v1.3.8.476

This commit is contained in:
RainLoop Team 2013-11-02 02:19:20 +04:00
parent 7502c35135
commit 45f3bf61e2
436 changed files with 1180 additions and 838 deletions

View file

@ -1 +1 @@
1.3.7.466
1.3.8.476

View file

@ -1 +0,0 @@
4e8f8e7da270f436b9ca2b8f68166567b6467c56

View file

@ -1 +0,0 @@
1.3.7.466

View file

@ -1,50 +0,0 @@
<?php
namespace MailSo\Mail;
/**
* @category MailSo
* @package Mail
*/
class AttachmentCollection extends \MailSo\Base\Collection
{
/**
* @access protected
*/
protected function __construct()
{
parent::__construct();
}
/**
* @return \MailSo\Mail\AttachmentCollection
*/
public static function NewInstance()
{
return new self();
}
/**
* @return int
*/
public function InlineCount()
{
$aList = $this->FilterList(function ($oAttachment) {
return $oAttachment && $oAttachment->IsInline();
});
return \is_array($aList) ? \count($aList) : 0;
}
/**
* @return int
*/
public function NonInlineCount()
{
$aList = $this->FilterList(function ($oAttachment) {
return $oAttachment && !$oAttachment->IsInline();
});
return \is_array($aList) ? \count($aList) : 0;
}
}

View file

