svg-scroll-draw 2.16.1 → 2.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.d.mts +45 -49
- package/dist/angular/index.d.ts +45 -49
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +5 -2
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/{chunk-OWMO2S3V.mjs → chunk-DIMNQPW5.mjs} +1 -1
- package/dist/chunk-HMSNYXKW.mjs +1 -0
- package/dist/chunk-LINFV2GK.mjs +3 -0
- package/dist/chunk-XSVTHCLO.mjs +1 -0
- package/dist/group/index.cjs +2 -2
- package/dist/group/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +16 -11
- package/dist/solid/index.d.ts +16 -11
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +5 -5
- package/dist/svelte/index.d.ts +5 -5
- package/dist/svelte/index.mjs +1 -1
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.mts +14 -7
- package/dist/vue/index.d.ts +14 -7
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +2 -2
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-E4M2PB7B.mjs +0 -1
- package/dist/chunk-WDIHLRZZ.mjs +0 -3
package/dist/group/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function Ht({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(t),c=0,m=[];for(let h=0;h<r;h++){let S=Math.pow(o,h);m.push(S),c+=S;}let i=[0],u=0;for(let h=0;h<r;h++)u+=m[h]/c,i.push(u);return h=>{if(h<=0)return 0;if(h>=1)return 1;for(let S=0;S<r;S++)if(h<=i[S+1]){let V=(h-i[S])/(i[S+1]-i[S]);if(S===0)return V*(2-V);let x=1-Math.pow(t,S);return x+(1-x)*(2*V-1)*(2*V-1)}return 1}}function Vt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),o=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return c=>c<=0?0:c>=1?1:r*Math.pow(2,-10*c)*Math.sin((c-o)*(2*Math.PI)/t)+1}var xe={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:Ht(),elastic:Vt()};function wt(e,n,r){return Math.min(r,Math.max(n,e))}function Ie(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 vt(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 Et(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 re(e,n,r,t){return r===n?0:wt((e-n)/(r-n)*t,0,1)}function Ce(e,n,r,t,o){let c=vt(e.top,e.height,n,t.element)-Et(t.viewport,r),m=vt(e.top,e.height,n,o.element)-Et(o.viewport,r);return {tStart:c,tEnd:m}}function et(e,n,r){let t=e.getBoundingClientRect(),o=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:o,scroll:0}:{top:r==="x"?t.left:t.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function Oe(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function St(e){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 Re(e,n,r){let t=St(e),o=St(n);return !t||!o?e:`rgb(${Math.round(t[0]+(o[0]-t[0])*r)},${Math.round(t[1]+(o[1]-t[1])*r)},${Math.round(t[2]+(o[2]-t[2])*r)})`}var xt={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 We=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function fe(e,...n){We&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var zt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Wt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Tt=33;function qt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Gt(e){let n=[];for(let r=0;r<Tt;r++){let t=r/(Tt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function tt(e){switch(e){case "linear":return "linear";case "ease-in":return zt;case "ease-out":return Wt;case "ease-in-out":return qt()?Gt(xe["ease-in-out"]):null;default:return null}}var $t=Symbol.for("svg-scroll-draw.registry");function At(){let e=globalThis;return e[$t]||(e[$t]=new Map)}function qe(e,n){At().set(e,n);}function Ge(e){At().delete(e);}var Bt=0;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Pt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Mt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ut(e){if(!We)return;let n=Pt(e,"stroke");if(!n||n==="none"){fe("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Mt.has(r)&&!Mt.has(Pt(e,"fill"))&&fe("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Xt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function o(){let c=r==="x"?window.scrollX:window.scrollY,m=e-c,i=n-c,u=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${m}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${u?`left:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,kt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Xt(e,n,r){if(!ze)return;let t=(e.match(kt)??[]).join("").toUpperCase(),o=(n.match(kt)??[]).join("").toUpperCase(),c=(e.match(Mt)??[]).length,m=(n.match(Mt)??[]).length;if(t!==o){fe(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==m&&fe(`morphTo: coordinate count differs (${c} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let m=parseFloat(c),i=t[o++]??m;return String(+(m+(i-m)*r).toFixed(4))})}function lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,o=r?{...St[r],...t}:t,c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:i=1,fade:u=false,easing:h="linear",trigger:S={},stagger:V=0,direction:x="forward",once:me=false,debug:Be=false,axis:J="y",scrollContainer:Pe,autoReverse:xe=false,delay:he=0,strokeColor:oe,strokeWidth:pe,fillOpacity:ee,waypoints:se,velocityScale:be=false,threshold:Ne=0,rootMargin:Q="0px",repeat:C=0,repeatDelay:Fe=0,morphTo:z,clip:Me,autoplay:_e=false,duration:je=1e3,native:tt=true,onProgress:Te,onStart:U,onComplete:W,onEnter:ie,onLeave:$e,onEnterBack:ae,onLeaveBack:de}=o,_=Me===true?"left":typeof Me=="string"?Me:false,Z=typeof h=="function"?h:Se[h]??Se.linear,le=De(S.start??"top bottom"),ke=De(S.end??"bottom top"),X=typeof Pe=="string"?document.querySelector(Pe):Pe??null,Y=Array.isArray(oe)?oe[0]:null,O=Array.isArray(oe)?oe[1]:typeof oe=="string"?oe:null,R=Array.isArray(pe)?pe[0]:null,M=Array.isArray(pe)?pe[1]:typeof pe=="number"?pe:null,H=Array.isArray(ee)?ee[0]:null,D=Array.isArray(ee)?ee[1]:typeof ee=="number"?ee:null;function ce(s){let l=s*100;switch(_){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=_?[]:Array.from(e.querySelectorAll(m)),b=[],a=[],f=0,q=0,v=false,$=false,A=0,te=false,G=-1,I=-1,k=false,B=0,ge=0,we,rt=null;function ut(){rt?.destroy(),rt=null;}let ve=new Set,ft=NaN,Ee=true,Ue=-1,mt=performance.now(),Le=NaN;function nt(){return X?J==="x"?X.scrollLeft:X.scrollTop:J==="x"?window.scrollX:window.scrollY}function pt(){return X?J==="x"?X.clientWidth:X.clientHeight:J==="x"?window.innerWidth:window.innerHeight}function dt(){let s=Je(e,X,J);return Ie(s,s.scroll,pt(),le,ke)}function gt(){(({tStart:f,tEnd:q}=dt())),Be&&ze&&(ut(),rt=Ut(f,q,J));}function ot(s,l=dt){We(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:l});let g=s.destroy;return s.destroy=()=>{g.call(s),qe(e);},s}function Ot(s,l){if(e.style.setProperty("--scroll-draw-progress",String(s)),_){let g=l==="reverse"?1-s:s;e.style.clipPath=ce(g);return}T.forEach((g,N)=>{g.style.strokeDashoffset=l==="reverse"?`${b[N]*s}`:`${b[N]*(1-s)}`,u&&(g.style.opacity=l==="reverse"?`${1-s}`:`${s}`),Y&&O?g.style.stroke=Oe(Y,O,s):O&&(g.style.stroke=O),R!==null&&M!==null?g.style.strokeWidth=`${R+(M-R)*s}`:M!==null&&(g.style.strokeWidth=`${M}`),H!==null&&D!==null?g.style.fillOpacity=`${H+(D-H)*s}`:D!==null&&(g.style.fillOpacity=`${D}`),z&&g.tagName.toLowerCase()==="path"&&a[N]&&g.setAttribute("d",at(a[N],z,s));});}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),_){e.style.clipPath=ce(0);return}T.forEach((s,l)=>{s.style.strokeDasharray=`${b[l]}`,s.style.strokeDashoffset=x==="reverse"?"0":`${b[l]}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",Y&&(s.style.stroke=Y),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`),z&&s.tagName.toLowerCase()==="path"&&a[l]&&s.setAttribute("d",a[l]);});}if(T.forEach(s=>{jt(s);let l=Ce(s);b.push(l);let g=s.tagName.toLowerCase()==="path";g?a.push(s.getAttribute("d")??""):a.push(""),z&&(g?Xt(a[a.length-1],z,s):fe(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),c?(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?`${l}`:"0",u&&(s.style.opacity="1"),O&&(s.style.stroke=O),M!==null&&(s.style.strokeWidth=`${M}`),D!==null&&(s.style.fillOpacity=`${D}`),z&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",z)):(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?"0":`${l}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",Y&&(s.style.stroke=Y),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`));}),_){if(c)return e.style.clipPath=ce(1),W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ce(0);}else if(c)return W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let yt=typeof h=="string"?et(h):null;function Rt(){return !(tt===false||!Bt()||!T.length||!yt||_||J!=="y"||X||i!==1||V!==0||me||xe||be!==false||z||se||C||he>0||Te||U||W||ie||$e||ae||de||oe!=null||pe!=null||ee!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Nt(){let s=++Gt,l=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,N=`--svg-scroll-draw-${s}`,ye=x==="reverse"?"0":"var(--ssd-len)",ue=x==="reverse"?"var(--ssd-len)":"0",re=`stroke-dashoffset:${ye};`,y=`stroke-dashoffset:${ue};`;u&&(re+=`opacity:${x==="reverse"?1:0};`,y+=`opacity:${x==="reverse"?0:1};`);let w=document.createElement("style");w.setAttribute("data-svg-scroll-draw",""),w.textContent=`@keyframes ${l}{from{${re}}to{${y}}}.${g}{view-timeline-name:${N};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${yt};animation-fill-mode:both;animation-timeline:${N};animation-range:cover 0% cover 100%;}`,document.head.appendChild(w),e.classList.add(g);function F(p,L){p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(l);}T.forEach(F);let d=false,E=-1;function P(){if(E>=0)return E;let p=e.getBoundingClientRect(),{tStart:L,tEnd:K}=Ie({top:p.top,height:p.height},nt(),pt(),le,ke);return Z(ne(nt(),L,K,i))}return {destroy(){e.classList.remove(g),T.forEach(p=>{p.classList.remove(l),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),w.remove();},replay(){d=false,E=-1,T.forEach(F);},pause(){d=true,T.forEach(p=>{p.style.animationPlayState="paused";});},resume(){d&&(d=false,T.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let L=Math.min(1,Math.max(0,p));E=L,d=true,T.forEach((K,j)=>{K.classList.remove(l),K.style.strokeDashoffset=x==="reverse"?`${b[j]*L}`:`${b[j]*(1-L)}`,u&&(K.style.opacity=x==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return P()},refresh(){T.forEach((p,L)=>{b[L]=Ce(p),p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`;});}}}if(Rt())return ot(Nt());function Ft(){let s=Math.max(1,je),l=0,g=0,N=false;function ye(d){let E=true;if(_){let P=Math.min(1,Math.max(0,d/s)),p=Z(P);B=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ce(x==="reverse"?1-p:p),Te?.(p),P<1&&(E=false);}else T.forEach((P,p)=>{let L=p*V*s,K=Math.min(1,Math.max(0,(d-L)/s)),j=Z(K);P.style.strokeDashoffset=x==="reverse"?`${b[p]*j}`:`${b[p]*(1-j)}`,u&&(P.style.opacity=x==="reverse"?`${1-j}`:`${j}`),Y&&O?P.style.stroke=Oe(Y,O,j):O&&(P.style.stroke=O),R!==null&&M!==null?P.style.strokeWidth=`${R+(M-R)*j}`:M!==null&&(P.style.strokeWidth=`${M}`),H!==null&&D!==null?P.style.fillOpacity=`${H+(D-H)*j}`:D!==null&&(P.style.fillOpacity=`${D}`),z&&P.tagName.toLowerCase()==="path"&&a[p]&&P.setAttribute("d",at(a[p],z,j)),p===0&&(B=j,Te?.(j),e.style.setProperty("--scroll-draw-progress",String(j))),K<1&&(E=false);});if(se){let P=Math.min(1,Math.max(0,d/s)),p=Z(P);for(let L in se){let K=parseFloat(L);p>=K&&!ve.has(K)&&(ve.add(K),se[L]?.());}}return E}function ue(d){if(k)return;let E=d-l;$||($=true,U?.());let P=ye(E);if(P&&!v){v=true,ye(s*(1+Math.max(0,T.length-1)*V)),W?.(),ge<(C==="infinite"?1/0:C??0)&&(ge++,we=setTimeout(()=>{l=performance.now(),$=false,v=false,ve.clear(),Xe(),A=requestAnimationFrame(ue);},Fe));return}P||(A=requestAnimationFrame(ue));}function re(){cancelAnimationFrame(A),clearTimeout(we),l=performance.now(),g=0,k=false,$=false,v=false,ge=0,N=true,B=0,ve.clear(),Xe(),A=requestAnimationFrame(ue);}let y=new IntersectionObserver(d=>{d.forEach(E=>{E.isIntersecting&&!(me&&v)?re():!E.isIntersecting&&!me&&!v&&(cancelAnimationFrame(A),clearTimeout(we),N=false);});},{root:X??null,threshold:Ne,rootMargin:Q}),w;function F(){clearTimeout(w),w=setTimeout(()=>{T.forEach((d,E)=>{b[E]=Ce(d),d.style.strokeDasharray=`${b[E]}`;});},150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),he>0?setTimeout(()=>y.observe(e),he):y.observe(e),{destroy(){cancelAnimationFrame(A),clearTimeout(we),y.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(w);},replay(){ge=0,re();},pause(){k||!N||(k=true,g=performance.now()-l,cancelAnimationFrame(A));},resume(){k&&(k=false,N=true,l=performance.now()-g,A=requestAnimationFrame(ue));},seek(d){let E=Math.min(1,Math.max(0,d));B=E,k=true,g=E*s,l=performance.now()-g,cancelAnimationFrame(A),ye(g);},getProgress(){return B},refresh(){clearTimeout(w),T.forEach((d,E)=>{b[E]=Ce(d),d.style.strokeDasharray=`${b[E]}`;});}}}if(_e)return ot(Ft());gt();function Ye(){if(!te||k)return;let s=performance.now(),l=nt();if(!Ee&&be===false&&l===ft){A=requestAnimationFrame(Ye);return}Ee=false,ft=l;let g=i;if(be!==false){let y=s-mt,w=y>0?Math.abs(l-(Ue<0?l:Ue))/y:0;g=i*Math.max(.2,1+w*(typeof be=="number"?be:1)*.04);}Ue=l,mt=s;let N=xe?I===-1||l>=I?"forward":"reverse":x;I=l;let ye=q-f,ue=true,re=ye===0?0:(l-f)/ye;if(isNaN(Le)||(Le<=0&&re>0?ie?.():Le>0&&re<=0&&de?.(),Le<1&&re>=1?$e?.():Le>=1&&re<1&&ae?.()),Le=re,_){let y=Z(ne(l,f,q,g));me&&!xe&&(G=Math.max(G,y),y=G),B=y,e.style.setProperty("--scroll-draw-progress",String(y));let w=N==="reverse"?1-y:y;e.style.clipPath=ce(w),Te?.(y),!$&&ne(l,f,q,g)>0&&($=true,U?.()),y>=1&&!v?(v=true,W?.(),ge<(C==="infinite"?1/0:C??0)&&(ge++,we=setTimeout(()=>{G=-1,$=false,v=false,e.style.clipPath=ce(0);},Fe))):y<1&&!me&&(v=false),A=requestAnimationFrame(Ye);return}if(T.forEach((y,w)=>{let F=w*V*ye,d=Z(ne(l,f+F,q+F,g));me&&!xe&&(G=Math.max(G,d),d=G),B=d,y.style.strokeDashoffset=N==="reverse"?`${b[w]*d}`:`${b[w]*(1-d)}`,u&&(y.style.opacity=N==="reverse"?`${1-d}`:`${d}`),Y&&O?y.style.stroke=Oe(Y,O,d):O&&(y.style.stroke=O),R!==null&&M!==null?y.style.strokeWidth=`${R+(M-R)*d}`:M!==null&&(y.style.strokeWidth=`${M}`),H!==null&&D!==null?y.style.fillOpacity=`${H+(D-H)*d}`:D!==null&&(y.style.fillOpacity=`${D}`),z&&y.tagName.toLowerCase()==="path"&&a[w]&&y.setAttribute("d",at(a[w],z,d)),w===0&&(Te?.(d),e.style.setProperty("--scroll-draw-progress",String(d))),d<1&&(ue=false);}),se){let y=Z(ne(l,f,q,g));for(let w in se){let F=parseFloat(w);y>=F&&!ve.has(F)&&(ve.add(F),se[w]?.());}}!$&&ne(l,f,q,g)>0&&($=true,U?.()),ue&&!v?(v=true,W?.(),ge<(C==="infinite"?1/0:C??0)&&(ge++,we=setTimeout(()=>{G=-1,$=false,v=false,ve.clear(),Xe(),Ee=true;},Fe))):!ue&&!me&&(v=false),A=requestAnimationFrame(Ye);}let st=false;function Qe(){st||(st=true,A=requestAnimationFrame(function(){Ye();}));}function Ze(){st=false,cancelAnimationFrame(A);}let it=new IntersectionObserver(s=>{s.forEach(l=>{te=l.isIntersecting,te&&!k?(Ee=true,Qe()):Ze();});},{root:X??null,threshold:Ne,rootMargin:Q});function ht(){T.forEach((s,l)=>{b[l]=Ce(s),s.style.strokeDasharray=`${b[l]}`;}),gt(),Ee=true;}let Ke;function He(){clearTimeout(Ke),Ke=setTimeout(ht,150);}window.addEventListener("resize",He),window.addEventListener("orientationchange",He);let Ve;return typeof ResizeObserver<"u"&&(Ve=new ResizeObserver(()=>He()),Ve.observe(document.body),Ve.observe(document.documentElement),Ve.observe(e)),he>0?setTimeout(()=>it.observe(e),he):it.observe(e),ot({destroy(){cancelAnimationFrame(A),clearTimeout(we),Ze(),it.disconnect(),Ve?.disconnect(),window.removeEventListener("resize",He),window.removeEventListener("orientationchange",He),clearTimeout(Ke),ut();},replay(){G=-1,I=-1,Ue=-1,$=false,v=false,ge=0,k=false,B=0,ve.clear(),clearTimeout(we),Xe(),Ee=true,te&&Qe();},pause(){k=true,Ze();},resume(){k&&(k=false,Ee=true,te&&Qe());},seek(s){let l=Math.min(1,Math.max(0,s));B=l,G=l,k=true,Ze(),Ot(l,x),Ee=true;},getProgress(){return B},refresh(){clearTimeout(Ke),ht(),te&&!k&&Qe();}},()=>({tStart:f,tEnd:q}))}function Yt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],m=t[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let u=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),c.push(u?u[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function Qt(e,n,r){let t=Lt(e),o=Lt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,m)=>{let i=o[m];return c.fn!==i.fn||c.nums.length!==i.nums.length?r<1?`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,h)=>`${u}${i.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u+(i.nums[h]-u)*r}${c.units[h]}`).join(", ")})`}).join(" ")}function ct(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(Yt(t))return Oe(t,o,r);if(t.includes("("))return Qt(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),m=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&m){let i=parseFloat(c[1]),u=parseFloat(m[1]);return `${i+(u-i)*r}${c[2]||m[2]}`}return r<1?t:o}function Zt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Jt=0,Dt="--scroll-draw-progress";function er(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Re(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:o={},easing:c="ease-out",speed:m=1,once:i=false,axis:u="y",scrollContainer:h,native:S=true,velocityScale:V=false,respectReducedMotion:x=true,triggerElement:me,onProgress:Be,onComplete:J,onEnter:Pe,onLeave:xe,onEnterBack:he,onLeaveBack:oe}=n,pe=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,ee=typeof c=="function"?c:Se[c]??Se["ease-out"],se=De(o.start??"top bottom"),be=De(o.end??"bottom top"),Ne=me??e,Q=typeof h=="string"?document.querySelector(h):h??null,C=Object.entries(t).map(([a,f])=>({prop:Zt(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Fe(){let a=window.getComputedStyle(e);for(let f of C)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function z(){for(let a of C)e.style.setProperty(a.prop,String(a.to));}let Me=new Map;for(let a of [...C.map(f=>f.prop),Dt])Me.set(a,e.style.getPropertyValue(a));function _e(){for(let[a,f]of Me)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(pe)return z(),J?.(),{...r,destroy:_e,getProgress:()=>1};Fe();let je=typeof c=="string"?et(c):null;function tt(){if(!S||!er()||!je||u!=="y"||Q||Ne!==e||i||m!==1||Be||J||Pe||xe||he||oe||V!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let a of C)if(!Kt.has(a.prop))return false;return true}function Te(){let a=`ssd-a-${++Jt}`,f=C.map(I=>`${I.prop}:${I.from}`).join(";"),q=C.map(I=>`${I.prop}:${I.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${a}{from{${f}}to{${q}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${je};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),e.classList.add(a);let $=()=>u==="x"?window.scrollX:window.scrollY,A=()=>u==="x"?window.innerWidth:window.innerHeight,te=()=>{let I=e.getBoundingClientRect();return Ie({top:I.top,height:I.height},$(),A(),se,be)};We(e,{type:"animate",getProgress:()=>G.getProgress(),getTrigger:te});let G={destroy(){e.classList.remove(a),v.remove(),e.style.animationPlayState="",_e(),qe(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let k=Math.min(1,Math.max(0,I));e.classList.remove(a);for(let B of C)e.style.setProperty(B.prop,ct(B.from,B.to,k));},getProgress(){let{tStart:I,tEnd:k}=te();return ee(ne($(),I,k,m))}};return G}if(tt())return Te();let U=0,W=0,ie=0,$e=false,ae=false,de=-1,_=0,Z=false,le=NaN,ke=-1,X=0,Y=()=>Q?u==="x"?Q.scrollLeft:Q.scrollTop:u==="x"?window.scrollX:window.scrollY,O=()=>Q?u==="x"?Q.clientWidth:Q.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function R(){let a=Je(Ne,Q,u),f=Ie(a,a.scroll,O(),se,be);U=f.tStart,W=f.tEnd;}function M(a){e.style.setProperty(Dt,String(a));for(let f of C)e.style.setProperty(f.prop,ct(f.from,f.to,a));Be?.(a);}function H(a){if(isNaN(le)){le=a;return}le<=0&&a>0?Pe?.():le>0&&a<=0&&oe?.(),le<1&&a>=1?xe?.():le>=1&&a<1&&he?.(),le=a;}function D(){if(!$e||ae)return;let a=performance.now(),f=Y(),q=m;if(V!==false){let A=a-X,te=A>0?Math.abs(f-(ke<0?f:ke))/A:0;q=m*Math.max(.2,1+te*(typeof V=="number"?V:1)*.04);}ke=f,X=a;let v=W===U?0:(f-U)/(W-U);H(v);let $=ee(ne(f,U,W,q));i&&(de=Math.max(de,$),$=de),_=$,M($),$>=1&&!Z?(Z=true,J?.()):$<1&&!i&&(Z=false),ie=requestAnimationFrame(D);}R(),W===U&&fe("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let a=ee(ne(Y(),U,W,m));i&&a>0&&(de=a),_=a,M(a);}let ce=new IntersectionObserver(a=>{a.forEach(f=>{$e=f.isIntersecting,$e&&!ae?ie=requestAnimationFrame(D):cancelAnimationFrame(ie);});},{root:Q??null}),T;function b(){clearTimeout(T),T=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),ce.observe(e),We(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:U,tEnd:W})}),{destroy(){cancelAnimationFrame(ie),ce.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),_e(),qe(e);},replay(){de=-1,Z=false,_=0,ae=false,M(0);},pause(){ae=true,cancelAnimationFrame(ie);},resume(){ae&&(ae=false,$e&&(ie=requestAnimationFrame(D)));},seek(a){let f=Math.min(1,Math.max(0,a));_=f,de=f,ae=true,cancelAnimationFrame(ie),M(f);},getProgress(){return _}}}var It={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ct(e,n={}){if(typeof window>"u")return It;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return fe("scrollParallax: element not found:",e),It;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:m,onProgress:i}=n,u=r.getBoundingClientRect(),h=o==="x"?u.width:u.height,S=t*h;return Re(r,{props:o==="x"?{transform:["translateX(0px)",`translateX(${-S}px)`]}:{transform:["translateY(0px)",`translateY(${-S}px)`]},trigger:m??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:i})}function Ge(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var Ae={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Fr(e,n={}){if(typeof window>"u")return Ae;let r=Ge(e).map(t=>lt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function _r(e,n={}){if(typeof window>"u")return Ae;let r=Ge(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return lt(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function Hr(e,n){if(typeof window>"u")return Ae;let r=Ge(e).map(t=>Re(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function Vr(e,n){if(typeof window>"u")return Ae;let r=Ge(e);if(r.length===0)return Ae;let t=0,o=[];function c(i){return Re(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function zr(e,n={}){if(typeof window>"u")return Ae;let r=Ge(e).map(t=>Ct(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}exports.scrollAnimateGroup=Hr;exports.scrollAnimateSequence=Vr;exports.scrollDrawGroup=Fr;exports.scrollDrawSequence=_r;exports.scrollParallaxGroup=zr;
|
|
3
|
+
<div style="position:absolute;${u?`left:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var kt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Lt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Yt(e,n,r){if(!We)return;let t=(e.match(Lt)??[]).join("").toUpperCase(),o=(n.match(Lt)??[]).join("").toUpperCase(),c=(e.match(kt)??[]).length,m=(n.match(kt)??[]).length;if(t!==o){fe(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==m&&fe(`morphTo: coordinate count differs (${c} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function lt(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let m=parseFloat(c),i=t[o++]??m;return String(+(m+(i-m)*r).toFixed(4))})}function ct(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,o=r?{...xt[r],...t}:t,c=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:i=1,fade:u=false,easing:h="linear",trigger:S={},stagger:V=0,direction:x="forward",once:me=false,debug:je=false,axis:K="y",scrollContainer:Me,autoReverse:Te=false,delay:he=0,strokeColor:ne,strokeWidth:pe,fillOpacity:J,waypoints:oe,velocityScale:be=false,threshold:Fe=0,rootMargin:X="0px",repeat:C=0,repeatDelay:_e=0,morphTo:z,clip:ke,autoplay:He=false,duration:Ue=1e3,native:rt=true,onProgress:$e,onStart:B,onComplete:W,onEnter:se,onLeave:Ae,onEnterBack:ie,onLeaveBack:de}=o,_=ke===true?"left":typeof ke=="string"?ke:false,Y=typeof h=="function"?h:xe[h]??xe.linear,ae=Ie(S.start??"top bottom"),Le=Ie(S.end??"bottom top"),j=typeof Me=="string"?document.querySelector(Me):Me??null,U=Array.isArray(ne)?ne[0]:null,O=Array.isArray(ne)?ne[1]:typeof ne=="string"?ne:null,R=Array.isArray(pe)?pe[0]:null,M=Array.isArray(pe)?pe[1]:typeof pe=="number"?pe:null,H=Array.isArray(J)?J[0]:null,D=Array.isArray(J)?J[1]:typeof J=="number"?J:null;function le(s){let l=s*100;switch(_){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let T=_?[]:Array.from(e.querySelectorAll(m)),b=[],a=[],f=0,q=0,v=false,$=false,A=0,ee=false,Q=-1,I=[],we=-1,k=false,ce=0,ge=0,ve,nt=null;function ft(){nt?.destroy(),nt=null;}let Ee=new Set,mt=NaN,Se=true,Xe=-1,pt=performance.now(),De=NaN;function ot(){return j?K==="x"?j.scrollLeft:j.scrollTop:K==="x"?window.scrollX:window.scrollY}function dt(){return j?K==="x"?j.clientWidth:j.clientHeight:K==="x"?window.innerWidth:window.innerHeight}function gt(){let s=et(e,j,K);return Ce(s,s.scroll,dt(),ae,Le)}function yt(){(({tStart:f,tEnd:q}=gt())),je&&We&&(ft(),nt=Xt(f,q,K));}function st(s,l=gt){qe(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:l});let g=s.destroy;return s.destroy=()=>{g.call(s),Ge(e);},s}function Rt(s,l){if(e.style.setProperty("--scroll-draw-progress",String(s)),_){let g=l==="reverse"?1-s:s;e.style.clipPath=le(g);return}T.forEach((g,N)=>{g.style.strokeDashoffset=l==="reverse"?`${b[N]*s}`:`${b[N]*(1-s)}`,u&&(g.style.opacity=l==="reverse"?`${1-s}`:`${s}`),U&&O?g.style.stroke=Re(U,O,s):O&&(g.style.stroke=O),R!==null&&M!==null?g.style.strokeWidth=`${R+(M-R)*s}`:M!==null&&(g.style.strokeWidth=`${M}`),H!==null&&D!==null?g.style.fillOpacity=`${H+(D-H)*s}`:D!==null&&(g.style.fillOpacity=`${D}`),z&&g.tagName.toLowerCase()==="path"&&a[N]&&g.setAttribute("d",lt(a[N],z,s));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),_){e.style.clipPath=le(0);return}T.forEach((s,l)=>{s.style.strokeDasharray=`${b[l]}`,s.style.strokeDashoffset=x==="reverse"?"0":`${b[l]}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",U&&(s.style.stroke=U),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`),z&&s.tagName.toLowerCase()==="path"&&a[l]&&s.setAttribute("d",a[l]);});}if(T.forEach(s=>{Ut(s);let l=Oe(s);b.push(l);let g=s.tagName.toLowerCase()==="path";g?a.push(s.getAttribute("d")??""):a.push(""),z&&(g?Yt(a[a.length-1],z,s):fe(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),c?(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?`${l}`:"0",u&&(s.style.opacity="1"),O&&(s.style.stroke=O),M!==null&&(s.style.strokeWidth=`${M}`),D!==null&&(s.style.fillOpacity=`${D}`),z&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",z)):(s.style.strokeDasharray=`${l}`,s.style.strokeDashoffset=x==="reverse"?"0":`${l}`,u?s.style.opacity=x==="reverse"?"1":"0":s.style.opacity="",U&&(s.style.stroke=U),R!==null&&(s.style.strokeWidth=`${R}`),H!==null&&(s.style.fillOpacity=`${H}`));}),_){if(c)return e.style.clipPath=le(1),W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(c)return W?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof h=="string"?tt(h):null;function Nt(){return !(rt===false||!jt()||!T.length||!ht||_||K!=="y"||j||i!==1||V!==0||me||Te||be!==false||z||oe||C||he>0||$e||B||W||se||Ae||ie||de||ne!=null||pe!=null||J!=null||(S.start??"top bottom").trim()!=="top bottom"||(S.end??"bottom top").trim()!=="bottom top")}function Ft(){let s=++Bt,l=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,N=`--svg-scroll-draw-${s}`,ye=x==="reverse"?"0":"var(--ssd-len)",ue=x==="reverse"?"var(--ssd-len)":"0",te=`stroke-dashoffset:${ye};`,y=`stroke-dashoffset:${ue};`;u&&(te+=`opacity:${x==="reverse"?1:0};`,y+=`opacity:${x==="reverse"?0:1};`);let w=document.createElement("style");w.setAttribute("data-svg-scroll-draw",""),w.textContent=`@keyframes ${l}{from{${te}}to{${y}}}.${g}{view-timeline-name:${N};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${N};animation-range:cover 0% cover 100%;}`,document.head.appendChild(w),e.classList.add(g);function F(p,L){p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(l);}T.forEach(F);let d=false,E=-1;function P(){if(E>=0)return E;let p=e.getBoundingClientRect(),{tStart:L,tEnd:Z}=Ce({top:p.top,height:p.height},ot(),dt(),ae,Le);return Y(re(ot(),L,Z,i))}return {destroy(){e.classList.remove(g),T.forEach(p=>{p.classList.remove(l),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),w.remove();},replay(){d=false,E=-1,T.forEach(F);},pause(){d=true,T.forEach(p=>{p.style.animationPlayState="paused";});},resume(){d&&(d=false,T.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let L=Math.min(1,Math.max(0,p));E=L,d=true,T.forEach((Z,G)=>{Z.classList.remove(l),Z.style.strokeDashoffset=x==="reverse"?`${b[G]*L}`:`${b[G]*(1-L)}`,u&&(Z.style.opacity=x==="reverse"?`${1-L}`:`${L}`);});},getProgress(){return P()},refresh(){T.forEach((p,L)=>{b[L]=Oe(p),p.style.setProperty("--ssd-len",String(b[L])),p.style.strokeDasharray=`${b[L]}`;});}}}if(Nt())return st(Ft());function _t(){let s=Math.max(1,Ue),l=0,g=0,N=false;function ye(d){let E=true;if(_){let P=Math.min(1,Math.max(0,d/s)),p=Y(P);ce=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=le(x==="reverse"?1-p:p),$e?.(p),P<1&&(E=false);}else T.forEach((P,p)=>{let L=p*V*s,Z=Math.min(1,Math.max(0,(d-L)/s)),G=Y(Z);P.style.strokeDashoffset=x==="reverse"?`${b[p]*G}`:`${b[p]*(1-G)}`,u&&(P.style.opacity=x==="reverse"?`${1-G}`:`${G}`),U&&O?P.style.stroke=Re(U,O,G):O&&(P.style.stroke=O),R!==null&&M!==null?P.style.strokeWidth=`${R+(M-R)*G}`:M!==null&&(P.style.strokeWidth=`${M}`),H!==null&&D!==null?P.style.fillOpacity=`${H+(D-H)*G}`:D!==null&&(P.style.fillOpacity=`${D}`),z&&P.tagName.toLowerCase()==="path"&&a[p]&&P.setAttribute("d",lt(a[p],z,G)),p===0&&(ce=G,$e?.(G),e.style.setProperty("--scroll-draw-progress",String(G))),Z<1&&(E=false);});if(oe){let P=Math.min(1,Math.max(0,d/s)),p=Y(P);for(let L in oe){let Z=parseFloat(L);p>=Z&&!Ee.has(Z)&&(Ee.add(Z),oe[L]?.());}}return E}function ue(d){if(k)return;let E=d-l;$||($=true,B?.());let P=ye(E);if(P&&!v){v=true,ye(s*(1+Math.max(0,T.length-1)*V)),W?.(),ge<(C==="infinite"?1/0:C??0)&&(ge++,ve=setTimeout(()=>{l=performance.now(),$=false,v=false,Ee.clear(),Ye(),A=requestAnimationFrame(ue);},_e));return}P||(A=requestAnimationFrame(ue));}function te(){cancelAnimationFrame(A),clearTimeout(ve),l=performance.now(),g=0,k=false,$=false,v=false,ge=0,N=true,ce=0,Ee.clear(),Ye(),A=requestAnimationFrame(ue);}let y=new IntersectionObserver(d=>{d.forEach(E=>{E.isIntersecting&&!(me&&v)?te():!E.isIntersecting&&!me&&!v&&(cancelAnimationFrame(A),clearTimeout(ve),N=false);});},{root:j??null,threshold:Fe,rootMargin:X}),w;function F(){clearTimeout(w),w=setTimeout(()=>{T.forEach((d,E)=>{b[E]=Oe(d),d.style.strokeDasharray=`${b[E]}`;});},150);}return window.addEventListener("resize",F),window.addEventListener("orientationchange",F),he>0?setTimeout(()=>y.observe(e),he):y.observe(e),{destroy(){cancelAnimationFrame(A),clearTimeout(ve),y.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),clearTimeout(w);},replay(){ge=0,te();},pause(){k||!N||(k=true,g=performance.now()-l,cancelAnimationFrame(A));},resume(){k&&(k=false,N=true,l=performance.now()-g,A=requestAnimationFrame(ue));},seek(d){let E=Math.min(1,Math.max(0,d));ce=E,k=true,g=E*s,l=performance.now()-g,cancelAnimationFrame(A),ye(g);},getProgress(){return ce},refresh(){clearTimeout(w),T.forEach((d,E)=>{b[E]=Oe(d),d.style.strokeDasharray=`${b[E]}`;});}}}if(He)return st(_t());yt();function Qe(){if(!ee||k)return;let s=performance.now(),l=ot();if(!Se&&be===false&&l===mt){A=requestAnimationFrame(Qe);return}Se=false,mt=l;let g=i;if(be!==false){let y=s-pt,w=y>0?Math.abs(l-(Xe<0?l:Xe))/y:0;g=i*Math.max(.2,1+w*(typeof be=="number"?be:1)*.04);}Xe=l,pt=s;let N=Te?we===-1||l>=we?"forward":"reverse":x;we=l;let ye=q-f,ue=true,te=ye===0?0:(l-f)/ye;if(isNaN(De)||(De<=0&&te>0?se?.():De>0&&te<=0&&de?.(),De<1&&te>=1?Ae?.():De>=1&&te<1&&ie?.()),De=te,_){let y=Y(re(l,f,q,g));me&&!Te&&(Q=Math.max(Q,y),y=Q),ce=y,e.style.setProperty("--scroll-draw-progress",String(y));let w=N==="reverse"?1-y:y;e.style.clipPath=le(w),$e?.(y),!$&&re(l,f,q,g)>0&&($=true,B?.()),y>=1&&!v?(v=true,W?.(),ge<(C==="infinite"?1/0:C??0)&&(ge++,ve=setTimeout(()=>{Q=-1,$=false,v=false,e.style.clipPath=le(0);},_e))):y<1&&!me&&(v=false),A=requestAnimationFrame(Qe);return}if(T.forEach((y,w)=>{let F=w*V*ye,d=Y(re(l,f+F,q+F,g));me&&!Te&&(d=I[w]=Math.max(I[w]??Q,d)),ce=d,y.style.strokeDashoffset=N==="reverse"?`${b[w]*d}`:`${b[w]*(1-d)}`,u&&(y.style.opacity=N==="reverse"?`${1-d}`:`${d}`),U&&O?y.style.stroke=Re(U,O,d):O&&(y.style.stroke=O),R!==null&&M!==null?y.style.strokeWidth=`${R+(M-R)*d}`:M!==null&&(y.style.strokeWidth=`${M}`),H!==null&&D!==null?y.style.fillOpacity=`${H+(D-H)*d}`:D!==null&&(y.style.fillOpacity=`${D}`),z&&y.tagName.toLowerCase()==="path"&&a[w]&&y.setAttribute("d",lt(a[w],z,d)),w===0&&($e?.(d),e.style.setProperty("--scroll-draw-progress",String(d))),d<1&&(ue=false);}),oe){let y=Y(re(l,f,q,g));for(let w in oe){let F=parseFloat(w);y>=F&&!Ee.has(F)&&(Ee.add(F),oe[w]?.());}}!$&&re(l,f,q,g)>0&&($=true,B?.()),ue&&!v?(v=true,W?.(),ge<(C==="infinite"?1/0:C??0)&&(ge++,ve=setTimeout(()=>{Q=-1,I=[],$=false,v=false,Ee.clear(),Ye(),Se=true;},_e))):!ue&&!me&&(v=false),A=requestAnimationFrame(Qe);}let it=false;function Ze(){it||(it=true,A=requestAnimationFrame(function(){Qe();}));}function Ke(){it=false,cancelAnimationFrame(A);}let at=new IntersectionObserver(s=>{s.forEach(l=>{ee=l.isIntersecting,ee&&!k?(Se=true,Ze()):Ke();});},{root:j??null,threshold:Fe,rootMargin:X});function bt(){T.forEach((s,l)=>{b[l]=Oe(s),s.style.strokeDasharray=`${b[l]}`;}),yt(),Se=true;}let Je;function Ve(){clearTimeout(Je),Je=setTimeout(bt,150);}window.addEventListener("resize",Ve),window.addEventListener("orientationchange",Ve);let ze;return typeof ResizeObserver<"u"&&(ze=new ResizeObserver(()=>Ve()),ze.observe(document.body),ze.observe(document.documentElement),ze.observe(e)),he>0?setTimeout(()=>at.observe(e),he):at.observe(e),st({destroy(){cancelAnimationFrame(A),clearTimeout(ve),Ke(),at.disconnect(),ze?.disconnect(),window.removeEventListener("resize",Ve),window.removeEventListener("orientationchange",Ve),clearTimeout(Je),ft();},replay(){Q=-1,I=[],we=-1,Xe=-1,$=false,v=false,ge=0,k=false,ce=0,Ee.clear(),clearTimeout(ve),Ye(),Se=true,ee&&Ze();},pause(){k=true,Ke();},resume(){k&&(k=false,Se=true,ee&&Ze());},seek(s){let l=Math.min(1,Math.max(0,s));ce=l,Q=l,I=[],k=true,Ke(),Rt(l,x),Se=true;},getProgress(){return ce},refresh(){clearTimeout(Je),bt(),ee&&!k&&Ze();}},()=>({tStart:f,tEnd:q}))}function Qt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Dt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],m=t[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let u=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),c.push(u?u[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function Zt(e,n,r){let t=Dt(e),o=Dt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,m)=>{let i=o[m];return c.fn!==i.fn||c.nums.length!==i.nums.length?r<1?`${c.fn}(${c.nums.map((u,h)=>`${u}${c.units[h]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,h)=>`${u}${i.units[h]}`).join(", ")})`:`${c.fn}(${c.nums.map((u,h)=>`${u+(i.nums[h]-u)*r}${c.units[h]}`).join(", ")})`}).join(" ")}function ut(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(Qt(t))return Re(t,o,r);if(t.includes("("))return Zt(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),m=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&m){let i=parseFloat(c[1]),u=parseFloat(m[1]);return `${i+(u-i)*r}${c[2]||m[2]}`}return r<1?t:o}function Kt(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Jt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),er=0,It="--scroll-draw-progress";function tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Ne(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:o={},easing:c="ease-out",speed:m=1,once:i=false,axis:u="y",scrollContainer:h,native:S=true,velocityScale:V=false,respectReducedMotion:x=true,triggerElement:me,onProgress:je,onComplete:K,onEnter:Me,onLeave:Te,onEnterBack:he,onLeaveBack:ne}=n,pe=x&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=typeof c=="function"?c:xe[c]??xe["ease-out"],oe=Ie(o.start??"top bottom"),be=Ie(o.end??"bottom top"),Fe=me??e,X=typeof h=="string"?document.querySelector(h):h??null,C=Object.entries(t).map(([a,f])=>({prop:Kt(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function _e(){let a=window.getComputedStyle(e);for(let f of C)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function z(){for(let a of C)e.style.setProperty(a.prop,String(a.to));}let ke=new Map;for(let a of [...C.map(f=>f.prop),It])ke.set(a,e.style.getPropertyValue(a));function He(){for(let[a,f]of ke)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(pe)return z(),K?.(),{...r,destroy:He,getProgress:()=>1};_e();let Ue=typeof c=="string"?tt(c):null;function rt(){if(!S||!tr()||!Ue||u!=="y"||X||Fe!==e||i||m!==1||je||K||Me||Te||he||ne||V!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let a of C)if(!Jt.has(a.prop))return false;return true}function $e(){let a=`ssd-a-${++er}`,f=C.map(I=>`${I.prop}:${I.from}`).join(";"),q=C.map(I=>`${I.prop}:${I.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${a}{from{${f}}to{${q}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),e.classList.add(a);let $=()=>u==="x"?window.scrollX:window.scrollY,A=()=>u==="x"?window.innerWidth:window.innerHeight,ee=()=>{let I=e.getBoundingClientRect();return Ce({top:I.top,height:I.height},$(),A(),oe,be)};qe(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:ee});let Q={destroy(){e.classList.remove(a),v.remove(),e.style.animationPlayState="",He(),Ge(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let we=Math.min(1,Math.max(0,I));e.classList.remove(a);for(let k of C)e.style.setProperty(k.prop,ut(k.from,k.to,we));},getProgress(){let{tStart:I,tEnd:we}=ee();return J(re($(),I,we,m))}};return Q}if(rt())return $e();let B=0,W=0,se=0,Ae=false,ie=false,de=-1,_=0,Y=false,ae=NaN,Le=-1,j=0,U=()=>X?u==="x"?X.scrollLeft:X.scrollTop:u==="x"?window.scrollX:window.scrollY,O=()=>X?u==="x"?X.clientWidth:X.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function R(){let a=et(Fe,X,u),f=Ce(a,a.scroll,O(),oe,be);B=f.tStart,W=f.tEnd;}function M(a){e.style.setProperty(It,String(a));for(let f of C)e.style.setProperty(f.prop,ut(f.from,f.to,a));je?.(a);}function H(a){if(isNaN(ae)){ae=a;return}ae<=0&&a>0?Me?.():ae>0&&a<=0&&ne?.(),ae<1&&a>=1?Te?.():ae>=1&&a<1&&he?.(),ae=a;}function D(){if(!Ae||ie)return;let a=performance.now(),f=U(),q=m;if(V!==false){let A=a-j,ee=A>0?Math.abs(f-(Le<0?f:Le))/A:0;q=m*Math.max(.2,1+ee*(typeof V=="number"?V:1)*.04);}Le=f,j=a;let v=W===B?0:(f-B)/(W-B);H(v);let $=J(re(f,B,W,q));i&&(de=Math.max(de,$),$=de),_=$,M($),$>=1&&!Y?(Y=true,K?.()):$<1&&!i&&(Y=false),se=requestAnimationFrame(D);}R(),W===B&&fe("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let a=J(re(U(),B,W,m));i&&a>0&&(de=a),_=a,M(a);}let le=new IntersectionObserver(a=>{a.forEach(f=>{Ae=f.isIntersecting,Ae&&!ie?se=requestAnimationFrame(D):cancelAnimationFrame(se);});},{root:X??null}),T;function b(){clearTimeout(T),T=setTimeout(R,150);}return window.addEventListener("resize",b),window.addEventListener("orientationchange",b),le.observe(e),qe(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:B,tEnd:W})}),{destroy(){cancelAnimationFrame(se),le.disconnect(),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),clearTimeout(T),He(),Ge(e);},replay(){de=-1,Y=false,_=0,ie=false,M(0);},pause(){ie=true,cancelAnimationFrame(se);},resume(){ie&&(ie=false,Ae&&(se=requestAnimationFrame(D)));},seek(a){let f=Math.min(1,Math.max(0,a));_=f,de=f,ie=true,cancelAnimationFrame(se),M(f);},getProgress(){return _}}}var Ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ot(e,n={}){if(typeof window>"u")return Ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return fe("scrollParallax: element not found:",e),Ct;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:m,onProgress:i}=n,u=r.getBoundingClientRect(),h=o==="x"?u.width:u.height,S=t*h;return Ne(r,{props:o==="x"?{transform:["translateX(0px)",`translateX(${-S}px)`]}:{transform:["translateY(0px)",`translateY(${-S}px)`]},trigger:m??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:i})}function Be(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var Pe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function _r(e,n={}){if(typeof window>"u")return Pe;let r=Be(e).map(t=>ct(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function Hr(e,n={}){if(typeof window>"u")return Pe;let r=Be(e);if(r.length===0)return Pe;let t=0,o=[];function c(i){return ct(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function Vr(e,n){if(typeof window>"u")return Pe;let r=Be(e).map(t=>Ne(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function zr(e,n){if(typeof window>"u")return Pe;let r=Be(e);if(r.length===0)return Pe;let t=0,o=[];function c(i){return Ne(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function m(){r.forEach((i,u)=>{o[u]=c(u);});for(let i=1;i<o.length;i++)o[i].pause();}return m(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,m();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function Wr(e,n={}){if(typeof window>"u")return Pe;let r=Be(e).map(t=>Ot(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}exports.scrollAnimateGroup=Vr;exports.scrollAnimateSequence=zr;exports.scrollDrawGroup=_r;exports.scrollDrawSequence=Hr;exports.scrollParallaxGroup=Wr;
|
package/dist/group/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1}from'../chunk-KBFWDHF4.mjs';import {a as a$1}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-
|
|
1
|
+
import {b as b$1}from'../chunk-KBFWDHF4.mjs';import {a as a$1}from'../chunk-QJ4H2HW3.mjs';import {b}from'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function u(s){return s.map(o=>typeof o=="string"?document.querySelector(o):o).filter(o=>o!==null)}var a={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function y(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function E(s,o={}){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return b(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function d(s,o){if(typeof window>"u")return a;let r=u(s).map(e=>a$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function w(s,o){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return a$1(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function S(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}export{d as scrollAnimateGroup,w as scrollAnimateSequence,y as scrollDrawGroup,E as scrollDrawSequence,S as scrollParallaxGroup};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function Wt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function St({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),l=Math.sqrt(n),a=0,d=[];for(let f=0;f<t;f++){let x=Math.pow(l,f);d.push(x),a+=x;}let m=[0],c=0;for(let f=0;f<t;f++)c+=d[f]/a,m.push(c);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let x=0;x<t;x++)if(f<=m[x+1]){let I=(f-m[x])/(m[x+1]-m[x]);if(x===0)return I*(2-I);let A=1-Math.pow(n,x);return A+(1-A)*(2*I-1)*(2*I-1)}return 1}}function Et({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),l=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-l)*(2*Math.PI)/n)+1}var K={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:St(),elastic:Et()};function xt(e,r,t){return Math.min(t,Math.max(r,e))}function $e(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function Tt(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function At(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function ie(e,r,t,n){return t===r?0:xt((e-r)/(t-r)*n,0,1)}function Ne(e,r,t,n,l){let a=Tt(e.top,e.height,r,n.element)-At(n.viewport,t),d=Tt(e.top,e.height,r,l.element)-At(l.viewport,t);return {tStart:a,tEnd:d}}function Ke(e,r,t){let n=e.getBoundingClientRect(),l=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left+r.scrollLeft:n.top-r.getBoundingClientRect().top+r.scrollTop,height:l,scroll:0}:{top:t==="x"?n.left:n.top,height:l,scroll:t==="x"?window.scrollX:window.scrollY}}function ze(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function $t(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function qe(e,r,t){let n=$t(e),l=$t(r);return !n||!l?e:`rgb(${Math.round(n[0]+(l[0]-n[0])*t)},${Math.round(n[1]+(l[1]-n[1])*t)},${Math.round(n[2]+(l[2]-n[2])*t)})`}var at={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 Ge=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function j(e,...r){Ge&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Bt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Yt(e){let r=[];for(let t=0;t<Mt;t++){let n=t/(Mt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function Je(e){switch(e){case "linear":return "linear";case "ease-in":return Bt;case "ease-out":return Gt;case "ease-in-out":return jt()?Yt(K["ease-in-out"]):null;default:return null}}var Pt=Symbol.for("svg-scroll-draw.registry");function kt(){let e=globalThis;return e[Pt]||(e[Pt]=new Map)}function Me(e,r){kt().set(e,r);}function Pe(e){kt().delete(e);}var Ut=0;function Xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Lt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Ct=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Qt(e){if(!Ge)return;let r=Lt(e,"stroke");if(!r||r==="none"){j("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Ct.has(t)&&!Ct.has(Lt(e,"fill"))&&j("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Zt(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let a=t==="x"?window.scrollX:window.scrollY,d=e-a,m=r-a,c=t==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${c?`left:${d}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${d}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",l,{passive:true}),l(),{el:n,destroy(){window.removeEventListener("scroll",l),n.remove();}}}var Ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Zt(e,r,t){if(!Be)return;let n=(e.match(Dt)??[]).join("").toUpperCase(),l=(r.match(Dt)??[]).join("").toUpperCase(),a=(e.match(Ct)??[]).length,d=(r.match(Ct)??[]).length;if(n!==l){j(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}a!==d&&j(`morphTo: coordinate count differs (${a} \u2192 ${d}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function at(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let d=parseFloat(a),m=n[l++]??d;return String(+(d+(m-d)*t).toFixed(4))})}function It(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,l=t?{...it[t],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:x={},stagger:I=0,direction:A="forward",once:J=false,debug:Ee=false,axis:S="y",scrollContainer:$,autoReverse:g=false,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:B,velocityScale:ee=false,threshold:ge=0,rootMargin:Y="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ye,autoplay:Le=false,duration:Ce=1e3,native:De=true,onProgress:w,onStart:P,onComplete:ne,onEnter:he,onLeave:Ne,onEnterBack:be,onLeaveBack:xe}=l,te=ye===true?"left":typeof ye=="string"?ye:false,me=typeof f=="function"?f:K[f]??K.linear,we=$e(x.start??"top bottom"),He=$e(x.end??"bottom top"),ce=typeof $=="string"?document.querySelector($):$??null,ue=Array.isArray(b)?b[0]:null,U=Array.isArray(b)?b[1]:typeof b=="string"?b:null,X=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function ve(o){let i=o*100;switch(te){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let C=te?[]:Array.from(e.querySelectorAll(d)),T=[],s=[],u=0,oe=0,k=false,D=false,O=0,pe=false,se=-1,G=-1,_=false,ie=0,Te=0,Ie,tt=null;function ft(){tt?.destroy(),tt=null;}let Oe=new Set,pt=NaN,Re=true,Ge=-1,dt=performance.now(),_e=NaN;function rt(){return ce?S==="x"?ce.scrollLeft:ce.scrollTop:S==="x"?window.scrollX:window.scrollY}function gt(){return ce?S==="x"?ce.clientWidth:ce.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function yt(){let o=Ze(e,ce,S);return Fe(o,o.scroll,gt(),we,He)}function ht(){(({tStart:u,tEnd:oe}=yt())),Ee&&Be&&(ft(),tt=Qt(u,oe,S));}function nt(o,i=yt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e);},o}function Ht(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=i==="reverse"?1-o:o;e.style.clipPath=ve(h);return}C.forEach((h,Q)=>{h.style.strokeDashoffset=i==="reverse"?`${T[Q]*o}`:`${T[Q]*(1-o)}`,c&&(h.style.opacity=i==="reverse"?`${1-o}`:`${o}`),ue&&U?h.style.stroke=ze(ue,U,o):U&&(h.style.stroke=U),X!==null&&H!==null?h.style.strokeWidth=`${X+(H-X)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[Q]&&h.setAttribute("d",at(s[Q],N,o));});}function je(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=ve(0);return}C.forEach((o,i)=>{o.style.strokeDasharray=`${T[i]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[i]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[i]&&o.setAttribute("d",s[i]);});}if(C.forEach(o=>{Xt(o);let i=Ve(o);T.push(i);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?Zt(s[s.length-1],N,o):j(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),U&&(o.style.stroke=U),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?"0":`${i}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",ue&&(o.style.stroke=ue),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(a)return e.style.clipPath=ve(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ve(0);}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let bt=typeof f=="string"?Ke(f):null;function _t(){return !(De===false||!Ut()||!C.length||!bt||te||S!=="y"||ce||m!==1||I!==0||J||g||ee!==false||N||B||q||E>0||w||P||ne||he||Ne||be||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Vt(){let o=++Yt,i=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",de=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(de+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${i}{from{${de}}to{${v}}}.${h}{view-timeline-name:${Q};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${bt};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Z(p,V){p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(i);}C.forEach(Z);let y=false,L=-1;function R(){if(L>=0)return L;let p=e.getBoundingClientRect(),{tStart:V,tEnd:fe}=Fe({top:p.top,height:p.height},rt(),gt(),we,He);return me(le(rt(),V,fe,m))}return {destroy(){e.classList.remove(h),C.forEach(p=>{p.classList.remove(i),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),M.remove();},replay(){y=false,L=-1,C.forEach(Z);},pause(){y=true,C.forEach(p=>{p.style.animationPlayState="paused";});},resume(){y&&(y=false,C.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));L=V,y=true,C.forEach((fe,ae)=>{fe.classList.remove(i),fe.style.strokeDashoffset=A==="reverse"?`${T[ae]*V}`:`${T[ae]*(1-V)}`,c&&(fe.style.opacity=A==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return R()},refresh(){C.forEach((p,V)=>{T[V]=Ve(p),p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`;});}}}if(_t())return nt(Vt());function zt(){let o=Math.max(1,Ce),i=0,h=0,Q=false;function Ae(y){let L=true;if(te){let R=Math.min(1,Math.max(0,y/o)),p=me(R);ie=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=ve(A==="reverse"?1-p:p),w?.(p),R<1&&(L=false);}else C.forEach((R,p)=>{let V=p*I*o,fe=Math.min(1,Math.max(0,(y-V)/o)),ae=me(fe);R.style.strokeDashoffset=A==="reverse"?`${T[p]*ae}`:`${T[p]*(1-ae)}`,c&&(R.style.opacity=A==="reverse"?`${1-ae}`:`${ae}`),ue&&U?R.style.stroke=ze(ue,U,ae):U&&(R.style.stroke=U),X!==null&&H!==null?R.style.strokeWidth=`${X+(H-X)*ae}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*ae}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[p]&&R.setAttribute("d",at(s[p],N,ae)),p===0&&(ie=ae,w?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),fe<1&&(L=false);});if(B){let R=Math.min(1,Math.max(0,y/o)),p=me(R);for(let V in B){let fe=parseFloat(V);p>=fe&&!Oe.has(fe)&&(Oe.add(fe),B[V]?.());}}return L}function Se(y){if(_)return;let L=y-i;D||(D=true,P?.());let R=Ae(L);if(R&&!k){k=true,Ae(o*(1+Math.max(0,C.length-1)*I)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{i=performance.now(),D=false,k=false,Oe.clear(),je(),O=requestAnimationFrame(Se);},ke));return}R||(O=requestAnimationFrame(Se));}function de(){cancelAnimationFrame(O),clearTimeout(Ie),i=performance.now(),h=0,_=false,D=false,k=false,Te=0,Q=true,ie=0,Oe.clear(),je(),O=requestAnimationFrame(Se);}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?de():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(Ie),Q=false);});},{root:ce??null,threshold:ge,rootMargin:Y}),M;function Z(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Ie),v.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(M);},replay(){Te=0,de();},pause(){_||!Q||(_=true,h=performance.now()-i,cancelAnimationFrame(O));},resume(){_&&(_=false,Q=true,i=performance.now()-h,O=requestAnimationFrame(Se));},seek(y){let L=Math.min(1,Math.max(0,y));ie=L,_=true,h=L*o,i=performance.now()-h,cancelAnimationFrame(O),Ae(h);},getProgress(){return ie},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=Ve(y),y.style.strokeDasharray=`${T[L]}`;});}}}if(Le)return nt(zt());ht();function Ye(){if(!pe||_)return;let o=performance.now(),i=rt();if(!Re&&ee===false&&i===pt){O=requestAnimationFrame(Ye);return}Re=false,pt=i;let h=m;if(ee!==false){let v=o-dt,M=v>0?Math.abs(i-(Ge<0?i:Ge))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04);}Ge=i,dt=o;let Q=g?G===-1||i>=G?"forward":"reverse":A;G=i;let Ae=oe-u,Se=true,de=Ae===0?0:(i-u)/Ae;if(isNaN(_e)||(_e<=0&&de>0?he?.():_e>0&&de<=0&&xe?.(),_e<1&&de>=1?Ne?.():_e>=1&&de<1&&be?.()),_e=de,te){let v=me(le(i,u,oe,h));J&&!g&&(se=Math.max(se,v),v=se),ie=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=Q==="reverse"?1-v:v;e.style.clipPath=ve(M),w?.(v),!D&&le(i,u,oe,h)>0&&(D=true,P?.()),v>=1&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=false,k=false,e.style.clipPath=ve(0);},ke))):v<1&&!J&&(k=false),O=requestAnimationFrame(Ye);return}if(C.forEach((v,M)=>{let Z=M*I*Ae,y=me(le(i,u+Z,oe+Z,h));J&&!g&&(se=Math.max(se,y),y=se),ie=y,v.style.strokeDashoffset=Q==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=Q==="reverse"?`${1-y}`:`${y}`),ue&&U?v.style.stroke=ze(ue,U,y):U&&(v.style.stroke=U),X!==null&&H!==null?v.style.strokeWidth=`${X+(H-X)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",at(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=false);}),B){let v=me(le(i,u,oe,h));for(let M in B){let Z=parseFloat(M);v>=Z&&!Oe.has(Z)&&(Oe.add(Z),B[M]?.());}}!D&&le(i,u,oe,h)>0&&(D=true,P?.()),Se&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Ie=setTimeout(()=>{se=-1,D=false,k=false,Oe.clear(),je(),Re=true;},ke))):!Se&&!J&&(k=false),O=requestAnimationFrame(Ye);}let ot=false;function Ue(){ot||(ot=true,O=requestAnimationFrame(function(){Ye();}));}function Xe(){ot=false,cancelAnimationFrame(O);}let st=new IntersectionObserver(o=>{o.forEach(i=>{pe=i.isIntersecting,pe&&!_?(Re=true,Ue()):Xe();});},{root:ce??null,threshold:ge,rootMargin:Y});function wt(){C.forEach((o,i)=>{T[i]=Ve(o),o.style.strokeDasharray=`${T[i]}`;}),ht(),Re=true;}let Qe;function qe(){clearTimeout(Qe),Qe=setTimeout(wt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),E>0?setTimeout(()=>st.observe(e),E):st.observe(e),nt({destroy(){cancelAnimationFrame(O),clearTimeout(Ie),Xe(),st.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Qe),ft();},replay(){se=-1,G=-1,Ge=-1,D=false,k=false,Te=0,_=false,ie=0,Oe.clear(),clearTimeout(Ie),je(),Re=true,pe&&Ue();},pause(){_=true,Xe();},resume(){_&&(_=false,Re=true,pe&&Ue());},seek(o){let i=Math.min(1,Math.max(0,o));ie=i,se=i,_=true,Xe(),Ht(i,A),Re=true;},getProgress(){return ie},refresh(){clearTimeout(Qe),wt(),pe&&!_&&Ue();}},()=>({tStart:u,tEnd:oe}))}function Kt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?It(n,r):(j("Container not found:",e),t)}function Jt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ot(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let l=[],a=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"");}r.push({fn:n[1],nums:l,units:a});}return r}function er(e,r,t){let n=Ot(e),l=Ot(r);return n.length===0||n.length!==l.length?t<1?e:r:n.map((a,d)=>{let m=l[d];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((c,f)=>`${c}${a.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,f)=>`${c+(m.nums[f]-c)*t}${a.units[f]}`).join(", ")})`}).join(" ")}function Rt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),l=String(r);if(Jt(n))return ze(n,l,t);if(n.includes("("))return er(n,l,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),d=l.match(/^([-+]?[\d.]+)(.*)$/);if(a&&d){let m=parseFloat(a[1]),c=parseFloat(d[1]);return `${m+(c-m)*t}${a[2]||d[2]}`}return t<1?n:l}function tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,Ft="--scroll-draw-progress";function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function lt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:l={},easing:a="ease-out",speed:d=1,once:m=false,axis:c="y",scrollContainer:f,native:x=true,velocityScale:I=false,respectReducedMotion:A=true,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=r,z=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:K[a]??K["ease-out"],B=$e(l.start??"top bottom"),ee=$e(l.end??"bottom top"),ge=J??e,Y=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([s,u])=>({prop:tr(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0");}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to));}let ye=new Map;for(let s of [...q.map(u=>u.prop),Ft])ye.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ye)u?e.style.setProperty(s,u):e.style.removeProperty(s);}if(z)return N(),S?.(),{...t,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Ke(a):null;function De(){if(!x||!or()||!Ce||c!=="y"||Y||ge!==e||m||d!==1||Ee||S||$||g||E||b||I!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let s of q)if(!rr.has(s.prop))return false;return true}function w(){let s=`ssd-a-${++nr}`,u=q.map(G=>`${G.prop}:${G.from}`).join(";"),oe=q.map(G=>`${G.prop}:${G.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,pe=()=>{let G=e.getBoundingClientRect();return Fe({top:G.top,height:G.height},D(),O(),B,ee)};Me(e,{type:"animate",getProgress:()=>se.getProgress(),getTrigger:pe});let se={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(G){let _=Math.min(1,Math.max(0,G));e.classList.remove(s);for(let ie of q)e.style.setProperty(ie.prop,Rt(ie.from,ie.to,_));},getProgress(){let{tStart:G,tEnd:_}=pe();return F(le(D(),G,_,d))}};return se}if(De())return w();let P=0,ne=0,he=0,Ne=false,be=false,xe=-1,te=0,me=false,we=NaN,He=-1,ce=0,ue=()=>Y?c==="x"?Y.scrollLeft:Y.scrollTop:c==="x"?window.scrollX:window.scrollY,U=()=>Y?c==="x"?Y.clientWidth:Y.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function X(){let s=Ze(ge,Y,c),u=Fe(s,s.scroll,U(),B,ee);P=u.tStart,ne=u.tEnd;}function H(s){e.style.setProperty(Ft,String(s));for(let u of q)e.style.setProperty(u.prop,Rt(u.from,u.to,s));Ee?.(s);}function re(s){if(isNaN(we)){we=s;return}we<=0&&s>0?$?.():we>0&&s<=0&&b?.(),we<1&&s>=1?g?.():we>=1&&s<1&&E?.(),we=s;}function W(){if(!Ne||be)return;let s=performance.now(),u=ue(),oe=d;if(I!==false){let O=s-ce,pe=O>0?Math.abs(u-(He<0?u:He))/O:0;oe=d*Math.max(.2,1+pe*(typeof I=="number"?I:1)*.04);}He=u,ce=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let D=F(le(u,P,ne,oe));m&&(xe=Math.max(xe,D),D=xe),te=D,H(D),D>=1&&!me?(me=true,S?.()):D<1&&!m&&(me=false),he=requestAnimationFrame(W);}X(),ne===P&&j("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let s=F(le(ue(),P,ne,d));m&&s>0&&(xe=s),te=s,H(s);}let ve=new IntersectionObserver(s=>{s.forEach(u=>{Ne=u.isIntersecting,Ne&&!be?he=requestAnimationFrame(W):cancelAnimationFrame(he);});},{root:Y??null}),C;function T(){clearTimeout(C),C=setTimeout(X,150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ve.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(he),ve.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e);},replay(){xe=-1,me=false,te=0,be=false,H(0);},pause(){be=true,cancelAnimationFrame(he);},resume(){be&&(be=false,Ne&&(he=requestAnimationFrame(W)));},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,be=true,cancelAnimationFrame(he),H(u);},getProgress(){return te}}}var Je={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function sr(e,r){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;return t?lt(t,r):(j("scrollAnimate: element not found:",e),Je)}function ir(e,r={}){if(typeof window>"u")return Je;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return j("scrollParallax: element not found:",e),Je;let{speed:n=.3,axis:l="y",easing:a="linear",trigger:d,onProgress:m}=r,c=t.getBoundingClientRect(),f=l==="x"?c.width:c.height,x=n*f;return lt(t,{props:l==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m})}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ar(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return j("scrollCounter: element not found:",e),ct;let n=t,{from:l=0,to:a,format:d,easing:m="ease-out",trigger:c={},once:f=true,decimals:x,onComplete:I}=r,A=x!==void 0?w=>w.toFixed(x):d??(w=>String(Math.round(w))),J=typeof m=="function"?m:K[m]??K["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),I?.(),ct;let g=0,E=0,b=0,z=false,F=false,B=-1,ee=0,ge=false,Y=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Fe({top:w.top,height:w.height},Y(),q(),Ee,S);g=P.tStart,E=P.tEnd;}function N(w){n.textContent=A(l+(a-l)*w),n.style.setProperty("--scroll-draw-progress",String(w));}function ye(){if(!z||F)return;let w=J(le(Y(),g,E,1));f&&(B=Math.max(B,w),w=B),ee=w,N(w),w>=1&&!ge?(ge=true,I?.()):w<1&&!f&&(ge=false),b=requestAnimationFrame(ye);}ke();{let w=J(le(Y(),g,E,1));f&&w>0&&(B=w),ee=w,N(w);}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ye):cancelAnimationFrame(b);});}),Ce;function De(){clearTimeout(Ce),Ce=setTimeout(ke,150);}return window.addEventListener("resize",De),window.addEventListener("orientationchange",De),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",De),window.removeEventListener("orientationchange",De),clearTimeout(Ce),Pe(n);},replay(){B=-1,ge=false,ee=0,F=false,N(0);},pause(){F=true,cancelAnimationFrame(b);},resume(){F&&(F=false,z&&(b=requestAnimationFrame(ye)));},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,B=P,F=true,cancelAnimationFrame(b),N(P);},getProgress(){return ee}}}var Nt="http://www.w3.org/2000/svg",lr="cinematic-photo",ut=e=>e<0?0:e>1?1:e;function et(e){let r=parseFloat(e);return Number.isFinite(r)?ut(r/100):0}function cr(e){return K[e]??K.linear}var ur={destroy:()=>{},getProgress:()=>0},mt=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||j("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return ur;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let l=[];for(let S of r.scenes){if(S.background){let g=document.createElement("img");g.id=lr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Nt,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(Nt,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),l.push({kind:"draw",el:b,start:et(E.start),end:et(E.end),ease:cr(E.easing),length:z});}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),l.push({kind:"fade",el:E,start:et(g.start),end:et(g.end),ease:K["ease-in-out"]??K.linear,from:g.from,to:g.to}));}}let a=0,d=()=>{let S=t.offsetHeight-window.innerHeight;return S<=0?t.getBoundingClientRect().top<=0?1:0:ut(-t.getBoundingClientRect().top/S)},m=S=>{for(let $ of l){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:ut((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,f=false,x=false,I=()=>{a=d(),m(a),f&&(c=requestAnimationFrame(I));},A=()=>{f||(f=true,c=requestAnimationFrame(I));},J=()=>{f=false,cancelAnimationFrame(c);},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J();},{threshold:0});return Ee.observe(n),a=d(),m(a),Me(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=t.getBoundingClientRect().top+window.scrollY;return {tStart:S,tEnd:S+Math.max(0,t.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(t);},getProgress:()=>a}}};
|
|
4
|
-
exports.Cinematic=
|
|
3
|
+
<div style="position:absolute;${c?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",l,{passive:true}),l(),{el:n,destroy(){window.removeEventListener("scroll",l),n.remove();}}}var Dt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,It=/[MmLlHhVvCcSsQqTtAaZz]/g;function Kt(e,r,t){if(!Ge)return;let n=(e.match(It)??[]).join("").toUpperCase(),l=(r.match(It)??[]).join("").toUpperCase(),a=(e.match(Dt)??[]).length,d=(r.match(Dt)??[]).length;if(n!==l){j(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}a!==d&&j(`morphTo: coordinate count differs (${a} \u2192 ${d}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function lt(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let d=parseFloat(a),m=n[l++]??d;return String(+(d+(m-d)*t).toFixed(4))})}function Ot(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:t,...n}=r,l=t?{...at[t],...n}:n,a=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:d="path, polyline, line, polygon, rect, circle",speed:m=1,fade:c=false,easing:f="linear",trigger:x={},stagger:I=0,direction:A="forward",once:J=false,debug:Ee=false,axis:S="y",scrollContainer:$,autoReverse:g=false,delay:E=0,strokeColor:b,strokeWidth:z,fillOpacity:F,waypoints:G,velocityScale:ee=false,threshold:de=0,rootMargin:Y="0px",repeat:q=0,repeatDelay:ke=0,morphTo:N,clip:ge,autoplay:Le=false,duration:Ce=1e3,native:De=true,onProgress:w,onStart:P,onComplete:ne,onEnter:ye,onLeave:He,onEnterBack:he,onLeaveBack:xe}=l,te=ge===true?"left":typeof ge=="string"?ge:false,ce=typeof f=="function"?f:K[f]??K.linear,be=$e(x.start??"top bottom"),_e=$e(x.end??"bottom top"),ae=typeof $=="string"?document.querySelector($):$??null,le=Array.isArray(b)?b[0]:null,U=Array.isArray(b)?b[1]:typeof b=="string"?b:null,X=Array.isArray(z)?z[0]:null,H=Array.isArray(z)?z[1]:typeof z=="number"?z:null,re=Array.isArray(F)?F[0]:null,W=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function we(o){let i=o*100;switch(te){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let C=te?[]:Array.from(e.querySelectorAll(d)),T=[],s=[],u=0,oe=0,k=false,D=false,O=0,fe=false,ue=-1,B=[],Ie=-1,_=false,ve=0,Te=0,Oe,rt=null;function pt(){rt?.destroy(),rt=null;}let Re=new Set,dt=NaN,Fe=true,je=-1,gt=performance.now(),Ve=NaN;function nt(){return ae?S==="x"?ae.scrollLeft:ae.scrollTop:S==="x"?window.scrollX:window.scrollY}function yt(){return ae?S==="x"?ae.clientWidth:ae.clientHeight:S==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Ke(e,ae,S);return Ne(o,o.scroll,yt(),be,_e)}function bt(){(({tStart:u,tEnd:oe}=ht())),Ee&&Ge&&(pt(),rt=Zt(u,oe,S));}function ot(o,i=ht){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let h=o.destroy;return o.destroy=()=>{h.call(o),Pe(e);},o}function _t(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),te){let h=i==="reverse"?1-o:o;e.style.clipPath=we(h);return}C.forEach((h,Q)=>{h.style.strokeDashoffset=i==="reverse"?`${T[Q]*o}`:`${T[Q]*(1-o)}`,c&&(h.style.opacity=i==="reverse"?`${1-o}`:`${o}`),le&&U?h.style.stroke=qe(le,U,o):U&&(h.style.stroke=U),X!==null&&H!==null?h.style.strokeWidth=`${X+(H-X)*o}`:H!==null&&(h.style.strokeWidth=`${H}`),re!==null&&W!==null?h.style.fillOpacity=`${re+(W-re)*o}`:W!==null&&(h.style.fillOpacity=`${W}`),N&&h.tagName.toLowerCase()==="path"&&s[Q]&&h.setAttribute("d",lt(s[Q],N,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),te){e.style.clipPath=we(0);return}C.forEach((o,i)=>{o.style.strokeDasharray=`${T[i]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${T[i]}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`),N&&o.tagName.toLowerCase()==="path"&&s[i]&&o.setAttribute("d",s[i]);});}if(C.forEach(o=>{Qt(o);let i=ze(o);T.push(i);let h=o.tagName.toLowerCase()==="path";h?s.push(o.getAttribute("d")??""):s.push(""),N&&(h?Kt(s[s.length-1],N,o):j(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),a?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?`${i}`:"0",c&&(o.style.opacity="1"),U&&(o.style.stroke=U),H!==null&&(o.style.strokeWidth=`${H}`),W!==null&&(o.style.fillOpacity=`${W}`),N&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",N)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=A==="reverse"?"0":`${i}`,c?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),X!==null&&(o.style.strokeWidth=`${X}`),re!==null&&(o.style.fillOpacity=`${re}`));}),te){if(a)return e.style.clipPath=we(1),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=we(0);}else if(a)return ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let wt=typeof f=="string"?Je(f):null;function Vt(){return !(De===false||!Xt()||!C.length||!wt||te||S!=="y"||ae||m!==1||I!==0||J||g||ee!==false||N||G||q||E>0||w||P||ne||ye||He||he||xe||b!=null||z!=null||F!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function zt(){let o=++Ut,i=`svg-scroll-draw-${o}`,h=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Ae=A==="reverse"?"0":"var(--ssd-len)",Se=A==="reverse"?"var(--ssd-len)":"0",pe=`stroke-dashoffset:${Ae};`,v=`stroke-dashoffset:${Se};`;c&&(pe+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let M=document.createElement("style");M.setAttribute("data-svg-scroll-draw",""),M.textContent=`@keyframes ${i}{from{${pe}}to{${v}}}.${h}{view-timeline-name:${Q};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${wt};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(h);function Z(p,V){p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`,p.style.strokeDashoffset="",p.style.opacity="",p.style.animationPlayState="",p.classList.add(i);}C.forEach(Z);let y=false,L=-1;function R(){if(L>=0)return L;let p=e.getBoundingClientRect(),{tStart:V,tEnd:me}=Ne({top:p.top,height:p.height},nt(),yt(),be,_e);return ce(ie(nt(),V,me,m))}return {destroy(){e.classList.remove(h),C.forEach(p=>{p.classList.remove(i),p.style.removeProperty("--ssd-len"),p.style.animationPlayState="";}),M.remove();},replay(){y=false,L=-1,C.forEach(Z);},pause(){y=true,C.forEach(p=>{p.style.animationPlayState="paused";});},resume(){y&&(y=false,C.forEach(p=>{p.style.animationPlayState="running";}));},seek(p){let V=Math.min(1,Math.max(0,p));L=V,y=true,C.forEach((me,se)=>{me.classList.remove(i),me.style.strokeDashoffset=A==="reverse"?`${T[se]*V}`:`${T[se]*(1-V)}`,c&&(me.style.opacity=A==="reverse"?`${1-V}`:`${V}`);});},getProgress(){return R()},refresh(){C.forEach((p,V)=>{T[V]=ze(p),p.style.setProperty("--ssd-len",String(T[V])),p.style.strokeDasharray=`${T[V]}`;});}}}if(Vt())return ot(zt());function qt(){let o=Math.max(1,Ce),i=0,h=0,Q=false;function Ae(y){let L=true;if(te){let R=Math.min(1,Math.max(0,y/o)),p=ce(R);ve=p,e.style.setProperty("--scroll-draw-progress",String(p)),e.style.clipPath=we(A==="reverse"?1-p:p),w?.(p),R<1&&(L=false);}else C.forEach((R,p)=>{let V=p*I*o,me=Math.min(1,Math.max(0,(y-V)/o)),se=ce(me);R.style.strokeDashoffset=A==="reverse"?`${T[p]*se}`:`${T[p]*(1-se)}`,c&&(R.style.opacity=A==="reverse"?`${1-se}`:`${se}`),le&&U?R.style.stroke=qe(le,U,se):U&&(R.style.stroke=U),X!==null&&H!==null?R.style.strokeWidth=`${X+(H-X)*se}`:H!==null&&(R.style.strokeWidth=`${H}`),re!==null&&W!==null?R.style.fillOpacity=`${re+(W-re)*se}`:W!==null&&(R.style.fillOpacity=`${W}`),N&&R.tagName.toLowerCase()==="path"&&s[p]&&R.setAttribute("d",lt(s[p],N,se)),p===0&&(ve=se,w?.(se),e.style.setProperty("--scroll-draw-progress",String(se))),me<1&&(L=false);});if(G){let R=Math.min(1,Math.max(0,y/o)),p=ce(R);for(let V in G){let me=parseFloat(V);p>=me&&!Re.has(me)&&(Re.add(me),G[V]?.());}}return L}function Se(y){if(_)return;let L=y-i;D||(D=true,P?.());let R=Ae(L);if(R&&!k){k=true,Ae(o*(1+Math.max(0,C.length-1)*I)),ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Oe=setTimeout(()=>{i=performance.now(),D=false,k=false,Re.clear(),Ye(),O=requestAnimationFrame(Se);},ke));return}R||(O=requestAnimationFrame(Se));}function pe(){cancelAnimationFrame(O),clearTimeout(Oe),i=performance.now(),h=0,_=false,D=false,k=false,Te=0,Q=true,ve=0,Re.clear(),Ye(),O=requestAnimationFrame(Se);}let v=new IntersectionObserver(y=>{y.forEach(L=>{L.isIntersecting&&!(J&&k)?pe():!L.isIntersecting&&!J&&!k&&(cancelAnimationFrame(O),clearTimeout(Oe),Q=false);});},{root:ae??null,threshold:de,rootMargin:Y}),M;function Z(){clearTimeout(M),M=setTimeout(()=>{C.forEach((y,L)=>{T[L]=ze(y),y.style.strokeDasharray=`${T[L]}`;});},150);}return window.addEventListener("resize",Z),window.addEventListener("orientationchange",Z),E>0?setTimeout(()=>v.observe(e),E):v.observe(e),{destroy(){cancelAnimationFrame(O),clearTimeout(Oe),v.disconnect(),window.removeEventListener("resize",Z),window.removeEventListener("orientationchange",Z),clearTimeout(M);},replay(){Te=0,pe();},pause(){_||!Q||(_=true,h=performance.now()-i,cancelAnimationFrame(O));},resume(){_&&(_=false,Q=true,i=performance.now()-h,O=requestAnimationFrame(Se));},seek(y){let L=Math.min(1,Math.max(0,y));ve=L,_=true,h=L*o,i=performance.now()-h,cancelAnimationFrame(O),Ae(h);},getProgress(){return ve},refresh(){clearTimeout(M),C.forEach((y,L)=>{T[L]=ze(y),y.style.strokeDasharray=`${T[L]}`;});}}}if(Le)return ot(qt());bt();function Ue(){if(!fe||_)return;let o=performance.now(),i=nt();if(!Fe&&ee===false&&i===dt){O=requestAnimationFrame(Ue);return}Fe=false,dt=i;let h=m;if(ee!==false){let v=o-gt,M=v>0?Math.abs(i-(je<0?i:je))/v:0;h=m*Math.max(.2,1+M*(typeof ee=="number"?ee:1)*.04);}je=i,gt=o;let Q=g?Ie===-1||i>=Ie?"forward":"reverse":A;Ie=i;let Ae=oe-u,Se=true,pe=Ae===0?0:(i-u)/Ae;if(isNaN(Ve)||(Ve<=0&&pe>0?ye?.():Ve>0&&pe<=0&&xe?.(),Ve<1&&pe>=1?He?.():Ve>=1&&pe<1&&he?.()),Ve=pe,te){let v=ce(ie(i,u,oe,h));J&&!g&&(ue=Math.max(ue,v),v=ue),ve=v,e.style.setProperty("--scroll-draw-progress",String(v));let M=Q==="reverse"?1-v:v;e.style.clipPath=we(M),w?.(v),!D&&ie(i,u,oe,h)>0&&(D=true,P?.()),v>=1&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Oe=setTimeout(()=>{ue=-1,D=false,k=false,e.style.clipPath=we(0);},ke))):v<1&&!J&&(k=false),O=requestAnimationFrame(Ue);return}if(C.forEach((v,M)=>{let Z=M*I*Ae,y=ce(ie(i,u+Z,oe+Z,h));J&&!g&&(y=B[M]=Math.max(B[M]??ue,y)),ve=y,v.style.strokeDashoffset=Q==="reverse"?`${T[M]*y}`:`${T[M]*(1-y)}`,c&&(v.style.opacity=Q==="reverse"?`${1-y}`:`${y}`),le&&U?v.style.stroke=qe(le,U,y):U&&(v.style.stroke=U),X!==null&&H!==null?v.style.strokeWidth=`${X+(H-X)*y}`:H!==null&&(v.style.strokeWidth=`${H}`),re!==null&&W!==null?v.style.fillOpacity=`${re+(W-re)*y}`:W!==null&&(v.style.fillOpacity=`${W}`),N&&v.tagName.toLowerCase()==="path"&&s[M]&&v.setAttribute("d",lt(s[M],N,y)),M===0&&(w?.(y),e.style.setProperty("--scroll-draw-progress",String(y))),y<1&&(Se=false);}),G){let v=ce(ie(i,u,oe,h));for(let M in G){let Z=parseFloat(M);v>=Z&&!Re.has(Z)&&(Re.add(Z),G[M]?.());}}!D&&ie(i,u,oe,h)>0&&(D=true,P?.()),Se&&!k?(k=true,ne?.(),Te<(q==="infinite"?1/0:q??0)&&(Te++,Oe=setTimeout(()=>{ue=-1,B=[],D=false,k=false,Re.clear(),Ye(),Fe=true;},ke))):!Se&&!J&&(k=false),O=requestAnimationFrame(Ue);}let st=false;function Xe(){st||(st=true,O=requestAnimationFrame(function(){Ue();}));}function Qe(){st=false,cancelAnimationFrame(O);}let it=new IntersectionObserver(o=>{o.forEach(i=>{fe=i.isIntersecting,fe&&!_?(Fe=true,Xe()):Qe();});},{root:ae??null,threshold:de,rootMargin:Y});function vt(){C.forEach((o,i)=>{T[i]=ze(o),o.style.strokeDasharray=`${T[i]}`;}),bt(),Fe=true;}let Ze;function We(){clearTimeout(Ze),Ze=setTimeout(vt,150);}window.addEventListener("resize",We),window.addEventListener("orientationchange",We);let Be;return typeof ResizeObserver<"u"&&(Be=new ResizeObserver(()=>We()),Be.observe(document.body),Be.observe(document.documentElement),Be.observe(e)),E>0?setTimeout(()=>it.observe(e),E):it.observe(e),ot({destroy(){cancelAnimationFrame(O),clearTimeout(Oe),Qe(),it.disconnect(),Be?.disconnect(),window.removeEventListener("resize",We),window.removeEventListener("orientationchange",We),clearTimeout(Ze),pt();},replay(){ue=-1,B=[],Ie=-1,je=-1,D=false,k=false,Te=0,_=false,ve=0,Re.clear(),clearTimeout(Oe),Ye(),Fe=true,fe&&Xe();},pause(){_=true,Qe();},resume(){_&&(_=false,Fe=true,fe&&Xe());},seek(o){let i=Math.min(1,Math.max(0,o));ve=i,ue=i,B=[],_=true,Qe(),_t(i,A),Fe=true;},getProgress(){return ve},refresh(){clearTimeout(Ze),vt(),fe&&!_&&Xe();}},()=>({tStart:u,tEnd:oe}))}function Jt(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Ot(n,r):(j("Container not found:",e),t)}function er(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Rt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let l=[],a=[],d=n[2].trim();if(d)for(let m of d.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(c?parseFloat(c[1]):0),a.push(c?c[2]:"");}r.push({fn:n[1],nums:l,units:a});}return r}function tr(e,r,t){let n=Rt(e),l=Rt(r);return n.length===0||n.length!==l.length?t<1?e:r:n.map((a,d)=>{let m=l[d];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((c,f)=>`${c}${a.units[f]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,f)=>`${c}${m.units[f]}`).join(", ")})`:`${a.fn}(${a.nums.map((c,f)=>`${c+(m.nums[f]-c)*t}${a.units[f]}`).join(", ")})`}).join(" ")}function Ft(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),l=String(r);if(er(n))return qe(n,l,t);if(n.includes("("))return tr(n,l,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),d=l.match(/^([-+]?[\d.]+)(.*)$/);if(a&&d){let m=parseFloat(a[1]),c=parseFloat(d[1]);return `${m+(c-m)*t}${a[2]||d[2]}`}return t<1?n:l}function rr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var nr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),or=0,Nt="--scroll-draw-progress";function sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ct(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:n,trigger:l={},easing:a="ease-out",speed:d=1,once:m=false,axis:c="y",scrollContainer:f,native:x=true,velocityScale:I=false,respectReducedMotion:A=true,triggerElement:J,onProgress:Ee,onComplete:S,onEnter:$,onLeave:g,onEnterBack:E,onLeaveBack:b}=r,z=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,F=typeof a=="function"?a:K[a]??K["ease-out"],G=$e(l.start??"top bottom"),ee=$e(l.end??"bottom top"),de=J??e,Y=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([s,u])=>({prop:rr(s),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function ke(){let s=window.getComputedStyle(e);for(let u of q)u.from===""&&(u.from=s.getPropertyValue(u.prop).trim()||"0");}function N(){for(let s of q)e.style.setProperty(s.prop,String(s.to));}let ge=new Map;for(let s of [...q.map(u=>u.prop),Nt])ge.set(s,e.style.getPropertyValue(s));function Le(){for(let[s,u]of ge)u?e.style.setProperty(s,u):e.style.removeProperty(s);}if(z)return N(),S?.(),{...t,destroy:Le,getProgress:()=>1};ke();let Ce=typeof a=="string"?Je(a):null;function De(){if(!x||!sr()||!Ce||c!=="y"||Y||de!==e||m||d!==1||Ee||S||$||g||E||b||I!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let s of q)if(!nr.has(s.prop))return false;return true}function w(){let s=`ssd-a-${++or}`,u=q.map(B=>`${B.prop}:${B.from}`).join(";"),oe=q.map(B=>`${B.prop}:${B.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${s}{from{${u}}to{${oe}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${Ce};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(s);let D=()=>c==="x"?window.scrollX:window.scrollY,O=()=>c==="x"?window.innerWidth:window.innerHeight,fe=()=>{let B=e.getBoundingClientRect();return Ne({top:B.top,height:B.height},D(),O(),G,ee)};Me(e,{type:"animate",getProgress:()=>ue.getProgress(),getTrigger:fe});let ue={destroy(){e.classList.remove(s),k.remove(),e.style.animationPlayState="",Le(),Pe(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(B){let Ie=Math.min(1,Math.max(0,B));e.classList.remove(s);for(let _ of q)e.style.setProperty(_.prop,Ft(_.from,_.to,Ie));},getProgress(){let{tStart:B,tEnd:Ie}=fe();return F(ie(D(),B,Ie,d))}};return ue}if(De())return w();let P=0,ne=0,ye=0,He=false,he=false,xe=-1,te=0,ce=false,be=NaN,_e=-1,ae=0,le=()=>Y?c==="x"?Y.scrollLeft:Y.scrollTop:c==="x"?window.scrollX:window.scrollY,U=()=>Y?c==="x"?Y.clientWidth:Y.clientHeight:c==="x"?window.innerWidth:window.innerHeight;function X(){let s=Ke(de,Y,c),u=Ne(s,s.scroll,U(),G,ee);P=u.tStart,ne=u.tEnd;}function H(s){e.style.setProperty(Nt,String(s));for(let u of q)e.style.setProperty(u.prop,Ft(u.from,u.to,s));Ee?.(s);}function re(s){if(isNaN(be)){be=s;return}be<=0&&s>0?$?.():be>0&&s<=0&&b?.(),be<1&&s>=1?g?.():be>=1&&s<1&&E?.(),be=s;}function W(){if(!He||he)return;let s=performance.now(),u=le(),oe=d;if(I!==false){let O=s-ae,fe=O>0?Math.abs(u-(_e<0?u:_e))/O:0;oe=d*Math.max(.2,1+fe*(typeof I=="number"?I:1)*.04);}_e=u,ae=s;let k=ne===P?0:(u-P)/(ne-P);re(k);let D=F(ie(u,P,ne,oe));m&&(xe=Math.max(xe,D),D=xe),te=D,H(D),D>=1&&!ce?(ce=true,S?.()):D<1&&!m&&(ce=false),ye=requestAnimationFrame(W);}X(),ne===P&&j("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let s=F(ie(le(),P,ne,d));m&&s>0&&(xe=s),te=s,H(s);}let we=new IntersectionObserver(s=>{s.forEach(u=>{He=u.isIntersecting,He&&!he?ye=requestAnimationFrame(W):cancelAnimationFrame(ye);});},{root:Y??null}),C;function T(){clearTimeout(C),C=setTimeout(X,150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),we.observe(e),Me(e,{type:"animate",getProgress:()=>te,getTrigger:()=>({tStart:P,tEnd:ne})}),{destroy(){cancelAnimationFrame(ye),we.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(C),Le(),Pe(e);},replay(){xe=-1,ce=false,te=0,he=false,H(0);},pause(){he=true,cancelAnimationFrame(ye);},resume(){he&&(he=false,He&&(ye=requestAnimationFrame(W)));},seek(s){let u=Math.min(1,Math.max(0,s));te=u,xe=u,he=true,cancelAnimationFrame(ye),H(u);},getProgress(){return te}}}var et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ir(e,r){if(typeof window>"u")return et;let t=typeof e=="string"?document.querySelector(e):e;return t?ct(t,r):(j("scrollAnimate: element not found:",e),et)}function ar(e,r={}){if(typeof window>"u")return et;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return j("scrollParallax: element not found:",e),et;let{speed:n=.3,axis:l="y",easing:a="linear",trigger:d,onProgress:m}=r,c=t.getBoundingClientRect(),f=l==="x"?c.width:c.height,x=n*f;return ct(t,{props:l==="x"?{transform:["translateX(0px)",`translateX(${-x}px)`]}:{transform:["translateY(0px)",`translateY(${-x}px)`]},trigger:d??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m})}var ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,r){if(typeof window>"u")return ut;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return j("scrollCounter: element not found:",e),ut;let n=t,{from:l=0,to:a,format:d,easing:m="ease-out",trigger:c={},once:f=true,decimals:x,onComplete:I}=r,A=x!==void 0?w=>w.toFixed(x):d??(w=>String(Math.round(w))),J=typeof m=="function"?m:K[m]??K["ease-out"],Ee=$e(c.start??"top 80%"),S=$e(c.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n.textContent=A(a),I?.(),ut;let g=0,E=0,b=0,z=false,F=false,G=-1,ee=0,de=false,Y=()=>window.scrollY,q=()=>window.innerHeight;function ke(){let w=n.getBoundingClientRect(),P=Ne({top:w.top,height:w.height},Y(),q(),Ee,S);g=P.tStart,E=P.tEnd;}function N(w){n.textContent=A(l+(a-l)*w),n.style.setProperty("--scroll-draw-progress",String(w));}function ge(){if(!z||F)return;let w=J(ie(Y(),g,E,1));f&&(G=Math.max(G,w),w=G),ee=w,N(w),w>=1&&!de?(de=true,I?.()):w<1&&!f&&(de=false),b=requestAnimationFrame(ge);}ke();{let w=J(ie(Y(),g,E,1));f&&w>0&&(G=w),ee=w,N(w);}let Le=new IntersectionObserver(w=>{w.forEach(P=>{z=P.isIntersecting,z&&!F?b=requestAnimationFrame(ge):cancelAnimationFrame(b);});}),Ce;function De(){clearTimeout(Ce),Ce=setTimeout(ke,150);}return window.addEventListener("resize",De),window.addEventListener("orientationchange",De),Le.observe(n),Me(n,{type:"counter",getProgress:()=>ee,getTrigger:()=>({tStart:g,tEnd:E})}),{destroy(){cancelAnimationFrame(b),Le.disconnect(),window.removeEventListener("resize",De),window.removeEventListener("orientationchange",De),clearTimeout(Ce),Pe(n);},replay(){G=-1,de=false,ee=0,F=false,N(0);},pause(){F=true,cancelAnimationFrame(b);},resume(){F&&(F=false,z&&(b=requestAnimationFrame(ge)));},seek(w){let P=Math.min(1,Math.max(0,w));ee=P,G=P,F=true,cancelAnimationFrame(b),N(P);},getProgress(){return ee}}}var Ht="http://www.w3.org/2000/svg",cr="cinematic-photo",mt=e=>e<0?0:e>1?1:e;function tt(e){let r=parseFloat(e);return Number.isFinite(r)?mt(r/100):0}function ur(e){return K[e]??K.linear}var mr={destroy:()=>{},getProgress:()=>0},ft=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||j("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return mr;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let l=[];for(let S of r.scenes){if(S.background){let g=document.createElement("img");g.id=cr,g.src=S.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let $=S.animations.filter(g=>g.type==="draw");if($.length){let g=document.createElementNS(Ht,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let E of $){let b=document.createElementNS(Ht,"path");b.id=E.target.replace(/^#/,""),b.setAttribute("d",E.d),b.setAttribute("fill","none"),b.setAttribute("stroke",E.stroke),b.setAttribute("stroke-width",String(E.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let z=E.length||b.getTotalLength?.()||0;b.style.strokeDasharray=String(z),b.style.strokeDashoffset=String(z),g.appendChild(b),l.push({kind:"draw",el:b,start:tt(E.start),end:tt(E.end),ease:ur(E.easing),length:z});}}for(let g of S.animations){if(g.type!=="fade")continue;let E=n.querySelector(g.target)??document.querySelector(g.target);E&&(E.style.opacity=String(g.from),l.push({kind:"fade",el:E,start:tt(g.start),end:tt(g.end),ease:K["ease-in-out"]??K.linear,from:g.from,to:g.to}));}}let a=0,d=()=>{let S=t.offsetHeight-window.innerHeight;return S<=0?t.getBoundingClientRect().top<=0?1:0:mt(-t.getBoundingClientRect().top/S)},m=S=>{for(let $ of l){let g=$.end-$.start,E=g<=0?S>=$.end?1:0:mt((S-$.start)/g),b=$.ease(E);$.kind==="draw"?$.el.style.strokeDashoffset=String($.length*(1-b)):$.el.style.opacity=String($.from+($.to-$.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let c=0,f=false,x=false,I=()=>{a=d(),m(a),f&&(c=requestAnimationFrame(I));},A=()=>{f||(f=true,c=requestAnimationFrame(I));},J=()=>{f=false,cancelAnimationFrame(c);},Ee=new IntersectionObserver(S=>{for(let $ of S)x=$.isIntersecting,x?A():J();},{threshold:0});return Ee.observe(n),a=d(),m(a),Me(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let S=t.getBoundingClientRect().top+window.scrollY;return {tStart:S,tEnd:S+Math.max(0,t.offsetHeight-window.innerHeight)}}}),{destroy(){J(),Ee.disconnect(),Pe(t);},getProgress:()=>a}}};
|
|
4
|
+
exports.Cinematic=ft;exports.PRESETS=at;exports.createBounce=St;exports.createElastic=Et;exports.createSpring=Wt;exports.scrollAnimate=ir;exports.scrollCounter=lr;exports.scrollDraw=Jt;exports.scrollParallax=ar;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollAnimate,b as scrollParallax}from'./chunk-KBFWDHF4.mjs';export{a as Cinematic}from'./chunk-KGAJQP2N.mjs';export{a as scrollDraw}from'./chunk-
|
|
1
|
+
export{a as scrollAnimate,b as scrollParallax}from'./chunk-KBFWDHF4.mjs';export{a as Cinematic}from'./chunk-KGAJQP2N.mjs';export{a as scrollDraw}from'./chunk-DIMNQPW5.mjs';export{a as scrollCounter}from'./chunk-4MH5SQTH.mjs';import'./chunk-QJ4H2HW3.mjs';export{a as PRESETS}from'./chunk-LINFV2GK.mjs';import'./chunk-OJFWQ6CU.mjs';import'./chunk-YWKPTYSG.mjs';import'./chunk-YZV4Z3EQ.mjs';import'./chunk-PEFR3ZB7.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-DM6EDKWH.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-BCV4RAIX.mjs';import'./chunk-LFSU6LR3.mjs';
|
package/dist/nuxt/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function
|
|
1
|
+
'use strict';var vue=require('vue');function rr({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(a,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let A=1-Math.pow(t,T);return A+(1-A)*(2*V-1)*(2*V-1)}return 1}}function nr({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),a=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-a)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:rr(),elastic:nr()};function Pt(e,n,r){return Math.min(r,Math.max(n,e))}function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function Ot(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 kt(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 J(e,n,r,t){return r===n?0:Pt((e-n)/(r-n)*t,0,1)}function Te(e,n,r,t,a){let s=Ot(e.top,e.height,n,t.element)-kt(t.viewport,r),c=Ot(e.top,e.height,n,a.element)-kt(a.viewport,r);return {tStart:s,tEnd:c}}function nt(e,n,r){let t=e.getBoundingClientRect(),a=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:r==="x"?t.left:t.top,height:a,scroll:r==="x"?window.scrollX:window.scrollY}}function 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 Rt(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=Rt(e),a=Rt(n);return !t||!a?e:`rgb(${Math.round(t[0]+(a[0]-t[0])*r)},${Math.round(t[1]+(a[1]-t[1])*r)},${Math.round(t[2]+(a[2]-t[2])*r)})`}var Ft={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 Ue=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function he(e,...n){Ue&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var or="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",sr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Dt=33;function ir(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function ar(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 ot(e){switch(e){case "linear":return "linear";case "ease-in":return or;case "ease-out":return sr;case "ease-in-out":return ir()?ar(re["ease-in-out"]):null;default:return null}}var It=Symbol.for("svg-scroll-draw.registry");function Nt(){let e=globalThis;return e[It]||(e[It]=new Map)}function Me(e,n){Nt().set(e,n);}function Ce(e){Nt().delete(e);}var lr=0;function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Ht(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Vt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function ur(e){if(!Ue)return;let n=Ht(e,"stroke");if(!n||n==="none"){he("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Vt.has(r)&&!Vt.has(Ht(e,"fill"))&&he("Element has a fill \u2014 it may obscure the stroke animation.",e);}function mr(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function a(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Vt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,zt=/[MmLlHhVvCcSsQqTtAaZz]/g;function lr(e,n,r){if(!Ue)return;let t=(e.match(zt)??[]).join("").toUpperCase(),l=(n.match(zt)??[]).join("").toUpperCase(),s=(e.match(Vt)??[]).length,c=(n.match(Vt)??[]).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?{...Dt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:A="forward",once:ne=false,debug:$e=false,axis:W="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:$,fillOpacity:C,waypoints:w,velocityScale:k=false,threshold:D=0,rootMargin:P="0px",repeat:S=0,repeatDelay:oe=0,morphTo:F,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:L,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(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray($)?$[0]:null,j=Array.isArray($)?$[1]:typeof $=="number"?$:null,pe=Array.isArray(C)?C[0]:null,Z=Array.isArray(C)?C[1]:typeof C=="number"?C: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,Qe=-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=rt(e,ve,W);return xe(o,o.scroll,xt(),Pe,_e)}function Mt(){(({tStart:f,tEnd:ge}=At())),$e&&Ue&&(St(),ot=ar(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 Yt(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}`),F&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ct(i[ue],F,o));});}function Ze(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Oe(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${O[a]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${O[a]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),F&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{ir(o);let a=Be(o);O.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),F&&(b?lr(i[i.length-1],F,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),F&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",F)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?"0":`${a}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Se&&(o.style.stroke=Se),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Oe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Oe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Ct=typeof p=="string"?nt(p):null;function Xt(){return !(ae===false||!sr()||!z.length||!Ct||Q||W!=="y"||ve||u!==1||V!==0||ne||X||k!==false||F||w||S||G>0||d||x||g||L||E||I||fe||M!=null||$!=null||C!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Qt(){let o=++or,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Ne=A==="reverse"?"0":"var(--ssd-len)",ke=A==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${Ne};`,v=`stroke-dashoffset:${ke};`;m&&(Me+=`opacity:${A==="reverse"?1:0};`,v+=`opacity:${A==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.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(R),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="";}),R.remove();},replay(){h=false,H=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let Y=Math.min(1,Math.max(0,y));H=Y,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=A==="reverse"?`${O[be]*Y}`:`${O[be]*(1-Y)}`,m&&(Te.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return B()},refresh(){z.forEach((y,Y)=>{O[Y]=Be(y),y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`;});}}}if(Xt())return it(Qt());function Zt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Ne(h){let H=true;if(Q){let B=Math.min(1,Math.max(0,h/o)),y=Ee(B);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Oe(A==="reverse"?1-y:y),d?.(y),B<1&&(H=false);}else z.forEach((B,y)=>{let Y=y*V*o,Te=Math.min(1,Math.max(0,(h-Y)/o)),be=Ee(Te);B.style.strokeDashoffset=A==="reverse"?`${O[y]*be}`:`${O[y]*(1-be)}`,m&&(B.style.opacity=A==="reverse"?`${1-be}`:`${be}`),Se&&le?B.style.stroke=We(Se,le,be):le&&(B.style.stroke=le),ce!==null&&j!==null?B.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(B.style.strokeWidth=`${j}`),pe!==null&&Z!==null?B.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(B.style.fillOpacity=`${Z}`),F&&B.tagName.toLowerCase()==="path"&&i[y]&&B.setAttribute("d",ct(i[y],F,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(H=false);});if(w){let B=Math.min(1,Math.max(0,h/o)),y=Ee(B);for(let Y in w){let Te=parseFloat(Y);y>=Te&&!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(),Ze(),q=requestAnimationFrame(ke);},oe));return}B||(q=requestAnimationFrame(ke));}function Me(){cancelAnimationFrame(q),clearTimeout(He),a=performance.now(),b=0,U=false,_=false,N=false,Ie=0,ue=true,he=0,Ve.clear(),Ze(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&N)?Me():!H.isIntersecting&&!ne&&!N&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:ve??null,threshold:D,rootMargin:P}),R;function me(){clearTimeout(R),R=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(R);},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(R),z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return it(Zt());Mt();function Ke(){if(!Ae||U)return;let o=performance.now(),a=st();if(!ze&&k===false&&a===Et){q=requestAnimationFrame(Ke);return}ze=false,Et=a;let b=u;if(k!==false){let v=o-Tt,R=v>0?Math.abs(a-(Qe<0?a:Qe))/v:0;b=u*Math.max(.2,1+R*(typeof k=="number"?k:1)*.04);}Qe=a,Tt=o;let ue=X?te===-1||a>=te?"forward":"reverse":A;te=a;let Ne=ge-f,ke=true,Me=Ne===0?0:(a-f)/Ne;if(isNaN(qe)||(qe<=0&&Me>0?L?.():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 R=ue==="reverse"?1-v:v;e.style.clipPath=Oe(R),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(Ke);return}if(z.forEach((v,R)=>{let me=R*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[R]*h}`:`${O[R]*(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}`),F&&v.tagName.toLowerCase()==="path"&&i[R]&&v.setAttribute("d",ct(i[R],F,h)),R===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 R in w){let me=parseFloat(R);v>=me&&!Ve.has(me)&&(Ve.add(me),w[R]?.());}}!_&&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(),Ze(),ze=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Ke);}let at=false;function Je(){at||(at=true,q=requestAnimationFrame(function(){Ke();}));}function et(){at=false,cancelAnimationFrame(q);}let lt=new IntersectionObserver(o=>{o.forEach(a=>{Ae=a.isIntersecting,Ae&&!U?(ze=true,Je()):et();});},{root:ve??null,threshold:D,rootMargin:P});function Lt(){z.forEach((o,a)=>{O[a]=Be(o),o.style.strokeDasharray=`${O[a]}`;}),Mt(),ze=true;}let tt;function Ge(){clearTimeout(tt),tt=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),et(),lt.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(tt),St();},replay(){ye=-1,te=-1,Qe=-1,_=false,N=false,Ie=0,U=false,he=0,Ve.clear(),clearTimeout(He),Ze(),ze=true,Ae&&Je();},pause(){U=true,et();},resume(){U&&(U=false,ze=true,Ae&&Je());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,U=true,et(),Yt(a,A),ze=true;},getProgress(){return he},refresh(){clearTimeout(tt),Lt(),Ae&&!U&&Je();}},()=>({tStart:f,tEnd:ge}))}function cr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function _t(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 ur(e,n,r){let t=_t(e),l=_t(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 qt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(cr(t))return We(t,l,r);if(t.includes("("))return ur(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 mr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var fr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),pr=0,Bt="--scroll-draw-progress";function dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function mt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:$e,onComplete:W,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,$=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=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:mr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function F(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...S.map(f=>f.prop),Bt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return F(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?nt(s):null;function ae(){if(!T||!dr()||!ee||m!=="y"||P||D!==e||u||c!==1||$e||W||J||X||G||M||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!fr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++pr}`,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,qt(he.from,he.to,U));},getProgress(){let{tStart:te,tEnd:U}=Ae();return C(K(_(),te,U,c))}};return ye}if(ae())return d();let x=0,g=0,L=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=rt(D,P,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Bt,String(i));for(let f of S)e.style.setProperty(f.prop,qt(f.from,f.to,i));$e?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&M?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Z(){if(!E||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 _=C(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Ee?(Ee=true,W?.()):_<1&&!u&&(Ee=false),L=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=C(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?L=requestAnimationFrame(Z):cancelAnimationFrame(L);});},{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(L),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(L);},resume(){I&&(I=false,E&&(L=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,I=true,cancelAnimationFrame(L),j(f);},getProgress(){return Q}}}var ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pt(e,n){if(typeof window>"u")return ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ft;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,A=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],$e=de(m.start??"top 80%"),W=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(s),V?.(),ft;let X=0,G=0,M=0,$=false,C=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 F(d){t.textContent=A(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||C)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,F(d),d>=1&&!D?(D=true,V?.()):d<1&&!p&&(D=false),M=requestAnimationFrame(se);}oe();{let d=ne(K(P(),X,G,1));p&&d>0&&(w=d),k=d,F(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{$=x.isIntersecting,$&&!C?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Ce(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),Le(t);},replay(){w=-1,D=false,k=0,C=false,F(0);},pause(){C=true,cancelAnimationFrame(M);},resume(){C&&(C=false,$&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,C=true,cancelAnimationFrame(M),F(x);},getProgress(){return k}}}var Wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n={}){if(typeof window>"u")return Wt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Wt;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,$e=de(l.start??"top top"),W=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,M=0,$=0,C=false,w=false,k=-1,D=0,P=false,S=false,oe=()=>u==="x"?window.scrollX:window.scrollY,F=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let E=t.getBoundingClientRect(),I=u==="x"?E.left:E.top,fe=u==="x"?E.width:E.height,Q=xe({top:I,height:fe},oe(),F(),$e,W);G=Q.tStart,M=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(!C||w||!S||A)return;let E=ne(K(oe(),G,M,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),A){ee(1),p?.();return}se(),p?.(),C&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),S||se();let x=new IntersectionObserver(E=>{E.forEach(I=>{C=I.isIntersecting,C&&!w&&S?$=requestAnimationFrame(ae):cancelAnimationFrame($);});}),g;function L(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),x.observe(t),Ce(t,{type:"video",getProgress:()=>D,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),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,C&&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 Ut(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 gr(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 Gt(e){let n=Ut(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 yr(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 hr(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 jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return jt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),jt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),$e=de(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=gr(t):l==="lines"?J=Gt(t):J=Ut(t);let X=J.length;function G(g,L){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*L));let E=hr(L,u);E&&(g.style.transform=E);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((L,E)=>{let I=A(yr(g,E,X,s));G(L,I);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let $=0,C=0,w=0,k=false,D=false,P=-1,S=0,oe=false,F=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),L=xe({top:g.top,height:g.height},F(),se(),ne,$e);$=L.tStart,C=L.tEnd;}function ee(){if(!k||D)return;let g=K(F(),$,C,1);p&&(P=Math.max(P,g),g=P),S=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach(L=>{k=L.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=Gt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Ce(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:C})}),{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,M(0);},pause(){D=true,cancelAnimationFrame(w);},resume(){D&&(D=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let L=Math.min(1,Math.max(0,g));S=L,P=L,D=true,cancelAnimationFrame(w),M(L);},getProgress(){return S}}}function br(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 wr(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 vr(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 Sr(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 Er(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 Tn(){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=Tn;exports.useScrollAnimate=wr;exports.useScrollCounter=vr;exports.useScrollDraw=br;exports.useScrollText=Er;exports.useScrollVideo=Sr;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",a,{passive:true}),a(),{el:t,destroy(){window.removeEventListener("scroll",a),t.remove();}}}var zt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,_t=/[MmLlHhVvCcSsQqTtAaZz]/g;function fr(e,n,r){if(!Ue)return;let t=(e.match(_t)??[]).join("").toUpperCase(),a=(n.match(_t)??[]).join("").toUpperCase(),s=(e.match(zt)??[]).length,c=(n.match(zt)??[]).length;if(t!==a){he(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${a||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&he(`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 ut(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),a=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[a++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function mt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,a=r?{...Ft[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:A="forward",once:ne=false,debug:Le=false,axis:W="y",scrollContainer:ee,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:$,fillOpacity:C,waypoints:w,velocityScale:k=false,threshold:F=0,rootMargin:P="0px",repeat:v=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:te=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:L,onLeave:E,onEnterBack:I,onLeaveBack:fe}=a,K=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,$e=de(T.start??"top bottom"),_e=de(T.end??"bottom top"),be=typeof ee=="string"?document.querySelector(ee):ee??null,we=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray($)?$[0]:null,j=Array.isArray($)?$[1]:typeof $=="number"?$:null,pe=Array.isArray(C)?C[0]:null,Q=Array.isArray(C)?C[1]:typeof C=="number"?C:null;function Pe(o){let l=o*100;switch(K){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let z=K?[]:Array.from(e.querySelectorAll(c)),O=[],i=[],f=0,ge=0,N=false,_=false,q=0,xe=false,ve=-1,Z=[],Ne=-1,U=false,Oe=0,De=0,He,st=null;function Et(){st?.destroy(),st=null;}let Ve=new Set,Tt=NaN,ze=true,Qe=-1,xt=performance.now(),qe=NaN;function it(){return be?W==="x"?be.scrollLeft:be.scrollTop:W==="x"?window.scrollX:window.scrollY}function At(){return be?W==="x"?be.clientWidth:be.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function Mt(){let o=nt(e,be,W);return Te(o,o.scroll,At(),$e,_e)}function Ct(){(({tStart:f,tEnd:ge}=Mt())),Le&&Ue&&(Et(),st=mr(f,ge,W));}function at(o,l=Mt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let b=o.destroy;return o.destroy=()=>{b.call(o),Ce(e);},o}function Zt(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let b=l==="reverse"?1-o:o;e.style.clipPath=Pe(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=l==="reverse"?`${O[ue]*o}`:`${O[ue]*(1-o)}`,m&&(b.style.opacity=l==="reverse"?`${1-o}`:`${o}`),we&&le?b.style.stroke=We(we,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Q!==null?b.style.fillOpacity=`${pe+(Q-pe)*o}`:Q!==null&&(b.style.fillOpacity=`${Q}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",ut(i[ue],D,o));});}function Ze(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=Pe(0);return}z.forEach((o,l)=>{o.style.strokeDasharray=`${O[l]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${O[l]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[l]&&o.setAttribute("d",i[l]);});}if(z.forEach(o=>{ur(o);let l=Be(o);O.push(l);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?fr(i[i.length-1],D,o):he(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=A==="reverse"?`${l}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Q!==null&&(o.style.fillOpacity=`${Q}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=A==="reverse"?"0":`${l}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",we&&(o.style.stroke=we),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),K){if(s)return e.style.clipPath=Pe(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Pe(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Lt=typeof p=="string"?ot(p):null;function Jt(){return !(ae===false||!cr()||!z.length||!Lt||K||W!=="y"||be||u!==1||V!==0||ne||X||k!==false||D||w||v||G>0||d||x||g||L||E||I||fe||M!=null||$!=null||C!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function er(){let o=++lr,l=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Ie=A==="reverse"?"0":"var(--ssd-len)",ke=A==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Ie};`,S=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${A==="reverse"?1:0};`,S+=`opacity:${A==="reverse"?0:1};`);let R=document.createElement("style");R.setAttribute("data-svg-scroll-draw",""),R.textContent=`@keyframes ${l}{from{${Ae}}to{${S}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Lt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(b);function me(y,Y){y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(l);}z.forEach(me);let h=false,H=-1;function B(){if(H>=0)return H;let y=e.getBoundingClientRect(),{tStart:Y,tEnd:Ee}=Te({top:y.top,height:y.height},it(),At(),$e,_e);return Se(J(it(),Y,Ee,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(l),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),R.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((Ee,ye)=>{Ee.classList.remove(l),Ee.style.strokeDashoffset=A==="reverse"?`${O[ye]*Y}`:`${O[ye]*(1-Y)}`,m&&(Ee.style.opacity=A==="reverse"?`${1-Y}`:`${Y}`);});},getProgress(){return B()},refresh(){z.forEach((y,Y)=>{O[Y]=Be(y),y.style.setProperty("--ssd-len",String(O[Y])),y.style.strokeDasharray=`${O[Y]}`;});}}}if(Jt())return at(er());function tr(){let o=Math.max(1,te),l=0,b=0,ue=false;function Ie(h){let H=true;if(K){let B=Math.min(1,Math.max(0,h/o)),y=Se(B);Oe=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Pe(A==="reverse"?1-y:y),d?.(y),B<1&&(H=false);}else z.forEach((B,y)=>{let Y=y*V*o,Ee=Math.min(1,Math.max(0,(h-Y)/o)),ye=Se(Ee);B.style.strokeDashoffset=A==="reverse"?`${O[y]*ye}`:`${O[y]*(1-ye)}`,m&&(B.style.opacity=A==="reverse"?`${1-ye}`:`${ye}`),we&&le?B.style.stroke=We(we,le,ye):le&&(B.style.stroke=le),ce!==null&&j!==null?B.style.strokeWidth=`${ce+(j-ce)*ye}`:j!==null&&(B.style.strokeWidth=`${j}`),pe!==null&&Q!==null?B.style.fillOpacity=`${pe+(Q-pe)*ye}`:Q!==null&&(B.style.fillOpacity=`${Q}`),D&&B.tagName.toLowerCase()==="path"&&i[y]&&B.setAttribute("d",ut(i[y],D,ye)),y===0&&(Oe=ye,d?.(ye),e.style.setProperty("--scroll-draw-progress",String(ye))),Ee<1&&(H=false);});if(w){let B=Math.min(1,Math.max(0,h/o)),y=Se(B);for(let Y in w){let Ee=parseFloat(Y);y>=Ee&&!Ve.has(Ee)&&(Ve.add(Ee),w[Y]?.());}}return H}function ke(h){if(U)return;let H=h-l;_||(_=true,x?.());let B=Ie(H);if(B&&!N){N=true,Ie(o*(1+Math.max(0,z.length-1)*V)),g?.(),De<(v==="infinite"?1/0:v??0)&&(De++,He=setTimeout(()=>{l=performance.now(),_=false,N=false,Ve.clear(),Ze(),q=requestAnimationFrame(ke);},oe));return}B||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(He),l=performance.now(),b=0,U=false,_=false,N=false,De=0,ue=true,Oe=0,Ve.clear(),Ze(),q=requestAnimationFrame(ke);}let S=new IntersectionObserver(h=>{h.forEach(H=>{H.isIntersecting&&!(ne&&N)?Ae():!H.isIntersecting&&!ne&&!N&&(cancelAnimationFrame(q),clearTimeout(He),ue=false);});},{root:be??null,threshold:F,rootMargin:P}),R;function me(){clearTimeout(R),R=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(()=>S.observe(e),G):S.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(He),S.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(R);},replay(){De=0,Ae();},pause(){U||!ue||(U=true,b=performance.now()-l,cancelAnimationFrame(q));},resume(){U&&(U=false,ue=true,l=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let H=Math.min(1,Math.max(0,h));Oe=H,U=true,b=H*o,l=performance.now()-b,cancelAnimationFrame(q),Ie(b);},getProgress(){return Oe},refresh(){clearTimeout(R),z.forEach((h,H)=>{O[H]=Be(h),h.style.strokeDasharray=`${O[H]}`;});}}}if(ie)return at(tr());Ct();function Je(){if(!xe||U)return;let o=performance.now(),l=it();if(!ze&&k===false&&l===Tt){q=requestAnimationFrame(Je);return}ze=false,Tt=l;let b=u;if(k!==false){let S=o-xt,R=S>0?Math.abs(l-(Qe<0?l:Qe))/S:0;b=u*Math.max(.2,1+R*(typeof k=="number"?k:1)*.04);}Qe=l,xt=o;let ue=X?Ne===-1||l>=Ne?"forward":"reverse":A;Ne=l;let Ie=ge-f,ke=true,Ae=Ie===0?0:(l-f)/Ie;if(isNaN(qe)||(qe<=0&&Ae>0?L?.():qe>0&&Ae<=0&&fe?.(),qe<1&&Ae>=1?E?.():qe>=1&&Ae<1&&I?.()),qe=Ae,K){let S=Se(J(l,f,ge,b));ne&&!X&&(ve=Math.max(ve,S),S=ve),Oe=S,e.style.setProperty("--scroll-draw-progress",String(S));let R=ue==="reverse"?1-S:S;e.style.clipPath=Pe(R),d?.(S),!_&&J(l,f,ge,b)>0&&(_=true,x?.()),S>=1&&!N?(N=true,g?.(),De<(v==="infinite"?1/0:v??0)&&(De++,He=setTimeout(()=>{ve=-1,_=false,N=false,e.style.clipPath=Pe(0);},oe))):S<1&&!ne&&(N=false),q=requestAnimationFrame(Je);return}if(z.forEach((S,R)=>{let me=R*V*Ie,h=Se(J(l,f+me,ge+me,b));ne&&!X&&(h=Z[R]=Math.max(Z[R]??ve,h)),Oe=h,S.style.strokeDashoffset=ue==="reverse"?`${O[R]*h}`:`${O[R]*(1-h)}`,m&&(S.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),we&&le?S.style.stroke=We(we,le,h):le&&(S.style.stroke=le),ce!==null&&j!==null?S.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(S.style.strokeWidth=`${j}`),pe!==null&&Q!==null?S.style.fillOpacity=`${pe+(Q-pe)*h}`:Q!==null&&(S.style.fillOpacity=`${Q}`),D&&S.tagName.toLowerCase()==="path"&&i[R]&&S.setAttribute("d",ut(i[R],D,h)),R===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let S=Se(J(l,f,ge,b));for(let R in w){let me=parseFloat(R);S>=me&&!Ve.has(me)&&(Ve.add(me),w[R]?.());}}!_&&J(l,f,ge,b)>0&&(_=true,x?.()),ke&&!N?(N=true,g?.(),De<(v==="infinite"?1/0:v??0)&&(De++,He=setTimeout(()=>{ve=-1,Z=[],_=false,N=false,Ve.clear(),Ze(),ze=true;},oe))):!ke&&!ne&&(N=false),q=requestAnimationFrame(Je);}let lt=false;function et(){lt||(lt=true,q=requestAnimationFrame(function(){Je();}));}function tt(){lt=false,cancelAnimationFrame(q);}let ct=new IntersectionObserver(o=>{o.forEach(l=>{xe=l.isIntersecting,xe&&!U?(ze=true,et()):tt();});},{root:be??null,threshold:F,rootMargin:P});function $t(){z.forEach((o,l)=>{O[l]=Be(o),o.style.strokeDasharray=`${O[l]}`;}),Ct(),ze=true;}let rt;function Ge(){clearTimeout(rt),rt=setTimeout($t,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(()=>ct.observe(e),G):ct.observe(e),at({destroy(){cancelAnimationFrame(q),clearTimeout(He),tt(),ct.disconnect(),je?.disconnect(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(rt),Et();},replay(){ve=-1,Z=[],Ne=-1,Qe=-1,_=false,N=false,De=0,U=false,Oe=0,Ve.clear(),clearTimeout(He),Ze(),ze=true,xe&&et();},pause(){U=true,tt();},resume(){U&&(U=false,ze=true,xe&&et());},seek(o){let l=Math.min(1,Math.max(0,o));Oe=l,ve=l,Z=[],U=true,tt(),Zt(l,A),ze=true;},getProgress(){return Oe},refresh(){clearTimeout(rt),$t(),xe&&!U&&et();}},()=>({tStart:f,tEnd:ge}))}var qt=new WeakMap,pr=0;function Bt(e){return JSON.stringify(e,(n,r)=>{if(typeof r=="function")return "\u0192";if(typeof Element<"u"&&r instanceof Element){let t=qt.get(r);return t===void 0&&qt.set(r,t=++pr),`el#${t}`}return r})}function Wt(e,n){let r={...e};for(let t of Object.keys(r))typeof r[t]=="function"&&(r[t]=(...a)=>n()[t]?.(...a));return r}function dr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Gt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let a=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:a,units:s});}return n}function gr(e,n,r){let t=Gt(e),a=Gt(n);return t.length===0||t.length!==a.length?r<1?e:n:t.map((s,c)=>{let u=a[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function jt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),a=String(n);if(dr(t))return We(t,a,r);if(t.includes("("))return gr(t,a,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:a}function yr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var hr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),br=0,Ut="--scroll-draw-progress";function wr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function ft(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:a={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:A=true,triggerElement:ne,onProgress:Le,onComplete:W,onEnter:ee,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,$=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,C=typeof s=="function"?s:re[s]??re["ease-out"],w=de(a.start??"top bottom"),k=de(a.end??"bottom top"),F=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,v=Object.entries(t).map(([i,f])=>({prop:yr(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 v)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of v)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...v.map(f=>f.prop),Ut])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 D(),W?.(),{...r,destroy:ie,getProgress:()=>1};oe();let te=typeof s=="string"?ot(s):null;function ae(){if(!T||!wr()||!te||m!=="y"||P||F!==e||u||c!==1||Le||W||ee||X||G||M||V!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let i of v)if(!hr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++br}`,f=v.map(Z=>`${Z.prop}:${Z.from}`).join(";"),ge=v.map(Z=>`${Z.prop}:${Z.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:${te};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,xe=()=>{let Z=e.getBoundingClientRect();return Te({top:Z.top,height:Z.height},_(),q(),w,k)};Me(e,{type:"animate",getProgress:()=>ve.getProgress(),getTrigger:xe});let ve={destroy(){e.classList.remove(i),N.remove(),e.style.animationPlayState="",ie(),Ce(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(Z){let Ne=Math.min(1,Math.max(0,Z));e.classList.remove(i);for(let U of v)e.style.setProperty(U.prop,jt(U.from,U.to,Ne));},getProgress(){let{tStart:Z,tEnd:Ne}=xe();return C(J(_(),Z,Ne,c))}};return ve}if(ae())return d();let x=0,g=0,L=0,E=false,I=false,fe=-1,K=0,Se=false,$e=NaN,_e=-1,be=0,we=()=>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=nt(F,P,m),f=Te(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Ut,String(i));for(let f of v)e.style.setProperty(f.prop,jt(f.from,f.to,i));Le?.(i);}function pe(i){if(isNaN($e)){$e=i;return}$e<=0&&i>0?ee?.():$e>0&&i<=0&&M?.(),$e<1&&i>=1?X?.():$e>=1&&i<1&&G?.(),$e=i;}function Q(){if(!E||I)return;let i=performance.now(),f=we(),ge=c;if(V!==false){let q=i-be,xe=q>0?Math.abs(f-(_e<0?f:_e))/q:0;ge=c*Math.max(.2,1+xe*(typeof V=="number"?V:1)*.04);}_e=f,be=i;let N=g===x?0:(f-x)/(g-x);pe(N);let _=C(J(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),K=_,j(_),_>=1&&!Se?(Se=true,W?.()):_<1&&!u&&(Se=false),L=requestAnimationFrame(Q);}ce(),g===x&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=C(J(we(),x,g,c));u&&i>0&&(fe=i),K=i,j(i);}let Pe=new IntersectionObserver(i=>{i.forEach(f=>{E=f.isIntersecting,E&&!I?L=requestAnimationFrame(Q):cancelAnimationFrame(L);});},{root:P??null}),z;function O(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),Pe.observe(e),Me(e,{type:"animate",getProgress:()=>K,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(L),Pe.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(z),ie(),Ce(e);},replay(){fe=-1,Se=false,K=0,I=false,j(0);},pause(){I=true,cancelAnimationFrame(L);},resume(){I&&(I=false,E&&(L=requestAnimationFrame(Q)));},seek(i){let f=Math.min(1,Math.max(0,i));K=f,fe=f,I=true,cancelAnimationFrame(L),j(f);},getProgress(){return K}}}var pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function dt(e,n){if(typeof window>"u")return pt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollCounter: element not found:",e),pt;let t=r,{from:a=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,A=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Le=de(m.start??"top 80%"),W=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(s),V?.(),pt;let X=0,G=0,M=0,$=false,C=false,w=-1,k=0,F=false,P=()=>window.scrollY,v=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=Te({top:d.top,height:d.height},P(),v(),Le,W);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=A(a+(s-a)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!$||C)return;let d=ne(J(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,D(d),d>=1&&!F?(F=true,V?.()):d<1&&!p&&(F=false),M=requestAnimationFrame(se);}oe();{let d=ne(J(P(),X,G,1));p&&d>0&&(w=d),k=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{$=x.isIntersecting,$&&!C?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),te;function ae(){clearTimeout(te),te=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Me(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(te),Ce(t);},replay(){w=-1,F=false,k=0,C=false,D(0);},pause(){C=true,cancelAnimationFrame(M);},resume(){C&&(C=false,$&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,C=true,cancelAnimationFrame(M),D(x);},getProgress(){return k}}}var Yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,n={}){if(typeof window>"u")return Yt;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Yt;let t=r,{trigger:a={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,A=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Le=de(a.start??"top top"),W=de(a.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let ee=n.from??0,X=n.to,G=0,M=0,$=0,C=false,w=false,k=-1,F=0,P=false,v=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>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,K=Te({top:I,height:fe},oe(),D(),Le,W);G=K.tStart,M=K.tEnd;}let ie=NaN;function te(E){if(!v)return;let I=X??t.duration??0,fe=ee+(I-ee)*E;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(E)),V?.(E);}function ae(){if(!C||w||!v||A)return;let E=ne(J(oe(),G,M,1));c&&(k=Math.max(k,E),E=k),F=E,te(E),E>=1&&!P?(P=true,T?.()):E<1&&!c&&(P=false),$=requestAnimationFrame(ae);}function d(){if(v=true,X===void 0&&(X=t.duration),A){te(1),p?.();return}se(),p?.(),C&&!w&&($=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),v||se();let x=new IntersectionObserver(E=>{E.forEach(I=>{C=I.isIntersecting,C&&!w&&v?$=requestAnimationFrame(ae):cancelAnimationFrame($);});}),g;function L(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),x.observe(t),Me(t,{type:"video",getProgress:()=>F,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame($),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(g),Ce(t);},replay(){k=-1,P=false,F=0,w=false,ie=NaN,te(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,C&&v&&($=requestAnimationFrame(ae)));},seek(E){let I=Math.min(1,Math.max(0,E));F=I,k=I,w=true,cancelAnimationFrame($),ie=NaN,te(I);},getProgress(){return F}}}function Qt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function Sr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Xt(e){let n=Qt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],a=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of a){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function vr(e,n,r,t){if(r<=1||t===0)return e;let a=(r-1)*t,s=n*t,c=s+(1-a);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function Er(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 Kt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yt(e,n={}){if(typeof window>"u")return Kt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return he("scrollText: element not found:",e),Kt;let t=r,{split:a="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Le=de(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ee;a==="chars"?ee=Sr(t):a==="lines"?ee=Xt(t):ee=Qt(t);let X=ee.length;function G(g,L){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*L));let E=Er(L,u);E&&(g.style.transform=E);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),ee.forEach((L,E)=>{let I=A(vr(g,E,X,s));G(L,I);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let $=0,C=0,w=0,k=false,F=false,P=-1,v=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),L=Te({top:g.top,height:g.height},D(),se(),ne,Le);$=L.tStart,C=L.tEnd;}function te(){if(!k||F)return;let g=J(D(),$,C,1);p&&(P=Math.max(P,g),g=P),v=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(te);}ie();let ae=new IntersectionObserver(g=>{g.forEach(L=>{k=L.isIntersecting,k&&!F?w=requestAnimationFrame(te):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(a==="lines"){let g=v;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),ee=Xt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Me(t,{type:"text",getProgress:()=>v,getTrigger:()=>({tStart:$,tEnd:C})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=W,t.removeAttribute("aria-label"),Ce(t);},replay(){P=-1,oe=false,v=0,F=false,M(0);},pause(){F=true,cancelAnimationFrame(w);},resume(){F&&(F=false,k&&(w=requestAnimationFrame(te)));},seek(g){let L=Math.min(1,Math.max(0,g));v=L,P=L,F=true,cancelAnimationFrame(w),M(L);},getProgress(){return v}}}var Ke=e=>typeof e=="function"?e():vue.unref(e);function Fe(e,n,r){let t=null,a=n(),s=()=>{t?.destroy(),t=e.value?r(e.value,Wt(a,()=>a)):null;};vue.onMounted(s),vue.watch(()=>Bt(a=n()),s),vue.onUnmounted(()=>{t?.destroy(),t=null;});}function Cr(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),mt),n}var ht=vue.defineComponent({name:"ScrollDraw",props:{selector:{type:String},speed:{type:Number},fade:{type:Boolean},stagger:{type:Number},easing:{type:[String,Function]},direction:{type:String},trigger:{type:Object},onProgress:{type:Function},onStart:{type:Function},onComplete:{type:Function},once:{type:Boolean},debug:{type:Boolean}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>{let t={};return e.selector!=null&&(t.selector=e.selector),e.speed!=null&&(t.speed=e.speed),e.fade!=null&&(t.fade=e.fade),e.stagger!=null&&(t.stagger=e.stagger),e.easing!=null&&(t.easing=e.easing),e.direction!=null&&(t.direction=e.direction),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.debug!=null&&(t.debug=e.debug),e.onProgress!=null&&(t.onProgress=e.onProgress),e.onStart!=null&&(t.onStart=e.onStart),e.onComplete!=null&&(t.onComplete=e.onComplete),t},mt),()=>vue.h("div",{ref:r},n.default?.())}});function Lr(e){let n=vue.ref(null);return Fe(n,()=>Ke(e),ft),n}var bt=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let r=vue.ref(null);return Fe(r,()=>e.options,ft),()=>vue.h("div",{ref:r},n.default?.())}});function $r(e){let n=vue.ref(null);return Fe(n,()=>Ke(e),dt),n}var wt=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:{type:Boolean},decimals:{type:Number},onComplete:{type:Function}},setup(e){let n=vue.ref(null);return Fe(n,()=>{let r={to:e.to};return e.from!=null&&(r.from=e.from),e.format!=null&&(r.format=e.format),e.easing!=null&&(r.easing=e.easing),e.trigger!=null&&(r.trigger=e.trigger),e.once!=null&&(r.once=e.once),e.decimals!=null&&(r.decimals=e.decimals),e.onComplete!=null&&(r.onComplete=e.onComplete),r},dt),()=>vue.h("span",{ref:n})}});function Pr(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),gt),n}var St=vue.defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let n=vue.ref(null);return Fe(n,()=>e.options??{},gt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Or(e={}){let n=vue.ref(null);return Fe(n,()=>Ke(e),yt),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 Fe(r,()=>e.options??{},yt),()=>vue.h(e.tag,{ref:r},n.default?.())}});function Fn(){return {install(e){e.component("ScrollDraw",ht),e.component("ScrollAnimate",bt),e.component("ScrollCounter",wt),e.component("ScrollVideo",St),e.component("ScrollText",vt);}}}exports.ScrollAnimate=bt;exports.ScrollCounter=wt;exports.ScrollDraw=ht;exports.ScrollText=vt;exports.ScrollVideo=St;exports.createScrollDrawPlugin=Fn;exports.useScrollAnimate=Lr;exports.useScrollCounter=$r;exports.useScrollDraw=Cr;exports.useScrollText=Or;exports.useScrollVideo=Pr;
|
package/dist/nuxt/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,d,f,h,j}from'../chunk-
|
|
1
|
+
import {b,d,f,h,j}from'../chunk-HMSNYXKW.mjs';export{d as ScrollAnimate,f as ScrollCounter,b as ScrollDraw,j as ScrollText,h as ScrollVideo,c as useScrollAnimate,e as useScrollCounter,a as useScrollDraw,i as useScrollText,g as useScrollVideo}from'../chunk-HMSNYXKW.mjs';import'../chunk-XSVTHCLO.mjs';import'../chunk-JC5BD4RB.mjs';import'../chunk-SNCRC6BA.mjs';import'../chunk-4MH5SQTH.mjs';import'../chunk-QJ4H2HW3.mjs';import'../chunk-LINFV2GK.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-PEFR3ZB7.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function s(){return {install(o){o.component("ScrollDraw",b),o.component("ScrollAnimate",d),o.component("ScrollCounter",f),o.component("ScrollVideo",h),o.component("ScrollText",j);}}}export{s as createScrollDrawPlugin};
|