import{c as e,o as t,a as n,t as s,i,b as a,s as o,u as r,d as c,e as l,f as d,g,F as u,h,j as m,l as v,k as p,m as y,n as w,p as f,S as x}from"./main.js";var I=s("
");function A(s){let r;const[c,l]=e({x:0,y:0}),d=e=>{const{clientX:t,clientY:n}=e;l({x:t,y:n})};return t(()=>{r=new AbortController;const e=r.signal;window.addEventListener("mousemove",d,{passive:!0,signal:e})}),n(()=>{null==r||r.abort()}),u=(g=I()).firstChild,i(u,()=>s.cursorText()),a(e=>{var t=!!s.active(),n=`translate3d(${c().x}px, ${c().y}px, 0)`;return t!==e.e&&g.classList.toggle("active",e.e=t),n!==e.t&&o(g,"transform",e.t=n),e},{e:void 0,t:void 0}),g;var g,u}const E=document.getElementsByClassName("threshold")[0],O=Array.from(E.getElementsByClassName("num")),T=E.getElementsByClassName("dec").item(0),H=E.getElementsByClassName("inc").item(0),L=document.getElementsByClassName("index").item(0),b=Array.from(L.getElementsByClassName("num"));function C(){const[e,{incThreshold:t,decThreshold:n}]=r();return c(()=>{var t,n,s;t=l(e().index+1),n=l(e().length),b.forEach((e,s)=>{e.innerText=s<4?t[s]:n[s-4]}),s=l(e().threshold),O.forEach((e,t)=>{e.innerText=s[t]})}),T.onclick=n,H.onclick=t,null}var k=s("
"),N=s("");function $(e){return e.map(e=>e.i)}function U(e,t){return function(e,t){return $(e).slice(-t.trailLength)}(e,t).slice(0,-1)}function V(e){return $(e).slice(-1)[0]}function j(e,t){return w(e.slice(-1)[0].i,t.length)}function W(e,t){return y(e.slice(-1)[0].i,t.length)}function B(e,t){return t.map(t=>e[t])}function M(e){e.forEach(e=>{e.src!==e.dataset.hiUrl&&(e.src=e.dataset.hiUrl,e.height=parseInt(e.dataset.hiImgH),e.width=parseInt(e.dataset.hiImgW))})}function F(e){e.forEach(e=>{e.src!==e.dataset.loUrl&&(e.src=e.dataset.loUrl,e.height=parseInt(e.dataset.loImgH),e.width=parseInt(e.dataset.loImgW))})}function X(e){let n;const s=Array(e.ijs.length);let o,l={x:0,y:0},p=!1;const[y,{incIndex:w}]=r(),f=y().length;let x=!1;const I=t=>{if(e.isOpen()||e.isAnimating()||!p||!x)return;const n={x:t.clientX,y:t.clientY};if(Math.hypot(n.x-l.x,n.y-l.y)>y().threshold){l=n,w();const t={i:y().index,...n};e.setCordHist(e=>[...e,t].slice(-f))}},A=()=>{!e.isAnimating()&&e.setIsOpen(!0)};function E(t){if(x&&p)if(t.complete)n.set(t,{opacity:1}).then(()=>{e.setIsLoading(!1)}).catch(e=>{console.log(e)});else{e.setIsLoading(!0);const s=new AbortController,i=s.signal;t.addEventListener("load",()=>{n.to(t,{opacity:1,ease:"power3.out",duration:.5}).then(()=>{e.setIsLoading(!1)}).catch(e=>{console.log(e)}).finally(()=>{s.abort()})},{once:!0,passive:!0,signal:i}),t.addEventListener("error",()=>{n.set(t,{opacity:1}).then(()=>{e.setIsLoading(!1)}).catch(e=>{console.log(e)}).finally(()=>{s.abort()})},{once:!0,passive:!0,signal:i})}}return t(()=>{s.forEach((t,n)=>{n<5&&(t.src=t.dataset.loUrl),function(e,t,n={attributes:!0}){new MutationObserver((e,n)=>{for(const s of e)if(t(s)){n.disconnect();break}}).observe(e,n)}(t,i=>!e.isOpen()&&!e.isAnimating()&&"style"===i.attributeName&&1===parseFloat(t.style.opacity)&&(n+5{v().then(e=>{n=e,p=!0}).catch(e=>{console.log(e)})},{passive:!0,once:!0}),o=new AbortController;const t=o.signal;window.addEventListener("mousemove",I,{passive:!0,signal:t}),x=!0}),c(d(()=>e.cordHist(),()=>{(()=>{if(!x)return;if(0===s.length)return;const t=e.cordHist(),i=$(t);if(0===i.length)return;const a=B(s,i),o=e.isOpen(),r=y();if(n.set(a,{x:e=>t[e].x-window.innerWidth/2,y:e=>t[e].y-window.innerHeight/2,opacity:e=>Math.max((e+1+r.trailLength<=t.length?0:1)-(o?1:0),0),zIndex:e=>e,scale:.6}),o){const i=B(s,[V(t)])[0],a=[],o=[];switch(e.navVector()){case"prev":a.push(j(t,r)),o.push(W(t,r));break;case"next":a.push(W(t,r)),o.push(j(t,r))}M(B(s,a)),n.set(B(s,o),{opacity:0}),n.set(i,{x:0,y:0,scale:1}),E(i)}else F(a)})()},{defer:!0})),c(d(()=>e.isOpen(),async()=>{e.isAnimating()||(e.isOpen()?await(async()=>{if(!x||!p)throw new Error("not mounted or gsap not loaded");e.setIsAnimating(!0);const t=e.cordHist(),i=y(),a=V(t),o=s[a];M(B(s,[a,j(t,i),W(t,i)])),E(o);const r=n.timeline(),c=B(s,U(t,i));return r.to(c,{y:"+=20",ease:"power3.in",stagger:.075,duration:.3,delay:.1,opacity:0}),r.to(o,{x:0,y:0,ease:"power3.inOut",duration:.7,delay:.3}),r.to(o,{delay:.1,scale:1,ease:"power3.inOut"}),await r.then(()=>{e.setIsAnimating(!1)})})().catch(()=>{}).then(()=>{null==o||o.abort()}):await(async()=>{if(!x||!p)throw new Error("not mounted or gsap not loaded");e.setIsAnimating(!0),e.setNavVector("none");const t=e.cordHist(),i=y(),a=V(t),o=U(t,i);F(B(s,[...o,a]));const r=n.timeline(),c=B(s,[a])[0],l=B(s,o);return r.to(c,{scale:.6,duration:.6,ease:"power3.inOut"}),r.to(c,{delay:.3,duration:.7,ease:"power3.inOut",x:t.slice(-1)[0].x-window.innerWidth/2,y:t.slice(-1)[0].y-window.innerHeight/2}),r.to(l,{y:"-=20",ease:"power3.out",stagger:-.1,duration:.3,opacity:1}),await r.then(()=>{e.setIsAnimating(!1)})})().catch(()=>{}).then(()=>{o=new AbortController;const t=o.signal;window.addEventListener("mousemove",I,{passive:!0,signal:t}),e.setIsLoading(!1)}))},{defer:!0})),(O=k()).$$keydown=A,O.$$click=A,i(O,g(u,{get each(){return e.ijs},children:(e,t)=>{return n=N(),"function"==typeof(i=s[t()])?h(i,n):s[t()]=n,a(t=>{var s=e.loImgH,i=e.loImgW,a=e.hiUrl,o=e.hiImgH,r=e.hiImgW,c=e.loUrl,l=e.loImgH,d=e.loImgW,g=e.alt;return s!==t.e&&m(n,"height",t.e=s),i!==t.t&&m(n,"width",t.t=i),a!==t.a&&m(n,"data-hi-url",t.a=a),o!==t.o&&m(n,"data-hi-img-h",t.o=o),r!==t.i&&m(n,"data-hi-img-w",t.i=r),c!==t.n&&m(n,"data-lo-url",t.n=c),l!==t.s&&m(n,"data-lo-img-h",t.s=l),d!==t.h&&m(n,"data-lo-img-w",t.h=d),g!==t.r&&m(n,"alt",t.r=g),t},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0}),n;var n,i}})),O;var O}p(["click","keydown"]);var Y=s("