document.addEventListener("DOMContentLoaded",(function(){const t=document.querySelectorAll(".wp-block-nexa-counter");if(!t.length)return;const e=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),n=new IntersectionObserver((t=>{t.forEach((t=>{if(t.isIntersecting){const r=t.target,o=r.querySelector(".counter-value");if(!o||"true"===o.dataset.animated)return;if(o.dataset.animated="true",!r.dataset.counterValue)return;const a=parseInt(r.dataset.counterValue)||0,u=parseInt(r.dataset.counterDuration)||2e3;let s=null;const c=t=>{s||(s=t);const i=t-s,l=Math.min(i/u,1),d=Math.floor(l*a);o.textContent=e(d),l<1?requestAnimationFrame(c):(o.textContent=e(a),n.unobserve(r))};requestAnimationFrame(c)}}))}),{root:null,rootMargin:"0px",threshold:.1});t.forEach((t=>{n.observe(t)}))}));