@ -1,155 +0,0 @@
(function(g,j,d,fa,z,i){function p(){this.sBase="#/";this.sCdnStaticDomain=e.settingsGet("CdnStaticDomain");this.sVersion=e.settingsGet("Version");this.sSpecSuffix=e.settingsGet("AuthAccountHash")||"0";this.sServer=(e.settingsGet("IndexFile")||"./")+"?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function M(){}function N(){}function O(){var a=i.find([N,M],function(a){return a.supported()});
a&&(this.oDriver=new a)}function ga(){}function t(a,b){this.sPosition=c.pString(a);this.sTemplate=c.pString(b);this.viewModelName="";this.viewModelVisibility=d.observable(!1);"Popups"===this.sPosition&&(this.modalVisibility=d.observable(!1));this.viewModelDom=null}function w(a,b){this.sScreenName=a;this.aViewModels=c.isArray(b)?b:[]}function q(){this.sDefaultScreenName="";this.oScreens={};this.oCurrentScreen=this.oBoot=null;this.popupVisibility=d.observable(!1);this.popupVisibility.subscribe(function(a){e&&
e.popupVisibility(a)})}function s(a,b){this.email=a||"";this.name=b||"";this.privateType=null;this.clearDuplicateName()}function B(){t.call(this,"Popups","PopupsDomain");this.edit=d.observable(!1);this.saving=d.observable(!1);this.savingError=d.observable("");this.whiteListPage=d.observable(!1);this.testing=d.observable(!1);this.testingDone=d.observable(!1);this.testingImapError=d.observable(!1);this.testingSmtpError=d.observable(!1);this.imapServerFocus=d.observable(!1);this.smtpServerFocus=d.observable(!1);
this.name=d.observable("");this.imapServer=d.observable("");this.imapPort=d.observable(m.Values.ImapDefaulPort);this.imapSecure=d.observable(f.ServerSecure.None);this.smtpServer=d.observable("");this.smtpPort=d.observable(m.Values.SmtpDefaulPort);this.smtpSecure=d.observable(f.ServerSecure.None);this.smtpAuth=d.observable(!0);this.whiteList=d.observable("");this.imapServerFocus.subscribe(function(a){a&&(""!==this.name()&&""===this.imapServer())&&this.imapServer(this.name())},this);this.smtpServerFocus.subscribe(function(a){a&&
(""!==this.imapServer()&&""===this.smtpServer())&&this.smtpServer(this.imapServer())},this);this.headerText=d.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this);this.domainIsComputed=d.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this);this.canBeTested=d.computed(function(){return!this.testing()&&this.domainIsComputed()},this);this.canBeSaved=
d.computed(function(){return!this.saving()&&this.domainIsComputed()},this);this.createOrAddCommand=c.createCommand(this,function(){this.saving(!0);e.remote().createOrUpdateDomain(i.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth(),this.whiteList())},this.canBeSaved);this.testConnectionCommand=c.createCommand(this,function(){this.whiteListPage(!1);this.testingDone(!1);
this.testingImapError(!1);this.testingSmtpError(!1);this.testing(!0);e.remote().testConnectionForDomain(i.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested);this.whiteListCommand=c.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())})}function P(){t.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=i.bind(this.onPluginSettingsUpdateResponse,
this);this.saveError=d.observable("");this.name=d.observable("");this.readme=d.observable("");this.configures=d.observableArray([]);this.hasReadme=d.computed(function(){return""!==this.readme()},this);this.hasConfiguration=d.computed(function(){return 0<this.configures().length},this);this.readmePopoverConf={placement:"top",trigger:"hover",title:"About",content:function(){return a.readme()}};this.saveCommand=c.createCommand(this,function(){var a={};a.Name=this.name();i.each(this.configures(),function(h){var c=
h.value();if(!1===c||!0===c)c=c?"1":"0";a["_"+h.Name]=c},this);this.saveError("");e.remote().pluginSettingsUpdate(this.onPluginSettingsUpdateResponse,a)},this.hasConfiguration)}function Q(){t.call(this,"Popups","PopupsActivate");var a=this;this.domain=d.observable("");this.key=d.observable("");this.key.focus=d.observable(!1);this.activationSuccessed=d.observable(!1);this.licenseTrigger=e.data().licenseTrigger;this.activateProcess=d.observable(!1);this.activateText=d.observable("");this.activateText.isError=
d.observable(!1);this.key.subscribe(function(){this.activateText("");this.activateText.isError(!1)},this);this.activationSuccessed.subscribe(function(a){a&&this.licenseTrigger(!this.licenseTrigger())},this);this.activateCommand=c.createCommand(this,function(){this.activateProcess(!0);this.validateSubscriptionKey()?e.remote().licensingActivate(function(b,h){a.activateProcess(!1);f.StorageResultType.Success===b&&h.Result?!0===h.Result?(a.activationSuccessed(!0),a.activateText("Subscription Key Activated Successfully"),
a.activateText.isError(!1)):(a.activateText(h.Result),a.activateText.isError(!0),a.key.focus(!0)):(h.ErrorCode?a.activateText(c.getNotification(h.ErrorCode)):a.activateText(c.getNotification(f.Notification.UnknownError)),a.activateText.isError(!0),a.key.focus(!0))},this.domain(),this.key()):(this.activateProcess(!1),this.activateText("Invalid Subscription Key"),this.activateText.isError(!0),this.key.focus(!0))},function(){return!this.activateProcess()&&""!==this.domain()&&""!==this.key()&&!this.activationSuccessed()})}
function R(){t.call(this,"Popups","PopupsLanguages");this.exp=d.observable(!1);this.languages=d.computed(function(){var a=e.data().mainLanguage();return i.map(e.data().languages(),function(b){return{key:b,selected:b===a,fullName:c.convertLangName(b)}})})}function S(){t.call(this,"Right","AdminLogin");this.login=d.observable("");this.password=d.observable("");this.loginError=d.observable(!1);this.passwordError=d.observable(!1);this.loginFocus=d.observable(!1);this.login.subscribe(function(){this.loginError(!1)},
this);this.password.subscribe(function(){this.passwordError(!1)},this);this.submitRequest=d.observable(!1);this.submitError=d.observable("");this.submitCommand=c.createCommand(this,function(){this.loginError(""===c.trim(this.login()));this.passwordError(""===c.trim(this.password()));if(this.loginError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().adminLogin(i.bind(function(a,b){f.StorageResultType.Success===a&&b&&"AdminLogin"===b.Action?b.Result?e.loginAndLogoutReload():b.ErrorCode&&
(this.submitRequest(!1),this.submitError(c.getNotification(b.ErrorCode))):(this.submitRequest(!1),this.submitError(c.getNotification(f.Notification.UnknownError)))},this),this.login(),this.password());return!0},function(){return!this.submitRequest()})}function X(a){t.call(this,"Left","AdminMenu");this.menu=a.menu}function Y(){t.call(this,"Right","AdminPane");this.adminDomain=d.observable(e.settingsGet("AdminDomain"));this.version=d.observable(e.settingsGet("Version"))}function ha(){var a=e.data();
this.mainLanguage=a.mainLanguage;this.mainTheme=a.mainTheme;this.language=a.language;this.theme=a.theme;this.allowThemes=a.allowThemes;this.allowCustomTheme=a.allowCustomTheme;this.allowCustomLogin=a.allowCustomLogin;this.allowLanguagesOnLogin=a.allowLanguagesOnLogin;this.allowLanguagesOnSettings=a.allowLanguagesOnSettings;this.allowAdditionalAccounts=a.allowAdditionalAccounts;this.determineUserLanguage=a.determineUserLanguage;this.title=d.observable(e.settingsGet("Title"));this.themesOptions=d.computed(function(){return i.map(a.themes(),
function(a){return{optValue:a,optText:c.convertThemeName(a)}})});this.languagesOptions=d.computed(function(){return i.map(a.languages(),function(a){return{optValue:a,optText:c.convertLangName(a)}})});this.contactsSupported=e.settingsGet("ContactsIsSupported");this.contactsIsAllowed=e.settingsGet("ContactsIsAllowed");this.titleTrigger=d.observable(f.SaveSettingsStep.Idle);this.languageTrigger=d.observable(f.SaveSettingsStep.Idle);this.themeTrigger=d.observable(f.SaveSettingsStep.Idle)}function C(){var a=
e.data();this.domains=a.domains;this.domainsLoading=a.domainsLoading;this.iDomainForDeletionTimeout=0;this.visibility=d.computed(function(){return a.domainsLoading()?"visible":"hidden"},this);this.domainForDeletion=d.observable(null).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&(a.deleteAccess(!0),this.startDomainForDeletionTimeout())}]})}function J(){this.licensing=e.data().licensing;this.licensingProcess=e.data().licensingProcess;this.licenseValid=e.data().licenseValid;
this.licenseExpired=e.data().licenseExpired;this.licenseError=e.data().licenseError;this.licenseTrigger=e.data().licenseTrigger;this.adminDomain=d.observable("");this.subscriptionEnabled=d.observable(!!e.settingsGet("SubscriptionEnabled"));this.licenseTrigger.subscribe(function(){this.subscriptionEnabled()&&e.reloadLicensing(!0)},this)}function K(){this.csrfProtection=d.observable(!!e.settingsGet("UseTokenProtection"));this.usageStatistics=d.observable(!!e.settingsGet("UsageStatistics"));this.adminLogin=
d.observable(e.settingsGet("AdminLogin"));this.adminPassword=d.observable("");this.adminPasswordNew=d.observable("");this.adminPasswordUpdateError=d.observable(!1);this.adminPasswordUpdateSuccess=d.observable(!1);this.adminPassword.subscribe(function(){this.adminPasswordUpdateError(!1);this.adminPasswordUpdateSuccess(!1)},this);this.adminPasswordNew.subscribe(function(){this.adminPasswordUpdateError(!1);this.adminPasswordUpdateSuccess(!1)},this);this.onNewAdminPasswordResponse=i.bind(this.onNewAdminPasswordResponse,
this);this.saveNewAdminPasswordCommand=c.createCommand(this,function(){this.adminPasswordUpdateError(!1);this.adminPasswordUpdateSuccess(!1);e.remote().saveNewAdminPassword(this.onNewAdminPasswordResponse,{Password:this.adminPassword(),NewPassword:this.adminPasswordNew()})},function(){return""!==this.adminPassword()&&""!==this.adminPasswordNew()})}function ia(){var a=e.data();this.googleEnable=a.googleEnable;this.googleClientID=a.googleClientID;this.googleClientSecret=a.googleClientSecret;this.googleTrigger1=
d.observable(f.SaveSettingsStep.Idle);this.googleTrigger2=d.observable(f.SaveSettingsStep.Idle);this.facebookEnable=a.facebookEnable;this.facebookAppID=a.facebookAppID;this.facebookAppSecret=a.facebookAppSecret;this.facebookTrigger1=d.observable(f.SaveSettingsStep.Idle);this.facebookTrigger2=d.observable(f.SaveSettingsStep.Idle);this.twitterEnable=a.twitterEnable;this.twitterConsumerKey=a.twitterConsumerKey;this.twitterConsumerSecret=a.twitterConsumerSecret;this.twitterTrigger1=d.observable(f.SaveSettingsStep.Idle);
this.twitterTrigger2=d.observable(f.SaveSettingsStep.Idle);this.dropboxEnable=a.dropboxEnable;this.dropboxApiKey=a.dropboxApiKey;this.dropboxTrigger1=d.observable(f.SaveSettingsStep.Idle)}function E(){var a=e.data();this.enabledPlugins=d.observable(!!e.settingsGet("EnabledPlugins"));this.pluginsError=d.observable("");this.plugins=a.plugins;this.pluginsLoading=a.pluginsLoading;this.visibility=d.computed(function(){return a.pluginsLoading()?"visible":"hidden"},this);this.onPluginLoadRequest=i.bind(this.onPluginLoadRequest,
this);this.onPluginDisableRequest=i.bind(this.onPluginDisableRequest,this)}function I(){var a=e.data();this.packagesError=d.observable("");this.packages=a.packages;this.packagesLoading=a.packagesLoading;this.packagesReal=a.packagesReal;this.packagesMainUpdatable=a.packagesMainUpdatable;this.packagesCurrent=d.computed(function(){return i.filter(this.packages(),function(a){return a&&""!==a.installed&&!a.compare})},this);this.packagesAvailableForUpdate=d.computed(function(){return i.filter(this.packages(),
function(a){return a&&""!==a.installed&&!!a.compare})},this);this.packagesAvailableForInstallation=d.computed(function(){return i.filter(this.packages(),function(a){return a&&""===a.installed})},this);this.visibility=d.computed(function(){return a.packagesLoading()?"visible":"hidden"},this)}function Z(){c.initDataConstructorBySettings(this)}function aa(){c.initDataConstructorBySettings(this);this.domainsLoading=d.observable(!1).extend({throttle:100});this.domains=d.observableArray([]);this.pluginsLoading=
d.observable(!1).extend({throttle:100});this.plugins=d.observableArray([]);this.packagesReal=d.observable(!0);this.packagesMainUpdatable=d.observable(!0);this.packagesLoading=d.observable(!1).extend({throttle:100});this.packages=d.observableArray([]);this.licensing=d.observable(!1);this.licensingProcess=d.observable(!1);this.licenseValid=d.observable(!1);this.licenseExpired=d.observable(0);this.licenseError=d.observable("");this.licenseTrigger=d.observable(!1)}function F(){this.oRequests={}}function n(){this.oRequests=
{};this.oRequests={}}function D(){this.oEmailsPicsHashes={};this.oServices={}}function ja(){D.call(this)}function G(a){w.call(this,"settings",a);this.menu=d.observableArray([]);this.oViewModelPlace=this.oCurrentSubScreen=null}function ba(){w.call(this,"login",[S])}function ca(){G.call(this,[X,Y])}function u(){this.oLocal=this.oLink=this.oPlugins=this.oSettings=null;this.isLocalAutocomplete=!0;this.popupVisibility=d.observable(!1);this.iframe=j('<iframe style="display:none" src="javascript:;" />').appendTo("body");
H.on("error",function(a){e&&(a&&a.originalEvent&&a.originalEvent.message&&-1===c.inArray(a.originalEvent.message,["Uncaught Error: Error calling method on NPObject."]))&&e.remote().jsError(c.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",T.attr("class"))})}function v(){u.call(this);this.oCache=this.oRemote=this.oData=null}var m={},f={},l={},c={},o={},k={},A={settings:[],"settings-removed":[],"settings-disabled":[]},
r=null,U=g.rainloopAppData||{},da=g.rainloopI18N||{},T=j("html"),H=j(g),ka=j(g.document),V=g.Notification&&g.Notification.requestPermission?g.Notification:null,e=null;k.minuteTick=d.observable(!0);k.fiveMinuteTick=d.observable(!0);k.langChangeTick=d.observable(!0);k.iAjaxErrorCount=0;k.iTokenErrorCount=0;k.iMessageBodyCacheCount=0;k.bUnload=!1;k.sUserAgent=(navigator.userAgent||"").toLowerCase();k.bIsiOSDevice=-1<k.sUserAgent.indexOf("iphone")||-1<k.sUserAgent.indexOf("ipod")||-1<k.sUserAgent.indexOf("ipad");
k.bIsAndroidDevice=-1<k.sUserAgent.indexOf("android");k.bMobileDevice=k.bIsiOSDevice||k.bIsAndroidDevice;k.bDisableNanoScroll=k.bMobileDevice;m.Defaults={};m.Values={};m.DataImages={};m.Defaults.MessagesPerPage=20;m.Defaults.MessagesPerPageArray=[10,20,30,50,100];m.Defaults.DefaultAjaxTimeout=2E4;m.Defaults.SearchAjaxTimeout=12E4;m.Defaults.SendMessageAjaxTimeout=2E5;m.Defaults.SaveMessageAjaxTimeout=2E5;m.Values.UnuseOptionValue="__UNUSE__";m.Values.GmailFolderName="[Gmail]";m.Values.ClientSideCookieIndexName=
"rlcsc";m.Values.ImapDefaulPort=143;m.Values.ImapDefaulSecurePort=993;m.Values.SmtpDefaulPort=25;m.Values.SmtpDefaulSecurePort=465;m.Values.iMessageBodyCacheLimit=15;m.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=";m.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=";f.StorageResultType={Success:"success",Abort:"abort",Error:"error",
Unload:"unload"};f.State={Empty:10,Login:20,Auth:30};f.StateType={Webmail:0,Admin:1};f.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,User:99};f.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"};f.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2};f.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft"};f.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,
FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99};f.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4};f.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4};f.EventKeyCode={Backspace:8,Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Insert:45,Delete:46,A:65,S:83};f.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3};f.MessageSelectAction={All:0,
None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6};f.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9};f.MessagePriority={Low:5,Normal:3,High:1};f.EditorDefaultType={Html:"Html",Plain:"Plain"};f.CustomThemeType={Light:"Light",Dark:"Dark"};f.ServerSecure={None:0,SSL:1,TLS:2};f.SearchDateType={All:-1,Days3:3,Days7:7,Month:30};f.EmailType={Defailt:0,Facebook:1,Google:2};f.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0};f.Notification={InvalidToken:101,AuthError:102,
AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,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,UnknownNotification:999,UnknownError:999};c.trim=j.trim;c.inArray=j.inArray;c.isArray=i.isArray;c.isFunc=i.isFunction;c.isUnd=i.isUndefined;c.isNull=i.isNull;c.emptyFunction=function(){};c.isNormal=function(a){return!c.isUnd(a)&&
!c.isNull(a)};c.windowResize=i.debounce(function(a){c.isUnd(a)?H.resize():g.setTimeout(function(){H.resize()},a)},50);c.isPosNumeric=function(a,b){return c.isNormal(a)?c.isUnd(b)||b?/^[0-9]*$/.test(a.toString()):/^[1-9]+[0-9]*$/.test(a.toString()):!1};c.pInt=function(a){return c.isNormal(a)&&""!==a?g.parseInt(a,10):0};c.pString=function(a){return c.isNormal(a)?a+"":""};c.isNonEmptyArray=function(a){return c.isArray(a)&&0<a.length};c.exportPath=function(a,b,h){for(var d=null,a=a.split("."),h=h||g;a.length&&
(d=a.shift());)!a.length&&!c.isUnd(b)?h[d]=b:h=h[d]?h[d]:h[d]={}};c.pImport=function(a,b,c){a[b]=c};c.pExport=function(a,b,h){return c.isUnd(a[b])?h:a[b]};c.encodeHtml=function(a){return c.isNormal(a)?a.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""};c.splitPlainText=function(a,b){for(var h="",d="",e=a,f=0,g=0,b=c.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),h+=d.substring(0,f)+"\n",e=e.substring(f+1);return h+e};var W={};c.timeOutAction=function(a,b,h){c.isUnd(W[a])&&(W[a]=0);g.clearTimeout(W[a]);W[a]=g.setTimeout(b,h)};var ea={};c.timeOutActionSecond=function(a,b,c){ea[a]||(ea[a]=g.setTimeout(function(){b();ea[a]=0},c))};var y=!1;c.audio=function(a,b){if(!1===y)if(k.bIsiOSDevice)y=null;else{var c=!1,d=!1,e=g.Audio?new g.Audio:null;e&&e.canPlayType&&e.play?((c=""!==e.canPlayType('audio/mpeg; codecs="mp3"'))||(d=""!==e.canPlayType('audio/ogg; codecs="vorbis"')),
c||d?(y=e,y.preload="none",y.loop=!1,y.autoplay=!1,y.muted=!1,y.src=c?a:b):y=null):y=null}return y};c.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};c.i18n=function(a,b,h){var d="",a=c.isUnd(da[a])?c.isUnd(h)?a:h:da[a];if(!c.isUnd(b)&&!c.isNull(b))for(d in b)c.hos(b,d)&&(a=a.replace("%"+d+"%",b[d]));return a};c.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),h="";(h=a.data("i18n-text"))?a.text(c.i18n(h)):((h=a.data("i18n-html"))&&
a.html(c.i18n(h)),(h=a.data("i18n-placeholder"))&&a.attr("placeholder",c.i18n(h)))})})};c.i18nToDoc=function(){g.rainloopI18N&&(da=g.rainloopI18N||{},c.i18nToNode(ka),k.langChangeTick(!k.langChangeTick()));g.rainloopI18N={}};c.initOnStartOrLangChange=function(a,b,c){a&&a.call(b);c?k.langChangeTick.subscribe(function(){a&&a.call(b);c.call(b)}):a&&k.langChangeTick.subscribe(a,b)};c.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||
"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)};c.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=j(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}};c.removeSelection=function(){if(g&&g.getSelection){var a=g.getSelection();a&&a.removeAllRanges&&a.removeAllRanges()}else document&&(document.selection&&document.selection.empty)&&document.selection.empty()};c.replySubjectAdd=function(a,b){var h=
null,d=c.trim(b);null!==(h=(new g.RegExp("^"+a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!c.isUnd(h[1])?d=a+"[2]: "+h[1]:null!==(h=(new g.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi")).exec(b))&&!c.isUnd(h[1])&&!c.isUnd(h[2])&&!c.isUnd(h[3])?(c.pInt(h[2]),d=h[1]+(c.pInt(h[2])+1)+h[3]):d=a+": "+b;return d};c.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};c.friendlySize=function(a){a=c.pInt(a);return 1073741824<=a?c.roundNumber(a/1073741824,1)+"GB":1048576<=
a?c.roundNumber(a/1048576,1)+"MB":1024<=a?c.roundNumber(a/1024,0)+"KB":a+"B"};c.log=function(a){g.console&&g.console.log&&g.console.log(a)};c.getNotification=function(a){a=c.pInt(a);return c.isUnd(l[a])?"":l[a]};c.initNotificationLanguage=function(){l[f.Notification.InvalidToken]=c.i18n("NOTIFICATIONS/INVALID_TOKEN");l[f.Notification.AuthError]=c.i18n("NOTIFICATIONS/AUTH_ERROR");l[f.Notification.AccessError]=c.i18n("NOTIFICATIONS/ACCESS_ERROR");l[f.Notification.ConnectionError]=c.i18n("NOTIFICATIONS/CONNECTION_ERROR");
l[f.Notification.CaptchaError]=c.i18n("NOTIFICATIONS/CAPTCHA_ERROR");l[f.Notification.SocialFacebookLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");l[f.Notification.SocialTwitterLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");l[f.Notification.SocialGoogleLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");l[f.Notification.DomainNotAllowed]=c.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");l[f.Notification.AccountNotAllowed]=
c.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED");l[f.Notification.CantGetMessageList]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST");l[f.Notification.CantGetMessage]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");l[f.Notification.CantDeleteMessage]=c.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");l[f.Notification.CantMoveMessage]=c.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");l[f.Notification.CantSaveMessage]=c.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");l[f.Notification.CantSendMessage]=c.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");
l[f.Notification.InvalidRecipients]=c.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");l[f.Notification.CantCreateFolder]=c.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER");l[f.Notification.CantRenameFolder]=c.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");l[f.Notification.CantDeleteFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");l[f.Notification.CantDeleteNonEmptyFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");l[f.Notification.CantSubscribeFolder]=c.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");l[f.Notification.CantUnsubscribeFolder]=
c.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");l[f.Notification.CantSaveSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS");l[f.Notification.CantSavePluginSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");l[f.Notification.DomainAlreadyExists]=c.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");l[f.Notification.CantInstallPackage]=c.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");l[f.Notification.CantDeletePackage]=c.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");l[f.Notification.InvalidPluginPackage]=
c.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");l[f.Notification.UnsupportedPluginPackage]=c.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE");l[f.Notification.LicensingServerIsUnavailable]=c.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");l[f.Notification.LicensingExpired]=c.i18n("NOTIFICATIONS/LICENSING_EXPIRED");l[f.Notification.LicensingBanned]=c.i18n("NOTIFICATIONS/LICENSING_BANNED");l[f.Notification.DemoSendMessageError]=c.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");l[f.Notification.AccountAlreadyExists]=
c.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");l[f.Notification.MailServerError]=c.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR");l[f.Notification.UnknownNotification]=c.i18n("NOTIFICATIONS/UNKNOWN_ERROR");l[f.Notification.UnknownError]=c.i18n("NOTIFICATIONS/UNKNOWN_ERROR")};c.getUploadErrorDescByCode=function(a){var b="";switch(c.pInt(a)){case f.UploadErrorCode.FileIsTooBig:b=c.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case f.UploadErrorCode.FilePartiallyUploaded:b=c.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");
break;case f.UploadErrorCode.FileNoUploaded:b=c.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case f.UploadErrorCode.MissingTempFolder:b=c.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case f.UploadErrorCode.FileOnSaveingError:b=c.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case f.UploadErrorCode.FileType:b=c.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=c.i18n("UPLOAD/ERROR_UNKNOWN")}return b};c.killCtrlAandS=function(a){if(a=a||g.event){var b=a.target||a.srcElement,c=a.keyCode||a.which;if(a.ctrlKey&&
c===f.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&c===f.EventKeyCode.A)g.getSelection?g.getSelection().removeAllRanges():g.document.selection&&g.document.selection.clear&&g.document.selection.clear(),a.preventDefault()}};c.createCommand=function(a,b,h){var e=b?function(){e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};e.enabled=d.observable(!0);h=c.isUnd(h)?!0:h;e.canExecute=c.isFunc(h)?
d.computed(function(){return e.enabled()&&h.call(a)}):d.computed(function(){return e.enabled()&&!!h});return e};c.initDataConstructorBySettings=function(a){a.ignoreFolderSubscribe=d.observable(!1);a.editorDefaultType=d.observable(f.EditorDefaultType.Html);a.showImages=d.observable(!1);a.showAnimation=d.observable(!1);a.allowThemes=d.observable(!0);a.allowCustomLogin=d.observable(!1);a.allowLanguagesOnSettings=d.observable(!0);a.allowLanguagesOnLogin=d.observable(!0);a.desktopNotifications=d.observable(!1);
a.useThreads=d.observable(!0);a.replySameFolder=d.observable(!0);a.usePreviewPane=d.observable(!0);a.useCheckboxesInList=d.observable(!0);a.showAnimation.subscribe(function(a){k.bMobileDevice?T.removeClass("rl-anim").addClass("no-rl-anim"):T.toggleClass("rl-anim",a).toggleClass("no-rl-anim",!a)});a.showAnimation.valueHasMutated();a.desktopNotificationsPermisions=d.computed(function(){a.desktopNotifications();var b=f.DesktopNotifications.NotSupported;if(V&&V.permission)switch(V.permission.toLowerCase()){case "granted":b=
f.DesktopNotifications.Allowed;break;case "denied":b=f.DesktopNotifications.Denied;break;case "default":b=f.DesktopNotifications.NotAllowed}else g.webkitNotifications&&g.webkitNotifications.checkPermission&&(b=g.webkitNotifications.checkPermission());return b});a.useDesktopNotifications=d.computed({read:function(){return a.desktopNotifications()&&f.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()},write:function(b){b?(b=a.desktopNotificationsPermisions(),f.DesktopNotifications.Allowed===
b?a.desktopNotifications(!0):f.DesktopNotifications.NotAllowed===b?V.requestPermission(function(){a.desktopNotifications.valueHasMutated();f.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()?a.desktopNotifications()?a.desktopNotifications.valueHasMutated():a.desktopNotifications(!0):a.desktopNotifications()?a.desktopNotifications(!1):a.desktopNotifications.valueHasMutated()}):a.desktopNotifications(!1)):a.desktopNotifications(!1)}});a.language=d.observable("");a.languages=d.observableArray([]);
a.mainLanguage=d.computed({read:a.language,write:function(b){b!==a.language()?-1<c.inArray(b,a.languages())?a.language(b):0<a.languages().length&&a.language(a.languages()[0]):a.language.valueHasMutated()}});a.theme=d.observable("");a.themes=d.observableArray([]);a.mainTheme=d.computed({read:a.theme,write:function(b){if(b!==a.theme()){var h=a.themes();-1<c.inArray(b,h)?a.theme(b):0<h.length&&a.theme(h[0])}else a.theme.valueHasMutated()}});a.allowCustomTheme=d.observable(!0);a.allowAdditionalAccounts=
d.observable(!0);a.determineUserLanguage=d.observable(!1);a.messagesPerPage=d.observable(m.Defaults.MessagesPerPage);a.mainMessagesPerPage=a.messagesPerPage;a.mainMessagesPerPage=d.computed({read:a.messagesPerPage,write:function(b){-1<c.inArray(c.pInt(b),m.Defaults.MessagesPerPageArray)?b!==a.messagesPerPage()&&a.messagesPerPage(b):a.messagesPerPage.valueHasMutated()}});a.facebookEnable=d.observable(!1);a.facebookAppID=d.observable("");a.facebookAppSecret=d.observable("");a.twitterEnable=d.observable(!1);
a.twitterConsumerKey=d.observable("");a.twitterConsumerSecret=d.observable("");a.googleEnable=d.observable(!1);a.googleClientID=d.observable("");a.googleClientSecret=d.observable("");a.dropboxEnable=d.observable(!1);a.dropboxApiKey=d.observable("");a.contactsIsSupported=d.observable(!1);a.contactsIsAllowed=d.observable(!1)};c.createMomentDate=function(a){return d.computed(function(){k.minuteTick();return this.moment().fromNow()},a)};c.createMomentShortDate=function(a){return d.computed(function(){var a=
"",a=moment(),h=this.moment(),d=this.momentDate();return a=4>=a.diff(h,"hours")?d:a.format("L")===h.format("L")?c.i18n("MESSAGE_LIST/TODAY_AT",{TIME:h.format("LT")}):a.clone().subtract("days",1).format("L")===h.format("L")?c.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:h.format("LT")}):a.year()===h.year()?h.format("D MMM."):h.format("LL")},a)};c.isFolderExpanded=function(a){var b=e.local().get(f.ClientSideKeyName.ExpandedFolders);return i.isArray(b)&&-1!==i.indexOf(b,a)};c.setExpandedFolder=function(a,
b){var c=e.local().get(f.ClientSideKeyName.ExpandedFolders);i.isArray(c)||(c=[]);b?(c.push(a),c=i.uniq(c)):c=i.without(c,a);e.local().set(f.ClientSideKeyName.ExpandedFolders,c)};c.initLayoutResizer=function(a,b,c,d,f,L,g,k){var d=d||300,f=f||500,L=L||f-d/2,g=g||300,x=0,l=j(a),m=j(b),o=j(c),b=e.local().get(k)||L,p=function(a,b,c){if(b||c)a=o.width(),b=b?100*(b.size.width/a):null,null===b&&c&&(b=100*(l.width()/a)),null!==b&&(l.css({width:"",height:"",right:""+(100-b)+"%"}),m.css({width:"",height:"",
left:""+b+"%"}))};b&&l.width(b);x=o.width()-g;x=f>x?x:f;l.resizable({minWidth:d,maxWidth:x,handles:"e",resize:p,stop:p});p(null,null,!0);H.resize(i.throttle(function(b,c){c&&(c.element&&c.element[0].id&&"#"+c.element[0].id===""+a)&&(x=o.width()-g,x=f>x?x:f,l.resizable("option","maxWidth",x),c.size&&c.size.width&&e.local().set(k,c.size.width),p(null,null,!0))},400))};c.initBlockquoteSwitcher=function(a){if(a){var b=j("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===j(this).parent().closest("blockquote",
a).length});b&&0<b.length&&b.each(function(){var a=j(this),b=a.height();if(0===b||100<b)a.addClass("rl-bq-switcher hidden-bq"),j('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>').insertBefore(a).click(function(){a.toggleClass("hidden-bq");c.windowResize()}).after("<br />").before("<br />")})}};c.removeBlockquoteSwitcher=function(a){a&&(j(a).find("blockquote.rl-bq-switcher").each(function(){j(this).removeClass("rl-bq-switcher hidden-bq")}),j(a).find(".rlBlockquoteSwitcher").each(function(){j(this).remove()}))};
c.extendAsViewModel=function(a,b){b&&(b.__name=a,o.regViewModelHook(a,b),i.extend(b.prototype,t.prototype))};c.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e};A.settings.push(a)};c.removeSettingsViewModel=function(a){A["settings-removed"].push(a)};c.disableSettingsViewModel=function(a){A["settings-disabled"].push(a)};c.convertThemeName=function(a){return c.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};c.convertLangName=
function(a){return c.i18n("LANGS_NAMES/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)};c.fakeMd5=function(a){for(var b="",a=c.isUnd(a)?32:c.pInt(a);b.length<a;)b+="0123456789abcdefghijklmnopqrstuvwxyz".substr(g.Math.round(36*g.Math.random()),1);return b};c.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")};c.draggeblePlace=function(){return j('<div class="draggablePlace"><span class="text"></span>&nbsp;<i class="icon-envelope icon-white"></i></div>').appendTo("#rl-hidden")};
c.defautOptionsAfterRender=function(a,b){b&&!c.isUnd(b.disable)&&d.applyBindingsToNode(a,{disable:b.disable},b)};c.windowPopupKnockout=function(a,b,h,d){var e=null,f=g.open(""),i="__OpenerApplyBindingsUid"+c.fakeMd5()+"__",k=j("#"+b);g[i]=function(){if(f&&f.document.body&&k&&k[0]){var b=j(f.document.body);j("#rl-content",b).html(k.html());j("html",f.document).addClass("external "+j("html").attr("class"));c.i18nToNode(b);q.prototype.applyExternal(a,j("#rl-content",b)[0]);g[i]=null;d(f)}};f.document.open();
f.document.write('<html><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="robots" content="noindex, nofollow, noodp" /><title>'+c.encodeHtml(h)+'</title></head><body><div id="rl-content"></div></body></html>');f.document.close();e=f.document.createElement("script");e.type="text/javascript";e.innerHTML="if(window&&window.opener&&window.opener['"+
i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}";f.document.getElementsByTagName("head")[0].appendChild(e)};c.settingsSaveHelperFunction=function(a,b,h,d){h=h||null;d=c.isUnd(d)?1E3:c.pInt(d);return function(c,e,g,j,x){b.call(h,e&&e.Result?f.SaveSettingsStep.TrueResult:f.SaveSettingsStep.FalseResult);a&&a.call(h,c,e,g,j,x);i.delay(function(){b.call(h,f.SaveSettingsStep.Idle)},d)}};c.settingsSaveHelperSimpleFunction=function(a,b){return c.settingsSaveHelperFunction(null,a,b,1E3)};c.resizeAndCrop=
function(a,b,c){var d=new Image;d.onload=function(){var a=[0,0],d=document.createElement("canvas"),e=d.getContext("2d");d.width=b;d.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];e.fillStyle="#fff";e.fillRect(0,0,b,b);e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,b,b);c(d.toDataURL("image/jpeg"))};d.src=a};d.bindingHandlers.tooltip={init:function(a,b){if(!k.bMobileDevice){var h=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,
hide:100},html:!0,trigger:"hover",title:function(){return'<span class="tooltip-class '+h+'">'+c.i18n(d.utils.unwrapObservable(b()))+"</span>"}})}}};d.bindingHandlers.tooltip2={init:function(a,b){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,title:function(){return'<span class="tooltip-class '+c+'">'+b()()+"</span>"}})}};d.bindingHandlers.popover={init:function(a,b){j(a).popover(d.utils.unwrapObservable(b()))}};d.bindingHandlers.resizecrop={init:function(a){j(a).addClass("resizecrop").resizecrop({width:"100",
height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,b){b()();j(a).resizecrop({width:"100",height:"100"})}};d.bindingHandlers.onEnter={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&13===g.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};d.bindingHandlers.onEsc={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&27===g.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};d.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,
show:d.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=d.utils.unwrapObservable(b());j(a).modal(c?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",c)},1)}};d.bindingHandlers.i18nInit={init:function(a){c.i18nToNode(a)}};d.bindingHandlers.i18nUpdate={update:function(a,b){d.utils.unwrapObservable(b());c.i18nToNode(a)}};d.bindingHandlers.link={update:function(a,b){j(a).attr("href",d.utils.unwrapObservable(b()))}};d.bindingHandlers.title={update:function(a,
b){j(a).attr("title",d.utils.unwrapObservable(b()))}};d.bindingHandlers.textF={init:function(a,b){j(a).text(d.utils.unwrapObservable(b()))}};d.bindingHandlers.initDom={init:function(a,b){b()(a)}};d.bindingHandlers.initResizeTrigger={init:function(a,b){var c=d.utils.unwrapObservable(b());j(a).css({height:c[1],"min-height":c[1]})},update:function(a,b){var h=d.utils.unwrapObservable(b()),e=c.pInt(h[1]),f=0,f=j(a).offset().top;0<f&&(f+=c.pInt(h[2]),f=H.height()-f,e<f&&(e=f),j(a).css({height:e,"min-height":e}))}};
d.bindingHandlers.appendDom={update:function(a,b){j(a).hide().empty().append(d.utils.unwrapObservable(b())).show()}};d.bindingHandlers.draggable={init:function(a,b,h){if(!k.bMobileDevice){var e=(h=h())&&h.droppableSelector?h.droppableSelector:"",h={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};e&&(h.drag=function(a){j(e).each(function(){var b=null,h=null,d=j(this),h=d.offset(),b=h.top+d.height();g.clearInterval(d.data("timerScroll"));d.data("timerScroll",
!1);if(a.pageX>=h.left&&a.pageX<=h.left+d.width()&&(a.pageY>=b-100&&a.pageY<=b&&(b=function(){d.scrollTop(d.scrollTop()+3);c.windowResize()},d.data("timerScroll",g.setInterval(b,10)),b()),a.pageY>=h.top&&a.pageY<=h.top+100))h=function(){d.scrollTop(d.scrollTop()-3);c.windowResize()},d.data("timerScroll",g.setInterval(h,10)),h()})},h.stop=function(){j(e).each(function(){g.clearInterval(j(this).data("timerScroll"));j(this).data("timerScroll",!1)})});h.helper=function(a){return b()(a&&a.target?d.dataFor(a.target):
null)};j(a).draggable(h).on("mousedown",function(){c.removeInFocus()})}}};d.bindingHandlers.droppable={init:function(a,b,c){if(!k.bMobileDevice){var d=b(),e=(b=c())&&b.droppableOver?b.droppableOver:null,f=b&&b.droppableOut?b.droppableOut:null,b={tolerance:"pointer",hoverClass:"droppableHover"};d&&(b.drop=function(a,b){d(a,b)},e&&(b.over=function(a,b){e(a,b)}),f&&(b.out=function(a,b){f(a,b)}),j(a).droppable(b))}}};d.bindingHandlers.nano={init:function(a){k.bDisableNanoScroll||j(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,
preventPageScrolling:!0})}};d.bindingHandlers.saveTrigger={init:function(a){j(a).append('&nbsp;&nbsp;<i class="icon-spinner-2 animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger")},update:function(a,b){var c=d.utils.unwrapObservable(b()),e=j(a);switch(c.toString()){case "1":e.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case "0":e.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");
break;case "-2":e.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:e.find(".animated").hide().end().find(".error,.success").removeClass("visible")}}};d.bindingHandlers.select2={init:function(a,b){var h=0,f=null,la=new g.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),L=new g.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),k=function(){return""},l=function(a){e.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,results:i.map(b,
function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};j(a).addClass("ko-select2").select2({query:function(a){a&&(0===h?(l(a),h=g.setTimeout(c.emptyFunction,100)):(g.clearInterval(h),h=g.setTimeout(function(){l(a)},100)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;if(null!==c)return c},formatResult:function(a,b,c,h){b=a&&a.c?a.c.select2Result(b):"";return""===b?h(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&la.test(a)?{id:a,text:a}:null},
formatNoMatches:k,formatSearching:function(){return c.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:k,formatSelectionTooBig:k,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,openOnEnter:!1});d.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),h=0,d=a.length,e=null,g=[];h<d;h++)if((e=a[h])&&e.id)e.c||(e.c=new s,(f=L.exec(c.trim(e.id)))&&!c.isUnd(f[2])?(e.c.name=
f[1],e.c.email=f[2]):e.c.email=e.id),g.push(e.c);b()(g)})},update:function(a,b){for(var c=d.utils.unwrapObservable(b()),e=0,f=c.length,g=null,i="",k=[];e<f;e++)g=c[e],i=g.toLine(!1),k.push({id:i,text:i,c:g});j(a).select2("data",k)}};d.bindingHandlers.command={init:function(a,b,c,e){var f=j(a),g=b();if(!g||!g.enabled||!g.canExecute)throw Error("You are not using command function");f.addClass("command");d.bindingHandlers[f.is("form")?"submit":"click"].init.apply(e,arguments)},update:function(a,b){var c=
!0,d=j(a),e=b(),c=e.enabled();d.toggleClass("command-not-enabled",!c);c&&(c=e.canExecute(),d.toggleClass("command-can-not-be-execute",!c));d.toggleClass("command-disabled disable disabled",!c);(d.is("input")||d.is("button"))&&d.prop("disabled",!c)}};d.extenders.trimmer=function(a){var b=d.computed({read:a,write:function(b){a(c.trim(b.toString()))},owner:this});b(a());return b};d.extenders.reversible=function(a){var b=a();a.commit=function(){b=a()};a.reverse=function(){a(b)};a.commitedValue=function(){return b};
return a};d.extenders.toggleSubscribe=function(a,b){a.subscribe(b[1],b[0],"beforeChange");a.subscribe(b[2],b[0]);return a};d.extenders.falseTimeout=function(a,b){a.iTimeout=0;a.subscribe(function(h){h&&(g.clearTimeout(a.iTimeout),a.iTimeout=g.setTimeout(function(){a(!1);a.iTimeout=0},c.pInt(b)))});return a};d.observable.fn.validateEmail=function(){this.hasError=d.observable(!1);this.subscribe(function(a){a=c.trim(a);this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this);this.valueHasMutated();
return this};d.observable.fn.validateFunc=function(a){this.hasFuncError=d.observable(!1);c.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated());return this};p.prototype.root=function(){return this.sBase};p.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};p.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a};p.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+
"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};p.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"};p.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"};p.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"};p.prototype.change=function(a){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+g.encodeURIComponent(a)+"/"};p.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+
a};p.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};p.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};p.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"};p.prototype.settings=function(a){var b=this.sBase+"settings";!c.isUnd(a)&&""!==a&&(b+="/"+a);return b};p.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};p.prototype.mailBox=function(a,b,h){var b=c.isNormal(b)?c.pInt(b):1,h=c.pString(h),d=this.sBase+"mailbox/";""!==a&&(d+=encodeURI(a));1<b&&(d=d.replace(/[\/]+$/,""),d+="/p"+b);""!==h&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(h));return d};p.prototype.phpInfo=function(){return this.sServer+"Info"};p.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"};p.prototype.getUserPicUrlFromHash=function(a){return this.sServer+
"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"};p.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"};p.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a};p.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+
"/images/preview.png"};p.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"};p.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};p.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};p.prototype.socialFacebook=function(){return this.sServer+
"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};o.oViewModelsHooks={};o.oSimpleHooks={};o.regViewModelHook=function(a,b){b&&(b.__hookName=a)};o.addHook=function(a,b){c.isFunc(b)&&(c.isArray(o.oSimpleHooks[a])||(o.oSimpleHooks[a]=[]),o.oSimpleHooks[a].push(b))};o.runHook=function(a,b){c.isArray(o.oSimpleHooks[a])&&(b=b||[],i.each(o.oSimpleHooks[a],function(a){a.apply(null,b)}))};o.mainSettingsGet=function(a){return e?e.settingsGet(a):null};o.remoteRequest=function(a,b,c,d,f,g){e&&
e.remote().defaultRequest(a,b,c,d,f,g)};o.settingsGet=function(a,b){var d=o.mainSettingsGet("Plugins");return(d=d&&c.isUnd(d[a])?null:d[a])?c.isUnd(d[b])?null:d[b]:null};M.supported=function(){return!0};M.prototype.set=function(a,b){var c=j.cookie(m.Values.ClientSideCookieIndexName),d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,j.cookie(m.Values.ClientSideCookieIndexName,JSON.stringify(e),{expires:30}),d=!0}catch(f){}return d};M.prototype.get=function(a){var b=j.cookie(m.Values.ClientSideCookieIndexName),
d=null;try{d=(d=null===b?null:JSON.parse(b))&&!c.isUnd(d[a])?d[a]:null}catch(e){}return d};N.supported=function(){return!!g.localStorage};N.prototype.set=function(a,b){var c=g.localStorage[m.Values.ClientSideCookieIndexName]||null,d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,g.localStorage[m.Values.ClientSideCookieIndexName]=JSON.stringify(e),d=!0}catch(f){}return d};N.prototype.get=function(a){var b=g.localStorage[m.Values.ClientSideCookieIndexName]||null,d=null;try{d=(d=null===
b?null:JSON.parse(b))&&!c.isUnd(d[a])?d[a]:null}catch(e){}return d};O.prototype.oDriver=null;O.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};O.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null};ga.prototype.bootstart=function(){};t.prototype.sPosition="";t.prototype.sTemplate="";t.prototype.viewModelName="";t.prototype.viewModelDom=null;t.prototype.viewModelTemplate=function(){return this.sTemplate};t.prototype.viewModelPosition=function(){return this.sPosition};
t.prototype.cancelCommand=t.prototype.closeCommand=function(){};w.prototype.oCross=null;w.prototype.sScreenName="";w.prototype.aViewModels=[];w.prototype.viewModels=function(){return this.aViewModels};w.prototype.screenName=function(){return this.sScreenName};w.prototype.routes=function(){return null};w.prototype.__cross=function(){return this.oCross};w.prototype.__start=function(){var a=this.routes(),b=null,d=null;c.isNonEmptyArray(a)&&(d=i.bind(this.onRoute||c.emptyFunction,this),b=fa.create(),
i.each(a,function(a){b.addRoute(a[0],d).rules=a[1]}),this.oCross=b)};q.prototype.sDefaultScreenName="";q.prototype.oScreens={};q.prototype.oBoot=null;q.prototype.oCurrentScreen=null;q.prototype.showLoading=function(){j("#rl-loading").show()};q.prototype.hideLoading=function(){j("#rl-loading").hide()};q.prototype.routeOff=function(){z.changed.active=!1};q.prototype.routeOn=function(){z.changed.active=!0};q.prototype.setBoot=function(a){c.isNormal(a)&&(this.oBoot=a);return this};q.prototype.screen=
function(a){return""!==a&&!c.isUnd(this.oScreens[a])?this.oScreens[a]:null};q.prototype.delegateRun=function(a,b,d){a&&a[b]&&a[b].apply(a,c.isArray(d)?d:[])};q.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var h=new a(b),f=h.viewModelPosition(),g=j("#rl-content #rl-"+f.toLowerCase()),i=null;a.__builded=!0;a.__vm=h;h.data=e.data();h.viewModelName=a.__name;g&&1===g.length?(i=j("<div>").addClass("rl-view-model").addClass("RL-"+h.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+
h.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(g),h.viewModelDom=i,a.__dom=i,"Popups"===f&&(h.cancelCommand=h.closeCommand=c.createCommand(h,function(){r.hideScreenPopup(a)})),o.runHook("view-model-pre-build",[a.__name,h,i]),d.applyBindings(h,i[0]),this.delegateRun(h,"onBuild",[i]),o.runHook("view-model-post-build",[a.__name,h,i])):c.log("Cannot find view model position: "+f)}return a?a.__vm:null};q.prototype.applyExternal=function(a,b){a&&b&&d.applyBindings(a,b)};q.prototype.hideScreenPopup=
function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),i.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};q.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),o.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};q.prototype.screenOnRoute=function(a,b){var d=
this,e=null,f=null;""===c.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){e=this.screen(a);if(!e&&(e=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;e&&e.__started&&(e.__builded||(e.__builded=!0,c.isNonEmptyArray(e.viewModels())&&i.each(e.viewModels(),function(a){this.buildViewModel(a,e)},this),this.delegateRun(e,"onBuild")),i.defer(function(){if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onHide");c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),
function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);d.delegateRun(a.__vm,"onHide")}})}d.oCurrentScreen=e;if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onShow");o.runHook("screen-on-show",[d.oCurrentScreen.screenName(),d.oCurrentScreen]);c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);
d.delegateRun(a.__vm,"onShow");o.runHook("view-model-on-show",[a.__name,a.__vm])}},d)}(f=e.__cross())&&f.parse(b)}))}};q.prototype.startScreens=function(a){i.each(a,function(a){var c=(a=new a)?a.screenName():"";a&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),o.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),o.runHook("screen-post-start",
[a.screenName(),a]))},this);a=fa.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));z.initialized.add(a.parse,a);z.changed.add(a.parse,a);z.init()};q.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):a;a="/"===a.substr(0,1)?a.substr(1):a;(c.isUnd(b)?0:b)?(z.changed.active=!1,z.setHash(a),z.changed.active=!0):(z.changed.active=!0,z.setHash(a))};q.prototype.bootstart=function(){this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart();return this};r=new q;
s.newInstanceFromJson=function(a){var b=new s;return b.initByJson(a)?b:null};s.prototype.name="";s.prototype.email="";s.prototype.privateType=null;s.prototype.validate=function(){return""!==this.name||""!==this.email};s.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"};s.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};s.prototype.type=function(){if(null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=
f.EmailType.Facebook),null===this.privateType))this.privateType=f.EmailType.Default;return this.privateType};s.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};s.prototype.parse=function(a){var a=c.trim(a),b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};s.prototype.initByJson=function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&
(this.name=c.trim(a.Name),this.email=c.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};s.prototype.toLine=function(a,b){var d="";""!==this.email&&(b=c.isUnd(b)?!1:!!b,a&&""!==this.name?d=b?'<a href="mailto:'+c.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.name)+"</a>":this.name:(d=this.email,""!==this.name?d=b?c.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+c.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+
c.encodeHtml(d)+"</a>"+c.encodeHtml(">"):'"'+this.name+'" <'+d+">":b&&(d='<a href="mailto:'+c.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.email)+"</a>")));return d};s.prototype.select2Result=function(){var a="",b=e.cache().getUserPic(this.email),a=""!==b?a+('<img class="select2-user-pic pull-left" src="'+c.encodeHtml(b)+'" />'):a+('<img class="select2-user-pic pull-left" src="'+e.link().emptyContactPic()+'" />');f.EmailType.Facebook===this.type()?(a+=""+(0<this.name.length?
this.name:this.email),a+='<i class="icon-facebook pull-right select2-icon-result" />'):a+=""+(0<this.name.length?this.email+' <span class="select2-subname">('+this.name+")</span>":this.email);return a+""};s.prototype.select2Selection=function(a){var b="";if(f.EmailType.Facebook===this.type()){if(b=0<this.name.length?this.name:this.email,""!==b)return j("<pan>").text(b).appendTo(a),a.append('<i class="icon-facebook select2-icon"></i>'),null}else b=0<this.name.length?this.name+" ("+this.email+")":this.email;
return b};c.extendAsViewModel("PopupsDomainViewModel",B);B.prototype.onTestConnectionResponse=function(a,b){this.testing(!1);f.StorageResultType.Success===a&&b.Result?(this.testingDone(!0),this.testingImapError(!1===b.Result.Imap),this.testingSmtpError(!1===b.Result.Smtp)):(this.testingImapError(!0),this.testingSmtpError(!0))};B.prototype.onDomainCreateOrSaveResponse=function(a,b){this.saving(!1);f.StorageResultType.Success===a&&b?b.Result?(e.reloadDomainList(),this.closeCommand()):f.Notification.DomainAlreadyExists===
b.ErrorCode&&this.savingError("Domain already exists"):this.savingError("Unknown error")};B.prototype.onHide=function(){this.whiteListPage(!1)};B.prototype.onShow=function(a){this.saving(!1);this.whiteListPage(!1);this.testing(!1);this.testingDone(!1);this.testingImapError(!1);this.testingSmtpError(!1);this.clearForm();a&&(this.edit(!0),this.name(c.trim(a.Name)),this.imapServer(c.trim(a.IncHost)),this.imapPort(c.pInt(a.IncPort)),this.imapSecure(c.trim(a.IncSecure)),this.smtpServer(c.trim(a.OutHost)),
this.smtpPort(c.pInt(a.OutPort)),this.smtpSecure(c.trim(a.OutSecure)),this.smtpAuth(!!a.OutAuth),this.whiteList(c.trim(a.WhiteList)))};B.prototype.clearForm=function(){this.edit(!1);this.whiteListPage(!1);this.savingError("");this.name("");this.imapServer("");this.imapPort(m.Values.ImapDefaulPort);this.imapSecure(f.ServerSecure.None);this.smtpServer("");this.smtpPort(m.Values.SmtpDefaulPort);this.smtpSecure(f.ServerSecure.None);this.smtpAuth(!0);this.whiteList("")};c.extendAsViewModel("PopupsPluginViewModel",
P);P.prototype.onPluginSettingsUpdateResponse=function(a,b){f.StorageResultType.Success===a&&b&&b.Result?this.cancelCommand():(this.saveError(""),b&&b.ErrorCode?this.saveError(c.getNotification(b.ErrorCode)):this.saveError(c.getNotification(f.Notification.CantSavePluginSettings)))};P.prototype.onShow=function(a){this.name();this.readme();this.configures([]);a&&(this.name(a.Name),this.readme(a.Readme),a=a.Config,c.isNonEmptyArray(a)&&this.configures(i.map(a,function(a){return{value:d.observable(a[0]),
Name:a[1],Type:a[2],Label:a[3],Default:a[4],Desc:a[5]}})))};c.extendAsViewModel("PopupsActivateViewModel",Q);Q.prototype.onShow=function(){this.domain(e.settingsGet("AdminDomain"));this.activateProcess()||(this.key(""),this.activateText(""),this.activateText.isError(!1),this.activationSuccessed(!1),this.key.focus(!0))};Q.prototype.validateSubscriptionKey=function(){var a=this.key();return""===a||!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(c.trim(a))};c.extendAsViewModel("PopupsLanguagesViewModel",R);R.prototype.onShow=
function(){this.exp(!0)};R.prototype.onHide=function(){this.exp(!1)};R.prototype.changeLanguage=function(a){e.data().mainLanguage(a);this.cancelCommand()};c.extendAsViewModel("AdminLoginViewModel",S);S.prototype.onShow=function(){r.routeOff();i.delay(i.bind(function(){this.loginFocus(!0)},this),100)};S.prototype.onHide=function(){this.loginFocus(!1)};c.extendAsViewModel("AdminMenuViewModel",X);X.prototype.link=function(a){return"#/"+a};c.extendAsViewModel("AdminPaneViewModel",Y);Y.prototype.logoutClick=
function(){e.remote().adminLogout(function(){e.loginAndLogoutReload()})};c.addSettingsViewModel(ha,"AdminGeneral","General","general",!0);ha.prototype.onBuild=function(){var a=this;i.delay(function(){var b=c.settingsSaveHelperSimpleFunction(a.titleTrigger,a),d=c.settingsSaveHelperSimpleFunction(a.languageTrigger,a),f=c.settingsSaveHelperSimpleFunction(a.themeTrigger,a);a.title.subscribe(function(a){e.remote().saveAdminConfig(b,{Title:c.trim(a)})});a.language.subscribe(function(a){e.remote().saveAdminConfig(d,
{Language:c.trim(a)})});a.theme.subscribe(function(a){e.remote().saveAdminConfig(f,{Theme:c.trim(a)})});a.allowCustomTheme.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowCustomTheme:a?"1":"0"})});a.allowAdditionalAccounts.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowAdditionalAccounts:a?"1":"0"})});a.determineUserLanguage.subscribe(function(a){e.remote().saveAdminConfig(null,{DetermineUserLanguage:a?"1":"0"})});a.allowThemes.subscribe(function(a){e.remote().saveAdminConfig(null,
{AllowThemes:a?"1":"0"})});a.allowCustomLogin.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowCustomLogin:a?"1":"0"})});a.allowLanguagesOnLogin.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowLanguagesOnLogin:a?"1":"0"})});a.allowLanguagesOnSettings.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowLanguagesOnSettings:a?"1":"0"})})},50)};c.addSettingsViewModel(C,"AdminDomains","Domains","domains");C.prototype.startDomainForDeletionTimeout=function(){var a=this;g.clearInterval(this.iDomainForDeletionTimeout);
this.iDomainForDeletionTimeout=g.setTimeout(function(){a.domainForDeletion(null)},3E3)};C.prototype.createDomain=function(){r.showScreenPopup(B)};C.prototype.deleteDomain=function(a){this.domains.remove(a);e.remote().domainDelete(i.bind(this.onDomainListChangeRequest,this),a.name)};C.prototype.disableDomain=function(a){a.disabled(!a.disabled());e.remote().domainDisable(i.bind(this.onDomainListChangeRequest,this),a.name,a.disabled())};C.prototype.onBuild=function(a){var b=this;a.on("click",".b-admin-domains-list-table .e-item .e-action",
function(){var a=d.dataFor(this);a&&e.remote().domain(i.bind(b.onDomainLoadRequest,b),a.name)});e.reloadDomainList()};C.prototype.onDomainLoadRequest=function(a,b){f.StorageResultType.Success===a&&(b&&b.Result)&&r.showScreenPopup(B,[b.Result])};C.prototype.onDomainListChangeRequest=function(){e.reloadDomainList()};c.addSettingsViewModel(J,"AdminLicensing","Licensing","licensing");J.prototype.onBuild=function(){this.subscriptionEnabled()&&e.reloadLicensing(!1)};J.prototype.onShow=function(){this.adminDomain(e.settingsGet("AdminDomain"))};
J.prototype.showActivationForm=function(){r.showScreenPopup(Q)};J.prototype.licenseExpiredMomentValue=function(){var a=moment.unix(this.licenseExpired());return a.format("LL")+" ("+a.from(moment())+")"};c.addSettingsViewModel(K,"AdminSecurity","Security","security");K.prototype.onNewAdminPasswordResponse=function(a,b){f.StorageResultType.Success===a&&b&&b.Result?(this.adminPassword(""),this.adminPasswordNew(""),this.adminPasswordUpdateSuccess(!0)):this.adminPasswordUpdateError(!0)};K.prototype.onBuild=
function(){this.csrfProtection.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{TokenProtection:a?"1":"0"})});this.usageStatistics.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{UsageStatistics:a?"1":"0"})})};K.prototype.onHide=function(){this.adminPassword("");this.adminPasswordNew("")};K.prototype.phpInfoLink=function(){return e.link().phpInfo()};c.addSettingsViewModel(ia,"AdminSocial","Social","social");ia.prototype.onBuild=function(){var a=this;i.delay(function(){var b=
c.settingsSaveHelperSimpleFunction(a.facebookTrigger1,a),d=c.settingsSaveHelperSimpleFunction(a.facebookTrigger2,a),f=c.settingsSaveHelperSimpleFunction(a.twitterTrigger1,a),g=c.settingsSaveHelperSimpleFunction(a.twitterTrigger2,a),i=c.settingsSaveHelperSimpleFunction(a.googleTrigger1,a),j=c.settingsSaveHelperSimpleFunction(a.googleTrigger2,a),k=c.settingsSaveHelperSimpleFunction(a.dropboxTrigger1,a);a.facebookEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{FacebookEnable:a?
"1":"0"})});a.facebookAppID.subscribe(function(a){e.remote().saveAdminConfig(b,{FacebookAppID:c.trim(a)})});a.facebookAppSecret.subscribe(function(a){e.remote().saveAdminConfig(d,{FacebookAppSecret:c.trim(a)})});a.twitterEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{TwitterEnable:a?"1":"0"})});a.twitterConsumerKey.subscribe(function(a){e.remote().saveAdminConfig(f,{TwitterConsumerKey:c.trim(a)})});a.twitterConsumerSecret.subscribe(function(a){e.remote().saveAdminConfig(g,
{TwitterConsumerSecret:c.trim(a)})});a.googleEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{GoogleEnable:a?"1":"0"})});a.googleClientID.subscribe(function(a){e.remote().saveAdminConfig(i,{GoogleClientID:c.trim(a)})});a.googleClientSecret.subscribe(function(a){e.remote().saveAdminConfig(j,{GoogleClientSecret:c.trim(a)})});a.dropboxEnable.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{DropboxEnable:a?"1":"0"})});a.dropboxApiKey.subscribe(function(a){e.remote().saveAdminConfig(k,
{DropboxApiKey:c.trim(a)})})},50)};c.addSettingsViewModel(E,"AdminPlugins","Plugins","plugins");E.prototype.disablePlugin=function(a){a.disabled(!a.disabled());e.remote().pluginDisable(this.onPluginDisableRequest,a.name,a.disabled())};E.prototype.configurePlugin=function(a){e.remote().plugin(this.onPluginLoadRequest,a.name)};E.prototype.onBuild=function(){this.enabledPlugins.subscribe(function(a){e.remote().saveAdminConfig(c.emptyFunction,{EnabledPlugins:a?"1":"0"})})};E.prototype.onShow=function(){this.pluginsError("");
e.reloadPluginList()};E.prototype.onPluginLoadRequest=function(a,b){f.StorageResultType.Success===a&&(b&&b.Result)&&r.showScreenPopup(P,[b.Result])};E.prototype.onPluginDisableRequest=function(a,b){f.StorageResultType.Success===a&&b&&!b.Result&&b.ErrorCode&&(f.Notification.UnsupportedPluginPackage===b.ErrorCode&&b.ErrorMessage&&""!==b.ErrorMessage?this.pluginsError(b.ErrorMessage):this.pluginsError(c.getNotification(b.ErrorCode)));e.reloadPluginList()};c.addSettingsViewModel(I,"AdminPackages","Packages",
"packages");I.prototype.onShow=function(){this.packagesError("")};I.prototype.onBuild=function(){e.reloadPackagesList()};I.prototype.requestHelper=function(a,b){var d=this;return function(j,k){if(f.StorageResultType.Success!==j||!k||!k.Result)k&&k.ErrorCode?d.packagesError(c.getNotification(k.ErrorCode)):d.packagesError(c.getNotification(b?f.Notification.CantInstallPackage:f.Notification.CantDeletePackage));i.each(e.data().packages(),function(b){b&&(a&&b.loading()&&a.file===b.file)&&(a.loading(!1),
b.loading(!1))});f.StorageResultType.Success===j&&k&&k.Result&&k.Result.Reload?g.location.reload():e.reloadPackagesList()}};I.prototype.deletePackage=function(a){a&&(a.loading(!0),e.remote().packageDelete(this.requestHelper(a,!1),a))};I.prototype.installPackage=function(a){a&&(a.loading(!0),e.remote().packageInstall(this.requestHelper(a,!0),a))};Z.prototype.populateDataOnStart=function(){var a=e.settingsGet("Languages"),b=e.settingsGet("Themes");c.isArray(a)&&this.languages(a);c.isArray(b)&&this.themes(b);
this.mainLanguage(e.settingsGet("Language"));this.mainTheme(e.settingsGet("Theme"));this.allowCustomTheme(!!e.settingsGet("AllowCustomTheme"));this.allowAdditionalAccounts(!!e.settingsGet("AllowAdditionalAccounts"));this.determineUserLanguage(!!e.settingsGet("DetermineUserLanguage"));this.allowThemes(!!e.settingsGet("AllowThemes"));this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"));this.allowLanguagesOnLogin(!!e.settingsGet("AllowLanguagesOnLogin"));this.allowLanguagesOnSettings(!!e.settingsGet("AllowLanguagesOnSettings"));
this.ignoreFolderSubscribe(!!e.settingsGet("IgnoreFolderSubscribe"));this.editorDefaultType(e.settingsGet("EditorDefaultType"));this.showImages(!!e.settingsGet("ShowImages"));this.showAnimation(!!e.settingsGet("ShowAnimation"));this.mainMessagesPerPage(e.settingsGet("MPP"));this.desktopNotifications(!!e.settingsGet("DesktopNotifications"));this.useThreads(!!e.settingsGet("UseThreads"));this.replySameFolder(!!e.settingsGet("ReplySameFolder"));this.usePreviewPane(!!e.settingsGet("UsePreviewPane"));
this.useCheckboxesInList(!!e.settingsGet("UseCheckboxesInList"));this.facebookEnable(!!e.settingsGet("AllowFacebookSocial"));this.facebookAppID(e.settingsGet("FacebookAppID"));this.facebookAppSecret(e.settingsGet("FacebookAppSecret"));this.twitterEnable(!!e.settingsGet("AllowTwitterSocial"));this.twitterConsumerKey(e.settingsGet("TwitterConsumerKey"));this.twitterConsumerSecret(e.settingsGet("TwitterConsumerSecret"));this.googleEnable(!!e.settingsGet("AllowGoogleSocial"));this.googleClientID(e.settingsGet("GoogleClientID"));
this.googleClientSecret(e.settingsGet("GoogleClientSecret"));this.dropboxEnable(!!e.settingsGet("AllowDropboxSocial"));this.dropboxApiKey(e.settingsGet("DropboxApiKey"));this.contactsIsSupported(!!e.settingsGet("ContactsIsSupported"));this.contactsIsAllowed(!!e.settingsGet("ContactsIsAllowed"))};i.extend(aa.prototype,Z.prototype);aa.prototype.populateDataOnStart=function(){Z.prototype.populateDataOnStart.call(this)};F.prototype.oRequests={};F.prototype.defaultResponse=function(a,b,d,j,l,m){var p=
function(){f.StorageResultType.Success!==d&&k.bUnload&&(d=f.StorageResultType.Unload);if(f.StorageResultType.Success===d&&j&&!j.Result){if(j&&-1<c.inArray(j.ErrorCode,[f.Notification.AuthError,f.Notification.AccessError,f.Notification.ConnectionError,f.Notification.DomainNotAllowed,f.Notification.AccountNotAllowed,f.Notification.MailServerError,f.Notification.UnknownNotification,f.Notification.UnknownError])&&k.iAjaxErrorCount++,j&&f.Notification.InvalidToken===j.ErrorCode&&k.iTokenErrorCount++,10<
k.iTokenErrorCount&&e.loginAndLogoutReload(!0),j.Logout||7<k.iAjaxErrorCount)g.__rlah_clear&&g.__rlah_clear(),e.loginAndLogoutReload(!0)}else f.StorageResultType.Success===d&&(j&&j.Result)&&(k.iAjaxErrorCount=0,k.iTokenErrorCount=0);a&&(o.runHook("ajax-default-response",[b,f.StorageResultType.Success===d?j:null,d,l,m]),a(d,f.StorageResultType.Success===d?j:null,l,b,m))};switch(d){case "success":d=f.StorageResultType.Success;break;case "abort":d=f.StorageResultType.Abort;break;default:d=f.StorageResultType.Error}f.StorageResultType.Error===
d?i.delay(p,300):p()};F.prototype.ajaxRequest=function(a,b,d,f,k){var l=this,m=""===f,p=(new g.Date).getTime(),o=null,n="",b=b||{},d=c.isNormal(d)?d:2E4,f=c.isUnd(f)?"":c.pString(f),k=c.isArray(k)?k:[];(n=b.Action||"")&&0<k.length&&i.each(k,function(a){l.oRequests[a]&&(l.oRequests[a].__aborted=!0,l.oRequests[a].abort&&l.oRequests[a].abort(),l.oRequests[a]=null)});m&&(b.XToken=e.settingsGet("Token"));o=j.ajax({type:m?"POST":"GET",url:e.link().ajax(f),async:!0,dataType:"json",data:m?b:{},headers:{},
timeout:d,global:!0});o.always(function(d,e){var f=!1;d&&d.Time&&(f=c.pInt(d.Time)>(new g.Date).getTime()-p);n&&l.oRequests[n]&&(l.oRequests[n].__aborted&&(e="abort"),l.oRequests[n]=null);l.defaultResponse(a,n,e,d,f,b)});n&&(0<k.length&&-1<c.inArray(n,k))&&(this.oRequests[n]&&(this.oRequests[n].__aborted=!0,this.oRequests[n].abort&&this.oRequests[n].abort(),this.oRequests[n]=null),this.oRequests[n]=o);return o};F.prototype.defaultRequest=function(a,b,d,e,f,g){d=d||{};d.Action=b;f=c.pString(f);o.runHook("ajax-default-request",
[b,d,f]);this.ajaxRequest(a,d,c.isUnd(e)?m.Defaults.DefaultAjaxTimeout:c.pInt(e),f,g)};F.prototype.noop=function(a){this.defaultRequest(a,"Noop")};F.prototype.jsError=function(a,b,c,d,e,f){this.defaultRequest(a,"JsError",{Message:b,FileName:c,LineNo:d,Location:e,HtmlCapa:f})};i.extend(n.prototype,F.prototype);n.prototype.adminLogin=function(a,b,c){this.defaultRequest(a,"AdminLogin",{Login:b,Password:c})};n.prototype.adminLogout=function(a){this.defaultRequest(a,"AdminLogout")};n.prototype.saveAdminConfig=
function(a,b){this.defaultRequest(a,"AdminSettingsUpdate",b)};n.prototype.domainList=function(a){this.defaultRequest(a,"AdminDomainList")};n.prototype.pluginList=function(a){this.defaultRequest(a,"AdminPluginList")};n.prototype.packagesList=function(a){this.defaultRequest(a,"AdminPackagesList")};n.prototype.packageInstall=function(a,b){this.defaultRequest(a,"AdminPackageInstall",{Id:b.id,Type:b.type,File:b.file})};n.prototype.packageDelete=function(a,b){this.defaultRequest(a,"AdminPackageDelete",
{Id:b.id})};n.prototype.domain=function(a,b){this.defaultRequest(a,"AdminDomainLoad",{Name:b})};n.prototype.plugin=function(a,b){this.defaultRequest(a,"AdminPluginLoad",{Name:b})};n.prototype.domainDelete=function(a,b){this.defaultRequest(a,"AdminDomainDelete",{Name:b})};n.prototype.domainDisable=function(a,b,c){return this.defaultRequest(a,"AdminDomainDisable",{Name:b,Disabled:c?"1":"0"})};n.prototype.pluginSettingsUpdate=function(a,b){return this.defaultRequest(a,"AdminPluginSettingsUpdate",b)};
n.prototype.licensing=function(a,b){return this.defaultRequest(a,"AdminLicensing",{Force:b?"1":"0"})};n.prototype.licensingActivate=function(a,b,c){return this.defaultRequest(a,"AdminLicensingActivate",{Domain:b,Key:c})};n.prototype.pluginDisable=function(a,b,c){return this.defaultRequest(a,"AdminPluginDisable",{Name:b,Disabled:c?"1":"0"})};n.prototype.createOrUpdateDomain=function(a,b,c,d,e,f,g,i,j,k,l){this.defaultRequest(a,"AdminDomainSave",{Create:b?"1":"0",Name:c,IncHost:d,IncPort:e,IncSecure:f,
OutHost:g,OutPort:i,OutSecure:j,OutAuth:k?"1":"0",WhiteList:l})};n.prototype.testConnectionForDomain=function(a,b,c,d,e,f,g,i){this.defaultRequest(a,"AdminDomainTest",{IncHost:b,IncPort:c,IncSecure:d,OutHost:e,OutPort:f,OutSecure:g,OutAuth:i?"1":"0"})};n.prototype.saveNewAdminPassword=function(a,b){this.defaultRequest(a,"AdminPasswordUpdate",b)};n.prototype.adminPing=function(a){this.defaultRequest(a,"AdminPing")};D.prototype.oEmailsPicsHashes={};D.prototype.oServices={};D.prototype.clear=function(){this.oServices=
{};this.oEmailsPicsHashes={}};D.prototype.getUserPic=function(a){var b="",b="",b=a.toLowerCase(),d=c.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];""===d?(b=b.substr(a.indexOf("@")+1),b=""!==b&&this.oServices[b]?this.oServices[b]:""):b=e.link().getUserPicUrlFromHash(d);return b};D.prototype.setServicesData=function(a){this.oServices=a};D.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a};i.extend(ja.prototype,D.prototype);i.extend(G.prototype,w.prototype);G.prototype.onRoute=
function(a){var b=this,f=null,g=null,k=null,l=null;if(g=i.find(A.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}))i.find(A["settings-removed"],function(a){return a&&a===g})&&(g=null),g&&i.find(A["settings-disabled"],function(a){return a&&a===g})&&(g=null);g&&(g.__builded&&g.__vm?f=g.__vm:(k=this.oViewModelPlace)&&1===k.length?(f=new g,l=j("<div></div>").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),
l.appendTo(k),f.data=e.data(),f.viewModelDom=l,f.viewModelDom.addClass("rl-animation-margin"),f.__rlSettingsData=g.__rlSettingsData,g.__dom=l,g.__builded=!0,g.__vm=f,d.applyBindings(f,l[0]),r.delegateRun(f,"onBuild",[l])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),f&&i.defer(function(){if(b.oCurrentSubScreen){r.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide();b.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin")}b.oCurrentSubScreen=
f;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();r.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(f&&f.__rlSettingsData&&a.route===f.__rlSettingsData.Route)});j("#rl-content .b-settings .b-content .content").scrollTop(0);b.oCurrentSubScreen.viewModelDom.removeClass("rl-animation-margin")}c.windowResize()}))};G.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(r.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide(),
this.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin"))};G.prototype.onBuild=function(){i.each(A.settings,function(a){a&&(a.__rlSettingsData&&!i.find(A["settings-removed"],function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:d.observable(!1),disabled:!!i.find(A["settings-disabled"],function(b){return b&&b===a})})},this);this.oViewModelPlace=j("#rl-content #rl-settings-subscreen")};G.prototype.routes=function(){var a=i.find(A.settings,
function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,d){d.subname=c.isUnd(d.subname)?b:c.pString(d.subname);return[d.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(ba.prototype,w.prototype);ba.prototype.onShow=function(){e.setTitle("")};i.extend(ca.prototype,G.prototype);ca.prototype.onShow=function(){e.setTitle("")};i.extend(u.prototype,ga.prototype);u.prototype.oSettings=null;
u.prototype.oLink=null;u.prototype.download=function(a){k.bMobileDevice?g.open(a):this.iframe.attr("src",a)};u.prototype.link=function(){null===this.oLink&&(this.oLink=new p);return this.oLink};u.prototype.local=function(){null===this.oLocal&&(this.oLocal=new O);return this.oLocal};u.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=c.isNormal(U)?U:{});return c.isUnd(this.oSettings[a])?null:this.oSettings[a]};u.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=
c.isNormal(U)?U:{});this.oSettings[a]=b};u.prototype.setTitle=function(a){a=(0<a.length?a+" - ":"")+this.settingsGet("Title")||"";a!==g.document.title&&(g.document.title=a)};u.prototype.loginAndLogoutReload=function(a,b){var d=c.pString(this.settingsGet("CustomLogoutLink")),f=!!this.settingsGet("InIframe"),a=c.isUnd(a)?!1:!!a,b=c.isUnd(b)?!1:!!b;a&&(b&&g.close)&&g.close();a&&""!==d&&g.location.href!==d?i.defer(function(){f&&g.parent?g.parent.location.href=d:g.location.href=d}):(r.routeOff(),r.setHash(e.link().root(),
!0),r.routeOff(),i.defer(function(){f&&g.parent?g.parent.location.reload():g.location.reload()}))};u.prototype.getAutocomplete=function(a,b,c){c([],a)};u.prototype.bootstart=function(){c.initOnStartOrLangChange(function(){c.initNotificationLanguage()},null);i.delay(function(){c.windowResize()},1E3)};i.extend(v.prototype,u.prototype);v.prototype.oData=null;v.prototype.oRemote=null;v.prototype.oCache=null;v.prototype.data=function(){null===this.oData&&(this.oData=new aa);return this.oData};v.prototype.remote=
function(){null===this.oRemote&&(this.oRemote=new n);return this.oRemote};v.prototype.cache=function(){null===this.oCache&&(this.oCache=new ja);return this.oCache};v.prototype.reloadDomainList=function(){e.data().domainsLoading(!0);e.remote().domainList(function(a,b){e.data().domainsLoading(!1);if(f.StorageResultType.Success===a&&b&&b.Result){var c=i.map(b.Result,function(a,b){return{name:b,disabled:d.observable(!a),deleteAccess:d.observable(!1)}},this);e.data().domains(c)}})};v.prototype.reloadPluginList=
function(){e.data().pluginsLoading(!0);e.remote().pluginList(function(a,b){e.data().pluginsLoading(!1);if(f.StorageResultType.Success===a&&b&&b.Result){var c=i.map(b.Result,function(a){return{name:a.Name,disabled:d.observable(!a.Enabled),configured:d.observable(!!a.Configured)}},this);e.data().plugins(c)}})};v.prototype.reloadPackagesList=function(){e.data().packagesLoading(!0);e.data().packagesReal(!0);e.remote().packagesList(function(a,b){e.data().packagesLoading(!1);if(f.StorageResultType.Success===
a&&b&&b.Result){e.data().packagesReal(!!b.Result.Real);e.data().packagesMainUpdatable(!!b.Result.MainUpdatable);var g=[],j={};i.each(e.data().packages(),function(a){a&&a.loading()&&(j[a.file]=a)});c.isArray(b.Result.List)&&(g=i.map(b.Result.List,function(a){a.loading=d.observable(!c.isUnd(j[a.file]));return a},this));e.data().packages(g)}else e.data().packagesReal(!1)})};v.prototype.reloadLicensing=function(a){a=c.isUnd(a)?!1:!!a;e.data().licensingProcess(!0);e.data().licenseError("");e.remote().licensing(function(a,
d){e.data().licensingProcess(!1);f.StorageResultType.Success===a&&d&&d.Result&&c.isNormal(d.Result.Expired)?(e.data().licenseValid(!0),e.data().licenseExpired(c.pInt(d.Result.Expired)),e.data().licenseError(""),e.data().licensing(!0)):d&&d.ErrorCode&&-1<c.inArray(c.pInt(d.ErrorCode),[f.Notification.LicensingServerIsUnavailable,f.Notification.LicensingExpired])?(e.data().licenseError(c.getNotification(c.pInt(d.ErrorCode))),e.data().licensing(!0)):f.StorageResultType.Abort===a?(e.data().licenseError(c.getNotification(f.Notification.LicensingServerIsUnavailable)),
e.data().licensing(!0)):e.data().licensing(!1)},a)};v.prototype.bootstart=function(){u.prototype.bootstart.call(this);e.data().populateDataOnStart();r.hideLoading();this.settingsGet("AllowAdminPanel")?this.settingsGet("Auth")?(r.startScreens([ca]),k.bMobileDevice||i.defer(function(){c.initLayoutResizer("#rl-top-resizer-left","#rl-top-resizer-right","#rl-center",120,300,200,600,f.ClientSideKeyName.FolderListSize)})):r.startScreens([ba]):(r.routeOff(),r.setHash(e.link().root(),!0),r.routeOff(),i.defer(function(){g.location.href=
"/"}));g.SimplePace&&g.SimplePace.set(100)};e=new v;T.addClass(k.bMobileDevice?"mobile":"no-mobile");H.keydown(c.killCtrlAandS).keyup(c.killCtrlAandS);H.unload(function(){k.bUnload=!0});g.rl=g.rl||{};g.rl.addHook=o.addHook;g.rl.settingsGet=o.mainSettingsGet;g.rl.remoteRequest=o.remoteRequest;g.rl.pluginSettingsGet=o.settingsGet;g.rl.addSettingsViewModel=c.addSettingsViewModel;g.rl.createCommand=c.createCommand;g.rl.EmailModel=s;g.rl.Enums=f;g.__RLBOOT=function(a){j(function(){g.rainloopTEMPLATES&&
g.rainloopTEMPLATES[0]?(j("#rl-templates").html(g.rainloopTEMPLATES[0]),g.setInterval(function(){k.minuteTick(!k.minuteTick())},6E4),g.setInterval(function(){k.fiveMinuteTick(!k.fiveMinuteTick())},3E5),i.delay(function(){g.rainloopAppData={};g.rainloopI18N={};g.rainloopTEMPLATES={};r.setBoot(e).bootstart()},50)):a(!1);g.__RLBOOT=null})};g.SimplePace&&g.SimplePace.add(10)})(window,jQuery,ko,crossroads,hasher,_);

