(function(h,j,e,Ta,P,Y,ra,i){function B(){this.sBase="#/";this.sCdnStaticDomain=f.settingsGet("CdnStaticDomain");this.sVersion=f.settingsGet("Version");this.sIndexFile=f.settingsGet("IndexFile");this.sSpecSuffix=f.settingsGet("AuthAccountHash")||"0";this.sServer=null===this.sIndexFile?"?":this.sIndexFile+"?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function n(a,b,d,l){this.oOptions= l=j.extend({DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"},c.isUnd(l)?{}:l);this.bOnlyPlain=!!this.oOptions.DisableHtml;this.fOnSwitch=this.oOptions.onSwitch;this.textarea=j(a).empty().addClass("editorTextArea");this.htmlarea=j(b).empty().addClass("editorHtmlArea").prop("contentEditable","true");this.toolbar=j(d).empty().addClass("editorToolbar");n.htmlInitEditor.apply(this); n.htmlInitToolbar.apply(this);n.htmlAttachEditorEvents.apply(this);this.bOnlyPlain&&this.toolbar.hide()}function M(a,b,d,l,f){this.list=a;this.selectedItem=b;this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.oContentScrollable=this.oContentVisible=null;this.sItemSelector=d;this.sItemSelectedSelector=l;this.sItemCheckedSelector=f;this.sLastUid="";this.oCallbacks={};this.iSelectTimer=0;this.bUseKeyboard=!0;this.emptyFunction=function(){}; this.useItemSelectCallback=!0;this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&(this.oCallbacks.onItemSelect||this.emptyFunction)(a)},this);var e=this,g=[],k=null;this.list.subscribe(function(){var a=this,b=this.list();c.isArray(b)&&i.each(b,function(b){b.checked()&&g.push(a.getItemUid(b));null===k&&b.selected()&&(k=a.getItemUid(b))})},this,"beforeChange");this.list.subscribe(function(a){this.useItemSelectCallback=!1;this.selectedItem(null);if(c.isArray(a)){var b=this,d=g.length; i.each(a,function(a){0=e||g-2<=e)l+=2;k(e);d=b=e}for(;0=d)k(d,!0),l--;else if(0>=b)break;3===b?k(2,!1):3d&&k(Math.round((g+d)/2),!0,"...");1d&&k(g,!0)}return f},this);this.checkAll=e.computed({read:function(){return 0d},this);this.hasMessages=e.computed(function(){return 0'), d.after(l),d.remove();l&&l[0]&&l.attr("data-href",e).attr("data-theme",b[0]).text(b[1]);a.themeTrigger(g.SaveSettingsStep.TrueResult)}}).always(function(){a.iTimer=h.setTimeout(function(){a.themeTrigger(g.SaveSettingsStep.Idle)},1E3);a.oLastAjax=null}));f.remote().saveSettings(null,{Theme:b})},this)}function Na(){c.initDataConstructorBySettings(this)}function T(){c.initDataConstructorBySettings(this);var a=function(a){return function(){var b=f.cache().getFolderFromCacheList(a());b&&b.type(g.FolderType.User)}}, b=function(a){return function(b){(b=f.cache().getFolderFromCacheList(b))&&b.type(a)}};this.devPassword=this.devLogin=this.devEmail="";this.accountEmail=e.observable("");this.accountLogin=e.observable("");this.projectHash=e.observable("");this.threading=!1;this.lastFoldersHash="";this.remoteChangePassword=this.remoteSuggestions=!1;this.sentFolder=e.observable("");this.draftFolder=e.observable("");this.spamFolder=e.observable("");this.trashFolder=e.observable("");this.sentFolder.subscribe(a(this.sentFolder), this,"beforeChange");this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange");this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange");this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange");this.sentFolder.subscribe(b(g.FolderType.SentItems),this);this.draftFolder.subscribe(b(g.FolderType.Draft),this);this.spamFolder.subscribe(b(g.FolderType.Spam),this);this.trashFolder.subscribe(b(g.FolderType.Trash),this);this.draftFolderNotEnabled=e.computed(function(){return""=== this.draftFolder()||t.Values.UnuseOptionValue===this.draftFolder()},this);this.displayName=e.observable("");this.signature=e.observable("");this.replyTo=e.observable("");this.accounts=e.observableArray([]);this.accountsLoading=e.observable(!1);this.namespace="";this.folderList=e.observableArray([]);this.foldersListError=e.observable("");this.foldersLoading=e.observable(!1);this.foldersCreating=e.observable(!1);this.foldersDeleting=e.observable(!1);this.foldersRenaming=e.observable(!1);this.currentFolder= e.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]});this.currentFolderFullNameRaw=e.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this);this.currentFolderFullName=e.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this);this.currentFolderFullNameHash=e.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this);this.currentFolderName= e.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this);this.folderListSystemNames=e.computed(function(){var a=["INBOX"],b=this.folderList(),f=this.sentFolder(),e=this.draftFolder(),g=this.spamFolder(),k=this.trashFolder();c.isArray(b)&&0').appendTo("body");R.on("error",function(a){f&&(a&&a.originalEvent&&a.originalEvent.message)&&(c.log(""+a.originalEvent.message+" ("+a.originalEvent.filename+":"+a.originalEvent.lineno+")"),f.remote().jsError(c.emptyFunction, a.originalEvent.message,a.originalEvent.filename,a.originalEvent.lineno))})}function A(){I.call(this);this.oCache=this.oRemote=this.oData=null;this.iSuggestionsLimit=c.pInt(this.settingsGet("SuggestionsLimit"));this.iSuggestionsLimit=0===this.iSuggestionsLimit?20:this.iSuggestionsLimit;this.quotaDebounce=i.debounce(this.quota,3E4)}var t={},g={},u={},c={},x={},ga={},wa=e.observable(!0),ha=e.observable(!0),s=null,Ba=h.rainloopAppData||{},Pa=h.rainloopI18N||{},Z=j("html"),R=j(h),Ca=j(h.document),Da= [],Qa=[],Ra=[],ia=h.Notification&&h.Notification.requestPermission?h.Notification:null,Ea=(navigator.userAgent||"").toLowerCase(),Ya=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""};c.splitPlainText=function(a,b){for(var d="",l="",f=a,e=0,g=0,b=c.isUnd(b)?100:b;f.length>b;)l=f.substring(0,b),e=l.lastIndexOf(" "),g=l.lastIndexOf("\n"),-1!==g&&(e=g),-1=== e&&(e=b),d+=l.substring(0,e)+"\n",f=f.substring(e+1);return d+f};var Fa={};c.timeOutAction=function(a,b,d){c.isUnd(Fa[a])&&(Fa[a]=0);h.clearTimeout(Fa[a]);Fa[a]=h.setTimeout(b,d)};var Sa={};c.timeOutActionSecond=function(a,b,d){Sa[a]||(Sa[a]=h.setTimeout(function(){b();Sa[a]=0},d))};var O=!1;c.audio=function(a,b){if(!1===O)if(Ya)O=null;else{var d=!1,c=!1,f=h.Audio?new h.Audio:null;f&&f.canPlayType&&f.play?((d=""!==f.canPlayType('audio/mpeg; codecs="mp3"'))||(c=""!==f.canPlayType('audio/ogg; codecs="vorbis"')), d||c?(O=f,O.preload="none",O.loop=!1,O.autoplay=!1,O.muted=!1,O.src=d?a:b):O=null):O=null}return O};c.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};c.i18n=function(a,b,d){var l="",a=c.isUnd(Pa[a])?c.isUnd(d)?a:d:Pa[a];if(!c.isUnd(b)&&!c.isNull(b))for(l in b)c.hos(b,l)&&(a=a.replace("%"+l+"%",b[l]));return a};c.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),d="";(d=a.data("i18n-text"))?a.text(c.i18n(d)):((d=a.data("i18n-html"))&& a.html(c.i18n(d)),(d=a.data("i18n-placeholder"))&&a.attr("placeholder",c.i18n(d)))})})};c.i18nToDoc=function(){h.rainloopI18N&&(Pa=h.rainloopI18N||{},c.i18nToNode(Ca),ha(!ha()));h.rainloopI18N={}};c.initOnStartOrLangChange=function(a,b,d){a&&a.call(b);d?ha.subscribe(function(){a&&a.call(b);d.call(b)}):a&&ha.subscribe(a,b)};c.inFocus=function(){var a=document.activeElement;return a&&("INPUT"===a.tagName||"TEXTAREA"===a.tagName||"IFRAME"===a.tagName||"DIV"===a.tagName&&"editorHtmlArea"===a.className&& a.contentEditable)};c.removeInFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var a=j(document.activeElement);(a.is("input")||a.is("textarea"))&&document.activeElement.blur()}};c.removeSelection=function(){if(h&&h.getSelection){var a=h.getSelection();a&&a.removeAllRanges&&a.removeAllRanges()}else document&&(document.selection&&document.selection.empty)&&document.selection.empty()};c.replySubjectAdd=function(a,b){var d=null,l=c.trim(b);null!==(d=(new h.RegExp("^"+ a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!c.isUnd(d[1])?l=a+"[2]: "+d[1]:null!==(d=(new h.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$","gi")).exec(b))&&!c.isUnd(d[1])&&!c.isUnd(d[2])&&!c.isUnd(d[3])?(c.pInt(d[2]),l=d[1]+(c.pInt(d[2])+1)+d[3]):l=a+": "+b;return l};c.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};c.friendlySize=function(a){a=c.pInt(a);return 1073741824<=a?c.roundNumber(a/1073741824,1)+"GB":1048576<=a?c.roundNumber(a/1048576,1)+"MB":1024<= a?c.roundNumber(a/1024,0)+"KB":a+"B"};c.log=function(a){h.console&&h.console.log&&h.console.log(a)};c.getNotification=function(a){a=c.pInt(a);return c.isUnd(u[a])?"":u[a]};c.initNotificationLanguage=function(){u[g.Notification.InvalidToken]=c.i18n("NOTIFICATIONS/INVALID_TOKEN");u[g.Notification.AuthError]=c.i18n("NOTIFICATIONS/AUTH_ERROR");u[g.Notification.AccessError]=c.i18n("NOTIFICATIONS/ACCESS_ERROR");u[g.Notification.ConnectionError]=c.i18n("NOTIFICATIONS/CONNECTION_ERROR");u[g.Notification.CaptchaError]= c.i18n("NOTIFICATIONS/CAPTCHA_ERROR");u[g.Notification.SocialFacebookLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");u[g.Notification.SocialTwitterLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");u[g.Notification.SocialGoogleLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");u[g.Notification.DomainNotAllowed]=c.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");u[g.Notification.CantGetMessageList]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST"); u[g.Notification.CantGetMessage]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");u[g.Notification.CantDeleteMessage]=c.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");u[g.Notification.CantMoveMessage]=c.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");u[g.Notification.CantSaveMessage]=c.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");u[g.Notification.CantSendMessage]=c.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");u[g.Notification.InvalidRecipients]=c.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");u[g.Notification.CantCreateFolder]=c.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER"); u[g.Notification.CantRenameFolder]=c.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");u[g.Notification.CantDeleteFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");u[g.Notification.CantDeleteNonEmptyFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");u[g.Notification.CantSubscribeFolder]=c.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");u[g.Notification.CantUnsubscribeFolder]=c.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");u[g.Notification.CantSaveSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS"); u[g.Notification.CantSavePluginSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");u[g.Notification.DomainAlreadyExists]=c.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");u[g.Notification.CantInstallPackage]=c.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");u[g.Notification.CantDeletePackage]=c.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");u[g.Notification.InvalidPluginPackage]=c.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");u[g.Notification.UnsupportedPluginPackage]=c.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE"); u[g.Notification.LicensingServerIsUnavailable]=c.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");u[g.Notification.LicensingExpired]=c.i18n("NOTIFICATIONS/LICENSING_EXPIRED");u[g.Notification.LicensingBanned]=c.i18n("NOTIFICATIONS/LICENSING_BANNED");u[g.Notification.DemoSendMessageError]=c.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");u[g.Notification.AccountAlreadyExists]=c.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");u[g.Notification.MailServerError]=c.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR"); u[g.Notification.UnknownError]=c.i18n("NOTIFICATIONS/UNKNOWN_ERROR")};c.getUploadErrorDescByCode=function(a){var b="";switch(c.pInt(a)){case g.UploadErrorCode.FileIsTooBig:b=c.i18n("UPLOAD/ERROR_FILE_IS_TOO_BIG");break;case g.UploadErrorCode.FilePartiallyUploaded:b=c.i18n("UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED");break;case g.UploadErrorCode.FileNoUploaded:b=c.i18n("UPLOAD/ERROR_NO_FILE_UPLOADED");break;case g.UploadErrorCode.MissingTempFolder:b=c.i18n("UPLOAD/ERROR_MISSING_TEMP_FOLDER");break;case g.UploadErrorCode.FileOnSaveingError:b= c.i18n("UPLOAD/ERROR_ON_SAVING_FILE");break;case g.UploadErrorCode.FileType:b=c.i18n("UPLOAD/ERROR_FILE_TYPE");break;default:b=c.i18n("UPLOAD/ERROR_UNKNOWN")}return b};c.killCtrlAandS=function(a){if(a=a||h.event){var b=a.target||a.srcElement,d=a.keyCode||a.which;if(a.ctrlKey&&d===g.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&d===g.EventKeyCode.A)h.getSelection?h.getSelection().removeAllRanges():h.document.selection&&h.document.selection.clear&& h.document.selection.clear(),a.preventDefault()}};c.createCommand=function(a,b,d){var l=b?function(){l.canExecute&&l.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};l.enabled=e.observable(!0);d=c.isUnd(d)?!0:d;l.canExecute=c.isFunc(d)?e.computed(function(){return l.enabled()&&d.call(a)}):e.computed(function(){return l.enabled()&&!!d});return l};c.initDataConstructorBySettings=function(a){a.ignoreFolderSubscribe=e.observable(!1);a.editorDefaultType=e.observable(g.EditorDefaultType.Html); a.showImages=e.observable(!1);a.showAnimation=e.observable(!1);a.desktopNotifications=e.observable(!1);a.useThreads=e.observable(!0);a.replySameFolder=e.observable(!0);a.usePreviewPane=e.observable(!0);a.useCheckboxesInList=e.observable(!0);a.showAnimation.subscribe(function(a){na?Z.removeClass("rl-anim").addClass("no-rl-anim"):Z.toggleClass("rl-anim",a).toggleClass("no-rl-anim",!a)});a.showAnimation.valueHasMutated();a.desktopNotificationsPermisions=e.computed(function(){a.desktopNotifications(); var b=g.DesctopNotifications.NotSupported;if(ia&&ia.permission)switch(ia.permission.toLowerCase()){case "granted":b=g.DesctopNotifications.Allowed;break;case "denied":b=g.DesctopNotifications.Denied;break;case "default":b=g.DesctopNotifications.NotAllowed}else h.webkitNotifications&&h.webkitNotifications.checkPermission&&(b=h.webkitNotifications.checkPermission());return b});a.useDesktopNotifications=e.computed({read:function(){return a.desktopNotifications()&&g.DesctopNotifications.Allowed===a.desktopNotificationsPermisions()}, write:function(b){b?(b=a.desktopNotificationsPermisions(),g.DesctopNotifications.Allowed===b?a.desktopNotifications(!0):g.DesctopNotifications.NotAllowed===b?ia.requestPermission(function(){a.desktopNotifications.valueHasMutated();h.console.log(a.desktopNotificationsPermisions());g.DesctopNotifications.Allowed===a.desktopNotificationsPermisions()?a.desktopNotifications()?a.desktopNotifications.valueHasMutated():a.desktopNotifications(!0):a.desktopNotifications()?a.desktopNotifications(!1):a.desktopNotifications.valueHasMutated()}): a.desktopNotifications(!1)):a.desktopNotifications(!1)}});a.language=e.observable("");a.languages=e.observableArray([]);a.mainLanguage=e.computed({read:a.language,write:function(b){b!==a.language()?-1=a.diff(d,"hours")?l:a.format("L")===d.format("L")?c.i18n("MESSAGE_LIST/TODAY_AT",{TIME:d.format("LT")}):a.clone().subtract("days",1).format("L")===d.format("L")?c.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:d.format("LT")}):a.year()===d.year()?d.format("D MMM."):d.format("LL")},a)};c.isFolderExpanded=function(a){var b=f.local().get(g.ClientSideKeyName.ExpandedFolders);return i.isArray(b)&&-1!==i.indexOf(b,a)};c.setExpandedFolder=function(a,b){var d= f.local().get(g.ClientSideKeyName.ExpandedFolders);i.isArray(d)||(d=[]);b?(d.push(a),d=i.uniq(d)):d=i.without(d,a);f.local().set(g.ClientSideKeyName.ExpandedFolders,d)};c.initLayoutResizer=function(a,b,d,c){var e=j(a),q=j(b),w=j(d),a=f.local().get(g.ClientSideKeyName.MailBoxListSize),k=function(a,b,d){if(b||d)a=w.width(),b=b?100*(b.size.width/a):null,null===b&&d&&(b=100*(e.width()/a)),null!==b&&(e.css({width:"",height:"",right:""+(100-b)+"%"}),q.css({width:"",height:"",left:""+b+"%"}))};a&&e.width(a); e.resizable({minWidth:350,maxWidth:w.width()-250,handles:"e",resize:k,stop:k});k(null,null,!0);R.resize(i.throttle(function(a,b){if(c&&c()){var d=w.width();e.resizable("option","maxWidth",d-250);b&&(b.size&&b.size.width)&&f.local().set(g.ClientSideKeyName.MailBoxListSize,b.size.width);k(null,null,!0)}},400))};c.initBlockquoteSwitcher=function(a){if(a){var b=j("blockquote:not(.rl-bq-switcher)",a).filter(function(){return 0===j(this).parent().closest("blockquote",a).length});b&&0').insertBefore(a).click(function(){a.toggleClass("hidden-bq");c.windowResize()}).after("
").before("
")})}};c.removeBlockquoteSwitcher=function(a){a&&(j(a).find("blockquote.rl-bq-switcher").each(function(){j(this).removeClass("rl-bq-switcher hidden-bq")}),j(a).find(".rlBlockquoteSwitcher").each(function(){j(this).remove()}))};c.extendAsViewModel= function(a,b){b&&(b.__name=a,x.regViewModelHook(a,b),i.extend(b.prototype,C.prototype))};c.addSettingsViewModel=function(a,b,d,c,f){a.__rlSettingsData={Label:d,Template:b,Route:c,IsDefault:!!f};Da.push(a)};c.removeSettingsViewModel=function(a){Qa.push(a)};c.disableSettingsViewModel=function(a){Ra.push(a)};c.convertThemeName=function(a){return c.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};c.fakeMd5=function(a){for(var b="",a=c.isUnd(a)?32:c.pInt(a);b.length/g,">").replace(/")};c.draggeblePlace=function(){return j('
 
').appendTo("#rl-hidden")};c.defautOptionsAfterRender=function(a,b){b&&!c.isUnd(b.disable)&&e.applyBindingsToNode(a, {disable:b.disable},b)};c.windowPopupKnockout=function(a,b,d,l){var f=null,e=h.open(""),g="__OpenerApplyBindingsUid"+c.fakeMd5()+"__",k=j("#"+b);h[g]=function(){if(e&&e.document.body&&k&&k[0]){var b=j(e.document.body);j("#rl-content",b).html(k.html());j("html",e.document).addClass("external "+j("html").attr("class"));c.i18nToNode(b);E.prototype.applyExternal(a,j("#rl-content",b)[0]);h[g]=null;l(e)}};e.document.open();e.document.write(''+ c.encodeHtml(d)+'
');e.document.close();f=e.document.createElement("script");f.innerHTML="if(window&&window.opener&&window.opener['"+g+"']){window.opener['"+g+"']();window.opener['"+g+"']=null}";e.document.getElementsByTagName("head")[0].appendChild(f)};c.settingsSaveHelperFunction=function(a,b,d,l){d=d||null;l=c.isUnd(l)?1E3:c.pInt(l);return function(c,f,e,k,h){b.call(d,f&&f.Result?g.SaveSettingsStep.TrueResult:g.SaveSettingsStep.FalseResult); a&&a.call(d,c,f,e,k,h);i.delay(function(){b.call(d,g.SaveSettingsStep.Idle)},l)}};c.settingsSaveHelperSimpleFunction=function(a,b){return c.settingsSaveHelperFunction(null,a,b,1E3)};c.resizeAndCrop=function(a,b,d){var c=new Image;c.onload=function(){var a=[0,0],c=document.createElement("canvas"),l=c.getContext("2d");c.width=b;c.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];l.fillStyle="#fff";l.fillRect(0,0,b,b);l.drawImage(this,a[0]/2,a[1]/2,this.width-a[0], this.height-a[1],0,0,b,b);d(c.toDataURL("image/jpeg"))};c.src=a};ga={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",urlsafe_encode:function(a){return ga.encode(a).replace(/[+]/g,"-").replace(/[\/]/g,"_").replace(/[=]/g,".")},encode:function(a){for(var b="",d,c,f,e,g,k,i=0,a=ga._utf8_encode(a);i>2,d=(d&3)<<4|c>>4,g=(c&15)<<2|f>>6,k=f&63,isNaN(c)?g=k=64:isNaN(f)&&(k=64),b=b+this._keyStr.charAt(e)+ this._keyStr.charAt(d)+this._keyStr.charAt(g)+this._keyStr.charAt(k);return b},decode:function(a){for(var b="",d,c,f,e,g,k=0,a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k>4,c=(c&15)<<4|e>>2,f=(e&3)<<6|g,b+=String.fromCharCode(d),64!==e&&(b+=String.fromCharCode(c)),64!==g&&(b+=String.fromCharCode(f));return ga._utf8_decode(b)},_utf8_encode:function(a){for(var a= a.replace(/\r\n/g,"\n"),b="",d=0,c=a.length,f=0;df?b+=String.fromCharCode(f):(127f?b+=String.fromCharCode(f>>6|192):(b+=String.fromCharCode(f>>12|224),b+=String.fromCharCode(f>>6&63|128)),b+=String.fromCharCode(f&63|128));return b},_utf8_decode:function(a){for(var b="",d=0,c=0,f=0,e=0;dc?(b+=String.fromCharCode(c),d++):191c?(f=a.charCodeAt(d+1),b+=String.fromCharCode((c&31)<<6|f&63),d+=2):(f=a.charCodeAt(d+1),e=a.charCodeAt(d+ 2),b+=String.fromCharCode((c&15)<<12|(f&63)<<6|e&63),d+=3);return b}};e.bindingHandlers.tooltip={init:function(a,b){if(!na){var d=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,trigger:"hover",title:function(){return''+c.i18n(e.utils.unwrapObservable(b()))+""}})}}};e.bindingHandlers.tooltip2={init:function(a,b){var d=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,title:function(){return''+b()()+""}})}};e.bindingHandlers.popover={init:function(a,b){var d=e.utils.unwrapObservable(b());j(a).popover({trigger:d[2]||"click",placement:d[3]||"right",title:function(){return c.i18n(d[0]||"")},content:function(){return c.i18n(d[1]||"")}})}};e.bindingHandlers.resizecrop={init:function(a){j(a).addClass("resizecrop").resizecrop({width:"100",height:"100",wrapperCSS:{"border-radius":"10px"}})},update:function(a,b){b()();j(a).resizecrop({width:"100",height:"100"})}};e.bindingHandlers.onEnter= {init:function(a,b,d,c){e.bindingHandlers.event.init(a,function(){return{keyup:function(d,c){c&&13===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(this,d))}}},d,c)}};e.bindingHandlers.onEsc={init:function(a,b,d,c){e.bindingHandlers.event.init(a,function(){return{keyup:function(d,c){c&&27===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(this,d))}}},d,c)}};e.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,show:e.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})}, update:function(a,b){var d=e.utils.unwrapObservable(b());j(a).modal(d?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",d)},1)}};e.bindingHandlers.onEnterChange={init:function(a,b,d,c){e.bindingHandlers.event.init(a,function(){return{keyup:function(b,d){d&&13===h.parseInt(d.keyCode,10)&&j(a).trigger("change")}}},d,c)}};e.bindingHandlers.i18nInit={init:function(a){c.i18nToNode(a)}};e.bindingHandlers.i18nUpdate={update:function(a,b){e.utils.unwrapObservable(b());c.i18nToNode(a)}};e.bindingHandlers.link= {update:function(a,b){j(a).attr("href",e.utils.unwrapObservable(b()))}};e.bindingHandlers.title={update:function(a,b){j(a).attr("title",e.utils.unwrapObservable(b()))}};e.bindingHandlers.textF={init:function(a,b){j(a).text(e.utils.unwrapObservable(b()))}};e.bindingHandlers.initDom={init:function(a,b){b()(a)}};e.bindingHandlers.initResizeTrigger={init:function(a,b){var d=e.utils.unwrapObservable(b());j(a).css({height:d[1],"min-height":d[1]})},update:function(a,b){var d=e.utils.unwrapObservable(b()), l=c.pInt(d[1]),f=0,f=j(a).offset().top;0
').addClass("settings-saved-trigger")},update:function(a,b){var d= e.utils.unwrapObservable(b()),c=j(a);switch(d.toString()){case "1":c.find(".animated,.error").hide().removeClass("visible").end().find(".success").show().addClass("visible");break;case "0":c.find(".animated,.success").hide().removeClass("visible").end().find(".error").show().addClass("visible");break;case "-2":c.find(".error,.success").hide().removeClass("visible").end().find(".animated").show().addClass("visible");break;default:c.find(".animated").hide().end().find(".error,.success").removeClass("visible")}}}; e.bindingHandlers.select2={init:function(a,b){var d=0,l=null,g=new h.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),q=new h.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),w=function(){return""},k=function(a){f.getAutocomplete(a.term,a.page,function(b,d){a.callback({more:!!d,results:i.map(b,function(a){var b=a.toLine(!1);return{id:b,text:b,c:a}})})})};j(a).addClass("ko-select2").select2({query:function(a){a&&(0===d?(k(a),d=h.setTimeout(c.emptyFunction,200)):(h.clearInterval(d),d=h.setTimeout(function(){k(a)}, 200)))},formatSelection:function(a,b){var d=a&&a.c?a.c.select2Selection(b):a.text;if(null!==d)return d},formatResult:function(a,b,d,c){b=a&&a.c?a.c.select2Result(b):"";return""===b?c(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&g.test(a)?{id:a,text:a}:null},formatNoMatches:w,formatSearching:function(){return c.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:w,formatSelectionTooBig:w,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0, openOnEnter:!1});e.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),d=0,f=a.length,e=null,g=[];dc.pInt(j.browser.version)?(d=this.getEditorRange())&&d.execCommand("forecolor"===a?"ForeColor":"BackColor",!1,b):(d=j.browser.msie?"forecolor"=== a?"ForeColor":"BackColor":"forecolor"===a?"foreColor":"backColor",this.ec(d,!1,b))};n.prototype.isHtml=function(){return!0===this.bOnlyPlain?!1:this.textarea.is(":hidden")};n.prototype.toHtmlString=function(){return this.editor.innerHTML};n.prototype.toString=function(){return this.editor.innerText};n.prototype.updateTextArea=function(){this.textarea.val(this.toHtmlString())};n.prototype.updateHtmlArea=function(){this.editor.innerHTML=this.textarea.val()};n.prototype.setRawText=function(a,b){b&&!this.bOnlyPlain? (this.isHtml()||(this.textarea.val(""),this.switchToHtml()),this.textarea.val(a.toString()),this.updateHtmlArea()):(this.textarea.val(a.toString()),this.updateHtmlArea(),this.switchToPlain(!1))};n.prototype.clear=function(){this.textarea.val("");this.editor.innerHTML="";this.bOnlyPlain?(this.toolbar.hide(),this.switchToPlain(!1)):this.switchToHtml()};n.prototype.getTextForRequest=function(){this.isHtml()&&this.updateTextArea();return this.textarea.val()};n.prototype.getTextFromHtml=function(a){var b= "",d=function(){if(arguments&&1 "+c.trim(a).replace(/\n/gm,"\n> ")+"\n>\n";return a.replace(/\n([> ]+)/gm,function(){return arguments&&1]*>([\s\S]*)<\/div>/gmi,f),a="\n"+c.trim(a)+"\n");return a}return""},a= c.isUnd(a)?!0:!!a,b=this.toHtmlString().replace(/[\s]+/gm," ").replace(//gmi,"\n").replace(/<\/h\d>/gi,"\n").replace(/<\/p>/gi,"\n\n").replace(/<\/li>/gi,"\n").replace(/<\/td>/gi,"\n").replace(/<\/tr>/gi,"\n").replace(/]*>/gmi,"\n_______________________________\n\n").replace(/]*>/gmi,"").replace(/]*>([\s\S]*)<\/div>/gmi,f).replace(/]*>/gmi,"\n__bq__start__\n").replace(/<\/blockquote>/gmi,"\n__bq__end__\n").replace(/]*>([\s\S]*?)<\/a>/gmi,function(){return arguments&& 1]*>/gm,"").replace(/>/gi,">").replace(/</gi,"<").replace(/&/gi,"&").replace(/&\w{2,6};/gi,"");return(a?c.splitPlainText(b):b).replace(/\n[ \t]+/gm,"\n").replace(/[\n]{3,}/gm,"\n\n").replace(/__bq__start__([\s\S]*)__bq__end__/gm,d).replace(/__bq__start__/gm,"").replace(/__bq__end__/gm,"")};n.prototype.getHtmlFromText=function(){return c.convertPlainTextToHtml(this.textarea.val())};n.prototype.switchToggle=function(){this.isHtml()? this.switchToPlain():this.switchToHtml()};n.prototype.switchToPlain=function(a){var a=c.isUnd(a)?!0:a,b=this.getTextFromHtml(),d=i.bind(function(a){a&&(this.toolbar.addClass("editorHideToolbar"),j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!1)),this.textarea.val(b),this.textarea.show(),this.htmlarea.hide(),this.fOnSwitch&&this.fOnSwitch(!1))},this);!a||0===c.trim(b).length?d(!0):d(h.confirm(this.oOptions.LangSwitcherConferm))};n.prototype.switcherLinkText=function(a){return a?this.oOptions.LangSwitcherTextLabel: this.oOptions.LangSwitcherHtmlLabel};n.prototype.switchToHtml=function(){this.toolbar.removeClass("editorHideToolbar");j(".editorSwitcher",this.toolbar).text(this.switcherLinkText(!0));this.textarea.val(this.getHtmlFromText());this.updateHtmlArea();this.textarea.hide();this.htmlarea.show();this.fOnSwitch&&this.fOnSwitch(!0)};n.prototype.addButton=function(a,b){var d=this;j("
").addClass("editorToolbarButtom").append(j('').addClass(a)).attr("title", b).click(function(b){c.isUnd(n.htmlFunctions[a])?h.alert(a):n.htmlFunctions[a].apply(d,[j(this),b])}).appendTo(this.toolbar)};n.htmlInitToolbar=function(){if(!this.bOnlyPlain){this.addButton("bold","Bold");this.addButton("italic","Italic");this.addButton("underline","Underline");this.addButton("strikethrough","Strikethrough");this.addButton("removeformat","removeformat");this.addButton("justifyleft","justifyleft");this.addButton("justifycenter","justifycenter");this.addButton("justifyright","justifyright"); this.addButton("horizontalrule","horizontalrule");this.addButton("orderedlist","orderedlist");this.addButton("unorderedlist","unorderedlist");this.addButton("indent","indent");this.addButton("outdent","outdent");this.addButton("forecolor","forecolor");var a=this;j("").addClass("editorSwitcher").text(a.switcherLinkText(!0)).click(function(){a.switchToggle()}).appendTo(a.toolbar)}};n.htmlInitEditor=function(){this.editor=this.htmlarea[0];this.editor.innerHTML=this.textarea.val()};n.htmlAttachEditorEvents= function(){};for(var ib=n,oa=[],Za=[],W=0,Ga=0,Ha=0,Ia=0,Ja="",W=0;256>W;W+=85)Ja=W.toString(16),oa.push(1===Ja.length?"0"+Ja:Ja);Ia=oa.length;for(W=0;W
'),bb=pa.find(".editorFpFonts"),cb=function(){};j.each("Arial;Arial Black;Courier New;Tahoma;Times New Roman;Verdana".split(";"), function(a,b){bb.append(j(''+b+"").click(function(){cb(b)}));bb.append("
")});pa.hide();jb.htmlFontPicker=function(a,b,d){ab||(pa.appendTo(d),ab=!0);cb=b;$a.unbind("click.fpNamespace");h.setTimeout(function(){$a.one("click.fpNamespace",function(){pa.hide()})},500);b=j(a).position();pa.css("top",5+b.top+j(a).height()+"px").css("left",b.left+"px").show()};var kb=n,db=j(h.document),eb=!1,qa=j('
'), fb=qa.find(".editorCpColors"),gb=function(){};j.each(n.htmlColorPickerColors,function(a,b){fb.append('')});qa.hide();j(".editorCpColor",fb).click(function(a){var b=1,d="#000000",a=j(a.target).css("background-color"),d=a.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);if(null!==d){for(delete d[0];3>=b;++b)d[b]=c.pInt(d[b]).toString(16),1===d[b].length&&(d[b]="0"+d[b]);d="#"+d.join("")}else d=a;gb(d)}); kb.htmlColorPicker=function(a,b,d){eb||(qa.appendTo(d),eb=!0);d=j(a).position();gb=b;db.unbind("click.cpNamespace");h.setTimeout(function(){db.one("click.cpNamespace",function(){qa.hide()})},100);qa.css("top",5+d.top+j(a).height()+"px").css("left",d.left+"px").show()};n.htmlFunctions={bold:function(){this.ec("bold")},italic:function(){this.ec("italic")},underline:function(){this.ec("underline")},strikethrough:function(){this.ec("strikethrough")},indent:function(){this.ec("indent")},outdent:function(){this.ec("outdent")}, justifyleft:function(){this.ec("justifyLeft")},justifycenter:function(){this.ec("justifyCenter")},justifyright:function(){this.ec("justifyRight")},horizontalrule:function(){this.ec("insertHorizontalRule",!1,"ht")},removeformat:function(){this.ec("removeFormat")},orderedlist:function(){this.ec("insertorderedlist")},unorderedlist:function(){this.ec("insertunorderedlist")},forecolor:function(a){n.htmlColorPicker(a,i.bind(function(a){this.setcolor("forecolor",a)},this),this.toolbar)},backcolor:function(a){n.htmlColorPicker(a, i.bind(function(a){this.setcolor("backcolor",a)},this),this.toolbar)},fontname:function(a){n.htmlFontPicker(a,i.bind(function(a){this.ec("fontname",!1,a)},this),this.toolbar)}};M.prototype.init=function(a,b){this.oContentVisible=a;this.oContentScrollable=b;if(this.oContentVisible&&this.oContentScrollable){var d=this;j(this.oContentVisible).on("click",this.sItemSelector,function(a){d.actionClick(e.dataFor(this),a)}).on("click",this.sItemCheckedSelector,function(a){var b=e.dataFor(this);b&&(a&&a.shiftKey? d.actionClick(b,a):(d.sLastUid=d.getItemUid(b),b.selected()?(b.checked(!1),d.selectedItem(null)):b.checked(!b.checked())))});j(h.document).on("keydown",i.bind(function(a){var b=!0;if(a&&this.bUseKeyboard&&!c.inFocus())if(-1c?0:c;w=k[c];break}}else if(g.EventKeyCode.Down===a||g.EventKeyCode.Insert===a||g.EventKeyCode.Home===a||g.EventKeyCode.PageUp===a)w=k[0];else if(g.EventKeyCode.Up===a||g.EventKeyCode.End===a||g.EventKeyCode.PageDown===a)w=k[k.length-1];w?(o&&(b?(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)&&o.checked(!o.checked()):g.EventKeyCode.Insert===a&&o.checked(!o.checked())),this.selectedItem(w),0!==this.iSelectTimer? (h.clearTimeout(this.iSelectTimer),this.iSelectTimer=h.setTimeout(function(){d.iSelectTimer=0;d.actionClick(w)},300)):(this.iSelectTimer=h.setTimeout(function(){d.iSelectTimer=0},200),this.actionClick(w)),this.scrollToSelected()):o&&(b&&(g.EventKeyCode.Up===a||g.EventKeyCode.Down===a)?o.checked(!o.checked()):g.EventKeyCode.Insert===a&&o.checked(!o.checked()))};M.prototype.scrollToSelected=function(){if(!this.oContentVisible||!this.oContentScrollable)return!1;var a=j(this.sItemSelectedSelector,this.oContentScrollable), b=a.position(),d=this.oContentVisible.height(),a=a.outerHeight();return b&&(0>b.top||b.top+a>d)?(0>b.top?this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+b.top-20):this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop()+b.top-d+a+20),!0):!1};M.prototype.eventClickFunction=function(a,b){var d=this.getItemUid(a),c=0,f=0,e=null,g="",k=!1,i=!1,h=[],j=!1;if(b&&b.shiftKey&&""!==d&&""!==this.sLastUid&&d!==this.sLastUid){h=this.list();j=a.checked();c=0;for(f=h.length;c< f;c++){e=h[c];g=this.getItemUid(e);k=!1;if(g===this.sLastUid||g===d)k=!0;k&&(i=!i);(i||k)&&e.checked(j)}}this.sLastUid=""===d?"":d};M.prototype.actionClick=function(a,b){if(a){var d=!0,c=this.getItemUid(a);b&&(b.shiftKey?(d=!1,""===this.sLastUid&&(this.sLastUid=c),a.checked(!a.checked()),this.eventClickFunction(a,b)):b.ctrlKey&&(d=!1,this.sLastUid=c,a.checked(!a.checked())));d&&(this.selectedItem(a),this.sLastUid=c)}};M.prototype.on=function(a,b){this.oCallbacks[a]=b};sa.supported=function(){return!0}; sa.prototype.set=function(a,b){var d=j.cookie(t.Values.ClientSideCookieIndexName),c=null;try{(c=null===d?null:JSON.parse(d))||(c={}),c[a]=b,j.cookie(t.Values.ClientSideCookieIndexName,JSON.stringify(c),{expires:30})}catch(f){}return c};sa.prototype.get=function(a){var b=j.cookie(t.Values.ClientSideCookieIndexName),d=null;try{d=(d=null===b?null:JSON.parse(b))&&!c.isUnd(d[a])?d[a]:null}catch(f){}return d};ta.supported=function(){return!!h.localStorage};ta.prototype.set=function(a,b){var d=h.localStorage[t.Values.ClientSideCookieIndexName]|| null,c=null;try{(c=null===d?null:JSON.parse(d))||(c={}),c[a]=b,h.localStorage[t.Values.ClientSideCookieIndexName]=JSON.stringify(c)}catch(f){}return c};ta.prototype.get=function(a){var b=h.localStorage[t.Values.ClientSideCookieIndexName]||null,d=null;try{d=(d=null===b?null:JSON.parse(b))&&!c.isUnd(d[a])?d[a]:null}catch(f){}return d};ua.prototype.oDriver=null;ua.prototype.set=function(a,b){return this.oDriver?this.oDriver.set("p"+a,b):!1};ua.prototype.get=function(a){return this.oDriver?this.oDriver.get("p"+ a):null};Ua.prototype.bootstart=function(){};C.prototype.sPosition="";C.prototype.sTemplate="";C.prototype.viewModelName="";C.prototype.viewModelDom=null;C.prototype.viewModelTemplate=function(){return this.sTemplate};C.prototype.viewModelPosition=function(){return this.sPosition};C.prototype.cancelCommand=C.prototype.closeCommand=function(){};J.prototype.oCross=null;J.prototype.sScreenName="";J.prototype.aViewModels=[];J.prototype.viewModels=function(){return this.aViewModels};J.prototype.screenName= function(){return this.sScreenName};J.prototype.routes=function(){return null};J.prototype.__cross=function(){return this.oCross};J.prototype.__start=function(){var a=this.routes(),b=null,d=null;c.isNonEmptyArray(a)&&(d=i.bind(this.onRoute||c.emptyFunction,this),b=Ta.create(),i.each(a,function(a){b.addRoute(a[0],d).rules=a[1]}),this.oCross=b)};E.prototype.sDefaultScreenName="";E.prototype.oScreens={};E.prototype.oBoot=null;E.prototype.oCurrentScreen=null;E.prototype.showLoading=function(){j("#rl-loading").show()}; E.prototype.hideLoading=function(){j("#rl-loading").hide()};E.prototype.routeOff=function(){P.changed.active=!1};E.prototype.routeOn=function(){P.changed.active=!0};E.prototype.setBoot=function(a){c.isNormal(a)&&(this.oBoot=a);return this};E.prototype.screen=function(a){return""!==a&&!c.isUnd(this.oScreens[a])?this.oScreens[a]:null};E.prototype.delegateRun=function(a,b,d){a&&a[b]&&a[b].apply(a,c.isArray(d)?d:[])};E.prototype.buildViewModel=function(a,b){if(a&&!a.__builded){var d=new a(b),l=d.viewModelPosition(), g=j("#rl-content #rl-"+l.toLowerCase()),q=null;a.__builded=!0;a.__vm=d;d.data=f.data();d.viewModelName=a.__name;g&&1===g.length?(q=j("
").addClass("rl-view-model").addClass("RL-"+d.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+d.viewModelTemplate()+'"}, i18nInit: true'),q.appendTo(g),d.viewModelDom=q,a.__dom=q,"Popups"===l&&(d.cancelCommand=d.closeCommand=c.createCommand(d,function(){s.hideScreenPopup(a)})),x.runHook("view-model-pre-build",[a.__name,d,q]),e.applyBindings(d, q[0]),this.delegateRun(d,"onBuild",[q]),x.runHook("view-model-post-build",[a.__name,d,q])):c.log("Cannot find view model position: "+l)}return a?a.__vm:null};E.prototype.applyExternal=function(a,b){a&&b&&e.applyBindings(a,b)};E.prototype.hideScreenPopup=function(a){a&&(a.__vm&&a.__dom)&&(a.__dom.hide(),a.__vm.modalVisibility(!1),this.delegateRun(a.__vm,"onHide"),this.popupVisibility(!1),i.defer(function(){a.__dom.find(".ko-select2").select2("close")}))};E.prototype.showScreenPopup=function(a,b){a&& (this.buildViewModel(a),a.__vm&&a.__dom&&(a.__dom.show(),a.__vm.modalVisibility(!0),this.delegateRun(a.__vm,"onShow",b||[]),this.popupVisibility(!0),x.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};E.prototype.screenOnRoute=function(a,b){var d=this,f=null,e=null;""===c.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){f=this.screen(a);if(!f&&(f=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;f&&f.__started&&(f.__builded||(f.__builded=!0,c.isNonEmptyArray(f.viewModels())&& i.each(f.viewModels(),function(a){this.buildViewModel(a,f)},this),this.delegateRun(f,"onBuild")),i.defer(function(){if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onHide");c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);d.delegateRun(a.__vm,"onHide")}})}d.oCurrentScreen=f;if(d.oCurrentScreen){d.delegateRun(d.oCurrentScreen,"onShow");x.runHook("screen-on-show", [d.oCurrentScreen.screenName(),d.oCurrentScreen]);c.isNonEmptyArray(d.oCurrentScreen.viewModels())&&i.each(d.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);d.delegateRun(a.__vm,"onShow");x.runHook("view-model-on-show",[a.__name,a.__vm])}},d)}(e=f.__cross())&&e.parse(b)}))}};E.prototype.startScreens=function(a){i.each(a,function(a){var d=(a=new a)?a.screenName():"";a&&""!==d&&(""===this.sDefaultScreenName&& (this.sDefaultScreenName=d),this.oScreens[d]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),x.runHook("screen-pre-start",[a.screenName(),a]),this.delegateRun(a,"onStart"),x.runHook("screen-post-start",[a.screenName(),a]))},this);a=Ta.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));P.initialized.add(a.parse,a);P.changed.add(a.parse,a);P.init()};E.prototype.setHash=function(a,b){a="#"===a.substr(0,1)?a.substr(1): a;a="/"===a.substr(0,1)?a.substr(1):a;(c.isUnd(b)?0:b)?(P.changed.active=!1,P.setHash(a),P.changed.active=!0):(P.changed.active=!0,P.setHash(a))};E.prototype.bootstart=function(){this.oBoot&&this.oBoot.bootstart&&this.oBoot.bootstart();return this};s=new E;F.newInstanceFromJson=function(a){var b=new F;return b.initByJson(a)?b:null};F.prototype.name="";F.prototype.email="";F.prototype.privateType=null;F.prototype.validate=function(){return""!==this.name||""!==this.email};F.prototype.hash=function(a){return"#"+ (a?"":this.name)+"#"+this.email+"#"};F.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};F.prototype.type=function(){if(null===this.privateType&&(this.email&&"@facebook.com"===this.email.substr(-13)&&(this.privateType=g.EmailType.Facebook),null===this.privateType))this.privateType=g.EmailType.Default;return this.privateType};F.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};F.prototype.parse=function(a){var a=c.trim(a), b=/(?:"([^"]+)")? ?,]+)>?,? ?/g.exec(a);b?(this.name=b[1]||"",this.email=b[2]||"",this.clearDuplicateName()):/^[^@]+@[^@]+$/.test(a)&&(this.name="",this.email=a)};F.prototype.initByJson=function(a){var b=!1;a&&"Object/Email"===a["@Object"]&&(this.name=c.trim(a.Name),this.email=c.trim(a.Email),b=""!==this.email,this.clearDuplicateName());return b};F.prototype.toLine=function(a,b){var d="";""!==this.email&&(b=c.isUnd(b)?!1:!!b,a&&""!==this.name?d=b?'")+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.name)+"":this.name:(d=this.email,""!==this.name?d=b?c.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+c.encodeHtml(d)+""+c.encodeHtml(">"):'"'+this.name+'" <'+d+">":b&&(d=''+c.encodeHtml(this.email)+"")));return d};F.prototype.select2Result=function(){var a= "",b=f.cache().getUserPic(this.email),a=""!==b?a+(''):a+('');g.EmailType.Facebook===this.type()?(a+=""+(0'):a+=""+(0('+this.name+")":this.email);return a+""};F.prototype.select2Selection= function(a){var b="";if(g.EmailType.Facebook===this.type()){if(b=0").text(b).appendTo(a),a.append(''),null}else b=0+$/,""),b=!0);return b};D.prototype.isImage=function(){return"image/"===this.mimeType.substr(0,6)};D.prototype.isText=function(){return"text/"===this.mimeType.substr(0,5)};D.prototype.linkDownload=function(){return f.link().attachmentDownload(this.download)};D.prototype.linkPreview= function(){return f.link().attachmentPreview(this.download)};D.prototype.linkPreviewAsPlain=function(){return f.link().attachmentPreviewAsPlain(this.download)};D.prototype.generateTransferDownloadUrl=function(){var a=this.linkDownload();"http"!==a.substr(0,4)&&(a=h.location.protocol+"//"+h.location.host+h.location.pathname+a);return this.mimeType+":"+this.fileName+":"+a};D.prototype.eventDragStart=function(a,b){var d=b.originalEvent||b;a&&(d&&d.dataTransfer&&d.dataTransfer.setData)&&d.dataTransfer.setData("DownloadURL", this.generateTransferDownloadUrl());return!0};D.prototype.iconClass=function(){var a=this.mimeType.toLocaleString().split("/"),b="icon-file";a&&a[1]&&("image"===a[0]?b="icon-image":"text"===a[0]?b="icon-file-xml":"audio"===a[0]?b="icon-music":"video"===a[0]?b="icon-film":-1+$/,""),b=i.find(d,function(b){return a===b.cidWithOutTags}));return b||null};m.prototype.messageId=function(){return this.sMessageId};m.prototype.inReplyTo=function(){return this.sInReplyTo};m.prototype.references=function(){return this.sReferences};m.prototype.fromAsSingleEmail=function(){return c.isArray(this.from)&& this.from[0]?this.from[0].email:""};m.prototype.viewLink=function(){return f.link().messageViewLink(this.requestHash)};m.prototype.downloadLink=function(){return f.link().messageDownloadLink(this.requestHash)};m.prototype.replyEmails=function(a){var b=[],a=c.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a,b);return b};m.prototype.replyAllEmails=function(a){var b=[],d=[],a=c.isUnd(a)?{}:a;m.replyHelper(this.replyTo,a,b);0===b.length&&m.replyHelper(this.from,a, b);m.replyHelper(this.to,a,b);m.replyHelper(this.cc,a,d);return[b,d]};m.prototype.textBodyToString=function(){return this.body?this.body.html():""};m.prototype.attachmentsToStringLine=function(){var a=i.map(this.attachments(),function(a){return a.fileName+" ("+a.friendlySize+")"});return a&&0
"+k+":

"+o+"
";break;case g.ComposeType.Forward:K=r.fromToLine(!1,!0);q=r.toToLine(!1,!0);w=r.ccToLine(!1,!0);o="


"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TITLE")+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_FROM")+": "+K+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_TO")+": "+q+(0"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_CC")+": "+w:"")+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SENT")+ ": "+c.encodeHtml(k)+"
"+c.i18n("COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT")+": "+c.encodeHtml(h)+"

