function bcexpander(){let isBuilder=window.location.href.includes("brickspreview");function toggleExpander(questionElement,duration){questionElement.classList.toggle("bc-expander-active");let answerContainer=questionElement.nextElementSibling;if(questionElement.classList.contains("bc-expander-active")){answerContainer.style.maxHeight=answerContainer.scrollHeight+"px";if(typeof lenisInstance!=='undefined'&&lenisInstance){setTimeout(()=>{lenisInstance.resize()},duration*1000+100)}}else{answerContainer.style.maxHeight=0;if(typeof lenisInstance!=='undefined'&&lenisInstance){setTimeout(()=>{lenisInstance.resize()},duration*1000+100)}}}
function openExpander(questionElement,duration){if(!questionElement.classList.contains("bc-expander-active")){questionElement.classList.add("bc-expander-active");let answerContainer=questionElement.nextElementSibling;answerContainer.style.maxHeight=answerContainer.scrollHeight+"px";if(typeof lenisInstance!=='undefined'&&lenisInstance){setTimeout(()=>{lenisInstance.resize()},duration*1000+100)}}}
function closeExpander(questionElement,duration){if(questionElement.classList.contains("bc-expander-active")){questionElement.classList.remove("bc-expander-active");let answerContainer=questionElement.nextElementSibling;answerContainer.style.maxHeight=0;if(typeof lenisInstance!=='undefined'&&lenisInstance){setTimeout(()=>{lenisInstance.resize()},duration*1000+100)}}}
function closeOthers(wrapper,currentQuestion){let allQuestions=wrapper.querySelectorAll(".bc-expander-question.bc-expander-active");allQuestions.forEach((question)=>{if(question!==currentQuestion){question.classList.remove("bc-expander-active");question.nextElementSibling.style.maxHeight=0}})}
document.querySelectorAll(".wrapper-bc-expander").forEach((wrapper)=>{let questions=wrapper.querySelectorAll(".bc-expander-question");let mode=wrapper.getAttribute("data-mode");let openAtBuilder=wrapper.getAttribute("data-openatbuilder");let duration=parseFloat(wrapper.getAttribute("data-contenttransitionduration"));let openThis=wrapper.getAttribute("data-openthis");let singleOpen=wrapper.getAttribute("data-singleopen");let openAll=wrapper.getAttribute("data-openall");if(openAll=="true"){singleOpen="false";mode="click";questions.forEach((question)=>{question.classList.add("bc-expander-active");let answerContainer=question.nextElementSibling;answerContainer.style.maxHeight=answerContainer.scrollHeight+"px"})}
questions.forEach((question,index)=>{let container=question.closest(".bc-expander-container");if(mode==="hover"){container.addEventListener("mouseenter",()=>{if(singleOpen=="true"){closeOthers(wrapper,question)}
openExpander(question,duration)});container.addEventListener("mouseleave",()=>{if(singleOpen=="false"){closeExpander(question,duration)}});question.setAttribute("tabindex","0");question.addEventListener("keydown",function(event){if(event.key==="Enter"||event.key===" "){event.preventDefault();if(singleOpen=="true"){closeOthers(wrapper,question)}
toggleExpander(question,duration)}})}else{question.addEventListener("click",()=>{if(singleOpen=="true"){closeOthers(wrapper,question)}
toggleExpander(question,duration)});question.setAttribute("tabindex","0");question.addEventListener("keydown",function(event){if(event.key==="Enter"||event.key===" "){event.preventDefault();if(singleOpen=="true"){closeOthers(wrapper,question)}
toggleExpander(question,duration)}})}});if(openThis!=""){questions.forEach((question,index)=>{if(index+1==parseFloat(openThis)){question.classList.add("bc-expander-active");let answerContainer=question.nextElementSibling;answerContainer.style.maxHeight=answerContainer.scrollHeight+"px"}})}
if(openAtBuilder==="true"&&isBuilder){questions.forEach((question)=>{question.classList.add("bc-expander-active");let answerContainer=question.nextElementSibling;answerContainer.style.maxHeight=answerContainer.scrollHeight+"px"})}})}
document.addEventListener("DOMContentLoaded",function(e){if(bricksIsFrontend){bcexpander()}})