View file

@ -1,388 +0,0 @@
(function(h,j,f,Ra,R,fa,xa,i){function C(){this.sBase="#/";this.sCdnStaticDomain=e.settingsGet("CdnStaticDomain");this.sVersion=e.settingsGet("Version");this.sSpecSuffix=e.settingsGet("AuthAccountHash")||"0";this.sServer=(e.settingsGet("IndexFile")||"./")+"?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function u(a,b,c,l){this.oOptions=l=j.extend({DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",
LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"},d.isUnd(l)?{}:l);this.bOnlyPlain=!!this.oOptions.DisableHtml;this.fOnSwitch=this.oOptions.onSwitch;this.textarea=j(a).empty().addClass("editorTextArea");this.htmlarea=j(b).empty().addClass("editorHtmlArea").prop("contentEditable","true");this.toolbar=j(c).empty().addClass("editorToolbar");u.htmlInitEditor.apply(this);u.htmlInitToolbar.apply(this);u.htmlAttachEditorEvents.apply(this);this.bOnlyPlain&&
this.toolbar.hide()}function M(a,b,c,l,e){this.list=a;this.selectedItem=b;this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.oContentScrollable=this.oContentVisible=null;this.sItemSelector=c;this.sItemSelectedSelector=l;this.sItemCheckedSelector=e;this.sLastUid="";this.oCallbacks={};this.iSelectTimer=0;this.bUseKeyboard=!0;this.emptyFunction=function(){};this.useItemSelectCallback=!0;this.throttleSelection=!1;this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&
(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],k=null;this.list.subscribe(function(){var a=this,b=this.list();d.isArray(b)&&i.each(b,function(b){b.checked()&&g.push(a.getItemUid(b));null===k&&b.selected()&&(k=a.getItemUid(b))})},this,"beforeChange");this.list.subscribe(function(a){this.useItemSelectCallback=!1;this.selectedItem(null);if(d.isArray(a)){var b=this,c=g.length;i.each(a,function(a){0<c&&-1<d.inArray(b.getItemUid(a),
g)&&(a.checked(!0),c--);null!==k&&k===b.getItemUid(a)&&(a.selected(!0),k=null,b.selectedItem(a))})}this.useItemSelectCallback=!0;g=[];k=null},this);this.list.setSelectedByUid=function(a){f.selectByUid(a,!1)};this.selectItemCallbacksThrottle=i.debounce(this.selectItemCallbacks,300)}function ya(){}function za(){}function Aa(){var a=i.find([za,ya],function(a){return a.supported()});a&&(this.oDriver=new a)}function Sa(){}function D(a,b){this.sPosition=d.pString(a);this.sTemplate=d.pString(b);this.viewModelName=
"";this.viewModelVisibility=f.observable(!1);"Popups"===this.sPosition&&(this.modalVisibility=f.observable(!1));this.viewModelDom=null}function L(a,b){this.sScreenName=a;this.aViewModels=d.isArray(b)?b:[]}function F(){this.sDefaultScreenName="";this.oScreens={};this.oCurrentScreen=this.oBoot=null;this.popupVisibility=f.observable(!1);this.popupVisibility.subscribe(function(a){e&&e.popupVisibility(a)})}function G(a,b){this.email=a||"";this.name=b||"";this.privateType=null;this.clearDuplicateName()}
function qa(){this.idContact=0;this.name=this.listName=this.imageHash="";this.emails=[];this.checked=f.observable(!1);this.selected=f.observable(!1);this.deleted=f.observable(!1)}function E(){this.fileName=this.mimeType="";this.estimatedSize=0;this.friendlySize="";this.isLinked=this.isInline=!1;this.mimeIndex=this.uid=this.folder=this.download=this.cidWithOutTags=this.cid=""}function O(a,b,c,l,e,t){this.id=a;this.isInline=d.isUnd(l)?!1:!!l;this.isLinked=d.isUnd(e)?!1:!!e;this.CID=d.isUnd(t)?"":t;
this.fromMessage=!1;this.fileName=f.observable(b);this.size=f.observable(d.isUnd(c)?null:c);this.tempName=f.observable("");this.progress=f.observable("");this.error=f.observable("");this.waiting=f.observable(!0);this.uploading=f.observable(!1);this.enabled=f.observable(!0);this.friendlySize=f.computed(function(){return null===this.size()?"":d.friendlySize(this.size())},this)}function m(){this.requestHash=this.uid=this.folderFullNameRaw="";this.subject=f.observable("");this.size=f.observable(0);this.dateTimeStampInUTC=
f.observable(0);this.priority=f.observable(g.MessagePriority.Normal);this.fromEmailString=f.observable("");this.toEmailsString=f.observable("");this.senderEmailsString=f.observable("");this.prefetched=!1;this.emails=[];this.from=[];this.to=[];this.cc=[];this.bcc=[];this.replyTo=[];this.newForAnimation=f.observable(!1);this.deleted=f.observable(!1);this.unseen=f.observable(!1);this.flagged=f.observable(!1);this.answered=f.observable(!1);this.forwarded=f.observable(!1);this.selected=f.observable(!1);
this.checked=f.observable(!1);this.hasAttachments=f.observable(!1);this.moment=f.observable(fa());this.fullFormatDateValue=f.computed(function(){return m.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this);this.fullFormatDateValue=f.computed(function(){return m.calculateFullFromatDateValue(this.dateTimeStampInUTC())},this);this.momentDate=d.createMomentDate(this);this.momentShortDate=d.createMomentShortDate(this);this.dateTimeStampInUTC.subscribe(function(a){var b=fa().unix();this.moment(fa.unix(b<
a?b:a))},this);this.body=null;this.isRtl=f.observable(!1);this.isHtml=f.observable(!1);this.hasImages=f.observable(!1);this.attachments=f.observableArray([]);this.priority=f.observable(g.MessagePriority.Normal);this.aDraftInfo=[];this.sReferences=this.sInReplyTo=this.sMessageId="";this.parentUid=f.observable(0);this.threads=f.observableArray([]);this.threadsLen=f.observable(0);this.hasUnseenSubMessage=f.observable(!1);this.hasFlaggedSubMessage=f.observable(!1);this.lastInCollapsedThread=f.observable(!1);
this.lastInCollapsedThreadLoading=f.observable(!1);this.threadsLenResult=f.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&0<a?a+1:""},this)}function I(){this.name=f.observable("");this.namespace=this.delimiter=this.fullNameHash=this.fullNameRaw=this.fullName="";this.deep=0;this.selectable=!1;this.existen=!0;this.isUnpaddigFolder=this.isGmailFolder=this.isNamespaceFolder=!1;this.type=f.observable(g.FolderType.User);this.selected=f.observable(!1);this.edited=f.observable(!1);
this.collapsed=f.observable(!0);this.subScribed=f.observable(!0);this.subFolders=f.observableArray([]);this.deleteAccess=f.observable(!1);this.actionBlink=f.observable(!1).extend({falseTimeout:1E3});this.nameForEdit=f.observable("");this.name.subscribe(function(a){this.nameForEdit(a)},this);this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this);this.canBeEdited=f.computed(function(){return g.FolderType.User===this.type()},this);this.privateMessageCountAll=f.observable(0);this.privateMessageCountUnread=
f.observable(0);this.collapsedPrivate=f.observable(!0)}function La(a,b){this.email=a;this.deleteAccess=f.observable(!1);this.canBeDalete=f.observable(b)}function Ba(){D.call(this,"Popups","PopupsFolderClear");this.selectedFolder=f.observable(null);this.clearingProcess=f.observable(!1);this.clearingError=f.observable("");this.folderFullNameForClear=f.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this);this.folderNameForClear=f.computed(function(){var a=this.selectedFolder();
return a?a.localName():""},this);this.dangerDescHtml=f.computed(function(){return d.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this);this.clearCommand=d.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(e.data().message(null),e.data().messageList([]),this.clearingProcess(!0),e.cache().setFolderHash(b.fullNameRaw,""),e.remote().folderClear(function(b,l){a.clearingProcess(!1);g.StorageResultType.Success===b&&l&&l.Result?(e.reloadMessageList(!0),
a.cancelCommand()):l&&l.ErrorCode?a.clearingError(d.getNotification(l.ErrorCode)):a.clearingError(d.getNotification(g.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder();return!this.clearingProcess()&&null!==a})}function ia(){D.call(this,"Popups","PopupsFolderCreate");d.initOnStartOrLangChange(function(){this.sNoParentText=d.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this);this.folderName=f.observable("");this.focusTrigger=f.observable(!1);this.selectedParentValue=
f.observable(o.Values.UnuseOptionValue);this.parentFolderSelectList=f.computed(function(){var a=e.data(),b=[],c=null,l=a.folderList();b.push(["",this.sNoParentText]);""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)});return e.folderListOptionsBuilder([],l,[],b,null,c,null,function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""})},this);this.createFolder=d.createCommand(this,function(){var a=e.data(),b=this.selectedParentValue();
""===b&&1<a.namespace.length&&(b=a.namespace.substr(0,a.namespace.length-1));a.foldersCreating(!0);e.remote().folderCreate(function(a,b){e.data().foldersCreating(!1);g.StorageResultType.Success===a&&b&&b.Result?e.folders(!1):e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"))},this.folderName(),b);this.cancelCommand()},function(){return this.simpleFolderNameValidation(this.folderName())});this.defautOptionsAfterRender=d.defautOptionsAfterRender}
function ba(){D.call(this,"Popups","PopupsFolderSystem");d.initOnStartOrLangChange(function(){this.sChooseOnText=d.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE");this.sUnuseText=d.i18n("POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME")},this);this.notification=f.observable("");this.folderSelectList=f.computed(function(){return e.folderListOptionsBuilder([],e.data().folderList(),e.data().folderListSystemNames(),[["",this.sChooseOnText],[o.Values.UnuseOptionValue,this.sUnuseText]])},this);var a=e.data(),b=
this,c=null,l=null;this.sentFolder=a.sentFolder;this.draftFolder=a.draftFolder;this.spamFolder=a.spamFolder;this.trashFolder=a.trashFolder;c=i.debounce(function(){e.settingsSet("SentFolder",b.sentFolder());e.settingsSet("DraftFolder",b.draftFolder());e.settingsSet("SpamFolder",b.spamFolder());e.settingsSet("TrashFolder",b.trashFolder());e.remote().saveSystemFolders(d.emptyFunction,{SentFolder:b.sentFolder(),DraftFolder:b.draftFolder(),SpamFolder:b.spamFolder(),TrashFolder:b.trashFolder()})},1E3);
l=function(){e.settingsSet("SentFolder",b.sentFolder());e.settingsSet("DraftFolder",b.draftFolder());e.settingsSet("SpamFolder",b.spamFolder());e.settingsSet("TrashFolder",b.trashFolder());c()};this.sentFolder.subscribe(l);this.draftFolder.subscribe(l);this.spamFolder.subscribe(l);this.trashFolder.subscribe(l);this.defautOptionsAfterRender=d.defautOptionsAfterRender}function z(){D.call(this,"Popups","PopupsCompose");this.aDraftInfo=this.oEditor=null;this.sInReplyTo="";this.bFromDraft=!1;this.sReferences=
"";this.bReloadFolder=!1;var a=this,b=function(a){for(var b=0,c=a.length,d=[];b<c;b++)d.push(a[b].toLine(!1));return d.join(", ")},c=function(a){!1===this.showCcAndBcc()&&0<a.length&&this.showCcAndBcc(!0)};this.resizer=f.observable(!1).extend({throttle:50});this.to=f.observableArray([]);this.cc=f.observableArray([]);this.bcc=f.observableArray([]);this.subject=f.observable("");this.sendError=f.observable(!1);this.sendSuccessButSaveError=f.observable(!1);this.savedError=f.observable(!1);this.savedTime=
f.observable(0);this.savedOrSendingText=f.observable("");this.emptyToError=f.observable(!1);this.showCcAndBcc=f.observable(!1);this.cc.subscribe(c,this);this.bcc.subscribe(c,this);this.draftFolder=f.observable("");this.draftUid=f.observable("");this.draftID=f.observable("");this.sending=f.observable(!1);this.saving=f.observable(!1);this.attachments=f.observableArray([]);this.attachmentsInProcess=f.computed(function(){return i.filter(this.attachments(),function(a){return a&&""===a.tempName()})},this);
this.attachmentsInReady=f.computed(function(){return i.filter(this.attachments(),function(a){return a&&""!==a.tempName()})},this);this.attachments.subscribe(function(){this.triggerForResize()},this);this.isDraftFolderMessage=f.computed(function(){return""!==this.draftFolder()&&""!==this.draftUid()&&""!==this.draftID()},this);this.composeUploaderButton=f.observable(null);this.composeUploaderDropPlace=f.observable(null);this.dragAndDropEnabled=f.observable(!1);this.dragAndDropOver=f.observable(!1).extend({throttle:1});
this.dragAndDropVisible=f.observable(!1).extend({throttle:1});this.attacheMultipleAllowed=f.observable(!1);this.addAttachmentEnabled=f.observable(!1);this.composeEditorTextArea=f.observable(null);this.composeEditorHtmlArea=f.observable(null);this.composeEditorToolbar=f.observable(null);this.to.subscribe(function(a){this.emptyToError()&&0<a.length&&this.emptyToError(!1)},this);this.canBeSended=f.computed(function(){return!this.sending()&&!this.saving()&&0===this.attachmentsInProcess().length&&0<this.to().length},
this);this.canBeSendedOrSaved=f.computed(function(){return!this.sending()&&!this.saving()},this);this.deleteCommand=d.createCommand(this,function(){var a=null,b=this.draftFolder(),c=this.draftUid();this.bFromDraft&&(a=e.data().message())&&(b===a.folderFullNameRaw&&c===a.uid)&&e.data().message(null);e.data().currentFolderFullNameRaw()===this.draftFolder()&&i.each(e.data().messageList(),function(a){a&&(b===a.folderFullNameRaw&&c===a.uid)&&a.deleted(true)});e.data().messageListIsNotCompleted(!0);e.remote().messagesDelete(function(){e.cache().setFolderHash(b,
"");e.reloadMessageList()},this.draftFolder(),[this.draftUid()]);this.bReloadFolder=!1;q.hideScreenPopup(z)},function(){return this.isDraftFolderMessage()});this.sendMessageResponse=i.bind(this.sendMessageResponse,this);this.saveMessageResponse=i.bind(this.saveMessageResponse,this);this.sendCommand=d.createCommand(this,function(){var a=this.to(),c=e.data().sentFolder(),f=[];if(0===a.length)this.emptyToError(!0);else if(e.data().replySameFolder()&&d.isArray(this.aDraftInfo)&&(3===this.aDraftInfo.length&&
d.isNormal(this.aDraftInfo[2])&&0<this.aDraftInfo[2].length)&&(c=this.aDraftInfo[2]),""===c)q.showScreenPopup(ba,[g.SetSystemFoldersNotification.Sent]);else{this.sendError(!1);this.sending(!0);this.bReloadFolder=!0;if(d.isArray(this.aDraftInfo)&&3===this.aDraftInfo.length&&(f=e.cache().getMessageFlagsFromCache(this.aDraftInfo[2],this.aDraftInfo[1])))"forward"===this.aDraftInfo[0]?f[3]=!0:f[2]=!0,e.cache().setMessageFlagsToCache(this.aDraftInfo[2],this.aDraftInfo[1],f),e.reloadFlagsCurrentMessageListAndMessageFromCache();
c=o.Values.UnuseOptionValue===c?"":c;e.cache().setFolderHash(this.draftFolder(),"");e.cache().setFolderHash(c,"");e.remote().sendMessage(this.sendMessageResponse,this.draftFolder(),this.draftUid(),this.draftID(),c,b(a),b(this.cc()),b(this.bcc()),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences)}},this.canBeSendedOrSaved);this.saveCommand=d.createCommand(this,function(){e.data().draftFolderNotEnabled()?
q.showScreenPopup(ba,[g.SetSystemFoldersNotification.Draft]):(this.savedError(!1),this.saving(!0),this.bReloadFolder=!0,e.cache().setFolderHash(e.data().draftFolder(),""),e.remote().saveMessage(this.saveMessageResponse,this.draftFolder(),this.draftUid(),this.draftID(),e.data().draftFolder(),b(this.to()),b(this.cc()),b(this.bcc()),this.subject(),this.oEditor.isHtml(),this.oEditor.getTextForRequest(),this.prepearAttachmentsForSendOrSave(),this.aDraftInfo,this.sInReplyTo,this.sReferences))},this.canBeSendedOrSaved);
n.minuteTick.subscribe(function(){this.modalVisibility()&&(!e.data().draftFolderNotEnabled()&&!this.isEmptyForm(!1)&&!this.saving()&&!this.sending()&&!this.savedError())&&this.saveCommand()},this);d.initOnStartOrLangChange(null,this,function(){this.oEditor&&this.oEditor.initLanguage(d.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),d.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),d.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))});this.showCcAndBcc.subscribe(function(){this.triggerForResize()},this);this.dropboxEnabled=
f.observable(e.settingsGet("DropboxApiKey")?!0:!1);this.dropboxCommand=d.createCommand(this,function(){h.Dropbox&&h.Dropbox.choose({success:function(b){b&&(b[0]&&b[0].link)&&a.addDropboxAttachment(b[0])},linkType:"direct",multiselect:!1});return!0},function(){return this.dropboxEnabled()});this.modalVisibility.subscribe(function(a){!a&&this.bReloadFolder&&(this.bReloadFolder=!1,e.reloadMessageList())},this);this.driveEnabled=f.observable(!1);this.driveCommand=d.createCommand(this,function(){return!0},
function(){return this.driveEnabled()})}function N(){D.call(this,"Popups","PopupsContacts");var a=this;this.imageUploader=f.observable(null);this.imageDom=f.observable(null);this.imageTrigger=f.observable(!1);this.search=f.observable("");this.contacts=f.observableArray([]);this.contacts.loading=f.observable(!1).extend({throttle:200});this.currentContact=f.observable(null);this.emptySelection=f.observable(!0);this.viewClearSearch=f.observable(!1);this.viewID=f.observable("");this.viewName=f.observable("");
this.viewName.focused=f.observable(!1);this.viewEmail=f.observable("").validateEmail();this.viewEmail.focused=f.observable(!1);this.viewImageUrl=f.observable(e.link().emptyContactPic());this.viewSaving=f.observable(!1);this.useCheckboxesInList=e.data().useCheckboxesInList;this.search.subscribe(function(){this.reloadContactList()},this);this.contacts.subscribe(function(){d.windowResize()},this);this.viewImageUrl.subscribe(function(a){this.imageDom().src=a},this);this.contactsChecked=f.computed(function(){return i.filter(this.contacts(),
function(a){return a.checked()})},this);this.contactsCheckedOrSelected=f.computed(function(){var a=this.contactsChecked(),c=this.currentContact();return i.union(a,c?[c]:[])},this);this.contactsCheckedOrSelectedUids=f.computed(function(){return i.map(this.contactsCheckedOrSelected(),function(a){return a.idContact})},this);this.newCommand=d.createCommand(this,function(){this.populateViewContact(null)});this.selector=new M(this.contacts,this.currentContact,".e-contact-item .actionHandle",".e-contact-item.selected",
".e-contact-item .checkboxItem");this.selector.on("onItemSelect",i.bind(function(a){this.populateViewContact(a?a:null)},this));this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""});this.selector.on("onDelete",i.bind(function(){this.deleteCommand()},this));this.newCommand=d.createCommand(this,function(){this.populateViewContact(null);this.currentContact(null)});this.deleteCommand=d.createCommand(this,function(){this.deleteSelectedContacts()},function(){return 0<this.contactsCheckedOrSelected().length});
this.newMessageCommand=d.createCommand(this,function(){var a=this.contactsCheckedOrSelected(),c=[];d.isNonEmptyArray(a)&&(c=i.map(a,function(a){return a&&a.emails&&(a=new G(a.emails[0]||"",a.name),a.validate())?a:null}),c=i.compact(c));d.isNonEmptyArray(a)&&(q.hideScreenPopup(N),q.showScreenPopup(z,[g.ComposeType.Empty,null,c]))},function(){return 0<this.contactsCheckedOrSelected().length});this.clearCommand=d.createCommand(this,function(){this.search("")});this.saveCommand=d.createCommand(this,function(){var b=
d.fakeMd5(),c=this.imageTrigger();this.viewSaving(!0);e.remote().contactSave(function(l,f){a.viewSaving(!1);g.StorageResultType.Success===l&&(f&&f.Result&&f.Result.RequestUid===b&&0<d.pInt(f.Result.ResultID))&&(""===a.viewID()&&a.viewID(d.pInt(f.Result.ResultID)),a.reloadContactList(),c&&e.emailsPicsHashes())},b,this.viewID(),this.viewName(),this.viewEmail(),c?this.imageDom().src:"")},function(){var a=this.viewName(),c=this.viewEmail();return!this.viewSaving()&&(""!==a||""!==c)})}function ja(){D.call(this,
"Popups","PopupsAdvancedSearch");this.fromFocus=f.observable(!1);this.from=f.observable("");this.to=f.observable("");this.subject=f.observable("");this.text=f.observable("");this.selectedDateValue=f.observable(-1);this.hasAttachments=f.observable(!1);this.searchCommand=d.createCommand(this,function(){var a=this.buildSearchString();""!==a&&e.data().mainMessageListSearch(a);this.cancelCommand()})}function ka(){D.call(this,"Popups","PopupsAddAccount");this.email=f.observable("");this.login=f.observable("");
this.password=f.observable("");this.emailError=f.observable(!1);this.loginError=f.observable(!1);this.passwordError=f.observable(!1);this.email.subscribe(function(){this.emailError(!1)},this);this.login.subscribe(function(){this.loginError(!1)},this);this.password.subscribe(function(){this.passwordError(!1)},this);this.allowCustomLogin=f.observable(!1);this.submitRequest=f.observable(!1);this.submitError=f.observable("");this.emailFocus=f.observable(!1);this.loginFocus=f.observable(!1);this.addAccountCommand=
d.createCommand(this,function(){this.emailError(""===d.trim(this.email()));this.passwordError(""===d.trim(this.password()));if(this.emailError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().accountAdd(i.bind(function(a,b){this.submitRequest(!1);g.StorageResultType.Success===a&&b&&"AccountAdd"===b.Action?b.Result?(e.accounts(),this.cancelCommand()):b.ErrorCode&&this.submitError(d.getNotification(b.ErrorCode)):this.submitError(d.getNotification(g.Notification.UnknownError))},this),
this.email(),this.login(),this.password());return!0},function(){return!this.submitRequest()});this.loginFocus.subscribe(function(a){a&&(""===this.login()&&""!==this.email())&&this.login(this.email())},this)}function la(){D.call(this,"Popups","PopupsLanguages");this.exp=f.observable(!1);this.languages=f.computed(function(){var a=e.data().mainLanguage();return i.map(e.data().languages(),function(b){return{key:b,selected:b===a,fullName:d.convertLangName(b)}})})}function ma(){D.call(this,"Right","Login");
var a=e.data();this.email=f.observable("");this.login=f.observable("");this.password=f.observable("");this.signMe=f.observable(!1);this.logoMain=f.observable("RainLoop");this.emailError=f.observable(!1);this.loginError=f.observable(!1);this.passwordError=f.observable(!1);this.emailFocus=f.observable(!1);this.loginFocus=f.observable(!1);this.submitFocus=f.observable(!1);this.email.subscribe(function(){this.emailError(!1)},this);this.login.subscribe(function(){this.loginError(!1)},this);this.password.subscribe(function(){this.passwordError(!1)},
this);this.submitRequest=f.observable(!1);this.submitError=f.observable("");this.allowCustomLogin=a.allowCustomLogin;this.allowLanguagesOnLogin=a.allowLanguagesOnLogin;this.langRequest=f.observable(!1);this.mainLanguage=a.mainLanguage;this.bSendLanguage=!1;this.mainLanguageFullName=f.computed(function(){return d.convertLangName(this.mainLanguage())},this);this.signMeType=f.observable(g.LoginSignMeType.Unused);this.signMeType.subscribe(function(a){this.signMe(g.LoginSignMeType.DefaultOn===a)},this);
this.signMeVisibility=f.computed(function(){return g.LoginSignMeType.Unused!==this.signMeType()},this);this.submitCommand=d.createCommand(this,function(){this.emailError(""===d.trim(this.email()));this.passwordError(""===d.trim(this.password()));if(this.emailError()||this.passwordError())return!1;this.submitRequest(!0);e.remote().login(i.bind(function(a,c){g.StorageResultType.Success===a&&c&&"Login"===c.Action?c.Result?e.loginAndLogoutReload():c.ErrorCode?(this.submitRequest(!1),this.submitError(d.getNotification(c.ErrorCode))):
this.submitRequest(!1):(this.submitRequest(!1),this.submitError(d.getNotification(g.Notification.UnknownError)))},this),this.email(),this.login(),this.password(),!!this.signMe(),this.bSendLanguage?this.mainLanguage():"");return!0},function(){return!this.submitRequest()});this.facebookLoginEnabled=f.observable(!1);this.facebookCommand=d.createCommand(this,function(){h.open(e.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");
return!0},function(){return!this.submitRequest()&&this.facebookLoginEnabled()});this.googleLoginEnabled=f.observable(!1);this.googleCommand=d.createCommand(this,function(){h.open(e.link().socialGoogle(),"Google","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&this.googleLoginEnabled()});this.twitterLoginEnabled=f.observable(!1);this.twitterCommand=d.createCommand(this,function(){h.open(e.link().socialTwitter(),
"Twitter","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes");return!0},function(){return!this.submitRequest()&&this.twitterLoginEnabled()});this.loginFocus.subscribe(function(a){a&&(""===this.login()&&""!==this.email())&&this.login(this.email())},this);this.socialLoginEnabled=f.computed(function(){var a=this.facebookLoginEnabled(),c=this.googleLoginEnabled(),d=this.twitterLoginEnabled();return a||c||d},this)}function S(){D.call(this,"Right","SystemDropDown");
var a=e.data();this.accounts=a.accounts;this.accountEmail=a.accountEmail;this.accountsLoading=a.accountsLoading;this.allowAddAccount=e.settingsGet("AllowAdditionalAccounts");this.loading=f.computed(function(){return this.accountsLoading()},this);this.accountClick=i.bind(this.accountClick,this)}function Ta(){S.call(this)}function Ua(){S.call(this)}function ca(){D.call(this,"Left","MailFolderList");this.folderList=e.data().folderList;this.folderListSystem=e.data().folderListSystem;this.iDropOverTimer=
0;this.allowContacts=!!e.settingsGet("ContactsIsSupported")&&!!e.settingsGet("ContactsIsAllowed")}function A(){D.call(this,"Right","MailMessageList");this.sLastUid=null;this.emptySubjectValue="";var a=e.data();this.popupVisibility=e.popupVisibility;this.messageList=a.messageList;this.currentMessage=a.currentMessage;this.isMessageSelected=a.isMessageSelected;this.messageListSearch=a.messageListSearch;this.messageListError=a.messageListError;this.folderMenuForMove=a.folderMenuForMove;this.useCheckboxesInList=
a.useCheckboxesInList;this.mainMessageListSearch=a.mainMessageListSearch;this.messageListEndFolder=a.messageListEndFolder;this.messageListChecked=a.messageListChecked;this.messageListCheckedOrSelected=a.messageListCheckedOrSelected;this.messageListCheckedOrSelectedUidsWithSubMails=a.messageListCheckedOrSelectedUidsWithSubMails;this.messageListCompleteLoadingThrottle=a.messageListCompleteLoadingThrottle;d.initOnStartOrLangChange(function(){this.emptySubjectValue=d.i18n("MESSAGE_LIST/EMPTY_SUBJECT_TEXT")},
this);this.userQuota=a.userQuota;this.userUsageSize=a.userUsageSize;this.userUsageProc=a.userUsageProc;this.dragOver=f.observable(!1).extend({throttle:1});this.dragOverEnter=f.observable(!1).extend({throttle:1});this.dragOverArea=f.observable(null);this.dragOverBodyArea=f.observable(null);this.messageListItemTemplate=f.computed(function(){return a.usePreviewPane()?"MailMessageListItem":"MailMessageListItemNoPreviewPane"});this.messageListSearchDesc=f.computed(function(){var b=a.messageListEndSearch();
return""===b?"":d.i18n("MESSAGE_LIST/SEARCH_RESULT_FOR",{SEARCH:b})});this.messageListPagenator=f.computed(function(){var b=0,c=0,l=2,e=[],f=a.messageListPage(),g=a.messageListPageCount(),k=function(a,b,c){a={current:a===f,name:d.isUnd(c)?a.toString():c.toString(),custom:d.isUnd(c)?!1:!0,title:d.isUnd(c)?"":a.toString(),value:a.toString()};d.isUnd(b)||b?e.push(a):e.unshift(a)};if(1<g||0<g&&g<f){if(g<f)k(g),c=b=g;else{if(3>=f||g-2<=f)l+=2;k(f);c=b=f}for(;0<l;)if(b-=1,c+=1,0<b&&(k(b,!1),l--),g>=c)k(c,
!0),l--;else if(0>=b)break;3===b?k(2,!1):3<b&&k(Math.round((b-1)/2),!1,"...");g-2===c?k(g-1,!0):g-2>c&&k(Math.round((g+c)/2),!0,"...");1<b&&k(1,!1);g>c&&k(g,!0)}return e},this);this.checkAll=f.computed({read:function(){return 0<e.data().messageListCheckedOrSelected().length},write:function(a){a=!!a;i.each(e.data().messageList(),function(c){c.checked(a)});a||e.data().message(null)}});this.inputMessageListSearchFocus=f.observable(!1);this.sLastSearchValue="";this.inputProxyMessageListSearch=f.computed({read:this.mainMessageListSearch,
write:function(a){this.sLastSearchValue=a},owner:this});this.isIncompleteChecked=f.computed(function(){var a=e.data().messageList().length,c=e.data().messageListCheckedOrSelected().length;return 0<a&&0<c&&a>c},this);this.hasMessages=f.computed(function(){return 0<this.messageList().length},this);this.hasCheckedLines=f.computed(function(){return 0<this.messageListChecked().length},this);this.hasCheckedOrSelectedLines=f.computed(function(){return 0<this.messageListCheckedOrSelected().length},this);
this.isSpamFolder=f.computed(function(){return e.data().spamFolder()===this.messageListEndFolder()},this);this.isTrashFolder=f.computed(function(){return e.data().trashFolder()===this.messageListEndFolder()},this);this.canBeMoved=this.hasCheckedOrSelectedLines;this.clearCommand=d.createCommand(this,function(){q.showScreenPopup(Ba,[e.data().currentFolder()])});this.multyForwardCommand=d.createCommand(this,function(){q.showScreenPopup(z,[g.ComposeType.ForwardAsAttachment,e.data().messageListCheckedOrSelected()])},
this.canBeMoved);this.deleteWithoutMoveCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Trash,!1)},this.canBeMoved);this.deleteCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Trash,!0)},this.canBeMoved);this.spamCommand=d.createCommand(this,function(){this.deleteSelectedMessageFromCurrentFolder(g.FolderType.Spam,!0)},this.canBeMoved);this.moveCommand=d.createCommand(this,d.emptyFunction,this.canBeMoved);
this.setCommand=d.createCommand(this,d.emptyFunction,this.hasCheckedLines);this.checkCommand=d.createCommand(this,d.emptyFunction,this.hasCheckedLines);this.reloadCommand=d.createCommand(this,function(){e.data().messageListCompleteLoadingThrottle()||e.reloadMessageList(!1,!0)});this.quotaTooltip=i.bind(this.quotaTooltip,this);this.selector=new M(this.messageList,this.currentMessage,".messageListItem .actionHandle",".messageListItem.selected",".messageListItem .checkboxMessage");this.selector.on("onItemSelect",
i.bind(function(b){b?(a.message(a.staticMessageList.populateByMessageListItem(b)),this.populateMessageBody(a.message())):a.message(null)},this));this.selector.on("onItemGetUid",function(a){return a?a.generateUid():""});this.selector.on("onDelete",i.bind(function(){0<e.data().messageListCheckedOrSelected().length&&this.deleteCommand()},this))}function J(){D.call(this,"Right","MailMessageView");var a="",b=e.data(),c=this,l=function(a){return d.createCommand(c,function(){this.replyOrforward(a)},c.canBeRepliedOrForwarded)};
this.oMessageScrollerDom=null;this.message=b.message;this.messageLoading=b.messageLoading;this.messageLoadingThrottle=b.messageLoadingThrottle;this.messagesBodiesDom=b.messagesBodiesDom;this.useThreads=b.useThreads;this.replySameFolder=b.replySameFolder;this.usePreviewPane=b.usePreviewPane;this.isMessageSelected=b.isMessageSelected;this.messageActiveDom=b.messageActiveDom;this.messageError=b.messageError;this.fullScreenMode=b.messageFullScreenMode;this.showFullInfo=f.observable(!1);this.canBeRepliedOrForwarded=
this.messageVisibility=f.computed(function(){return!this.messageLoadingThrottle()&&!!this.message()},this);this.closeMessage=d.createCommand(this,function(){b.message(null)});this.replyCommand=l(g.ComposeType.Reply);this.replyAllCommand=l(g.ComposeType.ReplyAll);this.forwardCommand=l(g.ComposeType.Forward);this.forwardAsAttachmentCommand=l(g.ComposeType.ForwardAsAttachment);this.messageVisibilityCommand=d.createCommand(this,d.emptyFunction,this.messageVisibility);this.viewSubject=f.observable("");
this.viewFromShort=f.observable("");this.viewToShort=f.observable("");this.viewFrom=f.observable("");this.viewTo=f.observable("");this.viewCc=f.observable("");this.viewBcc=f.observable("");this.viewDate=f.observable("");this.viewMoment=f.observable("");this.viewLineAsCcc=f.observable("");this.viewHasImages=f.observable(!1);this.viewHasVisibleAttachments=f.observable(!1);this.viewAttachments=f.observableArray([]);this.viewIsHtml=f.observable(!1);this.viewIsRtl=f.observable(!1);this.viewViewLink=f.observable("");
this.viewDownloadLink=f.observable("");this.viewUserPic=f.observable(o.DataImages.UserDotPic);this.viewUserPicVisible=f.observable(!1);this.message.subscribe(function(b){this.messageActiveDom(null);b&&(this.viewSubject(b.subject()),this.viewFromShort(b.fromToLine(!0,!0)),this.viewToShort(b.toToLine(!0,!0)),this.viewFrom(b.fromToLine(!1)),this.viewTo(b.toToLine(!1)),this.viewCc(b.ccToLine(!1)),this.viewBcc(b.bccToLine(!1)),this.viewDate(b.fullFormatDateValue()),this.viewMoment(b.momentDate()),this.viewLineAsCcc(b.lineAsCcc()),
this.viewHasImages(b.hasImages()),this.viewHasVisibleAttachments(b.hasVisibleAttachments()),this.viewAttachments(b.attachments()),this.viewIsHtml(b.isHtml()),this.viewIsRtl(b.isRtl()),this.viewViewLink(b.viewLink()),this.viewDownloadLink(b.downloadLink()),a=e.cache().getUserPic(b.fromAsSingleEmail()),a!==this.viewUserPic()&&(this.viewUserPicVisible(!1),this.viewUserPic(o.DataImages.UserDotPic),""!==a&&(this.viewUserPicVisible(!0),this.viewUserPic(a))))},this);this.fullScreenMode.subscribe(function(a){a?
da.addClass("rl-message-fullscreen"):da.removeClass("rl-message-fullscreen");d.windowResize()});this.messageLoadingThrottle.subscribe(function(a){a&&d.windowResize()});this.messageActiveDom.subscribe(function(){this.scrollMessageToTop()},this)}function Ca(a){D.call(this,"Left","SettingsMenu");this.menu=a.menu}function Da(){D.call(this,"Right","SettingsPane")}function Ea(){var a=e.data();this.mainLanguage=a.mainLanguage;this.mainMessagesPerPage=a.mainMessagesPerPage;this.mainMessagesPerPageArray=o.Defaults.MessagesPerPageArray;
this.editorDefaultType=a.editorDefaultType;this.showImages=a.showImages;this.showAnimation=a.showAnimation;this.useDesktopNotifications=a.useDesktopNotifications;this.threading=a.threading;this.useThreads=a.useThreads;this.replySameFolder=a.replySameFolder;this.usePreviewPane=a.usePreviewPane;this.useCheckboxesInList=a.useCheckboxesInList;this.allowLanguagesOnSettings=a.allowLanguagesOnSettings;this.isDesktopNotificationsSupported=f.computed(function(){return g.DesktopNotifications.NotSupported!==
a.desktopNotificationsPermisions()});this.isDesktopNotificationsDenied=f.computed(function(){return g.DesktopNotifications.NotSupported===a.desktopNotificationsPermisions()||g.DesktopNotifications.Denied===a.desktopNotificationsPermisions()});this.mainLanguageFullName=f.computed(function(){return d.convertLangName(this.mainLanguage())},this);this.languageTrigger=f.observable(g.SaveSettingsStep.Idle).extend({throttle:100});this.mppTrigger=f.observable(g.SaveSettingsStep.Idle)}function Va(){var a=e.data();
this.displayName=a.displayName;this.replyTo=a.replyTo;this.signature=a.signature;this.nameTrigger=f.observable(g.SaveSettingsStep.Idle);this.replyTrigger=f.observable(g.SaveSettingsStep.Idle);this.signatureTrigger=f.observable(g.SaveSettingsStep.Idle)}function ra(){this.accounts=e.data().accounts;this.processText=f.computed(function(){return e.data().accountsLoading()?d.i18n("SETTINGS_ACCOUNTS/LOADING_PROCESS"):""},this);this.visibility=f.computed(function(){return""===this.processText()?"hidden":
"visible"},this);this.accountForDeletion=f.observable(null).extend({falseTimeout:3E3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]})}function Ma(){var a=e.data();this.googleEnable=a.googleEnable;this.googleActions=a.googleActions;this.googleLoggined=a.googleLoggined;this.googleUserName=a.googleUserName;this.facebookEnable=a.facebookEnable;this.facebookActions=a.facebookActions;this.facebookLoggined=a.facebookLoggined;this.facebookUserName=a.facebookUserName;
this.twitterEnable=a.twitterEnable;this.twitterActions=a.twitterActions;this.twitterLoggined=a.twitterLoggined;this.twitterUserName=a.twitterUserName;this.connectGoogle=d.createCommand(this,function(){this.googleLoggined()||e.googleConnect()},function(){return!this.googleLoggined()&&!this.googleActions()});this.disconnectGoogle=d.createCommand(this,function(){e.googleDisconnect()});this.connectFacebook=d.createCommand(this,function(){this.facebookLoggined()||e.facebookConnect()},function(){return!this.facebookLoggined()&&
!this.facebookActions()});this.disconnectFacebook=d.createCommand(this,function(){e.facebookDisconnect()});this.connectTwitter=d.createCommand(this,function(){this.twitterLoggined()||e.twitterConnect()},function(){return!this.twitterLoggined()&&!this.twitterActions()});this.disconnectTwitter=d.createCommand(this,function(){e.twitterDisconnect()})}function sa(){this.changeProcess=f.observable(!1);this.passwordUpdateError=f.observable(!1);this.passwordUpdateSuccess=f.observable(!1);this.currentPassword=
f.observable("");this.newPassword=f.observable("");this.currentPassword.subscribe(function(){this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1)},this);this.newPassword.subscribe(function(){this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1)},this);this.saveNewPasswordCommand=d.createCommand(this,function(){this.changeProcess(!0);this.passwordUpdateError(!1);this.passwordUpdateSuccess(!1);e.remote().changePassword(this.onChangePasswordResponse,this.currentPassword(),this.newPassword())},
function(){return!this.changeProcess()&&""!==this.currentPassword()&&""!==this.newPassword()});this.onChangePasswordResponse=i.bind(this.onChangePasswordResponse,this)}function W(){var a=e.data();this.ignoreFolderSubscribe=a.ignoreFolderSubscribe;this.foldersListError=a.foldersListError;this.folderList=a.folderList;this.processText=f.computed(function(){var a=e.data(),c=a.foldersLoading(),l=a.foldersCreating(),f=a.foldersDeleting(),a=a.foldersRenaming();return l?d.i18n("SETTINGS_FOLDERS/CREATING_PROCESS"):
f?d.i18n("SETTINGS_FOLDERS/DELETING_PROCESS"):a?d.i18n("SETTINGS_FOLDERS/RENAMING_PROCESS"):c?d.i18n("SETTINGS_FOLDERS/LOADING_PROCESS"):""},this);this.visibility=f.computed(function(){return""===this.processText()?"hidden":"visible"},this);this.folderForDeletion=f.observable(null).extend({falseTimeout:3E3}).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&a.deleteAccess(!0)}]});this.folderForEdit=f.observable(null).extend({toggleSubscribe:[this,function(a){a&&a.edited(!1)},
function(a){a&&a.canBeEdited()&&a.edited(!0)}]})}function na(){var a=this;this.mainTheme=e.data().mainTheme;this.customThemeType=f.observable(e.settingsGet("CustomThemeType"));this.customThemeImg=f.observable(e.settingsGet("CustomThemeImg"));this.themesObjects=f.observableArray([]);this.customThemeUploaderProgress=f.observable(!1);this.customThemeUploaderButton=f.observable(null);this.showCustomThemeConfig=f.computed(function(){return"Custom"===this.mainTheme()},this);this.showCustomThemeConfig.subscribe(function(){d.windowResize()});
this.themeTrigger=f.observable(g.SaveSettingsStep.Idle).extend({throttle:100});this.oLastAjax=null;this.iTimer=0;e.data().theme.subscribe(function(b){i.each(this.themesObjects(),function(a){a.selected(b===a.name)});var c=j("#rlThemeLink"),l=j("#rlThemeStyle"),f=c.attr("href");f||(f=l.attr("data-href"));f&&(f=f.toString().replace(/\/-\/[^\/]+\/\-\//,"/-/"+b+"/-/"),f=f.toString().replace(/\/Css\/[^\/]+\/User\//,"/Css/"+("Custom"===b&&h.__rlah?h.__rlah()||"0":"0")+"/User/"),"Json/"!==f.substring(f.length-
5,f.length)&&(f+="Json/"),h.clearTimeout(a.iTimer),a.themeTrigger(g.SaveSettingsStep.Animate),this.oLastAjax&&this.oLastAjax.abort&&this.oLastAjax.abort(),this.oLastAjax=j.ajax({url:f,dataType:"json"}).done(function(b){if(b&&d.isArray(b)&&2===b.length){if(c&&c[0]&&(!l||!l[0]))l=j('<style id="rlThemeStyle"></style>'),c.after(l),c.remove();l&&l[0]&&l.attr("data-href",f).attr("data-theme",b[0]).text(b[1]);a.themeTrigger(g.SaveSettingsStep.TrueResult)}}).always(function(){a.iTimer=h.setTimeout(function(){a.themeTrigger(g.SaveSettingsStep.Idle)},
1E3);a.oLastAjax=null}));e.remote().saveSettings(null,{Theme:b})},this)}function Na(){d.initDataConstructorBySettings(this)}function T(){d.initDataConstructorBySettings(this);var a=function(a){return function(){var b=e.cache().getFolderFromCacheList(a());b&&b.type(g.FolderType.User)}},b=function(a){return function(b){(b=e.cache().getFolderFromCacheList(b))&&b.type(a)}};this.devPassword=this.devLogin=this.devEmail="";this.accountEmail=f.observable("");this.accountLogin=f.observable("");this.projectHash=
f.observable("");this.threading=f.observable(!1);this.lastFoldersHash="";this.remoteChangePassword=this.remoteSuggestions=!1;this.sentFolder=f.observable("");this.draftFolder=f.observable("");this.spamFolder=f.observable("");this.trashFolder=f.observable("");this.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange");this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange");this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange");this.trashFolder.subscribe(a(this.trashFolder),
this,"beforeChange");this.sentFolder.subscribe(b(g.FolderType.SentItems),this);this.draftFolder.subscribe(b(g.FolderType.Draft),this);this.spamFolder.subscribe(b(g.FolderType.Spam),this);this.trashFolder.subscribe(b(g.FolderType.Trash),this);this.draftFolderNotEnabled=f.computed(function(){return""===this.draftFolder()||o.Values.UnuseOptionValue===this.draftFolder()},this);this.displayName=f.observable("");this.signature=f.observable("");this.replyTo=f.observable("");this.accounts=f.observableArray([]);
this.accountsLoading=f.observable(!1);this.namespace="";this.folderList=f.observableArray([]);this.foldersListError=f.observable("");this.foldersLoading=f.observable(!1);this.foldersCreating=f.observable(!1);this.foldersDeleting=f.observable(!1);this.foldersRenaming=f.observable(!1);this.currentFolder=f.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.currentFolderFullNameRaw=f.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:
""},this);this.currentFolderFullName=f.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this);this.currentFolderFullNameHash=f.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this);this.currentFolderName=f.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this);this.folderListSystemNames=f.computed(function(){var a=["INBOX"],b=this.folderList(),e=this.sentFolder(),f=this.draftFolder(),g=this.spamFolder(),
k=this.trashFolder();d.isArray(b)&&0<b.length&&(""!==e&&o.Values.UnuseOptionValue!==e&&a.push(e),""!==f&&o.Values.UnuseOptionValue!==f&&a.push(f),""!==g&&o.Values.UnuseOptionValue!==g&&a.push(g),""!==k&&o.Values.UnuseOptionValue!==k&&a.push(k));return a},this);this.folderListSystem=f.computed(function(){return i.compact(i.map(this.folderListSystemNames(),function(a){return e.cache().getFolderFromCacheList(a)}))},this);this.folderMenuForMove=f.computed(function(){return e.folderListOptionsBuilder(this.folderListSystem(),
this.folderList(),[this.currentFolderFullNameRaw()],null,null,null,null,function(a){return a?a.localName():""})},this);this.staticMessageList=[];this.messageList=f.observableArray([]);this.messageListCount=f.observable(0);this.messageListSearch=f.observable("");this.messageListPage=f.observable(1);this.messageListThreadFolder=f.observable("");this.messageListThreadUids=f.observableArray([]);this.messageListThreadFolder.subscribe(function(){this.messageListThreadUids([])},this);this.messageListEndSearch=
f.observable("");this.messageListEndFolder=f.observable("");this.messageListPageCount=f.computed(function(){var a=Math.ceil(this.messageListCount()/this.messagesPerPage());return 0===a?1:a},this);this.mainMessageListSearch=f.computed({read:this.messageListSearch,write:function(a){q.setHash(e.link().mailBox(this.currentFolderFullNameHash(),1,d.trim(a.toString())))},owner:this});this.messageListError=f.observable("");this.messageListLoading=f.observable(!1);this.messageListIsNotCompleted=f.observable(!1);
this.messageListCompleteLoadingThrottle=f.observable(!1).extend({throttle:200});this.messageListCompleteLoading=f.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(i.debounce(function(a){i.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500));this.staticMessageList=new m;this.message=f.observable(null);
this.messageLoading=f.observable(!1);this.messageLoadingThrottle=f.observable(!1).extend({throttle:50});this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this);this.messageFullScreenMode=f.observable(!1);this.messageError=f.observable("");this.messagesBodiesDom=f.observable(null);this.messagesBodiesDom.subscribe(function(a){a&&!(a instanceof jQuery)&&this.messagesBodiesDom(j(a))},this);this.messageActiveDom=f.observable(null);this.isMessageSelected=f.computed(function(){return null!==
this.message()},this);this.currentMessage=f.observable(null);this.message.subscribe(function(a){null===a&&this.currentMessage(null)},this);this.messageListChecked=f.computed(function(){return i.filter(this.messageList(),function(a){return a.checked()})},this);this.messageListCheckedOrSelected=f.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return i.union(a,b?[b]:[])},this);this.messageListCheckedUids=f.computed(function(){var a=[];i.each(this.messageListChecked(),function(b){b&&
(a.push(b.uid),0<b.threadsLen()&&(0===b.parentUid()&&b.lastInCollapsedThread())&&(a=i.union(a,b.threads())))});return a},this);this.messageListCheckedOrSelectedUidsWithSubMails=f.computed(function(){var a=[];i.each(this.messageListCheckedOrSelected(),function(b){b&&(a.push(b.uid),0<b.threadsLen()&&(0===b.parentUid()&&b.lastInCollapsedThread())&&(a=i.union(a,b.threads())))});return a},this);this.userQuota=f.observable(0);this.userUsageSize=f.observable(0);this.userUsageProc=f.computed(function(){var a=
this.userQuota(),b=this.userUsageSize();return 0<a?Math.ceil(100*(b/a)):0},this);this.useKeyboardShortcuts=f.observable(!0);this.googleActions=f.observable(!1);this.googleLoggined=f.observable(!1);this.googleUserName=f.observable("");this.facebookActions=f.observable(!1);this.facebookLoggined=f.observable(!1);this.facebookUserName=f.observable("");this.twitterActions=f.observable(!1);this.twitterLoggined=f.observable(!1);this.twitterUserName=f.observable("");this.customThemeType=f.observable(g.CustomThemeType.Light);
this.purgeMessageBodyCacheThrottle=i.throttle(this.purgeMessageBodyCache,3E4)}function ga(){this.oRequests={}}function s(){this.oRequests={};this.oRequests={}}function X(){this.oEmailsPicsHashes={};this.oServices={}}function w(){X.call(this);this.oFoldersCache={};this.oFoldersNamesCache={};this.oFolderHashCache={};this.oFolderUidNextCache={};this.oMessageListHashCache={};this.oMessageFlagsCache={};this.oNewMessage={};this.oRequestedMessage={}}function ha(a){L.call(this,"settings",a);this.menu=f.observableArray([]);
this.oViewModelPlace=this.oCurrentSubScreen=null}function Fa(){L.call(this,"login",[ma])}function ea(){L.call(this,"mailbox",[Ta,ca,A,J]);this.oLastRoute={}}function Oa(){ha.call(this,[Ua,Ca,Da]);d.initOnStartOrLangChange(function(){this.sSettingsTitle=d.i18n("TITLES/SETTINGS")},this,function(){e.setTitle(this.sSettingsTitle)})}function K(){this.oLocal=this.oLink=this.oPlugins=this.oSettings=null;this.isLocalAutocomplete=!0;this.popupVisibility=f.observable(!1);this.iframe=j('<iframe style="display:none" src="javascript:;" />').appendTo("body");
P.on("error",function(a){e&&(a&&a.originalEvent&&a.originalEvent.message&&-1===d.inArray(a.originalEvent.message,["Uncaught Error: Error calling method on NPObject."]))&&e.remote().jsError(d.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",da.attr("class"))})}function B(){K.call(this);this.oCache=this.oRemote=this.oData=null;this.iSuggestionsLimit=d.pInt(this.settingsGet("SuggestionsLimit"));this.iSuggestionsLimit=
0===this.iSuggestionsLimit?20:this.iSuggestionsLimit;this.quotaDebounce=i.debounce(this.quota,3E4)}var o={},g={},v={},d={},x={},oa={},n={},U={settings:[],"settings-removed":[],"settings-disabled":[]},q=null,Ga=h.rainloopAppData||{},Pa=h.rainloopI18N||{},da=j("html"),P=j(h),Ha=j(h.document),pa=h.Notification&&h.Notification.requestPermission?h.Notification:null,e=null;n.minuteTick=f.observable(!0);n.fiveMinuteTick=f.observable(!0);n.langChangeTick=f.observable(!0);n.iAjaxErrorCount=0;n.iTokenErrorCount=
0;n.iMessageBodyCacheCount=0;n.bUnload=!1;n.sUserAgent=(navigator.userAgent||"").toLowerCase();n.bIsiOSDevice=-1<n.sUserAgent.indexOf("iphone")||-1<n.sUserAgent.indexOf("ipod")||-1<n.sUserAgent.indexOf("ipad");n.bIsAndroidDevice=-1<n.sUserAgent.indexOf("android");n.bMobileDevice=n.bIsiOSDevice||n.bIsAndroidDevice;n.bDisableNanoScroll=n.bMobileDevice;o.Defaults={};o.Values={};o.DataImages={};o.Defaults.MessagesPerPage=20;o.Defaults.MessagesPerPageArray=[10,20,30,50,100];o.Defaults.DefaultAjaxTimeout=
2E4;o.Defaults.SearchAjaxTimeout=12E4;o.Defaults.SendMessageAjaxTimeout=2E5;o.Defaults.SaveMessageAjaxTimeout=2E5;o.Values.UnuseOptionValue="__UNUSE__";o.Values.GmailFolderName="[Gmail]";o.Values.ClientSideCookieIndexName="rlcsc";o.Values.ImapDefaulPort=143;o.Values.ImapDefaulSecurePort=993;o.Values.SmtpDefaulPort=25;o.Values.SmtpDefaulSecurePort=465;o.Values.iMessageBodyCacheLimit=15;o.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=";
o.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=";g.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"};g.State={Empty:10,Login:20,Auth:30};g.StateType={Webmail:0,Admin:1};g.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,User:99};g.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"};g.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2};
g.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft"};g.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99};g.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4};g.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4};g.EventKeyCode={Backspace:8,
Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Insert:45,Delete:46,A:65,S:83};g.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3};g.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6};g.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9};g.MessagePriority={Low:5,Normal:3,High:1};g.EditorDefaultType={Html:"Html",Plain:"Plain"};g.CustomThemeType={Light:"Light",Dark:"Dark"};g.ServerSecure={None:0,SSL:1,
TLS:2};g.SearchDateType={All:-1,Days3:3,Days7:7,Month:30};g.EmailType={Defailt:0,Facebook:1,Google:2};g.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0};g.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,
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,
UnknownNotification:999,UnknownError:999};d.trim=j.trim;d.inArray=j.inArray;d.isArray=i.isArray;d.isFunc=i.isFunction;d.isUnd=i.isUndefined;d.isNull=i.isNull;d.emptyFunction=function(){};d.isNormal=function(a){return!d.isUnd(a)&&!d.isNull(a)};d.windowResize=i.debounce(function(a){d.isUnd(a)?P.resize():h.setTimeout(function(){P.resize()},a)},50);d.isPosNumeric=function(a,b){return d.isNormal(a)?d.isUnd(b)||b?/^[0-9]*$/.test(a.toString()):/^[1-9]+[0-9]*$/.test(a.toString()):!1};d.pInt=function(a){return d.isNormal(a)&&
""!==a?h.parseInt(a,10):0};d.pString=function(a){return d.isNormal(a)?a+"":""};d.isNonEmptyArray=function(a){return d.isArray(a)&&0<a.length};d.exportPath=function(a,b,c){for(var l=null,a=a.split("."),c=c||h;a.length&&(l=a.shift());)!a.length&&!d.isUnd(b)?c[l]=b:c=c[l]?c[l]:c[l]={}};d.pImport=function(a,b,c){a[b]=c};d.pExport=function(a,b,c){return d.isUnd(a[b])?c:a[b]};d.encodeHtml=function(a){return d.isNormal(a)?a.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,
"&quot;").replace(/'/g,"&#039;"):""};d.splitPlainText=function(a,b){for(var c="",l="",e=a,f=0,g=0,b=d.isUnd(b)?100:b;e.length>b;)l=e.substring(0,b),f=l.lastIndexOf(" "),g=l.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=l.substring(0,f)+"\n",e=e.substring(f+1);return c+e};var Ia={};d.timeOutAction=function(a,b,c){d.isUnd(Ia[a])&&(Ia[a]=0);h.clearTimeout(Ia[a]);Ia[a]=h.setTimeout(b,c)};var Qa={};d.timeOutActionSecond=function(a,b,c){Qa[a]||(Qa[a]=h.setTimeout(function(){b();Qa[a]=0},c))};var Q=!1;
d.audio=function(a,b){if(!1===Q)if(n.bIsiOSDevice)Q=null;else{var c=!1,d=!1,e=h.Audio?new h.Audio:null;e&&e.canPlayType&&e.play?((c=""!==e.canPlayType('audio/mpeg; codecs="mp3"'))||(d=""!==e.canPlayType('audio/ogg; codecs="vorbis"')),c||d?(Q=e,Q.preload="none",Q.loop=!1,Q.autoplay=!1,Q.muted=!1,Q.src=c?a:b):Q=null):Q=null}return Q};d.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};d.i18n=function(a,b,c){var l="",a=d.isUnd(Pa[a])?d.isUnd(c)?a:c:Pa[a];if(!d.isUnd(b)&&
!d.isNull(b))for(l in b)d.hos(b,l)&&(a=a.replace("%"+l+"%",b[l]));return a};d.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),c="";(c=a.data("i18n-text"))?a.text(d.i18n(c)):((c=a.data("i18n-html"))&&a.html(d.i18n(c)),(c=a.data("i18n-placeholder"))&&a.attr("placeholder",d.i18n(c)))})})};d.i18nToDoc=function(){h.rainloopI18N&&(Pa=h.rainloopI18N||{},d.i18nToNode(Ha),n.langChangeTick(!n.langChangeTick()));h.rainloopI18N={}};d.initOnStartOrLangChange=function(a,b,c){a&&
a.call(b);c?n.langChangeTick.subscribe(function(){a&&a.call(b);c.call(b)}):a&&n.langChangeTick.subscribe(a,b)};d.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)};d.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=j(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}};
d.removeSelection=function(){if(h&&h.getSelection){var a=h.getSelection();a&&a.removeAllRanges&&a.removeAllRanges()}else document&&(document.selection&&document.selection.empty)&&document.selection.empty()};d.replySubjectAdd=function(a,b){var c=null,l=d.trim(b);null!==(c=(new h.RegExp("^"+a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!d.isUnd(c[1])?l=a+"[2]: "+c[1]:null!==(c=(new h.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi")).exec(b))&&!d.isUnd(c[1])&&!d.isUnd(c[2])&&!d.isUnd(c[3])?
(d.pInt(c[2]),l=c[1]+(d.pInt(c[2])+1)+c[3]):l=a+": "+b;return l};d.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};d.friendlySize=function(a){a=d.pInt(a);return 1073741824<=a?d.roundNumber(a/1073741824,1)+"GB":1048576<=a?d.roundNumber(a/1048576,1)+"MB":1024<=a?d.roundNumber(a/1024,0)+"KB":a+"B"};d.log=function(a){h.console&&h.console.log&&h.console.log(a)};d.getNotification=function(a){a=d.pInt(a);return d.isUnd(v[a])?"":v[a]};d.initNotificationLanguage=function(){v[g.Notification.InvalidToken]=
d.i18n("NOTIFICATIONS/INVALID_TOKEN");v[g.Notification.AuthError]=d.i18n("NOTIFICATIONS/AUTH_ERROR");v[g.Notification.AccessError]=d.i18n("NOTIFICATIONS/ACCESS_ERROR");v[g.Notification.ConnectionError]=d.i18n("NOTIFICATIONS/CONNECTION_ERROR");v[g.Notification.CaptchaError]=d.i18n("NOTIFICATIONS/CAPTCHA_ERROR");v[g.Notification.SocialFacebookLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");v[g.Notification.SocialTwitterLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");
v[g.Notification.SocialGoogleLoginAccessDisable]=d.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");v[g.Notification.DomainNotAllowed]=d.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");v[g.Notification.AccountNotAllowed]=d.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED");v[g.Notification.CantGetMessageList]=d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST");v[g.Notification.CantGetMessage]=d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");v[g.Notification.CantDeleteMessage]=d.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");
v[g.Notification.CantMoveMessage]=d.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");v[g.Notification.CantSaveMessage]=d.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");v[g.Notification.CantSendMessage]=d.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");v[g.Notification.InvalidRecipients]=d.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");v[g.Notification.CantCreateFolder]=d.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER");v[g.Notification.CantRenameFolder]=d.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");v[g.Notification.CantDeleteFolder]=d.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");
v[g.Notification.CantDeleteNonEmptyFolder]=d.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");v[g.Notification.CantSubscribeFolder]=d.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");v[g.Notification.CantUnsubscribeFolder]=d.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");v[g.Notification.CantSaveSettings]=d.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS");v[g.Notification.CantSavePluginSettings]=d.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");v[g.Notification.DomainAlreadyExists]=d.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");
v[g.Notification.CantInstallPackage]=d.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");v[g.Notification.CantDeletePackage]=d.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");v[g.Notification.InvalidPluginPackage]=d.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");v[g.Notification.UnsupportedPluginPackage]=d.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE");v[g.Notification.LicensingServerIsUnavailable]=d.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");v[g.Notification.LicensingExpired]=d.i18n("NOTIFICATIONS/LICENSING_EXPIRED");
v[g.Notification.LicensingBanned]=d.i18n("NOTIFICATIONS/LICENSING_BANNED");v[g.Notification.DemoSendMessageError]=d.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");v[g.Notification.AccountAlreadyExists]=d.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");v[g.Notification.MailServerError]=d.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR");v[g.Notification.UnknownNotification]=d.i18n("NOTIFICATIONS/UNKNOWN_ERROR");v[g.Notification.UnknownError]=d.i18n("NOTIFICATIONS/UNKNOWN_ERROR")};d.getUploadErrorDescByCode=function(a){var b=
"";switch(d.pInt(a)){case g.UploadErrorCode.FileIsTooBig:b=d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case g.UploadErrorCode.FilePartiallyUploaded:b=d.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case g.UploadErrorCode.FileNoUploaded:b=d.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case g.UploadErrorCode.MissingTempFolder:b=d.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case g.UploadErrorCode.FileOnSaveingError:b=d.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case g.UploadErrorCode.FileType:b=
d.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=d.i18n("UPLOAD/ERROR_UNKNOWN")}return b};d.killCtrlAandS=function(a){if(a=a||h.event){var b=a.target||a.srcElement,c=a.keyCode||a.which;if(a.ctrlKey&&c===g.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&c===g.EventKeyCode.A)h.getSelection?h.getSelection().removeAllRanges():h.document.selection&&h.document.selection.clear&&h.document.selection.clear(),a.preventDefault()}};d.createCommand=function(a,
b,c){var l=b?function(){l.canExecute&&l.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};l.enabled=f.observable(!0);c=d.isUnd(c)?!0:c;l.canExecute=d.isFunc(c)?f.computed(function(){return l.enabled()&&c.call(a)}):f.computed(function(){return l.enabled()&&!!c});return l};d.initDataConstructorBySettings=function(a){a.ignoreFolderSubscribe=f.observable(!1);a.editorDefaultType=f.observable(g.EditorDefaultType.Html);a.showImages=f.observable(!1);a.showAnimation=f.observable(!1);
a.allowThemes=f.observable(!0);a.allowCustomLogin=f.observable(!1);a.allowLanguagesOnSettings=f.observable(!0);a.allowLanguagesOnLogin=f.observable(!0);a.desktopNotifications=f.observable(!1);a.useThreads=f.observable(!0);a.replySameFolder=f.observable(!0);a.usePreviewPane=f.observable(!0);a.useCheckboxesInList=f.observable(!0);a.showAnimation.subscribe(function(a){n.bMobileDevice?da.removeClass("rl-anim").addClass("no-rl-anim"):da.toggleClass("rl-anim",a).toggleClass("no-rl-anim",!a)});a.showAnimation.valueHasMutated();
a.desktopNotificationsPermisions=f.computed(function(){a.desktopNotifications();var b=g.DesktopNotifications.NotSupported;if(pa&&pa.permission)switch(pa.permission.toLowerCase()){case "granted":b=g.DesktopNotifications.Allowed;break;case "denied":b=g.DesktopNotifications.Denied;break;case "default":b=g.DesktopNotifications.NotAllowed}else h.webkitNotifications&&h.webkitNotifications.checkPermission&&(b=h.webkitNotifications.checkPermission());return b});a.useDesktopNotifications=f.computed({read:function(){return a.desktopNotifications()&&
g.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()},write:function(b){b?(b=a.desktopNotificationsPermisions(),g.DesktopNotifications.Allowed===b?a.desktopNotifications(!0):g.DesktopNotifications.NotAllowed===b?pa.requestPermission(function(){a.desktopNotifications.valueHasMutated();g.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()?a.desktopNotifications()?a.desktopNotifications.valueHasMutated():a.desktopNotifications(!0):a.desktopNotifications()?a.desktopNotifications(!1):
a.desktopNotifications.valueHasMutated()}):a.desktopNotifications(!1)):a.desktopNotifications(!1)}});a.language=f.observable("");a.languages=f.observableArray([]);a.mainLanguage=f.computed({read:a.language,write:function(b){b!==a.language()?-1<d.inArray(b,a.languages())?a.language(b):0<a.languages().length&&a.language(a.languages()[0]):a.language.valueHasMutated()}});a.theme=f.observable("");a.themes=f.observableArray([]);a.mainTheme=f.computed({read:a.theme,write:function(b){if(b!==a.theme()){var c=
a.themes();-1<d.inArray(b,c)?a.theme(b):0<c.length&&a.theme(c[0])}else a.theme.valueHasMutated()}});a.allowCustomTheme=f.observable(!0);a.allowAdditionalAccounts=f.observable(!0);a.determineUserLanguage=f.observable(!1);a.messagesPerPage=f.observable(o.Defaults.MessagesPerPage);a.mainMessagesPerPage=a.messagesPerPage;a.mainMessagesPerPage=f.computed({read:a.messagesPerPage,write:function(b){-1<d.inArray(d.pInt(b),o.Defaults.MessagesPerPageArray)?b!==a.messagesPerPage()&&a.messagesPerPage(b):a.messagesPerPage.valueHasMutated()}});
a.facebookEnable=f.observable(!1);a.facebookAppID=f.observable("");a.facebookAppSecret=f.observable("");a.twitterEnable=f.observable(!1);a.twitterConsumerKey=f.observable("");a.twitterConsumerSecret=f.observable("");a.googleEnable=f.observable(!1);a.googleClientID=f.observable("");a.googleClientSecret=f.observable("");a.dropboxEnable=f.observable(!1);a.dropboxApiKey=f.observable("");a.contactsIsSupported=f.observable(!1);a.contactsIsAllowed=f.observable(!1)};d.createMomentDate=function(a){return f.computed(function(){n.minuteTick();
return this.moment().fromNow()},a)};d.createMomentShortDate=function(a){return f.computed(function(){var a="",a=fa(),c=this.moment(),l=this.momentDate();return a=4>=a.diff(c,"hours")?l:a.format("L")===c.format("L")?d.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):a.clone().subtract("days",1).format("L")===c.format("L")?d.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):a.year()===c.year()?c.format("D MMM."):c.format("LL")},a)};d.isFolderExpanded=function(a){var b=e.local().get(g.ClientSideKeyName.ExpandedFolders);
return i.isArray(b)&&-1!==i.indexOf(b,a)};d.setExpandedFolder=function(a,b){var c=e.local().get(g.ClientSideKeyName.ExpandedFolders);i.isArray(c)||(c=[]);b?(c.push(a),c=i.uniq(c)):c=i.without(c,a);e.local().set(g.ClientSideKeyName.ExpandedFolders,c)};d.initLayoutResizer=function(a,b,c,d,f,t,g,k){var d=d||300,f=f||500,t=t||f-d/2,g=g||300,h=0,p=j(a),V=j(b),r=j(c),b=e.local().get(k)||t,H=function(a,b,c){if(b||c)a=r.width(),b=b?100*(b.size.width/a):null,null===b&&c&&(b=100*(p.width()/a)),null!==b&&(p.css({width:"",
height:"",right:""+(100-b)+"%"}),V.css({width:"",height:"",left:""+b+"%"}))};b&&p.width(b);h=r.width()-g;h=f>h?h:f;p.resizable({minWidth:d,maxWidth:h,handles:"e",resize:H,stop:H});H(null,null,!0);P.resize(i.throttle(function(b,c){c&&(c.element&&c.element[0].id&&"#"+c.element[0].id===""+a)&&(h=r.width()-g,h=f>h?h:f,p.resizable("option","maxWidth",h),c.size&&c.size.width&&e.local().set(k,c.size.width),H(null,null,!0))},400))};d.initBlockquoteSwitcher=function(a){if(a){var b=j("blockquote:not(.rl-bq-switcher)",
a).filter(function(){return 0===j(this).parent().closest("blockquote",a).length});b&&0<b.length&&b.each(function(){var a=j(this),b=a.height();if(0===b||100<b)a.addClass("rl-bq-switcher hidden-bq"),j('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>').insertBefore(a).click(function(){a.toggleClass("hidden-bq");d.windowResize()}).after("<br />").before("<br />")})}};d.removeBlockquoteSwitcher=function(a){a&&(j(a).find("blockquote.rl-bq-switcher").each(function(){j(this).removeClass("rl-bq-switcher hidden-bq")}),
j(a).find(".rlBlockquoteSwitcher").each(function(){j(this).remove()}))};d.extendAsViewModel=function(a,b){b&&(b.__name=a,x.regViewModelHook(a,b),i.extend(b.prototype,D.prototype))};d.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e};U.settings.push(a)};d.removeSettingsViewModel=function(a){U["settings-removed"].push(a)};d.disableSettingsViewModel=function(a){U["settings-disabled"].push(a)};d.convertThemeName=function(a){return d.trim(a.replace(/[^a-zA-Z]/g,
" ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};d.convertLangName=function(a){return d.i18n("LANGS_NAMES/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)};d.fakeMd5=function(a){for(var b="",a=d.isUnd(a)?32:d.pInt(a);b.length<a;)b+="0123456789abcdefghijklmnopqrstuvwxyz".substr(h.Math.round(36*h.Math.random()),1);return b};d.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")};
d.draggeblePlace=function(){return j('<div class="draggablePlace"><span class="text"></span>&nbsp;<i class="icon-envelope icon-white"></i></div>').appendTo("#rl-hidden")};d.defautOptionsAfterRender=function(a,b){b&&!d.isUnd(b.disable)&&f.applyBindingsToNode(a,{disable:b.disable},b)};d.windowPopupKnockout=function(a,b,c,l){var e=null,f=h.open(""),g="__OpenerApplyBindingsUid"+d.fakeMd5()+"__",k=j("#"+b);h[g]=function(){if(f&&f.document.body&&k&&k[0]){var b=j(f.document.body);j("#rl-content",b).html(k.html());
j("html",f.document).addClass("external "+j("html").attr("class"));d.i18nToNode(b);F.prototype.applyExternal(a,j("#rl-content",b)[0]);h[g]=null;l(f)}};f.document.open();f.document.write('<html><head><meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><meta name="viewport" content="user-scalable=no" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="robots" content="noindex, nofollow, noodp" /><title>'+d.encodeHtml(c)+'</title></head><body><div id="rl-content"></div></body></html>');
f.document.close();e=f.document.createElement("script");e.type="text/javascript";e.innerHTML="if(window&&window.opener&&window.opener['"+g+"']){window.opener['"+g+"']();window.opener['"+g+"']=null}";f.document.getElementsByTagName("head")[0].appendChild(e)};d.settingsSaveHelperFunction=function(a,b,c,l){c=c||null;l=d.isUnd(l)?1E3:d.pInt(l);return function(d,e,f,k,h){b.call(c,e&&e.Result?g.SaveSettingsStep.TrueResult:g.SaveSettingsStep.FalseResult);a&&a.call(c,d,e,f,k,h);i.delay(function(){b.call(c,
g.SaveSettingsStep.Idle)},l)}};d.settingsSaveHelperSimpleFunction=function(a,b){return d.settingsSaveHelperFunction(null,a,b,1E3)};d.resizeAndCrop=function(a,b,c){var d=new Image;d.onload=function(){var a=[0,0],d=document.createElement("canvas"),l=d.getContext("2d");d.width=b;d.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];l.fillStyle="#fff";l.fillRect(0,0,b,b);l.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,b,b);c(d.toDataURL("image/jpeg"))};
d.src=a};oa={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return oa.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){for(var b="",c,d,e,f,g,k,h=0,a=oa._utf8_encode(a);h<a.length;)c=a.charCodeAt(h++),d=a.charCodeAt(h++),e=a.charCodeAt(h++),f=c>>2,c=(c&3)<<4|d>>4,g=(d&15)<<2|e>>6,k=e&63,isNaN(d)?g=k=64:isNaN(e)&&(k=64),b=b+this._keyStr.charAt(f)+this._keyStr.charAt(c)+this._keyStr.charAt(g)+this._keyStr.charAt(k);
return b},decode:function(a){for(var b="",c,d,e,f,g,k=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)c=this._keyStr.indexOf(a.charAt(k++)),d=this._keyStr.indexOf(a.charAt(k++)),f=this._keyStr.indexOf(a.charAt(k++)),g=this._keyStr.indexOf(a.charAt(k++)),c=c<<2|d>>4,d=(d&15)<<4|f>>2,e=(f&3)<<6|g,b+=String.fromCharCode(c),64!==f&&(b+=String.fromCharCode(d)),64!==g&&(b+=String.fromCharCode(e));return oa._utf8_decode(b)},_utf8_encode:function(a){for(var a=a.replace(/\r\n/g,"\n"),b="",c=0,d=a.length,
e=0;c<d;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):(127<e&&2048>e?b+=String.fromCharCode(e>>6|192):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128)),b+=String.fromCharCode(e&63|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):191<d&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((d&31)<<6|e&63),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((d&15)<<12|
(e&63)<<6|f&63),c+=3);return b}};f.bindingHandlers.tooltip={init:function(a,b){if(!n.bMobileDevice){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,trigger:"hover",title:function(){return'<span class="tooltip-class '+c+'">'+d.i18n(f.utils.unwrapObservable(b()))+"</span>"}})}}};f.bindingHandlers.tooltip2={init:function(a,b){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,title:function(){return'<span class="tooltip-class '+c+
'">'+b()()+"</span>"}})}};f.bindingHandlers.popover={init:function(a,b){j(a).popover(f.utils.unwrapObservable(b()))}};f.bindingHandlers.resizecrop={init:function(a){j(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,b){b()();j(a).resizecrop({width:"100",height:"100"})}};f.bindingHandlers.onEnter={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&13===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};f.bindingHandlers.onEsc=
{init:function(a,b,c,d){j(a).on("keypress",function(c){c&&27===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};f.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,show:f.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=f.utils.unwrapObservable(b());j(a).modal(c?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",c)},1)}};f.bindingHandlers.i18nInit={init:function(a){d.i18nToNode(a)}};f.bindingHandlers.i18nUpdate=
{update:function(a,b){f.utils.unwrapObservable(b());d.i18nToNode(a)}};f.bindingHandlers.link={update:function(a,b){j(a).attr("href",f.utils.unwrapObservable(b()))}};f.bindingHandlers.title={update:function(a,b){j(a).attr("title",f.utils.unwrapObservable(b()))}};f.bindingHandlers.textF={init:function(a,b){j(a).text(f.utils.unwrapObservable(b()))}};f.bindingHandlers.initDom={init:function(a,b){b()(a)}};f.bindingHandlers.initResizeTrigger={init:function(a,b){var c=f.utils.unwrapObservable(b());j(a).css({height:c[1],
"min-height":c[1]})},update:function(a,b){var c=f.utils.unwrapObservable(b()),l=d.pInt(c[1]),e=0,e=j(a).offset().top;0<e&&(e+=d.pInt(c[2]),e=P.height()-e,l<e&&(l=e),j(a).css({height:l,"min-height":l}))}};f.bindingHandlers.appendDom={update:function(a,b){j(a).hide().empty().append(f.utils.unwrapObservable(b())).show()}};f.bindingHandlers.draggable={init:function(a,b,c){if(!n.bMobileDevice){var l=(c=c())&&c.droppableSelector?c.droppableSelector:"",c={distance:20,handle:".dragHandle",cursorAt:{top:22,
left:3},refreshPositions:!0,scroll:!0};l&&(c.drag=function(a){j(l).each(function(){var b=null,c=null,l=j(this),c=l.offset(),b=c.top+l.height();h.clearInterval(l.data("timerScroll"));l.data("timerScroll",!1);if(a.pageX>=c.left&&a.pageX<=c.left+l.width()&&(a.pageY>=b-100&&a.pageY<=b&&(b=function(){l.scrollTop(l.scrollTop()+3);d.windowResize()},l.data("timerScroll",h.setInterval(b,10)),b()),a.pageY>=c.top&&a.pageY<=c.top+100))c=function(){l.scrollTop(l.scrollTop()-3);d.windowResize()},l.data("timerScroll",
h.setInterval(c,10)),c()})},c.stop=function(){j(l).each(function(){h.clearInterval(j(this).data("timerScroll"));j(this).data("timerScroll",!1)})});c.helper=function(a){return b()(a&&a.target?f.dataFor(a.target):null)};j(a).draggable(c).on("mousedown",function(){d.removeInFocus()})}}};f.bindingHandlers.droppable={init:function(a,b,c){if(!n.bMobileDevice){var d=b(),e=(b=c())&&b.droppableOver?b.droppableOver:null,f=b&&b.droppableOut?b.droppableOut:null,b={tolerance:"pointer",hoverClass:"droppableHover"};
d&&(b.drop=function(a,b){d(a,b)},e&&(b.over=function(a,b){e(a,b)}),f&&(b.out=function(a,b){f(a,b)}),j(a).droppable(b))}}};f.bindingHandlers.nano={init:function(a){n.bDisableNanoScroll||j(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}};f.bindingHandlers.saveTrigger={init:function(a){j(a).append('&nbsp;&nbsp;<i class="icon-spinner-2 animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger")},update:function(a,
b){var c=f.utils.unwrapObservable(b()),d=j(a);switch(c.toString()){case "1":d.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case "0":d.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case "-2":d.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:d.find(".animated").hide().end().find(".error,.success").removeClass("visible")}}};
f.bindingHandlers.select2={init:function(a,b){var c=0,l=null,g=new h.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),t=new h.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),y=function(){return""},k=function(a){e.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,results:i.map(b,function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};j(a).addClass("ko-select2").select2({query:function(a){a&&(0===c?(k(a),c=h.setTimeout(d.emptyFunction,100)):(h.clearInterval(c),c=h.setTimeout(function(){k(a)},
100)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;if(null!==c)return c},formatResult:function(a,b,c,d){b=a&&a.c?a.c.select2Result(b):"";return""===b?d(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&g.test(a)?{id:a,text:a}:null},formatNoMatches:y,formatSearching:function(){return d.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:y,formatSelectionTooBig:y,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,
openOnEnter:!1});f.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),c=0,e=a.length,f=null,g=[];c<e;c++)if((f=a[c])&&f.id)f.c||(f.c=new G,(l=t.exec(d.trim(f.id)))&&!d.isUnd(l[2])?(f.c.name=l[1],f.c.email=l[2]):f.c.email=f.id),g.push(f.c);b()(g)})},update:function(a,b){for(var c=f.utils.unwrapObservable(b()),d=0,e=c.length,g=null,y="",k=[];d<e;d++)g=c[d],y=g.toLine(!1),k.push({id:y,text:y,c:g});j(a).select2("data",
k)}};f.bindingHandlers.command={init:function(a,b,c,d){var e=j(a),g=b();if(!g||!g.enabled||!g.canExecute)throw Error("You are not using command function");e.addClass("command");f.bindingHandlers[e.is("form")?"submit":"click"].init.apply(d,arguments)},update:function(a,b){var c=!0,d=j(a),e=b(),c=e.enabled();d.toggleClass("command-not-enabled",!c);c&&(c=e.canExecute(),d.toggleClass("command-can-not-be-execute",!c));d.toggleClass("command-disabled disable disabled",!c);(d.is("input")||d.is("button"))&&
d.prop("disabled",!c)}};f.extenders.trimmer=function(a){var b=f.computed({read:a,write:function(b){a(d.trim(b.toString()))},owner:this});b(a());return b};f.extenders.reversible=function(a){var b=a();a.commit=function(){b=a()};a.reverse=function(){a(b)};a.commitedValue=function(){return b};return a};f.extenders.toggleSubscribe=function(a,b){a.subscribe(b[1],b[0],"beforeChange");a.subscribe(b[2],b[0]);return a};f.extenders.falseTimeout=function(a,b){a.iTimeout=0;a.subscribe(function(c){c&&(h.clearTimeout(a.iTimeout),
a.iTimeout=h.setTimeout(function(){a(!1);a.iTimeout=0},d.pInt(b)))});return a};f.observable.fn.validateEmail=function(){this.hasError=f.observable(!1);this.subscribe(function(a){a=d.trim(a);this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this);this.valueHasMutated();return this};f.observable.fn.validateFunc=function(a){this.hasFuncError=f.observable(!1);d.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated());return this};C.prototype.root=function(){return this.sBase};
C.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};C.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a};C.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};C.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"};C.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"};
C.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"};C.prototype.change=function(a){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+h.encodeURIComponent(a)+"/"};C.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a};C.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a};C.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a};C.prototype.inbox=
function(){return this.sBase+"mailbox/Inbox"};C.prototype.settings=function(a){var b=this.sBase+"settings";!d.isUnd(a)&&""!==a&&(b+="/"+a);return b};C.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};C.prototype.mailBox=function(a,b,c){var b=d.isNormal(b)?d.pInt(b):1,c=d.pString(c),e=this.sBase+"mailbox/";""!==a&&(e+=encodeURI(a));1<b&&(e=e.replace(/[\/]+$/,""),e+="/p"+
b);""!==c&&(e=e.replace(/[\/]+$/,""),e+="/"+encodeURI(c));return e};C.prototype.phpInfo=function(){return this.sServer+"Info"};C.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"};C.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"};C.prototype.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"};
C.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a};C.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"};C.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"};C.prototype.socialGoogle=
function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};C.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")};C.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){d.isFunc(b)&&(d.isArray(x.oSimpleHooks[a])||
(x.oSimpleHooks[a]=[]),x.oSimpleHooks[a].push(b))};x.runHook=function(a,b){d.isArray(x.oSimpleHooks[a])&&(b=b||[],i.each(x.oSimpleHooks[a],function(a){a.apply(null,b)}))};x.mainSettingsGet=function(a){return e?e.settingsGet(a):null};x.remoteRequest=function(a,b,c,d,f,g){e&&e.remote().defaultRequest(a,b,c,d,f,g)};x.settingsGet=function(a,b){var c=x.mainSettingsGet("Plugins");return(c=c&&d.isUnd(c[a])?null:c[a])?d.isUnd(c[b])?null:c[b]:null};u.prototype.initLanguage=function(a,b,c){this.oOptions.LangSwitcherConferm=
a;this.oOptions.LangSwitcherTextLabel=b;this.oOptions.LangSwitcherHtmlLabel=c};u.prototype.execCom=function(a,b,c){h.document&&(h.document.execCommand(a,b||!1,c||null),this.updateTextArea())};u.prototype.getEditorSelection=function(){var a=null;h.getSelection?a=h.getSelection():h.document.getSelection?a=h.document.getSelection():h.document.selection&&(a=h.document.selection);return a};u.prototype.getEditorRange=function(){var a=this.getEditorSelection();return!a||0===a.rangeCount?null:a.getRangeAt?
a.getRangeAt(0):a.createRange()};u.prototype.ec=function(a,b,c){this.execCom(a,b,c)};u.prototype.heading=function(a){this.ec("formatblock",!1,j.browser.msie?"Heading "+a:"h"+a)};u.prototype.insertImage=function(a){this.isHtml()&&!this.bOnlyPlain&&(this.htmlarea.focus(),this.ec("insertImage",!1,a))};u.prototype.focus=function(){this.isHtml()&&!this.bOnlyPlain?this.htmlarea.focus():this.textarea.focus()};u.prototype.setcolor=function(a,b){var c=null,c="";j.browser.msie&&9>d.pInt(j.browser.version)?
(c=this.getEditorRange())&&c.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b):(c=j.browser.msie?"forecolor"===a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(c,!1,b))};u.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")};u.prototype.toHtmlString=function(){return this.editor.innerHTML};u.prototype.toString=function(){return this.editor.innerText};u.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())};u.prototype.updateHtmlArea=
function(){this.editor.innerHTML=this.textarea.val()};u.prototype.setRawText=function(a,b){b&&!this.bOnlyPlain?(this.isHtml()||(this.textarea.val(""),this.switchToHtml()),this.textarea.val(a.toString()),this.updateHtmlArea()):(this.textarea.val(a.toString()),this.updateHtmlArea(),this.switchToPlain(!1))};u.prototype.clear=function(){this.textarea.val("");this.editor.innerHTML="";this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()};u.prototype.getTextForRequest=function(){this.isHtml()&&
this.updateTextArea();return this.textarea.val()};u.prototype.getTextFromHtml=function(a){var b="",c=function(){if(arguments&&1<arguments.length){var a=d.trim(arguments[1]).replace(/__bq__start__([\s\S\n\r]*)__bq__end__/gm,c),a="\n> "+d.trim(a).replace(/\n/gm,"\n> ")+"\n>\n";return a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+d.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},e=function(){if(arguments&&1<arguments.length){var a=d.trim(arguments[1]);0<a.length&&
(a=a.replace(/<div[^>]*>([\s\S]*)<\/div>/gmi,e),a="\n"+d.trim(a)+"\n");return a}return""},a=d.isUnd(a)?!0:!!a,b=this.toHtmlString().replace(/[\s]+/gm," ").replace(/<br\s?\/?>/gmi,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<hr[^>]*>/gmi,"\n_______________________________\n\n").replace(/<img [^>]*>/gmi,"").replace(/<div[^>]*>([\s\S]*)<\/div>/gmi,e).replace(/<blockquote[^>]*>/gmi,"\n__bq__start__\n").replace(/<\/blockquote>/gmi,
"\n__bq__end__\n").replace(/<a [^>]*>([\s\S]*?)<\/a>/gmi,function(){return arguments&&1<arguments.length?d.trim(arguments[1]):""}).replace(/&nbsp;/gi," ").replace(/<[^>]*>/gm,"").replace(/&gt;/gi,">").replace(/&lt;/gi,"<").replace(/&amp;/gi,"&").replace(/&\w{2,6};/gi,"");return(a?d.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,c).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")};u.prototype.getHtmlFromText=function(){return d.convertPlainTextToHtml(this.textarea.val())};
u.prototype.switchToggle=function(){this.isHtml()?this.switchToPlain():this.switchToHtml()};u.prototype.switchToPlain=function(a){var a=d.isUnd(a)?!0:a,b=this.getTextFromHtml(),c=i.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(b),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);!a||0===d.trim(b).length?c(!0):c(h.confirm(this.oOptions.LangSwitcherConferm))};u.prototype.switcherLinkText=
function(a){return a?this.oOptions.LangSwitcherTextLabel:this.oOptions.LangSwitcherHtmlLabel};u.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar");j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0));this.textarea.val(this.getHtmlFromText());this.updateHtmlArea();this.textarea.hide();this.htmlarea.show();this.fOnSwitch&&this.fOnSwitch(!0)};u.prototype.addButton=function(a,b){var c=this;j("<div />").addClass("editorToolbarButtom").append(j('<a tabindex="-1" href="javascript:void(0);"></a>').addClass(a)).attr("title",
b).click(function(b){d.isUnd(u.htmlFunctions[a])?h.alert(a):u.htmlFunctions[a].apply(c,[j(this),b])}).appendTo(this.toolbar)};u.htmlInitToolbar=function(){if(!this.bOnlyPlain){this.addButton("bold","Bold");this.addButton("italic","Italic");this.addButton("underline","Underline");this.addButton("strikethrough","Strikethrough");this.addButton("removeformat","removeformat");this.addButton("justifyleft","justifyleft");this.addButton("justifycenter","justifycenter");this.addButton("justifyright","justifyright");
this.addButton("horizontalrule","horizontalrule");this.addButton("orderedlist","orderedlist");this.addButton("unorderedlist","unorderedlist");this.addButton("indent","indent");this.addButton("outdent","outdent");this.addButton("forecolor","forecolor");var a=this;j("<span />").addClass("editorSwitcher").text(a.switcherLinkText(!0)).click(function(){a.switchToggle()}).appendTo(a.toolbar)}};u.htmlInitEditor=function(){this.editor=this.htmlarea[0];this.editor.innerHTML=this.textarea.val()};u.htmlAttachEditorEvents=
function(){var a=this,b=function(b){if(b=(b&&b.originalEvent?b.originalEvent:b)||h.event){b.stopPropagation();b.preventDefault();var c=null,d=null;if((b=b.files||(b.dataTransfer?b.dataTransfer.files:null))&&1===b.length&&b[0]&&b[0].type&&0===b[0].type.indexOf("image/")){var d=b[0],c=new h.FileReader,e=d;c.onload=function(b){a.insertImage(b.target.result,e.name)};c.readAsDataURL(d)}}a.htmlarea.removeClass("editorDragOver")},c=function(){a.htmlarea.removeClass("editorDragOver")},d=function(b){b.stopPropagation();
b.preventDefault();a.htmlarea.addClass("editorDragOver")},e=function(b){(b=b&&b.clipboardData?b.clipboardData:b&&b.originalEvent&&b.originalEvent.clipboardData?b.originalEvent.clipboardData:null)&&b.items&&i.each(b.items,function(b){if(b&&(b.type&&0===b.type.indexOf("image/"))&&b.getAsFile){var c=null,d=b.getAsFile();d&&(c=new h.FileReader,c.onload=function(b){a.insertImage(b.target.result,d.name)},c.readAsDataURL(d))}})};!this.bOnlyPlain&&(h.File&&h.FileReader&&h.FileList)&&(this.htmlarea.bind("dragover",
d),this.htmlarea.bind("dragleave",c),this.htmlarea.bind("drop",b),this.htmlarea.bind("paste",e))};for(var ta=u,ua=[],Wa=[],Y=0,Z=0,Ja=0,Ka=0,Z="",Y=0;256>Y;Y+=85)Z=Y.toString(16),ua.push(1===Z.length?"0"+Z:Z);Ka=ua.length;for(Y=0;Y<Ka;Y++)for(Z=0;Z<Ka;Z++)for(Ja=0;Ja<Ka;Ja++)Wa.push("#"+ua[Y]+""+ua[Z]+""+ua[Ja]);ta.htmlColorPickerColors=Wa;var ta=u,Xa=j(h.document),Ya=!1,va=j('<div style="position: absolute;" class="editorFontStylePicker"><div class="editorFpFonts"></div></div>'),Za=va.find(".editorFpFonts"),
$a=function(){};j.each("Arial;Arial Black;Courier New;Tahoma;Times New Roman;Verdana".split(";"),function(a,b){Za.append(j('<a href="javascript:void(0);" tabindex="-1" class="editorFpFont" style="font-family: '+b+';">'+b+"</a>").click(function(){$a(b)}));Za.append("<br />")});va.hide();ta.htmlFontPicker=function(a,b,c){Ya||(va.appendTo(c),Ya=!0);$a=b;Xa.unbind("click.fpNamespace");h.setTimeout(function(){Xa.one("click.fpNamespace",function(){va.hide()})},500);b=j(a).position();va.css("top",5+b.top+
j(a).height()+"px").css("left",b.left+"px").show()};var ta=u,ab=j(h.document),bb=!1,wa=j('<div style="position: absolute;" class="editorColorPicker"><div class="editorCpColors"></div></div>'),cb=wa.find(".editorCpColors"),db=function(){};j.each(u.htmlColorPickerColors,function(a,b){cb.append('<a href="javascript:void(0);" tabindex="-1" class="editorCpColor" style="background-color: '+b+';"></a>')});wa.hide();j(".editorCpColor",cb).click(function(a){var b=1,c="#000000",a=j(a.target).css("background-color"),
c=a.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==c){for(delete c[0];3>=b;++b)c[b]=d.pInt(c[b]).toString(16),1===c[b].length&&(c[b]="0"+c[b]);c="#"+c.join("")}else c=a;db(c)});ta.htmlColorPicker=function(a,b,c){bb||(wa.appendTo(c),bb=!0);c=j(a).position();db=b;ab.unbind("click.cpNamespace");h.setTimeout(function(){ab.one("click.cpNamespace",function(){wa.hide()})},100);wa.css("top",5+c.top+j(a).height()+"px").css("left",c.left+"px").show()};u.htmlFunctions={bold:function(){this.ec("bold")},
italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")},justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},
unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){u.htmlColorPicker(a,i.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){u.htmlColorPicker(a,i.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){u.htmlFontPicker(a,i.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}};M.prototype.selectItemCallbacks=function(a){(this.oCallbacks.onItemSelect||this.emptyFunction)(a)};M.prototype.init=
function(a,b){this.oContentVisible=a;this.oContentScrollable=b;if(this.oContentVisible&&this.oContentScrollable){var c=this;j(this.oContentVisible).on("click",this.sItemSelector,function(a){c.actionClick(f.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=f.dataFor(this);b&&(a&&a.shiftKey?c.actionClick(b,a):(c.sLastUid=c.getItemUid(b),b.selected()?(b.checked(!1),c.selectedItem(null)):b.checked(!b.checked())))});j(h.document).on("keydown",function(a){var b=!0;if(a&&c.bUseKeyboard&&
!d.inFocus())if(-1<d.inArray(a.keyCode,[g.EventKeyCode.Up,g.EventKeyCode.Down,g.EventKeyCode.Insert,g.EventKeyCode.Home,g.EventKeyCode.End,g.EventKeyCode.PageUp,g.EventKeyCode.PageDown]))c.newSelectPosition(a.keyCode,a.shiftKey),b=!1;else if(g.EventKeyCode.Delete===a.keyCode&&!a.ctrlKey&&!a.shiftKey){if(c.oCallbacks.onDelete)c.oCallbacks.onDelete();b=!1}return b})}};M.prototype.selectByUid=function(a,b){this.useItemSelectCallback=b=d.isUnd(b)?!0:!!b;var c=i.find(this.list(),function(b){return a===
this.getItemUid(b)},this);c&&this.selectedItem(c);this.useItemSelectCallback=!0};M.prototype.useKeyboard=function(a){this.bUseKeyboard=!!a};M.prototype.getItemUid=function(a){var b="",c=this.oCallbacks.onItemGetUid||null;c&&a&&(b=c(a));return b.toString()};M.prototype.newSelectPosition=function(a,b){var c=this,d=0,e=!1,f=!1,y=null,k=this.list(),j=k?k.length:0,p=this.selectedItem();if(0<j)if(p){if(p)if(g.EventKeyCode.Down===a||g.EventKeyCode.Up===a||g.EventKeyCode.Insert===a)i.each(k,function(b){if(!f)switch(a){case g.EventKeyCode.Up:p===
b?f=!0:y=b;break;case g.EventKeyCode.Down:case g.EventKeyCode.Insert:e?(y=b,f=!0):p===b&&(e=!0)}});else if(g.EventKeyCode.Home===a||g.EventKeyCode.End===a)g.EventKeyCode.Home===a?y=k[0]:g.EventKeyCode.End===a&&(y=k[k.length-1]);else if(g.EventKeyCode.PageDown===a)for(;d<j;d++){if(p===k[d]){d+=10;d=j-1<d?j-1:d;y=k[d];break}}else if(g.EventKeyCode.PageUp===a)for(d=j;0<=d;d--)if(p===k[d]){d-=10;d=0>d?0:d;y=k[d];break}}else if(g.EventKeyCode.Down===a||g.EventKeyCode.Insert===a||g.EventKeyCode.Home===
a||g.EventKeyCode.PageUp===a)y=k[0];else if(g.EventKeyCode.Up===a||g.EventKeyCode.End===a||g.EventKeyCode.PageDown===a)y=k[k.length-1];y?(p&&(b?(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)&&p.checked(!p.checked()):g.EventKeyCode.Insert===a&&p.checked(!p.checked())),this.throttleSelection=!0,this.selectedItem(y),this.throttleSelection=!0,0!==this.iSelectTimer?(h.clearTimeout(this.iSelectTimer),this.iSelectTimer=h.setTimeout(function(){c.iSelectTimer=0;c.actionClick(y)},1E3)):(this.iSelectTimer=
h.setTimeout(function(){c.iSelectTimer=0},200),this.actionClick(y)),this.scrollToSelected()):p&&(b&&(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)?p.checked(!p.checked()):g.EventKeyCode.Insert===a&&p.checked(!p.checked()))};M.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=j(this.sItemSelectedSelector,this.oContentScrollable),b=a.position(),c=this.oContentVisible.height(),a=a.outerHeight();return b&&(0>b.top||b.top+a>c)?(0>b.top?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+
b.top-20):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+b.top-c+a+20),!0):!1};M.prototype.eventClickFunction=function(a,b){var c=this.getItemUid(a),d=0,e=0,f=null,g="",k=!1,h=!1,i=[],j=!1;if(b&&b.shiftKey&&""!==c&&""!==this.sLastUid&&c!==this.sLastUid){i=this.list();j=a.checked();d=0;for(e=i.length;d<e;d++){f=i[d];g=this.getItemUid(f);k=!1;if(g===this.sLastUid||g===c)k=!0;k&&(h=!h);(h||k)&&f.checked(j)}}this.sLastUid=""===c?"":c};M.prototype.actionClick=function(a,b){if(a){var c=
!0,d=this.getItemUid(a);b&&(b.shiftKey?(c=!1,""===this.sLastUid&&(this.sLastUid=d),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(c=!1,this.sLastUid=d,a.checked(!a.checked())));c&&(this.selectedItem(a),this.sLastUid=d)}};M.prototype.on=function(a,b){this.oCallbacks[a]=b};ya.supported=function(){return!0};ya.prototype.set=function(a,b){var c=j.cookie(o.Values.ClientSideCookieIndexName),d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,j.cookie(o.Values.ClientSideCookieIndexName,
JSON.stringify(e),{expires:30}),d=!0}catch(f){}return d};ya.prototype.get=function(a){var b=j.cookie(o.Values.ClientSideCookieIndexName),c=null;try{c=(c=null===b?null:JSON.parse(b))&&!d.isUnd(c[a])?c[a]:null}catch(e){}return c};za.supported=function(){return!!h.localStorage};za.prototype.set=function(a,b){var c=h.localStorage[o.Values.ClientSideCookieIndexName]||null,d=!1,e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,h.localStorage[o.Values.ClientSideCookieIndexName]=JSON.stringify(e),
d=!0}catch(f){}return d};za.prototype.get=function(a){var b=h.localStorage[o.Values.ClientSideCookieIndexName]||null,c=null;try{c=(c=null===b?null:JSON.parse(b))&&!d.isUnd(c[a])?c[a]:null}catch(e){}return c};Aa.prototype.oDriver=null;Aa.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};Aa.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null};Sa.prototype.bootstart=function(){};D.prototype.sPosition="";D.prototype.sTemplate="";D.prototype.viewModelName=
"";D.prototype.viewModelDom=null;D.prototype.viewModelTemplate=function(){return this.sTemplate};D.prototype.viewModelPosition=function(){return this.sPosition};D.prototype.cancelCommand=D.prototype.closeCommand=function(){};L.prototype.oCross=null;L.prototype.sScreenName="";L.prototype.aViewModels=[];L.prototype.viewModels=function(){return this.aViewModels};L.prototype.screenName=function(){return this.sScreenName};L.prototype.routes=function(){return null};L.prototype.__cross=function(){return this.oCross};
L.prototype.__start=function(){var a=this.routes(),b=null,c=null;d.isNonEmptyArray(a)&&(c=i.bind(this.onRoute||d.emptyFunction,this),b=Ra.create(),i.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)};F.prototype.sDefaultScreenName="";F.prototype.oScreens={};F.prototype.oBoot=null;F.prototype.oCurrentScreen=null;F.prototype.showLoading=function(){j("#rl-loading").show()};F.prototype.hideLoading=function(){j("#rl-loading").hide()};F.prototype.routeOff=function(){R.changed.active=!1};
F.prototype.routeOn=function(){R.changed.active=!0};F.prototype.setBoot=function(a){d.isNormal(a)&&(this.oBoot=a);return this};F.prototype.screen=function(a){return""!==a&&!d.isUnd(this.oScreens[a])?this.oScreens[a]:null};F.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,d.isArray(c)?c:[])};F.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var c=new a(b),l=c.viewModelPosition(),g=j("#rl-content #rl-"+l.toLowerCase()),t=null;a.__builded=!0;a.__vm=c;c.data=e.data();c.viewModelName=
a.__name;g&&1===g.length?(t=j("<div>").addClass("rl-view-model").addClass("RL-"+c.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+c.viewModelTemplate()+'"}, i18nInit: true'),t.appendTo(g),c.viewModelDom=t,a.__dom=t,"Popups"===l&&(c.cancelCommand=c.closeCommand=d.createCommand(c,function(){q.hideScreenPopup(a)})),x.runHook("view-model-pre-build",[a.__name,c,t]),f.applyBindings(c,t[0]),this.delegateRun(c,"onBuild",[t]),x.runHook("view-model-post-build",[a.__name,c,t])):d.log("Cannot find view model position: "+
l)}return a?a.__vm:null};F.prototype.applyExternal=function(a,b){a&&b&&f.applyBindings(a,b)};F.prototype.hideScreenPopup=function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),i.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};F.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),
x.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};F.prototype.screenOnRoute=function(a,b){var c=this,e=null,f=null;""===d.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){e=this.screen(a);if(!e&&(e=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;e&&e.__started&&(e.__builded||(e.__builded=!0,d.isNonEmptyArray(e.viewModels())&&i.each(e.viewModels(),function(a){this.buildViewModel(a,e)},this),this.delegateRun(e,"onBuild")),i.defer(function(){if(c.oCurrentScreen){c.delegateRun(c.oCurrentScreen,
"onHide");d.isNonEmptyArray(c.oCurrentScreen.viewModels())&&i.each(c.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);c.delegateRun(a.__vm,"onHide")}})}c.oCurrentScreen=e;if(c.oCurrentScreen){c.delegateRun(c.oCurrentScreen,"onShow");x.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]);d.isNonEmptyArray(c.oCurrentScreen.viewModels())&&i.each(c.oCurrentScreen.viewModels(),function(a){if(a.__vm&&
a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);c.delegateRun(a.__vm,"onShow");x.runHook("view-model-on-show",[a.__name,a.__vm])}},c)}(f=e.__cross())&&f.parse(b)}))}};F.prototype.startScreens=function(a){i.each(a,function(a){var c=(a=new a)?a.screenName():"";a&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),x.runHook("screen-pre-start",
[a.screenName(),a]),this.delegateRun(a,"onStart"),x.runHook("screen-post-start",[a.screenName(),a]))},this);a=Ra.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));R.initialized.add(a.parse,a);R.changed.add(a.parse,a);R.init()};F.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1):a;a="/"===a.substr(0,1)?a.substr(1):a;(d.isUnd(b)?0:b)?(R.changed.active=!1,R.setHash(a),R.changed.active=!0):(R.changed.active=!0,R.setHash(a))};F.prototype.bootstart=function(){this.oBoot&&
this.oBoot.bootstart&&this.oBoot.bootstart();return this};q=new F;G.newInstanceFromJson=function(a){var b=new G;return b.initByJson(a)?b:null};G.prototype.name="";G.prototype.email="";G.prototype.privateType=null;G.prototype.validate=function(){return""!==this.name||""!==this.email};G.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"};G.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};G.prototype.type=function(){if(null===this.privateType&&(this.email&&
"@facebook.com"===this.email.substr(-13)&&(this.privateType=g.EmailType.Facebook),null===this.privateType))this.privateType=g.EmailType.Default;return this.privateType};G.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};G.prototype.parse=function(a){var a=d.trim(a),b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};G.prototype.initByJson=
function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&(this.name=d.trim(a.Name),this.email=d.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};G.prototype.toLine=function(a,b){var c="";""!==this.email&&(b=d.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'<a href="mailto:'+d.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+d.encodeHtml(this.name)+"</a>":this.name:(c=this.email,""!==this.name?c=b?d.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+d.encodeHtml('"'+
this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+d.encodeHtml(c)+"</a>"+d.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c='<a href="mailto:'+d.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+d.encodeHtml(this.email)+"</a>")));return c};G.prototype.select2Result=function(){var a="",b=e.cache().getUserPic(this.email),a=""!==b?a+('<img class="select2-user-pic pull-left" src="'+d.encodeHtml(b)+'" />'):a+('<img class="select2-user-pic pull-left" src="'+e.link().emptyContactPic()+
'" />');g.EmailType.Facebook===this.type()?(a+=""+(0<this.name.length?this.name:this.email),a+='<i class="icon-facebook pull-right select2-icon-result" />'):a+=""+(0<this.name.length?this.email+' <span class="select2-subname">('+this.name+")</span>":this.email);return a+""};G.prototype.select2Selection=function(a){var b="";if(g.EmailType.Facebook===this.type()){if(b=0<this.name.length?this.name:this.email,""!==b)return j("<pan>").text(b).appendTo(a),a.append('<i class="icon-facebook select2-icon"></i>'),
null}else b=0<this.name.length?this.name+" ("+this.email+")":this.email;return b};qa.prototype.parse=function(a){var b=!1;a&&"Object/Contact"===a["@Object"]&&(this.idContact=d.pInt(a.IdContact),this.listName=d.pString(a.ListName),this.name=d.pString(a.Name),this.emails=d.isNonEmptyArray(a.Emails)?a.Emails:[],this.imageHash=d.pString(a.ImageHash),b=!0);return b};qa.prototype.srcAttr=function(){return""===this.imageHash?e.link().emptyContactPic():e.link().getUserPicUrlFromHash(this.imageHash)};qa.prototype.generateUid=
function(){return""+this.idContact};qa.prototype.lineAsCcc=function(){var a=[];this.deleted()&&a.push("deleted");this.selected()&&a.push("selected");this.checked()&&a.push("checked");return a.join(" ")};E.newInstanceFromJson=function(a){var b=new E;return b.initByJson(a)?b:null};E.prototype.mimeType="";E.prototype.fileName="";E.prototype.estimatedSize=0;E.prototype.friendlySize="";E.prototype.isInline=!1;E.prototype.isLinked=!1;E.prototype.cid="";E.prototype.cidWithOutTags="";E.prototype.download=
"";E.prototype.folder="";E.prototype.uid="";E.prototype.mimeIndex="";E.prototype.initByJson=function(a){var b=!1;a&&"Object/Attachment"===a["@Object"]&&(this.mimeType=a.MimeType,this.fileName=a.FileName,this.estimatedSize=d.pInt(a.EstimatedSize),this.isInline=!!a.IsInline,this.isLinked=!!a.IsLinked,this.cid=a.CID,this.download=a.Download,this.folder=a.Folder,this.uid=a.Uid,this.mimeIndex=a.MimeIndex,this.friendlySize=d.friendlySize(this.estimatedSize),this.cidWithOutTags=this.cid.replace(/^<+/,"").replace(/>+$/,
""),b=!0);return b};E.prototype.isImage=function(){return-1<d.inArray(this.mimeType.toLowerCase(),["image/png","image/jpg","image/jpeg","image/gif"])};E.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)};E.prototype.linkDownload=function(){return e.link().attachmentDownload(this.download)};E.prototype.linkPreview=function(){return e.link().attachmentPreview(this.download)};E.prototype.linkPreviewAsPlain=function(){return e.link().attachmentPreviewAsPlain(this.download)};E.prototype.generateTransferDownloadUrl=
function(){var a=this.linkDownload();"http"!==a.substr(0,4)&&(a=h.location.protocol+"//"+h.location.host+h.location.pathname+a);return this.mimeType+":"+this.fileName+":"+a};E.prototype.eventDragStart=function(a,b){var c=b.originalEvent||b;a&&(c&&c.dataTransfer&&c.dataTransfer.setData)&&c.dataTransfer.setData("DownloadURL",this.generateTransferDownloadUrl());return!0};E.prototype.iconClass=function(){var a=this.mimeType.toLocaleString().split("/"),b="icon-file";a&&a[1]&&("image"===a[0]?b="icon-image":
"text"===a[0]?b="icon-file-xml":"audio"===a[0]?b="icon-music":"video"===a[0]?b="icon-film":-1<d.inArray(a[1],"zip 7z tar rar gzip bzip bzip2 x-zip x-7z x-rar x-tar x-gzip x-bzip x-bzip2 x-zip-compressed x-7z-compressed x-rar-compressed".split(" "))?b="icon-file-zip":-1<d.inArray(a[1],["pdf","x-pdf"])?b="icon-file-pdf":-1<d.inArray(a[1],["exe","x-exe","x-winexe","bat"])?b="icon-console":-1<d.inArray(a[1],"rtf msword vnd.msword vnd.openxmlformats-officedocument.wordprocessingml.document vnd.openxmlformats-officedocument.wordprocessingml.template vnd.ms-word.document.macroEnabled.12 vnd.ms-word.template.macroEnabled.12".split(" "))?
b="icon-file-word":-1<d.inArray(a[1],"excel ms-excel vnd.ms-excel vnd.openxmlformats-officedocument.spreadsheetml.sheet vnd.openxmlformats-officedocument.spreadsheetml.template vnd.ms-excel.sheet.macroEnabled.12 vnd.ms-excel.template.macroEnabled.12 vnd.ms-excel.addin.macroEnabled.12 vnd.ms-excel.sheet.binary.macroEnabled.12".split(" "))?b="icon-file-excel":-1<d.inArray(a[1],"powerpoint ms-powerpoint vnd.ms-powerpoint vnd.openxmlformats-officedocument.presentationml.presentation vnd.openxmlformats-officedocument.presentationml.template vnd.openxmlformats-officedocument.presentationml.slideshow vnd.ms-powerpoint.addin.macroEnabled.12 vnd.ms-powerpoint.presentation.macroEnabled.12 vnd.ms-powerpoint.template.macroEnabled.12 vnd.ms-powerpoint.slideshow.macroEnabled.12".split(" "))&&
(b="icon-file-powerpoint"));return b};O.prototype.id="";O.prototype.isInline=!1;O.prototype.isLinked=!1;O.prototype.CID="";O.prototype.fromMessage=!1;O.prototype.cancel=d.emptyFunction;O.prototype.initByUploadJson=function(a){var b=!1;a&&(this.fileName(a.Name),this.size(d.isUnd(a.Size)?0:d.pInt(a.Size)),this.tempName(d.isUnd(a.TempName)?"":a.TempName),this.isInline=!1,b=!0);return b};m.newInstanceFromJson=function(a){var b=new m;return b.initByJson(a)?b:null};m.calculateFullFromatDateValue=function(a){return fa.unix(a).format("LLL")};
m.emailsToLine=function(a,b,c){var e=[],f=0,g=0;if(d.isNonEmptyArray(a)){f=0;for(g=a.length;f<g;f++)e.push(a[f].toLine(b,c))}return e.join(", ")};m.initEmailsFromJson=function(a){var b=0,c=0,e=null,f=[];if(d.isNonEmptyArray(a)){b=0;for(c=a.length;b<c;b++)(e=G.newInstanceFromJson(a[b]))&&f.push(e)}return f};m.replyHelper=function(a,b,c){if(a&&0<a.length)for(var e=0,f=a.length;e<f;e++)d.isUnd(b[a[e].email])&&(b[a[e].email]=!0,c.push(a[e]))};m.prototype.initByJson=function(a){var b=!1;a&&"Object/Message"===
a["@Object"]&&(this.folderFullNameRaw=a.Folder,this.uid=a.Uid,this.requestHash=a.RequestHash,this.prefetched=!1,this.size(d.pInt(a.Size)),this.from=m.initEmailsFromJson(a.From),this.to=m.initEmailsFromJson(a.To),this.cc=m.initEmailsFromJson(a.Cc),this.bcc=m.initEmailsFromJson(a.Bcc),this.replyTo=m.initEmailsFromJson(a.ReplyTo),this.subject(a.Subject),this.dateTimeStampInUTC(d.pInt(a.DateTimeStampInUTC)),this.hasAttachments(!!a.HasAttachments),this.fromEmailString(m.emailsToLine(this.from,!0)),this.toEmailsString(m.emailsToLine(this.to,
!0)),this.parentUid(d.pInt(a.ParentThread)),this.threads(d.isArray(a.Threads)?a.Threads:[]),this.threadsLen(d.pInt(a.ThreadsLen)),this.initFlagsByJson(a),this.computeSenderEmail(),b=!0);return b};m.prototype.computeSenderEmail=function(){var a=e.data().sentFolder(),b=e.data().draftFolder();this.senderEmailsString(this.folderFullNameRaw===a||this.folderFullNameRaw===b?this.toEmailsString():this.fromEmailString())};m.prototype.initUpdateByMessageJson=function(a){var b=!1,c=g.MessagePriority.Normal;
a&&"Object/Message"===a["@Object"]&&(c=d.pInt(a.Priority),this.priority(-1<d.inArray(c,[g.MessagePriority.High,g.MessagePriority.Low])?c:g.MessagePriority.Normal),this.aDraftInfo=a.DraftInfo,this.sMessageId=a.MessageId,this.sInReplyTo=a.InReplyTo,this.sReferences=a.References,this.hasAttachments(!!a.HasAttachments),this.foundedCIDs=d.isArray(a.FoundedCIDs)?a.FoundedCIDs:[],this.attachments(this.initAttachmentsFromJson(a.Attachments)),this.computeSenderEmail(),b=!0);return b};m.prototype.initAttachmentsFromJson=
function(a){var b=0,c=0,e=null,f=[];if(a&&"Collection/AttachmentCollection"===a["@Object"]&&d.isNonEmptyArray(a["@Collection"])){b=0;for(c=a["@Collection"].length;b<c;b++)if(e=E.newInstanceFromJson(a["@Collection"][b]))""!==e.cidWithOutTags&&(0<this.foundedCIDs.length&&0<=d.inArray(e.cidWithOutTags,this.foundedCIDs))&&(e.isLinked=!0),f.push(e)}return f};m.prototype.initFlagsByJson=function(a){var b=!1;a&&"Object/Message"===a["@Object"]&&(this.unseen(!a.IsSeen),this.flagged(!!a.IsFlagged),this.answered(!!a.IsAnswered),
this.forwarded(!!a.IsForwarded),b=!0);return b};m.prototype.fromToLine=function(a,b){return m.emailsToLine(this.from,a,b)};m.prototype.toToLine=function(a,b){return m.emailsToLine(this.to,a,b)};m.prototype.ccToLine=function(a,b){return m.emailsToLine(this.cc,a,b)};m.prototype.bccToLine=function(a,b){return m.emailsToLine(this.bcc,a,b)};m.prototype.lineAsCcc=function(){var a=[];this.deleted()&&a.push("deleted");this.selected()&&a.push("selected");this.checked()&&a.push("checked");this.flagged()&&a.push("flagged");
this.unseen()&&a.push("unseen");this.answered()&&a.push("answered");this.forwarded()&&a.push("forwarded");this.hasAttachments()&&a.push("withAttachments");this.newForAnimation()&&a.push("new");""===this.subject()&&a.push("emptySubject");0<this.parentUid()&&a.push("hasParentMessage");0<this.threadsLen()&&0===this.parentUid()&&a.push("hasChildrenMessage");this.hasUnseenSubMessage()&&a.push("hasUnseenSubMessage");this.hasFlaggedSubMessage()&&a.push("hasFlaggedSubMessage");return a.join(" ")};m.prototype.hasVisibleAttachments=
function(){return!!i.find(this.attachments(),function(a){return!a.isLinked})};m.prototype.findAttachmentByCid=function(a){var b=null,c=this.attachments();d.isNonEmptyArray(c)&&(a=a.replace(/^<+/,"").replace(/>+$/,""),b=i.find(c,function(b){return a===b.cidWithOutTags}));return b||null};m.prototype.messageId=function(){return this.sMessageId};m.prototype.inReplyTo=function(){return this.sInReplyTo};m.prototype.references=function(){return this.sReferences};m.prototype.fromAsSingleEmail=function(){return d.isArray(this.from)&&
this.from[0]?this.from[0].email:""};m.prototype.viewLink=function(){return e.link().messageViewLink(this.requestHash)};m.prototype.downloadLink=function(){return e.link().messageDownloadLink(this.requestHash)};m.prototype.replyEmails=function(a){var b=[],a=d.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,b);return b};m.prototype.replyAllEmails=function(a){var b=[],c=[],a=d.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,
b);m.replyHelper(this.to,a,b);m.replyHelper(this.cc,a,c);return[b,c]};m.prototype.textBodyToString=function(){return this.body?this.body.html():""};m.prototype.attachmentsToStringLine=function(){var a=i.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0<a.length?a.join(", "):""};m.prototype.getDataForWindowPopup=function(){return{popupFrom:this.fromToLine(!1),popupTo:this.toToLine(!1),popupCc:this.ccToLine(!1),popupBcc:this.bccToLine(!1),popupSubject:this.subject(),
popupDate:this.fullFormatDateValue(),popupAttachments:this.attachmentsToStringLine(),popupBody:this.textBodyToString()}};m.prototype.viewPopupMessage=function(a){d.windowPopupKnockout(this.getDataForWindowPopup(),"PopupsWindowSimpleMessage",this.subject(),function(b){b&&(b.document&&b.document.body)&&(j("img.lazy",b.document.body).each(function(a,b){var d=j(b),e=d.data("original"),f=d.attr("src");0<=a&&(e&&!f)&&d.attr("src",e)}),a&&h.setTimeout(function(){b.print()},100))})};m.prototype.printMessage=
function(){this.viewPopupMessage(!0)};m.prototype.generateUid=function(){return this.folderFullNameRaw+"/"+this.uid};m.prototype.populateByMessageListItem=function(a){this.folderFullNameRaw=a.folderFullNameRaw;this.uid=a.uid;this.requestHash=a.requestHash;this.subject(a.subject());this.size(a.size());this.dateTimeStampInUTC(a.dateTimeStampInUTC());this.priority(a.priority());this.fromEmailString(a.fromEmailString());this.toEmailsString(a.toEmailsString());this.emails=a.emails;this.from=a.from;this.to=
a.to;this.cc=a.cc;this.bcc=a.bcc;this.replyTo=a.replyTo;this.unseen(a.unseen());this.flagged(a.flagged());this.answered(a.answered());this.forwarded(a.forwarded());this.selected(a.selected());this.checked(a.checked());this.hasAttachments(a.hasAttachments());this.moment(a.moment());this.body=null;this.priority(g.MessagePriority.Normal);this.aDraftInfo=[];this.sReferences=this.sInReplyTo=this.sMessageId="";this.parentUid(a.parentUid());this.threads(a.threads());this.threadsLen(a.threadsLen());this.computeSenderEmail();
return this};m.prototype.showExternalImages=function(a){this.body&&this.body.data("rl-has-images")&&(a=d.isUnd(a)?!1:a,this.hasImages(!1),this.body.data("rl-has-images",!1),j("[data-x-src]",this.body).each(function(){a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",j(this).attr("data-x-src")).removeAttr("data-x-src"):j(this).attr("src",j(this).attr("data-x-src")).removeAttr("data-x-src")}),j("[data-x-style-url]",this.body).each(function(){var a=d.trim(j(this).attr("style")),a=""===
a?"":";"===a.substr(-1)?a+" ":a+"; ";j(this).attr("style",a+j(this).attr("data-x-style-url")).removeAttr("data-x-style-url")}),a&&(j("img.lazy",this.body).addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:j(".RL-MailMessageView .messageView .messageItem .content")[0]}),P.resize()),d.windowResize(500))};m.prototype.showInternalImages=function(a){if(this.body&&!this.body.data("rl-init-internal-images")){var a=d.isUnd(a)?!1:a,b=this;this.body.data("rl-init-internal-images",
!0);j("[data-x-src-cid]",this.body).each(function(){var c=b.findAttachmentByCid(j(this).attr("data-x-src-cid"));c&&c.download&&(a&&j(this).is("img")?j(this).addClass("lazy").attr("data-original",c.linkPreview()):j(this).attr("src",c.linkPreview()))});j("[data-x-style-cid]",this.body).each(function(){var a="",c="",e=b.findAttachmentByCid(j(this).attr("data-x-style-cid"));e&&e.linkPreview&&(c=j(this).attr("data-x-style-cid-name"),""!==c&&(a=d.trim(j(this).attr("style")),a=""===a?"":";"===a.substr(-1)?
a+" ":a+"; ",j(this).attr("style",a+c+": url('"+e.linkPreview()+"')")))});if(a){var c=j("img.lazy",b.body),e=j(".RL-MailMessageView .messageView .messageItem .content")[0];i.delay(function(){c.addClass("lazy-inited").lazyload({threshold:400,effect:"fadeIn",skip_invisible:!1,container:e})},300)}d.windowResize(500)}};I.newInstanceFromJson=function(a){var b=new I;return b.initByJson(a)?b.initComputed():null};I.prototype.initComputed=function(){this.hasSubScribedSubfolders=f.computed(function(){return!!i.find(this.subFolders(),
function(a){return a.subScribed()})},this);this.visible=f.computed(function(){var a=this.subScribed(),b=this.hasSubScribedSubfolders();return a||b&&(!this.existen||!this.selectable)},this);this.isSystemFolder=f.computed(function(){return g.FolderType.User!==this.type()},this);this.hidden=f.computed(function(){var a=this.isSystemFolder(),b=this.hasSubScribedSubfolders();return this.isGmailFolder||a&&this.isNamespaceFolder||a&&!b},this);this.selectableForFolderList=f.computed(function(){return!this.isSystemFolder()&&
this.selectable},this);this.messageCountAll=f.computed({read:this.privateMessageCountAll,write:function(a){d.isPosNumeric(a,!0)?this.privateMessageCountAll(a):this.privateMessageCountAll.valueHasMutated()},owner:this});this.messageCountUnread=f.computed({read:this.privateMessageCountUnread,write:function(a){d.isPosNumeric(a,!0)?this.privateMessageCountUnread(a):this.privateMessageCountUnread.valueHasMutated()},owner:this});this.printableUnreadCount=f.computed(function(){var a=this.messageCountAll(),
b=this.messageCountUnread(),c=this.type();return 0<b&&(g.FolderType.Inbox===c||g.FolderType.Spam===c)?""+b:0<a&&g.FolderType.Draft===c?""+a:""},this);this.canBeDeleted=f.computed(function(){return!this.isSystemFolder()&&0===this.subFolders().length&&"INBOX"!==this.fullNameRaw},this);this.canBeSubScribed=f.computed(function(){return!this.isSystemFolder()&&this.selectable&&"INBOX"!==this.fullNameRaw},this);this.visible.subscribe(function(){d.timeOutAction("folder-list-folder-visibility-change",function(){P.trigger("folder-list-folder-visibility-change")},
100)});this.localName=f.computed(function(){n.langChangeTick();var a=this.type(),b=this.name();if(this.isSystemFolder())switch(a){case g.FolderType.Inbox:b=d.i18n("FOLDER_LIST/INBOX_NAME");break;case g.FolderType.SentItems:b=d.i18n("FOLDER_LIST/SENT_NAME");break;case g.FolderType.Draft:b=d.i18n("FOLDER_LIST/DRAFTS_NAME");break;case g.FolderType.Spam:b=d.i18n("FOLDER_LIST/SPAM_NAME");break;case g.FolderType.Trash:b=d.i18n("FOLDER_LIST/TRASH_NAME")}return b},this);this.manageFolderSystemName=f.computed(function(){n.langChangeTick();
var a="",b=this.type(),c=this.name();if(this.isSystemFolder())switch(b){case g.FolderType.Inbox:a="("+d.i18n("FOLDER_LIST/INBOX_NAME")+")";break;case g.FolderType.SentItems:a="("+d.i18n("FOLDER_LIST/SENT_NAME")+")";break;case g.FolderType.Draft:a="("+d.i18n("FOLDER_LIST/DRAFTS_NAME")+")";break;case g.FolderType.Spam:a="("+d.i18n("FOLDER_LIST/SPAM_NAME")+")";break;case g.FolderType.Trash:a="("+d.i18n("FOLDER_LIST/TRASH_NAME")+")"}if(""!==a&&"("+c+")"===a||"(inbox)"===a.toLowerCase())a="";return a},
this);this.collapsed=f.computed({read:function(){return!this.hidden()&&this.collapsedPrivate()},write:function(a){this.collapsedPrivate(a)},owner:this});return this};I.prototype.fullName="";I.prototype.fullNameRaw="";I.prototype.fullNameHash="";I.prototype.delimiter="";I.prototype.namespace="";I.prototype.deep=0;I.prototype.isNamespaceFolder=!1;I.prototype.isGmailFolder=!1;I.prototype.isUnpaddigFolder=!1;I.prototype.collapsedCss=function(){return this.hasSubScribedSubfolders()?this.collapsed()?"icon-arrow-right-3 e-collapsed-sign":
"icon-arrow-down-3 e-collapsed-sign":"icon-none e-collapsed-sign"};I.prototype.initByJson=function(a){var b=!1;a&&"Object/Folder"===a["@Object"]&&(this.name(a.Name),this.delimiter=a.Delimiter,this.fullName=a.FullName,this.fullNameRaw=a.FullNameRaw,this.fullNameHash=a.FullNameHash,this.deep=a.FullNameRaw.split(this.delimiter).length-1,this.selectable=!!a.IsSelectable,this.existen=!!a.IsExisten,this.subScribed(!!a.IsSubscribed),this.type("INBOX"===this.fullNameRaw?g.FolderType.Inbox:g.FolderType.User),
b=!0);return b};I.prototype.printableFullName=function(){return this.fullName.split(this.delimiter).join(" / ")};La.prototype.email="";La.prototype.changeAccountLink=function(){return e.link().change(this.email)};d.extendAsViewModel("PopupsFolderClearViewModel",Ba);Ba.prototype.clearPopup=function(){this.clearingProcess(!1);this.selectedFolder(null)};Ba.prototype.onShow=function(a){this.clearPopup();a&&this.selectedFolder(a)};d.extendAsViewModel("PopupsFolderCreateViewModel",ia);ia.prototype.sNoParentText=
"";ia.prototype.simpleFolderNameValidation=function(a){return/^[^\\\/]+$/g.test(d.trim(a))};ia.prototype.clearPopup=function(){this.folderName("");this.selectedParentValue("");this.focusTrigger(!1)};ia.prototype.onShow=function(){this.clearPopup();this.focusTrigger(!0)};d.extendAsViewModel("PopupsFolderSystemViewModel",ba);ba.prototype.sChooseOnText="";ba.prototype.sUnuseText="";ba.prototype.onShow=function(a){var b="",a=d.isUnd(a)?g.SetSystemFoldersNotification.None:a;switch(a){case g.SetSystemFoldersNotification.Sent:b=
d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT");break;case g.SetSystemFoldersNotification.Draft:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS");break;case g.SetSystemFoldersNotification.Spam:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM");break;case g.SetSystemFoldersNotification.Trash:b=d.i18n("POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH")}this.notification(b)};d.extendAsViewModel("PopupsComposeViewModel",z);z.prototype.formattedFrom=function(){var a=e.data().displayName(),b=e.data().accountEmail();
return""===a?b:a+" ("+b+")"};z.prototype.sendMessageResponse=function(a,b){var c=!1;this.sending(!1);g.StorageResultType.Success===a&&(b&&b.Result)&&(c=!0,this.modalVisibility()&&q.delegateRun(this,"closeCommand"));this.modalVisibility()&&!c&&(b&&g.Notification.CantSaveMessage===b.ErrorCode?(this.sendSuccessButSaveError(!0),h.alert(d.trim(d.i18n("COMPOSE/SAVED_ERROR_ON_SEND")))):(this.sendError(!0),h.alert(d.getNotification(b.ErrorCode?b.ErrorCode:g.Notification.CantSendMessage))))};z.prototype.saveMessageResponse=
function(a,b){var c=!1,f=null;this.saving(!1);if(g.StorageResultType.Success===a&&(b&&b.Result)&&(b.Result.NewFolder&&b.Result.NewUid)&&(this.bFromDraft&&(f=e.data().message())&&(this.draftFolder()===f.folderFullNameRaw&&this.draftUid()===f.uid)&&e.data().message(null),this.draftFolder(b.Result.NewFolder),this.draftUid(b.Result.NewUid),this.draftID(b.Result.NewID),this.modalVisibility()))this.savedTime(h.Math.round((new h.Date).getTime()/1E3)),this.savedOrSendingText(0<this.savedTime()?d.i18n("COMPOSE/SAVED_TIME",
{TIME:fa.unix(this.savedTime()-1).format("LT")}):""),c=!0,this.bFromDraft&&e.cache().setFolderHash(this.draftFolder(),"");!this.modalVisibility()&&!c&&(this.savedError(!0),this.savedOrSendingText(d.getNotification(g.Notification.CantSaveMessage)))};z.prototype.onHide=function(){q.routeOn()};z.prototype.onShow=function(a,b,c){q.routeOff();var f=this,aa="",t="",h="",k="",m="",p=null,k=p="",V=[],aa={},k=e.data().accountEmail(),r=[],r=t=null,V=!1,a=a||g.ComposeType.Empty;(b=b||null)&&d.isNormal(b)&&(r=
d.isArray(b)&&1===b.length?b[0]:!d.isArray(b)?b:null);null!==k&&(aa[k]=!0);this.reset();d.isNonEmptyArray(c)&&this.to(c);if(""!==a&&r){k=r.fullFormatDateValue();m=r.subject();t=r.aDraftInfo;p=j(r.body).clone();d.removeBlockquoteSwitcher(p);p=p.html();switch(a){case g.ComposeType.Reply:this.to(r.replyEmails(aa));this.subject(d.replySubjectAdd("Re",m));this.prepearMessageAttachments(r,a);this.aDraftInfo=["reply",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+
" "+r.sReferences);V=!0;break;case g.ComposeType.ReplyAll:V=r.replyAllEmails(aa);this.to(V[0]);this.cc(V[1]);this.subject(d.replySubjectAdd("Re",m));this.prepearMessageAttachments(r,a);this.aDraftInfo=["reply",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.references());V=!0;break;case g.ComposeType.Forward:this.subject(d.replySubjectAdd("Fwd",m));this.prepearMessageAttachments(r,a);this.aDraftInfo=["forward",r.uid,r.folderFullNameRaw];this.sInReplyTo=
r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.sReferences);break;case g.ComposeType.ForwardAsAttachment:this.subject(d.replySubjectAdd("Fwd",m));this.prepearMessageAttachments(r,a);this.aDraftInfo=["forward",r.uid,r.folderFullNameRaw];this.sInReplyTo=r.sMessageId;this.sReferences=d.trim(this.sInReplyTo+" "+r.sReferences);break;case g.ComposeType.Draft:this.to(r.to),this.cc(r.cc),this.bcc(r.bcc),this.bFromDraft=!0,this.draftFolder(r.folderFullNameRaw),this.draftUid(r.uid),this.draftID(r.messageId()),
this.subject(m),this.prepearMessageAttachments(r,a),this.aDraftInfo=d.isNonEmptyArray(t)&&3===t.length?t:null,this.sInReplyTo=r.sInReplyTo,this.sReferences=r.sReferences}if(this.oEditor){switch(a){case g.ComposeType.Reply:case g.ComposeType.ReplyAll:aa=r.fromToLine(!1,!0);k=d.i18n("COMPOSE/REPLY_MESSAGE_TITLE",{DATETIME:k,EMAIL:aa});p="<br /><br />"+k+":<blockquote><br />"+p+"</blockquote>";break;case g.ComposeType.Forward:aa=r.fromToLine(!1,!0);t=r.toToLine(!1,!0);h=r.ccToLine(!1,!0);p="<br /><br /><br />"+
d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+aa+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+t+(0<h.length?"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+h:"")+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+": "+d.encodeHtml(k)+"<br />"+d.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+d.encodeHtml(m)+"<br /><br />"+p;break;case g.ComposeType.ForwardAsAttachment:p=""}this.oEditor.setRawText(p,r.isHtml)}}else this.oEditor&&
g.ComposeType.Empty===a?this.oEditor.setRawText("<br />"+d.convertPlainTextToHtml(e.data().signature()),g.EditorDefaultType.Html===e.data().editorDefaultType()):d.isNonEmptyArray(b)&&i.each(b,function(a){f.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload();d.isNonEmptyArray(r)&&e.remote().messageUploadAttachments(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result){var c=null,d="";if(!f.viewModelVisibility())for(d in b.Result)b.Result.hasOwnProperty(d)&&(c=f.getAttachmentById(b.Result[d]))&&
c.tempName(d)}else f.setMessageAttachmentFailedDowbloadText()},r);V&&this.oEditor&&this.oEditor.focus();this.triggerForResize()};z.prototype.onBuild=function(){this.initEditor();this.initUploader();var a=this,b=null;P.on("keydown",function(b){var d=!0;b&&(a.modalVisibility()&&e.data().useKeyboardShortcuts())&&(b.ctrlKey&&g.EventKeyCode.S===b.keyCode?(a.saveCommand(),d=!1):b.ctrlKey&&g.EventKeyCode.Enter===b.keyCode&&(a.sendCommand(),d=!1));return d});P.on("resize",function(){a.triggerForResize()});
this.dropboxEnabled()&&(b=document.createElement("script"),b.type="text/javascript",b.src="https://www.dropbox.com/static/api/1/dropins.js",j(b).attr("id","dropboxjs").attr("data-app-key",e.settingsGet("DropboxApiKey")),document.body.appendChild(b))};z.prototype.getAttachmentById=function(a){for(var b=this.attachments(),c=0,d=b.length;c<d;c++)if(b[c]&&a===b[c].id)return b[c];return null};z.prototype.initEditor=function(){if(this.composeEditorTextArea()&&this.composeEditorHtmlArea()&&this.composeEditorToolbar()){var a=
this;this.oEditor=new u(this.composeEditorTextArea(),this.composeEditorHtmlArea(),this.composeEditorToolbar(),{onSwitch:function(b){b||a.removeLinkedAttachments()}});this.oEditor.initLanguage(d.i18n("EDITOR/TEXT_SWITCHER_CONFIRM"),d.i18n("EDITOR/TEXT_SWITCHER_PLAINT_TEXT"),d.i18n("EDITOR/TEXT_SWITCHER_RICH_FORMATTING"))}};z.prototype.initUploader=function(){if(this.composeUploaderButton()){var a={},b=d.pInt(e.settingsGet("AttachmentLimit")),c=new xa({action:e.link().upload(),name:"uploader",queueSize:2,
multipleSizeLimit:50,disableFolderDragAndDrop:!1,clickElement:this.composeUploaderButton(),dragAndDropElement:this.composeUploaderDropPlace(),onDragEnter:i.bind(function(){this.dragAndDropOver(!0)},this),onDragLeave:i.bind(function(){this.dragAndDropOver(!1)},this),onBodyDragEnter:i.bind(function(){this.dragAndDropVisible(!0)},this),onBodyDragLeave:i.bind(function(){this.dragAndDropVisible(!1)},this),onProgress:i.bind(function(b,c,e){var f=null;d.isUnd(a[b])?(f=this.getAttachmentById(b))&&(a[b]=f):
f=a[b];f&&f.progress(" - "+Math.floor(100*(c/e))+"%")},this),onSelect:i.bind(function(a,e){this.dragAndDropOver(!1);var f=this,g=d.isUnd(e.FileName)?"":e.FileName.toString(),k=d.isNormal(e.Size)?d.pInt(e.Size):null,g=new O(a,g,k);g.cancel=function(){f.attachments.remove(function(b){return b&&b.id===a});c&&c.cancel(a)};this.attachments.push(g);return 0<k&&0<b&&b<k?(g.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:i.bind(function(b){var c=null;d.isUnd(a[b])?(c=this.getAttachmentById(b))&&
(a[b]=c):c=a[b];c&&(c.waiting(!1),c.uploading(!0))},this),onComplete:i.bind(function(b,c,e){var f="",g=null,h=null,i=this.getAttachmentById(b),h=c&&e&&e.Result&&e.Result.Attachment?e.Result.Attachment:null,g=e&&e.Result&&e.Result.ErrorCode?e.Result.ErrorCode:null;null!==g?f=d.getUploadErrorDescByCode(g):h||(f=d.i18n("UPLOAD/ERROR_UNKNOWN"));i&&(""!==f&&0<f.length?i.waiting(!1).uploading(!1).error(f):h&&(i.waiting(!1).uploading(!1),i.initByUploadJson(h)),d.isUnd(a[b])&&delete a[b])},this)});c?this.addAttachmentEnabled(!0).dragAndDropEnabled(c.isDragAndDropSupported()):
this.addAttachmentEnabled(!1).dragAndDropEnabled(!1)}};z.prototype.prepearAttachmentsForSendOrSave=function(){var a={};i.each(this.attachmentsInReady(),function(b){b&&(""!==b.tempName()&&b.enabled())&&(a[b.tempName()]=[b.fileName(),b.isInline?"1":"0",b.CID])});return a};z.prototype.addMessageAsAttachment=function(a){if(a){var b=this,c=null,c=a.subject(),c=".eml"===c.substr(-4).toLowerCase()?c:c+".eml",c=new O(a.requestHash,c,a.size());c.fromMessage=!0;var d=a.requestHash;c.cancel=function(){b.attachments.remove(function(a){return a&&
a.id===d})};c.waiting(!1).uploading(!0);this.attachments.push(c)}};z.prototype.addDropboxAttachment=function(a){var b=this,c=d.pInt(e.settingsGet("AttachmentLimit")),f=null,h=a.bytes,f=new O(a.link,a.name,h);f.fromMessage=!1;var t=a.link;f.cancel=function(){b.attachments.remove(function(a){return a&&a.id===t})};f.waiting(!1).uploading(!0);this.attachments.push(f);if(0<h&&0<c&&c<h)return f.uploading(!1),f.error(d.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG")),!1;e.remote().composeUploadExternals(function(a,
b){var c=!1;f.uploading(!1);g.StorageResultType.Success===a&&(b&&b.Result)&&b.Result[f.id]&&(c=!0,f.tempName(b.Result[f.id]));c||f.error(d.getUploadErrorDescByCode(g.UploadErrorCode.FileNoUploaded))},[a.link]);return!0};z.prototype.prepearMessageAttachments=function(a,b){if(a){var c=this,e=d.isNonEmptyArray(a.attachments())?a.attachments():[],f=0,h=e.length,i=null,k=null,j=function(a){return function(){c.attachments.remove(function(b){return b&&b.id===a})}};if(g.ComposeType.ForwardAsAttachment===
b)this.addMessageAsAttachment(a);else for(;f<h;f++)k=e[f],i=new O(k.download,k.fileName,k.estimatedSize,k.isInline,k.isLinked,k.cid),i.fromMessage=!0,i.cancel=j(k.download),i.waiting(!1).uploading(!0),this.attachments.push(i)}};z.prototype.removeLinkedAttachments=function(){this.attachments.remove(function(a){return a&&a.isLinked})};z.prototype.setMessageAttachmentFailedDowbloadText=function(){i.each(this.attachments(),function(a){a&&a.fromMessage&&a.waiting(!1).uploading(!1).error(d.getUploadErrorDescByCode(g.UploadErrorCode.FileNoUploaded))},
this)};z.prototype.isEmptyForm=function(a){a=(a=d.isUnd(a)?!0:!!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&&a&&""===this.oEditor.getTextForRequest()};z.prototype.reset=function(){this.to([]);this.cc([]);this.bcc([]);this.subject("");this.aDraftInfo=null;this.sInReplyTo="";this.bFromDraft=!1;this.sReferences="";this.bReloadFolder=!1;this.sendError(!1);this.sendSuccessButSaveError(!1);
this.savedError(!1);this.savedTime(0);this.savedOrSendingText("");this.emptyToError(!1);this.showCcAndBcc(!1);this.attachments([]);this.dragAndDropOver(!1);this.dragAndDropVisible(!1);this.draftFolder("");this.draftUid("");this.draftID("");this.sending(!1);this.saving(!1);this.oEditor&&this.oEditor.clear()};z.prototype.getAttachmentsDownloadsForUpload=function(){return i.map(i.filter(this.attachments(),function(a){return a&&""===a.tempName()}),function(a){return a.id})};z.prototype.triggerForResize=
function(){this.resizer(!this.resizer())};d.extendAsViewModel("PopupsContactsViewModel",N);N.prototype.removeCheckedOrSelectedContactsFromList=function(){var a=this,b=this.contacts,c=this.currentContact(),d=this.contactsCheckedOrSelected();0<d.length&&(i.each(d,function(b){c&&c.idContact===b.idContact&&(c=null,a.currentContact(null));b.deleted(!0)}),i.delay(function(){i.each(d,function(a){b.remove(a)})},500))};N.prototype.deleteSelectedContacts=function(){0<this.contactsCheckedOrSelected().length&&
(e.remote().contactsDelete(i.bind(this.deleteResponse,this),this.contactsCheckedOrSelectedUids()),this.removeCheckedOrSelectedContactsFromList())};N.prototype.deleteResponse=function(a,b){500<(g.StorageResultType.Success===a&&b&&b.Time?d.pInt(b.Time):0)?this.reloadContactList():i.delay(function(a){return function(){a.reloadContactList()}}(this),500)};N.prototype.populateViewContact=function(a){this.imageTrigger(!1);this.emptySelection(!1);a?(this.viewID(a.idContact),this.viewName(a.name),this.viewEmail(a.emails[0]||
""),this.viewImageUrl(a.srcAttr())):(this.viewID(""),this.viewName(""),this.viewEmail(""),this.viewImageUrl(e.link().emptyContactPic()))};N.prototype.reloadContactList=function(){var a=this;this.contacts.loading(!0);e.remote().contacts(function(b,c){var e=[];g.StorageResultType.Success===b&&(c&&c.Result&&c.Result.List)&&d.isNonEmptyArray(c.Result.List)&&(e=i.map(c.Result.List,function(a){var b=new qa;return b.parse(a)?b:null}),e=i.compact(e));a.contacts(e);a.viewClearSearch(""!==a.search());a.contacts.loading(!1);
""!==a.viewID()&&(!a.currentContact()&&a.contacts.setSelectedByUid)&&a.contacts.setSelectedByUid(""+a.viewID())},this.search())};N.prototype.onBuild=function(a){this.initUploader();this.oContentVisible=j(".b-list-content",a);this.oContentScrollable=j(".content",this.oContentVisible);this.selector.init(this.oContentVisible,this.oContentScrollable);this.viewImageUrl.valueHasMutated();f.computed(function(){var a=this.modalVisibility(),c=e.data().useKeyboardShortcuts();this.selector.useKeyboard(a&&c)},
this).extend({notify:"always"})};N.prototype.initUploader=function(){var a=this,b=null;h.File&&(h.FileReader&&this.imageUploader())&&(b=new xa({queueSize:1,multipleSizeLimit:1,clickElement:this.imageUploader(),disableDragAndDrop:!0,disableMultiple:!0,onSelect:function(b,e){if(e&&e.File&&e.File.type){var f=null,g=e.File;e.File.type.match(/image.*/)?(f=new h.FileReader,f.onload=function(b){b&&(b.target&&b.target.result)&&d.resizeAndCrop(b.target.result,150,function(b){a.viewImageUrl(b);a.imageTrigger(!0)})},
f.readAsDataURL(g)):h.alert("this file is not an image.")}return!1}}));return b};N.prototype.onShow=function(){q.routeOff();this.reloadContactList()};N.prototype.onHide=function(){q.routeOn();this.currentContact(null);this.emptySelection(!0);this.search("");i.each(this.contacts(),function(a){a.checked(!1)})};d.extendAsViewModel("PopupsAdvancedSearchViewModel",ja);ja.prototype.buildSearchStringValue=function(a){-1<a.indexOf(" ")&&(a='"'+a+'"');return a};ja.prototype.buildSearchString=function(){var a=
[],b=d.trim(this.from()),c=d.trim(this.to()),e=d.trim(this.subject()),f=d.trim(this.text());b&&""!==b&&a.push("from:"+this.buildSearchStringValue(b));c&&""!==c&&a.push("to:"+this.buildSearchStringValue(c));e&&""!==e&&a.push("subject:"+this.buildSearchStringValue(e));this.hasAttachments()&&a.push("has:attachments");-1<this.selectedDateValue()&&a.push("date:"+fa().subtract("days",this.selectedDateValue()).format("YYYY.MM.DD")+"/");f&&""!==f&&a.push("text:"+this.buildSearchStringValue(f));return d.trim(a.join(" "))};
ja.prototype.clearPopup=function(){this.from("");this.to("");this.subject("");this.text("");this.selectedDateValue(-1);this.hasAttachments(!1);this.fromFocus(!0)};ja.prototype.onShow=function(){this.clearPopup();this.fromFocus(!0)};d.extendAsViewModel("PopupsAddAccountViewModel",ka);ka.prototype.clearPopup=function(){this.email("");this.login("");this.password("");this.emailError(!1);this.loginError(!1);this.passwordError(!1);this.submitRequest(!1);this.submitError("")};ka.prototype.onShow=function(){this.clearPopup();
this.emailFocus(!0)};ka.prototype.onBuild=function(){this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"))};d.extendAsViewModel("PopupsLanguagesViewModel",la);la.prototype.onShow=function(){this.exp(!0)};la.prototype.onHide=function(){this.exp(!1)};la.prototype.changeLanguage=function(a){e.data().mainLanguage(a);this.cancelCommand()};d.extendAsViewModel("LoginViewModel",ma);ma.prototype.onShow=function(){q.routeOff();i.delay(i.bind(function(){""!==this.email()&&""!==this.password()?this.submitFocus(!0):
this.emailFocus(!0);e.settingsGet("UserLanguage")&&j.cookie("rllang",e.data().language(),{expires:30})},this),100)};ma.prototype.onHide=function(){this.submitFocus(!1);this.emailFocus(!1)};ma.prototype.onBuild=function(){var a=this,b=e.settingsGet("JsHash"),c=function(b){b=d.pInt(b);0===b?(a.submitRequest(!0),e.loginAndLogoutReload()):a.submitError(d.getNotification(b))};this.facebookLoginEnabled(!!e.settingsGet("AllowFacebookSocial"));this.twitterLoginEnabled(!!e.settingsGet("AllowTwitterSocial"));
this.googleLoginEnabled(!!e.settingsGet("AllowGoogleSocial"));switch((e.settingsGet("SignMe")||"unused").toLowerCase()){case g.LoginSignMeTypeAsString.DefaultOff:this.signMeType(g.LoginSignMeType.DefaultOff);break;case g.LoginSignMeTypeAsString.DefaultOn:this.signMeType(g.LoginSignMeType.DefaultOn);break;default:case g.LoginSignMeTypeAsString.Unused:this.signMeType(g.LoginSignMeType.Unused)}this.email(e.data().devEmail);this.login(e.data().devLogin);this.password(e.data().devPassword);this.googleLoginEnabled()&&
(h["rl_"+b+"_google_login_service"]=c);this.facebookLoginEnabled()&&(h["rl_"+b+"_facebook_login_service"]=c);this.twitterLoginEnabled()&&(h["rl_"+b+"_twitter_login_service"]=c);i.delay(function(){e.data().language.subscribe(function(b){a.langRequest(!0);j.ajax({url:e.link().langLink(b),dataType:"script",cache:!0}).done(function(){a.bSendLanguage=!0;d.i18nToDoc();j.cookie("rllang",e.data().language(),{expires:30})}).always(function(){a.langRequest(!1)})})},50)};ma.prototype.selectLanguage=function(){q.showScreenPopup(la)};
i.extend(S.prototype,D.prototype);S.prototype.accountClick=function(a,b){if(a&&b&&!d.isUnd(b.which)&&1===b.which){var c=this;this.accountsLoading(!0);i.delay(function(){c.accountsLoading(!1)},1E3)}return!0};S.prototype.emailTitle=function(){return e.data().accountEmail()};S.prototype.settingsClick=function(){q.setHash(e.link().settings())};S.prototype.addAccountClick=function(){this.allowAddAccount&&q.showScreenPopup(ka)};S.prototype.logoutClick=function(){e.remote().logout(function(){h.__rlah_clear&&
h.__rlah_clear();e.loginAndLogoutReload(!0,e.settingsGet("ParentEmail")&&0<e.settingsGet("ParentEmail").length)})};i.extend(Ta.prototype,S.prototype);i.extend(Ua.prototype,S.prototype);d.extendAsViewModel("MailBoxFolderListViewModel",ca);ca.prototype.onBuild=function(a){a.on("click",".b-folders .e-item .e-link .e-collapsed-sign",function(a){var c=f.dataFor(this),e=!1;c&&a&&(e=c.collapsed(),d.setExpandedFolder(c.fullNameHash,e),c.collapsed(!e),a.preventDefault(),a.stopPropagation())}).on("click",".b-folders .e-item .e-link.selectable",
function(a){a.preventDefault();if(a=f.dataFor(this))e.data().usePreviewPane()||e.data().message(null),a.fullNameRaw===e.data().currentFolderFullNameRaw()&&e.cache().setFolderHash(a.fullNameRaw,""),q.setHash(e.link().mailBox(a.fullNameHash))})};ca.prototype.messagesDropOver=function(a){h.clearTimeout(this.iDropOverTimer);a&&a.collapsed()&&(this.iDropOverTimer=h.setTimeout(function(){a.collapsed(!1);d.setExpandedFolder(a.fullNameHash,!0);d.windowResize()},500))};ca.prototype.messagesDropOut=function(){h.clearTimeout(this.iDropOverTimer)};
ca.prototype.messagesDrop=function(a,b){if(a&&b&&b.helper){var c=b.helper.data("rl-folder"),e=b.helper.data("rl-uids");A&&(A.__vm&&d.isNormal(c)&&d.isArray(e))&&A.__vm.moveMessagesToFolder(c,e,a.fullNameRaw)}};ca.prototype.composeClick=function(){q.showScreenPopup(z)};ca.prototype.contactsClick=function(){this.allowContacts&&q.showScreenPopup(N)};d.extendAsViewModel("MailBoxMessageListViewModel",A);A.prototype.emptySubjectValue="";A.prototype.searchEnterAction=function(){this.mainMessageListSearch(this.sLastSearchValue);
this.inputMessageListSearchFocus(!1)};A.prototype.cancelSearch=function(){this.mainMessageListSearch("");this.inputMessageListSearchFocus(!1)};A.prototype.removeMessagesFromList=function(a,b,c,f){var c=d.isNormal(c)?c:"",f=d.isUnd(f)?!1:!!f,g=0,h=e.data(),j=e.cache().getFolderFromCacheList(a),k=""===c?null:e.cache().getFolderFromCacheList(c||""),m=h.currentFolderFullNameRaw(),p=h.message(),q=m===a?i.filter(h.messageList(),function(a){return a&&-1<d.inArray(a.uid,b)}):[];f||i.each(q,function(a){a&&
a.unseen()&&g++});j&&!f&&(j.messageCountAll(0<=j.messageCountAll()-b.length?j.messageCountAll()-b.length:0),0<g&&j.messageCountUnread(0<=j.messageCountUnread()-g?j.messageCountUnread()-g:0));k&&!f&&(k.messageCountAll(k.messageCountAll()+b.length),0<g&&k.messageCountUnread(k.messageCountUnread()+g));0<q.length&&(i.each(q,function(a){if(p&&p.requestHash===a.requestHash){p=null;h.message(null)}a.deleted(true)}),i.delay(function(){i.each(q,function(a){h.messageList.remove(a)})},400),f||(e.data().messageListIsNotCompleted(!0),
e.cache().setFolderHash(a,""),d.isNormal(c)&&e.cache().setFolderHash(c||"","")))};A.prototype.removeCheckedOrSelectedMessagesFromList=function(a){this.removeMessagesFromList(e.data().currentFolderFullNameRaw(),i.map(e.data().messageListCheckedOrSelected(),function(a){return a.uid}),a)};A.prototype.moveOrDeleteResponse=function(a,b){g.StorageResultType.Success===a&&e.data().currentFolder()&&(b&&d.isArray(b.Result)&&2===b.Result.length?e.cache().setFolderHash(b.Result[0],b.Result[1]):(b&&g.Notification.CantMoveMessage===
b.ErrorCode&&h.alert(d.getNotification(g.Notification.CantMoveMessage)),e.cache().setFolderHash(e.data().currentFolderFullNameRaw(),"")),e.reloadMessageList(),e.quotaDebounce())};A.prototype.moveMessagesToFolder=function(a,b,c){if(a!==c&&d.isArray(b)&&0<b.length){var f=e.cache().getFolderFromCacheList(a),g=e.cache().getFolderFromCacheList(c);if(f&&g)return e.remote().messagesMove(i.bind(this.moveOrDeleteResponse,this),f.fullNameRaw,g.fullNameRaw,b),g.actionBlink(!0),this.removeMessagesFromList(a,
b,c),!0}return!1};A.prototype.moveSelectedMessagesToFolder=function(a){return this.canBeMoved()?this.moveMessagesToFolder(e.data().currentFolderFullNameRaw(),e.data().messageListCheckedOrSelectedUidsWithSubMails(),a):!1};A.prototype.deleteSelectedMessageFromCurrentFolder=function(a,b){if(this.canBeMoved()){var b=d.isUnd(b)?!0:!!b,c=e.cache().getFolderFromCacheList(g.FolderType.Spam===a?e.data().spamFolder():e.data().trashFolder());!c&&b?q.showScreenPopup(ba,[g.FolderType.Spam===a?g.SetSystemFoldersNotification.Spam:
g.SetSystemFoldersNotification.Trash]):!b||c&&(o.Values.UnuseOptionValue===c.fullNameRaw||e.data().currentFolderFullNameRaw()===c.fullNameRaw)?(e.remote().messagesDelete(i.bind(this.moveOrDeleteResponse,this),e.data().currentFolderFullNameRaw(),e.data().messageListCheckedOrSelectedUidsWithSubMails()),this.removeCheckedOrSelectedMessagesFromList()):c&&(e.remote().messagesMove(i.bind(this.moveOrDeleteResponse,this),e.data().currentFolderFullNameRaw(),c.fullNameRaw,e.data().messageListCheckedOrSelectedUidsWithSubMails()),
c.actionBlink(!0),this.removeCheckedOrSelectedMessagesFromList(c.fullNameRaw))}};A.prototype.dragAndDronHelper=function(a){a&&a.checked(!0);a=d.draggeblePlace();a.data("rl-folder",e.data().currentFolderFullNameRaw());a.data("rl-uids",e.data().messageListCheckedOrSelectedUidsWithSubMails());a.find(".text").text(e.data().messageListCheckedOrSelectedUidsWithSubMails().length);return a};A.prototype.onMessageResponse=function(a,b,c){var f=e.data();f.messageLoading(!1);g.StorageResultType.Success===a&&
b&&b.Result?f.setMessage(b,c):g.StorageResultType.Unload===a?(f.message(null),f.messageError("")):g.StorageResultType.Abort!==a&&(f.message(null),f.messageError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.getNotification(g.Notification.UnknownError)))};A.prototype.populateMessageBody=function(a){a&&(e.remote().message(this.onMessageResponse,a.folderFullNameRaw,a.uid)?e.data().messageLoading(!0):d.log("Error: Unknown message request: "+a.folderFullNameRaw+" ~ "+a.uid+" [e-101]"))};A.prototype.setAction=
function(a,b,c){var f=[],h=null,t=e.cache(),j=0;d.isUnd(c)&&(c=e.data().messageListChecked());f=i.map(c,function(a){return a.uid});if(""!==a&&0<f.length){switch(b){case g.MessageSetAction.SetSeen:i.each(c,function(a){a.unseen()&&j++;a.unseen(!1);t.storeMessageFlagsToCache(a)});(h=t.getFolderFromCacheList(a))&&h.messageCountUnread(h.messageCountUnread()-j);e.remote().messageSetSeen(d.emptyFunction,a,f,!0);break;case g.MessageSetAction.UnsetSeen:i.each(c,function(a){a.unseen()&&j++;a.unseen(!0);t.storeMessageFlagsToCache(a)});
(h=t.getFolderFromCacheList(a))&&h.messageCountUnread(h.messageCountUnread()-j+f.length);e.remote().messageSetSeen(d.emptyFunction,a,f,!1);break;case g.MessageSetAction.SetFlag:i.each(c,function(a){a.flagged(!0);t.storeMessageFlagsToCache(a)});e.remote().messageSetFlagged(d.emptyFunction,a,f,!0);break;case g.MessageSetAction.UnsetFlag:i.each(c,function(a){a.flagged(!1);t.storeMessageFlagsToCache(a)}),e.remote().messageSetFlagged(d.emptyFunction,a,f,!1)}e.reloadFlagsCurrentMessageListAndMessageFromCache()}};
A.prototype.setActionForAll=function(a,b){var c=null,f=e.data().messageList(),h=e.cache();if(""!==a&&(c=h.getFolderFromCacheList(a))){switch(b){case g.MessageSetAction.SetSeen:if(c=h.getFolderFromCacheList(a))i.each(f,function(a){a.unseen(!1)}),c.messageCountUnread(0),h.clearMessageFlagsFromCacheByFolder(a);e.remote().messageSetSeenToAll(d.emptyFunction,a,!0);break;case g.MessageSetAction.UnsetSeen:if(c=h.getFolderFromCacheList(a))i.each(f,function(a){a.unseen(!0)}),c.messageCountUnread(c.messageCountAll()),
h.clearMessageFlagsFromCacheByFolder(a);e.remote().messageSetSeenToAll(d.emptyFunction,a,!1)}e.reloadFlagsCurrentMessageListAndMessageFromCache()}};A.prototype.listSetSeen=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetSeen,e.data().messageListCheckedOrSelected())};A.prototype.listSetAllSeen=function(){this.setActionForAll(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetSeen)};A.prototype.listUnsetSeen=function(){this.setAction(e.data().currentFolderFullNameRaw(),
g.MessageSetAction.UnsetSeen,e.data().messageListCheckedOrSelected())};A.prototype.listSetFlags=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.SetFlag,e.data().messageListCheckedOrSelected())};A.prototype.listUnsetFlags=function(){this.setAction(e.data().currentFolderFullNameRaw(),g.MessageSetAction.UnsetFlag,e.data().messageListCheckedOrSelected())};A.prototype.onBuild=function(a){var b=this,c=e.data();this.oContentVisible=j(".b-content",a);this.oContentScrollable=
j(".content",this.oContentVisible);this.oContentVisible.on("click",".fullThreadHandle",function(){var a=[],b=f.dataFor(this);b&&!b.lastInCollapsedThreadLoading()&&(e.data().messageListThreadFolder(b.folderFullNameRaw),a=e.data().messageListThreadUids(),b.lastInCollapsedThread()?a.push(0<b.parentUid()?b.parentUid():b.uid):a=i.without(a,0<b.parentUid()?b.parentUid():b.uid),e.data().messageListThreadUids(i.uniq(a)),b.lastInCollapsedThreadLoading(!0),b.lastInCollapsedThread(!b.lastInCollapsedThread()),
e.reloadMessageList());return!1});this.selector.init(this.oContentVisible,this.oContentScrollable);Ha.on("keydown",function(a){var f=!0,h=a?a.keyCode:0;if(a&&b.viewModelVisibility()&&c.useKeyboardShortcuts()&&!e.popupVisibility()&&!c.messageFullScreenMode()&&!d.inFocus()&&(c.usePreviewPane()||!c.message()&&(g.EventKeyCode.Delete===h||g.EventKeyCode.A===h))&&a.ctrlKey&&g.EventKeyCode.A===h)b.checkAll(!(b.checkAll()&&!b.isIncompleteChecked())),f=!1;return f});a.on("click",".pagenator .page",function(){var a=
f.dataFor(this);a&&q.setHash(e.link().mailBox(c.currentFolderFullNameHash(),a.value,c.messageListSearch()))}).on("click",".messageList .checkboxCkeckAll",function(){b.checkAll(!b.checkAll())}).on("click",".messageList .messageListItem .flagParent",function(){var a=f.dataFor(this),e=c.messageListCheckedOrSelected(),h=[];a&&(0<e.length&&(h=i.map(e,function(a){return a.uid})),0<h.length&&-1<d.inArray(a.uid,h)?b.setAction(a.folderFullNameRaw,a.flagged()?g.MessageSetAction.UnsetFlag:g.MessageSetAction.SetFlag,
e):b.setAction(a.folderFullNameRaw,a.flagged()?g.MessageSetAction.UnsetFlag:g.MessageSetAction.SetFlag,[a]))});f.computed(function(){var a=e.data(),b=this.viewModelVisibility(),c=e.popupVisibility(),d=a.useKeyboardShortcuts(),a=a.messageFullScreenMode();this.selector.useKeyboard(b&&d&&!a&&!c)},this).extend({notify:"always"});this.initUploaderForAppend()};A.prototype.composeClick=function(){q.showScreenPopup(z)};A.prototype.advancedSearchClick=function(){q.showScreenPopup(ja)};A.prototype.quotaTooltip=
function(){return d.i18n("MESSAGE_LIST/QUOTA_SIZE",{SIZE:d.friendlySize(this.userUsageSize()),PROC:this.userUsageProc(),LIMIT:d.friendlySize(this.userQuota())})};A.prototype.initUploaderForAppend=function(){return!e.settingsGet("AllowAppendMessage")||!this.dragOverArea()?!1:!!new xa({action:e.link().append(),name:"AppendFile",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,hidden:{Folder:function(){return e.data().currentFolderFullNameRaw()}},dragAndDropElement:this.dragOverArea(),dragAndDropBodyElement:this.dragOverBodyArea(),
onDragEnter:i.bind(function(){this.dragOverEnter(true)},this),onDragLeave:i.bind(function(){this.dragOverEnter(false)},this),onBodyDragEnter:i.bind(function(){this.dragOver(true)},this),onBodyDragLeave:i.bind(function(){this.dragOver(false)},this),onSelect:i.bind(function(a,b){if(a&&b&&"message/rfc822"===b.Type){e.data().messageListLoading(true);return true}return false}),onComplete:i.bind(function(){e.reloadMessageList(true,true)},this)})};d.extendAsViewModel("MailBoxMessageViewViewModel",J);J.prototype.scrollToTop=
function(){var a=j(".messageItem.nano .content",this.viewModelDom);a&&a[0]?a.scrollTop(0):j(".messageItem",this.viewModelDom).scrollTop(0);d.windowResize()};J.prototype.fullScreen=function(){this.fullScreenMode(!0);d.windowResize()};J.prototype.unFullScreen=function(){this.fullScreenMode(!1);d.windowResize()};J.prototype.toggleFullScreen=function(){d.removeSelection();this.fullScreenMode(!this.fullScreenMode());d.windowResize()};J.prototype.replyOrforward=function(a){q.showScreenPopup(z,[a,e.data().message()])};
J.prototype.onBuild=function(a){var b=this,c=e.data();Ha.on("keydown",function(a){var e=!0,a=a?a.keyCode:0;if(0<a&&(g.EventKeyCode.Backspace===a||g.EventKeyCode.Esc===a)&&b.viewModelVisibility()&&c.useKeyboardShortcuts()&&!d.inFocus()&&c.message())b.fullScreenMode(!1),c.usePreviewPane()||c.message(null),e=!1;return e});j(".attachmentsPlace",a).magnificPopup({delegate:".magnificPopupImage:visible",type:"image",preload:[1,1],gallery:{enabled:!0},callbacks:{open:function(){c.useKeyboardShortcuts(!1)},
close:function(){c.useKeyboardShortcuts(!0)}},mainClass:"mfp-fade",removalDelay:300});a.on("click",".attachmentsPlace .attachmentPreview",function(a){a&&a.stopPropagation&&a.stopPropagation()}).on("click",".attachmentsPlace .attachmentItem",function(){var a=f.dataFor(this);a&&a.download&&e.download(a.linkDownload())});this.oMessageScrollerDom=(this.oMessageScrollerDom=a.find(".messageItem .content"))&&this.oMessageScrollerDom[0]?this.oMessageScrollerDom:null};J.prototype.isDraftFolder=function(){return e.data().message()&&
e.data().draftFolder()===e.data().message().folderFullNameRaw};J.prototype.isSentFolder=function(){return e.data().message()&&e.data().sentFolder()===e.data().message().folderFullNameRaw};J.prototype.isDraftOrSentFolder=function(){return this.isDraftFolder()||this.isSentFolder()};J.prototype.composeClick=function(){q.showScreenPopup(z)};J.prototype.editMessage=function(){e.data().message()&&q.showScreenPopup(z,[g.ComposeType.Draft,e.data().message()])};J.prototype.scrollMessageToTop=function(){this.oMessageScrollerDom&&
this.oMessageScrollerDom.scrollTop(0)};J.prototype.showImages=function(a){a&&a.showExternalImages&&a.showExternalImages(!0)};d.extendAsViewModel("SettingsMenuViewModel",Ca);Ca.prototype.link=function(a){return e.link().settings(a)};Ca.prototype.backToMailBoxClick=function(){q.setHash(e.link().inbox())};d.extendAsViewModel("SettingsPaneViewModel",Da);Da.prototype.onShow=function(){e.data().message(null)};Da.prototype.backToMailBoxClick=function(){q.setHash(e.link().inbox())};d.addSettingsViewModel(Ea,
"SettingsGeneral","SETTINGS_LABELS/LABEL_GENERAL_NAME","general",!0);Ea.prototype.onBuild=function(){var a=this;i.delay(function(){var b=e.data(),c=d.settingsSaveHelperSimpleFunction(a.mppTrigger,a);b.language.subscribe(function(b){a.languageTrigger(g.SaveSettingsStep.Animate);j.ajax({url:e.link().langLink(b),dataType:"script",cache:!0}).done(function(){d.i18nToDoc();a.languageTrigger(g.SaveSettingsStep.TrueResult)}).fail(function(){a.languageTrigger(g.SaveSettingsStep.FalseResult)}).always(function(){i.delay(function(){a.languageTrigger(g.SaveSettingsStep.Idle)},
1E3)});e.remote().saveSettings(d.emptyFunction,{Language:b})});b.editorDefaultType.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{EditorDefaultType:a})});b.messagesPerPage.subscribe(function(a){e.remote().saveSettings(c,{MPP:a})});b.showImages.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{ShowImages:a?"1":"0"})});b.showAnimation.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{ShowAnimation:a?"1":"0"})});b.useDesktopNotifications.subscribe(function(a){d.timeOutAction("SaveDesktopNotifications",
function(){e.remote().saveSettings(d.emptyFunction,{DesktopNotifications:a?"1":"0"})},3E3)});b.replySameFolder.subscribe(function(a){d.timeOutAction("SaveReplySameFolder",function(){e.remote().saveSettings(d.emptyFunction,{ReplySameFolder:a?"1":"0"})},3E3)});b.useThreads.subscribe(function(a){b.messageList([]);e.remote().saveSettings(d.emptyFunction,{UseThreads:a?"1":"0"})});b.usePreviewPane.subscribe(function(a){b.messageList([]);e.remote().saveSettings(d.emptyFunction,{UsePreviewPane:a?"1":"0"})});
b.useCheckboxesInList.subscribe(function(a){e.remote().saveSettings(d.emptyFunction,{UseCheckboxesInList:a?"1":"0"})})},50)};Ea.prototype.onShow=function(){e.data().desktopNotifications.valueHasMutated()};Ea.prototype.selectLanguage=function(){q.showScreenPopup(la)};d.addSettingsViewModel(Va,"SettingsPersonal","SETTINGS_LABELS/LABEL_PERSONAL_NAME","personal");Va.prototype.onBuild=function(){var a=this;i.delay(function(){var b=e.data(),c=d.settingsSaveHelperSimpleFunction(a.nameTrigger,a),f=d.settingsSaveHelperSimpleFunction(a.replyTrigger,
a),g=d.settingsSaveHelperSimpleFunction(a.signatureTrigger,a);b.displayName.subscribe(function(a){e.remote().saveSettings(c,{DisplayName:a})});b.replyTo.subscribe(function(a){e.remote().saveSettings(f,{ReplyTo:a})});b.signature.subscribe(function(a){e.remote().saveSettings(g,{Signature:a})})},50)};d.addSettingsViewModel(ra,"SettingsAccounts","SETTINGS_LABELS/LABEL_ACCOUNTS_NAME","accounts");ra.prototype.addNewAccount=function(){q.showScreenPopup(ka)};ra.prototype.deleteAccount=function(a){if(a&&a.deleteAccess()){this.accountForDeletion(null);
var b=function(b){return a===b};a&&(e.data().accounts.remove(b),e.remote().accountDelete(function(){e.accounts()},a.email))}};d.addSettingsViewModel(Ma,"SettingsSocial","SETTINGS_LABELS/LABEL_SOCIAL_NAME","social");d.addSettingsViewModel(sa,"SettingsChangePassword","SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME","change-password");sa.prototype.onHide=function(){this.changeProcess(!1);this.currentPassword("");this.newPassword("")};sa.prototype.onChangePasswordResponse=function(a,b){this.changeProcess(!1);
g.StorageResultType.Success===a&&b&&b.Result?(this.currentPassword(""),this.newPassword(""),this.passwordUpdateSuccess(!0)):this.passwordUpdateError(!0)};d.addSettingsViewModel(W,"SettingsFolders","SETTINGS_LABELS/LABEL_FOLDERS_NAME","folders");W.prototype.folderEditOnEnter=function(a){var b=a?d.trim(a.nameForEdit()):"";""!==b&&a.name()!==b&&(e.local().set(g.ClientSideKeyName.FoldersLashHash,""),e.data().foldersRenaming(!0),e.remote().folderRename(function(a,b){e.data().foldersRenaming(!1);if(g.StorageResultType.Success!==
a||!b||!b.Result)e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"));e.folders(!1)},a.fullNameRaw,b),e.cache().removeFolderFromCacheList(a.fullNameRaw),a.name(b));a.edited(!1)};W.prototype.folderEditOnEsc=function(a){a&&a.edited(!1)};W.prototype.onShow=function(){e.data().foldersListError("")};W.prototype.createFolder=function(){q.showScreenPopup(ia)};W.prototype.systemFolder=function(){q.showScreenPopup(ba)};W.prototype.deleteFolder=
function(a){if(a&&a.canBeDeleted()&&a.deleteAccess()&&0===a.privateMessageCountAll()){this.folderForDeletion(null);var b=function(c){if(a===c)return!0;c.subFolders.remove(b);return!1};a&&(e.local().set(g.ClientSideKeyName.FoldersLashHash,""),e.data().folderList.remove(b),e.data().foldersDeleting(!0),e.remote().folderDelete(function(a,b){e.data().foldersDeleting(!1);if(g.StorageResultType.Success!==a||!b||!b.Result)e.data().foldersListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"));
e.folders(!1)},a.fullNameRaw),e.cache().removeFolderFromCacheList(a.fullNameRaw))}else 0<a.privateMessageCountAll()&&e.data().foldersListError(d.getNotification(g.Notification.CantDeleteNonEmptyFolder))};W.prototype.subscribeFolder=function(a){e.local().set(g.ClientSideKeyName.FoldersLashHash,"");e.remote().folderSetSubscribe(d.emptyFunction,a.fullNameRaw,!0);a.subScribed(!0)};W.prototype.unSubscribeFolder=function(a){e.local().set(g.ClientSideKeyName.FoldersLashHash,"");e.remote().folderSetSubscribe(d.emptyFunction,
a.fullNameRaw,!1);a.subScribed(!1)};d.addSettingsViewModel(na,"SettingsThemes","SETTINGS_LABELS/LABEL_THEMES_NAME","themes");na.prototype.removeCustomThemeImg=function(){this.customThemeImg("")};na.prototype.onBuild=function(){var a=this,b=e.data().theme();this.themesObjects(i.map(e.data().themes(),function(a){return{name:a,nameDisplay:d.convertThemeName(a),selected:f.observable(a===b),themePreviewSrc:e.link().themePreviewLink(a)}}));i.delay(function(){a.customThemeType.subscribe(function(a){e.remote().saveSettings(function(){e.data().theme.valueHasMutated()},
{CustomThemeType:a})});a.customThemeImg.subscribe(function(a){e.remote().saveSettings(function(){e.data().theme.valueHasMutated()},{CustomThemeImg:a})})},50);this.initCustomThemeUploader()};na.prototype.initCustomThemeUploader=function(){return this.customThemeUploaderButton()?!!new xa({action:e.link().uploadBackground(),name:"uploader",queueSize:1,multipleSizeLimit:1,disableFolderDragAndDrop:!0,clickElement:this.customThemeUploaderButton(),onSelect:i.bind(function(a,b){var c=d.isUnd(b.FileName)?
"":b.FileName.toString(),c=c.substring(c.length-4,c.length),e=d.isNormal(b.Size)?d.pInt(b.Size):null;return-1===d.inArray(c,["jpeg",".jpg",".png"])?(h.alert(d.i18n("SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR")),!1):1048576<e?(h.alert(d.i18n("SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG")),!1):!0},this),onStart:i.bind(function(){this.customThemeUploaderProgress(!0)},this),onComplete:i.bind(function(a,b,c){!b||!c||!c.Result?h.alert(c&&c.ErrorCode?d.getUploadErrorDescByCode(c.ErrorCode):d.getUploadErrorDescByCode(g.UploadErrorCode.Unknown)):
this.customThemeImg(c.Result);this.customThemeUploaderProgress(!1)},this)}):!1};Na.prototype.populateDataOnStart=function(){var a=e.settingsGet("Languages"),b=e.settingsGet("Themes");d.isArray(a)&&this.languages(a);d.isArray(b)&&this.themes(b);this.mainLanguage(e.settingsGet("Language"));this.mainTheme(e.settingsGet("Theme"));this.allowCustomTheme(!!e.settingsGet("AllowCustomTheme"));this.allowAdditionalAccounts(!!e.settingsGet("AllowAdditionalAccounts"));this.determineUserLanguage(!!e.settingsGet("DetermineUserLanguage"));
this.allowThemes(!!e.settingsGet("AllowThemes"));this.allowCustomLogin(!!e.settingsGet("AllowCustomLogin"));this.allowLanguagesOnLogin(!!e.settingsGet("AllowLanguagesOnLogin"));this.allowLanguagesOnSettings(!!e.settingsGet("AllowLanguagesOnSettings"));this.ignoreFolderSubscribe(!!e.settingsGet("IgnoreFolderSubscribe"));this.editorDefaultType(e.settingsGet("EditorDefaultType"));this.showImages(!!e.settingsGet("ShowImages"));this.showAnimation(!!e.settingsGet("ShowAnimation"));this.mainMessagesPerPage(e.settingsGet("MPP"));
this.desktopNotifications(!!e.settingsGet("DesktopNotifications"));this.useThreads(!!e.settingsGet("UseThreads"));this.replySameFolder(!!e.settingsGet("ReplySameFolder"));this.usePreviewPane(!!e.settingsGet("UsePreviewPane"));this.useCheckboxesInList(!!e.settingsGet("UseCheckboxesInList"));this.facebookEnable(!!e.settingsGet("AllowFacebookSocial"));this.facebookAppID(e.settingsGet("FacebookAppID"));this.facebookAppSecret(e.settingsGet("FacebookAppSecret"));this.twitterEnable(!!e.settingsGet("AllowTwitterSocial"));
this.twitterConsumerKey(e.settingsGet("TwitterConsumerKey"));this.twitterConsumerSecret(e.settingsGet("TwitterConsumerSecret"));this.googleEnable(!!e.settingsGet("AllowGoogleSocial"));this.googleClientID(e.settingsGet("GoogleClientID"));this.googleClientSecret(e.settingsGet("GoogleClientSecret"));this.dropboxEnable(!!e.settingsGet("AllowDropboxSocial"));this.dropboxApiKey(e.settingsGet("DropboxApiKey"));this.contactsIsSupported(!!e.settingsGet("ContactsIsSupported"));this.contactsIsAllowed(!!e.settingsGet("ContactsIsAllowed"))};
i.extend(T.prototype,Na.prototype);T.prototype.purgeMessageBodyCache=function(){var a=0,b=null,c=n.iMessageBodyCacheCount-o.Values.iMessageBodyCacheLimit;if(0<c&&(b=this.messagesBodiesDom()))b.find(".rl-cache-class").each(function(){var b=j(this);c>b.data("rl-cache-count")&&(b.addClass("rl-cache-purge"),a++)}),0<a&&i.delay(function(){b.find(".rl-cache-purge").remove()},300)};T.prototype.populateDataOnStart=function(){Na.prototype.populateDataOnStart.call(this);this.accountEmail(e.settingsGet("Email"));
this.accountLogin(e.settingsGet("Login"));this.projectHash(e.settingsGet("ProjectHash"));this.displayName(e.settingsGet("DisplayName"));this.replyTo(e.settingsGet("ReplyTo"));this.signature(e.settingsGet("Signature"));this.lastFoldersHash=e.local().get(g.ClientSideKeyName.FoldersLashHash)||"";this.remoteSuggestions=!!e.settingsGet("RemoteSuggestions");this.remoteChangePassword=!!e.settingsGet("RemoteChangePassword");this.devEmail=e.settingsGet("DevEmail");this.devLogin=e.settingsGet("DevLogin");this.devPassword=
e.settingsGet("DevPassword")};T.prototype.initUidNextAndNewMessages=function(a,b,c){if("INBOX"===a&&d.isNormal(b)&&""!==b){if(d.isArray(c)&&0<c.length){var f=e.cache(),g=0,j=c.length,y=function(a,b,c){var d=null;if(pa&&e.data().useDesktopNotifications()&&(d=new pa(b,{body:c,icon:a})))d.show&&d.show(),h.setTimeout(function(a){return function(){a.cancel?a.cancel():a.close&&a.close()}}(d),7E3)};i.each(c,function(b){f.addNewMessageCache(a,b.Uid)});if(3<j)y(e.link().notificationMailIcon(),e.data().accountEmail(),
d.i18n("MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION",{COUNT:j}));else for(;g<j;g++)y(e.link().notificationMailIcon(),m.emailsToLine(m.initEmailsFromJson(c[g].From),!1),c[g].Subject)}e.cache().setFolderUidNext(a,b)}};T.prototype.folderResponseParseRec=function(a,b,c){for(var f=0,g=0,h=null,i=null,j="",h=[],m=[],c=!!c,f=0,g=b.length;f<g;f++)if(h=b[f]){j=h.FullNameRaw;i=e.cache().getFolderFromCacheList(j);if(!i&&(i=I.newInstanceFromJson(h)))if(e.cache().setFolderToCacheList(j,i),e.cache().setFolderFullNameRaw(i.fullNameHash,
j),i.isGmailFolder=o.Values.GmailFolderName.toLowerCase()===j.toLowerCase(),""!==a&&a===i.fullNameRaw+i.delimiter&&(i.isNamespaceFolder=!0),i.isNamespaceFolder||i.isGmailFolder)i.isUnpaddigFolder=!0;i&&(i.collapsed(!d.isFolderExpanded(i.fullNameHash)),!c&&h.Extended&&(h.Extended.Hash&&e.cache().setFolderHash(i.fullNameRaw,h.Extended.Hash),d.isNormal(h.Extended.MessageCount)&&i.messageCountAll(h.Extended.MessageCount),d.isNormal(h.Extended.MessageUnseenCount)&&i.messageCountUnread(h.Extended.MessageUnseenCount)),
(h=h.SubFolders)&&("Collection/FolderCollection"===h["@Object"]&&h["@Collection"]&&d.isArray(h["@Collection"]))&&i.subFolders(this.folderResponseParseRec(a,h["@Collection"],c)),m.push(i))}return m};T.prototype.setFolders=function(a,b){var c=[],f=!1,h=e.data(),i=0===h.folderList().length,j=function(a){return""===a||o.Values.UnuseOptionValue===a||null!==e.cache().getFolderFromCacheList(a)?a:""};a&&(a.Result&&"Collection/FolderCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&d.isArray(a.Result["@Collection"]))&&
(d.isUnd(a.Result.Namespace)||(h.namespace=a.Result.Namespace),this.threading(!!e.settingsGet("UseImapThread")&&a.Result.IsThreadsSupported&&!0),c=this.folderResponseParseRec(h.namespace,a.Result["@Collection"],!!b),h.folderList(c),a.Result.SystemFolders&&""===""+e.settingsGet("SentFolder")+e.settingsGet("DraftFolder")+e.settingsGet("SpamFolder")+e.settingsGet("TrashFolder")&&(e.settingsSet("SentFolder",a.Result.SystemFolders[2]||null),e.settingsSet("DraftFolder",a.Result.SystemFolders[3]||null),
e.settingsSet("SpamFolder",a.Result.SystemFolders[4]||null),e.settingsSet("TrashFolder",a.Result.SystemFolders[5]||null),f=!0),h.sentFolder(j(e.settingsGet("SentFolder"))),h.draftFolder(j(e.settingsGet("DraftFolder"))),h.spamFolder(j(e.settingsGet("SpamFolder"))),h.trashFolder(j(e.settingsGet("TrashFolder"))),f&&e.remote().saveSystemFolders(d.emptyFunction,{SentFolder:h.sentFolder(),DraftFolder:h.draftFolder(),SpamFolder:h.spamFolder(),TrashFolder:h.trashFolder()}),b||e.local().set(g.ClientSideKeyName.FoldersLashHash,
a.Result.FoldersHash),i&&b&&e.folders(!1))};T.prototype.hideMessageBodies=function(){var a=this.messagesBodiesDom();a&&a.find(".b-text-part").hide()};T.prototype.setMessage=function(a,b){var c=!1,f=!1,g=!1,h=null,f=null,c="",i=this.messagesBodiesDom(),k=this.message();if(a&&k&&a.Result&&"Object/Message"===a.Result["@Object"]&&k.folderFullNameRaw===a.Result.Folder&&k.uid===a.Result.Uid){this.messageError("");k.initUpdateByMessageJson(a.Result);e.cache().addRequestedMessage(k.folderFullNameRaw,k.uid);
b||k.initFlagsByJson(a.Result);if(i=i&&i[0]?i:null)c="rl-"+k.requestHash.replace(/[^a-zA-Z0-9]/g,""),f=i.find("#"+c),!f||!f[0]?(f=!!a.Result.HasExternals,g=!!a.Result.HasInternals,h=j('<div id="'+c+'" />').hide().addClass("rl-cache-class"),h.data("rl-cache-count",++n.iMessageBodyCacheCount),d.isNormal(a.Result.Html)&&""!==a.Result.Html?(c=!0,h.html(a.Result.Html.toString()).addClass("b-text-part html")):d.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(c=!1,h.html(a.Result.Plain.toString()).addClass("b-text-part plain")):
c=!1,a.Result.Rtl&&(h.data("rl-is-rtl",!0),h.addClass("rtl-text-part")),i.append(h),h.data("rl-is-html",c),h.data("rl-has-images",f),k.isRtl(!!h.data("rl-is-rtl")),k.isHtml(!!h.data("rl-is-html")),k.hasImages(!!h.data("rl-has-images")),k.body=h,g&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0),this.purgeMessageBodyCacheThrottle()):(f.data("rl-cache-count",++n.iMessageBodyCacheCount),k.isRtl(!!f.data("rl-is-rtl")),k.isHtml(!!f.data("rl-is-html")),k.hasImages(!!f.data("rl-has-images")),
k.body=f),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),h&&d.initBlockquoteSwitcher(h);e.cache().initMessageFlagsFromCache(k);k.unseen()&&e.setMessageSeen(k);d.windowResize()}};T.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"===a.Result["@Object"]&&a.Result["@Collection"]&&d.isArray(a.Result["@Collection"])){var c=e.data(),f=e.cache(),h=null,i=0,j=0,k=0,q=0,p=[],n=c.staticMessageList,r=null,H=null,o=null,s=0,u=!1,k=d.pInt(a.Result.MessageResultCount),
q=d.pInt(a.Result.Offset);d.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(h=a.Result.LastCollapsedThreadUids);if((o=e.cache().getFolderFromCacheList(d.isNormal(a.Result.Folder)?a.Result.Folder:""))&&!b)e.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),d.isNormal(a.Result.MessageCount)&&o.messageCountAll(a.Result.MessageCount),d.isNormal(a.Result.MessageUnseenCount)&&(d.pInt(o.messageCountUnread())!==d.pInt(a.Result.MessageUnseenCount)&&(u=!0),o.messageCountUnread(a.Result.MessageUnseenCount)),
this.initUidNextAndNewMessages(o.fullNameRaw,a.Result.UidNext,a.Result.NewMessages);u&&o&&e.cache().clearMessageFlagsFromCacheByFolder(o.fullNameRaw);i=0;for(j=a.Result["@Collection"].length;i<j;i++)if((r=a.Result["@Collection"][i])&&"Object/Message"===r["@Object"]){H=n[i];if(!H||!H.initByJson(r))H=m.newInstanceFromJson(r);H&&(f.hasNewMessageAndRemoveFromCache(H.folderFullNameRaw,H.uid)&&5>=s&&(s++,H.newForAnimation(!0)),H.deleted(!1),b?e.cache().initMessageFlagsFromCache(H):e.cache().storeMessageFlagsToCache(H),
H.lastInCollapsedThread(h&&-1<d.inArray(d.pInt(H.uid),h)?!0:!1),p.push(H))}c.messageListCount(k);c.messageListSearch(d.isNormal(a.Result.Search)?a.Result.Search:"");c.messageListEndSearch(d.isNormal(a.Result.Search)?a.Result.Search:"");c.messageListEndFolder(d.isNormal(a.Result.Folder)?a.Result.Folder:"");c.messageListPage(Math.ceil(q/c.messagesPerPage()+1));c.messageList(p);c.messageListIsNotCompleted(!1);(H=c.message())&&c.messageList.setSelectedByUid&&c.messageList.setSelectedByUid(H.generateUid());
n.length<p.length&&(c.staticMessageList=p);f.clearNewMessageCache();o&&(b||u||e.data().useThreads())&&e.folderInformation(o.fullNameRaw,p)}else e.data().messageListCount(0),e.data().messageList([]),e.data().messageListError(d.getNotification(a&&a.ErrorCode?a.ErrorCode:g.Notification.CantGetMessageList))};ga.prototype.oRequests={};ga.prototype.defaultResponse=function(a,b,c,f,j,t){var y=function(){g.StorageResultType.Success!==c&&n.bUnload&&(c=g.StorageResultType.Unload);if(g.StorageResultType.Success===
c&&f&&!f.Result){if(f&&-1<d.inArray(f.ErrorCode,[g.Notification.AuthError,g.Notification.AccessError,g.Notification.ConnectionError,g.Notification.DomainNotAllowed,g.Notification.AccountNotAllowed,g.Notification.MailServerError,g.Notification.UnknownNotification,g.Notification.UnknownError])&&n.iAjaxErrorCount++,f&&g.Notification.InvalidToken===f.ErrorCode&&n.iTokenErrorCount++,10<n.iTokenErrorCount&&e.loginAndLogoutReload(!0),f.Logout||7<n.iAjaxErrorCount)h.__rlah_clear&&h.__rlah_clear(),e.loginAndLogoutReload(!0)}else g.StorageResultType.Success===
c&&(f&&f.Result)&&(n.iAjaxErrorCount=0,n.iTokenErrorCount=0);a&&(x.runHook("ajax-default-response",[b,g.StorageResultType.Success===c?f:null,c,j,t]),a(c,g.StorageResultType.Success===c?f:null,j,b,t))};switch(c){case "success":c=g.StorageResultType.Success;break;case "abort":c=g.StorageResultType.Abort;break;default:c=g.StorageResultType.Error}g.StorageResultType.Error===c?i.delay(y,300):y()};ga.prototype.ajaxRequest=function(a,b,c,f,g){var t=this,y=""===f,k=(new h.Date).getTime(),m=null,p="",b=b||
{},c=d.isNormal(c)?c:2E4,f=d.isUnd(f)?"":d.pString(f),g=d.isArray(g)?g:[];(p=b.Action||"")&&0<g.length&&i.each(g,function(a){t.oRequests[a]&&(t.oRequests[a].__aborted=!0,t.oRequests[a].abort&&t.oRequests[a].abort(),t.oRequests[a]=null)});y&&(b.XToken=e.settingsGet("Token"));m=j.ajax({type:y?"POST":"GET",url:e.link().ajax(f),async:!0,dataType:"json",data:y?b:{},headers:{},timeout:c,global:!0});m.always(function(c,e){var f=!1;c&&c.Time&&(f=d.pInt(c.Time)>(new h.Date).getTime()-k);p&&t.oRequests[p]&&
(t.oRequests[p].__aborted&&(e="abort"),t.oRequests[p]=null);t.defaultResponse(a,p,e,c,f,b)});p&&(0<g.length&&-1<d.inArray(p,g))&&(this.oRequests[p]&&(this.oRequests[p].__aborted=!0,this.oRequests[p].abort&&this.oRequests[p].abort(),this.oRequests[p]=null),this.oRequests[p]=m);return m};ga.prototype.defaultRequest=function(a,b,c,e,f,g){c=c||{};c.Action=b;f=d.pString(f);x.runHook("ajax-default-request",[b,c,f]);this.ajaxRequest(a,c,d.isUnd(e)?o.Defaults.DefaultAjaxTimeout:d.pInt(e),f,g)};ga.prototype.noop=
function(a){this.defaultRequest(a,"Noop")};ga.prototype.jsError=function(a,b,c,d,e,f){this.defaultRequest(a,"JsError",{Message:b,FileName:c,LineNo:d,Location:e,HtmlCapa:f})};i.extend(s.prototype,ga.prototype);s.prototype.folders=function(a,b){var c=e.data().lastFoldersHash;(b=d.isUnd(b)?!1:!!b)&&""!==c?this.defaultRequest(a,"Folders",{},null,"Folders/"+e.data().projectHash()+"-"+c,["Folders"]):this.defaultRequest(a,"Folders",{},null,"",["Folders"])};s.prototype.login=function(a,b,c,d,e,f){this.defaultRequest(a,
"Login",{Email:b,Login:c,Password:d,Language:f||"",SignMe:e?"1":"0"})};s.prototype.accountAdd=function(a,b,c,d){this.defaultRequest(a,"AccountAdd",{Email:b,Login:c,Password:d})};s.prototype.accountDelete=function(a,b){this.defaultRequest(a,"AccountDelete",{EmailToDelete:b})};s.prototype.accounts=function(a){this.defaultRequest(a,"Accounts")};s.prototype.messageList=function(a,b,c,f,g,h){var b=d.pString(b),i=e.data(),j=e.cache().getFolderHash(b),h=d.isUnd(h)?!1:!!h,c=d.isUnd(c)?0:d.pInt(c),f=d.isUnd(c)?
20:d.pInt(f),g=d.pString(g);""!==j?this.defaultRequest(a,"MessageList",{},""===g?o.Defaults.DefaultAjaxTimeout:o.Defaults.SearchAjaxTimeout,"MessageList/"+oa.urlsafe_encode([b,c,f,g,i.projectHash(),j,"INBOX"===b?e.cache().getFolderUidNext(b):"",i.threading()&&i.useThreads()?"1":"0",i.threading()&&b===i.messageListThreadFolder()?i.messageListThreadUids().join(","):""].join(String.fromCharCode(0))),h?[]:["MessageList"]):this.defaultRequest(a,"MessageList",{Folder:b,Offset:c,Limit:f,Search:g,UidNext:"INBOX"===
b?e.cache().getFolderUidNext(b):"",UseThreads:e.data().threading()&&e.data().useThreads()?"1":"0",ExpandedThreadUid:i.threading()&&b===i.messageListThreadFolder()?i.messageListThreadUids().join(","):""},""===g?o.Defaults.DefaultAjaxTimeout:o.Defaults.SearchAjaxTimeout,"",h?[]:["MessageList"])};s.prototype.messageUploadAttachments=function(a,b){this.defaultRequest(a,"MessageUploadAttachments",{Attachments:b},999E3)};s.prototype.message=function(a,b,c){b=d.pString(b);c=d.pInt(c);return e.cache().getFolderFromCacheList(b)&&
0<c?(this.defaultRequest(a,"Message",{},null,"Message/"+oa.urlsafe_encode([b,c,e.data().projectHash(),e.data().threading()&&e.data().useThreads()?"1":"0"].join(String.fromCharCode(0))),["Message"]),!0):!1};s.prototype.composeUploadExternals=function(a,b){this.defaultRequest(a,"ComposeUploadExternals",{Externals:b},999E3)};s.prototype.folderInformation=function(a,b,c){var f=!0,g=e.cache(),h=[];d.isArray(c)&&0<c.length&&(f=!1,i.each(c,function(a){g.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid)||
h.push(a.uid);0<a.threads().length&&i.each(a.threads(),function(b){g.getMessageFlagsFromCache(a.folderFullNameRaw,b)||h.push(b)})}),0<h.length&&(f=!0));f?this.defaultRequest(a,"FolderInformation",{Folder:b,FlagsUids:d.isArray(h)?h.join(","):"",UidNext:"INBOX"===b?e.cache().getFolderUidNext(b):""}):e.data().useThreads()&&e.reloadFlagsCurrentMessageListAndMessageFromCache()};s.prototype.logout=function(a){this.defaultRequest(a,"Logout")};s.prototype.messageSetFlagged=function(a,b,c,d){this.defaultRequest(a,
"MessageSetFlagged",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})};s.prototype.messageSetSeen=function(a,b,c,d){this.defaultRequest(a,"MessageSetSeen",{Folder:b,Uids:c.join(","),SetAction:d?"1":"0"})};s.prototype.messageSetSeenToAll=function(a,b,c){this.defaultRequest(a,"MessageSetSeenToAll",{Folder:b,SetAction:c?"1":"0"})};s.prototype.saveMessage=function(a,b,c,d,e,f,g,h,i,j,m,r,q,n,s){this.defaultRequest(a,"SaveMessage",{MessageFolder:b,MessageUid:c,MessageID:d,DraftFolder:e,To:f,Cc:g,Bcc:h,
Subject:i,TextIsHtml:j?"1":"0",Text:m,DraftInfo:q,InReplyTo:n,References:s,Attachments:r},o.Defaults.SaveMessageAjaxTimeout)};s.prototype.sendMessage=function(a,b,c,d,e,f,g,h,i,j,m,r,q,n,s){this.defaultRequest(a,"SendMessage",{MessageFolder:b,MessageUid:c,MessageID:d,SentFolder:e,To:f,Cc:g,Bcc:h,Subject:i,TextIsHtml:j?"1":"0",Text:m,DraftInfo:q,InReplyTo:n,References:s,Attachments:r},o.Defaults.SendMessageAjaxTimeout)};s.prototype.saveSystemFolders=function(a,b){this.defaultRequest(a,"SystemFoldersUpdate",
b)};s.prototype.saveSettings=function(a,b){this.defaultRequest(a,"SettingsUpdate",b)};s.prototype.changePassword=function(a,b,c){this.defaultRequest(a,"ChangePassword",{PrevPassword:b,NewPassword:c})};s.prototype.folderCreate=function(a,b,c){this.defaultRequest(a,"FolderCreate",{Folder:b,Parent:c},null,"",["Folders"])};s.prototype.folderDelete=function(a,b){this.defaultRequest(a,"FolderDelete",{Folder:b},null,"",["Folders"])};s.prototype.folderRename=function(a,b,c){this.defaultRequest(a,"FolderRename",
{Folder:b,NewFolderName:c},null,"",["Folders"])};s.prototype.folderClear=function(a,b){this.defaultRequest(a,"FolderClear",{Folder:b})};s.prototype.folderSetSubscribe=function(a,b,c){this.defaultRequest(a,"FolderSubscribe",{Folder:b,Subscribe:c?"1":"0"})};s.prototype.messagesMove=function(a,b,c,d){this.defaultRequest(a,"MessageMove",{FromFolder:b,ToFolder:c,Uids:d.join(",")},null,"",["MessageList","Message"])};s.prototype.messagesDelete=function(a,b,c){this.defaultRequest(a,"MessageDelete",{Folder:b,
Uids:c.join(",")},null,"",["MessageList","Message"])};s.prototype.appDelayStart=function(a){this.defaultRequest(a,"AppDelayStart")};s.prototype.quota=function(a){this.defaultRequest(a,"Quota")};s.prototype.contacts=function(a,b){this.defaultRequest(a,"Contacts",{Search:b},null,"",["Contacts"])};s.prototype.contactSave=function(a,b,c,e,f,g){c=d.trim(c);this.defaultRequest(a,"ContactSave",{RequestUid:b,Uid:c,Name:e,Email:f,ImageData:g})};s.prototype.contactsDelete=function(a,b){this.defaultRequest(a,
"ContactsDelete",{Uids:b.join(",")})};s.prototype.suggestions=function(a,b,c){this.defaultRequest(a,"Suggestions",{Query:b,Page:c},null,"",["Suggestions"])};s.prototype.servicesPics=function(a){this.defaultRequest(a,"ServicesPics")};s.prototype.emailsPicsHashes=function(a){this.defaultRequest(a,"EmailsPicsHashes")};s.prototype.facebookUser=function(a){this.defaultRequest(a,"SocialFacebookUserInformation")};s.prototype.facebookDisconnect=function(a){this.defaultRequest(a,"SocialFacebookDisconnect")};
s.prototype.twitterUser=function(a){this.defaultRequest(a,"SocialTwitterUserInformation")};s.prototype.twitterDisconnect=function(a){this.defaultRequest(a,"SocialTwitterDisconnect")};s.prototype.googleUser=function(a){this.defaultRequest(a,"SocialGoogleUserInformation")};s.prototype.googleDisconnect=function(a){this.defaultRequest(a,"SocialGoogleDisconnect")};s.prototype.socialUsers=function(a){this.defaultRequest(a,"SocialUsers")};X.prototype.oEmailsPicsHashes={};X.prototype.oServices={};X.prototype.clear=
function(){this.oServices={};this.oEmailsPicsHashes={}};X.prototype.getUserPic=function(a){var b="",b="",b=a.toLowerCase(),c=d.isUnd(this.oEmailsPicsHashes[a])?"":this.oEmailsPicsHashes[a];""===c?(b=b.substr(a.indexOf("@")+1),b=""!==b&&this.oServices[b]?this.oServices[b]:""):b=e.link().getUserPicUrlFromHash(c);return b};X.prototype.setServicesData=function(a){this.oServices=a};X.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a};i.extend(w.prototype,X.prototype);w.prototype.oFoldersCache=
{};w.prototype.oFoldersNamesCache={};w.prototype.oFolderHashCache={};w.prototype.oFolderUidNextCache={};w.prototype.oMessageListHashCache={};w.prototype.oMessageFlagsCache={};w.prototype.oBodies={};w.prototype.oNewMessage={};w.prototype.oRequestedMessage={};w.prototype.clear=function(){X.prototype.clear.call(this);this.oFoldersCache={};this.oFoldersNamesCache={};this.oFolderHashCache={};this.oFolderUidNextCache={};this.oMessageListHashCache={};this.oMessageFlagsCache={};this.oBodies={}};w.prototype.getMessageKey=
function(a,b){return a+"#"+b};w.prototype.addRequestedMessage=function(a,b){this.oRequestedMessage[this.getMessageKey(a,b)]=!0};w.prototype.hasRequestedMessage=function(a,b){return!0===this.oRequestedMessage[this.getMessageKey(a,b)]};w.prototype.addNewMessageCache=function(a,b){this.oNewMessage[this.getMessageKey(a,b)]=!0};w.prototype.hasNewMessageAndRemoveFromCache=function(a,b){return this.oNewMessage[this.getMessageKey(a,b)]?(this.oNewMessage[this.getMessageKey(a,b)]=null,!0):!1};w.prototype.clearNewMessageCache=
function(){this.oNewMessage={}};w.prototype.getFolderFullNameRaw=function(a){return""!==a&&this.oFoldersNamesCache[a]?this.oFoldersNamesCache[a]:""};w.prototype.setFolderFullNameRaw=function(a,b){this.oFoldersNamesCache[a]=b};w.prototype.getFolderHash=function(a){return""!==a&&this.oFolderHashCache[a]?this.oFolderHashCache[a]:""};w.prototype.setFolderHash=function(a,b){this.oFolderHashCache[a]=b};w.prototype.getFolderUidNext=function(a){return""!==a&&this.oFolderUidNextCache[a]?this.oFolderUidNextCache[a]:
""};w.prototype.setFolderUidNext=function(a,b){this.oFolderUidNextCache[a]=b};w.prototype.getFolderFromCacheList=function(a){return""!==a&&this.oFoldersCache[a]?this.oFoldersCache[a]:null};w.prototype.setFolderToCacheList=function(a,b){this.oFoldersCache[a]=b};w.prototype.removeFolderFromCacheList=function(a){this.setFolderToCacheList(a,null)};w.prototype.getMessageFlagsFromCache=function(a,b){return this.oMessageFlagsCache[a]&&this.oMessageFlagsCache[a][b]?this.oMessageFlagsCache[a][b]:null};w.prototype.setMessageFlagsToCache=
function(a,b,c){this.oMessageFlagsCache[a]||(this.oMessageFlagsCache[a]={});this.oMessageFlagsCache[a][b]=c};w.prototype.clearMessageFlagsFromCacheByFolder=function(a){this.oMessageFlagsCache[a]={}};w.prototype.initMessageFlagsFromCache=function(a){if(a){var b=this,c=this.getMessageFlagsFromCache(a.folderFullNameRaw,a.uid),e=null,f=null;c&&4===c.length&&(a.unseen(c[0]),a.flagged(c[1]),a.answered(c[2]),a.forwarded(c[3]));0<a.threads().length&&(e=i.find(a.threads(),function(c){return(c=b.getMessageFlagsFromCache(a.folderFullNameRaw,
c))&&4===c.length&&!!c[0]}),f=i.find(a.threads(),function(c){return(c=b.getMessageFlagsFromCache(a.folderFullNameRaw,c))&&4===c.length&&!!c[1]}),a.hasUnseenSubMessage(e&&0<d.pInt(e)),a.hasFlaggedSubMessage(f&&0<d.pInt(f)))}};w.prototype.storeMessageFlagsToCache=function(a){a&&this.setMessageFlagsToCache(a.folderFullNameRaw,a.uid,[a.unseen(),a.flagged(),a.answered(),a.forwarded()])};w.prototype.storeMessageFlagsToCacheByFolderAndUid=function(a,b,c){d.isArray(c)&&4===c.length&&this.setMessageFlagsToCache(a,
b,c)};i.extend(ha.prototype,L.prototype);ha.prototype.onRoute=function(a){var b=this,c=null,g=null,h=null,t=null;if(g=i.find(U.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}))i.find(U["settings-removed"],function(a){return a&&a===g})&&(g=null),g&&i.find(U["settings-disabled"],function(a){return a&&a===g})&&(g=null);g&&(g.__builded&&g.__vm?c=g.__vm:(h=this.oViewModelPlace)&&1===h.length?(c=new g,t=j("<div></div>").addClass("rl-settings-view-model").hide().attr("data-bind",
'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),t.appendTo(h),c.data=e.data(),c.viewModelDom=t,c.viewModelDom.addClass("rl-animation-margin"),c.__rlSettingsData=g.__rlSettingsData,g.__dom=t,g.__builded=!0,g.__vm=c,f.applyBindings(c,t[0]),q.delegateRun(c,"onBuild",[t])):d.log("Cannot find sub settings view model position: SettingsSubScreen"),c&&i.defer(function(){if(b.oCurrentSubScreen){q.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide();b.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin")}b.oCurrentSubScreen=
c;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();q.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(c&&c.__rlSettingsData&&a.route===c.__rlSettingsData.Route)});j("#rl-content .b-settings .b-content .content").scrollTop(0);b.oCurrentSubScreen.viewModelDom.removeClass("rl-animation-margin")}d.windowResize()}))};ha.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(q.delegateRun(this.oCurrentSubScreen,"onHide"),
this.oCurrentSubScreen.viewModelDom.hide(),this.oCurrentSubScreen.viewModelDom.addClass("rl-animation-margin"))};ha.prototype.onBuild=function(){i.each(U.settings,function(a){a&&(a.__rlSettingsData&&!i.find(U["settings-removed"],function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:f.observable(!1),disabled:!!i.find(U["settings-disabled"],function(b){return b&&b===a})})},this);this.oViewModelPlace=j("#rl-content #rl-settings-subscreen")};
ha.prototype.routes=function(){var a=i.find(U.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,e){e.subname=d.isUnd(e.subname)?b:d.pString(e.subname);return[e.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(Fa.prototype,L.prototype);Fa.prototype.onShow=function(){e.setTitle(d.i18n("TITLES/LOGIN"))};i.extend(ea.prototype,L.prototype);ea.prototype.oLastRoute={};ea.prototype.onShow=
function(){var a=e.data().accountEmail();e.setTitle((""===a?"":a+" - ")+d.i18n("TITLES/MAILBOX"))};ea.prototype.onRoute=function(a,b,c){var d=e.data(),a=e.cache().getFolderFullNameRaw(a);if(a=e.cache().getFolderFromCacheList(a))d.currentFolder(a).messageListPage(b).messageListSearch(c),!d.usePreviewPane()&&d.message()&&d.message(null),e.reloadMessageList()};ea.prototype.onStart=function(){var a=e.data(),b=function(){d.windowResize()};e.settingsGet("AllowAdditionalAccounts")&&e.accounts();i.delay(function(){e.quota()},
5E3);i.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&e.folderInformation("INBOX")},1E3);i.delay(function(){var b=e.data().spamFolder();b!==a.currentFolderFullNameRaw()&&e.folderInformation(b)},1500);i.delay(function(){var b=e.data().draftFolder();b!==a.currentFolderFullNameRaw()&&e.folderInformation(b)},2E3);i.delay(function(){e.remote().appDelayStart(d.emptyFunction)},35E3);h.setInterval(function(){e.folderInformation("INBOX")},12E4);h.setInterval(function(){e.quota()},3E5);da.toggleClass("rl-no-preview-pane",
!a.usePreviewPane());a.folderList.subscribe(b);a.messageList.subscribe(b);a.message.subscribe(b);a.usePreviewPane.subscribe(function(a){da.toggleClass("rl-no-preview-pane",!a)})};ea.prototype.onBuild=function(){n.bMobileDevice||i.defer(function(){d.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",350,900,350,350,g.ClientSideKeyName.MailBoxListSize)})};ea.prototype.routes=function(){var a=function(a,c){c[0]=d.pString(c[0]);c[1]=d.pInt(c[1]);c[1]=0>=c[1]?1:c[1];c[2]=d.pString(c[2]);
""===a&&(c[0]="Inbox",c[1]=1);return[decodeURI(c[0]),c[1],decodeURI(c[2])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:function(a,c){c[0]=d.pString(c[0]);c[1]=d.pString(c[1]);""===a&&(c[0]="Inbox");return[decodeURI(c[0]),1,decodeURI(c[1])]}}],[/^([^\/]*)$/,{normalize_:a}]]};i.extend(Oa.prototype,ha.prototype);Oa.prototype.onShow=function(){e.setTitle(this.sSettingsTitle)};i.extend(K.prototype,
Sa.prototype);K.prototype.oSettings=null;K.prototype.oLink=null;K.prototype.download=function(a){n.bMobileDevice?h.open(a):this.iframe.attr("src",a)};K.prototype.link=function(){null===this.oLink&&(this.oLink=new C);return this.oLink};K.prototype.local=function(){null===this.oLocal&&(this.oLocal=new Aa);return this.oLocal};K.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=d.isNormal(Ga)?Ga:{});return d.isUnd(this.oSettings[a])?null:this.oSettings[a]};K.prototype.settingsSet=
function(a,b){null===this.oSettings&&(this.oSettings=d.isNormal(Ga)?Ga:{});this.oSettings[a]=b};K.prototype.setTitle=function(a){a=(0<a.length?a+" - ":"")+this.settingsGet("Title")||"";a!==h.document.title&&(h.document.title=a)};K.prototype.loginAndLogoutReload=function(a,b){var c=d.pString(this.settingsGet("CustomLogoutLink")),f=!!this.settingsGet("InIframe"),a=d.isUnd(a)?!1:!!a,b=d.isUnd(b)?!1:!!b;a&&(b&&h.close)&&h.close();a&&""!==c&&h.location.href!==c?i.defer(function(){f&&h.parent?h.parent.location.href=
c:h.location.href=c}):(q.routeOff(),q.setHash(e.link().root(),!0),q.routeOff(),i.defer(function(){f&&h.parent?h.parent.location.reload():h.location.reload()}))};K.prototype.getAutocomplete=function(a,b,c){c([],a)};K.prototype.bootstart=function(){d.initOnStartOrLangChange(function(){d.initNotificationLanguage()},null);i.delay(function(){d.windowResize()},1E3)};i.extend(B.prototype,K.prototype);B.prototype.oData=null;B.prototype.oRemote=null;B.prototype.oCache=null;B.prototype.data=function(){null===
this.oData&&(this.oData=new T);return this.oData};B.prototype.remote=function(){null===this.oRemote&&(this.oRemote=new s);return this.oRemote};B.prototype.cache=function(){null===this.oCache&&(this.oCache=new w);return this.oCache};B.prototype.reloadFlagsCurrentMessageListAndMessageFromCache=function(){var a=e.cache();i.each(e.data().messageList(),function(b){a.initMessageFlagsFromCache(b)});a.initMessageFlagsFromCache(e.data().message())};B.prototype.reloadMessageList=function(a,b){var c=e.data(),
f=(c.messageListPage()-1)*c.messagesPerPage();(d.isUnd(b)?0:b)&&e.cache().setFolderHash(c.currentFolderFullNameRaw(),"");if(d.isUnd(a)?0:a)c.messageListPage(1),f=0;c.messageListLoading(!0);e.remote().messageList(function(a,b,e){g.StorageResultType.Success===a&&b&&b.Result?(c.messageListError(""),c.messageListLoading(!1),c.setMessageList(b,e)):g.StorageResultType.Unload===a?(c.messageListError(""),c.messageListLoading(!1)):g.StorageResultType.Abort!==a&&(c.messageList([]),c.messageListLoading(!1),
c.messageListError(b&&b.ErrorCode?d.getNotification(b.ErrorCode):d.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST")))},c.currentFolderFullNameRaw(),f,c.messagesPerPage(),c.messageListSearch())};B.prototype.recacheInboxMessageList=function(){e.remote().messageList(d.emptyFunction,"INBOX",0,e.data().messagesPerPage(),"",!0)};B.prototype.folders=function(a,b){this.data().foldersLoading(!0);this.remote().folders(i.bind(function(a,d,f){e.data().foldersLoading(!1);g.StorageResultType.Success===a?(this.data().setFolders(d,
f),b&&b(!0)):b&&b(!1)},this),a)};B.prototype.accounts=function(){e.data().accountsLoading(!0);e.remote().accounts(function(a,b){e.data().accountsLoading(!1);if(g.StorageResultType.Success===a&&d.isArray(b.Result)){var c=e.settingsGet("ParentEmail"),c=""===c?e.data().accountEmail():c;e.data().accounts(i.map(b.Result,function(a){return new La(a,a!==c)}))}})};B.prototype.quota=function(){this.remote().quota(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result&&d.isArray(b.Result)&&2===b.Result.length&&
d.isPosNumeric(b.Result[0],!0)&&d.isPosNumeric(b.Result[1],!0))&&(e.data().userQuota(1024*d.pInt(b.Result[1])),e.data().userUsageSize(1024*d.pInt(b.Result[0])))})};B.prototype.folderInformation=function(a,b){this.remote().folderInformation(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result&&b.Result.Hash&&b.Result.Folder){var f=e.cache().getFolderHash(b.Result.Folder),h=e.cache().getFolderFromCacheList(b.Result.Folder),i=!1,j="",m=[],m=!1,p=null;if(h){b.Result.Hash&&e.cache().setFolderHash(b.Result.Folder,
b.Result.Hash);d.isNormal(b.Result.MessageCount)&&h.messageCountAll(b.Result.MessageCount);d.isNormal(b.Result.MessageUnseenCount)&&(d.pInt(h.messageCountUnread())!==d.pInt(b.Result.MessageUnseenCount)&&(m=!0),h.messageCountUnread(b.Result.MessageUnseenCount));m&&e.cache().clearMessageFlagsFromCacheByFolder(h.fullNameRaw);if(b.Result.Flags){for(j in b.Result.Flags)b.Result.Flags.hasOwnProperty(j)&&(i=!0,p=b.Result.Flags[j],e.cache().storeMessageFlagsToCacheByFolderAndUid(h.fullNameRaw,j.toString(),
[!p.IsSeen,!!p.IsFlagged,!!p.IsAnswered,!!p.IsForwarded]));i&&e.reloadFlagsCurrentMessageListAndMessageFromCache()}e.data().initUidNextAndNewMessages(h.fullNameRaw,b.Result.UidNext,b.Result.NewMessages);b.Result.Hash!==f||""===f?h.fullNameRaw===e.data().currentFolderFullNameRaw()?e.reloadMessageList():"INBOX"===h.fullNameRaw&&e.recacheInboxMessageList():m&&h.fullNameRaw===e.data().currentFolderFullNameRaw()&&(m=e.data().messageList(),d.isNonEmptyArray(m)&&e.folderInformation(h.fullNameRaw,m))}}},
a,b)};B.prototype.setMessageSeen=function(a){if(a.unseen()){a.unseen(!1);var b=e.cache().getFolderFromCacheList(a.folderFullNameRaw);b&&b.messageCountUnread(0<=b.messageCountUnread()-1?b.messageCountUnread()-1:0);e.cache().storeMessageFlagsToCache(a);e.reloadFlagsCurrentMessageListAndMessageFromCache()}e.remote().messageSetSeen(d.emptyFunction,a.folderFullNameRaw,[a.uid],!0)};B.prototype.googleConnect=function(){h.open(e.link().socialGoogle(),"Google","left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes")};
B.prototype.twitterConnect=function(){h.open(e.link().socialTwitter(),"Twitter","left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes")};B.prototype.facebookConnect=function(){h.open(e.link().socialFacebook(),"Facebook","left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes")};B.prototype.socialUsers=function(a){var b=e.data();a&&(b.googleActions(!0),b.facebookActions(!0),b.twitterActions(!0));e.remote().socialUsers(function(a,d){if(g.StorageResultType.Success===
a&&d&&d.Result){b.googleUserName(d.Result.Google||"");b.facebookUserName(d.Result.Facebook||"");b.twitterUserName(d.Result.Twitter||"")}else{b.googleUserName("");b.facebookUserName("");b.twitterUserName("")}b.googleLoggined(""!==b.googleUserName());b.facebookLoggined(""!==b.facebookUserName());b.twitterLoggined(""!==b.twitterUserName());b.googleActions(false);b.facebookActions(false);b.twitterActions(false)})};B.prototype.googleDisconnect=function(){e.data().googleActions(!0);e.remote().googleDisconnect(function(){e.socialUsers()})};
B.prototype.facebookDisconnect=function(){e.data().facebookActions(!0);e.remote().facebookDisconnect(function(){e.socialUsers()})};B.prototype.twitterDisconnect=function(){e.data().twitterActions(!0);e.remote().twitterDisconnect(function(){e.socialUsers()})};B.prototype.folderListOptionsBuilder=function(a,b,c,f,i,j,m,k,q,p){var o=0,r=0,n=null,s=[],q=!d.isNormal(q)?0<a.length:q,p=d.isUnd(p)?!1:!!p,i=!d.isNormal(i)?0:i,j=d.isNormal(j)?j:null,m=d.isNormal(m)?m:null,k=d.isNormal(k)?k:null;d.isArray(c)||
(c=[]);d.isArray(f)||(f=[]);o=0;for(r=f.length;o<r;o++)s.push({id:f[o][0],name:f[o][1],disable:!1});o=0;for(r=a.length;o<r;o++)if(n=a[o],m?m.call(null,n):1)s.push({id:n.fullNameRaw,system:!0,name:k?k.call(null,n):n.name(),disable:!n.selectable||-1<d.inArray(n.fullNameRaw,c)||(j?j.call(null,n):!1)});o=0;for(r=b.length;o<r;o++){n=b[o];if(!n.isGmailFolder&&(n.subScribed()||!n.existen))if(m?m.call(null,n):1)if(g.FolderType.User===n.type()||!q||!n.isNamespaceFolder&&0<n.subFolders().length)s.push({id:n.fullNameRaw,
system:!1,name:(new h.Array(n.deep+1-i)).join("\u00a0\u00a0\u00a0\u00a0")+(k?k.call(null,n):n.name()),disable:!n.selectable||-1<d.inArray(n.fullNameRaw,c)||g.FolderType.User!==n.type()||(j?j.call(null,n):!1)});n.isUnpaddigFolder&&i++;n.subScribed()&&0<n.subFolders().length&&(s=s.concat(e.folderListOptionsBuilder([],n.subFolders(),c,[],i,j,m,k,q,p)))}return s};B.prototype.getAutocomplete=function(a,b,c){var f=[];e.remote().suggestions(function(a,b){g.StorageResultType.Success===a&&b&&b.Result&&d.isArray(b.Result.List)?
(f=i.map(b.Result.List,function(a){return a&&a[0]?new G(a[0],a[1]):null}),c(i.compact(f),!!b.Result.More)):g.StorageResultType.Abort!==a&&c([],!1)},a,b)};B.prototype.emailsPicsHashes=function(){e.remote().emailsPicsHashes(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result)&&e.cache().setEmailsPicsHashesData(b.Result)})};B.prototype.bootstart=function(){K.prototype.bootstart.call(this);e.data().populateDataOnStart();var a="",b=this.settingsGet("JsHash"),c=this.settingsGet("AllowGoogleSocial"),
f=this.settingsGet("AllowFacebookSocial"),m=this.settingsGet("AllowTwitterSocial");!this.settingsGet("RemoteChangePassword")&&sa&&d.removeSettingsViewModel(sa);!this.settingsGet("AllowAdditionalAccounts")&&ra&&d.removeSettingsViewModel(ra);!c&&(!f&&!m&&Ma)&&d.removeSettingsViewModel(Ma);!this.settingsGet("AllowThemes")&&na&&d.removeSettingsViewModel(na);d.initOnStartOrLangChange(function(){j.extend(!0,j.magnificPopup.defaults,{tClose:d.i18n("MAGNIFIC_POPUP/CLOSE"),tLoading:d.i18n("MAGNIFIC_POPUP/LOADING"),
gallery:{tPrev:d.i18n("MAGNIFIC_POPUP/GALLERY_PREV"),tNext:d.i18n("MAGNIFIC_POPUP/GALLERY_NEXT"),tCounter:d.i18n("MAGNIFIC_POPUP/GALLERY_COUNTER")},image:{tError:d.i18n("MAGNIFIC_POPUP/IMAGE_ERROR")},ajax:{tError:d.i18n("MAGNIFIC_POPUP/AJAX_ERROR")}})},this);h.SimplePace&&(h.SimplePace.set(70),h.SimplePace.sleep());this.settingsGet("Auth")?(this.setTitle(d.i18n("TITLES/LOADING")),this.folders(!0,i.bind(function(a){q.hideLoading();if(a){q.startScreens([ea,Oa]);Ha.on("mousedown","#rl-center a",function(a){if(a&&
3!==a.which){var a=null,b=j(this).attr("href");if(b&&"mailto:"===b.toString().toLowerCase().substr(0,7)){a=new G;a.parse(h.decodeURI(b.toString().substr(7)));if(a&&a.email){q.showScreenPopup(z,[g.ComposeType.Empty,null,[a]]);return false}}}return true});(c||f||m)&&e.socialUsers(true);i.delay(function(){e.emailsPicsHashes();e.remote().servicesPics(function(a,b){g.StorageResultType.Success===a&&(b&&b.Result)&&e.cache().setServicesData(b.Result)})},1E3);x.runHook("rl-start-user-screens")}else{q.startScreens([Fa]);
x.runHook("rl-start-login-screens")}h.SimplePace&&h.SimplePace.set(100);n.bMobileDevice||i.defer(function(){d.initLayoutResizer("#rl-top-resizer-left","#rl-top-resizer-right","#rl-center",120,300,200,600,g.ClientSideKeyName.FolderListSize)})},this))):(a=d.pString(this.settingsGet("CustomLoginLink")))?(q.routeOff(),q.setHash(e.link().root(),!0),q.routeOff(),i.defer(function(){h.location.href=a})):(q.hideLoading(),q.startScreens([Fa]),x.runHook("rl-start-login-screens"),h.SimplePace&&h.SimplePace.set(100));
c&&(h["rl_"+b+"_google_service"]=function(){e.data().googleActions(true);e.socialUsers()});f&&(h["rl_"+b+"_facebook_service"]=function(){e.data().facebookActions(true);e.socialUsers()});m&&(h["rl_"+b+"_twitter_service"]=function(){e.data().twitterActions(true);e.socialUsers()});x.runHook("rl-start-screens")};e=new B;da.addClass(n.bMobileDevice?"mobile":"no-mobile");P.keydown(d.killCtrlAandS).keyup(d.killCtrlAandS);P.unload(function(){n.bUnload=!0});h.rl=h.rl||{};h.rl.addHook=x.addHook;h.rl.settingsGet=
x.mainSettingsGet;h.rl.remoteRequest=x.remoteRequest;h.rl.pluginSettingsGet=x.settingsGet;h.rl.addSettingsViewModel=d.addSettingsViewModel;h.rl.createCommand=d.createCommand;h.rl.EmailModel=G;h.rl.Enums=g;h.__RLBOOT=function(a){j(function(){h.rainloopTEMPLATES&&h.rainloopTEMPLATES[0]?(j("#rl-templates").html(h.rainloopTEMPLATES[0]),h.setInterval(function(){n.minuteTick(!n.minuteTick())},6E4),h.setInterval(function(){n.fiveMinuteTick(!n.fiveMinuteTick())},3E5),i.delay(function(){h.rainloopAppData=
{};h.rainloopI18N={};h.rainloopTEMPLATES={};q.setBoot(e).bootstart()},50)):a(!1);h.__RLBOOT=null})};h.SimplePace&&h.SimplePace.add(10)})(window,jQuery,ko,crossroads,hasher,moment,Jua,_);

