(()=>{"use strict";const t=".wp-block-accordion-heading__toggle",e=".wp-block-accordion-item",o=".wp-block-accordion";function r(e,o){e.classList.toggle("is-open",o);const r=e.querySelector(t);r&&r.setAttribute("aria-expanded",o?"true":"false");const c=function(e){const o=e.querySelector(t),r=o?.getAttribute("aria-controls");if(r){const t=document.getElementById(r);if(t)return t}return e.querySelector(".wp-block-accordion-panel")}(e);c&&(o?c.removeAttribute("inert"):c.setAttribute("inert",""))}document.addEventListener("click",c=>{const n=c.target.closest(t);if(!n||!n.closest(".modern-fields-content-area"))return;const s=n.closest(e),i=n.closest(o);if(!s||!i)return;c.stopImmediatePropagation();const a=!s.classList.contains("is-open");a&&function(t){try{const e=JSON.parse(t.getAttribute("data-wp-context")||"{}");return Boolean(e.autoclose)}catch{return!1}}(i)&&function(t){return Array.from(t.querySelectorAll(e)).filter(e=>e.closest(o)===t)}(i).filter(t=>t!==s).forEach(t=>r(t,!1)),r(s,a)},!0)})();