((t,e,i,l,s)=>{"use strict";let a,n,r,o,u=null,p=null,c="builder-parallax-scrolling",h=new Map,f=new Set,g=!!e.Notification,m=t=>{const e=themify_vars.breakpoints;let i="desktop";return t<=e.mobile?i="mobile":t<=e.tablet[1]?i="tablet":t<=e.tablet_landscape[1]&&(i="tablet_landscape"),i},d=()=>{s(r),r=l((()=>{for(let[t,e]of h)e&&t?.isConnected?!0!==e.visible&&!1!==g||!t.classList.contains(c)||e.update():e?.destroy()}))},b=t=>{t&&(clearTimeout(o),o=setTimeout((()=>{s(n),n=l((()=>{const e=m(t.w);for(let[t,i]of h)if(i&&t?.isConnected){if(a!==e){if(!i.isInBreakpoint()){f.add(i),i?.destroy();continue}i.getImage().catch((()=>{i?.destroy()}))}}else i?.destroy();if(a!==e){a=e;for(let t of f)t.el.isConnected?t.isInBreakpoint()&&(t.init(),f.delete(t)):f.delete(t)}n=o=null}))}),20))};class x{constructor(e){t.is_builder_active?h.get(e)?.destroy():e.removeAttribute("data-parallax-bg"),this.el=e,this.isInBreakpoint()?this.init():(e.classList.remove(c),f.add(this)),null===p&&(p=!0,t.on("tfsmartresize",b))}init(){const t=this.el;this.pos=null,null===u&&(u=new IntersectionObserver((t=>{for(let e=t.length-1;e>-1;--e){let i=t[e].target,l=!0===t[e].isIntersecting&&i.classList.contains(c),s=h.get(i);!0!==l||s.pos||(s.setPos(),s.update()),s.visible=l}}),{rootMargin:"10px 0px 10px 0px"}),e.tfOn("scroll",d,{passive:!0})),this.getImage().then((()=>{t.classList.add(c),h.set(t,this),!0===g&&u.observe(t)})).catch((()=>{}))}setPos(){this.pos=i(this.el).getPropertyValue("background-position-y")||"50%"}isInBreakpoint(){return"parallax"===i(this.el).getPropertyValue("--tbBg")}getImage(){return new Promise(((t,e)=>{let l=i(this.el).getPropertyValue("background-image");if(l&&"none"!==l&&"initial"!==l&&"unset"!==l){if(l=l.replace(/(url\(|\)|")/g,""),/\.(jpg|jpeg|png|webp|avif|gif|svg|apng)$/.test(l)){const i=new Image;i.src=l,i.decode().then((()=>{if(g)this.visible&&this.setPos();else{this.setPos();const t=this.el.offsetHeight,e=t>1e3?70:t>800?60:50;this.el.style.backgroundSize="auto calc("+(100+parseInt(this.pos))+"% + "+e+"px)",this.update()}t()})).catch((t=>{console.error("Parrallax("+l+"): "+t),e()}))}}else e()}))}destroy(){const i=this.el;this.pos=null,h.delete(i),i.classList.remove(c),i.style.backgroundSize=i.style.backgroundPositionY="",u.unobserve(i),0===h.size&&(u.disconnect(),e.tfOff("scroll",d,{passive:!0}),0===f.size&&(t.off("tfsmartresize",b),p=null),u=null)}update(){l((()=>{this.el.style.backgroundPositionY="calc("+this.pos+" + "+(.1*this.el.getBoundingClientRect().top+.5<<0)+"px)"}))}}a=m(t.w),t.on("builder_load_module_partial",((e,i)=>{let l;if(!0===i){if(!e.hasAttribute("data-parallax-bg"))return;l=[e]}else l=t.selectWithParent("[data-parallax-bg]",e);for(let t=l.length-1;t>-1;--t)new x(l[t])}))})(Themify,window,getComputedStyle,requestAnimationFrame,cancelAnimationFrame);