svg-scroll-draw 2.6.0 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/angular/index.cjs +3 -3
  2. package/dist/angular/index.d.mts +22 -0
  3. package/dist/angular/index.d.ts +22 -0
  4. package/dist/angular/index.mjs +3 -3
  5. package/dist/astro/index.cjs +3 -3
  6. package/dist/astro/index.d.mts +8 -0
  7. package/dist/astro/index.d.ts +8 -0
  8. package/dist/astro/index.mjs +3 -3
  9. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  10. package/dist/devtools/index.cjs +1 -1
  11. package/dist/devtools/index.mjs +1 -1
  12. package/dist/group/index.cjs +3 -3
  13. package/dist/group/index.d.mts +22 -0
  14. package/dist/group/index.d.ts +22 -0
  15. package/dist/group/index.mjs +3 -3
  16. package/dist/horizontal/index.cjs +1 -0
  17. package/dist/horizontal/index.d.mts +61 -0
  18. package/dist/horizontal/index.d.ts +61 -0
  19. package/dist/horizontal/index.mjs +1 -0
  20. package/dist/index.cjs +4 -4
  21. package/dist/index.d.mts +22 -0
  22. package/dist/index.d.ts +22 -0
  23. package/dist/index.mjs +4 -4
  24. package/dist/lenis/index.cjs +1 -0
  25. package/dist/lenis/index.d.mts +51 -0
  26. package/dist/lenis/index.d.ts +51 -0
  27. package/dist/lenis/index.mjs +1 -0
  28. package/dist/nuxt/index.cjs +2 -2
  29. package/dist/nuxt/index.d.mts +22 -0
  30. package/dist/nuxt/index.d.ts +22 -0
  31. package/dist/nuxt/index.mjs +2 -2
  32. package/dist/pin/index.cjs +1 -0
  33. package/dist/pin/index.d.mts +29 -0
  34. package/dist/pin/index.d.ts +29 -0
  35. package/dist/pin/index.mjs +1 -0
  36. package/dist/progress/index.cjs +1 -0
  37. package/dist/progress/index.d.mts +59 -0
  38. package/dist/progress/index.d.ts +59 -0
  39. package/dist/progress/index.mjs +1 -0
  40. package/dist/react/index.cjs +3 -3
  41. package/dist/react/index.d.mts +22 -0
  42. package/dist/react/index.d.ts +22 -0
  43. package/dist/react/index.mjs +3 -3
  44. package/dist/reveal/index.cjs +1 -0
  45. package/dist/reveal/index.d.mts +80 -0
  46. package/dist/reveal/index.d.ts +80 -0
  47. package/dist/reveal/index.mjs +1 -0
  48. package/dist/snap/index.cjs +1 -0
  49. package/dist/snap/index.d.mts +30 -0
  50. package/dist/snap/index.d.ts +30 -0
  51. package/dist/snap/index.mjs +1 -0
  52. package/dist/solid/index.cjs +3 -3
  53. package/dist/solid/index.d.mts +22 -0
  54. package/dist/solid/index.d.ts +22 -0
  55. package/dist/solid/index.mjs +3 -3
  56. package/dist/svelte/index.cjs +3 -3
  57. package/dist/svelte/index.d.mts +22 -0
  58. package/dist/svelte/index.d.ts +22 -0
  59. package/dist/svelte/index.mjs +3 -3
  60. package/dist/vue/index.cjs +2 -2
  61. package/dist/vue/index.d.mts +22 -0
  62. package/dist/vue/index.d.ts +22 -0
  63. package/dist/vue/index.mjs +2 -2
  64. package/dist/web-component/index.cjs +3 -3
  65. package/dist/web-component/index.mjs +3 -3
  66. package/package.json +31 -1
@@ -74,6 +74,14 @@ interface ScrollDrawOptions {
74
74
  onProgress?: (alpha: number) => void;
75
75
  onStart?: () => void;
76
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;
77
85
  /**
78
86
  * Trigger the animation when the element enters the viewport instead of
79
87
  * tying it to scroll position. The draw runs over `duration` milliseconds,
@@ -118,8 +126,22 @@ interface ScrollAnimateOptions {
118
126
  axis?: 'x' | 'y';
119
127
  scrollContainer?: string | Element;
120
128
  native?: boolean;
129
+ /**
130
+ * Scale animation speed by scroll velocity — faster scrolling = faster animation.
131
+ * Pass `true` for default sensitivity (1) or a number to control it.
132
+ * Higher values = more dramatic speed-up. Default sensitivity: 1.
133
+ */
134
+ velocityScale?: boolean | number;
121
135
  onProgress?: (alpha: number) => void;
122
136
  onComplete?: () => void;
137
+ /** Fires when scroll enters the trigger zone (scrolling forward). */
138
+ onEnter?: () => void;
139
+ /** Fires when scroll exits the trigger zone at the end (scrolling forward). */
140
+ onLeave?: () => void;
141
+ /** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
142
+ onEnterBack?: () => void;
143
+ /** Fires when scroll exits the trigger zone at the start (scrolling back). */
144
+ onLeaveBack?: () => void;
123
145
  }
124
146
 
