@mks2508/waapi-animation-primitives 0.1.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.
@@ -0,0 +1,502 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React from 'react';
3
+
4
+ interface FormatOptions {
5
+ style?: "decimal" | "currency" | "percent";
6
+ currency?: string;
7
+ locale?: string;
8
+ minimumFractionDigits?: number;
9
+ maximumFractionDigits?: number;
10
+ useGrouping?: boolean;
11
+ }
12
+ interface SlidingNumberProps {
13
+ value: number;
14
+ duration?: number;
15
+ fontSize?: string;
16
+ fontWeight?: string;
17
+ color?: string;
18
+ digitHeight?: number;
19
+ stagger?: number;
20
+ motionBlur?: boolean;
21
+ format?: FormatOptions;
22
+ trend?: -1 | 0 | 1;
23
+ animationConfig?: {
24
+ overshoot?: number;
25
+ mass?: number;
26
+ stiffness?: number;
27
+ };
28
+ }
29
+ declare function SlidingNumber({ value, duration, fontSize, fontWeight, color, digitHeight, stagger, motionBlur, format, trend, animationConfig, }: SlidingNumberProps): react_jsx_runtime.JSX.Element;
30
+
31
+ interface SlidingTextProps {
32
+ text: string;
33
+ mode?: 'word' | 'character' | 'none';
34
+ direction?: 'vertical' | 'horizontal';
35
+ staggerDelay?: number;
36
+ duration?: number;
37
+ easing?: string;
38
+ blur?: boolean;
39
+ widthAnimation?: boolean;
40
+ initial?: 'initial' | false;
41
+ animate?: 'animate';
42
+ exit?: 'exit';
43
+ onAnimationComplete?: () => void;
44
+ className?: string;
45
+ style?: React.CSSProperties;
46
+ }
47
+ declare const SlidingText: React.FC<SlidingTextProps>;
48
+
49
+ interface Token {
50
+ id: string;
51
+ text: string;
52
+ }
53
+ interface AnimatedTokensProps {
54
+ tokens: Token[];
55
+ placeholder?: string;
56
+ maxVisible?: number;
57
+ textAnimationMode?: 'character' | 'word';
58
+ textDirection?: 'vertical' | 'horizontal';
59
+ textStaggerDelay?: number;
60
+ separator?: string;
61
+ enableWidthAnimation?: boolean;
62
+ className?: string;
63
+ tokenClassName?: string;
64
+ placeholderClassName?: string;
65
+ separatorClassName?: string;
66
+ }
67
+ declare const AnimatedTokens: React.FC<AnimatedTokensProps>;
68
+
69
+ interface AnimationConfig {
70
+ onComplete: (id: string) => void;
71
+ exitDuration?: number;
72
+ flipDuration?: number;
73
+ exitEasing?: string;
74
+ flipEasing?: string;
75
+ }
76
+ declare const useWAAPIAnimations: (config: AnimationConfig) => {
77
+ registerElement: (id: string, el: HTMLElement | null) => void;
78
+ startExit: (id: string) => Promise<void>;
79
+ isAnimating: (id?: string) => boolean;
80
+ cancelAnimations: (id: string) => void;
81
+ };
82
+
83
+ /**
84
+ * Obtiene duración de animación responsiva para el dispositivo actual
85
+ * @param baseDuration - Duración base en ms
86
+ * @returns Duración ajustada para dispositivo actual
87
+ */
88
+ declare const getResponsiveDuration: (baseDuration: number) => number;
89
+ /**
90
+ * Obtiene stagger delay responsivo
91
+ * @param baseDelay - Delay base en ms
92
+ * @returns Delay ajustado para dispositivo actual
93
+ */
94
+ declare const getResponsiveStagger: (baseDelay: number) => number;
95
+ declare const TIMING: {
96
+ readonly ENTER_DURATION: 200;
97
+ readonly EXIT_DURATION: 180;
98
+ readonly COLLAPSE_DURATION: 200;
99
+ readonly FLIP_DURATION: 300;
100
+ readonly ENTER_STAGGER: 15;
101
+ readonly EXIT_STAGGER: 0;
102
+ readonly COLLAPSE_DELAY: 30;
103
+ readonly FLIP_DELAY_PERCENT: 0.25;
104
+ readonly MIN_DELTA_PX: 1;
105
+ };
106
+ declare const TRANSFORMS: {
107
+ readonly OFFSET_Y_ENTER: 8;
108
+ readonly OFFSET_Y_EXIT: -8;
109
+ readonly OFFSET_X: 16;
110
+ readonly SCALE_EXIT: 0.95;
111
+ readonly ROTATE_EXIT: 0;
112
+ };
113
+ declare const EFFECTS: {
114
+ readonly BLUR_ENTER: 4;
115
+ readonly BLUR_EXIT: 2;
116
+ };
117
+ declare const EASINGS: {
118
+ readonly EASE_OUT_CUBIC: "cubic-bezier(0.33, 1, 0.68, 1)";
119
+ readonly EASE_IN_CUBIC: "cubic-bezier(0.32, 0, 0.67, 0)";
120
+ readonly EASE_IN_OUT: "cubic-bezier(0.42, 0, 0.58, 1)";
121
+ readonly EASE_OUT_EXPO: "cubic-bezier(0.16, 1, 0.3, 1)";
122
+ readonly EASE_FLIP: "cubic-bezier(0.2, 0, 0.2, 1)";
123
+ readonly SPRING_GENTLE: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
124
+ readonly SPRING_SNAPPY: "linear(0, 0.006, 0.024 2%, 0.096 4.2%, 0.397 9.3%, 0.861 15.8%, 1.002 18.7%, 1.093 21.4%, 1.143 24%, 1.156, 1.149 28.3%, 1.115 31.5%, 1.022 40%, 0.988 47.1%, 0.984 55.1%, 0.998 72.3%, 1.001 85.4%, 1)";
125
+ };
126
+ /**
127
+ * Configuración de animación responsiva con accessibility
128
+ */
129
+ declare const RESPONSIVE_CONFIGS: {
130
+ readonly tokenEnter: {
131
+ readonly duration: number;
132
+ readonly stagger: number;
133
+ readonly easing: "cubic-bezier(0.33, 1, 0.68, 1)";
134
+ readonly blur: 4;
135
+ readonly offsetY: 8;
136
+ };
137
+ readonly tokenExit: {
138
+ readonly duration: number;
139
+ readonly stagger: number;
140
+ readonly easing: "cubic-bezier(0.32, 0, 0.67, 0)";
141
+ readonly blur: 2;
142
+ readonly offsetY: -8;
143
+ readonly scale: 0.95;
144
+ };
145
+ readonly collapse: {
146
+ readonly duration: number;
147
+ readonly delay: 30;
148
+ readonly easing: "cubic-bezier(0.42, 0, 0.58, 1)";
149
+ };
150
+ readonly flip: {
151
+ readonly duration: number;
152
+ readonly delayPercent: 0.25;
153
+ readonly easing: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
154
+ };
155
+ };
156
+ declare const ANIMATION_DEFAULTS: {
157
+ DURATION_ENTER: 200;
158
+ DURATION_EXIT: 180;
159
+ DURATION_FLIP: 300;
160
+ STAGGER_DELAY: 15;
161
+ OFFSET_VERTICAL: 8;
162
+ OFFSET_HORIZONTAL: 16;
163
+ BLUR_AMOUNT: 4;
164
+ EASING_ENTER: "cubic-bezier(0.33, 1, 0.68, 1)";
165
+ EASING_EXIT: "cubic-bezier(0.32, 0, 0.67, 0)";
166
+ EASING_FLIP: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
167
+ SPRING_EASING: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
168
+ };
169
+ declare const ANIMATION_CONFIGS: {
170
+ readonly tokenEnter: {
171
+ readonly duration: 200;
172
+ readonly stagger: 15;
173
+ readonly easing: "cubic-bezier(0.33, 1, 0.68, 1)";
174
+ readonly blur: 4;
175
+ readonly offsetY: 8;
176
+ };
177
+ readonly tokenExit: {
178
+ readonly duration: 180;
179
+ readonly stagger: 0;
180
+ readonly easing: "cubic-bezier(0.32, 0, 0.67, 0)";
181
+ readonly blur: 2;
182
+ readonly offsetY: -8;
183
+ readonly scale: 0.95;
184
+ };
185
+ readonly collapse: {
186
+ readonly duration: 200;
187
+ readonly delay: 30;
188
+ readonly easing: "cubic-bezier(0.42, 0, 0.58, 1)";
189
+ };
190
+ readonly flip: {
191
+ readonly duration: 300;
192
+ readonly delayPercent: 0.25;
193
+ readonly easing: "linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)";
194
+ };
195
+ };
196
+ declare const PRESETS: {
197
+ newToken: {
198
+ mode: "character";
199
+ direction: "vertical";
200
+ staggerDelay: number;
201
+ blur: boolean;
202
+ widthAnimation: boolean;
203
+ duration: number;
204
+ initial: "initial";
205
+ };
206
+ existingToken: {
207
+ mode: "none";
208
+ blur: boolean;
209
+ widthAnimation: boolean;
210
+ initial: false;
211
+ };
212
+ placeholder: {
213
+ mode: "word";
214
+ direction: "vertical";
215
+ blur: boolean;
216
+ widthAnimation: boolean;
217
+ duration: number;
218
+ };
219
+ separator: {
220
+ duration: number;
221
+ widthAnimation: boolean;
222
+ };
223
+ };
224
+
225
+ declare const slidingTextStyles: {
226
+ readonly container: React.CSSProperties;
227
+ readonly content: React.CSSProperties;
228
+ readonly token: React.CSSProperties;
229
+ readonly enterFrom: React.CSSProperties;
230
+ readonly enterTo: React.CSSProperties;
231
+ readonly exitActive: React.CSSProperties;
232
+ readonly verticalEnterFrom: React.CSSProperties;
233
+ readonly verticalExitActive: React.CSSProperties;
234
+ readonly horizontalEnterFrom: React.CSSProperties;
235
+ readonly horizontalExitActive: React.CSSProperties;
236
+ };
237
+ declare const getSlidingTextTokenStyle: (state: "enter-from" | "enter-to" | "exit-active", direction: "vertical" | "horizontal") => React.CSSProperties;
238
+
239
+ declare const animatedTokensStyles: {
240
+ readonly container: React.CSSProperties;
241
+ readonly placeholder: React.CSSProperties;
242
+ readonly tokenWrapper: React.CSSProperties;
243
+ readonly tokenWrapperLast: React.CSSProperties;
244
+ readonly tokenWrapperExitCompleted: React.CSSProperties;
245
+ readonly separator: React.CSSProperties;
246
+ readonly separatorExitActive: React.CSSProperties;
247
+ readonly overflow: React.CSSProperties;
248
+ readonly overflowExiting: React.CSSProperties;
249
+ };
250
+ declare const getResponsiveAnimatedTokensStyle: () => React.CSSProperties;
251
+
252
+ interface TimingData {
253
+ startTime: number;
254
+ endTime?: number;
255
+ expectedDuration: number;
256
+ actualDuration?: number;
257
+ deviation?: number;
258
+ deviationPercent?: number;
259
+ }
260
+ interface StyleData {
261
+ property: string;
262
+ expected: string;
263
+ actual: string;
264
+ matches: boolean;
265
+ }
266
+ interface PositionData {
267
+ element: string;
268
+ x: number;
269
+ y: number;
270
+ width: number;
271
+ height: number;
272
+ delta?: {
273
+ x: number;
274
+ y: number;
275
+ };
276
+ }
277
+ interface AnimationData {
278
+ name: string;
279
+ phase: 'start' | 'running' | 'complete' | 'cancelled';
280
+ progress?: number;
281
+ easing?: string;
282
+ fill?: string;
283
+ }
284
+ type DebugEventType = 'token-add' | 'token-remove' | 'token-reorder' | 'token-exit-start' | 'token-exit-complete' | 'token-dom-remove' | 'overflow-token-remove' | 'flip-animation' | 'flip-animation-complete' | 'flip-all-animations-complete' | 'flip-executing-callback' | 'flip-measure-start' | 'flip-position-measured' | 'flip-invalid-rect' | 'flip-invalid-delta' | 'flip-manual-trigger' | 'flip-capture-positions' | 'flip-position-captured' | 'waapi-exit-start' | 'waapi-exit-complete' | 'waapi-flip-animation' | 'exit-fade-complete' | 'orchestration-complete' | 'animation-start-detailed' | 'animation-complete-detailed' | 'animation-timing' | 'style-capture' | 'style-mismatch' | 'position-capture' | 'position-delta' | 'choreography-overlap' | 'choreography-sequence' | 'text-enter-start' | 'text-enter-complete' | 'triggering-flip-before-absolute' | 'state-change' | 'render' | 'animation-complete-called' | 'scheduling-raf' | 'raf-executed' | 'component-unmounted' | 'token-removing-from-layout' | 'exit-completed-ids-updated' | 'exit-completed-change' | 'registering-callback' | 'callback-fired';
285
+ interface DebugEvent {
286
+ timestamp: number;
287
+ type: DebugEventType;
288
+ source: string;
289
+ message: string;
290
+ timing?: TimingData;
291
+ styles?: StyleData[];
292
+ position?: PositionData;
293
+ animation?: AnimationData;
294
+ data?: Record<string, unknown>;
295
+ }
296
+ interface DebugContextValue {
297
+ events: DebugEvent[];
298
+ isEnabled: boolean;
299
+ enableDebug: () => void;
300
+ disableDebug: () => void;
301
+ toggleDebug: () => void;
302
+ logEvent: (event: Omit<DebugEvent, 'timestamp'>) => void;
303
+ clearEvents: () => void;
304
+ getEventLog: () => string;
305
+ exportToCSV: () => string;
306
+ }
307
+ declare const useDebug: () => DebugContextValue;
308
+ declare const DebugProvider: React.FC<{
309
+ children: React.ReactNode;
310
+ }>;
311
+
312
+ interface AnimationInfo {
313
+ id: string;
314
+ type: 'exit-fade' | 'exit-collapse' | 'flip' | 'enter' | 'width-collapse';
315
+ elementId: string;
316
+ startTime: number;
317
+ expectedDuration: number;
318
+ endTime?: number;
319
+ actualDuration?: number;
320
+ }
321
+ interface TimelineEvent {
322
+ time: number;
323
+ event: 'animation-start' | 'animation-end' | 'overlap-detected';
324
+ animationId: string;
325
+ type?: string;
326
+ overlappingWith?: string[];
327
+ expectedDuration?: number;
328
+ actualDuration?: number;
329
+ deviation?: number;
330
+ }
331
+ interface OverlapInfo {
332
+ animation1: string;
333
+ animation2: string;
334
+ overlapStart: number;
335
+ overlapDuration: number;
336
+ }
337
+ interface ChoreographySummary {
338
+ totalAnimations: number;
339
+ totalDuration: number;
340
+ overlaps: OverlapInfo[];
341
+ timeline: TimelineEvent[];
342
+ activeAnimations: AnimationInfo[];
343
+ }
344
+ /**
345
+ * ChoreographyTracker - Singleton for tracking animation choreography
346
+ * Detects overlaps, generates timeline, measures actual vs expected timing
347
+ */
348
+ declare class ChoreographyTrackerClass {
349
+ private activeAnimations;
350
+ private timeline;
351
+ private completedAnimations;
352
+ private sessionStartTime;
353
+ /**
354
+ * Start a new tracking session (call when debug panel is cleared)
355
+ */
356
+ startSession(): void;
357
+ /**
358
+ * Get relative time since session start
359
+ */
360
+ private getRelativeTime;
361
+ /**
362
+ * Start tracking an animation
363
+ */
364
+ startAnimation(id: string, type: AnimationInfo['type'], elementId: string, expectedDuration: number): void;
365
+ /**
366
+ * End tracking an animation
367
+ */
368
+ endAnimation(id: string): AnimationInfo | undefined;
369
+ /**
370
+ * Detect which animations are overlapping with the given animation
371
+ */
372
+ private detectOverlaps;
373
+ /**
374
+ * Get all overlap pairs with duration
375
+ */
376
+ getOverlaps(): OverlapInfo[];
377
+ /**
378
+ * Get current timeline
379
+ */
380
+ getTimeline(): TimelineEvent[];
381
+ /**
382
+ * Get active animation count
383
+ */
384
+ getActiveCount(): number;
385
+ /**
386
+ * Get active animations
387
+ */
388
+ getActiveAnimations(): AnimationInfo[];
389
+ /**
390
+ * Get completed animations
391
+ */
392
+ getCompletedAnimations(): AnimationInfo[];
393
+ /**
394
+ * Get full choreography summary
395
+ */
396
+ getSummary(): ChoreographySummary;
397
+ /**
398
+ * Get timeline for visualization (normalized to 0-100%)
399
+ */
400
+ getTimelineForVisualization(): Array<{
401
+ id: string;
402
+ type: string;
403
+ elementId: string;
404
+ startPercent: number;
405
+ widthPercent: number;
406
+ duration: number;
407
+ isActive: boolean;
408
+ }>;
409
+ }
410
+ declare const choreographyTracker: ChoreographyTrackerClass;
411
+
412
+ interface StyleCapture {
413
+ opacity: string;
414
+ transform: string;
415
+ filter: string;
416
+ width: string;
417
+ height: string;
418
+ marginRight: string;
419
+ marginLeft: string;
420
+ position: string;
421
+ visibility: string;
422
+ pointerEvents: string;
423
+ }
424
+ interface PositionCapture {
425
+ x: number;
426
+ y: number;
427
+ width: number;
428
+ height: number;
429
+ top: number;
430
+ left: number;
431
+ right: number;
432
+ bottom: number;
433
+ }
434
+ interface StyleComparison {
435
+ property: string;
436
+ expected: string;
437
+ actual: string;
438
+ matches: boolean;
439
+ }
440
+ interface TimingResult {
441
+ startTime: number;
442
+ endTime: number;
443
+ expectedDuration: number;
444
+ actualDuration: number;
445
+ deviation: number;
446
+ deviationPercent: number;
447
+ }
448
+ interface AnimationTimer {
449
+ start: number;
450
+ expectedDuration: number;
451
+ end: () => TimingResult;
452
+ }
453
+ /**
454
+ * Capture relevant computed styles from an element
455
+ * These are the styles we animate and need to verify
456
+ */
457
+ declare function captureComputedStyles(el: HTMLElement): StyleCapture;
458
+ /**
459
+ * Capture styles as a simple key-value object for logging
460
+ */
461
+ declare function captureStylesForLog(el: HTMLElement): Record<string, string>;
462
+ /**
463
+ * Capture complete position information from DOMRect
464
+ */
465
+ declare function capturePosition(el: HTMLElement): PositionCapture;
466
+ /**
467
+ * Capture position as simple object for logging
468
+ */
469
+ declare function capturePositionForLog(el: HTMLElement): Record<string, number>;
470
+ /**
471
+ * Calculate delta between two positions
472
+ */
473
+ declare function calculatePositionDelta(before: PositionCapture, after: PositionCapture): {
474
+ deltaX: number;
475
+ deltaY: number;
476
+ deltaWidth: number;
477
+ deltaHeight: number;
478
+ };
479
+ /**
480
+ * Compare expected styles vs actual computed styles
481
+ * Used to verify animations applied correctly
482
+ */
483
+ declare function compareStyles(expected: Record<string, string>, el: HTMLElement): StyleComparison[];
484
+ /**
485
+ * Create a timer for measuring actual animation duration
486
+ * Uses performance.now() for high precision
487
+ */
488
+ declare function createAnimationTimer(expectedDuration: number): AnimationTimer;
489
+ /**
490
+ * Format timing result for display
491
+ */
492
+ declare function formatTimingResult(timing: TimingResult): string;
493
+ /**
494
+ * Extract animation info from WAAPI Animation object
495
+ */
496
+ declare function captureAnimationInfo(animation: Animation): Record<string, unknown>;
497
+ /**
498
+ * Capture all active animations on an element
499
+ */
500
+ declare function captureElementAnimations(el: HTMLElement): Record<string, unknown>[];
501
+
502
+ export { ANIMATION_CONFIGS, ANIMATION_DEFAULTS, AnimatedTokens, type AnimatedTokensProps, type AnimationData, type AnimationInfo, type AnimationTimer, type ChoreographySummary, ChoreographyTrackerClass, type DebugEvent, type DebugEventType, DebugProvider, EASINGS, EFFECTS, type FormatOptions, type OverlapInfo, PRESETS, type PositionCapture, type PositionData, RESPONSIVE_CONFIGS, SlidingNumber, type SlidingNumberProps, SlidingText, type SlidingTextProps, type StyleCapture, type StyleComparison, type StyleData, TIMING, TRANSFORMS, type TimelineEvent, type TimingData, type TimingResult, type Token, animatedTokensStyles, calculatePositionDelta, captureAnimationInfo, captureComputedStyles, captureElementAnimations, capturePosition, capturePositionForLog, captureStylesForLog, choreographyTracker, compareStyles, createAnimationTimer, formatTimingResult, getResponsiveAnimatedTokensStyle, getResponsiveDuration, getResponsiveStagger, getSlidingTextTokenStyle, slidingTextStyles, useDebug, useWAAPIAnimations };
package/dist/index.js ADDED
@@ -0,0 +1,74 @@
1
+ import {createContext,useMemo,useRef,useEffect,useLayoutEffect,useState,useCallback,useContext}from'react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function vt(n,t){let e=t?.locale||"en-US",r={style:t?.style||"decimal",minimumFractionDigits:t?.minimumFractionDigits,maximumFractionDigits:t?.maximumFractionDigits,useGrouping:t?.useGrouping??true};t?.style==="currency"&&t?.currency&&(r.currency=t.currency);let s=new Intl.NumberFormat(e,r).formatToParts(n),p=[],h=0;s.forEach(a=>{a.type==="integer"&&(h+=a.value.length);});let g=h,x=0,l=0;return s.forEach((a,d)=>{if(a.type==="integer")for(let f of a.value)p.push({char:f,key:`int-${g}`,isDigit:true,position:g}),g--;else if(a.type==="fraction")for(let f of a.value)x++,p.push({char:f,key:`frac-${x}`,isDigit:true,position:-x});else a.type==="decimal"?p.push({char:a.value,key:"decimal",isDigit:false,position:0}):a.type==="group"?(l++,p.push({char:a.value,key:`group-${l}`,isDigit:false,position:0})):a.type==="currency"?p.push({char:a.value,key:`currency-${d}`,isDigit:false,position:0}):a.type==="percentSign"?p.push({char:a.value,key:"percent",isDigit:false,position:0}):p.push({char:a.value,key:`symbol-${d}`,isDigit:false,position:0});}),p}function rt({value:n,duration:t=700,fontSize:e="3rem",fontWeight:r="700",color:o="#000",digitHeight:s=60,stagger:p=30,motionBlur:h=true,format:g,trend:x=0,animationConfig:l}){let a=useMemo(()=>{if(l){let{overshoot:i=1,stiffness:u=1,mass:y=1}=l,m=.34*u,T=1+.56*i,_=.64/y;return `cubic-bezier(${Math.min(m,1).toFixed(2)}, ${Math.min(T,2).toFixed(2)}, ${Math.min(_,1).toFixed(2)}, 1)`}return "cubic-bezier(0.34, 1.56, 0.64, 1)"},[l]),d=useMemo(()=>vt(n,g),[n,g]),f=useRef(new Set),c=useRef(true),A=useMemo(()=>{if(c.current)return new Set;let i=new Set;return d.forEach(u=>{f.current.has(u.key)||i.add(u.key);}),i},[d]);useEffect(()=>{c.current=false,f.current=new Set(d.map(i=>i.key));},[d]);let D=i=>(Math.abs(i)-1)*p;return jsx("div",{style:{display:"inline-flex",alignItems:"center",fontSize:e,fontWeight:r,color:o,fontVariantNumeric:"tabular-nums",fontFamily:"system-ui, -apple-system, sans-serif",overflow:"hidden"},children:d.map(i=>{let u=A.has(i.key);return i.isDigit?jsx(_t,{digit:Number.parseInt(i.char),duration:t,digitHeight:s,delay:D(i.position),motionBlur:h,easing:a,isEntering:u,trend:x},i.key):jsx(At,{char:i.char,isEntering:u,duration:t,easing:a},i.key)})})}function At({char:n,isEntering:t,duration:e,easing:r}){let o=useRef(null),s=useRef(false);return useLayoutEffect(()=>{!o.current||!t||s.current||(s.current=true,o.current.animate([{opacity:0,transform:"scale(0.8)"},{opacity:1,transform:"scale(1)"}],{duration:e*.3,easing:r,fill:"forwards"}));},[t,e,r]),jsx("span",{ref:o,style:{display:"inline-block",whiteSpace:"pre",opacity:t?0:1},children:n})}function _t({digit:n,duration:t,digitHeight:e,delay:r,motionBlur:o,easing:s,isEntering:p,trend:h}){let g=useRef(null),x=useRef(null),l=useRef(null),a=useRef(`blur-${Math.random().toString(36).slice(2,9)}`).current,d=useRef(null),f=useRef(n),c=useRef(false),A=useMemo(()=>{let i=[];for(let u=-1;u<=1;u++)for(let y=0;y<=9;y++)i.push(y);return i},[]);useLayoutEffect(()=>{if(!c.current){c.current=true;let i=-(n+10)*e;d.current=i,f.current=n,g.current&&(g.current.style.transform=`translateY(${i}px)`);}},[n,e]),useLayoutEffect(()=>{!x.current||!p||x.current.animate([{opacity:0,transform:"scale(0.5) translateY(-20px)"},{opacity:1,transform:"scale(1) translateY(0)"}],{duration:t*.4,easing:s,fill:"forwards"});},[p,t,s]),useEffect(()=>{if(f.current=n,!c.current)return;let i=d.current!==null?((Math.round(-d.current/e)-10)%10+10)%10:n;n===i&&d.current!==null||D(n);},[n,e]);let D=i=>{if(!g.current||!x.current)return;if(l.current){let w=getComputedStyle(g.current),B=new DOMMatrix(w.transform);d.current=B.m42,l.current.cancel(),l.current=null,g.current.style.transform=`translateY(${d.current}px)`;}let u=d.current!==null?-d.current/e:i+10,m=((Math.round(u)-10)%10+10)%10;if(i===m&&d.current!==null){let w=-(i+10)*e;if(g.current){let B=l.current;B&&B.cancel(),g.current.style.transform=`translateY(${w}px)`;}d.current=w;return}let T;h===1?T=i>=m?i-m:10-m+i:h===-1?T=i<=m?i-m:i-m-10:(T=i-m,T>5?T-=10:T<-5&&(T+=10));let _=d.current??-(m+10)*e,E=_-T*e,S=document.getElementById(a)?.querySelector("feGaussianBlur");if(o&&S){let w=Math.min(Math.abs(T)*1.2,6);S.setAttribute("stdDeviation",`0,${w}`),x.current.style.filter=`url(#${a})`;}let U=g.current.animate([{transform:`translateY(${_}px)`},{transform:`translateY(${E}px)`}],{duration:t,delay:r,easing:s,fill:"forwards"});l.current=U,U.onfinish=()=>{let w=-(i+10)*e;g.current&&(U.cancel(),g.current.style.transform=`translateY(${w}px)`),d.current=w,x.current&&(x.current.style.filter="none"),S&&S.setAttribute("stdDeviation","0,0"),l.current=null,f.current!==i&&requestAnimationFrame(()=>{D(f.current);});},U.oncancel=()=>{l.current=null;};};return jsxs(Fragment,{children:[jsx("svg",{style:{position:"absolute",width:0,height:0},"aria-hidden":"true",children:jsx("defs",{children:jsx("filter",{id:a,children:jsx("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"0,0"})})})}),jsx("div",{ref:x,style:{position:"relative",height:`${e}px`,overflow:"hidden",width:"0.65em",textAlign:"center",opacity:p?0:1},children:jsx("div",{ref:g,style:{position:"absolute",left:0,right:0,willChange:"transform"},children:A.map((i,u)=>jsx("div",{style:{height:`${e}px`,display:"flex",alignItems:"center",justifyContent:"center"},children:i},u))})})]})}var q=n=>typeof window>"u"?n:window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:window.innerWidth<768?Math.round(n*.6):n,ot=n=>typeof window>"u"?n:window.matchMedia("(prefers-reduced-motion: reduce)").matches?0:window.innerWidth<768?Math.round(n*.5):n,b={ENTER_DURATION:200,EXIT_DURATION:180,COLLAPSE_DURATION:200,FLIP_DURATION:300,ENTER_STAGGER:15,EXIT_STAGGER:0,COLLAPSE_DELAY:30,FLIP_DELAY_PERCENT:.25,MIN_DELTA_PX:1},F={OFFSET_Y_ENTER:8,OFFSET_Y_EXIT:-8,OFFSET_X:16,SCALE_EXIT:.95,ROTATE_EXIT:0},X={BLUR_ENTER:4,BLUR_EXIT:2},N={EASE_OUT_CUBIC:"cubic-bezier(0.33, 1, 0.68, 1)",EASE_IN_CUBIC:"cubic-bezier(0.32, 0, 0.67, 0)",EASE_IN_OUT:"cubic-bezier(0.42, 0, 0.58, 1)",EASE_OUT_EXPO:"cubic-bezier(0.16, 1, 0.3, 1)",EASE_FLIP:"cubic-bezier(0.2, 0, 0.2, 1)",SPRING_GENTLE:"linear(0, 0.009, 0.035 2.1%, 0.141 4.4%, 0.723 12.9%, 0.938 16.7%, 1.017 19.4%, 1.067, 1.099 24.3%, 1.108 26%, 1.100, 1.078 30.1%, 1.049 32.5%, 0.994 37.3%, 0.981 40.2%, 0.974 43.4%, 0.975 50.2%, 0.997 62.5%, 1.001 74.7%, 1)",SPRING_SNAPPY:"linear(0, 0.006, 0.024 2%, 0.096 4.2%, 0.397 9.3%, 0.861 15.8%, 1.002 18.7%, 1.093 21.4%, 1.143 24%, 1.156, 1.149 28.3%, 1.115 31.5%, 1.022 40%, 0.988 47.1%, 0.984 55.1%, 0.998 72.3%, 1.001 85.4%, 1)"},Dt={tokenEnter:{get duration(){return q(b.ENTER_DURATION)},get stagger(){return ot(b.ENTER_STAGGER)},easing:N.EASE_OUT_CUBIC,blur:X.BLUR_ENTER,offsetY:F.OFFSET_Y_ENTER},tokenExit:{get duration(){return q(b.EXIT_DURATION)},get stagger(){return ot(b.EXIT_STAGGER)},easing:N.EASE_IN_CUBIC,blur:X.BLUR_EXIT,offsetY:F.OFFSET_Y_EXIT,scale:F.SCALE_EXIT},collapse:{get duration(){return q(b.COLLAPSE_DURATION)},delay:b.COLLAPSE_DELAY,easing:N.EASE_IN_OUT},flip:{get duration(){return q(b.FLIP_DURATION)},delayPercent:b.FLIP_DELAY_PERCENT,easing:N.SPRING_GENTLE}},I={DURATION_ENTER:b.ENTER_DURATION,DURATION_EXIT:b.EXIT_DURATION,DURATION_FLIP:b.FLIP_DURATION,STAGGER_DELAY:b.ENTER_STAGGER,OFFSET_VERTICAL:F.OFFSET_Y_ENTER,OFFSET_HORIZONTAL:F.OFFSET_X,BLUR_AMOUNT:X.BLUR_ENTER,EASING_ENTER:N.EASE_OUT_CUBIC,EASING_EXIT:N.EASE_IN_CUBIC,EASING_FLIP:N.SPRING_GENTLE,SPRING_EASING:N.SPRING_GENTLE},wt={tokenEnter:{duration:b.ENTER_DURATION,stagger:b.ENTER_STAGGER,easing:N.EASE_OUT_CUBIC,blur:X.BLUR_ENTER,offsetY:F.OFFSET_Y_ENTER},tokenExit:{duration:b.EXIT_DURATION,stagger:b.EXIT_STAGGER,easing:N.EASE_IN_CUBIC,blur:X.BLUR_EXIT,offsetY:F.OFFSET_Y_EXIT,scale:F.SCALE_EXIT},collapse:{duration:b.COLLAPSE_DURATION,delay:b.COLLAPSE_DELAY,easing:N.EASE_IN_OUT},flip:{duration:b.FLIP_DURATION,delayPercent:b.FLIP_DELAY_PERCENT,easing:N.SPRING_GENTLE}},z={newToken:{mode:"character",direction:"vertical",staggerDelay:15,blur:true,widthAnimation:true,duration:200,initial:"initial"},existingToken:{mode:"none",blur:false,widthAnimation:false,initial:false},placeholder:{mode:"word",direction:"vertical",blur:true,widthAnimation:false,duration:150},separator:{duration:100,widthAnimation:true}};var $={container:{"--duration-enter":"200ms","--duration-exit":"200ms","--easing-enter":"cubic-bezier(0.25, 0.46, 0.45, 0.94)","--easing-exit":"cubic-bezier(0.55, 0.06, 0.68, 0.19)","--offset-vertical":"8px","--offset-horizontal":"16px","--blur-amount":"4px",display:"inline-flex",overflow:"hidden",verticalAlign:"bottom",willChange:"width"},content:{display:"inline-flex",whiteSpace:"pre"},token:{display:"inline-block",willChange:"transform, opacity, filter",backfaceVisibility:"hidden",fontWeight:"500"},enterFrom:{opacity:0,filter:"blur(var(--blur-amount))"},enterTo:{opacity:1,transform:"translate(0, 0)",filter:"blur(0)"},exitActive:{opacity:0,filter:"blur(var(--blur-amount))"},verticalEnterFrom:{transform:"translateY(var(--offset-vertical))"},verticalExitActive:{transform:"translateY(calc(var(--offset-vertical) * -1))"},horizontalEnterFrom:{transform:"translateX(var(--offset-horizontal))"},horizontalExitActive:{transform:"translateX(calc(var(--offset-horizontal) * -1))"}},at=(n,t)=>{let e={...$.token};return n==="enter-from"?(Object.assign(e,$.enterFrom),t==="vertical"?Object.assign(e,$.verticalEnterFrom):Object.assign(e,$.horizontalEnterFrom)):n==="enter-to"?Object.assign(e,$.enterTo):n==="exit-active"&&(Object.assign(e,$.exitActive),t==="vertical"?Object.assign(e,$.verticalExitActive):Object.assign(e,$.horizontalExitActive)),e};var J=({text:n,mode:t="word",direction:e="vertical",staggerDelay:r=I.STAGGER_DELAY,duration:o=I.DURATION_ENTER,easing:s=I.EASING_ENTER,blur:p=true,widthAnimation:h=false,initial:g="initial",exit:x,className:l="",style:a})=>{let d=useRef(null),f=useRef(null),c=useRef(false),[A,D]=useState(g!=="initial");useEffect(()=>{g==="initial"&&!c.current&&(c.current=true,requestAnimationFrame(()=>{D(true);}));},[g]);let i=x==="exit"?"exit":A?"animate":"initial",u=t==="character"?n.split(""):[n];useLayoutEffect(()=>{if(!h||!d.current||!f.current)return;let m=d.current,T=f.current;if(i==="initial")m.style.width="0px";else if(i==="animate")if(CSS.supports("interpolate-size","allow-keywords"))m.style.width="auto",m.style.transition=`width ${o}ms ${s}`;else {let E=T.scrollWidth;m.style.width=`${E}px`,m.style.transition=`width ${o}ms ${s}`;let S=setTimeout(()=>{m.style.width="auto";},o);return ()=>clearTimeout(S)}else if(i==="exit"){let _=m.getBoundingClientRect().width;m.style.width=`${_}px`,m.getBoundingClientRect(),m.style.width="0px",m.style.transition=`width ${I.DURATION_EXIT}ms ${I.EASING_EXIT}`;}},[i,h,o,s,n]);let y=m=>{let T=m*r,_=i==="exit",E=_?I.DURATION_EXIT:o,S=_?I.EASING_EXIT:s;return {transition:`
2
+ opacity ${E}ms ${S} ${T}ms,
3
+ transform ${E}ms ${S} ${T}ms,
4
+ filter ${E}ms ${S} ${T}ms
5
+ `,"--blur-amount":p?`${I.BLUR_AMOUNT}px`:"0px","--offset":e==="vertical"?`${I.OFFSET_VERTICAL}px`:`${I.OFFSET_HORIZONTAL}px`}};return jsx("div",{ref:d,className:l,style:{...$.container,...a},children:jsx("div",{ref:f,style:$.content,children:u.map((m,T)=>jsx("span",{style:{...at(i==="initial"?"enter-from":i==="animate"?"enter-to":"exit-active",e),...y(T)},children:m},T))})})};var lt=n=>{let t=useRef(n);useEffect(()=>{t.current=n;},[n]);let e=useRef(new Map),r=useRef({animatingIds:new Set,positions:new Map}),o=useRef(new Map),s=useCallback((l,a)=>{a?e.current.set(l,a):e.current.delete(l);},[]),p=useCallback(l=>{let a=new Map;return e.current.forEach((d,f)=>{if(!l.has(f)){let c=d.getBoundingClientRect();c.width>0&&c.height>0&&a.set(f,c);}}),r.current.positions=a,a},[]),h=useCallback(l=>{let a=o.current.get(l);a&&(a.forEach(d=>d.cancel()),o.current.delete(l));},[]),g=useCallback(async l=>{let a=e.current.get(l);if(!a||r.current.animatingIds.has(l))return;r.current.animatingIds.add(l),p(new Set([l]));let f=t.current.exitDuration||b.EXIT_DURATION,c=t.current.exitEasing||N.EASE_IN_CUBIC,A=t.current.flipDuration||b.FLIP_DURATION,D=F.OFFSET_Y_EXIT,i=F.SCALE_EXIT,u=X.BLUR_EXIT,y=b.EXIT_STAGGER,m=a.getBoundingClientRect(),T=getComputedStyle(a),_=parseFloat(T.marginRight)||0,E=[],S=[],U=false,w=a.querySelectorAll(".sliding-text-token");if(w.length>0)w.forEach((C,v)=>{let M=v*y,O=C.animate([{opacity:1,transform:"translateY(0) scale(1)",filter:"blur(0px)"},{opacity:0,transform:`translateY(${D}px) scale(${i})`,filter:`blur(${u}px)`}],{duration:f,easing:c,delay:M,fill:"forwards"});E.push(O);});else {let C=a.animate([{opacity:1,transform:"translateY(0) scale(1)"},{opacity:0,transform:`translateY(${D}px) scale(${i})`}],{duration:f,easing:c,fill:"forwards"});E.push(C);}a.style.overflow="hidden";let B=a.animate([{width:`${m.width}px`,marginRight:`${_}px`},{width:"0px",marginRight:"0px"}],{duration:f,easing:c,fill:"forwards"});E.push(B),o.current.set(l,E);let R=f*b.FLIP_DELAY_PERCENT,Y=()=>{U||(U=true,a.style.position="absolute",a.style.opacity="0",a.style.pointerEvents="none",e.current.forEach((C,v)=>{if(v===l)return;let M=r.current.positions.get(v);if(!M)return;let O=C.getBoundingClientRect(),G=M.left-O.left,j=M.top-O.top;if(Math.abs(G)<1&&Math.abs(j)<1)return;let St=C.animate([{transform:`translate3d(${G}px, ${j}px, 0)`},{transform:"translate3d(0, 0, 0)"}],{duration:A,easing:N.SPRING_GENTLE});S.push(St);}));},P=setTimeout(Y,R);try{await Promise.all(E.map(C=>C.finished)),Y(),await Promise.all(S.map(C=>C.finished.catch(()=>{})));}catch{clearTimeout(P),r.current.animatingIds.delete(l);return}r.current.animatingIds.delete(l),o.current.delete(l),e.current.delete(l),t.current.onComplete(l);},[p]),x=useCallback(l=>l?r.current.animatingIds.has(l):r.current.animatingIds.size>0,[]);return useEffect(()=>()=>{o.current.forEach(l=>{l.forEach(a=>a.cancel());}),o.current.clear();},[]),{registerElement:s,startExit:g,isAnimating:x,cancelAnimations:h}};var H={container:{"--duration-enter":"200ms","--duration-exit":"180ms","--duration-collapse":"200ms","--duration-flip":"300ms","--stagger-enter":"15ms","--stagger-exit":"0ms","--offset-y-enter":"8px","--offset-y-exit":"-8px","--scale-exit":"0.95","--blur-enter":"4px","--blur-exit":"2px","--ease-enter":"cubic-bezier(0.33, 1, 0.68, 1)","--ease-exit":"cubic-bezier(0.32, 0, 0.67, 0)","--ease-collapse":"cubic-bezier(0.42, 0, 0.58, 1)","--ease-flip":"cubic-bezier(0.2, 0, 0.2, 1)",display:"flex",flexWrap:"wrap",alignItems:"center",gap:0},placeholder:{color:"var(--muted-foreground)",fontStyle:"italic"},tokenWrapper:{display:"inline-flex",alignItems:"center",marginRight:"4px"},tokenWrapperLast:{marginRight:0},tokenWrapperExitCompleted:{position:"absolute",opacity:0,pointerEvents:"none",marginRight:0},separator:{display:"inline",whiteSpace:"pre",opacity:1,transform:"translateY(0)",willChange:"transform, opacity",transition:`
6
+ opacity var(--duration-enter) var(--ease-enter),
7
+ transform var(--duration-enter) var(--ease-enter)
8
+ `},separatorExitActive:{opacity:0,transform:"translateY(-8px)",transition:`
9
+ opacity var(--duration-exit) var(--ease-exit),
10
+ transform var(--duration-exit) var(--ease-exit)
11
+ `},overflow:{display:"inline-flex",alignItems:"center",marginLeft:"4px",opacity:1,transform:"translateY(0)",willChange:"transform, opacity",transition:`
12
+ opacity var(--duration-enter) var(--ease-enter),
13
+ transform var(--duration-enter) var(--ease-enter)
14
+ `},overflowExiting:{opacity:0,transform:"translateY(-8px)",transition:`
15
+ opacity var(--duration-exit) var(--ease-exit),
16
+ transform var(--duration-exit) var(--ease-exit)
17
+ `}},ut=()=>{if(typeof window>"u")return H.container;let n=window.innerWidth<768,t=window.matchMedia("(prefers-reduced-motion: reduce)").matches,e=window.matchMedia("(prefers-contrast: high)").matches;return t?{...H.container,"--duration-enter":"0ms","--duration-exit":"0ms","--duration-collapse":"0ms","--duration-flip":"0ms","--stagger-enter":"0ms","--stagger-exit":"0ms","--blur-enter":"0px","--blur-exit":"0px","--offset-y-enter":"0px","--offset-y-exit":"0px","--scale-exit":"1"}:e?{...H.container,"--blur-enter":"0px","--blur-exit":"0px"}:n?{...H.container,"--duration-enter":"120ms","--duration-exit":"100ms","--duration-collapse":"120ms","--duration-flip":"180ms","--stagger-enter":"8ms","--blur-enter":"2px","--blur-exit":"1px","--offset-y-enter":"4px","--offset-y-exit":"-4px"}:H.container};var gt="waapi-animation-primitives-styles",Pt=`
18
+ /* AnimatedTokens critical animation styles */
19
+ .token-wrapper {
20
+ display: inline-flex;
21
+ align-items: center;
22
+ margin-right: 4px;
23
+ }
24
+
25
+ .token-wrapper:last-child {
26
+ margin-right: 0;
27
+ }
28
+
29
+ .token-wrapper.exit-completed {
30
+ position: absolute !important;
31
+ opacity: 0 !important;
32
+ pointer-events: none !important;
33
+ margin-right: 0;
34
+ }
35
+
36
+ .token-separator {
37
+ display: inline !important;
38
+ white-space: pre;
39
+ }
40
+
41
+ .token-separator.exit-completed {
42
+ opacity: 0;
43
+ position: absolute;
44
+ pointer-events: none;
45
+ }
46
+
47
+ .token-overflow {
48
+ display: inline-flex;
49
+ align-items: center;
50
+ margin-left: 4px;
51
+ }
52
+
53
+ /* Reduced motion support */
54
+ @media (prefers-reduced-motion: reduce) {
55
+ .token-wrapper,
56
+ .token-overflow,
57
+ .sliding-text,
58
+ .sliding-number {
59
+ animation: none !important;
60
+ transition: none !important;
61
+ transform: none !important;
62
+ }
63
+ }
64
+
65
+ /* Mobile optimizations */
66
+ @media (max-width: 767px) {
67
+ .token-wrapper {
68
+ transform: translateZ(0);
69
+ backface-visibility: hidden;
70
+ perspective: 1000px;
71
+ }
72
+ }
73
+ `;function ht(){if(typeof document>"u"||document.getElementById(gt))return;let n=document.createElement("style");n.id=gt,n.textContent=Pt,document.head.appendChild(n);}var $t=({tokens:n,placeholder:t="No tokens",maxVisible:e,textAnimationMode:r="character",textDirection:o="vertical",textStaggerDelay:s=15,separator:p=", ",enableWidthAnimation:h=false,className:g="",tokenClassName:x="",placeholderClassName:l="",separatorClassName:a=""})=>{let d=useRef(true);useEffect(()=>{ht();},[]),useEffect(()=>(d.current=true,()=>{d.current=false;}),[]);let[f,c]=useState(n),A=useRef(new Set),D=useCallback(R=>{d.current&&(A.current.delete(R),c(Y=>Y.filter(P=>P.id!==R)));},[]),{registerElement:i,startExit:u,isAnimating:y}=lt({onComplete:D}),m=useRef(u);useEffect(()=>{m.current=u;},[u]),useEffect(()=>{let R=new Set(n.map(v=>v.id)),Y=new Set(f.map(v=>v.id)),P=f.filter(v=>!R.has(v.id)&&!A.current.has(v.id)),C=n.filter(v=>!Y.has(v.id));if(!(P.length===0&&C.length===0)&&(P.forEach(v=>{let M=f.findIndex(G=>G.id===v.id);e!==void 0&&M>=e?c(G=>G.filter(j=>j.id!==v.id)):(A.current.add(v.id),m.current(v.id));}),C.length>0)){let v=f.filter(O=>!R.has(O.id)),M=[...n];v.forEach(O=>{let G=f.findIndex(j=>j.id===O.id);G!==-1&&G<=M.length&&M.splice(G,0,O);}),JSON.stringify(M.map(O=>O.id))!==JSON.stringify(f.map(O=>O.id))&&c(M);}},[n,f,e]);let T=f.filter(R=>!A.current.has(R.id)||!y(R.id)),_=e?f.slice(0,e):f,E=e?Math.max(0,T.length-e):0,S=useRef(0),U=E>0&&S.current===0,w=E===0&&S.current>0;useEffect(()=>{S.current=E;},[E]);let B=f.length===0&&!y()&&!!t;return jsxs("div",{style:ut(),className:g,children:[B&&jsx(J,{text:t,mode:z.placeholder.mode,direction:z.placeholder.direction,blur:z.placeholder.blur,duration:z.placeholder.duration,initial:"initial",animate:"animate",className:`token-placeholder ${l}`},"placeholder"),_.map((R,Y)=>{let P=A.current.has(R.id),C=!P&&Y<_.length-1;return jsxs("div",{className:`token-wrapper ${x} ${P?"exit-active":""}`,ref:v=>i(R.id,v),children:[jsx(J,{text:R.text,mode:P?"none":r,direction:o,staggerDelay:s,duration:I.DURATION_ENTER,blur:z.newToken.blur,widthAnimation:!P&&h,initial:P?false:"initial",animate:"animate"}),C&&jsx("span",{className:`token-separator ${a}`,children:p})]},R.id)}),(E>0||w)&&jsxs("div",{className:`token-overflow ${x} ${U?"entering":""} ${w?"exiting":""}`,ref:R=>i("overflow-counter",R),children:[jsx("span",{className:`token-separator ${a}`,children:"+"}),jsx(rt,{value:E,duration:I.DURATION_ENTER,fontSize:"inherit",fontWeight:"inherit",color:"inherit"}),jsx(J,{text:" more",mode:r,direction:o,staggerDelay:s,duration:w?I.DURATION_EXIT:I.DURATION_ENTER,blur:z.newToken.blur,initial:U?"initial":false,animate:"animate"})]})]})};var xt=createContext(null),Bt=()=>{let n=useContext(xt);if(!n)throw new Error("useDebug must be used within DebugProvider");return n},Yt=({children:n})=>{let[t,e]=useState([]),[r,o]=useState(true),s=useRef(r);s.current=r;let p=useCallback(c=>{},[]),h=useCallback(()=>{},[]),g=useCallback(()=>{},[]),x=useCallback(()=>{},[]),l=useCallback(()=>{},[]),a=useCallback(()=>"",[t]),d=useCallback(()=>"",[t]),f=useMemo(()=>({events:[],isEnabled:false,enableDebug:g,disableDebug:x,toggleDebug:l,logEvent:p,clearEvents:h,getEventLog:d,exportToCSV:a}),[t,r,g,x,l,p,h,d,a]);return jsx(xt.Provider,{value:f,children:n})};var nt=class{constructor(){this.activeAnimations=new Map;this.timeline=[];this.completedAnimations=[];this.sessionStartTime=0;}startSession(){}getRelativeTime(){return Math.round((performance.now()-this.sessionStartTime)*100)/100}startAnimation(t,e,r,o){}endAnimation(t){}detectOverlaps(t){let e=[];return this.activeAnimations.forEach((r,o)=>{o!==t&&e.push(`${r.type}:${r.elementId}`);}),e}getOverlaps(){return []}getTimeline(){return []}getActiveCount(){return 0}getActiveAnimations(){return []}getCompletedAnimations(){return []}getSummary(){return {totalAnimations:0,totalDuration:0,overlaps:[],timeline:[],activeAnimations:[]}}getTimelineForVisualization(){return []}},zt=new nt;function pt(n){let t=getComputedStyle(n);return {opacity:t.opacity,transform:t.transform,filter:t.filter,width:t.width,height:t.height,marginRight:t.marginRight,marginLeft:t.marginLeft,position:t.position,visibility:t.visibility,pointerEvents:t.pointerEvents}}function Wt(n){let t=pt(n);return {opacity:t.opacity,transform:t.transform==="none"?"none":t.transform,filter:t.filter==="none"?"none":t.filter,width:t.width,marginRight:t.marginRight,position:t.position}}function Tt(n){let t=n.getBoundingClientRect();return {x:Math.round(t.x*100)/100,y:Math.round(t.y*100)/100,width:Math.round(t.width*100)/100,height:Math.round(t.height*100)/100,top:Math.round(t.top*100)/100,left:Math.round(t.left*100)/100,right:Math.round(t.right*100)/100,bottom:Math.round(t.bottom*100)/100}}function jt(n){let t=Tt(n);return {x:t.x,y:t.y,w:t.width,h:t.height}}function Ht(n,t){return {deltaX:Math.round((n.left-t.left)*100)/100,deltaY:Math.round((n.top-t.top)*100)/100,deltaWidth:Math.round((n.width-t.width)*100)/100,deltaHeight:Math.round((n.height-t.height)*100)/100}}function Vt(n,t){let e=pt(t);return Object.entries(n).map(([r,o])=>{let s=e[r]||"",p=yt(r,o),h=yt(r,s);return {property:r,expected:o,actual:s,matches:p===h}})}function yt(n,t){if(!t)return "";if(n==="opacity")return parseFloat(t).toString();if(n==="transform"){if(t==="none")return "none";let e=t.match(/matrix\(([^)]+)\)/);if(e&&e[1]){let r=e[1].split(",").map(p=>parseFloat(p.trim())),o=r[4],s=r[5];if(o!==void 0&&s!==void 0)return `translate(${Math.round(o)}px, ${Math.round(s)}px)`}return t}if(n==="width"||n==="height"||n.includes("margin")){let e=parseFloat(t);if(!isNaN(e))return `${Math.round(e)}px`}if(n==="filter"){if(t==="none")return "none";let e=t.match(/blur\(([^)]+)\)/);if(e&&e[1]){let r=parseFloat(e[1]);return `blur(${Math.round(r)}px)`}}return t}function qt(n){let t=performance.now();return {start:t,expectedDuration:n,end:()=>{let e=performance.now(),r=e-t,o=r-n;return {startTime:Math.round(t*100)/100,endTime:Math.round(e*100)/100,expectedDuration:n,actualDuration:Math.round(r*100)/100,deviation:Math.round(o*100)/100,deviationPercent:Math.round(o/n*1e4)/100}}}}function Jt(n){let t=n.deviation>=0?"+":"",e=Math.abs(n.deviation)<10?"\u2705":"\u26A0\uFE0F";return `Expected: ${n.expectedDuration}ms | Actual: ${n.actualDuration}ms | Deviation: ${t}${n.deviation}ms ${e}`}function bt(n){let t=n.effect?.getTiming?.();return {id:n.id,playState:n.playState,currentTime:n.currentTime,playbackRate:n.playbackRate,pending:n.pending,duration:t?.duration,easing:t?.easing,fill:t?.fill}}function Zt(n){return n.getAnimations().map(bt)}export{wt as ANIMATION_CONFIGS,I as ANIMATION_DEFAULTS,$t as AnimatedTokens,nt as ChoreographyTrackerClass,Yt as DebugProvider,N as EASINGS,X as EFFECTS,z as PRESETS,Dt as RESPONSIVE_CONFIGS,rt as SlidingNumber,J as SlidingText,b as TIMING,F as TRANSFORMS,H as animatedTokensStyles,Ht as calculatePositionDelta,bt as captureAnimationInfo,pt as captureComputedStyles,Zt as captureElementAnimations,Tt as capturePosition,jt as capturePositionForLog,Wt as captureStylesForLog,zt as choreographyTracker,Vt as compareStyles,qt as createAnimationTimer,Jt as formatTimingResult,ut as getResponsiveAnimatedTokensStyle,q as getResponsiveDuration,ot as getResponsiveStagger,at as getSlidingTextTokenStyle,$ as slidingTextStyles,Bt as useDebug,lt as useWAAPIAnimations};//# sourceMappingURL=index.js.map
74
+ //# sourceMappingURL=index.js.map