@ssgoi/core 4.3.1 → 4.4.0

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 st=Object.defineProperty;var at=(e,n,t)=>n in e?st(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var m=(e,n,t)=>at(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./types.cjs"),D=require("./provider-Cs5iBqRD.cjs");class ct{constructor(){m(this,"listeners",new Set);m(this,"rafId",null);m(this,"isRunning",!1);m(this,"startTime",Date.now());m(this,"lastUpdate",this.startTime);m(this,"elapsed",0);m(this,"lagThreshold",500);m(this,"adjustedLag",33);m(this,"maxDeltaTime",33);m(this,"gap",1e3/240);m(this,"nextTime",this.gap);m(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 l=i/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(c=>{c(l,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 N=new ct;function lt(e){const{integrator:n,from:t,to:i,velocity:r=0,onUpdate:o,onComplete:l,onStart:c}=e;let s={position:t,velocity:r},f=!0,h=0,p=!1;const w=S=>{if(f){if(p||(p=!0,c==null||c()),s=n.step(s,i,S),n.isSettled(s,i)){if(h+=Math.min(S,.033),h>=D.SETTLE_THRESHOLD){s={position:i,velocity:0},f=!1,o(s.position),N.unsubscribe(w),l();return}}else h=0;o(s.position)}};return N.subscribe(w),{stop:()=>{f&&(f=!1,N.unsubscribe(w))},getPosition:()=>s.position,getVelocity:()=>s.velocity,isRunning:()=>f}}const O=1e3/60;function ut(e,n,t,i=0){let o={position:n,velocity:i},l=0;const c=[];for(let s=0;s<600;s++){const f=s*O;if(c.push({time:f,position:o.position,velocity:o.velocity}),o=e.step(o,t,O/1e3),e.isSettled(o,t)){if(l+=O/1e3,l>=D.SETTLE_THRESHOLD){c.push({time:(s+1)*O,position:t,velocity:0});break}}else l=0}return c}function G(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 f=Math.floor((r+o)/2);e[f].time<=n?r=f:o=f}const l=e[r],c=e[o],s=(n-l.time)/(c.time-l.time);return{position:l.position+(c.position-l.position)*s,velocity:l.velocity+(c.velocity-l.velocity)*s}}function ft(e,n){return e.map(t=>n(t.position))}function mt(e){const{integrator:n,element:t,from:i,to:r,velocity:o=0,style:l,onComplete:c,onStart:s}=e,f=ut(n,i,r,o);if(f.length===0)return s==null||s(),c(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const h=ft(f,l),p=f[f.length-1],w=p.time,S=h[0];if(S)for(const y of Object.keys(S))t.style[y]="";const d=t.animate(h,{duration:w,fill:"forwards",easing:"linear",composite:"replace"});let u=!0;const A=performance.now();return s==null||s(),d.onfinish=()=>{u&&(u=!1,c())},{stop:()=>{u&&(u=!1,d.cancel())},getPosition:()=>{if(!u)return p.position;const y=performance.now()-A;return G(f,y).position},getVelocity:()=>{if(!u)return 0;const y=performance.now()-A;return G(f,y).velocity},isRunning:()=>u}}function dt(e){const{to:n,onStart:t,onComplete:i}=e;return t==null||t(),i(),{stop:()=>{},getPosition:()=>n,getVelocity:()=>0,isRunning:()=>!1}}class ht{static from(n){const{tick:t,css:i}=n;if(t&&i)throw new Error("Cannot use both 'tick' and 'css' options together");return i?r=>mt({...r,element:i.element,style:i.style}):t?r=>lt({...r,onUpdate:t}):dt}}class J{}const gt={stiffness:300,damping:30};class $ extends J{constructor(t){super();m(this,"options");m(this,"runner");m(this,"controls",null);m(this,"isAnimating",!1);m(this,"currentValue");m(this,"currentVelocity",0);m(this,"updateFn");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,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 l=r(o);for(const[c,s]of Object.entries(l))i.style[c]=typeof s=="number"?String(s):s}}else this.updateFn=()=>{};this.runner=ht.from({tick:t.tick,css:t.css})}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?D.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new D.SpringIntegrator(gt)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator: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 L extends J{constructor(t){super();m(this,"config");m(this,"animators",new Map);m(this,"itemOrder",[]);m(this,"completedCount",0);m(this,"completedAnimators",new Set);m(this,"direction","forward");m(this,"idCounter",0);m(this,"rafId",null);m(this,"from");m(this,"to");m(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 $({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,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,l,c,s,f;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),(c=(l=this.config).onProgress)==null||c.call(l,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(f=(s=this.config).onEnd)==null||f.call(s)))}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 l=t[i-1],c=this.animators.get(l);if(!c||!c.started)continue;const s=this.getAnimatorProgress(c),f=o.item.normalizedOffset;s>=f&&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 $({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,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 L({...i,state:t})}}const W=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"}}}),Z=()=>({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"}}),j="data-ssgoi-scope",X="data-ssgoi-scope-ready";function pt(){return e=>{if(e)return e.setAttribute(j,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(X,"true")})}),()=>{}}}function tt(e){return e.hasAttribute(X)}function et(e){return e.closest(`[${j}]`)}const wt=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},yt=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 K(e){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})})}function St(e,n){var S;let t=null,i=null,r=null,o=null;const l={get currentAnimation(){return t}},c=((S=n==null?void 0:n.strategy)==null?void 0:S.call(n,l))||Q(l),s=async d=>{var P,V;i&&(i.remove(),i=null);const u=e(),A=u.in&&u.in(d),y=!(n!=null&&n.strategy)&&u.out?u.out(d):void 0;if(!A)return;const I={in:C.normalizeToMultiAnimation(A),out:y?C.normalizeToMultiAnimation(y):void 0},g=await c.runIn(I);if(!g.config){t&&(t.direction="in");return}const a=g.config;(P=a.prepare)==null||P.call(a);const v=C.normalizeSchedule({...a,onEnd:()=>{var E;t=null,(E=a.onEnd)==null||E.call(a)}},d);a.wait&&await a.wait();const T=L.fromState(g.state,{config:v,from:g.from,to:g.to});t={controller:T,direction:"in"},(V=a.onReady)==null||V.call(a),await K(),g.direction==="forward"?T.forward():T.backward()},f=async d=>{var V,E;i=d;const u=e(),A=!(n!=null&&n.strategy)&&u.in?u.in(d):void 0,y=u.out&&u.out(d);if(!y)return;const I={in:A?C.normalizeToMultiAnimation(A):void 0,out:C.normalizeToMultiAnimation(y)},g=await c.runOut(I);if(!g.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const a=g.config;P(),(V=a.prepare)==null||V.call(a);const v=C.normalizeSchedule({...a,onEnd:()=>{var M,k;(M=a.onEnd)==null||M.call(a),i&&(i.remove(),i=null),t=null,(k=n==null?void 0:n.onCleanupEnd)==null||k.call(n)}},d);a.wait&&await a.wait();const T=L.fromState(g.state,{config:v,from:g.from,to:g.to});t={controller:T,direction:"out"},(E=a.onReady)==null||E.call(a),await K(),g.direction==="forward"?T.forward():T.backward();function P(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let h=null,p=!1;const w=d=>()=>{if(p)return;p=!0;const u=d.cloneNode(!0);h?queueMicrotask(()=>{document.contains(h)&&f(u)}):f(u)};return d=>{if(d)return requestAnimationFrame(()=>{r=d.parentElement,o=d.nextElementSibling}),p=!1,(n==null?void 0:n.scope)==="local"?queueMicrotask(()=>{h=et(d),!(h&&!tt(h))&&s(d)}):s(d),w(d)}}const R=new Map;let b=null,U=!1;function it(e){if(e instanceof HTMLElement&&R.has(e)){const t=R.get(e);R.delete(e),queueMicrotask(()=>{t()})}const n=e.childNodes;for(let t=0;t<n.length;t++){const i=n[t];i&&it(i)}}function vt(){U||typeof document>"u"||(U=!0,b=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&&it(r)}}}),document.body?b.observe(document.body,{childList:!0,subtree:!0}):document.addEventListener("DOMContentLoaded",()=>{b==null||b.observe(document.body,{childList:!0,subtree:!0})},{once:!0}))}function nt(e,n){vt(),R.set(e,n)}function At(e){return R.has(e)}function Ct(){return R.size}function Tt(e){const n=R.get(e);return n?(R.delete(e),n(),!0):!1}function Et(){R.clear(),b==null||b.disconnect(),b=null,U=!1}const z=new Map,H=new Map,Y=new Map;function bt(e,n,t){z.set(e,n);let i=H.get(e);if(i)return i;const r=n;return i=St(()=>{const o=z.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:()=>{z.get(e)===r&&Rt(e)}}),H.set(e,i),i}function Rt(e){z.delete(e),H.delete(e),Y.delete(e)}function kt(e,n="manual"){const t=bt(e.key,{in:e.in,out:e.out},{strategy:e[W],scope:e.scope});if(n==="manual")return t;let i=Y.get(e.key);return i||(i=r=>{if(r){const o=t(r);o&&nt(r,o)}},Y.set(e.key,i),i)}function Pt(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function Vt(e){let n=!1,t=0,i=0,r=!1;const o=50,l=d=>{if(!e)return;const u=d.touches[0];u&&(r=u.clientX<o,r&&(t=u.clientX,i=u.clientY))},c=d=>{if(!e||!r)return;const u=d.touches[0];if(!u)return;const A=u.clientX-t,y=u.clientY-i;A>window.outerWidth/2-5&&Math.abs(A)>Math.abs(y)?n=!0:n=!1},s=()=>{e&&(r=!1,t=0,i=0)},f=()=>n,h=()=>{typeof window>"u"||e&&(window.addEventListener("touchstart",l,{passive:!0}),window.addEventListener("touchmove",c,{passive:!0}),window.addEventListener("touchend",s,{passive:!0}))},p=()=>{typeof window>"u"||(window.removeEventListener("touchstart",l),window.removeEventListener("touchmove",c),window.removeEventListener("touchend",s))};let w=0;return{initialize:h,cleanup:p,isSwipePending:f,resetSwipeDetection:()=>{requestAnimationFrame(()=>{w++,w>1&&(w=0,n=!1)})}}}function It(){let e=null,n=null;const t=new Map;let i=null;const r=()=>{e&&i&&t.set(i,{x:e.scrollLeft,y:e.scrollTop})};return{initializeContext:(h,p)=>{n=h,e||(e=wt(h),(e===document.documentElement?window:e).addEventListener("scroll",r,{passive:!0})),i=p},calculateScrollOffset:(h,p)=>{const w=h&&t.has(h)?t.get(h):{x:0,y:0},S=p&&t.has(p)?t.get(p):{x:0,y:0};return{x:-S.x+w.x,y:-S.y+w.y}},getScrollContainer:()=>e,getPositionedParentElement:()=>n?yt(n):document.body,getScrollPosition:h=>h&&t.has(h)?t.get(h):{x:0,y:0}}}function x(e,n){if(n==="*")return!0;if(n.endsWith("/*")){const t=n.slice(0,-2);return e===t||e.startsWith(t+"/")}return e===n}function B(e,n,t){for(const i of t)if(x(e,i.from)&&x(n,i.to))return i.transition;for(const i of t)if((i.from==="*"||x(e,i.from))&&(i.to==="*"||x(n,i.to)))return i.transition;return null}function rt(){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 ot(){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)){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 Mt(e,n){const{transitions:t=[],defaultTransition:i,middleware:r=(g,a)=>({from:g,to:a}),skipOnIosSwipe:o=!0}=e,{outFirst:l=!0,createNavigationDetector:c}=n||{},s=(c==null?void 0:c())??(l?rt():ot()),f=Pt(t),{initializeContext:h,calculateScrollOffset:p,getScrollContainer:w,getPositionedParentElement:S,getScrollPosition:d}=It(),u=Vt(o);u.initialize();const A=async(g,a)=>{if(u.isSwipePending())return u.resetSwipeDetection(),a==="in"?async k=>({onReady:()=>{k.style.visibility="visible"}}):()=>({});s.trigger(g,a);const v=await s.get(a);if(!v)return()=>({});const{from:T,to:P}=r(v.from,v.to),E=B(T,P,f)||i;if(!E)return()=>({});const M=p(v.from,v.to);if(a==="out"){const k={scrollOffset:M,scroll:d(v.from),get scrollingElement(){return w()||document.documentElement},get positionedParent(){return S()}};return F=>E.out(F,k)}else{const k={scrollOffset:M,get scroll(){return d(v.to)},get scrollingElement(){return w()||document.documentElement},get positionedParent(){return S()}};return async F=>{const _=await Promise.resolve(E.in(F,k)),q=_.onReady;return _.onReady=()=>{F.style.visibility="visible",q==null||q()},_}}},y=g=>({key:g,in:async a=>(h(a,g),(await A(g,"in"))(a)),out:async a=>(await A(g,"out"))(a),[W]:Z}),I=(g,a)=>{if(u.isSwipePending())return!1;const{from:v,to:T}=r(g,a);return!!(B(v,T,f)||i)};return c?{getTransition:y,hasMatchingTransition:I}:y}exports.isCssAnimation=C.isCssAnimation;exports.isMultiAnimation=C.isMultiAnimation;exports.isSingleAnimation=C.isSingleAnimation;exports.isTickAnimation=C.isTickAnimation;exports.normalizeSchedule=C.normalizeSchedule;exports.normalizeToMultiAnimation=C.normalizeToMultiAnimation;exports.SCOPE_ATTR=j;exports.SCOPE_READY_ATTR=X;exports.TRANSITION_STRATEGY=W;exports.createAnyOrderDetector=ot;exports.createDefaultStrategy=Q;exports.createOutFirstDetector=rt;exports.createPageTransitionStrategy=Z;exports.createSggoiTransitionContext=Mt;exports.createTransitionScope=pt;exports.findScope=et;exports.getWatchedCount=Ct;exports.isScopeReady=tt;exports.isWatched=At;exports.resetObserver=Et;exports.transition=kt;exports.triggerUnmount=Tt;exports.watchUnmount=nt;
1
+ "use strict";var ct=Object.defineProperty;var lt=(e,n,t)=>n in e?ct(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var d=(e,n,t)=>lt(e,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./types.cjs"),z=require("./provider-Cs5iBqRD.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(c=>{c(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 U=new ut;function ft(e){const{integrator:n,from:t,to:i,velocity:r=0,onUpdate:o,onComplete:s,onStart:c}=e;let a={position:t,velocity:r},f=!0,w=0,A=!1;const T=E=>{if(f){if(A||(A=!0,c==null||c()),a=n.step(a,i,E),n.isSettled(a,i)){if(w+=Math.min(E,.033),w>=z.SETTLE_THRESHOLD){a={position:i,velocity:0},f=!1,o(a.position),U.unsubscribe(T),s();return}}else w=0;o(a.position)}};return U.subscribe(T),{stop:()=>{f&&(f=!1,U.unsubscribe(T))},getPosition:()=>a.position,getVelocity:()=>a.velocity,isRunning:()=>f}}const O=1e3/60;function mt(e,n,t,i=0){let o={position:n,velocity:i},s=0;const c=[];for(let a=0;a<600;a++){const f=a*O;if(c.push({time:f,position:o.position,velocity:o.velocity}),o=e.step(o,t,O/1e3),e.isSettled(o,t)){if(s+=O/1e3,s>=z.SETTLE_THRESHOLD){c.push({time:(a+1)*O,position:t,velocity:0});break}}else s=0}return c}function K(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 f=Math.floor((r+o)/2);e[f].time<=n?r=f:o=f}const s=e[r],c=e[o],a=(n-s.time)/(c.time-s.time);return{position:s.position+(c.position-s.position)*a,velocity:s.velocity+(c.velocity-s.velocity)*a}}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:c,onStart:a}=e,f=mt(n,i,r,o);if(f.length===0)return a==null||a(),c(),{stop:()=>{},getPosition:()=>r,getVelocity:()=>0,isRunning:()=>!1};const w=dt(f,s),A=f[f.length-1],T=A.time,E=w[0];if(E)for(const l of Object.keys(E))t.style[l]="";const g=t.animate(w,{duration:T,fill:"forwards",easing:"linear",composite:"replace"});let m=!0;const h=performance.now();return a==null||a(),g.onfinish=()=>{m&&(m=!1,c())},{stop:()=>{m&&(m=!1,g.cancel())},getPosition:()=>{if(!m)return A.position;const l=performance.now()-h;return K(f,l).position},getVelocity:()=>{if(!m)return 0;const l=performance.now()-h;return K(f,l).velocity},isRunning:()=>m}}function gt(e){const{to:n,onStart:t,onComplete:i}=e;return t==null||t(),i(),{stop:()=>{},getPosition:()=>n,getVelocity:()=>0,isRunning:()=>!1}}class pt{static from(n){const{tick:t,css:i}=n;if(t&&i)throw new Error("Cannot use both 'tick' and 'css' options together");return i?r=>ht({...r,element:i.element,style:i.style}):t?r=>ft({...r,onUpdate:t}):gt}}class Z{}const yt={stiffness:300,damping:30};class B extends Z{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");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,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[c,a]of Object.entries(s))i.style[c]=typeof a=="number"?String(a):a}}else this.updateFn=()=>{};this.runner=pt.from({tick:t.tick,css:t.css})}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?z.IntegratorProvider.from({spring:t.spring,inertia:t.inertia}):new z.SpringIntegrator(yt)}runAnimation(t){this.isAnimating=!0,this.controls=this.runner({integrator: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 D extends Z{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 B({from:this.from,to:this.to,physics:t.physics,tick:t.tick,css:t.css,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,c,a,f;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),(c=(s=this.config).onProgress)==null||c.call(s,this.completedCount,this.config.items.length),this.completedCount===this.config.items.length&&(this.stopScheduler(),(f=(a=this.config).onEnd)==null||f.call(a)))}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],c=this.animators.get(s);if(!c||!c.started)continue;const a=this.getAnimatorProgress(c),f=o.item.normalizedOffset;a>=f&&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 B({from:this.to,to:this.from,physics:t.item.physics,tick:t.item.tick,css:t.item.css,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 D({...i,state:t})}}const X=Symbol.for("TRANSITION_STRATEGY"),tt=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"}}}),et=()=>({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"}}),j="data-ssgoi-scope",G="data-ssgoi-scope-ready";function wt(){return e=>{if(e)return e.setAttribute(j,""),queueMicrotask(()=>{queueMicrotask(()=>{e.setAttribute(G,"true")})}),()=>{}}}function it(e){return e.hasAttribute(G)}function nt(e){return e.closest(`[${j}]`)}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},vt=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 J(e){return new Promise(n=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{n()})})})}function At(e,n){var E;let t=null,i=null,r=null,o=null;const s={get currentAnimation(){return t}},c=((E=n==null?void 0:n.strategy)==null?void 0:E.call(n,s))||tt(s),a=async g=>{var v,R;i&&(i.remove(),i=null);const m=e(),h=m.in&&m.in(g),l=!(n!=null&&n.strategy)&&m.out?m.out(g):void 0;if(!h)return;const C={in:b.normalizeToMultiAnimation(h),out:l?b.normalizeToMultiAnimation(l):void 0},p=await c.runIn(C);if(!p.config){t&&(t.direction="in");return}const u=p.config;(v=u.prepare)==null||v.call(u);const S=b.normalizeSchedule({...u,onEnd:()=>{var F;t=null,(F=u.onEnd)==null||F.call(u)}},g);u.wait&&await u.wait();const y=D.fromState(p.state,{config:S,from:p.from,to:p.to});t={controller:y,direction:"in"},(R=u.onReady)==null||R.call(u),await J(),p.direction==="forward"?y.forward():y.backward()},f=async g=>{var R,F;i=g;const m=e(),h=!(n!=null&&n.strategy)&&m.in?m.in(g):void 0,l=m.out&&m.out(g);if(!l)return;const C={in:h?b.normalizeToMultiAnimation(h):void 0,out:b.normalizeToMultiAnimation(l)},p=await c.runOut(C);if(!p.config){t&&(t.direction="out"),i&&(i.remove(),i=null);return}const u=p.config;v(),(R=u.prepare)==null||R.call(u);const S=b.normalizeSchedule({...u,onEnd:()=>{var q,M;(q=u.onEnd)==null||q.call(u),i&&(i.remove(),i=null),t=null,(M=n==null?void 0:n.onCleanupEnd)==null||M.call(n)}},g);u.wait&&await u.wait();const y=D.fromState(p.state,{config:S,from:p.from,to:p.to});t={controller:y,direction:"out"},(F=u.onReady)==null||F.call(u),await J(),p.direction==="forward"?y.forward():y.backward();function v(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};let w=null,A=!1;const T=g=>()=>{if(A)return;A=!0;const m=g.cloneNode(!0);w?queueMicrotask(()=>{document.contains(w)&&f(m)}):f(m)};return g=>{if(g)return requestAnimationFrame(()=>{r=g.parentElement,o=g.nextElementSibling}),A=!1,(n==null?void 0:n.scope)==="local"?queueMicrotask(()=>{w=nt(g),!(w&&!it(w))&&a(g)}):a(g),T(g)}}const k=new Map;let P=null,Y=!1;function rt(e){if(e instanceof HTMLElement&&k.has(e)){const t=k.get(e);k.delete(e),queueMicrotask(()=>{t()})}const n=e.childNodes;for(let t=0;t<n.length;t++){const i=n[t];i&&rt(i)}}function Tt(){Y||typeof document>"u"||(Y=!0,P=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&&rt(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 ot(e,n){Tt(),k.set(e,n)}function Ct(e){return k.has(e)}function Et(){return k.size}function bt(e){const n=k.get(e);return n?(k.delete(e),n(),!0):!1}function Rt(){k.clear(),P==null||P.disconnect(),P=null,Y=!1}const L=new Map,H=new Map,W=new Map;function Pt(e,n,t){L.set(e,n);let i=H.get(e);if(i)return i;const r=n;return i=At(()=>{const o=L.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:()=>{L.get(e)===r&&kt(e)}}),H.set(e,i),i}function kt(e){L.delete(e),H.delete(e),W.delete(e)}function Ft(e,n="manual"){const t=Pt(e.key,{in:e.in,out:e.out},{strategy:e[X],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&&ot(r,o)}},W.set(e.key,i),i)}function Mt(e){const n=e.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...e,...n]}function Vt(e){let n=!1,t=0,i=0,r=!1;const o=50,s=g=>{if(!e)return;const m=g.touches[0];m&&(r=m.clientX<o,r&&(t=m.clientX,i=m.clientY))},c=g=>{if(!e||!r)return;const m=g.touches[0];if(!m)return;const h=m.clientX-t,l=m.clientY-i;h>window.outerWidth/2-5&&Math.abs(h)>Math.abs(l)?n=!0:n=!1},a=()=>{e&&(r=!1,t=0,i=0)},f=()=>n,w=()=>{typeof window>"u"||e&&(window.addEventListener("touchstart",s,{passive:!0}),window.addEventListener("touchmove",c,{passive:!0}),window.addEventListener("touchend",a,{passive:!0}))},A=()=>{typeof window>"u"||(window.removeEventListener("touchstart",s),window.removeEventListener("touchmove",c),window.removeEventListener("touchend",a))};let T=0;return{initialize:w,cleanup:A,isSwipePending:f,resetSwipeDetection:()=>{requestAnimationFrame(()=>{T++,T>1&&(T=0,n=!1)})}}}function I(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 Q(e,n,t){for(const i of t)if(I(e,i.from)&&I(n,i.to))return i.transition;for(const i of t)if((i.from==="*"||I(e,i.from))&&(i.to==="*"||I(n,i.to)))return i.transition;return null}function It(e={}){const{preserveScroll:n=!1,resetPatterns:t=[]}=e,i=h=>t.some(l=>I(h,l));let r=null,o=null;const s=new Map;let c=null,a=!1;const f=()=>{r&&c&&!a&&s.set(c,{x:r.scrollLeft,y:r.scrollTop})},w=h=>{if(!r||!n)return;if(i(h)){r.scrollTo({top:0,left:0});return}const l=s.get(h);if(!l){r.scrollTo({top:0,left:0});return}const C=10;let p=0;const u=()=>{if(!r)return;r.scrollTo({top:l.y,left:l.x});const S=r.scrollTop,y=r.scrollLeft;!(Math.abs(S-l.y)<1&&Math.abs(y-l.x)<1)&&p<C&&(p++,requestAnimationFrame(u))};requestAnimationFrame(u)};return{initializeContext:(h,l)=>{a=!0,o=h,r||(r=St(h),(r===document.documentElement?window:r).addEventListener("scroll",f,{passive:!0})),c=l,w(l);const C=10;let p=0;const u=()=>{p++,p>=C?a=!1:requestAnimationFrame(u)};requestAnimationFrame(u)},calculateScrollOffset:(h,l)=>{const C=h&&s.has(h)?s.get(h):{x:0,y:0},p=l&&i(l);p&&s.set(l,{x:0,y:0});const u=p?{x:0,y:0}:l&&s.has(l)?s.get(l):{x:0,y:0};return{x:-u.x+C.x,y:-u.y+C.y}},getScrollContainer:()=>r,getPositionedParentElement:()=>o?vt(o):document.body,getScrollPosition:h=>h&&s.has(h)?s.get(h):{x:0,y:0}}}function st(){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 at(){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)){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 xt(e,n){const{transitions:t=[],defaultTransition:i,middleware:r=(S,y)=>({from:S,to:y}),skipOnIosSwipe:o=!0,experimentalPreserveScroll:s=!1,scrollResetPatterns:c=[]}=e,{outFirst:a=!0,createNavigationDetector:f}=n||{},w=(f==null?void 0:f())??(a?st():at()),A=Mt(t),{initializeContext:T,calculateScrollOffset:E,getScrollContainer:g,getPositionedParentElement:m,getScrollPosition:h}=It({preserveScroll:s,resetPatterns:c}),l=Vt(o);l.initialize();const C=async(S,y)=>{if(l.isSwipePending())return l.resetSwipeDetection(),y==="in"?async V=>({onReady:()=>{V.style.visibility="visible"}}):()=>({});w.trigger(S,y);const v=await w.get(y);if(!v)return()=>({});const{from:R,to:F}=r(v.from,v.to),M=Q(R,F,A)||i;if(!M)return()=>({});const $=E(v.from,v.to);if(y==="out"){const V={scrollOffset:$,scroll:h(v.from),get scrollingElement(){return g()||document.documentElement},get positionedParent(){return m()}};return x=>M.out(x,V)}else{const V={scrollOffset:$,get scroll(){return h(v.to)},get scrollingElement(){return g()||document.documentElement},get positionedParent(){return m()}};return async x=>{const _=await Promise.resolve(M.in(x,V)),N=_.onReady;return _.onReady=()=>{x.style.visibility="visible",N==null||N()},_}}},p=S=>({key:S,in:async y=>(T(y,S),(await C(S,"in"))(y)),out:async y=>(await C(S,"out"))(y),[X]:et}),u=(S,y)=>{if(l.isSwipePending())return!1;const{from:v,to:R}=r(S,y);return!!(Q(v,R,A)||i)};return f?{getTransition:p,hasMatchingTransition:u}:p}exports.isCssAnimation=b.isCssAnimation;exports.isMultiAnimation=b.isMultiAnimation;exports.isSingleAnimation=b.isSingleAnimation;exports.isTickAnimation=b.isTickAnimation;exports.normalizeSchedule=b.normalizeSchedule;exports.normalizeToMultiAnimation=b.normalizeToMultiAnimation;exports.SCOPE_ATTR=j;exports.SCOPE_READY_ATTR=G;exports.TRANSITION_STRATEGY=X;exports.createAnyOrderDetector=at;exports.createDefaultStrategy=tt;exports.createOutFirstDetector=st;exports.createPageTransitionStrategy=et;exports.createSggoiTransitionContext=xt;exports.createTransitionScope=wt;exports.findScope=nt;exports.getWatchedCount=Et;exports.isScopeReady=it;exports.isWatched=Ct;exports.resetObserver=Rt;exports.transition=Ft;exports.triggerUnmount=bt;exports.watchUnmount=ot;