svg-scroll-draw 2.24.0 → 2.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -30
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +60 -6
- package/dist/angular/index.d.ts +60 -6
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.d.mts +3 -3
- package/dist/astro/index.d.ts +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +69 -31
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-5SJE7725.mjs +1 -0
- package/dist/{chunk-NX74KN5X.mjs → chunk-5U4JXBHR.mjs} +1 -1
- package/dist/chunk-7LDSB4FT.mjs +1 -0
- package/dist/chunk-ASCOHQQD.mjs +2 -0
- package/dist/chunk-GBFWTY5L.mjs +1 -0
- package/dist/chunk-HAGTU5EX.mjs +1 -0
- package/dist/chunk-HJTHOZK5.mjs +1 -0
- package/dist/chunk-IXR6RML7.mjs +1 -0
- package/dist/chunk-KN2YB54Z.mjs +1 -0
- package/dist/chunk-NJV6S5LD.mjs +1 -0
- package/dist/chunk-UBH4K5YD.mjs +1 -0
- package/dist/chunk-UF3MO5XQ.mjs +1 -0
- package/dist/chunk-XLXVGQ3P.mjs +3 -0
- package/dist/chunk-YOOPMYT6.mjs +1 -0
- package/dist/chunk-Z72TVDHY.mjs +1 -0
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.d.mts +3 -1
- package/dist/cinematic/index.d.ts +3 -1
- package/dist/cinematic/index.mjs +1 -1
- package/dist/{engine-6VsjEwzb.d.ts → engine-Bi2x8-X-.d.mts} +2 -2
- package/dist/{engine-BLWKCfxC.d.mts → engine-DAlvk6i0.d.ts} +2 -2
- package/dist/frames/index.cjs +1 -1
- package/dist/frames/index.d.mts +2 -2
- package/dist/frames/index.d.ts +2 -2
- package/dist/frames/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +3 -3
- package/dist/group/index.d.ts +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +2 -2
- package/dist/horizontal/index.d.ts +2 -2
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-BN8yKeQ3.d.ts → index-BMMZ8aW7.d.mts} +2 -2
- package/dist/{index-hSQqLVbg.d.ts → index-CEMsUTEG.d.ts} +3 -3
- package/dist/{index-DAiRJgtF.d.mts → index-ClAFxNEp.d.mts} +3 -3
- package/dist/{index-DVjblK_4.d.mts → index-MdQ4ti_z.d.ts} +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/lenis/index.cjs +1 -1
- package/dist/lenis/index.d.mts +15 -16
- package/dist/lenis/index.d.ts +15 -16
- package/dist/lenis/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +8 -5
- package/dist/nuxt/index.d.ts +8 -5
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +2 -2
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +21 -5
- package/dist/react/index.d.ts +21 -5
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +2 -2
- package/dist/reveal/index.d.ts +2 -2
- package/dist/reveal/index.mjs +1 -1
- package/dist/{scroll-draw-Fzir8hlU.d.mts → scroll-draw-CKZysh22.d.mts} +1 -1
- package/dist/{scroll-draw-BsU_Ohmu.d.ts → scroll-draw-DbY8RUJE.d.ts} +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +2 -2
- package/dist/snap/index.d.ts +2 -2
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +40 -4
- package/dist/solid/index.d.ts +40 -4
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +47 -4
- package/dist/svelte/index.d.ts +47 -4
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +2 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +10 -10
- package/dist/timeline/index.d.mts +2 -2
- package/dist/timeline/index.d.ts +2 -2
- package/dist/timeline/index.mjs +2 -2
- package/dist/{types-9bcJdVcg.d.mts → types-iITMwrru.d.mts} +10 -2
- package/dist/{types-9bcJdVcg.d.ts → types-iITMwrru.d.ts} +10 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +2 -2
- package/dist/video/index.d.ts +2 -2
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +37 -4
- package/dist/vue/index.d.ts +37 -4
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/dist/wrapper-BOHrDnBO.d.mts +8 -0
- package/dist/wrapper-Cm7JTIVl.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-32ZCSGFZ.mjs +0 -1
- package/dist/chunk-5SKWSPQT.mjs +0 -1
- package/dist/chunk-7USW2XFB.mjs +0 -1
- package/dist/chunk-7XOFQCQE.mjs +0 -3
- package/dist/chunk-BDXWPUBJ.mjs +0 -2
- package/dist/chunk-BRV2B2YW.mjs +0 -1
- package/dist/chunk-QZKYGS74.mjs +0 -1
- package/dist/chunk-THPTANES.mjs +0 -1
- package/dist/chunk-U5TKLHGW.mjs +0 -1
- package/dist/chunk-V3Z6G5JE.mjs +0 -1
- package/dist/chunk-XSVTHCLO.mjs +0 -1
package/dist/angular/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { S as
|
|
3
|
-
import { S as
|
|
1
|
+
import { F as FramesInput } from '../wrapper-Cm7JTIVl.js';
|
|
2
|
+
import { S as ScrollDrawInstance, a as ScrollDrawOptions } from '../types-iITMwrru.js';
|
|
3
|
+
import { S as ScrollAnimateOptions } from '../engine-DAlvk6i0.js';
|
|
4
|
+
import { S as ScrollCounterOptions } from '../index-MdQ4ti_z.js';
|
|
4
5
|
import { ScrollVideoOptions } from '../video/index.js';
|
|
6
|
+
export { ScrollFramesOptions } from '../frames/index.js';
|
|
5
7
|
import { ScrollTextOptions } from '../text/index.js';
|
|
6
8
|
|
|
7
9
|
/**
|
|
@@ -9,15 +11,21 @@ import { ScrollTextOptions } from '../text/index.js';
|
|
|
9
11
|
* `ngOnChanges`: it rebuilds the engine when an option really changed and does
|
|
10
12
|
* nothing for an equal object, so binding it to every change is safe. Callbacks
|
|
11
13
|
* are read live, so a new function alone never rebuilds. Exported for typing;
|
|
12
|
-
* use the
|
|
14
|
+
* use the six Ref classes below.
|
|
13
15
|
*/
|
|
14
16
|
declare class EngineRef<E extends Element, O extends object> {
|
|
15
17
|
private readonly create;
|
|
18
|
+
private readonly keyOf;
|
|
16
19
|
private instance;
|
|
17
20
|
private el;
|
|
18
21
|
private key;
|
|
19
22
|
private latest;
|
|
20
|
-
|
|
23
|
+
/**
|
|
24
|
+
* `keyOf` is the options' fingerprint: optionsKey, or the one scrollFrames
|
|
25
|
+
* passes, which reads a `frames` function by the URLs it gives. `create`
|
|
26
|
+
* gets the options with live callbacks, and as they were passed.
|
|
27
|
+
*/
|
|
28
|
+
constructor(create: (el: E, options: O, raw: O) => ScrollDrawInstance, keyOf?: (options: O) => string);
|
|
21
29
|
init(element: E, options: O): this;
|
|
22
30
|
/** Call from `ngOnChanges` with the current options. A no-op before `init()`. */
|
|
23
31
|
update(options: O): this;
|
|
@@ -124,6 +132,52 @@ declare class ScrollVideoRef extends EngineRef<HTMLVideoElement, ScrollVideoOpti
|
|
|
124
132
|
constructor();
|
|
125
133
|
init(element: HTMLVideoElement, options?: ScrollVideoOptions): this;
|
|
126
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* Scrub an image sequence on a <canvas> with the scroll (scrollFrames) —
|
|
137
|
+
* Angular class-based API. The canvas is in your template, so give it
|
|
138
|
+
* role="img" and an aria-label saying what the frames show; in development
|
|
139
|
+
* `init()` warns when it has no name (unless it is aria-hidden="true" or
|
|
140
|
+
* role="presentation").
|
|
141
|
+
*
|
|
142
|
+
* `update()` from ngOnChanges starts a new film only when the URLs (a `frames`
|
|
143
|
+
* function is read by the URLs it gives for `count`) or another option
|
|
144
|
+
* changed; callbacks are read live. `triggerElement` takes an element or a
|
|
145
|
+
* selector, found when the film starts.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* @Component({
|
|
149
|
+
* template: `
|
|
150
|
+
* <section #track style="height: 400vh">
|
|
151
|
+
* <div style="position: sticky; top: 0; height: 100vh">
|
|
152
|
+
* <canvas #film role="img" aria-label="The headphones turning"></canvas>
|
|
153
|
+
* </div>
|
|
154
|
+
* </section>`,
|
|
155
|
+
* })
|
|
156
|
+
* export class FilmComponent implements AfterViewInit, OnChanges, OnDestroy {
|
|
157
|
+
* @ViewChild('film') filmRef!: ElementRef<HTMLCanvasElement>;
|
|
158
|
+
* @ViewChild('track') trackRef!: ElementRef<HTMLElement>;
|
|
159
|
+
* @Input() count = 120;
|
|
160
|
+
* private film = new ScrollFramesRef();
|
|
161
|
+
*
|
|
162
|
+
* ngAfterViewInit() { this.film.init(this.filmRef.nativeElement, this.options()); }
|
|
163
|
+
* ngOnChanges() { this.film.update(this.options()); }
|
|
164
|
+
* ngOnDestroy() { this.film.destroy(); }
|
|
165
|
+
*
|
|
166
|
+
* private options() {
|
|
167
|
+
* return {
|
|
168
|
+
* frames: (i: number) => `/film/${i + 1}.jpg`, count: this.count,
|
|
169
|
+
* triggerElement: this.trackRef?.nativeElement,
|
|
170
|
+
* trigger: { start: 'top top', end: 'bottom bottom' },
|
|
171
|
+
* };
|
|
172
|
+
* }
|
|
173
|
+
* }
|
|
174
|
+
*/
|
|
175
|
+
declare class ScrollFramesRef extends EngineRef<HTMLCanvasElement, FramesInput> {
|
|
176
|
+
/** The canvas whose label was checked: once per canvas, not per new film. */
|
|
177
|
+
private named;
|
|
178
|
+
constructor();
|
|
179
|
+
init(element: HTMLCanvasElement, options: FramesInput): this;
|
|
180
|
+
}
|
|
127
181
|
/**
|
|
128
182
|
* Split text and stagger-animate each piece on scroll — Angular class-based API.
|
|
129
183
|
*
|
|
@@ -150,4 +204,4 @@ declare class ScrollTextRef extends EngineRef<HTMLElement, ScrollTextOptions> {
|
|
|
150
204
|
init(element: HTMLElement, options?: ScrollTextOptions): this;
|
|
151
205
|
}
|
|
152
206
|
|
|
153
|
-
export { EngineRef, ScrollAnimateOptions, ScrollAnimateRef, ScrollCounterOptions, ScrollCounterRef, ScrollDrawInstance, ScrollDrawOptions, ScrollDrawRef, ScrollTextOptions, ScrollTextRef, ScrollVideoOptions, ScrollVideoRef };
|
|
207
|
+
export { EngineRef, ScrollAnimateOptions, ScrollAnimateRef, ScrollCounterOptions, ScrollCounterRef, ScrollDrawInstance, ScrollDrawOptions, ScrollDrawRef, ScrollFramesRef, ScrollTextOptions, ScrollTextRef, ScrollVideoOptions, ScrollVideoRef };
|
package/dist/angular/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-
|
|
1
|
+
import {a as a$4}from'../chunk-NJV6S5LD.mjs';import {a,b,c,d as d$1}from'../chunk-KN2YB54Z.mjs';import {a as a$3}from'../chunk-HJTHOZK5.mjs';import'../chunk-GBFWTY5L.mjs';import {a as a$5}from'../chunk-UF3MO5XQ.mjs';import {a as a$2}from'../chunk-Z72TVDHY.mjs';import {a as a$1}from'../chunk-HAGTU5EX.mjs';import {b as b$1}from'../chunk-XLXVGQ3P.mjs';import'../chunk-7LDSB4FT.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-YOOPMYT6.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';var r=class{constructor(t,e=a){this.create=t;this.keyOf=e;this.instance=null;this.el=null;this.key="";}init(t,e){return this.destroy(),this.el=t,this.latest=e,this.key=this.keyOf(e),this.instance=this.create(t,b(e,()=>this.latest),e),this}update(t){return this.el?this.keyOf(t)!==this.key?this.init(this.el,t):(this.latest=t,this):this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(t){return this.instance?.seek(t),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=this.el=null,this}},O=class extends r{constructor(){super(b$1);}init(t,e={}){return super.init(t,e)}},d=class extends r{constructor(){super(a$1);}},y=class extends r{constructor(){super(a$2);}},x=class extends r{constructor(){super(a$3);}init(t,e={}){return super.init(t,e)}},S=class extends r{constructor(){super(a$4,c);this.named=null;}init(e,f){return this.named!==e&&d$1(e,"ScrollFramesRef"),this.named=e,super.init(e,f)}},E=class extends r{constructor(){super(a$5);}init(t,e={}){return super.init(t,e)}};export{r as EngineRef,d as ScrollAnimateRef,y as ScrollCounterRef,O as ScrollDrawRef,S as ScrollFramesRef,E as ScrollTextRef,x as ScrollVideoRef};
|
package/dist/astro/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';var ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...t){ze&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function hr({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function br({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(n),s=0,a=[];for(let m=0;m<r;m++){let g=Math.pow(o,m);a.push(g),s+=g;}let l=[0],u=0;for(let m=0;m<r;m++)u+=a[m]/s,l.push(u);return m=>{if(m<=0)return 0;if(m>=1)return 1;for(let g=0;g<r;g++)if(m<=l[g+1]){let S=(m-l[g])/(l[g+1]-l[g]);if(g===0)return S*(2-S);let y=1-Math.pow(n,g);return y+(1-y)*(2*S-1)*(2*S-1)}return 1}}function wr({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),o=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/n)+1}var We={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:hr(),bounce:br(),elastic:wr()};function vr(e,t,r,n){let o=(s,a,l)=>((1+3*s-3*a)*l+3*a-6*s)*l*l+3*s*l;return s=>{if(s<=0||s>=1)return +(s>0);let a=s;for(let l=0;l<8;l++)a-=(o(e,r,a)-s)/((3*(1+3*e-3*r)*a+6*r-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(o(e,r,a)-s)<1e-9))for(let l=0,u=0,m=1;l<30;l++)a=(u+m)/2,o(e,r,a)<s?u=a:m=a;return o(t,n,a)}}function wt(e){let t=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),r=t?t[1].split(",").map(parseFloat):[];if(r.length===4&&r.every(Number.isFinite)&&r[0]*(1-r[0])>=0&&r[2]*(1-r[2])>=0)return [vr(r[0],r[1],r[2],r[3]),`cubic-bezier(${r})`]}var Rt=new Set;function $e(e,t="linear"){if(typeof e=="function")return e;if(e==null)return We[t];if({}.hasOwnProperty.call(We,e))return We[e];let r=wt(String(e));return r?r[0]:(!Rt.has(e)&&Rt.add(e)&&V(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),We[t])}function Qe(e,t,r){return Math.min(r,Math.max(t,e))}function fe(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}var _t=(e,t)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:t;function Nt(e,t,r,n){return e+r+t*_t(n,0)}function Ft(e,t){return t*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:_t(e,1))}function z(e,t,r,n){return r===t?0:Qe((e-t)/(r-t)*n,0,1)}function ge(e,t,r,n,o){let s=Nt(e.top,e.height,t,n.element)-Ft(n.viewport,r),a=Nt(e.top,e.height,t,o.element)-Ft(o.viewport,r);return {tStart:s,tEnd:a}}function tt(e,t,r){let n=e.getBoundingClientRect(),o=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:n.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:r==="x"?n.left:n.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function rt(e){let t=parseFloat(e.getAttribute("pathLength")??"");if(t>0)return t;let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),o=parseFloat(e.getAttribute("height")??"0");return 2*(n+o)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function nt(e){return `${e} ${e*2}`}function Vt(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 r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function ot(e,t,r){let n=Vt(e),o=Vt(t);return !n||!o?e:`rgb(${Math.round(n[0]+(o[0]-n[0])*r)},${Math.round(n[1]+(o[1]-n[1])*r)},${Math.round(n[2]+(o[2]-n[2])*r)})`}var zt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Er="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Sr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Wt=33;function Tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Mr(e){let t=[];for(let r=0;r<Wt;r++){let n=r/(Wt-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function st(e){switch(e){case "linear":return "linear";case "ease-in":return Er;case "ease-out":return Sr;case "ease-in-out":return Tr()?Mr(We["ease-in-out"]):null;default:return wt(e)?.[1]??null}}var Gt=Symbol.for("svg-scroll-draw.registry");function Bt(){let e=globalThis;return e[Gt]||(e[Gt]=new Map)}function Le(e,t){Bt().set(e,t);}function Ae(e){Bt().delete(e);}function qt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",r),()=>t.removeEventListener("change",r);let n=t;return n.addListener?.(r),()=>n.removeListener?.(r)}function De(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let r=t(e,false),n=qt(s=>{if(!s)return;n();let a=(r.getProgress?.()??0)>=1;r.destroy(),r=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(r))o[s]=(...a)=>r[s]?.(...a);return o.destroy=()=>{n(),r.destroy();},o}var Ue,it=new Set,at=new WeakMap,Ye=new Map,jt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function xr(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function Qt(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let r=()=>t();Ue??(Ue=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)at.get(a)!==jt(a)&&(s=true),at.set(a,"");s&&it.forEach(a=>a());})),it.add(r);let n=xr(e);return [document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{at.has(o)||at.set(o,jt(o)),Ye.set(o,(Ye.get(o)??0)+1),Ue.observe(o);}),()=>{it.delete(r)&&(n.forEach(o=>{let s=(Ye.get(o)??1)-1;if(s)return void Ye.set(o,s);Ye.delete(o),Ue?.unobserve(o);}),it.size||(Ue?.disconnect(),Ue=void 0));}}function ke(e,t,r,n,o){let s,a=NaN,l,u,m=()=>{s=0,n(),!l&&!s&&(a=r())>0&&a<1&&(s=requestAnimationFrame(m));},g=()=>{!s&&!l&&r()!==a&&(s=requestAnimationFrame(m));},S=$=>{l=$,cancelAnimationFrame(s),s=a=NaN,g();},y=()=>{clearTimeout(u),o(),g();},H=()=>{clearTimeout(u),u=setTimeout(y,150);},se=Qt(t,H),b=$=>{e[$]("scroll",g,{passive:true}),window[$]("resize",H),window[$]("orientationchange",H);};return b("addEventListener"),g(),{hold:S,remeasure:y,off(){S(true),b("removeEventListener"),se(),clearTimeout(u);}}}var Lr=0;function Ar(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ut(e,t){let r="";try{r=getComputedStyle(e).getPropertyValue(t).trim();}catch{}return r||(e.getAttribute(t)??"").trim()}var Yt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Cr(e){if(!ze)return;let t=Ut(e,"stroke");if(!t||t==="none"){V("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Yt.has(r)&&!Yt.has(Ut(e,"fill"))&&V("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Pr(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function o(){let s=r==="x"?window.scrollX:window.scrollY,a=e-s,l=t-s,u=r==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${u?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${u?`left:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}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(n),window.addEventListener("scroll",o,{passive:true}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Qt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mr(e,t,r){if(!We)return;let n=(e.match(Qt)??[]).join("").toUpperCase(),o=(t.match(Qt)??[]).join("").toUpperCase(),i=(e.match(jt)??[]).length,a=(t.match(jt)??[]).length;if(n!==o){j(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}i!==a&&j(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function Lr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),f=n[o++]??a;return String(+(a+(f-a)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:De(t,(r,n)=>Ar(e,r,n))}function Ar(e,t,r){let{preset:n,...o}=t,i=n?{...Nt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:f=1,fade:u=false,easing:m="linear",trigger:g={},stagger:S=0,direction:y="forward",once:H=false,debug:ie=false,axis:b="y",scrollContainer:$,autoReverse:pe=false,delay:R=0,strokeColor:x,strokeWidth:C,fillOpacity:D,waypoints:M,velocityScale:A=false,threshold:W=0,rootMargin:he="0px",repeat:ee=0,repeatDelay:te=0,morphTo:N,clip:w,autoplay:ae=false,duration:v=1e3,native:F=true,onProgress:Oe,onStart:J,onComplete:re,onEnter:be,onLeave:Ne,onEnterBack:we,onLeaveBack:de}=i,Z=w===true?"left":typeof w=="string"?w:false,Q=typeof m=="function"?m:se[m]??se.linear,Fe=me(g.start||"top bottom"),Ge=me(g.end||"bottom top"),G=typeof $=="string"?document.querySelector($):$??null,ve=Array.isArray(x)?x[0]:null,Ee=Array.isArray(x)?x[1]:typeof x=="string"?x:null,ue=Array.isArray(C)?C[0]:null,Pe=Array.isArray(C)?C[1]:typeof C=="number"?C:null,Se=Array.isArray(D)?D[0]:null,fe=Array.isArray(D)?D[1]:typeof D=="number"?D:null;function Te(s){let c=s*100;switch(Z){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 l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],z=[],T=0,P=0,_=S,k=0,$e=0,B=false,xe=false,Me=0,ut=-1,Xe=[],Je=-1,le=false,ge=0,Ie=0,He,ft=false,mt=null;function vt(){mt?.destroy(),mt=null;}let Re=new Set,Et=NaN,_e=true,Ze=-1,St=performance.now(),Ve=NaN;function Ke(){return G?b==="x"?G.scrollLeft:G.scrollTop:b==="x"?window.scrollX:window.scrollY}function Tt(){return G?b==="x"?G.clientWidth:G.clientHeight:b==="x"?window.innerWidth:window.innerHeight}function xt(){let s=et(e,G,b);return ye(s,s.scroll,Tt(),Fe,Ge)}function ir(){let s=P-T,c=l.length-1,d=G??document.documentElement,E=b==="x"?"Width":"Height";if(_=S,S>0&&c>0&&s>0){let Y=d[`scroll${E}`]-d[`client${E}`]-1-T-s/f;Y>=0&&(_=Math.min(S,Y/(c*s)));}let q=Math.max(0,c)*_*s,ne=s/Math.min(f,1);k=T+Math.min(0,q,ne,q+ne),$e=T+Math.max(0,q,ne,q+ne);}function Mt(){(({tStart:T,tEnd:P}=xt())),ir(),ie&&We&&(vt(),mt=xr(T,P,b));}function pt(s,c=xt){Ae(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let d=s.destroy;return s.destroy=()=>{d.call(s),Ce(e);},s}function Lt(s,c){return H&&!pe?Math.max(ut,Q(Xe[s]=Math.max(Xe[s]??0,c))):Q(c)}function ar(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),Z){let d=c==="reverse"?1-s:s;e.style.clipPath=Te(d);return}l.forEach((d,E)=>dt(d,E,s,c));}function dt(s,c,d,E){s.style.strokeDashoffset=E==="reverse"?`${p[c]*d}`:`${p[c]*(1-d)}`,u&&(s.style.opacity=E==="reverse"?`${1-d}`:`${d}`),ve&&Ee?s.style.stroke=rt(ve,Ee,d):Ee&&(s.style.stroke=Ee),ue!==null&&Pe!==null?s.style.strokeWidth=`${ue+(Pe-ue)*d}`:Pe!==null&&(s.style.strokeWidth=`${Pe}`),Se!==null&&fe!==null?s.style.fillOpacity=`${Se+(fe-Se)*d}`:fe!==null&&(s.style.fillOpacity=`${fe}`),N&&s.tagName.toLowerCase()==="path"&&z[c]&&s.setAttribute("d",Lr(z[c],N,d));}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=Te(y==="reverse"?1:0);return}l.forEach((s,c)=>{s.style.strokeDasharray=`${p[c]}`,s.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,u?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ve&&(s.style.stroke=ve),ue!==null&&(s.style.strokeWidth=`${ue}`),Se!==null&&(s.style.fillOpacity=`${Se}`),N&&s.tagName.toLowerCase()==="path"&&z[c]&&s.setAttribute("d",z[c]);});}function ze(s,c){let d=s.getAttribute("d"),E=tt(s);if(N&&z[c]){s.setAttribute("d",N);let q=tt(s);s.setAttribute("d",z[c]),E=Math.max(tt(s),q),s.setAttribute("d",d);}p[c]=E,s.style.strokeDasharray=`${E}`;}if(l.forEach((s,c)=>{Tr(s);let d=s.tagName.toLowerCase()==="path";d?z.push(s.getAttribute("d")??""):z.push(""),ze(s,c);let E=p[c];N&&(d?Mr(z[z.length-1],N,s):j(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),r?(s.style.strokeDashoffset=y==="reverse"?`${E}`:"0",u&&(s.style.opacity="1"),Ee&&(s.style.stroke=Ee),Pe!==null&&(s.style.strokeWidth=`${Pe}`),fe!==null&&(s.style.fillOpacity=`${fe}`),N&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",N)):(s.style.strokeDashoffset=y==="reverse"?"0":`${E}`,u?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ve&&(s.style.stroke=ve),ue!==null&&(s.style.strokeWidth=`${ue}`),Se!==null&&(s.style.fillOpacity=`${Se}`));}),r)return Z&&(e.style.clipPath=Te(1)),re?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=Te(y==="reverse"?1:0));let At=typeof m=="string"?nt(m):null;function lr(){return !(F===false||ae||ie&&We||!Sr()||!l.length||!At||Z||b!=="y"||G||f!==1||S!==0||H||pe||A!==false||N||M||ee||R>0||Oe||J||re||be||Ne||we||de||x!=null||C!=null||D!=null||(g.start||"top bottom").trim()!=="top bottom"||(g.end||"bottom top").trim()!=="bottom top")}function cr(){let s=++Er,c=`svg-scroll-draw-${s}`,d=`svg-scroll-draw-host-${s}`,E=`--svg-scroll-draw-${s}`,q=y==="reverse"?"0":"var(--ssd-len)",ne=y==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${q};`,O=`stroke-dashoffset:${ne};`;u&&(Y+=`opacity:${y==="reverse"?1:0};`,O+=`opacity:${y==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${c}{from{${Y}}to{${O}}}.${d}{view-timeline-name:${E};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${E};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(d);function K(h,L){h.style.setProperty("--ssd-len",String(p[L])),h.style.strokeDasharray=`${p[L]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}l.forEach(K);let U=false,oe=-1;function ce(){if(oe>=0)return oe;let h=e.getBoundingClientRect(),{tStart:L,tEnd:X}=ye({top:h.top,height:h.height},Ke(),Tt(),Fe,Ge);return Q(V(Ke(),L,X,f))}return {destroy(){e.classList.remove(d),l.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),I.remove();},replay(){U=false,oe=-1,l.forEach(K);},pause(){U=true,l.forEach(h=>{h.style.animationPlayState="paused";});},resume(){U&&(U=false,l.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let L=Math.min(1,Math.max(0,h));oe=L,U=true,l.forEach((X,Le)=>{X.classList.remove(c),X.style.strokeDashoffset=y==="reverse"?`${p[Le]*L}`:`${p[Le]*(1-L)}`,u&&(X.style.opacity=y==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return ce()},refresh(){l.forEach((h,L)=>{ze(h,L),h.style.setProperty("--ssd-len",String(p[L]));});}}}if(lr())return pt(cr());function ur(){let s=Math.max(1,v),c=Z?s:s*(1+Math.max(0,l.length-1)*S),d=0,E=0,q=false;function ne(oe){let ce=true,h=Math.min(1,Math.max(0,oe/c));if(Z){let L=Math.min(1,Math.max(0,oe/s)),X=Q(L);ge=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=Te(y==="reverse"?1-X:X),Oe?.(X),L<1&&(ce=false);}else {l.forEach((X,Le)=>{let mr=Le*S*s,kt=Math.min(1,Math.max(0,(oe-mr)/s));dt(X,Le,Q(kt),y),kt<1&&(ce=false);});let L=Q(h);ge=L,Oe?.(L),e.style.setProperty("--scroll-draw-progress",String(L));}if(M){let L=Q(h);for(let X in M){let Le=parseFloat(X);L>=Le&&!Re.has(Le)&&(Re.add(Le),M[X]?.());}}return ce}function Y(oe){if(le)return;let ce=oe-d;xe||(xe=true,J?.());let h=ne(ce);if(h&&!B){B=true,ne(c),re?.(),Ie<(ee==="infinite"?1/0:ee??0)&&(Ie++,He=setTimeout(()=>{d=performance.now(),xe=false,B=false,Re.clear(),gt(),Me=requestAnimationFrame(Y);},te));return}h||(Me=requestAnimationFrame(Y));}function O(){cancelAnimationFrame(Me),clearTimeout(He),d=performance.now(),E=0,le=false,xe=false,B=false,Ie=0,q=true,ge=0,Re.clear(),gt(),Me=requestAnimationFrame(Y);}let I=new IntersectionObserver(oe=>{oe.forEach(ce=>{ce.isIntersecting&&!(H&&B)?O():!ce.isIntersecting&&!H&&!B&&(cancelAnimationFrame(Me),clearTimeout(He),q=false);});},{root:G??null,threshold:W,rootMargin:he}),K;function U(){clearTimeout(K),K=setTimeout(()=>l.forEach(ze),150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),R>0?setTimeout(()=>I.observe(e),R):I.observe(e),{destroy(){cancelAnimationFrame(Me),clearTimeout(He),I.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(K);},replay(){Ie=0,O();},pause(){le||!q||(le=true,E=performance.now()-d,cancelAnimationFrame(Me));},resume(){le&&(le=false,q=true,d=performance.now()-E,Me=requestAnimationFrame(Y));},seek(oe){let ce=Math.min(1,Math.max(0,oe));ge=ce,le=true,E=ce*c,d=performance.now()-E,cancelAnimationFrame(Me),ne(E);},getProgress(){return ge},refresh(){clearTimeout(K),l.forEach(ze);}}}if(ae)return pt(ur());Mt();let Ct=()=>V(Ke(),k,$e,1);function Pt(){B=true,re?.(),Ie<(ee==="infinite"?1/0:ee)&&(Ie++,He=setTimeout(()=>{ft=true;},te));}function $t(){ut=-1,Xe=[],xe=false,B=false,ft=false,Re.clear(),gt(),_e=true;}function fr(){let s=performance.now(),c=Ke();if(ft&&Ct()%1&&$t(),!_e&&A===false&&c===Et)return;_e=false,Et=c;let d=f;if(A!==false){let O=s-St,I=O>0?Math.abs(c-(Ze<0?c:Ze))/O:0;d=f*Math.max(.2,1+I*(typeof A=="number"?A:1)*.04);}Ze=c,St=s;let E=pe?Je===-1||c>=Je?"forward":"reverse":y;Je=c;let q=P-T,ne=true,Y=q===0?0:(c-T)/q;if(isNaN(Ve)||(Ve<=0&&Y>0&&be?.(),Ve<1&&Y>=1&&Ne?.(),Ve>=1&&Y<1&&we?.(),Ve>0&&Y<=0&&de?.()),Ve=Y,Z){let O=Lt(0,V(c,T,P,d));ge=O,e.style.setProperty("--scroll-draw-progress",String(O));let I=E==="reverse"?1-O:O;e.style.clipPath=Te(I),Oe?.(O),!xe&&V(c,T,P,d)>0&&(xe=true,J?.()),O>=1&&!B?Pt():O<1&&!H&&(B=false);return}if(l.forEach((O,I)=>{let K=I*_*q,U=Lt(I,V(c,T+K,P+K,d));dt(O,I,U,E),I===0&&(ge=U,Oe?.(U),e.style.setProperty("--scroll-draw-progress",String(U))),U<1&&(ne=false);}),M){let O=Q(V(c,T,P,d));for(let I in M){let K=parseFloat(I);O>=K&&!Re.has(K)&&(Re.add(K),M[I]?.());}}!xe&&V(c,T,P,d)>0&&(xe=true,J?.()),ne&&!B?Pt():!ne&&!H&&(B=false);}let Be=ke(G??window,[e],Ct,fr,()=>{let s=p.join();l.forEach(ze),Mt(),_e=true,p.join()!==s&&qe();}),yt=R>0;function qe(){Be.hold(le||yt);}let Dt;return yt&&(Dt=setTimeout(()=>{yt=false,qe();},R)),qe(),pt({destroy(){clearTimeout(He),clearTimeout(Dt),Be.off(),vt();},replay(){$t(),Je=-1,Ze=-1,Ie=0,le=false,ge=0,clearTimeout(He),qe();},pause(){le=true,Be.hold(true);},resume(){le&&(le=false,_e=true,qe());},seek(s){let c=Math.min(1,Math.max(0,s));ge=c,ut=c,Xe=[],le=true,Be.hold(true),ar(c,y),_e=true;},getProgress(){return ge},refresh:Be.remeasure},()=>({tStart:T,tEnd:P}))}function Cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Yt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let o=[],i=[],a=n[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let u=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:o,units:i});}return t}function Pr(e,t,r){let n=Yt(e),o=Yt(t);return n.length===0||n.length!==o.length?r<1?e:t:n.map((i,a)=>{let f=o[a];return i.fn!==f.fn||i.nums.length!==f.nums.length?r<1?`${i.fn}(${i.nums.map((u,m)=>`${u}${i.units[m]}`).join(", ")})`:`${f.fn}(${f.nums.map((u,m)=>`${u}${f.units[m]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,m)=>`${u+(f.nums[m]-u)*r}${i.units[m]}`).join(", ")})`}).join(" ")}function Ut(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),o=String(t);if(Cr(n))return rt(n,o,r);if(n.includes("("))return Pr(n,o,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let f=parseFloat(i[1]),u=parseFloat(a[1]);return `${f+(u-f)*r}${i[2]||a[2]}`}return r<1?n:o}function $r(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Dr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),kr=0,Xt="--scroll-draw-progress";function Or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Kt(e,t){return typeof window>"u"?Zt:t.respectReducedMotion===false?Jt(e,t,false):De(t,(r,n)=>Jt(e,r,n))}function Jt(e,t,r){let{props:n,trigger:o={},easing:i="ease-out",speed:a=1,once:f=false,axis:u="y",scrollContainer:m,native:g=true,velocityScale:S=false,triggerElement:y,onProgress:H,onComplete:ie,onEnter:b,onLeave:$,onEnterBack:pe,onLeaveBack:R}=t,x=typeof i=="function"?i:se[i]??se["ease-out"],C=me(o.start||"top bottom"),D=me(o.end||"bottom top"),M=y??e,A=typeof m=="string"?document.querySelector(m):m??null,W=Object.entries(n).map(([l,p])=>({prop:$r(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function he(){let l=window.getComputedStyle(e);for(let p of W)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function ee(){for(let l of W)e.style.setProperty(l.prop,String(l.to));}let te=new Map;for(let l of [...W.map(p=>p.prop),Xt])te.set(l,e.style.getPropertyValue(l));function N(){for(let[l,p]of te)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(r)return ee(),ie?.(),{...Zt,destroy:N,getProgress:()=>1};he();let w=()=>A?u==="x"?A.scrollLeft:A.scrollTop:u==="x"?window.scrollX:window.scrollY,ae=()=>A?u==="x"?A.clientWidth:A.clientHeight:u==="x"?window.innerWidth:window.innerHeight,v=typeof i=="string"?nt(i):null;function F(){if(!g||!Or()||!v||u!=="y"||A||M!==e||f||a!==1||H||ie||b||$||pe||R||S!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let l of W)if(!Dr.has(l.prop))return false;return true}function Oe(){let l=`ssd-a-${++kr}`,p=W.map(k=>`${k.prop}:${k.from}`).join(";"),z=W.map(k=>`${k.prop}:${k.to}`).join(";"),T=document.createElement("style");T.setAttribute("data-ssd-animate",""),T.textContent=`@keyframes ${l}{from{${p}}to{${z}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${v};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(T),e.classList.add(l);let P=()=>{let k=e.getBoundingClientRect();return ye({top:k.top,height:k.height},w(),ae(),C,D)};Ae(e,{type:"animate",getProgress:()=>_.getProgress(),getTrigger:P});let _={refresh(){},destroy(){e.classList.remove(l),T.remove(),e.style.animationPlayState="",N(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let $e=Math.min(1,Math.max(0,k));e.classList.remove(l);for(let B of W)e.style.setProperty(B.prop,Ut(B.from,B.to,$e));},getProgress(){let{tStart:k,tEnd:$e}=P();return x(V(w(),k,$e,a))}};return _}if(F())return Oe();let J=0,re=0,be=false,Ne=-1,we=0,de=0,Z=false,Q=NaN,Fe=-1,Ge=0,G=M===e?W:[],ve=false;function Ee(){let l=e.style,p=G.map(_=>l.getPropertyValue(_.prop)),z=l.transition;G.length&&(l.transition="none"),G.forEach(_=>l.setProperty(_.prop,te.get(_.prop)??""));let T=et(M,A,u);G.forEach((_,k)=>l.setProperty(_.prop,p[k])),G.length&&(e.offsetWidth,l.transition=z);let P=ye(T,T.scroll,ae(),C,D);ve&&Math.abs(P.tStart-J)<1&&Math.abs(P.tEnd-re)<1||(ve=true,J=P.tStart,re=P.tEnd);}function ue(l){e.style.setProperty(Xt,String(l));for(let p of W)e.style.setProperty(p.prop,Ut(p.from,p.to,l));H?.(l);}function Pe(l){if(isNaN(Q)){Q=l;return}Q<=0&&l>0&&b?.(),Q<1&&l>=1&&$?.(),Q>=1&&l<1&&pe?.(),Q>0&&l<=0&&R?.(),Q=l;}function Se(){if(be)return;let l=performance.now(),p=w(),z=a;if(S!==false){let k=l-Ge,$e=k>0?Math.abs(p-(Fe<0?p:Fe))/k:0;z=a*Math.max(.2,1+$e*(typeof S=="number"?S:1)*.04);}Fe=p,Ge=l;let T=re===J?0:(p-J)/(re-J);Pe(T);let P=V(p,J,re,z),_=f?Math.max(Ne,x(we=Math.max(we,P))):x(P);de=_,ue(_),_>=1&&!Z?(Z=true,ie?.()):_<1&&!f&&(Z=false);}let fe=ke(A??window,[M],()=>V(w(),J,re,Math.min(a,1)),Se,Ee);Ee(),re===J&&j("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),we=V(w(),J,re,a),de=x(we),ue(de),Ae(e,{type:"animate",getProgress:()=>de,getTrigger:()=>({tStart:J,tEnd:re})});function Te(){be=true,fe.hold(true);}return {destroy(){be=true,fe.off(),N(),Ce(e);},replay(){Ne=-1,we=0,Z=false,de=0,be=false,ue(0),fe.hold(false);},pause:Te,resume(){be&&(be=false,fe.hold(false));},seek(l){let p=Math.min(1,Math.max(0,l));de=p,Ne=p,we=0,Te(),ue(p);},getProgress(){return de},refresh:fe.remeasure}}var ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function er(e,t){if(typeof window>"u")return ht;let r=typeof e=="string"?document.querySelector(e):e;return r?De(t,(n,o)=>Ir(r,n,o)):(j("scrollCounter: element not found:",e),ht)}function Ir(e,t,r){let{from:n=0,to:o,format:i,easing:a="ease-out",trigger:f={},once:u=true,decimals:m,onComplete:g}=t,S=m!==void 0?v=>v.toFixed(m):i??(v=>String(Math.round(v))),y=typeof a=="function"?a:se[a]??se["ease-out"],H=me(f.start||"top 80%"),ie=me(f.end||"top 20%");if(r)return e.textContent=S(o),g?.(),{...ht,getProgress:()=>1};let b=0,$=0,pe=false,R=-1,x=0,C=0,D=false,M=()=>window.scrollY,A=()=>window.innerHeight;function W(){let v=e.getBoundingClientRect(),F=ye({top:v.top,height:v.height},M(),A(),H,ie);pe&&Math.abs(F.tStart-b)<1&&Math.abs(F.tEnd-$)<1||(pe=true,b=F.tStart,$=F.tEnd);}let he=e.style.getPropertyValue("--scroll-draw-progress");function ee(v){e.textContent=S(n+(o-n)*v),e.style.setProperty("--scroll-draw-progress",String(v));}let te=()=>V(M(),b,$,1);function N(){let v=te(),F=u?Math.max(R,y(x=Math.max(x,v))):y(v);C=F,ee(F),F>=1&&!D?(D=true,g?.()):F<1&&!u&&(D=false);}W();{x=V(M(),b,$,1);let v=y(x);C=v,ee(v);}let w=ke(window,[e],te,N,W);Ae(e,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:b,tEnd:$})});let ae=()=>w.hold(false);return {destroy(){w.off(),e.style.setProperty("--scroll-draw-progress",he),Ce(e);},replay(){R=-1,x=0,D=false,C=0,ee(0),ae();},pause:()=>w.hold(true),resume:ae,seek(v){let F=Math.min(1,Math.max(0,v));C=F,R=F,x=0,w.hold(true),ee(F);},getProgress(){return C}}}function tr(e,t){let r=document.createElement("span");r.textContent=t,r.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(r);}function at(e=""){let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=e,t}function nr(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(r=>{let n=e.appendChild(at(r)),o=/^\s+$/.test(r);return o?n.style.whiteSpace="pre":n.style.display="inline-block",o?null:n}).filter(r=>r!==null)}function Hr(e){let t=e.textContent??"";e.textContent="";let r=[],n=null;for(let o of t){let i=at(o),a=o===" ";a?i.style.whiteSpace="pre":(i.style.display="inline-block",r.push(i)),a||o>"\u0DFF"?n=null:n||(n=e.appendChild(at()),n.style.cssText="display:inline-block;white-space:nowrap"),(n??e).appendChild(i);}return r}function rr(e){let t=nr(e),r=new Map;for(let i of t){let a=i.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(i);}let n=[],o=Array.from(r.keys()).sort((i,a)=>i-a);for(let i of o){let a=r.get(i),f=at();f.style.display="inline-block",a.forEach((u,m)=>{let g=u.nextElementSibling;f.appendChild(u),m<a.length-1&&g&&g.style.whiteSpace==="pre"&&f.appendChild(g);}),n.push(f);}return e.textContent="",n.forEach((i,a)=>{e.appendChild(i),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function Rr(e,t,r,n){if(r<=1||n===0)return e;n=Math.min(n,1/r);let o=(r-1)*n,i=t*n,a=i+(1-o);return a<=i?e>=i?1:0:je((e-i)/(a-i),0,1)}function Nr(e,t){let r=[];if(t?.y!==void 0&&r.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&r.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&r.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let n=t.scale+(1-t.scale)*e;r.push(`scale(${n})`);}return r.join(" ")}var bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t={}){if(typeof window>"u")return bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return j("scrollText: element not found:",e),bt;let n=r;return De(t,(o,i)=>Fr(n,o,i))}function Fr(e,t,r){let{split:n="words",stagger:o=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:f={},once:u=true,onComplete:m}=t,g=typeof i=="function"?i:se[i]??se["ease-out"],S=me(f.start||"top 85%"),y=me(f.end||"top 40%"),H=e.innerHTML,ie=e.textContent??"",b;n==="chars"?b=Hr(e):n==="lines"?b=rr(e):b=nr(e),tr(e,ie);let $=b.length;function pe(w,ae){a?.opacity!==void 0&&(w.style.opacity=String(a.opacity+(1-a.opacity)*ae));let v=Nr(ae,a);v&&(w.style.transform=v);}function R(w){e.style.setProperty("--scroll-draw-progress",String(w)),b.forEach((ae,v)=>{let F=g(Rr(w,v,$,o));pe(ae,F);});}if(r)return R(1),m?.(),{...bt,destroy:()=>{e.innerHTML=H;},getProgress:()=>1};R(0);let x=0,C=0,D=-1,M=0,A=false;function W(){({tStart:x,tEnd:C}=ye(e.getBoundingClientRect(),window.scrollY,window.innerHeight,S,y));}let he=()=>V(window.scrollY,x,C,1);function ee(){let w=u?D=Math.max(D,he()):he();M=w,R(w),w>=1&&!A?(A=true,m?.()):w<1&&!u&&(A=false);}W();let te=ke(window,[e],he,ee,()=>{n==="lines"&&(e.innerHTML=H,b=rr(e),tr(e,ie),R(M)),W();});Ae(e,{type:"text",getProgress:()=>M,getTrigger:()=>({tStart:x,tEnd:C})});let N=()=>te.hold(false);return {destroy(){te.off(),e.innerHTML=H,Ce(e);},replay(){D=-1,A=false,M=0,R(0),N();},pause:()=>te.hold(true),resume:N,seek(w){te.hold(true),R(M=D=je(w,0,1));},getProgress(){return M}}}function _r(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?it(n,t):(j("Container not found:",e),r)}function Ue(){return typeof document>"u"?null:document}var wt=new WeakMap,sr;function lt(e,t,r,n){let o=wt.get(e)??new Map;wt.set(e,o);let i=()=>{let u=r(),m=o.get(t);m&&m.key===u||(m?.inst.destroy(),o.set(t,{inst:n(u),key:u,build:i,users:m?.users??0}));};i(),o.get(t).users++;let a=true;typeof MutationObserver<"u"&&(sr??(sr=new MutationObserver(u=>u.forEach(m=>wt.get(m.target)?.forEach(g=>g.build())))),sr.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(u=>`data-scroll-${u}-options`).concat("data-scroll-drawoptions")}));let f=()=>o.get(t)?.inst;return {destroy:()=>{let u=o.get(t);!a||!u||(a=false,!(--u.users>0)&&(u.inst.destroy(),o.delete(t)));},replay:()=>f()?.replay(),pause:()=>f()?.pause(),resume:()=>f()?.resume(),seek:u=>f()?.seek(u),getProgress:()=>f()?.getProgress()??0,refresh:()=>f()?.refresh?.()}}function ct(e,t){try{return e?JSON.parse(e):t}catch{return t}}function Vr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(t=>lt(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",r=>it(t,ct(r,{})))):[]}function Wr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(t=>lt(t,"animate",()=>t.dataset.scrollAnimateOptions??"",r=>Kt(t,ct(r,{props:{}})))):[]}function Gr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(t=>lt(t,"counter",()=>t.dataset.scrollCounterOptions??"",r=>{let n=ct(r,{});return !n.to&&n.to!==0&&(j('initScrollCounter: element missing "to" in options JSON:',t),n.to=0),typeof n.format!="function"&&n.format!==void 0&&(j('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete n.format),er(t,n)})):[]}function zr(e=Ue()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(t=>lt(t,"text",()=>t.dataset.scrollTextOptions??"",r=>or(t,ct(r,{})))):[]}function eo(e=Ue()){return {draw:Vr(e),animate:Wr(e),counter:Gr(e),text:zr(e)}}exports.initAll=eo;exports.initScrollAnimate=Wr;exports.initScrollCounter=Gr;exports.initScrollDraw=Vr;exports.initScrollText=zr;exports.scrollDraw=_r;
|
|
3
|
+
<div style="position:absolute;${u?`left:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}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(n),window.addEventListener("scroll",o,{passive:true}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove();}}}var Xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function $r(e,t,r){if(!ze)return;let n=(e.match(Jt)??[]).join("").toUpperCase(),o=(t.match(Jt)??[]).join("").toUpperCase(),s=(e.match(Xt)??[]).length,a=(t.match(Xt)??[]).length;if(n!==o){V(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==a&&V(`morphTo: coordinate count differs (${s} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function Dr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let a=parseFloat(s),l=n[o++]??a;return String(+(a+(l-a)*r).toFixed(4))})}function lt(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:De(t,(r,n)=>kr(e,r,n))}function kr(e,t,r){let{preset:n,...o}=t,s=n?{...zt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:l=1,fade:u=false,easing:m="linear",trigger:g={},stagger:S=0,direction:y="forward",once:H=false,debug:se=false,axis:b="y",scrollContainer:$,autoReverse:me=false,delay:R=0,strokeColor:M,strokeWidth:C,fillOpacity:D,waypoints:x,velocityScale:A=false,threshold:W=0,rootMargin:ye="0px",repeat:ee=0,repeatDelay:te=0,morphTo:N,clip:w,autoplay:ie=false,duration:v=1e3,native:F=true,onProgress:Oe,onStart:J,onComplete:re,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:pe}=s,Z=w===true?"left":typeof w=="string"?w:false,Q=$e(m),Fe=fe(g.start||"top bottom"),Ge=fe(g.end||"bottom top"),G=typeof $=="string"?document.querySelector($):$??null,we=Array.isArray(M)?M[0]:null,ve=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(C)?C[0]:null,Ce=Array.isArray(C)?C[1]:typeof C=="number"?C:null,Ee=Array.isArray(D)?D[0]:null,ue=Array.isArray(D)?D[1]:typeof D=="number"?D:null;function Se(i){let f=i*100;switch(Z){case "right":return `inset(0 0 0 ${100-f}%)`;case "top":return `inset(0 0 ${100-f}% 0)`;case "bottom":return `inset(${100-f}% 0 0 0)`;case "center":return `circle(${i*150}% at 50% 50%)`;default:return `inset(0 ${100-f}% 0 0)`}}let c=Z?[]:Array.from(e.querySelectorAll(a)),p=[],B=[],T=0,P=0,_=S,k=0,Pe=0,q=false,Te=false,Me=0,mt=-1,Je=[],Ze=-1,ae=false,de=0,Ie=0,He,pt=false,dt=null;function Tt(){dt?.destroy(),dt=null;}let Re=new Set,Mt=NaN,_e=true,Ke=-1,xt=performance.now(),Ve=NaN;function et(){return G?b==="x"?G.scrollLeft:G.scrollTop:b==="x"?window.scrollX:window.scrollY}function Lt(){return G?b==="x"?G.clientWidth:G.clientHeight:b==="x"?window.innerWidth:window.innerHeight}function At(){let i=tt(e,G,b);return ge(i,i.scroll,Lt(),Fe,Ge)}function ur(){let i=P-T,f=c.length-1,d=G??document.documentElement,E=b==="x"?"Width":"Height";if(_=S,S>0&&f>0&&i>0){let U=d[`scroll${E}`]-d[`client${E}`]-1-T-i/l;U>=0&&(_=Math.min(S,U/(f*i)));}let j=Math.max(0,f)*_*i,ne=i/Math.min(l,1);k=T+Math.min(0,j,ne,j+ne),Pe=T+Math.max(0,j,ne,j+ne);}function Ct(){(({tStart:T,tEnd:P}=At())),ur(),se&&ze&&(Tt(),dt=Pr(T,P,b));}function gt(i,f=At){Le(e,{type:"draw",getProgress:()=>i.getProgress(),getTrigger:f});let d=i.destroy;return i.destroy=()=>{d.call(i),Ae(e);},i}function Pt(i,f){return H&&!me?Math.max(mt,Q(Je[i]=Math.max(Je[i]??0,f))):Q(f)}function fr(i,f){if(e.style.setProperty("--scroll-draw-progress",String(i)),Z){let d=f==="reverse"?1-i:i;e.style.clipPath=Se(d);return}c.forEach((d,E)=>yt(d,E,i,f));}function yt(i,f,d,E){i.style.strokeDashoffset=E==="reverse"?`${p[f]*d}`:`${p[f]*(1-d)}`,u&&(i.style.opacity=E==="reverse"?`${1-d}`:`${d}`),we&&ve?i.style.stroke=ot(we,ve,d):ve&&(i.style.stroke=ve),ce!==null&&Ce!==null?i.style.strokeWidth=`${ce+(Ce-ce)*d}`:Ce!==null&&(i.style.strokeWidth=`${Ce}`),Ee!==null&&ue!==null?i.style.fillOpacity=`${Ee+(ue-Ee)*d}`:ue!==null&&(i.style.fillOpacity=`${ue}`),N&&i.tagName.toLowerCase()==="path"&&B[f]&&i.setAttribute("d",Dr(B[f],N,d));}function ht(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=Se(y==="reverse"?1:0);return}c.forEach((i,f)=>{i.style.strokeDasharray=nt(p[f]),i.style.strokeDashoffset=y==="reverse"?"0":`${p[f]}`,u?i.style.opacity=y==="reverse"?"1":"0":i.style.opacity="",we&&(i.style.stroke=we),ce!==null&&(i.style.strokeWidth=`${ce}`),Ee!==null&&(i.style.fillOpacity=`${Ee}`),N&&i.tagName.toLowerCase()==="path"&&B[f]&&i.setAttribute("d",B[f]);});}function Be(i,f){let d=i.getAttribute("d"),E=rt(i);if(N&&B[f]){i.setAttribute("d",N);let j=rt(i);i.setAttribute("d",B[f]),E=Math.max(rt(i),j),i.setAttribute("d",d);}p[f]=E,i.style.strokeDasharray=nt(E);}if(c.forEach((i,f)=>{Cr(i);let d=i.tagName.toLowerCase()==="path";d?B.push(i.getAttribute("d")??""):B.push(""),Be(i,f);let E=p[f];N&&(d?$r(B[B.length-1],N,i):V(`morphTo only applies to <path> elements \u2014 ignored on <${i.tagName}>.`,i)),r?(i.style.strokeDashoffset=y==="reverse"?`${E}`:"0",u&&(i.style.opacity="1"),ve&&(i.style.stroke=ve),Ce!==null&&(i.style.strokeWidth=`${Ce}`),ue!==null&&(i.style.fillOpacity=`${ue}`),N&&i.tagName.toLowerCase()==="path"&&i.setAttribute("d",N)):(i.style.strokeDashoffset=y==="reverse"?"0":`${E}`,u?i.style.opacity=y==="reverse"?"1":"0":i.style.opacity="",we&&(i.style.stroke=we),ce!==null&&(i.style.strokeWidth=`${ce}`),Ee!==null&&(i.style.fillOpacity=`${Ee}`));}),r)return Z&&(e.style.clipPath=Se(1)),re?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=Se(y==="reverse"?1:0));let $t=typeof m=="string"?st(m):null;function mr(){return !(F===false||ie||se&&ze||!Ar()||!c.length||!$t||Z||b!=="y"||G||l!==1||S!==0||H||me||A!==false||N||x||ee||R>0||Oe||J||re||he||Ne||be||pe||M!=null||C!=null||D!=null||(g.start||"top bottom").trim()!=="top bottom"||(g.end||"bottom top").trim()!=="bottom top")}function pr(){let i=++Lr,f=`svg-scroll-draw-${i}`,d=`svg-scroll-draw-host-${i}`,E=`--svg-scroll-draw-${i}`,j=y==="reverse"?"0":"var(--ssd-len)",ne=y==="reverse"?"var(--ssd-len)":"0",U=`stroke-dashoffset:${j};`,O=`stroke-dashoffset:${ne};`;u&&(U+=`opacity:${y==="reverse"?1:0};`,O+=`opacity:${y==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${f}{from{${U}}to{${O}}}.${d}{view-timeline-name:${E};view-timeline-axis:block;}.${f}{animation-name:${f};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${E};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(d);function K(h,L){h.style.setProperty("--ssd-len",String(p[L])),h.style.strokeDasharray=nt(p[L]),h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(f);}c.forEach(K);let Y=false,oe=-1;function le(){if(oe>=0)return oe;let h=e.getBoundingClientRect(),{tStart:L,tEnd:X}=ge({top:h.top,height:h.height},et(),Lt(),Fe,Ge);return Q(z(et(),L,X,l))}return {destroy(){e.classList.remove(d),c.forEach(h=>{h.classList.remove(f),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),I.remove();},replay(){Y=false,oe=-1,c.forEach(K);},pause(){Y=true,c.forEach(h=>{h.style.animationPlayState="paused";});},resume(){Y&&(Y=false,c.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let L=Math.min(1,Math.max(0,h));oe=L,Y=true,c.forEach((X,xe)=>{X.classList.remove(f),X.style.strokeDashoffset=y==="reverse"?`${p[xe]*L}`:`${p[xe]*(1-L)}`,u&&(X.style.opacity=y==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return le()},refresh(){c.forEach((h,L)=>{Be(h,L),h.style.setProperty("--ssd-len",String(p[L]));});}}}if(mr())return gt(pr());function dr(){let i=Math.max(1,v),f=Z?i:i*(1+Math.max(0,c.length-1)*S),d=0,E=0,j=false;function ne(oe){let le=true,h=Math.min(1,Math.max(0,oe/f));if(Z){let L=Math.min(1,Math.max(0,oe/i)),X=Q(L);de=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=Se(y==="reverse"?1-X:X),Oe?.(X),L<1&&(le=false);}else {c.forEach((X,xe)=>{let yr=xe*S*i,Ht=Math.min(1,Math.max(0,(oe-yr)/i));yt(X,xe,Q(Ht),y),Ht<1&&(le=false);});let L=Q(h);de=L,Oe?.(L),e.style.setProperty("--scroll-draw-progress",String(L));}if(x){let L=Q(h);for(let X in x){let xe=parseFloat(X);L>=xe&&!Re.has(xe)&&(Re.add(xe),x[X]?.());}}return le}function U(oe){if(ae)return;let le=oe-d;Te||(Te=true,J?.());let h=ne(le);if(h&&!q){q=true,ne(f),re?.(),Ie<(ee==="infinite"?1/0:ee??0)&&(Ie++,He=setTimeout(()=>{d=performance.now(),Te=false,q=false,Re.clear(),ht(),Me=requestAnimationFrame(U);},te));return}h||(Me=requestAnimationFrame(U));}function O(){cancelAnimationFrame(Me),clearTimeout(He),d=performance.now(),E=0,ae=false,Te=false,q=false,Ie=0,j=true,de=0,Re.clear(),ht(),Me=requestAnimationFrame(U);}let I=new IntersectionObserver(oe=>{oe.forEach(le=>{le.isIntersecting&&!(H&&q)?O():!le.isIntersecting&&!H&&!q&&(cancelAnimationFrame(Me),clearTimeout(He),j=false);});},{root:G??null,threshold:W,rootMargin:ye}),K;function Y(){clearTimeout(K),K=setTimeout(()=>c.forEach(Be),150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),R>0?setTimeout(()=>I.observe(e),R):I.observe(e),{destroy(){cancelAnimationFrame(Me),clearTimeout(He),I.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(K);},replay(){Ie=0,O();},pause(){ae||!j||(ae=true,E=performance.now()-d,cancelAnimationFrame(Me));},resume(){ae&&(ae=false,j=true,d=performance.now()-E,Me=requestAnimationFrame(U));},seek(oe){let le=Math.min(1,Math.max(0,oe));de=le,ae=true,E=le*f,d=performance.now()-E,cancelAnimationFrame(Me),ne(E);},getProgress(){return de},refresh(){clearTimeout(K),c.forEach(Be);}}}if(ie)return gt(dr());Ct();let Dt=()=>z(et(),k,Pe,1);function kt(){q=true,re?.(),Ie<(ee==="infinite"?1/0:ee)&&(Ie++,He=setTimeout(()=>{pt=true;},te));}function Ot(){mt=-1,Je=[],Te=false,q=false,pt=false,Re.clear(),ht(),_e=true;}function gr(){let i=performance.now(),f=et();if(pt&&Dt()%1&&Ot(),!_e&&A===false&&f===Mt)return;_e=false,Mt=f;let d=l;if(A!==false){let O=i-xt,I=O>0?Math.abs(f-(Ke<0?f:Ke))/O:0;d=l*Math.max(.2,1+I*(typeof A=="number"?A:1)*.04);}Ke=f,xt=i;let E=me?Ze===-1||f>=Ze?"forward":"reverse":y;Ze=f;let j=P-T,ne=true,U=j===0?0:(f-T)/j;if(isNaN(Ve)||(Ve<=0&&U>0&&he?.(),Ve<1&&U>=1&&Ne?.(),Ve>=1&&U<1&&be?.(),Ve>0&&U<=0&&pe?.()),Ve=U,Z){let O=Pt(0,z(f,T,P,d));de=O,e.style.setProperty("--scroll-draw-progress",String(O));let I=E==="reverse"?1-O:O;e.style.clipPath=Se(I),Oe?.(O),!Te&&z(f,T,P,d)>0&&(Te=true,J?.()),O>=1&&!q?kt():O<1&&!H&&(q=false);return}if(c.forEach((O,I)=>{let K=I*_*j,Y=Pt(I,z(f,T+K,P+K,d));yt(O,I,Y,E),I===0&&(de=Y,Oe?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(ne=false);}),x){let O=Q(z(f,T,P,d));for(let I in x){let K=parseFloat(I);O>=K&&!Re.has(K)&&(Re.add(K),x[I]?.());}}!Te&&z(f,T,P,d)>0&&(Te=true,J?.()),ne&&!q?kt():!ne&&!H&&(q=false);}let qe=ke(G??window,[e],Dt,gr,()=>{let i=p.join();c.forEach(Be),Ct(),_e=true,p.join()!==i&&je();}),bt=R>0;function je(){qe.hold(ae||bt);}let It;return bt&&(It=setTimeout(()=>{bt=false,je();},R)),je(),gt({destroy(){clearTimeout(He),clearTimeout(It),qe.off(),Tt();},replay(){Ot(),Ze=-1,Ke=-1,Ie=0,ae=false,de=0,clearTimeout(He),je();},pause(){ae=true,qe.hold(true);},resume(){ae&&(ae=false,_e=true,je());},seek(i){let f=Math.min(1,Math.max(0,i));de=f,mt=f,Je=[],ae=true,qe.hold(true),fr(f,y),_e=true;},getProgress(){return de},refresh:qe.remeasure},()=>({tStart:T,tEnd:P}))}function Or(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Zt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let o=[],s=[],a=n[2].trim();if(a)for(let l of a.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:n[1],nums:o,units:s});}return t}function Ir(e,t,r){let n=Zt(e),o=Zt(t);return n.length===0||n.length!==o.length?r<1?e:t:n.map((s,a)=>{let l=o[a];return s.fn!==l.fn||s.nums.length!==l.nums.length?r<1?`${s.fn}(${s.nums.map((u,m)=>`${u}${s.units[m]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,m)=>`${u}${l.units[m]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,m)=>`${u+(l.nums[m]-u)*r}${s.units[m]}`).join(", ")})`}).join(" ")}function Kt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),o=String(t);if(Or(n))return ot(n,o,r);if(n.includes("("))return Ir(n,o,r);let s=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let l=parseFloat(s[1]),u=parseFloat(a[1]);return `${l+(u-l)*r}${s[2]||a[2]}`}return r<1?n:o}function Hr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Nr=0,er="--scroll-draw-progress";function Fr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var rr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nr(e,t){return typeof window>"u"?rr:t.respectReducedMotion===false?tr(e,t,false):De(t,(r,n)=>tr(e,r,n))}function tr(e,t,r){let{props:n,trigger:o={},easing:s="ease-out",speed:a=1,once:l=false,axis:u="y",scrollContainer:m,native:g=true,velocityScale:S=false,triggerElement:y,onProgress:H,onComplete:se,onEnter:b,onLeave:$,onEnterBack:me,onLeaveBack:R}=t,M=$e(s,"ease-out"),C=fe(o.start||"top bottom"),D=fe(o.end||"bottom top"),x=y??e,A=typeof m=="string"?document.querySelector(m):m??null,W=Object.entries(n).map(([c,p])=>({prop:Hr(c),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function ye(){let c=window.getComputedStyle(e);for(let p of W)p.from===""&&(p.from=c.getPropertyValue(p.prop).trim()||"0");}function ee(){for(let c of W)e.style.setProperty(c.prop,String(c.to));}let te=new Map;for(let c of [...W.map(p=>p.prop),er])te.set(c,e.style.getPropertyValue(c));function N(){for(let[c,p]of te)p?e.style.setProperty(c,p):e.style.removeProperty(c);}if(r)return ee(),se?.(),{...rr,destroy:N,getProgress:()=>1};ye();let w=()=>A?u==="x"?A.scrollLeft:A.scrollTop:u==="x"?window.scrollX:window.scrollY,ie=()=>A?u==="x"?A.clientWidth:A.clientHeight:u==="x"?window.innerWidth:window.innerHeight,v=typeof s=="string"?st(s):null;function F(){if(!g||!Fr()||!v||u!=="y"||A||x!==e||l||a!==1||H||se||b||$||me||R||S!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let c of W)if(!Rr.has(c.prop))return false;return true}function Oe(){let c=`ssd-a-${++Nr}`,p=W.map(k=>`${k.prop}:${k.from}`).join(";"),B=W.map(k=>`${k.prop}:${k.to}`).join(";"),T=document.createElement("style");T.setAttribute("data-ssd-animate",""),T.textContent=`@keyframes ${c}{from{${p}}to{${B}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${v};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(T),e.classList.add(c);let P=()=>{let k=e.getBoundingClientRect();return ge({top:k.top,height:k.height},w(),ie(),C,D)};Le(e,{type:"animate",getProgress:()=>_.getProgress(),getTrigger:P});let _={refresh(){},destroy(){e.classList.remove(c),T.remove(),e.style.animationPlayState="",N(),Ae(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Pe=Math.min(1,Math.max(0,k));e.classList.remove(c);for(let q of W)e.style.setProperty(q.prop,Kt(q.from,q.to,Pe));},getProgress(){let{tStart:k,tEnd:Pe}=P();return M(z(w(),k,Pe,a))}};return _}if(F())return Oe();let J=0,re=0,he=false,Ne=-1,be=0,pe=0,Z=false,Q=NaN,Fe=-1,Ge=0,G=x===e?W:[],we=false;function ve(){let c=e.style,p=G.map(_=>c.getPropertyValue(_.prop)),B=c.transition;G.length&&(c.transition="none"),G.forEach(_=>c.setProperty(_.prop,te.get(_.prop)??""));let T=tt(x,A,u);G.forEach((_,k)=>c.setProperty(_.prop,p[k])),G.length&&(e.offsetWidth,c.transition=B);let P=ge(T,T.scroll,ie(),C,D);we&&Math.abs(P.tStart-J)<1&&Math.abs(P.tEnd-re)<1||(we=true,J=P.tStart,re=P.tEnd);}function ce(c){e.style.setProperty(er,String(c));for(let p of W)e.style.setProperty(p.prop,Kt(p.from,p.to,c));H?.(c);}function Ce(c){if(isNaN(Q)){Q=c;return}Q<=0&&c>0&&b?.(),Q<1&&c>=1&&$?.(),Q>=1&&c<1&&me?.(),Q>0&&c<=0&&R?.(),Q=c;}function Ee(){if(he)return;let c=performance.now(),p=w(),B=a;if(S!==false){let k=c-Ge,Pe=k>0?Math.abs(p-(Fe<0?p:Fe))/k:0;B=a*Math.max(.2,1+Pe*(typeof S=="number"?S:1)*.04);}Fe=p,Ge=c;let T=re===J?0:(p-J)/(re-J);Ce(T);let P=z(p,J,re,B),_=l?Math.max(Ne,M(be=Math.max(be,P))):M(P);pe=_,ce(_),_>=1&&!Z?(Z=true,se?.()):_<1&&!l&&(Z=false);}let ue=ke(A??window,[x],()=>z(w(),J,re,Math.min(a,1)),Ee,ve);ve(),re===J&&V("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),be=z(w(),J,re,a),pe=M(be),ce(pe),Le(e,{type:"animate",getProgress:()=>pe,getTrigger:()=>({tStart:J,tEnd:re})});function Se(){he=true,ue.hold(true);}return {destroy(){he=true,ue.off(),N(),Ae(e);},replay(){Ne=-1,be=0,Z=false,pe=0,he=false,ce(0),ue.hold(false);},pause:Se,resume(){he&&(he=false,ue.hold(false));},seek(c){let p=Math.min(1,Math.max(0,c));pe=p,Ne=p,be=0,Se(),ce(p);},getProgress(){return pe},refresh:ue.remeasure}}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t){if(typeof window>"u")return vt;let r=typeof e=="string"?document.querySelector(e):e;return r?De(t,(n,o)=>_r(r,n,o)):(V("scrollCounter: element not found:",e),vt)}function _r(e,t,r){let{from:n=0,to:o,format:s,easing:a="ease-out",trigger:l={},once:u=true,decimals:m,onComplete:g}=t,S=m!==void 0?v=>v.toFixed(m):s??(v=>String(Math.round(v))),y=$e(a,"ease-out"),H=fe(l.start||"top 80%"),se=fe(l.end||"top 20%");if(r)return e.textContent=S(o),g?.(),{...vt,getProgress:()=>1};let b=0,$=0,me=false,R=-1,M=0,C=0,D=false,x=()=>window.scrollY,A=()=>window.innerHeight;function W(){let v=e.getBoundingClientRect(),F=ge({top:v.top,height:v.height},x(),A(),H,se);me&&Math.abs(F.tStart-b)<1&&Math.abs(F.tEnd-$)<1||(me=true,b=F.tStart,$=F.tEnd);}let ye=e.style.getPropertyValue("--scroll-draw-progress");function ee(v){e.textContent=S(n+(o-n)*v),e.style.setProperty("--scroll-draw-progress",String(v));}let te=()=>z(x(),b,$,1);function N(){let v=te(),F=u?Math.max(R,y(M=Math.max(M,v))):y(v);C=F,ee(F),F>=1&&!D?(D=true,g?.()):F<1&&!u&&(D=false);}W();{M=z(x(),b,$,1);let v=y(M);C=v,ee(v);}let w=ke(window,[e],te,N,W);Le(e,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:b,tEnd:$})});let ie=()=>w.hold(false);return {destroy(){w.off(),e.style.setProperty("--scroll-draw-progress",ye),Ae(e);},replay(){R=-1,M=0,D=false,C=0,ee(0),ie();},pause:()=>w.hold(true),resume:ie,seek(v){let F=Math.min(1,Math.max(0,v));C=F,R=F,M=0,w.hold(true),ee(F);},getProgress(){return C}}}function sr(e,t){let r=document.createElement("span");r.textContent=t,r.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(r);}function ct(e=""){let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=e,t}function ar(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(r=>{let n=e.appendChild(ct(r)),o=/^\s+$/.test(r);return o?n.style.whiteSpace="pre":n.style.display="inline-block",o?null:n}).filter(r=>r!==null)}function Vr(e){let t=e.textContent??"";e.textContent="";let r=[],n=null;for(let o of t){let s=ct(o),a=o===" ";a?s.style.whiteSpace="pre":(s.style.display="inline-block",r.push(s)),a||o>"\u0DFF"?n=null:n||(n=e.appendChild(ct()),n.style.cssText="display:inline-block;white-space:nowrap"),(n??e).appendChild(s);}return r}function ir(e){let t=ar(e),r=new Map;for(let s of t){let a=s.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(s);}let n=[],o=Array.from(r.keys()).sort((s,a)=>s-a);for(let s of o){let a=r.get(s),l=ct();l.style.display="inline-block",a.forEach((u,m)=>{let g=u.nextElementSibling;l.appendChild(u),m<a.length-1&&g&&g.style.whiteSpace==="pre"&&l.appendChild(g);}),n.push(l);}return e.textContent="",n.forEach((s,a)=>{e.appendChild(s),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function zr(e,t,r,n){if(r<=1||n===0)return e;n=Math.min(n,1/r);let o=(r-1)*n,s=t*n,a=s+(1-o);return a<=s?e>=s?1:0:Qe((e-s)/(a-s),0,1)}function Wr(e,t){let r=[];if(t?.y!==void 0&&r.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&r.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&r.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let n=t.scale+(1-t.scale)*e;r.push(`scale(${n})`);}return r.join(" ")}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,t={}){if(typeof window>"u")return Et;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return V("scrollText: element not found:",e),Et;let n=r;return De(t,(o,s)=>Gr(n,o,s))}function Gr(e,t,r){let{split:n="words",stagger:o=.04,easing:s="ease-out",from:a={opacity:0,y:24},trigger:l={},once:u=true,onComplete:m}=t,g=$e(s,"ease-out"),S=fe(l.start||"top 85%"),y=fe(l.end||"top 40%"),H=e.innerHTML,se=e.textContent??"",b;n==="chars"?b=Vr(e):n==="lines"?b=ir(e):b=ar(e),sr(e,se);let $=b.length;function me(w,ie){a?.opacity!==void 0&&(w.style.opacity=String(a.opacity+(1-a.opacity)*ie));let v=Wr(ie,a);v&&(w.style.transform=v);}function R(w){e.style.setProperty("--scroll-draw-progress",String(w)),b.forEach((ie,v)=>{let F=g(zr(w,v,$,o));me(ie,F);});}if(r)return R(1),m?.(),{...Et,destroy:()=>{e.innerHTML=H;},getProgress:()=>1};R(0);let M=0,C=0,D=-1,x=0,A=false;function W(){({tStart:M,tEnd:C}=ge(e.getBoundingClientRect(),window.scrollY,window.innerHeight,S,y));}let ye=()=>z(window.scrollY,M,C,1);function ee(){let w=u?D=Math.max(D,ye()):ye();x=w,R(w),w>=1&&!A?(A=true,m?.()):w<1&&!u&&(A=false);}W();let te=ke(window,[e],ye,ee,()=>{n==="lines"&&(e.innerHTML=H,b=ir(e),sr(e,se),R(x)),W();});Le(e,{type:"text",getProgress:()=>x,getTrigger:()=>({tStart:M,tEnd:C})});let N=()=>te.hold(false);return {destroy(){te.off(),e.innerHTML=H,Ae(e);},replay(){D=-1,A=false,x=0,R(0),N();},pause:()=>te.hold(true),resume:N,seek(w){te.hold(true),R(x=D=Qe(w,0,1));},getProgress(){return x}}}function Br(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?lt(n,t):(V("Container not found:",e),r)}function Xe(){return typeof document>"u"?null:document}var St=new WeakMap,cr;function ut(e,t,r,n){let o=St.get(e)??new Map;St.set(e,o);let s=()=>{let u=r(),m=o.get(t);m&&m.key===u||(m?.inst.destroy(),o.set(t,{inst:n(u),key:u,build:s,users:m?.users??0}));};s(),o.get(t).users++;let a=true;typeof MutationObserver<"u"&&(cr??(cr=new MutationObserver(u=>u.forEach(m=>St.get(m.target)?.forEach(g=>g.build())))),cr.observe(e,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(u=>`data-scroll-${u}-options`).concat("data-scroll-drawoptions")}));let l=()=>o.get(t)?.inst;return {destroy:()=>{let u=o.get(t);!a||!u||(a=false,!(--u.users>0)&&(u.inst.destroy(),o.delete(t)));},replay:()=>l()?.replay(),pause:()=>l()?.pause(),resume:()=>l()?.resume(),seek:u=>l()?.seek(u),getProgress:()=>l()?.getProgress()??0,refresh:()=>l()?.refresh?.()}}function ft(e,t){try{return e?JSON.parse(e):t}catch{return t}}function qr(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-draw]")).map(t=>ut(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",r=>lt(t,ft(r,{})))):[]}function jr(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-animate]")).map(t=>ut(t,"animate",()=>t.dataset.scrollAnimateOptions??"",r=>nr(t,ft(r,{props:{}})))):[]}function Qr(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-counter]")).map(t=>ut(t,"counter",()=>t.dataset.scrollCounterOptions??"",r=>{let n=ft(r,{});return !n.to&&n.to!==0&&(V('initScrollCounter: element missing "to" in options JSON:',t),n.to=0),typeof n.format!="function"&&n.format!==void 0&&(V('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete n.format),or(t,n)})):[]}function Ur(e=Xe()){return e?Array.from(e.querySelectorAll("[data-scroll-text]")).map(t=>ut(t,"text",()=>t.dataset.scrollTextOptions??"",r=>lr(t,ft(r,{})))):[]}function lo(e=Xe()){return {draw:qr(e),animate:jr(e),counter:Qr(e),text:Ur(e)}}exports.initAll=lo;exports.initScrollAnimate=jr;exports.initScrollCounter=Qr;exports.initScrollDraw=qr;exports.initScrollText=Ur;exports.scrollDraw=Br;
|
package/dist/astro/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance } from '../types-
|
|
2
|
-
export { a as ScrollDrawOptions } from '../types-
|
|
3
|
-
export { s as scrollDraw } from '../scroll-draw-
|
|
1
|
+
import { S as ScrollDrawInstance } from '../types-iITMwrru.mjs';
|
|
2
|
+
export { a as ScrollDrawOptions } from '../types-iITMwrru.mjs';
|
|
3
|
+
export { s as scrollDraw } from '../scroll-draw-CKZysh22.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Auto-initialises all elements with a [data-scroll-draw] attribute on the page.
|
package/dist/astro/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { S as ScrollDrawInstance } from '../types-
|
|
2
|
-
export { a as ScrollDrawOptions } from '../types-
|
|
3
|
-
export { s as scrollDraw } from '../scroll-draw-
|
|
1
|
+
import { S as ScrollDrawInstance } from '../types-iITMwrru.js';
|
|
2
|
+
export { a as ScrollDrawOptions } from '../types-iITMwrru.js';
|
|
3
|
+
export { s as scrollDraw } from '../scroll-draw-DbY8RUJE.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Auto-initialises all elements with a [data-scroll-draw] attribute on the page.
|
package/dist/astro/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollDraw}from'../chunk-
|
|
1
|
+
export{a as scrollDraw}from'../chunk-5U4JXBHR.mjs';import {a as a$2}from'../chunk-UF3MO5XQ.mjs';import {a as a$1}from'../chunk-Z72TVDHY.mjs';import {a}from'../chunk-HAGTU5EX.mjs';import {b}from'../chunk-XLXVGQ3P.mjs';import'../chunk-7LDSB4FT.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-YOOPMYT6.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import {b as b$1}from'../chunk-LFSU6LR3.mjs';function i(){return typeof document>"u"?null:document}var p=new WeakMap,g;function c(r,t,n,o){let l=p.get(r)??new Map;p.set(r,l);let f=()=>{let e=n(),s=l.get(t);s&&s.key===e||(s?.inst.destroy(),l.set(t,{inst:o(e),key:e,build:f,users:s?.users??0}));};f(),l.get(t).users++;let S=true;typeof MutationObserver<"u"&&(g??(g=new MutationObserver(e=>e.forEach(s=>p.get(s.target)?.forEach(O=>O.build())))),g.observe(r,{attributes:true,attributeFilter:["draw","animate","counter","text"].map(e=>`data-scroll-${e}-options`).concat("data-scroll-drawoptions")}));let a=()=>l.get(t)?.inst;return {destroy:()=>{let e=l.get(t);!S||!e||(S=false,!(--e.users>0)&&(e.inst.destroy(),l.delete(t)));},replay:()=>a()?.replay(),pause:()=>a()?.pause(),resume:()=>a()?.resume(),seek:e=>a()?.seek(e),getProgress:()=>a()?.getProgress()??0,refresh:()=>a()?.refresh?.()}}function u(r,t){try{return r?JSON.parse(r):t}catch{return t}}function E(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-draw]")).map(t=>c(t,"draw",()=>t.dataset.scrollDrawOptions??t.dataset.scrollDrawoptions??"",n=>b(t,u(n,{})))):[]}function A(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-animate]")).map(t=>c(t,"animate",()=>t.dataset.scrollAnimateOptions??"",n=>a(t,u(n,{props:{}})))):[]}function I(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-counter]")).map(t=>c(t,"counter",()=>t.dataset.scrollCounterOptions??"",n=>{let o=u(n,{});return !o.to&&o.to!==0&&(b$1('initScrollCounter: element missing "to" in options JSON:',t),o.to=0),typeof o.format!="function"&&o.format!==void 0&&(b$1('initScrollCounter: "format" must be a function, so it cannot come from JSON; use "decimals":',t),delete o.format),a$1(t,o)})):[]}function M(r=i()){return r?Array.from(r.querySelectorAll("[data-scroll-text]")).map(t=>c(t,"text",()=>t.dataset.scrollTextOptions??"",n=>a$2(t,u(n,{})))):[]}function H(r=i()){return {draw:E(r),animate:A(r),counter:I(r),text:M(r)}}export{H as initAll,A as initScrollAnimate,I as initScrollCounter,E as initScrollDraw,M as initScrollText};
|
|
@@ -32,6 +32,28 @@ var SvgScrollDraw = (() => {
|
|
|
32
32
|
scrollParallax: () => scrollParallax
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
+
// src/core/env.ts
|
|
36
|
+
var IS_DEV = (
|
|
37
|
+
/*
|
|
38
|
+
* Build-time override, substituted as a literal by the two CDN builds.
|
|
39
|
+
*
|
|
40
|
+
* The `process` test below is unanswerable without a bundler — `process` does
|
|
41
|
+
* not exist in a browser — so `IS_DEV` was false for every CDN user, the people
|
|
42
|
+
* least likely to have any other diagnostics available. Every warning this
|
|
43
|
+
* library has was invisible to exactly them, including the zero-length trigger
|
|
44
|
+
* window that would have caught the `scrollHorizontal` defect.
|
|
45
|
+
*
|
|
46
|
+
* `svg-scroll-draw.dev.global.js` defines this to `true`; the production CDN
|
|
47
|
+
* build defines it to `false`, which also lets the minifier drop the warning
|
|
48
|
+
* bodies outright. Left undefined for the npm builds, where the `process` test
|
|
49
|
+
* is the right one and bundlers fold it away.
|
|
50
|
+
*/
|
|
51
|
+
true ? true : typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV !== "production"
|
|
52
|
+
);
|
|
53
|
+
function warn(msg, ...rest) {
|
|
54
|
+
if (IS_DEV) console.warn(`[svg-scroll-draw] ${msg}`, ...rest);
|
|
55
|
+
}
|
|
56
|
+
|
|
35
57
|
// src/core/easing.ts
|
|
36
58
|
function createSpring({
|
|
37
59
|
tension = 2.5,
|
|
@@ -98,6 +120,39 @@ var SvgScrollDraw = (() => {
|
|
|
98
120
|
bounce: createBounce(),
|
|
99
121
|
elastic: createElastic()
|
|
100
122
|
};
|
|
123
|
+
function cubicBezier(x1, y1, x2, y2) {
|
|
124
|
+
const at = (a, b, u) => ((1 + 3 * a - 3 * b) * u + 3 * b - 6 * a) * u * u + 3 * a * u;
|
|
125
|
+
return (x) => {
|
|
126
|
+
if (x <= 0 || x >= 1) return +(x > 0);
|
|
127
|
+
let u = x;
|
|
128
|
+
for (let i = 0; i < 8; i++)
|
|
129
|
+
u -= (at(x1, x2, u) - x) / ((3 * (1 + 3 * x1 - 3 * x2) * u + 6 * x2 - 12 * x1) * u + 3 * x1);
|
|
130
|
+
if (!(u >= 0 && u <= 1 && Math.abs(at(x1, x2, u) - x) < 1e-9))
|
|
131
|
+
for (let i = 0, lo = 0, hi = 1; i < 30; i++) {
|
|
132
|
+
u = (lo + hi) / 2;
|
|
133
|
+
if (at(x1, x2, u) < x) lo = u;
|
|
134
|
+
else hi = u;
|
|
135
|
+
}
|
|
136
|
+
return at(y1, y2, u);
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function cssEasing(s) {
|
|
140
|
+
const m = /^cubic-bezier\((.*)\)$/.exec(s === "ease" ? "cubic-bezier(.25,.1,.25,1)" : s.trim());
|
|
141
|
+
const v = m ? m[1].split(",").map(parseFloat) : [];
|
|
142
|
+
if (v.length === 4 && v.every(Number.isFinite) && v[0] * (1 - v[0]) >= 0 && v[2] * (1 - v[2]) >= 0)
|
|
143
|
+
return [cubicBezier(v[0], v[1], v[2], v[3]), `cubic-bezier(${v})`];
|
|
144
|
+
}
|
|
145
|
+
var warned = /* @__PURE__ */ new Set();
|
|
146
|
+
function resolveEasing(easing, fallback = "linear") {
|
|
147
|
+
if (typeof easing === "function") return easing;
|
|
148
|
+
if (easing == null) return EASINGS[fallback];
|
|
149
|
+
if ({}.hasOwnProperty.call(EASINGS, easing)) return EASINGS[easing];
|
|
150
|
+
const css = cssEasing(String(easing));
|
|
151
|
+
if (css) return css[0];
|
|
152
|
+
if (!warned.has(easing) && warned.add(easing))
|
|
153
|
+
warn(`Unknown easing ${JSON.stringify(easing)}: use a name, cubic-bezier() or a function.`);
|
|
154
|
+
return EASINGS[fallback];
|
|
155
|
+
}
|
|
101
156
|
|
|
102
157
|
// src/core/math.ts
|
|
103
158
|
function clamp(value, min, max) {
|
|
@@ -160,6 +215,11 @@ var SvgScrollDraw = (() => {
|
|
|
160
215
|
return el.getTotalLength();
|
|
161
216
|
}
|
|
162
217
|
|
|
218
|
+
// src/core/dash.ts
|
|
219
|
+
function dashFor(len) {
|
|
220
|
+
return `${len} ${len * 2}`;
|
|
221
|
+
}
|
|
222
|
+
|
|
163
223
|
// src/core/color.ts
|
|
164
224
|
function parseColor(color) {
|
|
165
225
|
const short = /^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(color);
|
|
@@ -231,28 +291,6 @@ var SvgScrollDraw = (() => {
|
|
|
231
291
|
}
|
|
232
292
|
};
|
|
233
293
|
|
|
234
|
-
// src/core/env.ts
|
|
235
|
-
var IS_DEV = (
|
|
236
|
-
/*
|
|
237
|
-
* Build-time override, substituted as a literal by the two CDN builds.
|
|
238
|
-
*
|
|
239
|
-
* The `process` test below is unanswerable without a bundler — `process` does
|
|
240
|
-
* not exist in a browser — so `IS_DEV` was false for every CDN user, the people
|
|
241
|
-
* least likely to have any other diagnostics available. Every warning this
|
|
242
|
-
* library has was invisible to exactly them, including the zero-length trigger
|
|
243
|
-
* window that would have caught the `scrollHorizontal` defect.
|
|
244
|
-
*
|
|
245
|
-
* `svg-scroll-draw.dev.global.js` defines this to `true`; the production CDN
|
|
246
|
-
* build defines it to `false`, which also lets the minifier drop the warning
|
|
247
|
-
* bodies outright. Left undefined for the npm builds, where the `process` test
|
|
248
|
-
* is the right one and bundlers fold it away.
|
|
249
|
-
*/
|
|
250
|
-
true ? true : typeof process !== "undefined" && typeof process.env !== "undefined" && process.env.NODE_ENV !== "production"
|
|
251
|
-
);
|
|
252
|
-
function warn(msg, ...rest) {
|
|
253
|
-
if (IS_DEV) console.warn(`[svg-scroll-draw] ${msg}`, ...rest);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
294
|
// src/core/css-easing.ts
|
|
257
295
|
var QUAD_IN = "cubic-bezier(0.333333, 0, 0.666667, 0.333333)";
|
|
258
296
|
var QUAD_OUT = "cubic-bezier(0.333333, 0.666667, 0.666667, 1)";
|
|
@@ -279,7 +317,7 @@ var SvgScrollDraw = (() => {
|
|
|
279
317
|
case "ease-in-out":
|
|
280
318
|
return supportsLinearTiming() ? sampleAsLinear(EASINGS["ease-in-out"]) : null;
|
|
281
319
|
default:
|
|
282
|
-
return null;
|
|
320
|
+
return cssEasing(easing)?.[1] ?? null;
|
|
283
321
|
}
|
|
284
322
|
}
|
|
285
323
|
|
|
@@ -569,7 +607,7 @@ var SvgScrollDraw = (() => {
|
|
|
569
607
|
onLeaveBack
|
|
570
608
|
} = options;
|
|
571
609
|
const clipDirection = clip === true ? "left" : typeof clip === "string" ? clip : false;
|
|
572
|
-
const easeFn =
|
|
610
|
+
const easeFn = resolveEasing(easing);
|
|
573
611
|
const startConfig = parseTrigger(trigger.start || "top bottom");
|
|
574
612
|
const endConfig = parseTrigger(trigger.end || "bottom top");
|
|
575
613
|
const scrollEl = typeof scrollContainer === "string" ? document.querySelector(scrollContainer) : scrollContainer ?? null;
|
|
@@ -703,7 +741,7 @@ var SvgScrollDraw = (() => {
|
|
|
703
741
|
return;
|
|
704
742
|
}
|
|
705
743
|
paths.forEach((el, i) => {
|
|
706
|
-
el.style.strokeDasharray =
|
|
744
|
+
el.style.strokeDasharray = dashFor(lengths[i]);
|
|
707
745
|
el.style.strokeDashoffset = direction === "reverse" ? "0" : `${lengths[i]}`;
|
|
708
746
|
if (fade) el.style.opacity = direction === "reverse" ? "1" : "0";
|
|
709
747
|
else el.style.opacity = "";
|
|
@@ -725,7 +763,7 @@ var SvgScrollDraw = (() => {
|
|
|
725
763
|
el.setAttribute("d", d);
|
|
726
764
|
}
|
|
727
765
|
lengths[i] = len;
|
|
728
|
-
el.style.strokeDasharray =
|
|
766
|
+
el.style.strokeDasharray = dashFor(len);
|
|
729
767
|
}
|
|
730
768
|
paths.forEach((el, i) => {
|
|
731
769
|
checkElement(el);
|
|
@@ -814,7 +852,7 @@ var SvgScrollDraw = (() => {
|
|
|
814
852
|
container.classList.add(containerCls);
|
|
815
853
|
function attach(el, i) {
|
|
816
854
|
el.style.setProperty("--ssd-len", String(lengths[i]));
|
|
817
|
-
el.style.strokeDasharray =
|
|
855
|
+
el.style.strokeDasharray = dashFor(lengths[i]);
|
|
818
856
|
el.style.strokeDashoffset = "";
|
|
819
857
|
el.style.opacity = "";
|
|
820
858
|
el.style.animationPlayState = "";
|
|
@@ -1343,7 +1381,7 @@ var SvgScrollDraw = (() => {
|
|
|
1343
1381
|
onEnterBack,
|
|
1344
1382
|
onLeaveBack
|
|
1345
1383
|
} = options;
|
|
1346
|
-
const easeFn =
|
|
1384
|
+
const easeFn = resolveEasing(easing, "ease-out");
|
|
1347
1385
|
const startConfig = parseTrigger(trigger.start || "top bottom");
|
|
1348
1386
|
const endConfig = parseTrigger(trigger.end || "bottom top");
|
|
1349
1387
|
const triggerEl = triggerElement ?? el;
|
|
@@ -1685,7 +1723,7 @@ var SvgScrollDraw = (() => {
|
|
|
1685
1723
|
onComplete
|
|
1686
1724
|
} = options;
|
|
1687
1725
|
const fmt = decimals !== void 0 ? (n) => n.toFixed(decimals) : format ?? ((n) => String(Math.round(n)));
|
|
1688
|
-
const easeFn =
|
|
1726
|
+
const easeFn = resolveEasing(easing, "ease-out");
|
|
1689
1727
|
const startConfig = parseTrigger(trigger.start || "top 80%");
|
|
1690
1728
|
const endConfig = parseTrigger(trigger.end || "top 20%");
|
|
1691
1729
|
if (prefersReduced) {
|
|
@@ -1787,7 +1825,7 @@ var SvgScrollDraw = (() => {
|
|
|
1787
1825
|
return Number.isFinite(n) ? clamp01(n / 100) : 0;
|
|
1788
1826
|
}
|
|
1789
1827
|
function easeOf(name) {
|
|
1790
|
-
return
|
|
1828
|
+
return resolveEasing(name);
|
|
1791
1829
|
}
|
|
1792
1830
|
var still = (progress) => ({ destroy() {
|
|
1793
1831
|
}, getProgress: () => progress });
|
|
@@ -1837,7 +1875,7 @@ var SvgScrollDraw = (() => {
|
|
|
1837
1875
|
path.setAttribute("stroke-linecap", "round");
|
|
1838
1876
|
path.setAttribute("stroke-linejoin", "round");
|
|
1839
1877
|
const len = a.length || path.getTotalLength?.() || 0;
|
|
1840
|
-
path.style.strokeDasharray =
|
|
1878
|
+
path.style.strokeDasharray = dashFor(len);
|
|
1841
1879
|
path.style.strokeDashoffset = String(len);
|
|
1842
1880
|
svg.appendChild(path);
|
|
1843
1881
|
records.push({
|