svg-scroll-draw 2.10.0 → 2.10.2

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 (44) hide show
  1. package/README.md +19 -10
  2. package/dist/angular/index.cjs +2 -2
  3. package/dist/angular/index.mjs +2 -2
  4. package/dist/astro/index.cjs +2 -2
  5. package/dist/astro/index.mjs +2 -2
  6. package/dist/cdn/svg-scroll-draw.dev.global.js +55 -29
  7. package/dist/cdn/svg-scroll-draw.global.js +2 -2
  8. package/dist/cinematic/index.cjs +2 -2
  9. package/dist/cinematic/index.mjs +2 -2
  10. package/dist/devtools/index.cjs +1 -1
  11. package/dist/devtools/index.mjs +1 -1
  12. package/dist/group/index.cjs +2 -2
  13. package/dist/group/index.mjs +2 -2
  14. package/dist/horizontal/index.cjs +1 -1
  15. package/dist/horizontal/index.mjs +1 -1
  16. package/dist/index.cjs +3 -3
  17. package/dist/index.mjs +3 -3
  18. package/dist/nuxt/index.cjs +2 -2
  19. package/dist/nuxt/index.mjs +2 -2
  20. package/dist/pin/index.cjs +1 -1
  21. package/dist/pin/index.mjs +1 -1
  22. package/dist/progress/index.cjs +1 -1
  23. package/dist/progress/index.mjs +1 -1
  24. package/dist/react/index.cjs +2 -2
  25. package/dist/react/index.mjs +2 -2
  26. package/dist/reveal/index.cjs +1 -1
  27. package/dist/reveal/index.mjs +1 -1
  28. package/dist/snap/index.cjs +1 -1
  29. package/dist/snap/index.mjs +1 -1
  30. package/dist/solid/index.cjs +2 -2
  31. package/dist/solid/index.mjs +2 -2
  32. package/dist/svelte/index.cjs +2 -2
  33. package/dist/svelte/index.mjs +2 -2
  34. package/dist/text/index.cjs +1 -1
  35. package/dist/text/index.mjs +1 -1
  36. package/dist/timeline/index.cjs +8 -8
  37. package/dist/timeline/index.mjs +8 -8
  38. package/dist/video/index.cjs +1 -1
  39. package/dist/video/index.mjs +1 -1
  40. package/dist/vue/index.cjs +2 -2
  41. package/dist/vue/index.mjs +2 -2
  42. package/dist/web-component/index.cjs +3 -3
  43. package/dist/web-component/index.mjs +3 -3
  44. package/package.json +255 -68
