(()=>{"use strict";var e={5338:(e,t,o)=>{var c=o(5795);t.H=c.createRoot,c.hydrateRoot},5795:e=>{e.exports=window.ReactDOM}},t={};const o=window.React;var c=function o(c){var n=t[c];if(void 0!==n)return n.exports;var a=t[c]={exports:{}};return e[c](a,a.exports,o),a.exports}(5338);const n=({attributes:e})=>{const{items:t,theme:c,customStyles:n}=e,a=(0,o.useRef)(null);return(0,o.useEffect)((()=>{const e=a.current;if(!e)return;const t=()=>Array.from(e.querySelectorAll("[data-accordion-item]")),o=t()?.[0];o&&o.classList.add("is-open");const c=e=>{const t=e.querySelector("[data-accordion-toggle]"),o=e.querySelector("[data-accordion-content]"),c=t?.querySelector(".accordion-icon");t&&o&&(e.classList.remove("is-open"),o.style.maxHeight="0",t.setAttribute("aria-expanded","false"),c&&(c.textContent="+"))};t().forEach((e=>{const t=e.querySelector("[data-accordion-content]");t&&(e.classList.contains("is-open")?t.style.maxHeight="unset":t.style.maxHeight="0")}));const n=o=>{const n=o.target.closest("[data-accordion-toggle]");if(!n||!e.contains(n))return;const a=n.closest("[data-accordion-item]");a&&(a.classList.contains("is-open")?c(a):(t().forEach((e=>{e!==a&&c(e)})),(e=>{const t=e.querySelector("[data-accordion-toggle]"),o=e.querySelector("[data-accordion-content]"),c=t?.querySelector(".accordion-icon");t&&o&&(e.classList.add("is-open"),o.style.maxHeight="unset",t.setAttribute("aria-expanded","true"),c&&(c.textContent="−"))})(a)))};let r;const i=()=>{clearTimeout(r),r=setTimeout((()=>{const t=e.querySelector("[data-accordion-item].is-open");if(!t)return;const o=t.querySelector("[data-accordion-content]");o&&(o.style.maxHeight="unset")}),200)};return e.addEventListener("click",n),window.addEventListener("resize",i),()=>{e.removeEventListener("click",n),window.removeEventListener("resize",i),clearTimeout(r)}}),[a]),(0,o.createElement)("div",{ref:a,className:`accordion-block accordion-theme-${c}`,style:"custom"!==c?{}:{"--bBlocks-accordion-header-bg":n.headerBgColor,"--bBlocks-accordion-header-text":n.headerTextColor,"--bBlocks-accordion-content-bg":n.contentBgColor,"--bBlocks-accordion-content-text":n.contentTextColor,"--bBlocks-accordion-border-color":n.borderColor,"--bBlocks-accordion-borderWidth":`${n.borderWidth}px`,"--bBlocks-accordion-borderRadius":`${n.borderRadius}px`,"--bBlocks-accordion-headerPadding":`${n.headerPadding}px`,"--bBlocks-accordion-content-padding":`${n.contentPadding}px`,"--bBlocks-accordion-header-font-size":`${n.headerFontSize}px`,"--bBlocks-accordion-content-font-size":`${n.contentFontSize}px`,"--bBlocks-accordion-icon-color":n.iconColor,"--bBlocks-accordion-animation-speed":`${n.animationSpeed}ms`}},(0,o.createElement)("div",{className:"accordion-items"},t.map(((e,t)=>(0,o.createElement)("div",{key:t,className:"accordion-item","data-accordion-item":!0},(0,o.createElement)("button",{className:"accordion-header","data-accordion-toggle":!0,type:"button","aria-expanded":"false"},(0,o.createElement)("span",{dangerouslySetInnerHTML:{__html:e.title},className:"accordion-title"}),(0,o.createElement)("span",{className:"accordion-icon","aria-hidden":"true"},"+")),(0,o.createElement)("div",{className:"accordion-content","data-accordion-content":!0},(0,o.createElement)("div",{className:"accordion-text"},(0,o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.content}}))))))))};document.addEventListener("DOMContentLoaded",(function(){document.querySelectorAll(".wp-block-b-blocks-accordion-block").forEach((e=>{const t=JSON.parse(e.dataset.attributes);(0,c.H)(e).render((0,o.createElement)(o.Fragment,null,(0,o.createElement)(n,{attributes:t}))),e?.removeAttribute("data-attributes")}))}))})();