%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/varak.net/mail2.varak.net_old/static/js/
Upload File :
Create Path :
Current File : //www/varak.net/mail2.varak.net_old/static/js/app-filestorage-pub.min.js

/*!
 * Copyright 2004-2014, AfterLogic Corp.
 * Licensed under AGPLv3 license or AfterLogic license
 * if commerical version of the product was purchased.
 * See the LICENSE file for a full license statement.
 */
!function(e,t,i){"use strict";function n(){this.ie11=!!navigator.userAgent.match(/Trident.*rv[ :]*11\./),this.ie=/msie/.test(navigator.userAgent.toLowerCase())&&!t.opera||this.ie11,this.ieVersion=this.getIeVersion(),this.ie8AndBelow=this.ie&&this.ieVersion<=8,this.ie9AndBelow=this.ie&&this.ieVersion<=9,this.ie10AndAbove=this.ie&&this.ieVersion>=10,this.opera=!!t.opera||/opr/.test(navigator.userAgent.toLowerCase()),this.firefox=/firefox/.test(navigator.userAgent.toLowerCase()),this.chrome=/chrome/.test(navigator.userAgent.toLowerCase())&&!/opr/.test(navigator.userAgent.toLowerCase()),this.chromeIos=/crios/.test(navigator.userAgent.toLowerCase()),this.safari=/safari/.test(navigator.userAgent.toLowerCase())&&!this.chromeIos}function o(){this.sUrl="?/Ajax/",this.requests=i.observableArray([]),this.openedRequestsCount=i.observable(0),this.requests.subscribe(function(){this.openedRequestsCount(this.requests().length)},this)}function s(t,n,o,s,r,a,l,c,h,u){this.fBeforeSelectCallback=null,this.fSelectCallback=n||function(){},this.fDeleteCallback=o||function(){},this.fDblClickCallback=!O&&s?s:function(){},this.fEnterCallback=r||function(){},this.bResetCheckedOnClick=I.isUnd(l)?!1:!!l,this.bCheckOnSelect=I.isUnd(c)?!1:!!c,this.bUnselectOnCtrl=I.isUnd(h)?!1:!!h,this.bDisableMultiplySelection=I.isUnd(u)?!1:!!u,this.useKeyboardKeys=i.observable(!1),this.list=i.observableArray([]),t&&t.subscribe&&t.subscribe(function(e){this.list(e)},this),this.multiplyLineFactor=a,this.oLast=null,this.oListScope=null,this.oScrollScope=null,this.iTimer=0,this.iFactor=1,this.KeyUp=P.Key.Up,this.KeyDown=P.Key.Down,this.KeyLeft=P.Key.Up,this.KeyRight=P.Key.Down,this.multiplyLineFactor&&(this.multiplyLineFactor.subscribe?this.multiplyLineFactor.subscribe(function(e){this.iFactor=e>0?e:1},this):this.iFactor=I.pInt(this.multiplyLineFactor),this.KeyUp=P.Key.Up,this.KeyDown=P.Key.Down,this.KeyLeft=P.Key.Left,this.KeyRight=P.Key.Right,e("html").hasClass("rtl")&&(this.KeyLeft=P.Key.Right,this.KeyRight=P.Key.Left)),this.sActionSelector="",this.sSelectabelSelector="",this.sCheckboxSelector="";var p=this;this.listChecked=i.computed({read:function(){var e=_.filter(this.list(),function(e){var t=e.checked(),i=e.selected();return t||p.bCheckOnSelect&&i});return e},write:function(e){e=!!e,_.each(this.list(),function(t){t.checked(e)}),this.list.valueHasMutated()},owner:this}),this.checkAll=i.computed({read:function(){return 0<this.listChecked().length},write:function(e){this.listChecked(!!e)},owner:this}),this.selectorHook=i.observable(null),this.selectorHook.subscribe(function(){var e=this.selectorHook();e&&e.selected(!1)},this,"beforeChange"),this.selectorHook.subscribe(function(e){e&&e.selected(!0)},this),this.itemSelected=i.computed({read:this.selectorHook,write:function(e){this.selectorHook(e),e&&(this.oLast=e)},owner:this}),this.list.subscribe(function(e){if(_.isArray(e)){var t=this.itemSelected();t&&(_.find(e,function(e){return t===e})||this.itemSelected(null))}else this.itemSelected(null)},this),this.listCheckedOrSelected=i.computed({read:function(){var e=this.itemSelected(),t=this.listChecked();return 0<t.length?t:e?[e]:[]},write:function(e){e?this.listChecked(!0):(this.itemSelected(null),this.listChecked(!1))},owner:this}),this.listCheckedAndSelected=i.computed({read:function(){var e=[],t=this.itemSelected(),i=this.listChecked();return i&&(e=i.slice(0)),t&&-1===_.indexOf(i,t)&&e.push(t),e},write:function(e){e?this.listChecked(!0):(this.itemSelected(null),this.listChecked(!1))},owner:this}),this.isIncompleteChecked=i.computed(function(){var e=this.list().length,t=this.listChecked().length;return e>0&&t>0&&e>t},this),this.onKeydownBinded=_.bind(this.onKeydown,this)}function r(){this.openPgp=null,this.openPgpCallbacks=[]}function a(){Data.init()}function l(e,t){this.pgp=e,this.pgpKeyring=new this.pgp.Keyring(new this.pgp.Keyring.localstore(t)),this.keys=i.observableArray([]),this.reloadKeysFromStorage()}function c(e){this.pgpKey=e;var t=this.pgpKey.getPrimaryUser();this.user=t&&t.user?t.user.userId.userid:this.pgpKey.users&&this.pgpKey.users[0]?this.pgpKey.users[0].userId.userid:"",this.emailParts=I.getEmailParts(this.user)}function h(){this.result=!0,this.errors=null,this.notices=null,this.exceptions=null}function u(){this.alertDesc=i.observable(""),this.closeCallback=null,this.title=i.observable(""),this.okButtonText=i.observable(I.i18n("MAIN/BUTTON_OK"))}function p(){this.fConfirmCallback=null,this.confirmDesc=i.observable(""),this.title=i.observable(""),this.okButtonText=i.observable(I.i18n("MAIN/BUTTON_OK")),this.cancelButtonText=i.observable(I.i18n("MAIN/BUTTON_CANCEL")),this.shown=!1}function d(){this.pgp=null,this.keyArmor=i.observable(""),this.keyArmorFocused=i.observable(!1),this.keys=i.observableArray([]),this.hasExistingKeys=i.observable(!1),this.headlineText=i.computed(function(){return I.i18n("OPENPGP/INFO_TEXT_INCLUDES_KEYS_PLURAL",{},null,this.keys().length)},this)}function f(){this.fCallback=null,this.folderName=i.observable(""),this.folderName.focus=i.observable(!1),this.folderName.error=i.observable(""),this.folderName.subscribe(function(){this.folderName.error("")},this)}function g(){this.fCallback=null,this.link=i.observable(""),this.linkPrev=i.observable(""),this.linkFocus=i.observable(!1),this.checkTimeout=null,this.urlChecked=i.observable(!1),this.saveCommand=I.createCommand(this,this.executeSave,function(){return this.urlChecked()}),this.fileItem=i.observable(new E)}function m(){this.fCallback=null,this.item=null,this.name=i.observable(""),this.name.focus=i.observable(!1),this.name.error=i.observable(""),this.name.subscribe(function(){this.name.error("")},this)}function b(){this.item=null,this.pub=i.observable(""),this.pubFocus=i.observable(!1)}function y(){this.IdUser=1,this.MailsPerPage=20,this.ContactsPerPage=20,this.iInterval=-1,this.AutoCheckMailInterval=0,this.DefaultTheme="Default",this.DefaultLanguage="English",this.DefaultLanguageShort="en",this.DefaultDateFormat="MM/DD/YYYY",this.defaultTimeFormat=i.observable(P.TimeFormat.F24),this.ThreadsEnabled=!0,this.useThreads=i.observable(!0),this.SaveRepliedToCurrFolder=!0,this.AllowChangeInputDirection=!1,this.DesktopNotifications=!1,this.AllowCompose=!0,this.AllowReply=!0,this.AllowForward=!0,this.SaveMail=P.SaveMail.Checked,this.AllowFetcher=!1,this.OutlookSyncEnable=!0,this.MobileSyncEnable=!0,this.ShowPersonalContacts=!0,this.ShowGlobalContacts=!1,this.IsFilesSupported=!1,this.IsHelpdeskSupported=!1,this.IsHelpdeskAgent=!1,this.HelpdeskIframeUrl="",this.ShowContacts=this.ShowPersonalContacts||this.ShowGlobalContacts,this.LastLogin=0,this.IsDemo=!1,this.AllowVoice=!1,this.SipRealm="",this.SipWebsocketProxyUrl="",this.SipOutboundProxyUrl="",this.SipCallerID="",this.SipImpi="",this.SipImpu="",this.SipPassword="",this.VoiceProvider="",this.AllowCalendar=!0,this.CalendarSharing=!1,this.CalendarAppointments=!1,this.CalendarShowWeekEnds=!1,this.CalendarShowWorkDay=!1,this.CalendarWorkDayStarts=0,this.CalendarWorkDayEnds=0,this.CalendarWeekStartsOn=0,this.CalendarDefaultTab=P.CalendarDefaultTab.Month,this.mobileSync=i.observable(null),this.MobileSyncDemoPass="demo",this.outlookSync=i.observable(null),this.OutlookSyncDemoPass="demo",this.AllowHelpdeskNotifications=!1,this.IsCollaborationSupported=!1,this.AllowFilesSharing=!1,this.DefaultFontName="Tahoma",this.fillDefaultFontName(),this.DefaultFontSize=3,this.fillDefaultFontSize(),this.enableOpenPgp=i.observable(!1),this.AllowAutosaveInDrafts=!0,this.AutosignOutgoingEmails=!1,this.filesEnable=i.observable(!0),this.SocialAccounts=i.observableArray([])}function v(){this.iTimeStampInUTC=0,this.oMoment=null}function E(){this.isIosDevice=M,this.isFolder=i.observable(!1),this.isLink=i.observable(!1),this.linkType=i.observable(P.FileStorageLinkType.Unknown),this.linkUrl=i.observable(""),this.isPopupItem=i.observable(!1),this.id=i.observable(""),this.fileName=i.observable(""),this.tempName=i.observable(""),this.displayName=i.observable(""),this.extension=i.observable(""),this.fileName.subscribe(function(){var e=this.fileName(),t=e.lastIndexOf(".");this.id(e),this.isFolder()?(this.displayName(e),this.extension("")):(this.displayName(e.substr(0,t)),this.extension(e.substr(t+1)))},this),this.size=i.observable(0),this.friendlySize=i.computed(function(){return I.friendlySize(this.size())},this),this.content=i.observable(""),this.accountId=i.observable(N.Accounts?N.Accounts.defaultId():null),this.hash=i.observable(""),this.thumb=i.observable(!1),this.iframedView=i.observable(!1),this.downloadLink=i.computed(function(){return I.getDownloadLinkByHash(this.accountId(),this.hash())},this),this.viewLink=i.computed(function(){var e=I.getViewLinkByHash(this.accountId(),this.hash());return this.iframedView()?I.getIframeWrappwer(this.accountId(),e):e},this),this.thumbnailSrc=i.observable(""),this.thumbnailLoaded=i.observable(!1),this.thumbnailSessionUid=i.observable(""),this.thumbnailLink=i.computed(function(){return this.thumb()?I.getViewThumbnailLinkByHash(this.accountId(),this.hash()):""},this),this.type=i.observable(""),this.uploadUid=i.observable(""),this.uploaded=i.observable(!1),this.uploadError=i.observable(!1),this.visibleImportLink=i.computed(function(){return N.User.enableOpenPgp()&&"asc"===this.extension().toLowerCase()&&""!==this.content()&&!this.isPopupItem()},this),this.isViewMimeType=i.computed(function(){return-1!==e.inArray(this.type(),U)||this.iframedView()},this),this.isMessageType=i.observable(!1),this.visibleViewLink=i.computed(function(){return this.isVisibleViewLink()&&!this.isPopupItem()},this),this.visibleDownloadLink=i.computed(function(){return!this.isPopupItem()},this),this.subFiles=i.observableArray([]),this.allowExpandSubFiles=i.observable(!1),this.subFilesLoaded=i.observable(!1),this.subFilesCollapsed=i.observable(!1),this.subFilesStartedLoading=i.observable(!1),this.visibleExpandLink=i.computed(function(){return this.allowExpandSubFiles()&&!this.subFilesCollapsed()&&!this.subFilesStartedLoading()},this),this.visibleExpandingText=i.computed(function(){return this.allowExpandSubFiles()&&!this.subFilesCollapsed()&&this.subFilesStartedLoading()},this),this.visibleSpinner=i.observable(!1),this.statusText=i.observable(""),this.progressPercent=i.observable(0),this.visibleProgress=i.observable(!1),this.uploadStarted=i.observable(!1),this.uploadStarted.subscribe(function(){this.uploadStarted()?(this.uploaded(!1),this.visibleProgress(!0),this.progressPercent(20)):(this.progressPercent(100),this.visibleProgress(!1),this.uploaded(!0))},this),this.allowDrag=i.observable(!1),this.allowSelect=i.observable(!1),this.allowCheck=i.observable(!1),this.allowDelete=i.observable(!1),this.allowUpload=i.observable(!1),this.allowSharing=i.observable(!1),this.allowHeader=i.observable(!1),this.allowDownload=i.observable(!0),this.downloadTitle=i.computed(function(){return this.allowDownload()?I.i18n("MESSAGE/ATTACHMENT_CLICK_TO_DOWNLOAD",{FILENAME:this.fileName(),SIZE:this.friendlySize()}):""},this)}function S(){this.id=i.observable(""),this.fileName=i.observable(""),this.displayName=i.observable(""),this.nameForEdit=i.observable(""),this.storageType=i.observable(P.FileStorageType.Personal),this.lastModified=i.observable(""),this.path=i.observable(""),this.fullPath=i.observable(""),this.publicHash=i.observable(""),this.selected=i.observable(!1),this.checked=i.observable(!1),this.isFolder=i.observable(!1),this.edited=i.observable(!1),this.isExternal=i.observable(!1),this.isLink=i.observable(!1),this.linkType=i.observable(0),this.linkUrl=i.observable(""),this.thumbnailExternalLink=i.observable(""),this.deleted=i.observable(!1),this.recivedAnim=i.observable(!1).extend({autoResetToFalse:500}),this.shared=i.observable(!1),this.owner=i.observable(""),this.ownerHeaderText=i.computed(function(){return I.i18n("FILESTORAGE/OWNER_HEADER_EMAIL",{OWNER:this.owner()})},this),this.lastModifiedHeaderText=i.computed(function(){return I.i18n("FILESTORAGE/OWNER_HEADER_LAST_MODIFIED_DATE_TEXT",{LASTMODIFIED:this.lastModified()})},this),E.call(this),this.fileName.subscribe(function(e){this.nameForEdit(e),this.displayName(e)},this),this.displayName.subscribe(function(e){this.isFolder()||this.displayName(I.getFileNameWithoutExtension(e))},this),this.type=this.storageType,this.uploaded=i.observable(!0),this.downloadLink=i.computed(function(){return I.getFilestorageDownloadLinkByHash(N.Accounts?N.Accounts.currentId():null,this.hash(),this.publicHash())},this),this.viewLink=i.computed(function(){if(this.isLink())return this.linkUrl();var e=I.getFilestorageViewLinkByHash(N.Accounts?N.Accounts.currentId():null,this.hash(),this.publicHash());return this.iframedView()?I.getIframeWrappwer(N.Accounts?N.Accounts.currentId():null,e):e},this),this.isViewable=i.computed(function(){var e=!1,t=["JPEG","JPG","PNG","GIF","HTM","HTML","TXT","CSS","ASC","JS","PDF"];return _.indexOf(t,this.extension().toUpperCase())>=0&&(e=!0),(this.iframedView()||e||this.isLink())&&!this.isPopupItem()},this),this.visibleViewLink=this.isViewable,this.thumbnailLink=i.computed(function(){return this.isExternal()||this.isLink()&&this.linkType()===P.FileStorageLinkType.GoogleDrive?this.thumbnailExternalLink():this.thumb()?I.getFilestorageViewThumbnailLinkByHash(this.accountId(),this.hash(),this.publicHash()):""},this),this.edited.subscribe(function(e){e===!1&&this.nameForEdit(this.fileName())},this)}function k(){this.allowWebMail=!(!N.App||!N.App.AllowWebMail),this.loaded=i.observable(!1),this.isPublic=x,this.publicHash=x?N.FileStoragePubHash:"",this.IsCollaborationSupported=N.User.IsCollaborationSupported,this.AllowFilesSharing=N.User.AllowFilesSharing,this.storages=i.observableArray(),this.folders=i.observableArray(),this.files=i.observableArray(),this.uploadingFiles=i.observableArray(),this.selected=i.observable(!1),this.rootPath=i.observable(I.i18n("FILESTORAGE/TAB_PERSONAL_FILES")),this.storageType=i.observable(P.FileStorageType.Personal),this.storageType.subscribe(function(){var e=null;this.isPublic?this.rootPath(N.FileStoragePubParams.Name):(e=this.getStorageByType(this.storageType()),e&&this.rootPath(e.displayName())),this.selector.listCheckedAndSelected(!1)},this),this.iPathIndex=i.observable(-1),this.pathItems=i.observableArray(),this.dropPath=i.observable(""),this.path=i.computed(function(){var e=_.map(this.pathItems(),function(e){return e.id()});return e.join("/")},this),this.path.subscribe(function(e){this.dropPath(e)},this),this.collection=i.computed(function(){var e=_.union(this.files(),this.getUploadingFiles());return e.sort(function(e,t){return e.fileName()===t.fileName()?0:e.fileName()<t.fileName()?-1:1}),_.union(this.folders(),e)},this),this.columnCount=i.observable(1),this.selector=new s(this.collection,null,_.bind(this.onItemDelete,this),_.bind(this.onItemDblClick,this),_.bind(this.onEnter,this),this.columnCount,!0,!0,!0),this.searchPattern=i.observable(""),this.isSearchFocused=i.observable(!1),this.renameCommand=I.createCommand(this,this.executeRename,function(){var e=this.selector.listCheckedAndSelected();return 1===e.length&&!e[0].isLink()}),this.deleteCommand=I.createCommand(this,this.executeDelete,function(){var e=this.selector.listCheckedAndSelected();return 0<e.length}),this.downloadCommand=I.createCommand(this,this.executeDownload,function(){var e=this.selector.listCheckedAndSelected();return 1===e.length&&!e[0].isFolder()}),this.shareCommand=I.createCommand(this,this.executeShare,function(){var e=this.selector.listCheckedAndSelected();return 1===e.length&&!e[0].isLink()}),this.sendCommand=I.createCommand(this,this.executeSend,function(){var e=this.selector.listCheckedAndSelected(),t=_.filter(e,function(e){return!e.isFolder()},this);return t.length>0}),this.uploaderButton=i.observable(null),this.uploaderArea=i.observable(null),this.bDragActive=i.observable(!1),this.bDragActiveComp=i.computed(function(){var e=this.bDragActive();return e&&""===this.searchPattern()},this),this.uploadError=i.observable(!1),this.quota=i.observable(0),this.used=i.observable(0),this.quotaDesc=i.observable(""),this.quotaProc=i.observable(-1),i.computed(function(){if(!N.App||N.App&&!N.App.ShowQuotaBar)return!0;var e=this.quota(),t=this.used(),i=e>0?Math.ceil(t/e*100):-1;return i=i>100?100:i,this.quotaProc(i),this.quotaDesc(i>-1?I.i18n("MAILBOX/QUOTA_TOOLTIP",{PROC:i,QUOTA:I.friendlySize(e)}):""),!0},this),this.dragover=i.observable(!1),this.loading=i.observable(!1),this.loadedFiles=i.observable(!1),this.fileListInfoText=i.computed(function(){var e="";return this.loading()?e=I.i18n("FILESTORAGE/INFO_LOADING"):this.loadedFiles()&&0===this.collection().length&&(e=I.i18n(this.isPublic?"FILESTORAGE/INFO_PUBLIC_FOLDER_NOT_EXIST":""!==this.searchPattern()||this.isPublic?"FILESTORAGE/INFO_NO_ITEMS_FOUND":""!==this.path()||this.isPopup?"FILESTORAGE/INFO_FOLDER_IS_EMPY":"FILESTORAGE/INFO_FILESTORAGE_IS_EMTY")),e},this),this.dragAndDropHelperBinded=_.bind(this.dragAndDropHelper,this),this.isPopup=!1,this.isCurrentStorageExternal=i.computed(function(){var e=this.getStorageByType(this.storageType());return e&&e.isExternal()},this),this.timerId=null}function A(){this.iAnimationDuration=500,this.iReportDuration=5e3,this.iErrorDuration=1e4,this.loadingMessage=i.observable(""),this.loadingHidden=i.observable(!0),this.loadingVisible=i.observable(!1),this.reportMessage=i.observable(""),this.reportHidden=i.observable(!0),this.reportVisible=i.observable(!1),this.iReportTimeout=-1,this.errorMessage=i.observable(""),this.errorHidden=i.observable(!0),this.errorVisible=i.observable(!1),this.iErrorTimeout=-1,this.isHtmlError=i.observable(!1),this.gray=i.observable(!1)}function T(){var n=e(t);this.resizeAll=_.debounce(function(){n.resize()},100),this.oScreens={},this.currentScreen=i.observable(""),this.popupVisibility=i.observable(!1),this.informationScreen=i.observable(null),this.popups=[]}function C(){this.browser=new n,this.favico=t.Favico?new t.Favico({animation:"none"}):null,this.Ajax=new o,this.Screens=new T,this.Api=new r,this.Storage=new a,this.helpdeskUnseenCount=i.observable(0),this.mailUnseenCount=i.observable(0)}function w(){C.call(this),this.init()}var P={},I={},F=t.pSevenI18N||{},R={},D={},N=t.pSevenAppData||{},x=!1,O=!1,L=e("html"),M=-1<navigator.userAgent.indexOf("iPhone")||-1<navigator.userAgent.indexOf("iPod")||-1<navigator.userAgent.indexOf("iPad"),K=-1<navigator.userAgent.toLowerCase().indexOf("android"),H=M||K,U=["image/jpeg","image/png","image/gif","text/html","text/plain","text/css","text/rfc822-headers","message/delivery-status","application/x-httpd-php","application/javascript","application/pdf"];if(t.Modernizr&&navigator&&t.Modernizr.addTest("pdf",function(){for(var e=navigator.mimeTypes,t=0,i=e.length;i>t;t++)if("application/pdf"===e[t].type)return!0;return!1}),Date.now||(Date.now=function(){return(new Date).getTime()}),x=!0,n.prototype.getIeVersion=function(){var e=navigator.userAgent.toLowerCase(),t=I.pInt(e.slice(e.indexOf("msie")+4,e.indexOf(";",e.indexOf("msie")+4)));return this.ie11&&(t=11),t},o.prototype.hasOpenedRequests=function(e){return e=I.isUnd(e)?"":e,this.requests(_.filter(this.requests(),function(t){var i=t&&4===t.Xhr.readyState,n=!t||0===t.Xhr.readyState&&"abort"===t.Xhr.statusText,o=""===e||t&&t.Parameters.Action===e;return t&&!i&&!n&&o})),this.requests().length>0},o.prototype.isSearchMessages=function(){var e=!1;return _.each(this.requests(),function(t){t&&t.Parameters&&"MessageList"===t.Parameters.Action&&""!==t.Parameters.Search&&(e=!0)},this),e},o.prototype.isAllowedActionWithoutAuth=function(e){var t=["Login","LoginLanguageUpdate","Logout","AccountCreate","SetMobile","RegisterAccount","GetForgotAccountQuestion","ValidateForgotAccountQuestion","ChangeForgotAccountPassword"];return-1!==_.indexOf(t,e)},o.prototype.isAllowedExtAction=function(e){return"SocialRegister"===e||"HelpdeskRegister"===e||"HelpdeskForgot"===e||"HelpdeskLogin"===e||"Logout"===e},o.prototype.doSend=function(t,i,n,o){var s=_.bind(o||null,this,t,i,n),r=_.bind(this.fail,this,t,i,n),a=_.bind(this.always,this,t),l=null;D.runPluginHook&&D.runPluginHook("ajax-default-request",[t.Action,t]),N.Token&&(t.Token=N.Token),this.abortRequests(t),I.log("Ajax request send",t.Action,t),l=e.ajax({url:this.sUrl,type:"POST",async:!0,dataType:"json",data:t,success:s,error:r,complete:a}),this.requests().push({Parameters:t,Xhr:l})},o.prototype.send=function(e,t,i){var n=void 0===e.AccountID,o=n||N.Accounts.hasAccountWithId(e.AccountID);e&&(N.Auth&&o||this.isAllowedActionWithoutAuth(e.Action))&&(n&&"Login"!==e.Action&&(e.AccountID=N.Accounts.currentId()),this.doSend(e,t,i,this.done))},o.prototype.sendExt=function(e,t,i){var n=["SocialRegister","HelpdeskRegister","HelpdeskForgot","HelpdeskLogin","HelpdeskForgotChangePassword","Logout","CalendarList","EventList","FilesPub"],o=-1!==_.indexOf(n,e.Action);e&&(N.Auth||o)&&(N.TenantHash&&(e.TenantHash=N.TenantHash),this.doSend(e,t,i,this.doneExt))},o.prototype.abortRequests=function(e){switch(e.Action){case"MessageMove":case"MessageDelete":this.abortRequestByActionName("MessageList",{Folder:e.Folder}),this.abortRequestByActionName("Message");break;case"MessageList":case"MessageSetSeen":this.abortRequestByActionName("MessageList",{Folder:e.Folder});break;case"MessageSetAllSeen":this.abortRequestByActionName("MessageList",{Folder:e.Folder}),this.abortRequestByActionName("MessageListByUids",{Folder:e.Folder});break;case"FolderClear":this.abortRequestByActionName("MessageList",{Folder:e.Folder}),this.abortRequestByActionName("FolderCounts");break;case"ContactList":case"GlobalContactList":this.abortRequestByActionName("ContactList"),this.abortRequestByActionName("GlobalContactList");break;case"Contact":case"GlobalContact":this.abortRequestByActionName("Contact"),this.abortRequestByActionName("GlobalContact");break;case"EventUpdate":this.abortRequestByActionName("EventUpdate",{calendarId:e.calendarId,uid:e.uid})}},o.prototype.abortRequestByActionName=function(e,t){var i;_.each(this.requests(),function(n,o){if(i=!1,n&&n.Parameters.Action===e)switch(e){case"MessageList":t.Folder===n.Parameters.Folder&&(i=!0);break;case"EventUpdate":t.calendarId===n.Parameters.calendarId&&t.uid===n.Parameters.uid&&(i=!0);break;default:i=!0}i&&(n.Xhr.abort(),this.requests()[o]=void 0)},this),this.requests(_.compact(this.requests()))},o.prototype.abortAllRequests=function(){_.each(this.requests(),function(e){e&&e.Xhr.abort()},this),this.requests([])},o.prototype.done=function(e,t,i,n,o){var s=this.isAllowedActionWithoutAuth(e.Action),r=N.Accounts.hasAccountWithId(e.AccountID),a=e.AccountID===N.Accounts.defaultId();if(I.log("Ajax request done",e.Action,o,I.getAjaxDataForLog(e.Action,n),e),s||r){if(n&&!n.Result)switch(n.ErrorCode){case P.Errors.InvalidToken:s||R.tokenProblem();break;case P.Errors.AuthError:a&&!s&&(this.abortAllRequests(),R.authProblem())}this.executeResponseHandler(t,i,n,e)}},o.prototype.doneExt=function(e,t,i,n){this.executeResponseHandler(t,i,n,e)},o.prototype.fail=function(e,t,i,n,o,s){var r={Result:!1,ErrorCode:0};switch(I.log("Ajax request fail",e.Action,o,e),o){case"abort":r={Result:!1,ErrorCode:P.Errors.NotDisplayedError};break;default:case"error":case"parseerror":r=""===s?{Result:!1,ErrorCode:P.Errors.NotDisplayedError}:{Result:!1,ErrorCode:P.Errors.DataTransferFailed}}this.executeResponseHandler(t,i,r,e)},o.prototype.executeResponseHandler=function(e,t,i,n){i||(i={Result:!1,ErrorCode:0}),D.runPluginHook&&D.runPluginHook("ajax-default-response",[n.Action,i]),"function"==typeof e&&e.apply(t,[i,n])},o.prototype.always=function(e,t,i){_.each(this.requests(),function(t,i){t&&_.isEqual(t.Parameters,e)&&(this.requests()[i]=void 0)},this),this.requests(_.compact(this.requests())),I.checkConnection(e.Action,i),R.Prefetcher&&"abort"!==i&&!this.hasOpenedRequests()&&R.Prefetcher.start()},P.Screens={Login:"login",Information:"information",Header:"header",Mailbox:"mailbox",SingleMessageView:"single-message-view",Compose:"compose",SingleCompose:"single-compose",Settings:"settings",Contacts:"contacts",Calendar:"calendar",FileStorage:"files",Helpdesk:"helpdesk",SingleHelpdesk:"single-helpdesk"},P.CalendarDefaultTab={Day:1,Week:2,Month:3},P.TimeFormat={F24:"0",F12:"1"},P.Errors={InvalidToken:101,AuthError:102,DataBaseError:104,LicenseProblem:105,DemoLimitations:106,Captcha:107,AccessDenied:108,CanNotGetMessage:202,ImapQuota:205,NotSavedInSentItems:304,NoRequestedMailbox:305,CanNotChangePassword:502,AccountOldPasswordNotCorrect:503,FetcherIncServerNotAvailable:702,FetcherLoginNotCorrect:703,HelpdeskThrowInWebmail:805,HelpdeskUserNotExists:807,HelpdeskUserNotActivated:808,MailServerError:901,DataTransferFailed:1100,NotDisplayedError:1155},P.FolderTypes={Inbox:1,Sent:2,Drafts:3,Spam:4,Trash:5,Virus:6,Starred:7,System:9,User:10},P.FolderFilter={Flagged:"flagged",Unseen:"unseen"},P.LoginFormType={Email:0,Login:3,Both:4},P.LoginSignMeType={DefaultOff:0,DefaultOn:1,Unuse:2},P.ReplyType={Reply:"reply",ReplyAll:"reply-all",Resend:"resend",Forward:"forward"},P.Importance={Low:5,Normal:3,High:1},P.Sensivity={Nothing:0,Confidential:1,Private:2,Personal:3},P.ContactEmailType={Personal:"Personal",Business:"Business",Other:"Other"},P.ContactPhoneType={Mobile:"Mobile",Personal:"Personal",Business:"Business"},P.ContactAddressType={Personal:"Personal",Business:"Business"},P.ContactSortType={Email:"Email",Name:"Name",Frequency:"Frequency"},P.SaveMail={Hidden:0,Checked:1,Unchecked:2},P.SettingsTab={Common:"common",EmailAccounts:"accounts",Calendar:"calendar",MobileSync:"mobile_sync",OutLookSync:"outlook_sync",Helpdesk:"helpdesk",Pgp:"pgp",Services:"services"},P.AccountSettingsTab={Properties:"properties",Signature:"signature",Filters:"filters",Autoresponder:"autoresponder",Forward:"forward",Folders:"folders",FetcherInc:"fetcher-inc",FetcherOut:"fetcher-out",FetcherSig:"fetcher-sig",IdentityProperties:"identity-properties",IdentitySignature:"identity-signature"},P.ContactsGroupListType={Personal:0,SubGroup:1,Global:2,SharedToAll:3,All:4},P.IcalType={Request:"REQUEST",Reply:"REPLY",Cancel:"CANCEL",Save:"SAVE"},P.IcalConfig={Accepted:"ACCEPTED",Declined:"DECLINED",Tentative:"TENTATIVE",NeedsAction:"NEEDS-ACTION"},P.IcalConfigInt={Accepted:1,Declined:2,Tentative:3,NeedsAction:0},P.Key={Tab:9,Enter:13,Shift:16,Ctrl:17,Esc:27,Space:32,PageUp:33,PageDown:34,End:35,Home:36,Up:38,Down:40,Left:37,Right:39,Del:46,Six:54,a:65,b:66,c:67,f:70,i:73,k:75,n:78,p:80,q:81,r:82,s:83,u:85,v:86,y:89,z:90,F5:116,Comma:188,Dot:190,Dash:192,Apostrophe:222},P.MouseKey={Left:0,Middle:1,Right:2},P.FileStorageType={Personal:0,Corporate:1,Shared:2,GoogleDrive:3,Dropbox:4},P.FileStorageLinkType={Unknown:0,GoogleDrive:1,Dropbox:2},P.HelpdeskThreadStates={None:0,Pending:1,Waiting:2,Answered:3,Resolved:4,Deferred:5},P.HelpdeskPostType={Normal:0,Internal:1,System:2},P.HelpdeskFilters={All:0,Pending:1,Resolved:2,InWork:3,Open:4,Archived:9},P.CalendarAccess={Full:0,Write:1,Read:2},P.CalendarEditRecurrenceEvent={None:0,OnlyThisInstance:1,AllEvents:2},P.CalendarRepeatPeriod={None:0,Daily:1,Weekly:2,Monthly:3,Yearly:4},P.PhoneAction={Offline:"offline",OfflineError:"offline_error",OfflineInit:"offline_init",OfflineActive:"offline_active",Online:"online",OnlineActive:"online_active",Incoming:"incoming",IncomingConnect:"incoming_connect",Outgoing:"outgoing",OutgoingConnect:"outgoing_connect",Settings:"settings"},P.HtmlEditorImageSizes={Small:"small",Medium:"medium",Large:"large",Original:"original"},P.MobilePanel={Groups:1,Items:2,View:3},P.PgpAction={Import:"import",Generate:"generate",Encrypt:"encrypt",Sign:"sign",EncryptSign:"encrypt-sign",Verify:"ferify",DecryptVerify:"decrypt-ferify"},P.SocialType={Unknown:0,Google:1,Dropbox:2,Facebook:3,Twitter:4,Vkontakte:5},P.notificationPermission={Granted:"granted",Denied:"denied",Default:"default"},i.bindingHandlers.command={init:function(t,n,o,s){var r=e(t),a=n();if(!a||!a.enabled||!a.canExecute)throw new Error("You are not using command function");r.addClass("command"),i.bindingHandlers[r.is("form")?"submit":"click"].init.apply(s,arguments)},update:function(t,i){var n=!0,o=e(t),s=i();n=s.enabled(),o.toggleClass("command-not-enabled",!n),n&&(n=s.canExecute(),o.toggleClass("unavailable",!n)),o.toggleClass("command-disabled disable disabled",!n),o.toggleClass("command-disabled",!n)}},i.bindingHandlers.simpleTemplate={init:function(t,n){var o=i.utils.unwrapObservable(n()),s=e("#"+o);s&&s[0]&&e(t).html(s.html().replace(/&lt;script(.*?)&gt;/i,"<script$1>").replace(/&lt;\/script(.*?)&gt;/i,"</script>"))}},i.bindingHandlers.findFocused={init:function(t){var i=e(t),n=null;n=i.find(".catch-focus"),n&&1===n.length&&n[0]&&n.on("blur",function(){i.removeClass("focused")}).on("focus",function(){i.addClass("focused")})}},i.bindingHandlers.findFilled={init:function(t){var i=e(t),n=null,o=null;n=i.find(".catch-filled"),n&&1===n.length&&n[0]&&(o=function(){i.toggleClass("filled",""!==n.val())},o(),_.delay(o,200),n.on("change",o))}},i.bindingHandlers.alert={init:function(e,n){t.alert(i.utils.unwrapObservable(n()))},update:function(e,n){t.alert(i.utils.unwrapObservable(n()))}},i.bindingHandlers.onEnter={init:function(n,o,s,r){i.bindingHandlers.event.init(n,function(){return{keyup:function(i,s){s&&13===t.parseInt(s.keyCode,10)&&(e(n).trigger("change"),o().call(this,i))}}},s,r)}},i.bindingHandlers.onCtrlEnter={init:O?null:function(n,o,s,r){i.bindingHandlers.event.init(n,function(){return{keydown:function(i,s){return s&&13===t.parseInt(s.keyCode,10)&&s.ctrlKey?(e(n).trigger("change"),o().call(this,i),!1):!0}}},s,r)}},i.bindingHandlers.onEsc={init:O?null:function(n,o,s,r){i.bindingHandlers.event.init(n,function(){return{keyup:function(i,s){s&&27===t.parseInt(s.keyCode,10)&&(e(n).trigger("change"),o().call(this,i))}}},s,r)}},i.bindingHandlers.onFocusSelect={init:function(e,t,n,o){i.bindingHandlers.event.init(e,function(){return{focus:function(){e.select()}}},n,o)}},i.bindingHandlers.onEnterChange={init:function(n,o,s,r){i.bindingHandlers.event.init(n,function(){return{keyup:function(i,o){o&&13===t.parseInt(o.keyCode,10)&&e(n).trigger("change")}}},s,r)}},i.bindingHandlers.fadeIn={update:function(t,n){i.utils.unwrapObservable(n())&&e(t).hide().fadeIn("fast")}},i.bindingHandlers.fadeOut={update:function(t,n){i.utils.unwrapObservable(n())&&e(t).fadeOut()}},i.bindingHandlers.csstext={init:function(t,n){t&&t.styleSheet&&!I.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=i.utils.unwrapObservable(n()):e(t).text(i.utils.unwrapObservable(n()))},update:function(t,n){t&&t.styleSheet&&!I.isUnd(t.styleSheet.cssText)?t.styleSheet.cssText=i.utils.unwrapObservable(n()):e(t).text(i.utils.unwrapObservable(n()))}},i.bindingHandlers.i18n={init:function(t,i){var n=e(t).data("i18n"),o=n?I.i18n(n):n;if(""!==o)switch(i()){case"value":e(t).val(o);break;case"text":e(t).text(o);break;case"html":e(t).html(o);break;case"title":e(t).attr("title",o);break;case"placeholder":e(t).attr({placeholder:o})}}},i.bindingHandlers.link={init:function(t,n){e(t).attr("href",i.utils.unwrapObservable(n()))}},i.bindingHandlers.title={init:function(t,n){e(t).attr("title",i.utils.unwrapObservable(n()))},update:function(t,n){e(t).attr("title",i.utils.unwrapObservable(n()))}},i.bindingHandlers.initDom={init:function(t,i){if(i())if(_.isArray(i()))for(var n=i(),o=n.length-1;o>=0;o--)n[o](e(t));else i()(e(t))}},i.bindingHandlers.customScrollbar={init:O?null:function(t,i){if(!H){var n=e(t),o=i();o=o,n.addClass("scroll-wrap").customscroll(o),I.isUnd(o.reset)||(t._customscroll_reset=_.throttle(function(){n.data("customscroll").reset()},100)),!I.isUnd(o.scrollToTopTrigger)&&I.isFunc(o.scrollToTopTrigger.subscribe)&&o.scrollToTopTrigger.subscribe(function(){n.data("customscroll")&&n.data("customscroll").scrollToTop()}),!I.isUnd(o.scrollToBottomTrigger)&&I.isFunc(o.scrollToBottomTrigger.subscribe)&&o.scrollToBottomTrigger.subscribe(function(){n.data("customscroll")&&n.data("customscroll").scrollToBottom()}),!I.isUnd(o.scrollTo)&&I.isFunc(o.scrollTo.subscribe)&&o.scrollTo.subscribe(function(){n.data("customscroll")&&n.data("customscroll").scrollTo(o.scrollTo())})}},update:O?null:function(t,i){H||(t._customscroll_reset&&t._customscroll_reset(),I.isUnd(i().top)||e(t).data("customscroll").vertical.set(i().top))
}},i.bindingHandlers.customOptions={init:function(){return{controlsDescendantBindings:!0}},update:function(e,t,n,o,s){for(var r=0,a=0,l=i.utils.arrayMap(i.utils.arrayFilter(e.childNodes,function(e){return e.tagName&&"OPTION"===e.tagName&&e.selected}),function(e){return i.selectExtensions.readValue(e)||e.innerText||e.textContent}),c=e.scrollTop,h=i.utils.unwrapObservable(t());e.length>0;)i.cleanNode(e.options[0]),e.remove(0);if(h){"number"!=typeof h.length&&(h=[h]);var u=n().optionsBind;for(r=0,a=h.length;a>r;r++){var p=document.createElement("OPTION"),d=i.utils.unwrapObservable(h[r]);i.selectExtensions.writeValue(p,d),p.appendChild(document.createTextNode(d)),e.appendChild(p),u&&(p.setAttribute("data-bind",u),i.applyBindings(s.createChildContext(d),p))}var f=e.getElementsByTagName("OPTION"),g=0,m=navigator.userAgent.indexOf("MSIE 6")>=0;for(r=0,a=f.length;a>r;r++)i.utils.arrayIndexOf(l,i.selectExtensions.readValue(f[r]))>=0&&(m?f[r].setAttribute("selected",!0):f[r].selected=!0,g++);e.scrollTop=c,g<l.length&&i.utils.triggerEvent(e,"change")}}},i.bindingHandlers.splitter={init:O?null:function(t,i){var n=e(t),o=i();setTimeout(function(){n.splitter(_.defaults(o,{}))},1)}},i.bindingHandlers.dropdown={init:function(i,n,o,s){var r,a,l,c=e(i),h=_.defaults(n(),{disabled:"disabled",expand:"expand",control:!0,container:".dropdown_content",scrollToTopContainer:".scroll-inner",passClick:!0,trueValue:!0}),u=h.control?c.find(".control"):c,p=c.find(".dropdown_helper"),d=c.find(".dropdown_arrow"),f=e(document),g=!1,m=function(){I.isUnd(h.callback)||h.callback.call(s,c.hasClass(h.expand)?h.trueValue:!1,c)},b=function(e){e.stopPropagation()},y=function(){h.scrollToTopContainer&&c.find(h.scrollToTopContainer).scrollTop(0)},v=function(e){I.isUnd(e)&&(e=!c.hasClass(h.expand)),!e&&c.hasClass(h.expand)&&y(),c.toggleClass(h.expand,e)},E=function(i){r=p.offset(),I.isUnd(r)||(a=r.left+10,l=e(t).width()-(a+p.outerWidth()),l>0&&(l=0),p.css("left",i||l+"px"),d.css("left",i||Math.abs(l?l+parseInt(d.css("margin-left")):0)+"px"))};h.passClick||(c.find(h.container).click(b),u.click(b)),v(!1),h.close&&h.close.subscribe&&h.close.subscribe(function(e){e||(f.unbind("click.dropdown"),v(!1)),m()}),c.on("mousedown",function(t){g=e(t.target).hasClass("customscroll-scrollbar")||e(t.target.parentElement).hasClass("customscroll-scrollbar")}),u.click(function(){c.hasClass(h.disabled)||g||(v(),_.defer(function(){m()}),c.hasClass(h.expand)&&(h.close&&h.close.subscribe&&h.close(!0),_.defer(function(){f.on("click.dropdown",function(e){!h.passClick&&e.button===P.MouseKey.Right||g||(f.unbind("click.dropdown"),h.close&&h.close.subscribe&&h.close(!1),v(!1),m(),E(0)),g=!1})}),E()))})}},i.bindingHandlers.customSelect={init:function(t,i,n,o){var s=e(t),r=_.defaults(i(),{disabled:"disabled",selected:"selected",expand:"expand",control:!0,input:!1,expandState:function(){}}),a=[],l=r.control?s.find(".control"):s,c=s.find(".dropdown_content"),h=s.find(".link"),u=function(t){_.each(a,function(e){e.removeClass(r.selected)});var i=_.find(r.options,function(e){return e[r.optionsValue]===t});return I.isUnd(i)?i=r.options[0]:(a[_.indexOf(r.options,i)].addClass(r.selected),h.text(e.trim(i[r.optionsText]))),i[r.optionsValue]},p=function(t){c.empty(),a=[],_.each(t?t:r.options,function(t){var i=e('<span class="item"></span>').text(t[r.optionsText]).data("value",t[r.optionsValue]),n=t.isDisabled;n?i.data("isDisabled",n).addClass("disabled"):i.data("isDisabled",n).removeClass("disabled"),a.push(i),c.append(i)},this)};p(),c.on("click",".item",function(){var t=e(this);t.data("isDisabled")||r.value(t.data("value"))}),!r.input&&r.value&&r.value.subscribe&&(r.value.subscribe(function(){var e=u(r.value());r.value()!==e&&r.value(e)},o),r.value.valueHasMutated()),r.input&&r.value&&r.value.subscribe&&(r.value.subscribe(function(){u(r.value())},o),r.value.valueHasMutated()),r.input&&r.value&&r.value.subscribe&&(r.value.subscribe(function(){u(r.value())},o),r.value.valueHasMutated()),r.alarmOptions&&r.alarmOptions.subscribe(function(){p()},o),r.timeOptions&&r.timeOptions.subscribe(function(e){p(e)},o),s.removeClass(r.expand),l.click(function(){if(!s.hasClass(r.disabled)&&(s.toggleClass(r.expand),r.expandState(s.hasClass(r.expand)),s.hasClass(r.expand))){var t=s.find(".dropdown_content"),i=t.find(".selected");i.position()&&(t.scrollTop(0),t.scrollTop(i.position().top-100)),_.defer(function(){e(document).one("click",function(){s.removeClass(r.expand),r.expandState(!1)})})}})}},i.bindingHandlers.moveToFolderFilter={init:function(t,i){var n=e(t),o=i(),s=e(t).find(o.container),r=_.isArray(o.options)?o.options:o.options(),a=o.value?o.value():"",l=_.find(r,function(e){return e[o.optionsValue]===a});l||(a="",o.value("")),n.removeClass("expand"),s.empty(),_.each(r,function(t){var i=e('<span class="item"></span>').text(t[o.optionsText]).data("value",t[o.optionsValue]);a===t[o.optionsValue]&&i.addClass("selected"),t.jq=i,s.append(i)}),s.on("click",".item",function(){var t=e(this).data("value");o.value(t)}),n.click(function(){n.toggleClass("expand"),n.hasClass("expand")&&_.defer(function(){e(document).one("click",function(){n.removeClass("expand")})})})},update:function(t,i){var n=e(t),o=i(),s=_.isArray(o.options)?o.options:o.options(),r=o.value?o.value():"",a=_.find(s,function(e){return e[o.optionsValue]===r}),l=n.find(".link");_.each(s,function(e){e.jq&&e.jq.toggleClass("selected",r===e[o.optionsValue])}),a&&l.text(e.trim(a[o.optionsText]))}},i.bindingHandlers.contactcard={init:O?null:function(t,i){var n=e(t),o=!1,s=_.defaults(i(),{disabled:"disabled",expand:"expand",control:!0}),r=s.control?n.find(".control"):n;void 0!==s.trigger&&void 0!==s.trigger.subscribe&&(n.removeClass(s.expand),r.bind({mouseover:function(){!n.hasClass(s.disabled)&&s.trigger()&&(o=!0,_.delay(function(){o&&(void 0!==s.controlWidth&&void 0!==s.controlWidth.subscribe&&s.controlWidth(r.width()),n.addClass(s.expand))},200))},mouseout:function(){s.trigger()&&(o=!1,_.delay(function(){o||n.removeClass(s.expand)},200))}}))}},i.bindingHandlers.checkmail={update:function(t,i){var n=t.oOptions||null,o=t.jqElement||null,s=t.oIconIE||null,r=i(),a=r.state;void 0!==r.state&&(o||(t.jqElement=o=e(t)),n||(t.oOptions=n=_.defaults(r,{activeClass:"process",duration:800})),I.deferredUpdate(o,a,n.duration,function(e,i){if(R.browser.ie9AndBelow)if(s||(t.oIconIE=s=o.find(".icon")),!s.__intervalIE&&i){var r=0,a="";s.__intervalIE=setInterval(function(){a="0px -"+20*r+"px",r=7>r?r+1:0,s.css({"background-position":a})},1e3/12)}else s.css({"background-position":"0px 0px"}),clearInterval(s.__intervalIE),s.__intervalIE=null;else e.toggleClass(n.activeClass,i)}))}},i.bindingHandlers.heightAdjust={update:function(t,i){var n=t.jqElement||null,o=0,s=i().location,r=i().delay||400;n||(t.jqElement=n=e(t)),_.delay(function(){_.each(i().elements,function(e){var t=e();t&&(o+=t.is(":visible")?t.outerHeight():0)}),"top"===s||void 0===s?n.css({"padding-top":o,"margin-top":-o}):"bottom"===s&&n.css({"padding-bottom":o,"margin-bottom":-o})},r)}},i.bindingHandlers.triggerInview={update:function(t,i){i().trigger().length<=0||_.defer(function(){var n=e(t),o=n.height(),s=i(),r=null,a=null;s=s,r=n.find(s.selector),r.each(function(){this.$el=e(this),this.inviewHeight=this.$el.height(),this.inview=!1}),a=_.debounce(function(){r.each(function(){var e=this.inview||!1,t=this.$el.position().top+parseInt(this.$el.css("margin-top"),10);t>0&&o>t?e||(this.inview=!0,this.$el.trigger("inview")):this.inview=!1})},2e3),n.scroll(a),a()})}},i.bindingHandlers.watchWidth={init:function(t,i){var n=!1;n||i().subscribe(function(){i()(e(t).outerWidth()),n=!0},this)}},i.bindingHandlers.columnCalc={init:function(i,n){var o=e(i),s=n().prop,r=null,a=0;r=o.find(n().itemSelector),void 0!==r[0]&&(a=r.outerWidth(!0),a=1>=a?1:a,s&&e(t).bind("resize",function(){var e=o.width();s(e>0?Math.floor(e/a):1)}))}},i.bindingHandlers.quickReplyAnim={update:O?null:function(t,i){var n=t.jqTextarea||null,o=t.jqStatus||null,s=t.jqButtons||null,r=t.jqElement||null,a=t.oPrevActions||null,l=i(),c=null;c=_.defaults(l,{saveAction:!1,sendAction:!1,activeAction:!1}),r||(t.jqElement=r=e(t),t.jqTextarea=n=r.find("textarea"),t.jqStatus=o=r.find(".status"),t.jqButtons=s=r.find(".buttons"),t.oPrevActions=a={saveAction:null,sendAction:null,activeAction:null}),r.is(":visible")&&(R.browser.ie9AndBelow?(!n||r.defualtHeight||n.defualtHeight||(r.defualtHeight=r.outerHeight(),n.defualtHeight=n.outerHeight(),o.defualtHeight=s.outerHeight(),s.defualtHeight=s.outerHeight()),_.defer(function(){var e=a.activeAction!==c.activeAction,t=a.sendAction!==c.sendAction,i=a.saveAction!==c.saveAction;e&&(c.activeAction?(n.animate({height:n.defualtHeight+50},300),r.animate({"max-height":r.defualtHeight+s.defualtHeight+50},300)):(n.animate({height:n.defualtHeight},300),r.animate({"max-height":r.defualtHeight},300))),(t||i)&&(c.sendAction?(r.animate({"max-height":"30px"},300),o.animate({"max-height":"30px",opacity:1},300)):c.saveAction?r.animate({"max-height":0},300):(r.animate({"max-height":r.defualtHeight+s.defualtHeight+50},300),o.animate({"max-height":0,opacity:0},300)))})):(r.toggleClass("saving",c.saveAction),r.toggleClass("sending",c.sendAction),r.toggleClass("active",c.activeAction))),_.defer(function(){a=c})}},i.extenders.reversible=function(e){var t=e();return e.commit=function(){t=e()},e.revert=function(){e(t)},e.commitedValue=function(){return t},e.changed=function(){return t!==e()},e},i.extenders.autoResetToFalse=function(e,i){return e.iTimeout=0,e.subscribe(function(n){n&&(t.clearTimeout(e.iTimeout),e.iTimeout=t.setTimeout(function(){e.iTimeout=0,e(!1)},I.pInt(i)))}),e},I.createCommand=function(e,t,n){var o=t?function(){return o.canExecute&&o.canExecute()?t.apply(e,Array.prototype.slice.call(arguments)):!1}:function(){};return o.enabled=i.observable(!0),n=I.isUnd(n)?!0:n,o.canExecute=i.computed(I.isFunc(n)?function(){return o.enabled()&&n.call(e)}:function(){return o.enabled()&&!!n}),o},i.bindingHandlers.autocomplete={init:function(t,i){function n(e){return e.split(/,\s*/)}function o(e){return n(e).pop()}var s=i(),r=e(t);s&&r&&r[0]&&r.autocomplete({minLength:1,autoFocus:!0,source:function(e,t){s(o(e.term),t)},search:function(){var e=o(this.value);return e.length<1?!1:!0},focus:function(){return!1},select:function(e,t){var i=n(this.value),o=null;return i.pop(),i.push(t.item.value),i.push(""),this.value=i.join(", ").slice(0,-2),r.trigger("change"),o=function(e){var t=e.value.length;e.blur(),e.focus(),e.setSelectionRange&&e.setSelectionRange(t,t)},o(r[0]),!1}})}},i.bindingHandlers.autocompleteSimple={init:function(t,i){var n=e(t),o=i(),s=o.callback,r=o.dataAccessor;s&&n&&n[0]&&n.autocomplete({minLength:1,autoFocus:!0,position:{collision:"flip"},source:function(e,t){s(e.term,t)},focus:function(){return!1},select:function(e,t){return _.delay(function(){n.trigger("change")},5),r&&r(t.item),!0}})}},i.bindingHandlers.draggablePlace={init:O?null:function(t,n,o,s){if(null===n())return null;var r=o?o():null;e(t).draggable({distance:20,handle:".dragHandle",cursorAt:{top:0,left:0},helper:function(e){return n().call(s,e&&e.target?i.dataFor(e.target):null)},start:r&&r.draggableDragStartCallback?r.draggableDragStartCallback:I.emptyFunction,stop:r&&r.draggableDragStopCallback?r.draggableDragStopCallback:I.emptyFunction}).on("mousedown",function(){I.removeActiveFocus()})}},i.bindingHandlers.droppable={init:O?null:function(t,i){var n=i(),o=n.valueFunc,s=n.switchObserv;!1!==o&&e(t).droppable({hoverClass:"droppableHover",drop:function(e,t){o(e,t)}}),s&&o!==!1&&(s.subscribe(function(i){e(t).data().droppable&&e(t).droppable(i?"disable":"enable")},this),s.valueHasMutated())}},i.bindingHandlers.draggable={init:O?null:function(t,n){e(t).attr("draggable",i.utils.unwrapObservable(n()))}},i.bindingHandlers.autosize={init:function(t,i){var n=e(t),o=i(),s=n.height(),r=n.outerHeight(),a=n.innerHeight(),l=r-a,c=a-s,h=o.minHeight?o.minHeight:0,u=o.maxHeight?o.maxHeight:0,p=o.scrollableHeight?o.scrollableHeight:1e3,d=o.autosizeTrigger?o.autosizeTrigger:null,f=function(e){var t=0;R.browser.firefox&&(t=2*parseInt(n.css("padding-top"),10)),u?setTimeout(function(){n.prop("scrollHeight")<u?(n.height(h-c-l),n.height(n.prop("scrollHeight")+t-c)):n.height(u-c-l)},100):(e||n.prop("scrollHeight")<p)&&setTimeout(function(){n.height(h-c-l),n.height(n.prop("scrollHeight")+t-c)},100)};n.on("keydown",function(){f()}),n.on("paste",function(){f()}),d&&d.subscribe(function(e){f(e)},this),f()}},i.bindingHandlers.customBind={init:function(e,t,n,o){var s=t(),r=s.onKeydown?s.onKeydown:null,a=s.onKeyup?s.onKeyup:null,l=s.onPaste?s.onPaste:null,c=s.onInput?s.onInput:null,h=s.valueObserver?s.valueObserver:null;i.bindingHandlers.event.init(e,function(){return{keydown:function(t,i){return r&&r.call(this,e,i,h),!0},keyup:function(t,i){return a&&a.call(this,e,i,h),!0},paste:function(t,i){return l&&l.call(this,e,i,h),!0},input:function(t,i){return c&&c.call(this,e,i,h),!0}}},n,o)}},i.bindingHandlers.fade={init:function(t,i){var n=e(t),o=e('<span class="faded"></span>'),s=_.defaults(i(),{color:null,css:"fadeout"}),r=s.color,a=s.css,l=function(e){if(""!==e){var t=c(e),i="rgba("+t.r+","+t.g+","+t.b;h(e,i)}},c=function(e){var t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return e=e.replace(t,function(e,t,i,n){return t+t+i+i+n+n}),i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:null},h=function(e,t){I.isRTL()?o.css("filter","progid:DXImageTransform.Microsoft.gradient(startColorstr='"+e+"', endColorstr='"+e+"',GradientType=1 )").css("background-image","-webkit-gradient(linear, left top, right top, color-stop(0%,"+t+",1)), color-stop(100%,"+t+",0)))").css("background-image","-moz-linear-gradient(left, "+t+",1)0%, "+t+",0)100%)").css("background-image","-webkit-linear-gradient(left, "+t+"1)0%,"+t+",0)100%)").css("background-image","-o-linear-gradient(left, "+t+",1)0%,"+t+",0)100%)").css("background-image","-ms-linear-gradient(left, "+t+",1)0%,"+t+",0)100%)").css("background-image","linear-gradient(left, "+t+",1)0%,"+t+",0)100%)"):o.css("filter","progid:DXImageTransform.Microsoft.gradient(startColorstr='"+e+"', endColorstr='"+e+"',GradientType=1 )").css("background-image","-webkit-gradient(linear, left top, right top, color-stop(0%,"+t+",0)), color-stop(100%,"+t+",1)))").css("background-image","-moz-linear-gradient(left, "+t+",0)0%, "+t+",1)100%)").css("background-image","-webkit-linear-gradient(left, "+t+",0)0%,"+t+",1)100%)").css("background-image","-o-linear-gradient(left, "+t+",0)0%,"+t+",1)100%)").css("background-image","-ms-linear-gradient(left, "+t+",0)0%,"+t+",1)100%)").css("background-image","linear-gradient(left, "+t+",0)0%,"+t+",1)100%)")};n.parent().addClass(a),n.after(o),void 0!==s.color.subscribe&&(l(r()),r.subscribe(function(e){l(e)},this))}},i.bindingHandlers.highlighter={init:function(n,o,s,r){function a(t){if(S){var i=0,n=h.text(),o=n.split(m),s=[],r='<span class="search_highlight">$&</span>';e.each(o,function(t,i){_.any(g,function(e){return e===i})?e.each(i,function(t,i){s.push(e(i.replace(/(.)/,r)))}):e.each(i,function(e,t){s.push(" "===t?document.createTextNode(" "):document.createTextNode(t))})}),t?h.empty().append(s):(i=l(),h.empty().append(s),c(i))}}function l(){var e,i,o,s,r=0;return"undefined"!=typeof t.getSelection?(e=t.getSelection().getRangeAt(0),i=e.cloneRange(),i.selectNodeContents(n),i.setEnd(e.endContainer,e.endOffset),r=i.toString().length):"undefined"!=typeof document.selection&&"Control"!==document.selection.type&&(o=document.selection.createRange(),s=document.body.createTextRange(),s.moveToElementText(n),s.setEndPoint("EndToEnd",o),r=s.text.length),r}function c(e){var i,o,s;if(!n)return!1;if(document.createRange)i=document.createRange(),i.selectNodeContents(n),i.setStart(n,e),i.setEnd(n,e),o=t.getSelection(),o.removeAllRanges(),o.addRange(i);else{if(n.createTextRange)return s=n.createTextRange(),s.collapse(!0),s.moveEnd(e),s.moveStart(e),s.select(),!0;if(n.setSelectionRange)return n.setSelectionRange(e,e),!0}return!1}var h=e(n),u=o(),p=u.valueObserver?u.valueObserver:null,d=u.highlighterValueObserver?u.highlighterValueObserver:null,f=u.highlightTrigger?u.highlightTrigger:null,g=["from:","to:","subject:","text:","email:","has:","date:","text:","body:"],m=function(){var t="";return e.each(g,function(e,i){t=e?t+"|\\b"+i:t+"\\b"+i}),new RegExp("("+t+")","g")}(),b=function(e){return e.replace(/\xC2\xA0/g," ").replace(/\xA0/g," ").replace(/[\s]+/g," ")},y=-1,v=t.navigator.language||t.navigator.userLanguage,E=["zh","zh-TW","zh-CN","zh-HK","zh-SG","zh-MO","ja","ja-JP","ko","ko-KR","vi","vi-VN","th","th-TH"],S=!_.include(E,v);i.bindingHandlers.event.init(n,function(){return{keydown:function(e,t){return t.keyCode!==P.Key.Enter},keyup:function(e,t){var i=[P.Key.Left,P.Key.Right,P.Key.Home,P.Key.End],n=-1!==I.inArray(t.keyCode,i);return t.keyCode===P.Key.Shift||t.keyCode===P.Key.Ctrl||t.keyCode===P.Key.Dash||t.keyCode===P.Key.Apostrophe||t.keyCode===P.Key.Six&&t.shiftKey||n||(t.ctrlKey||y===P.Key.Ctrl)&&t.keyCode===P.Key.a||(p(b(h.text())),a(!1)),y=t.keyCode,!0},paste:function(){return setTimeout(function(){p(b(h.text())),a(!1)},0),!0}}},s,r),setTimeout(function(){a(!0)},0),f.notifySubscribers(),f.subscribe(function(e){setTimeout(function(){a(!!e)},0)},this),d.subscribe(function(){h.text(p())},this)}},i.bindingHandlers.quoteText={init:function(t,i,n,o){var s=(e(t),e('<span class="button_quote">'+I.i18n("HELPDESK/BUTTON_QUOTE")+"</span>")),r=i(),a=r.actionHandler,l=!1,c=null,h="";e("#pSevenContent").append(s),e(document.body).on("click",function(t){l=!!e(t.target).parents(".posts")[0],document.getSelection?(c=document.getSelection(),c&&(h=c.toString())):h=document.selection.createRange().text,l&&""!==h.replace(/[\n\r\s]/,"")?s.css({top:t.clientY+20,left:t.clientX+20}).show():s.hide()}),s.on("click",function(){a.call(o,h)})}},i.bindingHandlers.adjustHeightToContent={init:function(t){var i=e(t),n=null,o=null,s=null;_.delay(_.bind(function(){n=e(_.max(i.find(".title .text"),function(e){return e.offsetWidth})),o=n.parent(),s=o.find(".icon"),i.css("min-width",parseInt(o.css("margin-left"))+parseInt(o.css("padding-left"))+parseInt(s.width())+parseInt(s.css("margin-left"))+parseInt(s.css("margin-right"))+parseInt(s.css("padding-left"))+parseInt(s.css("padding-right"))+parseInt(n.width())+parseInt(n.css("margin-left"))+parseInt(n.css("padding-left"))+10)},this),1)}},i.bindingHandlers.customTooltip={update:O?null:function(t,i){var n=I.i18n(i());e(t).attr("title",n)}},I.inArray=e.inArray,I.isFunc=e.isFunction,I.trim=e.trim,I.emptyFunction=function(){},I.isUnd=function(e){return void 0===e},I.isNull=function(e){return null===e},I.isNormal=function(e){return!I.isUnd(e)&&!I.isNull(e)},I.isNumeric=function(e){return I.isNormal(e)?/^[1-9]+[0-9]*$/.test(e.toString()):!1},I.pInt=function(e){var i=t.parseInt(e,10);return isNaN(i)&&(i=0),i},I.pString=function(e){return I.isNormal(e)?e.toString():""},I.isNonEmptyArray=function(e,t){return t=t||1,_.isArray(e)&&t<=e.length},I.pImport=function(e,t,i){e[t]=i},I.pExport=function(e,t,i){return I.isUnd(e[t])?i:e[t]},I.encodeHtml=function(e){return e?e.toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;"):""},I.i18n=function(e,t,i,n){var o="",s=I.isUnd(F[e])?I.isNormal(i)?i:e:F[e];if(I.isUnd(n)||(s=function(e,t){var i=I.getPlural(N.User.DefaultLanguage,e),n=t.split("|");return n&&n[i]?n[i]:n&&n[0]?n[0]:t}(n,s)),I.isNormal(t))for(o in t)t.hasOwnProperty(o)&&(s=s.replace("%"+o+"%",t[o]));return s},I.roundNumber=function(e,t){return Math.round(e*Math.pow(10,t))/Math.pow(10,t)},I.friendlySize=function(e){var t=1024,i=t*t,n=t*t*t;return e=I.pInt(e),e>=n?I.roundNumber(e/n,1)+I.i18n("MAIN/GIGABYTES"):e>=i?I.roundNumber(e/i,1)+I.i18n("MAIN/MEGABYTES"):e>=t?I.roundNumber(e/t,0)+I.i18n("MAIN/KILOBYTES"):e+I.i18n("MAIN/BYTES")},I.timeOutAction=function(){var e={};return function(i,n,o){I.isUnd(e[i])&&(e[i]=0),t.clearTimeout(e[i]),e[i]=t.setTimeout(n,o)}}(),I.$log=null,I.aLog=[],I.log=function(){function t(e,t){return"string"==typeof t&&t.length>50?t.substring(0,50):t}if(N&&N.ClientDebug&&R.browser&&!R.browser.ie9AndBelow){var i=I.$log||e('<div style="display: none;"></div>').appendTo("body"),n=[];_.each(arguments,function(e){var i="string"==typeof e?e:JSON.stringify(e,t);0===n.length&&(i=" *** "+i+" *** "),n.push(i)}),n.push(moment().format(" *** D MMMM, YYYY, HH:mm:ss *** ")),I.$log=i,I.aLog.length>200&&I.aLog.shift(),I.aLog.push(I.encodeHtml(n.join(", "))),i.html(I.aLog.join("<br /><br />"))}},I.getAjaxDataForLog=function(e,t){var i=t;if(t&&t.Result)switch(e){case"MessageList":case"MessageListByUids":i={Result:{Uids:t.Result.Uids,UidNext:t.Result.UidNext,FolderHash:t.Result.FolderHash,MessageCount:t.Result.MessageCount,MessageUnseenCount:t.Result.MessageUnseenCount,MessageResultCount:t.Result.MessageResultCount}};break;case"Message":i={Result:{Folder:t.Result.Folder,Uid:t.Result.Uid,Subject:t.Result.Subject,Size:t.Result.Size,TextSize:t.Result.TextSize,From:t.Result.From,To:t.Result.To}};break;case"Messages":i={Result:_.map(t.Result,function(e){return{Uid:e.Uid,Subject:e.Subject}})}}else t&&(i={Result:t.Result,ErrorCode:t.ErrorCode});return i},I.getEmailParts=function(e){for(var t=e.indexOf('"'),i=e.indexOf('"',t+1),n=e.indexOf("<",i),o=-1,s=-1,r="",a="";-1!==n;)o=n,n=e.indexOf("<",n+1);return n=o,s=e.indexOf(">",n+1),-1===n?a=I.trim(e):(r=I.trim(-1===t?e.substring(0,n):e.substring(t+1,i)),a=I.trim(e.substring(n+1,s))),{name:r,email:a,FullEmail:e}},I.isCorrectEmail=function(e){return!!e.match(/^[A-Z0-9\"!#\$%\^\{\}`~&'\+\-=_\.]+@[A-Z0-9\.\-]+$/i)},I.getIncorrectEmailsFromAddressString=function(e){for(var t=e.replace(/"[^"]*"/g,"").replace(/;/g,",").split(","),i=[],n=0,o=t.length,s="",r=null;o>n;n++)s=I.trim(t[n]),s.length>0&&(r=I.getEmailParts(I.trim(t[n])),I.isCorrectEmail(r.email)||i.push(r.email));return i},I.getArrayRecipients=function(e){if(!e)return[];for(var t=[],i=I.trim(e)+" ",n=0,o=0,s=!1,r='"',a=!1,l=!1,c=0,h=i.length,u="",p="",d=null,f=!1,g=0,m=0;h>c;){switch(u=i.substring(c,c+1)){case"'":case'"':s?r===u&&(s=!1):a||l||(r=u,s=!0);break;case"<":s||a||l||(a=!0);break;case">":a&&(a=!1);break;case"(":s||a||l||(l=!0);break;case")":l&&(l=!1);break;default:if(","!==u&&";"!==u&&c!==h-1)break;if(!a&&!l&&!s){if(o=c!==h-1?c:h,p=i.substring(n,o),I.trim(p).length>0){for(d=I.getEmailParts(p),f=!1,g=t.length,m=0;g>m;m++)t[m].email===d.email&&(f=!0);!f&&I.isCorrectEmail(d.email)&&t.push(d)}n=c+1}}c++}return t},I.getImportContactsLink=function(){return"?/ImportContacts/"},I.getExportContactsLink=function(e){return"?/Raw/Contacts"+e+"/"},I.getExportCalendarLinkByHash=function(e,t){return"?/Raw/Calendar/"+e+"/"+t},I.getDownloadLinkByHash=function(e,t,i,n){return i=I.isUnd(i)?!1:!!i,n=I.isUnd(n)?"":n,"?/Raw/Download/"+e+"/"+t+"/"+(i?"1":"0")+(""===n?"":"/"+n)},I.getViewLinkByHash=function(e,t,i,n){return i=I.isUnd(i)?!1:!!i,n=I.isUnd(n)?"":n,"?/Raw/View/"+e+"/"+t+"/"+(i?"1":"0")+(""===n?"":"/"+n)},I.getIframeLinkByHash=function(e,t,i,n){return i=I.isUnd(i)?!1:!!i,n=I.isUnd(n)?"":n,"?/Raw/Iframe/"+e+"/"+t+"/"+(i?"1":"0")+(""===n?"":"/"+n)},I.getIframeWrappwer=function(e,i){return"?/Raw/Iframe/"+e+"/"+t.encodeURIComponent(i)+"/"},I.getViewThumbnailLinkByHash=function(e,t,i,n){return i=I.isUnd(i)?!1:!!i,n=I.isUnd(n)?"":n,"?/Raw/Thumbnail/"+e+"/"+t+"/"+(i?"1":"0")+(""===n?"":"/"+n)},I.getFilestorageDownloadLinkByHash=function(e,t,i){var n="?/Raw/FilesDownload/"+e+"/"+t;return I.isUnd(i)||(n=n+"/0/"+i),n},I.getFilestorageViewLinkByHash=function(e,t,i){var n="?/Raw/FilesView/"+e+"/"+t;return I.isUnd(i)||(n=n+"/0/"+i),n},I.getFilestorageViewThumbnailLinkByHash=function(e,t,i){var n="?/Raw/FilesThumbnail/"+e+"/"+t;return I.isUnd(i)||(n=n+"/0/"+i),n},I.getFilestoragePublicViewLinkByHash=function(e){return"?/Window/Files/0/"+e},I.getFilestoragePublicDownloadLinkByHash=function(e){return"?/Raw/FilesPub/0/"+e},I.daysInMonth=function(e,t){return e>0&&13>e&&t>0?new Date(t,e,0).getDate():31},I.getAppPath=function(){return t.location.protocol+"//"+t.location.host+t.location.pathname},I.WindowOpener={_iDefaultRatio:.8,_aOpenedWins:[],openMessage:function(e,t){if(e){var i=e.folder(),n=e.uid(),o="",s=null;o=R.Routing.buildHashFromArray(t?[P.Screens.SingleCompose,"drafts",i,n]:[P.Screens.SingleMessageView,i,"msg"+n]),s=this.openTab(o)}},openTab:function(e){var i=null;return i=t.open(e,"_blank"),i.focus(),i.name=N.Accounts.currentId(),this._aOpenedWins.push(i),i},open:function(e,i,n){var o=n?",menubar=yes":",menubar=no",s="location=no,toolbar=no,status=no,scrollbars=yes,resizable=yes"+o,r=null;return i=i.replace(/\W/g,""),s+=this._getSizeParameters(),r=t.open(e,i,s),r.focus(),r.name=N.Accounts.currentId(),this._aOpenedWins.push(r),r},closeAll:function(){for(var e=this._aOpenedWins.length,t=0,i=null;e>t;t++)i=this._aOpenedWins[t],i.closed||i.close();this._aOpenedWins=[]},_getSizeParameters:function(){var e=t.screen.width,i=Math.ceil(e*this._iDefaultRatio),n=Math.ceil((e-i)/2),o=t.screen.height,s=Math.ceil(o*this._iDefaultRatio),r=Math.ceil((o-s)/2);return",width="+i+",height="+s+",top="+r+",left="+n}},I.delegateRun=function(e,t,i){e&&e[t]&&e[t].apply(e,_.isArray(i)?i:[])},I.strRepeat=function(e,t){return new Array(t+1).join(e)},I.deferredUpdate=function(e,i,n,o){!e.__interval&&i?(e.__state=!0,o(e,!0),e.__interval=t.setInterval(function(){e.__state||(o(e,!1),t.clearInterval(e.__interval),e.__interval=null)},n)):i||(e.__state=!1)},I.draggableMessages=function(){return e('<div class="draggable draggableMessages"><div class="content"><span class="count-text"></span></div></div>').appendTo("#pSevenHidden")},I.draggableContacts=function(){return e('<div class="draggable draggableContacts"><div class="content"><span class="count-text"></span></div></div>').appendTo("#pSevenHidden")},I.removeActiveFocus=function(){if(document&&document.activeElement&&document.activeElement.blur){var t=e(document.activeElement);(t.is("input")||t.is("textarea"))&&document.activeElement.blur()}},I.uiDropHelperAnim=function(i,n){var o=0,s=0,r=0,a=0,l=0,c=0,h=n.helper.clone().appendTo("#pSevenHidden"),u=e(i.target).find(".animGoal"),p=null;u=e(u[0]?u[0]:i.target),p=u&&u[0]?u.offset():null,p&&(o=t.Math.round(p.left),s=t.Math.round(p.top),l=u.width(),c=u.height(),r=o,l>0&&(r+=t.Math.round(l/2)),a=s,c>0&&(a+=t.Math.round(c/2)),h.animate({left:r+"px",top:a+"px","font-size":"0px",opacity:0},800,"easeOutQuint",function(){e(this).remove()}))},I.isTextFieldFocused=function(){var e=document&&document.activeElement?document.activeElement:null,t=e?e.tagName:null,i=e&&e.type?e.type.toLowerCase():null,n=e?e.contentEditable:null;return"INPUT"===t&&("text"===i||"password"===i||"email"===i)||"TEXTAREA"===t||"IFRAME"===t||"true"===n},I.removeSelection=function(){t.getSelection?t.getSelection().removeAllRanges():document.selection&&document.selection.empty()},I.getMonthNamesArray=function(){for(var e=I.i18n("DATETIME/MONTH_NAMES").split(" "),t=12,i=e.length;t>i;i++)e[i]="";return e},I.getPlural=function(e,t){var i=0;switch(t=I.pInt(t),e){case"Arabic":i=0===t?0:1===t?1:2===t?2:t%100>=3&&10>=t%100?3:t%100>=11?4:5;break;case"Bulgarian":i=1===t?0:1;break;case"Chinese-Simplified":i=0;break;case"Chinese-Traditional":i=1===t?0:1;break;case"Czech":i=1===t?0:t>=2&&4>=t?1:2;break;case"Danish":i=1===t?0:1;break;case"Dutch":i=1===t?0:1;break;case"English":i=1===t?0:1;break;case"Estonian":i=1===t?0:1;break;case"Finish":i=1===t?0:1;break;case"French":i=1===t?0:1;break;case"German":i=1===t?0:1;break;case"Greek":i=1===t?0:1;break;case"Hebrew":i=1===t?0:1;break;case"Hungarian":i=1===t?0:1;break;case"Italian":i=1===t?0:1;break;case"Japanese":i=0;break;case"Korean":i=0;break;case"Latvian":i=t%10===1&&t%100!==11?0:0!==t?1:2;break;case"Lithuanian":i=t%10===1&&t%100!==11?0:t%10>=2&&(10>t%100||t%100>=20)?1:2;break;case"Norwegian":i=1===t?0:1;break;case"Persian":i=0;break;case"Polish":i=1===t?0:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?1:2;break;case"Portuguese-Portuguese":i=1===t?0:1;break;case"Portuguese-Brazil":i=1===t?0:1;break;case"Romanian":i=1===t?0:0===t||t%100>0&&20>t%100?1:2;break;case"Russian":i=t%10===1&&t%100!==11?0:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?1:2;break;case"Serbian":i=t%10===1&&t%100!==11?0:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?1:2;break;case"Spanish":i=1===t?0:1;break;case"Swedish":i=1===t?0:1;break;case"Thai":i=0;break;case"Turkish":i=1===t?0:1;break;case"Ukrainian":i=t%10===1&&t%100!==11?0:t%10>=2&&4>=t%10&&(10>t%100||t%100>=20)?1:2;break;default:i=0}return i},I.getFileExtension=function(e){var t="",i=e.lastIndexOf(".");return i>-1&&(t=e.substr(i+1)),t},I.getFileNameWithoutExtension=function(e){var t=e,i=e.lastIndexOf(".");return i>-1&&(t=e.substr(0,i)),t},I.defaultOptionsAfterRender=function(e,t){t&&(I.isUnd(t.disable)||i.applyBindingsToNode(e,{disable:t.disable},t))},I.getDateFormatForMoment=function(e){var t="MM/DD/YYYY";switch(e){case"MM/DD/YYYY":t="MM/DD/YYYY";break;case"DD/MM/YYYY":t="DD/MM/YYYY";break;case"DD Month YYYY":t="DD MMMM YYYY"}return t},I.getDateFormatForDatePicker=function(e){var t="mm/dd/yy";switch(e){case"MM/DD/YYYY":t="mm/dd/yy";break;case"DD/MM/YYYY":t="dd/mm/yy";break;case"DD Month YYYY":t="dd MM yy"}return t},I.getDateFormatsForSelector=function(){return _.map(N.App.DateFormats,function(e){switch(e){case"MM/DD/YYYY":return{name:I.i18n("DATETIME/DATEFORMAT_MMDDYYYY"),value:e};case"DD/MM/YYYY":return{name:I.i18n("DATETIME/DATEFORMAT_DDMMYYYY"),value:e};case"DD Month YYYY":return{name:I.i18n("DATETIME/DATEFORMAT_DDMONTHYYYY"),value:e};default:return{name:e,value:e}}})},I.getTitleForEvent=function(e){var t=e?I.trim(e.replace(/[\n\r]/," ")):"",i=t.indexOf(" ",180);return i>=0&&(t=t.substring(0,i)+"..."),t.length>200&&(t=t.substring(0,200)+"..."),t},I.desktopNotify=function(){var e=[],i=0;return function(n){if(N.User.DesktopNotifications&&t.Notification&&!R.focused())if(n&&"show"===n.action&&t.Notification.permission!==P.notificationPermission.Denied){var o,s={body:n.body||"",dir:n.dir||"auto",lang:n.lang||"",tag:n.tag||Math.floor(900*Math.random()+100),icon:n.icon||!1},r=function(){o=new t.Notification(n.title,s),o.onclick=function(){n.callback&&n.callback(),o.close()},o.onshow=function(){},o.onclose=function(){},o.onerror=function(){},n.timeout&&(i=setTimeout(function(){o.close()},n.timeout)),e.push(o)};"granted"===t.Notification.permission?r():"default"===t.Notification.permission&&t.Notification.requestPermission(function(e){"granted"===e&&r()})}else n&&"hide"===n.action?_.each(e,function(t,i){n.tag===t.tag&&(t.close(),e.splice(i,1))}):n&&"hideAll"===n.action&&(_.each(e,function(e){e.close()}),e.length=0)}}(),I.isRTL=function(){return L.hasClass("rtl")},I.validateFileOrFolderName=function(e){return e=I.trim(e),""!==e&&!/["\/\\*?<>|:]/.test(e)},I.shadeColor=function(e,i){var n=!1,o=0,s=0,r=0,a=0;return"#"===e[0]&&(e=e.slice(1),n=!0),o=t.parseInt(e,16),s=(o>>16)+i,s>255?s=255:0>s&&(s=0),r=(o>>8&255)+i,r>255?r=255:0>r&&(r=0),a=(255&o)+i,a>255?a=255:0>a&&(a=0),(n?"#":"")+(a|r<<8|s<<16).toString(16)},I.extend=function(e,t){var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e},I.thumbQueue=function(){var e={},t={},i=2;return function(n,o,s){o&&s?!(n in t)||t[n]>0?(n in t||(t[n]=i,e[n]=[]),t[n]--,s(o)):e[n].push({imageSrc:o,imageSrcObserver:s,messageUid:n}):e[n]&&e[n].length&&(e[n][0].imageSrcObserver(e[n][0].imageSrc),e[n].shift())}}(),I.checkConnection=function(){var e=-1,t=(new Date).getTime(),i=0,n=!1;return setInterval(function(){i=(new Date).getTime(),n=i>t+5e3+1e3,t=i,n&&R.Api.hideError(!0)},5e3),function(t,i){clearTimeout(e),"error"!==i?R.Api.hideError(!0):"Ping"===t?(R.Api.showError(I.i18n("WARNING/NO_INTERNET_CONNECTION"),!1,!0,!0),e=setTimeout(function(){R.Ajax.send({Action:"Ping"})},6e4)):R.Ajax.send({Action:"Ping"})}}(),I.loadScript=function(e,i,n,o){var s=document.createElement("script");!I.isUnd(o)&&i&&(t[o]=i),I.isUnd(n)&&(n={}),_.each(n,function(e,t){s.setAttribute(t,e)}),s.type="text/javascript",s.src=e,document.body.appendChild(s)},I.registerMailto=function(e){!t.navigator||!I.isFunc(t.navigator.registerProtocolHandler)||e&&1===R.Storage.getData("MailtoAsked")||(t.navigator.registerProtocolHandler("mailto",I.getAppPath()+"#"+P.Screens.Compose+"/to/%s",""!==N.App.SiteName?N.App.SiteName:"WebMail"),R.Storage.setData("MailtoAsked",1))
},I.CustomTooltip={_$Region:null,_$ArrowTop:null,_$Text:null,_$ArrowBottom:null,_iArrowBorderLeft:0,_iArrowMarginLeft:0,_iLeftShift:0,_bInitialized:!1,init:function(){this._bInitialized||(this._$Region=e('<span class="custom_tooltip"></span>').appendTo("body").hide(),this._$ArrowTop=e('<span class="custom_tooltip_arrow top"></span>').appendTo(this._$Region),this._$Text=e('<span class="custom_tooltip_text"></span>').appendTo(this._$Region),this._$ArrowBottom=e('<span class="custom_tooltip_arrow bottom"></span>').appendTo(this._$Region),this._iArrowMarginLeft=I.pInt(this._$ArrowTop.css("margin-left")),this._iArrowBorderLeft=I.pInt(this._$ArrowTop.css("border-left-width")),this._iLeftShift=this._iArrowBorderLeft+this._iArrowMarginLeft+I.pInt(this._$Region.css("margin-left")),this._bInitialized=!0),this._$ArrowTop.show(),this._$ArrowBottom.hide(),this._$ArrowTop.css({"margin-left":this._iArrowMarginLeft+"px"}),this._$ArrowBottom.css({"margin-left":this._iArrowMarginLeft+"px"})},show:function(t,i){this.init();var n=i.offset(),o=Math.round(i.innerWidth()/2),s=this._iLeftShift-o;this._$Text.html(t),this._$Region.fadeIn().css({top:n.top+i.height(),left:n.left-s,right:"auto"}),e("body").height()<this._$Region.height()+this._$Region.offset().top&&(this._$ArrowTop.hide(),this._$ArrowBottom.show(),this._$Region.css({top:n.top-this._$Region.height()})),e("body").width()<this._$Region.outerWidth(!0)+this._$Region.offset().left&&(this._$Region.css({left:"auto",right:0}),this._$ArrowTop.css({"margin-left":o+n.left-this._$Region.offset().left-this._iArrowBorderLeft+"px"}))},hide:function(){this._bInitialized&&this._$Region.hide()}},s.prototype.iTimer=0,s.prototype.bResetCheckedOnClick=!1,s.prototype.bCheckOnSelect=!1,s.prototype.bUnselectOnCtrl=!1,s.prototype.bDisableMultiplySelection=!1,s.prototype.setBeforeSelectCallback=function(e){this.fBeforeSelectCallback=e||null},s.prototype.getLastOrSelected=function(){var e=0,t=null;return _.each(this.list(),function(i){i.checked()&&e++,i.selected()&&(t=i)}),0===e&&t?t:this.oLast},s.prototype.initOnApplyBindings=function(t,n,o,s,r){e(document).on("keydown",this.onKeydownBinded),this.oListScope=s,this.oScrollScope=r,this.sActionSelector=t,this.sSelectabelSelector=n,this.sCheckboxSelector=o;var a=this,l=function(e,t,i){var n=0,o=0,s=null,r=!1,l=!1,c=[],h=!1;if(t=t?t:null,i&&i.shiftKey&&null!==t&&null!==e&&t!==e)for(c=a.list(),h=t.checked(),n=0,o=c.length;o>n;n++)s=c[n],r=!1,(s===e||s===t)&&(r=!0),r&&(l=!l),(l||r)&&s.checked(h);t&&(a.oLast=t)};e(this.oListScope).on("dblclick",t,function(e){var t=i.dataFor(this);!t||!e||e.ctrlKey||e.altKey||e.shiftKey||a.onDblClick(t)}),H&&e(this.oListScope).on("touchstart",t,function(t){if(t){var i=t.timeStamp,n=e(this).data("lastTouch")||i,o=i-n,s=t.originalEvent&&t.originalEvent.touches?t.originalEvent.touches.length:0;e(this).data("lastTouch",i),!o||o>250||s>1||(t.preventDefault(),e(this).trigger("dblclick"))}}),e(this.oListScope).on("click",t,function(e){var t=!0,n=null,o=a.getLastOrSelected(),s=i.dataFor(this);s&&e&&(e.shiftKey?(t=!1,a.bDisableMultiplySelection||(null===a.oLast&&(a.oLast=s),s.checked(!s.checked()),l(o,s,e))):e.ctrlKey&&(t=!1,a.bDisableMultiplySelection||(a.oLast=s,n=a.itemSelected(),!n||n.checked()||s.checked()||n.checked(!0),a.bUnselectOnCtrl&&s===a.itemSelected()?(s.checked(!s.selected()),a.itemSelected(null)):s.checked(!s.checked()))),t&&(a.onSelect(s),a.scrollToSelected()))}),e(this.oListScope).on("click",o,function(e){var t=i.dataFor(this);t&&e&&!a.bDisableMultiplySelection&&(e.shiftKey?(null===a.oLast&&(a.oLast=t),l(a.getLastOrSelected(),t,e)):a.oLast=t),e&&e.stopPropagation&&e.stopPropagation()}),e(this.oListScope).on("dblclick",o,function(e){e&&e.stopPropagation&&e.stopPropagation()})},s.prototype.getResultSelection=function(e,t){var i=this,n=!1,o=!1,s=null,r=this.iFactor,a=!!this.multiplyLineFactor,l=0,c=0,h=[];if(!e&&-1<I.inArray(t,[this.KeyUp,this.KeyDown,this.KeyLeft,this.KeyRight,P.Key.PageUp,P.Key.PageDown,P.Key.Home,P.Key.End]))h=this.list(),h&&0<h.length&&(-1<I.inArray(t,[this.KeyDown,this.KeyRight,P.Key.PageUp,P.Key.Home])?s=h[0]:-1<I.inArray(t,[this.KeyUp,this.KeyLeft,P.Key.PageDown,P.Key.End])&&(s=h[h.length-1]));else if(e&&(h=this.list(),c=h?h.length:0,c>0))if(P.Key.Home===t||P.Key.PageUp===t||P.Key.End===t||P.Key.PageDown===t||a&&(P.Key.Left===t||P.Key.Right===t)||!a&&(P.Key.Up===t||P.Key.Down===t))_.each(h,function(r){if(!n)switch(t){case i.KeyUp:case i.KeyLeft:e===r?n=!0:s=r;break;case P.Key.Home:case P.Key.PageUp:s=r,n=!0;break;case i.KeyDown:case i.KeyRight:o?(s=r,n=!0):e===r&&(o=!0);break;case P.Key.End:case P.Key.PageDown:s=r}});else if(a&&this.KeyDown===t){for(;c>l;l++)if(e===h[l]){l+=r,l>c-1&&(l-=r),s=h[l];break}}else if(a&&this.KeyUp===t)for(l=c;l>=0;l--)if(e===h[l]){l-=r,0>l&&(l+=r),s=h[l];break}return s},s.prototype.shiftClickResult=function(e,t,i){if(t){var n=!!this.multiplyLineFactor,o=!1,s=!1;-1<I.inArray(i,n?[P.Key.Left,P.Key.Right]:[P.Key.Up,P.Key.Down])?t.checked(!t.checked()):-1<I.inArray(i,n?[P.Key.Up,P.Key.Down,P.Key.PageUp,P.Key.PageDown,P.Key.Home,P.Key.End]:[P.Key.Left,P.Key.Right,P.Key.PageUp,P.Key.PageDown,P.Key.Home,P.Key.End])&&(s=!t.checked(),_.each(this.list(),function(i){var n=!1;(i===e||t===i)&&(o=!o,n=!0),(o||n)&&(i.checked(s),n=!1)}),n&&e&&(i===P.Key.Up||i===P.Key.Down)&&e.checked(!e.checked()))}},s.prototype.clickNewSelectPosition=function(e,i){var n=this,o=0,s=null,r=this.itemSelected();s=this.getResultSelection(r,e),s?(i&&this.shiftClickResult(s,r,e),s&&this.fBeforeSelectCallback?(this.fBeforeSelectCallback(s,function(e){e&&(n.itemSelected(s),o=0===n.iTimer?50:150,0!==n.iTimer&&t.clearTimeout(n.iTimer),n.iTimer=t.setTimeout(function(){n.iTimer=0,n.onSelect(s,!1)},o),this.scrollToSelected())}),this.scrollToSelected()):(this.itemSelected(s),o=0===this.iTimer?50:150,0!==this.iTimer&&t.clearTimeout(this.iTimer),this.iTimer=t.setTimeout(function(){n.iTimer=0,n.onSelect(s)},o),this.scrollToSelected())):r&&i&&-1<I.inArray(e,[this.KeyUp,this.KeyDown,this.KeyLeft,this.KeyRight,P.Key.PageUp,P.Key.PageDown,P.Key.Home,P.Key.End])&&r.checked(!r.checked())},s.prototype.onKeydown=function(e){var t=!0,i=0;return this.useKeyboardKeys()&&e&&!I.isTextFieldFocused()&&(i=e.keyCode,e.ctrlKey||this.KeyUp!==i&&this.KeyDown!==i&&this.KeyLeft!==i&&this.KeyRight!==i&&P.Key.PageUp!==i&&P.Key.PageDown!==i&&P.Key.Home!==i&&P.Key.End!==i?P.Key.Del!==i||e.ctrlKey||e.shiftKey?P.Key.Enter===i?0<this.list().length&&!e.ctrlKey&&(this.onEnter(this.itemSelected()),t=!1):!e.ctrlKey||e.altKey||e.shiftKey||P.Key.a!==i||(this.checkAll(!(this.checkAll()&&!this.isIncompleteChecked())),t=!1):0<this.list().length&&(this.onDelete(),t=!1):(this.clickNewSelectPosition(i,e.shiftKey),t=!1)),t},s.prototype.onDelete=function(){this.fDeleteCallback.call(this,this.listCheckedOrSelected())},s.prototype.onEnter=function(e){var t=this;e&&this.fBeforeSelectCallback?this.fBeforeSelectCallback(e,function(i){i&&(t.itemSelected(e),t.fEnterCallback.call(this,e))}):(this.itemSelected(e),this.fEnterCallback.call(this,e))},s.prototype.selectionFunc=function(e){this.itemSelected(null),this.bResetCheckedOnClick&&this.listChecked(!1),this.itemSelected(e),this.fSelectCallback.call(this,e)},s.prototype.onSelect=function(e,t){if(t=I.isUnd(t)?!0:!!t,this.fBeforeSelectCallback&&t){var i=this;this.fBeforeSelectCallback(e,function(t){t&&i.selectionFunc(e)})}else this.selectionFunc(e)},s.prototype.onDblClick=function(e){this.fDblClickCallback.call(this,e)},s.prototype.koCheckAll=function(){return i.computed({read:this.checkAll,write:this.checkAll,owner:this})},s.prototype.koCheckAllIncomplete=function(){return i.computed({read:this.isIncompleteChecked,write:this.isIncompleteChecked,owner:this})},s.prototype.scrollToSelected=function(){if(!this.oListScope||!this.oScrollScope)return!1;var t=20,i=e(this.sSelectabelSelector,this.oScrollScope),n=i.position(),o=this.oScrollScope.height(),s=i.outerHeight();return n&&(n.top<0||n.top+s>o)?(this.oScrollScope.scrollTop(n.top<0?this.oScrollScope.scrollTop()+n.top-t:this.oScrollScope.scrollTop()+n.top-o+s+t),!0):!1},function(e){e.fn.splitter=function(i){return i=i||{},this.each(function(){var n=!1,o=i.name,s=0,r=0,a={},l={},c=function(t){n=!0,y.addClass(g.activeClass),g._posSplit=-((v?m._overallWidth-t[g.eventPos]:t[g.eventPos])-b.get(0)[g.pxSplit]),e("body").attr({unselectable:"on"}).addClass("unselectable"),e(document).bind("mousemove",h).bind("mouseup",u)},h=function(e){var t=(v?m._overallWidth-e[g.eventPos]:e[g.eventPos])+g._posSplit;p(t),I.isFunc(i.resizeFunc)&&i.resizeFunc()},u=function E(){y.removeClass(g.activeClass),e("body").attr({unselectable:"off"}).removeClass("unselectable"),o&&R.Storage.setData(o+"ResizerWidth",b.get(0)[g.pxSplit]),e(document).unbind("mousemove",h).unbind("mouseup",E),I.isFunc(i.resizeFunc)&&i.resizeFunc()},p=function(e,i){i||(e=t.Math.max(b.get(0)._min,m._overallWidth-b.get(1)._max,t.Math.min(e,b.get(0)._max,m._overallWidth-b.get(1)._min))),b.get(0).$.css(g.split,e),b.get(1).$.css(g.split,m._overallWidth-e),R.browser.ie8AndBelow||b.trigger("resize")},d=function(e){for(var i=0,n=1;n<arguments.length;n++)i+=t.Math.max(t.parseInt(e.css(arguments[n]),10)||0,0);return i},f=(i.splitHorizontal?"h":i.splitVertical?"v":i.type)||"v",g=e.extend({activeClass:"active",pxPerKey:8,tabIndex:0,accessKey:""},{v:{keyLeft:39,keyRight:37,type:"v",eventPos:"pageX",origin:"left",split:"width",pxSplit:"offsetWidth",side1:"Left",side2:"Right",fixed:"height",pxFixed:"offsetHeight",side3:"Top",side4:"Bottom"},h:{keyTop:40,keyBottom:38,type:"h",eventPos:"pageY",origin:"top",split:"height",pxSplit:"offsetHeight",side1:"Top",side2:"Bottom",fixed:"width",pxFixed:"offsetWidth",side3:"Left",side4:"Right"}}[f],i),m=e(this),b=e(">*:not(css3pie)",m).each(function(){this.$=e(this)}),y=e(".resize_handler",b.get(0)).attr({unselectable:"on"}).bind("mousedown",c),v="rtl"===m.css("direction");b.get(0)._paneName=g.side1,b.get(1)._paneName=g.side2,b.each(function(){this._min=g["min"+this._paneName]||d(this.$,"min-"+g.split),this._max=g["max"+this._paneName]||d(this.$,"max-"+g.split)||9999,this._init=void 0===g["size"+this._paneName]?t.parseInt(e.css(this,g.split),10):g["size"+this._paneName]}),s=o?R.Storage.getData(o+"ResizerWidth")||b.get(0)._init:b.get(0)._init,isNaN(s)&&(s=m[0][g.pxSplit],s=t.Math.round(s/b.length)),g.resizeToWidth&&!R.browser.ie8AndBelow&&e(t).bind("resize",function(e){e.target===this&&m.trigger("resize")}),m.bind("resize",function(e,t,i,o){var s=e.target.className+"_"+i;n&&(a={}),e.target===this&&(m._overallWidth=m[0][g.pxSplit],m._overallWidth<=0||(r=g.sizeRight||g.sizeBottom?m._overallWidth-b.get(1)[g.pxSplit]:b.get(0)[g.pxSplit],isNaN(t)?t=r:i&&(n=!1,a[s]?(t=a[s],a[s]=null):(t===r?(a[s]=null,t=l[s]):a[s]=l[s]=r,_.each(a,function(e,t){t!==s&&(a[t]=null)}))),p(t,o)))}).trigger("resize",[s])})}}(jQuery),function(e){e.ui.autocomplete.prototype._renderItem=function(t,i){return i.label=I.trim(i.label),i.label=i.label.replace(/\([^\)]+\)$/i,function(e){return"~~1~~"+e+"~~2~~"}),i.label=i.label.replace(/<[^>]+>$/i,function(e){return"~~1~~"+e+"~~2~~"}),i.label=I.encodeHtml(i.label),i.label=i.label.replace(/~~1~~/,'<span style="opacity: 0.5">').replace(/~~2~~/,"</span>"),e("<li>").append("<a>"+i.label+"</a>").appendTo(t)},e.ui.autocomplete.prototype._renderMenu=function(t,i){var n=this,o="";e.each(i,function(e,i){i&&i.category&&i.category!==o&&(o=i.category,t.append('<li class="ui-autocomplete-category">'+i.category+"</li>")),n._renderItemData(t,i)})}}(jQuery),r.prototype.openComposeMessage=function(e){R.Routing.setHash(R.Links.composeWithToField(e))},r.prototype.downloadByUrl=function(i){var n=null;H?t.open(i):(n=e('<iframe style="display: none;"></iframe>').appendTo(document.body),n.attr("src",i),setTimeout(function(){n.remove()},6e4))},r.prototype.isPgpSupported=function(){return!(!t.crypto||!t.crypto.getRandomValues)},r.prototype.pgp=function(i,n){if(I.isFunc(i))if(this.openPgp)i(this.openPgp);else if(this.isPgpSupported()){null!==this.openPgpCallbacks?this.openPgpCallbacks.push(i):i(!1);var o=this;this.openPgpRequest||(this.openPgpRequest=!0,e.ajax({url:"static/js/openpgp.js",dataType:"script",cache:!0,complete:function(){o.openPgp=t.openpgp?new l(t.openpgp,"user_"+(n||"0")+"_"):!1,null!==o.openPgpCallbacks&&_.each(o.openPgpCallbacks,function(e){e(o.openPgp)}),o.openPgpCallbacks=null}}))}else i(!1)},r.prototype.showLoading=function(e){R.Screens.showLoading(e)},r.prototype.hideLoading=function(){R.Screens.hideLoading()},r.prototype.showReport=function(e,t){R.Screens.showReport(e,t)},r.prototype.showError=function(e,t,i,n){R.Screens.showError(e,t,i,n)},r.prototype.hideError=function(e){R.Screens.hideError(e)},r.prototype.showPgpErrorByCode=function(e,t,i){var n=I.isNonEmptyArray(e.errors)?e.errors:[],o=I.isNonEmptyArray(e.notices)?e.notices:[],s=[],r=[],a="",l=!1,c=!0;if(_.each(_.union(n,o),function(e){if(2===e.length)switch(e[0]){case h.Enum.GenerateKeyError:a=I.i18n("OPENPGP/ERROR_GENERATE_KEY");break;case h.Enum.ImportKeyError:a=I.i18n("OPENPGP/ERROR_IMPORT_KEY");break;case h.Enum.ImportNoKeysFoundError:a=I.i18n("OPENPGP/ERROR_IMPORT_NO_KEY_FOUNDED");break;case h.Enum.PrivateKeyNotFoundError:case h.Enum.PrivateKeyNotFoundNotice:r.push(e[1]);break;case h.Enum.PublicKeyNotFoundError:c=!1,s.push(e[1]);break;case h.Enum.PublicKeyNotFoundNotice:s.push(e[1]);break;case h.Enum.KeyIsNotDecodedError:t===P.PgpAction.DecryptVerify?a=I.i18n("OPENPGP/ERROR_DECRYPT")+" "+I.i18n("OPENPGP/ERROR_KEY_NOT_DECODED",{USER:e[1]}):(t===P.PgpAction.Sign||t===P.PgpAction.EncryptSign)&&(a=I.i18n("OPENPGP/ERROR_SIGN")+" "+I.i18n("OPENPGP/ERROR_KEY_NOT_DECODED",{USER:e[1]}));break;case h.Enum.SignError:a=I.i18n("OPENPGP/ERROR_SIGN");break;case h.Enum.VerifyError:a=I.i18n("OPENPGP/ERROR_VERIFY");break;case h.Enum.EncryptError:a=I.i18n("OPENPGP/ERROR_ENCRYPT");break;case h.Enum.DecryptError:a=I.i18n("OPENPGP/ERROR_DECRYPT");break;case h.Enum.SignAndEncryptError:a=I.i18n("OPENPGP/ERROR_ENCRYPT_OR_SIGN");break;case h.Enum.VerifyAndDecryptError:a=I.i18n("OPENPGP/ERROR_DECRYPT_OR_VERIFY");break;case h.Enum.DeleteError:a=I.i18n("OPENPGP/ERROR_DELETE_KEY");break;case h.Enum.VerifyErrorNotice:a=I.i18n("OPENPGP/ERROR_VERIFY");break;case h.Enum.NoSignDataNotice:l=!0}}),s.length>0?(s=_.without(s,""),s.length>0?a=I.i18n("OPENPGP/ERROR_NO_PUBLIC_KEYS_FOR_USERS_PLURAL",{USERS:s.join(", ")},null,s.length):t===P.PgpAction.Verify&&(a=I.i18n("OPENPGP/ERROR_NO_PUBLIC_KEY_FOUND_FOR_VERIFY")),c&&""!==a&&(a+=" "+I.i18n("OPENPGP/ERROR_MESSAGE_WAS_NOT_VERIFIED"))):r.length>0&&(r=_.without(r,""),r.length>0?a=I.i18n("OPENPGP/ERROR_NO_PRIVATE_KEYS_FOR_USERS_PLURAL",{USERS:r.join(", ")},null,r.length):t===P.PgpAction.DecryptVerify&&(a=I.i18n("OPENPGP/ERROR_NO_PRIVATE_KEY_FOUND_FOR_DECRYPT"))),""===a&&!l){switch(t){case P.PgpAction.Generate:a=I.i18n("OPENPGP/ERROR_GENERATE_KEY");break;case P.PgpAction.Import:a=I.i18n("OPENPGP/ERROR_IMPORT_KEY");break;case P.PgpAction.DecryptVerify:a=I.i18n("OPENPGP/ERROR_DECRYPT");break;case P.PgpAction.Verify:a=I.i18n("OPENPGP/ERROR_VERIFY");break;case P.PgpAction.Encrypt:a=I.i18n("OPENPGP/ERROR_ENCRYPT");break;case P.PgpAction.EncryptSign:a=I.i18n("OPENPGP/ERROR_ENCRYPT_OR_SIGN");break;case P.PgpAction.Sign:a=I.i18n("OPENPGP/ERROR_SIGN")}a=i}return""!==a&&R.Api.showError(a),l},r.prototype.showErrorByCode=function(e,t){var i=e.ErrorCode,n=e.ErrorMessage||"";switch(""!==n&&(n=" ("+n+")"),i){default:t&&t.length>0?this.showError(t+n):""!==n&&this.showError(n);break;case P.Errors.AuthError:this.showError(I.i18n("WARNING/LOGIN_PASS_INCORRECT")+n);break;case P.Errors.DemoLimitations:this.showError(I.i18n("DEMO/WARNING_THIS_FEATURE_IS_DISABLED")+n);break;case P.Errors.Captcha:this.showError(I.i18n("WARNING/CAPTCHA_IS_INCORRECT")+n);break;case P.Errors.CanNotGetMessage:this.showError(I.i18n("MESSAGE/ERROR_MESSAGE_DELETED")+n);break;case P.Errors.NoRequestedMailbox:this.showError(t+" "+I.i18n("COMPOSE/ERROR_INVALID_ADDRESS",{ADDRESS:e.Mailbox})+n);break;case P.Errors.CanNotChangePassword:this.showError(I.i18n("WARNING/UNABLE_CHANGE_PASSWORD")+n);break;case P.Errors.AccountOldPasswordNotCorrect:this.showError(I.i18n("WARNING/CURRENT_PASSWORD_NOT_CORRECT")+n);break;case P.Errors.FetcherIncServerNotAvailable:this.showError(I.i18n("WARNING/FETCHER_SAVE_ERROR")+n);break;case P.Errors.FetcherLoginNotCorrect:this.showError(I.i18n("WARNING/FETCHER_SAVE_ERROR")+n);break;case P.Errors.HelpdeskUserNotExists:this.showError(I.i18n("HELPDESK/ERROR_FORGOT_NO_ACCOUNT")+n);break;case P.Errors.MailServerError:this.showError(I.i18n("WARNING/CANT_CONNECT_TO_SERVER")+n);break;case P.Errors.DataTransferFailed:this.showError(I.i18n("WARNING/DATA_TRANSFER_FAILED")+n);break;case P.Errors.NotDisplayedError:""!==n&&this.showError(n)}},a.prototype.setData=function(e,t){Data.setVar(e,t)},a.prototype.removeData=function(e){Data.setVar(e,"")},a.prototype.getData=function(e){return Data.getVar(e)},a.prototype.hasData=function(e){return Data.hasVar(e)},l.prototype.pgp=null,l.prototype.pgpKeyring=null,l.prototype.keys=[],l.prototype.getKeys=function(){return this.keys()},l.prototype.getKeysObservable=function(){return this.keys},l.prototype.reloadKeysFromStorage=function(){var e=[],t=this.pgpKeyring.getAllKeys();_.each(t,function(t){t&&t.primaryKey&&e.push(new c(t))}),this.keys(e)},l.prototype.convertToNativeKeys=function(e){return _.map(e,function(e){return e&&e.pgpKey?e.pgpKey:e})},l.prototype.cloneKey=function(e){var t=null;return e&&(t=this.pgp.key.readArmored(e.armor()),t&&!t.err&&t.keys&&t.keys[0]?(t=t.keys[0],t&&t.primaryKey||(t=null)):t=null),t},l.prototype.decryptKeyHelper=function(e,t,i,n){if(t)try{t.decrypt(I.pString(i)),t&&t.primaryKey&&t.primaryKey.isDecrypted||e.addError(h.Enum.KeyIsNotDecodedError,n||"")}catch(o){e.addExceptionMessage(o,h.Enum.KeyIsNotDecodedError,n||"")}else e.addError(h.Enum.KeyIsNotDecodedError,n||"")},l.prototype.verifyMessageHelper=function(e,t,i){var n=!1,o=null,s=[],r=[],a=[];if(i&&i.getSigningKeyIds)if(r=i.getSigningKeyIds(),r&&0<r.length)if(a=this.findKeysByEmails([t],!0),a&&0!==a.length){s=[];try{s=i.verify(this.convertToNativeKeys(a))}catch(l){e.addNotice(h.Enum.VerifyErrorNotice,t)}s&&0<s.length&&(o=_.find(s,function(e){return e&&e.keyid&&e.valid}),o&&o.keyid&&a&&a[0]&&o.keyid.toHex().toLowerCase()===a[0].getId()?n=!0:e.addNotice(h.Enum.VerifyErrorNotice,t))}else e.addNotice(h.Enum.PublicKeyNotFoundNotice,t);else e.addNotice(h.Enum.NoSignDataNotice);else e.addError(h.Enum.UnknownError);return n||e.hasNotices()||e.addNotice(h.Enum.VerifyErrorNotice),n},l.prototype.generateKey=function(e,t,i){var n=new h,o=null;try{o=this.pgp.generateKeyPair({userId:e,numBits:I.pInt(i),passphrase:I.trim(t)})}catch(s){n.addExceptionMessage(s)}if(o&&o.privateKeyArmored)try{this.pgpKeyring.privateKeys.importKey(o.privateKeyArmored),this.pgpKeyring.publicKeys.importKey(o.publicKeyArmored),this.pgpKeyring.store()}catch(s){n.addExceptionMessage(s,h.Enum.GenerateKeyError)}else n.addError(h.Enum.GenerateKeyError);return this.reloadKeysFromStorage(),n},l.prototype.splitKeys=function(e){var t=[],i=0,n=30,o=null,s=I.trim(e),r=/[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi;for(s=s.replace(/[\r\n]([a-zA-Z0-9]{2,}:[^\r\n]+)[\r\n]+([a-zA-Z0-9\/\\+=]{10,})/g,"\n$1---xyx---$2").replace(/[\n\r]+/g,"\n").replace(/---xyx---/g,"\n\n");;){if(o=r.exec(s),!o||0>n)break;o[0]&&o[1]&&o[2]&&o[1]===o[2]&&("PRIVATE"===o[1]||"PUBLIC"===o[1])&&(t.push([o[1],o[0]]),i++),n--}return t},l.prototype.importKeys=function(e){e=I.trim(e);var t=0,i=0,n=new h,o=null,s=[];if(!e)return n.addError(h.Enum.InvalidArgumentErrors);for(s=this.splitKeys(e),t=0;t<s.length;t++)if(o=s[t],"PRIVATE"===o[0])try{this.pgpKeyring.privateKeys.importKey(o[1]),i++}catch(r){n.addExceptionMessage(r,h.Enum.ImportKeyError,"private")}else if("PUBLIC"===o[0])try{this.pgpKeyring.publicKeys.importKey(o[1]),i++}catch(r){n.addExceptionMessage(r,h.Enum.ImportKeyError,"public")}return i>0?this.pgpKeyring.store():n.addError(h.Enum.ImportNoKeysFoundError),this.reloadKeysFromStorage(),n},l.prototype.getArmorInfo=function(e){e=I.trim(e);var t=0,i=0,n=null,o=[],s=null,r=[];if(!e)return!1;for(r=this.splitKeys(e),t=0;t<r.length;t++)if(s=r[t],"PRIVATE"===s[0])try{n=this.pgp.key.readArmored(s[1]),n&&!n.err&&n.keys&&n.keys[0]&&o.push(new c(n.keys[0])),i++}catch(a){o.push(null)}else if("PUBLIC"===s[0])try{n=this.pgp.key.readArmored(s[1]),n&&!n.err&&n.keys&&n.keys[0]&&o.push(new c(n.keys[0])),i++}catch(a){o.push(null)}return o},l.prototype.findKeyByID=function(e,t){t=!!t,e=e.toLowerCase();var i=_.find(this.keys(),function(i){var n=!1,o=null;return i&&t===i.isPublic()&&(o=i.pgpKey.getKeyIds(),o&&(n=_.find(o,function(t){return t&&t.toHex&&e===t.toHex().toLowerCase()}))),!!n});return i?i:null},l.prototype.findKeysByEmails=function(e,t,i){t=!!t;var n=[],o=this.keys();return _.each(e,function(e){var s=_.find(o,function(i){return i&&t===i.isPublic()&&e===i.getEmail()});s?n.push(s):i&&i.addError(t?h.Enum.PublicKeyNotFoundError:h.Enum.PrivateKeyNotFoundError,e)}),n},l.prototype.decryptAndVerify=function(e,t,i,n){var o=this,s=null,r=null,a=null,l=null,c=null,u=new h,p=[];if(s=this.pgp.message.readArmored(e),s&&s.decrypt)if(p=s.getEncryptionKeyIds(),p&&(a=null,r=null,_.each(p,function(e){r||(r=o.findKeyByID(e.toHex(),!1),r&&t!==r.getEmail()&&(r=null))}),r&&(a=r),a||_.each(p,function(e){a||(a=o.findKeyByID(e.toHex(),!1))})),a){if(l=this.cloneKey(this.convertToNativeKeys([a])[0]),this.decryptKeyHelper(u,l,n,a.getEmail()),l&&!u.hasErrors())try{c=s.decrypt(l)}catch(d){u.addExceptionMessage(d,h.Enum.DecryptError),c=null}c&&!u.hasErrors()&&(this.verifyMessageHelper(u,i,c),u.result=c.getText())}else u.addError(h.Enum.PrivateKeyNotFoundError);return u},l.prototype.verify=function(e,t){var i=null,n=new h;return i=this.pgp.cleartext.readArmored(e),i&&i.getText&&i.verify?(this.verifyMessageHelper(n,t,i),n.result=i.getText()):n.addError(h.Enum.CanNotReadMessage),n},l.prototype.encrypt=function(e,t){var i=new h,n=this.findKeysByEmails(t,!0,i);if(!i.hasErrors())try{i.result=this.pgp.encryptMessage(this.convertToNativeKeys(n),e)}catch(o){i.addExceptionMessage(o,h.Enum.EncryptError)}return i},l.prototype.sign=function(e,t,i){var n=new h,o=null,s=null,r=this.findKeysByEmails([t],!1,n);if(!n.hasErrors()&&(o=this.convertToNativeKeys(r)[0],s=this.cloneKey(o),this.decryptKeyHelper(n,s,i,t),s&&!n.hasErrors()))try{n.result=this.pgp.signClearMessage([s],e)}catch(a){n.addExceptionMessage(a,h.Enum.SignError,t)}return n},l.prototype.signAndEncrypt=function(e,t,i,n){var o=null,s=null,r=new h,a=this.findKeysByEmails([t],!1,r),l=this.findKeysByEmails(i,!0,r);if(!r.hasErrors()&&(o=this.convertToNativeKeys(a)[0],s=this.cloneKey(o),this.decryptKeyHelper(r,s,n,t),s&&!r.hasErrors()))try{r.result=this.pgp.signAndEncryptMessage(this.convertToNativeKeys(l),s,e)}catch(c){r.addExceptionMessage(c,h.Enum.SignAndEncryptError)}return r},l.prototype.deleteKey=function(e){var t=new h;if(e)try{this.pgpKeyring[e.isPrivate()?"privateKeys":"publicKeys"].removeForId(e.getFingerprint()),this.pgpKeyring.store()}catch(i){t.addExceptionMessage(i,h.Enum.DeleteError)}else t.addError(e?h.Enum.UnknownError:h.Enum.InvalidArgumentError);return this.reloadKeysFromStorage(),t},c.prototype.pgpKey=null,c.prototype.emailParts=null,c.prototype.user="",c.prototype.getId=function(){return this.pgpKey.primaryKey.getKeyId().toHex().toLowerCase()},c.prototype.getEmail=function(){return this.emailParts.email||this.user},c.prototype.getUser=function(){return this.user},c.prototype.getFingerprint=function(){return this.pgpKey.primaryKey.getFingerprint()},c.prototype.getBitSize=function(){return this.pgpKey.primaryKey.getBitSize()},c.prototype.getArmor=function(){return this.pgpKey.armor()},c.prototype.isPrivate=function(){return!!this.pgpKey.isPrivate()},c.prototype.isPublic=function(){return!this.isPrivate()},h.Enum={UnknownError:0,UnknownNotice:1,InvalidArgumentError:2,GenerateKeyError:10,ImportKeyError:20,ImportNoKeysFoundError:21,PrivateKeyNotFoundError:30,PublicKeyNotFoundError:31,KeyIsNotDecodedError:32,SignError:40,VerifyError:41,EncryptError:42,DecryptError:43,SignAndEncryptError:44,VerifyAndDecryptError:45,CanNotReadMessage:50,CanNotReadKey:51,DeleteError:60,PublicKeyNotFoundNotice:70,PrivateKeyNotFoundNotice:71,VerifyErrorNotice:72,NoSignDataNotice:73},h.prototype.result=!1,h.prototype.errors=null,h.prototype.notices=null,h.prototype.addError=function(e,t){return this.result=!1,this.errors=this.errors||[],this.errors.push([e||h.Enum.UnknownError,t||""]),this},h.prototype.addNotice=function(e,t){return this.notices=this.notices||[],this.notices.push([e||h.Enum.UnknownNotice,t||""]),this},h.prototype.addExceptionMessage=function(e,t,i){return e&&(this.result=!1,this.exceptions=this.exceptions||[],this.exceptions.push(""+(e.name||"unknown")+": "+(e.message||""))),I.isUnd(t)||this.addError(t,i),this},h.prototype.hasErrors=function(){return this.errors&&0<this.errors.length},h.prototype.hasNotices=function(){return this.notices&&0<this.notices.length},u.prototype.onShow=function(e,t,i,n){this.alertDesc(e),this.closeCallback=t||null,this.title(i||""),this.okButtonText(n||I.i18n("MAIN/BUTTON_OK"))},u.prototype.popupTemplate=function(){return"Popups_AlertPopupViewModel"},u.prototype.onEnterHandler=function(){this.close()},u.prototype.close=function(){I.isFunc(this.closeCallback)&&this.closeCallback(),this.closeCommand()},p.prototype.onShow=function(e,t,i,n,o){this.title(i||""),this.okButtonText(n||I.i18n("MAIN/BUTTON_OK")),this.cancelButtonText(o||I.i18n("MAIN/BUTTON_CANCEL")),I.isFunc(t)&&(this.fConfirmCallback=t,this.confirmDesc(e)),this.shown=!0},p.prototype.onHide=function(){this.shown=!1},p.prototype.popupTemplate=function(){return"Popups_ConfirmPopupViewModel"},p.prototype.onEnterHandler=function(){this.yesClick()},p.prototype.yesClick=function(){this.shown&&this.fConfirmCallback&&this.fConfirmCallback(!0),this.closeCommand()},p.prototype.noClick=function(){this.fConfirmCallback&&this.fConfirmCallback(!1),this.closeCommand()},p.prototype.onEscHandler=function(){this.noClick()},d.prototype.onShow=function(e,t){this.pgp=e,this.keyArmor(t||""),this.keyArmorFocused(!0),this.keys([]),this.hasExistingKeys(!1),""!==this.keyArmor()&&this.checkArmor()},d.prototype.popupTemplate=function(){return"Popups_ImportOpenPgpKeyPopupViewModel"},d.prototype.checkArmor=function(){var e=null,t=[],n=this.pgp,o=!1;""===this.keyArmor()?this.keyArmorFocused(!0):n&&(e=n.getArmorInfo(this.keyArmor()),I.isNonEmptyArray(e)&&_.each(e,function(e){if(e){var s=n.findKeyByID(e.getId(),e.isPublic()),r=null!==s,a=e.isPublic()?"OPENPGP/PUBLIC_KEY_ADD_INFO":"OPENPGP/PRIVATE_KEY_ADD_INFO";o=o||r,t.push({armor:e.getArmor(),email:e.user,id:e.getId(),addInfo:I.i18n(a,{LENGTH:e.getBitSize()}),needToImport:i.observable(!r),disabled:r})}}),0===t.length&&R.Api.showError(I.i18n("OPENPGP/ERROR_IMPORT_NO_KEY_FOUNDED")),this.keys(t),this.hasExistingKeys(o))},d.prototype.importKey=function(){var e=null,t=[];this.pgp&&(_.each(this.keys(),function(e){e.needToImport()&&t.push(e.armor)}),t.length>0?(e=this.pgp.importKeys(t.join("")),e&&e.result&&R.Api.showReport(I.i18n("OPENPGP/REPORT_KEY_SUCCESSFULLY_IMPORTED_PLURAL",{},null,t.length)),e&&!e.result&&R.Api.showPgpErrorByCode(e,P.PgpAction.Import,I.i18n("OPENPGP/ERROR_IMPORT_KEY")),this.closeCommand()):R.Api.showError(I.i18n("OPENPGP/ERROR_IMPORT_NO_KEY_SELECTED")))},f.prototype.onShow=function(e){this.folderName(""),this.folderName.focus(!0),this.folderName.error(""),I.isFunc(e)&&(this.fCallback=e)},f.prototype.popupTemplate=function(){return"Popups_FileStorage_FolderCreatePopupViewModel"},f.prototype.onOKClick=function(){if(this.folderName.error(""),this.fCallback){var e=this.fCallback(this.folderName());e?this.folderName.error(""+e):this.closeCommand()}else this.closeCommand()},f.prototype.onCancelClick=function(){this.closeCommand()},g.prototype.onShow=function(e){this.link(""),this.linkFocus(!0),I.isFunc(e)&&(this.fCallback=e),this.checkTimer=setTimeout(_.bind(this.checkUrl,this),2e3)},g.prototype.popupTemplate=function(){return"Popups_FileStorage_LinkCreatePopupViewModel"},g.prototype.checkUrl=function(){clearTimeout(this.checkTimer),this.link()!==this.linkPrev()&&(this.linkPrev(this.link()),R.Ajax.send({Action:"CheckUrl",Url:this.link()},this.onCheckUrlResponse,this)),this.checkTimer=setTimeout(_.bind(this.checkUrl,this),1e3)},g.prototype.onCheckUrlResponse=function(e){var t=new E;e.Result?(t.isPopupItem(!0),t.linkUrl(this.link()),t.fileName(e.Result.Name),t.size(e.Result.Size),t.allowDownload(!1),e.Result.Thumb&&(t.thumb(!0),t.thumbnailSrc(e.Result.Thumb)),this.fileItem(t),this.urlChecked(!0)):this.urlChecked(!1)},g.prototype.executeSave=function(){this.fCallback&&(this.fCallback(this.fileItem()),this.link(""),this.linkPrev(""),this.urlChecked(!1)),clearTimeout(this.checkTimer),this.closeCommand()},g.prototype.onCancelClick=function(){this.link(""),this.linkPrev(""),this.urlChecked(!1),clearTimeout(this.checkTimer),this.closeCommand()},g.prototype.onEscHandler=function(){this.onCancelClick()},m.prototype.onShow=function(e,t){this.item=e,this.item.nameForEdit(this.item.fileName()),this.name(this.item.nameForEdit()),this.name.focus(!0),this.name.error(""),I.isFunc(t)&&(this.fCallback=t)},m.prototype.popupTemplate=function(){return"Popups_FileStorage_RenamePopupViewModel"},m.prototype.onOKClick=function(){if(this.name.error(""),this.fCallback){this.item.nameForEdit(this.name());var e=this.fCallback(this.item);e?this.name.error(""+e):this.closeCommand()}else this.closeCommand()},m.prototype.onCancelClick=function(){this.closeCommand()},b.prototype.onShow=function(e){this.item=e,this.pub(""),R.Ajax.send({Action:"FilesCreatePublicLink",Account:N.Accounts.defaultId(),Type:e.storageType(),Path:e.path(),Name:e.fileName(),Size:e.size(),IsFolder:e.isFolder()?"1":"0"},this.onFilesCreatePublicLinkResponse,this)},b.prototype.onFilesCreatePublicLinkResponse=function(e){e.Result&&(this.pub(e.Result),this.pubFocus(!0),this.item.shared(!0))},b.prototype.popupTemplate=function(){return"Popups_FileStorage_SharePopupViewModel"},b.prototype.onOKClick=function(){this.closeCommand()},b.prototype.onFilesDeletePublicLinkResponse=function(){this.closeCommand()},b.prototype.onCancelSharingClick=function(){this.item&&(R.Ajax.send({Action:"FilesDeletePublicLink",Account:N.Accounts.defaultId(),Type:this.item.storageType(),Path:this.item.path(),Name:this.item.fileName()},this.onFilesDeletePublicLinkResponse,this),this.item.shared(!1))},y.prototype.fillDefaultFontName=function(){var e=I.pString(N.HtmlEditorDefaultFontName);""!==e&&(this.DefaultFontName=e)},y.prototype.fillDefaultFontSize=function(){var e=I.pInt(N.HtmlEditorDefaultFontSize);-1!==I.inArray(e,[2,3,5,7])&&(this.DefaultFontSize=e)},y.prototype.getSaveMailInSentItems=function(){var e=!0;switch(this.SaveMail){case P.SaveMail.Unchecked:e=!1;break;case P.SaveMail.Checked:case P.SaveMail.Hidden:e=!0}return e},y.prototype.getUseSaveMailInSentItems=function(){var e=!1;switch(this.SaveMail){case P.SaveMail.Unchecked:case P.SaveMail.Checked:e=!0;break;case P.SaveMail.Hidden:e=!1}return e},y.prototype.parse=function(e){var t=null;null!==e&&(this.IdUser=I.pInt(e.IdUser),this.MailsPerPage=I.pInt(e.MailsPerPage),this.ContactsPerPage=I.pInt(e.ContactsPerPage),this.AutoCheckMailInterval=I.pInt(e.AutoCheckMailInterval),this.DefaultTheme=I.pString(e.DefaultTheme),this.DefaultLanguage=I.pString(e.DefaultLanguage),this.DefaultLanguageShort=I.pString(e.DefaultLanguageShort),this.DefaultDateFormat=I.pString(e.DefaultDateFormat),this.defaultTimeFormat(I.pString(e.DefaultTimeFormat)),this.ThreadsEnabled=!!e.ThreadsEnabled,this.useThreads(!!e.UseThreads),this.SaveRepliedToCurrFolder=!!e.SaveRepliedMessagesToCurrentFolder,this.DesktopNotifications=!!e.DesktopNotifications,this.AllowChangeInputDirection=!!e.AllowChangeInputDirection,this.AllowCompose=!!e.AllowCompose,this.AllowReply=!!e.AllowReply,this.AllowForward=!!e.AllowForward,this.SaveMail=I.pInt(e.SaveMail),this.AllowFetcher=!!e.AllowFetcher,this.OutlookSyncEnable=!!e.OutlookSyncEnable,this.MobileSyncEnable=!!e.MobileSyncEnable,this.ShowPersonalContacts=!!e.ShowPersonalContacts,this.ShowGlobalContacts=!!e.ShowGlobalContacts,this.ShowContacts=this.ShowPersonalContacts||this.ShowGlobalContacts,this.IsFilesSupported=!!e.IsFilesSupported&&!O,this.IsFilesSupported=!!e.IsFilesSupported&&!O,this.filesEnable(!!e.FilesEnable&&!O),this.IsHelpdeskSupported=!!e.IsHelpdeskSupported&&!O,this.IsHelpdeskAgent=!!e.IsHelpdeskAgent,this.LastLogin=I.pInt(e.LastLogin),this.AllowCalendar=!!e.AllowCalendar&&!O,this.CalendarSharing=!!e.CalendarSharing,this.CalendarAppointments=!!e.CalendarAppointments,this.IsDemo=!!e.IsDemo,this.AllowVoice=!!e.AllowVoice,this.SipRealm=e.SipRealm,this.SipWebsocketProxyUrl=e.SipWebsocketProxyUrl,this.SipOutboundProxyUrl=e.SipOutboundProxyUrl,this.SipCallerID=e.SipCallerID,this.SipImpi=e.SipImpi,this.SipImpu=e.SipImpu,this.SipPassword=e.SipPassword,this.VoiceProvider=e.VoiceProvider,this.AllowHelpdeskNotifications=e.AllowHelpdeskNotifications,this.IsCollaborationSupported=!!e.IsCollaborationSupported,this.AllowFilesSharing=!!e.AllowFilesSharing,this.enableOpenPgp(!!e.EnableOpenPgp),this.AllowAutosaveInDrafts=!!e.AllowAutosaveInDrafts&&(N.App?N.App.AutoSave:!1),t=e.Calendar,t&&(this.CalendarShowWeekEnds=!!t.ShowWeekEnds,this.CalendarShowWorkDay=!!t.ShowWorkDay,this.CalendarWorkDayStarts=I.pInt(t.WorkDayStarts),this.CalendarWorkDayEnds=I.pInt(t.WorkDayEnds),this.CalendarWeekStartsOn=I.pInt(t.WeekStartsOn),this.CalendarDefaultTab=I.pInt(t.DefaultTab)),this.SocialAccounts(e.SocialAccounts))
},y.prototype.updateCommonSettings=function(e,t,i,n,o,s,r,a,l,c,h){var u=this.defaultTimeFormat()!==r;this.MailsPerPage=e,this.ContactsPerPage=t,this.AutoCheckMailInterval=i,R.MailCache.setAutocheckmailTimer(),this.DefaultTheme=n,this.DefaultLanguage=o,this.DefaultDateFormat=s,this.defaultTimeFormat(r),this.useThreads("1"===a),this.SaveRepliedToCurrFolder="1"===l,this.AllowChangeInputDirection="1"===h,this.DesktopNotifications="1"===c,u&&R.nowMoment.valueHasMutated()},y.prototype.updateOpenPgpSettings=function(e,t){this.enableOpenPgp("1"===e),this.AllowAutosaveInDrafts="1"===t},y.prototype.updateCalendarSettings=function(e,t,i,n,o,s){this.CalendarShowWeekEnds=e,this.CalendarShowWorkDay=t,this.CalendarWorkDayStarts=i,this.CalendarWorkDayEnds=n,this.CalendarWeekStartsOn=o,this.CalendarDefaultTab=s},y.prototype.updateHelpdeskSettings=function(e){this.AllowHelpdeskNotifications=e},y.prototype.onSyncSettingsResponse=function(e){e.Result?(this.mobileSync(e.Result.Mobile),this.outlookSync(e.Result.Outlook)):R.Api.showErrorByCode(e)},y.prototype.requestSyncSettings=function(){(null===this.mobileSync()||null===this.outlookSync())&&R.Ajax.send({Action:"SyncSettings"},this.onSyncSettingsResponse,this)},v.prototype.parse=function(e){this.iTimeStampInUTC=e,this.oMoment=moment.unix(this.iTimeStampInUTC)},v.prototype.setDate=function(e,t,i){this.oMoment=moment([e,t,i])},v.prototype.getTimeFormat=function(){return N.User.defaultTimeFormat()===P.TimeFormat.F24?"HH:mm":"hh:mm A"},v.prototype.getFullDate=function(){return this.oMoment?this.oMoment.format("ddd, MMM D, YYYY, "+this.getTimeFormat()):""},v.prototype.getMidDate=function(){return this.getShortDate(!0)},v.prototype.getShortDate=function(e){var t="",i=null;return this.oMoment&&(i=moment(),i.format("L")===this.oMoment.format("L")?t=this.oMoment.format(this.getTimeFormat()):(t=i.clone().subtract("days",1).format("L")===this.oMoment.format("L")?I.i18n("DATETIME/YESTERDAY"):this.oMoment.format(i.year()===this.oMoment.year()?"MMM D":"MMM D, YYYY"),(I.isUnd(e)?1:!e)||(t+=", "+this.oMoment.format(this.getTimeFormat())))),t},v.prototype.getDate=function(){return this.oMoment?this.oMoment.format("ddd, MMM D, YYYY"):""},v.prototype.getTime=function(){return this.oMoment?this.oMoment.format(this.getTimeFormat()):""},v.prototype.convertDate=function(e){var t=I.getDateFormatForMoment(N.User.DefaultDateFormat)+" "+this.getTimeFormat();return moment(1e3*e).format(t)},v.prototype.getTimeStampInUTC=function(){return this.iTimeStampInUTC},E.prototype.dataObjectName="",E.prototype.isVisibleViewLink=function(){return this.uploaded()&&!this.uploadError()&&this.isViewMimeType()},E.prototype.parse=function(e,t){e["@Object"]===this.dataObjectName&&(this.fileName(I.pString(e.FileName)),this.tempName(I.pString(e.TempName)),""===this.tempName()&&this.tempName(this.fileName()),this.type(I.pString(e.MimeType)),this.size(e.EstimatedSize?parseInt(e.EstimatedSize,10):parseInt(e.SizeInBytes,10)),this.content(I.pString(e.Content)),this.thumb(!!e.Thumb),this.hash(I.pString(e.Hash)),this.accountId(t),this.allowExpandSubFiles(!!e.Expand),this.iframedView(!!e.Iframed),this.uploadUid(this.hash()),this.uploaded(!0),I.isFunc(this.additionalParse)&&this.additionalParse(e))},E.prototype.getInThumbQueue=function(e){this.thumbnailSessionUid(e),this.thumb()&&(!this.linked||this.linked&&!this.linked())&&I.thumbQueue(this.thumbnailSessionUid(),this.thumbnailLink(),this.thumbnailSrc)},E.prototype.downloadFile=function(e){this.allowDownload()&&(e&&e.Api&&e.Api.downloadByUrl||(e=R),e&&this.downloadLink().length>0&&"#"!==this.downloadLink()&&e.Api.downloadByUrl(this.downloadLink()))},E.prototype.onExpandAttachmentResponse=function(e){this.subFiles([]),I.isNonEmptyArray(e.Result)&&(_.each(e.Result,_.bind(function(e){var t=this.getInstance();e["@Object"]=this.dataObjectName,t.parse(e,this.accountId()),this.subFiles.push(t)},this)),this.subFilesLoaded(!0),this.subFilesCollapsed(!0)),this.subFilesStartedLoading(!1)},E.prototype.expandFile=function(){this.subFilesLoaded()?this.subFilesCollapsed(!0):(this.subFilesStartedLoading(!0),R.Ajax.send({Action:"ExpandAttachment",RawKey:this.hash()},this.onExpandAttachmentResponse,this))},E.prototype.collapseFile=function(){this.subFilesCollapsed(!1)},E.prototype.getInstance=function(){return new E},E.prototype.importFile=function(){var e=this.content(),t=_.bind(function(t){t&&R.Screens.showPopup(d,[t,e])},this);R.Api.pgp(t,N.User.IdUser)},E.prototype.viewFile=function(){this.viewCommonFile()},E.prototype.viewCommonFile=function(){var e=null,t=I.getAppPath()+this.viewLink();this.visibleViewLink()&&this.viewLink().length>0&&"#"!==this.viewLink()&&(this.isLink()&&(t=this.linkUrl()),e=this.iframedView()?I.WindowOpener.openTab(t):I.WindowOpener.open(t,t,!1),e&&e.focus())},E.prototype.eventDragStart=function(e,t){var i=t.originalEvent||t;return e&&i&&i.dataTransfer&&i.dataTransfer.setData&&i.dataTransfer.setData("DownloadURL",this.generateTransferDownloadUrl()),!0},E.prototype.generateTransferDownloadUrl=function(){var e=this.downloadLink();return"http"!==e.substr(0,4)&&(e=t.location.protocol+"//"+t.location.host+t.location.pathname+e),this.type()+":"+this.fileName()+":"+e},E.prototype.onUploadSelect=function(e,t){this.fileName(t.FileName),this.type(t.Type),this.size(I.pInt(t.Size)),this.uploadUid(e),this.uploaded(!1),this.visibleSpinner(!1),this.statusText(""),this.progressPercent(0),this.visibleProgress(!1)},E.prototype.onUploadStart=function(){this.visibleSpinner(!0),this.visibleProgress(!0)},E.prototype.onUploadProgress=function(e,t){t>0&&(this.progressPercent(Math.ceil(e/t*100)),this.visibleProgress(!0))},E.prototype.onUploadComplete=function(e,t,i){var n=!t||!i||i.Error||!1,o=I.i18n(i&&"size"===i.Error?"COMPOSE/UPLOAD_ERROR_SIZE":"COMPOSE/UPLOAD_ERROR_UNKNOWN");this.visibleSpinner(!1),this.progressPercent(0),this.visibleProgress(!1),this.uploaded(!0),this.uploadError(n),this.statusText(n?o:I.i18n("COMPOSE/UPLOAD_COMPLETE")),n||(this.fillDataAfterUploadComplete(i,e),setTimeout(function(e){return function(){e.statusText("")}}(this),3e3))},E.prototype.fillDataAfterUploadComplete=function(){},E.prototype.onImageLoad=function(){this.thumb()&&!this.thumbnailLoaded()&&(this.thumbnailLoaded(!0),I.thumbQueue(this.thumbnailSessionUid()))},I.extend(S,E),S.prototype.getInstance=function(){return new S},S.prototype.parse=function(e,t){var i=new v;this.isFolder(!!e.IsFolder),this.isLink(!!e.IsLink),this.fileName(I.pString(e.Name)),this.id(I.pString(e.Id)),this.path(I.pString(e.Path)),this.fullPath(I.pString(e.FullPath)),this.storageType(I.pInt(e.Type)),this.shared(!!e.Shared),this.isExternal(!!e.IsExternal),this.iframedView(!!e.Iframed),this.isLink()&&(this.linkUrl(I.pString(e.LinkUrl)),this.linkType(I.pInt(e.LinkType))),this.isFolder()||(this.size(I.pInt(e.Size)),i.parse(e.LastModified),this.lastModified(i.getShortDate()),this.owner(I.pString(e.Owner)),this.thumb(!!e.Thumb),this.thumbnailExternalLink(I.pString(e.ThumbnailLink)),this.hash(I.pString(e.Hash)),this.publicHash(t)),this.thumb()&&""===this.thumbnailExternalLink()&&I.thumbQueue(this.thumbnailSessionUid(),this.thumbnailLink(),this.thumbnailSrc),this.content(I.pString(e.Content))},S.prototype.onUploadSelectOwn=function(e,t,i,n,o,s){var r=new v,a=new Date;this.onUploadSelect(e,t),r.parse(a.getTime()/1e3),this.fileName(i),this.lastModified(r.getShortDate()),this.owner(n),this.path(o),this.storageType(s)},k.prototype.__name="CFileStorageViewModel",k.prototype.onApplyBindings=function(t){this.selector.initOnApplyBindings(".items_sub_list .item",".items_sub_list .selected.item",".items_sub_list .item .custom_checkbox",e(".panel.files .items_list",t),e(".panel.files .items_list .files_scroll.scroll-inner",t)),this.initUploader(),this.hotKeysBind()},k.prototype.hotKeysBind=function(){var t=R.Screens.currentScreen()===P.Screens.FileStorage;e(document).on("keydown",_.bind(function(e){t&&e&&e.keyCode===P.Key.s&&this.selector.useKeyboardKeys()&&!I.isTextFieldFocused()&&(e.preventDefault(),this.isSearchFocused(!0))},this))},k.prototype.initUploader=function(){var e=this;this.uploaderButton()&&this.uploaderArea()&&(this.oJua=new Jua({action:"?/Upload/File/",name:"jua-uploader",queueSize:2,clickElement:this.uploaderButton(),dragAndDropElement:this.uploaderArea(),disableAjaxUpload:this.isPublic?!0:!1,disableFolderDragAndDrop:this.isPublic?!0:!1,disableDragAndDrop:this.isPublic?!0:!1,hidden:{Token:function(){return N.Token},AccountID:function(){return N.Accounts.currentId()},AdditionalData:function(t){return JSON.stringify({Type:e.storageType(),SubPath:t&&!I.isUnd(t.Folder)?t.Folder:"",Path:e.dropPath()})}}}),this.oJua.on("onProgress",_.bind(this.onFileUploadProgress,this)).on("onSelect",_.bind(this.onFileUploadSelect,this)).on("onStart",_.bind(this.onFileUploadStart,this)).on("onDrop",_.bind(this.onDrop,this)).on("onComplete",_.bind(this.onFileUploadComplete,this)).on("onBodyDragEnter",_.bind(this.bDragActive,this,!0)).on("onBodyDragLeave",_.bind(this.bDragActive,this,!1)))},k.prototype.onFileUploadSelect=function(e,t){if(N.App.FileSizeLimit>0&&t.Size/1048576>N.App.FileSizeLimit)return R.Screens.showPopup(u,[I.i18n("FILESTORAGE/ERROR_SIZE_LIMIT",{SIZE:N.App.FileSizeLimit})]),!1;if(""===this.searchPattern()){var i=new S,n=t.FileName,o=I.getFileExtension(n),s=I.getFileNameWithoutExtension(n),r=0,a=N.Accounts.getDefault();for(""!==o&&(o="."+o);!I.isUnd(this.getFileByName(n));)n=s+"_"+r+o,r++;i.onUploadSelectOwn(e,t,n,a.email(),this.path(),this.storageType()),this.uploadingFiles.push(i)}},k.prototype.onFileUploadStart=function(e){var t=this.getUploadFileByUid(e);t&&t.onUploadStart()},k.prototype.onFileUploadProgress=function(e,t,i){if(""===this.searchPattern()){var n=this.getUploadFileByUid(e);n&&n.onUploadProgress(t,i)}},k.prototype.onFileUploadComplete=function(e,t,i){if(""===this.searchPattern()){var n=this.getUploadFileByUid(e);n&&(n.onUploadComplete(e,t,i),this.deleteUploadFileByUid(e),n.uploadError()?(this.uploadError(!0),R.Api.showError(n.statusText())):(this.files.push(n),0===this.uploadingFiles().length&&R.Api.showReport(I.i18n("COMPOSE/UPLOAD_COMPLETE")))),this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()),this.searchPattern(),!1)}},k.prototype.onDrop=function(e,t){if(!this.isPublic)if(t&&t.target&&""===this.searchPattern()){var n=i.dataFor(t.target);n&&n instanceof S&&n.isFolder()&&this.dropPath(n.fullPath())}else R.Api.showReport(I.i18n("FILESTORAGE/INFO_CANNOT_UPLOAD_SEARCH_RESULT"))},k.prototype.filesDrop=function(e,t,i){if(!this.isPublic&&e&&t){var n=this,o="",s=e.fullPath(),r=t.ctrlKey?"FilesCopy":"FilesMove",a=[],l=[];(this.path()!==s&&this.storageType()===e.storageType()||this.storageType()!==e.storageType())&&(e.recivedAnim(!0),I.uiDropHelperAnim(t,i),a=this.selector.listCheckedAndSelected(),l=_.map(a,function(e){return t.ctrlKey||(e.isFolder()?n.deleteFolderByName(e.fileName()):n.deleteFileByName(e.id())),o=e.path(),{Name:e.id(),IsFolder:e.isFolder()}}),R.Ajax.send({Action:r,FromType:this.storageType(),ToType:e.storageType(),FromPath:o,ToPath:s,Files:JSON.stringify(l)},this.onFilesMoveResponse,this))}},k.prototype.onFilesMoveResponse=function(){this.getQuota(this.storageType())},k.prototype.dragAndDropHelper=function(t){t&&t.checked(!0);var i=I.draggableMessages(),n=this.selector.listCheckedAndSelected(),o=n.length,s=0,r=0,a="";return _.each(n,function(e){e.isFolder()?r++:s++},this),0!==s&&0!==r?a=I.i18n("FILESTORAGE/DRAG_ITEMS_TEXT_PLURAL",{COUNT:o},null,o):0===s?a=I.i18n("FILESTORAGE/DRAG_FOLDERS_TEXT_PLURAL",{COUNT:r},null,r):0===r&&(a=I.i18n("FILESTORAGE/DRAG_TEXT_PLURAL",{COUNT:s},null,s)),e(".count-text",i).text(a),i},k.prototype.onItemDelete=function(){this.executeDelete()},k.prototype.onEnter=function(e){this.onItemDblClick(e)},k.prototype.onItemDblClick=function(e){e&&(e.isFolder()?this.getFiles(this.storageType(),e):e.isViewable()?e.viewFile():e.downloadFile())},k.prototype.onFilesResponse=function(e,t){if(e.Result){var i=[],n=[],o=Date.now().toString();e.Result.Quota&&(this.quota(e.Result.Quota[0]+e.Result.Quota[1]),this.used(e.Result.Quota[0])),_.each(e.Result.Items,function(e){var t=(new S).allowDrag(!0).allowSelect(!0).allowCheck(!0).allowDelete(!0).allowUpload(!0).allowSharing(!0).allowHeader(!0).allowDownload(!1).isPopupItem(this.isPopup);t.parse(e,this.publicHash),t.getInThumbQueue(o),t.isFolder()?i.push(t):n.push(t)},this),(this.isPublic||t.Type===this.storageType())&&(this.folders(i),this.files(n)),this.loading(!1),this.loadedFiles(!0),clearTimeout(this.timerId)}},k.prototype.onQuotaResponse=function(e){e.Result&&e.Result.Quota&&(this.quota(e.Result.Quota[0]+e.Result.Quota[1]),this.used(e.Result.Quota[0]))},k.prototype.onFilesDeleteResponse=function(e){e.Result?this.expungeFileItems():this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()),this.searchPattern())},k.prototype.executeRename=function(){var e=this.selector.listCheckedAndSelected();!this.isPublic&&e[0]&&R.Screens.showPopup(m,[e[0],_.bind(this.renameItem,this)])},k.prototype.executeDownload=function(){var e=this.selector.listCheckedAndSelected();e[0]&&!e[0].isFolder()&&e[0].downloadFile()},k.prototype.executeShare=function(){var e=this.selector.listCheckedAndSelected();!this.isPublic&&e[0]&&R.Screens.showPopup(b,[e[0]])},k.prototype.executeSend=function(){var e=this.selector.listCheckedAndSelected(),t=_.filter(e,function(e){return!e.isFolder()},this);t.length>0&&R.Routing.goDirectly(R.Links.compose(),["file",t])},k.prototype.onShareIconClick=function(e){e&&R.Screens.showPopup(b,[e])},k.prototype.renameItem=function(e){var t=I.trim(e.nameForEdit());return I.validateFileOrFolderName(t)?(R.Ajax.send({Action:"FilesRename",Type:this.storageType(),Path:e.path(),Name:e.id(),NewName:t},this.onFilesRenameResponse,this),""):I.i18n(e.isFolder()?"FILESTORAGE/INVALID_FOLDER_NAME":"FILESTORAGE/INVALID_FILE_NAME")},k.prototype.onFilesRenameResponse=function(){this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()),this.searchPattern())},k.prototype.executeDelete=function(){var e=this.selector.listCheckedAndSelected();!this.isPublic&&e&&e.length>0&&R.Screens.showPopup(p,[I.i18n("FILESTORAGE/CONFIRMATION_DELETE"),_.bind(this.deleteItems,this,e)])},k.prototype.onShow=function(){this.loaded(!0),this.getStorages(),this.selector.useKeyboardKeys(!0),this.oJua&&this.oJua.setDragAndDropEnabledStatus(!0)},k.prototype.onHide=function(){this.selector.useKeyboardKeys(!1),this.oJua&&this.oJua.setDragAndDropEnabledStatus(!1)},k.prototype.getQuota=function(e){R.Ajax.send({Action:"FilesQuota",Type:e},this.onQuotaResponse,this)},k.prototype.getStorageByType=function(e){return _.find(this.storages(),function(t){return t.storageType()===e})},k.prototype.getStorages=function(){this.isPublic?this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex())):(this.getStorageByType(P.FileStorageType.Personal)||this.storages.push((new S).isFolder(!0).storageType(P.FileStorageType.Personal).displayName(I.i18n("FILESTORAGE/TAB_PERSONAL_FILES"))),this.IsCollaborationSupported&&(this.getStorageByType(P.FileStorageType.Corporate)||this.storages.push((new S).isFolder(!0).storageType(P.FileStorageType.Corporate).displayName(I.i18n("FILESTORAGE/TAB_CORPORATE_FILES"))),this.AllowFilesSharing&&(this.getStorageByType(P.FileStorageType.Shared)||this.storages.push((new S).isFolder(!0).storageType(P.FileStorageType.Shared).displayName(I.i18n("FILESTORAGE/TAB_SHARED_FILES"))))),this.isPopup?this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex())):this.getExternalFileStorages())},k.prototype.getExternalFileStorages=function(){R.Ajax.send({Action:"ExternalFileStorages"},this.onExternalStoragesResponse,this)},k.prototype.onExternalStoragesResponse=function(e){e.Result&&(_.each(e.Result,function(e){this.getStorageByType(e.Type)||this.storages.push((new S).isExternal(!0).isFolder(!0).storageType(e.Type).displayName(e.DisplayName))},this),this.expungeExternalStorages(_.map(e.Result,function(e){return e.Type},this))),this.getStorageByType(this.storageType())||this.storageType(P.FileStorageType.Personal),this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()))},k.prototype.getFiles=function(e,t,i,n){var o=this,s=this.storageType(),r=this.iPathIndex(),a=(new S).isFolder(!0).storageType(e);return this.isPublic?this.getFilesPub(t):(this.storageType(e),o.loadedFiles(!1),(I.isUnd(n)||!I.isUnd(n)&&n)&&(this.timerId=setTimeout(function(){o.loadedFiles()||(o.folders([]),o.files([]),o.loading(!0))},1500)),this.searchPattern(I.isUnd(i)?"":I.pString(i)),I.isUnd(t)||""===t.id()?(this.pathItems.removeAll(),a.displayName(this.rootPath())):a=t,this.pathItems.push(a),this.iPathIndex(this.pathItems().length-1),(r!==this.iPathIndex()||s!==this.storageType())&&(this.folders([]),this.files([])),void R.Ajax.sendExt({Action:"Files",Type:e,Path:this.path(),Pattern:this.searchPattern()},this.onFilesResponse,this))},k.prototype.getFilesPub=function(e){var t=this.iPathIndex(),i=(new S).isFolder(!0);I.isUnd(e)||""===e.id()?(this.pathItems.removeAll(),i.displayName(this.rootPath())):i=e,this.pathItems.push(i),this.iPathIndex(this.pathItems().length-1),t!==this.iPathIndex()&&(this.folders([]),this.files([])),R.Ajax.sendExt({Action:"FilesPub",Hash:N.FileStoragePubHash,Path:this.path()},this.onFilesResponse,this)},k.prototype.deleteItems=function(e,t){if(t&&0<e.length){var i=_.map(e,function(e){return e.deleted(!0),{Path:e.path(),Name:e.id()}});R.Ajax.send({Action:"FilesDelete",Type:this.storageType(),Path:this.path(),Items:JSON.stringify(i)},this.onFilesDeleteResponse,this)}},k.prototype.getPathItemByIndex=function(e){var t=this.pathItems()[e],i=(new S).fileName(this.rootPath()).id("");return this.pathItems(this.pathItems().slice(0,e)),t&&!this.isPublic&&(i=t),i},k.prototype.getFullPathByIndex=function(e){var t=_.map(this.pathItems().slice(0,e),function(e){return e.fileName()});return t.join("/")},k.prototype.getFileByName=function(e){return _.find(this.files(),function(t){return t.id()===e})},k.prototype.deleteFileByName=function(e){this.files(_.filter(this.files(),function(t){return t.id()!==e}))},k.prototype.deleteFolderByName=function(e){this.folders(_.filter(this.folders(),function(t){return t.fileName()!==e}))},k.prototype.expungeFileItems=function(){this.folders(_.filter(this.folders(),function(e){return!e.deleted()},this)),this.files(_.filter(this.files(),function(e){return!e.deleted()},this))},k.prototype.expungeExternalStorages=function(e){this.storages(_.filter(this.storages(),function(t){return!t.isExternal()||_.include(e,t.storageType())},this))},k.prototype.deleteStorageByType=function(e){this.storages(_.filter(this.storages(),function(t){return t.storageType()!==e}))},k.prototype.getUploadFileByUid=function(e){return _.find(this.uploadingFiles(),function(t){return t.uploadUid()===e})},k.prototype.deleteUploadFileByUid=function(e){this.uploadingFiles(_.filter(this.uploadingFiles(),function(t){return t.uploadUid()!==e}))},k.prototype.getUploadingFiles=function(){var e=[],t=this.uploadingFiles(),i=this;return I.isUnd(t)||(e=_.filter(t,function(e){return e.path()===i.path()&&e.storageType()===i.storageType()})),e},k.prototype.onCancelUpload=function(e){this.oJua&&this.oJua.cancel(e),this.deleteUploadFileByUid(e)},k.prototype.onCreateFolderResponse=function(){this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()))},k.prototype.createFolder=function(e){return e=I.trim(e),I.validateFileOrFolderName(e)?(R.Ajax.send({Action:"FilesFolderCreate",Type:this.storageType(),Path:this.path(),FolderName:e},this.onCreateFolderResponse,this),""):I.i18n("FILESTORAGE/INVALID_FOLDER_NAME")},k.prototype.onCreateFolderClick=function(){R.Screens.showPopup(f,[_.bind(this.createFolder,this)])},k.prototype.onCreateLinkResponse=function(){this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()))},k.prototype.createLink=function(e){R.Ajax.send({Action:"FilesLinkCreate",Type:this.storageType(),Path:this.path(),Link:e.linkUrl(),Name:e.fileName()},this.onCreateLinkResponse,this)},k.prototype.onCreateLinkClick=function(){var e=_.bind(this.createLink,this);R.Screens.showPopup(g,[e])},k.prototype.onSearch=function(){this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()),this.searchPattern())},k.prototype.clearSearch=function(){this.getFiles(this.storageType(),this.getPathItemByIndex(this.iPathIndex()))},A.prototype.showLoading=function(e){this.loadingMessage(e&&""!==e?e:I.i18n("MAIN/LOADING")),this.loadingVisible(!0),_.defer(_.bind(function(){this.loadingHidden(!1)},this))},A.prototype.hideLoading=function(){this.loadingHidden(!0),setTimeout(_.bind(function(){this.loadingHidden()&&this.loadingVisible(!1)},this),this.iAnimationDuration)},A.prototype.showReport=function(e,t){var i=this;t=t||this.iReportDuration,e&&""!==e?(this.reportMessage(e),this.reportVisible(!0),_.defer(function(){i.reportHidden(!1)}),clearTimeout(this.iReportTimeout),this.iReportTimeout=setTimeout(function(){i.reportHidden(!0),setTimeout(function(){i.reportHidden()&&i.reportVisible(!1)},this.iAnimationDuration)},t)):(this.reportHidden(!0),this.reportVisible(!1))},A.prototype.showError=function(e,t,i,n){e&&""!==e?(this.gray(!!n),this.errorMessage(e),this.isHtmlError(t),this.errorVisible(!0),_.defer(_.bind(function(){this.errorHidden(!1)},this)),clearTimeout(this.iErrorTimeout),i||(this.iErrorTimeout=setTimeout(_.bind(function(){this.selfHideError()},this),this.iErrorDuration))):this.selfHideError()},A.prototype.selfHideError=function(){this.errorHidden(!0),setTimeout(_.bind(function(){this.errorHidden()&&this.errorVisible(!1)},this),this.iAnimationDuration)},A.prototype.hideError=function(e){e=I.isUnd(e)?!1:!!e,e===this.gray()&&this.selfHideError()},T.prototype.initScreens=function(){},T.prototype.initLayout=function(){},T.prototype.init=function(){this.initScreens(),this.initLayout(),e("#pSevenContent").addClass("single_mode"),_.defer(function(){N.SingleMode||e("#pSevenContent").removeClass("single_mode")}),this.informationScreen(this.showNormalScreen(P.Screens.Information))},T.prototype.getCurrentScreenModel=function(){var e=this.oScreens[this.currentScreen()],t="undefined"!=typeof e?e.Model:null;return t},T.prototype.showCurrentScreen=function(e,t){var i=this.oScreens[this.currentScreen()],n="undefined"!=typeof i?i.Model:null;this.currentScreen()!==e&&(n&&i.bInitialized&&n.hideViewModel(),this.currentScreen(e)),this.showNormalScreen(e,t),this.resizeAll()},T.prototype.showNormalScreen=function(e,t){var i=e,n=this.oScreens[i];return n&&(n.bInitialized="boolean"!=typeof n.bInitialized?!1:n.bInitialized,n.bInitialized||(n.Model=this.initViewModel(n.Model,n.TemplateName),n.bInitialized=!0),n.Model.showViewModel(t)),n?n.Model:null},T.prototype.initViewModel=function(t,n){var o=null,s=null;return o=new t,s=e('div[data-view-model="'+n+'"]').attr("data-bind","template: {name: '"+n+"'}").hide(),o.$viewModel=s,o.bShown=!1,o.showViewModel=function(e){this.$viewModel.show(),"function"==typeof this.onRoute&&this.onRoute(e),this.bShown||("function"==typeof this.onShow&&this.onShow(e),D.runPluginHook&&this.__name&&D.runPluginHook("view-model-on-show",[this.__name,this]),this.bShown=!0)},o.hideViewModel=function(){this.$viewModel.hide(),"function"==typeof this.onHide&&this.onHide(),this.bShown=!1},i.applyBindings(o,s[0]),"function"==typeof o.onApplyBindings&&o.onApplyBindings(s),o},T.prototype.showPopup=function(t,n){if(t){if(!t.__builded){var o=null,s=new t,r=s.popupTemplate?s.popupTemplate():"";""!==r&&(o=e('div[data-view-model="'+r+'"]').attr("data-bind","template: {name: '"+r+"'}").removeClass("visible").hide(),o&&1===o.length&&(s.visibility=i.observable(!1),t.__builded=!0,t.__vm=s,s.$viewModel=o,t.__dom=o,s.showViewModel=I.createCommand(s,function(){R&&R.Screens&&R.Screens.showPopup(t)}),s.closeCommand=I.createCommand(s,function(){R&&R.Screens&&R.Screens.hidePopup(t)}),i.applyBindings(s,o[0]),I.delegateRun(s,"onApplyBindings",[o])))}t.__vm&&t.__dom&&(t.__dom.show(),_.delay(function(){t.__dom.addClass("visible")},50),t.__vm.visibility(!0),I.delegateRun(t.__vm,"onShow",n),this.popupVisibility(!0),this.popups.push(t),this.keyupPopupBinded=_.bind(this.keyupPopup,this,t.__vm),e(document).on("keyup",this.keyupPopupBinded))}},T.prototype.keyupPopup=function(e,i){if(i){var n=t.parseInt(i.keyCode,10);P.Key.Esc===n&&(e.onEscHandler?e.onEscHandler():e.closeCommand()),P.Key.Enter!==n&&P.Key.Space!==n||!e.onEnterHandler||e.onEnterHandler()}},T.prototype.hidePopup=function(t){t&&t.__vm&&t.__dom&&(this.keyupPopupBinded&&(e(document).off("keyup",this.keyupPopupBinded),this.keyupPopupBinded=void 0),t.__dom.removeClass("visible").hide(),t.__vm.visibility(!1),I.delegateRun(t.__vm,"onHide"),this.popupVisibility(!1),this.popups=_.without(this.popups,t))},T.prototype.hideAllPopup=function(){_.each(this.popups,function(e){this.hidePopup(e)},this)},T.prototype.showLoading=function(e){this.informationScreen()&&this.informationScreen().showLoading(e)},T.prototype.hideLoading=function(){this.informationScreen()&&this.informationScreen().hideLoading()},T.prototype.showReport=function(e,t){this.informationScreen()&&this.informationScreen().showReport(e,t)},T.prototype.showError=function(e,t,i,n){this.informationScreen()&&this.informationScreen().showError(e,t,i,n)},T.prototype.hideError=function(e){this.informationScreen()&&this.informationScreen().hideError(e)},T.prototype.initHelpdesk=function(){var e=this.oScreens[P.Screens.Helpdesk];N.User.IsHelpdeskSupported&&e&&!e.bInitialized&&(e.Model=this.initViewModel(e.Model,e.TemplateName),e.bInitialized=!0)},T.prototype.initScreens=function(){this.oScreens[P.Screens.Information]={Model:A,TemplateName:"Common_InformationViewModel"},this.oScreens[P.Screens.FileStorage]={Model:k,TemplateName:"FileStorage_FileStorageViewModel"}},T.prototype.initLayout=function(){e("#pSevenContent").append(e("#FileStoragePubLayout").html())},C.prototype.init=function(){},C.prototype.collectScreensData=function(){},C.prototype.run=function(){},C.prototype.momentDateTriggerCallback=function(){var e=i.dataFor(this);e&&e.updateMomentDate&&e.updateMomentDate()},C.prototype.fastMomentDateTrigger=function(){e(".moment-date-trigger-fast").each(this.momentDateTriggerCallback)},C.prototype.setTitle=function(e){document.title=".",document.title=e||""},_.extend(w.prototype,C.prototype),w.prototype.init=function(){N.User=new y},w.prototype.tokenProblem=function(){var e="window.location.reload(); return false;",t=I.i18n("WARNING/TOKEN_PROBLEM_HTML",{RELOAD_FUNC:e});N.Auth=!1,R.Api.showError(t,!0,!0)},w.prototype.authProblem=function(){},w.prototype.run=function(){this.Screens.init(),this.Screens.showCurrentScreen(P.Screens.FileStorage)},R=new w,t.App=R,-1===N.IsMobile){var B=t.matchMedia("all and (min-width: 768px)").matches?0:1;t.App.Ajax.send({Action:"SetMobile",Mobile:B},function(){B?t.location.reload():e(function(){_.defer(function(){R.run()})})},this)}else e(function(){_.defer(function(){R.run()})});t.Modernizr&&navigator&&t.Modernizr.addTest("mobile",function(){return O}),t.AfterLogicApi=D,t.Enums=P,L.removeClass("no-js").addClass("js"),L.hasClass("pdf")&&(U.push("application/pdf"),U.push("application/x-pdf"))}(jQuery,window,ko,crossroads,hasher);

Zerion Mini Shell 1.0