svg-scroll-draw 2.7.0 → 2.10.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 (76) hide show
  1. package/dist/angular/index.cjs +3 -3
  2. package/dist/angular/index.d.mts +48 -0
  3. package/dist/angular/index.d.ts +48 -0
  4. package/dist/angular/index.mjs +3 -3
  5. package/dist/astro/index.cjs +3 -3
  6. package/dist/astro/index.d.mts +20 -5
  7. package/dist/astro/index.d.ts +20 -5
  8. package/dist/astro/index.mjs +3 -3
  9. package/dist/cdn/svg-scroll-draw.dev.global.js +1878 -0
  10. package/dist/cdn/svg-scroll-draw.global.js +3 -3
  11. package/dist/cinematic/index.cjs +2 -2
  12. package/dist/cinematic/index.mjs +2 -2
  13. package/dist/cli/init.js +104 -101
  14. package/dist/devtools/index.cjs +1 -1
  15. package/dist/devtools/index.mjs +1 -1
  16. package/dist/group/index.cjs +3 -3
  17. package/dist/group/index.d.mts +48 -0
  18. package/dist/group/index.d.ts +48 -0
  19. package/dist/group/index.mjs +3 -3
  20. package/dist/horizontal/index.cjs +1 -0
  21. package/dist/horizontal/index.d.mts +108 -0
  22. package/dist/horizontal/index.d.ts +108 -0
  23. package/dist/horizontal/index.mjs +1 -0
  24. package/dist/index.cjs +4 -4
  25. package/dist/index.d.mts +48 -0
  26. package/dist/index.d.ts +48 -0
  27. package/dist/index.mjs +4 -4
  28. package/dist/nuxt/index.cjs +3 -3
  29. package/dist/nuxt/index.d.mts +33 -0
  30. package/dist/nuxt/index.d.ts +33 -0
  31. package/dist/nuxt/index.mjs +3 -3
  32. package/dist/pin/index.cjs +1 -1
  33. package/dist/pin/index.mjs +1 -1
  34. package/dist/progress/index.cjs +1 -0
  35. package/dist/progress/index.d.mts +74 -0
  36. package/dist/progress/index.d.ts +74 -0
  37. package/dist/progress/index.mjs +1 -0
  38. package/dist/react/index.cjs +3 -3
  39. package/dist/react/index.d.mts +33 -0
  40. package/dist/react/index.d.ts +33 -0
  41. package/dist/react/index.mjs +3 -3
  42. package/dist/reveal/index.cjs +1 -0
  43. package/dist/reveal/index.d.mts +80 -0
  44. package/dist/reveal/index.d.ts +80 -0
  45. package/dist/reveal/index.mjs +1 -0
  46. package/dist/snap/index.cjs +1 -1
  47. package/dist/snap/index.d.mts +8 -0
  48. package/dist/snap/index.d.ts +8 -0
  49. package/dist/snap/index.mjs +1 -1
  50. package/dist/solid/index.cjs +3 -3
  51. package/dist/solid/index.d.mts +48 -0
  52. package/dist/solid/index.d.ts +48 -0
  53. package/dist/solid/index.mjs +3 -3
  54. package/dist/svelte/index.cjs +3 -3
  55. package/dist/svelte/index.d.mts +48 -0
  56. package/dist/svelte/index.d.ts +48 -0
  57. package/dist/svelte/index.mjs +3 -3
  58. package/dist/text/index.cjs +1 -1
  59. package/dist/text/index.d.mts +15 -0
  60. package/dist/text/index.d.ts +15 -0
  61. package/dist/text/index.mjs +1 -1
  62. package/dist/timeline/index.cjs +8 -8
  63. package/dist/timeline/index.d.mts +31 -0
  64. package/dist/timeline/index.d.ts +31 -0
  65. package/dist/timeline/index.mjs +8 -8
  66. package/dist/video/index.cjs +1 -1
  67. package/dist/video/index.d.mts +15 -0
  68. package/dist/video/index.d.ts +15 -0
  69. package/dist/video/index.mjs +1 -1
  70. package/dist/vue/index.cjs +3 -3
  71. package/dist/vue/index.d.mts +33 -0
  72. package/dist/vue/index.d.ts +33 -0
  73. package/dist/vue/index.mjs +3 -3
  74. package/dist/web-component/index.cjs +3 -3
  75. package/dist/web-component/index.mjs +3 -3
  76. package/package.json +37 -5
