Viewing File: /usr/local/cpanel/base/frontend/jupiter/dynamic-dns/main.js

"use strict";(self.webpackChunkdynamic_dns=self.webpackChunkdynamic_dns||[]).push([[179],{3675:(T,R,c)=>{var w=c(1481),t=c(5062),h=c(6895),D=c(3044),M=c(8746),C=c(6191),u=c(4006),F=c(529),q=c(6737),l=c(9429),U=c(6962),J=c(1620),O=c(567),Z=c(269),m=c(755),g=(()=>{return(o=g||(g={})).up="icon-arrow-up",o.down="icon-arrow-down",g;var o})(),Q=c(1709),b=c(4850),H=c(7803),f=c(5259),x=c(7709),j=c(5380),Y=c(1086),$=c(2916);let L=(()=>{class o{constructor(e){this._http=e}createDDNSConfig(e){const n=new f.j({namespace:"DynamicDNS",method:"create",arguments:[new x.h("domain",e.domain),new x.h("description",e.description?e.description:""),new x.h("ip",e.ip?e.ip:"")]});return this._http.post(n).pipe((0,Q.zg)(i=>{if(1===i.status)return e.ip?this.setManualIP(i.data.id,e.ip):(0,Y.of)(i.data.id);throw i.errors.pop()}))}deleteDDNSConfig(e){const n=new f.j({namespace:"Batch",method:"strict",arguments:this._createBatchArgs(e,"delete")});return this._http.post(n).pipe((0,b.U)(i=>{if(1===i.status)return i.data;throw i.errors.pop()}))}fetchDDNSConfigs(e,n,i,a){const r=new f.j({namespace:"DynamicDNS",method:"list",sorts:[new m.PE(e,n)],pager:new j.uE(i,a)});return this._http.post(r).pipe((0,b.U)(d=>{if(1===d.status)return d;throw d.errors.pop()}))}fetchDomains(){if(!this._zonesObsv$){const e=new f.j({namespace:"DomainInfo",method:"list_domains"});this._zonesObsv$=this._http.post(e).pipe((0,b.U)(n=>{let i=[n.data.main_domain];return i=i.concat(n.data.addon_domains,n.data.parked_domains),i}),(0,H.d)(1))}return this._zonesObsv$}getSSLCert(e){const n=new f.j({namespace:"SSL",method:"fetch_cert_info",arguments:[new x.h("id",e)]});return this._http.post(n).pipe((0,b.U)(i=>{if(1===i.status)return i.data;throw i.data.statusmsg}))}getSSLCerts(e){const n=new f.j({namespace:"SSL",method:"fetch_certificates_for_fqdns",arguments:[new x.h("domains",e)]});return this._http.post(n).pipe((0,b.U)(i=>{if(1===i.status)return i.data;throw i.data.statusmsg}))}recreateDDNSURL(e){const n=new f.j({namespace:"Batch",method:"strict",arguments:this._createBatchArgs(e,"recreate")});return this._http.post(n).pipe((0,b.U)(i=>{if(1===i.status)return i.data;throw i.messages.pop()}))}saveDDNSDescription(e,n){const i=new f.j({namespace:"DynamicDNS",method:"set_description",arguments:[new x.h("id",e),new x.h("description",n)]});return this._http.post(i).pipe((0,b.U)(a=>{if(1===a.status)return!0;throw a.messages.pop()}))}setManualIP(e,n){const i=/^[0-9\.]+$/.test(n)?"ipv4":"ipv6",a=`/cpanelwebcall/${e}/${i}/${n}`;return new $.y(d=>{const _=new XMLHttpRequest;_.open("GET",a),_.addEventListener("error",k=>{d.error()}),_.addEventListener("load",k=>{d.next(e),d.complete()}),_.send()})}_createBatchArgs(e,n){const i=[];let a,r,d;return e.forEach((_,k)=>{a=["DynamicDNS",n,{id:_}],r=JSON.stringify(a),d=new x.h(`command-${k}`,r),i.push(d)}),i}}return o.\u0275fac=function(e){return new(e||o)(t.LFG(J.Tr))},o.\u0275prov=t.Yz7({token:o,factory:o.\u0275fac,providedIn:"root"}),o})();function V(o,s){1&o&&t._UZ(0,"i",42)}function E(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"div",35)(1,"div",36)(2,"cp-callout",37)(3,"span",38),t._uU(4),t.qZA(),t._UZ(5,"div",39),t.TgZ(6,"cp-action-button",40),t.NdJ("click",function(){return t.CHM(e),t.oxw().deleteDDNSConfig()}),t.YNc(7,V,1,0,"i",41),t._uU(8),t.qZA()()()()}if(2&o){const e=t.oxw();t.xp6(4),t.Oqu(e.deleteConfimationHeader),t.xp6(1),t.Q6J("innerHTML",e.deleteConfirmationWarningText,t.oJD),t.xp6(1),t.Q6J("buttonState",e.deleteBtnState),t.xp6(1),t.Q6J("ngIf",!e.isDeletingConfigs),t.xp6(1),t.hij(" ",e.locale.maketext("Delete ([_1])?",e.numberOfRowsChecked)," ")}}function z(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"ul",43)(1,"li",44)(2,"a",45),t.NdJ("click",function(){return t.CHM(e),t.oxw().recreateDDNSURL()}),t._uU(3),t.qZA()(),t.TgZ(4,"li",44)(5,"a",45),t.NdJ("click",function(){return t.CHM(e),t.oxw().toggleDeleteConfirmation(!0)}),t._uU(6),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(2),t.uIk("aria-label",e.aria.actionBtnRecreatelabel),t.xp6(1),t.Oqu(e.locale.maketext("Recreate URL")),t.xp6(2),t.uIk("aria-label",e.aria.actionBtnDeleteLabel),t.xp6(1),t.Oqu(e.locale.maketext("Delete"))}}function G(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"ul",46)(1,"li",44)(2,"cp-page-size-selector",47),t.NdJ("optionSelected",function(i){return t.CHM(e),t.oxw().updatePaginationByNums(i)}),t.qZA()()()}if(2&o){const e=t.oxw();t.xp6(2),t.Q6J("selectedPageSize",e.pagination.recordsPerPage)}}function K(o,s){if(1&o&&t._UZ(0,"i",53),2&o){const e=t.oxw(3);t.Q6J("ngClass",e.caretClass)}}function X(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"a",51),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().sortColumn(i)}),t._uU(1),t.YNc(2,K,1,1,"i",52),t.qZA()}if(2&o){const e=t.oxw().$implicit,n=t.oxw();t.uIk("title",n.getSortBtnTitle(e)),t.xp6(1),t.hij(" ",e.name," "),t.xp6(1),t.Q6J("ngIf",e.hasCaret)}}function W(o,s){if(1&o&&(t.TgZ(0,"span"),t._uU(1),t.qZA()),2&o){const e=t.oxw().$implicit;t.xp6(1),t.Oqu(e.name)}}const tt=function(o){return{"hidden-xs":o}};function et(o,s){if(1&o&&(t.ynx(0),t.TgZ(1,"th",48),t.YNc(2,X,3,3,"a",49),t.YNc(3,W,2,1,"span",50),t.qZA(),t.BQk()),2&o){const e=s.$implicit;t.xp6(1),t.Q6J("ngClass",t.VKq(3,tt,"ip"===e.columnID||"url"===e.columnID)),t.xp6(1),t.Q6J("ngIf",e.sortable),t.xp6(1),t.Q6J("ngIf",!e.sortable)}}function nt(o,s){if(1&o&&(t.TgZ(0,"tr",54)(1,"td",55),t._UZ(2,"i",56),t._uU(3),t.qZA()()),2&o){const e=t.oxw();t.xp6(3),t.hij(" ",e.locale.maketext("Fetching your dynamic [asis,DNS] configurations.")," ")}}function it(o,s){if(1&o&&(t.TgZ(0,"tr",54)(1,"td",55),t._uU(2),t.qZA()()),2&o){const e=t.oxw();t.xp6(2),t.hij(" ",e.locale.maketext("No [asis,DDNS] configuration. Click \u201cCreate\u201d to begin.")," ")}}function ot(o,s){if(1&o&&(t.TgZ(0,"p"),t._uU(1),t.qZA()),2&o){const e=t.oxw(3);t.xp6(1),t.hij(" ",e.locale.maketext("None")," ")}}function at(o,s){if(1&o&&(t.ynx(0),t.TgZ(1,"span"),t._uU(2),t.qZA(),t.BQk()),2&o){const e=s.$implicit;t.xp6(2),t.Oqu(e)}}function st(o,s){if(1&o&&(t.TgZ(0,"p"),t._uU(1),t.qZA()),2&o){const e=t.oxw(3);t.xp6(1),t.Oqu(e.noCertText)}}function lt(o,s){if(1&o&&(t.TgZ(0,"a",81),t._UZ(1,"span",82),t._uU(2),t.qZA()),2&o){const e=t.oxw(2),n=e.index,i=e.$implicit,a=t.oxw();t.MGl("id","viewDDNSSSLBtn_",n,""),t.s9C("href",i.certURL,t.LSH),t.xp6(2),t.hij(" ",a.locale.maketext("View [asis,SSL] certificate[comment, this is button text to view an SSL certificate]")," ")}}function rt(o,s){if(1&o&&(t.TgZ(0,"a",83),t._UZ(1,"span",82),t._uU(2),t.qZA()),2&o){const e=t.oxw(2),n=e.index,i=e.$implicit,a=t.oxw();t.MGl("id","viewDDNSSSLBtnMobile_",n,""),t.s9C("href",i.certURL,t.LSH),t.xp6(2),t.hij(" ",a.locale.maketext("View [asis,SSL] certificate[comment, this is button text to view an SSL certificate]")," ")}}const ct=function(o,s){return{"fa-chevron-down":o,"fa-chevron-right":s}};function dt(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"tr",59)(1,"td",60)(2,"label",61)(3,"input",62),t.NdJ("ngModelChange",function(i){return t.CHM(e),t.oxw().$implicit.checked=i})("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().toggleCheckbox(i)}),t.qZA()()(),t.TgZ(4,"td",63)(5,"div",64)(6,"button",65),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().toggleRolldown(i)}),t.TgZ(7,"span",25),t._uU(8,"Expand row"),t.qZA(),t._UZ(9,"i",66),t.qZA()(),t.TgZ(10,"span",67),t._uU(11),t.TgZ(12,"span",68,69)(14,"span",70),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().toggleRolldown(i)}),t._uU(15),t.qZA(),t.TgZ(16,"button",71),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().toggleRolldown(i)}),t._UZ(17,"i",72),t.qZA()()()(),t.TgZ(18,"td",73),t.YNc(19,ot,2,1,"p",50),t.YNc(20,at,3,1,"ng-container",29),t.qZA(),t.TgZ(21,"td",73)(22,"span",74)(23,"div",75),t._uU(24),t.qZA(),t.TgZ(25,"a",76),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().copyTextToClipboard(i.ddnsURL)}),t.TgZ(26,"span",77),t._uU(27),t.qZA(),t._UZ(28,"i",78),t.qZA()()(),t.TgZ(29,"td"),t.YNc(30,st,2,1,"p",50),t.YNc(31,lt,3,3,"a",79),t.YNc(32,rt,3,3,"a",80),t.qZA()()}if(2&o){const e=t.oxw(),n=e.$implicit,i=e.index,a=t.oxw();t.Q6J("id","ddns-list__domain--"+n.domain),t.xp6(2),t.MGl("for","rowCheckbox_",i,""),t.uIk("aria-label",a.aria.selectRowLabel),t.xp6(1),t.MGl("id","rowCheckbox_",i,""),t.Q6J("ngModel",n.checked),t.xp6(3),t.MGl("id","toggleRollDown_",i,""),t.xp6(3),t.Q6J("ngClass",t.WLB(21,ct,n.isRolldownVisible,!n.isRolldownVisible)),t.xp6(2),t.hij(" ",n.domain," "),t.xp6(3),t.Q6J("title",a.getDescriptionText(n)),t.xp6(1),t.Oqu(a.getDescriptionText(n)),t.xp6(1),t.s9C("name",a.locale.maketext("Edit description.")),t.MGl("id","descriptionEditBtn_",i,""),t.uIk("aria-label",a.aria.editDescIconBtn),t.xp6(3),t.Q6J("ngIf",!n.ips.length),t.xp6(1),t.Q6J("ngForOf",n.ips),t.xp6(4),t.Oqu(n.ddnsURL),t.xp6(1),t.MGl("id","urlCopyBtn_",i,""),t.xp6(2),t.Oqu(a.locale.maketext("Copy")),t.xp6(3),t.Q6J("ngIf",n.showNoCertText),t.xp6(1),t.Q6J("ngIf",n.isViewSSLCertBtnVisible),t.xp6(1),t.Q6J("ngIf",n.isViewSSLCertBtnVisible)}}function pt(o,s){1&o&&t._UZ(0,"span",100)}function ut(o,s){if(1&o&&(t.TgZ(0,"p"),t._uU(1),t.qZA()),2&o){const e=t.oxw(3);t.xp6(1),t.hij(" ",e.locale.maketext("None")," ")}}function mt(o,s){if(1&o&&(t.ynx(0,95),t.TgZ(1,"p"),t._uU(2),t.qZA(),t.BQk()),2&o){const e=s.$implicit,n=t.oxw(2).index;t.MGl("id","ddnsIPMobile_",n,""),t.xp6(2),t.Oqu(e)}}function _t(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"tr",84)(1,"td",85)(2,"div",86)(3,"div",35)(4,"div",87)(5,"label",61),t._uU(6),t.qZA(),t.TgZ(7,"textarea",88,89),t._uU(9),t.qZA(),t.TgZ(10,"cp-action-button",90),t.NdJ("click",function(){t.CHM(e);const i=t.MAs(8),a=t.oxw().$implicit;return t.oxw().saveDescription(a,i)}),t.YNc(11,pt,1,0,"span",91),t._uU(12),t.qZA(),t.TgZ(13,"button",92),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().toggleRolldown(i)}),t._uU(14),t.qZA()(),t.TgZ(15,"div",93)(16,"cp-form-label",94),t._uU(17),t.qZA(),t.TgZ(18,"p",95),t._uU(19),t.qZA(),t.TgZ(20,"cp-form-label",94),t._uU(21),t.qZA(),t.TgZ(22,"p",95),t._uU(23),t.qZA(),t.TgZ(24,"div",96),t._UZ(25,"label",97),t.TgZ(26,"p",95),t._uU(27),t.qZA(),t.TgZ(28,"a",98),t.NdJ("click",function(){t.CHM(e);const i=t.oxw().$implicit;return t.oxw().copyTextToClipboard(i.ddnsURL)}),t.TgZ(29,"span",77),t._uU(30),t.qZA(),t._UZ(31,"i",78),t.qZA()(),t.TgZ(32,"div",96),t._UZ(33,"label",97),t.YNc(34,ut,2,1,"p",50),t.YNc(35,mt,3,2,"ng-container",99),t.qZA()()()()()()}if(2&o){const e=t.oxw(),n=e.$implicit,i=e.index,a=t.oxw();t.Q6J("id","ddns-list__rolldown--"+n.domain),t.xp6(5),t.MGl("for","editDescriptionInput_",i,""),t.xp6(1),t.Oqu(a.locale.maketext("Description")),t.xp6(1),t.MGl("id","editDescriptionInput_",i,"")("name","editDescriptionInput_",i,""),t.xp6(2),t.Oqu(n.description),t.xp6(1),t.MGl("id","saveDescriptionBtn_",i,""),t.Q6J("buttonClass",a.saveDescriptionBtnClass)("buttonState",n.editDescBtnState),t.xp6(1),t.Q6J("ngIf","enabled"===n.editDescBtnState),t.xp6(1),t.hij(" ",a.locale.maketext("Save")," "),t.xp6(1),t.MGl("id","cancelEditDescription+",i,""),t.xp6(1),t.hij(" ",a.locale.maketext("Cancel")," "),t.xp6(2),t.MGl("id","lastUpdatedTimeLabel_",i,"")("for","lastUpdatedTimeText_",i,""),t.Q6J("showInfoBlock",!0)("labelText",a.locale.maketext("Last Update Time")),t.xp6(1),t.hij(" ",a.locale.maketext("The last time the [asis,IP] address changed.")," "),t.xp6(1),t.MGl("id","lastUpdatedTimeText_",i,""),t.xp6(1),t.hij(" ",n.lastUpdatedTime," "),t.xp6(1),t.MGl("id","lastRunTimeLabel_",i,"")("for","lastRunTimeText_",i,""),t.Q6J("showInfoBlock",!0)("labelText",a.locale.maketext("Last Run Time")),t.xp6(1),t.hij(" ",a.locale.maketext("The last time a request to update the [asis,IP] address happened.")," "),t.xp6(1),t.MGl("id","lastRunTimeText_",i,""),t.xp6(1),t.hij(" ",n.lastRunTime," "),t.xp6(2),t.MGl("id","ddnsURLMobileLabel_",i,"")("for","ddnsURLMobile_",i,""),t.Q6J("innerHTML",a.locale.maketext("[output,strong,URL][comment,this is a form element label]"),t.oJD),t.xp6(1),t.MGl("id","ddnsURLMobile_",i,""),t.xp6(1),t.hij(" ",n.ddnsURL," "),t.xp6(1),t.MGl("id","urlCopyBtnMobile_",i,""),t.xp6(2),t.Oqu(a.locale.maketext("Copy")),t.xp6(3),t.MGl("id","ddnsIPMobileLabel_",i,"")("for","ddnsIPMobile_",i,""),t.Q6J("innerHTML",a.locale.maketext("[output,strong,IP Address][comment,this is a form element label]"),t.oJD),t.xp6(1),t.Q6J("ngIf",!n.ips.length),t.xp6(1),t.Q6J("ngForOf",n.ips)}}function ht(o,s){if(1&o&&(t.ynx(0),t.YNc(1,dt,33,24,"tr",57),t.YNc(2,_t,36,39,"tr",58),t.BQk()),2&o){const e=s.$implicit,n=t.oxw();t.xp6(1),t.Q6J("ngIf",!n.isContentLoading),t.xp6(1),t.Q6J("ngIf",!n.isContentLoading&&e.isRolldownVisible)}}const y=function(o){return{disabled:o}};let B=(()=>{class o{constructor(e,n,i,a,r){this._alertService=e,this.locale=n,this._router=i,this._ddnsService=a,this._locationService=r,this.allRowsChecked=!1,this.anyRowChecked=!1,this.caretClass=g.up,this.deleteBtnState=l.FP.enabled,this.isContentLoading=!0,this.isDeleteConfirmationVisible=!1,this.pagination={page:1,recordsPerPage:20,totalPages:0,totalRecords:0,start:0}}get aria(){return{actionBtnControl:"tableRowsActionList",actionListLabelledBy:"tableRowsActionBtn",actionBtnRecreateLabel:this.locale.maketext("Recreate [asis,url]."),actionBtnDeleteLabel:this.locale.maketext("Delete [asis,url]."),editDescIconBtn:this.locale.maketext("Edit description."),selectAllRowsLabel:this.locale.maketext("Select all rows."),selectRowLabel:this.locale.maketext("Select row."),sectionTitleDescription:this.locale.maketext("Use this interface to view a list of your dynamic [asis,DNS] ([asis,DDNS]) domains.")}}get checkedRowIDs(){const e=[];return this.ddnsConfigs.forEach(n=>{n.checked&&e.push(n.id)}),e}get deleteConfimationHeader(){return this.locale.maketext("Delete the selected dynamic [asis,DNS] domains?")}get deleteConfirmationWarningText(){return this.locale.maketext("This will [output,strong,not] delete the associated [asis,SSL] certificate, if one exists.")}get descriptionTextPt1(){return this.locale.maketext("This feature lets you utilize a Domain Name System ([asis,DNS]) hosted on the [asis,cPanel] server to resolve a hostname that exists on an external network with a dynamic [asis,IP] address. This will let you manage your network devices without the need to manually update the devices\u2018 settings any time the [asis,IP] address changes.")}get descriptionTextPt2(){return`${this.locale.maketext("For example, a domain administrator can use this feature to have [asis,cPanel] host [asis,DNS] for a hostname that points to your office network\u2018s public [asis,IP] address.")} ${this.locale.maketext("For more information, read the [output,url,_1,feature documentation,class,externalLink,target,_2,id,_3].","https://go.cpanel.net/cpaneldocsDynamicDNS","cp-dynamic-dns-docs","linkDynamicDNSDocumentation")}`}get isDeletingConfigs(){return this.deleteBtnState===l.FP.loading}get noDescriptionText(){return this.locale.maketext("Add a description.")}get numberOfRowsChecked(){return this.ddnsConfigs.filter(n=>n.checked).length}get saveDescriptionBtnClass(){return"btn-outline-primary btn-sm"}copyTextToClipboard(e){const n=document.createElement("textarea");n.value=e,document.body.appendChild(n),n.select(),document.execCommand("copy")?this._alertService.success(this.locale.maketext("Successfully copied to the clipboard.")):this._alertService.error(this.locale.maketext("Copy failed.")),document.body.removeChild(n)}deleteDDNSConfig(){this.deleteBtnState=l.FP.loading;const e=this._ddnsService.deleteDDNSConfig(this.checkedRowIDs);this._ddnsRecreateConfigSub=e.subscribe({complete:()=>{this._alertService.success(this.locale.maketext("Succesffuly removed domain(s).")),this.allRowsChecked=!1,this.toggleDeleteConfirmation(!1),this.deleteBtnState=l.FP.enabled,this._fetchDDNSConfigs("domain",m.Sr.Ascending)},error:n=>{this.deleteBtnState=l.FP.loading,this._alertService.error(n.message)}})}executeSearch(e){e.trim(),this.ddnsConfigs=e?this._origDDNSList.filter(n=>n.domain.includes(e)||n.ips.filter(a=>a.includes(e)).length?n:void 0):this._origDDNSList}getDescriptionText(e){return e.description.length?e.description:this.noDescriptionText}getShortestParent(e,n){let i;return n.forEach(a=>{const r=a.replace(/\./g,"\\.");new RegExp(`\\.${r}$`).test(e)&&(!i||a.length<i.length)&&(i=a)}),i}getSortBtnTitle(e){return this.locale.maketext("Sort table by \u201c[_1]\u201d.",e.name)}goToCreateForm(){this._router.navigate(["create"])}goToSSLForm(e){this._router.navigate(["ssl"],{queryParams:{cert_id:e.certURL}})}recreateDDNSURL(){const e=this._ddnsService.recreateDDNSURL(this.checkedRowIDs);this._ddnsRecreateConfigSub=e.subscribe({complete:()=>{this.allRowsChecked=!1,this._alertService.success(this.locale.maketext("Successfully recreated URL.")),this._fetchDDNSConfigs("domain",m.Sr.Ascending)},error:n=>{this._alertService.error(n.message)}})}saveDescription(e,n){e.editDescBtnState=l.FP.loading;const i=n.value.trim().replace(/\r?\n|\r/g,""),a=this._ddnsService.saveDDNSDescription(e.id,i);this._saveDescriptionSub=a.subscribe({complete:()=>{this._alertService.success(this.locale.maketext("Successfully saved description for \u201c[_1]\u201d.",e.domain)),e.editDescBtnState=l.FP.enabled,e.description=i,this.toggleRolldown(e)},error:r=>{this._alertService.error(r.message),e.editDescBtnState=l.FP.enabled}})}sortColumn(e){if(e.hasCaret)this.caretClass=this.caretClass===g.up?g.down:g.up,e.direction=e.direction===m.Sr.Ascending?m.Sr.Descending:m.Sr.Ascending;else{this.caretClass=g.up;const n=this.tableColumns.map(i=>(i.direction=m.Sr.Ascending,i.hasCaret=i.columnID===e.columnID,i));this.tableColumns=n}this.ddnsConfigs.sort((n,i)=>e.direction===m.Sr.Ascending?n[e.sortOnName]<i[e.sortOnName]?-1:1:n[e.sortOnName]<i[e.sortOnName]?1:-1)}trackByID(e,n){return n.id}toggleAllRows(){this.allRowsChecked=!this.allRowsChecked,this.anyRowChecked=!!this.allRowsChecked||!this.anyRowChecked,this.isDeleteConfirmationVisible=!1,this.ddnsConfigs.forEach(e=>{e.checked=this.allRowsChecked})}toggleCheckbox(e){if(e.checked=!e.checked,e.checked)this.anyRowChecked=!0;else for(let n=0,i=this.ddnsConfigs.length;n<i;n++){if(this.ddnsConfigs[n].checked){this.anyRowChecked=!0;break}this.anyRowChecked=!1}for(let n=0,i=this.ddnsConfigs.length;n<i;n++){if(!this.ddnsConfigs[n].checked){this.allRowsChecked=!1;break}this.allRowsChecked=!0}this.isDeleteConfirmationVisible=!(!this.isDeleteConfirmationVisible||!this.anyRowChecked)}toggleDeleteConfirmation(e){this.isDeleteConfirmationVisible=e}toggleRolldown(e){e.isRolldownVisible=!e.isRolldownVisible}updatePaginationByPage(e){this.pagination.page!==e&&(this.pagination.page=e,this._fetchDDNSConfigs("domain",m.Sr.Ascending))}updatePaginationByNums(e){this.pagination.recordsPerPage!==e&&(this.pagination.recordsPerPage=e,this._fetchDDNSConfigs("domain",m.Sr.Ascending))}ngOnInit(){this.noCertText=this.locale.maketext("No certificate available for this domain."),this.tableColumns=[{name:this.locale.maketext("Domain"),sortOnName:"domain",columnID:"domain",sortable:!0,hasCaret:!0,direction:m.Sr.Ascending},{name:this.locale.maketext("[asis,IP] Address"),columnID:"ip",sortable:!1,hasCaret:!1,direction:m.Sr.Ascending},{name:this.locale.maketext("URL"),sortable:!0,sortOnName:"domain",columnID:"url",hasCaret:!1,direction:m.Sr.Ascending},{name:this.locale.maketext("[asis,SSL] Certificate"),columnID:"cert",sortable:!1,hasCaret:!1,direction:m.Sr.Ascending}],this._fetchDDNSConfigs("domain",m.Sr.Ascending)}ngOnDestroy(){this._ddnsConfigsSub.unsubscribe(),this._ddnsRecreateConfigSub&&this._ddnsRecreateConfigSub.unsubscribe(),this._ddnsDeleteConfigSub&&this._ddnsDeleteConfigSub.unsubscribe(),this._sslStatusSub&&this._sslStatusSub.unsubscribe(),this._checkAutoSSLQueueSub&&this._checkAutoSSLQueueSub.unsubscribe(),this._saveDescriptionSub&&this._saveDescriptionSub.unsubscribe()}_fetchDDNSConfigs(e,n){this.isContentLoading=!0;const i=this._ddnsService.fetchDDNSConfigs(e,n,this.pagination.page,this.pagination.recordsPerPage);let a;this._ddnsConfigsSub=i.subscribe({next:r=>{a=r.data,this.pagination={page:r.meta.page,recordsPerPage:r.meta.pageSize,totalPages:r.meta.totalPages,totalRecords:r.meta.totalRecords,start:r.meta.record}},complete:()=>{a.length?this._checkSSLStatuses(a):(this.isContentLoading=!1,this.ddnsConfigs=[])},error:r=>{this.isContentLoading=!1,this._alertService.error(r.message)}})}_formatDDNSConfigData(e,n,i){const a=[];let r,d,_,k;return e.forEach(p=>{let A="";r=p.last_update_time?this.locale.maketext("[local_datetime,_1,datetime_format_short][comment,this is needed to convert the date to a localized format]",p.last_update_time):this.locale.maketext("None"),d=p.last_run_times.length?this.locale.maketext("[local_datetime,_1,datetime_format_short][comment,this is needed to convert the date to a localized format]",p.last_run_times.sort()[p.last_run_times.length-1]):this.locale.maketext("None"),_=p.ipv4.concat(p.ipv6);for(let N=0,Jt=n.length;N<Jt;N++)n[N].domains.includes(p.domain)&&(k=n[N].id);A=this.getShortestParent(p.domain,i),A=`https://${A}/cpanelwebcall/${p.id}`;const I={domain:p.domain,id:p.id,ips:_.length?_:[],description:null===p.description?"":p.description.trim(),unixLastUpdatedTime:p.last_update_time,unixLastRun:p.last_run_times.length?p.last_run_times.sort()[p.last_run_times.length-1]:null,lastUpdatedTime:r,lastRunTime:d,ddnsURL:A,checked:!1,isViewSSLCertBtnVisible:!1,isRolldownVisible:!1,showNoCertText:!1,editDescBtnState:l.FP.enabled};k?(I.certURL=`https://${this._locationService.hostname}:${this._locationService.port}${this._locationService.pathname}#/ssl?cert_id=${k}`,I.isViewSSLCertBtnVisible=!0):I.showNoCertText=!0,a.push(I)}),a}_checkSSLStatuses(e){const n=e.map(i=>i.domain);this._sslStatusSub=(0,O.D)({sslCerts:this._ddnsService.getSSLCerts(n),userDomains:this._ddnsService.fetchDomains()}).subscribe({next:i=>{this.ddnsConfigs=this._formatDDNSConfigData(e,i.sslCerts,i.userDomains)},complete:()=>{this._origDDNSList=this.ddnsConfigs,this.isContentLoading=!1},error:i=>{this.isContentLoading=!1,this._alertService.error(i)}})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(l.c9),t.Y36(Z.g),t.Y36(C.F0),t.Y36(L),t.Y36(U.a))},o.\u0275cmp=t.Xpm({type:o,selectors:[["cp-ddns-list"]],decls:49,vars:32,consts:[[1,"description",3,"innerHTML"],[1,"row","search-page-container"],[1,"col-md-6","col-lg-5"],["for","ddnsConfigSearch"],["id","ddnsConfigSearch","role","search",3,"label","valueChange"],[1,"pull-right","text-right","col-md-6","col-lg-7","hidden-xs"],["id","listDDNSDomainsPagination",3,"totalItems","pageSize","pageChanged"],["class","row",4,"ngIf"],[1,"row","action-bar"],[1,"col-xs-12"],[1,"pull-left","flip"],[1,"table-action-button-container"],["for","selectAllRowsCheckbox",1,"table-action-button-label","table-action-button-sm"],["type","checkbox","id","selectAllRowsCheckbox","name","checkAllRows",3,"ngClass","ngModel","ngModelChange","click"],["dropdown","",1,"btn-group"],["id","tableRowsActionBtn","dropdownToggle","","type","button",1,"btn","btn-default","dropdown-toggle",3,"ngClass"],["aria-hidden","true",1,"caret"],["id","tableRowsActionList","class","dropdown-menu","role","menu","aria-labelledby","tableRowsActionBtn",4,"dropdownMenu"],[1,"pull-right","flip"],["id","createDDNSBtn",1,"btn","btn-primary",3,"ngClass","click"],[1,"fas","fa-plus"],["dropdown","",1,"btn-group","hidden-xs","pull-right"],["id","pageSizeDropdownBtn","dropdownToggle","","type","button",1,"btn","btn-default","dropdown-toggle",3,"ngClass"],[1,"fas","fa-cog"],[1,"caret"],[1,"sr-only"],["id","paginationDropdownList","class","dropdown-menu dropdown-menu-right","role","menu","aria-labelledby","pageSizeDropdownBtn",4,"dropdownMenu"],["id","ddnsListTable",1,"table","table-striped","responsive-table","details-table"],["scope","col"],[4,"ngFor","ngForOf"],["class","info empty-row",4,"ngIf"],[4,"ngFor","ngForOf","ngForTrackBy"],[1,"row","search-page-container","visible-xs-block","visible-sm-block","hidden-md","hidden-lg"],[1,"col-xs-12","col-sm-12","pull-right","text-right"],["id","listDDNSDomainsPaginationMobile",3,"totalItems","pageSize","pageChanged"],[1,"row"],[1,"col-xs-12","col-md-6"],["id","deleteConfirmationCallout","calloutType","warning"],["callout-heading",""],[3,"innerHTML"],["id","confirmDeleteBtn",3,"buttonState","click"],["class","fas fa-trash","aria-hidden","true",4,"ngIf"],["aria-hidden","true",1,"fas","fa-trash"],["id","tableRowsActionList","role","menu","aria-labelledby","tableRowsActionBtn",1,"dropdown-menu"],["role","menuitem"],["href","javascript:void(0)",1,"dropdown-item",3,"click"],["id","paginationDropdownList","role","menu","aria-labelledby","pageSizeDropdownBtn",1,"dropdown-menu","dropdown-menu-right"],["id","listDDNSDomainsPageSizeSelection",3,"selectedPageSize","optionSelected"],["scope","col",3,"ngClass"],["role","button","href","javascript:void(0)",3,"click",4,"ngIf"],[4,"ngIf"],["role","button","href","javascript:void(0)",3,"click"],[3,"ngClass",4,"ngIf"],[3,"ngClass"],[1,"info","empty-row"],["colspan","5"],["aria-hidden","true",1,"fas","fa-spinner","fa-spin"],["class","data-row",3,"id",4,"ngIf"],["class","wordbreak",3,"id",4,"ngIf"],[1,"data-row",3,"id"],[1,"check-column"],[3,"for"],["type","checkbox",3,"ngModel","id","ngModelChange","click"],[1,"name-column"],[1,"row-expand-container"],[1,"btn","btn-link",3,"id","click"],["aria-hidden","true",1,"fas",3,"ngClass"],[1,"domain-name","collapse-text"],[1,"info-block","ddns-list__edit-description"],["testEl",""],[1,"ddns-list__edit-description-text",3,"title","click"],[1,"btn","btn-sm","btn-link","url-content-copy",3,"name","id","click"],["aria-hidden","true",1,"fas","fa-pencil-alt"],[1,"hidden-xs"],[1,"url-content-container"],[1,"url-content"],["role","button","href","javascript:void(0)",1,"btn","btn-sm","btn-link","url-content-copy",3,"id","click"],[1,"table-btn-icon"],["aria-hidden","true",1,"fas","fa-copy"],["class","btn btn-outline-primary hidden-xs",3,"id","href",4,"ngIf"],["class","btn-outline-primary hidden-sm hidden-md hidden-lg",3,"id","href",4,"ngIf"],[1,"btn","btn-outline-primary","hidden-xs",3,"id","href"],["aria-hidden","true",1,"fas","fa-eye"],[1,"btn-outline-primary","hidden-sm","hidden-md","hidden-lg",3,"id","href"],[1,"wordbreak",3,"id"],["colspan","5",1,"expand-panel-data"],[1,"list-panel","expand-panel"],[1,"col-xs-12","col-sm-3","rolldown-content-container"],[1,"form-control","ddns__textarea",3,"id","name"],["editDescInput",""],[3,"id","buttonClass","buttonState","click"],["class","fas fa-save","aria-hidden","true",4,"ngIf"],[1,"btn","btn-link","btn-sm",3,"id","click"],[1,"col-xs-12","col-sm-4","rolldown-content-container"],[3,"id","for","showInfoBlock","labelText"],[3,"id"],[1,"hidden-sm","hidden-md","hidden-lg"],[3,"id","for","innerHTML"],["href","javascript:void(0)",1,"btn","btn-sm","btn-link","url-content-copy",3,"id","click"],[3,"id",4,"ngFor","ngForOf"],["aria-hidden","true",1,"fas","fa-save"]],template:function(e,n){1&e&&(t.TgZ(0,"section"),t._UZ(1,"p",0)(2,"p",0),t.qZA(),t._UZ(3,"cp-alert-list"),t.TgZ(4,"section")(5,"div",1)(6,"div",2)(7,"label",3),t._uU(8),t.qZA(),t.TgZ(9,"cp-search",4),t.NdJ("valueChange",function(a){return n.executeSearch(a)}),t.qZA()(),t.TgZ(10,"div",5)(11,"cp-pagination",6),t.NdJ("pageChanged",function(a){return n.updatePaginationByPage(a.page)}),t.qZA()()()(),t.TgZ(12,"section"),t.YNc(13,E,9,5,"div",7),t.TgZ(14,"div",8)(15,"div",9)(16,"div",10)(17,"div",11)(18,"label",12)(19,"input",13),t.NdJ("ngModelChange",function(a){return n.allRowsChecked=a})("click",function(){return n.toggleAllRows()}),t.qZA()()(),t.TgZ(20,"div",14)(21,"button",15),t._uU(22),t._UZ(23,"span",16),t.qZA(),t.YNc(24,z,7,4,"ul",17),t.qZA()(),t.TgZ(25,"div",18)(26,"button",19),t.NdJ("click",function(){return n.goToCreateForm()}),t._UZ(27,"span",20),t._uU(28),t.qZA(),t.TgZ(29,"div",21)(30,"button",22),t._UZ(31,"i",23)(32,"span",24),t.TgZ(33,"span",25),t._uU(34,"Select entries per page"),t.qZA()(),t.YNc(35,G,3,1,"ul",26),t.qZA()()()()(),t.TgZ(36,"section")(37,"table",27)(38,"thead")(39,"tr"),t._UZ(40,"th",28),t.YNc(41,et,4,5,"ng-container",29),t.qZA()(),t.TgZ(42,"tbody"),t.YNc(43,nt,4,1,"tr",30),t.YNc(44,it,3,1,"tr",30),t.YNc(45,ht,3,2,"ng-container",31),t.qZA()(),t.TgZ(46,"div",32)(47,"div",33)(48,"cp-pagination",34),t.NdJ("pageChanged",function(a){return n.updatePaginationByPage(a.page)}),t.qZA()()()()),2&e&&(t.uIk("title",n.aria.sectionTitleDescription),t.xp6(1),t.Q6J("innerHTML",n.descriptionTextPt1,t.oJD),t.xp6(1),t.Q6J("innerHTML",n.descriptionTextPt2,t.oJD),t.xp6(6),t.hij(" ",n.locale.maketext("Search by domain or [asis,IP] address.")," "),t.xp6(1),t.s9C("label",n.locale.maketext("Search dynamic [asis,DNS] configurations.")),t.xp6(2),t.Q6J("totalItems",n.pagination.totalRecords)("pageSize",n.pagination.recordsPerPage),t.xp6(2),t.Q6J("ngIf",n.isDeleteConfirmationVisible&&n.anyRowChecked),t.xp6(5),t.uIk("aria-label",n.aria.selectAllRowsLabel),t.xp6(1),t.Q6J("ngClass",t.VKq(24,y,n.ddnsConfigs&&!n.ddnsConfigs.length||n.isContentLoading))("ngModel",n.allRowsChecked),t.xp6(2),t.Q6J("ngClass",t.VKq(26,y,!n.anyRowChecked||n.isContentLoading)),t.uIk("disabled",!n.anyRowChecked||n.isContentLoading||null),t.xp6(1),t.hij(" ",n.locale.maketext("Action")," "),t.xp6(4),t.Q6J("ngClass",t.VKq(28,y,n.isContentLoading)),t.xp6(2),t.hij(" ",n.locale.maketext("Create")," "),t.xp6(2),t.Q6J("ngClass",t.VKq(30,y,n.isContentLoading)),t.xp6(11),t.Q6J("ngForOf",n.tableColumns),t.xp6(2),t.Q6J("ngIf",n.isContentLoading),t.xp6(1),t.Q6J("ngIf",n.ddnsConfigs&&!n.ddnsConfigs.length),t.xp6(1),t.Q6J("ngForOf",n.ddnsConfigs)("ngForTrackBy",n.trackByID),t.xp6(3),t.Q6J("totalItems",n.pagination.totalRecords)("pageSize",n.pagination.recordsPerPage))},directives:[l.hF,l.gS,l.Qt,h.O5,l.Oc,l.xV,u.Wl,h.mk,u.JJ,u.On,D.TO,D.Mq,D.Hz,l.k6,h.sg,l._P],styles:[".ddns__textarea[_ngcontent-%COMP%]{resize:vertical}.ddns-list__edit-description[_ngcontent-%COMP%]{display:flex;align-items:center}.ddns-list__edit-description-text[_ngcontent-%COMP%]{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}#paginationDropdownList[_ngcontent-%COMP%]   li[_ngcontent-%COMP%]{margin:0 5px}.description[_ngcontent-%COMP%]{padding-bottom:10px}"]}),o})();var S=c(2502),v=(()=>{return(o=v||(v={})).left="fa-arrow-left",o.right="fa-arrow-right",v;var o})(),gt=c(5712);let P=(()=>{class o{constructor(e,n){this.locale=e,this._locationService=n}ngOnInit(){this._path=new gt.b5(this._locationService),this.sslStatusLink=this._createRestoreModulesLink()}_createRestoreModulesLink(){return`${this._path.protocol}//${this._path.domain}:${this._path.port}${this._path.themePath}security/tls_status/#/`}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(Z.g),t.Y36(U.a))},o.\u0275cmp=t.Xpm({type:o,selectors:[["cp-ddns-resources"]],decls:16,vars:6,consts:[[1,"col-xs-12","col-sm-4","col-md-3"],[1,"section"],[1,"widget"],["href","https://go.cpanel.net/cpaneldocsdynamicdns","id","ddnsAboutTheInterface","target","cpanel_documentation",3,"title"],["aria-hidden","true",1,"fas","fa-fw","fa-external-link-alt"],[1,"widget-title"],["id","sslTLSStatusPageBtn","target","cpanel",3,"href","title"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0)(1,"div",1)(2,"section",2)(3,"ul")(4,"li")(5,"a",3),t._UZ(6,"i",4),t._uU(7),t.qZA()()()(),t.TgZ(8,"section",2)(9,"h3",5),t._uU(10),t.qZA(),t.TgZ(11,"ul")(12,"li")(13,"a",6),t._UZ(14,"i",4),t._uU(15),t.qZA()()()()()()),2&e&&(t.xp6(5),t.s9C("title",n.locale.maketext("Need help? Click here to read more about this interface.")),t.xp6(2),t.hij(" ",n.locale.maketext("About This Interface")," "),t.xp6(3),t.hij(" ",n.locale.maketext("Related Interfaces")," "),t.xp6(3),t.s9C("href",n.sslStatusLink,t.LSH),t.s9C("title",n.locale.maketext("Navigate to the [asis,SSL/TLS] Status interface.")),t.xp6(2),t.hij(" ",n.locale.maketext("Check [asis,SSL/TLS] Status")," "))},encapsulation:2}),o})();function ft(o,s){1&o&&(t.TgZ(0,"div",5),t._UZ(1,"cp-loading-spinner",6),t.qZA())}function xt(o,s){1&o&&t._UZ(0,"i",39)}function Ct(o,s){1&o&&t._UZ(0,"i",40)}const bt=function(){return["127.0.0.1","::1"]};function St(o,s){if(1&o&&(t.TgZ(0,"div",18)(1,"div",1)(2,"div",19)(3,"cp-form-label",41),t._uU(4),t.qZA()(),t._UZ(5,"div",19),t.qZA(),t.TgZ(6,"div",1)(7,"div",19),t._UZ(8,"input",42),t.qZA()(),t._UZ(9,"cp-validation-container",43),t.qZA()),2&o){const e=t.oxw(2);t.xp6(3),t.Q6J("showInfoBlock",e.showAllHelp)("labelText",e.locale.maketext("[asis,IP] Address")),t.xp6(1),t.hij(" ",e.locale.maketext("Optionally, add the current [asis,IPv4] or [asis,IPv6] address of the router or DDNS-enabled device.")," "),t.xp6(4),t.s9C("placeholder",e.locale.maketext("Example: [list_or,_1]",t.DdM(5,bt))),t.xp6(1),t.Q6J("control",e.ipControl)}}function vt(o,s){1&o&&t._UZ(0,"i",44)}function kt(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"div",7)(1,"form",8)(2,"div",9)(3,"div",10)(4,"div",11),t._uU(5),t.qZA(),t.TgZ(6,"div",12)(7,"button",13),t.NdJ("click",function(){return t.CHM(e),t.oxw().toggleHelp()}),t._uU(8),t._UZ(9,"i",14),t.qZA()(),t._UZ(10,"div",15),t.qZA(),t.TgZ(11,"div",16)(12,"section",17)(13,"div",18)(14,"div",1)(15,"div",19)(16,"cp-form-label",20),t._uU(17),t.qZA()()(),t.TgZ(18,"div",1)(19,"div",19)(20,"input",21),t.NdJ("keyup",function(){return t.CHM(e),t.oxw().validateSubdomain()}),t.qZA(),t._UZ(21,"ng-select",22),t.qZA()(),t._UZ(22,"cp-validation-container",23)(23,"cp-validation-container",24),t.qZA(),t.TgZ(24,"div",18)(25,"div",1)(26,"div",19)(27,"button",25),t.NdJ("click",function(){return t.CHM(e),t.oxw().toggleIPInput()}),t._uU(28),t.YNc(29,xt,1,0,"i",26),t.YNc(30,Ct,1,0,"i",27),t.qZA()()()(),t.YNc(31,St,10,6,"div",28),t.TgZ(32,"div",18)(33,"div",1)(34,"div",19)(35,"cp-form-label",29),t._uU(36),t.qZA()()(),t.TgZ(37,"div",1)(38,"div",19),t._UZ(39,"input",30),t.qZA()()()()(),t.TgZ(40,"div",31)(41,"div",32)(42,"label"),t._UZ(43,"input",33),t._uU(44),t.qZA()(),t._UZ(45,"hr",34),t.TgZ(46,"cp-action-button",35),t.NdJ("click",function(){return t.CHM(e),t.oxw().submitForm()}),t.YNc(47,vt,1,0,"i",36),t._uU(48),t.qZA(),t.TgZ(49,"button",37),t.NdJ("click",function(){return t.CHM(e),t.oxw().returnToTable()}),t._UZ(50,"i",38),t._uU(51),t.qZA()()()()()}if(2&o){const e=t.oxw();t.xp6(1),t.Q6J("formGroup",e.ddnsForm),t.xp6(4),t.hij(" ",e.locale.maketext("Create Dynamic [asis,DNS] Domain")," "),t.xp6(3),t.hij(" ",e.toggleHelpLabel," "),t.xp6(8),t.Q6J("showInfoBlock",e.showAllHelp)("labelText",e.locale.maketext("Dynamic [asis,DNS] Domain")),t.xp6(1),t.hij(" ",e.locale.maketext("Add a subdomain prefix and then select a domain to create a [asis,DDNS] domain (for example, \u201chome\u201d).")," "),t.xp6(3),t.s9C("placeholder",e.locale.maketext("Enter a subdomain prefix.")),t.xp6(1),t.s9C("placeholder",e.locale.maketext("Select a domain.")),t.s9C("notFoundText",e.locale.maketext("No domains available.")),t.Q6J("readonly",e.isSelectDisabled)("clearable",!1)("items",e.availableDomains),t.uIk("aria-label",e.aria.selectDomainLabel),t.xp6(1),t.Q6J("control",e.subdomainControl),t.xp6(1),t.Q6J("control",e.domainControl),t.xp6(5),t.hij(" ",e.locale.maketext("Manually enter an [asis,IP] address (Optional)[comment,this is a dropdown for the user to display or hide an input]")," "),t.xp6(1),t.Q6J("ngIf",!e.isIPInputShown),t.xp6(1),t.Q6J("ngIf",e.isIPInputShown),t.xp6(1),t.Q6J("ngIf",e.isIPInputShown),t.xp6(4),t.Q6J("showInfoBlock",e.showAllHelp)("labelText",e.locale.maketext("Description")),t.xp6(1),t.hij(" ",e.locale.maketext("Optionally, add a friendly name label to identify the DDNS domain (for example, \u201cHome Router\u201d).")," "),t.xp6(3),t.s9C("placeholder",e.locale.maketext("Enter a description.")),t.xp6(5),t.hij(" ",e.stayOnFormText," "),t.xp6(2),t.Q6J("buttonClass",e.createBtnClass)("buttonState",e.createBtnState),t.xp6(1),t.Q6J("ngIf",!e.isConfigCreating),t.xp6(1),t.hij(" ",e.locale.maketext("Create")," "),t.xp6(1),t.s9C("title",e.locale.maketext("Go back to the list of dynamic [asis,DNS] configurations.")),t.xp6(1),t.Q6J("ngClass",e.returnArrowDir),t.xp6(1),t.hij(" ",e.locale.maketext("Go Back")," ")}}function Tt(o,s){1&o&&t._UZ(0,"cp-ddns-resources")}let wt=(()=>{class o{constructor(e,n,i,a,r){this._alertService=e,this.locale=n,this._router=i,this._ddnsService=a,this._ddnsBuilder=r,this.createBtnState=l.FP.enabled,this.isContentLoading=!0,this.isIPInputShown=!1,this.showAllHelp=!0}get aria(){return{selectDomainLabel:this.locale.maketext("Select domain.")}}get descriptionText(){return`${this.locale.maketext("Use this interface to create a dynamic [asis,DNS] ([asis,DDNS]) domain.")} ${this.locale.maketext("For more information, read the [output,url,_1,feature documentation,class,externalLink,target,_2,id,_3].","https://go.cpanel.net/cpaneldocsDynamicDNS","cp-dynamic-dns-docs","linkDynamicDNSDocumentation")}`}get domainControl(){return this.ddnsForm.get("domain")}get ipControl(){return this.ddnsForm.get("ip")}get isConfigCreating(){return this.createBtnState===l.FP.loading}get isSelectDisabled(){return this.availableDomains.length<=1}get returnArrowDir(){return this.locale.isRtl?v.right:v.left}get stayOnFormText(){return this.locale.maketext("Stay on this page after I click \u201cCreate\u201d.")}get subdomainControl(){return this.ddnsForm.get("subdomain")}get createBtnClass(){return"btn-primary"}get toggleHelpLabel(){return this.locale.maketext(this.showAllHelp?"Hide Help Text":"Show Help Text")}returnToTable(){this._router.navigate(["list"])}toggleIPInput(){this.isIPInputShown=!this.isIPInputShown}submitForm(){if(this.ddnsForm.valid){let i;this.createBtnState=l.FP.loading;const a={domain:`${this.ddnsForm.get("subdomain").value}.${this.ddnsForm.get("domain").value.slice(1)}`,description:this.ddnsForm.get("description").value,ip:this.ddnsForm.get("ip").value},r=this._ddnsService.createDDNSConfig(a);this._createSub=r.subscribe({error:d=>{this.createBtnState=l.FP.enabled,this._alertService.error(d.message)},next:d=>{i=d},complete:()=>{const d=this.ddnsForm.get("stayOnForm").value;this.createBtnState=l.FP.enabled,this._alertService.success(this.locale.maketext("Successfully created a dynamic [asis,DNS] configuration with the following ID: [_1]",i)),d?this._resetForm():this.returnToTable()}})}else Object.keys(this.ddnsForm.controls).forEach(e=>{this.ddnsForm.controls[e].markAsTouched(),this.ddnsForm.controls[e].markAsDirty(),this.ddnsForm.controls[e].updateValueAndValidity()})}toggleHelp(){this.showAllHelp=!this.showAllHelp}validateSubdomain(){const e=this.ddnsForm.get("subdomain").value;if(e){const n=e.split(".");let i;for(let a=0,r=n.length;a<r;a++){if(i=S.Xz.NONINITIAL_LABEL_REGEX.test(n[a]),!i){this.ddnsForm.get("subdomain").setValidators(S.Xz.validateLabel());break}this.ddnsForm.get("subdomain").clearValidators()}}else this.ddnsForm.get("subdomain").setValidators(S.dt.required(this.locale.maketext("You must enter a subdomain prefix.")));this.ddnsForm.get("subdomain").updateValueAndValidity()}ngOnInit(){S.uZ.locale=this.locale,this.ddnsForm=this._ddnsBuilder.group({subdomain:[null,S.dt.required(this.locale.maketext("You must enter a subdomain prefix."))],domain:[null,S.dt.required(this.locale.maketext("You must choose a domain."))],description:[null],ip:[null,S.Xz.anyIP()],stayOnForm:[!1]}),this._fetchAvailableDomains()}ngOnDestroy(){this._domainsSub.unsubscribe(),this._createSub&&this._createSub.unsubscribe()}_fetchAvailableDomains(){const e=this._ddnsService.fetchDomains();this._domainsSub=e.subscribe({next:n=>{this.availableDomains=n.map(i=>`.${i}`),1===n.length&&this.ddnsForm.patchValue({domain:this.availableDomains[0]})},complete:()=>{this.isContentLoading=!1}})}_resetForm(){this.ddnsForm.reset(),1===this.availableDomains.length&&this.ddnsForm.patchValue({domain:this.availableDomains[0]})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(l.c9),t.Y36(Z.g),t.Y36(C.F0),t.Y36(L),t.Y36(u.qu))},o.\u0275cmp=t.Xpm({type:o,selectors:[["cp-ddns-manage-form"]],decls:7,vars:4,consts:[[1,"description",3,"innerHTML"],[1,"row"],["class","col-xs-12 col-md-9",4,"ngIf"],["class","col-xs-12 col-sm-8 col-md-6",4,"ngIf"],[4,"ngIf"],[1,"col-xs-12","col-md-9"],["id","ddnsLoadingSpinner"],[1,"col-xs-12","col-sm-8","col-md-6"],["id","ddnsForm","name","ddnsForm",3,"formGroup"],[1,"panel","panel-default"],[1,"panel-heading"],[1,"widget-title","pull-left","flip"],[1,"pull-right","flip"],["type","button","id","transferAcctShowHideHelp",1,"btn","btn-default","btn-xs",3,"click"],[1,"far","fa-question-circle","form-info-sign"],[1,"clearfix"],[1,"panel-body"],["id","ddnsDataSection"],[1,"form-group"],[1,"col-xs-12"],["id","ddnsSubdomainLabel","for","ddnsSubdomain",3,"showInfoBlock","labelText"],["name","ddnsSubdomain","formControlName","subdomain","autocomplete","off","id","ddnsSubdomainInput",1,"form-control","domainInputs",3,"placeholder","keyup"],["id","ddnsDomainSelector","formControlName","domain",1,"domainInputs",3,"readonly","clearable","items","placeholder","notFoundText"],["id","subdomainInputsValidationContainer",3,"control"],["id","domainInputsValidationContainer",3,"control"],["type","button","id","showIPInputBtn",1,"btn","btn-link",3,"click"],["class","fas fa-chevron-right","aria-hidden","true",4,"ngIf"],["class","fas fa-chevron-down","aria-hidden","true",4,"ngIf"],["class","form-group",4,"ngIf"],["id","ddnsDescriptionLabel","for","ddnsDescription",3,"showInfoBlock","labelText"],["name","ddnsDescription","formControlName","description","id","ddnsDescriptionInput",1,"form-control",3,"placeholder"],[1,"panel-footer"],[1,"checkbox","create-email-checkbox"],["type","checkbox","formControlName","stayOnForm","name","stayOnForm","id","stayOnForm"],[1,"separator"],["id","submitDDNSFormBtn","type","submit",3,"buttonClass","buttonState","click"],["class","fas fa-plus","aria-hidden","true",4,"ngIf"],["id","cancelDDNSFormBtn","type","button",1,"btn","btn-link","pull-right","flip",3,"title","click"],["aria-hidden","true",1,"fas",3,"ngClass"],["aria-hidden","true",1,"fas","fa-chevron-right"],["aria-hidden","true",1,"fas","fa-chevron-down"],["id","ddnsIPInputLabel","for","ddnsIPInput",3,"showInfoBlock","labelText"],["name","ddnsIPInput","formControlName","ip","id","ddnsIPInput",1,"form-control",3,"placeholder"],["id","ipInputValidationContainer",3,"control"],["aria-hidden","true",1,"fas","fa-plus"]],template:function(e,n){1&e&&(t.TgZ(0,"section"),t._UZ(1,"p",0),t.qZA(),t.TgZ(2,"div",1),t._UZ(3,"cp-alert-list"),t.YNc(4,ft,2,0,"div",2),t.YNc(5,kt,52,31,"div",3),t.YNc(6,Tt,1,0,"cp-ddns-resources",4),t.qZA()),2&e&&(t.xp6(1),t.Q6J("innerHTML",n.descriptionText,t.oJD),t.xp6(3),t.Q6J("ngIf",n.isContentLoading),t.xp6(1),t.Q6J("ngIf",!n.isContentLoading),t.xp6(1),t.Q6J("ngIf",!n.isContentLoading))},directives:[l.hF,h.O5,l.go,u._Y,u.JL,u.sg,l._P,u.Fj,u.JJ,u.u,q.w9,l.fm,u.Wl,l.xV,h.mk,P],encapsulation:2}),o})();var Dt=c(8635);function Zt(o,s){1&o&&(t.TgZ(0,"div",6),t._UZ(1,"cp-loading-spinner",7),t.qZA())}function Lt(o,s){if(1&o&&(t.TgZ(0,"cp-callout",8)(1,"span",9),t._uU(2),t.qZA(),t._uU(3),t.qZA()),2&o){const e=t.oxw();t.xp6(2),t.Oqu(e.locale.maketext("Self-Signed Certificate")),t.xp6(1),t.hij(" ",e.locale.maketext("This is a self-signed certificate. Using this certificate will not be secure.")," ")}}function yt(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"div",21)(1,"cp-form-label",37),t._uU(2),t.qZA(),t.TgZ(3,"figure",38)(4,"pre",null,39),t._uU(6),t.qZA()(),t.TgZ(7,"div",1)(8,"div",25)(9,"a",40),t.NdJ("click",function(){t.CHM(e);const i=t.oxw(2);return i.copyTextToClipboard(i.cabundle)}),t.TgZ(10,"span",27),t._uU(11),t.qZA(),t._UZ(12,"i",28),t.qZA()()()()}if(2&o){const e=t.oxw(2);t.xp6(1),t.Q6J("showInfoBlock",e.showAllHelp)("labelText",e.locale.maketext("Certificate Authority Bundle")),t.xp6(1),t.hij(" ",e.locale.maketext("This is the certificate\u2019s Certificate Authority Bundle.")," "),t.xp6(4),t.Oqu(e.sslConfig.cabundle),t.xp6(5),t.Oqu(e.copyBtnText)}}function At(o,s){if(1&o){const e=t.EpF();t.TgZ(0,"div",10)(1,"form",11)(2,"div",12)(3,"div",13)(4,"div",14),t._uU(5),t.qZA(),t.TgZ(6,"div",15)(7,"button",16),t.NdJ("click",function(){return t.CHM(e),t.oxw().toggleHelp()}),t._uU(8),t._UZ(9,"i",17),t.qZA()(),t._UZ(10,"div",18),t.qZA(),t.TgZ(11,"div",19)(12,"section",20)(13,"div",21)(14,"cp-form-label",22),t._uU(15),t.qZA(),t.TgZ(16,"figure",23)(17,"pre",null,24),t._uU(19),t.qZA()(),t.TgZ(20,"div",1)(21,"div",25)(22,"a",26),t.NdJ("click",function(){t.CHM(e);const i=t.MAs(18);return t.oxw().copyTextToClipboard(i)}),t.TgZ(23,"span",27),t._uU(24),t.qZA(),t._UZ(25,"i",28),t.qZA()()()(),t.TgZ(26,"div",21)(27,"cp-form-label",29),t._uU(28),t.qZA(),t.TgZ(29,"figure",30)(30,"pre",null,31),t._uU(32),t.qZA()(),t.TgZ(33,"div",1)(34,"div",25)(35,"a",32),t.NdJ("click",function(){t.CHM(e);const i=t.MAs(31);return t.oxw().copyTextToClipboard(i)}),t.TgZ(36,"span",27),t._uU(37),t.qZA(),t._UZ(38,"i",28),t.qZA()()()(),t.YNc(39,yt,13,5,"div",33),t.qZA()(),t.TgZ(40,"div",34)(41,"button",35),t.NdJ("click",function(){return t.CHM(e),t.oxw().returnToTable()}),t._UZ(42,"i",36),t._uU(43),t.qZA()()()()()}if(2&o){const e=t.oxw();t.xp6(5),t.hij(" ",e.locale.maketext("Dynamic [asis,DNS] [asis,SSL]")," "),t.xp6(3),t.hij(" ",e.toggleHelpLabel," "),t.xp6(6),t.Q6J("showInfoBlock",e.showAllHelp)("labelText",e.locale.maketext("Certificate")),t.xp6(1),t.hij(" ",e.locale.maketext("This is the [asis,SSL] certificate.")," "),t.xp6(4),t.Oqu(e.sslConfig.cert),t.xp6(5),t.Oqu(e.copyBtnText),t.xp6(3),t.Q6J("showInfoBlock",e.showAllHelp)("labelText",e.locale.maketext("Private Key")),t.xp6(1),t.hij(" ",e.locale.maketext("This is the certificate\u2019s private key.")," "),t.xp6(4),t.Oqu(e.sslConfig.key),t.xp6(5),t.Oqu(e.copyBtnText),t.xp6(2),t.Q6J("ngIf",e.sslConfig.cabundle),t.xp6(2),t.s9C("title",e.locale.maketext("Go back to the list of dynamic [asis,DNS] configurations.")),t.xp6(1),t.Q6J("ngClass",e.returnArrowDir),t.xp6(1),t.hij(" ",e.locale.maketext("Go Back")," ")}}function It(o,s){1&o&&t._UZ(0,"cp-ddns-resources")}let Nt=(()=>{class o{constructor(e,n,i,a,r){this.locale=e,this._ddnsService=n,this._router=i,this._activatedRoute=a,this._alertService=r,this.isContentLoading=!0,this.showAllHelp=!0}get descriptionText(){return`${this.locale.maketext("Use this interface to view the contents of the [asis,SSL] certificate for your dynamic [asis,DNS] (DDNS) domain. You can copy the contents to your DDNS-enabled device.")} ${this.locale.maketext("For more information, read the [output,url,_1,feature documentation,class,externalLink,target,_2,id,_3].","https://go.cpanel.net/cpaneldocsDynamicDNS","cp-dynamic-dns-docs","linkDynamicDNSDocumentation")}`}get returnArrowDir(){return this.locale.isRtl?v.right:v.left}get showSelfSignedCertMessage(){return!this.isContentLoading&&this.sslConfig.isSelfSigned}get sslConfig(){return this._sslConfig}set sslConfig(e){this._sslConfig=e}get toggleHelpLabel(){return this.locale.maketext(this.showAllHelp?"Hide Help Text":"Show Help Text")}copyTextToClipboard(e){const n=document.createElement("textarea");n.value=e.textContent,document.body.appendChild(n),n.select(),document.execCommand("copy")?this._alertService.success(this.locale.maketext("Successfully copied to the clipboard.")):this._alertService.error(this.locale.maketext("Copy failed.")),document.body.removeChild(n)}returnToTable(){this._router.navigate(["list"])}toggleHelp(){this.showAllHelp=!this.showAllHelp}ngOnInit(){this.copyBtnText=this.locale.maketext("Copy"),this._activatedRoute.queryParams.subscribe(e=>{this._getSSLCert(e.cert_id)})}ngOnDestroy(){this._sslSubs.unsubscribe()}_getSSLCert(e){const n=this._ddnsService.getSSLCert(e);this._sslSubs=n.subscribe({next:i=>{this.sslConfig={id:e,key:i.key,cert:i.certificate,cabundle:i.cabundle?i.cabundle:"",isSelfSigned:(0,Dt.s)(i.is_self_signed)}},complete:()=>{this.isContentLoading=!1},error:i=>{this._alertService.error(i),this.isContentLoading=!1}})}}return o.\u0275fac=function(e){return new(e||o)(t.Y36(Z.g),t.Y36(L),t.Y36(C.F0),t.Y36(C.gz),t.Y36(l.c9))},o.\u0275cmp=t.Xpm({type:o,selectors:[["cp-ddns-ssl"]],decls:9,vars:5,consts:[[1,"description",3,"innerHTML"],[1,"row"],["class","col-xs-12 col-md-9",4,"ngIf"],["id","selfSignedCertCallout","calloutType","warning","class","col-xs-12 col-sm-8 col-md-6",4,"ngIf"],["class","col-xs-12 col-sm-8 col-md-6",4,"ngIf"],[4,"ngIf"],[1,"col-xs-12","col-md-9"],["id","ddnsSSLLoadingSpinner"],["id","selfSignedCertCallout","calloutType","warning",1,"col-xs-12","col-sm-8","col-md-6"],["callout-heading",""],[1,"col-xs-12","col-sm-8","col-md-6"],["id","ddnsSSLForm"],[1,"panel","panel-default"],[1,"panel-heading"],[1,"widget-title","pull-left","flip"],[1,"pull-right","flip"],["type","button","id","transferAcctShowHideHelp",1,"btn","btn-default","btn-xs",3,"click"],[1,"far","fa-question-circle","form-info-sign"],[1,"clearfix"],[1,"panel-body"],["id","ddnsCertSection"],[1,"form-group"],["id","ddnsSSLCertLabel","for","ddnsSSLCert",3,"showInfoBlock","labelText"],["id","ddnsSSLCert","aria-labelledby","ddnsSSLCertLabel"],["certText",""],[1,"col-xs-12","text-right"],["href","javascript:void(0)",1,"btn","btn-sm","btn-link",3,"click"],[1,"clipboardBtn"],["aria-hidden","true",1,"fas","fa-copy"],["id","ddnsSSLKeyLabel","for","ddnsSSLKey",3,"showInfoBlock","labelText"],["id","ddnsSSLKey","aria-labelledby","ddnsSSLKeyLabel"],["keyText",""],["id","copyKeyBtn","href","javascript:void(0)",1,"btn","btn-sm","btn-link",3,"click"],["class","form-group",4,"ngIf"],[1,"panel-footer"],["id","cancelDDNSSSLFormBtn","type","button",1,"btn","btn-link","flip",3,"title","click"],["aria-hidden","true",1,"fas",3,"ngClass"],["id","ddnsSSLCABundleLabel","for","ddnsSSLCABundle",3,"showInfoBlock","labelText"],["id","ddnsSSLCABundle","aria-labelledby","ddnsSSLCABundleLabel"],["cabundleText",""],["id","copyBundleBtn","href","javascript:void(0)",1,"btn","btn-sm","btn-link",3,"click"]],template:function(e,n){1&e&&(t.TgZ(0,"section"),t._UZ(1,"p",0),t.qZA(),t.TgZ(2,"div",1),t._UZ(3,"cp-alert-list"),t.YNc(4,Zt,2,0,"div",2),t.YNc(5,Lt,4,2,"cp-callout",3),t.qZA(),t.TgZ(6,"div",1),t.YNc(7,At,44,16,"div",4),t.YNc(8,It,1,0,"cp-ddns-resources",5),t.qZA()),2&e&&(t.xp6(1),t.Q6J("innerHTML",n.descriptionText,t.oJD),t.xp6(3),t.Q6J("ngIf",n.isContentLoading),t.xp6(1),t.Q6J("ngIf",n.showSelfSignedCertMessage),t.xp6(2),t.Q6J("ngIf",!n.isContentLoading),t.xp6(1),t.Q6J("ngIf",!n.isContentLoading))},directives:[l.hF,h.O5,l.go,l.Oc,u._Y,u.JL,u.F,l._P,h.mk,P],encapsulation:2}),o})(),Ut=(()=>{class o{constructor(){}}return o.\u0275fac=function(e){return new(e||o)},o.\u0275cmp=t.Xpm({type:o,selectors:[["cp-ddns-root"]],decls:2,vars:0,consts:[[1,"body-content"],["id","ddnsListRouterOutlet",1,"section","animate-view","ng-cloak"]],template:function(e,n){1&e&&(t.TgZ(0,"div",0),t._UZ(1,"router-outlet",1),t.qZA())},directives:[C.lC],styles:[""]}),o})();const Rt=[{path:"create",component:wt,data:{id:"create"}},{path:"ssl",component:Nt,data:{id:"ssl"}},{path:"list",component:B,data:{id:"list"}},{path:"",redirectTo:"list",pathMatch:"full"},{path:"**",component:B,pathMatch:"full"}];let qt=(()=>{class o{}return o.\u0275fac=function(e){return new(e||o)},o.\u0275mod=t.oAB({type:o,bootstrap:[Ut]}),o.\u0275inj=t.cJS({providers:[l.c9,L,U.a],imports:[[l.zr,l.CQ,J.au,M.PW,w.b2,D.mr.forRoot(),l.df,h.ez,l.kM,u.u5,F.JF,l.zf,q.A0,l.RV,l.u3,l.t8,u.UX,l.wL,C.Bz.forRoot(Rt,{useHash:!0,relativeLinkResolution:"legacy"})],C.Bz]}),o})();(0,t.G48)(),w.q6().bootstrapModule(qt).catch(o=>console.error(o))}},T=>{T.O(0,[736],()=>T(T.s=3675)),T.O()}]);
Back to Directory File Manager