diff --git a/Gruntfile.js b/Gruntfile.js index 733ab7f6b..82029c3e8 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -207,6 +207,7 @@ module.exports = function (grunt) { "dev/Admin/Plugins.js", "dev/Admin/Packages.js", "dev/Admin/Licensing.js", + "dev/Admin/About.js", "dev/Storages/AbstractData.js", "dev/Storages/AdminData.js", diff --git a/dev/Admin/About.js b/dev/Admin/About.js new file mode 100644 index 000000000..052c64c2f --- /dev/null +++ b/dev/Admin/About.js @@ -0,0 +1,16 @@ +/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ + +/** + * @constructor + */ +function AdminAbout() +{ + this.version = ko.observable(RL.settingsGet('Version')); +} + +Utils.addSettingsViewModel(AdminAbout, 'AdminSettingsAbout', 'About', 'about'); + +//AdminAbout.prototype.onBuild = function () +//{ +// +//}; diff --git a/dev/Admin/General.js b/dev/Admin/General.js index f08bbae06..be40ee5ec 100644 --- a/dev/Admin/General.js +++ b/dev/Admin/General.js @@ -13,11 +13,11 @@ function AdminGeneral() this.language = oData.language; this.theme = oData.theme; - this.allowThemes = oData.allowThemes; this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings; - this.allowAdditionalAccounts = oData.allowAdditionalAccounts; - this.allowIdentities = oData.allowIdentities; - this.allowGravatar = oData.allowGravatar; + this.capaThemes = oData.capaThemes; + this.capaGravatar = oData.capaGravatar; + this.capaAdditionalAccounts = oData.capaAdditionalAccounts; + this.capaAdditionalIdentities = oData.capaAdditionalIdentities; this.themesOptions = ko.computed(function () { return _.map(oData.themes(), function (sTheme) { @@ -62,27 +62,27 @@ AdminGeneral.prototype.onBuild = function () }); }); - self.allowAdditionalAccounts.subscribe(function (bValue) { + self.capaAdditionalAccounts.subscribe(function (bValue) { RL.remote().saveAdminConfig(null, { - 'AllowAdditionalAccounts': bValue ? '1' : '0' + 'CapaAdditionalAccounts': bValue ? '1' : '0' }); }); - self.allowIdentities.subscribe(function (bValue) { + self.capaAdditionalIdentities.subscribe(function (bValue) { RL.remote().saveAdminConfig(null, { - 'AllowIdentities': bValue ? '1' : '0' + 'CapaAdditionalIdentities': bValue ? '1' : '0' }); }); - self.allowGravatar.subscribe(function (bValue) { + self.capaGravatar.subscribe(function (bValue) { RL.remote().saveAdminConfig(null, { - 'AllowGravatar': bValue ? '1' : '0' + 'CapaGravatar': bValue ? '1' : '0' }); }); - self.allowThemes.subscribe(function (bValue) { + self.capaThemes.subscribe(function (bValue) { RL.remote().saveAdminConfig(null, { - 'AllowThemes': bValue ? '1' : '0' + 'CapaThemes': bValue ? '1' : '0' }); }); diff --git a/dev/Admin/Security.js b/dev/Admin/Security.js index 03069909b..e871c219d 100644 --- a/dev/Admin/Security.js +++ b/dev/Admin/Security.js @@ -6,8 +6,8 @@ function AdminSecurity() { this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection')); - this.openPGP = ko.observable(!!RL.settingsGet('OpenPGP')); - this.allowTwoFactorAuth = ko.observable(!!RL.settingsGet('AllowTwoFactorAuth')); + this.capaOpenPGP = ko.observable(RL.capa(Enums.Capa.OpenPGP)); + this.capaTwoFactorAuth = ko.observable(RL.capa(Enums.Capa.TwoFactor)); this.adminLogin = ko.observable(RL.settingsGet('AdminLogin')); this.adminPassword = ko.observable(''); @@ -84,15 +84,15 @@ AdminSecurity.prototype.onBuild = function () }); }); - this.openPGP.subscribe(function (bValue) { + this.capaOpenPGP.subscribe(function (bValue) { RL.remote().saveAdminConfig(Utils.emptyFunction, { - 'OpenPGP': bValue ? '1' : '0' + 'CapaOpenPGP': bValue ? '1' : '0' }); }); - this.allowTwoFactorAuth.subscribe(function (bValue) { + this.capaTwoFactorAuth.subscribe(function (bValue) { RL.remote().saveAdminConfig(Utils.emptyFunction, { - 'AllowTwoFactorAuth': bValue ? '1' : '0' + 'CapaTwoFactorAuth': bValue ? '1' : '0' }); }); }; diff --git a/dev/Boots/AdminApp.js b/dev/Boots/AdminApp.js index 76e277762..96df72eac 100644 --- a/dev/Boots/AdminApp.js +++ b/dev/Boots/AdminApp.js @@ -212,6 +212,8 @@ AdminApp.prototype.bootstart = function () } else { + Utils.removeSettingsViewModel(AdminAbout); + if (!RL.capa(Enums.Capa.Prem)) { Utils.removeSettingsViewModel(AdminBranding); diff --git a/dev/Boots/RainLoopApp.js b/dev/Boots/RainLoopApp.js index 1a731eb0c..7d85a1783 100644 --- a/dev/Boots/RainLoopApp.js +++ b/dev/Boots/RainLoopApp.js @@ -425,7 +425,7 @@ RainLoopApp.prototype.folders = function (fCallback) RainLoopApp.prototype.reloadOpenPgpKeys = function () { - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { var aKeys = [], @@ -1043,12 +1043,12 @@ RainLoopApp.prototype.bootstart = function () Utils.removeSettingsViewModel(SettingsContacts); } - if (!RL.settingsGet('AllowAdditionalAccounts')) + if (!RL.capa(Enums.Capa.AdditionalAccounts)) { Utils.removeSettingsViewModel(SettingsAccounts); } - if (RL.settingsGet('AllowIdentities')) + if (RL.capa(Enums.Capa.AdditionalIdentities)) { Utils.removeSettingsViewModel(SettingsIdentity); } @@ -1057,26 +1057,26 @@ RainLoopApp.prototype.bootstart = function () Utils.removeSettingsViewModel(SettingsIdentities); } - if (!RL.settingsGet('OpenPGP')) + if (!RL.capa(Enums.Capa.OpenPGP)) { Utils.removeSettingsViewModel(SettingsOpenPGP); } - if (!RL.settingsGet('AllowTwoFactorAuth')) + if (!RL.capa(Enums.Capa.TwoFactor)) { Utils.removeSettingsViewModel(SettingsSecurity); } + if (!RL.capa(Enums.Capa.Themes)) + { + Utils.removeSettingsViewModel(SettingsThemes); + } + if (!bGoogle && !bFacebook && !bTwitter) { Utils.removeSettingsViewModel(SettingsSocialScreen); } - if (!RL.settingsGet('AllowThemes')) - { - Utils.removeSettingsViewModel(SettingsThemes); - } - Utils.initOnStartOrLangChange(function () { $.extend(true, $.magnificPopup.defaults, { @@ -1113,7 +1113,7 @@ RainLoopApp.prototype.bootstart = function () if (bValue) { - if (window.crypto && window.crypto.getRandomValues && RL.settingsGet('OpenPGP')) + if (window.crypto && window.crypto.getRandomValues && RL.capa(Enums.Capa.OpenPGP)) { $.ajax({ 'url': RL.link().openPgpJs(), @@ -1123,7 +1123,7 @@ RainLoopApp.prototype.bootstart = function () if (window.openpgp) { RL.data().openpgpKeyring = new window.openpgp.Keyring(); - RL.data().allowOpenPGP(true); + RL.data().capaOpenPGP(true); RL.pub('openpgp.init'); @@ -1134,7 +1134,7 @@ RainLoopApp.prototype.bootstart = function () } else { - RL.data().allowOpenPGP(false); + RL.data().capaOpenPGP(false); } kn.startScreens([MailBoxScreen, SettingsScreen]); diff --git a/dev/Common/Enums.js b/dev/Common/Enums.js index 49c4dfe8d..3f7b4fffa 100644 --- a/dev/Common/Enums.js +++ b/dev/Common/Enums.js @@ -31,7 +31,14 @@ Enums.StateType = { * @enum {string} */ Enums.Capa = { - 'Prem': 'PREM' + 'Prem': 'PREM', + 'TwoFactor': 'TWO_FACTOR', + 'OpenPGP': 'OPEN_PGP', + 'Prefetch': 'PREFETCH', + 'Gravatar': 'GRAVATAR', + 'Themes': 'THEMES', + 'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS', + 'AdditionalIdentities': 'ADDITIONAL_IDENTITIES' }; /** diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 468cb7691..a35bbcb9e 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -772,7 +772,7 @@ Utils.initDataConstructorBySettings = function (oData) Globals.sAnimationType = Enums.InterfaceAnimation.Full; - oData.allowThemes = ko.observable(true); + oData.capaThemes = ko.observable(false); oData.allowCustomLogin = ko.observable(false); oData.allowLanguagesOnSettings = ko.observable(true); oData.allowLanguagesOnLogin = ko.observable(true); @@ -940,9 +940,9 @@ Utils.initDataConstructorBySettings = function (oData) } }); - oData.allowAdditionalAccounts = ko.observable(false); - oData.allowIdentities = ko.observable(false); - oData.allowGravatar = ko.observable(false); + oData.capaAdditionalAccounts = ko.observable(false); + oData.capaAdditionalIdentities = ko.observable(false); + oData.capaGravatar = ko.observable(false); oData.determineUserLanguage = ko.observable(false); oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200}); diff --git a/dev/Models/MessageModel.js b/dev/Models/MessageModel.js index 6b06fbd7a..eafa6f00e 100644 --- a/dev/Models/MessageModel.js +++ b/dev/Models/MessageModel.js @@ -362,7 +362,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage) this.sInReplyTo = oJsonMessage.InReplyTo; this.sReferences = oJsonMessage.References; - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { this.isPgpSigned(!!oJsonMessage.PgpSigned); this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted); @@ -997,7 +997,7 @@ MessageModel.prototype.storeDataToDom = function () this.body.data('rl-plain-raw', this.plainRaw); - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned()); this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted()); @@ -1009,7 +1009,7 @@ MessageModel.prototype.storeDataToDom = function () MessageModel.prototype.storePgpVerifyDataToDom = function () { - if (this.body && RL.data().allowOpenPGP()) + if (this.body && RL.data().capaOpenPGP()) { this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus()); this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser()); @@ -1026,7 +1026,7 @@ MessageModel.prototype.fetchDataToDom = function () this.plainRaw = Utils.pString(this.body.data('rl-plain-raw')); - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed')); this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted')); diff --git a/dev/Screens/MailBox.js b/dev/Screens/MailBox.js index 123cb9a5c..07fb5688a 100644 --- a/dev/Screens/MailBox.js +++ b/dev/Screens/MailBox.js @@ -91,7 +91,7 @@ MailBoxScreen.prototype.onStart = function () } ; - if (RL.settingsGet('AllowAdditionalAccounts') || RL.settingsGet('AllowIdentities')) + if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities)) { RL.accountsAndIdentities(); } diff --git a/dev/Storages/AbstractCache.js b/dev/Storages/AbstractCache.js index 477870488..de5ab4273 100644 --- a/dev/Storages/AbstractCache.js +++ b/dev/Storages/AbstractCache.js @@ -7,7 +7,7 @@ function AbstractCacheStorage() { this.oEmailsPicsHashes = {}; this.oServices = {}; - this.bAllowGravatar = !!RL.settingsGet('AllowGravatar'); + this.bCapaGravatar = RL.capa(Enums.Capa.Gravatar); } /** @@ -23,7 +23,7 @@ AbstractCacheStorage.prototype.oServices = {}; /** * @type {boolean} */ -AbstractCacheStorage.prototype.bAllowGravatar = false; +AbstractCacheStorage.prototype.bCapaGravatar = false; AbstractCacheStorage.prototype.clear = function () { @@ -57,7 +57,7 @@ AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback) } - if (this.bAllowGravatar && '' === sUrl) + if (this.bCapaGravatar && '' === sUrl) { fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail); } diff --git a/dev/Storages/AbstractData.js b/dev/Storages/AbstractData.js index 3d4f54bc8..05e5215f9 100644 --- a/dev/Storages/AbstractData.js +++ b/dev/Storages/AbstractData.js @@ -84,12 +84,12 @@ AbstractData.prototype.populateDataOnStart = function() this.mainLanguage(RL.settingsGet('Language')); this.mainTheme(RL.settingsGet('Theme')); - this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts')); - this.allowIdentities(!!RL.settingsGet('AllowIdentities')); - this.allowGravatar(!!RL.settingsGet('AllowGravatar')); + this.capaAdditionalAccounts(RL.capa(Enums.Capa.AdditionalAccounts)); + this.capaAdditionalIdentities(RL.capa(Enums.Capa.AdditionalIdentities)); + this.capaGravatar(RL.capa(Enums.Capa.Gravatar)); this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage')); - - this.allowThemes(!!RL.settingsGet('AllowThemes')); + + this.capaThemes(RL.capa(Enums.Capa.Themes)); this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin')); this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin')); this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings')); diff --git a/dev/Storages/WebMailData.js b/dev/Storages/WebMailData.js index 8c78ad981..4da7c5d92 100644 --- a/dev/Storages/WebMailData.js +++ b/dev/Storages/WebMailData.js @@ -402,7 +402,7 @@ function WebMailDataStorage() }, this); // other - this.allowOpenPGP = ko.observable(false); + this.capaOpenPGP = ko.observable(false); this.openpgpkeys = ko.observableArray([]); this.openpgpKeyring = null; @@ -929,8 +929,7 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) sPlain = oData.Result.Plain.toString(); if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && - RL.data().allowOpenPGP() && - Utils.isNormal(oData.Result.PlainRaw)) + RL.data().capaOpenPGP() && Utils.isNormal(oData.Result.PlainRaw)) { oMessage.plainRaw = Utils.pString(oData.Result.PlainRaw); diff --git a/dev/Styles/@Main.less b/dev/Styles/@Main.less index 208ff7502..d97e94c2a 100644 --- a/dev/Styles/@Main.less +++ b/dev/Styles/@Main.less @@ -70,6 +70,7 @@ @import "AdminPackages.less"; @import "AdminPlugins.less"; @import "AdminPlugin.less"; +@import "AdminAbout.less"; @import "Activate.less"; @import "Settings.less"; @import "SettingsGeneral.less"; diff --git a/dev/Styles/AdminAbout.less b/dev/Styles/AdminAbout.less new file mode 100644 index 000000000..c40c38f64 --- /dev/null +++ b/dev/Styles/AdminAbout.less @@ -0,0 +1,10 @@ + +.b-admin-about { + .rl-logo { + display: inline-block; + width: 250px; + height: 250px; + background-image: url("images/rainloop-logo.png"); + } +} + diff --git a/dev/ViewModels/AbstractSystemDropDownViewModel.js b/dev/ViewModels/AbstractSystemDropDownViewModel.js index 8d9e89a66..c377eb4dd 100644 --- a/dev/ViewModels/AbstractSystemDropDownViewModel.js +++ b/dev/ViewModels/AbstractSystemDropDownViewModel.js @@ -16,7 +16,7 @@ function AbstractSystemDropDownViewModel() this.accountMenuDropdownTrigger = ko.observable(false); - this.allowAddAccount = RL.settingsGet('AllowAdditionalAccounts'); + this.capaAdditionalAccounts = RL.capa(Enums.Capa.AdditionalAccounts); this.loading = ko.computed(function () { return this.accountsLoading(); @@ -58,7 +58,7 @@ AbstractSystemDropDownViewModel.prototype.settingsHelp = function () AbstractSystemDropDownViewModel.prototype.addAccountClick = function () { - if (this.allowAddAccount) + if (this.capaAdditionalAccounts) { kn.showScreenPopup(PopupsAddAccountViewModel); } diff --git a/dev/ViewModels/MailBoxMessageListViewModel.js b/dev/ViewModels/MailBoxMessageListViewModel.js index bababcf21..0de616e97 100644 --- a/dev/ViewModels/MailBoxMessageListViewModel.js +++ b/dev/ViewModels/MailBoxMessageListViewModel.js @@ -665,7 +665,7 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom) this.initUploaderForAppend(); this.initShortcuts(); - if (!Globals.bMobileDevice && !!RL.settingsGet('AllowPrefetch') && ifvisible) + if (!Globals.bMobileDevice && RL.capa(Enums.Capa.Prefetch) && ifvisible) { ifvisible.setIdleDuration(10); diff --git a/dev/ViewModels/PopupsComposeViewModel.js b/dev/ViewModels/PopupsComposeViewModel.js index b977fb7cc..9f4d18ba0 100644 --- a/dev/ViewModels/PopupsComposeViewModel.js +++ b/dev/ViewModels/PopupsComposeViewModel.js @@ -14,8 +14,8 @@ function PopupsComposeViewModel() this.bFromDraft = false; this.bSkipNext = false; this.sReferences = ''; - - this.bAllowIdentities = RL.settingsGet('AllowIdentities'); + + this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities); var self = this, @@ -28,7 +28,7 @@ function PopupsComposeViewModel() } ; - this.allowOpenPGP = oRainLoopData.allowOpenPGP; + this.capaOpenPGP = oRainLoopData.capaOpenPGP; this.resizer = ko.observable(false).extend({'throttle': 50}); @@ -125,7 +125,7 @@ function PopupsComposeViewModel() sID = this.currentIdentityID() ; - if (this.bAllowIdentities && sID && sID !== RL.data().accountEmail()) + if (this.bCapaAdditionalIdentities && sID && sID !== RL.data().accountEmail()) { oItem = _.find(aList, function (oItem) { return oItem && sID === oItem['id']; @@ -366,7 +366,7 @@ Utils.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel); PopupsComposeViewModel.prototype.openOpenPgpPopup = function () { - if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml()) + if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) { var self = this; kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [ @@ -417,7 +417,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp } ; - if (this.bAllowIdentities) + if (this.bCapaAdditionalIdentities) { _.each(this.identities(), function (oItem) { oIDs[oItem.email()] = oItem['id']; diff --git a/dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js b/dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js index ff9a01281..44a65a2c8 100644 --- a/dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js +++ b/dev/ViewModels/PopupsGenerateNewOpenPgpKeyViewModel.js @@ -47,6 +47,13 @@ function PopupsGenerateNewOpenPgpKeyViewModel() _.delay(function () { mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password())); +// 0.6.0 +// mKeyPair = window.openpgp.generateKeyPair({ +// 'numBits': Utils.pInt(self.keyBitLength()), +// 'userId': sUserID, +// 'passphrase': Utils.trim(self.password()) +// }); + if (mKeyPair && mKeyPair.privateKeyArmored) { oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored); 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 7e1342841..4ddab8999 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -981,28 +981,21 @@ class Actions 'LoginDescription' => '', 'LoginCss' => '', 'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '', - 'OpenPGP' => $oConfig->Get('security', 'openpgp', false), - 'AllowTwoFactorAuth' => (bool) $oConfig->Get('security', 'allow_two_factor_auth', false), 'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false), 'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true), 'AllowHtmlEditorSourceButton' => (bool) $oConfig->Get('labs', 'allow_html_editor_source_button', false), 'CustomLoginLink' => $oConfig->Get('labs', 'custom_login_link', ''), 'CustomLogoutLink' => $oConfig->Get('labs', 'custom_logout_link', ''), - 'AllowAdditionalAccounts' => (bool) $oConfig->Get('webmail', 'allow_additional_accounts', true), - 'AllowIdentities' => (bool) $oConfig->Get('webmail', 'allow_identities', true), - 'AllowPrefetch' => (bool) $oConfig->Get('labs', 'allow_prefetch', true), - 'AllowGravatar' => (bool) $oConfig->Get('labs', 'allow_gravatar', true), 'AllowCustomLogin' => (bool) $oConfig->Get('login', 'allow_custom_login', false), 'LoginDefaultDomain' => $oConfig->Get('login', 'default_domain', ''), 'DetermineUserLanguage' => (bool) $oConfig->Get('login', 'determine_user_language', true), - 'AllowThemes' => (bool) $oConfig->Get('webmail', 'allow_themes', true), - 'ChangePasswordIsAllowed' => false, 'ContactsIsAllowed' => false, + 'ChangePasswordIsAllowed' => false, 'JsHash' => \md5(\RainLoop\Utils::GetConnectionToken()), 'UseImapThread' => (bool) $oConfig->Get('labs', 'use_imap_thread', false), 'UseImapSubscribe' => (bool) $oConfig->Get('labs', 'use_imap_list_subscribe', true), 'AllowAppendMessage' => (bool) $oConfig->Get('labs', 'allow_message_append', false), - 'Capa' => $this->Capa(), + 'Capa' => array(), 'Plugins' => array() ); @@ -1011,7 +1004,7 @@ class Actions $aResult['AuthAccountHash'] = $sAuthAccountHash; } - if ($this->GetCapa(\RainLoop\Enumerations\Capa::PREM)) + if ($this->GetCapa(true, \RainLoop\Enumerations\Capa::PREM)) { $aResult['Title'] = $oConfig->Get('webmail', 'title', ''); $aResult['LoadingDescription'] = $oConfig->Get('webmail', 'loading_description', ''); @@ -1113,6 +1106,8 @@ class Actions { $aResult['AllowDropboxSocial'] = false; } + + $aResult['Capa'] = $this->Capa(false, $oAccount); } else { @@ -1157,6 +1152,8 @@ class Actions $aResult['WeakPassword'] = $oConfig->ValidatePassword('12345'); } + + $aResult['Capa'] = $this->Capa(true); } $aResult['ProjectHash'] = \md5($aResult['AccountHash'].APP_VERSION.$this->Plugins()->Hash()); @@ -2034,6 +2031,36 @@ class Actions } } + /** + * @param \RainLoop\Config\Application $oConfig + * @param string $sParamName + * @param string $sCapa + */ + private function setCapaFromParams(&$oConfig, $sParamName, $sCapa) + { + switch ($sCapa) + { + case \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS: + $this->setConfigFromParams($oConfig, $sParamName, 'webmail', 'allow_additional_accounts', 'bool'); + break; + case \RainLoop\Enumerations\Capa::ADDITIONAL_IDENTITIES: + $this->setConfigFromParams($oConfig, $sParamName, 'webmail', 'allow_identities', 'bool'); + break; + case \RainLoop\Enumerations\Capa::TWO_FACTOR: + $this->setConfigFromParams($oConfig, $sParamName, 'security', 'allow_two_factor_auth', 'bool'); + break; + case \RainLoop\Enumerations\Capa::GRAVATAR: + $this->setConfigFromParams($oConfig, $sParamName, 'labs', 'allow_gravatar', 'bool'); + break; + case \RainLoop\Enumerations\Capa::THEMES: + $this->setConfigFromParams($oConfig, $sParamName, 'webmail', 'allow_themes', 'bool'); + break; + case \RainLoop\Enumerations\Capa::OPEN_PGP: + $this->setConfigFromParams($oConfig, $sParamName, 'security', 'openpgp', 'bool'); + break; + } + } + /** * @param \RainLoop\Settings $oSettings * @param string $sConfigName @@ -2091,7 +2118,6 @@ class Actions return $self->ValidateTheme($sTheme); }); - $this->setConfigFromParams($oConfig, 'AllowThemes', 'webmail', 'allow_themes', 'bool'); $this->setConfigFromParams($oConfig, 'AllowLanguagesOnSettings', 'webmail', 'allow_languages_on_settings', 'bool'); $this->setConfigFromParams($oConfig, 'AllowLanguagesOnLogin', 'login', 'allow_languages_on_login', 'bool'); $this->setConfigFromParams($oConfig, 'AllowCustomLogin', 'login', 'allow_custom_login', 'bool'); @@ -2108,14 +2134,16 @@ class Actions return $self->ValidateContactPdoType($sType); }); - $this->setConfigFromParams($oConfig, 'AllowAdditionalAccounts', 'webmail', 'allow_additional_accounts', 'bool'); - $this->setConfigFromParams($oConfig, 'AllowIdentities', 'webmail', 'allow_identities', 'bool'); - - $this->setConfigFromParams($oConfig, 'AllowGravatar', 'labs', 'allow_gravatar', 'bool'); + $this->setCapaFromParams($oConfig, 'CapaAdditionalAccounts', \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS); + $this->setCapaFromParams($oConfig, 'CapaAdditionalIdentities', \RainLoop\Enumerations\Capa::ADDITIONAL_IDENTITIES); + $this->setCapaFromParams($oConfig, 'CapaTwoFactorAuth', \RainLoop\Enumerations\Capa::TWO_FACTOR); + $this->setCapaFromParams($oConfig, 'CapaOpenPGP', \RainLoop\Enumerations\Capa::OPEN_PGP); + $this->setCapaFromParams($oConfig, 'CapaGravatar', \RainLoop\Enumerations\Capa::GRAVATAR); + $this->setCapaFromParams($oConfig, 'CapaThemes', \RainLoop\Enumerations\Capa::THEMES); $this->setConfigFromParams($oConfig, 'DetermineUserLanguage', 'login', 'determine_user_language', 'bool'); - if ($this->GetCapa(\RainLoop\Enumerations\Capa::PREM)) + if ($this->GetCapa(true, \RainLoop\Enumerations\Capa::PREM)) { $this->setConfigFromParams($oConfig, 'Title', 'webmail', 'title', 'string'); $this->setConfigFromParams($oConfig, 'LoadingDescription', 'webmail', 'loading_description', 'string'); @@ -2126,8 +2154,6 @@ class Actions } $this->setConfigFromParams($oConfig, 'TokenProtection', 'security', 'csrf_protection', 'bool'); - $this->setConfigFromParams($oConfig, 'OpenPGP', 'security', 'openpgp', 'bool'); - $this->setConfigFromParams($oConfig, 'AllowTwoFactorAuth', 'security', 'allow_two_factor_auth', 'bool'); $this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool'); $this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool'); @@ -5959,23 +5985,64 @@ class Actions } /** + * @param bool $bAdmin + * @param \RainLoop\Account $oAccount + * * @return array */ - public function Capa() + public function Capa($bAdmin, $oAccount = null) { - return array( - \RainLoop\Enumerations\Capa::PREM - ); + $oConfig = $this->Config(); + + $aResult = array(\RainLoop\Enumerations\Capa::PREM); + + if ($oConfig->Get('webmail', 'allow_additional_accounts', false)) + { + $aResult[] = \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS; + } + + if ($oConfig->Get('webmail', 'allow_identities', true)) + { + $aResult[] = \RainLoop\Enumerations\Capa::ADDITIONAL_IDENTITIES; + } + + if ($oConfig->Get('security', 'allow_two_factor_auth', false)) + { + $aResult[] = \RainLoop\Enumerations\Capa::TWO_FACTOR; + } + + if ($oConfig->Get('labs', 'allow_gravatar', false)) + { + $aResult[] = \RainLoop\Enumerations\Capa::GRAVATAR; + } + + if ($oConfig->Get('labs', 'allow_prefetch', false)) + { + $aResult[] = \RainLoop\Enumerations\Capa::PREFETCH; + } + + if ($oConfig->Get('webmail', 'allow_themes', false)) + { + $aResult[] = \RainLoop\Enumerations\Capa::THEMES; + } + + if ($oConfig->Get('security', 'openpgp', false)) + { + $aResult[] = \RainLoop\Enumerations\Capa::OPEN_PGP; + } + + return $aResult; } /** + * @param bool $bAdmin * @param string $sName * * @return bool */ - public function GetCapa($sName) + public function GetCapa($bAdmin, $sName) { - return \in_array($sName, $this->Capa()); + return \in_array($sName, $this->Capa($bAdmin)); } /** diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Enumerations/Capa.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Enumerations/Capa.php index ee2bd70c6..b252c988f 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Enumerations/Capa.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Enumerations/Capa.php @@ -5,4 +5,11 @@ namespace RainLoop\Enumerations; class Capa { const PREM = 'PREM'; + const TWO_FACTOR = 'TWO_FACTOR'; + const OPEN_PGP = 'OPEN_PGP'; + const PREFETCH = 'PREFETCH'; + const GRAVATAR = 'GRAVATAR'; + const THEMES = 'THEMES'; + const ADDITIONAL_ACCOUNTS = 'ADDITIONAL_ACCOUNTS'; + const ADDITIONAL_IDENTITIES = 'ADDITIONAL_IDENTITIES'; } diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminMenu.html b/rainloop/v/0.0.0/app/templates/Views/AdminMenu.html index d4cd5d1b2..38c39229c 100644 --- a/rainloop/v/0.0.0/app/templates/Views/AdminMenu.html +++ b/rainloop/v/0.0.0/app/templates/Views/AdminMenu.html @@ -2,7 +2,7 @@
diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsAbout.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsAbout.html new file mode 100644 index 000000000..8d95c112b --- /dev/null +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsAbout.html @@ -0,0 +1,22 @@ +]*>/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,"")},W.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},W.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},W.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:W.isUnd(c)?a.toString():c.toString(),custom:W.isUnd(c)?!1:!0,title:W.isUnd(c)?"":a.toString(),value:a.toString()};(W.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}},W.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()}},W.disableKeyFilter=function(){a.key&&(key.filter=function(){return hb.data().useKeyboardShortcuts()})},W.restoreKeyFilter=function(){a.key&&(key.filter=function(a){if(hb.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},W.detectDropdownVisibility=f.debounce(function(){Z.dropdownVisibility(!!f.find(_,function(a){return a.hasClass("open")}))},50),Y={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Y.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Y._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Y._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(!Z.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Z.dropdownVisibility()?"":''+W.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Z.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Z.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Z.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),Z.dropdownVisibility.subscribe(function(a){a&&c.tooltip("hide")}),fb.click(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){_.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),W.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!W.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&&!W.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Z.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){W.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){W.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),W.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=W.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=W.pInt(e[2]),g=eb.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(!Z.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),W.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),W.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)},b(d).draggable(k).on("mousedown",function(){W.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Z.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){Z.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(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:g,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){hb.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=W.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(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:g,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){hb.getContactsTagsAutocomplete(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=W.trim(a),c=null;return""!==b?(c=new p,c.name(b),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&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(W.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},W.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=W.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=W.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),W.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 W.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=W.isNormal(b)?W.pInt(b):1,c=W.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.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},g.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},g.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a -},g.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=W.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.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+"/":"")},X.oViewModelsHooks={},X.oSimpleHooks={},X.regViewModelHook=function(a,b){b&&(b.__hookName=a)},X.addHook=function(a,b){W.isFunc(b)&&(W.isArray(X.oSimpleHooks[a])||(X.oSimpleHooks[a]=[]),X.oSimpleHooks[a].push(b))},X.runHook=function(a,b){W.isArray(X.oSimpleHooks[a])&&(b=b||[],f.each(X.oSimpleHooks[a],function(a){a.apply(null,b)}))},X.mainSettingsGet=function(a){return hb?hb.settingsGet(a):null},X.remoteRequest=function(a,b,c,d,e,f){hb&&hb.remote().defaultRequest(a,b,c,d,e,f)},X.settingsGet=function(a,b){var c=X.mainSettingsGet("Plugins");return c=c&&W.isUnd(c[a])?null:c[a],c?W.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(T.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(T.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(T.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!W.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[T.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[T.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[T.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!W.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.storeAndSetKeyScope=function(){this.sCurrentKeyScope=hb.data().keyScope(),hb.data().keyScope(this.sDefaultKeyScope)},l.prototype.restoreKeyScope=function(){hb.data().keyScope(this.sCurrentKeyScope)},l.prototype.registerPopupKeyDown=function(){var a=this;eb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&U.EventKeyCode.Esc===b.keyCode)return W.delegateRun(a,"cancelCommand"),!1;if(U.EventKeyCode.Backspace===b.keyCode&&!W.inFocus())return!1}return!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;W.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||W.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){W.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 W.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||W.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),g=e.viewModelPosition(),h=b("#rl-content #rl-"+g.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=hb.data(),e.viewModelName=a.__name,h&&1===h.length?(i=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=W.createCommand(e,function(){ab.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),hb.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+hb.popupVisibilityNames().length+10),W.delegateRun(this,"onFocus",[],500)):(W.delegateRun(this,"onHide"),this.restoreKeyScope(),hb.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),f.delay(function(){b.viewModelDom.hide()},300))},e)),X.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),W.delegateRun(e,"onBuild",[i]),e&&"Popups"===g&&e.registerPopupKeyDown(),X.runHook("view-model-post-build",[a.__name,e,i])):W.log("Cannot find view model position: "+g)}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),X.runHook("view-model-on-hide",[a.__name,a.__vm]))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),W.delegateRun(a.__vm,"onShow",b||[]),X.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===W.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,W.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),W.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(W.delegateRun(c.oCurrentScreen,"onHide"),W.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),W.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(W.delegateRun(c.oCurrentScreen,"onShow"),X.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),W.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),W.delegateRun(a.__vm,"onShow"),W.delegateRun(a.__vm,"onFocus",[],200),X.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(),X.runHook("screen-pre-start",[a.screenName(),a]),W.delegateRun(a,"onStart"),X.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(){db.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=W.isUnd(c)?!1:!!c,(W.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},ab=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=U.EmailType.Facebook),null===this.privateType&&(this.privateType=U.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=W.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=W.trim(a.Name),this.email=W.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=W.isUnd(b)?!1:!!b,c=W.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+W.encodeHtml(this.name)+"":c?W.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=W.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+W.encodeHtml(d)+""+W.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=W.encodeHtml(d))):b&&(d=''+W.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=W.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=hb.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),W.delegateRun(e,"onBuild",[i])):W.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(W.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),W.delegateRun(d.oCurrentSubScreen,"onShow"),W.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)),W.windowResize()})):ab.setHash(hb.link().settings(),!1,!0)},O.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(W.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},O.prototype.onBuild=function(){f.each($.settings,function(a){a&&a.__rlSettingsData&&!f.find($["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($["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},O.prototype.routes=function(){var a=f.find($.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=W.isUnd(c.subname)?b:W.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(P.prototype,m.prototype),P.prototype.onShow=function(){hb.setTitle("")},f.extend(Q.prototype,O.prototype),Q.prototype.onShow=function(){hb.setTitle("")},f.extend(R.prototype,k.prototype),R.prototype.oSettings=null,R.prototype.oPlugins=null,R.prototype.oLocal=null,R.prototype.oLink=null,R.prototype.oSubs={},R.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):(Z.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},R.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},R.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},R.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=W.isNormal(bb)?bb:{}),W.isUnd(this.oSettings[a])?null:this.oSettings[a]},R.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=W.isNormal(bb)?bb:{}),this.oSettings[a]=b},R.prototype.setTitle=function(b){b=(W.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=W.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=W.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=W.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 ').appendTo("body"),fb.on("error",function(a){ib&&a&&a.originalEvent&&a.originalEvent.message&&-1===X.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&ib.remote().jsError(X.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",eb.attr("class"),X.microtime()-$.now)}),gb.on("keydown",function(a){a&&a.ctrlKey&&eb.addClass("rl-ctrl-key-pressed")}).on("keyup",function(a){a&&!a.ctrlKey&&eb.removeClass("rl-ctrl-key-pressed")})}function T(){S.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var U={},V={},W={},X={},Y={},Z={},$={},_={settings:[],"settings-removed":[],"settings-disabled":[]},ab=[],bb=null,cb=a.rainloopAppData||{},db=a.rainloopI18N||{},eb=b("html"),fb=b(a),gb=b(a.document),hb=a.Notification&&a.Notification.requestPermission?a.Notification:null,ib=null;$.now=(new Date).getTime(),$.momentTrigger=c.observable(!0),$.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),$.langChangeTrigger=c.observable(!0),$.iAjaxErrorCount=0,$.iTokenErrorCount=0,$.iMessageBodyCacheCount=0,$.bUnload=!1,$.sUserAgent=(navigator.userAgent||"").toLowerCase(),$.bIsiOSDevice=-1<$.sUserAgent.indexOf("iphone")||-1<$.sUserAgent.indexOf("ipod")||-1<$.sUserAgent.indexOf("ipad"),$.bIsAndroidDevice=-1<$.sUserAgent.indexOf("android"),$.bMobileDevice=$.bIsiOSDevice||$.bIsAndroidDevice,$.bDisableNanoScroll=$.bMobileDevice,$.bAllowPdfPreview=!$.bMobileDevice,$.bAnimationSupported=!$.bMobileDevice&&eb.hasClass("csstransitions"),$.sAnimationType="",$.oHtmlEditorDefaultConfig={title:!1,stylesSet:!1,customConfig:"",contentsCss:"",toolbarGroups:[{name:"spec"},{name:"styles"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"colors"},{name:"paragraph",groups:["list","indent","blocks","align"]},{name:"links"},{name:"insert"},{name:"others"}],removePlugins:"contextmenu",removeButtons:"Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll",removeDialogTabs:"link:advanced;link:target;image:advanced",extraPlugins:"plain",allowedContent:!0,autoParagraph:!1,enterMode:a.CKEDITOR.ENTER_BR,shiftEnterMode:a.CKEDITOR.ENTER_BR,font_defaultLabel:"Arial",fontSize_defaultLabel:"13",fontSize_sizes:"10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px"},$.oHtmlEditorLangsMap={de:"de",es:"es",fr:"fr",hu:"hu",is:"is",it:"it",ko:"ko","ko-kr":"ko",lv:"lv",nl:"nl",no:"no",pl:"pl",pt:"pt","pt-pt":"pt","pt-br":"pt-br",ru:"ru",ro:"ro",zh:"zh","zh-cn":"zh-cn"},$.bAllowPdfPreview&&navigator&&navigator.mimeTypes&&($.bAllowPdfPreview=!!f.find(navigator.mimeTypes,function(a){return a&&"application/pdf"===a.type})),U.Defaults={},U.Values={},U.DataImages={},U.Defaults.MessagesPerPage=20,U.Defaults.ContactsPerPage=50,U.Defaults.MessagesPerPageArray=[10,20,30,50,100],U.Defaults.DefaultAjaxTimeout=3e4,U.Defaults.SearchAjaxTimeout=3e5,U.Defaults.SendMessageAjaxTimeout=3e5,U.Defaults.SaveMessageAjaxTimeout=2e5,U.Defaults.ContactsSyncAjaxTimeout=2e5,U.Values.UnuseOptionValue="__UNUSE__",U.Values.ClientSideCookieIndexName="rlcsc",U.Values.ImapDefaulPort=143,U.Values.ImapDefaulSecurePort=993,U.Values.SmtpDefaulPort=25,U.Values.SmtpDefaulSecurePort=465,U.Values.MessageBodyCacheLimit=15,U.Values.AjaxErrorLimit=7,U.Values.TokenErrorLimit=10,U.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",U.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",V.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},V.State={Empty:10,Login:20,Auth:30},V.StateType={Webmail:0,Admin:1},V.Capa={Prem:"PREM",TwoFactor:"TWO_FACTOR",OpenPGP:"OPEN_PGP",Prefetch:"PREFETCH",Gravatar:"GRAVATAR",Themes:"THEMES",AdditionalAccounts:"ADDITIONAL_ACCOUNTS",AdditionalIdentities:"ADDITIONAL_IDENTITIES"},V.KeyState={All:"all",None:"none",ContactList:"contact-list",MessageList:"message-list",FolderList:"folder-list",MessageView:"message-view",Compose:"compose",Settings:"settings",Menu:"menu",PopupComposeOpenPGP:"compose-open-pgp",PopupKeyboardShortcutsHelp:"popup-keyboard-shortcuts-help",PopupAsk:"popup-ask"},V.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,NotSpam:80,User:99},V.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},V.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},V.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},V.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},V.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},V.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},V.EventKeyCode={Backspace:8,Tab:9,Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Space:32,Insert:45,Delete:46,A:65,S:83},V.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},V.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},V.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},V.MessagePriority={Low:5,Normal:3,High:1},V.EditorDefaultType={Html:"Html",Plain:"Plain"},V.CustomThemeType={Light:"Light",Dark:"Dark"},V.ServerSecure={None:0,SSL:1,TLS:2},V.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},V.EmailType={Defailt:0,Facebook:1,Google:2},V.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},V.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},V.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},V.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},V.ContactPropertyType={Unknown:0,FullName:10,FirstName:15,LastName:16,MiddleName:16,Nick:18,NamePrefix:20,NameSuffix:21,Email:30,Phone:31,Web:32,Birthday:40,Facebook:90,Skype:91,GitHub:92,Note:110,Custom:250},V.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,AccountTwoFactorAuthRequired:120,AccountTwoFactorAuthError:121,CouldNotSaveNewPassword:130,CurrentPasswordIncorrect:131,NewPasswordShort:132,NewPasswordWeak:133,NewPasswordForbidden:134,ContactsSyncError:140,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantCopyMessage:205,CantSaveMessage:301,CantSendMessage:302,InvalidRecipients:303,CantCreateFolder:400,CantRenameFolder:401,CantDeleteFolder:402,CantSubscribeFolder:403,CantUnsubscribeFolder:404,CantDeleteNonEmptyFolder:405,CantSaveSettings:501,CantSavePluginSettings:502,DomainAlreadyExists:601,CantInstallPackage:701,CantDeletePackage:702,InvalidPluginPackage:703,UnsupportedPluginPackage:704,LicensingServerIsUnavailable:710,LicensingExpired:711,LicensingBanned:712,DemoSendMessageError:750,AccountAlreadyExists:801,MailServerError:901,ClientViewError:902,UnknownNotification:999,UnknownError:999},X.trim=b.trim,X.inArray=b.inArray,X.isArray=f.isArray,X.isFunc=f.isFunction,X.isUnd=f.isUndefined,X.isNull=f.isNull,X.emptyFunction=function(){},X.isNormal=function(a){return!X.isUnd(a)&&!X.isNull(a)},X.windowResize=f.debounce(function(b){X.isUnd(b)?fb.resize():a.setTimeout(function(){fb.resize()},b)},50),X.isPosNumeric=function(a,b){return X.isNormal(a)?(X.isUnd(b)?0:!b)?/^[1-9]+[0-9]*$/.test(a.toString()):/^[0-9]*$/.test(a.toString()):!1},X.pInt=function(b){return X.isNormal(b)&&""!==b?a.parseInt(b,10):0},X.pString=function(a){return X.isNormal(a)?""+a:""},X.isNonEmptyArray=function(a){return X.isArray(a)&&0 /g,">").replace(/"/g,""").replace(/'/g,"'"):""},X.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=X.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},X.timeOutAction=function(){var b={};return function(c,d,e){X.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),X.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),X.audio=function(){var b=!1;return function(c,d){if(!1===b)if($.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}}(),X.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},X.i18n=function(a,b,c){var d="",e=X.isUnd(db[a])?X.isUnd(c)?a:c:db[a];if(!X.isUnd(b)&&!X.isNull(b))for(d in b)X.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},X.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(X.i18n(c)):(c=a.data("i18n-html"),c&&a.html(X.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",X.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",X.i18n(c)))})})},X.i18nToDoc=function(){a.rainloopI18N&&(db=a.rainloopI18N||{},X.i18nToNode(gb),$.langChangeTrigger(!$.langChangeTrigger())),a.rainloopI18N={}},X.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?$.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&$.langChangeTrigger.subscribe(a,b)},X.inFocus=function(){return document.activeElement?(X.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=b(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},X.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);a.is("input,textarea")&&document.activeElement.blur()}},X.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()},X.replySubjectAdd=function(b,c,d){var e=null,f=X.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||X.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||X.isUnd(e[1])||X.isUnd(e[2])||X.isUnd(e[3])?b+": "+c:e[1]+(X.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(X.isUnd(d)?!0:d)?X.fixLongSubject(f):f},X.fixLongSubject=function(a){var b=0,c=null;a=X.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||X.isUnd(c[0]))&&(c=null),c&&(b=0,b+=X.isUnd(c[2])?1:0+X.pInt(c[2]),b+=X.isUnd(c[4])?1:0+X.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]+/," ")},X.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},X.friendlySize=function(a){return a=X.pInt(a),a>=1073741824?X.roundNumber(a/1073741824,1)+"GB":a>=1048576?X.roundNumber(a/1048576,1)+"MB":a>=1024?X.roundNumber(a/1024,0)+"KB":a+"B"},X.log=function(b){a.console&&a.console.log&&a.console.log(b)},X.getNotification=function(a,b){return a=X.pInt(a),V.Notification.ClientViewError===a&&b?b:X.isUnd(W[a])?"":W[a]},X.initNotificationLanguage=function(){W[V.Notification.InvalidToken]=X.i18n("NOTIFICATIONS/INVALID_TOKEN"),W[V.Notification.AuthError]=X.i18n("NOTIFICATIONS/AUTH_ERROR"),W[V.Notification.AccessError]=X.i18n("NOTIFICATIONS/ACCESS_ERROR"),W[V.Notification.ConnectionError]=X.i18n("NOTIFICATIONS/CONNECTION_ERROR"),W[V.Notification.CaptchaError]=X.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),W[V.Notification.SocialFacebookLoginAccessDisable]=X.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),W[V.Notification.SocialTwitterLoginAccessDisable]=X.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),W[V.Notification.SocialGoogleLoginAccessDisable]=X.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),W[V.Notification.DomainNotAllowed]=X.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),W[V.Notification.AccountNotAllowed]=X.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),W[V.Notification.AccountTwoFactorAuthRequired]=X.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),W[V.Notification.AccountTwoFactorAuthError]=X.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),W[V.Notification.CouldNotSaveNewPassword]=X.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),W[V.Notification.CurrentPasswordIncorrect]=X.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),W[V.Notification.NewPasswordShort]=X.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),W[V.Notification.NewPasswordWeak]=X.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),W[V.Notification.NewPasswordForbidden]=X.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),W[V.Notification.ContactsSyncError]=X.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),W[V.Notification.CantGetMessageList]=X.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),W[V.Notification.CantGetMessage]=X.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),W[V.Notification.CantDeleteMessage]=X.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),W[V.Notification.CantMoveMessage]=X.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),W[V.Notification.CantCopyMessage]=X.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),W[V.Notification.CantSaveMessage]=X.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),W[V.Notification.CantSendMessage]=X.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),W[V.Notification.InvalidRecipients]=X.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),W[V.Notification.CantCreateFolder]=X.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),W[V.Notification.CantRenameFolder]=X.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),W[V.Notification.CantDeleteFolder]=X.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),W[V.Notification.CantDeleteNonEmptyFolder]=X.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),W[V.Notification.CantSubscribeFolder]=X.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),W[V.Notification.CantUnsubscribeFolder]=X.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),W[V.Notification.CantSaveSettings]=X.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),W[V.Notification.CantSavePluginSettings]=X.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),W[V.Notification.DomainAlreadyExists]=X.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),W[V.Notification.CantInstallPackage]=X.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),W[V.Notification.CantDeletePackage]=X.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),W[V.Notification.InvalidPluginPackage]=X.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),W[V.Notification.UnsupportedPluginPackage]=X.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),W[V.Notification.LicensingServerIsUnavailable]=X.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),W[V.Notification.LicensingExpired]=X.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),W[V.Notification.LicensingBanned]=X.i18n("NOTIFICATIONS/LICENSING_BANNED"),W[V.Notification.DemoSendMessageError]=X.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),W[V.Notification.AccountAlreadyExists]=X.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),W[V.Notification.MailServerError]=X.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),W[V.Notification.UnknownNotification]=X.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),W[V.Notification.UnknownError]=X.i18n("NOTIFICATIONS/UNKNOWN_ERROR") +},X.getUploadErrorDescByCode=function(a){var b="";switch(X.pInt(a)){case V.UploadErrorCode.FileIsTooBig:b=X.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case V.UploadErrorCode.FilePartiallyUploaded:b=X.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case V.UploadErrorCode.FileNoUploaded:b=X.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case V.UploadErrorCode.MissingTempFolder:b=X.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case V.UploadErrorCode.FileOnSaveingError:b=X.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case V.UploadErrorCode.FileType:b=X.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=X.i18n("UPLOAD/ERROR_UNKNOWN")}return b},X.delegateRun=function(a,b,c,d){a&&a[b]&&(d=X.pInt(d),0>=d?a[b].apply(a,X.isArray(c)?c:[]):f.delay(function(){a[b].apply(a,X.isArray(c)?c:[])},d))},X.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===V.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===V.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},X.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=X.isUnd(d)?!0:d,e.canExecute=X.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},X.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(V.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(V.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),$.sAnimationType=V.InterfaceAnimation.Full,b.capaThemes=c.observable(!1),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(V.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return V.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if($.bMobileDevice||a===V.InterfaceAnimation.None)eb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),$.sAnimationType=V.InterfaceAnimation.None;else switch(a){case V.InterfaceAnimation.Full:eb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),$.sAnimationType=a;break;case V.InterfaceAnimation.Normal:eb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),$.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=V.DesktopNotifications.NotSupported;if(hb&&hb.permission)switch(hb.permission.toLowerCase()){case"granted":c=V.DesktopNotifications.Allowed;break;case"denied":c=V.DesktopNotifications.Denied;break;case"default":c=V.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&V.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();V.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):V.DesktopNotifications.NotAllowed===c?hb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),V.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")?X.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?X.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},X.isFolderExpanded=function(a){var b=ib.local().get(V.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},X.setExpandedFolder=function(a,b){var c=ib.local().get(V.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),ib.local().set(V.ClientSideKeyName.ExpandedFolders,c)},X.initLayoutResizer=function(a,c,d){var e=60,f=155,g=b(a),h=b(c),i=ib.local().get(d)||null,j=function(a){a&&(g.css({width:""+a+"px"}),h.css({left:""+a+"px"}))},k=function(a){if(a)g.resizable("disable"),j(e);else{g.resizable("enable");var b=X.pInt(ib.local().get(d))||f;j(b>f?b:f)}},l=function(a,b){b&&b.size&&b.size.width&&(ib.local().set(d,b.size.width),h.css({left:""+b.size.width+"px"}))};null!==i&&j(i>f?i:f),g.resizable({helper:"ui-resizable-helper",minWidth:f,maxWidth:350,handles:"e",stop:l}),ib.sub("left-panel.off",function(){k(!0)}),ib.sub("left-panel.on",function(){k(!1)})},X.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"),X.windowResize()}).after("
").before("
"))})}},X.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()}))},X.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},X.extendAsViewModel=function(a,b,c){b&&(c||(c=l),b.__name=a,Y.regViewModelHook(a,b),f.extend(b.prototype,c.prototype))},X.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},_.settings.push(a)},X.removeSettingsViewModel=function(a){_["settings-removed"].push(a)},X.disableSettingsViewModel=function(a){_["settings-disabled"].push(a)},X.convertThemeName=function(a){return"@custom"===a.substr(-7)&&(a=X.trim(a.substring(0,a.length-7))),X.trim(a.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},X.quoteName=function(a){return a.replace(/["]/g,'\\"')},X.microtime=function(){return(new Date).getTime()},X.convertLangName=function(a,b){return X.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},X.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=X.isUnd(a)?32:X.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o /g,">").replace(/")},X.draggeblePlace=function(){return b(' ').appendTo("#rl-hidden")},X.defautOptionsAfterRender=function(a,c){c&&!X.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},X.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+X.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")),X.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+X.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)},X.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=X.isUnd(d)?1e3:X.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?V.SaveSettingsStep.TrueResult:V.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,V.SaveSettingsStep.Idle)},d)}},X.settingsSaveHelperSimpleFunction=function(a,b){return X.settingsSaveHelperFunction(null,a,b,1e3)},X.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(/') ; /*jshint onevar: true*/ - + /** * @type {?} */ @@ -237,7 +237,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes) return oType && 'application/pdf' === oType.type; }); } - + Consts.Defaults = {}; Consts.Values = {}; Consts.DataImages = {}; @@ -355,7 +355,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA * @type {string} */ Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII='; - + /** * @enum {string} */ @@ -387,7 +387,14 @@ Enums.StateType = { * @enum {string} */ Enums.Capa = { - 'Prem': 'PREM' + 'Prem': 'PREM', + 'TwoFactor': 'TWO_FACTOR', + 'OpenPGP': 'OPEN_PGP', + 'Prefetch': 'PREFETCH', + 'Gravatar': 'GRAVATAR', + 'Themes': 'THEMES', + 'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS', + 'AdditionalIdentities': 'ADDITIONAL_IDENTITIES' }; /** @@ -737,7 +744,7 @@ Enums.Notification = { 'UnknownNotification': 999, 'UnknownError': 999 }; - + Utils.trim = $.trim; Utils.inArray = $.inArray; Utils.isArray = _.isArray; @@ -1510,7 +1517,7 @@ Utils.initDataConstructorBySettings = function (oData) Globals.sAnimationType = Enums.InterfaceAnimation.Full; - oData.allowThemes = ko.observable(true); + oData.capaThemes = ko.observable(false); oData.allowCustomLogin = ko.observable(false); oData.allowLanguagesOnSettings = ko.observable(true); oData.allowLanguagesOnLogin = ko.observable(true); @@ -1678,9 +1685,9 @@ Utils.initDataConstructorBySettings = function (oData) } }); - oData.allowAdditionalAccounts = ko.observable(false); - oData.allowIdentities = ko.observable(false); - oData.allowGravatar = ko.observable(false); + oData.capaAdditionalAccounts = ko.observable(false); + oData.capaAdditionalIdentities = ko.observable(false); + oData.capaGravatar = ko.observable(false); oData.determineUserLanguage = ko.observable(false); oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200}); @@ -2487,7 +2494,7 @@ Utils.detectDropdownVisibility = _.debounce(function () { return oItem.hasClass('open'); })); }, 50); - + // Base64 encode / decode // http://www.webtoolkit.info/ @@ -2650,7 +2657,7 @@ Base64 = { } }; -/*jslint bitwise: false*/ +/*jslint bitwise: false*/ ko.bindingHandlers.tooltip = { 'init': function (oElement, fValueAccessor) { if (!Globals.bMobileDevice) @@ -3477,7 +3484,7 @@ ko.observable.fn.validateFunc = function (fFunc) return this; }; - + /** * @constructor */ @@ -3789,7 +3796,7 @@ LinkBuilder.prototype.socialFacebook = function () { return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : ''); }; - + /** * @type {Object} */ @@ -3883,7 +3890,7 @@ Plugins.settingsGet = function (sPluginSection, sName) }; - + function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange) { var self = this; @@ -4103,7 +4110,7 @@ NewHtmlEditorWrapper.prototype.clear = function (bFocus) this.setHtml('', bFocus); }; - + /** * @constructor * @param {koProperty} oKoList @@ -4812,7 +4819,7 @@ Selector.prototype.on = function (sEventName, fCallback) { this.oCallbacks[sEventName] = fCallback; }; - + /** * @constructor */ @@ -4886,7 +4893,7 @@ CookieDriver.prototype.get = function (sKey) return mResult; }; - + /** * @constructor */ @@ -4957,7 +4964,7 @@ LocalStorageDriver.prototype.get = function (sKey) return mResult; }; - + /** * @constructor */ @@ -5000,7 +5007,7 @@ LocalStorage.prototype.get = function (iKey) { return this.oDriver ? this.oDriver.get('p' + iKey) : null; }; - + /** * @constructor */ @@ -5013,7 +5020,7 @@ KnoinAbstractBoot.prototype.bootstart = function () { }; - + /** * @param {string=} sPosition = '' * @param {string=} sTemplate = '' @@ -5106,7 +5113,7 @@ KnoinAbstractViewModel.prototype.registerPopupKeyDown = function () return true; }); }; - + /** * @param {string} sScreenName * @param {?=} aViewModels = [] @@ -5182,7 +5189,7 @@ KnoinAbstractScreen.prototype.__start = function () this.oCross = oRoute; } }; - + /** * @constructor */ @@ -5582,7 +5589,7 @@ Knoin.prototype.bootstart = function () }; kn = new Knoin(); - + /** * @param {string=} sEmail * @param {string=} sName @@ -5946,7 +5953,7 @@ EmailModel.prototype.inputoTagLine = function () { return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email; }; - + /** * @constructor */ @@ -6070,7 +6077,7 @@ ContactModel.prototype.lineAsCcc = function () return aResult.join(' '); }; - + /** * @param {number=} iType = Enums.ContactPropertyType.Unknown * @param {string=} sTypeStr = '' @@ -6099,7 +6106,7 @@ function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder) }, this); } - + /** * @constructor */ @@ -6143,7 +6150,7 @@ ContactTagModel.prototype.toLine = function (bEncodeHtml) return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ? Utils.encodeHtml(this.name()) : this.name(); }; - + /** * @constructor */ @@ -6379,7 +6386,7 @@ AttachmentModel.prototype.iconClass = function () return sClass; }; - + /** * @constructor * @param {string} sId @@ -6440,7 +6447,7 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment) } return bResult; -}; +}; /** * @constructor */ @@ -6803,7 +6810,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage) this.sInReplyTo = oJsonMessage.InReplyTo; this.sReferences = oJsonMessage.References; - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { this.isPgpSigned(!!oJsonMessage.PgpSigned); this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted); @@ -7438,7 +7445,7 @@ MessageModel.prototype.storeDataToDom = function () this.body.data('rl-plain-raw', this.plainRaw); - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned()); this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted()); @@ -7450,7 +7457,7 @@ MessageModel.prototype.storeDataToDom = function () MessageModel.prototype.storePgpVerifyDataToDom = function () { - if (this.body && RL.data().allowOpenPGP()) + if (this.body && RL.data().capaOpenPGP()) { this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus()); this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser()); @@ -7467,7 +7474,7 @@ MessageModel.prototype.fetchDataToDom = function () this.plainRaw = Utils.pString(this.body.data('rl-plain-raw')); - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed')); this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted')); @@ -7634,7 +7641,7 @@ MessageModel.prototype.flagHash = function () return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(), this.isReadReceipt()].join(''); }; - + /** * @constructor */ @@ -7966,7 +7973,7 @@ FolderModel.prototype.printableFullName = function () { return this.fullName.split(this.delimiter).join(' / '); }; - + /** * @param {string} sEmail * @param {boolean=} bCanBeDelete = true @@ -7987,7 +7994,7 @@ AccountModel.prototype.email = ''; AccountModel.prototype.changeAccountLink = function () { return RL.link().change(this.email); -}; +}; /** * @param {string} sId * @param {string} sEmail @@ -8023,7 +8030,7 @@ IdentityModel.prototype.formattedNameForEmail = function () var sName = this.name(); return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>'; }; - + /** * @param {string} iIndex * @param {string} sGuID @@ -8054,7 +8061,7 @@ OpenPgpKeyModel.prototype.user = ''; OpenPgpKeyModel.prototype.email = ''; OpenPgpKeyModel.prototype.armor = ''; OpenPgpKeyModel.prototype.isPrivate = false; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -8150,7 +8157,7 @@ PopupsFolderClearViewModel.prototype.onShow = function (oFolder) this.selectedFolder(oFolder); } }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -8260,7 +8267,7 @@ PopupsFolderCreateViewModel.prototype.onFocus = function () { this.folderName.focused(true); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -8373,7 +8380,7 @@ PopupsFolderSystemViewModel.prototype.onShow = function (iNotificationType) this.notification(sNotification); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -8388,8 +8395,8 @@ function PopupsComposeViewModel() this.bFromDraft = false; this.bSkipNext = false; this.sReferences = ''; - - this.bAllowIdentities = RL.settingsGet('AllowIdentities'); + + this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities); var self = this, @@ -8402,7 +8409,7 @@ function PopupsComposeViewModel() } ; - this.allowOpenPGP = oRainLoopData.allowOpenPGP; + this.capaOpenPGP = oRainLoopData.capaOpenPGP; this.resizer = ko.observable(false).extend({'throttle': 50}); @@ -8499,7 +8506,7 @@ function PopupsComposeViewModel() sID = this.currentIdentityID() ; - if (this.bAllowIdentities && sID && sID !== RL.data().accountEmail()) + if (this.bCapaAdditionalIdentities && sID && sID !== RL.data().accountEmail()) { oItem = _.find(aList, function (oItem) { return oItem && sID === oItem['id']; @@ -8740,7 +8747,7 @@ Utils.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel); PopupsComposeViewModel.prototype.openOpenPgpPopup = function () { - if (this.allowOpenPGP() && this.oEditor && !this.oEditor.isHtml()) + if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) { var self = this; kn.showScreenPopup(PopupsComposeOpenPgpViewModel, [ @@ -8791,7 +8798,7 @@ PopupsComposeViewModel.prototype.findIdentityIdByMessage = function (sComposeTyp } ; - if (this.bAllowIdentities) + if (this.bCapaAdditionalIdentities) { _.each(this.identities(), function (oItem) { oIDs[oItem.email()] = oItem['id']; @@ -9861,7 +9868,7 @@ PopupsComposeViewModel.prototype.triggerForResize = function () this.editorResizeThrottle(); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -10603,7 +10610,7 @@ PopupsContactsViewModel.prototype.onHide = function () // oItem.checked(false); // }); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -10739,7 +10746,7 @@ PopupsAdvancedSearchViewModel.prototype.onFocus = function () { this.fromFocus(true); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -10851,7 +10858,7 @@ PopupsAddAccountViewModel.prototype.onFocus = function () { this.emailFocus(true); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -10937,7 +10944,7 @@ PopupsAddOpenPgpKeyViewModel.prototype.onFocus = function () { this.key.focus(true); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -10977,7 +10984,7 @@ PopupsViewOpenPgpKeyViewModel.prototype.onShow = function (oOpenPgpKey) this.key(oOpenPgpKey.armor); } }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11025,6 +11032,13 @@ function PopupsGenerateNewOpenPgpKeyViewModel() _.delay(function () { mKeyPair = window.openpgp.generateKeyPair(1, Utils.pInt(self.keyBitLength()), sUserID, Utils.trim(self.password())); +// 0.6.0 +// mKeyPair = window.openpgp.generateKeyPair({ +// 'numBits': Utils.pInt(self.keyBitLength()), +// 'userId': sUserID, +// 'passphrase': Utils.trim(self.password()) +// }); + if (mKeyPair && mKeyPair.privateKeyArmored) { oOpenpgpKeyring.privateKeys.importKey(mKeyPair.privateKeyArmored); @@ -11065,7 +11079,7 @@ PopupsGenerateNewOpenPgpKeyViewModel.prototype.onFocus = function () { this.email.focus(true); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11305,7 +11319,7 @@ PopupsComposeOpenPgpViewModel.prototype.onShow = function (fCallback, sText, sFr this.to(aRec); this.text(sText); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11453,7 +11467,7 @@ PopupsIdentityViewModel.prototype.onFocus = function () this.email.focused(true); } }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11513,7 +11527,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang) RL.data().mainLanguage(sLang); this.cancelCommand(); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11567,7 +11581,7 @@ PopupsTwoFactorTestViewModel.prototype.onFocus = function () { this.code.focused(true); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11673,7 +11687,7 @@ PopupsAskViewModel.prototype.onBuild = function () }, this)); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -11718,7 +11732,7 @@ PopupsKeyboardShortcutsHelpViewModel.prototype.onBuild = function (oDom) } }, this)); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -12030,7 +12044,7 @@ LoginViewModel.prototype.selectLanguage = function () kn.showScreenPopup(PopupsLanguagesViewModel); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -12047,7 +12061,7 @@ function AbstractSystemDropDownViewModel() this.accountMenuDropdownTrigger = ko.observable(false); - this.allowAddAccount = RL.settingsGet('AllowAdditionalAccounts'); + this.capaAdditionalAccounts = RL.capa(Enums.Capa.AdditionalAccounts); this.loading = ko.computed(function () { return this.accountsLoading(); @@ -12089,7 +12103,7 @@ AbstractSystemDropDownViewModel.prototype.settingsHelp = function () AbstractSystemDropDownViewModel.prototype.addAccountClick = function () { - if (this.allowAddAccount) + if (this.capaAdditionalAccounts) { kn.showScreenPopup(PopupsAddAccountViewModel); } @@ -12126,7 +12140,7 @@ AbstractSystemDropDownViewModel.prototype.onBuild = function () } }); }; - + /** * @constructor * @extends AbstractSystemDropDownViewModel @@ -12138,7 +12152,7 @@ function MailBoxSystemDropDownViewModel() } Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel); - + /** * @constructor * @extends AbstractSystemDropDownViewModel @@ -12150,7 +12164,7 @@ function SettingsSystemDropDownViewModel() } Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel); - + /** * @constructor * @extends KnoinAbstractViewModel @@ -12359,7 +12373,7 @@ MailBoxFolderListViewModel.prototype.contactsClick = function () kn.showScreenPopup(PopupsContactsViewModel); } }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -13025,7 +13039,7 @@ MailBoxMessageListViewModel.prototype.onBuild = function (oDom) this.initUploaderForAppend(); this.initShortcuts(); - if (!Globals.bMobileDevice && !!RL.settingsGet('AllowPrefetch') && ifvisible) + if (!Globals.bMobileDevice && RL.capa(Enums.Capa.Prefetch) && ifvisible) { ifvisible.setIdleDuration(10); @@ -13262,7 +13276,7 @@ MailBoxMessageListViewModel.prototype.initUploaderForAppend = function () ; return !!oJua; -}; +}; /** * @constructor * @extends KnoinAbstractViewModel @@ -13954,7 +13968,7 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage) RL.reloadFlagsCurrentMessageListAndMessageFromCache(); } }; - + /** * @param {?} oScreen * @@ -13983,7 +13997,7 @@ SettingsMenuViewModel.prototype.backToMailBoxClick = function () { kn.setHash(RL.link().inbox()); }; - + /** * @constructor * @extends KnoinAbstractViewModel @@ -14014,7 +14028,7 @@ SettingsPaneViewModel.prototype.backToMailBoxClick = function () { kn.setHash(RL.link().inbox()); }; - + /** * @constructor */ @@ -14174,7 +14188,7 @@ SettingsGeneral.prototype.selectLanguage = function () { kn.showScreenPopup(PopupsLanguagesViewModel); }; - + /** * @constructor */ @@ -14224,7 +14238,7 @@ SettingsContacts.prototype.onBuild = function () //{ // //}; - + /** * @constructor */ @@ -14305,7 +14319,7 @@ SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove) } } }; - + /** * @constructor */ @@ -14393,7 +14407,7 @@ SettingsIdentity.prototype.onBuild = function () }, 50); }; - + /** * @constructor */ @@ -14551,7 +14565,7 @@ SettingsIdentities.prototype.onBuild = function (oDom) }); }, 50); -}; +}; /** * @constructor */ @@ -14701,7 +14715,7 @@ SettingsSecurity.prototype.onBuild = function () this.processing(true); RL.remote().getTwoFactor(this.onResult); }; - + /** * @constructor */ @@ -14768,7 +14782,7 @@ function SettingsSocialScreen() } Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social'); - + /** * @constructor */ @@ -14873,7 +14887,7 @@ SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sRes Utils.getNotification(Enums.Notification.CouldNotSaveNewPassword)); } }; - + /** * @constructor */ @@ -15068,7 +15082,7 @@ SettingsFolders.prototype.unSubscribeFolder = function (oFolder) oFolder.subScribed(false); }; - + /** * @constructor */ @@ -15182,7 +15196,7 @@ SettingsThemes.prototype.onBuild = function () }; })); }; - + /** * @constructor */ @@ -15250,7 +15264,7 @@ SettingsOpenPGP.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove) RL.reloadOpenPgpKeys(); } } -}; +}; /** * @constructor */ @@ -15335,12 +15349,12 @@ AbstractData.prototype.populateDataOnStart = function() this.mainLanguage(RL.settingsGet('Language')); this.mainTheme(RL.settingsGet('Theme')); - this.allowAdditionalAccounts(!!RL.settingsGet('AllowAdditionalAccounts')); - this.allowIdentities(!!RL.settingsGet('AllowIdentities')); - this.allowGravatar(!!RL.settingsGet('AllowGravatar')); + this.capaAdditionalAccounts(RL.capa(Enums.Capa.AdditionalAccounts)); + this.capaAdditionalIdentities(RL.capa(Enums.Capa.AdditionalIdentities)); + this.capaGravatar(RL.capa(Enums.Capa.Gravatar)); this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage')); - - this.allowThemes(!!RL.settingsGet('AllowThemes')); + + this.capaThemes(RL.capa(Enums.Capa.Themes)); this.allowCustomLogin(!!RL.settingsGet('AllowCustomLogin')); this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin')); this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings')); @@ -15380,7 +15394,7 @@ AbstractData.prototype.populateDataOnStart = function() this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed')); }; - + /** * @constructor * @extends AbstractData @@ -15783,7 +15797,7 @@ function WebMailDataStorage() }, this); // other - this.allowOpenPGP = ko.observable(false); + this.capaOpenPGP = ko.observable(false); this.openpgpkeys = ko.observableArray([]); this.openpgpKeyring = null; @@ -16310,8 +16324,7 @@ WebMailDataStorage.prototype.setMessage = function (oData, bCached) sPlain = oData.Result.Plain.toString(); if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && - RL.data().allowOpenPGP() && - Utils.isNormal(oData.Result.PlainRaw)) + RL.data().capaOpenPGP() && Utils.isNormal(oData.Result.PlainRaw)) { oMessage.plainRaw = Utils.pString(oData.Result.PlainRaw); @@ -16634,7 +16647,7 @@ WebMailDataStorage.prototype.findSelfPrivateKey = function (sPassword) { return this.findPrivateKeyByEmail(this.accountEmail(), sPassword); }; - + /** * @constructor */ @@ -16908,7 +16921,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion) 'Version': sVersion }); }; - + /** * @constructor * @extends AbstractAjaxRemoteStorage @@ -17701,7 +17714,7 @@ WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback) this.defaultRequest(fCallback, 'SocialUsers'); }; - + /** * @constructor */ @@ -17709,7 +17722,7 @@ function AbstractCacheStorage() { this.oEmailsPicsHashes = {}; this.oServices = {}; - this.bAllowGravatar = !!RL.settingsGet('AllowGravatar'); + this.bCapaGravatar = RL.capa(Enums.Capa.Gravatar); } /** @@ -17725,7 +17738,7 @@ AbstractCacheStorage.prototype.oServices = {}; /** * @type {boolean} */ -AbstractCacheStorage.prototype.bAllowGravatar = false; +AbstractCacheStorage.prototype.bCapaGravatar = false; AbstractCacheStorage.prototype.clear = function () { @@ -17759,7 +17772,7 @@ AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback) } - if (this.bAllowGravatar && '' === sUrl) + if (this.bCapaGravatar && '' === sUrl) { fCallback('//secure.gravatar.com/avatar/' + Utils.md5(sEmailLower) + '.jpg?s=80&d=mm', sEmail); } @@ -17784,7 +17797,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData) { this.oEmailsPicsHashes = oData; }; - + /** * @constructor * @extends AbstractCacheStorage @@ -18102,7 +18115,7 @@ WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function this.setMessageFlagsToCache(sFolder, sUid, aFlags); } }; - + /** * @param {Array} aViewModels * @constructor @@ -18280,7 +18293,7 @@ AbstractSettings.prototype.routes = function () ['', oRules] ]; }; - + /** * @constructor * @extends KnoinAbstractScreen @@ -18295,7 +18308,7 @@ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype); LoginScreen.prototype.onShow = function () { RL.setTitle(''); -}; +}; /** * @constructor * @extends KnoinAbstractScreen @@ -18387,7 +18400,7 @@ MailBoxScreen.prototype.onStart = function () } ; - if (RL.settingsGet('AllowAdditionalAccounts') || RL.settingsGet('AllowIdentities')) + if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities)) { RL.accountsAndIdentities(); } @@ -18466,7 +18479,7 @@ MailBoxScreen.prototype.routes = function () [/^([^\/]*)$/, {'normalize_': fNormS}] ]; }; - + /** * @constructor * @extends AbstractSettings @@ -18495,7 +18508,7 @@ SettingsScreen.prototype.onShow = function () RL.setTitle(this.sSettingsTitle); RL.data().keyScope(Enums.KeyState.Settings); }; - + /** * @constructor * @extends KnoinAbstractBoot @@ -18853,7 +18866,7 @@ AbstractApp.prototype.bootstart = function () ssm.ready(); }; - + /** * @constructor * @extends AbstractApp @@ -19279,7 +19292,7 @@ RainLoopApp.prototype.folders = function (fCallback) RainLoopApp.prototype.reloadOpenPgpKeys = function () { - if (RL.data().allowOpenPGP()) + if (RL.data().capaOpenPGP()) { var aKeys = [], @@ -19897,12 +19910,12 @@ RainLoopApp.prototype.bootstart = function () Utils.removeSettingsViewModel(SettingsContacts); } - if (!RL.settingsGet('AllowAdditionalAccounts')) + if (!RL.capa(Enums.Capa.AdditionalAccounts)) { Utils.removeSettingsViewModel(SettingsAccounts); } - if (RL.settingsGet('AllowIdentities')) + if (RL.capa(Enums.Capa.AdditionalIdentities)) { Utils.removeSettingsViewModel(SettingsIdentity); } @@ -19911,26 +19924,26 @@ RainLoopApp.prototype.bootstart = function () Utils.removeSettingsViewModel(SettingsIdentities); } - if (!RL.settingsGet('OpenPGP')) + if (!RL.capa(Enums.Capa.OpenPGP)) { Utils.removeSettingsViewModel(SettingsOpenPGP); } - if (!RL.settingsGet('AllowTwoFactorAuth')) + if (!RL.capa(Enums.Capa.TwoFactor)) { Utils.removeSettingsViewModel(SettingsSecurity); } + if (!RL.capa(Enums.Capa.Themes)) + { + Utils.removeSettingsViewModel(SettingsThemes); + } + if (!bGoogle && !bFacebook && !bTwitter) { Utils.removeSettingsViewModel(SettingsSocialScreen); } - if (!RL.settingsGet('AllowThemes')) - { - Utils.removeSettingsViewModel(SettingsThemes); - } - Utils.initOnStartOrLangChange(function () { $.extend(true, $.magnificPopup.defaults, { @@ -19967,7 +19980,7 @@ RainLoopApp.prototype.bootstart = function () if (bValue) { - if (window.crypto && window.crypto.getRandomValues && RL.settingsGet('OpenPGP')) + if (window.crypto && window.crypto.getRandomValues && RL.capa(Enums.Capa.OpenPGP)) { $.ajax({ 'url': RL.link().openPgpJs(), @@ -19977,7 +19990,7 @@ RainLoopApp.prototype.bootstart = function () if (window.openpgp) { RL.data().openpgpKeyring = new window.openpgp.Keyring(); - RL.data().allowOpenPGP(true); + RL.data().capaOpenPGP(true); RL.pub('openpgp.init'); @@ -19988,7 +20001,7 @@ RainLoopApp.prototype.bootstart = function () } else { - RL.data().allowOpenPGP(false); + RL.data().capaOpenPGP(false); } kn.startScreens([MailBoxScreen, SettingsScreen]); @@ -20155,7 +20168,7 @@ RainLoopApp.prototype.bootstart = function () * @type {RainLoopApp} */ RL = new RainLoopApp(); - + $html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile'); $window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS); @@ -20206,9 +20219,9 @@ window['__RLBOOT'] = function (fCall) { window['__RLBOOT'] = null; }); }; - + if (window.SimplePace) { window.SimplePace.add(10); -} - +} + }(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible, key)); \ No newline at end of file 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 2a04fcaa7..45c5788a4 100644 --- a/rainloop/v/0.0.0/static/js/app.min.js +++ b/rainloop/v/0.0.0/static/js/app.min.js @@ -1,10 +1,10 @@ /*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ -!function(a,b,c,d,e,f,g,h,i,j){"use strict";function k(){this.sBase="#/",this.sVersion=Pb.settingsGet("Version"),this.sSpecSuffix=Pb.settingsGet("AuthAccountHash")||"0",this.sServer=(Pb.settingsGet("IndexFile")||"./")+"?"}function l(a,c,d,e){var f=this;f.editor=null,f.iBlurTimer=0,f.fOnBlur=c||null,f.fOnReady=d||null,f.fOnModeChange=e||null,f.$element=b(a),f.init()}function m(a,b,d,e,f,g){this.list=a,this.listChecked=c.computed(function(){return h.filter(this.list(),function(a){return a.checked()})},this).extend({rateLimit:0}),this.isListChecked=c.computed(function(){return 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,"")},X.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},X.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},X.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:X.isUnd(c)?a.toString():c.toString(),custom:X.isUnd(c)?!1:!0,title:X.isUnd(c)?"":a.toString(),value:a.toString()};(X.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}},X.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()}},X.disableKeyFilter=function(){a.key&&(key.filter=function(){return ib.data().useKeyboardShortcuts()})},X.restoreKeyFilter=function(){a.key&&(key.filter=function(a){if(ib.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},X.detectDropdownVisibility=f.debounce(function(){$.dropdownVisibility(!!f.find(ab,function(a){return a.hasClass("open")}))},50),Z={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Z.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Z._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Z._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(!$.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||$.dropdownVisibility()?"":''+X.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),$.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||$.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),$.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),$.dropdownVisibility.subscribe(function(a){a&&c.tooltip("hide")}),gb.click(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){ab.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),X.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!X.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&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!$.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){X.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){X.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),X.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=X.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=X.pInt(e[2]),g=fb.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(!$.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),X.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),X.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)},b(d).draggable(k).on("mousedown",function(){X.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!$.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){$.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(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:g,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){ib.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=X.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(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:g,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){ib.getContactsTagsAutocomplete(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=X.trim(a),c=null;return""!==b?(c=new p,c.name(b),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&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(X.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},X.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=X.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=X.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),X.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 X.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=X.isNormal(b)?X.pInt(b):1,c=X.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.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},g.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},g.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a +},g.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=X.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.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+"/":"")},Y.oViewModelsHooks={},Y.oSimpleHooks={},Y.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Y.addHook=function(a,b){X.isFunc(b)&&(X.isArray(Y.oSimpleHooks[a])||(Y.oSimpleHooks[a]=[]),Y.oSimpleHooks[a].push(b))},Y.runHook=function(a,b){X.isArray(Y.oSimpleHooks[a])&&(b=b||[],f.each(Y.oSimpleHooks[a],function(a){a.apply(null,b)}))},Y.mainSettingsGet=function(a){return ib?ib.settingsGet(a):null},Y.remoteRequest=function(a,b,c,d,e,f){ib&&ib.remote().defaultRequest(a,b,c,d,e,f)},Y.settingsGet=function(a,b){var c=Y.mainSettingsGet("Plugins");return c=c&&X.isUnd(c[a])?null:c[a],c?X.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(U.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(U.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(U.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.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[U.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[U.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[U.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.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.storeAndSetKeyScope=function(){this.sCurrentKeyScope=ib.data().keyScope(),ib.data().keyScope(this.sDefaultKeyScope)},l.prototype.restoreKeyScope=function(){ib.data().keyScope(this.sCurrentKeyScope)},l.prototype.registerPopupKeyDown=function(){var a=this;fb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&V.EventKeyCode.Esc===b.keyCode)return X.delegateRun(a,"cancelCommand"),!1;if(V.EventKeyCode.Backspace===b.keyCode&&!X.inFocus())return!1}return!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;X.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||X.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){X.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 X.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||X.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),g=e.viewModelPosition(),h=b("#rl-content #rl-"+g.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=ib.data(),e.viewModelName=a.__name,h&&1===h.length?(i=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=X.createCommand(e,function(){bb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),ib.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+ib.popupVisibilityNames().length+10),X.delegateRun(this,"onFocus",[],500)):(X.delegateRun(this,"onHide"),this.restoreKeyScope(),ib.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),f.delay(function(){b.viewModelDom.hide()},300))},e)),Y.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),X.delegateRun(e,"onBuild",[i]),e&&"Popups"===g&&e.registerPopupKeyDown(),Y.runHook("view-model-post-build",[a.__name,e,i])):X.log("Cannot find view model position: "+g)}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),Y.runHook("view-model-on-hide",[a.__name,a.__vm]))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),X.delegateRun(a.__vm,"onShow",b||[]),Y.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===X.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,X.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),X.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onHide"),X.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),X.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onShow"),Y.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),X.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),X.delegateRun(a.__vm,"onShow"),X.delegateRun(a.__vm,"onFocus",[],200),Y.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(),Y.runHook("screen-pre-start",[a.screenName(),a]),X.delegateRun(a,"onStart"),Y.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(){eb.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=X.isUnd(c)?!1:!!c,(X.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},bb=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=V.EmailType.Facebook),null===this.privateType&&(this.privateType=V.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=X.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=X.trim(a.Name),this.email=X.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=X.isUnd(b)?!1:!!b,c=X.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+X.encodeHtml(this.name)+"":c?X.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=X.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+X.encodeHtml(d)+""+X.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=X.encodeHtml(d))):b&&(d=''+X.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=X.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=ib.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),X.delegateRun(e,"onBuild",[i])):X.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(X.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),X.delegateRun(d.oCurrentSubScreen,"onShow"),X.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)),X.windowResize()})):bb.setHash(ib.link().settings(),!1,!0)},P.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(X.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},P.prototype.onBuild=function(){f.each(_.settings,function(a){a&&a.__rlSettingsData&&!f.find(_["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(_["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},P.prototype.routes=function(){var a=f.find(_.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=X.isUnd(c.subname)?b:X.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(Q.prototype,m.prototype),Q.prototype.onShow=function(){ib.setTitle("")},f.extend(R.prototype,P.prototype),R.prototype.onShow=function(){ib.setTitle("")},f.extend(S.prototype,k.prototype),S.prototype.oSettings=null,S.prototype.oPlugins=null,S.prototype.oLocal=null,S.prototype.oLink=null,S.prototype.oSubs={},S.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):($.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},S.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},S.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},S.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=X.isNormal(cb)?cb:{}),X.isUnd(this.oSettings[a])?null:this.oSettings[a]},S.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=X.isNormal(cb)?cb:{}),this.oSettings[a]=b},S.prototype.setTitle=function(b){b=(X.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=X.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=X.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=X.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 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(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser=c.observable(""),this.priority=c.observable(Ab.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 B(){this.name=c.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.interval=0,this.selectable=!1,this.existen=!0,this.type=c.observable(Ab.FolderType.User),this.focused=c.observable(!1),this.selected=c.observable(!1),this.edited=c.observable(!1),this.collapsed=c.observable(!0),this.subScribed=c.observable(!0),this.subFolders=c.observableArray([]),this.deleteAccess=c.observable(!1),this.actionBlink=c.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=c.observable(""),this.name.subscribe(function(a){this.nameForEdit(a)},this),this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function C(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function D(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 E(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 F(){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 Cb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=Cb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Pb.data().message(null),Pb.data().messageList([]),this.clearingProcess(!0),Pb.cache().setFolderHash(b.fullNameRaw,""),Pb.remote().folderClear(function(b,c){a.clearingProcess(!1),Ab.StorageResultType.Success===b&&c&&c.Result?(Pb.reloadMessageList(!0),a.cancelCommand()):a.clearingError(c&&c.ErrorCode?Cb.getNotification(c.ErrorCode):Cb.getNotification(Ab.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),t.constructorEnd(this)}function G(){r.call(this,"Popups","PopupsFolderCreate"),Cb.initOnStartOrLangChange(function(){this.sNoParentText=Cb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(zb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Pb.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)}),Pb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=Cb.createCommand(this,function(){var a=Pb.data(),b=this.selectedParentValue();""===b&&1 =a?1:a},this),this.contactsPagenator=c.computed(Cb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewProperties=c.observableArray([]),this.viewTags=c.observable(""),this.viewTags.visibility=c.observable(!1),this.viewTags.focusTrigger=c.observable(!1),this.viewTags.focusTrigger.subscribe(function(a){a||""!==this.viewTags()?a&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=c.observable(Ab.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1 a)break;b[0]&&b[1]&&b[2]&&b[1]===b[2]&&("PRIVATE"===b[1]?e.privateKeys.importKey(b[0]):"PUBLIC"===b[1]&&e.publicKeys.importKey(b[0])),a--}return e.store(),Pb.reloadOpenPgpKeys(),Cb.delegateRun(this,"cancelCommand"),!0}),t.constructorEnd(this)}function N(){r.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=c.observable(""),this.keyDom=c.observable(null),t.constructorEnd(this)}function O(){r.call(this,"Popups","PopupsGenerateNewOpenPgpKey"),this.email=c.observable(""),this.email.focus=c.observable(""),this.email.error=c.observable(!1),this.name=c.observable(""),this.password=c.observable(""),this.keyBitLength=c.observable(2048),this.submitRequest=c.observable(!1),this.email.subscribe(function(){this.email.error(!1)},this),this.generateOpenPgpKeyCommand=Cb.createCommand(this,function(){var b=this,c="",d=null,e=Pb.data().openpgpKeyring;return this.email.error(""===Cb.trim(this.email())),!e||this.email.error()?!1:(c=this.email(),""!==this.name()&&(c=this.name()+" <"+c+">"),this.submitRequest(!0),h.delay(function(){d=a.openpgp.generateKeyPair(1,Cb.pInt(b.keyBitLength()),c,Cb.trim(b.password())),d&&d.privateKeyArmored&&(e.privateKeys.importKey(d.privateKeyArmored),e.publicKeys.importKey(d.publicKeyArmored),e.store(),Pb.reloadOpenPgpKeys(),Cb.delegateRun(b,"cancelCommand")),b.submitRequest(!1)},100),!0)}),t.constructorEnd(this)}function P(){r.call(this,"Popups","PopupsComposeOpenPgp"),this.notification=c.observable(""),this.sign=c.observable(!0),this.encrypt=c.observable(!0),this.password=c.observable(""),this.password.focus=c.observable(!1),this.buttonFocus=c.observable(!1),this.from=c.observable(""),this.to=c.observableArray([]),this.text=c.observable(""),this.resultCallback=null,this.submitRequest=c.observable(!1),this.doCommand=Cb.createCommand(this,function(){var b=this,c=!0,d=Pb.data(),e=null,f=[];this.submitRequest(!0),c&&this.sign()&&""===this.from()&&(this.notification(Cb.i18n("PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL")),c=!1),c&&this.sign()&&(e=d.findPrivateKeyByEmail(this.from(),this.password()),e||(this.notification(Cb.i18n("PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR",{EMAIL:this.from()})),c=!1)),c&&this.encrypt()&&0===this.to().length&&(this.notification(Cb.i18n("PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT")),c=!1),c&&this.encrypt()&&(f=[],h.each(this.to(),function(a){var e=d.findPublicKeysByEmail(a);0===e.length&&c&&(b.notification(Cb.i18n("PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR",{EMAIL:a})),c=!1),f=f.concat(e)}),!c||0!==f.length&&this.to().length===f.length||(c=!1)),h.delay(function(){if(b.resultCallback&&c)try{e&&0===f.length?b.resultCallback(a.openpgp.signClearMessage([e],b.text())):e&&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&&!Cb.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(Ab.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(Ab.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Pb.remote().saveSettings(null,{Theme:c})},this)}function mb(){this.openpgpkeys=Pb.data().openpgpkeys,this.openpgpkeysPublic=Pb.data().openpgpkeysPublic,this.openpgpkeysPrivate=Pb.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 nb(){this.leftPanelDisabled=c.observable(!1),this.useKeyboardShortcuts=c.observable(!0),this.keyScopeReal=c.observable(Ab.KeyState.All),this.keyScopeFake=c.observable(Ab.KeyState.All),this.keyScope=c.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(a){Ab.KeyState.Menu!==a&&(Ab.KeyState.Compose===a?Cb.disableKeyFilter():Cb.restoreKeyFilter(),this.keyScopeFake(a),Fb.dropdownVisibility()&&(a=Ab.KeyState.Menu)),this.keyScopeReal(a)}}),this.keyScopeReal.subscribe(function(a){j.setScope(a)}),this.leftPanelDisabled.subscribe(function(a){Pb.pub("left-panel."+(a?"off":"on"))}),Fb.dropdownVisibility.subscribe(function(a){a?this.keyScope(Ab.KeyState.Menu):Ab.KeyState.Menu===j.getScope()&&this.keyScope(this.keyScopeFake())},this),Cb.initDataConstructorBySettings(this)}function ob(){nb.call(this);var d=function(a){return function(){var b=Pb.cache().getFolderFromCacheList(a());b&&b.type(Ab.FolderType.User)}},e=function(a){return function(b){var c=Pb.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.archiveFolder=c.observable(""),this.sentFolder.subscribe(d(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(d(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(d(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(d(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(d(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(e(Ab.FolderType.SentItems),this),this.draftFolder.subscribe(e(Ab.FolderType.Draft),this),this.spamFolder.subscribe(e(Ab.FolderType.Spam),this),this.trashFolder.subscribe(e(Ab.FolderType.Trash),this),this.archiveFolder.subscribe(e(Ab.FolderType.Archive),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||zb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.enableTwoFactor=c.observable(!1),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.contactTags=c.observableArray([]),this.contacts=c.observableArray([]),this.contacts.loading=c.observable(!1).extend({throttle:200}),this.contacts.importing=c.observable(!1).extend({throttle:200}),this.contacts.syncing=c.observable(!1).extend({throttle:200}),this.contacts.exportingVcf=c.observable(!1).extend({throttle:200}),this.contacts.exportingCsv=c.observable(!1).extend({throttle:200}),this.allowContactsSync=c.observable(!1),this.enableContactsSync=c.observable(!1),this.contactsSyncUrl=c.observable(""),this.contactsSyncUser=c.observable(""),this.contactsSyncPass=c.observable(""),this.allowContactsSync=c.observable(!!Pb.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=c.observable(!!Pb.settingsGet("EnableContactsSync")),this.contactsSyncUrl=c.observable(Pb.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=c.observable(Pb.settingsGet("ContactsSyncUser")),this.contactsSyncPass=c.observable(Pb.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=c.observableArray([]),this.folderList.focused=c.observable(!1),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersChanging=c.computed(function(){var a=this.foldersLoading(),b=this.foldersCreating(),c=this.foldersDeleting(),d=this.foldersRenaming();return a||b||c||d},this),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder(),g=this.archiveFolder(); -return Cb.isArray(b)&&0 =a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Ib.setHash(Pb.link().mailBox(this.currentFolderFullNameHash(),1,Cb.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 A,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.message.focused=c.observable(!1),this.message.subscribe(function(b){b?Ab.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.hideMessageBodies(),Ab.Layout.NoPreview===Pb.data().layout()&&-1 0?Math.ceil(b/a*100):0},this),this.allowOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(a){return!(!a||a.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(a){return!(!a||!a.isPrivate)}),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(Ab.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function pb(){this.oRequests={}}function qb(){pb.call(this),this.oRequests={}}function rb(){this.oEmailsPicsHashes={},this.oServices={},this.bAllowGravatar=!!Pb.settingsGet("AllowGravatar")}function sb(){rb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function tb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function ub(){s.call(this,"login",[V])}function vb(){s.call(this,"mailbox",[X,Z,$,_]),this.oLastRoute={}}function wb(){tb.call(this,[Y,ab,bb]),Cb.initOnStartOrLangChange(function(){this.sSettingsTitle=Cb.i18n("TITLES/SETTINGS")},this,function(){Pb.setTitle(this.sSettingsTitle)})}function xb(){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"),Mb.on("error",function(a){Pb&&a&&a.originalEvent&&a.originalEvent.message&&-1===Cb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Pb.remote().jsError(Cb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Lb.attr("class"),Cb.microtime()-Fb.now)}),Nb.on("keydown",function(a){a&&a.ctrlKey&&Lb.addClass("rl-ctrl-key-pressed")}).on("keyup",function(a){a&&!a.ctrlKey&&Lb.removeClass("rl-ctrl-key-pressed")})}function yb(){xb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=h.debounce(this.messagesMoveTrigger,500),a.setInterval(function(){Pb.pub("interval.30s")},3e4),a.setInterval(function(){Pb.pub("interval.1m")},6e4),a.setInterval(function(){Pb.pub("interval.2m")},12e4),a.setInterval(function(){Pb.pub("interval.3m")},18e4),a.setInterval(function(){Pb.pub("interval.5m")},3e5),a.setInterval(function(){Pb.pub("interval.10m")},6e5),a.setTimeout(function(){a.setInterval(function(){Pb.pub("interval.10m-after5m")},6e5)},3e5),b.wakeUp(function(){Pb.remote().jsVersion(function(b,c){Ab.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Pb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Pb.settingsGet("Version"))},{},36e5)}var zb={},Ab={},Bb={},Cb={},Db={},Eb={},Fb={},Gb={settings:[],"settings-removed":[],"settings-disabled":[]},Hb=[],Ib=null,Jb=a.rainloopAppData||{},Kb=a.rainloopI18N||{},Lb=b("html"),Mb=b(a),Nb=b(a.document),Ob=a.Notification&&a.Notification.requestPermission?a.Notification:null,Pb=null,Qb=b("");Fb.now=(new Date).getTime(),Fb.momentTrigger=c.observable(!0),Fb.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),Fb.langChangeTrigger=c.observable(!0),Fb.iAjaxErrorCount=0,Fb.iTokenErrorCount=0,Fb.iMessageBodyCacheCount=0,Fb.bUnload=!1,Fb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Fb.bIsiOSDevice=-1 /g,">").replace(/"/g,""").replace(/'/g,"'"):""},Cb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Cb.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},Cb.timeOutAction=function(){var b={};return function(c,d,e){Cb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Cb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Cb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Fb.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}}(),Cb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Cb.i18n=function(a,b,c){var d="",e=Cb.isUnd(Kb[a])?Cb.isUnd(c)?a:c:Kb[a];if(!Cb.isUnd(b)&&!Cb.isNull(b))for(d in b)Cb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Cb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Cb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Cb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Cb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Cb.i18n(c)))})})},Cb.i18nToDoc=function(){a.rainloopI18N&&(Kb=a.rainloopI18N||{},Cb.i18nToNode(Nb),Fb.langChangeTrigger(!Fb.langChangeTrigger())),a.rainloopI18N={}},Cb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Fb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Fb.langChangeTrigger.subscribe(a,b)},Cb.inFocus=function(){return document.activeElement?(Cb.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=b(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},Cb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);a.is("input,textarea")&&document.activeElement.blur()}},Cb.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()},Cb.replySubjectAdd=function(b,c,d){var e=null,f=Cb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Cb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Cb.isUnd(e[1])||Cb.isUnd(e[2])||Cb.isUnd(e[3])?b+": "+c:e[1]+(Cb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Cb.isUnd(d)?!0:d)?Cb.fixLongSubject(f):f},Cb.fixLongSubject=function(a){var b=0,c=null;a=Cb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Cb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Cb.isUnd(c[2])?1:0+Cb.pInt(c[2]),b+=Cb.isUnd(c[4])?1:0+Cb.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]+/," ")},Cb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Cb.friendlySize=function(a){return a=Cb.pInt(a),a>=1073741824?Cb.roundNumber(a/1073741824,1)+"GB":a>=1048576?Cb.roundNumber(a/1048576,1)+"MB":a>=1024?Cb.roundNumber(a/1024,0)+"KB":a+"B"},Cb.log=function(b){a.console&&a.console.log&&a.console.log(b)},Cb.getNotification=function(a,b){return a=Cb.pInt(a),Ab.Notification.ClientViewError===a&&b?b:Cb.isUnd(Bb[a])?"":Bb[a]},Cb.initNotificationLanguage=function(){Bb[Ab.Notification.InvalidToken]=Cb.i18n("NOTIFICATIONS/INVALID_TOKEN"),Bb[Ab.Notification.AuthError]=Cb.i18n("NOTIFICATIONS/AUTH_ERROR"),Bb[Ab.Notification.AccessError]=Cb.i18n("NOTIFICATIONS/ACCESS_ERROR"),Bb[Ab.Notification.ConnectionError]=Cb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Bb[Ab.Notification.CaptchaError]=Cb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Bb[Ab.Notification.SocialFacebookLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.SocialTwitterLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.SocialGoogleLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.DomainNotAllowed]=Cb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Bb[Ab.Notification.AccountNotAllowed]=Cb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Bb[Ab.Notification.AccountTwoFactorAuthRequired]=Cb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Bb[Ab.Notification.AccountTwoFactorAuthError]=Cb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Bb[Ab.Notification.CouldNotSaveNewPassword]=Cb.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Bb[Ab.Notification.CurrentPasswordIncorrect]=Cb.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Bb[Ab.Notification.NewPasswordShort]=Cb.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Bb[Ab.Notification.NewPasswordWeak]=Cb.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Bb[Ab.Notification.NewPasswordForbidden]=Cb.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Bb[Ab.Notification.ContactsSyncError]=Cb.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Bb[Ab.Notification.CantGetMessageList]=Cb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Bb[Ab.Notification.CantGetMessage]=Cb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Bb[Ab.Notification.CantDeleteMessage]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Bb[Ab.Notification.CantMoveMessage]=Cb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Bb[Ab.Notification.CantCopyMessage]=Cb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Bb[Ab.Notification.CantSaveMessage]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Bb[Ab.Notification.CantSendMessage]=Cb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Bb[Ab.Notification.InvalidRecipients]=Cb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Bb[Ab.Notification.CantCreateFolder]=Cb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Bb[Ab.Notification.CantRenameFolder]=Cb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Bb[Ab.Notification.CantDeleteFolder]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Bb[Ab.Notification.CantDeleteNonEmptyFolder]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Bb[Ab.Notification.CantSubscribeFolder]=Cb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Bb[Ab.Notification.CantUnsubscribeFolder]=Cb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Bb[Ab.Notification.CantSaveSettings]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Bb[Ab.Notification.CantSavePluginSettings]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Bb[Ab.Notification.DomainAlreadyExists]=Cb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Bb[Ab.Notification.CantInstallPackage]=Cb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Bb[Ab.Notification.CantDeletePackage]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Bb[Ab.Notification.InvalidPluginPackage]=Cb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Bb[Ab.Notification.UnsupportedPluginPackage]=Cb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Bb[Ab.Notification.LicensingServerIsUnavailable]=Cb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Bb[Ab.Notification.LicensingExpired]=Cb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Bb[Ab.Notification.LicensingBanned]=Cb.i18n("NOTIFICATIONS/LICENSING_BANNED"),Bb[Ab.Notification.DemoSendMessageError]=Cb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Bb[Ab.Notification.AccountAlreadyExists]=Cb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Bb[Ab.Notification.MailServerError]=Cb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Bb[Ab.Notification.UnknownNotification]=Cb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Bb[Ab.Notification.UnknownError]=Cb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Cb.getUploadErrorDescByCode=function(a){var b="";switch(Cb.pInt(a)){case Ab.UploadErrorCode.FileIsTooBig:b=Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Ab.UploadErrorCode.FilePartiallyUploaded:b=Cb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Ab.UploadErrorCode.FileNoUploaded:b=Cb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Ab.UploadErrorCode.MissingTempFolder:b=Cb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Ab.UploadErrorCode.FileOnSaveingError:b=Cb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Ab.UploadErrorCode.FileType:b=Cb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Cb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Cb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Cb.pInt(d),0>=d?a[b].apply(a,Cb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Cb.isArray(c)?c:[])},d))},Cb.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===Ab.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===Ab.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Cb.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=Cb.isUnd(d)?!0:d,e.canExecute=c.computed(Cb.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},Cb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(Ab.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(Ab.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Fb.sAnimationType=Ab.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(Ab.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return Ab.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Fb.bMobileDevice||a===Ab.InterfaceAnimation.None)Lb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Fb.sAnimationType=Ab.InterfaceAnimation.None;else switch(a){case Ab.InterfaceAnimation.Full:Lb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Fb.sAnimationType=a;break;case Ab.InterfaceAnimation.Normal:Lb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Fb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=Ab.DesktopNotifications.NotSupported;if(Ob&&Ob.permission)switch(Ob.permission.toLowerCase()){case"granted":c=Ab.DesktopNotifications.Allowed;break;case"denied":c=Ab.DesktopNotifications.Denied;break;case"default":c=Ab.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&Ab.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();Ab.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):Ab.DesktopNotifications.NotAllowed===c?Ob.requestPermission(function(){b.desktopNotifications.valueHasMutated(),Ab.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")?Cb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Cb.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},Cb.isFolderExpanded=function(a){var b=Pb.local().get(Ab.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Cb.setExpandedFolder=function(a,b){var c=Pb.local().get(Ab.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Pb.local().set(Ab.ClientSideKeyName.ExpandedFolders,c)},Cb.initLayoutResizer=function(a,c,d){var e=60,f=155,g=b(a),h=b(c),i=Pb.local().get(d)||null,j=function(a){a&&(g.css({width:""+a+"px"}),h.css({left:""+a+"px"}))},k=function(a){if(a)g.resizable("disable"),j(e);else{g.resizable("enable");var b=Cb.pInt(Pb.local().get(d))||f;j(b>f?b:f)}},l=function(a,b){b&&b.size&&b.size.width&&(Pb.local().set(d,b.size.width),h.css({left:""+b.size.width+"px"}))};null!==i&&j(i>f?i:f),g.resizable({helper:"ui-resizable-helper",minWidth:f,maxWidth:350,handles:"e",stop:l}),Pb.sub("left-panel.off",function(){k(!0)}),Pb.sub("left-panel.on",function(){k(!1)})},Cb.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"),Cb.windowResize()}).after("
").before("
"))})}},Cb.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()}))},Cb.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},Cb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,Db.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Cb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Gb.settings.push(a)},Cb.removeSettingsViewModel=function(a){Gb["settings-removed"].push(a)},Cb.disableSettingsViewModel=function(a){Gb["settings-disabled"].push(a)},Cb.convertThemeName=function(a){return"@custom"===a.substr(-7)&&(a=Cb.trim(a.substring(0,a.length-7))),Cb.trim(a.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Cb.quoteName=function(a){return a.replace(/["]/g,'\\"')},Cb.microtime=function(){return(new Date).getTime()},Cb.convertLangName=function(a,b){return Cb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},Cb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Cb.isUnd(a)?32:Cb.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f -}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o /g,">").replace(/")},Cb.draggeblePlace=function(){return b(' ').appendTo("#rl-hidden")},Cb.defautOptionsAfterRender=function(a,c){c&&!Cb.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},Cb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Cb.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")),Cb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+Cb.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)},Cb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Cb.isUnd(d)?1e3:Cb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?Ab.SaveSettingsStep.TrueResult:Ab.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,Ab.SaveSettingsStep.Idle)},d)}},Cb.settingsSaveHelperSimpleFunction=function(a,b){return Cb.settingsSaveHelperFunction(null,a,b,1e3)},Cb.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,"")},Cb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Cb.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},Cb.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:Cb.isUnd(c)?a.toString():c.toString(),custom:Cb.isUnd(c)?!1:!0,title:Cb.isUnd(c)?"":a.toString(),value:a.toString()};(Cb.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}},Cb.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()}},Cb.disableKeyFilter=function(){a.key&&(j.filter=function(){return Pb.data().useKeyboardShortcuts()})},Cb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){if(Pb.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},Cb.detectDropdownVisibility=h.debounce(function(){Fb.dropdownVisibility(!!h.find(Hb,function(a){return a.hasClass("open")}))},50),Eb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Eb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Eb._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Eb._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(!Fb.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Fb.dropdownVisibility()?"":''+Cb.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Fb.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Fb.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Fb.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),Fb.dropdownVisibility.subscribe(function(a){a&&c.tooltip("hide")}),Nb.click(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){Hb.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),Cb.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Cb.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&&!Cb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Fb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){Cb.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Cb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Cb.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=Cb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Cb.pInt(e[2]),g=Mb.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(!Fb.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),Cb.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),Cb.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)},b(d).draggable(k).on("mousedown",function(){Cb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Fb.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){Fb.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(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:f,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Pb.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=Cb.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(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:f,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){Pb.getContactsTagsAutocomplete(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=Cb.trim(a),c=null;return""!==b?(c=new x,c.name(b),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&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(Cb.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},Cb.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=Cb.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=Cb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Cb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Cb.isUnd(a)||""===a||(b+="/"+a),b},k.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},k.prototype.mailBox=function(a,b,c){b=Cb.isNormal(b)?Cb.pInt(b):1,c=Cb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},k.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},k.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=Cb.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Db.oViewModelsHooks={},Db.oSimpleHooks={},Db.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Db.addHook=function(a,b){Cb.isFunc(b)&&(Cb.isArray(Db.oSimpleHooks[a])||(Db.oSimpleHooks[a]=[]),Db.oSimpleHooks[a].push(b))},Db.runHook=function(a,b){Cb.isArray(Db.oSimpleHooks[a])&&(b=b||[],h.each(Db.oSimpleHooks[a],function(a){a.apply(null,b)}))},Db.mainSettingsGet=function(a){return Pb?Pb.settingsGet(a):null},Db.remoteRequest=function(a,b,c,d,e,f){Pb&&Pb.remote().defaultRequest(a,b,c,d,e,f)},Db.settingsGet=function(a,b){var c=Db.mainSettingsGet("Plugins");return c=c&&Cb.isUnd(c[a])?null:c[a],c?Cb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Fb.oHtmlEditorDefaultConfig,d=Pb.settingsGet("Language"),e=!!Pb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Fb.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.itemSelected=function(a){this.isListChecked()?a||(this.oCallbacks.onItemSelect||this.emptyFunction)(a||null):a&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},m.prototype.goDown=function(a){this.newSelectPosition(Ab.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(Ab.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.focusedItem(b),b.checked(!b.checked())))}),j("enter",e,function(){return f.focusedItem()&&!f.focusedItem().selected()?(f.actionClick(f.focusedItem()),!1):!0}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=Ab.EventKeyCode.Up;break;case"down":case"shift+down":c=Ab.EventKeyCode.Down;break;case"insert":c=Ab.EventKeyCode.Insert;break;case"space":c=Ab.EventKeyCode.Space;break;case"home":c=Ab.EventKeyCode.Home;break;case"end":c=Ab.EventKeyCode.End;break;case"pageup":c=Ab.EventKeyCode.PageUp;break;case"pagedown":c=Ab.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(a,b,c){var d=0,e=10,f=!1,g=!1,i=null,j=this.list(),k=j?j.length:0,l=this.focusedItem();if(k>0)if(l){if(l)if(Ab.EventKeyCode.Down===a||Ab.EventKeyCode.Up===a||Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a)h.each(j,function(b){if(!g)switch(a){case Ab.EventKeyCode.Up:l===b?g=!0:i=b;break;case Ab.EventKeyCode.Down:case Ab.EventKeyCode.Insert:f?(i=b,g=!0):l===b&&(f=!0)}});else if(Ab.EventKeyCode.Home===a||Ab.EventKeyCode.End===a)Ab.EventKeyCode.Home===a?i=j[0]:Ab.EventKeyCode.End===a&&(i=j[j.length-1]);else if(Ab.EventKeyCode.PageDown===a){for(;k>d;d++)if(l===j[d]){d+=e,d=d>k-1?k-1:d,i=j[d];break}}else if(Ab.EventKeyCode.PageUp===a)for(d=k;d>=0;d--)if(l===j[d]){d-=e,d=0>d?0:d,i=j[d];break}}else Ab.EventKeyCode.Down===a||Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a||Ab.EventKeyCode.Home===a||Ab.EventKeyCode.PageUp===a?i=j[0]:(Ab.EventKeyCode.Up===a||Ab.EventKeyCode.End===a||Ab.EventKeyCode.PageDown===a)&&(i=j[j.length-1]);i?(this.focusedItem(i),l&&(b?(Ab.EventKeyCode.Up===a||Ab.EventKeyCode.Down===a)&&l.checked(!l.checked()):(Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a)&&l.checked(!l.checked())),!this.bAutoSelect&&!c||this.isListChecked()||Ab.EventKeyCode.Space===a||this.selectedItem(i),this.scrollToFocused()):l&&(!b||Ab.EventKeyCode.Up!==a&&Ab.EventKeyCode.Down!==a?(Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a)&&l.checked(!l.checked()):l.checked(!l.checked()),this.focusedItem(l))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(this.oContentScrollable.scrollTop(d.top<0?this.oContentScrollable.scrollTop()+d.top-a:this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},m.prototype.scrollToTop=function(a){return this.oContentVisible&&this.oContentScrollable?(a?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},m.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},m.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(!b.shiftKey||b.ctrlKey||b.altKey?!b.ctrlKey||b.shiftKey||b.altKey||(c=!1,this.focusedItem(a),this.selectedItem()&&a!==this.selectedItem()&&this.selectedItem().checked(!0),a.checked(!a.checked())):(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b),this.focusedItem(a))),c&&(this.focusedItem(a),this.selectedItem(a))}},m.prototype.on=function(a,b){this.oCallbacks[a]=b},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(zb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(zb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e -},n.prototype.get=function(a){var c=b.cookie(zb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Cb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[zb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[zb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[zb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Cb.isUnd(d[b])?d[b]:null}catch(e){}return d},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Pb.data().keyScope(),Pb.data().keyScope(this.sDefaultKeyScope)},r.prototype.restoreKeyScope=function(){Pb.data().keyScope(this.sCurrentKeyScope)},r.prototype.registerPopupKeyDown=function(){var a=this;Mb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&Ab.EventKeyCode.Esc===b.keyCode)return Cb.delegateRun(a,"cancelCommand"),!1;if(Ab.EventKeyCode.Backspace===b.keyCode&&!Cb.inFocus())return!1}return!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;Cb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Cb.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){Cb.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 Cb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Cb.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=Pb.data(),e.viewModelName=a.__name,g&&1===g.length?(i=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Cb.createCommand(e,function(){Ib.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Pb.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+Pb.popupVisibilityNames().length+10),Cb.delegateRun(this,"onFocus",[],500)):(Cb.delegateRun(this,"onHide"),this.restoreKeyScope(),Pb.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),h.delay(function(){b.viewModelDom.hide()},300))},e)),Db.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),Cb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&e.registerPopupKeyDown(),Db.runHook("view-model-post-build",[a.__name,e,i])):Cb.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),Db.runHook("view-model-on-hide",[a.__name,a.__vm]))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Cb.delegateRun(a.__vm,"onShow",b||[]),Db.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Cb.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,Cb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Cb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Cb.delegateRun(c.oCurrentScreen,"onHide"),Cb.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),Cb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Cb.delegateRun(c.oCurrentScreen,"onShow"),Db.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Cb.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),Cb.delegateRun(a.__vm,"onShow"),Cb.delegateRun(a.__vm,"onFocus",[],200),Db.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(),Db.runHook("screen-pre-start",[a.screenName(),a]),Cb.delegateRun(a,"onStart"),Db.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(){Lb.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=Cb.isUnd(c)?!1:!!c,(Cb.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},Ib=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=Ab.EmailType.Facebook),null===this.privateType&&(this.privateType=Ab.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=Cb.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=Cb.trim(a.Name),this.email=Cb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Cb.isUnd(b)?!1:!!b,c=Cb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Cb.encodeHtml(this.name)+"":c?Cb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Cb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Cb.encodeHtml(d)+""+Cb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Cb.encodeHtml(d))):b&&(d=''+Cb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Cb.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=Pb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Cb.delegateRun(e,"onBuild",[i])):Cb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Cb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Cb.delegateRun(d.oCurrentSubScreen,"onShow"),Cb.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)),Cb.windowResize()})):Ib.setHash(Pb.link().settings(),!1,!0)},tb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Cb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},tb.prototype.onBuild=function(){h.each(Gb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Gb["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(Gb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},tb.prototype.routes=function(){var a=h.find(Gb.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=Cb.isUnd(c.subname)?b:Cb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(ub.prototype,s.prototype),ub.prototype.onShow=function(){Pb.setTitle("")},h.extend(vb.prototype,s.prototype),vb.prototype.oLastRoute={},vb.prototype.setNewTitle=function(){var a=Pb.data().accountEmail(),b=Pb.data().foldersInboxUnreadCount();Pb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Cb.i18n("TITLES/MAILBOX"))},vb.prototype.onShow=function(){this.setNewTitle(),Pb.data().keyScope(Ab.KeyState.MessageList)},vb.prototype.onRoute=function(a,b,c,d){if(Cb.isUnd(d)?1:!d){var e=Pb.data(),f=Pb.cache().getFolderFullNameRaw(a),g=Pb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),Ab.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Pb.reloadMessageList())}else Ab.Layout.NoPreview!==Pb.data().layout()||Pb.data().message()||Pb.historyBack()},vb.prototype.onStart=function(){var a=Pb.data(),b=function(){Cb.windowResize()};(Pb.settingsGet("AllowAdditionalAccounts")||Pb.settingsGet("AllowIdentities"))&&Pb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Pb.folderInformation("INBOX")},1e3),h.delay(function(){Pb.quota()},5e3),h.delay(function(){Pb.remote().appDelayStart(Cb.emptyFunction)},35e3),Lb.toggleClass("rl-no-preview-pane",Ab.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Lb.toggleClass("rl-no-preview-pane",Ab.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},vb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Cb.pString(b[0]),b[1]=Cb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Cb.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]=Cb.pString(b[0]),b[1]=Cb.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(wb.prototype,tb.prototype),wb.prototype.onShow=function(){Pb.setTitle(this.sSettingsTitle),Pb.data().keyScope(Ab.KeyState.Settings)},h.extend(xb.prototype,q.prototype),xb.prototype.oSettings=null,xb.prototype.oPlugins=null,xb.prototype.oLocal=null,xb.prototype.oLink=null,xb.prototype.oSubs={},xb.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):(Fb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},xb.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},xb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},xb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Cb.isNormal(Jb)?Jb:{}),Cb.isUnd(this.oSettings[a])?null:this.oSettings[a]},xb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Cb.isNormal(Jb)?Jb:{}),this.oSettings[a]=b},xb.prototype.setTitle=function(b){b=(Cb.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=Cb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Cb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Cb.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},y.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},A.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Cb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=u.newInstanceFromJson(a[b]),d&&e.push(d);return e},A.replyHelper=function(a,b,c){if(a&&0 d;d++)Cb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},A.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Ab.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(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Ab.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)},A.prototype.computeSenderEmail=function(){var a=Pb.data().sentFolder(),b=Pb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},A.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(Cb.pInt(a.Size)),this.from=A.initEmailsFromJson(a.From),this.to=A.initEmailsFromJson(a.To),this.cc=A.initEmailsFromJson(a.Cc),this.bcc=A.initEmailsFromJson(a.Bcc),this.replyTo=A.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(Cb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(A.emailsToLine(this.from,!0)),this.toEmailsString(A.emailsToLine(this.to,!0)),this.parentUid(Cb.pInt(a.ParentThread)),this.threads(Cb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Cb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},A.prototype.initUpdateByMessageJson=function(a){var b=!1,c=Ab.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Cb.pInt(a.Priority),this.priority(-1 b;b++)d=y.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},A.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Cb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},A.prototype.messageId=function(){return this.sMessageId},A.prototype.inReplyTo=function(){return this.sInReplyTo},A.prototype.references=function(){return this.sReferences},A.prototype.fromAsSingleEmail=function(){return Cb.isArray(this.from)&&this.from[0]?this.from[0].email:""},A.prototype.viewLink=function(){return Pb.link().messageViewLink(this.requestHash)},A.prototype.downloadLink=function(){return Pb.link().messageDownloadLink(this.requestHash)},A.prototype.replyEmails=function(a){var b=[],c=Cb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,c,b),0===b.length&&A.replyHelper(this.from,c,b),b},A.prototype.replyAllEmails=function(a){var b=[],c=[],d=Cb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,d,b),0===b.length&&A.replyHelper(this.from,d,b),A.replyHelper(this.to,d,b),A.replyHelper(this.cc,d,c),[b,c]},A.prototype.textBodyToString=function(){return this.body?this.body.html():""},A.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))})},A.prototype.printMessage=function(){this.viewPopupMessage(!0)},A.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},A.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(Ab.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},A.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Cb.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=Cb.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]}),Mb.resize()),Cb.windowResize(500))},A.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Cb.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=Cb.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]),Cb.windowResize(500)}},A.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),Pb.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())))},A.prototype.storePgpVerifyDataToDom=function(){this.body&&Pb.data().allowOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},A.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=Cb.pString(this.body.data("rl-plain-raw")),Pb.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(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},A.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=Pb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?Ab.SignedVerifyStatus.Unverified:Ab.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0 ').text(j)).html(),Qb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},A.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=Pb.data().findPublicKeysByEmail(g),j=Pb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0 ').text(m)).html(),Qb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},A.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},B.newInstanceFromJson=function(a){var b=new B;return b.initByJson(a)?b.initComputed():null},B.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()&&!a.isSystemFolder()})},this),this.canBeEdited=c.computed(function(){return Ab.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 Ab.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return a&&!b||!this.selectable&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Cb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Cb.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(Ab.FolderType.Inbox===c&&Pb.data().foldersInboxUnreadCount(b),a>0){if(Ab.FolderType.Draft===c)return""+a;if(b>0&&Ab.FolderType.Trash!==c&&Ab.FolderType.Archive!==c&&Ab.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(){Cb.timeOutAction("folder-list-folder-visibility-change",function(){Mb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Fb.langChangeTrigger(); -var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case Ab.FolderType.Inbox:b=Cb.i18n("FOLDER_LIST/INBOX_NAME");break;case Ab.FolderType.SentItems:b=Cb.i18n("FOLDER_LIST/SENT_NAME");break;case Ab.FolderType.Draft:b=Cb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Ab.FolderType.Spam:b=Cb.i18n("FOLDER_LIST/SPAM_NAME");break;case Ab.FolderType.Trash:b=Cb.i18n("FOLDER_LIST/TRASH_NAME");break;case Ab.FolderType.Archive:b=Cb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Fb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case Ab.FolderType.Inbox:a="("+Cb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Ab.FolderType.SentItems:a="("+Cb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Ab.FolderType.Draft:a="("+Cb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Ab.FolderType.Spam:a="("+Cb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Ab.FolderType.Trash:a="("+Cb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Ab.FolderType.Archive:a="("+Cb.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 "},D.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},D.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Cb.quoteName(a)+'" <'+this.email()+">"},E.prototype.index=0,E.prototype.id="",E.prototype.guid="",E.prototype.user="",E.prototype.email="",E.prototype.armor="",E.prototype.isPrivate=!1,Cb.extendAsViewModel("PopupsFolderClearViewModel",F),F.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},F.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Cb.extendAsViewModel("PopupsFolderCreateViewModel",G),G.prototype.sNoParentText="",G.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Cb.trim(a))},G.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},G.prototype.onShow=function(){this.clearPopup()},G.prototype.onFocus=function(){this.folderName.focused(!0)},Cb.extendAsViewModel("PopupsFolderSystemViewModel",H),H.prototype.sChooseOnText="",H.prototype.sUnuseText="",H.prototype.onShow=function(a){var b="";switch(a=Cb.isUnd(a)?Ab.SetSystemFoldersNotification.None:a){case Ab.SetSystemFoldersNotification.Sent:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Ab.SetSystemFoldersNotification.Draft:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Ab.SetSystemFoldersNotification.Spam:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Ab.SetSystemFoldersNotification.Trash:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Ab.SetSystemFoldersNotification.Archive:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Cb.extendAsViewModel("PopupsComposeViewModel",I),I.prototype.openOpenPgpPopup=function(){if(this.allowOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Ib.showScreenPopup(P,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},I.prototype.reloadDraftFolder=function(){var a=Pb.data().draftFolder();""!==a&&(Pb.cache().setFolderHash(a,""),Pb.data().currentFolderFullNameRaw()===a?Pb.reloadMessageList(!0):Pb.folderInformation(a))},I.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[Pb.data().accountEmail()]=Pb.data().accountEmail(),b)switch(a){case Ab.ComposeType.Empty:d=Pb.data().accountEmail();break;case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:case Ab.ComposeType.Forward:case Ab.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case Ab.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Pb.data().accountEmail();return d},I.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},I.prototype.formattedFrom=function(a){var b=Pb.data().displayName(),c=Pb.data().accountEmail();return""===b?c:(Cb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Cb.quoteName(b)+'" <'+c+">"},I.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),Ab.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Cb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&Ab.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Cb.trim(Cb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Cb.getNotification(c&&c.ErrorCode?c.ErrorCode:Ab.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Cb.getNotification(Ab.Notification.CantSendMessage)))),this.reloadDraftFolder()},I.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),Ab.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Pb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Pb.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&&Cb.isNormal(c)&&(v=Cb.isArray(c)&&1===c.length?c[0]:Cb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Cb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Cb.removeBlockquoteSwitcher(l),m=l.html(),w){case Ab.ComposeType.Empty:break;case Ab.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Cb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Cb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.references());break;case Ab.ComposeType.Forward:this.subject(Cb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.ForwardAsAttachment:this.subject(Cb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.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=Cb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case Ab.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=Cb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Cb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case Ab.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m=""+m+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Cb.encodeHtml(j)+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Cb.encodeHtml(k)+"
"+m;break;case Ab.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&Ab.ComposeType.EditAsNew!==w&&Ab.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 Ab.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),Ab.EditorDefaultType.Html!==Pb.data().editorDefaultType()&&a.modeToggle(!1)})):Cb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Cb.isNonEmptyArray(t)&&Pb.remote().messageUploadAttachments(function(a,b){if(Ab.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()},I.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},I.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},I.prototype.tryToClosePopup=function(){var a=this;Ib.showScreenPopup(T,[Cb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Cb.delegateRun(a,"closeCommand")}])},I.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",Ab.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",Ab.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",Ab.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",Ab.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Mb.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",Pb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},I.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},I.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Cb.pInt(Pb.settingsGet("AttachmentLimit")),c=new g({action:Pb.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;Cb.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=Cb.isUnd(d.FileName)?"":d.FileName.toString(),g=Cb.isNormal(d.Size)?Cb.pInt(d.Size):null,h=new z(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(Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Cb.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=Cb.getUploadErrorDescByCode(f):g||(e=Cb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Pb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),Ab.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Cb.getUploadErrorDescByCode(Ab.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},I.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Cb.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(Ab.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:i=h.isLinked;break;case Ab.ComposeType.Forward:case Ab.ComposeType.Draft:case Ab.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new z(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))}}},I.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},I.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Cb.getUploadErrorDescByCode(Ab.UploadErrorCode.FileNoUploaded))},this)},I.prototype.isEmptyForm=function(a){a=Cb.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())},I.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)},I.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},I.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Cb.extendAsViewModel("PopupsContactsViewModel",J),J.prototype.getPropertyPlceholder=function(a){var b="";switch(a){case Ab.ContactPropertyType.LastName:b="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case Ab.ContactPropertyType.FirstName:b="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case Ab.ContactPropertyType.Nick:b="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return b},J.prototype.addNewProperty=function(a,b){this.viewProperties.push(new w(a,b||"","",!0,this.getPropertyPlceholder(a)))},J.prototype.addNewOrFocusProperty=function(a,b){var c=h.find(this.viewProperties(),function(b){return a===b.type()});c?c.focused(!0):this.addNewProperty(a,b)},J.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},J.prototype.addNewEmail=function(){this.addNewProperty(Ab.ContactPropertyType.Email,"Home")},J.prototype.addNewPhone=function(){this.addNewProperty(Ab.ContactPropertyType.Phone,"Mobile")},J.prototype.addNewWeb=function(){this.addNewProperty(Ab.ContactPropertyType.Web)},J.prototype.addNewNickname=function(){this.addNewOrFocusProperty(Ab.ContactPropertyType.Nick)},J.prototype.addNewNotes=function(){this.addNewOrFocusProperty(Ab.ContactPropertyType.Note)},J.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(Ab.ContactPropertyType.Birthday)},J.prototype.exportVcf=function(){Pb.download(Pb.link().exportContactsVcf())},J.prototype.exportCsv=function(){Pb.download(Pb.link().exportContactsCsv())},J.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Pb.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(Cb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},J.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))},J.prototype.deleteSelectedContacts=function(){0 0?d:0),Cb.isNonEmptyArray(c.Result.Tags)&&(f=h.map(c.Result.Tags,function(a){var b=new x;return b.parse(a)?b:null}),f=h.compact(f))),b.contactsCount(d),b.contacts(e),b.contactTags(f),b.contacts.loading(!1),b.viewClearSearch(""!==b.search())},c,zb.Defaults.ContactsPerPage,this.search())},J.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Ab.KeyState.ContactList);var d=this;j("delete",Ab.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Cb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},J.prototype.onShow=function(){Ib.routeOff(),this.reloadContactList(!0)},J.prototype.onHide=function(){Ib.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Cb.extendAsViewModel("PopupsAdvancedSearchViewModel",K),K.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&("tab"===c.shortcut||"right"===c.shortcut),f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f -1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e 1?" ("+(100>a?a:"99+")+")":""},$.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},$.prototype.moveSelectedMessagesToFolder=function(a,b){return this.canBeMoved()&&Pb.moveMessagesToFolder(Pb.data().currentFolderFullNameRaw(),Pb.data().messageListCheckedOrSelectedUidsWithSubMails(),a,b),!1},$.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);var b=Cb.draggeblePlace(),c=Pb.data().messageListCheckedOrSelectedUidsWithSubMails();return b.data("rl-folder",Pb.data().currentFolderFullNameRaw()),b.data("rl-uids",c),b.find(".text").text(""+c.length),h.defer(function(){var a=Pb.data().messageListCheckedOrSelectedUidsWithSubMails();b.data("rl-uids",a),b.find(".text").text(""+a.length)}),b},$.prototype.onMessageResponse=function(a,b,c){var d=Pb.data();d.hideMessageBodies(),d.messageLoading(!1),Ab.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):Ab.StorageResultType.Unload===a?(d.message(null),d.messageError("")):Ab.StorageResultType.Abort!==a&&(d.message(null),d.messageError(Cb.getNotification(b&&b.ErrorCode?b.ErrorCode:Ab.Notification.UnknownError)))},$.prototype.populateMessageBody=function(a){a&&(Pb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Pb.data().messageLoading(!0):Cb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},$.prototype.setAction=function(a,b,c){var d=[],e=null,f=Pb.cache(),g=0;if(Cb.isUnd(c)&&(c=Pb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0 0?100>a?a:"99+":""},_.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},_.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},_.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Pb.remote().sendReadReceiptMessage(Cb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),Cb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),Cb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":Pb.data().accountEmail()})),a.isReadReceipt(!0),Pb.cache().storeMessageFlagsToCache(a),Pb.reloadFlagsCurrentMessageListAndMessageFromCache())},Cb.extendAsViewModel("SettingsMenuViewModel",ab),ab.prototype.link=function(a){return Pb.link().settings(a)},ab.prototype.backToMailBoxClick=function(){Ib.setHash(Pb.link().inbox())},Cb.extendAsViewModel("SettingsPaneViewModel",bb),bb.prototype.onBuild=function(){var a=this;j("esc",Ab.KeyState.Settings,function(){a.backToMailBoxClick()})},bb.prototype.onShow=function(){Pb.data().message(null)},bb.prototype.backToMailBoxClick=function(){Ib.setHash(Pb.link().inbox())},Cb.addSettingsViewModel(cb,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),cb.prototype.toggleLayout=function(){this.layout(Ab.Layout.NoPreview===this.layout()?Ab.Layout.SidePreview:Ab.Layout.NoPreview)},cb.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Pb.data(),d=Cb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(Ab.SaveSettingsStep.Animate),b.ajax({url:Pb.link().langLink(c),dataType:"script",cache:!0}).done(function(){Cb.i18nToDoc(),a.languageTrigger(Ab.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(Ab.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(Ab.SaveSettingsStep.Idle)},1e3)}),Pb.remote().saveSettings(Cb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Pb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){Cb.timeOutAction("SaveDesktopNotifications",function(){Pb.remote().saveSettings(Cb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){Cb.timeOutAction("SaveReplySameFolder",function(){Pb.remote().saveSettings(Cb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Pb.remote().saveSettings(Cb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Pb.remote().saveSettings(Cb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},cb.prototype.onShow=function(){Pb.data().desktopNotifications.valueHasMutated()},cb.prototype.selectLanguage=function(){Ib.showScreenPopup(R)},Cb.addSettingsViewModel(db,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),db.prototype.onBuild=function(){Pb.data().contactsAutosave.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},Cb.addSettingsViewModel(eb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),eb.prototype.addNewAccount=function(){Ib.showScreenPopup(L)},eb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Pb.remote().accountDelete(function(b,c){Ab.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Ib.routeOff(),Ib.setHash(Pb.link().root(),!0),Ib.routeOff(),h.defer(function(){a.location.reload()})):Pb.accountsAndIdentities()},b.email))}},Cb.addSettingsViewModel(fb,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),fb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Pb.data().signature();this.editor=new l(a.signatureDom(),function(){Pb.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)})}},fb.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Pb.data(),c=Cb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=Cb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=Cb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Pb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Pb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Pb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Pb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Cb.addSettingsViewModel(gb,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),gb.prototype.addNewIdentity=function(){Ib.showScreenPopup(Q)},gb.prototype.editIdentity=function(a){Ib.showScreenPopup(Q,[a])},gb.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Pb.remote().identityDelete(function(){Pb.accountsAndIdentities()},a.id))}},gb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Pb.data().signature();this.editor=new l(a.signatureDom(),function(){Pb.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)})}},gb.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=Pb.data(),c=Cb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=Cb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=Cb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Pb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Pb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Pb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Pb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Cb.addSettingsViewModel(hb,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),hb.prototype.showSecret=function(){this.secreting(!0),Pb.remote().showTwoFactorSecret(this.onSecretResult)},hb.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},hb.prototype.createTwoFactor=function(){this.processing(!0),Pb.remote().createTwoFactor(this.onResult)},hb.prototype.enableTwoFactor=function(){this.processing(!0),Pb.remote().enableTwoFactor(this.onResult,this.viewEnable())},hb.prototype.testTwoFactor=function(){Ib.showScreenPopup(S)},hb.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),Pb.remote().clearTwoFactor(this.onResult)},hb.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},hb.prototype.onResult=function(a,b){if(this.processing(!1),this.clearing(!1),Ab.StorageResultType.Success===a&&b&&b.Result?(this.viewUser(Cb.pString(b.Result.User)),this.viewEnable(!!b.Result.Enable),this.twoFactorStatus(!!b.Result.IsSet),this.viewSecret(Cb.pString(b.Result.Secret)),this.viewBackupCodes(Cb.pString(b.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Cb.pString(b.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var c=this;this.viewEnable.subscribe(function(a){this.viewEnable.subs&&Pb.remote().enableTwoFactor(function(a,b){Ab.StorageResultType.Success===a&&b&&b.Result||(c.viewEnable.subs=!1,c.viewEnable(!1),c.viewEnable.subs=!0)},a)},this)}},hb.prototype.onSecretResult=function(a,b){this.secreting(!1),Ab.StorageResultType.Success===a&&b&&b.Result?(this.viewSecret(Cb.pString(b.Result.Secret)),this.viewUrl(Cb.pString(b.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},hb.prototype.onBuild=function(){this.processing(!0),Pb.remote().getTwoFactor(this.onResult)},Cb.addSettingsViewModel(ib,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Cb.addSettingsViewModel(jb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),jb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},jb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),Ab.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(b&&Ab.Notification.CurrentPasswordIncorrect===b.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(Cb.getNotification(b&&b.ErrorCode?b.ErrorCode:Ab.Notification.CouldNotSaveNewPassword)))},Cb.addSettingsViewModel(kb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),kb.prototype.folderEditOnEnter=function(a){var b=a?Cb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,""),Pb.data().foldersRenaming(!0),Pb.remote().folderRename(function(a,b){Pb.data().foldersRenaming(!1),Ab.StorageResultType.Success===a&&b&&b.Result||Pb.data().foldersListError(b&&b.ErrorCode?Cb.getNotification(b.ErrorCode):Cb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Pb.folders()},a.fullNameRaw,b),Pb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},kb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},kb.prototype.onShow=function(){Pb.data().foldersListError("")},kb.prototype.createFolder=function(){Ib.showScreenPopup(G)},kb.prototype.systemFolder=function(){Ib.showScreenPopup(H)},kb.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&&(Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,""),Pb.data().folderList.remove(b),Pb.data().foldersDeleting(!0),Pb.remote().folderDelete(function(a,b){Pb.data().foldersDeleting(!1),Ab.StorageResultType.Success===a&&b&&b.Result||Pb.data().foldersListError(b&&b.ErrorCode?Cb.getNotification(b.ErrorCode):Cb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Pb.folders()},a.fullNameRaw),Pb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 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)))},ob.prototype.populateDataOnStart=function(){nb.prototype.populateDataOnStart.call(this),this.accountEmail(Pb.settingsGet("Email")),this.accountIncLogin(Pb.settingsGet("IncLogin")),this.accountOutLogin(Pb.settingsGet("OutLogin")),this.projectHash(Pb.settingsGet("ProjectHash")),this.displayName(Pb.settingsGet("DisplayName")),this.replyTo(Pb.settingsGet("ReplyTo")),this.signature(Pb.settingsGet("Signature")),this.signatureToAll(!!Pb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Pb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Pb.local().get(Ab.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Pb.settingsGet("RemoteSuggestions"),this.devEmail=Pb.settingsGet("DevEmail"),this.devLogin=Pb.settingsGet("DevLogin"),this.devPassword=Pb.settingsGet("DevPassword")},ob.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Cb.isNormal(c)&&""!==c){if(Cb.isArray(d)&&0 3)i(Pb.link().notificationMailIcon(),Pb.data().accountEmail(),Cb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Pb.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Pb.cache().setFolderUidNext(b,c)}},ob.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=Pb.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Pb.cache().setFolderToCacheList(g,f),Pb.cache().setFolderFullNameRaw(f.fullNameHash,g))),f&&(f.collapsed(!Cb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Pb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Cb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Cb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Cb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},ob.prototype.setFolders=function(a){var b=[],c=!1,d=Pb.data(),e=function(a){return""===a||zb.Values.UnuseOptionValue===a||null!==Pb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])&&(Cb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Pb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Pb.settingsGet("SentFolder")+Pb.settingsGet("DraftFolder")+Pb.settingsGet("SpamFolder")+Pb.settingsGet("TrashFolder")+Pb.settingsGet("ArchiveFolder")+Pb.settingsGet("NullFolder")&&(Pb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Pb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Pb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Pb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Pb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Pb.settingsGet("SentFolder"))),d.draftFolder(e(Pb.settingsGet("DraftFolder"))),d.spamFolder(e(Pb.settingsGet("SpamFolder"))),d.trashFolder(e(Pb.settingsGet("TrashFolder"))),d.archiveFolder(e(Pb.settingsGet("ArchiveFolder"))),c&&Pb.remote().saveSystemFolders(Cb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},ob.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},ob.prototype.getNextFolderNames=function(a){a=Cb.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=Pb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},ob.prototype.removeMessagesFromList=function(a,b,c,d){c=Cb.isNormal(c)?c:"",d=Cb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Cb.pInt(a)});var e=0,f=Pb.data(),g=Pb.cache(),i=f.messageList(),j=Pb.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-1 0&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Fb.iMessageBodyCacheCount),Cb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Cb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Pb.data().allowOpenPGP()&&Cb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Cb.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)),Qb.empty(),k&&n.isPgpSigned()?j=Qb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Qb.append(b('').text(n.plainRaw)).html()),Qb.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(Ab.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(n.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),n.storeDataToDom(),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Cb.initBlockquoteSwitcher(g)),Pb.cache().initMessageFlagsFromCache(n),n.unseen()&&Pb.setMessageSeen(n),Cb.windowResize())},ob.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},ob.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])){var c=Pb.data(),d=Pb.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=Cb.pInt(a.Result.MessageResultCount),j=Cb.pInt(a.Result.Offset),Cb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Pb.cache().getFolderFromCacheList(Cb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Pb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Cb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Cb.isNormal(a.Result.MessageUnseenCount)&&(Cb.pInt(p.messageCountUnread())!==Cb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Pb.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=A.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Pb.cache().initMessageFlagsFromCache(o):Pb.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/"+Eb.urlsafe_encode([b,c,Pb.data().projectHash(),Pb.data().threading()&&Pb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},qb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},qb.prototype.folderInformation=function(a,b,c){var d=!0,e=Pb.cache(),f=[];Cb.isArray(c)&&0 l;l++)q.push({id:e[l][0],name:e[l][1],system:!1,seporator:!1,disabled:!1});for(o=!0,l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&(o&&0 l;l++)n=c[l],(n.subScribed()||!n.existen)&&(h?h.call(null,n):!0)&&(Ab.FolderType.User===n.type()||!j||0 =5?e:20,e=320>=e?e:320,a.setInterval(function(){Pb.contactsSync()},6e4*e+5e3),h.delay(function(){Pb.contactsSync()},5e3),h.delay(function(){Pb.folderInformationMultiply(!0)},500),h.delay(function(){Pb.emailsPicsHashes(),Pb.remote().servicesPics(function(a,b){Ab.StorageResultType.Success===a&&b&&b.Result&&Pb.cache().setServicesData(b.Result)})},2e3),Db.runHook("rl-start-user-screens"),Pb.pub("rl.bootstart-user-screens"),Pb.settingsGet("AccountSignMe")&&a.navigator.registerProtocolHandler&&h.delay(function(){try{a.navigator.registerProtocolHandler("mailto",a.location.protocol+"//"+a.location.host+a.location.pathname+"?mailto&to=%s",""+(Pb.settingsGet("Title")||"RainLoop"))}catch(b){}Pb.settingsGet("MailToEmail")&&Pb.mailToHelper(Pb.settingsGet("MailToEmail"))},500)):(Ib.startScreens([ub]),Db.runHook("rl-start-login-screens"),Pb.pub("rl.bootstart-login-screens")),a.SimplePace&&a.SimplePace.set(100),Fb.bMobileDevice||h.defer(function(){Cb.initLayoutResizer("#rl-left","#rl-right",Ab.ClientSideKeyName.FolderListSize)})},this))):(c=Cb.pString(Pb.settingsGet("CustomLoginLink")),c?(Ib.routeOff(),Ib.setHash(Pb.link().root(),!0),Ib.routeOff(),h.defer(function(){a.location.href=c})):(Ib.hideLoading(),Ib.startScreens([ub]),Db.runHook("rl-start-login-screens"),Pb.pub("rl.bootstart-login-screens"),a.SimplePace&&a.SimplePace.set(100))),f&&(a["rl_"+d+"_google_service"]=function(){Pb.data().googleActions(!0),Pb.socialUsers()}),g&&(a["rl_"+d+"_facebook_service"]=function(){Pb.data().facebookActions(!0),Pb.socialUsers()}),i&&(a["rl_"+d+"_twitter_service"]=function(){Pb.data().twitterActions(!0),Pb.socialUsers()}),Pb.sub("interval.1m",function(){Fb.momentTrigger(!Fb.momentTrigger())}),Db.runHook("rl-start-screens"),Pb.pub("rl.bootstart-end")},Pb=new yb,Lb.addClass(Fb.bMobileDevice?"mobile":"no-mobile"),Mb.keydown(Cb.killCtrlAandS).keyup(Cb.killCtrlAandS),Mb.unload(function(){Fb.bUnload=!0}),Lb.on("click.dropdown.data-api",function(){Cb.detectDropdownVisibility()}),a.rl=a.rl||{},a.rl.addHook=Db.addHook,a.rl.settingsGet=Db.mainSettingsGet,a.rl.remoteRequest=Db.remoteRequest,a.rl.pluginSettingsGet=Db.settingsGet,a.rl.addSettingsViewModel=Cb.addSettingsViewModel,a.rl.createCommand=Cb.createCommand,a.rl.EmailModel=u,a.rl.Enums=Ab,a.__RLBOOT=function(c){b(function(){a.rainloopTEMPLATES&&a.rainloopTEMPLATES[0]?(b("#rl-templates").html(a.rainloopTEMPLATES[0]),h.delay(function(){a.rainloopAppData={},a.rainloopI18N={},a.rainloopTEMPLATES={},Ib.setBoot(Pb).bootstart(),Lb.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):c(!1),a.__RLBOOT=null})},a.SimplePace&&a.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible,key); \ No newline at end of file +!function(a,b,c,d,e,f,g,h,i,j){"use strict";function k(){this.sBase="#/",this.sVersion=Pb.settingsGet("Version"),this.sSpecSuffix=Pb.settingsGet("AuthAccountHash")||"0",this.sServer=(Pb.settingsGet("IndexFile")||"./")+"?"}function l(a,c,d,e){var f=this;f.editor=null,f.iBlurTimer=0,f.fOnBlur=c||null,f.fOnReady=d||null,f.fOnModeChange=e||null,f.$element=b(a),f.init()}function m(a,b,d,e,f,g){this.list=a,this.listChecked=c.computed(function(){return h.filter(this.list(),function(a){return a.checked()})},this).extend({rateLimit:0}),this.isListChecked=c.computed(function(){return 0 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(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser=c.observable(""),this.priority=c.observable(Ab.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 B(){this.name=c.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.interval=0,this.selectable=!1,this.existen=!0,this.type=c.observable(Ab.FolderType.User),this.focused=c.observable(!1),this.selected=c.observable(!1),this.edited=c.observable(!1),this.collapsed=c.observable(!0),this.subScribed=c.observable(!0),this.subFolders=c.observableArray([]),this.deleteAccess=c.observable(!1),this.actionBlink=c.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=c.observable(""),this.name.subscribe(function(a){this.nameForEdit(a)},this),this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function C(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function D(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 E(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 F(){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 Cb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=Cb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Pb.data().message(null),Pb.data().messageList([]),this.clearingProcess(!0),Pb.cache().setFolderHash(b.fullNameRaw,""),Pb.remote().folderClear(function(b,c){a.clearingProcess(!1),Ab.StorageResultType.Success===b&&c&&c.Result?(Pb.reloadMessageList(!0),a.cancelCommand()):c&&c.ErrorCode?a.clearingError(Cb.getNotification(c.ErrorCode)):a.clearingError(Cb.getNotification(Ab.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),t.constructorEnd(this)}function G(){r.call(this,"Popups","PopupsFolderCreate"),Cb.initOnStartOrLangChange(function(){this.sNoParentText=Cb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(zb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Pb.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)}),Pb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=Cb.createCommand(this,function(){var a=Pb.data(),b=this.selectedParentValue();""===b&&1 =a?1:a},this),this.contactsPagenator=c.computed(Cb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewProperties=c.observableArray([]),this.viewTags=c.observable(""),this.viewTags.visibility=c.observable(!1),this.viewTags.focusTrigger=c.observable(!1),this.viewTags.focusTrigger.subscribe(function(a){a||""!==this.viewTags()?a&&this.viewTags.visibility(!0):this.viewTags.visibility(!1)},this),this.viewSaveTrigger=c.observable(Ab.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-1 a)break;b[0]&&b[1]&&b[2]&&b[1]===b[2]&&("PRIVATE"===b[1]?e.privateKeys.importKey(b[0]):"PUBLIC"===b[1]&&e.publicKeys.importKey(b[0])),a--}return e.store(),Pb.reloadOpenPgpKeys(),Cb.delegateRun(this,"cancelCommand"),!0}),t.constructorEnd(this)}function N(){r.call(this,"Popups","PopupsViewOpenPgpKey"),this.key=c.observable(""),this.keyDom=c.observable(null),t.constructorEnd(this)}function O(){r.call(this,"Popups","PopupsGenerateNewOpenPgpKey"),this.email=c.observable(""),this.email.focus=c.observable(""),this.email.error=c.observable(!1),this.name=c.observable(""),this.password=c.observable(""),this.keyBitLength=c.observable(2048),this.submitRequest=c.observable(!1),this.email.subscribe(function(){this.email.error(!1)},this),this.generateOpenPgpKeyCommand=Cb.createCommand(this,function(){var b=this,c="",d=null,e=Pb.data().openpgpKeyring;return this.email.error(""===Cb.trim(this.email())),!e||this.email.error()?!1:(c=this.email(),""!==this.name()&&(c=this.name()+" <"+c+">"),this.submitRequest(!0),h.delay(function(){d=a.openpgp.generateKeyPair(1,Cb.pInt(b.keyBitLength()),c,Cb.trim(b.password())),d&&d.privateKeyArmored&&(e.privateKeys.importKey(d.privateKeyArmored),e.publicKeys.importKey(d.publicKeyArmored),e.store(),Pb.reloadOpenPgpKeys(),Cb.delegateRun(b,"cancelCommand")),b.submitRequest(!1)},100),!0)}),t.constructorEnd(this)}function P(){r.call(this,"Popups","PopupsComposeOpenPgp"),this.notification=c.observable(""),this.sign=c.observable(!0),this.encrypt=c.observable(!0),this.password=c.observable(""),this.password.focus=c.observable(!1),this.buttonFocus=c.observable(!1),this.from=c.observable(""),this.to=c.observableArray([]),this.text=c.observable(""),this.resultCallback=null,this.submitRequest=c.observable(!1),this.doCommand=Cb.createCommand(this,function(){var b=this,c=!0,d=Pb.data(),e=null,f=[];this.submitRequest(!0),c&&this.sign()&&""===this.from()&&(this.notification(Cb.i18n("PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL")),c=!1),c&&this.sign()&&(e=d.findPrivateKeyByEmail(this.from(),this.password()),e||(this.notification(Cb.i18n("PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR",{EMAIL:this.from()})),c=!1)),c&&this.encrypt()&&0===this.to().length&&(this.notification(Cb.i18n("PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT")),c=!1),c&&this.encrypt()&&(f=[],h.each(this.to(),function(a){var e=d.findPublicKeysByEmail(a);0===e.length&&c&&(b.notification(Cb.i18n("PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR",{EMAIL:a})),c=!1),f=f.concat(e)}),!c||0!==f.length&&this.to().length===f.length||(c=!1)),h.delay(function(){if(b.resultCallback&&c)try{e&&0===f.length?b.resultCallback(a.openpgp.signClearMessage([e],b.text())):e&&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&&!Cb.isUnd(f[0].styleSheet.cssText)?f[0].styleSheet.cssText=a[1]:f.text(a[1])),d.themeTrigger(Ab.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(Ab.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Pb.remote().saveSettings(null,{Theme:c})},this)}function mb(){this.openpgpkeys=Pb.data().openpgpkeys,this.openpgpkeysPublic=Pb.data().openpgpkeysPublic,this.openpgpkeysPrivate=Pb.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 nb(){this.leftPanelDisabled=c.observable(!1),this.useKeyboardShortcuts=c.observable(!0),this.keyScopeReal=c.observable(Ab.KeyState.All),this.keyScopeFake=c.observable(Ab.KeyState.All),this.keyScope=c.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(a){Ab.KeyState.Menu!==a&&(Ab.KeyState.Compose===a?Cb.disableKeyFilter():Cb.restoreKeyFilter(),this.keyScopeFake(a),Fb.dropdownVisibility()&&(a=Ab.KeyState.Menu)),this.keyScopeReal(a)}}),this.keyScopeReal.subscribe(function(a){j.setScope(a)}),this.leftPanelDisabled.subscribe(function(a){Pb.pub("left-panel."+(a?"off":"on"))}),Fb.dropdownVisibility.subscribe(function(a){a?this.keyScope(Ab.KeyState.Menu):Ab.KeyState.Menu===j.getScope()&&this.keyScope(this.keyScopeFake())},this),Cb.initDataConstructorBySettings(this)}function ob(){nb.call(this);var d=function(a){return function(){var b=Pb.cache().getFolderFromCacheList(a());b&&b.type(Ab.FolderType.User)}},e=function(a){return function(b){var c=Pb.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.archiveFolder=c.observable(""),this.sentFolder.subscribe(d(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(d(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(d(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(d(this.trashFolder),this,"beforeChange"),this.archiveFolder.subscribe(d(this.archiveFolder),this,"beforeChange"),this.sentFolder.subscribe(e(Ab.FolderType.SentItems),this),this.draftFolder.subscribe(e(Ab.FolderType.Draft),this),this.spamFolder.subscribe(e(Ab.FolderType.Spam),this),this.trashFolder.subscribe(e(Ab.FolderType.Trash),this),this.archiveFolder.subscribe(e(Ab.FolderType.Archive),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||zb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.signatureToAll=c.observable(!1),this.replyTo=c.observable(""),this.enableTwoFactor=c.observable(!1),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.contactTags=c.observableArray([]),this.contacts=c.observableArray([]),this.contacts.loading=c.observable(!1).extend({throttle:200}),this.contacts.importing=c.observable(!1).extend({throttle:200}),this.contacts.syncing=c.observable(!1).extend({throttle:200}),this.contacts.exportingVcf=c.observable(!1).extend({throttle:200}),this.contacts.exportingCsv=c.observable(!1).extend({throttle:200}),this.allowContactsSync=c.observable(!1),this.enableContactsSync=c.observable(!1),this.contactsSyncUrl=c.observable(""),this.contactsSyncUser=c.observable(""),this.contactsSyncPass=c.observable(""),this.allowContactsSync=c.observable(!!Pb.settingsGet("ContactsSyncIsAllowed")),this.enableContactsSync=c.observable(!!Pb.settingsGet("EnableContactsSync")),this.contactsSyncUrl=c.observable(Pb.settingsGet("ContactsSyncUrl")),this.contactsSyncUser=c.observable(Pb.settingsGet("ContactsSyncUser")),this.contactsSyncPass=c.observable(Pb.settingsGet("ContactsSyncPassword")),this.namespace="",this.folderList=c.observableArray([]),this.folderList.focused=c.observable(!1),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersChanging=c.computed(function(){var a=this.foldersLoading(),b=this.foldersCreating(),c=this.foldersDeleting(),d=this.foldersRenaming();return a||b||c||d},this),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder(),g=this.archiveFolder(); +return Cb.isArray(b)&&0 =a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){Ib.setHash(Pb.link().mailBox(this.currentFolderFullNameHash(),1,Cb.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 A,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.message.focused=c.observable(!1),this.message.subscribe(function(b){b?Ab.Layout.NoPreview===this.layout()&&this.message.focused(!0):(this.message.focused(!1),this.hideMessageBodies(),Ab.Layout.NoPreview===Pb.data().layout()&&-1 0?Math.ceil(b/a*100):0},this),this.capaOpenPGP=c.observable(!1),this.openpgpkeys=c.observableArray([]),this.openpgpKeyring=null,this.openpgpkeysPublic=this.openpgpkeys.filter(function(a){return!(!a||a.isPrivate)}),this.openpgpkeysPrivate=this.openpgpkeys.filter(function(a){return!(!a||!a.isPrivate)}),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(Ab.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function pb(){this.oRequests={}}function qb(){pb.call(this),this.oRequests={}}function rb(){this.oEmailsPicsHashes={},this.oServices={},this.bCapaGravatar=Pb.capa(Ab.Capa.Gravatar)}function sb(){rb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function tb(a){s.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function ub(){s.call(this,"login",[V])}function vb(){s.call(this,"mailbox",[X,Z,$,_]),this.oLastRoute={}}function wb(){tb.call(this,[Y,ab,bb]),Cb.initOnStartOrLangChange(function(){this.sSettingsTitle=Cb.i18n("TITLES/SETTINGS")},this,function(){Pb.setTitle(this.sSettingsTitle)})}function xb(){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"),Mb.on("error",function(a){Pb&&a&&a.originalEvent&&a.originalEvent.message&&-1===Cb.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&Pb.remote().jsError(Cb.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",Lb.attr("class"),Cb.microtime()-Fb.now)}),Nb.on("keydown",function(a){a&&a.ctrlKey&&Lb.addClass("rl-ctrl-key-pressed")}).on("keyup",function(a){a&&!a.ctrlKey&&Lb.removeClass("rl-ctrl-key-pressed")})}function yb(){xb.call(this),this.oData=null,this.oRemote=null,this.oCache=null,this.oMoveCache={},this.quotaDebounce=h.debounce(this.quota,3e4),this.moveOrDeleteResponseHelper=h.bind(this.moveOrDeleteResponseHelper,this),this.messagesMoveTrigger=h.debounce(this.messagesMoveTrigger,500),a.setInterval(function(){Pb.pub("interval.30s")},3e4),a.setInterval(function(){Pb.pub("interval.1m")},6e4),a.setInterval(function(){Pb.pub("interval.2m")},12e4),a.setInterval(function(){Pb.pub("interval.3m")},18e4),a.setInterval(function(){Pb.pub("interval.5m")},3e5),a.setInterval(function(){Pb.pub("interval.10m")},6e5),a.setTimeout(function(){a.setInterval(function(){Pb.pub("interval.10m-after5m")},6e5)},3e5),b.wakeUp(function(){Pb.remote().jsVersion(function(b,c){Ab.StorageResultType.Success===b&&c&&!c.Result&&(a.parent&&Pb.settingsGet("InIframe")?a.parent.location.reload():a.location.reload())},Pb.settingsGet("Version"))},{},36e5)}var zb={},Ab={},Bb={},Cb={},Db={},Eb={},Fb={},Gb={settings:[],"settings-removed":[],"settings-disabled":[]},Hb=[],Ib=null,Jb=a.rainloopAppData||{},Kb=a.rainloopI18N||{},Lb=b("html"),Mb=b(a),Nb=b(a.document),Ob=a.Notification&&a.Notification.requestPermission?a.Notification:null,Pb=null,Qb=b("");Fb.now=(new Date).getTime(),Fb.momentTrigger=c.observable(!0),Fb.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),Fb.langChangeTrigger=c.observable(!0),Fb.iAjaxErrorCount=0,Fb.iTokenErrorCount=0,Fb.iMessageBodyCacheCount=0,Fb.bUnload=!1,Fb.sUserAgent=(navigator.userAgent||"").toLowerCase(),Fb.bIsiOSDevice=-1 /g,">").replace(/"/g,""").replace(/'/g,"'"):""},Cb.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=Cb.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},Cb.timeOutAction=function(){var b={};return function(c,d,e){Cb.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),Cb.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),Cb.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Fb.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}}(),Cb.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},Cb.i18n=function(a,b,c){var d="",e=Cb.isUnd(Kb[a])?Cb.isUnd(c)?a:c:Kb[a];if(!Cb.isUnd(b)&&!Cb.isNull(b))for(d in b)Cb.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},Cb.i18nToNode=function(a){h.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(Cb.i18n(c)):(c=a.data("i18n-html"),c&&a.html(Cb.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",Cb.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",Cb.i18n(c)))})})},Cb.i18nToDoc=function(){a.rainloopI18N&&(Kb=a.rainloopI18N||{},Cb.i18nToNode(Nb),Fb.langChangeTrigger(!Fb.langChangeTrigger())),a.rainloopI18N={}},Cb.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Fb.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Fb.langChangeTrigger.subscribe(a,b)},Cb.inFocus=function(){return document.activeElement?(Cb.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=b(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},Cb.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);a.is("input,textarea")&&document.activeElement.blur()}},Cb.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()},Cb.replySubjectAdd=function(b,c,d){var e=null,f=Cb.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||Cb.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||Cb.isUnd(e[1])||Cb.isUnd(e[2])||Cb.isUnd(e[3])?b+": "+c:e[1]+(Cb.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(Cb.isUnd(d)?!0:d)?Cb.fixLongSubject(f):f},Cb.fixLongSubject=function(a){var b=0,c=null;a=Cb.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||Cb.isUnd(c[0]))&&(c=null),c&&(b=0,b+=Cb.isUnd(c[2])?1:0+Cb.pInt(c[2]),b+=Cb.isUnd(c[4])?1:0+Cb.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]+/," ")},Cb.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},Cb.friendlySize=function(a){return a=Cb.pInt(a),a>=1073741824?Cb.roundNumber(a/1073741824,1)+"GB":a>=1048576?Cb.roundNumber(a/1048576,1)+"MB":a>=1024?Cb.roundNumber(a/1024,0)+"KB":a+"B"},Cb.log=function(b){a.console&&a.console.log&&a.console.log(b)},Cb.getNotification=function(a,b){return a=Cb.pInt(a),Ab.Notification.ClientViewError===a&&b?b:Cb.isUnd(Bb[a])?"":Bb[a]},Cb.initNotificationLanguage=function(){Bb[Ab.Notification.InvalidToken]=Cb.i18n("NOTIFICATIONS/INVALID_TOKEN"),Bb[Ab.Notification.AuthError]=Cb.i18n("NOTIFICATIONS/AUTH_ERROR"),Bb[Ab.Notification.AccessError]=Cb.i18n("NOTIFICATIONS/ACCESS_ERROR"),Bb[Ab.Notification.ConnectionError]=Cb.i18n("NOTIFICATIONS/CONNECTION_ERROR"),Bb[Ab.Notification.CaptchaError]=Cb.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),Bb[Ab.Notification.SocialFacebookLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.SocialTwitterLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.SocialGoogleLoginAccessDisable]=Cb.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),Bb[Ab.Notification.DomainNotAllowed]=Cb.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),Bb[Ab.Notification.AccountNotAllowed]=Cb.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),Bb[Ab.Notification.AccountTwoFactorAuthRequired]=Cb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),Bb[Ab.Notification.AccountTwoFactorAuthError]=Cb.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),Bb[Ab.Notification.CouldNotSaveNewPassword]=Cb.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),Bb[Ab.Notification.CurrentPasswordIncorrect]=Cb.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),Bb[Ab.Notification.NewPasswordShort]=Cb.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),Bb[Ab.Notification.NewPasswordWeak]=Cb.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),Bb[Ab.Notification.NewPasswordForbidden]=Cb.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),Bb[Ab.Notification.ContactsSyncError]=Cb.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),Bb[Ab.Notification.CantGetMessageList]=Cb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),Bb[Ab.Notification.CantGetMessage]=Cb.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),Bb[Ab.Notification.CantDeleteMessage]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),Bb[Ab.Notification.CantMoveMessage]=Cb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Bb[Ab.Notification.CantCopyMessage]=Cb.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),Bb[Ab.Notification.CantSaveMessage]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),Bb[Ab.Notification.CantSendMessage]=Cb.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),Bb[Ab.Notification.InvalidRecipients]=Cb.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),Bb[Ab.Notification.CantCreateFolder]=Cb.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),Bb[Ab.Notification.CantRenameFolder]=Cb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),Bb[Ab.Notification.CantDeleteFolder]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),Bb[Ab.Notification.CantDeleteNonEmptyFolder]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),Bb[Ab.Notification.CantSubscribeFolder]=Cb.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),Bb[Ab.Notification.CantUnsubscribeFolder]=Cb.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),Bb[Ab.Notification.CantSaveSettings]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),Bb[Ab.Notification.CantSavePluginSettings]=Cb.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),Bb[Ab.Notification.DomainAlreadyExists]=Cb.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),Bb[Ab.Notification.CantInstallPackage]=Cb.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),Bb[Ab.Notification.CantDeletePackage]=Cb.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),Bb[Ab.Notification.InvalidPluginPackage]=Cb.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),Bb[Ab.Notification.UnsupportedPluginPackage]=Cb.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),Bb[Ab.Notification.LicensingServerIsUnavailable]=Cb.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),Bb[Ab.Notification.LicensingExpired]=Cb.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),Bb[Ab.Notification.LicensingBanned]=Cb.i18n("NOTIFICATIONS/LICENSING_BANNED"),Bb[Ab.Notification.DemoSendMessageError]=Cb.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),Bb[Ab.Notification.AccountAlreadyExists]=Cb.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),Bb[Ab.Notification.MailServerError]=Cb.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),Bb[Ab.Notification.UnknownNotification]=Cb.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),Bb[Ab.Notification.UnknownError]=Cb.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},Cb.getUploadErrorDescByCode=function(a){var b="";switch(Cb.pInt(a)){case Ab.UploadErrorCode.FileIsTooBig:b=Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Ab.UploadErrorCode.FilePartiallyUploaded:b=Cb.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Ab.UploadErrorCode.FileNoUploaded:b=Cb.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Ab.UploadErrorCode.MissingTempFolder:b=Cb.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Ab.UploadErrorCode.FileOnSaveingError:b=Cb.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Ab.UploadErrorCode.FileType:b=Cb.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=Cb.i18n("UPLOAD/ERROR_UNKNOWN")}return b},Cb.delegateRun=function(a,b,c,d){a&&a[b]&&(d=Cb.pInt(d),0>=d?a[b].apply(a,Cb.isArray(c)?c:[]):h.delay(function(){a[b].apply(a,Cb.isArray(c)?c:[])},d))},Cb.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===Ab.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===Ab.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},Cb.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=Cb.isUnd(d)?!0:d,e.canExecute=Cb.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},Cb.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(Ab.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(Ab.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Fb.sAnimationType=Ab.InterfaceAnimation.Full,b.capaThemes=c.observable(!1),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(Ab.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return Ab.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Fb.bMobileDevice||a===Ab.InterfaceAnimation.None)Lb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Fb.sAnimationType=Ab.InterfaceAnimation.None;else switch(a){case Ab.InterfaceAnimation.Full:Lb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Fb.sAnimationType=a;break;case Ab.InterfaceAnimation.Normal:Lb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Fb.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=Ab.DesktopNotifications.NotSupported;if(Ob&&Ob.permission)switch(Ob.permission.toLowerCase()){case"granted":c=Ab.DesktopNotifications.Allowed;break;case"denied":c=Ab.DesktopNotifications.Denied;break;case"default":c=Ab.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&Ab.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();Ab.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):Ab.DesktopNotifications.NotAllowed===c?Ob.requestPermission(function(){b.desktopNotifications.valueHasMutated(),Ab.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")?Cb.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?Cb.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},Cb.isFolderExpanded=function(a){var b=Pb.local().get(Ab.ClientSideKeyName.ExpandedFolders);return h.isArray(b)&&-1!==h.indexOf(b,a)},Cb.setExpandedFolder=function(a,b){var c=Pb.local().get(Ab.ClientSideKeyName.ExpandedFolders);h.isArray(c)||(c=[]),b?(c.push(a),c=h.uniq(c)):c=h.without(c,a),Pb.local().set(Ab.ClientSideKeyName.ExpandedFolders,c)},Cb.initLayoutResizer=function(a,c,d){var e=60,f=155,g=b(a),h=b(c),i=Pb.local().get(d)||null,j=function(a){a&&(g.css({width:""+a+"px"}),h.css({left:""+a+"px"}))},k=function(a){if(a)g.resizable("disable"),j(e);else{g.resizable("enable");var b=Cb.pInt(Pb.local().get(d))||f;j(b>f?b:f)}},l=function(a,b){b&&b.size&&b.size.width&&(Pb.local().set(d,b.size.width),h.css({left:""+b.size.width+"px"}))};null!==i&&j(i>f?i:f),g.resizable({helper:"ui-resizable-helper",minWidth:f,maxWidth:350,handles:"e",stop:l}),Pb.sub("left-panel.off",function(){k(!0)}),Pb.sub("left-panel.on",function(){k(!1)})},Cb.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"),Cb.windowResize()}).after("
").before("
"))})}},Cb.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()}))},Cb.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},Cb.extendAsViewModel=function(a,b,c){b&&(c||(c=r),b.__name=a,Db.regViewModelHook(a,b),h.extend(b.prototype,c.prototype))},Cb.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},Gb.settings.push(a)},Cb.removeSettingsViewModel=function(a){Gb["settings-removed"].push(a)},Cb.disableSettingsViewModel=function(a){Gb["settings-disabled"].push(a)},Cb.convertThemeName=function(a){return"@custom"===a.substr(-7)&&(a=Cb.trim(a.substring(0,a.length-7))),Cb.trim(a.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},Cb.quoteName=function(a){return a.replace(/["]/g,'\\"')},Cb.microtime=function(){return(new Date).getTime()},Cb.convertLangName=function(a,b){return Cb.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},Cb.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=Cb.isUnd(a)?32:Cb.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o /g,">").replace(/")},Cb.draggeblePlace=function(){return b(' ').appendTo("#rl-hidden")},Cb.defautOptionsAfterRender=function(a,c){c&&!Cb.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},Cb.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+Cb.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")),Cb.i18nToNode(d),t.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+Cb.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)},Cb.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=Cb.isUnd(d)?1e3:Cb.pInt(d),function(e,f,g,i,j){b.call(c,f&&f.Result?Ab.SaveSettingsStep.TrueResult:Ab.SaveSettingsStep.FalseResult),a&&a.call(c,e,f,g,i,j),h.delay(function(){b.call(c,Ab.SaveSettingsStep.Idle)},d)}},Cb.settingsSaveHelperSimpleFunction=function(a,b){return Cb.settingsSaveHelperFunction(null,a,b,1e3)},Cb.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,"")},Cb.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},Cb.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},Cb.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:Cb.isUnd(c)?a.toString():c.toString(),custom:Cb.isUnd(c)?!1:!0,title:Cb.isUnd(c)?"":a.toString(),value:a.toString()};(Cb.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}},Cb.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()}},Cb.disableKeyFilter=function(){a.key&&(j.filter=function(){return Pb.data().useKeyboardShortcuts()})},Cb.restoreKeyFilter=function(){a.key&&(j.filter=function(a){if(Pb.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},Cb.detectDropdownVisibility=h.debounce(function(){Fb.dropdownVisibility(!!h.find(Hb,function(a){return a.hasClass("open")}))},50),Eb={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Eb.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Eb._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j >4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Eb._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(!Fb.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Fb.dropdownVisibility()?"":''+Cb.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Fb.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Fb.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Fb.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),Fb.dropdownVisibility.subscribe(function(a){a&&c.tooltip("hide")}),Nb.click(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){Hb.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),Cb.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!Cb.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&&!Cb.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Fb.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){Cb.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){Cb.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),Cb.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=Cb.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=Cb.pInt(e[2]),g=Mb.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(!Fb.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),Cb.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),Cb.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)},b(d).draggable(k).on("mousedown",function(){Cb.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Fb.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){Fb.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(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:f,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){Pb.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=Cb.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(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),f=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:f,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){Pb.getContactsTagsAutocomplete(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=Cb.trim(a),c=null;return""!==b?(c=new x,c.name(b),[c.toLine(!1),c]):[b,null]})},change:h.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&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(Cb.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},Cb.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=Cb.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=Cb.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),Cb.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},k.prototype.root=function(){return this.sBase},k.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},k.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},k.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},k.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},k.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},k.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},k.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},k.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},k.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},k.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},k.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},k.prototype.settings=function(a){var b=this.sBase+"settings";return Cb.isUnd(a)||""===a||(b+="/"+a),b},k.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},k.prototype.mailBox=function(a,b,c){b=Cb.isNormal(b)?Cb.pInt(b):1,c=Cb.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},k.prototype.phpInfo=function(){return this.sServer+"Info"},k.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},k.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},k.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},k.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},k.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},k.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a},k.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=Cb.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},k.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},k.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},k.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},k.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Db.oViewModelsHooks={},Db.oSimpleHooks={},Db.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Db.addHook=function(a,b){Cb.isFunc(b)&&(Cb.isArray(Db.oSimpleHooks[a])||(Db.oSimpleHooks[a]=[]),Db.oSimpleHooks[a].push(b))},Db.runHook=function(a,b){Cb.isArray(Db.oSimpleHooks[a])&&(b=b||[],h.each(Db.oSimpleHooks[a],function(a){a.apply(null,b)}))},Db.mainSettingsGet=function(a){return Pb?Pb.settingsGet(a):null},Db.remoteRequest=function(a,b,c,d,e,f){Pb&&Pb.remote().defaultRequest(a,b,c,d,e,f)},Db.settingsGet=function(a,b){var c=Db.mainSettingsGet("Plugins");return c=c&&Cb.isUnd(c[a])?null:c[a],c?Cb.isUnd(c[b])?null:c[b]:null},l.prototype.blurTrigger=function(){if(this.fOnBlur){var b=this;a.clearTimeout(b.iBlurTimer),b.iBlurTimer=a.setTimeout(function(){b.fOnBlur()},200)}},l.prototype.focusTrigger=function(){this.fOnBlur&&a.clearTimeout(this.iBlurTimer)},l.prototype.isHtml=function(){return this.editor?"wysiwyg"===this.editor.mode:!1},l.prototype.checkDirty=function(){return this.editor?this.editor.checkDirty():!1},l.prototype.resetDirty=function(){this.editor&&this.editor.resetDirty()},l.prototype.getData=function(){return this.editor?"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain?this.editor.__plain.getRawData():this.editor.getData():""},l.prototype.modeToggle=function(a){this.editor&&(a?"plain"===this.editor.mode&&this.editor.setMode("wysiwyg"):"wysiwyg"===this.editor.mode&&this.editor.setMode("plain"))},l.prototype.setHtml=function(a,b){this.editor&&(this.modeToggle(!0),this.editor.setData(a),b&&this.focus())},l.prototype.setPlain=function(a,b){if(this.editor){if(this.modeToggle(!1),"plain"===this.editor.mode&&this.editor.plugins.plain&&this.editor.__plain)return this.editor.__plain.setRawData(a);this.editor.setData(a),b&&this.focus()}},l.prototype.init=function(){if(this.$element&&this.$element[0]){var b=this,c=Fb.oHtmlEditorDefaultConfig,d=Pb.settingsGet("Language"),e=!!Pb.settingsGet("AllowHtmlEditorSourceButton");e&&c.toolbarGroups&&!c.toolbarGroups.__SourceInited&&(c.toolbarGroups.__SourceInited=!0,c.toolbarGroups.push({name:"document",groups:["mode","document","doctools"]})),c.language=Fb.oHtmlEditorLangsMap[d]||"en",b.editor=a.CKEDITOR.appendTo(b.$element[0],c),b.editor.on("key",function(a){return a&&a.data&&9===a.data.keyCode?!1:void 0}),b.editor.on("blur",function(){b.blurTrigger()}),b.editor.on("mode",function(){b.blurTrigger(),b.fOnModeChange&&b.fOnModeChange("plain"!==b.editor.mode)}),b.editor.on("focus",function(){b.focusTrigger()}),b.fOnReady&&b.editor.on("instanceReady",function(){b.editor.setKeystroke(a.CKEDITOR.CTRL+65,"selectAll"),b.fOnReady(),b.__resizable=!0,b.resize()})}},l.prototype.focus=function(){this.editor&&this.editor.focus()},l.prototype.blur=function(){this.editor&&this.editor.focusManager.blur(!0)},l.prototype.resize=function(){this.editor&&this.__resizable&&this.editor.resize(this.$element.width(),this.$element.innerHeight())},l.prototype.clear=function(a){this.setHtml("",a)},m.prototype.itemSelected=function(a){this.isListChecked()?a||(this.oCallbacks.onItemSelect||this.emptyFunction)(a||null):a&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},m.prototype.goDown=function(a){this.newSelectPosition(Ab.EventKeyCode.Down,!1,a)},m.prototype.goUp=function(a){this.newSelectPosition(Ab.EventKeyCode.Up,!1,a)},m.prototype.init=function(a,d,e){if(this.oContentVisible=a,this.oContentScrollable=d,e=e||"all",this.oContentVisible&&this.oContentScrollable){var f=this;b(this.oContentVisible).on("selectstart",function(a){a&&a.preventDefault&&a.preventDefault()}).on("click",this.sItemSelector,function(a){f.actionClick(c.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=c.dataFor(this);b&&(a&&a.shiftKey?f.actionClick(b,a):(f.focusedItem(b),b.checked(!b.checked())))}),j("enter",e,function(){return f.focusedItem()&&!f.focusedItem().selected()?(f.actionClick(f.focusedItem()),!1):!0}),j("ctrl+up, command+up, ctrl+down, command+down",e,function(){return!1}),j("up, shift+up, down, shift+down, home, end, pageup, pagedown, insert, space",e,function(a,b){if(a&&b&&b.shortcut){var c=0;switch(b.shortcut){case"up":case"shift+up":c=Ab.EventKeyCode.Up;break;case"down":case"shift+down":c=Ab.EventKeyCode.Down;break;case"insert":c=Ab.EventKeyCode.Insert;break;case"space":c=Ab.EventKeyCode.Space;break;case"home":c=Ab.EventKeyCode.Home;break;case"end":c=Ab.EventKeyCode.End;break;case"pageup":c=Ab.EventKeyCode.PageUp;break;case"pagedown":c=Ab.EventKeyCode.PageDown}if(c>0)return f.newSelectPosition(c,j.shift),!1}})}},m.prototype.autoSelect=function(a){this.bAutoSelect=!!a},m.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;return c&&a&&(b=c(a)),b.toString()},m.prototype.newSelectPosition=function(a,b,c){var d=0,e=10,f=!1,g=!1,i=null,j=this.list(),k=j?j.length:0,l=this.focusedItem();if(k>0)if(l){if(l)if(Ab.EventKeyCode.Down===a||Ab.EventKeyCode.Up===a||Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a)h.each(j,function(b){if(!g)switch(a){case Ab.EventKeyCode.Up:l===b?g=!0:i=b;break;case Ab.EventKeyCode.Down:case Ab.EventKeyCode.Insert:f?(i=b,g=!0):l===b&&(f=!0)}});else if(Ab.EventKeyCode.Home===a||Ab.EventKeyCode.End===a)Ab.EventKeyCode.Home===a?i=j[0]:Ab.EventKeyCode.End===a&&(i=j[j.length-1]);else if(Ab.EventKeyCode.PageDown===a){for(;k>d;d++)if(l===j[d]){d+=e,d=d>k-1?k-1:d,i=j[d];break}}else if(Ab.EventKeyCode.PageUp===a)for(d=k;d>=0;d--)if(l===j[d]){d-=e,d=0>d?0:d,i=j[d];break}}else Ab.EventKeyCode.Down===a||Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a||Ab.EventKeyCode.Home===a||Ab.EventKeyCode.PageUp===a?i=j[0]:(Ab.EventKeyCode.Up===a||Ab.EventKeyCode.End===a||Ab.EventKeyCode.PageDown===a)&&(i=j[j.length-1]);i?(this.focusedItem(i),l&&(b?(Ab.EventKeyCode.Up===a||Ab.EventKeyCode.Down===a)&&l.checked(!l.checked()):(Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a)&&l.checked(!l.checked())),!this.bAutoSelect&&!c||this.isListChecked()||Ab.EventKeyCode.Space===a||this.selectedItem(i),this.scrollToFocused()):l&&(!b||Ab.EventKeyCode.Up!==a&&Ab.EventKeyCode.Down!==a?(Ab.EventKeyCode.Insert===a||Ab.EventKeyCode.Space===a)&&l.checked(!l.checked()):l.checked(!l.checked()),this.focusedItem(l))},m.prototype.scrollToFocused=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=20,c=b(this.sItemFocusedSelector,this.oContentScrollable),d=c.position(),e=this.oContentVisible.height(),f=c.outerHeight();return d&&(d.top<0||d.top+f>e)?(d.top<0?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-a):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+d.top-e+f+a),!0):!1},m.prototype.scrollToTop=function(a){return this.oContentVisible&&this.oContentScrollable?(a?this.oContentScrollable.scrollTop(0):this.oContentScrollable.stop().animate({scrollTop:0},200),!0):!1},m.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",h=!1,i=!1,j=[],k=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid)for(j=this.list(),k=a.checked(),d=0,e=j.length;e>d;d++)f=j[d],g=this.getItemUid(f),h=!1,(g===this.sLastUid||g===c)&&(h=!0),h&&(i=!i),(i||h)&&f.checked(k);this.sLastUid=""===c?"":c},m.prototype.actionClick=function(a,b){if(a){var c=!0,d=this.getItemUid(a);b&&(!b.shiftKey||b.ctrlKey||b.altKey?!b.ctrlKey||b.shiftKey||b.altKey||(c=!1,this.focusedItem(a),this.selectedItem()&&a!==this.selectedItem()&&this.selectedItem().checked(!0),a.checked(!a.checked())):(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b),this.focusedItem(a))),c&&(this.focusedItem(a),this.selectedItem(a))}},m.prototype.on=function(a,b){this.oCallbacks[a]=b +},n.supported=function(){return!0},n.prototype.set=function(a,c){var d=b.cookie(zb.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(zb.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},n.prototype.get=function(a){var c=b.cookie(zb.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Cb.isUnd(d[a])?d[a]:null}catch(e){}return d},o.supported=function(){return!!a.localStorage},o.prototype.set=function(b,c){var d=a.localStorage[zb.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[zb.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},o.prototype.get=function(b){var c=a.localStorage[zb.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!Cb.isUnd(d[b])?d[b]:null}catch(e){}return d},p.prototype.oDriver=null,p.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},p.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},q.prototype.bootstart=function(){},r.prototype.sPosition="",r.prototype.sTemplate="",r.prototype.viewModelName="",r.prototype.viewModelDom=null,r.prototype.viewModelTemplate=function(){return this.sTemplate},r.prototype.viewModelPosition=function(){return this.sPosition},r.prototype.cancelCommand=r.prototype.closeCommand=function(){},r.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=Pb.data().keyScope(),Pb.data().keyScope(this.sDefaultKeyScope)},r.prototype.restoreKeyScope=function(){Pb.data().keyScope(this.sCurrentKeyScope)},r.prototype.registerPopupKeyDown=function(){var a=this;Mb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&Ab.EventKeyCode.Esc===b.keyCode)return Cb.delegateRun(a,"cancelCommand"),!1;if(Ab.EventKeyCode.Backspace===b.keyCode&&!Cb.inFocus())return!1}return!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;Cb.isNonEmptyArray(a)&&(c=h.bind(this.onRoute||Cb.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){Cb.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 Cb.isNormal(a)&&(this.oBoot=a),this},t.prototype.screen=function(a){return""===a||Cb.isUnd(this.oScreens[a])?null:this.oScreens[a]},t.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=Pb.data(),e.viewModelName=a.__name,g&&1===g.length?(i=b(" ").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),e.viewModelDom=i,a.__dom=i,"Popups"===f&&(e.cancelCommand=e.closeCommand=Cb.createCommand(e,function(){Ib.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),Pb.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+Pb.popupVisibilityNames().length+10),Cb.delegateRun(this,"onFocus",[],500)):(Cb.delegateRun(this,"onHide"),this.restoreKeyScope(),Pb.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),h.delay(function(){b.viewModelDom.hide()},300))},e)),Db.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),Cb.delegateRun(e,"onBuild",[i]),e&&"Popups"===f&&e.registerPopupKeyDown(),Db.runHook("view-model-post-build",[a.__name,e,i])):Cb.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),Db.runHook("view-model-on-hide",[a.__name,a.__vm]))},t.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),Cb.delegateRun(a.__vm,"onShow",b||[]),Db.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},t.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===Cb.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,Cb.isNonEmptyArray(d.viewModels())&&h.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),Cb.delegateRun(d,"onBuild")),h.defer(function(){c.oCurrentScreen&&(Cb.delegateRun(c.oCurrentScreen,"onHide"),Cb.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),Cb.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(Cb.delegateRun(c.oCurrentScreen,"onShow"),Db.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),Cb.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),Cb.delegateRun(a.__vm,"onShow"),Cb.delegateRun(a.__vm,"onFocus",[],200),Db.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(),Db.runHook("screen-pre-start",[a.screenName(),a]),Cb.delegateRun(a,"onStart"),Db.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(){Lb.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=Cb.isUnd(c)?!1:!!c,(Cb.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},Ib=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=Ab.EmailType.Facebook),null===this.privateType&&(this.privateType=Ab.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=Cb.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=Cb.trim(a.Name),this.email=Cb.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},u.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=Cb.isUnd(b)?!1:!!b,c=Cb.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+Cb.encodeHtml(this.name)+"":c?Cb.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=Cb.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+Cb.encodeHtml(d)+""+Cb.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=Cb.encodeHtml(d))):b&&(d=''+Cb.encodeHtml(this.email)+""))),d},u.prototype.mailsoParse=function(a){if(a=Cb.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=Pb.data(),e.viewModelDom=i,e.__rlSettingsData=f.__rlSettingsData,f.__dom=i,f.__builded=!0,f.__vm=e,c.applyBindings(e,i[0]),Cb.delegateRun(e,"onBuild",[i])):Cb.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&h.defer(function(){d.oCurrentSubScreen&&(Cb.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),Cb.delegateRun(d.oCurrentSubScreen,"onShow"),Cb.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)),Cb.windowResize()})):Ib.setHash(Pb.link().settings(),!1,!0)},tb.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(Cb.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},tb.prototype.onBuild=function(){h.each(Gb.settings,function(a){a&&a.__rlSettingsData&&!h.find(Gb["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(Gb["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},tb.prototype.routes=function(){var a=h.find(Gb.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=Cb.isUnd(c.subname)?b:Cb.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},h.extend(ub.prototype,s.prototype),ub.prototype.onShow=function(){Pb.setTitle("")},h.extend(vb.prototype,s.prototype),vb.prototype.oLastRoute={},vb.prototype.setNewTitle=function(){var a=Pb.data().accountEmail(),b=Pb.data().foldersInboxUnreadCount();Pb.setTitle((""===a?"":(b>0?"("+b+") ":" ")+a+" - ")+Cb.i18n("TITLES/MAILBOX"))},vb.prototype.onShow=function(){this.setNewTitle(),Pb.data().keyScope(Ab.KeyState.MessageList)},vb.prototype.onRoute=function(a,b,c,d){if(Cb.isUnd(d)?1:!d){var e=Pb.data(),f=Pb.cache().getFolderFullNameRaw(a),g=Pb.cache().getFolderFromCacheList(f);g&&(e.currentFolder(g).messageListPage(b).messageListSearch(c),Ab.Layout.NoPreview===e.layout()&&e.message()&&(e.message(null),e.messageFullScreenMode(!1)),Pb.reloadMessageList())}else Ab.Layout.NoPreview!==Pb.data().layout()||Pb.data().message()||Pb.historyBack()},vb.prototype.onStart=function(){var a=Pb.data(),b=function(){Cb.windowResize()};(Pb.capa(Ab.Capa.AdditionalAccounts)||Pb.capa(Ab.Capa.AdditionalIdentities))&&Pb.accountsAndIdentities(),h.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&Pb.folderInformation("INBOX")},1e3),h.delay(function(){Pb.quota()},5e3),h.delay(function(){Pb.remote().appDelayStart(Cb.emptyFunction)},35e3),Lb.toggleClass("rl-no-preview-pane",Ab.Layout.NoPreview===a.layout()),a.folderList.subscribe(b),a.messageList.subscribe(b),a.message.subscribe(b),a.layout.subscribe(function(a){Lb.toggleClass("rl-no-preview-pane",Ab.Layout.NoPreview===a)}),a.foldersInboxUnreadCount.subscribe(function(){this.setNewTitle()},this)},vb.prototype.routes=function(){var a=function(){return["Inbox",1,"",!0]},b=function(a,b){return b[0]=Cb.pString(b[0]),b[1]=Cb.pInt(b[1]),b[1]=0>=b[1]?1:b[1],b[2]=Cb.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]=Cb.pString(b[0]),b[1]=Cb.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(wb.prototype,tb.prototype),wb.prototype.onShow=function(){Pb.setTitle(this.sSettingsTitle),Pb.data().keyScope(Ab.KeyState.Settings)},h.extend(xb.prototype,q.prototype),xb.prototype.oSettings=null,xb.prototype.oPlugins=null,xb.prototype.oLocal=null,xb.prototype.oLink=null,xb.prototype.oSubs={},xb.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):(Fb.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},xb.prototype.link=function(){return null===this.oLink&&(this.oLink=new k),this.oLink},xb.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new p),this.oLocal},xb.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=Cb.isNormal(Jb)?Jb:{}),Cb.isUnd(this.oSettings[a])?null:this.oSettings[a]},xb.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=Cb.isNormal(Jb)?Jb:{}),this.oSettings[a]=b},xb.prototype.setTitle=function(b){b=(Cb.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=Cb.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=Cb.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=Cb.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},y.prototype.isImage=function(){return-1 e;e++)d.push(a[e].toLine(b,c));return d.join(", ")},A.initEmailsFromJson=function(a){var b=0,c=0,d=null,e=[];if(Cb.isNonEmptyArray(a))for(b=0,c=a.length;c>b;b++)d=u.newInstanceFromJson(a[b]),d&&e.push(d);return e},A.replyHelper=function(a,b,c){if(a&&0 d;d++)Cb.isUnd(b[a[d].email])&&(b[a[d].email]=!0,c.push(a[d]))},A.prototype.clear=function(){this.folderFullNameRaw="",this.uid="",this.hash="",this.requestHash="",this.subject(""),this.size(0),this.dateTimeStampInUTC(0),this.priority(Ab.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(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser(""),this.priority(Ab.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)},A.prototype.computeSenderEmail=function(){var a=Pb.data().sentFolder(),b=Pb.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())},A.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(Cb.pInt(a.Size)),this.from=A.initEmailsFromJson(a.From),this.to=A.initEmailsFromJson(a.To),this.cc=A.initEmailsFromJson(a.Cc),this.bcc=A.initEmailsFromJson(a.Bcc),this.replyTo=A.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(Cb.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.attachmentsMainType(a.AttachmentsMainType),this.fromEmailString(A.emailsToLine(this.from,!0)),this.toEmailsString(A.emailsToLine(this.to,!0)),this.parentUid(Cb.pInt(a.ParentThread)),this.threads(Cb.isArray(a.Threads)?a.Threads:[]),this.threadsLen(Cb.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0),b},A.prototype.initUpdateByMessageJson=function(a){var b=!1,c=Ab.MessagePriority.Normal;return a&&"Object/Message"===a["@Object"]&&(c=Cb.pInt(a.Priority),this.priority(-1 b;b++)d=y.newInstanceFromJson(a["@Collection"][b]),d&&(""!==d.cidWithOutTags&&0 +$/,""),b=h.find(c,function(b){return a===b.cidWithOutTags})),b||null},A.prototype.findAttachmentByContentLocation=function(a){var b=null,c=this.attachments();return Cb.isNonEmptyArray(c)&&(b=h.find(c,function(b){return a===b.contentLocation})),b||null},A.prototype.messageId=function(){return this.sMessageId},A.prototype.inReplyTo=function(){return this.sInReplyTo},A.prototype.references=function(){return this.sReferences},A.prototype.fromAsSingleEmail=function(){return Cb.isArray(this.from)&&this.from[0]?this.from[0].email:""},A.prototype.viewLink=function(){return Pb.link().messageViewLink(this.requestHash)},A.prototype.downloadLink=function(){return Pb.link().messageDownloadLink(this.requestHash)},A.prototype.replyEmails=function(a){var b=[],c=Cb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,c,b),0===b.length&&A.replyHelper(this.from,c,b),b},A.prototype.replyAllEmails=function(a){var b=[],c=[],d=Cb.isUnd(a)?{}:a;return A.replyHelper(this.replyTo,d,b),0===b.length&&A.replyHelper(this.from,d,b),A.replyHelper(this.to,d,b),A.replyHelper(this.cc,d,c),[b,c]},A.prototype.textBodyToString=function(){return this.body?this.body.html():""},A.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))})},A.prototype.printMessage=function(){this.viewPopupMessage(!0)},A.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid},A.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(Ab.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},A.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=Cb.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=Cb.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]}),Mb.resize()),Cb.windowResize(500))},A.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){this.body.data("rl-init-internal-images",!0),a=Cb.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=Cb.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]),Cb.windowResize(500)}},A.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),Pb.data().capaOpenPGP()&&(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())))},A.prototype.storePgpVerifyDataToDom=function(){this.body&&Pb.data().capaOpenPGP()&&(this.body.data("rl-pgp-verify-status",this.pgpSignedVerifyStatus()),this.body.data("rl-pgp-verify-user",this.pgpSignedVerifyUser()))},A.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=Cb.pString(this.body.data("rl-plain-raw")),Pb.data().capaOpenPGP()?(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(Ab.SignedVerifyStatus.None),this.pgpSignedVerifyUser("")))},A.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=Pb.data().findPublicKeysByEmail(e),g=null,i=null,j="";this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Error),this.pgpSignedVerifyUser("");try{d=a.openpgp.cleartext.readArmored(this.plainRaw),d&&d.getText&&(this.pgpSignedVerifyStatus(f.length?Ab.SignedVerifyStatus.Unverified:Ab.SignedVerifyStatus.UnknownPublicKeys),c=d.verify(f),c&&0 ').text(j)).html(),Qb.empty(),this.replacePlaneTextBody(j)))))}catch(k){}this.storePgpVerifyDataToDom()}},A.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=Pb.data().findPublicKeysByEmail(g),j=Pb.data().findSelfPrivateKey(c),k=null,l=null,m="";this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Error),this.pgpSignedVerifyUser(""),j||this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.UnknownPrivateKey);try{e=a.openpgp.message.readArmored(this.plainRaw),e&&j&&e.decrypt&&(this.pgpSignedVerifyStatus(Ab.SignedVerifyStatus.Unverified),f=e.decrypt(j),f&&(d=f.verify(i),d&&0 ').text(m)).html(),Qb.empty(),this.replacePlaneTextBody(m)))}catch(n){}this.storePgpVerifyDataToDom()}},A.prototype.replacePlaneTextBody=function(a){this.body&&this.body.html(a).addClass("b-text-part plain")},A.prototype.flagHash=function(){return[this.deleted(),this.unseen(),this.flagged(),this.answered(),this.forwarded(),this.isReadReceipt()].join("")},B.newInstanceFromJson=function(a){var b=new B;return b.initByJson(a)?b.initComputed():null},B.prototype.initComputed=function(){return this.hasSubScribedSubfolders=c.computed(function(){return!!h.find(this.subFolders(),function(a){return a.subScribed()&&!a.isSystemFolder()})},this),this.canBeEdited=c.computed(function(){return Ab.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 Ab.FolderType.User!==this.type()},this),this.hidden=c.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return a&&!b||!this.selectable&&!b},this),this.selectableForFolderList=c.computed(function(){return!this.isSystemFolder()&&this.selectable},this),this.messageCountAll=c.computed({read:this.privateMessageCountAll,write:function(a){Cb.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this}),this.messageCountUnread=c.computed({read:this.privateMessageCountUnread,write:function(a){Cb.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(Ab.FolderType.Inbox===c&&Pb.data().foldersInboxUnreadCount(b),a>0){if(Ab.FolderType.Draft===c)return""+a;if(b>0&&Ab.FolderType.Trash!==c&&Ab.FolderType.Archive!==c&&Ab.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(){Cb.timeOutAction("folder-list-folder-visibility-change",function(){Mb.trigger("folder-list-folder-visibility-change")},100)}),this.localName=c.computed(function(){Fb.langChangeTrigger();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case Ab.FolderType.Inbox:b=Cb.i18n("FOLDER_LIST/INBOX_NAME");break;case Ab.FolderType.SentItems:b=Cb.i18n("FOLDER_LIST/SENT_NAME");break;case Ab.FolderType.Draft:b=Cb.i18n("FOLDER_LIST/DRAFTS_NAME");break;case Ab.FolderType.Spam:b=Cb.i18n("FOLDER_LIST/SPAM_NAME");break;case Ab.FolderType.Trash:b=Cb.i18n("FOLDER_LIST/TRASH_NAME");break;case Ab.FolderType.Archive:b=Cb.i18n("FOLDER_LIST/ARCHIVE_NAME")}return b},this),this.manageFolderSystemName=c.computed(function(){Fb.langChangeTrigger();var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case Ab.FolderType.Inbox:a="("+Cb.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case Ab.FolderType.SentItems:a="("+Cb.i18n("FOLDER_LIST/SENT_NAME")+")";break;case Ab.FolderType.Draft:a="("+Cb.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case Ab.FolderType.Spam:a="("+Cb.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case Ab.FolderType.Trash:a="("+Cb.i18n("FOLDER_LIST/TRASH_NAME")+")";break;case Ab.FolderType.Archive:a="("+Cb.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 "},D.prototype.formattedNameForCompose=function(){var a=this.name();return""===a?this.email():a+" ("+this.email()+")"},D.prototype.formattedNameForEmail=function(){var a=this.name();return""===a?this.email():'"'+Cb.quoteName(a)+'" <'+this.email()+">"},E.prototype.index=0,E.prototype.id="",E.prototype.guid="",E.prototype.user="",E.prototype.email="",E.prototype.armor="",E.prototype.isPrivate=!1,Cb.extendAsViewModel("PopupsFolderClearViewModel",F),F.prototype.clearPopup=function(){this.clearingProcess(!1),this.selectedFolder(null)},F.prototype.onShow=function(a){this.clearPopup(),a&&this.selectedFolder(a)},Cb.extendAsViewModel("PopupsFolderCreateViewModel",G),G.prototype.sNoParentText="",G.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(Cb.trim(a))},G.prototype.clearPopup=function(){this.folderName(""),this.selectedParentValue(""),this.folderName.focused(!1)},G.prototype.onShow=function(){this.clearPopup()},G.prototype.onFocus=function(){this.folderName.focused(!0)},Cb.extendAsViewModel("PopupsFolderSystemViewModel",H),H.prototype.sChooseOnText="",H.prototype.sUnuseText="",H.prototype.onShow=function(a){var b="";switch(a=Cb.isUnd(a)?Ab.SetSystemFoldersNotification.None:a){case Ab.SetSystemFoldersNotification.Sent:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case Ab.SetSystemFoldersNotification.Draft:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case Ab.SetSystemFoldersNotification.Spam:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case Ab.SetSystemFoldersNotification.Trash:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH");break;case Ab.SetSystemFoldersNotification.Archive:b=Cb.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE")}this.notification(b)},Cb.extendAsViewModel("PopupsComposeViewModel",I),I.prototype.openOpenPgpPopup=function(){if(this.capaOpenPGP()&&this.oEditor&&!this.oEditor.isHtml()){var a=this;Ib.showScreenPopup(P,[function(b){a.editor(function(a){a.setPlain(b)})},this.oEditor.getData(),this.currentIdentityResultEmail(),this.to(),this.cc(),this.bcc()])}},I.prototype.reloadDraftFolder=function(){var a=Pb.data().draftFolder();""!==a&&(Pb.cache().setFolderHash(a,""),Pb.data().currentFolderFullNameRaw()===a?Pb.reloadMessageList(!0):Pb.folderInformation(a))},I.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.bCapaAdditionalIdentities&&h.each(this.identities(),function(a){c[a.email()]=a.id}),c[Pb.data().accountEmail()]=Pb.data().accountEmail(),b)switch(a){case Ab.ComposeType.Empty:d=Pb.data().accountEmail();break;case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:case Ab.ComposeType.Forward:case Ab.ComposeType.ForwardAsAttachment:h.find(h.union(b.to,b.cc,b.bcc),e);break;case Ab.ComposeType.Draft:h.find(h.union(b.from,b.replyTo),e)}else d=Pb.data().accountEmail();return d},I.prototype.selectIdentity=function(a){a&&this.currentIdentityID(a.optValue)},I.prototype.formattedFrom=function(a){var b=Pb.data().displayName(),c=Pb.data().accountEmail();return""===b?c:(Cb.isUnd(a)?1:!a)?b+" ("+c+")":'"'+Cb.quoteName(b)+'" <'+c+">"},I.prototype.sendMessageResponse=function(b,c){var d=!1,e="";this.sending(!1),Ab.StorageResultType.Success===b&&c&&c.Result&&(d=!0,this.modalVisibility()&&Cb.delegateRun(this,"closeCommand")),this.modalVisibility()&&!d&&(c&&Ab.Notification.CantSaveMessage===c.ErrorCode?(this.sendSuccessButSaveError(!0),a.alert(Cb.trim(Cb.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(e=Cb.getNotification(c&&c.ErrorCode?c.ErrorCode:Ab.Notification.CantSendMessage,c&&c.ErrorMessage?c.ErrorMessage:""),this.sendError(!0),a.alert(e||Cb.getNotification(Ab.Notification.CantSendMessage)))),this.reloadDraftFolder()},I.prototype.saveMessageResponse=function(b,c){var d=!1,e=null;this.saving(!1),Ab.StorageResultType.Success===b&&c&&c.Result&&c.Result.NewFolder&&c.Result.NewUid&&(this.bFromDraft&&(e=Pb.data().message(),e&&this.draftFolder()===e.folderFullNameRaw&&this.draftUid()===e.uid&&Pb.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&&Cb.isNormal(c)&&(v=Cb.isArray(c)&&1===c.length?c[0]:Cb.isArray(c)?null:c),null!==q&&(p[q]=!0,this.currentIdentityID(this.findIdentityIdByMessage(w,v))),this.reset(),Cb.isNonEmptyArray(d)&&this.to(x(d)),""!==w&&v){switch(j=v.fullFormatDateValue(),k=v.subject(),u=v.aDraftInfo,l=b(v.body).clone(),Cb.removeBlockquoteSwitcher(l),m=l.html(),w){case Ab.ComposeType.Empty:break;case Ab.ComposeType.Reply:this.to(x(v.replyEmails(p))),this.subject(Cb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.ReplyAll:o=v.replyAllEmails(p),this.to(x(o[0])),this.cc(x(o[1])),this.subject(Cb.replySubjectAdd("Re",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["reply",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.references());break;case Ab.ComposeType.Forward:this.subject(Cb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.ComposeType.ForwardAsAttachment:this.subject(Cb.replySubjectAdd("Fwd",k)),this.prepearMessageAttachments(v,w),this.aDraftInfo=["forward",v.uid,v.folderFullNameRaw],this.sInReplyTo=v.sMessageId,this.sReferences=Cb.trim(this.sInReplyTo+" "+v.sReferences);break;case Ab.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=Cb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences;break;case Ab.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=Cb.isNonEmptyArray(u)&&3===u.length?u:null,this.sInReplyTo=v.sInReplyTo,this.sReferences=v.sReferences}switch(w){case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:f=v.fromToLine(!1,!0),n=Cb.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:j,EMAIL:f}),m="
"+n+":";break;case Ab.ComposeType.Forward:f=v.fromToLine(!1,!0),g=v.toToLine(!1,!0),i=v.ccToLine(!1,!0),m=""+m+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+f+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+g+(0"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+i:"")+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+Cb.encodeHtml(j)+"
"+Cb.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+Cb.encodeHtml(k)+"
"+m;break;case Ab.ComposeType.ForwardAsAttachment:m=""}s&&""!==r&&Ab.ComposeType.EditAsNew!==w&&Ab.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 Ab.ComposeType.Empty===w?(m=this.convertSignature(r),this.editor(function(a){a.setHtml(m,!1),Ab.EditorDefaultType.Html!==Pb.data().editorDefaultType()&&a.modeToggle(!1)})):Cb.isNonEmptyArray(c)&&h.each(c,function(a){e.addMessageAsAttachment(a)});t=this.getAttachmentsDownloadsForUpload(),Cb.isNonEmptyArray(t)&&Pb.remote().messageUploadAttachments(function(a,b){if(Ab.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()},I.prototype.onFocus=function(){""===this.to()?this.to.focusTrigger(!this.to.focusTrigger()):this.oEditor&&this.oEditor.focus(),this.triggerForResize()},I.prototype.editorResize=function(){this.oEditor&&this.oEditor.resize()},I.prototype.tryToClosePopup=function(){var a=this;Ib.showScreenPopup(T,[Cb.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&Cb.delegateRun(a,"closeCommand")}])},I.prototype.onBuild=function(){this.initUploader();var a=this,c=null;j("ctrl+q, command+q",Ab.KeyState.Compose,function(){return a.identitiesDropdownTrigger(!0),!1}),j("ctrl+s, command+s",Ab.KeyState.Compose,function(){return a.saveCommand(),!1}),j("ctrl+enter, command+enter",Ab.KeyState.Compose,function(){return a.sendCommand(),!1}),j("esc",Ab.KeyState.Compose,function(){return a.tryToClosePopup(),!1}),Mb.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",Pb.settingsGet("DropboxApiKey")),document.body.appendChild(c))},I.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},I.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=Cb.pInt(Pb.settingsGet("AttachmentLimit")),c=new g({action:Pb.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;Cb.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=Cb.isUnd(d.FileName)?"":d.FileName.toString(),g=Cb.isNormal(d.Size)?Cb.pInt(d.Size):null,h=new z(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(Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this)).on("onStart",h.bind(function(b){var c=null;Cb.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=Cb.getUploadErrorDescByCode(f):g||(e=Cb.i18n("UPLOAD/ERROR_UNKNOWN")),h&&(""!==e&&00&&d>0&&f>d?(e.uploading(!1),e.error(Cb.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):(Pb.remote().composeUploadExternals(function(a,b){var c=!1;e.uploading(!1),Ab.StorageResultType.Success===a&&b&&b.Result&&b.Result[e.id]&&(c=!0,e.tempName(b.Result[e.id])),c||e.error(Cb.getUploadErrorDescByCode(Ab.UploadErrorCode.FileNoUploaded))},[a.link]),!0)},I.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,d=Cb.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(Ab.ComposeType.ForwardAsAttachment===b)this.addMessageAsAttachment(a);else for(;f>e;e++){switch(h=d[e],i=!1,b){case Ab.ComposeType.Reply:case Ab.ComposeType.ReplyAll:i=h.isLinked;break;case Ab.ComposeType.Forward:case Ab.ComposeType.Draft:case Ab.ComposeType.EditAsNew:i=!0}i=!0,i&&(g=new z(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))}}},I.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})},I.prototype.setMessageAttachmentFailedDowbloadText=function(){h.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(Cb.getUploadErrorDescByCode(Ab.UploadErrorCode.FileNoUploaded))},this)},I.prototype.isEmptyForm=function(a){a=Cb.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())},I.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)},I.prototype.getAttachmentsDownloadsForUpload=function(){return h.map(h.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})},I.prototype.triggerForResize=function(){this.resizer(!this.resizer()),this.editorResizeThrottle()},Cb.extendAsViewModel("PopupsContactsViewModel",J),J.prototype.getPropertyPlceholder=function(a){var b="";switch(a){case Ab.ContactPropertyType.LastName:b="CONTACTS/PLACEHOLDER_ENTER_LAST_NAME";break;case Ab.ContactPropertyType.FirstName:b="CONTACTS/PLACEHOLDER_ENTER_FIRST_NAME";break;case Ab.ContactPropertyType.Nick:b="CONTACTS/PLACEHOLDER_ENTER_NICK_NAME"}return b},J.prototype.addNewProperty=function(a,b){this.viewProperties.push(new w(a,b||"","",!0,this.getPropertyPlceholder(a)))},J.prototype.addNewOrFocusProperty=function(a,b){var c=h.find(this.viewProperties(),function(b){return a===b.type()});c?c.focused(!0):this.addNewProperty(a,b)},J.prototype.addNewTag=function(){this.viewTags.visibility(!0),this.viewTags.focusTrigger(!0)},J.prototype.addNewEmail=function(){this.addNewProperty(Ab.ContactPropertyType.Email,"Home")},J.prototype.addNewPhone=function(){this.addNewProperty(Ab.ContactPropertyType.Phone,"Mobile")},J.prototype.addNewWeb=function(){this.addNewProperty(Ab.ContactPropertyType.Web)},J.prototype.addNewNickname=function(){this.addNewOrFocusProperty(Ab.ContactPropertyType.Nick)},J.prototype.addNewNotes=function(){this.addNewOrFocusProperty(Ab.ContactPropertyType.Note)},J.prototype.addNewBirthday=function(){this.addNewOrFocusProperty(Ab.ContactPropertyType.Birthday)},J.prototype.exportVcf=function(){Pb.download(Pb.link().exportContactsVcf())},J.prototype.exportCsv=function(){Pb.download(Pb.link().exportContactsCsv())},J.prototype.initUploader=function(){if(this.importUploaderButton()){var b=new g({action:Pb.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(Cb.i18n("CONTACTS/ERROR_IMPORT_FILE"))},this))}},J.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))},J.prototype.deleteSelectedContacts=function(){0 0?d:0),Cb.isNonEmptyArray(c.Result.Tags)&&(f=h.map(c.Result.Tags,function(a){var b=new x;return b.parse(a)?b:null}),f=h.compact(f))),b.contactsCount(d),b.contacts(e),b.contactTags(f),b.contacts.loading(!1),b.viewClearSearch(""!==b.search())},c,zb.Defaults.ContactsPerPage,this.search())},J.prototype.onBuild=function(a){this.oContentVisible=b(".b-list-content",a),this.oContentScrollable=b(".content",this.oContentVisible),this.selector.init(this.oContentVisible,this.oContentScrollable,Ab.KeyState.ContactList);var d=this;j("delete",Ab.KeyState.ContactList,function(){return d.deleteCommand(),!1}),a.on("click",".e-pagenator .e-page",function(){var a=c.dataFor(this);a&&(d.contactsPage(Cb.pInt(a.value)),d.reloadContactList())}),this.initUploader()},J.prototype.onShow=function(){Ib.routeOff(),this.reloadContactList(!0)},J.prototype.onHide=function(){Ib.routeOn(),this.currentContact(null),this.emptySelection(!0),this.search(""),this.contactsCount(0),this.contacts([])},Cb.extendAsViewModel("PopupsAdvancedSearchViewModel",K),K.prototype.buildSearchStringValue=function(a){return-1 li"),e=c&&("tab"===c.shortcut||"right"===c.shortcut),f=d.index(d.filter(".active"));return!e&&f>0?f--:e&&f -1&&g.eq(e).removeClass("focused"),38===f&&e>0?e--:40===f&&e 1?" ("+(100>a?a:"99+")+")":""},$.prototype.cancelSearch=function(){this.mainMessageListSearch(""),this.inputMessageListSearchFocus(!1)},$.prototype.moveSelectedMessagesToFolder=function(a,b){return this.canBeMoved()&&Pb.moveMessagesToFolder(Pb.data().currentFolderFullNameRaw(),Pb.data().messageListCheckedOrSelectedUidsWithSubMails(),a,b),!1},$.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);var b=Cb.draggeblePlace(),c=Pb.data().messageListCheckedOrSelectedUidsWithSubMails();return b.data("rl-folder",Pb.data().currentFolderFullNameRaw()),b.data("rl-uids",c),b.find(".text").text(""+c.length),h.defer(function(){var a=Pb.data().messageListCheckedOrSelectedUidsWithSubMails();b.data("rl-uids",a),b.find(".text").text(""+a.length)}),b},$.prototype.onMessageResponse=function(a,b,c){var d=Pb.data();d.hideMessageBodies(),d.messageLoading(!1),Ab.StorageResultType.Success===a&&b&&b.Result?d.setMessage(b,c):Ab.StorageResultType.Unload===a?(d.message(null),d.messageError("")):Ab.StorageResultType.Abort!==a&&(d.message(null),d.messageError(b&&b.ErrorCode?Cb.getNotification(b.ErrorCode):Cb.getNotification(Ab.Notification.UnknownError)))},$.prototype.populateMessageBody=function(a){a&&(Pb.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?Pb.data().messageLoading(!0):Cb.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))},$.prototype.setAction=function(a,b,c){var d=[],e=null,f=Pb.cache(),g=0;if(Cb.isUnd(c)&&(c=Pb.data().messageListChecked()),d=h.map(c,function(a){return a.uid}),""!==a&&0 0?100>a?a:"99+":""},_.prototype.verifyPgpSignedClearMessage=function(a){a&&a.verifyPgpSignedClearMessage()},_.prototype.decryptPgpEncryptedMessage=function(a){a&&a.decryptPgpEncryptedMessage(this.viewPgpPassword())},_.prototype.readReceipt=function(a){a&&""!==a.readReceipt()&&(Pb.remote().sendReadReceiptMessage(Cb.emptyFunction,a.folderFullNameRaw,a.uid,a.readReceipt(),Cb.i18n("READ_RECEIPT/SUBJECT",{SUBJECT:a.subject()}),Cb.i18n("READ_RECEIPT/BODY",{"READ-RECEIPT":Pb.data().accountEmail()})),a.isReadReceipt(!0),Pb.cache().storeMessageFlagsToCache(a),Pb.reloadFlagsCurrentMessageListAndMessageFromCache())},Cb.extendAsViewModel("SettingsMenuViewModel",ab),ab.prototype.link=function(a){return Pb.link().settings(a)},ab.prototype.backToMailBoxClick=function(){Ib.setHash(Pb.link().inbox())},Cb.extendAsViewModel("SettingsPaneViewModel",bb),bb.prototype.onBuild=function(){var a=this;j("esc",Ab.KeyState.Settings,function(){a.backToMailBoxClick()})},bb.prototype.onShow=function(){Pb.data().message(null)},bb.prototype.backToMailBoxClick=function(){Ib.setHash(Pb.link().inbox())},Cb.addSettingsViewModel(cb,"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0),cb.prototype.toggleLayout=function(){this.layout(Ab.Layout.NoPreview===this.layout()?Ab.Layout.SidePreview:Ab.Layout.NoPreview)},cb.prototype.onBuild=function(){var a=this;h.delay(function(){var c=Pb.data(),d=Cb.settingsSaveHelperSimpleFunction(a.mppTrigger,a);c.language.subscribe(function(c){a.languageTrigger(Ab.SaveSettingsStep.Animate),b.ajax({url:Pb.link().langLink(c),dataType:"script",cache:!0}).done(function(){Cb.i18nToDoc(),a.languageTrigger(Ab.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(Ab.SaveSettingsStep.FalseResult)}).always(function(){h.delay(function(){a.languageTrigger(Ab.SaveSettingsStep.Idle)},1e3)}),Pb.remote().saveSettings(Cb.emptyFunction,{Language:c})}),c.editorDefaultType.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{EditorDefaultType:a})}),c.messagesPerPage.subscribe(function(a){Pb.remote().saveSettings(d,{MPP:a})}),c.showImages.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{ShowImages:a?"1":"0"})}),c.interfaceAnimation.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{InterfaceAnimation:a})}),c.useDesktopNotifications.subscribe(function(a){Cb.timeOutAction("SaveDesktopNotifications",function(){Pb.remote().saveSettings(Cb.emptyFunction,{DesktopNotifications:a?"1":"0"})},3e3)}),c.replySameFolder.subscribe(function(a){Cb.timeOutAction("SaveReplySameFolder",function(){Pb.remote().saveSettings(Cb.emptyFunction,{ReplySameFolder:a?"1":"0"})},3e3)}),c.useThreads.subscribe(function(a){c.messageList([]),Pb.remote().saveSettings(Cb.emptyFunction,{UseThreads:a?"1":"0"})}),c.layout.subscribe(function(a){c.messageList([]),Pb.remote().saveSettings(Cb.emptyFunction,{Layout:a})}),c.useCheckboxesInList.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)},cb.prototype.onShow=function(){Pb.data().desktopNotifications.valueHasMutated()},cb.prototype.selectLanguage=function(){Ib.showScreenPopup(R)},Cb.addSettingsViewModel(db,"SettingsContacts","SETTINGS_LABELS/LABEL_CONTACTS_NAME","contacts"),db.prototype.onBuild=function(){Pb.data().contactsAutosave.subscribe(function(a){Pb.remote().saveSettings(Cb.emptyFunction,{ContactsAutosave:a?"1":"0"})})},Cb.addSettingsViewModel(eb,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts"),eb.prototype.addNewAccount=function(){Ib.showScreenPopup(L)},eb.prototype.deleteAccount=function(b){if(b&&b.deleteAccess()){this.accountForDeletion(null);var c=function(a){return b===a};b&&(this.accounts.remove(c),Pb.remote().accountDelete(function(b,c){Ab.StorageResultType.Success===b&&c&&c.Result&&c.Reload?(Ib.routeOff(),Ib.setHash(Pb.link().root(),!0),Ib.routeOff(),h.defer(function(){a.location.reload()})):Pb.accountsAndIdentities()},b.email))}},Cb.addSettingsViewModel(fb,"SettingsIdentity","SETTINGS_LABELS/LABEL_IDENTITY_NAME","identity"),fb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Pb.data().signature();this.editor=new l(a.signatureDom(),function(){Pb.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)})}},fb.prototype.onBuild=function(){var a=this;h.delay(function(){var b=Pb.data(),c=Cb.settingsSaveHelperSimpleFunction(a.displayNameTrigger,a),d=Cb.settingsSaveHelperSimpleFunction(a.replyTrigger,a),e=Cb.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){Pb.remote().saveSettings(c,{DisplayName:a})}),b.replyTo.subscribe(function(a){Pb.remote().saveSettings(d,{ReplyTo:a})}),b.signature.subscribe(function(a){Pb.remote().saveSettings(e,{Signature:a})}),b.signatureToAll.subscribe(function(a){Pb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Cb.addSettingsViewModel(gb,"SettingsIdentities","SETTINGS_LABELS/LABEL_IDENTITIES_NAME","identities"),gb.prototype.addNewIdentity=function(){Ib.showScreenPopup(Q)},gb.prototype.editIdentity=function(a){Ib.showScreenPopup(Q,[a])},gb.prototype.deleteIdentity=function(a){if(a&&a.deleteAccess()){this.identityForDeletion(null);var b=function(b){return a===b};a&&(this.identities.remove(b),Pb.remote().identityDelete(function(){Pb.accountsAndIdentities()},a.id))}},gb.prototype.onFocus=function(){if(!this.editor&&this.signatureDom()){var a=this,b=Pb.data().signature();this.editor=new l(a.signatureDom(),function(){Pb.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)})}},gb.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=Pb.data(),c=Cb.settingsSaveHelperSimpleFunction(b.displayNameTrigger,b),d=Cb.settingsSaveHelperSimpleFunction(b.replyTrigger,b),e=Cb.settingsSaveHelperSimpleFunction(b.signatureTrigger,b);a.displayName.subscribe(function(a){Pb.remote().saveSettings(c,{DisplayName:a})}),a.replyTo.subscribe(function(a){Pb.remote().saveSettings(d,{ReplyTo:a})}),a.signature.subscribe(function(a){Pb.remote().saveSettings(e,{Signature:a})}),a.signatureToAll.subscribe(function(a){Pb.remote().saveSettings(null,{SignatureToAll:a?"1":"0"})})},50)},Cb.addSettingsViewModel(hb,"SettingsSecurity","SETTINGS_LABELS/LABEL_SECURITY_NAME","security"),hb.prototype.showSecret=function(){this.secreting(!0),Pb.remote().showTwoFactorSecret(this.onSecretResult)},hb.prototype.hideSecret=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},hb.prototype.createTwoFactor=function(){this.processing(!0),Pb.remote().createTwoFactor(this.onResult)},hb.prototype.enableTwoFactor=function(){this.processing(!0),Pb.remote().enableTwoFactor(this.onResult,this.viewEnable())},hb.prototype.testTwoFactor=function(){Ib.showScreenPopup(S)},hb.prototype.clearTwoFactor=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl(""),this.clearing(!0),Pb.remote().clearTwoFactor(this.onResult)},hb.prototype.onShow=function(){this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")},hb.prototype.onResult=function(a,b){if(this.processing(!1),this.clearing(!1),Ab.StorageResultType.Success===a&&b&&b.Result?(this.viewUser(Cb.pString(b.Result.User)),this.viewEnable(!!b.Result.Enable),this.twoFactorStatus(!!b.Result.IsSet),this.viewSecret(Cb.pString(b.Result.Secret)),this.viewBackupCodes(Cb.pString(b.Result.BackupCodes).replace(/[\s]+/g," ")),this.viewUrl(Cb.pString(b.Result.Url))):(this.viewUser(""),this.viewEnable(!1),this.twoFactorStatus(!1),this.viewSecret(""),this.viewBackupCodes(""),this.viewUrl("")),this.bFirst){this.bFirst=!1;var c=this;this.viewEnable.subscribe(function(a){this.viewEnable.subs&&Pb.remote().enableTwoFactor(function(a,b){Ab.StorageResultType.Success===a&&b&&b.Result||(c.viewEnable.subs=!1,c.viewEnable(!1),c.viewEnable.subs=!0)},a)},this)}},hb.prototype.onSecretResult=function(a,b){this.secreting(!1),Ab.StorageResultType.Success===a&&b&&b.Result?(this.viewSecret(Cb.pString(b.Result.Secret)),this.viewUrl(Cb.pString(b.Result.Url))):(this.viewSecret(""),this.viewUrl(""))},hb.prototype.onBuild=function(){this.processing(!0),Pb.remote().getTwoFactor(this.onResult)},Cb.addSettingsViewModel(ib,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social"),Cb.addSettingsViewModel(jb,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password"),jb.prototype.onHide=function(){this.changeProcess(!1),this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.errorDescription(""),this.passwordMismatch(!1),this.currentPassword.error(!1)},jb.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1),this.passwordMismatch(!1),this.errorDescription(""),this.currentPassword.error(!1),Ab.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.newPassword2(""),this.passwordUpdateSuccess(!0),this.currentPassword.error(!1)):(b&&Ab.Notification.CurrentPasswordIncorrect===b.ErrorCode&&this.currentPassword.error(!0),this.passwordUpdateError(!0),this.errorDescription(b&&b.ErrorCode?Cb.getNotification(b.ErrorCode):Cb.getNotification(Ab.Notification.CouldNotSaveNewPassword)))},Cb.addSettingsViewModel(kb,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders"),kb.prototype.folderEditOnEnter=function(a){var b=a?Cb.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,""),Pb.data().foldersRenaming(!0),Pb.remote().folderRename(function(a,b){Pb.data().foldersRenaming(!1),Ab.StorageResultType.Success===a&&b&&b.Result||Pb.data().foldersListError(b&&b.ErrorCode?Cb.getNotification(b.ErrorCode):Cb.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER")),Pb.folders()},a.fullNameRaw,b),Pb.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b)),a.edited(!1)},kb.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)},kb.prototype.onShow=function(){Pb.data().foldersListError("")},kb.prototype.createFolder=function(){Ib.showScreenPopup(G)},kb.prototype.systemFolder=function(){Ib.showScreenPopup(H)},kb.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&&(Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,""),Pb.data().folderList.remove(b),Pb.data().foldersDeleting(!0),Pb.remote().folderDelete(function(a,b){Pb.data().foldersDeleting(!1),Ab.StorageResultType.Success===a&&b&&b.Result||Pb.data().foldersListError(b&&b.ErrorCode?Cb.getNotification(b.ErrorCode):Cb.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER")),Pb.folders()},a.fullNameRaw),Pb.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0 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)))},ob.prototype.populateDataOnStart=function(){nb.prototype.populateDataOnStart.call(this),this.accountEmail(Pb.settingsGet("Email")),this.accountIncLogin(Pb.settingsGet("IncLogin")),this.accountOutLogin(Pb.settingsGet("OutLogin")),this.projectHash(Pb.settingsGet("ProjectHash")),this.displayName(Pb.settingsGet("DisplayName")),this.replyTo(Pb.settingsGet("ReplyTo")),this.signature(Pb.settingsGet("Signature")),this.signatureToAll(!!Pb.settingsGet("SignatureToAll")),this.enableTwoFactor(!!Pb.settingsGet("EnableTwoFactor")),this.lastFoldersHash=Pb.local().get(Ab.ClientSideKeyName.FoldersLashHash)||"",this.remoteSuggestions=!!Pb.settingsGet("RemoteSuggestions"),this.devEmail=Pb.settingsGet("DevEmail"),this.devLogin=Pb.settingsGet("DevLogin"),this.devPassword=Pb.settingsGet("DevPassword")},ob.prototype.initUidNextAndNewMessages=function(b,c,d){if("INBOX"===b&&Cb.isNormal(c)&&""!==c){if(Cb.isArray(d)&&0 3)i(Pb.link().notificationMailIcon(),Pb.data().accountEmail(),Cb.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:g}));else for(;g>f;f++)i(Pb.link().notificationMailIcon(),A.emailsToLine(A.initEmailsFromJson(d[f].From),!1),d[f].Subject)}Pb.cache().setFolderUidNext(b,c)}},ob.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=Pb.cache().getFolderFromCacheList(g),f||(f=B.newInstanceFromJson(e),f&&(Pb.cache().setFolderToCacheList(g,f),Pb.cache().setFolderFullNameRaw(f.fullNameHash,g))),f&&(f.collapsed(!Cb.isFolderExpanded(f.fullNameHash)),e.Extended&&(e.Extended.Hash&&Pb.cache().setFolderHash(f.fullNameRaw,e.Extended.Hash),Cb.isNormal(e.Extended.MessageCount)&&f.messageCountAll(e.Extended.MessageCount),Cb.isNormal(e.Extended.MessageUnseenCount)&&f.messageCountUnread(e.Extended.MessageUnseenCount)),h=e.SubFolders,h&&"Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&Cb.isArray(h["@Collection"])&&f.subFolders(this.folderResponseParseRec(a,h["@Collection"])),i.push(f)));return i},ob.prototype.setFolders=function(a){var b=[],c=!1,d=Pb.data(),e=function(a){return""===a||zb.Values.UnuseOptionValue===a||null!==Pb.cache().getFolderFromCacheList(a)?a:""};a&&a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])&&(Cb.isUnd(a.Result.Namespace)||(d.namespace=a.Result.Namespace),this.threading(!!Pb.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),b=this.folderResponseParseRec(d.namespace,a.Result["@Collection"]),d.folderList(b),a.Result.SystemFolders&&""==""+Pb.settingsGet("SentFolder")+Pb.settingsGet("DraftFolder")+Pb.settingsGet("SpamFolder")+Pb.settingsGet("TrashFolder")+Pb.settingsGet("ArchiveFolder")+Pb.settingsGet("NullFolder")&&(Pb.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),Pb.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),Pb.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),Pb.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),Pb.settingsSet("ArchiveFolder",a.Result.SystemFolders[12]||null),c=!0),d.sentFolder(e(Pb.settingsGet("SentFolder"))),d.draftFolder(e(Pb.settingsGet("DraftFolder"))),d.spamFolder(e(Pb.settingsGet("SpamFolder"))),d.trashFolder(e(Pb.settingsGet("TrashFolder"))),d.archiveFolder(e(Pb.settingsGet("ArchiveFolder"))),c&&Pb.remote().saveSystemFolders(Cb.emptyFunction,{SentFolder:d.sentFolder(),DraftFolder:d.draftFolder(),SpamFolder:d.spamFolder(),TrashFolder:d.trashFolder(),ArchiveFolder:d.archiveFolder(),NullFolder:"NullFolder"}),Pb.local().set(Ab.ClientSideKeyName.FoldersLashHash,a.Result.FoldersHash))},ob.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()},ob.prototype.getNextFolderNames=function(a){a=Cb.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=Pb.cache().getFolderFromCacheList(a[1]);return e&&(e.interval=d,b.push(a[1])),c<=b.length}),h.uniq(b)},ob.prototype.removeMessagesFromList=function(a,b,c,d){c=Cb.isNormal(c)?c:"",d=Cb.isUnd(d)?!1:!!d,b=h.map(b,function(a){return Cb.pInt(a)});var e=0,f=Pb.data(),g=Pb.cache(),i=f.messageList(),j=Pb.cache().getFolderFromCacheList(a),k=""===c?null:g.getFolderFromCacheList(c||""),l=f.currentFolderFullNameRaw(),m=f.message(),n=l===a?h.filter(i,function(a){return a&&-1 0&&j.messageCountUnread(0<=j.messageCountUnread()-e?j.messageCountUnread()-e:0)),k&&(k.messageCountAll(k.messageCountAll()+b.length),e>0&&k.messageCountUnread(k.messageCountUnread()+e),k.actionBlink(!0)),0 ').hide().addClass("rl-cache-class"),g.data("rl-cache-count",++Fb.iMessageBodyCacheCount),Cb.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,g.html(a.Result.Html.toString()).addClass("b-text-part html")):Cb.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,j=a.Result.Plain.toString(),(n.isPgpSigned()||n.isPgpEncrypted())&&Pb.data().capaOpenPGP()&&Cb.isNormal(a.Result.PlainRaw)&&(n.plainRaw=Cb.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)),Qb.empty(),k&&n.isPgpSigned()?j=Qb.append(b('').text(n.plainRaw)).html():l&&n.isPgpEncrypted()&&(j=Qb.append(b('').text(n.plainRaw)).html()),Qb.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(Ab.SignedVerifyStatus.None),n.pgpSignedVerifyUser(""),a.Result.Rtl&&(n.isRtl(!0),g.addClass("rtl-text-part")),n.body=g,n.body&&m.append(n.body),n.storeDataToDom(),f&&n.showInternalImages(!0),n.hasImages()&&this.showImages()&&n.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()),this.messageActiveDom(n.body),this.hideMessageBodies(),n.body.show(),g&&Cb.initBlockquoteSwitcher(g)),Pb.cache().initMessageFlagsFromCache(n),n.unseen()&&Pb.setMessageSeen(n),Cb.windowResize())},ob.prototype.calculateMessageListHash=function(a){return h.map(a,function(a){return""+a.hash+"_"+a.threadsLen()+"_"+a.flagHash()}).join("|")},ob.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&Cb.isArray(a.Result["@Collection"])){var c=Pb.data(),d=Pb.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=Cb.pInt(a.Result.MessageResultCount),j=Cb.pInt(a.Result.Offset),Cb.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(e=a.Result.LastCollapsedThreadUids),p=Pb.cache().getFolderFromCacheList(Cb.isNormal(a.Result.Folder)?a.Result.Folder:""),p&&!b&&(p.interval=l,Pb.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),Cb.isNormal(a.Result.MessageCount)&&p.messageCountAll(a.Result.MessageCount),Cb.isNormal(a.Result.MessageUnseenCount)&&(Cb.pInt(p.messageCountUnread())!==Cb.pInt(a.Result.MessageUnseenCount)&&(r=!0),p.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(p.fullNameRaw,a.Result.UidNext,a.Result.NewMessages)),r&&p&&Pb.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=A.newInstanceFromJson(n)),o&&(d.hasNewMessageAndRemoveFromCache(o.folderFullNameRaw,o.uid)&&5>=q&&(q++,o.newForAnimation(!0)),o.deleted(!1),b?Pb.cache().initMessageFlagsFromCache(o):Pb.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/"+Eb.urlsafe_encode([b,c,Pb.data().projectHash(),Pb.data().threading()&&Pb.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1},qb.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999e3)},qb.prototype.folderInformation=function(a,b,c){var d=!0,e=Pb.cache(),f=[];Cb.isArray(c)&&0 l;l++)q.push({id:e[l][0],name:e[l][1],system:!1,seporator:!1,disabled:!1});for(o=!0,l=0,m=b.length;m>l;l++)n=b[l],(h?h.call(null,n):!0)&&(o&&0 l;l++)n=c[l],(n.subScribed()||!n.existen)&&(h?h.call(null,n):!0)&&(Ab.FolderType.User===n.type()||!j||0 =5?e:20,e=320>=e?e:320,a.setInterval(function(){Pb.contactsSync()},6e4*e+5e3),h.delay(function(){Pb.contactsSync()},5e3),h.delay(function(){Pb.folderInformationMultiply(!0)},500),h.delay(function(){Pb.emailsPicsHashes(),Pb.remote().servicesPics(function(a,b){Ab.StorageResultType.Success===a&&b&&b.Result&&Pb.cache().setServicesData(b.Result)})},2e3),Db.runHook("rl-start-user-screens"),Pb.pub("rl.bootstart-user-screens"),Pb.settingsGet("AccountSignMe")&&a.navigator.registerProtocolHandler&&h.delay(function(){try{a.navigator.registerProtocolHandler("mailto",a.location.protocol+"//"+a.location.host+a.location.pathname+"?mailto&to=%s",""+(Pb.settingsGet("Title")||"RainLoop"))}catch(b){}Pb.settingsGet("MailToEmail")&&Pb.mailToHelper(Pb.settingsGet("MailToEmail"))},500)):(Ib.startScreens([ub]),Db.runHook("rl-start-login-screens"),Pb.pub("rl.bootstart-login-screens")),a.SimplePace&&a.SimplePace.set(100),Fb.bMobileDevice||h.defer(function(){Cb.initLayoutResizer("#rl-left","#rl-right",Ab.ClientSideKeyName.FolderListSize)})},this))):(c=Cb.pString(Pb.settingsGet("CustomLoginLink")),c?(Ib.routeOff(),Ib.setHash(Pb.link().root(),!0),Ib.routeOff(),h.defer(function(){a.location.href=c})):(Ib.hideLoading(),Ib.startScreens([ub]),Db.runHook("rl-start-login-screens"),Pb.pub("rl.bootstart-login-screens"),a.SimplePace&&a.SimplePace.set(100))),f&&(a["rl_"+d+"_google_service"]=function(){Pb.data().googleActions(!0),Pb.socialUsers()}),g&&(a["rl_"+d+"_facebook_service"]=function(){Pb.data().facebookActions(!0),Pb.socialUsers()}),i&&(a["rl_"+d+"_twitter_service"]=function(){Pb.data().twitterActions(!0),Pb.socialUsers()}),Pb.sub("interval.1m",function(){Fb.momentTrigger(!Fb.momentTrigger())}),Db.runHook("rl-start-screens"),Pb.pub("rl.bootstart-end")},Pb=new yb,Lb.addClass(Fb.bMobileDevice?"mobile":"no-mobile"),Mb.keydown(Cb.killCtrlAandS).keyup(Cb.killCtrlAandS),Mb.unload(function(){Fb.bUnload=!0}),Lb.on("click.dropdown.data-api",function(){Cb.detectDropdownVisibility()}),a.rl=a.rl||{},a.rl.addHook=Db.addHook,a.rl.settingsGet=Db.mainSettingsGet,a.rl.remoteRequest=Db.remoteRequest,a.rl.pluginSettingsGet=Db.settingsGet,a.rl.addSettingsViewModel=Cb.addSettingsViewModel,a.rl.createCommand=Cb.createCommand,a.rl.EmailModel=u,a.rl.Enums=Ab,a.__RLBOOT=function(c){b(function(){a.rainloopTEMPLATES&&a.rainloopTEMPLATES[0]?(b("#rl-templates").html(a.rainloopTEMPLATES[0]),h.delay(function(){a.rainloopAppData={},a.rainloopI18N={},a.rainloopTEMPLATES={},Ib.setBoot(Pb).bootstart(),Lb.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):c(!1),a.__RLBOOT=null})},a.SimplePace&&a.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,moment,Jua,_,ifvisible,key); \ No newline at end of file diff --git a/vendors/fontastic/fonts/rainloop.eot b/vendors/fontastic/fonts/rainloop.eot index b3636ef8d..e9b726c3f 100644 Binary files a/vendors/fontastic/fonts/rainloop.eot and b/vendors/fontastic/fonts/rainloop.eot differ diff --git a/vendors/fontastic/fonts/rainloop.svg b/vendors/fontastic/fonts/rainloop.svg index 6e4bbad7a..23c7203e7 100644 --- a/vendors/fontastic/fonts/rainloop.svg +++ b/vendors/fontastic/fonts/rainloop.svg @@ -105,15 +105,16 @@ - - - - - - - - - - - + + + + + + + + + + + + diff --git a/vendors/fontastic/fonts/rainloop.ttf b/vendors/fontastic/fonts/rainloop.ttf index 0184e40c9..e3f590a59 100644 Binary files a/vendors/fontastic/fonts/rainloop.ttf and b/vendors/fontastic/fonts/rainloop.ttf differ diff --git a/vendors/fontastic/fonts/rainloop.woff b/vendors/fontastic/fonts/rainloop.woff index 7b8554946..a85dce219 100644 Binary files a/vendors/fontastic/fonts/rainloop.woff and b/vendors/fontastic/fonts/rainloop.woff differ diff --git a/vendors/fontastic/icons-reference.html b/vendors/fontastic/icons-reference.html index 74868b4dd..aaadd0574 100644 --- a/vendors/fontastic/icons-reference.html +++ b/vendors/fontastic/icons-reference.html @@ -481,6 +481,10 @@ h2{font-size:18px;padding:0 0 21px 5px;margin:45px 0 0 0;text-transform:uppercas + + + + CSS mapping
@@ -876,10 +880,6 @@ h2{font-size:18px;padding:0 0 21px 5px;margin:45px 0 0 0;text-transform:uppercas -
- - - -
- @@ -920,6 +920,14 @@ h2{font-size:18px;padding:0 0 21px 5px;margin:45px 0 0 0;text-transform:uppercas
+- + + +
+- + + +