svg-scroll-draw 2.16.1 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.d.mts +45 -49
- package/dist/angular/index.d.ts +45 -49
- package/dist/angular/index.mjs +1 -1
- package/dist/chunk-XSVTHCLO.mjs +1 -0
- package/dist/chunk-ZZCTLVGT.mjs +1 -0
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +16 -11
- package/dist/solid/index.d.ts +16 -11
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +5 -5
- package/dist/svelte/index.d.ts +5 -5
- package/dist/svelte/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.mts +14 -7
- package/dist/vue/index.d.ts +14 -7
- package/dist/vue/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-E4M2PB7B.mjs +0 -1
package/dist/svelte/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${m?`left:${
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Kt(e,n,r){if(!Be)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),l=(n.match(Pt)??[]).join("").toUpperCase(),s=(e.match(Ct)??[]).length,c=(n.match(Ct)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ct(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function Je(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...Tt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:A="forward",once:ne=false,debug:Ce=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:C,fillOpacity:L,waypoints:w,velocityScale:O=false,threshold:k=0,rootMargin:P="0px",repeat:S=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:E,onEnterBack:R,onLeaveBack:fe}=l,Q=se===true?"left":typeof se=="string"?se:false,Ee=typeof p=="function"?p:re[p]??re.linear,Pe=de(T.start??"top bottom"),Ne=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Se=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(C)?C[0]:null,j=Array.isArray(C)?C[1]:typeof C=="number"?C:null,pe=Array.isArray(L)?L[0]:null,Z=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Ie(o){let a=o*100;switch(Q){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=Q?[]:Array.from(e.querySelectorAll(c)),I=[],i=[],f=0,ge=0,H=false,_=false,q=0,Ae=false,ye=-1,te=-1,U=false,he=0,ke=0,Fe,ot=null;function mt(){ot?.destroy(),ot=null;}let Re=new Set,ft=NaN,He=true,Ge=-1,pt=performance.now(),Ve=NaN;function st(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function dt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function gt(){let o=Ze(e,ve,B);return xe(o,o.scroll,dt(),Pe,Ne)}function yt(){(({tStart:f,tEnd:ge}=gt())),Ce&&Be&&(mt(),ot=Zt(f,ge,B));}function it(o,a=gt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Nt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),Q){let b=a==="reverse"?1-o:o;e.style.clipPath=Ie(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${I[ue]*o}`:`${I[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Se&&le?b.style.stroke=_e(Se,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*o}`:Z!==null&&(b.style.fillOpacity=`${Z}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ct(i[ue],D,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Ie(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${I[a]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{Qt(o);let a=ze(o);I.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Kt(i[i.length-1],D,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?"0":`${a}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Ie(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ie(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof p=="string"?Ke(p):null;function Vt(){return !(ae===false||!Xt()||!z.length||!ht||Q||B!=="y"||ve||u!==1||V!==0||ne||X||O!==false||D||w||S||G>0||d||x||g||$||E||R||fe||M!=null||C!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function zt(){let o=++Yt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=A==="reverse"?"0":"var(--ssd-len)",Oe=A==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${Oe};`;m&&(Me+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${a}{from{${Me}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(I[Y])),y.style.strokeDasharray=`${I[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:y.top,height:y.height},st(),dt(),Pe,Ne);return Ee(K(st(),Y,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),F.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));N=Y,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=A==="reverse"?`${I[be]*Y}`:`${I[be]*(1-Y)}`,m&&(Te.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){z.forEach((y,Y)=>{I[Y]=ze(y),y.style.setProperty("--ssd-len",String(I[Y])),y.style.strokeDasharray=`${I[Y]}`;});}}}if(Vt())return it(zt());function _t(){let o=Math.max(1,ee),a=0,b=0,ue=false;function De(h){let N=true;if(Q){let W=Math.min(1,Math.max(0,h/o)),y=Ee(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Ie(A==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Ee(Te);W.style.strokeDashoffset=A==="reverse"?`${I[y]*be}`:`${I[y]*(1-be)}`,m&&(W.style.opacity=A==="reverse"?`${1-be}`:`${be}`),Se&&le?W.style.stroke=_e(Se,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Z!==null?W.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(W.style.fillOpacity=`${Z}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",ct(i[y],D,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Ee(W);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!Re.has(Te)&&(Re.add(Te),w[Y]?.());}}return N}function Oe(h){if(U)return;let N=h-a;_||(_=true,x?.());let W=De(N);if(W&&!H){H=true,De(o*(1+Math.max(0,z.length-1)*V)),g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Fe=setTimeout(()=>{a=performance.now(),_=false,H=false,Re.clear(),je(),q=requestAnimationFrame(Oe);},oe));return}W||(q=requestAnimationFrame(Oe));}function Me(){cancelAnimationFrame(q),clearTimeout(Fe),a=performance.now(),b=0,U=false,_=false,H=false,ke=0,ue=true,he=0,Re.clear(),je(),q=requestAnimationFrame(Oe);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&H)?Me():!N.isIntersecting&&!ne&&!H&&(cancelAnimationFrame(q),clearTimeout(Fe),ue=false);});},{root:ve??null,threshold:k,rootMargin:P}),F;function me(){clearTimeout(F),F=setTimeout(()=>{z.forEach((h,N)=>{I[N]=ze(h),h.style.strokeDasharray=`${I[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Fe),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(F);},replay(){ke=0,Me();},pause(){U||!ue||(U=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(Oe));},seek(h){let N=Math.min(1,Math.max(0,h));he=N,U=true,b=N*o,a=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return he},refresh(){clearTimeout(F),z.forEach((h,N)=>{I[N]=ze(h),h.style.strokeDasharray=`${I[N]}`;});}}}if(ie)return it(_t());yt();function Ue(){if(!Ae||U)return;let o=performance.now(),a=st();if(!He&&O===false&&a===ft){q=requestAnimationFrame(Ue);return}He=false,ft=a;let b=u;if(O!==false){let v=o-pt,F=v>0?Math.abs(a-(Ge<0?a:Ge))/v:0;b=u*Math.max(.2,1+F*(typeof O=="number"?O:1)*.04);}Ge=a,pt=o;let ue=X?te===-1||a>=te?"forward":"reverse":A;te=a;let De=ge-f,Oe=true,Me=De===0?0:(a-f)/De;if(isNaN(Ve)||(Ve<=0&&Me>0?$?.():Ve>0&&Me<=0&&fe?.(),Ve<1&&Me>=1?E?.():Ve>=1&&Me<1&&R?.()),Ve=Me,Q){let v=Ee(K(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let F=ue==="reverse"?1-v:v;e.style.clipPath=Ie(F),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!H?(H=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Fe=setTimeout(()=>{ye=-1,_=false,H=false,e.style.clipPath=Ie(0);},oe))):v<1&&!ne&&(H=false),q=requestAnimationFrame(Ue);return}if(z.forEach((v,F)=>{let me=F*V*De,h=Ee(K(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${I[F]*h}`:`${I[F]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Se&&le?v.style.stroke=_e(Se,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*h}`:Z!==null&&(v.style.fillOpacity=`${Z}`),D&&v.tagName.toLowerCase()==="path"&&i[F]&&v.setAttribute("d",ct(i[F],D,h)),F===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Oe=false);}),w){let v=Ee(K(a,f,ge,b));for(let F in w){let me=parseFloat(F);v>=me&&!Re.has(me)&&(Re.add(me),w[F]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),Oe&&!H?(H=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,Fe=setTimeout(()=>{ye=-1,_=false,H=false,Re.clear(),je(),He=true;},oe))):!Oe&&!ne&&(H=false),q=requestAnimationFrame(Ue);}let at=false;function Ye(){at||(at=true,q=requestAnimationFrame(function(){Ue();}));}function Xe(){at=false,cancelAnimationFrame(q);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!U?(He=true,Ye()):Xe();});},{root:ve??null,threshold:k,rootMargin:P});function bt(){z.forEach((o,a)=>{I[a]=ze(o),o.style.strokeDasharray=`${I[a]}`;}),yt(),He=true;}let Qe;function qe(){clearTimeout(Qe),Qe=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)),G>0?setTimeout(()=>lt.observe(e),G):lt.observe(e),it({destroy(){cancelAnimationFrame(q),clearTimeout(Fe),Xe(),lt.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),mt();},replay(){ye=-1,te=-1,Ge=-1,_=false,H=false,ke=0,U=false,he=0,Re.clear(),clearTimeout(Fe),je(),He=true,Ae&&Ye();},pause(){U=true,Xe();},resume(){U&&(U=false,He=true,Ae&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,Xe(),Nt(a,A),He=true;},getProgress(){return he},refresh(){clearTimeout(Qe),bt(),Ae&&!U&&Ye();}},()=>({tStart:f,tEnd:ge}))}function Jt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function It(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function er(e,n,r){let t=It(e),l=It(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function Ot(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Jt(t))return _e(t,l,r);if(t.includes("("))return er(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function tr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,kt="--scroll-draw-progress";function or(){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:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:Ce,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,C=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),O=de(l.end??"bottom top"),k=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([i,f])=>({prop:tr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...S.map(f=>f.prop),kt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return D(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?Ke(s):null;function ae(){if(!T||!or()||!ee||m!=="y"||P||k!==e||u||c!==1||Ce||B||J||X||G||M||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!rr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++nr}`,f=S.map(te=>`${te.prop}:${te.from}`).join(";"),ge=S.map(te=>`${te.prop}:${te.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},_(),q(),w,O)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Ae});let ye={destroy(){e.classList.remove(i),H.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of S)e.style.setProperty(he.prop,Ot(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return L(K(_(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,$=0,E=false,R=false,fe=-1,Q=0,Ee=false,Pe=NaN,Ne=-1,ve=0,Se=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ze(k,P,m),f=xe(i,i.scroll,le(),w,O);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(kt,String(i));for(let f of S)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Ce?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&M?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Z(){if(!E||R)return;let i=performance.now(),f=Se(),ge=c;if(V!==false){let q=i-ve,Ae=q>0?Math.abs(f-(Ne<0?f:Ne))/q:0;ge=c*Math.max(.2,1+Ae*(typeof V=="number"?V:1)*.04);}Ne=f,ve=i;let H=g===x?0:(f-x)/(g-x);pe(H);let _=L(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Ee?(Ee=true,B?.()):_<1&&!u&&(Ee=false),$=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(K(Se(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let Ie=new IntersectionObserver(i=>{i.forEach(f=>{E=f.isIntersecting,E&&!R?$=requestAnimationFrame(Z):cancelAnimationFrame($);});},{root:P??null}),z;function I(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Ie.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),Ie.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(z),ie(),$e(e);},replay(){fe=-1,Ee=false,Q=0,R=false,j(0);},pause(){R=true,cancelAnimationFrame($);},resume(){R&&(R=false,E&&($=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,R=true,cancelAnimationFrame($),j(f);},getProgress(){return Q}}}var ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tt(e,n){if(typeof window>"u")return ut;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ut;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,A=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Ce=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(s),V?.(),ut;let X=0,G=0,M=0,C=false,L=false,w=-1,O=0,k=false,P=()=>window.scrollY,S=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},P(),S(),Ce,B);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=A(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!C||L)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),O=d,D(d),d>=1&&!k?(k=true,V?.()):d<1&&!p&&(k=false),M=requestAnimationFrame(se);}oe();{let d=ne(K(P(),X,G,1));p&&d>0&&(w=d),O=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{C=x.isIntersecting,C&&!L?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,k=false,O=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(M);},resume(){L&&(L=false,C&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));O=x,w=x,L=true,cancelAnimationFrame(M),D(x);},getProgress(){return O}}}var Dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rt(e,n={}){if(typeof window>"u")return Dt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Dt;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Ce=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,M=0,C=0,L=false,w=false,O=-1,k=0,P=false,S=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let E=t.getBoundingClientRect(),R=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,Q=xe({top:R,height:fe},oe(),D(),Ce,B);G=Q.tStart,M=Q.tEnd;}let ie=NaN;function ee(E){if(!S)return;let R=X??t.duration??0,fe=J+(R-J)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!L||w||!S||A)return;let E=ne(K(oe(),G,M,1));c&&(O=Math.max(O,E),E=O),k=E,ee(E),E>=1&&!P?(P=true,T?.()):E<1&&!c&&(P=false),C=requestAnimationFrame(ae);}function d(){if(S=true,X===void 0&&(X=t.duration),A){ee(1),p?.();return}se(),p?.(),L&&!w&&(C=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(R=>{L=R.isIntersecting,L&&!w&&S?C=requestAnimationFrame(ae):cancelAnimationFrame(C);});}),g;function $(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Le(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(C),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),$e(t);},replay(){O=-1,P=false,k=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,L&&S&&(C=requestAnimationFrame(ae)));},seek(E){let R=Math.min(1,Math.max(0,E));k=R,O=R,w=true,cancelAnimationFrame(C),ie=NaN,ee(R);},getProgress(){return k}}}function Ht(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function sr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Ft(e){let n=Ht(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ir(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ar(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Rt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function nt(e,n={}){if(typeof window>"u")return Rt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Rt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Ce=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=sr(t):l==="lines"?J=Ft(t):J=Ht(t);let X=J.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let E=ar($,u);E&&(g.style.transform=E);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach(($,E)=>{let R=A(ir(g,E,X,s));G($,R);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let C=0,L=0,w=0,O=false,k=false,P=-1,S=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=xe({top:g.top,height:g.height},D(),se(),ne,Ce);C=$.tStart,L=$.tEnd;}function ee(){if(!O||k)return;let g=K(D(),C,L,1);p&&(P=Math.max(P,g),g=P),S=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{O=$.isIntersecting,O&&!k?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Ft(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:C,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){P=-1,oe=false,S=0,k=false,M(0);},pause(){k=true,cancelAnimationFrame(w);},resume(){k&&(k=false,O&&(w=requestAnimationFrame(ee)));},seek(g){let $=Math.min(1,Math.max(0,g));S=$,P=$,k=true,cancelAnimationFrame(w),M($);},getProgress(){return S}}}function on(e,n={}){let r=Je(e,n);return {update(t){r.destroy(),r=Je(e,t);},destroy(){r.destroy();}}}function sn(e={}){let n=null;function r(t){return n=Je(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function an(e,n){let r=et(e,n);return {update(t){r.destroy(),r=et(e,t);},destroy(){r.destroy();}}}function ln(e){let n=null;function r(t){return n=et(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function cn(e,n){let r=tt(e,n);return {update(t){r.destroy(),r=tt(e,t);},destroy(){r.destroy();}}}function un(e){let n=null;function r(t){return n=tt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function mn(e,n={}){let r=rt(e,n);return {update(t){r.destroy(),r=rt(e,t);},destroy(){r.destroy();}}}function fn(e={}){let n=null;function r(t){return n=rt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}function pn(e,n={}){let r=nt(e,n);return {update(t){r.destroy(),r=nt(e,t);},destroy(){r.destroy();}}}function dn(e={}){let n=null;function r(t){return n=nt(t,e),{destroy(){n?.destroy(),n=null;}}}return {action:r,getInstance:()=>n}}exports.createScrollAnimate=ln;exports.createScrollCounter=un;exports.createScrollDraw=sn;exports.createScrollText=dn;exports.createScrollVideo=fn;exports.scrollAnimate=an;exports.scrollCounterAction=cn;exports.scrollDraw=on;exports.scrollTextAction=pn;exports.scrollVideoAction=mn;
|
|
1
|
+
'use strict';function jt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),a=Math.sqrt(t),s=0,l=[];for(let p=0;p<n;p++){let T=Math.pow(a,p);l.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<n;p++)m+=l[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<n;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let A=1-Math.pow(t,T);return A+(1-A)*(2*V-1)*(2*V-1)}return 1}}function Ut({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),t=Math.max(.1,r),a=n<=1?t/4:t/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:jt(),elastic:Ut()};function St(e,r,n){return Math.min(n,Math.max(r,e))}function de(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:t}}function Tt(e,r,n,t){switch(t){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function xt(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 Z(e,r,n,t){return n===r?0:St((e-r)/(n-r)*t,0,1)}function xe(e,r,n,t,a){let s=Tt(e.top,e.height,r,t.element)-xt(t.viewport,n),l=Tt(e.top,e.height,r,a.element)-xt(a.viewport,n);return {tStart:s,tEnd:l}}function Ze(e,r,n){let t=e.getBoundingClientRect(),a=n==="x"?t.width:t.height;return r?{top:n==="x"?t.left-r.getBoundingClientRect().left+r.scrollLeft:t.top-r.getBoundingClientRect().top+r.scrollTop,height:a,scroll:0}:{top:n==="x"?t.left:t.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function _e(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(n+t)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function At(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function ze(e,r,n){let t=At(e),a=At(r);return !t||!a?e:`rgb(${Math.round(t[0]+(a[0]-t[0])*n)},${Math.round(t[1]+(a[1]-t[1])*n)},${Math.round(t[2]+(a[2]-t[2])*n)})`}var Mt={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 Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...r){Be&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Yt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Xt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Lt=33;function Kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Qt(e){let r=[];for(let n=0;n<Lt;n++){let t=n/(Lt-1);r.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${r.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Yt;case "ease-out":return Xt;case "ease-in-out":return Kt()?Qt(re["ease-in-out"]):null;default:return null}}var $t=Symbol.for("svg-scroll-draw.registry");function Ct(){let e=globalThis;return e[$t]||(e[$t]=new Map)}function Le(e,r){Ct().set(e,r);}function $e(e){Ct().delete(e);}var Zt=0;function Jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Pt(e,r){let n="";try{n=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return n||(e.getAttribute(r)??"").trim()}var kt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function er(e){if(!Be)return;let r=Pt(e,"stroke");if(!r||r==="none"){we("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!kt.has(n)&&!kt.has(Pt(e,"fill"))&&we("Element has a fill \u2014 it may obscure the stroke animation.",e);}function tr(e,r,n){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function a(){let s=n==="x"?window.scrollX:window.scrollY,l=e-s,u=r-s,m=n==="x";t.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ot=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,r,n){if(!Be)return;let t=(e.match(Ot)??[]).join("").toUpperCase(),a=(r.match(Ot)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,l=(r.match(It)??[]).length;if(t!==a){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}s!==l&&we(`morphTo: coordinate count differs (${s} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function st(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let l=parseFloat(s),u=t[a++]??l;return String(+(l+(u-l)*n).toFixed(4))})}function it(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,a=n?{...Mt[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:A="forward",once:ne=false,debug:Ce=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:C,fillOpacity:L,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:P="0px",repeat:E=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:S,onEnterBack:R,onLeaveBack:fe}=a,K=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Pe=de(T.start??"top bottom"),Ne=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(C)?C[0]:null,j=Array.isArray(C)?C[1]:typeof C=="number"?C:null,pe=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function ke(o){let c=o*100;switch(K){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let _=K?[]:Array.from(e.querySelectorAll(l)),k=[],i=[],f=0,ge=0,H=false,z=false,q=0,Ae=false,ye=-1,te=-1,U=false,he=0,Oe=0,Fe,et=null;function dt(){et?.destroy(),et=null;}let Re=new Set,gt=NaN,He=true,je=-1,yt=performance.now(),Ve=NaN;function tt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function ht(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function bt(){let o=Ze(e,ve,B);return xe(o,o.scroll,ht(),Pe,Ne)}function wt(){(({tStart:f,tEnd:ge}=bt())),Ce&&Be&&(dt(),et=tr(f,ge,B));}function rt(o,c=bt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function qt(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=c==="reverse"?1-o:o;e.style.clipPath=ke(b);return}_.forEach((b,ue)=>{b.style.strokeDashoffset=c==="reverse"?`${k[ue]*o}`:`${k[ue]*(1-o)}`,m&&(b.style.opacity=c==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=ze(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",st(i[ue],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=ke(0);return}_.forEach((o,c)=>{o.style.strokeDasharray=`${k[c]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${k[c]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[c]&&o.setAttribute("d",i[c]);});}if(_.forEach(o=>{er(o);let c=_e(o);k.push(c);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?rr(i[i.length-1],D,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=A==="reverse"?`${c}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=A==="reverse"?"0":`${c}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=ke(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let vt=typeof p=="string"?Je(p):null;function Wt(){return !(ae===false||!Jt()||!_.length||!vt||K||B!=="y"||ve||u!==1||V!==0||ne||X||I!==false||D||w||E||G>0||d||x||g||$||S||R||fe||M!=null||C!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Bt(){let o=++Zt,c=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=A==="reverse"?"0":"var(--ssd-len)",Ie=A==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${Ie};`;m&&(Me+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Me}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${vt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(c);}_.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:y.top,height:y.height},tt(),ht(),Pe,Ne);return Se(Z(tt(),Y,Te,u))}return {destroy(){e.classList.remove(b),_.forEach(y=>{y.classList.remove(c),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),F.remove();},replay(){h=false,N=-1,_.forEach(me);},pause(){h=true,_.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,_.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));N=Y,h=true,_.forEach((Te,be)=>{Te.classList.remove(c),Te.style.strokeDashoffset=A==="reverse"?`${k[be]*Y}`:`${k[be]*(1-Y)}`,m&&(Te.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return W()},refresh(){_.forEach((y,Y)=>{k[Y]=_e(y),y.style.setProperty("--ssd-len",String(k[Y])),y.style.strokeDasharray=`${k[Y]}`;});}}}if(Wt())return rt(Bt());function Gt(){let o=Math.max(1,ee),c=0,b=0,ue=false;function De(h){let N=true;if(K){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=ke(A==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else _.forEach((W,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Se(Te);W.style.strokeDashoffset=A==="reverse"?`${k[y]*be}`:`${k[y]*(1-be)}`,m&&(W.style.opacity=A==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=ze(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Q!==null?W.style.fillOpacity=`${pe+(Q-pe)*be}`:Q!==null&&(W.style.fillOpacity=`${Q}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",st(i[y],D,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!Re.has(Te)&&(Re.add(Te),w[Y]?.());}}return N}function Ie(h){if(U)return;let N=h-c;z||(z=true,x?.());let W=De(N);if(W&&!H){H=true,De(o*(1+Math.max(0,_.length-1)*V)),g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Fe=setTimeout(()=>{c=performance.now(),z=false,H=false,Re.clear(),Ue(),q=requestAnimationFrame(Ie);},oe));return}W||(q=requestAnimationFrame(Ie));}function Me(){cancelAnimationFrame(q),clearTimeout(Fe),c=performance.now(),b=0,U=false,z=false,H=false,Oe=0,ue=true,he=0,Re.clear(),Ue(),q=requestAnimationFrame(Ie);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&H)?Me():!N.isIntersecting&&!ne&&!H&&(cancelAnimationFrame(q),clearTimeout(Fe),ue=false);});},{root:ve??null,threshold:O,rootMargin:P}),F;function me(){clearTimeout(F),F=setTimeout(()=>{_.forEach((h,N)=>{k[N]=_e(h),h.style.strokeDasharray=`${k[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Fe),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(F);},replay(){Oe=0,Me();},pause(){U||!ue||(U=true,b=performance.now()-c,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,c=performance.now()-b,q=requestAnimationFrame(Ie));},seek(h){let N=Math.min(1,Math.max(0,h));he=N,U=true,b=N*o,c=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return he},refresh(){clearTimeout(F),_.forEach((h,N)=>{k[N]=_e(h),h.style.strokeDasharray=`${k[N]}`;});}}}if(ie)return rt(Gt());wt();function Ye(){if(!Ae||U)return;let o=performance.now(),c=tt();if(!He&&I===false&&c===gt){q=requestAnimationFrame(Ye);return}He=false,gt=c;let b=u;if(I!==false){let v=o-yt,F=v>0?Math.abs(c-(je<0?c:je))/v:0;b=u*Math.max(.2,1+F*(typeof I=="number"?I:1)*.04);}je=c,yt=o;let ue=X?te===-1||c>=te?"forward":"reverse":A;te=c;let De=ge-f,Ie=true,Me=De===0?0:(c-f)/De;if(isNaN(Ve)||(Ve<=0&&Me>0?$?.():Ve>0&&Me<=0&&fe?.(),Ve<1&&Me>=1?S?.():Ve>=1&&Me<1&&R?.()),Ve=Me,K){let v=Se(Z(c,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let F=ue==="reverse"?1-v:v;e.style.clipPath=ke(F),d?.(v),!z&&Z(c,f,ge,b)>0&&(z=true,x?.()),v>=1&&!H?(H=true,g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Fe=setTimeout(()=>{ye=-1,z=false,H=false,e.style.clipPath=ke(0);},oe))):v<1&&!ne&&(H=false),q=requestAnimationFrame(Ye);return}if(_.forEach((v,F)=>{let me=F*V*De,h=Se(Z(c,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${k[F]*h}`:`${k[F]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=ze(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),D&&v.tagName.toLowerCase()==="path"&&i[F]&&v.setAttribute("d",st(i[F],D,h)),F===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(Ie=false);}),w){let v=Se(Z(c,f,ge,b));for(let F in w){let me=parseFloat(F);v>=me&&!Re.has(me)&&(Re.add(me),w[F]?.());}}!z&&Z(c,f,ge,b)>0&&(z=true,x?.()),Ie&&!H?(H=true,g?.(),Oe<(E==="infinite"?1/0:E??0)&&(Oe++,Fe=setTimeout(()=>{ye=-1,z=false,H=false,Re.clear(),Ue(),He=true;},oe))):!Ie&&!ne&&(H=false),q=requestAnimationFrame(Ye);}let nt=false;function Xe(){nt||(nt=true,q=requestAnimationFrame(function(){Ye();}));}function Ke(){nt=false,cancelAnimationFrame(q);}let ot=new IntersectionObserver(o=>{o.forEach(c=>{Ae=c.isIntersecting,Ae&&!U?(He=true,Xe()):Ke();});},{root:ve??null,threshold:O,rootMargin:P});function Et(){_.forEach((o,c)=>{k[c]=_e(o),o.style.strokeDasharray=`${k[c]}`;}),wt(),He=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(Et,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)),G>0?setTimeout(()=>ot.observe(e),G):ot.observe(e),rt({destroy(){cancelAnimationFrame(q),clearTimeout(Fe),Ke(),ot.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),dt();},replay(){ye=-1,te=-1,je=-1,z=false,H=false,Oe=0,U=false,he=0,Re.clear(),clearTimeout(Fe),Ue(),He=true,Ae&&Xe();},pause(){U=true,Ke();},resume(){U&&(U=false,He=true,Ae&&Xe());},seek(o){let c=Math.min(1,Math.max(0,o));he=c,ye=c,U=true,Ke(),qt(c,A),He=true;},getProgress(){return he},refresh(){clearTimeout(Qe),Et(),Ae&&!U&&Xe();}},()=>({tStart:f,tEnd:ge}))}var Dt=new WeakMap,nr=0;function at(e){return JSON.stringify(e,(r,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let t=Dt.get(n);return t===void 0&&Dt.set(n,t=++nr),`el#${t}`}return n})}function lt(e,r){let n={...e};for(let t of Object.keys(n))typeof n[t]=="function"&&(n[t]=(...a)=>r()[t]?.(...a));return n}function or(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ft(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let a=[],s=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}r.push({fn:t[1],nums:a,units:s});}return r}function sr(e,r,n){let t=Ft(e),a=Ft(r);return t.length===0||t.length!==a.length?n<1?e:r:t.map((s,l)=>{let u=a[l];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*n}${s.units[p]}`).join(", ")})`}).join(" ")}function Rt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),a=String(r);if(or(t))return ze(t,a,n);if(t.includes("("))return sr(t,a,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),l=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&l){let u=parseFloat(s[1]),m=parseFloat(l[1]);return `${u+(m-u)*n}${s[2]||l[2]}`}return n<1?t:a}function ir(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var ar=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),lr=0,Ht="--scroll-draw-progress";function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ct(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:a={},easing:s="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:Ce,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=r,C=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(a.start??"top bottom"),I=de(a.end??"bottom top"),O=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:ir(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),Ht])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return D(),B?.(),{...n,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?Je(s):null;function ae(){if(!T||!cr()||!ee||m!=="y"||P||O!==e||u||l!==1||Ce||B||J||X||G||M||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!ar.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++lr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),H=document.createElement("style");H.setAttribute("data-ssd-animate",""),H.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},z(),q(),w,I)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Ae});let ye={destroy(){e.classList.remove(i),H.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,Rt(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return L(Z(z(),te,U,l))}};return ye}if(ae())return d();let x=0,g=0,$=0,S=false,R=false,fe=-1,K=0,Se=false,Pe=NaN,Ne=-1,ve=0,Ee=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ze(O,P,m),f=xe(i,i.scroll,le(),w,I);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Ht,String(i));for(let f of E)e.style.setProperty(f.prop,Rt(f.from,f.to,i));Ce?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&M?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Q(){if(!S||R)return;let i=performance.now(),f=Ee(),ge=l;if(V!==false){let q=i-ve,Ae=q>0?Math.abs(f-(Ne<0?f:Ne))/q:0;ge=l*Math.max(.2,1+Ae*(typeof V=="number"?V:1)*.04);}Ne=f,ve=i;let H=g===x?0:(f-x)/(g-x);pe(H);let z=L(Z(f,x,g,ge));u&&(fe=Math.max(fe,z),z=fe),K=z,j(z),z>=1&&!Se?(Se=true,B?.()):z<1&&!u&&(Se=false),$=requestAnimationFrame(Q);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(Ee(),x,g,l));u&&i>0&&(fe=i),K=i,j(i);}let ke=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!R?$=requestAnimationFrame(Q):cancelAnimationFrame($);});},{root:P??null}),_;function k(){clearTimeout(_),_=setTimeout(ce,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),ke.observe(e),Le(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),ke.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),clearTimeout(_),ie(),$e(e);},replay(){fe=-1,Se=false,K=0,R=false,j(0);},pause(){R=true,cancelAnimationFrame($);},resume(){R&&(R=false,S&&($=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,R=true,cancelAnimationFrame($),j(f);},getProgress(){return K}}}var ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,r){if(typeof window>"u")return ut;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return we("scrollCounter: element not found:",e),ut;let t=n,{from:a=0,to:s,format:l,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=r,A=T!==void 0?d=>d.toFixed(T):l??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Ce=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(s),V?.(),ut;let X=0,G=0,M=0,C=false,L=false,w=-1,I=0,O=false,P=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},P(),E(),Ce,B);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=A(a+(s-a)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!C||L)return;let d=ne(Z(P(),X,G,1));p&&(w=Math.max(w,d),d=w),I=d,D(d),d>=1&&!O?(O=true,V?.()):d<1&&!p&&(O=false),M=requestAnimationFrame(se);}oe();{let d=ne(Z(P(),X,G,1));p&&d>0&&(w=d),I=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{C=x.isIntersecting,C&&!L?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,O=false,I=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(M);},resume(){L&&(L=false,C&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));I=x,w=x,L=true,cancelAnimationFrame(M),D(x);},getProgress(){return I}}}var Nt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,r={}){if(typeof window>"u")return Nt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Nt;let t=n,{trigger:a={},easing:s="linear",once:l=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=r,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Ce=de(a.start??"top top"),B=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=r.from??0,X=r.to,G=0,M=0,C=0,L=false,w=false,I=-1,O=0,P=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),R=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,K=xe({top:R,height:fe},oe(),D(),Ce,B);G=K.tStart,M=K.tEnd;}let ie=NaN;function ee(S){if(!E)return;let R=X??t.duration??0,fe=J+(R-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!L||w||!E||A)return;let S=ne(Z(oe(),G,M,1));l&&(I=Math.max(I,S),S=I),O=S,ee(S),S>=1&&!P?(P=true,T?.()):S<1&&!l&&(P=false),C=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),A){ee(1),p?.();return}se(),p?.(),L&&!w&&(C=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(R=>{L=R.isIntersecting,L&&!w&&E?C=requestAnimationFrame(ae):cancelAnimationFrame(C);});}),g;function $(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Le(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(C),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),$e(t);},replay(){I=-1,P=false,O=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,L&&E&&(C=requestAnimationFrame(ae)));},seek(S){let R=Math.min(1,Math.max(0,S));O=R,I=R,w=true,cancelAnimationFrame(C),ie=NaN,ee(R);},getProgress(){return O}}}function zt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function ur(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function Vt(e){let r=zt(e),n=new Map;for(let s of r){let l=s.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(s);}let t=[],a=Array.from(n.keys()).sort((s,l)=>s-l);for(let s of a){let l=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<l.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,l)=>{e.appendChild(s),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function mr(e,r,n,t){if(n<=1||t===0)return e;let a=(n-1)*t,s=r*t,l=s+(1-a);return l<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(l-s)))}function fr(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,r={}){if(typeof window>"u")return _t;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return we("scrollText: element not found:",e),_t;let t=n,{split:a="words",stagger:s=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=r,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof l=="function"?l:re[l]??re["ease-out"],ne=de(m.start??"top 85%"),Ce=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;a==="chars"?J=ur(t):a==="lines"?J=Vt(t):J=zt(t);let X=J.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let S=fr($,u);S&&(g.style.transform=S);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach(($,S)=>{let R=A(mr(g,S,X,s));G($,R);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let C=0,L=0,w=0,I=false,O=false,P=-1,E=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=xe({top:g.top,height:g.height},D(),se(),ne,Ce);C=$.tStart,L=$.tEnd;}function ee(){if(!I||O)return;let g=Z(D(),C,L,1);p&&(P=Math.max(P,g),g=P),E=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{I=$.isIntersecting,I&&!O?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(a==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Vt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){P=-1,oe=false,E=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(ee)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,P=$,O=true,cancelAnimationFrame(w),M($);},getProgress(){return E}}}function Ge(e,r,n){let t=r,a=at(r),s=n(e,lt(r,()=>t));return {update(l){t=l;let u=at(l);u!==a&&(a=u,s.destroy(),s=n(e,lt(l,()=>t)));},destroy(){s.destroy();}}}function fn(e,r={}){return Ge(e,r,it)}function pn(e={}){let r=null;function n(t){return r=it(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function dn(e,r){return Ge(e,r,ct)}function gn(e){let r=null;function n(t){return r=ct(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function yn(e,r){return Ge(e,r,mt)}function hn(e){let r=null;function n(t){return r=mt(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function bn(e,r={}){return Ge(e,r,ft)}function wn(e={}){let r=null;function n(t){return r=ft(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}function vn(e,r={}){return Ge(e,r,pt)}function En(e={}){let r=null;function n(t){return r=pt(t,e),{destroy(){r?.destroy(),r=null;}}}return {action:n,getInstance:()=>r}}exports.createScrollAnimate=gn;exports.createScrollCounter=hn;exports.createScrollDraw=pn;exports.createScrollText=En;exports.createScrollVideo=wn;exports.scrollAnimate=dn;exports.scrollCounterAction=yn;exports.scrollDraw=fn;exports.scrollTextAction=vn;exports.scrollVideoAction=bn;
|
package/dist/svelte/index.d.mts
CHANGED
|
@@ -13,7 +13,7 @@ import { ScrollTextOptions } from '../text/index.mjs';
|
|
|
13
13
|
* </div>
|
|
14
14
|
*/
|
|
15
15
|
declare function scrollDraw(node: HTMLElement, options?: ScrollDrawOptions): {
|
|
16
|
-
update(
|
|
16
|
+
update(next: ScrollDrawOptions): void;
|
|
17
17
|
destroy(): void;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
@@ -42,7 +42,7 @@ declare function createScrollDraw(options?: ScrollDrawOptions): {
|
|
|
42
42
|
* </div>
|
|
43
43
|
*/
|
|
44
44
|
declare function scrollAnimate(node: HTMLElement, options: ScrollAnimateOptions): {
|
|
45
|
-
update(
|
|
45
|
+
update(next: ScrollAnimateOptions): void;
|
|
46
46
|
destroy(): void;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
@@ -71,7 +71,7 @@ declare function createScrollAnimate(options: ScrollAnimateOptions): {
|
|
|
71
71
|
* <span use:scrollCounterAction={{ to: 1250000, format: n => '$' + Math.round(n).toLocaleString(), once: true }} />
|
|
72
72
|
*/
|
|
73
73
|
declare function scrollCounterAction(node: HTMLElement, options: ScrollCounterOptions): {
|
|
74
|
-
update(
|
|
74
|
+
update(next: ScrollCounterOptions): void;
|
|
75
75
|
destroy(): void;
|
|
76
76
|
};
|
|
77
77
|
/**
|
|
@@ -98,7 +98,7 @@ declare function createScrollCounter(options: ScrollCounterOptions): {
|
|
|
98
98
|
* src="/hero.mp4" muted playsinline preload="auto" />
|
|
99
99
|
*/
|
|
100
100
|
declare function scrollVideoAction(node: HTMLVideoElement, options?: ScrollVideoOptions): {
|
|
101
|
-
update(
|
|
101
|
+
update(next: ScrollVideoOptions): void;
|
|
102
102
|
destroy(): void;
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
@@ -126,7 +126,7 @@ declare function createScrollVideo(options?: ScrollVideoOptions): {
|
|
|
126
126
|
* </h2>
|
|
127
127
|
*/
|
|
128
128
|
declare function scrollTextAction(node: HTMLElement, options?: ScrollTextOptions): {
|
|
129
|
-
update(
|
|
129
|
+
update(next: ScrollTextOptions): void;
|
|
130
130
|
destroy(): void;
|
|
131
131
|
};
|
|
132
132
|
/**
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { ScrollTextOptions } from '../text/index.js';
|
|
|
13
13
|
* </div>
|
|
14
14
|
*/
|
|
15
15
|
declare function scrollDraw(node: HTMLElement, options?: ScrollDrawOptions): {
|
|
16
|
-
update(
|
|
16
|
+
update(next: ScrollDrawOptions): void;
|
|
17
17
|
destroy(): void;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
@@ -42,7 +42,7 @@ declare function createScrollDraw(options?: ScrollDrawOptions): {
|
|
|
42
42
|
* </div>
|
|
43
43
|
*/
|
|
44
44
|
declare function scrollAnimate(node: HTMLElement, options: ScrollAnimateOptions): {
|
|
45
|
-
update(
|
|
45
|
+
update(next: ScrollAnimateOptions): void;
|
|
46
46
|
destroy(): void;
|
|
47
47
|
};
|
|
48
48
|
/**
|
|
@@ -71,7 +71,7 @@ declare function createScrollAnimate(options: ScrollAnimateOptions): {
|
|
|
71
71
|
* <span use:scrollCounterAction={{ to: 1250000, format: n => '$' + Math.round(n).toLocaleString(), once: true }} />
|
|
72
72
|
*/
|
|
73
73
|
declare function scrollCounterAction(node: HTMLElement, options: ScrollCounterOptions): {
|
|
74
|
-
update(
|
|
74
|
+
update(next: ScrollCounterOptions): void;
|
|
75
75
|
destroy(): void;
|
|
76
76
|
};
|
|
77
77
|
/**
|
|
@@ -98,7 +98,7 @@ declare function createScrollCounter(options: ScrollCounterOptions): {
|
|
|
98
98
|
* src="/hero.mp4" muted playsinline preload="auto" />
|
|
99
99
|
*/
|
|
100
100
|
declare function scrollVideoAction(node: HTMLVideoElement, options?: ScrollVideoOptions): {
|
|
101
|
-
update(
|
|
101
|
+
update(next: ScrollVideoOptions): void;
|
|
102
102
|
destroy(): void;
|
|
103
103
|
};
|
|
104
104
|
/**
|
|
@@ -126,7 +126,7 @@ declare function createScrollVideo(options?: ScrollVideoOptions): {
|
|
|
126
126
|
* </h2>
|
|
127
127
|
*/
|
|
128
128
|
declare function scrollTextAction(node: HTMLElement, options?: ScrollTextOptions): {
|
|
129
|
-
update(
|
|
129
|
+
update(next: ScrollTextOptions): void;
|
|
130
130
|
destroy(): void;
|
|
131
131
|
};
|
|
132
132
|
/**
|
package/dist/svelte/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$
|
|
1
|
+
import {a as a$4,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-JC5BD4RB.mjs';import {a as a$2}from'../chunk-SNCRC6BA.mjs';import {a as a$1}from'../chunk-4MH5SQTH.mjs';import {a}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-WDIHLRZZ.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function r(n,t,o){let e=t,f=a$4(t),l=o(n,b$1(t,()=>e));return {update(c){e=c;let d=a$4(c);d!==f&&(f=d,l.destroy(),l=o(n,b$1(c,()=>e)));},destroy(){l.destroy();}}}function D(n,t={}){return r(n,t,b)}function I(n={}){let t=null;function o(e){return t=b(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function A(n,t){return r(n,t,a)}function H(n){let t=null;function o(e){return t=a(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function L(n,t){return r(n,t,a$1)}function M(n){let t=null;function o(e){return t=a$1(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function V(n,t={}){return r(n,t,a$3)}function g(n={}){let t=null;function o(e){return t=a$3(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function C(n,t={}){return r(n,t,a$2)}function v(n={}){let t=null;function o(e){return t=a$2(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}export{H as createScrollAnimate,M as createScrollCounter,I as createScrollDraw,v as createScrollText,g as createScrollVideo,A as scrollAnimate,L as scrollCounterAction,D as scrollDraw,C as scrollTextAction,V as scrollVideoAction};
|
package/dist/vue/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function
|
|
1
|
+
'use strict';var vue=require('vue');function Kt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(a,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let M=1-Math.pow(t,T);return M+(1-M)*(2*V-1)*(2*V-1)}return 1}}function Qt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),a=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Kt(),elastic:Qt()};function xt(e,n,r){return Math.min(r,Math.max(n,e))}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 Mt(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 At(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 Z(e,n,r,t){return r===n?0:xt((e-n)/(r-n)*t,0,1)}function xe(e,n,r,t,a){let s=Mt(e.top,e.height,n,t.element)-At(t.viewport,r),c=Mt(e.top,e.height,n,a.element)-At(a.viewport,r);return {tStart:s,tEnd:c}}function rt(e,n,r){let t=e.getBoundingClientRect(),a=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:a,scroll:0}:{top:r==="x"?t.left:t.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function qe(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 Lt(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 Be(e,n,r){let t=Lt(e),a=Lt(n);return !t||!a?e:`rgb(${Math.round(t[0]+(a[0]-t[0])*r)},${Math.round(t[1]+(a[1]-t[1])*r)},${Math.round(t[2]+(a[2]-t[2])*r)})`}var Ct={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 je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...n){je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Zt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Jt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",$t=33;function er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function tr(e){let n=[];for(let r=0;r<$t;r++){let t=r/($t-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function nt(e){switch(e){case "linear":return "linear";case "ease-in":return Zt;case "ease-out":return Jt;case "ease-in-out":return er()?tr(re["ease-in-out"]):null;default:return null}}var Pt=Symbol.for("svg-scroll-draw.registry");function Ot(){let e=globalThis;return e[Pt]||(e[Pt]=new Map)}function Le(e,n){Ot().set(e,n);}function Ce(e){Ot().delete(e);}var rr=0;function nr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function kt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Rt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function or(e){if(!je)return;let n=kt(e,"stroke");if(!n||n==="none"){we("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Rt.has(r)&&!Rt.has(kt(e,"fill"))&&we("Element has a fill \u2014 it may obscure the stroke animation.",e);}function sr(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 a(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Rt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,It=/[MmLlHhVvCcSsQqTtAaZz]/g;function nr(e,n,r){if(!Ue)return;let t=(e.match(It)??[]).join("").toUpperCase(),l=(n.match(It)??[]).join("").toUpperCase(),s=(e.match(Rt)??[]).length,c=(n.match(Rt)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ct(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function ut(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...Ct[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:A="forward",once:ne=false,debug:$e=false,axis:W="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:$,fillOpacity:L,waypoints:w,velocityScale:k=false,threshold:F=0,rootMargin:P="0px",repeat:S=0,repeatDelay:oe=0,morphTo:R,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:C,onLeave:E,onEnterBack:D,onLeaveBack:fe}=l,Q=se===true?"left":typeof se=="string"?se:false,Ee=typeof p=="function"?p:re[p]??re.linear,Pe=de(T.start??"top bottom"),_e=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Se=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray($)?$[0]:null,j=Array.isArray($)?$[1]:typeof $=="number"?$:null,pe=Array.isArray(L)?L[0]:null,Z=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Oe(o){let a=o*100;switch(Q){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=Q?[]:Array.from(e.querySelectorAll(c)),O=[],i=[],f=0,ge=0,N=false,_=false,q=0,Ae=false,ye=-1,te=-1,U=false,he=0,De=0,He,ot=null;function yt(){ot?.destroy(),ot=null;}let Ve=new Set,ht=NaN,ze=true,Qe=-1,bt=performance.now(),qe=NaN;function st(){return ve?W==="x"?ve.scrollLeft:ve.scrollTop:W==="x"?window.scrollX:window.scrollY}function wt(){return ve?W==="x"?ve.clientWidth:ve.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function vt(){let o=rt(e,ve,W);return xe(o,o.scroll,wt(),Pe,_e)}function St(){(({tStart:f,tEnd:ge}=vt())),$e&&Ue&&(yt(),ot=rr(f,ge,W));}function it(o,a=vt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Ce(e);},o}function Bt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),Q){let b=a==="reverse"?1-o:o;e.style.clipPath=Oe(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${O[ue]*o}`:`${O[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Se&&le?b.style.stroke=We(Se,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*o}`:Z!==null&&(b.style.fillOpacity=`${Z}`),R&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ct(i[ue],R,o));});}function Ze(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Oe(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${O[a]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${O[a]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),R&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{tr(o);let a=Be(o);O.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),R&&(b?nr(i[i.length-1],R,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),R&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",R)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?"0":`${a}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Oe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Oe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Et=typeof p=="string"?nt(p):null;function Wt(){return !(ae===false||!er()||!z.length||!Et||Q||W!=="y"||ve||u!==1||V!==0||ne||X||k!==false||R||w||S||G>0||d||x||g||C||E||D||fe||M!=null||$!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Gt(){let o=++Jt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Ne=A==="reverse"?"0":"var(--ssd-len)",ke=A==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${Ne};`,v=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${a}{from{${Me}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Et};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(me);let h=false,H=-1;function B(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:y.top,height:y.height},st(),wt(),Pe,_e);return Ee(K(st(),Y,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),I.remove();},replay(){h=false,H=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));H=Y,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=A==="reverse"?`${O[be]*Y}`:`${O[be]*(1-Y)}`,m&&(Te.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return B()},refresh(){z.forEach((y,Y)=>{O[Y]=Be(y),y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`;});}}}if(Wt())return it(Gt());function jt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Ne(h){let H=true;if(Q){let B=Math.min(1,Math.max(0,h/o)),y=Ee(B);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Oe(A==="reverse"?1-y:y),d?.(y),B<1&&(H=false);}else z.forEach((B,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Ee(Te);B.style.strokeDashoffset=A==="reverse"?`${O[y]*be}`:`${O[y]*(1-be)}`,m&&(B.style.opacity=A==="reverse"?`${1-be}`:`${be}`),Se&&le?B.style.stroke=We(Se,le,be):le&&(B.style.stroke=le),ce!==null&&j!==null?B.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(B.style.strokeWidth=`${j}`),pe!==null&&Z!==null?B.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(B.style.fillOpacity=`${Z}`),R&&B.tagName.toLowerCase()==="path"&&i[y]&&B.setAttribute("d",ct(i[y],R,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(H=false);});if(w){let B=Math.min(1,Math.max(0,h/o)),y=Ee(B);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!Ve.has(Te)&&(Ve.add(Te),w[Y]?.());}}return H}function ke(h){if(U)return;let H=h-a;_||(_=true,x?.());let B=Ne(H);if(B&&!N){N=true,Ne(o*(1+Math.max(0,z.length-1)*V)),g?.(),De<(S==="infinite"?1/0:S??0)&&(De++,He=setTimeout(()=>{a=performance.now(),_=false,N=false,Ve.clear(),Ze(),q=requestAnimationFrame(ke);},oe));return}B||(q=requestAnimationFrame(ke));}function Me(){cancelAnimationFrame(q),clearTimeout(He),a=performance.now(),b=0,U=false,_=false,N=false,De=0,ue=true,he=0,Ve.clear(),Ze(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&N)?Me():!H.isIntersecting&&!ne&&!N&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:ve??null,threshold:F,rootMargin:P}),I;function me(){clearTimeout(I),I=setTimeout(()=>{z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(He),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(I);},replay(){De=0,Me();},pause(){U||!ue||(U=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let H=Math.min(1,Math.max(0,h));he=H,U=true,b=H*o,a=performance.now()-b,cancelAnimationFrame(q),Ne(b);},getProgress(){return he},refresh(){clearTimeout(I),z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return it(jt());St();function Ke(){if(!Ae||U)return;let o=performance.now(),a=st();if(!ze&&k===false&&a===ht){q=requestAnimationFrame(Ke);return}ze=false,ht=a;let b=u;if(k!==false){let v=o-bt,I=v>0?Math.abs(a-(Qe<0?a:Qe))/v:0;b=u*Math.max(.2,1+I*(typeof k=="number"?k:1)*.04);}Qe=a,bt=o;let ue=X?te===-1||a>=te?"forward":"reverse":A;te=a;let Ne=ge-f,ke=true,Me=Ne===0?0:(a-f)/Ne;if(isNaN(qe)||(qe<=0&&Me>0?C?.():qe>0&&Me<=0&&fe?.(),qe<1&&Me>=1?E?.():qe>=1&&Me<1&&D?.()),qe=Me,Q){let v=Ee(K(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let I=ue==="reverse"?1-v:v;e.style.clipPath=Oe(I),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!N?(N=true,g?.(),De<(S==="infinite"?1/0:S??0)&&(De++,He=setTimeout(()=>{ye=-1,_=false,N=false,e.style.clipPath=Oe(0);},oe))):v<1&&!ne&&(N=false),q=requestAnimationFrame(Ke);return}if(z.forEach((v,I)=>{let me=I*V*Ne,h=Ee(K(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${O[I]*h}`:`${O[I]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Se&&le?v.style.stroke=We(Se,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*h}`:Z!==null&&(v.style.fillOpacity=`${Z}`),R&&v.tagName.toLowerCase()==="path"&&i[I]&&v.setAttribute("d",ct(i[I],R,h)),I===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=Ee(K(a,f,ge,b));for(let I in w){let me=parseFloat(I);v>=me&&!Ve.has(me)&&(Ve.add(me),w[I]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!N?(N=true,g?.(),De<(S==="infinite"?1/0:S??0)&&(De++,He=setTimeout(()=>{ye=-1,_=false,N=false,Ve.clear(),Ze(),ze=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Ke);}let at=false;function Je(){at||(at=true,q=requestAnimationFrame(function(){Ke();}));}function et(){at=false,cancelAnimationFrame(q);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!U?(ze=true,Je()):et();});},{root:ve??null,threshold:F,rootMargin:P});function Tt(){z.forEach((o,a)=>{O[a]=Be(o),o.style.strokeDasharray=`${O[a]}`;}),St(),ze=true;}let tt;function Ge(){clearTimeout(tt),tt=setTimeout(Tt,150);}window.addEventListener("resize",Ge),window.addEventListener("orientationchange",Ge);let je;return typeof ResizeObserver<"u"&&(je=new ResizeObserver(()=>Ge()),je.observe(document.body),je.observe(document.documentElement),je.observe(e)),G>0?setTimeout(()=>lt.observe(e),G):lt.observe(e),it({destroy(){cancelAnimationFrame(q),clearTimeout(He),et(),lt.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(tt),yt();},replay(){ye=-1,te=-1,Qe=-1,_=false,N=false,De=0,U=false,he=0,Ve.clear(),clearTimeout(He),Ze(),ze=true,Ae&&Je();},pause(){U=true,et();},resume(){U&&(U=false,ze=true,Ae&&Je());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,et(),Bt(a,A),ze=true;},getProgress(){return he},refresh(){clearTimeout(tt),Tt(),Ae&&!U&&Je();}},()=>({tStart:f,tEnd:ge}))}function or(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Dt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function sr(e,n,r){let t=Dt(e),l=Dt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function Nt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(or(t))return We(t,l,r);if(t.includes("("))return sr(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function ir(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ar=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),lr=0,Ht="--scroll-draw-progress";function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function mt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:$e,onComplete:W,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,$=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),F=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([i,f])=>({prop:ir(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function R(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...S.map(f=>f.prop),Ht])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return R(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?nt(s):null;function ae(){if(!T||!cr()||!ee||m!=="y"||P||F!==e||u||c!==1||$e||W||J||X||G||M||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!ar.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++lr}`,f=S.map(te=>`${te.prop}:${te.from}`).join(";"),ge=S.map(te=>`${te.prop}:${te.to}`).join(";"),N=document.createElement("style");N.setAttribute("data-ssd-animate",""),N.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},_(),q(),w,k)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Ae});let ye={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",ie(),Ce(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of S)e.style.setProperty(he.prop,Nt(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return L(K(_(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,C=0,E=false,D=false,fe=-1,Q=0,Ee=false,Pe=NaN,_e=-1,ve=0,Se=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=rt(F,P,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Ht,String(i));for(let f of S)e.style.setProperty(f.prop,Nt(f.from,f.to,i));$e?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&M?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Z(){if(!E||D)return;let i=performance.now(),f=Se(),ge=c;if(V!==false){let q=i-ve,Ae=q>0?Math.abs(f-(_e<0?f:_e))/q:0;ge=c*Math.max(.2,1+Ae*(typeof V=="number"?V:1)*.04);}_e=f,ve=i;let N=g===x?0:(f-x)/(g-x);pe(N);let _=L(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Ee?(Ee=true,W?.()):_<1&&!u&&(Ee=false),C=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(K(Se(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let Oe=new IntersectionObserver(i=>{i.forEach(f=>{E=f.isIntersecting,E&&!D?C=requestAnimationFrame(Z):cancelAnimationFrame(C);});},{root:P??null}),z;function O(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Oe.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(C),Oe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(z),ie(),Ce(e);},replay(){fe=-1,Ee=false,Q=0,D=false,j(0);},pause(){D=true,cancelAnimationFrame(C);},resume(){D&&(D=false,E&&(C=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,D=true,cancelAnimationFrame(C),j(f);},getProgress(){return Q}}}var ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,n){if(typeof window>"u")return ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ft;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,A=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],$e=de(m.start??"top 80%"),W=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(s),V?.(),ft;let X=0,G=0,M=0,$=false,L=false,w=-1,k=0,F=false,P=()=>window.scrollY,S=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},P(),S(),$e,W);X=x.tStart,G=x.tEnd;}function R(d){t.textContent=A(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||L)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,R(d),d>=1&&!F?(F=true,V?.()):d<1&&!p&&(F=false),M=requestAnimationFrame(se);}oe();{let d=ne(K(P(),X,G,1));p&&d>0&&(w=d),k=d,R(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{$=x.isIntersecting,$&&!L?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),Ce(t);},replay(){w=-1,F=false,k=0,L=false,R(0);},pause(){L=true,cancelAnimationFrame(M);},resume(){L&&(L=false,$&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,L=true,cancelAnimationFrame(M),R(x);},getProgress(){return k}}}var Vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return Vt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Vt;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,$e=de(l.start??"top top"),W=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,M=0,$=0,L=false,w=false,k=-1,F=0,P=false,S=false,oe=()=>u==="x"?window.scrollX:window.scrollY,R=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let E=t.getBoundingClientRect(),D=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,Q=xe({top:D,height:fe},oe(),R(),$e,W);G=Q.tStart,M=Q.tEnd;}let ie=NaN;function ee(E){if(!S)return;let D=X??t.duration??0,fe=J+(D-J)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!L||w||!S||A)return;let E=ne(K(oe(),G,M,1));c&&(k=Math.max(k,E),E=k),F=E,ee(E),E>=1&&!P?(P=true,T?.()):E<1&&!c&&(P=false),$=requestAnimationFrame(ae);}function d(){if(S=true,X===void 0&&(X=t.duration),A){ee(1),p?.();return}se(),p?.(),L&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(D=>{L=D.isIntersecting,L&&!w&&S?$=requestAnimationFrame(ae):cancelAnimationFrame($);});}),g;function C(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),x.observe(t),Le(t,{type:"video",getProgress:()=>F,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(g),Ce(t);},replay(){k=-1,P=false,F=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,L&&S&&($=requestAnimationFrame(ae)));},seek(E){let D=Math.min(1,Math.max(0,E));F=D,k=D,w=true,cancelAnimationFrame($),ie=NaN,ee(D);},getProgress(){return F}}}function qt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function ur(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function zt(e){let n=qt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function mr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function fr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),_t;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),$e=de(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=ur(t):l==="lines"?J=zt(t):J=qt(t);let X=J.length;function G(g,C){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*C));let E=fr(C,u);E&&(g.style.transform=E);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((C,E)=>{let D=A(mr(g,E,X,s));G(C,D);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let $=0,L=0,w=0,k=false,F=false,P=-1,S=0,oe=false,R=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),C=xe({top:g.top,height:g.height},R(),se(),ne,$e);$=C.tStart,L=C.tEnd;}function ee(){if(!k||F)return;let g=K(R(),$,L,1);p&&(P=Math.max(P,g),g=P),S=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach(C=>{k=C.isIntersecting,k&&!F?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),J=zt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=W,t.removeAttribute("aria-label"),Ce(t);},replay(){P=-1,oe=false,S=0,F=false,M(0);},pause(){F=true,cancelAnimationFrame(w);},resume(){F&&(F=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let C=Math.min(1,Math.max(0,g));S=C,P=C,F=true,cancelAnimationFrame(w),M(C);},getProgress(){return S}}}function mn(e={}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r=ut(n.value,e);vue.onUnmounted(()=>r.destroy());}),n}var fn=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:n}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let t={};e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete);let l=ut(r.value,t);vue.onUnmounted(()=>l.destroy());}),()=>vue.h("div",{ref:r},n.default?.())}});function pn(e){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r=mt(n.value,e);vue.onUnmounted(()=>r.destroy());}),n}var dn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let t=mt(r.value,e.options);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("div",{ref:r},n.default?.())}});function gn(e){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r=pt(n.value,e);vue.onUnmounted(()=>r.destroy());}),n}var yn=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r={to:e.to};e.from!=null&&(r.from=e.from),e.format!=null&&(r.format=e.format),e.easing!=null&&(r.easing=e.easing),e.trigger!=null&&(r.trigger=e.trigger),e.once!=null&&(r.once=e.once),e.decimals!=null&&(r.decimals=e.decimals),e.onComplete!=null&&(r.onComplete=e.onComplete);let t=pt(n.value,r);vue.onUnmounted(()=>t.destroy());}),()=>vue.h("span",{ref:n})}});function hn(e={}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r=dt(n.value,e);vue.onUnmounted(()=>r.destroy());}),n}var bn=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r=dt(n.value,e.options??{});vue.onUnmounted(()=>r.destroy());}),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function wn(e={}){let n=vue.ref(null);return vue.onMounted(()=>{if(!n.value)return;let r=gt(n.value,e);vue.onUnmounted(()=>r.destroy());}),n}var vn=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let r=vue.ref(null);return vue.onMounted(()=>{if(!r.value)return;let t=gt(r.value,e.options??{});vue.onUnmounted(()=>t.destroy());}),()=>vue.h(e.tag,{ref:r},n.default?.())}});exports.ScrollAnimate=dn;exports.ScrollCounter=yn;exports.ScrollDraw=fn;exports.ScrollText=vn;exports.ScrollVideo=bn;exports.useScrollAnimate=pn;exports.useScrollCounter=gn;exports.useScrollDraw=mn;exports.useScrollText=wn;exports.useScrollVideo=hn;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var Ft=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,It=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!je)return;let t=(e.match(It)??[]).join("").toUpperCase(),a=(n.match(It)??[]).join("").toUpperCase(),s=(e.match(Ft)??[]).length,c=(n.match(Ft)??[]).length;if(t!==a){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function ct(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[a++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function ut(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,a=r?{...Ct[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:M="forward",once:ne=false,debug:$e=false,axis:W="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:$,fillOpacity:L,waypoints:w,velocityScale:k=false,threshold:R=0,rootMargin:P="0px",repeat:S=0,repeatDelay:oe=0,morphTo:F,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:C,onLeave:E,onEnterBack:D,onLeaveBack:fe}=a,K=se===true?"left":typeof se=="string"?se:false,Ee=typeof p=="function"?p:re[p]??re.linear,Pe=de(T.start??"top bottom"),_e=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Se=Array.isArray(A)?A[0]:null,le=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ce=Array.isArray($)?$[0]:null,j=Array.isArray($)?$[1]:typeof $=="number"?$:null,pe=Array.isArray(L)?L[0]:null,Q=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Oe(o){let l=o*100;switch(K){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(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let _=K?[]:Array.from(e.querySelectorAll(c)),O=[],i=[],f=0,ge=0,N=false,z=false,q=0,Me=false,ye=-1,te=-1,U=false,he=0,Ie=0,Ne,ot=null;function yt(){ot?.destroy(),ot=null;}let He=new Set,ht=NaN,Ve=true,Ke=-1,bt=performance.now(),ze=NaN;function st(){return ve?W==="x"?ve.scrollLeft:ve.scrollTop:W==="x"?window.scrollX:window.scrollY}function wt(){return ve?W==="x"?ve.clientWidth:ve.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function vt(){let o=rt(e,ve,W);return xe(o,o.scroll,wt(),Pe,_e)}function St(){(({tStart:f,tEnd:ge}=vt())),$e&&je&&(yt(),ot=sr(f,ge,W));}function it(o,l=vt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let b=o.destroy;return o.destroy=()=>{b.call(o),Ce(e);},o}function jt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=l==="reverse"?1-o:o;e.style.clipPath=Oe(b);return}_.forEach((b,ue)=>{b.style.strokeDashoffset=l==="reverse"?`${O[ue]*o}`:`${O[ue]*(1-o)}`,m&&(b.style.opacity=l==="reverse"?`${1-o}`:`${o}`),Se&&le?b.style.stroke=Be(Se,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),F&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ct(i[ue],F,o));});}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=Oe(0);return}_.forEach((o,l)=>{o.style.strokeDasharray=`${O[l]}`,o.style.strokeDashoffset=M==="reverse"?"0":`${O[l]}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),F&&o.tagName.toLowerCase()==="path"&&i[l]&&o.setAttribute("d",i[l]);});}if(_.forEach(o=>{or(o);let l=qe(o);O.push(l);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),F&&(b?ir(i[i.length-1],F,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=M==="reverse"?`${l}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=M==="reverse"?"0":`${l}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=Oe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Oe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Et=typeof p=="string"?nt(p):null;function Ut(){return !(ae===false||!nr()||!_.length||!Et||K||W!=="y"||ve||u!==1||V!==0||ne||X||k!==false||F||w||S||G>0||d||x||g||C||E||D||fe||A!=null||$!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Yt(){let o=++rr,l=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,De=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${De};`,v=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${M==="reverse"?1:0};`,v+=`opacity:${M==="reverse"?0:1};`);let I=document.createElement("style");I.setAttribute("data-svg-scroll-draw",""),I.textContent=`@keyframes ${l}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Et};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(l);}_.forEach(me);let h=false,H=-1;function B(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Te}=xe({top:y.top,height:y.height},st(),wt(),Pe,_e);return Ee(Z(st(),Y,Te,u))}return {destroy(){e.classList.remove(b),_.forEach(y=>{y.classList.remove(l),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),I.remove();},replay(){h=false,H=-1,_.forEach(me);},pause(){h=true,_.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,_.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));H=Y,h=true,_.forEach((Te,be)=>{Te.classList.remove(l),Te.style.strokeDashoffset=M==="reverse"?`${O[be]*Y}`:`${O[be]*(1-Y)}`,m&&(Te.style.opacity=M==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return B()},refresh(){_.forEach((y,Y)=>{O[Y]=qe(y),y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`;});}}}if(Ut())return it(Yt());function Xt(){let o=Math.max(1,ee),l=0,b=0,ue=false;function De(h){let H=true;if(K){let B=Math.min(1,Math.max(0,h/o)),y=Ee(B);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Oe(M==="reverse"?1-y:y),d?.(y),B<1&&(H=false);}else _.forEach((B,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Ee(Te);B.style.strokeDashoffset=M==="reverse"?`${O[y]*be}`:`${O[y]*(1-be)}`,m&&(B.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Se&&le?B.style.stroke=Be(Se,le,be):le&&(B.style.stroke=le),ce!==null&&j!==null?B.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(B.style.strokeWidth=`${j}`),pe!==null&&Q!==null?B.style.fillOpacity=`${pe+(Q-pe)*be}`:Q!==null&&(B.style.fillOpacity=`${Q}`),F&&B.tagName.toLowerCase()==="path"&&i[y]&&B.setAttribute("d",ct(i[y],F,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(H=false);});if(w){let B=Math.min(1,Math.max(0,h/o)),y=Ee(B);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!He.has(Te)&&(He.add(Te),w[Y]?.());}}return H}function ke(h){if(U)return;let H=h-l;z||(z=true,x?.());let B=De(H);if(B&&!N){N=true,De(o*(1+Math.max(0,_.length-1)*V)),g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,Ne=setTimeout(()=>{l=performance.now(),z=false,N=false,He.clear(),Qe(),q=requestAnimationFrame(ke);},oe));return}B||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(Ne),l=performance.now(),b=0,U=false,z=false,N=false,Ie=0,ue=true,he=0,He.clear(),Qe(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&N)?Ae():!H.isIntersecting&&!ne&&!N&&(cancelAnimationFrame(q),clearTimeout(Ne),ue=false);});},{root:ve??null,threshold:R,rootMargin:P}),I;function me(){clearTimeout(I),I=setTimeout(()=>{_.forEach((h,H)=>{O[H]=qe(h),h.style.strokeDasharray=`${O[H]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Ne),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(I);},replay(){Ie=0,Ae();},pause(){U||!ue||(U=true,b=performance.now()-l,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,l=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let H=Math.min(1,Math.max(0,h));he=H,U=true,b=H*o,l=performance.now()-b,cancelAnimationFrame(q),De(b);},getProgress(){return he},refresh(){clearTimeout(I),_.forEach((h,H)=>{O[H]=qe(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return it(Xt());St();function Ze(){if(!Me||U)return;let o=performance.now(),l=st();if(!Ve&&k===false&&l===ht){q=requestAnimationFrame(Ze);return}Ve=false,ht=l;let b=u;if(k!==false){let v=o-bt,I=v>0?Math.abs(l-(Ke<0?l:Ke))/v:0;b=u*Math.max(.2,1+I*(typeof k=="number"?k:1)*.04);}Ke=l,bt=o;let ue=X?te===-1||l>=te?"forward":"reverse":M;te=l;let De=ge-f,ke=true,Ae=De===0?0:(l-f)/De;if(isNaN(ze)||(ze<=0&&Ae>0?C?.():ze>0&&Ae<=0&&fe?.(),ze<1&&Ae>=1?E?.():ze>=1&&Ae<1&&D?.()),ze=Ae,K){let v=Ee(Z(l,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let I=ue==="reverse"?1-v:v;e.style.clipPath=Oe(I),d?.(v),!z&&Z(l,f,ge,b)>0&&(z=true,x?.()),v>=1&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,z=false,N=false,e.style.clipPath=Oe(0);},oe))):v<1&&!ne&&(N=false),q=requestAnimationFrame(Ze);return}if(_.forEach((v,I)=>{let me=I*V*De,h=Ee(Z(l,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${O[I]*h}`:`${O[I]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Se&&le?v.style.stroke=Be(Se,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Q!==null?v.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(v.style.fillOpacity=`${Q}`),F&&v.tagName.toLowerCase()==="path"&&i[I]&&v.setAttribute("d",ct(i[I],F,h)),I===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=Ee(Z(l,f,ge,b));for(let I in w){let me=parseFloat(I);v>=me&&!He.has(me)&&(He.add(me),w[I]?.());}}!z&&Z(l,f,ge,b)>0&&(z=true,x?.()),ke&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,z=false,N=false,He.clear(),Qe(),Ve=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Ze);}let at=false;function Je(){at||(at=true,q=requestAnimationFrame(function(){Ze();}));}function et(){at=false,cancelAnimationFrame(q);}let lt=new IntersectionObserver(o=>{o.forEach(l=>{Me=l.isIntersecting,Me&&!U?(Ve=true,Je()):et();});},{root:ve??null,threshold:R,rootMargin:P});function Tt(){_.forEach((o,l)=>{O[l]=qe(o),o.style.strokeDasharray=`${O[l]}`;}),St(),Ve=true;}let tt;function We(){clearTimeout(tt),tt=setTimeout(Tt,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>We()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),G>0?setTimeout(()=>lt.observe(e),G):lt.observe(e),it({destroy(){cancelAnimationFrame(q),clearTimeout(Ne),et(),lt.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(tt),yt();},replay(){ye=-1,te=-1,Ke=-1,z=false,N=false,Ie=0,U=false,he=0,He.clear(),clearTimeout(Ne),Qe(),Ve=true,Me&&Je();},pause(){U=true,et();},resume(){U&&(U=false,Ve=true,Me&&Je());},seek(o){let l=Math.min(1,Math.max(0,o));he=l,ye=l,U=true,et(),jt(l,M),Ve=true;},getProgress(){return he},refresh(){clearTimeout(tt),Tt(),Me&&!U&&Je();}},()=>({tStart:f,tEnd:ge}))}var Dt=new WeakMap,ar=0;function Nt(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=Dt.get(r);return t===void 0&&Dt.set(r,t=++ar),`el#${t}`}return r})}function Ht(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...a)=>n()[t]?.(...a));return r}function lr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Vt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let a=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:a,units:s});}return n}function cr(e,n,r){let t=Vt(e),a=Vt(n);return t.length===0||t.length!==a.length?r<1?e:n:t.map((s,c)=>{let u=a[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function _t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),a=String(n);if(lr(t))return Be(t,a,r);if(t.includes("("))return cr(t,a,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:a}function ur(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),fr=0,zt="--scroll-draw-progress";function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function mt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:a={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:M=true,triggerElement:ne,onProgress:$e,onComplete:W,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,$=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(a.start??"top bottom"),k=de(a.end??"bottom top"),R=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([i,f])=>({prop:ur(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function F(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...S.map(f=>f.prop),zt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return F(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?nt(s):null;function ae(){if(!T||!pr()||!ee||m!=="y"||P||R!==e||u||c!==1||$e||W||J||X||G||A||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!mr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++fr}`,f=S.map(te=>`${te.prop}:${te.from}`).join(";"),ge=S.map(te=>`${te.prop}:${te.to}`).join(";"),N=document.createElement("style");N.setAttribute("data-ssd-animate",""),N.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},z(),q(),w,k)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",ie(),Ce(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let U=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of S)e.style.setProperty(he.prop,_t(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Me();return L(Z(z(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,C=0,E=false,D=false,fe=-1,K=0,Ee=false,Pe=NaN,_e=-1,ve=0,Se=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=rt(R,P,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(zt,String(i));for(let f of S)e.style.setProperty(f.prop,_t(f.from,f.to,i));$e?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&A?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Q(){if(!E||D)return;let i=performance.now(),f=Se(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(_e<0?f:_e))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}_e=f,ve=i;let N=g===x?0:(f-x)/(g-x);pe(N);let z=L(Z(f,x,g,ge));u&&(fe=Math.max(fe,z),z=fe),K=z,j(z),z>=1&&!Ee?(Ee=true,W?.()):z<1&&!u&&(Ee=false),C=requestAnimationFrame(Q);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(Z(Se(),x,g,c));u&&i>0&&(fe=i),K=i,j(i);}let Oe=new IntersectionObserver(i=>{i.forEach(f=>{E=f.isIntersecting,E&&!D?C=requestAnimationFrame(Q):cancelAnimationFrame(C);});},{root:P??null}),_;function O(){clearTimeout(_),_=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Oe.observe(e),Le(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(C),Oe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(_),ie(),Ce(e);},replay(){fe=-1,Ee=false,K=0,D=false,j(0);},pause(){D=true,cancelAnimationFrame(C);},resume(){D&&(D=false,E&&(C=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,D=true,cancelAnimationFrame(C),j(f);},getProgress(){return K}}}var ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,n){if(typeof window>"u")return ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ft;let t=r,{from:a=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,M=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],$e=de(m.start??"top 80%"),W=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(s),V?.(),ft;let X=0,G=0,A=0,$=false,L=false,w=-1,k=0,R=false,P=()=>window.scrollY,S=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},P(),S(),$e,W);X=x.tStart,G=x.tEnd;}function F(d){t.textContent=M(a+(s-a)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||L)return;let d=ne(Z(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,F(d),d>=1&&!R?(R=true,V?.()):d<1&&!p&&(R=false),A=requestAnimationFrame(se);}oe();{let d=ne(Z(P(),X,G,1));p&&d>0&&(w=d),k=d,F(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{$=x.isIntersecting,$&&!L?A=requestAnimationFrame(se):cancelAnimationFrame(A);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(A),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),Ce(t);},replay(){w=-1,R=false,k=0,L=false,F(0);},pause(){L=true,cancelAnimationFrame(A);},resume(){L&&(L=false,$&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,L=true,cancelAnimationFrame(A),F(x);},getProgress(){return k}}}var qt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return qt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),qt;let t=r,{trigger:a={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,$e=de(a.start??"top top"),W=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,A=0,$=0,L=false,w=false,k=-1,R=0,P=false,S=false,oe=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let E=t.getBoundingClientRect(),D=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,K=xe({top:D,height:fe},oe(),F(),$e,W);G=K.tStart,A=K.tEnd;}let ie=NaN;function ee(E){if(!S)return;let D=X??t.duration??0,fe=J+(D-J)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!L||w||!S||M)return;let E=ne(Z(oe(),G,A,1));c&&(k=Math.max(k,E),E=k),R=E,ee(E),E>=1&&!P?(P=true,T?.()):E<1&&!c&&(P=false),$=requestAnimationFrame(ae);}function d(){if(S=true,X===void 0&&(X=t.duration),M){ee(1),p?.();return}se(),p?.(),L&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(D=>{L=D.isIntersecting,L&&!w&&S?$=requestAnimationFrame(ae):cancelAnimationFrame($);});}),g;function C(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",C),window.addEventListener("orientationchange",C),x.observe(t),Le(t,{type:"video",getProgress:()=>R,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(g),Ce(t);},replay(){k=-1,P=false,R=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,L&&S&&($=requestAnimationFrame(ae)));},seek(E){let D=Math.min(1,Math.max(0,E));R=D,k=D,w=true,cancelAnimationFrame($),ie=NaN,ee(D);},getProgress(){return R}}}function Gt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function dr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Bt(e){let n=Gt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],a=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of a){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function gr(e,n,r,t){if(r<=1||t===0)return e;let a=(r-1)*t,s=n*t,c=s+(1-a);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function yr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Wt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Wt;let t=r,{split:a="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),$e=de(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;a==="chars"?J=dr(t):a==="lines"?J=Bt(t):J=Gt(t);let X=J.length;function G(g,C){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*C));let E=yr(C,u);E&&(g.style.transform=E);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((C,E)=>{let D=M(gr(g,E,X,s));G(C,D);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,L=0,w=0,k=false,R=false,P=-1,S=0,oe=false,F=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),C=xe({top:g.top,height:g.height},F(),se(),ne,$e);$=C.tStart,L=C.tEnd;}function ee(){if(!k||R)return;let g=Z(F(),$,L,1);p&&(P=Math.max(P,g),g=P),S=g,A(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach(C=>{k=C.isIntersecting,k&&!R?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(a==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),J=Bt(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=W,t.removeAttribute("aria-label"),Ce(t);},replay(){P=-1,oe=false,S=0,R=false,A(0);},pause(){R=true,cancelAnimationFrame(w);},resume(){R&&(R=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let C=Math.min(1,Math.max(0,g));S=C,P=C,R=true,cancelAnimationFrame(w),A(C);},getProgress(){return S}}}var Xe=e=>typeof e=="function"?e():vue.unref(e);function Fe(e,n,r){let t=null,a=n(),s=()=>{t?.destroy(),t=e.value?r(e.value,Ht(a,()=>a)):null;};vue.onMounted(s),vue.watch(()=>Nt(a=n()),s),vue.onUnmounted(()=>{t?.destroy(),t=null;});}function Sn(e={}){let n=vue.ref(null);return Fe(n,()=>Xe(e),ut),n}var En=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>{let t={};return e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete),t},ut),()=>vue.h("div",{ref:r},n.default?.())}});function Tn(e){let n=vue.ref(null);return Fe(n,()=>Xe(e),mt),n}var xn=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options,mt),()=>vue.h("div",{ref:r},n.default?.())}});function Mn(e){let n=vue.ref(null);return Fe(n,()=>Xe(e),pt),n}var An=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let n=vue.ref(null);return Fe(n,()=>{let r={to:e.to};return e.from!=null&&(r.from=e.from),e.format!=null&&(r.format=e.format),e.easing!=null&&(r.easing=e.easing),e.trigger!=null&&(r.trigger=e.trigger),e.once!=null&&(r.once=e.once),e.decimals!=null&&(r.decimals=e.decimals),e.onComplete!=null&&(r.onComplete=e.onComplete),r},pt),()=>vue.h("span",{ref:n})}});function Ln(e={}){let n=vue.ref(null);return Fe(n,()=>Xe(e),dt),n}var Cn=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let n=vue.ref(null);return Fe(n,()=>e.options??{},dt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function $n(e={}){let n=vue.ref(null);return Fe(n,()=>Xe(e),gt),n}var Pn=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options??{},gt),()=>vue.h(e.tag,{ref:r},n.default?.())}});exports.ScrollAnimate=xn;exports.ScrollCounter=An;exports.ScrollDraw=En;exports.ScrollText=Pn;exports.ScrollVideo=Cn;exports.useScrollAnimate=Tn;exports.useScrollCounter=Mn;exports.useScrollDraw=Sn;exports.useScrollText=$n;exports.useScrollVideo=Ln;
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
|
+
import { Ref } from 'vue';
|
|
2
3
|
import { a as ScrollDrawOptions } from '../types-DHU1zNEw.mjs';
|
|
3
4
|
import { S as ScrollAnimateOptions } from '../engine-Ci08nM91.mjs';
|
|
4
5
|
import { S as ScrollCounterOptions } from '../index-BDGQEK6X.mjs';
|
|
5
6
|
import { ScrollVideoOptions } from '../video/index.mjs';
|
|
6
7
|
import { ScrollTextOptions } from '../text/index.mjs';
|
|
7
8
|
|
|
8
|
-
/**
|
|
9
|
-
|
|
9
|
+
/** Options as a plain object, a ref, or a getter — the getter or ref keeps them live. */
|
|
10
|
+
type MaybeRefOrGetter<T> = T | Ref<T> | (() => T);
|
|
11
|
+
/**
|
|
12
|
+
* Composable — attach the returned ref to any container. Pass a getter or a ref
|
|
13
|
+
* to keep options live: `useScrollDraw(() => ({ speed: speed.value }))` rebuilds
|
|
14
|
+
* the draw when `speed` changes. A plain object is read once.
|
|
15
|
+
*/
|
|
16
|
+
declare function useScrollDraw(options?: MaybeRefOrGetter<ScrollDrawOptions>): Ref<HTMLElement | null, HTMLElement | null>;
|
|
10
17
|
/** Component — wraps children in a <div> and initialises the engine. */
|
|
11
18
|
declare const ScrollDraw: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
12
19
|
selector: {
|
|
@@ -100,7 +107,7 @@ declare const ScrollDraw: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
100
107
|
* </script>
|
|
101
108
|
* <div :ref="el">...</div>
|
|
102
109
|
*/
|
|
103
|
-
declare function useScrollAnimate(options: ScrollAnimateOptions):
|
|
110
|
+
declare function useScrollAnimate(options: MaybeRefOrGetter<ScrollAnimateOptions>): Ref<HTMLElement | null, HTMLElement | null>;
|
|
104
111
|
/**
|
|
105
112
|
* Component — accepts a single `:options` prop and wraps children in a <div>.
|
|
106
113
|
*
|
|
@@ -132,7 +139,7 @@ declare const ScrollAnimate: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
132
139
|
* </script>
|
|
133
140
|
* <span :ref="el" />
|
|
134
141
|
*/
|
|
135
|
-
declare function useScrollCounter(options: ScrollCounterOptions):
|
|
142
|
+
declare function useScrollCounter(options: MaybeRefOrGetter<ScrollCounterOptions>): Ref<HTMLElement | null, HTMLElement | null>;
|
|
136
143
|
/**
|
|
137
144
|
* Component — renders a <span> that counts from `from` to `to` on scroll.
|
|
138
145
|
*
|
|
@@ -206,7 +213,7 @@ declare const ScrollCounter: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
206
213
|
* </script>
|
|
207
214
|
* <video :ref="vid" src="..." muted playsinline preload="auto" />
|
|
208
215
|
*/
|
|
209
|
-
declare function useScrollVideo(options?: ScrollVideoOptions):
|
|
216
|
+
declare function useScrollVideo(options?: MaybeRefOrGetter<ScrollVideoOptions>): Ref<HTMLVideoElement | null, HTMLVideoElement | null>;
|
|
210
217
|
/**
|
|
211
218
|
* Component — renders a <video> scrubbed by scroll position.
|
|
212
219
|
*
|
|
@@ -267,7 +274,7 @@ declare const ScrollVideo: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
267
274
|
* </script>
|
|
268
275
|
* <h2 :ref="el">Animate on scroll.</h2>
|
|
269
276
|
*/
|
|
270
|
-
declare function useScrollText(options?: ScrollTextOptions):
|
|
277
|
+
declare function useScrollText(options?: MaybeRefOrGetter<ScrollTextOptions>): Ref<HTMLElement | null, HTMLElement | null>;
|
|
271
278
|
/**
|
|
272
279
|
* Component — wraps text content in a <p> (or any tag) and animates it on scroll.
|
|
273
280
|
*
|
|
@@ -298,4 +305,4 @@ declare const ScrollText: vue.DefineComponent<vue.ExtractPropTypes<{
|
|
|
298
305
|
tag: string;
|
|
299
306
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
|
|
300
307
|
|
|
301
|
-
export { ScrollAnimate, ScrollAnimateOptions, ScrollCounter, ScrollCounterOptions, ScrollDraw, ScrollDrawOptions, ScrollText, ScrollTextOptions, ScrollVideo, ScrollVideoOptions, useScrollAnimate, useScrollCounter, useScrollDraw, useScrollText, useScrollVideo };
|
|
308
|
+
export { type MaybeRefOrGetter, ScrollAnimate, ScrollAnimateOptions, ScrollCounter, ScrollCounterOptions, ScrollDraw, ScrollDrawOptions, ScrollText, ScrollTextOptions, ScrollVideo, ScrollVideoOptions, useScrollAnimate, useScrollCounter, useScrollDraw, useScrollText, useScrollVideo };
|