125
147
  interface ScrollCounterOptions {
@@ -74,6 +74,14 @@ interface ScrollDrawOptions {
74
74
  onProgress?: (alpha: number) => void;
75
75
  onStart?: () => void;
76
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;
77
85
  /**
78
86
  * Trigger the animation when the element enters the viewport instead of
79
87
  * tying it to scroll position. The draw runs over `duration` milliseconds,
@@ -118,8 +126,22 @@ interface ScrollAnimateOptions {
118
126
  axis?: 'x' | 'y';
119
127
  scrollContainer?: string | Element;
120
128
  native?: boolean;
129
+ /**
130
+ * Scale animation speed by scroll velocity — faster scrolling = faster animation.
131
+ * Pass `true` for default sensitivity (1) or a number to control it.
132
+ * Higher values = more dramatic speed-up. Default sensitivity: 1.
133
+ */
134
+ velocityScale?: boolean | number;
121
135
  onProgress?: (alpha: number) => void;
122
136
  onComplete?: () => void;
137
+ /** Fires when scroll enters the trigger zone (scrolling forward). */
138
+ onEnter?: () => void;
139
+ /** Fires when scroll exits the trigger zone at the end (scrolling forward). */
140
+ onLeave?: () => void;
141
+ /** Fires when scroll re-enters the trigger zone from the end (scrolling back). */
142
+ onEnterBack?: () => void;
143
+ /** Fires when scroll exits the trigger zone at the start (scrolling back). */
144
+ onLeaveBack?: () => void;
123
145
  }
124
146
 
125
147
  interface ScrollCounterOptions {
@@ -1,3 +1,3 @@
1
- import zt,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function vt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,l=[];for(let p=0;p<r;p++){let I=Math.pow(i,p);l.push(I),o+=I;}let c=[0],a=0;for(let p=0;p<r;p++)a+=l[p]/o,c.push(a);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let I=0;I<r;I++)if(p<=c[I+1]){let k=(p-c[I])/(c[I+1]-c[I]);if(I===0)return k*(2-k);let E=1-Math.pow(t,I);return E+(1-E)*(2*k-1)*(2*k-1)}return 1}}function Et({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),i=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/t)+1}var te={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:vt(),elastic:Et()};function re(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function Je(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function Ze(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ve(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function St(e,n,r){return Math.min(r,Math.max(n,e))}function Y(e,n,r,t){return r===n?0:St((e-n)/(r-n)*t,0,1)}function fe(e,n,r,t,i){let o=Je(e.top,e.height,n,t.element)-Ze(t.viewport,r),l=Je(e.top,e.height,n,i.element)-Ze(i.viewport,r);return {tStart:o,tEnd:l}}function Ke(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[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 t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Le(e,n,r){let t=Ke(e),i=Ke(n);return !t||!i?e:`rgb(${Math.round(t[0]+(i[0]-t[0])*r)},${Math.round(t[1]+(i[1]-t[1])*r)},${Math.round(t[2]+(i[2]-t[2])*r)})`}var Qe={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}};function et(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var tt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},xt=0;function Tt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function At(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?et("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&et("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Mt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.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 i(){let o=r==="x"?window.scrollX:window.scrollY,l=e-o,c=n-o,a=r==="x";t.innerHTML=`
2
- <div style="position:absolute;${a?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}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;${a?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}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(),t}function Ge(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 l=parseFloat(o),c=t[i++]??l;return String(+(l+(c-l)*r).toFixed(4))})}function rt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...Qe[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:c=1,fade:a=false,easing:p="linear",trigger:I={},stagger:k=0,direction:E="forward",once:Z=false,debug:ce=false,axis:V="y",scrollContainer:B,autoReverse:S=false,delay:R=0,strokeColor:C,strokeWidth:$,fillOpacity:L,waypoints:h,velocityScale:A=false,threshold:M=0,rootMargin:w="0px",repeat:b=0,repeatDelay:D=0,morphTo:P,clip:z,autoplay:G=false,duration:K=1e3,native:ae=true,onProgress:d,onStart:N,onComplete:y}=i,f=z===true?"left":typeof z=="string"?z:false,H=typeof p=="function"?p:te[p]??te.linear,ge=re(I.start??"top bottom"),m=re(I.end??"bottom top"),g=typeof B=="string"?document.querySelector(B):B??null,se=Array.isArray(C)?C[0]:null,_=Array.isArray(C)?C[1]:typeof C=="string"?C:null,Q=Array.isArray($)?$[0]:null,ie=Array.isArray($)?$[1]:typeof $=="number"?$:null,q=Array.isArray(L)?L[0]:null,j=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function pe(s){let u=s*100;switch(f){case "right":return `inset(0 0 0 ${100-u}%)`;case "top":return `inset(0 0 ${100-u}% 0)`;case "bottom":return `inset(${100-u}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-u}% 0 0)`}}let ne=f?[]:Array.from(e.querySelectorAll(l)),U=[],he=[],Ee=0,Se=0,le=false,ye=false,oe=0,ke=false,be=-1,Re=-1,ue=false,Pe=0,ve=0,xe,We=null,Te=new Set,Ne=-1,Ye=performance.now();function Ie(){return g?V==="x"?g.scrollLeft:g.scrollTop:V==="x"?window.scrollX:window.scrollY}function je(){return g?V==="x"?g.clientWidth:g.clientHeight:V==="x"?window.innerWidth:window.innerHeight}function Ue(){let s=e.getBoundingClientRect(),u,T,J;if(g){let me=g.getBoundingClientRect();u=V==="x"?s.left-me.left+g.scrollLeft:s.top-me.top+g.scrollTop,T=V==="x"?s.width:s.height,J=Ie();}else u=V==="x"?s.left:s.top,T=V==="x"?s.width:s.height,J=Ie();let de=fe({top:u,height:T},J,je(),ge,m);Ee=de.tStart,Se=de.tEnd,ce&&process.env.NODE_ENV!=="production"&&(We?.remove(),We=Mt(Ee,Se,V));}function yt(s,u){if(e.style.setProperty("--scroll-draw-progress",String(s)),f){let T=u==="reverse"?1-s:s;e.style.clipPath=pe(T);return}ne.forEach((T,J)=>{T.style.strokeDashoffset=u==="reverse"?`${U[J]*s}`:`${U[J]*(1-s)}`,a&&(T.style.opacity=u==="reverse"?`${1-s}`:`${s}`),se&&_?T.style.stroke=Le(se,_,s):_&&(T.style.stroke=_),Q!==null&&ie!==null?T.style.strokeWidth=`${Q+(ie-Q)*s}`:ie!==null&&(T.style.strokeWidth=`${ie}`),q!==null&&j!==null?T.style.fillOpacity=`${q+(j-q)*s}`:j!==null&&(T.style.fillOpacity=`${j}`),P&&T.tagName.toLowerCase()==="path"&&he[J]&&T.setAttribute("d",Ge(he[J],P,s));});}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),f){e.style.clipPath=pe(0);return}ne.forEach((s,u)=>{s.style.strokeDasharray=`${U[u]}`,s.style.strokeDashoffset=E==="reverse"?"0":`${U[u]}`,a?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",se&&(s.style.stroke=se),Q!==null&&(s.style.strokeWidth=`${Q}`),q!==null&&(s.style.fillOpacity=`${q}`),P&&s.tagName.toLowerCase()==="path"&&he[u]&&s.setAttribute("d",he[u]);});}if(ne.forEach(s=>{At(s);let u=Ve(s);U.push(u),s.tagName.toLowerCase()==="path"?he.push(s.getAttribute("d")??""):he.push(""),o?(s.style.strokeDasharray=`${u}`,s.style.strokeDashoffset=E==="reverse"?`${u}`:"0",a&&(s.style.opacity="1"),_&&(s.style.stroke=_),ie!==null&&(s.style.strokeWidth=`${ie}`),j!==null&&(s.style.fillOpacity=`${j}`),P&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",P)):(s.style.strokeDasharray=`${u}`,s.style.strokeDashoffset=E==="reverse"?"0":`${u}`,a?s.style.opacity=E==="reverse"?"1":"0":s.style.opacity="",se&&(s.style.stroke=se),Q!==null&&(s.style.strokeWidth=`${Q}`),q!==null&&(s.style.fillOpacity=`${q}`));}),f){if(o)return e.style.clipPath=pe(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=pe(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function ht(){return !(ae===false||!Tt()||!ne.length||typeof p!="string"||!(p in tt)||f||V!=="y"||g||c!==1||k!==0||Z||S||A!==false||P||h||b||R>0||d||N||y||C!=null||$!=null||L!=null||(I.start??"top bottom").trim()!=="top bottom"||(I.end??"bottom top").trim()!=="bottom top")}function bt(){let s=`svg-scroll-draw-${++xt}`,u=E==="reverse"?"0":"var(--ssd-len)",T=E==="reverse"?"var(--ssd-len)":"0",J=`stroke-dashoffset:${u};`,de=`stroke-dashoffset:${T};`;a&&(J+=`opacity:${E==="reverse"?1:0};`,de+=`opacity:${E==="reverse"?0:1};`);let me=document.createElement("style");me.setAttribute("data-svg-scroll-draw",""),me.textContent=`@keyframes ${s}{from{${J}}to{${de}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${tt[p]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(me);function x(v,F){v.style.setProperty("--ssd-len",String(U[F])),v.style.strokeDasharray=`${U[F]}`,v.style.strokeDashoffset="",v.style.opacity="",v.style.animationPlayState="",v.classList.add(s);}ne.forEach(x);let W=false,ee=-1;function O(){if(ee>=0)return ee;let v=e.getBoundingClientRect(),{tStart:F,tEnd:X}=fe({top:v.top,height:v.height},Ie(),je(),ge,m);return H(Y(Ie(),F,X,c))}return {destroy(){ne.forEach(v=>{v.classList.remove(s),v.style.removeProperty("--ssd-len"),v.style.animationPlayState="";}),me.remove();},replay(){W=false,ee=-1,ne.forEach(x);},pause(){W=true,ne.forEach(v=>{v.style.animationPlayState="paused";});},resume(){W&&(W=false,ne.forEach(v=>{v.style.animationPlayState="running";}));},seek(v){let F=Math.min(1,Math.max(0,v));ee=F,W=true,ne.forEach((X,Ce)=>{X.classList.remove(s),X.style.strokeDashoffset=E==="reverse"?`${U[Ce]*F}`:`${U[Ce]*(1-F)}`,a&&(X.style.opacity=E==="reverse"?`${1-F}`:`${F}`);});},getProgress(){return O()}}}if(ht())return bt();function wt(){let s=Math.max(1,K),u=0,T=0;function J(O){let v=true;if(f){let F=Math.min(1,Math.max(0,O/s)),X=H(F);Pe=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=pe(E==="reverse"?1-X:X),d?.(X),F<1&&(v=false);}else ne.forEach((F,X)=>{let Ce=X*k*s,$e=Math.min(1,Math.max(0,(O-Ce)/s)),we=H($e);F.style.strokeDashoffset=E==="reverse"?`${U[X]*we}`:`${U[X]*(1-we)}`,a&&(F.style.opacity=E==="reverse"?`${1-we}`:`${we}`),se&&_?F.style.stroke=Le(se,_,we):_&&(F.style.stroke=_),Q!==null&&ie!==null?F.style.strokeWidth=`${Q+(ie-Q)*we}`:ie!==null&&(F.style.strokeWidth=`${ie}`),q!==null&&j!==null?F.style.fillOpacity=`${q+(j-q)*we}`:j!==null&&(F.style.fillOpacity=`${j}`),P&&F.tagName.toLowerCase()==="path"&&he[X]&&F.setAttribute("d",Ge(he[X],P,we)),X===0&&(d?.(we),e.style.setProperty("--scroll-draw-progress",String(we))),$e<1&&(v=false);});if(h){let F=Math.min(1,Math.max(0,O/s)),X=H(F);for(let Ce in h){let $e=parseFloat(Ce);X>=$e&&!Te.has($e)&&(Te.add($e),h[Ce]?.());}}return v}function de(O){if(ue)return;let v=O-u;ye||(ye=true,N?.());let F=J(v);if(F&&!le){le=true,J(s*(1+Math.max(0,ne.length-1)*k)),y?.(),ve<(b==="infinite"?1/0:b??0)&&(ve++,xe=setTimeout(()=>{u=performance.now(),ye=false,le=false,Te.clear(),De(),oe=requestAnimationFrame(de);},D));return}F||(oe=requestAnimationFrame(de));}function me(){cancelAnimationFrame(oe),clearTimeout(xe),u=performance.now(),T=0,ue=false,ye=false,le=false,ve=0,Te.clear(),De(),oe=requestAnimationFrame(de);}let x=new IntersectionObserver(O=>{O.forEach(v=>{v.isIntersecting&&!(Z&&le)?me():!v.isIntersecting&&!Z&&!le&&(cancelAnimationFrame(oe),clearTimeout(xe),u=null);});},{root:g??null,threshold:M,rootMargin:w}),W;function ee(){clearTimeout(W),W=setTimeout(()=>{ne.forEach((O,v)=>{U[v]=Ve(O),O.style.strokeDasharray=`${U[v]}`;});},150);}return window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee),R>0?setTimeout(()=>x.observe(e),R):x.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(xe),x.disconnect(),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),clearTimeout(W);},replay(){ve=0,me();},pause(){ue||(ue=true,T=performance.now()-u,cancelAnimationFrame(oe));},resume(){ue&&(ue=false,u=performance.now()-T,oe=requestAnimationFrame(de));},seek(O){let v=Math.min(1,Math.max(0,O));Pe=v,ue=true,T=v*s,u=performance.now()-T,cancelAnimationFrame(oe),J(T);},getProgress(){return Pe}}}if(G)return wt();Ue();function He(){if(!ke||ue)return;let s=performance.now(),u=Ie(),T=c;if(A!==false){let x=s-Ye,W=x>0?Math.abs(u-(Ne<0?u:Ne))/x:0;T=c*Math.max(.2,1+W*(typeof A=="number"?A:1)*.04);}Ne=u,Ye=s;let J=S?Re===-1||u>=Re?"forward":"reverse":E;Re=u;let de=Se-Ee,me=true;if(f){let x=H(Y(u,Ee,Se,T));Z&&!S&&(be=Math.max(be,x),x=be),Pe=x,e.style.setProperty("--scroll-draw-progress",String(x));let W=J==="reverse"?1-x:x;e.style.clipPath=pe(W),d?.(x),!ye&&Y(u,Ee,Se,T)>0&&(ye=true,N?.()),x>=1&&!le?(le=true,y?.(),ve<(b==="infinite"?1/0:b??0)&&(ve++,xe=setTimeout(()=>{be=-1,ye=false,le=false,e.style.clipPath=pe(0);},D))):x<1&&!Z&&(le=false),oe=requestAnimationFrame(He);return}if(ne.forEach((x,W)=>{let ee=W*k*de,O=H(Y(u,Ee+ee,Se+ee,T));Z&&!S&&(be=Math.max(be,O),O=be),Pe=O,x.style.strokeDashoffset=J==="reverse"?`${U[W]*O}`:`${U[W]*(1-O)}`,a&&(x.style.opacity=J==="reverse"?`${1-O}`:`${O}`),se&&_?x.style.stroke=Le(se,_,O):_&&(x.style.stroke=_),Q!==null&&ie!==null?x.style.strokeWidth=`${Q+(ie-Q)*O}`:ie!==null&&(x.style.strokeWidth=`${ie}`),q!==null&&j!==null?x.style.fillOpacity=`${q+(j-q)*O}`:j!==null&&(x.style.fillOpacity=`${j}`),P&&x.tagName.toLowerCase()==="path"&&he[W]&&x.setAttribute("d",Ge(he[W],P,O)),W===0&&(d?.(O),e.style.setProperty("--scroll-draw-progress",String(O))),O<1&&(me=false);}),h){let x=H(Y(u,Ee,Se,T));for(let W in h){let ee=parseFloat(W);x>=ee&&!Te.has(ee)&&(Te.add(ee),h[W]?.());}}!ye&&Y(u,Ee,Se,T)>0&&(ye=true,N?.()),me&&!le?(le=true,y?.(),ve<(b==="infinite"?1/0:b??0)&&(ve++,xe=setTimeout(()=>{be=-1,ye=false,le=false,Te.clear(),De();},D))):!me&&!Z&&(le=false),oe=requestAnimationFrame(He);}let _e=new IntersectionObserver(s=>{s.forEach(u=>{ke=u.isIntersecting,ke&&!ue?oe=requestAnimationFrame(He):cancelAnimationFrame(oe);});},{root:g??null,threshold:M,rootMargin:w}),Be;function ze(){clearTimeout(Be),Be=setTimeout(()=>{ne.forEach((s,u)=>{U[u]=Ve(s),s.style.strokeDasharray=`${U[u]}`;}),Ue();},150);}return window.addEventListener("resize",ze),window.addEventListener("orientationchange",ze),R>0?setTimeout(()=>_e.observe(e),R):_e.observe(e),{destroy(){cancelAnimationFrame(oe),clearTimeout(xe),_e.disconnect(),window.removeEventListener("resize",ze),window.removeEventListener("orientationchange",ze),clearTimeout(Be),We?.remove();},replay(){be=-1,Re=-1,Ne=-1,ye=false,le=false,ve=0,ue=false,Te.clear(),clearTimeout(xe),De();},pause(){ue=true,cancelAnimationFrame(oe);},resume(){ue&&(ue=false,ke&&(oe=requestAnimationFrame(He)));},seek(s){let u=Math.min(1,Math.max(0,s));Pe=u,be=u,ue=true,cancelAnimationFrame(oe),yt(u,E);},getProgress(){return Pe}}}var nt=new Map;function Ae(e,n){nt.set(e,n);}function Me(e){nt.delete(e);}function Pt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ot(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],l=t[2].trim();if(l)for(let c of l.split(/[\s,]+/)){let a=c.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(a?parseFloat(a[1]):0),o.push(a?a[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function Ct(e,n,r){let t=ot(e),i=ot(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,l)=>{let c=i[l];return o.fn!==c.fn||o.nums.length!==c.nums.length?r<1?`${o.fn}(${o.nums.map((a,p)=>`${a}${o.units[p]}`).join(", ")})`:`${c.fn}(${c.nums.map((a,p)=>`${a}${c.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((a,p)=>`${a+(c.nums[p]-a)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function st(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(Pt(t))return Le(t,i,r);if(t.includes("("))return Ct(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),l=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&l){let c=parseFloat(o[1]),a=parseFloat(l[1]);return `${c+(a-c)*r}${o[2]||l[2]}`}return r<1?t:i}function $t(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var it={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Lt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),It=0;function Ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function at(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:l=1,once:c=false,axis:a="y",scrollContainer:p,native:I=true,onProgress:k,onComplete:E}=n,Z=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ce=typeof o=="function"?o:te[o]??te["ease-out"],V=re(i.start??"top bottom"),B=re(i.end??"bottom top"),S=typeof p=="string"?document.querySelector(p):p??null,R=Object.entries(t).map(([m,g])=>({prop:$t(m),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function C(){let m=window.getComputedStyle(e);for(let g of R)g.from===""&&(g.from=m.getPropertyValue(g.prop).trim()||"0");}function $(){for(let m of R)e.style.setProperty(m.prop,String(m.to));}if(Z)return $(),E?.(),r;C();function L(){if(!I||!Ot()||typeof o!="string"||!(o in it)||a!=="y"||S||c||l!==1||k||E||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let m of R)if(!Lt.has(m.prop))return false;return true}function h(){let m=`ssd-a-${++It}`,g=R.map(q=>`${q.prop}:${q.from}`).join(";"),se=R.map(q=>`${q.prop}:${q.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${m}{from{${g}}to{${se}}}.${m}{animation-name:${m};animation-duration:auto;animation-timing-function:${it[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(m);let Q=()=>a==="x"?window.scrollX:window.scrollY,ie=()=>a==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(m),_.remove();},replay(){e.classList.remove(m),e.offsetWidth,e.classList.add(m);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(q){let j=Math.min(1,Math.max(0,q));e.classList.remove(m);for(let pe of R)e.style.setProperty(pe.prop,st(pe.from,pe.to,j));},getProgress(){let q=e.getBoundingClientRect(),j=Q(),pe=ie(),{tStart:ne,tEnd:U}=fe({top:q.top,height:q.height},j,pe,V,B);return ce(Y(j,ne,U,l))}}}if(L())return h();let A=0,M=0,w=0,b=false,D=false,P=-1,z=0,G=false,K=()=>S?a==="x"?S.scrollLeft:S.scrollTop:a==="x"?window.scrollX:window.scrollY,ae=()=>S?a==="x"?S.clientWidth:S.clientHeight:a==="x"?window.innerWidth:window.innerHeight;function d(){let m=e.getBoundingClientRect(),g,se;if(S){let Q=S.getBoundingClientRect();g=a==="x"?m.left-Q.left+S.scrollLeft:m.top-Q.top+S.scrollTop,se=a==="x"?m.width:m.height;}else g=a==="x"?m.left:m.top,se=a==="x"?m.width:m.height;let _=fe({top:g,height:se},K(),ae(),V,B);A=_.tStart,M=_.tEnd;}function N(m){e.style.setProperty("--scroll-draw-progress",String(m));for(let g of R)e.style.setProperty(g.prop,st(g.from,g.to,m));k?.(m);}function y(){if(!b||D)return;let m=ce(Y(K(),A,M,l));c&&(P=Math.max(P,m),m=P),z=m,N(m),m>=1&&!G?(G=true,E?.()):m<1&&!c&&(G=false),w=requestAnimationFrame(y);}d();{let m=ce(Y(K(),A,M,l));c&&m>0&&(P=m),z=m,N(m);}let f=new IntersectionObserver(m=>{m.forEach(g=>{b=g.isIntersecting,b&&!D?w=requestAnimationFrame(y):cancelAnimationFrame(w);});},{root:S??null}),H;function ge(){clearTimeout(H),H=setTimeout(d,150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),f.observe(e),Ae(e,{type:"animate",getProgress:()=>z,getTrigger:()=>({tStart:A,tEnd:M})}),{destroy(){cancelAnimationFrame(w),f.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(H),Me(e);},replay(){P=-1,G=false,z=0,D=false,N(0);},pause(){D=true,cancelAnimationFrame(w);},resume(){D&&(D=false,b&&(w=requestAnimationFrame(y)));},seek(m){let g=Math.min(1,Math.max(0,m));z=g,P=g,D=true,cancelAnimationFrame(w),N(g);},getProgress(){return z}}}var Xe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lt(e,n){if(typeof window>"u")return Xe;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Xe;let t=r,{from:i=0,to:o,format:l,easing:c="ease-out",trigger:a={},once:p=true,decimals:I,onComplete:k}=n,E=I!==void 0?d=>d.toFixed(I):l??(d=>String(Math.round(d))),Z=typeof c=="function"?c:te[c]??te["ease-out"],ce=re(a.start??"top 80%"),V=re(a.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=E(o),k?.(),Xe;t.textContent=E(i);let S=0,R=0,C=0,$=false,L=false,h=-1,A=0,M=false,w=()=>window.scrollY,b=()=>window.innerHeight;function D(){let d=t.getBoundingClientRect(),N=fe({top:d.top,height:d.height},w(),b(),ce,V);S=N.tStart,R=N.tEnd;}function P(d){t.textContent=E(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!$||L)return;let d=Z(Y(w(),S,R,1));p&&(h=Math.max(h,d),d=h),A=d,P(d),d>=1&&!M?(M=true,k?.()):d<1&&!p&&(M=false),C=requestAnimationFrame(z);}D();{let d=Z(Y(w(),S,R,1));p&&d>0&&(h=d),A=d,P(d);}let G=new IntersectionObserver(d=>{d.forEach(N=>{$=N.isIntersecting,$&&!L?C=requestAnimationFrame(z):cancelAnimationFrame(C);});}),K;function ae(){clearTimeout(K),K=setTimeout(D,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),G.observe(t),Ae(t,{type:"counter",getProgress:()=>A,getTrigger:()=>({tStart:S,tEnd:R})}),{destroy(){cancelAnimationFrame(C),G.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(K),Me(t);},replay(){h=-1,M=false,A=0,L=false,P(0);},pause(){L=true,cancelAnimationFrame(C);},resume(){L&&(L=false,$&&(C=requestAnimationFrame(z)));},seek(d){let N=Math.min(1,Math.max(0,d));A=N,h=N,L=true,cancelAnimationFrame(C),P(N);},getProgress(){return A}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n={}){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),ct;let t=r,{trigger:i={},easing:o="linear",once:l=false,axis:c="y",preload:a="auto",onReady:p,onComplete:I,onProgress:k}=n,E=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Z=typeof o=="function"?o:te[o]??te.linear,ce=re(i.start??"top top"),V=re(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=a);let B=n.from??0,S=n.to,R=0,C=0,$=0,L=false,h=false,A=-1,M=0,w=false,b=false,D=()=>c==="x"?window.scrollX:window.scrollY,P=()=>c==="x"?window.innerWidth:window.innerHeight;function z(){let f=t.getBoundingClientRect(),H=c==="x"?f.left:f.top,ge=c==="x"?f.width:f.height,m=fe({top:H,height:ge},D(),P(),ce,V);R=m.tStart,C=m.tEnd;}function G(f){if(!b)return;let H=S??t.duration??0;t.currentTime=B+(H-B)*f,t.style.setProperty("--scroll-draw-progress",String(f)),k?.(f);}function K(){if(!L||h||!b)return;let f=Z(Y(D(),R,C,1));l&&(A=Math.max(A,f),f=A),M=f,G(f),f>=1&&!w?(w=true,I?.()):f<1&&!l&&(w=false),$=requestAnimationFrame(K);}function ae(){if(b=true,S===void 0&&(S=t.duration),E){G(1),p?.();return}z(),p?.(),L&&!h&&($=requestAnimationFrame(K));}t.readyState>=1?ae():t.addEventListener("loadedmetadata",ae,{once:true}),b||z();let d=new IntersectionObserver(f=>{f.forEach(H=>{L=H.isIntersecting,L&&!h&&b?$=requestAnimationFrame(K):cancelAnimationFrame($);});}),N;function y(){clearTimeout(N),N=setTimeout(z,150);}return window.addEventListener("resize",y),window.addEventListener("orientationchange",y),d.observe(t),Ae(t,{type:"video",getProgress:()=>M,getTrigger:()=>({tStart:R,tEnd:C})}),{destroy(){cancelAnimationFrame($),d.disconnect(),t.removeEventListener("loadedmetadata",ae),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),clearTimeout(N),Me(t);},replay(){A=-1,w=false,M=0,h=false,G(0);},pause(){h=true,cancelAnimationFrame($);},resume(){h&&(h=false,L&&b&&($=requestAnimationFrame(K)));},seek(f){let H=Math.min(1,Math.max(0,f));M=H,A=H,h=true,cancelAnimationFrame($),G(H);},getProgress(){return M}}}function pt(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 Ft(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 mt(e){let n=pt(e),r=new Map;for(let o of n){let l=o.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(o);}let t=[],i=Array.from(r.keys()).sort((o,l)=>o-l);for(let o of i){let l=r.get(o),c=document.createElement("span");c.setAttribute("aria-hidden","true"),c.style.display="inline-block";for(let a of l)c.appendChild(a);t.push(c);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function kt(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,l=o+(1-i);return l<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(l-o)))}function Rt(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 dt(e,n={}){if(typeof window>"u")return ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),ft;let t=r,{split:i="words",stagger:o=.04,easing:l="ease-out",from:c={opacity:0,y:24},trigger:a={},once:p=true,onComplete:I}=n,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,E=typeof l=="function"?l:te[l]??te["ease-out"],Z=re(a.start??"top 85%"),ce=re(a.end??"top 40%"),V=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let B;i==="chars"?B=Ft(t):i==="lines"?B=mt(t):B=pt(t);let S=B.length;function R(y,f){c?.opacity!==void 0&&(y.style.opacity=String(c.opacity+(1-c.opacity)*f));let H=Rt(f,c);H&&(y.style.transform=H);}function C(y){t.style.setProperty("--scroll-draw-progress",String(y)),B.forEach((f,H)=>{let ge=E(kt(y,H,S,o));R(f,ge);});}if(k)return C(1),I?.(),{destroy(){t.innerHTML=V,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};C(0);let $=0,L=0,h=0,A=false,M=false,w=-1,b=0,D=false,P=()=>window.scrollY,z=()=>window.innerHeight;function G(){let y=t.getBoundingClientRect(),f=fe({top:y.top,height:y.height},P(),z(),Z,ce);$=f.tStart,L=f.tEnd;}function K(){if(!A||M)return;let y=Y(P(),$,L,1);p&&(w=Math.max(w,y),y=w),b=y,C(y),y>=1&&!D?(D=true,I?.()):y<1&&!p&&(D=false),h=requestAnimationFrame(K);}G();let ae=new IntersectionObserver(y=>{y.forEach(f=>{A=f.isIntersecting,A&&!M?h=requestAnimationFrame(K):cancelAnimationFrame(h);});}),d;function N(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=b;t.innerHTML=V,t.setAttribute("aria-label",t.textContent??""),B=mt(t),C(y);}G();},150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),ae.observe(t),Ae(t,{type:"text",getProgress:()=>b,getTrigger:()=>({tStart:$,tEnd:L})}),{destroy(){cancelAnimationFrame(h),ae.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(d),t.innerHTML=V,t.removeAttribute("aria-label"),Me(t);},replay(){w=-1,D=false,b=0,M=false,C(0);},pause(){M=true,cancelAnimationFrame(h);},resume(){M&&(M=false,A&&(h=requestAnimationFrame(K)));},seek(y){let f=Math.min(1,Math.max(0,y));b=f,w=f,M=true,cancelAnimationFrame(h),C(f);},getProgress(){return b}}}function Ht(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 l=typeof e=="string"?document.querySelector(e):e.current;if(!l)return;let c=l,{axis:a="y",scrollContainer:p,trigger:I={}}=i.current,k=typeof p=="string"?document.querySelector(p):p??null,E=re(I.start??"top bottom"),Z=re(I.end??"bottom top"),ce=0,V=0,B=false,S=0;function R(){return k?a==="x"?k.scrollLeft:k.scrollTop:a==="x"?window.scrollX:window.scrollY}function C(){return k?a==="x"?k.clientWidth:k.clientHeight:a==="x"?window.innerWidth:window.innerHeight}function $(){let w=c.getBoundingClientRect(),b=R(),D=a==="x"?w.left:w.top,P=a==="x"?w.width:w.height,z=fe({top:D,height:P},b,C(),E,Z);ce=z.tStart,V=z.tEnd;}function L(){if(!B)return;let{speed:w=1,easing:b="linear",once:D=false}=i.current,P=typeof b=="function"?b:te[b]??te.linear,z=Y(R(),ce,V,w),G=P(z);D&&(o.current=Math.max(o.current,G),G=o.current),t(G),S=requestAnimationFrame(L);}let h=new IntersectionObserver(w=>{w.forEach(b=>{B=b.isIntersecting,B?S=requestAnimationFrame(L):cancelAnimationFrame(S);});},{root:k??null,threshold:0});$(),h.observe(c);let A;function M(){clearTimeout(A),A=setTimeout($,150);}return window.addEventListener("resize",M),window.addEventListener("orientationchange",M),()=>{cancelAnimationFrame(S),clearTimeout(A),h.disconnect(),window.removeEventListener("resize",M),window.removeEventListener("orientationchange",M);}},[]),r}function pr({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=rt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function dr({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=at(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function gr({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let i=lt(t.current,r);return ()=>i.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function yr({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let l=useRef(null);return useEffect(()=>{if(!l.current)return;let c=ut(l.current,o);return ()=>c.destroy()},[]),jsx("video",{ref:l,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function hr({children:e,as:n="p",className:r,style:t,...i}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let l=dt(o.current,i);return ()=>l.destroy()},[]),zt.createElement(n,{ref:o,className:r,style:t},e)}export{dr as ScrollAnimate,gr as ScrollCounter,pr as ScrollDraw,hr as ScrollText,yr as ScrollVideo,Ht as useScrollDrawProgress};
1
+ import _t,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function At({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,l=[];for(let y=0;y<r;y++){let L=Math.pow(i,y);l.push(L),o+=L;}let u=[0],c=0;for(let y=0;y<r;y++)c+=l[y]/o,u.push(c);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let L=0;L<r;L++)if(y<=u[L+1]){let C=(y-u[L])/(u[L+1]-u[L]);if(L===0)return C*(2-C);let S=1-Math.pow(t,L);return S+(1-S)*(2*C-1)*(2*C-1)}return 1}}function Mt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),i=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/t)+1}var re={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:At(),elastic:Mt()};function ne(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function tt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function rt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ge(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Pt(e,n,r){return Math.min(r,Math.max(n,e))}function Z(e,n,r,t){return r===n?0:Pt((e-n)/(r-n)*t,0,1)}function pe(e,n,r,t,i){let o=tt(e.top,e.height,n,t.element)-rt(t.viewport,r),l=tt(e.top,e.height,n,i.element)-rt(i.viewport,r);return {tStart:o,tEnd:l}}function nt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[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 t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Oe(e,n,r){let t=nt(e),i=nt(n);return !t||!i?e:`rgb(${Math.round(t[0]+(i[0]-t[0])*r)},${Math.round(t[1]+(i[1]-t[1])*r)},${Math.round(t[2]+(i[2]-t[2])*r)})`}var ot={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}};function st(e,n){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,n);}var it={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Lt=0;function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function $t(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?st("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&st("Element has a fill \u2014 it may obscure the stroke animation.",e);}function kt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.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 i(){let o=r==="x"?window.scrollX:window.scrollY,l=e-o,u=n-o,c=r==="x";t.innerHTML=`
2
+ <div style="position:absolute;${c?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}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;${c?`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(),t}function Je(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 l=parseFloat(o),u=t[i++]??l;return String(+(l+(u-l)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...ot[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:c=false,easing:y="linear",trigger:L={},stagger:C=0,direction:S="forward",once:U=false,debug:de=false,axis:F="y",scrollContainer:_,autoReverse:H=false,delay:G=0,strokeColor:x,strokeWidth:M,fillOpacity:P,waypoints:p,velocityScale:v=false,threshold:N=0,rootMargin:I="0px",repeat:E=0,repeatDelay:J=0,morphTo:T,clip:R,autoplay:D=false,duration:K=1e3,native:X=true,onProgress:d,onStart:$,onComplete:b,onEnter:h,onLeave:Y,onEnterBack:Se,onLeaveBack:xe}=i,be=R===true?"left":typeof R=="string"?R:false,we=typeof y=="function"?y:re[y]??re.linear,Ce=ne(L.start??"top bottom"),He=ne(L.end??"bottom top"),oe=typeof _=="string"?document.querySelector(_):_??null,ge=Array.isArray(x)?x[0]:null,ee=Array.isArray(x)?x[1]:typeof x=="string"?x:null,te=Array.isArray(M)?M[0]:null,a=Array.isArray(M)?M[1]:typeof M=="number"?M:null,g=Array.isArray(P)?P[0]:null,z=Array.isArray(P)?P[1]:typeof P=="number"?P:null;function se(s){let m=s*100;switch(be){case "right":return `inset(0 0 0 ${100-m}%)`;case "top":return `inset(0 0 ${100-m}% 0)`;case "bottom":return `inset(${100-m}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-m}% 0 0)`}}let O=be?[]:Array.from(e.querySelectorAll(l)),B=[],V=[],le=0,ce=0,ie=false,ye=false,ae=0,ze=false,ve=-1,Ve=-1,ue=false,$e=0,Te=0,Ae,Ye=null,Me=new Set,qe=-1,Ke=performance.now(),Ne=NaN;function Re(){return oe?F==="x"?oe.scrollLeft:oe.scrollTop:F==="x"?window.scrollX:window.scrollY}function Qe(){return oe?F==="x"?oe.clientWidth:oe.clientHeight:F==="x"?window.innerWidth:window.innerHeight}function et(){let s=e.getBoundingClientRect(),m,A,Q;if(oe){let fe=oe.getBoundingClientRect();m=F==="x"?s.left-fe.left+oe.scrollLeft:s.top-fe.top+oe.scrollTop,A=F==="x"?s.width:s.height,Q=Re();}else m=F==="x"?s.left:s.top,A=F==="x"?s.width:s.height,Q=Re();let me=pe({top:m,height:A},Q,Qe(),Ce,He);le=me.tStart,ce=me.tEnd,de&&process.env.NODE_ENV!=="production"&&(Ye?.remove(),Ye=kt(le,ce,F));}function Et(s,m){if(e.style.setProperty("--scroll-draw-progress",String(s)),be){let A=m==="reverse"?1-s:s;e.style.clipPath=se(A);return}O.forEach((A,Q)=>{A.style.strokeDashoffset=m==="reverse"?`${B[Q]*s}`:`${B[Q]*(1-s)}`,c&&(A.style.opacity=m==="reverse"?`${1-s}`:`${s}`),ge&&ee?A.style.stroke=Oe(ge,ee,s):ee&&(A.style.stroke=ee),te!==null&&a!==null?A.style.strokeWidth=`${te+(a-te)*s}`:a!==null&&(A.style.strokeWidth=`${a}`),g!==null&&z!==null?A.style.fillOpacity=`${g+(z-g)*s}`:z!==null&&(A.style.fillOpacity=`${z}`),T&&A.tagName.toLowerCase()==="path"&&V[Q]&&A.setAttribute("d",Je(V[Q],T,s));});}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),be){e.style.clipPath=se(0);return}O.forEach((s,m)=>{s.style.strokeDasharray=`${B[m]}`,s.style.strokeDashoffset=S==="reverse"?"0":`${B[m]}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",ge&&(s.style.stroke=ge),te!==null&&(s.style.strokeWidth=`${te}`),g!==null&&(s.style.fillOpacity=`${g}`),T&&s.tagName.toLowerCase()==="path"&&V[m]&&s.setAttribute("d",V[m]);});}if(O.forEach(s=>{$t(s);let m=Ge(s);B.push(m),s.tagName.toLowerCase()==="path"?V.push(s.getAttribute("d")??""):V.push(""),o?(s.style.strokeDasharray=`${m}`,s.style.strokeDashoffset=S==="reverse"?`${m}`:"0",c&&(s.style.opacity="1"),ee&&(s.style.stroke=ee),a!==null&&(s.style.strokeWidth=`${a}`),z!==null&&(s.style.fillOpacity=`${z}`),T&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",T)):(s.style.strokeDasharray=`${m}`,s.style.strokeDashoffset=S==="reverse"?"0":`${m}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",ge&&(s.style.stroke=ge),te!==null&&(s.style.strokeWidth=`${te}`),g!==null&&(s.style.fillOpacity=`${g}`));}),be){if(o)return e.style.clipPath=se(1),b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=se(0);}else if(o)return b?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function St(){return !(X===false||!Ct()||!O.length||typeof y!="string"||!(y in it)||be||F!=="y"||oe||u!==1||C!==0||U||H||v!==false||T||p||E||G>0||d||$||b||h||Y||Se||xe||x!=null||M!=null||P!=null||(L.start??"top bottom").trim()!=="top bottom"||(L.end??"bottom top").trim()!=="bottom top")}function xt(){let s=`svg-scroll-draw-${++Lt}`,m=S==="reverse"?"0":"var(--ssd-len)",A=S==="reverse"?"var(--ssd-len)":"0",Q=`stroke-dashoffset:${m};`,me=`stroke-dashoffset:${A};`;c&&(Q+=`opacity:${S==="reverse"?1:0};`,me+=`opacity:${S==="reverse"?0:1};`);let fe=document.createElement("style");fe.setAttribute("data-svg-scroll-draw",""),fe.textContent=`@keyframes ${s}{from{${Q}}to{${me}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${it[y]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(fe);function he(f,k){f.style.setProperty("--ssd-len",String(B[k])),f.style.strokeDasharray=`${B[k]}`,f.style.strokeDashoffset="",f.style.opacity="",f.style.animationPlayState="",f.classList.add(s);}O.forEach(he);let w=false,q=-1;function W(){if(q>=0)return q;let f=e.getBoundingClientRect(),{tStart:k,tEnd:j}=pe({top:f.top,height:f.height},Re(),Qe(),Ce,He);return we(Z(Re(),k,j,u))}return {destroy(){O.forEach(f=>{f.classList.remove(s),f.style.removeProperty("--ssd-len"),f.style.animationPlayState="";}),fe.remove();},replay(){w=false,q=-1,O.forEach(he);},pause(){w=true,O.forEach(f=>{f.style.animationPlayState="paused";});},resume(){w&&(w=false,O.forEach(f=>{f.style.animationPlayState="running";}));},seek(f){let k=Math.min(1,Math.max(0,f));q=k,w=true,O.forEach((j,ke)=>{j.classList.remove(s),j.style.strokeDashoffset=S==="reverse"?`${B[ke]*k}`:`${B[ke]*(1-k)}`,c&&(j.style.opacity=S==="reverse"?`${1-k}`:`${k}`);});},getProgress(){return W()}}}if(St())return xt();function Tt(){let s=Math.max(1,K),m=0,A=0;function Q(W){let f=true;if(be){let k=Math.min(1,Math.max(0,W/s)),j=we(k);$e=j,e.style.setProperty("--scroll-draw-progress",String(j)),e.style.clipPath=se(S==="reverse"?1-j:j),d?.(j),k<1&&(f=false);}else O.forEach((k,j)=>{let ke=j*C*s,Ie=Math.min(1,Math.max(0,(W-ke)/s)),Ee=we(Ie);k.style.strokeDashoffset=S==="reverse"?`${B[j]*Ee}`:`${B[j]*(1-Ee)}`,c&&(k.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),ge&&ee?k.style.stroke=Oe(ge,ee,Ee):ee&&(k.style.stroke=ee),te!==null&&a!==null?k.style.strokeWidth=`${te+(a-te)*Ee}`:a!==null&&(k.style.strokeWidth=`${a}`),g!==null&&z!==null?k.style.fillOpacity=`${g+(z-g)*Ee}`:z!==null&&(k.style.fillOpacity=`${z}`),T&&k.tagName.toLowerCase()==="path"&&V[j]&&k.setAttribute("d",Je(V[j],T,Ee)),j===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Ie<1&&(f=false);});if(p){let k=Math.min(1,Math.max(0,W/s)),j=we(k);for(let ke in p){let Ie=parseFloat(ke);j>=Ie&&!Me.has(Ie)&&(Me.add(Ie),p[ke]?.());}}return f}function me(W){if(ue)return;let f=W-m;ye||(ye=true,$?.());let k=Q(f);if(k&&!ie){ie=true,Q(s*(1+Math.max(0,O.length-1)*C)),b?.(),Te<(E==="infinite"?1/0:E??0)&&(Te++,Ae=setTimeout(()=>{m=performance.now(),ye=false,ie=false,Me.clear(),We(),ae=requestAnimationFrame(me);},J));return}k||(ae=requestAnimationFrame(me));}function fe(){cancelAnimationFrame(ae),clearTimeout(Ae),m=performance.now(),A=0,ue=false,ye=false,ie=false,Te=0,Me.clear(),We(),ae=requestAnimationFrame(me);}let he=new IntersectionObserver(W=>{W.forEach(f=>{f.isIntersecting&&!(U&&ie)?fe():!f.isIntersecting&&!U&&!ie&&(cancelAnimationFrame(ae),clearTimeout(Ae),m=null);});},{root:oe??null,threshold:N,rootMargin:I}),w;function q(){clearTimeout(w),w=setTimeout(()=>{O.forEach((W,f)=>{B[f]=Ge(W),W.style.strokeDasharray=`${B[f]}`;});},150);}return window.addEventListener("resize",q),window.addEventListener("orientationchange",q),G>0?setTimeout(()=>he.observe(e),G):he.observe(e),{destroy(){cancelAnimationFrame(ae),clearTimeout(Ae),he.disconnect(),window.removeEventListener("resize",q),window.removeEventListener("orientationchange",q),clearTimeout(w);},replay(){Te=0,fe();},pause(){ue||(ue=true,A=performance.now()-m,cancelAnimationFrame(ae));},resume(){ue&&(ue=false,m=performance.now()-A,ae=requestAnimationFrame(me));},seek(W){let f=Math.min(1,Math.max(0,W));$e=f,ue=true,A=f*s,m=performance.now()-A,cancelAnimationFrame(ae),Q(A);},getProgress(){return $e}}}if(D)return Tt();et();function Be(){if(!ze||ue)return;let s=performance.now(),m=Re(),A=u;if(v!==false){let w=s-Ke,q=w>0?Math.abs(m-(qe<0?m:qe))/w:0;A=u*Math.max(.2,1+q*(typeof v=="number"?v:1)*.04);}qe=m,Ke=s;let Q=H?Ve===-1||m>=Ve?"forward":"reverse":S;Ve=m;let me=ce-le,fe=true,he=me===0?0:(m-le)/me;if(isNaN(Ne)||(Ne<=0&&he>0?h?.():Ne>0&&he<=0&&xe?.(),Ne<1&&he>=1?Y?.():Ne>=1&&he<1&&Se?.()),Ne=he,be){let w=we(Z(m,le,ce,A));U&&!H&&(ve=Math.max(ve,w),w=ve),$e=w,e.style.setProperty("--scroll-draw-progress",String(w));let q=Q==="reverse"?1-w:w;e.style.clipPath=se(q),d?.(w),!ye&&Z(m,le,ce,A)>0&&(ye=true,$?.()),w>=1&&!ie?(ie=true,b?.(),Te<(E==="infinite"?1/0:E??0)&&(Te++,Ae=setTimeout(()=>{ve=-1,ye=false,ie=false,e.style.clipPath=se(0);},J))):w<1&&!U&&(ie=false),ae=requestAnimationFrame(Be);return}if(O.forEach((w,q)=>{let W=q*C*me,f=we(Z(m,le+W,ce+W,A));U&&!H&&(ve=Math.max(ve,f),f=ve),$e=f,w.style.strokeDashoffset=Q==="reverse"?`${B[q]*f}`:`${B[q]*(1-f)}`,c&&(w.style.opacity=Q==="reverse"?`${1-f}`:`${f}`),ge&&ee?w.style.stroke=Oe(ge,ee,f):ee&&(w.style.stroke=ee),te!==null&&a!==null?w.style.strokeWidth=`${te+(a-te)*f}`:a!==null&&(w.style.strokeWidth=`${a}`),g!==null&&z!==null?w.style.fillOpacity=`${g+(z-g)*f}`:z!==null&&(w.style.fillOpacity=`${z}`),T&&w.tagName.toLowerCase()==="path"&&V[q]&&w.setAttribute("d",Je(V[q],T,f)),q===0&&(d?.(f),e.style.setProperty("--scroll-draw-progress",String(f))),f<1&&(fe=false);}),p){let w=we(Z(m,le,ce,A));for(let q in p){let W=parseFloat(q);w>=W&&!Me.has(W)&&(Me.add(W),p[q]?.());}}!ye&&Z(m,le,ce,A)>0&&(ye=true,$?.()),fe&&!ie?(ie=true,b?.(),Te<(E==="infinite"?1/0:E??0)&&(Te++,Ae=setTimeout(()=>{ve=-1,ye=false,ie=false,Me.clear(),We();},J))):!fe&&!U&&(ie=false),ae=requestAnimationFrame(Be);}let je=new IntersectionObserver(s=>{s.forEach(m=>{ze=m.isIntersecting,ze&&!ue?ae=requestAnimationFrame(Be):cancelAnimationFrame(ae);});},{root:oe??null,threshold:N,rootMargin:I}),Ue;function _e(){clearTimeout(Ue),Ue=setTimeout(()=>{O.forEach((s,m)=>{B[m]=Ge(s),s.style.strokeDasharray=`${B[m]}`;}),et();},150);}return window.addEventListener("resize",_e),window.addEventListener("orientationchange",_e),G>0?setTimeout(()=>je.observe(e),G):je.observe(e),{destroy(){cancelAnimationFrame(ae),clearTimeout(Ae),je.disconnect(),window.removeEventListener("resize",_e),window.removeEventListener("orientationchange",_e),clearTimeout(Ue),Ye?.remove();},replay(){ve=-1,Ve=-1,qe=-1,ye=false,ie=false,Te=0,ue=false,Me.clear(),clearTimeout(Ae),We();},pause(){ue=true,cancelAnimationFrame(ae);},resume(){ue&&(ue=false,ze&&(ae=requestAnimationFrame(Be)));},seek(s){let m=Math.min(1,Math.max(0,s));$e=m,ve=m,ue=true,cancelAnimationFrame(ae),Et(m,S);},getProgress(){return $e}}}var lt=new Map;function Pe(e,n){lt.set(e,n);}function Le(e){lt.delete(e);}function Nt(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=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let c=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function It(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,l)=>{let u=i[l];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((c,y)=>`${c}${o.units[y]}`).join(", ")})`:`${u.fn}(${u.nums.map((c,y)=>`${c}${u.units[y]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,y)=>`${c+(u.nums[y]-c)*r}${o.units[y]}`).join(", ")})`}).join(" ")}function ut(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(Nt(t))return Oe(t,i,r);if(t.includes("("))return It(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),l=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&l){let u=parseFloat(o[1]),c=parseFloat(l[1]);return `${u+(c-u)*r}${o[2]||l[2]}`}return r<1?t:i}function Ot(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Rt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ft=0;function Dt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ft(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:l=1,once:u=false,axis:c="y",scrollContainer:y,native:L=true,velocityScale:C=false,onProgress:S,onComplete:U,onEnter:de,onLeave:F,onEnterBack:_,onLeaveBack:H}=n,G=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:re[o]??re["ease-out"],M=ne(i.start??"top bottom"),P=ne(i.end??"bottom top"),p=typeof y=="string"?document.querySelector(y):y??null,v=Object.entries(t).map(([a,g])=>({prop:Ot(a),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function N(){let a=window.getComputedStyle(e);for(let g of v)g.from===""&&(g.from=a.getPropertyValue(g.prop).trim()||"0");}function I(){for(let a of v)e.style.setProperty(a.prop,String(a.to));}if(G)return I(),U?.(),r;N();function E(){if(!L||!Dt()||typeof o!="string"||!(o in mt)||c!=="y"||p||u||l!==1||S||U||de||F||_||H||C!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let a of v)if(!Rt.has(a.prop))return false;return true}function J(){let a=`ssd-a-${++Ft}`,g=v.map(V=>`${V.prop}:${V.from}`).join(";"),z=v.map(V=>`${V.prop}:${V.to}`).join(";"),se=document.createElement("style");se.setAttribute("data-ssd-animate",""),se.textContent=`@keyframes ${a}{from{${g}}to{${z}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${mt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(se),e.classList.add(a);let O=()=>c==="x"?window.scrollX:window.scrollY,B=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),se.remove();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(V){let le=Math.min(1,Math.max(0,V));e.classList.remove(a);for(let ce of v)e.style.setProperty(ce.prop,ut(ce.from,ce.to,le));},getProgress(){let V=e.getBoundingClientRect(),le=O(),ce=B(),{tStart:ie,tEnd:ye}=pe({top:V.top,height:V.height},le,ce,M,P);return x(Z(le,ie,ye,l))}}}if(E())return J();let T=0,R=0,D=0,K=false,X=false,d=-1,$=0,b=false,h=NaN,Y=-1,Se=0,xe=()=>p?c==="x"?p.scrollLeft:p.scrollTop:c==="x"?window.scrollX:window.scrollY,be=()=>p?c==="x"?p.clientWidth:p.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function we(){let a=e.getBoundingClientRect(),g,z;if(p){let O=p.getBoundingClientRect();g=c==="x"?a.left-O.left+p.scrollLeft:a.top-O.top+p.scrollTop,z=c==="x"?a.width:a.height;}else g=c==="x"?a.left:a.top,z=c==="x"?a.width:a.height;let se=pe({top:g,height:z},xe(),be(),M,P);T=se.tStart,R=se.tEnd;}function Ce(a){e.style.setProperty("--scroll-draw-progress",String(a));for(let g of v)e.style.setProperty(g.prop,ut(g.from,g.to,a));S?.(a);}function He(a){if(isNaN(h)){h=a;return}h<=0&&a>0?de?.():h>0&&a<=0&&H?.(),h<1&&a>=1?F?.():h>=1&&a<1&&_?.(),h=a;}function oe(){if(!K||X)return;let a=performance.now(),g=xe(),z=l;if(C!==false){let B=a-Se,V=B>0?Math.abs(g-(Y<0?g:Y))/B:0;z=l*Math.max(.2,1+V*(typeof C=="number"?C:1)*.04);}Y=g,Se=a;let se=R===T?0:(g-T)/(R-T);He(se);let O=x(Z(g,T,R,z));u&&(d=Math.max(d,O),O=d),$=O,Ce(O),O>=1&&!b?(b=true,U?.()):O<1&&!u&&(b=false),D=requestAnimationFrame(oe);}we();{let a=x(Z(xe(),T,R,l));u&&a>0&&(d=a),$=a,Ce(a);}let ge=new IntersectionObserver(a=>{a.forEach(g=>{K=g.isIntersecting,K&&!X?D=requestAnimationFrame(oe):cancelAnimationFrame(D);});},{root:p??null}),ee;function te(){clearTimeout(ee),ee=setTimeout(we,150);}return window.addEventListener("resize",te),window.addEventListener("orientationchange",te),ge.observe(e),Pe(e,{type:"animate",getProgress:()=>$,getTrigger:()=>({tStart:T,tEnd:R})}),{destroy(){cancelAnimationFrame(D),ge.disconnect(),window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),clearTimeout(ee),Le(e);},replay(){d=-1,b=false,$=0,X=false,Ce(0);},pause(){X=true,cancelAnimationFrame(D);},resume(){X&&(X=false,K&&(D=requestAnimationFrame(oe)));},seek(a){let g=Math.min(1,Math.max(0,a));$=g,d=g,X=true,cancelAnimationFrame(D),Ce(g);},getProgress(){return $}}}var Ze={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,n){if(typeof window>"u")return Ze;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),Ze;let t=r,{from:i=0,to:o,format:l,easing:u="ease-out",trigger:c={},once:y=true,decimals:L,onComplete:C}=n,S=L!==void 0?d=>d.toFixed(L):l??(d=>String(Math.round(d))),U=typeof u=="function"?u:re[u]??re["ease-out"],de=ne(c.start??"top 80%"),F=ne(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(o),C?.(),Ze;t.textContent=S(i);let H=0,G=0,x=0,M=false,P=false,p=-1,v=0,N=false,I=()=>window.scrollY,E=()=>window.innerHeight;function J(){let d=t.getBoundingClientRect(),$=pe({top:d.top,height:d.height},I(),E(),de,F);H=$.tStart,G=$.tEnd;}function T(d){t.textContent=S(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function R(){if(!M||P)return;let d=U(Z(I(),H,G,1));y&&(p=Math.max(p,d),d=p),v=d,T(d),d>=1&&!N?(N=true,C?.()):d<1&&!y&&(N=false),x=requestAnimationFrame(R);}J();{let d=U(Z(I(),H,G,1));y&&d>0&&(p=d),v=d,T(d);}let D=new IntersectionObserver(d=>{d.forEach($=>{M=$.isIntersecting,M&&!P?x=requestAnimationFrame(R):cancelAnimationFrame(x);});}),K;function X(){clearTimeout(K),K=setTimeout(J,150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),D.observe(t),Pe(t,{type:"counter",getProgress:()=>v,getTrigger:()=>({tStart:H,tEnd:G})}),{destroy(){cancelAnimationFrame(x),D.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(K),Le(t);},replay(){p=-1,N=false,v=0,P=false,T(0);},pause(){P=true,cancelAnimationFrame(x);},resume(){P&&(P=false,M&&(x=requestAnimationFrame(R)));},seek(d){let $=Math.min(1,Math.max(0,d));v=$,p=$,P=true,cancelAnimationFrame(x),T($);},getProgress(){return v}}}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),dt;let t=r,{trigger:i={},easing:o="linear",once:l=false,axis:u="y",preload:c="auto",onReady:y,onComplete:L,onProgress:C}=n,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,U=typeof o=="function"?o:re[o]??re.linear,de=ne(i.start??"top top"),F=ne(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let _=n.from??0,H=n.to,G=0,x=0,M=0,P=false,p=false,v=-1,N=0,I=false,E=false,J=()=>u==="x"?window.scrollX:window.scrollY,T=()=>u==="x"?window.innerWidth:window.innerHeight;function R(){let h=t.getBoundingClientRect(),Y=u==="x"?h.left:h.top,Se=u==="x"?h.width:h.height,xe=pe({top:Y,height:Se},J(),T(),de,F);G=xe.tStart,x=xe.tEnd;}function D(h){if(!E)return;let Y=H??t.duration??0;t.currentTime=_+(Y-_)*h,t.style.setProperty("--scroll-draw-progress",String(h)),C?.(h);}function K(){if(!P||p||!E)return;let h=U(Z(J(),G,x,1));l&&(v=Math.max(v,h),h=v),N=h,D(h),h>=1&&!I?(I=true,L?.()):h<1&&!l&&(I=false),M=requestAnimationFrame(K);}function X(){if(E=true,H===void 0&&(H=t.duration),S){D(1),y?.();return}R(),y?.(),P&&!p&&(M=requestAnimationFrame(K));}t.readyState>=1?X():t.addEventListener("loadedmetadata",X,{once:true}),E||R();let d=new IntersectionObserver(h=>{h.forEach(Y=>{P=Y.isIntersecting,P&&!p&&E?M=requestAnimationFrame(K):cancelAnimationFrame(M);});}),$;function b(){clearTimeout($),$=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),d.observe(t),Pe(t,{type:"video",getProgress:()=>N,getTrigger:()=>({tStart:G,tEnd:x})}),{destroy(){cancelAnimationFrame(M),d.disconnect(),t.removeEventListener("loadedmetadata",X),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout($),Le(t);},replay(){v=-1,I=false,N=0,p=false,D(0);},pause(){p=true,cancelAnimationFrame(M);},resume(){p&&(p=false,P&&E&&(M=requestAnimationFrame(K)));},seek(h){let Y=Math.min(1,Math.max(0,h));N=Y,v=Y,p=true,cancelAnimationFrame(M),D(Y);},getProgress(){return N}}}function bt(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 Ht(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 yt(e){let n=bt(e),r=new Map;for(let o of n){let l=o.offsetTop;r.has(l)||r.set(l,[]),r.get(l).push(o);}let t=[],i=Array.from(r.keys()).sort((o,l)=>o-l);for(let o of i){let l=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block";for(let c of l)u.appendChild(c);t.push(u);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function zt(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,l=o+(1-i);return l<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(l-o)))}function Vt(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 ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function wt(e,n={}){if(typeof window>"u")return ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),ht;let t=r,{split:i="words",stagger:o=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:c={},once:y=true,onComplete:L}=n,C=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof l=="function"?l:re[l]??re["ease-out"],U=ne(c.start??"top 85%"),de=ne(c.end??"top 40%"),F=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let _;i==="chars"?_=Ht(t):i==="lines"?_=yt(t):_=bt(t);let H=_.length;function G(b,h){u?.opacity!==void 0&&(b.style.opacity=String(u.opacity+(1-u.opacity)*h));let Y=Vt(h,u);Y&&(b.style.transform=Y);}function x(b){t.style.setProperty("--scroll-draw-progress",String(b)),_.forEach((h,Y)=>{let Se=S(zt(b,Y,H,o));G(h,Se);});}if(C)return x(1),L?.(),{destroy(){t.innerHTML=F,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let M=0,P=0,p=0,v=false,N=false,I=-1,E=0,J=false,T=()=>window.scrollY,R=()=>window.innerHeight;function D(){let b=t.getBoundingClientRect(),h=pe({top:b.top,height:b.height},T(),R(),U,de);M=h.tStart,P=h.tEnd;}function K(){if(!v||N)return;let b=Z(T(),M,P,1);y&&(I=Math.max(I,b),b=I),E=b,x(b),b>=1&&!J?(J=true,L?.()):b<1&&!y&&(J=false),p=requestAnimationFrame(K);}D();let X=new IntersectionObserver(b=>{b.forEach(h=>{v=h.isIntersecting,v&&!N?p=requestAnimationFrame(K):cancelAnimationFrame(p);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let b=E;t.innerHTML=F,t.setAttribute("aria-label",t.textContent??""),_=yt(t),x(b);}D();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),X.observe(t),Pe(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:M,tEnd:P})}),{destroy(){cancelAnimationFrame(p),X.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=F,t.removeAttribute("aria-label"),Le(t);},replay(){I=-1,J=false,E=0,N=false,x(0);},pause(){N=true,cancelAnimationFrame(p);},resume(){N&&(N=false,v&&(p=requestAnimationFrame(K)));},seek(b){let h=Math.min(1,Math.max(0,b));E=h,I=h,N=true,cancelAnimationFrame(p),x(h);},getProgress(){return E}}}function Bt(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 l=typeof e=="string"?document.querySelector(e):e.current;if(!l)return;let u=l,{axis:c="y",scrollContainer:y,trigger:L={}}=i.current,C=typeof y=="string"?document.querySelector(y):y??null,S=ne(L.start??"top bottom"),U=ne(L.end??"bottom top"),de=0,F=0,_=false,H=0;function G(){return C?c==="x"?C.scrollLeft:C.scrollTop:c==="x"?window.scrollX:window.scrollY}function x(){return C?c==="x"?C.clientWidth:C.clientHeight:c==="x"?window.innerWidth:window.innerHeight}function M(){let I=u.getBoundingClientRect(),E=G(),J=c==="x"?I.left:I.top,T=c==="x"?I.width:I.height,R=pe({top:J,height:T},E,x(),S,U);de=R.tStart,F=R.tEnd;}function P(){if(!_)return;let{speed:I=1,easing:E="linear",once:J=false}=i.current,T=typeof E=="function"?E:re[E]??re.linear,R=Z(G(),de,F,I),D=T(R);J&&(o.current=Math.max(o.current,D),D=o.current),t(D),H=requestAnimationFrame(P);}let p=new IntersectionObserver(I=>{I.forEach(E=>{_=E.isIntersecting,_?H=requestAnimationFrame(P):cancelAnimationFrame(H);});},{root:C??null,threshold:0});M(),p.observe(u);let v;function N(){clearTimeout(v),v=setTimeout(M,150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),()=>{cancelAnimationFrame(H),clearTimeout(v),p.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N);}},[]),r}function br({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=at(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function wr({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=ft(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function vr({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let i=pt(t.current,r);return ()=>i.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function Er({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let l=useRef(null);return useEffect(()=>{if(!l.current)return;let u=gt(l.current,o);return ()=>u.destroy()},[]),jsx("video",{ref:l,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function Sr({children:e,as:n="p",className:r,style:t,...i}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let l=wt(o.current,i);return ()=>l.destroy()},[]),_t.createElement(n,{ref:o,className:r,style:t},e)}export{wr as ScrollAnimate,vr as ScrollCounter,br as ScrollDraw,Sr as ScrollText,Er as ScrollVideo,Bt as useScrollDrawProgress};
@@ -0,0 +1 @@
1
+ 'use strict';function Ee({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(r),s=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(u,c);m.push(p),s+=p;}let l=[0],a=0;for(let c=0;c<t;c++)a+=m[c]/s,l.push(a);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let d=(c-l[p])/(l[p+1]-l[p]);if(p===0)return d*(2-d);let v=1-Math.pow(r,p);return v+(1-v)*(2*d-1)*(2*d-1)}return 1}}function xe({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),u=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-u)*(2*Math.PI)/r)+1}var j={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:Ee(),elastic:xe()};function G(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function te(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function ne(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Se(e,n,t){return Math.min(t,Math.max(n,e))}function B(e,n,t,r){return t===n?0:Se((e-n)/(t-n)*r,0,1)}function U(e,n,t,r,u){let s=te(e.top,e.height,n,r.element)-ne(r.viewport,t),m=te(e.top,e.height,n,u.element)-ne(u.viewport,t);return {tStart:s,tEnd:m}}function re(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[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 oe(e,n,t){let r=re(e),u=re(n);return !r||!u?e:`rgb(${Math.round(r[0]+(u[0]-r[0])*t)},${Math.round(r[1]+(u[1]-r[1])*t)},${Math.round(r[2]+(u[2]-r[2])*t)})`}var se=new Map;function ie(e,n){se.set(e,n);}function ae(e){se.delete(e);}function Me(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ue(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let u=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let a=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(a?parseFloat(a[1]):0),s.push(a?a[2]:"");}n.push({fn:r[1],nums:u,units:s});}return n}function Pe(e,n,t){let r=ue(e),u=ue(n);return r.length===0||r.length!==u.length?t<1?e:n:r.map((s,m)=>{let l=u[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?t<1?`${s.fn}(${s.nums.map((a,c)=>`${a}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((a,c)=>`${a}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((a,c)=>`${a+(l.nums[c]-a)*t}${s.units[c]}`).join(", ")})`}).join(" ")}function ce(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),u=String(n);if(Me(r))return oe(r,u,t);if(r.includes("("))return Pe(r,u,t);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),a=parseFloat(m[1]);return `${l+(a-l)*t}${s[2]||m[2]}`}return t<1?r:u}function $e(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var le={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Ae=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Te=0;function Le(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function me(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:u={},easing:s="ease-out",speed:m=1,once:l=false,axis:a="y",scrollContainer:c,native:p=true,velocityScale:d=false,onProgress:v,onComplete:R,onEnter:F,onLeave:P,onEnterBack:$,onLeaveBack:I}=n,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,H=typeof s=="function"?s:j[s]??j["ease-out"],Z=G(u.start??"top bottom"),J=G(u.end??"bottom top"),f=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(r).map(([o,i])=>({prop:$e(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function fe(){let o=window.getComputedStyle(e);for(let i of w)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function ge(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}if(k)return ge(),R?.(),t;fe();function de(){if(!p||!Le()||typeof s!="string"||!(s in le)||a!=="y"||f||l||m!==1||v||R||F||P||$||I||d!==false||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Ae.has(o.prop))return false;return true}function be(){let o=`ssd-a-${++Te}`,i=w.map(g=>`${g.prop}:${g.from}`).join(";"),y=w.map(g=>`${g.prop}:${g.to}`).join(";"),h=document.createElement("style");h.setAttribute("data-ssd-animate",""),h.textContent=`@keyframes ${o}{from{${i}}to{${y}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${le[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(h),e.classList.add(o);let b=()=>a==="x"?window.scrollX:window.scrollY,D=()=>a==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),h.remove();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(g){let N=Math.min(1,Math.max(0,g));e.classList.remove(o);for(let C of w)e.style.setProperty(C.prop,ce(C.from,C.to,N));},getProgress(){let g=e.getBoundingClientRect(),N=b(),C=D(),{tStart:ve,tEnd:we}=U({top:g.top,height:g.height},N,C,Z,J);return H(B(N,ve,we,m))}}}if(de())return be();let E=0,A=0,x=0,O=false,S=false,T=-1,L=0,V=false,M=NaN,Y=-1,K=0,q=()=>f?a==="x"?f.scrollLeft:f.scrollTop:a==="x"?window.scrollX:window.scrollY,he=()=>f?a==="x"?f.clientWidth:f.clientHeight:a==="x"?window.innerWidth:window.innerHeight;function Q(){let o=e.getBoundingClientRect(),i,y;if(f){let b=f.getBoundingClientRect();i=a==="x"?o.left-b.left+f.scrollLeft:o.top-b.top+f.scrollTop,y=a==="x"?o.width:o.height;}else i=a==="x"?o.left:o.top,y=a==="x"?o.width:o.height;let h=U({top:i,height:y},q(),he(),Z,J);E=h.tStart,A=h.tEnd;}function X(o){e.style.setProperty("--scroll-draw-progress",String(o));for(let i of w)e.style.setProperty(i.prop,ce(i.from,i.to,o));v?.(o);}function ye(o){if(isNaN(M)){M=o;return}M<=0&&o>0?F?.():M>0&&o<=0&&I?.(),M<1&&o>=1?P?.():M>=1&&o<1&&$?.(),M=o;}function z(){if(!O||S)return;let o=performance.now(),i=q(),y=m;if(d!==false){let D=o-K,g=D>0?Math.abs(i-(Y<0?i:Y))/D:0;y=m*Math.max(.2,1+g*(typeof d=="number"?d:1)*.04);}Y=i,K=o;let h=A===E?0:(i-E)/(A-E);ye(h);let b=H(B(i,E,A,y));l&&(T=Math.max(T,b),b=T),L=b,X(b),b>=1&&!V?(V=true,R?.()):b<1&&!l&&(V=false),x=requestAnimationFrame(z);}Q();{let o=H(B(q(),E,A,m));l&&o>0&&(T=o),L=o,X(o);}let ee=new IntersectionObserver(o=>{o.forEach(i=>{O=i.isIntersecting,O&&!S?x=requestAnimationFrame(z):cancelAnimationFrame(x);});},{root:f??null}),W;function _(){clearTimeout(W),W=setTimeout(Q,150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),ee.observe(e),ie(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:E,tEnd:A})}),{destroy(){cancelAnimationFrame(x),ee.disconnect(),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(W),ae(e);},replay(){T=-1,V=false,L=0,S=false,X(0);},pause(){S=true,cancelAnimationFrame(x);},resume(){S&&(S=false,O&&(x=requestAnimationFrame(z)));},seek(o){let i=Math.min(1,Math.max(0,o));L=i,T=i,S=true,cancelAnimationFrame(x),X(i);},getProgress(){return L}}}var Re={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 Ie(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function Ne(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var pe={destroy:()=>{}};function De(e,n={}){if(typeof window>"u")return pe;let t=Ne(e);if(!t.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollReveal: no elements found:",e),pe;let{preset:r="fadeUp",from:u,stagger:s=.08,easing:m="ease-out",once:l=true,trigger:a,onEnter:c,onLeave:p}=n,d={...Re[r],...u},v=Ie(d),R=Math.min(s*4,4),F=t.map((P,$)=>{let I=Math.max(50,88-$*R),k=Math.max(20,I-35);return me(P,{props:v,easing:m,once:l,native:false,trigger:a??{start:`top ${I}%`,end:`top ${k}%`},onEnter:$===0?c:void 0,onLeave:$===t.length-1?p:void 0})});return {destroy(){F.forEach(P=>P.destroy());}}}exports.scrollReveal=De;
@@ -0,0 +1,80 @@
1
+ type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
+ interface TriggerConfig {
3
+ start?: string;
4
+ end?: string;
5
+ }
6
+
7
+ interface ScrollRevealFrom {
8
+ /** Start opacity (0–1). Animates to 1. */
9
+ opacity?: number;
10
+ /** Start translateX in px. Animates to 0. */
11
+ x?: number;
12
+ /** Start translateY in px. Animates to 0. */
13
+ y?: number;
14
+ /** Start scale. Animates to 1. */
15
+ scale?: number;
16
+ /** Start rotate in degrees. Animates to 0. */
17
+ rotate?: number;
18
+ /** Start rotateX in degrees. Animates to 0. */
19
+ rotateX?: number;
20
+ /** Start rotateY in degrees. Animates to 0. */
21
+ rotateY?: number;
22
+ }
23
+ type ScrollRevealPreset = 'fadeUp' | 'fadeDown' | 'fadeLeft' | 'fadeRight' | 'scale' | 'flip' | 'flipX';
24
+ interface ScrollRevealOptions {
25
+ /**
26
+ * Named preset for the reveal animation. Default: `'fadeUp'`.
27
+ * Custom `from` overrides the preset when both are provided.
28
+ *
29
+ * Presets:
30
+ * - `fadeUp` — opacity 0→1, y +32→0 (default)
31
+ * - `fadeDown` — opacity 0→1, y -32→0
32
+ * - `fadeLeft` — opacity 0→1, x +32→0
33
+ * - `fadeRight` — opacity 0→1, x -32→0
34
+ * - `scale` — opacity 0→1, scale 0.88→1
35
+ * - `flip` — opacity 0→1, rotateX 20→0
36
+ * - `flipX` — opacity 0→1, rotateY 20→0
37
+ */
38
+ preset?: ScrollRevealPreset;
39
+ /** Custom start state. Keys: opacity, x, y, scale, rotate, rotateX, rotateY. */
40
+ from?: ScrollRevealFrom;
41
+ /**
42
+ * Delay between each element's animation start (seconds).
43
+ * Elements are staggered by offsetting their trigger window.
44
+ * Default: 0.08.
45
+ */
46
+ stagger?: number;
47
+ /** Animation easing. Default: `'ease-out'`. */
48
+ easing?: EasingName | ((t: number) => number);
49
+ /** Freeze at max progress — don't reverse on scroll back. Default: true. */
50
+ once?: boolean;
51
+ /** Override the default trigger window. */
52
+ trigger?: TriggerConfig;
53
+ /** Fires when the first element enters the trigger zone. */
54
+ onEnter?: () => void;
55
+ /** Fires when the last element leaves the trigger zone. */
56
+ onLeave?: () => void;
57
+ }
58
+ interface ScrollRevealInstance {
59
+ /** Remove all animations and restore original styles. */
60
+ destroy: () => void;
61
+ }
62
+ /**
63
+ * Reveal elements as they scroll into view.
64
+ *
65
+ * The zero-config replacement for AOS, ScrollReveal.js, and GSAP + ScrollTrigger
66
+ * for the most common scroll animation use case — in one function call.
67
+ *
68
+ * @example
69
+ * // Fade up (default)
70
+ * scrollReveal('.card');
71
+ *
72
+ * // Custom from state
73
+ * scrollReveal('.feature', { from: { opacity: 0, y: 40, scale: 0.95 } });
74
+ *
75
+ * // Named preset with stagger
76
+ * scrollReveal('.item', { preset: 'fadeLeft', stagger: 0.1 });
77
+ */
78
+ declare function scrollReveal(target: string | NodeList | Element[], options?: ScrollRevealOptions): ScrollRevealInstance;
79
+
80
+ export { type ScrollRevealFrom, type ScrollRevealInstance, type ScrollRevealOptions, type ScrollRevealPreset, scrollReveal };
@@ -0,0 +1,80 @@
1
+ type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
+ interface TriggerConfig {
3
+ start?: string;
4
+ end?: string;
5
+ }
6
+
7
+ interface ScrollRevealFrom {
8
+ /** Start opacity (0–1). Animates to 1. */
9
+ opacity?: number;
10
+ /** Start translateX in px. Animates to 0. */
11
+ x?: number;
12
+ /** Start translateY in px. Animates to 0. */
13
+ y?: number;
14
+ /** Start scale. Animates to 1. */
15
+ scale?: number;
16
+ /** Start rotate in degrees. Animates to 0. */
17
+ rotate?: number;
18
+ /** Start rotateX in degrees. Animates to 0. */
19
+ rotateX?: number;
20
+ /** Start rotateY in degrees. Animates to 0. */
21
+ rotateY?: number;
22
+ }
23
+ type ScrollRevealPreset = 'fadeUp' | 'fadeDown' | 'fadeLeft' | 'fadeRight' | 'scale' | 'flip' | 'flipX';
24
+ interface ScrollRevealOptions {
25
+ /**
26
+ * Named preset for the reveal animation. Default: `'fadeUp'`.
27
+ * Custom `from` overrides the preset when both are provided.
28
+ *
29
+ * Presets:
30
+ * - `fadeUp` — opacity 0→1, y +32→0 (default)
31
+ * - `fadeDown` — opacity 0→1, y -32→0
32
+ * - `fadeLeft` — opacity 0→1, x +32→0
33
+ * - `fadeRight` — opacity 0→1, x -32→0
34
+ * - `scale` — opacity 0→1, scale 0.88→1
35
+ * - `flip` — opacity 0→1, rotateX 20→0
36
+ * - `flipX` — opacity 0→1, rotateY 20→0
37
+ */
38
+ preset?: ScrollRevealPreset;
39
+ /** Custom start state. Keys: opacity, x, y, scale, rotate, rotateX, rotateY. */
40
+ from?: ScrollRevealFrom;
41
+ /**
42
+ * Delay between each element's animation start (seconds).
43
+ * Elements are staggered by offsetting their trigger window.
44
+ * Default: 0.08.
45
+ */
46
+ stagger?: number;
47
+ /** Animation easing. Default: `'ease-out'`. */
48
+ easing?: EasingName | ((t: number) => number);
49
+ /** Freeze at max progress — don't reverse on scroll back. Default: true. */
50
+ once?: boolean;
51
+ /** Override the default trigger window. */
52
+ trigger?: TriggerConfig;
53
+ /** Fires when the first element enters the trigger zone. */
54
+ onEnter?: () => void;
55
+ /** Fires when the last element leaves the trigger zone. */
56
+ onLeave?: () => void;
57
+ }
58
+ interface ScrollRevealInstance {
59
+ /** Remove all animations and restore original styles. */
60
+ destroy: () => void;
61
+ }
62
+ /**
63
+ * Reveal elements as they scroll into view.
64
+ *
65
+ * The zero-config replacement for AOS, ScrollReveal.js, and GSAP + ScrollTrigger
66
+ * for the most common scroll animation use case — in one function call.
67
+ *
68
+ * @example
69
+ * // Fade up (default)
70
+ * scrollReveal('.card');
71
+ *
72
+ * // Custom from state
73
+ * scrollReveal('.feature', { from: { opacity: 0, y: 40, scale: 0.95 } });
74
+ *
75
+ * // Named preset with stagger
76
+ * scrollReveal('.item', { preset: 'fadeLeft', stagger: 0.1 });
77
+ */
78
+ declare function scrollReveal(target: string | NodeList | Element[], options?: ScrollRevealOptions): ScrollRevealInstance;
79
+
80
+ export { type ScrollRevealFrom, type ScrollRevealInstance, type ScrollRevealOptions, type ScrollRevealPreset, scrollReveal };
@@ -0,0 +1 @@
1
+ function Ee({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),u=Math.sqrt(r),s=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(u,c);m.push(p),s+=p;}let l=[0],a=0;for(let c=0;c<t;c++)a+=m[c]/s,l.push(a);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let d=(c-l[p])/(l[p+1]-l[p]);if(p===0)return d*(2-d);let v=1-Math.pow(r,p);return v+(1-v)*(2*d-1)*(2*d-1)}return 1}}function xe({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),u=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-u)*(2*Math.PI)/r)+1}var j={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:Ee(),elastic:xe()};function G(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function te(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function ne(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Se(e,n,t){return Math.min(t,Math.max(n,e))}function B(e,n,t,r){return t===n?0:Se((e-n)/(t-n)*r,0,1)}function U(e,n,t,r,u){let s=te(e.top,e.height,n,r.element)-ne(r.viewport,t),m=te(e.top,e.height,n,u.element)-ne(u.viewport,t);return {tStart:s,tEnd:m}}function re(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[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 oe(e,n,t){let r=re(e),u=re(n);return !r||!u?e:`rgb(${Math.round(r[0]+(u[0]-r[0])*t)},${Math.round(r[1]+(u[1]-r[1])*t)},${Math.round(r[2]+(u[2]-r[2])*t)})`}var se=new Map;function ie(e,n){se.set(e,n);}function ae(e){se.delete(e);}function Me(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function ue(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let u=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let a=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(a?parseFloat(a[1]):0),s.push(a?a[2]:"");}n.push({fn:r[1],nums:u,units:s});}return n}function Pe(e,n,t){let r=ue(e),u=ue(n);return r.length===0||r.length!==u.length?t<1?e:n:r.map((s,m)=>{let l=u[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?t<1?`${s.fn}(${s.nums.map((a,c)=>`${a}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((a,c)=>`${a}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((a,c)=>`${a+(l.nums[c]-a)*t}${s.units[c]}`).join(", ")})`}).join(" ")}function ce(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),u=String(n);if(Me(r))return oe(r,u,t);if(r.includes("("))return Pe(r,u,t);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=u.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),a=parseFloat(m[1]);return `${l+(a-l)*t}${s[2]||m[2]}`}return t<1?r:u}function $e(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var le={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Ae=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Te=0;function Le(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function me(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:u={},easing:s="ease-out",speed:m=1,once:l=false,axis:a="y",scrollContainer:c,native:p=true,velocityScale:d=false,onProgress:v,onComplete:R,onEnter:F,onLeave:P,onEnterBack:$,onLeaveBack:I}=n,k=window.matchMedia("(prefers-reduced-motion: reduce)").matches,H=typeof s=="function"?s:j[s]??j["ease-out"],Z=G(u.start??"top bottom"),J=G(u.end??"bottom top"),f=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(r).map(([o,i])=>({prop:$e(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function fe(){let o=window.getComputedStyle(e);for(let i of w)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function ge(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}if(k)return ge(),R?.(),t;fe();function de(){if(!p||!Le()||typeof s!="string"||!(s in le)||a!=="y"||f||l||m!==1||v||R||F||P||$||I||d!==false||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Ae.has(o.prop))return false;return true}function be(){let o=`ssd-a-${++Te}`,i=w.map(g=>`${g.prop}:${g.from}`).join(";"),y=w.map(g=>`${g.prop}:${g.to}`).join(";"),h=document.createElement("style");h.setAttribute("data-ssd-animate",""),h.textContent=`@keyframes ${o}{from{${i}}to{${y}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${le[s]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(h),e.classList.add(o);let b=()=>a==="x"?window.scrollX:window.scrollY,D=()=>a==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),h.remove();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(g){let N=Math.min(1,Math.max(0,g));e.classList.remove(o);for(let C of w)e.style.setProperty(C.prop,ce(C.from,C.to,N));},getProgress(){let g=e.getBoundingClientRect(),N=b(),C=D(),{tStart:ve,tEnd:we}=U({top:g.top,height:g.height},N,C,Z,J);return H(B(N,ve,we,m))}}}if(de())return be();let E=0,A=0,x=0,O=false,S=false,T=-1,L=0,V=false,M=NaN,Y=-1,K=0,q=()=>f?a==="x"?f.scrollLeft:f.scrollTop:a==="x"?window.scrollX:window.scrollY,he=()=>f?a==="x"?f.clientWidth:f.clientHeight:a==="x"?window.innerWidth:window.innerHeight;function Q(){let o=e.getBoundingClientRect(),i,y;if(f){let b=f.getBoundingClientRect();i=a==="x"?o.left-b.left+f.scrollLeft:o.top-b.top+f.scrollTop,y=a==="x"?o.width:o.height;}else i=a==="x"?o.left:o.top,y=a==="x"?o.width:o.height;let h=U({top:i,height:y},q(),he(),Z,J);E=h.tStart,A=h.tEnd;}function X(o){e.style.setProperty("--scroll-draw-progress",String(o));for(let i of w)e.style.setProperty(i.prop,ce(i.from,i.to,o));v?.(o);}function ye(o){if(isNaN(M)){M=o;return}M<=0&&o>0?F?.():M>0&&o<=0&&I?.(),M<1&&o>=1?P?.():M>=1&&o<1&&$?.(),M=o;}function z(){if(!O||S)return;let o=performance.now(),i=q(),y=m;if(d!==false){let D=o-K,g=D>0?Math.abs(i-(Y<0?i:Y))/D:0;y=m*Math.max(.2,1+g*(typeof d=="number"?d:1)*.04);}Y=i,K=o;let h=A===E?0:(i-E)/(A-E);ye(h);let b=H(B(i,E,A,y));l&&(T=Math.max(T,b),b=T),L=b,X(b),b>=1&&!V?(V=true,R?.()):b<1&&!l&&(V=false),x=requestAnimationFrame(z);}Q();{let o=H(B(q(),E,A,m));l&&o>0&&(T=o),L=o,X(o);}let ee=new IntersectionObserver(o=>{o.forEach(i=>{O=i.isIntersecting,O&&!S?x=requestAnimationFrame(z):cancelAnimationFrame(x);});},{root:f??null}),W;function _(){clearTimeout(W),W=setTimeout(Q,150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),ee.observe(e),ie(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:E,tEnd:A})}),{destroy(){cancelAnimationFrame(x),ee.disconnect(),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(W),ae(e);},replay(){T=-1,V=false,L=0,S=false,X(0);},pause(){S=true,cancelAnimationFrame(x);},resume(){S&&(S=false,O&&(x=requestAnimationFrame(z)));},seek(o){let i=Math.min(1,Math.max(0,o));L=i,T=i,S=true,cancelAnimationFrame(x),X(i);},getProgress(){return L}}}var Re={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 Ie(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function Ne(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var pe={destroy:()=>{}};function De(e,n={}){if(typeof window>"u")return pe;let t=Ne(e);if(!t.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollReveal: no elements found:",e),pe;let{preset:r="fadeUp",from:u,stagger:s=.08,easing:m="ease-out",once:l=true,trigger:a,onEnter:c,onLeave:p}=n,d={...Re[r],...u},v=Ie(d),R=Math.min(s*4,4),F=t.map((P,$)=>{let I=Math.max(50,88-$*R),k=Math.max(20,I-35);return me(P,{props:v,easing:m,once:l,native:false,trigger:a??{start:`top ${I}%`,end:`top ${k}%`},onEnter:$===0?c:void 0,onLeave:$===t.length-1?p:void 0})});return {destroy(){F.forEach(P=>P.destroy());}}}export{De as scrollReveal};
@@ -0,0 +1 @@
1
+ 'use strict';function q({bounces:e=3,decay:m=.5}={}){let n=Math.max(1,Math.round(e)),l=Math.max(.01,Math.min(.99,m)),b=Math.sqrt(l),u=0,g=[];for(let s=0;s<n;s++){let t=Math.pow(b,s);g.push(t),u+=t;}let c=[0],h=0;for(let s=0;s<n;s++)h+=g[s]/u,c.push(h);return s=>{if(s<=0)return 0;if(s>=1)return 1;for(let t=0;t<n;t++)if(s<=c[t+1]){let r=(s-c[t])/(c[t+1]-c[t]);if(t===0)return r*(2-r);let o=1-Math.pow(l,t);return o+(1-o)*(2*r-1)*(2*r-1)}return 1}}function O({amplitude:e=1,period:m=.4}={}){let n=Math.max(1,e),l=Math.max(.1,m),b=n<=1?l/4:l/(2*Math.PI)*Math.asin(1/n);return u=>u<=0?0:u>=1?1:n*Math.pow(2,-10*u)*Math.sin((u-b)*(2*Math.PI)/l)+1}var v={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:q(),elastic:O()};function A(e,m,n){return Math.min(n,Math.max(m,e))}var $={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function G(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function B(e,m={}){if(typeof window>"u")return $;let n=G(e);if(!n.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollSnap: no sections found"),$;let{direction:l="vertical",duration:b=600,easing:u="ease-in-out",threshold:g=.3,scrollContainer:c,onSnap:h}=m,s=typeof u=="function"?u:v[u]??v["ease-in-out"],t=l==="horizontal",r=typeof c=="string"?document.querySelector(c):c??null,o=0,f=false,x=0;function L(){return r?t?r.scrollLeft:r.scrollTop:t?window.scrollX:window.scrollY}function P(a){r?t?r.scrollLeft=a:r.scrollTop=a:window.scrollTo(t?{left:a}:{top:a});}function N(){return n.map(a=>{let i=a.getBoundingClientRect();if(r){let p=r.getBoundingClientRect();return t?i.left-p.left+r.scrollLeft:i.top-p.top+r.scrollTop}return t?i.left+window.scrollX:i.top+window.scrollY})}function S(a){let i=A(a,0,n.length-1);f&&(cancelAnimationFrame(x),f=false),f=true;let p=N(),d=L(),w=p[i];if(Math.abs(d-w)<1){f=false,o=i,h?.(i);return}let I=performance.now();function E(y){let M=A((y-I)/b,0,1);P(d+(w-d)*s(M)),M<1?x=requestAnimationFrame(E):(f=false,o=i,h?.(i));}x=requestAnimationFrame(E);}let T;function F(){f||(clearTimeout(T),T=setTimeout(()=>{let a=L(),i=N();i.forEach((E,y)=>{});let w=t?n[o].offsetWidth:n[o].offsetHeight,I=a-i[o];I>w*g&&o<n.length-1?S(o+1):I<-(w*g)&&o>0?S(o-1):S(o);},100));}let C=r??window;return C.addEventListener("scroll",F,{passive:true}),{destroy(){cancelAnimationFrame(x),clearTimeout(T),C.removeEventListener("scroll",F);},snapTo:S,getCurrentIndex(){return o}}}exports.scrollSnap=B;
@@ -0,0 +1,30 @@
1
+ type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
+
3
+ interface ScrollSnapOptions {
4
+ /** Scroll axis. Default: 'vertical'. */
5
+ direction?: 'vertical' | 'horizontal';
6
+ /** Snap animation duration in ms. Default: 600. */
7
+ duration?: number;
8
+ /** Easing for the snap scroll animation. Default: 'ease-in-out'. */
9
+ easing?: EasingName | ((t: number) => number);
10
+ /**
11
+ * Fraction of a section's size the user must scroll past before it snaps
12
+ * forward instead of snapping back. Range 0–1. Default: 0.3.
13
+ */
14
+ threshold?: number;
15
+ /** Custom scroll container. Default: window. */
16
+ scrollContainer?: string | Element;
17
+ /** Fires after each snap with the target section index. */
18
+ onSnap?: (index: number) => void;
19
+ }
20
+ interface ScrollSnapInstance {
21
+ /** Remove snap behaviour and all listeners. */
22
+ destroy: () => void;
23
+ /** Programmatically snap to a section by zero-based index. */
24
+ snapTo: (index: number) => void;
25
+ /** Returns the index of the currently snapped section. */
26
+ getCurrentIndex: () => number;
27
+ }
28
+ declare function scrollSnap(sections: string | NodeList | Element[], options?: ScrollSnapOptions): ScrollSnapInstance;
29
+
30
+ export { type ScrollSnapInstance, type ScrollSnapOptions, scrollSnap };
@@ -0,0 +1,30 @@
1
+ type EasingName = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic';
2
+
3
+ interface ScrollSnapOptions {
4
+ /** Scroll axis. Default: 'vertical'. */
5
+ direction?: 'vertical' | 'horizontal';
6
+ /** Snap animation duration in ms. Default: 600. */
7
+ duration?: number;
8
+ /** Easing for the snap scroll animation. Default: 'ease-in-out'. */
9
+ easing?: EasingName | ((t: number) => number);
10
+ /**
11
+ * Fraction of a section's size the user must scroll past before it snaps
12
+ * forward instead of snapping back. Range 0–1. Default: 0.3.
13
+ */
14
+ threshold?: number;
15
+ /** Custom scroll container. Default: window. */
16
+ scrollContainer?: string | Element;
17
+ /** Fires after each snap with the target section index. */
18
+ onSnap?: (index: number) => void;
19
+ }
20
+ interface ScrollSnapInstance {
21
+ /** Remove snap behaviour and all listeners. */
22
+ destroy: () => void;
23
+ /** Programmatically snap to a section by zero-based index. */
24
+ snapTo: (index: number) => void;
25
+ /** Returns the index of the currently snapped section. */
26
+ getCurrentIndex: () => number;
27
+ }
28
+ declare function scrollSnap(sections: string | NodeList | Element[], options?: ScrollSnapOptions): ScrollSnapInstance;
29
+
30
+ export { type ScrollSnapInstance, type ScrollSnapOptions, scrollSnap };
@@ -0,0 +1 @@
1
+ function q({bounces:e=3,decay:m=.5}={}){let n=Math.max(1,Math.round(e)),l=Math.max(.01,Math.min(.99,m)),b=Math.sqrt(l),u=0,g=[];for(let s=0;s<n;s++){let t=Math.pow(b,s);g.push(t),u+=t;}let c=[0],h=0;for(let s=0;s<n;s++)h+=g[s]/u,c.push(h);return s=>{if(s<=0)return 0;if(s>=1)return 1;for(let t=0;t<n;t++)if(s<=c[t+1]){let r=(s-c[t])/(c[t+1]-c[t]);if(t===0)return r*(2-r);let o=1-Math.pow(l,t);return o+(1-o)*(2*r-1)*(2*r-1)}return 1}}function O({amplitude:e=1,period:m=.4}={}){let n=Math.max(1,e),l=Math.max(.1,m),b=n<=1?l/4:l/(2*Math.PI)*Math.asin(1/n);return u=>u<=0?0:u>=1?1:n*Math.pow(2,-10*u)*Math.sin((u-b)*(2*Math.PI)/l)+1}var v={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:q(),elastic:O()};function A(e,m,n){return Math.min(n,Math.max(m,e))}var $={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function G(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function B(e,m={}){if(typeof window>"u")return $;let n=G(e);if(!n.length)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollSnap: no sections found"),$;let{direction:l="vertical",duration:b=600,easing:u="ease-in-out",threshold:g=.3,scrollContainer:c,onSnap:h}=m,s=typeof u=="function"?u:v[u]??v["ease-in-out"],t=l==="horizontal",r=typeof c=="string"?document.querySelector(c):c??null,o=0,f=false,x=0;function L(){return r?t?r.scrollLeft:r.scrollTop:t?window.scrollX:window.scrollY}function P(a){r?t?r.scrollLeft=a:r.scrollTop=a:window.scrollTo(t?{left:a}:{top:a});}function N(){return n.map(a=>{let i=a.getBoundingClientRect();if(r){let p=r.getBoundingClientRect();return t?i.left-p.left+r.scrollLeft:i.top-p.top+r.scrollTop}return t?i.left+window.scrollX:i.top+window.scrollY})}function S(a){let i=A(a,0,n.length-1);f&&(cancelAnimationFrame(x),f=false),f=true;let p=N(),d=L(),w=p[i];if(Math.abs(d-w)<1){f=false,o=i,h?.(i);return}let I=performance.now();function E(y){let M=A((y-I)/b,0,1);P(d+(w-d)*s(M)),M<1?x=requestAnimationFrame(E):(f=false,o=i,h?.(i));}x=requestAnimationFrame(E);}let T;function F(){f||(clearTimeout(T),T=setTimeout(()=>{let a=L(),i=N();i.forEach((E,y)=>{});let w=t?n[o].offsetWidth:n[o].offsetHeight,I=a-i[o];I>w*g&&o<n.length-1?S(o+1):I<-(w*g)&&o>0?S(o-1):S(o);},100));}let C=r??window;return C.addEventListener("scroll",F,{passive:true}),{destroy(){cancelAnimationFrame(x),clearTimeout(T),C.removeEventListener("scroll",F);},snapTo:S,getCurrentIndex(){return o}}}export{B as scrollSnap};