diff --git a/package.json b/package.json index e02b4c9a7..35ce088e4 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "RainLoop", "title": "RainLoop Webmail", "version": "1.4.1", - "release": "512", + "release": "513", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "Gruntfile.js", diff --git a/rainloop/v/0.0.0/static/css/less.css b/rainloop/v/0.0.0/static/css/less.css index 09398bb30..f7254b534 100644 --- a/rainloop/v/0.0.0/static/css/less.css +++ b/rainloop/v/0.0.0/static/css/less.css @@ -4083,10 +4083,10 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle { } .popups .b-languages-content.modal { z-index: 1103; - width: 520px; + width: 500px; } .popups .b-languages-content.exp { - width: 521px; + width: 501px; } .popups .b-languages-content .modal-header { background-color: #fff; @@ -4095,7 +4095,7 @@ html.rl-no-preview-pane #rl-right .ui-resizable-handle { display: inline-block; padding: 5px 15px; margin: 2px 5px; - width: 200px; + width: 180px; background-color: #fff; text-align: left; } @@ -5377,6 +5377,12 @@ html.rl-message-fullscreen .messageView .b-content .buttonFull { .b-admin-right .b-settings-content { padding: 20px; } +.b-admin-general .flag-selector { + padding-top: 5px; +} +.b-admin-general .flag-name { + border-bottom: 1px dashed #555; +} .b-admin-domains .process-place { width: 600px; padding: 14px 0; diff --git a/rainloop/v/0.0.0/static/js/admin.min.js b/rainloop/v/0.0.0/static/js/admin.min.js index abc2b1163..e74200931 100644 --- a/rainloop/v/0.0.0/static/js/admin.min.js +++ b/rainloop/v/0.0.0/static/js/admin.min.js @@ -1,4 +1,4 @@ /*! 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.sCdnStaticDomain=cb.settingsGet("CdnStaticDomain"),this.sVersion=cb.settingsGet("Version"),this.sSpecSuffix=cb.settingsGet("AuthAccountHash")||"0",this.sServer=(cb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}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.sPosition=S.pString(a),this.sTemplate=S.pString(b),this.viewModelName="",this.viewModelVisibility=c.observable(!1),"Popups"===this.sPosition&&(this.modalVisibility=c.observable(!1)),this.viewModelDom=null}function m(a,b){this.sScreenName=a,this.aViewModels=S.isArray(b)?b:[]}function n(){this.sDefaultScreenName="",this.oScreens={},this.oBoot=null,this.oCurrentScreen=null,this.popupVisibility=c.observable(!1),this.popupVisibility.subscribe(function(a){cb&&cb.popupVisibility(a)})}function o(a,b){this.email=a||"",this.name=b||"",this.privateType=null,this.clearDuplicateName()}function p(){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.imapServerFocus=c.observable(!1),this.smtpServerFocus=c.observable(!1),this.name=c.observable(""),this.imapServer=c.observable(""),this.imapPort=c.observable(P.Values.ImapDefaulPort),this.imapSecure=c.observable(Q.ServerSecure.None),this.imapShortLogin=c.observable(!1),this.smtpServer=c.observable(""),this.smtpPort=c.observable(P.Values.SmtpDefaulPort),this.smtpSecure=c.observable(Q.ServerSecure.None),this.smtpShortLogin=c.observable(!1),this.smtpAuth=c.observable(!0),this.whiteList=c.observable(""),this.imapServerFocus.subscribe(function(a){a&&""!==this.name()&&""===this.imapServer()&&this.imapServer(this.name())},this),this.smtpServerFocus.subscribe(function(a){a&&""!==this.imapServer()&&""===this.smtpServer()&&this.smtpServer(this.imapServer())},this),this.headerText=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=S.createCommand(this,function(){this.saving(!0),cb.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=S.createCommand(this,function(){this.whiteListPage(!1),this.testingDone(!1),this.testingImapError(!1),this.testingSmtpError(!1),this.testing(!0),cb.remote().testConnectionForDomain(f.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested),this.whiteListCommand=S.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())})}function q(){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"),_.on("error",function(a){cb&&a&&a.originalEvent&&a.originalEvent.message&&-1===S.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&cb.remote().jsError(S.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",$.attr("class"),S.microtime()-V.now)})}function O(){N.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var P={},Q={},R={},S={},T={},U={},V={},W={settings:[],"settings-removed":[],"settings-disabled":[]},X=null,Y=a.rainloopAppData||{},Z=a.rainloopI18N||{},$=b("html"),_=b(a),ab=b(a.document),bb=a.Notification&&a.Notification.requestPermission?a.Notification:null,cb=null;V.now=(new Date).getTime(),V.minuteTick=c.observable(!0),V.fiveMinuteTick=c.observable(!0),V.langChangeTick=c.observable(!0),V.iAjaxErrorCount=0,V.iTokenErrorCount=0,V.iMessageBodyCacheCount=0,V.bUnload=!1,V.sUserAgent=(navigator.userAgent||"").toLowerCase(),V.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},S.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=S.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},S.timeOutAction=function(){var b={};return function(c,d,e){S.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),S.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),S.audio=function(){var b=!1;return function(c,d){if(!1===b)if(V.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}}(),S.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},S.i18n=function(a,b,c){var d="",e=S.isUnd(Z[a])?S.isUnd(c)?a:c:Z[a];if(!S.isUnd(b)&&!S.isNull(b))for(d in b)S.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},S.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(S.i18n(c)):(c=a.data("i18n-html"),c&&a.html(S.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",S.i18n(c)))})})},S.i18nToDoc=function(){a.rainloopI18N&&(Z=a.rainloopI18N||{},S.i18nToNode(ab),V.langChangeTick(!V.langChangeTick())),a.rainloopI18N={}},S.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?V.langChangeTick.subscribe(function(){a&&a.call(b),c.call(b)}):a&&V.langChangeTick.subscribe(a,b)},S.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)},S.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},S.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()},S.replySubjectAdd=function(b,c){var d=null,e=S.trim(c);return null===(d=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||S.isUnd(d[1])?null===(d=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||S.isUnd(d[1])||S.isUnd(d[2])||S.isUnd(d[3])?e=b+": "+c:(e=d[1]+(S.pInt(d[2])+1)+d[3],e=d[1]+(S.pInt(d[2])+1)+d[3]):e=b+"[2]: "+d[1],e},S.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},S.friendlySize=function(a){return a=S.pInt(a),a>=1073741824?S.roundNumber(a/1073741824,1)+"GB":a>=1048576?S.roundNumber(a/1048576,1)+"MB":a>=1024?S.roundNumber(a/1024,0)+"KB":a+"B"},S.log=function(b){a.console&&a.console.log&&a.console.log(b)},S.getNotification=function(a){return a=S.pInt(a),S.isUnd(R[a])?"":R[a]},S.initNotificationLanguage=function(){R[Q.Notification.InvalidToken]=S.i18n("NOTIFICATIONS/INVALID_TOKEN"),R[Q.Notification.AuthError]=S.i18n("NOTIFICATIONS/AUTH_ERROR"),R[Q.Notification.AccessError]=S.i18n("NOTIFICATIONS/ACCESS_ERROR"),R[Q.Notification.ConnectionError]=S.i18n("NOTIFICATIONS/CONNECTION_ERROR"),R[Q.Notification.CaptchaError]=S.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),R[Q.Notification.SocialFacebookLoginAccessDisable]=S.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),R[Q.Notification.SocialTwitterLoginAccessDisable]=S.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),R[Q.Notification.SocialGoogleLoginAccessDisable]=S.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),R[Q.Notification.DomainNotAllowed]=S.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),R[Q.Notification.AccountNotAllowed]=S.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),R[Q.Notification.CantGetMessageList]=S.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),R[Q.Notification.CantGetMessage]=S.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),R[Q.Notification.CantDeleteMessage]=S.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),R[Q.Notification.CantMoveMessage]=S.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),R[Q.Notification.CantSaveMessage]=S.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),R[Q.Notification.CantSendMessage]=S.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),R[Q.Notification.InvalidRecipients]=S.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),R[Q.Notification.CantCreateFolder]=S.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),R[Q.Notification.CantRenameFolder]=S.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),R[Q.Notification.CantDeleteFolder]=S.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),R[Q.Notification.CantDeleteNonEmptyFolder]=S.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),R[Q.Notification.CantSubscribeFolder]=S.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),R[Q.Notification.CantUnsubscribeFolder]=S.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),R[Q.Notification.CantSaveSettings]=S.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),R[Q.Notification.CantSavePluginSettings]=S.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),R[Q.Notification.DomainAlreadyExists]=S.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),R[Q.Notification.CantInstallPackage]=S.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),R[Q.Notification.CantDeletePackage]=S.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),R[Q.Notification.InvalidPluginPackage]=S.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),R[Q.Notification.UnsupportedPluginPackage]=S.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),R[Q.Notification.LicensingServerIsUnavailable]=S.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),R[Q.Notification.LicensingExpired]=S.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),R[Q.Notification.LicensingBanned]=S.i18n("NOTIFICATIONS/LICENSING_BANNED"),R[Q.Notification.DemoSendMessageError]=S.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),R[Q.Notification.AccountAlreadyExists]=S.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),R[Q.Notification.MailServerError]=S.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),R[Q.Notification.UnknownNotification]=S.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),R[Q.Notification.UnknownError]=S.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},S.getUploadErrorDescByCode=function(a){var b="";switch(S.pInt(a)){case Q.UploadErrorCode.FileIsTooBig:b=S.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Q.UploadErrorCode.FilePartiallyUploaded:b=S.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Q.UploadErrorCode.FileNoUploaded:b=S.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Q.UploadErrorCode.MissingTempFolder:b=S.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Q.UploadErrorCode.FileOnSaveingError:b=S.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Q.UploadErrorCode.FileType:b=S.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=S.i18n("UPLOAD/ERROR_UNKNOWN")}return b},S.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===Q.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===Q.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},S.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=S.isUnd(d)?!0:d,e.canExecute=S.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},S.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(Q.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(Q.InterfaceAnimation.Full),V.sAnimationType=Q.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.usePreviewPane=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.interfaceAnimation.subscribe(function(a){if(V.bMobileDevice||a===Q.InterfaceAnimation.None)$.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),V.sAnimationType=Q.InterfaceAnimation.None;else switch(a){case Q.InterfaceAnimation.Full:$.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),V.sAnimationType=a;break;case Q.InterfaceAnimation.Normal:$.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),V.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=Q.DesktopNotifications.NotSupported;if(bb&&bb.permission)switch(bb.permission.toLowerCase()){case"granted":c=Q.DesktopNotifications.Allowed;break;case"denied":c=Q.DesktopNotifications.Denied;break;case"default":c=Q.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&Q.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();Q.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):Q.DesktopNotifications.NotAllowed===c?bb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),Q.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")?S.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?S.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},S.isFolderExpanded=function(a){var b=cb.local().get(Q.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},S.setExpandedFolder=function(a,b){var c=cb.local().get(Q.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),cb.local().set(Q.ClientSideKeyName.ExpandedFolders,c)},S.initLayoutResizer=function(a,c,d,e,g,h,i,j){e=e||300,g=g||500,h=h||g-e/2,i=i||300;var k=0,l=b(a),m=b(c),n=b(d),o=cb.local().get(j)||h,p=function(a,b,c){if(b||c){var d=n.width(),e=b?b.size.width/d*100:null;null===e&&c&&(e=l.width()/d*100),null!==e&&(l.css({width:"",height:"",right:""+(100-e)+"%"}),m.css({width:"",height:"",left:""+e+"%"})) -}},q=function(b,c){if(c&&c.element&&c.element[0].id&&"#"+c.element[0].id==""+a){var d=n.width();k=d-i,k=g>k?k:g,l.resizable("option","maxWidth",k),c.size&&c.size.width&&cb.local().set(j,c.size.width),p(null,null,!0)}};o&&l.width(o),k=n.width()-i,k=g>k?k:g,l.resizable({minWidth:e,maxWidth:k,handles:"e",resize:p,stop:p}),p(null,null,!0),_.resize(f.throttle(q,400))},S.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"),S.windowResize()}).after("
").before("
"))})}},S.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()}))},S.extendAsViewModel=function(a,b){b&&(b.__name=a,T.regViewModelHook(a,b),f.extend(b.prototype,l.prototype))},S.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},W.settings.push(a)},S.removeSettingsViewModel=function(a){W["settings-removed"].push(a)},S.disableSettingsViewModel=function(a){W["settings-disabled"].push(a)},S.convertThemeName=function(a){return S.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},S.quoteName=function(a){return a.replace(/["]/g,'\\"')},S.microtime=function(){return(new Date).getTime()},S.convertLangName=function(a){return S.i18n("LANGS_NAMES/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},S.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=S.isUnd(a)?32:S.pInt(a);b.length/g,">").replace(/")},S.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},S.defautOptionsAfterRender=function(a,b){b&&!S.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},S.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+S.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")),S.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+S.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)},S.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=S.isUnd(d)?1e3:S.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?Q.SaveSettingsStep.TrueResult:Q.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,Q.SaveSettingsStep.Idle)},d)}},S.settingsSaveHelperSimpleFunction=function(a,b){return S.settingsSaveHelperFunction(null,a,b,1e3)},S.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},U={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return U.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=U._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 U._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(!V.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+S.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={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.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.modal={init:function(a,d){b(a).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)})},update:function(a,d){var e=c.utils.unwrapObservable(d());b(a).modal(e?"show":"hide"),f.delay(function(){b(a).toggleClass("popup-active",e)},1)}},c.bindingHandlers.i18nInit={init:function(a){S.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),S.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=S.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=S.pInt(e[2]),g=_.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(!V.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),S.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),S.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(){S.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!V.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){V.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger1={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text]")?"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),g="custom"===f.data("save-trigger-type"),h=g?"":"-input";switch(e.toString()){case"1":f.find(".sst-animated"+h+",.sst-error"+h).hide().removeClass("sst-visible"+h).end().find(".sst-success"+h).show().addClass("sst-visible"+h);break;case"0":f.find(".sst-animated"+h+",.sst-success"+h).hide().removeClass("sst-visible"+h).end().find(".sst-error"+h).show().addClass("sst-visible"+h);break;case"-2":f.find(".sst-error"+h+",.sst-success"+h).hide().removeClass("sst-visible"+h).end().find(".sst-animated"+h).show().addClass("sst-visible"+h);break;default:f.find(".sst-animated"+h).hide().end().find(".sst-error"+h+",.sst-success"+h).removeClass("sst-visible"+h)}}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],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.select2={init:function(d,e){var g=0,h=100,i=null,j=new a.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),k=new a.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),l=function(){return""},m=function(a){cb.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,results:f.map(b,function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};b(d).addClass("ko-select2").select2({query:function(b){b&&(0===g?(m(b),g=a.setTimeout(S.emptyFunction,h)):(a.clearInterval(g),g=a.setTimeout(function(){m(b)},h)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;return null!==c?c:void 0},formatResult:function(a,b,c,d){var e=a&&a.c?a.c.select2Result(b):"";return""===e?d(a.text):e},createSearchChoice:function(a,b){return 0===b.length&&j.test(a)?{id:a,text:a}:null},formatNoMatches:l,formatSearching:function(){return S.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:l,formatSelectionTooBig:l,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,openOnEnter:!1}),c.utils.domNodeDisposal.addDisposeCallback(d,function(){b(d).select2("destroy")}),b(d).on("change",function(){for(var a=b(this).select2("data"),c=0,d=a.length,f=null,g=[];d>c;c++)f=a[c],f&&f.id&&(f.c||(f.c=new o,i=k.exec(S.trim(f.id)),i&&!S.isUnd(i[2])?(f.c.name=i[1],f.c.email=i[2]):f.c.email=f.id),g.push(f.c));e()(g)})},update:function(a,d){for(var e=c.utils.unwrapObservable(d()),f=0,g=e.length,h=null,i="",j=[];g>f;f++)h=e[f],i=h.toLine(!1),j.push({id:i,text:i,c:h});b(a).select2("data",j)}},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),(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(S.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},S.pInt(c)))}),b},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=S.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=S.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),S.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.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.settings=function(a){var b=this.sBase+"settings";return S.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=S.isNormal(b)?S.pInt(b):1,c=S.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.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},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+"/":"")},T.oViewModelsHooks={},T.oSimpleHooks={},T.regViewModelHook=function(a,b){b&&(b.__hookName=a)},T.addHook=function(a,b){S.isFunc(b)&&(S.isArray(T.oSimpleHooks[a])||(T.oSimpleHooks[a]=[]),T.oSimpleHooks[a].push(b))},T.runHook=function(a,b){S.isArray(T.oSimpleHooks[a])&&(b=b||[],f.each(T.oSimpleHooks[a],function(a){a.apply(null,b)}))},T.mainSettingsGet=function(a){return cb?cb.settingsGet(a):null},T.remoteRequest=function(a,b,c,d,e,f){cb&&cb.remote().defaultRequest(a,b,c,d,e,f)},T.settingsGet=function(a,b){var c=T.mainSettingsGet("Plugins");return c=c&&S.isUnd(c[a])?null:c[a],c?S.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(P.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(P.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(P.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!S.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[P.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[P.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[P.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!S.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(){},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;S.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||S.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.showLoading=function(){b("#rl-loading").show()},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 S.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||S.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,S.isArray(c)?c:[])},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=cb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b("
").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=S.createCommand(e,function(){X.hideScreenPopup(a)})),T.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),this.delegateRun(e,"onBuild",[h]),T.runHook("view-model-post-build",[a.__name,e,h])):S.log("Cannot find view model position: "+f)}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.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),f.defer(function(){a.__dom.find(".ko-select2").select2("close")}))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),T.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===S.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,S.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onHide"),S.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),c.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onShow"),T.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),S.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),c.delegateRun(a.__vm,"onShow"),T.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){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(),T.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),T.runHook("screen-post-start",[a.screenName(),a]))},this);var b=d.create();b.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(b.parse,b),e.changed.add(b.parse,b),e.init()},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=S.isUnd(c)?!1:!!c,(S.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},X=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.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=Q.EmailType.Facebook),null===this.privateType&&(this.privateType=Q.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){a=S.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=S.trim(a.Name),this.email=S.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b){var c="";return""!==this.email&&(b=S.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'")+'" target="_blank" tabindex="-1">'+S.encodeHtml(this.name)+"":this.name:(c=this.email,""!==this.name?c=b?S.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+S.encodeHtml(c)+""+S.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c=''+S.encodeHtml(this.email)+""))),c},o.prototype.select2Result=function(){var a="",b=cb.cache().getUserPic(this.email);return a+=""!==b?'':'',Q.EmailType.Facebook===this.type()?(a+=""+(0'):a+=""+(0('+this.name+")":this.email),a+""},o.prototype.select2Selection=function(a){var c="";if(Q.EmailType.Facebook===this.type()){if(c=0").text(c).appendTo(a),a.append(''),null}else c=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=cb.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])):S.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"),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)),S.windowResize()})):X.setHash(cb.link().settings(),!1,!0)},K.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(X.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},K.prototype.onBuild=function(){f.each(W.settings,function(a){a&&a.__rlSettingsData&&!f.find(W["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(W["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},K.prototype.routes=function(){var a=f.find(W.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=S.isUnd(c.subname)?b:S.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(L.prototype,m.prototype),L.prototype.onShow=function(){cb.setTitle("")},f.extend(M.prototype,K.prototype),M.prototype.onShow=function(){cb.setTitle("")},f.extend(N.prototype,k.prototype),N.prototype.oSettings=null,N.prototype.oLink=null,N.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):(V.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},N.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},N.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},N.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=S.isNormal(Y)?Y:{}),S.isUnd(this.oSettings[a])?null:this.oSettings[a]},N.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=S.isNormal(Y)?Y:{}),this.oSettings[a]=b},N.prototype.setTitle=function(b){b=(0').appendTo("body"),_.on("error",function(a){cb&&a&&a.originalEvent&&a.originalEvent.message&&-1===S.inArray(a.originalEvent.message,["Script error.","Uncaught Error: Error calling method on NPObject."])&&cb.remote().jsError(S.emptyFunction,a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno,location&&location.toString?location.toString():"",$.attr("class"),S.microtime()-V.now)})}function O(){N.call(this),this.oData=null,this.oRemote=null,this.oCache=null}var P={},Q={},R={},S={},T={},U={},V={},W={settings:[],"settings-removed":[],"settings-disabled":[]},X=null,Y=a.rainloopAppData||{},Z=a.rainloopI18N||{},$=b("html"),_=b(a),ab=b(a.document),bb=a.Notification&&a.Notification.requestPermission?a.Notification:null,cb=null;V.now=(new Date).getTime(),V.minuteTick=c.observable(!0),V.fiveMinuteTick=c.observable(!0),V.langChangeTick=c.observable(!0),V.iAjaxErrorCount=0,V.iTokenErrorCount=0,V.iMessageBodyCacheCount=0,V.bUnload=!1,V.sUserAgent=(navigator.userAgent||"").toLowerCase(),V.bIsiOSDevice=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""},S.splitPlainText=function(a,b){var c="",d="",e=a,f=0,g=0;for(b=S.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},S.timeOutAction=function(){var b={};return function(c,d,e){S.isUnd(b[c])&&(b[c]=0),a.clearTimeout(b[c]),b[c]=a.setTimeout(d,e)}}(),S.timeOutActionSecond=function(){var b={};return function(c,d,e){b[c]||(b[c]=a.setTimeout(function(){d(),b[c]=0},e))}}(),S.audio=function(){var b=!1;return function(c,d){if(!1===b)if(V.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}}(),S.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1},S.i18n=function(a,b,c){var d="",e=S.isUnd(Z[a])?S.isUnd(c)?a:c:Z[a];if(!S.isUnd(b)&&!S.isNull(b))for(d in b)S.hos(b,d)&&(e=e.replace("%"+d+"%",b[d]));return e},S.i18nToNode=function(a){f.defer(function(){b(".i18n",a).each(function(){var a=b(this),c="";c=a.data("i18n-text"),c?a.text(S.i18n(c)):(c=a.data("i18n-html"),c&&a.html(S.i18n(c)),c=a.data("i18n-placeholder"),c&&a.attr("placeholder",S.i18n(c)))})})},S.i18nToDoc=function(){a.rainloopI18N&&(Z=a.rainloopI18N||{},S.i18nToNode(ab),V.langChangeTick(!V.langChangeTick())),a.rainloopI18N={}},S.initOnStartOrLangChange=function(a,b,c){a&&a.call(b),c?V.langChangeTick.subscribe(function(){a&&a.call(b),c.call(b)}):a&&V.langChangeTick.subscribe(a,b)},S.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)},S.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=b(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}},S.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()},S.replySubjectAdd=function(b,c){var d=null,e=S.trim(c);return null===(d=new a.RegExp("^"+b+"[\\s]?\\:(.*)$","gi").exec(c))||S.isUnd(d[1])?null===(d=new a.RegExp("^("+b+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi").exec(c))||S.isUnd(d[1])||S.isUnd(d[2])||S.isUnd(d[3])?e=b+": "+c:(e=d[1]+(S.pInt(d[2])+1)+d[3],e=d[1]+(S.pInt(d[2])+1)+d[3]):e=b+"[2]: "+d[1],e},S.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)},S.friendlySize=function(a){return a=S.pInt(a),a>=1073741824?S.roundNumber(a/1073741824,1)+"GB":a>=1048576?S.roundNumber(a/1048576,1)+"MB":a>=1024?S.roundNumber(a/1024,0)+"KB":a+"B"},S.log=function(b){a.console&&a.console.log&&a.console.log(b)},S.getNotification=function(a){return a=S.pInt(a),S.isUnd(R[a])?"":R[a]},S.initNotificationLanguage=function(){R[Q.Notification.InvalidToken]=S.i18n("NOTIFICATIONS/INVALID_TOKEN"),R[Q.Notification.AuthError]=S.i18n("NOTIFICATIONS/AUTH_ERROR"),R[Q.Notification.AccessError]=S.i18n("NOTIFICATIONS/ACCESS_ERROR"),R[Q.Notification.ConnectionError]=S.i18n("NOTIFICATIONS/CONNECTION_ERROR"),R[Q.Notification.CaptchaError]=S.i18n("NOTIFICATIONS/CAPTCHA_ERROR"),R[Q.Notification.SocialFacebookLoginAccessDisable]=S.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE"),R[Q.Notification.SocialTwitterLoginAccessDisable]=S.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE"),R[Q.Notification.SocialGoogleLoginAccessDisable]=S.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE"),R[Q.Notification.DomainNotAllowed]=S.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED"),R[Q.Notification.AccountNotAllowed]=S.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED"),R[Q.Notification.CantGetMessageList]=S.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"),R[Q.Notification.CantGetMessage]=S.i18n("NOTIFICATIONS/CANT_GET_MESSAGE"),R[Q.Notification.CantDeleteMessage]=S.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE"),R[Q.Notification.CantMoveMessage]=S.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE"),R[Q.Notification.CantSaveMessage]=S.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE"),R[Q.Notification.CantSendMessage]=S.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE"),R[Q.Notification.InvalidRecipients]=S.i18n("NOTIFICATIONS/INVALID_RECIPIENTS"),R[Q.Notification.CantCreateFolder]=S.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"),R[Q.Notification.CantRenameFolder]=S.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER"),R[Q.Notification.CantDeleteFolder]=S.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER"),R[Q.Notification.CantDeleteNonEmptyFolder]=S.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER"),R[Q.Notification.CantSubscribeFolder]=S.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER"),R[Q.Notification.CantUnsubscribeFolder]=S.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER"),R[Q.Notification.CantSaveSettings]=S.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"),R[Q.Notification.CantSavePluginSettings]=S.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS"),R[Q.Notification.DomainAlreadyExists]=S.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS"),R[Q.Notification.CantInstallPackage]=S.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE"),R[Q.Notification.CantDeletePackage]=S.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE"),R[Q.Notification.InvalidPluginPackage]=S.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE"),R[Q.Notification.UnsupportedPluginPackage]=S.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"),R[Q.Notification.LicensingServerIsUnavailable]=S.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE"),R[Q.Notification.LicensingExpired]=S.i18n("NOTIFICATIONS/LICENSING_EXPIRED"),R[Q.Notification.LicensingBanned]=S.i18n("NOTIFICATIONS/LICENSING_BANNED"),R[Q.Notification.DemoSendMessageError]=S.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR"),R[Q.Notification.AccountAlreadyExists]=S.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS"),R[Q.Notification.MailServerError]=S.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"),R[Q.Notification.UnknownNotification]=S.i18n("NOTIFICATIONS/UNKNOWN_ERROR"),R[Q.Notification.UnknownError]=S.i18n("NOTIFICATIONS/UNKNOWN_ERROR")},S.getUploadErrorDescByCode=function(a){var b="";switch(S.pInt(a)){case Q.UploadErrorCode.FileIsTooBig:b=S.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case Q.UploadErrorCode.FilePartiallyUploaded:b=S.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case Q.UploadErrorCode.FileNoUploaded:b=S.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case Q.UploadErrorCode.MissingTempFolder:b=S.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case Q.UploadErrorCode.FileOnSaveingError:b=S.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case Q.UploadErrorCode.FileType:b=S.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=S.i18n("UPLOAD/ERROR_UNKNOWN")}return b},S.killCtrlAandS=function(b){if(b=b||a.event){var c=b.target||b.srcElement,d=b.keyCode||b.which;if(b.ctrlKey&&d===Q.EventKeyCode.S)return b.preventDefault(),void 0;if(c&&c.tagName&&c.tagName.match(/INPUT|TEXTAREA/i))return;b.ctrlKey&&d===Q.EventKeyCode.A&&(a.getSelection?a.getSelection().removeAllRanges():a.document.selection&&a.document.selection.clear&&a.document.selection.clear(),b.preventDefault())}},S.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=S.isUnd(d)?!0:d,e.canExecute=S.isFunc(d)?c.computed(function(){return e.enabled()&&d.call(a)}):c.computed(function(){return e.enabled()&&!!d}),e},S.initDataConstructorBySettings=function(b){b.editorDefaultType=c.observable(Q.EditorDefaultType.Html),b.showImages=c.observable(!1),b.interfaceAnimation=c.observable(Q.InterfaceAnimation.Full),V.sAnimationType=Q.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.usePreviewPane=c.observable(!0),b.useCheckboxesInList=c.observable(!0),b.interfaceAnimation.subscribe(function(a){if(V.bMobileDevice||a===Q.InterfaceAnimation.None)$.removeClass("rl-anim rl-anim-full").addClass("no-rl-anim"),V.sAnimationType=Q.InterfaceAnimation.None;else switch(a){case Q.InterfaceAnimation.Full:$.removeClass("no-rl-anim").addClass("rl-anim rl-anim-full"),V.sAnimationType=a;break;case Q.InterfaceAnimation.Normal:$.removeClass("no-rl-anim rl-anim-full").addClass("rl-anim"),V.sAnimationType=a}}),b.interfaceAnimation.valueHasMutated(),b.desktopNotificationsPermisions=c.computed(function(){b.desktopNotifications();var c=Q.DesktopNotifications.NotSupported;if(bb&&bb.permission)switch(bb.permission.toLowerCase()){case"granted":c=Q.DesktopNotifications.Allowed;break;case"denied":c=Q.DesktopNotifications.Denied;break;case"default":c=Q.DesktopNotifications.NotAllowed}else a.webkitNotifications&&a.webkitNotifications.checkPermission&&(c=a.webkitNotifications.checkPermission());return c}),b.useDesktopNotifications=c.computed({read:function(){return b.desktopNotifications()&&Q.DesktopNotifications.Allowed===b.desktopNotificationsPermisions()},write:function(a){if(a){var c=b.desktopNotificationsPermisions();Q.DesktopNotifications.Allowed===c?b.desktopNotifications(!0):Q.DesktopNotifications.NotAllowed===c?bb.requestPermission(function(){b.desktopNotifications.valueHasMutated(),Q.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")?S.i18n("MESSAGE_LIST/TODAY_AT",{TIME:c.format("LT")}):b.clone().subtract("days",1).format("L")===c.format("L")?S.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:c.format("LT")}):b.year()===c.year()?c.format("D MMM."):c.format("LL")},a)},S.isFolderExpanded=function(a){var b=cb.local().get(Q.ClientSideKeyName.ExpandedFolders);return f.isArray(b)&&-1!==f.indexOf(b,a)},S.setExpandedFolder=function(a,b){var c=cb.local().get(Q.ClientSideKeyName.ExpandedFolders);f.isArray(c)||(c=[]),b?(c.push(a),c=f.uniq(c)):c=f.without(c,a),cb.local().set(Q.ClientSideKeyName.ExpandedFolders,c)},S.initLayoutResizer=function(a,c,d,e,g,h,i,j){e=e||300,g=g||500,h=h||g-e/2,i=i||300; +var k=0,l=b(a),m=b(c),n=b(d),o=cb.local().get(j)||h,p=function(a,b,c){if(b||c){var d=n.width(),e=b?b.size.width/d*100:null;null===e&&c&&(e=l.width()/d*100),null!==e&&(l.css({width:"",height:"",right:""+(100-e)+"%"}),m.css({width:"",height:"",left:""+e+"%"}))}},q=function(b,c){if(c&&c.element&&c.element[0].id&&"#"+c.element[0].id==""+a){var d=n.width();k=d-i,k=g>k?k:g,l.resizable("option","maxWidth",k),c.size&&c.size.width&&cb.local().set(j,c.size.width),p(null,null,!0)}};o&&l.width(o),k=n.width()-i,k=g>k?k:g,l.resizable({minWidth:e,maxWidth:k,handles:"e",resize:p,stop:p}),p(null,null,!0),_.resize(f.throttle(q,400))},S.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"),S.windowResize()}).after("
").before("
"))})}},S.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()}))},S.extendAsViewModel=function(a,b){b&&(b.__name=a,T.regViewModelHook(a,b),f.extend(b.prototype,l.prototype))},S.addSettingsViewModel=function(a,b,c,d,e){a.__rlSettingsData={Label:c,Template:b,Route:d,IsDefault:!!e},W.settings.push(a)},S.removeSettingsViewModel=function(a){W["settings-removed"].push(a)},S.disableSettingsViewModel=function(a){W["settings-disabled"].push(a)},S.convertThemeName=function(a){return S.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))},S.quoteName=function(a){return a.replace(/["]/g,'\\"')},S.microtime=function(){return(new Date).getTime()},S.convertLangName=function(a,b){return S.i18n("LANGS_NAMES"+(!0===b?"_EN":"")+"/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)},S.fakeMd5=function(a){var b="",c="0123456789abcdefghijklmnopqrstuvwxyz";for(a=S.isUnd(a)?32:S.pInt(a);b.length/g,">").replace(/")},S.draggeblePlace=function(){return b('
 
').appendTo("#rl-hidden")},S.defautOptionsAfterRender=function(a,b){b&&!S.isUnd(b.disable)&&c.applyBindingsToNode(a,{disable:b.disable},b)},S.windowPopupKnockout=function(c,d,e,f){var g=null,h=a.open(""),i="__OpenerApplyBindingsUid"+S.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")),S.i18nToNode(d),n.prototype.applyExternal(c,b("#rl-content",d)[0]),a[i]=null,f(h)}},h.document.open(),h.document.write(''+S.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)},S.settingsSaveHelperFunction=function(a,b,c,d){return c=c||null,d=S.isUnd(d)?1e3:S.pInt(d),function(e,g,h,i,j){b.call(c,g&&g.Result?Q.SaveSettingsStep.TrueResult:Q.SaveSettingsStep.FalseResult),a&&a.call(c,e,g,h,i,j),f.delay(function(){b.call(c,Q.SaveSettingsStep.Idle)},d)}},S.settingsSaveHelperSimpleFunction=function(a,b){return S.settingsSaveHelperFunction(null,a,b,1e3)},S.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},U={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return U.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){var b,c,d,e,f,g,h,i="",j=0;for(a=U._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 U._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(!V.bMobileDevice){var e=b(a).data("tooltip-class")||"",f=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:f,trigger:"hover",title:function(){return''+S.i18n(c.utils.unwrapObservable(d()))+""}})}}},c.bindingHandlers.tooltip2={init:function(a,c){var d=b(a).data("tooltip-class")||"",e=b(a).data("tooltip-placement")||"top";b(a).tooltip({delay:{show:500,hide:100},html:!0,placement:e,title:function(){return''+c()()+""}})}},c.bindingHandlers.dropdown={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.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.modal={init:function(a,d){b(a).modal({keyboard:!1,show:c.utils.unwrapObservable(d())}).on("hidden",function(){d()(!1)})},update:function(a,d){var e=c.utils.unwrapObservable(d());b(a).modal(e?"show":"hide"),f.delay(function(){b(a).toggleClass("popup-active",e)},1)}},c.bindingHandlers.i18nInit={init:function(a){S.i18nToNode(a)}},c.bindingHandlers.i18nUpdate={update:function(a,b){c.utils.unwrapObservable(b()),S.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=S.pInt(e[1]),g=0,h=b(a).offset().top;h>0&&(h+=S.pInt(e[2]),g=_.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(!V.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),S.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),S.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(){S.removeInFocus()})}}},c.bindingHandlers.droppable={init:function(a,c,d){if(!V.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){V.bDisableNanoScroll||b(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}},c.bindingHandlers.saveTrigger1={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text]")?"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),g="custom"===f.data("save-trigger-type"),h=g?"":"-input";switch(e.toString()){case"1":f.find(".sst-animated"+h+",.sst-error"+h).hide().removeClass("sst-visible"+h).end().find(".sst-success"+h).show().addClass("sst-visible"+h);break;case"0":f.find(".sst-animated"+h+",.sst-success"+h).hide().removeClass("sst-visible"+h).end().find(".sst-error"+h).show().addClass("sst-visible"+h);break;case"-2":f.find(".sst-error"+h+",.sst-success"+h).hide().removeClass("sst-visible"+h).end().find(".sst-animated"+h).show().addClass("sst-visible"+h);break;default:f.find(".sst-animated"+h).hide().end().find(".sst-error"+h+",.sst-success"+h).removeClass("sst-visible"+h)}}},c.bindingHandlers.saveTrigger={init:function(a){var c=b(a);c.data("save-trigger-type",c.is("input[type=text],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.select2={init:function(d,e){var g=0,h=100,i=null,j=new a.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),k=new a.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),l=function(){return""},m=function(a){cb.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,results:f.map(b,function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};b(d).addClass("ko-select2").select2({query:function(b){b&&(0===g?(m(b),g=a.setTimeout(S.emptyFunction,h)):(a.clearInterval(g),g=a.setTimeout(function(){m(b)},h)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;return null!==c?c:void 0},formatResult:function(a,b,c,d){var e=a&&a.c?a.c.select2Result(b):"";return""===e?d(a.text):e},createSearchChoice:function(a,b){return 0===b.length&&j.test(a)?{id:a,text:a}:null},formatNoMatches:l,formatSearching:function(){return S.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:l,formatSelectionTooBig:l,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,openOnEnter:!1}),c.utils.domNodeDisposal.addDisposeCallback(d,function(){b(d).select2("destroy")}),b(d).on("change",function(){for(var a=b(this).select2("data"),c=0,d=a.length,f=null,g=[];d>c;c++)f=a[c],f&&f.id&&(f.c||(f.c=new o,i=k.exec(S.trim(f.id)),i&&!S.isUnd(i[2])?(f.c.name=i[1],f.c.email=i[2]):f.c.email=f.id),g.push(f.c));e()(g)})},update:function(a,d){for(var e=c.utils.unwrapObservable(d()),f=0,g=e.length,h=null,i="",j=[];g>f;f++)h=e[f],i=h.toLine(!1),j.push({id:i,text:i,c:h});b(a).select2("data",j)}},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),(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(S.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},S.pInt(c)))}),b},c.observable.fn.validateEmail=function(){return this.hasError=c.observable(!1),this.subscribe(function(a){a=S.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=S.trim(a),this.hasError(""!==a&&!/^.+@.+$/.test(a))},this),this.valueHasMutated(),this},c.observable.fn.validateFunc=function(a){return this.hasFuncError=c.observable(!1),S.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.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.settings=function(a){var b=this.sBase+"settings";return S.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=S.isNormal(b)?S.pInt(b):1,c=S.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.emptyContactPic=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/empty-contact.png"},g.prototype.sound=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/sounds/"+a},g.prototype.themePreviewLink=function(a){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/themes/"+encodeURI(a)+"/images/preview.png"},g.prototype.notificationMailIcon=function(){return(""===this.sCdnStaticDomain?"rainloop/v/":this.sCdnStaticDomain)+this.sVersion+"/static/css/images/icom-message-notification.png"},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+"/":"")},T.oViewModelsHooks={},T.oSimpleHooks={},T.regViewModelHook=function(a,b){b&&(b.__hookName=a)},T.addHook=function(a,b){S.isFunc(b)&&(S.isArray(T.oSimpleHooks[a])||(T.oSimpleHooks[a]=[]),T.oSimpleHooks[a].push(b))},T.runHook=function(a,b){S.isArray(T.oSimpleHooks[a])&&(b=b||[],f.each(T.oSimpleHooks[a],function(a){a.apply(null,b)}))},T.mainSettingsGet=function(a){return cb?cb.settingsGet(a):null},T.remoteRequest=function(a,b,c,d,e,f){cb&&cb.remote().defaultRequest(a,b,c,d,e,f)},T.settingsGet=function(a,b){var c=T.mainSettingsGet("Plugins");return c=c&&S.isUnd(c[a])?null:c[a],c?S.isUnd(c[b])?null:c[b]:null},h.supported=function(){return!0},h.prototype.set=function(a,c){var d=b.cookie(P.Values.ClientSideCookieIndexName),e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[a]=c,b.cookie(P.Values.ClientSideCookieIndexName,JSON.stringify(f),{expires:30}),e=!0}catch(g){}return e},h.prototype.get=function(a){var c=b.cookie(P.Values.ClientSideCookieIndexName),d=null;try{d=null===c?null:JSON.parse(c),d=d&&!S.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[P.Values.ClientSideCookieIndexName]||null,e=!1,f=null;try{f=null===d?null:JSON.parse(d),f||(f={}),f[b]=c,a.localStorage[P.Values.ClientSideCookieIndexName]=JSON.stringify(f),e=!0}catch(g){}return e},i.prototype.get=function(b){var c=a.localStorage[P.Values.ClientSideCookieIndexName]||null,d=null;try{d=null===c?null:JSON.parse(c),d=d&&!S.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(){},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;S.isNonEmptyArray(a)&&(c=f.bind(this.onRoute||S.emptyFunction,this),b=d.create(),f.each(a,function(a){b.addRoute(a[0],c).rules=a[1]}),this.oCross=b)},n.prototype.sDefaultScreenName="",n.prototype.oScreens={},n.prototype.oBoot=null,n.prototype.oCurrentScreen=null,n.prototype.showLoading=function(){b("#rl-loading").show()},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 S.isNormal(a)&&(this.oBoot=a),this},n.prototype.screen=function(a){return""===a||S.isUnd(this.oScreens[a])?null:this.oScreens[a]},n.prototype.delegateRun=function(a,b,c){a&&a[b]&&a[b].apply(a,S.isArray(c)?c:[])},n.prototype.buildViewModel=function(a,d){if(a&&!a.__builded){var e=new a(d),f=e.viewModelPosition(),g=b("#rl-content #rl-"+f.toLowerCase()),h=null;a.__builded=!0,a.__vm=e,e.data=cb.data(),e.viewModelName=a.__name,g&&1===g.length?(h=b("
").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),h.appendTo(g),e.viewModelDom=h,a.__dom=h,"Popups"===f&&(e.cancelCommand=e.closeCommand=S.createCommand(e,function(){X.hideScreenPopup(a)})),T.runHook("view-model-pre-build",[a.__name,e,h]),c.applyBindings(e,h[0]),this.delegateRun(e,"onBuild",[h]),T.runHook("view-model-post-build",[a.__name,e,h])):S.log("Cannot find view model position: "+f)}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.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),f.defer(function(){a.__dom.find(".ko-select2").select2("close")}))},n.prototype.showScreenPopup=function(a,b){a&&(this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),T.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))},n.prototype.screenOnRoute=function(a,b){var c=this,d=null,e=null;""===S.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,S.isNonEmptyArray(d.viewModels())&&f.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),f.defer(function(){c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onHide"),S.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),c.delegateRun(a.__vm,"onHide"))})),c.oCurrentScreen=d,c.oCurrentScreen&&(c.delegateRun(c.oCurrentScreen,"onShow"),T.runHook("screen-on-show",[c.oCurrentScreen.screenName(),c.oCurrentScreen]),S.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),c.delegateRun(a.__vm,"onShow"),T.runHook("view-model-on-show",[a.__name,a.__vm]))},c)),e=d.__cross(),e&&e.parse(b)})))},n.prototype.startScreens=function(a){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(),T.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),T.runHook("screen-post-start",[a.screenName(),a]))},this);var b=d.create();b.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,f.bind(this.screenOnRoute,this)),e.initialized.add(b.parse,b),e.changed.add(b.parse,b),e.init()},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=S.isUnd(c)?!1:!!c,(S.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},X=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.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=Q.EmailType.Facebook),null===this.privateType&&(this.privateType=Q.EmailType.Default)),this.privateType},o.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())},o.prototype.parse=function(a){a=S.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=S.trim(a.Name),this.email=S.trim(a.Email),b=""!==this.email,this.clearDuplicateName()),b},o.prototype.toLine=function(a,b){var c="";return""!==this.email&&(b=S.isUnd(b)?!1:!!b,a&&""!==this.name?c=b?'")+'" target="_blank" tabindex="-1">'+S.encodeHtml(this.name)+"":this.name:(c=this.email,""!==this.name?c=b?S.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+S.encodeHtml(c)+""+S.encodeHtml(">"):'"'+this.name+'" <'+c+">":b&&(c=''+S.encodeHtml(this.email)+""))),c},o.prototype.select2Result=function(){var a="",b=cb.cache().getUserPic(this.email);return a+=""!==b?'':'',Q.EmailType.Facebook===this.type()?(a+=""+(0'):a+=""+(0('+this.name+")":this.email),a+""},o.prototype.select2Selection=function(a){var c="";if(Q.EmailType.Facebook===this.type()){if(c=0").text(c).appendTo(a),a.append(''),null}else c=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=cb.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])):S.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"),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)),S.windowResize()})):X.setHash(cb.link().settings(),!1,!0)},K.prototype.onHide=function(){this.oCurrentSubScreen&&this.oCurrentSubScreen.viewModelDom&&(X.delegateRun(this.oCurrentSubScreen,"onHide"),this.oCurrentSubScreen.viewModelDom.hide())},K.prototype.onBuild=function(){f.each(W.settings,function(a){a&&a.__rlSettingsData&&!f.find(W["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(W["settings-disabled"],function(b){return b&&b===a})})},this),this.oViewModelPlace=b("#rl-content #rl-settings-subscreen")},K.prototype.routes=function(){var a=f.find(W.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=S.isUnd(c.subname)?b:S.pString(c.subname),[c.subname]}};return[["{subname}/",c],["{subname}",c],["",c]]},f.extend(L.prototype,m.prototype),L.prototype.onShow=function(){cb.setTitle("")},f.extend(M.prototype,K.prototype),M.prototype.onShow=function(){cb.setTitle("")},f.extend(N.prototype,k.prototype),N.prototype.oSettings=null,N.prototype.oLink=null,N.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):(V.bMobileDevice?(a.open(b,"_self"),a.focus()):this.iframe.attr("src",b),!0)},N.prototype.link=function(){return null===this.oLink&&(this.oLink=new g),this.oLink},N.prototype.local=function(){return null===this.oLocal&&(this.oLocal=new j),this.oLocal},N.prototype.settingsGet=function(a){return null===this.oSettings&&(this.oSettings=S.isNormal(Y)?Y:{}),S.isUnd(this.oSettings[a])?null:this.oSettings[a]},N.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=S.isNormal(Y)?Y:{}),this.oSettings[a]=b},N.prototype.setTitle=function(b){b=(0