snappymail/rainloop/v/1.3.10.492/static/js/admin.min.js
2013-11-12 11:28:48 +04:00

159 lines
No EOL
80 KiB
JavaScript

(function(g,i,d,fa,y,j){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 N(){}function O(){}function P(){var a=j.find([O,N],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 r(){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.imapShortLogin=d.observable(!1);this.smtpServer=d.observable("");this.smtpPort=d.observable(m.Values.SmtpDefaulPort);this.smtpSecure=d.observable(f.ServerSecure.None);this.smtpShortLogin=d.observable(!1);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(j.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),
this.whiteList())},this.canBeSaved);this.testConnectionCommand=c.createCommand(this,function(){this.whiteListPage(!1);this.testingDone(!1);this.testingImapError(!1);this.testingSmtpError(!1);this.testing(!0);e.remote().testConnectionForDomain(j.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 Q(){t.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=j.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();j.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 R(){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 S(){t.call(this,"Popups","PopupsLanguages");this.exp=d.observable(!1);this.languages=d.computed(function(){var a=e.data().mainLanguage();return j.map(e.data().languages(),function(b){return{key:b,selected:b===a,fullName:c.convertLangName(b)}})})}function T(){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(j.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.allowIdentities=a.allowIdentities;this.determineUserLanguage=a.determineUserLanguage;this.title=d.observable(e.settingsGet("Title"));this.defaultDomain=d.observable(e.settingsGet("LoginDefaultDomain"));this.themesOptions=d.computed(function(){return j.map(a.themes(),function(a){return{optValue:a,optText:c.convertThemeName(a)}})});this.languagesOptions=d.computed(function(){return j.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);this.defaultDomainTrigger=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 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=j.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=j.bind(this.onPluginLoadRequest,this);this.onPluginDisableRequest=j.bind(this.onPluginDisableRequest,this)}function J(){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 j.filter(this.packages(),function(a){return a&&""!==a.installed&&!a.compare})},this);this.packagesAvailableForUpdate=d.computed(function(){return j.filter(this.packages(),function(a){return a&&""!==a.installed&&!!a.compare})},this);this.packagesAvailableForInstallation=
d.computed(function(){return j.filter(this.packages(),function(a){return a&&""===a.installed})},this);this.visibility=d.computed(function(){return a.packagesLoading()?"visible":"hidden"},this)}function L(){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 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",[T])}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=i('<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,
["Script error.","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():"",I.attr("class"),c.microtime()-k.now)})}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":[]},q=null,U=g.rainloopAppData||{},da=g.rainloopI18N||{},I=i("html"),H=i(g),
ka=i(g.document),V=g.Notification&&g.Notification.requestPermission?g.Notification:null,e=null;k.now=(new Date).getTime();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;k.bAnimationSupported=!k.bMobileDevice&&I.hasClass("csstransitions");k.sAnimationType="";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.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"};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=i.trim;c.inArray=i.inArray;c.isArray=
j.isArray;c.isFunc=j.isFunction;c.isUnd=j.isUndefined;c.isNull=j.isNull;c.emptyFunction=function(){};c.isNormal=function(a){return!c.isUnd(a)&&!c.isNull(a)};c.windowResize=j.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,h){a[b]=h};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,h){ea[a]||(ea[a]=g.setTimeout(function(){b();ea[a]=0},h))};var z=!1;c.audio=function(a,b){if(!1===z)if(k.bIsiOSDevice)z=null;else{var h=
!1,c=!1,d=g.Audio?new g.Audio:null;d&&d.canPlayType&&d.play?((h=""!==d.canPlayType('audio/mpeg; codecs="mp3"'))||(c=""!==d.canPlayType('audio/ogg; codecs="vorbis"')),h||c?(z=d,z.preload="none",z.loop=!1,z.autoplay=!1,z.muted=!1,z.src=h?a:b):z=null):z=null}return z};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){j.defer(function(){i(".i18n",a).each(function(){var a=i(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=i(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.editorDefaultType=d.observable(f.EditorDefaultType.Html);a.showImages=d.observable(!1);a.interfaceAnimation=d.observable(f.InterfaceAnimation.Full);k.sAnimationType=f.InterfaceAnimation.Full;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.interfaceAnimation.subscribe(function(a){if(k.bMobileDevice||a===f.InterfaceAnimation.None)I.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),k.sAnimationType=f.InterfaceAnimation.None;else switch(a){case f.InterfaceAnimation.Full:I.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full");
k.sAnimationType=a;break;case f.InterfaceAnimation.Normal:I.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),k.sAnimationType=a}});a.interfaceAnimation.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(!1);a.allowAdditionalAccounts=d.observable(!1);a.allowIdentities=d.observable(!1);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 j.isArray(b)&&-1!==j.indexOf(b,a)};c.setExpandedFolder=function(a,b){var c=e.local().get(f.ClientSideKeyName.ExpandedFolders);j.isArray(c)||(c=[]);b?(c.push(a),c=j.uniq(c)):c=j.without(c,a);e.local().set(f.ClientSideKeyName.ExpandedFolders,
c)};c.initLayoutResizer=function(a,b,c,d,f,M,g,k){var d=d||300,f=f||500,M=M||f-d/2,g=g||300,x=0,l=i(a),m=i(b),o=i(c),b=e.local().get(k)||M,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(j.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=i("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===i(this).parent().closest("blockquote",a).length});b&&0<b.length&&b.each(function(){var a=i(this),b=a.height();if(0===b||100<b)a.addClass("rl-bq-switcher hidden-bq"),i('<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&&(i(a).find("blockquote.rl-bq-switcher").each(function(){i(this).removeClass("rl-bq-switcher hidden-bq")}),i(a).find(".rlBlockquoteSwitcher").each(function(){i(this).remove()}))};c.extendAsViewModel=function(a,b){b&&(b.__name=a,o.regViewModelHook(a,b),j.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.quoteName=function(a){return a.replace(/["]/g,'\\"')};c.microtime=function(){return(new Date).getTime()};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 i('<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(""),j="__OpenerApplyBindingsUid"+c.fakeMd5()+"__",k=i("#"+b);g[j]=function(){if(f&&f.document.body&&k&&k[0]){var b=i(f.document.body);i("#rl-content",b).html(k.html());i("html",f.document).addClass("external "+i("html").attr("class"));c.i18nToNode(b);r.prototype.applyExternal(a,i("#rl-content",b)[0]);g[j]=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['"+j+"']){window.opener['"+j+"']();window.opener['"+j+"']=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,i,x){b.call(h,e&&e.Result?f.SaveSettingsStep.TrueResult:
f.SaveSettingsStep.FalseResult);a&&a.call(h,c,e,g,i,x);j.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=i(a).data("tooltip-class")||"",e=i(a).data("tooltip-placement")||"top";i(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,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=i(a).data("tooltip-class")||
"",d=i(a).data("tooltip-placement")||"top";i(a).tooltip({delay:{show:500,hide:100},html:!0,placement:d,title:function(){return'<span class="tooltip-class '+c+'">'+b()()+"</span>"}})}};d.bindingHandlers.dropdown={init:function(a){i(a).closest(".dropdown").on("click",".e-item",function(){i(a).dropdown("toggle")})}};d.bindingHandlers.popover={init:function(a,b){i(a).popover(d.utils.unwrapObservable(b()))}};d.bindingHandlers.resizecrop={init:function(a){i(a).addClass("resizecrop").resizecrop({width:"100",
height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,b){b()();i(a).resizecrop({width:"100",height:"100"})}};d.bindingHandlers.onEnter={init:function(a,b,c,d){i(a).on("keypress",function(c){c&&13===g.parseInt(c.keyCode,10)&&(i(a).trigger("change"),b().call(d))})}};d.bindingHandlers.onEsc={init:function(a,b,c,d){i(a).on("keypress",function(c){c&&27===g.parseInt(c.keyCode,10)&&(i(a).trigger("change"),b().call(d))})}};d.bindingHandlers.modal={init:function(a,b){i(a).modal({keyboard:!1,
show:d.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=d.utils.unwrapObservable(b());i(a).modal(c?"show":"hide");j.delay(function(){i(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){i(a).attr("href",d.utils.unwrapObservable(b()))}};d.bindingHandlers.title={update:function(a,
b){i(a).attr("title",d.utils.unwrapObservable(b()))}};d.bindingHandlers.textF={init:function(a,b){i(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());i(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=i(a).offset().top;0<f&&(f+=c.pInt(h[2]),f=H.height()-f,e<f&&(e=f),i(a).css({height:e,"min-height":e}))}};
d.bindingHandlers.appendDom={update:function(a,b){i(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){i(e).each(function(){var b=null,h=null,d=i(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(){i(e).each(function(){g.clearInterval(i(this).data("timerScroll"));i(this).data("timerScroll",!1)})});h.helper=function(a){return b()(a&&a.target?d.dataFor(a.target):
null)};i(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)}),i(a).droppable(b))}}};d.bindingHandlers.nano={init:function(a){k.bDisableNanoScroll||i(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,
preventPageScrolling:!0})}};d.bindingHandlers.saveTrigger={init:function(a){i(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=i(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\.\-_]+/),M=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:j.map(b,
function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};i(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(){i(a).select2("destroy")});i(a).on("change",function(){for(var a=i(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=M.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,j="",k=[];e<f;e++)g=c[e],j=g.toLine(!1),k.push({id:j,text:j,c:g});i(a).select2("data",k)}};d.bindingHandlers.command={init:function(a,b,c,e){var f=i(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=i(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.validateSimpleEmail=function(){this.hasError=d.observable(!1);this.subscribe(function(a){a=c.trim(a);this.hasError(""!==a&&!/^.+@.+$/.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||[],j.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};N.supported=function(){return!0};N.prototype.set=function(a,b){var c=i.cookie(m.Values.ClientSideCookieIndexName),d=!1,
e=null;try{(e=null===c?null:JSON.parse(c))||(e={}),e[a]=b,i.cookie(m.Values.ClientSideCookieIndexName,JSON.stringify(e),{expires:30}),d=!0}catch(f){}return d};N.prototype.get=function(a){var b=i.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};O.supported=function(){return!!g.localStorage};O.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};O.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};P.prototype.oDriver=null;P.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};P.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null};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=j.bind(this.onRoute||c.emptyFunction,this),b=fa.create(),j.each(a,function(a){b.addRoute(a[0],d).rules=a[1]}),this.oCross=b)};r.prototype.sDefaultScreenName="";r.prototype.oScreens={};r.prototype.oBoot=null;r.prototype.oCurrentScreen=null;r.prototype.showLoading=function(){i("#rl-loading").show()};r.prototype.hideLoading=
function(){i("#rl-loading").hide()};r.prototype.routeOff=function(){y.changed.active=!1};r.prototype.routeOn=function(){y.changed.active=!0};r.prototype.setBoot=function(a){c.isNormal(a)&&(this.oBoot=a);return this};r.prototype.screen=function(a){return""!==a&&!c.isUnd(this.oScreens[a])?this.oScreens[a]:null};r.prototype.delegateRun=function(a,b,d){a&&a[b]&&a[b].apply(a,c.isArray(d)?d:[])};r.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var h=new a(b),f=h.viewModelPosition(),g=i("#rl-content #rl-"+
f.toLowerCase()),j=null;a.__builded=!0;a.__vm=h;h.data=e.data();h.viewModelName=a.__name;g&&1===g.length?(j=i("<div>").addClass("rl-view-model").addClass("RL-"+h.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+h.viewModelTemplate()+'"}, i18nInit: true'),j.appendTo(g),h.viewModelDom=j,a.__dom=j,"Popups"===f&&(h.cancelCommand=h.closeCommand=c.createCommand(h,function(){q.hideScreenPopup(a)})),o.runHook("view-model-pre-build",[a.__name,h,j]),d.applyBindings(h,j[0]),this.delegateRun(h,
"onBuild",[j]),o.runHook("view-model-post-build",[a.__name,h,j])):c.log("Cannot find view model position: "+f)}return a?a.__vm:null};r.prototype.applyExternal=function(a,b){a&&b&&d.applyBindings(a,b)};r.prototype.hideScreenPopup=function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),j.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};r.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||[]])))};r.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())&&j.each(e.viewModels(),
function(a){this.buildViewModel(a,e)},this),this.delegateRun(e,"onBuild")),j.defer(function(){if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onHide");c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&j.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())&&j.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)}))}};r.prototype.startScreens=function(a){j.each(a,function(a){var c=(a=new a)?a.screenName():"";a&&""!==c&&(""===this.sDefaultScreenName&&
(this.sDefaultScreenName=c),this.oScreens[c]=a)},this);j.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\-]*)\/?(.*)$/,j.bind(this.screenOnRoute,this));y.initialized.add(a.parse,a);y.changed.add(a.parse,a);y.init()};r.prototype.setHash=function(a,b,d){a="#"===a.substr(0,1)?a.substr(1):
a;a="/"===a.substr(0,1)?a.substr(1):a;d=c.isUnd(d)?!1:!!d;(c.isUnd(b)?0:b)?(y.changed.active=!1,y[d?"replaceHash":"setHash"](a),y.changed.active=!0):(y.changed.active=!0,y[d?"replaceHash":"setHash"](a),y.setHash(a))};r.prototype.bootstart=function(){this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart();return this};q=new r;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 i("<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.imapShortLogin(!!a.IncShortLogin),this.smtpServer(c.trim(a.OutHost)),this.smtpPort(c.pInt(a.OutPort)),this.smtpSecure(c.trim(a.OutSecure)),this.smtpShortLogin(!!a.OutShortLogin),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.imapShortLogin(!1);this.smtpServer("");this.smtpPort(m.Values.SmtpDefaulPort);this.smtpSecure(f.ServerSecure.None);this.smtpShortLogin(!1);this.smtpAuth(!0);this.whiteList("")};c.extendAsViewModel("PopupsPluginViewModel",Q);Q.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)))};Q.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(j.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",
R);R.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))};R.prototype.validateSubscriptionKey=function(){var a=this.key();return""===a||!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(c.trim(a))};c.extendAsViewModel("PopupsLanguagesViewModel",S);S.prototype.onShow=function(){this.exp(!0)};S.prototype.onHide=function(){this.exp(!1)};S.prototype.changeLanguage=
function(a){e.data().mainLanguage(a);this.cancelCommand()};c.extendAsViewModel("AdminLoginViewModel",T);T.prototype.onShow=function(){q.routeOff();j.delay(j.bind(function(){this.loginFocus(!0)},this),100)};T.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;j.delay(function(){var b=c.settingsSaveHelperSimpleFunction(a.titleTrigger,a),d=c.settingsSaveHelperSimpleFunction(a.languageTrigger,a),f=c.settingsSaveHelperSimpleFunction(a.themeTrigger,a),g=c.settingsSaveHelperSimpleFunction(a.defaultDomainTrigger,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.allowIdentities.subscribe(function(a){e.remote().saveAdminConfig(null,{AllowIdentities: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"})});a.defaultDomain.subscribe(function(a){e.remote().saveAdminConfig(g,
{LoginDefaultDomain:c.trim(a)})})},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(){q.showScreenPopup(B)};C.prototype.deleteDomain=function(a){this.domains.remove(a);e.remote().domainDelete(j.bind(this.onDomainListChangeRequest,this),a.name)};C.prototype.disableDomain=
function(a){a.disabled(!a.disabled());e.remote().domainDisable(j.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(j.bind(b.onDomainLoadRequest,b),a.name)});e.reloadDomainList()};C.prototype.onDomainLoadRequest=function(a,b){f.StorageResultType.Success===a&&(b&&b.Result)&&q.showScreenPopup(B,[b.Result])};C.prototype.onDomainListChangeRequest=
function(){e.reloadDomainList()};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;j.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),j=c.settingsSaveHelperSimpleFunction(a.googleTrigger1,a),i=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(j,{GoogleClientID:c.trim(a)})});a.googleClientSecret.subscribe(function(a){e.remote().saveAdminConfig(i,
{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)&&q.showScreenPopup(Q,[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(J,"AdminPackages","Packages","packages");J.prototype.onShow=function(){this.packagesError("")};J.prototype.onBuild=function(){e.reloadPackagesList()};J.prototype.requestHelper=function(a,b){var d=this;return function(i,k){if(f.StorageResultType.Success!==i||!k||!k.Result)k&&k.ErrorCode?d.packagesError(c.getNotification(k.ErrorCode)):
d.packagesError(c.getNotification(b?f.Notification.CantInstallPackage:f.Notification.CantDeletePackage));j.each(e.data().packages(),function(b){b&&(a&&b.loading()&&a.file===b.file)&&(a.loading(!1),b.loading(!1))});f.StorageResultType.Success===i&&k&&k.Result&&k.Result.Reload?g.location.reload():e.reloadPackagesList()}};J.prototype.deletePackage=function(a){a&&(a.loading(!0),e.remote().packageDelete(this.requestHelper(a,!1),a))};J.prototype.installPackage=function(a){a&&(a.loading(!0),e.remote().packageInstall(this.requestHelper(a,
!0),a))};c.addSettingsViewModel(L,"AdminLicensing","Licensing","licensing");L.prototype.onBuild=function(){this.subscriptionEnabled()&&e.reloadLicensing(!1)};L.prototype.onShow=function(){this.adminDomain(e.settingsGet("AdminDomain"))};L.prototype.showActivationForm=function(){q.showScreenPopup(R)};L.prototype.licenseExpiredMomentValue=function(){var a=moment.unix(this.licenseExpired());return a.format("LL")+" ("+a.from(moment())+")"};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.allowIdentities(!!e.settingsGet("AllowIdentities"));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.editorDefaultType(e.settingsGet("EditorDefaultType"));this.showImages(!!e.settingsGet("ShowImages"));this.interfaceAnimation(e.settingsGet("InterfaceAnimation"));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"))};j.extend(aa.prototype,Z.prototype);aa.prototype.populateDataOnStart=function(){Z.prototype.populateDataOnStart.call(this)};F.prototype.oRequests={};F.prototype.defaultResponse=
function(a,b,d,i,l,m){var p=function(){f.StorageResultType.Success!==d&&k.bUnload&&(d=f.StorageResultType.Unload);if(f.StorageResultType.Success===d&&i&&!i.Result){if(i&&-1<c.inArray(i.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++,i&&f.Notification.InvalidToken===i.ErrorCode&&
k.iTokenErrorCount++,10<k.iTokenErrorCount&&e.loginAndLogoutReload(!0),i.Logout||7<k.iAjaxErrorCount)g.__rlah_clear&&g.__rlah_clear(),e.loginAndLogoutReload(!0)}else f.StorageResultType.Success===d&&(i&&i.Result)&&(k.iAjaxErrorCount=0,k.iTokenErrorCount=0);a&&(o.runHook("ajax-default-response",[b,f.StorageResultType.Success===d?i:null,d,l,m]),a(d,f.StorageResultType.Success===d?i: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?j.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&&j.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=i.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,g){this.defaultRequest(a,"JsError",{Message:b,FileName:c,LineNo:d,Location:e,HtmlCapa:f,TimeOnPage:g})};j.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},6E4)};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,m,n){this.defaultRequest(a,
"AdminDomainSave",{Create:b?"1":"0",Name:c,IncHost:d,IncPort:e,IncSecure:f,IncShortLogin:g?"1":"0",OutHost:i,OutPort:j,OutSecure:k,OutShortLogin:l?"1":"0",OutAuth:m?"1":"0",WhiteList:n})};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};j.extend(ja.prototype,D.prototype);j.extend(G.prototype,w.prototype);G.prototype.onRoute=function(a){var b=this,f=null,g=null,k=null,l=null;if(g=j.find(A.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}))j.find(A["settings-removed"],function(a){return a&&a===g})&&(g=null),g&&j.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=i("<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.__rlSettingsData=g.__rlSettingsData,g.__dom=l,g.__builded=!0,g.__vm=f,d.applyBindings(f,l[0]),q.delegateRun(f,"onBuild",[l])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),f&&j.defer(function(){if(b.oCurrentSubScreen){q.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide()}b.oCurrentSubScreen=f;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();
q.delegateRun(b.oCurrentSubScreen,"onShow");j.each(b.menu(),function(a){a.selected(f&&f.__rlSettingsData&&a.route===f.__rlSettingsData.Route)});i("#rl-content .b-settings .b-content .content").scrollTop(0)}c.windowResize()})):q.setHash(e.link().settings(),!1,!0)};G.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(q.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())};G.prototype.onBuild=function(){j.each(A.settings,function(a){a&&
(a.__rlSettingsData&&!j.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:!!j.find(A["settings-disabled"],function(b){return b&&b===a})})},this);this.oViewModelPlace=i("#rl-content #rl-settings-subscreen")};G.prototype.routes=function(){var a=j.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]]};j.extend(ba.prototype,w.prototype);ba.prototype.onShow=function(){e.setTitle("")};j.extend(ca.prototype,G.prototype);ca.prototype.onShow=function(){e.setTitle("")};j.extend(u.prototype,ga.prototype);u.prototype.oSettings=null;u.prototype.oLink=null;u.prototype.download=function(a){var b=null,c=null;if((b=navigator.userAgent.toLowerCase())&&(-1<b.indexOf("chrome")||
-1<b.indexOf("chrome")))if(b=document.createElement("a"),b.href=a,document.createEvent&&(c=document.createEvent("MouseEvents"))&&c.initEvent&&b.dispatchEvent)return c.initEvent("click",!0,!0),b.dispatchEvent(c),!0;k.bMobileDevice?(g.open(a,"_self"),g.focus()):this.iframe.attr("src",a);return!0};u.prototype.link=function(){null===this.oLink&&(this.oLink=new p);return this.oLink};u.prototype.local=function(){null===this.oLocal&&(this.oLocal=new P);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?j.delay(function(){f&&g.parent?g.parent.location.href=d:g.location.href=d},100):(q.routeOff(),q.setHash(e.link().root(),!0),q.routeOff(),j.delay(function(){f&&g.parent?g.parent.location.reload():g.location.reload()},100))};u.prototype.getAutocomplete=function(a,b,c){c([],a)};u.prototype.bootstart=function(){c.initOnStartOrLangChange(function(){c.initNotificationLanguage()},null);j.delay(function(){c.windowResize()},
1E3)};j.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=j.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=j.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=[],i={};j.each(e.data().packages(),function(a){a&&a.loading()&&(i[a.file]=a)});c.isArray(b.Result.List)&&(g=j.compact(j.map(b.Result.List,function(a){return a?(a.loading=
d.observable(!c.isUnd(i[a.file])),"core"===a.type&&!a.canBeInstalled?null:a):null})));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();q.hideLoading();this.settingsGet("AllowAdminPanel")?
this.settingsGet("Auth")?(q.startScreens([ca]),k.bMobileDevice||j.defer(function(){c.initLayoutResizer("#rl-top-resizer-left","#rl-top-resizer-right","#rl-center",120,300,200,600,f.ClientSideKeyName.FolderListSize)})):q.startScreens([ba]):(q.routeOff(),q.setHash(e.link().root(),!0),q.routeOff(),j.defer(function(){g.location.href="/"}));g.SimplePace&&g.SimplePace.set(100)};e=new v;I.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){i(function(){g.rainloopTEMPLATES&&g.rainloopTEMPLATES[0]?(i("#rl-templates").html(g.rainloopTEMPLATES[0]),g.setInterval(function(){k.minuteTick(!k.minuteTick())},6E4),g.setInterval(function(){k.fiveMinuteTick(!k.fiveMinuteTick())},
3E5),j.delay(function(){g.rainloopAppData={};g.rainloopI18N={};g.rainloopTEMPLATES={};q.setBoot(e).bootstart();I.addClass("rl-started")},50)):a(!1);g.__RLBOOT=null})};g.SimplePace&&g.SimplePace.add(10)})(window,jQuery,ko,crossroads,hasher,_);