define("shared/js/update_config/services/updateConfigService",["angular","cjt/io/whm-v1-request","cjt/io/whm-v1","cjt/io/api","cjt/services/APIService"],(function(e,t){"use strict";e.module("whm.updateConfig.updateConfigurationService",[]).factory("updateConfigService",["$q","APIService",function(i,n){var a=function(){n.call(this)};return a.prototype=Object.create(n.prototype),e.extend(a.prototype,{enableAutomaticUpdates:function(){var e=new t.Class;return e.initialize("","update_updateconf",{UPDATES:"daily",RPMUP:"daily",SARULESUP:"daily"}),this.deferred(e).promise}}),new a}])})),define("app/config",["angular","jquery","lodash","cjt/util/locale","cjt/util/parse","uiBootstrap","cjt/directives/alert","cjt/directives/callout","cjt/directives/actionButtonDirective","cjt/directives/alertList","cjt/services/alertService","shared/js/update_config/services/updateConfigService"],(function(e,t,i,n,a){"use strict";e.module("whm.updateConfig",["whm.updateConfig.updateConfigurationService"]).controller("config",["$scope","updateConfigService","alertService",function(e,t,r){function o(){return!/^\/usr\/local\/cpanel\/?$/.test(e.stagingDir)}function s(){var t=PAGE.partitions,i=e.stagingDir.replace(/(\/)+/g,"$1");/\/$/.test(i)||(i+="/");var n,a=[],r="";if(t.length>0)for(var o=0;o<t.length;o++)n=t[o].path,/\/$/.test(n)||(n+="/"),0===i.indexOf(n)&&a.push(t[o].path);return a.length>0&&(r=a.reduce((function(e,t){return e.length>t.length?e:t}))),r}e.changeStagingDir=function(){e.stagingDir=e.stagingSelection,/\/$/.test(e.stagingSelection)||(e.stagingDir+="/")},e.stagingdirOnChange=function(){e.showStagingSubdir=o(),e.stagingSelection=s()},e.submitForm=function(t){e.isSaving?t.preventDefault():e.isSaving=!0},e.enableAutomaticUpdates=function(){return t.enableAutomaticUpdates().then((function(t){e.autoUpdateEnabled=!0,r.removeById("autoUpdateError"),r.add({type:"success",message:n.maketext("The system saved your changes. To update now, click [output,url,_1,here,id,_2].","../scripts2/upcpform","update-now-link"),id:"autoUpdateSuccess"})})).catch((function(e){var t=n.maketext("The system failed to save your new settings: [_1]",i.escape(e));r.add({type:"danger",message:t,id:"autoUpdateError"})}))},e.toggleVersionDetails=function(){e.showVersionDetails=!e.showVersionDetails,e.showVersionDetails?e.additionalInfoText=n.maketext("Hide Additional Details"):e.additionalInfoText=n.maketext("Show Additional Details")},e.init=function(){e.loading=!0,e.preventSumbit=PAGE.preventSumbit,e.saved=PAGE.saved,e.saveFailed=PAGE.save_failed,e.tiers=PAGE.flat_tiers,e.saveFailReason=PAGE.save_fail_reason,e.currentVersion=PAGE.current_version,e.currentMajorVersion=PAGE.current_major_version,e.currentMajorVersionNoEleven=parseInt(e.currentVersion.split(".")[0]),e.isDevVersion=e.currentMajorVersionNoEleven%2!=0,e.customTier=PAGE.custom_tier,e.requiredFreeSpace=PAGE.required_free_space,e.hostname=PAGE.hostname,e.stagingDir=PAGE.upconf.staging_dir,e.stagingSelection=s(),e.showStagingSubdir=o(),e.tierSelection=e.customTier?e.customTier:PAGE.checked,e.isSaving=!1,e.showVersionDetails=!1,e.additionalInfoText=n.maketext("Show Additional Details");var t=PAGE.custom_tier_info;if(t){e.customTierLatestBuild=t.latest_build;var i=Math.max(t.latest_build_expiration,t.main_build_expiration);i&&(e.customTierExpiration=new Date(1e3*i),e.customTierExpirationLocalized=n.datetime(e.customTierExpiration),e.customTierExpiredWarningText=(e.customTierIsExpired=e.customTierExpiration&&e.customTierExpiration.getTime()<Date.now(),e.customTier&&e.customTierIsExpired?n.maketext("Support for this build ended on [_1].",e.customTierExpirationLocalized):n.maketext("Support for this build will end on [_1].",e.customTierExpirationLocalized)))}e.customTier&&!t.main_build&&(e.customTierInvalidWarningText=n.maketext("“[_1]” is not a supported named release tier. Your server won’t receive updates without a valid tier.",e.customTier)),e.hasCustomTierWarning=Boolean(e.customTierInvalidWarningText||e.customTierExpiredWarningText),e.upconf=PAGE.upconf,e.autoUpdateEnabled=a.parsePerlBoolean(e.upconf.auto_update_enabled),e.loading=!1},e.init()}])})),define("app/index",["angular","jquery","lodash","cjt/core","cjt/modules","ngRoute","uiBootstrap","ngSanitize"],(function(e,t,i,n){return function(){return e.module("App",["cjt2.config.whm.configProvider","ngRoute","ui.bootstrap","cjt2.whm","whm.updateConfig"]),require(["cjt/bootstrap","cjt/views/applicationController","app/config"],(function(t){e.module("App").value("PAGE",PAGE),t(document)}))}}));