(()=>{function e(e,t,i,a,c,n,r,o){var l=this,f="https://management";function d(){n.getCertificate().then(m).then(s)}function m(e){_.get(e,"error")||!e?l.certificate=void 0:(l.certificate=_.pick(e,["cn","activated","licensePresent"]),l.certificate.serialNumber=_.get(e,"serialNumber").replace(/(.{2})/g,"$1 "),l.certificate.validFrom=u(_.get(e,"validFrom")),l.certificate.validTo=u(_.get(e,"validTo")),l.newDomainName=(e=>e&&/^\*./.test(e)?(l.validWildcard=!0,_.replace(e,"*",f)):(a.add({text:t("Replace certificate please. Make sure that you upload a valid SSL wildcard certificate with proper common name. Activation for this certificate is disabled."),type:"danger"}),l.validWildcard=!1,e))(_.get(l,"certificate.cn")))}function s(){l.certificate&&n.getDnsEntry().then(function(e){l.dnsEntry=e})}function u(e){return moment({y:e.year,M:e.monthOfYear-1,d:e.dayOfMonth,h:e.hourOfDay,m:e.minuteOfHour}).format("lll")}_.assign(l,{showUploadModal:function(){var e={title:t("SSL certificate upload"),templateUrl:":::PLUGIN_PATH:::/sslCertificate/certificateUpload.html",scope:c};return i(e)},saveCertificate:function(e,t){n.saveCertificate(e,l.certificate).then(t.$dismiss).then(d)},deleteCertificate:function(){var e={title:t("Delete certificate"),status:"danger",labels:{ok:t("Delete")}};return i(e).then(n.deleteCertificate).then(function(){a.success(t("Certificate deleted.")),m()})},activateCertificate:function(){return o.open({component:"c8yCertificateActivation",resolve:{domainName:function(){return l.domainName}}})},deactivateCertificate:function(){return o.open({component:"c8yCertificateDeactivation"})},$onInit:function(){r.current().then(function(e){e=e.domainName;l.domainName=e}),d(),n.hasCustomLoadBalancer().then(function(e){l.customLoadBalancerOff=!e})},validWildcard:!0})}e.$inject=["c8yTitle","gettext","c8yModal","c8yAlert","$scope","manageCertificateSvc","c8yTenant","$uibModal"],angular.module("c8y.enterpriseEdition").component("c8yManageCertificateForm",{templateUrl:":::PLUGIN_PATH:::/sslCertificate/manageCertificateForm.html",controller:e,controllerAs:"vm"})})();