diff --git a/dev/Boots/RainLoopApp.js b/dev/Boots/RainLoopApp.js index 119b778f3..941770778 100644 --- a/dev/Boots/RainLoopApp.js +++ b/dev/Boots/RainLoopApp.js @@ -215,26 +215,43 @@ RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFol self = this, oData = RL.data(), oCache = RL.cache(), - oTrashOrSpamFolder = oCache.getFolderFromCacheList( - Enums.FolderType.Spam === iDeleteType ? oData.spamFolder() : oData.trashFolder()) + oMoveFolder = null, + nSetSystemFoldersNotification = null ; + switch (iDeleteType) + { + case Enums.FolderType.Spam: + oMoveFolder = oCache.getFolderFromCacheList(oData.spamFolder()); + nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam; + break; + case Enums.FolderType.Trash: + oMoveFolder = oCache.getFolderFromCacheList(oData.trashFolder()); + nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash; + break; + case Enums.FolderType.Archive: + oMoveFolder = oCache.getFolderFromCacheList(oData.archiveFolder()); + nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive; + break; + } + bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder; if (bUseFolder) { if ((Enums.FolderType.Spam === iDeleteType && Consts.Values.UnuseOptionValue === oData.spamFolder()) || - (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === oData.trashFolder())) + (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === oData.trashFolder()) || + (Enums.FolderType.Archive === iDeleteType && Consts.Values.UnuseOptionValue === oData.archiveFolder())) { bUseFolder = false; } } - if (!oTrashOrSpamFolder && bUseFolder) + if (!oMoveFolder && bUseFolder) { - kn.showScreenPopup(PopupsFolderSystemViewModel, [ - Enums.FolderType.Spam === iDeleteType ? Enums.SetSystemFoldersNotification.Spam : Enums.SetSystemFoldersNotification.Trash]); + kn.showScreenPopup(PopupsFolderSystemViewModel, [nSetSystemFoldersNotification]); } - else if (!bUseFolder || (sFromFolderFullNameRaw === oData.spamFolder() || sFromFolderFullNameRaw === oData.trashFolder())) + else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType && + (sFromFolderFullNameRaw === oData.spamFolder() || sFromFolderFullNameRaw === oData.trashFolder()))) { kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () { @@ -248,16 +265,16 @@ RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFol }]); } - else if (oTrashOrSpamFolder) + else if (oMoveFolder) { RL.remote().messagesMove( this.moveOrDeleteResponseHelper, sFromFolderFullNameRaw, - oTrashOrSpamFolder.fullNameRaw, + oMoveFolder.fullNameRaw, aUidForRemove ); - oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oTrashOrSpamFolder.fullNameRaw); + oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw); } }; diff --git a/dev/Common/Enums.js b/dev/Common/Enums.js index 8580df4bb..7d74d4440 100644 --- a/dev/Common/Enums.js +++ b/dev/Common/Enums.js @@ -36,6 +36,7 @@ Enums.FolderType = { 'Draft': 12, 'Trash': 13, 'Spam': 14, + 'Archive': 15, 'User': 99 }; @@ -92,7 +93,8 @@ Enums.SetSystemFoldersNotification = { 'Sent': 1, 'Draft': 2, 'Spam': 3, - 'Trash': 4 + 'Trash': 4, + 'Archive': 5 }; /** @@ -254,6 +256,8 @@ Enums.ContactScopeType = { * @enum {number} */ Enums.SignedVerifyStatus = { + 'UnknownPublicKeys': -4, + 'UnknownPrivateKey': -3, 'Unverified': -2, 'Error': -1, 'None': 0, diff --git a/dev/Models/FolderModel.js b/dev/Models/FolderModel.js index d11ddab80..4742d4bef 100644 --- a/dev/Models/FolderModel.js +++ b/dev/Models/FolderModel.js @@ -207,6 +207,9 @@ FolderModel.prototype.initComputed = function () case Enums.FolderType.Trash: sName = Utils.i18n('FOLDER_LIST/TRASH_NAME'); break; + case Enums.FolderType.Archive: + sName = Utils.i18n('FOLDER_LIST/ARCHIVE_NAME'); + break; } } @@ -243,6 +246,9 @@ FolderModel.prototype.initComputed = function () case Enums.FolderType.Trash: sSuffix = '(' + Utils.i18n('FOLDER_LIST/TRASH_NAME') + ')'; break; + case Enums.FolderType.Archive: + sSuffix = '(' + Utils.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')'; + break; } } diff --git a/dev/Models/MessageModel.js b/dev/Models/MessageModel.js index 1acb36860..78fac6cc0 100644 --- a/dev/Models/MessageModel.js +++ b/dev/Models/MessageModel.js @@ -1046,7 +1046,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function () aRes = [], mPgpMessage = null, sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '', - aPublicKey = RL.data().findPublicKeysByEmail(sFrom), + aPublicKeys = RL.data().findPublicKeysByEmail(sFrom), oValidKey = null, oValidSysKey = null, sPlain = '' @@ -1060,9 +1060,10 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function () mPgpMessage = window.openpgp.cleartext.readArmored(this.plainRaw); if (mPgpMessage && mPgpMessage.getText) { - this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Unverified); + this.pgpSignedVerifyStatus( + aPublicKeys.length ? Enums.SignedVerifyStatus.Unverified : Enums.SignedVerifyStatus.UnknownPublicKeys); - aRes = mPgpMessage.verify(aPublicKey); + aRes = mPgpMessage.verify(aPublicKeys); if (aRes && 0 < aRes.length) { oValidKey = _.find(aRes, function (oItem) { @@ -1099,6 +1100,78 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function () } }; +MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword) +{ + if (this.isPgpEncrypted()) + { + var + aRes = [], + mPgpMessage = null, + mPgpMessageDecrypted = null, + sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '', + aPublicKey = RL.data().findPublicKeysByEmail(sFrom), + oPrivateKey = RL.data().findSelfPrivateKey(sPassword), + oValidKey = null, + oValidSysKey = null, + sPlain = '' + ; + + this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Error); + this.pgpSignedVerifyUser(''); + + if (!oPrivateKey) + { + this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.UnknownPrivateKey); + } + + try + { + mPgpMessage = window.openpgp.message.readArmored(this.plainRaw); + if (mPgpMessage && oPrivateKey && mPgpMessage.decrypt) + { + this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Unverified); + + mPgpMessageDecrypted = mPgpMessage.decrypt(oPrivateKey); + if (mPgpMessageDecrypted) + { + aRes = mPgpMessageDecrypted.verify(aPublicKey); + if (aRes && 0 < aRes.length) + { + oValidKey = _.find(aRes, function (oItem) { + return oItem && oItem.keyid && oItem.valid; + }); + + if (oValidKey) + { + oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); + if (oValidSysKey) + { + this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success); + this.pgpSignedVerifyUser(oValidSysKey.user); + } + } + } + + sPlain = mPgpMessageDecrypted.getText(); + + sPlain = + $proxyDiv.empty().append( + $('
').text(sPlain) + ).html() + ; + + $proxyDiv.empty(); + + this.replacePlaneTextBody(sPlain); + } + } + } + catch (oExc) {} + + this.storePgpVerifyDataToDom(); + } +}; + MessageModel.prototype.replacePlaneTextBody = function (sPlain) { if (this.body) diff --git a/dev/Storages/WebMailAjaxRemote.js b/dev/Storages/WebMailAjaxRemote.js index 5f4991a7e..f00c90357 100644 --- a/dev/Storages/WebMailAjaxRemote.js +++ b/dev/Storages/WebMailAjaxRemote.js @@ -22,7 +22,8 @@ WebMailAjaxRemoteStorage.prototype.folders = function (fCallback) 'SentFolder': RL.settingsGet('SentFolder'), 'DraftFolder': RL.settingsGet('DraftFolder'), 'SpamFolder': RL.settingsGet('SpamFolder'), - 'TrashFolder': RL.settingsGet('TrashFolder') + 'TrashFolder': RL.settingsGet('TrashFolder'), + 'ArchiveFolder': RL.settingsGet('ArchiveFolder') }, null, '', ['Folders']); }; diff --git a/dev/Storages/WebMailData.js b/dev/Storages/WebMailData.js index 328211f3b..5ec66a443 100644 --- a/dev/Storages/WebMailData.js +++ b/dev/Storages/WebMailData.js @@ -48,16 +48,19 @@ function WebMailDataStorage() this.draftFolder = ko.observable(''); this.spamFolder = ko.observable(''); this.trashFolder = ko.observable(''); + this.archiveFolder = ko.observable(''); this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange'); this.draftFolder.subscribe(fRemoveSystemFolderType(this.draftFolder), this, 'beforeChange'); this.spamFolder.subscribe(fRemoveSystemFolderType(this.spamFolder), this, 'beforeChange'); this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange'); + this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange'); this.sentFolder.subscribe(fSetSystemFolderType(Enums.FolderType.SentItems), this); this.draftFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Draft), this); this.spamFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Spam), this); this.trashFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Trash), this); + this.archiveFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Archive), this); this.draftFolderNotEnabled = ko.computed(function () { return '' === this.draftFolder() || Consts.Values.UnuseOptionValue === this.draftFolder(); @@ -138,7 +141,8 @@ function WebMailDataStorage() sSentFolder = this.sentFolder(), sDraftFolder = this.draftFolder(), sSpamFolder = this.spamFolder(), - sTrashFolder = this.trashFolder() + sTrashFolder = this.trashFolder(), + sArchiveFolder = this.archiveFolder() ; if (Utils.isArray(aFolders) && 0 < aFolders.length) @@ -159,6 +163,10 @@ function WebMailDataStorage() { aList.push(sTrashFolder); } + if ('' !== sArchiveFolder && Consts.Values.UnuseOptionValue !== sArchiveFolder) + { + aList.push(sArchiveFolder); + } } return aList; @@ -625,13 +633,15 @@ WebMailDataStorage.prototype.setFolders = function (oData) if (oData.Result['SystemFolders'] && '' === '' + RL.settingsGet('SentFolder') + RL.settingsGet('DraftFolder') + - RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('NullFolder')) + RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('ArchiveFolder') + + RL.settingsGet('NullFolder')) { // TODO Magic Numbers RL.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null); RL.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null); RL.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null); RL.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null); + RL.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null); bUpdate = true; } @@ -640,6 +650,7 @@ WebMailDataStorage.prototype.setFolders = function (oData) oRLData.draftFolder(fNormalizeFolder(RL.settingsGet('DraftFolder'))); oRLData.spamFolder(fNormalizeFolder(RL.settingsGet('SpamFolder'))); oRLData.trashFolder(fNormalizeFolder(RL.settingsGet('TrashFolder'))); + oRLData.archiveFolder(fNormalizeFolder(RL.settingsGet('ArchiveFolder'))); if (bUpdate) { @@ -648,6 +659,7 @@ WebMailDataStorage.prototype.setFolders = function (oData) 'DraftFolder': oRLData.draftFolder(), 'SpamFolder': oRLData.spamFolder(), 'TrashFolder': oRLData.trashFolder(), + 'ArchiveFolder': oRLData.archiveFolder(), 'NullFolder': 'NullFolder' }); } @@ -838,7 +850,6 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) sPlain = '', bPgpSigned = false, bPgpEncrypted = false, - mPgpMessage = null, oMessagesBodiesDom = this.messagesBodiesDom(), oMessage = this.message() ; @@ -903,12 +914,6 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) } else if (bPgpEncrypted && oMessage.isPgpEncrypted()) { -// try -// { -// mPgpMessage = window.openpgp.message.readArmored(oMessage.plainRaw); -// } -// catch (oExc) {} - sPlain = $proxyDiv.append( $('').text(oMessage.plainRaw) @@ -1157,7 +1162,12 @@ WebMailDataStorage.prototype.findPublicKeysByEmail = function (sEmail) })); }; -WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPass) +/** + * @param {string} sEmail + * @param {string=} sPassword + * @returns {?} + */ +WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword) { var oPrivateKey = null, @@ -1174,7 +1184,7 @@ WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPass) if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0]) { oPrivateKey = oPrivateKey.keys[0]; - oPrivateKey.decrypt(sPass); + oPrivateKey.decrypt(Utils.pString(sPassword)); } else { @@ -1189,3 +1199,12 @@ WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPass) return oPrivateKey; }; + +/** + * @param {string=} sPassword + * @returns {?} + */ +WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword) +{ + return this.findPrivateKeyByEmail(this.accountEmail(), sPassword); +}; diff --git a/dev/Styles/Layout.less b/dev/Styles/Layout.less index 012be1caf..016fb0c4d 100644 --- a/dev/Styles/Layout.less +++ b/dev/Styles/Layout.less @@ -90,6 +90,7 @@ html.ssm-state-desktop-large { } html.ssm-state-desktop { + #rl-left { width: @rlLeftWidth; } @@ -99,15 +100,16 @@ html.ssm-state-desktop { } #rl-sub-left { - width: 350px; + width: 400px; } #rl-sub-right { - left: 350px; + left: 400px; } } html.ssm-state-tablet { + #rl-left { width: 150px; } @@ -117,7 +119,7 @@ html.ssm-state-tablet { } #rl-sub-left { - width: 310px; + width: 340px; .messageList .inputSearch { width: 220px; @@ -125,7 +127,7 @@ html.ssm-state-tablet { } #rl-sub-right { - left: 310px; + left: 340px; } .b-compose.modal { @@ -147,7 +149,7 @@ html.ssm-state-mobile { } #rl-sub-left { - width: 310px; + width: 340px; .messageList .inputSearch { width: 220px; @@ -155,7 +157,7 @@ html.ssm-state-mobile { } #rl-sub-right { - left: 310px; + left: 340px; } .b-compose.modal { diff --git a/dev/Styles/_BootstrapFix.less b/dev/Styles/_BootstrapFix.less index 4db252734..ffa935df8 100644 --- a/dev/Styles/_BootstrapFix.less +++ b/dev/Styles/_BootstrapFix.less @@ -63,26 +63,39 @@ select { .border-radius(@btnBorderRadius); } +.btn-group + .btn-group { + margin-left: 3px; +} + .btn { .border-radius(@btnBorderRadius); background-image: none; + padding-left: 13px; + padding-right: 13px; &.disabled, &[disabled] { + .opacity(75); .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)"); } text-shadow: 0 1px 0 #fff; - &:active { +// &:active { // .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.3), 0 0 0 rgba(0,0,0,.1)"); +// } +} + +.btn.btn-dark-disabled-border { + &.disabled, &[disabled] { + border-color: #aaa; } } -.btn-group.open { - .dropdown-toggle { +//.btn-group.open { +// .dropdown-toggle { // .box-shadow(~"inset 0 2px 4px rgba(0,0,0,.3), 0 0 0 rgba(0,0,0,.1)"); - } -} +// } +//} html.rgba.textshadow { .btn.btn-danger, .btn.btn-success, .btn.btn-primary { diff --git a/dev/Styles/_Values.less b/dev/Styles/_Values.less index 7f09b44ff..a30e71fd4 100644 --- a/dev/Styles/_Values.less +++ b/dev/Styles/_Values.less @@ -19,7 +19,7 @@ @rlMessageDelimiterColor: #999; // bootstart -@btnBorderRadius: 2px; +@btnBorderRadius: 3px; @tooltipColor: #eee; @tooltipBackground: #333; diff --git a/dev/ViewModels/MailBoxMessageListViewModel.js b/dev/ViewModels/MailBoxMessageListViewModel.js index d16108741..92cae8938 100644 --- a/dev/ViewModels/MailBoxMessageListViewModel.js +++ b/dev/ViewModels/MailBoxMessageListViewModel.js @@ -109,15 +109,26 @@ function MailBoxMessageListViewModel() }, this); this.isSpamFolder = ko.computed(function () { - return RL.data().spamFolder() === this.messageListEndFolder(); + return oData.spamFolder() === this.messageListEndFolder() && + '' !== oData.spamFolder(); }, this); this.isSpamDisabled = ko.computed(function () { - return Consts.Values.UnuseOptionValue === RL.data().spamFolder(); + return Consts.Values.UnuseOptionValue === oData.spamFolder(); }, this); this.isTrashFolder = ko.computed(function () { - return RL.data().trashFolder() === this.messageListEndFolder(); + return oData.trashFolder() === this.messageListEndFolder() && + '' !== oData.trashFolder(); + }, this); + + this.isArchiveFolder = ko.computed(function () { + return oData.archiveFolder() === this.messageListEndFolder() && + '' !== oData.archiveFolder(); + }, this); + + this.isArchiveDisabled = ko.computed(function () { + return Consts.Values.UnuseOptionValue === RL.data().archiveFolder(); }, this); this.canBeMoved = this.hasCheckedOrSelectedLines; @@ -141,6 +152,12 @@ function MailBoxMessageListViewModel() RL.data().currentFolderFullNameRaw(), RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); }, this.canBeMoved); + + this.archiveCommand = Utils.createCommand(this, function () { + RL.deleteMessagesFromFolder(Enums.FolderType.Archive, + RL.data().currentFolderFullNameRaw(), + RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); + }, this.canBeMoved); this.spamCommand = Utils.createCommand(this, function () { RL.deleteMessagesFromFolder(Enums.FolderType.Spam, @@ -219,6 +236,15 @@ MailBoxMessageListViewModel.prototype.searchEnterAction = function () this.inputMessageListSearchFocus(false); }; +/** + * @returns {string} + */ +MailBoxMessageListViewModel.prototype.printableMessageCountForDeletion = function () +{ + var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length; + return 1 < iCnt ? ' (' + (100 > iCnt ? iCnt : '99+') + ')' : ''; +}; + MailBoxMessageListViewModel.prototype.cancelSearch = function () { this.mainMessageListSearch(''); diff --git a/dev/ViewModels/MailBoxMessageViewViewModel.js b/dev/ViewModels/MailBoxMessageViewViewModel.js index 48653eb7a..24874f9a9 100644 --- a/dev/ViewModels/MailBoxMessageViewViewModel.js +++ b/dev/ViewModels/MailBoxMessageViewViewModel.js @@ -36,8 +36,6 @@ function MailBoxMessageViewViewModel() this.fullScreenMode = oData.messageFullScreenMode; this.showFullInfo = ko.observable(false); - this.openPGPInformation = ko.observable(''); - this.openPGPInformation.isError = ko.observable(false); this.messageVisibility = ko.computed(function () { return !this.messageLoadingThrottle() && !!this.message(); @@ -80,6 +78,17 @@ function MailBoxMessageViewViewModel() }, this.messageVisibility); + this.archiveCommand = Utils.createCommand(this, function () { + + if (this.message()) + { + RL.deleteMessagesFromFolder(Enums.FolderType.Archive, + this.message().folderFullNameRaw, + [this.message().uid], true); + } + + }, this.messageVisibility); + this.spamCommand = Utils.createCommand(this, function () { if (this.message()) @@ -107,6 +116,7 @@ function MailBoxMessageViewViewModel() this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic); this.viewUserPicVisible = ko.observable(false); + this.viewPgpPassword = ko.observable(''); this.viewPgpSignedVerifyStatus = ko.computed(function () { return this.message() ? this.message().pgpSignedVerifyStatus() : Enums.SignedVerifyStatus.None; }, this); @@ -114,11 +124,14 @@ function MailBoxMessageViewViewModel() this.viewPgpSignedVerifyUser = ko.computed(function () { return this.message() ? this.message().pgpSignedVerifyUser() : ''; }, this); + this.message.subscribe(function (oMessage) { this.messageActiveDom(null); + this.viewPgpPassword(''); + if (oMessage) { this.viewSubject(oMessage.subject()); @@ -207,6 +220,12 @@ MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function () switch (this.viewPgpSignedVerifyStatus()) { // TODO i18n + case Enums.SignedVerifyStatus.UnknownPublicKeys: + sResult = 'No public keys found'; + break; + case Enums.SignedVerifyStatus.UnknownPrivateKey: + sResult = 'No private key found'; + break; case Enums.SignedVerifyStatus.Unverified: sResult = 'Unverified signature'; break; @@ -359,6 +378,38 @@ MailBoxMessageViewViewModel.prototype.isSentFolder = function () return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw; }; +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isSpamFolder = function () +{ + return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw; +}; + +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isSpamDisabled = function () +{ + return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue; +}; + +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isArchiveFolder = function () +{ + return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw; +}; + +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function () +{ + return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue; +}; + /** * @return {boolean} */ @@ -417,7 +468,7 @@ MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMe { if (oMessage) { - oMessage.decryptPgpEncryptedMessage(); + oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword()); } }; diff --git a/dev/ViewModels/PopupsComposeOpenPgpViewModel.js b/dev/ViewModels/PopupsComposeOpenPgpViewModel.js index c35205b6c..7695ed5bf 100644 --- a/dev/ViewModels/PopupsComposeOpenPgpViewModel.js +++ b/dev/ViewModels/PopupsComposeOpenPgpViewModel.js @@ -64,7 +64,8 @@ function PopupsComposeOpenPgpViewModel() if (bResult && this.encrypt()) { - aPublicKeys = _.compact(_.union(this.to(), function (sEmail) { + aPublicKeys = []; + _.each(this.to(), function (sEmail) { var aKeys = oData.findPublicKeysByEmail(sEmail); if (0 === aKeys.length && bResult) { @@ -72,11 +73,10 @@ function PopupsComposeOpenPgpViewModel() self.notification('No public key found for "' + sEmail + '" email'); bResult = false; } - - return aKeys; - - })); + aPublicKeys = aPublicKeys.concat(aKeys); + }); + if (bResult && (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length)) { bResult = false; diff --git a/dev/ViewModels/PopupsFolderSystemViewModel.js b/dev/ViewModels/PopupsFolderSystemViewModel.js index 64ba9b2d6..4be574caf 100644 --- a/dev/ViewModels/PopupsFolderSystemViewModel.js +++ b/dev/ViewModels/PopupsFolderSystemViewModel.js @@ -33,6 +33,7 @@ function PopupsFolderSystemViewModel() this.draftFolder = oData.draftFolder; this.spamFolder = oData.spamFolder; this.trashFolder = oData.trashFolder; + this.archiveFolder = oData.archiveFolder; fSaveSystemFolders = _.debounce(function () { @@ -40,12 +41,14 @@ function PopupsFolderSystemViewModel() RL.settingsSet('DraftFolder', self.draftFolder()); RL.settingsSet('SpamFolder', self.spamFolder()); RL.settingsSet('TrashFolder', self.trashFolder()); + RL.settingsSet('ArchiveFolder', self.archiveFolder()); RL.remote().saveSystemFolders(Utils.emptyFunction, { 'SentFolder': self.sentFolder(), 'DraftFolder': self.draftFolder(), 'SpamFolder': self.spamFolder(), 'TrashFolder': self.trashFolder(), + 'ArchiveFolder': self.archiveFolder(), 'NullFolder': 'NullFolder' }); @@ -57,6 +60,7 @@ function PopupsFolderSystemViewModel() RL.settingsSet('DraftFolder', self.draftFolder()); RL.settingsSet('SpamFolder', self.spamFolder()); RL.settingsSet('TrashFolder', self.trashFolder()); + RL.settingsSet('ArchiveFolder', self.archiveFolder()); fSaveSystemFolders(); }; @@ -65,6 +69,7 @@ function PopupsFolderSystemViewModel() this.draftFolder.subscribe(fCallback); this.spamFolder.subscribe(fCallback); this.trashFolder.subscribe(fCallback); + this.archiveFolder.subscribe(fCallback); this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; @@ -99,6 +104,9 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType) case Enums.SetSystemFoldersNotification.Trash: sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH'); break; + case Enums.SetSystemFoldersNotification.Archive: + sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE'); + break; } this.notification(sNotification); diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php index 156e5c4d9..3a3b1b7b9 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Imap/Enumerations/FolderType.php @@ -17,5 +17,5 @@ class FolderType const TRASH = 5; const IMPORTANT = 10; const STARRED = 11; - const ALLMAIL = 12; + const ARCHIVE = 12; } diff --git a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php index dd3b512aa..070716b34 100644 --- a/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php +++ b/rainloop/v/0.0.0/app/libraries/MailSo/Mail/Folder.php @@ -295,7 +295,7 @@ class Folder case \in_array('\all', $aFlags): case \in_array('\archive', $aFlags): case \in_array('\allmail', $aFlags): - $iXListType = \MailSo\Imap\Enumerations\FolderType::ALLMAIL; + $iXListType = \MailSo\Imap\Enumerations\FolderType::ARCHIVE; break; } } diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 6734598a2..676b5d866 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -1162,6 +1162,7 @@ class Actions $aResult['DraftFolder'] = $oSettings->GetConf('DraftFolder', ''); $aResult['SpamFolder'] = $oSettings->GetConf('SpamFolder', ''); $aResult['TrashFolder'] = $oSettings->GetConf('TrashFolder', ''); + $aResult['ArchiveFolder'] = $oSettings->GetConf('ArchiveFolder', ''); $aResult['NullFolder'] = $oSettings->GetConf('NullFolder', ''); $aResult['EditorDefaultType'] = $oSettings->GetConf('EditorDefaultType', $aResult['EditorDefaultType']); $aResult['ShowImages'] = (bool) $oSettings->GetConf('ShowImages', $aResult['ShowImages']); @@ -1909,8 +1910,9 @@ class Actions $oSettings->SetConf('SentFolder', $this->GetActionParam('SentFolder', '')); $oSettings->SetConf('DraftFolder', $this->GetActionParam('DraftFolder', '')); - $oSettings->SetConf('TrashFolder', $this->GetActionParam('TrashFolder', '')); $oSettings->SetConf('SpamFolder', $this->GetActionParam('SpamFolder', '')); + $oSettings->SetConf('TrashFolder', $this->GetActionParam('TrashFolder', '')); + $oSettings->SetConf('ArchiveFolder', $this->GetActionParam('ArchiveFolder', '')); $oSettings->SetConf('NullFolder', $this->GetActionParam('NullFolder', '')); return $this->DefaultResponse(__FUNCTION__, @@ -3347,6 +3349,7 @@ class Actions $aCache = array( 'Sent' => \MailSo\Imap\Enumerations\FolderType::SENT, + 'Send' => \MailSo\Imap\Enumerations\FolderType::SENT, 'Sent Item' => \MailSo\Imap\Enumerations\FolderType::SENT, 'Sent Items' => \MailSo\Imap\Enumerations\FolderType::SENT, @@ -3358,6 +3361,7 @@ class Actions 'Send Mails' => \MailSo\Imap\Enumerations\FolderType::SENT, 'Draft' => \MailSo\Imap\Enumerations\FolderType::DRAFTS, + 'Drafts' => \MailSo\Imap\Enumerations\FolderType::DRAFTS, 'Draft Mail' => \MailSo\Imap\Enumerations\FolderType::DRAFTS, 'Draft Mails' => \MailSo\Imap\Enumerations\FolderType::DRAFTS, @@ -3365,14 +3369,22 @@ class Actions 'Drafts Mails' => \MailSo\Imap\Enumerations\FolderType::DRAFTS, 'Spam' => \MailSo\Imap\Enumerations\FolderType::SPAM, + 'Junk' => \MailSo\Imap\Enumerations\FolderType::SPAM, 'Bulk Mail' => \MailSo\Imap\Enumerations\FolderType::SPAM, 'Bulk Mails' => \MailSo\Imap\Enumerations\FolderType::SPAM, 'Trash' => \MailSo\Imap\Enumerations\FolderType::TRASH, 'Deleted' => \MailSo\Imap\Enumerations\FolderType::TRASH, - 'Bin' => \MailSo\Imap\Enumerations\FolderType::TRASH + 'Bin' => \MailSo\Imap\Enumerations\FolderType::TRASH, + 'Archive' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE, + + 'All' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE, + 'All Mail' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE, + 'All Mails' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE, + 'AllMail' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE, + 'AllMails' => \MailSo\Imap\Enumerations\FolderType::ARCHIVE, ); $this->Plugins()->RunHook('filter.system-folders-names', array($oAccount, &$aCache)); @@ -3403,7 +3415,8 @@ class Actions \MailSo\Imap\Enumerations\FolderType::SENT, \MailSo\Imap\Enumerations\FolderType::DRAFTS, \MailSo\Imap\Enumerations\FolderType::SPAM, - \MailSo\Imap\Enumerations\FolderType::TRASH + \MailSo\Imap\Enumerations\FolderType::TRASH, + \MailSo\Imap\Enumerations\FolderType::ARCHIVE ))) { $aResult[$iFolderXListType] = $oFolder->FullNameRaw(); @@ -3428,7 +3441,8 @@ class Actions \MailSo\Imap\Enumerations\FolderType::SENT, \MailSo\Imap\Enumerations\FolderType::DRAFTS, \MailSo\Imap\Enumerations\FolderType::SPAM, - \MailSo\Imap\Enumerations\FolderType::TRASH + \MailSo\Imap\Enumerations\FolderType::TRASH, + \MailSo\Imap\Enumerations\FolderType::ARCHIVE ))) { $aResult[$iFolderType] = $oFolder->FullNameRaw(); @@ -3473,6 +3487,7 @@ class Actions if ($oFolderCollection instanceof \MailSo\Mail\FolderCollection) { $aSystemFolders = array(); + $this->recFoldersTypes($oAccount, $oFolderCollection, $aSystemFolders); $oFolderCollection->SystemFolders = $aSystemFolders; @@ -3500,6 +3515,10 @@ class Actions { $aList[] = \MailSo\Imap\Enumerations\FolderType::TRASH; } + if ('' === $this->GetActionParam('ArchiveFolder', '')) + { + $aList[] = \MailSo\Imap\Enumerations\FolderType::ARCHIVE; + } $this->Plugins()->RunHook('filter.folders-system-types', array($oAccount, &$aList)); @@ -6284,8 +6303,9 @@ class Actions */ private function hashFolderFullName($sFolderFullName) { - return \in_array(\strtolower($sFolderFullName), array('inbox', 'sent', 'send', 'drafts', 'spam', 'junk', 'bin', 'trash')) ? - \ucfirst(\strtolower($sFolderFullName)) : \md5($sFolderFullName); + return \in_array(\strtolower($sFolderFullName), array('inbox', 'sent', 'send', 'drafts', + 'spam', 'junk', 'bin', 'trash', 'archive', 'allmail')) ? + \ucfirst(\strtolower($sFolderFullName)) : \md5($sFolderFullName); // return \in_array(\strtolower($sFolderFullName), array('inbox', 'sent', 'send', 'drafts', 'spam', 'junk', 'bin', 'trash')) ? // \ucfirst(\strtolower($sFolderFullName)) : diff --git a/rainloop/v/0.0.0/app/templates/Views/MailMessageList.html b/rainloop/v/0.0.0/app/templates/Views/MailMessageList.html index faa6d7404..fd95cb9e3 100644 --- a/rainloop/v/0.0.0/app/templates/Views/MailMessageList.html +++ b/rainloop/v/0.0.0/app/templates/Views/MailMessageList.html @@ -21,14 +21,17 @@]*>/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,"")},V.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},V.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},V.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:V.isUnd(c)?a.toString():c.toString(),custom:V.isUnd(c)?!1:!0,title:V.isUnd(c)?"":a.toString(),value:a.toString()};(V.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}},V.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()}},V.openPgpImportPublicKeys=function(b){if(a.openpgp&&fb){var c=fb.data().openpgpKeyring,d=a.openpgp.key.readArmored(b);if(c&&d&&!d.err&&V.isArray(d.keys)&&0>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 X._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;c d?(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(!Y.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+V.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={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&&!V.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&&!V.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.modal={init:function(a,d){b(a).toggleClass("fade",!Y.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){V.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){V.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),V.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=V.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=V.pInt(e[2]),g=cb.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(!Y.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),V.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),V.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(){V.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Y.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){Y.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){fb.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=V.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.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(V.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},V.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=V.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=V.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),V.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return V.isUnd(a)||""===a||(b+="/"+a),b},g.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},g.prototype.mailBox=function(a,b,c){b=V.isNormal(b)?V.pInt(b):1,c=V.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},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},W.oViewModelsHooks={},W.oSimpleHooks={},W.regViewModelHook=function(a,b){b&&(b.__hookName=a)},W.addHook=function(a,b){V.isFunc(b)&&(V.isArray(W.oSimpleHooks[a])||(W.oSimpleHooks[a]=[]),W.oSimpleHooks[a].push(b))},W.runHook=function(a,b){V.isArray(W.oSimpleHooks[a])&&(b=b||[],f.each(W.oSimpleHooks[a],function(a){a.apply(null,b)}))},W.mainSettingsGet=function(a){return fb?fb.settingsGet(a):null},W.remoteRequest=function(a,b,c,d,e,f){fb&&fb.remote().defaultRequest(a,b,c,d,e,f)},W.settingsGet=function(a,b){var c=W.mainSettingsGet("Plugins");return c=c&&V.isUnd(c[a])?null:c[a],c?V.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(S.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(S.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(S.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!V.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[S.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[S.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[S.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!V.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},l.prototype.registerPopupEscapeKey=function(){var a=this;cb.on("keydown",function(b){return b&&T.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()?(V.delegateRun(a,"cancelCommand"),!1):!0})},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;V.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||V.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){V.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return V.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||V.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=fb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=V.createCommand(e,function(){$.hideScreenPopup(a)})),W.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),V.delegateRun(e,"onBuild",[h]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),W.runHook("view-model-post-build",[a.__name,e,h])):V.log("Cannot find view model position: "+f)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),V.delegateRun(a.__vm,"onHide"),fb.popupVisibilityNames.remove(a.__name),W.runHook("view-model-on-hide",[a.__name,a.__vm]),f.delay(function(){a.__dom.hide()},300))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),V.delegateRun(a.__vm,"onShow",b||[]),fb.popupVisibilityNames.push(a.__name),W.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),V.delegateRun(a.__vm,"onFocus",[],500)))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===V.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,V.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),V.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(V.delegateRun(c.oCurrentScreen,"onHide"),V.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),V.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(V.delegateRun(c.oCurrentScreen,"onShow"),W.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),V.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),V.delegateRun(a.__vm,"onShow"),V.delegateRun(a.__vm,"onFocus",[],200),W.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),W.runHook("screen-pre-start",[a.screenName(),a]),V.delegateRun(a,"onStart"),W.runHook("screen-post-start",[a.screenName(),a])) +!function(a,b,c,d,e,f){"use strict";function g(){this.sBase="#/",this.sCdnStaticDomain=fb.settingsGet("CdnStaticDomain"),this.sVersion=fb.settingsGet("Version"),this.sSpecSuffix=fb.settingsGet("AuthAccountHash")||"0",this.sServer=(fb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function h(){}function i(){}function j(){var a=[i,h],b=f.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function k(){}function l(a,b){this.bDisabeCloseOnEsc=!1,this.sPosition=V.pString(a),this.sTemplate=V.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function m(a,b){this.sScreenName=a,this.aViewModels=V.isArray(b)?b:[]}function n(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null}function o(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function p(){l.call(this,"Popups","PopupsDomain"),this.edit=c.observable(!1),this.saving=c.observable(!1),this.savingError=c.observable(""),this.whiteListPage=c.observable(!1),this.testing=c.observable(!1),this.testingDone=c.observable(!1),this.testingImapError=c.observable(!1),this.testingSmtpError=c.observable(!1),this.imapServerFocus=c.observable(!1),this.smtpServerFocus=c.observable(!1),this.name=c.observable(""),this.name.focused=c.observable(!1),this.imapServer=c.observable(""),this.imapPort=c.observable(S.Values.ImapDefaulPort),this.imapSecure=c.observable(T.ServerSecure.None),this.imapShortLogin=c.observable(!1),this.smtpServer=c.observable(""),this.smtpPort=c.observable(S.Values.SmtpDefaulPort),this.smtpSecure=c.observable(T.ServerSecure.None),this.smtpShortLogin=c.observable(!1),this.smtpAuth=c.observable(!0),this.whiteList=c.observable(""),this.imapServerFocus.subscribe(function(a){a&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(a){a&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer().replace(/imap/gi,"smtp"))},this),this.headerText=c.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this),this.domainIsComputed=c.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=c.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=c.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=V.createCommand(this,function(){this.saving(!0),fb.remote().createOrUpdateDomain(f.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=V.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),fb.remote().testConnectionForDomain(f.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=V.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),n.constructorEnd(this)}function q(){l.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=f.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=c.observable(""),this.name=c.observable(""),this.readme=c.observable(""),this.configures=c.observableArray([]),this.hasReadme=c.computed(function(){return""!==this.readme()},this),this.hasConfiguration=c.computed(function(){return 0').appendTo("body"),cb.on("error",function(a){fb&&a&&a.originalEvent&&a.originalEvent.message&&-1===V.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&fb.remote().jsError(V.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",bb.attr("class"),V.microtime()-Y.now)})}function R(){Q.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var S={},T={},U={},V={},W={},X={},Y={},Z={settings:[],"settings-removed":[],"settings-disabled":[]},$=null,_=a.rainloopAppData||{},ab=a.rainloopI18N||{},bb=b("html"),cb=b(a),db=b(a.document),eb=a.Notification&&a.Notification.requestPermission?a.Notification:null,fb=null;Y.now=(new Date).getTime(),Y.momentTrigger=c.observable(!0),Y.langChangeTrigger=c.observable(!0),Y.iAjaxErrorCount=0,Y.iTokenErrorCount=0,Y.iMessageBodyCacheCount=0,Y.bUnload=!1,Y.sUserAgent=(navigator.userAgent||"").toLowerCase(),Y.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},V.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=V.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},V.timeOutAction=function(){var b={};return function(c,d,e){V.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),V.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),V.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Y.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}}(),V.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},V.i18n=function(a,b,c){var d="",e=V.isUnd(ab[a])?V.isUnd(c)?a:c:ab[a];if(!V.isUnd(b)&&!V.isNull(b))for(d in b)V.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},V.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(V.i18n(c)):(c=a.data("i18n-html"),c&&a.html(V.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",V.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",V.i18n(c)))})})},V.i18nToDoc=function(){a.rainloopI18N&&(ab=a.rainloopI18N||{},V.i18nToNode(db),Y.langChangeTrigger(!Y.langChangeTrigger())),a.rainloopI18N={}},V.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Y.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Y.langChangeTrigger.subscribe(a,b)},V.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)},V.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},V.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()},V.replySubjectAdd=function(b,c,d){var e=null,f=V.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||V.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||V.isUnd(e[1])||V.isUnd(e[2])||V.isUnd(e[3])?b+": "+c:e[1]+(V.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(V.isUnd(d)?!0:d)?V.fixLongSubject(f):f},V.fixLongSubject=function(a){var b=0,c=null;a=V.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||V.isUnd(c[0]))&&(c=null),c&&(b=0,b+=V.isUnd(c[2])?1:0+V.pInt(c[2]),b+=V.isUnd(c[4])?1:0+V.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]+/," ")},V.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},V.friendlySize=function(a){return a=V.pInt(a),a>=1073741824?V.roundNumber(a/1073741824,1)+"GB":a>=1048576?V.roundNumber(a/1048576,1)+"MB":a>=1024?V.roundNumber(a/1024,0)+"KB":a+"B"},V.log=function(b){a.console&&a.console.log&&a.console.log(b)},V.getNotification=function(a,b){return a=V.pInt(a),T.Notification.ClientViewError===a&&b?b:V.isUnd(U[a])?"":U[a]},V.initNotificationLanguage=function(){U[T.Notification.InvalidToken]=V.i18n("NOTIFICATIONS/INVALID_TOKEN"),U[T.Notification.AuthError]=V.i18n("NOTIFICATIONS/AUTH_ERROR"),U[T.Notification.AccessError]=V.i18n("NOTIFICATIONS/ACCESS_ERROR"),U[T.Notification.ConnectionError]=V.i18n("NOTIFICATIONS/CONNECTION_ERROR"),U[T.Notification.CaptchaError]=V.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),U[T.Notification.SocialFacebookLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),U[T.Notification.SocialTwitterLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),U[T.Notification.SocialGoogleLoginAccessDisable]=V.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),U[T.Notification.DomainNotAllowed]=V.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),U[T.Notification.AccountNotAllowed]=V.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),U[T.Notification.CantGetMessageList]=V.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),U[T.Notification.CantGetMessage]=V.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),U[T.Notification.CantDeleteMessage]=V.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),U[T.Notification.CantMoveMessage]=V.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),U[T.Notification.CantCopyMessage]=V.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),U[T.Notification.CantSaveMessage]=V.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),U[T.Notification.CantSendMessage]=V.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),U[T.Notification.InvalidRecipients]=V.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),U[T.Notification.CantCreateFolder]=V.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),U[T.Notification.CantRenameFolder]=V.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),U[T.Notification.CantDeleteFolder]=V.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),U[T.Notification.CantDeleteNonEmptyFolder]=V.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),U[T.Notification.CantSubscribeFolder]=V.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),U[T.Notification.CantUnsubscribeFolder]=V.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),U[T.Notification.CantSaveSettings]=V.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),U[T.Notification.CantSavePluginSettings]=V.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),U[T.Notification.DomainAlreadyExists]=V.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),U[T.Notification.CantInstallPackage]=V.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),U[T.Notification.CantDeletePackage]=V.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),U[T.Notification.InvalidPluginPackage]=V.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),U[T.Notification.UnsupportedPluginPackage]=V.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),U[T.Notification.LicensingServerIsUnavailable]=V.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),U[T.Notification.LicensingExpired]=V.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),U[T.Notification.LicensingBanned]=V.i18n("NOTIFICATIONS/LICENSING_BANNED"),U[T.Notification.DemoSendMessageError]=V.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),U[T.Notification.AccountAlreadyExists]=V.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),U[T.Notification.MailServerError]=V.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),U[T.Notification.UnknownNotification]=V.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),U[T.Notification.UnknownError]=V.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},V.getUploadErrorDescByCode=function(a){var b="";switch(V.pInt(a)){case T.UploadErrorCode.FileIsTooBig:b=V.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case T.UploadErrorCode.FilePartiallyUploaded:b=V.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case T.UploadErrorCode.FileNoUploaded:b=V.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case T.UploadErrorCode.MissingTempFolder:b=V.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case T.UploadErrorCode.FileOnSaveingError:b=V.i18n("UPLOAD/ERROR_ON_SAVING_FILE"); +break;case T.UploadErrorCode.FileType:b=V.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=V.i18n("UPLOAD/ERROR_UNKNOWN")}return b},V.delegateRun=function(a,b,c,d){a&&a[b]&&(d=V.pInt(d),0>=d?a[b].apply(a,V.isArray(c)?c:[]):f.delay(function(){a[b].apply(a,V.isArray(c)?c:[])},d))},V.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===T.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===T.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},V.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=V.isUnd(d)?!0:d,e.canExecute=c.computed(V.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},V.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(T.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(T.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Y.sAnimationType=T.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(T.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return T.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Y.bMobileDevice||a===T.InterfaceAnimation.None)bb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Y.sAnimationType=T.InterfaceAnimation.None;else switch(a){case T.InterfaceAnimation.Full:bb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Y.sAnimationType=a;break;case T.InterfaceAnimation.Normal:bb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Y.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=T.DesktopNotifications.NotSupported;if(eb&&eb.permission)switch(eb.permission.toLowerCase()){case"granted":c=T.DesktopNotifications.Allowed;break;case"denied":c=T.DesktopNotifications.Denied;break;case"default":c=T.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&T.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();T.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):T.DesktopNotifications.NotAllowed===c?eb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),T.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")?V.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?V.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},V.isFolderExpanded=function(a){var b=fb.local().get(T.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},V.setExpandedFolder=function(a,b){var c=fb.local().get(T.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),fb.local().set(T.ClientSideKeyName.ExpandedFolders,c)},V.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=fb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(fb.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})},V.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&&0 100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),V.windowResize()}).after("
").before("
"))})}},V.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()}))},V.extendAsViewModel=function(a,b,c){b&&(c||(c=l),b.__name=a,W.regViewModelHook(a,b),f.extend(b.prototype,c.prototype))},V.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Z.settings.push(a)},V.removeSettingsViewModel=function(a){Z["settings-removed"].push(a)},V.disableSettingsViewModel=function(a){Z["settings-disabled"].push(a)},V.convertThemeName=function(a){return V.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},V.quoteName=function(a){return a.replace(/["]/g,'\\"')},V.microtime=function(){return(new Date).getTime()},V.convertLangName=function(a,b){return V.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},V.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=V.isUnd(a)?32:V.pInt(a);b.length/g,">").replace(/")},V.draggeblePlace=function(){return b('').appendTo("#rl-hidden")},V.defautOptionsAfterRender=function(a,b){b&&!V.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},V.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+V.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")),V.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+V.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)},V.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=V.isUnd(d)?1e3:V.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?T.SaveSettingsStep.TrueResult:T.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,T.SaveSettingsStep.Idle)},d)}},V.settingsSaveHelperSimpleFunction=function(a,b){return V.settingsSaveHelperFunction(null,a,b,1e3)},V.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,"")},V.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},V.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},V.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:V.isUnd(c)?a.toString():c.toString(),custom:V.isUnd(c)?!1:!0,title:V.isUnd(c)?"":a.toString(),value:a.toString()};(V.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}},V.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()}},V.openPgpImportPublicKeys=function(b){if(a.openpgp&&fb){var c=fb.data().openpgpKeyring,d=a.openpgp.key.readArmored(b);if(c&&d&&!d.err&&V.isArray(d.keys)&&0>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 X._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;c d?(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(!Y.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+V.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={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&&!V.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&&!V.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.modal={init:function(a,d){b(a).toggleClass("fade",!Y.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){V.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){V.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),V.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=V.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=V.pInt(e[2]),g=cb.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(!Y.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),V.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),V.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(){V.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Y.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){Y.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){fb.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=V.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.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(V.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},V.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=V.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=V.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),V.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return V.isUnd(a)||""===a||(b+="/"+a),b},g.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},g.prototype.mailBox=function(a,b,c){b=V.isNormal(b)?V.pInt(b):1,c=V.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},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},W.oViewModelsHooks={},W.oSimpleHooks={},W.regViewModelHook=function(a,b){b&&(b.__hookName=a)},W.addHook=function(a,b){V.isFunc(b)&&(V.isArray(W.oSimpleHooks[a])||(W.oSimpleHooks[a]=[]),W.oSimpleHooks[a].push(b))},W.runHook=function(a,b){V.isArray(W.oSimpleHooks[a])&&(b=b||[],f.each(W.oSimpleHooks[a],function(a){a.apply(null,b)}))},W.mainSettingsGet=function(a){return fb?fb.settingsGet(a):null},W.remoteRequest=function(a,b,c,d,e,f){fb&&fb.remote().defaultRequest(a,b,c,d,e,f)},W.settingsGet=function(a,b){var c=W.mainSettingsGet("Plugins");return c=c&&V.isUnd(c[a])?null:c[a],c?V.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(S.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(S.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(S.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!V.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[S.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[S.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[S.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!V.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},l.prototype.registerPopupEscapeKey=function(){var a=this;cb.on("keydown",function(b){return b&&T.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()?(V.delegateRun(a,"cancelCommand"),!1):!0})},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;V.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||V.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){V.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return V.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||V.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=fb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=V.createCommand(e,function(){$.hideScreenPopup(a)})),W.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),V.delegateRun(e,"onBuild",[h]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),W.runHook("view-model-post-build",[a.__name,e,h])):V.log("Cannot find view model position: "+f)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),V.delegateRun(a.__vm,"onHide"),fb.popupVisibilityNames.remove(a.__name),W.runHook("view-model-on-hide",[a.__name,a.__vm]),f.delay(function(){a.__dom.hide()},300))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),V.delegateRun(a.__vm,"onShow",b||[]),fb.popupVisibilityNames.push(a.__name),W.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),V.delegateRun(a.__vm,"onFocus",[],500)))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===V.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,V.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),V.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(V.delegateRun(c.oCurrentScreen,"onHide"),V.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),V.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(V.delegateRun(c.oCurrentScreen,"onShow"),W.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),V.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),V.delegateRun(a.__vm,"onShow"),V.delegateRun(a.__vm,"onFocus",[],200),W.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),W.runHook("screen-pre-start",[a.screenName(),a]),V.delegateRun(a,"onStart"),W.runHook("screen-post-start",[a.screenName(),a])) },this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),f.delay(function(){bb.removeClass("rl-started-trigger").addClass("rl-started")},50)},n.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=V.isUnd(c)?!1:!!c,(V.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)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},$=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.clear=function(){this.email="",this.name="",this.privateType=null},o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=T.EmailType.Facebook),null===this.privateType&&(this.privateType=T.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){this.clear(),a=V.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)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=V.trim(a.Name),this.email=V.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=V.isUnd(b)?!1:!!b,c=V.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+V.encodeHtml(this.name)+"":c?V.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=V.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+V.encodeHtml(d)+""+V.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=V.encodeHtml(d))):b&&(d=''+V.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=V.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(h),e.data=fb.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),V.delegateRun(e,"onBuild",[i])):V.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(V.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),V.delegateRun(d.oCurrentSubScreen,"onShow"),V.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),f.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)),V.windowResize()})):$.setHash(fb.link().settings(),!1,!0)},N.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(V.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},N.prototype.onBuild=function(){f.each(Z.settings,function(a){a&&a.__rlSettingsData&&!f.find(Z["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!f.find(Z["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},N.prototype.routes=function(){var a=f.find(Z.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=V.isUnd(c.subname)?b:V.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(O.prototype,m.prototype),O.prototype.onShow=function(){fb.setTitle("")},f.extend(P.prototype,N.prototype),P.prototype.onShow=function(){fb.setTitle("")},f.extend(Q.prototype,k.prototype),Q.prototype.oSettings=null,Q.prototype.oPlugins=null,Q.prototype.oLocal=null,Q.prototype.oLink=null,Q.prototype.oSubs={},Q.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):(Y.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},Q.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},Q.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},Q.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=V.isNormal(_)?_:{}),V.isUnd(this.oSettings[a])?null:this.oSettings[a]},Q.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=V.isNormal(_)?_:{}),this.oSettings[a]=b},Q.prototype.setTitle=function(b){b=(V.isNormal(b)&&00&&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=V.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=V.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=V.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},o.prototype.inputoTagLine=function(){return 0 (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&&0 ').text(sPlain) + ).html() + ; + + $proxyDiv.empty(); + + this.replacePlaneTextBody(sPlain); + } + } + } + catch (oExc) {} + + this.storePgpVerifyDataToDom(); + } +}; + MessageModel.prototype.replacePlaneTextBody = function (sPlain) { if (this.body) @@ -7334,6 +7411,9 @@ FolderModel.prototype.initComputed = function () case Enums.FolderType.Trash: sName = Utils.i18n('FOLDER_LIST/TRASH_NAME'); break; + case Enums.FolderType.Archive: + sName = Utils.i18n('FOLDER_LIST/ARCHIVE_NAME'); + break; } } @@ -7370,6 +7450,9 @@ FolderModel.prototype.initComputed = function () case Enums.FolderType.Trash: sSuffix = '(' + Utils.i18n('FOLDER_LIST/TRASH_NAME') + ')'; break; + case Enums.FolderType.Archive: + sSuffix = '(' + Utils.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')'; + break; } } @@ -7788,6 +7871,7 @@ function PopupsFolderSystemViewModel() this.draftFolder = oData.draftFolder; this.spamFolder = oData.spamFolder; this.trashFolder = oData.trashFolder; + this.archiveFolder = oData.archiveFolder; fSaveSystemFolders = _.debounce(function () { @@ -7795,12 +7879,14 @@ function PopupsFolderSystemViewModel() RL.settingsSet('DraftFolder', self.draftFolder()); RL.settingsSet('SpamFolder', self.spamFolder()); RL.settingsSet('TrashFolder', self.trashFolder()); + RL.settingsSet('ArchiveFolder', self.archiveFolder()); RL.remote().saveSystemFolders(Utils.emptyFunction, { 'SentFolder': self.sentFolder(), 'DraftFolder': self.draftFolder(), 'SpamFolder': self.spamFolder(), 'TrashFolder': self.trashFolder(), + 'ArchiveFolder': self.archiveFolder(), 'NullFolder': 'NullFolder' }); @@ -7812,6 +7898,7 @@ function PopupsFolderSystemViewModel() RL.settingsSet('DraftFolder', self.draftFolder()); RL.settingsSet('SpamFolder', self.spamFolder()); RL.settingsSet('TrashFolder', self.trashFolder()); + RL.settingsSet('ArchiveFolder', self.archiveFolder()); fSaveSystemFolders(); }; @@ -7820,6 +7907,7 @@ function PopupsFolderSystemViewModel() this.draftFolder.subscribe(fCallback); this.spamFolder.subscribe(fCallback); this.trashFolder.subscribe(fCallback); + this.archiveFolder.subscribe(fCallback); this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; @@ -7854,6 +7942,9 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType) case Enums.SetSystemFoldersNotification.Trash: sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH'); break; + case Enums.SetSystemFoldersNotification.Archive: + sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE'); + break; } this.notification(sNotification); @@ -10468,7 +10559,8 @@ function PopupsComposeOpenPgpViewModel() if (bResult && this.encrypt()) { - aPublicKeys = _.compact(_.union(this.to(), function (sEmail) { + aPublicKeys = []; + _.each(this.to(), function (sEmail) { var aKeys = oData.findPublicKeysByEmail(sEmail); if (0 === aKeys.length && bResult) { @@ -10476,11 +10568,10 @@ function PopupsComposeOpenPgpViewModel() self.notification('No public key found for "' + sEmail + '" email'); bResult = false; } - - return aKeys; - - })); + aPublicKeys = aPublicKeys.concat(aKeys); + }); + if (bResult && (0 === aPublicKeys.length || this.to().length !== aPublicKeys.length)) { bResult = false; @@ -11534,15 +11625,26 @@ function MailBoxMessageListViewModel() }, this); this.isSpamFolder = ko.computed(function () { - return RL.data().spamFolder() === this.messageListEndFolder(); + return oData.spamFolder() === this.messageListEndFolder() && + '' !== oData.spamFolder(); }, this); this.isSpamDisabled = ko.computed(function () { - return Consts.Values.UnuseOptionValue === RL.data().spamFolder(); + return Consts.Values.UnuseOptionValue === oData.spamFolder(); }, this); this.isTrashFolder = ko.computed(function () { - return RL.data().trashFolder() === this.messageListEndFolder(); + return oData.trashFolder() === this.messageListEndFolder() && + '' !== oData.trashFolder(); + }, this); + + this.isArchiveFolder = ko.computed(function () { + return oData.archiveFolder() === this.messageListEndFolder() && + '' !== oData.archiveFolder(); + }, this); + + this.isArchiveDisabled = ko.computed(function () { + return Consts.Values.UnuseOptionValue === RL.data().archiveFolder(); }, this); this.canBeMoved = this.hasCheckedOrSelectedLines; @@ -11566,6 +11668,12 @@ function MailBoxMessageListViewModel() RL.data().currentFolderFullNameRaw(), RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); }, this.canBeMoved); + + this.archiveCommand = Utils.createCommand(this, function () { + RL.deleteMessagesFromFolder(Enums.FolderType.Archive, + RL.data().currentFolderFullNameRaw(), + RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); + }, this.canBeMoved); this.spamCommand = Utils.createCommand(this, function () { RL.deleteMessagesFromFolder(Enums.FolderType.Spam, @@ -11644,6 +11752,15 @@ MailBoxMessageListViewModel.prototype.searchEnterAction = function () this.inputMessageListSearchFocus(false); }; +/** + * @returns {string} + */ +MailBoxMessageListViewModel.prototype.printableMessageCountForDeletion = function () +{ + var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length; + return 1 < iCnt ? ' (' + (100 > iCnt ? iCnt : '99+') + ')' : ''; +}; + MailBoxMessageListViewModel.prototype.cancelSearch = function () { this.mainMessageListSearch(''); @@ -12167,8 +12284,6 @@ function MailBoxMessageViewViewModel() this.fullScreenMode = oData.messageFullScreenMode; this.showFullInfo = ko.observable(false); - this.openPGPInformation = ko.observable(''); - this.openPGPInformation.isError = ko.observable(false); this.messageVisibility = ko.computed(function () { return !this.messageLoadingThrottle() && !!this.message(); @@ -12211,6 +12326,17 @@ function MailBoxMessageViewViewModel() }, this.messageVisibility); + this.archiveCommand = Utils.createCommand(this, function () { + + if (this.message()) + { + RL.deleteMessagesFromFolder(Enums.FolderType.Archive, + this.message().folderFullNameRaw, + [this.message().uid], true); + } + + }, this.messageVisibility); + this.spamCommand = Utils.createCommand(this, function () { if (this.message()) @@ -12238,6 +12364,7 @@ function MailBoxMessageViewViewModel() this.viewUserPic = ko.observable(Consts.DataImages.UserDotPic); this.viewUserPicVisible = ko.observable(false); + this.viewPgpPassword = ko.observable(''); this.viewPgpSignedVerifyStatus = ko.computed(function () { return this.message() ? this.message().pgpSignedVerifyStatus() : Enums.SignedVerifyStatus.None; }, this); @@ -12245,11 +12372,14 @@ function MailBoxMessageViewViewModel() this.viewPgpSignedVerifyUser = ko.computed(function () { return this.message() ? this.message().pgpSignedVerifyUser() : ''; }, this); + this.message.subscribe(function (oMessage) { this.messageActiveDom(null); + this.viewPgpPassword(''); + if (oMessage) { this.viewSubject(oMessage.subject()); @@ -12338,6 +12468,12 @@ MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function () switch (this.viewPgpSignedVerifyStatus()) { // TODO i18n + case Enums.SignedVerifyStatus.UnknownPublicKeys: + sResult = 'No public keys found'; + break; + case Enums.SignedVerifyStatus.UnknownPrivateKey: + sResult = 'No private key found'; + break; case Enums.SignedVerifyStatus.Unverified: sResult = 'Unverified signature'; break; @@ -12490,6 +12626,38 @@ MailBoxMessageViewViewModel.prototype.isSentFolder = function () return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw; }; +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isSpamFolder = function () +{ + return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw; +}; + +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isSpamDisabled = function () +{ + return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue; +}; + +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isArchiveFolder = function () +{ + return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw; +}; + +/** + * @return {boolean} + */ +MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function () +{ + return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue; +}; + /** * @return {boolean} */ @@ -12548,7 +12716,7 @@ MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMe { if (oMessage) { - oMessage.decryptPgpEncryptedMessage(); + oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword()); } }; @@ -13905,16 +14073,19 @@ function WebMailDataStorage() this.draftFolder = ko.observable(''); this.spamFolder = ko.observable(''); this.trashFolder = ko.observable(''); + this.archiveFolder = ko.observable(''); this.sentFolder.subscribe(fRemoveSystemFolderType(this.sentFolder), this, 'beforeChange'); this.draftFolder.subscribe(fRemoveSystemFolderType(this.draftFolder), this, 'beforeChange'); this.spamFolder.subscribe(fRemoveSystemFolderType(this.spamFolder), this, 'beforeChange'); this.trashFolder.subscribe(fRemoveSystemFolderType(this.trashFolder), this, 'beforeChange'); + this.archiveFolder.subscribe(fRemoveSystemFolderType(this.archiveFolder), this, 'beforeChange'); this.sentFolder.subscribe(fSetSystemFolderType(Enums.FolderType.SentItems), this); this.draftFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Draft), this); this.spamFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Spam), this); this.trashFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Trash), this); + this.archiveFolder.subscribe(fSetSystemFolderType(Enums.FolderType.Archive), this); this.draftFolderNotEnabled = ko.computed(function () { return '' === this.draftFolder() || Consts.Values.UnuseOptionValue === this.draftFolder(); @@ -13995,7 +14166,8 @@ function WebMailDataStorage() sSentFolder = this.sentFolder(), sDraftFolder = this.draftFolder(), sSpamFolder = this.spamFolder(), - sTrashFolder = this.trashFolder() + sTrashFolder = this.trashFolder(), + sArchiveFolder = this.archiveFolder() ; if (Utils.isArray(aFolders) && 0 < aFolders.length) @@ -14016,6 +14188,10 @@ function WebMailDataStorage() { aList.push(sTrashFolder); } + if ('' !== sArchiveFolder && Consts.Values.UnuseOptionValue !== sArchiveFolder) + { + aList.push(sArchiveFolder); + } } return aList; @@ -14482,13 +14658,15 @@ WebMailDataStorage.prototype.setFolders = function (oData) if (oData.Result['SystemFolders'] && '' === '' + RL.settingsGet('SentFolder') + RL.settingsGet('DraftFolder') + - RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('NullFolder')) + RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('ArchiveFolder') + + RL.settingsGet('NullFolder')) { // TODO Magic Numbers RL.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null); RL.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null); RL.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null); RL.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null); + RL.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null); bUpdate = true; } @@ -14497,6 +14675,7 @@ WebMailDataStorage.prototype.setFolders = function (oData) oRLData.draftFolder(fNormalizeFolder(RL.settingsGet('DraftFolder'))); oRLData.spamFolder(fNormalizeFolder(RL.settingsGet('SpamFolder'))); oRLData.trashFolder(fNormalizeFolder(RL.settingsGet('TrashFolder'))); + oRLData.archiveFolder(fNormalizeFolder(RL.settingsGet('ArchiveFolder'))); if (bUpdate) { @@ -14505,6 +14684,7 @@ WebMailDataStorage.prototype.setFolders = function (oData) 'DraftFolder': oRLData.draftFolder(), 'SpamFolder': oRLData.spamFolder(), 'TrashFolder': oRLData.trashFolder(), + 'ArchiveFolder': oRLData.archiveFolder(), 'NullFolder': 'NullFolder' }); } @@ -14695,7 +14875,6 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) sPlain = '', bPgpSigned = false, bPgpEncrypted = false, - mPgpMessage = null, oMessagesBodiesDom = this.messagesBodiesDom(), oMessage = this.message() ; @@ -14760,12 +14939,6 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) } else if (bPgpEncrypted && oMessage.isPgpEncrypted()) { -// try -// { -// mPgpMessage = window.openpgp.message.readArmored(oMessage.plainRaw); -// } -// catch (oExc) {} - sPlain = $proxyDiv.append( $('').text(oMessage.plainRaw) @@ -15014,7 +15187,12 @@ WebMailDataStorage.prototype.findPublicKeysByEmail = function (sEmail) })); }; -WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPass) +/** + * @param {string} sEmail + * @param {string=} sPassword + * @returns {?} + */ +WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPassword) { var oPrivateKey = null, @@ -15031,7 +15209,7 @@ WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPass) if (oPrivateKey && !oPrivateKey.err && oPrivateKey.keys && oPrivateKey.keys[0]) { oPrivateKey = oPrivateKey.keys[0]; - oPrivateKey.decrypt(sPass); + oPrivateKey.decrypt(Utils.pString(sPassword)); } else { @@ -15047,6 +15225,15 @@ WebMailDataStorage.prototype.findPrivateKeyByEmail = function (sEmail, sPass) return oPrivateKey; }; +/** + * @param {string=} sPassword + * @returns {?} + */ +WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword) +{ + return this.findPrivateKeyByEmail(this.accountEmail(), sPassword); +}; + /** * @constructor */ @@ -15343,7 +15530,8 @@ WebMailAjaxRemoteStorage.prototype.folders = function (fCallback) 'SentFolder': RL.settingsGet('SentFolder'), 'DraftFolder': RL.settingsGet('DraftFolder'), 'SpamFolder': RL.settingsGet('SpamFolder'), - 'TrashFolder': RL.settingsGet('TrashFolder') + 'TrashFolder': RL.settingsGet('TrashFolder'), + 'ArchiveFolder': RL.settingsGet('ArchiveFolder') }, null, '', ['Folders']); }; @@ -17342,26 +17530,43 @@ RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFol self = this, oData = RL.data(), oCache = RL.cache(), - oTrashOrSpamFolder = oCache.getFolderFromCacheList( - Enums.FolderType.Spam === iDeleteType ? oData.spamFolder() : oData.trashFolder()) + oMoveFolder = null, + nSetSystemFoldersNotification = null ; + switch (iDeleteType) + { + case Enums.FolderType.Spam: + oMoveFolder = oCache.getFolderFromCacheList(oData.spamFolder()); + nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam; + break; + case Enums.FolderType.Trash: + oMoveFolder = oCache.getFolderFromCacheList(oData.trashFolder()); + nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash; + break; + case Enums.FolderType.Archive: + oMoveFolder = oCache.getFolderFromCacheList(oData.archiveFolder()); + nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive; + break; + } + bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder; if (bUseFolder) { if ((Enums.FolderType.Spam === iDeleteType && Consts.Values.UnuseOptionValue === oData.spamFolder()) || - (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === oData.trashFolder())) + (Enums.FolderType.Trash === iDeleteType && Consts.Values.UnuseOptionValue === oData.trashFolder()) || + (Enums.FolderType.Archive === iDeleteType && Consts.Values.UnuseOptionValue === oData.archiveFolder())) { bUseFolder = false; } } - if (!oTrashOrSpamFolder && bUseFolder) + if (!oMoveFolder && bUseFolder) { - kn.showScreenPopup(PopupsFolderSystemViewModel, [ - Enums.FolderType.Spam === iDeleteType ? Enums.SetSystemFoldersNotification.Spam : Enums.SetSystemFoldersNotification.Trash]); + kn.showScreenPopup(PopupsFolderSystemViewModel, [nSetSystemFoldersNotification]); } - else if (!bUseFolder || (sFromFolderFullNameRaw === oData.spamFolder() || sFromFolderFullNameRaw === oData.trashFolder())) + else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType && + (sFromFolderFullNameRaw === oData.spamFolder() || sFromFolderFullNameRaw === oData.trashFolder()))) { kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () { @@ -17375,16 +17580,16 @@ RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFol }]); } - else if (oTrashOrSpamFolder) + else if (oMoveFolder) { RL.remote().messagesMove( this.moveOrDeleteResponseHelper, sFromFolderFullNameRaw, - oTrashOrSpamFolder.fullNameRaw, + oMoveFolder.fullNameRaw, aUidForRemove ); - oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oTrashOrSpamFolder.fullNameRaw); + oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw); } }; 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 081941288..6289fec51 100644 --- a/rainloop/v/0.0.0/static/js/app.min.js +++ b/rainloop/v/0.0.0/static/js/app.min.js @@ -1,9 +1,9 @@ /*! 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){"use strict";function j(){this.sBase="#/",this.sCdnStaticDomain=Kb.settingsGet("CdnStaticDomain"),this.sVersion=Kb.settingsGet("Version"),this.sSpecSuffix=Kb.settingsGet("AuthAccountHash")||"0",this.sServer=(Kb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function k(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 l(a,b,c,d,e){this.list=a,this.selectedItem=b,this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.oContentVisible=null,this.oContentScrollable=null,this.sItemSelector=c,this.sItemSelectedSelector=d,this.sItemCheckedSelector=e,this.sLastUid="",this.oCallbacks={},this.iSelectTimer=0,this.bUseKeyboard=!0,this.emptyFunction=function(){},this.useItemSelectCallback=!0,this.throttleSelection=!1,this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],i=null;this.list.subscribe(function(){var a=this,b=this.list();yb.isArray(b)&&h.each(b,function(b){b.checked()&&g.push(a.getItemUid(b)),null===i&&b.selected()&&(i=a.getItemUid(b))})},this,"beforeChange"),this.list.subscribe(function(a){if(this.useItemSelectCallback=!1,this.selectedItem(null),yb.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1 b?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(wb.SignedVerifyStatus.None),this.pgpSignedVerifyUser=c.observable(""),this.priority=c.observable(wb.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.selectable=!1,this.existen=!0,this.isNamespaceFolder=!1,this.isGmailFolder=!1,this.isUnpaddigFolder=!1,this.interval=0,this.type=c.observable(wb.FolderType.User),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 yb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=yb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Kb.data().message(null),Kb.data().messageList([]),this.clearingProcess(!0),Kb.cache().setFolderHash(b.fullNameRaw,""),Kb.remote().folderClear(function(b,c){a.clearingProcess(!1),wb.StorageResultType.Success===b&&c&&c.Result?(Kb.reloadMessageList(!0),a.cancelCommand()):a.clearingError(c&&c.ErrorCode?yb.getNotification(c.ErrorCode):yb.getNotification(wb.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"),yb.initOnStartOrLangChange(function(){this.sNoParentText=yb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(vb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Kb.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)}),Kb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=yb.createCommand(this,function(){var a=Kb.data(),b=this.selectedParentValue();""===b&&1 =a?1:a},this),this.contactsPagenator=c.computed(yb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewIDStr=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewScopeType=c.observable(wb.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(wb.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1 "),this.submitRequest(!0),h.delay(function(){d=a.openpgp.generateKeyPair(1,yb.pInt(b.keyBitLength()),c,yb.trim(b.password())),d&&d.privateKeyArmored&&(e.importKey(d.privateKeyArmored),e.importKey(d.publicKeyArmored),e.store(),Kb.reloadOpenPgpKeys(),yb.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(!0),this.from=c.observable(""),this.to=c.observableArray([]),this.text=c.observable(""),this.resultCallback=null,this.submitRequest=c.observable(!1),this.doCommand=yb.createCommand(this,function(){var b=this,c=!0,d=Kb.data(),e=null,f=[];this.submitRequest(!0),c&&this.sign()&&""===this.from()&&(this.notification("Please specify FROM email address"),c=!1),c&&this.sign()&&(e=d.findPrivateKeyByEmail(this.from(),this.password()),e||(this.notification('No private key found for "'+this.from()+'" email'),c=!1)),c&&this.encrypt()&&0===this.to().length&&(this.notification("Please specify at least one recipient"),c=!1),c&&this.encrypt()&&(f=h.compact(h.union(this.to(),function(a){var e=d.findPublicKeysByEmail(a);return 0===e.length&&c&&(b.notification('No public key found for "'+a+'" email'),c=!1),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&&0 0&&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&&!yb.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(wb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(wb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Kb.remote().saveSettings(null,{Theme:c})},this)}function ib(){this.openpgpkeys=Kb.data().openpgpkeys,this.openpgpkeysPublic=Kb.data().openpgpkeysPublic,this.openpgpkeysPrivate=Kb.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 jb(){yb.initDataConstructorBySettings(this)}function kb(){jb.call(this);var a=function(a){return function(){var b=Kb.cache().getFolderFromCacheList(a());b&&b.type(wb.FolderType.User)}},d=function(a){return function(b){var c=Kb.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.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange"),this.sentFolder.subscribe(d(wb.FolderType.SentItems),this),this.draftFolder.subscribe(d(wb.FolderType.Draft),this),this.spamFolder.subscribe(d(wb.FolderType.Spam),this),this.trashFolder.subscribe(d(wb.FolderType.Trash),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||vb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),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.namespace="",this.folderList=c.observableArray([]),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();return yb.isArray(b)&&0 =a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Db.setHash(Kb.link().mailBox(this.currentFolderFullNameHash(),1,yb.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.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this),this.messageFullScreenMode=c.observable(!1),this.messageError=c.observable(""),this.messagesBodiesDom=c.observable(null),this.messagesBodiesDom.subscribe(function(a){!a||a instanceof jQuery||this.messagesBodiesDom(b(a))},this),this.messageActiveDom=c.observable(null),this.isMessageSelected=c.computed(function(){return null!==this.message()},this),this.currentMessage=c.observable(null),this.message.subscribe(function(a){null===a&&(this.currentMessage(null),this.hideMessageBodies())},this),this.messageListChecked=c.computed(function(){return h.filter(this.messageList(),function(a){return a.checked()})},this),this.messageListCheckedOrSelected=c.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return h.union(a,b?[b]:[])},this),this.messageListCheckedUids=c.computed(function(){var a=[];return h.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),0 0?Math.ceil(b/a*100):0},this),this.useKeyboardShortcuts=c.observable(!0),this.allowOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=c.computed(function(){return h.filter(this.openpgpkeys(),function(a){return!(!a||a.isPrivate)})},this),this.openpgpkeysPrivate=c.computed(function(){return h.filter(this.openpgpkeys(),function(a){return!(!a||!a.isPrivate)})},this),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(wb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function lb(){this.oRequests={}}function mb(){lb.call(this),this.oRequests={}}function nb(){this.oEmailsPicsHashes={},this.oServices={}}function ob(){nb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function pb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function qb(){s.call(this,"login",[S])}function rb(){s.call(this,"mailbox",[U,W,X,Y]),this.oLastRoute={}}function sb(){pb.call(this,[V,Z,$]),yb.initOnStartOrLangChange(function(){this.sSettingsTitle=yb.i18n("TITLES/SETTINGS")},this,function(){Kb.setTitle(this.sSettingsTitle)})}function tb(){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"),Hb.on("error",function(a){Kb&&a&&a.originalEvent&&a.originalEvent.message&&-1===yb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Kb.remote().jsError(yb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Gb.attr("class"),yb.microtime()-Bb.now)})}function ub(){tb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),a.setInterval(function(){Kb.pub("interval.30s")},3e4),a.setInterval(function(){Kb.pub("interval.1m")},6e4),a.setInterval(function(){Kb.pub("interval.2m")},12e4),a.setInterval(function(){Kb.pub("interval.3m")},18e4),a.setInterval(function(){Kb.pub("interval.5m")},3e5),a.setInterval(function(){Kb.pub("interval.10m")},6e5),b.wakeUp(function(){Kb.remote().jsVersion(function(b,c){wb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Kb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Kb.settingsGet("Version"))},{},36e5)}var vb={},wb={},xb={},yb={},zb={},Ab={},Bb={},Cb={settings:[],"settings-removed":[],"settings-disabled":[]},Db=null,Eb=a.rainloopAppData||{},Fb=a.rainloopI18N||{},Gb=b("html"),Hb=b(a),Ib=b(a.document),Jb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Kb=null,Lb=b("");Bb.now=(new Date).getTime(),Bb.momentTrigger=c.observable(!0),Bb.langChangeTrigger=c.observable(!0),Bb.iAjaxErrorCount=0,Bb.iTokenErrorCount=0,Bb.iMessageBodyCacheCount=0,Bb.bUnload=!1,Bb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Bb.bIsiOSDevice=-1 /g,">").replace(/"/g,""").replace(/'/g,"'"):""},yb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=yb.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},yb.timeOutAction=function(){var b={};return function(c,d,e){yb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),yb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),yb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Bb.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}}(),yb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},yb.i18n=function(a,b,c){var d="",e=yb.isUnd(Fb[a])?yb.isUnd(c)?a:c:Fb[a];if(!yb.isUnd(b)&&!yb.isNull(b))for(d in b)yb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},yb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(yb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(yb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",yb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",yb.i18n(c)))})})},yb.i18nToDoc=function(){a.rainloopI18N&&(Fb=a.rainloopI18N||{},yb.i18nToNode(Ib),Bb.langChangeTrigger(!Bb.langChangeTrigger())),a.rainloopI18N={}},yb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Bb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Bb.langChangeTrigger.subscribe(a,b)},yb.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)},yb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},yb.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()},yb.replySubjectAdd=function(b,c,d){var e=null,f=yb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||yb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||yb.isUnd(e[1])||yb.isUnd(e[2])||yb.isUnd(e[3])?b+": "+c:e[1]+(yb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(yb.isUnd(d)?!0:d)?yb.fixLongSubject(f):f},yb.fixLongSubject=function(a){var b=0,c=null;a=yb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||yb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=yb.isUnd(c[2])?1:0+yb.pInt(c[2]),b+=yb.isUnd(c[4])?1:0+yb.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]+/," ")},yb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},yb.friendlySize=function(a){return a=yb.pInt(a),a>=1073741824?yb.roundNumber(a/1073741824,1)+"GB":a>=1048576?yb.roundNumber(a/1048576,1)+"MB":a>=1024?yb.roundNumber(a/1024,0)+"KB":a+"B"},yb.log=function(b){a.console&&a.console.log&&a.console.log(b)},yb.getNotification=function(a,b){return a=yb.pInt(a),wb.Notification.ClientViewError===a&&b?b:yb.isUnd(xb[a])?"":xb[a]},yb.initNotificationLanguage=function(){xb[wb.Notification.InvalidToken]=yb.i18n("NOTIFICATIONS/INVALID_TOKEN"),xb[wb.Notification.AuthError]=yb.i18n("NOTIFICATIONS/AUTH_ERROR"),xb[wb.Notification.AccessError]=yb.i18n("NOTIFICATIONS/ACCESS_ERROR"),xb[wb.Notification.ConnectionError]=yb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),xb[wb.Notification.CaptchaError]=yb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),xb[wb.Notification.SocialFacebookLoginAccessDisable]=yb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),xb[wb.Notification.SocialTwitterLoginAccessDisable]=yb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),xb[wb.Notification.SocialGoogleLoginAccessDisable]=yb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),xb[wb.Notification.DomainNotAllowed]=yb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),xb[wb.Notification.AccountNotAllowed]=yb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),xb[wb.Notification.CantGetMessageList]=yb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),xb[wb.Notification.CantGetMessage]=yb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),xb[wb.Notification.CantDeleteMessage]=yb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),xb[wb.Notification.CantMoveMessage]=yb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),xb[wb.Notification.CantCopyMessage]=yb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),xb[wb.Notification.CantSaveMessage]=yb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),xb[wb.Notification.CantSendMessage]=yb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),xb[wb.Notification.InvalidRecipients]=yb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),xb[wb.Notification.CantCreateFolder]=yb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),xb[wb.Notification.CantRenameFolder]=yb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),xb[wb.Notification.CantDeleteFolder]=yb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),xb[wb.Notification.CantDeleteNonEmptyFolder]=yb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),xb[wb.Notification.CantSubscribeFolder]=yb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),xb[wb.Notification.CantUnsubscribeFolder]=yb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),xb[wb.Notification.CantSaveSettings]=yb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),xb[wb.Notification.CantSavePluginSettings]=yb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),xb[wb.Notification.DomainAlreadyExists]=yb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),xb[wb.Notification.CantInstallPackage]=yb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),xb[wb.Notification.CantDeletePackage]=yb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),xb[wb.Notification.InvalidPluginPackage]=yb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),xb[wb.Notification.UnsupportedPluginPackage]=yb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),xb[wb.Notification.LicensingServerIsUnavailable]=yb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),xb[wb.Notification.LicensingExpired]=yb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),xb[wb.Notification.LicensingBanned]=yb.i18n("NOTIFICATIONS/LICENSING_BANNED"),xb[wb.Notification.DemoSendMessageError]=yb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),xb[wb.Notification.AccountAlreadyExists]=yb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),xb[wb.Notification.MailServerError]=yb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),xb[wb.Notification.UnknownNotification]=yb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),xb[wb.Notification.UnknownError]=yb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},yb.getUploadErrorDescByCode=function(a){var b="";switch(yb.pInt(a)){case wb.UploadErrorCode.FileIsTooBig:b=yb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case wb.UploadErrorCode.FilePartiallyUploaded:b=yb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case wb.UploadErrorCode.FileNoUploaded:b=yb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case wb.UploadErrorCode.MissingTempFolder:b=yb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case wb.UploadErrorCode.FileOnSaveingError:b=yb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case wb.UploadErrorCode.FileType:b=yb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=yb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},yb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=yb.pInt(d),0>=d?a[b].apply(a,yb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,yb.isArray(c)?c:[])},d))},yb.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===wb.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===wb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},yb.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=yb.isUnd(d)?!0:d,e.canExecute=c.computed(yb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},yb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(wb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(wb.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Bb.sAnimationType=wb.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(wb.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return wb.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Bb.bMobileDevice||a===wb.InterfaceAnimation.None)Gb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Bb.sAnimationType=wb.InterfaceAnimation.None;else switch(a){case wb.InterfaceAnimation.Full:Gb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Bb.sAnimationType=a;break;case wb.InterfaceAnimation.Normal:Gb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Bb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=wb.DesktopNotifications.NotSupported;if(Jb&&Jb.permission)switch(Jb.permission.toLowerCase()){case"granted":c=wb.DesktopNotifications.Allowed;break;case"denied":c=wb.DesktopNotifications.Denied;break;case"default":c=wb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&wb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();wb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):wb.DesktopNotifications.NotAllowed===c?Jb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),wb.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")?yb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?yb.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},yb.isFolderExpanded=function(a){var b=Kb.local().get(wb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},yb.setExpandedFolder=function(a,b){var c=Kb.local().get(wb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Kb.local().set(wb.ClientSideKeyName.ExpandedFolders,c)},yb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Kb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Kb.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})},yb.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&&0 100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),yb.windowResize()}).after("
").before("
"))})}},yb.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()}))},yb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,zb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},yb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Cb.settings.push(a)},yb.removeSettingsViewModel=function(a){Cb["settings-removed"].push(a)},yb.disableSettingsViewModel=function(a){Cb["settings-disabled"].push(a)},yb.convertThemeName=function(a){return yb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},yb.quoteName=function(a){return a.replace(/["]/g,'\\"')},yb.microtime=function(){return(new Date).getTime()},yb.convertLangName=function(a,b){return yb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},yb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=yb.isUnd(a)?32:yb.pInt(a);b.length/g,">").replace(/")},yb.draggeblePlace=function(){return b('').appendTo("#rl-hidden")},yb.defautOptionsAfterRender=function(a,b){b&&!yb.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},yb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+yb.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")),yb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+yb.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)},yb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=yb.isUnd(d)?1e3:yb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?wb.SaveSettingsStep.TrueResult:wb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,wb.SaveSettingsStep.Idle)},d)}},yb.settingsSaveHelperSimpleFunction=function(a,b){return yb.settingsSaveHelperFunction(null,a,b,1e3)},yb.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,"")},yb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},yb.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},yb.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:yb.isUnd(c)?a.toString():c.toString(),custom:yb.isUnd(c)?!1:!0,title:yb.isUnd(c)?"":a.toString(),value:a.toString()};(yb.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}},yb.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()}},yb.openPgpImportPublicKeys=function(b){if(a.openpgp&&Kb){var c=Kb.data().openpgpKeyring,d=a.openpgp.key.readArmored(b);if(c&&d&&!d.err&&yb.isArray(d.keys)&&0>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 Ab._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;c d?(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(!Bb.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+yb.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={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&&!yb.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&&!yb.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.modal={init:function(a,d){b(a).toggleClass("fade",!Bb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){yb.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){yb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),yb.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=yb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=yb.pInt(e[2]),g=Hb.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(!Bb.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),yb.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),yb.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(){yb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Bb.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){Bb.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"); +!function(a,b,c,d,e,f,g,h,i){"use strict";function j(){this.sBase="#/",this.sCdnStaticDomain=Kb.settingsGet("CdnStaticDomain"),this.sVersion=Kb.settingsGet("Version"),this.sSpecSuffix=Kb.settingsGet("AuthAccountHash")||"0",this.sServer=(Kb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function k(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 l(a,b,c,d,e){this.list=a,this.selectedItem=b,this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.oContentVisible=null,this.oContentScrollable=null,this.sItemSelector=c,this.sItemSelectedSelector=d,this.sItemCheckedSelector=e,this.sLastUid="",this.oCallbacks={},this.iSelectTimer=0,this.bUseKeyboard=!0,this.emptyFunction=function(){},this.useItemSelectCallback=!0,this.throttleSelection=!1,this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],i=null;this.list.subscribe(function(){var a=this,b=this.list();yb.isArray(b)&&h.each(b,function(b){b.checked()&&g.push(a.getItemUid(b)),null===i&&b.selected()&&(i=a.getItemUid(b))})},this,"beforeChange"),this.list.subscribe(function(a){if(this.useItemSelectCallback=!1,this.selectedItem(null),yb.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1 b?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(wb.SignedVerifyStatus.None),this.pgpSignedVerifyUser=c.observable(""),this.priority=c.observable(wb.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.selectable=!1,this.existen=!0,this.isNamespaceFolder=!1,this.isGmailFolder=!1,this.isUnpaddigFolder=!1,this.interval=0,this.type=c.observable(wb.FolderType.User),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 yb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=yb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Kb.data().message(null),Kb.data().messageList([]),this.clearingProcess(!0),Kb.cache().setFolderHash(b.fullNameRaw,""),Kb.remote().folderClear(function(b,c){a.clearingProcess(!1),wb.StorageResultType.Success===b&&c&&c.Result?(Kb.reloadMessageList(!0),a.cancelCommand()):a.clearingError(c&&c.ErrorCode?yb.getNotification(c.ErrorCode):yb.getNotification(wb.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"),yb.initOnStartOrLangChange(function(){this.sNoParentText=yb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(vb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Kb.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)}),Kb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=yb.createCommand(this,function(){var a=Kb.data(),b=this.selectedParentValue();""===b&&1 =a?1:a},this),this.contactsPagenator=c.computed(yb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewIDStr=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewScopeType=c.observable(wb.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(wb.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1 "),this.submitRequest(!0),h.delay(function(){d=a.openpgp.generateKeyPair(1,yb.pInt(b.keyBitLength()),c,yb.trim(b.password())),d&&d.privateKeyArmored&&(e.importKey(d.privateKeyArmored),e.importKey(d.publicKeyArmored),e.store(),Kb.reloadOpenPgpKeys(),yb.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(!0),this.from=c.observable(""),this.to=c.observableArray([]),this.text=c.observable(""),this.resultCallback=null,this.submitRequest=c.observable(!1),this.doCommand=yb.createCommand(this,function(){var b=this,c=!0,d=Kb.data(),e=null,f=[];this.submitRequest(!0),c&&this.sign()&&""===this.from()&&(this.notification("Please specify FROM email address"),c=!1),c&&this.sign()&&(e=d.findPrivateKeyByEmail(this.from(),this.password()),e||(this.notification('No private key found for "'+this.from()+'" email'),c=!1)),c&&this.encrypt()&&0===this.to().length&&(this.notification("Please 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('No public key found for "'+a+'" email'),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&&0 0&&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&&!yb.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(wb.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(wb.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Kb.remote().saveSettings(null,{Theme:c})},this)}function ib(){this.openpgpkeys=Kb.data().openpgpkeys,this.openpgpkeysPublic=Kb.data().openpgpkeysPublic,this.openpgpkeysPrivate=Kb.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 jb(){yb.initDataConstructorBySettings(this)}function kb(){jb.call(this);var a=function(a){return function(){var b=Kb.cache().getFolderFromCacheList(a());b&&b.type(wb.FolderType.User)}},d=function(a){return function(b){var c=Kb.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(a(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(a(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(d(wb.FolderType.SentItems),this),this.draftFolder.subscribe(d(wb.FolderType.Draft),this),this.spamFolder.subscribe(d(wb.FolderType.Spam),this),this.trashFolder.subscribe(d(wb.FolderType.Trash),this),this.archiveFolder.subscribe(d(wb.FolderType.Archive),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||vb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),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.namespace="",this.folderList=c.observableArray([]),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 yb.isArray(b)&&0 =a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Db.setHash(Kb.link().mailBox(this.currentFolderFullNameHash(),1,yb.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.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this),this.messageFullScreenMode=c.observable(!1),this.messageError=c.observable(""),this.messagesBodiesDom=c.observable(null),this.messagesBodiesDom.subscribe(function(a){!a||a instanceof jQuery||this.messagesBodiesDom(b(a))},this),this.messageActiveDom=c.observable(null),this.isMessageSelected=c.computed(function(){return null!==this.message()},this),this.currentMessage=c.observable(null),this.message.subscribe(function(a){null===a&&(this.currentMessage(null),this.hideMessageBodies())},this),this.messageListChecked=c.computed(function(){return h.filter(this.messageList(),function(a){return a.checked()})},this),this.messageListCheckedOrSelected=c.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return h.union(a,b?[b]:[])},this),this.messageListCheckedUids=c.computed(function(){var a=[];return h.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),0 0?Math.ceil(b/a*100):0},this),this.useKeyboardShortcuts=c.observable(!0),this.allowOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=c.computed(function(){return h.filter(this.openpgpkeys(),function(a){return!(!a||a.isPrivate)})},this),this.openpgpkeysPrivate=c.computed(function(){return h.filter(this.openpgpkeys(),function(a){return!(!a||!a.isPrivate)})},this),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(wb.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function lb(){this.oRequests={}}function mb(){lb.call(this),this.oRequests={}}function nb(){this.oEmailsPicsHashes={},this.oServices={}}function ob(){nb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function pb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function qb(){s.call(this,"login",[S])}function rb(){s.call(this,"mailbox",[U,W,X,Y]),this.oLastRoute={}}function sb(){pb.call(this,[V,Z,$]),yb.initOnStartOrLangChange(function(){this.sSettingsTitle=yb.i18n("TITLES/SETTINGS")},this,function(){Kb.setTitle(this.sSettingsTitle)})}function tb(){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"),Hb.on("error",function(a){Kb&&a&&a.originalEvent&&a.originalEvent.message&&-1===yb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Kb.remote().jsError(yb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Gb.attr("class"),yb.microtime()-Bb.now)})}function ub(){tb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),a.setInterval(function(){Kb.pub("interval.30s")},3e4),a.setInterval(function(){Kb.pub("interval.1m")},6e4),a.setInterval(function(){Kb.pub("interval.2m")},12e4),a.setInterval(function(){Kb.pub("interval.3m")},18e4),a.setInterval(function(){Kb.pub("interval.5m")},3e5),a.setInterval(function(){Kb.pub("interval.10m")},6e5),b.wakeUp(function(){Kb.remote().jsVersion(function(b,c){wb.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Kb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Kb.settingsGet("Version"))},{},36e5)}var vb={},wb={},xb={},yb={},zb={},Ab={},Bb={},Cb={settings:[],"settings-removed":[],"settings-disabled":[]},Db=null,Eb=a.rainloopAppData||{},Fb=a.rainloopI18N||{},Gb=b("html"),Hb=b(a),Ib=b(a.document),Jb=a.Notification&&a.Notification.requestPermission?a.Notification:null,Kb=null,Lb=b("");Bb.now=(new Date).getTime(),Bb.momentTrigger=c.observable(!0),Bb.langChangeTrigger=c.observable(!0),Bb.iAjaxErrorCount=0,Bb.iTokenErrorCount=0,Bb.iMessageBodyCacheCount=0,Bb.bUnload=!1,Bb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Bb.bIsiOSDevice=-1 /g,">").replace(/"/g,""").replace(/'/g,"'"):""},yb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=yb.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},yb.timeOutAction=function(){var b={};return function(c,d,e){yb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),yb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),yb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Bb.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}}(),yb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},yb.i18n=function(a,b,c){var d="",e=yb.isUnd(Fb[a])?yb.isUnd(c)?a:c:Fb[a];if(!yb.isUnd(b)&&!yb.isNull(b))for(d in b)yb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},yb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(yb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(yb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",yb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",yb.i18n(c)))})})},yb.i18nToDoc=function(){a.rainloopI18N&&(Fb=a.rainloopI18N||{},yb.i18nToNode(Ib),Bb.langChangeTrigger(!Bb.langChangeTrigger())),a.rainloopI18N={}},yb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Bb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Bb.langChangeTrigger.subscribe(a,b)},yb.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)},yb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},yb.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()},yb.replySubjectAdd=function(b,c,d){var e=null,f=yb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||yb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||yb.isUnd(e[1])||yb.isUnd(e[2])||yb.isUnd(e[3])?b+": "+c:e[1]+(yb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(yb.isUnd(d)?!0:d)?yb.fixLongSubject(f):f},yb.fixLongSubject=function(a){var b=0,c=null;a=yb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||yb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=yb.isUnd(c[2])?1:0+yb.pInt(c[2]),b+=yb.isUnd(c[4])?1:0+yb.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]+/," ")},yb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},yb.friendlySize=function(a){return a=yb.pInt(a),a>=1073741824?yb.roundNumber(a/1073741824,1)+"GB":a>=1048576?yb.roundNumber(a/1048576,1)+"MB":a>=1024?yb.roundNumber(a/1024,0)+"KB":a+"B"},yb.log=function(b){a.console&&a.console.log&&a.console.log(b)},yb.getNotification=function(a,b){return a=yb.pInt(a),wb.Notification.ClientViewError===a&&b?b:yb.isUnd(xb[a])?"":xb[a]},yb.initNotificationLanguage=function(){xb[wb.Notification.InvalidToken]=yb.i18n("NOTIFICATIONS/INVALID_TOKEN"),xb[wb.Notification.AuthError]=yb.i18n("NOTIFICATIONS/AUTH_ERROR"),xb[wb.Notification.AccessError]=yb.i18n("NOTIFICATIONS/ACCESS_ERROR"),xb[wb.Notification.ConnectionError]=yb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),xb[wb.Notification.CaptchaError]=yb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),xb[wb.Notification.SocialFacebookLoginAccessDisable]=yb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),xb[wb.Notification.SocialTwitterLoginAccessDisable]=yb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),xb[wb.Notification.SocialGoogleLoginAccessDisable]=yb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),xb[wb.Notification.DomainNotAllowed]=yb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),xb[wb.Notification.AccountNotAllowed]=yb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),xb[wb.Notification.CantGetMessageList]=yb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),xb[wb.Notification.CantGetMessage]=yb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),xb[wb.Notification.CantDeleteMessage]=yb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),xb[wb.Notification.CantMoveMessage]=yb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),xb[wb.Notification.CantCopyMessage]=yb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),xb[wb.Notification.CantSaveMessage]=yb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),xb[wb.Notification.CantSendMessage]=yb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),xb[wb.Notification.InvalidRecipients]=yb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),xb[wb.Notification.CantCreateFolder]=yb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),xb[wb.Notification.CantRenameFolder]=yb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),xb[wb.Notification.CantDeleteFolder]=yb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),xb[wb.Notification.CantDeleteNonEmptyFolder]=yb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),xb[wb.Notification.CantSubscribeFolder]=yb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),xb[wb.Notification.CantUnsubscribeFolder]=yb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),xb[wb.Notification.CantSaveSettings]=yb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),xb[wb.Notification.CantSavePluginSettings]=yb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),xb[wb.Notification.DomainAlreadyExists]=yb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),xb[wb.Notification.CantInstallPackage]=yb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),xb[wb.Notification.CantDeletePackage]=yb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),xb[wb.Notification.InvalidPluginPackage]=yb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),xb[wb.Notification.UnsupportedPluginPackage]=yb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),xb[wb.Notification.LicensingServerIsUnavailable]=yb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),xb[wb.Notification.LicensingExpired]=yb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),xb[wb.Notification.LicensingBanned]=yb.i18n("NOTIFICATIONS/LICENSING_BANNED"),xb[wb.Notification.DemoSendMessageError]=yb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),xb[wb.Notification.AccountAlreadyExists]=yb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),xb[wb.Notification.MailServerError]=yb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),xb[wb.Notification.UnknownNotification]=yb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),xb[wb.Notification.UnknownError]=yb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},yb.getUploadErrorDescByCode=function(a){var b="";switch(yb.pInt(a)){case wb.UploadErrorCode.FileIsTooBig:b=yb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case wb.UploadErrorCode.FilePartiallyUploaded:b=yb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case wb.UploadErrorCode.FileNoUploaded:b=yb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case wb.UploadErrorCode.MissingTempFolder:b=yb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case wb.UploadErrorCode.FileOnSaveingError:b=yb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case wb.UploadErrorCode.FileType:b=yb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=yb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},yb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=yb.pInt(d),0>=d?a[b].apply(a,yb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,yb.isArray(c)?c:[])},d))},yb.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===wb.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===wb.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},yb.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=yb.isUnd(d)?!0:d,e.canExecute=c.computed(yb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},yb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(wb.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(wb.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Bb.sAnimationType=wb.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(wb.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return wb.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Bb.bMobileDevice||a===wb.InterfaceAnimation.None)Gb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Bb.sAnimationType=wb.InterfaceAnimation.None;else switch(a){case wb.InterfaceAnimation.Full:Gb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Bb.sAnimationType=a;break;case wb.InterfaceAnimation.Normal:Gb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Bb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=wb.DesktopNotifications.NotSupported;if(Jb&&Jb.permission)switch(Jb.permission.toLowerCase()){case"granted":c=wb.DesktopNotifications.Allowed;break;case"denied":c=wb.DesktopNotifications.Denied;break;case"default":c=wb.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&wb.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();wb.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):wb.DesktopNotifications.NotAllowed===c?Jb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),wb.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")?yb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?yb.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},yb.isFolderExpanded=function(a){var b=Kb.local().get(wb.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},yb.setExpandedFolder=function(a,b){var c=Kb.local().get(wb.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Kb.local().set(wb.ClientSideKeyName.ExpandedFolders,c)},yb.initLayoutResizer=function(a,c,d){var e=b(a),f=b(c),g=Kb.local().get(d)||null,h=function(a,b){b&&b.size&&b.size.width&&(Kb.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})},yb.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&&0 100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),yb.windowResize()}).after("
").before("
"))})}},yb.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()}))},yb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,zb.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},yb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Cb.settings.push(a)},yb.removeSettingsViewModel=function(a){Cb["settings-removed"].push(a)},yb.disableSettingsViewModel=function(a){Cb["settings-disabled"].push(a)},yb.convertThemeName=function(a){return yb.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},yb.quoteName=function(a){return a.replace(/["]/g,'\\"')},yb.microtime=function(){return(new Date).getTime()},yb.convertLangName=function(a,b){return yb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},yb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=yb.isUnd(a)?32:yb.pInt(a);b.length/g,">").replace(/")},yb.draggeblePlace=function(){return b('').appendTo("#rl-hidden")},yb.defautOptionsAfterRender=function(a,b){b&&!yb.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},yb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+yb.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")),yb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+yb.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)},yb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=yb.isUnd(d)?1e3:yb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?wb.SaveSettingsStep.TrueResult:wb.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,wb.SaveSettingsStep.Idle)},d)}},yb.settingsSaveHelperSimpleFunction=function(a,b){return yb.settingsSaveHelperFunction(null,a,b,1e3)},yb.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(/").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Kb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),yb.delegateRun(e,"onBuild",[i])):yb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(yb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),yb.delegateRun(d.oCurrentSubScreen,"onShow"),yb.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)),yb.windowResize() +})):Db.setHash(Kb.link().settings(),!1,!0)},pb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(yb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},pb.prototype.onBuild=function(){h.each(Cb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Cb["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(Cb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},pb.prototype.routes=function(){var a=h.find(Cb.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=yb.isUnd(c.subname)?b:yb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(qb.prototype,s.prototype),qb.prototype.onShow=function(){Kb.setTitle("")},h.extend(rb.prototype,s.prototype),rb.prototype.oLastRoute={},rb.prototype.setNewTitle=function(){var a=Kb.data().accountEmail(),b=Kb.data().foldersInboxUnreadCount();Kb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+yb.i18n("TITLES/MAILBOX"))},rb.prototype.onShow=function(){this.setNewTitle()},rb.prototype.onRoute=function(a,b,c,d){if(yb.isUnd(d)?1:!d){var e=Kb.data(),f=Kb.cache().getFolderFullNameRaw(a),g=Kb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),wb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Kb.reloadMessageList())}else wb.Layout.NoPreview!==Kb.data().layout()||Kb.data().message()||Kb.historyBack()},rb.prototype.onStart=function(){var a=Kb.data(),b=function(){yb.windowResize()};(Kb.settingsGet("AllowAdditionalAccounts")||Kb.settingsGet("AllowIdentities"))&&Kb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Kb.folderInformation("INBOX")},1e3),h.delay(function(){Kb.quota()},5e3),h.delay(function(){Kb.remote().appDelayStart(yb.emptyFunction)},35e3),Gb.toggleClass("rl-no-preview-pane",wb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Gb.toggleClass("rl-no-preview-pane",wb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},rb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=yb.pString(b[0]),b[1]=yb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=yb.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]=yb.pString(b[0]),b[1]=yb.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(sb.prototype,pb.prototype),sb.prototype.onShow=function(){Kb.setTitle(this.sSettingsTitle)},h.extend(tb.prototype,q.prototype),tb.prototype.oSettings=null,tb.prototype.oPlugins=null,tb.prototype.oLocal=null,tb.prototype.oLink=null,tb.prototype.oSubs={},tb.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):(Bb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},tb.prototype.link=function(){return null===this.oLink&&(this.oLink=new j),this.oLink},tb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},tb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=yb.isNormal(Eb)?Eb:{}),yb.isUnd(this.oSettings[a])?null:this.oSettings[a]},tb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=yb.isNormal(Eb)?Eb:{}),this.oSettings[a]=b},tb.prototype.setTitle=function(b){b=(yb.isNormal(b)&&0]*>/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,"")},yb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},yb.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},yb.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:yb.isUnd(c)?a.toString():c.toString(),custom:yb.isUnd(c)?!1:!0,title:yb.isUnd(c)?"":a.toString(),value:a.toString()};(yb.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}},yb.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()}},yb.openPgpImportPublicKeys=function(b){if(a.openpgp&&Kb){var c=Kb.data().openpgpKeyring,d=a.openpgp.key.readArmored(b);if(c&&d&&!d.err&&yb.isArray(d.keys)&&0>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 Ab._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;c d?(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(!Bb.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+yb.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={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&&!yb.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&&!yb.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.modal={init:function(a,d){b(a).toggleClass("fade",!Bb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)}).on("shown",function(){yb.windowResize()})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){yb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),yb.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=yb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=yb.pInt(e[2]),g=Hb.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(!Bb.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),yb.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),yb.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(){yb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Bb.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){Bb.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){Kb.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=yb.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(yb.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},yb.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=yb.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=yb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),yb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},j.prototype.root=function(){return this.sBase},j.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},j.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},j.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},j.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},j.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},j.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},j.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},j.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},j.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},j.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},j.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},j.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},j.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},j.prototype.settings=function(a){var b=this.sBase+"settings";return yb.isUnd(a)||""===a||(b+="/"+a),b},j.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},j.prototype.mailBox=function(a,b,c){b=yb.isNormal(b)?yb.pInt(b):1,c=yb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},j.prototype.phpInfo=function(){return this.sServer+"Info"},j.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},j.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},j.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},j.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},j.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},j.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},j.prototype.openPgpJs=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/js/openpgp.js"},j.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},j.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},j.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},zb.oViewModelsHooks={},zb.oSimpleHooks={},zb.regViewModelHook=function(a,b){b&&(b.__hookName=a)},zb.addHook=function(a,b){yb.isFunc(b)&&(yb.isArray(zb.oSimpleHooks[a])||(zb.oSimpleHooks[a]=[]),zb.oSimpleHooks[a].push(b))},zb.runHook=function(a,b){yb.isArray(zb.oSimpleHooks[a])&&(b=b||[],h.each(zb.oSimpleHooks[a],function(a){a.apply(null,b)}))},zb.mainSettingsGet=function(a){return Kb?Kb.settingsGet(a):null},zb.remoteRequest=function(a,b,c,d,e,f){Kb&&Kb.remote().defaultRequest(a,b,c,d,e,f)},zb.settingsGet=function(a,b){var c=zb.mainSettingsGet("Plugins");return c=c&&yb.isUnd(c[a])?null:c[a],c?yb.isUnd(c[b])?null:c[b]:null},k.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},k.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},k.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},k.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},k.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},k.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},k.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},k.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},k.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},k.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Bb.oHtmlEditorDefaultConfig,d=Kb.settingsGet("Language"),e=!!Kb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Bb.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},k.prototype.focus=function(){this.editor&&this.editor.focus()},k.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},k.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},k.prototype.clear=function(a){this.setHtml("",a)},l.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},l.prototype.goDown=function(){this.newSelectPosition(wb.EventKeyCode.Down,!1)},l.prototype.goUp=function(){this.newSelectPosition(wb.EventKeyCode.Up,!1)},l.prototype.init=function(d,e){if(this.oContentVisible=d,this.oContentScrollable=e,this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.sLastUid=f.getItemUid(b),b.selected()?(b.checked(!1),f.selectedItem(null)):b.checked(!b.checked())))}),b(a.document).on("keydown",function(a){var b=!0;return a&&f.bUseKeyboard&&!yb.inFocus()&&(-1 0)if(m){if(m)if(wb.EventKeyCode.Down===b||wb.EventKeyCode.Up===b||wb.EventKeyCode.Insert===b)h.each(k,function(a){if(!i)switch(b){case wb.EventKeyCode.Up:m===a?i=!0:j=a;break;case wb.EventKeyCode.Down:case wb.EventKeyCode.Insert:g?(j=a,i=!0):m===a&&(g=!0)}});else if(wb.EventKeyCode.Home===b||wb.EventKeyCode.End===b)wb.EventKeyCode.Home===b?j=k[0]:wb.EventKeyCode.End===b&&(j=k[k.length-1]);else if(wb.EventKeyCode.PageDown===b){for(;l>e;e++)if(m===k[e]){e+=f,e=e>l-1?l-1:e,j=k[e];break}}else if(wb.EventKeyCode.PageUp===b)for(e=l;e>=0;e--)if(m===k[e]){e-=f,e=0>e?0:e,j=k[e];break}}else wb.EventKeyCode.Down===b||wb.EventKeyCode.Insert===b||wb.EventKeyCode.Home===b||wb.EventKeyCode.PageUp===b?j=k[0]:(wb.EventKeyCode.Up===b||wb.EventKeyCode.End===b||wb.EventKeyCode.PageDown===b)&&(j=k[k.length-1]);j?(m&&(c?(wb.EventKeyCode.Up===b||wb.EventKeyCode.Down===b)&&m.checked(!m.checked()):wb.EventKeyCode.Insert===b&&m.checked(!m.checked())),this.throttleSelection=!0,this.selectedItem(j),this.throttleSelection=!0,0!==this.iSelectTimer?(a.clearTimeout(this.iSelectTimer),this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0,d.actionClick(j)},1e3)):(this.iSelectTimer=a.setTimeout(function(){d.iSelectTimer=0},200),this.actionClick(j)),this.scrollToSelected()):m&&(!c||wb.EventKeyCode.Up!==b&&wb.EventKeyCode.Down!==b?wb.EventKeyCode.Insert===b&&m.checked(!m.checked()):m.checked(!m.checked()))},l.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemSelectedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(this.oContentScrollable.scrollTop(d.top<0?this.oContentScrollable.scrollTop()+d.top-a:this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},l.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},l.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked()))),c&&(this.selectedItem(a),this.sLastUid=d)}},l.prototype.on=function(a,b){this.oCallbacks[a]=b},m.supported=function(){return!0},m.prototype.set=function(a,c){var d=b.cookie(vb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(vb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},m.prototype.get=function(a){var c=b.cookie(vb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!yb.isUnd(d[a])?d[a]:null}catch(e){}return d},n.supported=function(){return!!a.localStorage},n.prototype.set=function(b,c){var d=a.localStorage[vb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[vb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},n.prototype.get=function(b){var c=a.localStorage[vb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!yb.isUnd(d[b])?d[b]:null}catch(e){}return d},o.prototype.item="armoredRainLoopKeys",o.prototype.load=function(){var b=0,c=0,d=[],e=JSON.parse(a.localStorage.getItem(this.item));if(e&&0 b;b++)d.push(a.openpgp.key.readArmored(e[b]).keys[0]);return d},o.prototype.store=function(b){for(var c=0,d=b.length,e=[];d>c;c++)e.push(b[c].armor());a.localStorage.setItem(this.item,JSON.stringify(e))},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.registerPopupEscapeKey=function(){var a=this;Hb.on("keydown",function(b){return b&&wb.EventKeyCode.Esc===b.keyCode&&a.modalVisibility()?(yb.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;yb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||yb.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){yb.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 yb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||yb.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=Kb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=yb.createCommand(e,function(){Db.hideScreenPopup(a)})),zb.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),yb.delegateRun(e,"onBuild",[h]),e&&"Popups"===f&&!e.bDisabeCloseOnEsc&&e.registerPopupEscapeKey(),zb.runHook("view-model-post-build",[a.__name,e,h])):yb.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),yb.delegateRun(a.__vm,"onHide"),Kb.popupVisibilityNames.remove(a.__name),zb.runHook("view-model-on-hide",[a.__name,a.__vm]),h.delay(function(){a.__dom.hide()},300))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),yb.delegateRun(a.__vm,"onShow",b||[]),Kb.popupVisibilityNames.push(a.__name),zb.runHook("view-model-on-show",[a.__name,a.__vm,b||[]]),yb.delegateRun(a.__vm,"onFocus",[],500)))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===yb.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,yb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),yb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(yb.delegateRun(c.oCurrentScreen,"onHide"),yb.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),yb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(yb.delegateRun(c.oCurrentScreen,"onShow"),zb.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),yb.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),yb.delegateRun(a.__vm,"onShow"),yb.delegateRun(a.__vm,"onFocus",[],200),zb.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(),zb.runHook("screen-pre-start",[a.screenName(),a]),yb.delegateRun(a,"onStart"),zb.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(){Gb.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=yb.isUnd(c)?!1:!!c,(yb.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},Db=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=wb.EmailType.Facebook),null===this.privateType&&(this.privateType=wb.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=yb.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=yb.trim(a.Name),this.email=yb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=yb.isUnd(b)?!1:!!b,c=yb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+yb.encodeHtml(this.name)+"":c?yb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=yb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+yb.encodeHtml(d)+""+yb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=yb.encodeHtml(d))):b&&(d=''+yb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=yb.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+f.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(g),e.data=Kb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),yb.delegateRun(e,"onBuild",[i])):yb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(yb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),yb.delegateRun(d.oCurrentSubScreen,"onShow"),yb.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)),yb.windowResize()})):Db.setHash(Kb.link().settings(),!1,!0)},pb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(yb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},pb.prototype.onBuild=function(){h.each(Cb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Cb["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(Cb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},pb.prototype.routes=function(){var a=h.find(Cb.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=yb.isUnd(c.subname)?b:yb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(qb.prototype,s.prototype),qb.prototype.onShow=function(){Kb.setTitle("")},h.extend(rb.prototype,s.prototype),rb.prototype.oLastRoute={},rb.prototype.setNewTitle=function(){var a=Kb.data().accountEmail(),b=Kb.data().foldersInboxUnreadCount();Kb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+yb.i18n("TITLES/MAILBOX"))},rb.prototype.onShow=function(){this.setNewTitle()},rb.prototype.onRoute=function(a,b,c,d){if(yb.isUnd(d)?1:!d){var e=Kb.data(),f=Kb.cache().getFolderFullNameRaw(a),g=Kb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),wb.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Kb.reloadMessageList())}else wb.Layout.NoPreview!==Kb.data().layout()||Kb.data().message()||Kb.historyBack()},rb.prototype.onStart=function(){var a=Kb.data(),b=function(){yb.windowResize()};(Kb.settingsGet("AllowAdditionalAccounts")||Kb.settingsGet("AllowIdentities"))&&Kb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Kb.folderInformation("INBOX")},1e3),h.delay(function(){Kb.quota()},5e3),h.delay(function(){Kb.remote().appDelayStart(yb.emptyFunction)},35e3),Gb.toggleClass("rl-no-preview-pane",wb.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Gb.toggleClass("rl-no-preview-pane",wb.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},rb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0] -},b=function(a,b){return b[0]=yb.pString(b[0]),b[1]=yb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=yb.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]=yb.pString(b[0]),b[1]=yb.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(sb.prototype,pb.prototype),sb.prototype.onShow=function(){Kb.setTitle(this.sSettingsTitle)},h.extend(tb.prototype,q.prototype),tb.prototype.oSettings=null,tb.prototype.oPlugins=null,tb.prototype.oLocal=null,tb.prototype.oLink=null,tb.prototype.oSubs={},tb.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):(Bb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},tb.prototype.link=function(){return null===this.oLink&&(this.oLink=new j),this.oLink},tb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},tb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=yb.isNormal(Eb)?Eb:{}),yb.isUnd(this.oSettings[a])?null:this.oSettings[a]},tb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=yb.isNormal(Eb)?Eb:{}),this.oSettings[a]=b},tb.prototype.setTitle=function(b){b=(yb.isNormal(b)&&00&&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=yb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=yb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=yb.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-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},z.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(yb.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&&0 d;d++)yb.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(wb.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(wb.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(wb.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=Kb.data().sentFolder(),b=Kb.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(yb.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(yb.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(yb.pInt(a.ParentThread)),this.threads(yb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(yb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},z.prototype.initUpdateByMessageJson=function(a){var b=!1,c=wb.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=yb.pInt(a.Priority),this.priority(-1 b;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 yb.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 yb.isArray(this.from)&&this.from[0]?this.from[0].email:""},z.prototype.viewLink=function(){return Kb.link().messageViewLink(this.requestHash)},z.prototype.downloadLink=function(){return Kb.link().messageDownloadLink(this.requestHash)},z.prototype.replyEmails=function(a){var b=[],c=yb.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=yb.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(wb.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=yb.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=yb.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]}),Hb.resize()),yb.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=yb.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=yb.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]),yb.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),Kb.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&&Kb.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=yb.pString(this.body.data("rl-plain-raw")),Kb.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(wb.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=Kb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(wb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(wb.SignedVerifyStatus.Unverified),c=d.verify(f),c&&0 ').text(j)).html(),Lb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},z.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.newInstanceFromJson=function(a){var b=new A;return b.initByJson(a)?b.initComputed():null},A.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return wb.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 wb.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){yb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){yb.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(wb.FolderType.Inbox===c&&Kb.data().foldersInboxUnreadCount(b),a>0){if(wb.FolderType.Draft===c)return""+a;if(b>0&&wb.FolderType.Trash!==c&&wb.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(){yb.timeOutAction("folder-list-folder-visibility-change",function(){Hb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Bb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case wb.FolderType.Inbox:b=yb.i18n("FOLDER_LIST/INBOX_NAME");break;case wb.FolderType.SentItems:b=yb.i18n("FOLDER_LIST/SENT_NAME");break;case wb.FolderType.Draft:b=yb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case wb.FolderType.Spam:b=yb.i18n("FOLDER_LIST/SPAM_NAME");break;case wb.FolderType.Trash:b=yb.i18n("FOLDER_LIST/TRASH_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Bb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case wb.FolderType.Inbox:a="("+yb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case wb.FolderType.SentItems:a="("+yb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case wb.FolderType.Draft:a="("+yb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case wb.FolderType.Spam:a="("+yb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case wb.FolderType.Trash:a="("+yb.i18n("FOLDER_LIST/TRASH_NAME")+")"}return(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())&&(a=""),a},this),this.collapsed=c.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this}),this.hasUnreadMessages=c.computed(function(){return 0 "},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():'"'+yb.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,yb.extendAsViewModel("PopupsFolderClearViewModel",E),E.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},E.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},yb.extendAsViewModel("PopupsFolderCreateViewModel",F),F.prototype.sNoParentText="",F.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(yb.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)},yb.extendAsViewModel("PopupsFolderSystemViewModel",G),G.prototype.sChooseOnText="",G.prototype.sUnuseText="",G.prototype.onShow=function(a){var b="";switch(a=yb.isUnd(a)?wb.SetSystemFoldersNotification.None:a){case wb.SetSystemFoldersNotification.Sent:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case wb.SetSystemFoldersNotification.Draft:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case wb.SetSystemFoldersNotification.Spam:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case wb.SetSystemFoldersNotification.Trash:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)},yb.extendAsViewModel("PopupsComposeViewModel",H),H.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Db.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=Kb.data().draftFolder();""!==a&&(Kb.cache().setFolderHash(a,""),Kb.data().currentFolderFullNameRaw()===a?Kb.reloadMessageList(!0):Kb.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[Kb.data().accountEmail()]=Kb.data().accountEmail(),b)switch(a){case wb.ComposeType.Empty:d=Kb.data().accountEmail();break;case wb.ComposeType.Reply:case wb.ComposeType.ReplyAll:case wb.ComposeType.Forward:case wb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case wb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Kb.data().accountEmail();return d},H.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},H.prototype.formattedFrom=function(a){var b=Kb.data().displayName(),c=Kb.data().accountEmail();return""===b?c:(yb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+yb.quoteName(b)+'" <'+c+">"},H.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),wb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&yb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&wb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(yb.trim(yb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=yb.getNotification(c&&c.ErrorCode?c.ErrorCode:wb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||yb.getNotification(wb.Notification.CantSendMessage)))),this.reloadDraftFolder()},H.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),wb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Kb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Kb.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(0 c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&yb.isNormal(c)&&(v=yb.isArray(c)&&1===c.length?c[0]:yb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),yb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),yb.removeBlockquoteSwitcher(l),m=l.html(),w){case wb.ComposeType.Empty:break;case wb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(yb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.sReferences);break;case wb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(yb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.references());break;case wb.ComposeType.Forward:this.subject(yb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.sReferences);break;case wb.ComposeType.ForwardAsAttachment:this.subject(yb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.sReferences);break;case wb.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=yb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case wb.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=yb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case wb.ComposeType.Reply:case wb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=yb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case wb.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m=""+m+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+yb.encodeHtml(j)+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+yb.encodeHtml(k)+"
"+m;break;case wb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&wb.ComposeType.EditAsNew!==w&&wb.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 wb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),wb.EditorDefaultType.Html!==Kb.data().editorDefaultType()&&a.modeToggle(!1)})):yb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),yb.isNonEmptyArray(t)&&Kb.remote().messageUploadAttachments(function(a,b){if(wb.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;Db.showScreenPopup(R,[yb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&yb.delegateRun(a,"closeCommand")}])},H.prototype.onBuild=function(){this.initUploader();var a=this,c=null;Hb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Kb.data().useKeyboardShortcuts()&&(a.bAllowCtrlS&&b.ctrlKey&&wb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&wb.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):wb.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),Hb.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",Kb.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=yb.pInt(Kb.settingsGet("AttachmentLimit")),c=new g({action:Kb.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;yb.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=yb.isUnd(d.FileName)?"":d.FileName.toString(),g=yb.isNormal(d.Size)?yb.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(yb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;yb.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=yb.getUploadErrorDescByCode(f):g||(e=yb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(yb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Kb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),wb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(yb.getUploadErrorDescByCode(wb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},H.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=yb.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(wb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case wb.ComposeType.Reply:case wb.ComposeType.ReplyAll:i=h.isLinked;break;case wb.ComposeType.Forward:case wb.ComposeType.Draft:case wb.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(yb.getUploadErrorDescByCode(wb.UploadErrorCode.FileNoUploaded))},this)},H.prototype.isEmptyForm=function(a){a=yb.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()},yb.extendAsViewModel("PopupsContactsViewModel",I),I.prototype.setShareToNone=function(){this.viewScopeType(wb.ContactScopeType.Default)},I.prototype.setShareToAll=function(){this.viewScopeType(wb.ContactScopeType.ShareAll)},I.prototype.addNewProperty=function(a){var b=new w(a,"");b.focused(!0),this.viewProperties.push(b)},I.prototype.addNewEmail=function(){this.addNewProperty(wb.ContactPropertyType.EmailPersonal)},I.prototype.addNewPhone=function(){this.addNewProperty(wb.ContactPropertyType.MobilePersonal)},I.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Kb.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(yb.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(){0 0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,vb.Defaults.ContactsPerPage,this.search())},I.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Kb.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(yb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},I.prototype.onShow=function(){Db.routeOff(),this.reloadContactList(!0)},I.prototype.onHide=function(){Db.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},yb.extendAsViewModel("PopupsAdvancedSearchViewModel",J),J.prototype.buildSearchStringValue=function(a){return-1 0&&wb.EventKeyCode.Esc===c&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!yb.inFocus()&&e.message()&&(d.fullScreenMode(!1),wb.Layout.NoPreview===e.layout()&&Kb.historyBack(),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("mousedown","a",function(a){return!(a&&3!==a.which&&Kb.mailToHelper(b(this).attr("href")))}).on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Kb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},Y.prototype.isDraftFolder=function(){return Kb.data().message()&&Kb.data().draftFolder()===Kb.data().message().folderFullNameRaw},Y.prototype.isSentFolder=function(){return Kb.data().message()&&Kb.data().sentFolder()===Kb.data().message().folderFullNameRaw},Y.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},Y.prototype.composeClick=function(){Db.showScreenPopup(H)},Y.prototype.editMessage=function(){Kb.data().message()&&Db.showScreenPopup(H,[wb.ComposeType.Draft,Kb.data().message()])},Y.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},Y.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},Y.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},Y.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage()},Y.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Kb.remote().sendReadReceiptMessage(yb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),yb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),yb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":a.readReceipt()})),a.isReadReceipt(!0),Kb.cache().storeMessageFlagsToCache(a),Kb.reloadFlagsCurrentMessageListAndMessageFromCache())},yb.extendAsViewModel("SettingsMenuViewModel",Z),Z.prototype.link=function(a){return Kb.link().settings(a)},Z.prototype.backToMailBoxClick=function(){Db.setHash(Kb.link().inbox())},yb.extendAsViewModel("SettingsPaneViewModel",$),$.prototype.onShow=function(){Kb.data().message(null)},$.prototype.backToMailBoxClick=function(){Db.setHash(Kb.link().inbox())},yb.addSettingsViewModel(_,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),_.prototype.toggleLayout=function(){this.layout(wb.Layout.NoPreview===this.layout()?wb.Layout.SidePreview:wb.Layout.NoPreview)},_.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Kb.data(),d=yb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(wb.SaveSettingsStep.Animate),b.ajax({url:Kb.link().langLink(c),dataType:"script",cache:!0}).done(function(){yb.i18nToDoc(),a.languageTrigger(wb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(wb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(wb.SaveSettingsStep.Idle)},1e3)}),Kb.remote().saveSettings(yb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Kb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){yb.timeOutAction("SaveDesktopNotifications",function(){Kb.remote().saveSettings(yb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){yb.timeOutAction("SaveReplySameFolder",function(){Kb.remote().saveSettings(yb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Kb.remote().saveSettings(yb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Kb.remote().saveSettings(yb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},_.prototype.onShow=function(){Kb.data().desktopNotifications.valueHasMutated()},_.prototype.selectLanguage=function(){Db.showScreenPopup(Q)},yb.addSettingsViewModel(ab,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),ab.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},ab.prototype.onBuild=function(){Kb.data().contactsAutosave.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},ab.prototype.onShow=function(){this.showPassword(!1)},yb.addSettingsViewModel(bb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),bb.prototype.addNewAccount=function(){Db.showScreenPopup(K)},bb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Kb.remote().accountDelete(function(b,c){wb.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Db.routeOff(),Db.setHash(Kb.link().root(),!0),Db.routeOff(),h.defer(function(){a.location.reload()})):Kb.accountsAndIdentities()},b.email))}},yb.addSettingsViewModel(cb,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),cb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Kb.data().signature();this.editor=new k(a.signatureDom(),function(){Kb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},cb.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Kb.data(),c=yb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=yb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=yb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Kb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Kb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Kb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Kb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},yb.addSettingsViewModel(db,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),db.prototype.addNewIdentity=function(){Db.showScreenPopup(P)},db.prototype.editIdentity=function(a){Db.showScreenPopup(P,[a])},db.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Kb.remote().identityDelete(function(){Kb.accountsAndIdentities()},a.id))}},db.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Kb.data().signature();this.editor=new k(a.signatureDom(),function(){Kb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},db.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=Kb.data(),c=yb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=yb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=yb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Kb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Kb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Kb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Kb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},yb.addSettingsViewModel(eb,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),yb.addSettingsViewModel(fb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),fb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},fb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),wb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},yb.addSettingsViewModel(gb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),gb.prototype.folderEditOnEnter=function(a){var b=a?yb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Kb.local().set(wb.ClientSideKeyName.FoldersLashHash,""),Kb.data().foldersRenaming(!0),Kb.remote().folderRename(function(a,b){Kb.data().foldersRenaming(!1),wb.StorageResultType.Success===a&&b&&b.Result||Kb.data().foldersListError(b&&b.ErrorCode?yb.getNotification(b.ErrorCode):yb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Kb.folders()},a.fullNameRaw,b),Kb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},gb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},gb.prototype.onShow=function(){Kb.data().foldersListError("")},gb.prototype.createFolder=function(){Db.showScreenPopup(F)},gb.prototype.systemFolder=function(){Db.showScreenPopup(G)},gb.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(Kb.local().set(wb.ClientSideKeyName.FoldersLashHash,""),Kb.data().folderList.remove(b),Kb.data().foldersDeleting(!0),Kb.remote().folderDelete(function(a,b){Kb.data().foldersDeleting(!1),wb.StorageResultType.Success===a&&b&&b.Result||Kb.data().foldersListError(b&&b.ErrorCode?yb.getNotification(b.ErrorCode):yb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Kb.folders()},a.fullNameRaw),Kb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 1048576?(a.alert(yb.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(yb.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:wb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},yb.addSettingsViewModel(ib,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),ib.prototype.addOpenPgpKey=function(){Db.showScreenPopup(L)},ib.prototype.generateOpenPgpKey=function(){Db.showScreenPopup(N)},ib.prototype.viewOpenPgpKey=function(a){a&&Db.showScreenPopup(M,[a])},ib.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Kb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Kb.reloadOpenPgpKeys())}},jb.prototype.populateDataOnStart=function(){var a=yb.pInt(Kb.settingsGet("Layout")),b=Kb.settingsGet("Languages"),c=Kb.settingsGet("Themes");yb.isArray(b)&&this.languages(b),yb.isArray(c)&&this.themes(c),this.mainLanguage(Kb.settingsGet("Language")),this.mainTheme(Kb.settingsGet("Theme")),this.allowCustomTheme(!!Kb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Kb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Kb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Kb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Kb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Kb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Kb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Kb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Kb.settingsGet("EditorDefaultType")),this.showImages(!!Kb.settingsGet("ShowImages")),this.contactsAutosave(!!Kb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Kb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Kb.settingsGet("MPP")),this.desktopNotifications(!!Kb.settingsGet("DesktopNotifications")),this.useThreads(!!Kb.settingsGet("UseThreads")),this.replySameFolder(!!Kb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Kb.settingsGet("UseCheckboxesInList")),this.layout(wb.Layout.SidePreview),-1 0&&(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)))},kb.prototype.populateDataOnStart=function(){jb.prototype.populateDataOnStart.call(this),this.accountEmail(Kb.settingsGet("Email")),this.accountIncLogin(Kb.settingsGet("IncLogin")),this.accountOutLogin(Kb.settingsGet("OutLogin")),this.projectHash(Kb.settingsGet("ProjectHash")),this.displayName(Kb.settingsGet("DisplayName")),this.replyTo(Kb.settingsGet("ReplyTo")),this.signature(Kb.settingsGet("Signature")),this.signatureToAll(!!Kb.settingsGet("SignatureToAll")),this.lastFoldersHash=Kb.local().get(wb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Kb.settingsGet("RemoteSuggestions"),this.devEmail=Kb.settingsGet("DevEmail"),this.devLogin=Kb.settingsGet("DevLogin"),this.devPassword=Kb.settingsGet("DevPassword")},kb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&yb.isNormal(c)&&""!==c){if(yb.isArray(d)&&0 3)i(Kb.link().notificationMailIcon(),Kb.data().accountEmail(),yb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Kb.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Kb.cache().setFolderUidNext(b,c)}},kb.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=Kb.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Kb.cache().setFolderToCacheList(g,f),Kb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=vb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!yb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Kb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),yb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),yb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&yb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},kb.prototype.setFolders=function(a){var b=[],c=!1,d=Kb.data(),e=function(a){return""===a||vb.Values.UnuseOptionValue===a||null!==Kb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&yb.isArray(a.Result["@Collection"])&&(yb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Kb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Kb.settingsGet("SentFolder")+Kb.settingsGet("DraftFolder")+Kb.settingsGet("SpamFolder")+Kb.settingsGet("TrashFolder")+Kb.settingsGet("NullFolder")&&(Kb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Kb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Kb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Kb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),c=!0),d.sentFolder(e(Kb.settingsGet("SentFolder"))),d.draftFolder(e(Kb.settingsGet("DraftFolder"))),d.spamFolder(e(Kb.settingsGet("SpamFolder"))),d.trashFolder(e(Kb.settingsGet("TrashFolder"))),c&&Kb.remote().saveSystemFolders(yb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),NullFolder:"NullFolder"}),Kb.local().set(wb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},kb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},kb.prototype.getNextFolderNames=function(a){a=yb.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&&0 b[0]?1:0}),h.find(g,function(a){var e=Kb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},kb.prototype.removeMessagesFromList=function(a,b,c,d){c=yb.isNormal(c)?c:"",d=yb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return yb.pInt(a)});var e=0,f=Kb.data(),g=Kb.cache(),i=Kb.cache().getFolderFromCacheList(a),j=""===c?null:g.getFolderFromCacheList(c||""),k=f.currentFolderFullNameRaw(),l=f.message(),m=k===a?h.filter(f.messageList(),function(a){return a&&-1 0&&i.messageCountUnread(0<=i.messageCountUnread()-e?i.messageCountUnread()-e:0)),j&&(j.messageCountAll(j.messageCountAll()+b.length),e>0&&j.messageCountUnread(j.messageCountUnread()+e),j.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Bb.iMessageBodyCacheCount),yb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):yb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Kb.data().allowOpenPGP()&&yb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=yb.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)),Lb.empty(),k&&n.isPgpSigned()?j=Lb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Lb.append(b('').text(n.plainRaw)).html()),Lb.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(wb.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),n.storeDataToDom(),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&yb.initBlockquoteSwitcher(g)),Kb.cache().initMessageFlagsFromCache(n),n.unseen()&&Kb.setMessageSeen(n),yb.windowResize())},kb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&yb.isArray(a.Result["@Collection"])){var c=Kb.data(),d=Kb.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=yb.pInt(a.Result.MessageResultCount),j=yb.pInt(a.Result.Offset),yb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Kb.cache().getFolderFromCacheList(yb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Kb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),yb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),yb.isNormal(a.Result.MessageUnseenCount)&&(yb.pInt(p.messageCountUnread())!==yb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Kb.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?Kb.cache().initMessageFlagsFromCache(o):Kb.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&&0 0?(this.defaultRequest(a,"Message",{},null,"Message/"+Ab.urlsafe_encode([b,c,Kb.data().projectHash(),Kb.data().threading()&&Kb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},mb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},mb.prototype.folderInformation=function(a,b,c){var d=!0,e=Kb.cache(),f=[];yb.isArray(c)&&0 l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1 l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(wb.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0 b;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 yb.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 yb.isArray(this.from)&&this.from[0]?this.from[0].email:""},z.prototype.viewLink=function(){return Kb.link().messageViewLink(this.requestHash)},z.prototype.downloadLink=function(){return Kb.link().messageDownloadLink(this.requestHash)},z.prototype.replyEmails=function(a){var b=[],c=yb.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=yb.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(wb.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=yb.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=yb.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]}),Hb.resize()),yb.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=yb.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=yb.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]),yb.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),Kb.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&&Kb.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=yb.pString(this.body.data("rl-plain-raw")),Kb.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(wb.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=Kb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(wb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?wb.SignedVerifyStatus.Unverified:wb.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0 ').text(j)).html(),Lb.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=Kb.data().findPublicKeysByEmail(g),j=Kb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(wb.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(wb.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(wb.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0 ').text(m)).html(),Lb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},z.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.newInstanceFromJson=function(a){var b=new A;return b.initByJson(a)?b.initComputed():null},A.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()})},this),this.canBeEdited=c.computed(function(){return wb.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 wb.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){yb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){yb.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(wb.FolderType.Inbox===c&&Kb.data().foldersInboxUnreadCount(b),a>0){if(wb.FolderType.Draft===c)return""+a;if(b>0&&wb.FolderType.Trash!==c&&wb.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(){yb.timeOutAction("folder-list-folder-visibility-change",function(){Hb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Bb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case wb.FolderType.Inbox:b=yb.i18n("FOLDER_LIST/INBOX_NAME");break;case wb.FolderType.SentItems:b=yb.i18n("FOLDER_LIST/SENT_NAME");break;case wb.FolderType.Draft:b=yb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case wb.FolderType.Spam:b=yb.i18n("FOLDER_LIST/SPAM_NAME");break;case wb.FolderType.Trash:b=yb.i18n("FOLDER_LIST/TRASH_NAME");break;case wb.FolderType.Archive:b=yb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Bb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case wb.FolderType.Inbox:a="("+yb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case wb.FolderType.SentItems:a="("+yb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case wb.FolderType.Draft:a="("+yb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case wb.FolderType.Spam:a="("+yb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case wb.FolderType.Trash:a="("+yb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case wb.FolderType.Archive:a="("+yb.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():'"'+yb.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,yb.extendAsViewModel("PopupsFolderClearViewModel",E),E.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},E.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},yb.extendAsViewModel("PopupsFolderCreateViewModel",F),F.prototype.sNoParentText="",F.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(yb.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)},yb.extendAsViewModel("PopupsFolderSystemViewModel",G),G.prototype.sChooseOnText="",G.prototype.sUnuseText="",G.prototype.onShow=function(a){var b="";switch(a=yb.isUnd(a)?wb.SetSystemFoldersNotification.None:a){case wb.SetSystemFoldersNotification.Sent:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case wb.SetSystemFoldersNotification.Draft:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case wb.SetSystemFoldersNotification.Spam:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case wb.SetSystemFoldersNotification.Trash:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case wb.SetSystemFoldersNotification.Archive:b=yb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},yb.extendAsViewModel("PopupsComposeViewModel",H),H.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Db.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=Kb.data().draftFolder();""!==a&&(Kb.cache().setFolderHash(a,""),Kb.data().currentFolderFullNameRaw()===a?Kb.reloadMessageList(!0):Kb.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[Kb.data().accountEmail()]=Kb.data().accountEmail(),b)switch(a){case wb.ComposeType.Empty:d=Kb.data().accountEmail();break;case wb.ComposeType.Reply:case wb.ComposeType.ReplyAll:case wb.ComposeType.Forward:case wb.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case wb.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Kb.data().accountEmail();return d},H.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},H.prototype.formattedFrom=function(a){var b=Kb.data().displayName(),c=Kb.data().accountEmail();return""===b?c:(yb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+yb.quoteName(b)+'" <'+c+">"},H.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),wb.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&yb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&wb.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(yb.trim(yb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=yb.getNotification(c&&c.ErrorCode?c.ErrorCode:wb.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||yb.getNotification(wb.Notification.CantSendMessage)))),this.reloadDraftFolder()},H.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),wb.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Kb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Kb.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(0 c;c++)e.push(a[c].toLine(!!b));return e.join(", ")};if(c=c||null,c&&yb.isNormal(c)&&(v=yb.isArray(c)&&1===c.length?c[0]:yb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),yb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),yb.removeBlockquoteSwitcher(l),m=l.html(),w){case wb.ComposeType.Empty:break;case wb.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(yb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.sReferences);break;case wb.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(yb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.references());break;case wb.ComposeType.Forward:this.subject(yb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.sReferences);break;case wb.ComposeType.ForwardAsAttachment:this.subject(yb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=yb.trim(this.sInReplyTo+" "+v.sReferences);break;case wb.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=yb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case wb.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=yb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case wb.ComposeType.Reply:case wb.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=yb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case wb.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m=""+m+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+yb.encodeHtml(j)+"
"+yb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+yb.encodeHtml(k)+"
"+m;break;case wb.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&wb.ComposeType.EditAsNew!==w&&wb.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 wb.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),wb.EditorDefaultType.Html!==Kb.data().editorDefaultType()&&a.modeToggle(!1)})):yb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),yb.isNonEmptyArray(t)&&Kb.remote().messageUploadAttachments(function(a,b){if(wb.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;Db.showScreenPopup(R,[yb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&yb.delegateRun(a,"closeCommand")}])},H.prototype.onBuild=function(){this.initUploader();var a=this,c=null;Hb.on("keydown",function(b){var c=!0;return b&&a.modalVisibility()&&Kb.data().useKeyboardShortcuts()&&(a.bAllowCtrlS&&b.ctrlKey&&wb.EventKeyCode.S===b.keyCode?(a.saveCommand(),c=!1):b.ctrlKey&&wb.EventKeyCode.Enter===b.keyCode?(a.sendCommand(),c=!1):wb.EventKeyCode.Esc===b.keyCode&&(a.tryToClosePopup(),c=!1)),c}),Hb.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",Kb.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=yb.pInt(Kb.settingsGet("AttachmentLimit")),c=new g({action:Kb.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;yb.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=yb.isUnd(d.FileName)?"":d.FileName.toString(),g=yb.isNormal(d.Size)?yb.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(yb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;yb.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=yb.getUploadErrorDescByCode(f):g||(e=yb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(yb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Kb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),wb.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(yb.getUploadErrorDescByCode(wb.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},H.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=yb.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(wb.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case wb.ComposeType.Reply:case wb.ComposeType.ReplyAll:i=h.isLinked;break;case wb.ComposeType.Forward:case wb.ComposeType.Draft:case wb.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(yb.getUploadErrorDescByCode(wb.UploadErrorCode.FileNoUploaded))},this)},H.prototype.isEmptyForm=function(a){a=yb.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()},yb.extendAsViewModel("PopupsContactsViewModel",I),I.prototype.setShareToNone=function(){this.viewScopeType(wb.ContactScopeType.Default)},I.prototype.setShareToAll=function(){this.viewScopeType(wb.ContactScopeType.ShareAll)},I.prototype.addNewProperty=function(a){var b=new w(a,"");b.focused(!0),this.viewProperties.push(b)},I.prototype.addNewEmail=function(){this.addNewProperty(wb.ContactPropertyType.EmailPersonal)},I.prototype.addNewPhone=function(){this.addNewProperty(wb.ContactPropertyType.MobilePersonal)},I.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Kb.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(yb.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(){0 0?d:0),b.contactsCount(d),b.contacts(e),b.viewClearSearch(""!==b.search()),b.contacts.loading(!1),""!==b.viewID()&&!b.currentContact()&&b.contacts.setSelectedByUid&&b.contacts.setSelectedByUid(""+b.viewID())},c,vb.Defaults.ContactsPerPage,this.search())},I.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable);var d=this;c.computed(function(){var a=this.modalVisibility(),b=Kb.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&b)},this).extend({notify:"always"}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(yb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},I.prototype.onShow=function(){Db.routeOff(),this.reloadContactList(!0)},I.prototype.onHide=function(){Db.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),h.each(this.contacts(),function(a){a.checked(!1)})},yb.extendAsViewModel("PopupsAdvancedSearchViewModel",J),J.prototype.buildSearchStringValue=function(a){return-1 1?" ("+(100>a?a:"99+")+")":""},X.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},X.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()&&Kb.moveMessagesToFolder(Kb.data().currentFolderFullNameRaw(),Kb.data().messageListCheckedOrSelectedUidsWithSubMails(),a),!1},X.prototype.dragAndDronHelper=function(a,b){a&&a.checked(!0);var c=yb.draggeblePlace();return c.data("rl-folder",Kb.data().currentFolderFullNameRaw()),c.data("rl-uids",Kb.data().messageListCheckedOrSelectedUidsWithSubMails()),c.data("rl-copy",b?"1":"0"),c.find(".text").text((b?"+":"")+""+Kb.data().messageListCheckedOrSelectedUidsWithSubMails().length),c},X.prototype.onMessageResponse=function(a,b,c){var d=Kb.data();d.hideMessageBodies(),d.messageLoading(!1),wb.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):wb.StorageResultType.Unload===a?(d.message(null),d.messageError("")):wb.StorageResultType.Abort!==a&&(d.message(null),d.messageError(yb.getNotification(b&&b.ErrorCode?b.ErrorCode:wb.Notification.UnknownError)))},X.prototype.populateMessageBody=function(a){a&&(Kb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Kb.data().messageLoading(!0):yb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},X.prototype.setAction=function(a,b,c){var d=[],e=null,f=Kb.cache(),g=0;if(yb.isUnd(c)&&(c=Kb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0 0&&wb.EventKeyCode.Esc===c&&d.viewModelVisibility()&&e.useKeyboardShortcuts()&&!yb.inFocus()&&e.message()&&(d.fullScreenMode(!1),wb.Layout.NoPreview===e.layout()&&Kb.historyBack(),b=!1),b}),b(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",gallery:{enabled:!0,preload:[1,1],navigateByImgClick:!0},callbacks:{open:function(){e.useKeyboardShortcuts(!1)},close:function(){e.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:400}),a.on("mousedown","a",function(a){return!(a&&3!==a.which&&Kb.mailToHelper(b(this).attr("href")))}).on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=c.dataFor(this);a&&a.download&&Kb.download(a.linkDownload())}),this.oMessageScrollerDom=a.find(".messageItem .content"),this.oMessageScrollerDom=this.oMessageScrollerDom&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null},Y.prototype.isDraftFolder=function(){return Kb.data().message()&&Kb.data().draftFolder()===Kb.data().message().folderFullNameRaw},Y.prototype.isSentFolder=function(){return Kb.data().message()&&Kb.data().sentFolder()===Kb.data().message().folderFullNameRaw},Y.prototype.isSpamFolder=function(){return Kb.data().message()&&Kb.data().spamFolder()===Kb.data().message().folderFullNameRaw},Y.prototype.isSpamDisabled=function(){return Kb.data().message()&&Kb.data().spamFolder()===vb.Values.UnuseOptionValue},Y.prototype.isArchiveFolder=function(){return Kb.data().message()&&Kb.data().archiveFolder()===Kb.data().message().folderFullNameRaw},Y.prototype.isArchiveDisabled=function(){return Kb.data().message()&&Kb.data().archiveFolder()===vb.Values.UnuseOptionValue},Y.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()},Y.prototype.composeClick=function(){Db.showScreenPopup(H)},Y.prototype.editMessage=function(){Kb.data().message()&&Db.showScreenPopup(H,[wb.ComposeType.Draft,Kb.data().message()])},Y.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&this.oMessageScrollerDom.scrollTop(0)},Y.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)},Y.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},Y.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},Y.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Kb.remote().sendReadReceiptMessage(yb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),yb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),yb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":a.readReceipt()})),a.isReadReceipt(!0),Kb.cache().storeMessageFlagsToCache(a),Kb.reloadFlagsCurrentMessageListAndMessageFromCache())},yb.extendAsViewModel("SettingsMenuViewModel",Z),Z.prototype.link=function(a){return Kb.link().settings(a)},Z.prototype.backToMailBoxClick=function(){Db.setHash(Kb.link().inbox())},yb.extendAsViewModel("SettingsPaneViewModel",$),$.prototype.onShow=function(){Kb.data().message(null)},$.prototype.backToMailBoxClick=function(){Db.setHash(Kb.link().inbox())},yb.addSettingsViewModel(_,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),_.prototype.toggleLayout=function(){this.layout(wb.Layout.NoPreview===this.layout()?wb.Layout.SidePreview:wb.Layout.NoPreview)},_.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Kb.data(),d=yb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(wb.SaveSettingsStep.Animate),b.ajax({url:Kb.link().langLink(c),dataType:"script",cache:!0}).done(function(){yb.i18nToDoc(),a.languageTrigger(wb.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(wb.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(wb.SaveSettingsStep.Idle)},1e3)}),Kb.remote().saveSettings(yb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Kb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){yb.timeOutAction("SaveDesktopNotifications",function(){Kb.remote().saveSettings(yb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){yb.timeOutAction("SaveReplySameFolder",function(){Kb.remote().saveSettings(yb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Kb.remote().saveSettings(yb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Kb.remote().saveSettings(yb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},_.prototype.onShow=function(){Kb.data().desktopNotifications.valueHasMutated()},_.prototype.selectLanguage=function(){Db.showScreenPopup(Q)},yb.addSettingsViewModel(ab,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),ab.prototype.toggleShowPassword=function(){this.showPassword(!this.showPassword())},ab.prototype.onBuild=function(){Kb.data().contactsAutosave.subscribe(function(a){Kb.remote().saveSettings(yb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},ab.prototype.onShow=function(){this.showPassword(!1)},yb.addSettingsViewModel(bb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),bb.prototype.addNewAccount=function(){Db.showScreenPopup(K)},bb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Kb.remote().accountDelete(function(b,c){wb.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Db.routeOff(),Db.setHash(Kb.link().root(),!0),Db.routeOff(),h.defer(function(){a.location.reload()})):Kb.accountsAndIdentities()},b.email))}},yb.addSettingsViewModel(cb,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),cb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Kb.data().signature();this.editor=new k(a.signatureDom(),function(){Kb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},cb.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Kb.data(),c=yb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=yb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=yb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Kb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Kb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Kb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Kb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},yb.addSettingsViewModel(db,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),db.prototype.addNewIdentity=function(){Db.showScreenPopup(P)},db.prototype.editIdentity=function(a){Db.showScreenPopup(P,[a])},db.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Kb.remote().identityDelete(function(){Kb.accountsAndIdentities()},a.id))}},db.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Kb.data().signature();this.editor=new k(a.signatureDom(),function(){Kb.data().signature((a.editor.isHtml()?":HTML:":"")+a.editor.getData())},function(){":HTML:"===b.substr(0,6)?a.editor.setHtml(b.substr(6),!1):a.editor.setPlain(b,!1)})}},db.prototype.onBuild=function(a){var b=this;a.on("click",".identity-item .e-action",function(){var a=c.dataFor(this);a&&b.editIdentity(a)}),h.delay(function(){var a=Kb.data(),c=yb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=yb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=yb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Kb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Kb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Kb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Kb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},yb.addSettingsViewModel(eb,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),yb.addSettingsViewModel(fb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),fb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword("")},fb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),wb.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)},yb.addSettingsViewModel(gb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),gb.prototype.folderEditOnEnter=function(a){var b=a?yb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Kb.local().set(wb.ClientSideKeyName.FoldersLashHash,""),Kb.data().foldersRenaming(!0),Kb.remote().folderRename(function(a,b){Kb.data().foldersRenaming(!1),wb.StorageResultType.Success===a&&b&&b.Result||Kb.data().foldersListError(b&&b.ErrorCode?yb.getNotification(b.ErrorCode):yb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Kb.folders()},a.fullNameRaw,b),Kb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},gb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},gb.prototype.onShow=function(){Kb.data().foldersListError("")},gb.prototype.createFolder=function(){Db.showScreenPopup(F) +},gb.prototype.systemFolder=function(){Db.showScreenPopup(G)},gb.prototype.deleteFolder=function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){return a===c?!0:(c.subFolders.remove(b),!1)};a&&(Kb.local().set(wb.ClientSideKeyName.FoldersLashHash,""),Kb.data().folderList.remove(b),Kb.data().foldersDeleting(!0),Kb.remote().folderDelete(function(a,b){Kb.data().foldersDeleting(!1),wb.StorageResultType.Success===a&&b&&b.Result||Kb.data().foldersListError(b&&b.ErrorCode?yb.getNotification(b.ErrorCode):yb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Kb.folders()},a.fullNameRaw),Kb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 1048576?(a.alert(yb.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(yb.getUploadErrorDescByCode(d&&d.ErrorCode?d.ErrorCode:wb.UploadErrorCode.Unknown)),this.customThemeUploaderProgress(!1)},this)),!!b}return!1},yb.addSettingsViewModel(ib,"SettingsOpenPGP","SETTINGS_LABELS/LABEL_OPEN_PGP_NAME","openpgp"),ib.prototype.addOpenPgpKey=function(){Db.showScreenPopup(L)},ib.prototype.generateOpenPgpKey=function(){Db.showScreenPopup(N)},ib.prototype.viewOpenPgpKey=function(a){a&&Db.showScreenPopup(M,[a])},ib.prototype.deleteOpenPgpKey=function(a){if(a&&a.deleteAccess()){this.openPgpKeyForDeletion(null);var b=-1,c=Kb.data().openpgpKeyring,d=function(b){return a===b};a&&c&&(this.openpgpkeys.remove(d),h.each(c.keys,function(c,d){-1===b&&c&&c.primaryKey&&a.guid===c.primaryKey.getFingerprint()&&a.isPrivate===c.isPrivate()&&(b=d)}),b>=0&&c.removeKey(b),c.store(),Kb.reloadOpenPgpKeys())}},jb.prototype.populateDataOnStart=function(){var a=yb.pInt(Kb.settingsGet("Layout")),b=Kb.settingsGet("Languages"),c=Kb.settingsGet("Themes");yb.isArray(b)&&this.languages(b),yb.isArray(c)&&this.themes(c),this.mainLanguage(Kb.settingsGet("Language")),this.mainTheme(Kb.settingsGet("Theme")),this.allowCustomTheme(!!Kb.settingsGet("AllowCustomTheme")),this.allowAdditionalAccounts(!!Kb.settingsGet("AllowAdditionalAccounts")),this.allowIdentities(!!Kb.settingsGet("AllowIdentities")),this.determineUserLanguage(!!Kb.settingsGet("DetermineUserLanguage")),this.allowThemes(!!Kb.settingsGet("AllowThemes")),this.allowCustomLogin(!!Kb.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!Kb.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!Kb.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(Kb.settingsGet("EditorDefaultType")),this.showImages(!!Kb.settingsGet("ShowImages")),this.contactsAutosave(!!Kb.settingsGet("ContactsAutosave")),this.interfaceAnimation(Kb.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(Kb.settingsGet("MPP")),this.desktopNotifications(!!Kb.settingsGet("DesktopNotifications")),this.useThreads(!!Kb.settingsGet("UseThreads")),this.replySameFolder(!!Kb.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!Kb.settingsGet("UseCheckboxesInList")),this.layout(wb.Layout.SidePreview),-1 0&&(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)))},kb.prototype.populateDataOnStart=function(){jb.prototype.populateDataOnStart.call(this),this.accountEmail(Kb.settingsGet("Email")),this.accountIncLogin(Kb.settingsGet("IncLogin")),this.accountOutLogin(Kb.settingsGet("OutLogin")),this.projectHash(Kb.settingsGet("ProjectHash")),this.displayName(Kb.settingsGet("DisplayName")),this.replyTo(Kb.settingsGet("ReplyTo")),this.signature(Kb.settingsGet("Signature")),this.signatureToAll(!!Kb.settingsGet("SignatureToAll")),this.lastFoldersHash=Kb.local().get(wb.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Kb.settingsGet("RemoteSuggestions"),this.devEmail=Kb.settingsGet("DevEmail"),this.devLogin=Kb.settingsGet("DevLogin"),this.devPassword=Kb.settingsGet("DevPassword")},kb.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&yb.isNormal(c)&&""!==c){if(yb.isArray(d)&&0 3)i(Kb.link().notificationMailIcon(),Kb.data().accountEmail(),yb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Kb.link().notificationMailIcon(),z.emailsToLine(z.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Kb.cache().setFolderUidNext(b,c)}},kb.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=Kb.cache().getFolderFromCacheList(g),f||(f=A.newInstanceFromJson(e),f&&(Kb.cache().setFolderToCacheList(g,f),Kb.cache().setFolderFullNameRaw(f.fullNameHash,g),f.isGmailFolder=vb.Values.GmailFolderName.toLowerCase()===g.toLowerCase(),""!==a&&a===f.fullNameRaw+f.delimiter&&(f.isNamespaceFolder=!0),(f.isNamespaceFolder||f.isGmailFolder)&&(f.isUnpaddigFolder=!0))),f&&(f.collapsed(!yb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Kb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),yb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),yb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&yb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},kb.prototype.setFolders=function(a){var b=[],c=!1,d=Kb.data(),e=function(a){return""===a||vb.Values.UnuseOptionValue===a||null!==Kb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&yb.isArray(a.Result["@Collection"])&&(yb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Kb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Kb.settingsGet("SentFolder")+Kb.settingsGet("DraftFolder")+Kb.settingsGet("SpamFolder")+Kb.settingsGet("TrashFolder")+Kb.settingsGet("ArchiveFolder")+Kb.settingsGet("NullFolder")&&(Kb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Kb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Kb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Kb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Kb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Kb.settingsGet("SentFolder"))),d.draftFolder(e(Kb.settingsGet("DraftFolder"))),d.spamFolder(e(Kb.settingsGet("SpamFolder"))),d.trashFolder(e(Kb.settingsGet("TrashFolder"))),d.archiveFolder(e(Kb.settingsGet("ArchiveFolder"))),c&&Kb.remote().saveSystemFolders(yb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Kb.local().set(wb.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},kb.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},kb.prototype.getNextFolderNames=function(a){a=yb.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&&0 b[0]?1:0}),h.find(g,function(a){var e=Kb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},kb.prototype.removeMessagesFromList=function(a,b,c,d){c=yb.isNormal(c)?c:"",d=yb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return yb.pInt(a)});var e=0,f=Kb.data(),g=Kb.cache(),i=Kb.cache().getFolderFromCacheList(a),j=""===c?null:g.getFolderFromCacheList(c||""),k=f.currentFolderFullNameRaw(),l=f.message(),m=k===a?h.filter(f.messageList(),function(a){return a&&-1 0&&i.messageCountUnread(0<=i.messageCountUnread()-e?i.messageCountUnread()-e:0)),j&&(j.messageCountAll(j.messageCountAll()+b.length),e>0&&j.messageCountUnread(j.messageCountUnread()+e),j.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Bb.iMessageBodyCacheCount),yb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):yb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Kb.data().allowOpenPGP()&&yb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=yb.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)),Lb.empty(),k&&n.isPgpSigned()?j=Lb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Lb.append(b('').text(n.plainRaw)).html()),Lb.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(wb.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(this.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),n.storeDataToDom(),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&yb.initBlockquoteSwitcher(g)),Kb.cache().initMessageFlagsFromCache(n),n.unseen()&&Kb.setMessageSeen(n),yb.windowResize())},kb.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&yb.isArray(a.Result["@Collection"])){var c=Kb.data(),d=Kb.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=yb.pInt(a.Result.MessageResultCount),j=yb.pInt(a.Result.Offset),yb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Kb.cache().getFolderFromCacheList(yb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Kb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),yb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),yb.isNormal(a.Result.MessageUnseenCount)&&(yb.pInt(p.messageCountUnread())!==yb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Kb.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?Kb.cache().initMessageFlagsFromCache(o):Kb.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&&0 0?(this.defaultRequest(a,"Message",{},null,"Message/"+Ab.urlsafe_encode([b,c,Kb.data().projectHash(),Kb.data().threading()&&Kb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},mb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},mb.prototype.folderInformation=function(a,b,c){var d=!0,e=Kb.cache(),f=[];yb.isArray(c)&&0 l;l++)p.push({id:e[l][0],name:e[l][1],disable:!1});for(l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&p.push({id:n.fullNameRaw,system:!0,name:i?i.call(null,n):n.name(),disable:!n.selectable||-1 l;l++)n=c[l],n.isGmailFolder||!n.subScribed()&&n.existen||(h?h.call(null,n):!0)&&(wb.FolderType.User===n.type()||!j||!n.isNamespaceFolder&&0