View file

@ -0,0 +1 @@
600ddea78fde5db1d72498a9a612c2e5efc1229f

View file

@ -0,0 +1 @@
1.3.8.476

View file

@ -130,10 +130,12 @@ class HtmlUtils
* @param \DOMElement $oElement
* @param bool $bHasExternals
* @param array $aFoundCIDs
* @param array $aContentLocationUrls
* @param array $aFoundedContentLocationUrls
*
* @return string
*/
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs)
public static function ClearStyle($sStyle, $oElement, &$bHasExternals, &$aFoundCIDs, $aContentLocationUrls, &$aFoundedContentLocationUrls)
{
$sStyle = \trim($sStyle);
$aOutStyles = array();
@ -242,12 +244,15 @@ class HtmlUtils
/**
* @param string $sHtml
* @param bool $bHasExternals
* @param array $aFoundCIDs
* @param bool $bHasExternals = false
* @param array $aFoundCIDs = array()
* @param array $aContentLocationUrls = array()
* @param array $aFoundedContentLocationUrls = array()
*
* @return string
*/
public static function ClearHtml($sHtml, &$bHasExternals = false, &$aFoundCIDs = array())
public static function ClearHtml($sHtml, &$bHasExternals = false, &$aFoundCIDs = array(),
$aContentLocationUrls = array(), &$aFoundedContentLocationUrls = array())
{
$sHtml = null === $sHtml ? '' : (string) $sHtml;
$sHtml = \trim($sHtml);
@ -304,7 +309,12 @@ class HtmlUtils
$sSrc = \trim($oElement->getAttribute('src'));
$oElement->removeAttribute('src');
if ('cid:' === \strtolower(\substr($sSrc, 0, 4)))
if (\in_array($sSrc, $aContentLocationUrls))
{
$oElement->setAttribute('data-x-src-location', $sSrc);
$aFoundedContentLocationUrls[] = $sSrc;
}
else if ('cid:' === \strtolower(\substr($sSrc, 0, 4)))
{
$oElement->setAttribute('data-x-src-cid', \substr($sSrc, 4));
$aFoundCIDs[] = \substr($sSrc, 4);
@ -356,7 +366,8 @@ class HtmlUtils
if ($oElement->hasAttribute('style'))
{
$oElement->setAttribute('style',
\MailSo\Base\HtmlUtils::ClearStyle($oElement->getAttribute('style'), $oElement, $bHasExternals, $aFoundCIDs));
\MailSo\Base\HtmlUtils::ClearStyle($oElement->getAttribute('style'), $oElement, $bHasExternals,
$aFoundCIDs, $aContentLocationUrls, $aFoundedContentLocationUrls));
}
}
@ -375,10 +386,11 @@ class HtmlUtils
* @param string $sHtml
* @param array $aFoundCids = array()
* @param array|null $mFoundDataURL = null
* @param array $aFoundedContentLocationUrls = array()
*
* @return string
*/
public static function BuildHtml($sHtml, &$aFoundCids = array(), &$mFoundDataURL = null)
public static function BuildHtml($sHtml, &$aFoundCids = array(), &$mFoundDataURL = null, &$aFoundedContentLocationUrls = array())
{
$bRtl = \MailSo\Base\Utils::IsRTL($sHtml);
@ -403,6 +415,20 @@ class HtmlUtils
$oElement->setAttribute('src', 'cid:'.$sCid);
}
}
if ($oElement->hasAttribute('data-x-src-location'))
{
$sSrc = $oElement->getAttribute('data-x-src-location');
$oElement->removeAttribute('data-x-src-location');
if (!empty($sSrc))
{
$aFoundedContentLocationUrls[] = $sSrc;
@$oElement->removeAttribute('src');
$oElement->setAttribute('src', $sSrc);
}
}
if ($oElement->hasAttribute('data-x-broken-src'))
{

View file

@ -401,10 +401,11 @@ class Http
* @param string $sContentType = ''
* @param int $iCode = 0
* @param \MailSo\Log\Logger $oLogger = null
* @param int $iTimeout = 10
*
* @return bool
*/
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MaiSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0, $oLogger = null)
public function SaveUrlToFile($sUrl, $rFile, $sCustomUserAgent = 'MaiSo Http User Agent (v1)', &$sContentType = '', &$iCode = 0, $oLogger = null, $iTimeout = 10)
{
if (!is_resource($rFile))
{
@ -423,7 +424,7 @@ class Http
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FILE => $rFile,
CURLOPT_TIMEOUT => 10
CURLOPT_TIMEOUT => (int) $iTimeout
);
if (0 < \strlen($sCustomUserAgent))

View file

@ -712,6 +712,69 @@ class Utils
return $sResult;
}
/**
* @param string $sContentType
* @param string $sFileName
*
* @return string
*/
public static function ContentTypeType($sContentType, $sFileName)
{
$sResult = '';
$sContentType = \strtolower($sContentType);
if (0 === strpos($sContentType, 'image/'))
{
$sResult = 'image';
}
else
{
switch ($sContentType)
{
case 'application/zip':
case 'application/x-7z-compressed':
case 'application/x-rar-compressed':
case 'application/x-msdownload':
case 'application/vnd.ms-cab-compressed':
case 'application/x-gzip':
case 'application/x-bzip':
case 'application/x-bzip2':
case 'application/x-debian-package':
$sResult = 'archive';
break;
case 'application/msword':
case 'application/rtf':
case 'application/vnd.ms-excel':
case 'application/vnd.ms-powerpoint':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.template':
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
case 'application/vnd.oasis.opendocument.text':
case 'application/vnd.oasis.opendocument.spreadsheet':
$sResult = 'doc';
break;
case 'application/pdf':
case 'application/x-pdf':
$sResult = 'pdf';
break;
}
if ('' === $sResult)
{
switch (\strtolower(\MailSo\Base\Utils::GetFileExtension($sFileName)))
{
case 'zip':
case '7z':
case 'rar':
$sResult = 'archive';
break;
}
}
}
return $sResult;
}
/**
* @staticvar bool $bValidateAction
*

View file

@ -199,6 +199,14 @@ class BodyStructure
return (null === $this->sContentID) ? '' : $this->sContentID;
}
/**
* return string
*/
public function ContentLocation()
{
return (null === $this->sLocation) ? '' : $this->sLocation;
}
/**
* return bool
*/
@ -208,6 +216,38 @@ class BodyStructure
(0 < strlen($this->ContentID())) : ('inline' === strtolower($this->sDisposition));
}
/**
* return bool
*/
public function IsImage()
{
return 'image' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->FileName());
}
/**
* return bool
*/
public function IsArchive()
{
return 'archive' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->FileName());
}
/**
* @return bool
*/
public function IsPdf()
{
return 'pdf' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->FileName());
}
/**
* @return bool
*/
public function IsDoc()
{
return 'doc' === \MailSo\Base\Utils::ContentTypeType($this->ContentType(), $this->FileName());
}
/**
* @return array|null
*/

Some files were not shown because too many files have changed in this diff Show more