/*! 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=hb.settingsGet("Version"),this.sSpecSuffix=hb.settingsGet("AuthAccountHash")||"0",this.sServer=(hb.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=W.pString(a),this.sTemplate=W.pString(b),this.sDefaultKeyScope=U.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=W.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(T.Values.ImapDefaulPort),this.imapSecure=c.observable(U.ServerSecure.None),this.imapShortLogin=c.observable(!1),this.smtpServer=c.observable(""),this.smtpPort=c.observable(T.Values.SmtpDefaulPort),this.smtpSecure=c.observable(U.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=W.createCommand(this,function(){this.saving(!0),hb.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=W.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),hb.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=W.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=W.pInt(this.imapPort());switch(a=W.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=W.pInt(this.smtpPort());switch(a=W.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').appendTo("body"),eb.on("error",function(a){hb&&a&&a.originalEvent&&a.originalEvent.message&&-1===W.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&hb.remote().jsError(W.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",db.attr("class"),W.microtime()-Z.now)}),fb.on("keydown",function(a){a&&a.ctrlKey&&db.addClass("rl-ctrl-key-pressed")}).on("keyup",function(a){a&&!a.ctrlKey&&db.removeClass("rl-ctrl-key-pressed")})}function S(){R.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var T={},U={},V={},W={},X={},Y={},Z={},$={settings:[],"settings-removed":[],"settings-disabled":[]},_=[],ab=null,bb=a.rainloopAppData||{},cb=a.rainloopI18N||{},db=b("html"),eb=b(a),fb=b(a.document),gb=a.Notification&&a.Notification.requestPermission?a.Notification:null,hb=null;Z.now=(new Date).getTime(),Z.momentTrigger=c.observable(!0),Z.dropdownVisibility=c.observable(!1).extend({rateLimit:0}),Z.langChangeTrigger=c.observable(!0),Z.iAjaxErrorCount=0,Z.iTokenErrorCount=0,Z.iMessageBodyCacheCount=0,Z.bUnload=!1,Z.sUserAgent=(navigator.userAgent||"").toLowerCase(),Z.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},W.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=W.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},W.timeOutAction=function(){var b={};return function(c,d,e){W.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),W.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),W.audio=function(){var b=!1;return function(c,d){if(!1===b)if(Z.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}}(),W.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},W.i18n=function(a,b,c){var d="",e=W.isUnd(cb[a])?W.isUnd(c)?a:c:cb[a];if(!W.isUnd(b)&&!W.isNull(b))for(d in b)W.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},W.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(W.i18n(c)):(c=a.data("i18n-html"),c&&a.html(W.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",W.i18n(c)),c=a.data("i18n-title"),c&&a.attr("title",W.i18n(c)))})})},W.i18nToDoc=function(){a.rainloopI18N&&(cb=a.rainloopI18N||{},W.i18nToNode(fb),Z.langChangeTrigger(!Z.langChangeTrigger())),a.rainloopI18N={}},W.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?Z.langChangeTrigger.subscribe(function(){a&&a.call(b),c.call(b)}):a&&Z.langChangeTrigger.subscribe(a,b)},W.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&&a.contentEditable)},W.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},W.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()},W.replySubjectAdd=function(b,c,d){var e=null,f=W.trim(c);return f=null===(e=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||W.isUnd(e[1])?null===(e=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||W.isUnd(e[1])||W.isUnd(e[2])||W.isUnd(e[3])?b+": "+c:e[1]+(W.pInt(e[2])+1)+e[3]:b+"[2]: "+e[1],f=f.replace(/[\s]+/g," "),f=(W.isUnd(d)?!0:d)?W.fixLongSubject(f):f},W.fixLongSubject=function(a){var b=0,c=null;a=W.trim(a.replace(/[\s]+/," "));do c=/^Re(\[([\d]+)\]|):[\s]{0,3}Re(\[([\d]+)\]|):/gi.exec(a),(!c||W.isUnd(c[0]))&&(c=null),c&&(b=0,b+=W.isUnd(c[2])?1:0+W.pInt(c[2]),b+=W.isUnd(c[4])?1:0+W.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]+/," ")},W.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},W.friendlySize=function(a){return a=W.pInt(a),a>=1073741824?W.roundNumber(a/1073741824,1)+"GB":a>=1048576?W.roundNumber(a/1048576,1)+"MB":a>=1024?W.roundNumber(a/1024,0)+"KB":a+"B"},W.log=function(b){a.console&&a.console.log&&a.console.log(b)},W.getNotification=function(a,b){return a=W.pInt(a),U.Notification.ClientViewError===a&&b?b:W.isUnd(V[a])?"":V[a]},W.initNotificationLanguage=function(){V[U.Notification.InvalidToken]=W.i18n("NOTIFICATIONS/INVALID_TOKEN"),V[U.Notification.AuthError]=W.i18n("NOTIFICATIONS/AUTH_ERROR"),V[U.Notification.AccessError]=W.i18n("NOTIFICATIONS/ACCESS_ERROR"),V[U.Notification.ConnectionError]=W.i18n("NOTIFICATIONS/CONNECTION_ERROR"),V[U.Notification.CaptchaError]=W.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),V[U.Notification.SocialFacebookLoginAccessDisable]=W.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),V[U.Notification.SocialTwitterLoginAccessDisable]=W.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),V[U.Notification.SocialGoogleLoginAccessDisable]=W.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),V[U.Notification.DomainNotAllowed]=W.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),V[U.Notification.AccountNotAllowed]=W.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),V[U.Notification.AccountTwoFactorAuthRequired]=W.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED"),V[U.Notification.AccountTwoFactorAuthError]=W.i18n("NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR"),V[U.Notification.CouldNotSaveNewPassword]=W.i18n("NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD"),V[U.Notification.CurrentPasswordIncorrect]=W.i18n("NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT"),V[U.Notification.NewPasswordShort]=W.i18n("NOTIFICATIONS/NEW_PASSWORD_SHORT"),V[U.Notification.NewPasswordWeak]=W.i18n("NOTIFICATIONS/NEW_PASSWORD_WEAK"),V[U.Notification.NewPasswordForbidden]=W.i18n("NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT"),V[U.Notification.ContactsSyncError]=W.i18n("NOTIFICATIONS/CONTACTS_SYNC_ERROR"),V[U.Notification.CantGetMessageList]=W.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),V[U.Notification.CantGetMessage]=W.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),V[U.Notification.CantDeleteMessage]=W.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),V[U.Notification.CantMoveMessage]=W.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),V[U.Notification.CantCopyMessage]=W.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),V[U.Notification.CantSaveMessage]=W.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),V[U.Notification.CantSendMessage]=W.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),V[U.Notification.InvalidRecipients]=W.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),V[U.Notification.CantCreateFolder]=W.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),V[U.Notification.CantRenameFolder]=W.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),V[U.Notification.CantDeleteFolder]=W.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),V[U.Notification.CantDeleteNonEmptyFolder]=W.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),V[U.Notification.CantSubscribeFolder]=W.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),V[U.Notification.CantUnsubscribeFolder]=W.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),V[U.Notification.CantSaveSettings]=W.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),V[U.Notification.CantSavePluginSettings]=W.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),V[U.Notification.DomainAlreadyExists]=W.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),V[U.Notification.CantInstallPackage]=W.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),V[U.Notification.CantDeletePackage]=W.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),V[U.Notification.InvalidPluginPackage]=W.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),V[U.Notification.UnsupportedPluginPackage]=W.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),V[U.Notification.LicensingServerIsUnavailable]=W.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),V[U.Notification.LicensingExpired]=W.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),V[U.Notification.LicensingBanned]=W.i18n("NOTIFICATIONS/LICENSING_BANNED"),V[U.Notification.DemoSendMessageError]=W.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),V[U.Notification.AccountAlreadyExists]=W.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),V[U.Notification.MailServerError]=W.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),V[U.Notification.UnknownNotification]=W.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),V[U.Notification.UnknownError]=W.i18n("NOTIFICATIONS/UNKNOWN_ERROR") },W.getUploadErrorDescByCode=function(a){var b="";switch(W.pInt(a)){case U.UploadErrorCode.FileIsTooBig:b=W.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case U.UploadErrorCode.FilePartiallyUploaded:b=W.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case U.UploadErrorCode.FileNoUploaded:b=W.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case U.UploadErrorCode.MissingTempFolder:b=W.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case U.UploadErrorCode.FileOnSaveingError:b=W.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case U.UploadErrorCode.FileType:b=W.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=W.i18n("UPLOAD/ERROR_UNKNOWN")}return b},W.delegateRun=function(a,b,c,d){a&&a[b]&&(d=W.pInt(d),0>=d?a[b].apply(a,W.isArray(c)?c:[]):f.delay(function(){a[b].apply(a,W.isArray(c)?c:[])},d))},W.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===U.EventKeyCode.S)return void b.preventDefault();if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;d===U.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},W.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=W.isUnd(d)?!0:d,e.canExecute=c.computed(W.isFunc(d)?function(){return e.enabled()&&d.call(a)}:function(){return e.enabled()&&!!d}),e},W.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(U.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(U.InterfaceAnimation.Full),b.contactsAutosave=c.observable(!1),Z.sAnimationType=U.InterfaceAnimation.Full,b.allowThemes=c.observable(!0),b.allowCustomLogin=c.observable(!1),b.allowLanguagesOnSettings=c.observable(!0),b.allowLanguagesOnLogin=c.observable(!0),b.desktopNotifications=c.observable(!1),b.useThreads=c.observable(!0),b.replySameFolder=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.layout=c.observable(U.Layout.SidePreview),b.usePreviewPane=c.computed(function(){return U.Layout.NoPreview!==b.layout()}),b.interfaceAnimation.subscribe(function(a){if(Z.bMobileDevice||a===U.InterfaceAnimation.None)db.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),Z.sAnimationType=U.InterfaceAnimation.None;else switch(a){case U.InterfaceAnimation.Full:db.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),Z.sAnimationType=a;break;case U.InterfaceAnimation.Normal:db.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),Z.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=U.DesktopNotifications.NotSupported;if(gb&&gb.permission)switch(gb.permission.toLowerCase()){case"granted":c=U.DesktopNotifications.Allowed;break;case"denied":c=U.DesktopNotifications.Denied;break;case"default":c=U.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&U.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();U.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):U.DesktopNotifications.NotAllowed===c?gb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),U.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()?b.desktopNotifications()?b.desktopNotifications.valueHasMutated():b.desktopNotifications(!0):b.desktopNotifications()?b.desktopNotifications(!1):b.desktopNotifications.valueHasMutated()}):b.desktopNotifications(!1)}else b.desktopNotifications(!1)}}),b.language=c.observable(""),b.languages=c.observableArray([]),b.mainLanguage=c.computed({read:b.language,write:function(a){a!==b.language()?-1=b.diff(c,"hours")?d:b.format("L")===c.format("L")?W.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?W.i18n("MESSAGE_LIST/YESTERDAY_AT",{TIME:c.format("LT")}):c.format(b.year()===c.year()?"D MMM.":"LL")},a)},W.isFolderExpanded=function(a){var b=hb.local().get(U.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},W.setExpandedFolder=function(a,b){var c=hb.local().get(U.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),hb.local().set(U.ClientSideKeyName.ExpandedFolders,c)},W.initLayoutResizer=function(a,c,d){var e=60,f=155,g=b(a),h=b(c),i=hb.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=W.pInt(hb.local().get(d))||f;j(b>f?b:f)}},l=function(a,b){b&&b.size&&b.size.width&&(hb.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}),hb.sub("left-panel.off",function(){k(!0)}),hb.sub("left-panel.on",function(){k(!1)})},W.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&&0100)&&(a.addClass("rl-bq-switcher hidden-bq"),b('').insertBefore(a).click(function(){a.toggleClass("hidden-bq"),W.windowResize()}).after("
").before("
"))})}},W.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()}))},W.toggleMessageBlockquote=function(a){a&&a.find(".rlBlockquoteSwitcher").click()},W.extendAsViewModel=function(a,b,c){b&&(c||(c=l),b.__name=a,X.regViewModelHook(a,b),f.extend(b.prototype,c.prototype))},W.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},$.settings.push(a)},W.removeSettingsViewModel=function(a){$["settings-removed"].push(a)},W.disableSettingsViewModel=function(a){$["settings-disabled"].push(a)},W.convertThemeName=function(a){return"@custom"===a.substr(-7)&&(a=W.trim(a.substring(0,a.length-7))),W.trim(a.replace(/[^a-zA-Z]+/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},W.quoteName=function(a){return a.replace(/["]/g,'\\"')},W.microtime=function(){return(new Date).getTime()},W.convertLangName=function(a,b){return W.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},W.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=W.isUnd(a)?32:W.pInt(a);b.length>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;c>i;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<>>29,g}function m(a){var b,c,d="",e="";for(c=0;3>=c;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;cd?b+=String.fromCharCode(d):d>127&&2048>d?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o/g,">").replace(/")},W.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},W.defautOptionsAfterRender=function(a,c){c&&!W.isUnd(c.disabled)&&a&&b(a).toggleClass("disabled",c.disabled).prop("disabled",c.disabled)},W.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+W.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")),W.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+W.encodeHtml(e)+'
'),h.document.close(),g=h.document.createElement("script"),g.type="text/javascript",g.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}",h.document.getElementsByTagName("head")[0].appendChild(g)},W.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=W.isUnd(d)?1e3:W.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?U.SaveSettingsStep.TrueResult:U.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,U.SaveSettingsStep.Idle)},d)}},W.settingsSaveHelperSimpleFunction=function(a,b){return W.settingsSaveHelperFunction(null,a,b,1e3)},W.htmlToPlain=function(a){var c="",d="> ",e=function(){if(arguments&&1\n",a.replace(/\n([> ]+)/gm,function(){return arguments&&1]*>(.|[\s\S\r\n]*)<\/div>/gim,f),a="\n"+b.trim(a)+"\n"),a}return""},g=function(){return arguments&&1/g,">"):""},h=function(){if(arguments&&1/gim,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/]*>/gim,"\n_______________________________\n\n").replace(/]*>/gim,"").replace(/]*>(.|[\s\S\r\n]*)<\/div>/gim,f).replace(/]*>/gim,"\n__bq__start__\n").replace(/<\/blockquote>/gim,"\n__bq__end__\n").replace(/]*>(.|[\s\S\r\n]*)<\/a>/gim,h).replace(/ /gi," ").replace(/<[^>]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,""),c.replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__(.|[\s\S\r\n]*)__bq__end__/gm,e).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")},W.plainToHtml=function(a){return a.toString().replace(/&/g,"&").replace(/>/g,">").replace(/")},W.resizeAndCrop=function(b,c,d){var e=new a.Image;e.onload=function(){var a=[0,0],b=document.createElement("canvas"),e=b.getContext("2d");b.width=c,b.height=c,a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width],e.fillStyle="#fff",e.fillRect(0,0,c,c),e.drawImage(this,a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,c,c),d(b.toDataURL("image/jpeg"))},e.src=b},W.computedPagenatorHelper=function(a,b){return function(){var c=0,d=0,e=2,f=[],g=a(),h=b(),i=function(a,b,c){var d={current:a===g,name:W.isUnd(c)?a.toString():c.toString(),custom:W.isUnd(c)?!1:!0,title:W.isUnd(c)?"":a.toString(),value:a.toString()};(W.isUnd(b)?0:!b)?f.unshift(d):f.push(d)};if(h>1||h>0&&g>h){for(g>h?(i(h),c=h,d=h):((3>=g||g>=h-2)&&(e+=2),i(g),c=g,d=g);e>0;)if(c-=1,d+=1,c>0&&(i(c,!1),e--),h>=d)i(d,!0),e--;else if(0>=c)break;3===c?i(2,!1):c>3&&i(Math.round((c-1)/2),!1,"..."),h-2===d?i(h-1,!0):h-2>d&&i(Math.round((h+d)/2),!0,"..."),c>1&&i(1,!1),h>d&&i(h,!0)}return f}},W.selectElement=function(b){if(a.getSelection){var c=a.getSelection();c.removeAllRanges();var d=document.createRange();d.selectNodeContents(b),c.addRange(d)}else if(document.selection){var e=document.body.createTextRange();e.moveToElementText(b),e.select()}},W.disableKeyFilter=function(){a.key&&(key.filter=function(){return hb.data().useKeyboardShortcuts()})},W.restoreKeyFilter=function(){a.key&&(key.filter=function(a){if(hb.data().useKeyboardShortcuts()){var b=a.target||a.srcElement,c=b?b.tagName:"";return c=c.toUpperCase(),!("INPUT"===c||"SELECT"===c||"TEXTAREA"===c||b&&"DIV"===c&&"editorHtmlArea"===b.className&&b.contentEditable)}return!1})},W.detectDropdownVisibility=f.debounce(function(){Z.dropdownVisibility(!!f.find(_,function(a){return a.hasClass("open")}))},50),Y={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return Y.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=Y._utf8_encode(a);j>2,f=(3&b)<<4|c>>4,g=(15&c)<<2|d>>6,h=63&d,isNaN(c)?g=h=64:isNaN(d)&&(h=64),i=i+this._keyStr.charAt(e)+this._keyStr.charAt(f)+this._keyStr.charAt(g)+this._keyStr.charAt(h);return i},decode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");j>4,c=(15&f)<<4|g>>2,d=(3&g)<<6|h,i+=String.fromCharCode(b),64!==g&&(i+=String.fromCharCode(c)),64!==h&&(i+=String.fromCharCode(d));return Y._utf8_decode(i)},_utf8_encode:function(a){a=a.replace(/\r\n/g,"\n");for(var b="",c=0,d=a.length,e=0;d>c;c++)e=a.charCodeAt(c),128>e?b+=String.fromCharCode(e):e>127&&2048>e?(b+=String.fromCharCode(e>>6|192),b+=String.fromCharCode(63&e|128)):(b+=String.fromCharCode(e>>12|224),b+=String.fromCharCode(e>>6&63|128),b+=String.fromCharCode(63&e|128));return b},_utf8_decode:function(a){for(var b="",c=0,d=0,e=0,f=0;cd?(b+=String.fromCharCode(d),c++):d>191&&224>d?(e=a.charCodeAt(c+1),b+=String.fromCharCode((31&d)<<6|63&e),c+=2):(e=a.charCodeAt(c+1),f=a.charCodeAt(c+2),b+=String.fromCharCode((15&d)<<12|(63&e)<<6|63&f),c+=3);return b}},c.bindingHandlers.tooltip={init:function(a,d){if(!Z.bMobileDevice){var e=b(a),f=e.data("tooltip-class")||"",g=e.data("tooltip-placement")||"top";e.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:g,trigger:"hover",title:function(){return e.is(".disabled")||Z.dropdownVisibility()?"":''+W.i18n(c.utils.unwrapObservable(d()))+""}}).click(function(){e.tooltip("hide")}),Z.dropdownVisibility.subscribe(function(a){a&&e.tooltip("hide")})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a),e=d.data("tooltip-class")||"",f=d.data("tooltip-placement")||"top";d.tooltip({delay:{show:500,hide:100},html:!0,container:"body",placement:f,title:function(){return d.is(".disabled")||Z.dropdownVisibility()?"":''+c()()+""}}).click(function(){d.tooltip("hide")}),Z.dropdownVisibility.subscribe(function(a){a&&d.tooltip("hide")})}},c.bindingHandlers.tooltip3={init:function(a){var c=b(a);c.tooltip({container:"body",trigger:"hover manual",title:function(){return c.data("tooltip3-data")||""}}),Z.dropdownVisibility.subscribe(function(a){a&&c.tooltip("hide")}),fb.click(function(){c.tooltip("hide")})},update:function(a,d){var e=c.utils.unwrapObservable(d());""===e?b(a).data("tooltip3-data","").tooltip("hide"):b(a).data("tooltip3-data",e).tooltip("show")}},c.bindingHandlers.registrateBootstrapDropdown={init:function(a){_.push(b(a))}},c.bindingHandlers.openDropdownTrigger={update:function(a,d){if(c.utils.unwrapObservable(d())){var e=b(a);e.hasClass("open")||(e.find(".dropdown-toggle").dropdown("toggle"),W.detectDropdownVisibility()),d()(!1)}}},c.bindingHandlers.dropdownCloser={init:function(a){b(a).closest(".dropdown").on("click",".e-item",function(){b(a).dropdown("toggle")})}},c.bindingHandlers.popover={init:function(a,d){b(a).popover(c.utils.unwrapObservable(d()))}},c.bindingHandlers.csstext={init:function(a,d){a&&a.styleSheet&&!W.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))},update:function(a,d){a&&a.styleSheet&&!W.isUnd(a.styleSheet.cssText)?a.styleSheet.cssText=c.utils.unwrapObservable(d()):b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.resizecrop={init:function(a){b(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,c){c()(),b(a).resizecrop({width:"100",height:"100"})}},c.bindingHandlers.onEnter={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&13===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.onEsc={init:function(c,d,e,f){b(c).on("keypress",function(e){e&&27===a.parseInt(e.keyCode,10)&&(b(c).trigger("change"),d().call(f))})}},c.bindingHandlers.clickOnTrue={update:function(a,d){c.utils.unwrapObservable(d())&&b(a).click()}},c.bindingHandlers.modal={init:function(a,d){b(a).toggleClass("fade",!Z.bMobileDevice).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("shown",function(){W.windowResize()}).find(".close").click(function(){d()(!1)})},update:function(a,d){b(a).modal(c.utils.unwrapObservable(d())?"show":"hide")}},c.bindingHandlers.i18nInit={init:function(a){W.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),W.i18nToNode(a)}},c.bindingHandlers.link={update:function(a,d){b(a).attr("href",c.utils.unwrapObservable(d()))}},c.bindingHandlers.title={update:function(a,d){b(a).attr("title",c.utils.unwrapObservable(d()))}},c.bindingHandlers.textF={init:function(a,d){b(a).text(c.utils.unwrapObservable(d()))}},c.bindingHandlers.initDom={init:function(a,b){b()(a)}},c.bindingHandlers.initResizeTrigger={init:function(a,d){var e=c.utils.unwrapObservable(d());b(a).css({height:e[1],"min-height":e[1]})},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=W.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=W.pInt(e[2]),g=eb.height()-h,g>f&&(f=g),b(a).css({height:f,"min-height":f}))}},c.bindingHandlers.appendDom={update:function(a,d){b(a).hide().empty().append(c.utils.unwrapObservable(d())).show()}},c.bindingHandlers.draggable={init:function(d,e,f){if(!Z.bMobileDevice){var g=100,h=3,i=f(),j=i&&i.droppableSelector?i.droppableSelector:"",k={distance:20,handle:".dragHandle",cursorAt:{top:22,left:3},refreshPositions:!0,scroll:!0};j&&(k.drag=function(c){b(j).each(function(){var d=null,e=null,f=b(this),i=f.offset(),j=i.top+f.height();a.clearInterval(f.data("timerScroll")),f.data("timerScroll",!1),c.pageX>=i.left&&c.pageX<=i.left+f.width()&&(c.pageY>=j-g&&c.pageY<=j&&(d=function(){f.scrollTop(f.scrollTop()+h),W.windowResize()},f.data("timerScroll",a.setInterval(d,10)),d()),c.pageY>=i.top&&c.pageY<=i.top+g&&(e=function(){f.scrollTop(f.scrollTop()-h),W.windowResize()},f.data("timerScroll",a.setInterval(e,10)),e()))})},k.stop=function(){b(j).each(function(){a.clearInterval(b(this).data("timerScroll")),b(this).data("timerScroll",!1)})}),k.helper=function(a){return e()(a&&a.target?c.dataFor(a.target):null)},b(d).draggable(k).on("mousedown",function(){W.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!Z.bMobileDevice){var e=c(),f=d(),g=f&&f.droppableOver?f.droppableOver:null,h=f&&f.droppableOut?f.droppableOut:null,i={tolerance:"pointer",hoverClass:"droppableHover"};e&&(i.drop=function(a,b){e(a,b)},g&&(i.over=function(a,b){g(a,b)}),h&&(i.out=function(a,b){h(a,b)}),b(a).droppable(i))}}},c.bindingHandlers.nano={init:function(a){Z.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],input[type=email],input[type=password],select,textarea")?"input":"custom"),"custom"===c.data("save-trigger-type")?c.append('  ').addClass("settings-saved-trigger"):c.addClass("settings-saved-trigger-input")},update:function(a,d){var e=c.utils.unwrapObservable(d()),f=b(a);if("custom"===f.data("save-trigger-type"))switch(e.toString()){case"1":f.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case"0":f.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case"-2":f.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:f.find(".animated").hide().end().find(".error,.success").removeClass("visible")}else switch(e.toString()){case"1":f.addClass("success").removeClass("error");break;case"0":f.addClass("error").removeClass("success");break;case"-2":break;default:f.removeClass("error success")}}},c.bindingHandlers.emailsTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!0,focusCallback:g,inputDelimiters:[",",";"],autoCompleteSource:function(a,b){hb.getAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=W.trim(a),c=null;return""!==b?(c=new o,c.mailsoParse(b),c.clearDuplicateName(),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("EmailsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("EmailsTagsValue")!==a&&(d.val(a),d.data("EmailsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.contactTags={init:function(a,c){var d=b(a),e=c(),g=function(a){e&&e.focusTrigger&&e.focusTrigger(a)};d.inputosaurus({parseOnBlur:!0,allowDragAndDrop:!1,focusCallback:g,inputDelimiters:[";"],outputDelimiter:";",autoCompleteSource:function(a,b){hb.getContactsTagsAutocomplete(a.term,function(a){b(f.map(a,function(a){return a.toLine(!1)}))})},parseHook:function(a){return f.map(a,function(a){var b=W.trim(a),c=null;return""!==b?(c=new p,c.name(b),[c.toLine(!1),c]):[b,null]})},change:f.bind(function(a){d.data("ContactsTagsValue",a.target.value),e(a.target.value)},this)}),e.subscribe(function(a){d.data("ContactsTagsValue")!==a&&(d.val(a),d.data("ContactsTagsValue",a),d.inputosaurus("refresh"))}),e.focusTrigger&&e.focusTrigger.subscribe(function(a){a&&d.inputosaurus("focus")})}},c.bindingHandlers.command={init:function(a,d,e,f){var g=b(a),h=d();if(!h||!h.enabled||!h.canExecute)throw new Error("You are not using command function");g.addClass("command"),c.bindingHandlers[g.is("form")?"submit":"click"].init.apply(f,arguments)},update:function(a,c){var d=!0,e=b(a),f=c();d=f.enabled(),e.toggleClass("command-not-enabled",!d),d&&(d=f.canExecute(),e.toggleClass("command-can-not-be-execute",!d)),e.toggleClass("command-disabled disable disabled",!d).toggleClass("no-disabled",!!d),(e.is("input")||e.is("button"))&&e.prop("disabled",!d)}},c.extenders.trimmer=function(a){var b=c.computed({read:a,write:function(b){a(W.trim(b.toString()))},owner:this});return b(a()),b},c.extenders.reversible=function(a){var b=a();return a.commit=function(){b=a()},a.reverse=function(){a(b)},a.commitedValue=function(){return b},a},c.extenders.toggleSubscribe=function(a,b){return a.subscribe(b[1],b[0],"beforeChange"),a.subscribe(b[2],b[0]),a},c.extenders.falseTimeout=function(b,c){return b.iTimeout=0,b.subscribe(function(d){d&&(a.clearTimeout(b.iTimeout),b.iTimeout=a.setTimeout(function(){b(!1),b.iTimeout=0},W.pInt(c)))}),b},c.observable.fn.validateNone=function(){return this.hasError=c.observable(!1),this},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=W.trim(a),this.hasError(""!==a&&!/^[^@\s]+@[^@\s]+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateSimpleEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=W.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),W.isFunc(a)&&(this.subscribe(function(b){this.hasFuncError(!a(b))},this),this.valueHasMutated()),this},g.prototype.root=function(){return this.sBase},g.prototype.attachmentDownload=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.attachmentPreview=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/View/"+a},g.prototype.attachmentPreviewAsPlain=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.upload=function(){return this.sServer+"/Upload/"+this.sSpecSuffix+"/"},g.prototype.uploadContacts=function(){return this.sServer+"/UploadContacts/"+this.sSpecSuffix+"/"},g.prototype.uploadBackground=function(){return this.sServer+"/UploadBackground/"+this.sSpecSuffix+"/"},g.prototype.append=function(){return this.sServer+"/Append/"+this.sSpecSuffix+"/"},g.prototype.change=function(b){return this.sServer+"/Change/"+this.sSpecSuffix+"/"+a.encodeURIComponent(b)+"/"},g.prototype.ajax=function(a){return this.sServer+"/Ajax/"+this.sSpecSuffix+"/"+a},g.prototype.messageViewLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ViewAsPlain/"+a},g.prototype.messageDownloadLink=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/Download/"+a},g.prototype.inbox=function(){return this.sBase+"mailbox/Inbox"},g.prototype.messagePreview=function(){return this.sBase+"mailbox/message-preview"},g.prototype.settings=function(a){var b=this.sBase+"settings";return W.isUnd(a)||""===a||(b+="/"+a),b},g.prototype.admin=function(a){var b=this.sBase;switch(a){case"AdminDomains":b+="domains";break;case"AdminSecurity":b+="security";break;case"AdminLicensing":b+="licensing"}return b},g.prototype.mailBox=function(a,b,c){b=W.isNormal(b)?W.pInt(b):1,c=W.pString(c);var d=this.sBase+"mailbox/";return""!==a&&(d+=encodeURI(a)),b>1&&(d=d.replace(/[\/]+$/,""),d+="/p"+b),""!==c&&(d=d.replace(/[\/]+$/,""),d+="/"+encodeURI(c)),d},g.prototype.phpInfo=function(){return this.sServer+"Info"},g.prototype.langLink=function(a){return this.sServer+"/Lang/0/"+encodeURI(a)+"/"+this.sVersion+"/"},g.prototype.getUserPicUrlFromHash=function(a){return this.sServer+"/Raw/"+this.sSpecSuffix+"/UserPic/"+a+"/"+this.sVersion+"/"},g.prototype.exportContactsVcf=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsVcf/"},g.prototype.exportContactsCsv=function(){return this.sServer+"/Raw/"+this.sSpecSuffix+"/ContactsCsv/"},g.prototype.emptyContactPic=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return"rainloop/v/"+this.sVersion+"/static/sounds/"+a },g.prototype.themePreviewLink=function(a){var b="rainloop/v/"+this.sVersion+"/";return"@custom"===a.substr(-7)&&(a=W.trim(a.substring(0,a.length-7)),b=""),b+"themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return"rainloop/v/"+this.sVersion+"/static/css/images/icom-message-notification.png"},g.prototype.openPgpJs=function(){return"rainloop/v/"+this.sVersion+"/static/js/openpgp.min.js"},g.prototype.socialGoogle=function(){return this.sServer+"SocialGoogle"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialTwitter=function(){return this.sServer+"SocialTwitter"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},g.prototype.socialFacebook=function(){return this.sServer+"SocialFacebook"+(""!==this.sSpecSuffix?"/"+this.sSpecSuffix+"/":"")},X.oViewModelsHooks={},X.oSimpleHooks={},X.regViewModelHook=function(a,b){b&&(b.__hookName=a)},X.addHook=function(a,b){W.isFunc(b)&&(W.isArray(X.oSimpleHooks[a])||(X.oSimpleHooks[a]=[]),X.oSimpleHooks[a].push(b))},X.runHook=function(a,b){W.isArray(X.oSimpleHooks[a])&&(b=b||[],f.each(X.oSimpleHooks[a],function(a){a.apply(null,b)}))},X.mainSettingsGet=function(a){return hb?hb.settingsGet(a):null},X.remoteRequest=function(a,b,c,d,e,f){hb&&hb.remote().defaultRequest(a,b,c,d,e,f)},X.settingsGet=function(a,b){var c=X.mainSettingsGet("Plugins");return c=c&&W.isUnd(c[a])?null:c[a],c?W.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(T.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(T.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(T.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!W.isUnd(d[a])?d[a]:null}catch(e){}return d},i.supported=function(){return!!a.localStorage},i.prototype.set=function(b,c){var d=a.localStorage[T.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[T.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[T.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!W.isUnd(d[b])?d[b]:null}catch(e){}return d},j.prototype.oDriver=null,j.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1},j.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+a):null},k.prototype.bootstart=function(){},l.prototype.sPosition="",l.prototype.sTemplate="",l.prototype.viewModelName="",l.prototype.viewModelDom=null,l.prototype.viewModelTemplate=function(){return this.sTemplate},l.prototype.viewModelPosition=function(){return this.sPosition},l.prototype.cancelCommand=l.prototype.closeCommand=function(){},l.prototype.storeAndSetKeyScope=function(){this.sCurrentKeyScope=hb.data().keyScope(),hb.data().keyScope(this.sDefaultKeyScope)},l.prototype.restoreKeyScope=function(){hb.data().keyScope(this.sCurrentKeyScope)},l.prototype.registerPopupKeyDown=function(){var a=this;eb.on("keydown",function(b){if(b&&a.modalVisibility&&a.modalVisibility()){if(!this.bDisabeCloseOnEsc&&U.EventKeyCode.Esc===b.keyCode)return W.delegateRun(a,"cancelCommand"),!1;if(U.EventKeyCode.Backspace===b.keyCode&&!W.inFocus())return!1}return!0})},m.prototype.oCross=null,m.prototype.sScreenName="",m.prototype.aViewModels=[],m.prototype.viewModels=function(){return this.aViewModels},m.prototype.screenName=function(){return this.sScreenName},m.prototype.routes=function(){return null},m.prototype.__cross=function(){return this.oCross},m.prototype.__start=function(){var a=this.routes(),b=null,c=null;W.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||W.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.constructorEnd=function(a){W.isFunc(a.__constructor_end)&&a.__constructor_end.call(a)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.hideLoading=function(){b("#rl-loading").hide()},n.prototype.routeOff=function(){e.changed.active=!1},n.prototype.routeOn=function(){e.changed.active=!0},n.prototype.setBoot=function(a){return W.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||W.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),g=e.viewModelPosition(),h=b("#rl-content #rl-"+g.toLowerCase()),i=null;a.__builded=!0,a.__vm=e,e.data=hb.data(),e.viewModelName=a.__name,h&&1===h.length?(i=b("
").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=W.createCommand(e,function(){ab.hideScreenPopup(a)}),e.modalVisibility.subscribe(function(a){var b=this;a?(this.viewModelDom.show(),this.storeAndSetKeyScope(),hb.popupVisibilityNames.push(this.viewModelName),e.viewModelDom.css("z-index",3e3+hb.popupVisibilityNames().length+10),W.delegateRun(this,"onFocus",[],500)):(W.delegateRun(this,"onHide"),this.restoreKeyScope(),hb.popupVisibilityNames.remove(this.viewModelName),e.viewModelDom.css("z-index",2e3),f.delay(function(){b.viewModelDom.hide()},300))},e)),X.runHook("view-model-pre-build",[a.__name,e,i]),c.applyBindings(e,i[0]),W.delegateRun(e,"onBuild",[i]),e&&"Popups"===g&&e.registerPopupKeyDown(),X.runHook("view-model-post-build",[a.__name,e,i])):W.log("Cannot find view model position: "+g)}return a?a.__vm:null},n.prototype.applyExternal=function(a,b){a&&b&&c.applyBindings(a,b)},n.prototype.hideScreenPopup=function(a){a&&a.__vm&&a.__dom&&(a.__vm.modalVisibility(!1),X.runHook("view-model-on-hide",[a.__name,a.__vm]))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__vm.modalVisibility(!0),W.delegateRun(a.__vm,"onShow",b||[]),X.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===W.pString(a)&&(a=this.sDefaultScreenName),""!==a&&(d=this.screen(a),d||(d=this.screen(this.sDefaultScreenName),d&&(b=a+"/"+b,a=this.sDefaultScreenName)),d&&d.__started&&(d.__builded||(d.__builded=!0,W.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),W.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(W.delegateRun(c.oCurrentScreen,"onHide"),W.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.hide(),a.__vm.viewModelVisibility(!1),W.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(W.delegateRun(c.oCurrentScreen,"onShow"),X.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),W.isNonEmptyArray(c.oCurrentScreen.viewModels())&&f.each(c.oCurrentScreen.viewModels(),function(a){a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()&&(a.__dom.show(),a.__vm.viewModelVisibility(!0),W.delegateRun(a.__vm,"onShow"),W.delegateRun(a.__vm,"onFocus",[],200),X.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){b("#rl-content").css({visibility:"hidden"}),f.each(a,function(a){var b=new a,c=b?b.screenName():"";b&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=b)},this),f.each(this.oScreens,function(a){a&&!a.__started&&a.__start&&(a.__started=!0,a.__start(),X.runHook("screen-pre-start",[a.screenName(),a]),W.delegateRun(a,"onStart"),X.runHook("screen-post-start",[a.screenName(),a]))},this);var c=d.create();c.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(c.parse,c),e.changed.add(c.parse,c),e.init(),b("#rl-content").css({visibility:"visible"}),f.delay(function(){db.removeClass("rl-started-trigger").addClass("rl-started")},50)},n.prototype.setHash=function(a,b,c){a="#"===a.substr(0,1)?a.substr(1):a,a="/"===a.substr(0,1)?a.substr(1):a,c=W.isUnd(c)?!1:!!c,(W.isUnd(b)?1:!b)?(e.changed.active=!0,e[c?"replaceHash":"setHash"](a),e.setHash(a)):(e.changed.active=!1,e[c?"replaceHash":"setHash"](a),e.changed.active=!0)},n.prototype.bootstart=function(){return this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart(),this},ab=new n,o.newInstanceFromJson=function(a){var b=new o;return b.initByJson(a)?b:null},o.prototype.name="",o.prototype.email="",o.prototype.privateType=null,o.prototype.clear=function(){this.email="",this.name="",this.privateType=null},o.prototype.validate=function(){return""!==this.name||""!==this.email},o.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"},o.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")},o.prototype.type=function(){return null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=U.EmailType.Facebook),null===this.privateType&&(this.privateType=U.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){this.clear(),a=W.trim(a);var b=/(?:"([^"]+)")? ?,]+)>?,? ?/g,c=b.exec(a);c?(this.name=c[1]||"",this.email=c[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)},o.prototype.initByJson=function(a){var b=!1;return a&&"Object/Email"===a["@Object"]&&(this.name=W.trim(a.Name),this.email=W.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b,c){var d="";return""!==this.email&&(b=W.isUnd(b)?!1:!!b,c=W.isUnd(c)?!1:!!c,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+W.encodeHtml(this.name)+"":c?W.encodeHtml(this.name):this.name:(d=this.email,""!==this.name?b?d=W.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+W.encodeHtml(d)+""+W.encodeHtml(">"):(d='"'+this.name+'" <'+d+">",c&&(d=W.encodeHtml(d))):b&&(d=''+W.encodeHtml(this.email)+""))),d},o.prototype.mailsoParse=function(a){if(a=W.trim(a),""===a)return!1;for(var b=function(a,b,c){a+="";var d=a.length;return 0>b&&(b+=d),d="undefined"==typeof c?d:0>c?c+d:c+b,b>=a.length||0>b||b>d?!1:a.slice(b,d)},c=function(a,b,c,d){return 0>c&&(c+=a.length),d=void 0!==d?d:a.length,0>d&&(d=d+a.length-c),a.slice(0,c)+b.substr(0,d)+b.slice(d)+a.slice(c+d)},d="",e="",f="",g=!1,h=!1,i=!1,j=null,k=0,l=0,m=0;m0&&0===d.length&&(d=b(a,0,m)),h=!0,k=m);break;case">":h&&(l=m,e=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,h=!1);break;case"(":g||h||i||(i=!0,k=m);break;case")":i&&(l=m,f=b(a,k+1,l-k-1),a=c(a,"",k,l-k+1),l=0,m=0,k=0,i=!1);break;case"\\":m++}m++}return 0===e.length&&(j=a.match(/[^@\s]+@\S+/i),j&&j[0]?e=j[0]:d=a),e.length>0&&0===d.length&&0===f.length&&(d=a.replace(e,"")),e=W.trim(e).replace(/^[<]+/,"").replace(/[>]+$/,""),d=W.trim(d).replace(/^["']+/,"").replace(/["']+$/,""),f=W.trim(f).replace(/^[(]+/,"").replace(/[)]+$/,""),d=d.replace(/\\\\(.)/,"$1"),f=f.replace(/\\\\(.)/,"$1"),this.name=d,this.email=e,this.clearDuplicateName(),!0},o.prototype.inputoTagLine=function(){return 0(new a.Date).getTime()-l),n&&i.oRequests[n]&&(i.oRequests[n].__aborted&&(e="abort"),i.oRequests[n]=null),i.defaultResponse(c,n,e,b,f,d)}),n&&0
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),i.appendTo(h),e.data=hb.data(),e.viewModelDom=i,e.__rlSettingsData=g.__rlSettingsData,g.__dom=i,g.__builded=!0,g.__vm=e,c.applyBindings(e,i[0]),W.delegateRun(e,"onBuild",[i])):W.log("Cannot find sub settings view model position: SettingsSubScreen")),e&&f.defer(function(){d.oCurrentSubScreen&&(W.delegateRun(d.oCurrentSubScreen,"onHide"),d.oCurrentSubScreen.viewModelDom.hide()),d.oCurrentSubScreen=e,d.oCurrentSubScreen&&(d.oCurrentSubScreen.viewModelDom.show(),W.delegateRun(d.oCurrentSubScreen,"onShow"),W.delegateRun(d.oCurrentSubScreen,"onFocus",[],200),f.each(d.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)}),b("#rl-content .b-settings .b-content .content").scrollTop(0)),W.windowResize()})):ab.setHash(hb.link().settings(),!1,!0)},O.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(W.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},O.prototype.onBuild=function(){f.each($.settings,function(a){a&&a.__rlSettingsData&&!f.find($["settings-removed"],function(b){return b&&b===a})&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:c.observable(!1),disabled:!!f.find($["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},O.prototype.routes=function(){var a=f.find($.settings,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",c={subname:/^(.*)$/,normalize_:function(a,c){return c.subname=W.isUnd(c.subname)?b:W.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(P.prototype,m.prototype),P.prototype.onShow=function(){hb.setTitle("")},f.extend(Q.prototype,O.prototype),Q.prototype.onShow=function(){hb.setTitle("")},f.extend(R.prototype,k.prototype),R.prototype.oSettings=null,R.prototype.oPlugins=null,R.prototype.oLocal=null,R.prototype.oLink=null,R.prototype.oSubs={},R.prototype.download=function(b){var c=null,d=null,e=navigator.userAgent.toLowerCase();return e&&(e.indexOf("chrome")>-1||e.indexOf("chrome")>-1)&&(c=document.createElement("a"),c.href=b,document.createEvent&&(d=document.createEvent("MouseEvents"),d&&d.initEvent&&c.dispatchEvent))?(d.initEvent("click",!0,!0),c.dispatchEvent(d),!0):(Z.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},R.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},R.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},R.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=W.isNormal(bb)?bb:{}),W.isUnd(this.oSettings[a])?null:this.oSettings[a]},R.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=W.isNormal(bb)?bb:{}),this.oSettings[a]=b},R.prototype.setTitle=function(b){b=(W.isNormal(b)&&0