@ssgoi/core 5.2.0 → 5.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var at=Object.defineProperty;var ct=(e,n,t)=>n in e?at(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>ct(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./types.cjs"),X=require("./spring-integrator-95Mh7mdw.cjs"),lt=require("./provider-BKaONTeg.cjs");class ut{constructor(){d(this,"listeners",new Set);d(this,"rafId",null);d(this,"isRunning",!1);d(this,"startTime",Date.now());d(this,"lastUpdate",this.startTime);d(this,"elapsed",0);d(this,"lagThreshold",500);d(this,"adjustedLag",33);d(this,"maxDeltaTime",33);d(this,"gap",1e3/240);d(this,"nextTime",this.gap);d(this,"tick",()=>{const n=Date.now();let i=n-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=n;const r=n-this.startTime,o=r-this.nextTime;if(o>0){const s=i/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(f=>{f(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(n){return this.listeners.add(n),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(n)}}unsubscribe(n){this.listeners.delete(n),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(n,t){this.lagThreshold=n,this.adjustedLag=Math.min(t,n)}fps(n){this.gap=1e3/n,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const _=new ut;function ft(e){const{integrator:n,from:t,to:i,velocity:r=0,onUpdate:o,onComplete:s,onStart:f}=e;let l={position:t,velocity:r},m=!0,h=0,v=!1;const A=S=>{if(m){if(v||(v=!0,f==null||f()),l=n.step(l,i,S),n.isSettled(l,i)){if(h+=Math.min(S,.033),h>=X.SETTLE_THRESHOLD){l={position:i,velocity:0},m=!1,o(l.position),_.unsubscribe(A),s();return}}else h=0;o(l.position)}};return _.subscribe(A),{stop:()=>{m&&(m=!1,_.unsubscribe(A))},getPosition:()=>l.position,getVelocity:()=>l.velocity,isRunning:()=>m}}const L=1e3/60;function mt(e,n,t,i=0){let o={position:n,velocity:i},s=0;const f=[];for(let l=0;l<600;l++){const m=l*L;if(f.push({time:m,position:o.position,velocity:o.velocity}),o=e.step(o,t,L/1e3),e.isSettled(o,t)){if(s+=L/1e3,s>=X.SETTLE_THRESHOLD){f.push({time:(l+1)*L,position:t,velocity:0});break}}else s=0}return f}function Y(e,n){if(e.length===0)return{position:0,velocity:0};const t=e[0],i=e[e.length-1];if(n<=0)return{position:t.position,velocity:t.velocity};if(n>=i.time)return{position:i.position,velocity:i.velocity};let r=0,o=e.length-1;for(;r<o-1;){const m=Math.floor((r+o)/2);e[m].time<=n?r=m:o=m}const s=e[r],f=e[o],l=(n-s.time)/(f.time-s.time);return{position:s.position+(f.position-s.position)*l,velocity:s.velocity+(f.velocity-s.velocity)*l}}function dt(e,n){return e.map(t=>n(t.position))}function ht(e){const{integrator:n,element:t,from:i,to:r,velocity:o=0,style:s,onComplete:f,onStart:l}=e,m=mt(n,i,r,o);if(m.length===0)return l==null||l(),f(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=dt(m,s),v=m[m.length-1],A=v.time,S=h[0];if(S)for(const C of Object.keys(S))t.style[C]="";const y=t.animate(h,{duration:A,fill:"forwards",easing:"linear",composite:"replace"});let p=!0;const R=performance.now();return l==null||l(),y.onfinish=()=>{p&&(p=!1,f())},{stop:()=>{p&&(p=!1,y.cancel())},getPosition:()=>{if(!p)return v.position;const C=performance.now()-R;return Y(m,C).position},getVelocity:()=>{if(!p)return 0;const C=performance.now()-R;return Y(m,C).velocity},isRunning:()=>p}}function gt(e){const{element:n,frames:t,duration:i,easing:r="linear",from:o,to:s,onComplete:f,onStart:l}=e,m=t[0];if(m)for(const S of Object.keys(m))S==="offset"||S==="easing"||S==="composite"||(n.style[S]="");const h=n.animate(t,{duration:i,fill:"forwards",easing:r,composite:"replace"});let v=!0;const A=performance.now();return l==null||l(),h.onfinish=()=>{v&&(v=!1,f())},{stop:()=>{v&&(v=!1,h.cancel())},getPosition:()=>{if(!v)return s;const S=performance.now()-A,y=Math.min(Math.max(S/i,0),1);return o+(s-o)*y},getVelocity:()=>0,isRunning:()=>v}}function yt(e){const{to:n,onStart:t,onComplete:i}=e;return t==null||t(),i(),{stop:()=>{},getPosition:()=>n,getVelocity:()=>0,isRunning:()=>!1}}class wt{static from(n){const{tick:t,css:i,keyframes:r}=n;if((t?1:0)+(i?1:0)+(r?1:0)>1)throw new Error("Cannot use more than one of 'tick', 'css', 'keyframes' together");return r?s=>gt({element:r.element,frames:r.frames,duration:r.duration,easing:r.easing,from:s.from,to:s.to,onComplete:s.onComplete,onStart:s.onStart}):i?s=>{if(!s.integrator)throw new Error("css mode requires an integrator");return ht({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,element:i.element,style:i.style})}:t?s=>{if(!s.integrator)throw new Error("tick mode requires an integrator");return ft({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,onUpdate:t})}:yt}}class J{}const pt={stiffness:300,damping:30};class j extends J{constructor(t){super();d(this,"options");d(this,"runner");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);d(this,"updateFn");d(this,"isKeyframesMode");if(this.options={from:t.from??0,to:t.to??1,physics:t.physics,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,this.isKeyframesMode=!!t.keyframes,t.tick)this.updateFn=i=>{var r;return(r=t.tick)==null?void 0:r.call(t,i)};else if(t.css){const{element:i,style:r}=t.css;this.updateFn=o=>{const s=r(o);for(const[f,l]of Object.entries(s))i.style[f]=typeof l=="number"?String(l):l}}else this.updateFn=()=>{};this.runner=wt.from({tick:t.tick,css:t.css,keyframes:t.keyframes})}syncState(){var t;(t=this.updateFn)==null||t.call(this,this.currentValue)}createIntegrator(){const t=this.options.physics;return t!=null&&t.integrator?t.integrator():t!=null&&t.spring||t!=null&&t.inertia?lt.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new X.SpringIntegrator(pt)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator:this.isKeyframesMode?void 0:this.createIntegrator(),from:this.currentValue,to:t,velocity:this.currentVelocity,onStart:this.options.onStart,onComplete:()=>{this.currentValue=t,this.currentVelocity=0,this.isAnimating=!1,this.controls=null,this.options.onComplete()}})}forward(){this.stop(),this.runAnimation(this.options.to)}backward(){this.stop(),this.runAnimation(this.options.from)}reverse(){const t=this.options.from;this.options.from=this.options.to,this.options.to=t,this.isAnimating&&(this.stop(),this.runAnimation(this.options.to))}stop(){this.controls&&(this.currentValue=this.controls.getPosition(),this.currentVelocity=this.controls.getVelocity(),this.controls.stop(),this.controls=null),this.isAnimating=!1}getVelocity(){var t;return((t=this.controls)==null?void 0:t.getVelocity())??this.currentVelocity}getCurrentValue(){var t;return((t=this.controls)==null?void 0:t.getPosition())??this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.getCurrentValue(),velocity:this.getVelocity(),from:this.options.from,to:this.options.to}}setValue(t){this.currentValue=t}setVelocity(t){this.currentVelocity=t}updateOptions(t){this.options={...this.options,...t}}}class z extends J{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"itemOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"from");d(this,"to");d(this,"initialState");this.config=t.config,this.from=t.from,this.to=t.to,this.initialState=t.state??{position:t.from,velocity:0},this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.items.forEach((t,i)=>{const r=this.generateId(),o=new j({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,keyframes:t.keyframes,onComplete:()=>this.onAnimatorComplete(r),onStart:t.onStart});(i===0||t.normalizedOffset===0)&&(o.setValue(this.initialState.position),o.setVelocity(this.initialState.velocity),o.syncState()),this.animators.set(r,{id:r,item:t,animator:o,started:!1}),this.itemOrder.push(r)})}getAnimatorProgress(t){const i=t.animator.getCurrentState(),r=Math.abs(i.to-i.from);return r===0?1:Math.abs(i.position-i.from)/r}getOrderedIds(){return this.direction==="forward"?this.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var r,o,s,f,l,m;const i=this.animators.get(t);!i||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=i.item).onComplete)==null||o.call(r),(f=(s=this.config).onProgress)==null||f.call(s,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(m=(l=this.config).onEnd)==null||m.call(l)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let i=0;i<t.length;i++){const r=t[i],o=this.animators.get(r);if(!o||o.started)continue;if(i===0){this.startAnimator(r);continue}const s=t[i-1],f=this.animators.get(s);if(!f||!f.started)continue;const l=this.getAnimatorProgress(f),m=o.item.normalizedOffset;l>=m&&this.startAnimator(r)}}startAnimator(t){const i=this.animators.get(t);!i||i.started||(i.started=!0,this.direction==="forward"?i.animator.forward():i.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};t()}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var i;const t=this.itemOrder[0];return t?((i=this.animators.get(t))==null?void 0:i.animator)??null:null}forward(){var t,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}backward(){var t,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(i=(t=this.config).onStart)==null||i.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const i=t.animator.getCurrentState();if(i.position===i.to){const o=new j({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,keyframes:t.item.keyframes,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});o.setValue(this.to),o.setVelocity(0),o.syncState(),o.forward(),t.animator=o}else t.animator.reverse()})}getCurrentState(){const t=this.getFirstAnimator();return t?t.getCurrentState():{position:0,velocity:0,from:0,to:1}}getCurrentValue(){const t=this.getFirstAnimator();return(t==null?void 0:t.getCurrentValue())??0}getVelocity(){const t=this.getFirstAnimator();return(t==null?void 0:t.getVelocity())??0}setValue(t){const i=this.getFirstAnimator();i==null||i.setValue(t)}setVelocity(t){const i=this.getFirstAnimator();i==null||i.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,i){return new z({...i,state:t})}}const H=Symbol.for("TRANSITION_STRATEGY"),Q=e=>({runIn:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.out)return{config:await n.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return n.in?{config:await n.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async n=>{const{currentAnimation:t}=e;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),n.in)return{config:await n.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return n.out?{config:await n.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}}),tt=()=>({runIn:async e=>e.in?{config:await e.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"},runOut:async e=>e.out?{config:await e.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),U="data-ssgoi-scope",K="data-ssgoi-scope-ready";function vt(){return e=>{if(e)return e.setAttribute(U,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(K,"true")})}),()=>{}}}function et(e){return e.hasAttribute(K)}function it(e){return e.closest(`[${U}]`)}const St=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n),i=t.overflow+t.overflowY+t.overflowX;if(i.includes("auto")||i.includes("scroll")||n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.parentElement}return document.documentElement},At=e=>{let n=e.parentElement;for(;n&&n!==document.body;){const t=window.getComputedStyle(n).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return n;n=n.parentElement}return document.body};function B(e){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})})}function Tt(e,n){var S;let t=null,i=null,r=null,o=null;const s={get currentAnimation(){return t}},f=((S=n==null?void 0:n.strategy)==null?void 0:S.call(n,s))||Q(s),l=async y=>{var g,E;i&&(i.remove(),i=null);const p=e(),R=p.in&&p.in(y),C=!(n!=null&&n.strategy)&&p.out?p.out(y):void 0;if(!R)return;const w={in:k.normalizeToMultiAnimation(R),out:C?k.normalizeToMultiAnimation(C):void 0},u=await f.runIn(w);if(!u.config){t&&(t.direction="in");return}const a=u.config;(g=a.prepare)==null||g.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var b;t=null,(b=a.onEnd)==null||b.call(a)}},y);a.wait&&await a.wait();const c=z.fromState(u.state,{config:T,from:u.from,to:u.to});t={controller:c,direction:"in"},(E=a.onReady)==null||E.call(a),await B(),u.direction==="forward"?c.forward():c.backward()},m=async y=>{var E,b;i=y;const p=e(),R=!(n!=null&&n.strategy)&&p.in?p.in(y):void 0,C=p.out&&p.out(y);if(!C)return;const w={in:R?k.normalizeToMultiAnimation(R):void 0,out:k.normalizeToMultiAnimation(C)},u=await f.runOut(w);if(!u.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const a=u.config;g(),(E=a.prepare)==null||E.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var P,V;(P=a.onEnd)==null||P.call(a),i&&(i.remove(),i=null),t=null,(V=n==null?void 0:n.onCleanupEnd)==null||V.call(n)}},y);a.wait&&await a.wait();const c=z.fromState(u.state,{config:T,from:u.from,to:u.to});t={controller:c,direction:"out"},(b=a.onReady)==null||b.call(a),await B(),u.direction==="forward"?c.forward():c.backward();function g(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let h=null,v=!1;const A=y=>()=>{if(v)return;v=!0;const p=y.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&m(p)}):m(p)};return y=>{if(y)return requestAnimationFrame(()=>{r=y.parentElement,o=y.nextElementSibling}),v=!1,(n==null?void 0:n.scope)==="local"?queueMicrotask(()=>{h=it(y),!(h&&!et(h))&&l(y)}):l(y),A(y)}}const M=new Map;let I=null,q=!1;function nt(e){if(e instanceof HTMLElement&&M.has(e)){const t=M.get(e);M.delete(e),queueMicrotask(()=>{t()})}const n=e.childNodes;for(let t=0;t<n.length;t++){const i=n[t];i&&nt(i)}}function Et(){q||typeof document>"u"||(q=!0,I=new MutationObserver(e=>{for(const n of e){const t=n.removedNodes;for(let i=0;i<t.length;i++){const r=t[i];r&&nt(r)}}}),document.body?I.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{I==null||I.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function rt(e,n){Et(),M.set(e,n)}function Ct(e){return M.has(e)}function bt(){return M.size}function Rt(e){const n=M.get(e);return n?(M.delete(e),n(),!0):!1}function kt(){M.clear(),I==null||I.disconnect(),I=null,q=!1}const O=new Map,N=new Map,W=new Map;function Pt(e,n,t){O.set(e,n);let i=N.get(e);if(i)return i;const r=n;return i=Tt(()=>{const o=O.get(e);return o||(console.warn(`Transition "${String(e)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{O.get(e)===r&&It(e)}}),N.set(e,i),i}function It(e){O.delete(e),N.delete(e),W.delete(e)}function Mt(e,n="manual"){const t=Pt(e.key,{in:e.in,out:e.out},{strategy:e[H],scope:e.scope});if(n==="manual")return t;let i=W.get(e.key);return i||(i=r=>{if(r){const o=t(r);o&&rt(r,o)}},W.set(e.key,i),i)}function Vt(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function F(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===n}function Ft(e,n,t){for(const i of t)if(F(e,i.from)&&F(n,i.to))return i.transition;for(const i of t)if((i.from==="*"||F(e,i.from))&&(i.to==="*"||F(n,i.to)))return i.transition;return null}const xt=768,Lt=10,Ot=10;function zt(e={}){const{preserveScroll:n=c=>c}=e,t=typeof n=="function"?n:()=>n;let i=null,r=!1,o=!1;const s=()=>{const c=(i==null?void 0:i.clientWidth)??0,g=c>0?c:typeof window<"u"?window.innerWidth:0;return g>0&&g<xt},f=()=>(o||(r=s(),o=!0),r),l=c=>{const g=t(f());return g===!1?!1:g===!0?!0:!g.exclude.some(E=>F(c,E))};let m=null;const h=new Map;let v=null,A=!1,S=0;const y=()=>{i&&v&&!A&&h.set(v,{x:i.scrollLeft,y:i.scrollTop})},p=c=>{if(!i)return;const g=l(c)&&h.has(c)?h.get(c):{x:0,y:0};let E=0;const b=()=>{if(!i)return;i.scrollTo({top:g.y,left:g.x}),!(Math.abs(i.scrollTop-g.y)<1&&Math.abs(i.scrollLeft-g.x)<1)&&E<Lt&&(E++,requestAnimationFrame(b))};requestAnimationFrame(b)};return{initializeContext:(c,g)=>{A=!0;const E=++S;m=c,i||(i=St(c),r=s(),o=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=s()}).observe(i),(i===document.documentElement?window:i).addEventListener("scroll",y,{passive:!0})),v=g,p(g);let b=0;const P=()=>{E===S&&(b++,b>=Ot?A=!1:requestAnimationFrame(P))};requestAnimationFrame(P)},calculateScrollOffset:(c,g)=>{const E=c&&h.has(c)?h.get(c):{x:0,y:0},b=g&&l(g)&&h.has(g)?h.get(g):{x:0,y:0};return{x:-b.x+E.x,y:-b.y+E.y}},evictScrollPosition:c=>{h.delete(c)},shouldPreserve:l,getScrollContainer:()=>i,getPositionedParentElement:()=>m?At(m):document.body,getScrollPosition:c=>c&&h.has(c)?h.get(c):{x:0,y:0}}}const G=30,$=8,Z=1.2,Dt=30,_t=600;function qt(){let e=null,n=!1,t=!1,i=null,r=null,o=!1;const s=(w,u)=>{for(let a=0;a<w.length;a++){const T=w.item(a);if(T&&T.identifier===u)return T}return null},f=()=>{i!==null&&(clearTimeout(i),i=null)},l=()=>{r!==null&&(clearTimeout(r),r=null)},m=()=>{n=!0,t=!0,f(),l(),i=setTimeout(()=>{n=!1,t=!1,i=null},_t)},h=w=>{if(w.touches.length!==1){e=null;return}const u=w.touches.item(0);if(!u){e=null;return}const a=window.innerWidth,T=u.clientX<=G,c=u.clientX>=a-G;if(!T&&!c){e=null;return}e={identifier:u.identifier,startX:u.clientX,startY:u.clientY,fromLeftEdge:T,moved:!1}},v=w=>{if(!e)return;if(w.touches.length!==1){e=null;return}const u=s(w.touches,e.identifier);if(!u){e=null;return}const a=u.clientX-e.startX,T=u.clientY-e.startY,c=Math.abs(a),g=Math.abs(T);if(g>$&&g>c*Z){e=null;return}const E=e.fromLeftEdge?a>0:a<0;c>$&&c>g*Z&&E&&(e.moved=!0)},A=w=>{if(!e)return;const u=s(w.changedTouches,e.identifier);if(!u){e=null;return}const a=u.clientX-e.startX,T=e.fromLeftEdge?a>0:a<0;e.moved&&T&&Math.abs(a)>=Dt&&m(),e=null},S=()=>{e&&(e.moved&&m(),e=null)};return{initialize:()=>{if(typeof window>"u"||o)return;o=!0;const w={passive:!0,capture:!0};window.addEventListener("touchstart",h,w),window.addEventListener("touchmove",v,w),window.addEventListener("touchend",A,w),window.addEventListener("touchcancel",S,w)},destroy:()=>{if(typeof window>"u"||!o)return;o=!1;const w={capture:!0};window.removeEventListener("touchstart",h,w),window.removeEventListener("touchmove",v,w),window.removeEventListener("touchend",A,w),window.removeEventListener("touchcancel",S,w),f(),l(),e=null,n=!1,t=!1},isSwipeBack:()=>{const w=n||t;return w&&f(),w},onPageEnter:()=>{n=!1,f(),l(),r=setTimeout(()=>{t=!1,r=null},0)}}}function ot(){let e=null;function n(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){const t={from:e.from,to:e.to};e.outResolve(t),e.inResolve(t),e=null}}return{trigger(t,i){e||(e={}),i==="out"?e.from=t:e.to=t},get(t){return t==="in"&&(!e||!e.from)?Promise.resolve(null):new Promise(i=>{e||(e={}),t==="out"?e.outResolve=i:e.inResolve=i,n()})}}}function st(){let e=null;function n(){var i,r;e&&((i=e.outResolve)==null||i.call(e,null),(r=e.inResolve)==null||r.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){if(e.from===e.to){n();return}const i={from:e.from,to:e.to};e.outResolve(i),e.inResolve(i),e=null}}return{trigger(i,r){e&&(r==="out"&&e.from&&e.from!==i||r==="in"&&e.to&&e.to!==i)&&n(),e||(e={}),r==="out"?e.from=i:e.to=i},get(i){return new Promise(r=>{e||(e={}),i==="out"?e.outResolve=r:e.inResolve=r,t()})}}}function Nt(e,n){const{transitions:t=[],defaultTransition:i,middleware:r=(u,a)=>({from:u,to:a}),preserveScroll:o=u=>u}=e,{outFirst:s=!0}=n||{},f=s?ot():st(),l=Vt(t),m=qt();m.initialize();const{initializeContext:h,calculateScrollOffset:v,evictScrollPosition:A,shouldPreserve:S,getScrollContainer:y,getPositionedParentElement:p,getScrollPosition:R}=zt({preserveScroll:o}),C=async(u,a)=>{const T=m.isSwipeBack();f.trigger(u,a);const c=await f.get(a);if(a==="in"&&m.onPageEnter(),!c)return()=>({});if(T)return a==="out"&&c.from&&!S(c.from)&&A(c.from),()=>({});const{from:g,to:E}=r(c.from,c.to),P=Ft(g,E,l)||i;if(!P)return()=>({});const V=v(c.from,c.to);if(a==="out"){const x={scrollOffset:V,scroll:R(c.from),get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return c.from&&!S(c.from)&&A(c.from),D=>P.out(D,x)}else{const x={scrollOffset:V,get scroll(){return R(c.to)},get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return D=>P.in(D,x)}};return u=>({key:u,in:async a=>(h(a,u),(await C(u,"in"))(a)),out:async a=>(await C(u,"out"))(a),[H]:tt})}exports.isCssAnimation=k.isCssAnimation;exports.isKeyframesAnimation=k.isKeyframesAnimation;exports.isMultiAnimation=k.isMultiAnimation;exports.isSingleAnimation=k.isSingleAnimation;exports.isTickAnimation=k.isTickAnimation;exports.normalizeSchedule=k.normalizeSchedule;exports.normalizeToMultiAnimation=k.normalizeToMultiAnimation;exports.SCOPE_ATTR=U;exports.SCOPE_READY_ATTR=K;exports.TRANSITION_STRATEGY=H;exports.createAnyOrderDetector=st;exports.createDefaultStrategy=Q;exports.createOutFirstDetector=ot;exports.createPageTransitionStrategy=tt;exports.createSggoiTransitionContext=Nt;exports.createTransitionScope=vt;exports.findScope=it;exports.getWatchedCount=bt;exports.isScopeReady=et;exports.isWatched=Ct;exports.resetObserver=kt;exports.transition=Mt;exports.triggerUnmount=Rt;exports.watchUnmount=rt;
1
+ "use strict";var lt=Object.defineProperty;var ut=(e,i,t)=>i in e?lt(e,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[i]=t;var d=(e,i,t)=>ut(e,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./types.cjs"),W=require("./spring-integrator-95Mh7mdw.cjs"),ft=require("./provider-BKaONTeg.cjs");class mt{constructor(){d(this,"listeners",new Set);d(this,"rafId",null);d(this,"isRunning",!1);d(this,"startTime",Date.now());d(this,"lastUpdate",this.startTime);d(this,"elapsed",0);d(this,"lagThreshold",500);d(this,"adjustedLag",33);d(this,"maxDeltaTime",33);d(this,"gap",1e3/240);d(this,"nextTime",this.gap);d(this,"tick",()=>{const i=Date.now();let n=i-this.lastUpdate;n>this.lagThreshold||n<0?(this.startTime+=n-this.adjustedLag,n=this.adjustedLag):n>this.maxDeltaTime&&(n=this.maxDeltaTime),this.lastUpdate=i;const r=i-this.startTime,o=r-this.nextTime;if(o>0){const s=n/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(m=>{m(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(i){return this.listeners.add(i),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(i)}}unsubscribe(i){this.listeners.delete(i),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(i,t){this.lagThreshold=i,this.adjustedLag=Math.min(t,i)}fps(i){this.gap=1e3/i,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const D=new mt;function dt(e){const{integrator:i,from:t,to:n,velocity:r=0,onUpdate:o,onComplete:s,onStart:m}=e;let l={position:t,velocity:r},u=!0,h=0,v=!1;const A=S=>{if(u){if(v||(v=!0,m==null||m()),l=i.step(l,n,S),i.isSettled(l,n)){if(h+=Math.min(S,.033),h>=W.SETTLE_THRESHOLD){l={position:n,velocity:0},u=!1,o(l.position),D.unsubscribe(A),s();return}}else h=0;o(l.position)}};return D.subscribe(A),{stop:()=>{u&&(u=!1,D.unsubscribe(A))},getPosition:()=>l.position,getVelocity:()=>l.velocity,isRunning:()=>u}}const L=1e3/60;function ht(e,i,t,n=0){let o={position:i,velocity:n},s=0;const m=[];for(let l=0;l<600;l++){const u=l*L;if(m.push({time:u,position:o.position,velocity:o.velocity}),o=e.step(o,t,L/1e3),e.isSettled(o,t)){if(s+=L/1e3,s>=W.SETTLE_THRESHOLD){m.push({time:(l+1)*L,position:t,velocity:0});break}}else s=0}return m}function Y(e,i){if(e.length===0)return{position:0,velocity:0};const t=e[0],n=e[e.length-1];if(i<=0)return{position:t.position,velocity:t.velocity};if(i>=n.time)return{position:n.position,velocity:n.velocity};let r=0,o=e.length-1;for(;r<o-1;){const u=Math.floor((r+o)/2);e[u].time<=i?r=u:o=u}const s=e[r],m=e[o],l=(i-s.time)/(m.time-s.time);return{position:s.position+(m.position-s.position)*l,velocity:s.velocity+(m.velocity-s.velocity)*l}}function gt(e,i){return e.map(t=>i(t.position))}function yt(e){const{integrator:i,element:t,from:n,to:r,velocity:o=0,style:s,onComplete:m,onStart:l}=e,u=ht(i,n,r,o);if(u.length===0)return l==null||l(),m(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=gt(u,s),v=u[u.length-1],A=v.time,S=h[0];if(S)for(const C of Object.keys(S))t.style[C]="";const y=t.animate(h,{duration:A,fill:"forwards",easing:"linear",composite:"replace"});let p=!0;const R=performance.now();return l==null||l(),y.onfinish=()=>{p&&(p=!1,m())},{stop:()=>{p&&(p=!1,y.cancel())},getPosition:()=>{if(!p)return v.position;const C=performance.now()-R;return Y(u,C).position},getVelocity:()=>{if(!p)return 0;const C=performance.now()-R;return Y(u,C).velocity},isRunning:()=>p}}function wt(e){const{element:i,frames:t,duration:n,easing:r="linear",from:o,to:s,onComplete:m,onStart:l}=e,u=t[0];if(u)for(const S of Object.keys(u))S==="offset"||S==="easing"||S==="composite"||(i.style[S]="");const h=i.animate(t,{duration:n,fill:"forwards",easing:r,composite:"replace"});let v=!0;const A=performance.now();return l==null||l(),h.onfinish=()=>{v&&(v=!1,m())},{stop:()=>{v&&(v=!1,h.cancel())},getPosition:()=>{if(!v)return s;const S=performance.now()-A,y=Math.min(Math.max(S/n,0),1);return o+(s-o)*y},getVelocity:()=>0,isRunning:()=>v}}function pt(e){const{to:i,onStart:t,onComplete:n}=e;return t==null||t(),n(),{stop:()=>{},getPosition:()=>i,getVelocity:()=>0,isRunning:()=>!1}}class vt{static from(i){const{tick:t,css:n,keyframes:r}=i;if((t?1:0)+(n?1:0)+(r?1:0)>1)throw new Error("Cannot use more than one of 'tick', 'css', 'keyframes' together");return r?s=>wt({element:r.element,frames:r.frames,duration:r.duration,easing:r.easing,from:s.from,to:s.to,onComplete:s.onComplete,onStart:s.onStart}):n?s=>{if(!s.integrator)throw new Error("css mode requires an integrator");return yt({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,element:n.element,style:n.style})}:t?s=>{if(!s.integrator)throw new Error("tick mode requires an integrator");return dt({integrator:s.integrator,from:s.from,to:s.to,velocity:s.velocity,onComplete:s.onComplete,onStart:s.onStart,onUpdate:t})}:pt}}class tt{}const St={stiffness:300,damping:30};class j extends tt{constructor(t){super();d(this,"options");d(this,"runner");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);d(this,"updateFn");d(this,"isKeyframesMode");if(this.options={from:t.from??0,to:t.to??1,physics:t.physics,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,this.isKeyframesMode=!!t.keyframes,t.tick)this.updateFn=n=>{var r;return(r=t.tick)==null?void 0:r.call(t,n)};else if(t.css){const{element:n,style:r}=t.css;this.updateFn=o=>{const s=r(o);for(const[m,l]of Object.entries(s))n.style[m]=typeof l=="number"?String(l):l}}else this.updateFn=()=>{};this.runner=vt.from({tick:t.tick,css:t.css,keyframes:t.keyframes})}syncState(){var t;(t=this.updateFn)==null||t.call(this,this.currentValue)}createIntegrator(){const t=this.options.physics;return t!=null&&t.integrator?t.integrator():t!=null&&t.spring||t!=null&&t.inertia?ft.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new W.SpringIntegrator(St)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator:this.isKeyframesMode?void 0:this.createIntegrator(),from:this.currentValue,to:t,velocity:this.currentVelocity,onStart:this.options.onStart,onComplete:()=>{this.currentValue=t,this.currentVelocity=0,this.isAnimating=!1,this.controls=null,this.options.onComplete()}})}forward(){this.stop(),this.runAnimation(this.options.to)}backward(){this.stop(),this.runAnimation(this.options.from)}reverse(){const t=this.options.from;this.options.from=this.options.to,this.options.to=t,this.isAnimating&&(this.stop(),this.runAnimation(this.options.to))}stop(){this.controls&&(this.currentValue=this.controls.getPosition(),this.currentVelocity=this.controls.getVelocity(),this.controls.stop(),this.controls=null),this.isAnimating=!1}getVelocity(){var t;return((t=this.controls)==null?void 0:t.getVelocity())??this.currentVelocity}getCurrentValue(){var t;return((t=this.controls)==null?void 0:t.getPosition())??this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.getCurrentValue(),velocity:this.getVelocity(),from:this.options.from,to:this.options.to}}setValue(t){this.currentValue=t}setVelocity(t){this.currentVelocity=t}updateOptions(t){this.options={...this.options,...t}}}class z extends tt{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"itemOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"from");d(this,"to");d(this,"initialState");this.config=t.config,this.from=t.from,this.to=t.to,this.initialState=t.state??{position:t.from,velocity:0},this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.items.forEach((t,n)=>{const r=this.generateId(),o=new j({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,keyframes:t.keyframes,onComplete:()=>this.onAnimatorComplete(r),onStart:t.onStart});(n===0||t.normalizedOffset===0)&&(o.setValue(this.initialState.position),o.setVelocity(this.initialState.velocity),o.syncState()),this.animators.set(r,{id:r,item:t,animator:o,started:!1}),this.itemOrder.push(r)})}getAnimatorProgress(t){const n=t.animator.getCurrentState(),r=Math.abs(n.to-n.from);return r===0?1:Math.abs(n.position-n.from)/r}getOrderedIds(){return this.direction==="forward"?this.itemOrder:[...this.itemOrder].reverse()}onAnimatorComplete(t){var r,o,s,m,l,u;const n=this.animators.get(t);!n||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=n.item).onComplete)==null||o.call(r),(m=(s=this.config).onProgress)==null||m.call(s,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(u=(l=this.config).onEnd)==null||u.call(l)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let n=0;n<t.length;n++){const r=t[n],o=this.animators.get(r);if(!o||o.started)continue;if(n===0){this.startAnimator(r);continue}const s=t[n-1],m=this.animators.get(s);if(!m||!m.started)continue;const l=this.getAnimatorProgress(m),u=o.item.normalizedOffset;l>=u&&this.startAnimator(r)}}startAnimator(t){const n=this.animators.get(t);!n||n.started||(n.started=!0,this.direction==="forward"?n.animator.forward():n.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};t()}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var n;const t=this.itemOrder[0];return t?((n=this.animators.get(t))==null?void 0:n.animator)??null:null}forward(){var t,n;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(n=(t=this.config).onStart)==null||n.call(t),this.startScheduler()}backward(){var t,n;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(n=(t=this.config).onStart)==null||n.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const n=t.animator.getCurrentState();if(n.position===n.to){const o=new j({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,keyframes:t.item.keyframes,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});o.setValue(this.to),o.setVelocity(0),o.syncState(),o.forward(),t.animator=o}else t.animator.reverse()})}getCurrentState(){const t=this.getFirstAnimator();return t?t.getCurrentState():{position:0,velocity:0,from:0,to:1}}getCurrentValue(){const t=this.getFirstAnimator();return(t==null?void 0:t.getCurrentValue())??0}getVelocity(){const t=this.getFirstAnimator();return(t==null?void 0:t.getVelocity())??0}setValue(t){const n=this.getFirstAnimator();n==null||n.setValue(t)}setVelocity(t){const n=this.getFirstAnimator();n==null||n.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,n){return new z({...n,state:t})}}const U=Symbol.for("TRANSITION_STRATEGY"),et=e=>({runIn:async i=>{const{currentAnimation:t}=e;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),i.out)return{config:await i.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}return i.in?{config:await i.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async i=>{const{currentAnimation:t}=e;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),i.in)return{config:await i.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}return i.out?{config:await i.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}}),nt=()=>({runIn:async e=>e.in?{config:await e.in,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"},runOut:async e=>e.out?{config:await e.out,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}),H="data-ssgoi-scope",K="data-ssgoi-scope-ready";function At(){return e=>{if(e)return e.setAttribute(H,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(K,"true")})}),()=>{}}}function it(e){return e.hasAttribute(K)}function rt(e){return e.closest(`[${H}]`)}const B=new Set(["auto","scroll","overlay"]),Tt=e=>{let i=e.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i);if(B.has(t.overflowY)||B.has(t.overflowX))return i;i=i.parentElement}return document.documentElement},Et=e=>{let i=e.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return i;i=i.parentElement}return document.body};function G(e){return new Promise(i=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{i()})})})}function Ct(e,i){var S;let t=null,n=null,r=null,o=null;const s={get currentAnimation(){return t}},m=((S=i==null?void 0:i.strategy)==null?void 0:S.call(i,s))||et(s),l=async y=>{var g,E;n&&(n.remove(),n=null);const p=e(),R=p.in&&p.in(y),C=!(i!=null&&i.strategy)&&p.out?p.out(y):void 0;if(!R)return;const w={in:k.normalizeToMultiAnimation(R),out:C?k.normalizeToMultiAnimation(C):void 0},f=await m.runIn(w);if(!f.config){t&&(t.direction="in");return}const a=f.config;(g=a.prepare)==null||g.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var b;t=null,(b=a.onEnd)==null||b.call(a)}},y);a.wait&&await a.wait();const c=z.fromState(f.state,{config:T,from:f.from,to:f.to});t={controller:c,direction:"in"},(E=a.onReady)==null||E.call(a),await G(),f.direction==="forward"?c.forward():c.backward()},u=async y=>{var E,b;n=y;const p=e(),R=!(i!=null&&i.strategy)&&p.in?p.in(y):void 0,C=p.out&&p.out(y);if(!C)return;const w={in:R?k.normalizeToMultiAnimation(R):void 0,out:k.normalizeToMultiAnimation(C)},f=await m.runOut(w);if(!f.config){t&&(t.direction="out"),n&&(n.remove(),n=null);return}const a=f.config;g(),(E=a.prepare)==null||E.call(a);const T=k.normalizeSchedule({...a,onEnd:()=>{var M,V;(M=a.onEnd)==null||M.call(a),n&&(n.remove(),n=null),t=null,(V=i==null?void 0:i.onCleanupEnd)==null||V.call(i)}},y);a.wait&&await a.wait();const c=z.fromState(f.state,{config:T,from:f.from,to:f.to});t={controller:c,direction:"out"},(b=a.onReady)==null||b.call(a),await G(),f.direction==="forward"?c.forward():c.backward();function g(){!r||!n||(o&&r.contains(o)?r.insertBefore(n,o):r.appendChild(n))}};let h=null,v=!1;const A=y=>()=>{if(v)return;v=!0;const p=y.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&u(p)}):u(p)};return y=>{if(y)return requestAnimationFrame(()=>{r=y.parentElement,o=y.nextElementSibling}),v=!1,(i==null?void 0:i.scope)==="local"?queueMicrotask(()=>{h=rt(y),!(h&&!it(h))&&l(y)}):l(y),A(y)}}const I=new Map;let P=null,q=!1;function ot(e){if(e instanceof HTMLElement&&I.has(e)){const t=I.get(e);I.delete(e),queueMicrotask(()=>{t()})}const i=e.childNodes;for(let t=0;t<i.length;t++){const n=i[t];n&&ot(n)}}function bt(){q||typeof document>"u"||(q=!0,P=new MutationObserver(e=>{for(const i of e){const t=i.removedNodes;for(let n=0;n<t.length;n++){const r=t[n];r&&ot(r)}}}),document.body?P.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{P==null||P.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function st(e,i){bt(),I.set(e,i)}function Rt(e){return I.has(e)}function kt(){return I.size}function Mt(e){const i=I.get(e);return i?(I.delete(e),i(),!0):!1}function Pt(){I.clear(),P==null||P.disconnect(),P=null,q=!1}const O=new Map,N=new Map,X=new Map;function It(e,i,t){O.set(e,i);let n=N.get(e);if(n)return n;const r=i;return n=Ct(()=>{const o=O.get(e);return o||(console.warn(`Transition "${String(e)}" not found`),{})},{strategy:t==null?void 0:t.strategy,scope:t==null?void 0:t.scope,onCleanupEnd:()=>{O.get(e)===r&&Vt(e)}}),N.set(e,n),n}function Vt(e){O.delete(e),N.delete(e),X.delete(e)}function Ft(e,i="manual"){const t=It(e.key,{in:e.in,out:e.out},{strategy:e[U],scope:e.scope});if(i==="manual")return t;let n=X.get(e.key);return n||(n=r=>{if(r){const o=t(r);o&&st(r,o)}},X.set(e.key,n),n)}function xt(e){const i=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...i]}function F(e,i){if(i==="*")return!0;if(i.endsWith("/*")){const t=i.slice(0,-1);return e.startsWith(t)&&e.length>t.length}return e===i}function Lt(e,i,t){for(const n of t)if(F(e,n.from)&&F(i,n.to))return n.transition;for(const n of t)if((n.from==="*"||F(e,n.from))&&(n.to==="*"||F(i,n.to)))return n.transition;return null}const Ot=768,zt=10,_t=10;function Dt(e={}){const{preserveScroll:i=c=>c}=e,t=typeof i=="function"?i:()=>i;let n=null,r=!1,o=!1;const s=()=>{const c=(n==null?void 0:n.clientWidth)??0,g=c>0?c:typeof window<"u"?window.innerWidth:0;return g>0&&g<Ot},m=()=>(o||(r=s(),o=!0),r),l=c=>{const g=t(m());return g===!1?!1:g===!0?!0:!g.exclude.some(E=>F(c,E))};let u=null;const h=new Map;let v=null,A=!1,S=0;const y=()=>{n&&v&&!A&&h.set(v,{x:n.scrollLeft,y:n.scrollTop})},p=c=>{if(!n)return;const g=l(c)&&h.has(c)?h.get(c):{x:0,y:0};let E=0;const b=()=>{if(!n)return;n.scrollTo({top:g.y,left:g.x}),!(Math.abs(n.scrollTop-g.y)<1&&Math.abs(n.scrollLeft-g.x)<1)&&E<zt&&(E++,requestAnimationFrame(b))};requestAnimationFrame(b)};return{initializeContext:(c,g)=>{A=!0;const E=++S;u=c,n||(n=Tt(c),r=s(),o=!0,typeof ResizeObserver<"u"&&new ResizeObserver(()=>{r=s()}).observe(n),(n===document.documentElement?window:n).addEventListener("scroll",y,{passive:!0})),v=g,p(g);let b=0;const M=()=>{E===S&&(b++,b>=_t?A=!1:requestAnimationFrame(M))};requestAnimationFrame(M)},calculateScrollOffset:(c,g)=>{const E=c&&h.has(c)?h.get(c):{x:0,y:0},b=g&&l(g)&&h.has(g)?h.get(g):{x:0,y:0};return{x:-b.x+E.x,y:-b.y+E.y}},evictScrollPosition:c=>{h.delete(c)},shouldPreserve:l,getScrollContainer:()=>n,getPositionedParentElement:()=>u?Et(u):document.body,getScrollPosition:c=>c&&h.has(c)?h.get(c):{x:0,y:0}}}const $=30,Z=8,J=1.2,Q=30,qt=600;function Nt(){let e=null,i=!1,t=!1,n=null,r=null,o=!1;const s=(w,f)=>{for(let a=0;a<w.length;a++){const T=w.item(a);if(T&&T.identifier===f)return T}return null},m=()=>{n!==null&&(clearTimeout(n),n=null)},l=()=>{r!==null&&(clearTimeout(r),r=null)},u=()=>{i=!0,t=!0,m(),l(),n=setTimeout(()=>{i=!1,t=!1,n=null},qt)},h=w=>{if(w.touches.length!==1){e=null;return}const f=w.touches.item(0);if(!f){e=null;return}const a=window.innerWidth,T=f.clientX<=$,c=f.clientX>=a-$;if(!T&&!c){e=null;return}e={identifier:f.identifier,startX:f.clientX,startY:f.clientY,fromLeftEdge:T,moved:!1}},v=w=>{if(!e)return;if(w.touches.length!==1){e=null;return}const f=s(w.touches,e.identifier);if(!f){e=null;return}const a=f.clientX-e.startX,T=f.clientY-e.startY,c=Math.abs(a),g=Math.abs(T);if(g>Z&&g>c*J){e=null;return}const E=e.fromLeftEdge?a>0:a<0;c>Z&&c>g*J&&E&&(e.moved=!0)},A=w=>{if(!e)return;const f=s(w.changedTouches,e.identifier);if(!f){e=null;return}const a=f.clientX-e.startX,T=e.fromLeftEdge?a>0:a<0;if(e.moved&&T&&Math.abs(a)>=Q){u(),e=null;return}e.moved&&Math.abs(a)>=Q&&u(),e=null},S=()=>{e&&(e.moved&&u(),e=null)};return{initialize:()=>{if(typeof window>"u"||o)return;o=!0;const w={passive:!0,capture:!0};window.addEventListener("touchstart",h,w),window.addEventListener("touchmove",v,w),window.addEventListener("touchend",A,w),window.addEventListener("touchcancel",S,w)},destroy:()=>{if(typeof window>"u"||!o)return;o=!1;const w={capture:!0};window.removeEventListener("touchstart",h,w),window.removeEventListener("touchmove",v,w),window.removeEventListener("touchend",A,w),window.removeEventListener("touchcancel",S,w),m(),l(),e=null,i=!1,t=!1},isSwipeBack:()=>{const w=i||t;return w&&m(),w},onPageEnter:()=>{i=!1,m(),l(),r=setTimeout(()=>{t=!1,r=null},0)}}}function at(){let e=null;function i(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){const t={from:e.from,to:e.to};e.outResolve(t),e.inResolve(t),e=null}}return{trigger(t,n){e||(e={}),n==="out"?e.from=t:e.to=t},get(t){return t==="in"&&(!e||!e.from)?Promise.resolve(null):new Promise(n=>{e||(e={}),t==="out"?e.outResolve=n:e.inResolve=n,i()})}}}function ct(){let e=null;function i(){var n,r;e&&((n=e.outResolve)==null||n.call(e,null),(r=e.inResolve)==null||r.call(e,null),e=null)}function t(){if(e!=null&&e.from&&(e!=null&&e.to)&&(e!=null&&e.outResolve)&&(e!=null&&e.inResolve)){if(e.from===e.to){i();return}const n={from:e.from,to:e.to};e.outResolve(n),e.inResolve(n),e=null}}return{trigger(n,r){e&&(r==="out"&&e.from&&e.from!==n||r==="in"&&e.to&&e.to!==n)&&i(),e||(e={}),r==="out"?e.from=n:e.to=n},get(n){return new Promise(r=>{e||(e={}),n==="out"?e.outResolve=r:e.inResolve=r,t()})}}}function Xt(e,i){const{transitions:t=[],defaultTransition:n,middleware:r=(f,a)=>({from:f,to:a}),preserveScroll:o=f=>f}=e,{outFirst:s=!0}=i||{},m=s?at():ct(),l=xt(t),u=Nt();u.initialize();const{initializeContext:h,calculateScrollOffset:v,evictScrollPosition:A,shouldPreserve:S,getScrollContainer:y,getPositionedParentElement:p,getScrollPosition:R}=Dt({preserveScroll:o}),C=async(f,a)=>{const T=u.isSwipeBack();m.trigger(f,a);const c=await m.get(a);if(a==="in"&&u.onPageEnter(),!c)return()=>({});if(T)return a==="out"&&c.from&&!S(c.from)&&A(c.from),()=>({});const{from:g,to:E}=r(c.from,c.to),M=Lt(g,E,l)||n;if(!M)return()=>({});const V=v(c.from,c.to);if(a==="out"){const x={scrollOffset:V,scroll:R(c.from),get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return c.from&&!S(c.from)&&A(c.from),_=>M.out(_,x)}else{const x={scrollOffset:V,get scroll(){return R(c.to)},get scrollingElement(){return y()||document.documentElement},get positionedParent(){return p()}};return _=>M.in(_,x)}};return f=>({key:f,in:async a=>(h(a,f),(await C(f,"in"))(a)),out:async a=>(await C(f,"out"))(a),[U]:nt})}exports.isCssAnimation=k.isCssAnimation;exports.isKeyframesAnimation=k.isKeyframesAnimation;exports.isMultiAnimation=k.isMultiAnimation;exports.isSingleAnimation=k.isSingleAnimation;exports.isTickAnimation=k.isTickAnimation;exports.normalizeSchedule=k.normalizeSchedule;exports.normalizeToMultiAnimation=k.normalizeToMultiAnimation;exports.SCOPE_ATTR=H;exports.SCOPE_READY_ATTR=K;exports.TRANSITION_STRATEGY=U;exports.createAnyOrderDetector=ct;exports.createDefaultStrategy=et;exports.createOutFirstDetector=at;exports.createPageTransitionStrategy=nt;exports.createSggoiTransitionContext=Xt;exports.createTransitionScope=At;exports.findScope=rt;exports.getWatchedCount=kt;exports.isScopeReady=it;exports.isWatched=Rt;exports.resetObserver=Pt;exports.transition=Ft;exports.triggerUnmount=Mt;exports.watchUnmount=st;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- var et = Object.defineProperty;
2
- var nt = (e, i, t) => i in e ? et(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
- var d = (e, i, t) => nt(e, typeof i != "symbol" ? i + "" : i, t);
1
+ var it = Object.defineProperty;
2
+ var rt = (e, i, t) => i in e ? it(e, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[i] = t;
3
+ var d = (e, i, t) => rt(e, typeof i != "symbol" ? i + "" : i, t);
4
4
  import { normalizeToMultiAnimation as F, normalizeSchedule as W } from "./types.js";
5
- import { isCssAnimation as Gt, isKeyframesAnimation as $t, isMultiAnimation as Zt, isSingleAnimation as Jt, isTickAnimation as Qt } from "./types.js";
6
- import { S as G, a as it } from "./spring-integrator-BM4a-82c.js";
7
- import { I as rt } from "./provider-B2B8CK6H.js";
8
- class ot {
5
+ import { isCssAnimation as $t, isKeyframesAnimation as Zt, isMultiAnimation as Jt, isSingleAnimation as Qt, isTickAnimation as te } from "./types.js";
6
+ import { S as Z, a as ot } from "./spring-integrator-BM4a-82c.js";
7
+ import { I as st } from "./provider-B2B8CK6H.js";
8
+ class at {
9
9
  constructor() {
10
10
  d(this, "listeners", /* @__PURE__ */ new Set());
11
11
  d(this, "rafId", null);
@@ -32,8 +32,8 @@ class ot {
32
32
  const r = i - this.startTime, o = r - this.nextTime;
33
33
  if (o > 0) {
34
34
  const s = n / 1e3;
35
- this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((f) => {
36
- f(s, this.elapsed);
35
+ this.elapsed = r / 1e3, this.nextTime += o + (o >= this.gap ? 4 : this.gap - o), this.listeners.forEach((m) => {
36
+ m(s, this.elapsed);
37
37
  });
38
38
  }
39
39
  this.listeners.size > 0 ? this.rafId = requestAnimationFrame(this.tick) : (this.isRunning = !1, this.rafId = null);
@@ -69,8 +69,8 @@ class ot {
69
69
  return this.elapsed;
70
70
  }
71
71
  }
72
- const z = new ot();
73
- function st(e) {
72
+ const z = new at();
73
+ function ct(e) {
74
74
  const {
75
75
  integrator: i,
76
76
  from: t,
@@ -78,14 +78,14 @@ function st(e) {
78
78
  velocity: r = 0,
79
79
  onUpdate: o,
80
80
  onComplete: s,
81
- onStart: f
81
+ onStart: m
82
82
  } = e;
83
- let l = { position: t, velocity: r }, m = !0, h = 0, v = !1;
84
- const A = (S) => {
85
- if (m) {
86
- if (v || (v = !0, f == null || f()), l = i.step(l, n, S), i.isSettled(l, n)) {
87
- if (h += Math.min(S, 0.033), h >= G) {
88
- l = { position: n, velocity: 0 }, m = !1, o(l.position), z.unsubscribe(A), s();
83
+ let l = { position: t, velocity: r }, u = !0, h = 0, v = !1;
84
+ const E = (S) => {
85
+ if (u) {
86
+ if (v || (v = !0, m == null || m()), l = i.step(l, n, S), i.isSettled(l, n)) {
87
+ if (h += Math.min(S, 0.033), h >= Z) {
88
+ l = { position: n, velocity: 0 }, u = !1, o(l.position), z.unsubscribe(E), s();
89
89
  return;
90
90
  }
91
91
  } else
@@ -93,28 +93,28 @@ function st(e) {
93
93
  o(l.position);
94
94
  }
95
95
  };
96
- return z.subscribe(A), {
96
+ return z.subscribe(E), {
97
97
  stop: () => {
98
- m && (m = !1, z.unsubscribe(A));
98
+ u && (u = !1, z.unsubscribe(E));
99
99
  },
100
100
  getPosition: () => l.position,
101
101
  getVelocity: () => l.velocity,
102
- isRunning: () => m
102
+ isRunning: () => u
103
103
  };
104
104
  }
105
105
  const L = 1e3 / 60;
106
- function at(e, i, t, n = 0) {
106
+ function lt(e, i, t, n = 0) {
107
107
  let o = { position: i, velocity: n }, s = 0;
108
- const f = [];
108
+ const m = [];
109
109
  for (let l = 0; l < 600; l++) {
110
- const m = l * L;
111
- if (f.push({
112
- time: m,
110
+ const u = l * L;
111
+ if (m.push({
112
+ time: u,
113
113
  position: o.position,
114
114
  velocity: o.velocity
115
115
  }), o = e.step(o, t, L / 1e3), e.isSettled(o, t)) {
116
- if (s += L / 1e3, s >= G) {
117
- f.push({
116
+ if (s += L / 1e3, s >= Z) {
117
+ m.push({
118
118
  time: (l + 1) * L,
119
119
  position: t,
120
120
  velocity: 0
@@ -124,9 +124,9 @@ function at(e, i, t, n = 0) {
124
124
  } else
125
125
  s = 0;
126
126
  }
127
- return f;
127
+ return m;
128
128
  }
129
- function H(e, i) {
129
+ function U(e, i) {
130
130
  if (e.length === 0)
131
131
  return { position: 0, velocity: 0 };
132
132
  const t = e[0], n = e[e.length - 1];
@@ -136,19 +136,19 @@ function H(e, i) {
136
136
  return { position: n.position, velocity: n.velocity };
137
137
  let r = 0, o = e.length - 1;
138
138
  for (; r < o - 1; ) {
139
- const m = Math.floor((r + o) / 2);
140
- e[m].time <= i ? r = m : o = m;
139
+ const u = Math.floor((r + o) / 2);
140
+ e[u].time <= i ? r = u : o = u;
141
141
  }
142
- const s = e[r], f = e[o], l = (i - s.time) / (f.time - s.time);
142
+ const s = e[r], m = e[o], l = (i - s.time) / (m.time - s.time);
143
143
  return {
144
- position: s.position + (f.position - s.position) * l,
145
- velocity: s.velocity + (f.velocity - s.velocity) * l
144
+ position: s.position + (m.position - s.position) * l,
145
+ velocity: s.velocity + (m.velocity - s.velocity) * l
146
146
  };
147
147
  }
148
- function ct(e, i) {
148
+ function ut(e, i) {
149
149
  return e.map((t) => i(t.position));
150
150
  }
151
- function lt(e) {
151
+ function ft(e) {
152
152
  const {
153
153
  integrator: i,
154
154
  element: t,
@@ -156,23 +156,23 @@ function lt(e) {
156
156
  to: r,
157
157
  velocity: o = 0,
158
158
  style: s,
159
- onComplete: f,
159
+ onComplete: m,
160
160
  onStart: l
161
- } = e, m = at(i, n, r, o);
162
- if (m.length === 0)
163
- return l == null || l(), f(), {
161
+ } = e, u = lt(i, n, r, o);
162
+ if (u.length === 0)
163
+ return l == null || l(), m(), {
164
164
  stop: () => {
165
165
  },
166
166
  getPosition: () => r,
167
167
  getVelocity: () => 0,
168
168
  isRunning: () => !1
169
169
  };
170
- const h = ct(m, s), v = m[m.length - 1], A = v.time, S = h[0];
170
+ const h = ut(u, s), v = u[u.length - 1], E = v.time, S = h[0];
171
171
  if (S)
172
172
  for (const T of Object.keys(S))
173
173
  t.style[T] = "";
174
174
  const y = t.animate(h, {
175
- duration: A,
175
+ duration: E,
176
176
  fill: "forwards",
177
177
  easing: "linear",
178
178
  composite: "replace"
@@ -180,7 +180,7 @@ function lt(e) {
180
180
  let p = !0;
181
181
  const k = performance.now();
182
182
  return l == null || l(), y.onfinish = () => {
183
- p && (p = !1, f());
183
+ p && (p = !1, m());
184
184
  }, {
185
185
  stop: () => {
186
186
  p && (p = !1, y.cancel());
@@ -189,18 +189,18 @@ function lt(e) {
189
189
  if (!p)
190
190
  return v.position;
191
191
  const T = performance.now() - k;
192
- return H(m, T).position;
192
+ return U(u, T).position;
193
193
  },
194
194
  getVelocity: () => {
195
195
  if (!p)
196
196
  return 0;
197
197
  const T = performance.now() - k;
198
- return H(m, T).velocity;
198
+ return U(u, T).velocity;
199
199
  },
200
200
  isRunning: () => p
201
201
  };
202
202
  }
203
- function ut(e) {
203
+ function mt(e) {
204
204
  const {
205
205
  element: i,
206
206
  frames: t,
@@ -208,11 +208,11 @@ function ut(e) {
208
208
  easing: r = "linear",
209
209
  from: o,
210
210
  to: s,
211
- onComplete: f,
211
+ onComplete: m,
212
212
  onStart: l
213
- } = e, m = t[0];
214
- if (m)
215
- for (const S of Object.keys(m))
213
+ } = e, u = t[0];
214
+ if (u)
215
+ for (const S of Object.keys(u))
216
216
  S === "offset" || S === "easing" || S === "composite" || (i.style[S] = "");
217
217
  const h = i.animate(t, {
218
218
  duration: n,
@@ -221,9 +221,9 @@ function ut(e) {
221
221
  composite: "replace"
222
222
  });
223
223
  let v = !0;
224
- const A = performance.now();
224
+ const E = performance.now();
225
225
  return l == null || l(), h.onfinish = () => {
226
- v && (v = !1, f());
226
+ v && (v = !1, m());
227
227
  }, {
228
228
  stop: () => {
229
229
  v && (v = !1, h.cancel());
@@ -234,7 +234,7 @@ function ut(e) {
234
234
  // progress signal.
235
235
  getPosition: () => {
236
236
  if (!v) return s;
237
- const S = performance.now() - A, y = Math.min(Math.max(S / n, 0), 1);
237
+ const S = performance.now() - E, y = Math.min(Math.max(S / n, 0), 1);
238
238
  return o + (s - o) * y;
239
239
  },
240
240
  // Baked animations don't expose velocity — interruption/resumption isn't
@@ -243,7 +243,7 @@ function ut(e) {
243
243
  isRunning: () => v
244
244
  };
245
245
  }
246
- function ft(e) {
246
+ function dt(e) {
247
247
  const { to: i, onStart: t, onComplete: n } = e;
248
248
  return t == null || t(), n(), {
249
249
  stop: () => {
@@ -253,7 +253,7 @@ function ft(e) {
253
253
  isRunning: () => !1
254
254
  };
255
255
  }
256
- class mt {
256
+ class ht {
257
257
  /**
258
258
  * Get bound runner based on animation mode
259
259
  *
@@ -267,7 +267,7 @@ class mt {
267
267
  throw new Error(
268
268
  "Cannot use more than one of 'tick', 'css', 'keyframes' together"
269
269
  );
270
- return r ? (s) => ut({
270
+ return r ? (s) => mt({
271
271
  element: r.element,
272
272
  frames: r.frames,
273
273
  duration: r.duration,
@@ -279,7 +279,7 @@ class mt {
279
279
  }) : n ? (s) => {
280
280
  if (!s.integrator)
281
281
  throw new Error("css mode requires an integrator");
282
- return lt({
282
+ return ft({
283
283
  integrator: s.integrator,
284
284
  from: s.from,
285
285
  to: s.to,
@@ -292,7 +292,7 @@ class mt {
292
292
  } : t ? (s) => {
293
293
  if (!s.integrator)
294
294
  throw new Error("tick mode requires an integrator");
295
- return st({
295
+ return ct({
296
296
  integrator: s.integrator,
297
297
  from: s.from,
298
298
  to: s.to,
@@ -301,13 +301,13 @@ class mt {
301
301
  onStart: s.onStart,
302
302
  onUpdate: t
303
303
  });
304
- } : ft;
304
+ } : dt;
305
305
  }
306
306
  }
307
- class $ {
307
+ class J {
308
308
  }
309
- const dt = { stiffness: 300, damping: 30 };
310
- class K extends $ {
309
+ const gt = { stiffness: 300, damping: 30 };
310
+ class B extends J {
311
311
  constructor(t) {
312
312
  super();
313
313
  d(this, "options");
@@ -334,13 +334,13 @@ class K extends $ {
334
334
  const { element: n, style: r } = t.css;
335
335
  this.updateFn = (o) => {
336
336
  const s = r(o);
337
- for (const [f, l] of Object.entries(s))
338
- n.style[f] = typeof l == "number" ? String(l) : l;
337
+ for (const [m, l] of Object.entries(s))
338
+ n.style[m] = typeof l == "number" ? String(l) : l;
339
339
  };
340
340
  } else
341
341
  this.updateFn = () => {
342
342
  };
343
- this.runner = mt.from({
343
+ this.runner = ht.from({
344
344
  tick: t.tick,
345
345
  css: t.css,
346
346
  keyframes: t.keyframes
@@ -360,10 +360,10 @@ class K extends $ {
360
360
  */
361
361
  createIntegrator() {
362
362
  const t = this.options.physics;
363
- return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? rt.from({
363
+ return t != null && t.integrator ? t.integrator() : t != null && t.spring || t != null && t.inertia ? st.from({
364
364
  spring: t.spring,
365
365
  inertia: t.inertia
366
- }) : new it(dt);
366
+ }) : new ot(gt);
367
367
  }
368
368
  runAnimation(t) {
369
369
  this.isAnimating = !0, this.controls = this.runner({
@@ -421,7 +421,7 @@ class K extends $ {
421
421
  this.options = { ...this.options, ...t };
422
422
  }
423
423
  }
424
- class D extends $ {
424
+ class _ extends J {
425
425
  constructor(t) {
426
426
  super();
427
427
  d(this, "config");
@@ -445,7 +445,7 @@ class D extends $ {
445
445
  }
446
446
  initializeAnimators() {
447
447
  this.config.items.forEach((t, n) => {
448
- const r = this.generateId(), o = new K({
448
+ const r = this.generateId(), o = new B({
449
449
  from: this.from,
450
450
  to: this.to,
451
451
  physics: t.physics,
@@ -480,9 +480,9 @@ class D extends $ {
480
480
  return this.direction === "forward" ? this.itemOrder : [...this.itemOrder].reverse();
481
481
  }
482
482
  onAnimatorComplete(t) {
483
- var r, o, s, f, l, m;
483
+ var r, o, s, m, l, u;
484
484
  const n = this.animators.get(t);
485
- !n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = n.item).onComplete) == null || o.call(r), (f = (s = this.config).onProgress) == null || f.call(s, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (m = (l = this.config).onEnd) == null || m.call(l)));
485
+ !n || this.completedAnimators.has(t) || (this.completedAnimators.add(t), this.completedCount++, (o = (r = n.item).onComplete) == null || o.call(r), (m = (s = this.config).onProgress) == null || m.call(s, this.completedCount, this.config.items.length), this.completedCount === this.config.items.length && (this.stopScheduler(), (u = (l = this.config).onEnd) == null || u.call(l)));
486
486
  }
487
487
  /**
488
488
  * Check and start springs based on previous spring's progress
@@ -497,10 +497,10 @@ class D extends $ {
497
497
  this.startAnimator(r);
498
498
  continue;
499
499
  }
500
- const s = t[n - 1], f = this.animators.get(s);
501
- if (!f || !f.started) continue;
502
- const l = this.getAnimatorProgress(f), m = o.item.normalizedOffset;
503
- l >= m && this.startAnimator(r);
500
+ const s = t[n - 1], m = this.animators.get(s);
501
+ if (!m || !m.started) continue;
502
+ const l = this.getAnimatorProgress(m), u = o.item.normalizedOffset;
503
+ l >= u && this.startAnimator(r);
504
504
  }
505
505
  }
506
506
  startAnimator(t) {
@@ -548,7 +548,7 @@ class D extends $ {
548
548
  return;
549
549
  const n = t.animator.getCurrentState();
550
550
  if (n.position === n.to) {
551
- const o = new K({
551
+ const o = new B({
552
552
  from: this.to,
553
553
  to: this.from,
554
554
  physics: t.item.physics,
@@ -616,10 +616,10 @@ class D extends $ {
616
616
  * Uses first animator's state for initialization
617
617
  */
618
618
  static fromState(t, n) {
619
- return new D({ ...n, state: t });
619
+ return new _({ ...n, state: t });
620
620
  }
621
621
  }
622
- const Z = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
622
+ const Q = Symbol.for("TRANSITION_STRATEGY"), yt = (e) => ({
623
623
  runIn: async (i) => {
624
624
  const { currentAnimation: t } = e;
625
625
  if (t && t.direction === "out") {
@@ -686,7 +686,7 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
686
686
  direction: "forward"
687
687
  };
688
688
  }
689
- }), gt = () => ({
689
+ }), wt = () => ({
690
690
  runIn: async (e) => e.in ? {
691
691
  config: await e.in,
692
692
  state: {
@@ -723,34 +723,34 @@ const Z = Symbol.for("TRANSITION_STRATEGY"), ht = (e) => ({
723
723
  to: 0,
724
724
  direction: "forward"
725
725
  }
726
- }), J = "data-ssgoi-scope", Q = "data-ssgoi-scope-ready";
727
- function Nt() {
726
+ }), tt = "data-ssgoi-scope", et = "data-ssgoi-scope-ready";
727
+ function Xt() {
728
728
  return (e) => {
729
729
  if (e)
730
- return e.setAttribute(J, ""), queueMicrotask(() => {
730
+ return e.setAttribute(tt, ""), queueMicrotask(() => {
731
731
  queueMicrotask(() => {
732
- e.setAttribute(Q, "true");
732
+ e.setAttribute(et, "true");
733
733
  });
734
734
  }), () => {
735
735
  };
736
736
  };
737
737
  }
738
- function yt(e) {
739
- return e.hasAttribute(Q);
738
+ function pt(e) {
739
+ return e.hasAttribute(et);
740
740
  }
741
- function wt(e) {
742
- return e.closest(`[${J}]`);
741
+ function vt(e) {
742
+ return e.closest(`[${tt}]`);
743
743
  }
744
- const pt = (e) => {
744
+ const H = /* @__PURE__ */ new Set(["auto", "scroll", "overlay"]), St = (e) => {
745
745
  let i = e.parentElement;
746
746
  for (; i && i !== document.body; ) {
747
- const t = window.getComputedStyle(i), n = t.overflow + t.overflowY + t.overflowX;
748
- if (n.includes("auto") || n.includes("scroll") || i.scrollHeight > i.clientHeight || i.scrollWidth > i.clientWidth)
747
+ const t = window.getComputedStyle(i);
748
+ if (H.has(t.overflowY) || H.has(t.overflowX))
749
749
  return i;
750
750
  i = i.parentElement;
751
751
  }
752
752
  return document.documentElement;
753
- }, vt = (e) => {
753
+ }, Et = (e) => {
754
754
  let i = e.parentElement;
755
755
  for (; i && i !== document.body; ) {
756
756
  const t = window.getComputedStyle(i).position;
@@ -760,7 +760,7 @@ const pt = (e) => {
760
760
  }
761
761
  return document.body;
762
762
  };
763
- function U(e) {
763
+ function K(e) {
764
764
  return new Promise((i) => {
765
765
  requestAnimationFrame(() => {
766
766
  requestAnimationFrame(() => {
@@ -769,15 +769,15 @@ function U(e) {
769
769
  });
770
770
  });
771
771
  }
772
- function St(e, i) {
772
+ function At(e, i) {
773
773
  var S;
774
774
  let t = null, n = null, r = null, o = null;
775
775
  const s = {
776
776
  get currentAnimation() {
777
777
  return t;
778
778
  }
779
- }, f = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, s)) || ht(s), l = async (y) => {
780
- var g, E;
779
+ }, m = ((S = i == null ? void 0 : i.strategy) == null ? void 0 : S.call(i, s)) || yt(s), l = async (y) => {
780
+ var g, C;
781
781
  n && (n.remove(), n = null);
782
782
  const p = e(), k = p.in && p.in(y), T = !(i != null && i.strategy) && p.out ? p.out(y) : void 0;
783
783
  if (!k)
@@ -785,14 +785,14 @@ function St(e, i) {
785
785
  const w = {
786
786
  in: F(k),
787
787
  out: T ? F(T) : void 0
788
- }, u = await f.runIn(w);
789
- if (!u.config) {
788
+ }, f = await m.runIn(w);
789
+ if (!f.config) {
790
790
  t && (t.direction = "in");
791
791
  return;
792
792
  }
793
- const a = u.config;
793
+ const a = f.config;
794
794
  (g = a.prepare) == null || g.call(a);
795
- const C = W(
795
+ const A = W(
796
796
  {
797
797
  ...a,
798
798
  onEnd: () => {
@@ -803,14 +803,14 @@ function St(e, i) {
803
803
  y
804
804
  );
805
805
  a.wait && await a.wait();
806
- const c = D.fromState(u.state, {
807
- config: C,
808
- from: u.from,
809
- to: u.to
806
+ const c = _.fromState(f.state, {
807
+ config: A,
808
+ from: f.from,
809
+ to: f.to
810
810
  });
811
- t = { controller: c, direction: "in" }, (E = a.onReady) == null || E.call(a), await U(), u.direction === "forward" ? c.forward() : c.backward();
812
- }, m = async (y) => {
813
- var E, b;
811
+ t = { controller: c, direction: "in" }, (C = a.onReady) == null || C.call(a), await K(), f.direction === "forward" ? c.forward() : c.backward();
812
+ }, u = async (y) => {
813
+ var C, b;
814
814
  n = y;
815
815
  const p = e(), k = !(i != null && i.strategy) && p.in ? p.in(y) : void 0, T = p.out && p.out(y);
816
816
  if (!T)
@@ -818,14 +818,14 @@ function St(e, i) {
818
818
  const w = {
819
819
  in: k ? F(k) : void 0,
820
820
  out: F(T)
821
- }, u = await f.runOut(w);
822
- if (!u.config) {
821
+ }, f = await m.runOut(w);
822
+ if (!f.config) {
823
823
  t && (t.direction = "out"), n && (n.remove(), n = null);
824
824
  return;
825
825
  }
826
- const a = u.config;
827
- g(), (E = a.prepare) == null || E.call(a);
828
- const C = W(
826
+ const a = f.config;
827
+ g(), (C = a.prepare) == null || C.call(a);
828
+ const A = W(
829
829
  {
830
830
  ...a,
831
831
  onEnd: () => {
@@ -836,37 +836,37 @@ function St(e, i) {
836
836
  y
837
837
  );
838
838
  a.wait && await a.wait();
839
- const c = D.fromState(u.state, {
840
- config: C,
841
- from: u.from,
842
- to: u.to
839
+ const c = _.fromState(f.state, {
840
+ config: A,
841
+ from: f.from,
842
+ to: f.to
843
843
  });
844
- t = { controller: c, direction: "out" }, (b = a.onReady) == null || b.call(a), await U(), u.direction === "forward" ? c.forward() : c.backward();
844
+ t = { controller: c, direction: "out" }, (b = a.onReady) == null || b.call(a), await K(), f.direction === "forward" ? c.forward() : c.backward();
845
845
  function g() {
846
846
  !r || !n || (o && r.contains(o) ? r.insertBefore(n, o) : r.appendChild(n));
847
847
  }
848
848
  };
849
849
  let h = null, v = !1;
850
- const A = (y) => () => {
850
+ const E = (y) => () => {
851
851
  if (v) return;
852
852
  v = !0;
853
853
  const p = y.cloneNode(!0);
854
854
  h ? queueMicrotask(() => {
855
- document.contains(h) && m(p);
856
- }) : m(p);
855
+ document.contains(h) && u(p);
856
+ }) : u(p);
857
857
  };
858
858
  return (y) => {
859
859
  if (y)
860
860
  return requestAnimationFrame(() => {
861
861
  r = y.parentElement, o = y.nextElementSibling;
862
862
  }), v = !1, (i == null ? void 0 : i.scope) === "local" ? queueMicrotask(() => {
863
- h = wt(y), !(h && !yt(h)) && l(y);
864
- }) : l(y), A(y);
863
+ h = vt(y), !(h && !pt(h)) && l(y);
864
+ }) : l(y), E(y);
865
865
  };
866
866
  }
867
867
  const P = /* @__PURE__ */ new Map();
868
868
  let I = null, q = !1;
869
- function tt(e) {
869
+ function nt(e) {
870
870
  if (e instanceof HTMLElement && P.has(e)) {
871
871
  const t = P.get(e);
872
872
  P.delete(e), queueMicrotask(() => {
@@ -876,16 +876,16 @@ function tt(e) {
876
876
  const i = e.childNodes;
877
877
  for (let t = 0; t < i.length; t++) {
878
878
  const n = i[t];
879
- n && tt(n);
879
+ n && nt(n);
880
880
  }
881
881
  }
882
- function At() {
882
+ function Ct() {
883
883
  q || typeof document > "u" || (q = !0, I = new MutationObserver((e) => {
884
884
  for (const i of e) {
885
885
  const t = i.removedNodes;
886
886
  for (let n = 0; n < t.length; n++) {
887
887
  const r = t[n];
888
- r && tt(r);
888
+ r && nt(r);
889
889
  }
890
890
  }
891
891
  }), document.body ? I.observe(document.body, {
@@ -902,30 +902,30 @@ function At() {
902
902
  { once: !0 }
903
903
  ));
904
904
  }
905
- function Ct(e, i) {
906
- At(), P.set(e, i);
905
+ function Tt(e, i) {
906
+ Ct(), P.set(e, i);
907
907
  }
908
- function Xt(e) {
908
+ function Wt(e) {
909
909
  return P.has(e);
910
910
  }
911
- function Wt() {
911
+ function Ut() {
912
912
  return P.size;
913
913
  }
914
- function Ht(e) {
914
+ function Bt(e) {
915
915
  const i = P.get(e);
916
916
  return i ? (P.delete(e), i(), !0) : !1;
917
917
  }
918
- function Kt() {
918
+ function Ht() {
919
919
  P.clear(), I == null || I.disconnect(), I = null, q = !1;
920
920
  }
921
921
  const O = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), X = /* @__PURE__ */ new Map();
922
- function Et(e, i, t) {
922
+ function bt(e, i, t) {
923
923
  O.set(e, i);
924
924
  let n = N.get(e);
925
925
  if (n)
926
926
  return n;
927
927
  const r = i;
928
- return n = St(
928
+ return n = At(
929
929
  () => {
930
930
  const o = O.get(e);
931
931
  return o || (console.warn(`Transition "${String(e)}" not found`), {});
@@ -934,23 +934,23 @@ function Et(e, i, t) {
934
934
  strategy: t == null ? void 0 : t.strategy,
935
935
  scope: t == null ? void 0 : t.scope,
936
936
  onCleanupEnd: () => {
937
- O.get(e) === r && Tt(e);
937
+ O.get(e) === r && kt(e);
938
938
  }
939
939
  }
940
940
  ), N.set(e, n), n;
941
941
  }
942
- function Tt(e) {
942
+ function kt(e) {
943
943
  O.delete(e), N.delete(e), X.delete(e);
944
944
  }
945
- function Ut(e, i = "manual") {
946
- const t = Et(
945
+ function Kt(e, i = "manual") {
946
+ const t = bt(
947
947
  e.key,
948
948
  {
949
949
  in: e.in,
950
950
  out: e.out
951
951
  },
952
952
  {
953
- strategy: e[Z],
953
+ strategy: e[Q],
954
954
  scope: e.scope
955
955
  }
956
956
  );
@@ -960,11 +960,11 @@ function Ut(e, i = "manual") {
960
960
  return n || (n = (r) => {
961
961
  if (r) {
962
962
  const o = t(r);
963
- o && Ct(r, o);
963
+ o && Tt(r, o);
964
964
  }
965
965
  }, X.set(e.key, n), n);
966
966
  }
967
- function bt(e) {
967
+ function Rt(e) {
968
968
  const i = e.filter((t) => t.symmetric).map((t) => ({
969
969
  from: t.to,
970
970
  to: t.from,
@@ -981,7 +981,7 @@ function V(e, i) {
981
981
  }
982
982
  return e === i;
983
983
  }
984
- function kt(e, i, t) {
984
+ function It(e, i, t) {
985
985
  for (const n of t)
986
986
  if (V(e, n.from) && V(i, n.to))
987
987
  return n.transition;
@@ -990,58 +990,58 @@ function kt(e, i, t) {
990
990
  return n.transition;
991
991
  return null;
992
992
  }
993
- const Rt = 768, It = 10, Pt = 10;
994
- function Mt(e = {}) {
993
+ const Pt = 768, Mt = 10, Vt = 10;
994
+ function xt(e = {}) {
995
995
  const { preserveScroll: i = (c) => c } = e, t = typeof i == "function" ? i : () => i;
996
996
  let n = null, r = !1, o = !1;
997
997
  const s = () => {
998
998
  const c = (n == null ? void 0 : n.clientWidth) ?? 0, g = c > 0 ? c : typeof window < "u" ? window.innerWidth : 0;
999
- return g > 0 && g < Rt;
1000
- }, f = () => (o || (r = s(), o = !0), r), l = (c) => {
1001
- const g = t(f());
1002
- return g === !1 ? !1 : g === !0 ? !0 : !g.exclude.some((E) => V(c, E));
999
+ return g > 0 && g < Pt;
1000
+ }, m = () => (o || (r = s(), o = !0), r), l = (c) => {
1001
+ const g = t(m());
1002
+ return g === !1 ? !1 : g === !0 ? !0 : !g.exclude.some((C) => V(c, C));
1003
1003
  };
1004
- let m = null;
1004
+ let u = null;
1005
1005
  const h = /* @__PURE__ */ new Map();
1006
- let v = null, A = !1, S = 0;
1006
+ let v = null, E = !1, S = 0;
1007
1007
  const y = () => {
1008
- n && v && !A && h.set(v, {
1008
+ n && v && !E && h.set(v, {
1009
1009
  x: n.scrollLeft,
1010
1010
  y: n.scrollTop
1011
1011
  });
1012
1012
  }, p = (c) => {
1013
1013
  if (!n) return;
1014
1014
  const g = l(c) && h.has(c) ? h.get(c) : { x: 0, y: 0 };
1015
- let E = 0;
1015
+ let C = 0;
1016
1016
  const b = () => {
1017
1017
  if (!n) return;
1018
1018
  n.scrollTo({
1019
1019
  top: g.y,
1020
1020
  left: g.x
1021
- }), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && E < It && (E++, requestAnimationFrame(b));
1021
+ }), !(Math.abs(n.scrollTop - g.y) < 1 && Math.abs(n.scrollLeft - g.x) < 1) && C < Mt && (C++, requestAnimationFrame(b));
1022
1022
  };
1023
1023
  requestAnimationFrame(b);
1024
1024
  };
1025
1025
  return {
1026
1026
  initializeContext: (c, g) => {
1027
- A = !0;
1028
- const E = ++S;
1029
- m = c, n || (n = pt(c), r = s(), o = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
1027
+ E = !0;
1028
+ const C = ++S;
1029
+ u = c, n || (n = St(c), r = s(), o = !0, typeof ResizeObserver < "u" && new ResizeObserver(() => {
1030
1030
  r = s();
1031
1031
  }).observe(n), (n === document.documentElement ? window : n).addEventListener("scroll", y, {
1032
1032
  passive: !0
1033
1033
  })), v = g, p(g);
1034
1034
  let b = 0;
1035
1035
  const R = () => {
1036
- E === S && (b++, b >= Pt ? A = !1 : requestAnimationFrame(R));
1036
+ C === S && (b++, b >= Vt ? E = !1 : requestAnimationFrame(R));
1037
1037
  };
1038
1038
  requestAnimationFrame(R);
1039
1039
  },
1040
1040
  calculateScrollOffset: (c, g) => {
1041
- const E = c && h.has(c) ? h.get(c) : { x: 0, y: 0 }, b = g && l(g) && h.has(g) ? h.get(g) : { x: 0, y: 0 };
1041
+ const C = c && h.has(c) ? h.get(c) : { x: 0, y: 0 }, b = g && l(g) && h.has(g) ? h.get(g) : { x: 0, y: 0 };
1042
1042
  return {
1043
- x: -b.x + E.x,
1044
- y: -b.y + E.y
1043
+ x: -b.x + C.x,
1044
+ y: -b.y + C.y
1045
1045
  };
1046
1046
  },
1047
1047
  evictScrollPosition: (c) => {
@@ -1049,47 +1049,47 @@ function Mt(e = {}) {
1049
1049
  },
1050
1050
  shouldPreserve: l,
1051
1051
  getScrollContainer: () => n,
1052
- getPositionedParentElement: () => m ? vt(m) : document.body,
1052
+ getPositionedParentElement: () => u ? Et(u) : document.body,
1053
1053
  getScrollPosition: (c) => c && h.has(c) ? h.get(c) : { x: 0, y: 0 }
1054
1054
  };
1055
1055
  }
1056
- const j = 30, B = 8, Y = 1.2, Vt = 30, xt = 600;
1057
- function Ft() {
1056
+ const j = 30, Y = 8, G = 1.2, $ = 30, Ft = 600;
1057
+ function Lt() {
1058
1058
  let e = null, i = !1, t = !1, n = null, r = null, o = !1;
1059
- const s = (w, u) => {
1059
+ const s = (w, f) => {
1060
1060
  for (let a = 0; a < w.length; a++) {
1061
- const C = w.item(a);
1062
- if (C && C.identifier === u) return C;
1061
+ const A = w.item(a);
1062
+ if (A && A.identifier === f) return A;
1063
1063
  }
1064
1064
  return null;
1065
- }, f = () => {
1065
+ }, m = () => {
1066
1066
  n !== null && (clearTimeout(n), n = null);
1067
1067
  }, l = () => {
1068
1068
  r !== null && (clearTimeout(r), r = null);
1069
- }, m = () => {
1070
- i = !0, t = !0, f(), l(), n = setTimeout(() => {
1069
+ }, u = () => {
1070
+ i = !0, t = !0, m(), l(), n = setTimeout(() => {
1071
1071
  i = !1, t = !1, n = null;
1072
- }, xt);
1072
+ }, Ft);
1073
1073
  }, h = (w) => {
1074
1074
  if (w.touches.length !== 1) {
1075
1075
  e = null;
1076
1076
  return;
1077
1077
  }
1078
- const u = w.touches.item(0);
1079
- if (!u) {
1078
+ const f = w.touches.item(0);
1079
+ if (!f) {
1080
1080
  e = null;
1081
1081
  return;
1082
1082
  }
1083
- const a = window.innerWidth, C = u.clientX <= j, c = u.clientX >= a - j;
1084
- if (!C && !c) {
1083
+ const a = window.innerWidth, A = f.clientX <= j, c = f.clientX >= a - j;
1084
+ if (!A && !c) {
1085
1085
  e = null;
1086
1086
  return;
1087
1087
  }
1088
1088
  e = {
1089
- identifier: u.identifier,
1090
- startX: u.clientX,
1091
- startY: u.clientY,
1092
- fromLeftEdge: C,
1089
+ identifier: f.identifier,
1090
+ startX: f.clientX,
1091
+ startY: f.clientY,
1092
+ fromLeftEdge: A,
1093
1093
  moved: !1
1094
1094
  };
1095
1095
  }, v = (w) => {
@@ -1098,50 +1098,54 @@ function Ft() {
1098
1098
  e = null;
1099
1099
  return;
1100
1100
  }
1101
- const u = s(w.touches, e.identifier);
1102
- if (!u) {
1101
+ const f = s(w.touches, e.identifier);
1102
+ if (!f) {
1103
1103
  e = null;
1104
1104
  return;
1105
1105
  }
1106
- const a = u.clientX - e.startX, C = u.clientY - e.startY, c = Math.abs(a), g = Math.abs(C);
1107
- if (g > B && g > c * Y) {
1106
+ const a = f.clientX - e.startX, A = f.clientY - e.startY, c = Math.abs(a), g = Math.abs(A);
1107
+ if (g > Y && g > c * G) {
1108
1108
  e = null;
1109
1109
  return;
1110
1110
  }
1111
- const E = e.fromLeftEdge ? a > 0 : a < 0;
1112
- c > B && c > g * Y && E && (e.moved = !0);
1113
- }, A = (w) => {
1111
+ const C = e.fromLeftEdge ? a > 0 : a < 0;
1112
+ c > Y && c > g * G && C && (e.moved = !0);
1113
+ }, E = (w) => {
1114
1114
  if (!e) return;
1115
- const u = s(w.changedTouches, e.identifier);
1116
- if (!u) {
1115
+ const f = s(w.changedTouches, e.identifier);
1116
+ if (!f) {
1117
1117
  e = null;
1118
1118
  return;
1119
1119
  }
1120
- const a = u.clientX - e.startX, C = e.fromLeftEdge ? a > 0 : a < 0;
1121
- e.moved && C && Math.abs(a) >= Vt && m(), e = null;
1120
+ const a = f.clientX - e.startX, A = e.fromLeftEdge ? a > 0 : a < 0;
1121
+ if (e.moved && A && Math.abs(a) >= $) {
1122
+ u(), e = null;
1123
+ return;
1124
+ }
1125
+ e.moved && Math.abs(a) >= $ && u(), e = null;
1122
1126
  }, S = () => {
1123
- e && (e.moved && m(), e = null);
1127
+ e && (e.moved && u(), e = null);
1124
1128
  };
1125
1129
  return { initialize: () => {
1126
1130
  if (typeof window > "u" || o) return;
1127
1131
  o = !0;
1128
1132
  const w = { passive: !0, capture: !0 };
1129
- window.addEventListener("touchstart", h, w), window.addEventListener("touchmove", v, w), window.addEventListener("touchend", A, w), window.addEventListener("touchcancel", S, w);
1133
+ window.addEventListener("touchstart", h, w), window.addEventListener("touchmove", v, w), window.addEventListener("touchend", E, w), window.addEventListener("touchcancel", S, w);
1130
1134
  }, destroy: () => {
1131
1135
  if (typeof window > "u" || !o) return;
1132
1136
  o = !1;
1133
1137
  const w = { capture: !0 };
1134
- window.removeEventListener("touchstart", h, w), window.removeEventListener("touchmove", v, w), window.removeEventListener("touchend", A, w), window.removeEventListener("touchcancel", S, w), f(), l(), e = null, i = !1, t = !1;
1138
+ window.removeEventListener("touchstart", h, w), window.removeEventListener("touchmove", v, w), window.removeEventListener("touchend", E, w), window.removeEventListener("touchcancel", S, w), m(), l(), e = null, i = !1, t = !1;
1135
1139
  }, isSwipeBack: () => {
1136
1140
  const w = i || t;
1137
- return w && f(), w;
1141
+ return w && m(), w;
1138
1142
  }, onPageEnter: () => {
1139
- i = !1, f(), l(), r = setTimeout(() => {
1143
+ i = !1, m(), l(), r = setTimeout(() => {
1140
1144
  t = !1, r = null;
1141
1145
  }, 0);
1142
1146
  } };
1143
1147
  }
1144
- function Lt() {
1148
+ function Ot() {
1145
1149
  let e = null;
1146
1150
  function i() {
1147
1151
  if (e != null && e.from && (e != null && e.to) && (e != null && e.outResolve) && (e != null && e.inResolve)) {
@@ -1160,7 +1164,7 @@ function Lt() {
1160
1164
  }
1161
1165
  };
1162
1166
  }
1163
- function Ot() {
1167
+ function _t() {
1164
1168
  let e = null;
1165
1169
  function i() {
1166
1170
  var n, r;
@@ -1191,34 +1195,34 @@ function jt(e, i) {
1191
1195
  const {
1192
1196
  transitions: t = [],
1193
1197
  defaultTransition: n,
1194
- middleware: r = (u, a) => ({ from: u, to: a }),
1198
+ middleware: r = (f, a) => ({ from: f, to: a }),
1195
1199
  // Identity function as default
1196
- preserveScroll: o = (u) => u
1197
- } = e, { outFirst: s = !0 } = i || {}, f = s ? Lt() : Ot(), l = bt(t), m = Ft();
1198
- m.initialize();
1200
+ preserveScroll: o = (f) => f
1201
+ } = e, { outFirst: s = !0 } = i || {}, m = s ? Ot() : _t(), l = Rt(t), u = Lt();
1202
+ u.initialize();
1199
1203
  const {
1200
1204
  initializeContext: h,
1201
1205
  calculateScrollOffset: v,
1202
- evictScrollPosition: A,
1206
+ evictScrollPosition: E,
1203
1207
  shouldPreserve: S,
1204
1208
  getScrollContainer: y,
1205
1209
  getPositionedParentElement: p,
1206
1210
  getScrollPosition: k
1207
- } = Mt({
1211
+ } = xt({
1208
1212
  preserveScroll: o
1209
- }), T = async (u, a) => {
1210
- const C = m.isSwipeBack();
1211
- f.trigger(u, a);
1212
- const c = await f.get(a);
1213
- if (a === "in" && m.onPageEnter(), !c) return () => ({});
1214
- if (C)
1215
- return a === "out" && c.from && !S(c.from) && A(c.from), () => ({});
1216
- const { from: g, to: E } = r(
1213
+ }), T = async (f, a) => {
1214
+ const A = u.isSwipeBack();
1215
+ m.trigger(f, a);
1216
+ const c = await m.get(a);
1217
+ if (a === "in" && u.onPageEnter(), !c) return () => ({});
1218
+ if (A)
1219
+ return a === "out" && c.from && !S(c.from) && E(c.from), () => ({});
1220
+ const { from: g, to: C } = r(
1217
1221
  c.from,
1218
1222
  c.to
1219
- ), R = kt(
1223
+ ), R = It(
1220
1224
  g,
1221
- E,
1225
+ C,
1222
1226
  l
1223
1227
  ) || n;
1224
1228
  if (!R) return () => ({});
@@ -1234,7 +1238,7 @@ function jt(e, i) {
1234
1238
  return p();
1235
1239
  }
1236
1240
  };
1237
- return c.from && !S(c.from) && A(c.from), (_) => R.out(_, x);
1241
+ return c.from && !S(c.from) && E(c.from), (D) => R.out(D, x);
1238
1242
  } else {
1239
1243
  const x = {
1240
1244
  scrollOffset: M,
@@ -1248,40 +1252,40 @@ function jt(e, i) {
1248
1252
  return p();
1249
1253
  }
1250
1254
  };
1251
- return (_) => R.in(_, x);
1255
+ return (D) => R.in(D, x);
1252
1256
  }
1253
1257
  };
1254
- return (u) => ({
1255
- key: u,
1256
- in: async (a) => (h(a, u), (await T(u, "in"))(a)),
1257
- out: async (a) => (await T(u, "out"))(a),
1258
+ return (f) => ({
1259
+ key: f,
1260
+ in: async (a) => (h(a, f), (await T(f, "in"))(a)),
1261
+ out: async (a) => (await T(f, "out"))(a),
1258
1262
  // Add page transition strategy for page-level transitions
1259
- [Z]: gt
1263
+ [Q]: wt
1260
1264
  });
1261
1265
  }
1262
1266
  export {
1263
- J as SCOPE_ATTR,
1264
- Q as SCOPE_READY_ATTR,
1265
- Z as TRANSITION_STRATEGY,
1266
- Ot as createAnyOrderDetector,
1267
- ht as createDefaultStrategy,
1268
- Lt as createOutFirstDetector,
1269
- gt as createPageTransitionStrategy,
1267
+ tt as SCOPE_ATTR,
1268
+ et as SCOPE_READY_ATTR,
1269
+ Q as TRANSITION_STRATEGY,
1270
+ _t as createAnyOrderDetector,
1271
+ yt as createDefaultStrategy,
1272
+ Ot as createOutFirstDetector,
1273
+ wt as createPageTransitionStrategy,
1270
1274
  jt as createSggoiTransitionContext,
1271
- Nt as createTransitionScope,
1272
- wt as findScope,
1273
- Wt as getWatchedCount,
1274
- Gt as isCssAnimation,
1275
- $t as isKeyframesAnimation,
1276
- Zt as isMultiAnimation,
1277
- yt as isScopeReady,
1278
- Jt as isSingleAnimation,
1279
- Qt as isTickAnimation,
1280
- Xt as isWatched,
1275
+ Xt as createTransitionScope,
1276
+ vt as findScope,
1277
+ Ut as getWatchedCount,
1278
+ $t as isCssAnimation,
1279
+ Zt as isKeyframesAnimation,
1280
+ Jt as isMultiAnimation,
1281
+ pt as isScopeReady,
1282
+ Qt as isSingleAnimation,
1283
+ te as isTickAnimation,
1284
+ Wt as isWatched,
1281
1285
  W as normalizeSchedule,
1282
1286
  F as normalizeToMultiAnimation,
1283
- Kt as resetObserver,
1284
- Ut as transition,
1285
- Ht as triggerUnmount,
1286
- Ct as watchUnmount
1287
+ Ht as resetObserver,
1288
+ Kt as transition,
1289
+ Bt as triggerUnmount,
1290
+ Tt as watchUnmount
1287
1291
  };
@@ -21,6 +21,14 @@
21
21
  * → settle as a swipe.
22
22
  * touchcancel after horizontal commitment also counts: the browser took the
23
23
  * gesture over, which is exactly what edge-swipe-back does on iOS.
24
+ * In some environments (notably iOS WKWebView), the OS commits the gesture
25
+ * and dispatches `touchend` instead of `touchcancel`, with `clientX`
26
+ * reported in the now document-translated coordinate space — `dx` flips
27
+ * sign and fails the in-direction recheck above. When the in-direction
28
+ * check fails but `|dx| ≥ FINAL_DISTANCE` and `moved` was set during
29
+ * touchmove, treat it as the same takeover signal: the magnitude survives
30
+ * translation, while keeping the FINAL_DISTANCE floor rejects weak or
31
+ * cancelled gestures, matching pre-patch behavior in normal browsers.
24
32
  *
25
33
  * Settling arms an "active" flag. The flag auto-expires after EXPIRE_WINDOW so
26
34
  * a successful gesture that wasn't actually a navigation (e.g. user dragged a
@@ -1 +1 @@
1
- {"version":3,"file":"create-swipe-back-detector.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-swipe-back-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAkBH,wBAAgB,uBAAuB;;;;;EA4LtC"}
1
+ {"version":3,"file":"create-swipe-back-detector.d.ts","sourceRoot":"","sources":["../../src/lib/ssgoi-transition/create-swipe-back-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAkBH,wBAAgB,uBAAuB;;;;;EAyMtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-scrolling-element.d.ts","sourceRoot":"","sources":["../../src/lib/utils/get-scrolling-element.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,WAyB1D,CAAC"}
1
+ {"version":3,"file":"get-scrolling-element.d.ts","sourceRoot":"","sources":["../../src/lib/utils/get-scrolling-element.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,WAAW,KAAG,WAkB1D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssgoi/core",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "Core animation engine for SSGOI - Native app-like page transitions with spring physics",
5
5
  "private": false,
6
6
  "type": "module",