@@ -1,3 +1,3 @@
1
- 'use strict';function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),u=Math.sqrt(t),o=0,f=[];for(let y=0;y<n;y++){let $=Math.pow(u,y);f.push($),o+=$;}let l=[0],c=0;for(let y=0;y<n;y++)c+=f[y]/o,l.push(c);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let $=0;$<n;$++)if(y<=l[$+1]){let B=(y-l[$])/(l[$+1]-l[$]);if($===0)return B*(2-B);let S=1-Math.pow(t,$);return S+(1-S)*(2*B-1)*(2*B-1)}return 1}}function Pt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),u=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-u)*(2*Math.PI)/t)+1}var ie={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:Mt(),elastic:Pt()};function ae(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Ke(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Qe(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function $t(e,r,n){return Math.min(n,Math.max(r,e))}function K(e,r,n,t){return n===r?0:$t((e-r)/(n-r)*t,0,1)}function pe(e,r,n,t,u){let o=Ke(e.top,e.height,r,t.element)-Qe(t.viewport,n),f=Ke(e.top,e.height,r,u.element)-Qe(u.viewport,n);return {tStart:o,tEnd:f}}function et(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Fe(e,r,n){let t=et(e),u=et(r);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*n)},${Math.round(t[1]+(u[1]-t[1])*n)},${Math.round(t[2]+(u[2]-t[2])*n)})`}var tt={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 rt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var nt={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 kt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?rt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&rt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function It(e,r,n){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 u(){let o=n==="x"?window.scrollX:window.scrollY,f=e-o,l=r-o,c=n==="x";t.innerHTML=`
2
- <div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}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:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",u,{passive:true}),u(),t}function Ye(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let f=parseFloat(o),l=t[u++]??f;return String(+(f+(l-f)*n).toFixed(4))})}function st(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...tt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:y="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:ye=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:G="0px",repeat:L=0,repeatDelay:N=0,morphTo:M,clip:z,autoplay:re=false,duration:D=1e3,native:W=true,onProgress:d,onStart:P,onComplete:g,onEnter:h,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof y=="function"?y:ie[y]??ie.linear,Ne=ae($.start??"top bottom"),ke=ae($.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,Y=Array.isArray(A)?A[0]:null,H=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,se=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(s){let a=s*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),I=[],me=[],ge=0,Te=0,oe=false,he=false,ne=0,He=false,ve=-1,Re=-1,le=false,Le=0,xe=0,Ae,Be=null,Me=new Set,ze=-1,Ue=performance.now(),Ie=NaN;function De(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function Ze(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Je(){let s=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?s.left-ue.left+U.scrollLeft:s.top-ue.top+U.scrollTop,E=R==="x"?s.width:s.height,j=De();}else a=R==="x"?s.left:s.top,E=R==="x"?s.width:s.height,j=De();let ce=pe({top:a,height:E},j,Ze(),Ne,ke);ge=ce.tStart,Te=ce.tEnd,ye&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=It(ge,Te,R));}function St(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),we){let E=a==="reverse"?1-s:s;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${I[j]*s}`:`${I[j]*(1-s)}`,c&&(E.style.opacity=a==="reverse"?`${1-s}`:`${s}`),i&&p?E.style.stroke=Fe(i,p,s):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*s}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&se!==null?E.style.fillOpacity=`${Z+(se-Z)*s}`:se!==null&&(E.style.fillOpacity=`${se}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ye(me[j],M,s));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((s,a)=>{s.style.strokeDasharray=`${I[a]}`,s.style.strokeDashoffset=S==="reverse"?"0":`${I[a]}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`),M&&s.tagName.toLowerCase()==="path"&&me[a]&&s.setAttribute("d",me[a]);});}if(_.forEach(s=>{kt(s);let a=_e(s);I.push(a),s.tagName.toLowerCase()==="path"?me.push(s.getAttribute("d")??""):me.push(""),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(s.style.opacity="1"),p&&(s.style.stroke=p),H!==null&&(s.style.strokeWidth=`${H}`),se!==null&&(s.style.fillOpacity=`${se}`),M&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",M)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`));}),we){if(o)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(W===false||!Ct()||!_.length||typeof y!="string"||!(y in nt)||we||R!=="y"||U||l!==1||B!==0||Q||te||C!==false||M||b||L||q>0||d||P||g||h||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Tt(){let s=`svg-scroll-draw-${++Lt}`,a=S==="reverse"?"0":"var(--ssd-len)",E=S==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${E};`;c&&(j+=`opacity:${S==="reverse"?1:0};`,ce+=`opacity:${S==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${j}}to{${ce}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${nt[y]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function fe(m,T){m.style.setProperty("--ssd-len",String(I[T])),m.style.strokeDasharray=`${I[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(s);}_.forEach(fe);let v=false,O=-1;function F(){if(O>=0)return O;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},De(),Ze(),Ne,ke);return de(K(De(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(s),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,O=-1,_.forEach(fe);},pause(){v=true,_.forEach(m=>{m.style.animationPlayState="paused";});},resume(){v&&(v=false,_.forEach(m=>{m.style.animationPlayState="running";}));},seek(m){let T=Math.min(1,Math.max(0,m));O=T,v=true,_.forEach((V,Ce)=>{V.classList.remove(s),V.style.strokeDashoffset=S==="reverse"?`${I[Ce]*T}`:`${I[Ce]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return F()}}}if(xt())return Tt();function At(){let s=Math.max(1,D),a=0,E=0;function j(F){let m=true;if(we){let T=Math.min(1,Math.max(0,F/s)),V=de(T);Le=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(S==="reverse"?1-V:V),d?.(V),T<1&&(m=false);}else _.forEach((T,V)=>{let Ce=V*B*s,Oe=Math.min(1,Math.max(0,(F-Ce)/s)),Ee=de(Oe);T.style.strokeDashoffset=S==="reverse"?`${I[V]*Ee}`:`${I[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=Fe(i,p,Ee):p&&(T.style.stroke=p),Y!==null&&H!==null?T.style.strokeWidth=`${Y+(H-Y)*Ee}`:H!==null&&(T.style.strokeWidth=`${H}`),Z!==null&&se!==null?T.style.fillOpacity=`${Z+(se-Z)*Ee}`:se!==null&&(T.style.fillOpacity=`${se}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ye(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Oe<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,F/s)),V=de(T);for(let Ce in b){let Oe=parseFloat(Ce);V>=Oe&&!Me.has(Oe)&&(Me.add(Oe),b[Ce]?.());}}return m}function ce(F){if(le)return;let m=F-a;he||(he=true,P?.());let T=j(m);if(T&&!oe){oe=true,j(s*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),he=false,oe=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},N));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,he=false,oe=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(F=>{F.forEach(m=>{m.isIntersecting&&!(Q&&oe)?ue():!m.isIntersecting&&!Q&&!oe&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:k,rootMargin:G}),v;function O(){clearTimeout(v),v=setTimeout(()=>{_.forEach((F,m)=>{I[m]=_e(F),F.style.strokeDasharray=`${I[m]}`;});},150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(v);},replay(){xe=0,ue();},pause(){le||(le=true,E=performance.now()-a,cancelAnimationFrame(ne));},resume(){le&&(le=false,a=performance.now()-E,ne=requestAnimationFrame(ce));},seek(F){let m=Math.min(1,Math.max(0,F));Le=m,le=true,E=m*s,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Le}}}if(re)return At();Je();function qe(){if(!He||le)return;let s=performance.now(),a=De(),E=l;if(C!==false){let v=s-Ue,O=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+O*(typeof C=="number"?C:1)*.04);}ze=a,Ue=s;let j=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ce=Te-ge,ue=true,fe=ce===0?0:(a-ge)/ce;if(isNaN(Ie)||(Ie<=0&&fe>0?h?.():Ie>0&&fe<=0&&be?.(),Ie<1&&fe>=1?X?.():Ie>=1&&fe<1&&Se?.()),Ie=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Le=v,e.style.setProperty("--scroll-draw-progress",String(v));let O=j==="reverse"?1-v:v;e.style.clipPath=J(O),d?.(v),!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),v>=1&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,e.style.clipPath=J(0);},N))):v<1&&!Q&&(oe=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,O)=>{let F=O*B*ce,m=de(K(a,ge+F,Te+F,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Le=m,v.style.strokeDashoffset=j==="reverse"?`${I[O]*m}`:`${I[O]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=Fe(i,p,m):p&&(v.style.stroke=p),Y!==null&&H!==null?v.style.strokeWidth=`${Y+(H-Y)*m}`:H!==null&&(v.style.strokeWidth=`${H}`),Z!==null&&se!==null?v.style.fillOpacity=`${Z+(se-Z)*m}`:se!==null&&(v.style.fillOpacity=`${se}`),M&&v.tagName.toLowerCase()==="path"&&me[O]&&v.setAttribute("d",Ye(me[O],M,m)),O===0&&(d?.(m),e.style.setProperty("--scroll-draw-progress",String(m))),m<1&&(ue=false);}),b){let v=de(K(a,ge,Te,E));for(let O in b){let F=parseFloat(O);v>=F&&!Me.has(F)&&(Me.add(F),b[O]?.());}}!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),ue&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,Me.clear(),Ve();},N))):!ue&&!Q&&(oe=false),ne=requestAnimationFrame(qe);}let Ge=new IntersectionObserver(s=>{s.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:k,rootMargin:G}),Xe;function We(){clearTimeout(Xe),Xe=setTimeout(()=>{_.forEach((s,a)=>{I[a]=_e(s),s.style.strokeDasharray=`${I[a]}`;}),Je();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ge.observe(e),q):Ge.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ge.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Xe),Be?.remove();},replay(){ve=-1,Re=-1,ze=-1,he=false,oe=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(s){let a=Math.min(1,Math.max(0,s));Le=a,ve=a,le=true,cancelAnimationFrame(ne),St(a,S);},getProgress(){return Le}}}var ot=new Map;function Pe(e,r){ot.set(e,r);}function $e(e){ot.delete(e);}function Ot(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function it(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let u=[],o=[],f=t[2].trim();if(f)for(let l of f.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}r.push({fn:t[1],nums:u,units:o});}return r}function Ft(e,r,n){let t=it(e),u=it(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((o,f)=>{let l=u[f];return o.fn!==l.fn||o.nums.length!==l.nums.length?n<1?`${o.fn}(${o.nums.map((c,y)=>`${c}${o.units[y]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,y)=>`${c}${l.units[y]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,y)=>`${c+(l.nums[y]-c)*n}${o.units[y]}`).join(", ")})`}).join(" ")}function at(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Ot(t))return Fe(t,u,n);if(t.includes("("))return Ft(t,u,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(o&&f){let l=parseFloat(o[1]),c=parseFloat(f[1]);return `${l+(c-l)*n}${o[2]||f[2]}`}return n<1?t:u}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var lt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ht=0;function Rt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ct(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:o="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:y,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:ye,onEnterBack:R,onLeaveBack:ee}=r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof o=="function"?o:ie[o]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof y=="string"?document.querySelector(y):y??null,b=Object.entries(t).map(([i,p])=>({prop:Nt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function C(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function k(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return k(),S?.(),n;C();function G(){if(!$||!Rt()||typeof o!="string"||!(o in lt)||c!=="y"||w||l||f!==1||B||S||Q||ye||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!Dt.has(i.prop))return false;return true}function L(){let i=`ssd-a-${++Ht}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),Y=b.map(J=>`${J.prop}:${J.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${p}}to{${Y}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${lt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let Z=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),H.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let _=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let I of b)e.style.setProperty(I.prop,at(I.from,I.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),I=se(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,I,x,A);return q(K(_,me,ge,f))}}}if(G())return L();let N=0,M=0,z=0,re=false,D=false,W=-1,d=0,P=false,g=NaN,h=()=>w?c==="x"?w.scrollLeft:w.scrollTop:c==="x"?window.scrollX:window.scrollY,X=()=>w?c==="x"?w.clientWidth:w.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Se(){let i=e.getBoundingClientRect(),p,Y;if(w){let Z=w.getBoundingClientRect();p=c==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,Y=c==="x"?i.width:i.height;}else p=c==="x"?i.left:i.top,Y=c==="x"?i.width:i.height;let H=pe({top:p,height:Y},h(),X(),x,A);N=H.tStart,M=H.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,at(p.from,p.to,i));B?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?ye?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||D)return;let i=M===N?0:(h()-N)/(M-N);we(i);let p=q(K(h(),N,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!P?(P=true,S?.()):p<1&&!l&&(P=false),z=requestAnimationFrame(de);}Se();{let i=q(K(h(),N,M,f));l&&i>0&&(W=i),d=i,be(i);}let Ne=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!D?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),ke;function U(){clearTimeout(ke),ke=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Ne.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:N,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Ne.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(ke),$e(e);},replay(){W=-1,P=false,d=0,D=false,be(0);},pause(){D=true,cancelAnimationFrame(z);},resume(){D&&(D=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,D=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r){if(typeof window>"u")return je;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),je;let t=n,{from:u=0,to:o,format:f,easing:l="ease-out",trigger:c={},once:y=true,decimals:$,onComplete:B}=r,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],ye=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(o),B?.(),je;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,C=0,k=false,G=()=>window.scrollY,L=()=>window.innerHeight;function N(){let d=t.getBoundingClientRect(),P=pe({top:d.top,height:d.height},G(),L(),ye,R);te=P.tStart,q=P.tEnd;}function M(d){t.textContent=S(u+(o-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));y&&(b=Math.max(b,d),d=b),C=d,M(d),d>=1&&!k?(k=true,B?.()):d<1&&!y&&(k=false),x=requestAnimationFrame(z);}N();{let d=Q(K(G(),te,q,1));y&&d>0&&(b=d),C=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(P=>{A=P.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),D;function W(){clearTimeout(D),D=setTimeout(N,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(D),$e(t);},replay(){b=-1,k=false,C=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let P=Math.min(1,Math.max(0,d));C=P,b=P,w=true,cancelAnimationFrame(x),M(P);},getProgress(){return C}}}var mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r={}){if(typeof window>"u")return mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),mt;let t=n,{trigger:u={},easing:o="linear",once:f=false,axis:l="y",preload:c="auto",onReady:y,onComplete:$,onProgress:B}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof o=="function"?o:ie[o]??ie.linear,ye=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=r.from??0,te=r.to,q=0,x=0,A=0,w=false,b=false,C=-1,k=0,G=false,L=false,N=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let h=t.getBoundingClientRect(),X=l==="x"?h.left:h.top,Se=l==="x"?h.width:h.height,be=pe({top:X,height:Se},N(),M(),ye,R);q=be.tStart,x=be.tEnd;}function re(h){if(!L)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*h,t.style.setProperty("--scroll-draw-progress",String(h)),B?.(h);}function D(){if(!w||b||!L)return;let h=Q(K(N(),q,x,1));f&&(C=Math.max(C,h),h=C),k=h,re(h),h>=1&&!G?(G=true,$?.()):h<1&&!f&&(G=false),A=requestAnimationFrame(D);}function W(){if(L=true,te===void 0&&(te=t.duration),S){re(1),y?.();return}z(),y?.(),w&&!b&&(A=requestAnimationFrame(D));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),L||z();let d=new IntersectionObserver(h=>{h.forEach(X=>{w=X.isIntersecting,w&&!b&&L?A=requestAnimationFrame(D):cancelAnimationFrame(A);});}),P;function g(){clearTimeout(P),P=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(P),$e(t);},replay(){C=-1,G=false,k=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&L&&(A=requestAnimationFrame(D)));},seek(h){let X=Math.min(1,Math.max(0,h));k=X,C=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return k}}}function gt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function zt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function pt(e){let r=gt(e),n=new Map;for(let o of r){let f=o.offsetTop;n.has(f)||n.set(f,[]),n.get(f).push(o);}let t=[],u=Array.from(n.keys()).sort((o,f)=>o-f);for(let o of u){let f=n.get(o),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of f)l.appendChild(c);t.push(l);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function Vt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,o=r*t,f=o+(1-u);return f<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(f-o)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ht(e,r={}){if(typeof window>"u")return dt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),dt;let t=n,{split:u="words",stagger:o=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:y=true,onComplete:$}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),ye=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=zt(t):u==="lines"?ee=pt(t):ee=gt(t);let te=ee.length;function q(g,h){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*h));let X=qt(h,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((h,X)=>{let Se=S(Vt(g,X,te,o));q(h,Se);});}if(B)return x(1),$?.(),{destroy(){t.innerHTML=R,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,C=false,k=false,G=-1,L=0,N=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),h=pe({top:g.top,height:g.height},M(),z(),Q,ye);A=h.tStart,w=h.tEnd;}function D(){if(!C||k)return;let g=K(M(),A,w,1);y&&(G=Math.max(G,g),g=G),L=g,x(g),g>=1&&!N?(N=true,$?.()):g<1&&!y&&(N=false),b=requestAnimationFrame(D);}re();let W=new IntersectionObserver(g=>{g.forEach(h=>{C=h.isIntersecting,C&&!k?b=requestAnimationFrame(D):cancelAnimationFrame(b);});}),d;function P(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=L;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=pt(t),x(g);}re();},150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),W.observe(t),Pe(t,{type:"text",getProgress:()=>L,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,N=false,L=0,k=false,x(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(D)));},seek(g){let h=Math.min(1,Math.max(0,g));L=h,G=h,k=true,cancelAnimationFrame(b),x(h);},getProgress(){return L}}}var yt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=st(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},bt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ct(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},wt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ut(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},vt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ft(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Et=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ht(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};exports.ScrollAnimateRef=bt;exports.ScrollCounterRef=wt;exports.ScrollDrawRef=yt;exports.ScrollTextRef=Et;exports.ScrollVideoRef=vt;
1
+ 'use strict';function Vt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),o=0,c=[];for(let d=0;d<n;d++){let x=Math.pow(l,d);c.push(x),o+=x;}let u=[0],m=0;for(let d=0;d<n;d++)m+=c[d]/o,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<n;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function qt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-l)*(2*Math.PI)/t)+1}var ee={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:qt()};function pe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function ft(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function pt(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Wt(e,r,n){return Math.min(n,Math.max(r,e))}function Q(e,r,n,t){return n===r?0:Wt((e-r)/(n-r)*t,0,1)}function Qe(e,r,n){let t=e.getBoundingClientRect(),l=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:n==="x"?t.left:t.top,height:l,scroll:n==="x"?window.scrollX:window.scrollY}}function xe(e,r,n,t,l){let o=ft(e.top,e.height,r,t.element)-pt(t.viewport,n),c=ft(e.top,e.height,r,l.element)-pt(l.viewport,n);return {tStart:o,tEnd:c}}function dt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Ve(e,r,n){let t=dt(e),l=dt(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var gt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function he(e,...r){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Bt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ht=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ut(e){let r=[];for(let n=0;n<ht;n++){let t=n/(ht-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Bt;case "ease-out":return Gt;case "ease-in-out":return jt()?Ut(ee["ease-in-out"]):null;default:return null}}var Xt=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?he("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&he("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Zt(e,r,n){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 l(){let o=n==="x"?window.scrollX:window.scrollY,c=e-o,u=r-o,m=n==="x";t.innerHTML=`
2
+ <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}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;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var yt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,bt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Jt(e,r,n){if(!Ze)return;let t=(e.match(bt)??[]).join("").toUpperCase(),l=(r.match(bt)??[]).join("").toUpperCase(),o=(e.match(yt)??[]).length,c=(r.match(yt)??[]).length;if(t!==l){he(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}o!==c&&he(`morphTo: coordinate count differs (${o} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function nt(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let c=parseFloat(o),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function wt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...gt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Me=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:A,strokeWidth:$,fillOpacity:M,waypoints:w,velocityScale:k=false,threshold:I=0,rootMargin:P="0px",repeat:S=0,repeatDelay:re=0,morphTo:O,clip:ne,autoplay:se=false,duration:J=1e3,native:ue=true,onProgress:h,onStart:T,onComplete:g,onEnter:p,onLeave:D,onEnterBack:de,onLeaveBack:ve}=l,me=ne===true?"left":typeof ne=="string"?ne:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),Ne=pe(x.end??"bottom top"),ye=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(A)?A[0]:null,oe=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(M)?M[0]:null,Y=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function $e(s){let a=s*100;switch(me){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=me?[]:Array.from(e.querySelectorAll(c)),C=[],i=[],f=0,we=0,R=false,_=false,V=0,j=false,ae=-1,Pe=-1,K=false,Se=0,ke=0,Oe,Ke=null;function ot(){Ke?.destroy(),Ke=null;}let Fe=new Set,it=NaN,De=true,Be=-1,at=performance.now(),ze=NaN;function et(){return ye?W==="x"?ye.scrollLeft:ye.scrollTop:W==="x"?window.scrollX:window.scrollY}function lt(){return ye?W==="x"?ye.clientWidth:ye.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function ct(){let s=Qe(e,ye,W),a=xe(s,s.scroll,lt(),Le,Ne);f=a.tStart,we=a.tEnd,Me&&Ze&&(ot(),Ke=Zt(f,we,W));}function Ht(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),me){let v=a==="reverse"?1-s:s;e.style.clipPath=$e(v);return}z.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${C[le]*s}`:`${C[le]*(1-s)}`,m&&(v.style.opacity=a==="reverse"?`${1-s}`:`${s}`),be&&oe?v.style.stroke=Ve(be,oe,s):oe&&(v.style.stroke=oe),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*s}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*s}`:Y!==null&&(v.style.fillOpacity=`${Y}`),O&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",nt(i[le],O,s));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}z.forEach((s,a)=>{s.style.strokeDasharray=`${C[a]}`,s.style.strokeDashoffset=L==="reverse"?"0":`${C[a]}`,m?s.style.opacity=L==="reverse"?"1":"0":s.style.opacity="",be&&(s.style.stroke=be),ie!==null&&(s.style.strokeWidth=`${ie}`),fe!==null&&(s.style.fillOpacity=`${fe}`),O&&s.tagName.toLowerCase()==="path"&&i[a]&&s.setAttribute("d",i[a]);});}if(z.forEach(s=>{Qt(s);let a=_e(s);C.push(a);let v=s.tagName.toLowerCase()==="path";v?i.push(s.getAttribute("d")??""):i.push(""),O&&(v?Jt(i[i.length-1],O,s):he(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(s.style.opacity="1"),oe&&(s.style.stroke=oe),G!==null&&(s.style.strokeWidth=`${G}`),Y!==null&&(s.style.fillOpacity=`${Y}`),O&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",O)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?s.style.opacity=L==="reverse"?"1":"0":s.style.opacity="",be&&(s.style.stroke=be),ie!==null&&(s.style.strokeWidth=`${ie}`),fe!==null&&(s.style.fillOpacity=`${fe}`));}),me){if(o)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ut=typeof d=="string"?Je(d):null;function Nt(){return !(ue===false||!Yt()||!z.length||!ut||me||W!=="y"||ye||u!==1||N!==0||te||X||k!==false||O||w||S||B>0||h||T||g||p||D||de||ve||A!=null||$!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function zt(){let s=++Xt,a=`svg-scroll-draw-${s}`,v=`svg-scroll-draw-host-${s}`,le=`--svg-scroll-draw-${s}`,Ie=L==="reverse"?"0":"var(--ssd-len)",Ce=L==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Ie};`,E=`stroke-dashoffset:${Ce};`;m&&(Ae+=`opacity:${L==="reverse"?1:0};`,E+=`opacity:${L==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${a}{from{${Ae}}to{${E}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ut};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(v);function ce(y,U){y.style.setProperty("--ssd-len",String(C[U])),y.style.strokeDasharray=`${C[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(ce);let b=false,H=-1;function q(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},et(),lt(),Le,Ne);return Ee(Q(et(),U,Te,u))}return {destroy(){e.classList.remove(v),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),F.remove();},replay(){b=false,H=-1,z.forEach(ce);},pause(){b=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){b&&(b=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));H=U,b=true,z.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${C[ge]*U}`:`${C[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){z.forEach((y,U)=>{C[U]=_e(y),y.style.setProperty("--ssd-len",String(C[U])),y.style.strokeDasharray=`${C[U]}`;});}}}if(Nt())return zt();function _t(){let s=Math.max(1,J),a=0,v=0,le=false;function Ie(b){let H=true;if(me){let q=Math.min(1,Math.max(0,b/s)),y=Ee(q);Se=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=$e(L==="reverse"?1-y:y),h?.(y),q<1&&(H=false);}else z.forEach((q,y)=>{let U=y*N*s,Te=Math.min(1,Math.max(0,(b-U)/s)),ge=Ee(Te);q.style.strokeDashoffset=L==="reverse"?`${C[y]*ge}`:`${C[y]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&oe?q.style.stroke=Ve(be,oe,ge):oe&&(q.style.stroke=oe),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),O&&q.tagName.toLowerCase()==="path"&&i[y]&&q.setAttribute("d",nt(i[y],O,ge)),y===0&&(Se=ge,h?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(H=false);});if(w){let q=Math.min(1,Math.max(0,b/s)),y=Ee(q);for(let U in w){let Te=parseFloat(U);y>=Te&&!Fe.has(Te)&&(Fe.add(Te),w[U]?.());}}return H}function Ce(b){if(K)return;let H=b-a;_||(_=true,T?.());let q=Ie(H);if(q&&!R){R=true,Ie(s*(1+Math.max(0,z.length-1)*N)),g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Oe=setTimeout(()=>{a=performance.now(),_=false,R=false,Fe.clear(),Ge(),V=requestAnimationFrame(Ce);},re));return}q||(V=requestAnimationFrame(Ce));}function Ae(){cancelAnimationFrame(V),clearTimeout(Oe),a=performance.now(),v=0,K=false,_=false,R=false,ke=0,le=true,Se=0,Fe.clear(),Ge(),V=requestAnimationFrame(Ce);}let E=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&R)?Ae():!H.isIntersecting&&!te&&!R&&(cancelAnimationFrame(V),clearTimeout(Oe),le=false);});},{root:ye??null,threshold:I,rootMargin:P}),F;function ce(){clearTimeout(F),F=setTimeout(()=>{z.forEach((b,H)=>{C[H]=_e(b),b.style.strokeDasharray=`${C[H]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>E.observe(e),B):E.observe(e),{destroy(){cancelAnimationFrame(V),clearTimeout(Oe),E.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(F);},replay(){ke=0,Ae();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(V));},resume(){K&&(K=false,le=true,a=performance.now()-v,V=requestAnimationFrame(Ce));},seek(b){let H=Math.min(1,Math.max(0,b));Se=H,K=true,v=H*s,a=performance.now()-v,cancelAnimationFrame(V),Ie(v);},getProgress(){return Se},refresh(){clearTimeout(F),z.forEach((b,H)=>{C[H]=_e(b),b.style.strokeDasharray=`${C[H]}`;});}}}if(se)return _t();ct();function je(){if(!j||K)return;let s=performance.now(),a=et();if(!De&&k===false&&a===it){V=requestAnimationFrame(je);return}De=false,it=a;let v=u;if(k!==false){let E=s-at,F=E>0?Math.abs(a-(Be<0?a:Be))/E:0;v=u*Math.max(.2,1+F*(typeof k=="number"?k:1)*.04);}Be=a,at=s;let le=X?Pe===-1||a>=Pe?"forward":"reverse":L;Pe=a;let Ie=we-f,Ce=true,Ae=Ie===0?0:(a-f)/Ie;if(isNaN(ze)||(ze<=0&&Ae>0?p?.():ze>0&&Ae<=0&&ve?.(),ze<1&&Ae>=1?D?.():ze>=1&&Ae<1&&de?.()),ze=Ae,me){let E=Ee(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,E),E=ae),Se=E,e.style.setProperty("--scroll-draw-progress",String(E));let F=le==="reverse"?1-E:E;e.style.clipPath=$e(F),h?.(E),!_&&Q(a,f,we,v)>0&&(_=true,T?.()),E>=1&&!R?(R=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Oe=setTimeout(()=>{ae=-1,_=false,R=false,e.style.clipPath=$e(0);},re))):E<1&&!te&&(R=false),V=requestAnimationFrame(je);return}if(z.forEach((E,F)=>{let ce=F*N*Ie,b=Ee(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Se=b,E.style.strokeDashoffset=le==="reverse"?`${C[F]*b}`:`${C[F]*(1-b)}`,m&&(E.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&oe?E.style.stroke=Ve(be,oe,b):oe&&(E.style.stroke=oe),ie!==null&&G!==null?E.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(E.style.strokeWidth=`${G}`),fe!==null&&Y!==null?E.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(E.style.fillOpacity=`${Y}`),O&&E.tagName.toLowerCase()==="path"&&i[F]&&E.setAttribute("d",nt(i[F],O,b)),F===0&&(h?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Ce=false);}),w){let E=Ee(Q(a,f,we,v));for(let F in w){let ce=parseFloat(F);E>=ce&&!Fe.has(ce)&&(Fe.add(ce),w[F]?.());}}!_&&Q(a,f,we,v)>0&&(_=true,T?.()),Ce&&!R?(R=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Oe=setTimeout(()=>{ae=-1,_=false,R=false,Fe.clear(),Ge(),De=true;},re))):!Ce&&!te&&(R=false),V=requestAnimationFrame(je);}let tt=false;function Ue(){tt||(tt=true,V=requestAnimationFrame(function(){je();}));}function Xe(){tt=false,cancelAnimationFrame(V);}let rt=new IntersectionObserver(s=>{s.forEach(a=>{j=a.isIntersecting,j&&!K?(De=true,Ue()):Xe();});},{root:ye??null,threshold:I,rootMargin:P});function mt(){z.forEach((s,a)=>{C[a]=_e(s),s.style.strokeDasharray=`${C[a]}`;}),ct(),De=true;}let Ye;function qe(){clearTimeout(Ye),Ye=setTimeout(mt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),B>0?setTimeout(()=>rt.observe(e),B):rt.observe(e),{destroy(){cancelAnimationFrame(V),clearTimeout(Oe),Xe(),rt.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Ye),ot();},replay(){ae=-1,Pe=-1,Be=-1,_=false,R=false,ke=0,K=false,Se=0,Fe.clear(),clearTimeout(Oe),Ge(),De=true,j&&Ue();},pause(){K=true,Xe();},resume(){K&&(K=false,De=true,j&&Ue());},seek(s){let a=Math.min(1,Math.max(0,s));Se=a,ae=a,K=true,Xe(),Ht(a,L),De=true;},getProgress(){return Se},refresh(){clearTimeout(Ye),mt(),j&&!K&&Ue();}}}var vt=new Map;function Re(e,r){vt.set(e,r);}function He(e){vt.delete(e);}function Kt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Et(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],o=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}r.push({fn:t[1],nums:l,units:o});}return r}function er(e,r,n){let t=Et(e),l=Et(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((o,c)=>{let u=l[c];return o.fn!==u.fn||o.nums.length!==u.nums.length?n<1?`${o.fn}(${o.nums.map((m,d)=>`${m}${o.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,d)=>`${m+(u.nums[d]-m)*n}${o.units[d]}`).join(", ")})`}).join(" ")}function St(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Kt(t))return Ve(t,l,n);if(t.includes("("))return er(t,l,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(o&&c){let u=parseFloat(o[1]),m=parseFloat(c[1]);return `${u+(m-u)*n}${o[2]||c[2]}`}return n<1?t:l}function tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,Tt="--scroll-draw-progress";function sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function xt(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:o="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Me,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:A}=r,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof o=="function"?o:ee[o]??ee["ease-out"],w=pe(l.start??"top bottom"),k=pe(l.end??"bottom top"),I=te??e,P=typeof d=="string"?document.querySelector(d):d??null,S=Object.entries(t).map(([i,f])=>({prop:tr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function re(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function O(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let ne=new Map;for(let i of [...S.map(f=>f.prop),Tt])ne.set(i,e.style.getPropertyValue(i));function se(){for(let[i,f]of ne)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return O(),W?.(),{...n,destroy:se,getProgress:()=>1};re();let J=typeof o=="string"?Je(o):null;function ue(){if(!x||!sr()||!J||m!=="y"||P||I!==e||u||c!==1||Me||W||Z||X||B||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!rr.has(i.prop))return false;return true}function h(){let i=`ssd-a-${++nr}`,f=S.map(j=>`${j.prop}:${j.from}`).join(";"),we=S.map(j=>`${j.prop}:${j.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,V=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",se();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Pe of S)e.style.setProperty(Pe.prop,St(Pe.from,Pe.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=_(),Pe=V(),{tStart:K,tEnd:Se}=xe({top:j.top,height:j.height},ae,Pe,w,k);return M(Q(ae,K,Se,c))}}}if(ue())return h();let T=0,g=0,p=0,D=false,de=false,ve=-1,me=0,Ee=false,Le=NaN,Ne=-1,ye=0,be=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,oe=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Qe(I,P,m),f=xe(i,i.scroll,oe(),w,k);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Tt,String(i));for(let f of S)e.style.setProperty(f.prop,St(f.from,f.to,i));Me?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&A?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!D||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let V=i-ye,j=V>0?Math.abs(f-(Ne<0?f:Ne))/V:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}Ne=f,ye=i;let R=g===T?0:(f-T)/(g-T);fe(R);let _=M(Q(f,T,g,we));u&&(ve=Math.max(ve,_),_=ve),me=_,G(_),_>=1&&!Ee?(Ee=true,W?.()):_<1&&!u&&(Ee=false),p=requestAnimationFrame(Y);}ie(),g===T&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=M(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{D=f.isIntersecting,D&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:P??null}),z;function C(){clearTimeout(z),z=setTimeout(ie,150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),$e.observe(e),Re(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(z),se(),He(e);},replay(){ve=-1,Ee=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,D&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function At(e,r){if(typeof window>"u")return st;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return he("scrollCounter: element not found:",e),st;let t=n,{from:l=0,to:o,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?h=>h.toFixed(x):c??(h=>String(Math.round(h))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Me=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(o),N?.(),st;let X=0,B=0,A=0,$=false,M=false,w=-1,k=0,I=false,P=()=>window.scrollY,S=()=>window.innerHeight;function re(){let h=t.getBoundingClientRect(),T=xe({top:h.top,height:h.height},P(),S(),Me,W);X=T.tStart,B=T.tEnd;}function O(h){t.textContent=L(l+(o-l)*h),t.style.setProperty("--scroll-draw-progress",String(h));}function ne(){if(!$||M)return;let h=te(Q(P(),X,B,1));d&&(w=Math.max(w,h),h=w),k=h,O(h),h>=1&&!I?(I=true,N?.()):h<1&&!d&&(I=false),A=requestAnimationFrame(ne);}re();{let h=te(Q(P(),X,B,1));d&&h>0&&(w=h),k=h,O(h);}let se=new IntersectionObserver(h=>{h.forEach(T=>{$=T.isIntersecting,$&&!M?A=requestAnimationFrame(ne):cancelAnimationFrame(A);});}),J;function ue(){clearTimeout(J),J=setTimeout(re,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),se.observe(t),Re(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(A),se.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),He(t);},replay(){w=-1,I=false,k=0,M=false,O(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,$&&(A=requestAnimationFrame(ne)));},seek(h){let T=Math.min(1,Math.max(0,h));k=T,w=T,M=true,cancelAnimationFrame(A),O(T);},getProgress(){return k}}}var Mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,r={}){if(typeof window>"u")return Mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Mt;let t=n,{trigger:l={},easing:o="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof o=="function"?o:ee[o]??ee.linear,Me=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,B=0,A=0,$=0,M=false,w=false,k=-1,I=0,P=false,S=false,re=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;function ne(){let p=t.getBoundingClientRect(),D=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:D,height:de},re(),O(),Me,W);B=ve.tStart,A=ve.tEnd;}function se(p){if(!S)return;let D=X??t.duration??0;t.currentTime=Z+(D-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!M||w||!S)return;let p=te(Q(re(),B,A,1));c&&(k=Math.max(k,p),p=k),I=p,se(p),p>=1&&!P?(P=true,x?.()):p<1&&!c&&(P=false),$=requestAnimationFrame(J);}function ue(){if(S=true,X===void 0&&(X=t.duration),L){se(1),d?.();return}ne(),d?.(),M&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),S||ne();let h=new IntersectionObserver(p=>{p.forEach(D=>{M=D.isIntersecting,M&&!w&&S?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(ne,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),h.observe(t),Re(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:B,tEnd:A})}),{destroy(){cancelAnimationFrame($),h.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),He(t);},replay(){k=-1,P=false,I=0,w=false,se(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,M&&S&&($=requestAnimationFrame(J)));},seek(p){let D=Math.min(1,Math.max(0,p));I=D,k=D,w=true,cancelAnimationFrame($),se(D);},getProgress(){return I}}}function Ct(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function or(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function $t(e){let r=Ct(e),n=new Map;for(let o of r){let c=o.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(o);}let t=[],l=Array.from(n.keys()).sort((o,c)=>o-c);for(let o of l){let c=n.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((o,c)=>{e.appendChild(o),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ir(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,o=r*t,c=o+(1-l);return c<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(c-o)))}function ar(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kt(e,r={}){if(typeof window>"u")return Pt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return he("scrollText: element not found:",e),Pt;let t=n,{split:l="words",stagger:o=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Me=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=or(t):l==="lines"?Z=$t(t):Z=Ct(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let D=ar(p,u);D&&(g.style.transform=D);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,D)=>{let de=L(ir(g,D,X,o));B(p,de);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,M=0,w=0,k=false,I=false,P=-1,S=0,re=false,O=()=>window.scrollY,ne=()=>window.innerHeight;function se(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},O(),ne(),te,Me);$=p.tStart,M=p.tEnd;}function J(){if(!k||I)return;let g=Q(O(),$,M,1);d&&(P=Math.max(P,g),g=P),S=g,A(g),g>=1&&!re?(re=true,x?.()):g<1&&!d&&(re=false),w=requestAnimationFrame(J);}se();let ue=new IntersectionObserver(g=>{g.forEach(p=>{k=p.isIntersecting,k&&!I?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),h;function T(){clearTimeout(h),h=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=$t(t),A(g);}se();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Re(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(h),t.innerHTML=W,t.removeAttribute("aria-label"),He(t);},replay(){P=-1,re=false,S=0,I=false,A(0);},pause(){I=true,cancelAnimationFrame(w);},resume(){I&&(I=false,k&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));S=p,P=p,I=true,cancelAnimationFrame(w),A(p);},getProgress(){return S}}}var It=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=wt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Ot=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=xt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Ft=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=At(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Dt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Lt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Rt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=kt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};exports.ScrollAnimateRef=Ot;exports.ScrollCounterRef=Ft;exports.ScrollDrawRef=It;exports.ScrollTextRef=Rt;exports.ScrollVideoRef=Dt;
@@ -125,6 +125,21 @@ interface ScrollDrawInstance {
125
125
  seek: (progress: number) => void;
126
126
  /** Returns current draw progress (0–1). */
127
127
  getProgress: () => number;
128
+ /**
129
+ * Re-measure after a layout change: path lengths, and the scroll trigger window.
130
+ *
131
+ * The engine already re-measures on `resize`, on `orientationchange`, and via a
132
+ * `ResizeObserver` on the document element — but none of those fire for a layout
133
+ * change that leaves the document height alone, such as a tab switching, a
134
+ * sibling collapsing, or a font swapping inside a fixed-height box. Call this
135
+ * after one of those.
136
+ *
137
+ * Optional on this shared type because several instances here are fan-outs over
138
+ * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
139
+ * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
140
+ * use `instance.refresh?.()` if you hold an instance of unknown origin.
141
+ */
142
+ refresh?: () => void;
128
143
  }
129
144
 
130
145
  interface ScrollAnimateOptions {
@@ -136,6 +151,39 @@ interface ScrollAnimateOptions {
136
151
  axis?: 'x' | 'y';
137
152
  scrollContainer?: string | Element;
138
153
  native?: boolean;
154
+ /**
155
+ * Scale animation speed by scroll velocity — faster scrolling = faster animation.
156
+ * Pass `true` for default sensitivity (1) or a number to control it.
157
+ * Higher values = more dramatic speed-up. Default sensitivity: 1.
158
+ */
159
+ velocityScale?: boolean | number;
160
+ /**
161
+ * Honour `prefers-reduced-motion: reduce` by applying the final state and not
162
+ * animating. Default: `true`.
163
+ *
164
+ * Set to `false` only when the movement is *scroll-linked scrubbing* rather
165
+ * than autonomous motion — it advances solely as the user scrolls, 1:1 with
166
+ * their input, so it is direct manipulation rather than something that plays at
167
+ * them. `scrollHorizontal` sets this, because jumping to the final state there
168
+ * would leave every panel but the last unreachable inside the sticky
169
+ * `overflow: hidden` container.
170
+ */
171
+ respectReducedMotion?: boolean;
172
+ /**
173
+ * Element whose geometry defines the trigger window, when that is not the
174
+ * element being animated. Defaults to the animated element.
175
+ *
176
+ * Needed whenever the animated element cannot supply the scroll length itself —
177
+ * the case that matters is a `position: sticky` stage, where the pinned element
178
+ * is exactly one viewport tall and all of the scroll room belongs to its
179
+ * container. Resolving `top top` → `bottom bottom` against the pinned element
180
+ * there yields tStart === tEnd, a zero-length window, and no movement at all.
181
+ *
182
+ * Setting this disables the native CSS fast path: `animation-timeline: view()`
183
+ * always measures the element the animation is attached to, so it cannot express
184
+ * a separate subject.
185
+ */
186
+ triggerElement?: Element;
139
187
  onProgress?: (alpha: number) => void;
140
188
  onComplete?: () => void;
141
189
  /** Fires when scroll enters the trigger zone (scrolling forward). */
@@ -125,6 +125,21 @@ interface ScrollDrawInstance {
125
125
  seek: (progress: number) => void;
126
126
  /** Returns current draw progress (0–1). */
127
127
  getProgress: () => number;
128
+ /**
129
+ * Re-measure after a layout change: path lengths, and the scroll trigger window.
130
+ *
131
+ * The engine already re-measures on `resize`, on `orientationchange`, and via a
132
+ * `ResizeObserver` on the document element — but none of those fire for a layout
133
+ * change that leaves the document height alone, such as a tab switching, a
134
+ * sibling collapsing, or a font swapping inside a fixed-height box. Call this
135
+ * after one of those.
136
+ *
137
+ * Optional on this shared type because several instances here are fan-outs over
138
+ * other instances or SSR no-op stubs. `scrollDraw`, `scrollPin`,
139
+ * `scrollHorizontal`, `scrollDrawTimeline` and the group APIs all provide it;
140
+ * use `instance.refresh?.()` if you hold an instance of unknown origin.
141
+ */
142
+ refresh?: () => void;
128
143
  }
129
144
 
130
145
  interface ScrollAnimateOptions {
@@ -136,6 +151,39 @@ interface ScrollAnimateOptions {
136
151
  axis?: 'x' | 'y';
137
152
  scrollContainer?: string | Element;
138
153
  native?: boolean;
154
+ /**
155
+ * Scale animation speed by scroll velocity — faster scrolling = faster animation.
156
+ * Pass `true` for default sensitivity (1) or a number to control it.
157
+ * Higher values = more dramatic speed-up. Default sensitivity: 1.
158
+ */
159
+ velocityScale?: boolean | number;
160
+ /**
161
+ * Honour `prefers-reduced-motion: reduce` by applying the final state and not
162
+ * animating. Default: `true`.
163
+ *
164
+ * Set to `false` only when the movement is *scroll-linked scrubbing* rather
165
+ * than autonomous motion — it advances solely as the user scrolls, 1:1 with
166
+ * their input, so it is direct manipulation rather than something that plays at
167
+ * them. `scrollHorizontal` sets this, because jumping to the final state there
168
+ * would leave every panel but the last unreachable inside the sticky
169
+ * `overflow: hidden` container.
170
+ */
171
+ respectReducedMotion?: boolean;
172
+ /**
173
+ * Element whose geometry defines the trigger window, when that is not the
174
+ * element being animated. Defaults to the animated element.
175
+ *
176
+ * Needed whenever the animated element cannot supply the scroll length itself —
177
+ * the case that matters is a `position: sticky` stage, where the pinned element
178
+ * is exactly one viewport tall and all of the scroll room belongs to its
179
+ * container. Resolving `top top` → `bottom bottom` against the pinned element
180
+ * there yields tStart === tEnd, a zero-length window, and no movement at all.
181
+ *
182
+ * Setting this disables the native CSS fast path: `animation-timeline: view()`
183
+ * always measures the element the animation is attached to, so it cannot express
184
+ * a separate subject.
185
+ */
186
+ triggerElement?: Element;
139
187
  onProgress?: (alpha: number) => void;
140
188
  onComplete?: () => void;
141
189
  /** Fires when scroll enters the trigger zone (scrolling forward). */
@@ -1,3 +1,3 @@
1
- function Mt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),u=Math.sqrt(t),o=0,f=[];for(let y=0;y<n;y++){let $=Math.pow(u,y);f.push($),o+=$;}let l=[0],c=0;for(let y=0;y<n;y++)c+=f[y]/o,l.push(c);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let $=0;$<n;$++)if(y<=l[$+1]){let B=(y-l[$])/(l[$+1]-l[$]);if($===0)return B*(2-B);let S=1-Math.pow(t,$);return S+(1-S)*(2*B-1)*(2*B-1)}return 1}}function Pt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),u=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-u)*(2*Math.PI)/t)+1}var ie={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:Mt(),elastic:Pt()};function ae(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Ke(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function Qe(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function $t(e,r,n){return Math.min(n,Math.max(r,e))}function K(e,r,n,t){return n===r?0:$t((e-r)/(n-r)*t,0,1)}function pe(e,r,n,t,u){let o=Ke(e.top,e.height,r,t.element)-Qe(t.viewport,n),f=Ke(e.top,e.height,r,u.element)-Qe(u.viewport,n);return {tStart:o,tEnd:f}}function et(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Fe(e,r,n){let t=et(e),u=et(r);return !t||!u?e:`rgb(${Math.round(t[0]+(u[0]-t[0])*n)},${Math.round(t[1]+(u[1]-t[1])*n)},${Math.round(t[2]+(u[2]-t[2])*n)})`}var tt={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 rt(e,r){process.env.NODE_ENV!=="production"&&console.warn(`[svg-scroll-draw] ${e}`,r);}var nt={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 kt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?rt("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&rt("Element has a fill \u2014 it may obscure the stroke animation.",e);}function It(e,r,n){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 u(){let o=n==="x"?window.scrollX:window.scrollY,f=e-o,l=r-o,c=n==="x";t.innerHTML=`
2
- <div style="position:absolute;${c?`left:${f}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${f}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:${l}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${l}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",u,{passive:true}),u(),t}function Ye(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),u=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let f=parseFloat(o),l=t[u++]??f;return String(+(f+(l-f)*n).toFixed(4))})}function st(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,u=n?{...tt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:f="path, polyline, line, polygon, rect, circle",speed:l=1,fade:c=false,easing:y="linear",trigger:$={},stagger:B=0,direction:S="forward",once:Q=false,debug:ye=false,axis:R="y",scrollContainer:ee,autoReverse:te=false,delay:q=0,strokeColor:x,strokeWidth:A,fillOpacity:w,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:G="0px",repeat:L=0,repeatDelay:N=0,morphTo:M,clip:z,autoplay:re=false,duration:D=1e3,native:W=true,onProgress:d,onStart:P,onComplete:g,onEnter:h,onLeave:X,onEnterBack:Se,onLeaveBack:be}=u,we=z===true?"left":typeof z=="string"?z:false,de=typeof y=="function"?y:ie[y]??ie.linear,Ne=ae($.start??"top bottom"),ke=ae($.end??"bottom top"),U=typeof ee=="string"?document.querySelector(ee):ee??null,i=Array.isArray(x)?x[0]:null,p=Array.isArray(x)?x[1]:typeof x=="string"?x:null,Y=Array.isArray(A)?A[0]:null,H=Array.isArray(A)?A[1]:typeof A=="number"?A:null,Z=Array.isArray(w)?w[0]:null,se=Array.isArray(w)?w[1]:typeof w=="number"?w:null;function J(s){let a=s*100;switch(we){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let _=we?[]:Array.from(e.querySelectorAll(f)),I=[],me=[],ge=0,Te=0,oe=false,he=false,ne=0,He=false,ve=-1,Re=-1,le=false,Le=0,xe=0,Ae,Be=null,Me=new Set,ze=-1,Ue=performance.now(),Ie=NaN;function De(){return U?R==="x"?U.scrollLeft:U.scrollTop:R==="x"?window.scrollX:window.scrollY}function Ze(){return U?R==="x"?U.clientWidth:U.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Je(){let s=e.getBoundingClientRect(),a,E,j;if(U){let ue=U.getBoundingClientRect();a=R==="x"?s.left-ue.left+U.scrollLeft:s.top-ue.top+U.scrollTop,E=R==="x"?s.width:s.height,j=De();}else a=R==="x"?s.left:s.top,E=R==="x"?s.width:s.height,j=De();let ce=pe({top:a,height:E},j,Ze(),Ne,ke);ge=ce.tStart,Te=ce.tEnd,ye&&process.env.NODE_ENV!=="production"&&(Be?.remove(),Be=It(ge,Te,R));}function St(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),we){let E=a==="reverse"?1-s:s;e.style.clipPath=J(E);return}_.forEach((E,j)=>{E.style.strokeDashoffset=a==="reverse"?`${I[j]*s}`:`${I[j]*(1-s)}`,c&&(E.style.opacity=a==="reverse"?`${1-s}`:`${s}`),i&&p?E.style.stroke=Fe(i,p,s):p&&(E.style.stroke=p),Y!==null&&H!==null?E.style.strokeWidth=`${Y+(H-Y)*s}`:H!==null&&(E.style.strokeWidth=`${H}`),Z!==null&&se!==null?E.style.fillOpacity=`${Z+(se-Z)*s}`:se!==null&&(E.style.fillOpacity=`${se}`),M&&E.tagName.toLowerCase()==="path"&&me[j]&&E.setAttribute("d",Ye(me[j],M,s));});}function Ve(){if(e.style.setProperty("--scroll-draw-progress","0"),we){e.style.clipPath=J(0);return}_.forEach((s,a)=>{s.style.strokeDasharray=`${I[a]}`,s.style.strokeDashoffset=S==="reverse"?"0":`${I[a]}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`),M&&s.tagName.toLowerCase()==="path"&&me[a]&&s.setAttribute("d",me[a]);});}if(_.forEach(s=>{kt(s);let a=_e(s);I.push(a),s.tagName.toLowerCase()==="path"?me.push(s.getAttribute("d")??""):me.push(""),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?`${a}`:"0",c&&(s.style.opacity="1"),p&&(s.style.stroke=p),H!==null&&(s.style.strokeWidth=`${H}`),se!==null&&(s.style.fillOpacity=`${se}`),M&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",M)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=S==="reverse"?"0":`${a}`,c?s.style.opacity=S==="reverse"?"1":"0":s.style.opacity="",i&&(s.style.stroke=i),Y!==null&&(s.style.strokeWidth=`${Y}`),Z!==null&&(s.style.fillOpacity=`${Z}`));}),we){if(o)return e.style.clipPath=J(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=J(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};function xt(){return !(W===false||!Ct()||!_.length||typeof y!="string"||!(y in nt)||we||R!=="y"||U||l!==1||B!==0||Q||te||C!==false||M||b||L||q>0||d||P||g||h||X||Se||be||x!=null||A!=null||w!=null||($.start??"top bottom").trim()!=="top bottom"||($.end??"bottom top").trim()!=="bottom top")}function Tt(){let s=`svg-scroll-draw-${++Lt}`,a=S==="reverse"?"0":"var(--ssd-len)",E=S==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${a};`,ce=`stroke-dashoffset:${E};`;c&&(j+=`opacity:${S==="reverse"?1:0};`,ce+=`opacity:${S==="reverse"?0:1};`);let ue=document.createElement("style");ue.setAttribute("data-svg-scroll-draw",""),ue.textContent=`@keyframes ${s}{from{${j}}to{${ce}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${nt[y]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(ue);function fe(m,T){m.style.setProperty("--ssd-len",String(I[T])),m.style.strokeDasharray=`${I[T]}`,m.style.strokeDashoffset="",m.style.opacity="",m.style.animationPlayState="",m.classList.add(s);}_.forEach(fe);let v=false,O=-1;function F(){if(O>=0)return O;let m=e.getBoundingClientRect(),{tStart:T,tEnd:V}=pe({top:m.top,height:m.height},De(),Ze(),Ne,ke);return de(K(De(),T,V,l))}return {destroy(){_.forEach(m=>{m.classList.remove(s),m.style.removeProperty("--ssd-len"),m.style.animationPlayState="";}),ue.remove();},replay(){v=false,O=-1,_.forEach(fe);},pause(){v=true,_.forEach(m=>{m.style.animationPlayState="paused";});},resume(){v&&(v=false,_.forEach(m=>{m.style.animationPlayState="running";}));},seek(m){let T=Math.min(1,Math.max(0,m));O=T,v=true,_.forEach((V,Ce)=>{V.classList.remove(s),V.style.strokeDashoffset=S==="reverse"?`${I[Ce]*T}`:`${I[Ce]*(1-T)}`,c&&(V.style.opacity=S==="reverse"?`${1-T}`:`${T}`);});},getProgress(){return F()}}}if(xt())return Tt();function At(){let s=Math.max(1,D),a=0,E=0;function j(F){let m=true;if(we){let T=Math.min(1,Math.max(0,F/s)),V=de(T);Le=V,e.style.setProperty("--scroll-draw-progress",String(V)),e.style.clipPath=J(S==="reverse"?1-V:V),d?.(V),T<1&&(m=false);}else _.forEach((T,V)=>{let Ce=V*B*s,Oe=Math.min(1,Math.max(0,(F-Ce)/s)),Ee=de(Oe);T.style.strokeDashoffset=S==="reverse"?`${I[V]*Ee}`:`${I[V]*(1-Ee)}`,c&&(T.style.opacity=S==="reverse"?`${1-Ee}`:`${Ee}`),i&&p?T.style.stroke=Fe(i,p,Ee):p&&(T.style.stroke=p),Y!==null&&H!==null?T.style.strokeWidth=`${Y+(H-Y)*Ee}`:H!==null&&(T.style.strokeWidth=`${H}`),Z!==null&&se!==null?T.style.fillOpacity=`${Z+(se-Z)*Ee}`:se!==null&&(T.style.fillOpacity=`${se}`),M&&T.tagName.toLowerCase()==="path"&&me[V]&&T.setAttribute("d",Ye(me[V],M,Ee)),V===0&&(d?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Oe<1&&(m=false);});if(b){let T=Math.min(1,Math.max(0,F/s)),V=de(T);for(let Ce in b){let Oe=parseFloat(Ce);V>=Oe&&!Me.has(Oe)&&(Me.add(Oe),b[Ce]?.());}}return m}function ce(F){if(le)return;let m=F-a;he||(he=true,P?.());let T=j(m);if(T&&!oe){oe=true,j(s*(1+Math.max(0,_.length-1)*B)),g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{a=performance.now(),he=false,oe=false,Me.clear(),Ve(),ne=requestAnimationFrame(ce);},N));return}T||(ne=requestAnimationFrame(ce));}function ue(){cancelAnimationFrame(ne),clearTimeout(Ae),a=performance.now(),E=0,le=false,he=false,oe=false,xe=0,Me.clear(),Ve(),ne=requestAnimationFrame(ce);}let fe=new IntersectionObserver(F=>{F.forEach(m=>{m.isIntersecting&&!(Q&&oe)?ue():!m.isIntersecting&&!Q&&!oe&&(cancelAnimationFrame(ne),clearTimeout(Ae),a=null);});},{root:U??null,threshold:k,rootMargin:G}),v;function O(){clearTimeout(v),v=setTimeout(()=>{_.forEach((F,m)=>{I[m]=_e(F),F.style.strokeDasharray=`${I[m]}`;});},150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),q>0?setTimeout(()=>fe.observe(e),q):fe.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),fe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(v);},replay(){xe=0,ue();},pause(){le||(le=true,E=performance.now()-a,cancelAnimationFrame(ne));},resume(){le&&(le=false,a=performance.now()-E,ne=requestAnimationFrame(ce));},seek(F){let m=Math.min(1,Math.max(0,F));Le=m,le=true,E=m*s,a=performance.now()-E,cancelAnimationFrame(ne),j(E);},getProgress(){return Le}}}if(re)return At();Je();function qe(){if(!He||le)return;let s=performance.now(),a=De(),E=l;if(C!==false){let v=s-Ue,O=v>0?Math.abs(a-(ze<0?a:ze))/v:0;E=l*Math.max(.2,1+O*(typeof C=="number"?C:1)*.04);}ze=a,Ue=s;let j=te?Re===-1||a>=Re?"forward":"reverse":S;Re=a;let ce=Te-ge,ue=true,fe=ce===0?0:(a-ge)/ce;if(isNaN(Ie)||(Ie<=0&&fe>0?h?.():Ie>0&&fe<=0&&be?.(),Ie<1&&fe>=1?X?.():Ie>=1&&fe<1&&Se?.()),Ie=fe,we){let v=de(K(a,ge,Te,E));Q&&!te&&(ve=Math.max(ve,v),v=ve),Le=v,e.style.setProperty("--scroll-draw-progress",String(v));let O=j==="reverse"?1-v:v;e.style.clipPath=J(O),d?.(v),!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),v>=1&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,e.style.clipPath=J(0);},N))):v<1&&!Q&&(oe=false),ne=requestAnimationFrame(qe);return}if(_.forEach((v,O)=>{let F=O*B*ce,m=de(K(a,ge+F,Te+F,E));Q&&!te&&(ve=Math.max(ve,m),m=ve),Le=m,v.style.strokeDashoffset=j==="reverse"?`${I[O]*m}`:`${I[O]*(1-m)}`,c&&(v.style.opacity=j==="reverse"?`${1-m}`:`${m}`),i&&p?v.style.stroke=Fe(i,p,m):p&&(v.style.stroke=p),Y!==null&&H!==null?v.style.strokeWidth=`${Y+(H-Y)*m}`:H!==null&&(v.style.strokeWidth=`${H}`),Z!==null&&se!==null?v.style.fillOpacity=`${Z+(se-Z)*m}`:se!==null&&(v.style.fillOpacity=`${se}`),M&&v.tagName.toLowerCase()==="path"&&me[O]&&v.setAttribute("d",Ye(me[O],M,m)),O===0&&(d?.(m),e.style.setProperty("--scroll-draw-progress",String(m))),m<1&&(ue=false);}),b){let v=de(K(a,ge,Te,E));for(let O in b){let F=parseFloat(O);v>=F&&!Me.has(F)&&(Me.add(F),b[O]?.());}}!he&&K(a,ge,Te,E)>0&&(he=true,P?.()),ue&&!oe?(oe=true,g?.(),xe<(L==="infinite"?1/0:L??0)&&(xe++,Ae=setTimeout(()=>{ve=-1,he=false,oe=false,Me.clear(),Ve();},N))):!ue&&!Q&&(oe=false),ne=requestAnimationFrame(qe);}let Ge=new IntersectionObserver(s=>{s.forEach(a=>{He=a.isIntersecting,He&&!le?ne=requestAnimationFrame(qe):cancelAnimationFrame(ne);});},{root:U??null,threshold:k,rootMargin:G}),Xe;function We(){clearTimeout(Xe),Xe=setTimeout(()=>{_.forEach((s,a)=>{I[a]=_e(s),s.style.strokeDasharray=`${I[a]}`;}),Je();},150);}return window.addEventListener("resize",We),window.addEventListener("orientationchange",We),q>0?setTimeout(()=>Ge.observe(e),q):Ge.observe(e),{destroy(){cancelAnimationFrame(ne),clearTimeout(Ae),Ge.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Xe),Be?.remove();},replay(){ve=-1,Re=-1,ze=-1,he=false,oe=false,xe=0,le=false,Me.clear(),clearTimeout(Ae),Ve();},pause(){le=true,cancelAnimationFrame(ne);},resume(){le&&(le=false,He&&(ne=requestAnimationFrame(qe)));},seek(s){let a=Math.min(1,Math.max(0,s));Le=a,ve=a,le=true,cancelAnimationFrame(ne),St(a,S);},getProgress(){return Le}}}var ot=new Map;function Pe(e,r){ot.set(e,r);}function $e(e){ot.delete(e);}function Ot(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function it(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let u=[],o=[],f=t[2].trim();if(f)for(let l of f.split(/[\s,]+/)){let c=l.match(/^([-+]?[\d.eE]+)(.*)$/);u.push(c?parseFloat(c[1]):0),o.push(c?c[2]:"");}r.push({fn:t[1],nums:u,units:o});}return r}function Ft(e,r,n){let t=it(e),u=it(r);return t.length===0||t.length!==u.length?n<1?e:r:t.map((o,f)=>{let l=u[f];return o.fn!==l.fn||o.nums.length!==l.nums.length?n<1?`${o.fn}(${o.nums.map((c,y)=>`${c}${o.units[y]}`).join(", ")})`:`${l.fn}(${l.nums.map((c,y)=>`${c}${l.units[y]}`).join(", ")})`:`${o.fn}(${o.nums.map((c,y)=>`${c+(l.nums[y]-c)*n}${o.units[y]}`).join(", ")})`}).join(" ")}function at(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),u=String(r);if(Ot(t))return Fe(t,u,n);if(t.includes("("))return Ft(t,u,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),f=u.match(/^([-+]?[\d.]+)(.*)$/);if(o&&f){let l=parseFloat(o[1]),c=parseFloat(f[1]);return `${l+(c-l)*n}${o[2]||f[2]}`}return n<1?t:u}function Nt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var lt={linear:"linear","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out"},Dt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ht=0;function Rt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ct(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:u={},easing:o="ease-out",speed:f=1,once:l=false,axis:c="y",scrollContainer:y,native:$=true,onProgress:B,onComplete:S,onEnter:Q,onLeave:ye,onEnterBack:R,onLeaveBack:ee}=r,te=window.matchMedia("(prefers-reduced-motion: reduce)").matches,q=typeof o=="function"?o:ie[o]??ie["ease-out"],x=ae(u.start??"top bottom"),A=ae(u.end??"bottom top"),w=typeof y=="string"?document.querySelector(y):y??null,b=Object.entries(t).map(([i,p])=>({prop:Nt(i),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function C(){let i=window.getComputedStyle(e);for(let p of b)p.from===""&&(p.from=i.getPropertyValue(p.prop).trim()||"0");}function k(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}if(te)return k(),S?.(),n;C();function G(){if(!$||!Rt()||typeof o!="string"||!(o in lt)||c!=="y"||w||l||f!==1||B||S||Q||ye||R||ee||(u.start??"top bottom").trim()!=="top bottom"||(u.end??"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!Dt.has(i.prop))return false;return true}function L(){let i=`ssd-a-${++Ht}`,p=b.map(J=>`${J.prop}:${J.from}`).join(";"),Y=b.map(J=>`${J.prop}:${J.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${p}}to{${Y}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${lt[o]};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let Z=()=>c==="x"?window.scrollX:window.scrollY,se=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),H.remove();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let _=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let I of b)e.style.setProperty(I.prop,at(I.from,I.to,_));},getProgress(){let J=e.getBoundingClientRect(),_=Z(),I=se(),{tStart:me,tEnd:ge}=pe({top:J.top,height:J.height},_,I,x,A);return q(K(_,me,ge,f))}}}if(G())return L();let N=0,M=0,z=0,re=false,D=false,W=-1,d=0,P=false,g=NaN,h=()=>w?c==="x"?w.scrollLeft:w.scrollTop:c==="x"?window.scrollX:window.scrollY,X=()=>w?c==="x"?w.clientWidth:w.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function Se(){let i=e.getBoundingClientRect(),p,Y;if(w){let Z=w.getBoundingClientRect();p=c==="x"?i.left-Z.left+w.scrollLeft:i.top-Z.top+w.scrollTop,Y=c==="x"?i.width:i.height;}else p=c==="x"?i.left:i.top,Y=c==="x"?i.width:i.height;let H=pe({top:p,height:Y},h(),X(),x,A);N=H.tStart,M=H.tEnd;}function be(i){e.style.setProperty("--scroll-draw-progress",String(i));for(let p of b)e.style.setProperty(p.prop,at(p.from,p.to,i));B?.(i);}function we(i){if(isNaN(g)){g=i;return}g<=0&&i>0?Q?.():g>0&&i<=0&&ee?.(),g<1&&i>=1?ye?.():g>=1&&i<1&&R?.(),g=i;}function de(){if(!re||D)return;let i=M===N?0:(h()-N)/(M-N);we(i);let p=q(K(h(),N,M,f));l&&(W=Math.max(W,p),p=W),d=p,be(p),p>=1&&!P?(P=true,S?.()):p<1&&!l&&(P=false),z=requestAnimationFrame(de);}Se();{let i=q(K(h(),N,M,f));l&&i>0&&(W=i),d=i,be(i);}let Ne=new IntersectionObserver(i=>{i.forEach(p=>{re=p.isIntersecting,re&&!D?z=requestAnimationFrame(de):cancelAnimationFrame(z);});},{root:w??null}),ke;function U(){clearTimeout(ke),ke=setTimeout(Se,150);}return window.addEventListener("resize",U),window.addEventListener("orientationchange",U),Ne.observe(e),Pe(e,{type:"animate",getProgress:()=>d,getTrigger:()=>({tStart:N,tEnd:M})}),{destroy(){cancelAnimationFrame(z),Ne.disconnect(),window.removeEventListener("resize",U),window.removeEventListener("orientationchange",U),clearTimeout(ke),$e(e);},replay(){W=-1,P=false,d=0,D=false,be(0);},pause(){D=true,cancelAnimationFrame(z);},resume(){D&&(D=false,re&&(z=requestAnimationFrame(de)));},seek(i){let p=Math.min(1,Math.max(0,i));d=p,W=p,D=true,cancelAnimationFrame(z),be(p);},getProgress(){return d}}}var je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r){if(typeof window>"u")return je;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollCounter: element not found:",e),je;let t=n,{from:u=0,to:o,format:f,easing:l="ease-out",trigger:c={},once:y=true,decimals:$,onComplete:B}=r,S=$!==void 0?d=>d.toFixed($):f??(d=>String(Math.round(d))),Q=typeof l=="function"?l:ie[l]??ie["ease-out"],ye=ae(c.start??"top 80%"),R=ae(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=S(o),B?.(),je;t.textContent=S(u);let te=0,q=0,x=0,A=false,w=false,b=-1,C=0,k=false,G=()=>window.scrollY,L=()=>window.innerHeight;function N(){let d=t.getBoundingClientRect(),P=pe({top:d.top,height:d.height},G(),L(),ye,R);te=P.tStart,q=P.tEnd;}function M(d){t.textContent=S(u+(o-u)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function z(){if(!A||w)return;let d=Q(K(G(),te,q,1));y&&(b=Math.max(b,d),d=b),C=d,M(d),d>=1&&!k?(k=true,B?.()):d<1&&!y&&(k=false),x=requestAnimationFrame(z);}N();{let d=Q(K(G(),te,q,1));y&&d>0&&(b=d),C=d,M(d);}let re=new IntersectionObserver(d=>{d.forEach(P=>{A=P.isIntersecting,A&&!w?x=requestAnimationFrame(z):cancelAnimationFrame(x);});}),D;function W(){clearTimeout(D),D=setTimeout(N,150);}return window.addEventListener("resize",W),window.addEventListener("orientationchange",W),re.observe(t),Pe(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:te,tEnd:q})}),{destroy(){cancelAnimationFrame(x),re.disconnect(),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),clearTimeout(D),$e(t);},replay(){b=-1,k=false,C=0,w=false,M(0);},pause(){w=true,cancelAnimationFrame(x);},resume(){w&&(w=false,A&&(x=requestAnimationFrame(z)));},seek(d){let P=Math.min(1,Math.max(0,d));C=P,b=P,w=true,cancelAnimationFrame(x),M(P);},getProgress(){return C}}}var mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r={}){if(typeof window>"u")return mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollVideo: <video> element not found:",e),mt;let t=n,{trigger:u={},easing:o="linear",once:f=false,axis:l="y",preload:c="auto",onReady:y,onComplete:$,onProgress:B}=r,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Q=typeof o=="function"?o:ie[o]??ie.linear,ye=ae(u.start??"top top"),R=ae(u.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=c);let ee=r.from??0,te=r.to,q=0,x=0,A=0,w=false,b=false,C=-1,k=0,G=false,L=false,N=()=>l==="x"?window.scrollX:window.scrollY,M=()=>l==="x"?window.innerWidth:window.innerHeight;function z(){let h=t.getBoundingClientRect(),X=l==="x"?h.left:h.top,Se=l==="x"?h.width:h.height,be=pe({top:X,height:Se},N(),M(),ye,R);q=be.tStart,x=be.tEnd;}function re(h){if(!L)return;let X=te??t.duration??0;t.currentTime=ee+(X-ee)*h,t.style.setProperty("--scroll-draw-progress",String(h)),B?.(h);}function D(){if(!w||b||!L)return;let h=Q(K(N(),q,x,1));f&&(C=Math.max(C,h),h=C),k=h,re(h),h>=1&&!G?(G=true,$?.()):h<1&&!f&&(G=false),A=requestAnimationFrame(D);}function W(){if(L=true,te===void 0&&(te=t.duration),S){re(1),y?.();return}z(),y?.(),w&&!b&&(A=requestAnimationFrame(D));}t.readyState>=1?W():t.addEventListener("loadedmetadata",W,{once:true}),L||z();let d=new IntersectionObserver(h=>{h.forEach(X=>{w=X.isIntersecting,w&&!b&&L?A=requestAnimationFrame(D):cancelAnimationFrame(A);});}),P;function g(){clearTimeout(P),P=setTimeout(z,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),d.observe(t),Pe(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:q,tEnd:x})}),{destroy(){cancelAnimationFrame(A),d.disconnect(),t.removeEventListener("loadedmetadata",W),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(P),$e(t);},replay(){C=-1,G=false,k=0,b=false,re(0);},pause(){b=true,cancelAnimationFrame(A);},resume(){b&&(b=false,w&&L&&(A=requestAnimationFrame(D)));},seek(h){let X=Math.min(1,Math.max(0,h));k=X,C=X,b=true,cancelAnimationFrame(A),re(X);},getProgress(){return k}}}function gt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function zt(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function pt(e){let r=gt(e),n=new Map;for(let o of r){let f=o.offsetTop;n.has(f)||n.set(f,[]),n.get(f).push(o);}let t=[],u=Array.from(n.keys()).sort((o,f)=>o-f);for(let o of u){let f=n.get(o),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block";for(let c of f)l.appendChild(c);t.push(l);}e.textContent="";for(let o of t)e.appendChild(o),e.appendChild(document.createTextNode(" "));return t}function Vt(e,r,n,t){if(n<=1||t===0)return e;let u=(n-1)*t,o=r*t,f=o+(1-u);return f<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(f-o)))}function qt(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ht(e,r={}){if(typeof window>"u")return dt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return process.env.NODE_ENV!=="production"&&console.warn("[svg-scroll-draw] scrollText: element not found:",e),dt;let t=n,{split:u="words",stagger:o=.04,easing:f="ease-out",from:l={opacity:0,y:24},trigger:c={},once:y=true,onComplete:$}=r,B=window.matchMedia("(prefers-reduced-motion: reduce)").matches,S=typeof f=="function"?f:ie[f]??ie["ease-out"],Q=ae(c.start??"top 85%"),ye=ae(c.end??"top 40%"),R=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;u==="chars"?ee=zt(t):u==="lines"?ee=pt(t):ee=gt(t);let te=ee.length;function q(g,h){l?.opacity!==void 0&&(g.style.opacity=String(l.opacity+(1-l.opacity)*h));let X=qt(h,l);X&&(g.style.transform=X);}function x(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((h,X)=>{let Se=S(Vt(g,X,te,o));q(h,Se);});}if(B)return x(1),$?.(),{destroy(){t.innerHTML=R,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};x(0);let A=0,w=0,b=0,C=false,k=false,G=-1,L=0,N=false,M=()=>window.scrollY,z=()=>window.innerHeight;function re(){let g=t.getBoundingClientRect(),h=pe({top:g.top,height:g.height},M(),z(),Q,ye);A=h.tStart,w=h.tEnd;}function D(){if(!C||k)return;let g=K(M(),A,w,1);y&&(G=Math.max(G,g),g=G),L=g,x(g),g>=1&&!N?(N=true,$?.()):g<1&&!y&&(N=false),b=requestAnimationFrame(D);}re();let W=new IntersectionObserver(g=>{g.forEach(h=>{C=h.isIntersecting,C&&!k?b=requestAnimationFrame(D):cancelAnimationFrame(b);});}),d;function P(){clearTimeout(d),d=setTimeout(()=>{if(u==="lines"){let g=L;t.innerHTML=R,t.setAttribute("aria-label",t.textContent??""),ee=pt(t),x(g);}re();},150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),W.observe(t),Pe(t,{type:"text",getProgress:()=>L,getTrigger:()=>({tStart:A,tEnd:w})}),{destroy(){cancelAnimationFrame(b),W.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(d),t.innerHTML=R,t.removeAttribute("aria-label"),$e(t);},replay(){G=-1,N=false,L=0,k=false,x(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(D)));},seek(g){let h=Math.min(1,Math.max(0,g));L=h,G=h,k=true,cancelAnimationFrame(b),x(h);},getProgress(){return L}}}var yt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=st(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},bt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ct(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},wt=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=ut(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},vt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ft(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Et=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=ht(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};export{bt as ScrollAnimateRef,wt as ScrollCounterRef,yt as ScrollDrawRef,Et as ScrollTextRef,vt as ScrollVideoRef};
1
+ function Vt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(t),o=0,c=[];for(let d=0;d<n;d++){let x=Math.pow(l,d);c.push(x),o+=x;}let u=[0],m=0;for(let d=0;d<n;d++)m+=c[d]/o,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<n;x++)if(d<=u[x+1]){let N=(d-u[x])/(u[x+1]-u[x]);if(x===0)return N*(2-N);let L=1-Math.pow(t,x);return L+(1-L)*(2*N-1)*(2*N-1)}return 1}}function qt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),l=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return o=>o<=0?0:o>=1?1:n*Math.pow(2,-10*o)*Math.sin((o-l)*(2*Math.PI)/t)+1}var ee={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:qt()};function pe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function ft(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function pt(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Wt(e,r,n){return Math.min(n,Math.max(r,e))}function Q(e,r,n,t){return n===r?0:Wt((e-r)/(n-r)*t,0,1)}function Qe(e,r,n){let t=e.getBoundingClientRect(),l=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:n==="x"?t.left:t.top,height:l,scroll:n==="x"?window.scrollX:window.scrollY}}function xe(e,r,n,t,l){let o=ft(e.top,e.height,r,t.element)-pt(t.viewport,n),c=ft(e.top,e.height,r,l.element)-pt(l.viewport,n);return {tStart:o,tEnd:c}}function dt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let 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 Ve(e,r,n){let t=dt(e),l=dt(r);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*n)},${Math.round(t[1]+(l[1]-t[1])*n)},${Math.round(t[2]+(l[2]-t[2])*n)})`}var gt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function he(e,...r){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Bt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ht=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ut(e){let r=[];for(let n=0;n<ht;n++){let t=n/(ht-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Bt;case "ease-out":return Gt;case "ease-in-out":return jt()?Ut(ee["ease-in-out"]):null;default:return null}}var Xt=0;function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e){let r=e.getAttribute("stroke"),n=e.getAttribute("fill");!r||r==="none"?he("Element has no stroke \u2014 path will not be visible.",e):n&&n!=="none"&&n!=="transparent"&&he("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Zt(e,r,n){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 l(){let o=n==="x"?window.scrollX:window.scrollY,c=e-o,u=r-o,m=n==="x";t.innerHTML=`
2
+ <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}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;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var yt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,bt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Jt(e,r,n){if(!Ze)return;let t=(e.match(bt)??[]).join("").toUpperCase(),l=(r.match(bt)??[]).join("").toUpperCase(),o=(e.match(yt)??[]).length,c=(r.match(yt)??[]).length;if(t!==l){he(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}o!==c&&he(`morphTo: coordinate count differs (${o} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function nt(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let c=parseFloat(o),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function wt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...gt[n],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Me=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:A,strokeWidth:$,fillOpacity:M,waypoints:w,velocityScale:k=false,threshold:I=0,rootMargin:P="0px",repeat:S=0,repeatDelay:re=0,morphTo:O,clip:ne,autoplay:se=false,duration:J=1e3,native:ue=true,onProgress:h,onStart:T,onComplete:g,onEnter:p,onLeave:D,onEnterBack:de,onLeaveBack:ve}=l,me=ne===true?"left":typeof ne=="string"?ne:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),Ne=pe(x.end??"bottom top"),ye=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(A)?A[0]:null,oe=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(M)?M[0]:null,Y=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function $e(s){let a=s*100;switch(me){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=me?[]:Array.from(e.querySelectorAll(c)),C=[],i=[],f=0,we=0,R=false,_=false,V=0,j=false,ae=-1,Pe=-1,K=false,Se=0,ke=0,Oe,Ke=null;function ot(){Ke?.destroy(),Ke=null;}let Fe=new Set,it=NaN,De=true,Be=-1,at=performance.now(),ze=NaN;function et(){return ye?W==="x"?ye.scrollLeft:ye.scrollTop:W==="x"?window.scrollX:window.scrollY}function lt(){return ye?W==="x"?ye.clientWidth:ye.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function ct(){let s=Qe(e,ye,W),a=xe(s,s.scroll,lt(),Le,Ne);f=a.tStart,we=a.tEnd,Me&&Ze&&(ot(),Ke=Zt(f,we,W));}function Ht(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),me){let v=a==="reverse"?1-s:s;e.style.clipPath=$e(v);return}z.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${C[le]*s}`:`${C[le]*(1-s)}`,m&&(v.style.opacity=a==="reverse"?`${1-s}`:`${s}`),be&&oe?v.style.stroke=Ve(be,oe,s):oe&&(v.style.stroke=oe),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*s}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*s}`:Y!==null&&(v.style.fillOpacity=`${Y}`),O&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",nt(i[le],O,s));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}z.forEach((s,a)=>{s.style.strokeDasharray=`${C[a]}`,s.style.strokeDashoffset=L==="reverse"?"0":`${C[a]}`,m?s.style.opacity=L==="reverse"?"1":"0":s.style.opacity="",be&&(s.style.stroke=be),ie!==null&&(s.style.strokeWidth=`${ie}`),fe!==null&&(s.style.fillOpacity=`${fe}`),O&&s.tagName.toLowerCase()==="path"&&i[a]&&s.setAttribute("d",i[a]);});}if(z.forEach(s=>{Qt(s);let a=_e(s);C.push(a);let v=s.tagName.toLowerCase()==="path";v?i.push(s.getAttribute("d")??""):i.push(""),O&&(v?Jt(i[i.length-1],O,s):he(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(s.style.opacity="1"),oe&&(s.style.stroke=oe),G!==null&&(s.style.strokeWidth=`${G}`),Y!==null&&(s.style.fillOpacity=`${Y}`),O&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",O)):(s.style.strokeDasharray=`${a}`,s.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?s.style.opacity=L==="reverse"?"1":"0":s.style.opacity="",be&&(s.style.stroke=be),ie!==null&&(s.style.strokeWidth=`${ie}`),fe!==null&&(s.style.fillOpacity=`${fe}`));}),me){if(o)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(o)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ut=typeof d=="string"?Je(d):null;function Nt(){return !(ue===false||!Yt()||!z.length||!ut||me||W!=="y"||ye||u!==1||N!==0||te||X||k!==false||O||w||S||B>0||h||T||g||p||D||de||ve||A!=null||$!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function zt(){let s=++Xt,a=`svg-scroll-draw-${s}`,v=`svg-scroll-draw-host-${s}`,le=`--svg-scroll-draw-${s}`,Ie=L==="reverse"?"0":"var(--ssd-len)",Ce=L==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Ie};`,E=`stroke-dashoffset:${Ce};`;m&&(Ae+=`opacity:${L==="reverse"?1:0};`,E+=`opacity:${L==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${a}{from{${Ae}}to{${E}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ut};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(v);function ce(y,U){y.style.setProperty("--ssd-len",String(C[U])),y.style.strokeDasharray=`${C[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(ce);let b=false,H=-1;function q(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},et(),lt(),Le,Ne);return Ee(Q(et(),U,Te,u))}return {destroy(){e.classList.remove(v),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),F.remove();},replay(){b=false,H=-1,z.forEach(ce);},pause(){b=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){b&&(b=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));H=U,b=true,z.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${C[ge]*U}`:`${C[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){z.forEach((y,U)=>{C[U]=_e(y),y.style.setProperty("--ssd-len",String(C[U])),y.style.strokeDasharray=`${C[U]}`;});}}}if(Nt())return zt();function _t(){let s=Math.max(1,J),a=0,v=0,le=false;function Ie(b){let H=true;if(me){let q=Math.min(1,Math.max(0,b/s)),y=Ee(q);Se=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=$e(L==="reverse"?1-y:y),h?.(y),q<1&&(H=false);}else z.forEach((q,y)=>{let U=y*N*s,Te=Math.min(1,Math.max(0,(b-U)/s)),ge=Ee(Te);q.style.strokeDashoffset=L==="reverse"?`${C[y]*ge}`:`${C[y]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&oe?q.style.stroke=Ve(be,oe,ge):oe&&(q.style.stroke=oe),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),O&&q.tagName.toLowerCase()==="path"&&i[y]&&q.setAttribute("d",nt(i[y],O,ge)),y===0&&(Se=ge,h?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(H=false);});if(w){let q=Math.min(1,Math.max(0,b/s)),y=Ee(q);for(let U in w){let Te=parseFloat(U);y>=Te&&!Fe.has(Te)&&(Fe.add(Te),w[U]?.());}}return H}function Ce(b){if(K)return;let H=b-a;_||(_=true,T?.());let q=Ie(H);if(q&&!R){R=true,Ie(s*(1+Math.max(0,z.length-1)*N)),g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Oe=setTimeout(()=>{a=performance.now(),_=false,R=false,Fe.clear(),Ge(),V=requestAnimationFrame(Ce);},re));return}q||(V=requestAnimationFrame(Ce));}function Ae(){cancelAnimationFrame(V),clearTimeout(Oe),a=performance.now(),v=0,K=false,_=false,R=false,ke=0,le=true,Se=0,Fe.clear(),Ge(),V=requestAnimationFrame(Ce);}let E=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&R)?Ae():!H.isIntersecting&&!te&&!R&&(cancelAnimationFrame(V),clearTimeout(Oe),le=false);});},{root:ye??null,threshold:I,rootMargin:P}),F;function ce(){clearTimeout(F),F=setTimeout(()=>{z.forEach((b,H)=>{C[H]=_e(b),b.style.strokeDasharray=`${C[H]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>E.observe(e),B):E.observe(e),{destroy(){cancelAnimationFrame(V),clearTimeout(Oe),E.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(F);},replay(){ke=0,Ae();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(V));},resume(){K&&(K=false,le=true,a=performance.now()-v,V=requestAnimationFrame(Ce));},seek(b){let H=Math.min(1,Math.max(0,b));Se=H,K=true,v=H*s,a=performance.now()-v,cancelAnimationFrame(V),Ie(v);},getProgress(){return Se},refresh(){clearTimeout(F),z.forEach((b,H)=>{C[H]=_e(b),b.style.strokeDasharray=`${C[H]}`;});}}}if(se)return _t();ct();function je(){if(!j||K)return;let s=performance.now(),a=et();if(!De&&k===false&&a===it){V=requestAnimationFrame(je);return}De=false,it=a;let v=u;if(k!==false){let E=s-at,F=E>0?Math.abs(a-(Be<0?a:Be))/E:0;v=u*Math.max(.2,1+F*(typeof k=="number"?k:1)*.04);}Be=a,at=s;let le=X?Pe===-1||a>=Pe?"forward":"reverse":L;Pe=a;let Ie=we-f,Ce=true,Ae=Ie===0?0:(a-f)/Ie;if(isNaN(ze)||(ze<=0&&Ae>0?p?.():ze>0&&Ae<=0&&ve?.(),ze<1&&Ae>=1?D?.():ze>=1&&Ae<1&&de?.()),ze=Ae,me){let E=Ee(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,E),E=ae),Se=E,e.style.setProperty("--scroll-draw-progress",String(E));let F=le==="reverse"?1-E:E;e.style.clipPath=$e(F),h?.(E),!_&&Q(a,f,we,v)>0&&(_=true,T?.()),E>=1&&!R?(R=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Oe=setTimeout(()=>{ae=-1,_=false,R=false,e.style.clipPath=$e(0);},re))):E<1&&!te&&(R=false),V=requestAnimationFrame(je);return}if(z.forEach((E,F)=>{let ce=F*N*Ie,b=Ee(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Se=b,E.style.strokeDashoffset=le==="reverse"?`${C[F]*b}`:`${C[F]*(1-b)}`,m&&(E.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&oe?E.style.stroke=Ve(be,oe,b):oe&&(E.style.stroke=oe),ie!==null&&G!==null?E.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(E.style.strokeWidth=`${G}`),fe!==null&&Y!==null?E.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(E.style.fillOpacity=`${Y}`),O&&E.tagName.toLowerCase()==="path"&&i[F]&&E.setAttribute("d",nt(i[F],O,b)),F===0&&(h?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Ce=false);}),w){let E=Ee(Q(a,f,we,v));for(let F in w){let ce=parseFloat(F);E>=ce&&!Fe.has(ce)&&(Fe.add(ce),w[F]?.());}}!_&&Q(a,f,we,v)>0&&(_=true,T?.()),Ce&&!R?(R=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Oe=setTimeout(()=>{ae=-1,_=false,R=false,Fe.clear(),Ge(),De=true;},re))):!Ce&&!te&&(R=false),V=requestAnimationFrame(je);}let tt=false;function Ue(){tt||(tt=true,V=requestAnimationFrame(function(){je();}));}function Xe(){tt=false,cancelAnimationFrame(V);}let rt=new IntersectionObserver(s=>{s.forEach(a=>{j=a.isIntersecting,j&&!K?(De=true,Ue()):Xe();});},{root:ye??null,threshold:I,rootMargin:P});function mt(){z.forEach((s,a)=>{C[a]=_e(s),s.style.strokeDasharray=`${C[a]}`;}),ct(),De=true;}let Ye;function qe(){clearTimeout(Ye),Ye=setTimeout(mt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),B>0?setTimeout(()=>rt.observe(e),B):rt.observe(e),{destroy(){cancelAnimationFrame(V),clearTimeout(Oe),Xe(),rt.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Ye),ot();},replay(){ae=-1,Pe=-1,Be=-1,_=false,R=false,ke=0,K=false,Se=0,Fe.clear(),clearTimeout(Oe),Ge(),De=true,j&&Ue();},pause(){K=true,Xe();},resume(){K&&(K=false,De=true,j&&Ue());},seek(s){let a=Math.min(1,Math.max(0,s));Se=a,ae=a,K=true,Xe(),Ht(a,L),De=true;},getProgress(){return Se},refresh(){clearTimeout(Ye),mt(),j&&!K&&Ue();}}}var vt=new Map;function Re(e,r){vt.set(e,r);}function He(e){vt.delete(e);}function Kt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Et(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],o=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}r.push({fn:t[1],nums:l,units:o});}return r}function er(e,r,n){let t=Et(e),l=Et(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((o,c)=>{let u=l[c];return o.fn!==u.fn||o.nums.length!==u.nums.length?n<1?`${o.fn}(${o.nums.map((m,d)=>`${m}${o.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,d)=>`${m+(u.nums[d]-m)*n}${o.units[d]}`).join(", ")})`}).join(" ")}function St(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Kt(t))return Ve(t,l,n);if(t.includes("("))return er(t,l,n);let o=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(o&&c){let u=parseFloat(o[1]),m=parseFloat(c[1]);return `${u+(m-u)*n}${o[2]||c[2]}`}return n<1?t:l}function tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,Tt="--scroll-draw-progress";function sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function xt(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:o="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Me,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:A}=r,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof o=="function"?o:ee[o]??ee["ease-out"],w=pe(l.start??"top bottom"),k=pe(l.end??"bottom top"),I=te??e,P=typeof d=="string"?document.querySelector(d):d??null,S=Object.entries(t).map(([i,f])=>({prop:tr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function re(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function O(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let ne=new Map;for(let i of [...S.map(f=>f.prop),Tt])ne.set(i,e.style.getPropertyValue(i));function se(){for(let[i,f]of ne)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return O(),W?.(),{...n,destroy:se,getProgress:()=>1};re();let J=typeof o=="string"?Je(o):null;function ue(){if(!x||!sr()||!J||m!=="y"||P||I!==e||u||c!==1||Me||W||Z||X||B||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!rr.has(i.prop))return false;return true}function h(){let i=`ssd-a-${++nr}`,f=S.map(j=>`${j.prop}:${j.from}`).join(";"),we=S.map(j=>`${j.prop}:${j.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,V=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",se();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Pe of S)e.style.setProperty(Pe.prop,St(Pe.from,Pe.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=_(),Pe=V(),{tStart:K,tEnd:Se}=xe({top:j.top,height:j.height},ae,Pe,w,k);return M(Q(ae,K,Se,c))}}}if(ue())return h();let T=0,g=0,p=0,D=false,de=false,ve=-1,me=0,Ee=false,Le=NaN,Ne=-1,ye=0,be=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,oe=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Qe(I,P,m),f=xe(i,i.scroll,oe(),w,k);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Tt,String(i));for(let f of S)e.style.setProperty(f.prop,St(f.from,f.to,i));Me?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&A?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!D||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let V=i-ye,j=V>0?Math.abs(f-(Ne<0?f:Ne))/V:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}Ne=f,ye=i;let R=g===T?0:(f-T)/(g-T);fe(R);let _=M(Q(f,T,g,we));u&&(ve=Math.max(ve,_),_=ve),me=_,G(_),_>=1&&!Ee?(Ee=true,W?.()):_<1&&!u&&(Ee=false),p=requestAnimationFrame(Y);}ie(),g===T&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=M(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{D=f.isIntersecting,D&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:P??null}),z;function C(){clearTimeout(z),z=setTimeout(ie,150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),$e.observe(e),Re(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(z),se(),He(e);},replay(){ve=-1,Ee=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,D&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function At(e,r){if(typeof window>"u")return st;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return he("scrollCounter: element not found:",e),st;let t=n,{from:l=0,to:o,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?h=>h.toFixed(x):c??(h=>String(Math.round(h))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Me=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(o),N?.(),st;let X=0,B=0,A=0,$=false,M=false,w=-1,k=0,I=false,P=()=>window.scrollY,S=()=>window.innerHeight;function re(){let h=t.getBoundingClientRect(),T=xe({top:h.top,height:h.height},P(),S(),Me,W);X=T.tStart,B=T.tEnd;}function O(h){t.textContent=L(l+(o-l)*h),t.style.setProperty("--scroll-draw-progress",String(h));}function ne(){if(!$||M)return;let h=te(Q(P(),X,B,1));d&&(w=Math.max(w,h),h=w),k=h,O(h),h>=1&&!I?(I=true,N?.()):h<1&&!d&&(I=false),A=requestAnimationFrame(ne);}re();{let h=te(Q(P(),X,B,1));d&&h>0&&(w=h),k=h,O(h);}let se=new IntersectionObserver(h=>{h.forEach(T=>{$=T.isIntersecting,$&&!M?A=requestAnimationFrame(ne):cancelAnimationFrame(A);});}),J;function ue(){clearTimeout(J),J=setTimeout(re,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),se.observe(t),Re(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(A),se.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),He(t);},replay(){w=-1,I=false,k=0,M=false,O(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,$&&(A=requestAnimationFrame(ne)));},seek(h){let T=Math.min(1,Math.max(0,h));k=T,w=T,M=true,cancelAnimationFrame(A),O(T);},getProgress(){return k}}}var Mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,r={}){if(typeof window>"u")return Mt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Mt;let t=n,{trigger:l={},easing:o="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof o=="function"?o:ee[o]??ee.linear,Me=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,B=0,A=0,$=0,M=false,w=false,k=-1,I=0,P=false,S=false,re=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;function ne(){let p=t.getBoundingClientRect(),D=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:D,height:de},re(),O(),Me,W);B=ve.tStart,A=ve.tEnd;}function se(p){if(!S)return;let D=X??t.duration??0;t.currentTime=Z+(D-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!M||w||!S)return;let p=te(Q(re(),B,A,1));c&&(k=Math.max(k,p),p=k),I=p,se(p),p>=1&&!P?(P=true,x?.()):p<1&&!c&&(P=false),$=requestAnimationFrame(J);}function ue(){if(S=true,X===void 0&&(X=t.duration),L){se(1),d?.();return}ne(),d?.(),M&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),S||ne();let h=new IntersectionObserver(p=>{p.forEach(D=>{M=D.isIntersecting,M&&!w&&S?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(ne,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),h.observe(t),Re(t,{type:"video",getProgress:()=>I,getTrigger:()=>({tStart:B,tEnd:A})}),{destroy(){cancelAnimationFrame($),h.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),He(t);},replay(){k=-1,P=false,I=0,w=false,se(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,M&&S&&($=requestAnimationFrame(J)));},seek(p){let D=Math.min(1,Math.max(0,p));I=D,k=D,w=true,cancelAnimationFrame($),se(D);},getProgress(){return I}}}function Ct(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function or(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function $t(e){let r=Ct(e),n=new Map;for(let o of r){let c=o.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(o);}let t=[],l=Array.from(n.keys()).sort((o,c)=>o-c);for(let o of l){let c=n.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((o,c)=>{e.appendChild(o),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ir(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,o=r*t,c=o+(1-l);return c<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(c-o)))}function ar(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kt(e,r={}){if(typeof window>"u")return Pt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return he("scrollText: element not found:",e),Pt;let t=n,{split:l="words",stagger:o=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Me=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=or(t):l==="lines"?Z=$t(t):Z=Ct(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let D=ar(p,u);D&&(g.style.transform=D);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,D)=>{let de=L(ir(g,D,X,o));B(p,de);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,M=0,w=0,k=false,I=false,P=-1,S=0,re=false,O=()=>window.scrollY,ne=()=>window.innerHeight;function se(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},O(),ne(),te,Me);$=p.tStart,M=p.tEnd;}function J(){if(!k||I)return;let g=Q(O(),$,M,1);d&&(P=Math.max(P,g),g=P),S=g,A(g),g>=1&&!re?(re=true,x?.()):g<1&&!d&&(re=false),w=requestAnimationFrame(J);}se();let ue=new IntersectionObserver(g=>{g.forEach(p=>{k=p.isIntersecting,k&&!I?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),h;function T(){clearTimeout(h),h=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=$t(t),A(g);}se();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Re(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(h),t.innerHTML=W,t.removeAttribute("aria-label"),He(t);},replay(){P=-1,re=false,S=0,I=false,A(0);},pause(){I=true,cancelAnimationFrame(w);},resume(){I&&(I=false,k&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));S=p,P=p,I=true,cancelAnimationFrame(w),A(p);},getProgress(){return S}}}var It=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=wt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Ot=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=xt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Ft=class{constructor(){this.instance=null;}init(r,n){return this.destroy(),this.instance=At(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Dt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=Lt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}},Rt=class{constructor(){this.instance=null;}init(r,n={}){return this.destroy(),this.instance=kt(r,n),this}replay(){return this.instance?.replay(),this}pause(){return this.instance?.pause(),this}resume(){return this.instance?.resume(),this}seek(r){return this.instance?.seek(r),this}getProgress(){return this.instance?.getProgress()??0}destroy(){return this.instance?.destroy(),this.instance=null,this}};export{Ot as ScrollAnimateRef,Ft as ScrollCounterRef,It as ScrollDrawRef,Rt as ScrollTextRef,Dt as ScrollVideoRef};