"use strict";(self.webpackChunknginx_manager=self.webpackChunknginx_manager||[]).push([[179],{2416:(b,y,r)=>{var S=r(1481),t=r(5062),J=r(529),p=r(6895),a=r(8738),F=r(348),P=r(9241),m=r(2904),C=r(269),M=r(4850),u=r(5397),d=r(7709),g=(()=>{return(n=g||(g={})).install="install",n.uninstall="uninstall",n.upgrade="upgrade",g;var n})(),O=r(5419);let I=(()=>{class n{get nativeWindow(){return window}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=t.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})(),G=(()=>{class n{constructor(e,i,s,l){this.apiClient=e,this.alertService=s,this.winRef=l}installNginx(){return this._provisionPackage([{type:g.install,pkgName:n.nginxPackage}])}uninstallNginx(){return this._provisionPackage([{type:g.uninstall,pkgName:n.nginxPackage}])}uninstallStandaloneNginx(){return this._provisionPackage([{type:g.uninstall,pkgName:n.nginxStandalonePackage},{type:g.install,pkgName:n.nginxPackage},{type:g.upgrade,pkgName:n.nginxPackage}])}tailInstallProgress(e,i){const s=new u.r(u.N.JsonApi,{method:"package_manager_get_build_log",arguments:[new d.h("build",e),new d.h("offset",i)]});return this.apiClient.post(s).pipe((0,M.U)(l=>{if(l.success)return{offset:l.data?.offset,content:l.data?.content,isInProgress:1===l.data?.still_running};throw l.errors}))}_getStartMessage(e,i){let s="";return s=e?"Uninstallation process started for the NGINX standalone package.":i===g.install?"Installation process started for the NGINX package.":"Uninstallation process started for the NGINX package.",s}_getEndMessage(e,i){let s="";return s=e?"Completed the uninstallation process for the NGINX standalone package.":i===g.install?"Completed the installation process for the NGINX package.":"Completed the uninstallation process for the NGINX package.",s}parseTailLogInfo(e,i,s,l){let c="",_=!1,w=!1,T=!1;return i.forEach(h=>{h===`-- ${e} --`?c+=`<p><strong>${this._getStartMessage(s,l)}</strong></p>\r\n`:h===`-- /${e} --`?(c+=`<span><strong>${this._getEndMessage(s,l)}</strong></span>\r\n`,n.hitProvisionEnd=!0,T=!w):h===`-- error(${e}) --`?(_=!0,w=!0):h===`-- /error(${e}) --`?(_=!1,c+="\r\n"):/.*Installed:$/.test(h)||/.*Removed:$/.test(h)?n.hitProvisionEnd=!0:n.hitProvisionEnd&&/^.*ea-nginx/.test(h)&&(T=!0,n.hitProvisionEnd=!1),/Error:.*/gm.test(h)&&(h=`<span class='text-danger'>${h}</span>`,w=!0),h=h.replace(/&/gm,"&").replace(/</gm,"<").replace(/>/gm,">").replace(/'/gm,"'").replace(/"/gm,"""),_&&(h.startsWith("--")?c+="<span class='text-danger'><strong>Error</strong></span>\r\n":h=`<span class='text-danger'>${h}</span>`),h.startsWith("--")?c+="\r\n":c+=`${h}\r\n`}),{content:c,hasError:w,provisionSuccess:T}}_provisionPackage(e){const i=new u.r(u.N.JsonApi,{method:"package_manager_submit_actions",arguments:e.map(s=>new d.h(s.type,s.pkgName))});return this.apiClient.post(i).pipe((0,M.U)(s=>{if(s.success)return s.data=s.data.build,s.data;throw s.errors}))}}return n.nginxPackage="ea-nginx",n.nginxStandalonePackage="ea-nginx-standalone",n.hitProvisionEnd=!1,n.\u0275fac=function(e){return new(e||n)(t.LFG(O.A4),t.LFG(C.g),t.LFG(a.c9),t.LFG(I))},n.\u0275prov=t.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();var E=r(537),H=r(7100);let Z=(()=>{class n{constructor(){this.hasNginxCaching=!1,this.hasNginxStandalone=!1,this.hasExternalNginx=!1}}return n.\u0275fac=function(e){return new(e||n)},n.\u0275prov=t.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function Y(n,o){if(1&n&&(t.TgZ(0,"cp-callout",17),t._UZ(1,"p",18),t.qZA()),2&n){const e=t.oxw(3);t.xp6(1),t.Q6J("innerHtml",e.hasExternalNginxMessage,t.oJD)}}function Q(n,o){if(1&n&&(t.TgZ(0,"section",5)(1,"div",6)(2,"div",7)(3,"div",8),t._UZ(4,"img",9),t.qZA()(),t.TgZ(5,"div",10)(6,"div",11)(7,"span",12),t._uU(8,"NGINX"),t.qZA(),t.TgZ(9,"sup"),t._uU(10,"\xae"),t.qZA(),t.TgZ(11,"p",13),t._uU(12),t.qZA(),t._UZ(13,"p",14),t.YNc(14,Y,2,1,"cp-callout",15),t.qZA(),t.TgZ(15,"button",16),t._uU(16),t.qZA()()()()),2&n){const e=t.oxw(2);t.xp6(4),t.Q6J("src",e.getStartedImageUrl,t.LSH),t.xp6(8),t.hij(" ",e.locale.maketext("Reverse proxy with caching[comment,sub heading title]")," "),t.xp6(1),t.Q6J("innerHTML",e.nginxSubText,t.oJD),t.xp6(1),t.Q6J("ngIf",e.hasExternalNginx),t.xp6(2),t.hij(" ",e.locale.maketext("Install")," ")}}function q(n,o){if(1&n&&(t.TgZ(0,"section",19)(1,"cp-callout",20),t._UZ(2,"p",18),t.TgZ(3,"button",21),t._uU(4),t.qZA()()()),2&n){const e=t.oxw(2);t.xp6(2),t.Q6J("innerHtml",e.hasNginxStandaloneMessage,t.oJD),t.xp6(2),t.hij(" ",e.locale.maketext("Switch to [asis,NGINX] Reverse Proxy Mode")," ")}}function X(n,o){if(1&n&&(t.TgZ(0,"div",2),t.YNc(1,Q,17,5,"section",3),t.YNc(2,q,5,2,"section",4),t.qZA()),2&n){const e=t.oxw();t.xp6(1),t.Q6J("ngIf",!e.hasNginxStandalone),t.xp6(1),t.Q6J("ngIf",e.hasNginxStandalone)}}function L(n,o){if(1&n&&t._UZ(0,"p",18),2&n){const e=t.oxw(3);t.Q6J("innerHtml",e.nginxInstallSuccessHelpMessage,t.oJD)}}function R(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"button",35),t.NdJ("click",function(){return t.CHM(e),t.oxw(3).goToSystemSettings()}),t._uU(1),t.qZA()}if(2&n){const e=t.oxw(3);t.xp6(1),t.hij(" ",e.locale.maketext("Go to [asis,NGINX] Manager")," ")}}function B(n,o){if(1&n&&(t.TgZ(0,"div",30),t._UZ(1,"span",31)(2,"p",32),t.YNc(3,L,1,1,"p",33),t.YNc(4,R,2,1,"button",34),t.qZA()),2&n){const e=t.oxw(2);t.xp6(2),t.Q6J("innerHtml",e.nginxInstallSuccessMessage,t.oJD),t.xp6(1),t.Q6J("ngIf",e.showNginxInstallSuccessHelpMessage),t.xp6(1),t.Q6J("ngIf",e.showGoToNginxButton)}}function z(n,o){if(1&n&&(t.TgZ(0,"div",36),t._UZ(1,"i",37)(2,"span",18),t.qZA()),2&n){const e=t.oxw(2);t.xp6(2),t.Q6J("innerHtml",e.provisionInProcessMessage,t.oJD)}}function j(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"a",38),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).goBack()}),t._uU(1),t.qZA()}if(2&n){const e=t.oxw(2);t.xp6(1),t.hij(" ",e.locale.maketext("Go Back")," ")}}function W(n,o){if(1&n&&(t.TgZ(0,"a",39),t._uU(1),t.qZA()),2&n){const e=t.oxw(2);t.Q6J("href",e.whmHomeUrl,t.LSH),t.xp6(1),t.hij(" ",e.locale.maketext("Go to Homepage")," ")}}function $(n,o){if(1&n&&(t.TgZ(0,"section",22)(1,"div",6)(2,"div",23),t.YNc(3,B,5,3,"div",24),t.qZA(),t.YNc(4,z,3,1,"div",25),t.TgZ(5,"div",26)(6,"pre",27),t._uU(7," "),t._UZ(8,"span",18),t._uU(9,"\n "),t.qZA()()(),t.TgZ(10,"div",6)(11,"div",23),t.YNc(12,j,2,1,"a",28),t.YNc(13,W,2,2,"a",29),t.qZA()()()),2&n){const e=t.oxw();t.xp6(3),t.Q6J("ngIf",e.showNginxInstallSuccess),t.xp6(1),t.Q6J("ngIf",e.tailNginxInstallation.isRunning),t.xp6(4),t.Q6J("innerHtml",e.tailNginxInstallation.tailContent,t.oJD),t.xp6(4),t.Q6J("ngIf",e.showGoBackLink),t.xp6(1),t.Q6J("ngIf",e.showGoHomeLink)}}let N=(()=>{class n{constructor(e,i,s,l,c,_){this.installNginxService=e,this.locale=i,this.router=s,this.alertService=l,this.appDataService=c,this.winRef=_,this.hasExternalNginx=!1,this.hasNginxStandalone=!1,this.tailNginxInstallation={provisionType:null,showInstallView:!1,timerHandle:null,timerInterval:1e3,scrollTimerHandle:null,scrollTimerInterval:100,buildId:-1,offset:-1,isRunning:!1,tailContent:"",hasError:!1,provisionSuccess:!1,success:!1,successMsg:"",resultSummary:""}}get hasExternalNginxMessage(){return this.locale.maketext("The system detected a version of [asis,NGINX] that [asis,cPanel] did not provide. You can not use a non-[asis,cPanel]-provided package with a [asis,cPanel]-provided package. If you click install, conflicts will occur.")}get hasNginxStandaloneMessage(){return this.locale.maketext("The system detected the [asis,NGINX] standalone package. [asis,cPanel] does not support [asis,NGINX] caching in standalone mode. To use caching, use [asis,NGINX] in reverse proxy mode.")}get provisionInProcessMessage(){let e="";return e=this.locale.maketext(this.hasNginxStandalone?"Uninstalling [asis,NGINX] standalone package \u2026":this.tailNginxInstallation.provisionType===g.install?"Installing [asis,NGINX] \u2026":"Uninstalling [asis,NGINX] reverse proxy \u2026"),e}get showGoHomeLink(){return this.tailNginxInstallation.provisionType===g.uninstall&&this.tailNginxInstallation.success&&!this.hasNginxStandalone&&!this.tailNginxInstallation.isRunning}get showGoBackLink(){return this.tailNginxInstallation.hasError&&!this.tailNginxInstallation.provisionSuccess||this.showGoHomeLink}get showGoToNginxButton(){return this.tailNginxInstallation.provisionType===g.install&&this.tailNginxInstallation.success}get whmHomeUrl(){return`${this.winRef.nativeWindow.PAGE.cp_security_token}/`}get getStartedImageUrl(){return this.winRef.nativeWindow.PAGE.nginx_manager_image_url}get nginxSubText(){return this.locale.maketext("Installing [asis,NGINX] will enable [asis,NGINX] caching on all user accounts by default. When the installation is complete, you can change this setting in the [asis,NGINX] Manager interface. For more information, read our documentation[output,url,_1, NGINX reverse proxy with caching,target,_2].","https://go.cpanel.net/ea-nginx","_blank")}get nginxInstallSuccessMessage(){return this.tailNginxInstallation.successMsg}get nginxInstallSuccessHelpMessage(){return this.locale.maketext("[asis,NGINX] caching is enabled for all user accounts. You can change these settings in the [asis,NGINX] Manager interface.")}get showNginxInstallSuccessHelpMessage(){return this.tailNginxInstallation.success&&this.tailNginxInstallation.provisionType===g.install}get showNginxInstallSuccess(){return this.tailNginxInstallation.success}ngOnInit(){this.hasNginxStandalone=this.appDataService?.hasNginxStandalone,this.hasExternalNginx=this.appDataService?.hasExternalNginx,this.initRoutesOnCondition()}initRoutesOnCondition(){"/install/nginx"===this.router.url?this.installNginx():"/uninstall/standalone"===this.router.url?this.uninstallStandaloneNginx():"/uninstall/nginx"===this.router.url?this.uninstallNginx():this.appDataService?.hasNginxCaching&&!this.appDataService?.hasNginxStandalone&&this.router.navigate(["system"])}installNginx(){this.tailNginxInstallation.showInstallView=!0,this.tailNginxInstallation.provisionType=g.install,this.installNginxService.installNginx().subscribe(e=>{this.tailNginxInstallation.buildId=e,this.tailNginxInstallation.offset=0,this.showProvisionProgress(!1)},e=>{e.forEach(i=>{this.alertService.error(i.message)})})}uninstallNginx(){this.tailNginxInstallation.showInstallView=!0,this.tailNginxInstallation.provisionType=g.uninstall,this.installNginxService.uninstallNginx().subscribe(e=>{this.tailNginxInstallation.buildId=e,this.tailNginxInstallation.offset=0,this.showProvisionProgress(!1)},e=>{e.forEach(i=>{this.alertService.error(i.message)})})}uninstallStandaloneNginx(){this.tailNginxInstallation.showInstallView=!0,this.tailNginxInstallation.provisionType=g.install,this.installNginxService.uninstallStandaloneNginx().subscribe(e=>{this.tailNginxInstallation.buildId=e,this.tailNginxInstallation.offset=0,this.showProvisionProgress(!0)},e=>{e.forEach(i=>{this.alertService.error(i.message)})})}showProvisionProgress(e){this.tailNginxInstallation.timerHandle=(0,H.F)(this.tailNginxInstallation.timerInterval).subscribe(()=>{this.installNginxService.tailInstallProgress(this.tailNginxInstallation.buildId,this.tailNginxInstallation.offset).pipe((0,E.x)(()=>{this.tailNginxInstallation.isRunning||this.tailNginxInstallation.timerHandle.unsubscribe()})).subscribe(i=>{if(this.tailNginxInstallation.offset===i.offset)return;this.tailNginxInstallation.isRunning=i.isInProgress||!1,this.tailNginxInstallation.offset=i.offset;const s=this.installNginxService.parseTailLogInfo(this.tailNginxInstallation.buildId,i.content,e,this.tailNginxInstallation.provisionType);if(this.tailNginxInstallation.tailContent+=s.content,this.tailNginxInstallation.provisionSuccess||(this.tailNginxInstallation.provisionSuccess=s.provisionSuccess),this.tailNginxInstallation.hasError||(this.tailNginxInstallation.hasError=s.hasError),this.tailNginxInstallation.scrollTimerHandle=this.winRef.nativeWindow.setTimeout(()=>{const l=document.getElementById("log");l&&(l.scrollTop=l.scrollHeight)},this.tailNginxInstallation.scrollTimerInterval),!i.isInProgress){if(this.tailNginxInstallation.buildId=-1,this.tailNginxInstallation.offset=-1,this.tailNginxInstallation.hasError){const l=this._getProvisionFailureMsg();this.alertService.error(l)}this.tailNginxInstallation.provisionSuccess&&(this.tailNginxInstallation.successMsg=this._getProvisionSuccessMsg(),this.tailNginxInstallation.success=!0,this.tailNginxInstallation.provisionType===g.uninstall&&(this.appDataService.hasNginxCaching=!1))}},i=>{i.forEach(s=>{this.alertService.error(s.message)}),this.tailNginxInstallation.isRunning=!1})})}goToSystemSettings(){this.router.navigate(["system"])}goBack(){this.alertService.clear(),this.router.navigate(["getStarted"])}_getProvisionSuccessMsg(){let e="";return e=this.locale.maketext(this.hasNginxStandalone?"[asis,NGINX] standalone package uninstalled. You are now using [asis,NGINX] in reverse proxy mode.":this.tailNginxInstallation.provisionType===g.install?"[asis,NGINX] reverse proxy is now installed.":"[asis,NGINX] reverse proxy is now uninstalled."),e}_getProvisionFailureMsg(){let e="";return e=this.locale.maketext(this.tailNginxInstallation.provisionSuccess?"An error occurred during the provision process. Check the log for more information.":this.hasNginxStandalone?"Failed to uninstall the [asis,NGINX] standalone package. Check the log for more information.":this.tailNginxInstallation.provisionType===g.install?"Failed to install the [asis,NGINX] reverse proxy. Check the log for more information.":"Failed to uninstall the [asis,NGINX] reverse proxy. Check the log for more information."),e}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(G),t.Y36(C.g),t.Y36(m.F0),t.Y36(a.c9),t.Y36(Z),t.Y36(I))},n.\u0275cmp=t.Xpm({type:n,selectors:[["cp-install-nginx"]],decls:2,vars:2,consts:[["class","intro-content",4,"ngIf"],["id","provision-nginx-view",4,"ngIf"],[1,"intro-content"],["id","get-started-section","class","get-started-content",4,"ngIf"],["id","switch-from-standalone-section",4,"ngIf"],["id","get-started-section",1,"get-started-content"],[1,"row"],[1,"col-xs-12","col-md-3"],[1,"nginx-logo"],["alt","NGINX",1,"pull-right","flip",3,"src"],[1,"col-xs-12","col-md-9"],[1,"get-started"],[1,"heading"],[1,"sub-heading"],[1,"subtext",3,"innerHTML"],["id","external-nginx-message","calloutType","warning",4,"ngIf"],["id","btn-install-nginx","routerLink","/install/nginx",1,"btn","btn-primary","installButton"],["id","external-nginx-message","calloutType","warning"],[3,"innerHtml"],["id","switch-from-standalone-section"],["id","standalone-nginx-message","calloutType","warning"],["id","btn-switch-to-reverse-proxy","routerLink","/uninstall/standalone",1,"btn","btn-primary"],["id","provision-nginx-view"],[1,"col-xs-12","col-sm-9"],["class","alert alert-success",4,"ngIf"],["class","col-xs-12 col-sm-9 installingProcess",4,"ngIf"],["dir","ltr",1,"col-xs-12","col-sm-9"],["id","log",1,"tail-log"],["href","javascript:void(0)","id","go-back-link","class","goBackBtn pull-left flip",3,"click",4,"ngIf"],["id","go-home-link","class","goBackBtn pull-right flip",3,"href",4,"ngIf"],[1,"alert","alert-success"],["aria-hidden","true",1,"fa-check-circle","fas","type-icon"],[1,"install-success-message",3,"innerHtml"],[3,"innerHtml",4,"ngIf"],["id","system-settings-btn","class","btn btn-primary",3,"click",4,"ngIf"],["id","system-settings-btn",1,"btn","btn-primary",3,"click"],[1,"col-xs-12","col-sm-9","installingProcess"],["aria-hidden","true",1,"fas","fa-spinner","fa-spin"],["href","javascript:void(0)","id","go-back-link",1,"goBackBtn","pull-left","flip",3,"click"],["id","go-home-link",1,"goBackBtn","pull-right","flip",3,"href"]],template:function(e,i){1&e&&(t.YNc(0,X,3,2,"div",0),t.YNc(1,$,14,5,"section",1)),2&e&&(t.Q6J("ngIf",!i.tailNginxInstallation.showInstallView),t.xp6(1),t.Q6J("ngIf",i.tailNginxInstallation.showInstallView))},directives:[p.O5,a.Oc,m.rH],styles:[".intro-content[_ngcontent-%COMP%]{margin:auto;width:75%}.get-started-content[_ngcontent-%COMP%]{padding-top:25px}.nginx-logo[_ngcontent-%COMP%]{margin:10px 0}.nginx-logo[_ngcontent-%COMP%] img[_ngcontent-%COMP%]{height:165px;width:165px;display:block}.get-started[_ngcontent-%COMP%]{display:inline-block;padding-bottom:20px}.heading[_ngcontent-%COMP%]{font-size:30px;letter-spacing:10px;margin-top:20px;margin-bottom:10px;font-weight:500}.get-started[_ngcontent-%COMP%] sup[_ngcontent-%COMP%]{top:-10px;font-size:130%}.sub-heading[_ngcontent-%COMP%]{font-size:18px}.subtext[_ngcontent-%COMP%]{margin-top:20px}.installButton[_ngcontent-%COMP%]{font-size:16px;padding:12px 25px}.installingProcess[_ngcontent-%COMP%]{padding-bottom:15px}.installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{font-size:16px}html[dir=ltr][_ngcontent-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=ltr][_ngcontent-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], html[dir=ltr][_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], html[dir=ltr] [_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=ltr] [_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding-left:5px}html[dir=rtl][_ngcontent-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=rtl][_ngcontent-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], html[dir=rtl][_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], html[dir=rtl] [_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%], [dir=rtl] [_nghost-%COMP%] .installingProcess[_ngcontent-%COMP%] span[_ngcontent-%COMP%]{padding-right:5px}.tail-log[_ngcontent-%COMP%]{height:500px;white-space:pre-wrap}.goBackBtn[_ngcontent-%COMP%]{text-decoration:underline}.install-success-message[_ngcontent-%COMP%]{font-size:20px}@media screen and (max-width: 992px){.nginx-logo[_ngcontent-%COMP%] > img[_ngcontent-%COMP%]{float:none!important;margin:0 auto}.installButton[_ngcontent-%COMP%]{font-size:18px;width:100%}.get-started[_ngcontent-%COMP%]{text-align:center}.subtext[_ngcontent-%COMP%]{text-align:justify}}html[dir=rtl][_nghost-%COMP%] .calloutText[_ngcontent-%COMP%] strong[_ngcontent-%COMP%], html[dir=rtl] [_nghost-%COMP%] .calloutText[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{padding-right:0;padding-left:5px}"]}),n})(),A=(()=>{class n{constructor(e){this.apiClient=e}toggleCaching(e,i){const s=[new d.h("enabled",!0===e?1:0)];i&&i.length>0&&s.push(...i.map(c=>new d.h("user",c)));const l=new u.r(u.N.JsonApi,{method:"nginxmanager_set_cache_config",arguments:s});return this.apiClient.post(l)}clearCache(e){const i=[];e&&e.length>0&&i.push(...e.map(l=>new d.h("user",l)));const s=new u.r(u.N.JsonApi,{method:"nginxmanager_clear_cache",arguments:i});return this.apiClient.post(s)}resetToDefault(){const e=new u.r(u.N.JsonApi,{method:"nginxmanager_reset_users_cache_config"});return this.apiClient.post(e)}rebuildConfig(e){const i=[];e&&e.length>0&&i.push(...e.map(l=>new d.h("user",l)));const s=new u.r(u.N.JsonApi,{method:"nginxmanager_rebuild_cache_config",arguments:i});return this.apiClient.post(s)}getSystemNginxConfig(e){const i=[new d.h("merge",!0===e?1:0)],s=new u.r(u.N.JsonApi,{method:"nginxmanager_get_cache_config_system",arguments:i});return this.apiClient.get(s)}getUserNginxConfig(e,i,s){const l=[new d.h("merge",!0===i?1:0)];s&&s.length>0&&l.push(...s.map(_=>new d.h("user",_)));const c=new u.r(u.N.JsonApi,{method:"nginxmanager_get_cache_config_users",arguments:l,...e});return this.apiClient.get(c)}restartNginx(){const e=new u.r(u.N.JsonApi,{method:"restartservice",arguments:[new d.h("service","nginx"),new d.h("queue_task","0")]});return this.apiClient.post(e)}}return n.\u0275fac=function(e){return new(e||n)(t.LFG(O.A4))},n.\u0275prov=t.Yz7({token:n,factory:n.\u0275fac,providedIn:"root"}),n})();function V(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"section",24)(1,"cp-toggle-switch",25),t.NdJ("toggleStatus",function(){return t.CHM(e),t.oxw().toggleDefaultCacheSetting()}),t.qZA()()}if(2&n){const e=t.oxw();t.xp6(1),t.s9C("onText",e.locale.maketext("Enabled")),t.s9C("offText",e.locale.maketext("Disabled")),t.Q6J("toggleState",e.defaultCacheSetting.toggleState)("labelPosition",e.defaultCacheSetting.labelPosition)}}function K(n,o){if(1&n&&(t.TgZ(0,"section",26)(1,"div",27),t._UZ(2,"i",28)(3,"span",29),t.qZA()()),2&n){const e=t.oxw();t.xp6(3),t.Q6J("innerHtml",e.locale.maketext("Loading system default for NGINX caching \u2026"),t.oJD)}}function tt(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"cp-callout",30)(1,"div",31)(2,"strong"),t._uU(3),t.qZA(),t._UZ(4,"p",32),t.qZA(),t.TgZ(5,"div")(6,"button",33),t.NdJ("click",function(){return t.CHM(e),t.oxw().resetToSystemDefault()}),t._uU(7),t.qZA(),t.TgZ(8,"button",34),t.NdJ("click",function(){return t.CHM(e),t.oxw().cancelReset()}),t._uU(9),t.qZA()()()}if(2&n){const e=t.oxw();t.xp6(3),t.Oqu(e.locale.maketext("Warning:")),t.xp6(1),t.Q6J("innerHTML",e.locale.maketext("This action will remove any user specific settings for all users and set them to use the system default settings."),t.oJD),t.xp6(2),t.s9C("title",e.locale.maketext("Reset all user accounts to use the system default configuration.")),t.xp6(1),t.hij(" ",e.locale.maketext("Reset users to system default")," "),t.xp6(1),t.Q6J("title",e.locale.maketext("Cancel user reset to default")),t.xp6(1),t.hij(" ",e.locale.maketext("Cancel")," ")}}function et(n,o){if(1&n&&(t.TgZ(0,"p")(1,"strong"),t._uU(2),t.qZA()()),2&n){const e=t.oxw();t.xp6(2),t.Oqu(e.locale.maketext("Are you sure you want to continue?"))}}function nt(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"div",35)(1,"button",36),t.NdJ("click",function(){return t.CHM(e),t.oxw().onUninstallClicked()}),t._uU(2),t.qZA()()}if(2&n){const e=t.oxw();t.xp6(2),t.hij(" ",e.locale.maketext("Uninstall [asis,NGINX] reverse proxy[comment,header title]")," ")}}function it(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"div",37)(1,"button",38),t.NdJ("click",function(){return t.CHM(e),t.oxw().uninstallNginx()}),t._uU(2),t.qZA(),t.TgZ(3,"button",39),t.NdJ("click",function(){return t.CHM(e),t.oxw().cancelUninstall()}),t._uU(4),t.qZA()()}if(2&n){const e=t.oxw();t.xp6(2),t.hij(" ",e.locale.maketext("Uninstall")," "),t.xp6(1),t.Q6J("title",e.locale.maketext("Do not uninstall [asis,NGINX] reverse proxy.")),t.xp6(1),t.hij(" ",e.locale.maketext("Cancel")," ")}}const st=function(n){return{"callout callout-warning":n}};let at=(()=>{class n{constructor(e,i,s,l){this.locale=e,this.systemSettingsService=i,this.alertService=s,this.router=l,this.loadingDefaultCacheSetting=!0,this.defaultCacheSetting={toggleState:a.Yg.toggleOff,labelPosition:a.Gy.right,isDisabled:!1},this.clearCacheAction={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.enabled},this.restartNginxAction={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.enabled},this.rebuildConfigAction={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.enabled},this.resetToSystemDefaultAction={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.enabled},this.showResetWarning=!1,this.showUninstallConfirmation=!1}ngOnInit(){this.loadDefaultCacheSetting()}loadDefaultCacheSetting(){this.systemSettingsService.getSystemNginxConfig().subscribe(e=>{e.success?(this.defaultCacheSetting.toggleState=e.data.system.enabled?a.Yg.toggleOn:a.Yg.toggleOff,this.loadingDefaultCacheSetting=!1):e.errors.forEach(i=>{this.alertService.error(i.message)})})}toggleDefaultCacheSetting(){const e=this.defaultCacheSetting.toggleState;this.defaultCacheSetting.toggleState=a.Yg.toggleUpdating,e===a.Yg.toggleOn?this.systemSettingsService.toggleCaching(!1).subscribe(i=>{i.success?(this.defaultCacheSetting.toggleState=a.Yg.toggleOff,this.alertService.success(this.locale.maketext("[asis,NGINX] caching for the system set to off."))):(i.errors.forEach(s=>{this.alertService.error(s.message)}),this.defaultCacheSetting.toggleState=e)}):this.systemSettingsService.toggleCaching(!0).subscribe(i=>{i.success?(this.defaultCacheSetting.toggleState=a.Yg.toggleOn,this.alertService.success(this.locale.maketext("[asis,NGINX] caching for the system set to on."))):(i.errors.forEach(s=>{this.alertService.error(s.message)}),this.defaultCacheSetting.toggleState=e)})}clearCache(){this.clearCacheAction.buttonState=a.FP.loading,this.systemSettingsService.clearCache().subscribe(e=>{e.success?(this.clearCacheAction.buttonState=a.FP.enabled,this.alertService.success(this.locale.maketext("[asis,NGINX] caching successfully cleared."))):(e.errors.forEach(i=>{this.alertService.error(i.message)}),this.clearCacheAction.buttonState=a.FP.enabled)})}restartNginx(){this.restartNginxAction.buttonState=a.FP.loading,this.systemSettingsService.restartNginx().subscribe(e=>{if(e.success){const i=e?.meta.properties.output.raw;/nginx (re)?started successfully.[\r\n]$/.test(i)?this.alertService.success(this.locale.maketext("[asis,NGINX] service restarted.")):this.alertService.error(i)}else e.errors.forEach(i=>{this.alertService.error(i.message)});this.restartNginxAction.buttonState=a.FP.enabled})}rebuildConfig(){this.rebuildConfigAction.buttonState=a.FP.loading,this.systemSettingsService.rebuildConfig().subscribe(e=>{e.success?(this.rebuildConfigAction.buttonState=a.FP.enabled,this.alertService.success(this.locale.maketext("[asis,NGINX] configuration successfully rebuilt."))):(e.errors.forEach(i=>{this.alertService.error(i.message)}),this.rebuildConfigAction.buttonState=a.FP.enabled)})}resetToSystemDefault(){this.showResetWarning=!1,this.resetToSystemDefaultAction.buttonState=a.FP.loading,this.systemSettingsService.resetToDefault().subscribe(e=>{e.success?(this.resetToSystemDefaultAction.buttonState=a.FP.enabled,this.alertService.success(this.locale.maketext("All user accounts set to use the [asis,NGINX] system default configuration."))):(e.errors.forEach(i=>{this.alertService.error(i.message)}),this.resetToSystemDefaultAction.buttonState=a.FP.enabled)})}handleShowResetWarning(){this.showResetWarning=!0,this.resetToSystemDefaultAction.buttonState=a.FP.disabled}cancelReset(){this.showResetWarning=!1,this.resetToSystemDefaultAction.buttonState=a.FP.enabled}uninstallNginx(){this.router.navigate(["uninstall/nginx"])}onUninstallClicked(){this.showUninstallConfirmation=!0}cancelUninstall(){this.showUninstallConfirmation=!1}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(C.g),t.Y36(A),t.Y36(a.c9),t.Y36(m.F0))},n.\u0275cmp=t.Xpm({type:n,selectors:[["cp-nginx-mgr-system-settings"]],decls:38,vars:29,consts:[["id","systemSettingsSection"],[1,"row"],[1,"col-xs-12","col-md-10"],[1,"panel","panel-default","defaultSetting"],[1,"row","panel-body"],["id","default-cache-setting-header",1,"col-xs-12","col-sm-4"],[1,"col-xs-12","col-sm-8"],["id","default-cache-setting-section",4,"ngIf"],["id","loading-section","class","notifyLoading",4,"ngIf"],[1,"col-xs-12"],["id","default-cache-help-text",1,"help-block",3,"innerHtml"],[1,"panel-footer"],["id","btn-clear-cache",3,"buttonClass","buttonState","title","click"],["id","btn-restart-nginx",3,"buttonClass","buttonState","title","click"],["id","btn-rebuild-config",3,"buttonClass","buttonState","title","click"],["id","btn-reset-to-default",3,"buttonClass","buttonState","title","click"],["id","resetUsersWarning","calloutType","warning",4,"ngIf"],["id","uninstallSection"],[1,"panel","panel-default","uninstall-section",3,"ngClass"],[1,"panel-heading"],[1,"widget-title"],[4,"ngIf"],["class","margin-top-20 margin-bottom-20",4,"ngIf"],["id","confirm-uninstall","class","margin-top-20 margin-bottom-20",4,"ngIf"],["id","default-cache-setting-section"],["id","toggleSwitchDefaultSetting",3,"onText","offText","toggleState","labelPosition","toggleStatus"],["id","loading-section",1,"notifyLoading"],[1,"processing-spinner"],["aria-hidden","true",1,"fas","fa-spinner","fa-spin","spinner"],[3,"innerHtml"],["id","resetUsersWarning","calloutType","warning"],[1,"warningText"],[3,"innerHTML"],["id","resetConfirmBtn",1,"btn","btn-primary","btn-sm",3,"title","click"],["id","cancelResetBtn","type","button",1,"btn","btn-sm","btn-link",3,"title","click"],[1,"margin-top-20","margin-bottom-20"],["id","btn-uninstall-nginx",1,"btn","btn-sm","btn-default",3,"click"],["id","confirm-uninstall",1,"margin-top-20","margin-bottom-20"],["id","btn-confirm-uninstall-nginx",1,"btn","btn-sm","btn-default",3,"click"],["id","btn-cancel-uninstall-nginx","type","button",1,"btn","btn-sm","btn-link",3,"title","click"]],template:function(e,i){1&e&&(t.TgZ(0,"section",0)(1,"div",1)(2,"div",2)(3,"div",3)(4,"div",4)(5,"h3",5),t._uU(6),t.qZA(),t.TgZ(7,"div",6),t.YNc(8,V,2,4,"section",7),t.YNc(9,K,4,1,"section",8),t.qZA(),t.TgZ(10,"div",9),t._UZ(11,"span",10),t.qZA()(),t.TgZ(12,"div",11)(13,"div",1)(14,"div",9)(15,"cp-action-button",12),t.NdJ("click",function(){return i.clearCache()}),t._uU(16),t.qZA(),t.TgZ(17,"cp-action-button",13),t.NdJ("click",function(){return i.restartNginx()}),t._uU(18),t.qZA(),t.TgZ(19,"cp-action-button",14),t.NdJ("click",function(){return i.rebuildConfig()}),t._uU(20),t.qZA(),t.TgZ(21,"cp-action-button",15),t.NdJ("click",function(){return i.handleShowResetWarning()}),t._uU(22),t.qZA()()()(),t.YNc(23,tt,10,6,"cp-callout",16),t.qZA()()()(),t.TgZ(24,"section",17)(25,"div",1)(26,"div",2)(27,"div",18)(28,"div",19)(29,"span",20),t._uU(30),t.qZA()(),t.TgZ(31,"div",4)(32,"div",9),t.YNc(33,et,3,1,"p",21),t.TgZ(34,"p"),t._uU(35),t.qZA(),t.YNc(36,nt,3,1,"div",22),t.YNc(37,it,5,3,"div",23),t.qZA()()()()()()),2&e&&(t.xp6(6),t.hij(" ",i.locale.maketext("Use caching by default[comment,label]")," "),t.xp6(2),t.Q6J("ngIf",!i.loadingDefaultCacheSetting),t.xp6(1),t.Q6J("ngIf",i.loadingDefaultCacheSetting),t.xp6(2),t.Q6J("innerHtml",i.locale.maketext("The default setting applies to all new accounts and any accounts that do not explicitly set caching."),t.oJD),t.xp6(4),t.s9C("title",i.locale.maketext("Clear the cache for all user accounts.")),t.Q6J("buttonClass",i.clearCacheAction.buttonClass)("buttonState",i.clearCacheAction.buttonState),t.xp6(1),t.hij(" ",i.locale.maketext("Clear Cache For All Users")," "),t.xp6(1),t.s9C("title",i.locale.maketext("Restart the [asis,NGINX] service.")),t.Q6J("buttonClass",i.restartNginxAction.buttonClass)("buttonState",i.restartNginxAction.buttonState),t.xp6(1),t.hij(" ",i.locale.maketext("Restart [asis,NGINX]")," "),t.xp6(1),t.s9C("title",i.locale.maketext("Rebuild the [asis,NGINX] service configuration.")),t.Q6J("buttonClass",i.rebuildConfigAction.buttonClass)("buttonState",i.rebuildConfigAction.buttonState),t.xp6(1),t.hij(" ",i.locale.maketext("Rebuild Configuration")," "),t.xp6(1),t.s9C("title",i.locale.maketext("Reset all user accounts to use the system default configuration.")),t.Q6J("buttonClass",i.resetToSystemDefaultAction.buttonClass)("buttonState",i.resetToSystemDefaultAction.buttonState),t.xp6(1),t.hij(" ",i.locale.maketext("Reset users to system default")," "),t.xp6(1),t.Q6J("ngIf",i.showResetWarning),t.xp6(4),t.Q6J("ngClass",t.VKq(27,st,i.showUninstallConfirmation)),t.xp6(3),t.hij(" ",i.locale.maketext("Uninstall [asis,NGINX] reverse proxy[comment,header title]")," "),t.xp6(3),t.Q6J("ngIf",i.showUninstallConfirmation),t.xp6(2),t.hij(" ",i.locale.maketext("Uninstalling [asis,NGINX] reverse proxy will remove caching for all users and their websites.")," "),t.xp6(1),t.Q6J("ngIf",!i.showUninstallConfirmation),t.xp6(1),t.Q6J("ngIf",i.showUninstallConfirmation))},directives:[p.O5,a.MF,a.xV,a.Oc,p.mk],styles:[".defaultSetting[_ngcontent-%COMP%] h3[_ngcontent-%COMP%]{margin-top:0;padding-top:10px}.defaultSetting[_ngcontent-%COMP%] .toggle-switch-wrapper{margin-top:5px}.notifyLoading[_ngcontent-%COMP%]{padding-top:10px}.warningText[_ngcontent-%COMP%]{display:inline-flex}.warningText[_ngcontent-%COMP%] strong[_ngcontent-%COMP%]{padding-left:5px;padding-right:5px}.panel-default[_ngcontent-%COMP%] > .panel-heading[_ngcontent-%COMP%]{background:transparent;border:none;color:#333}.uninstall-section[_ngcontent-%COMP%]{margin:15px 0;padding:15px}"]}),n})();var x=r(755),ot=r(5380),U=r(3357);class lt{constructor(o="",e="",i=!1){this.account=o,this.owner=e,this.nginxCacheStatus=i}}class ct{constructor(o="",e){this.userName=o,this.model=e,this.selected=!1,this.clearCacheButton={buttonClass:"btn btn-outline-primary btn-sm mobile-float",buttonState:a.FP.enabled},this.nginxCacheToggle={toggleState:a.Yg.toggleOff,labelPosition:a.Gy.right,isDisabled:!1},this.nginxCacheToggle.toggleState=e.nginxCacheStatus?a.Yg.toggleOn:a.Yg.toggleOff}}var f=r(7489),v=r(4719),k=r(6775);function rt(n,o){if(1&n&&(t.TgZ(0,"div",2)(1,"div",3)(2,"cp-callout",4)(3,"pre",5),t._uU(4),t.qZA()()()()),2&n){const e=t.oxw();t.xp6(4),t.Oqu(e.loadFailureMessage)}}function gt(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"li",36)(1,"div")(2,"cp-page-size-selector",39),t.NdJ("optionSelected",function(s){return t.CHM(e),t.oxw(3).onPageSizeSelected(s)}),t.qZA()()()}if(2&n){const e=t.oxw(3);t.xp6(2),t.Q6J("pageSizeOptions",e.pagination.pageSizes)("selectedPageSize",e.pagination.pageSize)}}function ut(n,o){1&n&&t._UZ(0,"li",40)}function ht(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"ul",33),t.YNc(1,gt,3,2,"li",34),t.YNc(2,ut,1,0,"li",35),t.TgZ(3,"li",36)(4,"a",37),t.NdJ("click",function(){return t.CHM(e),t.oxw(2).loadUserList()}),t._UZ(5,"i",38),t._uU(6),t.qZA()()()}if(2&n){const e=t.oxw(2);t.xp6(1),t.Q6J("ngIf",e.showPageSizeSelector),t.xp6(1),t.Q6J("ngIf",e.showPageSizeSelector),t.xp6(4),t.hij(" ",e.locale.maketext("Refresh")," ")}}function dt(n,o){if(1&n&&t._UZ(0,"i"),2&n){const e=t.oxw(2).$implicit,i=t.oxw(2);t.Tol(i.sortDirClass),t.uIk("title",e.title)}}function pt(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"a",44),t.NdJ("click",function(){t.CHM(e);const s=t.oxw().$implicit;return t.oxw(2).changeSort(s.key)}),t._UZ(1,"span",45),t._uU(2," \xa0 "),t.YNc(3,dt,1,3,"i",46),t.qZA()}if(2&n){const e=t.oxw().$implicit,i=t.oxw(2);t.xp6(1),t.Q6J("innerHtml",e.title,t.oJD),t.xp6(2),t.Q6J("ngIf",e.key===i.tableMetaData.sorts[0].column)}}function mt(n,o){if(1&n&&t._UZ(0,"span",45),2&n){const e=t.oxw().$implicit;t.Q6J("innerHtml",e.title,t.oJD)}}function _t(n,o){if(1&n&&(t.TgZ(0,"th",41),t.YNc(1,pt,4,2,"a",42),t.YNc(2,mt,1,1,"span",43),t.qZA()),2&n){const e=o.$implicit;t.Q6J("ngClass",e.cssClasses),t.xp6(1),t.Q6J("ngIf",e.isSortable),t.xp6(1),t.Q6J("ngIf",!e.isSortable&&""!==e.title)}}function xt(n,o){if(1&n){const e=t.EpF();t.ynx(0),t.TgZ(1,"tr",48)(2,"td",49)(3,"input",50),t.NdJ("ngModelChange",function(s){return t.CHM(e).$implicit.selected=s})("change",function(){const l=t.CHM(e).$implicit;return t.oxw(3).onRowSelectionChanged(l)}),t.qZA()(),t.TgZ(4,"td")(5,"span",51),t._uU(6),t.qZA()(),t.TgZ(7,"td",52)(8,"span",51),t._uU(9),t.qZA()(),t.TgZ(10,"td")(11,"cp-toggle-switch",53),t.NdJ("toggleStatus",function(){const l=t.CHM(e).$implicit;return t.oxw(3).toggleNginxCacheForUser(l)}),t.qZA()(),t.TgZ(12,"td")(13,"cp-action-button",54),t.NdJ("click",function(){const l=t.CHM(e).$implicit;return t.oxw(3).clearCacheForUser(l)}),t._uU(14),t.qZA()()(),t.BQk()}if(2&n){const e=o.$implicit,i=t.oxw(3);t.xp6(1),t.MGl("id","",e.userName,"-user-list-row"),t.xp6(2),t.Q6J("ngModel",e.selected),t.uIk("aria-label",i.locale.maketext("Select single row.")),t.xp6(3),t.Oqu(e.userName),t.xp6(3),t.Oqu(e.model.owner),t.xp6(2),t.MGl("id","",e.userName,"-nginx-cache-toggle"),t.s9C("onText",i.locale.maketext("Enabled")),t.s9C("offText",i.locale.maketext("Disabled")),t.Q6J("toggleState",e.nginxCacheToggle.toggleState)("labelPosition",e.nginxCacheToggle.labelPosition)("isDisabled",e.nginxCacheToggle.isDisabled),t.xp6(2),t.MGl("id","",e.userName,"-btn-clear-cache"),t.s9C("title",i.locale.maketext("Clear [asis,NGINX] cache.")),t.Q6J("buttonClass",e.clearCacheButton.buttonClass)("buttonState",e.clearCacheButton.buttonState),t.xp6(1),t.hij(" ",i.locale.maketext("Clear Cache")," ")}}function ft(n,o){if(1&n&&(t.TgZ(0,"tbody"),t.YNc(1,xt,15,16,"ng-container",47),t.qZA()),2&n){const e=t.oxw(2);t.xp6(1),t.Q6J("ngForOf",e.displayRows)}}function bt(n,o){if(1&n&&(t.TgZ(0,"tbody")(1,"tr",55)(2,"td"),t._uU(3),t.qZA()()()),2&n){const e=t.oxw(2);t.xp6(2),t.uIk("colspan",e.emptyRowColSpan),t.xp6(1),t.hij(" ",e.locale.maketext("The account list is empty.")," ")}}function Ct(n,o){if(1&n&&(t.TgZ(0,"tbody")(1,"tr",56)(2,"td"),t._uU(3),t.qZA()()()),2&n){const e=t.oxw(2);t.xp6(2),t.uIk("colspan",e.emptyRowColSpan),t.xp6(1),t.hij(" ",e.locale.maketext("No results match your query.")," ")}}function St(n,o){if(1&n&&(t.TgZ(0,"tbody")(1,"tr",57)(2,"td"),t._UZ(3,"span",58),t.TgZ(4,"span",59),t._uU(5),t.qZA()()()()),2&n){const e=t.oxw(2);t.xp6(2),t.uIk("colspan",e.emptyRowColSpan),t.xp6(3),t.Oqu(e.locale.maketext("Loading user accounts \u2026"))}}function Nt(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"div",2)(1,"div",3)(2,"div",2)(3,"div",6)(4,"cp-search",7),t.NdJ("valueChange",function(s){return t.CHM(e),t.oxw().changeFilter(s)}),t.qZA()(),t.TgZ(5,"div",8)(6,"div",9)(7,"div",10)(8,"cp-pagination",11),t.NdJ("pageChanged",function(s){return t.CHM(e),t.oxw().onPageChanged(s)}),t.qZA()()()()(),t.TgZ(9,"div",12)(10,"div",3)(11,"div",13)(12,"div",14)(13,"label",15)(14,"input",16),t.NdJ("ngModelChange",function(s){return t.CHM(e),t.oxw().selectAllState=s})("change",function(){return t.CHM(e),t.oxw().toggleSelectAll()}),t.qZA()()(),t.TgZ(15,"cp-action-button",17),t.NdJ("click",function(){return t.CHM(e),t.oxw().bulkEnableCache()}),t._uU(16),t.qZA(),t.TgZ(17,"cp-action-button",18),t.NdJ("click",function(){return t.CHM(e),t.oxw().bulkDisableCache()}),t._uU(18),t.qZA(),t.TgZ(19,"cp-action-button",19),t.NdJ("click",function(){return t.CHM(e),t.oxw().bulkClearCache()}),t._uU(20),t.qZA()(),t.TgZ(21,"div",20)(22,"div",21)(23,"button",22),t._UZ(24,"i",23)(25,"span",24),t.qZA(),t.YNc(26,ht,7,3,"ul",25),t.qZA()()()(),t.TgZ(27,"section",26)(28,"table",27)(29,"thead")(30,"tr"),t.YNc(31,_t,3,3,"th",28),t.qZA()(),t.YNc(32,ft,2,1,"tbody",29),t.YNc(33,bt,4,2,"tbody",29),t.YNc(34,Ct,4,2,"tbody",29),t.YNc(35,St,6,2,"tbody",29),t.qZA()(),t.TgZ(36,"div",30)(37,"div",3)(38,"div",31)(39,"cp-pagination",32),t.NdJ("pageChanged",function(s){return t.CHM(e),t.oxw().onPageChanged(s)}),t.qZA()()()()()()}if(2&n){const e=t.oxw();t.xp6(4),t.s9C("label",e.searchHelpText),t.s9C("placeholder",e.searchHelpText),t.xp6(4),t.Q6J("selectedPage",e.pagination.currentPage)("totalItems",e.totalRecords)("maxPagesVisible",e.maxItemsPerPage)("pageSize",e.pageSize),t.xp6(6),t.Q6J("ngModel",e.selectAllState),t.uIk("aria-label",e.locale.maketext("Select all rows.")),t.xp6(1),t.s9C("title",e.locale.maketext("Enable [asis,NGINX] caching for selected users.")),t.Q6J("buttonClass",e.bulkEnableCacheButton.buttonClass)("buttonState",e.bulkEnableCacheButtonState),t.xp6(1),t.hij(" ",e.locale.maketext("Enable [asis,NGINX] cache[comment,button title]")," "),t.xp6(1),t.s9C("title",e.locale.maketext("Disable [asis,NGINX] caching for selected users.")),t.Q6J("buttonClass",e.bulkDisableCacheButton.buttonClass)("buttonState",e.bulkDisableCacheButtonState),t.xp6(1),t.hij(" ",e.locale.maketext("Disable [asis,NGINX] cache[comment,button title]")," "),t.xp6(1),t.s9C("title",e.locale.maketext("Clear [asis,NGINX] cache for selected users.")),t.Q6J("buttonClass",e.bulkClearCacheButton.buttonClass)("buttonState",e.bulkClearCacheButtonState),t.xp6(1),t.hij(" ",e.locale.maketext("Clear [asis,NGINX] cache[comment,button title]")," "),t.xp6(3),t.uIk("aria-label",e.locale.maketext("Table Settings")),t.xp6(8),t.Q6J("ngForOf",e.tableHeaders),t.xp6(1),t.Q6J("ngIf",e.showList),t.xp6(1),t.Q6J("ngIf",e.showWhenListIsEmpty),t.xp6(1),t.Q6J("ngIf",e.showWhenSearchIsEmpty),t.xp6(1),t.Q6J("ngIf",e.showLoadingMessage),t.xp6(4),t.Q6J("selectedPage",e.pagination.currentPage)("totalItems",e.totalRecords)("maxPagesVisible",e.maxItemsPerPage)("pageSize",e.pageSize)}}const vt=[{path:"getStarted",component:N,pathMatch:"full"},{path:"install/nginx",component:N},{path:"uninstall/nginx",component:N},{path:"uninstall/standalone",component:N},{path:"system",component:at,data:{id:"system",tab:"system"}},{path:"user",component:(()=>{class n{constructor(e,i,s){this.locale=e,this.systemSettingsService=i,this.alertService=s,this.displayRows=[],this.userList=[],this.loadingData=!0,this.loadFailureMessage="",this.searchHelpText="",this.checkedCount=0,this.selectAllState=!1,this.pagination={pageSizes:[20,50,100,500,1e3],currentPage:1,pageSize:20,maxSize:2,disable:!1,totalItems:0},this.tableMetaData={sorts:[new x.PE("user",x.Sr.Ascending)],pager:new ot.uE(this.pagination.currentPage,this.pagination.pageSize)},this.bulkEnableCacheButton={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.disabled},this.bulkDisableCacheButton={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.disabled},this.bulkClearCacheButton={buttonClass:"btn btn-sm btn-default button-bar",buttonState:a.FP.disabled}}get showLoadingMessage(){return this.loadingData&&""===this.loadFailureMessage}get showFailureMessageOnLoad(){return!this.loadingData&&""!==this.loadFailureMessage}get emptyRowColSpan(){return this.tableHeaders.length+1}get showList(){return!this.loadingData&&this.displayRows.length>0}get showWhenListIsEmpty(){return!this.loadingData&&0===this.userList.length&&0===this.tableMetaData.filters?.length}get showWhenSearchIsEmpty(){return!this.loadingData&&0===this.userList.length&&0!==this.tableMetaData.filters?.length}get sortDirClass(){return this.tableMetaData.sorts[0].direction===x.Sr.Ascending?"icon-arrow-up":"icon-arrow-down"}get disablePagination(){return this.pagination.disable}get showPageSizeSelector(){return this.pagination.totalItems>(0,f.min)(this.pagination.pageSizes)}get totalRecords(){return this.pagination.totalItems}get pageSize(){return this.pagination.pageSize}get maxItemsPerPage(){return this.pagination.maxSize}get bulkEnableCacheButtonState(){return this.bulkEnableCacheButton.buttonState===a.FP.loading?this.bulkEnableCacheButton.buttonState:0===this.checkedCount?a.FP.disabled:a.FP.enabled}get bulkDisableCacheButtonState(){return this.bulkDisableCacheButton.buttonState===a.FP.loading?this.bulkDisableCacheButton.buttonState:0===this.checkedCount?a.FP.disabled:a.FP.enabled}get bulkClearCacheButtonState(){return this.bulkClearCacheButton.buttonState===a.FP.loading?this.bulkClearCacheButton.buttonState:0===this.checkedCount?a.FP.disabled:a.FP.enabled}ngOnInit(){this.tableHeaders=[{key:"checkbox",title:"",cssClasses:["bulkAction","hidden-xs"],isSortable:!1},{key:"user",title:this.locale.maketext("Account"),cssClasses:["account-column"],isSortable:!0},{key:"owner",title:this.locale.maketext("Owner"),cssClasses:["account-column","hidden-xs"],isSortable:!0},{key:"config.enabled",title:this.locale.maketext("[asis,NGINX] caching[comment,table header title]"),cssClasses:[],isSortable:!0},{key:"actions",title:"",cssClasses:[],isSortable:!1}],this.searchHelpText=this.locale.maketext("Search for account or owner."),this.loadUserList()}changeSort(e){if(this.tableMetaData.sorts){const i=this.tableMetaData.sorts.findIndex(s=>s.column===e);if(-1!==i)return this.tableMetaData.sorts[i].direction=this.tableMetaData.sorts[i].direction===x.Sr.Ascending?x.Sr.Descending:x.Sr.Ascending,void this.loadUserList()}this.tableMetaData.sorts=[new x.PE(e,x.Sr.Descending)],this.loadUserList()}changeFilter(e){this.tableMetaData.filters=[new U.w("*",U.p.Contains,e)],1!==this.pagination.currentPage&&(this.pagination.currentPage=1,this.tableMetaData.pager.page=this.pagination.currentPage),this.loadUserList()}onPageChanged(e){this.pagination.currentPage!==e.page&&(this.pagination.currentPage=e.page,this.tableMetaData.pager.page=this.pagination.currentPage,this.loadUserList())}onPageSizeSelected(e){e!==this.pagination.pageSize&&(this.pagination.pageSize=e,this.tableMetaData.pager.pageSize=this.pagination.pageSize,this.loadUserList())}loadUserList(){this.loadingData=!0,this.systemSettingsService.getUserNginxConfig(this.tableMetaData,!0).subscribe(e=>{e.success?(this.userList=e.data.map(i=>new lt(i.user,i.owner,i.config.enabled)),this.displayRows=this.userList.map(i=>new ct(i.account,i)),this._updatePaginationMetadata(e.meta),this.checkedCount=0,this.selectAllState=!1):e.hasErrors&&e.errors.length>0&&e.errors.forEach(i=>{this.alertService.error(i.message)}),this.loadingData=!1},e=>{this.loadFailureMessage=e,this.loadingData=!1},()=>{this.loadingData=!1})}clearCacheForUser(e){e.clearCacheButton.buttonState=a.FP.loading,this.systemSettingsService.clearCache([e.userName]).subscribe(i=>{i.success?(e.clearCacheButton.buttonState=a.FP.enabled,this.alertService.success(this.locale.maketext("[asis,NGINX] caching successfully cleared for \u201c[_1]\u201d.",e.userName))):(i.errors.forEach(s=>{this.alertService.error(s.message)}),e.clearCacheButton.buttonState=a.FP.enabled)})}toggleNginxCacheForUser(e){const i=e.nginxCacheToggle.toggleState;e.nginxCacheToggle.toggleState=a.Yg.toggleUpdating,i===a.Yg.toggleOn?this.systemSettingsService.toggleCaching(!1,[e.userName]).subscribe(s=>{s.success?(e.nginxCacheToggle.toggleState=a.Yg.toggleOff,this.alertService.success(this.locale.maketext("[asis,NGINX] caching is disabled for \u201c[_1]\u201d.",e.userName))):(s.errors.forEach(l=>{this.alertService.error(l.message)}),e.nginxCacheToggle.toggleState=i)}):this.systemSettingsService.toggleCaching(!0,[e.userName]).subscribe(s=>{s.success?(e.nginxCacheToggle.toggleState=a.Yg.toggleOn,this.alertService.success(this.locale.maketext("[asis,NGINX] caching is enabled for \u201c[_1]\u201d.",e.userName))):(s.errors.forEach(l=>{this.alertService.error(l.message)}),e.nginxCacheToggle.toggleState=i)})}onRowSelectionChanged(e){e.selected?this.checkedCount++:this.checkedCount--,this.selectAllState=this.checkedCount===this.userList.length}toggleSelectAll(){0!==this.userList.length&&(this.checkedCount=this.selectAllState?this.userList.length:0,this.displayRows.forEach(e=>{e.selected=this.selectAllState}))}_bulkToggleCache(e,i){i.buttonState=a.FP.loading;const s=(0,f.map)((0,f.filter)(this.displayRows,["selected",!0]),l=>l.userName);this.systemSettingsService.toggleCaching(e,s).subscribe(l=>{if(l.success){const c=this.locale.maketext(e?"[asis,NGINX] caching is enabled for the selected users.":"[asis,NGINX] caching is disabled for the selected users.");this.alertService.success(c),this.loadUserList()}else l.errors.forEach(c=>{this.alertService.error(c.message)});i.buttonState=a.FP.enabled})}bulkEnableCache(){this._bulkToggleCache(!0,this.bulkEnableCacheButton)}bulkDisableCache(){this._bulkToggleCache(!1,this.bulkDisableCacheButton)}bulkClearCache(){this.bulkClearCacheButton.buttonState=a.FP.loading;const e=(0,f.map)((0,f.filter)(this.displayRows,["selected",!0]),i=>i.userName);this.systemSettingsService.clearCache(e).subscribe(i=>{i.success?(this.alertService.success(this.locale.maketext("[asis,NGINX] caching successfully cleared for the selected users.")),this.loadUserList()):i.errors.forEach(s=>{this.alertService.error(s.message)}),this.bulkClearCacheButton.buttonState=a.FP.enabled})}_updatePaginationMetadata(e){this.pagination.totalItems=e.totalRecords,this.pagination.disable=this.pagination.totalItems>(0,f.min)(this.pagination.pageSizes)}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(C.g),t.Y36(A),t.Y36(a.c9))},n.\u0275cmp=t.Xpm({type:n,selectors:[["cp-user-settings"]],decls:3,vars:2,consts:[["id","user-settings"],["class","row",4,"ngIf"],[1,"row"],[1,"col-xs-12"],["id","load-failure-message","calloutType","danger"],[1,"unlink-error-pre"],[1,"col-xs-12","col-sm-6","col-md-4","search-container"],["id","search-user-list","autofocus","true",3,"label","placeholder","valueChange"],[1,"col-xs-12","col-sm-6","col-md-8"],[1,"hidden-xs","hidden-sm"],[1,"pull-right","text-right","flip"],["id","user-list-pagination",3,"selectedPage","totalItems","maxPagesVisible","pageSize","pageChanged"],[1,"row","action-bar"],[1,"pull-left","flip","hidden-xs"],[1,"table-action-button-container"],[1,"table-action-button-label","table-action-button-sm"],["type","checkbox","name","checkAllInList","id","checkAllInList",3,"ngModel","ngModelChange","change"],["id","bulk-enable-cache",3,"buttonClass","buttonState","title","click"],["id","bulk-disable-cache",3,"buttonClass","buttonState","title","click"],["id","bulk-clear-cache",3,"buttonClass","buttonState","title","click"],[1,"pull-right","flip"],["dropdown","","auto-close","outsideClick",1,"btn-group","pull-right"],["id","table-settings-dropdown","type","button","dropdownToggle","",1,"btn","btn-default","btn-sm","dropdown-toggle","button-bar"],[1,"fas","fa-cog"],[1,"caret"],["id","table-settings-menu","class","dropdown-menu dropdown-menu-right","role","menu","aria-labelledby","table-settings-dropdown",4,"dropdownMenu"],[1,"list-section"],["id","user-table",1,"table","table-striped","responsive-table","details-table"],[3,"ngClass",4,"ngFor","ngForOf"],[4,"ngIf"],[1,"row","visible-sm-block","visible-xs-block","hidden-lg","hidden-md"],["id","page-container-bottom",1,"pull-right","flip"],["id","user-list-pagination-bottom",3,"selectedPage","totalItems","maxPagesVisible","pageSize","pageChanged"],["id","table-settings-menu","role","menu","aria-labelledby","table-settings-dropdown",1,"dropdown-menu","dropdown-menu-right"],["role","menuitem",4,"ngIf"],["class","divider",4,"ngIf"],["role","menuitem"],[3,"click"],[1,"fas","fa-sync-alt"],["id","user-list-page-selector",3,"pageSizeOptions","selectedPageSize","optionSelected"],[1,"divider"],[3,"ngClass"],["class","sort-link","href","javascript:void(0)",3,"click",4,"ngIf"],[3,"innerHtml",4,"ngIf"],["href","javascript:void(0)",1,"sort-link",3,"click"],[3,"innerHtml"],[3,"class",4,"ngIf"],[4,"ngFor","ngForOf"],[1,"data-row",3,"id"],[1,"bulkActionColumn","hidden-xs"],["type","checkbox",3,"ngModel","ngModelChange","change"],[1,"account-name","collapse-text"],[1,"hidden-xs"],[3,"id","onText","offText","toggleState","labelPosition","isDisabled","toggleStatus"],[3,"id","buttonClass","buttonState","title","click"],["id","emptyListRow",1,"info","empty-row"],["id","emptySearchRow",1,"info","empty-row"],["id","loadingRow",1,"info","empty-row"],[1,"fas","fa-spinner","fa-spin"],[1,"loading-text"]],template:function(e,i){1&e&&(t.TgZ(0,"div",0),t.YNc(1,rt,5,1,"div",1),t.YNc(2,Nt,40,30,"div",1),t.qZA()),2&e&&(t.xp6(1),t.Q6J("ngIf",i.showFailureMessageOnLoad),t.xp6(1),t.Q6J("ngIf",!i.showFailureMessageOnLoad))},directives:[p.O5,a.Oc,a.gS,a.Qt,v.Wl,v.JJ,v.On,a.xV,k.TO,k.Mq,k.Hz,a.k6,p.sg,p.mk,a.MF],styles:[".account-name[_ngcontent-%COMP%]{display:table-cell;min-width:150px}.account-column[_ngcontent-%COMP%]{min-width:150px}.padding-bottom-20[_ngcontent-%COMP%]{padding-bottom:20px}.search-container[_ngcontent-%COMP%]{margin-top:20px}html[dir=ltr][_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=ltr][_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], html[dir=ltr][_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], html[dir=ltr] [_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=ltr][_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=ltr] [_nghost-%COMP%] .loading-text[_ngcontent-%COMP%]{padding-left:5px}html[dir=rtl][_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=rtl][_ngcontent-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], html[dir=rtl][_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], html[dir=rtl] [_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=rtl][_nghost-%COMP%] .loading-text[_ngcontent-%COMP%], [dir=rtl] [_nghost-%COMP%] .loading-text[_ngcontent-%COMP%]{padding-right:5px}"]}),n})(),data:{id:"user",tab:"user"}},{path:"",redirectTo:"getStarted",pathMatch:"full"},{path:"**",redirectTo:"getStarted",pathMatch:"full"}];let kt=(()=>{class n{}return n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.oAB({type:n}),n.\u0275inj=t.cJS({imports:[[m.Bz.forRoot(vt,{relativeLinkResolution:"legacy"})],m.Bz]}),n})();const wt=["mgrTabSet"];function Pt(n,o){if(1&n){const e=t.EpF();t.TgZ(0,"tabset",null,4)(2,"tab",5),t.NdJ("selectTab",function(){return t.CHM(e),t.oxw().routeTo("/system")}),t.qZA(),t.TgZ(3,"tab",6),t.NdJ("selectTab",function(){return t.CHM(e),t.oxw().routeTo("/user")}),t.qZA()()}if(2&n){const e=t.oxw();t.xp6(2),t.s9C("heading",e.locale.maketext("System Settings")),t.xp6(1),t.s9C("heading",e.locale.maketext("User Settings"))}}let It=(()=>{class n{constructor(e,i,s,l,c,_){this.router=e,this.route=i,this.locale=s,this.appDataService=l,this._window=c,this.ngZone=_,this.showTabSet=!0}ngOnInit(){this.initNavigationTab(),this.initNginxFlags()}initNginxFlags(){this.appDataService.hasNginxCaching=this._window.nativeWindow.PAGE.has_ea_nginx,this.appDataService.hasNginxStandalone=this._window.nativeWindow.PAGE.has_ea_nginx_standalone,this.appDataService.hasExternalNginx=this._window.nativeWindow.PAGE.has_external_nginx}initNavigationTab(){this.router.events.subscribe(e=>{if(e instanceof m.m2){const i=this.route.root.firstChild.snapshot.data.tab;this.showTabSet="/system"===e.url||"/user"===e.url;const s=(0,f.find)(this.mgrTabSet?.tabs,["id",i]);s&&(s.active=!0)}})}routeTo(e){this.ngZone.run(()=>this.router.navigate([e]))}}return n.\u0275fac=function(e){return new(e||n)(t.Y36(m.F0),t.Y36(m.gz),t.Y36(C.g),t.Y36(Z),t.Y36(I),t.Y36(t.R0b))},n.\u0275cmp=t.Xpm({type:n,selectors:[["cp-nginx-manager-root"]],viewQuery:function(e,i){if(1&e&&t.Gf(wt,5),2&e){let s;t.iGM(s=t.CRH())&&(i.mgrTabSet=s.first)}},decls:5,vars:1,consts:[["position","top-right"],["id","content"],[4,"ngIf"],[1,"body"],["mgrTabSet",""],["id","system",3,"heading","selectTab"],["id","user",3,"heading","selectTab"]],template:function(e,i){1&e&&(t._UZ(0,"cp-alert-list",0),t.TgZ(1,"div",1),t.YNc(2,Pt,4,2,"tabset",2),t.TgZ(3,"div",3),t._UZ(4,"router-outlet"),t.qZA()()),2&e&&(t.xp6(2),t.Q6J("ngIf",i.showTabSet))},directives:[a.hF,p.O5,P.AH,P.wW,m.lC],styles:[".body[_ngcontent-%COMP%]{margin-top:30px}"]}),n})(),Tt=(()=>{class n{}return n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=t.oAB({type:n,bootstrap:[It]}),n.\u0275inj=t.cJS({providers:[{provide:p.mr,useValue:window.PAGE.base},a.c9],imports:[[p.ez,S.b2,a.df,a.nM,a.CQ,kt,F.m,a.Op,J.JF,P.P4.forRoot(),a.zr,a.t8,a.u3,a.RV,k.mr.forRoot(),v.u5]]}),n})();(0,t.G48)(),S.q6().bootstrapModule(Tt).catch(n=>console.error(n))}},b=>{b.O(0,[736],()=>b(b.s=2416)),b.O()}]);