"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/email-address/postbox"],{2087:(e,t,n)=>{n.r(t),n.d(t,{default:()=>a});var l=n(90);const a=({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 e=document.getElementById("general-generalSection-postbox").checked;document.getElementById("redirect-redirectSection-remove")&&(document.getElementById("redirect-redirectSection-remove").disabled=!e),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(),u()},u=()=>{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 document.getElementById("general-generalSection-mboxQuotaValue").value="-1"},d=()=>{const{value:t,desc:n}=(()=>{const t=document.getElementById("general-generalSection-domain"),n=t?t.options[t.selectedIndex].value:Object.keys(e)[0];return e[n]})();if(document.getElementById("general-generalSection-text-default").innerHTML=o.lmsg("mailBoxQuotaDomainDefault",{domainMboxQuota:-1===t?o.lmsg("mailBoxQuotaUnlimited"):n}),document.getElementById("general-generalSection-mboxQuotaValue-specific").checked)return;const l=c(t),a=-1===t?0:Math.round(t/l);document.getElementById("general-generalSection-mboxQuotaValue").value="-1",document.getElementById("general-generalSection-mboxQuotaValue-specific-input").value=a,document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").value=l};(()=>{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}i(),d()})(),document.getElementById("general-generalSection-postbox").addEventListener("click",i),document.getElementById("general-generalSection-mboxQuotaValue-default").addEventListener("click",i),document.getElementById("general-generalSection-mboxQuotaValue-specific").addEventListener("click",i),document.getElementById("general-generalSection-mboxQuotaValue-specific-input").addEventListener("change",u),document.getElementById("general-generalSection-mboxQuotaValue-specific-multiplier").addEventListener("change",u),document.getElementById("general-generalSection-domain")&&document.getElementById("general-generalSection-domain").addEventListener("change",d)}}}]);
//# sourceMappingURL=postbox.js.map?3d4721ecddb2fd9f8db0