@@ -1,3 +1,3 @@
1
- function Ct({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(t),c=0,m=[];for(let h=0;h<r;h++){let S=Math.pow(o,h);m.push(S),c+=S;}let i=[0],u=0;for(let h=0;h<r;h++)u+=m[h]/c,i.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let S=0;S<r;S++)if(h<=i[S+1]){let z=(h-i[S])/(i[S+1]-i[S]);if(S===0)return z*(2-z);let x=1-Math.pow(t,S);return x+(1-x)*(2*z-1)*(2*z-1)}return 1}}function It({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),o=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return c=>c<=0?0:c>=1?1:r*Math.pow(2,-10*c)*Math.sin((c-o)*(2*Math.PI)/t)+1}var Se={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:Ct(),elastic:It()};function De(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function pt(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function dt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ce(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Ot(e,n,r){return Math.min(r,Math.max(n,e))}function re(e,n,r,t){return r===n?0:Ot((e-n)/(r-n)*t,0,1)}function Ye(e,n,r){let t=e.getBoundingClientRect(),o=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:o,scroll:0}:{top:r==="x"?t.left:t.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function Ie(e,n,r,t,o){let c=pt(e.top,e.height,n,t.element)-dt(t.viewport,r),m=pt(e.top,e.height,n,o.element)-dt(o.viewport,r);return {tStart:c,tEnd:m}}function gt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Oe(e,n,r){let t=gt(e),o=gt(n);return !t||!o?e:`rgb(${Math.round(t[0]+(o[0]-t[0])*r)},${Math.round(t[1]+(o[1]-t[1])*r)},${Math.round(t[2]+(o[2]-t[2])*r)})`}var yt={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 Qe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...n){Qe&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Rt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ft="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ht=33;function Nt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function _t(e){let n=[];for(let r=0;r<ht;r++){let t=r/(ht-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function Ze(e){switch(e){case "linear":return "linear";case "ease-in":return Rt;case "ease-out":return Ft;case "ease-in-out":return Nt()?_t(Se["ease-in-out"]):null;default:return null}}var Ht=0;function Vt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function zt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Wt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function o(){let c=r==="x"?window.scrollX:window.scrollY,m=e-c,i=n-c,u=r==="x";t.innerHTML=`
1
+ function Rt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(t),c=0,m=[];for(let h=0;h<r;h++){let S=Math.pow(o,h);m.push(S),c+=S;}let i=[0],u=0;for(let h=0;h<r;h++)u+=m[h]/c,i.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let S=0;S<r;S++)if(h<=i[S+1]){let V=(h-i[S])/(i[S+1]-i[S]);if(S===0)return V*(2-V);let x=1-Math.pow(t,S);return x+(1-x)*(2*V-1)*(2*V-1)}return 1}}function Ft({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),o=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return c=>c<=0?0:c>=1?1:r*Math.pow(2,-10*c)*Math.sin((c-o)*(2*Math.PI)/t)+1}var Se={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:Rt(),elastic:Ft()};function De(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function ht(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function bt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ie(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Nt(e,n,r){return Math.min(r,Math.max(n,e))}function ne(e,n,r,t){return r===n?0:Nt((e-n)/(r-n)*t,0,1)}function Ze(e,n,r){let t=e.getBoundingClientRect(),o=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:o,scroll:0}:{top:r==="x"?t.left:t.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function Ce(e,n,r,t,o){let c=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),m=ht(e.top,e.height,n,o.element)-bt(o.viewport,r);return {tStart:c,tEnd:m}}function wt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function Oe(e,n,r){let t=wt(e),o=wt(n);return !t||!o?e:`rgb(${Math.round(t[0]+(o[0]-t[0])*r)},${Math.round(t[1]+(o[1]-t[1])*r)},${Math.round(t[2]+(o[2]-t[2])*r)})`}var vt={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 Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ye(e,...n){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var _t="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ht="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Et=33;function Vt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function zt(e){let n=[];for(let r=0;r<Et;r++){let t=r/(Et-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return _t;case "ease-out":return Ht;case "ease-in-out":return Vt()?zt(Se["ease-in-out"]):null;default:return null}}var St=Symbol.for("svg-scroll-draw.registry");function xt(){let e=globalThis;return e[St]||(e[St]=new Map)}function Ve(e,n){xt().set(e,n);}function ze(e){xt().delete(e);}var Wt=0;function qt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Bt(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?ye("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&ye("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Gt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function o(){let c=r==="x"?window.scrollX:window.scrollY,m=e-c,i=n-c,u=r==="x";t.innerHTML=`
2
2
  <div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${u?`left:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}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",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var bt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,wt=/[MmLlHhVvCcSsQqTtAaZz]/g;function qt(e,n,r){if(!Qe)return;let t=(e.match(wt)??[]).join("").toUpperCase(),o=(n.match(wt)??[]).join("").toUpperCase(),c=(e.match(bt)??[]).length,m=(n.match(bt)??[]).length;if(t!==o){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==m&&ye(`morphTo: coordinate count differs (${c} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ot(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let m=parseFloat(c),i=t[o++]??m;return String(+(m+(i-m)*r).toFixed(4))})}function st(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,o=r?{...yt[r],...t}:t,c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:i=1,fade:u=false,easing:h="linear",trigger:S={},stagger:z=0,direction:x="forward",once:fe=false,debug:ze=false,axis:K="y",scrollContainer:Pe,autoReverse:xe=false,delay:he=0,strokeColor:ne,strokeWidth:me,fillOpacity:ee,waypoints:oe,velocityScale:be=false,threshold:Re=0,rootMargin:Y="0px",repeat:I=0,repeatDelay:Fe=0,morphTo:W,clip:Me,autoplay:Ne=false,duration:We=1e3,native:Ke=true,onProgress:Te,onStart:G,onComplete:q,onEnter:se,onLeave:$e,onEnterBack:ie,onLeaveBack:pe}=o,H=Me===true?"left":typeof Me=="string"?Me:false,Q=typeof h=="function"?h:Se[h]??Se.linear,ae=De(S.start??"top bottom"),ke=De(S.end??"bottom top"),j=typeof Pe=="string"?document.querySelector(Pe):Pe??null,U=Array.isArray(ne)?ne[0]:null,O=Array.isArray(ne)?ne[1]:typeof ne=="string"?ne:null,R=Array.isArray(me)?me[0]:null,M=Array.isArray(me)?me[1]:typeof me=="number"?me:null,V=Array.isArray(ee)?ee[0]:null,D=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null;function le(s){let l=s*100;switch(H){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=H?[]:Array.from(e.querySelectorAll(m)),b=[],a=[],f=0,X=0,v=false,$=false,A=0,k=false,F=-1,ce=-1,C=false,Z=0,de=0,we,et=null;function it(){et?.destroy(),et=null;}let ve=new Set,at=NaN,Ee=true,qe=-1,lt=performance.now(),Le=NaN;function tt(){return j?K==="x"?j.scrollLeft:j.scrollTop:K==="x"?window.scrollX:window.scrollY}function ct(){return j?K==="x"?j.clientWidth:j.clientHeight:K==="x"?window.innerWidth:window.innerHeight}function ut(){let s=Ye(e,j,K),l=Ie(s,s.scroll,ct(),ae,ke);f=l.tStart,X=l.tEnd,ze&&Qe&&(it(),et=Wt(f,X,K));}function Mt(s,l){if(e.style.setProperty("--scroll-draw-progress",String(s)),H){let g=l==="reverse"?1-s:s;e.style.clipPath=le(g);return}T.forEach((g,N)=>{g.style.strokeDashoffset=l==="reverse"?`${b[N]*s}`:`${b[N]*(1-s)}`,u&&(g.style.opacity=l==="reverse"?`${1-s}`:`${s}`),U&&O?g.style.stroke=Oe(U,O,s):O&&(g.style.stroke=O),R!==null&&M!==null?g.style.strokeWidth=`${R+(M-R)*s}`:M!==null&&(g.style.strokeWidth=`${M}`),V!==null&&D!==null?g.style.fillOpacity=`${V+(D-V)*s}`:D!==null&&(g.style.fillOpacity=`${D}`),W&&g.tagName.toLowerCase()==="path"&&a[N]&&g.setAttribute("d",ot(a[N],W,s));});}function Be(){if(e.style.setProperty("--scroll-draw-progress","0"),H){e.style.clipPath=le(0);return}T.forEach((s,l)=>{s.style.strokeDasharray=`${b[l]}`,s.style.strokeDashoffset=x==="reverse"?"0":`${b[l]}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",U&&(s.style.stroke=U),R!==null&&(s.style.strokeWidth=`${R}`),V!==null&&(s.style.fillOpacity=`${V}`),W&&s.tagName.toLowerCase()==="path"&&a[l]&&s.setAttribute("d",a[l]);});}if(T.forEach(s=>{zt(s);let l=Ce(s);b.push(l);let g=s.tagName.toLowerCase()==="path";g?a.push(s.getAttribute("d")??""):a.push(""),W&&(g?qt(a[a.length-1],W,s):ye(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),c?(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?`${l}`:"0",u&&(s.style.opacity="1"),O&&(s.style.stroke=O),M!==null&&(s.style.strokeWidth=`${M}`),D!==null&&(s.style.fillOpacity=`${D}`),W&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",W)):(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?"0":`${l}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",U&&(s.style.stroke=U),R!==null&&(s.style.strokeWidth=`${R}`),V!==null&&(s.style.fillOpacity=`${V}`));}),H){if(c)return e.style.clipPath=le(1),q?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(c)return q?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ft=typeof h=="string"?Ze(h):null;function kt(){return !(Ke===false||!Vt()||!T.length||!ft||H||K!=="y"||j||i!==1||z!==0||fe||xe||be!==false||W||oe||I||he>0||Te||G||q||se||$e||ie||pe||ne!=null||me!=null||ee!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Lt(){let s=++Ht,l=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,N=`--svg-scroll-draw-${s}`,ge=x==="reverse"?"0":"var(--ssd-len)",ue=x==="reverse"?"var(--ssd-len)":"0",te=`stroke-dashoffset:${ge};`,y=`stroke-dashoffset:${ue};`;u&&(te+=`opacity:${x==="reverse"?1:0};`,y+=`opacity:${x==="reverse"?0:1};`);let w=document.createElement("style");w.setAttribute("data-svg-scroll-draw",""),w.textContent=`@keyframes ${l}{from{${te}}to{${y}}}.${g}{view-timeline-name:${N};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ft};animation-fill-mode:both;animation-timeline:${N};animation-range:cover 0% cover 100%;}`,document.head.appendChild(w),e.classList.add(g);function _(p,L){p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(l);}T.forEach(_);let d=false,E=-1;function P(){if(E>=0)return E;let p=e.getBoundingClientRect(),{tStart:L,tEnd:J}=Ie({top:p.top,height:p.height},tt(),ct(),ae,ke);return Q(re(tt(),L,J,i))}return {destroy(){e.classList.remove(g),T.forEach(p=>{p.classList.remove(l),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),w.remove();},replay(){d=false,E=-1,T.forEach(_);},pause(){d=true,T.forEach(p=>{p.style.animationPlayState="paused";});},resume(){d&&(d=false,T.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let L=Math.min(1,Math.max(0,p));E=L,d=true,T.forEach((J,B)=>{J.classList.remove(l),J.style.strokeDashoffset=x==="reverse"?`${b[B]*L}`:`${b[B]*(1-L)}`,u&&(J.style.opacity=x==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return P()},refresh(){T.forEach((p,L)=>{b[L]=Ce(p),p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`;});}}}if(kt())return Lt();function Dt(){let s=Math.max(1,We),l=0,g=0,N=false;function ge(d){let E=true;if(H){let P=Math.min(1,Math.max(0,d/s)),p=Q(P);Z=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=le(x==="reverse"?1-p:p),Te?.(p),P<1&&(E=false);}else T.forEach((P,p)=>{let L=p*z*s,J=Math.min(1,Math.max(0,(d-L)/s)),B=Q(J);P.style.strokeDashoffset=x==="reverse"?`${b[p]*B}`:`${b[p]*(1-B)}`,u&&(P.style.opacity=x==="reverse"?`${1-B}`:`${B}`),U&&O?P.style.stroke=Oe(U,O,B):O&&(P.style.stroke=O),R!==null&&M!==null?P.style.strokeWidth=`${R+(M-R)*B}`:M!==null&&(P.style.strokeWidth=`${M}`),V!==null&&D!==null?P.style.fillOpacity=`${V+(D-V)*B}`:D!==null&&(P.style.fillOpacity=`${D}`),W&&P.tagName.toLowerCase()==="path"&&a[p]&&P.setAttribute("d",ot(a[p],W,B)),p===0&&(Z=B,Te?.(B),e.style.setProperty("--scroll-draw-progress",String(B))),J<1&&(E=false);});if(oe){let P=Math.min(1,Math.max(0,d/s)),p=Q(P);for(let L in oe){let J=parseFloat(L);p>=J&&!ve.has(J)&&(ve.add(J),oe[L]?.());}}return E}function ue(d){if(C)return;let E=d-l;$||($=true,G?.());let P=ge(E);if(P&&!v){v=true,ge(s*(1+Math.max(0,T.length-1)*z)),q?.(),de<(I==="infinite"?1/0:I??0)&&(de++,we=setTimeout(()=>{l=performance.now(),$=false,v=false,ve.clear(),Be(),A=requestAnimationFrame(ue);},Fe));return}P||(A=requestAnimationFrame(ue));}function te(){cancelAnimationFrame(A),clearTimeout(we),l=performance.now(),g=0,C=false,$=false,v=false,de=0,N=true,Z=0,ve.clear(),Be(),A=requestAnimationFrame(ue);}let y=new IntersectionObserver(d=>{d.forEach(E=>{E.isIntersecting&&!(fe&&v)?te():!E.isIntersecting&&!fe&&!v&&(cancelAnimationFrame(A),clearTimeout(we),N=false);});},{root:j??null,threshold:Re,rootMargin:Y}),w;function _(){clearTimeout(w),w=setTimeout(()=>{T.forEach((d,E)=>{b[E]=Ce(d),d.style.strokeDasharray=`${b[E]}`;});},150);}return window.addEventListener("resize",_),window.addEventListener("orientationchange",_),he>0?setTimeout(()=>y.observe(e),he):y.observe(e),{destroy(){cancelAnimationFrame(A),clearTimeout(we),y.disconnect(),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),clearTimeout(w);},replay(){de=0,te();},pause(){C||!N||(C=true,g=performance.now()-l,cancelAnimationFrame(A));},resume(){C&&(C=false,N=true,l=performance.now()-g,A=requestAnimationFrame(ue));},seek(d){let E=Math.min(1,Math.max(0,d));Z=E,C=true,g=E*s,l=performance.now()-g,cancelAnimationFrame(A),ge(g);},getProgress(){return Z},refresh(){clearTimeout(w),T.forEach((d,E)=>{b[E]=Ce(d),d.style.strokeDasharray=`${b[E]}`;});}}}if(Ne)return Dt();ut();function Ge(){if(!k||C)return;let s=performance.now(),l=tt();if(!Ee&&be===false&&l===at){A=requestAnimationFrame(Ge);return}Ee=false,at=l;let g=i;if(be!==false){let y=s-lt,w=y>0?Math.abs(l-(qe<0?l:qe))/y:0;g=i*Math.max(.2,1+w*(typeof be=="number"?be:1)*.04);}qe=l,lt=s;let N=xe?ce===-1||l>=ce?"forward":"reverse":x;ce=l;let ge=X-f,ue=true,te=ge===0?0:(l-f)/ge;if(isNaN(Le)||(Le<=0&&te>0?se?.():Le>0&&te<=0&&pe?.(),Le<1&&te>=1?$e?.():Le>=1&&te<1&&ie?.()),Le=te,H){let y=Q(re(l,f,X,g));fe&&!xe&&(F=Math.max(F,y),y=F),Z=y,e.style.setProperty("--scroll-draw-progress",String(y));let w=N==="reverse"?1-y:y;e.style.clipPath=le(w),Te?.(y),!$&&re(l,f,X,g)>0&&($=true,G?.()),y>=1&&!v?(v=true,q?.(),de<(I==="infinite"?1/0:I??0)&&(de++,we=setTimeout(()=>{F=-1,$=false,v=false,e.style.clipPath=le(0);},Fe))):y<1&&!fe&&(v=false),A=requestAnimationFrame(Ge);return}if(T.forEach((y,w)=>{let _=w*z*ge,d=Q(re(l,f+_,X+_,g));fe&&!xe&&(F=Math.max(F,d),d=F),Z=d,y.style.strokeDashoffset=N==="reverse"?`${b[w]*d}`:`${b[w]*(1-d)}`,u&&(y.style.opacity=N==="reverse"?`${1-d}`:`${d}`),U&&O?y.style.stroke=Oe(U,O,d):O&&(y.style.stroke=O),R!==null&&M!==null?y.style.strokeWidth=`${R+(M-R)*d}`:M!==null&&(y.style.strokeWidth=`${M}`),V!==null&&D!==null?y.style.fillOpacity=`${V+(D-V)*d}`:D!==null&&(y.style.fillOpacity=`${D}`),W&&y.tagName.toLowerCase()==="path"&&a[w]&&y.setAttribute("d",ot(a[w],W,d)),w===0&&(Te?.(d),e.style.setProperty("--scroll-draw-progress",String(d))),d<1&&(ue=false);}),oe){let y=Q(re(l,f,X,g));for(let w in oe){let _=parseFloat(w);y>=_&&!ve.has(_)&&(ve.add(_),oe[w]?.());}}!$&&re(l,f,X,g)>0&&($=true,G?.()),ue&&!v?(v=true,q?.(),de<(I==="infinite"?1/0:I??0)&&(de++,we=setTimeout(()=>{F=-1,$=false,v=false,ve.clear(),Be(),Ee=true;},Fe))):!ue&&!fe&&(v=false),A=requestAnimationFrame(Ge);}let rt=false;function je(){rt||(rt=true,A=requestAnimationFrame(function(){Ge();}));}function Ue(){rt=false,cancelAnimationFrame(A);}let nt=new IntersectionObserver(s=>{s.forEach(l=>{k=l.isIntersecting,k&&!C?(Ee=true,je()):Ue();});},{root:j??null,threshold:Re,rootMargin:Y});function mt(){T.forEach((s,l)=>{b[l]=Ce(s),s.style.strokeDasharray=`${b[l]}`;}),ut(),Ee=true;}let Xe;function _e(){clearTimeout(Xe),Xe=setTimeout(mt,150);}window.addEventListener("resize",_e),window.addEventListener("orientationchange",_e);let He;return typeof ResizeObserver<"u"&&(He=new ResizeObserver(()=>_e()),He.observe(document.body),He.observe(document.documentElement),He.observe(e)),he>0?setTimeout(()=>nt.observe(e),he):nt.observe(e),{destroy(){cancelAnimationFrame(A),clearTimeout(we),Ue(),nt.disconnect(),He?.disconnect(),window.removeEventListener("resize",_e),window.removeEventListener("orientationchange",_e),clearTimeout(Xe),it();},replay(){F=-1,ce=-1,qe=-1,$=false,v=false,de=0,C=false,Z=0,ve.clear(),clearTimeout(we),Be(),Ee=true,k&&je();},pause(){C=true,Ue();},resume(){C&&(C=false,Ee=true,k&&je());},seek(s){let l=Math.min(1,Math.max(0,s));Z=l,F=l,C=true,Ue(),Mt(l,x),Ee=true;},getProgress(){return Z},refresh(){clearTimeout(Xe),mt(),k&&!C&&je();}}}var vt=new Map;function Et(e,n){vt.set(e,n);}function St(e){vt.delete(e);}function Bt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function xt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],m=t[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let u=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),c.push(u?u[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function Gt(e,n,r){let t=xt(e),o=xt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,m)=>{let i=o[m];return c.fn!==i.fn||c.nums.length!==i.nums.length?r<1?`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,h)=>`${u}${i.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u+(i.nums[h]-u)*r}${c.units[h]}`).join(", ")})`}).join(" ")}function Tt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(Bt(t))return Oe(t,o,r);if(t.includes("("))return Gt(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),m=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&m){let i=parseFloat(c[1]),u=parseFloat(m[1]);return `${i+(u-i)*r}${c[2]||m[2]}`}return r<1?t:o}function jt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Ut=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Xt=0,$t="--scroll-draw-progress";function Yt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Je(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:o={},easing:c="ease-out",speed:m=1,once:i=false,axis:u="y",scrollContainer:h,native:S=true,velocityScale:z=false,respectReducedMotion:x=true,triggerElement:fe,onProgress:ze,onComplete:K,onEnter:Pe,onLeave:xe,onEnterBack:he,onLeaveBack:ne}=n,me=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=typeof c=="function"?c:Se[c]??Se["ease-out"],oe=De(o.start??"top bottom"),be=De(o.end??"bottom top"),Re=fe??e,Y=typeof h=="string"?document.querySelector(h):h??null,I=Object.entries(t).map(([a,f])=>({prop:jt(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Fe(){let a=window.getComputedStyle(e);for(let f of I)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function W(){for(let a of I)e.style.setProperty(a.prop,String(a.to));}let Me=new Map;for(let a of [...I.map(f=>f.prop),$t])Me.set(a,e.style.getPropertyValue(a));function Ne(){for(let[a,f]of Me)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(me)return W(),K?.(),{...r,destroy:Ne,getProgress:()=>1};Fe();let We=typeof c=="string"?Ze(c):null;function Ke(){if(!S||!Yt()||!We||u!=="y"||Y||Re!==e||i||m!==1||ze||K||Pe||xe||he||ne||z!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let a of I)if(!Ut.has(a.prop))return false;return true}function Te(){let a=`ssd-a-${++Xt}`,f=I.map(k=>`${k.prop}:${k.from}`).join(";"),X=I.map(k=>`${k.prop}:${k.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${a}{from{${f}}to{${X}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${We};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),e.classList.add(a);let $=()=>u==="x"?window.scrollX:window.scrollY,A=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(a),v.remove(),e.style.animationPlayState="",Ne();},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let F=Math.min(1,Math.max(0,k));e.classList.remove(a);for(let ce of I)e.style.setProperty(ce.prop,Tt(ce.from,ce.to,F));},getProgress(){let k=e.getBoundingClientRect(),F=$(),ce=A(),{tStart:C,tEnd:Z}=Ie({top:k.top,height:k.height},F,ce,oe,be);return ee(re(F,C,Z,m))}}}if(Ke())return Te();let G=0,q=0,se=0,$e=false,ie=false,pe=-1,H=0,Q=false,ae=NaN,ke=-1,j=0,U=()=>Y?u==="x"?Y.scrollLeft:Y.scrollTop:u==="x"?window.scrollX:window.scrollY,O=()=>Y?u==="x"?Y.clientWidth:Y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function R(){let a=Ye(Re,Y,u),f=Ie(a,a.scroll,O(),oe,be);G=f.tStart,q=f.tEnd;}function M(a){e.style.setProperty($t,String(a));for(let f of I)e.style.setProperty(f.prop,Tt(f.from,f.to,a));ze?.(a);}function V(a){if(isNaN(ae)){ae=a;return}ae<=0&&a>0?Pe?.():ae>0&&a<=0&&ne?.(),ae<1&&a>=1?xe?.():ae>=1&&a<1&&he?.(),ae=a;}function D(){if(!$e||ie)return;let a=performance.now(),f=U(),X=m;if(z!==false){let A=a-j,k=A>0?Math.abs(f-(ke<0?f:ke))/A:0;X=m*Math.max(.2,1+k*(typeof z=="number"?z:1)*.04);}ke=f,j=a;let v=q===G?0:(f-G)/(q-G);V(v);let $=ee(re(f,G,q,X));i&&(pe=Math.max(pe,$),$=pe),H=$,M($),$>=1&&!Q?(Q=true,K?.()):$<1&&!i&&(Q=false),se=requestAnimationFrame(D);}R(),q===G&&ye("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 a=ee(re(U(),G,q,m));i&&a>0&&(pe=a),H=a,M(a);}let le=new IntersectionObserver(a=>{a.forEach(f=>{$e=f.isIntersecting,$e&&!ie?se=requestAnimationFrame(D):cancelAnimationFrame(se);});},{root:Y??null}),T;function b(){clearTimeout(T),T=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),le.observe(e),Et(e,{type:"animate",getProgress:()=>H,getTrigger:()=>({tStart:G,tEnd:q})}),{destroy(){cancelAnimationFrame(se),le.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),Ne(),St(e);},replay(){pe=-1,Q=false,H=0,ie=false,M(0);},pause(){ie=true,cancelAnimationFrame(se);},resume(){ie&&(ie=false,$e&&(se=requestAnimationFrame(D)));},seek(a){let f=Math.min(1,Math.max(0,a));H=f,pe=f,ie=true,cancelAnimationFrame(se),M(f);},getProgress(){return H}}}var At={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Pt(e,n={}){if(typeof window>"u")return At;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollParallax: element not found:",e),At;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:m,onProgress:i}=n,u=r.getBoundingClientRect(),h=o==="x"?u.width:u.height,S=t*h;return Je(r,{props:o==="x"?{transform:["translateX(0px)",`translateX(${-S}px)`]}:{transform:["translateY(0px)",`translateY(${-S}px)`]},trigger:m??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:i})}function Ve(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var Ae={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dr(e,n={}){if(typeof window>"u")return Ae;let r=Ve(e).map(t=>st(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function gr(e,n={}){if(typeof window>"u")return Ae;let r=Ve(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return st(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function yr(e,n){if(typeof window>"u")return Ae;let r=Ve(e).map(t=>Je(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function hr(e,n){if(typeof window>"u")return Ae;let r=Ve(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return Je(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function br(e,n={}){if(typeof window>"u")return Ae;let r=Ve(e).map(t=>Pt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}export{yr as scrollAnimateGroup,hr as scrollAnimateSequence,dr as scrollDrawGroup,gr as scrollDrawSequence,br as scrollParallaxGroup};
3
+ <div style="position:absolute;${u?`left:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}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",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var Tt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,$t=/[MmLlHhVvCcSsQqTtAaZz]/g;function jt(e,n,r){if(!Ke)return;let t=(e.match($t)??[]).join("").toUpperCase(),o=(n.match($t)??[]).join("").toUpperCase(),c=(e.match(Tt)??[]).length,m=(n.match(Tt)??[]).length;if(t!==o){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==m&&ye(`morphTo: coordinate count differs (${c} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let m=parseFloat(c),i=t[o++]??m;return String(+(m+(i-m)*r).toFixed(4))})}function lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,o=r?{...vt[r],...t}:t,c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:i=1,fade:u=false,easing:h="linear",trigger:S={},stagger:V=0,direction:x="forward",once:fe=false,debug:qe=false,axis:J="y",scrollContainer:Pe,autoReverse:xe=false,delay:he=0,strokeColor:oe,strokeWidth:me,fillOpacity:ee,waypoints:se,velocityScale:be=false,threshold:Re=0,rootMargin:Q="0px",repeat:C=0,repeatDelay:Fe=0,morphTo:z,clip:Me,autoplay:Ne=false,duration:Be=1e3,native:tt=true,onProgress:Te,onStart:U,onComplete:W,onEnter:ie,onLeave:$e,onEnterBack:ae,onLeaveBack:pe}=o,_=Me===true?"left":typeof Me=="string"?Me:false,Z=typeof h=="function"?h:Se[h]??Se.linear,le=De(S.start??"top bottom"),ke=De(S.end??"bottom top"),X=typeof Pe=="string"?document.querySelector(Pe):Pe??null,Y=Array.isArray(oe)?oe[0]:null,O=Array.isArray(oe)?oe[1]:typeof oe=="string"?oe:null,R=Array.isArray(me)?me[0]:null,M=Array.isArray(me)?me[1]:typeof me=="number"?me:null,H=Array.isArray(ee)?ee[0]:null,D=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null;function ce(s){let l=s*100;switch(_){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=_?[]:Array.from(e.querySelectorAll(m)),b=[],a=[],f=0,q=0,v=false,$=false,A=0,te=false,B=-1,I=-1,k=false,G=0,de=0,we,rt=null;function ct(){rt?.destroy(),rt=null;}let ve=new Set,ut=NaN,Ee=true,Ge=-1,ft=performance.now(),Le=NaN;function nt(){return X?J==="x"?X.scrollLeft:X.scrollTop:J==="x"?window.scrollX:window.scrollY}function mt(){return X?J==="x"?X.clientWidth:X.clientHeight:J==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ze(e,X,J);return Ce(s,s.scroll,mt(),le,ke)}function dt(){(({tStart:f,tEnd:q}=pt())),qe&&Ke&&(ct(),rt=Gt(f,q,J));}function ot(s,l=pt){Ve(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:l});let g=s.destroy;return s.destroy=()=>{g.call(s),ze(e);},s}function Dt(s,l){if(e.style.setProperty("--scroll-draw-progress",String(s)),_){let g=l==="reverse"?1-s:s;e.style.clipPath=ce(g);return}T.forEach((g,F)=>{g.style.strokeDashoffset=l==="reverse"?`${b[F]*s}`:`${b[F]*(1-s)}`,u&&(g.style.opacity=l==="reverse"?`${1-s}`:`${s}`),Y&&O?g.style.stroke=Oe(Y,O,s):O&&(g.style.stroke=O),R!==null&&M!==null?g.style.strokeWidth=`${R+(M-R)*s}`:M!==null&&(g.style.strokeWidth=`${M}`),H!==null&&D!==null?g.style.fillOpacity=`${H+(D-H)*s}`:D!==null&&(g.style.fillOpacity=`${D}`),z&&g.tagName.toLowerCase()==="path"&&a[F]&&g.setAttribute("d",at(a[F],z,s));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),_){e.style.clipPath=ce(0);return}T.forEach((s,l)=>{s.style.strokeDasharray=`${b[l]}`,s.style.strokeDashoffset=x==="reverse"?"0":`${b[l]}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",Y&&(s.style.stroke=Y),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`),z&&s.tagName.toLowerCase()==="path"&&a[l]&&s.setAttribute("d",a[l]);});}if(T.forEach(s=>{Bt(s);let l=Ie(s);b.push(l);let g=s.tagName.toLowerCase()==="path";g?a.push(s.getAttribute("d")??""):a.push(""),z&&(g?jt(a[a.length-1],z,s):ye(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),c?(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?`${l}`:"0",u&&(s.style.opacity="1"),O&&(s.style.stroke=O),M!==null&&(s.style.strokeWidth=`${M}`),D!==null&&(s.style.fillOpacity=`${D}`),z&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",z)):(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?"0":`${l}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",Y&&(s.style.stroke=Y),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`));}),_){if(c)return e.style.clipPath=ce(1),W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ce(0);}else if(c)return W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof h=="string"?Je(h):null;function It(){return !(tt===false||!qt()||!T.length||!gt||_||J!=="y"||X||i!==1||V!==0||fe||xe||be!==false||z||se||C||he>0||Te||U||W||ie||$e||ae||pe||oe!=null||me!=null||ee!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ct(){let s=++Wt,l=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,F=`--svg-scroll-draw-${s}`,ge=x==="reverse"?"0":"var(--ssd-len)",ue=x==="reverse"?"var(--ssd-len)":"0",re=`stroke-dashoffset:${ge};`,y=`stroke-dashoffset:${ue};`;u&&(re+=`opacity:${x==="reverse"?1:0};`,y+=`opacity:${x==="reverse"?0:1};`);let w=document.createElement("style");w.setAttribute("data-svg-scroll-draw",""),w.textContent=`@keyframes ${l}{from{${re}}to{${y}}}.${g}{view-timeline-name:${F};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${F};animation-range:cover 0% cover 100%;}`,document.head.appendChild(w),e.classList.add(g);function N(p,L){p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(l);}T.forEach(N);let d=false,E=-1;function P(){if(E>=0)return E;let p=e.getBoundingClientRect(),{tStart:L,tEnd:K}=Ce({top:p.top,height:p.height},nt(),mt(),le,ke);return Z(ne(nt(),L,K,i))}return {destroy(){e.classList.remove(g),T.forEach(p=>{p.classList.remove(l),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),w.remove();},replay(){d=false,E=-1,T.forEach(N);},pause(){d=true,T.forEach(p=>{p.style.animationPlayState="paused";});},resume(){d&&(d=false,T.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let L=Math.min(1,Math.max(0,p));E=L,d=true,T.forEach((K,j)=>{K.classList.remove(l),K.style.strokeDashoffset=x==="reverse"?`${b[j]*L}`:`${b[j]*(1-L)}`,u&&(K.style.opacity=x==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return P()},refresh(){T.forEach((p,L)=>{b[L]=Ie(p),p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`;});}}}if(It())return ot(Ct());function Ot(){let s=Math.max(1,Be),l=0,g=0,F=false;function ge(d){let E=true;if(_){let P=Math.min(1,Math.max(0,d/s)),p=Z(P);G=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ce(x==="reverse"?1-p:p),Te?.(p),P<1&&(E=false);}else T.forEach((P,p)=>{let L=p*V*s,K=Math.min(1,Math.max(0,(d-L)/s)),j=Z(K);P.style.strokeDashoffset=x==="reverse"?`${b[p]*j}`:`${b[p]*(1-j)}`,u&&(P.style.opacity=x==="reverse"?`${1-j}`:`${j}`),Y&&O?P.style.stroke=Oe(Y,O,j):O&&(P.style.stroke=O),R!==null&&M!==null?P.style.strokeWidth=`${R+(M-R)*j}`:M!==null&&(P.style.strokeWidth=`${M}`),H!==null&&D!==null?P.style.fillOpacity=`${H+(D-H)*j}`:D!==null&&(P.style.fillOpacity=`${D}`),z&&P.tagName.toLowerCase()==="path"&&a[p]&&P.setAttribute("d",at(a[p],z,j)),p===0&&(G=j,Te?.(j),e.style.setProperty("--scroll-draw-progress",String(j))),K<1&&(E=false);});if(se){let P=Math.min(1,Math.max(0,d/s)),p=Z(P);for(let L in se){let K=parseFloat(L);p>=K&&!ve.has(K)&&(ve.add(K),se[L]?.());}}return E}function ue(d){if(k)return;let E=d-l;$||($=true,U?.());let P=ge(E);if(P&&!v){v=true,ge(s*(1+Math.max(0,T.length-1)*V)),W?.(),de<(C==="infinite"?1/0:C??0)&&(de++,we=setTimeout(()=>{l=performance.now(),$=false,v=false,ve.clear(),je(),A=requestAnimationFrame(ue);},Fe));return}P||(A=requestAnimationFrame(ue));}function re(){cancelAnimationFrame(A),clearTimeout(we),l=performance.now(),g=0,k=false,$=false,v=false,de=0,F=true,G=0,ve.clear(),je(),A=requestAnimationFrame(ue);}let y=new IntersectionObserver(d=>{d.forEach(E=>{E.isIntersecting&&!(fe&&v)?re():!E.isIntersecting&&!fe&&!v&&(cancelAnimationFrame(A),clearTimeout(we),F=false);});},{root:X??null,threshold:Re,rootMargin:Q}),w;function N(){clearTimeout(w),w=setTimeout(()=>{T.forEach((d,E)=>{b[E]=Ie(d),d.style.strokeDasharray=`${b[E]}`;});},150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),he>0?setTimeout(()=>y.observe(e),he):y.observe(e),{destroy(){cancelAnimationFrame(A),clearTimeout(we),y.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(w);},replay(){de=0,re();},pause(){k||!F||(k=true,g=performance.now()-l,cancelAnimationFrame(A));},resume(){k&&(k=false,F=true,l=performance.now()-g,A=requestAnimationFrame(ue));},seek(d){let E=Math.min(1,Math.max(0,d));G=E,k=true,g=E*s,l=performance.now()-g,cancelAnimationFrame(A),ge(g);},getProgress(){return G},refresh(){clearTimeout(w),T.forEach((d,E)=>{b[E]=Ie(d),d.style.strokeDasharray=`${b[E]}`;});}}}if(Ne)return ot(Ot());dt();function Ue(){if(!te||k)return;let s=performance.now(),l=nt();if(!Ee&&be===false&&l===ut){A=requestAnimationFrame(Ue);return}Ee=false,ut=l;let g=i;if(be!==false){let y=s-ft,w=y>0?Math.abs(l-(Ge<0?l:Ge))/y:0;g=i*Math.max(.2,1+w*(typeof be=="number"?be:1)*.04);}Ge=l,ft=s;let F=xe?I===-1||l>=I?"forward":"reverse":x;I=l;let ge=q-f,ue=true,re=ge===0?0:(l-f)/ge;if(isNaN(Le)||(Le<=0&&re>0?ie?.():Le>0&&re<=0&&pe?.(),Le<1&&re>=1?$e?.():Le>=1&&re<1&&ae?.()),Le=re,_){let y=Z(ne(l,f,q,g));fe&&!xe&&(B=Math.max(B,y),y=B),G=y,e.style.setProperty("--scroll-draw-progress",String(y));let w=F==="reverse"?1-y:y;e.style.clipPath=ce(w),Te?.(y),!$&&ne(l,f,q,g)>0&&($=true,U?.()),y>=1&&!v?(v=true,W?.(),de<(C==="infinite"?1/0:C??0)&&(de++,we=setTimeout(()=>{B=-1,$=false,v=false,e.style.clipPath=ce(0);},Fe))):y<1&&!fe&&(v=false),A=requestAnimationFrame(Ue);return}if(T.forEach((y,w)=>{let N=w*V*ge,d=Z(ne(l,f+N,q+N,g));fe&&!xe&&(B=Math.max(B,d),d=B),G=d,y.style.strokeDashoffset=F==="reverse"?`${b[w]*d}`:`${b[w]*(1-d)}`,u&&(y.style.opacity=F==="reverse"?`${1-d}`:`${d}`),Y&&O?y.style.stroke=Oe(Y,O,d):O&&(y.style.stroke=O),R!==null&&M!==null?y.style.strokeWidth=`${R+(M-R)*d}`:M!==null&&(y.style.strokeWidth=`${M}`),H!==null&&D!==null?y.style.fillOpacity=`${H+(D-H)*d}`:D!==null&&(y.style.fillOpacity=`${D}`),z&&y.tagName.toLowerCase()==="path"&&a[w]&&y.setAttribute("d",at(a[w],z,d)),w===0&&(Te?.(d),e.style.setProperty("--scroll-draw-progress",String(d))),d<1&&(ue=false);}),se){let y=Z(ne(l,f,q,g));for(let w in se){let N=parseFloat(w);y>=N&&!ve.has(N)&&(ve.add(N),se[w]?.());}}!$&&ne(l,f,q,g)>0&&($=true,U?.()),ue&&!v?(v=true,W?.(),de<(C==="infinite"?1/0:C??0)&&(de++,we=setTimeout(()=>{B=-1,$=false,v=false,ve.clear(),je(),Ee=true;},Fe))):!ue&&!fe&&(v=false),A=requestAnimationFrame(Ue);}let st=false;function Xe(){st||(st=true,A=requestAnimationFrame(function(){Ue();}));}function Ye(){st=false,cancelAnimationFrame(A);}let it=new IntersectionObserver(s=>{s.forEach(l=>{te=l.isIntersecting,te&&!k?(Ee=true,Xe()):Ye();});},{root:X??null,threshold:Re,rootMargin:Q});function yt(){T.forEach((s,l)=>{b[l]=Ie(s),s.style.strokeDasharray=`${b[l]}`;}),dt(),Ee=true;}let Qe;function _e(){clearTimeout(Qe),Qe=setTimeout(yt,150);}window.addEventListener("resize",_e),window.addEventListener("orientationchange",_e);let He;return typeof ResizeObserver<"u"&&(He=new ResizeObserver(()=>_e()),He.observe(document.body),He.observe(document.documentElement),He.observe(e)),he>0?setTimeout(()=>it.observe(e),he):it.observe(e),ot({destroy(){cancelAnimationFrame(A),clearTimeout(we),Ye(),it.disconnect(),He?.disconnect(),window.removeEventListener("resize",_e),window.removeEventListener("orientationchange",_e),clearTimeout(Qe),ct();},replay(){B=-1,I=-1,Ge=-1,$=false,v=false,de=0,k=false,G=0,ve.clear(),clearTimeout(we),je(),Ee=true,te&&Xe();},pause(){k=true,Ye();},resume(){k&&(k=false,Ee=true,te&&Xe());},seek(s){let l=Math.min(1,Math.max(0,s));G=l,B=l,k=true,Ye(),Dt(l,x),Ee=true;},getProgress(){return G},refresh(){clearTimeout(Qe),yt(),te&&!k&&Xe();}},()=>({tStart:f,tEnd:q}))}function Ut(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function At(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],m=t[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let u=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),c.push(u?u[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function Xt(e,n,r){let t=At(e),o=At(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,m)=>{let i=o[m];return c.fn!==i.fn||c.nums.length!==i.nums.length?r<1?`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,h)=>`${u}${i.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u+(i.nums[h]-u)*r}${c.units[h]}`).join(", ")})`}).join(" ")}function Pt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(Ut(t))return Oe(t,o,r);if(t.includes("("))return Xt(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),m=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&m){let i=parseFloat(c[1]),u=parseFloat(m[1]);return `${i+(u-i)*r}${c[2]||m[2]}`}return r<1?t:o}function Yt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Qt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Zt=0,Mt="--scroll-draw-progress";function Kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function et(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:o={},easing:c="ease-out",speed:m=1,once:i=false,axis:u="y",scrollContainer:h,native:S=true,velocityScale:V=false,respectReducedMotion:x=true,triggerElement:fe,onProgress:qe,onComplete:J,onEnter:Pe,onLeave:xe,onEnterBack:he,onLeaveBack:oe}=n,me=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=typeof c=="function"?c:Se[c]??Se["ease-out"],se=De(o.start??"top bottom"),be=De(o.end??"bottom top"),Re=fe??e,Q=typeof h=="string"?document.querySelector(h):h??null,C=Object.entries(t).map(([a,f])=>({prop:Yt(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Fe(){let a=window.getComputedStyle(e);for(let f of C)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function z(){for(let a of C)e.style.setProperty(a.prop,String(a.to));}let Me=new Map;for(let a of [...C.map(f=>f.prop),Mt])Me.set(a,e.style.getPropertyValue(a));function Ne(){for(let[a,f]of Me)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(me)return z(),J?.(),{...r,destroy:Ne,getProgress:()=>1};Fe();let Be=typeof c=="string"?Je(c):null;function tt(){if(!S||!Kt()||!Be||u!=="y"||Q||Re!==e||i||m!==1||qe||J||Pe||xe||he||oe||V!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let a of C)if(!Qt.has(a.prop))return false;return true}function Te(){let a=`ssd-a-${++Zt}`,f=C.map(I=>`${I.prop}:${I.from}`).join(";"),q=C.map(I=>`${I.prop}:${I.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${a}{from{${f}}to{${q}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Be};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),e.classList.add(a);let $=()=>u==="x"?window.scrollX:window.scrollY,A=()=>u==="x"?window.innerWidth:window.innerHeight,te=()=>{let I=e.getBoundingClientRect();return Ce({top:I.top,height:I.height},$(),A(),se,be)};Ve(e,{type:"animate",getProgress:()=>B.getProgress(),getTrigger:te});let B={destroy(){e.classList.remove(a),v.remove(),e.style.animationPlayState="",Ne(),ze(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let k=Math.min(1,Math.max(0,I));e.classList.remove(a);for(let G of C)e.style.setProperty(G.prop,Pt(G.from,G.to,k));},getProgress(){let{tStart:I,tEnd:k}=te();return ee(ne($(),I,k,m))}};return B}if(tt())return Te();let U=0,W=0,ie=0,$e=false,ae=false,pe=-1,_=0,Z=false,le=NaN,ke=-1,X=0,Y=()=>Q?u==="x"?Q.scrollLeft:Q.scrollTop:u==="x"?window.scrollX:window.scrollY,O=()=>Q?u==="x"?Q.clientWidth:Q.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function R(){let a=Ze(Re,Q,u),f=Ce(a,a.scroll,O(),se,be);U=f.tStart,W=f.tEnd;}function M(a){e.style.setProperty(Mt,String(a));for(let f of C)e.style.setProperty(f.prop,Pt(f.from,f.to,a));qe?.(a);}function H(a){if(isNaN(le)){le=a;return}le<=0&&a>0?Pe?.():le>0&&a<=0&&oe?.(),le<1&&a>=1?xe?.():le>=1&&a<1&&he?.(),le=a;}function D(){if(!$e||ae)return;let a=performance.now(),f=Y(),q=m;if(V!==false){let A=a-X,te=A>0?Math.abs(f-(ke<0?f:ke))/A:0;q=m*Math.max(.2,1+te*(typeof V=="number"?V:1)*.04);}ke=f,X=a;let v=W===U?0:(f-U)/(W-U);H(v);let $=ee(ne(f,U,W,q));i&&(pe=Math.max(pe,$),$=pe),_=$,M($),$>=1&&!Z?(Z=true,J?.()):$<1&&!i&&(Z=false),ie=requestAnimationFrame(D);}R(),W===U&&ye("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 a=ee(ne(Y(),U,W,m));i&&a>0&&(pe=a),_=a,M(a);}let ce=new IntersectionObserver(a=>{a.forEach(f=>{$e=f.isIntersecting,$e&&!ae?ie=requestAnimationFrame(D):cancelAnimationFrame(ie);});},{root:Q??null}),T;function b(){clearTimeout(T),T=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),ce.observe(e),Ve(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:U,tEnd:W})}),{destroy(){cancelAnimationFrame(ie),ce.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),Ne(),ze(e);},replay(){pe=-1,Z=false,_=0,ae=false,M(0);},pause(){ae=true,cancelAnimationFrame(ie);},resume(){ae&&(ae=false,$e&&(ie=requestAnimationFrame(D)));},seek(a){let f=Math.min(1,Math.max(0,a));_=f,pe=f,ae=true,cancelAnimationFrame(ie),M(f);},getProgress(){return _}}}var kt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,n={}){if(typeof window>"u")return kt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ye("scrollParallax: element not found:",e),kt;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:m,onProgress:i}=n,u=r.getBoundingClientRect(),h=o==="x"?u.width:u.height,S=t*h;return et(r,{props:o==="x"?{transform:["translateX(0px)",`translateX(${-S}px)`]}:{transform:["translateY(0px)",`translateY(${-S}px)`]},trigger:m??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:i})}function We(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var Ae={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function br(e,n={}){if(typeof window>"u")return Ae;let r=We(e).map(t=>lt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function wr(e,n={}){if(typeof window>"u")return Ae;let r=We(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return lt(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function vr(e,n){if(typeof window>"u")return Ae;let r=We(e).map(t=>et(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function Er(e,n){if(typeof window>"u")return Ae;let r=We(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return et(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function Sr(e,n={}){if(typeof window>"u")return Ae;let r=We(e).map(t=>Lt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}export{vr as scrollAnimateGroup,Er as scrollAnimateSequence,br as scrollDrawGroup,wr as scrollDrawSequence,Sr as scrollParallaxGroup};
@@ -1 +1 @@
1
- 'use strict';function Ce({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let h=1-Math.pow(n,f);return h+(1-h)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var N={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ce(),elastic:_e()};function U(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function ue(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function le(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function Re(e,t,r){return Math.min(r,Math.max(t,e))}function k(e,t,r,n){return r===t?0:Re((e-t)/(r-t)*n,0,1)}function me(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function Y(e,t,r,n,a){let i=ue(e.top,e.height,t,n.element)-le(n.viewport,r),l=ue(e.top,e.height,t,a.element)-le(a.viewport,r);return {tStart:i,tEnd:l}}function ce(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function pe(e,t,r){let n=ce(e),a=ce(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var Ne="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",He="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",fe=33;function Oe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<fe;r++){let n=r/(fe-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function ge(e){switch(e){case "linear":return "linear";case "ease-in":return Ne;case "ease-out":return He;case "ease-in-out":return Oe()?Fe(N["ease-in-out"]):null;default:return null}}var de=new Map;function be(e,t){de.set(e,t);}function ye(e){de.delete(e);}var De=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function H(e,...t){De&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function ze(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function he(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function Ve(e,t,r){let n=he(e),a=he(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function Ee(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(ze(n))return pe(n,a,r);if(n.includes("("))return Ve(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var ke=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Be=0,we="--scroll-draw-progress";function qe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Q(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:h=true,triggerElement:I,onProgress:b,onComplete:P,onEnter:p,onLeave:C,onEnterBack:Z,onLeaveBack:J}=t,ve=h&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=typeof i=="function"?i:N[i]??N["ease-out"],K=U(a.start??"top bottom"),ee=U(a.end??"bottom top"),te=I??e,y=typeof c=="string"?document.querySelector(c):c??null,E=Object.entries(n).map(([o,s])=>({prop:We(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function xe(){let o=window.getComputedStyle(e);for(let s of E)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Me(){for(let o of E)e.style.setProperty(o.prop,String(o.to));}let ne=new Map;for(let o of [...E.map(s=>s.prop),we])ne.set(o,e.style.getPropertyValue(o));function q(){for(let[o,s]of ne)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(ve)return Me(),P?.(),{...r,destroy:q,getProgress:()=>1};xe();let re=typeof i=="string"?ge(i):null;function Te(){if(!f||!qe()||!re||u!=="y"||y||te!==e||m||l!==1||b||P||p||C||Z||J||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of E)if(!ke.has(o.prop))return false;return true}function Pe(){let o=`ssd-a-${++Be}`,s=E.map(d=>`${d.prop}:${d.from}`).join(";"),V=E.map(d=>`${d.prop}:${d.to}`).join(";"),$=document.createElement("style");$.setAttribute("data-ssd-animate",""),$.textContent=`@keyframes ${o}{from{${s}}to{${V}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${re};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(o);let S=()=>u==="x"?window.scrollX:window.scrollY,W=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),$.remove(),e.style.animationPlayState="",q();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let _=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let R of E)e.style.setProperty(R.prop,Ee(R.from,R.to,_));},getProgress(){let d=e.getBoundingClientRect(),_=S(),R=W(),{tStart:$e,tEnd:Ie}=Y({top:d.top,height:d.height},_,R,K,ee);return B(k(_,$e,Ie,l))}}}if(Te())return Pe();let w=0,v=0,x=0,O=false,M=false,A=-1,L=0,F=false,T=NaN,G=-1,oe=0,se=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ie(){let o=me(te,y,u),s=Y(o,o.scroll,Ae(),K,ee);w=s.tStart,v=s.tEnd;}function D(o){e.style.setProperty(we,String(o));for(let s of E)e.style.setProperty(s.prop,Ee(s.from,s.to,o));b?.(o);}function Le(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&J?.(),T<1&&o>=1?C?.():T>=1&&o<1&&Z?.(),T=o;}function j(){if(!O||M)return;let o=performance.now(),s=se(),V=l;if(g!==false){let W=o-oe,d=W>0?Math.abs(s-(G<0?s:G))/W:0;V=l*Math.max(.2,1+d*(typeof g=="number"?g:1)*.04);}G=s,oe=o;let $=v===w?0:(s-w)/(v-w);Le($);let S=B(k(s,w,v,V));m&&(A=Math.max(A,S),S=A),L=S,D(S),S>=1&&!F?(F=true,P?.()):S<1&&!m&&(F=false),x=requestAnimationFrame(j);}ie(),v===w&&H("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=B(k(se(),w,v,l));m&&o>0&&(A=o),L=o,D(o);}let ae=new IntersectionObserver(o=>{o.forEach(s=>{O=s.isIntersecting,O&&!M?x=requestAnimationFrame(j):cancelAnimationFrame(x);});},{root:y??null}),X;function z(){clearTimeout(X),X=setTimeout(ie,150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),ae.observe(e),be(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:w,tEnd:v})}),{destroy(){cancelAnimationFrame(x),ae.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(X),q(),ye(e);},replay(){A=-1,F=false,L=0,M=false,D(0);},pause(){M=true,cancelAnimationFrame(x);},resume(){M&&(M=false,O&&(x=requestAnimationFrame(j)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,A=s,M=true,cancelAnimationFrame(x),D(s);},getProgress(){return L}}}var Se={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function rt(e,t={}){if(typeof window>"u")return Se;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return H("scrollHorizontal: track element not found:",e),Se;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;H("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let h=f(),I=g(),b=Q(n,P(h,I));function P(p,C){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...C!==n&&{triggerElement:C},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),h=f(),I=g(),b=Q(n,P(h,I));}}}exports.scrollHorizontal=rt;
1
+ 'use strict';function Re({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let E=1-Math.pow(n,f);return E+(1-E)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var R={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:Re(),elastic:_e()};function Q(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function pe(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function fe(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function Ne(e,t,r){return Math.min(r,Math.max(t,e))}function k(e,t,r,n){return r===t?0:Ne((e-t)/(r-t)*n,0,1)}function de(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function K(e,t,r,n,a){let i=pe(e.top,e.height,t,n.element)-fe(n.viewport,r),l=pe(e.top,e.height,t,a.element)-fe(a.viewport,r);return {tStart:i,tEnd:l}}function ge(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function be(e,t,r){let n=ge(e),a=ge(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var He="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<ye;r++){let n=r/(ye-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function he(e){switch(e){case "linear":return "linear";case "ease-in":return He;case "ease-out":return Oe;case "ease-in-out":return De()?Fe(R["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function Z(e,t){we().set(e,t);}function J(e){we().delete(e);}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 _(e,...t){ze&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Ve(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function ke(e,t,r){let n=Se(e),a=Se(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function ve(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(Ve(n))return be(n,a,r);if(n.includes("("))return ke(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),qe=0,xe="--scroll-draw-progress";function Ge(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ee(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:E=true,triggerElement:$,onProgress:b,onComplete:P,onEnter:p,onLeave:C,onEnterBack:te,onLeaveBack:ne}=t,Te=E&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:R[i]??R["ease-out"],re=Q(a.start??"top bottom"),oe=Q(a.end??"bottom top"),se=$??e,y=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(n).map(([o,s])=>({prop:We(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Pe(){let o=window.getComputedStyle(e);for(let s of w)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Ae(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}let ie=new Map;for(let o of [...w.map(s=>s.prop),xe])ie.set(o,e.style.getPropertyValue(o));function B(){for(let[o,s]of ie)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Te)return Ae(),P?.(),{...r,destroy:B,getProgress:()=>1};Pe();let ae=typeof i=="string"?he(i):null;function Le(){if(!f||!Ge()||!ae||u!=="y"||y||se!==e||m||l!==1||b||P||p||C||te||ne||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Be.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++qe}`,s=w.map(d=>`${d.prop}:${d.from}`).join(";"),F=w.map(d=>`${d.prop}:${d.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${o}{from{${s}}to{${F}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ae};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(o);let h=()=>u==="x"?window.scrollX:window.scrollY,z=()=>u==="x"?window.innerWidth:window.innerHeight,V=()=>{let d=e.getBoundingClientRect();return K({top:d.top,height:d.height},h(),z(),re,oe)};Z(e,{type:"animate",getProgress:()=>X.getProgress(),getTrigger:V});let X={destroy(){e.classList.remove(o),I.remove(),e.style.animationPlayState="",B(),J(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let U=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let Y of w)e.style.setProperty(Y.prop,ve(Y.from,Y.to,U));},getProgress(){let{tStart:d,tEnd:U}=V();return W(k(h(),d,U,l))}};return X}if(Le())return Ie();let S=0,v=0,x=0,N=false,M=false,A=-1,L=0,H=false,T=NaN,q=-1,ue=0,le=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=de(se,y,u),s=K(o,o.scroll,$e(),re,oe);S=s.tStart,v=s.tEnd;}function O(o){e.style.setProperty(xe,String(o));for(let s of w)e.style.setProperty(s.prop,ve(s.from,s.to,o));b?.(o);}function Ce(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&ne?.(),T<1&&o>=1?C?.():T>=1&&o<1&&te?.(),T=o;}function G(){if(!N||M)return;let o=performance.now(),s=le(),F=l;if(g!==false){let z=o-ue,V=z>0?Math.abs(s-(q<0?s:q))/z:0;F=l*Math.max(.2,1+V*(typeof g=="number"?g:1)*.04);}q=s,ue=o;let I=v===S?0:(s-S)/(v-S);Ce(I);let h=W(k(s,S,v,F));m&&(A=Math.max(A,h),h=A),L=h,O(h),h>=1&&!H?(H=true,P?.()):h<1&&!m&&(H=false),x=requestAnimationFrame(G);}ce(),v===S&&_("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=W(k(le(),S,v,l));m&&o>0&&(A=o),L=o,O(o);}let me=new IntersectionObserver(o=>{o.forEach(s=>{N=s.isIntersecting,N&&!M?x=requestAnimationFrame(G):cancelAnimationFrame(x);});},{root:y??null}),j;function D(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),me.observe(e),Z(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:S,tEnd:v})}),{destroy(){cancelAnimationFrame(x),me.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(j),B(),J(e);},replay(){A=-1,H=false,L=0,M=false,O(0);},pause(){M=true,cancelAnimationFrame(x);},resume(){M&&(M=false,N&&(x=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,A=s,M=true,cancelAnimationFrame(x),O(s);},getProgress(){return L}}}var Me={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function ot(e,t={}){if(typeof window>"u")return Me;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return _("scrollHorizontal: track element not found:",e),Me;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;_("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let E=f(),$=g(),b=ee(n,P(E,$));function P(p,C){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...C!==n&&{triggerElement:C},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),E=f(),$=g(),b=ee(n,P(E,$));}}}exports.scrollHorizontal=ot;
@@ -1 +1 @@
1
- function Ce({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let h=1-Math.pow(n,f);return h+(1-h)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var N={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Ce(),elastic:_e()};function U(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function ue(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function le(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function Re(e,t,r){return Math.min(r,Math.max(t,e))}function k(e,t,r,n){return r===t?0:Re((e-t)/(r-t)*n,0,1)}function me(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function Y(e,t,r,n,a){let i=ue(e.top,e.height,t,n.element)-le(n.viewport,r),l=ue(e.top,e.height,t,a.element)-le(a.viewport,r);return {tStart:i,tEnd:l}}function ce(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function pe(e,t,r){let n=ce(e),a=ce(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var Ne="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",He="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",fe=33;function Oe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<fe;r++){let n=r/(fe-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function ge(e){switch(e){case "linear":return "linear";case "ease-in":return Ne;case "ease-out":return He;case "ease-in-out":return Oe()?Fe(N["ease-in-out"]):null;default:return null}}var de=new Map;function be(e,t){de.set(e,t);}function ye(e){de.delete(e);}var De=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function H(e,...t){De&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function ze(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function he(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function Ve(e,t,r){let n=he(e),a=he(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function Ee(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(ze(n))return pe(n,a,r);if(n.includes("("))return Ve(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var ke=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Be=0,we="--scroll-draw-progress";function qe(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Q(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:h=true,triggerElement:I,onProgress:b,onComplete:P,onEnter:p,onLeave:C,onEnterBack:Z,onLeaveBack:J}=t,ve=h&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,B=typeof i=="function"?i:N[i]??N["ease-out"],K=U(a.start??"top bottom"),ee=U(a.end??"bottom top"),te=I??e,y=typeof c=="string"?document.querySelector(c):c??null,E=Object.entries(n).map(([o,s])=>({prop:We(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function xe(){let o=window.getComputedStyle(e);for(let s of E)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Me(){for(let o of E)e.style.setProperty(o.prop,String(o.to));}let ne=new Map;for(let o of [...E.map(s=>s.prop),we])ne.set(o,e.style.getPropertyValue(o));function q(){for(let[o,s]of ne)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(ve)return Me(),P?.(),{...r,destroy:q,getProgress:()=>1};xe();let re=typeof i=="string"?ge(i):null;function Te(){if(!f||!qe()||!re||u!=="y"||y||te!==e||m||l!==1||b||P||p||C||Z||J||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of E)if(!ke.has(o.prop))return false;return true}function Pe(){let o=`ssd-a-${++Be}`,s=E.map(d=>`${d.prop}:${d.from}`).join(";"),V=E.map(d=>`${d.prop}:${d.to}`).join(";"),$=document.createElement("style");$.setAttribute("data-ssd-animate",""),$.textContent=`@keyframes ${o}{from{${s}}to{${V}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${re};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild($),e.classList.add(o);let S=()=>u==="x"?window.scrollX:window.scrollY,W=()=>u==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(o),$.remove(),e.style.animationPlayState="",q();},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let _=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let R of E)e.style.setProperty(R.prop,Ee(R.from,R.to,_));},getProgress(){let d=e.getBoundingClientRect(),_=S(),R=W(),{tStart:$e,tEnd:Ie}=Y({top:d.top,height:d.height},_,R,K,ee);return B(k(_,$e,Ie,l))}}}if(Te())return Pe();let w=0,v=0,x=0,O=false,M=false,A=-1,L=0,F=false,T=NaN,G=-1,oe=0,se=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ie(){let o=me(te,y,u),s=Y(o,o.scroll,Ae(),K,ee);w=s.tStart,v=s.tEnd;}function D(o){e.style.setProperty(we,String(o));for(let s of E)e.style.setProperty(s.prop,Ee(s.from,s.to,o));b?.(o);}function Le(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&J?.(),T<1&&o>=1?C?.():T>=1&&o<1&&Z?.(),T=o;}function j(){if(!O||M)return;let o=performance.now(),s=se(),V=l;if(g!==false){let W=o-oe,d=W>0?Math.abs(s-(G<0?s:G))/W:0;V=l*Math.max(.2,1+d*(typeof g=="number"?g:1)*.04);}G=s,oe=o;let $=v===w?0:(s-w)/(v-w);Le($);let S=B(k(s,w,v,V));m&&(A=Math.max(A,S),S=A),L=S,D(S),S>=1&&!F?(F=true,P?.()):S<1&&!m&&(F=false),x=requestAnimationFrame(j);}ie(),v===w&&H("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=B(k(se(),w,v,l));m&&o>0&&(A=o),L=o,D(o);}let ae=new IntersectionObserver(o=>{o.forEach(s=>{O=s.isIntersecting,O&&!M?x=requestAnimationFrame(j):cancelAnimationFrame(x);});},{root:y??null}),X;function z(){clearTimeout(X),X=setTimeout(ie,150);}return window.addEventListener("resize",z),window.addEventListener("orientationchange",z),ae.observe(e),be(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:w,tEnd:v})}),{destroy(){cancelAnimationFrame(x),ae.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),clearTimeout(X),q(),ye(e);},replay(){A=-1,F=false,L=0,M=false,D(0);},pause(){M=true,cancelAnimationFrame(x);},resume(){M&&(M=false,O&&(x=requestAnimationFrame(j)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,A=s,M=true,cancelAnimationFrame(x),D(s);},getProgress(){return L}}}var Se={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function rt(e,t={}){if(typeof window>"u")return Se;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return H("scrollHorizontal: track element not found:",e),Se;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;H("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let h=f(),I=g(),b=Q(n,P(h,I));function P(p,C){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...C!==n&&{triggerElement:C},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),h=f(),I=g(),b=Q(n,P(h,I));}}}export{rt as scrollHorizontal};
1
+ function Re({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(n),i=0,l=[];for(let c=0;c<r;c++){let f=Math.pow(a,c);l.push(f),i+=f;}let m=[0],u=0;for(let c=0;c<r;c++)u+=l[c]/i,m.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let f=0;f<r;f++)if(c<=m[f+1]){let g=(c-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let E=1-Math.pow(n,f);return E+(1-E)*(2*g-1)*(2*g-1)}return 1}}function _e({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),a=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/n)+1}var R={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:Re(),elastic:_e()};function Q(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function pe(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function fe(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function Ne(e,t,r){return Math.min(r,Math.max(t,e))}function k(e,t,r,n){return r===t?0:Ne((e-t)/(r-t)*n,0,1)}function de(e,t,r){let n=e.getBoundingClientRect(),a=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:a,scroll:0}:{top:r==="x"?n.left:n.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function K(e,t,r,n,a){let i=pe(e.top,e.height,t,n.element)-fe(n.viewport,r),l=pe(e.top,e.height,t,a.element)-fe(a.viewport,r);return {tStart:i,tEnd:l}}function ge(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function be(e,t,r){let n=ge(e),a=ge(t);return !n||!a?e:`rgb(${Math.round(n[0]+(a[0]-n[0])*r)},${Math.round(n[1]+(a[1]-n[1])*r)},${Math.round(n[2]+(a[2]-n[2])*r)})`}var He="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Fe(e){let t=[];for(let r=0;r<ye;r++){let n=r/(ye-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function he(e){switch(e){case "linear":return "linear";case "ease-in":return He;case "ease-out":return Oe;case "ease-in-out":return De()?Fe(R["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function Z(e,t){we().set(e,t);}function J(e){we().delete(e);}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 _(e,...t){ze&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Ve(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let a=[],i=[],l=n[2].trim();if(l)for(let m of l.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}t.push({fn:n[1],nums:a,units:i});}return t}function ke(e,t,r){let n=Se(e),a=Se(t);return n.length===0||n.length!==a.length?r<1?e:t:n.map((i,l)=>{let m=a[l];return i.fn!==m.fn||i.nums.length!==m.nums.length?r<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,c)=>`${u}${m.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(m.nums[c]-u)*r}${i.units[c]}`).join(", ")})`}).join(" ")}function ve(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),a=String(t);if(Ve(n))return be(n,a,r);if(n.includes("("))return ke(n,a,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let m=parseFloat(i[1]),u=parseFloat(l[1]);return `${m+(u-m)*r}${i[2]||l[2]}`}return r<1?n:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Be=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),qe=0,xe="--scroll-draw-progress";function Ge(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ee(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:a={},easing:i="ease-out",speed:l=1,once:m=false,axis:u="y",scrollContainer:c,native:f=true,velocityScale:g=false,respectReducedMotion:E=true,triggerElement:$,onProgress:b,onComplete:P,onEnter:p,onLeave:C,onEnterBack:te,onLeaveBack:ne}=t,Te=E&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,W=typeof i=="function"?i:R[i]??R["ease-out"],re=Q(a.start??"top bottom"),oe=Q(a.end??"bottom top"),se=$??e,y=typeof c=="string"?document.querySelector(c):c??null,w=Object.entries(n).map(([o,s])=>({prop:We(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Pe(){let o=window.getComputedStyle(e);for(let s of w)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Ae(){for(let o of w)e.style.setProperty(o.prop,String(o.to));}let ie=new Map;for(let o of [...w.map(s=>s.prop),xe])ie.set(o,e.style.getPropertyValue(o));function B(){for(let[o,s]of ie)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Te)return Ae(),P?.(),{...r,destroy:B,getProgress:()=>1};Pe();let ae=typeof i=="string"?he(i):null;function Le(){if(!f||!Ge()||!ae||u!=="y"||y||se!==e||m||l!==1||b||P||p||C||te||ne||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of w)if(!Be.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++qe}`,s=w.map(d=>`${d.prop}:${d.from}`).join(";"),F=w.map(d=>`${d.prop}:${d.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${o}{from{${s}}to{${F}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ae};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(o);let h=()=>u==="x"?window.scrollX:window.scrollY,z=()=>u==="x"?window.innerWidth:window.innerHeight,V=()=>{let d=e.getBoundingClientRect();return K({top:d.top,height:d.height},h(),z(),re,oe)};Z(e,{type:"animate",getProgress:()=>X.getProgress(),getTrigger:V});let X={destroy(){e.classList.remove(o),I.remove(),e.style.animationPlayState="",B(),J(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let U=Math.min(1,Math.max(0,d));e.classList.remove(o);for(let Y of w)e.style.setProperty(Y.prop,ve(Y.from,Y.to,U));},getProgress(){let{tStart:d,tEnd:U}=V();return W(k(h(),d,U,l))}};return X}if(Le())return Ie();let S=0,v=0,x=0,N=false,M=false,A=-1,L=0,H=false,T=NaN,q=-1,ue=0,le=()=>y?u==="x"?y.scrollLeft:y.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>y?u==="x"?y.clientWidth:y.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=de(se,y,u),s=K(o,o.scroll,$e(),re,oe);S=s.tStart,v=s.tEnd;}function O(o){e.style.setProperty(xe,String(o));for(let s of w)e.style.setProperty(s.prop,ve(s.from,s.to,o));b?.(o);}function Ce(o){if(isNaN(T)){T=o;return}T<=0&&o>0?p?.():T>0&&o<=0&&ne?.(),T<1&&o>=1?C?.():T>=1&&o<1&&te?.(),T=o;}function G(){if(!N||M)return;let o=performance.now(),s=le(),F=l;if(g!==false){let z=o-ue,V=z>0?Math.abs(s-(q<0?s:q))/z:0;F=l*Math.max(.2,1+V*(typeof g=="number"?g:1)*.04);}q=s,ue=o;let I=v===S?0:(s-S)/(v-S);Ce(I);let h=W(k(s,S,v,F));m&&(A=Math.max(A,h),h=A),L=h,O(h),h>=1&&!H?(H=true,P?.()):h<1&&!m&&(H=false),x=requestAnimationFrame(G);}ce(),v===S&&_("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=W(k(le(),S,v,l));m&&o>0&&(A=o),L=o,O(o);}let me=new IntersectionObserver(o=>{o.forEach(s=>{N=s.isIntersecting,N&&!M?x=requestAnimationFrame(G):cancelAnimationFrame(x);});},{root:y??null}),j;function D(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",D),window.addEventListener("orientationchange",D),me.observe(e),Z(e,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:S,tEnd:v})}),{destroy(){cancelAnimationFrame(x),me.disconnect(),window.removeEventListener("resize",D),window.removeEventListener("orientationchange",D),clearTimeout(j),B(),J(e);},replay(){A=-1,H=false,L=0,M=false,O(0);},pause(){M=true,cancelAnimationFrame(x);},resume(){M&&(M=false,N&&(x=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));L=s,A=s,M=true,cancelAnimationFrame(x),O(s);},getProgress(){return L}}}var Me={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function ot(e,t={}){if(typeof window>"u")return Me;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return _("scrollHorizontal: track element not found:",e),Me;let n=r,{easing:a="linear",trigger:i={start:"top top",end:"bottom bottom"},scrollContainer:l,respectReducedMotion:m=false,onProgress:u}=t;function c(){let p=typeof l=="string"?document.querySelector(l):l??null;return p?p.clientWidth:window.innerWidth}function f(){return t.distance??n.scrollWidth-c()}function g(){if(t.triggerElement!==void 0){let p=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(p)return p;_("scrollHorizontal: triggerElement not found:",t.triggerElement);}for(let p=n.parentElement;p;p=p.parentElement)if(window.getComputedStyle(p).position==="sticky")return p.parentElement??p;return n}let E=f(),$=g(),b=ee(n,P(E,$));function P(p,C){return {props:{transform:["translateX(0px)",`translateX(${-p}px)`]},trigger:i,easing:a,native:false,respectReducedMotion:m,...C!==n&&{triggerElement:C},...l!==void 0&&{scrollContainer:l},...u!==void 0&&{onProgress:u}}}return {destroy(){b.destroy();},replay(){b.replay();},pause(){b.pause();},resume(){b.resume();},seek(p){b.seek(p);},getProgress(){return b.getProgress()},refresh(){b.destroy(),E=f(),$=g(),b=ee(n,P(E,$));}}}export{ot as scrollHorizontal};
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';function Ft({tension:e=2.5,friction:t=2.2}={}){return r=>1-Math.cos(r*Math.PI*e)*Math.pow(1-r,t)}function vt({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),l=Math.sqrt(n),a=0,d=[];for(let f=0;f<r;f++){let E=Math.pow(l,f);d.push(E),a+=E;}let m=[0],c=0;for(let f=0;f<r;f++)c+=d[f]/a,m.push(c);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let E=0;E<r;E++)if(f<=m[E+1]){let I=(f-m[E])/(m[E+1]-m[E]);if(E===0)return I*(2-I);let T=1-Math.pow(n,E);return T+(1-T)*(2*I-1)*(2*I-1)}return 1}}function St({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),l=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return a=>a<=0?0:a>=1?1:r*Math.pow(2,-10*a)*Math.sin((a-l)*(2*Math.PI)/n)+1}var J={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:vt(),elastic:St()};function $e(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function ht(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function bt(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function He(e){let t=e.tagName.toLowerCase();if(t==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(r+n)}if(t==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Nt(e,t,r){return Math.min(r,Math.max(t,e))}function ie(e,t,r,n){return r===t?0:Nt((e-t)/(r-t)*n,0,1)}function Xe(e,t,r){let n=e.getBoundingClientRect(),l=r==="x"?n.width:n.height;return t?{top:r==="x"?n.left-t.getBoundingClientRect().left+t.scrollLeft:n.top-t.getBoundingClientRect().top+t.scrollTop,height:l,scroll:0}:{top:r==="x"?n.left:n.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function Oe(e,t,r,n,l){let a=ht(e.top,e.height,t,n.element)-bt(n.viewport,r),d=ht(e.top,e.height,t,l.element)-bt(l.viewport,r);return {tStart:a,tEnd:d}}function wt(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function _e(e,t,r){let n=wt(e),l=wt(t);return !n||!l?e:`rgb(${Math.round(n[0]+(l[0]-n[0])*r)},${Math.round(n[1]+(l[1]-n[1])*r)},${Math.round(n[2]+(l[2]-n[2])*r)})`}var st={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 Ye=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function K(e,...t){Ye&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var Ht="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",_t="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Et=33;function zt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Vt(e){let t=[];for(let r=0;r<Et;r++){let n=r/(Et-1);t.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${t.join(",")})`}function Qe(e){switch(e){case "linear":return "linear";case "ease-in":return Ht;case "ease-out":return _t;case "ease-in-out":return zt()?Vt(J["ease-in-out"]):null;default:return null}}var qt=0;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Bt(e){let t=e.getAttribute("stroke"),r=e.getAttribute("fill");!t||t==="none"?K("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Gt(e,t,r){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let a=r==="x"?window.scrollX:window.scrollY,d=e-a,m=t-a,c=r==="x";n.innerHTML=`
1
+ 'use strict';function _t({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Et({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(n),a=0,d=[];for(let f=0;f<t;f++){let x=Math.pow(l,f);d.push(x),a+=x;}let m=[0],c=0;for(let f=0;f<t;f++)c+=d[f]/a,m.push(c);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let x=0;x<t;x++)if(f<=m[x+1]){let D=(f-m[x])/(m[x+1]-m[x]);if(x===0)return D*(2-D);let A=1-Math.pow(n,x);return A+(1-A)*(2*D-1)*(2*D-1)}return 1}}function xt({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),l=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-l)*(2*Math.PI)/n)+1}var Z={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:Et(),elastic:xt()};function $e(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function wt(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function vt(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 ze(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function zt(e,r,t){return Math.min(t,Math.max(r,e))}function le(e,r,t,n){return t===r?0:zt((e-r)/(t-r)*n,0,1)}function Qe(e,r,t){let n=e.getBoundingClientRect(),l=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left+r.scrollLeft:n.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:t==="x"?n.left:n.top,height:l,scroll:t==="x"?window.scrollX:window.scrollY}}function Fe(e,r,t,n,l){let a=wt(e.top,e.height,r,n.element)-vt(n.viewport,t),d=wt(e.top,e.height,r,l.element)-vt(l.viewport,t);return {tStart:a,tEnd:d}}function St(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 t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function Ve(e,r,t){let n=St(e),l=St(r);return !n||!l?e:`rgb(${Math.round(n[0]+(l[0]-n[0])*t)},${Math.round(n[1]+(l[1]-n[1])*t)},${Math.round(n[2]+(l[2]-n[2])*t)})`}var it={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 K(e,...r){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Vt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",qt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Tt=33;function Wt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Bt(e){let r=[];for(let t=0;t<Tt;t++){let n=t/(Tt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function Ke(e){switch(e){case "linear":return "linear";case "ease-in":return Vt;case "ease-out":return qt;case "ease-in-out":return Wt()?Bt(Z["ease-in-out"]):null;default:return null}}var At=Symbol.for("svg-scroll-draw.registry");function $t(){let e=globalThis;return e[At]||(e[At]=new Map)}function Me(e,r){$t().set(e,r);}function Pe(e){$t().delete(e);}var Gt=0;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Yt(e){let r=e.getAttribute("stroke"),t=e.getAttribute("fill");!r||r==="none"?K("Element has no stroke \u2014 path will not be visible.",e):t&&t!=="none"&&t!=="transparent"&&K("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Ut(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let a=t==="x"?window.scrollX:window.scrollY,d=e-a,m=r-a,c=t==="x";n.innerHTML=`
2
2
  <div style="position:absolute;${c?`left:${d}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${d}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:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",l,{passive:true}),l(),{el:n,destroy(){window.removeEventListener("scroll",l),n.remove();}}}var xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Tt=/[MmLlHhVvCcSsQqTtAaZz]/g;function jt(e,t,r){if(!Ye)return;let n=(e.match(Tt)??[]).join("").toUpperCase(),l=(t.match(Tt)??[]).join("").toUpperCase(),a=(e.match(xt)??[]).length,d=(t.match(xt)??[]).length;if(n!==l){K(`morphTo: command sequence differs (${n||"\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.`,r);return}a!==d&&K(`morphTo: coordinate count differs (${a} \u2192 ${d}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let d=parseFloat(a),m=n[l++]??d;return String(+(d+(m-d)*r).toFixed(4))})}function At(e,t={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...n}=t,l=r?{...st[r],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:E={},stagger:I=0,direction:T="forward",once:ee=false,debug:Ee=false,axis:A="y",scrollContainer:$,autoReverse:g=false,delay:S=0,strokeColor:h,strokeWidth:V,fillOpacity:F,waypoints:B,velocityScale:te=false,threshold:de=0,rootMargin:j="0px",repeat:q=0,repeatDelay:Me=0,morphTo:N,clip:ge,autoplay:Pe=false,duration:ke=1e3,native:Le=true,onProgress:b,onStart:P,onComplete:oe,onEnter:ye,onLeave:Re,onEnterBack:he,onLeaveBack:xe}=l,re=ge===true?"left":typeof ge=="string"?ge:false,ue=typeof f=="function"?f:J[f]??J.linear,be=$e(E.start??"top bottom"),Fe=$e(E.end??"bottom top"),ae=typeof $=="string"?document.querySelector($):$??null,le=Array.isArray(h)?h[0]:null,U=Array.isArray(h)?h[1]:typeof h=="string"?h:null,X=Array.isArray(V)?V[0]:null,H=Array.isArray(V)?V[1]:typeof V=="number"?V:null,ne=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function we(o){let i=o*100;switch(re){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let C=re?[]:Array.from(e.querySelectorAll(d)),x=[],s=[],u=0,ce=0,k=false,D=false,O=0,_=false,Y=-1,ve=-1,G=false,me=0,Te=0,Ce,tt=null;function ut(){tt?.destroy(),tt=null;}let Ie=new Set,mt=NaN,De=true,qe=-1,ft=performance.now(),Ne=NaN;function rt(){return ae?A==="x"?ae.scrollLeft:ae.scrollTop:A==="x"?window.scrollX:window.scrollY}function pt(){return ae?A==="x"?ae.clientWidth:ae.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function dt(){let o=Xe(e,ae,A),i=Oe(o,o.scroll,pt(),be,Fe);u=i.tStart,ce=i.tEnd,Ee&&Ye&&(ut(),tt=Gt(u,ce,A));}function It(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),re){let w=i==="reverse"?1-o:o;e.style.clipPath=we(w);return}C.forEach((w,Q)=>{w.style.strokeDashoffset=i==="reverse"?`${x[Q]*o}`:`${x[Q]*(1-o)}`,c&&(w.style.opacity=i==="reverse"?`${1-o}`:`${o}`),le&&U?w.style.stroke=_e(le,U,o):U&&(w.style.stroke=U),X!==null&&H!==null?w.style.strokeWidth=`${X+(H-X)*o}`:H!==null&&(w.style.strokeWidth=`${H}`),ne!==null&&W!==null?w.style.fillOpacity=`${ne+(W-ne)*o}`:W!==null&&(w.style.fillOpacity=`${W}`),N&&w.tagName.toLowerCase()==="path"&&s[Q]&&w.setAttribute("d",it(s[Q],N,o));});}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),re){e.style.clipPath=we(0);return}C.forEach((o,i)=>{o.style.strokeDasharray=`${x[i]}`,o.style.strokeDashoffset=T==="reverse"?"0":`${x[i]}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),X!==null&&(o.style.strokeWidth=`${X}`),ne!==null&&(o.style.fillOpacity=`${ne}`),N&&o.tagName.toLowerCase()==="path"&&s[i]&&o.setAttribute("d",s[i]);});}if(C.forEach(o=>{Bt(o);let i=He(o);x.push(i);let w=o.tagName.toLowerCase()==="path";w?s.push(o.getAttribute("d")??""):s.push(""),N&&(w?jt(s[s.length-1],N,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=T==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),U&&(o.style.stroke=U),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=T==="reverse"?"0":`${i}`,c?o.style.opacity=T==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),X!==null&&(o.style.strokeWidth=`${X}`),ne!==null&&(o.style.fillOpacity=`${ne}`));}),re){if(a)return e.style.clipPath=we(1),oe?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=we(0);}else if(a)return oe?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof f=="string"?Qe(f):null;function Dt(){return !(Le===false||!Wt()||!C.length||!gt||re||A!=="y"||ae||m!==1||I!==0||ee||g||te!==false||N||B||q||S>0||b||P||oe||ye||Re||he||xe||h!=null||V!=null||F!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Ot(){let o=++qt,i=`svg-scroll-draw-${o}`,w=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Ae=T==="reverse"?"0":"var(--ssd-len)",Se=T==="reverse"?"var(--ssd-len)":"0",pe=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(pe+=`opacity:${T==="reverse"?1:0};`,v+=`opacity:${T==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${i}{from{${pe}}to{${v}}}.${w}{view-timeline-name:${Q};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(w);function Z(p,z){p.style.setProperty("--ssd-len",String(x[z])),p.style.strokeDasharray=`${x[z]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(i);}C.forEach(Z);let y=false,L=-1;function R(){if(L>=0)return L;let p=e.getBoundingClientRect(),{tStart:z,tEnd:fe}=Oe({top:p.top,height:p.height},rt(),pt(),be,Fe);return ue(ie(rt(),z,fe,m))}return {destroy(){e.classList.remove(w),C.forEach(p=>{p.classList.remove(i),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),M.remove();},replay(){y=false,L=-1,C.forEach(Z);},pause(){y=true,C.forEach(p=>{p.style.animationPlayState="paused";});},resume(){y&&(y=false,C.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let z=Math.min(1,Math.max(0,p));L=z,y=true,C.forEach((fe,se)=>{fe.classList.remove(i),fe.style.strokeDashoffset=T==="reverse"?`${x[se]*z}`:`${x[se]*(1-z)}`,c&&(fe.style.opacity=T==="reverse"?`${1-z}`:`${z}`);});},getProgress(){return R()},refresh(){C.forEach((p,z)=>{x[z]=He(p),p.style.setProperty("--ssd-len",String(x[z])),p.style.strokeDasharray=`${x[z]}`;});}}}if(Dt())return Ot();function Rt(){let o=Math.max(1,ke),i=0,w=0,Q=false;function Ae(y){let L=true;if(re){let R=Math.min(1,Math.max(0,y/o)),p=ue(R);me=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=we(T==="reverse"?1-p:p),b?.(p),R<1&&(L=false);}else C.forEach((R,p)=>{let z=p*I*o,fe=Math.min(1,Math.max(0,(y-z)/o)),se=ue(fe);R.style.strokeDashoffset=T==="reverse"?`${x[p]*se}`:`${x[p]*(1-se)}`,c&&(R.style.opacity=T==="reverse"?`${1-se}`:`${se}`),le&&U?R.style.stroke=_e(le,U,se):U&&(R.style.stroke=U),X!==null&&H!==null?R.style.strokeWidth=`${X+(H-X)*se}`:H!==null&&(R.style.strokeWidth=`${H}`),ne!==null&&W!==null?R.style.fillOpacity=`${ne+(W-ne)*se}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[p]&&R.setAttribute("d",it(s[p],N,se)),p===0&&(me=se,b?.(se),e.style.setProperty("--scroll-draw-progress",String(se))),fe<1&&(L=false);});if(B){let R=Math.min(1,Math.max(0,y/o)),p=ue(R);for(let z in B){let fe=parseFloat(z);p>=fe&&!Ie.has(fe)&&(Ie.add(fe),B[z]?.());}}return L}function Se(y){if(G)return;let L=y-i;D||(D=true,P?.());let R=Ae(L);if(R&&!k){k=true,Ae(o*(1+Math.max(0,C.length-1)*I)),oe?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ce=setTimeout(()=>{i=performance.now(),D=false,k=false,Ie.clear(),We(),O=requestAnimationFrame(Se);},Me));return}R||(O=requestAnimationFrame(Se));}function pe(){cancelAnimationFrame(O),clearTimeout(Ce),i=performance.now(),w=0,G=false,D=false,k=false,Te=0,Q=true,me=0,Ie.clear(),We(),O=requestAnimationFrame(Se);}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(ee&&k)?pe():!L.isIntersecting&&!ee&&!k&&(cancelAnimationFrame(O),clearTimeout(Ce),Q=false);});},{root:ae??null,threshold:de,rootMargin:j}),M;function Z(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{x[L]=He(y),y.style.strokeDasharray=`${x[L]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),S>0?setTimeout(()=>v.observe(e),S):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Ce),v.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(M);},replay(){Te=0,pe();},pause(){G||!Q||(G=true,w=performance.now()-i,cancelAnimationFrame(O));},resume(){G&&(G=false,Q=true,i=performance.now()-w,O=requestAnimationFrame(Se));},seek(y){let L=Math.min(1,Math.max(0,y));me=L,G=true,w=L*o,i=performance.now()-w,cancelAnimationFrame(O),Ae(w);},getProgress(){return me},refresh(){clearTimeout(M),C.forEach((y,L)=>{x[L]=He(y),y.style.strokeDasharray=`${x[L]}`;});}}}if(Pe)return Rt();dt();function Be(){if(!_||G)return;let o=performance.now(),i=rt();if(!De&&te===false&&i===mt){O=requestAnimationFrame(Be);return}De=false,mt=i;let w=m;if(te!==false){let v=o-ft,M=v>0?Math.abs(i-(qe<0?i:qe))/v:0;w=m*Math.max(.2,1+M*(typeof te=="number"?te:1)*.04);}qe=i,ft=o;let Q=g?ve===-1||i>=ve?"forward":"reverse":T;ve=i;let Ae=ce-u,Se=true,pe=Ae===0?0:(i-u)/Ae;if(isNaN(Ne)||(Ne<=0&&pe>0?ye?.():Ne>0&&pe<=0&&xe?.(),Ne<1&&pe>=1?Re?.():Ne>=1&&pe<1&&he?.()),Ne=pe,re){let v=ue(ie(i,u,ce,w));ee&&!g&&(Y=Math.max(Y,v),v=Y),me=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=Q==="reverse"?1-v:v;e.style.clipPath=we(M),b?.(v),!D&&ie(i,u,ce,w)>0&&(D=true,P?.()),v>=1&&!k?(k=true,oe?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ce=setTimeout(()=>{Y=-1,D=false,k=false,e.style.clipPath=we(0);},Me))):v<1&&!ee&&(k=false),O=requestAnimationFrame(Be);return}if(C.forEach((v,M)=>{let Z=M*I*Ae,y=ue(ie(i,u+Z,ce+Z,w));ee&&!g&&(Y=Math.max(Y,y),y=Y),me=y,v.style.strokeDashoffset=Q==="reverse"?`${x[M]*y}`:`${x[M]*(1-y)}`,c&&(v.style.opacity=Q==="reverse"?`${1-y}`:`${y}`),le&&U?v.style.stroke=_e(le,U,y):U&&(v.style.stroke=U),X!==null&&H!==null?v.style.strokeWidth=`${X+(H-X)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),ne!==null&&W!==null?v.style.fillOpacity=`${ne+(W-ne)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",it(s[M],N,y)),M===0&&(b?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=false);}),B){let v=ue(ie(i,u,ce,w));for(let M in B){let Z=parseFloat(M);v>=Z&&!Ie.has(Z)&&(Ie.add(Z),B[M]?.());}}!D&&ie(i,u,ce,w)>0&&(D=true,P?.()),Se&&!k?(k=true,oe?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ce=setTimeout(()=>{Y=-1,D=false,k=false,Ie.clear(),We(),De=true;},Me))):!Se&&!ee&&(k=false),O=requestAnimationFrame(Be);}let nt=false;function Ge(){nt||(nt=true,O=requestAnimationFrame(function(){Be();}));}function je(){nt=false,cancelAnimationFrame(O);}let ot=new IntersectionObserver(o=>{o.forEach(i=>{_=i.isIntersecting,_&&!G?(De=true,Ge()):je();});},{root:ae??null,threshold:de,rootMargin:j});function yt(){C.forEach((o,i)=>{x[i]=He(o),o.style.strokeDasharray=`${x[i]}`;}),dt(),De=true;}let Ue;function ze(){clearTimeout(Ue),Ue=setTimeout(yt,150);}window.addEventListener("resize",ze),window.addEventListener("orientationchange",ze);let Ve;return typeof ResizeObserver<"u"&&(Ve=new ResizeObserver(()=>ze()),Ve.observe(document.body),Ve.observe(document.documentElement),Ve.observe(e)),S>0?setTimeout(()=>ot.observe(e),S):ot.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Ce),je(),ot.disconnect(),Ve?.disconnect(),window.removeEventListener("resize",ze),window.removeEventListener("orientationchange",ze),clearTimeout(Ue),ut();},replay(){Y=-1,ve=-1,qe=-1,D=false,k=false,Te=0,G=false,me=0,Ie.clear(),clearTimeout(Ce),We(),De=true,_&&Ge();},pause(){G=true,je();},resume(){G&&(G=false,De=true,_&&Ge());},seek(o){let i=Math.min(1,Math.max(0,o));me=i,Y=i,G=true,je(),It(i,T),De=true;},getProgress(){return me},refresh(){clearTimeout(Ue),yt(),_&&!G&&Ge();}}}var $t=new Map;function Ze(e,t){$t.set(e,t);}function Je(e){$t.delete(e);}function Ut(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Mt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let l=[],a=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"");}t.push({fn:n[1],nums:l,units:a});}return t}function Xt(e,t,r){let n=Mt(e),l=Mt(t);return n.length===0||n.length!==l.length?r<1?e:t:n.map((a,d)=>{let m=l[d];return a.fn!==m.fn||a.nums.length!==m.nums.length?r<1?`${a.fn}(${a.nums.map((c,f)=>`${c}${a.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,f)=>`${c+(m.nums[f]-c)*r}${a.units[f]}`).join(", ")})`}).join(" ")}function Pt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),l=String(t);if(Ut(n))return _e(n,l,r);if(n.includes("("))return Xt(n,l,r);let a=n.match(/^([-+]?[\d.]+)(.*)$/),d=l.match(/^([-+]?[\d.]+)(.*)$/);if(a&&d){let m=parseFloat(a[1]),c=parseFloat(d[1]);return `${m+(c-m)*r}${a[2]||d[2]}`}return r<1?n:l}function Yt(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Qt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Zt=0,kt="--scroll-draw-progress";function Jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Lt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:n,trigger:l={},easing:a="ease-out",speed:d=1,once:m=false,axis:c="y",scrollContainer:f,native:E=true,velocityScale:I=false,respectReducedMotion:T=true,triggerElement:ee,onProgress:Ee,onComplete:A,onEnter:$,onLeave:g,onEnterBack:S,onLeaveBack:h}=t,V=T&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:J[a]??J["ease-out"],B=$e(l.start??"top bottom"),te=$e(l.end??"bottom top"),de=ee??e,j=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([s,u])=>({prop:Yt(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function Me(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0");}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to));}let ge=new Map;for(let s of [...q.map(u=>u.prop),kt])ge.set(s,e.style.getPropertyValue(s));function Pe(){for(let[s,u]of ge)u?e.style.setProperty(s,u):e.style.removeProperty(s);}if(V)return N(),A?.(),{...r,destroy:Pe,getProgress:()=>1};Me();let ke=typeof a=="string"?Qe(a):null;function Le(){if(!E||!Jt()||!ke||c!=="y"||j||de!==e||m||d!==1||Ee||A||$||g||S||h||I!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let s of q)if(!Qt.has(s.prop))return false;return true}function b(){let s=`ssd-a-${++Zt}`,u=q.map(_=>`${_.prop}:${_.from}`).join(";"),ce=q.map(_=>`${_.prop}:${_.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${ce}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${ke};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Pe();},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(_){let Y=Math.min(1,Math.max(0,_));e.classList.remove(s);for(let ve of q)e.style.setProperty(ve.prop,Pt(ve.from,ve.to,Y));},getProgress(){let _=e.getBoundingClientRect(),Y=D(),ve=O(),{tStart:G,tEnd:me}=Oe({top:_.top,height:_.height},Y,ve,B,te);return F(ie(Y,G,me,d))}}}if(Le())return b();let P=0,oe=0,ye=0,Re=false,he=false,xe=-1,re=0,ue=false,be=NaN,Fe=-1,ae=0,le=()=>j?c==="x"?j.scrollLeft:j.scrollTop:c==="x"?window.scrollX:window.scrollY,U=()=>j?c==="x"?j.clientWidth:j.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function X(){let s=Xe(de,j,c),u=Oe(s,s.scroll,U(),B,te);P=u.tStart,oe=u.tEnd;}function H(s){e.style.setProperty(kt,String(s));for(let u of q)e.style.setProperty(u.prop,Pt(u.from,u.to,s));Ee?.(s);}function ne(s){if(isNaN(be)){be=s;return}be<=0&&s>0?$?.():be>0&&s<=0&&h?.(),be<1&&s>=1?g?.():be>=1&&s<1&&S?.(),be=s;}function W(){if(!Re||he)return;let s=performance.now(),u=le(),ce=d;if(I!==false){let O=s-ae,_=O>0?Math.abs(u-(Fe<0?u:Fe))/O:0;ce=d*Math.max(.2,1+_*(typeof I=="number"?I:1)*.04);}Fe=u,ae=s;let k=oe===P?0:(u-P)/(oe-P);ne(k);let D=F(ie(u,P,oe,ce));m&&(xe=Math.max(xe,D),D=xe),re=D,H(D),D>=1&&!ue?(ue=true,A?.()):D<1&&!m&&(ue=false),ye=requestAnimationFrame(W);}X(),oe===P&&K("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 s=F(ie(le(),P,oe,d));m&&s>0&&(xe=s),re=s,H(s);}let we=new IntersectionObserver(s=>{s.forEach(u=>{Re=u.isIntersecting,Re&&!he?ye=requestAnimationFrame(W):cancelAnimationFrame(ye);});},{root:j??null}),C;function x(){clearTimeout(C),C=setTimeout(X,150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),we.observe(e),Ze(e,{type:"animate",getProgress:()=>re,getTrigger:()=>({tStart:P,tEnd:oe})}),{destroy(){cancelAnimationFrame(ye),we.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(C),Pe(),Je(e);},replay(){xe=-1,ue=false,re=0,he=false,H(0);},pause(){he=true,cancelAnimationFrame(ye);},resume(){he&&(he=false,Re&&(ye=requestAnimationFrame(W)));},seek(s){let u=Math.min(1,Math.max(0,s));re=u,xe=u,he=true,cancelAnimationFrame(ye),H(u);},getProgress(){return re}}}var Ke={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Kt(e,t){if(typeof window>"u")return Ke;let r=typeof e=="string"?document.querySelector(e):e;return r?Lt(r,t):(K("scrollAnimate: element not found:",e),Ke)}function er(e,t={}){if(typeof window>"u")return Ke;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollParallax: element not found:",e),Ke;let{speed:n=.3,axis:l="y",easing:a="linear",trigger:d,onProgress:m}=t,c=r.getBoundingClientRect(),f=l==="x"?c.width:c.height,E=n*f;return Lt(r,{props:l==="x"?{transform:["translateX(0px)",`translateX(${-E}px)`]}:{transform:["translateY(0px)",`translateY(${-E}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m})}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tr(e,t){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return K("scrollCounter: element not found:",e),at;let n=r,{from:l=0,to:a,format:d,easing:m="ease-out",trigger:c={},once:f=true,decimals:E,onComplete:I}=t,T=E!==void 0?b=>b.toFixed(E):d??(b=>String(Math.round(b))),ee=typeof m=="function"?m:J[m]??J["ease-out"],Ee=$e(c.start??"top 80%"),A=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=T(a),I?.(),at;let g=0,S=0,h=0,V=false,F=false,B=-1,te=0,de=false,j=()=>window.scrollY,q=()=>window.innerHeight;function Me(){let b=n.getBoundingClientRect(),P=Oe({top:b.top,height:b.height},j(),q(),Ee,A);g=P.tStart,S=P.tEnd;}function N(b){n.textContent=T(l+(a-l)*b),n.style.setProperty("--scroll-draw-progress",String(b));}function ge(){if(!V||F)return;let b=ee(ie(j(),g,S,1));f&&(B=Math.max(B,b),b=B),te=b,N(b),b>=1&&!de?(de=true,I?.()):b<1&&!f&&(de=false),h=requestAnimationFrame(ge);}Me();{let b=ee(ie(j(),g,S,1));f&&b>0&&(B=b),te=b,N(b);}let Pe=new IntersectionObserver(b=>{b.forEach(P=>{V=P.isIntersecting,V&&!F?h=requestAnimationFrame(ge):cancelAnimationFrame(h);});}),ke;function Le(){clearTimeout(ke),ke=setTimeout(Me,150);}return window.addEventListener("resize",Le),window.addEventListener("orientationchange",Le),Pe.observe(n),Ze(n,{type:"counter",getProgress:()=>te,getTrigger:()=>({tStart:g,tEnd:S})}),{destroy(){cancelAnimationFrame(h),Pe.disconnect(),window.removeEventListener("resize",Le),window.removeEventListener("orientationchange",Le),clearTimeout(ke),Je(n);},replay(){B=-1,de=false,te=0,F=false,N(0);},pause(){F=true,cancelAnimationFrame(h);},resume(){F&&(F=false,V&&(h=requestAnimationFrame(ge)));},seek(b){let P=Math.min(1,Math.max(0,b));te=P,B=P,F=true,cancelAnimationFrame(h),N(P);},getProgress(){return te}}}var Ct="http://www.w3.org/2000/svg",rr="cinematic-photo",lt=e=>e<0?0:e>1?1:e;function et(e){let t=parseFloat(e);return Number.isFinite(t)?lt(t/100):0}function nr(e){return J[e]??J.linear}var or={destroy:()=>{},getProgress:()=>0},ct=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||K("Cinematic: wrapper not found:",t.wrapper);}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return or;r.style.position="relative",r.style.height=t.totalHeight,r.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",r.appendChild(n);let l=[];for(let A of t.scenes){if(A.background){let g=document.createElement("img");g.id=rr,g.src=A.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let $=A.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Ct,"svg");g.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let S of $){let h=document.createElementNS(Ct,"path");h.id=S.target.replace(/^#/,""),h.setAttribute("d",S.d),h.setAttribute("fill","none"),h.setAttribute("stroke",S.stroke),h.setAttribute("stroke-width",String(S.strokeWidth)),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round");let V=S.length||h.getTotalLength?.()||0;h.style.strokeDasharray=String(V),h.style.strokeDashoffset=String(V),g.appendChild(h),l.push({kind:"draw",el:h,start:et(S.start),end:et(S.end),ease:nr(S.easing),length:V});}}for(let g of A.animations){if(g.type!=="fade")continue;let S=n.querySelector(g.target)??document.querySelector(g.target);S&&(S.style.opacity=String(g.from),l.push({kind:"fade",el:S,start:et(g.start),end:et(g.end),ease:J["ease-in-out"]??J.linear,from:g.from,to:g.to}));}}let a=0,d=()=>{let A=r.offsetHeight-window.innerHeight;return A<=0?r.getBoundingClientRect().top<=0?1:0:lt(-r.getBoundingClientRect().top/A)},m=A=>{for(let $ of l){let g=$.end-$.start,S=g<=0?A>=$.end?1:0:lt((A-$.start)/g),h=$.ease(S);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-h)):$.el.style.opacity=String($.from+($.to-$.from)*h);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,f=false,E=false,I=()=>{a=d(),m(a),f&&(c=requestAnimationFrame(I));},T=()=>{f||(f=true,c=requestAnimationFrame(I));},ee=()=>{f=false,cancelAnimationFrame(c);},Ee=new IntersectionObserver(A=>{for(let $ of A)E=$.isIntersecting,E?T():ee();},{threshold:0});return Ee.observe(n),a=d(),m(a),{destroy(){ee(),Ee.disconnect();},getProgress:()=>a}}};function Lr(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?At(n,t):(K("Container not found:",e),r)}
4
- exports.Cinematic=ct;exports.PRESETS=st;exports.createBounce=vt;exports.createElastic=St;exports.createSpring=Ft;exports.scrollAnimate=Kt;exports.scrollCounter=tr;exports.scrollDraw=Lr;exports.scrollParallax=er;
3
+ <div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",l,{passive:true}),l(),{el:n,destroy(){window.removeEventListener("scroll",l),n.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Xt(e,r,t){if(!Ze)return;let n=(e.match(Pt)??[]).join("").toUpperCase(),l=(r.match(Pt)??[]).join("").toUpperCase(),a=(e.match(Mt)??[]).length,d=(r.match(Mt)??[]).length;if(n!==l){K(`morphTo: command sequence differs (${n||"\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.`,t);return}a!==d&&K(`morphTo: coordinate count differs (${a} \u2192 ${d}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function at(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let d=parseFloat(a),m=n[l++]??d;return String(+(d+(m-d)*t).toFixed(4))})}function kt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,l=t?{...it[t],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:x={},stagger:D=0,direction:A="forward",once:J=false,debug:Ee=false,axis:S="y",scrollContainer:$,autoReverse:g=false,delay:E=0,strokeColor:b,strokeWidth:V,fillOpacity:F,waypoints:B,velocityScale:ee=false,threshold:ge=0,rootMargin:j="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ye,autoplay:Le=false,duration:Ce=1e3,native:Ie=true,onProgress:w,onStart:P,onComplete:ne,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:xe}=l,te=ye===true?"left":typeof ye=="string"?ye:false,me=typeof f=="function"?f:Z[f]??Z.linear,we=$e(x.start??"top bottom"),He=$e(x.end??"bottom top"),ce=typeof $=="string"?document.querySelector($):$??null,ue=Array.isArray(b)?b[0]:null,Y=Array.isArray(b)?b[1]:typeof b=="string"?b:null,U=Array.isArray(V)?V[0]:null,H=Array.isArray(V)?V[1]:typeof V=="number"?V:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function ve(o){let i=o*100;switch(te){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let C=te?[]:Array.from(e.querySelectorAll(d)),T=[],s=[],u=0,oe=0,k=false,I=false,R=0,pe=false,se=-1,G=-1,_=false,ie=0,Te=0,De,tt=null;function mt(){tt?.destroy(),tt=null;}let Re=new Set,ft=NaN,Oe=true,Be=-1,pt=performance.now(),_e=NaN;function rt(){return ce?S==="x"?ce.scrollLeft:ce.scrollTop:S==="x"?window.scrollX:window.scrollY}function dt(){return ce?S==="x"?ce.clientWidth:ce.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function gt(){let o=Qe(e,ce,S);return Fe(o,o.scroll,dt(),we,He)}function yt(){(({tStart:u,tEnd:oe}=gt())),Ee&&Ze&&(mt(),tt=Ut(u,oe,S));}function nt(o,i=gt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e);},o}function Ot(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=i==="reverse"?1-o:o;e.style.clipPath=ve(h);return}C.forEach((h,X)=>{h.style.strokeDashoffset=i==="reverse"?`${T[X]*o}`:`${T[X]*(1-o)}`,c&&(h.style.opacity=i==="reverse"?`${1-o}`:`${o}`),ue&&Y?h.style.stroke=Ve(ue,Y,o):Y&&(h.style.stroke=Y),U!==null&&H!==null?h.style.strokeWidth=`${U+(H-U)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[X]&&h.setAttribute("d",at(s[X],N,o));});}function Ge(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=ve(0);return}C.forEach((o,i)=>{o.style.strokeDasharray=`${T[i]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[i]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[i]&&o.setAttribute("d",s[i]);});}if(C.forEach(o=>{Yt(o);let i=ze(o);T.push(i);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?Xt(s[s.length-1],N,o):K(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),Y&&(o.style.stroke=Y),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?"0":`${i}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),U!==null&&(o.style.strokeWidth=`${U}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(a)return e.style.clipPath=ve(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ve(0);}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof f=="string"?Ke(f):null;function Ft(){return !(Ie===false||!jt()||!C.length||!ht||te||S!=="y"||ce||m!==1||D!==0||J||g||ee!==false||N||B||q||E>0||w||P||ne||he||Ne||be||xe||b!=null||V!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Nt(){let o=++Gt,i=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,X=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(de+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${i}{from{${de}}to{${v}}}.${h}{view-timeline-name:${X};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Q(p,z){p.style.setProperty("--ssd-len",String(T[z])),p.style.strokeDasharray=`${T[z]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(i);}C.forEach(Q);let y=false,L=-1;function O(){if(L>=0)return L;let p=e.getBoundingClientRect(),{tStart:z,tEnd:fe}=Fe({top:p.top,height:p.height},rt(),dt(),we,He);return me(le(rt(),z,fe,m))}return {destroy(){e.classList.remove(h),C.forEach(p=>{p.classList.remove(i),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),M.remove();},replay(){y=false,L=-1,C.forEach(Q);},pause(){y=true,C.forEach(p=>{p.style.animationPlayState="paused";});},resume(){y&&(y=false,C.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let z=Math.min(1,Math.max(0,p));L=z,y=true,C.forEach((fe,ae)=>{fe.classList.remove(i),fe.style.strokeDashoffset=A==="reverse"?`${T[ae]*z}`:`${T[ae]*(1-z)}`,c&&(fe.style.opacity=A==="reverse"?`${1-z}`:`${z}`);});},getProgress(){return O()},refresh(){C.forEach((p,z)=>{T[z]=ze(p),p.style.setProperty("--ssd-len",String(T[z])),p.style.strokeDasharray=`${T[z]}`;});}}}if(Ft())return nt(Nt());function Ht(){let o=Math.max(1,Ce),i=0,h=0,X=false;function Ae(y){let L=true;if(te){let O=Math.min(1,Math.max(0,y/o)),p=me(O);ie=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ve(A==="reverse"?1-p:p),w?.(p),O<1&&(L=false);}else C.forEach((O,p)=>{let z=p*D*o,fe=Math.min(1,Math.max(0,(y-z)/o)),ae=me(fe);O.style.strokeDashoffset=A==="reverse"?`${T[p]*ae}`:`${T[p]*(1-ae)}`,c&&(O.style.opacity=A==="reverse"?`${1-ae}`:`${ae}`),ue&&Y?O.style.stroke=Ve(ue,Y,ae):Y&&(O.style.stroke=Y),U!==null&&H!==null?O.style.strokeWidth=`${U+(H-U)*ae}`:H!==null&&(O.style.strokeWidth=`${H}`),re!==null&&W!==null?O.style.fillOpacity=`${re+(W-re)*ae}`:W!==null&&(O.style.fillOpacity=`${W}`),N&&O.tagName.toLowerCase()==="path"&&s[p]&&O.setAttribute("d",at(s[p],N,ae)),p===0&&(ie=ae,w?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),fe<1&&(L=false);});if(B){let O=Math.min(1,Math.max(0,y/o)),p=me(O);for(let z in B){let fe=parseFloat(z);p>=fe&&!Re.has(fe)&&(Re.add(fe),B[z]?.());}}return L}function Se(y){if(_)return;let L=y-i;I||(I=true,P?.());let O=Ae(L);if(O&&!k){k=true,Ae(o*(1+Math.max(0,C.length-1)*D)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,De=setTimeout(()=>{i=performance.now(),I=false,k=false,Re.clear(),Ge(),R=requestAnimationFrame(Se);},ke));return}O||(R=requestAnimationFrame(Se));}function de(){cancelAnimationFrame(R),clearTimeout(De),i=performance.now(),h=0,_=false,I=false,k=false,Te=0,X=true,ie=0,Re.clear(),Ge(),R=requestAnimationFrame(Se);}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?de():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(R),clearTimeout(De),X=false);});},{root:ce??null,threshold:ge,rootMargin:j}),M;function Q(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=ze(y),y.style.strokeDasharray=`${T[L]}`;});},150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(R),clearTimeout(De),v.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(M);},replay(){Te=0,de();},pause(){_||!X||(_=true,h=performance.now()-i,cancelAnimationFrame(R));},resume(){_&&(_=false,X=true,i=performance.now()-h,R=requestAnimationFrame(Se));},seek(y){let L=Math.min(1,Math.max(0,y));ie=L,_=true,h=L*o,i=performance.now()-h,cancelAnimationFrame(R),Ae(h);},getProgress(){return ie},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=ze(y),y.style.strokeDasharray=`${T[L]}`;});}}}if(Le)return nt(Ht());yt();function je(){if(!pe||_)return;let o=performance.now(),i=rt();if(!Oe&&ee===false&&i===ft){R=requestAnimationFrame(je);return}Oe=false,ft=i;let h=m;if(ee!==false){let v=o-pt,M=v>0?Math.abs(i-(Be<0?i:Be))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04);}Be=i,pt=o;let X=g?G===-1||i>=G?"forward":"reverse":A;G=i;let Ae=oe-u,Se=true,de=Ae===0?0:(i-u)/Ae;if(isNaN(_e)||(_e<=0&&de>0?he?.():_e>0&&de<=0&&xe?.(),_e<1&&de>=1?Ne?.():_e>=1&&de<1&&be?.()),_e=de,te){let v=me(le(i,u,oe,h));J&&!g&&(se=Math.max(se,v),v=se),ie=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=X==="reverse"?1-v:v;e.style.clipPath=ve(M),w?.(v),!I&&le(i,u,oe,h)>0&&(I=true,P?.()),v>=1&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,De=setTimeout(()=>{se=-1,I=false,k=false,e.style.clipPath=ve(0);},ke))):v<1&&!J&&(k=false),R=requestAnimationFrame(je);return}if(C.forEach((v,M)=>{let Q=M*D*Ae,y=me(le(i,u+Q,oe+Q,h));J&&!g&&(se=Math.max(se,y),y=se),ie=y,v.style.strokeDashoffset=X==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=X==="reverse"?`${1-y}`:`${y}`),ue&&Y?v.style.stroke=Ve(ue,Y,y):Y&&(v.style.stroke=Y),U!==null&&H!==null?v.style.strokeWidth=`${U+(H-U)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",at(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=false);}),B){let v=me(le(i,u,oe,h));for(let M in B){let Q=parseFloat(M);v>=Q&&!Re.has(Q)&&(Re.add(Q),B[M]?.());}}!I&&le(i,u,oe,h)>0&&(I=true,P?.()),Se&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,De=setTimeout(()=>{se=-1,I=false,k=false,Re.clear(),Ge(),Oe=true;},ke))):!Se&&!J&&(k=false),R=requestAnimationFrame(je);}let ot=false;function Ye(){ot||(ot=true,R=requestAnimationFrame(function(){je();}));}function Ue(){ot=false,cancelAnimationFrame(R);}let st=new IntersectionObserver(o=>{o.forEach(i=>{pe=i.isIntersecting,pe&&!_?(Oe=true,Ye()):Ue();});},{root:ce??null,threshold:ge,rootMargin:j});function bt(){C.forEach((o,i)=>{T[i]=ze(o),o.style.strokeDasharray=`${T[i]}`;}),yt(),Oe=true;}let Xe;function qe(){clearTimeout(Xe),Xe=setTimeout(bt,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)),E>0?setTimeout(()=>st.observe(e),E):st.observe(e),nt({destroy(){cancelAnimationFrame(R),clearTimeout(De),Ue(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Xe),mt();},replay(){se=-1,G=-1,Be=-1,I=false,k=false,Te=0,_=false,ie=0,Re.clear(),clearTimeout(De),Ge(),Oe=true,pe&&Ye();},pause(){_=true,Ue();},resume(){_&&(_=false,Oe=true,pe&&Ye());},seek(o){let i=Math.min(1,Math.max(0,o));ie=i,se=i,_=true,Ue(),Ot(i,A),Oe=true;},getProgress(){return ie},refresh(){clearTimeout(Xe),bt(),pe&&!_&&Ye();}},()=>({tStart:u,tEnd:oe}))}function Qt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let l=[],a=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"");}r.push({fn:n[1],nums:l,units:a});}return r}function Zt(e,r,t){let n=Lt(e),l=Lt(r);return n.length===0||n.length!==l.length?t<1?e:r:n.map((a,d)=>{let m=l[d];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((c,f)=>`${c}${a.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,f)=>`${c+(m.nums[f]-c)*t}${a.units[f]}`).join(", ")})`}).join(" ")}function Ct(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),l=String(r);if(Qt(n))return Ve(n,l,t);if(n.includes("("))return Zt(n,l,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),d=l.match(/^([-+]?[\d.]+)(.*)$/);if(a&&d){let m=parseFloat(a[1]),c=parseFloat(d[1]);return `${m+(c-m)*t}${a[2]||d[2]}`}return t<1?n:l}function Kt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Jt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),er=0,It="--scroll-draw-progress";function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Dt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:l={},easing:a="ease-out",speed:d=1,once:m=false,axis:c="y",scrollContainer:f,native:x=true,velocityScale:D=false,respectReducedMotion:A=true,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=r,V=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:Z[a]??Z["ease-out"],B=$e(l.start??"top bottom"),ee=$e(l.end??"bottom top"),ge=J??e,j=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([s,u])=>({prop:Kt(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0");}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to));}let ye=new Map;for(let s of [...q.map(u=>u.prop),It])ye.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ye)u?e.style.setProperty(s,u):e.style.removeProperty(s);}if(V)return N(),S?.(),{...t,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Ke(a):null;function Ie(){if(!x||!tr()||!Ce||c!=="y"||j||ge!==e||m||d!==1||Ee||S||$||g||E||b||D!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let s of q)if(!Jt.has(s.prop))return false;return true}function w(){let s=`ssd-a-${++er}`,u=q.map(G=>`${G.prop}:${G.from}`).join(";"),oe=q.map(G=>`${G.prop}:${G.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let I=()=>c==="x"?window.scrollX:window.scrollY,R=()=>c==="x"?window.innerWidth:window.innerHeight,pe=()=>{let G=e.getBoundingClientRect();return Fe({top:G.top,height:G.height},I(),R(),B,ee)};Me(e,{type:"animate",getProgress:()=>se.getProgress(),getTrigger:pe});let se={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(G){let _=Math.min(1,Math.max(0,G));e.classList.remove(s);for(let ie of q)e.style.setProperty(ie.prop,Ct(ie.from,ie.to,_));},getProgress(){let{tStart:G,tEnd:_}=pe();return F(le(I(),G,_,d))}};return se}if(Ie())return w();let P=0,ne=0,he=0,Ne=false,be=false,xe=-1,te=0,me=false,we=NaN,He=-1,ce=0,ue=()=>j?c==="x"?j.scrollLeft:j.scrollTop:c==="x"?window.scrollX:window.scrollY,Y=()=>j?c==="x"?j.clientWidth:j.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function U(){let s=Qe(ge,j,c),u=Fe(s,s.scroll,Y(),B,ee);P=u.tStart,ne=u.tEnd;}function H(s){e.style.setProperty(It,String(s));for(let u of q)e.style.setProperty(u.prop,Ct(u.from,u.to,s));Ee?.(s);}function re(s){if(isNaN(we)){we=s;return}we<=0&&s>0?$?.():we>0&&s<=0&&b?.(),we<1&&s>=1?g?.():we>=1&&s<1&&E?.(),we=s;}function W(){if(!Ne||be)return;let s=performance.now(),u=ue(),oe=d;if(D!==false){let R=s-ce,pe=R>0?Math.abs(u-(He<0?u:He))/R:0;oe=d*Math.max(.2,1+pe*(typeof D=="number"?D:1)*.04);}He=u,ce=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let I=F(le(u,P,ne,oe));m&&(xe=Math.max(xe,I),I=xe),te=I,H(I),I>=1&&!me?(me=true,S?.()):I<1&&!m&&(me=false),he=requestAnimationFrame(W);}U(),ne===P&&K("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 s=F(le(ue(),P,ne,d));m&&s>0&&(xe=s),te=s,H(s);}let ve=new IntersectionObserver(s=>{s.forEach(u=>{Ne=u.isIntersecting,Ne&&!be?he=requestAnimationFrame(W):cancelAnimationFrame(he);});},{root:j??null}),C;function T(){clearTimeout(C),C=setTimeout(U,150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ve.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(he),ve.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e);},replay(){xe=-1,me=false,te=0,be=false,H(0);},pause(){be=true,cancelAnimationFrame(he);},resume(){be&&(be=false,Ne&&(he=requestAnimationFrame(W)));},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,be=true,cancelAnimationFrame(he),H(u);},getProgress(){return te}}}var Je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rr(e,r){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;return t?Dt(t,r):(K("scrollAnimate: element not found:",e),Je)}function nr(e,r={}){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return K("scrollParallax: element not found:",e),Je;let{speed:n=.3,axis:l="y",easing:a="linear",trigger:d,onProgress:m}=r,c=t.getBoundingClientRect(),f=l==="x"?c.width:c.height,x=n*f;return Dt(t,{props:l==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m})}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,r){if(typeof window>"u")return lt;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return K("scrollCounter: element not found:",e),lt;let n=t,{from:l=0,to:a,format:d,easing:m="ease-out",trigger:c={},once:f=true,decimals:x,onComplete:D}=r,A=x!==void 0?w=>w.toFixed(x):d??(w=>String(Math.round(w))),J=typeof m=="function"?m:Z[m]??Z["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),D?.(),lt;let g=0,E=0,b=0,V=false,F=false,B=-1,ee=0,ge=false,j=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Fe({top:w.top,height:w.height},j(),q(),Ee,S);g=P.tStart,E=P.tEnd;}function N(w){n.textContent=A(l+(a-l)*w),n.style.setProperty("--scroll-draw-progress",String(w));}function ye(){if(!V||F)return;let w=J(le(j(),g,E,1));f&&(B=Math.max(B,w),w=B),ee=w,N(w),w>=1&&!ge?(ge=true,D?.()):w<1&&!f&&(ge=false),b=requestAnimationFrame(ye);}ke();{let w=J(le(j(),g,E,1));f&&w>0&&(B=w),ee=w,N(w);}let Le=new IntersectionObserver(w=>{w.forEach(P=>{V=P.isIntersecting,V&&!F?b=requestAnimationFrame(ye):cancelAnimationFrame(b);});}),Ce;function Ie(){clearTimeout(Ce),Ce=setTimeout(ke,150);}return window.addEventListener("resize",Ie),window.addEventListener("orientationchange",Ie),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",Ie),window.removeEventListener("orientationchange",Ie),clearTimeout(Ce),Pe(n);},replay(){B=-1,ge=false,ee=0,F=false,N(0);},pause(){F=true,cancelAnimationFrame(b);},resume(){F&&(F=false,V&&(b=requestAnimationFrame(ye)));},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,B=P,F=true,cancelAnimationFrame(b),N(P);},getProgress(){return ee}}}var Rt="http://www.w3.org/2000/svg",sr="cinematic-photo",ct=e=>e<0?0:e>1?1:e;function et(e){let r=parseFloat(e);return Number.isFinite(r)?ct(r/100):0}function ir(e){return Z[e]??Z.linear}var ar={destroy:()=>{},getProgress:()=>0},ut=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||K("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return ar;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let l=[];for(let S of r.scenes){if(S.background){let g=document.createElement("img");g.id=sr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Rt,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(Rt,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let V=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(V),b.style.strokeDashoffset=String(V),g.appendChild(b),l.push({kind:"draw",el:b,start:et(E.start),end:et(E.end),ease:ir(E.easing),length:V});}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),l.push({kind:"fade",el:E,start:et(g.start),end:et(g.end),ease:Z["ease-in-out"]??Z.linear,from:g.from,to:g.to}));}}let a=0,d=()=>{let S=t.offsetHeight-window.innerHeight;return S<=0?t.getBoundingClientRect().top<=0?1:0:ct(-t.getBoundingClientRect().top/S)},m=S=>{for(let $ of l){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:ct((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,f=false,x=false,D=()=>{a=d(),m(a),f&&(c=requestAnimationFrame(D));},A=()=>{f||(f=true,c=requestAnimationFrame(D));},J=()=>{f=false,cancelAnimationFrame(c);},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J();},{threshold:0});return Ee.observe(n),a=d(),m(a),Me(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=t.getBoundingClientRect().top+window.scrollY;return {tStart:S,tEnd:S+Math.max(0,t.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(t);},getProgress:()=>a}}};function Or(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?kt(n,r):(K("Container not found:",e),t)}
4
+ exports.Cinematic=ut;exports.PRESETS=it;exports.createBounce=Et;exports.createElastic=xt;exports.createSpring=_t;exports.scrollAnimate=rr;exports.scrollCounter=or;exports.scrollDraw=Or;exports.scrollParallax=nr;