mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-07 13:44:13 +08:00
5 lines
No EOL
110 KiB
JavaScript
5 lines
No EOL
110 KiB
JavaScript
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
!function(a,b,c,d,e,f){"use strict";function g(){this.sBase="#/",this.sVersion=ib.settingsGet("Version"),this.sSpecSuffix=ib.settingsGet("AuthAccountHash")||"0",this.sServer=(ib.settingsGet("IndexFile")||"./")+"?"}function h(){}function i(){}function j(){var a=[i,h],b=f.find(a,function(a){return a.supported()});b&&(b=b,this.oDriver=new b)}function k(){}function l(a,b){this.bDisabeCloseOnEsc=!1,this.sPosition=X.pString(a),this.sTemplate=X.pString(b),this.sDefaultKeyScope=V.KeyState.None,this.sCurrentKeyScope=this.sDefaultKeyScope,this.viewModelName="",this.viewModelVisibility=c.observable(!1),this.modalVisibility=c.observable(!1).extend({rateLimit:0}),this.viewModelDom=null}function m(a,b){this.sScreenName=a,this.aViewModels=X.isArray(b)?b:[]}function n(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null}function o(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function p(){this.idContactTag=0,this.name=c.observable(""),this.readOnly=!1}function q(){l.call(this,"Popups","PopupsDomain"),this.edit=c.observable(!1),this.saving=c.observable(!1),this.savingError=c.observable(""),this.whiteListPage=c.observable(!1),this.testing=c.observable(!1),this.testingDone=c.observable(!1),this.testingImapError=c.observable(!1),this.testingSmtpError=c.observable(!1),this.testingImapErrorDesc=c.observable(""),this.testingSmtpErrorDesc=c.observable(""),this.testingImapError.subscribe(function(a){a||this.testingImapErrorDesc("")},this),this.testingSmtpError.subscribe(function(a){a||this.testingSmtpErrorDesc("")},this),this.testingImapErrorDesc=c.observable(""),this.testingSmtpErrorDesc=c.observable(""),this.imapServerFocus=c.observable(!1),this.smtpServerFocus=c.observable(!1),this.name=c.observable(""),this.name.focused=c.observable(!1),this.imapServer=c.observable(""),this.imapPort=c.observable(U.Values.ImapDefaulPort),this.imapSecure=c.observable(V.ServerSecure.None),this.imapShortLogin=c.observable(!1),this.smtpServer=c.observable(""),this.smtpPort=c.observable(U.Values.SmtpDefaulPort),this.smtpSecure=c.observable(V.ServerSecure.None),this.smtpShortLogin=c.observable(!1),this.smtpAuth=c.observable(!0),this.whiteList=c.observable(""),this.headerText=c.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this),this.domainIsComputed=c.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this),this.canBeTested=c.computed(function(){return!this.testing()&&this.domainIsComputed()},this),this.canBeSaved=c.computed(function(){return!this.saving()&&this.domainIsComputed()},this),this.createOrAddCommand=X.createCommand(this,function(){this.saving(!0),ib.remote().createOrUpdateDomain(f.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.imapShortLogin(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpShortLogin(),this.smtpAuth(),this.whiteList())},this.canBeSaved),this.testConnectionCommand=X.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),ib.remote().testConnectionForDomain(f.bind(this.onTestConnectionResponse,this),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=X.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())}),this.imapServerFocus.subscribe(function(a){a&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name().replace(/[.]?[*][.]?/g,""))},this),this.smtpServerFocus.subscribe(function(a){a&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer().replace(/imap/gi,"smtp"))},this),this.imapSecure.subscribe(function(a){var b=X.pInt(this.imapPort());switch(a=X.pString(a)){case"0":993===b&&this.imapPort(143);break;case"1":143===b&&this.imapPort(993)}},this),this.smtpSecure.subscribe(function(a){var b=X.pInt(this.smtpPort());switch(a=X.pString(a)){case"0":(465===b||587===b)&&this.smtpPort(25);break;case"1":(25===b||587===b)&&this.smtpPort(465);break;case"2":(25===b||465===b)&&this.smtpPort(587)}},this),n.constructorEnd(this)}function r(){l.call(this,"Popups","PopupsPlugin");var a=this;this.onPluginSettingsUpdateResponse=f.bind(this.onPluginSettingsUpdateResponse,this),this.saveError=c.observable(""),this.name=c.observable(""),this.readme=c.observable(""),this.configures=c.observableArray([]),this.hasReadme=c.computed(function(){return""!==this.readme()},this),this.hasConfiguration=c.computed(function(){return 0<this.configures().length},this),this.readmePopoverConf={placement:"top",trigger:"hover",title:"About",content:function(){return a.readme()}},this.saveCommand=X.createCommand(this,function(){var a={};a.Name=this.name(),f.each(this.configures(),function(b){var c=b.value();(!1===c||!0===c)&&(c=c?"1":"0"),a["_"+b.Name]=c},this),this.saveError(""),ib.remote().pluginSettingsUpdate(this.onPluginSettingsUpdateResponse,a)},this.hasConfiguration),this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=V.KeyState.All,n.constructorEnd(this)}function s(){l.call(this,"Popups","PopupsActivate");var a=this;this.domain=c.observable(""),this.key=c.observable(""),this.key.focus=c.observable(!1),this.activationSuccessed=c.observable(!1),this.licenseTrigger=ib.data().licenseTrigger,this.activateProcess=c.observable(!1),this.activateText=c.observable(""),this.activateText.isError=c.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=X.createCommand(this,function(){this.activateProcess(!0),this.validateSubscriptionKey()?ib.remote().licensingActivate(function(b,c){a.activateProcess(!1),V.StorageResultType.Success===b&&c.Result?!0===c.Result?(a.activationSuccessed(!0),a.activateText("Subscription Key Activated Successfully"),a.activateText.isError(!1)):(a.activateText(c.Result),a.activateText.isError(!0),a.key.focus(!0)):c.ErrorCode?(a.activateText(X.getNotification(c.ErrorCode)),a.activateText.isError(!0),a.key.focus(!0)):(a.activateText(X.getNotification(V.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()}),n.constructorEnd(this)}function t(){l.call(this,"Popups","PopupsLanguages"),this.exp=c.observable(!1),this.languages=c.computed(function(){return f.map(ib.data().languages(),function(a){return{key:a,selected:c.observable(!1),fullName:X.convertLangName(a)}})}),ib.data().mainLanguage.subscribe(function(){this.resetMainLanguage()},this),n.constructorEnd(this)}function u(){l.call(this,"Popups","PopupsAsk"),this.askDesc=c.observable(""),this.yesButton=c.observable(""),this.noButton=c.observable(""),this.yesFocus=c.observable(!1),this.noFocus=c.observable(!1),this.fYesAction=null,this.fNoAction=null,this.bDisabeCloseOnEsc=!0,this.sDefaultKeyScope=V.KeyState.PopupAsk,n.constructorEnd(this)}function v(){l.call(this,"Center","AdminLogin"),this.login=c.observable(""),this.password=c.observable(""),this.loginError=c.observable(!1),this.passwordError=c.observable(!1),this.loginFocus=c.observable(!1),this.login.subscribe(function(){this.loginError(!1)},this),this.password.subscribe(function(){this.passwordError(!1)},this),this.submitRequest=c.observable(!1),this.submitError=c.observable(""),this.submitCommand=X.createCommand(this,function(){return this.loginError(""===X.trim(this.login())),this.passwordError(""===X.trim(this.password())),this.loginError()||this.passwordError()?!1:(this.submitRequest(!0),ib.remote().adminLogin(f.bind(function(a,b){V.StorageResultType.Success===a&&b&&"AdminLogin"===b.Action?b.Result?ib.loginAndLogoutReload():b.ErrorCode&&(this.submitRequest(!1),this.submitError(X.getNotification(b.ErrorCode))):(this.submitRequest(!1),this.submitError(X.getNotification(V.Notification.UnknownError)))},this),this.login(),this.password()),!0)},function(){return!this.submitRequest()}),n.constructorEnd(this)}function w(a){l.call(this,"Left","AdminMenu"),this.leftPanelDisabled=ib.data().leftPanelDisabled,this.menu=a.menu,n.constructorEnd(this)}function x(){l.call(this,"Right","AdminPane"),this.adminDomain=c.observable(ib.settingsGet("AdminDomain")),this.version=c.observable(ib.settingsGet("Version")),this.adminManLoadingVisibility=ib.data().adminManLoadingVisibility,n.constructorEnd(this)}function y(){var a=ib.data();this.mainLanguage=a.mainLanguage,this.mainTheme=a.mainTheme,this.language=a.language,this.theme=a.theme,this.allowLanguagesOnSettings=a.allowLanguagesOnSettings,this.capaThemes=a.capaThemes,this.capaGravatar=a.capaGravatar,this.capaAdditionalAccounts=a.capaAdditionalAccounts,this.capaAdditionalIdentities=a.capaAdditionalIdentities,this.themesOptions=c.computed(function(){return f.map(a.themes(),function(a){return{optValue:a,optText:X.convertThemeName(a)}})}),this.mainLanguageFullName=c.computed(function(){return X.convertLangName(this.mainLanguage())},this),this.weakPassword=!!ib.settingsGet("WeakPassword"),this.languageTrigger=c.observable(V.SaveSettingsStep.Idle),this.themeTrigger=c.observable(V.SaveSettingsStep.Idle)}function z(){var a=ib.data();this.allowCustomLogin=a.allowCustomLogin,this.determineUserLanguage=a.determineUserLanguage,this.defaultDomain=c.observable(ib.settingsGet("LoginDefaultDomain")),this.allowLanguagesOnLogin=a.allowLanguagesOnLogin,this.defaultDomainTrigger=c.observable(V.SaveSettingsStep.Idle)}function A(){this.title=c.observable(ib.settingsGet("Title")),this.title.trigger=c.observable(V.SaveSettingsStep.Idle),this.loadingDesc=c.observable(ib.settingsGet("LoadingDescription")),this.loadingDesc.trigger=c.observable(V.SaveSettingsStep.Idle),this.loginLogo=c.observable(ib.settingsGet("LoginLogo")),this.loginLogo.trigger=c.observable(V.SaveSettingsStep.Idle),this.loginDescription=c.observable(ib.settingsGet("LoginDescription")),this.loginDescription.trigger=c.observable(V.SaveSettingsStep.Idle),this.loginCss=c.observable(ib.settingsGet("LoginCss")),this.loginCss.trigger=c.observable(V.SaveSettingsStep.Idle)}function B(){this.defautOptionsAfterRender=X.defautOptionsAfterRender,this.enableContacts=c.observable(!!ib.settingsGet("ContactsEnable")),this.contactsSharing=c.observable(!!ib.settingsGet("ContactsSharing")),this.contactsSync=c.observable(!!ib.settingsGet("ContactsSync"));var a=["sqlite","mysql","pgsql"],b=[],d=function(a){switch(a){case"sqlite":a="SQLite";break;case"mysql":a="MySQL";break;case"pgsql":a="PostgreSQL"}return a};ib.settingsGet("SQLiteIsSupported")&&b.push("sqlite"),ib.settingsGet("MySqlIsSupported")&&b.push("mysql"),ib.settingsGet("PostgreSqlIsSupported")&&b.push("pgsql"),this.contactsSupported=0<b.length,this.contactsTypes=c.observableArray([]),this.contactsTypesOptions=this.contactsTypes.map(function(a){var c=-1===X.inArray(a,b);return{id:a,name:d(a)+(c?" (not supported)":""),disabled:c}}),this.contactsTypes(a),this.contactsType=c.observable(""),this.mainContactsType=c.computed({owner:this,read:this.contactsType,write:function(a){a!==this.contactsType()?-1<X.inArray(a,b)?this.contactsType(a):0<b.length&&this.contactsType(""):this.contactsType.valueHasMutated()}}),this.contactsType.subscribe(function(){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage("")},this),this.pdoDsn=c.observable(ib.settingsGet("ContactsPdoDsn")),this.pdoUser=c.observable(ib.settingsGet("ContactsPdoUser")),this.pdoPassword=c.observable(ib.settingsGet("ContactsPdoPassword")),this.pdoDsnTrigger=c.observable(V.SaveSettingsStep.Idle),this.pdoUserTrigger=c.observable(V.SaveSettingsStep.Idle),this.pdoPasswordTrigger=c.observable(V.SaveSettingsStep.Idle),this.contactsTypeTrigger=c.observable(V.SaveSettingsStep.Idle),this.testing=c.observable(!1),this.testContactsSuccess=c.observable(!1),this.testContactsError=c.observable(!1),this.testContactsErrorMessage=c.observable(""),this.testContactsCommand=X.createCommand(this,function(){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage(""),this.testing(!0),ib.remote().testContacts(this.onTestContactsResponse,{ContactsPdoType:this.contactsType(),ContactsPdoDsn:this.pdoDsn(),ContactsPdoUser:this.pdoUser(),ContactsPdoPassword:this.pdoPassword()})},function(){return""!==this.pdoDsn()&&""!==this.pdoUser()}),this.contactsType(ib.settingsGet("ContactsPdoType")),this.onTestContactsResponse=f.bind(this.onTestContactsResponse,this)}function C(){var a=ib.data();this.domains=a.domains,this.domainsLoading=a.domainsLoading,this.iDomainForDeletionTimeout=0,this.visibility=c.computed(function(){return a.domainsLoading()?"visible":"hidden"},this),this.domainForDeletion=c.observable(null).extend({toggleSubscribe:[this,function(a){a&&a.deleteAccess(!1)},function(a){a&&(a.deleteAccess(!0),this.startDomainForDeletionTimeout())}]})}function D(){this.csrfProtection=c.observable(!!ib.settingsGet("UseTokenProtection")),this.capaOpenPGP=c.observable(ib.capa(V.Capa.OpenPGP)),this.capaTwoFactorAuth=c.observable(ib.capa(V.Capa.TwoFactor)),this.adminLogin=c.observable(ib.settingsGet("AdminLogin")),this.adminPassword=c.observable(""),this.adminPasswordNew=c.observable(""),this.adminPasswordNew2=c.observable(""),this.adminPasswordNewError=c.observable(!1),this.adminPasswordUpdateError=c.observable(!1),this.adminPasswordUpdateSuccess=c.observable(!1),this.adminPassword.subscribe(function(){this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1)},this),this.adminPasswordNew.subscribe(function(){this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1),this.adminPasswordNewError(!1)},this),this.adminPasswordNew2.subscribe(function(){this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1),this.adminPasswordNewError(!1)},this),this.saveNewAdminPasswordCommand=X.createCommand(this,function(){return this.adminPasswordNew()!==this.adminPasswordNew2()?(this.adminPasswordNewError(!0),!1):(this.adminPasswordUpdateError(!1),this.adminPasswordUpdateSuccess(!1),void ib.remote().saveNewAdminPassword(this.onNewAdminPasswordResponse,{Password:this.adminPassword(),NewPassword:this.adminPasswordNew()}))},function(){return""!==this.adminPassword()&&""!==this.adminPasswordNew()&&""!==this.adminPasswordNew2()}),this.onNewAdminPasswordResponse=f.bind(this.onNewAdminPasswordResponse,this)}function E(){var a=ib.data();this.googleEnable=a.googleEnable,this.googleClientID=a.googleClientID,this.googleClientSecret=a.googleClientSecret,this.googleTrigger1=c.observable(V.SaveSettingsStep.Idle),this.googleTrigger2=c.observable(V.SaveSettingsStep.Idle),this.facebookEnable=a.facebookEnable,this.facebookAppID=a.facebookAppID,this.facebookAppSecret=a.facebookAppSecret,this.facebookTrigger1=c.observable(V.SaveSettingsStep.Idle),this.facebookTrigger2=c.observable(V.SaveSettingsStep.Idle),this.twitterEnable=a.twitterEnable,this.twitterConsumerKey=a.twitterConsumerKey,this.twitterConsumerSecret=a.twitterConsumerSecret,this.twitterTrigger1=c.observable(V.SaveSettingsStep.Idle),this.twitterTrigger2=c.observable(V.SaveSettingsStep.Idle),this.dropboxEnable=a.dropboxEnable,this.dropboxApiKey=a.dropboxApiKey,this.dropboxTrigger1=c.observable(V.SaveSettingsStep.Idle)}function F(){var a=ib.data();this.enabledPlugins=c.observable(!!ib.settingsGet("EnabledPlugins")),this.pluginsError=c.observable(""),this.plugins=a.plugins,this.pluginsLoading=a.pluginsLoading,this.visibility=c.computed(function(){return a.pluginsLoading()?"visible":"hidden"},this),this.onPluginLoadRequest=f.bind(this.onPluginLoadRequest,this),this.onPluginDisableRequest=f.bind(this.onPluginDisableRequest,this)}function G(){var a=ib.data();this.packagesError=c.observable(""),this.packages=a.packages,this.packagesLoading=a.packagesLoading,this.packagesReal=a.packagesReal,this.packagesMainUpdatable=a.packagesMainUpdatable,this.packagesCurrent=this.packages.filter(function(a){return a&&""!==a.installed&&!a.compare}),this.packagesAvailableForUpdate=this.packages.filter(function(a){return a&&""!==a.installed&&!!a.compare}),this.packagesAvailableForInstallation=this.packages.filter(function(a){return a&&""===a.installed}),this.visibility=c.computed(function(){return a.packagesLoading()?"visible":"hidden"},this)}function H(){this.licensing=ib.data().licensing,this.licensingProcess=ib.data().licensingProcess,this.licenseValid=ib.data().licenseValid,this.licenseExpired=ib.data().licenseExpired,this.licenseError=ib.data().licenseError,this.licenseTrigger=ib.data().licenseTrigger,this.adminDomain=c.observable(""),this.subscriptionEnabled=c.observable(!!ib.settingsGet("SubscriptionEnabled")),this.licenseTrigger.subscribe(function(){this.subscriptionEnabled()&&ib.reloadLicensing(!0)},this)}function I(){this.version=c.observable(ib.settingsGet("Version"))}function J(){this.leftPanelDisabled=c.observable(!1),this.useKeyboardShortcuts=c.observable(!0),this.keyScopeReal=c.observable(V.KeyState.All),this.keyScopeFake=c.observable(V.KeyState.All),this.keyScope=c.computed({owner:this,read:function(){return this.keyScopeFake()},write:function(a){V.KeyState.Menu!==a&&(V.KeyState.Compose===a?X.disableKeyFilter():X.restoreKeyFilter(),this.keyScopeFake(a),$.dropdownVisibility()&&(a=V.KeyState.Menu)),this.keyScopeReal(a)}}),this.keyScopeReal.subscribe(function(a){key.setScope(a)}),this.leftPanelDisabled.subscribe(function(a){ib.pub("left-panel."+(a?"off":"on"))}),$.dropdownVisibility.subscribe(function(a){a?this.keyScope(V.KeyState.Menu):V.KeyState.Menu===key.getScope()&&this.keyScope(this.keyScopeFake())},this),X.initDataConstructorBySettings(this)}function K(){J.call(this),this.domainsLoading=c.observable(!1).extend({throttle:100}),this.domains=c.observableArray([]),this.pluginsLoading=c.observable(!1).extend({throttle:100}),this.plugins=c.observableArray([]),this.packagesReal=c.observable(!0),this.packagesMainUpdatable=c.observable(!0),this.packagesLoading=c.observable(!1).extend({throttle:100}),this.packages=c.observableArray([]),this.licensing=c.observable(!1),this.licensingProcess=c.observable(!1),this.licenseValid=c.observable(!1),this.licenseExpired=c.observable(0),this.licenseError=c.observable(""),this.licenseTrigger=c.observable(!1),this.adminManLoading=c.computed(function(){return"000"!==[this.domainsLoading()?"1":"0",this.pluginsLoading()?"1":"0",this.packagesLoading()?"1":"0"].join("")},this),this.adminManLoadingVisibility=c.computed(function(){return this.adminManLoading()?"visible":"hidden"},this).extend({rateLimit:300})}function L(){this.oRequests={}}function M(){L.call(this),this.oRequests={}}function N(){this.oEmailsPicsHashes={},this.oServices={},this.bCapaGravatar=ib.capa(V.Capa.Gravatar)}function O(){N.call(this)}function P(a){m.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function Q(){m.call(this,"login",[v])}function R(){P.call(this,[w,x])}function S(){k.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibilityNames=c.observableArray([]),this.popupVisibility=c.computed(function(){return 0<this.popupVisibilityNames().length},this),this.iframe=b('<iframe style="display:none" src="javascript:;" />').appendTo("body"),fb.on("error",function(a){ib&&a&&a.originalEvent&&a.originalEvent.message&&-1===X.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&ib.remote().jsError(X.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",eb.attr("class"),X.microtime()-$.now)}),gb.on("keydown",function(a){a&&a.ctrlKey&&eb.addClass("rl-ctrl-key-pressed")}).on("keyup",function(a){a&&!a.ctrlKey&&eb.removeClass("rl-ctrl-key-pressed")})}function T(){S.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var U={},V={},W={},X={},Y={},Z={},$={},_={settings:[],"settings-removed":[],"settings-disabled":[]},ab=[],bb=null,cb=a.rainloopAppData||{},db=a.rainloopI18N||{},eb=b("html"),fb=b(a),gb=b(a.document),hb=a.Notification&&a.Notification.requestPermission?a.Notification:null,ib=null;$.now=(new Date).getTime(),$.momentTrigger=c.observable(!0),$.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),$.langChangeTrigger=c.observable(!0),$.iAjaxErrorCount=0,$.iTokenErrorCount=0,$.iMessageBodyCacheCount=0,$.bUnload=!1,$.sUserAgent=(navigator.userAgent||"").toLowerCase(),$.bIsiOSDevice=-1<$.sUserAgent.indexOf("iphone")||-1<$.sUserAgent.indexOf("ipod")||-1<$.sUserAgent.indexOf("ipad"),$.bIsAndroidDevice=-1<$.sUserAgent.indexOf("android"),$.bMobileDevice=$.bIsiOSDevice||$.bIsAndroidDevice,$.bDisableNanoScroll=$.bMobileDevice,$.bAllowPdfPreview=!$.bMobileDevice,$.bAnimationSupported=!$.bMobileDevice&&eb.hasClass("csstransitions"),$.sAnimationType="",$.oHtmlEditorDefaultConfig={title:!1,stylesSet:!1,customConfig:"",contentsCss:"",toolbarGroups:[{name:"spec"},{name:"styles"},{name:"basicstyles",groups:["basicstyles","cleanup"]},{name:"colors"},{name:"paragraph",groups:["list","indent","blocks","align"]},{name:"links"},{name:"insert"},{name:"others"}],removePlugins:"contextmenu",removeButtons:"Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll",removeDialogTabs:"link:advanced;link:target;image:advanced",extraPlugins:"plain",allowedContent:!0,autoParagraph:!1,enterMode:a.CKEDITOR.ENTER_BR,shiftEnterMode:a.CKEDITOR.ENTER_BR,font_defaultLabel:"Arial",fontSize_defaultLabel:"13",fontSize_sizes:"10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px"},$.oHtmlEditorLangsMap={de:"de",es:"es",fr:"fr",hu:"hu",is:"is",it:"it",ko:"ko","ko-kr":"ko",lv:"lv",nl:"nl",no:"no",pl:"pl",pt:"pt","pt-pt":"pt","pt-br":"pt-br",ru:"ru",ro:"ro",zh:"zh","zh-cn":"zh-cn"},$.bAllowPdfPreview&&navigator&&navigator.mimeTypes&&($.bAllowPdfPreview=!!f.find(navigator.mimeTypes,function(a){return a&&"application/pdf"===a.type})),U.Defaults={},U.Values={},U.DataImages={},U.Defaults.MessagesPerPage=20,U.Defaults.ContactsPerPage=50,U.Defaults.MessagesPerPageArray=[10,20,30,50,100],U.Defaults.DefaultAjaxTimeout=3e4,U.Defaults.SearchAjaxTimeout=3e5,U.Defaults.SendMessageAjaxTimeout=3e5,U.Defaults.SaveMessageAjaxTimeout=2e5,U.Defaults.ContactsSyncAjaxTimeout=2e5,U.Values.UnuseOptionValue="__UNUSE__",U.Values.ClientSideCookieIndexName="rlcsc",U.Values.ImapDefaulPort=143,U.Values.ImapDefaulSecurePort=993,U.Values.SmtpDefaulPort=25,U.Values.SmtpDefaulSecurePort=465,U.Values.MessageBodyCacheLimit=15,U.Values.AjaxErrorLimit=7,U.Values.TokenErrorLimit=10,U.DataImages.UserDotPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=",U.DataImages.TranspPic="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=",V.StorageResultType={Success:"success",Abort:"abort",Error:"error",Unload:"unload"},V.State={Empty:10,Login:20,Auth:30},V.StateType={Webmail:0,Admin:1},V.Capa={Prem:"PREM",TwoFactor:"TWO_FACTOR",OpenPGP:"OPEN_PGP",Prefetch:"PREFETCH",Gravatar:"GRAVATAR",Themes:"THEMES",AdditionalAccounts:"ADDITIONAL_ACCOUNTS",AdditionalIdentities:"ADDITIONAL_IDENTITIES"},V.KeyState={All:"all",None:"none",ContactList:"contact-list",MessageList:"message-list",FolderList:"folder-list",MessageView:"message-view",Compose:"compose",Settings:"settings",Menu:"menu",PopupComposeOpenPGP:"compose-open-pgp",PopupKeyboardShortcutsHelp:"popup-keyboard-shortcuts-help",PopupAsk:"popup-ask"},V.FolderType={Inbox:10,SentItems:11,Draft:12,Trash:13,Spam:14,Archive:15,NotSpam:80,User:99},V.LoginSignMeTypeAsString={DefaultOff:"defaultoff",DefaultOn:"defaulton",Unused:"unused"},V.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unused:2},V.ComposeType={Empty:"empty",Reply:"reply",ReplyAll:"replyall",Forward:"forward",ForwardAsAttachment:"forward-as-attachment",Draft:"draft",EditAsNew:"editasnew"},V.UploadErrorCode={Normal:0,FileIsTooBig:1,FilePartiallyUploaded:2,FileNoUploaded:3,MissingTempFolder:4,FileOnSaveingError:5,FileType:98,Unknown:99},V.SetSystemFoldersNotification={None:0,Sent:1,Draft:2,Spam:3,Trash:4,Archive:5},V.ClientSideKeyName={FoldersLashHash:0,MessagesInboxLastHash:1,MailBoxListSize:2,ExpandedFolders:3,FolderListSize:4},V.EventKeyCode={Backspace:8,Tab:9,Enter:13,Esc:27,PageUp:33,PageDown:34,Left:37,Right:39,Up:38,Down:40,End:35,Home:36,Space:32,Insert:45,Delete:46,A:65,S:83},V.MessageSetAction={SetSeen:0,UnsetSeen:1,SetFlag:2,UnsetFlag:3},V.MessageSelectAction={All:0,None:1,Invert:2,Unseen:3,Seen:4,Flagged:5,Unflagged:6},V.DesktopNotifications={Allowed:0,NotAllowed:1,Denied:2,NotSupported:9},V.MessagePriority={Low:5,Normal:3,High:1},V.EditorDefaultType={Html:"Html",Plain:"Plain"},V.CustomThemeType={Light:"Light",Dark:"Dark"},V.ServerSecure={None:0,SSL:1,TLS:2},V.SearchDateType={All:-1,Days3:3,Days7:7,Month:30},V.EmailType={Defailt:0,Facebook:1,Google:2},V.SaveSettingsStep={Animate:-2,Idle:-1,TrueResult:1,FalseResult:0},V.InterfaceAnimation={None:"None",Normal:"Normal",Full:"Full"},V.Layout={NoPreview:0,SidePreview:1,BottomPreview:2},V.SignedVerifyStatus={UnknownPublicKeys:-4,UnknownPrivateKey:-3,Unverified:-2,Error:-1,None:0,Success:1},V.ContactPropertyType={Unknown:0,FullName:10,FirstName:15,LastName:16,MiddleName:16,Nick:18,NamePrefix:20,NameSuffix:21,Email:30,Phone:31,Web:32,Birthday:40,Facebook:90,Skype:91,GitHub:92,Note:110,Custom:250},V.Notification={InvalidToken:101,AuthError:102,AccessError:103,ConnectionError:104,CaptchaError:105,SocialFacebookLoginAccessDisable:106,SocialTwitterLoginAccessDisable:107,SocialGoogleLoginAccessDisable:108,DomainNotAllowed:109,AccountNotAllowed:110,AccountTwoFactorAuthRequired:120,AccountTwoFactorAuthError:121,CouldNotSaveNewPassword:130,CurrentPasswordIncorrect:131,NewPasswordShort:132,NewPasswordWeak:133,NewPasswordForbidden:134,ContactsSyncError:140,CantGetMessageList:201,CantGetMessage:202,CantDeleteMessage:203,CantMoveMessage:204,CantCopyMessage:205,CantSaveMessage:301,CantSendMessage:302,InvalidRecipients:303,CantCreateFolder:400,CantRenameFolder:401,CantDeleteFolder:402,CantSubscribeFolder:403,CantUnsubscribeFolder:404,CantDeleteNonEmptyFolder:405,CantSaveSettings:501,CantSavePluginSettings:502,DomainAlreadyExists:601,CantInstallPackage:701,CantDeletePackage:702,InvalidPluginPackage:703,UnsupportedPluginPackage:704,LicensingServerIsUnavailable:710,LicensingExpired:711,LicensingBanned:712,DemoSendMessageError:750,AccountAlreadyExists:801,MailServerError:901,ClientViewError:902,UnknownNotification:999,UnknownError:999},X.trim=b.trim,X.inArray=b.inArray,X.isArray=f.isArray,X.isFunc=f.isFunction,X.isUnd=f.isUndefined,X.isNull=f.isNull,X.emptyFunction=function(){},X.isNormal=function(a){return!X.isUnd(a)&&!X.isNull(a)},X.windowResize=f.debounce(function(b){X.isUnd(b)?fb.resize():a.setTimeout(function(){fb.resize()},b)},50),X.isPosNumeric=function(a,b){return X.isNormal(a)?(X.isUnd(b)?0:!b)?/^[1-9]+[0-9]*$/.test(a.toString()):/^[0-9]*$/.test(a.toString()):!1},X.pInt=function(b){return X.isNormal(b)&&""!==b?a.parseInt(b,10):0},X.pString=function(a){return X.isNormal(a)?""+a:""},X.isNonEmptyArray=function(a){return X.isArray(a)&&0<a.length},X.exportPath=function(b,c,d){for(var e=null,f=b.split("."),g=d||a;f.length&&(e=f.shift());)f.length||X.isUnd(c)?g=g[e]?g[e]:g[e]={}:g[e]=c},X.pImport=function(a,b,c){a[b]=c},X.pExport=function(a,b,c){return X.isUnd(a[b])?c:a[b]},X.encodeHtml=function(a){return X.isNormal(a)?a.toString().replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"):""},X.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=X.isUnd(b)?100:b;e.length>b;)d=e.substring(0,b),f=d.lastIndexOf(" "),g=d.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),c+=d.substring(0,f)+"\n",e=e.substring(f+1);return c+e},X.timeOutAction=function(){var b={};return function(c,d,e){X.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),X.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),X.audio=function(){var b=!1;return function(c,d){if(!1===b)if($.bIsiOSDevice)b=null;else{var e=!1,f=!1,g=a.Audio?new a.Audio:null;g&&g.canPlayType&&g.play?(e=""!==g.canPlayType('audio/mpeg; codecs="mp3"'),e||(f=""!==g.canPlayType('audio/ogg; codecs="vorbis"')),e||f?(b=g,b.preload="none",b.loop=!1,b.autoplay=!1,b.muted=!1,b.src=e?c:d):b=null):b=null}return b}}(),X.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},X.i18n=function(a,b,c){var d="",e=X.isUnd(db[a])?X.isUnd(c)?a:c:db[a];if(!X.isUnd(b)&&!X.isNull(b))for(d in b)X.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},X.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(X.i18n(c)):(c=a.data("i18n-html"),c&&a.html(X.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",X.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",X.i18n(c)))})})},X.i18nToDoc=function(){a.rainloopI18N&&(db=a.rainloopI18N||{},X.i18nToNode(gb),$.langChangeTrigger(!$.langChangeTrigger())),a.rainloopI18N={}},X.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?$.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&$.langChangeTrigger.subscribe(a,b)},X.inFocus=function(){return document.activeElement?(X.isUnd(document.activeElement.__inFocusCache)&&(document.activeElement.__inFocusCache=b(document.activeElement).is("input,textarea,iframe,.cke_editable")),!!document.activeElement.__inFocusCache):!1},X.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);a.is("input,textarea")&&document.activeElement.blur()}},X.removeSelection=function(){if(a&&a.getSelection){var b=a.getSelection();b&&b.removeAllRanges&&b.removeAllRanges()}else document&&document.selection&&document.selection.empty&&document.selection.empty()},X.replySubjectAdd=function(b,c,d){var e=null,f=X.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||X.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||X.isUnd(e[1])||X.isUnd(e[2])||X.isUnd(e[3])?b+": "+c:e[1]+(X.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(X.isUnd(d)?!0:d)?X.fixLongSubject(f):f},X.fixLongSubject=function(a){var b=0,c=null;a=X.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||X.isUnd(c[0]))&&(c=null),c&&(b=0,b+=X.isUnd(c[2])?1:0+X.pInt(c[2]),b+=X.isUnd(c[4])?1:0+X.pInt(c[4]),a=a.replace(/^Re(\[[\d]+\]|):[\s]{0,3}Re(\[[\d]+\]|):/gi,"Re"+(b>0?"["+b+"]":"")+":"));while(c);return a=a.replace(/[\s]+/," ")},X.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},X.friendlySize=function(a){return a=X.pInt(a),a>=1073741824?X.roundNumber(a/1073741824,1)+"GB":a>=1048576?X.roundNumber(a/1048576,1)+"MB":a>=1024?X.roundNumber(a/1024,0)+"KB":a+"B"},X.log=function(b){a.console&&a.console.log&&a.console.log(b)},X.getNotification=function(a,b){return a=X.pInt(a),V.Notification.ClientViewError===a&&b?b:X.isUnd(W[a])?"":W[a]},X.initNotificationLanguage=function(){W[V.Notification.InvalidToken]=X.i18n("NOTIFICATIONS/INVALID_TOKEN"),W[V.Notification.AuthError]=X.i18n("NOTIFICATIONS/AUTH_ERROR"),W[V.Notification.AccessError]=X.i18n("NOTIFICATIONS/ACCESS_ERROR"),W[V.Notification.ConnectionError]=X.i18n("NOTIFICATIONS/CONNECTION_ERROR"),W[V.Notification.CaptchaError]=X.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),W[V.Notification.SocialFacebookLoginAccessDisable]=X.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),W[V.Notification.SocialTwitterLoginAccessDisable]=X.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),W[V.Notification.SocialGoogleLoginAccessDisable]=X.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),W[V.Notification.DomainNotAllowed]=X.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),W[V.Notification.AccountNotAllowed]=X.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),W[V.Notification.AccountTwoFactorAuthRequired]=X.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),W[V.Notification.AccountTwoFactorAuthError]=X.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),W[V.Notification.CouldNotSaveNewPassword]=X.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),W[V.Notification.CurrentPasswordIncorrect]=X.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),W[V.Notification.NewPasswordShort]=X.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),W[V.Notification.NewPasswordWeak]=X.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),W[V.Notification.NewPasswordForbidden]=X.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),W[V.Notification.ContactsSyncError]=X.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),W[V.Notification.CantGetMessageList]=X.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),W[V.Notification.CantGetMessage]=X.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),W[V.Notification.CantDeleteMessage]=X.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),W[V.Notification.CantMoveMessage]=X.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),W[V.Notification.CantCopyMessage]=X.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),W[V.Notification.CantSaveMessage]=X.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),W[V.Notification.CantSendMessage]=X.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),W[V.Notification.InvalidRecipients]=X.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),W[V.Notification.CantCreateFolder]=X.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),W[V.Notification.CantRenameFolder]=X.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),W[V.Notification.CantDeleteFolder]=X.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),W[V.Notification.CantDeleteNonEmptyFolder]=X.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),W[V.Notification.CantSubscribeFolder]=X.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),W[V.Notification.CantUnsubscribeFolder]=X.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),W[V.Notification.CantSaveSettings]=X.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),W[V.Notification.CantSavePluginSettings]=X.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),W[V.Notification.DomainAlreadyExists]=X.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),W[V.Notification.CantInstallPackage]=X.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),W[V.Notification.CantDeletePackage]=X.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),W[V.Notification.InvalidPluginPackage]=X.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),W[V.Notification.UnsupportedPluginPackage]=X.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),W[V.Notification.LicensingServerIsUnavailable]=X.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),W[V.Notification.LicensingExpired]=X.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),W[V.Notification.LicensingBanned]=X.i18n("NOTIFICATIONS/LICENSING_BANNED"),W[V.Notification.DemoSendMessageError]=X.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),W[V.Notification.AccountAlreadyExists]=X.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),W[V.Notification.MailServerError]=X.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),W[V.Notification.UnknownNotification]=X.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),W[V.Notification.UnknownError]=X.i18n("NOTIFICATIONS/UNKNOWN_ERROR")
|
|
},X.getUploadErrorDescByCode=function(a){var b="";switch(X.pInt(a)){case V.UploadErrorCode.FileIsTooBig:b=X.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case V.UploadErrorCode.FilePartiallyUploaded:b=X.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case V.UploadErrorCode.FileNoUploaded:b=X.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case V.UploadErrorCode.MissingTempFolder:b=X.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case V.UploadErrorCode.FileOnSaveingError:b=X.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case V.UploadErrorCode.FileType:b=X.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=X.i18n("UPLOAD/ERROR_UNKNOWN")}return b},X.delegateRun=function(a,b,c,d){a&&a[b]&&(d=X.pInt(d),0>=d?a[b].apply(a,X.isArray(c)?c:[]):f.delay(function(){a[b].apply(a,X.isArray(c)?c:[])},d))},X.killCtrlAandS=function(b){if(b=b||a.event,b&&b.ctrlKey&&!b.shiftKey&&!b.altKey){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(d===V.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===V.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},X.createCommand=function(a,b,d){var e=b?function(){return e.canExecute&&e.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments)),!1}:function(){};return e.enabled=c.observable(!0),d=X.isUnd(d)?!0:d,e.canExecute=c.computed(X.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},X.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(V.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(V.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),$.sAnimationType=V.InterfaceAnimation.Full,b.capaThemes=c.observable(!1),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(V.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return V.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if($.bMobileDevice||a===V.InterfaceAnimation.None)eb.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),$.sAnimationType=V.InterfaceAnimation.None;else switch(a){case V.InterfaceAnimation.Full:eb.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),$.sAnimationType=a;break;case V.InterfaceAnimation.Normal:eb.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),$.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=V.DesktopNotifications.NotSupported;if(hb&&hb.permission)switch(hb.permission.toLowerCase()){case"granted":c=V.DesktopNotifications.Allowed;break;case"denied":c=V.DesktopNotifications.Denied;break;case"default":c=V.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&V.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();V.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):V.DesktopNotifications.NotAllowed===c?hb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),V.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1<X.inArray(a,b.languages())?b.language(a):0<b.languages().length&&b.language(b.languages()[0]):b.language.valueHasMutated()}}),b.theme=c.observable(""),b.themes=c.observableArray([]),b.mainTheme=c.computed({read:b.theme,write:function(a){if(a!==b.theme()){var c=b.themes();-1<X.inArray(a,c)?b.theme(a):0<c.length&&b.theme(c[0])}else b.theme.valueHasMutated()}}),b.capaAdditionalAccounts=c.observable(!1),b.capaAdditionalIdentities=c.observable(!1),b.capaGravatar=c.observable(!1),b.determineUserLanguage=c.observable(!1),b.messagesPerPage=c.observable(U.Defaults.MessagesPerPage),b.mainMessagesPerPage=b.messagesPerPage,b.mainMessagesPerPage=c.computed({read:b.messagesPerPage,write:function(a){-1<X.inArray(X.pInt(a),U.Defaults.MessagesPerPageArray)?a!==b.messagesPerPage()&&b.messagesPerPage(a):b.messagesPerPage.valueHasMutated()}}),b.facebookEnable=c.observable(!1),b.facebookAppID=c.observable(""),b.facebookAppSecret=c.observable(""),b.twitterEnable=c.observable(!1),b.twitterConsumerKey=c.observable(""),b.twitterConsumerSecret=c.observable(""),b.googleEnable=c.observable(!1),b.googleClientID=c.observable(""),b.googleClientSecret=c.observable(""),b.dropboxEnable=c.observable(!1),b.dropboxApiKey=c.observable(""),b.contactsIsAllowed=c.observable(!1)},X.createMomentDate=function(a){return X.isUnd(a.moment)&&(a.moment=c.observable(moment())),c.computed(function(){return $.momentTrigger(),this.moment().fromNow()},a)},X.createMomentShortDate=function(a){return c.computed(function(){var a="",b=moment(),c=this.moment(),d=this.momentDate();return a=4>=b.diff(c,"hours")?d:b.format("L")===c.format("L")?X.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?X.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},X.isFolderExpanded=function(a){var b=ib.local().get(V.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},X.setExpandedFolder=function(a,b){var c=ib.local().get(V.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),ib.local().set(V.ClientSideKeyName.ExpandedFolders,c)},X.initLayoutResizer=function(a,c,d){var e=60,f=155,g=b(a),h=b(c),i=ib.local().get(d)||null,j=function(a){a&&(g.css({width:""+a+"px"}),h.css({left:""+a+"px"}))},k=function(a){if(a)g.resizable("disable"),j(e);else{g.resizable("enable");var b=X.pInt(ib.local().get(d))||f;j(b>f?b:f)}},l=function(a,b){b&&b.size&&b.size.width&&(ib.local().set(d,b.size.width),h.css({left:""+b.size.width+"px"}))};null!==i&&j(i>f?i:f),g.resizable({helper:"ui-resizable-helper",minWidth:f,maxWidth:350,handles:"e",stop:l}),ib.sub("left-panel.off",function(){k(!0)}),ib.sub("left-panel.on",function(){k(!1)})},X.initBlockquoteSwitcher=function(a){if(a){var c=b("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===b(this).parent().closest("blockquote",a).length});c&&0<c.length&&c.each(function(){var a=b(this),c=a.height();(0===c||c>100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('<span class="rlBlockquoteSwitcher"><i class="icon-ellipsis" /></span>').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),X.windowResize()}).after("<br />").before("<br />"))})}},X.removeBlockquoteSwitcher=function(a){a&&(b(a).find("blockquote.rl-bq-switcher").each(function(){b(this).removeClass("rl-bq-switcher hidden-bq")}),b(a).find(".rlBlockquoteSwitcher").each(function(){b(this).remove()}))},X.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},X.extendAsViewModel=function(a,b,c){b&&(c||(c=l),b.__name=a,Y.regViewModelHook(a,b),f.extend(b.prototype,c.prototype))},X.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},_.settings.push(a)},X.removeSettingsViewModel=function(a){_["settings-removed"].push(a)},X.disableSettingsViewModel=function(a){_["settings-disabled"].push(a)},X.convertThemeName=function(a){return"@custom"===a.substr(-7)&&(a=X.trim(a.substring(0,a.length-7))),X.trim(a.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},X.quoteName=function(a){return a.replace(/["]/g,'\\"')},X.microtime=function(){return(new Date).getTime()},X.convertLangName=function(a,b){return X.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},X.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=X.isUnd(a)?32:X.pInt(a);b.length<a;)b+=c.substr(Math.round(Math.random()*c.length),1);return b},X.md5=function(a){function b(a,b){return a<<b|a>>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<<h,i++;return b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|128<<h,g[f-2]=c<<3,g[f-1]=c>>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);128>d?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o<x.length;o+=16)p=t,q=u,r=v,s=w,t=h(t,u,v,w,x[o+0],y,3614090360),w=h(w,t,u,v,x[o+1],z,3905402710),v=h(v,w,t,u,x[o+2],A,606105819),u=h(u,v,w,t,x[o+3],B,3250441966),t=h(t,u,v,w,x[o+4],y,4118548399),w=h(w,t,u,v,x[o+5],z,1200080426),v=h(v,w,t,u,x[o+6],A,2821735955),u=h(u,v,w,t,x[o+7],B,4249261313),t=h(t,u,v,w,x[o+8],y,1770035416),w=h(w,t,u,v,x[o+9],z,2336552879),v=h(v,w,t,u,x[o+10],A,4294925233),u=h(u,v,w,t,x[o+11],B,2304563134),t=h(t,u,v,w,x[o+12],y,1804603682),w=h(w,t,u,v,x[o+13],z,4254626195),v=h(v,w,t,u,x[o+14],A,2792965006),u=h(u,v,w,t,x[o+15],B,1236535329),t=i(t,u,v,w,x[o+1],C,4129170786),w=i(w,t,u,v,x[o+6],D,3225465664),v=i(v,w,t,u,x[o+11],E,643717713),u=i(u,v,w,t,x[o+0],F,3921069994),t=i(t,u,v,w,x[o+5],C,3593408605),w=i(w,t,u,v,x[o+10],D,38016083),v=i(v,w,t,u,x[o+15],E,3634488961),u=i(u,v,w,t,x[o+4],F,3889429448),t=i(t,u,v,w,x[o+9],C,568446438),w=i(w,t,u,v,x[o+14],D,3275163606),v=i(v,w,t,u,x[o+3],E,4107603335),u=i(u,v,w,t,x[o+8],F,1163531501),t=i(t,u,v,w,x[o+13],C,2850285829),w=i(w,t,u,v,x[o+2],D,4243563512),v=i(v,w,t,u,x[o+7],E,1735328473),u=i(u,v,w,t,x[o+12],F,2368359562),t=j(t,u,v,w,x[o+5],G,4294588738),w=j(w,t,u,v,x[o+8],H,2272392833),v=j(v,w,t,u,x[o+11],I,1839030562),u=j(u,v,w,t,x[o+14],J,4259657740),t=j(t,u,v,w,x[o+1],G,2763975236),w=j(w,t,u,v,x[o+4],H,1272893353),v=j(v,w,t,u,x[o+7],I,4139469664),u=j(u,v,w,t,x[o+10],J,3200236656),t=j(t,u,v,w,x[o+13],G,681279174),w=j(w,t,u,v,x[o+0],H,3936430074),v=j(v,w,t,u,x[o+3],I,3572445317),u=j(u,v,w,t,x[o+6],J,76029189),t=j(t,u,v,w,x[o+9],G,3654602809),w=j(w,t,u,v,x[o+12],H,3873151461),v=j(v,w,t,u,x[o+15],I,530742520),u=j(u,v,w,t,x[o+2],J,3299628645),t=k(t,u,v,w,x[o+0],K,4096336452),w=k(w,t,u,v,x[o+7],L,1126891415),v=k(v,w,t,u,x[o+14],M,2878612391),u=k(u,v,w,t,x[o+5],N,4237533241),t=k(t,u,v,w,x[o+12],K,1700485571),w=k(w,t,u,v,x[o+3],L,2399980690),v=k(v,w,t,u,x[o+10],M,4293915773),u=k(u,v,w,t,x[o+1],N,2240044497),t=k(t,u,v,w,x[o+8],K,1873313359),w=k(w,t,u,v,x[o+15],L,4264355552),v=k(v,w,t,u,x[o+6],M,2734768916),u=k(u,v,w,t,x[o+13],N,1309151649),t=k(t,u,v,w,x[o+4],K,4149444226),w=k(w,t,u,v,x[o+11],L,3174756917),v=k(v,w,t,u,x[o+2],M,718787259),u=k(u,v,w,t,x[o+9],N,3951481745),t=c(t,p),u=c(u,q),v=c(v,r),w=c(w,s);var O=m(t)+m(u)+m(v)+m(w);return O.toLowerCase()},X.convertPlainTextToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")},X.draggeblePlace=function(){return b('<div class="draggablePlace"><span class="text"></span> <i class="icon-copy icon-white visible-on-ctrl"></i><i class="icon-mail icon-white hidden-on-ctrl"></i></div>').appendTo("#rl-hidden")},X.defautOptionsAfterRender=function(a,c){c&&!X.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},X.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+X.fakeMd5()+"__",j=b("#"+d);a[i]=function(){if(h&&h.document.body&&j&&j[0]){var d=b(h.document.body);b("#rl-content",d).html(j.html()),b("html",h.document).addClass("external "+b("html").attr("class")),X.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write('<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>'+X.encodeHtml(e)+'</title></head><body><div id="rl-content"></div></body></html>'),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},X.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=X.isUnd(d)?1e3:X.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?V.SaveSettingsStep.TrueResult:V.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,V.SaveSettingsStep.Idle)},d)}},X.settingsSaveHelperSimpleFunction=function(a,b){return X.settingsSaveHelperFunction(null,a,b,1e3)},X.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1<arguments.length){var a=b.trim(arguments[1]).replace(/__bq__start__(.|[\s\S\n\r]*)__bq__end__/gm,e);return a="\n"+d+b.trim(a).replace(/\n/gm,"\n"+d)+"\n>\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1<arguments.length?"\n"+b.trim(arguments[1].replace(/[\s]/,""))+" ":""})}return""},f=function(){if(arguments&&1<arguments.length){var a=b.trim(arguments[1]);return 0<a.length&&(a=a.replace(/<div[^>]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1<arguments.length?""+arguments[1]+arguments[2].replace(/</g,"<").replace(/>/g,">"):""},h=function(){if(arguments&&1<arguments.length){var a=b.trim(arguments[1]);return a}return""};return c=a.replace(/[\s]+/gm," ").replace(/((?:href|data)\s?=\s?)("[^"]+?"|'[^']+?')/gim,g).replace(/<br\s?\/?>/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/<hr[^>]*>/gim,"\n_______________________________\n\n").replace(/<img [^>]*>/gim,"").replace(/<div[^>]*>(.|[\s\S\r\n]*)<\/div>/gim,f).replace(/<blockquote[^>]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/<a [^>]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},X.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/</g,"<").replace(/\r/g,"").replace(/\n/g,"<br />")},X.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},X.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:X.isUnd(c)?a.toString():c.toString(),custom:X.isUnd(c)?!1:!0,title:X.isUnd(c)?"":a.toString(),value:a.toString()};(X.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},X.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},X.disableKeyFilter=function(){a.key&&(key.filter=function(){return ib.data().useKeyboardShortcuts()})},X.restoreKeyFilter=function(){a.key&&(key.filter=function(a){if(ib.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},X.detectDropdownVisibility=f.debounce(function(){$.dropdownVisibility(!!f.find(ab,function(a){return a.hasClass("open")}))},50),Z={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Z.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Z._utf8_encode(a);j<a.length;)b=a.charCodeAt(j++),c=a.charCodeAt(j++),d=a.charCodeAt(j++),e=b>>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j<a.length;)e=this._keyStr.indexOf(a.charAt(j++)),f=this._keyStr.indexOf(a.charAt(j++)),g=this._keyStr.indexOf(a.charAt(j++)),h=this._keyStr.indexOf(a.charAt(j++)),b=e<<2|f>>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Z._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;c<a.length;)d=a.charCodeAt(c),128>d?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!$.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||$.dropdownVisibility()?"":'<span class="tooltip-class '+f+'">'+X.i18n(c.utils.unwrapObservable(d()))+"</span>"}}).click(function(){e.tooltip("hide")}),$.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||$.dropdownVisibility()?"":'<span class="tooltip-class '+e+'">'+c()()+"</span>"}}).click(function(){d.tooltip("hide")}),$.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),$.dropdownVisibility.subscribe(function(a){a&&c.tooltip("hide")}),gb.click(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){ab.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),X.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!X.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!$.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){X.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){X.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),X.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=X.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=X.pInt(e[2]),g=fb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!$.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),X.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),X.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null)},b(d).draggable(k).on("mousedown",function(){X.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!$.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){$.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append(' <i class="icon-spinner animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:g,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){ib.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=X.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:g,inputDelimiters:[",",";"],outputDelimiter:",",autoCompleteSource:function(a,b){ib.getContactsTagsAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=X.trim(a),c=null;return""!==b?(c=new p,c.name(b),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(X.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},X.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=X.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=X.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),X.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return X.isUnd(a)||""===a||(b+="/"+a),b},g.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},g.prototype.mailBox=function(a,b,c){b=X.isNormal(b)?X.pInt(b):1,c=X.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},g.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},g.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a
|
|
},g.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=X.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},Y.oViewModelsHooks={},Y.oSimpleHooks={},Y.regViewModelHook=function(a,b){b&&(b.__hookName=a)},Y.addHook=function(a,b){X.isFunc(b)&&(X.isArray(Y.oSimpleHooks[a])||(Y.oSimpleHooks[a]=[]),Y.oSimpleHooks[a].push(b))},Y.runHook=function(a,b){X.isArray(Y.oSimpleHooks[a])&&(b=b||[],f.each(Y.oSimpleHooks[a],function(a){a.apply(null,b)}))},Y.mainSettingsGet=function(a){return ib?ib.settingsGet(a):null},Y.remoteRequest=function(a,b,c,d,e,f){ib&&ib.remote().defaultRequest(a,b,c,d,e,f)},Y.settingsGet=function(a,b){var c=Y.mainSettingsGet("Plugins");return c=c&&X.isUnd(c[a])?null:c[a],c?X.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(U.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(U.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(U.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[U.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[U.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[U.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!X.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},l.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=ib.data().keyScope(),ib.data().keyScope(this.sDefaultKeyScope)},l.prototype.restoreKeyScope=function(){ib.data().keyScope(this.sCurrentKeyScope)},l.prototype.registerPopupKeyDown=function(){var a=this;fb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&V.EventKeyCode.Esc===b.keyCode)return X.delegateRun(a,"cancelCommand"),!1;if(V.EventKeyCode.Backspace===b.keyCode&&!X.inFocus())return!1}return!0})},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;X.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||X.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){X.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return X.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||X.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),g=e.viewModelPosition(),h=b("#rl-content #rl-"+g.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=ib.data(),e.viewModelName=a.__name,h&&1===h.length?(i=b("<div>").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=X.createCommand(e,function(){bb.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),ib.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+ib.popupVisibilityNames().length+10),X.delegateRun(this,"onFocus",[],500)):(X.delegateRun(this,"onHide"),this.restoreKeyScope(),ib.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),f.delay(function(){b.viewModelDom.hide()},300))},e)),Y.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),X.delegateRun(e,"onBuild",[i]),e&&"Popups"===g&&e.registerPopupKeyDown(),Y.runHook("view-model-post-build",[a.__name,e,i])):X.log("Cannot find view model position: "+g)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),Y.runHook("view-model-on-hide",[a.__name,a.__vm]))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),X.delegateRun(a.__vm,"onShow",b||[]),Y.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===X.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,X.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),X.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onHide"),X.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),X.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(X.delegateRun(c.oCurrentScreen,"onShow"),Y.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),X.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),X.delegateRun(a.__vm,"onShow"),X.delegateRun(a.__vm,"onFocus",[],200),Y.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),Y.runHook("screen-pre-start",[a.screenName(),a]),X.delegateRun(a,"onStart"),Y.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),f.delay(function(){eb.removeClass("rl-started-trigger").addClass("rl-started")},50)},n.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=X.isUnd(c)?!1:!!c,(X.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},bb=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.clear=function(){this.email="",this.name="",this.privateType=null},o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=V.EmailType.Facebook),null===this.privateType&&(this.privateType=V.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){this.clear(),a=X.trim(a);var b=/(?:"([^"]+)")? ?<?(.*?@[^>,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=X.trim(a.Name),this.email=X.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=X.isUnd(b)?!1:!!b,c=X.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'<a href="mailto:'+X.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+X.encodeHtml(this.name)+"</a>":c?X.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=X.encodeHtml('"'+this.name+'" <')+'<a href="mailto:'+X.encodeHtml('"'+this.name+'" <'+this.email+">")+'" target="_blank" tabindex="-1">'+X.encodeHtml(d)+"</a>"+X.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=X.encodeHtml(d))):b&&(d='<a href="mailto:'+X.encodeHtml(this.email)+'" target="_blank" tabindex="-1">'+X.encodeHtml(this.email)+"</a>"))),d},o.prototype.mailsoParse=function(a){if(a=X.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m<a.length;){switch(a.substr(m,1)){case'"':g||h||i?h||i||(l=m,d=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,g=!1):(g=!0,k=m);break;case"<":g||h||i||(m>0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=X.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=X.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=X.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},o.prototype.inputoTagLine=function(){return 0<this.name.length?this.name+" ("+this.email+")":this.email},p.prototype.parse=function(a){var b=!1;return a&&"Object/Tag"===a["@Object"]&&(this.idContact=X.pInt(a.IdContactTag),this.name(X.pString(a.Name)),this.readOnly=!!a.ReadOnly,b=!0),b},p.prototype.filterHelper=function(a){return-1!==this.name().toLowerCase().indexOf(a.toLowerCase())},p.prototype.toLine=function(a){return(X.isUnd(a)?1:!a)?this.name():X.encodeHtml(this.name())},X.extendAsViewModel("PopupsDomainViewModel",q),q.prototype.onTestConnectionResponse=function(a,b){this.testing(!1),V.StorageResultType.Success===a&&b.Result?(this.testingDone(!0),this.testingImapError(!0!==b.Result.Imap),this.testingSmtpError(!0!==b.Result.Smtp),this.testingImapError()&&b.Result.Imap&&this.testingImapErrorDesc(b.Result.Imap),this.testingSmtpError()&&b.Result.Smtp&&this.testingSmtpErrorDesc(b.Result.Smtp)):(this.testingImapError(!0),this.testingSmtpError(!0))},q.prototype.onDomainCreateOrSaveResponse=function(a,b){this.saving(!1),V.StorageResultType.Success===a&&b?b.Result?(ib.reloadDomainList(),this.closeCommand()):V.Notification.DomainAlreadyExists===b.ErrorCode&&this.savingError("Domain already exists"):this.savingError("Unknown error")},q.prototype.onHide=function(){this.whiteListPage(!1)},q.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(X.trim(a.Name)),this.imapServer(X.trim(a.IncHost)),this.imapPort(X.pInt(a.IncPort)),this.imapSecure(X.trim(a.IncSecure)),this.imapShortLogin(!!a.IncShortLogin),this.smtpServer(X.trim(a.OutHost)),this.smtpPort(X.pInt(a.OutPort)),this.smtpSecure(X.trim(a.OutSecure)),this.smtpShortLogin(!!a.OutShortLogin),this.smtpAuth(!!a.OutAuth),this.whiteList(X.trim(a.WhiteList)))},q.prototype.onFocus=function(){""===this.name()&&this.name.focused(!0)},q.prototype.clearForm=function(){this.edit(!1),this.whiteListPage(!1),this.savingError(""),this.name(""),this.name.focused(!1),this.imapServer(""),this.imapPort(U.Values.ImapDefaulPort),this.imapSecure(V.ServerSecure.None),this.imapShortLogin(!1),this.smtpServer(""),this.smtpPort(U.Values.SmtpDefaulPort),this.smtpSecure(V.ServerSecure.None),this.smtpShortLogin(!1),this.smtpAuth(!0),this.whiteList("")},X.extendAsViewModel("PopupsPluginViewModel",r),r.prototype.onPluginSettingsUpdateResponse=function(a,b){V.StorageResultType.Success===a&&b&&b.Result?this.cancelCommand():(this.saveError(""),this.saveError(b&&b.ErrorCode?X.getNotification(b.ErrorCode):X.getNotification(V.Notification.CantSavePluginSettings)))},r.prototype.onShow=function(a){if(this.name(),this.readme(),this.configures([]),a){this.name(a.Name),this.readme(a.Readme);var b=a.Config;X.isNonEmptyArray(b)&&this.configures(f.map(b,function(a){return{value:c.observable(a[0]),Name:a[1],Type:a[2],Label:a[3],Default:a[4],Desc:a[5]}}))}},r.prototype.tryToClosePopup=function(){var a=this;bb.showScreenPopup(u,[X.i18n("POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW"),function(){a.modalVisibility()&&X.delegateRun(a,"cancelCommand")}])},r.prototype.onBuild=function(){key("esc",V.KeyState.All,f.bind(function(){return this.modalVisibility()?(this.tryToClosePopup(),!1):void 0},this))},X.extendAsViewModel("PopupsActivateViewModel",s),s.prototype.onShow=function(){this.domain(ib.settingsGet("AdminDomain")),this.activateProcess()||(this.key(""),this.activateText(""),this.activateText.isError(!1),this.activationSuccessed(!1))},s.prototype.onFocus=function(){this.activateProcess()||this.key.focus(!0)},s.prototype.validateSubscriptionKey=function(){var a=this.key();return""===a||!!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(X.trim(a))},X.extendAsViewModel("PopupsLanguagesViewModel",t),t.prototype.languageEnName=function(a){return X.convertLangName(a,!0)},t.prototype.resetMainLanguage=function(){var a=ib.data().mainLanguage();f.each(this.languages(),function(b){b.selected(b.key===a)})},t.prototype.onShow=function(){this.exp(!0),this.resetMainLanguage()},t.prototype.onHide=function(){this.exp(!1)},t.prototype.changeLanguage=function(a){ib.data().mainLanguage(a),this.cancelCommand()},X.extendAsViewModel("PopupsAskViewModel",u),u.prototype.clearPopup=function(){this.askDesc(""),this.yesButton(X.i18n("POPUPS_ASK/BUTTON_YES")),this.noButton(X.i18n("POPUPS_ASK/BUTTON_NO")),this.yesFocus(!1),this.noFocus(!1),this.fYesAction=null,this.fNoAction=null},u.prototype.yesClick=function(){this.cancelCommand(),X.isFunc(this.fYesAction)&&this.fYesAction.call(null)},u.prototype.noClick=function(){this.cancelCommand(),X.isFunc(this.fNoAction)&&this.fNoAction.call(null)},u.prototype.onShow=function(a,b,c,d,e){this.clearPopup(),this.fYesAction=b||null,this.fNoAction=c||null,this.askDesc(a||""),d&&this.yesButton(d),d&&this.yesButton(e)},u.prototype.onFocus=function(){this.yesFocus(!0)},u.prototype.onBuild=function(){key("tab, shift+tab, right, left",V.KeyState.PopupAsk,f.bind(function(){return this.yesFocus()?this.noFocus(!0):this.yesFocus(!0),!1},this))},X.extendAsViewModel("AdminLoginViewModel",v),v.prototype.onShow=function(){bb.routeOff(),f.delay(f.bind(function(){this.loginFocus(!0)},this),100)},v.prototype.onHide=function(){this.loginFocus(!1)},X.extendAsViewModel("AdminMenuViewModel",w),w.prototype.link=function(a){return"#/"+a},X.extendAsViewModel("AdminPaneViewModel",x),x.prototype.logoutClick=function(){ib.remote().adminLogout(function(){ib.loginAndLogoutReload()})},X.addSettingsViewModel(y,"AdminSettingsGeneral","General","general",!0),y.prototype.onBuild=function(){var a=this;f.delay(function(){var b=X.settingsSaveHelperSimpleFunction(a.languageTrigger,a),c=X.settingsSaveHelperSimpleFunction(a.themeTrigger,a);a.language.subscribe(function(a){ib.remote().saveAdminConfig(b,{Language:X.trim(a)})}),a.theme.subscribe(function(a){ib.remote().saveAdminConfig(c,{Theme:X.trim(a)})}),a.capaAdditionalAccounts.subscribe(function(a){ib.remote().saveAdminConfig(null,{CapaAdditionalAccounts:a?"1":"0"})}),a.capaAdditionalIdentities.subscribe(function(a){ib.remote().saveAdminConfig(null,{CapaAdditionalIdentities:a?"1":"0"})}),a.capaGravatar.subscribe(function(a){ib.remote().saveAdminConfig(null,{CapaGravatar:a?"1":"0"})}),a.capaThemes.subscribe(function(a){ib.remote().saveAdminConfig(null,{CapaThemes:a?"1":"0"})}),a.allowLanguagesOnSettings.subscribe(function(a){ib.remote().saveAdminConfig(null,{AllowLanguagesOnSettings:a?"1":"0"})})},50)},y.prototype.selectLanguage=function(){bb.showScreenPopup(t)},X.addSettingsViewModel(z,"AdminSettingsLogin","Login","login"),z.prototype.onBuild=function(){var a=this;f.delay(function(){var b=X.settingsSaveHelperSimpleFunction(a.defaultDomainTrigger,a);a.determineUserLanguage.subscribe(function(a){ib.remote().saveAdminConfig(null,{DetermineUserLanguage:a?"1":"0"})}),a.allowCustomLogin.subscribe(function(a){ib.remote().saveAdminConfig(null,{AllowCustomLogin:a?"1":"0"})}),a.allowLanguagesOnLogin.subscribe(function(a){ib.remote().saveAdminConfig(null,{AllowLanguagesOnLogin:a?"1":"0"})}),a.defaultDomain.subscribe(function(a){ib.remote().saveAdminConfig(b,{LoginDefaultDomain:X.trim(a)})})},50)},X.addSettingsViewModel(A,"AdminSettingsBranding","Branding","branding"),A.prototype.onBuild=function(){var a=this;f.delay(function(){var b=X.settingsSaveHelperSimpleFunction(a.title.trigger,a),c=X.settingsSaveHelperSimpleFunction(a.loadingDesc.trigger,a),d=X.settingsSaveHelperSimpleFunction(a.loginLogo.trigger,a),e=X.settingsSaveHelperSimpleFunction(a.loginDescription.trigger,a),f=X.settingsSaveHelperSimpleFunction(a.loginCss.trigger,a);a.title.subscribe(function(a){ib.remote().saveAdminConfig(b,{Title:X.trim(a)})}),a.loadingDesc.subscribe(function(a){ib.remote().saveAdminConfig(c,{LoadingDescription:X.trim(a)})}),a.loginLogo.subscribe(function(a){ib.remote().saveAdminConfig(d,{LoginLogo:X.trim(a)})}),a.loginDescription.subscribe(function(a){ib.remote().saveAdminConfig(e,{LoginDescription:X.trim(a)})}),a.loginCss.subscribe(function(a){ib.remote().saveAdminConfig(f,{LoginCss:X.trim(a)})})},50)},X.addSettingsViewModel(B,"AdminSettingsContacts","Contacts","contacts"),B.prototype.onTestContactsResponse=function(a,b){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage(""),V.StorageResultType.Success===a&&b&&b.Result&&b.Result.Result?this.testContactsSuccess(!0):(this.testContactsError(!0),this.testContactsErrorMessage(b&&b.Result?b.Result.Message||"":"")),this.testing(!1)},B.prototype.onShow=function(){this.testContactsSuccess(!1),this.testContactsError(!1),this.testContactsErrorMessage("")},B.prototype.onBuild=function(){var a=this;f.delay(function(){var b=X.settingsSaveHelperSimpleFunction(a.pdoDsnTrigger,a),c=X.settingsSaveHelperSimpleFunction(a.pdoUserTrigger,a),d=X.settingsSaveHelperSimpleFunction(a.pdoPasswordTrigger,a),e=X.settingsSaveHelperSimpleFunction(a.contactsTypeTrigger,a);a.enableContacts.subscribe(function(a){ib.remote().saveAdminConfig(null,{ContactsEnable:a?"1":"0"})}),a.contactsSharing.subscribe(function(a){ib.remote().saveAdminConfig(null,{ContactsSharing:a?"1":"0"})}),a.contactsSync.subscribe(function(a){ib.remote().saveAdminConfig(null,{ContactsSync:a?"1":"0"})}),a.contactsType.subscribe(function(a){ib.remote().saveAdminConfig(e,{ContactsPdoType:a})}),a.pdoDsn.subscribe(function(a){ib.remote().saveAdminConfig(b,{ContactsPdoDsn:X.trim(a)})}),a.pdoUser.subscribe(function(a){ib.remote().saveAdminConfig(c,{ContactsPdoUser:X.trim(a)})}),a.pdoPassword.subscribe(function(a){ib.remote().saveAdminConfig(d,{ContactsPdoPassword:X.trim(a)})}),a.contactsType(ib.settingsGet("ContactsPdoType"))},50)},X.addSettingsViewModel(C,"AdminSettingsDomains","Domains","domains"),C.prototype.startDomainForDeletionTimeout=function(){var b=this;a.clearInterval(this.iDomainForDeletionTimeout),this.iDomainForDeletionTimeout=a.setTimeout(function(){b.domainForDeletion(null)},3e3)},C.prototype.createDomain=function(){bb.showScreenPopup(q)},C.prototype.deleteDomain=function(a){this.domains.remove(a),ib.remote().domainDelete(f.bind(this.onDomainListChangeRequest,this),a.name)},C.prototype.disableDomain=function(a){a.disabled(!a.disabled()),ib.remote().domainDisable(f.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=c.dataFor(this);a&&ib.remote().domain(f.bind(b.onDomainLoadRequest,b),a.name)}),ib.reloadDomainList()},C.prototype.onDomainLoadRequest=function(a,b){V.StorageResultType.Success===a&&b&&b.Result&&bb.showScreenPopup(q,[b.Result])},C.prototype.onDomainListChangeRequest=function(){ib.reloadDomainList()},X.addSettingsViewModel(D,"AdminSettingsSecurity","Security","security"),D.prototype.onNewAdminPasswordResponse=function(a,b){V.StorageResultType.Success===a&&b&&b.Result?(this.adminPassword(""),this.adminPasswordNew(""),this.adminPasswordNew2(""),this.adminPasswordUpdateSuccess(!0)):this.adminPasswordUpdateError(!0)},D.prototype.onBuild=function(){this.csrfProtection.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{TokenProtection:a?"1":"0"})}),this.capaOpenPGP.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{CapaOpenPGP:a?"1":"0"})}),this.capaTwoFactorAuth.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{CapaTwoFactorAuth:a?"1":"0"})})},D.prototype.onHide=function(){this.adminPassword(""),this.adminPasswordNew(""),this.adminPasswordNew2("")},D.prototype.phpInfoLink=function(){return ib.link().phpInfo()},X.addSettingsViewModel(E,"AdminSettingsSocial","Social","social"),E.prototype.onBuild=function(){var a=this;f.delay(function(){var b=X.settingsSaveHelperSimpleFunction(a.facebookTrigger1,a),c=X.settingsSaveHelperSimpleFunction(a.facebookTrigger2,a),d=X.settingsSaveHelperSimpleFunction(a.twitterTrigger1,a),e=X.settingsSaveHelperSimpleFunction(a.twitterTrigger2,a),f=X.settingsSaveHelperSimpleFunction(a.googleTrigger1,a),g=X.settingsSaveHelperSimpleFunction(a.googleTrigger2,a),h=X.settingsSaveHelperSimpleFunction(a.dropboxTrigger1,a);a.facebookEnable.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{FacebookEnable:a?"1":"0"})}),a.facebookAppID.subscribe(function(a){ib.remote().saveAdminConfig(b,{FacebookAppID:X.trim(a)})}),a.facebookAppSecret.subscribe(function(a){ib.remote().saveAdminConfig(c,{FacebookAppSecret:X.trim(a)})}),a.twitterEnable.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{TwitterEnable:a?"1":"0"})}),a.twitterConsumerKey.subscribe(function(a){ib.remote().saveAdminConfig(d,{TwitterConsumerKey:X.trim(a)})}),a.twitterConsumerSecret.subscribe(function(a){ib.remote().saveAdminConfig(e,{TwitterConsumerSecret:X.trim(a)})}),a.googleEnable.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{GoogleEnable:a?"1":"0"})}),a.googleClientID.subscribe(function(a){ib.remote().saveAdminConfig(f,{GoogleClientID:X.trim(a)})}),a.googleClientSecret.subscribe(function(a){ib.remote().saveAdminConfig(g,{GoogleClientSecret:X.trim(a)})}),a.dropboxEnable.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{DropboxEnable:a?"1":"0"})}),a.dropboxApiKey.subscribe(function(a){ib.remote().saveAdminConfig(h,{DropboxApiKey:X.trim(a)})})},50)},X.addSettingsViewModel(F,"AdminSettingsPlugins","Plugins","plugins"),F.prototype.disablePlugin=function(a){a.disabled(!a.disabled()),ib.remote().pluginDisable(this.onPluginDisableRequest,a.name,a.disabled())},F.prototype.configurePlugin=function(a){ib.remote().plugin(this.onPluginLoadRequest,a.name)},F.prototype.onBuild=function(a){var b=this;a.on("click",".e-item .configure-plugin-action",function(){var a=c.dataFor(this);a&&b.configurePlugin(a)}).on("click",".e-item .disabled-plugin",function(){var a=c.dataFor(this);a&&b.disablePlugin(a)}),this.enabledPlugins.subscribe(function(a){ib.remote().saveAdminConfig(X.emptyFunction,{EnabledPlugins:a?"1":"0"})})},F.prototype.onShow=function(){this.pluginsError(""),ib.reloadPluginList()},F.prototype.onPluginLoadRequest=function(a,b){V.StorageResultType.Success===a&&b&&b.Result&&bb.showScreenPopup(r,[b.Result])},F.prototype.onPluginDisableRequest=function(a,b){V.StorageResultType.Success===a&&b&&!b.Result&&b.ErrorCode&&this.pluginsError(V.Notification.UnsupportedPluginPackage===b.ErrorCode&&b.ErrorMessage&&""!==b.ErrorMessage?b.ErrorMessage:X.getNotification(b.ErrorCode)),ib.reloadPluginList()},X.addSettingsViewModel(G,"AdminSettingsPackages","Packages","packages"),G.prototype.onShow=function(){this.packagesError("")},G.prototype.onBuild=function(){ib.reloadPackagesList()},G.prototype.requestHelper=function(b,c){var d=this;return function(e,g){V.StorageResultType.Success===e&&g&&g.Result||d.packagesError(g&&g.ErrorCode?X.getNotification(g.ErrorCode):X.getNotification(c?V.Notification.CantInstallPackage:V.Notification.CantDeletePackage)),f.each(ib.data().packages(),function(a){a&&b&&a.loading()&&b.file===a.file&&(b.loading(!1),a.loading(!1))}),V.StorageResultType.Success===e&&g&&g.Result&&g.Result.Reload?a.location.reload():ib.reloadPackagesList()}},G.prototype.deletePackage=function(a){a&&(a.loading(!0),ib.remote().packageDelete(this.requestHelper(a,!1),a))},G.prototype.installPackage=function(a){a&&(a.loading(!0),ib.remote().packageInstall(this.requestHelper(a,!0),a))},X.addSettingsViewModel(H,"AdminSettingsLicensing","Licensing","licensing"),H.prototype.onBuild=function(){this.subscriptionEnabled()&&ib.reloadLicensing(!1)},H.prototype.onShow=function(){this.adminDomain(ib.settingsGet("AdminDomain"))},H.prototype.showActivationForm=function(){bb.showScreenPopup(s)},H.prototype.licenseExpiredMomentValue=function(){var a=moment.unix(this.licenseExpired());return a.format("LL")+" ("+a.from(moment())+")"},X.addSettingsViewModel(I,"AdminSettingsAbout","About","about"),J.prototype.populateDataOnStart=function(){var a=X.pInt(ib.settingsGet("Layout")),b=ib.settingsGet("Languages"),c=ib.settingsGet("Themes");X.isArray(b)&&this.languages(b),X.isArray(c)&&this.themes(c),this.mainLanguage(ib.settingsGet("Language")),this.mainTheme(ib.settingsGet("Theme")),this.capaAdditionalAccounts(ib.capa(V.Capa.AdditionalAccounts)),this.capaAdditionalIdentities(ib.capa(V.Capa.AdditionalIdentities)),this.capaGravatar(ib.capa(V.Capa.Gravatar)),this.determineUserLanguage(!!ib.settingsGet("DetermineUserLanguage")),this.capaThemes(ib.capa(V.Capa.Themes)),this.allowCustomLogin(!!ib.settingsGet("AllowCustomLogin")),this.allowLanguagesOnLogin(!!ib.settingsGet("AllowLanguagesOnLogin")),this.allowLanguagesOnSettings(!!ib.settingsGet("AllowLanguagesOnSettings")),this.editorDefaultType(ib.settingsGet("EditorDefaultType")),this.showImages(!!ib.settingsGet("ShowImages")),this.contactsAutosave(!!ib.settingsGet("ContactsAutosave")),this.interfaceAnimation(ib.settingsGet("InterfaceAnimation")),this.mainMessagesPerPage(ib.settingsGet("MPP")),this.desktopNotifications(!!ib.settingsGet("DesktopNotifications")),this.useThreads(!!ib.settingsGet("UseThreads")),this.replySameFolder(!!ib.settingsGet("ReplySameFolder")),this.useCheckboxesInList(!!ib.settingsGet("UseCheckboxesInList")),this.layout(V.Layout.SidePreview),-1<X.inArray(a,[V.Layout.NoPreview,V.Layout.SidePreview,V.Layout.BottomPreview])&&this.layout(a),this.facebookEnable(!!ib.settingsGet("AllowFacebookSocial")),this.facebookAppID(ib.settingsGet("FacebookAppID")),this.facebookAppSecret(ib.settingsGet("FacebookAppSecret")),this.twitterEnable(!!ib.settingsGet("AllowTwitterSocial")),this.twitterConsumerKey(ib.settingsGet("TwitterConsumerKey")),this.twitterConsumerSecret(ib.settingsGet("TwitterConsumerSecret")),this.googleEnable(!!ib.settingsGet("AllowGoogleSocial")),this.googleClientID(ib.settingsGet("GoogleClientID")),this.googleClientSecret(ib.settingsGet("GoogleClientSecret")),this.dropboxEnable(!!ib.settingsGet("AllowDropboxSocial")),this.dropboxApiKey(ib.settingsGet("DropboxApiKey")),this.contactsIsAllowed(!!ib.settingsGet("ContactsIsAllowed"))},f.extend(K.prototype,J.prototype),K.prototype.populateDataOnStart=function(){J.prototype.populateDataOnStart.call(this)},L.prototype.oRequests={},L.prototype.defaultResponse=function(b,c,d,e,g,h){var i=function(){V.StorageResultType.Success!==d&&$.bUnload&&(d=V.StorageResultType.Unload),V.StorageResultType.Success===d&&e&&!e.Result?(e&&-1<X.inArray(e.ErrorCode,[V.Notification.AuthError,V.Notification.AccessError,V.Notification.ConnectionError,V.Notification.DomainNotAllowed,V.Notification.AccountNotAllowed,V.Notification.MailServerError,V.Notification.UnknownNotification,V.Notification.UnknownError])&&$.iAjaxErrorCount++,e&&V.Notification.InvalidToken===e.ErrorCode&&$.iTokenErrorCount++,U.Values.TokenErrorLimit<$.iTokenErrorCount&&ib.loginAndLogoutReload(!0),(e.Logout||U.Values.AjaxErrorLimit<$.iAjaxErrorCount)&&(a.__rlah_clear&&a.__rlah_clear(),ib.loginAndLogoutReload(!0))):V.StorageResultType.Success===d&&e&&e.Result&&($.iAjaxErrorCount=0,$.iTokenErrorCount=0),b&&(Y.runHook("ajax-default-response",[c,V.StorageResultType.Success===d?e:null,d,g,h]),b(d,V.StorageResultType.Success===d?e:null,g,c,h))};switch(d){case"success":d=V.StorageResultType.Success;break;case"abort":d=V.StorageResultType.Abort;break;default:d=V.StorageResultType.Error}V.StorageResultType.Error===d?f.delay(i,300):i()},L.prototype.ajaxRequest=function(c,d,e,g,h){var i=this,j=""===g,k={},l=(new a.Date).getTime(),m=null,n="";return d=d||{},e=X.isNormal(e)?e:2e4,g=X.isUnd(g)?"":X.pString(g),h=X.isArray(h)?h:[],n=d.Action||"",n&&0<h.length&&f.each(h,function(a){i.oRequests[a]&&(i.oRequests[a].__aborted=!0,i.oRequests[a].abort&&i.oRequests[a].abort(),i.oRequests[a]=null)}),j&&(d.XToken=ib.settingsGet("Token")),m=b.ajax({type:j?"POST":"GET",url:ib.link().ajax(g),async:!0,dataType:"json",data:j?d:{},headers:k,timeout:e,global:!0}),m.always(function(b,e){var f=!1;b&&b.Time&&(f=X.pInt(b.Time)>(new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0<h.length&&-1<X.inArray(n,h)&&(this.oRequests[n]&&(this.oRequests[n].__aborted=!0,this.oRequests[n].abort&&this.oRequests[n].abort(),this.oRequests[n]=null),this.oRequests[n]=m),m},L.prototype.defaultRequest=function(a,b,c,d,e,f){c=c||{},c.Action=b,e=X.pString(e),Y.runHook("ajax-default-request",[b,c,e]),this.ajaxRequest(a,c,X.isUnd(d)?U.Defaults.DefaultAjaxTimeout:X.pInt(d),e,f)},L.prototype.noop=function(a){this.defaultRequest(a,"Noop")},L.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})
|
|
},L.prototype.jsInfo=function(a,b,c,d){this.defaultRequest(a,"JsInfo",{Type:b,Data:c,IsError:(X.isUnd(d)?1:!d)?"0":"1"})},L.prototype.jsVersion=function(a,b){this.defaultRequest(a,"Version",{Version:b})},f.extend(M.prototype,L.prototype),M.prototype.adminLogin=function(a,b,c){this.defaultRequest(a,"AdminLogin",{Login:b,Password:c})},M.prototype.adminLogout=function(a){this.defaultRequest(a,"AdminLogout")},M.prototype.saveAdminConfig=function(a,b){this.defaultRequest(a,"AdminSettingsUpdate",b)},M.prototype.domainList=function(a){this.defaultRequest(a,"AdminDomainList")},M.prototype.pluginList=function(a){this.defaultRequest(a,"AdminPluginList")},M.prototype.packagesList=function(a){this.defaultRequest(a,"AdminPackagesList")},M.prototype.packageInstall=function(a,b){this.defaultRequest(a,"AdminPackageInstall",{Id:b.id,Type:b.type,File:b.file},6e4)},M.prototype.packageDelete=function(a,b){this.defaultRequest(a,"AdminPackageDelete",{Id:b.id})},M.prototype.domain=function(a,b){this.defaultRequest(a,"AdminDomainLoad",{Name:b})},M.prototype.plugin=function(a,b){this.defaultRequest(a,"AdminPluginLoad",{Name:b})},M.prototype.domainDelete=function(a,b){this.defaultRequest(a,"AdminDomainDelete",{Name:b})},M.prototype.domainDisable=function(a,b,c){return this.defaultRequest(a,"AdminDomainDisable",{Name:b,Disabled:c?"1":"0"})},M.prototype.pluginSettingsUpdate=function(a,b){return this.defaultRequest(a,"AdminPluginSettingsUpdate",b)},M.prototype.licensing=function(a,b){return this.defaultRequest(a,"AdminLicensing",{Force:b?"1":"0"})},M.prototype.licensingActivate=function(a,b,c){return this.defaultRequest(a,"AdminLicensingActivate",{Domain:b,Key:c})},M.prototype.pluginDisable=function(a,b,c){return this.defaultRequest(a,"AdminPluginDisable",{Name:b,Disabled:c?"1":"0"})},M.prototype.createOrUpdateDomain=function(a,b,c,d,e,f,g,h,i,j,k,l,m){this.defaultRequest(a,"AdminDomainSave",{Create:b?"1":"0",Name:c,IncHost:d,IncPort:e,IncSecure:f,IncShortLogin:g?"1":"0",OutHost:h,OutPort:i,OutSecure:j,OutShortLogin:k?"1":"0",OutAuth:l?"1":"0",WhiteList:m})},M.prototype.testConnectionForDomain=function(a,b,c,d,e,f,g,h,i){this.defaultRequest(a,"AdminDomainTest",{Name:b,IncHost:c,IncPort:d,IncSecure:e,OutHost:f,OutPort:g,OutSecure:h,OutAuth:i?"1":"0"})},M.prototype.testContacts=function(a,b){this.defaultRequest(a,"AdminContactsTest",b)},M.prototype.saveNewAdminPassword=function(a,b){this.defaultRequest(a,"AdminPasswordUpdate",b)},M.prototype.adminPing=function(a){this.defaultRequest(a,"AdminPing")},N.prototype.oEmailsPicsHashes={},N.prototype.oServices={},N.prototype.bCapaGravatar=!1,N.prototype.clear=function(){this.oServices={},this.oEmailsPicsHashes={}},N.prototype.getUserPic=function(a,b){a=X.trim(a);var c="",d="",e=a.toLowerCase(),f=X.isUnd(this.oEmailsPicsHashes[e])?"":this.oEmailsPicsHashes[e];""!==f?c=ib.link().getUserPicUrlFromHash(f):(d=e.substr(a.indexOf("@")+1),c=""!==d&&this.oServices[d]?this.oServices[d]:""),this.bCapaGravatar&&""===c?b("//secure.gravatar.com/avatar/"+X.md5(e)+".jpg?s=80&d=mm",a):b(c,a)},N.prototype.setServicesData=function(a){this.oServices=a},N.prototype.setEmailsPicsHashesData=function(a){this.oEmailsPicsHashes=a},f.extend(O.prototype,N.prototype),f.extend(P.prototype,m.prototype),P.prototype.onRoute=function(a){var d=this,e=null,g=null,h=null,i=null;g=f.find(_.settings,function(b){return b&&b.__rlSettingsData&&a===b.__rlSettingsData.Route}),g&&(f.find(_["settings-removed"],function(a){return a&&a===g})&&(g=null),g&&f.find(_["settings-disabled"],function(a){return a&&a===g})&&(g=null)),g?(g.__builded&&g.__vm?e=g.__vm:(h=this.oViewModelPlace,h&&1===h.length?(g=g,e=new g,i=b("<div></div>").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(h),e.data=ib.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),X.delegateRun(e,"onBuild",[i])):X.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(X.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),X.delegateRun(d.oCurrentSubScreen,"onShow"),X.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),f.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),X.windowResize()})):bb.setHash(ib.link().settings(),!1,!0)},P.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(X.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},P.prototype.onBuild=function(){f.each(_.settings,function(a){a&&a.__rlSettingsData&&!f.find(_["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!f.find(_["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},P.prototype.routes=function(){var a=f.find(_.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=X.isUnd(c.subname)?b:X.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(Q.prototype,m.prototype),Q.prototype.onShow=function(){ib.setTitle("")},f.extend(R.prototype,P.prototype),R.prototype.onShow=function(){ib.setTitle("")},f.extend(S.prototype,k.prototype),S.prototype.oSettings=null,S.prototype.oPlugins=null,S.prototype.oLocal=null,S.prototype.oLink=null,S.prototype.oSubs={},S.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):($.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},S.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},S.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},S.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=X.isNormal(cb)?cb:{}),X.isUnd(this.oSettings[a])?null:this.oSettings[a]},S.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=X.isNormal(cb)?cb:{}),this.oSettings[a]=b},S.prototype.setTitle=function(b){b=(X.isNormal(b)&&0<b.length?b+" - ":"")+ib.settingsGet("Title")||"",a.document.title="_",a.document.title=b},S.prototype.loginAndLogoutReload=function(b,c){var d=X.pString(ib.settingsGet("CustomLogoutLink")),e=!!ib.settingsGet("InIframe");b=X.isUnd(b)?!1:!!b,c=X.isUnd(c)?!1:!!c,b&&c&&a.close&&a.close(),b&&""!==d&&a.location.href!==d?f.delay(function(){e&&a.parent?a.parent.location.href=d:a.location.href=d},100):(bb.routeOff(),bb.setHash(ib.link().root(),!0),bb.routeOff(),f.delay(function(){e&&a.parent?a.parent.location.reload():a.location.reload()},100))},S.prototype.historyBack=function(){a.history.back()},S.prototype.getAutocomplete=function(a,b){b([],a)},S.prototype.sub=function(a,b,c){return X.isUnd(this.oSubs[a])&&(this.oSubs[a]=[]),this.oSubs[a].push([b,c]),this},S.prototype.pub=function(a,b){return Y.runHook("rl-pub",[a,b]),X.isUnd(this.oSubs[a])||f.each(this.oSubs[a],function(a){a[0]&&a[0].apply(a[1]||null,b||[])}),this},S.prototype.capa=function(a){var b=this.settingsGet("Capa");return X.isArray(b)&&X.isNormal(a)&&-1<X.inArray(a,b)},S.prototype.bootstart=function(){var a=this;X.initOnStartOrLangChange(function(){X.initNotificationLanguage()},null),f.delay(function(){X.windowResize()},1e3),ssm.addState({id:"mobile",maxWidth:767,onEnter:function(){eb.addClass("ssm-state-mobile"),a.pub("ssm.mobile-enter")},onLeave:function(){eb.removeClass("ssm-state-mobile"),a.pub("ssm.mobile-leave")}}),ssm.addState({id:"tablet",minWidth:768,maxWidth:999,onEnter:function(){eb.addClass("ssm-state-tablet")},onLeave:function(){eb.removeClass("ssm-state-tablet")}}),ssm.addState({id:"desktop",minWidth:1e3,maxWidth:1400,onEnter:function(){eb.addClass("ssm-state-desktop")},onLeave:function(){eb.removeClass("ssm-state-desktop")}}),ssm.addState({id:"desktop-large",minWidth:1400,onEnter:function(){eb.addClass("ssm-state-desktop-large")},onLeave:function(){eb.removeClass("ssm-state-desktop-large")}}),ib.sub("ssm.mobile-enter",function(){ib.data().leftPanelDisabled(!0)}),ib.sub("ssm.mobile-leave",function(){ib.data().leftPanelDisabled(!1)}),ib.data().leftPanelDisabled.subscribe(function(a){eb.toggleClass("rl-left-panel-disabled",a)}),ssm.ready()},f.extend(T.prototype,S.prototype),T.prototype.oData=null,T.prototype.oRemote=null,T.prototype.oCache=null,T.prototype.data=function(){return null===this.oData&&(this.oData=new K),this.oData},T.prototype.remote=function(){return null===this.oRemote&&(this.oRemote=new M),this.oRemote},T.prototype.cache=function(){return null===this.oCache&&(this.oCache=new O),this.oCache},T.prototype.reloadDomainList=function(){ib.data().domainsLoading(!0),ib.remote().domainList(function(a,b){if(ib.data().domainsLoading(!1),V.StorageResultType.Success===a&&b&&b.Result){var d=f.map(b.Result,function(a,b){return{name:b,disabled:c.observable(!a),deleteAccess:c.observable(!1)}},this);ib.data().domains(d)}})},T.prototype.reloadPluginList=function(){ib.data().pluginsLoading(!0),ib.remote().pluginList(function(a,b){if(ib.data().pluginsLoading(!1),V.StorageResultType.Success===a&&b&&b.Result){var d=f.map(b.Result,function(a){return{name:a.Name,disabled:c.observable(!a.Enabled),configured:c.observable(!!a.Configured)}},this);ib.data().plugins(d)}})},T.prototype.reloadPackagesList=function(){ib.data().packagesLoading(!0),ib.data().packagesReal(!0),ib.remote().packagesList(function(a,b){if(ib.data().packagesLoading(!1),V.StorageResultType.Success===a&&b&&b.Result){ib.data().packagesReal(!!b.Result.Real),ib.data().packagesMainUpdatable(!!b.Result.MainUpdatable);var d=[],e={};f.each(ib.data().packages(),function(a){a&&a.loading()&&(e[a.file]=a)}),X.isArray(b.Result.List)&&(d=f.compact(f.map(b.Result.List,function(a){return a?(a.loading=c.observable(!X.isUnd(e[a.file])),"core"!==a.type||a.canBeInstalled?a:null):null}))),ib.data().packages(d)}else ib.data().packagesReal(!1)})},T.prototype.reloadLicensing=function(a){a=X.isUnd(a)?!1:!!a,ib.data().licensingProcess(!0),ib.data().licenseError(""),ib.remote().licensing(function(a,b){ib.data().licensingProcess(!1),V.StorageResultType.Success===a&&b&&b.Result&&X.isNormal(b.Result.Expired)?(ib.data().licenseValid(!0),ib.data().licenseExpired(X.pInt(b.Result.Expired)),ib.data().licenseError(""),ib.data().licensing(!0)):b&&b.ErrorCode&&-1<X.inArray(X.pInt(b.ErrorCode),[V.Notification.LicensingServerIsUnavailable,V.Notification.LicensingExpired])?(ib.data().licenseError(X.getNotification(X.pInt(b.ErrorCode))),ib.data().licensing(!0)):V.StorageResultType.Abort===a?(ib.data().licenseError(X.getNotification(V.Notification.LicensingServerIsUnavailable)),ib.data().licensing(!0)):ib.data().licensing(!1)},a)},T.prototype.bootstart=function(){S.prototype.bootstart.call(this),ib.data().populateDataOnStart(),bb.hideLoading(),ib.settingsGet("AllowAdminPanel")?(X.removeSettingsViewModel(I),ib.capa(V.Capa.Prem)||X.removeSettingsViewModel(A),bb.startScreens(ib.settingsGet("Auth")?[R]:[Q])):(bb.routeOff(),bb.setHash(ib.link().root(),!0),bb.routeOff(),f.defer(function(){a.location.href="/"})),a.SimplePace&&a.SimplePace.set(100)},ib=new T,eb.addClass($.bMobileDevice?"mobile":"no-mobile"),fb.keydown(X.killCtrlAandS).keyup(X.killCtrlAandS),fb.unload(function(){$.bUnload=!0}),eb.on("click.dropdown.data-api",function(){X.detectDropdownVisibility()}),a.rl=a.rl||{},a.rl.addHook=Y.addHook,a.rl.settingsGet=Y.mainSettingsGet,a.rl.remoteRequest=Y.remoteRequest,a.rl.pluginSettingsGet=Y.settingsGet,a.rl.addSettingsViewModel=X.addSettingsViewModel,a.rl.createCommand=X.createCommand,a.rl.EmailModel=o,a.rl.Enums=V,a.__RLBOOT=function(c){b(function(){a.rainloopTEMPLATES&&a.rainloopTEMPLATES[0]?(b("#rl-templates").html(a.rainloopTEMPLATES[0]),f.delay(function(){a.rainloopAppData={},a.rainloopI18N={},a.rainloopTEMPLATES={},bb.setBoot(ib).bootstart(),eb.removeClass("no-js rl-booted-trigger").addClass("rl-booted")},50)):c(!1),a.__RLBOOT=null})},a.SimplePace&&a.SimplePace.add(10)}(window,jQuery,ko,crossroads,hasher,_); |