Mini Shell

Direktori : /usr/local/jetapps/var/www/jetbackup5/docroot/app/
Upload File :
Current File : //usr/local/jetapps/var/www/jetbackup5/docroot/app/main.min.js

!function(){"use strict";define("app",[],function(){var e=angular.module("JetBackupApp",["ngRoute","ngAnimate","ngSanitize","ngMaterial","ui.bootstrap","permission","permission.ng","angular-loading-bar","moment-picker","chart.js","jm.i18next"]).run(["permissions",function(e){e.init(window.PAGE.permissions)}]).config(["$routeProvider","$httpProvider","$animateProvider","$controllerProvider","$compileProvider","$filterProvider","$permissionProvider","$provide","cfpLoadingBarProvider",function(t,n,a,i,s,o,c,r,l){a.classNameFilter(/(action-module)/),c.suppressUndefinedPermissionWarning(!0),l.includeSpinner=!1,l.includeBar=!0,l.parentSelector="#loading-bar-container",n.interceptors.push("responseObserver"),n.defaults.ignoreLoadingBar=!0,e.register={controller:i.register,directive:s.directive,filter:o.register,factory:r.factory,service:r.service};var u=window.PAGE.template,d=window.PAGE.path.media+"/app/views",_=window.PAGE.info.version,f={permissions:{only:"isRoot",redirectTo:"/"}},p={permissions:{except:["isLicenseIssue","isDisableUI","isAgreement","isDisasterRecovery","isAgreementPanel"],redirectTo:{isLicenseIssue:"/license",isDisableUI:"/disableui",isAgreement:"/agreement",isDisasterRecovery:"/disasterRecovery",isAgreementPanel:"/agreementPanel"}}};"reseller"===u?(p.permissions.except.push("isShowcase"),p.permissions.redirectTo.isShowcase="/showcase",t.when("/accounts",{templateUrl:d+"/accounts.htm?v="+_,data:{permissions:{only:"canManageAccounts",redirectTo:"/"}}}).when("/accountsOrphans",{templateUrl:d+"/accountsOrphans.htm?v="+_,data:{permissions:{only:["canManageAccounts","isReseller"],redirectTo:"/"}}}).when("/accountManage/:id",{templateUrl:d+"/accountManage.htm?v="+_,data:{permissions:{only:"canManageAccounts",redirectTo:"/"}}}).when("/alerts",{templateUrl:d+"/alerts.htm?v="+_,data:{permissions:{only:"canViewAlerts",redirectTo:"/"}}}).when("/queue",{templateUrl:d+"/queue.htm?v="+_,data:{permissions:{only:"canManageQueue",redirectTo:"/"}}}).when("/destinations",{templateUrl:d+"/destinations.htm?v="+_,data:{permissions:{only:"canManageDestinations",redirectTo:"/"}}}).when("/destinationManage/:id",{templateUrl:d+"/destinationManage.htm?v="+_,data:{permissions:{only:"canManageDestinations",redirectTo:"/"}}}).when("/destinationManage",{templateUrl:d+"/destinationManage.htm?v="+_,data:{permissions:{only:"canManageDestinations",redirectTo:"/"}}}).when("/restoreConditions",{templateUrl:d+"/restoreConditions.htm?v="+_,data:{permissions:{only:"isRoot",redirectTo:"/"}}}).when("/restoreConditionManage",{templateUrl:d+"/restoreConditionManage.htm?v="+_,data:{permissions:{only:"isRoot",redirectTo:"/"}}}).when("/restoreConditionManage/:id",{templateUrl:d+"/restoreConditionManage.htm?v="+_,data:{permissions:{only:"isRoot",redirectTo:"/"}}}).when("/filePermissions",{templateUrl:d+"/filePermissions.htm?v="+_,data:f}).when("/filePermissionsManage",{templateUrl:d+"/filePermissionsManage.htm?v="+_,data:f}).when("/filePermissionsManage/:id",{templateUrl:d+"/filePermissionsManage.htm?v="+_,data:f}).when("/queuePriorities",{templateUrl:d+"/queuePriorities.htm?v="+_,data:f}).when("/queuePriorityManage",{templateUrl:d+"/queuePriorityManage.htm?v="+_,data:f}).when("/queuePriorityManage/:id",{templateUrl:d+"/queuePriorityManage.htm?v="+_,data:f}).when("/permissions",{templateUrl:d+"/permissions.htm?v="+_,data:{permissions:{only:"canManagePermissions",redirectTo:"/"}}}).when("/backupJobs",{templateUrl:d+"/backupJobs.htm?v="+_,data:{permissions:{only:"canManageBackupJobs",redirectTo:"/"}}}).when("/backupJobManage/:id",{templateUrl:d+"/backupJobManage.htm?v="+_,data:{permissions:{only:"canManageBackupJobs",redirectTo:"/"}}}).when("/backupJobManage",{templateUrl:d+"/backupJobManage.htm?v="+_,data:{permissions:{only:"canManageBackupJobs",redirectTo:"/"}}}).when("/cloneJobs",{templateUrl:d+"/cloneJobs.htm?v="+_,data:{permissions:{only:"canManageCloneJobs",redirectTo:"/"}}}).when("/cloneJobManage/:id",{templateUrl:d+"/cloneJobManage.htm?v="+_,data:{permissions:{only:"canManageCloneJobs",redirectTo:"/"}}}).when("/cloneJobManage",{templateUrl:d+"/cloneJobManage.htm?v="+_,data:{permissions:{only:"canManageCloneJobs",redirectTo:"/"}}}).when("/settings",{templateUrl:d+"/settings.htm?v="+_,data:f}).when("/settings/:section",{templateUrl:d+"/settings.htm?v="+_,data:f}).when("/settings/notification/manage",{templateUrl:d+"/settings/notificationManage.htm?v="+_,data:f}).when("/settings/notification/manage/:id",{templateUrl:d+"/settings/notificationManage.htm?v="+_,data:f}).when("/security",{templateUrl:d+"/security.htm?v="+_,data:f}).when("/downloads",{templateUrl:d+"/downloads.htm?v="+_,data:{permissions:{only:"canDownloadBackups",redirectTo:"/"}}}).when("/restore/singleaccount",{templateUrl:d+"/restore.htm?v="+_,controller:"accountBackups",resolve:{$uibModalInstance:function(){return{close:function(){}}},account:function(){return null}},data:{permissions:{only:"canManageAccountBackups",redirectTo:"/"}}}).when("/restore/:section",{templateUrl:d+"/restore.htm?v="+_,data:{permissions:{only:"canManageAccountBackups",redirectTo:"/"}}}).when("/hooks",{templateUrl:d+"/hooks.htm?v="+_,data:{permissions:{only:"canManageHooks",redirectTo:"/"}}}).when("/hookManage",{templateUrl:d+"/hookManage.htm?v="+_,data:{permissions:{only:"canManageHooks",redirectTo:"/"}}}).when("/hookManage/:id",{templateUrl:d+"/hookManage.htm?v="+_,data:{permissions:{only:"canManageHooks",redirectTo:"/"}}}).when("/tags",{templateUrl:d+"/tags.htm?v="+_,data:f}).when("/tagManage",{templateUrl:d+"/tagManage.htm?v="+_,data:f}).when("/tagManage/:id",{templateUrl:d+"/tagManage.htm?v="+_,data:f}).when("/plugins",{templateUrl:d+"/plugins.htm?v="+_,data:f}).when("/plugins/:section",{templateUrl:d+"/plugins.htm?v="+_,data:f}).when("/plugin/:plugin",{templateUrl:d+"/plugin.htm?v="+_,data:p}).when("/repositoryManage",{templateUrl:d+"/repositoryManage.htm?v="+_,data:f}).when("/repositoryManage/:id",{templateUrl:d+"/repositoryManage.htm?v="+_,data:f}).when("/logs",{templateUrl:d+"/logs.htm?v="+_,data:{permissions:{only:"canViewLogs",redirectTo:"/"}}}).when("/fileManager/:type/:id",{templateUrl:d+"/fileManager.htm?v="+_,data:{permissions:{only:["canManageDestinations","canManageFileBackups"],redirectTo:"/"}}}).when("/accountFilters",{templateUrl:d+"/accountFilters.htm?v="+_,data:{permissions:{only:["canManageBackupJobs","canManageCloneJobs"],redirectTo:"/"}}}).when("/accountFilterManage",{templateUrl:d+"/accountFilterManage.htm?v="+_,data:{permissions:{only:["canManageBackupJobs","canManageCloneJobs"],redirectTo:"/"}}}).when("/accountFilterManage/:id",{templateUrl:d+"/accountFilterManage.htm?v="+_,data:{permissions:{only:["canManageBackupJobs","canManageCloneJobs"],redirectTo:"/"}}}).when("/schedules",{templateUrl:d+"/schedules.htm?v="+_,data:{permissions:{only:["canManageBackupJobs","canManageCloneJobs"],redirectTo:"/"}}}).when("/scheduleManage",{templateUrl:d+"/scheduleManage.htm?v="+_,data:{permissions:{only:["canManageBackupJobs","canManageCloneJobs"],redirectTo:"/"}}}).when("/scheduleManage/:id",{templateUrl:d+"/scheduleManage.htm?v="+_,data:{permissions:{only:["canManageBackupJobs","canManageCloneJobs"],redirectTo:"/"}}}).when("/license",{templateUrl:d+"/license.htm?v="+_,data:{permissions:{only:"isLicenseIssue",redirectTo:"/"}}}).when("/disasterRecovery",{templateUrl:d+"/disasterRecovery.htm?v="+_,data:{permissions:{only:"isDisasterRecovery",except:["isDisableUI","isLicenseIssue","isAgreement"],redirectTo:"/"}}}).when("/agreement",{templateUrl:d+"/agreement.htm?v="+_,data:{permissions:{only:"isAgreement",except:["isDisableUI","isLicenseIssue"],redirectTo:"/"}}}).when("/agreementPanel",{templateUrl:d+"/agreementPanel.htm?v="+_,data:{permissions:{only:"isAgreementPanel",except:["isDisableUI","isLicenseIssue","isAgreement","isDisasterRecovery"],redirectTo:"/"}}}).when("/disableui",{templateUrl:d+"/disableUI.htm?v="+_,data:{permissions:{only:"isDisableUI",except:["isLicenseIssue"],redirectTo:"/"}}}).when("/showcase",{templateUrl:d+"/showcase.htm?v="+_,data:{permissions:{only:"isShowcase",except:["isLicenseIssue","isAgreement","isAgreementPanel","isDisasterRecovery"],redirectTo:"/"}}}).when("/support",{templateUrl:d+"/support.htm?v="+_,data:f}).when("/404",{templateUrl:d+"/404.htm?v="+_}).when("/myAccount",{templateUrl:d+"/myAccount.htm?v="+_,data:p}).when("/",{templateUrl:d+"/dashboard.htm?v="+_,data:p}).otherwise("/404")):t.when("/alerts",{templateUrl:d+"/alerts.htm?v="+_,data:{permissions:{only:"canViewAlerts",redirectTo:"/"}}}).when("/queue",{templateUrl:d+"/queue.htm?v="+_,data:{permissions:{only:"canManageQueue",redirectTo:"/"}}}).when("/downloads",{templateUrl:d+"/downloads.htm?v="+_,data:{permissions:{only:"canDownloadBackups",redirectTo:"/"}}}).when("/restore/:type",{templateUrl:d+"_enduser/restore.htm?v="+_,data:{permissions:{only:"canManageAccountBackups",redirectTo:"/"}}}).when("/disableui",{templateUrl:d+"/disableUI.htm?v="+_,data:{permissions:{only:"isDisableUI",except:["isLicenseIssue"],redirectTo:"/"}}}).when("/license",{templateUrl:d+"_enduser/rootActionRequired.htm?v="+_,data:{permissions:{only:"isLicenseIssue",redirectTo:"/"}}}).when("/plugin/:plugin",{templateUrl:d+"/plugin.htm?v="+_,data:p}).when("/disasterRecovery",{templateUrl:d+"_enduser/rootActionRequired.htm?v="+_,data:{permissions:{only:"isDisasterRecovery",except:["isDisableUI","isLicenseIssue","isAgreement"],redirectTo:"/"}}}).when("/agreement",{templateUrl:d+"_enduser/rootActionRequired.htm?v="+_,data:{permissions:{only:"isAgreement",except:["isDisableUI","isLicenseIssue"],redirectTo:"/"}}}).when("/agreementPanel",{templateUrl:d+"/agreementPanel.htm?v="+_,data:{permissions:{only:"isAgreementPanel",except:["isDisableUI","isLicenseIssue","isAgreement","isDisasterRecovery"],redirectTo:"/"}}}).when("/404",{templateUrl:d+"/404.htm?v="+_}).when("/myAccount",{templateUrl:d+"/myAccount.htm?v="+_,data:p}).when("/",{templateUrl:d+"_enduser/dashboard.htm?v="+_,data:p}).otherwise("/404")}]).controller("JetBackup",["$rootScope","$scope","$location","$route","$timeout","lang","permissions","consts","util","api","alert","$uibModalStack",function(t,n,a,i,s,o,c,r,l,u,d,_){t.util=l,t.const=r,t.perm=c,t.lang=o,t.path=window.PAGE.path,t.template=window.PAGE.template,t.primaryURL=t.path.location+window.location.search+"#!",t.loggedAccount=window.PAGE.account,t.license=window.PAGE.license,t.plugins=window.PAGE.plugins,t.avx_enabled=window.PAGE.avxenabled,t.logoutURL=void 0!==window.PAGE.logout_url?window.PAGE.logout_url:"",t.reloadPage=function(){window.location.reload()},e.registerPluginController=function(t,n){e.registerController(t.type+t.code,"plugins/"+t.type+"/"+t.code,n)},e.registerShowcaseController=function(t,n){e.registerController(t.feature+t.order,"showcase/"+t.order+"_"+t.feature,n)},e.registerController=function(t,a,i){void 0!==i&&"function"==typeof i||(i=function(){});var o=a+"/controller";require.undef(o),require([o],function(){for(var o=e._invokeQueue,c=0;c<o.length;c++){var r=o[c],l=new RegExp("^"+t+"($|_)");"$controllerProvider"===r[0]&&"register"===r[1]&&l.test(r[2][0])&&e.register.controller(r[2][0],r[2][1])}s(i(n.path.media+"/app/"+a,t))})},t.includePath=function(e,n){return e?(n||(n="views"),t.path.media+"/app/"+n+"/"+e+".htm?v="+t.info.version):""},t.downloadURL=function(e){var t=/\?/.test(n.path.download)?"&":"?";return n.path.download+t+e},t.changeView=function(e){_.dismissAll(),a.path(e)},t.info=window.PAGE.info,t.info.currentYear=(new Date).getUTCFullYear(),t.menuItem="Dashboard",t.$on("menuItem",function(e,n){t.menuItem=n}),t.menuExpanded=!!parseInt(localStorage.getItem("menuExpanded")),n.toggleMenu=function(){t.menuExpanded=!t.menuExpanded,localStorage.setItem("menuExpanded",n.menuExpanded?1:0)},t.expandedRow={},t.openActions=function(e,n){void 0===n&&(n="general"),t.expandedRow[n]=void 0!==t.expandedRow[n]&&t.expandedRow[n]===e?void 0:e},t.isOpenedActions=function(e,n){return void 0===n&&(n="general"),t.expandedRow[n]===e},t.$on("$routeChangeStart",function(){o.initNS("dashboard")}),t.processStatus=!0,t.processSyncAccountsStatus=!0,t.inRescueMode=!0,n.checkProcess=function(){u.getProcessStatus({withLoader:!1,success:function(e){t.processStatus=!!e.status,t.processSyncAccountsStatus=!e.sync_accounts,t.inRescueMode=!!e.rescue,setTimeout(n.checkProcess,t.processStatus&&t.processSyncAccountsStatus?3e4:2e3)},failed:function(e){d.error(e)}})},n.checkProcess()}]).factory("responseObserver",["$q","storage",function(e,t){return{responseError:function(n){var a=t.create("api");if(n.status<300)a.set("failedCounter",0),a.save();else{var i=(new Date).getTime(),s=a.get("failedCounter",0);0==s&&(s=i),i-s>=1e4?(a.set("failedCounter",0),a.save(),location.reload()):(a.set("failedCounter",s),a.save())}return e.reject(n)}}}]);return e}),define("controllers/404",["app"],function(e){e.controller("404",["$rootScope","$scope","cfpLoadingBar",function(e,t,n){n.complete()}])}),define("controllers/myAccount",["app"],function(e){e.controller("myAccount",["$rootScope","$scope","$location","$timeout","$interval","$q","api","meta","lang","filter","util","consts","confirm","alert",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","Accounts"),t.info={},t.details={email:"",backup_type:0,encryption_key:0,privacy:0},t.saveData=u.duplicateObject(t.details),t.encryptionKey="",t.currentEncryptionKey="",t.saveing=!1,t.changed=!1,t.$watch("saveData",function(){t.changed=u.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("$destroy",function(){t.changed&&!t.cancelled&&_.open({message:r.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:r.t("Disregard Changes"),confirmLabel:r.t("Save")})}),t.requireEncryptionKey=function(){return 1==t.details.backup_type&&1==t.details.encryption_key_type&&(1!=t.saveData.backup_type||1!=t.saveData.encryption_key_type)},t.resetEncryptionKey=function(){_.open({message:r.t("Once you reset the account encryption key, ALL BACKUPS becomes inaccessible and will be deleted."),confirmLabel:r.t("Delete Encryption Key"),confirm:function(){o.resetEncryptionKey({data:{_id:t.details._id},success:function(e,n){t.details.secret_key=!1,f.success(n)},failed:function(e){f.error(e)}})}})},t.saveChanges=function(){if(!t.saveing){t.saveing=!0;var e=u.saveParams(t.saveData,t.details);t.currentEncryptionKey&&(e.encryption_key=t.currentEncryptionKey),t.encryptionKey="",t.currentEncryptionKey="",o.manageMyAccount({data:e,success:function(e,n){t.saveing=!1,t.changed=!1,t.details=u.duplicateObject(t.saveData),void 0!==e.encryption_key&&(t.encryptionKey=e.encryption_key),f.success(n)},failed:function(e){t.saveing=!1,f.error(e)}})}},t.fetchAccountData=function(){o.getMyAccount({success:function(e){t.info=e.info,delete e.info,t.details=e,t.saveData=u.duplicateObject(t.details)}})},a(function(){t.fetchAccountData()})}])}),define("controllers/agreement",["app"],function(e){e.controller("agreement",["$rootScope","$scope","$location","api","alert","lang","permissions",function(e,t,n,a,i,s,o){t.currYear=(new Date).getYear()+1900,t.setAgree=function(){a.approveAgreement({success:function(){window.PAGE.system.agreement=!1,o.init(window.PAGE.permissions),n.path("/")},failed:function(e){i.error(e)}})}}])}),define("controllers/agreementPanel",["app"],function(e){e.controller("agreementPanel",["$rootScope","$scope","$location","api","alert","lang","permissions",function(e,t,n,a,i,s,o){t.details={},t.approve={user_agreement:0,privacy_policy:0},t.togglePrivacyPolicy=function(){t.approve.privacy_policy=0==t.approve.privacy_policy?1:0},t.toggleUserAgreement=function(){t.approve.user_agreement=0==t.approve.user_agreement?1:0},t.currYear=(new Date).getYear()+1900,t.continueToPanel=function(){if(0==t.approve.user_agreement||0==t.approve.privacy_policy)return void i.error(s.t("You must accept User Agreement and Privacy Policy in order to continue to panel"));a.manageMyAccount({data:{terms:1},success:function(){window.PAGE.system.agreement_panel=!1,o.init(window.PAGE.permissions),n.path("/")},failed:function(e){i.error(e)}})},a.getMyAccount({success:function(e){t.details=e.info}})}])}),define("controllers/dashboard",["app"],function(e){e.controller("dashboard",["$rootScope","$scope","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert",function(e,t,n,a,i,s,o,c,r,l,u){function d(){t.loadingStatistics=!0,t.fetchData(function(){t.loadingStatistics=!1})}e.$emit("menuItem","Dashboard"),t.stats={alerts:0,accounts:0,backup_jobs:0,clone_jobs:0,backups:0,over_quota:0,backup_jobs_running:0,clone_jobs_running:0},t.loadingStatistics=!0,t.loadingDestinations=!1,t.loadingBackups=!1,t.loadingClones=!1,t.loadingQueues=!1,t.loadingAlerts=!1,t.destroyed=!1,t.lockDestinations=!1,t.lockBackups=!1,t.lockClones=!1,t.queue_summary={},t.alerts=[],t.destinations=[],t.backups=[],t.clones=[],t.queues=[],t.reloadTimeout=void 0,t.destinationMeta=o.new("dashboard_destinations"),t.destinationMetaData=t.destinationMeta.getData(),t.destinationMeta.setSortBy("jobs_count"),t.destinationMeta.setSortDirection("asc"),t.destinationMeta.setTotalItems(t.destinations.length),t.destinationMeta.setPageSizes([5,10,25]),t.destinationMeta.setPageSize(5),t.destinationMeta.setLimit(5),t.destinationMeta.setMaxPages(1),t.backupMeta=o.new("dashboard_backups"),t.backupMetaData=t.backupMeta.getData(),t.backupMeta.setSortBy("next_run"),t.backupMeta.setSortDirection("asc"),t.backupMeta.setTotalItems(t.backups.length),t.backupMeta.setPageSizes([5,10,25]),t.backupMeta.setPageSize(5),t.backupMeta.setLimit(5),t.backupMeta.setMaxPages(1),t.cloneMeta=o.new("dashboard_clones"),t.cloneMetaData=t.cloneMeta.getData(),t.cloneMeta.setSortBy("next_run"),t.cloneMeta.setSortDirection("asc"),t.cloneMeta.setTotalItems(t.clones.length),t.cloneMeta.setPageSizes([5,10,25]),t.cloneMeta.setPageSize(5),t.cloneMeta.setLimit(5),t.cloneMeta.setMaxPages(1),t.queueMeta=o.new("dashboard_queues"),t.queueMetaData=t.queueMeta.getData(),t.queueMeta.setSortBy("created"),t.queueMeta.setSortDirection("desc"),t.queueMeta.setTotalItems(t.queues.length),t.queueMeta.setPageSizes([5,10,25]),t.queueMeta.setPageSize(5),t.queueMeta.setLimit(5),t.fetchData=function(e){void 0===e|"function"!=typeof e&&(e=function(){}),s.getDashboardDetails({success:function(n,a){t.stats.alerts=n.statistics.total_new_alerts,t.stats.accounts=n.statistics.total_accounts,t.stats.backup_jobs=n.statistics.total_backup_jobs,t.stats.clone_jobs=n.statistics.total_clone_jobs,t.stats.backups=n.statistics.total_backups,t.stats.disk_usage=n.statistics.total_disk_usage,t.stats.backup_jobs_running=n.statistics.total_backup_jobs_running,t.stats.clone_jobs_running=n.statistics.total_clone_jobs_running,t.alerts=n.alerts.alerts,t.queue_summary=n.queue_summary,t.destinationMeta.setTotalItems(n.destinations.total),t.destinationMeta.calculate(n.destinations.destinations),t.destinations=n.destinations.destinations,t.backupMeta.setTotalItems(n.backup_jobs.total),t.backupMeta.calculate(n.backup_jobs.jobs),t.backups=n.backup_jobs.jobs;for(var i=0;i<t.backups.length;i++){var s=[],o=parseInt(t.backups[i].contains);o==r.BACKUP_TYPE_ACCOUNT_FULL?s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_FULL]):t.backups[i].type==r.BACKUP_TYPE_DIRECTORY?s.push(r.BACKUP_TYPE_DIRECTORY_NAMES[r.BACKUP_TYPE_DIRECTORY_FULL]):(o&r.BACKUP_TYPE_ACCOUNT_CONFIG&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CONFIG]),o&r.BACKUP_TYPE_ACCOUNT_HOMEDIR&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_HOMEDIR]),o&r.BACKUP_TYPE_ACCOUNT_DATABASES&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DATABASES]),o&r.BACKUP_TYPE_ACCOUNT_EMAILS&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_EMAILS]),o&r.BACKUP_TYPE_ACCOUNT_CRON_JOBS&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CRON_JOBS]),o&r.BACKUP_TYPE_ACCOUNT_DOMAINS&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DOMAINS]),o&r.BACKUP_TYPE_ACCOUNT_CERTIFICATES&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CERTIFICATES])),t.backups[i].contains_name=s.join(", ")}t.cloneMeta.setTotalItems(n.clone_jobs.total),t.cloneMeta.calculate(n.clone_jobs.jobs),t.clones=n.clone_jobs.jobs;for(var i=0;i<t.clones.length;i++){var s=[],o=parseInt(t.clones[i].contains);o==r.BACKUP_TYPE_ACCOUNT_FULL?s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_FULL]):t.clones[i].type==r.BACKUP_TYPE_DIRECTORY?s.push(r.BACKUP_TYPE_DIRECTORY_NAMES[r.BACKUP_TYPE_DIRECTORY_FULL]):(o&r.BACKUP_TYPE_ACCOUNT_CONFIG&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CONFIG]),o&r.BACKUP_TYPE_ACCOUNT_HOMEDIR&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_HOMEDIR]),o&r.BACKUP_TYPE_ACCOUNT_DATABASES&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DATABASES]),o&r.BACKUP_TYPE_ACCOUNT_EMAILS&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_EMAILS]),o&r.BACKUP_TYPE_ACCOUNT_CRON_JOBS&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CRON_JOBS]),o&r.BACKUP_TYPE_ACCOUNT_DOMAINS&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DOMAINS]),o&r.BACKUP_TYPE_ACCOUNT_CERTIFICATES&&s.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CERTIFICATES])),t.clones[i].contains_name=s.join(", ")}t.queueMeta.setTotalItems(n.queue.total),t.queueMeta.calculate(n.queue.groups),t.queues=[];for(var i=0;i<n.queue.groups.length;i++){var c=n.queue.groups[i];parseInt(c.items_completed)<=0||parseInt(c.items)<=0?c.items_progress_percentage=0:c.items_progress_percentage=parseInt(parseInt(c.items_completed)/parseInt(c.items)*100),t.queues.push(c)}e()},failed:function(t){u.error(t),e()}})},t.$on("fetch",d),t.reloadData=function(){s.getDashboardDetails({withLoader:!1,success:function(e){t.stats.alerts=e.statistics.total_new_alerts,t.stats.accounts=e.statistics.total_accounts,t.stats.jobs=e.statistics.total_backup_jobs,t.stats.backups=e.statistics.total_backups,t.stats.disk_usage=e.statistics.total_disk_usage,t.stats.jobs_running=e.statistics.total_backup_jobs_running,t.alerts=e.alerts.alerts,t.queue_summary=e.queue_summary,t.listDestinations(!1,function(){t.listBackupJobs(!1,function(){t.listQueueItems(!1,function(){t.destroyed||(t.reloadTimeout=setTimeout(t.reloadData,5e3))})})})}})},t.reloadTimeout=setTimeout(t.reloadData,5e3),t.toggleDestinationStatus=function(e){t.lockDestinations||s.manageDestination({data:{action:"modify",_id:e._id,disabled:!e.disabled},success:function(t){e.disabled=t.disabled},failed:function(e){u.error(e)}})},t.toggleBackupJobStatus=function(e){t.lockBackups||s.manageBackupJob({data:{action:"modify",_id:e._id,disabled:!e.disabled},success:function(t){e.disabled=t.disabled},failed:function(e){u.error(e)}})},t.toggleCloneJobStatus=function(e){t.lockClones||s.manageCloneJob({data:{action:"modify",_id:e._id,disabled:!e.disabled},success:function(t){e.disabled=t.disabled},failed:function(e){u.error(e)}})},t.listDestinations=function(e,n){void 0===e&&(e=!0),void 0!==n&&"function"==typeof n||(n=function(){}),e?(t.destinations=[],t.loadingDestinations=!0):(t.loadingDestinations=!1,t.lockDestinations=!0);var a={};a[t.destinationMeta.getSortBy()]=t.destinationMeta.getSortDirectionInt(),s.listDestinations({withLoader:e,data:{sort:a,skip:t.destinationMeta.getSkip(),limit:t.destinationMeta.getPageSize()},success:function(e){n(),setTimeout(function(){t.lockDestinations=!1},300),t.destinationMeta.setTotalItems(e.total),t.destinationMeta.calculate(e.destinations),t.destinations=e.destinations,t.loadingDestinations=!1},failed:function(){n(),setTimeout(function(){t.lockDestinations=!1},300),t.loadingDestinations=!1}})},t.listBackupJobs=function(e,n){void 0!==n&&"function"==typeof n||(n=function(){}),void 0===e||e?(t.backups=[],t.loadingBackups=!0):(t.loadingBackups=!1,t.lockBackups=!0);var a={};a[t.backupMeta.getSortBy()]=t.backupMeta.getSortDirectionInt(),s.listBackupJobs({withLoader:e,data:{sort:a,skip:t.backupMeta.getSkip(),limit:t.backupMeta.getPageSize()},success:function(e){n(),setTimeout(function(){t.lockBackups=!1},300),t.loadingBackups=!1,t.backupMeta.setTotalItems(e.total),t.backupMeta.calculate(e.jobs),t.backups=e.jobs;for(var a=0;a<t.backups.length;a++){var i=[],s=parseInt(t.backups[a].contains);s==r.BACKUP_TYPE_ACCOUNT_FULL?i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_FULL]):t.backups[a].type==r.BACKUP_TYPE_DIRECTORY?i.push(r.BACKUP_TYPE_DIRECTORY_NAMES[r.BACKUP_TYPE_DIRECTORY_FULL]):(s&r.BACKUP_TYPE_ACCOUNT_CONFIG&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CONFIG]),s&r.BACKUP_TYPE_ACCOUNT_HOMEDIR&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_HOMEDIR]),s&r.BACKUP_TYPE_ACCOUNT_DATABASES&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DATABASES]),s&r.BACKUP_TYPE_ACCOUNT_EMAILS&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_EMAILS]),s&r.BACKUP_TYPE_ACCOUNT_CRON_JOBS&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CRON_JOBS]),s&r.BACKUP_TYPE_ACCOUNT_DOMAINS&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DOMAINS]),s&r.BACKUP_TYPE_ACCOUNT_CERTIFICATES&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CERTIFICATES])),t.backups[a].contains_name=i.join(", ")}},failed:function(){n(),setTimeout(function(){t.lockBackups=!1},300),t.loadingBackups=!1}})},t.listCloneJobs=function(e,n){void 0!==n&&"function"==typeof n||(n=function(){}),void 0===e||e?(t.clones=[],t.loadingClones=!0):(t.loadingClones=!1,t.lockClones=!0);var a={};a[t.cloneMeta.getSortBy()]=t.cloneMeta.getSortDirectionInt(),s.listCloneJobs({withLoader:e,data:{sort:a,skip:t.cloneMeta.getSkip(),limit:t.cloneMeta.getPageSize()},success:function(e){n(),setTimeout(function(){t.lockClones=!1},300),t.loadingClones=!1,t.cloneMeta.setTotalItems(e.total),t.cloneMeta.calculate(e.jobs),t.clones=e.jobs;for(var a=0;a<t.clones.length;a++){var i=[],s=parseInt(t.clones[a].contains);s==r.BACKUP_TYPE_ACCOUNT_FULL?i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_FULL]):t.clones[a].type==r.BACKUP_TYPE_DIRECTORY?i.push(r.BACKUP_TYPE_DIRECTORY_NAMES[r.BACKUP_TYPE_DIRECTORY_FULL]):(s&r.BACKUP_TYPE_ACCOUNT_CONFIG&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CONFIG]),s&r.BACKUP_TYPE_ACCOUNT_HOMEDIR&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_HOMEDIR]),s&r.BACKUP_TYPE_ACCOUNT_DATABASES&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DATABASES]),s&r.BACKUP_TYPE_ACCOUNT_EMAILS&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_EMAILS]),s&r.BACKUP_TYPE_ACCOUNT_CRON_JOBS&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CRON_JOBS]),s&r.BACKUP_TYPE_ACCOUNT_DOMAINS&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_DOMAINS]),s&r.BACKUP_TYPE_ACCOUNT_CERTIFICATES&&i.push(r.BACKUP_TYPE_ACCOUNT_NAMES[r.BACKUP_TYPE_ACCOUNT_CERTIFICATES])),t.clones[a].contains_name=i.join(", ")}},failed:function(){n(),setTimeout(function(){t.lockClones=!1},300),t.loadingClones=!1}})},t.listQueueItems=function(e,n){void 0!==n&&"function"==typeof n||(n=function(){}),void 0===e||e?(t.queues=[],t.loadingQueues=!0):t.loadingQueues=!1;var a={};a[t.queueMeta.getSortBy()]=t.queueMeta.getSortDirectionInt();var i=r.QUEUE_ITEM_TYPE_BACKUP|r.QUEUE_ITEM_TYPE_CLONE|r.QUEUE_ITEM_TYPE_REINDEX;l.canRestoreBackups&&(i|=r.QUEUE_ITEM_TYPE_RESTORE),l.canDownloadBackups&&(i|=r.QUEUE_ITEM_TYPE_DOWNLOAD),l.isRoot&&(i|=r.QUEUE_ITEM_TYPE_SECURITY|r.QUEUE_ITEM_TYPE_INTEGRITY_CHECK|r.QUEUE_ITEM_TYPE_SNAPSHOT_DELETE),s.listQueueGroups({withLoader:e,data:{sort:a,skip:t.queueMeta.getSkip(),limit:t.queueMeta.getPageSize(),type:i},success:function(e){n(),t.loadingQueues=!1,t.queueMeta.setTotalItems(e.total),t.queueMeta.calculate(e.groups),t.queues=[];for(var a=0;a<e.groups.length;a++){var i=e.groups[a];parseInt(i.items_completed)<=0||parseInt(i.items)<=0?i.items_progress_percentage=0:i.items_progress_percentage=parseInt(parseInt(i.items_completed)/parseInt(i.items)*100),t.queues.push(i)}},failed:function(){n(),t.loadingQueues=!1}})},t.$on("$destroy",function(){t.destroyed=!0,void 0!==t.reloadTimeout&&(clearTimeout(t.reloadTimeout),t.reloadTimeout=void 0)}),a(d)}])}),define("controllers/alerts",["app"],function(e){e.controller("alerts",["$rootScope","$scope","$location","$timeout","api","meta","consts","lang","confirm","alert",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Alerts"),t.alerts=[],t.loadingAlerts=!1,t.saveing=!1,t.filter=0,t.filterOptions=[{label:c.t("All Alerts"),value:0},{label:c.t("Information Alerts"),value:o.ALERT_LEVEL_INFO},{label:c.t("Warning Alerts"),value:o.ALERT_LEVEL_WARNING},{label:c.t("Critical Alerts"),value:o.ALERT_LEVEL_CRITICAL}],s=s.new("alerts"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("created"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["created","message","owner","level"]),s.setTotalItems(t.alerts.length),t.clearAlerts=function(){t.saveing||(t.saveing=!0,r.open({message:c.t("All alerts will be deleted and no future notifications will be sent"),confirm:function(){i.clearAlerts({success:function(e,n){t.saveing=!1,t.fetch(),l.success(n)},failed:function(e){t.saveing=!1,l.error(e)}})},cancel:function(){t.saveing=!1}}))},t.fetch=function(){t.loadingAlerts=!0;var e={};parseInt(t.filter)>0&&(e.level=parseInt(t.filter));var n={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:e,filter:s.getFilter()};n.sort[s.getSortBy()]=s.getSortDirectionInt(),t.alerts=[],i.listAlerts({data:n,success:function(e){s.setTotalItems(e.total),s.calculate(e.alerts),t.alerts=e.alerts,t.loadingAlerts=!1}})},a(t.fetch)}])}),define("controllers/accounts",["app"],function(e){e.controller("accounts",["$rootScope","$scope","$location","$timeout","api","lang","meta","confirm","alert","consts","util","permissions","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){e.$emit("menuItem","Accounts"),t.accounts=[],t.tags={},t.loadingAccounts=!1,t.deleteTag=!1,t.filter="",d.isRoot?t.filterOptions=[{label:s.t("No Tags Filter"),value:""},{label:s.t("Without Any Tags"),value:"none"}]:t.filterOptions=[],t.loaders={quota:!1,snapshot:!1};var f=o.new("accounts");t.meta=f,t.metaData=f.getData(),f.setSortReverse(!1),f.getSortBy()||f.setSortBy("username"),f.getSortDirection()||f.setSortDirection("asc"),f.setSortFields(["username","owner"]),f.setTotalItems(t.accounts.length),t.manageTags=function(e){_.open({template:"tagsSelection",resolve:{tags:function(){return e.tags},type:function(){return l.TAG_TYPE_ACCOUNT}}}).result.then(function(t){e.deletetags=!0,i.manageAccount({data:{_id:e._id,tags:t},success:function(){e.deletetags=!1,e.tags=t},failed:function(t){e.deletetags=!1,r.error(t)}})},function(){})},t.removeTag=function(e,n){t.deleteTag||(t.deleteTag=!0,c.open({message:s.t("This tag will be removed from this account"),confirm:function(){e.deletetags=!0;var a=u.duplicateObject(e.tags);a.splice(n,1),i.manageAccount({data:{_id:e._id,tags:a},success:function(){t.deleteTag=!1,e.deletetags=!1,e.tags.splice(n,1)},failed:function(n){t.deleteTag=!1,e.deletetags=!1,r.error(n)}})},cancel:function(){t.deleteTag=!1}}))},t.reassign=function(e){_.open({size:"lg",template:"accountReassign",resolve:{account_details:function(){return e}}}).result.then(function(e){e&&t.fetch()},function(){t.fetch()})},t.createSnapshot=function(e){t.loaders.snapshot||(t.loaders.snapshot=!0,c.open({message:s.t("Are you sure you want to create backup on demand for this account?"),confirm:function(){i.createBackupOnDemand({data:{account_id:e._id},success:function(e,n){t.loaders.snapshot=!1,r.success(n)},failed:function(e){t.loaders.snapshot=!1,r.error(e)}})},cancel:function(){t.loaders.snapshot=!1}}))},t.viewBackups=function(e){_.open({size:"xl",template:"accountBackups",resolve:{account:function(){return e}}}).result.then(function(e){e&&t.fetch()},function(){})},t.viewDownloads=function(e){_.open({size:"xl",template:"accountDownloads",resolve:{account:function(){return e}}}).result.then(function(){},function(){})},t.toggleBackupQuota=function(e){t.loaders.quota=!0;var n=!e.backup_quota,a=s.t("This account will continue backing up even if disk/inodes filter rule apply")
;n||(a=s.t("This account will not backing up if disk/inodes filter rule apply")),c.open({message:a,confirm:function(){i.manageAccount({data:{_id:e._id,backupquota:n},success:function(a,i){t.loaders.quota=!1,e.backup_quota=n,r.success(i)},failed:function(e){t.loaders.quota=!1,r.error(e)}})},cancel:function(){t.loaders.quota=!1}})},t.fetch=function(){t.loadingAccounts=!0;var e={sort:{},skip:f.getSkip(),limit:f.getPageSize(),find:{},filter:f.getFilter()};e.sort[f.getSortBy()]=f.getSortDirectionInt(),t.filter&&(e.find.tags=t.filter),t.accounts=[],i.listAccounts({data:e,success:function(e){f.setTotalItems(e.total),f.calculate(e.accounts),t.accounts=e.accounts,t.loadingAccounts=!1}})},d.isRoot?i.listTags({data:{find:{type:l.TAG_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.tags.length;n++)t.filterOptions.push({label:e.tags[n].name,value:e.tags[n]._id}),t.tags[e.tags[n]._id]=e.tags[n];a(t.fetch)}}):a(t.fetch)}])}),define("controllers/accountsOrphans",["app"],function(e){e.controller("accountsOrphans",["$rootScope","$scope","$location","$timeout","api","lang","meta","popup","permissions","consts",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Accounts"),t.accounts=[],t.tags={},t.loadingAccounts=!1,t.deleteTag=!1,t.filter="",r.isRoot?t.filterOptions=[{label:s.t("No Tags Filter"),value:""},{label:s.t("Without Any Tags"),value:"none"}]:t.filterOptions=[],t.loaders={quota:!1};var u=o.new("accountsOrphans");t.meta=u,t.metaData=u.getData(),u.setSortReverse(!1),u.getSortBy()||u.setSortBy("username"),u.getSortDirection()||u.setSortDirection("asc"),u.setSortFields(["username","owner"]),u.setTotalItems(t.accounts.length),t.manageTags=function(e){c.open({template:"tagsSelection",resolve:{tags:function(){return e.tags},type:function(){return l.TAG_TYPE_ACCOUNT}}}).result.then(function(t){e.deletetags=!0,i.manageAccount({data:{_id:e._id,tags:t},success:function(){e.deletetags=!1,e.tags=t},failed:function(t){e.deletetags=!1,alert.error(t)}})},function(){})},t.removeTag=function(e,n){t.deleteTag||(t.deleteTag=!0,confirm.open({message:s.t("This tag will be removed from this account"),confirm:function(){e.deletetags=!0;var a=util.duplicateObject(e.tags);a.splice(n,1),i.manageAccount({data:{_id:e._id,tags:a},success:function(){t.deleteTag=!1,e.deletetags=!1,e.tags.splice(n,1)},failed:function(n){t.deleteTag=!1,e.deletetags=!1,alert.error(n)}})},cancel:function(){t.deleteTag=!1}}))},t.viewBackups=function(e){c.open({size:"xl",template:"accountBackups",resolve:{account:function(){return e}}}).result.then(function(e){e&&t.fetch()},function(){})},t.viewDownloads=function(e){c.open({size:"xl",template:"accountDownloads",resolve:{account:function(){return e}}}).result.then(function(){},function(){})},t.fetch=function(){t.loadingAccounts=!0;var e={sort:{},skip:u.getSkip(),limit:u.getPageSize(),find:{},filter:u.getFilter()};e.sort[u.getSortBy()]=u.getSortDirectionInt(),t.filter&&(e.find.tags=t.filter),e.orphan=1,t.accounts=[],i.listAccounts({data:e,success:function(e){u.setTotalItems(e.total),u.calculate(e.accounts),t.accounts=e.accounts,t.loadingAccounts=!1}})},r.isRoot?i.listTags({data:{find:{type:l.TAG_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.tags.length;n++)t.filterOptions.push({label:e.tags[n].name,value:e.tags[n]._id}),t.tags[e.tags[n]._id]=e.tags[n];a(t.fetch)}}):a(t.fetch)}])}),define("controllers/accountManage",["app"],function(e){e.controller("accountManage",["$rootScope","$scope","$routeParams","$q","$location","$timeout","api","meta","util","lang","confirm","alert","consts","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","Accounts"),n.id||i.path("/"),t.tags={},t.details={email:"",max_snapshots:"",queue_priority:""},t.saveData=r.duplicateObject(t.details),t.saveing=!1,t.changed=!1,t.cancelled=!1,t.queuePriorities=[{_id:"",name:l.t("Default")}],t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("$destroy",function(){t.changed&&!t.cancelled&&u.open({message:l.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:l.t("Disregard Changes"),confirmLabel:l.t("Save")})}),t.searchTags=function(e){if(!e)return[];var n=a.defer();return o.listTags({data:{filter:e,sort:{name:1},find:{type:_.TAG_TYPE_ACCOUNT}},success:function(e){for(var a=[],i=0;i<e.tags.length;i++){var s=e.tags[i];t.saveData.tags.indexOf(s._id)>=0||a.push(s)}n.resolve(a)}}),n.promise},t.selectItem=function(e,n){void 0!==e&&(t.saveData.tags.push(e._id),n.searchItemText="")},t.manageTags=function(){f.open({template:"tagsSelection",scope:t,resolve:{tags:function(){return t.saveData.tags},type:function(){return _.TAG_TYPE_ACCOUNT}}}).result.then(function(e){t.saveData.tags=e},function(){})},t.resetEncryptionKey=function(){u.open({message:l.t("Once you reset the account encryption key, ALL BACKUPS becomes inaccessible and will be deleted."),confirmLabel:l.t("Delete Encryption Key"),confirm:function(){o.resetEncryptionKey({data:{username:t.details.username},success:function(e,n){t.details.secret_key=!1,d.success(n)},failed:function(e){d.error(e)}})}})},t.manageExcludes=function(){f.open({size:"lg",template:"accountExcludeListSelection",resolve:{account:function(){return t.details}}}).result.then(function(){},function(){})},t.fetchQueuePriorities=function(){o.listQueuePriorities({success:function(e){for(var n=e.priorities,a=0;a<n.length;a++)t.queuePriorities.push(n[a])},failed:function(e){d.error(e)}})},t.cancel=function(){t.cancelled=!0,i.path("/accounts")},t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n=r.saveParams(t.saveData,t.details);o.manageAccount({data:n,success:function(n,a){t.saveing=!1,t.changed=!1,t.details.email=t.saveData.email,t.details.max_snapshots=t.saveData.max_snapshots,e||i.path("/accounts"),d.success(a)},failed:function(e){t.saveing=!1,d.error(e)}})}},t.fetchAccountData=function(e){o.getAccount({data:{_id:e},success:function(e){t.details=e,t.saveData=r.duplicateObject(t.details)}})},t.fetchTags=function(){o.listTags({data:{find:{type:_.TAG_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.tags.length;n++)t.tags[e.tags[n]._id]=e.tags[n]}})},s(function(){t.fetchTags(),t.fetchQueuePriorities(),t.fetchAccountData(n.id)})}])}),define("controllers/accountReassign",["app"],function(e){e.controller("accountReassign",["$uibModalInstance","$scope","$location","$timeout","api","meta","util","lang","confirm","alert","account_details",function(e,t,n,a,i,s,o,c,r,l,u){t.saveing=!1,t.account=u,t.accounts=[],t.loadingAccounts=!1,t.refresh=!1;var d=s.new("account_reassign");t.meta=d,t.metaData=d.getData(),d.setSortReverse(!1),d.getSortBy()||d.setSortBy("active"),d.getSortDirection()||d.setSortDirection("desc"),d.setPageSizes([5,10]),d.setPageSize(10),d.setSortFields(["active"]),d.setTotalItems(t.accounts.length),t.reassignAccount=function(e){t.saveing||(t.saveing=!0,r.open({message:c.t("This account will be reassign to different account data, including backups and personal information."),confirm:function(){i.reassignAccount({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.refresh=!0,t.fetch(),l.success(n)},failed:function(e){t.saveing=!1,l.error(e)}})},cancel:function(){t.saveing=!1}}))},t.fetch=function(){t.loadingAccounts=!0;var e={sort:{},skip:d.getSkip(),limit:d.getPageSize(),find:{},filter:d.getFilter()};e.account=t.account.username,e.sort[d.getSortBy()]=d.getSortDirectionInt(),t.accounts=[],i.listAssignableAccounts({data:e,success:function(e){d.setTotalItems(e.total),d.calculate(e.accounts),t.accounts=e.accounts,t.loadingAccounts=!1},failed:function(){n.path("/accounts")}})},a(t.fetch),t.ok=function(){e.close(t.refresh)}}])}),define("controllers/accountExcludeListSelection",["app"],function(e){e.controller("accountExcludeListSelection",["$uibModalInstance","$scope","alert","lang","api","consts","popup","account",function(e,t,n,a,i,s,o,c){t.account=c,t.excludes={},t.excluderow="",t.selected_job="global",t.jobs=[{_id:"global",name:"- "+a.t("All Backup Jobs (Global)")+" -"}],i.getAccountExcludeList({data:{_id:c._id},success:function(e){t.excludes=e}}),i.listBackupJobs({data:{find:{type:s.BACKUP_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.jobs.length;n++)t.jobs.push(e.jobs[n]),void 0===t.excludes[e.jobs[n]._id]&&(t.excludes[e.jobs[n]._id]=[])}});var r=function(e){var n=e.replace(/\/+$/,""),a=n+"/";return t.excludes[t.selected_job].indexOf(n)>=0||t.excludes[t.selected_job].indexOf(a)>=0},l=function(e){return!!e.trim()&&!s.PATH_FILTER_PATTERNS.test(e)};t.addMultiListRow=function(){t.listTitle=a.t("Directories and Files to exclude"),t.listData=t.excludes[t.selected_job].join("\n"),t.listUIB=o.open({size:"xl",template:"listSelection",scope:t,noController:!0}),t.listUIB.result.then(function(e){for(;t.excludes[t.selected_job].length;)t.excludes[t.selected_job].pop();e=e.split("\n");for(var i=[],s=[],o=0;o<e.length;o++)r(e[o])?s.push(e[o]):l(e[o])?t.excludes[t.selected_job].indexOf(e[o])<0&&t.excludes[t.selected_job].push(e[o]):i.push(e[o]);i.length&&n.error(a.t('The following paths ("%s") is invalid. The path must start with a "/" and can\'t have trailing "/"'+("include"===type?", also patterns are not allowed.":"."),i.join(", "))),s.length&&n.error(a.t('The provided path(s) ("%s") already exists on the list.',s.join(", ")))},function(){})},t.addListRow=function(){var e=t.excluderow.trim();r(e)?n.error(a.t('The provided path ("%s") already exists on the list.',e)):l(e)?t.excludes[t.selected_job].push(e):n.error(a.t('The provided path ("%s") is invalid. The path must start with a "/"',e)),t.excluderow=""},t.ok=function(){i.manageAccountExcludeList({data:{_id:t.account._id,excludes:t.excludes},success:function(t,a){e.close(),n.success(a)},failed:function(e){n.error(e)}})},t.cancel=function(){e.dismiss(a.t("cancel"))}}])}),define("controllers/modifyDatabasesExcludes",["app"],function(e){e.controller("modifyDatabasesExcludes",["$uibModalInstance","$rootScope","$scope","$routeParams","$location","permissions","lang","db_excludes",function(e,t,n,a,i,s,o,c){n.dbExcludesSections=[{_id:"mysql",name:o.t("MySQL"),template:"modifyMySQLExcludes",icon:"fa-database",hidden:!1},{_id:"postgresql",name:o.t("PostgreSQL"),template:"modifyPostgreSQLExcludes",icon:"fa-database",hidden:!1},{_id:"mongodb",name:o.t("MongoDB"),template:"modifyMongoDBExcludes",icon:"fa-database",hidden:!1}],n.getDBExcludesSection=function(e){for(var t=0;t<n.dbExcludesSections.length;t++)if(n.dbExcludesSections[t]._id===e)return n.dbExcludesSections[t];return n.dbExcludesSections[0]},n.loadDBExcludesSection=function(e){n.currentDBExcludesSection=e,n.dbExcludesSection=n.includePath(e.template)},n.loadDBExcludesSection(n.getDBExcludesSection(a.section?a.section:"mysql")),void 0===c&&(c={mysql_exclude_db_by_size:0,postgresql_exclude_db_by_size:0,mongodb_exclude_db_by_size:0}),n.excludes={mysql_exclude_db_by_size:c.mysql_exclude_db_by_size,postgresql_exclude_db_by_size:c.postgresql_exclude_db_by_size,mongodb_exclude_db_by_size:c.mongodb_exclude_db_by_size},n.ok=function(){e.close(n.excludes)},n.cancel=function(){e.dismiss(o.t("cancel"))}}])}),define("controllers/destinations",["app"],function(e){e.controller("destinations",["$rootScope","$scope","$location","$timeout","api","meta","lang","alert","confirm","consts",function(e,t,n,a,i,s,o,c,r,l){function u(e,n){t.saveing||(t.saveing=!0,void 0===!e&&(e={}),i.manageDestination({data:e,success:function(e,a){t.saveing=!1,void 0!==n&&n({success:!0,data:e,message:a})},failed:function(e){c.error(e),void 0!==n&&n({success:!1,data:{},message:e})}}))}e.$emit("menuItem","Destinations"),t.loadingDestinations=!1,t.destinations=[],t.checkReindexTimeout=void 0,t.types={},t.filter="",t.filterOptions=[{label:o.t("All Destinations"),value:""}],t.saveing=!1,t.jobs={},t.loaders={state:!1,validation:!1,dr:!1,hide:!1,delete:!1,reindex:!1,speed:!1},s=s.new("destinations"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("name"),s.getSortDirection()||s.setSortDirection("asc"),s.setSortFields(["name","type","owner","engine","count","disabled","dr"]),s.setTotalItems(t.destinations.length),t.onClickDelete=function(e){if(!t.saveing){if(e.jobs_count>0)return c.error(o.t("This destination has an assigned jobs, Please remove those jobs before deleting this destination.")),!1;t.saveing=!0,t.loaders.delete=!0,r.open({message:o.t("This destination will be permanently deleted!"),confirm:function(){i.deleteDestination({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),c.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,c.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}})}},t.measureSpeed=function(e){t.saveing||(t.saveing=!0,t.loaders.speed=!0,r.open({message:o.t("JetBackup will use a 100MB file for the speed test, and depending on your destination, charges may apply."),confirm:function(){i.measureDestinationSpeed({data:{_id:e._id},success:function(n,a){t.saveing=!1,t.loaders.speed=!1,c.success(a),e.speed=n.speed},failed:function(e){t.saveing=!1,t.loaders.speed=!1,c.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.speed=!1}}))},t.reindex=function(e){t.saveing||(t.saveing=!0,t.loaders.reindex=!0,r.open({message:o.t("All running processes (backup, restore and etc) related to this destination will be aborted"),confirm:function(){i.reindexDestination({data:{_id:e._id},success:function(n,a){t.saveing=!1,t.loaders.reindex=!1,c.success(a),e.reindex=!0,t.checkReindex()},failed:function(e){t.saveing=!1,t.loaders.reindex=!1,c.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.reindex=!1}}))},t.toggleDR=function(e){t.loaders.dr=!0;var n=!e.dr;u({_id:e._id,action:"modify",dr:n},function(a){t.loaders.dr=!1,a.success&&(e.dr=n)})},t.toggleStatus=function(e){t.loaders.state=!0;var a=!e.disabled;if(a||"Clones"===e.type){if(t.saveing)return;t.saveing=!0,i.manageDestinationState({data:{_id:e._id,disabled:a},success:function(n,i){t.saveing=!1,t.loaders.state=!1,e.disabled=a,c.success(i)},failed:function(e){t.saveing=!1,t.loaders.state=!1,c.error(e)}})}else var s=r.open({message:o.t("WARNING: By Enabling the Destination you are also enabling automated tasks to run in the background for this destination. This could result in backups being cleaned using the Manual Backups TTL or Orphan Backups TTL settings. Are you sure you want to enable and perform background tasks on the destination?"),buttons:[{label:o.t("Change Settings"),class:"btn-primary",click:function(){n.path("/settings"),s.dismiss()}}],confirm:function(){t.saveing||(t.saveing=!0,i.manageDestinationState({data:{_id:e._id,disabled:a},success:function(n,i){t.saveing=!1,t.loaders.state=!1,e.disabled=a,c.success(i)},failed:function(e){t.saveing=!1,t.loaders.state=!1,c.error(e)}}))},cancel:function(){t.loaders.state=!1}})},t.toggleHidden=function(e){t.loaders.hide=!0;var n=!e.hidden;u({_id:e._id,action:"modify",hidden:n},function(a){t.loaders.hide=!1,a.success&&(e.hidden=n)})},t.validateDestination=function(e){t.saveing||(t.saveing=!0,t.loaders.validation=!0,i.validateDestination({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.validation=!1,c.success(n)},failed:function(e){t.saveing=!1,t.loaders.validation=!1,c.error(e)}}))},t.listDestinations=function(e){void 0!==e&&"function"==typeof e||(e=function(){});var n={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};t.filter&&(n.find.type=t.filter),n.sort[s.getSortBy()]=s.getSortDirectionInt(),i.listDestinations({data:n,success:function(t,n){e({success:!0,data:t,message:n})},failed:function(t,n){e({success:!1,data:t,message:n})}})},t.fetch=function(){t.loadingDestinations||(t.loadingDestinations=!0,t.listDestinations(function(e){t.destinations=[],t.loadingDestinations=!1,s.setTotalItems(e.data.total),s.calculate(e.data.destinations);for(var n=!1,a=0;a<e.data.destinations.length;a++){var i=e.data.destinations[a];t.destinations.push(i),i.reindex&&(n=!0)}n&&t.checkReindex()}))},t.getDestination=function(e){for(var n=0;n<t.destinations.length;n++)if(t.destinations[n]._id==e)return t.destinations[n];return null},t.checkReindex=function(){t.listDestinations(function(e){for(var n=!1,a=0;a<e.data.destinations.length;a++){var i=e.data.destinations[a];i.reindex&&(n=!0);var s=t.getDestination(i._id);s&&(s.reindex=i.reindex)}n&&(t.checkReindexTimeout=setTimeout(t.checkReindex,3e3))})},t.$on("$destroy",function(){t.checkReindexTimeout&&(clearTimeout(t.checkReindexTimeout),t.checkReindexTimeout=null)}),i.listDestinationTypes({success:function(e){t.types=e;for(var n=0;n<e.types.length;n++)t.filterOptions.push({label:l.DESTINATION_JOB_TYPE_NAMES[e.types[n].type]+" - "+e.types[n].name,value:e.types[n].key})}}),i.listBackupJobs({success:function(e){for(var n=0;n<e.jobs.length;n++)for(var a=e.jobs[n],i=0;i<a.destination.length;i++)void 0===t.jobs[a.destination[i]]&&(t.jobs[a.destination[i]]=[]),t.jobs[a.destination[i]].push(a)}}),a(t.fetch)}])}),define("controllers/destinationManage",["app"],function(e){e.controller("destinationManage",["$rootScope","$scope","$routeParams","$q","$location","$timeout","api","meta","util","confirm","permissions","lang","consts","alert",function(t,n,a,i,s,o,c,r,l,u,d,_,f,p){t.$emit("menuItem","Destinations"),n.details={job_type:f.DESTINATION_JOB_TYPE_BACKUP,type:"",owner:n.loggedAccount._id,owner_name:n.loggedAccount.username,disk_limit:0,threads:10,readonly:0,options:{}},n.forks={backup:0,queueable:0,system:0,total:0},n.saveData=l.duplicateObject(n.details),n.autocomplete={accountText:n.saveData.owner_name},n.saveData.disk_limit=95,n.saveing=!1,n.changed=!0,n.forkThreads=0,n.types={},n.types[f.DESTINATION_JOB_TYPE_BACKUP]=[],n.types[f.DESTINATION_JOB_TYPE_CLONE]=[],n.publicDir="",n.plugin={},n.plugin_available={},n.plugins_available={},n.installing=!1,n.experimental="",n.disklimits=[{label:_.t("Disabled"),value:0},{label:"50%",value:50},{label:"55%",value:55},{label:"60%",value:60},{label:"65%",value:65},{label:"70%",value:70},{label:"75%",value:75},{label:"80%",value:80},{label:"85%",value:85},{label:"90%",value:90},{label:"95%",value:95}],n.isAvailableDestinations=function(){return n.saveData.type&&n.saveData.type.indexOf("AvailableDestinations")>=0},n.selectAccount=function(e){if(void 0!==e){n.saveData.owner=e._id,n.saveData.owner_name=e.username,n.autocomplete.accountText=e.username;var t=document.activeElement;t&&t.blur()}},n.searchAccounts=function(e){if(e){var t=i.defer();return c.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]},n.resetOptions=function(){n.options={disklimit:!0,threads:!1}},n.loadTemplate=function(t){if(t){if(t.indexOf("::")>=0){var a=t.split("::");t=a[0],n.plugin_available=n.plugins_available[a[1]]}switch(n.resetOptions(),t){case"AvailableDestinations":n.destinationType=n.includePath("destinations/"+t),n.experimental=void 0!==n.plugin_available.experimental?n.plugin_available.experimental:"";break;default:if(void 0===n.plugin[t])return;_.setDefaultNS("plugins-destination-"+t),e.registerPluginController(n.plugin[t],function(e){n.publicDir=e,n.destinationType=n.publicDir+"/view.htm?v="+n.plugin[t].version,n.experimental=n.plugin[t].experimental})}}},n.loadDestinationType=function(e){void 0===e&&(e=!1),e&&(n.saveData.options={}),n.loadTemplate(n.saveData.type)},n.toggleEngine=function(e){if(void 0!==e)return e.checked&&(e.engine=1),e.checked},n.resetOptions(),n.$on("options",function(e,t){for(var a in t)n.options[a]=t[a]}),n.$watch("saveData.job_type",function(){a.id||(void 0!==n.types[n.saveData.job_type][0]?(n.details.type=n.types[n.saveData.job_type][0].value,n.saveData.type=n.types[n.saveData.job_type][0].value,n.loadDestinationType()):(n.details.type="",n.saveData.type=""))},!0),n.$watch("saveData",function(){n.changed=l.isChanged(n.saveData,n.details,["_id"]),n.forkThreads=n.forks.total>0?Math.ceil(n.saveData.threads/n.forks.total):0},!0),n.$on("$destroy",function(){!n.changed||n.cancelled||n.disasterRecovery||u.open({message:_.t("You didn't saved your changes"),confirm:n.saveChanges,cancelLabel:_.t("Disregard Changes"),confirmLabel:_.t("Save")})}),n.cancel=function(){s.path("/destinations")},n.saveChanges=function(e,t){if(!n.saveing){n.saveing=!0;var a=l.saveParams(n.saveData,n.details,[],function(e){return void 0===n.details._id&&"type"===e});a.action=n.details._id?"modify":"create",c.manageDestination({data:a,success:function(a,i){n.saveing=!1,n.details=a,n.saveData=l.duplicateObject(n.details),void 0===t&&(e?s.path("/destinationManage/"+a._id):s.path("/destinations"),p.success(i)),void 0!==t&&"function"==typeof t&&t()},failed:function(e){n.saveing=!1,p.error(e),void 0!==t&&"function"==typeof t&&t()}})}},n.installDestination=function(){n.installing||(n.installing=!0,u.open({message:_.t("This destination will be installed on this server!"),confirm:function(){c.installPlugin({data:{package_id:n.plugin_available._id,disabled:0},success:function(e,t){n.installing=!1,n.plugin_available={},n.loadDestinations(function(){n.saveData.type=e.code,n.loadDestinationType(),p.success(t)})},failed:function(e){n.installing=!1,p.error(e)}})},cancel:function(){n.installing=!1}}))},n.loadDestinations=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),n.types[f.DESTINATION_JOB_TYPE_BACKUP]=[],n.types[f.DESTINATION_JOB_TYPE_CLONE]=[],n.plugins_available={},c.listDestinationTypes({success:function(t){for(var i=0;i<t.types.length;i++){var s=t.types[i];("Local"!=s.key&&"Localv2"!=s.key||d.isRoot)&&(n.types[s.type].push({label:s.name+(s.experimental?" - "+_.t("Experimental"):""),value:s.key,group:_.t("Installed Destinations")}),n.plugin[s.key]={type:f.PLUGIN_TYPE_DESTINATION,code:s.key,job_type:s.type,version:s.version,experimental:s.experimental},n.details.type||a.id||(n.details.type=s.key,n.saveData.type=s.key,n.loadDestinationType()))}c.listPackagesAvailable({data:{find:{type:f.PLUGIN_TYPE_DESTINATION}},success:function(t){for(var a=0;a<t.packages.length;a++){var i=t.packages[a];n.plugins_available[i.code]=i,n.types[f.DESTINATION_JOB_TYPE_BACKUP].push({label:_.t("%s via %s",i.name,i.repo_name)+(i.experimental?" - "+_.t("Experimental"):""),value:"AvailableDestinations::"+i.code,group:_.t("Available Destinations")})}e()},failed:function(){e()}})}})},n.loadDestinations(function(){a.id&&c.getDestination({data:{_id:a.id},success:function(e){n.details=e,"[object Object]"!=={}.toString.apply(n.details.options)&&(n.details.options={}),n.saveData=l.duplicateObject(n.details),n.autocomplete.accountText=n.saveData.owner_name,n.loadDestinationType()}})}),c.getSettings({data:{section:"performance"},success:function(e){n.forks={backup:e.backup_forks,queueable:e.queueable_forks,system:e.system_forks,total:e.backup_forks+e.queueable_forks+e.system_forks}}})}])}),define("controllers/disasterRecovery",["app"],function(e){e.controller("disasterRecovery",["$rootScope","$scope","$location","$timeout","api","meta","confirm","PermPermissionStore","lang","alert",function(e,t,n,a,i,s,o,c,r,l){if(t.disasterRecovery=!0,t.saveing=!1,t.newInstallation=!1,t.loadingMessage="",t.saveToDB=function(){sessionStorage.disasterRecovery=JSON.stringify({details:t.details,step:t.currentStep})},t.steps=[{title:r.t("What to do next?"),description:r.t("Please select whether to start to recover your server from a disaster, continue with the default JetBackup configuration, or keep current configuration"),template:"disasterRecovery/selection"},{title:r.t("JB Configurations destination"),description:r.t("Connect to the destination where the JetBackup configuration files are stored"),template:"disasterRecovery/destination"},{title:r.t("Available JB configuration files"),description:r.t("Select the desired JB configuration file"),template:"disasterRecovery/backups"},{title:r.t("Adjust Settings"),description:r.t("Adjust the settings"),template:"disasterRecovery/settings"},{title:r.t("Accounts to recover"),description:r.t("Select the desired accounts you want to restore"),template:"disasterRecovery/accounts"}],sessionStorage.disasterRecovery){var u=JSON.parse(sessionStorage.disasterRecovery);t.details=u.details,t.currentStep=u.step}else t.currentStep=0,t.details={destination_id:"",drbackups:[],drbackup:""},t.saveToDB();t.$watch("details",function(){t.saveToDB()},!0),t.changeStep=function(e){t.currentStep=e,t.saveToDB(),t.currentStepView=t.includePath(t.steps[e].template)},t.changeStep(t.currentStep),t.exitDRSure=function(t){void 0!==t&&"function"==typeof t||(t=function(e){}),o.open({message:r.t("Are you sure you want to exit disaster recovery mode?"),confirm:function(){delete sessionStorage.disasterRecovery,t(function(){window.location=e.path.location+window.location.search})}})},t.freshInstallation=function(){t.exitDRSure(function(e){void 0!==e&&"function"==typeof e||(e=function(){}),t.newInstallation=!0,i.factoryReset({success:e,failed:function(e){t.newInstallation=!1,l.error(e)}})})},t.startDR=function(){o.open({message:r.t("Are you sure you want start disaster recovery? All current data will be lost"),confirm:function(){t.loadingMessage=r.t("Dropping all JetBackup data from database"),i.factoryReset({data:{drmode:!0},success:function(){t.nextStep()},failed:function(e){l.error(e)}})}})},t.exitDR=function(){t.exitDRSure(function(e){void 0!==e&&"function"==typeof e||(e=function(){}),i.exitDisasterRecovery({success:e,failed:function(e){l.error(e)}})})},t.nextStep=function(){t.saveing||(t.saveing=!0,t.loadingMessage="",e.$broadcast("nextStep"))},t.startOver=function(){t.saveing||(delete sessionStorage.disasterRecovery,t.changeStep(1))},t.$on("nonrecoverable",function(e,n){t.saveing=!1,l.error(r.t("Failed restoring JB Configurations, the DR Wizard will now exit and start over. Error: %s",n)),t.loadingMessage=r.t("Dropping all JetBackup data from database"),i.factoryReset({data:{drmode:!0},success:function(){t.loadingMessage="",t.startOver()},failed:function(e){l.error(e)}})}),t.$on("error",function(e,n){t.saveing=!1,l.error(n),t.loadingMessage=""}),t.$on("loadingMessage",function(e,n){t.loadingMessage=n}),t.$on("commitNextStep",function(e,n){for(var a in n)t.details[a]=n[a];t.saveing=!1,t.changeStep(t.currentStep+1),t.loadingMessage=""})}])}),define("controllers/disasterRecovery/selection",["app"],function(e){e.controller("disasterRecoverySelection",["$rootScope","$scope","api",function(e,t,n){t.installed=!1,n.getSettings({data:{section:"general"},success:function(e){t.installed=e.installed}}),t.$on("nextStep",function(){t.$emit("commitNextStep",{})})}])}),define("controllers/disasterRecovery/destination",["app"],function(e){e.controller("disasterRecoveryDestination",["$rootScope","$scope","$routeParams","$location","$timeout","api","consts","lang","util",function(e,t,n,a,i,s,o,c,r){t.destination_id="",t.reindex=function(e,t){void 0!==t&&"function"==typeof t||(t=function(){}),s.reindexDestination({data:{_id:e,backup_type:o.BACKUP_TYPE_JB_CONFIG},success:function(e){var n=setInterval(function(){s.getQueueGroup({data:{_id:e._id},success:function(e){e.status<o.QUEUE_STATUS_COMPLETED||(null!==n&&clearInterval(n),n=null,t({success:e.status==o.QUEUE_STATUS_COMPLETED,message:c.t("Reindex process finished with %s status",o.QUEUE_STATUS_NAMES[e.status])}))},failed:function(e){null!==n&&clearInterval(n),n=null,t({success:!1,message:e})}})},5e3)},failed:function(e){t({success:!1,message:e})}})};var l=function(e,n){void 0===n&&(n=function(){}),s.listBackups({data:{destination:t.destination_id,type:o.BACKUP_TYPE_JB_CONFIG,contains:e,sort:{created:-1}},success:function(e){n(e)},failed:function(e){s.deleteDestination({data:{_id:t.destination_id}}),t.$emit("error",e)}})};t.$on("nextStep",function(){t.$emit("loadingMessage",c.t("Creating destination and reindexing JB configurations backups..."));var e=r.saveParams(t.saveData,t.details,[],function(e){return void 0===t.details._id&&"type"===e});e.name="DR destination "+(new Date).getTime(),e.readonly=!0,e.no_reindex=!0,e.action="create",s.manageDestination({data:e,success:function(e){t.destination_id=e._id,t.reindex(t.destination_id,function(e){if(!e.success)return s.deleteDestination({data:{_id:t.destination_id}}),void t.$emit("error",e.message);l(o.BACKUP_TYPE_JB_CONFIG_FULL,function(e){var n=e.backups;l(o.BACKUP_TYPE_JB_CONFIG_FULL^o.BACKUP_TYPE_JB_CONFIG_WIREDTIGER,function(e){for(var a=0;a<e.backups.length;a++)n.push(e.backups[a]);if(!n.length)return s.deleteDestination({data:{_id:t.destination_id}}),void t.$emit("error",c.t("No JetBackup 5 configuration files found on this destination. Please verify the Destination Path is set to a directory that includes JetBackup 5 Configuration Backups."));t.$emit("commitNextStep",{destination_id:t.destination_id,drbackups:n,drbackup:n[0]._id})})})})},failed:function(e){t.$emit("error",e)}})})}])}),define("controllers/disasterRecovery/settings",["app"],function(e){e.controller("disasterRecoverySettings",["$rootScope","$scope","$routeParams","$location","$timeout","api","consts","lang","util",function(t,n,a,i,s,o,c,r,l){n.saveData={general:{},performance:{},resource:{},options:{}},n.validateOptions={},n.settingsSection="",o.getSettings({data:{section:"general"},success:function(e){n.saveData.general=e,n.general=l.duplicateObject(n.saveData.general)}}),o.getSettings({data:{section:"performance"},success:function(e){n.saveData.performance=e,n.performance=l.duplicateObject(n.saveData.performance)}}),o.getSettings({data:{section:"resource"},success:function(e){n.saveData.resource=e,n.resource=l.duplicateObject(n.saveData.resource)}}),o.getSettings({data:{section:"panel"},success:function(e){n.saveData.options=e.options,n.panel=l.duplicateObject(n.saveData.options)}}),n.$on("validateOptions",function(e,t){n.validateOptions=t}),e.registerController("panelSettings","plugins/panel",function(e){n.settingsSection=n.includePath("panel/view","plugins")}),n.$on("nextStep",function(){n.$emit("loadingMessage",r.t("Adjusting settings..."));for(var e in n.saveData.options)if(void 0!==n.validateOptions[e]&&!n.validateOptions[e].validation(n.saveData.options[e]))return void n.$emit("error",r.t("Invalid value provided for %s",n.validateOptions[e].name));var t=l.saveParams(n.saveData.general,n.general);t.section="general";var a=l.saveParams(n.saveData.performance,n.performance);a.section="performance";var i=l.saveParams(n.saveData.resource,n.resource);i.section="resource";var s=l.saveParams(n.saveData.options,n.panel);o.manageSettings({data:t,success:function(){o.manageSettings({data:a,success:function(){o.manageSettings({data:i,success:function(){o.manageSettings({data:{section:"panel",options:s},success:function(){n.$emit("commitNextStep",{})},failed:function(e){n.$emit("error",e)}})},failed:function(e){n.$emit("error",e)}})},failed:function(e){n.$emit("error",e)}})},failed:function(e){n.$emit("error",e)}})})}])}),define("controllers/disasterRecovery/backups",["app"],function(e){e.controller("disasterRecoveryBackups",["$rootScope","$scope","$routeParams","$location","$timeout","api","consts","lang","popup",function(e,t,n,a,i,s,o,c,r){t.restore=function(e,n){t.$emit("loadingMessage",c.t("Restoring selected JB configurations backup..."));var a={type:o.QUEUE_ITEM_TYPE_RESTORE,items:[e]};void 0!==n&&(a.encryption_key=n),s.addQueueItems({data:a,success:function(e){t.failedCounter=0;var a=setInterval(function(){s.getQueueGroup({data:{_id:e._id},success:function(e){var i=parseInt(e.status);if(i<o.QUEUE_STATUS_COMPLETED)return void(i>o.QUEUE_STATUS_PROCESSING&&t.$emit("loadingMessage",o.QUEUE_STATUS_SUB_NAMES[e.type][i]));if(null!==a&&clearInterval(a),a=null,i===o.QUEUE_STATUS_COMPLETED){var r={};return void 0!==n&&(r.private_key=n),void t.$emit("commitNextStep",r)}s.listQueueItems({data:{group_id:e._id},success:function(e){var n="";n=void 0===e.items[0]?c.t("Restore process finished with %s status",o.QUEUE_STATUS_NAMES[i]):e.items[0].message,e.items[0].data.nonrecoverable?t.$emit("nonrecoverable",n):t.$emit("error",n)},failed:function(e){t.$emit("error",e)}})},failed:function(e){
t.failedCounter++<10||(null!==a&&clearInterval(a),a=null,t.$emit("error",e))}})},5e3)},failed:function(e){t.$emit("error",e)}})},t.$on("nextStep",function(){for(var e={_id:t.details.drbackup},n=0;n<t.details.drbackups.length;n++)if(e._id===t.details.drbackups[n]._id){e=t.details.drbackups[n];break}e.encrypted?(t.privateKeyUIB=r.open({template:"encryptionKeySelection",noController:!0,scope:t}),t.privateKeyUIB.result.then(function(n){if(!n)return void t.$emit("error",c.t("You must provide root master key"));t.restore(e._id,n)},function(){t.$emit("error",c.t("You must provide root master key"))})):t.restore(e._id)})}])}),define("controllers/disasterRecovery/accounts",["app"],function(e){e.controller("disasterRecoveryAccounts",["$rootScope","$scope",function(e,t){t.drMode=!0}])}),define("controllers/restoreConditions",["app"],function(e){e.controller("restoreConditions",["$rootScope","$scope","$location","$timeout","$interval","$q","api","meta","confirm","alert","lang",function(e,t,n,a,i,s,o,c,r,l,u){e.$emit("menuItem","Settings"),t.conditions=[],t.loadingConditions=!1,t.loaders={state:!1,delete:!1},c=c.new("restore_conditions"),t.meta=c,t.metaData=c.getData(),c.getSortBy()||c.setSortBy("title"),c.getSortDirection()||c.setSortDirection("asc"),c.setSortFields(["title","content","type"]),c.setTotalItems(t.conditions.length),t.toggleState=function(e){o.manageRestoreCondition({data:{action:"modify",_id:e._id,disabled:!e.disabled},success:function(n,a){t.loaders.state=!1,e.disabled=n.disabled,l.success(a)},failed:function(e){l.error(e)}}),t.loaders.state=!0},t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,r.open({message:u.t("This restore condition will be permanently deleted!"),confirm:function(){o.deleteRestoreCondition({data:{_id:e._id},success:function(e,n){t.loaders.delete=!1,t.saveing=!1,t.fetch(),l.success(n)},failed:function(e){t.loaders.delete=!1,t.saveing=!1,l.error(e)}})},cancel:function(){t.loaders.delete=!1,t.saveing=!1}}))},t.fetch=function(){t.loadingConditions=!0;var e={sort:{},skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter()};e.sort[c.getSortBy()]=c.getSortDirectionInt(),t.conditions=[],o.listRestoreConditions({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.conditions),t.conditions=e.conditions,t.loadingConditions=!1}})},a(t.fetch)}])}),define("controllers/restoreConditionManage",["app"],function(e){e.controller("restoreConditionManage",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","util","confirm","lang","alert",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Settings"),t.details={},t.saveData={condition:""},t.saveing=!1,t.changed=!1,t.cancelled=!1,t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("$destroy",function(){t.changed&&!t.cancelled&&l.open({message:u.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:u.t("Disregard Changes"),confirmLabel:u.t("Save")})}),t.cancel=function(){t.cancelled=!0,a.path("/restoreConditions")},t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n=r.saveParams(t.saveData,t.details);n.action=t.details._id?"modify":"create",o.manageRestoreCondition({data:n,success:function(n,i){t.saveing=!1,t.changed=!1,t.saveData._id=response.data._id,t.details=r.duplicateObject(t.saveData),e?a.path("/restoreConditionManage/"+n._id):a.path("/restoreConditions"),d.success(i)},failed:function(e){t.saveing=!1,d.error(e)}})}},t.fetch=function(){o.getRestoreCondition({data:{_id:n.id},success:function(e){t.details=e,t.saveData=r.duplicateObject(t.details)}})},n.id&&i(t.fetch())}])}),define("controllers/backupJobs",["app"],function(e){e.controller("backupJobs",["$rootScope","$scope","$location","$timeout","$sce","$interval","$q","api","meta","lang","filter","consts","confirm","alert",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","BackupJobs"),t.jobs=[],t.checkingJob={},t.loadingJobs=!1,t.filters={},t.destinations=void 0,t.running={},t.checkRunningInterval=null,t.run_now=!1,t.currentTime=parseInt(Date.now()/1e3),s(function(){t.currentTime=parseInt(Date.now()/1e3)},100),t.loaders={state:!1,quota:!1,runnow:!1,duplicate:!1,delete:!1},r=r.new("backup_jobs"),t.meta=r,t.metaData=r.getData(),r.getSortBy()||r.setSortBy("name"),r.getSortDirection()||r.setSortDirection("asc"),r.setSortFields(["name","type","owner","retain","last_run","disabled"]),r.setTotalItems(t.jobs.length),t.viewLogs=function(e){u.new("logs_filter").setFilter(d.LOG_TYPE_BACKUP),u.new("logs_subfilter").setFilter(e._id),t.changeView("/logs")},t.duplicate=function(e){_.open({message:l.t("This backup job will be duplicated!"),confirm:function(){t.loaders.duplicate=!0,c.duplicateBackupJob({data:{_id:e._id},success:function(e,n){t.loaders.duplicate=!1,t.fetch(),f.success(n)},failed:function(e){t.loaders.duplicate=!1,f.error(e)}})},cancel:function(){t.saveing=!1}})},t.toggleState=function(e){t.loaders.state=!0;var n=!e.disabled;c.manageBackupJob({data:{action:"modify",_id:e._id,disabled:n},success:function(n){t.loaders.state=!1,e.disabled=n.disabled,e.next_run=n.next_run},failed:function(e){t.loaders.state=!1,f.error(e)}})},t.toggleBackupQuota=function(e){t.loaders.quota=!0;var n=!e.backup_quota;c.manageBackupJob({data:{action:"modify",_id:e._id,backup_quota:n},success:function(){t.loaders.quota=!1,e.backup_quota=n},failed:function(e){t.loaders.quota=!1,f.error(e)}})},t.runBackupJobManually=function(e){t.loaders.runnow||(t.loaders.runnow=!0,c.runBackupJobManually({data:{_id:e._id},success:function(n,a){t.loaders.runnow=!1;for(var i in n)e[i]=n[i];t.running[e._id]=e,f.success(a)},failed:function(e){t.loaders.runnow=!1,f.error(e)}}))},t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,_.open({message:l.t("This backup job will be permanently deleted!"),confirm:function(){c.deleteBackupJob({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),f.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,f.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},c.listAccountFilters({success:function(e){for(var n=0;n<e.filters.length;n++)t.filters[e.filters[n].group_id]=e.filters[n].name}}),t.createBackupJob=function(){t.destinationsCheck(function(){t.changeView("/backupJobManage")})},t.destinationsCheck=function(e){if(void 0===e&&(e=function(){}),void 0!==t.destinations)return t.destinations?void e():void f.error(l.t("You must first create a destination before creating a backup job for this server"));t.destinations=!1,c.listDestinations({data:{readonly:0},success:function(n){if(t.destinations=!!n.destinations.length,!t.destinations)return void f.error(l.t("You must first create a destination before creating a backup job for this server"));e()},failed:function(e){f.error(e)}})},t.checkRunning=function(){for(var e in t.running)c.getBackupJob({data:{_id:e},success:function(n){if(!n.running){for(var a in n)t.running[e][a]=n[a];delete t.running[e]}}})},t.$on("$destroy",function(){null!==t.checkRunningInterval&&(clearInterval(t.checkRunningInterval),t.checkRunningInterval=null)}),t.fetch=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),t.loadingJobs=!0;var n={sort:{},skip:r.getSkip(),limit:r.getPageSize(),filter:r.getFilter()};n.sort[r.getSortBy()]=r.getSortDirectionInt(),t.jobs=[],t.running={},c.listBackupJobs({data:n,success:function(n){r.setTotalItems(n.total),r.calculate(n.jobs),t.jobs=n.jobs;for(var a=0;a<t.jobs.length;a++){var s=t.jobs[a],o=parseInt(s.type),c=parseInt(s.contains),u=[];switch(o){case d.BACKUP_TYPE_ACCOUNT:c==d.BACKUP_TYPE_ACCOUNT_FULL?u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_FULL]):(c&d.BACKUP_TYPE_ACCOUNT_CONFIG&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_CONFIG]),c&d.BACKUP_TYPE_ACCOUNT_HOMEDIR&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_HOMEDIR]),c&d.BACKUP_TYPE_ACCOUNT_DATABASES&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_DATABASES]),c&d.BACKUP_TYPE_ACCOUNT_EMAILS&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_EMAILS]),c&d.BACKUP_TYPE_ACCOUNT_CRON_JOBS&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_CRON_JOBS]),c&d.BACKUP_TYPE_ACCOUNT_DOMAINS&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_DOMAINS]),c&d.BACKUP_TYPE_ACCOUNT_CERTIFICATES&&u.push(d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_CERTIFICATES]));break;case d.BACKUP_TYPE_DIRECTORY:u.push(d.BACKUP_TYPE_DIRECTORY_NAMES[d.BACKUP_TYPE_DIRECTORY_FULL]);break;case d.BACKUP_TYPE_JB_CONFIG:u.push(d.BACKUP_TYPE_JB_CONFIG_NAMES[d.BACKUP_TYPE_JB_CONFIG_FULL]);break;case d.BACKUP_TYPE_DR:u.push(d.BACKUP_TYPE_DR_NAMES[d.BACKUP_TYPE_DR_FULL])}if(s.contains_name=u.join(", "),s.filters_sorted=[],void 0!==s.filters)for(var _=0;_<s.filters.length;_++)for(var f=0;f<s.filters[_].length;f++)s.filters_sorted.push(s.filters[_][f]);s.running&&(t.running[s._id]=s);var p=[];s.destinations="";for(var g=0;g<s.destination_details.length;g++)p.push(s.destination_details[g].name+(s.destination_details[g].disabled?' <span style="color: #cc0000; font-size: 11px;">('+l.t("Disabled")+")</span>":""));s.destinations=i.trustAsHtml(p.join(", "))}t.loadingJobs=!1,e()}})},a(function(){t.fetch(function(){t.checkRunningInterval=setInterval(t.checkRunning,3e3)})})}])}),define("controllers/backupJobManage",["app"],function(e){e.controller("backupJobManage",["$rootScope","$scope","$routeParams","$templateCache","$route","$location","$timeout","$q","api","meta","util","lang","alert","permissions","consts","filterManager","confirm","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f,p,g,E,T){e.$emit("menuItem","BackupJobs"),t.saveData={name:"",destination:[],owner:t.loggedAccount._id,owner_name:t.loggedAccount.username,type:p.BACKUP_TYPE_ACCOUNT,contains:p.BACKUP_TYPE_ACCOUNT_FULL,mysql_exclude_db_by_size:0,postgresql_exclude_db_by_size:0,mongodb_exclude_db_by_size:0,encrypted:0,retry_failed:0,structure:p.BACKUP_STRUCTURE_INCREMENTAL,time_parsed:"12:00 AM",time:0,monitor:{ranfor:0,notran:0},schedules:[],filters:[],include_list:[],exclude_list:[]},t.autocomplete={accountText:t.saveData.owner_name},t.details={},t.destinations={},t.schedules={},t.filters={},t.backup_job_names={},t.clone_job_names={},t.cancelled=!1,t.excluderow="",t.includerow="",t.type_description=d.t("Backup the account data that you choose - Files, Emails, Databases, Cron Jobs, Domains, SSL & Panel Configs (If relevant)"),t.type_experimental="",t.structures=[{label:p.BACKUP_STRUCTURE_NAMES[p.BACKUP_STRUCTURE_INCREMENTAL],value:p.BACKUP_STRUCTURE_INCREMENTAL},{label:p.BACKUP_STRUCTURE_NAMES[p.BACKUP_STRUCTURE_ARCHIVED],value:p.BACKUP_STRUCTURE_ARCHIVED},{label:p.BACKUP_STRUCTURE_NAMES[p.BACKUP_STRUCTURE_COMPRESSED],value:p.BACKUP_STRUCTURE_COMPRESSED}],t.types=[{label:p.BACKUP_TYPE_NAMES[p.BACKUP_TYPE_ACCOUNT],value:p.BACKUP_TYPE_ACCOUNT}],f.isRoot&&(t.types.push({label:p.BACKUP_TYPE_NAMES[p.BACKUP_TYPE_DIRECTORY],value:p.BACKUP_TYPE_DIRECTORY}),t.types.push({label:p.BACKUP_TYPE_NAMES[p.BACKUP_TYPE_DR],value:p.BACKUP_TYPE_DR})),t.account_types=[{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_CONFIG],value:p.BACKUP_TYPE_ACCOUNT_CONFIG},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_HOMEDIR],value:p.BACKUP_TYPE_ACCOUNT_HOMEDIR},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_DATABASES],value:p.BACKUP_TYPE_ACCOUNT_DATABASES},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_DATABASE_USERS],value:p.BACKUP_TYPE_ACCOUNT_DATABASE_USERS},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_EMAILS],value:p.BACKUP_TYPE_ACCOUNT_EMAILS},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_FTP],value:p.BACKUP_TYPE_ACCOUNT_FTP},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_CRON_JOBS],value:p.BACKUP_TYPE_ACCOUNT_CRON_JOBS},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_DOMAINS],value:p.BACKUP_TYPE_ACCOUNT_DOMAINS},{label:p.BACKUP_TYPE_ACCOUNT_NAMES[p.BACKUP_TYPE_ACCOUNT_CERTIFICATES],value:p.BACKUP_TYPE_ACCOUNT_CERTIFICATES}],t.filtersConditions=[{_id:1,name:d.t("OR")},{_id:2,name:d.t("AND")}],t.filtersStructure=[],t.$watch("saveData.structure",function(){t.saveData.structure!=p.BACKUP_STRUCTURE_ARCHIVED&&t.saveData.structure!=p.BACKUP_STRUCTURE_COMPRESSED&&(t.saveData.encrypted=0)}),t.$watch("filtersStructure",function(){t.buildFilters(!0)},!0),t.addRecommendedExcludes=function(e){if(void 0!==p.RECOMMENDED_EXCLUDES_ACCOUNT[e])for(var n=p.RECOMMENDED_EXCLUDES_ACCOUNT[e],a=0;a<n.length;a++){var i=n[a];t.saveData.exclude_list.indexOf(i)<0&&t.saveData.exclude_list.push(i)}},t.selectAccount=function(e){if(void 0!==e){t.saveData.owner=e._id,t.saveData.owner_name=e.username,t.autocomplete.accountText=e.username;var n=document.activeElement;n&&n.blur()}},t.searchAccounts=function(e){if(e){var t=c.defer();return r.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]},t.buildFilters=function(e){void 0===e&&(e=!1),e?t.saveData.filters=g.buildFilters(t.filtersStructure):void 0!==t.saveData.filters&&(t.filtersStructure=g.reBuildStructure(t.saveData.filters))},t.removeFilter=function(e){t.filtersStructure=g.removeFilter(t.filtersStructure,e)},t.upFilter=function(e){if(0!==e){var n=t.filtersStructure[e],a=t.filtersStructure[e-1];1===e&&(a.cond=n.cond,delete n.cond),t.filtersStructure[e]=a,t.filtersStructure[e-1]=n}},t.downFilter=function(e){if(e!==t.filtersStructure.length-1){var n=t.filtersStructure[e],a=t.filtersStructure[e+1];0===e&&(n.cond=a.cond,delete a.cond),t.filtersStructure[e]=a,t.filtersStructure[e+1]=n}},t.fileBrowse=function(){T.open({size:"lg",template:"fileBrowse",scope:t,resolve:{listPaths:function(){return t.saveData.include_list}}}).result.then(function(e){t.saveData.include_list=e},function(){})},t.filterSelection=function(){T.open({size:"lg",template:"accountFilterGroupSelection",scope:t,resolve:{filters:function(){return t.filters},details:function(){return t.details}}}).result.then(function(e){if(e){var n={_id:e};t.filtersStructure.length>0&&(n.cond=1),t.filtersStructure.push(n)}},function(){})},t.manageDestination=function(){T.open({template:"destinationsSelection",scope:t,resolve:{destinations:function(){return t.saveData.destination},readonly:function(){return!1},types:function(){return p.DESTINATION_JOB_TYPE_BACKUP},legacy:function(){return p.BACKUP_ALLOW_LEGACY_DESTINATION[t.saveData.type]},local:function(){return p.BACKUP_ALLOW_LOCAL_DESTINATION[t.saveData.type]}}}).result.then(function(e){t.saveData.destination=e},function(){})},t.databasesExcludes=function(){T.open({size:"lg",template:"modifyDatabasesExcludes",scope:t,resolve:{db_excludes:function(){return{mysql_exclude_db_by_size:t.saveData.mysql_exclude_db_by_size,postgresql_exclude_db_by_size:t.saveData.postgresql_exclude_db_by_size,mongodb_exclude_db_by_size:t.saveData.mongodb_exclude_db_by_size}}}}).result.then(function(e){t.saveData.mysql_exclude_db_by_size=e.mysql_exclude_db_by_size,t.saveData.postgresql_exclude_db_by_size=e.postgresql_exclude_db_by_size,t.saveData.mongodb_exclude_db_by_size=e.mongodb_exclude_db_by_size},function(){})},t.scheduleSelection=function(e){T.open({size:"lg",template:"scheduleSelection",scope:t,resolve:{schedules:function(){return t.schedules},schedule:function(){return e},details:function(){return t.saveData},retain:function(){return!0}}}).result.then(function(n){if(!n._id||n.retain<=0)return void _.error(d.t("No schedule and/or backups retain selected"));if(n.display=t.scheduleDisplay(n),t.schedules[n._id]=n,void 0!==e)for(var a in n)void 0!==e[a]&&(e[a]=n[a]);else t.saveData.schedules.push({_id:n._id,name:n.name,retain:n.retain,next_run:0});t.checkScheduleTimeMismatch()},function(){})},t.checkScheduleTimeMismatch=function(){for(var e=0,n=0;n<t.saveData.schedules.length;n++){if(void 0===t.schedules[t.saveData.schedules[n]._id])return;var a=t.schedules[t.saveData.schedules[n]._id];if(!([1,2,3,4].indexOf(a.type)<0)&&(1!==a.type&&(e||(e=a.time),a.time!==e)))return void(t.scheduleTimeMismatch=!0)}t.scheduleTimeMismatch=!1},t.removeSchedule=function(e){E.open({message:d.t("Are you sure you want to remove this schedule from this job? Please note that all snapshots assigned to this schedule will be deleted in the next job run."),confirm:function(){for(var n=0;n<t.saveData.schedules.length;n++)if(e._id===t.saveData.schedules[n]._id){t.saveData.schedules.splice(n,1),t.checkScheduleTimeMismatch();break}_.success("Schedule removed successfully")}})},t.timeToStr=function(e){e=parseInt(e);var t="AM";e>=1200&&(t="PM",e-=1200),e=""+e,e.length<2&&(e="0"+e);var n=e.substr(-2),a=e.length>2?e.substr(0,e.length-2):12;return parseInt(a)<10&&(a="0"+parseInt(a)),a+":"+n+" "+t},t.strToTime=function(e){var t=/^([0-9]+):([0-9]+)\s+(AM+|PM+)$/g.exec(e);if(!t)return 0;var n=parseInt(t[1]+t[2]);return n>=1200&&(n-=1200),"PM"===t[3]&&(n+=1200),n},t.validateListPath=function(e,t){return!!e.trim()&&(t?!p.PATH_FILTER_PATTERNS.test(e):!p.PATH_FILTER.test(e))},t.typeChecked=function(e,t){return e&t},t.toggleOptionsTypes=function(e){t.typeChecked(e,t.saveData.options)?t.saveData.options^=e:t.saveData.options|=e},t.checkChange=function(){t.changed=u.isChanged(t.saveData,t.details,["_id"])},t.$watch("saveData",t.checkChange,!0),t.$watch("details",t.checkChange,!0),t.validateSchedules=function(e,t){if(e.length)return t(!0);E.open({message:d.t("We noticed that you didn't set any schedule for this job. That means that this job will never run automatically, only manually"),cancelLabel:d.t("No, let me set schedules"),confirm:function(){t(!0)},cancel:function(){t(!1)}})},t.fetchSchedules=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listSchedules({success:function(n){for(var a=0;a<n.schedules.length;a++){var i=n.schedules[a]._id;t.schedules[i]=n.schedules[a],t.schedules[i].display=t.scheduleDisplay(t.schedules[i])}e()},failed:function(){e()}})},t.fetchFilters=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listAccountFilterGroups({success:function(n){for(var a=0;a<n.groups.length;a++)t.filters[n.groups[a]._id]=n.groups[a];e()},failed:function(){e()}})},t.fetchDestinations=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listDestinations({success:function(n){for(var a=0;a<n.destinations.length;a++){var i=n.destinations[a];i.display=d.t("%s destination",i.type),t.destinations[i._id]=i}e()}})},t.removeDestination=function(e){for(var n=0;n<t.saveData.destination.length;n++)if(e===t.saveData.destination[n]){t.saveData.destination.splice(n,1);break}},t.updateData=function(e){t.details=e,t.saveData=u.duplicateObject(t.details),t.checkScheduleTimeMismatch(),t.buildFilters()},t.toggleBackupType=function(e){switch(e){case p.BACKUP_TYPE_ACCOUNT:t.saveData.contains=p.BACKUP_TYPE_ACCOUNT_FULL,t.type_description=d.t("Backup the account data that you choose - Files, Emails, Databases, Cron Jobs, Domains, SSL & Panel Configs (If relevant)"),t.type_experimental="";break;case p.BACKUP_TYPE_DIRECTORY:t.saveData.contains=p.BACKUP_TYPE_DIRECTORY_FULL,t.type_description=d.t("Backup server files/folders that you choose to include (not necessarily related to accounts)."),t.type_experimental="",void 0===t.saveData.include_list&&(t.saveData.include_list=[]),void 0===t.saveData.exclude_list&&(t.saveData.exclude_list=[]);break;case p.BACKUP_TYPE_DR:t.saveData.contains=p.BACKUP_TYPE_DR_FULL,t.type_description=d.t("Create an entire server backup (BMR) for disaster recovery restore, this will create a bootable ISO to restore from. Note that this works alongside the accounts, so for a full recovery you will need an active all-accounts backup job."),t.type_experimental=d.t('JetApps does not guarantee the error-free functionality of experimental features, and we provide it on an experimental basis only. You assume all risk for any function that you use marked "Experimental". Installation of this software could cause functionality failures, even for experienced administrators. Eventually this function will be released to our STABLE tier, once adequate testing and refinement is completed. Current ETA for STABLE release: Q2 2024')}if(!p.BACKUP_ALLOW_LEGACY_DESTINATION[e]&&t.saveData.destination.length){for(var n=[],a=0;a<t.saveData.destination.length;a++){t.destinations[t.saveData.destination[a]].legacy||n.push(t.saveData.destination[a])}t.saveData.destination=n}},t.toggleContains=function(e){t.typeChecked(e,t.saveData.contains)?t.saveData.contains^=e:t.saveData.contains|=e};var A=function(e,t){var n=e.replace(/\/+$/,""),a=n+"/";return t.indexOf(n)>=0||t.indexOf(a)>=0};t.addListRow=function(e,n){void 0!==t[e]&&t[e].trim()&&(A(t[e].trim(),n)?_.error(d.t('The provided path ("%s") already exists on the list.',t[e].trim())):t.validateListPath(t[e].trim(),"excluderow"===e)?n.push(t[e].trim()):_.error(d.t('The provided path ("%s") is invalid. The path must start with a "/"'+("excluderow"!==e?", also patterns are not allowed.":"."),t[e].trim())),t[e]="")},t.addMultiListRow=function(e,n){"include"==e?(t.listTitle=d.t("Directories and Files to include"),t.listData=t.saveData.include_list.join("\n")):(t.listTitle=d.t("Directories and Files to exclude"),t.listData=t.saveData.exclude_list.join("\n")),t.listUIB=T.open({template:"listSelection",noController:!0,scope:t}),t.listUIB.result.then(function(a){for(;n.length;)n.pop();a=a.split("\n");for(var i=[],s=[],o=0;o<a.length;o++)"include"===e&&A(a[o],n)?s.push(a[o]):"include"===e&&"/"===a[o]||!t.validateListPath(a[o],"exclude"===e)?i.push(a[o]):n.indexOf(a[o])<0&&n.push(a[o]);i.length&&_.error(d.t('The following paths ("%s") is invalid. The path must start with a "/" and can\'t have trailing "/"'+("include"===e?", also patterns are not allowed.":"."),i.join(", "))),s.length&&_.error(d.t('The provided path(s) ("%s") already exists on the list.',s.join(", ")))},function(){})},t.$on("$destroy",function(){t.changed&&!t.cancelled&&E.open({message:d.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:d.t("Disregard Changes"),confirmLabel:d.t("Save")})}),t.cancel=function(){t.cancelled=!0,s.path("/backupJobs")},t.saveChanges=function(e,n){if(!t.saveing){t.saveing=!0;var a=u.saveParams(t.saveData,t.details,["backuptype"]);a.time_parsed&&(a.time=t.strToTime(a.time_parsed)),a.action=t.details._id?"modify":"create",t.validateSchedules(t.saveData.schedules,function(i){i?r.manageBackupJob({data:a,success:function(a,i){t.saveing=!1,t.details=u.duplicateObject(t.saveData),t.updateData(t.details),void 0===n&&(e?s.path("/backupJobManage/"+a._id):s.path("/backupJobs"),_.success(i)),void 0!==n&&"function"==typeof n&&n()},failed:function(e){t.saveing=!1,_.error(e),void 0!==n&&"function"==typeof n&&n()}}):t.saveing=!1})}},t.hideTime=function(){if(!t.saveData.schedules||!t.saveData.schedules.length)return!0;for(var e=0;e<t.saveData.schedules.length;e++)if(t.schedules[t.saveData.schedules[e]._id].type<5)return!1;return!0},t.$on("fetchJobData",function(e,n){t.fetchJobData(n._id,n.callback)}),t.fetchJobData=function(){r.getBackupJob({data:{_id:n.id},success:function(e){t.details=e,t.details.time_parsed=t.timeToStr(t.details.time),t.saveData=u.duplicateObject(t.details),t.autocomplete.accountText=t.saveData.owner_name,t.buildFilters()}})},t.fetchBackupJobs=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listBackupJobs({success:function(n){for(var a=0;a<n.jobs.length;a++)t.backup_job_names[n.jobs[a]._id]=n.jobs[a].name;e()},failed:function(){e()}})},t.fetchCloneJobs=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listCloneJobs({success:function(n){for(var a=0;a<n.jobs.length;a++)t.clone_job_names[n.jobs[a]._id]=n.jobs[a].name;e()},failed:function(){e()}})},t.scheduleDisplay=function(e){var n=[];switch(e.type){case p.SCHEDULE_TYPE_HOURLY:return d.t("Hourly Schedule runs every %s Hours",e.type_data);case p.SCHEDULE_TYPE_DAILY:return n=e.type_data.map(function(e){return p.SCHEDULE_WEEK_DAYS_NAMES[e]}),d.t("Daily Schedule runs every %s",7===e.type_data.length?d.t("day"):n.join(", "));case p.SCHEDULE_TYPE_WEEKLY:return d.t("Weekly Schedule runs every %s",p.SCHEDULE_WEEK_DAYS_NAMES[e.type_data]);case p.SCHEDULE_TYPE_MONTHLY:return n=e.type_data.map(function(e){return(e=String(e))+p.SCHEDULE_TYPE_MONTHLY_SUFFIX[e.substr(e.length-1)]}),d.t("Monthly Schedule runs every %s of every month",n.join(", "));case p.SCHEDULE_TYPE_BACKUP_DONE:return d.t('Runs %safter the "%s" backup job End',e.delay_amount>0?e.delay_amount+" "+p.SCHEDULE_DELAY_TYPE_NAMES[e.delay_type]+" ":"",t.backup_job_names[e.type_data]);case p.SCHEDULE_TYPE_CLONE_DONE:return d.t('Runs %safter the "%s" clone job End',e.delay_amount>0?e.delay_amount+" "+p.SCHEDULE_DELAY_TYPE_NAMES[e.delay_type]+" ":"",t.clone_job_names[e.type_data])}},t.fetchFilters(function(){t.fetchBackupJobs(function(){t.fetchCloneJobs(function(){t.fetchSchedules(function(){t.fetchDestinations(function(){t.fetchJobData()})})})})})}])}),define("controllers/cloneJobs",["app"],function(e){e.controller("cloneJobs",["$rootScope","$scope","$location","$timeout","$sce","$interval","$q","api","meta","lang","filter","consts","confirm","alert",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","CloneJobs"),t.jobs=[],t.checkingJob={},t.loadingJobs=!1,t.filters={},t.destinations=void 0,t.running={},t.checkRunningInterval=null,t.run_now=!1,t.currentTime=parseInt(Date.now()/1e3),s(function(){t.currentTime=parseInt(Date.now()/1e3)},100),t.loaders={state:!1,quota:!1,runnow:!1,duplicate:!1,delete:!1},r=r.new("clone_jobs"),t.meta=r,t.metaData=r.getData(),r.getSortBy()||r.setSortBy("name"),r.getSortDirection()||r.setSortDirection("asc"),r.setSortFields(["name","type","owner","retain","last_run","disabled"]),r.setTotalItems(t.jobs.length),t.viewLogs=function(e){u.new("logs_filter").setFilter(d.LOG_TYPE_CLONE),u.new("logs_subfilter").setFilter(e._id),t.changeView("/logs")},t.duplicate=function(e){_.open({message:l.t("This clone job will be duplicated!"),confirm:function(){t.loaders.duplicate=!0,c.duplicateCloneJob({data:{_id:e._id},success:function(e,n){t.loaders.duplicate=!1,t.fetch(),f.success(n)},failed:function(e){t.loaders.duplicate=!1,f.error(e)}})},cancel:function(){t.saveing=!1}})},t.toggleState=function(e){t.loaders.state=!0;var n=!e.disabled;c.manageCloneJob({data:{action:"modify",_id:e._id,disabled:n},success:function(n){t.loaders.state=!1,e.disabled=n.disabled,e.next_run=n.next_run},failed:function(e){t.loaders.state=!1,f.error(e)}})},t.runCloneJobManually=function(e){t.loaders.runnow||(t.loaders.runnow=!0,c.runCloneJobManually({data:{_id:e._id},success:function(n,a){t.loaders.runnow=!1;for(var i in n)e[i]=n[i];t.running[e._id]=e,f.success(a)},failed:function(e){t.loaders.runnow=!1,f.error(e)}}))},t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,_.open({message:l.t("This clone job will be permanently deleted!"),confirm:function(){c.deleteCloneJob({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),f.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,f.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},c.listAccountFilters({success:function(e){for(var n=0;n<e.filters.length;n++)t.filters[e.filters[n].group_id]=e.filters[n].name}}),t.createCloneJob=function(){t.destinationsCheck(function(){t.changeView("/cloneJobManage")})},t.destinationsCheck=function(e){if(void 0===e&&(e=function(){}),void 0!==t.destinations)return t.destinations?void e():void f.error(l.t("You must first create a destination before creating a clone job for this server"));t.destinations=!1,c.listDestinations({data:{readonly:0},success:function(n){if(t.destinations=!!n.destinations.length,!t.destinations)return void f.error(l.t("You must first create a destination before creating a clone job for this server"));e()},failed:function(e){f.error(e)}})},t.checkRunning=function(){for(var e in t.running)c.getCloneJob({data:{_id:e},success:function(n){if(!n.running){for(var a in n)t.running[e][a]=n[a];delete t.running[e]}}})},t.$on("$destroy",function(){null!==t.checkRunningInterval&&(clearInterval(t.checkRunningInterval),t.checkRunningInterval=null)}),t.fetch=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),t.loadingJobs=!0;var n={sort:{},skip:r.getSkip(),limit:r.getPageSize(),filter:r.getFilter()};n.sort[r.getSortBy()]=r.getSortDirectionInt(),t.jobs=[],t.running={},c.listCloneJobs({data:n,success:function(n){r.setTotalItems(n.total),r.calculate(n.jobs),t.jobs=n.jobs;for(var a=0;a<t.jobs.length;a++){var s=t.jobs[a],o=parseInt(s.type),c=parseInt(s.contains),u=[];switch(o){case d.CLONE_TYPE_ACCOUNT:c==d.CLONE_TYPE_ACCOUNT_FULL?u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_FULL]):(c&d.CLONE_TYPE_ACCOUNT_CONFIG&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_CONFIG]),c&d.CLONE_TYPE_ACCOUNT_HOMEDIR&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_HOMEDIR]),c&d.CLONE_TYPE_ACCOUNT_DATABASES&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_DATABASES]),c&d.CLONE_TYPE_ACCOUNT_EMAILS&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_EMAILS]),c&d.CLONE_TYPE_ACCOUNT_CRON_JOBS&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_CRON_JOBS]),c&d.CLONE_TYPE_ACCOUNT_DOMAINS&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_DOMAINS]),c&d.CLONE_TYPE_ACCOUNT_CERTIFICATES&&u.push(d.CLONE_TYPE_ACCOUNT_NAMES[d.CLONE_TYPE_ACCOUNT_CERTIFICATES]))}if(s.contains_name=u.join(", "),s.filters_sorted=[],void 0!==s.filters)for(var _=0;_<s.filters.length;_++)for(var f=0;f<s.filters[_].length;f++)s.filters_sorted.push(s.filters[_][f]);s.running&&(t.running[s._id]=s);var p=[];s.destinations="";for(var g=0;g<s.destination_details.length;g++)p.push(s.destination_details[g].name+(s.destination_details[g].disabled?' <span style="color: #cc0000; font-size: 11px;">('+l.t("Disabled")+")</span>":""));s.destinations=i.trustAsHtml(p.join(", "))}t.loadingJobs=!1,e()}})},a(function(){t.fetch(function(){t.checkRunningInterval=setInterval(t.checkRunning,3e3)})})}])}),define("controllers/cloneJobManage",["app"],function(e){e.controller("cloneJobManage",["$rootScope","$scope","$routeParams","$templateCache","$route","$location","$timeout","$q","api","meta","util","lang","alert","permissions","consts","filterManager","confirm","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f,p,g,E,T){e.$emit("menuItem","cloneJobs"),t.saveData={name:"",destination:"",owner:t.loggedAccount._id,owner_name:t.loggedAccount.username,type:p.CLONE_TYPE_ACCOUNT,contains:p.CLONE_TYPE_ACCOUNT_FULL,default_package:"",default_owner:"",suspend_after:0,time_parsed:"12:00 AM",time:0,monitor:{ranfor:0,notran:0},schedules:[],filters:[],include_list:[],exclude_list:[]},t.autocomplete={accountText:t.saveData.owner_name},t.details={},t.destinations={},t.schedules={},t.filters={},t.backup_job_names={},t.clone_job_names={},t.cancelled=!1,t.excluderow="",t.includerow="",t.types=[{label:p.CLONE_TYPE_NAMES[p.CLONE_TYPE_ACCOUNT],value:p.CLONE_TYPE_ACCOUNT}],t.account_types=[{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_HOMEDIR],value:p.CLONE_TYPE_ACCOUNT_HOMEDIR},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_DATABASES],value:p.CLONE_TYPE_ACCOUNT_DATABASES},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_DATABASE_USERS],value:p.CLONE_TYPE_ACCOUNT_DATABASE_USERS},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_EMAILS],value:p.CLONE_TYPE_ACCOUNT_EMAILS},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_FTP],value:p.CLONE_TYPE_ACCOUNT_FTP},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_CRON_JOBS],value:p.CLONE_TYPE_ACCOUNT_CRON_JOBS},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_DOMAINS],value:p.CLONE_TYPE_ACCOUNT_DOMAINS},{label:p.CLONE_TYPE_ACCOUNT_NAMES[p.CLONE_TYPE_ACCOUNT_CERTIFICATES],value:p.CLONE_TYPE_ACCOUNT_CERTIFICATES}],t.filtersConditions=[{_id:1,name:d.t("OR")},{_id:2,name:d.t("AND")}],t.filtersStructure=[],t.$watch("filtersStructure",function(){t.buildFilters(!0)},!0),
t.selectAccount=function(e){if(void 0!==e){t.saveData.owner=e._id,t.saveData.owner_name=e.username,t.autocomplete.accountText=e.username;var n=document.activeElement;n&&n.blur()}},t.searchAccounts=function(e){if(e){var t=c.defer();return r.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]},t.buildFilters=function(e){void 0===e&&(e=!1),e?t.saveData.filters=g.buildFilters(t.filtersStructure):void 0!==t.saveData.filters&&(t.filtersStructure=g.reBuildStructure(t.saveData.filters))},t.removeFilter=function(e){t.filtersStructure=g.removeFilter(t.filtersStructure,e)},t.upFilter=function(e){if(0!==e){var n=t.filtersStructure[e],a=t.filtersStructure[e-1];1===e&&(a.cond=n.cond,delete n.cond),t.filtersStructure[e]=a,t.filtersStructure[e-1]=n}},t.downFilter=function(e){if(e!==t.filtersStructure.length-1){var n=t.filtersStructure[e],a=t.filtersStructure[e+1];0===e&&(n.cond=a.cond,delete a.cond),t.filtersStructure[e]=a,t.filtersStructure[e+1]=n}},t.fileBrowse=function(){T.open({size:"lg",template:"fileBrowse",scope:t,resolve:{listPaths:function(){return t.saveData.include_list}}}).result.then(function(e){t.saveData.include_list=e},function(){})},t.filterSelection=function(){T.open({size:"lg",template:"accountFilterGroupSelection",scope:t,resolve:{filters:function(){return t.filters},details:function(){return t.details}}}).result.then(function(e){if(e){var n={_id:e};t.filtersStructure.length>0&&(n.cond=1),t.filtersStructure.push(n)}},function(){})},t.manageDestination=function(){T.open({template:"destinationsSelection",scope:t,resolve:{destinations:function(){return t.saveData.destination},readonly:function(){return!1},types:function(){return p.DESTINATION_JOB_TYPE_CLONE},legacy:function(){return!0},local:function(){return!0}}}).result.then(function(e){t.saveData.destination=e},function(){})},t.scheduleSelection=function(e){T.open({size:"lg",template:"scheduleSelection",scope:t,resolve:{schedules:function(){return t.schedules},schedule:function(){return e},details:function(){return t.saveData},retain:function(){return!1}}}).result.then(function(n){if(!n._id)return void _.error(d.t("No schedule selected"));if(n.display=t.scheduleDisplay(n),t.schedules[n._id]=n,void 0!==e)for(var a in n)void 0!==e[a]&&(e[a]=n[a]);else t.saveData.schedules.push({_id:n._id,name:n.name,retain:n.retain,next_run:0});t.checkScheduleTimeMismatch()},function(){})},t.checkScheduleTimeMismatch=function(){for(var e=0,n=0;n<t.saveData.schedules.length;n++){if(void 0===t.schedules[t.saveData.schedules[n]._id])return;var a=t.schedules[t.saveData.schedules[n]._id];if(!([1,2,3,4].indexOf(a.type)<0)&&(1!==a.type&&(e||(e=a.time),a.time!==e)))return void(t.scheduleTimeMismatch=!0)}t.scheduleTimeMismatch=!1},t.removeSchedule=function(e){E.open({message:d.t("Are you sure you want to remove this schedule from this job? Please note that all snapshots assigned to this schedule will be deleted in the next job run."),confirm:function(){for(var n=0;n<t.saveData.schedules.length;n++)if(e._id===t.saveData.schedules[n]._id){t.saveData.schedules.splice(n,1),t.checkScheduleTimeMismatch();break}_.success("Schedule removed successfully")}})},t.timeToStr=function(e){e=parseInt(e);var t="AM";e>=1200&&(t="PM",e-=1200),e=""+e,e.length<2&&(e="0"+e);var n=e.substr(-2),a=e.length>2?e.substr(0,e.length-2):12;return parseInt(a)<10&&(a="0"+parseInt(a)),a+":"+n+" "+t},t.strToTime=function(e){var t=/^([0-9]+):([0-9]+)\s+(AM+|PM+)$/g.exec(e);if(!t)return 0;var n=parseInt(t[1]+t[2]);return n>=1200&&(n-=1200),"PM"===t[3]&&(n+=1200),n},t.validateListPath=function(e,t){return!!e.trim()&&(t?!p.PATH_FILTER_PATTERNS.test(e):!p.PATH_FILTER.test(e))},t.typeChecked=function(e,t){return e&t},t.toggleOptionsTypes=function(e){t.typeChecked(e,t.saveData.options)?t.saveData.options^=e:t.saveData.options|=e},t.checkChange=function(){t.changed=u.isChanged(t.saveData,t.details,["_id"])},t.$watch("saveData",t.checkChange,!0),t.$watch("details",t.checkChange,!0),t.validateSchedules=function(e,t){if(e.length)return t(!0);E.open({message:d.t("We noticed that you didn't set any schedule for this job. That means that this job will never run automatically, only manually"),cancelLabel:d.t("No, let me set schedules"),confirm:function(){t(!0)},cancel:function(){t(!1)}})},t.fetchSchedules=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listSchedules({success:function(n){for(var a=0;a<n.schedules.length;a++){var i=n.schedules[a]._id;t.schedules[i]=n.schedules[a],t.schedules[i].display=t.scheduleDisplay(t.schedules[i])}e()},failed:function(){e()}})},t.fetchFilters=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listAccountFilterGroups({success:function(n){for(var a=0;a<n.groups.length;a++)t.filters[n.groups[a]._id]=n.groups[a];e()},failed:function(){e()}})},t.fetchDestinations=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listDestinations({success:function(n){for(var a=0;a<n.destinations.length;a++){var i=n.destinations[a];i.display=d.t("%s destination",i.type),t.destinations[i._id]=i}e()}})},t.removeDestination=function(e){for(var n=0;n<t.saveData.destination.length;n++)if(e===t.saveData.destination[n]){t.saveData.destination.splice(n,1);break}},t.updateData=function(e){t.details=e,t.saveData=u.duplicateObject(t.details),t.checkScheduleTimeMismatch(),t.buildFilters()},t.toggleCloneType=function(e){switch(e){case p.CLONE_TYPE_ACCOUNT:t.saveData.contains=p.CLONE_TYPE_ACCOUNT_FULL}},t.toggleContains=function(e){t.typeChecked(e,t.saveData.contains)?t.saveData.contains^=e:t.saveData.contains|=e};var A=function(e,t){var n=e.replace(/\/+$/,""),a=n+"/";return t.indexOf(n)>=0||t.indexOf(a)>=0};t.addListRow=function(e,n){void 0!==t[e]&&t[e].trim()&&(A(t[e].trim(),n)?_.error(d.t('The provided path ("%s") already exists on the list.',t[e].trim())):t.validateListPath(t[e].trim(),"excluderow"===e)?n.push(t[e].trim()):_.error(d.t('The provided path ("%s") is invalid. The path must start with a "/"'+("excluderow"!==e?", also patterns are not allowed.":"."),t[e].trim())),t[e]="")},t.addMultiListRow=function(e,n){"include"==e?(t.listTitle=d.t("Directories and Files to include"),t.listData=t.saveData.include_list.join("\n")):(t.listTitle=d.t("Directories and Files to exclude"),t.listData=t.saveData.exclude_list.join("\n")),t.listUIB=T.open({template:"listSelection",noController:!0,scope:t}),t.listUIB.result.then(function(a){for(;n.length;)n.pop();a=a.split("\n");for(var i=[],s=[],o=0;o<a.length;o++)"include"===e&&A(a[o],n)?s.push(a[o]):t.validateListPath(a[o],"exclude"===e)?n.indexOf(a[o])<0&&n.push(a[o]):i.push(a[o]);i.length&&_.error(d.t('The following paths ("%s") is invalid. The path must start with a "/" and can\'t have trailing "/"'+("include"===e?", also patterns are not allowed.":"."),i.join(", "))),s.length&&_.error(d.t('The provided path(s) ("%s") already exists on the list.',s.join(", ")))},function(){})},t.$on("$destroy",function(){t.changed&&!t.cancelled&&E.open({message:d.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:d.t("Disregard Changes"),confirmLabel:d.t("Save")})}),t.cancel=function(){t.cancelled=!0,s.path("/cloneJobs")},t.saveChanges=function(e,n){if(!t.saveing){t.saveing=!0;var a=u.saveParams(t.saveData,t.details,["clonetype"]);a.time_parsed&&(a.time=t.strToTime(a.time_parsed)),a.action=t.details._id?"modify":"create",t.validateSchedules(t.saveData.schedules,function(i){i?r.manageCloneJob({data:a,success:function(a,i){t.saveing=!1,t.details=u.duplicateObject(t.saveData),t.updateData(t.details),void 0===n&&(e?s.path("/cloneJobManage/"+a._id):s.path("/cloneJobs"),_.success(i)),void 0!==n&&"function"==typeof n&&n()},failed:function(e){t.saveing=!1,_.error(e),void 0!==n&&"function"==typeof n&&n()}}):t.saveing=!1})}},t.hideTime=function(){if(!t.saveData.schedules||!t.saveData.schedules.length)return!0;for(var e=0;e<t.saveData.schedules.length;e++)if(t.schedules[t.saveData.schedules[e]._id].type<5)return!1;return!0},t.$on("fetchJobData",function(e,n){t.fetchJobData(n._id,n.callback)}),t.fetchJobData=function(){r.getCloneJob({data:{_id:n.id},success:function(e){t.details=e,t.details.time_parsed=t.timeToStr(t.details.time),t.saveData=u.duplicateObject(t.details),t.autocomplete.accountText=t.saveData.owner_name,t.buildFilters()}})},t.fetchBackupJobs=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listBackupJobs({success:function(n){for(var a=0;a<n.jobs.length;a++)t.backup_job_names[n.jobs[a]._id]=n.jobs[a].name;e()},failed:function(){e()}})},t.fetchCloneJobs=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),r.listCloneJobs({success:function(n){for(var a=0;a<n.jobs.length;a++)t.clone_job_names[n.jobs[a]._id]=n.jobs[a].name;e()},failed:function(){e()}})},t.scheduleDisplay=function(e){var n=[];switch(e.type){case p.SCHEDULE_TYPE_HOURLY:return d.t("Hourly Schedule runs every %s Hours",e.type_data);case p.SCHEDULE_TYPE_DAILY:return n=e.type_data.map(function(e){return p.SCHEDULE_WEEK_DAYS_NAMES[e]}),d.t("Daily Schedule runs every %s",7===e.type_data.length?d.t("day"):n.join(", "));case p.SCHEDULE_TYPE_WEEKLY:return d.t("Weekly Schedule runs every %s",p.SCHEDULE_WEEK_DAYS_NAMES[e.type_data]);case p.SCHEDULE_TYPE_MONTHLY:return n=e.type_data.map(function(e){return(e=String(e))+p.SCHEDULE_TYPE_MONTHLY_SUFFIX[e.substr(e.length-1)]}),d.t("Monthly Schedule runs every %s of every month",n.join(", "));case p.SCHEDULE_TYPE_BACKUP_DONE:return d.t('Runs %safter the "%s" backup job End',e.delay_amount>0?e.delay_amount+" "+p.SCHEDULE_DELAY_TYPE_NAMES[e.delay_type]+" ":"",t.backup_job_names[e.type_data]);case p.SCHEDULE_TYPE_CLONE_DONE:return d.t('Runs %safter the "%s" clone job End',e.delay_amount>0?e.delay_amount+" "+p.SCHEDULE_DELAY_TYPE_NAMES[e.delay_type]+" ":"",t.clone_job_names[e.type_data])}},t.fetchFilters(function(){t.fetchBackupJobs(function(){t.fetchCloneJobs(function(){t.fetchSchedules(function(){t.fetchDestinations(function(){t.fetchJobData()})})})})})}])}),define("controllers/permissions",["app"],function(e){e.controller("permissions",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","confirm","util","permissions","lang","alert",function(e,t,n,a,i,s,o,c,r,l,u,d,_){e.$emit("menuItem","Permissions"),t.saveing=!1,t.changed=!1,t.loading=!1,t.totalFiltered=0,t.selectedAccount="",t.autocomplete={accountText:""},t.details={},t.filtered={},t.saveData={},t.meta={sectionValue:-1,filterType:1,filterValue:""},t.permissions={canView:!1,canManage:!1},t.types=[{value:1,label:d.t("Global Permissions")},{value:2,label:d.t("Specific Permissions")}],t.fetch=function(){if(2===t.meta.filterType&&!t.selectedAccount)return t.details={},t.filtered={},t.saveData={},void(t.totalFiltered=0);t.loading=!0;var e={};2===t.meta.filterType&&t.selectedAccount&&(e.username=t.selectedAccount),o.getPermissions({data:e,success:function(e){t.details=e.permissions,t.totalFiltered=1,t.saveData=l.duplicateObject(t.details),t.filteredList(),t.loading=!1}})},t.startFetching=function(){t.details={},t.filtered={},t.saveData={},t.totalFiltered=0,t.fetch()},t.resetPermissions=function(){r.open({message:2===t.meta.filterType&&t.selectedAccount?d.t('Are you sure you want to reset all permissions for the account "%s" to defaults?',t.selectedAccount):d.t("Are you sure you want to reset all permissions to defaults?"),confirm:function(){var e={};2===t.meta.filterType&&t.selectedAccount&&(e.username=t.selectedAccount),o.resetPermissions({data:e,success:function(e,n){_.success(n),t.startFetching()},failed:function(e){_.error(e)}})}})},t.selectAccount=function(e){void 0!==e&&(t.selectedAccount=e.username,t.startFetching())},t.searchAccounts=function(e){if(e){var t=s.defer();return o.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]},t.filteredList=function(){if(t.filtered={},t.totalFiltered=0,!t.meta.filterValue&&-1===t.meta.sectionValue)return t.totalFiltered=1,void(t.filtered=l.duplicateObject(t.details));for(var e in t.details){var n=u.get(e);null!==n&&(t.meta.filterValue&&!new RegExp("("+t.meta.filterValue+")","gi").test(n.name)||t.meta.sectionValue>=0||(t.totalFiltered++,t.filtered[e]=t.details[e]))}},t.$on("$destroy",function(){t.changed&&r.open({message:d.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:d.t("Disregard Changes"),confirmLabel:d.t("Save")})}),t.startFetching(),t.$watch("autocomplete.accountText",function(){""===t.autocomplete.accountText&&t.selectAccount({username:""})}),t.$watch("saveData",function(){t.changed=l.isChanged(t.saveData,t.details)},!0),t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n={permissions:l.saveParams(t.saveData,t.details)};2===t.meta.filterType&&t.selectedAccount&&(n.username=t.selectedAccount),o.managePermissions({data:n,success:function(a,i){t.saveing=!1,t.changed=!1,t.details=l.duplicateObject(t.saveData);for(var s in n.permissions)void 0!==t.filtered[s]&&(t.filtered[s]=n.permissions[s]);void 0!==e&&e(),_.success(i)},failed:function(e){t.saveing=!1,_.error(e)}})}}}])}),define("controllers/schedules",["app"],function(e){e.controller("schedules",["$rootScope","$scope","$location","$timeout","api","lang","meta","confirm","alert","consts",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Schedules"),t.schedules=[],t.loadingSchedules=!1,t.backup_job_names={},t.clone_job_names={},t.loaders={delete:!1},o=o.new("schedules"),t.meta=o,t.metaData=o.getData(),o.getSortBy()||o.setSortBy("name"),o.getSortDirection()||o.setSortDirection("asc"),o.setSortFields(["name","type","owner"]),o.setTotalItems(t.schedules.length),t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,c.open({message:s.t("This schedule will be permanently deleted!"),confirm:function(){i.deleteSchedule({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),r.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,r.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},t.scheduleDisplay=function(e){var n=[];switch(e.type){case l.SCHEDULE_TYPE_HOURLY:return s.t("Hourly Schedule runs every %s Hours",e.type_data);case l.SCHEDULE_TYPE_DAILY:return n=e.type_data.map(function(e){return l.SCHEDULE_WEEK_DAYS_NAMES[e]}),s.t("Daily Schedule runs every %s",7===e.type_data.length?s.t("day"):n.join(", "));case l.SCHEDULE_TYPE_WEEKLY:return s.t("Weekly Schedule runs every %s",l.SCHEDULE_WEEK_DAYS_NAMES[e.type_data]);case l.SCHEDULE_TYPE_MONTHLY:return n=e.type_data.map(function(e){return(e=String(e))+l.SCHEDULE_TYPE_MONTHLY_SUFFIX[e.substr(e.length-1)]}),s.t("Monthly Schedule runs every %s of every month",n.join(", "));case l.SCHEDULE_TYPE_BACKUP_DONE:return s.t('Runs after the "%s" backup job Ends',t.backup_job_names[e.type_data]);case l.SCHEDULE_TYPE_CLONE_DONE:return s.t('Runs after the "%s" clone job Ends',t.clone_job_names[e.type_data])}},t.fetchBackupJobs=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),i.listBackupJobs({success:function(n){for(var a=0;a<n.jobs.length;a++)t.backup_job_names[n.jobs[a]._id]=n.jobs[a].name;e()},failed:function(){e()}})},t.fetchCloneJobs=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),i.listCloneJobs({success:function(n){for(var a=0;a<n.jobs.length;a++)t.clone_job_names[n.jobs[a]._id]=n.jobs[a].name;e()},failed:function(){e()}})},t.fetch=function(){t.loadingSchedules=!0;var e={sort:{},skip:o.getSkip(),limit:o.getPageSize(),find:{},filter:o.getFilter()};e.sort[o.getSortBy()]=o.getSortDirectionInt(),t.schedules=[],i.listSchedules({data:e,success:function(e){o.setTotalItems(e.total),o.calculate(e.schedules),t.schedules=e.schedules,t.loadingSchedules=!1}})},t.fetchBackupJobs(function(){t.fetchCloneJobs(function(){t.fetch()})})}])}),define("controllers/scheduleManage",["app"],function(e){e.controller("scheduleManage",["$rootScope","$scope","$routeParams","$location","$timeout","api","meta","lang","util","consts","alert",function(e,t,n,a,i,s,o,c,r,l,u){e.$emit("menuItem","BackupJobs"),t.saveData={},t.details={name:"",type:1,type_data:"",delay_type:"minutes",delay_amount:0},t.saveing=!1,t.changed=!1,t.cancelled=!1,t.types=[{label:c.t("Hourly"),value:l.SCHEDULE_TYPE_HOURLY},{label:c.t("Daily"),value:l.SCHEDULE_TYPE_DAILY},{label:c.t("Weekly"),value:l.SCHEDULE_TYPE_WEEKLY},{label:c.t("Monthly"),value:l.SCHEDULE_TYPE_MONTHLY},{label:c.t("After Backup Job Done"),value:l.SCHEDULE_TYPE_BACKUP_DONE},{label:c.t("After Clone Job Done"),value:l.SCHEDULE_TYPE_CLONE_DONE}],t.hours=[{label:c.t("Every Hour"),value:1},{label:c.t("Every 2 Hours"),value:2},{label:c.t("Every 3 Hours"),value:3},{label:c.t("Every 4 Hours"),value:4},{label:c.t("Every 6 Hours"),value:6},{label:c.t("Every 8 Hours"),value:8},{label:c.t("Every 12 Hours"),value:12}],t.days=[{label:c.t("Sunday"),value:1},{label:c.t("Monday"),value:2},{label:c.t("Tuesday"),value:3},{label:c.t("Wednesday"),value:4},{label:c.t("Thursday"),value:5},{label:c.t("Friday"),value:6},{label:c.t("Saturday"),value:7}],t.months=[{label:c.t("%sst of the month",1),value:1},{label:c.t("%sth of the month",7),value:7},{label:c.t("%sth of the month",14),value:14},{label:c.t("%sst of the month",21),value:21},{label:c.t("%sth of the month",28),value:28}],t.delay_types=[{label:c.t("Minutes"),value:l.SCHEDULE_DELAY_TYPE_MINUTES},{label:c.t("Hours"),value:l.SCHEDULE_DELAY_TYPE_HOURS},{label:c.t("Days"),value:l.SCHEDULE_DELAY_TYPE_DAYS}],t.backups=[{_id:"",name:c.t("- Select Backup Job -")}],t.clones=[{_id:"",name:c.t("- Select Clone Job -")}],t.toggleTypeData=function(e){var n=t.saveData.type_data.indexOf(e);n>-1?t.saveData.type_data.splice(n,1):t.saveData.type_data.push(e)},t.loadScheduleType=function(e,n){if(void 0!==t.saveData)var a=t.saveData.name;if(t.saveData=r.duplicateObject(t.details),void 0!==a&&(t.saveData.name=a),"object"==typeof t.details.type_data){t.saveData.type_data=[];for(var i=0;i<t.details.type_data.length;i++)t.saveData.type_data.push(t.details.type_data[i])}t.saveData.type=e;var o=new RegExp("^[a-f0-9]{24}$","g");switch(e){case l.SCHEDULE_TYPE_HOURLY:n&&(t.saveData.type_data=1);break;case l.SCHEDULE_TYPE_DAILY:case l.SCHEDULE_TYPE_MONTHLY:n&&(t.saveData.type_data=[]);break;case l.SCHEDULE_TYPE_WEEKLY:n&&(t.saveData.type_data=1);break;case l.SCHEDULE_TYPE_BACKUP_DONE:void 0!==t.saveData.type_data&&"string"==typeof t.saveData.type_data&&o.test(t.saveData.type_data.trim())||(t.saveData.type_data=""),s.listBackupJobs({success:function(e){for(var n=0;n<e.jobs.length;n++)t.excludeids&&t.excludeids.indexOf(e.jobs[n]._id)>=0||t.backups.push({_id:e.jobs[n]._id,name:e.jobs[n].name})}});break;case l.SCHEDULE_TYPE_CLONE_DONE:void 0!==t.saveData.type_data&&"string"==typeof t.saveData.type_data&&o.test(t.saveData.type_data.trim())||(t.saveData.type_data=""),s.listCloneJobs({success:function(e){for(var n=0;n<e.jobs.length;n++)t.excludeids&&t.excludeids.indexOf(e.jobs[n]._id)>=0||t.clones.push({_id:e.jobs[n]._id,name:e.jobs[n].name})}})}},t.fetchScheduleData=function(e){s.getSchedule({data:{_id:e},success:function(e){t.details=e,t.loadScheduleType(t.details.type)}})},t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id","checked"])},!0),t.$on("createSchedule",function(e){t.saveChanges(!0,function(e,n,a){t.$emit("scheduleResponse",{success:e,data:n,message:a})})}),t.cancel=function(){t.cancelled=!0,a.path("/schedules")},t.saveChanges=function(e,n){if(!t.saveing){t.saveing=!0;var i=r.saveParams(t.saveData,t.details,[],function(e){return"type"===e});i.action=t.details._id?"modify":"create",s.manageSchedule({data:i,success:function(i,s){if(t.saveing=!1,void 0!==n)return void n(!0,i,s);t.changed=!1,t.saveData._id=i._id,t.details=r.duplicateObject(t.saveData),e?a.path("/scheduleManage/"+i._id):a.path("/schedules"),u.success(s)},failed:function(e){if(t.saveing=!1,void 0!==n)return void n(!1,{},e);u.error(e)}})}};var d=n.id;d?i(t.fetchScheduleData(d)):t.loadScheduleType(t.details.type,!0)}])}),define("controllers/scheduleManagePopup",["app"],function(e){e.controller("scheduleManagePopup",["$uibModalInstance","$routeParams","$rootScope","$scope","api","lang","schedule","excludeids","alert",function(e,t,n,a,i,s,o,c,r){a.excludeids=c,a.schedule=o,t.id=null,a.saveData={},a.schedule&&(t.id=a.schedule._id),a.$on("scheduleResponse",function(t,n){if(!n.success)return void r.error(n.message);i.getSchedule({data:{_id:n.data._id},success:function(t){r.success(n.message),e.close(t)},failed:function(e){r.error(e)}})}),a.ok=function(){n.$broadcast("createSchedule")},a.cancel=function(){e.dismiss()}}])}),define("controllers/scheduleSelection",["app"],function(e){e.controller("scheduleSelection",["$uibModalInstance","$scope","lang","schedules","schedule","details","alert","retain","popup",function(e,t,n,a,i,s,o,c,r){function l(e){for(var n=0;n<t.schedules.length;n++)if(t.schedules[n]._id==e)return!0;return!1}t.schedule=i,t.schedules=[],t.allSchedules=a,t.includeRetain=c,t.scheduleDetails={retain:0},t.details=void 0!==i?i:{_id:"",retain:0},t.newSchedule=function(){r.open({size:"lg",template:"scheduleManagePopup",scope:t,resolve:{schedule:function(){return{}},excludeids:function(){return[]}}}).result.then(function(e){if(!e._id)return void o.error(n.t("Failed to create schedule"));t.allSchedules[e._id]=e,t.calculateUsableSchedules(function(){if(!l(e._id))return void o.error(n.t("You can't use this type of schedule as same schedule type is already assigned to this job"));t.details._id=e._id})},function(){})},t.calculateUsableSchedules=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),t.schedules=[],t.schedulesTypesInUse=[];for(var n=0;n<s.schedules.length;n++)void 0!==a[s.schedules[n]._id]&&t.schedulesTypesInUse.push(a[s.schedules[n]._id].type);for(var n in t.allSchedules)if(void 0!==i&&t.allSchedules[i._id].type===t.allSchedules[n].type||!(t.schedulesTypesInUse.indexOf(t.allSchedules[n].type)>=0)){for(var o=!0,c=0;c<s.schedules.length;c++)if(n===s.schedules[c]._id&&(void 0===i||i._id!==n)){o=!1;break}o&&(t.allSchedules[n].label=t.allSchedules[n].name+" ("+t.allSchedules[n].type_name+")",t.schedules.push(t.allSchedules[n]))}e()},t.calculateUsableSchedules(),t.$watch("details",function(){if(!t.details._id)return void(t.schedules.length&&(t.scheduleDetails=t.schedules[0],t.details._id=t.scheduleDetails._id));t.scheduleDetails=t.allSchedules[t.details._id],t.scheduleDetails.retain=t.details.retain},!0),t.ok=function(){t.scheduleDetails.retain=parseInt(t.scheduleDetails.retain),e.close(t.scheduleDetails)},t.cancel=function(){e.dismiss(n.t("cancel"))}}])}),define("controllers/queue",["app"],function(e){e.controller("queue",["$rootScope","$scope","$location","$timeout","api","meta","consts","lang","permissions","confirm","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Queue");var _=o.QUEUE_ITEM_TYPE_BACKUP|o.QUEUE_ITEM_TYPE_CLONE|o.QUEUE_ITEM_TYPE_REINDEX;r.canRestoreBackups&&(_|=o.QUEUE_ITEM_TYPE_RESTORE),r.canDownloadBackups&&(_|=o.QUEUE_ITEM_TYPE_DOWNLOAD),r.isRoot&&(_|=o.QUEUE_ITEM_TYPE_SECURITY|o.QUEUE_ITEM_TYPE_INTEGRITY_CHECK|o.QUEUE_ITEM_TYPE_SNAPSHOT_DELETE);var f=[],p={};t.groups=[],t.loadingGroups=!1,t.stopping=!1,t.destroy=!1,t.filter=_,t.filterOptions=[{label:c.t("All Queue Items"),value:_},{label:c.t("Backup Queue Items"),value:o.QUEUE_ITEM_TYPE_BACKUP},{label:c.t("Clone Queue Items"),value:o.QUEUE_ITEM_TYPE_CLONE}],r.canRestoreBackups&&t.filterOptions.push({label:c.t("Restore Queue Items"),value:o.QUEUE_ITEM_TYPE_RESTORE}),r.canDownloadBackups&&t.filterOptions.push({label:c.t("Download Queue Items"),value:o.QUEUE_ITEM_TYPE_DOWNLOAD}),r.isRoot&&(t.filterOptions.push({label:c.t("Security Queue Items"),value:o.QUEUE_ITEM_TYPE_SECURITY}),t.filterOptions.push({label:c.t("Integrity Check Queue Items"),value:o.QUEUE_ITEM_TYPE_INTEGRITY_CHECK}),t.filterOptions.push({label:c.t("Snapshot Cleanup Queue Items"),value:o.QUEUE_ITEM_TYPE_SNAPSHOT_DELETE})),t.filterOptions.push({label:c.t("Reindex Queue Items"),value:o.QUEUE_ITEM_TYPE_REINDEX}),s=s.new("queue"),t.meta=s,t.metaData=s.getData(),s.setTotalItems(t.groups.length),t.stopGroup=function(e){t.stopping||(t.stopping=!0,i.stopQueueGroup({data:{_id:e._id},success:function(e,n){t.stopping=!1,t.fetch(),u.success(n)},failed:function(e){t.stopping=!1,u.error(e)}}))};var g=function(e,t,n){void 0===t&&(t=!0),void 0!==n&&"function"==typeof n||(n=function(){}),i.listQueueGroups({data:e,withLoader:t,success:function(e){for(var t=[],a=0;a<e.groups.length;a++){var i=e.groups[a];parseInt(i.items_completed)<=0||parseInt(i.items)<=0?i.items_progress_percentage=0:i.items_progress_percentage=parseInt(parseInt(i.items_completed)/parseInt(i.items)*100),i.type===o.QUEUE_ITEM_TYPE_BACKUP&&(i.data.snapshot?i.data={schedule:c.t("Backup on Demand"),account:i.owner_name}:i.data={schedule:i.data.manually?c.t("Manually"):c.t("Backup Job Schedule"),"Job Id":i.data._id,"Job Name":i.data.name}),t.push(i)}n(t,e.total)},failed:function(e){u.error(e),n([],0)}})};t.cancelAll=function(){l.open({message:c.t("All queue items will be cancelled"),confirm:function(){i.stopAllQueueGroup({success:function(e,n){t.fetch(),u.success(n)},failed:function(e){u.error(e)}})}})},t.viewGroupItems=function(e){d.open({size:"xl",template:"queueItems",scope:t,resolve:{group:function(){return e}}}).result.then(function(){},function(){})},t.viewGroupLog=function(e){i.getQueueGroup({data:{_id:e._id,get_log_contents:1},success:function(e){if(!e.log_contents)return void u.error(c.t("No log content found"));d.open({size:"lg",template:"queueLogViewer",scope:t,resolve:{group:function(){return e}}}).result.then(function(){},function(){})},failed:function(e){u.error(e)}})},t.checkRunningStatusesTimeout=null,t.rerunFailedItem=function(e){i.rerunFailedQueueGroup({data:{_id:e._id},success:function(n,a){for(var i in n)e[i]=n[i];f.push(e._id),t.startRunningStatuses(),u.success(a)},failed:function(e){u.error(e)}})},t.clear=function(){i.clearQueue({success:function(){t.fetch()},failed:function(e){u.error(e)}})},t.fetch=function(){t.loadingGroups=!0;var e={skip:s.getSkip(),limit:s.getPageSize(),type:t.filter};t.groups=[],g(e,!0,function(e,n){s.setTotalItems(n),s.calculate(e);for(var a=[],i=0;i<e.length;i++){var c=e[i];c.status<o.QUEUE_STATUS_COMPLETED&&f.push(c._id),p[c._id]=c,a.push(c)}t.groups=a,f.length>0&&t.startRunningStatuses(),t.loadingGroups=!1})};var E=function(){g({type:t.filter},!1,function(e,n){for(var a=0;a<e.length;a++){var i=e[a],s=f.indexOf(i._id);if(!(s<0)){for(var c in p[i._id])p[i._id][c]=i[c];i.status>=o.QUEUE_STATUS_COMPLETED&&f.splice(s,1)}}f.length>0&&t.startRunningStatuses()})};t.clearRunningStatuses=function(){null!==t.checkRunningStatusesTimeout&&clearTimeout(t.checkRunningStatusesTimeout),t.checkRunningStatusesTimeout=null},t.startRunningStatuses=function(){t.clearRunningStatuses(),t.destroy||(t.checkRunningStatusesTimeout=setTimeout(E,1e3))},t.$on("$destroy",function(){t.destroy=!0,t.clearRunningStatuses()}),a(t.fetch)}])}),define("controllers/queueItems",["app"],function(e){e.controller("queueItems",["$uibModalInstance","$scope","$timeout","lang","meta","api","consts","alert","group","popup",function(e,t,n,a,i,s,o,c,r,l){var u=[],d={};t.group=r,t.items=[],t.loadingItems=!1,t.checkRunningStatusesTimeout=null,t.destroy=!1,t.loaders={view:!1},i=i.new("queue_items"),t.meta=i,t.metaData=i.getData(),i.getSortBy()||i.setSortBy("priority"),i.getSortDirection()||i.setSortDirection("asc"),i.setSortFields(["priority","started","ended","execution_time","owner","status"]),i.setTotalItems(t.items.length),i.setPageSizes([5,10]),i.setPageSize(10),i.setLimit(10),t.viewLogItem=function(e){t.loaders.view=!0,s.getQueueItem({data:{_id:e._id,get_log_contents:1},success:function(e){if(t.loaders.view=!1,!e.content)return void c.error(a.t("No log content found"));l.open({size:"lg",template:"logViewer",scope:t,resolve:{log:function(){return{_id:e._id,file:e.file,content:e.content,start_time:e.started,end_time:e.ended,execution_time:e.execution_time,status:o.QUEUE_STATUS_TO_LOG[e.status],information:[]}}}}).result.then(function(){},function(){})},failed:function(e){t.loaders.view=!1,c.error(e)}})};var _=function(e,n,a){void 0===n&&(n=!0),void 0!==a&&"function"==typeof a||(a=function(){}),e.group_id=t.group._id,s.listQueueItems({data:e,withLoader:n,success:function(e){a(e.items,e.total)},failed:function(e){c.error(e),a([],0)}})},f=function(){_({},!1,function(e,n){for(var a=0;a<e.length;a++){var i=e[a],s=u.indexOf(i._id);if(!(s<0)){for(var c in d[i._id])d[i._id][c]=i[c];i.status>=o.QUEUE_STATUS_COMPLETED&&u.splice(s,1)}}u.length>0&&t.startRunningStatuses()})};t.clearRunningStatuses=function(){null!==t.checkRunningStatusesTimeout&&clearTimeout(t.checkRunningStatusesTimeout),t.checkRunningStatusesTimeout=null},t.startRunningStatuses=function(){t.clearRunningStatuses(),t.destroy||(t.checkRunningStatusesTimeout=setTimeout(f,1e3))},t.fetch=function(){t.loadingItems=!0;var e={skip:i.getSkip(),limit:i.getPageSize(),sort:{}};e.sort[i.getSortBy()]=i.getSortDirectionInt(),t.items=[],_(e,!0,function(e,n){i.setTotalItems(n),i.calculate(e);for(var a=[],s=0;s<e.length;s++){var c=e[s];c.status<o.QUEUE_STATUS_COMPLETED&&u.push(c._id),d[c._id]=c,a.push(c)}t.items=a,u.length>0&&t.startRunningStatuses(),t.loadingItems=!1})},t.$on("$destroy",function(){t.destroy=!0,t.clearRunningStatuses()}),n(t.fetch),t.close=function(){e.close()}}])}),define("controllers/queueLogViewer",["app"],function(e){e.controller("queueLogViewer",["$uibModalInstance","$scope","group",function(e,t,n){t.group=n,t.ok=function(){e.close()}}])}),define("controllers/queuePriorities",["app"],function(e){e.controller("queuePriorities",["$rootScope","$scope","$location","$timeout","$interval","$q","api","meta","lang","consts","confirm","alert",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Settings"),t.priorities=[],t.tags={},t.loadingPriorities=!1,t.loaders={default:!1,delete:!1},c=c.new("queue_priorities"),t.meta=c,t.metaData=c.getData(),c.getSortBy()||c.setSortBy("name"),c.getSortDirection()||c.setSortDirection("asc"),c.setSortFields(["name","priority"]),c.setTotalItems(t.priorities.length),t.onClickDelete=function(e){t.saveing||(t.saveing=!0,u.open({message:r.t("This queue priority will be permanently deleted!"),confirm:function(){t.loaders.delete=!0,o.deleteQueuePriority({data:{_id:e._id},success:function(e,n){t.loaders.delete=!1,t.saveing=!1,t.fetch(),d.success(n)},failed:function(e){t.loaders.delete=!1,t.saveing=!1,d.error(e)}})},cancel:function(){t.saveing=!1}}))},t.setDefault=function(e){t.saveing||(t.saveing=!0,t.loaders.default=!0,o.manageQueuePriority({data:{action:"modify",_id:e._id,default:1},success:function(n,a){t.saveing=!1,t.loaders.default=!1;for(var i=0;i<t.priorities.length;i++)if(t.priorities[i].default){t.priorities[i].default=0;break}e.default=1,d.success(a)},failed:function(e){t.saveing=!1,t.loaders.default=!1,d.error(e)}}))},t.fetch=function(){t.loadingPriorities=!0;var e={sort:{},skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter()};e.sort[c.getSortBy()]=c.getSortDirectionInt(),t.priorities=[],o.listQueuePriorities({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.priorities),t.priorities=e.priorities,t.loadingPriorities=!1}})},t.fetchTags=function(){o.listTags({data:{find:{type:l.TAG_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.tags.length;n++)t.tags[e.tags[n]._id]=e.tags[n]}})},a(function(){t.fetchTags(),t.fetch()})}])}),define("controllers/queuePriorityManage",["app"],function(e){e.controller("queuePriorityManage",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","consts","lang","meta","util","confirm","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","Settings"),t.details={},t.saveData={name:"",tags:[],backup_priority:"",clone_priority:"",restore_priority:"",download_priority:""},t.tags={},t.saveing=!1,t.status=void 0,t.changed=!1,
t.cancelled=!1,t.$watch("saveData",function(){t.changed=u.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("$destroy",function(){t.changed&&!t.cancelled&&d.open({message:r.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:r.t("Disregard Changes"),confirmLabel:r.t("Save")})}),t.cancel=function(){t.cancelled=!0,a.path("/queuePriorities")},t.searchTags=function(e){if(!e)return[];var n=s.defer();return o.listTags({data:{filter:e,sort:{name:1},find:{type:c.TAG_TYPE_ACCOUNT}},success:function(e){for(var a=[],i=0;i<e.tags.length;i++){var s=e.tags[i];t.saveData.tags.indexOf(s._id)>=0||a.push(s)}n.resolve(a)}}),n.promise},t.selectItem=function(e,n){void 0!==e&&(t.saveData.tags.push(e._id),n.searchItemText="")},t.manageTags=function(){f.open({template:"tagsSelection",scope:t,resolve:{tags:function(){return t.saveData.tags},type:function(){return c.TAG_TYPE_ACCOUNT}}}).result.then(function(e){t.saveData.tags=e},function(){})},t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n=u.saveParams(t.saveData,t.details);n.action=t.details._id?"modify":"create",o.manageQueuePriority({data:n,success:function(n,i){t.saveing=!1,t.changed=!1,t.saveData._id=n._id,t.details=u.duplicateObject(t.saveData),e?a.path("/queuePriorityManage/"+n._id):a.path("/queuePriorities"),_.success(i)},failed:function(e){t.saveing=!1,_.error(e)}})}},t.fetch=function(e){o.getQueuePriority({data:{_id:e},success:function(e){t.details=e,t.saveData=u.duplicateObject(t.details)}})},t.fetchTags=function(){o.listTags({data:{find:{type:c.TAG_TYPE_ACCOUNT}},success:function(e){for(var a=0;a<e.tags.length;a++)t.tags[e.tags[a]._id]=e.tags[a];var s=n.id;s&&i(t.fetch(s))}})},i(function(){t.fetchTags()})}])}),define("controllers/security",["app"],function(e){e.controller("security",["$rootScope","$scope","$routeParams","$location","$timeout","api","meta","confirm","util","lang","consts","alert",function(t,n,a,i,s,o,c,r,l,u,d,_){t.$emit("menuItem","Security"),n.saveing=!1,n.loading=!1,n.pluginTemplate="",n.pluginsList={},n.publicDir="",n.plugins_available={},n.plugin_available={},n.saveData={plugin:"",restore:0,lock:0,options:{}},n.plugins=[],n.isAvailablePlugins=function(){return n.saveData.plugin&&n.saveData.plugin.indexOf("AvailablePlugins")>=0},n.changePlugin=function(){if(!n.saveData.plugin)return n.pluginTemplate="",void(n.details={});if(n.isAvailablePlugins()){var t=n.saveData.plugin.split("::");n.plugin_available=n.plugins_available[t[1]],n.pluginTemplate=n.includePath("securityAvailablePlugins")}else n.details=l.duplicateObject(n.pluginsList[n.saveData.plugin]),u.setDefaultNS("plugins-security-"+n.details.code),e.registerPluginController(n.details,function(e){n.publicDir=e,n.pluginTemplate=n.publicDir+"/view.htm?v="+n.details.version})},n.installDestination=function(){n.installing||(n.installing=!0,r.open({message:u.t("This plugin will be installed on this server!"),confirm:function(){o.installPlugin({data:{package_id:n.plugin_available._id,disabled:0},success:function(e,t){n.installing=!1,n.plugin_available={},n.fetch(function(){n.loading=!1,n.saveData.plugin="";for(var a in n.pluginsList)if(n.pluginsList[a].code===e.code){n.saveData.plugin=a;break}n.changePlugin(),_.success(t)})},failed:function(e){n.installing=!1,_.error(e)}})},cancel:function(){n.installing=!1}}))},n.saveChanges=function(e){if(!n.saveing){void 0!==e&&"function"==typeof e||(e=function(){}),n.saveing=!0;var t=l.duplicateObject(n.saveData);o.manageSecurityPlugin({data:t,success:function(t,a){n.saveing=!1,e(),_.success(a)},failed:function(e){n.saveing=!1,_.error(e)}})}},n.loadPackagesAvailable=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),o.listPackagesAvailable({data:{find:{type:"security"}},success:function(t){for(var a=0;a<t.packages.length;a++){var i=t.packages[a];n.plugins_available[i.code]=i,n.plugins.push({name:u.t("%s via %s",i.name,i.repo_name),_id:"AvailablePlugins::"+i.code,group:u.t("Available Plugins")})}e()},failed:function(t){e()}})},n.fetch=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),n.plugins=[{_id:"",name:u.t("Disabled")}],n.pluginsList={},n.plugins_available={},n.loading=!0,o.listPlugins({data:{find:{type:d.PLUGIN_TYPE_SECURITY,disabled:!1}},success:function(t){for(var a=0;a<t.plugins.length;a++)n.plugins.push({_id:t.plugins[a]._id,name:t.plugins[a].name,group:u.t("Installed Plugins")}),n.pluginsList[t.plugins[a]._id]=t.plugins[a];n.loadPackagesAvailable(e)},failed:function(){n.loadPackagesAvailable(e)}})},n.fetch(function(){o.getSettings({data:{section:"security"},success:function(e){n.loading=!1,n.saveData=e,n.changePlugin()},failed:function(e){_.error(e)}},function(e){})})}])}),define("controllers/support",["app"],function(e){e.controller("support",["$rootScope","$scope","alert","api","lang",function(e,t,n,a,i){e.$emit("menuItem","Support"),t.cancel=function(){t.loading=!1,t.wizard=0,t.info={},t.url="",t.options={configurations:!1,access:!1,whitelisted:!1,sshkey:"1"}},t.cancel(),t.setWizardStep=function(e){t.wizard=e},t.addSSHKey=function(){if(t.options.access){if(!t.options.whitelisted)return n.error(i.t("Please confirm all conditions")),!1;"1"===t.options.sshkey&&(t.loading=!0)}t.setWizardStep(3)},t.transmitData=function(){if(!t.options.configurations)return n.error(i.t("You must allow JetApps staff to review your configurations. If you don't want to let JetApps staff to review your configurations, Please open a ticket directly to JetApps Helpdesk at https://billing.jetapps.com/submitticket.php")),!1;t.loading=!0,a.createSupportTicketKey({success:function(e){t.loading=!1,t.info=e.info,t.key=e.key,t.ip=e.ip,t.url=t.info.url,t.url+=t.url.indexOf("?")>=0?"&":"?",t.url+="key="+e.key+"&ip="+e.ip+"&allowaccess="+(t.options.access?"yes":"no"),t.setWizardStep(2)},failed:function(e){t.loading=!1,n.error(e)}})}}])}),define("controllers/repositories",["app"],function(e){e.controller("repositories",["$rootScope","$scope","$location","$timeout","api","meta","filter","confirm","alert","lang",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Plugins"),t.repositories=[],t.loadingRepositories=!1,t.loaders={reload:!1,delete:!1},s=s.new("repositories"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("created"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["created"]),s.setTotalItems(t.repositories.length),t.reloadDB=function(e){t.loaders.reload=!0,i.reloadRepository({data:{_id:e._id},success:function(n,a){t.saveing=!1,t.loaders.reload=!1,e.last_checked=n.last_checked,r.success(a)},failed:function(e){t.saveing=!1,t.loaders.reload=!1,r.error(e)}})},t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,c.open({message:l.t("This repository will be permanently deleted!"),confirm:function(){i.deleteRepository({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),r.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,r.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},t.fetch=function(){t.loadingRepositories=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.repositories=[],i.listRepositories({data:e,success:function(e){s.setTotalItems(e.total),s.calculate(e.repositories),t.repositories=e.repositories,t.loadingRepositories=!1}})},a(t.fetch)}])}),define("controllers/repositoryManage",["app"],function(e){e.controller("repositoryManage",["$rootScope","$scope","$location","$routeParams","$timeout","api","meta","filter","confirm","lang","util","alert",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Plugins"),t.details={name:"",url:""},t.saveData=u.duplicateObject(t.details),t.saveing=!1,t.changed=!0,t.cancelled=!1,t.$watch("saveData",function(){t.changed=u.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("$destroy",function(){t.changed&&!t.cancelled&&r.open({message:l.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:l.t("Disregard Changes"),confirmLabel:l.t("Save")})}),t.cancel=function(){t.cancelled=!0,n.path("/plugins/repositories")},t.saveChanges=function(e,a){if(!t.saveing){t.saveing=!0;var i=u.saveParams(t.saveData,t.details);i.action=t.details._id?"modify":"create",s.manageRepository({data:i,success:function(i,s){t.saveing=!1,t.changed=!1,t.saveData._id=i._id,t.details=u.duplicateObject(t.saveData),void 0===a&&(e?n.path("/repositoryManage/"+i._id):n.path("/plugins/repositories"),d.success(s)),void 0!==a&&"function"==typeof a&&a()},failed:function(e){t.saveing=!1,d.error(e),void 0!==a&&"function"==typeof a&&a()}})}},t.fetchRepoData=function(){s.getRepository({data:{_id:a.id},success:function(e){t.details=e,t.saveData=u.duplicateObject(t.details)}})},a.id&&t.fetchRepoData()}])}),define("controllers/filePermissions",["app"],function(e){e.controller("filePermissions",["$rootScope","$scope","$location","$timeout","$interval","$q","api","meta","confirm","lang","alert",function(e,t,n,a,i,s,o,c,r,l,u){e.$emit("menuItem","Settings"),t.permissions=[],t.loadingPermissions=!1,t.loaders={delete:!1},c=c.new("file_permissions"),t.meta=c,t.metaData=c.getData(),c.getSortBy()||c.setSortBy("regex"),c.getSortDirection()||c.setSortDirection("asc"),c.setSortFields(["regex","owner","group","permissions"]),c.setTotalItems(t.permissions.length),t.onClickDelete=function(e){t.saveing||(t.loaders.delete=!0,t.saveing=!0,r.open({message:l.t("This file permission will be permanently deleted!"),confirm:function(){o.deleteFilePermissions({data:{_id:e._id},success:function(e,n){t.loaders.delete=!1,t.saveing=!1,t.fetch(),u.success(n)},failed:function(e){t.loaders.delete=!1,t.saveing=!1,u.error(e)}})},cancel:function(){t.loaders.delete=!1,t.saveing=!1}}))},t.fetch=function(){t.loadingPermissions=!0;var e={sort:{},skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter()};e.sort[c.getSortBy()]=c.getSortDirectionInt(),t.permissions=[],o.listFilePermissions({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.permissions),t.permissions=e.permissions,t.loadingPermissions=!1}})},a(t.fetch)}])}),define("controllers/filePermissionsManage",["app"],function(e){e.controller("filePermissionsManage",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","util","lang","consts","alert",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Settings"),t.details={},t.saveData={regex:"",category:u.FILE_PERMISSIONS_CATEGORY_HOMEDIR_DATA,owner:"",group:"",recursive:0,dirs_permissions:"",files_permissions:""},t.saveing=!1,t.changed=!1,t.categories=[{_id:u.FILE_PERMISSIONS_CATEGORY_HOMEDIR_DATA,name:u.FILE_PERMISSIONS_CATEGORIES[u.FILE_PERMISSIONS_CATEGORY_HOMEDIR_DATA]},{_id:u.FILE_PERMISSIONS_CATEGORY_EMAIL_DATA,name:u.FILE_PERMISSIONS_CATEGORIES[u.FILE_PERMISSIONS_CATEGORY_EMAIL_DATA]}],t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id"])},!0),t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n=r.saveParams(t.saveData,t.details);n.action=t.details._id?"modify":"create",o.manageFilePermissions({data:n,success:function(n,i){t.saveing=!1,t.changed=!1,t.saveData._id=n._id,t.details=r.duplicateObject(t.saveData),e?a.path("/filePermissionsManage/"+n._id):a.path("/filePermissions"),d.success(i)},failed:function(e){t.saveing=!1,d.error(e)}})}},t.fetch=function(e){o.getFilePermissions({data:{_id:e},success:function(e){t.details=e,t.saveData=r.duplicateObject(t.details)}})};var _=n.id;_&&i(t.fetch(_))}])}),define("controllers/hooks",["app"],function(e){e.controller("hooks",["$rootScope","$scope","$location","$timeout","api","meta","confirm","alert","lang","consts",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Hooks"),t.hooks=[],t.loading=!1,t.saveing=!1,t.filter="",t.filterOptions=[{label:r.t("All Hook Positions"),value:""},{label:r.t("Pre"),value:l.HOOK_TYPE_POSITION_PRE},{label:r.t("Post"),value:l.HOOK_TYPE_POSITION_POST}],t.loaders={delete:!1,state:!1},t.backups={},t.clones={},t.destinations={},t.types={},t.types[l.BACKUP_TYPE_ACCOUNT]=r.t("Accounts"),t.types[l.BACKUP_TYPE_DIRECTORY]=r.t("Directories"),t.positions={},t.positions[l.HOOK_POSITION_BACKUP]=r.t("Backup"),t.positions[l.HOOK_POSITION_BACKUP_ACCOUNT]=r.t("Backup Account"),t.positions[l.HOOK_POSITION_RESTORE]=r.t("Restore"),t.positions[l.HOOK_POSITION_DOWNLOAD]=r.t("Download"),t.positions[l.HOOK_POSITION_REINDEX]=r.t("Reindex"),t.positions[l.HOOK_POSITION_SNAPSHOT]=r.t("Snapshot"),t.positions[l.HOOK_POSITION_CLONE]=r.t("Clone"),t.positions[l.HOOK_POSITION_CLONE_ACCOUNT]=r.t("Clone Account"),t.position_types={},t.position_types[l.HOOK_TYPE_POSITION_PRE]=r.t("Pre"),t.position_types[l.HOOK_TYPE_POSITION_POST]=r.t("Post"),s=s.new("hooks"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("name"),s.getSortDirection()||s.setSortDirection("asc"),s.setSortFields(["name","position_type","position","owner","disabled"]),s.setTotalItems(t.hooks.length),t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,o.open({message:r.t("This hook will be permanently deleted!"),confirm:function(){i.deleteHook({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),c.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,c.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},t.toggleStatus=function(e){t.loaders.state=!0;var n=!e.disabled;i.manageHook({data:{_id:e._id,action:"modify",disabled:n},success:function(a,i){t.loaders.state=!1,e.disabled=n,c.success(i)},failed:function(e){t.loaders.state=!1,c.error(e)}})},t.init=!1,t.fetch=function(e){if(t.init||e){t.init=!0,t.loading=!0;var n={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};n.sort[s.getSortBy()]=s.getSortDirectionInt(),t.filter&&(n.find.position_type=t.filter),t.hooks=[],i.listHooks({data:n,success:function(e){s.setTotalItems(e.total),s.calculate(e.hooks);for(var n=0;n<e.hooks.length;n++){var a=e.hooks[n].data_list;if(a.length)switch(e.hooks[n].position){case l.HOOK_POSITION_BACKUP:case l.HOOK_POSITION_BACKUP_ACCOUNT:for(var i=0;i<a.length;i++)a[i]=void 0!==t.backups[a[i]]?t.backups[a[i]].name:"Unknown";break;case l.HOOK_POSITION_RESTORE:case l.HOOK_POSITION_DOWNLOAD:for(var i=0;i<a.length;i++)a[i]=void 0!==t.types[a[i]]?t.types[a[i]]:"Unknown";break;case l.HOOK_POSITION_REINDEX:for(var i=0;i<a.length;i++)a[i]=void 0!==t.destinations[a[i]]?t.destinations[a[i]].name:"Unknown"}t.hooks.push(e.hooks[n])}t.loading=!1},failed:function(e){c.error(e)}})}},i.listBackupJobs({success:function(e){for(var n=0;n<e.jobs.length;n++)t.backups[e.jobs[n]._id]=e.jobs[n];i.listDestinations({success:function(e){for(var n=0;n<e.destinations.length;n++)t.destinations[e.destinations[n]._id]=e.destinations[n];a(t.fetch(!0))}})}})}])}),define("controllers/hookManage",["app"],function(e){e.controller("hookManage",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","util","lang","consts","confirm","cfpLoadingBar","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f,p){e.$emit("menuItem","Hooks"),t.details={},t.saveData={name:"",position_type:u.HOOK_POSITION_BACKUP,position:u.HOOK_TYPE_POSITION_PRE,data_list:[],script:""},t.saveing=!1,t.changed=!1,t.cancelled=!1,t.backups={},t.clones={},t.destinations={},t.positions=[{label:l.t("Backup"),value:u.HOOK_POSITION_BACKUP},{label:l.t("Backup Account"),value:u.HOOK_POSITION_BACKUP_ACCOUNT},{label:l.t("Clone"),value:u.HOOK_POSITION_CLONE},{label:l.t("Clone Account"),value:u.HOOK_POSITION_CLONE_ACCOUNT},{label:l.t("Restore"),value:u.HOOK_POSITION_RESTORE},{label:l.t("Download"),value:u.HOOK_POSITION_DOWNLOAD},{label:l.t("Reindex"),value:u.HOOK_POSITION_REINDEX}],t.position_types=[{label:l.t("Pre"),value:u.HOOK_TYPE_POSITION_PRE},{label:l.t("Post"),value:u.HOOK_TYPE_POSITION_POST}],t.types={},t.types[u.HOOK_POSITION_RESTORE]=[{label:l.t("Accounts"),value:u.BACKUP_TYPE_ACCOUNT}],t.types[u.HOOK_POSITION_DOWNLOAD]=[{label:l.t("Accounts"),value:u.BACKUP_TYPE_ACCOUNT}],t.itemsSelection=function(){var e={};e[u.HOOK_POSITION_BACKUP]={template:"backupJobsSelection",resolve:{jobs:function(){return t.saveData.data_list}}},e[u.HOOK_POSITION_BACKUP_ACCOUNT]=e[u.HOOK_POSITION_BACKUP],e[u.HOOK_POSITION_CLONE]={template:"cloneJobsSelection",resolve:{jobs:function(){return t.saveData.data_list}}},e[u.HOOK_POSITION_CLONE_ACCOUNT]=e[u.HOOK_POSITION_CLONE],e[u.HOOK_POSITION_REINDEX]={template:"destinationsSelection",controller:"destinationsSelection",resolve:{destinations:function(){return t.saveData.data_list},readonly:function(){return!0},types:function(){return u.DESTINATION_JOB_TYPE_BACKUP},legacy:function(){return!0},local:function(){return!0}}},void 0!==e[t.saveData.position]&&p.open(e[t.saveData.position]).result.then(function(e){t.saveData.data_list=e},function(){})},t.searchCloneJobs=function(e){if(e){var n=s.defer();return o.listCloneJobs({data:{filter:e,sort:{name:1}},success:function(e){for(var a=[],i=0;i<e.jobs.length;i++)if(!(t.saveData.data_list.indexOf(e.jobs[i]._id)>=0)){var s=e.jobs[i],o=parseInt(s.type),c=parseInt(s.contains),r=[];switch(o){case u.CLONE_TYPE_ACCOUNT:c==u.CLONE_TYPE_ACCOUNT_FULL?r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_FULL]):(c&u.CLONE_TYPE_ACCOUNT_CONFIG&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_CONFIG]),c&u.CLONE_TYPE_ACCOUNT_HOMEDIR&&r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_HOMEDIR]),c&u.CLONE_TYPE_ACCOUNT_DATABASES&&r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_DATABASES]),c&u.CLONE_TYPE_ACCOUNT_EMAILS&&r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_EMAILS]),c&u.CLONE_TYPE_ACCOUNT_CRON_JOBS&&r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_CRON_JOBS]),c&u.CLONE_TYPE_ACCOUNT_DOMAINS&&r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_DOMAINS]),c&u.CLONE_TYPE_ACCOUNT_CERTIFICATES&&r.push(u.CLONE_TYPE_ACCOUNT_NAMES[u.CLONE_TYPE_ACCOUNT_CERTIFICATES]))}s.contains_name=r.join(", "),a.push(s)}n.resolve(a)}}),n.promise}return[]},t.searchBackupJobs=function(e){if(e){var n=s.defer();return o.listBackupJobs({data:{filter:e,sort:{name:1}},success:function(e){for(var a=[],i=0;i<e.jobs.length;i++)if(!(t.saveData.data_list.indexOf(e.jobs[i]._id)>=0)){var s=e.jobs[i],o=parseInt(s.type),c=parseInt(s.contains),r=[];switch(o){case u.BACKUP_TYPE_ACCOUNT:c==u.BACKUP_TYPE_ACCOUNT_FULL?r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_FULL]):(c&u.BACKUP_TYPE_ACCOUNT_CONFIG&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_CONFIG]),c&u.BACKUP_TYPE_ACCOUNT_HOMEDIR&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_HOMEDIR]),c&u.BACKUP_TYPE_ACCOUNT_DATABASES&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_DATABASES]),c&u.BACKUP_TYPE_ACCOUNT_EMAILS&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_EMAILS]),c&u.BACKUP_TYPE_ACCOUNT_CRON_JOBS&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_CRON_JOBS]),c&u.BACKUP_TYPE_ACCOUNT_DOMAINS&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_DOMAINS]),c&u.BACKUP_TYPE_ACCOUNT_CERTIFICATES&&r.push(u.BACKUP_TYPE_ACCOUNT_NAMES[u.BACKUP_TYPE_ACCOUNT_CERTIFICATES]));break;case u.BACKUP_TYPE_DIRECTORY:r.push(u.BACKUP_TYPE_DIRECTORY_NAMES[u.BACKUP_TYPE_DIRECTORY_FULL])}s.contains_name=r.join(", "),a.push(s)}n.resolve(a)}}),n.promise}return[]},t.searchDestinations=function(e){if(e){var n=s.defer();return o.listDestinations({data:{filter:e,sort:{name:1}},success:function(e){for(var a=[],i=0;i<e.destinations.length;i++)t.saveData.data_list.indexOf(e.destinations[i]._id)>=0||a.push(e.destinations[i]);n.resolve(a)}}),n.promise}return[]},t.selectItem=function(e,n){void 0!==e&&(t.saveData.data_list.push(e._id),n.searchBackupText="",n.searchCloneText="",n.searchDestinationText="")},t.fetchHookData=function(e){o.getHook({data:{_id:e},success:function(e){t.details=e,t.saveData=r.duplicateObject(t.details)},failed:function(){a.path("/hooks")}})},t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id"])},!0),t.resetList=function(){t.saveData.data_list=[]},t.$on("$destroy",function(){t.changed&&!t.cancelled&&d.open({message:l.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:l.t("Disregard Changes"),confirmLabel:l.t("Save")})}),t.manageTypesList=function(e){var n=t.saveData.data_list.indexOf(e);n>=0?t.saveData.data_list.splice(n,1):t.saveData.data_list.push(e)},t.cancel=function(){t.cancelled=!0,a.path("/hooks")},t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n=r.saveParams(t.saveData,t.details);n.action=t.details._id?"modify":"create",o.manageHook({data:n,success:function(n,i){t.saveing=!1,t.changed=!1,t.saveData._id=n._id,t.details=r.duplicateObject(t.saveData),e?a.path("/hookManage/"+n._id):a.path("/hooks"),f.success(i)},failed:function(e){t.saveing=!1,f.error(e)}})}},o.listBackupJobs({success:function(e){for(var n=0;n<e.jobs.length;n++)t.backups[e.jobs[n]._id]=e.jobs[n]}}),o.listCloneJobs({success:function(e){for(var n=0;n<e.jobs.length;n++)t.clones[e.jobs[n]._id]=e.jobs[n]}}),o.listDestinations({success:function(e){for(var n=0;n<e.destinations.length;n++)t.destinations[e.destinations[n]._id]=e.destinations[n]}});var g=n.id;g?i(t.fetchHookData(g)):_.complete()}])}),define("controllers/tags",["app"],function(e){e.controller("tags",["$rootScope","$scope","$location","$timeout","api","meta","confirm","alert","lang","consts",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Accounts"),t.tags=[],t.loading=!1,t.saveing=!1,t.filter="",t.types={},t.types[l.TAG_TYPE_ACCOUNT]=r.t("Account"),t.loaders={delete:!1},s=s.new("tags"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("name"),s.getSortDirection()||s.setSortDirection("asc"),s.setSortFields(["name","type","color","owner"]),s.setTotalItems(t.tags.length),t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,o.open({message:r.t("This tag will be permanently deleted, also this tag will be removed from all accounts that are using it!"),confirm:function(){i.deleteTag({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),c.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,c.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},t.fetch=function(){if(!t.loading){t.loading=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.filter&&(e.find.type=t.filter),t.tags=[],i.listTags({data:e,success:function(e){s.setTotalItems(e.total),s.calculate(e.tags),t.tags=e.tags,t.loading=!1}})}},a(t.fetch())}])}),define("controllers/tagManage",["app"],function(e){e.controller("tagManage",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","util","lang","consts","confirm","cfpLoadingBar","alert",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","Accounts");var p=function(){for(var e="#",t=0;t<6;t++)e+="0123456789ABCDEF"[Math.floor(16*Math.random())];return e.toLowerCase()};t.details={},t.saveData={name:"",type:u.TAG_TYPE_ACCOUNT,color:p()},t.saveing=!1,t.changed=!1,t.cancelled=!1,t.colors=["#3e3c3e","#666366","#8d8a8d","#b4b2b4","#e5a8de","#d87bcc","#cb4dba","#ab329b","#7e2572","#511849","#900c3f","#c70039","#ff5733","#ff8d1a","#ffc300","#eddd53","#add45c","#57c785","#00baad","#2a7b9b","#3d3d6b","#6464a6","#4848c2","#2c2cde"],t.types=[{label:l.t("Account"),value:u.TAG_TYPE_ACCOUNT}],t.randomColor=function(){t.saveData.color=p()},t.fetchTagData=function(e){o.getTag({data:{_id:e},success:function(e){t.details=e,t.saveData=r.duplicateObject(t.details)},failed:function(){a.path("/tags")}})},t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("$destroy",function(){t.changed&&!t.cancelled&&d.open({message:l.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:l.t("Disregard Changes"),confirmLabel:l.t("Save")})}),t.cancel=function(){t.cancelled=!0,a.path("/tags")},t.saveChanges=function(e){if(!t.saveing){t.saveing=!0;var n=r.saveParams(t.saveData,t.details);n.action=t.details._id?"modify":"create",o.manageTag({data:n,success:function(n,i){t.saveing=!1,t.changed=!1,t.saveData._id=n._id,t.details=r.duplicateObject(t.saveData),e?a.path("/tagManage/"+n._id):a.path("/tags"),f.success(i)},failed:function(e){t.saveing=!1,f.error(e)}})}};var g=n.id;g?i(t.fetchTagData(g)):_.complete()}])}),define("controllers/tagsSelection",["app"],function(e){e.controller("tagsSelection",["$uibModalInstance","$scope","$timeout","api","lang","tags","type",function(e,t,n,a,i,s,o){t.loading=!1,t.tags=[],t.fetchTags=function(){t.loading=!0,a.listTags({data:{find:{type:o},sort:{name:1}},success:function(e){for(var n=0;n<e.tags.length;n++)e.tags[n].checked=!(void 0===s||!s.length)&&s.indexOf(e.tags[n]._id)>=0,t.tags.push(e.tags[n]);t.loading=!1}})},n(t.fetchTags()),t.ok=function(){for(var n=[],a=0;a<t.tags.length;a++)t.tags[a].checked&&n.push(t.tags[a]._id);e.close(n)},t.cancel=function(){e.dismiss(i.t("cancel"))}}])}),define("controllers/destinationsSelection",["app"],function(e){e.controller("destinationsSelection",["$uibModalInstance","$scope","$timeout","api","lang","meta","destinations","readonly","types","legacy","local",function(e,t,n,a,i,s,o,c,r,l,u){t.loading=!1,t.destinations=[],t.fetchDestinations=function(){t.loading=!0,a.listDestinations({data:{types:r,readonly:c,sort:{name:1}},success:function(e){for(var n=0;n<e.destinations.length;n++)!l&&e.destinations[n].legacy||(u||"Local"!=e.destinations[n].type&&"Localv2"!=e.destinations[n].type)&&(e.destinations[n].checked=!(void 0===o||!o.length)&&o.indexOf(e.destinations[n]._id)>=0,t.destinations.push(e.destinations[n]));t.loading=!1}})},n(t.fetchDestinations()),t.ok=function(){for(var n=[],a=0;a<t.destinations.length;a++)t.destinations[a].checked&&n.push(t.destinations[a]._id);e.close(n)},t.cancel=function(){e.dismiss(i.t("cancel"))}}])}),define("controllers/backupJobsSelection",["app"],function(e){e.controller("backupJobsSelection",["$uibModalInstance","$scope","$timeout","api","lang","meta","jobs",function(e,t,n,a,i,s,o){t.loading=!1,t.jobs=[],t.fetchJobs=function(){t.loading=!0,a.listBackupJobs({data:{sort:{name:1}},success:function(e){for(var n=0;n<e.jobs.length;n++)e.jobs[n].checked=!(void 0===o||!o.length)&&o.indexOf(e.jobs[n]._id)>=0;t.jobs=e.jobs,t.loading=!1}})},n(t.fetchJobs()),t.ok=function(){for(var n=[],a=0;a<t.jobs.length;a++)t.jobs[a].checked&&n.push(t.jobs[a]._id);e.close(n)},t.cancel=function(){e.dismiss(i.t("cancel"))}}])}),define("controllers/cloneJobsSelection",["app"],function(e){e.controller("cloneJobsSelection",["$uibModalInstance","$scope","$timeout","api","lang","meta","jobs",function(e,t,n,a,i,s,o){t.loading=!1,t.jobs=[],t.fetchJobs=function(){t.loading=!0,a.listCloneJobs({data:{sort:{name:1}},success:function(e){for(var n=0;n<e.jobs.length;n++)e.jobs[n].checked=!(void 0===o||!o.length)&&o.indexOf(e.jobs[n]._id)>=0;t.jobs=e.jobs,t.loading=!1}})},n(t.fetchJobs()),t.ok=function(){for(var n=[],a=0;a<t.jobs.length;a++)t.jobs[a].checked&&n.push(t.jobs[a]._id);e.close(n)},t.cancel=function(){e.dismiss(i.t("cancel"))}}])}),define("controllers/backupLockSelection",["app"],function(e){e.controller("backupLockSelection",["$uibModalInstance","$scope","lang",function(e,t,n){t.ttl=0,t.ok=function(){e.close(t.ttl)},t.cancel=function(){e.dismiss(n.t("cancel"))}}])}),define("controllers/plugins",["app"],function(e){e.controller("plugins",["$rootScope","$scope","$routeParams","$location","lang",function(e,t,n,a,i){e.$emit("menuItem","Plugins"),t.plugins=[],t.loadingPlugins=!1,t.loaders={state:!1,uninstall:!1},t.sections=[{_id:"installed",name:i.t("Installed Plugins"),icon:"fa-edit",template:t.includePath("pluginManage")},{_id:"packages",name:i.t("Available Plugins"),icon:"fa-box",template:t.includePath("packages")},{_id:"repositories",name:i.t("Repositories"),icon:"fa-layer-group",template:t.includePath("repositories")}],t.getSection=function(e){for(var n=0;n<t.sections.length;n++)if(t.sections[n]._id===e)return t.sections[n];return t.sections[0]},t.changeSection=function(e){n.section===e._id&&(t.currentSection=e),a.path("/plugins/"+e._id)},t.changeSection(t.getSection(n.section?n.section:t.sections[0]._id))}])}),define("controllers/packages",["app"],function(e){e.controller("packages",["$rootScope","$scope","$location","$timeout","api","lang","confirm","alert","meta","consts",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","Plugins"),t.packages=[],t.filterRepos=[{label:s.t("All Repositories"),value:""}],t.repo="",t.filterTypes=[{value:"",label:s.t("All Types")},{value:l.PLUGIN_TYPE_DESTINATION,label:s.t("Destinations")},{value:l.PLUGIN_TYPE_NOTIFICATION,label:s.t("Notification")},{value:l.PLUGIN_TYPE_SECURITY,label:s.t("Security")},{value:l.PLUGIN_TYPE_ADDON,label:s.t("Addons")}],t.type="",t.loadingPackages=!1,t.loaders={install:!1},r=r.new("packages"),t.meta=r,t.metaData=r.getData(),r.getSortBy()||r.setSortBy("created"),r.getSortDirection()||r.setSortDirection("desc"),r.setPageSizes([30,60,120,240]),r.setPageSize(30),r.setSortFields(["created"]),r.setTotalItems(t.packages.length),t.switchRepo=function(e){o.open({message:s.t('Are you sure you want to switch this plugin installation to the repository "%s"? This plugin will start picking up updates from this repository',e.repo_name),confirm:function(){i.managePlugin({data:{_id:e.plugin_id,repo:e.repo},success:function(e,n){t.fetch(),c.success(n)},failed:function(e){c.error(e)}})}})},t.uninstall=function(n){o.open({message:s.t("This plugin and all his settings will be permanently deleted!"),confirm:function(){i.uninstallPlugin({data:{_id:n.plugin._id},success:function(a,i){t.loaders.uninstall=!1,void 0!==e.plugins[n.plugin._id]&&(e.plugins[n.plugin._id].visible=!1,e.plugins[n.plugin._id].disabled=!0),t.fetch(),c.success(i)},failed:function(e){t.loaders.uninstall=!1,c.error(e)}})}})},t.reinstall=function(n){o.open({message:s.t("This plugin will be reinstalled!"),confirm:function(){i.installPlugin({data:{package_id:n._id},success:function(a,i){n.installed=!0,n.installable=!1,a.type==l.PLUGIN_TYPE_ADDON&&(e.plugins[a._id]=a),t.fetch(),c.success(i)},failed:function(e){c.error(e)}})}})},t.install=function(n){o.open({message:s.t("This plugin will be installed on this server!"),confirm:function(){i.installPlugin({data:{package_id:n._id},success:function(a,r){n.installed=!0,n.installable=!1,a.type==l.PLUGIN_TYPE_ADDON&&(e.plugins[a._id]=a),t.fetch(),c.success(r),o.open({message:s.t("Would you like to enable this plugin?"),confirmLabel:s.t("Enable Plugin"),confirm:function(){i.managePlugin({data:{_id:a._id,disabled:!1,visible:a.type==l.PLUGIN_TYPE_ADDON},success:function(t,n){if(void 0!==e.plugins[t._id])for(var a in e.plugins[t._id])e.plugins[t._id][a]=t[a];c.success(n)},failed:function(e){c.error(e)}})}})},failed:function(e){c.error(e)}})}})},t.update=function(e){o.open({message:s.t("This plugin will be updated to version %s",e.version),confirm:function(){i.updatePlugin({data:{_id:e.plugin._id},success:function(e,n){t.fetch(),c.success(n)},failed:function(e){c.error(e)}})}})},t.fetch=function(){t.loadingPackages=!0;var e={sort:{},skip:r.getSkip(),limit:r.getPageSize(),find:{},filter:r.getFilter()};e.sort[r.getSortBy()]=r.getSortDirectionInt(),t.repo&&(e.find.repo=t.repo),t.type&&(e.find.type=t.type),t.packages=[],i.listPackages({data:e,success:function(e){r.setTotalItems(e.total),r.calculate(e.packages),t.packages=e.packages,t.loadingPackages=!1}})},i.listRepositories({success:function(e){for(var n=0;n<e.repositories.length;n++)t.filterRepos.push({label:e.repositories[n].name,value:e.repositories[n]._id})}}),a(t.fetch)}])}),define("controllers/showcase",["app"],function(e){e.controller("showcase",["$rootScope","$scope","$controller","$q","$location","$timeout","api","permissions","alert",function(t,n,a,i,s,o,c,r,l){var u=window.PAGE.showcase;u.total_unapproved||s.path("/"),n.showcases={},n.features={};for(var d=0;d<u.total;d++)if(!u.features[d].approved){var _=u.features[d].feature+u.features[d].order;n.showcases[_]=u.features[d],e.registerShowcaseController(u.features[d],function(e,t){
n.features[t]=n.showcases[t]})}n.checkFeatures=function(){if(window.PAGE.showcase.total_unapproved>0)return!1;r.init(window.PAGE.permissions),s.path("/")},n.setStatus=function(e){l.error(e)},t.$on("approve",function(e,t){var a=t.feature+t.order;c.approveShowcase({data:{_id:t._id},success:function(){window.PAGE.showcase.total_unapproved--,n.features[a].approved=!0,n.checkFeatures()},failed:function(e){n.setStatus(e)}})}),t.$on("error",function(e,t){n.setStatus(t)}),n.saveChanges=function(){t.$broadcast("save")}}])}),define("controllers/plugin",["app"],function(e){e.controller("plugin",["$rootScope","$scope","$routeParams","$location","$timeout","lang","api","util","consts","alert",function(t,n,a,i,s,o,c,r,l,u){if(!a.plugin)return void i.path("/");t.$emit("menuItem","Plugin"+a.plugin),n.plugin={},n.saveData={},n.saveing=!1,n.pluginView="",n.publicDir="",c.getPlugin({data:{code:a.plugin,type:l.PLUGIN_TYPE_ADDON},success:function(t){if(t.disabled||!t.visible)return void i.path("/");n.plugin=t,n.saveData=r.duplicateObject(n.plugin),o.setDefaultNS("plugins-addon-"+n.plugin.code),e.registerPluginController(n.plugin,function(e){n.publicDir=e,n.pluginView=n.publicDir+"/view.htm?v="+n.plugin.version})},failed:function(){i.path("/")}}),n.saveChanges=function(e){if(!n.saveing){void 0===e&&"function"==typeof e||(e=function(){}),n.saveing=!0;var t=r.saveParams(n.saveData,n.plugin);c.managePlugin({data:t,success:function(t,a){n.saveing=!1,e(),u.success(a)},failed:function(t){n.saveing=!1,e(),u.error(t)}})}}}])}),define("controllers/pluginManage",["app"],function(e){e.controller("pluginManage",["$rootScope","$scope","$location","$timeout","api","meta","filter","confirm","alert","lang","consts",function(e,t,n,a,i,s,o,c,r,l,u){e.$emit("menuItem","Plugins"),t.plugins=[],t.loadingPlugins=!1,t.filter="",t.filterOptions=[{value:"",label:l.t("All Plugins")},{value:u.PLUGIN_TYPE_DESTINATION,label:l.t("Destination Plugins")},{value:u.PLUGIN_TYPE_NOTIFICATION,label:l.t("Notification Plugins")},{value:u.PLUGIN_TYPE_SECURITY,label:l.t("Security Plugins")},{value:u.PLUGIN_TYPE_ADDON,label:l.t("Addon Plugins")}],t.loaders={state:!1,update:!1,visible:!1,autoupdate:!1,uninstall:!1},t.permissions=[{value:u.PLUGIN_PERMISSION_ROOT,name:l.t("Root Access")},{value:u.PLUGIN_PERMISSION_RESELLER,name:l.t("Root & Reseller Access")},{value:u.PLUGIN_PERMISSION_USER,name:l.t("Root, Reseller & User Access")}],s=s.new("plugins_manage"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("created"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["created"]),s.setTotalItems(t.plugins.length),t.savePermissions=function(e){i.managePlugin({data:{_id:e._id,permissions:e.permissions},success:function(e){t.updatePlugin(e)},failed:function(e){r.error(e)}})},t.updatePlugin=function(t){if(void 0!==e.plugins[t._id])for(var n in e.plugins[t._id])e.plugins[t._id][n]=t[n]},t.uninstall=function(n){t.loaders.uninstall||(t.loaders.uninstall=!0,c.open({message:l.t("This plugin and all his settings will be permanently deleted!"),confirm:function(){i.uninstallPlugin({data:{_id:n._id},success:function(a,i){t.loaders.uninstall=!1,void 0!==e.plugins[n._id]&&(e.plugins[n._id].visible=!1,e.plugins[n._id].disabled=!0),t.fetch(),r.success(i)},failed:function(e){t.loaders.uninstall=!1,r.error(e)}})},cancel:function(){t.loaders.uninstall=!1}}))},t.toggleStatus=function(e){t.loaders.state=!0,i.managePlugin({data:{_id:e._id,disabled:!e.disabled},success:function(n){t.loaders.state=!1,e.disabled=n.disabled,t.updatePlugin(n)},failed:function(e){t.loaders.state=!1,r.error(e)}})},t.toggleVisible=function(e){t.loaders.visible=!0,i.managePlugin({data:{_id:e._id,visible:!e.visible},success:function(n){t.loaders.visible=!1,e.visible=n.visible,t.updatePlugin(n)},failed:function(e){t.loaders.visible=!1,r.error(e)}})},t.autoupdate=function(e){e.updating||(t.loaders.update=!0,c.open({message:l.t("This plugin will be updated to version %s",e.available_package),confirm:function(){e.updating=!0,i.updatePlugin({data:{_id:e._id},success:function(n){e.updating=!1,t.loaders.update=!1,e.version=n.version,e.available_package=n.available_package,t.updatePlugin(n)},failed:function(e){t.loaders.update=!1,r.error(e)}})},cancel:function(){t.loaders.update=!1}}))},t.fetch=function(){t.loadingPlugins=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.filter&&(e.find.type=t.filter),t.plugins=[],i.listPlugins({data:e,success:function(e){s.setTotalItems(e.total),s.calculate(e.plugins),t.plugins=e.plugins,t.loadingPlugins=!1}})},a(t.fetch)}])}),define("controllers/logs",["app"],function(e){e.controller("logs",["$rootScope","$scope","$location","$timeout","api","meta","filter","confirm","$interval","lang","consts","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){e.$emit("menuItem","Logs"),t.logs=[],t.logsProcessingList={},t.checkTimeout=void 0,t.loadingLogs=!1,t.showPager=!0,t.checkall=!1,t.checked=!1;var f=o.new("logs_filter");f.getFilter()||f.setFilter(0);var p=f.getFilter();t.filter=p,f.setFilter(0);var g=o.new("logs_subfilter");t.subfilter=g.getFilter(),t.statusfilter=0,g.setFilter(""),t.subfilterTitle="",t.subfilterOptions=[],t.filterOptions=[{label:l.t("All Logs"),value:0},{label:l.t("Backup Logs"),value:u.LOG_TYPE_BACKUP},{label:l.t("Clone Logs"),value:u.LOG_TYPE_CLONE},{label:l.t("Backup on Demand Logs"),value:u.LOG_TYPE_BACKUP_ON_DEMAND},{label:l.t("Download Logs"),value:u.LOG_TYPE_DOWNLOAD},{label:l.t("Restore Logs"),value:u.LOG_TYPE_RESTORE},{label:l.t("Reindex Logs"),value:u.LOG_TYPE_REINDEX},{label:l.t("System Logs"),value:u.LOG_TYPE_SYSTEM}],t.statusFilterOptions=[{label:l.t("All Statuses"),value:0}];for(var E in u.LOG_STATUS_NAMES)t.statusFilterOptions.push({label:u.LOG_STATUS_NAMES[E],value:E});t.loaders={stop:!1,delete:!1,view:!1,summary:!1},t.$watch("filter",function(e){if(t.subfilterTitle="",t.subfilterOptions=[],p||(t.subfilter=""),p=0,t.filter===u.LOG_TYPE_BACKUP||t.filter===u.LOG_TYPE_CLONE||t.filter===u.LOG_TYPE_BACKUP_ON_DEMAND)switch(t.filter){case u.LOG_TYPE_BACKUP:t.subfilterTitle="Backup Job",t.subfilterOptions.push({label:l.t("All Backup Jobs"),value:""}),i.listBackupJobs({data:{list_hidden:!0},success:function(e){for(var n=0;n<e.jobs.length;n++)t.subfilterOptions.push({label:e.jobs[n].name,value:e.jobs[n]._id})}});break;case u.LOG_TYPE_CLONE:t.subfilterTitle="Clone Job",t.subfilterOptions.push({label:l.t("All Clone Jobs"),value:""}),i.listCloneJobs({data:{list_hidden:!0},success:function(e){for(var n=0;n<e.jobs.length;n++)t.subfilterOptions.push({label:e.jobs[n].name,value:e.jobs[n]._id})}})}},!0),s=s.new("logs"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("start_time"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["pid","type","start_time","end_time","status"]),s.setTotalItems(t.logs.length),t.onClickDownload=function(e){window.location=t.downloadURL("log_id="+e._id)},t.onClickDelete=function(e){t.loaders.delete=!0,c.open({message:l.t("The selected log will be permanently deleted!"),confirm:function(){i.deleteLog({data:{_id:[e._id]},success:function(e,n){t.loaders.delete=!1,t.checkall=!1,t.fetch(),d.success(n)},failed:function(e){t.loaders.delete=!1,d.error(e)}})},cancel:function(){t.loaders.delete=!1}})},t.onClickView=function(e){t.loaders.view=!0,i.getLog({data:{_id:e._id,content:1},success:function(e){if(t.loaders.view=!1,!e.content)return void d.error(l.t("No log content found"));_.open({size:"lg",template:"logViewer",scope:t,resolve:{log:function(){return e}}}).result.then(function(){},function(){})},failed:function(e){t.loaders.view=!1,d.error(e)}})},t.onClickSummary=function(e){_.open({size:"lg",template:"logItems",scope:t,resolve:{log:function(){return e}}}).result.then(function(){},function(){})},t.checkChanged=function(){for(var e=0;e<t.logs.length;e++)if(t.logs[e].checked&&t.logs[e].status!=u.LOG_STATUS_PROCESSING)return void(t.checked=!0);t.checked=!1},t.setCheckAll=function(){for(var e=0;e<t.logs.length;e++){var n=t.logs[e];n.status!=u.LOG_STATUS_PROCESSING&&t.permissions[n.type]&&(n.checked=t.checkall)}t.checkChanged()},t.deleteSelected=function(){var e=[];for(var n in t.logs)t.logs[n].checked&&e.push(t.logs[n]._id);if(!e.length)return d.error(l.t("No log IDs selected")),!1;c.open({message:l.t("The selected logs will be permanently deleted!"),confirm:function(){i.deleteLog({data:{_id:e},success:function(e,n){t.checkall=!1,t.checked=!1,t.fetch(),d.success(n)},failed:function(e){d.error(e)}})},cancel:function(){t.saveing=!1}})},t.updateAlert=function(e){for(var n in t.logs)if(t.logs[n]._id===e._id)return t.logs[n]=e,!1},t.fetch=function(){t.loadingLogs=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};if(t.filter&&(e.find.type=t.filter),t.statusfilter&&(e.find.status=t.statusfilter),t.subfilter)switch(t.filter){case u.LOG_TYPE_BACKUP:case u.LOG_TYPE_CLONE:e.find["info.ID"]=t.subfilter}e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.logs=[],t.logsProcessingList=[],i.listLogs({data:e,success:function(e){s.setTotalItems(e.total),s.calculate(e.logs),t.logs=e.logs;for(var n in t.logs){t.logs[n].status===u.LOG_STATUS_PROCESSING&&t.logsProcessingList.push(t.logs[n]),t.logs[n].information=[];for(var a in t.logs[n].info)t.logs[n].information.push({key:a,value:t.logs[n].info[a]})}T(),t.loadingLogs=!1}})};var T=function(){void 0===t.checkTimeout&&t.logsProcessingList.length&&(t.checkTimeout=setTimeout(function(){t.checkTimeout=void 0;var e=!1,n=!1,a={};a._id=[];for(var s=0;s<t.logsProcessingList.length;s++)a._id.push(t.logsProcessingList[s]._id);i.listLogs({data:a,success:function(a){for(var i=a.logs,s=0;s<i.length;s++){i[s].status===u.LOG_STATUS_PROCESSING?n=!0:i[s].status!==u.LOG_STATUS_PROCESSING&&(e=!0);for(var o=0;o<t.logsProcessingList.length;o++)t.logsProcessingList[o]._id==i[s]._id&&(t.logsProcessingList[o].start_time=i[s].start_time,t.logsProcessingList[o].end_time=i[s].end_time,t.logsProcessingList[o].execution_time=i[s].execution_time)}e&&t.fetch(),n&&T()}})},3e3))};t.$on("$destroy",function(){void 0!==t.checkTimeout&&(clearTimeout(t.checkTimeout),t.checkTimeout=void 0)}),a(t.fetch)}])}),define("controllers/logViewer",["app"],function(e){e.controller("logViewer",["$uibModalInstance","$scope","log",function(e,t,n){t.log=n,t.log.information=[];for(var a in t.log.info)t.log.information.push({key:a,value:t.log.info[a]});t.ok=function(){e.close()}}])}),define("controllers/logItems",["app"],function(e){e.controller("logItems",["$uibModalInstance","$scope","$timeout","lang","meta","consts","api","alert","log","popup",function(e,t,n,a,i,s,o,c,r,l){t.log=r,t.items=[],t.loadingItems=!1,t.loaders={view:!1},i=i.new("log_items"),t.meta=i,t.metaData=i.getData(),i.getSortBy()||i.setSortBy("priority"),i.getSortDirection()||i.setSortDirection("asc"),i.setSortFields(["priority","started","ended","execution_time","owner","status"]),i.setTotalItems(t.items.length),i.setPageSizes([5,10]),i.setPageSize(5),i.setLimit(5),t.downloadLogItem=function(e){window.location=t.downloadURL("log_id="+t.log._id+":"+e._id)},t.viewLogItem=function(e){t.loaders.view=!0,o.getLogItem({data:{_id:e._id,log_id:t.log._id,content:1},success:function(e){if(t.loaders.view=!1,!e.content)return void c.error(a.t("No log content found"));l.open({size:"lg",template:"logViewer",scope:t,resolve:{log:function(){var t={};return e.data.account&&(t.account=e.data.account),t.priority=e.priority,t.created=a.d(e.created),{_id:e._id,type:e.type,file:e.file,content:e.content,start_time:e.started,end_time:e.ended,execution_time:e.execution_time,status:s.QUEUE_STATUS_TO_LOG[e.status],info:t}}}}).result.then(function(){},function(){})},failed:function(e){t.loaders.view=!1,c.error(e)}})},t.fetch=function(){t.loadingItems=!0;var n={skip:i.getSkip(),limit:i.getPageSize(),sort:{},filter:i.getFilter(),log_id:t.log._id};n.sort[i.getSortBy()]=i.getSortDirectionInt(),t.items=[],o.listLogItems({data:n,success:function(e){i.setTotalItems(e.total),i.calculate(e.items),t.items=e.items,t.loadingItems=!1},failed:function(t){c.error(t),e.close()}})},n(t.fetch),t.close=function(){e.close()}}])}),define("controllers/settings",["app"],function(e){e.controller("settings",["$rootScope","$scope","$routeParams","$location","$timeout","api","meta","confirm","util","permissions","cfpLoadingBar","lang","alert",function(t,n,a,i,s,o,c,r,l,u,d,_,f){t.$emit("menuItem","Settings"),n.saveing=!1,n.changed=!1,n.loading=!1,n.sectionChanged=!1,t.noSaveButton=!1,n.details={},n.saveData={},n.sections=[{_id:"general",name:_.t("General"),template:"general",icon:"fa-cogs",docs:"/Settings/general.html"},{_id:"performance",name:_.t("Performance"),template:"performance",icon:"fa-sliders-h",docs:"/Settings/performance.html"},{_id:"resource",name:_.t("Resource"),template:"resource",icon:"fa-microchip",docs:"/Settings/resource.html"},{_id:"restore",name:_.t("Restore"),template:"restore",icon:"fa-sync",docs:"/Settings/restore.html"},{_id:"privacy",name:_.t("Privacy & Security"),template:"privacy",icon:"fa-lock",docs:"/Settings/privacyAndSecurity.html"},{_id:"panel",name:_.t("Panel"),template:"panel",icon:"fa-solar-panel",docs:"/Settings/Panel.html"},{_id:"snapshots",name:_.t("Backup on Demand"),template:"snapshots",icon:"fa-cubes",docs:"/Settings/snapshots.html"},{_id:"notification",name:_.t("Notification"),template:"notification",icon:"fa-bell",docs:"/Settings/notification.html"},{_id:"binary",name:_.t("Binary Locations"),template:"binary",icon:"fa-terminal",docs:"/Settings/binaryLocations.html"}],n.getSection=function(e){for(var t=0;t<n.sections.length;t++)if(n.sections[t]._id===e)return n.sections[t];return n.sections[0]},n.changeSection=function(e){if(!n.changed)return void i.path("/settings/"+e._id);n.sectionChanged=!0,r.open({message:_.t("You didn't saved your changes"),confirm:function(){},cancel:function(){i.path("/settings/"+e._id)},cancelLabel:_.t("Leave Section"),confirmLabel:_.t("Stay On Section")})},n.validateOptions={},n.$on("validateOptions",function(e,t){n.validateOptions=t}),n.$on("$destroy",function(){if(n.changed)return n.sectionChanged?void(n.sectionChanged=!1):void r.open({message:_.t("You didn't saved your changes"),confirmLabel:_.t("Save"),cancelLabel:_.t("Disregard Changes"),confirm:n.saveChanges})}),n.loadSection=function(t){n.currentSection=t,"panel"===t._id?(n.settingsSection="",e.registerController("panelSettings","plugins/panel",function(e){n.settingsSection=n.includePath("panel/view","plugins")})):n.settingsSection=n.includePath("settings/"+t.template)},n.loadSection(n.getSection(a.section?a.section:"general")),n.$watch("saveData",function(){n.changed=l.isChanged(n.saveData,n.details)},!0),n.$on("noSaveButtonChange",function(e,t){n.noSaveButton=t}),n.saveChanges=function(e){if(d.start(),!n.saveing){n.saveing=!0;for(var a in n.saveData.options)if(void 0!==n.validateOptions[a]&&!n.validateOptions[a].validation(n.saveData.options[a]))return f.error(_.t("Invalid value provided for %s",n.validateOptions[a].name)),d.complete(),void(n.saveing=!1);var i=l.saveParams(n.saveData,n.details,void 0,function(e){return"mustagree"==e||"suspendbackups"==e});i.section=n.currentSection._id,o.manageSettings({data:i,success:function(a,s){n.saveing=!1,n.changed=!1,n.saveData._id=a._id,n.details=l.duplicateObject(n.saveData),void 0!==e&&e(),"snapshots"===i.section&&(t.info.bod_disabled=!a.backup),n.$broadcast("saveChanges",{success:!0,message:s,data:a}),f.success(s)},failed:function(e){n.saveing=!1,n.$broadcast("saveChanges",{success:!1,message:e}),f.error(e)}})}},n.fetch=function(){n.loading=!0,o.getSettings({data:{section:n.currentSection._id},success:function(e){n.loading=!1,n.details={},n.saveData={},l.countObj(e)&&(n.details=e,n.saveData=l.duplicateObject(n.details))},failed:function(e){f.error(e)}})},s(n.fetch())}])}),define("controllers/settings/binary",["app"],function(e){e.controller("binarySettings",["$rootScope","$scope",function(e,t){t.$on("saveChanges",function(e,n){for(var a in n.data)t.saveData[a]=n.data[a]})}])}),define("controllers/settings/general",["app"],function(e){e.controller("generalSettings",["$rootScope","$scope","api","lang",function(e,t,n,a){t.time_formats=[{value:12,label:a.t("12 hours based (e.g. 11:00 PM)")},{value:24,label:a.t("24 hours based (e.g. 23:00)")}],t.email_integrations=[{value:"",label:"- "+a.t("Disabled")+" -"}],n.listNotificationIntegrations({data:{find:{type:"Email"}},success:function(e){for(var n=0;n<e.notifications.length;n++)t.email_integrations.push({value:e.notifications[n]._id,label:e.notifications[n].name})}}),t.$on("saveChanges",function(e,t){window.PAGE.timeformat=t.data.time_format})}])}),define("controllers/settings/notification",["app"],function(e){e.controller("notificationSettings",["$rootScope","$scope","$timeout","lang","consts","api","confirm","alert","meta",function(e,t,n,a,i,s,o,c,r){t.loadingNotifications=!1,t.notifications=[],t.filter="",t.filterOptions=[{label:a.t("All Notifications"),value:""}],t.saveing=!1,t.loaders={state:!1,delete:!1},r=r.new("notifications"),t.meta=r,t.metaData=r.getData(),r.getSortBy()||r.setSortBy("name"),r.getSortDirection()||r.setSortDirection("asc"),r.setSortFields(["name","type","owner","disabled"]),r.setTotalItems(t.notifications.length),t.onClickDelete=function(e){t.saveing||(t.saveing=!0,t.loaders.delete=!0,o.open({message:a.t("This notification will be permanently deleted!"),confirm:function(){s.deleteNotificationIntegration({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),c.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,c.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}}))},t.toggleStatus=function(e){if(!t.saveing){t.saveing=!0,t.loaders.state=!0;var n=!e.disabled;s.manageNotificationIntegration({data:{_id:e._id,action:"modify",disabled:n},success:function(a,i){t.saveing=!1,t.loaders.state=!1,e.disabled=n,c.success(i)},failed:function(e){t.saveing=!1,t.loaders.state=!1,c.error(e)}})}},t.listNotifications=function(e){void 0!==e&&"function"==typeof e||(e=function(){});var n={sort:{},skip:r.getSkip(),limit:r.getPageSize(),find:{},filter:r.getFilter()};t.filter&&(n.find.type=t.filter),n.sort[r.getSortBy()]=r.getSortDirectionInt(),s.listNotificationIntegrations({data:n,success:function(t,n){e({success:!0,data:t,message:n})},failed:function(t,n){e({success:!1,data:t,message:n})}})},t.fetch=function(){t.loadingNotifications||(t.loadingNotifications=!0,t.listNotifications(function(e){t.notifications=e.data.notifications,t.loadingNotifications=!1,r.setTotalItems(e.data.total),r.calculate(t.notifications)}))},s.listNotificationIntegrationTypes({success:function(e){t.types=e;for(var n=0;n<e.types.length;n++)t.filterOptions.push({label:e.types[n].name,value:e.types[n].key})}}),n(t.fetch)}])}),define("controllers/settings/notificationManage",["app"],function(e){e.controller("notificationManage",["$rootScope","$scope","$routeParams","$q","$location","$timeout","api","meta","util","confirm","permissions","lang","consts","alert",function(t,n,a,i,s,o,c,r,l,u,d,_,f,p){t.$emit("menuItem","Settings"),n.details={type:"",frequency:{},owner:n.loggedAccount._id,owner_name:n.loggedAccount.username,options:{}},n.saveData=l.duplicateObject(n.details),n.autocomplete={accountText:n.saveData.owner_name},n.saveing=!1,n.sending=!1,n.changed=!0,n.cancelled=!1,n.types=[],n.plugin={},n.plugin_available={},n.plugins_available={},n.installing=!1,n.frequencies=[{value:0,label:_.t("Frequency")+" - "+_.t("Disabled")},{value:f.NOTIFICATION_FREQUENCY_REALTIME,label:_.t("Frequency")+" - "+_.t("Real Time")},{value:f.NOTIFICATION_FREQUENCY_ONCEADAY,label:_.t("Frequency")+" - "+_.t("Once a Day")}],n.resetFrequency=function(){void 0===n.saveData.frequency[f.ALERT_LEVEL_INFO]&&(n.saveData.frequency[f.ALERT_LEVEL_INFO]=f.NOTIFICATION_FREQUENCY_REALTIME),void 0===n.saveData.frequency[f.ALERT_LEVEL_WARNING]&&(n.saveData.frequency[f.ALERT_LEVEL_WARNING]=f.NOTIFICATION_FREQUENCY_REALTIME),void 0===n.saveData.frequency[f.ALERT_LEVEL_CRITICAL]&&(n.saveData.frequency[f.ALERT_LEVEL_CRITICAL]=f.NOTIFICATION_FREQUENCY_REALTIME)},n.resetFrequency(),n.isAvailableNotificationIntegration=function(){return n.saveData.type&&n.saveData.type.indexOf("AvailableNotificationIntegrations")>=0},n.selectAccount=function(e){if(void 0!==e){n.saveData.owner=e._id,n.saveData.owner_name=e.username,n.autocomplete.accountText=e.username;var t=document.activeElement;t&&t.blur()}},n.searchAccounts=function(e){if(e){var t=i.defer();return c.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]},n.resetOptions=function(){n.options={}},n.loadTemplate=function(t){if(t){if(t.indexOf("::")>=0){var a=t.split("::");t=a[0],n.plugin_available=n.plugins_available[a[1]]}switch(n.resetOptions(),t){case"AvailableNotificationIntegrations":n.notificationIntegrationType=n.includePath("notifications/"+t),n.experimental=void 0!==n.plugin_available.experimental?n.plugin_available.experimental:"";break;default:if(void 0===n.plugin[t])return;_.setDefaultNS("plugins-notification-"+t),e.registerPluginController(n.plugin[t],function(e){n.publicDir=e,n.notificationIntegrationType=n.publicDir+"/view.htm?v="+n.plugin[t].version,n.experimental=n.plugin[t].experimental})}}},n.loadNotificationIntegrationType=function(){n.loadTemplate(n.saveData.type)},n.resetOptions(),n.$on("options",function(e,t){for(var a in t)n.options[a]=t[a]}),n.$watch("saveData",function(){n.changed=l.isChanged(n.saveData,n.details,["_id"])},!0),n.$on("$destroy",function(){n.changed&&!n.cancelled&&u.open({message:_.t("You didn't saved your changes"),confirm:n.saveChanges,cancelLabel:_.t("Disregard Changes"),confirmLabel:_.t("Save")})}),n.cancel=function(){n.cancelled=!0,s.path("/settings/notification")},n.sendTest=function(){if(!n.details._id)return void p.error(_.t("You can't send test message on unconfigured notification integration"));n.sending||(n.sending=!0,c.sendNotificationIntegrationTest({data:{_id:n.details._id},success:function(e,t){n.sending=!1,p.success(t)},failed:function(e){n.sending=!1,p.error(e)}}))},n.saveChanges=function(e,t){if(!n.saveing){n.saveing=!0;var a=l.saveParams(n.saveData,n.details,[],function(e){return void 0===n.details._id&&"type"===e});a.action=n.details._id?"modify":"create",c.manageNotificationIntegration({data:a,success:function(a,i){n.saveing=!1,n.details=a,n.saveData=l.duplicateObject(n.details),n.changed=!1,void 0===t&&(e?s.path("/settings/notification/manage/"+a._id):s.path("/settings/notification"),p.success(i)),void 0!==t&&"function"==typeof t&&t()},failed:function(e){n.saveing=!1,p.error(e),void 0!==t&&"function"==typeof t&&t()}})}},n.installNotificationIntegration=function(){n.installing||(n.installing=!0,u.open({message:_.t("This notification integration will be installed on this server!"),confirm:function(){c.installPlugin({data:{package_id:n.plugin_available._id,disabled:0},success:function(e,t){n.installing=!1,n.plugin_available={},n.loadNotificationIntegrations(function(){n.saveData.type=e.code,n.loadNotificationIntegrationType(),p.success(t)})},failed:function(e){n.installing=!1,p.error(e)}})},cancel:function(){n.installing=!1}}))},n.loadNotificationIntegrations=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),n.types=[],n.plugins_available={},c.listNotificationIntegrationTypes({success:function(t){for(var i=0;i<t.types.length;i++){var s=t.types[i];n.types.push({label:s.name,value:s.key,group:_.t("Installed Integrations")}),n.plugin[s.key]={type:f.PLUGIN_TYPE_NOTIFICATION,code:s.key,version:s.version},n.details.type||a.id||(n.details.type=s.key,n.saveData.type=s.key,n.loadNotificationIntegrationType())}c.listPackagesAvailable({data:{find:{type:f.PLUGIN_TYPE_NOTIFICATION}},success:function(t){for(var a=0;a<t.packages.length;a++){var i=t.packages[a];n.plugins_available[i.code]=i,n.types.push({label:_.t("%s via %s",i.name,i.repo_name),value:"AvailableNotificationIntegrations::"+i.code,group:_.t("Available Integrations")})}e()},failed:function(){e()}})}})},n.loadNotificationIntegrations(function(){a.id&&c.getNotificationIntegration({data:{_id:a.id},success:function(e){n.details=e,"[object Object]"!=={}.toString.apply(n.details.options)&&(n.details.options={}),n.saveData=l.duplicateObject(n.details),n.autocomplete.accountText=n.saveData.owner_name,n.loadNotificationIntegrationType()}})})}])}),define("controllers/settings/performance",["app"],function(e){e.controller("performanceSettings",["$rootScope","$scope","api","lang",function(e,t,n,a){t.queuePriorities=[{_id:"",name:a.t("Default")}],t.fetchQueuePriorities=function(){n.listQueuePriorities({success:function(e){for(var n=e.priorities,a=0;a<n.length;a++)t.queuePriorities.push({_id:n[a]._id,name:n[a].name})}})},t.fetchQueuePriorities(),t.mysqlpackets_options=[{label:a.t("Default"),value:0},{label:"32 MB",value:32},{label:"64 MB",value:64},{label:"128 MB",value:128},{label:"256 MB",value:256},{label:"512 MB",value:512},{label:"1 GB",value:1024}],t.gtidpurged_options=[{label:a.t("Default"),value:""},{label:"Auto",value:"AUTO"},{label:"Off",value:"OFF"},{label:"On",value:"ON"},{label:"Commented",value:"COMMENTED"}]}])}),define("controllers/settings/resource",["app"],function(e){e.controller("resourceSettings",["$rootScope","$scope","lang",function(e,t,n){}])}),define("controllers/settings/privacy",["app"],function(e){e.controller("privacySettings",["$rootScope","$scope","confirm","lang","api",function(e,t,n,a,i){t.encryption_key="",i.getMasterEncryptionKey({success:function(e){t.encryption_key=e.encryption_key}}),t.$watch("saveData.encryption_selection",function(){void 0!==t.details.encryption_selection&&0!=t.details.encryption_selection&&void 0!==t.saveData.encryption_selection&&1!=t.saveData.encryption_selection&&n.open({message:a.t("WARNING! All encrypted backups for accounts that are using *remote* encryption key will be deleted and lost forever!"),confirmLabel:a.t("OK, I understand the risks"),confirm:function(){t.saveData.condition=1},cancel:function(){t.saveData.condition=0,t.saveData.encryption_selection=1}})})}])}),define("controllers/settings/restore",["app"],function(e){e.controller("restoreSettings",["$rootScope","$scope","$timeout","api","consts","lang",function(e,t,n,a,i,s){t.ownership_types=["nobody","user"]}])}),define("controllers/settings/snapshots",["app"],function(e){e.controller("snapshotsSettings",["$rootScope","$scope","$routeParams","$location","$timeout","api","lang","consts",function(e,t,n,a,i,s,o,c){t.backups=[{_id:"",name:o.t("- Disable Backup on Demand System -")}],t.sizes=["MB","GB","TB"],t.fetchBackupJobs=function(){var e={find:{}};e.find.type=c.BACKUP_TYPE_ACCOUNT,e.find.contains=c.BACKUP_TYPE_ACCOUNT_FULL,s.listBackupJobs({data:e,success:function(e){for(var n=0;n<e.jobs.length;n++)t.backups.push(e.jobs[n])}})},i(t.fetchBackupJobs())}])}),define("controllers/fileManager",["app"],function(e){e.controller("fileManager",["$rootScope","$scope","$interval","$timeout","api","meta","$window","$routeParams","$location","permissions","consts","lang","alert","pathManager",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","BackupManager"),t.manager=f.new(void 0!==t.listPathes?t.listPathes:[]),t.type=c.type,t.typeId=c.id,t.typeDetails={name:""},t.files=[],t.loadingFiles=!1,t.currentPath="",t.breadcrumbs=[],t.filesIndex={},t.actionModule=void 0,t.backup_type=2,t.restoringBackup=!1,t.downloadingBackup=!1,t.downloads=[],t.restores=[],t.downloadsTmp=[],t.queues=[],t.isDirectories=!1,t.showhidden=!0,t.checkedAll=!1;var p;t.clearStatus=function(){},t.cancelAction=function(){t.actionModule=void 0},t.changeView=function(e){r.path(e)},t.onClickRestore=function(){if(!g().length)return void _.error("Please select files to restore");t.actionModule="restore"===t.actionModule?void 0:"restore"},t.onClickDownload=function(){if(!g().length)return void _.error("Please select files to download");t.actionModule="download"===t.actionModule?void 0:"download"};var g=function(){var e=[];for(var n in t.filesIndex)for(var a in t.filesIndex[n].files)null!=t.filesIndex[n].files[a]&&void 0!==t.filesIndex[n].files[a].checked&&t.filesIndex[n].files[a].checked&&e.push(t.filesIndex[n].files[a].path);return e};t.canPerformAction=function(){for(var e in t.filesIndex)for(var n in t.filesIndex[e].files)if(null!=t.filesIndex[e].files[n]&&void 0!==t.filesIndex[e].files[n].checked&&t.filesIndex[e].files[n].checked)return!1;return!0},t.emitSelected=function(){for(var n={},a=t.manager.getSelected(),i=0;i<a.length;i++){var s=a[i],o=s.replace(/.*\//,""),c=s.match(/.*\//).join("");if("/"!==c&&(c=c.replace(/\/$/,"")),void 0!==t.filesIndex[c]){for(var r=t.filesIndex[c].files,l=0;l<r.length;l++)if(r[l].name===o){n[s]=r[l];break}}else n[s]={empty:!0}}e.$emit("filesChanged",n)},t.toggleFile=function(e){t.manager.isExists(e.path)?t.manager.removePath(e.path):t.manager.addPath(e.path),t.emitSelected(),t.calculateCheckedAll()},t.isDisabled=function(e){return t.manager.isChildren(e.path)},t.isChecked=function(e){return e.checked=t.manager.isExists(e.path)||t.manager.isChildren(e.path),e.checked},t.isChildrenChecked=function(e){return t.manager.isParent(e.path)};var E=function(e){"/"===e.path&&(e.name="/"+t.type+"-root"),t.breadcrumbs.unshift(e),void 0!==e.parent&&E(e.parent)},T=function(e,n){t.filesIndex[n.path]=e,t.files=e.files,t.loadingFiles=!1};t.toggleHidden=function(){t.showhidden=!t.showhidden,t.calculateCheckedAll()};var A=s.new("file_manager");t.meta=A,t.metaData=A.getData(),A.getSortBy()||A.setSortBy("type"),A.getSortDirection()||A.setSortDirection("asc"),A.setSortFields(["name","type","size","created"]),A.setPageSize(50),A.setPageSizes([10,25,50,100]),A.setTotalItems(t.files.length),t.currentFile=void 0,t.fetch=function(e,n){void 0===e?e=t.currentFile:t.currentFile=e,void 0===e.path&&(e.path="/"),t.loadingFiles=!0,t.files=[],t.breadcrumbs=[],E(e),n&&A.setCurrentPage(1);var a={sort:{},skip:A.getSkip(),limit:A.getPageSize(),find:{},filter:""};a._id=t.typeId,a.type=t.type,a.path=e.path,a.file_id=e.id,a.sort[A.getSortBy()]=A.getSortDirectionInt(),i.fileManager({data:a,success:function(n){for(var a=0;a<n.files.length;a++)n.files[a].path=e.path+("/"===e.path?"":"/")+n.files[a].name,n.files[a].parent=e,n.files[a].hidden="."===n.files[a].name.substr(0,1);A.setTotalItems(n.total),A.calculate(n.files),T(n,e),t.calculateCheckedAll()},failed:function(e){_.error(e)}})},t.hideCheckAll=function(){return t.manager.isExists(t.currentFile.path)||t.manager.isChildren(t.currentFile.path)},t.calculateCheckedAll=function(){for(var e=0;e<t.files.length;e++){var n=t.files[e];if(!("File"!==n.type&&"Directory"!==n.type||n.hidden&&!t.showhidden&&t.checkedAll)){if(!t.manager.isExists(n.path))return void(t.checkedAll=!1)}}t.checkedAll=!0},t.toggleCheckAll=function(){t.checkedAll=!t.checkedAll;for(var e=0;e<t.files.length;e++){var n=t.files[e];if(!("File"!==n.type&&"Directory"!==n.type||n.hidden&&!t.showhidden&&t.checkedAll)){var a=t.manager.isExists(n.path);t.checkedAll&&!a?t.manager.addPath(n.path):!t.checkedAll&&a&&t.manager.removePath(n.path)}}t.emitSelected()},t.uncheckAll=function(){for(var e in t.filesIndex)for(var n in t.filesIndex[e].files)null!=t.filesIndex[e].files[n]&&void 0!==t.filesIndex[e].files[n].checked&&t.filesIndex[e].files[n].checked&&(t.filesIndex[e].files[n].checked=!1)},t.directDownload=function(e){window.location=t.downloadURL("download_id="+e.download_id)},t.inQueues=function(e){for(var n=0;n<t.queues.length;n++)if(t.queues[n]==e)return n;return null},t.checkStatus=function(){p=n(function(){i.listQueueItems({data:{snap_item_id:t.typeId},success:function(e){for(var n=0;n<e.queue.length;n++){var a=e.queue[n],i=t.inQueues(a._id);null!==i?a.status>=100&&(t.queues.splice(i,1),!0):a.status<100&&t.queues.push(a._id)}},failed:function(e){_.error(e)}})},3e3)},t.getDestination=function(){i.getDestination({data:{_id:t.typeId},
success:function(e){t.typeDetails=e},failed:function(e){_.error(e),r.path("/destinations")}})},t.getBackup=function(){i.getBackupItem({data:{_id:t.typeId},success:function(e){t.typeDetails=e},failed:function(e){_.error(e)}})},t.$on("$destroy",function(){angular.isDefined(p)&&n.cancel(p)}),t.init=function(){switch(t.type){default:r.path("/");break;case"backup":l.canManageFileBackups||r.path("/"),t.getBackup();break;case"destination":l.canManageDestinations||r.path("/"),t.isDirectories=!0,t.getDestination()}t.fetch({path:"/"}),t.calculateCheckedAll()},a(t.init())}])}),define("controllers/fileManagerPopup",["app"],function(e){e.controller("fileManagerPopup",["$uibModalInstance","$rootScope","$scope","$routeParams","$interval","$timeout","api","meta","lang","pathManager","files","backup",function(e,t,n,a,i,s,o,c,r,l,u,d){a.type="backup",a.id=d._id,n.files=u,n.listPathes=[];for(var _ in u)n.listPathes.push(_);t.$on("filesChanged",function(e,t){n.files={};for(var a in t)void 0===n.files[a]&&(n.files[a]=void 0!==t[a].empty&&t[a].empty?"Unknown":t[a].type)}),n.ok=function(){e.close(n.files)},n.cancel=function(){e.dismiss(r.t("cancel"))}}])}),define("controllers/fileBrowse",["app"],function(e){e.controller("fileBrowse",["$uibModalInstance","$scope","$interval","$timeout","api","meta","lang","alert","util","pathManager","listPaths",function(e,t,n,a,i,s,o,c,r,l,u){t.manager=l.new(u),t.files=[],t.selectedTree={},t.loadingFiles=!1,t.breadcrumbs=[],t.filesIndex={},t.filesPageIndex={},t.currentFile={path:"/"},t.toggleFile=function(e){t.manager.isExists(e.path)?t.manager.removePath(e.path):t.manager.addPath(e.path)},t.noParentDirectory=function(){return t.breadcrumbs.length<=1},t.goParentDirectory=function(){t.noParentDirectory()||t.fetch(t.breadcrumbs[t.breadcrumbs.length-2],!1,!0)},t.isDisabled=function(e){return t.manager.isChildren(e.path)},t.isChecked=function(e){return t.manager.isExists(e.path)||t.manager.isChildren(e.path)},t.isChildrenChecked=function(e){return t.manager.isParent(e.path)};var d=function(e){var n=e.path;"/"===n.substr(-1)&&(n=n.substr(0,n.length-1)),"/"===n.substr(0,1)&&(n=n.substr(1));var a=n?n.split("/"):[];t.breadcrumbs=[{name:"",path:"/"}];for(var i="",s=0;s<a.length;s++)i+="/"+a[s],t.breadcrumbs.push({name:a[s],path:i})},_=function(e,n){t.filesIndex[n.path]=e,t.filesPageIndex[n.path]=f.getCurrentPage(),t.files=e.files;for(var a=0;a<t.files.length;a++)t.files[a].checked=t.manager.isExists(t.files[a].path);t.loadingFiles=!1},f=s.new("file_browse");t.meta=f,t.metaData=f.getData(),f.getSortBy()||f.setSortBy("type"),f.getSortDirection()||f.setSortDirection("asc"),f.setSortFields(["name","type","size","created"]),f.setPageSize(25),f.setPageSizes([5,10,25,50]),f.setTotalItems(t.files.length),t.fetch=function(e,n,a){if(void 0!==e&&void 0!==e.path||(e=t.currentFile),t.currentFile=e,t.loadingFiles=!0,t.files=[],d(e),n)f.setCurrentPage(1);else if(a){var s=void 0===t.filesPageIndex[e.path]?1:t.filesPageIndex[e.path];f.setCurrentPage(s)}var o={sort:{},skip:f.getSkip(),limit:f.getPageSize(),find:{},filter:""};o._id=t.typeId,o.type=t.type,o.path=e.path,o.sort[f.getSortBy()]=f.getSortDirectionInt(),i.fileBrowse({data:o,success:function(t){for(var n=0;n<t.files.length;n++)t.files[n].path=e.path+("/"===e.path?"":"/")+t.files[n].name;_(t,e),f.setTotalItems(t.total),f.calculate(t.files)},failed:function(e){c.error(e)}})},a(t.fetch({path:"/"})),t.ok=function(){e.close(t.manager.getSelected())},t.cancel=function(){e.dismiss(o.t("cancel"))}}])}),define("controllers/downloads",["app"],function(e){e.controller("downloads",["$rootScope","$scope","$location","$timeout","api","meta","alert",function(e,t,n,a,i,s,o){e.$emit("menuItem","Downloads"),t.loading=!1,t.downloads=[],s=s.new("downloads"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("created"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["created","size"]),s.setTotalItems(t.downloads.length),t.directDownload=function(e){window.location=window.PAGE.path.download+"&download_id="+e._id},t.saveNotes=function(e,t){t&&13!==t.which||(i.manageDownloadNotes({data:{_id:e._id,notes:e.notes},success:function(e,t){o.success(t)},failed:function(e){o.error(e)}}),e.editing=!1)},t.fetch=function(){if(!t.loading){t.loading=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),filter:s.getFilter()};e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.downloads=[],i.listDownloads({data:e,success:function(e){t.loading=!1,s.setTotalItems(e.total),s.calculate(e.downloads),t.downloads=e.downloads}})}},a(t.fetch())}])}),define("controllers/accountSelection",["app"],function(e){e.controller("accountSelection",["$uibModalInstance","$scope","$timeout","api","lang","account",function(e,t,n,a,i,s){t.loading=!1,t.accounts=[],t.selectedAccount={},t.selectAccount=function(e){t.selectedAccount=e},t.fetch=function(){t.loading=!0,a.listAccounts({data:{login_only:0,sort:{username:1},limit:9999999},success:function(e){for(var n=0;n<e.accounts.length;n++)s===e.accounts[n].username&&(t.selectedAccount=e.accounts[n]),t.accounts.push(e.accounts[n]);t.loading=!1}})},n(t.fetch()),t.ok=function(){e.close(t.selectedAccount)},t.cancel=function(){e.dismiss(i.t("cancel"))}}])}),define("controllers/restore",["app"],function(e){e.controller("restore",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","permissions","confirm","alert","consts","lang","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","Restore"),t.changed=!1,t.restoreSectionChanged=!1,t.hideTabs=!r.canManageAccounts&&!r.canManageDirectoryBackups,t.restoreSections=[{_id:"singleaccount",name:_.t("Single Account"),template:"restoreSingleAccount",icon:"fa-user",hidden:!1},{_id:"multiaccount",name:_.t("Multi Account"),template:"restoreMultiAccount",icon:"fa-users",hidden:!r.canManageAccounts},{_id:"directories",name:_.t("Directories"),template:"restoreDirectories",icon:"fa-folder",hidden:!r.canManageDirectoryBackups},{_id:"disasterrecovery",name:_.t("ISO Images"),template:"restoreDisasterRecovery",icon:"fa-compact-disc",hidden:!r.canManageDisasterRecoveryBackups}],t.getRestoreSection=function(e){for(var n=0;n<t.restoreSections.length;n++)if(t.restoreSections[n]._id===e)return t.restoreSections[n];return t.restoreSections[0]},t.changeRestoreSection=function(e){if(!t.changed)return void a.path("/restore/"+e._id);t.restoreSectionChanged=!0},t.loadRestoreSection=function(e){t.currentRestoreSection=e,t.restoreSection=t.includePath(e.template)},t.loadRestoreSection(t.getRestoreSection(n.section?n.section:"singleaccount"))}])}),define("controllers/restoreMultiAccount",["app"],function(e){e.controller("restoreMultiAccount",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","permissions","confirm","alert","consts","lang","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){t.today=new Date,t.loadingAccounts=!1,t.destinations=[{label:_.t("Any Destination"),value:""}],t.action="restore",t.accounts=[],t.account_details={},t.owner_details={},t.excluded=[],t.restore_conditions=[],t.conditions={},t.exclude_type=0,t.exclude_loading=!1,t.encryption_keys={},t.total_accounts=0,t.backup_contains=d.BACKUP_TYPE_ACCOUNT_FULL,t.options={},t.tags={},t.autocomplete={accountText:"",ownerText:"",tagText:""},t.filters={accounts:[],show_oldest:0,date_start:"",date_end:"",account_status:0,account_suspended:0,locked:0,encrypted:0,backup_structure:0,backup_contains:0,destination:"",owned_by:[],tags:[],use_damaged:0},t.$watch("action",function(){t.options={allbackups:0},"unlock"==t.action?t.filters.locked=1:"lock"==t.action?t.filters.locked=2:t.filters.locked=0}),t.account_types_disabled={},t.account_types_disabled[d.BACKUP_TYPE_ACCOUNT_CONFIG]=!0,t.account_types=[{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_CONFIG],value:d.BACKUP_TYPE_ACCOUNT_CONFIG},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_HOMEDIR],value:d.BACKUP_TYPE_ACCOUNT_HOMEDIR},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_DATABASES],value:d.BACKUP_TYPE_ACCOUNT_DATABASES},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_DATABASE_USERS],value:d.BACKUP_TYPE_ACCOUNT_DATABASE_USERS},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_EMAILS],value:d.BACKUP_TYPE_ACCOUNT_EMAILS},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_FTP],value:d.BACKUP_TYPE_ACCOUNT_FTP},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_CRON_JOBS],value:d.BACKUP_TYPE_ACCOUNT_CRON_JOBS},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_DOMAINS],value:d.BACKUP_TYPE_ACCOUNT_DOMAINS},{label:d.BACKUP_TYPE_ACCOUNT_NAMES[d.BACKUP_TYPE_ACCOUNT_CERTIFICATES],value:d.BACKUP_TYPE_ACCOUNT_CERTIFICATES}];var p=c.new("restore_and_download");t.meta=p,t.metaData=p.getData(),p.setSortReverse(!1),p.getSortBy()||p.setSortBy("username"),p.getSortDirection()||p.setSortDirection("asc"),p.setSortFields(["username","owner"]),p.setTotalItems(t.accounts.length),t.containsChecked=function(e,n){return void 0===n&&(n=t),e&n.backup_contains},t.toggleContains=function(e,n){void 0===n&&(n=t),t.containsChecked(e,n)?n.backup_contains^=e:n.backup_contains|=e},t.isExcluded=function(e){return t.excluded.indexOf(e.username)>=0},t.toggleExclude=function(e){if(t.isExcluded(e)){var n=t.excluded.indexOf(e.username);t.excluded.splice(n,1)}else t.excluded.push(e.username)},t.toggleExcludeAll=function(){t.exclude_loading||(t.exclude_loading=!0,0===t.exclude_type?(t.exclude_type=1,o.listAccountsByFilters({data:{filters:t.filters,limit:9999999},success:function(e){t.excluded=[];for(var n=0;n<e.accounts.length;n++){var a=e.accounts[n].account;t.excluded.push(a.username)}t.exclude_loading=!1}})):(t.exclude_loading=!1,t.exclude_type=0,t.excluded=[]))},t.gotItems=function(e){for(var n=0,a=0;a<e.length;a++)n|=e[a];return t.backup_contains&n},t.fetchNoResetExcludes=function(e){t.fetch(e,!0)},t.fetch=function(e,n){if(!t.loadingAccounts){void 0!==e&&"function"==typeof e||(e=function(){}),t.loadingAccounts=!0,t.exclude_type=0,void 0!==n&&n||(t.excluded=[]);var a={skip:p.getSkip(),limit:p.getPageSize(),filters:t.filters};window.PAGE.info.utcOffset&&(a.filters.date_start&&a.filters.date_start.utcOffset(window.PAGE.info.utcOffset,!0),a.filters.date_end&&a.filters.date_end.utcOffset(window.PAGE.info.utcOffset,!0)),t.accounts=[],o.listAccountsByFilters({data:a,success:function(n){p.setTotalItems(n.total),p.calculate(n.accounts),t.accounts=n.accounts,t.total_accounts=n.total,t.loadingAccounts=!1,e()}})}},t.tagsSelection=function(){f.open({template:"tagsSelection",scope:t,resolve:{tags:function(){return t.filters.tags},type:function(){return d.TAG_TYPE_ACCOUNT}}}).result.then(function(e){t.filters.tags=e},function(){})},t.ownersSelection=function(){f.open({template:"accountsSelection",scope:t,resolve:{accounts:function(){return t.filters.owned_by},includeOrphan:function(){return 0},callParams:function(){return""}}}).result.then(function(e){t.filters.owned_by=e},function(){})},t.accountsSelection=function(){f.open({template:"accountsSelection",scope:t,resolve:{accounts:function(){return t.filters.accounts},includeOrphan:function(){return 1},callParams:function(){return""}}}).result.then(function(e){t.filters.accounts=e},function(){})},t.searchTags=function(e){if(!e)return[];var n=s.defer();return o.listTags({data:{filter:e,sort:{name:1},find:{type:d.TAG_TYPE_ACCOUNT}},success:function(e){for(var a=[],i=0;i<e.tags.length;i++){var s=e.tags[i];t.filters.tags.indexOf(s._id)>=0||a.push(s)}n.resolve(a)}}),n.promise},t.searchOwners=function(e){if(e){var n=s.defer();return o.listAccounts({data:{filter:e,sort:{username:1}},success:function(e){for(var a=[],i=0;i<e.accounts.length;i++){var s=e.accounts[i];t.filters.owned_by.indexOf(s.username)>=0||a.push(s)}n.resolve(a)}}),n.promise}return[]},t.searchAccounts=function(e){if(e){var n=s.defer();return o.listAccounts({data:{include_orphan:1,filter:e,sort:{username:1}},success:function(e){for(var a=[],i=0;i<e.accounts.length;i++){var s=e.accounts[i];t.filters.accounts.indexOf(s.username)>=0||a.push(s)}n.resolve(a)}}),n.promise}return[]},t.selectTag=function(e){void 0!==e&&(t.filters.tags.push(e._id),t.autocomplete.tagText="")},t.selectOwner=function(e){void 0!==e&&(t.filters.owned_by.push(e.username),t.owner_details[e.username]=e,t.autocomplete.ownerText="")},t.selectAccount=function(e){void 0!==e&&(t.filters.accounts.push(e.username),t.account_details[e.username]=e,t.autocomplete.accountText="")},t.isContainsDisabled=function(e){return void 0!==t.account_types_disabled[e]&&t.account_types_disabled[e]},t.manageBackupLock=function(){var e=t.total_accounts-t.excluded.length;if(e<=0)return void u.error(_.t("Your filters didn't result with any account"));var n="lock"==t.action?1:0;l.open({message:_.t("Total of %s accounts backups will be "+(n?"locked":"unlocked"),e),confirm:function(){o.manageMultiBackupLock({data:{locked:n,filters:t.filters,options:t.options,excluded:t.excluded},success:function(e,n){u.success(n),t.fetch()},failed:function(e){u.error(e)}})}})},t.addToQueue=function(){var e=t.total_accounts-t.excluded.length;if(e<=0)return void u.error(_.t("Your filters didn't result with any account"));var n="",a="";switch(t.action){case"restore":a=d.QUEUE_ITEM_TYPE_RESTORE,n=_.t("Total of %s accounts will be restored",e);for(var i=0;i<t.restore_conditions.length;i++){var s=t.restore_conditions[i];if(void 0===t.conditions[s._id]||!t.conditions[s._id])return void u.error(_.t("Please accept all restore conditions"))}break;case"download":a=d.QUEUE_ITEM_TYPE_DOWNLOAD,n=_.t("Total of %s accounts backups will be downloaded",e)}l.open({message:n,confirm:function(){o.addMultiAccountQueueItems({data:{type:a,filters:t.filters,options:t.options,backup_contains:t.backup_contains,encryption_keys:t.encryption_keys,excluded:t.excluded},success:function(e,t){u.success(t)},failed:function(e){u.error(e)}})}})},t.setActionMessage=function(){var e="",n=t.total_accounts-t.excluded.length;switch(t.action){case"restore":e=_.t("Total of %s filtered accounts will be restored",n);break;case"download":e=_.t("Total of %s backups will be downloaded (one backup for each filtered account)",n);break;case"lock":e=t.options.allbackups?_.t("All backups related to %s filtered accounts will be locked",n):_.t("Total of %s backups will be locked (one backup for each filtered account)",n);break;case"unlock":e=t.options.allbackups?_.t("All backups related to %s filtered accounts will be unlocked",n):_.t("Total of %s backups will be unlocked (one backup for each filtered account)",n)}e&&(t.actionMessage={message:e,type:"warning"})},t.filteredMessage=function(){t.filteredAccountsStatus={message:_.t("Total of %s accounts will be affected using selected filters",t.total_accounts-t.excluded.length),type:"info"}},t.$watch("excluded",function(){t.filteredMessage(),t.setActionMessage()},!0),t.$watch("total_accounts",function(){t.filteredMessage(),t.setActionMessage()},!0),t.$watch("options",function(){t.filteredMessage(),t.setActionMessage()},!0),t.$watch("filters",function(){1!=t.filters.account_status?(t.containsChecked(d.BACKUP_TYPE_ACCOUNT_CONFIG,t.filters)||t.toggleContains(d.BACKUP_TYPE_ACCOUNT_CONFIG,t.filters),t.containsChecked(d.BACKUP_TYPE_ACCOUNT_CONFIG)||t.toggleContains(d.BACKUP_TYPE_ACCOUNT_CONFIG),t.account_types_disabled[d.BACKUP_TYPE_ACCOUNT_CONFIG]=!0):t.account_types_disabled[d.BACKUP_TYPE_ACCOUNT_CONFIG]=!1,t.fetch(function(){t.filteredMessage(),t.setActionMessage()})},!0),r.canManageDestinations&&o.listDestinations({success:function(e){for(var n=0;n<e.destinations.length;n++){var a=e.destinations[n];t.destinations.push({label:a.name,value:a._id})}}}),o.listTags({data:{find:{type:d.TAG_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.tags.length;n++)t.tags[e.tags[n]._id]=e.tags[n]}}),o.listRestoreConditions({data:{find:{disabled:!1}},success:function(e){t.restore_conditions=e.conditions}}),i(t.fetch())}])}),define("controllers/restoreSingleAccount",["app"],function(e){e.controller("restoreSingleAccount",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","permissions","confirm","alert","consts","lang","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){r.canManageAccounts||t.$emit("accountChanged",e.loggedAccount),t.autocomplete={accountText:""},t.selectAccount=function(e){void 0!==e&&t.$emit("accountChanged",e)},t.clearAccount=function(){t.autocomplete={accountText:""},t.$emit("accountChanged",{})},t.searchAccounts=function(e){if(e){var t=s.defer();return o.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]}}])}),define("controllers/restoreDirectories",["app"],function(e){e.controller("restoreDirectories",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","permissions","confirm","alert","consts","lang","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){t.isAllChecked=!1,t.backups=[],t.backups_selected=[],t.files={},t.filter="";var p=function(e){for(var n=-1,a=0;a<t.backups_selected.length;a++)if(e.backup._id===t.backups_selected[a].backup._id){n=a;break}if(e.checked){if(n>=0)return;t.backups_selected.push(e)}else{if(n<0)return;t.backups_selected.splice(n,1)}};t.fileBrowse=function(e){f.open({size:"xl",template:"fileManagerPopup",scope:t,resolve:{files:function(){return void 0!==t.files[e.backup._id]?t.files[e.backup._id]:{}},backup:function(){return e.backup}}}).result.then(function(n){t.files[e.backup._id]=n},function(){})},t.totalFiles=function(e){if(void 0===t.files[e.backup._id])return null;var n=0;for(var a in t.files[e.backup._id])n++;return n||(delete t.files[e.backup._id],null)},t.changeBackup=function(e){if(e.options=[],e.new_id===e.backup._id)return e.options_real={},void(e.new_id="");delete t.files[e.backup._id];var n=e.options_real[e.new_id];for(var a in n)e.backup[a]=n[a];e.options_real={},e.new_id=""},t.selectBackup=function(e){e.new_id=e.backup._id,e.options=[],e.options_real={};var t={type:e.backup.backup_type,contains:e.backup.backup_contains,name:e.backup.name,sort:{created:-1}};o.listBackupForTypeName({data:t,success:function(t){for(var n=0;n<t.backups.length;n++)e.options.push({_id:t.backups[n]._id,display:_.d(t.backups[n].created,"shorttime")}),e.options_real[t.backups[n]._id]=t.backups[n]}})},t.checkAll=function(){for(var e=0;e<t.backups.length;e++){var n=t.backups[e];n.checked=t.isAllChecked,p(n)}},t.unCheckAll=function(){t.isAllChecked=!1;for(var e=0;e<t.backups.length;e++){var n=t.backups[e];n.checked=!1,p(n)}t.files={}},t.checkChanged=function(e){void 0!==e&&p(e);for(var n=t.backups.length>0,a=0;a<t.backups.length;a++){var i=t.backups[a];i.checked||(t.isAllChecked=!1,delete t.files[i.backup._id],n=!1)}t.isAllChecked=n},t.saveNotes=function(e,t){e.backup.notes=e.backup.notes.substr(0,40),t&&13!==t.which||(o.manageBackupNotes({data:{_id:e.backup._id,notes:e.backup.notes},success:function(e,t){u.success(t)},failed:function(e){u.error(e)}}),e.editing=!1)},t.getChecked=function(){for(var e=[],n=0;n<t.backups_selected.length;n++)e.push(t.backups_selected[n].backup._id);return e},t.getCheckedParents=function(){for(var e=[],n=0;n<t.backups_selected.length;n++)e.push(t.backups_selected[n].backup.parent_id);return e},t.restore=function(){var e=t.getChecked();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));l.open({title:_.t("RESTORE NOTICE"),message:_.t("To guarantee the safety and integrity of your system, the Files and/or Directories selected will be restored with a temporary file/directory name at its original location.")+"<br />"+_.t("For example, when restoring %s folder, JetBackup will restore it at %s","<strong>/etc</strong>","<strong>/etc.jetbackup.xxxx</strong>")+"<br /><br /><strong>"+_.t("YOU ARE RESPONSIBLE")+"</strong> "+_.t("for completing the restoration process manually.")+"<br /><br />"+_.t("Please take necessary precautions before restoring core system files and/or directories to avoid any unintended issues with your server.")+"<br /><br />"+_.t("For more information, please visit")+" <a style='color: #fd6b2b;' href='https://docs.jetbackup.com/v5.2/adminpanel/restoreAndDownload.html#directories' target='_blank'>"+_.t("Directory Restore Documentation")+"</a>.",confirmLabel:_.t("Restore Selected Items"),confirm:function(){o.addQueueItems({data:{type:d.QUEUE_ITEM_TYPE_RESTORE,items:e,files:t.files},success:function(e,n){u.success(n),t.unCheckAll(),t.files={}},failed:function(e){u.error(e)}})}})},t.download=function(){var e=t.getChecked();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));o.addQueueItems({data:{type:d.QUEUE_ITEM_TYPE_DOWNLOAD,items:e,files:t.files},success:function(e,n){u.success(n),t.unCheckAll(),t.files={}},failed:function(e){u.error(e)}})},t.lock=function(){var e=t.getCheckedParents();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));f.open({size:"lg",template:"backupLockSelection",scope:t}).result.then(function(n){o.manageBackupLock({data:{_id:e,lock_ttl:n,locked:1},success:function(e,a){for(var i=[],s=0;s<t.backups.length;s++)t.backups[s].checked&&(i.includes(t.backups[s].backup.parent_id)||i.push(t.backups[s].backup.parent_id));if(n){var o=new Date;o.setDate(o.getDate()+n)}for(var s=0;s<t.backups.length;s++)i.includes(t.backups[s].backup.parent_id)&&(t.backups[s].backup.lock=!0,t.backups[s].backup.lock_ttl=n?moment(o):0);u.success(a)},failed:function(e){u.error(e)}})})},t.unlock=function(){var e=t.getCheckedParents();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));o.manageBackupLock({data:{_id:e,locked:0},success:function(e,n){for(var a=[],i=0;i<t.backups.length;i++)t.backups[i].checked&&(a.includes(t.backups[i].backup.parent_id)||a.push(t.backups[i].backup.parent_id));for(var i=0;i<t.backups.length;i++)a.includes(t.backups[i].backup.parent_id)&&(t.backups[i].backup.lock=!1,t.backups[i].backup.lock_ttl=0);u.success(n)},failed:function(e){u.error(e)}})};var g=function(e){for(var n=0;n<t.backups_selected.length;n++)if(e.backup._id===t.backups_selected[n].backup._id)return t.backups_selected[n];return e};t.fetch=function(){o.listBackupForDirectories({data:{filter:t.filter},success:function(e){for(var n=[],a=0;a<e.directories.length;a++){var i=e.directories[a];n.push(g(i))}t.backups=n,t.checkChanged()},fail:function(e){u.error(e)}})},t.fetch()}])}),define("controllers/restoreDisasterRecovery",["app"],function(e){e.controller("restoreDisasterRecovery",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","meta","permissions","confirm","alert","consts","lang","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){t.isAllChecked=!1,t.backups=[],t.backups_selected=[],t.files={},t.filter="",t.lock_options={ttl:0};var p=function(e){for(var n=-1,a=0;a<t.backups_selected.length;a++)if(e._id===t.backups_selected[a]._id){n=a;break}if(e.checked){if(n>=0)return;t.backups_selected.push(e)}else{if(n<0)return;t.backups_selected.splice(n,1)}};t.checkAll=function(){for(var e=0;e<t.backups.length;e++){var n=t.backups[e];n.checked=t.isAllChecked,p(n)}},t.unCheckAll=function(){t.isAllChecked=!1;for(var e=0;e<t.backups.length;e++){var n=t.backups[e];n.checked=!1,p(n)}t.files={}},t.checkChanged=function(e){void 0!==e&&p(e);for(var n=t.backups.length>0,a=0;a<t.backups.length;a++){var i=t.backups[a];i.checked||(t.isAllChecked=!1,delete t.files[i._id],n=!1)}t.isAllChecked=n},t.saveNotes=function(e,t){e.notes=e.notes.substr(0,40),t&&13!==t.which||(o.manageBackupNotes({data:{_id:e._id,notes:e.notes},success:function(e,t){u.success(t)},failed:function(e){u.error(e)}}),e.editing=!1)},t.getChecked=function(){for(var e=[],n=0;n<t.backups_selected.length;n++)e.push(t.backups_selected[n]._id);return e},t.getCheckedParents=function(){for(var e=[],n=0;n<t.backups_selected.length;n++)e.push(t.backups_selected[n].parent_id);return e},t.download=function(){var e=t.getChecked();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));o.addQueueItems({data:{type:d.QUEUE_ITEM_TYPE_DOWNLOAD,items:e,files:t.files},success:function(e,n){u.success(n),t.unCheckAll(),t.files={}},failed:function(e){u.error(e)}})},t.lock=function(){var e=t.getCheckedParents();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));o.manageBackupLock({data:{_id:e,lock_ttl:t.lock_options.ttl,locked:1},success:function(e,n){for(var a=0;a<t.backups.length;a++)t.backups[a].checked&&(t.backups[a].lock=1,t.backups[a].lock_ttl=t.lock_options.ttl);u.success(n)},failed:function(e){u.error(e)}})},t.unlock=function(){var e=t.getCheckedParents();if(e.length<=0)return void u.error(_.t("You must select at least one backup"));o.manageBackupLock({data:{_id:e,locked:0},success:function(e,n){for(var a=0;a<t.backups.length;a++)t.backups[a].checked&&(t.backups[a].lock=0,t.backups[a].lock_ttl=0);u.success(n)},failed:function(e){u.error(e)}})};var g=function(e){for(var n=0;n<t.backups_selected.length;n++)if(e._id===t.backups_selected[n]._id)return t.backups_selected[n];return e};t.fetch=function(){o.listBackupForDisasterRecovery({success:function(e){for(var n=[],a=0;a<e.images.length;a++){var i=e.images[a];n.push(g(i))}t.backups=n,t.checkChanged()},fail:function(e){u.error(e)}})},t.fetch()}])}),define("controllers/accountBackups",["app"],function(e){e.controller("accountBackups",["$uibModalInstance","$rootScope","$scope","$q","$location","$timeout","api","meta","util","permissions","consts","lang","alert","popup","account",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f,p){t.$emit("menuItem","Restore"),n.accountData=p,n.accountData||(n.accountData={}),n.reset=function(){n.loading=!1,n.list={},n.list_loaded={},n.backups=[],n.searchFilterValue="",n.static={isAllChecked:!1},n.advanced=!1,n.selected={full:"",full_items:[]},n.summary={enabled:!1,type:"",tpl:"",gotoqueue:!0},n.list_checked={},n.list_checked_parents={},n.fulls=[],n.fulls_list={},n.conditions={restore:{}},n.options={owner:"",exclude:[]},n.owner={},n.autocomplete={accountText:""},n.files={},n.lock_options={ttl:0},n.encryption={encrypted:!1,key:""},n.panelConfig={},n.require={owner:!0},n.localOptions={chown:!1}},n.reset(),n.restore_conditions=[],n.currentSection=void 0,n.sections=[{_id:u.BACKUP_TYPE_ACCOUNT_CONFIG,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_CONFIG],icon:"fa-cog",permissions:l.canManageConfigBackups},{_id:u.BACKUP_TYPE_ACCOUNT_HOMEDIR,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_HOMEDIR],icon:"fa-folder",permissions:l.canManageFileBackups},{_id:u.BACKUP_TYPE_ACCOUNT_CRON_JOBS,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_CRON_JOBS],icon:"fa-clock",permissions:l.canManageCronBackups},{_id:u.BACKUP_TYPE_ACCOUNT_DATABASES,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_DATABASES],icon:"fa-database",permissions:l.canManageDatabaseBackups},{_id:u.BACKUP_TYPE_ACCOUNT_DATABASE_USERS,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_DATABASE_USERS],icon:"fa-user-tie",permissions:l.canManageDatabaseBackups},{_id:u.BACKUP_TYPE_ACCOUNT_DOMAINS,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_DOMAINS],icon:"fa-map-marker-alt",permissions:l.canManageDNSZoneBackups},{_id:u.BACKUP_TYPE_ACCOUNT_CERTIFICATES,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_CERTIFICATES],icon:"fa-lock",permissions:l.canManageCertificateBackups},{_id:u.BACKUP_TYPE_ACCOUNT_EMAILS,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_EMAILS],icon:"fa-envelope",permissions:l.canManageEmailBackups},{_id:u.BACKUP_TYPE_ACCOUNT_FTP,name:u.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[u.BACKUP_TYPE_ACCOUNT_FTP],icon:"fa-file-alt",permissions:l.canManageFTPBackups}],n.$on("accountChanged",function(e,t){n.accountData=t,n.reset(),n.fetchFulls(function(){n.changeSection(n.sections[0])})}),n.$watch("summary.type",function(){n.summary.type?n.summary.tpl="accountBackups"+n.summary.type+"Summary":n.summary.tpl=""});var g=c.new("account_backups");n.meta=g,n.metaData=g.getData(),g.setSortReverse(!1),g.getSortBy()||g.setSortBy("username"),g.getSortDirection()||g.setSortDirection("asc"),g.setPageSizes([5,10,25,50]),g.setPageSize(5),g.setSortFields(["username","owner"]),g.setTotalItems(n.list.length);var E=function(e){void 0===n.list[e.backup_contains]&&(n.list[e.backup_contains]=[]);for(var t=0;t<n.list[e.backup_contains].length;t++)if(n.list[e.backup_contains][t].name===e.name&&(void 0===e.params.engine||n.list[e.backup_contains][t].params.engine==e.params.engine)){for(var a in e)n.list[e.backup_contains][t][a]=e[a];return}n.list[e.backup_contains].push(e)},T=function(e){if(n.selected.full_items.length)for(var t=0;t<n.selected.full_items.length;t++){var a=n.selected.full_items[t];void 0!==e&&a.backup_contains!==e||(a.checked=!0,E(a))}};n.checkAll=function(){for(var e=0;e<n.list[n.currentSection._id].length;e++){var t=n.list[n.currentSection._id][e];t.checked=n.static.isAllChecked,t.checked||void 0===n.files[t._id]||delete n.files[t._id]}},n.uncheckAll=function(){for(var e in n.list)for(var t=0;t<n.list[e].length;t++){var a=n.list[e][t];a.checked=!1,void 0!==n.files[a._id]&&delete n.files[a._id]}},n.isChecked=function(){for(var e in n.list)for(var t=0;t<n.list[e].length;t++)if(n.list[e][t].checked)return!0;return!1},n.getChecked=function(){var e=[];if(void 0===n.currentSection||void 0===n.list[n.currentSection._id])return e;for(var t=0;t<n.list[n.currentSection._id].length;t++)n.list[n.currentSection._id][t].checked&&e.push(n.list[n.currentSection._id][t]._id);return e},n.getCheckedAll=function(){var e=[];for(var t in n.list)for(var a=0;a<n.list[t].length;a++)n.list[t][a].checked&&e.push(n.list[t][a]);return e},n.searchAccounts=function(e){if(!e)return[];var t=a.defer();return o.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var a=[],i=0;i<e.accounts.length;i++){var s=e.accounts[i];(n.options.reseller&&s.root||!n.options.reseller&&s.reseller)&&a.push(s)}t.resolve(a)}}),t.promise},n.selectNewOwner=function(e){void 0!==e&&(n.options.owner=e.username,n.owner=e)},n.resetNewOwner=function(){n.options.owner="",n.autocomplete.accountText="",n.owner={}},n.changeBackup=function(e){if(e.options=[],e.new_id===e._id)return e.options_real={},void(e.new_id="");delete n.files[e._id];var t=e.options_real[e.new_id];for(var a in t)e[a]=t[a];n.selected.full="",n.selected.full_items=[],e.options_real={},e.new_id=""},n.selectBackup=function(e){e.new_id=e._id,e.options=[],e.options_real={};var t={account_id:e.account_id,type:e.backup_type,contains:e.backup_contains,name:e.name,sort:{created:-1},limit:9999999};void 0!==e.params.engine&&(t.engine=e.params.engine),o.listBackupForTypeName({data:t,success:function(t){for(var n=0;n<t.backups.length;n++)e.options.push({_id:t.backups[n]._id,display:d.d(t.backups[n].created,"shorttime")}),e.options_real[t.backups[n]._id]=t.backups[n]}})},n.checkChanged=function(){n.selected.full="",n.selected.full_items=[]},n.$watch("list",function(){var e=n.getChecked();n.static.isAllChecked=e.length===g.getTotalItems()},!0),n.askForEncryptionKey=function(){return n.encryption.encrypted&&1==n.accountData.backup_type&&1==n.accountData.encryption_key_type},n.lock=function(){var t=[];for(var a in n.list_checked_parents)t.push(a);o.manageBackupLock({data:{_id:t,lock_ttl:n.lock_options.ttl,locked:1},success:function(a,i){for(var s in n.list)for(var o=0;o<n.list[s].length;o++){var c=n.list[s][o];t.indexOf(c.parent_id)>=0&&(c.lock=1,c.lock_ttl=n.lock_options.ttl)}e.close(),_.success(i)},failed:function(e){_.error(e)}})},n.unlock=function(){var t=[];for(var a in n.list_checked_parents)t.push(a);o.manageBackupLock({data:{_id:t,locked:0},success:function(a,i){for(var s in n.list)for(var o=0;o<n.list[s].length;o++){var c=n.list[s][o];t.indexOf(c.parent_id)>=0&&(c.lock=0)}e.close(),_.success(i)},failed:function(e){_.error(e)}})},n.saveNotes=function(e,t){e.notes=e.notes.substr(0,40),t&&13!==t.which||(o.manageBackupNotes({data:{_id:e._id,notes:e.notes},success:function(e,t){_.success(t)},
failed:function(e){_.error(e)}}),e.editing=!1)},n.fileBrowse=function(e){f.open({size:"xl",template:"fileManagerPopup",scope:n,resolve:{files:function(){return void 0!==n.files[e._id]?n.files[e._id]:{}},backup:function(){return e}}}).result.then(function(t){n.files[e._id]=t},function(){})},n.totalFiles=function(e){if(void 0===n.files[e._id])return null;var t=0;for(var a in n.files[e._id])t++;return t||(delete n.files[e._id],null)},n.fetchReal=function(e){if(void 0===e&&(e=function(){}),!n.loading){if(void 0!==n.list_loaded[n.currentSection._id])return void e();n.list_loaded[n.currentSection._id]=!0,n.loading=!0,n.list[n.currentSection._id]=[],n.backups=[],n.searchFilterValue="";var t={type:u.BACKUP_TYPE_ACCOUNT,contains:n.currentSection._id,account_id:n.accountData._id,limit:9999999};o.listBackupForType({data:t,success:function(t){n.loading=!1;for(var a=0;a<t.backups.length;a++)t.backups[a].options=[],E(t.backups[a]);n.selected.full_items=t.backups,T(n.currentSection._id),e()},failed:function(){n.loading=!1,e()}})}},n.fetch=function(){n.backups=[],n.backupsFiltered=[];var e=[];if(n.searchFilterValue)for(var t=0;t<n.list[n.currentSection._id].length;t++)new RegExp(n.searchFilterValue).test(n.list[n.currentSection._id][t].name)&&e.push(n.list[n.currentSection._id][t]);else e=n.list[n.currentSection._id];g.setTotalItems(e.length);for(var a=0,t=0;t<e.length&&!(n.backups.length>=g.getPageSize());t++)a<g.getSkip()?a++:n.backups.push(e[t]);g.calculate(n.backups)},n.ok=function(){e.close()},n.changeSection=function(e){n.currentSection=e,n.fetchReal(function(){n.static.isAllChecked=n.getChecked().length===g.getTotalItems(),n.fetch()})},n.changeFullBackup=function(){""!==n.selected.full&&(n.uncheckAll(),o.getBackupItems({data:{_id:n.selected.full,limit:999999},success:function(e){e.backups.length&&(n.selected.full_items=e.backups,T())}}))},n.calculateSummary=function(){var e=!1;n.encryption.encrypted=!1,n.list_checked={},n.list_checked_parents={};for(var t in n.list)for(var a=0;a<n.list[t].length;a++)n.list[t][a].checked&&(!n.encryption.encrypted&&n.list[t][a].encrypted&&(n.encryption.encrypted=!0),void 0===n.list_checked[t]&&(n.list_checked[t]=[]),n.list_checked[t].push(n.list[t][a]),void 0===n.list_checked_parents[n.list[t][a].parent_id]&&(n.list_checked_parents[n.list[t][a].parent_id]=n.list[t][a].created),e=!0);n.summary.enabled=e},n.checkOwnerRequire=function(){if(!l.isRoot||!n.panelConfig.account_data.owner_id)return void(n.require.owner=!1);n.validateOwner(n.panelConfig.account_data.owner_id,function(e,t){!t.root&&n.options.reseller&&(e=!1),e&&(n.autocomplete.accountText=t.username,n.selectNewOwner(t)),n.require.owner=!e})},n.showSummary=function(e){"Restore"===e&&(n.getPanelConfig(),n.options.suspend=n.panelConfig.account_data.suspended,n.options.reseller=n.panelConfig.account_data.reseller,n.options.exclude=[],n.checkOwnerRequire()),n.checkOrphanConfig()&&(n.summary.type=e,n.calculateSummary())},n.gotItems=function(e){for(var t=n.getCheckedAll(),a=0;a<t.length;a++)if(e.indexOf(t[a].backup_contains)>=0)return!0;return!1},n.getPanelConfig=function(){for(var e=n.getCheckedAll(),t=0;t<e.length;t++)if(e[t].backup_contains===u.BACKUP_TYPE_ACCOUNT_CONFIG)return n.panelConfig=e[t],n.panelConfig;return n.panelConfig={account_data:{}},null},n.checkOrphanConfig=function(){return!n.accountData.orphan||(null!==n.getPanelConfig()||(_.error(d.t('You must select "Panel Configurations" item in order to restore orphan account')),!1))},n.validateOwner=function(e,t){void 0===t&&(t=function(){}),o.getAccount({data:{_id:e},success:function(e){t(e.reseller,e)},failed:function(){t(!1,{})}})},n.exclude={row:""},n.validateListPath=function(e){return!!e.trim()&&!u.PATH_FILTER_PATTERNS.test(e)},n.addExcludeRow=function(){void 0!==n.exclude.row&&n.exclude.row.trim()&&(n.validateListPath(n.exclude.row.trim())?n.options.exclude.push(n.exclude.row.trim()):_.error(d.t('The provided path ("%s") is invalid. The path must start with a "/".',n.exclude.row.trim())),n.exclude.row="")},n.addMultiExcludeRow=function(){n.listTitle=d.t("Directories and Files to exclude"),n.listData=n.options.exclude.join("\n"),n.listUIB=f.open({template:"listSelection",noController:!0,scope:n}),n.listUIB.result.then(function(e){for(;n.options.exclude.length;)n.options.exclude.pop();e=e.split("\n");for(var t=[],a=0;a<e.length;a++)n.validateListPath(e[a])?n.options.exclude.indexOf(e[a])<0&&n.options.exclude.push(e[a]):t.push(e[a]);t.length&&_.error(d.t('The following paths ("%s") is invalid. The path must start with a "/" and can\'t have trailing "/"'+("include"===type?", also patterns are not allowed.":"."),t.join(", ")))},function(){})},n.$watch("options.reseller",function(){n.getPanelConfig(),!n.owner.root&&n.options.reseller&&(n.require.owner=!0,n.resetNewOwner())}),n.restore=function(){if(null===n.getPanelConfig()&&(n.options.terminate=!1,n.options.reseller=!1,n.options.suspend=!1,n.options.owner=""),n.checkOrphanConfig()){var t=!(n.options.terminate||n.accountData.orphan);if(!t&&n.require.owner&&!n.options.owner)return void _.error(d.t("You must select new owner"));for(var a=0;a<n.restore_conditions.length;a++){var s=n.restore_conditions[a];if(void 0===n.conditions.restore[s._id]||!n.conditions.restore[s._id])return void _.error(d.t("Please accept all restore conditions"))}if(n.askForEncryptionKey()&&!n.encryption.key)return void _.error(d.t('You must provide "Backups Private Encryption Key"'));for(var c=n.getCheckedAll(),f=[],a=0;a<c.length;a++)f.push(c[a]._id);var p=r.duplicateObject(n.options);t?(delete p.reseller,delete p.owner):p.terminate&&delete p.merge,l.isRoot||(delete p.reseller,delete p.owner),l.isReseller||delete p.suspend,o.addQueueItems({data:{type:u.QUEUE_ITEM_TYPE_RESTORE,items:f,files:n.files,options:p,encryption_key:n.encryption.key},success:function(t,a){n.encryption.key="",_.success(a),e.close(),n.summary.gotoqueue&&i.path("/queue")},failed:function(e){_.error(e)}})}},n.download=function(){if(n.askForEncryptionKey()&&!n.encryption.key)return void _.error(d.t('You must provide "Backups Private Encryption Key"'));for(var t=r.duplicateObject(n.options),a=n.getCheckedAll(),s=[],c=0;c<a.length;c++)s.push(a[c]._id);o.addQueueItems({data:{type:u.QUEUE_ITEM_TYPE_DOWNLOAD,items:s,files:n.files,options:t,encryption_key:n.encryption.key},success:function(t,a){n.encryption.key="",_.success(a),e.close(),n.summary.gotoqueue&&i.path("/queue")},failed:function(e){_.error(e)}})},n.removeItems=function(e){n.selected.full="",n.selected.full_items=[];for(var t=0;t<n.list[e].length;t++){var a=n.list[e][t];a.checked=!1,void 0!==n.files[a._id]&&delete n.files[a._id]}n.calculateSummary()},n.removeSnapshot=function(e){n.selected.full="",n.selected.full_items=[];for(var t in n.list)for(var a=0;a<n.list[t].length;a++){var i=n.list[t][a];i.parent_id===e&&(i.checked=!1,void 0!==n.files[i._id]&&delete n.files[i._id])}n.calculateSummary()},n.$watch("require",function(){var e=n.require.owner;n.localOptions.chown=e,n.chownDisabled=e},!0),o.listRestoreConditions({data:{find:{disabled:!1}},success:function(e){n.restore_conditions=e.conditions}}),n.fetchFulls=function(e){void 0!==e&&"function"==typeof e||(e=function(){}),o.listBackupForTypeName({data:{name:n.accountData.username,type:u.BACKUP_TYPE_ACCOUNT,contains:u.BACKUP_TYPE_ACCOUNT_FULL,account_id:n.accountData._id,sort:{created:-1},limit:9999999},success:function(t){for(var a=0;a<t.backups.length;a++){0===a&&(n.selected.full=t.backups[a].parent_id);for(var i=[],s=0;s<t.backups[a].schedules.length;s++)i.push(u.SCHEDULE_TYPES[t.backups[a].schedules[s]]);t.backups[a].schedules_names=i.join(","),n.fulls.push({_id:t.backups[a].parent_id,display:d.d(t.backups[a].created,"shorttime")}),n.fulls_list[t.backups[a].parent_id]=t.backups[a]}n.fulls.push({_id:"",display:d.t("Custom")}),n.changeFullBackup(),e()}})},n.fetchFulls(),n.changeSection(n.sections[0])}])}),define("controllers/accountDownloads",["app"],function(e){e.controller("accountDownloads",["$uibModalInstance","$rootScope","$scope","$location","$timeout","api","meta","util","consts","lang","account","alert",function(e,t,n,a,i,s,o,c,r,l,u,d){n.loading=!1,n.account=u,n.downloads=[],o=o.new("account_downloads"),n.meta=o,n.metaData=o.getData(),o.setSortReverse(!1),o.getSortBy()||o.setSortBy("created"),o.getSortDirection()||o.setSortDirection("desc"),o.setPageSizes([5]),o.setPageSize(5),o.setSortFields(["created","size"]),o.setTotalItems(n.downloads.length),n.close=function(){e.close()},n.directDownload=function(e){window.location=window.PAGE.path.download+"&download_id="+e._id},n.saveNotes=function(e,t){e.notes=e.notes.substr(0,40),t&&13!==t.which||(s.manageDownloadNotes({data:{_id:e._id,notes:e.notes},success:function(e,t){d.success(t)},failed:function(e){d.error(e)}}),e.editing=!1)},n.fetch=function(){if(!n.loading){n.loading=!0;var e={sort:{},skip:o.getSkip(),limit:o.getPageSize(),find:{},filter:o.getFilter(),account_id:n.account._id};e.sort[o.getSortBy()]=o.getSortDirectionInt(),n.downloads=[],s.listDownloads({data:e,success:function(e){n.loading=!1,o.setTotalItems(e.total),o.calculate(e.downloads),n.downloads=e.downloads}})}},i(n.fetch())}])}),define("controllers/accountFilters",["app"],function(e){e.controller("accountFilters",["$rootScope","$scope","$location","$timeout","api","meta","confirm","consts","lang","alert",function(e,t,n,a,i,s,o,c,r,l){e.$emit("menuItem","AccountFilters"),t.filters=[],t.groups={},t.loadingFilters=!1,t.saveing=!1,t.filter=0,t.filterOptions=[{label:r.t("All Filter Types"),value:0},{label:r.t("Accounts Filter"),value:c.ACCOUNT_FILTER_TYPE_ACCOUNT},{label:r.t("Account Tags Filter"),value:c.ACCOUNT_FILTER_TYPE_ACCOUNT_TAG},{label:r.t("Owned By Filter"),value:c.ACCOUNT_FILTER_TYPE_OWNEDBY},{label:r.t("Resellers Filter"),value:c.ACCOUNT_FILTER_TYPE_RESELLER},{label:r.t("Suspension Filter"),value:c.ACCOUNT_FILTER_TYPE_SUSPENSION},{label:r.t("Encryption Filter"),value:c.ACCOUNT_FILTER_TYPE_ENCRYPTION},{label:r.t("Disk Space Usage Filter"),value:c.ACCOUNT_FILTER_TYPE_DISK_USAGE},{label:r.t("Inodes Usage Filter"),value:c.ACCOUNT_FILTER_TYPE_INODE_USAGE},{label:r.t("Packages Filter"),value:c.ACCOUNT_FILTER_TYPE_PACKAGE},{label:r.t("Characters Range Filter"),value:c.ACCOUNT_FILTER_TYPE_RANGE},{label:r.t("Regular Expression Filter"),value:c.ACCOUNT_FILTER_TYPE_REGEX}],t.types={};for(var u=0;u<t.filterOptions.length;u++)t.filterOptions[u].value>0&&(t.types[t.filterOptions[u].value]=t.filterOptions[u].label);t.loaders={delete:!1},s=s.new("filters"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("name"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["name","type","owner"]),s.setTotalItems(t.filters.length),t.onClickDelete=function(e){if(!t.saveing){if(e.groups_count>0)return l.error(r.t("This filter has an assigned filter groups, Please remove those groups before deleting this filter.")),!1;t.saveing=!0,t.loaders.delete=!0,o.open({message:r.t("This filter will be permanently deleted!"),confirm:function(){i.deleteAccountFilter({data:{_id:e._id},success:function(e,n){t.saveing=!1,t.loaders.delete=!1,t.fetch(),l.success(n)},failed:function(e){t.saveing=!1,t.loaders.delete=!1,l.error(e)}})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}})}},t.listGroups=function(e){i.listAccountFilterGroups({success:function(n){for(var a=0;a<n.groups.length;a++)void 0===t.groups[n.groups[a]._id]&&(t.groups[n.groups[a]._id]=[]),t.groups[n.groups[a]._id].push(n.groups[a]);void 0!==e&&e()},failed:function(){void 0!==e&&e()}})},t.fetch=function(){t.loadingFilters=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.filter&&(e.find.type=t.filter),t.filters=[],i.listAccountFilters({data:e,success:function(e){s.setTotalItems(e.total),s.calculate(e.filters),t.filters=e.filters;for(var n=0;n<t.filters.length;n++)t.groups[t.filters[n]._id]=[];t.listGroups(function(){t.loadingFilters=!1})}})},a(t.fetch)}])}),define("controllers/accountFilterManage",["app"],function(e){e.controller("accountFilterManage",["$rootScope","$scope","$routeParams","$location","$timeout","$q","api","lang","util","confirm","consts","alert","permissions","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f){e.$emit("menuItem","AccountFilters"),t.details={name:"",owner:t.loggedAccount._id,owner_name:t.loggedAccount.username},t.saveData=r.duplicateObject(t.details),t.autocomplete={accountText:t.saveData.owner_name},t.saveing=!1,t.changed=!1,t.cancelled=!1,t.range="0123456789_abcdefghijklmnopqrstuvwxyz",t.tags={},t.item={package:""},t.accounts={},t.conditions=[{label:c.t("Include"),value:u.ACCOUNT_FILTER_CONDITION_INCLUDE},{label:c.t("Exclude"),value:u.ACCOUNT_FILTER_CONDITION_EXCLUDE}],t.types=[{label:c.t("Accounts Filter"),value:u.ACCOUNT_FILTER_TYPE_ACCOUNT,template:"account"},{label:c.t("Owned By Filter"),value:u.ACCOUNT_FILTER_TYPE_OWNEDBY,template:"reseller"},{label:c.t("Resellers Filter"),value:u.ACCOUNT_FILTER_TYPE_RESELLER,template:"reseller"},{label:c.t("Suspension Filter"),value:u.ACCOUNT_FILTER_TYPE_SUSPENSION,template:"suspension"},{label:c.t("Encryption Filter"),value:u.ACCOUNT_FILTER_TYPE_ENCRYPTION,template:"encryption"},{label:c.t("Disk Space Usage Filter"),value:u.ACCOUNT_FILTER_TYPE_DISK_USAGE,template:"diskusage"},{label:c.t("Inodes Usage Filter"),value:u.ACCOUNT_FILTER_TYPE_INODE_USAGE,template:"inodeusage"},{label:c.t("Packages Filter"),value:u.ACCOUNT_FILTER_TYPE_PACKAGE,template:"package"},{label:c.t("Characters Range Filter"),value:u.ACCOUNT_FILTER_TYPE_RANGE,template:"range"},{label:c.t("Regular Expression Filter"),value:u.ACCOUNT_FILTER_TYPE_REGEX,template:"regex"}],_.isRoot&&t.types.push({label:c.t("Account Tags Filter"),value:u.ACCOUNT_FILTER_TYPE_ACCOUNT_TAG,template:"accounttags"}),t.selectCreator=function(e){if(void 0!==e){t.saveData.owner=e._id,t.saveData.owner_name=e.username,t.autocomplete.accountText=e.username;var n=document.activeElement;n&&n.blur()}},t.searchCreators=function(e){if(e){var t=s.defer();return o.listAccounts({data:{login_only:1,filter:e,sort:{username:1}},success:function(e){for(var n=[],a=0;a<e.accounts.length;a++)n.push(e.accounts[a]);t.resolve(n)}}),t.promise}return[]},t.loadFilterType=function(e,n){if(t.saveData=r.duplicateObject(t.details),t.autocomplete.accountText=t.saveData.owner_name,n)switch(t.saveData.condition=u.ACCOUNT_FILTER_CONDITION_INCLUDE,t.saveData.type=e,e){case u.ACCOUNT_FILTER_TYPE_ACCOUNT:case u.ACCOUNT_FILTER_TYPE_ACCOUNT_TAG:case u.ACCOUNT_FILTER_TYPE_RESELLER:case u.ACCOUNT_FILTER_TYPE_OWNEDBY:case u.ACCOUNT_FILTER_TYPE_PACKAGE:t.saveData.list=[];break;case u.ACCOUNT_FILTER_TYPE_INODE_USAGE:case u.ACCOUNT_FILTER_TYPE_DISK_USAGE:t.saveData.usage=0;break;case u.ACCOUNT_FILTER_TYPE_RANGE:t.saveData.range_start="0",t.saveData.range_end="z";break;case u.ACCOUNT_FILTER_TYPE_REGEX:t.saveData.regex=""}t.saveData.type==u.ACCOUNT_FILTER_TYPE_DISK_USAGE||t.saveData.type==u.ACCOUNT_FILTER_TYPE_INODE_USAGE?(t.conditions[0].label=c.t("Include Below (or equals)"),t.conditions[1].label=c.t("Include Above (or equals)")):(t.conditions[0].label=c.t("Include"),t.conditions[1].label=c.t("Exclude"));for(var a=0;a<t.types.length;a++)if(t.types[a].value===e)return void(t.filterType=t.includePath("accountFilters/"+t.types[a].template))},t.itemsSelection=function(){var e={};e[u.ACCOUNT_FILTER_TYPE_ACCOUNT]={size:"lg",template:"accountsSelection",resolve:{accounts:function(){return t.saveData.list},includeOrphan:function(){return 0},callParams:function(){return""}}},e[u.ACCOUNT_FILTER_TYPE_RESELLER]={size:"lg",template:"accountsSelection",controller:"resellersSelection",resolve:{accounts:function(){return t.saveData.list},includeOrphan:function(){return 0}}},e[u.ACCOUNT_FILTER_TYPE_OWNEDBY]={size:"lg",template:"accountsSelection",controller:"resellersSelection",resolve:{accounts:function(){return t.saveData.list},includeOrphan:function(){return 0}}},e[u.ACCOUNT_FILTER_TYPE_PACKAGE]={size:"lg",template:"accountPackagesSelection",resolve:{packages:function(){return t.saveData.list},account:function(){return null}}},e[u.ACCOUNT_FILTER_TYPE_ACCOUNT_TAG]={size:"lg",template:"tagsSelection",resolve:{tags:function(){return t.saveData.list},type:function(){return u.TAG_TYPE_ACCOUNT}}},f.open(e[t.saveData.type]).result.then(function(e){t.saveData.list=e},function(){})},t.searchTags=function(e){if(!e)return[];var n=s.defer();return o.listTags({data:{filter:e,sort:{name:1},find:{type:u.TAG_TYPE_ACCOUNT}},success:function(e){for(var a=[],i=0;i<e.tags.length;i++){var s=e.tags[i];t.saveData.list.indexOf(s._id)>=0||a.push(s)}n.resolve(a)},failed:function(e){}}),n.promise},t.searchAccountPackages=function(e){if(!e)return[];var n=s.defer();return o.listAccountPackages({data:{all:1,filter:e,sort:{name:1}},success:function(e){for(var a=[],i=0;i<e.packages.length;i++){var s=e.packages[i];t.saveData.list.indexOf(s.name)>=0||a.push(s)}n.resolve(a)}}),n.promise},t.searchAccounts=function(e){if(!e)return[];var n=t.saveData.type===u.ACCOUNT_FILTER_TYPE_RESELLER||t.saveData.type===u.ACCOUNT_FILTER_TYPE_OWNEDBY,a=s.defer();return o.listAccounts({data:{filter:e,sort:{username:1}},success:function(e){for(var i=[],s=0;s<e.accounts.length;s++){var o=e.accounts[s];!n&&t.saveData.list.indexOf(o.username)>=0||n&&(!o.reseller||t.saveData.list.indexOf(o.username)>=0)||i.push(o)}a.resolve(i)}}),a.promise},t.addPackage=function(){var e=t.item.package.trim();if(e){if(t.saveData.list.indexOf(e)>=0)return void(t.item.package="");t.saveData.list.push(e),t.item.package=""}},t.addMultiplePackages=function(){t.listData=t.saveData.list.join("\n"),t.listUIB=f.open({template:"listSelection",scope:t,noController:!0}),t.listUIB.result.then(function(e){for(;t.saveData.list.length;)t.saveData.list.pop();e=e.split("\n");for(var n=0;n<e.length;n++)t.saveData.list.indexOf(e[n])>=0||t.saveData.list.push(e[n])},function(){})},t.selectItem=function(e){void 0!==e&&(t.saveData.list.push(e),t.autocomplete.filterText="")},t.rangeStartValueCheck=function(e){return e<=t.saveData.range_end},t.rangeEndValueCheck=function(e){return e>=t.saveData.range_start},t.fetchFilterData=function(e){o.getAccountFilter({data:{_id:e},success:function(e){t.details=e,t.details.type==u.ACCOUNT_FILTER_TYPE_DISK_USAGE&&t.details.usage>0&&(t.details.usage=t.details.usage/1024/1024),t.loadFilterType(t.details.type)}})},t.$watch("saveData",function(){t.changed=r.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("createFilter",function(){t.saveChanges(!0,function(e){t.$emit("filterResponse",e)})}),t.$on("$destroy",function(){!t.changed||t.cancelled||t.popup||t.wizardData||l.open({message:c.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:c.t("Disregard Changes"),confirmLabel:c.t("Save")})}),t.cancel=function(){t.cancelled=!0,a.path("/accountFilters")},t.saveChanges=function(e,n){if(!t.saveing){t.saveing=!0;var i=r.saveParams(t.saveData,t.details,[],function(e){return void 0===t.details._id&&"type"===e});i.action=t.details._id?"modify":"create",void 0!==i.usage&&t.saveData.type==u.ACCOUNT_FILTER_TYPE_DISK_USAGE&&i.usage>0&&(i.usage=1024*i.usage*1024),o.manageAccountFilter({data:i,success:function(i,s){if(t.saveing=!1,void 0!==n&&"function"==typeof n)return void n({success:!0,data:i,message:s});t.changed=!1,t.saveData._id=i._id,t.details=r.duplicateObject(t.saveData),e?a.path("/accountFilterManage/"+i._id):a.path("/accountFilters"),d.success(s)},failed:function(e){if(t.saveing=!1,void 0!==n&&"function"==typeof n)return void n({success:!1,data:{},message:e});d.error(e)}})}},t.loadAccounts=function(){o.listAccounts({success:function(e){for(var n=0;n<e.accounts.length;n++)t.accounts[e.accounts[n].username]=e.accounts[n]}})},t.loadData=function(){var e=n.id;e?i(t.fetchFilterData(e)):t.loadFilterType(u.ACCOUNT_FILTER_TYPE_ACCOUNT,!0),t.loadAccounts()},_.isRoot?o.listTags({data:{find:{type:u.TAG_TYPE_ACCOUNT}},success:function(e){for(var n=0;n<e.tags.length;n++)t.tags[e.tags[n]._id]=e.tags[n];t.loadData()}}):t.loadData()}])}),define("controllers/accountFilterManagePopup",["app"],function(e){e.controller("accountFilterManagePopup",["$uibModalInstance","$routeParams","$rootScope","$scope","api","consts","lang","alert",function(e,t,n,a,i,s,o,c){a.popup=!0,t.id=null,a.details={name:""},a.saveData={name:"",type:s.ACCOUNT_FILTER_TYPE_ACCOUNT,list:[],condition:s.ACCOUNT_FILTER_CONDITION_INCLUDE},a.$on("filterResponse",function(t,n){if(!n.success)return void c.error(n.message);i.getAccountFilterGroup({data:{_id:n.data.group_id},success:function(t){c.success(n.message),e.close(t)},failed:function(e){c.error(e)}})}),a.ok=function(){n.$broadcast("createFilter")},a.cancel=function(){e.dismiss()}}])}),define("controllers/accountFilterGroupManage",["app"],function(e){e.controller("accountFilterGroupManage",["$rootScope","$scope","$routeParams","$location","$timeout","api","consts","lang","meta","utils","alert","confirm",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","AccountFilters"),t.details={name:"",filters:[]},t.saveData=l.duplicateObject(t.details),t.filters={},t.saveing=!1,t.changed=!1,t.types={},t.types[o.ACCOUNT_FILTER_TYPE_ACCOUNT]=c.t("Accounts Filter"),t.types[o.ACCOUNT_FILTER_TYPE_OWNEDBY]=c.t("Owned By Filter"),t.types[o.ACCOUNT_FILTER_TYPE_RESELLER]=c.t("Resellers Filter"),t.types[o.ACCOUNT_FILTER_TYPE_SUSPENSION]=c.t("Suspension Filter"),t.types[o.ACCOUNT_FILTER_TYPE_ENCRYPTION]=c.t("Encryption Filter"),t.types[o.ACCOUNT_FILTER_TYPE_DISK_USAGE]=c.t("Disk Space Usage Filter"),t.types[o.ACCOUNT_FILTER_TYPE_INODE_USAGE]=c.t("Inodes Usage Filter"),t.types[o.ACCOUNT_FILTER_TYPE_PACKAGE]=c.t("Packages Filter"),t.types[o.ACCOUNT_FILTER_TYPE_RANGE]=c.t("Characters Range Filter"),t.types[o.ACCOUNT_FILTER_TYPE_REGEX]=c.t("Regular Expression Filter"),t.toggleFilter=function(e){var n=t.saveData.filters.indexOf(e._id);n>-1?t.saveData.filters.splice(n,1):t.saveData.filters.push(e._id)},t.fetchGroupData=function(e){s.getAccountFilterGroup({data:{_id:e},success:function(e){t.details=e,t.saveData=l.duplicateObject(t.details)}})},t.$watch("saveData",function(){t.changed=l.isChanged(t.saveData,t.details,["_id"])},!0),t.$on("createFilter",function(e){t.saveChanges(!0,function(e){t.$emit("filterResponse",e)})}),t.$on("$destroy",function(){t.changed&&!t.cancelled&&d.open({message:c.t("You didn't saved your changes"),confirm:t.saveChanges,cancelLabel:c.t("Disregard Changes"),confirmLabel:c.t("Save")})}),t.cancel=function(){t.cancelled=!0,a.path("/accountFilterGroups")},t.saveChanges=function(e,n){if(!t.saveing){t.saveing=!0;var i=l.saveParams(t.saveData,t.details);i.action=t.details._id?"modify":"create",s.manageAccountFilterGroup({data:i,success:function(i,s){if(t.saveing=!1,void 0!==n)return void n({success:!0,data:i,message:s});t.changed=!1,t.saveData._id=i._id,t.details=l.duplicateObject(t.saveData),e?a.path("/accountFilterGroupManage/"+i._id):a.path("/accountFilterGroups"),u.success(s)},failed:function(e){if(t.saveing=!1,void 0!==n)return void n({success:!1,data:{},message:e});u.error(e)}})}},t.fetchFilters=function(e){t.filters={},s.listAccountFilters({success:function(n){for(var a=0;a<n.filters.length;a++)t.filters[n.filters[a]._id]=n.filters[a];void 0!==e&&e()}})},i(t.fetchFilters(function(){var e=n.id;e&&i(t.fetchGroupData(e))}))}])}),define("controllers/accountFilterGroupManagePopup",["app"],function(e){e.controller("accountFilterGroupManagePopup",["$uibModalInstance","$rootScope","$scope","api","lang","alert",function(e,t,n,a,i,s){n.saveData={name:"",filters:[]},n.$on("filterResponse",function(t,n){if(!n.success)return void s.error(n.message);a.getAccountFilterGroup({data:{_id:n.data._id},success:function(t){s.success(n.message),e.close(t)},failed:function(e){s.error(e)}})}),n.ok=function(){t.$broadcast("createFilter")},n.cancel=function(){e.dismiss()}}])}),define("controllers/accountFilterGroups",["app"],function(e){e.controller("accountFilterGroups",["$rootScope","$scope","$location","$timeout","api","meta","confirm","lang",function(e,t,n,a,i,s,o,c){e.$emit("menuItem","AccountFilters"),t.groups=[],t.filters={},t.loadingGroups=!1,t.saveing=!1,t.loaders={delete:!1},s=s.new("filter_groups"),t.meta=s,t.metaData=s.getData(),s.getSortBy()||s.setSortBy("name"),s.getSortDirection()||s.setSortDirection("desc"),s.setSortFields(["name","type","owner","count"]),s.setTotalItems(t.groups.length),t.onClickDelete=function(e){if(!t.saveing){if(e.count>0)return alert.error(c.t("This account filter group has an assigned jobs, Please remove those jobs before deleting this account filter group.")),!1;t.saveing=!0,t.loaders.delete=!0,o.open({message:c.t("This group will be permanently deleted!"),confirm:function(){i.deleteAccountFilterGroup({_id:e._id},function(e){if(t.saveing=!1,t.loaders.delete=!1,e.success)return t.fetchData(),void alert.success(e.message);alert.error(e.message)})},cancel:function(){t.saveing=!1,t.loaders.delete=!1}})}},t.fetchFilters=function(e){t.filters={},i.listAccountFilters({success:function(n){for(var a=0;a<n.filters.length;a++)t.filters[n.filters[a]._id]=n.filters[a];void 0!==e&&e()}})},t.fetch=function(){t.loadingGroups=!0;var e={sort:{},skip:s.getSkip(),limit:s.getPageSize(),find:{},filter:s.getFilter()};e.sort[s.getSortBy()]=s.getSortDirectionInt(),t.groups=[],i.listAccountFilterGroups({data:e,success:function(e){s.setTotalItems(e.total),s.calculate(e.groups),t.groups=e.groups,t.loadingGroups=!1}})},a(t.fetchFilters(function(){t.fetch()}))}])}),define("controllers/accountFilterGroupSelection",["app"],function(e){e.controller("accountFilterGroupSelection",["$uibModalInstance","$scope","filters","details","alert","lang","popup",function(e,t,n,a,i,s,o){t.filters=[],t.allFilters=n,t.newFilter=function(){o.open({size:"lg",template:"accountFilterManagePopup",scope:t}).result.then(function(e){if(!e._id)return void i.error(s.t("Failed to create filter"));t.allFilters[e._id]=e,t.selectedFilter=e._id,t.ok()},function(){})},t.setFilters=function(){for(var e in t.allFilters)t.filters.push(t.allFilters[e])},t.setFilters(),t.selectedFilter=t.filters.length?t.filters[0]._id:"",t.ok=function(){e.close(t.selectedFilter)},t.cancel=function(){e.dismiss(s.t("cancel"))}}])}),define("controllers/accountsSelection",["app"],function(e){e.controller("accountsSelection",["$uibModalInstance","$scope","$timeout","api","meta","accounts","includeOrphan","callParams","lang",function(e,t,n,a,i,s,o,c,r){t.loading=!1,t.accounts=[],t.fetchAccounts=function(){t.loading=!0,a.listAccounts({data:{include_orphan:o,sort:{username:1},limit:9999999},success:function(e){for(var n=0;n<e.accounts.length;n++)e.accounts[n].checked=!(void 0===s||!s.length)&&s.indexOf(e.accounts[n].username)>=0;t.accounts=e.accounts,t.loading=!1}})},n(t.fetchAccounts),t.ok=function(){for(var n=[],a=0;a<t.accounts.length;a++)t.accounts[a].checked&&n.push(t.accounts[a].username);e.close(n)},t.cancel=function(){e.dismiss(r.t("cancel"))}}])}),define("controllers/accountPackagesSelection",["app"],function(e){e.controller("accountPackagesSelection",["$uibModalInstance","$scope","$timeout","api","meta","packages","account","lang",function(e,t,n,a,i,s,o,c){t.loading=!1,t.packages=[],t.fetchAccountPackages=function(){if(!t.loading){t.loading=!0,t.packages=[];var e={all:1,sort:{name:1}};o&&(e._id=o._id);var n=[];a.listAccountPackages({data:e,success:function(e){for(var a=0;a<e.packages.length;a++)e.packages[a].checked=!(void 0===s||!s.length)&&s.indexOf(e.packages[a].name)>=0,n.indexOf(e.packages[a].name)<0&&(t.packages.push(e.packages[a]),n.push(e.packages[a].name));t.loading=!1}})}},n(t.fetchAccountPackages),t.ok=function(){for(var n=[],a=0;a<t.packages.length;a++)t.packages[a].checked&&n.push(t.packages[a].name);e.close(n)},t.cancel=function(){e.dismiss(c.t("cancel"))}}])}),define("controllers/resellersSelection",["app"],function(e){e.controller("resellersSelection",["$uibModalInstance","$scope","$timeout","api","meta","lang","accounts",function(e,t,n,a,i,s,o){t.loading=!1,t.accounts=[],t.fetchAccounts=function(){t.loading=!0,a.listAccounts({data:{limit:9999999,find:{reseller:!0}},success:function(e){for(var n=0;n<e.accounts.length;n++)e.accounts[n].checked=!(void 0===o||!o.length)&&o.indexOf(e.accounts[n].username)>=0,t.accounts.push(e.accounts[n]);t.loading=!1}})},n(t.fetchAccounts),t.ok=function(){for(var n=[],a=0;a<t.accounts.length;a++)t.accounts[a].checked&&n.push(t.accounts[a].username);e.close(n)},t.cancel=function(){e.dismiss(s.t("cancel"))}}])}),define("controllers/confirm",["app"],function(e){e.controller("confirm",["$uibModalInstance","$scope","$timeout","$sce","api","lang","meta","title","message","buttons","labels",function(e,t,n,a,i,s,o,c,r,l,u){t.title=c,t.message=a.trustAsHtml(r),t.buttons=l,t.labels=u,t.close=function(){e.close()},t.dismiss=function(){e.dismiss()}}])}),define("controllers_enduser/dashboard",["app"],function(e){e.controller("dashboard_enduser",["$rootScope","$scope","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","confirm",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Dashboard"),t.stats={alerts:0,accounts:0,jobs:0,backups:0,over_quota:0,jobs_running:0},t.loadingStatistics=!0,t.createBackupOnDemand=function(){d.open({message:c.t("Are you sure you want to create backup on demand?"),confirm:function(){s.createBackupOnDemand({data:{account_id:t.loggedAccount._id},success:function(e,t){u.success(t)},failed:function(e){u.error(e)}})},cancel:function(){}})},t.fetch=function(e){void 0===e|"function"!=typeof e&&(e=function(){}),s.getDashboardDetails({success:function(n){t.stats.alerts=n.statistics.total_new_alerts,t.stats.accounts=n.statistics.total_accounts,t.stats.backups=n.statistics.total_account_backups,t.stats.disk_usage=n.statistics.total_disk_usage,t.loadingStatistics=!1,e()},failed:function(n){u.error(n),t.loadingStatistics=!1,e()}})},a(t.fetch)}])}),define("controllers_enduser/restore",["app"],function(e){e.controller("restore_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","popup","permissions","consts",function(e,t,n,a,i,s,o,c,r,l,u,d){e.$emit("menuItem","Restore"),t.currentSection={},t.selected={},t.sectionTemplate="",t.sections=[{_id:"full",name:r.t("Full Account"),icon:"fa-cubes",hidden:!u.canManageFullBackups},{_id:"files",name:r.t("Home Directory"),icon:"fa-folder",hidden:!u.canManageFileBackups},{_id:"cron",name:r.t("Cron Jobs"),icon:"fa-user-clock",hidden:!u.canManageCronBackups},{_id:"db",name:r.t("Databases"),icon:"fa-database",hidden:!u.canManageDatabaseBackups},{_id:"dbuser",name:r.t("Database Users"),icon:"fa-user-tie",hidden:!u.canManageDatabaseBackups},{_id:"dns",name:r.t("Domains"),icon:"fa-map-marker-alt",hidden:!u.canManageDNSZoneBackups},{_id:"ssl",name:r.t("Certificates"),icon:"fa-lock",hidden:!u.canManageCertificateBackups},{_id:"email",name:r.t("Email Accounts"),icon:"fa-envelope",hidden:!u.canManageEmailBackups},{_id:"ftp",name:r.t("FTP Accounts"),icon:"fa-file",hidden:!u.canManageFTPBackups}],t.saveNotes=function(e,t){e.notes=e.notes.substr(0,40),t&&13!==t.which||(o.manageBackupNotes({data:{_id:e._id,notes:e.notes},success:function(e,t){alert.success(t)},failed:function(e){alert.error(e)}}),e.editing=!1)},t.isSelected=function(){for(var e in t.selected)return!0;return!1},t.isSelectedBackup=function(e){return void 0!==t.selected[e._id]},t.selectedBackup=function(e){void 0!==t.selected[e._id]?delete t.selected[e._id]:t.selected[e._id]=e},t.prepareSummary=function(e){var n=[];for(var a in t.selected)n.push(t.selected[a]);t.showSummary(e,n)},t.changeBackup=function(e){if(e.options=[],e.new_id===e._id)return e.options_real={},void(e.new_id="");var n=e._id,a=e.options_real[e.new_id];for(var i in a)e[i]=a[i];void 0!==t.selected[n]&&(delete t.selected[n],t.selected[e._id]=e),e.options_real={},e.new_id=""},t.selectBackup=function(e){e.new_id=e._id,e.options=[],e.options_real={};var t={account_id:e.account_id,type:e.backup_type,contains:e.backup_contains,name:e.name,sort:{created:-1}}
;void 0!==e.params.engine&&(t.engine=e.params.engine),o.listBackupForTypeName({data:t,success:function(t){for(var n=0;n<t.backups.length;n++)e.options.push({_id:t.backups[n]._id,display:r.d(t.backups[n].created,"shorttime")}),e.options_real[t.backups[n]._id]=t.backups[n]}})},t.showSummary=function(e,n,a){l.open({size:"xl",template:"backups",templateViews:"views_enduser",controller:"backups_enduser",resolve:{section:function(){return t.currentSection},summary:function(){return e},items:function(){return n},files:function(){return void 0!==a?a:{}}}}).result.then(function(e){e&&t.fetch()},function(){})},t.changeSection=function(e){t.changeView("restore/"+e._id)},t.loadSection=function(e){for(var n=0;n<t.sections.length;n++){var a=t.sections[n];if(a._id===e&&!a.hidden)return t.currentSection=a,void(t.sectionTemplate=t.includePath("restore/"+a._id,"views_enduser"))}for(var n=0;n<t.sections.length;n++){var a=t.sections[n];if(!a.hidden)return t.currentSection=a,void(t.sectionTemplate=t.includePath("restore/"+a._id,"views_enduser"))}},t.loadSection(n.type)}])}),define("controllers_enduser/restore/full",["app"],function(e){e.controller("restore_full_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert",function(e,t,n,a,i,s,o,c,r,l,u,d){t.backups=[],t.selected="",c=c.new("enduser_full_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.selectedBackup=function(e){t.selected===e.parent_id?t.selected="":t.selected=e.parent_id},t.prepareSummary=function(e){o.getBackupItems({data:{_id:t.selected,limit:999999},success:function(n){t.showSummary(e,n.backups)},failed:function(e){d.error(e)}})},t.fetch=function(){t.backups=[],t.selected="";var e={name:t.loggedAccount.username,type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_FULL,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForTypeName({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/files",["app"],function(e){e.controller("restore_files_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={_id:""},t.files=void 0,c=c.new("enduser_files_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.selectedBackup=function(e){t.files=void 0,t.selected._id!==e._id?t.selected=e:t.selected={_id:""}},t.totalFiles=function(){if(void 0===t.files)return null;var e=0;for(var n in t.files)e++;return e||null},t.fileBrowse=function(){_.open({size:"xl",template:"fileManagerPopup",scope:t,resolve:{files:function(){return t.files},backup:function(){return t.selected}}}).result.then(function(e){var n=0;for(var a in e)n++;t.files=n?e:void 0},function(){})},t.prepareSummary=function(e){var n={};void 0!==t.files&&(n[t.selected._id]=t.files),t.showSummary(e,[t.selected],n)},t.fetch=function(){t.backups=[],t.selected={_id:""},t.files=void 0;var e={name:t.loggedAccount.username,type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_HOMEDIR,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForTypeName({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/cron",["app"],function(e){e.controller("restore_cron_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={_id:""},t.files={},c=c.new("enduser_cron_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.saveNotes=function(e,t){e.notes=e.notes.substr(0,40),t&&13!==t.which||(o.manageBackupNotes({data:{_id:e._id,notes:e.notes},success:function(e,t){d.success(t)},failed:function(e){d.error(e)}}),e.editing=!1)},t.selectedBackup=function(e){t.selected._id===e._id?t.selected={_id:""}:t.selected=e},t.prepareSummary=function(e){t.showSummary(e,[t.selected])},t.fetch=function(){t.backups=[],t.selected={_id:""};var e={name:t.loggedAccount.username,type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_CRON_JOBS,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForTypeName({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/dns",["app"],function(e){e.controller("restore_dns_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={},t.files={},c=c.new("enduser_dns_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.fetch=function(){t.backups=[],t.selected={};var e={type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_DOMAINS,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForType({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/email",["app"],function(e){e.controller("restore_email_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={},t.files={},c=c.new("enduser_email_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.fetch=function(){t.backups=[],t.selected={};var e={type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_EMAILS,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForType({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/db",["app"],function(e){e.controller("restore_db_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={},t.files={},c=c.new("enduser_db_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.fetch=function(){t.backups=[],t.selected={};var e={type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_DATABASES,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForType({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/dbuser",["app"],function(e){e.controller("restore_dbuser_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={},t.files={},c=c.new("enduser_dbuser_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.fetch=function(){t.backups=[],t.selected={};var e={type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_DATABASE_USERS,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForType({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/ftp",["app"],function(e){e.controller("restore_ftp_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts","permissions","alert","popup",function(e,t,n,a,i,s,o,c,r,l,u,d,_){t.backups=[],t.selected={},t.files={},c=c.new("enduser_ftp_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.fetch=function(){t.backups=[],t.selected={};var e={type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_FTP,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForType({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/restore/ssl",["app"],function(e){e.controller("restore_ssl_enduser",["$rootScope","$scope","$routeParams","$location","$timeout","$interval","api","meta","lang","consts",function(e,t,n,a,i,s,o,c,r,l){t.backups=[],t.selected={},t.files={},c=c.new("enduser_ssl_backups"),t.meta=c,t.metaData=c.getData(),c.setSortReverse(!1),c.getSortBy()||c.setSortBy("created"),c.getSortDirection()||c.setSortDirection("desc"),c.setPageSizes([10,25,50,100]),c.setPageSize(10),c.setSortFields(["username","owner"]),c.setTotalItems(t.backups.length),t.fetch=function(){t.backups=[],t.selected={};var e={type:l.BACKUP_TYPE_ACCOUNT,contains:l.BACKUP_TYPE_ACCOUNT_CERTIFICATES,account_id:t.loggedAccount._id,skip:c.getSkip(),limit:c.getPageSize(),filter:c.getFilter(),sort:{},find:{}};e.sort[c.getSortBy()]=c.getSortDirectionInt(),o.listBackupForType({data:e,success:function(e){c.setTotalItems(e.total),c.calculate(e.backups);for(var n=0;n<e.backups.length;n++){for(var a=[],i=0;i<e.backups[n].schedules.length;i++)a.push(l.SCHEDULE_TYPES[e.backups[n].schedules[i]]);e.backups[n].schedules_names=a.join(","),t.backups.push(e.backups[n])}}})},i(t.fetch)}])}),define("controllers_enduser/backups",["app"],function(e){e.controller("backups_enduser",["$uibModalInstance","$rootScope","$scope","$q","$location","$timeout","api","meta","util","permissions","consts","lang","alert","popup","summary","items","files","section",function(e,t,n,a,i,s,o,c,r,l,u,d,_,f,p,g,E,T){n.loading=!1,n.accountData=n.loggedAccount,n.items=g,n.files=E,n.list={},n.list_checked={},n.summary_gotoqueue=!0,n.summary_type=p,n.summary_tpl=n.includePath("backups"+p+"Summary","views_enduser"),n.restore_conditions=[],n.conditions={},n.options={owner:"",package:""},n.encryption={encrypted:!1,key:""},n.noPermissions=[],"full"===T._id&&(l.canManageFileBackups||n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_HOMEDIR),l.canManageCronBackups||n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_CRON_JOBS),l.canManageDatabaseBackups||(n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_DATABASES),n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_DATABASE_USERS)),l.canManageDNSZoneBackups||n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_DOMAINS),l.canManageCertificateBackups||n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_CERTIFICATES),l.canManageEmailBackups||n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_EMAILS),l.canManageFTPBackups||n.noPermissions.push(u.BACKUP_TYPE_ACCOUNT_FTP));for(var A=0;A<n.items.length;A++){var C=n.items[A];C.checked=!0,void 0===n.list[C.backup_contains]&&(n.list[C.backup_contains]=[]),n.list[C.backup_contains].push(C)}n.close=function(){e.dismiss()},n.askForEncryptionKey=function(){return n.encryption.encrypted&&1==n.accountData.backup_type&&1==n.accountData.encryption_key_type},n.ok=function(){e.close()},n.calculateSummary=function(){var t=!1;n.encryption.encrypted=!1,n.list_checked={};for(var a in n.list)for(var i=0;i<n.list[a].length;i++){var s=n.list[a][i];s.checked&&(!n.encryption.encrypted&&s.encrypted&&(n.encryption.encrypted=!0),void 0===n.list_checked[a]&&(n.list_checked[a]=[]),n.list_checked[a].push(n.list[a][i]),t=!0)}t||e.dismiss()},n.gotItems=function(e){for(var t=0;t<e.length;t++)if(void 0!==n.list_checked[e[t]])return!0;return!1},n.restore=function(){for(var t=0;t<n.restore_conditions.length;t++){var a=n.restore_conditions[t];if(void 0===n.conditions[a._id]||!n.conditions[a._id])return void _.error(d.t("Please accept all restore conditions"))}if(n.askForEncryptionKey()&&!n.encryption.key)return void _.error(d.t('You must provide "Backups Private Encryption Key"'));for(var s=n.items,c=[],t=0;t<s.length;t++)s[t].checked&&c.push(s[t]._id);var l=r.duplicateObject(n.options);o.addQueueItems({data:{type:u.QUEUE_ITEM_TYPE_RESTORE,items:c,files:n.files,options:l,encryption_key:n.encryption.key},success:function(t,a){n.encryption.key="",_.success(a),e.close(),n.summary_gotoqueue&&i.path("/queue")},failed:function(e){_.error(e)}})},n.download=function(){if(n.askForEncryptionKey()&&!n.encryption.key)return void _.error(d.t('You must provide "Backups Private Encryption Key"'));for(var t=n.items,a=[],s=0;s<t.length;s++)t[s].checked&&a.push(t[s]._id);o.addQueueItems({data:{type:u.QUEUE_ITEM_TYPE_DOWNLOAD,items:a,files:n.files,encryption_key:n.encryption.key},success:function(t,a){n.encryption.key="",_.success(a),e.close(),n.summary_gotoqueue&&i.path("/queue")},failed:function(e){_.error(e)}})},n.removeItems=function(e){for(var t=0;t<n.list[e].length;t++){n.list[e][t].checked=!1}n.calculateSummary()},o.listRestoreConditions({data:{find:{disabled:0}},success:function(e){n.restore_conditions=e.conditions}}),n.calculateSummary()}])}),define("filters/html",["app"],function(e){e.filter("html",["$sce",function(e){return function(t){return e.trustAs("html",t)}}])}),define("filters/capitalize",["app"],function(e){e.filter("capitalize",function(){return function(e,t){return e?e.replace(t?/([^\W_]+[^\s-]*) */g:/([^\W_]+[^\s-]*)/,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()}):""}})}),define("filters/executionTime",["app"],function(e){e.filter("executionTime",["$sce","lang",function(e,t){return function(e){if((e=parseInt(e))<0)return"-";if(0===e)return t.t("Under a Second");var n={Day:Math.floor(e/86400),Hour:Math.floor(e/3600)%24,Minute:Math.floor(e/60)%60,Second:e%60};return n.Day?t.t("%s Days and %s Hours and %s Minutes and %s Seconds",n.Day,n.Hour,n.Minute,n.Second):n.Hour?t.t("%s Hours and %s Minutes and %s Seconds",n.Hour,n.Minute,n.Second):n.Minute?t.t("%s Minutes and %s Seconds",n.Minute,n.Second):n.Second?t.t("%s Seconds",n.Second):void 0}}])}),define("filters/numberFormat",["app"],function(e){e.filter("numberFormat",[function(){return function(e,t,n,a){t=isNaN(t=Math.abs(t))?2:t,n=void 0==n?".":n,a=void 0==a?",":a;var i=e<0?"-":"",s=parseInt(e=Math.abs(+e||0).toFixed(t))+"",o=(o=s.length)>3?o%3:0;return i+(o?s.substring(0,o)+a:"")+s.substring(o).replace(/(\d{3})(?=\d)/g,"$1"+a)+(t?n+Math.abs(e-s).toFixed(t).slice(2):"")}}])}),define("services/api",["app"],function(e){e.factory("api",["$rootScope","$http","$location","cfpLoadingBar","permissions","lang","util",function(e,t,n,a,i,s,o){function c(r,l){void 0!==l.success&&"function"==typeof l.success||(l.success=function(e,t,n){}),void 0!==l.failed&&"function"==typeof l.failed||(l.failed=function(e,t){}),void 0===l.withLoader&&(l.withLoader=!0),void 0===l.data&&(l.data={}),l.data.function=r,l.withLoader&&a.start(),t.post(window.PAGE.path.api,l.data).then(function(t){if(void 0===t.data.success&&t.data.includes("<html")&&window.location.reload(),t.data.system.retry_ms>0)return o.sleep(t.data.system.retry_ms),void c(r,l);if(t.data.message){var u=[];if(u.push("exceptions|:|"+t.data.message),!t.data.success&&t.data.data.length)for(var d=0;d<t.data.data.length;d++)u.push(t.data.data[d]);t.data.message=s.t.apply(s,u)}if(t.data.system.licenseIssue||t.data.system.agreement||t.data.system.dr||t.data.system.agreement_panel){var _="";window.PAGE.system=t.data.system,t.data.system.agreement_panel&&(_="/agreementPanel"),t.data.system.dr&&(_="/disasterRecovery"),t.data.system.agreement&&(_="/agreement"),t.data.system.licenseIssue&&("Active"===e.license.status&&(window.PAGE.license={status:"Invalid",message:t.data.message},e.license=window.PAGE.license),_="/license"),i.init(window.PAGE.permissions),n.path(_)}l.withLoader&&a.complete(),t.data.success?l.success(t.data.data,t.data.message,t.data.system):l.failed(t.data.message,t.data.system)},function(){l.withLoader&&a.complete()})}return{pluginAPI:function(e,t,n){return void 0===n.data&&(n.data={}),n.data.plugin=e,n.data.call=t,c("pluginAPI",n)},panel:function(e,t){return t.data.call=e,c("panelAPI",t)},custom:function(e,t){return c(e,t)},getSettings:function(e){var t="getSettings"+e.data.section[0].toUpperCase()+e.data.section.substr(1);return delete e.section,c(t,e)},manageSettings:function(e){var t="manageSettings"+e.data.section[0].toUpperCase()+e.data.section.substr(1);return delete e.section,c(t,e)},factoryReset:function(e){c("factoryReset",e)},exitDisasterRecovery:function(e){c("exitDisasterRecovery",e)},manageRestoreCondition:function(e){c("manageRestoreCondition",e)},getRestoreCondition:function(e){c("getRestoreCondition",e)},listRestoreConditions:function(e){c("listRestoreConditions",e)},deleteRestoreCondition:function(e){c("deleteRestoreCondition",e)},createSupportTicketKey:function(e){c("createSupportTicketKey",e)},getMyAccount:function(e){c("getMyAccount",e)},manageMyAccount:function(e){c("manageMyAccount",e)},approveAgreement:function(e){c("approveAgreement",e)},getProcessStatus:function(e){c("getProcessStatus",e)},fileManager:function(e){c("fileManager",e)},getDashboardDetails:function(e){c("getDashboardDetails",e)},fileBrowse:function(e){c("fileBrowse",e)},getDownload:function(e){c("getDownload",e)},listDownloads:function(e){c("listDownloads",e)},manageDownloadNotes:function(e){c("manageDownloadNotes",e)},createBackupOnDemand:function(e){c("createBackupOnDemand",e)},manageSecurityPlugin:function(e){c("manageSecurityPlugin",e)},managePlugin:function(e){c("managePlugin",e)},getPlugin:function(e){c("getPlugin",e)},listPlugins:function(e){c("listPlugins",e)},installPlugin:function(e){c("installPlugin",e)},uninstallPlugin:function(e){c("uninstallPlugin",e)},updatePlugin:function(e){c("updatePlugin",e)},listAvailablePlugins:function(e){c("listAvailablePlugins",e)},listNotificationIntegrationTypes:function(e){c("listNotificationIntegrationTypes",e)},listNotificationIntegrations:function(e){c("listNotificationIntegrations",e)},manageNotificationIntegration:function(e){c("manageNotificationIntegration",e)},sendNotificationIntegrationTest:function(e){c("sendNotificationIntegrationTest",e)},deleteNotificationIntegration:function(e){c("deleteNotificationIntegration",e)},getNotificationIntegration:function(e){c("getNotificationIntegration",e)},manageHook:function(e){c("manageHook",e)},getHook:function(e){c("getHook",e)},listHooks:function(e){c("listHooks",e)},deleteHook:function(e){c("deleteHook",e)},manageTag:function(e){c("manageTag",e)},getTag:function(e){c("getTag",e)},listTags:function(e){c("listTags",e)},deleteTag:function(e){c("deleteTag",e)},manageSchedule:function(e){c("manageSchedule",e)},getSchedule:function(e){c("getSchedule",e)},listSchedules:function(e){c("listSchedules",e)},deleteSchedule:function(e){c("deleteSchedule",e)},manageQueuePriority:function(e){c("manageQueuePriority",e)},getQueuePriority:function(e){c("getQueuePriority",e)},listQueuePriorities:function(e){c("listQueuePriorities",e)},deleteQueuePriority:function(e){c("deleteQueuePriority",e)},getFilePermissions:function(e){c("getFilePermissions",e)},listFilePermissions:function(e){c("listFilePermissions",e)},manageFilePermissions:function(e){c("manageFilePermissions",e)},deleteFilePermissions:function(e){c("deleteFilePermissions",e)},getRepository:function(e){c("getRepository",e)},listRepositories:function(e){c("listRepositories",e)},manageRepository:function(e){c("manageRepository",e)},deleteRepository:function(e){c("deleteRepository",e)},reloadRepository:function(e){c("reloadRepository",e)},getPackage:function(e){c("getPackage",e)},listPackages:function(e){c("listPackages",e)},listPackagesAvailable:function(e){c("listPackagesAvailable",e)},deleteAccountFilter:function(e){c("deleteAccountFilter",e)},getAccountFilter:function(e){c("getAccountFilter",e)},listAccountFilters:function(e){c("listAccountFilters",e)},manageAccountFilter:function(e){c("manageAccountFilter",e)},getAccountFilterGroup:function(e){c("getAccountFilterGroup",e)},listAccountFilterGroups:function(e){c("listAccountFilterGroups",e)},getAlert:function(e){c("getAlert",e)},listAlerts:function(e){c("listAlerts",e)},clearAlerts:function(e){c("clearAlerts",e)},getPermissions:function(e){c("getPermissions",e)},managePermissions:function(e){c("managePermissions",e)},resetPermissions:function(e){c("resetPermissions",e)},deleteLog:function(e){c("deleteLog",e)},getLog:function(e){c("getLog",e)},listLogs:function(e){c("listLogs",e)},getLogItem:function(e){c("getLogItem",e)},listLogItems:function(e){c("listLogItems",e)},deleteDestination:function(e){c("deleteDestination",e)},getDestination:function(e){c("getDestination",e)},listDestinations:function(e){c("listDestinations",e)},listDestinationTypes:function(e){c("listDestinationTypes",e)},manageDestination:function(e){c("manageDestination",e)},manageDestinationState:function(e){c("manageDestinationState",e)},validateDestination:function(e){c("validateDestination",e)},reindexDestination:function(e){c("reindexDestination",e)},measureDestinationSpeed:function(e){c("measureDestinationSpeed",e)},genDestinationAuth:function(e){c("genDestinationAuth",e)},reassignAccount:function(e){c("reassignAccount",e)},listAssignableAccounts:function(e){c("listAssignableAccounts",e)},manageAccount:function(e){c("manageAccount",e)},manageAccountExcludeList:function(e){c("manageAccountExcludeList",e)},getAccount:function(e){c("getAccount",e)},getAccountExcludeList:function(e){c("getAccountExcludeList",e)},listAccounts:function(e){c("listAccounts",e)},listAccountsByFilters:function(e){c("listAccountsByFilters",e)},listAccountPackages:function(e){c("listAccountPackages",e)},addMultiAccountQueueItems:function(e){c("addMultiAccountQueueItems",e)},resetEncryptionKey:function(e){c("resetEncryptionKey",e)},addQueueItems:function(e){c("addQueueItems",e)},listQueueItems:function(e){c("listQueueItems",e)},listQueueGroups:function(e){c("listQueueGroups",e)},stopQueueGroup:function(e){c("stopQueueGroup",e)},stopAllQueueGroup:function(e){c("stopAllQueueGroup",e)},getQueueGroup:function(e){c("getQueueGroup",e)},getQueueItem:function(e){c("getQueueItem",e)},clearQueue:function(e){c("clearQueue",e)},rerunFailedQueueGroup:function(e){c("rerunFailedQueueGroup",e)},getBackupItems:function(e){c("getBackupItems",e)},getBackupItem:function(e){c("getBackupItem",e)},listBackupForTypeName:function(e){c("listBackupForTypeName",e)},listBackups:function(e){c("listBackups",e)},listBackupForType:function(e){c("listBackupForType",e)},listBackupForAccounts:function(e){c("listBackupForAccounts",e)},listBackupForDirectories:function(e){c("listBackupForDirectories",e)},listBackupForDisasterRecovery:function(e){c("listBackupForDisasterRecovery",e)},getMasterEncryptionKey:function(e){c("getMasterEncryptionKey",e)},listShowcase:function(e){c("listShowcase",e)},approveShowcase:function(e){c("approveShowcase",e)},manageBackupLock:function(e){c("manageBackupLock",e)},manageBackupNotes:function(e){c("manageBackupNotes",e)},manageMultiBackupLock:function(e){c("manageMultiBackupLock",e)},runCloneJobManually:function(e){c("runCloneJobManually",e)},duplicateCloneJob:function(e){c("duplicateCloneJob",e)},manageCloneJob:function(e){c("manageCloneJob",e)},deleteCloneJob:function(e){c("deleteCloneJob",e)},getCloneJob:function(e){c("getCloneJob",e)},listCloneJobs:function(e){c("listCloneJobs",e)},runBackupJobManually:function(e){c("runBackupJobManually",e)},duplicateBackupJob:function(e){c("duplicateBackupJob",e)},manageBackupJob:function(e){c("manageBackupJob",e)},deleteBackupJob:function(e){c("deleteBackupJob",e)},getBackupJob:function(e){c("getBackupJob",e)},listBackupJobs:function(e){c("listBackupJobs",e)}}}])}),define("services/alert",["app"],function(e){e.factory("alert",["$rootScope",function(e){var t=function(t,n,a){void 0===a&&(a=1e4),void 0===e.alerts&&(e.alerts=[]),e.alerts.unshift({message:t,type:n,closeable:!0,ttl:a})};return t.prototype={},{success:function(e,n){new t(e,"success",n)},error:function(e,n){new t(e,"danger",n)},warning:function(e,n){new t(e,"warning",n)},info:function(e,n){new t(e,"info",n)}}}])}),define("services/confirm",["app"],function(e){e.factory("confirm",["$rootScope","$uibModal","lang","popupPosition",function(e,t,n,a){return{open:function(i){void 0===i.title&&(i.title=n.t("Are you sure?")),void 0===i.message&&(i.message=""),void 0===i.cancelLabel&&(i.cancelLabel=n.t("Cancel")),void 0===i.confirmLabel&&(i.confirmLabel=n.t("OK")),void 0!==i.confirm&&"function"==typeof i.confirm||(i.confirm=function(){}),void 0!==i.cancel&&"function"==typeof i.cancel||(i.cancel=function(){}),void 0===i.buttons&&(i.buttons=[]);var s=t.open({animation:!0,size:"md",ariaLabelledBy:"modal-title",ariaDescribedBy:"modal-body",templateUrl:e.includePath("confirm"),controller:"confirm",scope:e,resolve:{title:function(){return i.title},message:function(){return i.message},buttons:function(){return i.buttons},labels:function(){return{cancel:i.cancelLabel,confirm:i.confirmLabel}}}});return s.opened.then(function(){a.update()}),s.result.then(i.confirm,i.cancel),s}}}])}),define("services/lang",["app"],function(e){e.factory("lang",["$i18next","$location",function(e,t){return{_ns:"",setNS:function(e,t){var n=this;n._ns=e,void 0!==t&&t.$on("$destroy",function(){n.resetNS()})},resetNS:function(){this._ns=""},loadNS:function(t){e.loadNamespaces(t)},setDefaultNS:function(t){this.loadNS(t),e.setDefaultNamespace(t)},initNS:function(e){var n=t.path();n=n.split("/")[1],n||void 0===e||(n=e),n?this.setDefaultNS(n):$rootScope.$broadcast("i18nextNSLoad",this._ns)},t:function(){var t=[];for(var n in arguments)t.push(arguments[n]);var a=t.slice(1),i=(this._ns?this._ns+"|:|":"")+t[0];return a.length?e.t(i,{postProcess:"sprintf",sprintf:a}):e.t(i)},d:function(t,n){var a=moment(t);window.PAGE.info.utcOffset&&a.utcOffset(window.PAGE.info.utcOffset),void 0===n&&(n="longtime");var i=n;return n=e.t("date|:|"+i),n==i&&(n="ddd, MMM D, YYYY, |TIME|"),n=n.replace("|TIME|",12==window.PAGE.timeformat?"hh:mm A":"HH:mm"),a.format(n)}}}])}),define("services/filter",["app"],function(e){e.factory("filter",[function(){var e=function(e){this._init(e)};return e.prototype={_storage_key:void 0,_data:{},_initStorage:function(e){this._storage_key="sort_"+e;var t=localStorage.getItem(this._storage_key);if(void 0===t)localStorage.setItem(this._storage_key,JSON.stringify(this._data));else{var n=JSON.parse(t);n&&(this._data=n)}},_init:function(e){var t={filter:""};this._data={};for(var n in t)this._data[n]=t[n];void 0!==e&&this._initStorage(e)},set:function(e,t){this._data[e]=t,localStorage.setItem(this._storage_key,JSON.stringify(this._data))},get:function(e,t){return void 0!==this._data[e]?this._data[e]:t},setFilter:function(e){this.set("filter",e)},getFilter:function(){return this.get("filter")},setData:function(e){this._data=e},getData:function(){return this._data}},{new:function(t){return new e(t)}}}])}),define("services/meta",["app"],function(e){e.factory("meta",["storage","lang",function(e,t){var n=function(t){if(void 0===t)throw Error("No storage name provided");this._storage_id=t,this._storage=e.create("sort_"+this._storage_id),this._noneStorage[this._storage_id]={};for(var n in this._defaults)(this._noneStorageKeys.indexOf(n)>=0||!this._storage.isSet(n))&&this.set(n,this._defaults[n])};return n.prototype={_defaults:{sortReverse:!1,sortBy:"",sortDirection:"",sortFields:[],filterValue:"",maxPages:3,totalItems:0,currentPage:1,pageSize:25,pageSizes:[25,50,100,250,500],start:0,limit:25,itemCountText:void 0},_noneStorageKeys:["filterValue"],_noneStorage:{},_storage_id:void 0,_storage:void 0,_storage_key:void 0,_show_count_text:!1,_onChangeFunction:function(){},onChange:function(e){this._onChangeFunction=e},set:function(e,t){this._noneStorageKeys.indexOf(e)>=0?this._noneStorage[this._storage_id][e]=t:(this._storage.set(e,t),this._storage.save()),this._onChangeFunction()},get:function(e,t){return this._storage.get(e,t)},setSortReverse:function(e){this.set("sortReverse",e)},getSortReverse:function(){return this.get("sortReverse")},setSortBy:function(e){this.set("sortBy",e)},getSortBy:function(){return this.get("sortBy")},setSortDirection:function(e){this.set("sortDirection",e)},getSortDirection:function(){return this.get("sortDirection")},getSortDirectionInt:function(){return"asc"===this.getSortDirection()?1:-1},setSortFields:function(e){this.set("sortFields",e)},getSortFields:function(){return this.get("sortFields")},setFilter:function(e){
this._noneStorage[this._storage_id].filterValue=e},getFilter:function(){return this._noneStorage[this._storage_id].filterValue},setMaxPages:function(e){this.set("maxPages",e)},getMaxPages:function(){return this.get("maxPages")},setTotalItems:function(e){this.set("totalItems",parseInt(e))},getTotalItems:function(){return this.get("totalItems")},setCurrentPage:function(e){this.set("currentPage",e)},getCurrentPage:function(){return this.get("currentPage")},setPageSize:function(e){this.set("pageSize",e)},getPageSize:function(){return this.get("pageSize")},setPageSizes:function(e){this.set("pageSizes",e)},getPageSizes:function(){return this.get("pageSizes")},setStart:function(e){this.set("start",e)},getStart:function(){return this.get("start")},setLimit:function(e){this.set("limit",e)},getLimit:function(){return this.get("limit")},setItemCountText:function(e){this.set("itemCountText",e)},getItemCountText:function(){return this.get("itemCountText")},showItemCountText:function(){return this._show_count_text=!0,this._show_count_text},getSkip:function(){return(this.getCurrentPage()-1)*this.getPageSize()},showPagination:function(){return this.get("showPagination",!1)},setData:function(e){for(var t in e)this._noneStorageKeys.indexOf(t)<0||(this._noneStorage[this._storage_id][t]=e[t]);this._storage.setData(e)},getData:function(){var e=this._noneStorage[this._storage_id],t=this._storage.getData();for(var n in t)this._noneStorageKeys.indexOf(n)>=0||(e[n]=t[n]);return e},reset:function(){this.setCurrentPage(1)},calculate:function(e){if(void 0===e&&(e=[]),this.getTotalItems()>this._min(this.getPageSizes())){this.set("showPagination",!0);var n=(this.getCurrentPage()-1)*this.getPageSize();this.setStart(n+1)}else this.set("showPagination",!1),this.setStart(0===e.length?0:1),this.setLimit(e.length);this.setItemCountText(t.t("Displaying %s to %s out of %s records",this.getStart(),this.getPageSize()*this.getCurrentPage()>this.getTotalItems()?this.getTotalItems():this.getPageSize()*this.getCurrentPage(),this.getTotalItems()))},_min:function(e){for(var t,n=null;t<e.length;t++)(null===n||e[t]<n)&&(n=e[t]);return null===n?0:n}},{new:function(e){return new n(e)}}}])}),define("services/storage",["app"],function(e){e.factory("storage",[function(){var e=function(e){if(void 0===e)throw Error("You must provide pool name");this._storage_name="JetBackupStorage_"+e,this._data={};var t=localStorage.getItem(this._storage_name);void 0===t?this.save():this.setData(JSON.parse(t))};return e.prototype={_storage_name:void 0,_data:null,set:function(e,t){this._data[e]=t},get:function(e,t){return void 0!==this._data[e]?this._data[e]:t},isSet:function(e){return void 0!==this._data[e]},remove:function(e){delete this._data[e]},save:function(){localStorage.setItem(this._storage_name,JSON.stringify(this._data))},setData:function(e){e&&(this._data=e)},getData:function(){return this._data},destroy:function(){localStorage.removeItem(this._storage_name),this._data={}}},{create:function(t){return new e(t)},delete:function(e){if(void 0===e)throw Error("You must provide pool name");localStorage.removeItem("JetBackupStorage_"+e)},deleteAll:function(){localStorage.clear()},exists:function(e){return!!localStorage.getItem("JetBackupStorage_"+e)}}}])}),define("services/permissions",["app"],function(e){e.factory("permissions",["PermPermissionStore","lang",function(e,t){var n={HAS_ALL_PRIVILEGES:0,CAN_MANAGE_ACCOUNTS:1,CAN_RESTORE_BACKUPS:2,CAN_DOWNLOAD_BACKUPS:3,CAN_MANAGE_FULL_BACKUPS:4,CAN_MANAGE_FILE_BACKUPS:5,CAN_MANAGE_CRON_BACKUPS:6,CAN_MANAGE_EMAIL_BACKUPS:7,CAN_MANAGE_DATABASE_BACKUPS:8,CAN_MANAGE_SSL_BACKUPS:9,CAN_MANAGE_DNSZONES_BACKUPS:10,CAN_MANAGE_CONFIG_BACKUPS:11,CAN_MANAGE_BACKUP_JOBS:12,CAN_MANAGE_CLONE_JOBS:21,CAN_MANAGE_DESTINATIONS:13,CAN_MANAGE_HOOKS:14,CAN_MANAGE_PERMISSIONS:15,CAN_VIEW_LOGS:16,CAN_MANAGE_LOGS:17,CAN_VIEW_ALERTS:18,CAN_MANAGE_DIRECTORY_BACKUPS:19,CAN_MANAGE_DISASTER_RECOVERY_BACKUPS:22,CAN_MANAGE_FTP_BACKUPS:20,CAN_ACCESS_SOCKET_API:23},a=function(){};return a.prototype={_permissions:void 0,init:function(t){var a=this;this._permissions=t,this.isRoot=!!this._permissions[n.HAS_ALL_PRIVILEGES],this.isReseller=!(!this.isRoot&&!window.PAGE.account.reseller),this.isEnduser="enduser"===window.PAGE.template,this.isShowcase=!(!this.isRoot||void 0===window.PAGE.showcase.total_unapproved||!window.PAGE.showcase.total_unapproved),this.isLicenseIssue=!(void 0===window.PAGE.system.licenseIssue||!window.PAGE.system.licenseIssue),this.isDisableUI=!(void 0===window.PAGE.disableui||!window.PAGE.disableui),this.isDisasterRecovery=!(this.isDisableUI||void 0===window.PAGE.system.dr||!window.PAGE.system.dr),this.isAgreement=!(this.isDisableUI||void 0===window.PAGE.system.agreement||!window.PAGE.system.agreement),this.isAgreementPanel=!(this.isDisableUI||void 0===window.PAGE.system.agreement_panel||!window.PAGE.system.agreement_panel),this.isFullScreen=!!(this.isShowcase||this.isLicenseIssue||this.isDisasterRecovery||this.isAgreement||this.isAgreementPanel||this.isDisableUI),this.canManageAccounts=this.check(n.CAN_MANAGE_ACCOUNTS),this.canRestoreBackups=this.check(n.CAN_RESTORE_BACKUPS),this.canDownloadBackups=this.check(n.CAN_DOWNLOAD_BACKUPS),this.canManageFullBackups=this.check(n.CAN_MANAGE_FULL_BACKUPS),this.canManageFileBackups=this.check(n.CAN_MANAGE_FILE_BACKUPS),this.canManageCronBackups=this.check(n.CAN_MANAGE_CRON_BACKUPS),this.canManageEmailBackups=this.check(n.CAN_MANAGE_EMAIL_BACKUPS),this.canManageDatabaseBackups=this.check(n.CAN_MANAGE_DATABASE_BACKUPS),this.canManageCertificateBackups=this.check(n.CAN_MANAGE_SSL_BACKUPS),this.canManageDNSZoneBackups=this.check(n.CAN_MANAGE_DNSZONES_BACKUPS),this.canManageConfigBackups=this.check(n.CAN_MANAGE_CONFIG_BACKUPS),this.canManageBackupJobs=this.check(n.CAN_MANAGE_BACKUP_JOBS),this.canManageCloneJobs=this.check(n.CAN_MANAGE_CLONE_JOBS),this.canManageDestinations=this.check(n.CAN_MANAGE_DESTINATIONS),this.canManageHooks=this.check(n.CAN_MANAGE_HOOKS),this.canManagePermissions=this.check(n.CAN_MANAGE_PERMISSIONS),this.canViewLogs=this.check(n.CAN_VIEW_LOGS),this.canManageLogs=this.check(n.CAN_MANAGE_LOGS),this.canViewAlerts=this.check(n.CAN_VIEW_ALERTS),this.canManageDirectoryBackups=this.check(n.CAN_MANAGE_DIRECTORY_BACKUPS),this.canManageDisasterRecoveryBackups=this.check(n.CAN_MANAGE_DISASTER_RECOVERY_BACKUPS),this.canManageFTPBackups=this.check(n.CAN_MANAGE_FTP_BACKUPS),this.canManageQueue=this.canRestoreBackups||this.canDownloadBackups,this.canAccessSocketAPI=this.check(n.CAN_ACCESS_SOCKET_API),this.canManageAccountBackups=this.canManageFullBackups||this.canManageFileBackups||this.canManageCronBackups||this.canManageEmailBackups||this.canManageDatabaseBackups||this.canManageCertificateBackups||this.canManageDNSZoneBackups||this.canManageFTPBackups||this.canManageConfigBackups,e.clearStore();for(var i in this)(/^can/.test(i)||/^is/.test(i)||/^has/.test(i))&&e.definePermission(i,function(e){return void 0!==a[e]&&a[e]})},check:function(e){return!(this.isLicenseIssue||this.isDisasterRecovery||this.isShowcase||this.isAgreement||this.isAgreementPanel||this.isDisableUI||!this._permissions[e])},get:function(e){var a={};return a[n.HAS_ALL_PRIVILEGES]={name:t.t("Has All Privileges"),description:"",warning:t.t("WARNING: Same as granting root access!")},a[n.CAN_MANAGE_ACCOUNTS]={name:t.t("Can Manage Accounts"),description:"",warning:""},a[n.CAN_RESTORE_BACKUPS]={name:t.t("Can Restore Backups"),description:"",warning:""},a[n.CAN_DOWNLOAD_BACKUPS]={name:t.t("Can Download Backups"),description:"",warning:""},a[n.CAN_MANAGE_FULL_BACKUPS]={name:t.t("Can Manage Full Backups"),description:"",warning:""},a[n.CAN_MANAGE_FILE_BACKUPS]={name:t.t("Can Manage File Backups"),description:"",warning:""},a[n.CAN_MANAGE_CRON_BACKUPS]={name:t.t("Can Manage Cron Job Backups"),description:"",warning:""},a[n.CAN_MANAGE_EMAIL_BACKUPS]={name:t.t("Can Manage Email Account Backups"),description:"",warning:""},a[n.CAN_MANAGE_DATABASE_BACKUPS]={name:t.t("Can Manage Database Backups"),description:"",warning:""},a[n.CAN_MANAGE_SSL_BACKUPS]={name:t.t("Can Manage SSL Certificate Backups"),description:"",warning:""},a[n.CAN_MANAGE_DNSZONES_BACKUPS]={name:t.t("Can Manage Domain Backups"),description:"",warning:""},a[n.CAN_MANAGE_CONFIG_BACKUPS]={name:t.t("Can Manage Configuration Backups"),description:"",warning:""},a[n.CAN_MANAGE_BACKUP_JOBS]={name:t.t("Can Manage Backup Jobs"),description:"",warning:""},a[n.CAN_MANAGE_CLONE_JOBS]={name:t.t("Can Manage Clone Jobs"),description:"",warning:""},a[n.CAN_MANAGE_DESTINATIONS]={name:t.t("Can Manage Destinations"),description:"",warning:""},a[n.CAN_MANAGE_HOOKS]={name:t.t("Can Manage Hooks"),description:"",warning:""},a[n.CAN_MANAGE_PERMISSIONS]={name:t.t("Can Manage Permissions"),description:"",warning:""},a[n.CAN_VIEW_LOGS]={name:t.t("Can View Logs"),description:"",warning:""},a[n.CAN_MANAGE_LOGS]={name:t.t("Can Manage Logs"),description:"",warning:""},a[n.CAN_VIEW_ALERTS]={name:t.t("Can View Alerts"),description:"",warning:""},a[n.CAN_MANAGE_DIRECTORY_BACKUPS]={name:t.t("Can Manage Directory Backups"),description:"",warning:t.t("WARNING: Enabling this permission will give the ability to restore/download files that were backed up in any directory backup job and may contain sensitive information")},a[n.CAN_MANAGE_DISASTER_RECOVERY_BACKUPS]={name:t.t("Can Manage Server Backups (BMR)"),description:"",warning:""},a[n.CAN_MANAGE_FTP_BACKUPS]={name:t.t("Can Manage FTP Account Backups"),description:"",warning:""},a[n.CAN_ACCESS_SOCKET_API]={name:t.t("Can Access Socket API"),description:"",warning:""},void 0!==a[e]?a[e]:null}},new a}])}),define("services/popup",["app"],function(e){e.factory("popup",["$rootScope","$uibModal","lang","popupPosition",function(e,t,n,a){var i=function(e){this._init(e)};return i.prototype={_options:{},_init:function(e){this._options=e},open:function(){void 0===this._options.size&&(this._options.size="md"),void 0===this._options.resolve&&(this._options.resolve={}),void 0===this._options.template&&(this._options.template=""),void 0===this._options.templateViews&&(this._options.templateViews=""),void 0===this._options.noController&&(this._options.noController=!1),void 0===this._options.controller&&(this._options.controller=""),void 0===this._options.scope&&(this._options.scope=e);var n=t.open({animation:!0,size:this._options.size,ariaLabelledBy:"modal-title",ariaDescribedBy:"modal-body",templateUrl:e.includePath(this._options.template,this._options.templateViews),controller:this._options.noController?null:this._options.controller?this._options.controller:this._options.template,scope:this._options.scope,resolve:this._options.resolve});return n.opened.then(function(){a.update()}),n}},{open:function(e){return new i(e).open()}}}])}),define("services/popupPosition",["app"],function(e){e.factory("popupPosition",[function(){var e=function(){this._init()};return e.prototype={_window:window,_offset:0,_position:0,_iframe:!1,_listener_state:void 0,_listener_funcs:{window:void 0},_init:function(){this._calculate()},_calculate:function(){this._calculateWindow(),this._listener()},_calculateWindow:function(){var e=this;for(e._window=window,e._offset=0,e._iframe=!1;;){var t=e._window.location.href,n=e._window.parent;try{if(void 0===n||n===e._window||!1===n.document)break}catch(e){break}e._iframe=!0;var a=n.document.getElementsByTagName("iframe");e._window=n;for(var i=0;i<a.length;i++){var s=a[i];if(s.src.substr(0,s.src.indexOf("?"))===t.substr(0,t.indexOf("?"))){var o=s.getBoundingClientRect().top,c=e._window.scrollY;if(void 0!==e._window.popupPosition){var r=e._window.popupPosition;if(void 0!==r.id){var l=e._window.document.getElementById(r.id);void 0!==l&&(o-=l.getBoundingClientRect().top,c=l.scrollTop)}}e._offset+=c+o;break}}}e._window.onresize=function(){e._calculate()}},_listener:function(){if(this.insideIframe()){var e=this,t=void 0!==e._window.popupPosition&&void 0!==e._window.popupPosition.id?e._window.popupPosition.id:"window";if(!e._listener_state||e._listener_state!==t||void 0===e._listener_funcs[t]){var n=void 0,a=void 0;if(void 0!==e._window.popupPosition){var i=e._window.popupPosition;if(void 0!==i.id){var s=e._window.document.getElementById(i.id);void 0!==s&&(n=function(){var t=void 0!==i.offset?i.offset:0;e._scroll(s.scrollTop+t)},a=s)}}else n=function(){e._scroll(e._window.scrollY)},a=e._window;e._listener_state=t,e._listener_funcs[t]=n,void 0!==a&&a.addEventListener("scroll",n)}}},_scroll:function(e){this._position=e-this._offset,this._position<0&&(this._position=0),this.update()},update:function(){var e=this;if(e._calculate(),e.insideIframe()){var t=document.getElementById("alert-floating-container");t&&(t.style.top=e._position+"px");var n=document.getElementsByClassName("modal");if(n)for(var a=0;a<n.length;a++)n[a].style.top=e._position+"px"}},insideIframe:function(){return!!this._iframe}},new e}])}),define("services/consts",["app"],function(e){e.factory("consts",["lang",function(e){var t={DOCS_URL:"https://docs.jetbackup.com/v5.3",CHANGELOG_URL:"https://changelog.jetbackup.com",REQUEST_URL:"https://request.jetapps.com",FORUM_URL:"https://forum.jetapps.com",BLOG_URL:"https://blog.jetapps.com",ACCOUNT_FILTER_TYPE_ACCOUNT:2,ACCOUNT_FILTER_TYPE_OWNEDBY:4,ACCOUNT_FILTER_TYPE_SUSPENSION:8,ACCOUNT_FILTER_TYPE_DISK_USAGE:16,ACCOUNT_FILTER_TYPE_INODE_USAGE:32,ACCOUNT_FILTER_TYPE_PACKAGE:64,ACCOUNT_FILTER_TYPE_RANGE:128,ACCOUNT_FILTER_TYPE_REGEX:256,ACCOUNT_FILTER_TYPE_ACCOUNT_TAG:512,ACCOUNT_FILTER_TYPE_ENCRYPTION:1024,ACCOUNT_FILTER_TYPE_RESELLER:2048,ACCOUNT_FILTER_CONDITION_INCLUDE:1,ACCOUNT_FILTER_CONDITION_EXCLUDE:2,SCHEDULE_DELAY_TYPE_MINUTES:1,SCHEDULE_DELAY_TYPE_HOURS:2,SCHEDULE_DELAY_TYPE_DAYS:3,ACCOUNT_BACKUP_OPTION_EMAIL_STRUCTURE_ONLY:1,ACCOUNT_BACKUP_OPTION_EMAIL_INCLUDE_JUNK:2,ACCOUNT_BACKUP_OPTION_EXCLUDE_DATABASES:4,ACCOUNT_PACKAGE_TYPE_USER:1,ACCOUNT_PACKAGE_TYPE_RESELLER:2,SCHEDULE_WEEK_DAYS_SUNDAY:1,SCHEDULE_WEEK_DAYS_MONDAY:2,SCHEDULE_WEEK_DAYS_TUESDAY:3,SCHEDULE_WEEK_DAYS_WEDNESDAY:4,SCHEDULE_WEEK_DAYS_THURSDAY:5,SCHEDULE_WEEK_DAYS_FRIDAY:6,SCHEDULE_WEEK_DAYS_SATURDAY:7,SCHEDULE_TYPE_HOURLY:1,SCHEDULE_TYPE_DAILY:2,SCHEDULE_TYPE_WEEKLY:3,SCHEDULE_TYPE_MONTHLY:4,SCHEDULE_TYPE_BACKUP_DONE:5,SCHEDULE_TYPE_CLONE_DONE:10,SCHEDULE_TYPE_MANUALLY:8,SCHEDULE_TYPE_SNAPSHOT:9,SCHEDULE_TYPE_MONTHLY_SUFFIX:["th","st","nd","rd","th","th","th","th","th","th"],QUEUE_ITEM_TYPE_BACKUP:1,QUEUE_ITEM_TYPE_RESTORE:2,QUEUE_ITEM_TYPE_DOWNLOAD:4,QUEUE_ITEM_TYPE_REINDEX:8,QUEUE_ITEM_TYPE_CLONE:16,QUEUE_ITEM_TYPE_SECURITY:32,QUEUE_ITEM_TYPE_INTEGRITY_CHECK:64,QUEUE_ITEM_TYPE_SNAPSHOT_DELETE:128,QUEUE_STATUS_PENDING:1,QUEUE_STATUS_PROCESSING:2,QUEUE_STATUS_BACKUP_ACCOUNT_CONFIG:30,QUEUE_STATUS_BACKUP_ACCOUNT_DOMAINS:31,QUEUE_STATUS_BACKUP_ACCOUNT_CERTIFICATES:32,QUEUE_STATUS_BACKUP_ACCOUNT_FTP:33,QUEUE_STATUS_BACKUP_ACCOUNT_CRON_JOBS:34,QUEUE_STATUS_BACKUP_ACCOUNT_DATABASES:35,QUEUE_STATUS_BACKUP_ACCOUNT_DATABASE_USERS:36,QUEUE_STATUS_BACKUP_ACCOUNT_HOMEDIR:37,QUEUE_STATUS_BACKUP_ACCOUNT_EMAILS:38,QUEUE_STATUS_BACKUP_ACCOUNT_ENCRYPTING:39,QUEUE_STATUS_BACKUP_ACCOUNT_TRANSFERRING:40,QUEUE_STATUS_BACKUP_DIRECTORY_ENCRYPTING:50,QUEUE_STATUS_BACKUP_DIRECTORY_TRANSFERRING:51,QUEUE_STATUS_BACKUP_JBCONFIG_ENCRYPTION_KEY:60,QUEUE_STATUS_BACKUP_JBCONFIG_DATABASE:61,QUEUE_STATUS_BACKUP_JBCONFIG_FILES:62,QUEUE_STATUS_BACKUP_JBCONFIG_ACCOUNTS_LIST:63,QUEUE_STATUS_BACKUP_JBCONFIG_VERSION:64,QUEUE_STATUS_BACKUP_JBCONFIG_ENCRYPTING:65,QUEUE_STATUS_BACKUP_JBCONFIG_TRANSFERRING:66,QUEUE_STATUS_RESTORE_ACCOUNT_CONFIG:30,QUEUE_STATUS_RESTORE_ACCOUNT_DOMAINS:31,QUEUE_STATUS_RESTORE_ACCOUNT_CERTIFICATES:32,QUEUE_STATUS_RESTORE_ACCOUNT_FTP:33,QUEUE_STATUS_RESTORE_ACCOUNT_CRON_JOBS:34,QUEUE_STATUS_RESTORE_ACCOUNT_IMPORTING_DATABASES:35,QUEUE_STATUS_RESTORE_ACCOUNT_DATABASES:36,QUEUE_STATUS_RESTORE_ACCOUNT_DATABASE_USERS:37,QUEUE_STATUS_RESTORE_ACCOUNT_HOMEDIR:38,QUEUE_STATUS_RESTORE_ACCOUNT_EMAILS:39,QUEUE_STATUS_RESTORE_ACCOUNT_POST_RESTORE:40,QUEUE_STATUS_RESTORE_ACCOUNT_PRE_RESTORE:41,QUEUE_STATUS_RESTORE_DIRECTORY_FILES:50,QUEUE_STATUS_RESTORE_JBCONFIG_DOWNLOADING:60,QUEUE_STATUS_RESTORE_JBCONFIG_EXTRACT:61,QUEUE_STATUS_RESTORE_JBCONFIG_DATABASE:62,QUEUE_STATUS_RESTORE_JBCONFIG_PLUGINS:63,QUEUE_STATUS_RESTORE_JBCONFIG_CONFIGS:64,QUEUE_STATUS_BACKUP_DR_DATABASE:70,QUEUE_STATUS_BACKUP_DR_ISO:71,QUEUE_STATUS_BACKUP_DR_ENCRYPTING:72,QUEUE_STATUS_BACKUP_DR_TRANSFERRING:73,QUEUE_STATUS_CLONE_ACCOUNT_PACKAGE:30,QUEUE_STATUS_CLONE_ACCOUNT_CLONING:31,QUEUE_STATUS_DOWNLOAD_DOWNLOADING:30,QUEUE_STATUS_DOWNLOAD_ARCHIVE:31,QUEUE_STATUS_COMPLETED:100,QUEUE_STATUS_PARTIALLY:101,QUEUE_STATUS_FAILED:102,QUEUE_STATUS_ABORTED:103,QUEUE_STATUS_NEVER_FINISHED:104,FILE_PERMISSIONS_CATEGORY_HOMEDIR_DATA:1,FILE_PERMISSIONS_CATEGORY_EMAIL_DATA:2,FILE_PERMISSIONS_CATEGORY_FILESYSTEM_DATA:3,ALERT_LEVEL_INFO:1,ALERT_LEVEL_WARNING:2,ALERT_LEVEL_CRITICAL:4,NOTIFICATION_FREQUENCY_REALTIME:1,NOTIFICATION_FREQUENCY_ONCEADAY:2,PLUGIN_PERMISSION_ROOT:1,PLUGIN_PERMISSION_RESELLER:2,PLUGIN_PERMISSION_USER:4,PLUGIN_TYPE_DESTINATION:"destination",PLUGIN_TYPE_NOTIFICATION:"notification",PLUGIN_TYPE_SECURITY:"security",PLUGIN_TYPE_ADDON:"addon",DESTINATION_JOB_TYPE_BACKUP:1,DESTINATION_JOB_TYPE_CLONE:2,CLONE_TYPE_ACCOUNT:1,CLONE_TYPE_ACCOUNT_CONFIG:1,CLONE_TYPE_ACCOUNT_HOMEDIR:2,CLONE_TYPE_ACCOUNT_DATABASES:4,CLONE_TYPE_ACCOUNT_EMAILS:8,CLONE_TYPE_ACCOUNT_CRON_JOBS:16,CLONE_TYPE_ACCOUNT_DOMAINS:32,CLONE_TYPE_ACCOUNT_CERTIFICATES:64,CLONE_TYPE_ACCOUNT_DATABASE_USERS:128,CLONE_TYPE_ACCOUNT_FTP:256,BACKUP_TYPE_ACCOUNT:1,BACKUP_TYPE_ACCOUNT_CONFIG:1,BACKUP_TYPE_ACCOUNT_HOMEDIR:2,BACKUP_TYPE_ACCOUNT_DATABASES:4,BACKUP_TYPE_ACCOUNT_EMAILS:8,BACKUP_TYPE_ACCOUNT_CRON_JOBS:16,BACKUP_TYPE_ACCOUNT_DOMAINS:32,BACKUP_TYPE_ACCOUNT_CERTIFICATES:64,BACKUP_TYPE_ACCOUNT_DATABASE_USERS:128,BACKUP_TYPE_ACCOUNT_FTP:256,BACKUP_TYPE_DIRECTORY:2,BACKUP_TYPE_DIRECTORY_FILES:1,BACKUP_TYPE_DIRECTORY_DIRS:2,BACKUP_TYPE_JB_CONFIG:3,BACKUP_TYPE_JB_CONFIG_DATABASE:1,BACKUP_TYPE_JB_CONFIG_ETC:2,BACKUP_TYPE_JB_CONFIG_VERSION:4,BACKUP_TYPE_JB_CONFIG_ACCOUNTS:8,BACKUP_TYPE_JB_CONFIG_ENCRYPTION:16,BACKUP_TYPE_JB_CONFIG_WIREDTIGER:32,BACKUP_TYPE_DR:4,BACKUP_TYPE_DR_DATABASE:1,BACKUP_TYPE_DR_ISO:2,BACKUP_TYPE_DR_FILES:4,BACKUP_STRUCTURE_INCREMENTAL:1,BACKUP_STRUCTURE_ARCHIVED:2,BACKUP_STRUCTURE_COMPRESSED:4,HOOK_POSITION_BACKUP:1,HOOK_POSITION_RESTORE:3,HOOK_POSITION_DOWNLOAD:4,HOOK_POSITION_REINDEX:5,HOOK_POSITION_SNAPSHOT:6,HOOK_POSITION_BACKUP_ACCOUNT:8,HOOK_POSITION_CLONE:9,HOOK_POSITION_CLONE_ACCOUNT:10,DATABASE_ENGINE_MYSQL:1,DATABASE_ENGINE_MONGODB:2,DATABASE_ENGINE_PGSQL:3,HOOK_TYPE_POSITION_PRE:1,HOOK_TYPE_POSITION_POST:2,TAG_TYPE_ACCOUNT:1,LOG_TYPE_BACKUP:1,LOG_TYPE_DOWNLOAD:2,LOG_TYPE_RESTORE:3,LOG_TYPE_SYSTEM:4,LOG_TYPE_REINDEX:5,LOG_TYPE_BACKUP_ON_DEMAND:6,LOG_TYPE_CLONE:7,LOG_TYPE_SECURITY:8,LOG_STATUS_COMPLETED:1,LOG_STATUS_FAILED:2,LOG_STATUS_ABORTED:3,LOG_STATUS_PARTIALLY:4,LOG_STATUS_NEVER_FINISHED:5,LOG_STATUS_PROCESSING:6,RECOMMENDED_EXCLUDES_ACCOUNT:{basic:["*.bkup","*.gz","*.jpa","*.log","*.sql","*.tar","*.tar.gz","*.wpress","*.zip","*/.wysiwygPro_*","*/backupbuddy_backups/*","*/cache/smarty/*","*/com_akeeba/backup/*","*/core.[0-9]*","*/error_log","*/var/amasty_fpc/*","*/var/backups/*","*/var/cache/*","*/var/debug/*","*/var/export/*","*/var/import/*","*/var/log/*","*/var/report/*","*/var/session/*","*/var/tmp/*","*/wp-content/cache/*","*/wp-content/wphb-cache/*","*/wp-content/uploads/wpcf7_captcha/*","*/wp-content/widget-cache/*","*/wptsc-cachedir/*",".MirrorSearch",".cpanel/*.sock",".trash","access-logs/*","backup-*.tar.gz","logs/*","public_ftp/*","public_html/cache/*","site-*.tar.gz","softaculous_backups/*","tmp/*","lscache/*"]},PATH_FILTER:/(^[^\/])|(((\/+|^)\.{2})+(\/+|$)|\/{2,})|([`:;\\!$&*()])/,PATH_FILTER_PATTERNS:/(((\/+|^)\.{2})+(\/+|$)|\/{2,})|([`:;\\!$&()])/};return t.DOCS_ADMIN_URL=t.DOCS_URL+"/adminpanel",t.DOCS_USER_URL=t.DOCS_URL+"/userpanel",t.ALERT_LEVEL_NAMES={},t.ALERT_LEVEL_NAMES[t.ALERT_LEVEL_INFO]=e.t("Information"),t.ALERT_LEVEL_NAMES[t.ALERT_LEVEL_WARNING]=e.t("Warning"),t.ALERT_LEVEL_NAMES[t.ALERT_LEVEL_CRITICAL]=e.t("Critical"),t.ALERT_LEVEL_TYPES={},t.ALERT_LEVEL_TYPES[t.ALERT_LEVEL_INFO]="information",t.ALERT_LEVEL_TYPES[t.ALERT_LEVEL_WARNING]="warning",t.ALERT_LEVEL_TYPES[t.ALERT_LEVEL_CRITICAL]="critical",t.LOG_TYPE_NAMES={},t.LOG_TYPE_NAMES[t.LOG_TYPE_BACKUP]=e.t("Backup"),t.LOG_TYPE_NAMES[t.LOG_TYPE_CLONE]=e.t("Clone"),t.LOG_TYPE_NAMES[t.LOG_TYPE_DOWNLOAD]=e.t("Download"),t.LOG_TYPE_NAMES[t.LOG_TYPE_RESTORE]=e.t("Restore"),t.LOG_TYPE_NAMES[t.LOG_TYPE_REINDEX]=e.t("Reindex"),t.LOG_TYPE_NAMES[t.LOG_TYPE_SECURITY]=e.t("Security"),t.LOG_TYPE_NAMES[t.LOG_TYPE_SYSTEM]=e.t("System"),t.LOG_TYPE_NAMES[t.LOG_TYPE_BACKUP_ON_DEMAND]=e.t("Backup on Demand"),t.LOG_STATUS_NAMES={},t.LOG_STATUS_NAMES[t.LOG_STATUS_COMPLETED]=e.t("Completed"),t.LOG_STATUS_NAMES[t.LOG_STATUS_FAILED]=e.t("Failed"),t.LOG_STATUS_NAMES[t.LOG_STATUS_ABORTED]=e.t("Aborted"),t.LOG_STATUS_NAMES[t.LOG_STATUS_PARTIALLY]=e.t("Partially Completed"),t.LOG_STATUS_NAMES[t.LOG_STATUS_NEVER_FINISHED]=e.t("Never Finished"),t.LOG_STATUS_NAMES[t.LOG_STATUS_PROCESSING]=e.t("Processing"),t.DATABASE_ENGINE_NAMES={},t.DATABASE_ENGINE_NAMES[t.DATABASE_ENGINE_MYSQL]=e.t("MySQL"),t.DATABASE_ENGINE_NAMES[t.DATABASE_ENGINE_MONGODB]=e.t("MongoDB"),t.DATABASE_ENGINE_NAMES[t.DATABASE_ENGINE_PGSQL]=e.t("PostgreSQL"),t.QUEUE_STATUS_TO_LOG={},t.QUEUE_STATUS_TO_LOG[t.QUEUE_STATUS_COMPLETED]=t.LOG_STATUS_COMPLETED,t.QUEUE_STATUS_TO_LOG[t.QUEUE_STATUS_FAILED]=t.LOG_STATUS_FAILED,t.QUEUE_STATUS_TO_LOG[t.QUEUE_STATUS_ABORTED]=t.LOG_STATUS_ABORTED,t.QUEUE_STATUS_TO_LOG[t.QUEUE_STATUS_PARTIALLY]=t.LOG_STATUS_PARTIALLY,t.QUEUE_STATUS_TO_LOG[t.QUEUE_STATUS_NEVER_FINISHED]=t.LOG_STATUS_NEVER_FINISHED,t.QUEUE_STATUS_TO_LOG[t.QUEUE_STATUS_PROCESSING]=t.LOG_STATUS_PROCESSING,t.DESTINATION_JOB_TYPE_NAMES={},t.DESTINATION_JOB_TYPE_NAMES[t.DESTINATION_JOB_TYPE_BACKUP]=e.t("Backup"),t.DESTINATION_JOB_TYPE_NAMES[t.DESTINATION_JOB_TYPE_CLONE]=e.t("Clone"),t.BACKUP_STRUCTURE_NAMES={},t.BACKUP_STRUCTURE_NAMES[t.BACKUP_STRUCTURE_INCREMENTAL]=e.t("Incremental"),t.BACKUP_STRUCTURE_NAMES[t.BACKUP_STRUCTURE_ARCHIVED]=e.t("Archived"),t.BACKUP_STRUCTURE_NAMES[t.BACKUP_STRUCTURE_COMPRESSED]=e.t("Compressed"),t.ACCOUNT_FILTER_TYPE_NAMES={},t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_ACCOUNT]=e.t("Accounts Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_ACCOUNT_TAG]=e.t("Account Tags Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_OWNEDBY]=e.t("Owned By Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_RESELLER]=e.t("Resellers Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_SUSPENSION]=e.t("Suspension Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_DISK_USAGE]=e.t("Disk Space Usage Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_INODE_USAGE]=e.t("Inodes Usage Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_PACKAGE]=e.t("Packages Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_RANGE]=e.t("Characters Range Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_REGEX]=e.t("Regular Expression Filter"),t.ACCOUNT_FILTER_TYPE_NAMES[t.ACCOUNT_FILTER_TYPE_ENCRYPTION]=e.t("Encryption Filter"),t.BACKUP_ITEMS_TEXT={},t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_CONFIG]=e.t("Panel Config"),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_HOMEDIR]=e.t("Home Dir Files"),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_DATABASES]=e.t('"%s" Database'),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_EMAILS]=e.t('"%s" Email Account'),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_CRON_JOBS]=e.t("Cron Jobs"),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_DOMAINS]=e.t('"%s" Domains'),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_CERTIFICATES]=e.t('"%s" SSL Certificate'),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_DATABASE_USERS]=e.t('"%s" Database User'),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_FTP]=e.t('"%s" FTP Account'),t.BACKUP_ITEMS_TEXT[t.BACKUP_TYPE_ACCOUNT_FULL]=e.t("Full Account"),t.BACKUP_DIRECTORY_ITEMS_TEXT={},t.BACKUP_DIRECTORY_ITEMS_TEXT[t.BACKUP_TYPE_DIRECTORY_FILES]=e.t('File "%s"'),t.BACKUP_DIRECTORY_ITEMS_TEXT[t.BACKUP_TYPE_DIRECTORY_DIRS]=e.t('Directory "%s"'),t.BACKUP_DR_ITEMS_TEXT={},t.BACKUP_DR_ITEMS_TEXT[t.BACKUP_TYPE_DR_DATABASE]=e.t('Database "%s"'),t.BACKUP_DR_ITEMS_TEXT[t.BACKUP_TYPE_DR_ISO]=e.t('ISO Image "%s"'),t.BACKUP_DR_ITEMS_TEXT[t.BACKUP_TYPE_DR_FILES]=e.t('Files "%s"'),t.BACKUP_TYPE_NAMES={},t.BACKUP_TYPE_NAMES[t.BACKUP_TYPE_ACCOUNT]=e.t("Accounts"),t.BACKUP_TYPE_NAMES[t.BACKUP_TYPE_DIRECTORY]=e.t("Directories"),t.BACKUP_TYPE_NAMES[t.BACKUP_TYPE_JB_CONFIG]=e.t("JB Config"),t.BACKUP_TYPE_NAMES[t.BACKUP_TYPE_DR]=e.t("Server Backup (BMR)"),t.BACKUP_TYPE_ACCOUNT_FULL=t.BACKUP_TYPE_ACCOUNT_CONFIG|t.BACKUP_TYPE_ACCOUNT_HOMEDIR|t.BACKUP_TYPE_ACCOUNT_DATABASES|t.BACKUP_TYPE_ACCOUNT_EMAILS|t.BACKUP_TYPE_ACCOUNT_CRON_JOBS|t.BACKUP_TYPE_ACCOUNT_DOMAINS|t.BACKUP_TYPE_ACCOUNT_CERTIFICATES|t.BACKUP_TYPE_ACCOUNT_DATABASE_USERS|t.BACKUP_TYPE_ACCOUNT_FTP,t.BACKUP_TYPE_ACCOUNT_NAMES={},t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_CONFIG]=e.t("Panel Config"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_HOMEDIR]=e.t("Home Dir Files"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_DATABASES]=e.t("Databases"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_EMAILS]=e.t("Email Accounts"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_CRON_JOBS]=e.t("Cron Jobs"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_DOMAINS]=e.t("Domains"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_CERTIFICATES]=e.t("SSL Certificates"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_DATABASE_USERS]=e.t("Database Users"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_FTP]=e.t("FTP Accounts"),t.BACKUP_TYPE_ACCOUNT_NAMES[t.BACKUP_TYPE_ACCOUNT_FULL]=e.t("Full Account"),t.CLONE_ITEMS_TEXT={},t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_CONFIG]=e.t("Panel Config"),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_HOMEDIR]=e.t("Home Dir Files"),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_DATABASES]=e.t('"%s" Database'),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_EMAILS]=e.t('"%s" Email Account'),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_CRON_JOBS]=e.t("Cron Jobs"),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_DOMAINS]=e.t('"%s" Domains'),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_CERTIFICATES]=e.t('"%s" SSL Certificate'),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_DATABASE_USERS]=e.t('"%s" Database User'),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_FTP]=e.t('"%s" FTP Account'),t.CLONE_ITEMS_TEXT[t.CLONE_TYPE_ACCOUNT_FULL]=e.t("Full Account"),t.CLONE_TYPE_NAMES={},t.CLONE_TYPE_NAMES[t.CLONE_TYPE_ACCOUNT]=e.t("Accounts"),t.CLONE_TYPE_ACCOUNT_FULL=t.CLONE_TYPE_ACCOUNT_CONFIG|t.CLONE_TYPE_ACCOUNT_HOMEDIR|t.CLONE_TYPE_ACCOUNT_DATABASES|t.CLONE_TYPE_ACCOUNT_EMAILS|t.CLONE_TYPE_ACCOUNT_CRON_JOBS|t.CLONE_TYPE_ACCOUNT_DOMAINS|t.CLONE_TYPE_ACCOUNT_CERTIFICATES|t.CLONE_TYPE_ACCOUNT_DATABASE_USERS|t.CLONE_TYPE_ACCOUNT_FTP,t.CLONE_TYPE_ACCOUNT_NAMES={},t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_CONFIG]=e.t("Panel Config"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_HOMEDIR]=e.t("Home Dir Files"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_DATABASES]=e.t("Databases"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_EMAILS]=e.t("Email Accounts"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_CRON_JOBS]=e.t("Cron Jobs"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_DOMAINS]=e.t("Domains"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_CERTIFICATES]=e.t("SSL Certificates"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_DATABASE_USERS]=e.t("Database Users"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_FTP]=e.t("FTP Accounts"),t.CLONE_TYPE_ACCOUNT_NAMES[t.CLONE_TYPE_ACCOUNT_FULL]=e.t("Full Account"),t.SCHEDULE_TYPES={},t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_HOURLY]=e.t("Hourly"),t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_DAILY]=e.t("Daily"),t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_WEEKLY]=e.t("Weekly"),t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_MONTHLY]=e.t("Monthly"),t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_BACKUP_DONE]=e.t("Backup Done"),t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_MANUALLY]=e.t("Manually"),t.SCHEDULE_TYPES[t.SCHEDULE_TYPE_SNAPSHOT]=e.t("Backup on Demand"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD={},t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_CONFIG]=e.t("Panel Config"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_HOMEDIR]=e.t("Home Dir"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_DATABASES]=e.t("DB"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_EMAILS]=e.t("Emails"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_CRON_JOBS]=e.t("Cron Jobs"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_DOMAINS]=e.t("Domains"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_CERTIFICATES]=e.t("Certificates"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_DATABASE_USERS]=e.t("DB Users"),t.BACKUP_TYPE_ACCOUNT_NAMES_WIZARD[t.BACKUP_TYPE_ACCOUNT_FTP]=e.t("FTP"),t.QUEUE_ITEM_TYPE_NAMES={},t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_BACKUP]=e.t("Backup"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_CLONE]=e.t("Clone"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_RESTORE]=e.t("Restore"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_DOWNLOAD]=e.t("Download"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_REINDEX]=e.t("Reindex"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_SECURITY]=e.t("Security"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_INTEGRITY_CHECK]=e.t("Backup Cleanup & Integrity Check"),t.QUEUE_ITEM_TYPE_NAMES[t.QUEUE_ITEM_TYPE_SNAPSHOT_DELETE]=e.t("Snapshot Cleanup"),t.SCHEDULE_DELAY_TYPE_NAMES={},t.SCHEDULE_DELAY_TYPE_NAMES[t.SCHEDULE_DELAY_TYPE_MINUTES]=e.t("minutes"),t.SCHEDULE_DELAY_TYPE_NAMES[t.SCHEDULE_DELAY_TYPE_HOURS]=e.t("hours"),t.SCHEDULE_DELAY_TYPE_NAMES[t.SCHEDULE_DELAY_TYPE_DAYS]=e.t("days"),t.QUEUE_STATUS_NAMES={},t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_PENDING]=e.t("Pending"),t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_PROCESSING]=e.t("Processing")+"...",t.QUEUE_STATUS_SUB_NAMES={},t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP]={},t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_CONFIG]=e.t("Backing up Panel Configurations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_DOMAINS]=e.t("Backing up Domains and DNS"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_CERTIFICATES]=e.t("Backing up SSL Certificates"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_FTP]=e.t("Backing up FTP Accounts"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_CRON_JOBS]=e.t("Backing up Cron Jobs"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_DATABASES]=e.t("Backing up Databases"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_DATABASE_USERS]=e.t("Backing up Database Users"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_HOMEDIR]=e.t("Backing up Home Directory files"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_EMAILS]=e.t("Backing up Email Accounts"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_ENCRYPTING]=e.t("Encrypting backup data"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_ACCOUNT_TRANSFERRING]=e.t("Transferring backup to all destinations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_DIRECTORY_ENCRYPTING]=e.t("Encrypting backup data"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_DIRECTORY_TRANSFERRING]=e.t("Transferring backup to all destinations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_ENCRYPTION_KEY]=e.t("Backing up JetBackup server Encryption Key"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_DATABASE]=e.t("Backing up JetBackup Database"),
t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_FILES]=e.t("Backing up JetBackup Files"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_ACCOUNTS_LIST]=e.t("Backing up JetBackup Accounts list"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_VERSION]=e.t("Backing up JetBackup Version"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_ENCRYPTING]=e.t("Encrypting backup data"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_JBCONFIG_TRANSFERRING]=e.t("Transferring backup to all destinations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_DR_DATABASE]=e.t("Backing up JetBackup Database"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_DR_ISO]=e.t("Creating ISO image"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_DR_ENCRYPTING]=e.t("Encrypting backup data"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_BACKUP][t.QUEUE_STATUS_BACKUP_DR_TRANSFERRING]=e.t("Transferring backup to all destinations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE]={},t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_CONFIG]=e.t("Restoring Panel Configurations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_DOMAINS]=e.t("Restoring Domains and DNS"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_CERTIFICATES]=e.t("Restoring SSL Certificates"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_FTP]=e.t("Restoring FTP Accounts"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_CRON_JOBS]=e.t("Restoring Cron Jobs"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_IMPORTING_DATABASES]=e.t("Importing databases data"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_DATABASES]=e.t("Restoring Databases"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_DATABASE_USERS]=e.t("Restoring Database Users"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_HOMEDIR]=e.t("Restoring Home Directory files"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_EMAILS]=e.t("Restoring Email Accounts"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_POST_RESTORE]=e.t("Performing post restore actions"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_ACCOUNT_PRE_RESTORE]=e.t("Performing pre restore actions"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_DIRECTORY_FILES]=e.t("Downloading files"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_JBCONFIG_DOWNLOADING]=e.t("Downloading backup"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_JBCONFIG_EXTRACT]=e.t("Extracting backup from archive"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_JBCONFIG_DATABASE]=e.t("Restoring JetBackup database"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_JBCONFIG_PLUGINS]=e.t("Installing Plugins"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_RESTORE][t.QUEUE_STATUS_RESTORE_JBCONFIG_CONFIGS]=e.t("Restoring JetBackup configuration files"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_CLONE]={},t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_CLONE][t.QUEUE_STATUS_CLONE_ACCOUNT_PACKAGE]=e.t("Packaging account databases and information"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_CLONE][t.QUEUE_STATUS_CLONE_ACCOUNT_CLONING]=e.t("Cloning to all destinations"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_DOWNLOAD]={},t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_DOWNLOAD][t.QUEUE_STATUS_DOWNLOAD_DOWNLOADING]=e.t("Downloading backup"),t.QUEUE_STATUS_SUB_NAMES[t.QUEUE_ITEM_TYPE_DOWNLOAD][t.QUEUE_STATUS_DOWNLOAD_ARCHIVE]=e.t("Compressing backup to archive"),t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_COMPLETED]=e.t("Completed"),t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_PARTIALLY]=e.t("Partially Completed"),t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_FAILED]=e.t("Failed"),t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_ABORTED]=e.t("Aborted"),t.QUEUE_STATUS_NAMES[t.QUEUE_STATUS_NEVER_FINISHED]=e.t("Never Finished"),t.SCHEDULE_WEEK_DAYS_NAMES={},t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_SUNDAY]=e.t("Sunday"),t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_MONDAY]=e.t("Monday"),t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_TUESDAY]=e.t("Tuesday"),t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_WEDNESDAY]=e.t("Wednesday"),t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_THURSDAY]=e.t("Thursday"),t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_FRIDAY]=e.t("Friday"),t.SCHEDULE_WEEK_DAYS_NAMES[t.SCHEDULE_WEEK_DAYS_SATURDAY]=e.t("Saturday"),t.FILE_PERMISSIONS_CATEGORIES={},t.FILE_PERMISSIONS_CATEGORIES[t.FILE_PERMISSIONS_CATEGORY_HOMEDIR_DATA]=e.t("Homedir Data"),t.FILE_PERMISSIONS_CATEGORIES[t.FILE_PERMISSIONS_CATEGORY_EMAIL_DATA]=e.t("Email Data"),t.FILE_PERMISSIONS_CATEGORIES[t.FILE_PERMISSIONS_CATEGORY_FILESYSTEM_DATA]=e.t("Filesystem Data"),t.PLUGIN_PERMISSION_RESELLER=t.PLUGIN_PERMISSION_ROOT|t.PLUGIN_PERMISSION_RESELLER,t.PLUGIN_PERMISSION_USER=t.PLUGIN_PERMISSION_ROOT|t.PLUGIN_PERMISSION_RESELLER|t.PLUGIN_PERMISSION_USER,t.BACKUP_TYPE_DIRECTORY_FULL=t.BACKUP_TYPE_DIRECTORY_FILES|t.BACKUP_TYPE_DIRECTORY_DIRS,t.BACKUP_TYPE_DIRECTORY_NAMES={},t.BACKUP_TYPE_DIRECTORY_NAMES[t.BACKUP_TYPE_DIRECTORY_FILES]=e.t("Directories (File)"),t.BACKUP_TYPE_DIRECTORY_NAMES[t.BACKUP_TYPE_DIRECTORY_DIRS]=e.t("Directories (Directory)"),t.BACKUP_TYPE_DIRECTORY_NAMES[t.BACKUP_TYPE_DIRECTORY_FULL]=e.t("Directories"),t.BACKUP_TYPE_JB_CONFIG_FULL=t.BACKUP_TYPE_JB_CONFIG_DATABASE|t.BACKUP_TYPE_JB_CONFIG_ETC|t.BACKUP_TYPE_JB_CONFIG_VERSION|t.BACKUP_TYPE_JB_CONFIG_ACCOUNTS|t.BACKUP_TYPE_JB_CONFIG_ENCRYPTION|t.BACKUP_TYPE_JB_CONFIG_WIREDTIGER,t.BACKUP_TYPE_JB_CONFIG_NAMES={},t.BACKUP_TYPE_JB_CONFIG_NAMES[t.BACKUP_TYPE_JB_CONFIG_DATABASE]=e.t("Database"),t.BACKUP_TYPE_JB_CONFIG_NAMES[t.BACKUP_TYPE_JB_CONFIG_ETC]=e.t("ETC Directory"),t.BACKUP_TYPE_JB_CONFIG_NAMES[t.BACKUP_TYPE_JB_CONFIG_VERSION]=e.t("Version File"),t.BACKUP_TYPE_JB_CONFIG_NAMES[t.BACKUP_TYPE_JB_CONFIG_ACCOUNTS]=e.t("Active Accounts"),t.BACKUP_TYPE_JB_CONFIG_NAMES[t.BACKUP_TYPE_JB_CONFIG_ENCRYPTION]=e.t("Encryption Key"),t.BACKUP_TYPE_JB_CONFIG_NAMES[t.BACKUP_TYPE_JB_CONFIG_FULL]=e.t("JB Config"),t.BACKUP_TYPE_DR_FULL=t.BACKUP_TYPE_DR_DATABASE|t.BACKUP_TYPE_DR_ISO|t.BACKUP_TYPE_DR_FILES,t.BACKUP_TYPE_DR_NAMES={},t.BACKUP_TYPE_DR_NAMES[t.BACKUP_TYPE_DR_DATABASE]=e.t("Database"),t.BACKUP_TYPE_DR_NAMES[t.BACKUP_TYPE_DR_ISO]=e.t("ISO image"),t.BACKUP_TYPE_DR_NAMES[t.BACKUP_TYPE_DR_FILES]=e.t("Files"),t.BACKUP_TYPE_DR_NAMES[t.BACKUP_TYPE_DR_FULL]=e.t("Server Backup (BMR)"),t.BACKUP_ALLOW_LEGACY_DESTINATION={},t.BACKUP_ALLOW_LEGACY_DESTINATION[t.BACKUP_TYPE_ACCOUNT]=!0,t.BACKUP_ALLOW_LEGACY_DESTINATION[t.BACKUP_TYPE_DIRECTORY]=!0,t.BACKUP_ALLOW_LEGACY_DESTINATION[t.BACKUP_TYPE_JB_CONFIG]=!0,t.BACKUP_ALLOW_LEGACY_DESTINATION[t.BACKUP_TYPE_DR]=!1,t.BACKUP_ALLOW_LOCAL_DESTINATION={},t.BACKUP_ALLOW_LOCAL_DESTINATION[t.BACKUP_TYPE_ACCOUNT]=!0,t.BACKUP_ALLOW_LOCAL_DESTINATION[t.BACKUP_TYPE_DIRECTORY]=!0,t.BACKUP_ALLOW_LOCAL_DESTINATION[t.BACKUP_TYPE_JB_CONFIG]=!0,t.BACKUP_ALLOW_LOCAL_DESTINATION[t.BACKUP_TYPE_DR]=!1,t}])}),define("services/util",["app"],function(e){e.factory("util",[function(){var e=function(){return{getChanges:function(e,t,n,a){if(void 0===e||void 0===t)return{};if(!this.isObject(e)||!this.isObject(t))throw"Invalid argument. Function given, object expected.";var i={};for(var s in t)void 0!==n&&n.indexOf(s)>=0||("_id"===s||void 0!==a&&"function"==typeof a&&a(s)?i[s]=t[s]:this.changedValue(e[s],t[s])&&(i[s]=t[s]));return i},isChanged:function(e,t,n){if(void 0===e||void 0===t)return!1;if(!this.isObject(e)||!this.isObject(t))throw"Invalid argument. Function given, object expected.";for(var a in t)if(!(void 0!==n&&n.indexOf(a)>=0)&&this.changedValue(e[a],t[a]))return!0;return!1},changedValue:function(e,t){if(this.isFunction(e)||this.isFunction(t))throw"Invalid argument. Function given, object expected.";if(this.isValue(t))return!/^object:[0-9]+$/.test(t)&&e!==t;var n={};for(var a in t)if(n[a]=1,!this.isFunction(t[a])){if(void 0===e||void 0===e[a])return!0;if(this.changedValue(e[a],t[a]))return!0}for(var i in e)if(!n[i])return!0;return!1},isFunction:function(e){return"[object Function]"==={}.toString.apply(e)},isArray:function(e){return"[object Array]"==={}.toString.apply(e)},isObject:function(e){return"[object Object]"==={}.toString.apply(e)},isDate:function(e){return"[object Date]"==={}.toString.apply(e)},isValue:function(e){return!this.isObject(e)&&!this.isArray(e)}}}();return{sizeToHumanReadable:function(e,t,n){return(this.sizeToNumber(e,t,n)+" "+this.sizeToType(e,t)).trim()},sizeToNumber:function(e,t,n){void 0===t&&(t=!1),void 0===n&&(n=2);var a=t?1e3:1024;if(e<a)return e;var i=parseInt(Math.log(e)/Math.log(a));return(e/Math.pow(a,i)).toFixed(n)},sizeToType:function(e,t){void 0===t&&(t=!1);var n=t?1e3:1024;if(e<n)return"B";var a=parseInt(Math.log(e)/Math.log(n));return(t?"kMGTPE":"KMGTPE")[a-1]+"B"},copyToClipboard:function(e){var t=document.createElement("textarea");t.style.position="fixed",t.style.opacity="0",t.textContent=e;var n=document.getElementsByTagName("body")[0];n.appendChild(t),t.select(),document.execCommand("copy"),n.removeChild(t)},countObj:function(e){var t=0;for(var n in e)t++;return t},saveParams:function(t,n,a,i){return e.getChanges(n,t,a,i)},duplicateObject:function(e){return JSON.parse(JSON.stringify(e))},isChanged:function(t,n,a){return e.isChanged(n,t,a)},sleep:function(e){const t=Date.now();var n=null;do{n=Date.now()}while(n-t<e)},versionCompare:function(e,t,n){function a(e){return(i?/^\d+[A-Za-z]*$/:/^\d+$/).test(e)}e=e.replace("-","."),t=t.replace("-",".");var i=n&&n.lexicographical,s=n&&n.zeroExtend,o=e.split("."),c=t.split(".");if(!o.every(a)||!c.every(a))return NaN;if(s){for(;o.length<c.length;)o.push("0");for(;c.length<o.length;)c.push("0")}i||(o=o.map(Number),c=c.map(Number));for(var r=0;r<o.length;++r){if(c.length==r)return 1;if(o[r]!=c[r])return o[r]>c[r]?1:-1}return o.length!=c.length?-1:0}}}])}),define("services/filterManager",["app"],function(e){e.factory("filterManager",function(){return{buildFilters:function(e){for(var t=[],n=0,a=0;a<e.length;a++)void 0!==e[a].cond&&1===e[a].cond&&n++,void 0===t[n]&&(t[n]=[]),t[n].push(e[a]._id);return t},reBuildStructure:function(e){for(var t=[],n=0;n<e.length;n++)for(var a=0;a<e[n].length;a++){var i={_id:e[n][a]};0==n&&0==a||(i.cond=0==a?1:2),t.push(i)}return t},removeFilter:function(e,t){return e.splice(t,1),0===t&&void 0!==e[0]&&delete e[0].cond,e}}})}),define("services/pathManager",["app"],function(e){e.factory("pathManager",[function(){var e=function(e){this._init(e)};return e.prototype={_tree:{},_init:function(e){if(this._tree={},void 0!==e)for(var t=0;t<e.length;t++)this.addPath(e[t])},_getCurrent:function(e){for(var t=e.split("/"),n=this.getTree();t.length;){var a=t.shift();if(a){if(void 0===n[a])return!1;n=n[a]}}return n},_countObj:function(e){var t=0;for(var n in e)t++;return t},isExists:function(e){if(!this._countObj(this.getTree()))return!1;var t=this._getCurrent(e);return!!t&&!this._countObj(t)},isParent:function(e){if(!this._countObj(this.getTree()))return!1;var t=this._getCurrent(e);return!!t&&!!this._countObj(t)},isChildren:function(e){if(!this._countObj(this.getTree()))return!1;for(var t=e.split("/"),n=this.getTree();t.length;){var a=t.shift();if(a){if(void 0===n[a])return!this._countObj(n);n=n[a]}}return!1},addPath:function(e){for(var t=e.split("/"),n=this.getTree();t.length;){var a=t.shift();a&&(void 0===n[a]&&(n[a]={}),n=n[a])}for(var i in n)delete n[i]},removePath:function(e){for(var t=e.split("/"),n=this.getTree(),a=[];t.length;){var i=t.shift();if(i){if(void 0===n[i])return!1;a.push({instance:n,name:i}),n=n[i]}}if(a.length){var s=a.pop();for(delete s.instance[s.name];a.length;){if(s=a.pop(),this._countObj(s.instance[s.name])>0)return;delete s.instance[s.name]}}},getSelected:function(){for(var e=[],t=this.getTree(),n=[{path:"",obj:t}];n.length;){var a=n.shift();for(var i in a.obj){var s=a.path+"/"+i;this._countObj(a.obj[i])?n.push({path:s,obj:a.obj[i]}):e.push(s)}}return e},getTree:function(){return this._tree}},{new:function(t){return new e(t)}}}])}),define("directives/pagination",["app"],function(e,t){e.directive("pagination",[function(){return{template:'<div class="row search-page-container">\n        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">\n            <p ng-show="meta.showItemCountText()">{{ meta.getItemCountText() }}</p>\n        </div>\n        <div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">\n            <div class="pagination-container hidden-xs hidden-sm">\n                <page-size id="table_items_per_page"\n                        allowed-sizes="meta.getPageSizes()"\n                        total-items="meta.getTotalItems()"\n                        ng-model="pageSize"\n                        show-all="false"\n                        ng-show="!hidePageSize && meta.showPagination()">\n                </page-size>\n                <ul uib-pagination id="table_paginate"\n                        total-items="meta.getTotalItems()"\n                        ng-model="currentPage"\n                        max-size="meta.getMaxPages()"\n                        boundary-links="false"\n                        direction-links="true"\n                        rotate="false"\n                        previous-text="<"\n                        next-text=">"\n                        items-per-page="meta.getPageSize()"\n                        ng-show="meta.showPagination()">\n                </ul>\n            </div>\n        </div>\n    </div>\n    <div class="row hidden-md hidden-lg">\n        <div class="col-xs-12">\n            <p class="text-right" ng-show="meta.showItemCountText()">{{ meta.getItemCountText() }}</p>\n        </div>\n    </div>\n    <div class="row search-page-container visible-xs-block visible-sm-block hidden-md hidden-lg">\n        <div class="col-xs-12 col-sm-12">\n            <div class="pagination-container">\n                <filter-box id="table_filter_mobile"\n                        box-options="filterOptions"\n                        ng-model="filter"\n                        ng-change="fetch()">\n                </filter-box>\n                <page-size id="table_items_per_page_mobile"\n                        allowed-sizes="meta.getPageSizes()"\n                        total-items="meta.getTotalItems()"\n                        ng-model="pageSize"\n                        show-all="false"\n                        ng-show="!hidePageSize && meta.showPagination()">\n                </page-size>\n                <ul uib-pagination id="table_paginate_mobile"\n                        total-items="meta.getTotalItems()"\n                        ng-model="currentPage"\n                        max-size="0"\n                        boundary-links="false"\n                        direction-links="true"\n                        rotate="false"\n                        previous-text="<"\n                        next-text=">"\n                        items-per-page="meta.getPageSize()"\n                        ng-show="meta.showPagination()"\n                        class="pagination-small">\n                </ul>\n            </div>\n        </div>\n    </div>',scope:{meta:"=",fetch:"=",hidePageSize:"="},link:function(e){e.currentPage=e.meta.getCurrentPage(),e.pageSize=e.meta.getPageSize(),e.meta.onChange(function(){e.currentPage=e.meta.getCurrentPage(),e.pageSize=e.meta.getPageSize()}),e.$watch("currentPage",function(t,n){t!==n&&(e.meta.setCurrentPage(e.currentPage),e.meta.getTotalItems()>e.meta.getSkip()&&e.fetch())}),e.$watch("pageSize",function(t,n){t!==n&&(e.meta.setPageSize(e.pageSize),e.meta.getTotalItems()>e.meta.getSkip()&&e.fetch())})}}}])}),define("directives/filterBox",["app"],function(e){e.directive("filterBox",["$parse","lang",function(e,t){return{restrict:"EA",template:'<div ng-hide="!boxOptions[0]" class="input-group" >\n        <span class="input-group-addon">{{filterTitle}}</span>        <select id="{{parentID}}_select"\n            class="form-control"\n            ng-options="filterOpt.value as filterOpt.label for filterOpt in boxOptions"\n            ng-model="filter">\n        </select>\n</div>',require:"ngModel",replace:!0,scope:{parentID:"@id",filterTitle:"@",boxOptions:"=boxOptions"},link:function(e,n,a,i){i&&(i.$render=function(){void 0===e.filterTitle&&(e.filterTitle=t.t("Filter")),e.filter=i.$viewValue},e.$watch("filter",function(t,n){t!==n&&i.$setViewValue(e.filter)}))}}}])}),define("directives/validateField",["app"],function(e){e.directive("validateField",["$parse","lang",function(e,t){return{restrict:"A",require:"ngModel",replace:!1,scope:{min:"@",max:"@",regex:"@",ngModel:"="},link:function(e,t,n,a){if(a){var i=function(e){e.css({borderColor:"#cc0000"}),setTimeout(function(){e.css({borderColor:"inherit"})},2e3)};e.$watch(function(){return a.$modelValue},function(t){e.oldValue=t}),t.on("blur",function(){if(e.newValue=a.$viewValue,""!==e.newValue){switch(n.validateField){case"int":e.newValue=parseInt(e.newValue),void 0!==e.min&&e.newValue<parseInt(e.min)&&(e.newValue=parseInt(e.min)),void 0!==e.max&&e.newValue>parseInt(e.max)&&(e.newValue=parseInt(e.max));break;case"float":e.newValue=parseFloat(e.newValue),void 0!==e.min&&e.newValue<parseFloat(e.min)&&(e.newValue=parseFloat(e.min)),void 0!==e.max&&e.newValue>parseFloat(e.max)&&(e.newValue=parseFloat(e.max));break;case"str":new RegExp(e.regex).test(e.newValue)||(e.newValue=""),void 0!==e.max&&e.newValue.length>parseInt(e.max)&&(e.newValue=e.newValue.substr(0,parseInt(e.max)));break;case"path":var s=new RegExp(/^(\/[\w\s\d.-]+)+\/?$/);s.test(e.newValue)||(e.newValue="");break;case"color":var s=new RegExp(/^#[a-fA-F0-9]{3}(?:[a-fA-F0-9]{3})?$/);s.test(e.newValue)||(e.newValue="");break;case"binary":var s=new RegExp(/^((\/[\w\s\d]+)+\/?|[\w]+)$/);s.test(e.newValue)||(e.newValue="");break;case"email":var s=new RegExp(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);s.test(e.newValue)||(e.newValue="")}e.oldValue!=e.newValue&&(i(t),a.$setViewValue(e.newValue),a.$render())}})}}}}])}),define("directives/inputDropdown",["app"],function(e){e.directive("inputDropdown",["$parse","lang",function(e,t){return{restrict:"E",template:'<div class="input-group">        <span ng-show="prefix" class="input-group-addon">{{prefixLang}}</span>        <select class="form-control"            ng-options="value.key as value.label for value in values"            ng-model="input">        </select>        <span ng-show="input == \'CUSTOM\'" class="input-group-addon">-</span>\t\t <span ng-show="input == \'CUSTOM\'" ng-transclude></span>        <span class="input-group-addon">{{addonLang}}</span></div>',require:"ngModel",transclude:!0,replace:!0,scope:{addon:"@",prefix:"@",options:"=",ngModel:"="},link:function(e,n,a,i,s){i&&(e.addonLang=e.addon?e.addon:"",e.prefixLang=e.prefix?e.prefix:"",e.values=[],Object.keys(e.options).sort(function(e,t){return e-t}).forEach(function(t){var n=t;n==parseInt(n)&&(n=parseInt(n)),e.values.push({key:n,label:e.options[t]})}),e.values.push({key:"CUSTOM",label:t.t("Custom")}),i.$render=function(){e.input=i.$viewValue;for(var t in e.options)if(t==parseInt(t)&&(t=parseInt(t)),t===e.input)return;e.input="CUSTOM"},e.$watch("input",function(t,n){t!==n&&"CUSTOM"!==t&&i.$setViewValue(e.input)}))}}}])}),define("directives/pageSize",["app"],function(e){e.directive("pageSize",["$parse","pageSizeConfig","lang",function(e,t,n){var a=-1;return{restrict:"EA",template:'<div class="page-size">\n    <div ng-hide="autoHide && options[0].value >= totalItems" class="form-group" >\n        <label for="{{parentID}}_select" class="title">{{pageSizeTitle}}</label>\n        <select id="{{parentID}}_select"\n            class="form-control"\n            ng-options="size.value as size.label for size in options"\n            ng-model="pageSize">\n        </select>\n    </div>\n</div>',require:"ngModel",replace:!0,scope:{parentID:"@id",totalItems:"=",allowedSizes:"=",showAll:"=",autoHide:"="},link:function(i,s,o,c){function r(){var e={};e.allowedSizes=i.allowedSizes||t.allowedSizes,e.totalItems=i.totalItems||t.totalItems,e.showAllItems=i.showAll,i.showAll&&(a=i.totalItems||-1);var s=e.allowedSizes.slice(0);return s.sort(function(e,t){return e-t}),s=s.map(function(e){return{label:e,value:e}}),e.showAllItems&&s.push({label:n.t("All"),value:a}),1===s.length&&s[0].value===e.totalItems?i.pageSize=s[0].value:0===s.filter(function(e){return e.value===i.pageSize}).length&&(i.pageSize=s[0].value),s}c&&(o.allowedSizes&&i.$parent.$watch(e(o.allowedSizes),function(){i.options=r()}),o.totalItems&&i.$parent.$watch(e(o.totalItems),function(){i.options=r()}),o.showAll&&i.$parent.$watch(e(o.showAll),function(){i.options=r()}),c.$render=function(){i.pageSizeTitle=n.t("Page Size"),i.pageSize=c.$viewValue},i.$watch("pageSize",function(e,t){e!==t&&e&&c.$setViewValue(i.pageSize)}),i.$watch("totalItems",function(){i.options=r()}),i.options=r())}}}]),e.constant("pageSizeConfig",{allowedSizes:[10,20,50,100],totalItems:0,showAllItems:!1})}),define("directives/loadingBox",["app"],function(e){e.directive("loadingBox",function(){return{restrict:"E",transclude:!0,template:'<div class="alert alert-info"><em class="fas fa-cog fa-spin"></em> <span ng-transclude></span></div>'}})}),define("directives/tooltip",["app"],function(e){e.directive("tooltip",["$sce","$compile","lang",function(e,t,n){return{restrict:"A",replace:!1,terminal:!0,priority:1e3,link:function(a,i,s){var o=s.tooltip,c=/^(top|top-left|top-right|bottom|bottom-left|bottom-right|left|left-top|left-bottom|right|right-top|right-bottom)\|(.*)$/;if(c.test(o)){var r=o.match(c);i.attr("tooltip-placement",r[1]),o=r[2]}if(c=/^\{\{(.*)\}\}$/,c.test(o)){r=o.match(c),r=r[1].split("."),o=a;for(var l=0;l<r.length;l++)void 0!==o&&(o=o[r[l]])}if(i.removeAttr("tooltip"),!o)return void t(i)(a);void 0===a.contentHTML&&(a.contentHTML=[]);var u=a.contentHTML.length;a.contentHTML[u]=e.trustAsHtml("<div style='padding: 5px;'>"+n.t(o)+"</div>"),i.attr("uib-tooltip-html","contentHTML["+u+"]"),t(i)(a)}}}])}),define("directives/sortBy",["app"],function(e){e.directive("sortBy",["lang",function(e){var t=e.t("Ascending"),n=e.t("Descending");return{template:'<button class="sort-link" ng-click="sort(sortValue)">\n    <span ng-transclude></span>\n    <span ng-hide="sortMeta.getSortBy() !== sortField">\n        <i class="fas" ng-class="{true: \'fa-sort-up\', false: \'fa-sort-down\'}[sortMeta.getSortDirection() == \'asc\']"\n           ng-attr-title="{{ getTitle() }}"></i>\n    </span>\n</button>',restrict:"EA",transclude:!0,replace:!0,scope:{sortMeta:"=",sortType:"@",sortField:"@",sortReverse:"@",sortAscendingTitle:"@",sortDescendingTitle:"@",sortReverseDefault:"@",onsort:"&"},compile:function(e,a){return a.sortAscendingTitle||(a.sortAscendingTitle=t),a.sortDescendingTitle||(a.sortDescendingTitle=n),function(e,t,n){e.getTitle=function(){return"asc"===e.sortMeta.getSortDirection()?n.sortAscendingTitle:n.sortDescendingTitle},e.sort=function(){var t=e.sortMeta;t.getSortBy()===e.sortField?t.setSortDirection("asc"===t.getSortDirection()?"desc":"asc"):(t.setSortBy(e.sortField),t.setSortDirection("asc"));var n=e.onsort();angular.isFunction(n)&&n(t)}}}}}])}),define("directives/search",["app"],function(e){e.directive("search",["lang",function(e){return{restrict:"E",template:'<div class="input-group">\n    <input type="text"\n        id="{{parentID}}_input"\n        class="form-control"\n        placeholder="{{placeholder}}"\n        title="{{title}}"\n        ng-model="filterText"\n        ng-keyup="clear($event)"\n        ng-debounce\n        prevent-default-on-enter\n        auto-focus="{{autofocus}}"\n        aria-label="'+e.t("Search")+'"/>\n    <span class="input-group-btn">\n        <button id="{{parentID}}_submit_btn"\n            class="btn btn-default"\n            ng-click="filterText=\'\'"\n            type="button"\n            ng-attr-aria-label="{{ !filterText ? ariaLabelSearch : ariaLabelClear }}">\n            <span class="fas"\n                ng-class="{ \'fa-search\' : !filterText, \'fa-times\' :filterText  }"\n                aria-hidden="true">\n            </span>\n        </button>\n    </span>\n</div>',require:"ngModel",replace:!0,scope:{parentID:"@id",placeholder:"@?placeholder",autofocus:"@?autofocus",title:"@?title"},compile:function(){return{pre:function(t,n,a){angular.isUndefined(a.placeholder)&&(a.placeholder=e.t("Search")),angular.isUndefined(a.title)&&(a.title=e.t("Search")),angular.isUndefined(a.autofocus)?a.autofocus=!1:a.autofocus=!0,t.autofocus=a.autofocus,t.placeholder=a.placeholder,t.title=a.title,t.ariaLabelSearch=e.t("Search"),t.ariaLabelClear=e.t("Clear")},post:function(e,t,n,a){var i=a;if(i){i.$render=function(){e.filterText=i.$viewValue},e.clear=function(t){27===t.keyCode&&(e.filterText="")};var s=null;e.$watch("filterText",function(){null!==s&&clearTimeout(s),s=setTimeout(function(){i.$setViewValue(e.filterText)},300)})}}}}}}])}),define("directives/alertBox",["app"],function(e){e.directive("alertBox",["$timeout","$compile","lang",function(e,t,n){var a=0,i=[{name:"errorLabel",defaultText:n.t("Error:")},{name:"warnLabel",defaultText:n.t("Warning:")},{name:"infoLabel",defaultText:n.t("Information:")},{name:"successLabel",defaultText:n.t("Success:")},{name:"moreLabel",defaultText:n.t("What went wrong?")}],s=function(e,t,n){var i={};if(e)if(angular.isString(n))i.message=n;else{if(!angular.isObject(n))throw new TypeError("ngModel must be a string or object.");angular.copy(n,i)}if(angular.isDefined(i.type)||(angular.isDefined(t.type)&&t.type?i.type=t.type:i.type="warning"),angular.isDefined(i.closable)?i.closable="danger"!==i.type&&i.closable:angular.isDefined(t.closable)?i.closable="danger"!==i.type:i.closable=!1,angular.isDefined(i.autoClose)?i.autoClose="danger"!==i.type&&i.autoClose:angular.isDefined(t.autoClose)?i.autoClose="danger"!==i.type&&i.autoClose:i.autoClose=!1,angular.isDefined(i.id)||(angular.isDefined(t.id)?i.id=t.id:i.id="alert"+a++),e&&!angular.isDefined(i.message)&&!i.message)throw new Error("No message provided in the model's message property.");return i},o=function(e,t,n){var a=e.alert.type,i=t[0].querySelector(".alert-"+a),s=i.querySelector(".alert-body");n(function(e){angular.element(s).append(e)})};return{restrict:"EA",template:"<div>\n    <div ng-show=\"alert.type === 'danger'\" class='alert alert-danger ng-hide'>\n        <button id=\"{{'btnClose_danger_' + alert.id}}\" type='button' class='close' ng-if='alert.closeable' ng-click='runClose()'>&times;</button>\n        <button id=\"{{'btnMore_danger_' + alert.id}}\" type='button' class='btn btn-more btn-link pull-right flip' ng-if='hasToggleHandler' ng-click='runToggleMore()'>{{moreLabel}}</button>\n        <div class='alert-message'>\n        <span class='fas fa-times-circle'></span>\n            <strong class=\"alert-title\" ng-show=\"errorLabel\">{{errorLabel}}</strong>\n            <span class=\"alert-body\"><span id=\"{{'txtMessage_danger_' + alert.id}}\" ng-bind-html=\"alert.message\" ng-if=\"alert && alert.message\"></span></span>\n            <ul ng-if=\"alert.list && alert.list.length\" class=\"alert-list\">\n                <li ng-repeat=\"value in alert.list\">\n                    <span id=\"{{'txtList_danger_' + alert.id + '_' + $index}}\" ng-bind-html=\"value\"></span>\n                </li>\n            </ul>\n        </div>\n    </div>\n\n    <div ng-show=\"alert.type === 'info'\" class='alert alert-info ng-hide'>\n        <button id=\"{{'btnClose_info_' + alert.id}}\" type='button' class='close' ng-if='alert.closeable' ng-click='runClose()'>&times;</button>\n        <button id=\"{{'btnMore_info_' + alert.id}}\" type='button' class='btn btn-more btn-link pull-right flip' ng-if='hasToggleHandler' ng-click='runToggleMore()'>{{moreLabel}}</button>\n        <div class='alert-message'>\n        <span class='fas fa-info-circle'></span>\n            <strong class=\"alert-title\" ng-show=\"infoLabel\">{{infoLabel}}</strong>\n            <span class=\"alert-body\"><span id=\"{{'txtMessage_info_' + alert.id}}\" ng-bind-html=\"alert.message\" ng-if=\"alert && alert.message\"></span></span>\n            <ul ng-if=\"alert.list && alert.list.length\" class=\"alert-list\">\n                <li ng-repeat=\"value in alert.list\">\n                    <span id=\"{{'txtList_info_' + alert.id + '_' + $index}}\" ng-bind-html=\"value\"></span>\n                </li>\n            </ul>\n        </div>\n    </div>\n\n    <div ng-show=\"alert.type === 'success'\" class='alert alert-success ng-hide'>\n        <button id=\"{{'btnClose_success_' + alert.id}}\" type='button' class='close' ng-if='alert.closeable' ng-click='runClose()'>&times;</button>\n        <button id=\"{{'btnMore_success_' + alert.id}}\" type='button' class='btn btn-more btn-link pull-right flip' ng-if='hasToggleHandler' ng-click='runToggleMore()'>{{moreLabel}}</button>\n        <div class='alert-message'>\n        <span class='fas fa-check-circle'></span>\n            <strong class=\"alert-title\" ng-show=\"successLabel\">{{successLabel}}</strong>\n            <span class=\"alert-body\"><span id=\"{{'txtMessage_success_' + alert.id}}\" ng-bind-html=\"alert.message\" ng-if=\"alert && alert.message\"></span></span>\n            <ul ng-if=\"alert.list && alert.list.length\" class=\"alert-list\">\n                <li ng-repeat=\"value in alert.list\">\n                    <span id=\"{{'txtList_success_' + alert.id + '_' + $index}}\" ng-bind-html=\"value\"></span>\n                </li>\n            </ul>\n        </div>\n    </div>\n\n    <div ng-show=\"alert.type === 'warning'\" class='alert alert-warning ng-hide'>\n        <button id=\"{{'btnClose_warning_' + alert.id}}\" type='button' class='close' ng-if='alert.closeable' ng-click='runClose()'>&times;</button>\n        <button id=\"{{'btnMore_warning_' + alert.id}}\" type='button' class='btn btn-more btn-link pull-right flip' ng-if='hasToggleHandler' ng-click='runToggleMore()'>{{moreLabel}}</button>\n        <div class='alert-message'>\n        <span class='fas fa-exclamation-circle'></span>\n"+'            <strong class="alert-title" ng-show="warnLabel">{{warnLabel}}</strong>\n            <span class="alert-body"><span id="{{\'txtMessage_warning_\' + alert.id}}" ng-bind-html="alert.message" ng-if="alert && alert.message"></span></span>\n            <ul ng-if="alert.list && alert.list.length" class="alert-list">\n                <li ng-repeat="value in alert.list">\n                    <span id="{{\'txtList_warning_\' + alert.id + \'_\' + $index}}" ng-bind-html="value"></span>\n                </li>\n            </ul>\n        </div>\n    </div>\n</div>',transclude:!0,replace:!0,require:"?ngModel",scope:{close:"&onClose",toggleMore:"&onToggleMore",autoClose:"=",errorLabel:"@",warnLabel:"@",infoLabel:"@",successLabel:"@",moreLabel:"@"},compile:function(t,n){return i.forEach(function(e){angular.isDefined(n[e.name])||(n[e.name]=e.defaultText)}),function(t,n,a,c,r){c?(c.$formatters.push(function(e){return s(!0,a,e)}),c.$render=function(){t.alert=c.$viewValue}):(t.alert=s(!1,a),o(t,n,r)),t.$watch("alert.label",function(e){angular.isDefined(e)&&i.forEach(function(t){a.$set(t.name,e)})}),t.runClose=function(){if(t.timer){var n=t.timer;t.timer=null,delete t.timer,e.cancel(n)}t.$emit("closeAlertCalled",{id:t.alert.id}),t.alert.type=""};var l=t.autoClose?parseInt(t.autoClose,10):null;l&&!isNaN(l)&&(t.timer=e(function(){t.runClose()
},l)),t.hasToggleHandler=angular.isDefined(a.onToggleMore),t.showMore=!1,t.runToggleMore=function(){t.showMore=!t.showMore;var e={id:t.alert.id,show:t.showMore};t.$emit("toggleMoreAlertCalled",e),t.toggleMore(e)}}}}}])}),define("directives/navigation",["app"],function(e){e.directive("navigation",["$rootScope","$location","lang","permissions",function(e,t,n,a){return{template:'<li aria-label="{{ option.label }}" ng-repeat="option in options" ng-if="option.permissions" ng-class="{ \'active\': active == option.class }" > <a href="{{url}}{{option.href}}" ng-click="changePath(option.href)" tooltip-placement="right" tooltip-enable="collapsed" uib-tooltip="{{ option.label }}" > <em aria-hidden="true" class="{{ option.icon }}"></em><span>{{ option.label }}</span></a></li>',scope:{collapsed:"=",active:"="},link:function(i){window.PAGE.account;i.changePath=function(e){t.path(e)},i.url=e.primaryURL,i.options=[{label:n.t("Dashboard"),href:"/",class:"Dashboard",icon:"fas fa-home",permissions:!0},{label:n.t("Accounts"),href:"/accounts",class:"Accounts",icon:"fas fa-users",permissions:!a.isEnduser&&a.canManageAccounts},{label:n.t("Destinations"),href:"/destinations",class:"Destinations",icon:"fas fa-folder",permissions:!a.isEnduser&&a.canManageDestinations},{label:n.t("Backup Jobs"),href:"/backupJobs",class:"BackupJobs",icon:"fas fa-cubes",permissions:!a.isEnduser&&a.canManageBackupJobs},{label:n.t("Clone Jobs"),href:"/cloneJobs",class:"CloneJobs",icon:"fas fa-clone",permissions:!a.isEnduser&&a.canManageCloneJobs},{label:n.t("Restore & Download"),href:"/restore"+(a.isEnduser?"/full":"/singleaccount"),class:"Restore",icon:"fas fa-sync",permissions:a.canManageAccountBackups},{label:n.t("Downloads"),href:"/downloads",class:"Downloads",icon:"fas fa-cloud-download-alt",permissions:a.canDownloadBackups},{label:n.t("Alerts"),href:"/alerts",class:"Alerts",icon:"fas fa-exclamation-triangle",permissions:a.canViewAlerts},{label:n.t("Queue"),href:"/queue",class:"Queue",icon:"fas fa-clock",permissions:a.canManageQueue},{label:n.t("Logs"),href:"/logs",class:"Logs",icon:"fas fa-file-alt",permissions:!a.isEnduser&&a.canViewLogs},{label:n.t("Permissions"),href:"/permissions",class:"Permissions",icon:"fas fa-users-cog",permissions:!a.isEnduser&&a.canManagePermissions},{label:n.t("Hooks"),href:"/hooks",class:"Hooks",icon:"fas fa-flag",permissions:!a.isEnduser&&a.canManageHooks},{label:n.t("Security"),href:"/security",class:"Security",icon:"fas fa-fingerprint",permissions:!a.isEnduser&&a.isRoot},{label:n.t("Plugins"),href:"/plugins",class:"Plugins",icon:"fas fa-puzzle-piece",permissions:!a.isEnduser&&a.isRoot}],i.pluginsPositions={},i.lastPosition=i.options.length-1;var s=function(e){i.lastPosition++,i.options.splice(i.lastPosition,0,{label:e.name,href:"/plugin/"+e.code,class:"Plugin"+e.code,icon:e.icon?e.icon:"fas fa-puzzle-piece",permissions:e.visible&&!e.disabled}),i.pluginsPositions[e._id]=i.lastPosition};for(var o in e.plugins)s(e.plugins[o]);e.$watch("plugins",function(){for(var t in e.plugins){var n=e.plugins[t];void 0===i.pluginsPositions[t]?s(n):i.options[i.pluginsPositions[t]].permissions=n.visible&&!n.disabled}},!0),i.options.push({label:n.t("Settings"),href:"/settings",class:"Settings",icon:"fas fa-cog",permissions:!a.isEnduser&&a.isRoot})}}}])}),require(["app","controllers/404","controllers/myAccount","controllers/agreement","controllers/agreementPanel","controllers/dashboard","controllers/alerts","controllers/accounts","controllers/accountsOrphans","controllers/accountManage","controllers/accountReassign","controllers/accountExcludeListSelection","controllers/modifyDatabasesExcludes","controllers/destinations","controllers/destinationManage","controllers/disasterRecovery","controllers/disasterRecovery/selection","controllers/disasterRecovery/destination","controllers/disasterRecovery/settings","controllers/disasterRecovery/backups","controllers/disasterRecovery/backups","controllers/disasterRecovery/accounts","controllers/restoreConditions","controllers/restoreConditionManage","controllers/backupJobs","controllers/backupJobManage","controllers/cloneJobs","controllers/cloneJobManage","controllers/permissions","controllers/schedules","controllers/scheduleManage","controllers/scheduleManagePopup","controllers/scheduleSelection","controllers/queue","controllers/queueItems","controllers/queueLogViewer","controllers/queuePriorities","controllers/queuePriorityManage","controllers/security","controllers/support","controllers/repositories","controllers/repositoryManage","controllers/filePermissions","controllers/filePermissionsManage","controllers/hooks","controllers/hookManage","controllers/tags","controllers/tagManage","controllers/tagsSelection","controllers/destinationsSelection","controllers/backupJobsSelection","controllers/cloneJobsSelection","controllers/backupLockSelection","controllers/plugins","controllers/packages","controllers/showcase","controllers/plugin","controllers/pluginManage","controllers/logs","controllers/logViewer","controllers/logItems","controllers/settings","controllers/settings/binary","controllers/settings/general","controllers/settings/notification","controllers/settings/notificationManage","controllers/settings/performance","controllers/settings/resource","controllers/settings/privacy","controllers/settings/restore","controllers/settings/snapshots","controllers/fileManager","controllers/fileManagerPopup","controllers/fileBrowse","controllers/downloads","controllers/accountSelection","controllers/restore","controllers/restoreMultiAccount","controllers/restoreSingleAccount","controllers/restoreDirectories","controllers/restoreDisasterRecovery","controllers/accountBackups","controllers/accountDownloads","controllers/accountFilters","controllers/accountFilterManage","controllers/accountFilterManagePopup","controllers/accountFilterGroupManage","controllers/accountFilterGroupManagePopup","controllers/accountFilterGroups","controllers/accountFilterGroupSelection","controllers/accountsSelection","controllers/accountPackagesSelection","controllers/resellersSelection","controllers/confirm","controllers_enduser/dashboard","controllers_enduser/restore","controllers_enduser/restore/full","controllers_enduser/restore/files","controllers_enduser/restore/cron","controllers_enduser/restore/dns","controllers_enduser/restore/email","controllers_enduser/restore/db","controllers_enduser/restore/dbuser","controllers_enduser/restore/ftp","controllers_enduser/restore/ssl","controllers_enduser/backups","filters/html","filters/capitalize","filters/executionTime","filters/numberFormat","services/api","services/alert","services/confirm","services/lang","services/filter","services/meta","services/storage","services/permissions","services/popup","services/popupPosition","services/consts","services/util","services/filterManager","services/pathManager","directives/pagination","directives/filterBox","directives/validateField","directives/inputDropdown","directives/pageSize","directives/loadingBox","directives/tooltip","directives/sortBy","directives/search","directives/alertBox","directives/navigation"],function(e){angular.bootstrap(document,["JetBackupApp"])}),define("main",function(){})}();

Zerion Mini Shell 1.0