svg-scroll-draw 2.10.1 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.mjs +2 -2
- package/dist/cdn/svg-scroll-draw.dev.global.js +1 -0
- package/dist/cdn/svg-scroll-draw.global.js +1 -1
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +2 -2
- package/dist/pin/index.cjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.mjs +2 -2
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +2 -2
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +2 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.mjs +2 -2
- package/dist/web-component/index.cjs +1 -1
- package/dist/web-component/index.mjs +1 -1
- package/package.json +237 -67
package/dist/nuxt/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function Xt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let
|
|
1
|
+
'use strict';var vue=require('vue');function Xt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,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 L=1-Math.pow(t,T);return L+(1-L)*(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),l=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-l)*(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:Xt(),elastic:Qt()};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 $t(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 Pt(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 Be(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 Zt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:Zt((e-n)/(r-n)*t,0,1)}function tt(e,n,r){let t=e.getBoundingClientRect(),l=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:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=$t(e.top,e.height,n,t.element)-Pt(t.viewport,r),c=$t(e.top,e.height,n,l.element)-Pt(l.viewport,r);return {tStart:s,tEnd:c}}function Ot(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 We(e,n,r){let t=Ot(e),l=Ot(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var kt={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 rt=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){rt&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Kt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Jt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Dt=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<Dt;r++){let t=r/(Dt-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 Kt;case "ease-out":return Jt;case "ease-in-out":return er()?tr(re["ease-in-out"]):null;default:return null}}var Rt=Symbol.for("svg-scroll-draw.registry");function Ft(){let e=globalThis;return e[Rt]||(e[Rt]=new Map)}function Ce(e,n){Ft().set(e,n);}function Le(e){Ft().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 or(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?we("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&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 l(){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 It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ht=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!rt)return;let t=(e.match(Ht)??[]).join("").toUpperCase(),l=(n.match(Ht)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,c=(n.match(It)??[]).length;if(t!==l){be(`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&&be(`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?{...kt[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:d="linear",trigger:x={},stagger:N=0,direction:C="forward",once:te=false,debug:$e=false,axis:B="y",scrollContainer:Z,autoReverse:Y=false,delay:W=0,strokeColor:A,strokeWidth:L,fillOpacity:M,waypoints:v,velocityScale:O=false,threshold:k=0,rootMargin:$="0px",repeat:E=0,repeatDelay:re=0,morphTo:D,clip:ne,autoplay:oe=false,duration:K=1e3,native:ce=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:F,onEnterBack:pe,onLeaveBack:Se}=l,ue=ne===true?"left":typeof ne=="string"?ne:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Pe=fe(x.start??"top bottom"),_e=fe(x.end??"bottom top"),we=typeof Z=="string"?document.querySelector(Z):Z??null,ve=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null,me=Array.isArray(M)?M[0]:null,X=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Oe(o){let a=o*100;switch(ue){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 V=ue?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,de=0,I=false,z=false,_=0,Ae=false,ge=-1,J=-1,j=false,ye=0,Ie=0,Ne,ot=null;function St(){ot?.destroy(),ot=null;}let Ve=new Set,Et=NaN,ze=true,Xe=-1,Tt=performance.now(),qe=NaN;function st(){return we?B==="x"?we.scrollLeft:we.scrollTop:B==="x"?window.scrollX:window.scrollY}function xt(){return we?B==="x"?we.clientWidth:we.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function At(){let o=tt(e,we,B);return xe(o,o.scroll,xt(),Pe,_e)}function Mt(){(({tStart:f,tEnd:de}=At())),$e&&rt&&(St(),ot=sr(f,de,B));}function it(o,a=At){Ce(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let w=o.destroy;return o.destroy=()=>{w.call(o),Le(e);},o}function Gt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),ue){let w=a==="reverse"?1-o:o;e.style.clipPath=Oe(w);return}V.forEach((w,ae)=>{w.style.strokeDashoffset=a==="reverse"?`${P[ae]*o}`:`${P[ae]*(1-o)}`,m&&(w.style.opacity=a==="reverse"?`${1-o}`:`${o}`),ve&&se?w.style.stroke=We(ve,se,o):se&&(w.style.stroke=se),ie!==null&&G!==null?w.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(w.style.strokeWidth=`${G}`),me!==null&&X!==null?w.style.fillOpacity=`${me+(X-me)*o}`:X!==null&&(w.style.fillOpacity=`${X}`),D&&w.tagName.toLowerCase()==="path"&&i[ae]&&w.setAttribute("d",ct(i[ae],D,o));});}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),ue){e.style.clipPath=Oe(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=C==="reverse"?"0":`${P[a]}`,m?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),ie!==null&&(o.style.strokeWidth=`${ie}`),me!==null&&(o.style.fillOpacity=`${me}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{or(o);let a=Be(o);P.push(a);let w=o.tagName.toLowerCase()==="path";w?i.push(o.getAttribute("d")??""):i.push(""),D&&(w?ir(i[i.length-1],D,o):be(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=C==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),X!==null&&(o.style.fillOpacity=`${X}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=C==="reverse"?"0":`${a}`,m?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),ie!==null&&(o.style.strokeWidth=`${ie}`),me!==null&&(o.style.fillOpacity=`${me}`));}),ue){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 Ct=typeof d=="string"?nt(d):null;function jt(){return !(ce===false||!nr()||!V.length||!Ct||ue||B!=="y"||we||u!==1||N!==0||te||Y||O!==false||D||v||E||W>0||y||T||g||p||F||pe||Se||A!=null||L!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Ut(){let o=++rr,a=`svg-scroll-draw-${o}`,w=`svg-scroll-draw-host-${o}`,ae=`--svg-scroll-draw-${o}`,He=C==="reverse"?"0":"var(--ssd-len)",ke=C==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${He};`,S=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${C==="reverse"?1:0};`,S+=`opacity:${C==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${a}{from{${Me}}to{${S}}}.${w}{view-timeline-name:${ae};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${ae};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(w);function le(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(le);let b=false,H=-1;function q(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},st(),xt(),Pe,_e);return Ee(Q(st(),U,Te,u))}return {destroy(){e.classList.remove(w),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),R.remove();},replay(){b=false,H=-1,V.forEach(le);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));H=U,b=true,V.forEach((Te,he)=>{Te.classList.remove(a),Te.style.strokeDashoffset=C==="reverse"?`${P[he]*U}`:`${P[he]*(1-U)}`,m&&(Te.style.opacity=C==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=Be(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(jt())return it(Ut());function Yt(){let o=Math.max(1,K),a=0,w=0,ae=false;function He(b){let H=true;if(ue){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);ye=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Oe(C==="reverse"?1-h:h),y?.(h),q<1&&(H=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),he=Ee(Te);q.style.strokeDashoffset=C==="reverse"?`${P[h]*he}`:`${P[h]*(1-he)}`,m&&(q.style.opacity=C==="reverse"?`${1-he}`:`${he}`),ve&&se?q.style.stroke=We(ve,se,he):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*he}`:G!==null&&(q.style.strokeWidth=`${G}`),me!==null&&X!==null?q.style.fillOpacity=`${me+(X-me)*he}`:X!==null&&(q.style.fillOpacity=`${X}`),D&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",ct(i[h],D,he)),h===0&&(ye=he,y?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),Te<1&&(H=false);});if(v){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);for(let U in v){let Te=parseFloat(U);h>=Te&&!Ve.has(Te)&&(Ve.add(Te),v[U]?.());}}return H}function ke(b){if(j)return;let H=b-a;z||(z=true,T?.());let q=He(H);if(q&&!I){I=true,He(o*(1+Math.max(0,V.length-1)*N)),g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,Ne=setTimeout(()=>{a=performance.now(),z=false,I=false,Ve.clear(),Qe(),_=requestAnimationFrame(ke);},re));return}q||(_=requestAnimationFrame(ke));}function Me(){cancelAnimationFrame(_),clearTimeout(Ne),a=performance.now(),w=0,j=false,z=false,I=false,Ie=0,ae=true,ye=0,Ve.clear(),Qe(),_=requestAnimationFrame(ke);}let S=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&I)?Me():!H.isIntersecting&&!te&&!I&&(cancelAnimationFrame(_),clearTimeout(Ne),ae=false);});},{root:we??null,threshold:k,rootMargin:$}),R;function le(){clearTimeout(R),R=setTimeout(()=>{V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});},150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),W>0?setTimeout(()=>S.observe(e),W):S.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(Ne),S.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(R);},replay(){Ie=0,Me();},pause(){j||!ae||(j=true,w=performance.now()-a,cancelAnimationFrame(_));},resume(){j&&(j=false,ae=true,a=performance.now()-w,_=requestAnimationFrame(ke));},seek(b){let H=Math.min(1,Math.max(0,b));ye=H,j=true,w=H*o,a=performance.now()-w,cancelAnimationFrame(_),He(w);},getProgress(){return ye},refresh(){clearTimeout(R),V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});}}}if(oe)return it(Yt());Mt();function Ze(){if(!Ae||j)return;let o=performance.now(),a=st();if(!ze&&O===false&&a===Et){_=requestAnimationFrame(Ze);return}ze=false,Et=a;let w=u;if(O!==false){let S=o-Tt,R=S>0?Math.abs(a-(Xe<0?a:Xe))/S:0;w=u*Math.max(.2,1+R*(typeof O=="number"?O:1)*.04);}Xe=a,Tt=o;let ae=Y?J===-1||a>=J?"forward":"reverse":C;J=a;let He=de-f,ke=true,Me=He===0?0:(a-f)/He;if(isNaN(qe)||(qe<=0&&Me>0?p?.():qe>0&&Me<=0&&Se?.(),qe<1&&Me>=1?F?.():qe>=1&&Me<1&&pe?.()),qe=Me,ue){let S=Ee(Q(a,f,de,w));te&&!Y&&(ge=Math.max(ge,S),S=ge),ye=S,e.style.setProperty("--scroll-draw-progress",String(S));let R=ae==="reverse"?1-S:S;e.style.clipPath=Oe(R),y?.(S),!z&&Q(a,f,de,w)>0&&(z=true,T?.()),S>=1&&!I?(I=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,Ne=setTimeout(()=>{ge=-1,z=false,I=false,e.style.clipPath=Oe(0);},re))):S<1&&!te&&(I=false),_=requestAnimationFrame(Ze);return}if(V.forEach((S,R)=>{let le=R*N*He,b=Ee(Q(a,f+le,de+le,w));te&&!Y&&(ge=Math.max(ge,b),b=ge),ye=b,S.style.strokeDashoffset=ae==="reverse"?`${P[R]*b}`:`${P[R]*(1-b)}`,m&&(S.style.opacity=ae==="reverse"?`${1-b}`:`${b}`),ve&&se?S.style.stroke=We(ve,se,b):se&&(S.style.stroke=se),ie!==null&&G!==null?S.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(S.style.strokeWidth=`${G}`),me!==null&&X!==null?S.style.fillOpacity=`${me+(X-me)*b}`:X!==null&&(S.style.fillOpacity=`${X}`),D&&S.tagName.toLowerCase()==="path"&&i[R]&&S.setAttribute("d",ct(i[R],D,b)),R===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(ke=false);}),v){let S=Ee(Q(a,f,de,w));for(let R in v){let le=parseFloat(R);S>=le&&!Ve.has(le)&&(Ve.add(le),v[R]?.());}}!z&&Q(a,f,de,w)>0&&(z=true,T?.()),ke&&!I?(I=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,Ne=setTimeout(()=>{ge=-1,z=false,I=false,Ve.clear(),Qe(),ze=true;},re))):!ke&&!te&&(I=false),_=requestAnimationFrame(Ze);}let at=false;function Ke(){at||(at=true,_=requestAnimationFrame(function(){Ze();}));}function Je(){at=false,cancelAnimationFrame(_);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!j?(ze=true,Ke()):Je();});},{root:we??null,threshold:k,rootMargin:$});function Lt(){V.forEach((o,a)=>{P[a]=Be(o),o.style.strokeDasharray=`${P[a]}`;}),Mt(),ze=true;}let et;function Ge(){clearTimeout(et),et=setTimeout(Lt,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)),W>0?setTimeout(()=>lt.observe(e),W):lt.observe(e),it({destroy(){cancelAnimationFrame(_),clearTimeout(Ne),Je(),lt.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(et),St();},replay(){ge=-1,J=-1,Xe=-1,z=false,I=false,Ie=0,j=false,ye=0,Ve.clear(),clearTimeout(Ne),Qe(),ze=true,Ae&&Ke();},pause(){j=true,Je();},resume(){j&&(j=false,ze=true,Ae&&Ke());},seek(o){let a=Math.min(1,Math.max(0,o));ye=a,ge=a,j=true,Je(),Gt(a,C),ze=true;},getProgress(){return ye},refresh(){clearTimeout(et),Lt(),Ae&&!j&&Ke();}},()=>({tStart:f,tEnd:de}))}function ar(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Nt(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 lr(e,n,r){let t=Nt(e),l=Nt(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,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Vt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(ar(t))return We(t,l,r);if(t.includes("("))return lr(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 cr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ur=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),mr=0,zt="--scroll-draw-progress";function fr(){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:d,native:x=true,velocityScale:N=false,respectReducedMotion:C=true,triggerElement:te,onProgress:$e,onComplete:B,onEnter:Z,onLeave:Y,onEnterBack:W,onLeaveBack:A}=n,L=C&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:ee[s]??ee["ease-out"],v=fe(l.start??"top bottom"),O=fe(l.end??"bottom top"),k=te??e,$=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([i,f])=>({prop:cr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function re(){let i=window.getComputedStyle(e);for(let f of 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 ne=new Map;for(let i of [...E.map(f=>f.prop),zt])ne.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of ne)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(L)return D(),B?.(),{...r,destroy:oe,getProgress:()=>1};re();let K=typeof s=="string"?nt(s):null;function ce(){if(!x||!fr()||!K||m!=="y"||$||k!==e||u||c!==1||$e||B||Z||Y||W||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!ur.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++mr}`,f=E.map(J=>`${J.prop}:${J.from}`).join(";"),de=E.map(J=>`${J.prop}:${J.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${i}{from{${f}}to{${de}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${K};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let J=e.getBoundingClientRect();return xe({top:J.top,height:J.height},z(),_(),v,O)};Ce(e,{type:"animate",getProgress:()=>ge.getProgress(),getTrigger:Ae});let ge={destroy(){e.classList.remove(i),I.remove(),e.style.animationPlayState="",oe(),Le(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let j=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let ye of E)e.style.setProperty(ye.prop,Vt(ye.from,ye.to,j));},getProgress(){let{tStart:J,tEnd:j}=Ae();return M(Q(z(),J,j,c))}};return ge}if(ce())return y();let T=0,g=0,p=0,F=false,pe=false,Se=-1,ue=0,Ee=false,Pe=NaN,_e=-1,we=0,ve=()=>$?m==="x"?$.scrollLeft:$.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>$?m==="x"?$.clientWidth:$.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=tt(k,$,m),f=xe(i,i.scroll,se(),v,O);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(zt,String(i));for(let f of E)e.style.setProperty(f.prop,Vt(f.from,f.to,i));$e?.(i);}function me(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?Z?.():Pe>0&&i<=0&&A?.(),Pe<1&&i>=1?Y?.():Pe>=1&&i<1&&W?.(),Pe=i;}function X(){if(!F||pe)return;let i=performance.now(),f=ve(),de=c;if(N!==false){let _=i-we,Ae=_>0?Math.abs(f-(_e<0?f:_e))/_:0;de=c*Math.max(.2,1+Ae*(typeof N=="number"?N:1)*.04);}_e=f,we=i;let I=g===T?0:(f-T)/(g-T);me(I);let z=M(Q(f,T,g,de));u&&(Se=Math.max(Se,z),z=Se),ue=z,G(z),z>=1&&!Ee?(Ee=true,B?.()):z<1&&!u&&(Ee=false),p=requestAnimationFrame(X);}ie(),g===T&&be("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=M(Q(ve(),T,g,c));u&&i>0&&(Se=i),ue=i,G(i);}let Oe=new IntersectionObserver(i=>{i.forEach(f=>{F=f.isIntersecting,F&&!pe?p=requestAnimationFrame(X):cancelAnimationFrame(p);});},{root:$??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),Oe.observe(e),Ce(e,{type:"animate",getProgress:()=>ue,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),Oe.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),Le(e);},replay(){Se=-1,Ee=false,ue=0,pe=false,G(0);},pause(){pe=true,cancelAnimationFrame(p);},resume(){pe&&(pe=false,F&&(p=requestAnimationFrame(X)));},seek(i){let f=Math.min(1,Math.max(0,i));ue=f,Se=f,pe=true,cancelAnimationFrame(p),G(f);},getProgress(){return ue}}}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 be("scrollCounter: element not found:",e),ft;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=n,C=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],$e=fe(m.start??"top 80%"),B=fe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=C(s),N?.(),ft;let Y=0,W=0,A=0,L=false,M=false,v=-1,O=0,k=false,$=()=>window.scrollY,E=()=>window.innerHeight;function re(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},$(),E(),$e,B);Y=T.tStart,W=T.tEnd;}function D(y){t.textContent=C(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function ne(){if(!L||M)return;let y=te(Q($(),Y,W,1));d&&(v=Math.max(v,y),y=v),O=y,D(y),y>=1&&!k?(k=true,N?.()):y<1&&!d&&(k=false),A=requestAnimationFrame(ne);}re();{let y=te(Q($(),Y,W,1));d&&y>0&&(v=y),O=y,D(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{L=T.isIntersecting,L&&!M?A=requestAnimationFrame(ne):cancelAnimationFrame(A);});}),K;function ce(){clearTimeout(K),K=setTimeout(re,150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),oe.observe(t),Ce(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:Y,tEnd:W})}),{destroy(){cancelAnimationFrame(A),oe.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(K),Le(t);},replay(){v=-1,k=false,O=0,M=false,D(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,L&&(A=requestAnimationFrame(ne)));},seek(y){let T=Math.min(1,Math.max(0,y));O=T,v=T,M=true,cancelAnimationFrame(A),D(T);},getProgress(){return O}}}var _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return be("scrollVideo: <video> element not found:",e),_t;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=n,C=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,$e=fe(l.start??"top top"),B=fe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=n.from??0,Y=n.to,W=0,A=0,L=0,M=false,v=false,O=-1,k=0,$=false,E=false,re=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function ne(){let p=t.getBoundingClientRect(),F=u==="x"?p.left:p.top,pe=u==="x"?p.width:p.height,Se=xe({top:F,height:pe},re(),D(),$e,B);W=Se.tStart,A=Se.tEnd;}function oe(p){if(!E)return;let F=Y??t.duration??0;t.currentTime=Z+(F-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function K(){if(!M||v||!E)return;let p=te(Q(re(),W,A,1));c&&(O=Math.max(O,p),p=O),k=p,oe(p),p>=1&&!$?($=true,x?.()):p<1&&!c&&($=false),L=requestAnimationFrame(K);}function ce(){if(E=true,Y===void 0&&(Y=t.duration),C){oe(1),d?.();return}ne(),d?.(),M&&!v&&(L=requestAnimationFrame(K));}t.readyState>=1?ce():t.addEventListener("loadedmetadata",ce,{once:true}),E||ne();let y=new IntersectionObserver(p=>{p.forEach(F=>{M=F.isIntersecting,M&&!v&&E?L=requestAnimationFrame(K):cancelAnimationFrame(L);});}),T;function g(){clearTimeout(T),T=setTimeout(ne,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ce(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:W,tEnd:A})}),{destroy(){cancelAnimationFrame(L),y.disconnect(),t.removeEventListener("loadedmetadata",ce),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),Le(t);},replay(){O=-1,$=false,k=0,v=false,oe(0);},pause(){v=true,cancelAnimationFrame(L);},resume(){v&&(v=false,M&&E&&(L=requestAnimationFrame(K)));},seek(p){let F=Math.min(1,Math.max(0,p));k=F,O=F,v=true,cancelAnimationFrame(L),oe(F);},getProgress(){return k}}}function Wt(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 pr(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 qt(e){let n=Wt(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,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function dr(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 gr(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 Bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return be("scrollText: element not found:",e),Bt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=n,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=typeof c=="function"?c:ee[c]??ee["ease-out"],te=fe(m.start??"top 85%"),$e=fe(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=pr(t):l==="lines"?Z=qt(t):Z=Wt(t);let Y=Z.length;function W(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let F=gr(p,u);F&&(g.style.transform=F);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,F)=>{let pe=C(dr(g,F,Y,s));W(p,pe);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let L=0,M=0,v=0,O=false,k=false,$=-1,E=0,re=false,D=()=>window.scrollY,ne=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},D(),ne(),te,$e);L=p.tStart,M=p.tEnd;}function K(){if(!O||k)return;let g=Q(D(),L,M,1);d&&($=Math.max($,g),g=$),E=g,A(g),g>=1&&!re?(re=true,x?.()):g<1&&!d&&(re=false),v=requestAnimationFrame(K);}oe();let ce=new IntersectionObserver(g=>{g.forEach(p=>{O=p.isIntersecting,O&&!k?v=requestAnimationFrame(K):cancelAnimationFrame(v);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),Z=qt(t),A(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ce.observe(t),Ce(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:L,tEnd:M})}),{destroy(){cancelAnimationFrame(v),ce.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=B,t.removeAttribute("aria-label"),Le(t);},replay(){$=-1,re=false,E=0,k=false,A(0);},pause(){k=true,cancelAnimationFrame(v);},resume(){k&&(k=false,O&&(v=requestAnimationFrame(K)));},seek(g){let p=Math.min(1,Math.max(0,g));E=p,$=p,k=true,cancelAnimationFrame(v),A(p);},getProgress(){return E}}}function yr(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 yt=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 hr(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 ht=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 br(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 bt=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 wr(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 wt=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 vr(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 vt=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?.())}});function on(){return {install(e){e.component("ScrollDraw",yt),e.component("ScrollAnimate",ht),e.component("ScrollCounter",bt),e.component("ScrollVideo",wt),e.component("ScrollText",vt);}}}exports.ScrollAnimate=ht;exports.ScrollCounter=bt;exports.ScrollDraw=yt;exports.ScrollText=vt;exports.ScrollVideo=wt;exports.createScrollDrawPlugin=on;exports.useScrollAnimate=hr;exports.useScrollCounter=br;exports.useScrollDraw=yr;exports.useScrollText=vr;exports.useScrollVideo=wr;
|
|
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 It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Nt=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!rt)return;let t=(e.match(Nt)??[]).join("").toUpperCase(),l=(n.match(Nt)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,c=(n.match(It)??[]).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?{...kt[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:L="forward",once:ne=false,debug:$e=false,axis:W="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:$,fillOpacity:M,waypoints:w,velocityScale:k=false,threshold:D=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:I,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(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(M)?M[0]:null,Z=Array.isArray(M)?M[1]:typeof M=="number"?M: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,Ie=0,He,ot=null;function St(){ot?.destroy(),ot=null;}let Ve=new Set,Et=NaN,ze=true,Xe=-1,Tt=performance.now(),qe=NaN;function st(){return ve?W==="x"?ve.scrollLeft:ve.scrollTop:W==="x"?window.scrollX:window.scrollY}function xt(){return ve?W==="x"?ve.clientWidth:ve.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function At(){let o=tt(e,ve,W);return xe(o,o.scroll,xt(),Pe,_e)}function Mt(){(({tStart:f,tEnd:ge}=At())),$e&&rt&&(St(),ot=sr(f,ge,W));}function it(o,a=At){Ce(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Le(e);},o}function Gt(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 Qe(){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=L==="reverse"?"0":`${O[a]}`,m?o.style.opacity=L==="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=>{or(o);let a=Be(o);O.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),R&&(b?ir(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=L==="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=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="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 Ct=typeof p=="string"?nt(p):null;function jt(){return !(ae===false||!nr()||!z.length||!Ct||Q||W!=="y"||ve||u!==1||V!==0||ne||X||k!==false||R||w||S||G>0||d||x||g||C||E||I||fe||A!=null||$!=null||M!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Ut(){let o=++rr,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Ne=L==="reverse"?"0":"var(--ssd-len)",ke=L==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${Ne};`,v=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${L==="reverse"?1:0};`,v+=`opacity:${L==="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:${Ct};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(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(),xt(),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="";}),F.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=L==="reverse"?`${O[be]*Y}`:`${O[be]*(1-Y)}`,m&&(Te.style.opacity=L==="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(jt())return it(Ut());function Yt(){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(L==="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=L==="reverse"?`${O[y]*be}`:`${O[y]*(1-be)}`,m&&(B.style.opacity=L==="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?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{a=performance.now(),_=false,N=false,Ve.clear(),Qe(),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,Ie=0,ue=true,he=0,Ve.clear(),Qe(),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:D,rootMargin:P}),F;function me(){clearTimeout(F),F=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(F);},replay(){Ie=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(F),z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return it(Yt());Mt();function Ze(){if(!Ae||U)return;let o=performance.now(),a=st();if(!ze&&k===false&&a===Et){q=requestAnimationFrame(Ze);return}ze=false,Et=a;let b=u;if(k!==false){let v=o-Tt,F=v>0?Math.abs(a-(Xe<0?a:Xe))/v:0;b=u*Math.max(.2,1+F*(typeof k=="number"?k:1)*.04);}Xe=a,Tt=o;let ue=X?te===-1||a>=te?"forward":"reverse":L;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&&I?.()),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 F=ue==="reverse"?1-v:v;e.style.clipPath=Oe(F),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{ye=-1,_=false,N=false,e.style.clipPath=Oe(0);},oe))):v<1&&!ne&&(N=false),q=requestAnimationFrame(Ze);return}if(z.forEach((v,F)=>{let me=F*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[F]*h}`:`${O[F]*(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[F]&&v.setAttribute("d",ct(i[F],R,h)),F===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 F in w){let me=parseFloat(F);v>=me&&!Ve.has(me)&&(Ve.add(me),w[F]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{ye=-1,_=false,N=false,Ve.clear(),Qe(),ze=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Ze);}let at=false;function Ke(){at||(at=true,q=requestAnimationFrame(function(){Ze();}));}function Je(){at=false,cancelAnimationFrame(q);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!U?(ze=true,Ke()):Je();});},{root:ve??null,threshold:D,rootMargin:P});function Lt(){z.forEach((o,a)=>{O[a]=Be(o),o.style.strokeDasharray=`${O[a]}`;}),Mt(),ze=true;}let et;function Ge(){clearTimeout(et),et=setTimeout(Lt,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),Je(),lt.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(et),St();},replay(){ye=-1,te=-1,Xe=-1,_=false,N=false,Ie=0,U=false,he=0,Ve.clear(),clearTimeout(He),Qe(),ze=true,Ae&&Ke();},pause(){U=true,Je();},resume(){U&&(U=false,ze=true,Ae&&Ke());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,Je(),Gt(a,L),ze=true;},getProgress(){return he},refresh(){clearTimeout(et),Lt(),Ae&&!U&&Ke();}},()=>({tStart:f,tEnd:ge}))}function ar(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ht(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 lr(e,n,r){let t=Ht(e),l=Ht(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 Vt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(ar(t))return We(t,l,r);if(t.includes("("))return lr(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 cr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ur=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),mr=0,zt="--scroll-draw-progress";function fr(){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:L=true,triggerElement:ne,onProgress:$e,onComplete:W,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),D=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([i,f])=>({prop:cr(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),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 R(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?nt(s):null;function ae(){if(!T||!fr()||!ee||m!=="y"||P||D!==e||u||c!==1||$e||W||J||X||G||A||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!ur.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++mr}`,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)};Ce(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Ae});let ye={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",ie(),Le(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,Vt(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return M(K(_(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,C=0,E=false,I=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=tt(D,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,Vt(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 Z(){if(!E||I)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 _=M(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=M(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&&!I?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),Ce(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(),Le(e);},replay(){fe=-1,Ee=false,Q=0,I=false,j(0);},pause(){I=true,cancelAnimationFrame(C);},resume(){I&&(I=false,E&&(C=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,I=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,L=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=L(s),V?.(),ft;let X=0,G=0,A=0,$=false,M=false,w=-1,k=0,D=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=L(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||M)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,R(d),d>=1&&!D?(D=true,V?.()):d<1&&!p&&(D=false),A=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,$&&!M?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),Ce(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),Le(t);},replay(){w=-1,D=false,k=0,M=false,R(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,$&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,M=true,cancelAnimationFrame(A),R(x);},getProgress(){return k}}}var _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),_t;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,L=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,A=0,$=0,M=false,w=false,k=-1,D=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(),I=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,Q=xe({top:I,height:fe},oe(),R(),$e,W);G=Q.tStart,A=Q.tEnd;}let ie=NaN;function ee(E){if(!S)return;let I=X??t.duration??0,fe=J+(I-J)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!M||w||!S)return;let E=ne(K(oe(),G,A,1));c&&(k=Math.max(k,E),E=k),D=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),L){ee(1),p?.();return}se(),p?.(),M&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(I=>{M=I.isIntersecting,M&&!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),Ce(t,{type:"video",getProgress:()=>D,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(g),Le(t);},replay(){k=-1,P=false,D=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,M&&S&&($=requestAnimationFrame(ae)));},seek(E){let I=Math.min(1,Math.max(0,E));D=I,k=I,w=true,cancelAnimationFrame($),ie=NaN,ee(I);},getProgress(){return D}}}function Wt(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 pr(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 qt(e){let n=Wt(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 dr(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 gr(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 Bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Bt;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,L=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=pr(t):l==="lines"?J=qt(t):J=Wt(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=gr(C,u);E&&(g.style.transform=E);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((C,E)=>{let I=L(dr(g,E,X,s));G(C,I);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,M=0,w=0,k=false,D=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,M=C.tEnd;}function ee(){if(!k||D)return;let g=K(R(),$,M,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&&!D?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=qt(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Ce(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=W,t.removeAttribute("aria-label"),Le(t);},replay(){P=-1,oe=false,S=0,D=false,A(0);},pause(){D=true,cancelAnimationFrame(w);},resume(){D&&(D=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let C=Math.min(1,Math.max(0,g));S=C,P=C,D=true,cancelAnimationFrame(w),A(C);},getProgress(){return S}}}function yr(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 yt=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 hr(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 ht=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 br(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 bt=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 wr(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 wt=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 vr(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 vt=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?.())}});function on(){return {install(e){e.component("ScrollDraw",yt),e.component("ScrollAnimate",ht),e.component("ScrollCounter",bt),e.component("ScrollVideo",wt),e.component("ScrollText",vt);}}}exports.ScrollAnimate=ht;exports.ScrollCounter=bt;exports.ScrollDraw=yt;exports.ScrollText=vt;exports.ScrollVideo=wt;exports.createScrollDrawPlugin=on;exports.useScrollAnimate=hr;exports.useScrollCounter=br;exports.useScrollDraw=yr;exports.useScrollText=vr;exports.useScrollVideo=wr;
|
package/dist/nuxt/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {defineComponent,ref,onMounted,onUnmounted,h}from'vue';function Xt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let
|
|
1
|
+
import {defineComponent,ref,onMounted,onUnmounted,h}from'vue';function Xt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,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 L=1-Math.pow(t,T);return L+(1-L)*(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),l=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-l)*(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:Xt(),elastic:Qt()};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 $t(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 Pt(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 Be(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 Zt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:Zt((e-n)/(r-n)*t,0,1)}function tt(e,n,r){let t=e.getBoundingClientRect(),l=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:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=$t(e.top,e.height,n,t.element)-Pt(t.viewport,r),c=$t(e.top,e.height,n,l.element)-Pt(l.viewport,r);return {tStart:s,tEnd:c}}function Ot(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 We(e,n,r){let t=Ot(e),l=Ot(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var kt={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 rt=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){rt&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Kt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Jt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Dt=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<Dt;r++){let t=r/(Dt-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 Kt;case "ease-out":return Jt;case "ease-in-out":return er()?tr(re["ease-in-out"]):null;default:return null}}var Rt=Symbol.for("svg-scroll-draw.registry");function Ft(){let e=globalThis;return e[Rt]||(e[Rt]=new Map)}function Ce(e,n){Ft().set(e,n);}function Le(e){Ft().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 or(e){let n=e.getAttribute("stroke"),r=e.getAttribute("fill");!n||n==="none"?we("Element has no stroke \u2014 path will not be visible.",e):r&&r!=="none"&&r!=="transparent"&&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 l(){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 It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ht=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!rt)return;let t=(e.match(Ht)??[]).join("").toUpperCase(),l=(n.match(Ht)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,c=(n.match(It)??[]).length;if(t!==l){be(`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&&be(`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?{...kt[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:d="linear",trigger:x={},stagger:N=0,direction:C="forward",once:te=false,debug:$e=false,axis:B="y",scrollContainer:Z,autoReverse:Y=false,delay:W=0,strokeColor:A,strokeWidth:L,fillOpacity:M,waypoints:v,velocityScale:O=false,threshold:k=0,rootMargin:$="0px",repeat:E=0,repeatDelay:re=0,morphTo:D,clip:ne,autoplay:oe=false,duration:K=1e3,native:ce=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:F,onEnterBack:pe,onLeaveBack:Se}=l,ue=ne===true?"left":typeof ne=="string"?ne:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Pe=fe(x.start??"top bottom"),_e=fe(x.end??"bottom top"),we=typeof Z=="string"?document.querySelector(Z):Z??null,ve=Array.isArray(A)?A[0]:null,se=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ie=Array.isArray(L)?L[0]:null,G=Array.isArray(L)?L[1]:typeof L=="number"?L:null,me=Array.isArray(M)?M[0]:null,X=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Oe(o){let a=o*100;switch(ue){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 V=ue?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,de=0,I=false,z=false,_=0,Ae=false,ge=-1,J=-1,j=false,ye=0,Ie=0,Ne,ot=null;function St(){ot?.destroy(),ot=null;}let Ve=new Set,Et=NaN,ze=true,Xe=-1,Tt=performance.now(),qe=NaN;function st(){return we?B==="x"?we.scrollLeft:we.scrollTop:B==="x"?window.scrollX:window.scrollY}function xt(){return we?B==="x"?we.clientWidth:we.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function At(){let o=tt(e,we,B);return xe(o,o.scroll,xt(),Pe,_e)}function Mt(){(({tStart:f,tEnd:de}=At())),$e&&rt&&(St(),ot=sr(f,de,B));}function it(o,a=At){Ce(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let w=o.destroy;return o.destroy=()=>{w.call(o),Le(e);},o}function Gt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),ue){let w=a==="reverse"?1-o:o;e.style.clipPath=Oe(w);return}V.forEach((w,ae)=>{w.style.strokeDashoffset=a==="reverse"?`${P[ae]*o}`:`${P[ae]*(1-o)}`,m&&(w.style.opacity=a==="reverse"?`${1-o}`:`${o}`),ve&&se?w.style.stroke=We(ve,se,o):se&&(w.style.stroke=se),ie!==null&&G!==null?w.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(w.style.strokeWidth=`${G}`),me!==null&&X!==null?w.style.fillOpacity=`${me+(X-me)*o}`:X!==null&&(w.style.fillOpacity=`${X}`),D&&w.tagName.toLowerCase()==="path"&&i[ae]&&w.setAttribute("d",ct(i[ae],D,o));});}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),ue){e.style.clipPath=Oe(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=C==="reverse"?"0":`${P[a]}`,m?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),ie!==null&&(o.style.strokeWidth=`${ie}`),me!==null&&(o.style.fillOpacity=`${me}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{or(o);let a=Be(o);P.push(a);let w=o.tagName.toLowerCase()==="path";w?i.push(o.getAttribute("d")??""):i.push(""),D&&(w?ir(i[i.length-1],D,o):be(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=C==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),X!==null&&(o.style.fillOpacity=`${X}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=C==="reverse"?"0":`${a}`,m?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),ie!==null&&(o.style.strokeWidth=`${ie}`),me!==null&&(o.style.fillOpacity=`${me}`));}),ue){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 Ct=typeof d=="string"?nt(d):null;function jt(){return !(ce===false||!nr()||!V.length||!Ct||ue||B!=="y"||we||u!==1||N!==0||te||Y||O!==false||D||v||E||W>0||y||T||g||p||F||pe||Se||A!=null||L!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Ut(){let o=++rr,a=`svg-scroll-draw-${o}`,w=`svg-scroll-draw-host-${o}`,ae=`--svg-scroll-draw-${o}`,He=C==="reverse"?"0":"var(--ssd-len)",ke=C==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${He};`,S=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${C==="reverse"?1:0};`,S+=`opacity:${C==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${a}{from{${Me}}to{${S}}}.${w}{view-timeline-name:${ae};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${ae};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(w);function le(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(le);let b=false,H=-1;function q(){if(H>=0)return H;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},st(),xt(),Pe,_e);return Ee(Q(st(),U,Te,u))}return {destroy(){e.classList.remove(w),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),R.remove();},replay(){b=false,H=-1,V.forEach(le);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));H=U,b=true,V.forEach((Te,he)=>{Te.classList.remove(a),Te.style.strokeDashoffset=C==="reverse"?`${P[he]*U}`:`${P[he]*(1-U)}`,m&&(Te.style.opacity=C==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=Be(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(jt())return it(Ut());function Yt(){let o=Math.max(1,K),a=0,w=0,ae=false;function He(b){let H=true;if(ue){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);ye=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Oe(C==="reverse"?1-h:h),y?.(h),q<1&&(H=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),he=Ee(Te);q.style.strokeDashoffset=C==="reverse"?`${P[h]*he}`:`${P[h]*(1-he)}`,m&&(q.style.opacity=C==="reverse"?`${1-he}`:`${he}`),ve&&se?q.style.stroke=We(ve,se,he):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*he}`:G!==null&&(q.style.strokeWidth=`${G}`),me!==null&&X!==null?q.style.fillOpacity=`${me+(X-me)*he}`:X!==null&&(q.style.fillOpacity=`${X}`),D&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",ct(i[h],D,he)),h===0&&(ye=he,y?.(he),e.style.setProperty("--scroll-draw-progress",String(he))),Te<1&&(H=false);});if(v){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);for(let U in v){let Te=parseFloat(U);h>=Te&&!Ve.has(Te)&&(Ve.add(Te),v[U]?.());}}return H}function ke(b){if(j)return;let H=b-a;z||(z=true,T?.());let q=He(H);if(q&&!I){I=true,He(o*(1+Math.max(0,V.length-1)*N)),g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,Ne=setTimeout(()=>{a=performance.now(),z=false,I=false,Ve.clear(),Qe(),_=requestAnimationFrame(ke);},re));return}q||(_=requestAnimationFrame(ke));}function Me(){cancelAnimationFrame(_),clearTimeout(Ne),a=performance.now(),w=0,j=false,z=false,I=false,Ie=0,ae=true,ye=0,Ve.clear(),Qe(),_=requestAnimationFrame(ke);}let S=new IntersectionObserver(b=>{b.forEach(H=>{H.isIntersecting&&!(te&&I)?Me():!H.isIntersecting&&!te&&!I&&(cancelAnimationFrame(_),clearTimeout(Ne),ae=false);});},{root:we??null,threshold:k,rootMargin:$}),R;function le(){clearTimeout(R),R=setTimeout(()=>{V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});},150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),W>0?setTimeout(()=>S.observe(e),W):S.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(Ne),S.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(R);},replay(){Ie=0,Me();},pause(){j||!ae||(j=true,w=performance.now()-a,cancelAnimationFrame(_));},resume(){j&&(j=false,ae=true,a=performance.now()-w,_=requestAnimationFrame(ke));},seek(b){let H=Math.min(1,Math.max(0,b));ye=H,j=true,w=H*o,a=performance.now()-w,cancelAnimationFrame(_),He(w);},getProgress(){return ye},refresh(){clearTimeout(R),V.forEach((b,H)=>{P[H]=Be(b),b.style.strokeDasharray=`${P[H]}`;});}}}if(oe)return it(Yt());Mt();function Ze(){if(!Ae||j)return;let o=performance.now(),a=st();if(!ze&&O===false&&a===Et){_=requestAnimationFrame(Ze);return}ze=false,Et=a;let w=u;if(O!==false){let S=o-Tt,R=S>0?Math.abs(a-(Xe<0?a:Xe))/S:0;w=u*Math.max(.2,1+R*(typeof O=="number"?O:1)*.04);}Xe=a,Tt=o;let ae=Y?J===-1||a>=J?"forward":"reverse":C;J=a;let He=de-f,ke=true,Me=He===0?0:(a-f)/He;if(isNaN(qe)||(qe<=0&&Me>0?p?.():qe>0&&Me<=0&&Se?.(),qe<1&&Me>=1?F?.():qe>=1&&Me<1&&pe?.()),qe=Me,ue){let S=Ee(Q(a,f,de,w));te&&!Y&&(ge=Math.max(ge,S),S=ge),ye=S,e.style.setProperty("--scroll-draw-progress",String(S));let R=ae==="reverse"?1-S:S;e.style.clipPath=Oe(R),y?.(S),!z&&Q(a,f,de,w)>0&&(z=true,T?.()),S>=1&&!I?(I=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,Ne=setTimeout(()=>{ge=-1,z=false,I=false,e.style.clipPath=Oe(0);},re))):S<1&&!te&&(I=false),_=requestAnimationFrame(Ze);return}if(V.forEach((S,R)=>{let le=R*N*He,b=Ee(Q(a,f+le,de+le,w));te&&!Y&&(ge=Math.max(ge,b),b=ge),ye=b,S.style.strokeDashoffset=ae==="reverse"?`${P[R]*b}`:`${P[R]*(1-b)}`,m&&(S.style.opacity=ae==="reverse"?`${1-b}`:`${b}`),ve&&se?S.style.stroke=We(ve,se,b):se&&(S.style.stroke=se),ie!==null&&G!==null?S.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(S.style.strokeWidth=`${G}`),me!==null&&X!==null?S.style.fillOpacity=`${me+(X-me)*b}`:X!==null&&(S.style.fillOpacity=`${X}`),D&&S.tagName.toLowerCase()==="path"&&i[R]&&S.setAttribute("d",ct(i[R],D,b)),R===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(ke=false);}),v){let S=Ee(Q(a,f,de,w));for(let R in v){let le=parseFloat(R);S>=le&&!Ve.has(le)&&(Ve.add(le),v[R]?.());}}!z&&Q(a,f,de,w)>0&&(z=true,T?.()),ke&&!I?(I=true,g?.(),Ie<(E==="infinite"?1/0:E??0)&&(Ie++,Ne=setTimeout(()=>{ge=-1,z=false,I=false,Ve.clear(),Qe(),ze=true;},re))):!ke&&!te&&(I=false),_=requestAnimationFrame(Ze);}let at=false;function Ke(){at||(at=true,_=requestAnimationFrame(function(){Ze();}));}function Je(){at=false,cancelAnimationFrame(_);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!j?(ze=true,Ke()):Je();});},{root:we??null,threshold:k,rootMargin:$});function Lt(){V.forEach((o,a)=>{P[a]=Be(o),o.style.strokeDasharray=`${P[a]}`;}),Mt(),ze=true;}let et;function Ge(){clearTimeout(et),et=setTimeout(Lt,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)),W>0?setTimeout(()=>lt.observe(e),W):lt.observe(e),it({destroy(){cancelAnimationFrame(_),clearTimeout(Ne),Je(),lt.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(et),St();},replay(){ge=-1,J=-1,Xe=-1,z=false,I=false,Ie=0,j=false,ye=0,Ve.clear(),clearTimeout(Ne),Qe(),ze=true,Ae&&Ke();},pause(){j=true,Je();},resume(){j&&(j=false,ze=true,Ae&&Ke());},seek(o){let a=Math.min(1,Math.max(0,o));ye=a,ge=a,j=true,Je(),Gt(a,C),ze=true;},getProgress(){return ye},refresh(){clearTimeout(et),Lt(),Ae&&!j&&Ke();}},()=>({tStart:f,tEnd:de}))}function ar(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Nt(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 lr(e,n,r){let t=Nt(e),l=Nt(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,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*r}${s.units[d]}`).join(", ")})`}).join(" ")}function Vt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(ar(t))return We(t,l,r);if(t.includes("("))return lr(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 cr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ur=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),mr=0,zt="--scroll-draw-progress";function fr(){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:d,native:x=true,velocityScale:N=false,respectReducedMotion:C=true,triggerElement:te,onProgress:$e,onComplete:B,onEnter:Z,onLeave:Y,onEnterBack:W,onLeaveBack:A}=n,L=C&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:ee[s]??ee["ease-out"],v=fe(l.start??"top bottom"),O=fe(l.end??"bottom top"),k=te??e,$=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([i,f])=>({prop:cr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function re(){let i=window.getComputedStyle(e);for(let f of 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 ne=new Map;for(let i of [...E.map(f=>f.prop),zt])ne.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of ne)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(L)return D(),B?.(),{...r,destroy:oe,getProgress:()=>1};re();let K=typeof s=="string"?nt(s):null;function ce(){if(!x||!fr()||!K||m!=="y"||$||k!==e||u||c!==1||$e||B||Z||Y||W||A||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!ur.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++mr}`,f=E.map(J=>`${J.prop}:${J.from}`).join(";"),de=E.map(J=>`${J.prop}:${J.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${i}{from{${f}}to{${de}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${K};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight,Ae=()=>{let J=e.getBoundingClientRect();return xe({top:J.top,height:J.height},z(),_(),v,O)};Ce(e,{type:"animate",getProgress:()=>ge.getProgress(),getTrigger:Ae});let ge={destroy(){e.classList.remove(i),I.remove(),e.style.animationPlayState="",oe(),Le(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(J){let j=Math.min(1,Math.max(0,J));e.classList.remove(i);for(let ye of E)e.style.setProperty(ye.prop,Vt(ye.from,ye.to,j));},getProgress(){let{tStart:J,tEnd:j}=Ae();return M(Q(z(),J,j,c))}};return ge}if(ce())return y();let T=0,g=0,p=0,F=false,pe=false,Se=-1,ue=0,Ee=false,Pe=NaN,_e=-1,we=0,ve=()=>$?m==="x"?$.scrollLeft:$.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>$?m==="x"?$.clientWidth:$.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=tt(k,$,m),f=xe(i,i.scroll,se(),v,O);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(zt,String(i));for(let f of E)e.style.setProperty(f.prop,Vt(f.from,f.to,i));$e?.(i);}function me(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?Z?.():Pe>0&&i<=0&&A?.(),Pe<1&&i>=1?Y?.():Pe>=1&&i<1&&W?.(),Pe=i;}function X(){if(!F||pe)return;let i=performance.now(),f=ve(),de=c;if(N!==false){let _=i-we,Ae=_>0?Math.abs(f-(_e<0?f:_e))/_:0;de=c*Math.max(.2,1+Ae*(typeof N=="number"?N:1)*.04);}_e=f,we=i;let I=g===T?0:(f-T)/(g-T);me(I);let z=M(Q(f,T,g,de));u&&(Se=Math.max(Se,z),z=Se),ue=z,G(z),z>=1&&!Ee?(Ee=true,B?.()):z<1&&!u&&(Ee=false),p=requestAnimationFrame(X);}ie(),g===T&&be("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=M(Q(ve(),T,g,c));u&&i>0&&(Se=i),ue=i,G(i);}let Oe=new IntersectionObserver(i=>{i.forEach(f=>{F=f.isIntersecting,F&&!pe?p=requestAnimationFrame(X):cancelAnimationFrame(p);});},{root:$??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),Oe.observe(e),Ce(e,{type:"animate",getProgress:()=>ue,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),Oe.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),Le(e);},replay(){Se=-1,Ee=false,ue=0,pe=false,G(0);},pause(){pe=true,cancelAnimationFrame(p);},resume(){pe&&(pe=false,F&&(p=requestAnimationFrame(X)));},seek(i){let f=Math.min(1,Math.max(0,i));ue=f,Se=f,pe=true,cancelAnimationFrame(p),G(f);},getProgress(){return ue}}}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 be("scrollCounter: element not found:",e),ft;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=n,C=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],$e=fe(m.start??"top 80%"),B=fe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=C(s),N?.(),ft;let Y=0,W=0,A=0,L=false,M=false,v=-1,O=0,k=false,$=()=>window.scrollY,E=()=>window.innerHeight;function re(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},$(),E(),$e,B);Y=T.tStart,W=T.tEnd;}function D(y){t.textContent=C(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function ne(){if(!L||M)return;let y=te(Q($(),Y,W,1));d&&(v=Math.max(v,y),y=v),O=y,D(y),y>=1&&!k?(k=true,N?.()):y<1&&!d&&(k=false),A=requestAnimationFrame(ne);}re();{let y=te(Q($(),Y,W,1));d&&y>0&&(v=y),O=y,D(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{L=T.isIntersecting,L&&!M?A=requestAnimationFrame(ne):cancelAnimationFrame(A);});}),K;function ce(){clearTimeout(K),K=setTimeout(re,150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),oe.observe(t),Ce(t,{type:"counter",getProgress:()=>O,getTrigger:()=>({tStart:Y,tEnd:W})}),{destroy(){cancelAnimationFrame(A),oe.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(K),Le(t);},replay(){v=-1,k=false,O=0,M=false,D(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,L&&(A=requestAnimationFrame(ne)));},seek(y){let T=Math.min(1,Math.max(0,y));O=T,v=T,M=true,cancelAnimationFrame(A),D(T);},getProgress(){return O}}}var _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return be("scrollVideo: <video> element not found:",e),_t;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=n,C=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,$e=fe(l.start??"top top"),B=fe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=n.from??0,Y=n.to,W=0,A=0,L=0,M=false,v=false,O=-1,k=0,$=false,E=false,re=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function ne(){let p=t.getBoundingClientRect(),F=u==="x"?p.left:p.top,pe=u==="x"?p.width:p.height,Se=xe({top:F,height:pe},re(),D(),$e,B);W=Se.tStart,A=Se.tEnd;}function oe(p){if(!E)return;let F=Y??t.duration??0;t.currentTime=Z+(F-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function K(){if(!M||v||!E)return;let p=te(Q(re(),W,A,1));c&&(O=Math.max(O,p),p=O),k=p,oe(p),p>=1&&!$?($=true,x?.()):p<1&&!c&&($=false),L=requestAnimationFrame(K);}function ce(){if(E=true,Y===void 0&&(Y=t.duration),C){oe(1),d?.();return}ne(),d?.(),M&&!v&&(L=requestAnimationFrame(K));}t.readyState>=1?ce():t.addEventListener("loadedmetadata",ce,{once:true}),E||ne();let y=new IntersectionObserver(p=>{p.forEach(F=>{M=F.isIntersecting,M&&!v&&E?L=requestAnimationFrame(K):cancelAnimationFrame(L);});}),T;function g(){clearTimeout(T),T=setTimeout(ne,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ce(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:W,tEnd:A})}),{destroy(){cancelAnimationFrame(L),y.disconnect(),t.removeEventListener("loadedmetadata",ce),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),Le(t);},replay(){O=-1,$=false,k=0,v=false,oe(0);},pause(){v=true,cancelAnimationFrame(L);},resume(){v&&(v=false,M&&E&&(L=requestAnimationFrame(K)));},seek(p){let F=Math.min(1,Math.max(0,p));k=F,O=F,v=true,cancelAnimationFrame(L),oe(F);},getProgress(){return k}}}function Wt(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 pr(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 qt(e){let n=Wt(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,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function dr(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 gr(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 Bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return be("scrollText: element not found:",e),Bt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=n,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=typeof c=="function"?c:ee[c]??ee["ease-out"],te=fe(m.start??"top 85%"),$e=fe(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=pr(t):l==="lines"?Z=qt(t):Z=Wt(t);let Y=Z.length;function W(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let F=gr(p,u);F&&(g.style.transform=F);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,F)=>{let pe=C(dr(g,F,Y,s));W(p,pe);});}if(N)return A(1),x?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let L=0,M=0,v=0,O=false,k=false,$=-1,E=0,re=false,D=()=>window.scrollY,ne=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},D(),ne(),te,$e);L=p.tStart,M=p.tEnd;}function K(){if(!O||k)return;let g=Q(D(),L,M,1);d&&($=Math.max($,g),g=$),E=g,A(g),g>=1&&!re?(re=true,x?.()):g<1&&!d&&(re=false),v=requestAnimationFrame(K);}oe();let ce=new IntersectionObserver(g=>{g.forEach(p=>{O=p.isIntersecting,O&&!k?v=requestAnimationFrame(K):cancelAnimationFrame(v);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),Z=qt(t),A(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ce.observe(t),Ce(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:L,tEnd:M})}),{destroy(){cancelAnimationFrame(v),ce.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=B,t.removeAttribute("aria-label"),Le(t);},replay(){$=-1,re=false,E=0,k=false,A(0);},pause(){k=true,cancelAnimationFrame(v);},resume(){k&&(k=false,O&&(v=requestAnimationFrame(K)));},seek(g){let p=Math.min(1,Math.max(0,g));E=p,$=p,k=true,cancelAnimationFrame(v),A(p);},getProgress(){return E}}}function yr(e={}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=ut(n.value,e);onUnmounted(()=>r.destroy());}),n}var yt=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=ref(null);return 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);onUnmounted(()=>l.destroy());}),()=>h("div",{ref:r},n.default?.())}});function hr(e){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=mt(n.value,e);onUnmounted(()=>r.destroy());}),n}var ht=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let t=mt(r.value,e.options);onUnmounted(()=>t.destroy());}),()=>h("div",{ref:r},n.default?.())}});function br(e){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=pt(n.value,e);onUnmounted(()=>r.destroy());}),n}var bt=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=ref(null);return 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);onUnmounted(()=>t.destroy());}),()=>h("span",{ref:n})}});function wr(e={}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=dt(n.value,e);onUnmounted(()=>r.destroy());}),n}var wt=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=ref(null);return onMounted(()=>{if(!n.value)return;let r=dt(n.value,e.options??{});onUnmounted(()=>r.destroy());}),()=>h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function vr(e={}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=gt(n.value,e);onUnmounted(()=>r.destroy());}),n}var vt=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let t=gt(r.value,e.options??{});onUnmounted(()=>t.destroy());}),()=>h(e.tag,{ref:r},n.default?.())}});function on(){return {install(e){e.component("ScrollDraw",yt),e.component("ScrollAnimate",ht),e.component("ScrollCounter",bt),e.component("ScrollVideo",wt),e.component("ScrollText",vt);}}}export{ht as ScrollAnimate,bt as ScrollCounter,yt as ScrollDraw,vt as ScrollText,wt as ScrollVideo,on as createScrollDrawPlugin,hr as useScrollAnimate,br as useScrollCounter,yr as useScrollDraw,vr as useScrollText,wr as useScrollVideo};
|
|
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 It=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Nt=/[MmLlHhVvCcSsQqTtAaZz]/g;function ir(e,n,r){if(!rt)return;let t=(e.match(Nt)??[]).join("").toUpperCase(),l=(n.match(Nt)??[]).join("").toUpperCase(),s=(e.match(It)??[]).length,c=(n.match(It)??[]).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?{...kt[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:L="forward",once:ne=false,debug:$e=false,axis:W="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:$,fillOpacity:M,waypoints:w,velocityScale:k=false,threshold:D=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:I,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(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(M)?M[0]:null,Z=Array.isArray(M)?M[1]:typeof M=="number"?M: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,Ie=0,He,ot=null;function St(){ot?.destroy(),ot=null;}let Ve=new Set,Et=NaN,ze=true,Xe=-1,Tt=performance.now(),qe=NaN;function st(){return ve?W==="x"?ve.scrollLeft:ve.scrollTop:W==="x"?window.scrollX:window.scrollY}function xt(){return ve?W==="x"?ve.clientWidth:ve.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function At(){let o=tt(e,ve,W);return xe(o,o.scroll,xt(),Pe,_e)}function Mt(){(({tStart:f,tEnd:ge}=At())),$e&&rt&&(St(),ot=sr(f,ge,W));}function it(o,a=At){Ce(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),Le(e);},o}function Gt(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 Qe(){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=L==="reverse"?"0":`${O[a]}`,m?o.style.opacity=L==="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=>{or(o);let a=Be(o);O.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),R&&(b?ir(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=L==="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=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="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 Ct=typeof p=="string"?nt(p):null;function jt(){return !(ae===false||!nr()||!z.length||!Ct||Q||W!=="y"||ve||u!==1||V!==0||ne||X||k!==false||R||w||S||G>0||d||x||g||C||E||I||fe||A!=null||$!=null||M!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Ut(){let o=++rr,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Ne=L==="reverse"?"0":"var(--ssd-len)",ke=L==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${Ne};`,v=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${L==="reverse"?1:0};`,v+=`opacity:${L==="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:${Ct};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(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(),xt(),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="";}),F.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=L==="reverse"?`${O[be]*Y}`:`${O[be]*(1-Y)}`,m&&(Te.style.opacity=L==="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(jt())return it(Ut());function Yt(){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(L==="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=L==="reverse"?`${O[y]*be}`:`${O[y]*(1-be)}`,m&&(B.style.opacity=L==="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?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{a=performance.now(),_=false,N=false,Ve.clear(),Qe(),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,Ie=0,ue=true,he=0,Ve.clear(),Qe(),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:D,rootMargin:P}),F;function me(){clearTimeout(F),F=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(F);},replay(){Ie=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(F),z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return it(Yt());Mt();function Ze(){if(!Ae||U)return;let o=performance.now(),a=st();if(!ze&&k===false&&a===Et){q=requestAnimationFrame(Ze);return}ze=false,Et=a;let b=u;if(k!==false){let v=o-Tt,F=v>0?Math.abs(a-(Xe<0?a:Xe))/v:0;b=u*Math.max(.2,1+F*(typeof k=="number"?k:1)*.04);}Xe=a,Tt=o;let ue=X?te===-1||a>=te?"forward":"reverse":L;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&&I?.()),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 F=ue==="reverse"?1-v:v;e.style.clipPath=Oe(F),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{ye=-1,_=false,N=false,e.style.clipPath=Oe(0);},oe))):v<1&&!ne&&(N=false),q=requestAnimationFrame(Ze);return}if(z.forEach((v,F)=>{let me=F*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[F]*h}`:`${O[F]*(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[F]&&v.setAttribute("d",ct(i[F],R,h)),F===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 F in w){let me=parseFloat(F);v>=me&&!Ve.has(me)&&(Ve.add(me),w[F]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!N?(N=true,g?.(),Ie<(S==="infinite"?1/0:S??0)&&(Ie++,He=setTimeout(()=>{ye=-1,_=false,N=false,Ve.clear(),Qe(),ze=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Ze);}let at=false;function Ke(){at||(at=true,q=requestAnimationFrame(function(){Ze();}));}function Je(){at=false,cancelAnimationFrame(q);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!U?(ze=true,Ke()):Je();});},{root:ve??null,threshold:D,rootMargin:P});function Lt(){z.forEach((o,a)=>{O[a]=Be(o),o.style.strokeDasharray=`${O[a]}`;}),Mt(),ze=true;}let et;function Ge(){clearTimeout(et),et=setTimeout(Lt,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),Je(),lt.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(et),St();},replay(){ye=-1,te=-1,Xe=-1,_=false,N=false,Ie=0,U=false,he=0,Ve.clear(),clearTimeout(He),Qe(),ze=true,Ae&&Ke();},pause(){U=true,Je();},resume(){U&&(U=false,ze=true,Ae&&Ke());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,Je(),Gt(a,L),ze=true;},getProgress(){return he},refresh(){clearTimeout(et),Lt(),Ae&&!U&&Ke();}},()=>({tStart:f,tEnd:ge}))}function ar(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ht(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 lr(e,n,r){let t=Ht(e),l=Ht(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 Vt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(ar(t))return We(t,l,r);if(t.includes("("))return lr(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 cr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ur=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),mr=0,zt="--scroll-draw-progress";function fr(){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:L=true,triggerElement:ne,onProgress:$e,onComplete:W,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),D=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,S=Object.entries(t).map(([i,f])=>({prop:cr(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),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 R(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?nt(s):null;function ae(){if(!T||!fr()||!ee||m!=="y"||P||D!==e||u||c!==1||$e||W||J||X||G||A||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!ur.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++mr}`,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)};Ce(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Ae});let ye={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",ie(),Le(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,Vt(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return M(K(_(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,C=0,E=false,I=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=tt(D,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,Vt(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 Z(){if(!E||I)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 _=M(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=M(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&&!I?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),Ce(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(),Le(e);},replay(){fe=-1,Ee=false,Q=0,I=false,j(0);},pause(){I=true,cancelAnimationFrame(C);},resume(){I&&(I=false,E&&(C=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,I=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,L=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=L(s),V?.(),ft;let X=0,G=0,A=0,$=false,M=false,w=-1,k=0,D=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=L(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||M)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,R(d),d>=1&&!D?(D=true,V?.()):d<1&&!p&&(D=false),A=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,$&&!M?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),Ce(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),Le(t);},replay(){w=-1,D=false,k=0,M=false,R(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,$&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,M=true,cancelAnimationFrame(A),R(x);},getProgress(){return k}}}var _t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return _t;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),_t;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,L=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,A=0,$=0,M=false,w=false,k=-1,D=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(),I=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,Q=xe({top:I,height:fe},oe(),R(),$e,W);G=Q.tStart,A=Q.tEnd;}let ie=NaN;function ee(E){if(!S)return;let I=X??t.duration??0,fe=J+(I-J)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!M||w||!S)return;let E=ne(K(oe(),G,A,1));c&&(k=Math.max(k,E),E=k),D=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),L){ee(1),p?.();return}se(),p?.(),M&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(I=>{M=I.isIntersecting,M&&!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),Ce(t,{type:"video",getProgress:()=>D,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",C),window.removeEventListener("orientationchange",C),clearTimeout(g),Le(t);},replay(){k=-1,P=false,D=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,M&&S&&($=requestAnimationFrame(ae)));},seek(E){let I=Math.min(1,Math.max(0,E));D=I,k=I,w=true,cancelAnimationFrame($),ie=NaN,ee(I);},getProgress(){return D}}}function Wt(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 pr(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 qt(e){let n=Wt(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 dr(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 gr(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 Bt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Bt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Bt;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,L=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=pr(t):l==="lines"?J=qt(t):J=Wt(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=gr(C,u);E&&(g.style.transform=E);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((C,E)=>{let I=L(dr(g,E,X,s));G(C,I);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let $=0,M=0,w=0,k=false,D=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,M=C.tEnd;}function ee(){if(!k||D)return;let g=K(R(),$,M,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&&!D?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=qt(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Ce(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=W,t.removeAttribute("aria-label"),Le(t);},replay(){P=-1,oe=false,S=0,D=false,A(0);},pause(){D=true,cancelAnimationFrame(w);},resume(){D&&(D=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let C=Math.min(1,Math.max(0,g));S=C,P=C,D=true,cancelAnimationFrame(w),A(C);},getProgress(){return S}}}function yr(e={}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=ut(n.value,e);onUnmounted(()=>r.destroy());}),n}var yt=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=ref(null);return 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);onUnmounted(()=>l.destroy());}),()=>h("div",{ref:r},n.default?.())}});function hr(e){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=mt(n.value,e);onUnmounted(()=>r.destroy());}),n}var ht=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let t=mt(r.value,e.options);onUnmounted(()=>t.destroy());}),()=>h("div",{ref:r},n.default?.())}});function br(e){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=pt(n.value,e);onUnmounted(()=>r.destroy());}),n}var bt=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=ref(null);return 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);onUnmounted(()=>t.destroy());}),()=>h("span",{ref:n})}});function wr(e={}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=dt(n.value,e);onUnmounted(()=>r.destroy());}),n}var wt=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=ref(null);return onMounted(()=>{if(!n.value)return;let r=dt(n.value,e.options??{});onUnmounted(()=>r.destroy());}),()=>h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function vr(e={}){let n=ref(null);return onMounted(()=>{if(!n.value)return;let r=gt(n.value,e);onUnmounted(()=>r.destroy());}),n}var vt=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let r=ref(null);return onMounted(()=>{if(!r.value)return;let t=gt(r.value,e.options??{});onUnmounted(()=>t.destroy());}),()=>h(e.tag,{ref:r},n.default?.())}});function on(){return {install(e){e.component("ScrollDraw",yt),e.component("ScrollAnimate",ht),e.component("ScrollCounter",bt),e.component("ScrollVideo",wt),e.component("ScrollText",vt);}}}export{ht as ScrollAnimate,bt as ScrollCounter,yt as ScrollDraw,vt as ScrollText,wt as ScrollVideo,on as createScrollDrawPlugin,hr as useScrollAnimate,br as useScrollCounter,yr as useScrollDraw,vr as useScrollText,wr as useScrollVideo};
|
package/dist/pin/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function G({bounces:t=3,decay:s=.5}={}){let u=Math.max(1,Math.round(t)),e=Math.max(.01,Math.min(.99,s)),a=Math.sqrt(e),l=0,
|
|
1
|
+
'use strict';function G({bounces:t=3,decay:s=.5}={}){let u=Math.max(1,Math.round(t)),e=Math.max(.01,Math.min(.99,s)),a=Math.sqrt(e),l=0,y=[];for(let r=0;r<u;r++){let i=Math.pow(a,r);y.push(i),l+=i;}let c=[0],h=0;for(let r=0;r<u;r++)h+=y[r]/l,c.push(h);return r=>{if(r<=0)return 0;if(r>=1)return 1;for(let i=0;i<u;i++)if(r<=c[i+1]){let d=(r-c[i])/(c[i+1]-c[i]);if(i===0)return d*(2-d);let n=1-Math.pow(e,i);return n+(1-n)*(2*d-1)*(2*d-1)}return 1}}function N({amplitude:t=1,period:s=.4}={}){let u=Math.max(1,t),e=Math.max(.1,s),a=u<=1?e/4:e/(2*Math.PI)*Math.asin(1/u);return l=>l<=0?0:l>=1?1:u*Math.pow(2,-10*l)*Math.sin((l-a)*(2*Math.PI)/e)+1}({bounce:G(),elastic:N()});function B(t,s,u){return Math.min(u,Math.max(s,t))}var $=Symbol.for("svg-scroll-draw.registry");function A(){let t=globalThis;return t[$]||(t[$]=new Map)}function C(t,s){A().set(t,s);}function D(t){A().delete(t);}var W=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function O(t,...s){W&&console.warn(`[svg-scroll-draw] ${t}`,...s);}var V={destroy:()=>{},refresh:()=>{},getProgress:()=>0};function J(t,s={}){if(typeof window>"u")return V;let u=typeof t=="string"?document.querySelector(t):t;if(!u)return O("scrollPin: element not found:",t),V;let e=u,{top:a=0,scrollContainer:l,onEnter:y,onLeave:c,onEnterBack:h,onLeaveBack:r,onProgress:i}=s,d=typeof l=="string"?document.querySelector(l):l??null,n={position:e.style.position,top:e.style.top,bottom:e.style.bottom,left:e.style.left,width:e.style.width,boxSizing:e.style.boxSizing},o=document.createElement("div");o.setAttribute("data-ssd-pin-wrapper",""),o.style.cssText="position:relative;",e.parentNode?.insertBefore(o,e),o.appendChild(e);let T=0,v=0,E=0,S="before",M=0,I=0,_=false;function w(){T=o.offsetWidth,v=e.offsetHeight,E=s.pinDistance??window.innerHeight,o.style.height=`${v+E}px`;}function R(p){if(S===p)return;let m=S;if(S=p,p==="before")e.style.position=n.position,e.style.top=n.top,e.style.bottom=n.bottom,e.style.left=n.left,e.style.width=n.width,e.style.boxSizing=n.boxSizing,m==="pinned"&&r?.();else if(p==="pinned"){let P=o.getBoundingClientRect();e.style.position="fixed",e.style.top=`${a}px`,e.style.bottom="",e.style.left=`${P.left}px`,e.style.width=`${T}px`,e.style.boxSizing="border-box",m==="before"?y?.():m==="after"&&h?.();}else e.style.position="absolute",e.style.top="",e.style.bottom="0",e.style.left="0",e.style.width="100%",e.style.boxSizing="border-box",m==="pinned"&&c?.();}function F(){_=false;let p=o.getBoundingClientRect(),m=p.top,P=p.bottom,z=B((a-m)/E,0,1);M=z,i?.(z),m>a?R("before"):P-v<=a?R("after"):R("pinned");}function f(){_||(_=true,I=requestAnimationFrame(()=>F()));}let L=d??window;L.addEventListener("scroll",f,{passive:true});let b;function x(){clearTimeout(b),b=setTimeout(()=>{w(),f();},150);}window.addEventListener("resize",x),window.addEventListener("orientationchange",x);let g=null;return typeof ResizeObserver<"u"&&(g=new ResizeObserver(()=>{clearTimeout(b),b=setTimeout(()=>{w(),f();},100);}),g.observe(o),g.observe(document.documentElement),g.observe(e)),w(),f(),C(o,{type:"pin",getProgress:()=>M,getTrigger:()=>({tStart:0,tEnd:1})}),{destroy(){cancelAnimationFrame(I),clearTimeout(b),L.removeEventListener("scroll",f),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),g?.disconnect(),e.style.position=n.position,e.style.top=n.top,e.style.bottom=n.bottom,e.style.left=n.left,e.style.width=n.width,e.style.boxSizing=n.boxSizing,o.parentNode?.insertBefore(e,o),o.remove(),D(o);},refresh(){w(),f();},getProgress(){return M}}}exports.scrollPin=J;
|
package/dist/pin/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function G({bounces:t=3,decay:s=.5}={}){let u=Math.max(1,Math.round(t)),e=Math.max(.01,Math.min(.99,s)),a=Math.sqrt(e),l=0,
|
|
1
|
+
function G({bounces:t=3,decay:s=.5}={}){let u=Math.max(1,Math.round(t)),e=Math.max(.01,Math.min(.99,s)),a=Math.sqrt(e),l=0,y=[];for(let r=0;r<u;r++){let i=Math.pow(a,r);y.push(i),l+=i;}let c=[0],h=0;for(let r=0;r<u;r++)h+=y[r]/l,c.push(h);return r=>{if(r<=0)return 0;if(r>=1)return 1;for(let i=0;i<u;i++)if(r<=c[i+1]){let d=(r-c[i])/(c[i+1]-c[i]);if(i===0)return d*(2-d);let n=1-Math.pow(e,i);return n+(1-n)*(2*d-1)*(2*d-1)}return 1}}function N({amplitude:t=1,period:s=.4}={}){let u=Math.max(1,t),e=Math.max(.1,s),a=u<=1?e/4:e/(2*Math.PI)*Math.asin(1/u);return l=>l<=0?0:l>=1?1:u*Math.pow(2,-10*l)*Math.sin((l-a)*(2*Math.PI)/e)+1}({bounce:G(),elastic:N()});function B(t,s,u){return Math.min(u,Math.max(s,t))}var $=Symbol.for("svg-scroll-draw.registry");function A(){let t=globalThis;return t[$]||(t[$]=new Map)}function C(t,s){A().set(t,s);}function D(t){A().delete(t);}var W=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function O(t,...s){W&&console.warn(`[svg-scroll-draw] ${t}`,...s);}var V={destroy:()=>{},refresh:()=>{},getProgress:()=>0};function J(t,s={}){if(typeof window>"u")return V;let u=typeof t=="string"?document.querySelector(t):t;if(!u)return O("scrollPin: element not found:",t),V;let e=u,{top:a=0,scrollContainer:l,onEnter:y,onLeave:c,onEnterBack:h,onLeaveBack:r,onProgress:i}=s,d=typeof l=="string"?document.querySelector(l):l??null,n={position:e.style.position,top:e.style.top,bottom:e.style.bottom,left:e.style.left,width:e.style.width,boxSizing:e.style.boxSizing},o=document.createElement("div");o.setAttribute("data-ssd-pin-wrapper",""),o.style.cssText="position:relative;",e.parentNode?.insertBefore(o,e),o.appendChild(e);let T=0,v=0,E=0,S="before",M=0,I=0,_=false;function w(){T=o.offsetWidth,v=e.offsetHeight,E=s.pinDistance??window.innerHeight,o.style.height=`${v+E}px`;}function R(p){if(S===p)return;let m=S;if(S=p,p==="before")e.style.position=n.position,e.style.top=n.top,e.style.bottom=n.bottom,e.style.left=n.left,e.style.width=n.width,e.style.boxSizing=n.boxSizing,m==="pinned"&&r?.();else if(p==="pinned"){let P=o.getBoundingClientRect();e.style.position="fixed",e.style.top=`${a}px`,e.style.bottom="",e.style.left=`${P.left}px`,e.style.width=`${T}px`,e.style.boxSizing="border-box",m==="before"?y?.():m==="after"&&h?.();}else e.style.position="absolute",e.style.top="",e.style.bottom="0",e.style.left="0",e.style.width="100%",e.style.boxSizing="border-box",m==="pinned"&&c?.();}function F(){_=false;let p=o.getBoundingClientRect(),m=p.top,P=p.bottom,z=B((a-m)/E,0,1);M=z,i?.(z),m>a?R("before"):P-v<=a?R("after"):R("pinned");}function f(){_||(_=true,I=requestAnimationFrame(()=>F()));}let L=d??window;L.addEventListener("scroll",f,{passive:true});let b;function x(){clearTimeout(b),b=setTimeout(()=>{w(),f();},150);}window.addEventListener("resize",x),window.addEventListener("orientationchange",x);let g=null;return typeof ResizeObserver<"u"&&(g=new ResizeObserver(()=>{clearTimeout(b),b=setTimeout(()=>{w(),f();},100);}),g.observe(o),g.observe(document.documentElement),g.observe(e)),w(),f(),C(o,{type:"pin",getProgress:()=>M,getTrigger:()=>({tStart:0,tEnd:1})}),{destroy(){cancelAnimationFrame(I),clearTimeout(b),L.removeEventListener("scroll",f),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),g?.disconnect(),e.style.position=n.position,e.style.top=n.top,e.style.bottom=n.bottom,e.style.left=n.left,e.style.width=n.width,e.style.boxSizing=n.boxSizing,o.parentNode?.insertBefore(e,o),o.remove(),D(o);},refresh(){w(),f();},getProgress(){return M}}}export{J as scrollPin};
|