(function(h,j,d,qa,z,i){function m(){this.sBase="#/";this.sCdnStaticDomain=f.settingsGet("CdnStaticDomain");this.sVersion=f.settingsGet("Version");this.sSpecSuffix=f.settingsGet("AuthAccountHash")||"0";this.sServer="./?";this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function M(){}function N(){}function O(){var a=i.find([N,M],function(a){return a.supported()});a&&(this.oDriver=new a)}function ra(){}
function u(a,b){this.sPosition=c.pString(a);this.sTemplate=c.pString(b);this.viewModelName="";this.viewModelVisibility=d.observable(!1);"Popups"===this.sPosition&&(this.modalVisibility=d.observable(!1));this.viewModelDom=null}function x(a,b){this.sScreenName=a;this.aViewModels=c.isArray(b)?b:[]}function q(){this.sDefaultScreenName="";this.oScreens={};this.oCurrentScreen=this.oBoot=null;this.popupVisibility=d.observable(!1);this.popupVisibility.subscribe(function(a){f&&f.popupVisibility(a)})}function t(a,
b){this.email=a||"";this.name=b||"";this.privateType=null;this.clearDuplicateName()}function A(){u.call(this,"Popups","PopupsDomain");this.edit=d.observable(!1);this.saving=d.observable(!1);this.savingError=d.observable("");this.whiteListPage=d.observable(!1);this.testing=d.observable(!1);this.testingDone=d.observable(!1);this.testingImapError=d.observable(!1);this.testingSmtpError=d.observable(!1);this.imapServerFocus=d.observable(!1);this.smtpServerFocus=d.observable(!1);this.name=d.observable("");
this.imapServer=d.observable("");this.imapPort=d.observable(l.Values.ImapDefaulPort);this.imapSecure=d.observable(g.ServerSecure.None);this.smtpServer=d.observable("");this.smtpPort=d.observable(l.Values.SmtpDefaulPort);this.smtpSecure=d.observable(g.ServerSecure.None);this.smtpAuth=d.observable(!0);this.whiteList=d.observable("");this.imapServerFocus.subscribe(function(a){a&&(""!==this.name()&&""===this.imapServer())&&this.imapServer(this.name())},this);this.smtpServerFocus.subscribe(function(a){a&&
(""!==this.imapServer()&&""===this.smtpServer())&&this.smtpServer(this.imapServer())},this);this.headerText=d.computed(function(){var a=this.name();return this.edit()?'Edit Domain "'+a+'"':"Add Domain"+(""===a?"":' "'+a+'"')},this);this.domainIsComputed=d.computed(function(){return""!==this.name()&&""!==this.imapServer()&&""!==this.imapPort()&&""!==this.smtpServer()&&""!==this.smtpPort()},this);this.canBeTested=d.computed(function(){return!this.testing()&&this.domainIsComputed()},this);this.canBeSaved=
d.computed(function(){return!this.saving()&&this.domainIsComputed()},this);this.createOrAddCommand=c.createCommand(this,function(){this.saving(!0);f.remote().createOrUpdateDomain(i.bind(this.onDomainCreateOrSaveResponse,this),!this.edit(),this.name(),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth(),this.whiteList())},this.canBeSaved);this.testConnectionCommand=c.createCommand(this,function(){this.whiteListPage(!1);this.testingDone(!1);
this.testingImapError(!1);this.testingSmtpError(!1);this.testing(!0);f.remote().testConnectionForDomain(i.bind(this.onTestConnectionResponse,this),this.imapServer(),this.imapPort(),this.imapSecure(),this.smtpServer(),this.smtpPort(),this.smtpSecure(),this.smtpAuth())},this.canBeTested);this.whiteListCommand=c.createCommand(this,function(){this.whiteListPage(!this.whiteListPage())})}function P(){u.call(this,"Popups","PopupsPlugin");this.onPluginSettingsUpdateResponse=i.bind(this.onPluginSettingsUpdateResponse,
this);this.saveError=d.observable("");this.name=d.observable("");this.readme=d.observable("");this.configures=d.observableArray([]);this.hasReadme=d.computed(function(){return""!==this.readme()},this);this.hasConfiguration=d.computed(function(){return 0').appendTo("body");G.on("error",function(a){f&&(a&&a.originalEvent&&a.originalEvent.message&&-1===c.inArray(a.originalEvent.message,["Uncaught Error: Error calling method on NPObject."]))&&f.remote().jsError(c.emptyFunction,a.originalEvent.message,a.originalEvent.filename,
a.originalEvent.lineno,location&&location.toString?location.toString():"",T.attr("class"))})}function w(){v.call(this);this.oCache=this.oRemote=this.oData=null}var l={},g={},k={},c={},n={},U,V,ja,H,ka,D,la=d.observable(!0),W=d.observable(!0),r=null,X=h.rainloopAppData||{},ma=h.rainloopI18N||{},T=j("html"),G=j(h),va=j(h.document),Y=[],na=[],oa=[],Z=h.Notification&&h.Notification.requestPermission?h.Notification:null,f=null;V=U=0;ja=!1;H=(navigator.userAgent||"").toLowerCase();ka=-1/g,">").replace(/"/g,""").replace(/'/g,"'"):""};c.splitPlainText=function(a,b){for(var e="",s="",d=a,f=0,g=0,b=c.isUnd(b)?100:b;d.length>b;)s=d.substring(0,b),f=s.lastIndexOf(" "),g=s.lastIndexOf("\n"),-1!==g&&(f=g),-1===f&&(f=b),e+=s.substring(0,f)+"\n",d=d.substring(f+1);return e+d};var aa={};c.timeOutAction=function(a,
b,e){c.isUnd(aa[a])&&(aa[a]=0);h.clearTimeout(aa[a]);aa[a]=h.setTimeout(b,e)};var pa={};c.timeOutActionSecond=function(a,b,e){pa[a]||(pa[a]=h.setTimeout(function(){b();pa[a]=0},e))};var y=!1;c.audio=function(a,b){if(!1===y)if(ka)y=null;else{var e=!1,c=!1,d=h.Audio?new h.Audio:null;d&&d.canPlayType&&d.play?((e=""!==d.canPlayType('audio/mpeg; codecs="mp3"'))||(c=""!==d.canPlayType('audio/ogg; codecs="vorbis"')),e||c?(y=d,y.preload="none",y.loop=!1,y.autoplay=!1,y.muted=!1,y.src=e?a:b):y=null):y=null}return y};
c.hos=function(a,b){return a&&Object.hasOwnProperty?Object.hasOwnProperty.call(a,b):!1};c.i18n=function(a,b,e){var d="",a=c.isUnd(ma[a])?c.isUnd(e)?a:e:ma[a];if(!c.isUnd(b)&&!c.isNull(b))for(d in b)c.hos(b,d)&&(a=a.replace("%"+d+"%",b[d]));return a};c.i18nToNode=function(a){i.defer(function(){j(".i18n",a).each(function(){var a=j(this),e="";(e=a.data("i18n-text"))?a.text(c.i18n(e)):((e=a.data("i18n-html"))&&a.html(c.i18n(e)),(e=a.data("i18n-placeholder"))&&a.attr("placeholder",c.i18n(e)))})})};c.i18nToDoc=
function(){h.rainloopI18N&&(ma=h.rainloopI18N||{},c.i18nToNode(va),W(!W()));h.rainloopI18N={}};c.initOnStartOrLangChange=function(a,b,e){a&&a.call(b);e?W.subscribe(function(){a&&a.call(b);e.call(b)}):a&&W.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 e=null,d=c.trim(b);null!==(e=(new h.RegExp("^"+a+"[\\s]?\\:(.*)$","gi")).exec(b))&&!c.isUnd(e[1])?d=a+"[2]: "+e[1]:null!==(e=(new h.RegExp("^("+a+"[\\s]?[\\[\\(]?)([\\d]+)([\\]\\)]?[\\s]?\\:.*)$",
"gi")).exec(b))&&!c.isUnd(e[1])&&!c.isUnd(e[2])&&!c.isUnd(e[3])?(c.pInt(e[2]),d=e[1]+(c.pInt(e[2])+1)+e[3]):d=a+": "+b;return d};c.roundNumber=function(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)};c.friendlySize=function(a){a=c.pInt(a);return 1073741824<=a?c.roundNumber(a/1073741824,1)+"GB":1048576<=a?c.roundNumber(a/1048576,1)+"MB":1024<=a?c.roundNumber(a/1024,0)+"KB":a+"B"};c.log=function(a){h.console&&h.console.log&&h.console.log(a)};c.getNotification=function(a){a=c.pInt(a);return c.isUnd(k[a])?
"":k[a]};c.initNotificationLanguage=function(){k[g.Notification.InvalidToken]=c.i18n("NOTIFICATIONS/INVALID_TOKEN");k[g.Notification.AuthError]=c.i18n("NOTIFICATIONS/AUTH_ERROR");k[g.Notification.AccessError]=c.i18n("NOTIFICATIONS/ACCESS_ERROR");k[g.Notification.ConnectionError]=c.i18n("NOTIFICATIONS/CONNECTION_ERROR");k[g.Notification.CaptchaError]=c.i18n("NOTIFICATIONS/CAPTCHA_ERROR");k[g.Notification.SocialFacebookLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE");
k[g.Notification.SocialTwitterLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE");k[g.Notification.SocialGoogleLoginAccessDisable]=c.i18n("NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE");k[g.Notification.DomainNotAllowed]=c.i18n("NOTIFICATIONS/DOMAIN_NOT_ALLOWED");k[g.Notification.AccountNotAllowed]=c.i18n("NOTIFICATIONS/ACCOUNT_NOT_ALLOWED");k[g.Notification.CantGetMessageList]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE_LIST");k[g.Notification.CantGetMessage]=c.i18n("NOTIFICATIONS/CANT_GET_MESSAGE");
k[g.Notification.CantDeleteMessage]=c.i18n("NOTIFICATIONS/CANT_DELETE_MESSAGE");k[g.Notification.CantMoveMessage]=c.i18n("NOTIFICATIONS/CANT_MOVE_MESSAGE");k[g.Notification.CantSaveMessage]=c.i18n("NOTIFICATIONS/CANT_SAVE_MESSAGE");k[g.Notification.CantSendMessage]=c.i18n("NOTIFICATIONS/CANT_SEND_MESSAGE");k[g.Notification.InvalidRecipients]=c.i18n("NOTIFICATIONS/INVALID_RECIPIENTS");k[g.Notification.CantCreateFolder]=c.i18n("NOTIFICATIONS/CANT_CREATE_FOLDER");k[g.Notification.CantRenameFolder]=c.i18n("NOTIFICATIONS/CANT_RENAME_FOLDER");
k[g.Notification.CantDeleteFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_FOLDER");k[g.Notification.CantDeleteNonEmptyFolder]=c.i18n("NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER");k[g.Notification.CantSubscribeFolder]=c.i18n("NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER");k[g.Notification.CantUnsubscribeFolder]=c.i18n("NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER");k[g.Notification.CantSaveSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_SETTINGS");k[g.Notification.CantSavePluginSettings]=c.i18n("NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS");
k[g.Notification.DomainAlreadyExists]=c.i18n("NOTIFICATIONS/DOMAIN_ALREADY_EXISTS");k[g.Notification.CantInstallPackage]=c.i18n("NOTIFICATIONS/CANT_INSTALL_PACKAGE");k[g.Notification.CantDeletePackage]=c.i18n("NOTIFICATIONS/CANT_DELETE_PACKAGE");k[g.Notification.InvalidPluginPackage]=c.i18n("NOTIFICATIONS/INVALID_PLUGIN_PACKAGE");k[g.Notification.UnsupportedPluginPackage]=c.i18n("NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE");k[g.Notification.LicensingServerIsUnavailable]=c.i18n("NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE");
k[g.Notification.LicensingExpired]=c.i18n("NOTIFICATIONS/LICENSING_EXPIRED");k[g.Notification.LicensingBanned]=c.i18n("NOTIFICATIONS/LICENSING_BANNED");k[g.Notification.DemoSendMessageError]=c.i18n("NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR");k[g.Notification.AccountAlreadyExists]=c.i18n("NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS");k[g.Notification.MailServerError]=c.i18n("NOTIFICATIONS/MAIL_SERVER_ERROR");k[g.Notification.UnknownNotification]=c.i18n("NOTIFICATIONS/UNKNOWN_ERROR");k[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,e=a.keyCode||a.which;if(a.ctrlKey&&e===g.EventKeyCode.S)a.preventDefault();else if((!b||!b.tagName||!b.tagName.match(/INPUT|TEXTAREA/i))&&a.ctrlKey&&e===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,e){var s=b?function(){s.canExecute&&s.canExecute()&&b.apply(a,Array.prototype.slice.call(arguments));return!1}:function(){};s.enabled=d.observable(!0);e=c.isUnd(e)?!0:e;s.canExecute=c.isFunc(e)?d.computed(function(){return s.enabled()&&e.call(a)}):d.computed(function(){return s.enabled()&&!!e});return s};c.initDataConstructorBySettings=function(a){a.ignoreFolderSubscribe=d.observable(!1);a.editorDefaultType=d.observable(g.EditorDefaultType.Html);
a.showImages=d.observable(!1);a.showAnimation=d.observable(!1);a.allowThemes=d.observable(!0);a.allowCustomLogin=d.observable(!1);a.allowLanguagesOnSettings=d.observable(!0);a.allowLanguagesOnLogin=d.observable(!0);a.desktopNotifications=d.observable(!1);a.useThreads=d.observable(!0);a.replySameFolder=d.observable(!0);a.usePreviewPane=d.observable(!0);a.useCheckboxesInList=d.observable(!0);a.showAnimation.subscribe(function(a){D?T.removeClass("rl-anim").addClass("no-rl-anim"):T.toggleClass("rl-anim",
a).toggleClass("no-rl-anim",!a)});a.showAnimation.valueHasMutated();a.desktopNotificationsPermisions=d.computed(function(){a.desktopNotifications();var b=g.DesktopNotifications.NotSupported;if(Z&&Z.permission)switch(Z.permission.toLowerCase()){case "granted":b=g.DesktopNotifications.Allowed;break;case "denied":b=g.DesktopNotifications.Denied;break;case "default":b=g.DesktopNotifications.NotAllowed}else h.webkitNotifications&&h.webkitNotifications.checkPermission&&(b=h.webkitNotifications.checkPermission());
return b});a.useDesktopNotifications=d.computed({read:function(){return a.desktopNotifications()&&g.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()},write:function(b){b?(b=a.desktopNotificationsPermisions(),g.DesktopNotifications.Allowed===b?a.desktopNotifications(!0):g.DesktopNotifications.NotAllowed===b?Z.requestPermission(function(){a.desktopNotifications.valueHasMutated();g.DesktopNotifications.Allowed===a.desktopNotificationsPermisions()?a.desktopNotifications()?a.desktopNotifications.valueHasMutated():
a.desktopNotifications(!0):a.desktopNotifications()?a.desktopNotifications(!1):a.desktopNotifications.valueHasMutated()}):a.desktopNotifications(!1)):a.desktopNotifications(!1)}});a.language=d.observable("");a.languages=d.observableArray([]);a.mainLanguage=d.computed({read:a.language,write:function(b){b!==a.language()?-1=a.diff(e,"hours")?d:a.format("L")===e.format("L")?c.i18n("MESSAGE_LIST/TODAY_AT",{TIME:e.format("LT")}):a.clone().subtract("days",1).format("L")===e.format("L")?c.i18n("MESSAGE_LIST/YESTERDAY_IN",{TIME:e.format("LT")}):a.year()===e.year()?e.format("D MMM."):
e.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 e=f.local().get(g.ClientSideKeyName.ExpandedFolders);i.isArray(e)||(e=[]);b?(e.push(a),e=i.uniq(e)):e=i.without(e,a);f.local().set(g.ClientSideKeyName.ExpandedFolders,e)};c.initLayoutResizer=function(a,b,e,c,d,g,h,ba,ca){var d=d||300,g=g||500,h=h||g-d/2,ba=ba||300,p=0,k=j(a),l=j(b),n=j(e),b=f.local().get(ca)||h,
m=function(a,b,e){if(b||e)a=n.width(),b=b?100*(b.size.width/a):null,null===b&&e&&(b=100*(k.width()/a)),null!==b&&(k.css({width:"",height:"",right:""+(100-b)+"%"}),l.css({width:"",height:"",left:""+b+"%"}))};b&&k.width(b);p=n.width()-ba;p=g>p?p:g;k.resizable({minWidth:d,maxWidth:p,handles:"e",resize:m,stop:m});m(null,null,!0);G.resize(i.throttle(function(b,e){c&&(c()&&e&&e.element&&e.element[0].id&&"#"+e.element[0].id===""+a)&&(p=n.width()-ba,p=g>p?p:g,k.resizable("option","maxWidth",p),e.size&&e.size.width&&
f.local().set(ca,e.size.width),m(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,n.regViewModelHook(a,b),i.extend(b.prototype,u.prototype))};c.addSettingsViewModel=function(a,b,e,c,d){a.__rlSettingsData={Label:e,Template:b,Route:c,IsDefault:!!d};Y.push(a)};c.removeSettingsViewModel=function(a){na.push(a)};c.disableSettingsViewModel=
function(a){oa.push(a)};c.convertThemeName=function(a){return c.trim(a.replace(/[^a-zA-Z]/g," ").replace(/([A-Z])/g," $1").replace(/[\s]+/g," "))};c.convertLangName=function(a){return c.i18n("LANGS_NAMES/LANG_"+a.toUpperCase().replace(/[^a-zA-Z0-9]+/,"_"),null,a)};c.fakeMd5=function(a){for(var b="",a=c.isUnd(a)?32:c.pInt(a);b.length/g,">").replace(/")};c.draggeblePlace=function(){return j('
').appendTo("#rl-hidden")};c.defautOptionsAfterRender=function(a,b){b&&!c.isUnd(b.disable)&&d.applyBindingsToNode(a,{disable:b.disable},b)};c.windowPopupKnockout=function(a,b,e,d){var f=null,g=h.open(""),i="__OpenerApplyBindingsUid"+c.fakeMd5()+"__",k=j("#"+b);h[i]=
function(){if(g&&g.document.body&&k&&k[0]){var b=j(g.document.body);j("#rl-content",b).html(k.html());j("html",g.document).addClass("external "+j("html").attr("class"));c.i18nToNode(b);q.prototype.applyExternal(a,j("#rl-content",b)[0]);h[i]=null;d(g)}};g.document.open();g.document.write(''+
c.encodeHtml(e)+'');g.document.close();f=g.document.createElement("script");f.type="text/javascript";f.innerHTML="if(window&&window.opener&&window.opener['"+i+"']){window.opener['"+i+"']();window.opener['"+i+"']=null}";g.document.getElementsByTagName("head")[0].appendChild(f)};c.settingsSaveHelperFunction=function(a,b,e,d){e=e||null;d=c.isUnd(d)?1E3:c.pInt(d);return function(c,f,h,j,ca){b.call(e,f&&f.Result?g.SaveSettingsStep.TrueResult:
g.SaveSettingsStep.FalseResult);a&&a.call(e,c,f,h,j,ca);i.delay(function(){b.call(e,g.SaveSettingsStep.Idle)},d)}};c.settingsSaveHelperSimpleFunction=function(a,b){return c.settingsSaveHelperFunction(null,a,b,1E3)};c.resizeAndCrop=function(a,b,e){var c=new Image;c.onload=function(){var a=[0,0],c=document.createElement("canvas"),d=c.getContext("2d");c.width=b;c.height=b;a=this.width>this.height?[this.width-this.height,0]:[0,this.height-this.width];d.fillStyle="#fff";d.fillRect(0,0,b,b);d.drawImage(this,
a[0]/2,a[1]/2,this.width-a[0],this.height-a[1],0,0,b,b);e(c.toDataURL("image/jpeg"))};c.src=a};d.bindingHandlers.tooltip={init:function(a,b){if(!D){var e=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,trigger:"hover",title:function(){return''+c.i18n(d.utils.unwrapObservable(b()))+""}})}}};d.bindingHandlers.tooltip2={init:function(a,b){var c=j(a).data("tooltip-class")||"";j(a).tooltip({delay:{show:500,hide:100},html:!0,title:function(){return''+b()()+""}})}};d.bindingHandlers.popover={init:function(a,b){j(a).popover(d.utils.unwrapObservable(b()))}};d.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"})}};d.bindingHandlers.onEnter={init:function(a,b,c,d){j(a).on("keypress",function(c){c&&13===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};d.bindingHandlers.onEsc=
{init:function(a,b,c,d){j(a).on("keypress",function(c){c&&27===h.parseInt(c.keyCode,10)&&(j(a).trigger("change"),b().call(d))})}};d.bindingHandlers.modal={init:function(a,b){j(a).modal({keyboard:!1,show:d.utils.unwrapObservable(b())}).on("hidden",function(){b()(!1)})},update:function(a,b){var c=d.utils.unwrapObservable(b());j(a).modal(c?"show":"hide");i.delay(function(){j(a).toggleClass("popup-active",c)},1)}};d.bindingHandlers.i18nInit={init:function(a){c.i18nToNode(a)}};d.bindingHandlers.i18nUpdate=
{update:function(a,b){d.utils.unwrapObservable(b());c.i18nToNode(a)}};d.bindingHandlers.link={update:function(a,b){j(a).attr("href",d.utils.unwrapObservable(b()))}};d.bindingHandlers.title={update:function(a,b){j(a).attr("title",d.utils.unwrapObservable(b()))}};d.bindingHandlers.textF={init:function(a,b){j(a).text(d.utils.unwrapObservable(b()))}};d.bindingHandlers.initDom={init:function(a,b){b()(a)}};d.bindingHandlers.initResizeTrigger={init:function(a,b){var c=d.utils.unwrapObservable(b());j(a).css({height:c[1],
"min-height":c[1]})},update:function(a,b){var e=d.utils.unwrapObservable(b()),f=c.pInt(e[1]),g=0,g=j(a).offset().top;0=e.left&&a.pageX<=e.left+d.width()&&(a.pageY>=b-100&&a.pageY<=b&&(b=function(){d.scrollTop(d.scrollTop()+3);c.windowResize()},d.data("timerScroll",h.setInterval(b,10)),b()),a.pageY>=e.top&&a.pageY<=e.top+100))e=function(){d.scrollTop(d.scrollTop()-3);c.windowResize()},d.data("timerScroll",h.setInterval(e,10)),
e()})},e.stop=function(){j(f).each(function(){h.clearInterval(j(this).data("timerScroll"));j(this).data("timerScroll",!1)})});e.helper=function(a){return b()(a&&a.target?d.dataFor(a.target):null)};j(a).draggable(e).on("mousedown",function(){c.removeInFocus()})}}};d.bindingHandlers.droppable={init:function(a,b,c){if(!D){var d=b(),f=(b=c())&&b.droppableOver?b.droppableOver:null,g=b&&b.droppableOut?b.droppableOut:null,b={tolerance:"pointer",hoverClass:"droppableHover"};d&&(b.drop=function(a,b){d(a,b)},
f&&(b.over=function(a,b){f(a,b)}),g&&(b.out=function(a,b){g(a,b)}),j(a).droppable(b))}}};d.bindingHandlers.nano={init:function(a){D||j(a).addClass("nano").nanoScroller({iOSNativeScrolling:!1,preventPageScrolling:!0})}};d.bindingHandlers.saveTrigger={init:function(a){j(a).append(' ').addClass("settings-saved-trigger")},update:function(a,b){var c=d.utils.unwrapObservable(b()),f=j(a);switch(c.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")}}};d.bindingHandlers.select2={init:function(a,b){var e=0,g=null,wa=new h.RegExp(/[a-zA-Z0-9\.\-_]+@[a-zA-Z0-9\.\-_]+/),xa=new h.RegExp(/(.+) [<]?([^\s<@]+@[a-zA-Z0-9\.\-_]+)[>]?/),
k=function(){return""},l=function(a){f.getAutocomplete(a.term,a.page,function(b,c){a.callback({more:!!c,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===e?(l(a),e=h.setTimeout(c.emptyFunction,100)):(h.clearInterval(e),e=h.setTimeout(function(){l(a)},100)))},formatSelection:function(a,b){var c=a&&a.c?a.c.select2Selection(b):a.text;if(null!==c)return c},formatResult:function(a,b,c,e){b=a&&a.c?a.c.select2Result(b):
"";return""===b?e(a.text):b},createSearchChoice:function(a,b){return 0===b.length&&wa.test(a)?{id:a,text:a}:null},formatNoMatches:k,formatSearching:function(){return c.i18n("SUGGESTIONS/SEARCHING_DESC")},formatInputTooShort:k,formatSelectionTooBig:k,multiple:!0,tokenSeparators:[",",";"],minimumInputLength:2,selectOnBlur:!1,closeOnSelect:!0,openOnEnter:!1});d.utils.domNodeDisposal.addDisposeCallback(a,function(){j(a).select2("destroy")});j(a).on("change",function(){for(var a=j(this).select2("data"),
e=0,d=a.length,f=null,h=[];e").addClass("rl-view-model").addClass("RL-"+e.viewModelTemplate()).hide().attr("data-bind",'template: {name: "'+e.viewModelTemplate()+'"}, i18nInit: true'),i.appendTo(h),e.viewModelDom=i,a.__dom=i,"Popups"===g&&(e.cancelCommand=e.closeCommand=c.createCommand(e,function(){r.hideScreenPopup(a)})),n.runHook("view-model-pre-build",[a.__name,e,i]),d.applyBindings(e,i[0]),this.delegateRun(e,"onBuild",[i]),n.runHook("view-model-post-build",[a.__name,e,i])):c.log("Cannot find view model position: "+
g)}return a?a.__vm:null};q.prototype.applyExternal=function(a,b){a&&b&&d.applyBindings(a,b)};q.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")}))};q.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),
n.runHook("view-model-on-show",[a.__name,a.__vm,b||[]])))};q.prototype.screenOnRoute=function(a,b){var e=this,d=null,f=null;""===c.pString(a)&&(a=this.sDefaultScreenName);if(""!==a){d=this.screen(a);if(!d&&(d=this.screen(this.sDefaultScreenName)))b=a+"/"+b,a=this.sDefaultScreenName;d&&d.__started&&(d.__builded||(d.__builded=!0,c.isNonEmptyArray(d.viewModels())&&i.each(d.viewModels(),function(a){this.buildViewModel(a,d)},this),this.delegateRun(d,"onBuild")),i.defer(function(){if(e.oCurrentScreen){e.delegateRun(e.oCurrentScreen,
"onHide");c.isNonEmptyArray(e.oCurrentScreen.viewModels())&&i.each(e.oCurrentScreen.viewModels(),function(a){if(a.__vm&&a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.hide();a.__vm.viewModelVisibility(false);e.delegateRun(a.__vm,"onHide")}})}e.oCurrentScreen=d;if(e.oCurrentScreen){e.delegateRun(e.oCurrentScreen,"onShow");n.runHook("screen-on-show",[e.oCurrentScreen.screenName(),e.oCurrentScreen]);c.isNonEmptyArray(e.oCurrentScreen.viewModels())&&i.each(e.oCurrentScreen.viewModels(),function(a){if(a.__vm&&
a.__dom&&"Popups"!==a.__vm.viewModelPosition()){a.__dom.show();a.__vm.viewModelVisibility(true);e.delegateRun(a.__vm,"onShow");n.runHook("view-model-on-show",[a.__name,a.__vm])}},e)}(f=d.__cross())&&f.parse(b)}))}};q.prototype.startScreens=function(a){i.each(a,function(a){var c=(a=new a)?a.screenName():"";a&&""!==c&&(""===this.sDefaultScreenName&&(this.sDefaultScreenName=c),this.oScreens[c]=a)},this);i.each(this.oScreens,function(a){a&&(!a.__started&&a.__start)&&(a.__started=!0,a.__start(),n.runHook("screen-pre-start",
[a.screenName(),a]),this.delegateRun(a,"onStart"),n.runHook("screen-post-start",[a.screenName(),a]))},this);a=qa.create();a.addRoute(/^([a-zA-Z0-9\-]*)\/?(.*)$/,i.bind(this.screenOnRoute,this));z.initialized.add(a.parse,a);z.changed.add(a.parse,a);z.init()};q.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)?(z.changed.active=!1,z.setHash(a),z.changed.active=!0):(z.changed.active=!0,z.setHash(a))};q.prototype.bootstart=function(){this.oBoot&&
this.oBoot.bootstart&&this.oBoot.bootstart();return this};r=new q;t.newInstanceFromJson=function(a){var b=new t;return b.initByJson(a)?b:null};t.prototype.name="";t.prototype.email="";t.prototype.privateType=null;t.prototype.validate=function(){return""!==this.name||""!==this.email};t.prototype.hash=function(a){return"#"+(a?"":this.name)+"#"+this.email+"#"};t.prototype.clearDuplicateName=function(){this.name===this.email&&(this.name="")};t.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};t.prototype.search=function(a){return-1<(this.name+" "+this.email).toLowerCase().indexOf(a.toLowerCase())};t.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)};t.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};t.prototype.toLine=function(a,b){var e="";""!==this.email&&(b=c.isUnd(b)?!1:!!b,a&&""!==this.name?e=b?'")+'" target="_blank" tabindex="-1">'+c.encodeHtml(this.name)+"":this.name:(e=this.email,""!==this.name?e=b?c.encodeHtml('"'+this.name+'" <')+'")+'" target="_blank" tabindex="-1">'+c.encodeHtml(e)+""+c.encodeHtml(">"):'"'+this.name+'" <'+e+">":b&&(e=''+c.encodeHtml(this.email)+"")));return e};t.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+""};t.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(new h.Date).getTime()-n);p&&l.oRequests[p]&&(l.oRequests[p].__aborted&&(e="abort"),l.oRequests[p]=
null);l.defaultResponse(a,p,e,d,f,b)});p&&(0").addClass("rl-settings-view-model").hide().attr("data-bind",'template: {name: "'+g.__rlSettingsData.Template+'"}, i18nInit: true'),k.appendTo(h),e.data=f.data(),e.viewModelDom=k,e.__rlSettingsData=g.__rlSettingsData,g.__dom=k,g.__builded=!0,g.__vm=e,d.applyBindings(e,k[0]),r.delegateRun(e,
"onBuild",[k])):c.log("Cannot find sub settings view model position: SettingsSubScreen"),e&&i.defer(function(){if(b.oCurrentSubScreen){r.delegateRun(b.oCurrentSubScreen,"onHide");b.oCurrentSubScreen.viewModelDom.hide()}b.oCurrentSubScreen=e;if(b.oCurrentSubScreen){b.oCurrentSubScreen.viewModelDom.show();r.delegateRun(b.oCurrentSubScreen,"onShow");i.each(b.menu(),function(a){a.selected(e&&e.__rlSettingsData&&a.route===e.__rlSettingsData.Route)})}c.windowResize()}))};J.prototype.onBuild=function(){i.each(Y,
function(a){a&&(a.__rlSettingsData&&!i.find(na,function(b){return b&&b===a}))&&this.menu.push({route:a.__rlSettingsData.Route,label:a.__rlSettingsData.Label,selected:d.observable(!1),disabled:!!i.find(oa,function(b){return b&&b===a})})},this)};J.prototype.routes=function(){var a=i.find(Y,function(a){return a&&a.__rlSettingsData&&a.__rlSettingsData.IsDefault}),b=a?a.__rlSettingsData.Route:"general",a={subname:/^(.*)$/,normalize_:function(a,d){d.subname=c.isUnd(d.subname)?b:c.pString(d.subname);return[d.subname]}};
return[["{subname}/",a],["{subname}",a],["",a]]};i.extend(ha.prototype,x.prototype);ha.prototype.onShow=function(){f.setTitle("")};i.extend(ia.prototype,J.prototype);ia.prototype.onShow=function(){f.setTitle("")};i.extend(v.prototype,ra.prototype);v.prototype.oSettings=null;v.prototype.oLink=null;v.prototype.download=function(a){D?this.iframe.attr("src",a):h.open(a)};v.prototype.link=function(){null===this.oLink&&(this.oLink=new m);return this.oLink};v.prototype.local=function(){null===this.oLocal&&
(this.oLocal=new O);return this.oLocal};v.prototype.settingsGet=function(a){null===this.oSettings&&(this.oSettings=c.isNormal(X)?X:{});return c.isUnd(this.oSettings[a])?null:this.oSettings[a]};v.prototype.settingsSet=function(a,b){null===this.oSettings&&(this.oSettings=c.isNormal(X)?X:{});this.oSettings[a]=b};v.prototype.setTitle=function(a){a=(0