document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelector(".wp-block-nexa-progress-bar");if(!e)return;const t=e.querySelector(".progress-bar-inner");if(!t)return;const n=parseInt(t.dataset.value,10),r=t.querySelector(".bar-value");let i={isAnimating:!1,currentValue:0,intervalId:null};function a(){i.currentValue=0,r.textContent="0%",i.intervalId&&clearInterval(i.intervalId),i.isAnimating||(i.isAnimating=!0,i.intervalId=setInterval((()=>{if(i.currentValue>=n)return clearInterval(i.intervalId),i.intervalId=null,void(i.isAnimating=!1);i.currentValue++,r.textContent=i.currentValue+"%"}),10))}function l(){i.intervalId&&(clearInterval(i.intervalId),i.intervalId=null),i.isAnimating=!1,i.currentValue=0,r.textContent="0%"}const c=new IntersectionObserver((e=>{e.forEach((e=>{e.isIntersecting?(t.classList.add("active"),l(),a()):(t.classList.remove("active"),l())}))}),{threshold:.1,rootMargin:"0px"});c.observe(t);const o=t.getBoundingClientRect();return o.top<window.innerHeight&&o.bottom>0&&(t.classList.add("active"),a()),()=>{c.disconnect(),l()}}));