"+o;break;case g.ComposeType.ForwardAsAttachment:o=""}this.oEditor.setRawText(o,r.isHtml)}}else this.oEditor&&g.ComposeType.Empty===a?this.oEditor.setRawText("
"+c.convertPlainTextToHtml(f.data().signature()),g.EditorDefaultType.Html===f.data().editorDefaultType()):c.isNonEmptyArray(b)&&i.each(b,function(a){e.addMessageAsAttachment(a)});r=this.getAttachmentsDownloadsForUpload();c.isNonEmptyArray(r)&& f.remote().messageUploadAttachments(function(a,b){if(g.StorageResultType.Success===a&&b&&b.Result){var d=null,c="";if(!e.viewModelVisibility())for(c in b.Result)b.Result.hasOwnProperty(c)&&(d=e.getAttachmentById(b.Result[c]))&&d.tempName(c)}else e.setMessageAttachmentFailedDowbloadText()},r);this.triggerForResize()};y.prototype.onBuild=function(){this.initEditor();this.initUploader();var a=this,b=null;R.on("keydown",function(b){var c=!0;b&&(a.modalVisibility()&&f.data().useKeyboardShortcuts())&&(b.ctrlKey&& g.EventKeyCode.S===b.keyCode)&&(a.saveCommand(),c=!1);return c});R.on("resize",function(){a.triggerForResize()});this.dropboxEnabled()&&(b=document.createElement("script"),b.type="text/javascript",b.src="https://www.dropbox.com/static/api/1/dropins.js",j(b).attr("id","dropboxjs").attr("data-app-key",f.settingsGet("DropboxApiKey")),document.body.appendChild(b))};y.prototype.getAttachmentById=function(a){for(var b=this.attachments(),d=0,c=b.length;d').hide(),c.isNormal(a.Result.Html)&&""!==a.Result.Html?(d=!0,i.html(a.Result.Html.toString()).addClass("b-text-part html")):c.isNormal(a.Result.Plain)&&""!==a.Result.Plain?(d=!1,i.html(a.Result.Plain.toString()).addClass("b-text-part plain")):d=!1,h.append(i),i.data("rl-is-html",d),i.data("rl-has-images", e),k.isHtml(i.data("rl-is-html")),k.hasImages(i.data("rl-has-images")),k.body=i,g&&k.showInternalImages(!0),k.hasImages()&&this.showImages()&&k.showExternalImages(!0)):(k.isHtml(e.data("rl-is-html")),k.hasImages(e.data("rl-has-images")),k.body=e),this.messageActiveDom(k.body),this.hideMessageBodies(),k.body.show(),i&&c.initBlockquoteSwitcher(i);f.cache().initMessageFlagsFromCache(k);k.unseen()&&f.setMessageSeen(k);c.windowResize()}};T.prototype.setMessageList=function(a,b){if(a&&a.Result&&"Collection/MessageCollection"=== a.Result["@Object"]&&a.Result["@Collection"]&&c.isArray(a.Result["@Collection"])){var d=f.data(),e=f.cache(),i=null,h=0,j=0,k=0,s=0,o=[],r=d.staticMessageList,t=null,p=null,n=null,u=0,v=!1,k=c.pInt(a.Result.MessageResultCount),s=c.pInt(a.Result.Offset);c.isNonEmptyArray(a.Result.LastCollapsedThreadUids)&&(i=a.Result.LastCollapsedThreadUids);if((n=f.cache().getFolderFromCacheList(c.isNormal(a.Result.Folder)?a.Result.Folder:""))&&!b)f.cache().setFolderHash(a.Result.Folder,a.Result.FolderHash),c.isNormal(a.Result.MessageCount)&& n.messageCountAll(a.Result.MessageCount),c.isNormal(a.Result.MessageUnseenCount)&&(c.pInt(n.messageCountUnread())!==c.pInt(a.Result.MessageUnseenCount)&&(v=!0),n.messageCountUnread(a.Result.MessageUnseenCount)),this.initUidNextAndNewMessages(n.fullNameRaw,a.Result.UidNext,a.Result.NewMessages);v&&n&&f.cache().clearMessageFlagsFromCacheByFolder(n.fullNameRaw);h=0;for(j=a.Result["@Collection"].length;h=u&&(u++,p.newForAnimation(!0)),p.deleted(!1),b?f.cache().initMessageFlagsFromCache(p):f.cache().storeMessageFlagsToCache(p),p.lastInCollapsedThread(i&&-1(new h.Date).getTime()-k);o&&q.oRequests[o]&&(q.oRequests[o].__aborted&&(f="abort"),q.oRequests[o]=null);q.defaultResponse(a,o,f,d,e,b)});o&&(0
").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+ g.__rlSettingsData.Template+'"}, i18nInit: true'),q.appendTo(h),d.data=f.data(),d.viewModelDom=q,d.__rlSettingsData=g.__rlSettingsData,g.__dom=q,g.__builded=!0,g.__vm=d,e.applyBindings(d,q[0]),s.delegateRun(d,"onBuild",[q])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),d&&i.defer(function(){if(b.oCurrentSubScreen){s.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide()}b.oCurrentSubScreen=d;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show(); s.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(d&&d.__rlSettingsData&&a.route===d.__rlSettingsData.Route)})}c.windowResize()}))};fa.prototype.onBuild=function(){i.each(Da,function(a){a&&(a.__rlSettingsData&&!i.find(Qa,function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:e.observable(!1),disabled:!!i.find(Ra,function(b){return b&&b===a})})},this)};fa.prototype.routes=function(){var a=i.find(Da,function(a){return a&& a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,f){f.subname=c.isUnd(f.subname)?b:c.pString(f.subname);return[f.subname]}};return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(Aa.prototype,J.prototype);Aa.prototype.onShow=function(){f.setTitle(c.i18n("TITLES/LOGIN"))};i.extend(V.prototype,J.prototype);V.prototype.oLastRoute={};V.prototype.onShow=function(){var a=f.data().accountEmail();f.setTitle((""===a?"":a+ " - ")+c.i18n("TITLES/MAILBOX"));this.mailBoxScreenVisibily(!0)};V.prototype.onHide=function(){this.mailBoxScreenVisibily(!1)};V.prototype.onRoute=function(a,b,c){var e=f.data(),a=f.cache().getFolderFullNameRaw(a);if(a=f.cache().getFolderFromCacheList(a))e.currentFolder(a).messageListPage(b).messageListSearch(c),!e.usePreviewPane()&&e.message()&&e.message(null),f.reloadMessageList()};V.prototype.onStart=function(){var a=f.data(),b=function(){c.windowResize()};f.settingsGet("AllowAdditionalAccounts")&& f.accounts();i.delay(function(){f.quota()},5E3);i.delay(function(){"INBOX"!==a.currentFolderFullNameRaw()&&f.folderInformation("INBOX")},1E3);i.delay(function(){f.remote().appDelayStart(c.emptyFunction)},35E3);h.setInterval(function(){f.folderInformation("INBOX")},12E4);h.setInterval(function(){f.quota()},3E5);Z.toggleClass("rl-no-preview-pane",!a.usePreviewPane());a.folderList.subscribe(b);a.messageList.subscribe(b);a.message.subscribe(b);a.usePreviewPane.subscribe(function(b){Z.toggleClass("rl-no-preview-pane", !b);a.messageList.valueHasMutated()})};V.prototype.onBuild=function(){i.defer(i.bind(function(){c.initLayoutResizer("#rl-resizer-left","#rl-resizer-right","#rl-right",this.resizeTrigger)},this))};V.prototype.routes=function(){var a=function(a,d){d[0]=c.pString(d[0]);d[1]=c.pInt(d[1]);d[1]=0>=d[1]?1:d[1];d[2]=c.pString(d[2]);""===a&&(d[0]="Inbox",d[1]=1);return[decodeURI(d[0]),d[1],decodeURI(d[2])]};return[[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/,{normalize_:a}],[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/?$/, {normalize_:a}],[/^([a-zA-Z0-9]+)\/(.+)\/?$/,{normalize_:function(a,d){d[0]=c.pString(d[0]);d[1]=c.pString(d[1]);""===a&&(d[0]="Inbox");return[decodeURI(d[0]),1,decodeURI(d[1])]}}],[/^([^\/]*)$/,{normalize_:a}]]};i.extend(Oa.prototype,fa.prototype);Oa.prototype.onShow=function(){f.setTitle(this.sSettingsTitle)};i.extend(I.prototype,Ua.prototype);I.prototype.oSettings=null;I.prototype.oLink=null;I.prototype.download=function(a){na?this.iframe.attr("src",a):h.open(a)};I.prototype.link=function(){null=== this.oLink&&(this.oLink=new B);return this.oLink};I.prototype.local=function(){null===this.oLocal&&(this.oLocal=new ua);return this.oLocal};I.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=c.isNormal(Ba)?Ba:{});return c.isUnd(this.oSettings[a])?null:this.oSettings[a]};I.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=c.isNormal(Ba)?Ba:{});this.oSettings[a]=b};I.prototype.setTitle=function(a){a=(0