svg-scroll-draw 2.15.3 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -17
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.d.mts +7 -240
- package/dist/angular/index.d.ts +7 -240
- package/dist/angular/index.mjs +1 -3
- package/dist/aos/index.cjs +2 -2
- package/dist/aos/index.mjs +1 -2
- package/dist/aos/react/index.cjs +2 -2
- package/dist/aos/react/index.d.mts +1 -33
- package/dist/aos/react/index.d.ts +1 -33
- package/dist/aos/react/index.mjs +1 -2
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.d.mts +4 -148
- package/dist/astro/index.d.ts +4 -148
- package/dist/astro/index.mjs +1 -3
- package/dist/cdn/aos.global.js +2 -2
- package/dist/cdn/scrollreveal.global.js +2 -2
- package/dist/cdn/svg-scroll-draw.dev.global.js +51 -39
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/cdn/vivus.global.js +1 -1
- package/dist/chunk-4DOJSIEQ.mjs +1 -0
- package/dist/chunk-4MH5SQTH.mjs +1 -0
- package/dist/chunk-4T5R3ZTL.mjs +2 -0
- package/dist/chunk-5PJEKEEP.mjs +1 -0
- package/dist/chunk-AJ22VSHC.mjs +1 -0
- package/dist/chunk-BCV4RAIX.mjs +1 -0
- package/dist/chunk-DM6EDKWH.mjs +1 -0
- package/dist/chunk-E4M2PB7B.mjs +1 -0
- package/dist/chunk-JC5BD4RB.mjs +1 -0
- package/dist/chunk-KBFWDHF4.mjs +1 -0
- package/dist/chunk-KGAJQP2N.mjs +2 -0
- package/dist/chunk-LFSU6LR3.mjs +1 -0
- package/dist/chunk-OJFWQ6CU.mjs +1 -0
- package/dist/chunk-OMI46IXL.mjs +2 -0
- package/dist/chunk-OWMO2S3V.mjs +1 -0
- package/dist/chunk-PEFR3ZB7.mjs +1 -0
- package/dist/chunk-QJ4H2HW3.mjs +1 -0
- package/dist/chunk-SNCRC6BA.mjs +1 -0
- package/dist/chunk-WDIHLRZZ.mjs +3 -0
- package/dist/chunk-WQZKXAXK.mjs +2 -0
- package/dist/chunk-YWKPTYSG.mjs +1 -0
- package/dist/chunk-YZV4Z3EQ.mjs +1 -0
- package/dist/cinematic/index.cjs +1 -1
- package/dist/cinematic/index.mjs +1 -2
- package/dist/devtools/index.mjs +1 -1
- package/dist/engine-6AXEX8CL.d.ts +57 -0
- package/dist/engine-Ci08nM91.d.mts +57 -0
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.d.mts +4 -207
- package/dist/group/index.d.ts +4 -207
- package/dist/group/index.mjs +1 -3
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +1 -33
- package/dist/horizontal/index.d.ts +1 -33
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index-BDGQEK6X.d.mts +15 -0
- package/dist/index-BVuNgQSd.d.ts +14 -0
- package/dist/index-CGR7pSOR.d.mts +14 -0
- package/dist/index-DxjUOIbK.d.ts +15 -0
- package/dist/index.cjs +3 -3
- package/dist/index.d.mts +8 -294
- package/dist/index.d.ts +8 -294
- package/dist/index.mjs +1 -4
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.d.mts +7 -507
- package/dist/nuxt/index.d.ts +7 -507
- package/dist/nuxt/index.mjs +1 -3
- package/dist/pin/index.cjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +1 -33
- package/dist/progress/index.d.ts +1 -33
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -2
- package/dist/react/index.d.mts +5 -212
- package/dist/react/index.d.ts +5 -212
- package/dist/react/index.mjs +2 -3
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +1 -5
- package/dist/reveal/index.d.ts +1 -5
- package/dist/reveal/index.mjs +1 -1
- package/dist/scroll-draw-BlJfbTDv.d.ts +5 -0
- package/dist/scroll-draw-CNlq4Z_L.d.mts +5 -0
- package/dist/scrollreveal/index.cjs +2 -2
- package/dist/scrollreveal/index.mjs +1 -2
- package/dist/scrollreveal/react/index.cjs +2 -2
- package/dist/scrollreveal/react/index.d.mts +1 -36
- package/dist/scrollreveal/react/index.d.ts +1 -36
- package/dist/scrollreveal/react/index.mjs +1 -2
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +1 -1
- package/dist/snap/index.d.ts +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.d.mts +6 -240
- package/dist/solid/index.d.ts +6 -240
- package/dist/solid/index.mjs +1 -3
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.d.mts +6 -240
- package/dist/svelte/index.d.ts +6 -240
- package/dist/svelte/index.mjs +1 -3
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +1 -33
- package/dist/text/index.d.ts +1 -33
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +7 -7
- package/dist/timeline/index.d.mts +1 -29
- package/dist/timeline/index.d.ts +1 -29
- package/dist/timeline/index.mjs +11 -11
- package/dist/types-DHU1zNEw.d.mts +147 -0
- package/dist/types-DHU1zNEw.d.ts +147 -0
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +1 -33
- package/dist/video/index.d.ts +1 -33
- package/dist/video/index.mjs +1 -1
- package/dist/vivus/index.cjs +2 -2
- package/dist/vivus/index.mjs +1 -2
- package/dist/vivus/react/index.cjs +2 -1
- package/dist/vivus/react/index.d.mts +1 -99
- package/dist/vivus/react/index.d.ts +1 -99
- package/dist/vivus/react/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.mts +6 -213
- package/dist/vue/index.d.ts +6 -213
- package/dist/vue/index.mjs +1 -3
- package/dist/web-component/index.cjs +2 -2
- package/dist/web-component/index.mjs +1 -3
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
|
@@ -1,217 +1,10 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { RefObject } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
end?: string;
|
|
9
|
-
}
|
|
10
|
-
interface ScrollDrawOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Apply a named preset as the base configuration. User-supplied options
|
|
13
|
-
* always override the preset. Available presets:
|
|
14
|
-
* - `'sketch'` — staggered ease-in draw, pencil feel
|
|
15
|
-
* - `'reveal'` — fade + ease-out, draws once on viewport entry
|
|
16
|
-
* - `'typewriter'` — fast linear draw with stagger
|
|
17
|
-
* - `'cinematic'` — slow ease-in-out with fade, dramatic entrance
|
|
18
|
-
* - `'spring'` — spring easing, bouncy organic feel
|
|
19
|
-
*/
|
|
20
|
-
preset?: PresetName;
|
|
21
|
-
selector?: string;
|
|
22
|
-
speed?: number;
|
|
23
|
-
fade?: boolean;
|
|
24
|
-
easing?: EasingName | ((t: number) => number);
|
|
25
|
-
trigger?: TriggerConfig;
|
|
26
|
-
stagger?: number;
|
|
27
|
-
direction?: 'forward' | 'reverse';
|
|
28
|
-
once?: boolean;
|
|
29
|
-
debug?: boolean;
|
|
30
|
-
/** Scroll axis to track. 'y' (default) for vertical, 'x' for horizontal. */
|
|
31
|
-
axis?: 'x' | 'y';
|
|
32
|
-
/** CSS selector or Element for a custom scroll container (default: window). */
|
|
33
|
-
scrollContainer?: string | Element;
|
|
34
|
-
/** Automatically reverse the animation when the user scrolls back up. */
|
|
35
|
-
autoReverse?: boolean;
|
|
36
|
-
/** Delay in milliseconds before the engine starts observing. */
|
|
37
|
-
delay?: number;
|
|
38
|
-
/** Animate stroke color. Single string = static override. Tuple = interpolate from → to. */
|
|
39
|
-
strokeColor?: string | [string, string];
|
|
40
|
-
/** Animate stroke width. Single number = static override. Tuple = interpolate from → to. */
|
|
41
|
-
strokeWidth?: number | [number, number];
|
|
42
|
-
/** Animate fill opacity. Single number = static override. Tuple [from, to] = interpolate as the path draws. Use [0, 1] to flood fill in sync with the stroke draw. */
|
|
43
|
-
fillOpacity?: number | [number, number];
|
|
44
|
-
/**
|
|
45
|
-
* Reveal the container using CSS clip-path instead of stroke-dashoffset.
|
|
46
|
-
* Works on any content — SVG, images, text, divs.
|
|
47
|
-
*
|
|
48
|
-
* Pass a direction string to control which edge the reveal starts from,
|
|
49
|
-
* or `true` as shorthand for `'left'`.
|
|
50
|
-
*
|
|
51
|
-
* Values: `'left' | 'right' | 'top' | 'bottom' | 'center'`
|
|
52
|
-
*/
|
|
53
|
-
clip?: boolean | 'left' | 'right' | 'top' | 'bottom' | 'center';
|
|
54
|
-
/** Fire callbacks at specific progress thresholds (0–1). Resets on replay(). */
|
|
55
|
-
waypoints?: Record<number, () => void>;
|
|
56
|
-
/** Scale animation speed by scroll velocity — faster scrolling = faster draw. Pass a number to control sensitivity (default 1). */
|
|
57
|
-
velocityScale?: boolean | number;
|
|
58
|
-
/** IntersectionObserver threshold (0–1). Default 0. */
|
|
59
|
-
threshold?: number;
|
|
60
|
-
/** IntersectionObserver rootMargin. Default "0px". */
|
|
61
|
-
rootMargin?: string;
|
|
62
|
-
/** Repeat the animation N times after completion. Use 'infinite' to loop forever. */
|
|
63
|
-
repeat?: number | 'infinite';
|
|
64
|
-
/** Milliseconds to wait between repeats. Default 0. */
|
|
65
|
-
repeatDelay?: number;
|
|
66
|
-
/**
|
|
67
|
-
* Target path `d` attribute to morph toward as the animation progresses.
|
|
68
|
-
* Paths must have compatible command structures (same number of numeric tokens).
|
|
69
|
-
*
|
|
70
|
-
* Only applies to `<path>` elements — silently no-ops on `<rect>`, `<circle>`,
|
|
71
|
-
* `<line>`, and other SVG shape elements.
|
|
72
|
-
*/
|
|
73
|
-
morphTo?: string;
|
|
74
|
-
onProgress?: (alpha: number) => void;
|
|
75
|
-
onStart?: () => void;
|
|
76
|
-
onComplete?: () => void;
|
|
77
|
-
/** Fires when scroll position enters the trigger zone (scrolling forward). */
|
|
78
|
-
onEnter?: () => void;
|
|
79
|
-
/** Fires when scroll position exits the trigger zone at the end (scrolling forward). */
|
|
80
|
-
onLeave?: () => void;
|
|
81
|
-
/** Fires when scroll position re-enters the trigger zone from the end (scrolling back). */
|
|
82
|
-
onEnterBack?: () => void;
|
|
83
|
-
/** Fires when scroll position exits the trigger zone at the start (scrolling back). */
|
|
84
|
-
onLeaveBack?: () => void;
|
|
85
|
-
/**
|
|
86
|
-
* Trigger the animation when the element enters the viewport instead of
|
|
87
|
-
* tying it to scroll position. The draw runs over `duration` milliseconds,
|
|
88
|
-
* replaying each time the element re-enters the viewport (use `once: true`
|
|
89
|
-
* to play only the first time).
|
|
90
|
-
*
|
|
91
|
-
* All visual options work in autoplay mode — `easing`, `stagger`, `fade`,
|
|
92
|
-
* `strokeColor`, `strokeWidth`, `fillOpacity`, `clip`, `morphTo`, `waypoints`,
|
|
93
|
-
* `repeat`, `repeatDelay`, `onStart`, `onComplete`, `onProgress`, etc.
|
|
94
|
-
*
|
|
95
|
-
* The full instance API (`pause`, `resume`, `seek`, `replay`, `getProgress`)
|
|
96
|
-
* also works — `seek(0.5)` pauses at 50% of the duration.
|
|
97
|
-
*/
|
|
98
|
-
autoplay?: boolean;
|
|
99
|
-
/**
|
|
100
|
-
* Duration of the autoplay animation in milliseconds. Only used when
|
|
101
|
-
* `autoplay: true`. Default `1000`.
|
|
102
|
-
*/
|
|
103
|
-
duration?: number;
|
|
104
|
-
/**
|
|
105
|
-
* Use the browser's native CSS scroll-driven animation
|
|
106
|
-
* (`animation-timeline: view()`) when the configuration is simple enough and
|
|
107
|
-
* the browser supports it. The browser drives the draw from the scroll
|
|
108
|
-
* position — zero per-frame JavaScript, zero scroll/resize listeners. (It
|
|
109
|
-
* still repaints on the main thread: browsers don't composite
|
|
110
|
-
* `stroke-dashoffset`.)
|
|
111
|
-
*
|
|
112
|
-
* Falls back to the JS engine automatically when unsupported or when the
|
|
113
|
-
* config uses a feature native CSS can't express (callbacks, stagger, morph,
|
|
114
|
-
* velocity scaling, custom triggers, `once`, custom easing functions, etc.).
|
|
115
|
-
*
|
|
116
|
-
* - `undefined` / `true` (default): use native when eligible.
|
|
117
|
-
* - `false`: always use the JS engine.
|
|
118
|
-
*/
|
|
119
|
-
native?: boolean;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
interface ScrollAnimateOptions {
|
|
123
|
-
props: Record<string, string | number | [string | number, string | number]>;
|
|
124
|
-
trigger?: TriggerConfig;
|
|
125
|
-
easing?: EasingName | ((t: number) => number);
|
|
126
|
-
speed?: number;
|
|
127
|
-
once?: boolean;
|
|
128
|
-
axis?: 'x' | 'y';
|
|
129
|
-
scrollContainer?: string | Element;
|
|
130
|
-
native?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* Scale animation speed by scroll velocity — faster scrolling = faster animation.
|
|
133
|
-
* Pass `true` for default sensitivity (1) or a number to control it.
|
|
134
|
-
* Higher values = more dramatic speed-up. Default sensitivity: 1.
|
|
135
|
-
*/
|
|
136
|
-
velocityScale?: boolean | number;
|
|
137
|
-
/**
|
|
138
|
-
* Honour `prefers-reduced-motion: reduce` by applying the final state and not
|
|
139
|
-
* animating. Default: `true`.
|
|
140
|
-
*
|
|
141
|
-
* Set to `false` only when the movement is *scroll-linked scrubbing* rather
|
|
142
|
-
* than autonomous motion — it advances solely as the user scrolls, 1:1 with
|
|
143
|
-
* their input, so it is direct manipulation rather than something that plays at
|
|
144
|
-
* them. `scrollHorizontal` sets this, because jumping to the final state there
|
|
145
|
-
* would leave every panel but the last unreachable inside the sticky
|
|
146
|
-
* `overflow: hidden` container.
|
|
147
|
-
*/
|
|
148
|
-
respectReducedMotion?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Element whose geometry defines the trigger window, when that is not the
|
|
151
|
-
* element being animated. Defaults to the animated element.
|
|
152
|
-
*
|
|
153
|
-
* Needed whenever the animated element cannot supply the scroll length itself —
|
|
154
|
-
* the case that matters is a `position: sticky` stage, where the pinned element
|
|
155
|
-
* is exactly one viewport tall and all of the scroll room belongs to its
|
|
156
|
-
* container. Resolving `top top` → `bottom bottom` against the pinned element
|
|
157
|
-
* there yields tStart === tEnd, a zero-length window, and no movement at all.
|
|
158
|
-
*
|
|
159
|
-
* Setting this disables the native CSS fast path: `animation-timeline: view()`
|
|
160
|
-
* always measures the element the animation is attached to, so it cannot express
|
|
161
|
-
* a separate subject.
|
|
162
|
-
*/
|
|
163
|
-
triggerElement?: Element;
|
|
164
|
-
onProgress?: (alpha: number) => void;
|
|
165
|
-
onComplete?: () => void;
|
|
166
|
-
/** Fires when scroll enters the trigger zone (scrolling forward). */
|
|
167
|
-
onEnter?: () => void;
|
|
168
|
-
/** Fires when scroll exits the trigger zone at the end (scrolling forward). */
|
|
169
|
-
onLeave?: () => void;
|
|
170
|
-
/** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
|
|
171
|
-
onEnterBack?: () => void;
|
|
172
|
-
/** Fires when scroll exits the trigger zone at the start (scrolling back). */
|
|
173
|
-
onLeaveBack?: () => void;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
interface ScrollCounterOptions {
|
|
177
|
-
from?: number;
|
|
178
|
-
to: number;
|
|
179
|
-
format?: (value: number) => string;
|
|
180
|
-
easing?: EasingName | ((t: number) => number);
|
|
181
|
-
trigger?: TriggerConfig;
|
|
182
|
-
once?: boolean;
|
|
183
|
-
decimals?: number;
|
|
184
|
-
onComplete?: () => void;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
interface ScrollVideoOptions {
|
|
188
|
-
trigger?: TriggerConfig;
|
|
189
|
-
from?: number;
|
|
190
|
-
to?: number;
|
|
191
|
-
easing?: EasingName | ((t: number) => number);
|
|
192
|
-
once?: boolean;
|
|
193
|
-
axis?: 'x' | 'y';
|
|
194
|
-
preload?: 'auto' | 'metadata';
|
|
195
|
-
onReady?: () => void;
|
|
196
|
-
onComplete?: () => void;
|
|
197
|
-
onProgress?: (alpha: number) => void;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
interface ScrollTextOptions {
|
|
201
|
-
split?: 'chars' | 'words' | 'lines';
|
|
202
|
-
stagger?: number;
|
|
203
|
-
easing?: EasingName | ((t: number) => number);
|
|
204
|
-
from?: {
|
|
205
|
-
opacity?: number;
|
|
206
|
-
y?: number;
|
|
207
|
-
x?: number;
|
|
208
|
-
rotate?: number;
|
|
209
|
-
scale?: number;
|
|
210
|
-
};
|
|
211
|
-
trigger?: TriggerConfig;
|
|
212
|
-
once?: boolean;
|
|
213
|
-
onComplete?: () => void;
|
|
214
|
-
}
|
|
3
|
+
import { E as EasingName, T as TriggerConfig, a as ScrollDrawOptions } from '../types-DHU1zNEw.js';
|
|
4
|
+
import { S as ScrollAnimateOptions } from '../engine-6AXEX8CL.js';
|
|
5
|
+
import { S as ScrollCounterOptions } from '../index-DxjUOIbK.js';
|
|
6
|
+
import { ScrollVideoOptions } from '../video/index.js';
|
|
7
|
+
import { ScrollTextOptions } from '../text/index.js';
|
|
215
8
|
|
|
216
9
|
interface UseScrollDrawProgressOptions {
|
|
217
10
|
/** Same speed multiplier as ScrollDraw. Values > 1 complete faster. Default 1. */
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,n,r){if(!Be)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),i=(n.match(Pt)??[]).join("").toUpperCase(),o=(e.match(Mt)??[]).length,a=(n.match(Mt)??[]).length;if(t!==i){ve(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==a&&ve(`morphTo: coordinate count differs (${o} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let a=parseFloat(o),u=t[i++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function Lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...vt[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:E={},stagger:R=0,direction:M="forward",once:re=false,debug:Se=false,axis:H="y",scrollContainer:W,autoReverse:D=false,delay:z=0,strokeColor:P,strokeWidth:L,fillOpacity:x,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:w="0px",repeat:g=0,repeatDelay:j=0,morphTo:O,clip:B,autoplay:X=false,duration:ie=1e3,native:le=true,onProgress:d,onStart:$,onComplete:y,onEnter:I,onLeave:A,onEnterBack:V,onLeaveBack:pe}=i,ne=B===true?"left":typeof B=="string"?B:false,xe=typeof p=="function"?p:Z[p]??Z.linear,$e=se(E.start??"top bottom"),He=se(E.end??"bottom top"),Ee=typeof W=="string"?document.querySelector(W):W??null,Te=Array.isArray(P)?P[0]:null,ce=Array.isArray(P)?P[1]:typeof P=="string"?P:null,ue=Array.isArray(L)?L[0]:null,K=Array.isArray(L)?L[1]:typeof L=="number"?L:null,de=Array.isArray(x)?x[0]:null,oe=Array.isArray(x)?x[1]:typeof x=="number"?x:null;function Re(s){let c=s*100;switch(ne){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let G=ne?[]:Array.from(e.querySelectorAll(a)),N=[],l=[],f=0,ge=0,_=false,U=false,Y=0,Me=false,ye=-1,ae=-1,ee=false,he=0,Ie=0,Ne,rt=null;function ct(){rt?.destroy(),rt=null;}let De=new Set,ut=NaN,Fe=true,je=-1,mt=performance.now(),ze=NaN;function nt(){return Ee?H==="x"?Ee.scrollLeft:Ee.scrollTop:H==="x"?window.scrollX:window.scrollY}function ft(){return Ee?H==="x"?Ee.clientWidth:Ee.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ke(e,Ee,H);return we(s,s.scroll,ft(),$e,He)}function dt(){(({tStart:f,tEnd:ge}=pt())),Se&&Be&&(ct(),rt=tr(f,ge,H));}function ot(s,c=pt){Le(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let S=s.destroy;return s.destroy=()=>{S.call(s),Ce(e);},s}function _t(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),ne){let S=c==="reverse"?1-s:s;e.style.clipPath=Re(S);return}G.forEach((S,me)=>{S.style.strokeDashoffset=c==="reverse"?`${N[me]*s}`:`${N[me]*(1-s)}`,m&&(S.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Te&&ce?S.style.stroke=_e(Te,ce,s):ce&&(S.style.stroke=ce),ue!==null&&K!==null?S.style.strokeWidth=`${ue+(K-ue)*s}`:K!==null&&(S.style.strokeWidth=`${K}`),de!==null&&oe!==null?S.style.fillOpacity=`${de+(oe-de)*s}`:oe!==null&&(S.style.fillOpacity=`${oe}`),O&&S.tagName.toLowerCase()==="path"&&l[me]&&S.setAttribute("d",at(l[me],O,s));});}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),ne){e.style.clipPath=Re(0);return}G.forEach((s,c)=>{s.style.strokeDasharray=`${N[c]}`,s.style.strokeDashoffset=M==="reverse"?"0":`${N[c]}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`),O&&s.tagName.toLowerCase()==="path"&&l[c]&&s.setAttribute("d",l[c]);});}if(G.forEach(s=>{er(s);let c=Ve(s);N.push(c);let S=s.tagName.toLowerCase()==="path";S?l.push(s.getAttribute("d")??""):l.push(""),O&&(S?rr(l[l.length-1],O,s):ve(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ce&&(s.style.stroke=ce),K!==null&&(s.style.strokeWidth=`${K}`),oe!==null&&(s.style.fillOpacity=`${oe}`),O&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",O)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?"0":`${c}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`));}),ne){if(o)return e.style.clipPath=Re(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Re(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof p=="string"?et(p):null;function qt(){return !(le===false||!Kt()||!G.length||!gt||ne||H!=="y"||Ee||u!==1||R!==0||re||D||C!==false||O||b||g||z>0||d||$||y||I||A||V||pe||P!=null||L!=null||x!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Wt(){let s=++Jt,c=`svg-scroll-draw-${s}`,S=`svg-scroll-draw-host-${s}`,me=`--svg-scroll-draw-${s}`,Oe=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Pe=`stroke-dashoffset:${Oe};`,T=`stroke-dashoffset:${ke};`;m&&(Pe+=`opacity:${M==="reverse"?1:0};`,T+=`opacity:${M==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Pe}}to{${T}}}.${S}{view-timeline-name:${me};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${me};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(S);function fe(h,te){h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}G.forEach(fe);let v=false,q=-1;function Q(){if(q>=0)return q;let h=e.getBoundingClientRect(),{tStart:te,tEnd:Ae}=we({top:h.top,height:h.height},nt(),ft(),$e,He);return xe(J(nt(),te,Ae,u))}return {destroy(){e.classList.remove(S),G.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),F.remove();},replay(){v=false,q=-1,G.forEach(fe);},pause(){v=true,G.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,G.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let te=Math.min(1,Math.max(0,h));q=te,v=true,G.forEach((Ae,be)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=M==="reverse"?`${N[be]*te}`:`${N[be]*(1-te)}`,m&&(Ae.style.opacity=M==="reverse"?`${1-te}`:`${te}`);});},getProgress(){return Q()},refresh(){G.forEach((h,te)=>{N[te]=Ve(h),h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`;});}}}if(qt())return ot(Wt());function Bt(){let s=Math.max(1,ie),c=0,S=0,me=false;function Oe(v){let q=true;if(ne){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);he=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Re(M==="reverse"?1-h:h),d?.(h),Q<1&&(q=false);}else G.forEach((Q,h)=>{let te=h*R*s,Ae=Math.min(1,Math.max(0,(v-te)/s)),be=xe(Ae);Q.style.strokeDashoffset=M==="reverse"?`${N[h]*be}`:`${N[h]*(1-be)}`,m&&(Q.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Te&&ce?Q.style.stroke=_e(Te,ce,be):ce&&(Q.style.stroke=ce),ue!==null&&K!==null?Q.style.strokeWidth=`${ue+(K-ue)*be}`:K!==null&&(Q.style.strokeWidth=`${K}`),de!==null&&oe!==null?Q.style.fillOpacity=`${de+(oe-de)*be}`:oe!==null&&(Q.style.fillOpacity=`${oe}`),O&&Q.tagName.toLowerCase()==="path"&&l[h]&&Q.setAttribute("d",at(l[h],O,be)),h===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Ae<1&&(q=false);});if(b){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);for(let te in b){let Ae=parseFloat(te);h>=Ae&&!De.has(Ae)&&(De.add(Ae),b[te]?.());}}return q}function ke(v){if(ee)return;let q=v-c;U||(U=true,$?.());let Q=Oe(q);if(Q&&!_){_=true,Oe(s*(1+Math.max(0,G.length-1)*R)),y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{c=performance.now(),U=false,_=false,De.clear(),Xe(),Y=requestAnimationFrame(ke);},j));return}Q||(Y=requestAnimationFrame(ke));}function Pe(){cancelAnimationFrame(Y),clearTimeout(Ne),c=performance.now(),S=0,ee=false,U=false,_=false,Ie=0,me=true,he=0,De.clear(),Xe(),Y=requestAnimationFrame(ke);}let T=new IntersectionObserver(v=>{v.forEach(q=>{q.isIntersecting&&!(re&&_)?Pe():!q.isIntersecting&&!re&&!_&&(cancelAnimationFrame(Y),clearTimeout(Ne),me=false);});},{root:Ee??null,threshold:k,rootMargin:w}),F;function fe(){clearTimeout(F),F=setTimeout(()=>{G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});},150);}return window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),z>0?setTimeout(()=>T.observe(e),z):T.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),T.disconnect(),window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),clearTimeout(F);},replay(){Ie=0,Pe();},pause(){ee||!me||(ee=true,S=performance.now()-c,cancelAnimationFrame(Y));},resume(){ee&&(ee=false,me=true,c=performance.now()-S,Y=requestAnimationFrame(ke));},seek(v){let q=Math.min(1,Math.max(0,v));he=q,ee=true,S=q*s,c=performance.now()-S,cancelAnimationFrame(Y),Oe(S);},getProgress(){return he},refresh(){clearTimeout(F),G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});}}}if(X)return ot(Bt());dt();function Ye(){if(!Me||ee)return;let s=performance.now(),c=nt();if(!Fe&&C===false&&c===ut){Y=requestAnimationFrame(Ye);return}Fe=false,ut=c;let S=u;if(C!==false){let T=s-mt,F=T>0?Math.abs(c-(je<0?c:je))/T:0;S=u*Math.max(.2,1+F*(typeof C=="number"?C:1)*.04);}je=c,mt=s;let me=D?ae===-1||c>=ae?"forward":"reverse":M;ae=c;let Oe=ge-f,ke=true,Pe=Oe===0?0:(c-f)/Oe;if(isNaN(ze)||(ze<=0&&Pe>0?I?.():ze>0&&Pe<=0&&pe?.(),ze<1&&Pe>=1?A?.():ze>=1&&Pe<1&&V?.()),ze=Pe,ne){let T=xe(J(c,f,ge,S));re&&!D&&(ye=Math.max(ye,T),T=ye),he=T,e.style.setProperty("--scroll-draw-progress",String(T));let F=me==="reverse"?1-T:T;e.style.clipPath=Re(F),d?.(T),!U&&J(c,f,ge,S)>0&&(U=true,$?.()),T>=1&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,e.style.clipPath=Re(0);},j))):T<1&&!re&&(_=false),Y=requestAnimationFrame(Ye);return}if(G.forEach((T,F)=>{let fe=F*R*Oe,v=xe(J(c,f+fe,ge+fe,S));re&&!D&&(ye=Math.max(ye,v),v=ye),he=v,T.style.strokeDashoffset=me==="reverse"?`${N[F]*v}`:`${N[F]*(1-v)}`,m&&(T.style.opacity=me==="reverse"?`${1-v}`:`${v}`),Te&&ce?T.style.stroke=_e(Te,ce,v):ce&&(T.style.stroke=ce),ue!==null&&K!==null?T.style.strokeWidth=`${ue+(K-ue)*v}`:K!==null&&(T.style.strokeWidth=`${K}`),de!==null&&oe!==null?T.style.fillOpacity=`${de+(oe-de)*v}`:oe!==null&&(T.style.fillOpacity=`${oe}`),O&&T.tagName.toLowerCase()==="path"&&l[F]&&T.setAttribute("d",at(l[F],O,v)),F===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(ke=false);}),b){let T=xe(J(c,f,ge,S));for(let F in b){let fe=parseFloat(F);T>=fe&&!De.has(fe)&&(De.add(fe),b[F]?.());}}!U&&J(c,f,ge,S)>0&&(U=true,$?.()),ke&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,De.clear(),Xe(),Fe=true;},j))):!ke&&!re&&(_=false),Y=requestAnimationFrame(Ye);}let st=false;function Qe(){st||(st=true,Y=requestAnimationFrame(function(){Ye();}));}function Ze(){st=false,cancelAnimationFrame(Y);}let it=new IntersectionObserver(s=>{s.forEach(c=>{Me=c.isIntersecting,Me&&!ee?(Fe=true,Qe()):Ze();});},{root:Ee??null,threshold:k,rootMargin:w});function yt(){G.forEach((s,c)=>{N[c]=Ve(s),s.style.strokeDasharray=`${N[c]}`;}),dt(),Fe=true;}let Je;function qe(){clearTimeout(Je),Je=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),z>0?setTimeout(()=>it.observe(e),z):it.observe(e),ot({destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),Ze(),it.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Je),ct();},replay(){ye=-1,ae=-1,je=-1,U=false,_=false,Ie=0,ee=false,he=0,De.clear(),clearTimeout(Ne),Xe(),Fe=true,Me&&Qe();},pause(){ee=true,Ze();},resume(){ee&&(ee=false,Fe=true,Me&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));he=c,ye=c,ee=true,Ze(),_t(c,M),Fe=true;},getProgress(){return he},refresh(){clearTimeout(Je),yt(),Me&&!ee&&Qe();}},()=>({tStart:f,tEnd:ge}))}function nr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],a=t[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function or(e,n,r){let t=Ct(e),i=Ct(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,a)=>{let u=i[a];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function $t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(nr(t))return _e(t,i,r);if(t.includes("("))return or(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),a=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&a){let u=parseFloat(o[1]),m=parseFloat(a[1]);return `${u+(m-u)*r}${o[2]||a[2]}`}return r<1?t:i}function sr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ir=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ar=0,Rt="--scroll-draw-progress";function lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function kt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:p,native:E=true,velocityScale:R=false,respectReducedMotion:M=true,triggerElement:re,onProgress:Se,onComplete:H,onEnter:W,onLeave:D,onEnterBack:z,onLeaveBack:P}=n,L=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:Z[o]??Z["ease-out"],b=se(i.start??"top bottom"),C=se(i.end??"bottom top"),k=re??e,w=typeof p=="string"?document.querySelector(p):p??null,g=Object.entries(t).map(([l,f])=>({prop:sr(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function j(){let l=window.getComputedStyle(e);for(let f of g)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function O(){for(let l of g)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...g.map(f=>f.prop),Rt])B.set(l,e.style.getPropertyValue(l));function X(){for(let[l,f]of B)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(L)return O(),H?.(),{...r,destroy:X,getProgress:()=>1};j();let ie=typeof o=="string"?et(o):null;function le(){if(!E||!lr()||!ie||m!=="y"||w||k!==e||u||a!==1||Se||H||W||D||z||P||R!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let l of g)if(!ir.has(l.prop))return false;return true}function d(){let l=`ssd-a-${++ar}`,f=g.map(ae=>`${ae.prop}:${ae.from}`).join(";"),ge=g.map(ae=>`${ae.prop}:${ae.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${l}{from{${f}}to{${ge}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(l);let U=()=>m==="x"?window.scrollX:window.scrollY,Y=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let ae=e.getBoundingClientRect();return we({top:ae.top,height:ae.height},U(),Y(),b,C)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(l),_.remove(),e.style.animationPlayState="",X(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let ee=Math.min(1,Math.max(0,ae));e.classList.remove(l);for(let he of g)e.style.setProperty(he.prop,$t(he.from,he.to,ee));},getProgress(){let{tStart:ae,tEnd:ee}=Me();return x(J(U(),ae,ee,a))}};return ye}if(le())return d();let $=0,y=0,I=0,A=false,V=false,pe=-1,ne=0,xe=false,$e=NaN,He=-1,Ee=0,Te=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ce=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ue(){let l=Ke(k,w,m),f=we(l,l.scroll,ce(),b,C);$=f.tStart,y=f.tEnd;}function K(l){e.style.setProperty(Rt,String(l));for(let f of g)e.style.setProperty(f.prop,$t(f.from,f.to,l));Se?.(l);}function de(l){if(isNaN($e)){$e=l;return}$e<=0&&l>0?W?.():$e>0&&l<=0&&P?.(),$e<1&&l>=1?D?.():$e>=1&&l<1&&z?.(),$e=l;}function oe(){if(!A||V)return;let l=performance.now(),f=Te(),ge=a;if(R!==false){let Y=l-Ee,Me=Y>0?Math.abs(f-(He<0?f:He))/Y:0;ge=a*Math.max(.2,1+Me*(typeof R=="number"?R:1)*.04);}He=f,Ee=l;let _=y===$?0:(f-$)/(y-$);de(_);let U=x(J(f,$,y,ge));u&&(pe=Math.max(pe,U),U=pe),ne=U,K(U),U>=1&&!xe?(xe=true,H?.()):U<1&&!u&&(xe=false),I=requestAnimationFrame(oe);}ue(),y===$&&ve("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let l=x(J(Te(),$,y,a));u&&l>0&&(pe=l),ne=l,K(l);}let Re=new IntersectionObserver(l=>{l.forEach(f=>{A=f.isIntersecting,A&&!V?I=requestAnimationFrame(oe):cancelAnimationFrame(I);});},{root:w??null}),G;function N(){clearTimeout(G),G=setTimeout(ue,150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Re.observe(e),Le(e,{type:"animate",getProgress:()=>ne,getTrigger:()=>({tStart:$,tEnd:y})}),{destroy(){cancelAnimationFrame(I),Re.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(G),X(),Ce(e);},replay(){pe=-1,xe=false,ne=0,V=false,K(0);},pause(){V=true,cancelAnimationFrame(I);},resume(){V&&(V=false,A&&(I=requestAnimationFrame(oe)));},seek(l){let f=Math.min(1,Math.max(0,l));ne=f,pe=f,V=true,cancelAnimationFrame(I),K(f);},getProgress(){return ne}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollCounter: element not found:",e),lt;let t=r,{from:i=0,to:o,format:a,easing:u="ease-out",trigger:m={},once:p=true,decimals:E,onComplete:R}=n,M=E!==void 0?d=>d.toFixed(E):a??(d=>String(Math.round(d))),re=typeof u=="function"?u:Z[u]??Z["ease-out"],Se=se(m.start??"top 80%"),H=se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(o),R?.(),lt;let D=0,z=0,P=0,L=false,x=false,b=-1,C=0,k=false,w=()=>window.scrollY,g=()=>window.innerHeight;function j(){let d=t.getBoundingClientRect(),$=we({top:d.top,height:d.height},w(),g(),Se,H);D=$.tStart,z=$.tEnd;}function O(d){t.textContent=M(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function B(){if(!L||x)return;let d=re(J(w(),D,z,1));p&&(b=Math.max(b,d),d=b),C=d,O(d),d>=1&&!k?(k=true,R?.()):d<1&&!p&&(k=false),P=requestAnimationFrame(B);}j();{let d=re(J(w(),D,z,1));p&&d>0&&(b=d),C=d,O(d);}let X=new IntersectionObserver(d=>{d.forEach($=>{L=$.isIntersecting,L&&!x?P=requestAnimationFrame(B):cancelAnimationFrame(P);});}),ie;function le(){clearTimeout(ie),ie=setTimeout(j,150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),X.observe(t),Le(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:D,tEnd:z})}),{destroy(){cancelAnimationFrame(P),X.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(ie),Ce(t);},replay(){b=-1,k=false,C=0,x=false,O(0);},pause(){x=true,cancelAnimationFrame(P);},resume(){x&&(x=false,L&&(P=requestAnimationFrame(B)));},seek(d){let $=Math.min(1,Math.max(0,d));C=$,b=$,x=true,cancelAnimationFrame(P),O($);},getProgress(){return C}}}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ve("scrollVideo: <video> element not found:",e),Ot;let t=r,{trigger:i={},easing:o="linear",once:a=false,axis:u="y",preload:m="auto",onReady:p,onComplete:E,onProgress:R}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:Z[o]??Z.linear,Se=se(i.start??"top top"),H=se(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,D=n.to,z=0,P=0,L=0,x=false,b=false,C=-1,k=0,w=false,g=false,j=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;function B(){let A=t.getBoundingClientRect(),V=u==="x"?A.left:A.top,pe=u==="x"?A.width:A.height,ne=we({top:V,height:pe},j(),O(),Se,H);z=ne.tStart,P=ne.tEnd;}let X=NaN;function ie(A){if(!g)return;let V=D??t.duration??0,pe=W+(V-W)*A;pe!==X&&(X=pe,t.currentTime=pe),t.style.setProperty("--scroll-draw-progress",String(A)),R?.(A);}function le(){if(!x||b||!g||M)return;let A=re(J(j(),z,P,1));a&&(C=Math.max(C,A),A=C),k=A,ie(A),A>=1&&!w?(w=true,E?.()):A<1&&!a&&(w=false),L=requestAnimationFrame(le);}function d(){if(g=true,D===void 0&&(D=t.duration),M){ie(1),p?.();return}B(),p?.(),x&&!b&&(L=requestAnimationFrame(le));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),g||B();let $=new IntersectionObserver(A=>{A.forEach(V=>{x=V.isIntersecting,x&&!b&&g?L=requestAnimationFrame(le):cancelAnimationFrame(L);});}),y;function I(){clearTimeout(y),y=setTimeout(B,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),$.observe(t),Le(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:z,tEnd:P})}),{destroy(){cancelAnimationFrame(L),$.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(y),Ce(t);},replay(){C=-1,w=false,k=0,b=false,X=NaN,ie(0);},pause(){b=true,cancelAnimationFrame(L);},resume(){b&&(b=false,x&&g&&(L=requestAnimationFrame(le)));},seek(A){let V=Math.min(1,Math.max(0,A));k=V,C=V,b=true,cancelAnimationFrame(L),X=NaN,ie(V);},getProgress(){return k}}}function Ht(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function cr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=Ht(e),r=new Map;for(let o of n){let a=o.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(o);}let t=[],i=Array.from(r.keys()).sort((o,a)=>o-a);for(let o of i){let a=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((m,p)=>{let E=m.nextElementSibling;u.appendChild(m),p<a.length-1&&E&&E.style.whiteSpace==="pre"&&u.appendChild(E);}),t.push(u);}return e.textContent="",t.forEach((o,a)=>{e.appendChild(o),a<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ur(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,a=o+(1-i);return a<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(a-o)))}function mr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,n={}){if(typeof window>"u")return Ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollText: element not found:",e),Ft;let t=r,{split:i="words",stagger:o=.04,easing:a="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:E}=n,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof a=="function"?a:Z[a]??Z["ease-out"],re=se(m.start??"top 85%"),Se=se(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let W;i==="chars"?W=cr(t):i==="lines"?W=Dt(t):W=Ht(t);let D=W.length;function z(y,I){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*I));let A=mr(I,u);A&&(y.style.transform=A);}function P(y){t.style.setProperty("--scroll-draw-progress",String(y)),W.forEach((I,A)=>{let V=M(ur(y,A,D,o));z(I,V);});}if(R)return P(1),E?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P(0);let L=0,x=0,b=0,C=false,k=false,w=-1,g=0,j=false,O=()=>window.scrollY,B=()=>window.innerHeight;function X(){let y=t.getBoundingClientRect(),I=we({top:y.top,height:y.height},O(),B(),re,Se);L=I.tStart,x=I.tEnd;}function ie(){if(!C||k)return;let y=J(O(),L,x,1);p&&(w=Math.max(w,y),y=w),g=y,P(y),y>=1&&!j?(j=true,E?.()):y<1&&!p&&(j=false),b=requestAnimationFrame(ie);}X();let le=new IntersectionObserver(y=>{y.forEach(I=>{C=I.isIntersecting,C&&!k?b=requestAnimationFrame(ie):cancelAnimationFrame(b);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=g;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),W=Dt(t),P(y);}X();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),le.observe(t),Le(t,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:L,tEnd:x})}),{destroy(){cancelAnimationFrame(b),le.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ce(t);},replay(){w=-1,j=false,g=0,k=false,P(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(ie)));},seek(y){let I=Math.min(1,Math.max(0,y));g=I,w=I,k=true,cancelAnimationFrame(b),P(I);},getProgress(){return g}}}function dr(e,n={}){let[r,t]=useState(0),i=useRef(n);i.current=n;let o=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let u=a,{axis:m="y",scrollContainer:p,trigger:E={}}=i.current,R=typeof p=="string"?document.querySelector(p):p??null,M=se(E.start??"top bottom"),re=se(E.end??"bottom top"),Se=0,H=0,W=false,D=0;function z(){return R?m==="x"?R.scrollLeft:R.scrollTop:m==="x"?window.scrollX:window.scrollY}function P(){return R?m==="x"?R.clientWidth:R.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function L(){let w=u.getBoundingClientRect(),g=z(),j=m==="x"?w.left:w.top,O=m==="x"?w.width:w.height,B=we({top:j,height:O},g,P(),M,re);Se=B.tStart,H=B.tEnd;}function x(){if(!W)return;let{speed:w=1,easing:g="linear",once:j=false}=i.current,O=typeof g=="function"?g:Z[g]??Z.linear,B=J(z(),Se,H,w),X=O(B);j&&(o.current=Math.max(o.current,X),X=o.current),t(X),D=requestAnimationFrame(x);}let b=new IntersectionObserver(w=>{w.forEach(g=>{W=g.isIntersecting,W?D=requestAnimationFrame(x):cancelAnimationFrame(D);});},{root:R??null,threshold:0});L(),b.observe(u);let C;function k(){clearTimeout(C),C=setTimeout(L,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),()=>{cancelAnimationFrame(D),clearTimeout(C),b.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k);}},[]),r}function en({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=Lt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function tn({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=kt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function rn({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let i=It(t.current,r);return ()=>i.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function nn({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let a=useRef(null);return useEffect(()=>{if(!a.current)return;let u=Nt(a.current,o);return ()=>u.destroy()},[]),jsx("video",{ref:a,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function on({children:e,as:n="p",className:r,style:t,...i}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let a=zt(o.current,i);return ()=>a.destroy()},[]),gr.createElement(n,{ref:o,className:r,style:t},e)}export{tn as ScrollAnimate,rn as ScrollCounter,en as ScrollDraw,on as ScrollText,nn as ScrollVideo,dr as useScrollDrawProgress};
|
|
1
|
+
"use client";
|
|
2
|
+
import {a as a$3}from'../chunk-JC5BD4RB.mjs';import {a as a$4}from'../chunk-SNCRC6BA.mjs';import {a as a$2}from'../chunk-4MH5SQTH.mjs';import {a as a$1}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-WDIHLRZZ.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import {a,c,b as b$1}from'../chunk-PEFR3ZB7.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';import J,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function G(t,o={}){let[s,r]=useState(0),e=useRef(o);e.current=o;let n=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){r(1);return}let i=typeof t=="string"?document.querySelector(t):t.current;if(!i)return;let f=i,{axis:u="y",scrollContainer:w,trigger:b={}}=e.current,c$1=typeof w=="string"?document.querySelector(w):w??null,k=a(b.start??"top bottom"),W=a(b.end??"bottom top"),C=0,O=0,E=false,d$1=0;function N(){return c$1?u==="x"?c$1.scrollLeft:c$1.scrollTop:u==="x"?window.scrollX:window.scrollY}function X(){return c$1?u==="x"?c$1.clientWidth:c$1.clientHeight:u==="x"?window.innerWidth:window.innerHeight}function D(){let l=f.getBoundingClientRect(),a=N(),P=u==="x"?l.left:l.top,T=u==="x"?l.width:l.height,S=c({top:P,height:T},a,X(),k,W);C=S.tStart,O=S.tEnd;}function A(){if(!E)return;let{speed:l=1,easing:a="linear",once:P=false}=e.current,T=typeof a=="function"?a:d[a]??d.linear,S=b$1(N(),C,O,l),h=T(S);P&&(n.current=Math.max(n.current,h),h=n.current),r(h),d$1=requestAnimationFrame(A);}let L=new IntersectionObserver(l=>{l.forEach(a=>{E=a.isIntersecting,E?d$1=requestAnimationFrame(A):cancelAnimationFrame(d$1);});},{root:c$1??null,threshold:0});D(),L.observe(f);let x;function g(){clearTimeout(x),x=setTimeout(D,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),()=>{cancelAnimationFrame(d$1),clearTimeout(x),L.disconnect(),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g);}},[]),s}function oe({children:t,className:o,style:s,...r}){let e=useRef(null);return useEffect(()=>{if(!e.current)return;let n=b(e.current,r);return ()=>n.destroy()},[]),jsx("div",{ref:e,className:o,style:s,children:t})}function se({children:t,className:o,style:s,...r}){let e=useRef(null);return useEffect(()=>{if(!e.current)return;let n=a$1(e.current,r);return ()=>n.destroy()},[]),jsx("div",{ref:e,className:o,style:s,children:t})}function ie({className:t,style:o,...s}){let r=useRef(null);return useEffect(()=>{if(!r.current)return;let e=a$2(r.current,s);return ()=>e.destroy()},[]),jsx("span",{ref:r,className:t,style:o})}function le({src:t,className:o,style:s,muted:r=true,playsInline:e=true,...n}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let f=a$3(i.current,n);return ()=>f.destroy()},[]),jsx("video",{ref:i,src:t,className:o,style:s,muted:r,playsInline:e,preload:"auto"})}function ce({children:t,as:o="p",className:s,style:r,...e}){let n=useRef(null);return useEffect(()=>{if(!n.current)return;let i=a$4(n.current,e);return ()=>i.destroy()},[]),J.createElement(o,{ref:n,className:s,style:r},t)}export{se as ScrollAnimate,ie as ScrollCounter,oe as ScrollDraw,ce as ScrollText,le as ScrollVideo,G as useScrollDrawProgress};
|
package/dist/reveal/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function Ne({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(r),s=0,m=[];for(let c=0;c<n;c++){let p=Math.pow(a,c);m.push(p),s+=p;}let l=[0],u=0;for(let c=0;c<n;c++)u+=m[c]/s,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Fe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),a=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/r)+1}var N={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ne(),elastic:Fe()};function J(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function fe(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function ge(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function Oe(e,t,n){return Math.min(n,Math.max(t,e))}function W(e,t,n,r){return n===t?0:Oe((e-t)/(n-t)*r,0,1)}function be(e,t,n){let r=e.getBoundingClientRect(),a=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left+t.scrollLeft:r.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:n==="x"?r.left:r.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function ee(e,t,n,r,a){let s=fe(e.top,e.height,t,r.element)-ge(r.viewport,n),m=fe(e.top,e.height,t,a.element)-ge(a.viewport,n);return {tStart:s,tEnd:m}}function de(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function he(e,t,n){let r=de(e),a=de(t);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*n)},${Math.round(r[1]+(a[1]-r[1])*n)},${Math.round(r[2]+(a[2]-r[2])*n)})`}var De="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ve="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function He(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Xe(e){let t=[];for(let n=0;n<ye;n++){let r=n/(ye-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function we(e){switch(e){case "linear":return "linear";case "ease-in":return De;case "ease-out":return Ve;case "ease-in-out":return He()?Xe(N["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function ve(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function te(e,t){ve().set(e,t);}function ne(e){ve().delete(e);}var ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Y(e,...t){ke&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Be(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let a=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:r[1],nums:a,units:s});}return t}function ze(e,t,n){let r=Se(e),a=Se(t);return r.length===0||r.length!==a.length?n<1?e:t:r.map((s,m)=>{let l=a[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?n<1?`${s.fn}(${s.nums.map((u,c)=>`${u}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,c)=>`${u+(l.nums[c]-u)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function xe(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),a=String(t);if(Be(r))return he(r,a,n);if(r.includes("("))return ze(r,a,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),u=parseFloat(m[1]);return `${l+(u-l)*n}${s[2]||m[2]}`}return n<1?r:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Ye=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ge=0,Me="--scroll-draw-progress";function je(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Te(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:r,trigger:a={},easing:s="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:I,onProgress:T,onComplete:P,onEnter:C,onLeave:F,onEnterBack:O,onLeaveBack:R}=t,_=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,w=typeof s=="function"?s:N[s]??N["ease-out"],oe=J(a.start??"top bottom"),se=J(a.end??"bottom top"),ie=I??e,d=typeof c=="string"?document.querySelector(c):c??null,h=Object.entries(r).map(([o,i])=>({prop:We(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function Le(){let o=window.getComputedStyle(e);for(let i of h)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function $e(){for(let o of h)e.style.setProperty(o.prop,String(o.to));}let ae=new Map;for(let o of [...h.map(i=>i.prop),Me])ae.set(o,e.style.getPropertyValue(o));function G(){for(let[o,i]of ae)i?e.style.setProperty(o,i):e.style.removeProperty(o);}if(_)return $e(),P?.(),{...n,destroy:G,getProgress:()=>1};Le();let ue=typeof s=="string"?we(s):null;function Ae(){if(!p||!je()||!ue||u!=="y"||d||ie!==e||l||m!==1||T||P||C||F||O||R||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of h)if(!Ye.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++Ge}`,i=h.map(f=>`${f.prop}:${f.from}`).join(";"),k=h.map(f=>`${f.prop}:${f.to}`).join(";"),A=document.createElement("style");A.setAttribute("data-ssd-animate",""),A.textContent=`@keyframes ${o}{from{${i}}to{${k}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,B=()=>u==="x"?window.innerWidth:window.innerHeight,z=()=>{let f=e.getBoundingClientRect();return ee({top:f.top,height:f.height},b(),B(),oe,se)};te(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:z});let Q={destroy(){e.classList.remove(o),A.remove(),e.style.animationPlayState="",G(),ne(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let K=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Z of h)e.style.setProperty(Z.prop,xe(Z.from,Z.to,K));},getProgress(){let{tStart:f,tEnd:K}=z();return w(W(b(),f,K,m))}};return Q}if(Ae())return Ie();let y=0,E=0,v=0,D=false,S=false,L=-1,$=0,V=false,x=NaN,j=-1,ce=0,le=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function me(){let o=be(ie,d,u),i=ee(o,o.scroll,Ce(),oe,se);y=i.tStart,E=i.tEnd;}function H(o){e.style.setProperty(Me,String(o));for(let i of h)e.style.setProperty(i.prop,xe(i.from,i.to,o));T?.(o);}function _e(o){if(isNaN(x)){x=o;return}x<=0&&o>0?C?.():x>0&&o<=0&&R?.(),x<1&&o>=1?F?.():x>=1&&o<1&&O?.(),x=o;}function q(){if(!D||S)return;let o=performance.now(),i=le(),k=m;if(g!==false){let B=o-ce,z=B>0?Math.abs(i-(j<0?i:j))/B:0;k=m*Math.max(.2,1+z*(typeof g=="number"?g:1)*.04);}j=i,ce=o;let A=E===y?0:(i-y)/(E-y);_e(A);let b=w(W(i,y,E,k));l&&(L=Math.max(L,b),b=L),$=b,H(b),b>=1&&!V?(V=true,P?.()):b<1&&!l&&(V=false),v=requestAnimationFrame(q);}me(),E===y&&Y("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=w(W(le(),y,E,m));l&&o>0&&(L=o),$=o,H(o);}let pe=new IntersectionObserver(o=>{o.forEach(i=>{D=i.isIntersecting,D&&!S?v=requestAnimationFrame(q):cancelAnimationFrame(v);});},{root:d??null}),U;function X(){clearTimeout(U),U=setTimeout(me,150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),pe.observe(e),te(e,{type:"animate",getProgress:()=>$,getTrigger:()=>({tStart:y,tEnd:E})}),{destroy(){cancelAnimationFrame(v),pe.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(U),G(),ne(e);},replay(){L=-1,V=false,$=0,S=false,H(0);},pause(){S=true,cancelAnimationFrame(v);},resume(){S&&(S=false,D&&(v=requestAnimationFrame(q)));},seek(o){let i=Math.min(1,Math.max(0,o));$=i,L=i,S=true,cancelAnimationFrame(v),H(i);},getProgress(){return $}}}var qe={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ue(e){let t={};e.opacity!==void 0&&(t.opacity=[e.opacity,1]);let n=[],r=[];return e.x!==void 0&&(n.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(n.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(n.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(n.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(n.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(n.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),n.length>0&&(t.transform=[n.join(" "),r.join(" ")]),t}function Qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function re(e){let t=e.trim().split(/\s+/),[n,r]=t.length>1?t:/%$/.test(t[0])?["top",t[0]]:[t[0],"bottom"];return [n,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function Pe(e,t){let[n,r]=re(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function Ke(e){let t=NaN,n=0,r=0;return e.map(a=>{let s=a.getBoundingClientRect();return Math.abs(s.top-t)<=Math.max(8,Math.min(s.height,n||s.height)/2)?r++:(t=s.top,n=s.height,r=0),r})}var Re={destroy:()=>{}};function lt(e,t={}){if(typeof window>"u")return Re;let n=Qe(e);if(!n.length)return Y("scrollReveal: no elements found:",e),Re;let{preset:r="fadeUp",from:a,stagger:s=.15,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=t,g={...qe[r],...a},M=Ue(g),I=u?.start??"top 88%",T=u?.end??"top 53%",P=Math.abs(re(I)[1]-re(T)[1]),C=Math.min(Math.max(s,0),1)*P,F=C>0?Ke(n):n.map(()=>0),O=n.map((R,_)=>{let w=Math.min(F[_]*C,P);return Te(R,{props:M,easing:m,once:l,native:false,trigger:w>0?{start:Pe(I,w),end:Pe(T,w)}:{start:I,end:T},onEnter:_===0?c:void 0,onLeave:_===n.length-1?p:void 0})});return {destroy(){O.forEach(R=>R.destroy());}}}exports.scrollReveal=lt;
|
|
1
|
+
'use strict';function Fe({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(r),s=0,m=[];for(let c=0;c<n;c++){let p=Math.pow(a,c);m.push(p),s+=p;}let l=[0],u=0;for(let c=0;c<n;c++)u+=m[c]/s,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Ve({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),a=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/r)+1}var N={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Fe(),elastic:Ve()};function fe(e,t,n){return Math.min(n,Math.max(t,e))}function J(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function ge(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function de(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function z(e,t,n,r){return n===t?0:fe((e-t)/(n-t)*r,0,1)}function ee(e,t,n,r,a){let s=ge(e.top,e.height,t,r.element)-de(r.viewport,n),m=ge(e.top,e.height,t,a.element)-de(a.viewport,n);return {tStart:s,tEnd:m}}function be(e,t,n){let r=e.getBoundingClientRect(),a=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left+t.scrollLeft:r.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:n==="x"?r.left:r.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function he(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function ye(e,t,n){let r=he(e),a=he(t);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*n)},${Math.round(r[1]+(a[1]-r[1])*n)},${Math.round(r[2]+(a[2]-r[2])*n)})`}var De="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ve=33;function He(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function ke(e){let t=[];for(let n=0;n<ve;n++){let r=n/(ve-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function Ee(e){switch(e){case "linear":return "linear";case "ease-in":return De;case "ease-out":return Oe;case "ease-in-out":return He()?ke(N["ease-in-out"]):null;default:return null}}var we=Symbol.for("svg-scroll-draw.registry");function Se(){let e=globalThis;return e[we]||(e[we]=new Map)}function te(e,t){Se().set(e,t);}function ne(e){Se().delete(e);}var Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Y(e,...t){Be&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Xe(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function xe(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let a=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:r[1],nums:a,units:s});}return t}function We(e,t,n){let r=xe(e),a=xe(t);return r.length===0||r.length!==a.length?n<1?e:t:r.map((s,m)=>{let l=a[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?n<1?`${s.fn}(${s.nums.map((u,c)=>`${u}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,c)=>`${u+(l.nums[c]-u)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function Me(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),a=String(t);if(Xe(r))return ye(r,a,n);if(r.includes("("))return We(r,a,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),u=parseFloat(m[1]);return `${l+(u-l)*n}${s[2]||m[2]}`}return n<1?r:a}function ze(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Ye=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),je=0,Te="--scroll-draw-progress";function qe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Re(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:r,trigger:a={},easing:s="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:I,onProgress:T,onComplete:R,onEnter:_,onLeave:F,onEnterBack:V,onLeaveBack:L}=t,C=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,v=typeof s=="function"?s:N[s]??N["ease-out"],oe=J(a.start??"top bottom"),se=J(a.end??"bottom top"),ie=I??e,d=typeof c=="string"?document.querySelector(c):c??null,h=Object.entries(r).map(([o,i])=>({prop:ze(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function Pe(){let o=window.getComputedStyle(e);for(let i of h)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function Ae(){for(let o of h)e.style.setProperty(o.prop,String(o.to));}let ae=new Map;for(let o of [...h.map(i=>i.prop),Te])ae.set(o,e.style.getPropertyValue(o));function j(){for(let[o,i]of ae)i?e.style.setProperty(o,i):e.style.removeProperty(o);}if(C)return Ae(),R?.(),{...n,destroy:j,getProgress:()=>1};Pe();let ue=typeof s=="string"?Ee(s):null;function Ie(){if(!p||!qe()||!ue||u!=="y"||d||ie!==e||l||m!==1||T||R||_||F||V||L||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of h)if(!Ye.has(o.prop))return false;return true}function _e(){let o=`ssd-a-${++je}`,i=h.map(f=>`${f.prop}:${f.from}`).join(";"),B=h.map(f=>`${f.prop}:${f.to}`).join(";"),A=document.createElement("style");A.setAttribute("data-ssd-animate",""),A.textContent=`@keyframes ${o}{from{${i}}to{${B}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,X=()=>u==="x"?window.innerWidth:window.innerHeight,W=()=>{let f=e.getBoundingClientRect();return ee({top:f.top,height:f.height},b(),X(),oe,se)};te(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:W});let Q={destroy(){e.classList.remove(o),A.remove(),e.style.animationPlayState="",j(),ne(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let K=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Z of h)e.style.setProperty(Z.prop,Me(Z.from,Z.to,K));},getProgress(){let{tStart:f,tEnd:K}=W();return v(z(b(),f,K,m))}};return Q}if(Ie())return _e();let y=0,E=0,w=0,D=false,S=false,$=-1,P=0,O=false,x=NaN,q=-1,ce=0,le=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function me(){let o=be(ie,d,u),i=ee(o,o.scroll,Ce(),oe,se);y=i.tStart,E=i.tEnd;}function H(o){e.style.setProperty(Te,String(o));for(let i of h)e.style.setProperty(i.prop,Me(i.from,i.to,o));T?.(o);}function Ne(o){if(isNaN(x)){x=o;return}x<=0&&o>0?_?.():x>0&&o<=0&&L?.(),x<1&&o>=1?F?.():x>=1&&o<1&&V?.(),x=o;}function G(){if(!D||S)return;let o=performance.now(),i=le(),B=m;if(g!==false){let X=o-ce,W=X>0?Math.abs(i-(q<0?i:q))/X:0;B=m*Math.max(.2,1+W*(typeof g=="number"?g:1)*.04);}q=i,ce=o;let A=E===y?0:(i-y)/(E-y);Ne(A);let b=v(z(i,y,E,B));l&&($=Math.max($,b),b=$),P=b,H(b),b>=1&&!O?(O=true,R?.()):b<1&&!l&&(O=false),w=requestAnimationFrame(G);}me(),E===y&&Y("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=v(z(le(),y,E,m));l&&o>0&&($=o),P=o,H(o);}let pe=new IntersectionObserver(o=>{o.forEach(i=>{D=i.isIntersecting,D&&!S?w=requestAnimationFrame(G):cancelAnimationFrame(w);});},{root:d??null}),U;function k(){clearTimeout(U),U=setTimeout(me,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),pe.observe(e),te(e,{type:"animate",getProgress:()=>P,getTrigger:()=>({tStart:y,tEnd:E})}),{destroy(){cancelAnimationFrame(w),pe.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(U),j(),ne(e);},replay(){$=-1,O=false,P=0,S=false,H(0);},pause(){S=true,cancelAnimationFrame(w);},resume(){S&&(S=false,D&&(w=requestAnimationFrame(G)));},seek(o){let i=Math.min(1,Math.max(0,o));P=i,$=i,S=true,cancelAnimationFrame(w),H(i);},getProgress(){return P}}}var Ge={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ue(e){let t={};e.opacity!==void 0&&(t.opacity=[e.opacity,1]);let n=[],r=[];return e.x!==void 0&&(n.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(n.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(n.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(n.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(n.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(n.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),n.length>0&&(t.transform=[n.join(" "),r.join(" ")]),t}function Qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function re(e){let t=e.trim().split(/\s+/),[n,r]=t.length>1?t:/%$/.test(t[0])?["top",t[0]]:[t[0],"bottom"];return [n,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function Le(e,t){let[n,r]=re(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function Ke(e){let t=NaN,n=0,r=0;return e.map(a=>{let s=a.getBoundingClientRect();return Math.abs(s.top-t)<=Math.max(8,Math.min(s.height,n||s.height)/2)?r++:(t=s.top,n=s.height,r=0),r})}var $e={destroy:()=>{}};function yt(e,t={}){if(typeof window>"u")return $e;let n=Qe(e);if(!n.length)return Y("scrollReveal: no elements found:",e),$e;let{preset:r="fadeUp",from:a,stagger:s=.15,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=t,g={...Ge[r],...a},M=Ue(g),I=u?.start??"top 88%",T=u?.end??"top 53%",R=Math.abs(re(I)[1]-re(T)[1]),_=Math.min(Math.max(s,0),1)*R,F=_>0?Ke(n):n.map(()=>0),V=n.map((L,C)=>{let v=Math.min(F[C]*_,R);return Re(L,{props:M,easing:m,once:l,native:false,trigger:v>0?{start:Le(I,v),end:Le(T,v)}:{start:I,end:T},onEnter:C===0?c:void 0,onLeave:C===n.length-1?p:void 0})});return {destroy(){V.forEach(L=>L.destroy());}}}exports.scrollReveal=yt;
|
package/dist/reveal/index.d.mts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface TriggerConfig {
|
|
3
|
-
start?: string;
|
|
4
|
-
end?: string;
|
|
5
|
-
}
|
|
1
|
+
import { E as EasingName, T as TriggerConfig } from '../types-DHU1zNEw.mjs';
|
|
6
2
|
|
|
7
3
|
interface ScrollRevealFrom {
|
|
8
4
|
/** Start opacity (0–1). Animates to 1. */
|
package/dist/reveal/index.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
interface TriggerConfig {
|
|
3
|
-
start?: string;
|
|
4
|
-
end?: string;
|
|
5
|
-
}
|
|
1
|
+
import { E as EasingName, T as TriggerConfig } from '../types-DHU1zNEw.js';
|
|
6
2
|
|
|
7
3
|
interface ScrollRevealFrom {
|
|
8
4
|
/** Start opacity (0–1). Animates to 1. */
|
package/dist/reveal/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function Ne({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(r),s=0,m=[];for(let c=0;c<n;c++){let p=Math.pow(a,c);m.push(p),s+=p;}let l=[0],u=0;for(let c=0;c<n;c++)u+=m[c]/s,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Fe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),a=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/r)+1}var N={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ne(),elastic:Fe()};function J(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function fe(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function ge(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function Oe(e,t,n){return Math.min(n,Math.max(t,e))}function W(e,t,n,r){return n===t?0:Oe((e-t)/(n-t)*r,0,1)}function be(e,t,n){let r=e.getBoundingClientRect(),a=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left+t.scrollLeft:r.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:n==="x"?r.left:r.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function ee(e,t,n,r,a){let s=fe(e.top,e.height,t,r.element)-ge(r.viewport,n),m=fe(e.top,e.height,t,a.element)-ge(a.viewport,n);return {tStart:s,tEnd:m}}function de(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function he(e,t,n){let r=de(e),a=de(t);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*n)},${Math.round(r[1]+(a[1]-r[1])*n)},${Math.round(r[2]+(a[2]-r[2])*n)})`}var De="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ve="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function He(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Xe(e){let t=[];for(let n=0;n<ye;n++){let r=n/(ye-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function we(e){switch(e){case "linear":return "linear";case "ease-in":return De;case "ease-out":return Ve;case "ease-in-out":return He()?Xe(N["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function ve(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function te(e,t){ve().set(e,t);}function ne(e){ve().delete(e);}var ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Y(e,...t){ke&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Be(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let a=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:r[1],nums:a,units:s});}return t}function ze(e,t,n){let r=Se(e),a=Se(t);return r.length===0||r.length!==a.length?n<1?e:t:r.map((s,m)=>{let l=a[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?n<1?`${s.fn}(${s.nums.map((u,c)=>`${u}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,c)=>`${u+(l.nums[c]-u)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function xe(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),a=String(t);if(Be(r))return he(r,a,n);if(r.includes("("))return ze(r,a,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),u=parseFloat(m[1]);return `${l+(u-l)*n}${s[2]||m[2]}`}return n<1?r:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Ye=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ge=0,Me="--scroll-draw-progress";function je(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Te(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:r,trigger:a={},easing:s="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:I,onProgress:T,onComplete:P,onEnter:C,onLeave:F,onEnterBack:O,onLeaveBack:R}=t,_=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,w=typeof s=="function"?s:N[s]??N["ease-out"],oe=J(a.start??"top bottom"),se=J(a.end??"bottom top"),ie=I??e,d=typeof c=="string"?document.querySelector(c):c??null,h=Object.entries(r).map(([o,i])=>({prop:We(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function Le(){let o=window.getComputedStyle(e);for(let i of h)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function $e(){for(let o of h)e.style.setProperty(o.prop,String(o.to));}let ae=new Map;for(let o of [...h.map(i=>i.prop),Me])ae.set(o,e.style.getPropertyValue(o));function G(){for(let[o,i]of ae)i?e.style.setProperty(o,i):e.style.removeProperty(o);}if(_)return $e(),P?.(),{...n,destroy:G,getProgress:()=>1};Le();let ue=typeof s=="string"?we(s):null;function Ae(){if(!p||!je()||!ue||u!=="y"||d||ie!==e||l||m!==1||T||P||C||F||O||R||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of h)if(!Ye.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++Ge}`,i=h.map(f=>`${f.prop}:${f.from}`).join(";"),k=h.map(f=>`${f.prop}:${f.to}`).join(";"),A=document.createElement("style");A.setAttribute("data-ssd-animate",""),A.textContent=`@keyframes ${o}{from{${i}}to{${k}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,B=()=>u==="x"?window.innerWidth:window.innerHeight,z=()=>{let f=e.getBoundingClientRect();return ee({top:f.top,height:f.height},b(),B(),oe,se)};te(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:z});let Q={destroy(){e.classList.remove(o),A.remove(),e.style.animationPlayState="",G(),ne(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let K=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Z of h)e.style.setProperty(Z.prop,xe(Z.from,Z.to,K));},getProgress(){let{tStart:f,tEnd:K}=z();return w(W(b(),f,K,m))}};return Q}if(Ae())return Ie();let y=0,E=0,v=0,D=false,S=false,L=-1,$=0,V=false,x=NaN,j=-1,ce=0,le=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function me(){let o=be(ie,d,u),i=ee(o,o.scroll,Ce(),oe,se);y=i.tStart,E=i.tEnd;}function H(o){e.style.setProperty(Me,String(o));for(let i of h)e.style.setProperty(i.prop,xe(i.from,i.to,o));T?.(o);}function _e(o){if(isNaN(x)){x=o;return}x<=0&&o>0?C?.():x>0&&o<=0&&R?.(),x<1&&o>=1?F?.():x>=1&&o<1&&O?.(),x=o;}function q(){if(!D||S)return;let o=performance.now(),i=le(),k=m;if(g!==false){let B=o-ce,z=B>0?Math.abs(i-(j<0?i:j))/B:0;k=m*Math.max(.2,1+z*(typeof g=="number"?g:1)*.04);}j=i,ce=o;let A=E===y?0:(i-y)/(E-y);_e(A);let b=w(W(i,y,E,k));l&&(L=Math.max(L,b),b=L),$=b,H(b),b>=1&&!V?(V=true,P?.()):b<1&&!l&&(V=false),v=requestAnimationFrame(q);}me(),E===y&&Y("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=w(W(le(),y,E,m));l&&o>0&&(L=o),$=o,H(o);}let pe=new IntersectionObserver(o=>{o.forEach(i=>{D=i.isIntersecting,D&&!S?v=requestAnimationFrame(q):cancelAnimationFrame(v);});},{root:d??null}),U;function X(){clearTimeout(U),U=setTimeout(me,150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),pe.observe(e),te(e,{type:"animate",getProgress:()=>$,getTrigger:()=>({tStart:y,tEnd:E})}),{destroy(){cancelAnimationFrame(v),pe.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(U),G(),ne(e);},replay(){L=-1,V=false,$=0,S=false,H(0);},pause(){S=true,cancelAnimationFrame(v);},resume(){S&&(S=false,D&&(v=requestAnimationFrame(q)));},seek(o){let i=Math.min(1,Math.max(0,o));$=i,L=i,S=true,cancelAnimationFrame(v),H(i);},getProgress(){return $}}}var qe={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function Ue(e){let t={};e.opacity!==void 0&&(t.opacity=[e.opacity,1]);let n=[],r=[];return e.x!==void 0&&(n.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(n.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(n.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(n.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(n.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(n.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),n.length>0&&(t.transform=[n.join(" "),r.join(" ")]),t}function Qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function re(e){let t=e.trim().split(/\s+/),[n,r]=t.length>1?t:/%$/.test(t[0])?["top",t[0]]:[t[0],"bottom"];return [n,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function Pe(e,t){let[n,r]=re(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function Ke(e){let t=NaN,n=0,r=0;return e.map(a=>{let s=a.getBoundingClientRect();return Math.abs(s.top-t)<=Math.max(8,Math.min(s.height,n||s.height)/2)?r++:(t=s.top,n=s.height,r=0),r})}var Re={destroy:()=>{}};function lt(e,t={}){if(typeof window>"u")return Re;let n=Qe(e);if(!n.length)return Y("scrollReveal: no elements found:",e),Re;let{preset:r="fadeUp",from:a,stagger:s=.15,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=t,g={...qe[r],...a},M=Ue(g),I=u?.start??"top 88%",T=u?.end??"top 53%",P=Math.abs(re(I)[1]-re(T)[1]),C=Math.min(Math.max(s,0),1)*P,F=C>0?Ke(n):n.map(()=>0),O=n.map((R,_)=>{let w=Math.min(F[_]*C,P);return Te(R,{props:M,easing:m,once:l,native:false,trigger:w>0?{start:Pe(I,w),end:Pe(T,w)}:{start:I,end:T},onEnter:_===0?c:void 0,onLeave:_===n.length-1?p:void 0})});return {destroy(){O.forEach(R=>R.destroy());}}}export{lt as scrollReveal};
|
|
1
|
+
import {a}from'../chunk-QJ4H2HW3.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var M={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function N(e){let r={};e.opacity!==void 0&&(r.opacity=[e.opacity,1]);let t=[],n=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),n.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),n.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),n.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),n.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),n.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),n.push("rotateY(0deg)")),t.length>0&&(r.transform=[t.join(" "),n.join(" ")]),r}function P(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function u(e){let r=e.trim().split(/\s+/),[t,n]=r.length>1?r:/%$/.test(r[0])?["top",r[0]]:[r[0],"bottom"];return [t,/%$/.test(n)?parseFloat(n):n==="top"?0:n==="center"?50:100]}function y(e,r){let[t,n]=u(e);return `${t} ${+Math.max(0,n-r).toFixed(3)}%`}function Y(e){let r=NaN,t=0,n=0;return e.map(a=>{let o=a.getBoundingClientRect();return Math.abs(o.top-r)<=Math.max(8,Math.min(o.height,t||o.height)/2)?n++:(r=o.top,t=o.height,n=0),n})}var v={destroy:()=>{}};function A(e,r={}){if(typeof window>"u")return v;let t=P(e);if(!t.length)return b("scrollReveal: no elements found:",e),v;let{preset:n="fadeUp",from:a$1,stagger:o=.15,easing:b$1="ease-out",once:R=true,trigger:d,onEnter:x,onLeave:E}=r,S={...M[n],...a$1},X=N(S),s=d?.start??"top 88%",i=d?.end??"top 53%",f=Math.abs(u(s)[1]-u(i)[1]),g=Math.min(Math.max(o,0),1)*f,$=g>0?Y(t):t.map(()=>0),L=t.map((l,c)=>{let p=Math.min($[c]*g,f);return a(l,{props:X,easing:b$1,once:R,native:false,trigger:p>0?{start:y(s,p),end:y(i,p)}:{start:s,end:i},onEnter:c===0?x:void 0,onLeave:c===t.length-1?E:void 0})});return {destroy(){L.forEach(l=>l.destroy());}}}export{A as scrollReveal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';Object.defineProperty(exports,'__esModule',{value:true});function
|
|
2
|
-
\u2014 ${t}`).join("")}`,"color: #ea654b;");}var k=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function oe(e,n){let t=[];for(let o=0;o<4;o++)for(let i=0;i<4;i++){let r=0;for(let s=0;s<4;s++)r+=e[i+4*s]*n[4*o+s];t[i+4*o]=r;}return t}function ie(e){let n=/matrix(3d)?\(([^)]+)\)/.exec(e||"");if(!n)return k();let t=n[2].split(", ").map(parseFloat);if(t.length===16)return t;let o=k();return [o[0],o[1],o[4],o[5],o[12],o[13]]=t,o}function z(e,n){let t=Math.PI/180*n,o=Math.cos(t),i=Math.sin(t),r=k(),[s,a,c,h]=e==="x"?[5,10,6,9]:e==="y"?[0,10,8,2]:[0,5,1,4];return r[s]=r[a]=o,r[c]=i,r[h]=-i,r}function re(e,n){let t=k();return t[e==="X"?12:13]=n,t}function se(e){let n=k();return n[0]=n[5]=e,n}function p(e,n){for(let t of n.split(";")){let o=t.indexOf(":");if(o<1)continue;let i=t.slice(0,o).trim(),r=t.slice(o+1).trim();i&&r&&e.style.setProperty(i,r);}}function ae(e){let{node:n,config:t}=e,o=window.getComputedStyle(n),i=(n.getAttribute("style")||"").match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[],r=i.map(d=>d.trim()),s=`${r.join("; ")};`,a=i.some(d=>/visibility\s?:\s?visible/i.test(d))?s:`${[...r,"visibility: visible"].join("; ")};`,c=parseFloat(o.opacity),h=t.opacity!==null&&!isNaN(parseFloat(String(t.opacity)))?parseFloat(String(t.opacity)):c,b=c!==h?{computed:`opacity: ${c};`,generated:`opacity: ${h};`}:{computed:"",generated:""},u=[];if(parseFloat(t.distance)){let d=t.origin==="top"||t.origin==="bottom"?"Y":"X",f=t.distance;(t.origin==="top"||t.origin==="left")&&(f=f.startsWith("-")?f.slice(1):`-${f}`);let S=f.match(/(^-?\d+\.?\d?)|(em$|px$|%$)/g)||[],m=Number(S[0]),A=S[1],L;if(A==="em")L=parseInt(o.fontSize,10)*m;else if(A==="px")L=m;else if(A==="%"){let X=n.getBoundingClientRect();L=(d==="Y"?X.height:X.width)*m/100;}else throw new RangeError("Unrecognized or missing distance unit.");u.push(re(d,L));}t.rotate.x&&u.push(z("x",t.rotate.x)),t.rotate.y&&u.push(z("y",t.rotate.y)),t.rotate.z&&u.push(z("z",t.rotate.z)),t.scale!==1&&u.push(se(t.scale===0?2e-4:t.scale));let g={initial:"",final:""};if(u.length){let d=ie(o.transform);g={initial:`transform: matrix3d(${u.reduce(oe,d).join(", ")});`,final:`transform: matrix3d(${d.join(", ")});`};}let w={delayed:"",instant:""};if(b.generated||g.initial){let d=m=>`${m/1e3}s`,f=[],S=m=>({delayed:`${m} ${d(t.duration)} ${t.easing} ${d(t.delay)}`,instant:`${m} ${d(t.duration)} ${t.easing} 0s`});o.transition&&!/all 0s|none 0s/.test(o.transition)&&f.push({delayed:o.transition,instant:o.transition}),b.generated&&f.push(S("opacity")),g.initial&&f.push(S("transform")),w={delayed:`transition: ${f.map(m=>m.delayed).join(", ")};`,instant:`transition: ${f.map(m=>m.instant).join(", ")};`};}return {inline:{computed:s,generated:a},opacity:b,position:o.position,transform:g,transition:w}}var x=(...e)=>e.filter(n=>n!=="").join(" "),le=()=>({delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.5, 0, 0, 1)",interval:0,opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,cleanup:false,container:document.documentElement,desktop:true,mobile:true,reset:false,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:()=>{},afterReveal:()=>{},beforeReset:()=>{},beforeReveal:()=>{}}),v=null,T=null,l={containers:{},elements:{},history:[],sequences:{}},G=true,O=null,R=0,Q=false,ce=0,H=()=>ce++;function V(e,n=false){let t=e,o=n?t.clientHeight:t.offsetHeight,i=n?t.clientWidth:t.offsetWidth,r=0,s=0,a=t;for(;a;)isNaN(a.offsetTop)||(r+=a.offsetTop),isNaN(a.offsetLeft)||(s+=a.offsetLeft),a=a.offsetParent;return {bounds:{top:r,right:s+i,bottom:r+o,left:s},height:o,width:i}}var de=e=>e.node===document.documentElement?{top:window.pageYOffset,left:window.pageXOffset}:{top:e.node.scrollTop,left:e.node.scrollLeft};function ue(e){let n=l.containers[e.containerId];if(!n||!n.geometry||!n.scroll||!e.geometry)return false;let t=Math.max(0,Math.min(1,e.config.viewFactor)),o=e.config.viewOffset,i=e.geometry,r={top:i.bounds.top+i.height*t,right:i.bounds.right-i.width*t,bottom:i.bounds.bottom-i.height*t,left:i.bounds.left+i.width*t},s={top:n.geometry.bounds.top+n.scroll.top+o.top,right:n.geometry.bounds.right+n.scroll.left-o.right,bottom:n.geometry.bounds.bottom+n.scroll.top-o.bottom,left:n.geometry.bounds.left+n.scroll.left+o.left};return r.top<s.bottom&&r.right>s.left&&r.bottom>s.top&&r.left<s.right||e.styles.position==="fixed"}function K(e,n=false){let t=n?e.config.duration+e.config.delay:e.config.duration,o=0;e.timer&&(o=Date.now()-e.timer.start,clearTimeout(e.timer.clock)),(e.revealed?e.config.beforeReveal:e.config.beforeReset)(e.node),e.timer={start:Date.now(),clock:setTimeout(()=>{(e.revealed?e.config.afterReveal:e.config.afterReset)(e.node),e.timer=null,e.revealed&&!e.config.reset&&e.config.cleanup&&W(e.node);},t-o)};}function fe(e,n){let t=e.styles;e.revealed=e.seen=true,p(e.node,x(t.inline.generated,t.opacity.computed,t.transform.final,n?t.transition.delayed:t.transition.instant)),K(e,n);}function me(e){let n=e.styles;e.revealed=false,p(e.node,x(n.inline.generated,n.opacity.generated,n.transform.initial,n.transition.instant)),K(e);}function M(e,n={}){let t=n.pristine||G,o=e.config.useDelay,i=o==="always"||o==="onload"&&t||o==="once"&&!e.seen;if(n.reveal||e.visible&&!e.revealed)return fe(e,i);if(n.reset||!e.visible&&e.revealed&&e.config.reset)return me(e)}function U(e,n){let t=[],o=[],i=[];return e.members.forEach((r,s)=>{l.elements[r]?.[n]&&o.push(s);}),o.length&&e.members.forEach((r,s)=>{let a=l.elements[r];a&&!a[n]&&(s<o[0]?t:i).push(s);}),{head:t,body:o,foot:i}}function I(e,n,t,o){let i=t<0?"head":"foot",r=l.elements[e.members[n+t]];e.blocked[i]=true,setTimeout(()=>{e.blocked[i]=false,r&&Z(r,o);},e.interval);}function Z(e,n=G){if(!e.visible&&e.revealed&&e.config.reset)return M(e,{reset:true});let t=e.sequence&&l.sequences[e.sequence.id];if(!t||!e.sequence)return;let o=e.sequence.index,i=U(t,"visible"),r=U(t,"revealed");if(!r.body.length){let a=i.body[0],c=l.elements[t.members[a]];if(c)return I(t,a,-1,n),I(t,a,1,n),M(c,{reveal:true,pristine:n})}let s=a=>a[a.length-1];if(!t.blocked.head&&o===s(r.head)&&o>=(i.body[0]??1/0))return I(t,o,-1,n),M(e,{reveal:true,pristine:n});if(!t.blocked.foot&&o===r.foot[0]&&o<=(s(i.body)??-1/0))return I(t,o,1,n),M(e,{reveal:true,pristine:n})}function be(){R=0;let e=Q;Q=false;for(let t of Object.values(l.containers))(e||!t.geometry)&&(t.geometry=V(t.node,true)),t.scroll=de(t);let n=Object.values(l.elements);for(let t of n)(e||!t.geometry)&&(t.geometry=V(t.node)),t.visible=ue(t);for(let t of n)t.sequence?Z(t):M(t);G=false;}function y(e){let n=e?e.type:"init";(n==="init"||n==="resize")&&(Q=true),R||(R=requestAnimationFrame(be));}var E=e=>e.node===document.documentElement?window:e.node;function _(){let e=new Set(Array.from(document.querySelectorAll("[data-sr-id]")).map(o=>parseInt(o.getAttribute("data-sr-id")||"",10)));for(let o of Object.values(l.elements))e.has(o.id)||delete l.elements[o.id];let n=new Set,t=new Set;for(let o of Object.values(l.elements))n.add(o.containerId),o.sequence&&t.add(o.sequence.id);for(let o of Object.values(l.containers))n.has(o.id)||(E(o).removeEventListener("scroll",y),E(o).removeEventListener("resize",y),delete l.containers[o.id]);for(let o of Object.values(l.sequences))t.has(o.id)||delete l.sequences[o.id];}function ee(){O=null,_();let e=Y();for(let n of Object.values(l.elements)){let t=n.styles;e?(n.visible=n.revealed=n.seen=true,p(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final,"transition: none;"))):n.visible?(n.revealed=true,p(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final))):(n.revealed=false,p(n.node,x(t.inline.generated,t.opacity.generated,t.transform.initial)));}if(!e){for(let n of Object.values(l.containers))E(n).addEventListener("scroll",y),E(n).addEventListener("resize",y);y();}}function te(e,n={},t=false){if(!v)return;let o=[],i=n.interval||0,r,s;try{if(i){let c=Math.abs(i);if(isNaN(c))throw new RangeError("Invalid sequence interval.");r={id:H(),interval:Math.max(c,16),members:[],blocked:{head:!1,foot:!1}};}let a=j(e);if(!a.length)throw new Error("Invalid reveal target.");s=[];for(let c of a){let h=c.getAttribute("data-sr-id"),b=h!==null?l.elements[Number(h)]:void 0,u=b?q({},b):{id:H(),node:c,seen:!1,revealed:!1,visible:!1};b&&p(c,b.styles.inline.computed);let g=q({},b?b.config:v,n);if(!g.mobile&&$()||!g.desktop&&!$()){b&&W(c);continue}let w=j(g.container)[0];if(!w)throw new Error("Invalid container.");if(!w.contains(c))continue;let d=[...o,...Object.values(l.containers)].find(f=>f.node===w)?.id;d===void 0&&(d=H(),o.push({id:d,node:w})),u.config=g,u.containerId=d,u.styles=ae(u),r&&(u.sequence={id:r.id,index:r.members.length},r.members.push(u.id)),s.push(u);}for(let c of s)l.elements[c.id]=c,c.node.setAttribute("data-sr-id",String(c.id));}catch(a){return P("Reveal failed.",a.message)}for(let a of o)l.containers[a.id]=a;r&&(l.sequences[r.id]=r),t||(l.history.push({target:e,options:n}),O&&clearTimeout(O),O=setTimeout(ee,0));}function W(e){let n=false;for(let t of j(e)){let o=t.getAttribute("data-sr-id");if(o===null)continue;n=true;let i=l.elements[Number(o)];i&&(i.timer&&clearTimeout(i.timer.clock),p(i.node,i.styles.inline.generated),delete l.elements[i.id]),t.removeAttribute("data-sr-id");}n&&_();}function ge(){for(let e of Object.values(l.elements))p(e.node,e.styles.inline.generated),e.node.removeAttribute("data-sr-id");for(let e of Object.values(l.containers))E(e).removeEventListener("scroll",y),E(e).removeEventListener("resize",y);R&&cancelAnimationFrame(R),R=0,l={containers:{},elements:{},history:[],sequences:{}};}function ve(){for(let e of l.history)te(e.target,e.options,true);ee();}var N=()=>(D()&&document.documentElement.classList.remove("sr"),{reveal(){},clean(){},destroy(){},sync(){},defaults:{},version:J,noop:true});function ne(){if(!D())return false;let e=document.documentElement.style;return ("transform"in e||"WebkitTransform"in e)&&("transition"in e||"WebkitTransition"in e)}function pe(){document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",()=>{document.body.style.height="100%";},{once:true});}function ye(e={}){if(!D()||!ne())return N();let n;try{if(n=q({},v??le(),e),!j(n.container)[0])throw new Error("Invalid container.")}catch(t){return P("Invalid configuration.",t.message),N()}return v=n,!v.mobile&&$()||!v.desktop&&!$()?(P("This device is disabled.",`desktop: ${v.desktop}`,`mobile: ${v.mobile}`),N()):(pe(),T||(T={reveal:(t,o)=>te(t,o),clean:W,destroy:ge,sync:ve,get defaults(){return v},version:J,noop:false},Object.defineProperty(T,"delegate",{value:y})),T)}var B=ye;B.isSupported=ne;Object.defineProperty(B,"debug",{get:()=>F,set:e=>{typeof e=="boolean"&&(F=e);}});var Re=B;exports.ScrollReveal=B;exports.default=Re;
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});function V(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}var K="4.0.9",G=()=>typeof window<"u"&&typeof document<"u",C=e=>e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]";function q(e,...n){for(let t of n)if(C(t))for(let o of Object.keys(t)){let i=t[o];C(i)?(C(e[o])||(e[o]={}),q(e[o],i)):e[o]=i;}return e}function L(e){if(typeof e=="string")try{return Array.from(document.querySelectorAll(e))}catch{return []}return e instanceof Element?[e]:e&&typeof e.length=="number"?Array.from(e).filter(n=>n instanceof Element):[]}var $=(e=navigator.userAgent)=>/Android|iPhone|iPad|iPod/i.test(e),F=false;function P(e,...n){F&&typeof console<"u"&&console.log(`%cScrollReveal: ${e}${n.map(t=>`
|
|
2
|
+
\u2014 ${t}`).join("")}`,"color: #ea654b;");}var T=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function oe(e,n){let t=[];for(let o=0;o<4;o++)for(let i=0;i<4;i++){let r=0;for(let s=0;s<4;s++)r+=e[i+4*s]*n[4*o+s];t[i+4*o]=r;}return t}function ie(e){let n=/matrix(3d)?\(([^)]+)\)/.exec(e||"");if(!n)return T();let t=n[2].split(", ").map(parseFloat);if(t.length===16)return t;let o=T();return [o[0],o[1],o[4],o[5],o[12],o[13]]=t,o}function z(e,n){let t=Math.PI/180*n,o=Math.cos(t),i=Math.sin(t),r=T(),[s,a,c,h]=e==="x"?[5,10,6,9]:e==="y"?[0,10,8,2]:[0,5,1,4];return r[s]=r[a]=o,r[c]=i,r[h]=-i,r}function re(e,n){let t=T();return t[e==="X"?12:13]=n,t}function se(e){let n=T();return n[0]=n[5]=e,n}function v(e,n){for(let t of n.split(";")){let o=t.indexOf(":");if(o<1)continue;let i=t.slice(0,o).trim(),r=t.slice(o+1).trim();i&&r&&e.style.setProperty(i,r);}}function ae(e){let{node:n,config:t}=e,o=window.getComputedStyle(n),i=(n.getAttribute("style")||"").match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[],r=i.map(d=>d.trim()),s=`${r.join("; ")};`,a=i.some(d=>/visibility\s?:\s?visible/i.test(d))?s:`${[...r,"visibility: visible"].join("; ")};`,c=parseFloat(o.opacity),h=t.opacity!==null&&!isNaN(parseFloat(String(t.opacity)))?parseFloat(String(t.opacity)):c,b=c!==h?{computed:`opacity: ${c};`,generated:`opacity: ${h};`}:{computed:"",generated:""},u=[];if(parseFloat(t.distance)){let d=t.origin==="top"||t.origin==="bottom"?"Y":"X",f=t.distance;(t.origin==="top"||t.origin==="left")&&(f=f.startsWith("-")?f.slice(1):`-${f}`);let E=f.match(/(^-?\d+\.?\d?)|(em$|px$|%$)/g)||[],m=Number(E[0]),A=E[1],I;if(A==="em")I=parseInt(o.fontSize,10)*m;else if(A==="px")I=m;else if(A==="%"){let Y=n.getBoundingClientRect();I=(d==="Y"?Y.height:Y.width)*m/100;}else throw new RangeError("Unrecognized or missing distance unit.");u.push(re(d,I));}t.rotate.x&&u.push(z("x",t.rotate.x)),t.rotate.y&&u.push(z("y",t.rotate.y)),t.rotate.z&&u.push(z("z",t.rotate.z)),t.scale!==1&&u.push(se(t.scale===0?2e-4:t.scale));let g={initial:"",final:""};if(u.length){let d=ie(o.transform);g={initial:`transform: matrix3d(${u.reduce(oe,d).join(", ")});`,final:`transform: matrix3d(${d.join(", ")});`};}let w={delayed:"",instant:""};if(b.generated||g.initial){let d=m=>`${m/1e3}s`,f=[],E=m=>({delayed:`${m} ${d(t.duration)} ${t.easing} ${d(t.delay)}`,instant:`${m} ${d(t.duration)} ${t.easing} 0s`});o.transition&&!/all 0s|none 0s/.test(o.transition)&&f.push({delayed:o.transition,instant:o.transition}),b.generated&&f.push(E("opacity")),g.initial&&f.push(E("transform")),w={delayed:`transition: ${f.map(m=>m.delayed).join(", ")};`,instant:`transition: ${f.map(m=>m.instant).join(", ")};`};}return {inline:{computed:s,generated:a},opacity:b,position:o.position,transform:g,transition:w}}var x=(...e)=>e.filter(n=>n!=="").join(" "),le=()=>({delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.5, 0, 0, 1)",interval:0,opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,cleanup:false,container:document.documentElement,desktop:true,mobile:true,reset:false,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:()=>{},afterReveal:()=>{},beforeReset:()=>{},beforeReveal:()=>{}}),p=null,M=null,l={containers:{},elements:{},history:[],sequences:{}},W=true,j=null,R=0,D=false,ce=0,H=()=>ce++;function U(e,n=false){let t=e,o=n?t.clientHeight:t.offsetHeight,i=n?t.clientWidth:t.offsetWidth,r=0,s=0,a=t;for(;a;)isNaN(a.offsetTop)||(r+=a.offsetTop),isNaN(a.offsetLeft)||(s+=a.offsetLeft),a=a.offsetParent;return {bounds:{top:r,right:s+i,bottom:r+o,left:s},height:o,width:i}}var de=e=>e.node===document.documentElement?{top:window.pageYOffset,left:window.pageXOffset}:{top:e.node.scrollTop,left:e.node.scrollLeft};function ue(e){let n=l.containers[e.containerId];if(!n||!n.geometry||!n.scroll||!e.geometry)return false;let t=Math.max(0,Math.min(1,e.config.viewFactor)),o=e.config.viewOffset,i=e.geometry,r={top:i.bounds.top+i.height*t,right:i.bounds.right-i.width*t,bottom:i.bounds.bottom-i.height*t,left:i.bounds.left+i.width*t},s={top:n.geometry.bounds.top+n.scroll.top+o.top,right:n.geometry.bounds.right+n.scroll.left-o.right,bottom:n.geometry.bounds.bottom+n.scroll.top-o.bottom,left:n.geometry.bounds.left+n.scroll.left+o.left};return r.top<s.bottom&&r.right>s.left&&r.bottom>s.top&&r.left<s.right||e.styles.position==="fixed"}function Q(e,n=false){let t=n?e.config.duration+e.config.delay:e.config.duration,o=0;e.timer&&(o=Date.now()-e.timer.start,clearTimeout(e.timer.clock)),(e.revealed?e.config.beforeReveal:e.config.beforeReset)(e.node),e.timer={start:Date.now(),clock:setTimeout(()=>{(e.revealed?e.config.afterReveal:e.config.afterReset)(e.node),e.timer=null,e.revealed&&!e.config.reset&&e.config.cleanup&&B(e.node);},t-o)};}function fe(e,n){let t=e.styles;e.revealed=e.seen=true,v(e.node,x(t.inline.generated,t.opacity.computed,t.transform.final,n?t.transition.delayed:t.transition.instant)),Q(e,n);}function me(e){let n=e.styles;e.revealed=false,v(e.node,x(n.inline.generated,n.opacity.generated,n.transform.initial,n.transition.instant)),Q(e);}function k(e,n={}){let t=n.pristine||W,o=e.config.useDelay,i=o==="always"||o==="onload"&&t||o==="once"&&!e.seen;if(n.reveal||e.visible&&!e.revealed)return fe(e,i);if(n.reset||!e.visible&&e.revealed&&e.config.reset)return me(e)}function J(e,n){let t=[],o=[],i=[];return e.members.forEach((r,s)=>{l.elements[r]?.[n]&&o.push(s);}),o.length&&e.members.forEach((r,s)=>{let a=l.elements[r];a&&!a[n]&&(s<o[0]?t:i).push(s);}),{head:t,body:o,foot:i}}function O(e,n,t,o){let i=t<0?"head":"foot",r=l.elements[e.members[n+t]];e.blocked[i]=true,setTimeout(()=>{e.blocked[i]=false,r&&Z(r,o);},e.interval);}function Z(e,n=W){if(!e.visible&&e.revealed&&e.config.reset)return k(e,{reset:true});let t=e.sequence&&l.sequences[e.sequence.id];if(!t||!e.sequence)return;let o=e.sequence.index,i=J(t,"visible"),r=J(t,"revealed");if(!r.body.length){let a=i.body[0],c=l.elements[t.members[a]];if(c)return O(t,a,-1,n),O(t,a,1,n),k(c,{reveal:true,pristine:n})}let s=a=>a[a.length-1];if(!t.blocked.head&&o===s(r.head)&&o>=(i.body[0]??1/0))return O(t,o,-1,n),k(e,{reveal:true,pristine:n});if(!t.blocked.foot&&o===r.foot[0]&&o<=(s(i.body)??-1/0))return O(t,o,1,n),k(e,{reveal:true,pristine:n})}function be(){R=0;let e=D;D=false;for(let t of Object.values(l.containers))(e||!t.geometry)&&(t.geometry=U(t.node,true)),t.scroll=de(t);let n=Object.values(l.elements);for(let t of n)(e||!t.geometry)&&(t.geometry=U(t.node)),t.visible=ue(t);for(let t of n)t.sequence?Z(t):k(t);W=false;}function y(e){let n=e?e.type:"init";(n==="init"||n==="resize")&&(D=true),R||(R=requestAnimationFrame(be));}var S=e=>e.node===document.documentElement?window:e.node;function _(){let e=new Set(Array.from(document.querySelectorAll("[data-sr-id]")).map(o=>parseInt(o.getAttribute("data-sr-id")||"",10)));for(let o of Object.values(l.elements))e.has(o.id)||delete l.elements[o.id];let n=new Set,t=new Set;for(let o of Object.values(l.elements))n.add(o.containerId),o.sequence&&t.add(o.sequence.id);for(let o of Object.values(l.containers))n.has(o.id)||(S(o).removeEventListener("scroll",y),S(o).removeEventListener("resize",y),delete l.containers[o.id]);for(let o of Object.values(l.sequences))t.has(o.id)||delete l.sequences[o.id];}function ee(){j=null,_();let e=V();for(let n of Object.values(l.elements)){let t=n.styles;e?(n.visible=n.revealed=n.seen=true,v(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final,"transition: none;"))):n.visible?(n.revealed=true,v(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final))):(n.revealed=false,v(n.node,x(t.inline.generated,t.opacity.generated,t.transform.initial)));}if(!e){for(let n of Object.values(l.containers))S(n).addEventListener("scroll",y),S(n).addEventListener("resize",y);y();}}function te(e,n={},t=false){if(!p)return;let o=[],i=n.interval||0,r,s;try{if(i){let c=Math.abs(i);if(isNaN(c))throw new RangeError("Invalid sequence interval.");r={id:H(),interval:Math.max(c,16),members:[],blocked:{head:!1,foot:!1}};}let a=L(e);if(!a.length)throw new Error("Invalid reveal target.");s=[];for(let c of a){let h=c.getAttribute("data-sr-id"),b=h!==null?l.elements[Number(h)]:void 0,u=b?q({},b):{id:H(),node:c,seen:!1,revealed:!1,visible:!1};b&&v(c,b.styles.inline.computed);let g=q({},b?b.config:p,n);if(!g.mobile&&$()||!g.desktop&&!$()){b&&B(c);continue}let w=L(g.container)[0];if(!w)throw new Error("Invalid container.");if(!w.contains(c))continue;let d=[...o,...Object.values(l.containers)].find(f=>f.node===w)?.id;d===void 0&&(d=H(),o.push({id:d,node:w})),u.config=g,u.containerId=d,u.styles=ae(u),r&&(u.sequence={id:r.id,index:r.members.length},r.members.push(u.id)),s.push(u);}for(let c of s)l.elements[c.id]=c,c.node.setAttribute("data-sr-id",String(c.id));}catch(a){return P("Reveal failed.",a.message)}for(let a of o)l.containers[a.id]=a;r&&(l.sequences[r.id]=r),t||(l.history.push({target:e,options:n}),j&&clearTimeout(j),j=setTimeout(ee,0));}function B(e){let n=false;for(let t of L(e)){let o=t.getAttribute("data-sr-id");if(o===null)continue;n=true;let i=l.elements[Number(o)];i&&(i.timer&&clearTimeout(i.timer.clock),v(i.node,i.styles.inline.generated),delete l.elements[i.id]),t.removeAttribute("data-sr-id");}n&&_();}function ge(){for(let e of Object.values(l.elements))v(e.node,e.styles.inline.generated),e.node.removeAttribute("data-sr-id");for(let e of Object.values(l.containers))S(e).removeEventListener("scroll",y),S(e).removeEventListener("resize",y);R&&cancelAnimationFrame(R),R=0,l={containers:{},elements:{},history:[],sequences:{}};}function pe(){for(let e of l.history)te(e.target,e.options,true);ee();}var N=()=>(G()&&document.documentElement.classList.remove("sr"),{reveal(){},clean(){},destroy(){},sync(){},defaults:{},version:K,noop:true});function ne(){if(!G())return false;let e=document.documentElement.style;return ("transform"in e||"WebkitTransform"in e)&&("transition"in e||"WebkitTransition"in e)}function ve(){document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",()=>{document.body.style.height="100%";},{once:true});}function ye(e={}){if(!G()||!ne())return N();let n;try{if(n=q({},p??le(),e),!L(n.container)[0])throw new Error("Invalid container.")}catch(t){return P("Invalid configuration.",t.message),N()}return p=n,!p.mobile&&$()||!p.desktop&&!$()?(P("This device is disabled.",`desktop: ${p.desktop}`,`mobile: ${p.mobile}`),N()):(ve(),M||(M={reveal:(t,o)=>te(t,o),clean:B,destroy:ge,sync:pe,get defaults(){return p},version:K,noop:false},Object.defineProperty(M,"delegate",{value:y})),M)}var X=ye;X.isSupported=ne;Object.defineProperty(X,"debug",{get:()=>F,set:e=>{typeof e=="boolean"&&(F=e);}});var Re=X;exports.ScrollReveal=X;exports.default=Re;
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
\u2014 ${t}`).join("")}`,"color: #ea654b;");}var k=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function oe(e,n){let t=[];for(let o=0;o<4;o++)for(let i=0;i<4;i++){let r=0;for(let s=0;s<4;s++)r+=e[i+4*s]*n[4*o+s];t[i+4*o]=r;}return t}function ie(e){let n=/matrix(3d)?\(([^)]+)\)/.exec(e||"");if(!n)return k();let t=n[2].split(", ").map(parseFloat);if(t.length===16)return t;let o=k();return [o[0],o[1],o[4],o[5],o[12],o[13]]=t,o}function z(e,n){let t=Math.PI/180*n,o=Math.cos(t),i=Math.sin(t),r=k(),[s,a,c,h]=e==="x"?[5,10,6,9]:e==="y"?[0,10,8,2]:[0,5,1,4];return r[s]=r[a]=o,r[c]=i,r[h]=-i,r}function re(e,n){let t=k();return t[e==="X"?12:13]=n,t}function se(e){let n=k();return n[0]=n[5]=e,n}function p(e,n){for(let t of n.split(";")){let o=t.indexOf(":");if(o<1)continue;let i=t.slice(0,o).trim(),r=t.slice(o+1).trim();i&&r&&e.style.setProperty(i,r);}}function ae(e){let{node:n,config:t}=e,o=window.getComputedStyle(n),i=(n.getAttribute("style")||"").match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[],r=i.map(d=>d.trim()),s=`${r.join("; ")};`,a=i.some(d=>/visibility\s?:\s?visible/i.test(d))?s:`${[...r,"visibility: visible"].join("; ")};`,c=parseFloat(o.opacity),h=t.opacity!==null&&!isNaN(parseFloat(String(t.opacity)))?parseFloat(String(t.opacity)):c,b=c!==h?{computed:`opacity: ${c};`,generated:`opacity: ${h};`}:{computed:"",generated:""},u=[];if(parseFloat(t.distance)){let d=t.origin==="top"||t.origin==="bottom"?"Y":"X",f=t.distance;(t.origin==="top"||t.origin==="left")&&(f=f.startsWith("-")?f.slice(1):`-${f}`);let S=f.match(/(^-?\d+\.?\d?)|(em$|px$|%$)/g)||[],m=Number(S[0]),A=S[1],L;if(A==="em")L=parseInt(o.fontSize,10)*m;else if(A==="px")L=m;else if(A==="%"){let X=n.getBoundingClientRect();L=(d==="Y"?X.height:X.width)*m/100;}else throw new RangeError("Unrecognized or missing distance unit.");u.push(re(d,L));}t.rotate.x&&u.push(z("x",t.rotate.x)),t.rotate.y&&u.push(z("y",t.rotate.y)),t.rotate.z&&u.push(z("z",t.rotate.z)),t.scale!==1&&u.push(se(t.scale===0?2e-4:t.scale));let g={initial:"",final:""};if(u.length){let d=ie(o.transform);g={initial:`transform: matrix3d(${u.reduce(oe,d).join(", ")});`,final:`transform: matrix3d(${d.join(", ")});`};}let w={delayed:"",instant:""};if(b.generated||g.initial){let d=m=>`${m/1e3}s`,f=[],S=m=>({delayed:`${m} ${d(t.duration)} ${t.easing} ${d(t.delay)}`,instant:`${m} ${d(t.duration)} ${t.easing} 0s`});o.transition&&!/all 0s|none 0s/.test(o.transition)&&f.push({delayed:o.transition,instant:o.transition}),b.generated&&f.push(S("opacity")),g.initial&&f.push(S("transform")),w={delayed:`transition: ${f.map(m=>m.delayed).join(", ")};`,instant:`transition: ${f.map(m=>m.instant).join(", ")};`};}return {inline:{computed:s,generated:a},opacity:b,position:o.position,transform:g,transition:w}}var x=(...e)=>e.filter(n=>n!=="").join(" "),le=()=>({delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.5, 0, 0, 1)",interval:0,opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,cleanup:false,container:document.documentElement,desktop:true,mobile:true,reset:false,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:()=>{},afterReveal:()=>{},beforeReset:()=>{},beforeReveal:()=>{}}),v=null,T=null,l={containers:{},elements:{},history:[],sequences:{}},G=true,O=null,R=0,Q=false,ce=0,H=()=>ce++;function V(e,n=false){let t=e,o=n?t.clientHeight:t.offsetHeight,i=n?t.clientWidth:t.offsetWidth,r=0,s=0,a=t;for(;a;)isNaN(a.offsetTop)||(r+=a.offsetTop),isNaN(a.offsetLeft)||(s+=a.offsetLeft),a=a.offsetParent;return {bounds:{top:r,right:s+i,bottom:r+o,left:s},height:o,width:i}}var de=e=>e.node===document.documentElement?{top:window.pageYOffset,left:window.pageXOffset}:{top:e.node.scrollTop,left:e.node.scrollLeft};function ue(e){let n=l.containers[e.containerId];if(!n||!n.geometry||!n.scroll||!e.geometry)return false;let t=Math.max(0,Math.min(1,e.config.viewFactor)),o=e.config.viewOffset,i=e.geometry,r={top:i.bounds.top+i.height*t,right:i.bounds.right-i.width*t,bottom:i.bounds.bottom-i.height*t,left:i.bounds.left+i.width*t},s={top:n.geometry.bounds.top+n.scroll.top+o.top,right:n.geometry.bounds.right+n.scroll.left-o.right,bottom:n.geometry.bounds.bottom+n.scroll.top-o.bottom,left:n.geometry.bounds.left+n.scroll.left+o.left};return r.top<s.bottom&&r.right>s.left&&r.bottom>s.top&&r.left<s.right||e.styles.position==="fixed"}function K(e,n=false){let t=n?e.config.duration+e.config.delay:e.config.duration,o=0;e.timer&&(o=Date.now()-e.timer.start,clearTimeout(e.timer.clock)),(e.revealed?e.config.beforeReveal:e.config.beforeReset)(e.node),e.timer={start:Date.now(),clock:setTimeout(()=>{(e.revealed?e.config.afterReveal:e.config.afterReset)(e.node),e.timer=null,e.revealed&&!e.config.reset&&e.config.cleanup&&W(e.node);},t-o)};}function fe(e,n){let t=e.styles;e.revealed=e.seen=true,p(e.node,x(t.inline.generated,t.opacity.computed,t.transform.final,n?t.transition.delayed:t.transition.instant)),K(e,n);}function me(e){let n=e.styles;e.revealed=false,p(e.node,x(n.inline.generated,n.opacity.generated,n.transform.initial,n.transition.instant)),K(e);}function M(e,n={}){let t=n.pristine||G,o=e.config.useDelay,i=o==="always"||o==="onload"&&t||o==="once"&&!e.seen;if(n.reveal||e.visible&&!e.revealed)return fe(e,i);if(n.reset||!e.visible&&e.revealed&&e.config.reset)return me(e)}function U(e,n){let t=[],o=[],i=[];return e.members.forEach((r,s)=>{l.elements[r]?.[n]&&o.push(s);}),o.length&&e.members.forEach((r,s)=>{let a=l.elements[r];a&&!a[n]&&(s<o[0]?t:i).push(s);}),{head:t,body:o,foot:i}}function I(e,n,t,o){let i=t<0?"head":"foot",r=l.elements[e.members[n+t]];e.blocked[i]=true,setTimeout(()=>{e.blocked[i]=false,r&&Z(r,o);},e.interval);}function Z(e,n=G){if(!e.visible&&e.revealed&&e.config.reset)return M(e,{reset:true});let t=e.sequence&&l.sequences[e.sequence.id];if(!t||!e.sequence)return;let o=e.sequence.index,i=U(t,"visible"),r=U(t,"revealed");if(!r.body.length){let a=i.body[0],c=l.elements[t.members[a]];if(c)return I(t,a,-1,n),I(t,a,1,n),M(c,{reveal:true,pristine:n})}let s=a=>a[a.length-1];if(!t.blocked.head&&o===s(r.head)&&o>=(i.body[0]??1/0))return I(t,o,-1,n),M(e,{reveal:true,pristine:n});if(!t.blocked.foot&&o===r.foot[0]&&o<=(s(i.body)??-1/0))return I(t,o,1,n),M(e,{reveal:true,pristine:n})}function be(){R=0;let e=Q;Q=false;for(let t of Object.values(l.containers))(e||!t.geometry)&&(t.geometry=V(t.node,true)),t.scroll=de(t);let n=Object.values(l.elements);for(let t of n)(e||!t.geometry)&&(t.geometry=V(t.node)),t.visible=ue(t);for(let t of n)t.sequence?Z(t):M(t);G=false;}function y(e){let n=e?e.type:"init";(n==="init"||n==="resize")&&(Q=true),R||(R=requestAnimationFrame(be));}var E=e=>e.node===document.documentElement?window:e.node;function _(){let e=new Set(Array.from(document.querySelectorAll("[data-sr-id]")).map(o=>parseInt(o.getAttribute("data-sr-id")||"",10)));for(let o of Object.values(l.elements))e.has(o.id)||delete l.elements[o.id];let n=new Set,t=new Set;for(let o of Object.values(l.elements))n.add(o.containerId),o.sequence&&t.add(o.sequence.id);for(let o of Object.values(l.containers))n.has(o.id)||(E(o).removeEventListener("scroll",y),E(o).removeEventListener("resize",y),delete l.containers[o.id]);for(let o of Object.values(l.sequences))t.has(o.id)||delete l.sequences[o.id];}function ee(){O=null,_();let e=Y();for(let n of Object.values(l.elements)){let t=n.styles;e?(n.visible=n.revealed=n.seen=true,p(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final,"transition: none;"))):n.visible?(n.revealed=true,p(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final))):(n.revealed=false,p(n.node,x(t.inline.generated,t.opacity.generated,t.transform.initial)));}if(!e){for(let n of Object.values(l.containers))E(n).addEventListener("scroll",y),E(n).addEventListener("resize",y);y();}}function te(e,n={},t=false){if(!v)return;let o=[],i=n.interval||0,r,s;try{if(i){let c=Math.abs(i);if(isNaN(c))throw new RangeError("Invalid sequence interval.");r={id:H(),interval:Math.max(c,16),members:[],blocked:{head:!1,foot:!1}};}let a=j(e);if(!a.length)throw new Error("Invalid reveal target.");s=[];for(let c of a){let h=c.getAttribute("data-sr-id"),b=h!==null?l.elements[Number(h)]:void 0,u=b?q({},b):{id:H(),node:c,seen:!1,revealed:!1,visible:!1};b&&p(c,b.styles.inline.computed);let g=q({},b?b.config:v,n);if(!g.mobile&&$()||!g.desktop&&!$()){b&&W(c);continue}let w=j(g.container)[0];if(!w)throw new Error("Invalid container.");if(!w.contains(c))continue;let d=[...o,...Object.values(l.containers)].find(f=>f.node===w)?.id;d===void 0&&(d=H(),o.push({id:d,node:w})),u.config=g,u.containerId=d,u.styles=ae(u),r&&(u.sequence={id:r.id,index:r.members.length},r.members.push(u.id)),s.push(u);}for(let c of s)l.elements[c.id]=c,c.node.setAttribute("data-sr-id",String(c.id));}catch(a){return P("Reveal failed.",a.message)}for(let a of o)l.containers[a.id]=a;r&&(l.sequences[r.id]=r),t||(l.history.push({target:e,options:n}),O&&clearTimeout(O),O=setTimeout(ee,0));}function W(e){let n=false;for(let t of j(e)){let o=t.getAttribute("data-sr-id");if(o===null)continue;n=true;let i=l.elements[Number(o)];i&&(i.timer&&clearTimeout(i.timer.clock),p(i.node,i.styles.inline.generated),delete l.elements[i.id]),t.removeAttribute("data-sr-id");}n&&_();}function ge(){for(let e of Object.values(l.elements))p(e.node,e.styles.inline.generated),e.node.removeAttribute("data-sr-id");for(let e of Object.values(l.containers))E(e).removeEventListener("scroll",y),E(e).removeEventListener("resize",y);R&&cancelAnimationFrame(R),R=0,l={containers:{},elements:{},history:[],sequences:{}};}function ve(){for(let e of l.history)te(e.target,e.options,true);ee();}var N=()=>(D()&&document.documentElement.classList.remove("sr"),{reveal(){},clean(){},destroy(){},sync(){},defaults:{},version:J,noop:true});function ne(){if(!D())return false;let e=document.documentElement.style;return ("transform"in e||"WebkitTransform"in e)&&("transition"in e||"WebkitTransition"in e)}function pe(){document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",()=>{document.body.style.height="100%";},{once:true});}function ye(e={}){if(!D()||!ne())return N();let n;try{if(n=q({},v??le(),e),!j(n.container)[0])throw new Error("Invalid container.")}catch(t){return P("Invalid configuration.",t.message),N()}return v=n,!v.mobile&&$()||!v.desktop&&!$()?(P("This device is disabled.",`desktop: ${v.desktop}`,`mobile: ${v.mobile}`),N()):(pe(),T||(T={reveal:(t,o)=>te(t,o),clean:W,destroy:ge,sync:ve,get defaults(){return v},version:J,noop:false},Object.defineProperty(T,"delegate",{value:y})),T)}var B=ye;B.isSupported=ne;Object.defineProperty(B,"debug",{get:()=>F,set:e=>{typeof e=="boolean"&&(F=e);}});var Re=B;export{B as ScrollReveal,Re as default};
|
|
1
|
+
export{a as ScrollReveal,b as default}from'../chunk-OMI46IXL.mjs';import'../chunk-AJ22VSHC.mjs';
|