(()=>{"use strict";class e{constructor(e){this.marqueeElements=e,this.marqueeElements}addMarqueeAnimation(){this.marqueeElements.forEach(e=>{e.setAttribute("data-animated","true");const t=parseFloat(e.getAttribute("data-speed"))||10,a=e.getAttribute("data-direction")||"normal",n=parseFloat(e.getAttribute("data-content-gap"))||12,o="true"===e.getAttribute("data-pause"),r="true"===e.getAttribute("data-loop"),i=parseInt(e.getAttribute("data-loop-count"),10)||1,s="up"===a||"down"===a,l=s?"marquee-scroll-vertical":"marquee-scroll",c="up"===a?"reverse":"down"===a?"normal":a;e.style.setProperty("--ablocks-block-animation-speed",`${t}s`),e.style.setProperty("--ablocks-block-animation-name",l),e.style.setProperty("--ablocks-block-animation-direction",c),e.style.setProperty("--ablocks-block-content-gap",`${n}px`);const d=e.querySelector(".ablocks-block-marquee__children");if(!d)return;const u=d.cloneNode(!0);if(u.classList.add("ablocks-block-marquee__children-mirror"),u.setAttribute("aria-hidden","true"),e.appendChild(u),requestAnimationFrame(()=>{if(s){const t=d.scrollHeight;e.style.setProperty("--ablocks-block-total-height",`${t+n}px`)}else{const t=d.scrollWidth;e.style.setProperty("--ablocks-block-total-width",`${t+n}px`)}}),r&&i>0){let e=0;const t=()=>{e++,e>=i&&(d.style.animation="none",u.style.animation="none",d.removeEventListener("animationiteration",t),u.removeEventListener("animationiteration",t))};d.addEventListener("animationiteration",t),u.addEventListener("animationiteration",t)}o&&(e.addEventListener("mouseenter",()=>{d.style.animationPlayState="paused",u.style.animationPlayState="paused"}),e.addEventListener("mouseleave",()=>{d.style.animationPlayState="running",u.style.animationPlayState="running"}))})}}document.addEventListener("DOMContentLoaded",()=>{!function(){const t=document.querySelectorAll(".ablocks-block-marquee");window.matchMedia("(prefers-reduced-motion: reduce)").matches||new e(t).addMarqueeAnimation()}()})})();