@ssgoi/core 2.5.5 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/animator/animate/css-runner.d.ts +17 -0
  2. package/dist/animator/animate/css-runner.d.ts.map +1 -0
  3. package/dist/animator/animate/index.d.ts +42 -0
  4. package/dist/animator/animate/index.d.ts.map +1 -0
  5. package/dist/animator/animate/tick-runner.d.ts +16 -0
  6. package/dist/animator/animate/tick-runner.d.ts.map +1 -0
  7. package/dist/animator/animate/types.d.ts +31 -0
  8. package/dist/animator/animate/types.d.ts.map +1 -0
  9. package/dist/animator/animation.d.ts +57 -0
  10. package/dist/animator/animation.d.ts.map +1 -0
  11. package/dist/animator/index.d.ts +34 -33
  12. package/dist/animator/index.d.ts.map +1 -1
  13. package/dist/animator/multi-animator.d.ts +98 -0
  14. package/dist/animator/multi-animator.d.ts.map +1 -0
  15. package/dist/animator/spring-core.d.ts +63 -0
  16. package/dist/animator/spring-core.d.ts.map +1 -0
  17. package/dist/index.cjs +2 -2
  18. package/dist/index.js +700 -818
  19. package/dist/ssgoi-transition/create-ssgoi-transition-context.d.ts.map +1 -1
  20. package/dist/ssgoi-transition/create-swipe-detector.d.ts +1 -0
  21. package/dist/ssgoi-transition/create-swipe-detector.d.ts.map +1 -1
  22. package/dist/transition/create-transition-callback.d.ts +2 -2
  23. package/dist/transition/create-transition-callback.d.ts.map +1 -1
  24. package/dist/transition/transition-strategy.d.ts +28 -17
  25. package/dist/transition/transition-strategy.d.ts.map +1 -1
  26. package/dist/transition/transition.d.ts +2 -18
  27. package/dist/transition/transition.d.ts.map +1 -1
  28. package/dist/transitions/blur.d.ts +5 -5
  29. package/dist/transitions/blur.d.ts.map +1 -1
  30. package/dist/transitions/bounce.d.ts +5 -5
  31. package/dist/transitions/bounce.d.ts.map +1 -1
  32. package/dist/transitions/fade.d.ts +5 -5
  33. package/dist/transitions/fade.d.ts.map +1 -1
  34. package/dist/transitions/fly.d.ts +5 -5
  35. package/dist/transitions/fly.d.ts.map +1 -1
  36. package/dist/transitions/index.cjs +1 -1
  37. package/dist/transitions/index.js +206 -207
  38. package/dist/transitions/mask.d.ts +5 -5
  39. package/dist/transitions/mask.d.ts.map +1 -1
  40. package/dist/transitions/none.d.ts +3 -3
  41. package/dist/transitions/none.d.ts.map +1 -1
  42. package/dist/transitions/rotate.d.ts +5 -5
  43. package/dist/transitions/rotate.d.ts.map +1 -1
  44. package/dist/transitions/scale.d.ts +5 -5
  45. package/dist/transitions/scale.d.ts.map +1 -1
  46. package/dist/transitions/slide.d.ts +5 -5
  47. package/dist/transitions/slide.d.ts.map +1 -1
  48. package/dist/types.cjs +1 -1
  49. package/dist/types.d.ts +142 -102
  50. package/dist/types.d.ts.map +1 -1
  51. package/dist/types.js +69 -6
  52. package/dist/view-transitions/blind.d.ts +0 -1
  53. package/dist/view-transitions/blind.d.ts.map +1 -1
  54. package/dist/view-transitions/drill.d.ts.map +1 -1
  55. package/dist/view-transitions/fade.d.ts.map +1 -1
  56. package/dist/view-transitions/hero.d.ts.map +1 -1
  57. package/dist/view-transitions/index.cjs +13 -13
  58. package/dist/view-transitions/index.js +499 -492
  59. package/dist/view-transitions/scroll.d.ts.map +1 -1
  60. package/dist/view-transitions/slide.d.ts.map +1 -1
  61. package/dist/view-transitions/strip.d.ts.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/animator/animate.d.ts +0 -35
  64. package/dist/animator/animate.d.ts.map +0 -1
  65. package/dist/animator/animation-scheduler.d.ts +0 -47
  66. package/dist/animator/animation-scheduler.d.ts.map +0 -1
  67. package/dist/test-utils.d.ts +0 -46
  68. package/dist/test-utils.d.ts.map +0 -1
