(()=>{var c=class{constructor({clientId:t,...n}={}){this.options={activeClass:"nfd-wb-animated-in",root:null,rootMargin:"0px",threshold:0,...n}}observeElements(t,n=null,e=!1){if(!("IntersectionObserver"in window)||!t?.length||document.documentElement.classList.contains("block-editor-block-preview__content-iframe"))return;function a(r,o){this._mutationCallback(r,o,n)}let i=new IntersectionObserver(this._handleIntersection.bind(this),this.options),d=new MutationObserver(a.bind(this)),b=new MutationObserver(this._handleClassMutation.bind(this));t.forEach(r=>{let o=r;r.classList.contains("nfd-wb-reveal-right")&&(o=r.parentElement),i.observe(o),e&&(b.observe(o,{attributes:!0,attributeFilter:["class"]}),d.observe(o,{attributes:!0,attributeFilter:["class"]}))})}_handleIntersection(t,n){t.forEach(e=>{e.isIntersecting&&(e.target.classList.add(this.options.activeClass),e.target.querySelectorAll(".nfd-wb-animate").forEach(a=>{a.classList.add(this.options.activeClass)}),n.unobserve(e.target))})}_handleClassMutation(t){t.forEach(n=>{if(n?.type==="attributes"){let e=n.target;e.classList.contains("nfd-wb-animated-in")||e.classList.add("nfd-wb-animated-in")}})}_mutationCallback(t,n,e=null){t.forEach(a=>{if(a?.type==="attributes"){let i=a.target;e&&e===i.getAttribute("data-block")&&(i.getAttribute("data-replay-animation")===null&&(i.setAttribute("data-replay-animation",!0),requestAnimationFrame(()=>{i.removeAttribute("data-replay-animation")})),n.disconnect())}})}};document.addEventListener("DOMContentLoaded",()=>{l()});document.addEventListener("wonder-blocks/toolbar-button-added",()=>{l()});document.addEventListener("wonder-blocks/animation-changed",s=>{let t=s?.detail?.clientId;l(t)});document.addEventListener("wonder-blocks/block-order-changed",()=>{l()});function l(s=null){let t=document.body.classList.contains("block-editor-page")||!!s||document.body.classList.contains("block-editor-iframe__body"),n=new c({root:t?document.querySelector(".interface-interface-skeleton__content"):null,threshold:0});requestAnimationFrame(()=>{let e=Array.from(document.getElementsByClassName("nfd-wb-animate"));n.observeElements(e,s,t)})}})();
