@ssgoi/core 7.3.0-beta.3 → 7.3.0-beta.4

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.
@@ -1,5 +1,6 @@
1
1
  import { Pose, Timeline } from '../types/index.ts';
2
2
  import { Animation, AnimationDisposal } from './animation';
3
+ import { ViewportHint } from './web-presentation';
3
4
  export interface HandoffEvent {
4
5
  kind: "element" | "key" | "enter" | "ambiguous" | "release" | "fallback";
5
6
  target?: HTMLElement;
@@ -10,6 +11,8 @@ export interface HandoffEvent {
10
11
  export interface HostAttachOptions {
11
12
  /** Presence is independent of tracks: blind/static hero can leave pages unanimated. */
12
13
  targets?: readonly HTMLElement[];
14
+ /** Where the scroll container rests for this run; boxes are read before it gets there. */
15
+ scroll?: ViewportHint;
13
16
  }
14
17
  /** A transition scope owns live presentation, replaceable choreography, and retirement. */
15
18
  export declare class HostAnimation extends Animation {
@@ -1 +1 @@
1
- {"version":3,"file":"host-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/host-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAiBhE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,UAAU,CAAC;IACzE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CACnC;AACD,MAAM,WAAW,iBAAiB;IAChC,uFAAuF;IACvF,OAAO,CAAC,EAAE,SAAS,WAAW,EAAE,CAAC;CAClC;AAMD,2FAA2F;AAC3F,qBAAa,aAA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MAAM,EAAE,SAAS,YAAY,EAAE,KAAK,IAAI,CAAC;IAEtD,gFAAgF;IAChF,cAAc,IAAI,IAAI;IAQtB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,iBAAsB,GAAG,IAAI;IA6M9D,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,MAAM;IA8Fd,OAAO,CAAC,eAAe;IAUvB,IAAI,IAAI,IAAI;IAQZ,OAAO,IAAI,IAAI;IAMf,KAAK,IAAI,IAAI;IAOb,QAAQ,IAAI,IAAI;IAMhB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IAWxC,IAAI,WAAW,IAAI,OAAO,CAKzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,MAAM,CAErB;IACD,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAGrD,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAM5B;IACD,OAAO,IAAI,IAAI,EAAE;IAGjB,WAAW,IAAI,QAAQ,EAAE;IAGzB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAG9B,IAAI,WAAW,IAAI,SAAS,GAAG,IAAI,CAElC;IACD,IAAI,aAAa,IAAI,MAAM,CAE1B;IACD,SAAS,CAAC,EAAE,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI;IAMrC,OAAO,CAAC,MAAM;CAGf"}
@@ -2,7 +2,7 @@ import { Pose, StyleObject, Timeline } from '../types/index.ts';
2
2
  import { Integrator } from './integrator';
3
3
  import { Animation, AnimationDisposal } from './animation';
4
4
  import { MotionSnapshot } from '../runtime/motion-matching';
5
- import { PresentationCodec } from './web-presentation';
5
+ import { PresentationCodec, ViewportHint } from './web-presentation';
6
6
  export interface WebMotionOptions {
7
7
  /** Semantic identity, scoped by HostAnimation; never inferred from array position. */
8
8
  key?: string;
@@ -89,6 +89,7 @@ export declare class WebAnimation extends Animation {
89
89
  private readonly legacyCompletionCleanup;
90
90
  readonly motion: WebMotionOptions;
91
91
  private codec;
92
+ private viewport;
92
93
  private adopted;
93
94
  private presentationFrames;
94
95
  private hold;
@@ -126,6 +127,15 @@ export declare class WebAnimation extends Animation {
126
127
  space: unknown;
127
128
  lifetime: "persistent" | "temporary" | undefined;
128
129
  };
130
+ /**
131
+ * Read the element's rendered box while the scene is laid out for this run.
132
+ * The next navigation snapshots this track only after the framework has
133
+ * unmounted the element or an Activity hide has taken it out of flow, so a
134
+ * box measured at that point is empty or shifted and the handoff would
135
+ * decode the pose against the wrong frame. Playback never needs this; an
136
+ * uninterrupted run still decodes nothing.
137
+ */
138
+ measure(viewport?: ViewportHint): void;
129
139
  /** Final output, including any earlier residual, is the next handoff's source. */
130
140
  getMotionSnapshot(): WebMotionSnapshot;
131
141
  adopt(snapshot: MotionSnapshot<HTMLElement>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"web-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAiB,MAAM,QAAQ,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAmB,MAAM,cAAc,CAAC;AAOhE,OAAO,EACL,SAAS,EAET,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,WAAW,gBAAgB;IAC/B,sFAAsF;IACtF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC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AiD1B;;;;;;OAMG;IACH,WAAW,IAAI,IAAI;IAInB,IAAI,WAAW,IAAI,OAAO,CAEzB;IACD,IAAI,QAAQ,IAAI,OAAO,CAEtB;IACD,IAAI,UAAU,IAAI,OAAO,CAExB;IACD,IAAI,WAAW,IAAI,OAAO,CAEzB;IAED,IAAI,QAAQ,IAAI,MAAM,CAMrB;IAED,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAcrD,IAAI,YAAY,IAAI,MAAM,CAEzB;IACD,IAAI,YAAY,CAAC,IAAI,EAAE,MAAM,EAG5B;IAED,OAAO,IAAI,IAAI,EAAE;IAcjB,WAAW,IAAI,QAAQ,EAAE;IAczB,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAU9B,OAAO,CAAC,SAAS;IAmFjB;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IA4GvB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,gBAAgB;IAgBxB;;;;;;;OAOG;IACH,OAAO,CAAC,aAAa;IAWrB,OAAO,CAAC,gBAAgB;IAOxB,OAAO,CAAC,YAAY;CAQrB"}
@@ -1,5 +1,18 @@
1
1
  import { StyleObject } from '../runtime/motion-state';
2
2
  import { MotionChannel } from '../runtime/motion-matching';
3
+ /**
4
+ * Where the scroll container rests once the run being measured has applied
5
+ * its scroll policy. The incoming page's scroll restores in the rendering
6
+ * update after a run attaches, so a box read at attach time is still offset
7
+ * by the outgoing page's scroll. Expressing every frame at its own run's
8
+ * resting scroll keeps successive runs in one viewport space, which is what
9
+ * a handoff compares.
10
+ */
11
+ export interface ViewportHint {
12
+ container: HTMLElement;
13
+ x: number;
14
+ y: number;
15
+ }
3
16
  export interface PresentationCodec {
4
17
  readonly frame?: {
5
18
  left: number;
@@ -20,6 +33,6 @@ export declare function readTransform(value: string, width: number, height: numb
20
33
  * this preserves rotation instead of linearly collapsing a rotation matrix.
21
34
  * 3D surfaces are supported as projected planes, not arbitrary 3D scenes.
22
35
  */
23
- export declare function createWebPresentationCodec(element: HTMLElement): PresentationCodec;
36
+ export declare function createWebPresentationCodec(element: HTMLElement, viewport?: ViewportHint): PresentationCodec;
24
37
  export {};
25
38
  //# sourceMappingURL=web-presentation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web-presentation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9E,wEAAwE;IACxE,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxD,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,WAAW,CAAC;CACvE;AAED,KAAK,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAyB/D,+EAA+E;AAC/E,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,IAAI,CAkDf;AAiFD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,WAAW,GACnB,iBAAiB,CA+InB"}
1
+ {"version":3,"file":"web-presentation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-presentation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,WAAW,CAAC;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9E,wEAAwE;IACxE,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IACxD,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,WAAW,CAAC;CACvE;AAED,KAAK,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAyB/D,+EAA+E;AAC/E,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,GACb,MAAM,GAAG,IAAI,CAkDf;AAiFD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,WAAW,EACpB,QAAQ,CAAC,EAAE,YAAY,GACtB,iBAAiB,CA2JnB"}
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Oe=Object.defineProperty;var Me=(t,e,n)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var M=(t,e,n)=>Me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-CtyacfH7.cjs"),b=require("./retain-opacity-5kqI1OCo.cjs"),S=require("./provider-JDtJ5Jzf.cjs"),z=require("./page-motion-Dhj3UfzO.cjs");class ae{constructor(e){M(this,"durationSec");this.durationSec=Math.max(1/60,e.durationSec)}step(e,n,o){const i=n-e.position;if(i===0)return e;const r=Math.sign(i),c=Math.abs(i)/this.durationSec,s=r*c*o,l=e.position+s;return(r>0?l>=n:l<=n)?{position:n,velocity:0}:{position:l,velocity:r*c}}isSettled(e,n){return Math.abs(e.position-n)<S.POSITION_THRESHOLD}}function Rt(t,e){function n(r){let c=0,s=0;const l=r.offsetWidth,a=r.offsetHeight;let d=r;for(;d;)c+=d.offsetTop,s+=d.offsetLeft,d=d.offsetParent;return c-=window.scrollY,s-=window.scrollX,{top:c,left:s,width:l,height:a}}const o=n(t),i=n(e);return new DOMRect(i.left-o.left,i.top-o.top,i.width,i.height)}function L(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=(s,l)=>l>0&&Math.abs(s-l)>.5?s/l:1,r=i(n.width,t.offsetWidth),c=i(n.height,t.offsetHeight);return new DOMRect((o.left-n.left)/r,(o.top-n.top)/c,o.width/r,o.height/c)}function N(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-i}}function ce(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y-i,height:n.clientHeight}}const Dt=8,Ft={spring:{stiffness:600,damping:40,doubleSpring:1.2}};function Te({direction:t}){const e=t==="forward"?Dt:-Dt;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${e}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${e*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function _e(){return{outPhysics:Ft,inPhysics:Ft,composition:{mode:"parallel",startAt:[0,0]},build:Te}}const Yt=30,ke={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},De={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function Fe({direction:t}){const e=t==="forward"?1:-1,n=-Yt*e,o=Yt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(${n*i}px, 0, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${o}px, 0, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(${o*(1-i)}px, 0, 0)`,opacity:`${i}`})}}}function Ye(){return{outPhysics:ke,inPhysics:De,composition:{mode:"sequence"},build:Fe}}const Le={snappy:_e(),fluid:Ye()},Lt=8,We={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},He={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function ze({direction:t}){const e=t==="forward"?1:-1,n=-Lt*e,o=Lt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(0, ${n*i}px, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${o}px, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(0, ${o*(1-i)}px, 0)`,opacity:`${i}`})}}}function Ne(){return{outPhysics:We,inPhysics:He,composition:{mode:"sequence"},build:ze}}const Ve=40,Xe={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},Be={spring:{stiffness:400,damping:30,doubleSpring:1.2,restDelta:.1,restSpeed:.1}};function Ue(t){const e=Ve;return{out:{willChange:"opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${e}px, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(0, ${e*(1-n)}px, 0)`,opacity:`${n}`})}}}function je(){return{outPhysics:Xe,inPhysics:Be,composition:{mode:"parallel",startAt:[0,0]},build:Ue}}const Wt=Ne(),Ze={snappy:Wt,directional:Wt,"non-directional":je()},Ht={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},lt=.1,dt=1/3,zt=t=>Math.max(0,Math.min(1,t));function Ge({direction:t}){const e=t==="forward"?1:-1,n=1-e*lt;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`scale(${1+e*o*lt})`,opacity:`${zt(1-o/dt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${n})`,opacity:"0"},animate:o=>({transform:`scale(${n+e*o*lt})`,opacity:`${zt((o-dt)/(1-dt))}`})}}}function qe(){return{outPhysics:Ht,inPhysics:Ht,composition:{mode:"parallel"},build:Ge}}const Nt={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},ut=.1,pt=1/3,Vt=t=>Math.max(0,Math.min(1,t));function Ke(){return{out:{willChange:"opacity",startStyle:{},animate:t=>({opacity:`${Vt(1-t/pt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-ut})`,opacity:"0"},animate:t=>({transform:`scale(${1-ut+t*ut})`,opacity:`${Vt((t-pt)/(1-pt))}`})}}}function Je(){return{outPhysics:Nt,inPhysics:Nt,composition:{mode:"parallel"},build:Ke}}const Xt=qe(),Qe={snappy:Xt,directional:Xt,"non-directional":Je()},tn={x:Le,y:Ze,z:Qe};function en(t,e){const n=tn[t];return n[e]??n.snappy}const nn="x",on="snappy";function Bt(t,e){t.style.willChange=e.willChange,t.style.backfaceVisibility="hidden",t.style.contain="layout paint";for(const[n,o]of Object.entries(e.startStyle))t.style[n]=o}function le(t){t.style.willChange="auto",t.style.backfaceVisibility="",t.style.contain="",t.style.transform="",t.style.opacity="",t.style.clipPath=""}function rn(t){le(t),t.style.pointerEvents=""}const sn=(t={})=>{const e=t.type??nn,n=t.feel??on,o=en(e,n),i=r=>{const c=o.build({direction:r});return{prepare:({from:s,to:l})=>(s.then(a=>{Bt(a,c.out),a.style.pointerEvents="none"}),l.then(a=>{Bt(a,c.in)}),{}),animation:({from:s,to:l,context:a})=>{if(e==="z"){const y=N(a,"from"),p=N(a,"to");s.style.clipPath=`inset(${y.top}px 0 calc(100% - ${y.top+y.height}px) 0)`,l.style.clipPath=`inset(${p.top}px 0 calc(100% - ${p.top+p.height}px) 0)`}const d=new b.WebAnimation({element:s,integrator:S.IntegratorProvider.from(o.outPhysics),style:y=>c.out.animate(y),onDispose:()=>rn(s)}),u=new b.WebAnimation({element:l,integrator:S.IntegratorProvider.from(o.inPhysics),style:y=>c.in.animate(y),onDispose:()=>le(l)});return new b.MultiAnimation({out:d,in:u},o.composition)}}};return v.defineTransition({forward:i("forward"),backward:i("backward")})};function an(t,e,n){return t==="y"?e==="non-directional"?"non-directional":"directional":t!=="x"||e==="snappy"||n==="snappy"?"snappy":"fluid"}function cn(t={},e={}){const n=t.type??"x",o=t.variant,i=t.feel,r=an(n,o,i);return v.withOverride(sn({type:n,feel:r}),e.override)}const ln={spring:{stiffness:200,damping:22}},dn=10,un="horizontal",pn="#000000";function Ut(t,e,n,o,i,r){window.getComputedStyle(t).position==="static"&&(t.style.position="relative");const s=document.createElement("div");s.style.cssText=`
1
+ "use strict";var Oe=Object.defineProperty;var Me=(t,e,n)=>e in t?Oe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var M=(t,e,n)=>Me(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const v=require("./index-CtyacfH7.cjs"),b=require("./retain-opacity-BrtENsD0.cjs"),S=require("./provider-JDtJ5Jzf.cjs"),z=require("./page-motion-Dhj3UfzO.cjs");class ae{constructor(e){M(this,"durationSec");this.durationSec=Math.max(1/60,e.durationSec)}step(e,n,o){const i=n-e.position;if(i===0)return e;const r=Math.sign(i),c=Math.abs(i)/this.durationSec,s=r*c*o,l=e.position+s;return(r>0?l>=n:l<=n)?{position:n,velocity:0}:{position:l,velocity:r*c}}isSettled(e,n){return Math.abs(e.position-n)<S.POSITION_THRESHOLD}}function Rt(t,e){function n(r){let c=0,s=0;const l=r.offsetWidth,a=r.offsetHeight;let d=r;for(;d;)c+=d.offsetTop,s+=d.offsetLeft,d=d.offsetParent;return c-=window.scrollY,s-=window.scrollX,{top:c,left:s,width:l,height:a}}const o=n(t),i=n(e);return new DOMRect(i.left-o.left,i.top-o.top,i.width,i.height)}function L(t,e){const n=t.getBoundingClientRect(),o=e.getBoundingClientRect(),i=(s,l)=>l>0&&Math.abs(s-l)>.5?s/l:1,r=i(n.width,t.offsetWidth),c=i(n.height,t.offsetHeight);return new DOMRect((o.left-n.left)/r,(o.top-n.top)/c,o.width/r,o.height/c)}function N(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y,left:0,width:n.clientWidth,height:n.clientHeight-i}}function ce(t,e){const{scrollingElement:n,positionedParent:o}=t,i=n!==o&&n.contains(o)?Rt(n,o).top:0;return{top:t[e].scroll.y-i,height:n.clientHeight}}const Dt=8,Ft={spring:{stiffness:600,damping:40,doubleSpring:1.2}};function Te({direction:t}){const e=t==="forward"?Dt:-Dt;return{out:{willChange:"transform, opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${e}px, 0, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(${e*(1-n)}px, 0, 0)`,opacity:`${n}`})}}}function _e(){return{outPhysics:Ft,inPhysics:Ft,composition:{mode:"parallel",startAt:[0,0]},build:Te}}const Yt=30,ke={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},De={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function Fe({direction:t}){const e=t==="forward"?1:-1,n=-Yt*e,o=Yt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(${n*i}px, 0, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(${o}px, 0, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(${o*(1-i)}px, 0, 0)`,opacity:`${i}`})}}}function Ye(){return{outPhysics:ke,inPhysics:De,composition:{mode:"sequence"},build:Fe}}const Le={snappy:_e(),fluid:Ye()},Lt=8,We={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},He={spring:{stiffness:180,damping:34,restDelta:.1,restSpeed:.1}};function ze({direction:t}){const e=t==="forward"?1:-1,n=-Lt*e,o=Lt*e;return{out:{willChange:"transform, opacity",startStyle:{},animate:i=>({transform:`translate3d(0, ${n*i}px, 0)`,opacity:`${1-i}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${o}px, 0)`,opacity:"0"},animate:i=>({transform:`translate3d(0, ${o*(1-i)}px, 0)`,opacity:`${i}`})}}}function Ne(){return{outPhysics:We,inPhysics:He,composition:{mode:"sequence"},build:ze}}const Ve=40,Xe={inertia:{acceleration:150,resistance:1.5,restDelta:.1}},Be={spring:{stiffness:400,damping:30,doubleSpring:1.2,restDelta:.1,restSpeed:.1}};function Ue(t){const e=Ve;return{out:{willChange:"opacity",startStyle:{},animate:n=>({opacity:`${1-n}`})},in:{willChange:"transform, opacity",startStyle:{transform:`translate3d(0, ${e}px, 0)`,opacity:"0"},animate:n=>({transform:`translate3d(0, ${e*(1-n)}px, 0)`,opacity:`${n}`})}}}function je(){return{outPhysics:Xe,inPhysics:Be,composition:{mode:"parallel",startAt:[0,0]},build:Ue}}const Wt=Ne(),Ze={snappy:Wt,directional:Wt,"non-directional":je()},Ht={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},lt=.1,dt=1/3,zt=t=>Math.max(0,Math.min(1,t));function Ge({direction:t}){const e=t==="forward"?1:-1,n=1-e*lt;return{out:{willChange:"transform, opacity",startStyle:{},animate:o=>({transform:`scale(${1+e*o*lt})`,opacity:`${zt(1-o/dt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${n})`,opacity:"0"},animate:o=>({transform:`scale(${n+e*o*lt})`,opacity:`${zt((o-dt)/(1-dt))}`})}}}function qe(){return{outPhysics:Ht,inPhysics:Ht,composition:{mode:"parallel"},build:Ge}}const Nt={spring:{stiffness:280,damping:30,restDelta:.1,restSpeed:.1}},ut=.1,pt=1/3,Vt=t=>Math.max(0,Math.min(1,t));function Ke(){return{out:{willChange:"opacity",startStyle:{},animate:t=>({opacity:`${Vt(1-t/pt)}`})},in:{willChange:"transform, opacity",startStyle:{transform:`scale(${1-ut})`,opacity:"0"},animate:t=>({transform:`scale(${1-ut+t*ut})`,opacity:`${Vt((t-pt)/(1-pt))}`})}}}function Je(){return{outPhysics:Nt,inPhysics:Nt,composition:{mode:"parallel"},build:Ke}}const Xt=qe(),Qe={snappy:Xt,directional:Xt,"non-directional":Je()},tn={x:Le,y:Ze,z:Qe};function en(t,e){const n=tn[t];return n[e]??n.snappy}const nn="x",on="snappy";function Bt(t,e){t.style.willChange=e.willChange,t.style.backfaceVisibility="hidden",t.style.contain="layout paint";for(const[n,o]of Object.entries(e.startStyle))t.style[n]=o}function le(t){t.style.willChange="auto",t.style.backfaceVisibility="",t.style.contain="",t.style.transform="",t.style.opacity="",t.style.clipPath=""}function rn(t){le(t),t.style.pointerEvents=""}const sn=(t={})=>{const e=t.type??nn,n=t.feel??on,o=en(e,n),i=r=>{const c=o.build({direction:r});return{prepare:({from:s,to:l})=>(s.then(a=>{Bt(a,c.out),a.style.pointerEvents="none"}),l.then(a=>{Bt(a,c.in)}),{}),animation:({from:s,to:l,context:a})=>{if(e==="z"){const y=N(a,"from"),p=N(a,"to");s.style.clipPath=`inset(${y.top}px 0 calc(100% - ${y.top+y.height}px) 0)`,l.style.clipPath=`inset(${p.top}px 0 calc(100% - ${p.top+p.height}px) 0)`}const d=new b.WebAnimation({element:s,integrator:S.IntegratorProvider.from(o.outPhysics),style:y=>c.out.animate(y),onDispose:()=>rn(s)}),u=new b.WebAnimation({element:l,integrator:S.IntegratorProvider.from(o.inPhysics),style:y=>c.in.animate(y),onDispose:()=>le(l)});return new b.MultiAnimation({out:d,in:u},o.composition)}}};return v.defineTransition({forward:i("forward"),backward:i("backward")})};function an(t,e,n){return t==="y"?e==="non-directional"?"non-directional":"directional":t!=="x"||e==="snappy"||n==="snappy"?"snappy":"fluid"}function cn(t={},e={}){const n=t.type??"x",o=t.variant,i=t.feel,r=an(n,o,i);return v.withOverride(sn({type:n,feel:r}),e.override)}const ln={spring:{stiffness:200,damping:22}},dn=10,un="horizontal",pn="#000000";function Ut(t,e,n,o,i,r){window.getComputedStyle(t).position==="static"&&(t.style.position="relative");const s=document.createElement("div");s.style.cssText=`
2
2
  position: absolute;
3
3
  top: 0;
4
4
  left: 0;
package/dist/index.js CHANGED
@@ -2,8 +2,8 @@ var ke = Object.defineProperty;
2
2
  var De = (t, e, n) => e in t ? ke(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
3
3
  var _ = (t, e, n) => De(t, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { d as k, w as D } from "./index-B_K3Vnj-.js";
5
- import { W as w, M as I, r as ot } from "./retain-opacity-Bp_Y__-B.js";
6
- import { A as ur } from "./retain-opacity-Bp_Y__-B.js";
5
+ import { W as w, M as I, r as ot } from "./retain-opacity-BVcRlLr1.js";
6
+ import { A as ur } from "./retain-opacity-BVcRlLr1.js";
7
7
  import { P as Fe, I as x, S as vt, b as Me, d as Pt, a as Te, D as Ye } from "./provider-BLf6XeXT.js";
8
8
  import { F as Le, a as He, p as it, S as ze } from "./page-motion-CoPTk-Gd.js";
9
9
  class Ne {
package/dist/internal.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var kt=Object.defineProperty;var Tt=(t,n,e)=>n in t?kt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var K=(t,n,e)=>Tt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("./resolve-transition-rule-BL12rDDu.cjs"),G=require("./retain-opacity-5kqI1OCo.cjs"),He=require("./provider-JDtJ5Jzf.cjs");function oe(t){return[...t.getMotionTracks()]}class dt extends G.Animation{constructor(){super(...arguments);K(this,"child",null);K(this,"run",null);K(this,"retiring",[]);K(this,"owners",new WeakMap);K(this,"epoch",0);K(this,"prepared",null);K(this,"_state","idle");K(this,"_settled",!1);K(this,"listeners",new Set);K(this,"onHandoff")}prepareHandoff(){var e;if(!this.prepared){this.prepared=this.sceneSnapshots(),(e=this.child)==null||e.pause();for(const s of this.retiring)for(const l of s.releases)l.pause()}}attach(e,s={}){var L;if(this.child===e)return;e.validate();const l=this.run,r=this.prepared??this.sceneSnapshots();this.prepared=null;const h=++this.epoch,c=oe(e),v=r.filter(u=>u.lifetime!=="temporary"&&!c.some(o=>o.element===u.target)&&(s.targets??[]).some(o=>{var a;return o===u.target||((a=o.contains)==null?void 0:a.call(o,u.target))})&&("transform"in u.channels||"opacity"in u.channels)).map(u=>{const o=u.target,a={transform:o.style.transform,opacity:o.style.opacity},w=o.style.opacity||1;return new G.WebAnimation({element:o,integrator:new He.SpringIntegrator({stiffness:200,damping:24}),style:()=>({transform:"none",opacity:w}),motion:{key:u.key,role:u.role,space:u.space},onDispose:()=>{!a.transform&&o.style.transform==="none"&&(o.style.transform=""),!a.opacity&&String(o.style.opacity)===String(w)&&(o.style.opacity="")}})});if(v.length){const u=e.onDispose;e.onDispose=void 0,e=new G.MultiAnimation({effect:e,restore:new G.MultiAnimation(v)}),e.onDispose=u}const g=oe(e),m=new Set([...s.targets??[],...g.map(u=>u.element)]);for(const u of s.targets??[])this.owners.set(u,h);for(const u of c)this.owners.set(u.element,h);this.child=e;const d={animation:e,epoch:h,targets:m,hidden:[]};this.run=d,this._settled=!1;const y=[];if(e.supportsInterruption&&(!l||l.animation.supportsInterruption)){const u=He.matchMotion(r,g.map(o=>o.motionIdentity));u.forEach((o,a)=>{y.push({kind:o.reason,target:o.next.target,key:o.next.key}),o.previous&&g[a].adopt(o.previous),g[a].handoffFallbacks.length&&y.push({kind:"fallback",target:o.next.target,channels:g[a].handoffFallbacks,fallback:g[a].handoffFallbackMode})});for(const o of u){if(!o.previous||o.previous.target===o.next.target)continue;if(o.previous.lifetime==="temporary"){o.previous.target.remove();continue}const a=G.retainOpacity(o.previous.target);a.set(0),d.hidden.push(a.restore)}for(const o of[...this.retiring]){for(const a of o.releases)(m.has(a.element)||u.some(C=>{var W;return((W=C.previous)==null?void 0:W.target)===a.element}))&&a.cancel({reason:"interrupted",owns:()=>!1});o.releases=o.releases.filter(a=>a.isAnimating||a.isPaused),o.releases.length||this.disposeRetiring(o)}l&&this.retire(l,r,new Set([...m,...u.flatMap(o=>o.previous?[o.previous.target]:[])]),y)}else if(l){y.push({kind:"fallback"});const u=[...m].map(o=>[o,o.style.cssText]);l.animation.complete();for(const[o,a]of u)o.style.cssText=a}e.playbackRate=this.playbackRate;const E=e.onDispose;e.onDispose=u=>{try{E==null||E(u)}finally{for(const o of d.hidden.splice(0))o()}};const O=e.onComplete;e.onComplete=()=>{O==null||O(),this.child===e&&(this.child=null,this.run=null,this._state="idle",this._settled=this.retiring.length===0),this.notify()};const M=e.onUpdate;e.onUpdate=u=>{var o;M==null||M(u),this.child===e&&((o=this.onUpdate)==null||o.call(this,u),this.notify())},this._state==="paused"?e.pause():(this._state="playing",e.play());for(const u of this.retiring)for(const o of u.releases)this._state!=="paused"&&o.isPaused&&o.play();(L=this.onHandoff)==null||L.call(this,y),this.notify()}sceneSnapshots(){return[...this.child?oe(this.child).map(e=>e.getMotionSnapshot()):[],...this.run?[...this.run.targets].filter(e=>!oe(this.run.animation).some(s=>s.element===e)).map(e=>({target:e,channels:G.createWebPresentationCodec(e).read({transform:typeof getComputedStyle=="function"&&getComputedStyle(e).transform||"none",opacity:typeof getComputedStyle=="function"&&getComputedStyle(e).opacity||"1"})})):[],...this.retiring.flatMap(e=>e.releases.map(s=>s.getMotionSnapshot()))]}disposal(e){return{reason:"interrupted",owns:s=>!this.owners.has(s)||this.owners.get(s)===e.epoch}}retire(e,s,l,r){var g,m,d;e.animation.stop();const h=oe(e.animation),c={...e,releases:[]},v=new Set([...e.targets,...l]);for(const y of e.targets){if(l.has(y)||[...v].some(a=>{var w;return a!==y&&((w=a.contains)==null?void 0:w.call(a,y))}))continue;const E=s.find(a=>a.target===y);if(!E||((g=h.find(a=>a.element===y))==null?void 0:g.motion.release)==="remove")continue;const O=(m=h.find(a=>a.element===y))==null?void 0:m.motion.release;if(typeof O=="function")try{const a=O(E);if(a.element!==y)throw new Error("Release must own the retiring target");a.validate();const w=a.onComplete;a.onComplete=()=>{w==null||w(),c.releases.every(C=>C.isComplete)&&this.disposeRetiring(c)},a.adopt(E),a.playbackRate=this.playbackRate,c.releases.push(a),r.push({kind:"release",target:y});continue}catch(a){console.error("[ssgoi] invalid release; using fade",a),r.push({kind:"fallback",target:y})}const L=G.createWebPresentationCodec(y).write(E.channels),u=Number(L.opacity??1),o=new G.WebAnimation({element:y,integrator:{step:(a,w,C)=>({position:Math.min(w,a.position+C/.18),velocity:a.position>=w?0:1/.18}),isSettled:(a,w)=>a.position>=w},style:(a,w)=>({...L,opacity:u*w}),motion:{...(d=h.find(a=>a.element===y))==null?void 0:d.motion,handoffDuration:180},onComplete:()=>{c.releases.every(a=>a.isComplete)&&this.disposeRetiring(c)}});o.adopt(E),o.playbackRate=this.playbackRate,c.releases.push(o),r.push({kind:"release",target:y})}if(!c.releases.length){e.animation.cancel(this.disposal(e));return}this.retiring.push(c);for(const y of c.releases)y.play(),this._state==="paused"&&y.pause();for(;this.retiring.length>8;)this.disposeRetiring(this.retiring[0])}disposeRetiring(e){if(this.retiring.includes(e)){this.retiring=this.retiring.filter(s=>s!==e);for(const s of e.releases)s.cancel({reason:"disposed",owns:()=>!1});e.animation.cancel(this.disposal(e)),!this.child&&!this.retiring.length&&(this._settled=!0),this.notify()}}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.play();for(const s of this.retiring)for(const l of s.releases)l.play();this.notify()}reverse(){var e;this._state="reversing",this._settled=!1,(e=this.child)==null||e.reverse(),this.notify()}pause(){var e;this._state="paused",(e=this.child)==null||e.pause();for(const s of this.retiring)for(const l of s.releases)l.pause();this.notify()}complete(){var e;this.prepared=null,(e=this.child)==null||e.complete();for(const s of[...this.retiring])this.disposeRetiring(s);this.notify()}cancel(e){this.prepared=null;const s=this.child;this.child=null,this.run=null,this._state="idle",s==null||s.cancel(e);for(const l of[...this.retiring])this.disposeRetiring(l);this._settled=!0,this.notify()}get isAnimating(){var e;return!!((e=this.child)!=null&&e.isAnimating)||this.retiring.some(s=>s.releases.some(l=>l.isAnimating))}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child&&!this.retiring.length}get isReversing(){var e;return((e=this.child)==null?void 0:e.isReversing)??this._state==="reversing"}get progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var s;return((s=this.child)==null?void 0:s.findTimeForProgress(e))??null}get playbackRate(){return super.playbackRate}set playbackRate(e){super.playbackRate=e,this.child&&(this.child.playbackRate=e);for(const s of this.retiring)for(const l of s.releases)l.playbackRate=e;this.notify()}getPose(){var e;return((e=this.child)==null?void 0:e.getPose())??[]}getTimeline(){var e;return((e=this.child)==null?void 0:e.getTimeline())??[]}matchInto(e){var s;(s=this.child)==null||s.matchInto(e)}get activeChild(){return this.child}get retiringCount(){return this.retiring.length}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Pt=(t,n)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=n==null?void 0:n.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},tt=new Set(["auto","scroll","overlay"]),Rt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(tt.has(e.overflowY)||tt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},Mt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return n;n=n.parentElement}return document.body};function xt(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const s={};return n.forEach((l,r)=>{s[l]=e[r]}),s})}const Oe=new WeakMap;function Ct(t){let n=Oe.get(t);if(!n){const s=t.ownerDocument,r=t===s.documentElement||t===s.scrollingElement?s:t,h=m=>{m.type==="wheel"&&m.ctrlKey||m.type==="touchmove"&&m.touches.length>1||m.cancelable&&m.preventDefault()},c={passive:!1,capture:!0};r.addEventListener("wheel",h,c),r.addEventListener("touchmove",h,c);const v=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," "]),g=m=>{var y,E;const d=m;if(!(d.defaultPrevented||d.altKey||!v.has(d.key))){for(const O of d.composedPath()){const M=O;if(M.isContentEditable||(y=M.matches)!=null&&y.call(M,"input, textarea, select, [role=slider], [role=spinbutton], [role=listbox], [role=menu], [role=tablist]")||d.key===" "&&((E=M.matches)!=null&&E.call(M,"button, [role=button]")))return}d.cancelable&&d.preventDefault()}};r.addEventListener("keydown",g,{capture:!0}),n={owners:0,restore(){r.removeEventListener("wheel",h,{capture:!0}),r.removeEventListener("touchmove",h,{capture:!0}),r.removeEventListener("keydown",g,{capture:!0})}},Oe.set(t,n)}n.owners++;let e=!1;return()=>{e||(e=!0,--n.owners===0&&(Oe.delete(t),n.restore()))}}const At=768,Ot=10,Dt=10;function Lt(t={}){const{resolvePath:n=b=>b}=t;let e=null,s=null;const l=new Set,r=b=>{const k=b&&e?Ct(e):()=>{},_=()=>{l.delete(_)&&k()};return l.add(_),_};let h=!1,c=!1;const v=()=>{const b=(e==null?void 0:e.clientWidth)??0,k=b>0?b:typeof window<"u"?window.innerWidth:0;return k>0&&k<At},g=()=>(c||(h=v(),c=!0),h),m=b=>`path:${n(b)}`;let d=null;const y=new Map;let E=null,O=!1,M=0,L=0,u=0;const o=()=>{e&&E&&!O&&!l.size&&y.set(m(E),{x:e.scrollLeft,y:e.scrollTop})},a=(b,k,_)=>{if(!e)return;const D=++L,N=m(b),A=k&&y.has(N)?y.get(N):{x:0,y:0};let H=0;const B=()=>{if(!e||_!==M||D!==L)return;k||y.set(N,A),e.scrollTo({top:A.y,left:A.x,behavior:"instant"}),!(Math.abs(e.scrollTop-A.y)<1&&Math.abs(e.scrollLeft-A.x)<1)&&H<Ot&&(H++,requestAnimationFrame(B))};requestAnimationFrame(B)};return{beginTransition:r,disconnect(){++M,++L;for(const b of l)b();e&&(e===document.documentElement?window:e).removeEventListener("scroll",o),s==null||s.disconnect(),s=null,e=null,d=null,E=null,c=!1},initializeContext:(b,k,_)=>{O=!0;const D=E===k?M:++M;d=b,e||(e=Rt(b),h=v(),c=!0,typeof ResizeObserver<"u"&&(s=new ResizeObserver(()=>{h=v()}),s.observe(e)),(e===document.documentElement?window:e).addEventListener("scroll",o,{passive:!0})),E=k;const N=m(k),A=y.get(N),H=ee=>{D===M&&(u=D,ee&&A&&y.set(N,A),a(k,ee,D))};_!==void 0?H(_):requestAnimationFrame(()=>{u!==D&&D===M&&H(!1)});let B=0;const V=()=>{D===M&&(B++,B>=Dt?O=!1:requestAnimationFrame(V))};return requestAnimationFrame(V),H},calculateScrollOffset:(b,k,_=!1)=>{const D=b?m(b):null,N=D&&y.has(D)?y.get(D):{x:0,y:0},A=k&&_?m(k):null,H=A&&y.has(A)?y.get(A):{x:0,y:0};return{x:-H.x+N.x,y:-H.y+N.y}},evictScrollPosition:b=>{y.delete(m(b))},getScrollContainer:()=>e,getPositionedParentElement:()=>d?Mt(d):document.body,getScrollPosition:(b,k=!0)=>{if(!k)return{x:0,y:0};const _=b?m(b):null;return _&&y.has(_)?y.get(_):{x:0,y:0}},getIsMobile:g}}const nt=30,st=8,ot=1.2,rt=30,_t=600;function Ht(){let t=null,n=!1,e=!1,s=null,l=null,r=!1;const h=(o,a)=>{for(let w=0;w<o.length;w++){const C=o.item(w);if(C&&C.identifier===a)return C}return null},c=()=>{s!==null&&(clearTimeout(s),s=null)},v=()=>{l!==null&&(clearTimeout(l),l=null)},g=()=>{n=!0,e=!0,c(),v(),s=setTimeout(()=>{n=!1,e=!1,s=null},_t)},m=o=>{if(o.touches.length!==1){t=null;return}const a=o.touches.item(0);if(!a){t=null;return}const w=window.innerWidth,C=a.clientX<=nt,W=a.clientX>=w-nt;if(!C&&!W){t=null;return}t={identifier:a.identifier,startX:a.clientX,startY:a.clientY,fromLeftEdge:C,moved:!1}},d=o=>{if(!t)return;if(o.touches.length!==1){t=null;return}const a=h(o.touches,t.identifier);if(!a){t=null;return}const w=a.clientX-t.startX,C=a.clientY-t.startY,W=Math.abs(w),Y=Math.abs(C);if(Y>st&&Y>W*ot){t=null;return}const ie=t.fromLeftEdge?w>0:w<0;W>st&&W>Y*ot&&ie&&(t.moved=!0)},y=o=>{if(!t)return;const a=h(o.changedTouches,t.identifier);if(!a){t=null;return}const w=a.clientX-t.startX,C=t.fromLeftEdge?w>0:w<0;if(t.moved&&C&&Math.abs(w)>=rt){g(),t=null;return}t.moved&&Math.abs(w)>=rt&&g(),t=null},E=()=>{t&&(t.moved&&g(),t=null)};return{initialize:()=>{if(typeof window>"u"||r)return;r=!0;const o={passive:!0,capture:!0};window.addEventListener("touchstart",m,o),window.addEventListener("touchmove",d,o),window.addEventListener("touchend",y,o),window.addEventListener("touchcancel",E,o)},destroy:()=>{if(typeof window>"u"||!r)return;r=!1;const o={capture:!0};window.removeEventListener("touchstart",m,o),window.removeEventListener("touchmove",d,o),window.removeEventListener("touchend",y,o),window.removeEventListener("touchcancel",E,o),c(),v(),t=null,n=!1,e=!1},isSwipeBack:()=>{const o=n||e;return o&&c(),o},onPageEnter:()=>{n=!1,c(),v(),l=setTimeout(()=>{e=!1,l=null},0)}}}const it="__ssgoi_entry_v1",De=new WeakMap,pt={read:()=>null,previous:()=>null,dispose(){}};function It(){if(typeof window>"u")return pt;const t=window.navigation,n=window;let e=De.get(n);e||(e=Nt(n,t),De.set(n,e)),e.users++;const s=e;let l=!1;return{read:s.read,previous:s.previous,dispose(){l||(l=!0,--s.users===0&&(s.dispose(),De.delete(n)))}}}function lt(t){return t&&typeof t.key=="string"&&typeof t.url=="string"&&Number.isSafeInteger(t.index)&&t.index>=0?{key:t.key,index:t.index,url:t.url}:null}function Le(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype}function Nt(t,n){var L;const e=t.history,s=e.pushState,l=e.replaceState,r=`${Date.now()}-${Math.random().toString(36).slice(2)}-`;let h=0,c=!0,v=null,g=null;const m=()=>{const u=lt(n==null?void 0:n.currentEntry);return(u==null?void 0:u.url)===t.location.href?u:null},d=()=>{const u=e.state,o=Le(u)?u[it]:null;return!Le(o)||typeof o.key!="string"||!o.key.startsWith(r)||!Number.isSafeInteger(o.index)?m():{key:o.key,index:o.index,url:t.location.href}},y=(u,o)=>u!==null&&!Le(u)?u:{...u,[it]:o},E=u=>({key:`${r}${++h}`,index:u});try{l.call(e,y(e.state,E(((L=m())==null?void 0:L.index)??0)),"")}catch{return{...pt,read:m,users:0}}const O=function(u,o,a){var W;if(!c)return s.call(this,u,o,a);const w=d(),C=E(((w==null?void 0:w.index)??0)+1);s.call(this,y(u,C),o,a),v=w,g=((W=d())==null?void 0:W.key)??null},M=function(u,o,a){if(!c)return l.call(this,u,o,a);const w=d();l.call(this,y(u,w??E(0)),o,a)};return e.pushState=O,e.replaceState=M,{users:0,read:d,previous:()=>{var o;if(((o=d())==null?void 0:o.key)===g)return v;const u=m();return u?lt(n==null?void 0:n.entries().find(a=>a.index===u.index-1)):null},dispose(){c=!1,e.pushState===O&&(e.pushState=s),e.replaceState===M&&(e.replaceState=l)}}}function Wt(){let t=null,n=null;const e=new Set,s=r=>{r&&e.add(r.key),e.size>200&&e.delete(e.values().next().value)},l=()=>{t||(t=It(),n=t.read(),s(n))};return{connect:l,resolve(r,h){l();const c=t.read();let v=n,g="unknown";if(v&&c&&(c.key===v.key||c.index===v.index?g="replace":c.index<v.index?g="back":g=e.has(c.key)?"forward":"push"),g==="push"){const m=t.previous();m&&m.index===c.index-1&&_e.normalizePath(new URL(m.url).pathname)===_e.normalizePath(r)&&(v=m)}return n=c,s(v),s(c),{kind:g,direction:g==="back"?"backward":"forward",from:v,to:c}},dispose(){t==null||t.dispose(),t=null,n=null,e.clear()}}}function Ft(){const t=Wt(),n=new Map;return{connect:t.connect,resolve(e,s,l){var g,m;const r=t.resolve(e,s),h=(g=r.from)==null?void 0:g.key,c=(m=r.to)==null?void 0:m.key;if(r.kind==="back"&&h&&c){const d=n.get(h);if((d==null?void 0:d.source)===c&&d.from===s&&d.to===e)return d.rule?{...d.rule,direction:d.rule.direction==="forward"?"backward":"forward",preserveScroll:{from:d.rule.preserveScroll.to,to:d.rule.preserveScroll.from}}:null}if(r.kind==="forward"&&h&&c){const d=n.get(c);if((d==null?void 0:d.source)===h&&d.from===e&&d.to===s)return d.rule}const v=l(r.direction);if(c&&r.kind==="replace"&&n.delete(c),c&&h&&r.kind==="push"){for(const[d,y]of n)y.index>=r.to.index&&n.delete(d);n.set(c,{source:h,index:r.to.index,from:e,to:s,rule:v?{...v,preserveScroll:{...v.preserveScroll}}:null}),n.size>100&&n.delete(n.keys().next().value)}return v},dispose(){t.dispose(),n.clear()}}}function Bt(t={}){let n=null,e=null;function s(){var r,h;n&&((r=n.out)==null||r.resolve(null),(h=n.in)==null||h.resolve(null),n=null)}function l(){if(n!=null&&n.out&&n.in){if(n.out.path===n.in.path){s();return}const r={from:n.out.path,to:n.in.path,out:n.out.payload,in:n.in.payload};e=r,n.out.resolve(r),n.in.resolve(r),n=null}}return{arrive(r,h,c){return new Promise(v=>{var y,E;const g=e===null?null:h==="out"?{path:e.from,payload:e.out}:{path:e.to,payload:e.in};if((g==null?void 0:g.path)===r){v(null);return}h==="out"&&((y=n==null?void 0:n.in)==null?void 0:y.path)===r&&!n.out&&(n.in.resolve(null),n.in=void 0);const m=n==null?void 0:n[h];m&&m.path!==r&&s(),n||(n={});const d=n[h];if(d){if(((E=t.keepCurrent)==null?void 0:E.call(t,{type:h,path:r,current:d.payload,next:c}))??!1){v(null);return}d.resolve(null)}n[h]={path:r,payload:c,resolve:v},l()})},cancel(r){(n!=null&&n.out&&r(n.out.payload)||n!=null&&n.in&&r(n.in.payload))&&s(),(e&&r(e.out)||e&&r(e.in))&&(e=null)}}}const zt={},Q=new Map;let we=null,at=!1;function ht(t,n,e){t instanceof HTMLElement&&Q.has(t)&&!t.isConnected&&e.set(t,{entry:Q.get(t),anchor:n});for(const s of Array.from(t.childNodes))ht(s,n,e)}function Gt(t){const n=new Set(Array.from(t.values(),({entry:e})=>e));for(const[e,{entry:s,anchor:l}]of t){Q.delete(e);let r=s.parent,h=!1;for(;r;){if(r.group===s.group&&n.has(r)){h=!0;break}r=r.parent}queueMicrotask(()=>s.callback(l,{emit:!h}))}}function Kt(){if(at||typeof document>"u")return;at=!0,we=new MutationObserver(n=>{const e=new Map;for(const s of n){const l={parent:s.target,nextSibling:s.nextSibling};for(const r of Array.from(s.removedNodes))ht(r,l,e)}Gt(e)});const t=()=>{we==null||we.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Ut(t,n,e=zt){Kt();let s=t.parentElement,l=null;for(;s;){const r=Q.get(s);if((r==null?void 0:r.group)===e){l=r;break}s=s.parentElement}return Q.set(t,{element:t,callback:n,group:e,parent:l}),()=>{Q.delete(t)}}const Ie=new WeakMap;let be=null;const Se="none !important";function re(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function Xt(){return be||(be=new MutationObserver(t=>{for(const n of t){const e=n.target,s=Ie.get(e);if(!s)continue;const l=re(e);l!==s.accounted&&(s.accounted=l,l===Se?(s.reactHidden=!0,s.onHide()):l!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),be)}function qt(t,n){const e=re(t),s={accounted:e,reactHidden:e===Se,onHide:n.onHide,onShow:n.onShow};return Ie.set(t,s),Xt().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return re(t)===Se},setDisplay(l,r=!1){l===null?t.style.removeProperty("display"):t.style.setProperty("display",l,r?"important":""),s.accounted=re(t)},sync(){s.accounted=re(t),s.reactHidden=s.accounted===Se},stop(){Ie.delete(t)}}}const $t=5e3;function Vt(t,n={}){const{transitions:e=[],middleware:s=(i,f)=>({from:i,to:f})}=t,l=n.host??new dt,r={},h=Bt({keepCurrent:({current:i,next:f})=>i.element.contains(f.element)}),c=Ft(),v=typeof e=="function"?e:()=>e,g=Ht();g.initialize();const m=new Map,d=i=>{let f=m.get(i);return f===void 0&&(f=s(i,i).from,m.set(i,f)),f},{initializeContext:y,beginTransition:E,disconnect:O,calculateScrollOffset:M,evictScrollPosition:L,getScrollContainer:u,getPositionedParentElement:o,getScrollPosition:a,getIsMobile:w}=Lt({resolvePath:d}),C=new Map,W=()=>{const i=w();let f=C.get(i);return f||(f=v({isMobile:i}),C.set(i,f)),f},Y=new WeakMap,ie=i=>{Y.set(i,{parent:i.parentNode,nextSibling:i.nextSibling})},le=i=>{const f=Y.get(i);return f||{parent:i.parentNode,nextSibling:i.nextSibling}},b=new WeakMap,k=new WeakMap;let _=0,D=0,N=null,A=null,H=!1;const B=new WeakMap,V=()=>{D++,N==null||N.abort(),A==null||A(),A=null},ee=i=>{const f=typeof getComputedStyle<"u"?getComputedStyle(i).display:"";return f&&f!=="none"?f:"block"},ae=(i,f)=>{f.visibleDisplay=i.style.getPropertyValue("display"),f.computedDisplay=ee(i)},ke=(i,f)=>{if(k.get(i)!==f)return;k.delete(i);const p=b.get(i);p&&(p.savedCss!==null&&(i.style.cssText=p.savedCss,p.savedCss=null),p.intent==="hidden"?p.vis.setDisplay("none",!0):p.visibleDisplay?(p.vis.setDisplay(p.visibleDisplay,!1),ae(i,p)):(p.vis.setDisplay(null),ae(i,p)))},Te=(i,f)=>{if(i.mode!=="hidden")return;const p=Array.from(new Set([i.element,f==null?void 0:f.element].filter(Boolean))),I=++_;for(const S of p)k.set(S,I);l.complete();for(const S of p)ke(S,I)};let te=0;const yt=(i,f,p,I,S,T,z)=>{var $e;const P=S.element,x=T.element,$=++_;k.set(x,$),k.set(P,$);const de=E(t.scrollLock!==!1);V();const J=D;N=new AbortController;const j=N.signal;l.prepareHandoff();for(const R of[P,x])B.has(R)||B.set(R,(($e=b.get(R))==null?void 0:$e.savedCss)??R.style.cssText);const pe=(S.mode??"unmount")==="hidden",{parent:he,nextSibling:Re}=S.parent?{parent:S.parent,nextSibling:S.nextSibling}:le(P),me=M(p,I,z.to),ye={direction:f,scrollOffset:me,from:{scroll:a(p)},to:{scroll:a(I,z.to)},get scrollingElement(){return u()||document.documentElement},get positionedParent(){return o()}};let F;if(pe){F=P,F.style.top=`${-1*((me==null?void 0:me.y)??0)}px`;const R=b.get(x);R&&R.savedCss===null&&(R.savedCss=x.style.cssText)}else F=P,Pt(F,ye);z.from||L(p);const Be=Promise.resolve(F),ze=Promise.resolve(x),Me=[],Ge=[];let xe=!1;const ge=()=>{if(!xe){xe=!0;for(const R of Ge)try{R()}catch(U){console.error("[ssgoi] prepare cleanup",U)}for(const R of Me)R.remove()}},bt={from:Be,to:ze,context:ye,createElement:((R,U="div")=>{const se=document.createElement(U);return se.setAttribute("data-ssgoi-id",R),Me.push(se),se}),signal:j,onCleanup:R=>{xe?R():Ge.push(R)}};let Ke=!1,ne=!1;const ve=()=>{ne||(ne=!0,clearTimeout(qe),ge(),de())},Ue=()=>{for(const R of[P,x]){if(k.get(R)!==$)continue;const U=B.get(R);U!==void 0&&(R.style.cssText=U),B.delete(R),ke(R,$)}};A=()=>{ge(),Ue(),ve()};const Xe=R=>{ge();const U=ne||j.aborted||H||J!==D;if(A&&J===D&&(A=null),U){ve();return}l.cancel({reason:"disposed",owns:()=>!0}),Ue(),pe||F.remove(),ve(),console.error("[SSGOI] Page transition failed",R)},qe=setTimeout(()=>{Ke||ne||Xe(new Error("Page transition preparation timed out"))},$t),St=Promise.resolve().then(()=>j.aborted?{}:i.prepare?i.prepare(bt):{});xt({from:Be,to:ze,extras:St}).then(({from:R,to:U,extras:se})=>{var je,Ze,Je,Qe;if(ne||j.aborted||H||J!==D){ge();return}Ke=!0,clearTimeout(qe),A=null,!pe&&he&&(Re&&he.contains(Re)?he.insertBefore(F,Re):he.appendChild(F));const Z=i.animation({from:R,to:U,context:ye,...se}),Et=Z.getMotionTracks();for(const X of Et)Me.includes(X.element)&&((je=X.motion).lifetime??(je.lifetime="temporary"),(Ze=X.motion).role??(Ze.role="overlay"),(Je=X.motion).key??(Je.key=X.element.getAttribute("data-ssgoi-id")??void 0),(Qe=X.motion).space??(Qe.space=ye.positionedParent));const Ce=Z.onDispose;let Ve=!1;const Ye=X=>{if(!Ve){Ve=!0;try{Ce==null||Ce(X)}catch(q){console.error("[ssgoi] effect cleanup failed",q)}try{for(const q of[P,x]){if(k.get(q)!==$||!X.owns(q))continue;const et=B.get(q);et!==void 0&&(q.style.cssText=et),B.delete(q),b.has(q)?ke(q,$):k.delete(q)}!pe&&X.owns(F)&&F.parentNode&&!k.has(F)&&F.parentNode.removeChild(F)}finally{ve()}}};Z.onDispose=Ye;const Ae=Z.onComplete;Z.onComplete=()=>{try{Ae==null||Ae()}finally{Z.supportsInterruption||Ye(G.finishedDisposal)}},l.attach(Z,{targets:[P,x]})}).catch(Xe)},ce=(i,f,p)=>{if(H)return;const I=te,S=g.isSwipeBack();h.arrive(i,f,p).then(T=>{var $,de,J,j;if(H||I!==te)return;if(f==="in"&&g.onPageEnter(),!T){f==="out"&&Te(p);return}if(f!=="in")return;const{from:z,to:P}=s(T.from,T.to),x=c.resolve(T.from,T.to,Fe=>_e.resolveTransitionRule(z,P,W(),Fe));if(!x){(de=($=T.in).applyScrollPolicy)==null||de.call($,!1),L(T.from),V(),Te(T.out,T.in),l.complete();return}if((j=(J=T.in).applyScrollPolicy)==null||j.call(J,x.preserveScroll.to),S){x.preserveScroll.from||L(T.from),V(),Te(T.out,T.in),l.complete();return}yt(x.transition,x.direction,T.from,T.to,T.out,T.in,x.preserveScroll)})},gt=(i,f)=>{const p=b.get(i);if(!p)return;const I=p.intent==="hidden";if(p.intent="hidden",p.savedCss===null&&(p.savedCss=i.style.cssText),p.vis.setDisplay(p.computedDisplay||"block",!0),i.style.position="absolute",i.style.width="100%",i.style.left="0",I)return;const S=le(i),T={element:i,parent:S.parent,nextSibling:S.nextSibling,mode:"hidden"},z=p.pendingOutPath??p.currentPath??f;p.pendingOutPath=null,ce(z,"out",T)},vt=(i,f)=>{const p=b.get(i);if(!p||p.intent==="visible")return;p.intent="visible",p.currentPath=i.getAttribute("data-ssgoi-transition")??p.currentPath??f,p.pendingOutPath=null,p.pathRevision++,ae(i,p),p.savedCss!==null&&(i.style.cssText=p.savedCss,p.visibleDisplay?p.vis.setDisplay(p.visibleDisplay,!1):p.vis.setDisplay(null));const I=p.currentPath,S=y(i,I),T={element:i,parent:i.parentElement,nextSibling:i.nextElementSibling,applyScrollPolicy:S};ce(I,"in",T)},wt=(i,f,p,I=!0)=>{const S=b.get(i);fe.delete(i);const T=(S==null?void 0:S.pendingOutPath)??(S==null?void 0:S.currentPath)??f;if(S&&(S.vis.stop(),ue.delete(S.vis),b.delete(i),k.delete(i),S.intent==="hidden")){h.cancel(x=>x.element===i);return}if(!I)return;const z=p??le(i),P={element:i,parent:z.parent,nextSibling:z.nextSibling,mode:"unmount"};ce(T,"out",P)};let Pe=new WeakSet;const ue=new Set,fe=new Map,Ne=(i,f,{enter:p=!0}={})=>{if(H=!1,c.connect(),g.initialize(),Pe.has(f)){const P=b.get(f);if(P&&P.currentPath!==i){P.intent==="visible"&&P.pendingOutPath===null&&(P.pendingOutPath=P.currentPath),P.currentPath=i;const x=++P.pathRevision;queueMicrotask(()=>{P.pathRevision===x&&(P.pendingOutPath=null)})}return}Pe.add(f);const I=te;ie(f);const S=qt(f,{onHide:()=>gt(f,i),onShow:()=>vt(f,i)});ue.add(S);const T={vis:S,savedCss:null,intent:S.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:i,pendingOutPath:null,pathRevision:0};if(b.set(f,T),!S.isHidden&&(ae(f,T),p)){const P=y(f,i),x={element:f,parent:f.parentElement,nextSibling:f.nextElementSibling,applyScrollPolicy:P};ce(i,"in",x)}const z=Ut(f,(P,x)=>{I===te&&wt(f,i,P,(x==null?void 0:x.emit)??!0)},r);fe.set(f,z)},We=new Map;return{register:Ne,refFor:i=>{let f=We.get(i);return f||(f=p=>{p&&Ne(i,p)},We.set(i,f)),f},disconnect(){H=!0,te++,h.cancel(()=>!0),V();try{l.cancel({reason:"disposed",owns:()=>!0})}finally{for(const i of ue)i.stop();ue.clear();for(const i of fe.values())i();fe.clear(),Pe=new WeakSet,O(),g.destroy(),c.dispose()}}}}const mt="data-ssgoi-root",Yt=`[${mt}]`,Ee="data-ssgoi-transition",ct=`[${Ee}]`,jt="[data-ssgoi-clone]";function Zt(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function Jt(t){return t.nodeType===Node.ELEMENT_NODE}function Qt(t){return t instanceof HTMLElement}function ut(t){let n=0,e=t.parentElement;for(;e;)n++,e=e.parentElement;return n}function ft(t,n,e=t){const s=Array.from(t).sort((l,r)=>ut(l)-ut(r));for(const l of s){const r=l.getAttribute(Ee);if(r===null)continue;let h=l.parentElement,c=!1;for(;h;){if(e.has(h)){c=!0;break}h=h.parentElement}n.register(r,l,{enter:!c})}}function en(t,n){if(!Zt())return()=>{};t.setAttribute(mt,"");const e=c=>c.closest(Yt)===t,s=c=>!Qt(c)||!e(c)||c.closest(jt)||c.getAttribute(Ee)===null?null:c,l=(c,v)=>{if(Jt(c)){if(c.matches(ct)){const g=s(c);g&&v.add(g)}for(const g of c.querySelectorAll(ct)){const m=s(g);m&&v.add(m)}}},r=new MutationObserver(c=>{const v=new Set,g=new Set;for(const m of c){if(m.type==="attributes"){const d=s(m.target);d&&v.add(d);continue}for(const d of m.addedNodes)l(d,g)}for(const m of g)v.add(m);ft(v,n,g)});r.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[Ee]});const h=new Set;return l(t,h),ft(h,n),()=>{var c;r.disconnect(),(c=n.disconnect)==null||c.call(n)}}exports.Animation=G.Animation;exports.MultiAnimation=G.MultiAnimation;exports.WebAnimation=G.WebAnimation;exports.simulate=He.simulate;exports.HostAnimation=dt;exports.createSggoiTransitionContext=Vt;exports.observeSsgoiTransitions=en;
1
+ "use strict";var Tt=Object.defineProperty;var Pt=(t,n,e)=>n in t?Tt(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e;var U=(t,n,e)=>Pt(t,typeof n!="symbol"?n+"":n,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _e=require("./resolve-transition-rule-BL12rDDu.cjs"),z=require("./retain-opacity-BrtENsD0.cjs"),He=require("./provider-JDtJ5Jzf.cjs");function ie(t){return[...t.getMotionTracks()]}class pt extends z.Animation{constructor(){super(...arguments);U(this,"child",null);U(this,"run",null);U(this,"retiring",[]);U(this,"owners",new WeakMap);U(this,"epoch",0);U(this,"prepared",null);U(this,"_state","idle");U(this,"_settled",!1);U(this,"listeners",new Set);U(this,"onHandoff")}prepareHandoff(){var e;if(!this.prepared){this.prepared=this.sceneSnapshots(),(e=this.child)==null||e.pause();for(const s of this.retiring)for(const c of s.releases)c.pause()}}attach(e,s={}){var S;if(this.child===e)return;e.validate();const c=this.run,i=this.prepared??this.sceneSnapshots();this.prepared=null;const h=++this.epoch,a=ie(e),v=i.filter(o=>o.lifetime!=="temporary"&&!a.some(r=>r.element===o.target)&&(s.targets??[]).some(r=>{var y;return r===o.target||((y=r.contains)==null?void 0:y.call(r,o.target))})&&("transform"in o.channels||"opacity"in o.channels)).map(o=>{const r=o.target,y={transform:r.style.transform,opacity:r.style.opacity},C=r.style.opacity||1;return new z.WebAnimation({element:r,integrator:new He.SpringIntegrator({stiffness:200,damping:24}),style:()=>({transform:"none",opacity:C}),motion:{key:o.key,role:o.role,space:o.space},onDispose:()=>{!y.transform&&r.style.transform==="none"&&(r.style.transform=""),!y.opacity&&String(r.style.opacity)===String(C)&&(r.style.opacity="")}})});if(v.length){const o=e.onDispose;e.onDispose=void 0,e=new z.MultiAnimation({effect:e,restore:new z.MultiAnimation(v)}),e.onDispose=o}const m=ie(e),d=new Set([...s.targets??[],...m.map(o=>o.element)]);for(const o of s.targets??[])this.owners.set(o,h);for(const o of a)this.owners.set(o.element,h);const f=new Map;if(e.supportsInterruption){for(const o of m)o.measure(s.scroll);for(const o of d)m.some(r=>r.element===o)||!o.isConnected||!(o.offsetWidth||o.offsetHeight)||f.set(o,z.createWebPresentationCodec(o,s.scroll))}this.child=e;const b={animation:e,epoch:h,targets:d,hidden:[],layouts:f,scroll:s.scroll};this.run=b,this._settled=!1;const T=[];if(e.supportsInterruption&&(!c||c.animation.supportsInterruption)){const o=He.matchMotion(i,m.map(r=>r.motionIdentity));o.forEach((r,y)=>{T.push({kind:r.reason,target:r.next.target,key:r.next.key}),r.previous&&m[y].adopt(r.previous),m[y].handoffFallbacks.length&&T.push({kind:"fallback",target:r.next.target,channels:m[y].handoffFallbacks,fallback:m[y].handoffFallbackMode})});for(const r of o){if(!r.previous||r.previous.target===r.next.target)continue;if(r.previous.lifetime==="temporary"){r.previous.target.remove();continue}const y=z.retainOpacity(r.previous.target);y.set(0),b.hidden.push(y.restore)}for(const r of[...this.retiring]){for(const y of r.releases)(d.has(y.element)||o.some(g=>{var O;return((O=g.previous)==null?void 0:O.target)===y.element}))&&y.cancel({reason:"interrupted",owns:()=>!1});r.releases=r.releases.filter(y=>y.isAnimating||y.isPaused),r.releases.length||this.disposeRetiring(r)}c&&this.retire(c,i,new Set([...d,...o.flatMap(r=>r.previous?[r.previous.target]:[])]),T)}else if(c){T.push({kind:"fallback"});const o=[...d].map(r=>[r,r.style.cssText]);c.animation.complete();for(const[r,y]of o)r.style.cssText=y}e.playbackRate=this.playbackRate;const _=e.onDispose;e.onDispose=o=>{try{_==null||_(o)}finally{for(const r of b.hidden.splice(0))r()}};const w=e.onComplete;e.onComplete=()=>{w==null||w(),this.child===e&&(this.child=null,this.run=null,this._state="idle",this._settled=this.retiring.length===0),this.notify()};const D=e.onUpdate;e.onUpdate=o=>{var r;D==null||D(o),this.child===e&&((r=this.onUpdate)==null||r.call(this,o),this.notify())},this._state==="paused"?e.pause():(this._state="playing",e.play());for(const o of this.retiring)for(const r of o.releases)this._state!=="paused"&&r.isPaused&&r.play();(S=this.onHandoff)==null||S.call(this,T),this.notify()}sceneSnapshots(){return[...this.child?ie(this.child).map(e=>e.getMotionSnapshot()):[],...this.run?[...this.run.targets].filter(e=>!ie(this.run.animation).some(s=>s.element===e)).map(e=>({target:e,channels:(this.run.layouts.get(e)??z.createWebPresentationCodec(e,this.run.scroll)).read({transform:typeof getComputedStyle=="function"&&getComputedStyle(e).transform||"none",opacity:typeof getComputedStyle=="function"&&getComputedStyle(e).opacity||"1"})})):[],...this.retiring.flatMap(e=>e.releases.map(s=>s.getMotionSnapshot()))]}disposal(e){return{reason:"interrupted",owns:s=>!this.owners.has(s)||this.owners.get(s)===e.epoch}}retire(e,s,c,i){var m,d,f,b,T,_;e.animation.stop();const h=ie(e.animation),a={...e,releases:[]},v=new Set([...e.targets,...c]);for(const w of e.targets){if(c.has(w)||[...v].some(g=>{var O;return g!==w&&((O=g.contains)==null?void 0:O.call(g,w))}))continue;const D=s.find(g=>g.target===w);if(!D||((m=h.find(g=>g.element===w))==null?void 0:m.motion.release)==="remove")continue;const S=(d=h.find(g=>g.element===w))==null?void 0:d.motion.release;if(typeof S=="function")try{const g=S(D);if(g.element!==w)throw new Error("Release must own the retiring target");g.validate(),g.measure((f=this.run)==null?void 0:f.scroll);const O=g.onComplete;g.onComplete=()=>{O==null||O(),a.releases.every(Y=>Y.isComplete)&&this.disposeRetiring(a)},g.adopt(D),g.playbackRate=this.playbackRate,a.releases.push(g),i.push({kind:"release",target:w});continue}catch(g){console.error("[ssgoi] invalid release; using fade",g),i.push({kind:"fallback",target:w})}const r=z.createWebPresentationCodec(w,(b=this.run)==null?void 0:b.scroll).write(D.channels),y=Number(r.opacity??1),C=new z.WebAnimation({element:w,integrator:{step:(g,O,Y)=>({position:Math.min(O,g.position+Y/.18),velocity:g.position>=O?0:1/.18}),isSettled:(g,O)=>g.position>=O},style:(g,O)=>({...r,opacity:y*O}),motion:{...(T=h.find(g=>g.element===w))==null?void 0:T.motion,handoffDuration:180},onComplete:()=>{a.releases.every(g=>g.isComplete)&&this.disposeRetiring(a)}});C.measure((_=this.run)==null?void 0:_.scroll),C.adopt(D),C.playbackRate=this.playbackRate,a.releases.push(C),i.push({kind:"release",target:w})}if(!a.releases.length){e.animation.cancel(this.disposal(e));return}this.retiring.push(a);for(const w of a.releases)w.play(),this._state==="paused"&&w.pause();for(;this.retiring.length>8;)this.disposeRetiring(this.retiring[0])}disposeRetiring(e){if(this.retiring.includes(e)){this.retiring=this.retiring.filter(s=>s!==e);for(const s of e.releases)s.cancel({reason:"disposed",owns:()=>!1});e.animation.cancel(this.disposal(e)),!this.child&&!this.retiring.length&&(this._settled=!0),this.notify()}}play(){var e;this._state="playing",this._settled=!1,(e=this.child)==null||e.play();for(const s of this.retiring)for(const c of s.releases)c.play();this.notify()}reverse(){var e;this._state="reversing",this._settled=!1,(e=this.child)==null||e.reverse(),this.notify()}pause(){var e;this._state="paused",(e=this.child)==null||e.pause();for(const s of this.retiring)for(const c of s.releases)c.pause();this.notify()}complete(){var e;this.prepared=null,(e=this.child)==null||e.complete();for(const s of[...this.retiring])this.disposeRetiring(s);this.notify()}cancel(e){this.prepared=null;const s=this.child;this.child=null,this.run=null,this._state="idle",s==null||s.cancel(e);for(const c of[...this.retiring])this.disposeRetiring(c);this._settled=!0,this.notify()}get isAnimating(){var e;return!!((e=this.child)!=null&&e.isAnimating)||this.retiring.some(s=>s.releases.some(c=>c.isAnimating))}get isPaused(){return this._state==="paused"}get isComplete(){return this._settled&&!this.child&&!this.retiring.length}get isReversing(){var e;return((e=this.child)==null?void 0:e.isReversing)??this._state==="reversing"}get progress(){var e;return((e=this.child)==null?void 0:e.progress)??0}findTimeForProgress(e){var s;return((s=this.child)==null?void 0:s.findTimeForProgress(e))??null}get playbackRate(){return super.playbackRate}set playbackRate(e){super.playbackRate=e,this.child&&(this.child.playbackRate=e);for(const s of this.retiring)for(const c of s.releases)c.playbackRate=e;this.notify()}getPose(){var e;return((e=this.child)==null?void 0:e.getPose())??[]}getTimeline(){var e;return((e=this.child)==null?void 0:e.getTimeline())??[]}matchInto(e){var s;(s=this.child)==null||s.matchInto(e)}get activeChild(){return this.child}get retiringCount(){return this.retiring.length}subscribe(e){return this.listeners.add(e),()=>{this.listeners.delete(e)}}notify(){for(const e of this.listeners)e()}}const Rt=(t,n)=>{var e;t.style.position="absolute",t.style.width="100%",t.style.top=`${-1*(((e=n==null?void 0:n.scrollOffset)==null?void 0:e.y)??0)}px`,t.style.left="0"},nt=new Set(["auto","scroll","overlay"]),Mt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n);if(nt.has(e.overflowY)||nt.has(e.overflowX))return n;n=n.parentElement}return document.documentElement},xt=t=>{let n=t.parentElement;for(;n&&n!==document.body;){const e=window.getComputedStyle(n).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return n;n=n.parentElement}return document.body};function Ct(t){const n=Object.keys(t);return Promise.all(n.map(e=>t[e])).then(e=>{const s={};return n.forEach((c,i)=>{s[c]=e[i]}),s})}const Oe=new WeakMap;function At(t){let n=Oe.get(t);if(!n){const s=t.ownerDocument,i=t===s.documentElement||t===s.scrollingElement?s:t,h=d=>{d.type==="wheel"&&d.ctrlKey||d.type==="touchmove"&&d.touches.length>1||d.cancelable&&d.preventDefault()},a={passive:!1,capture:!0};i.addEventListener("wheel",h,a),i.addEventListener("touchmove",h,a);const v=new Set(["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","PageUp","PageDown","Home","End"," "]),m=d=>{var b,T;const f=d;if(!(f.defaultPrevented||f.altKey||!v.has(f.key))){for(const _ of f.composedPath()){const w=_;if(w.isContentEditable||(b=w.matches)!=null&&b.call(w,"input, textarea, select, [role=slider], [role=spinbutton], [role=listbox], [role=menu], [role=tablist]")||f.key===" "&&((T=w.matches)!=null&&T.call(w,"button, [role=button]")))return}f.cancelable&&f.preventDefault()}};i.addEventListener("keydown",m,{capture:!0}),n={owners:0,restore(){i.removeEventListener("wheel",h,{capture:!0}),i.removeEventListener("touchmove",h,{capture:!0}),i.removeEventListener("keydown",m,{capture:!0})}},Oe.set(t,n)}n.owners++;let e=!1;return()=>{e||(e=!0,--n.owners===0&&(Oe.delete(t),n.restore()))}}const Ot=768,Dt=10,Lt=10;function _t(t={}){const{resolvePath:n=k=>k}=t;let e=null,s=null;const c=new Set,i=k=>{const P=k&&e?At(e):()=>{},I=()=>{c.delete(I)&&P()};return c.add(I),I};let h=!1,a=!1;const v=()=>{const k=(e==null?void 0:e.clientWidth)??0,P=k>0?k:typeof window<"u"?window.innerWidth:0;return P>0&&P<Ot},m=()=>(a||(h=v(),a=!0),h),d=k=>`path:${n(k)}`;let f=null;const b=new Map;let T=null,_=!1,w=0,D=0,S=0;const o=()=>{e&&T&&!_&&!c.size&&b.set(d(T),{x:e.scrollLeft,y:e.scrollTop})},r=(k,P,I)=>{if(!e)return;const H=++D,F=d(k),L=P&&b.has(F)?b.get(F):{x:0,y:0};let N=0;const G=()=>{if(!e||I!==w||H!==D)return;P||b.set(F,L),e.scrollTo({top:L.y,left:L.x,behavior:"instant"}),!(Math.abs(e.scrollTop-L.y)<1&&Math.abs(e.scrollLeft-L.x)<1)&&N<Dt&&(N++,requestAnimationFrame(G))};requestAnimationFrame(G)};return{beginTransition:i,disconnect(){++w,++D;for(const k of c)k();e&&(e===document.documentElement?window:e).removeEventListener("scroll",o),s==null||s.disconnect(),s=null,e=null,f=null,T=null,a=!1},initializeContext:(k,P,I)=>{_=!0;const H=T===P?w:++w;f=k,e||(e=Mt(k),h=v(),a=!0,typeof ResizeObserver<"u"&&(s=new ResizeObserver(()=>{h=v()}),s.observe(e)),(e===document.documentElement?window:e).addEventListener("scroll",o,{passive:!0})),T=P;const F=d(P),L=b.get(F),N=te=>{H===w&&(S=H,te&&L&&b.set(F,L),r(P,te,H))};I!==void 0?N(I):requestAnimationFrame(()=>{S!==H&&H===w&&N(!1)});let G=0;const j=()=>{H===w&&(G++,G>=Lt?_=!1:requestAnimationFrame(j))};return requestAnimationFrame(j),N},calculateScrollOffset:(k,P,I=!1)=>{const H=k?d(k):null,F=H&&b.has(H)?b.get(H):{x:0,y:0},L=P&&I?d(P):null,N=L&&b.has(L)?b.get(L):{x:0,y:0};return{x:-N.x+F.x,y:-N.y+F.y}},evictScrollPosition:k=>{b.delete(d(k))},getScrollContainer:()=>e,getPositionedParentElement:()=>f?xt(f):document.body,getScrollPosition:(k,P=!0)=>{if(!P)return{x:0,y:0};const I=k?d(k):null;return I&&b.has(I)?b.get(I):{x:0,y:0}},getIsMobile:m}}const st=30,ot=8,rt=1.2,it=30,Ht=600;function It(){let t=null,n=!1,e=!1,s=null,c=null,i=!1;const h=(o,r)=>{for(let y=0;y<o.length;y++){const C=o.item(y);if(C&&C.identifier===r)return C}return null},a=()=>{s!==null&&(clearTimeout(s),s=null)},v=()=>{c!==null&&(clearTimeout(c),c=null)},m=()=>{n=!0,e=!0,a(),v(),s=setTimeout(()=>{n=!1,e=!1,s=null},Ht)},d=o=>{if(o.touches.length!==1){t=null;return}const r=o.touches.item(0);if(!r){t=null;return}const y=window.innerWidth,C=r.clientX<=st,g=r.clientX>=y-st;if(!C&&!g){t=null;return}t={identifier:r.identifier,startX:r.clientX,startY:r.clientY,fromLeftEdge:C,moved:!1}},f=o=>{if(!t)return;if(o.touches.length!==1){t=null;return}const r=h(o.touches,t.identifier);if(!r){t=null;return}const y=r.clientX-t.startX,C=r.clientY-t.startY,g=Math.abs(y),O=Math.abs(C);if(O>ot&&O>g*rt){t=null;return}const Y=t.fromLeftEdge?y>0:y<0;g>ot&&g>O*rt&&Y&&(t.moved=!0)},b=o=>{if(!t)return;const r=h(o.changedTouches,t.identifier);if(!r){t=null;return}const y=r.clientX-t.startX,C=t.fromLeftEdge?y>0:y<0;if(t.moved&&C&&Math.abs(y)>=it){m(),t=null;return}t.moved&&Math.abs(y)>=it&&m(),t=null},T=()=>{t&&(t.moved&&m(),t=null)};return{initialize:()=>{if(typeof window>"u"||i)return;i=!0;const o={passive:!0,capture:!0};window.addEventListener("touchstart",d,o),window.addEventListener("touchmove",f,o),window.addEventListener("touchend",b,o),window.addEventListener("touchcancel",T,o)},destroy:()=>{if(typeof window>"u"||!i)return;i=!1;const o={capture:!0};window.removeEventListener("touchstart",d,o),window.removeEventListener("touchmove",f,o),window.removeEventListener("touchend",b,o),window.removeEventListener("touchcancel",T,o),a(),v(),t=null,n=!1,e=!1},isSwipeBack:()=>{const o=n||e;return o&&a(),o},onPageEnter:()=>{n=!1,a(),v(),c=setTimeout(()=>{e=!1,c=null},0)}}}const lt="__ssgoi_entry_v1",De=new WeakMap,ht={read:()=>null,previous:()=>null,dispose(){}};function Nt(){if(typeof window>"u")return ht;const t=window.navigation,n=window;let e=De.get(n);e||(e=Wt(n,t),De.set(n,e)),e.users++;const s=e;let c=!1;return{read:s.read,previous:s.previous,dispose(){c||(c=!0,--s.users===0&&(s.dispose(),De.delete(n)))}}}function ct(t){return t&&typeof t.key=="string"&&typeof t.url=="string"&&Number.isSafeInteger(t.index)&&t.index>=0?{key:t.key,index:t.index,url:t.url}:null}function Le(t){return t!==null&&typeof t=="object"&&Object.getPrototypeOf(t)===Object.prototype}function Wt(t,n){var D;const e=t.history,s=e.pushState,c=e.replaceState,i=`${Date.now()}-${Math.random().toString(36).slice(2)}-`;let h=0,a=!0,v=null,m=null;const d=()=>{const S=ct(n==null?void 0:n.currentEntry);return(S==null?void 0:S.url)===t.location.href?S:null},f=()=>{const S=e.state,o=Le(S)?S[lt]:null;return!Le(o)||typeof o.key!="string"||!o.key.startsWith(i)||!Number.isSafeInteger(o.index)?d():{key:o.key,index:o.index,url:t.location.href}},b=(S,o)=>S!==null&&!Le(S)?S:{...S,[lt]:o},T=S=>({key:`${i}${++h}`,index:S});try{c.call(e,b(e.state,T(((D=d())==null?void 0:D.index)??0)),"")}catch{return{...ht,read:d,users:0}}const _=function(S,o,r){var g;if(!a)return s.call(this,S,o,r);const y=f(),C=T(((y==null?void 0:y.index)??0)+1);s.call(this,b(S,C),o,r),v=y,m=((g=f())==null?void 0:g.key)??null},w=function(S,o,r){if(!a)return c.call(this,S,o,r);const y=f();c.call(this,b(S,y??T(0)),o,r)};return e.pushState=_,e.replaceState=w,{users:0,read:f,previous:()=>{var o;if(((o=f())==null?void 0:o.key)===m)return v;const S=d();return S?ct(n==null?void 0:n.entries().find(r=>r.index===S.index-1)):null},dispose(){a=!1,e.pushState===_&&(e.pushState=s),e.replaceState===w&&(e.replaceState=c)}}}function Ft(){let t=null,n=null;const e=new Set,s=i=>{i&&e.add(i.key),e.size>200&&e.delete(e.values().next().value)},c=()=>{t||(t=Nt(),n=t.read(),s(n))};return{connect:c,resolve(i,h){c();const a=t.read();let v=n,m="unknown";if(v&&a&&(a.key===v.key||a.index===v.index?m="replace":a.index<v.index?m="back":m=e.has(a.key)?"forward":"push"),m==="push"){const d=t.previous();d&&d.index===a.index-1&&_e.normalizePath(new URL(d.url).pathname)===_e.normalizePath(i)&&(v=d)}return n=a,s(v),s(a),{kind:m,direction:m==="back"?"backward":"forward",from:v,to:a}},dispose(){t==null||t.dispose(),t=null,n=null,e.clear()}}}function Bt(){const t=Ft(),n=new Map;return{connect:t.connect,resolve(e,s,c){var m,d;const i=t.resolve(e,s),h=(m=i.from)==null?void 0:m.key,a=(d=i.to)==null?void 0:d.key;if(i.kind==="back"&&h&&a){const f=n.get(h);if((f==null?void 0:f.source)===a&&f.from===s&&f.to===e)return f.rule?{...f.rule,direction:f.rule.direction==="forward"?"backward":"forward",preserveScroll:{from:f.rule.preserveScroll.to,to:f.rule.preserveScroll.from}}:null}if(i.kind==="forward"&&h&&a){const f=n.get(a);if((f==null?void 0:f.source)===h&&f.from===e&&f.to===s)return f.rule}const v=c(i.direction);if(a&&i.kind==="replace"&&n.delete(a),a&&h&&i.kind==="push"){for(const[f,b]of n)b.index>=i.to.index&&n.delete(f);n.set(a,{source:h,index:i.to.index,from:e,to:s,rule:v?{...v,preserveScroll:{...v.preserveScroll}}:null}),n.size>100&&n.delete(n.keys().next().value)}return v},dispose(){t.dispose(),n.clear()}}}function zt(t={}){let n=null,e=null;function s(){var i,h;n&&((i=n.out)==null||i.resolve(null),(h=n.in)==null||h.resolve(null),n=null)}function c(){if(n!=null&&n.out&&n.in){if(n.out.path===n.in.path){s();return}const i={from:n.out.path,to:n.in.path,out:n.out.payload,in:n.in.payload};e=i,n.out.resolve(i),n.in.resolve(i),n=null}}return{arrive(i,h,a){return new Promise(v=>{var b,T;const m=e===null?null:h==="out"?{path:e.from,payload:e.out}:{path:e.to,payload:e.in};if((m==null?void 0:m.path)===i){v(null);return}h==="out"&&((b=n==null?void 0:n.in)==null?void 0:b.path)===i&&!n.out&&(n.in.resolve(null),n.in=void 0);const d=n==null?void 0:n[h];d&&d.path!==i&&s(),n||(n={});const f=n[h];if(f){if(((T=t.keepCurrent)==null?void 0:T.call(t,{type:h,path:i,current:f.payload,next:a}))??!1){v(null);return}f.resolve(null)}n[h]={path:i,payload:a,resolve:v},c()})},cancel(i){(n!=null&&n.out&&i(n.out.payload)||n!=null&&n.in&&i(n.in.payload))&&s(),(e&&i(e.out)||e&&i(e.in))&&(e=null)}}}const Gt={},ee=new Map;let we=null,at=!1;function mt(t,n,e){t instanceof HTMLElement&&ee.has(t)&&!t.isConnected&&e.set(t,{entry:ee.get(t),anchor:n});for(const s of Array.from(t.childNodes))mt(s,n,e)}function Kt(t){const n=new Set(Array.from(t.values(),({entry:e})=>e));for(const[e,{entry:s,anchor:c}]of t){ee.delete(e);let i=s.parent,h=!1;for(;i;){if(i.group===s.group&&n.has(i)){h=!0;break}i=i.parent}queueMicrotask(()=>s.callback(c,{emit:!h}))}}function Ut(){if(at||typeof document>"u")return;at=!0,we=new MutationObserver(n=>{const e=new Map;for(const s of n){const c={parent:s.target,nextSibling:s.nextSibling};for(const i of Array.from(s.removedNodes))mt(i,c,e)}Kt(e)});const t=()=>{we==null||we.observe(document.body,{childList:!0,subtree:!0})};document.body?t():document.addEventListener("DOMContentLoaded",t,{once:!0})}function Xt(t,n,e=Gt){Ut();let s=t.parentElement,c=null;for(;s;){const i=ee.get(s);if((i==null?void 0:i.group)===e){c=i;break}s=s.parentElement}return ee.set(t,{element:t,callback:n,group:e,parent:c}),()=>{ee.delete(t)}}const Ie=new WeakMap;let be=null;const Se="none !important";function le(t){const n=t.style.getPropertyValue("display");return t.style.getPropertyPriority("display")?`${n} !important`:n}function qt(){return be||(be=new MutationObserver(t=>{for(const n of t){const e=n.target,s=Ie.get(e);if(!s)continue;const c=le(e);c!==s.accounted&&(s.accounted=c,c===Se?(s.reactHidden=!0,s.onHide()):c!=="none"&&s.reactHidden&&(s.reactHidden=!1,s.onShow()))}}),be)}function $t(t,n){const e=le(t),s={accounted:e,reactHidden:e===Se,onHide:n.onHide,onShow:n.onShow};return Ie.set(t,s),qt().observe(t,{attributes:!0,attributeFilter:["style"]}),{get isHidden(){return le(t)===Se},setDisplay(c,i=!1){c===null?t.style.removeProperty("display"):t.style.setProperty("display",c,i?"important":""),s.accounted=le(t)},sync(){s.accounted=le(t),s.reactHidden=s.accounted===Se},stop(){Ie.delete(t)}}}const Vt=5e3;function Yt(t,n={}){const{transitions:e=[],middleware:s=(l,u)=>({from:l,to:u})}=t,c=n.host??new pt,i={},h=zt({keepCurrent:({current:l,next:u})=>l.element.contains(u.element)}),a=Bt(),v=typeof e=="function"?e:()=>e,m=It();m.initialize();const d=new Map,f=l=>{let u=d.get(l);return u===void 0&&(u=s(l,l).from,d.set(l,u)),u},{initializeContext:b,beginTransition:T,disconnect:_,calculateScrollOffset:w,evictScrollPosition:D,getScrollContainer:S,getPositionedParentElement:o,getScrollPosition:r,getIsMobile:y}=_t({resolvePath:f}),C=new Map,g=()=>{const l=y();let u=C.get(l);return u||(u=v({isMobile:l}),C.set(l,u)),u},O=new WeakMap,Y=l=>{O.set(l,{parent:l.parentNode,nextSibling:l.nextSibling})},ce=l=>{const u=O.get(l);return u||{parent:l.parentNode,nextSibling:l.nextSibling}},k=new WeakMap,P=new WeakMap;let I=0,H=0,F=null,L=null,N=!1;const G=new WeakMap,j=()=>{H++,F==null||F.abort(),L==null||L(),L=null},te=l=>{const u=typeof getComputedStyle<"u"?getComputedStyle(l).display:"";return u&&u!=="none"?u:"block"},ae=(l,u)=>{u.visibleDisplay=l.style.getPropertyValue("display"),u.computedDisplay=te(l)},Ee=(l,u)=>{if(P.get(l)!==u)return;P.delete(l);const p=k.get(l);p&&(p.savedCss!==null&&(l.style.cssText=p.savedCss,p.savedCss=null),p.intent==="hidden"?p.vis.setDisplay("none",!0):p.visibleDisplay?(p.vis.setDisplay(p.visibleDisplay,!1),ae(l,p)):(p.vis.setDisplay(null),ae(l,p)))},Te=(l,u)=>{if(l.mode!=="hidden")return;const p=Array.from(new Set([l.element,u==null?void 0:u.element].filter(Boolean))),W=++I;for(const E of p)P.set(E,W);c.complete();for(const E of p)Ee(E,W)};let ne=0;const gt=(l,u,p,W,E,R,K)=>{var $e;const M=E.element,A=R.element,V=++I;P.set(A,V),P.set(M,V);const pe=T(t.scrollLock!==!1);j();const Q=H;F=new AbortController;const Z=F.signal;c.prepareHandoff();for(const x of[M,A])G.has(x)||G.set(x,(($e=k.get(x))==null?void 0:$e.savedCss)??x.style.cssText);const he=(E.mode??"unmount")==="hidden",{parent:me,nextSibling:Re}=E.parent?{parent:E.parent,nextSibling:E.nextSibling}:ce(M),ye=w(p,W,K.to),se={direction:u,scrollOffset:ye,from:{scroll:r(p)},to:{scroll:r(W,K.to)},get scrollingElement(){return S()||document.documentElement},get positionedParent(){return o()}};let B;if(he){B=M,B.style.top=`${-1*((ye==null?void 0:ye.y)??0)}px`;const x=k.get(A);x&&x.savedCss===null&&(x.savedCss=A.style.cssText)}else B=M,Rt(B,se);K.from||D(p);const Be=Promise.resolve(B),ze=Promise.resolve(A),Me=[],Ge=[];let xe=!1;const ge=()=>{if(!xe){xe=!0;for(const x of Ge)try{x()}catch(X){console.error("[ssgoi] prepare cleanup",X)}for(const x of Me)x.remove()}},St={from:Be,to:ze,context:se,createElement:((x,X="div")=>{const re=document.createElement(X);return re.setAttribute("data-ssgoi-id",x),Me.push(re),re}),signal:Z,onCleanup:x=>{xe?x():Ge.push(x)}};let Ke=!1,oe=!1;const ve=()=>{oe||(oe=!0,clearTimeout(qe),ge(),pe())},Ue=()=>{for(const x of[M,A]){if(P.get(x)!==V)continue;const X=G.get(x);X!==void 0&&(x.style.cssText=X),G.delete(x),Ee(x,V)}};L=()=>{ge(),Ue(),ve()};const Xe=x=>{ge();const X=oe||Z.aborted||N||Q!==H;if(L&&Q===H&&(L=null),X){ve();return}c.cancel({reason:"disposed",owns:()=>!0}),Ue(),he||B.remove(),ve(),console.error("[SSGOI] Page transition failed",x)},qe=setTimeout(()=>{Ke||oe||Xe(new Error("Page transition preparation timed out"))},Vt),kt=Promise.resolve().then(()=>Z.aborted?{}:l.prepare?l.prepare(St):{});Ct({from:Be,to:ze,extras:kt}).then(({from:x,to:X,extras:re})=>{var Ze,Je,Qe,et;if(oe||Z.aborted||N||Q!==H){ge();return}Ke=!0,clearTimeout(qe),L=null,!he&&me&&(Re&&me.contains(Re)?me.insertBefore(B,Re):me.appendChild(B));const J=l.animation({from:x,to:X,context:se,...re}),Et=J.getMotionTracks();for(const q of Et)Me.includes(q.element)&&((Ze=q.motion).lifetime??(Ze.lifetime="temporary"),(Je=q.motion).role??(Je.role="overlay"),(Qe=q.motion).key??(Qe.key=q.element.getAttribute("data-ssgoi-id")??void 0),(et=q.motion).space??(et.space=se.positionedParent));const Ce=J.onDispose;let Ve=!1;const Ye=q=>{if(!Ve){Ve=!0;try{Ce==null||Ce(q)}catch($){console.error("[ssgoi] effect cleanup failed",$)}try{for(const $ of[M,A]){if(P.get($)!==V||!q.owns($))continue;const tt=G.get($);tt!==void 0&&($.style.cssText=tt),G.delete($),k.has($)?Ee($,V):P.delete($)}!he&&q.owns(B)&&B.parentNode&&!P.has(B)&&B.parentNode.removeChild(B)}finally{ve()}}};J.onDispose=Ye;const Ae=J.onComplete;J.onComplete=()=>{try{Ae==null||Ae()}finally{J.supportsInterruption||Ye(z.finishedDisposal)}};const je=S();c.attach(J,{targets:[M,A],scroll:je?{container:je,...se.to.scroll}:void 0})}).catch(Xe)},ue=(l,u,p)=>{if(N)return;const W=ne,E=m.isSwipeBack();h.arrive(l,u,p).then(R=>{var V,pe,Q,Z;if(N||W!==ne)return;if(u==="in"&&m.onPageEnter(),!R){u==="out"&&Te(p);return}if(u!=="in")return;const{from:K,to:M}=s(R.from,R.to),A=a.resolve(R.from,R.to,Fe=>_e.resolveTransitionRule(K,M,g(),Fe));if(!A){(pe=(V=R.in).applyScrollPolicy)==null||pe.call(V,!1),D(R.from),j(),Te(R.out,R.in),c.complete();return}if((Z=(Q=R.in).applyScrollPolicy)==null||Z.call(Q,A.preserveScroll.to),E){A.preserveScroll.from||D(R.from),j(),Te(R.out,R.in),c.complete();return}gt(A.transition,A.direction,R.from,R.to,R.out,R.in,A.preserveScroll)})},vt=(l,u)=>{const p=k.get(l);if(!p)return;const W=p.intent==="hidden";if(p.intent="hidden",p.savedCss===null&&(p.savedCss=l.style.cssText),p.vis.setDisplay(p.computedDisplay||"block",!0),l.style.position="absolute",l.style.width="100%",l.style.left="0",W)return;const E=ce(l),R={element:l,parent:E.parent,nextSibling:E.nextSibling,mode:"hidden"},K=p.pendingOutPath??p.currentPath??u;p.pendingOutPath=null,ue(K,"out",R)},wt=(l,u)=>{const p=k.get(l);if(!p||p.intent==="visible")return;p.intent="visible",p.currentPath=l.getAttribute("data-ssgoi-transition")??p.currentPath??u,p.pendingOutPath=null,p.pathRevision++,ae(l,p),p.savedCss!==null&&(l.style.cssText=p.savedCss,p.visibleDisplay?p.vis.setDisplay(p.visibleDisplay,!1):p.vis.setDisplay(null));const W=p.currentPath,E=b(l,W),R={element:l,parent:l.parentElement,nextSibling:l.nextElementSibling,applyScrollPolicy:E};ue(W,"in",R)},bt=(l,u,p,W=!0)=>{const E=k.get(l);de.delete(l);const R=(E==null?void 0:E.pendingOutPath)??(E==null?void 0:E.currentPath)??u;if(E&&(E.vis.stop(),fe.delete(E.vis),k.delete(l),P.delete(l),E.intent==="hidden")){h.cancel(A=>A.element===l);return}if(!W)return;const K=p??ce(l),M={element:l,parent:K.parent,nextSibling:K.nextSibling,mode:"unmount"};ue(R,"out",M)};let Pe=new WeakSet;const fe=new Set,de=new Map,Ne=(l,u,{enter:p=!0}={})=>{if(N=!1,a.connect(),m.initialize(),Pe.has(u)){const M=k.get(u);if(M&&M.currentPath!==l){M.intent==="visible"&&M.pendingOutPath===null&&(M.pendingOutPath=M.currentPath),M.currentPath=l;const A=++M.pathRevision;queueMicrotask(()=>{M.pathRevision===A&&(M.pendingOutPath=null)})}return}Pe.add(u);const W=ne;Y(u);const E=$t(u,{onHide:()=>vt(u,l),onShow:()=>wt(u,l)});fe.add(E);const R={vis:E,savedCss:null,intent:E.isHidden?"hidden":"visible",visibleDisplay:"",computedDisplay:"block",currentPath:l,pendingOutPath:null,pathRevision:0};if(k.set(u,R),!E.isHidden&&(ae(u,R),p)){const M=b(u,l),A={element:u,parent:u.parentElement,nextSibling:u.nextElementSibling,applyScrollPolicy:M};ue(l,"in",A)}const K=Xt(u,(M,A)=>{W===ne&&bt(u,l,M,(A==null?void 0:A.emit)??!0)},i);de.set(u,K)},We=new Map;return{register:Ne,refFor:l=>{let u=We.get(l);return u||(u=p=>{p&&Ne(l,p)},We.set(l,u)),u},disconnect(){N=!0,ne++,h.cancel(()=>!0),j();try{c.cancel({reason:"disposed",owns:()=>!0})}finally{for(const l of fe)l.stop();fe.clear();for(const l of de.values())l();de.clear(),Pe=new WeakSet,_(),m.destroy(),a.dispose()}}}}const yt="data-ssgoi-root",jt=`[${yt}]`,ke="data-ssgoi-transition",ut=`[${ke}]`,Zt="[data-ssgoi-clone]";function Jt(){return typeof MutationObserver<"u"&&typeof HTMLElement<"u"&&typeof Node<"u"}function Qt(t){return t.nodeType===Node.ELEMENT_NODE}function en(t){return t instanceof HTMLElement}function ft(t){let n=0,e=t.parentElement;for(;e;)n++,e=e.parentElement;return n}function dt(t,n,e=t){const s=Array.from(t).sort((c,i)=>ft(c)-ft(i));for(const c of s){const i=c.getAttribute(ke);if(i===null)continue;let h=c.parentElement,a=!1;for(;h;){if(e.has(h)){a=!0;break}h=h.parentElement}n.register(i,c,{enter:!a})}}function tn(t,n){if(!Jt())return()=>{};t.setAttribute(yt,"");const e=a=>a.closest(jt)===t,s=a=>!en(a)||!e(a)||a.closest(Zt)||a.getAttribute(ke)===null?null:a,c=(a,v)=>{if(Qt(a)){if(a.matches(ut)){const m=s(a);m&&v.add(m)}for(const m of a.querySelectorAll(ut)){const d=s(m);d&&v.add(d)}}},i=new MutationObserver(a=>{const v=new Set,m=new Set;for(const d of a){if(d.type==="attributes"){const f=s(d.target);f&&v.add(f);continue}for(const f of d.addedNodes)c(f,m)}for(const d of m)v.add(d);dt(v,n,m)});i.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[ke]});const h=new Set;return c(t,h),dt(h,n),()=>{var a;i.disconnect(),(a=n.disconnect)==null||a.call(n)}}exports.Animation=z.Animation;exports.MultiAnimation=z.MultiAnimation;exports.WebAnimation=z.WebAnimation;exports.simulate=He.simulate;exports.HostAnimation=pt;exports.createSggoiTransitionContext=Yt;exports.observeSsgoiTransitions=tn;