const d={invite:{checkboxSelector:".basic-permission",idPrefix:"perm_"},edit:{checkboxSelector:".edit-basic-permission",idPrefix:"edit_perm_"}};function a(s,c){const e=d[s];e&&(document.querySelectorAll(e.checkboxSelector).forEach(t=>{t.disabled||(t.checked=!1)}),c.forEach(t=>{const r=document.getElementById(e.idPrefix+t);r&&!r.disabled&&(r.checked=!0)}))}document.addEventListener("DOMContentLoaded",()=>{const s=Array.isArray(window.permissionPresets)?window.permissionPresets:[],c=Object.fromEntries(s.map(e=>[e.key,e.permissions||[]]));document.querySelectorAll("button.apply-preset").forEach(e=>{e.addEventListener("click",()=>{var o;const t=e.getAttribute("data-preset"),r=e.getAttribute("data-scope")||"invite",i=c[t];i&&(a(r,i),(o=e.parentElement)==null||o.querySelectorAll("button.apply-preset").forEach(n=>n.classList.remove("active")),e.classList.add("active"))})})});
