@ssgoi/core 7.3.0-beta.1 → 7.3.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -166,8 +166,14 @@ export declare class WebAnimation extends Animation {
166
166
  private bridgeKeyframes;
167
167
  private clearWaapi;
168
168
  private captureLiveState;
169
- private startWhenReady;
170
169
  private startFramePacedPlayback;
170
+ /**
171
+ * Inline start styles are cleared in the same rendering update as the first
172
+ * seek, after the paused 0 ms WAAPI frame has had its own frame. Clearing
173
+ * earlier can expose the underlying, unanimated style while the animation is
174
+ * still pending.
175
+ */
176
+ private clearStartStyles;
171
177
  private advanceFramePacedStartup;
172
178
  private handOffToWaapi;
173
179
  private finishFramePacedRun;
@@ -1 +1 @@
1
- {"version":3,"file":"web-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-animation.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"web-animation.d.ts","sourceRoot":"","sources":["../../src/lib/animation/web-animation.ts"],"names":[],"mappings":"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"}
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-BFlsDhI7.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-C5ajTKSI.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-Dvv9gi8-.js";
6
- import { A as ur } from "./retain-opacity-Dvv9gi8-.js";
5
+ import { W as w, M as I, r as ot } from "./retain-opacity-ChyA_fg_.js";
6
+ import { A as ur } from "./retain-opacity-ChyA_fg_.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-BFlsDhI7.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 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-C5ajTKSI.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;
package/dist/internal.js CHANGED
@@ -2,7 +2,7 @@ var kt = Object.defineProperty;
2
2
  var Tt = (t, n, e) => n in t ? kt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
3
  var G = (t, n, e) => Tt(t, typeof n != "symbol" ? n + "" : n, e);
4
4
  import { n as Je, r as Pt } from "./resolve-transition-rule-DbkMu0rm.js";
5
- import { A as Rt, W as Qe, M as et, r as xt, c as tt, f as Mt } from "./retain-opacity-Dvv9gi8-.js";
5
+ import { A as Rt, W as Qe, M as et, r as xt, c as tt, f as Mt } from "./retain-opacity-ChyA_fg_.js";
6
6
  import { S as Ct, m as At } from "./provider-BLf6XeXT.js";
7
7
  import { a as gn } from "./provider-BLf6XeXT.js";
8
8
  function se(t) {
@@ -0,0 +1 @@
1
+ "use strict";var ht=Object.defineProperty;var ct=(s,r,t)=>r in s?ht(s,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[r]=t;var h=(s,r,t)=>ct(s,typeof r!="symbol"?r+"":r,t);const A=require("./provider-JDtJ5Jzf.cjs"),x={reason:"finished",owns:()=>!0};class Z extends A.Animation{constructor(){super(...arguments);h(this,"_startCondition");h(this,"onDispose");h(this,"deferDisposal",!1)}getMotionTracks(){return[]}validate(){}get supportsInterruption(){return!1}stop(){this.pause()}cancel(t){var e;this.isComplete||this.complete(),(e=this.onDispose)==null||e.call(this,t)}get startCondition(){return this._startCondition}set(t){if(t.startAt){const{after:e,at:i}=t.startAt;if(e===this)throw new Error("An animation cannot start after itself");if(i!=="settled"&&(!Number.isFinite(i)||i<0||i>1))throw new Error("startAt.at must be a progress from 0 to 1 or settled")}if(t.integrator!==void 0){if(typeof t.integrator.step!="function"||typeof t.integrator.isSettled!="function")throw new Error("An integrator must implement step and isSettled");this.setIntegrator(t.integrator)}return t.startAt!==void 0&&(this._startCondition=t.startAt?{...t.startAt}:void 0),this}setIntegrator(t){throw new Error("This animation does not support replacing its integrator")}}const U=[1,0,0,1,0,0],nt=(s,r)=>[s[0]*r[0]+s[2]*r[1],s[1]*r[0]+s[3]*r[1],s[0]*r[2]+s[2]*r[3],s[1]*r[2]+s[3]*r[3],s[0]*r[4]+s[2]*r[5]+s[4],s[1]*r[4]+s[3]*r[5]+s[5]];function tt(s){const r=s[0]*s[3]-s[1]*s[2];return Math.abs(r)<1e-10?null:[s[3]/r,-s[1]/r,-s[2]/r,s[0]/r,(s[2]*s[5]-s[3]*s[4])/r,(s[1]*s[4]-s[0]*s[5])/r]}const B=(s,r)=>[1,0,0,1,s,r],K=(s,r)=>[s,0,0,r,0,0];function ut(s,r,t){if(!s||s==="none")return[...U];let e=[...U];const i=/([a-zA-Z][a-zA-Z0-9]*)\(([^()]*)\)/g;let a="";for(const c of s.matchAll(i)){a+=c[0];const d=c[1].toLowerCase(),u=c[2].trim().split(/\s*,\s*|\s+/);if(u.some(n=>!/^[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?(?:px|%|deg|rad|turn)?$/i.test(n)))return null;const m=u.map(Number.parseFloat);if(m.some(n=>!Number.isFinite(n)))return null;const g=(n,y)=>{var o;return m[n]*((o=u[n])!=null&&o.endsWith("%")?y/100:1)},p=n=>{var y,o;return m[n]*((y=u[n])!=null&&y.endsWith("rad")?1:(o=u[n])!=null&&o.endsWith("turn")?2*Math.PI:Math.PI/180)};let l;if(d==="matrix"&&m.length===6)l=m;else if(d==="translate"||d==="translate3d"){if(d==="translate3d"&&m[2]!==0)return null;l=B(g(0,r),u[1]?g(1,t):0)}else if(d==="translatex")l=B(g(0,r),0);else if(d==="translatey")l=B(0,g(0,t));else if(d==="translatez"&&m[0]===0)l=[...U];else if(d==="scale")l=K(m[0],m[1]??m[0]);else if(d==="scalex")l=K(m[0],1);else if(d==="scaley")l=K(1,m[0]);else if(d==="rotate"||d==="rotatez"){const n=p(0);l=[Math.cos(n),Math.sin(n),-Math.sin(n),Math.cos(n),0,0]}else return null;e=nt(e,l)}return a.replace(/\s/g,"")===s.replace(/\s/g,"")?e:null}function et(s,r){return{schema:s,value:r,velocity:r.map(()=>0)}}const st=/[-+]?(?:\d*\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/gi,M=s=>[s[0],s[2],s[4],s[1],s[3],s[5],0,0,1];function O(s,r){return Array.from({length:9},(t,e)=>{const i=Math.floor(e/3),a=e%3;return s[i*3]*r[a]+s[i*3+1]*r[a+3]+s[i*3+2]*r[a+6]})}function at(s){return Math.abs(s[8])<1e-8||!s.every(Number.isFinite)?null:s.map(r=>r/s[8])}function it(s,r,t){const e=ut(s,r,t);if(e)return M(e);if(typeof DOMMatrix>"u")return null;const i=s.replace(/(translate(?:3d|X|Y)?)\(([^()]*)\)/gi,(a,c,d)=>{const u=d.split(/\s*,\s*|\s+/).map((m,g)=>{if(!m.endsWith("%"))return m;const p=c.toLowerCase()==="translatey"||g===1?t:r;return`${Number.parseFloat(m)*p/100}px`});return`${c}(${u.join(",")})`});try{const a=new DOMMatrix(i);return at([a.m11,a.m21,a.m41,a.m12,a.m22,a.m42,a.m14,a.m24,a.m44])}catch{return null}}const rt="viewport-plane-v1";function N(s){var w;const r=s.offsetWidth||1,t=s.offsetHeight||1,e=typeof getComputedStyle=="function"?getComputedStyle(s):null,i=((e==null?void 0:e.transformOrigin)||`${r/2}px ${t/2}px`).split(" "),a=Number.parseFloat(i[0])||0,c=Number.parseFloat(i[1])||0;let d=!0;if(typeof getComputedStyle=="function")for(let C=s.parentElement;C;C=C.parentElement){const S=getComputedStyle(C);if(S.transform&&S.transform!=="none"||S.perspective&&S.perspective!=="none"){d=!1;break}}const u=(w=s.getBoundingClientRect)==null?void 0:w.call(s),m=it((e==null?void 0:e.transform)||"",r,t)??M(U),g=O(O(M(B(a,c)),m),M(B(-a,-c))),p=[[0,0],[r,0],[0,t],[r,t]].map(([C,S])=>{const F=g[6]*C+g[7]*S+g[8];return[(g[0]*C+g[1]*S+g[2])/F,(g[3]*C+g[4]*S+g[5])/F]}),l=((u==null?void 0:u.left)??0)-Math.min(...p.map(C=>C[0])),n=((u==null?void 0:u.top)??0)-Math.min(...p.map(C=>C[1])),y=B(l+a,n+c),o=nt(B(-a,-c),K(r,t)),f=M(tt(y)),b=M(tt(o));return{frame:d?{left:l,top:n,width:r,height:t}:void 0,read(C){const S={};for(const[F,_]of Object.entries(C)){const k=String(_);if(F==="transform"){if(!d)continue;const T=it(k,r,t),V=T&&at(O(O(M(y),T),M(o)));if(V){const[W,z,P,E,D,I,j,v]=V,L=W-P*j,$=E-I*j,J=z-P*v,Q=D-I*v,H=Math.hypot(L,$);if(H>1e-8){S[F]=et(rt,[P,I,Math.atan2($,L),H,(L*Q-$*J)/H,(L*J+$*Q)/H,j,v]);continue}}}const R=[...k.matchAll(st)].map(T=>Number(T[0]));R.length&&R.every(Number.isFinite)&&(S[F]=et(`css:${k.replace(st,"#")}`,R))}return S},write(C){const S={};for(const[F,_]of Object.entries(C))if(F==="transform"&&_.schema===rt){const[k,R,T,V,W,z,P,E]=_.value,D=Math.cos(T),I=Math.sin(T),j=[D*V+k*P,D*z-I*W+k*E,k,I*V+R*P,I*z+D*W+R*E,R,P,E,1],v=O(O(f,j),b);Math.abs(v[6])+Math.abs(v[7])<1e-10&&Math.abs(v[8]-1)<1e-10?S[F]=`matrix(${[v[0],v[3],v[1],v[4],v[2],v[5]].join(",")})`:S[F]=`matrix3d(${[v[0],v[3],0,v[6],v[1],v[4],0,v[7],0,0,1,0,v[2],v[5],0,v[8]].join(",")})`}else if(_.schema.startsWith("css:")){let k=0;S[F]=_.schema.slice(4).replace(/#/g,()=>String(_.value[k++]))}return S}}}const dt=1e3/60,ot=1e3/30,pt=ot+1;class ft{constructor(){h(this,"drivers",new Set);h(this,"observers",new Set);h(this,"frameRequest",null);h(this,"previousTimestamp",null);h(this,"tick",r=>{this.frameRequest=null;const t=this.previousTimestamp===null?dt:Math.max(0,r-this.previousTimestamp);this.previousTimestamp=r;const e={delta:Math.min(t,ot),rawDelta:t};this.runPhase(this.drivers,e),this.runPhase(this.observers,e),this.hasCallbacks()?this.requestFrame():this.previousTimestamp=null})}subscribe(r,t="drive"){const e=t==="drive"?this.drivers:this.observers;return e.add(r),this.requestFrame(),()=>{e.delete(r),this.stopIfIdle()}}requestFrame(){this.frameRequest!==null||!this.hasCallbacks()||(this.frameRequest=requestAnimationFrame(this.tick))}runPhase(r,t){for(const e of[...r])r.has(e)&&e(t)}hasCallbacks(){return this.drivers.size>0||this.observers.size>0}stopIfIdle(){this.hasCallbacks()||(this.frameRequest!==null&&typeof cancelAnimationFrame<"u"&&cancelAnimationFrame(this.frameRequest),this.frameRequest=null,this.previousTimestamp=null)}}const lt=new ft,mt=2;class Y extends Z{constructor(t){super();h(this,"_element");h(this,"_integrator");h(this,"label");h(this,"styleFn");h(this,"lowerBound");h(this,"upperBound");h(this,"currentValue");h(this,"currentVelocity",0);h(this,"solverState");h(this,"solverTarget",1);h(this,"presentationTime",0);h(this,"renderedStyles",[]);h(this,"frames",[]);h(this,"waapi",null);h(this,"runId",0);h(this,"waitingForStart",!1);h(this,"startReady",!1);h(this,"pendingFirstFrame");h(this,"stopStartupClock",null);h(this,"startupStableFrames",0);h(this,"running",!1);h(this,"paused",!1);h(this,"settled",!1);h(this,"reversing",!1);h(this,"disposed",!1);h(this,"legacyCompletionCleanup");h(this,"motion");h(this,"codec");h(this,"adopted");h(this,"presentationFrames",[]);h(this,"hold",null);h(this,"fallbackCopy",null);h(this,"fallbackChannels",new Set);h(this,"fallbackMode");this._element=t.element,this._integrator=t.integrator,this.label=t.label,this.styleFn=t.style,this.lowerBound=t.lowerBound??0,this.upperBound=t.upperBound??1,this.currentValue=this.lowerBound,this.onUpdate=t.onUpdate,this.legacyCompletionCleanup=!!t.onComplete&&!t.onDispose,this.onComplete=t.onComplete,this.onDispose=t.onDispose,this.motion=t.motion??{}}get handoffFallbackMode(){return this.fallbackMode}get handoffFallbacks(){return[...this.fallbackChannels]}get element(){return this._element}get integrator(){return this._integrator}set integrator(t){this._integrator=t,this.solverState=void 0}setIntegrator(t){this._integrator=t,this.solverState=void 0}play(){var e;const t=this.reversing;if(this.reversing=!1,this.paused&&this.waapi&&!t){if(this.paused=!1,this.running=!0,this.waitingForStart){this.startReady&&this.startFramePacedPlayback(this.waapi);return}this.waapi.play(),(e=this.fallbackCopy)==null||e.play();return}this.runToward(this.upperBound)}reverse(){this.reversing=!0,this.runToward(this.lowerBound)}pause(){var t,e,i;this.running&&(this.captureLiveState(),(t=this.waapi)==null||t.pause(),(e=this.fallbackCopy)==null||e.pause(),(i=this.stopStartupClock)==null||i.call(this),this.stopStartupClock=null,this.running=!1,this.paused=!0)}complete(){this.settled||(this.clearWaapi(),this.running=!1,this.paused=!1,this.currentValue=this.upperBound,this.currentVelocity=0,this.applyStyleAt(this.currentValue),this.settled=!0,this.finish())}validate(){const t=this.motion.handoffDuration??280;if(!Number.isFinite(t)||t<0||t>1e4)throw new Error("handoffDuration must be finite and between 0 and 10000 ms")}getMotionTracks(){return[this]}get supportsInterruption(){return!this.legacyCompletionCleanup}stop(){var t,e;this.captureLiveState(),this.clearWaapi(),(t=this.hold)==null||t.cancel(),this.hold=null,(e=this.fallbackCopy)==null||e.cancel({reason:"disposed",owns:()=>!0}),this.fallbackCopy=null,this.running=!1,this.paused=!1}cancel(t){this.stop(),this.disposeResources(t)}disposeResources(t){var e;if(!this.disposed&&(this.disposed=!0,t.owns(this.element)))try{(e=this.onDispose)==null||e.call(this,t)}catch(i){console.error("[ssgoi] animation cleanup failed",i)}}finish(){var t,e,i,a;this.presentationTime=((t=this.frames[this.frames.length-1])==null?void 0:t.time)??0,this.solverState=void 0,(e=this.hold)==null||e.cancel(),this.hold=null,this.applyStyleAt(this.currentValue),this.clearWaapi(),(i=this.fallbackCopy)==null||i.cancel({reason:"disposed",owns:()=>!0}),this.fallbackCopy=null,this.deferDisposal||this.disposeResources(x),(a=this.onComplete)==null||a.call(this)}get motionIdentity(){return{target:this.element,key:this.motion.key,role:this.motion.role,space:this.motion.space,lifetime:this.motion.lifetime}}getMotionSnapshot(){var a,c;this.running&&this.captureLiveState();const t=this.samplePresentation(q(this.waapi)??this.presentationTime),e=this.paused||this.waitingForStart&&!q(this.waapi)?0:this.playbackRate,i={...this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue),...(a=this.codec)==null?void 0:a.write(t)};return{...this.motionIdentity,displayStyle:i,inlineStyle:this.element.style.cssText,frame:(c=this.codec)==null?void 0:c.frame,channels:Object.fromEntries(Object.entries(t).map(([d,u])=>[d,{...u,velocity:u.velocity.map(m=>m*e)}]))}}adopt(t){var d,u,m,g,p;this.codec??(this.codec=this.motion.codec??N(this.element)),this.adopted=t;const e=this.codec.read({transform:"none",opacity:1,...this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue)});this.fallbackChannels.clear(),this.fallbackMode=void 0;const i=this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue),a=t.displayStyle;for(const[l,n]of Object.entries(a??{}))l in i&&String(n)!==String(i[l])&&(!t.channels[l]||!e[l])&&this.fallbackChannels.add(l);for(const[l,n]of Object.entries(t.channels)){const y=e[l];y&&!A.compatibleChannel(n,y)&&this.fallbackChannels.add(l)}if(this.fallbackChannels.size&&(this.fallbackMode="finish"),this.fallbackChannels.size&&this.motion.fallback!=="finish"){const l=t;if(l.frame&&l.displayStyle&&t.target.cloneNode&&t.target.parentElement&&!t.target.shadowRoot&&!((u=(d=t.target).matches)!=null&&u.call(d,"canvas, video, audio, iframe, object, embed"))&&!((g=(m=t.target).querySelector)!=null&&g.call(m,"canvas, video, audio, iframe, object, embed"))){this.fallbackMode="crossfade";const n=t.target.cloneNode(!0);n.removeAttribute("id"),n.removeAttribute("data-ssgoi-transition");for(const o of n.querySelectorAll("[id], [data-ssgoi-transition]"))o.removeAttribute("id"),o.removeAttribute("data-ssgoi-transition");n.style.cssText=l.inlineStyle??"",Object.assign(n.style,l.displayStyle,{position:"fixed",left:`${l.frame.left}px`,top:`${l.frame.top}px`,width:`${l.frame.width}px`,height:`${l.frame.height}px`,margin:"0",pointerEvents:"none",zIndex:"2147483646"}),n.setAttribute("aria-hidden","true"),n.inert=!0,t.target.parentElement.appendChild(n);const y=Number(l.displayStyle.opacity??1);this.fallbackCopy=new Y({element:n,integrator:{step:(o,f,b)=>({position:Math.min(f,o.position+b/.18),velocity:0}),isSettled:(o,f)=>o.position>=f},style:(o,f)=>({opacity:y*f}),onDispose:()=>n.remove()}),this.adopted={...t,channels:{...t.channels,opacity:{schema:"css:#",value:[0],velocity:[0]}}}}}const c=this.codec.write(this.adopted.channels);(p=this.hold)==null||p.cancel(),Object.keys(c).length&&(this.hold=this.element.animate([c],{duration:1,fill:"both"}),this.hold.pause(),this.hold.currentTime=0)}channelsAt(t){const e=this.presentationFrames[t];if(e)return e.channels;const i=this.frames[t];return this.codec??(this.codec=this.motion.codec??N(this.element)),this.codec.read({transform:"none",opacity:1,...this.styleFn(i.position,this.lowerBound+this.upperBound-i.position)})}samplePresentation(t){const e=this.frames;if(!e.length)return this.adopted?{...this.adopted.channels}:(this.codec??(this.codec=this.motion.codec??N(this.element)),this.codec.read({transform:"none",opacity:1,...this.styleFn(this.currentValue,this.lowerBound+this.upperBound-this.currentValue)}));let i=e.findIndex(n=>n.time>t);i<0&&(i=e.length-1);const a=Math.max(0,i-1),c=e[a],d=e[i],u=this.channelsAt(a),m=a===i?u:this.channelsAt(i),g=(d.time-c.time)/1e3,p=g?Math.max(0,Math.min(1,(t-c.time)/(g*1e3))):0,l={};for(const[n,y]of Object.entries(u)){const o=m[n];if(!o||!A.compatibleChannel(y,o)){l[n]=y;continue}l[n]={schema:y.schema,value:y.value.map((f,b)=>f+(o.value[b]-f)*p),velocity:y.value.map((f,b)=>t>=e[e.length-1].time||!g?0:(o.value[b]-f)/g)}}return l}releaseFill(){this.clearWaapi()}get isAnimating(){return this.running}get isPaused(){return this.paused}get isComplete(){return this.settled}get isReversing(){return this.reversing}get progress(){this.running&&this.captureLiveState();const t=this.upperBound-this.lowerBound;if(t===0)return 0;const e=(this.currentValue-this.lowerBound)/t;return e<0?0:e>1?1:e}findTimeForProgress(t){if(this.frames.length<2)return null;const e=this.upperBound-this.lowerBound;if(e===0)return 0;for(const i of this.frames)if((i.position-this.lowerBound)/e>=t)return i.time;return this.frames[this.frames.length-1].time}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t,this.waapi&&(this.waapi.playbackRate=t)}getPose(){return this.running&&this.captureLiveState(),[{element:this._element,value:this.currentValue,velocity:this.currentVelocity}]}getTimeline(){const t=this.frames.map((e,i)=>{const a=e.position,c=this.lowerBound+this.upperBound-a;return{time:e.time,value:e.position,velocity:e.velocity,style:this.renderedStyles[i]??this.styleFn(a,c)}});return[{element:this._element,frames:t}]}matchInto(t){const e=t.find(i=>i.element===this._element);e&&(this.currentValue=e.value,this.currentVelocity=e.velocity,this.solverState=void 0)}runToward(t){var m,g;if(this.validate(),this.running||this.paused){const p=this.getMotionSnapshot();this.captureLiveState(),this.adopted=p}if(this.clearWaapi(),this.running=!1,this.paused=!1,this.settled=!1,this.disposed=!1,this.presentationTime=0,this.presentationFrames=[],this.solverTarget=t,this.frames=A.simulate(this._integrator,this.currentValue,t,this.currentVelocity,this.solverState,!0),this.frames.length===0&&this.adopted&&(this.frames=[{time:0,position:t,velocity:0}]),this.frames.length===0){this.currentValue=t,this.currentVelocity=0,this.applyStyleAt(t),this.settled=!0,this.finish();return}const e=p=>this.styleFn(p.position,this.lowerBound+this.upperBound-p.position),i=this.adopted?this.bridgeKeyframes(e):this.frames.map(p=>e(p));this.renderedStyles=i,this.adopted=void 0;const a=i[0],c=this.frames[this.frames.length-1],d=c.time;this.runId++;const u=this._element.animate(i,{duration:d,fill:"both",easing:"linear",composite:"replace"});u.playbackRate=this.playbackRate,u.currentTime=0,u.pause(),this.waapi=u,(m=this.fallbackCopy)==null||m.play(),(g=this.hold)==null||g.cancel(),this.hold=null,this.waitingForStart=!0,this.startReady=!0,this.pendingFirstFrame=a,this.running=!0,u.onfinish=()=>{!this.running||this.waapi!==u||(this.running=!1,this.settled=!0,this.currentValue=c.position,this.currentVelocity=0,this.finish())},this.startFramePacedPlayback(u)}bridgeKeyframes(t){var g;this.codec=this.motion.codec??N(this.element);const e=this.codec,i=Math.max(16,this.motion.handoffDuration??280),a=this.frames[this.frames.length-1];for(let p=a.time+1e3/60;p<i+1e3/60;p+=1e3/60)this.frames.push({time:p,position:a.position,velocity:0});const c=this.frames.map(p=>e.read({transform:"none",opacity:1,...t(p)}));for(let p=1;p<c.length;p++){const l=c[p-1].transform,n=c[p].transform;if((l==null?void 0:l.schema)==="viewport-plane-v1"&&(n==null?void 0:n.schema)===l.schema){const y=[...n.value];y[2]=l.value[2]+Math.atan2(Math.sin(y[2]-l.value[2]),Math.cos(y[2]-l.value[2])),c[p].transform={...n,value:y}}}const d=c[0],u=c[1]??d,m={};for(const[p,l]of Object.entries(((g=this.adopted)==null?void 0:g.channels)??{})){let n=d[p];if(!n){const o=p==="transform"?{transform:"none"}:p==="opacity"?{opacity:1}:{};if(n=e.read(o)[p],n)for(const f of c)f[p]=n}if(!n||!A.compatibleChannel(l,n))continue;const y=u[p]??n;m[p]={offset:l.value.map((o,f)=>{let b=o-n.value[f];return p==="transform"&&l.schema==="viewport-plane-v1"&&f===2&&(b=Math.atan2(Math.sin(b),Math.cos(b))),b}),velocity:l.velocity.map((o,f)=>o/Math.max(Math.abs(this.playbackRate),1e-4)-(y.value[f]-n.value[f])*60)}}return this.presentationFrames=this.frames.map((p,l)=>{const n={...c[l]};for(const[y,o]of Object.entries(m)){const f=n[y];n[y]={...f,value:f.value.map((b,w)=>b+A.residualAt(o.offset[w],o.velocity[w],p.time/1e3,i/1e3).value)}}return{time:p.time,channels:n}}),this.frames.map((p,l)=>{const n=this.presentationFrames[l].channels;return{...t(p),...e.write(Object.fromEntries(Object.keys(m).map(y=>[y,n[y]])))}})}clearWaapi(){var t,e;this.runId++,(t=this.waapi)==null||t.cancel(),this.waapi=null,this.waitingForStart=!1,this.startReady=!1,this.pendingFirstFrame=void 0,(e=this.stopStartupClock)==null||e.call(this),this.stopStartupClock=null,this.startupStableFrames=0}captureLiveState(){if(this.frames.length===0)return;const t=q(this.waapi);if(t===null)return;this.presentationTime=t;const{position:e,velocity:i}=A.interpolateFrame(this.frames,t);this.currentValue=e,this.currentVelocity=i,this.solverState=A.sampleIntegratorState(this.frames,t,this._integrator,this.solverTarget)}startFramePacedPlayback(t){if(!(this.waapi!==t||!this.waitingForStart||!this.startReady||this.stopStartupClock)){if(typeof requestAnimationFrame>"u"||this.playbackRate<0){this.clearStartStyles(),this.handOffToWaapi(t);return}this.startupStableFrames=0,this.stopStartupClock=lt.subscribe(e=>{this.advanceFramePacedStartup(t,e)})}}clearStartStyles(){if(this.pendingFirstFrame)for(const t of Object.keys(this.pendingFirstFrame))this._element.style[t]="";this.pendingFirstFrame=void 0}advanceFramePacedStartup(t,e){if(this.waapi!==t||!this.running||this.paused||!this.waitingForStart)return;const i=this.frames[this.frames.length-1];if(!i)return;const a=q(t)??0,c=Math.min(i.time,a+e.delta*Math.max(0,this.playbackRate));if(t.currentTime=c,this.clearStartStyles(),this.captureLiveState(),c>=i.time){this.finishFramePacedRun(t,i);return}e.rawDelta<=pt?this.startupStableFrames++:this.startupStableFrames=0,!(this.startupStableFrames<mt)&&this.handOffToWaapi(t)}handOffToWaapi(t){var c,d;if(this.waapi!==t||!this.running||this.paused)return;(c=this.stopStartupClock)==null||c.call(this),this.stopStartupClock=null,this.waitingForStart=!1,this.startReady=!1,this.startupStableFrames=0;const e=(d=t.timeline)==null?void 0:d.currentTime,i=q(t),a=this.playbackRate;if(typeof e=="number"&&i!==null&&a!==0){t.startTime=e-i/a;return}t.play()}finishFramePacedRun(t,e){var i;this.waapi!==t||!this.running||((i=this.stopStartupClock)==null||i.call(this),this.stopStartupClock=null,this.waitingForStart=!1,this.startReady=!1,this.startupStableFrames=0,this.running=!1,this.settled=!0,this.currentValue=e.position,this.currentVelocity=0,this.finish())}applyStyleAt(t){const e=this.lowerBound+this.upperBound-t,i=this.styleFn(t,e);for(const[a,c]of Object.entries(i))this._element.style[a]=typeof c=="number"?String(c):c}}function q(s){const r=s==null?void 0:s.currentTime;return typeof r=="number"?r:null}function gt(s){return typeof s.step=="function"?s:A.IntegratorProvider.from(s)}class G extends Z{constructor(t,e={}){super();h(this,"_children");h(this,"progressChildren");h(this,"_startAt");h(this,"namedChildren");h(this,"restoreChildCallbacks",[]);h(this,"runId",0);h(this,"pendingComplete",0);h(this,"running",!1);h(this,"disposed",!1);h(this,"settled",!1);h(this,"startedChildren",new Set);h(this,"lastMethod","play");h(this,"pausedRun",!1);h(this,"pendingStartObservers",[]);this.namedChildren=new Map(Array.isArray(t)?[]:Object.entries(t)),this._children=Array.isArray(t)?[...t]:[...this.namedChildren.values()];for(const i of this._children)i.deferDisposal=!0;this.progressChildren=this._children.filter(i=>!(i instanceof G)||i.progressChildren.length>0),(e.mode??"parallel")==="sequence"?this._startAt=this._children.map((i,a)=>a===0?0:1):this._startAt=e.startAt??[]}get children(){return this._children}get startAt(){return this._startAt}set startAt(t){this._startAt=t}tracks(){return this._children.flatMap(t=>[...t.getMotionTracks()])}getMotionTracks(){return this.tracks()}validate(){this.buildDependencies();for(const t of this._children)t.validate()}select(t){const e=this.namedChildren.get(t);if(!e)throw new Error(`Unknown animation child: ${t}`);return e}set(t,e){if(typeof t=="string"){const i=this.select(t);return(e==null?void 0:e.integrator)!==void 0&&i.set({integrator:gt(e.integrator)}),this}return super.set(t)}setIntegrator(t){for(const e of this._children)e.set({integrator:t})}play(){this.startRun("play")}reverse(){this.startRun("reverse")}pause(){this.pausedRun=this.running||this.pausedRun,this.running=!1,this.clearPendingStartObservers();for(const t of this._children)t.pause()}complete(){var t;if(!this.settled){this.settled=!0,this.running=!1,this.clearPendingStartObservers(),this.restoreCompletionHandlers();for(const e of this._children)e.complete();if(!this.deferDisposal){for(const e of this._children)e.cancel(x);this.disposeResources(x)}(t=this.onComplete)==null||t.call(this)}}get supportsInterruption(){return this._children.every(t=>t.supportsInterruption)}stop(){this.runId++,this.running=!1,this.clearPendingStartObservers(),this.restoreCompletionHandlers();for(const t of this._children)t.stop()}cancel(t){this.stop();for(const e of this._children)e.cancel(t);this.disposeResources(t)}disposeResources(t){var e;if(!this.disposed){this.disposed=!0;try{(e=this.onDispose)==null||e.call(this,t)}catch(i){console.error("[ssgoi] composite cleanup failed",i)}}}get progress(){if(this.progressChildren.length===0)return 0;let t=0;for(const e of this.progressChildren)t+=e.progress;return t/this.progressChildren.length}getPose(){return this._children.flatMap(t=>t.getPose())}getTimeline(){return this._children.flatMap(t=>t.getTimeline())}matchInto(t){for(const e of this._children)e.matchInto(t)}get isAnimating(){return this._children.some(t=>t.isAnimating)}get isPaused(){return this._children.some(t=>t.isPaused)&&this._children.every(t=>t.isPaused||t.isComplete)}get isComplete(){return this.settled}get isReversing(){return this._children.some(t=>t.isReversing)}get playbackRate(){return super.playbackRate}set playbackRate(t){super.playbackRate=t;for(const e of this._children)e.playbackRate=t}startRun(t){const e=this.buildDependencies(),i=this.pausedRun&&t===this.lastMethod,a=t!==this.lastMethod,c=new Set(this.startedChildren),d=new Set(this._children.filter(o=>o.isComplete)),u=t==="reverse"&&c.size?this._children.filter(o=>c.has(o)):[...this._children],m=t==="reverse"?[...u].reverse():u,g=new Map;if(t==="reverse")for(const[o,f]of e){if(!u.includes(o)||!u.includes(f.after))continue;const b=g.get(f.after)??[];b.push({after:o,at:f.at==="settled"?"settled":1-f.at}),g.set(f.after,b)}else for(const[o,f]of e)g.set(o,[f]);if(a||i)for(const o of c)d.has(o)||g.delete(o);this.running&&this.pause(),this.restoreCompletionHandlers();const p=++this.runId;if(this.running=!0,this.pausedRun=!1,this.lastMethod=t,this.disposed=!1,this.settled=!1,this.pendingComplete=u.length,!i&&!a&&this.startedChildren.clear(),this.pendingComplete===0){this.handleFinished();return}const l=new Set,n=new Set;if(i)for(const o of u)c.has(o)&&d.has(o)&&(n.add(o),l.add(o),this.pendingComplete--);for(const o of u){const f=o.onComplete,b=()=>{if(!(this.runId!==p||!this.running||l.has(o))){try{f==null||f()}catch(w){console.error("[ssgoi] animation completion failed",w)}l.add(o),--this.pendingComplete===0&&this.handleFinished()}};o.onComplete=b,this.restoreChildCallbacks.push(()=>{o.onComplete===b&&(o.onComplete=f)})}const y=()=>{let o=!0;for(;this.running&&this.runId===p&&o;){o=!1;for(const f of m)!this.running||n.has(f)||(g.get(f)??[]).some(w=>!n.has(w.after)||!this.hasReachedThreshold(w.after,w.at,t))||(n.add(f),this.startedChildren.add(f),f[t](),o=!0)}n.size===u.length&&this.clearPendingStartObservers()};y(),this.pendingComplete===0&&this.handleFinished(),this.running&&n.size!==u.length&&this.pendingStartObservers.push(lt.subscribe(y,"observe"))}buildDependencies(){const t=new Map,e=new Set(this._children);if(e.size!==this._children.length)throw new Error("Each child animation must occur once in a MultiAnimation");this._children.forEach((d,u)=>{const m=d.startCondition;if(m){if(!e.has(m.after))throw new Error("startAt.after must reference a sibling in the same MultiAnimation");t.set(d,{...m})}else u>0&&this._startAt.some(g=>g>0)&&t.set(d,{after:this._children[u-1],at:this._startAt[u]??0})});const i=new Set,a=new Set,c=d=>{if(a.has(d))throw new Error("Animation startAt dependencies form a cycle");if(i.has(d))return;a.add(d);const u=t.get(d);u&&c(u.after),a.delete(d),i.add(d)};return this._children.forEach(c),t}hasReachedThreshold(t,e,i){return t.isComplete?!0:e==="settled"?!1:e<=0?!0:(i==="play"?t.progress:1-t.progress)>=e}clearPendingStartObservers(){for(const t of this.pendingStartObservers)t();this.pendingStartObservers=[]}restoreCompletionHandlers(){for(const t of this.restoreChildCallbacks)t();this.restoreChildCallbacks=[]}handleFinished(){var t;if(this.running){if(this.running=!1,this.settled=!0,this.clearPendingStartObservers(),this.restoreCompletionHandlers(),!this.deferDisposal){for(const e of this._children)e.cancel(x);this.disposeResources(x)}(t=this.onComplete)==null||t.call(this)}}findTimeForProgress(t){return null}}const X=new WeakMap;function yt(s){const r=X.get(s)??{value:s.style.getPropertyValue("opacity"),priority:s.style.getPropertyPriority("opacity"),opacity:typeof getComputedStyle=="function"?Number.parseFloat(getComputedStyle(s).opacity):Number.NaN,users:new Set},t={};r.users.add(t),X.set(s,r);let e=!1;return{opacity:Number.isFinite(r.opacity)?r.opacity:1,set:i=>{t.value=i,s.style.opacity=String(i)},restore:()=>{if(!e){if(e=!0,r.users.delete(t),r.users.size>0){const i=Array.from(r.users),a=i[i.length-1];(a==null?void 0:a.value)!==void 0&&(s.style.opacity=String(a.value));return}r.value?s.style.setProperty("opacity",r.value,r.priority):s.style.removeProperty("opacity"),X.delete(s)}}}}exports.Animation=Z;exports.MultiAnimation=G;exports.WebAnimation=Y;exports.createWebPresentationCodec=N;exports.finishedDisposal=x;exports.retainOpacity=yt;