(()=>{"use strict";const e=(e,t)=>{const o=e.querySelector(".gkit_accordion_normal_icon.icon-right"),c=e.querySelector(".gkit_accordion_active_icon.icon-right"),l=e.querySelector(".gkit_accordion_normal_icon.icon-left"),s=e.querySelector(".gkit_accordion_active_icon.icon-left");o&&c&&(o.style.display=t?"none":"block",c.style.display=t?"block":"none"),l&&s&&(l.style.display=t?"none":"block",s.style.display=t?"block":"none")},t=t=>{const o=t.target.closest(".gkit-card"),c=o.querySelector(".collapse");var l,s;if((l=t.target.closest(".gkit-accordion").querySelectorAll(".collapse"),s=c,Array.from(l).filter(e=>e.nodeType===Node.ELEMENT_NODE&&e!==s)).forEach(t=>{t.style.maxHeight=null,t.classList.remove("show");const o=t.closest(".gkit-card");o&&(o.classList.remove("active"),e(o,!1))}),c.classList.contains("show")){c.classList.remove("show"),c.style.maxHeight=null,o.classList.remove("active"),e(o,!1);let t=c.parentElement;for(;t;)t.classList.contains("collapse")&&t.classList.contains("show")&&(t.style.maxHeight=t.scrollHeight+"px"),t=t.parentElement}else c.classList.add("show"),o.classList.add("active"),e(o,!0),requestAnimationFrame(()=>{c.style.maxHeight=c.scrollHeight+"px";let e=c.parentElement;for(;e;)e.classList.contains("collapse")&&e.classList.contains("show")&&(e.style.maxHeight=e.scrollHeight+"px"),e=e.parentElement})};window.addEventListener("load",()=>{document.querySelectorAll(".wp-block-gutenkit-advanced-accordion").forEach(e=>{e.querySelectorAll(".gkit-card-header").forEach(e=>{e.addEventListener("click",t)}),e.querySelectorAll(".gkit-accordion .collapse").forEach(e=>{e.classList.contains("show")&&(e.style.maxHeight=`${e.scrollHeight}px`)}),e.querySelectorAll(".gkit-card").forEach(e=>{const t=e.classList.contains("active"),o=e.querySelector(".gkit_accordion_normal_icon.icon-right"),c=e.querySelector(".gkit_accordion_active_icon.icon-right");o&&c&&(o.style.display=t?"none":"block",c.style.display=t?"block":"none");const l=e.querySelector(".gkit_accordion_normal_icon.icon-left"),s=e.querySelector(".gkit_accordion_active_icon.icon-left");l&&s&&(l.style.display=t?"none":"block",s.style.display=t?"block":"none")})});const e=new ResizeObserver(e=>{e.forEach(e=>{const t=e.target;if(t.classList.contains("show")){t.style.maxHeight=t.scrollHeight+"px";let e=t.parentElement;for(;e;)e.classList.contains("collapse")&&e.classList.contains("show")&&(e.style.maxHeight=e.scrollHeight+"px"),e=e.parentElement}})});document.querySelectorAll(".collapse").forEach(t=>e.observe(t))})})();