(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/email-address/aliases-dynamic"],{1113:(e,n,t)=>{"use strict";t.r(n);var a=t(143);const i=a.Locale.getSection("smb.components.forms.email-address");class o extends a.AddRemoveDynamicSubForm{_initConfiguration(e){super._initConfiguration({addButtonTitle:i.lmsg("buttonAddMailAlias"),removeButtonTitle:i.lmsg("buttonRemoveMailAlias"),...e})}_onInitDynamic(){super._onInitDynamic(),this.domainNameFieldId="general-generalSection-domain",document.getElementById("general-generalSection-domain")||(this.domainNameFieldId="general-vcard-domain"),document.getElementById(this.domainNameFieldId)&&document.getElementById(this.domainNameFieldId).addEventListener("change",(()=>{this.onDomainChange()})),this.onDomainChange()}_isAddButtonDisabled(){try{return Smb.Views.User.isExternalMailUsed()}catch(e){}return!1}_bindDynamicContent(e,n){const t=document.createElement("span");t.className="aliasDomainName";const i=e.querySelectorAll(".field-value input");return(0,a.render)(i[i.length-1],t,"after"),super._bindDynamicContent(e,n)}_initRemoveButtonWrapper(e){const n="".concat(this._removeButtonId,"-").concat(this._getRandomNumber()),t=e.querySelectorAll(".aliasDomainName");return(0,a.render)(t[t.length-1],'<span id="'.concat(n,'" class="').concat(this._removeButtonId,'"></span>'),"after"),n}_onUpdateDynamic(){super._onUpdateDynamic(),this.onDomainChange()}onDomainChange(){const e=this.getDomainName();this._componentElement.querySelectorAll(".aliasDomainName").forEach((n=>{n.innerHTML=" @".concat(e)}))}getDomainName(){const e=this._getConfigParam("domainName");if(e)return e;const n=document.getElementById(this.domainNameFieldId);return"general-vcard-domain"===this.domainNameFieldId?n.value:n.options[n.selectedIndex].text}}n.default=e=>new o(e)}}]);
//# sourceMappingURL=aliases-dynamic.js.map?9965a28e99dc63b8c347