"),He=x("
");function Ye(e){let n,t,r,i,s,a;const o=U(),[l,{setIndex:c,setIsAnimating:u,setIsScrollLocked:g}]=j(),d=V(()=>oe(e.loadingText));let h=-1,b=!1,$="none";const[_,O]=B(!1),[m,Y]=B(!1),[ce,ue]=je(Array(o().length).fill(!1)),fe=()=>{!_()||!b||(S(i),S(s),Ue({gsap:n,curtain:i,gallery:s,setIsAnimating:u,setIsScrollLocked:g}))},de=()=>{S(s),S(i),ze({gsap:n,curtain:i,gallery:s,setIsAnimating:u,setIsScrollLocked:g,onClosed:()=>{h=-1}})},ge=()=>{const f=l.index();ue(pe(Ke(f,o().length,$)),!0)},q=f=>{!m()||t===void 0||(ge(),t.slideTo(f,0))},X=async()=>{if(r!==void 0)return await r;r=(async()=>{try{const[f,y]=await Promise.all([K(),Be()]);n=f,S(a,"galleryInner is not defined"),t=new y(a,{spaceBetween:20}),t.on("slideChange",({realIndex:D})=>{c(D)}),O(!0),Y(!0);const L=Se(l.index);L>=0&&(q(L),h=L)}catch(f){r=void 0,Y(!1),console.log(f)}})(),await r};return H(()=>{window.addEventListener("touchstart",()=>{X()},{once:!0,passive:!0}),b=!0}),C(M(()=>[m(),l.index()],([f,y])=>{!f||y<0||y!==h&&(h===-1?$="none":yh?$="next":$="none",q(y),h=y)})),C(M(()=>l.isOpen(),async f=>{f&&!m()&&await X(),!(!_()||!m())&&(l.isAnimating()||(f?fe():de()))},{defer:!0})),[(()=>{var f=Ve(),y=f.firstChild,L=y.firstChild,D=s;typeof D=="function"?I(D,f):s=f;var J=a;return typeof J=="function"?I(J,y):a=y,v(L,p(te,{get each(){return o().images},children:(ye,ve)=>(()=>{var Q=He();return v(Q,p(Re,{get load(){return ce[ve()]},ij:ye,get loadingText(){return d()}})),Q})()})),v(f,p(Ne,{get closeText(){return e.closeText}}),null),f})(),(()=>{var f=We(),y=i;return typeof y=="function"?I(y,f):i=f,f})()]}function Xe(e){const n=U(),[t]=j();return C(()=>{const r=document.getElementsByClassName("container").item(0);r!==null&&(t.isScrollLocked()?r.classList.add("disableScroll"):r.classList.remove("disableScroll"))}),Ae(()=>{document.getElementsByClassName("container").item(0)?.classList.remove("disableScroll")}),p(xe,{get when(){return n().length>0},get children(){return[p(Le,{}),p(Ye,{get closeText(){return e.closeText},get loadingText(){return e.loadingText}})]}})}export{Xe as default};