(window.webpackJsonpPlesk=window.webpackJsonpPlesk||[]).push([["app/email-address/postbox"],{1004:function(e,t,n){"use strict";n.r(t);var l=n(145);t.default=({domainLimits:e,units:t,quotaValue:n,isDefault:a})=>{const o=l.Locale.getSection("smb.components.forms.email-address"),c=e=>{let n=t[0];return t.forEach(t=>{n<t&&Math.round(e/t)*t===e&&(n=t)}),n},i=()=>{const t=document.getElementById("general-generalSection-domain"),n=t?t.options[t.selectedIndex].value:Object.keys(e)[0];return e[n]},u=()=>{const e=document.getElementById("general-generalSection-postbox").checked;document.getElementById("general-generalSection-mboxQuotaValue-default").disabled=!e,document.getElementById("general-generalSection-mboxQuotaValue-specific").disabled=!e,document.getElementById("general-generalSection-mboxQuotaValue-specific-input").disabled=!e||!document.getElementById("general-generalSection-mboxQuotaValue-specific").checked,document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").disabled=!e||!document.getElementById("general-generalSection-mboxQuotaValue-specific").checked,e&&document.getElementById("general-generalSection-mboxQuotaValue-specific").checked&&document.getElementById("general-generalSection-mboxQuotaValue-specific-input").focus(),d()},d=()=>{if(document.getElementById("general-generalSection-postbox").checked)if(document.getElementById("general-generalSection-mboxQuotaValue-specific").checked){const e=document.getElementById("general-generalSection-mboxQuotaValue-specific-input").value;if(/^\d+$/.test(e)){const t=document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").value;document.getElementById("general-generalSection-mboxQuotaValue").value=e*t}else document.getElementById("general-generalSection-mboxQuotaValue").value="error"}else{const{value:e}=i();document.getElementById("general-generalSection-mboxQuotaValue").value=e}},m=()=>{const{value:e,desc:t}=i();if(document.getElementById("general-generalSection-text-default").innerHTML=o.lmsg("mailBoxQuotaDomainDefault",{domainMboxQuota:-1===e?o.lmsg("mailBoxQuotaUnlimited"):t}),document.getElementById("general-generalSection-mboxQuotaValue-specific").checked)return;const n=c(e),l=-1===e?0:Math.round(e/n);document.getElementById("general-generalSection-mboxQuotaValue").value=e,document.getElementById("general-generalSection-mboxQuotaValue-specific-input").value=l,document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").value=n};(()=>{if(!a){const e=c(n);document.getElementById("general-generalSection-mboxQuotaValue-specific-input").value=n/e,document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").value=e}u(),m()})(),document.getElementById("general-generalSection-postbox").addEventListener("click",u),document.getElementById("general-generalSection-mboxQuotaValue-default").addEventListener("click",u),document.getElementById("general-generalSection-mboxQuotaValue-specific").addEventListener("click",u),document.getElementById("general-generalSection-mboxQuotaValue-specific-input").addEventListener("change",d),document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").addEventListener("change",d),document.getElementById("general-generalSection-domain")&&document.getElementById("general-generalSection-domain").addEventListener("change",m)}}}]);
//# sourceMappingURL=postbox.js.map?3e8804aaae72b379dc9d