@@ -0,0 +1,17 @@
1
+ import { SpringConfig } from '../spring-core';
2
+ import { AnimationControls, StyleObject } from './types';
3
+ export interface CssRunnerOptions {
4
+ element: HTMLElement;
5
+ from: number;
6
+ to: number;
7
+ spring: SpringConfig;
8
+ velocity?: number;
9
+ style: (progress: number) => StyleObject;
10
+ onComplete: () => void;
11
+ onStart?: () => void;
12
+ }
13
+ /**
14
+ * Run spring animation via Web Animation API
15
+ */
16
+ export declare function runCssAnimation(options: CssRunnerOptions): AnimationControls;
17
+ //# sourceMappingURL=css-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/animate/css-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE9D,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,WAAW,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;IACzC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AA4HD;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,iBAAiB,CA6E5E"}
@@ -0,0 +1,42 @@
1
+ import { AnimationControls, AnimationOptions } from './types';
2
+ export type { AnimationControls, AnimationOptions };
3
+ /**
4
+ * Run spring animation
5
+ *
6
+ * tick option: RAF-based real-time animation
7
+ * css option: Web Animation API based (GPU accelerated)
8
+ *
9
+ * @example
10
+ * ```ts
11
+ * // Tick mode (RAF)
12
+ * const controls = animate({
13
+ * from: 0,
14
+ * to: 1,
15
+ * spring: { stiffness: 300, damping: 30 },
16
+ * tick: (value) => element.style.opacity = String(value),
17
+ * onComplete: () => console.log('done'),
18
+ * });
19
+ *
20
+ * // CSS mode (Web Animation API)
21
+ * const controls = animate({
22
+ * from: 0,
23
+ * to: 1,
24
+ * spring: { stiffness: 300, damping: 30 },
25
+ * css: {
26
+ * element: myElement,
27
+ * style: (progress) => ({
28
+ * opacity: String(progress),
29
+ * transform: `scale(${0.5 + 0.5 * progress})`,
30
+ * }),
31
+ * },
32
+ * onComplete: () => console.log('done'),
33
+ * });
34
+ *
35
+ * // Stop mid-animation and check state
36
+ * controls.stop();
37
+ * console.log(controls.getPosition()); // Current position
38
+ * console.log(controls.getVelocity()); // Current velocity
39
+ * ```
40
+ */
41
+ export declare function animate(options: AnimationOptions): AnimationControls;
42
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/animate/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEnE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,iBAAiB,CA6CpE"}
@@ -0,0 +1,16 @@
1
+ import { SpringConfig } from '../spring-core';
2
+ import { AnimationControls } from './types';
3
+ export interface TickRunnerOptions {
4
+ from: number;
5
+ to: number;
6
+ spring: SpringConfig;
7
+ velocity?: number;
8
+ onUpdate: (value: number) => void;
9
+ onComplete: () => void;
10
+ onStart?: () => void;
11
+ }
12
+ /**
13
+ * Run spring animation via RAF
14
+ */
15
+ export declare function runTickAnimation(options: TickRunnerOptions): AnimationControls;
16
+ //# sourceMappingURL=tick-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tick-runner.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/animate/tick-runner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAML,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,iBAAiB,GACzB,iBAAiB,CA8DnB"}
@@ -0,0 +1,31 @@
1
+ import { SpringConfig } from '../spring-core';
2
+ /**
3
+ * CSS style object type
4
+ */
5
+ export type StyleObject = Record<string, number | string>;
6
+ /**
7
+ * Animation Controls - Common interface for both tick-runner and css-runner
8
+ */
9
+ export interface AnimationControls {
10
+ stop: () => void;
11
+ getPosition: () => number;
12
+ getVelocity: () => number;
13
+ isRunning: () => boolean;
14
+ }
15
+ /**
16
+ * Animation Options - Unified options
17
+ */
18
+ export interface AnimationOptions {
19
+ from: number;
20
+ to: number;
21
+ spring: SpringConfig;
22
+ velocity?: number;
23
+ onComplete: () => void;
24
+ onStart?: () => void;
25
+ tick?: (value: number) => void;
26
+ css?: {
27
+ element: HTMLElement;
28
+ style: (progress: number) => StyleObject;
29
+ };
30
+ }
31
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/animator/animate/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAGrB,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,WAAW,CAAC;QACrB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;KAC1C,CAAC;CACH"}
@@ -0,0 +1,57 @@
1
+ import { AnimationState } from '../types';
2
+ /**
3
+ * Animation - Abstract base class for spring-based animations
4
+ *
5
+ * Provides common interface for both single and multi-spring animations.
6
+ * Subclasses implement the actual animation logic.
7
+ */
8
+ export declare abstract class Animation {
9
+ /**
10
+ * Start animation moving forward (from → to)
11
+ * For IN transitions: 0 → 1
12
+ */
13
+ abstract forward(): void;
14
+ /**
15
+ * Start animation moving backward (to → from)
16
+ * For OUT transitions: 1 → 0
17
+ */
18
+ abstract backward(): void;
19
+ /**
20
+ * Stop the animation at current position
21
+ */
22
+ abstract stop(): void;
23
+ /**
24
+ * Reverse the animation direction
25
+ * If animating forward, switch to backward (and vice versa)
26
+ */
27
+ abstract reverse(): void;
28
+ /**
29
+ * Get current animation state
30
+ */
31
+ abstract getCurrentState(): AnimationState;
32
+ /**
33
+ * Get current position value
34
+ * For multi-spring: returns first animator's position
35
+ */
36
+ abstract getCurrentValue(): number;
37
+ /**
38
+ * Get current velocity
39
+ * For multi-spring: returns first animator's velocity
40
+ */
41
+ abstract getVelocity(): number;
42
+ /**
43
+ * Set current position value
44
+ * For multi-spring: applies to first animator (TODO: per-spring control)
45
+ */
46
+ abstract setValue(value: number): void;
47
+ /**
48
+ * Set current velocity
49
+ * For multi-spring: applies to first animator (TODO: per-spring control)
50
+ */
51
+ abstract setVelocity(velocity: number): void;
52
+ /**
53
+ * Check if animation is currently running
54
+ */
55
+ abstract getIsAnimating(): boolean;
56
+ }
57
+ //# sourceMappingURL=animation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../src/lib/animator/animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,8BAAsB,SAAS;IAC7B;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,IAAI,IAAI;IAEzB;;OAEG;IACH,QAAQ,CAAC,IAAI,IAAI,IAAI;IAErB;;;OAGG;IACH,QAAQ,CAAC,OAAO,IAAI,IAAI;IAExB;;OAEG;IACH,QAAQ,CAAC,eAAe,IAAI,cAAc;IAE1C;;;OAGG;IACH,QAAQ,CAAC,eAAe,IAAI,MAAM;IAElC;;;OAGG;IACH,QAAQ,CAAC,WAAW,IAAI,MAAM;IAE9B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAEtC;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAE5C;;OAEG;IACH,QAAQ,CAAC,cAAc,IAAI,OAAO;CACnC"}
@@ -1,47 +1,48 @@
1
- import { SpringConfig, AnimationController, AnimationState } from '../types';
2
- export interface AnimationOptions<TAnimationValue = number> {
3
- from: TAnimationValue;
4
- to: TAnimationValue;
5
- spring: SpringConfig;
6
- onUpdate: (value: TAnimationValue) => void;
7
- onComplete: () => void;
1
+ import { StyleObject } from './animate/types';
2
+ import { SpringConfig, AnimationState } from '../types';
3
+ import { Animation } from './animation';
4
+ export type { StyleObject };
5
+ export interface AnimatorOptions {
6
+ from?: number;
7
+ to?: number;
8
+ spring?: SpringConfig;
9
+ tick?: (progress: number) => void;
10
+ css?: {
11
+ element: HTMLElement;
12
+ style: (progress: number) => StyleObject;
13
+ };
14
+ onComplete?: () => void;
8
15
  onStart?: () => void;
9
16
  }
10
17
  /**
11
- * New Animator implementation using Popmotion
12
- * Provides spring-based animations with fine control
13
- * Supports both number and object animations
18
+ * Animator - Spring-based Animation Controller for single spring
14
19
  *
15
- * @template TAnimationValue - The type of value being animated (number | object)
20
+ * Internally selects appropriate runner based on tick or css option
21
+ * - tick: RAF-based real-time animation
22
+ * - css: Web Animation API based (GPU accelerated, velocity tracking via simulation data)
16
23
  */
17
- export declare class Animator<TAnimationValue = number> implements AnimationController<TAnimationValue> {
24
+ export declare class Animator extends Animation {
18
25
  private options;
19
- private currentValue;
20
- private velocity;
21
- private isAnimating;
22
26
  private controls;
23
- private animationMap;
24
- private activeAnimations;
25
- private completedAnimations;
26
- private updatedProperties;
27
- constructor(options: Partial<AnimationOptions<TAnimationValue>>);
28
- private animate;
29
- private animateObject;
27
+ private isAnimating;
28
+ private currentValue;
29
+ private currentVelocity;
30
+ constructor(options: AnimatorOptions);
31
+ private runAnimation;
30
32
  forward(): void;
31
33
  backward(): void;
32
34
  reverse(): void;
33
- private shouldReverse;
34
35
  stop(): void;
35
- getVelocity(): TAnimationValue extends number ? number : Record<string, number>;
36
- getCurrentValue(): TAnimationValue;
36
+ getVelocity(): number;
37
+ getCurrentValue(): number;
37
38
  getIsAnimating(): boolean;
38
- getCurrentState(): AnimationState<TAnimationValue>;
39
- setVelocity(velocity: TAnimationValue extends number ? number : Record<string, number>): void;
40
- setValue(value: TAnimationValue): void;
41
- updateOptions(newOptions: Partial<AnimationOptions<TAnimationValue>>): void;
42
- static fromState<TAnimationValue = number>(state: {
43
- position: TAnimationValue;
44
- velocity: TAnimationValue extends number ? number : Record<string, number>;
45
- }, newOptions: Partial<AnimationOptions<TAnimationValue>>): Animator<TAnimationValue>;
39
+ getCurrentState(): AnimationState;
40
+ setValue(value: number): void;
41
+ setVelocity(velocity: number): void;
42
+ updateOptions(newOptions: Partial<AnimatorOptions>): void;
43
+ static fromState(state: {
44
+ position: number;
45
+ velocity: number;
46
+ }, options: AnimatorOptions): Animator;
46
47
  }
47
48
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/animator/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACf,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,gBAAgB,CAAC,eAAe,GAAG,MAAM;IACxD,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,EAAE,eAAe,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC3C,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,QAAQ,CAAC,eAAe,GAAG,MAAM,CAC5C,YAAW,mBAAmB,CAAC,eAAe,CAAC;IAE/C,OAAO,CAAC,OAAO,CAAoC;IACnD,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,QAAQ,CAEW;IAC3B,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,QAAQ,CAAqC;IAGrD,OAAO,CAAC,YAAY,CAAkD;IACtE,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,iBAAiB,CAAqB;gBAElC,OAAO,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC;IA2B/D,OAAO,CAAC,OAAO,CA+Fb;IAEF,OAAO,CAAC,aAAa,CAoHnB;IAGF,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;IAKhB,OAAO,IAAI,IAAI;IAcf,OAAO,CAAC,aAAa;IAYrB,IAAI,IAAI,IAAI;IAyBZ,WAAW,IAAI,eAAe,SAAS,MAAM,GACzC,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAI1B,eAAe,IAAI,eAAe;IAIlC,cAAc,IAAI,OAAO;IAIzB,eAAe,IAAI,cAAc,CAAC,eAAe,CAAC;IAWlD,WAAW,CACT,QAAQ,EAAE,eAAe,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACzE,IAAI;IAIP,QAAQ,CAAC,KAAK,EAAE,eAAe,GAAG,IAAI;IAKtC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GAAG,IAAI;IAY3E,MAAM,CAAC,SAAS,CAAC,eAAe,GAAG,MAAM,EACvC,KAAK,EAAE;QACL,QAAQ,EAAE,eAAe,CAAC;QAC1B,QAAQ,EAAE,eAAe,SAAS,MAAM,GACpC,MAAM,GACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC5B,EACD,UAAU,EAAE,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACrD,QAAQ,CAAC,eAAe,CAAC;CAM7B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/animator/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,GAAG,CAAC,EAAE;QACJ,OAAO,EAAE,WAAW,CAAC;QACrB,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,WAAW,CAAC;KAC1C,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED;;;;;;GAMG;AACH,qBAAa,QAAS,SAAQ,SAAS;IACrC,OAAO,CAAC,OAAO,CAWb;IACF,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAAa;gBAExB,OAAO,EAAE,eAAe;IAmBpC,OAAO,CAAC,YAAY;IAqBpB,OAAO,IAAI,IAAI;IAKf,QAAQ,IAAI,IAAI;IAKhB,OAAO,IAAI,IAAI;IAWf,IAAI,IAAI,IAAI;IAWZ,WAAW,IAAI,MAAM;IAIrB,eAAe,IAAI,MAAM;IAIzB,cAAc,IAAI,OAAO;IAIzB,eAAe,IAAI,cAAc;IASjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAInC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAIzD,MAAM,CAAC,SAAS,CACd,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAC7C,OAAO,EAAE,eAAe,GACvB,QAAQ;CAMZ"}
@@ -0,0 +1,98 @@
1
+ import { Animation } from './animation';
2
+ import { NormalizedMultiSpringConfig, AnimationState } from '../types';
3
+ export interface MultiAnimatorOptions {
4
+ config: NormalizedMultiSpringConfig;
5
+ from: number;
6
+ to: number;
7
+ element?: HTMLElement;
8
+ }
9
+ /**
10
+ * MultiAnimator - Coordinates multiple spring animations
11
+ *
12
+ * Extends Animation base class to provide unified interface.
13
+ * Manages the lifecycle and timing of multiple spring animations.
14
+ *
15
+ * All scheduling is progress-based using normalizedOffset (0-1):
16
+ * - offset 0: Start immediately with previous spring
17
+ * - offset 1: Start after previous spring completes
18
+ * - offset 0-1: Start when previous spring reaches this progress
19
+ *
20
+ * Config must be pre-normalized using normalizeMultiSpringSchedule()
21
+ */
22
+ export declare class MultiAnimator extends Animation {
23
+ private config;
24
+ private animators;
25
+ private springOrder;
26
+ private completedCount;
27
+ private completedAnimators;
28
+ private direction;
29
+ private idCounter;
30
+ private rafId;
31
+ private element?;
32
+ private from;
33
+ private to;
34
+ constructor(options: MultiAnimatorOptions);
35
+ private generateId;
36
+ private initializeAnimators;
37
+ /**
38
+ * Calculate progress of an animator (0-1)
39
+ * Progress = |position - from| / |to - from|
40
+ */
41
+ private getAnimatorProgress;
42
+ /**
43
+ * Get order of springs based on direction
44
+ * Forward: 0, 1, 2, ...
45
+ * Backward: n-1, n-2, ..., 0
46
+ */
47
+ private getOrderedIds;
48
+ private onAnimatorComplete;
49
+ /**
50
+ * Check and start springs based on previous spring's progress
51
+ * Called on each frame while animation is running
52
+ */
53
+ private checkAndStartSprings;
54
+ private startAnimator;
55
+ /**
56
+ * Start the scheduler loop that checks spring progress
57
+ */
58
+ private startScheduler;
59
+ private stopScheduler;
60
+ private getFirstAnimator;
61
+ forward(): void;
62
+ backward(): void;
63
+ private resetStartedFlags;
64
+ stop(): void;
65
+ reverse(): void;
66
+ getCurrentState(): AnimationState;
67
+ /**
68
+ * Get current position value from first animator
69
+ */
70
+ getCurrentValue(): number;
71
+ /**
72
+ * Get current velocity from first animator
73
+ */
74
+ getVelocity(): number;
75
+ /**
76
+ * Set position value on first animator
77
+ * TODO: Support per-spring control
78
+ */
79
+ setValue(value: number): void;
80
+ /**
81
+ * Set velocity on first animator
82
+ * TODO: Support per-spring control
83
+ */
84
+ setVelocity(velocity: number): void;
85
+ /**
86
+ * Check if any animation is currently running
87
+ */
88
+ getIsAnimating(): boolean;
89
+ /**
90
+ * Create MultiAnimator from existing state
91
+ * Uses first animator's state for initialization
92
+ */
93
+ static fromState(state: {
94
+ position: number;
95
+ velocity: number;
96
+ }, options: MultiAnimatorOptions): MultiAnimator;
97
+ }
98
+ //# sourceMappingURL=multi-animator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-animator.d.ts","sourceRoot":"","sources":["../../src/lib/animator/multi-animator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EACV,2BAA2B,EAE3B,cAAc,EACf,MAAM,UAAU,CAAC;AAiBlB,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,2BAA2B,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAC1C,OAAO,CAAC,MAAM,CAA8B;IAC5C,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,cAAc,CAAK;IAC3B,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,SAAS,CAAqC;IACtD,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,EAAE,CAAS;gBAEP,OAAO,EAAE,oBAAoB;IASzC,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,mBAAmB;IA0B3B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAO3B;;;;OAIG;IACH,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,kBAAkB;IAiB1B;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA6B5B,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,gBAAgB;IAMxB,OAAO,IAAI,IAAI;IAYf,QAAQ,IAAI,IAAI;IAYhB,OAAO,CAAC,iBAAiB;IAMzB,IAAI,IAAI,IAAI;IAQZ,OAAO,IAAI,IAAI;IAsCf,eAAe,IAAI,cAAc;IAgBjC;;OAEG;IACH,eAAe,IAAI,MAAM;IAKzB;;OAEG;IACH,WAAW,IAAI,MAAM;IAKrB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK7B;;;OAGG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAKnC;;OAEG;IACH,cAAc,IAAI,OAAO;IASzB;;;OAGG;IACH,MAAM,CAAC,SAAS,CACd,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAC7C,OAAO,EAAE,oBAAoB,GAC5B,aAAa;CAMjB"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Spring Core
3
+ *
4
+ * Core module containing spring physics calculation logic
5
+ * Used by both tick-runner (RAF based) and css-runner (synchronous simulation)
6
+ *
7
+ * Uses optimized Semi-implicit Euler method (Allen Chou's approach)
8
+ */
9
+ export interface SpringConfig {
10
+ stiffness: number;
11
+ damping: number;
12
+ }
13
+ export interface SpringState {
14
+ position: number;
15
+ velocity: number;
16
+ }
17
+ export interface SpringConstants {
18
+ omega: number;
19
+ zeta: number;
20
+ }
21
+ /**
22
+ * Pre-compute spring constants (performance optimization)
23
+ *
24
+ * @param config Spring configuration
25
+ * @returns omega (angular frequency), zeta (damping ratio)
26
+ */
27
+ export declare function computeSpringConstants(config: SpringConfig): SpringConstants;
28
+ /**
29
+ * Calculate one spring step (Semi-implicit Euler)
30
+ *
31
+ * Uses optimized formula with omega and zeta instead of F = -k(x-xt) - d*v:
32
+ * - v += -2*h*zeta*omega*v + h*omega^2*(target - x)
33
+ * - x += h*v
34
+ *
35
+ * @param state Current state (position, velocity)
36
+ * @param target Target position
37
+ * @param constants Pre-computed spring constants (omega, zeta)
38
+ * @param dt Delta time (seconds)
39
+ * @returns New state
40
+ */
41
+ export declare function stepSpring(state: SpringState, target: number, constants: SpringConstants, dt: number): SpringState;
42
+ export declare const POSITION_THRESHOLD = 0.01;
43
+ export declare const VELOCITY_THRESHOLD = 0.01;
44
+ export declare const SETTLE_THRESHOLD = 0.05;
45
+ /**
46
+ * Check if spring has converged to target
47
+ */
48
+ export declare function isSettled(state: SpringState, target: number): boolean;
49
+ /**
50
+ * Full spring simulation (synchronous)
51
+ * Used for Web Animation API keyframe generation
52
+ *
53
+ * @param config Spring configuration
54
+ * @param from Start value
55
+ * @param to Target value
56
+ * @param initialVelocity Initial velocity
57
+ * @returns Frame-by-frame progress array and duration
58
+ */
59
+ export declare function simulateSpring(config: SpringConfig, from: number, to: number, initialVelocity?: number): {
60
+ frames: number[];
61
+ duration: number;
62
+ };
63
+ //# sourceMappingURL=spring-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spring-core.d.ts","sourceRoot":"","sources":["../../src/lib/animator/spring-core.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAO5E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,WAAW,EAClB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,eAAe,EAC1B,EAAE,EAAE,MAAM,GACT,WAAW,CAiBb;AAGD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,kBAAkB,OAAO,CAAC;AACvC,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,YAAY,EACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,eAAe,SAAI,GAClB;IAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAoCxC"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var H=Object.defineProperty;var N=(n,t,e)=>t in n?H(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var m=(n,t,e)=>N(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const M=require("./types.cjs"),Y=require("./jaemin-BG8HRXG1.cjs");class W{constructor(){m(this,"listeners",new Set);m(this,"rafId",null);m(this,"isRunning",!1);m(this,"startTime",Date.now());m(this,"lastUpdate",this.startTime);m(this,"elapsed",0);m(this,"lagThreshold",500);m(this,"adjustedLag",33);m(this,"maxDeltaTime",33);m(this,"gap",1e3/240);m(this,"nextTime",this.gap);m(this,"tick",()=>{const t=Date.now();let i=t-this.lastUpdate;i>this.lagThreshold||i<0?(this.startTime+=i-this.adjustedLag,i=this.adjustedLag):i>this.maxDeltaTime&&(i=this.maxDeltaTime),this.lastUpdate=t;const r=t-this.startTime,o=r-this.nextTime;if(o>0){const s=i/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(d=>{d(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(t){return this.listeners.add(t),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(t)}}unsubscribe(t){this.listeners.delete(t),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(t,e){this.lagThreshold=t,this.adjustedLag=Math.min(e,t)}fps(t){this.gap=1e3/t,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const x=new W;function k(n){const{from:t,to:e,stiffness:i,damping:r,mass:o,velocity:s=0,onUpdate:d,onComplete:l}=n;let h=t,u=s,a=!0;const p=Math.sqrt(i/o),c=r/(2*Math.sqrt(i*o)),g=.01,w=.01;let f=0;const y=.05,S=T=>{if(!a)return;const A=Math.min(T,.033),v=-2*A*c*p*u,b=A*p*p*(e-h);u+=v+b,h+=A*u;const E=Math.abs(e-h),C=Math.abs(u);if(E<g&&C<w){if(f+=A,f>=y){h=e,u=0,a=!1,d(h),x.unsubscribe(S),l();return}}else f=0;d(h)};return x.subscribe(S),{stop:()=>{a&&(a=!1,x.unsubscribe(S))}}}class O{constructor(t){m(this,"options");m(this,"currentValue");m(this,"velocity");m(this,"isAnimating",!1);m(this,"controls",null);m(this,"animationMap",null);m(this,"activeAnimations",new Set);m(this,"completedAnimations",new Set);m(this,"updatedProperties",new Set);m(this,"animate",(t=!1)=>{!this.isAnimating&&this.options.onStart&&this.options.onStart(),this.isAnimating=!0;const e=t?this.options.from:this.options.to;if(typeof this.currentValue=="object"&&this.currentValue!==null){this.animateObject(e);return}let i=this.currentValue,r=performance.now();const o={from:this.currentValue,to:e,stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="number"&&(o.velocity=this.velocity*1e3),this.controls=k({...o,onUpdate:s=>{const d=performance.now(),l=(d-r)/1e3;if(l>0){if(typeof s=="number"&&typeof i=="number"){const h=(s-i)/l;this.velocity=h/1e3}else if(typeof s=="object"&&s!==null){const h={};Object.keys(s).forEach(u=>{const a=s[u],p=i[u];if(typeof a=="number"&&typeof p=="number"){const c=(a-p)/l;h[u]=c/1e3}}),this.velocity=h}i=s,r=d}this.currentValue=s,this.options.onUpdate(s)},onComplete:()=>{this.currentValue=e,this.isAnimating=!1,this.controls=null,typeof this.velocity=="object"&&this.velocity!==null?Object.keys(this.velocity).forEach(s=>{this.velocity[s]=0}):this.velocity=0,this.options.onComplete()}})});m(this,"animateObject",t=>{const e=this.currentValue,i=Object.keys(e);this.animationMap=new Map,this.activeAnimations.clear(),this.completedAnimations.clear(),this.updatedProperties.clear();const r={...e},o={};let s=!1;const d=()=>{const l=i.filter(u=>!this.completedAnimations.has(u));if(l.every(u=>this.updatedProperties.has(u))&&l.length>0){if(typeof this.velocity=="object"&&this.velocity){const u=performance.now();Object.keys(r).forEach(a=>{if(o[a]){const p=(u-o[a])/1e3,c=this.currentValue[a],g=r[a];typeof c=="number"&&typeof g=="number"&&p>0&&(this.velocity[a]=(g-c)/p/1e3)}o[a]=u})}this.currentValue={...r},this.options.onUpdate(this.currentValue),this.updatedProperties.clear(),!s&&this.options.onStart&&(s=!0,this.options.onStart())}};i.forEach(l=>{this.activeAnimations.add(l);const h={from:e[l],to:t[l],stiffness:this.options.spring.stiffness,damping:this.options.spring.damping,mass:1};typeof this.velocity=="object"&&this.velocity&&l in this.velocity&&(h.velocity=this.velocity[l]*1e3);const u=k({...h,onUpdate:a=>{r[l]=a,this.updatedProperties.add(l),d()},onComplete:()=>{this.completedAnimations.add(l),this.updatedProperties.delete(l),this.completedAnimations.size===i.length&&(this.currentValue=t,this.isAnimating=!1,this.animationMap=null,typeof this.velocity=="object"&&this.velocity&&Object.keys(this.velocity).forEach(a=>{this.velocity[a]=0}),this.options.onComplete())}});this.animationMap.set(l,u)})});if(this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:100,damping:10},onUpdate:t.onUpdate??(()=>{}),onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from,typeof this.options.from=="object"&&this.options.from!==null){const e={};Object.keys(this.options.from).forEach(i=>{e[i]=0}),this.velocity=e}else this.velocity=0}forward(){this.stop(),this.animate(!1)}backward(){this.stop(),this.animate(!0)}reverse(){const t=this.options.from;if(this.options.from=this.options.to,this.options.to=t,this.isAnimating){const e=this.shouldReverse();this.stop(),this.animate(!e)}}shouldReverse(){return typeof this.currentValue=="number"&&typeof this.options.from=="number"&&typeof this.options.to=="number"?this.currentValue>(this.options.from+this.options.to)/2:!1}stop(){this.isAnimating=!1,this.controls&&(this.controls.stop(),this.controls=null),this.animationMap&&(this.animationMap.forEach(t=>{t.stop()}),this.animationMap.clear(),this.animationMap=null),this.updatedProperties.clear()}getVelocity(){return this.velocity}getCurrentValue(){return this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{type:"single",position:this.currentValue,velocity:this.velocity,from:this.options.from,to:this.options.to}}setVelocity(t){this.velocity=t}setValue(t){this.currentValue=t}updateOptions(t){if(this.options={...this.options,...t},this.isAnimating&&this.controls){const e=this.shouldReverse();this.stop(),this.animate(!e)}}static fromState(t,e){const i=new O(e);return i.setValue(t.position),i.setVelocity(t.velocity),i}}class D{constructor(t){m(this,"config");m(this,"animators",new Map);m(this,"springOrder",[]);m(this,"completedCount",0);m(this,"completedAnimators",new Set);m(this,"direction","forward");m(this,"idCounter",0);m(this,"timeoutIds",[]);this.config=t,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const e=this.generateId(),i=new O({from:t.from,to:t.to,spring:t.spring,onUpdate:t.tick,onComplete:()=>this.onAnimatorComplete(e),onStart:t.onStart});this.animators.set(e,{id:e,item:t,animator:i,startTime:null}),this.springOrder.push(e)})}normalizeSchedule(t){const e=this.config.schedule??"overlap";return this.springOrder.map((i,r)=>{const o=this.animators.get(i);if(!o)throw new Error(`AnimationScheduler: animator with id "${i}" not found during normalization`);if(e==="overlap")return{type:"offset",id:i,delay:0};if(e==="wait")return t==="forward"&&r===0?{type:"offset",id:i,delay:0}:t==="backward"&&r===this.springOrder.length-1?{type:"offset",id:i,delay:0}:{type:"wait",id:i};const s=o.item.offset??0;if(t==="forward")return{type:"offset",id:i,delay:s};const d=this.animators.size===0?0:Math.max(...Array.from(this.animators.values()).map(l=>l.item.offset??0));return{type:"offset",id:i,delay:d-s}})}onAnimatorComplete(t){var i,r,o,s,d,l;const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on completion`);return}this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(r=(i=e.item).onComplete)==null||r.call(i),(s=(o=this.config).onProgress)==null||s.call(o,this.completedCount,this.config.springs.length),this.handleWaitModeChaining(t),this.completedCount===this.config.springs.length&&((l=(d=this.config).onEnd)==null||l.call(d)))}handleWaitModeChaining(t){if(this.config.schedule!=="wait")return;const e=this.springOrder.indexOf(t);if(this.direction==="forward"){const o=this.springOrder[e+1];if(!o)return;const s=this.animators.get(o);s&&s.startTime===null&&this.startAnimator(o);return}const i=this.springOrder[e-1];if(!i)return;const r=this.animators.get(i);r&&r.startTime===null&&this.startBackwardAnimator(i)}startAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.forward()}startBackwardAnimator(t){const e=this.animators.get(t);if(!e){console.warn(`AnimationScheduler: animator with id "${t}" not found on backward start`);return}if(e.startTime!==null){console.warn(`AnimationScheduler: animator with id "${t}" already started`);return}e.startTime=Date.now(),e.animator.backward()}forward(){var e,i;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("forward").forEach(r=>{if(r.type==="wait")return;if(r.delay===0){this.startAnimator(r.id);return}const o=window.setTimeout(()=>this.startAnimator(r.id),r.delay);this.timeoutIds.push(o)})}backward(){var e,i;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),(i=(e=this.config).onStart)==null||i.call(e),this.normalizeSchedule("backward").forEach(r=>{if(r.type==="wait")return;if(r.delay===0){this.startBackwardAnimator(r.id);return}const o=window.setTimeout(()=>this.startBackwardAnimator(r.id),r.delay);this.timeoutIds.push(o)})}stop(){this.timeoutIds.forEach(t=>clearTimeout(t)),this.timeoutIds=[],this.animators.forEach(t=>{t.animator.stop(),t.startTime=null})}reverse(t){((t==null?void 0:t.offsetMode)??"immediate")!=="immediate"&&console.warn('AnimationScheduler.reverse(): Only "immediate" offsetMode is currently supported. Falling back to "immediate".'),this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(i=>{if(i.startTime===null)return;const r=i.animator.getCurrentState();if(r.type!=="single")return;if(r.position===r.to){const s=O.fromState({position:1,velocity:0},{from:i.item.to??1,to:i.item.from??0,spring:i.item.spring,onUpdate:i.item.tick,onComplete:()=>this.onAnimatorComplete(i.id),onStart:i.item.onStart});s.forward(),i.animator=s;return}i.animator.reverse()})}getCurrentState(){return{type:"multi",completed:this.completedCount,total:this.config.springs.length,direction:this.direction}}}const j=Symbol.for("TRANSITION_STRATEGY"),z=n=>({runIn:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="out"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if(t.out){const d=await t.out,{from:l=1,to:h=0}=d;return{config:d,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.in;if(!i)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in i)return{config:i,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:r=0,to:o=1}=i;return{config:i,state:{position:r,velocity:0},from:r,to:o,direction:"forward"}},runOut:async t=>{const{currentAnimation:e}=n;if(e&&e.direction==="in"){const s=e.controller.getCurrentState();if(e.controller.stop(),s.type==="multi")return e.controller.reverse(),{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if(t.in){const d=await t.in,{from:l=0,to:h=1}=d;return{config:d,state:{position:s.position,velocity:s.velocity},from:l,to:h,direction:"backward"}}}const i=await t.out;if(!i)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in i)return{config:i,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:r=1,to:o=0}=i;return{config:i,state:{position:r,velocity:0},from:r,to:o,direction:"forward"}}}),_=()=>({runIn:async n=>{const t=await n.in;if(!t)return{state:{position:0,velocity:0},from:0,to:1,direction:"forward"};if("springs"in t)return{config:t,state:{position:0,velocity:0},from:0,to:1,direction:"forward"};const{from:e=0,to:i=1}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}},runOut:async n=>{const t=await n.out;if(!t)return{state:{position:1,velocity:0},from:1,to:0,direction:"forward"};if("springs"in t)return{config:t,state:{position:1,velocity:0},from:1,to:0,direction:"forward"};const{from:e=1,to:i=0}=t;return{config:t,state:{position:e,velocity:0},from:e,to:i,direction:"forward"}}});function X(n,t){var u;let e=null,i=null,r=null,o=null;const s={get currentAnimation(){return e}},d=((u=t==null?void 0:t.strategy)==null?void 0:u.call(t,s))||z(s),l=async a=>{var S,T,A;i&&(i.remove(),i=null);const p=n(),c=p.in&&await p.in(a),g=!(t!=null&&t.strategy)&&p.out?p.out(a):void 0;if(!c)return;if(M.isMultiSpring(c)){const v={in:Promise.resolve(c),out:g&&Promise.resolve(g)};if(!(await d.runIn(v)).config){e&&(e.direction="in");return}(S=c.prepare)==null||S.call(c,a),c.wait&&await c.wait();const E=new D({...c,onEnd:()=>{var C;e=null,(C=c.onEnd)==null||C.call(c)}});e={controller:E,direction:"in"},E.forward();return}const w={in:Promise.resolve(c),out:g&&Promise.resolve(g)},f=await d.runIn(w);if(!f.config)return;if("springs"in f.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(A=(T=f.config).prepare)==null||A.call(T,a),f.config.wait&&await f.config.wait();const y=O.fromState(f.state,{from:f.from,to:f.to,spring:f.config.spring,onStart:f.config.onStart,onUpdate:f.config.tick,onComplete:()=>{var v,b;e=null,(b=(v=f.config)==null?void 0:v.onEnd)==null||b.call(v)}});e={controller:y,direction:"in"},f.direction==="forward"?y.forward():y.backward()},h=async a=>{var S,T,A;i=a;const p=n(),c=p.out&&await p.out(a);if(!c)return;if(M.isMultiSpring(c)){const v={in:void 0,out:Promise.resolve(c)};if(!(await d.runOut(v)).config){e&&(e.direction="out"),i&&(i.remove(),i=null);return}(S=c.prepare)==null||S.call(c,a),y(),c.wait&&await c.wait();const E=new D({...c,onEnd:()=>{var C,I;(C=c.onEnd)==null||C.call(c),i&&(i.remove(),i=null),e=null,(I=t==null?void 0:t.onCleanupEnd)==null||I.call(t)}});e={controller:E,direction:"out"},E.forward();return}const g={in:void 0,out:Promise.resolve(c)},w=await d.runOut(g);if(!w.config)return;if("springs"in w.config){console.error("Unexpected MultiSpringConfig in single-spring path");return}(A=(T=w.config).prepare)==null||A.call(T,a),y(),w.config.wait&&await w.config.wait();const f=O.fromState(w.state,{from:w.from,to:w.to,spring:w.config.spring,onStart:w.config.onStart,onUpdate:w.config.tick,onComplete:()=>{var v,b,E;(b=(v=w.config)==null?void 0:v.onEnd)==null||b.call(v),i&&(i.remove(),i=null),e=null,(E=t==null?void 0:t.onCleanupEnd)==null||E.call(t)}});e={controller:f,direction:"out"},w.direction==="forward"?f.forward():f.backward();function y(){!r||!i||(o&&r.contains(o)?r.insertBefore(i,o):r.appendChild(i))}};return a=>{if(a)return r=a.parentElement,o=a.nextElementSibling,l(a),()=>{if(a.isConnected){const p=a.cloneNode(!0);h(p)}else h(a)}}}const q=3,K=n=>{if(!n)return null;const t=n.split(`
2
- `).map(e=>e.trim());for(let e=q;e<Math.min(t.length,6);e++){const i=t[e],r=i==null?void 0:i.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!r)continue;const o=r[1]??"",s=r[2]??"0",d=r[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:s,column:d}}return null},R=new Map,V=new Map;function B(n,t,e){R.set(n,t);let i=V.get(n);return i||(i=X(()=>{const r=R.get(n);return r||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:e,onCleanupEnd:()=>F(n)}),V.set(n,i),i)}function F(n){R.delete(n),V.delete(n)}function $(){const n=K(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const L=globalThis.FinalizationRegistry,U=L?new L(n=>{try{F(n)}catch{}}):void 0;function G(n){const t=n.key??$();if(n.ref&&U)try{U.register(n.ref,t)}catch{}return B(t,{in:n.in,out:n.out},n[j])}function J(n){const t=n.filter(e=>e.symmetric).map(e=>({from:e.to,to:e.from,transition:e.transition}));return[...n,...t]}function Q(n){let t=!1,e=0,i=0,r=!1;const o=50,s=50,d=c=>{if(!n)return;const g=c.touches[0];g&&(r=g.clientX<s,r&&(e=g.clientX,i=g.clientY))},l=c=>{if(!n||!r||t)return;const g=c.touches[0];if(!g)return;const w=g.clientX-e,f=g.clientY-i;w>o&&Math.abs(w)>Math.abs(f)&&(t=!0,setTimeout(()=>{t=!1},500))},h=()=>{n&&(r=!1,e=0,i=0)};return{initialize:()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",d,{passive:!0}),window.addEventListener("touchmove",l,{passive:!0}),window.addEventListener("touchend",h,{passive:!0}))},cleanup:()=>{typeof window>"u"||(window.removeEventListener("touchstart",d),window.removeEventListener("touchmove",l),window.removeEventListener("touchend",h))},isSwipePending:()=>t}}const Z=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t),i=e.overflow+e.overflowY+e.overflowX;if(i.includes("auto")||i.includes("scroll")||t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)return t;t=t.parentElement}return document.documentElement},tt=n=>{let t=n.parentElement;for(;t&&t!==document.body;){const e=window.getComputedStyle(t).position;if(e==="relative"||e==="absolute"||e==="fixed"||e==="sticky")return t;t=t.parentElement}return document.body};function et(){let n=null,t=null;const e=new Map;let i=null;const r=()=>{n&&i&&e.set(i,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(u,a)=>{t=u,n||(n=Z(u),(n===document.documentElement?window:n).addEventListener("scroll",r,{passive:!0})),i=a},calculateScrollOffset:(u,a)=>{const p=u&&e.has(u)?e.get(u):{x:0,y:0},c=a&&e.has(a)?e.get(a):{x:0,y:0};return{x:-c.x+p.x,y:-c.y+p.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>t?tt(t):document.body,getScrollPosition:u=>u&&e.has(u)?e.get(u):{x:0,y:0}}}function P(n,t){if(t==="*")return!0;if(t.endsWith("/*")){const e=t.slice(0,-2);return n===e||n.startsWith(e+"/")}return n===t}function it(n,t,e){for(const i of e)if(P(n,i.from)&&P(t,i.to))return i.transition;for(const i of e)if((i.from==="*"||P(n,i.from))&&(i.to==="*"||P(t,i.to)))return i.transition;return null}function nt(n){const{transitions:t=[],defaultTransition:e,middleware:i=(f,y)=>({from:f,to:y}),skipOnIosSwipe:r=!0}=n;let o=null;const s=J(t),{initializeContext:d,calculateScrollOffset:l,getScrollContainer:h,getPositionedParentElement:u,getScrollPosition:a}=et(),p=Q(r);p.initialize();function c(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:f,to:y}=i(o.from,o.to),T=it(f,y,s)||e,A=l(o.from,o.to),v={scrollOffset:A,scroll:a(o.from),get scrollingElement(){return h()||document.documentElement},get positionedParent(){return u()}},b={scrollOffset:A,get scroll(){return o?a(o.to):{x:0,y:0}},get scrollingElement(){return h()||document.documentElement},get positionedParent(){return u()}};T&&(T.out&&o.outResolve&&o.outResolve(E=>T.out(E,v)),T.in&&o.inResolve&&o.inResolve(E=>T.in(E,b))),o=null}}const g=async(f,y)=>p.isSwipePending()?()=>({}):y==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),y==="out"?(o.from=f,new Promise(S=>{o.outResolve=S,c()})):(o.to=f,new Promise(S=>{o.inResolve=S,c()})));return f=>({key:f,in:async y=>(d(y,f),(await g(f,"in"))(y)),out:async y=>(await g(f,"out"))(y),[j]:_})}exports.isMultiSpring=M.isMultiSpring;exports.isSingleSpring=M.isSingleSpring;exports.jaeminInternal=Y.jaeminInternal;exports.TRANSITION_STRATEGY=j;exports.createDefaultStrategy=z;exports.createPageTransitionStrategy=_;exports.createSggoiTransitionContext=nt;exports.generateAutoKey=$;exports.transition=G;
1
+ "use strict";var K=Object.defineProperty;var W=(n,i,t)=>i in n?K(n,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[i]=t;var d=(n,i,t)=>W(n,typeof i!="symbol"?i+"":i,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./types.cjs"),U=require("./jaemin-BG8HRXG1.cjs");class G{constructor(){d(this,"listeners",new Set);d(this,"rafId",null);d(this,"isRunning",!1);d(this,"startTime",Date.now());d(this,"lastUpdate",this.startTime);d(this,"elapsed",0);d(this,"lagThreshold",500);d(this,"adjustedLag",33);d(this,"maxDeltaTime",33);d(this,"gap",1e3/240);d(this,"nextTime",this.gap);d(this,"tick",()=>{const i=Date.now();let e=i-this.lastUpdate;e>this.lagThreshold||e<0?(this.startTime+=e-this.adjustedLag,e=this.adjustedLag):e>this.maxDeltaTime&&(e=this.maxDeltaTime),this.lastUpdate=i;const r=i-this.startTime,o=r-this.nextTime;if(o>0){const s=e/1e3;this.elapsed=r/1e3,this.nextTime+=o+(o>=this.gap?4:this.gap-o),this.listeners.forEach(c=>{c(s,this.elapsed)})}this.listeners.size>0?this.rafId=requestAnimationFrame(this.tick):(this.isRunning=!1,this.rafId=null)})}subscribe(i){return this.listeners.add(i),this.isRunning||(this.isRunning=!0,this.rafId=requestAnimationFrame(this.tick)),()=>{this.unsubscribe(i)}}unsubscribe(i){this.listeners.delete(i),this.listeners.size===0&&this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.isRunning=!1,this.rafId=null)}lagSmoothing(i,t){this.lagThreshold=i,this.adjustedLag=Math.min(t,i)}fps(i){this.gap=1e3/i,this.nextTime=this.elapsed*1e3+this.gap}getListenerCount(){return this.listeners.size}getElapsed(){return this.elapsed}}const P=new G;function L(n){const i=n.stiffness,t=n.damping,e=1,r=Math.sqrt(i/e),o=t/(2*Math.sqrt(i*e));return{omega:r,zeta:o}}function _(n,i,t,e){const{omega:r,zeta:o}=t,{position:s,velocity:c}=n,a=Math.min(e,.033),u=-2*a*o*r*c,h=a*r*r*(i-s),l=c+u+h;return{position:s+a*l,velocity:l}}const B=.01,J=.01,N=.05;function H(n,i){const t=Math.abs(i-n.position),e=Math.abs(n.velocity);return t<B&&e<J}function Q(n){const{from:i,to:t,spring:e,velocity:r=0,onUpdate:o,onComplete:s,onStart:c}=n;let a={position:i,velocity:r},u=!0,h=0,l=!1;const g=L(e),w=p=>{if(u){if(l||(l=!0,c==null||c()),a=_(a,t,g,p),H(a,t)){if(h+=Math.min(p,.033),h>=N){a={position:t,velocity:0},u=!1,o(a.position),P.unsubscribe(w),s();return}}else h=0;o(a.position)}};return P.subscribe(w),{stop:()=>{u&&(u=!1,P.unsubscribe(w))},getPosition:()=>a.position,getVelocity:()=>a.velocity,isRunning:()=>u}}const V=1e3/60;function Z(n,i,t,e=0){const r=L(t),o=600;let s={position:n,velocity:e},c=0;const a=[];for(let u=0;u<o;u++){const h=u*V;if(a.push({time:h,position:s.position,velocity:s.velocity}),s=_(s,i,r,V/1e3),H(s,i)){if(c+=V/1e3,c>=N){a.push({time:(u+1)*V,position:i,velocity:0});break}}else c=0}return a}function F(n,i){if(n.length===0)return{position:0,velocity:0};const t=n[0],e=n[n.length-1];if(i<=0)return{position:t.position,velocity:t.velocity};if(i>=e.time)return{position:e.position,velocity:e.velocity};let r=0,o=n.length-1;for(;r<o-1;){const u=Math.floor((r+o)/2);n[u].time<=i?r=u:o=u}const s=n[r],c=n[o],a=(i-s.time)/(c.time-s.time);return{position:s.position+(c.position-s.position)*a,velocity:s.velocity+(c.velocity-s.velocity)*a}}function tt(n,i){return n.map(t=>i(t.position))}function et(n){const{element:i,from:t,to:e,spring:r,velocity:o=0,style:s,onComplete:c,onStart:a}=n,u=Z(t,e,r,o);if(u.length===0)return a==null||a(),c(),{stop:()=>{},getPosition:()=>e,getVelocity:()=>0,isRunning:()=>!1};const h=tt(u,s),l=u[u.length-1],g=l.time,w=i.animate(h,{duration:g,fill:"forwards",easing:"linear"});let p=!0;const y=performance.now();return a==null||a(),w.onfinish=()=>{p&&(p=!1,c())},{stop:()=>{p&&(p=!1,w.cancel())},getPosition:()=>{if(!p)return l.position;const m=performance.now()-y;return F(u,m).position},getVelocity:()=>{if(!p)return 0;const m=performance.now()-y;return F(u,m).velocity},isRunning:()=>p}}function it(n){const{from:i,to:t,spring:e,velocity:r,onComplete:o,onStart:s,tick:c,css:a}=n;if(c&&a)throw new Error("Cannot use both 'tick' and 'css' options together");return!c&&!a?(s==null||s(),o(),{stop:()=>{},getPosition:()=>t,getVelocity:()=>0,isRunning:()=>!1}):a?et({element:a.element,from:i,to:t,spring:e,velocity:r,style:a.style,onComplete:o,onStart:s}):Q({from:i,to:t,spring:e,velocity:r,onUpdate:c,onComplete:o,onStart:s})}class q{}class k extends q{constructor(t){super();d(this,"options");d(this,"controls",null);d(this,"isAnimating",!1);d(this,"currentValue");d(this,"currentVelocity",0);if(t.tick&&t.css)throw new Error("Cannot use both 'tick' and 'css' options together");this.options={from:t.from??0,to:t.to??1,spring:t.spring??{stiffness:300,damping:30},tick:t.tick,css:t.css,onComplete:t.onComplete??(()=>{}),onStart:t.onStart},this.currentValue=this.options.from}runAnimation(t){this.isAnimating=!0,this.controls=it({from:this.currentValue,to:t,spring:this.options.spring,velocity:this.currentVelocity,tick:this.options.tick,css:this.options.css,onStart:this.options.onStart,onComplete:()=>{this.currentValue=t,this.currentVelocity=0,this.isAnimating=!1,this.controls=null,this.options.onComplete()}})}forward(){this.stop(),this.runAnimation(this.options.to)}backward(){this.stop(),this.runAnimation(this.options.from)}reverse(){const t=this.options.from;this.options.from=this.options.to,this.options.to=t,this.isAnimating&&(this.stop(),this.runAnimation(this.options.to))}stop(){this.controls&&(this.currentValue=this.controls.getPosition(),this.currentVelocity=this.controls.getVelocity(),this.controls.stop(),this.controls=null),this.isAnimating=!1}getVelocity(){var t;return((t=this.controls)==null?void 0:t.getVelocity())??this.currentVelocity}getCurrentValue(){var t;return((t=this.controls)==null?void 0:t.getPosition())??this.currentValue}getIsAnimating(){return this.isAnimating}getCurrentState(){return{position:this.getCurrentValue(),velocity:this.getVelocity(),from:this.options.from,to:this.options.to}}setValue(t){this.currentValue=t}setVelocity(t){this.currentVelocity=t}updateOptions(t){this.options={...this.options,...t}}static fromState(t,e){const r=new k(e);return r.setValue(t.position),r.setVelocity(t.velocity),r}}class M extends q{constructor(t){super();d(this,"config");d(this,"animators",new Map);d(this,"springOrder",[]);d(this,"completedCount",0);d(this,"completedAnimators",new Set);d(this,"direction","forward");d(this,"idCounter",0);d(this,"rafId",null);d(this,"element");d(this,"from");d(this,"to");this.config=t.config,this.from=t.from,this.to=t.to,this.element=t.element,this.initializeAnimators()}generateId(){return`spring_${this.idCounter++}`}initializeAnimators(){this.config.springs.forEach(t=>{const e=this.generateId(),r=new k({from:this.from,to:this.to,spring:t.spring,tick:t.tick,css:t.css&&this.element?{element:this.element,style:t.css}:void 0,onComplete:()=>this.onAnimatorComplete(e),onStart:t.onStart});this.animators.set(e,{id:e,item:t,animator:r,started:!1}),this.springOrder.push(e)})}getAnimatorProgress(t){const e=t.animator.getCurrentState(),r=Math.abs(e.to-e.from);return r===0?1:Math.abs(e.position-e.from)/r}getOrderedIds(){return this.direction==="forward"?this.springOrder:[...this.springOrder].reverse()}onAnimatorComplete(t){var r,o,s,c,a,u;const e=this.animators.get(t);!e||this.completedAnimators.has(t)||(this.completedAnimators.add(t),this.completedCount++,(o=(r=e.item).onComplete)==null||o.call(r),(c=(s=this.config).onProgress)==null||c.call(s,this.completedCount,this.config.springs.length),this.completedCount===this.config.springs.length&&(this.stopScheduler(),(u=(a=this.config).onEnd)==null||u.call(a)))}checkAndStartSprings(){const t=this.getOrderedIds();for(let e=0;e<t.length;e++){const r=t[e],o=this.animators.get(r);if(!o||o.started)continue;if(e===0){this.startAnimator(r);continue}const s=t[e-1],c=this.animators.get(s);if(!c||!c.started)continue;const a=this.getAnimatorProgress(c),u=o.item.normalizedOffset;a>=u&&this.startAnimator(r)}}startAnimator(t){const e=this.animators.get(t);!e||e.started||(e.started=!0,this.direction==="forward"?e.animator.forward():e.animator.backward())}startScheduler(){const t=()=>{this.checkAndStartSprings(),this.getIsAnimating()&&(this.rafId=requestAnimationFrame(t))};this.rafId=requestAnimationFrame(t)}stopScheduler(){this.rafId!==null&&(cancelAnimationFrame(this.rafId),this.rafId=null)}getFirstAnimator(){var e;const t=this.springOrder[0];return t?((e=this.animators.get(t))==null?void 0:e.animator)??null:null}forward(){var t,e;this.stop(),this.direction="forward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(e=(t=this.config).onStart)==null||e.call(t),this.startScheduler()}backward(){var t,e;this.stop(),this.direction="backward",this.completedCount=0,this.completedAnimators.clear(),this.resetStartedFlags(),(e=(t=this.config).onStart)==null||e.call(t),this.startScheduler()}resetStartedFlags(){this.animators.forEach(t=>{t.started=!1})}stop(){this.stopScheduler(),this.animators.forEach(t=>{t.animator.stop(),t.started=!1})}reverse(){this.direction=this.direction==="forward"?"backward":"forward",this.animators.forEach(t=>{if(!t.started)return;const e=t.animator.getCurrentState();if(e.position===e.to){const o=t.item.css&&this.element?{element:this.element,style:t.item.css}:void 0,s=k.fromState({position:this.to,velocity:0},{from:this.to,to:this.from,spring:t.item.spring,tick:t.item.tick,css:o,onComplete:()=>this.onAnimatorComplete(t.id),onStart:t.item.onStart});s.forward(),t.animator=s}else t.animator.reverse()})}getCurrentState(){const t=this.getFirstAnimator();return t?t.getCurrentState():{position:0,velocity:0,from:0,to:1}}getCurrentValue(){const t=this.getFirstAnimator();return(t==null?void 0:t.getCurrentValue())??0}getVelocity(){const t=this.getFirstAnimator();return(t==null?void 0:t.getVelocity())??0}setValue(t){const e=this.getFirstAnimator();e==null||e.setValue(t)}setVelocity(t){const e=this.getFirstAnimator();e==null||e.setVelocity(t)}getIsAnimating(){for(const t of this.animators.values())if(t.animator.getIsAnimating())return!0;return!1}static fromState(t,e){const r=new M(e);return r.setValue(t.position),r.setVelocity(t.velocity),r}}const O=Symbol.for("TRANSITION_STRATEGY"),Y=n=>({runIn:async i=>{const{currentAnimation:t}=n;if(t&&t.direction==="out"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),i.out)return{config:i.out,state:{position:r,velocity:o},from:1,to:0,direction:"backward"}}const e=i.in;return e?{config:e,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async i=>{const{currentAnimation:t}=n;if(t&&t.direction==="in"){const r=t.controller.getCurrentValue(),o=t.controller.getVelocity();if(t.controller.stop(),i.in)return{config:i.in,state:{position:r,velocity:o},from:0,to:1,direction:"backward"}}const e=i.out;return e?{config:e,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}}),j=()=>({runIn:async n=>{const i=n.in;return i?{config:i,state:{position:0,velocity:0},from:0,to:1,direction:"forward"}:{state:{position:0,velocity:0},from:0,to:1,direction:"forward"}},runOut:async n=>{const i=n.out;return i?{config:i,state:{position:1,velocity:0},from:1,to:0,direction:"forward"}:{state:{position:1,velocity:0},from:1,to:0,direction:"forward"}}});function nt(n,i){var h;let t=null,e=null,r=null,o=null;const s={get currentAnimation(){return t}},c=((h=i==null?void 0:i.strategy)==null?void 0:h.call(i,s))||Y(s),a=async l=>{var A;e&&(e.remove(),e=null);const g=n(),w=g.in&&await g.in(l),p=!(i!=null&&i.strategy)&&g.out?await g.out(l):void 0;if(!w)return;const y={in:S.normalizeToMultiSpring(w),out:p?S.normalizeToMultiSpring(p):void 0},m=await c.runIn(y);if(!m.config){t&&(t.direction="in");return}const f=m.config;(A=f.prepare)==null||A.call(f,l),f.wait&&await f.wait();const C=S.normalizeMultiSpringSchedule({...f,onEnd:()=>{var T;t=null,(T=f.onEnd)==null||T.call(f)}}),v=M.fromState(m.state,{config:C,from:m.from,to:m.to,element:l});t={controller:v,direction:"in"},m.direction==="forward"?v.forward():v.backward()},u=async l=>{var T;e=l;const g=n(),w=!(i!=null&&i.strategy)&&g.in?await g.in(l):void 0,p=g.out&&await g.out(l);if(!p)return;const y={in:w?S.normalizeToMultiSpring(w):void 0,out:S.normalizeToMultiSpring(p)},m=await c.runOut(y);if(!m.config){t&&(t.direction="out"),e&&(e.remove(),e=null);return}const f=m.config;(T=f.prepare)==null||T.call(f,l),A(),f.wait&&await f.wait();const C=S.normalizeMultiSpringSchedule({...f,onEnd:()=>{var I,E;(I=f.onEnd)==null||I.call(f),e&&(e.remove(),e=null),t=null,(E=i==null?void 0:i.onCleanupEnd)==null||E.call(i)}}),v=M.fromState(m.state,{config:C,from:m.from,to:m.to,element:l});t={controller:v,direction:"out"},m.direction==="forward"?v.forward():v.backward();function A(){!r||!e||(o&&r.contains(o)?r.insertBefore(e,o):r.appendChild(e))}};return l=>{if(l)return r=l.parentElement,o=l.nextElementSibling,a(l),()=>{if(l.isConnected){const g=l.cloneNode(!0);u(g)}else u(l)}}}const ot=3,rt=n=>{if(!n)return null;const i=n.split(`
2
+ `).map(t=>t.trim());for(let t=ot;t<Math.min(i.length,6);t++){const e=i[t],r=e==null?void 0:e.match(/\(?([^):]+):(\d+):(\d+)\)?$/);if(!r)continue;const o=r[1]??"",s=r[2]??"0",c=r[3]??"0";return{file:o.split(/[\\/]/).pop()||o,line:s,column:c}}return null},R=new Map,x=new Map;function st(n,i,t){R.set(n,i);let e=x.get(n);return e||(e=nt(()=>{const r=R.get(n);return r||(console.warn(`Transition "${String(n)}" not found`),{})},{strategy:t,onCleanupEnd:()=>X(n)}),x.set(n,e),e)}function X(n){R.delete(n),x.delete(n)}function $(){const n=rt(new Error().stack);return n?`auto_${n.file}_${n.line}_${n.column}`:Symbol(`ssgoi_auto_${Date.now()}`)}const z=globalThis.FinalizationRegistry,D=z?new z(n=>{try{X(n)}catch{}}):void 0;function at(n){const i=n.key??$();if(n.ref&&D)try{D.register(n.ref,i)}catch{}return st(i,{in:n.in,out:n.out},n[O])}function ct(n){const i=n.filter(t=>t.symmetric).map(t=>({from:t.to,to:t.from,transition:t.transition}));return[...n,...i]}function lt(n){let i=!1,t=0,e=0,r=!1;const o=50,s=p=>{if(!n)return;const y=p.touches[0];y&&(r=y.clientX<o,r&&(t=y.clientX,e=y.clientY))},c=p=>{if(!n||!r)return;const y=p.touches[0];if(!y)return;const m=y.clientX-t,f=y.clientY-e;m>window.outerWidth/2-5&&Math.abs(m)>Math.abs(f)?i=!0:i=!1},a=()=>{n&&(r=!1,t=0,e=0)},u=()=>i,h=()=>{typeof window>"u"||n&&(window.addEventListener("touchstart",s,{passive:!0}),window.addEventListener("touchmove",c,{passive:!0}),window.addEventListener("touchend",a,{passive:!0}))},l=()=>{typeof window>"u"||(window.removeEventListener("touchstart",s),window.removeEventListener("touchmove",c),window.removeEventListener("touchend",a))};let g=0;return{initialize:h,cleanup:l,isSwipePending:u,resetSwipeDetection:()=>{g++,g>1&&(g=0,i=!1)}}}const ut=n=>{let i=n.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i),e=t.overflow+t.overflowY+t.overflowX;if(e.includes("auto")||e.includes("scroll")||i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth)return i;i=i.parentElement}return document.documentElement},ft=n=>{let i=n.parentElement;for(;i&&i!==document.body;){const t=window.getComputedStyle(i).position;if(t==="relative"||t==="absolute"||t==="fixed"||t==="sticky")return i;i=i.parentElement}return document.body};function mt(){let n=null,i=null;const t=new Map;let e=null;const r=()=>{n&&e&&t.set(e,{x:n.scrollLeft,y:n.scrollTop})};return{initializeContext:(h,l)=>{i=h,n||(n=ut(h),(n===document.documentElement?window:n).addEventListener("scroll",r,{passive:!0})),e=l},calculateScrollOffset:(h,l)=>{const g=h&&t.has(h)?t.get(h):{x:0,y:0},w=l&&t.has(l)?t.get(l):{x:0,y:0};return{x:-w.x+g.x,y:-w.y+g.y}},getScrollContainer:()=>n,getPositionedParentElement:()=>i?ft(i):document.body,getScrollPosition:h=>h&&t.has(h)?t.get(h):{x:0,y:0}}}function b(n,i){if(i==="*")return!0;if(i.endsWith("/*")){const t=i.slice(0,-2);return n===t||n.startsWith(t+"/")}return n===i}function dt(n,i,t){for(const e of t)if(b(n,e.from)&&b(i,e.to))return e.transition;for(const e of t)if((e.from==="*"||b(n,e.from))&&(e.to==="*"||b(i,e.to)))return e.transition;return null}function ht(n){const{transitions:i=[],defaultTransition:t,middleware:e=(m,f)=>({from:m,to:f}),skipOnIosSwipe:r=!0}=n;let o=null;const s=ct(i),{initializeContext:c,calculateScrollOffset:a,getScrollContainer:u,getPositionedParentElement:h,getScrollPosition:l}=mt(),g=lt(r);g.initialize();function w(){if(o!=null&&o.from&&(o!=null&&o.to)){const{from:m,to:f}=e(o.from,o.to),v=dt(m,f,s)||t,A=a(o.from,o.to),T={scrollOffset:A,scroll:l(o.from),get scrollingElement(){return u()||document.documentElement},get positionedParent(){return h()}},I={scrollOffset:A,get scroll(){return o?l(o.to):{x:0,y:0}},get scrollingElement(){return u()||document.documentElement},get positionedParent(){return h()}};v&&(v.out&&o.outResolve&&o.outResolve(E=>v.out(E,T)),v.in&&o.inResolve&&o.inResolve(E=>v.in(E,I))),o=null}}const p=async(m,f)=>g.isSwipePending()?(g.resetSwipeDetection(),()=>({})):f==="in"&&(!o||!o.from)?()=>({}):(o||(o={}),f==="out"?(o.from=m,new Promise(C=>{o.outResolve=C,w()})):(o.to=m,new Promise(C=>{o.inResolve=C,w()})));return m=>({key:m,in:async f=>(c(f,m),(await p(m,"in"))(f)),out:async f=>(await p(m,"out"))(f),[O]:j})}exports.isCssAnimation=S.isCssAnimation;exports.isMultiSpring=S.isMultiSpring;exports.isSingleSpring=S.isSingleSpring;exports.isTickAnimation=S.isTickAnimation;exports.normalizeMultiSpringSchedule=S.normalizeMultiSpringSchedule;exports.normalizeToMultiSpring=S.normalizeToMultiSpring;exports.validateAnimationMode=S.validateAnimationMode;exports.validateSpringItem=S.validateSpringItem;exports.jaeminInternal=U.jaeminInternal;exports.TRANSITION_STRATEGY=O;exports.createDefaultStrategy=Y;exports.createPageTransitionStrategy=j;exports.createSggoiTransitionContext=ht;exports.generateAutoKey=$;exports.transition=at;