svg-scroll-draw 2.20.1 → 2.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -15
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +1 -1
- package/dist/angular/index.d.ts +1 -1
- package/dist/angular/index.mjs +1 -1
- package/dist/aos/index.cjs +2 -2
- package/dist/aos/index.mjs +1 -1
- package/dist/aos/react/index.cjs +2 -2
- package/dist/aos/react/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/aos.global.js +2 -2
- package/dist/cdn/scrollreveal.global.js +2 -2
- package/dist/cdn/svg-scroll-draw.dev.global.js +83 -29
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/cdn/vivus.global.js +1 -1
- package/dist/chunk-2PYLM3E7.mjs +1 -0
- package/dist/chunk-DWK6XXY6.mjs +2 -0
- package/dist/chunk-DY5JCXVR.mjs +1 -0
- package/dist/chunk-EAWFBJUR.mjs +2 -0
- package/dist/{chunk-MTEGM4RR.mjs → chunk-GVBO5GRD.mjs} +1 -1
- package/dist/chunk-HX4SP5WN.mjs +3 -0
- package/dist/chunk-JCXMBI4G.mjs +2 -0
- package/dist/chunk-KV3WCPQ5.mjs +1 -0
- package/dist/chunk-LTCJVVSC.mjs +1 -0
- package/dist/{chunk-SMRTRZSD.mjs → chunk-OTDD2ROH.mjs} +1 -1
- package/dist/{chunk-ECHMYVSK.mjs → chunk-VMUJMXKO.mjs} +1 -1
- package/dist/chunk-WXUOF4NM.mjs +1 -0
- package/dist/chunk-YNNA33A5.mjs +2 -0
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.mjs +1 -1
- package/dist/{engine-DQyBzZDl.d.ts → engine-B7UpB4fT.d.ts} +2 -1
- package/dist/{engine-P8u6OK4m.d.mts → engine-o1VSQ1lX.d.mts} +2 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +2 -2
- package/dist/group/index.d.ts +2 -2
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +2 -1
- package/dist/horizontal/index.d.ts +2 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-CMqK0GCT.d.mts → index-BY-CNE8c.d.mts} +1 -1
- package/dist/{index-DPqPEnO-.d.ts → index-DqXXiDIk.d.ts} +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +1 -1
- package/dist/nuxt/index.d.ts +1 -1
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/scrollreveal/index.cjs +2 -2
- package/dist/scrollreveal/index.mjs +1 -1
- package/dist/scrollreveal/react/index.cjs +2 -2
- package/dist/scrollreveal/react/index.mjs +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +1 -1
- package/dist/solid/index.d.ts +1 -1
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +1 -1
- package/dist/svelte/index.d.ts +1 -1
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vivus/index.cjs +2 -2
- package/dist/vivus/index.d.mts +3 -0
- package/dist/vivus/index.d.ts +3 -0
- package/dist/vivus/index.mjs +1 -1
- package/dist/vivus/react/index.cjs +2 -2
- package/dist/vivus/react/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +1 -1
- package/dist/vue/index.d.ts +1 -1
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-4T5R3ZTL.mjs +0 -2
- package/dist/chunk-7SBTYJGH.mjs +0 -1
- package/dist/chunk-BFX2CSQ3.mjs +0 -1
- package/dist/chunk-ENACACPZ.mjs +0 -3
- package/dist/chunk-I45LCJUP.mjs +0 -1
- package/dist/chunk-KGAJQP2N.mjs +0 -2
- package/dist/chunk-KHQ7OGQK.mjs +0 -1
- package/dist/chunk-OMI46IXL.mjs +0 -2
- package/dist/chunk-WQZKXAXK.mjs +0 -2
package/dist/vue/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var vue=require('vue');function
|
|
2
|
-
<div style="position:absolute;${m?`left:${
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",s,{passive:true}),s(),{el:t,destroy(){window.removeEventListener("scroll",s),t.remove();}}}var Gt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Tn(e,r,n){if(!Qe)return;let t=(e.match(jt)??[]).join("").toUpperCase(),s=(r.match(jt)??[]).join("").toUpperCase(),i=(e.match(Gt)??[]).length,l=(r.match(Gt)??[]).length;if(t!==s){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}i!==l&&we(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function bt(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let l=parseFloat(i),u=t[s++]??l;return String(+(l+(u-l)*n).toFixed(4))})}function wt(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,s=n?{...Ht[n],...t}:t,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:l="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:T={},stagger:D=0,direction:A="forward",once:te=false,debug:Pe=false,axis:G="y",scrollContainer:ce,autoReverse:ne=false,delay:Y=0,strokeColor:N,strokeWidth:P,fillOpacity:k,waypoints:w,velocityScale:O=false,threshold:x=0,rootMargin:M="0px",repeat:E=0,repeatDelay:re=0,morphTo:L,clip:oe,autoplay:ve=false,duration:ge=1e3,native:ye=true,onProgress:H,onStart:$,onComplete:f,onEnter:p,onLeave:R,onEnterBack:W,onLeaveBack:Me}=s,v=oe===true?"left":typeof oe=="string"?oe:false,V=typeof d=="function"?d:le[d]??le.linear,ue=be(T.start??"top bottom"),He=be(T.end??"bottom top"),Ee=typeof ce=="string"?document.querySelector(ce):ce??null,Ae=Array.isArray(N)?N[0]:null,me=Array.isArray(N)?N[1]:typeof N=="string"?N:null,X=Array.isArray(P)?P[0]:null,se=Array.isArray(P)?P[1]:typeof P=="number"?P:null,ie=Array.isArray(k)?k[0]:null,K=Array.isArray(k)?k[1]:typeof k=="number"?k:null;function Ve(o){let a=o*100;switch(v){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=v?[]:Array.from(e.querySelectorAll(l)),I=[],fe=[],J=0,Se=0,c=D,h=0,_=false,q=false,C=0,pe=false,he=-1,ze=[],ae=-1,j=false,Te=0,_e=0,Be,ft=null;function Mt(){ft?.destroy(),ft=null;}let We=new Set,At=NaN,qe=true,rt=-1,Lt=performance.now(),Ge=NaN;function Xe(){return Ee?G==="x"?Ee.scrollLeft:Ee.scrollTop:G==="x"?window.scrollX:window.scrollY}function Ct(){return Ee?G==="x"?Ee.clientWidth:Ee.clientHeight:G==="x"?window.innerWidth:window.innerHeight}function $t(){let o=lt(e,Ee,G);return $e(o,o.scroll,Ct(),ue,He)}function sn(){let o=Se-J,a=z.length-1,y=Ee??document.documentElement,Q=G==="x"?"Width":"Height";if(c=D,D>0&&a>0&&o>0){let Le=y[`scroll${Q}`]-y[`client${Q}`]-1-J-o/u;Le>=0&&(c=Math.min(D,Le/(a*o)));}h=Se+a*c*o;}function Pt(){(({tStart:J,tEnd:Se}=$t())),sn(),Pe&&Qe&&(Mt(),ft=Sn(J,Se,G));}function pt(o,a=$t){ke(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let y=o.destroy;return o.destroy=()=>{y.call(o),Re(e);},o}function an(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),v){let y=a==="reverse"?1-o:o;e.style.clipPath=Ve(y);return}z.forEach((y,Q)=>{y.style.strokeDashoffset=a==="reverse"?`${I[Q]*o}`:`${I[Q]*(1-o)}`,m&&(y.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ae&&me?y.style.stroke=Ye(Ae,me,o):me&&(y.style.stroke=me),X!==null&&se!==null?y.style.strokeWidth=`${X+(se-X)*o}`:se!==null&&(y.style.strokeWidth=`${se}`),ie!==null&&K!==null?y.style.fillOpacity=`${ie+(K-ie)*o}`:K!==null&&(y.style.fillOpacity=`${K}`),L&&y.tagName.toLowerCase()==="path"&&fe[Q]&&y.setAttribute("d",bt(fe[Q],L,o));});}function ot(){if(e.style.setProperty("--scroll-draw-progress","0"),v){e.style.clipPath=Ve(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=A==="reverse"?"0":`${I[a]}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Ae&&(o.style.stroke=Ae),X!==null&&(o.style.strokeWidth=`${X}`),ie!==null&&(o.style.fillOpacity=`${ie}`),L&&o.tagName.toLowerCase()==="path"&&fe[a]&&o.setAttribute("d",fe[a]);});}if(z.forEach(o=>{En(o);let a=Ue(o);I.push(a);let y=o.tagName.toLowerCase()==="path";y?fe.push(o.getAttribute("d")??""):fe.push(""),L&&(y?Tn(fe[fe.length-1],L,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),i?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),me&&(o.style.stroke=me),se!==null&&(o.style.strokeWidth=`${se}`),K!==null&&(o.style.fillOpacity=`${K}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=A==="reverse"?"0":`${a}`,m?o.style.opacity=A==="reverse"?"1":"0":o.style.opacity="",Ae&&(o.style.stroke=Ae),X!==null&&(o.style.strokeWidth=`${X}`),ie!==null&&(o.style.fillOpacity=`${ie}`));}),v){if(i)return e.style.clipPath=Ve(1),f?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ve(0);}else if(i)return f?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Ot=typeof d=="string"?ct(d):null;function ln(){return !(ye===false||!vn()||!z.length||!Ot||v||G!=="y"||Ee||u!==1||D!==0||te||ne||O!==false||L||w||E||Y>0||H||$||f||p||R||W||Me||N!=null||P!=null||k!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function cn(){let o=++wn,a=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,Q=`--svg-scroll-draw-${o}`,Le=A==="reverse"?"0":"var(--ssd-len)",Ie=A==="reverse"?"var(--ssd-len)":"0",Oe=`stroke-dashoffset:${Le};`,S=`stroke-dashoffset:${Ie};`;m&&(Oe+=`opacity:${A==="reverse"?1:0};`,S+=`opacity:${A==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${a}{from{${Oe}}to{${S}}}.${y}{view-timeline-name:${Q};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Ot};animation-fill-mode:both;animation-timeline:${Q};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(y);function de(g,Z){g.style.setProperty("--ssd-len",String(I[Z])),g.style.strokeDasharray=`${I[Z]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(a);}z.forEach(de);let b=false,B=-1;function U(){if(B>=0)return B;let g=e.getBoundingClientRect(),{tStart:Z,tEnd:Ce}=$e({top:g.top,height:g.height},Xe(),Ct(),ue,He);return V(ee(Xe(),Z,Ce,u))}return {destroy(){e.classList.remove(y),z.forEach(g=>{g.classList.remove(a),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),F.remove();},replay(){b=false,B=-1,z.forEach(de);},pause(){b=true,z.forEach(g=>{g.style.animationPlayState="paused";});},resume(){b&&(b=false,z.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let Z=Math.min(1,Math.max(0,g));B=Z,b=true,z.forEach((Ce,xe)=>{Ce.classList.remove(a),Ce.style.strokeDashoffset=A==="reverse"?`${I[xe]*Z}`:`${I[xe]*(1-Z)}`,m&&(Ce.style.opacity=A==="reverse"?`${1-Z}`:`${Z}`);});},getProgress(){return U()},refresh(){z.forEach((g,Z)=>{I[Z]=Ue(g),g.style.setProperty("--ssd-len",String(I[Z])),g.style.strokeDasharray=`${I[Z]}`;});}}}if(ln())return pt(cn());function un(){let o=Math.max(1,ge),a=0,y=0,Q=false;function Le(b){let B=true;if(v){let U=Math.min(1,Math.max(0,b/o)),g=V(U);Te=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=Ve(A==="reverse"?1-g:g),H?.(g),U<1&&(B=false);}else z.forEach((U,g)=>{let Z=g*D*o,Ce=Math.min(1,Math.max(0,(b-Z)/o)),xe=V(Ce);U.style.strokeDashoffset=A==="reverse"?`${I[g]*xe}`:`${I[g]*(1-xe)}`,m&&(U.style.opacity=A==="reverse"?`${1-xe}`:`${xe}`),Ae&&me?U.style.stroke=Ye(Ae,me,xe):me&&(U.style.stroke=me),X!==null&&se!==null?U.style.strokeWidth=`${X+(se-X)*xe}`:se!==null&&(U.style.strokeWidth=`${se}`),ie!==null&&K!==null?U.style.fillOpacity=`${ie+(K-ie)*xe}`:K!==null&&(U.style.fillOpacity=`${K}`),L&&U.tagName.toLowerCase()==="path"&&fe[g]&&U.setAttribute("d",bt(fe[g],L,xe)),g===0&&(Te=xe,H?.(xe),e.style.setProperty("--scroll-draw-progress",String(xe))),Ce<1&&(B=false);});if(w){let U=Math.min(1,Math.max(0,b/o)),g=V(U);for(let Z in w){let Ce=parseFloat(Z);g>=Ce&&!We.has(Ce)&&(We.add(Ce),w[Z]?.());}}return B}function Ie(b){if(j)return;let B=b-a;q||(q=true,$?.());let U=Le(B);if(U&&!_){_=true,Le(o*(1+Math.max(0,z.length-1)*D)),f?.(),_e<(E==="infinite"?1/0:E??0)&&(_e++,Be=setTimeout(()=>{a=performance.now(),q=false,_=false,We.clear(),ot(),C=requestAnimationFrame(Ie);},re));return}U||(C=requestAnimationFrame(Ie));}function Oe(){cancelAnimationFrame(C),clearTimeout(Be),a=performance.now(),y=0,j=false,q=false,_=false,_e=0,Q=true,Te=0,We.clear(),ot(),C=requestAnimationFrame(Ie);}let S=new IntersectionObserver(b=>{b.forEach(B=>{B.isIntersecting&&!(te&&_)?Oe():!B.isIntersecting&&!te&&!_&&(cancelAnimationFrame(C),clearTimeout(Be),Q=false);});},{root:Ee??null,threshold:x,rootMargin:M}),F;function de(){clearTimeout(F),F=setTimeout(()=>{z.forEach((b,B)=>{I[B]=Ue(b),b.style.strokeDasharray=`${I[B]}`;});},150);}return window.addEventListener("resize",de),window.addEventListener("orientationchange",de),Y>0?setTimeout(()=>S.observe(e),Y):S.observe(e),{destroy(){cancelAnimationFrame(C),clearTimeout(Be),S.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),clearTimeout(F);},replay(){_e=0,Oe();},pause(){j||!Q||(j=true,y=performance.now()-a,cancelAnimationFrame(C));},resume(){j&&(j=false,Q=true,a=performance.now()-y,C=requestAnimationFrame(Ie));},seek(b){let B=Math.min(1,Math.max(0,b));Te=B,j=true,y=B*o,a=performance.now()-y,cancelAnimationFrame(C),Le(y);},getProgress(){return Te},refresh(){clearTimeout(F),z.forEach((b,B)=>{I[B]=Ue(b),b.style.strokeDasharray=`${I[B]}`;});}}}if(ve)return pt(un());Pt();function kt(){if(j||!je)return;let o=performance.now(),a=Xe();if(!qe&&O===false&&a===At){gt(a);return}qe=false,At=a;let y=u;if(O!==false){let S=o-Lt,F=S>0?Math.abs(a-(rt<0?a:rt))/S:0;y=u*Math.max(.2,1+F*(typeof O=="number"?O:1)*.04);}rt=a,Lt=o;let Q=ne?ae===-1||a>=ae?"forward":"reverse":A;ae=a;let Le=Se-J,Ie=true,Oe=Le===0?0:(a-J)/Le;if(isNaN(Ge)||(Ge<=0&&Oe>0?p?.():Ge>0&&Oe<=0&&Me?.(),Ge<1&&Oe>=1?R?.():Ge>=1&&Oe<1&&W?.()),Ge=Oe,v){let S=V(ee(a,J,Se,y));te&&!ne&&(he=Math.max(he,S),S=he),Te=S,e.style.setProperty("--scroll-draw-progress",String(S));let F=Q==="reverse"?1-S:S;e.style.clipPath=Ve(F),H?.(S),!q&&ee(a,J,Se,y)>0&&(q=true,$?.()),S>=1&&!_?(_=true,f?.(),_e<(E==="infinite"?1/0:E??0)&&(_e++,Be=setTimeout(()=>{he=-1,q=false,_=false,e.style.clipPath=Ve(0);},re))):S<1&&!te&&(_=false),gt(a);return}if(z.forEach((S,F)=>{let de=F*c*Le,b=V(ee(a,J+de,Se+de,y));te&&!ne&&(b=ze[F]=Math.max(ze[F]??he,b)),S.style.strokeDashoffset=Q==="reverse"?`${I[F]*b}`:`${I[F]*(1-b)}`,m&&(S.style.opacity=Q==="reverse"?`${1-b}`:`${b}`),Ae&&me?S.style.stroke=Ye(Ae,me,b):me&&(S.style.stroke=me),X!==null&&se!==null?S.style.strokeWidth=`${X+(se-X)*b}`:se!==null&&(S.style.strokeWidth=`${se}`),ie!==null&&K!==null?S.style.fillOpacity=`${ie+(K-ie)*b}`:K!==null&&(S.style.fillOpacity=`${K}`),L&&S.tagName.toLowerCase()==="path"&&fe[F]&&S.setAttribute("d",bt(fe[F],L,b)),F===0&&(Te=b,H?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Ie=false);}),w){let S=V(ee(a,J,Se,y));for(let F in w){let de=parseFloat(F);S>=de&&!We.has(de)&&(We.add(de),w[F]?.());}}!q&&ee(a,J,Se,y)>0&&(q=true,$?.()),Ie&&!_?(_=true,f?.(),_e<(E==="infinite"?1/0:E??0)&&(_e++,Be=setTimeout(()=>{he=-1,ze=[],q=false,_=false,We.clear(),ot(),qe=true;},re))):!Ie&&!te&&(_=false),gt(a);}function dt(o){return o>=Se&&o<h}function gt(o){pe||dt(o)?C=requestAnimationFrame(kt):je=false;}function yt(){return pe||dt(Xe())}let je=false;function st(){je||(je=true,C=requestAnimationFrame(function(){kt();}));}function it(){je=false,cancelAnimationFrame(C);}let ht=new IntersectionObserver(o=>{o.forEach(a=>{pe=a.isIntersecting,pe&&!j?(qe=true,st()):je&&!j&&dt(Xe())||it();});},{root:Ee??null,threshold:x,rootMargin:M});function Rt(){z.forEach((o,a)=>{I[a]=Ue(o),o.style.strokeDasharray=`${I[a]}`;}),Pt(),qe=true;}let at;function Ke(){clearTimeout(at),at=setTimeout(Rt,150);}window.addEventListener("resize",Ke),window.addEventListener("orientationchange",Ke);let mn=Fe([e],Ke);return Y>0?setTimeout(()=>ht.observe(e),Y):ht.observe(e),pt({destroy(){cancelAnimationFrame(C),clearTimeout(Be),it(),ht.disconnect(),mn(),window.removeEventListener("resize",Ke),window.removeEventListener("orientationchange",Ke),clearTimeout(at),Mt();},replay(){he=-1,ze=[],ae=-1,rt=-1,q=false,_=false,_e=0,j=false,Te=0,We.clear(),clearTimeout(Be),ot(),qe=true,yt()&&st();},pause(){j=true,it();},resume(){j&&(j=false,qe=true,yt()&&st());},seek(o){let a=Math.min(1,Math.max(0,o));Te=a,he=a,ze=[],j=true,it(),an(a,A),qe=true;},getProgress(){return Te},refresh(){clearTimeout(at),Rt(),yt()&&!j&&st();}},()=>({tStart:J,tEnd:Se}))}var Ut=new WeakMap,xn=0;function Yt(e){return JSON.stringify(e,(r,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let t=Ut.get(n);return t===void 0&&Ut.set(n,t=++xn),`el#${t}`}return n})}function Xt(e,r){let n={...e};for(let t of Object.keys(n))typeof n[t]=="function"&&(n[t]=(...s)=>r()[t]?.(...s));return n}function Mn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Kt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let s=[],i=[],l=t[2].trim();if(l)for(let u of l.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}r.push({fn:t[1],nums:s,units:i});}return r}function An(e,r,n){let t=Kt(e),s=Kt(r);return t.length===0||t.length!==s.length?n<1?e:r:t.map((i,l)=>{let u=s[l];return i.fn!==u.fn||i.nums.length!==u.nums.length?n<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*n}${i.units[d]}`).join(", ")})`}).join(" ")}function Qt(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),s=String(r);if(Mn(t))return Ye(t,s,n);if(t.includes("("))return An(t,s,n);let i=t.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let u=parseFloat(i[1]),m=parseFloat(l[1]);return `${u+(m-u)*n}${i[2]||l[2]}`}return n<1?t:s}function Ln(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Cn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),$n=0,Zt="--scroll-draw-progress";function Pn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function vt(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:s={},easing:i="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:d,native:T=true,velocityScale:D=false,respectReducedMotion:A=true,triggerElement:te,onProgress:Pe,onComplete:G,onEnter:ce,onLeave:ne,onEnterBack:Y,onLeaveBack:N}=r,P=A&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,k=typeof i=="function"?i:le[i]??le["ease-out"],w=be(s.start??"top bottom"),O=be(s.end??"bottom top"),x=te??e,M=typeof d=="string"?document.querySelector(d):d??null,E=Object.entries(t).map(([c,h])=>({prop:Ln(c),from:Array.isArray(h)?h[0]:"",to:Array.isArray(h)?h[1]:h}));function re(){let c=window.getComputedStyle(e);for(let h of E)h.from===""&&(h.from=c.getPropertyValue(h.prop).trim()||"0");}function L(){for(let c of E)e.style.setProperty(c.prop,String(c.to));}let oe=new Map;for(let c of [...E.map(h=>h.prop),Zt])oe.set(c,e.style.getPropertyValue(c));function ve(){for(let[c,h]of oe)h?e.style.setProperty(c,h):e.style.removeProperty(c);}if(P)return L(),G?.(),{...n,destroy:ve,getProgress:()=>1};re();let ge=typeof i=="string"?ct(i):null;function ye(){if(!T||!Pn()||!ge||m!=="y"||M||x!==e||u||l!==1||Pe||G||ce||ne||Y||N||D!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let c of E)if(!Cn.has(c.prop))return false;return true}function H(){let c=`ssd-a-${++$n}`,h=E.map(ae=>`${ae.prop}:${ae.from}`).join(";"),_=E.map(ae=>`${ae.prop}:${ae.to}`).join(";"),q=document.createElement("style");q.setAttribute("data-ssd-animate",""),q.textContent=`@keyframes ${c}{from{${h}}to{${_}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${ge};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(q),e.classList.add(c);let C=()=>m==="x"?window.scrollX:window.scrollY,pe=()=>m==="x"?window.innerWidth:window.innerHeight,he=()=>{let ae=e.getBoundingClientRect();return $e({top:ae.top,height:ae.height},C(),pe(),w,O)};ke(e,{type:"animate",getProgress:()=>ze.getProgress(),getTrigger:he});let ze={refresh(){},destroy(){e.classList.remove(c),q.remove(),e.style.animationPlayState="",ve(),Re(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let j=Math.min(1,Math.max(0,ae));e.classList.remove(c);for(let Te of E)e.style.setProperty(Te.prop,Qt(Te.from,Te.to,j));},getProgress(){let{tStart:ae,tEnd:j}=he();return k(ee(C(),ae,j,l))}};return ze}if(ye())return H();let $=0,f=0,p=0,R=false,W=false,Me=-1,v=0,V=false,ue=NaN,He=-1,Ee=0,Ae=()=>M?m==="x"?M.scrollLeft:M.scrollTop:m==="x"?window.scrollX:window.scrollY,me=()=>M?m==="x"?M.clientWidth:M.clientHeight:m==="x"?window.innerWidth:window.innerHeight,X=x===e?E:[],se=false;function ie(){let c=e.style,h=X.map(pe=>c.getPropertyValue(pe.prop)),_=c.transition;X.length&&(c.transition="none"),X.forEach(pe=>c.setProperty(pe.prop,oe.get(pe.prop)??""));let q=lt(x,M,m);X.forEach((pe,he)=>c.setProperty(pe.prop,h[he])),X.length&&(e.offsetWidth,c.transition=_);let C=$e(q,q.scroll,me(),w,O);se&&Math.abs(C.tStart-$)<1&&Math.abs(C.tEnd-f)<1||(se=true,$=C.tStart,f=C.tEnd);}function K(c){e.style.setProperty(Zt,String(c));for(let h of E)e.style.setProperty(h.prop,Qt(h.from,h.to,c));Pe?.(c);}function Ve(c){if(isNaN(ue)){ue=c;return}ue<=0&&c>0?ce?.():ue>0&&c<=0&&N?.(),ue<1&&c>=1?ne?.():ue>=1&&c<1&&Y?.(),ue=c;}function z(){if(!R||W)return;let c=performance.now(),h=Ae(),_=l;if(D!==false){let pe=c-Ee,he=pe>0?Math.abs(h-(He<0?h:He))/pe:0;_=l*Math.max(.2,1+he*(typeof D=="number"?D:1)*.04);}He=h,Ee=c;let q=f===$?0:(h-$)/(f-$);Ve(q);let C=k(ee(h,$,f,_));u&&(Me=Math.max(Me,C),C=Me),v=C,K(C),C>=1&&!V?(V=true,G?.()):C<1&&!u&&(V=false),p=requestAnimationFrame(z);}ie(),f===$&&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 c=k(ee(Ae(),$,f,l));u&&c>0&&(Me=c),v=c,K(c);}let I=new IntersectionObserver(c=>{c.forEach(h=>{R=h.isIntersecting,R&&!W?p=requestAnimationFrame(z):cancelAnimationFrame(p);});},{root:M??null}),fe;function J(){clearTimeout(fe),fe=setTimeout(ie,150);}window.addEventListener("resize",J),window.addEventListener("orientationchange",J);let Se=Fe([x],J);return I.observe(e),ke(e,{type:"animate",getProgress:()=>v,getTrigger:()=>({tStart:$,tEnd:f})}),{destroy(){cancelAnimationFrame(p),I.disconnect(),window.removeEventListener("resize",J),window.removeEventListener("orientationchange",J),Se(),clearTimeout(fe),ve(),Re(e);},replay(){Me=-1,V=false,v=0,W=false,K(0);},pause(){W=true,cancelAnimationFrame(p);},resume(){W&&(W=false,R&&(p=requestAnimationFrame(z)));},seek(c){let h=Math.min(1,Math.max(0,c));v=h,Me=h,W=true,cancelAnimationFrame(p),K(h);},getProgress(){return v},refresh(){ie();}}}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,r){if(typeof window>"u")return Et;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return we("scrollCounter: element not found:",e),Et;let t=n,{from:s=0,to:i,format:l,easing:u="ease-out",trigger:m={},once:d=true,decimals:T,onComplete:D}=r,A=T!==void 0?f=>f.toFixed(T):l??(f=>String(Math.round(f))),te=typeof u=="function"?u:le[u]??le["ease-out"],Pe=be(m.start??"top 80%"),G=be(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=A(i),D?.(),Et;let ne=0,Y=0,N=false,P=0,k=false,w=false,O=-1,x=0,M=false,E=()=>window.scrollY,re=()=>window.innerHeight;function L(){let f=t.getBoundingClientRect(),p=$e({top:f.top,height:f.height},E(),re(),Pe,G);N&&Math.abs(p.tStart-ne)<1&&Math.abs(p.tEnd-Y)<1||(N=true,ne=p.tStart,Y=p.tEnd);}function oe(f){t.textContent=A(s+(i-s)*f),t.style.setProperty("--scroll-draw-progress",String(f));}function ve(){if(!k||w)return;let f=te(ee(E(),ne,Y,1));d&&(O=Math.max(O,f),f=O),x=f,oe(f),f>=1&&!M?(M=true,D?.()):f<1&&!d&&(M=false),P=requestAnimationFrame(ve);}L();{let f=te(ee(E(),ne,Y,1));d&&f>0&&(O=f),x=f,oe(f);}let ge=new IntersectionObserver(f=>{f.forEach(p=>{k=p.isIntersecting,k&&!w?P=requestAnimationFrame(ve):cancelAnimationFrame(P);});}),ye;function H(){clearTimeout(ye),ye=setTimeout(L,150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let $=Fe([t],H);return ge.observe(t),ke(t,{type:"counter",getProgress:()=>x,getTrigger:()=>({tStart:ne,tEnd:Y})}),{destroy(){cancelAnimationFrame(P),ge.disconnect(),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),$(),clearTimeout(ye),Re(t);},replay(){O=-1,M=false,x=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame(P);},resume(){w&&(w=false,k&&(P=requestAnimationFrame(ve)));},seek(f){let p=Math.min(1,Math.max(0,f));x=p,O=p,w=true,cancelAnimationFrame(P),oe(p);},getProgress(){return x}}}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tt(e,r={}){if(typeof window>"u")return Jt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Jt;let t=n,{trigger:s={},easing:i="linear",once:l=false,axis:u="y",preload:m="auto",triggerElement:d,onReady:T,onComplete:D,onProgress:A}=r,te=d??t,Pe=window.matchMedia("(prefers-reduced-motion: reduce)").matches,G=typeof i=="function"?i:le[i]??le.linear,ce=be(s.start??"top top"),ne=be(s.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Y=r.from??0,N=r.to,P=0,k=0,w=0,O=false,x=false,M=-1,E=0,re=false,L=false,oe=()=>u==="x"?window.scrollX:window.scrollY,ve=()=>u==="x"?window.innerWidth:window.innerHeight;function ge(){let v=te.getBoundingClientRect(),V=u==="x"?v.left:v.top,ue=u==="x"?v.width:v.height,He=$e({top:V,height:ue},oe(),ve(),ce,ne);P=He.tStart,k=He.tEnd,L&&k===P&&we("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let ye=NaN;function H(v){if(!L)return;let V=N??t.duration??0,ue=Y+(V-Y)*v;ue!==ye&&(ye=ue,t.currentTime=ue),t.style.setProperty("--scroll-draw-progress",String(v)),A?.(v);}function $(){if(!O||x||!L||Pe)return;let v=G(ee(oe(),P,k,1));l&&(M=Math.max(M,v),v=M),E=v,H(v),v>=1&&!re?(re=true,D?.()):v<1&&!l&&(re=false),w=requestAnimationFrame($);}function f(){if(L=true,N===void 0&&(N=t.duration),Pe){H(1),T?.();return}ge(),T?.(),O&&!x&&(w=requestAnimationFrame($));}t.readyState>=1?f():t.addEventListener("loadedmetadata",f,{once:true}),L||ge();let p=new IntersectionObserver(v=>{v.forEach(V=>{O=V.isIntersecting,O&&!x&&L?w=requestAnimationFrame($):cancelAnimationFrame(w);});}),R;function W(){clearTimeout(R),R=setTimeout(ge,150);}window.addEventListener("resize",W),window.addEventListener("orientationchange",W);let Me=Fe([te],W);return p.observe(t),ke(t,{type:"video",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:k})}),{destroy(){cancelAnimationFrame(w),p.disconnect(),t.removeEventListener("loadedmetadata",f),window.removeEventListener("resize",W),window.removeEventListener("orientationchange",W),Me(),clearTimeout(R),Re(t);},replay(){M=-1,re=false,E=0,x=false,ye=NaN,H(0);},pause(){x=true,cancelAnimationFrame(w);},resume(){x&&(x=false,O&&L&&(w=requestAnimationFrame($)));},seek(v){let V=Math.min(1,Math.max(0,v));E=V,M=V,x=true,cancelAnimationFrame(w),ye=NaN,H(V);},getProgress(){return E}}}function nn(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function On(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function en(e){let r=nn(e),n=new Map;for(let i of r){let l=i.offsetTop;n.has(l)||n.set(l,[]),n.get(l).push(i);}let t=[],s=Array.from(n.keys()).sort((i,l)=>i-l);for(let i of s){let l=n.get(i),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",l.forEach((m,d)=>{let T=m.nextElementSibling;u.appendChild(m),d<l.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((i,l)=>{e.appendChild(i),l<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function kn(e,r,n,t){if(n<=1||t===0)return e;let s=(n-1)*t,i=r*t,l=i+(1-s);return l<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(l-i)))}function Rn(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var tn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function xt(e,r={}){if(typeof window>"u")return tn;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return we("scrollText: element not found:",e),tn;let t=n,{split:s="words",stagger:i=.04,easing:l="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:T}=r,D=window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof l=="function"?l:le[l]??le["ease-out"],te=be(m.start??"top 85%"),Pe=be(m.end??"top 40%"),G=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let ce;s==="chars"?ce=On(t):s==="lines"?ce=en(t):ce=nn(t);let ne=ce.length;function Y(p,R){u?.opacity!==void 0&&(p.style.opacity=String(u.opacity+(1-u.opacity)*R));let W=Rn(R,u);W&&(p.style.transform=W);}function N(p){t.style.setProperty("--scroll-draw-progress",String(p)),ce.forEach((R,W)=>{let Me=A(kn(p,W,ne,i));Y(R,Me);});}if(D)return N(1),T?.(),{destroy(){t.innerHTML=G,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};N(0);let P=0,k=0,w=0,O=false,x=false,M=-1,E=0,re=false,L=()=>window.scrollY,oe=()=>window.innerHeight;function ve(){let p=t.getBoundingClientRect(),R=$e({top:p.top,height:p.height},L(),oe(),te,Pe);P=R.tStart,k=R.tEnd;}function ge(){if(!O||x)return;let p=ee(L(),P,k,1);d&&(M=Math.max(M,p),p=M),E=p,N(p),p>=1&&!re?(re=true,T?.()):p<1&&!d&&(re=false),w=requestAnimationFrame(ge);}ve();let ye=new IntersectionObserver(p=>{p.forEach(R=>{O=R.isIntersecting,O&&!x?w=requestAnimationFrame(ge):cancelAnimationFrame(w);});}),H;function $(){clearTimeout(H),H=setTimeout(()=>{if(s==="lines"){let p=E;t.innerHTML=G,t.setAttribute("aria-label",t.textContent??""),ce=en(t),N(p);}ve();},150);}window.addEventListener("resize",$),window.addEventListener("orientationchange",$);let f=Fe([t],$);return ye.observe(t),ke(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:k})}),{destroy(){cancelAnimationFrame(w),ye.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),f(),clearTimeout(H),t.innerHTML=G,t.removeAttribute("aria-label"),Re(t);},replay(){M=-1,re=false,E=0,x=false,N(0);},pause(){x=true,cancelAnimationFrame(w);},resume(){x&&(x=false,O&&(w=requestAnimationFrame(ge)));},seek(p){let R=Math.min(1,Math.max(0,p));E=R,M=R,x=true,cancelAnimationFrame(w),N(R);},getProgress(){return E}}}var nt=e=>typeof e=="function"?e():vue.unref(e);function Ne(e,r,n){let t=null,s=r(),i=()=>{t?.destroy(),t=e.value?n(e.value,Xt(s,()=>s)):null;};vue.onMounted(i),vue.watch(()=>Yt(s=r()),i),vue.onUnmounted(()=>{t?.destroy(),t=null;});}function qr(e={}){let r=vue.ref(null);return Ne(r,()=>nt(e),wt),r}var rn={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},Hn=[null,Boolean,[Boolean,String],[Boolean,Number]],on=e=>({type:e,default:void 0}),Gr=vue.defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(rn).map(([e,r])=>[e,r?on(Hn[r]):null])),setup(e,{slots:r}){let n=vue.ref(null);return Ne(n,()=>{let t={};for(let s in rn){let i=e[s];i!=null&&(t[s]=i);}return t},wt),()=>vue.h("div",{ref:n},r.default?.())}});function jr(e){let r=vue.ref(null);return Ne(r,()=>nt(e),vt),r}var Ur=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:r}){let n=vue.ref(null);return Ne(n,()=>e.options,vt),()=>vue.h("div",{ref:n},r.default?.())}});function Yr(e){let r=vue.ref(null);return Ne(r,()=>nt(e),St),r}var Xr=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:on(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let r=vue.ref(null);return Ne(r,()=>{let n={to:e.to};return e.from!=null&&(n.from=e.from),e.format!=null&&(n.format=e.format),e.easing!=null&&(n.easing=e.easing),e.trigger!=null&&(n.trigger=e.trigger),e.once!=null&&(n.once=e.once),e.decimals!=null&&(n.decimals=e.decimals),e.onComplete!=null&&(n.onComplete=e.onComplete),n},St),()=>vue.h("span",{ref:r})}});function Kr(e={}){let r=vue.ref(null);return Ne(r,()=>nt(e),Tt),r}var Qr=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 r=vue.ref(null);return Ne(r,()=>e.options??{},Tt),()=>vue.h("video",{ref:r,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function Zr(e={}){let r=vue.ref(null);return Ne(r,()=>nt(e),xt),r}var Jr=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:r}){let n=vue.ref(null);return Ne(n,()=>e.options??{},xt),()=>vue.h(e.tag,{ref:n},r.default?.())}});exports.ScrollAnimate=Ur;exports.ScrollCounter=Xr;exports.ScrollDraw=Gr;exports.ScrollText=Jr;exports.ScrollVideo=Qr;exports.useScrollAnimate=jr;exports.useScrollCounter=Yr;exports.useScrollDraw=qr;exports.useScrollText=Zr;exports.useScrollVideo=Kr;
|
|
1
|
+
'use strict';var vue=require('vue');function hn({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(r),i=0,a=[];for(let d=0;d<t;d++){let x=Math.pow(o,d);a.push(x),i+=x;}let f=[0],m=0;for(let d=0;d<t;d++)m+=a[d]/i,f.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<t;x++)if(d<=f[x+1]){let F=(d-f[x])/(f[x+1]-f[x]);if(x===0)return F*(2-F);let $=1-Math.pow(r,x);return $+(1-$)*(2*F-1)*(2*F-1)}return 1}}function bn({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),o=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/r)+1}var oe={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:hn(),elastic:bn()};function Ft(e,n,t){return Math.min(t,Math.max(n,e))}function ye(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function Ht(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function Nt(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 ee(e,n,t,r){return t===n?0:Ft((e-n)/(t-n)*r,0,1)}function Le(e,n,t,r,o){let i=Ht(e.top,e.height,n,r.element)-Nt(r.viewport,t),a=Ht(e.top,e.height,n,o.element)-Nt(o.viewport,t);return {tStart:i,tEnd:a}}function ct(e,n,t){let r=e.getBoundingClientRect(),o=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:o,scroll:0}:{top:t==="x"?r.left:r.top,height:o,scroll:t==="x"?window.scrollX:window.scrollY}}function Ue(e){let n=e.tagName.toLowerCase();if(n==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),r=parseFloat(e.getAttribute("height")??"0");return 2*(t+r)}if(n==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function Vt(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 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 r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function Ye(e,n,t){let r=Vt(e),o=Vt(n);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*t)},${Math.round(r[1]+(o[1]-r[1])*t)},${Math.round(r[2]+(o[2]-r[2])*t)})`}var zt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function he(e,...n){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var wn="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",vn="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",_t=33;function En(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Sn(e){let n=[];for(let t=0;t<_t;t++){let r=t/(_t-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function ut(e){switch(e){case "linear":return "linear";case "ease-in":return wn;case "ease-out":return vn;case "ease-in-out":return En()?Sn(oe["ease-in-out"]):null;default:return null}}var Wt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[Wt]||(e[Wt]=new Map)}function Oe(e,n){qt().set(e,n);}function Pe(e){qt().delete(e);}var Je,ft=new Set,mt=new WeakMap,et=new Map,Bt=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function Tn(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function De(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();Je??(Je=new ResizeObserver(o=>{let i=false;for(let{target:a}of o)mt.get(a)!==Bt(a)&&(i=true),mt.set(a,"");i&&ft.forEach(a=>a());})),ft.add(t);let r=Tn(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{mt.has(o)||mt.set(o,Bt(o)),et.set(o,(et.get(o)??0)+1),Je.observe(o);}),()=>{ft.delete(t)&&(r.forEach(o=>{let i=(et.get(o)??1)-1;if(i)return void et.set(o,i);et.delete(o),Je?.unobserve(o);}),ft.size||(Je?.disconnect(),Je=void 0));}}function pt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function Ge(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=pt(i=>{if(!i)return;r();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=n(a?{...e,onComplete:void 0}:e,true);}),o={};for(let i of Object.keys(t))o[i]=(...a)=>t[i]?.(...a);return o.destroy=()=>{r(),t.destroy();},o}var xn=0;function Mn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Gt(e,n){let t="";try{t=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return t||(e.getAttribute(n)??"").trim()}var jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ln(e){if(!Ze)return;let n=Gt(e,"stroke");if(!n||n==="none"){he("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!jt.has(t)&&!jt.has(Gt(e,"fill"))&&he("Element has a fill \u2014 it may obscure the stroke animation.",e);}function An(e,n,t){let r=document.createElement("div");r.setAttribute("data-svg-scroll-draw-debug",""),r.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 i=t==="x"?window.scrollX:window.scrollY,a=e-i,f=n-i,m=t==="x";r.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}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:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}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(r),window.addEventListener("scroll",o,{passive:true}),o(),{el:r,destroy(){window.removeEventListener("scroll",o),r.remove();}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function Cn(e,n,t){if(!Ze)return;let r=(e.match(Ut)??[]).join("").toUpperCase(),o=(n.match(Ut)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,a=(n.match(Qt)??[]).length;if(r!==o){he(`morphTo: command sequence differs (${r||"\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.`,t);return}i!==a&&he(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function vt(e,n,t){let r=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),f=r[o++]??a;return String(+(a+(f-a)*t).toFixed(4))})}function Et(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(n,(t,r)=>$n(e,t,r))}function $n(e,n,t){let{preset:r,...o}=n,i=r?{...zt[r],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:f=1,fade:m=false,easing:d="linear",trigger:x={},stagger:F=0,direction:$="forward",once:Q=false,debug:fe=false,axis:R="y",scrollContainer:se,autoReverse:be=false,delay:I=0,strokeColor:H,strokeWidth:P,fillOpacity:M,waypoints:w,velocityScale:v=false,threshold:T=0,rootMargin:U="0px",repeat:N=0,repeatDelay:B=0,morphTo:L,clip:me,autoplay:Ee=false,duration:ie=1e3,native:z=true,onProgress:u,onStart:A,onComplete:h,onEnter:k,onLeave:te,onEnterBack:pe,onLeaveBack:Se}=i,Z=me===true?"left":typeof me=="string"?me:false,E=typeof d=="function"?d:oe[d]??oe.linear,de=ye(x.start??"top bottom"),Ae=ye(x.end??"bottom top"),ae=typeof se=="string"?document.querySelector(se):se??null,le=Array.isArray(H)?H[0]:null,ne=Array.isArray(H)?H[1]:typeof H=="string"?H:null,re=Array.isArray(P)?P[0]:null,Y=Array.isArray(P)?P[1]:typeof P=="number"?P:null,ge=Array.isArray(M)?M[0]:null,J=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function ke(s){let c=s*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let _=Z?[]:Array.from(e.querySelectorAll(a)),O=[],we=[],l=0,p=0,Ce=F,Te=0,C=false,V=false,G=0,ze=false,q=-1,Ne=[],_e=-1,ce=false,Re=0,Ve=0,We,dt=null;function At(){dt?.destroy(),dt=null;}let qe=new Set,Ct=NaN,Be=true,ot=-1,$t=performance.now(),je=NaN;function Xe(){return ae?R==="x"?ae.scrollLeft:ae.scrollTop:R==="x"?window.scrollX:window.scrollY}function Ot(){return ae?R==="x"?ae.clientWidth:ae.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Pt(){let s=ct(e,ae,R);return Le(s,s.scroll,Ot(),de,Ae)}function fn(){let s=p-l,c=_.length-1,y=ae??document.documentElement,X=R==="x"?"Width":"Height";if(Ce=F,F>0&&c>0&&s>0){let xe=y[`scroll${X}`]-y[`client${X}`]-1-l-s/f;xe>=0&&(Ce=Math.min(F,xe/(c*s)));}Te=p+c*Ce*s;}function kt(){(({tStart:l,tEnd:p}=Pt())),fn(),fe&&Ze&&(At(),dt=An(l,p,R));}function gt(s,c=Pt){Oe(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let y=s.destroy;return s.destroy=()=>{y.call(s),Pe(e);},s}function mn(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),Z){let y=c==="reverse"?1-s:s;e.style.clipPath=ke(y);return}_.forEach((y,X)=>{y.style.strokeDashoffset=c==="reverse"?`${O[X]*s}`:`${O[X]*(1-s)}`,m&&(y.style.opacity=c==="reverse"?`${1-s}`:`${s}`),le&&ne?y.style.stroke=Ye(le,ne,s):ne&&(y.style.stroke=ne),re!==null&&Y!==null?y.style.strokeWidth=`${re+(Y-re)*s}`:Y!==null&&(y.style.strokeWidth=`${Y}`),ge!==null&&J!==null?y.style.fillOpacity=`${ge+(J-ge)*s}`:J!==null&&(y.style.fillOpacity=`${J}`),L&&y.tagName.toLowerCase()==="path"&&we[X]&&y.setAttribute("d",vt(we[X],L,s));});}function st(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ke(0);return}_.forEach((s,c)=>{s.style.strokeDasharray=`${O[c]}`,s.style.strokeDashoffset=$==="reverse"?"0":`${O[c]}`,m?s.style.opacity=$==="reverse"?"1":"0":s.style.opacity="",le&&(s.style.stroke=le),re!==null&&(s.style.strokeWidth=`${re}`),ge!==null&&(s.style.fillOpacity=`${ge}`),L&&s.tagName.toLowerCase()==="path"&&we[c]&&s.setAttribute("d",we[c]);});}if(_.forEach(s=>{Ln(s);let c=Ue(s);O.push(c);let y=s.tagName.toLowerCase()==="path";y?we.push(s.getAttribute("d")??""):we.push(""),L&&(y?Cn(we[we.length-1],L,s):he(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),t?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=$==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ne&&(s.style.stroke=ne),Y!==null&&(s.style.strokeWidth=`${Y}`),J!==null&&(s.style.fillOpacity=`${J}`),L&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",L)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=$==="reverse"?"0":`${c}`,m?s.style.opacity=$==="reverse"?"1":"0":s.style.opacity="",le&&(s.style.stroke=le),re!==null&&(s.style.strokeWidth=`${re}`),ge!==null&&(s.style.fillOpacity=`${ge}`));}),Z){if(t)return e.style.clipPath=ke(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=ke(0);}else if(t)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Rt=typeof d=="string"?ut(d):null;function pn(){return !(z===false||!Mn()||!_.length||!Rt||Z||R!=="y"||ae||f!==1||F!==0||Q||be||v!==false||L||w||N||I>0||u||A||h||k||te||pe||Se||H!=null||P!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function dn(){let s=++xn,c=`svg-scroll-draw-${s}`,y=`svg-scroll-draw-host-${s}`,X=`--svg-scroll-draw-${s}`,xe=$==="reverse"?"0":"var(--ssd-len)",Ie=$==="reverse"?"var(--ssd-len)":"0",$e=`stroke-dashoffset:${xe};`,S=`stroke-dashoffset:${Ie};`;m&&($e+=`opacity:${$==="reverse"?1:0};`,S+=`opacity:${$==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${$e}}to{${S}}}.${y}{view-timeline-name:${X};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Rt};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(y);function ue(g,K){g.style.setProperty("--ssd-len",String(O[K])),g.style.strokeDasharray=`${O[K]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(c);}_.forEach(ue);let b=false,W=-1;function j(){if(W>=0)return W;let g=e.getBoundingClientRect(),{tStart:K,tEnd:Me}=Le({top:g.top,height:g.height},Xe(),Ot(),de,Ae);return E(ee(Xe(),K,Me,f))}return {destroy(){e.classList.remove(y),_.forEach(g=>{g.classList.remove(c),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),D.remove();},replay(){b=false,W=-1,_.forEach(ue);},pause(){b=true,_.forEach(g=>{g.style.animationPlayState="paused";});},resume(){b&&(b=false,_.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let K=Math.min(1,Math.max(0,g));W=K,b=true,_.forEach((Me,ve)=>{Me.classList.remove(c),Me.style.strokeDashoffset=$==="reverse"?`${O[ve]*K}`:`${O[ve]*(1-K)}`,m&&(Me.style.opacity=$==="reverse"?`${1-K}`:`${K}`);});},getProgress(){return j()},refresh(){_.forEach((g,K)=>{O[K]=Ue(g),g.style.setProperty("--ssd-len",String(O[K])),g.style.strokeDasharray=`${O[K]}`;});}}}if(pn())return gt(dn());function gn(){let s=Math.max(1,ie),c=0,y=0,X=false;function xe(b){let W=true;if(Z){let j=Math.min(1,Math.max(0,b/s)),g=E(j);Re=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=ke($==="reverse"?1-g:g),u?.(g),j<1&&(W=false);}else _.forEach((j,g)=>{let K=g*F*s,Me=Math.min(1,Math.max(0,(b-K)/s)),ve=E(Me);j.style.strokeDashoffset=$==="reverse"?`${O[g]*ve}`:`${O[g]*(1-ve)}`,m&&(j.style.opacity=$==="reverse"?`${1-ve}`:`${ve}`),le&&ne?j.style.stroke=Ye(le,ne,ve):ne&&(j.style.stroke=ne),re!==null&&Y!==null?j.style.strokeWidth=`${re+(Y-re)*ve}`:Y!==null&&(j.style.strokeWidth=`${Y}`),ge!==null&&J!==null?j.style.fillOpacity=`${ge+(J-ge)*ve}`:J!==null&&(j.style.fillOpacity=`${J}`),L&&j.tagName.toLowerCase()==="path"&&we[g]&&j.setAttribute("d",vt(we[g],L,ve)),g===0&&(Re=ve,u?.(ve),e.style.setProperty("--scroll-draw-progress",String(ve))),Me<1&&(W=false);});if(w){let j=Math.min(1,Math.max(0,b/s)),g=E(j);for(let K in w){let Me=parseFloat(K);g>=Me&&!qe.has(Me)&&(qe.add(Me),w[K]?.());}}return W}function Ie(b){if(ce)return;let W=b-c;V||(V=true,A?.());let j=xe(W);if(j&&!C){C=true,xe(s*(1+Math.max(0,_.length-1)*F)),h?.(),Ve<(N==="infinite"?1/0:N??0)&&(Ve++,We=setTimeout(()=>{c=performance.now(),V=false,C=false,qe.clear(),st(),G=requestAnimationFrame(Ie);},B));return}j||(G=requestAnimationFrame(Ie));}function $e(){cancelAnimationFrame(G),clearTimeout(We),c=performance.now(),y=0,ce=false,V=false,C=false,Ve=0,X=true,Re=0,qe.clear(),st(),G=requestAnimationFrame(Ie);}let S=new IntersectionObserver(b=>{b.forEach(W=>{W.isIntersecting&&!(Q&&C)?$e():!W.isIntersecting&&!Q&&!C&&(cancelAnimationFrame(G),clearTimeout(We),X=false);});},{root:ae??null,threshold:T,rootMargin:U}),D;function ue(){clearTimeout(D),D=setTimeout(()=>{_.forEach((b,W)=>{O[W]=Ue(b),b.style.strokeDasharray=`${O[W]}`;});},150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),I>0?setTimeout(()=>S.observe(e),I):S.observe(e),{destroy(){cancelAnimationFrame(G),clearTimeout(We),S.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(D);},replay(){Ve=0,$e();},pause(){ce||!X||(ce=true,y=performance.now()-c,cancelAnimationFrame(G));},resume(){ce&&(ce=false,X=true,c=performance.now()-y,G=requestAnimationFrame(Ie));},seek(b){let W=Math.min(1,Math.max(0,b));Re=W,ce=true,y=W*s,c=performance.now()-y,cancelAnimationFrame(G),xe(y);},getProgress(){return Re},refresh(){clearTimeout(D),_.forEach((b,W)=>{O[W]=Ue(b),b.style.strokeDasharray=`${O[W]}`;});}}}if(Ee)return gt(gn());kt();function It(){if(ce||!Qe)return;let s=performance.now(),c=Xe();if(!Be&&v===false&&c===Ct){ht(c);return}Be=false,Ct=c;let y=f;if(v!==false){let S=s-$t,D=S>0?Math.abs(c-(ot<0?c:ot))/S:0;y=f*Math.max(.2,1+D*(typeof v=="number"?v:1)*.04);}ot=c,$t=s;let X=be?_e===-1||c>=_e?"forward":"reverse":$;_e=c;let xe=p-l,Ie=true,$e=xe===0?0:(c-l)/xe;if(isNaN(je)||(je<=0&&$e>0?k?.():je>0&&$e<=0&&Se?.(),je<1&&$e>=1?te?.():je>=1&&$e<1&&pe?.()),je=$e,Z){let S=E(ee(c,l,p,y));Q&&!be&&(q=Math.max(q,S),S=q),Re=S,e.style.setProperty("--scroll-draw-progress",String(S));let D=X==="reverse"?1-S:S;e.style.clipPath=ke(D),u?.(S),!V&&ee(c,l,p,y)>0&&(V=true,A?.()),S>=1&&!C?(C=true,h?.(),Ve<(N==="infinite"?1/0:N??0)&&(Ve++,We=setTimeout(()=>{q=-1,V=false,C=false,e.style.clipPath=ke(0);},B))):S<1&&!Q&&(C=false),ht(c);return}if(_.forEach((S,D)=>{let ue=D*Ce*xe,b=E(ee(c,l+ue,p+ue,y));Q&&!be&&(b=Ne[D]=Math.max(Ne[D]??q,b)),S.style.strokeDashoffset=X==="reverse"?`${O[D]*b}`:`${O[D]*(1-b)}`,m&&(S.style.opacity=X==="reverse"?`${1-b}`:`${b}`),le&&ne?S.style.stroke=Ye(le,ne,b):ne&&(S.style.stroke=ne),re!==null&&Y!==null?S.style.strokeWidth=`${re+(Y-re)*b}`:Y!==null&&(S.style.strokeWidth=`${Y}`),ge!==null&&J!==null?S.style.fillOpacity=`${ge+(J-ge)*b}`:J!==null&&(S.style.fillOpacity=`${J}`),L&&S.tagName.toLowerCase()==="path"&&we[D]&&S.setAttribute("d",vt(we[D],L,b)),D===0&&(Re=b,u?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Ie=false);}),w){let S=E(ee(c,l,p,y));for(let D in w){let ue=parseFloat(D);S>=ue&&!qe.has(ue)&&(qe.add(ue),w[D]?.());}}!V&&ee(c,l,p,y)>0&&(V=true,A?.()),Ie&&!C?(C=true,h?.(),Ve<(N==="infinite"?1/0:N??0)&&(Ve++,We=setTimeout(()=>{q=-1,Ne=[],V=false,C=false,qe.clear(),st(),Be=true;},B))):!Ie&&!Q&&(C=false),ht(c);}function yt(s){return s>=p&&s<Te}function ht(s){ze||yt(s)?G=requestAnimationFrame(It):Qe=false;}function bt(){return ze||yt(Xe())}let Qe=false;function it(){Qe||(Qe=true,G=requestAnimationFrame(function(){It();}));}function at(){Qe=false,cancelAnimationFrame(G);}let wt=new IntersectionObserver(s=>{s.forEach(c=>{ze=c.isIntersecting,ze&&!ce?(Be=true,it()):Qe&&!ce&&yt(Xe())||at();});},{root:ae??null,threshold:T,rootMargin:U});function Dt(){_.forEach((s,c)=>{O[c]=Ue(s),s.style.strokeDasharray=`${O[c]}`;}),kt(),Be=true;}let lt;function Ke(){clearTimeout(lt),lt=setTimeout(Dt,150);}window.addEventListener("resize",Ke),window.addEventListener("orientationchange",Ke);let yn=De([e],Ke);return I>0?setTimeout(()=>wt.observe(e),I):wt.observe(e),gt({destroy(){cancelAnimationFrame(G),clearTimeout(We),at(),wt.disconnect(),yn(),window.removeEventListener("resize",Ke),window.removeEventListener("orientationchange",Ke),clearTimeout(lt),At();},replay(){q=-1,Ne=[],_e=-1,ot=-1,V=false,C=false,Ve=0,ce=false,Re=0,qe.clear(),clearTimeout(We),st(),Be=true,bt()&&it();},pause(){ce=true,at();},resume(){ce&&(ce=false,Be=true,bt()&&it());},seek(s){let c=Math.min(1,Math.max(0,s));Re=c,q=c,Ne=[],ce=true,at(),mn(c,$),Be=true;},getProgress(){return Re},refresh(){clearTimeout(lt),Dt(),bt()&&!ce&&it();}},()=>({tStart:l,tEnd:p}))}var Yt=new WeakMap,On=0;function Xt(e){return JSON.stringify(e,(n,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let r=Yt.get(t);return r===void 0&&Yt.set(t,r=++On),`el#${r}`}return t})}function Kt(e,n){let t={...e};for(let r of Object.keys(t))typeof t[r]=="function"&&(t[r]=(...o)=>n()[r]?.(...o));return t}function Pn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Zt(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let o=[],i=[],a=r[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let m=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}n.push({fn:r[1],nums:o,units:i});}return n}function kn(e,n,t){let r=Zt(e),o=Zt(n);return r.length===0||r.length!==o.length?t<1?e:n:r.map((i,a)=>{let f=o[a];return i.fn!==f.fn||i.nums.length!==f.nums.length?t<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${f.fn}(${f.nums.map((m,d)=>`${m}${f.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(f.nums[d]-m)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function Jt(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),o=String(n);if(Pn(r))return Ye(r,o,t);if(r.includes("("))return kn(r,o,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let f=parseFloat(i[1]),m=parseFloat(a[1]);return `${f+(m-f)*t}${i[2]||a[2]}`}return t<1?r:o}function Rn(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var In=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Dn=0,en="--scroll-draw-progress";function Fn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var nn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,n){return typeof window>"u"?nn:n.respectReducedMotion===false?tn(e,n,false):Ge(n,(t,r)=>tn(e,t,r))}function tn(e,n,t){let{props:r,trigger:o={},easing:i="ease-out",speed:a=1,once:f=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:F=false,triggerElement:$,onProgress:Q,onComplete:fe,onEnter:R,onLeave:se,onEnterBack:be,onLeaveBack:I}=n,H=typeof i=="function"?i:oe[i]??oe["ease-out"],P=ye(o.start??"top bottom"),M=ye(o.end??"bottom top"),w=$??e,v=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(r).map(([l,p])=>({prop:Rn(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function U(){let l=window.getComputedStyle(e);for(let p of T)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function N(){for(let l of T)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...T.map(p=>p.prop),en])B.set(l,e.style.getPropertyValue(l));function L(){for(let[l,p]of B)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(t)return N(),fe?.(),{...nn,destroy:L,getProgress:()=>1};U();let me=typeof i=="string"?ut(i):null;function Ee(){if(!x||!Fn()||!me||m!=="y"||v||w!==e||f||a!==1||Q||fe||R||se||be||I||F!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let l of T)if(!In.has(l.prop))return false;return true}function ie(){let l=`ssd-a-${++Dn}`,p=T.map(q=>`${q.prop}:${q.from}`).join(";"),Ce=T.map(q=>`${q.prop}:${q.to}`).join(";"),Te=document.createElement("style");Te.setAttribute("data-ssd-animate",""),Te.textContent=`@keyframes ${l}{from{${p}}to{${Ce}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${me};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(Te),e.classList.add(l);let C=()=>m==="x"?window.scrollX:window.scrollY,V=()=>m==="x"?window.innerWidth:window.innerHeight,G=()=>{let q=e.getBoundingClientRect();return Le({top:q.top,height:q.height},C(),V(),P,M)};Oe(e,{type:"animate",getProgress:()=>ze.getProgress(),getTrigger:G});let ze={refresh(){},destroy(){e.classList.remove(l),Te.remove(),e.style.animationPlayState="",L(),Pe(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(q){let Ne=Math.min(1,Math.max(0,q));e.classList.remove(l);for(let _e of T)e.style.setProperty(_e.prop,Jt(_e.from,_e.to,Ne));},getProgress(){let{tStart:q,tEnd:Ne}=G();return H(ee(C(),q,Ne,a))}};return ze}if(Ee())return ie();let z=0,u=0,A=0,h=false,k=false,te=-1,pe=0,Se=false,Z=NaN,E=-1,de=0,Ae=()=>v?m==="x"?v.scrollLeft:v.scrollTop:m==="x"?window.scrollX:window.scrollY,ae=()=>v?m==="x"?v.clientWidth:v.clientHeight:m==="x"?window.innerWidth:window.innerHeight,le=w===e?T:[],ne=false;function re(){let l=e.style,p=le.map(V=>l.getPropertyValue(V.prop)),Ce=l.transition;le.length&&(l.transition="none"),le.forEach(V=>l.setProperty(V.prop,B.get(V.prop)??""));let Te=ct(w,v,m);le.forEach((V,G)=>l.setProperty(V.prop,p[G])),le.length&&(e.offsetWidth,l.transition=Ce);let C=Le(Te,Te.scroll,ae(),P,M);ne&&Math.abs(C.tStart-z)<1&&Math.abs(C.tEnd-u)<1||(ne=true,z=C.tStart,u=C.tEnd);}function Y(l){e.style.setProperty(en,String(l));for(let p of T)e.style.setProperty(p.prop,Jt(p.from,p.to,l));Q?.(l);}function ge(l){if(isNaN(Z)){Z=l;return}Z<=0&&l>0?R?.():Z>0&&l<=0&&I?.(),Z<1&&l>=1?se?.():Z>=1&&l<1&&be?.(),Z=l;}function J(){if(!h||k)return;let l=performance.now(),p=Ae(),Ce=a;if(F!==false){let V=l-de,G=V>0?Math.abs(p-(E<0?p:E))/V:0;Ce=a*Math.max(.2,1+G*(typeof F=="number"?F:1)*.04);}E=p,de=l;let Te=u===z?0:(p-z)/(u-z);ge(Te);let C=H(ee(p,z,u,Ce));f&&(te=Math.max(te,C),C=te),pe=C,Y(C),C>=1&&!Se?(Se=true,fe?.()):C<1&&!f&&(Se=false),A=requestAnimationFrame(J);}re(),u===z&&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 l=H(ee(Ae(),z,u,a));f&&l>0&&(te=l),pe=l,Y(l);}let ke=new IntersectionObserver(l=>{l.forEach(p=>{h=p.isIntersecting,h&&!k?A=requestAnimationFrame(J):cancelAnimationFrame(A);});},{root:v??null}),_;function O(){clearTimeout(_),_=setTimeout(re,150);}window.addEventListener("resize",O),window.addEventListener("orientationchange",O);let we=De([w],O);return ke.observe(e),Oe(e,{type:"animate",getProgress:()=>pe,getTrigger:()=>({tStart:z,tEnd:u})}),{destroy(){cancelAnimationFrame(A),ke.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),we(),clearTimeout(_),L(),Pe(e);},replay(){te=-1,Se=false,pe=0,k=false,Y(0);},pause(){k=true,cancelAnimationFrame(A);},resume(){k&&(k=false,h&&(A=requestAnimationFrame(J)));},seek(l){let p=Math.min(1,Math.max(0,l));pe=p,te=p,k=true,cancelAnimationFrame(A),Y(p);},getProgress(){return pe},refresh(){re();}}}var Tt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function xt(e,n){if(typeof window>"u")return Tt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(n,(r,o)=>Hn(t,r,o)):(he("scrollCounter: element not found:",e),Tt)}function Hn(e,n,t){let{from:r=0,to:o,format:i,easing:a="ease-out",trigger:f={},once:m=true,decimals:d,onComplete:x}=n,F=d!==void 0?u=>u.toFixed(d):i??(u=>String(Math.round(u))),$=typeof a=="function"?a:oe[a]??oe["ease-out"],Q=ye(f.start??"top 80%"),fe=ye(f.end??"top 20%");if(t)return e.textContent=F(o),x?.(),{...Tt,getProgress:()=>1};let R=0,se=0,be=false,I=0,H=false,P=false,M=-1,w=0,v=false,T=()=>window.scrollY,U=()=>window.innerHeight;function N(){let u=e.getBoundingClientRect(),A=Le({top:u.top,height:u.height},T(),U(),Q,fe);be&&Math.abs(A.tStart-R)<1&&Math.abs(A.tEnd-se)<1||(be=true,R=A.tStart,se=A.tEnd);}function B(u){e.textContent=F(r+(o-r)*u),e.style.setProperty("--scroll-draw-progress",String(u));}function L(){if(!H||P)return;let u=$(ee(T(),R,se,1));m&&(M=Math.max(M,u),u=M),w=u,B(u),u>=1&&!v?(v=true,x?.()):u<1&&!m&&(v=false),I=requestAnimationFrame(L);}N();{let u=$(ee(T(),R,se,1));m&&u>0&&(M=u),w=u,B(u);}let me=new IntersectionObserver(u=>{u.forEach(A=>{H=A.isIntersecting,H&&!P?I=requestAnimationFrame(L):cancelAnimationFrame(I);});}),Ee;function ie(){clearTimeout(Ee),Ee=setTimeout(N,150);}window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie);let z=De([e],ie);return me.observe(e),Oe(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:R,tEnd:se})}),{destroy(){cancelAnimationFrame(I),me.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),z(),clearTimeout(Ee),Pe(e);},replay(){M=-1,v=false,w=0,P=false,B(0);},pause(){P=true,cancelAnimationFrame(I);},resume(){P&&(P=false,H&&(I=requestAnimationFrame(L)));},seek(u){let A=Math.min(1,Math.max(0,u));w=A,M=A,P=true,cancelAnimationFrame(I),B(A);},getProgress(){return w}}}var rn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Mt(e,n={}){if(typeof window>"u")return rn;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),rn;let r=t,{trigger:o={},easing:i="linear",once:a=false,axis:f="y",preload:m="auto",triggerElement:d,onReady:x,onComplete:F,onProgress:$}=n,Q=d??r,fe=window.matchMedia("(prefers-reduced-motion: reduce)").matches,R=typeof i=="function"?i:oe[i]??oe.linear,se=ye(o.start??"top top"),be=ye(o.end??"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=m);let I=n.from??0,H=n.to,P=0,M=0,w=0,v=false,T=false,U=-1,N=0,B=false,L=false,me=()=>f==="x"?window.scrollX:window.scrollY,Ee=()=>f==="x"?window.innerWidth:window.innerHeight;function ie(){let E=Q.getBoundingClientRect(),de=f==="x"?E.left:E.top,Ae=f==="x"?E.width:E.height,ae=Le({top:de,height:Ae},me(),Ee(),se,be);P=ae.tStart,M=ae.tEnd,L&&M===P&&he("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let z=NaN;function u(E){if(!L)return;let de=H??r.duration??0,Ae=I+(de-I)*E;Ae!==z&&(z=Ae,r.currentTime=Ae),r.style.setProperty("--scroll-draw-progress",String(E)),$?.(E);}function A(){if(!v||T||!L||fe)return;let E=R(ee(me(),P,M,1));a&&(U=Math.max(U,E),E=U),N=E,u(E),E>=1&&!B?(B=true,F?.()):E<1&&!a&&(B=false),w=requestAnimationFrame(A);}function h(){if(L=true,H===void 0&&(H=r.duration),fe){u(1),x?.();return}ie(),x?.(),v&&!T&&(w=requestAnimationFrame(A));}r.readyState>=1?h():r.addEventListener("loadedmetadata",h,{once:true}),L||ie();let k=fe?()=>{}:pt(E=>{E&&(k(),fe=true,cancelAnimationFrame(w),u(1));}),te=new IntersectionObserver(E=>{E.forEach(de=>{v=de.isIntersecting,v&&!T&&L?w=requestAnimationFrame(A):cancelAnimationFrame(w);});}),pe;function Se(){clearTimeout(pe),pe=setTimeout(ie,150);}window.addEventListener("resize",Se),window.addEventListener("orientationchange",Se);let Z=De([Q],Se);return te.observe(r),Oe(r,{type:"video",getProgress:()=>N,getTrigger:()=>({tStart:P,tEnd:M})}),{destroy(){cancelAnimationFrame(w),te.disconnect(),r.removeEventListener("loadedmetadata",h),window.removeEventListener("resize",Se),window.removeEventListener("orientationchange",Se),Z(),k(),clearTimeout(pe),Pe(r);},replay(){U=-1,B=false,N=0,T=false,z=NaN,u(0);},pause(){T=true,cancelAnimationFrame(w);},resume(){T&&(T=false,v&&L&&(w=requestAnimationFrame(A)));},seek(E){let de=Math.min(1,Math.max(0,E));N=de,U=de,T=true,cancelAnimationFrame(w),z=NaN,u(de);},getProgress(){return N}}}function on(e,n){let t=document.createElement("span");t.textContent=n,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function ln(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(r.textContent=t,r.style.whiteSpace="pre"):(r.textContent=t,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(t)?null:r}).filter(t=>t!==null)}function Nn(e){let n=e.textContent??"";return e.textContent="",n.split("").map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=t,t===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),t===" "?null:r}).filter(t=>t!==null)}function sn(e){let n=ln(e),t=new Map;for(let i of n){let a=i.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(i);}let r=[],o=Array.from(t.keys()).sort((i,a)=>i-a);for(let i of o){let a=t.get(i),f=document.createElement("span");f.setAttribute("aria-hidden","true"),f.style.display="inline-block",a.forEach((m,d)=>{let x=m.nextElementSibling;f.appendChild(m),d<a.length-1&&x&&x.style.whiteSpace==="pre"&&f.appendChild(x);}),r.push(f);}return e.textContent="",r.forEach((i,a)=>{e.appendChild(i),a<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Vn(e,n,t,r){if(t<=1||r===0)return e;let o=(t-1)*r,i=n*r,a=i+(1-o);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function zn(e,n){let t=[];if(n?.y!==void 0&&t.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&t.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&t.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let r=n.scale+(1-n.scale)*e;t.push(`scale(${r})`);}return t.join(" ")||""}var an={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lt(e,n={}){if(typeof window>"u")return an;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return he("scrollText: element not found:",e),an;let r=t;return Ge(n,(o,i)=>_n(r,o,i))}function _n(e,n,t){let{split:r="words",stagger:o=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:f={},once:m=true,onComplete:d}=n,x=typeof i=="function"?i:oe[i]??oe["ease-out"],F=ye(f.start??"top 85%"),$=ye(f.end??"top 40%"),Q=e.innerHTML,fe=e.textContent??"",R;r==="chars"?R=Nn(e):r==="lines"?R=sn(e):R=ln(e),on(e,fe);let se=R.length;function be(h,k){a?.opacity!==void 0&&(h.style.opacity=String(a.opacity+(1-a.opacity)*k));let te=zn(k,a);te&&(h.style.transform=te);}function I(h){e.style.setProperty("--scroll-draw-progress",String(h)),R.forEach((k,te)=>{let pe=x(Vn(h,te,se,o));be(k,pe);});}if(t)return I(1),d?.(),{destroy(){e.innerHTML=Q;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};I(0);let H=0,P=0,M=0,w=false,v=false,T=-1,U=0,N=false,B=()=>window.scrollY,L=()=>window.innerHeight;function me(){let h=e.getBoundingClientRect(),k=Le({top:h.top,height:h.height},B(),L(),F,$);H=k.tStart,P=k.tEnd;}function Ee(){if(!w||v)return;let h=ee(B(),H,P,1);m&&(T=Math.max(T,h),h=T),U=h,I(h),h>=1&&!N?(N=true,d?.()):h<1&&!m&&(N=false),M=requestAnimationFrame(Ee);}me();let ie=new IntersectionObserver(h=>{h.forEach(k=>{w=k.isIntersecting,w&&!v?M=requestAnimationFrame(Ee):cancelAnimationFrame(M);});}),z;function u(){clearTimeout(z),z=setTimeout(()=>{if(r==="lines"){let h=U;e.innerHTML=Q,R=sn(e),on(e,fe),I(h);}me();},150);}window.addEventListener("resize",u),window.addEventListener("orientationchange",u);let A=De([e],u);return ie.observe(e),Oe(e,{type:"text",getProgress:()=>U,getTrigger:()=>({tStart:H,tEnd:P})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",u),window.removeEventListener("orientationchange",u),A(),clearTimeout(z),e.innerHTML=Q,Pe(e);},replay(){T=-1,N=false,U=0,v=false,I(0);},pause(){v=true,cancelAnimationFrame(M);},resume(){v&&(v=false,w&&(M=requestAnimationFrame(Ee)));},seek(h){let k=Math.min(1,Math.max(0,h));U=k,T=k,v=true,cancelAnimationFrame(M),I(k);},getProgress(){return U}}}var rt=e=>typeof e=="function"?e():vue.unref(e);function He(e,n,t){let r=null,o=n(),i=()=>{r?.destroy(),r=e.value?t(e.value,Kt(o,()=>o)):null;};vue.onMounted(i),vue.watch(()=>Xt(o=n()),i),vue.onUnmounted(()=>{r?.destroy(),r=null;});}function io(e={}){let n=vue.ref(null);return He(n,()=>rt(e),Et),n}var cn={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},jn=[null,Boolean,[Boolean,String],[Boolean,Number]],un=e=>({type:e,default:void 0}),ao=vue.defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(cn).map(([e,n])=>[e,n?un(jn[n]):null])),setup(e,{slots:n}){let t=vue.ref(null);return He(t,()=>{let r={};for(let o in cn){let i=e[o];i!=null&&(r[o]=i);}return r},Et),()=>vue.h("div",{ref:t},n.default?.())}});function lo(e){let n=vue.ref(null);return He(n,()=>rt(e),St),n}var co=vue.defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:n}){let t=vue.ref(null);return He(t,()=>e.options,St),()=>vue.h("div",{ref:t},n.default?.())}});function uo(e){let n=vue.ref(null);return He(n,()=>rt(e),xt),n}var fo=vue.defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:un(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let n=vue.ref(null);return He(n,()=>{let t={to:e.to};return e.from!=null&&(t.from=e.from),e.format!=null&&(t.format=e.format),e.easing!=null&&(t.easing=e.easing),e.trigger!=null&&(t.trigger=e.trigger),e.once!=null&&(t.once=e.once),e.decimals!=null&&(t.decimals=e.decimals),e.onComplete!=null&&(t.onComplete=e.onComplete),t},xt),()=>vue.h("span",{ref:n})}});function mo(e={}){let n=vue.ref(null);return He(n,()=>rt(e),Mt),n}var po=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 He(n,()=>e.options??{},Mt),()=>vue.h("video",{ref:n,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function go(e={}){let n=vue.ref(null);return He(n,()=>rt(e),Lt),n}var yo=vue.defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:n}){let t=vue.ref(null);return He(t,()=>e.options??{},Lt),()=>vue.h(e.tag,{ref:t},n.default?.())}});exports.ScrollAnimate=co;exports.ScrollCounter=fo;exports.ScrollDraw=ao;exports.ScrollText=yo;exports.ScrollVideo=po;exports.useScrollAnimate=lo;exports.useScrollCounter=uo;exports.useScrollDraw=io;exports.useScrollText=go;exports.useScrollVideo=mo;
|
package/dist/vue/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { a as ScrollDrawOptions } from '../types-MswK0erX.mjs';
|
|
4
|
-
import { S as ScrollAnimateOptions } from '../engine-
|
|
4
|
+
import { S as ScrollAnimateOptions } from '../engine-o1VSQ1lX.mjs';
|
|
5
5
|
import { S as ScrollCounterOptions } from '../index-CdaBYn3A.mjs';
|
|
6
6
|
import { ScrollVideoOptions } from '../video/index.mjs';
|
|
7
7
|
import { ScrollTextOptions } from '../text/index.mjs';
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { Ref } from 'vue';
|
|
3
3
|
import { a as ScrollDrawOptions } from '../types-MswK0erX.js';
|
|
4
|
-
import { S as ScrollAnimateOptions } from '../engine-
|
|
4
|
+
import { S as ScrollAnimateOptions } from '../engine-B7UpB4fT.js';
|
|
5
5
|
import { S as ScrollCounterOptions } from '../index-D3o4vT3e.js';
|
|
6
6
|
import { ScrollVideoOptions } from '../video/index.js';
|
|
7
7
|
import { ScrollTextOptions } from '../text/index.js';
|
package/dist/vue/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-VMUJMXKO.mjs';import'../chunk-XSVTHCLO.mjs';import'../chunk-KV3WCPQ5.mjs';import'../chunk-DY5JCXVR.mjs';import'../chunk-WXUOF4NM.mjs';import'../chunk-LTCJVVSC.mjs';import'../chunk-HX4SP5WN.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${$?`left:${b}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${b}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(o),window.addEventListener("scroll",i,{passive:true}),i(),{el:o,destroy(){window.removeEventListener("scroll",i),o.remove();}}}var Pt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Dt=/[MmLlHhVvCcSsQqTtAaZz]/g;function er(e,r,n){if(!Se)return;let o=(e.match(Dt)??[]).join("").toUpperCase(),i=(r.match(Dt)??[]).join("").toUpperCase(),u=(e.match(Pt)??[]).length,m=(r.match(Pt)??[]).length;if(o!==i){de(`morphTo: command sequence differs (${o||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}u!==m&&de(`morphTo: coordinate count differs (${u} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function Xe(e,r,n){let o=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,u=>{let m=parseFloat(u),b=o[i++]??m;return String(+(m+(b-m)*n).toFixed(4))})}function Ct(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...o}=r,i=n?{...wt[n],...o}:o,u=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:m="path, polyline, line, polygon, rect, circle",speed:b=1,fade:$=false,easing:y="linear",trigger:w={},stagger:k=0,direction:v="forward",once:te=false,debug:Ot=false,axis:X="y",scrollContainer:Fe,autoReverse:Te=false,delay:ge=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ye=false,threshold:Ye=0,rootMargin:Je="0px",repeat:ie=0,repeatDelay:Ve=0,morphTo:N,clip:ze,autoplay:Rt=false,duration:It=1e3,native:Nt=true,onProgress:he,onStart:Ae,onComplete:ce,onEnter:Ke,onLeave:Ze,onEnterBack:et,onLeaveBack:tt}=i,Y=ze===true?"left":typeof ze=="string"?ze:false,ae=typeof y=="function"?y:Ee[y]??Ee.linear,rt=je(w.start??"top bottom"),nt=je(w.end??"bottom top"),W=typeof Fe=="string"?document.querySelector(Fe):Fe??null,B=Array.isArray(re)?re[0]:null,L=Array.isArray(re)?re[1]:typeof re=="string"?re:null,O=Array.isArray(ne)?ne[0]:null,P=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,R=Array.isArray(se)?se[0]:null,D=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function le(t){let s=t*100;switch(Y){case "right":return `inset(0 0 0 ${100-s}%)`;case "top":return `inset(0 0 ${100-s}% 0)`;case "bottom":return `inset(${100-s}% 0 0 0)`;case "center":return `circle(${t*150}% at 50% 50%)`;default:return `inset(0 ${100-s}% 0 0)`}}let x=Y?[]:Array.from(e.querySelectorAll(m)),d=[],_=[],F=0,V=0,Me=k,st=0,M=false,G=false,I=0,ke=false,J=-1,be=[],Le=-1,T=false,U=0,Q=0,K,He=null;function ot(){He?.destroy(),He=null;}let Z=new Set,it=NaN,ee=true,Pe=-1,at=performance.now(),fe=NaN;function we(){return W?X==="x"?W.scrollLeft:W.scrollTop:X==="x"?window.scrollX:window.scrollY}function lt(){return W?X==="x"?W.clientWidth:W.clientHeight:X==="x"?window.innerWidth:window.innerHeight}function ut(){let t=ht(e,W,X);return Qe(t,t.scroll,lt(),rt,nt)}function _t(){let t=V-F,s=x.length-1,l=W??document.documentElement,E=X==="x"?"Width":"Height";if(Me=k,k>0&&s>0&&t>0){let z=l[`scroll${E}`]-l[`client${E}`]-1-F-t/b;z>=0&&(Me=Math.min(k,z/(s*t)));}st=V+s*Me*t;}function ct(){(({tStart:F,tEnd:V}=ut())),_t(),Ot&&Se&&(ot(),He=Zt(F,V,X));}function We(t,s=ut){$t(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:s});let l=t.destroy;return t.destroy=()=>{l.call(t),Tt(e);},t}function Ft(t,s){if(e.style.setProperty("--scroll-draw-progress",String(t)),Y){let l=s==="reverse"?1-t:t;e.style.clipPath=le(l);return}x.forEach((l,E)=>{l.style.strokeDashoffset=s==="reverse"?`${d[E]*t}`:`${d[E]*(1-t)}`,$&&(l.style.opacity=s==="reverse"?`${1-t}`:`${t}`),B&&L?l.style.stroke=Ie(B,L,t):L&&(l.style.stroke=L),O!==null&&P!==null?l.style.strokeWidth=`${O+(P-O)*t}`:P!==null&&(l.style.strokeWidth=`${P}`),R!==null&&D!==null?l.style.fillOpacity=`${R+(D-R)*t}`:D!==null&&(l.style.fillOpacity=`${D}`),N&&l.tagName.toLowerCase()==="path"&&_[E]&&l.setAttribute("d",Xe(_[E],N,t));});}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),Y){e.style.clipPath=le(0);return}x.forEach((t,s)=>{t.style.strokeDasharray=`${d[s]}`,t.style.strokeDashoffset=v==="reverse"?"0":`${d[s]}`,$?t.style.opacity=v==="reverse"?"1":"0":t.style.opacity="",B&&(t.style.stroke=B),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`),N&&t.tagName.toLowerCase()==="path"&&_[s]&&t.setAttribute("d",_[s]);});}if(x.forEach(t=>{Kt(t);let s=pe(t);d.push(s);let l=t.tagName.toLowerCase()==="path";l?_.push(t.getAttribute("d")??""):_.push(""),N&&(l?er(_[_.length-1],N,t):de(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),u?(t.style.strokeDasharray=`${s}`,t.style.strokeDashoffset=v==="reverse"?`${s}`:"0",$&&(t.style.opacity="1"),L&&(t.style.stroke=L),P!==null&&(t.style.strokeWidth=`${P}`),D!==null&&(t.style.fillOpacity=`${D}`),N&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",N)):(t.style.strokeDasharray=`${s}`,t.style.strokeDashoffset=v==="reverse"?"0":`${s}`,$?t.style.opacity=v==="reverse"?"1":"0":t.style.opacity="",B&&(t.style.stroke=B),O!==null&&(t.style.strokeWidth=`${O}`),R!==null&&(t.style.fillOpacity=`${R}`));}),Y){if(u)return e.style.clipPath=le(1),ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(u)return ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ft=typeof y=="string"?Et(y):null;function Vt(){return !(Nt===false||!Jt()||!x.length||!ft||Y||X!=="y"||W||b!==1||k!==0||te||Te||ye!==false||N||oe||ie||ge>0||he||Ae||ce||Ke||Ze||et||tt||re!=null||ne!=null||se!=null||(w.start??"top bottom").trim()!=="top bottom"||(w.end??"bottom top").trim()!=="bottom top")}function zt(){let t=++Yt,s=`svg-scroll-draw-${t}`,l=`svg-scroll-draw-host-${t}`,E=`--svg-scroll-draw-${t}`,z=v==="reverse"?"0":"var(--ssd-len)",j=v==="reverse"?"var(--ssd-len)":"0",q=`stroke-dashoffset:${z};`,f=`stroke-dashoffset:${j};`;$&&(q+=`opacity:${v==="reverse"?1:0};`,f+=`opacity:${v==="reverse"?0:1};`);let p=document.createElement("style");p.setAttribute("data-svg-scroll-draw",""),p.textContent=`@keyframes ${s}{from{${q}}to{${f}}}.${l}{view-timeline-name:${E};view-timeline-axis:block;}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${ft};animation-fill-mode:both;animation-timeline:${E};animation-range:cover 0% cover 100%;}`,document.head.appendChild(p),e.classList.add(l);function A(a,S){a.style.setProperty("--ssd-len",String(d[S])),a.style.strokeDasharray=`${d[S]}`,a.style.strokeDashoffset="",a.style.opacity="",a.style.animationPlayState="",a.classList.add(s);}x.forEach(A);let c=false,g=-1;function h(){if(g>=0)return g;let a=e.getBoundingClientRect(),{tStart:S,tEnd:H}=Qe({top:a.top,height:a.height},we(),lt(),rt,nt);return ae(ue(we(),S,H,b))}return {destroy(){e.classList.remove(l),x.forEach(a=>{a.classList.remove(s),a.style.removeProperty("--ssd-len"),a.style.animationPlayState="";}),p.remove();},replay(){c=false,g=-1,x.forEach(A);},pause(){c=true,x.forEach(a=>{a.style.animationPlayState="paused";});},resume(){c&&(c=false,x.forEach(a=>{a.style.animationPlayState="running";}));},seek(a){let S=Math.min(1,Math.max(0,a));g=S,c=true,x.forEach((H,C)=>{H.classList.remove(s),H.style.strokeDashoffset=v==="reverse"?`${d[C]*S}`:`${d[C]*(1-S)}`,$&&(H.style.opacity=v==="reverse"?`${1-S}`:`${S}`);});},getProgress(){return h()},refresh(){x.forEach((a,S)=>{d[S]=pe(a),a.style.setProperty("--ssd-len",String(d[S])),a.style.strokeDasharray=`${d[S]}`;});}}}if(Vt())return We(zt());function Ht(){let t=Math.max(1,It),s=0,l=0,E=false;function z(c){let g=true;if(Y){let h=Math.min(1,Math.max(0,c/t)),a=ae(h);U=a,e.style.setProperty("--scroll-draw-progress",String(a)),e.style.clipPath=le(v==="reverse"?1-a:a),he?.(a),h<1&&(g=false);}else x.forEach((h,a)=>{let S=a*k*t,H=Math.min(1,Math.max(0,(c-S)/t)),C=ae(H);h.style.strokeDashoffset=v==="reverse"?`${d[a]*C}`:`${d[a]*(1-C)}`,$&&(h.style.opacity=v==="reverse"?`${1-C}`:`${C}`),B&&L?h.style.stroke=Ie(B,L,C):L&&(h.style.stroke=L),O!==null&&P!==null?h.style.strokeWidth=`${O+(P-O)*C}`:P!==null&&(h.style.strokeWidth=`${P}`),R!==null&&D!==null?h.style.fillOpacity=`${R+(D-R)*C}`:D!==null&&(h.style.fillOpacity=`${D}`),N&&h.tagName.toLowerCase()==="path"&&_[a]&&h.setAttribute("d",Xe(_[a],N,C)),a===0&&(U=C,he?.(C),e.style.setProperty("--scroll-draw-progress",String(C))),H<1&&(g=false);});if(oe){let h=Math.min(1,Math.max(0,c/t)),a=ae(h);for(let S in oe){let H=parseFloat(S);a>=H&&!Z.has(H)&&(Z.add(H),oe[S]?.());}}return g}function j(c){if(T)return;let g=c-s;G||(G=true,Ae?.());let h=z(g);if(h&&!M){M=true,z(t*(1+Math.max(0,x.length-1)*k)),ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{s=performance.now(),G=false,M=false,Z.clear(),De(),I=requestAnimationFrame(j);},Ve));return}h||(I=requestAnimationFrame(j));}function q(){cancelAnimationFrame(I),clearTimeout(K),s=performance.now(),l=0,T=false,G=false,M=false,Q=0,E=true,U=0,Z.clear(),De(),I=requestAnimationFrame(j);}let f=new IntersectionObserver(c=>{c.forEach(g=>{g.isIntersecting&&!(te&&M)?q():!g.isIntersecting&&!te&&!M&&(cancelAnimationFrame(I),clearTimeout(K),E=false);});},{root:W??null,threshold:Ye,rootMargin:Je}),p;function A(){clearTimeout(p),p=setTimeout(()=>{x.forEach((c,g)=>{d[g]=pe(c),c.style.strokeDasharray=`${d[g]}`;});},150);}return window.addEventListener("resize",A),window.addEventListener("orientationchange",A),ge>0?setTimeout(()=>f.observe(e),ge):f.observe(e),{destroy(){cancelAnimationFrame(I),clearTimeout(K),f.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),clearTimeout(p);},replay(){Q=0,q();},pause(){T||!E||(T=true,l=performance.now()-s,cancelAnimationFrame(I));},resume(){T&&(T=false,E=true,s=performance.now()-l,I=requestAnimationFrame(j));},seek(c){let g=Math.min(1,Math.max(0,c));U=g,T=true,l=g*t,s=performance.now()-l,cancelAnimationFrame(I),z(l);},getProgress(){return U},refresh(){clearTimeout(p),x.forEach((c,g)=>{d[g]=pe(c),c.style.strokeDasharray=`${d[g]}`;});}}}if(Rt)return We(Ht());ct();function mt(){if(T||!me)return;let t=performance.now(),s=we();if(!ee&&ye===false&&s===it){qe(s);return}ee=false,it=s;let l=b;if(ye!==false){let f=t-at,p=f>0?Math.abs(s-(Pe<0?s:Pe))/f:0;l=b*Math.max(.2,1+p*(typeof ye=="number"?ye:1)*.04);}Pe=s,at=t;let E=Te?Le===-1||s>=Le?"forward":"reverse":v;Le=s;let z=V-F,j=true,q=z===0?0:(s-F)/z;if(isNaN(fe)||(fe<=0&&q>0?Ke?.():fe>0&&q<=0&&tt?.(),fe<1&&q>=1?Ze?.():fe>=1&&q<1&&et?.()),fe=q,Y){let f=ae(ue(s,F,V,l));te&&!Te&&(J=Math.max(J,f),f=J),U=f,e.style.setProperty("--scroll-draw-progress",String(f));let p=E==="reverse"?1-f:f;e.style.clipPath=le(p),he?.(f),!G&&ue(s,F,V,l)>0&&(G=true,Ae?.()),f>=1&&!M?(M=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{J=-1,G=false,M=false,e.style.clipPath=le(0);},Ve))):f<1&&!te&&(M=false),qe(s);return}if(x.forEach((f,p)=>{let A=p*Me*z,c=ae(ue(s,F+A,V+A,l));te&&!Te&&(c=be[p]=Math.max(be[p]??J,c)),f.style.strokeDashoffset=E==="reverse"?`${d[p]*c}`:`${d[p]*(1-c)}`,$&&(f.style.opacity=E==="reverse"?`${1-c}`:`${c}`),B&&L?f.style.stroke=Ie(B,L,c):L&&(f.style.stroke=L),O!==null&&P!==null?f.style.strokeWidth=`${O+(P-O)*c}`:P!==null&&(f.style.strokeWidth=`${P}`),R!==null&&D!==null?f.style.fillOpacity=`${R+(D-R)*c}`:D!==null&&(f.style.fillOpacity=`${D}`),N&&f.tagName.toLowerCase()==="path"&&_[p]&&f.setAttribute("d",Xe(_[p],N,c)),p===0&&(U=c,he?.(c),e.style.setProperty("--scroll-draw-progress",String(c))),c<1&&(j=false);}),oe){let f=ae(ue(s,F,V,l));for(let p in oe){let A=parseFloat(p);f>=A&&!Z.has(A)&&(Z.add(A),oe[p]?.());}}!G&&ue(s,F,V,l)>0&&(G=true,Ae?.()),j&&!M?(M=true,ce?.(),Q<(ie==="infinite"?1/0:ie??0)&&(Q++,K=setTimeout(()=>{J=-1,be=[],G=false,M=false,Z.clear(),De(),ee=true;},Ve))):!j&&!te&&(M=false),qe(s);}function Ge(t){return t>=V&&t<st}function qe(t){ke||Ge(t)?I=requestAnimationFrame(mt):me=false;}function Be(){return ke||Ge(we())}let me=false;function Ce(){me||(me=true,I=requestAnimationFrame(function(){mt();}));}function Oe(){me=false,cancelAnimationFrame(I);}let Ue=new IntersectionObserver(t=>{t.forEach(s=>{ke=s.isIntersecting,ke&&!T?(ee=true,Ce()):me&&!T&&Ge(we())||Oe();});},{root:W??null,threshold:Ye,rootMargin:Je});function pt(){x.forEach((t,s)=>{d[s]=pe(t),t.style.strokeDasharray=`${d[s]}`;}),ct(),ee=true;}let Re;function ve(){clearTimeout(Re),Re=setTimeout(pt,150);}window.addEventListener("resize",ve),window.addEventListener("orientationchange",ve);let Wt=Mt([e],ve);return ge>0?setTimeout(()=>Ue.observe(e),ge):Ue.observe(e),We({destroy(){cancelAnimationFrame(I),clearTimeout(K),Oe(),Ue.disconnect(),Wt(),window.removeEventListener("resize",ve),window.removeEventListener("orientationchange",ve),clearTimeout(Re),ot();},replay(){J=-1,be=[],Le=-1,Pe=-1,G=false,M=false,Q=0,T=false,U=0,Z.clear(),clearTimeout(K),De(),ee=true,Be()&&Ce();},pause(){T=true,Oe();},resume(){T&&(T=false,ee=true,Be()&&Ce());},seek(t){let s=Math.min(1,Math.max(0,t));U=s,J=s,be=[],T=true,Oe(),Ft(s,v),ee=true;},getProgress(){return U},refresh(){clearTimeout(Re),pt(),Be()&&!T&&Ce();}},()=>({tStart:F,tEnd:V}))}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(k=>this.getAttribute(k)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let u={},m=this.getAttribute("speed"),b=this.getAttribute("easing"),$=this.getAttribute("stagger"),y=this.getAttribute("direction"),w=this.getAttribute("selector");m&&(u.speed=parseFloat(m)),b&&(u.easing=b),$&&(u.stagger=parseFloat($)),y&&(u.direction=y),w&&(u.selector=w),this.hasAttribute("fade")&&(u.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(u.once=this.getAttribute("once")!=="false"),this.instance=Ct(this,u);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}r.observedAttributes=e,customElements.define("scroll-draw",r);}
|
|
1
|
+
'use strict';function Bt({bounces:e=3,decay:r=.5}={}){let n=Math.max(1,Math.round(e)),s=Math.max(.01,Math.min(.99,r)),i=Math.sqrt(s),a=0,m=[];for(let y=0;y<n;y++){let w=Math.pow(i,y);m.push(w),a+=w;}let b=[0],M=0;for(let y=0;y<n;y++)M+=m[y]/a,b.push(M);return y=>{if(y<=0)return 0;if(y>=1)return 1;for(let w=0;w<n;w++)if(y<=b[w+1]){let A=(y-b[w])/(b[w+1]-b[w]);if(w===0)return A*(2-A);let v=1-Math.pow(s,w);return v+(1-v)*(2*A-1)*(2*A-1)}return 1}}function Qt({amplitude:e=1,period:r=.4}={}){let n=Math.max(1,e),s=Math.max(.1,r),i=n<=1?s/4:s/(2*Math.PI)*Math.asin(1/n);return a=>a<=0?0:a>=1?1:n*Math.pow(2,-10*a)*Math.sin((a-i)*(2*Math.PI)/s)+1}var Ee={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Bt(),elastic:Qt()};function pt(e,r,n){return Math.min(n,Math.max(r,e))}function Ue(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[n="top",s="bottom"]=r.split(/\s+/).filter(Boolean);return {element:n,viewport:s}}function gt(e,r,n,s){switch(s){case "top":return e+n;case "center":return e+n+r/2;case "bottom":return e+n+r;default:return e+n}}function yt(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 ue(e,r,n,s){return n===r?0:pt((e-r)/(n-r)*s,0,1)}function je(e,r,n,s,i){let a=gt(e.top,e.height,r,s.element)-yt(s.viewport,n),m=gt(e.top,e.height,r,i.element)-yt(i.viewport,n);return {tStart:a,tEnd:m}}function ht(e,r,n){let s=e.getBoundingClientRect(),i=n==="x"?s.width:s.height;return r?{top:n==="x"?s.left-r.getBoundingClientRect().left+r.scrollLeft:s.top-r.getBoundingClientRect().top+r.scrollTop,height:i,scroll:0}:{top:n==="x"?s.left:s.top,height:i,scroll:n==="x"?window.scrollX:window.scrollY}}function de(e){let r=e.tagName.toLowerCase();if(r==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(r==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function bt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let s=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return s?[parseInt(s[1]),parseInt(s[2]),parseInt(s[3])]:null}function Ie(e,r,n){let s=bt(e),i=bt(r);return !s||!i?e:`rgb(${Math.round(s[0]+(i[0]-s[0])*n)},${Math.round(s[1]+(i[1]-s[1])*n)},${Math.round(s[2]+(i[2]-s[2])*n)})`}var wt={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 Se=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function pe(e,...r){Se&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var Ut="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",jt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",vt=33;function Xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Yt(e){let r=[];for(let n=0;n<vt;n++){let s=n/(vt-1);r.push(String(Math.round(e(s)*1e5)/1e5));}return `linear(${r.join(",")})`}function Et(e){switch(e){case "linear":return "linear";case "ease-in":return Ut;case "ease-out":return jt;case "ease-in-out":return Xt()?Yt(Ee["ease-in-out"]):null;default:return null}}var St=Symbol.for("svg-scroll-draw.registry");function xt(){let e=globalThis;return e[St]||(e[St]=new Map)}function Mt(e,r){xt().set(e,r);}function Tt(e){xt().delete(e);}var xe,Ne=new Set,_e=new WeakMap,Me=new Map,$t=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function Jt(e){let r=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let s=n;s;s=s.previousElementSibling)r.add(s);return r}function kt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>r();xe??(xe=new ResizeObserver(i=>{let a=false;for(let{target:m}of i)_e.get(m)!==$t(m)&&(a=true),_e.set(m,"");a&&Ne.forEach(m=>m());})),Ne.add(n);let s=Jt(e);return [document.body,document.documentElement].forEach(i=>i&&s.add(i)),s.forEach(i=>{_e.has(i)||_e.set(i,$t(i)),Me.set(i,(Me.get(i)??0)+1),xe.observe(i);}),()=>{Ne.delete(n)&&(s.forEach(i=>{let a=(Me.get(i)??1)-1;if(a)return void Me.set(i,a);Me.delete(i),xe?.unobserve(i);}),Ne.size||(xe?.disconnect(),xe=void 0));}}function At(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),n=i=>e(!!i.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",n),()=>r.removeEventListener("change",n);let s=r;return s.addListener?.(n),()=>s.removeListener?.(n)}function Lt(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let n=r(e,false),s=At(a=>{if(!a)return;s();let m=(n.getProgress?.()??0)>=1;n.destroy(),n=r(m?{...e,onComplete:void 0}:e,true);}),i={};for(let a of Object.keys(n))i[a]=(...m)=>n[a]?.(...m);return i.destroy=()=>{s(),n.destroy();},i}var Kt=0;function Zt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Pt(e,r){let n="";try{n=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return n||(e.getAttribute(r)??"").trim()}var Dt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function er(e){if(!Se)return;let r=Pt(e,"stroke");if(!r||r==="none"){pe("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!Dt.has(n)&&!Dt.has(Pt(e,"fill"))&&pe("Element has a fill \u2014 it may obscure the stroke animation.",e);}function tr(e,r,n){let s=document.createElement("div");s.setAttribute("data-svg-scroll-draw-debug",""),s.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 i(){let a=n==="x"?window.scrollX:window.scrollY,m=e-a,b=r-a,M=n==="x";s.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${M?`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;${M?`left:${b}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${b}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(s),window.addEventListener("scroll",i,{passive:true}),i(),{el:s,destroy(){window.removeEventListener("scroll",i),s.remove();}}}var Ot=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,r,n){if(!Se)return;let s=(e.match(Ct)??[]).join("").toUpperCase(),i=(r.match(Ct)??[]).join("").toUpperCase(),a=(e.match(Ot)??[]).length,m=(r.match(Ot)??[]).length;if(s!==i){pe(`morphTo: command sequence differs (${s||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}a!==m&&pe(`morphTo: coordinate count differs (${a} \u2192 ${m}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function Xe(e,r,n){let s=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let m=parseFloat(a),b=s[i++]??m;return String(+(m+(b-m)*n).toFixed(4))})}function Rt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Lt(r,(n,s)=>nr(e,n,s))}function nr(e,r,n){let{preset:s,...i}=r,a=s?{...wt[s],...i}:i,{selector:m="path, polyline, line, polygon, rect, circle",speed:b=1,fade:M=false,easing:y="linear",trigger:w={},stagger:A=0,direction:v="forward",once:te=false,debug:It=false,axis:X="y",scrollContainer:Fe,autoReverse:Te=false,delay:ge=0,strokeColor:re,strokeWidth:ne,fillOpacity:se,waypoints:oe,velocityScale:ye=false,threshold:Ye=0,rootMargin:Je="0px",repeat:ie=0,repeatDelay:Ve=0,morphTo:N,clip:We,autoplay:Nt=false,duration:_t=1e3,native:Ft=true,onProgress:he,onStart:$e,onComplete:ce,onEnter:Ke,onLeave:Ze,onEnterBack:et,onLeaveBack:tt}=a,Y=We===true?"left":typeof We=="string"?We:false,ae=typeof y=="function"?y:Ee[y]??Ee.linear,rt=Ue(w.start??"top bottom"),nt=Ue(w.end??"bottom top"),H=typeof Fe=="string"?document.querySelector(Fe):Fe??null,B=Array.isArray(re)?re[0]:null,L=Array.isArray(re)?re[1]:typeof re=="string"?re:null,C=Array.isArray(ne)?ne[0]:null,P=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,R=Array.isArray(se)?se[0]:null,D=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function le(t){let o=t*100;switch(Y){case "right":return `inset(0 0 0 ${100-o}%)`;case "top":return `inset(0 0 ${100-o}% 0)`;case "bottom":return `inset(${100-o}% 0 0 0)`;case "center":return `circle(${t*150}% at 50% 50%)`;default:return `inset(0 ${100-o}% 0 0)`}}let x=Y?[]:Array.from(e.querySelectorAll(m)),p=[],_=[],F=0,V=0,ke=A,st=0,k=false,G=false,I=0,Ae=false,J=-1,be=[],Le=-1,T=false,Q=0,j=0,K,ze=null;function ot(){ze?.destroy(),ze=null;}let Z=new Set,it=NaN,ee=true,Pe=-1,at=performance.now(),fe=NaN;function we(){return H?X==="x"?H.scrollLeft:H.scrollTop:X==="x"?window.scrollX:window.scrollY}function lt(){return H?X==="x"?H.clientWidth:H.clientHeight:X==="x"?window.innerWidth:window.innerHeight}function ut(){let t=ht(e,H,X);return je(t,t.scroll,lt(),rt,nt)}function Vt(){let t=V-F,o=x.length-1,u=H??document.documentElement,E=X==="x"?"Width":"Height";if(ke=A,A>0&&o>0&&t>0){let W=u[`scroll${E}`]-u[`client${E}`]-1-F-t/b;W>=0&&(ke=Math.min(A,W/(o*t)));}st=V+o*ke*t;}function ct(){(({tStart:F,tEnd:V}=ut())),Vt(),It&&Se&&(ot(),ze=tr(F,V,X));}function He(t,o=ut){Mt(e,{type:"draw",getProgress:()=>t.getProgress(),getTrigger:o});let u=t.destroy;return t.destroy=()=>{u.call(t),Tt(e);},t}function Wt(t,o){if(e.style.setProperty("--scroll-draw-progress",String(t)),Y){let u=o==="reverse"?1-t:t;e.style.clipPath=le(u);return}x.forEach((u,E)=>{u.style.strokeDashoffset=o==="reverse"?`${p[E]*t}`:`${p[E]*(1-t)}`,M&&(u.style.opacity=o==="reverse"?`${1-t}`:`${t}`),B&&L?u.style.stroke=Ie(B,L,t):L&&(u.style.stroke=L),C!==null&&P!==null?u.style.strokeWidth=`${C+(P-C)*t}`:P!==null&&(u.style.strokeWidth=`${P}`),R!==null&&D!==null?u.style.fillOpacity=`${R+(D-R)*t}`:D!==null&&(u.style.fillOpacity=`${D}`),N&&u.tagName.toLowerCase()==="path"&&_[E]&&u.setAttribute("d",Xe(_[E],N,t));});}function De(){if(e.style.setProperty("--scroll-draw-progress","0"),Y){e.style.clipPath=le(0);return}x.forEach((t,o)=>{t.style.strokeDasharray=`${p[o]}`,t.style.strokeDashoffset=v==="reverse"?"0":`${p[o]}`,M?t.style.opacity=v==="reverse"?"1":"0":t.style.opacity="",B&&(t.style.stroke=B),C!==null&&(t.style.strokeWidth=`${C}`),R!==null&&(t.style.fillOpacity=`${R}`),N&&t.tagName.toLowerCase()==="path"&&_[o]&&t.setAttribute("d",_[o]);});}if(x.forEach(t=>{er(t);let o=de(t);p.push(o);let u=t.tagName.toLowerCase()==="path";u?_.push(t.getAttribute("d")??""):_.push(""),N&&(u?rr(_[_.length-1],N,t):pe(`morphTo only applies to <path> elements \u2014 ignored on <${t.tagName}>.`,t)),n?(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=v==="reverse"?`${o}`:"0",M&&(t.style.opacity="1"),L&&(t.style.stroke=L),P!==null&&(t.style.strokeWidth=`${P}`),D!==null&&(t.style.fillOpacity=`${D}`),N&&t.tagName.toLowerCase()==="path"&&t.setAttribute("d",N)):(t.style.strokeDasharray=`${o}`,t.style.strokeDashoffset=v==="reverse"?"0":`${o}`,M?t.style.opacity=v==="reverse"?"1":"0":t.style.opacity="",B&&(t.style.stroke=B),C!==null&&(t.style.strokeWidth=`${C}`),R!==null&&(t.style.fillOpacity=`${R}`));}),Y){if(n)return e.style.clipPath=le(1),ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=le(0);}else if(n)return ce?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ft=typeof y=="string"?Et(y):null;function zt(){return !(Ft===false||!Zt()||!x.length||!ft||Y||X!=="y"||H||b!==1||A!==0||te||Te||ye!==false||N||oe||ie||ge>0||he||$e||ce||Ke||Ze||et||tt||re!=null||ne!=null||se!=null||(w.start??"top bottom").trim()!=="top bottom"||(w.end??"bottom top").trim()!=="bottom top")}function Ht(){let t=++Kt,o=`svg-scroll-draw-${t}`,u=`svg-scroll-draw-host-${t}`,E=`--svg-scroll-draw-${t}`,W=v==="reverse"?"0":"var(--ssd-len)",U=v==="reverse"?"var(--ssd-len)":"0",q=`stroke-dashoffset:${W};`,f=`stroke-dashoffset:${U};`;M&&(q+=`opacity:${v==="reverse"?1:0};`,f+=`opacity:${v==="reverse"?0:1};`);let d=document.createElement("style");d.setAttribute("data-svg-scroll-draw",""),d.textContent=`@keyframes ${o}{from{${q}}to{${f}}}.${u}{view-timeline-name:${E};view-timeline-axis:block;}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ft};animation-fill-mode:both;animation-timeline:${E};animation-range:cover 0% cover 100%;}`,document.head.appendChild(d),e.classList.add(u);function $(l,S){l.style.setProperty("--ssd-len",String(p[S])),l.style.strokeDasharray=`${p[S]}`,l.style.strokeDashoffset="",l.style.opacity="",l.style.animationPlayState="",l.classList.add(o);}x.forEach($);let c=false,g=-1;function h(){if(g>=0)return g;let l=e.getBoundingClientRect(),{tStart:S,tEnd:z}=je({top:l.top,height:l.height},we(),lt(),rt,nt);return ae(ue(we(),S,z,b))}return {destroy(){e.classList.remove(u),x.forEach(l=>{l.classList.remove(o),l.style.removeProperty("--ssd-len"),l.style.animationPlayState="";}),d.remove();},replay(){c=false,g=-1,x.forEach($);},pause(){c=true,x.forEach(l=>{l.style.animationPlayState="paused";});},resume(){c&&(c=false,x.forEach(l=>{l.style.animationPlayState="running";}));},seek(l){let S=Math.min(1,Math.max(0,l));g=S,c=true,x.forEach((z,O)=>{z.classList.remove(o),z.style.strokeDashoffset=v==="reverse"?`${p[O]*S}`:`${p[O]*(1-S)}`,M&&(z.style.opacity=v==="reverse"?`${1-S}`:`${S}`);});},getProgress(){return h()},refresh(){x.forEach((l,S)=>{p[S]=de(l),l.style.setProperty("--ssd-len",String(p[S])),l.style.strokeDasharray=`${p[S]}`;});}}}if(zt())return He(Ht());function Gt(){let t=Math.max(1,_t),o=0,u=0,E=false;function W(c){let g=true;if(Y){let h=Math.min(1,Math.max(0,c/t)),l=ae(h);Q=l,e.style.setProperty("--scroll-draw-progress",String(l)),e.style.clipPath=le(v==="reverse"?1-l:l),he?.(l),h<1&&(g=false);}else x.forEach((h,l)=>{let S=l*A*t,z=Math.min(1,Math.max(0,(c-S)/t)),O=ae(z);h.style.strokeDashoffset=v==="reverse"?`${p[l]*O}`:`${p[l]*(1-O)}`,M&&(h.style.opacity=v==="reverse"?`${1-O}`:`${O}`),B&&L?h.style.stroke=Ie(B,L,O):L&&(h.style.stroke=L),C!==null&&P!==null?h.style.strokeWidth=`${C+(P-C)*O}`:P!==null&&(h.style.strokeWidth=`${P}`),R!==null&&D!==null?h.style.fillOpacity=`${R+(D-R)*O}`:D!==null&&(h.style.fillOpacity=`${D}`),N&&h.tagName.toLowerCase()==="path"&&_[l]&&h.setAttribute("d",Xe(_[l],N,O)),l===0&&(Q=O,he?.(O),e.style.setProperty("--scroll-draw-progress",String(O))),z<1&&(g=false);});if(oe){let h=Math.min(1,Math.max(0,c/t)),l=ae(h);for(let S in oe){let z=parseFloat(S);l>=z&&!Z.has(z)&&(Z.add(z),oe[S]?.());}}return g}function U(c){if(T)return;let g=c-o;G||(G=true,$e?.());let h=W(g);if(h&&!k){k=true,W(t*(1+Math.max(0,x.length-1)*A)),ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,K=setTimeout(()=>{o=performance.now(),G=false,k=false,Z.clear(),De(),I=requestAnimationFrame(U);},Ve));return}h||(I=requestAnimationFrame(U));}function q(){cancelAnimationFrame(I),clearTimeout(K),o=performance.now(),u=0,T=false,G=false,k=false,j=0,E=true,Q=0,Z.clear(),De(),I=requestAnimationFrame(U);}let f=new IntersectionObserver(c=>{c.forEach(g=>{g.isIntersecting&&!(te&&k)?q():!g.isIntersecting&&!te&&!k&&(cancelAnimationFrame(I),clearTimeout(K),E=false);});},{root:H??null,threshold:Ye,rootMargin:Je}),d;function $(){clearTimeout(d),d=setTimeout(()=>{x.forEach((c,g)=>{p[g]=de(c),c.style.strokeDasharray=`${p[g]}`;});},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),ge>0?setTimeout(()=>f.observe(e),ge):f.observe(e),{destroy(){cancelAnimationFrame(I),clearTimeout(K),f.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d);},replay(){j=0,q();},pause(){T||!E||(T=true,u=performance.now()-o,cancelAnimationFrame(I));},resume(){T&&(T=false,E=true,o=performance.now()-u,I=requestAnimationFrame(U));},seek(c){let g=Math.min(1,Math.max(0,c));Q=g,T=true,u=g*t,o=performance.now()-u,cancelAnimationFrame(I),W(u);},getProgress(){return Q},refresh(){clearTimeout(d),x.forEach((c,g)=>{p[g]=de(c),c.style.strokeDasharray=`${p[g]}`;});}}}if(Nt)return He(Gt());ct();function mt(){if(T||!me)return;let t=performance.now(),o=we();if(!ee&&ye===false&&o===it){qe(o);return}ee=false,it=o;let u=b;if(ye!==false){let f=t-at,d=f>0?Math.abs(o-(Pe<0?o:Pe))/f:0;u=b*Math.max(.2,1+d*(typeof ye=="number"?ye:1)*.04);}Pe=o,at=t;let E=Te?Le===-1||o>=Le?"forward":"reverse":v;Le=o;let W=V-F,U=true,q=W===0?0:(o-F)/W;if(isNaN(fe)||(fe<=0&&q>0?Ke?.():fe>0&&q<=0&&tt?.(),fe<1&&q>=1?Ze?.():fe>=1&&q<1&&et?.()),fe=q,Y){let f=ae(ue(o,F,V,u));te&&!Te&&(J=Math.max(J,f),f=J),Q=f,e.style.setProperty("--scroll-draw-progress",String(f));let d=E==="reverse"?1-f:f;e.style.clipPath=le(d),he?.(f),!G&&ue(o,F,V,u)>0&&(G=true,$e?.()),f>=1&&!k?(k=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,K=setTimeout(()=>{J=-1,G=false,k=false,e.style.clipPath=le(0);},Ve))):f<1&&!te&&(k=false),qe(o);return}if(x.forEach((f,d)=>{let $=d*ke*W,c=ae(ue(o,F+$,V+$,u));te&&!Te&&(c=be[d]=Math.max(be[d]??J,c)),f.style.strokeDashoffset=E==="reverse"?`${p[d]*c}`:`${p[d]*(1-c)}`,M&&(f.style.opacity=E==="reverse"?`${1-c}`:`${c}`),B&&L?f.style.stroke=Ie(B,L,c):L&&(f.style.stroke=L),C!==null&&P!==null?f.style.strokeWidth=`${C+(P-C)*c}`:P!==null&&(f.style.strokeWidth=`${P}`),R!==null&&D!==null?f.style.fillOpacity=`${R+(D-R)*c}`:D!==null&&(f.style.fillOpacity=`${D}`),N&&f.tagName.toLowerCase()==="path"&&_[d]&&f.setAttribute("d",Xe(_[d],N,c)),d===0&&(Q=c,he?.(c),e.style.setProperty("--scroll-draw-progress",String(c))),c<1&&(U=false);}),oe){let f=ae(ue(o,F,V,u));for(let d in oe){let $=parseFloat(d);f>=$&&!Z.has($)&&(Z.add($),oe[d]?.());}}!G&&ue(o,F,V,u)>0&&(G=true,$e?.()),U&&!k?(k=true,ce?.(),j<(ie==="infinite"?1/0:ie??0)&&(j++,K=setTimeout(()=>{J=-1,be=[],G=false,k=false,Z.clear(),De(),ee=true;},Ve))):!U&&!te&&(k=false),qe(o);}function Ge(t){return t>=V&&t<st}function qe(t){Ae||Ge(t)?I=requestAnimationFrame(mt):me=false;}function Be(){return Ae||Ge(we())}let me=false;function Oe(){me||(me=true,I=requestAnimationFrame(function(){mt();}));}function Ce(){me=false,cancelAnimationFrame(I);}let Qe=new IntersectionObserver(t=>{t.forEach(o=>{Ae=o.isIntersecting,Ae&&!T?(ee=true,Oe()):me&&!T&&Ge(we())||Ce();});},{root:H??null,threshold:Ye,rootMargin:Je});function dt(){x.forEach((t,o)=>{p[o]=de(t),t.style.strokeDasharray=`${p[o]}`;}),ct(),ee=true;}let Re;function ve(){clearTimeout(Re),Re=setTimeout(dt,150);}window.addEventListener("resize",ve),window.addEventListener("orientationchange",ve);let qt=kt([e],ve);return ge>0?setTimeout(()=>Qe.observe(e),ge):Qe.observe(e),He({destroy(){cancelAnimationFrame(I),clearTimeout(K),Ce(),Qe.disconnect(),qt(),window.removeEventListener("resize",ve),window.removeEventListener("orientationchange",ve),clearTimeout(Re),ot();},replay(){J=-1,be=[],Le=-1,Pe=-1,G=false,k=false,j=0,T=false,Q=0,Z.clear(),clearTimeout(K),De(),ee=true,Be()&&Oe();},pause(){T=true,Ce();},resume(){T&&(T=false,ee=true,Be()&&Oe());},seek(t){let o=Math.min(1,Math.max(0,t));Q=o,J=o,be=[],T=true,Ce(),Wt(o,v),ee=true;},getProgress(){return Q},refresh(){clearTimeout(Re),dt(),Be()&&!T&&Oe();}},()=>({tStart:F,tEnd:V}))}if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(A=>this.getAttribute(A)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let a={},m=this.getAttribute("speed"),b=this.getAttribute("easing"),M=this.getAttribute("stagger"),y=this.getAttribute("direction"),w=this.getAttribute("selector");m&&(a.speed=parseFloat(m)),b&&(a.easing=b),M&&(a.stagger=parseFloat(M)),y&&(a.direction=y),w&&(a.selector=w),this.hasAttribute("fade")&&(a.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(a.once=this.getAttribute("once")!=="false"),this.instance=Rt(this,a);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}r.observedAttributes=e,customElements.define("scroll-draw",r);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'../chunk-
|
|
1
|
+
import {b}from'../chunk-HX4SP5WN.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-YWKPTYSG.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class s extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key="";}connectedCallback(){this.build();}attributeChangedCallback(){this.instance&&this.build();}build(){let i=JSON.stringify(e.map(d=>this.getAttribute(d)));if(this.instance&&i===this.key)return;this.instance?.destroy(),this.key=i;let t={},n=this.getAttribute("speed"),r=this.getAttribute("easing"),a=this.getAttribute("stagger"),c=this.getAttribute("direction"),o=this.getAttribute("selector");n&&(t.speed=parseFloat(n)),r&&(t.easing=r),a&&(t.stagger=parseFloat(a)),c&&(t.direction=c),o&&(t.selector=o),this.hasAttribute("fade")&&(t.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(t.once=this.getAttribute("once")!=="false"),this.instance=b(this,t);}disconnectedCallback(){this.instance?.destroy(),this.instance=null;}}s.observedAttributes=e,customElements.define("scroll-draw",s);}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svg-scroll-draw",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.23.0",
|
|
4
4
|
"description": "Scroll-driven animation for the web — draw SVG paths, reveal elements, pin sections, scrub video. Zero dependencies, native CSS fast path, works with React, Vue, Svelte, Solid, Angular, Astro and vanilla JS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svg",
|
package/dist/chunk-4T5R3ZTL.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a}from'./chunk-AJ22VSHC.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';var w=["delayed","sync","async","nsync","oneByOne","scenario","scenario-sync"],E=["inViewport","manual","autostart"];function u(r,t){let e=parseInt(r,10);return e>=0?e:t}function $(r){if(typeof window>"u")return false;let t=window,e=i=>typeof t[i]=="function"&&r instanceof t[i];return e("SVGSVGElement")||e("SVGGElement")||r?.constructor===t.SVGElement}var y=["cx","cy","points","r","rx","ry","x","x1","x2","y","y1","y2"],V=["line","ellipse","circle","polygon","polyline","rect"],A="http://www.w3.org/2000/svg";function v(r){let t=r.points.trim().split(" ");if(r.points.indexOf(",")===-1){let i=[];for(let s=0;s<t.length;s+=2)i.push(`${t[s]},${t[s+1]}`);t=i;}let e=`M${t[0]}`;for(let i=1;i<t.length;i++)t[i].indexOf(",")!==-1&&(e+=`L${t[i]}`);return e}function b(r,t,e,i){let s=parseFloat(e)||0,a=parseFloat(i)||0,n=parseFloat(r)||0,o=parseFloat(t)||0,l=n-s,h=n+s;return `M${l},${o}A${s},${a} 0,1,1 ${h},${o}A${s},${a} 0,1,1 ${l},${o}`}var x={line:r=>`M${r.x1||0},${r.y1||0}L${r.x2||0},${r.y2||0}`,rect(r){let t=parseFloat(r.x)||0,e=parseFloat(r.y)||0,i=parseFloat(r.width)||0,s=parseFloat(r.height)||0;if(r.rx||r.ry){let a=parseInt(r.rx,10)||-1,n=parseInt(r.ry,10)||-1;a=Math.min(Math.max(a<0?n:a,0),i/2),n=Math.min(Math.max(n<0?a:n,0),s/2);let o=`A ${a},${n},0,0,1,`;return `M ${t+a},${e} L ${t+i-a},${e} ${o}${t+i},${e+n} L ${t+i},${e+s-n} ${o}${t+i-a},${e+s} L ${t+a},${e+s} ${o}${t},${e+s-n} L ${t},${e+n} ${o}${t+a},${e}`}return `M${t} ${e} L${t+i} ${e} L${t+i} ${e+s} L${t} ${e+s} Z`},polyline:v,polygon:r=>`${v(r)}Z`,ellipse:r=>b(r.cx,r.cy,r.rx,r.ry),circle:r=>b(r.cx,r.cy,r.r,r.r)};function L(r){for(let t of Array.from(r.querySelectorAll(V.join(",")))){let e={};for(let{name:a,value:n}of Array.from(t.attributes)){if(y.indexOf(a)!==-1&&n.indexOf("%")!==-1)throw new Error("Pathformer [parseAttr]: a SVG shape got values in percentage. This cannot be transformed into 'path' tags. Please use 'viewBox'.");e[a]=n;}let i=x[t.tagName.toLowerCase()](e),s=document.createElementNS(A,"path");for(let{name:a,value:n}of Array.from(t.attributes))y.indexOf(a)===-1&&s.setAttribute(a,n);s.setAttribute("d",i),t.parentNode?.replaceChild(s,t);}}var c=class c{constructor(t,e,i){this.isReady=false;this.type="delayed";this.start="inViewport";this.duration=120;this.delay=null;this.dashGap=1;this.forceRender=false;this.reverseStack=false;this.selfDestroy=false;this.ignoreInvisible=false;this.animTimingFunction=c.LINEAR;this.pathTimingFunction=c.LINEAR;this.callback=()=>{};this.map=[];this.frameLength=0;this.currentFrame=0;this.delayUnit=0;this.speed=1;this.handle=null;this.instanceCallback=null;this.mustRecalcScale=null;this.viewportListener=null;this.setElement(t,e),this.setOptions(e),this.setCallback(i),this.isReady&&this.init();}setElement(t,e){if(t===void 0)throw new Error('Vivus [constructor]: "element" parameter is required');let i=t;if(typeof i=="string"){let s=document.getElementById(i);if(!s)throw new Error('Vivus [constructor]: "element" parameter is not related to an existing ID');i=s;}if(this.parentEl=i,e&&e.file){let s=new XMLHttpRequest;s.addEventListener("load",()=>{let a=document.createElement("div");a.innerHTML=s.responseText;let n=a.querySelector("svg");if(!n)throw new Error(`Vivus [load]: Cannot find the SVG in the loaded file : ${e.file}`);this.el=n,n.setAttribute("width","100%"),n.setAttribute("height","100%"),this.parentEl.appendChild(n),this.isReady=true,this.init();}),s.open("GET",e.file),s.send();return}if($(i)){this.el=i,this.isReady=true;return}if(i instanceof HTMLObjectElement){let s=i,a=n=>{if(this.isReady)return;let o=s.contentDocument&&s.contentDocument.querySelector("svg");if(!o&&n)throw new Error("Vivus [constructor]: object loaded does not contain any SVG");o&&(s.getAttribute("built-by-vivus")&&(this.parentEl.insertBefore(o,s),this.parentEl.removeChild(s),o.setAttribute("width","100%"),o.setAttribute("height","100%")),this.el=o,this.isReady=true,this.init());};a(),this.isReady||s.addEventListener("load",a);return}throw new Error('Vivus [constructor]: "element" parameter is not valid (or miss the "file" attribute)')}setOptions(t){if(t!==void 0&&(t===null||t.constructor!==Object))throw new Error('Vivus [constructor]: "options" parameter must be an object');let e=t||{};if(e.type&&w.indexOf(e.type)===-1)throw new Error(`Vivus [constructor]: ${e.type} is not an existing animation \`type\``);if(e.start&&E.indexOf(e.start)===-1)throw new Error(`Vivus [constructor]: ${e.start} is not an existing \`start\` option`);this.type=e.type||"delayed",this.start=e.start||"inViewport";let i=navigator.userAgent,s=i.indexOf("MSIE")!==-1||i.indexOf("Trident/")!==-1||i.indexOf("Edge/")!==-1;if(this.duration=u(e.duration,120),this.delay=u(e.delay,null),this.dashGap=u(e.dashGap,1),this.forceRender=Object.prototype.hasOwnProperty.call(e,"forceRender")?!!e.forceRender:s,this.reverseStack=!!e.reverseStack,this.selfDestroy=!!e.selfDestroy,this.onReady=e.onReady,this.map=[],this.ignoreInvisible=Object.prototype.hasOwnProperty.call(e,"ignoreInvisible")?!!e.ignoreInvisible:false,this.animTimingFunction=e.animTimingFunction||c.LINEAR,this.pathTimingFunction=e.pathTimingFunction||c.LINEAR,this.delay!==null&&this.delay>=this.duration)throw new Error("Vivus [constructor]: delay must be shorter than duration")}setCallback(t){if(t&&typeof t!="function")throw new Error('Vivus [constructor]: "callback" parameter must be a function');this.callback=t||(()=>{});}mapping(){let t=0,e=0,i=0,s=false,a=Array.from(this.el.querySelectorAll("path"));a.forEach((n,o)=>{if(this.isInvisible(n))return;let l={el:n,length:0,startAt:0,duration:0,isResizeSensitive:false},h=1;if(n.getAttribute("vector-effect")==="non-scaling-stroke"){let d=n.getBoundingClientRect(),m=n.getBBox();h=Math.max(d.width/m.width,d.height/m.height),l.isResizeSensitive=true,s=true;}if(l.length=Math.ceil(n.getTotalLength()*h),isNaN(l.length)){b$1("vivus: cannot retrieve a path element length",n);return}this.map.push(l),n.style.strokeDasharray=`${l.length} ${l.length+this.dashGap*2}`,n.style.strokeDashoffset=String(l.length+this.dashGap),l.length+=this.dashGap,e+=l.length,this.renderPath(o);}),s&&b$1("vivus: this SVG contains non-scaling-strokes. Call instance.recalc() when the SVG is resized."),e=e===0?1:e,this.delay=this.delay===null?this.duration/3:this.delay,this.delayUnit=this.delay/(a.length>1?a.length-1:1),this.reverseStack&&this.map.reverse(),this.map.forEach((n,o)=>{let l=()=>{let h={};for(let{name:d,value:m}of Array.from(n.el.attributes))h[d]=m;return h};switch(this.type){case "delayed":n.startAt=this.delayUnit*o,n.duration=this.duration-this.delay;break;case "oneByOne":n.startAt=i/e*this.duration,n.duration=n.length/e*this.duration;break;case "sync":case "async":case "nsync":n.startAt=0,n.duration=this.duration;break;case "scenario-sync":{let h=l();n.startAt=t+(u(h["data-delay"],this.delayUnit)||0),n.duration=u(h["data-duration"],this.duration),t=h["data-async"]!==void 0?n.startAt:n.startAt+n.duration,this.frameLength=Math.max(this.frameLength,n.startAt+n.duration);break}case "scenario":{let h=l();n.startAt=u(h["data-start"],this.delayUnit)||0,n.duration=u(h["data-duration"],this.duration),this.frameLength=Math.max(this.frameLength,n.startAt+n.duration);break}}i+=n.length,this.frameLength=this.frameLength||this.duration;});}recalc(){this.mustRecalcScale||(this.mustRecalcScale=requestAnimationFrame(()=>this.performLineRecalc()));}performLineRecalc(){for(let t of this.map){if(!t.isResizeSensitive)continue;let e=t.el.getBoundingClientRect(),i=t.el.getBBox(),s=Math.max(e.width/i.width,e.height/i.height);t.length=Math.ceil(t.el.getTotalLength()*s),t.el.style.strokeDasharray=`${t.length} ${t.length+this.dashGap*2}`;}this.trace(),this.mustRecalcScale=null;}draw(){if(this.currentFrame+=this.speed,this.currentFrame<=0)this.stop(),this.reset();else if(this.currentFrame>=this.frameLength)this.stop(),this.currentFrame=this.frameLength,this.trace(),this.selfDestroy&&this.destroy();else {this.trace(),this.handle=requestAnimationFrame(()=>this.draw());return}this.finished();}finished(){if(this.callback(this),this.instanceCallback){let t=this.instanceCallback;this.instanceCallback=null,t(this);}}trace(){let t=this.animTimingFunction(this.currentFrame/this.frameLength)*this.frameLength;this.map.forEach((e,i)=>{let s=this.pathTimingFunction(Math.max(0,Math.min(1,(t-e.startAt)/e.duration)));e.progress!==s&&(e.progress=s,e.el.style.strokeDashoffset=String(Math.floor(e.length*(1-s))),this.renderPath(i));});}renderPath(t){let e=this.forceRender&&this.map&&this.map[t];if(!e)return;let i=e.el.cloneNode(true);e.el.parentNode?.replaceChild(i,e.el),e.el=i;}init(){this.frameLength=0,this.currentFrame=0,this.map=[],L(this.el),this.mapping(),this.starter(),this.onReady&&this.onReady(this);}starter(){if(this.start==="manual")return;if(this.start==="autostart"){this.play();return}let t=()=>{this.isInViewport(this.parentEl,1)&&(this.play(),window.removeEventListener("scroll",t),this.viewportListener=null);};this.viewportListener=t,window.addEventListener("scroll",t),t();}getStatus(){return this.currentFrame===0?"start":this.currentFrame===this.frameLength?"end":"progress"}reset(){return this.setFrameProgress(0)}finish(){return this.setFrameProgress(1)}setFrameProgress(t){let e=Math.min(1,Math.max(0,t));return this.currentFrame=Math.round(this.frameLength*e),this.trace(),this}play(t,e){this.instanceCallback=null;let i=t;if(i&&typeof i=="function")this.instanceCallback=i,i=void 0;else if(i&&typeof i!="number")throw new Error("Vivus [play]: invalid speed");return e&&typeof e=="function"&&!this.instanceCallback&&(this.instanceCallback=e),this.speed=i||1,a()?(this.stop(),this.currentFrame=this.speed<0?0:this.frameLength,this.trace(),this.speed>0&&this.selfDestroy&&this.destroy(),this.finished(),this):(this.handle||this.draw(),this)}stop(){return this.handle&&(cancelAnimationFrame(this.handle),this.handle=null),this}destroy(){this.stop(),this.viewportListener&&(window.removeEventListener("scroll",this.viewportListener),this.viewportListener=null),this.map.forEach((t,e)=>{t.el.style.strokeDashoffset="",t.el.style.strokeDasharray="",this.renderPath(e);});}isInvisible(t){let e=t.getAttribute("data-ignore");if(e!==null)return e!=="false";if(this.ignoreInvisible){let i=t.getBoundingClientRect();return !i.width&&!i.height}return false}isInViewport(t,e=0){let i=window.pageYOffset||document.documentElement.scrollTop,s=i+Math.max(document.documentElement.clientHeight,window.innerHeight),a=t.getBoundingClientRect(),n=i+a.top;return n+a.height*(e||0)<=s&&n+a.height>=i}};c.LINEAR=t=>t,c.EASE=t=>-Math.cos(t*Math.PI)/2+.5,c.EASE_OUT=t=>1-Math.pow(1-t,3),c.EASE_IN=t=>Math.pow(t,3),c.EASE_OUT_BOUNCE=t=>{let e=-Math.cos(t*(.5*Math.PI))+1,i=Math.pow(e,1.5),s=Math.pow(1-t,2),a=-Math.abs(Math.cos(i*(2.5*Math.PI)))+1;return 1-s+a*s};var p=c,T=p;
|
|
2
|
-
export{p as a,T as b};
|
package/dist/chunk-7SBTYJGH.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,d as d$1,c,b as b$2}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var G={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ne(m,h={}){if(typeof window>"u")return G;let E=typeof m=="string"?document.querySelector(m):m;if(!E||E.tagName.toLowerCase()!=="video")return b("scrollVideo: <video> element not found:",m),G;let t=E,{trigger:P={},easing:b$3="linear",once:z=false,axis:u="y",preload:W="auto",triggerElement:X,onReady:C,onComplete:Y,onProgress:j}=h,I=X??t,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,J=typeof b$3=="function"?b$3:d[b$3]??d.linear,K=a(P.start??"top top"),Q=a(P.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=W);let M=h.from??0,T=h.to,f=0,g=0,o=0,a$2=false,n=false,s=-1,l=0,p=false,i=false,R=()=>u==="x"?window.scrollX:window.scrollY,U=()=>u==="x"?window.innerWidth:window.innerHeight;function A(){let e=I.getBoundingClientRect(),r=u==="x"?e.left:e.top,d=u==="x"?e.width:e.height,O=c({top:r,height:d},R(),U(),K,Q);f=O.tStart,g=O.tEnd,i&&g===f&&b("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let w=NaN;function v(e){if(!i)return;let r=T??t.duration??0,d=M+(r-M)*e;d!==w&&(w=d,t.currentTime=d),t.style.setProperty("--scroll-draw-progress",String(e)),j?.(e);}function y(){if(!a$2||n||!i||V)return;let e=J(b$2(R(),f,g,1));z&&(s=Math.max(s,e),e=s),l=e,v(e),e>=1&&!p?(p=true,Y?.()):e<1&&!z&&(p=false),o=requestAnimationFrame(y);}function S(){if(i=true,T===void 0&&(T=t.duration),V){v(1),C?.();return}A(),C?.(),a$2&&!n&&(o=requestAnimationFrame(y));}t.readyState>=1?S():t.addEventListener("loadedmetadata",S,{once:true}),i||A();let q=new IntersectionObserver(e=>{e.forEach(r=>{a$2=r.isIntersecting,a$2&&!n&&i?o=requestAnimationFrame(y):cancelAnimationFrame(o);});}),x;function c$1(){clearTimeout(x),x=setTimeout(A,150);}window.addEventListener("resize",c$1),window.addEventListener("orientationchange",c$1);let Z=d$1([I],c$1);return q.observe(t),a$1(t,{type:"video",getProgress:()=>l,getTrigger:()=>({tStart:f,tEnd:g})}),{destroy(){cancelAnimationFrame(o),q.disconnect(),t.removeEventListener("loadedmetadata",S),window.removeEventListener("resize",c$1),window.removeEventListener("orientationchange",c$1),Z(),clearTimeout(x),b$1(t);},replay(){s=-1,p=false,l=0,n=false,w=NaN,v(0);},pause(){n=true,cancelAnimationFrame(o);},resume(){n&&(n=false,a$2&&i&&(o=requestAnimationFrame(y)));},seek(e){let r=Math.min(1,Math.max(0,e));l=r,s=r,n=true,cancelAnimationFrame(o),w=NaN,v(r);},getProgress(){return l}}}export{ne as a};
|
package/dist/chunk-BFX2CSQ3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {b,a as a$3}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a,b as b$2,d as d$1,c}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$3}from'./chunk-BCV4RAIX.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';function Ae(t){return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")}function ge(t){let u=[],l=/([\w]+)\(([^)]*)\)/g,s;for(;(s=l.exec(t))!==null;){let a=[],o=[],m=s[2].trim();if(m)for(let i of m.split(/[\s,]+/)){let r=i.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(r?parseFloat(r[1]):0),o.push(r?r[2]:"");}u.push({fn:s[1],nums:a,units:o});}return u}function He(t,u,l){let s=ge(t),a=ge(u);return s.length===0||s.length!==a.length?l<1?t:u:s.map((o,m)=>{let i=a[m];return o.fn!==i.fn||o.nums.length!==i.nums.length?l<1?`${o.fn}(${o.nums.map((r,g)=>`${r}${o.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((r,g)=>`${r}${i.units[g]}`).join(", ")})`:`${o.fn}(${o.nums.map((r,g)=>`${r+(i.nums[g]-r)*l}${o.units[g]}`).join(", ")})`}).join(" ")}function de(t,u,l){if(typeof t=="number"&&typeof u=="number")return String(t+(u-t)*l);let s=String(t),a=String(u);if(Ae(s))return a$3(s,a,l);if(s.includes("("))return He(s,a,l);let o=s.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(o&&m){let i=parseFloat(o[1]),r=parseFloat(m[1]);return `${i+(r-i)*l}${o[2]||m[2]}`}return l<1?s:a}function xe(t){return t.replace(/([A-Z])/g,u=>`-${u.toLowerCase()}`)}var Ce=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Fe=0,ye="--scroll-draw-progress";function Ne(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function je(t,u){let l={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return l;let{props:s,trigger:a$3={},easing:o="ease-out",speed:m=1,once:i=false,axis:r="y",scrollContainer:g,native:he=true,velocityScale:H=false,respectReducedMotion:ve=true,triggerElement:Ee,onProgress:J,onComplete:R,onEnter:K,onLeave:Q,onEnterBack:ee,onLeaveBack:te}=u,be=ve&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,k=typeof o=="function"?o:d[o]??d["ease-out"],ne=a(a$3.start??"top bottom"),re=a(a$3.end??"bottom top"),x=Ee??t,d$2=typeof g=="string"?document.querySelector(g):g??null,y=Object.entries(s).map(([e,n])=>({prop:xe(e),from:Array.isArray(n)?n[0]:"",to:Array.isArray(n)?n[1]:n}));function we(){let e=window.getComputedStyle(t);for(let n of y)n.from===""&&(n.from=e.getPropertyValue(n.prop).trim()||"0");}function Se(){for(let e of y)t.style.setProperty(e.prop,String(e.to));}let V=new Map;for(let e of [...y.map(n=>n.prop),ye])V.set(e,t.style.getPropertyValue(e));function z(){for(let[e,n]of V)n?t.style.setProperty(e,n):t.style.removeProperty(e);}if(be)return Se(),R?.(),{...l,destroy:z,getProgress:()=>1};we();let oe=typeof o=="string"?b(o):null;function Te(){if(!he||!Ne()||!oe||r!=="y"||d$2||x!==t||i||m!==1||J||R||K||Q||ee||te||H!==false||(a$3.start??"top bottom").trim()!=="top bottom"||(a$3.end??"bottom top").trim()!=="bottom top")return false;for(let e of y)if(!Ce.has(e.prop))return false;return true}function Le(){let e=`ssd-a-${++Fe}`,n=y.map(f=>`${f.prop}:${f.from}`).join(";"),P=y.map(f=>`${f.prop}:${f.to}`).join(";"),v=document.createElement("style");v.setAttribute("data-ssd-animate",""),v.textContent=`@keyframes ${e}{from{${n}}to{${P}}}.${e}{animation-name:${e};animation-duration:auto;animation-timing-function:${oe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(v),t.classList.add(e);let c$1=()=>r==="x"?window.scrollX:window.scrollY,p=()=>r==="x"?window.innerWidth:window.innerHeight,M=()=>{let f=t.getBoundingClientRect();return c({top:f.top,height:f.height},c$1(),p(),ne,re)};a$1(t,{type:"animate",getProgress:()=>D.getProgress(),getTrigger:M});let D={refresh(){},destroy(){t.classList.remove(e),v.remove(),t.style.animationPlayState="",z(),b$3(t);},replay(){t.classList.remove(e),t.offsetWidth,t.classList.add(e);},pause(){t.style.animationPlayState="paused";},resume(){t.style.animationPlayState="";},seek(f){let _=Math.min(1,Math.max(0,f));t.classList.remove(e);for(let q of y)t.style.setProperty(q.prop,de(q.from,q.to,_));},getProgress(){let{tStart:f,tEnd:_}=M();return k(b$2(c$1(),f,_,m))}};return D}if(Te())return Le();let h=0,E=0,b$4=0,C=false,w=false,T=-1,L=0,F=false,S=NaN,O=-1,se=0,ie=()=>d$2?r==="x"?d$2.scrollLeft:d$2.scrollTop:r==="x"?window.scrollX:window.scrollY,Pe=()=>d$2?r==="x"?d$2.clientWidth:d$2.clientHeight:r==="x"?window.innerWidth:window.innerHeight,$=x===t?y:[],ae=false;function W(){let e=t.style,n=$.map(p=>e.getPropertyValue(p.prop)),P=e.transition;$.length&&(e.transition="none"),$.forEach(p=>e.setProperty(p.prop,V.get(p.prop)??""));let v=a$2(x,d$2,r);$.forEach((p,M)=>e.setProperty(p.prop,n[M])),$.length&&(t.offsetWidth,e.transition=P);let c$1=c(v,v.scroll,Pe(),ne,re);ae&&Math.abs(c$1.tStart-h)<1&&Math.abs(c$1.tEnd-E)<1||(ae=true,h=c$1.tStart,E=c$1.tEnd);}function N(e){t.style.setProperty(ye,String(e));for(let n of y)t.style.setProperty(n.prop,de(n.from,n.to,e));J?.(e);}function Me(e){if(isNaN(S)){S=e;return}S<=0&&e>0?K?.():S>0&&e<=0&&te?.(),S<1&&e>=1?Q?.():S>=1&&e<1&&ee?.(),S=e;}function B(){if(!C||w)return;let e=performance.now(),n=ie(),P=m;if(H!==false){let p=e-se,M=p>0?Math.abs(n-(O<0?n:O))/p:0;P=m*Math.max(.2,1+M*(typeof H=="number"?H:1)*.04);}O=n,se=e;let v=E===h?0:(n-h)/(E-h);Me(v);let c=k(b$2(n,h,E,P));i&&(T=Math.max(T,c),c=T),L=c,N(c),c>=1&&!F?(F=true,R?.()):c<1&&!i&&(F=false),b$4=requestAnimationFrame(B);}W(),E===h&&b$1("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`.",t);{let e=k(b$2(ie(),h,E,m));i&&e>0&&(T=e),L=e,N(e);}let le=new IntersectionObserver(e=>{e.forEach(n=>{C=n.isIntersecting,C&&!w?b$4=requestAnimationFrame(B):cancelAnimationFrame(b$4);});},{root:d$2??null}),j;function A(){clearTimeout(j),j=setTimeout(W,150);}window.addEventListener("resize",A),window.addEventListener("orientationchange",A);let $e=d$1([x],A);return le.observe(t),a$1(t,{type:"animate",getProgress:()=>L,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(b$4),le.disconnect(),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),$e(),clearTimeout(j),z(),b$3(t);},replay(){T=-1,F=false,L=0,w=false,N(0);},pause(){w=true,cancelAnimationFrame(b$4);},resume(){w&&(w=false,C&&(b$4=requestAnimationFrame(B)));},seek(e){let n=Math.min(1,Math.max(0,e));L=n,T=n,w=true,cancelAnimationFrame(b$4),N(n);},getProgress(){return L},refresh(){W();}}}export{je as a};
|
package/dist/chunk-ENACACPZ.mjs
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import {b as b$1,a as a$5}from'./chunk-OJFWQ6CU.mjs';import {a as a$2}from'./chunk-YWKPTYSG.mjs';import {a as a$1}from'./chunk-YZV4Z3EQ.mjs';import {a,d as d$1,c,b as b$3}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$4,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b,a as a$3}from'./chunk-LFSU6LR3.mjs';var yt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Mt=0;function Dt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function ht(r,w){let d="";try{d=getComputedStyle(r).getPropertyValue(w).trim();}catch{}return d||(r.getAttribute(w)??"").trim()}var gt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ct(r){if(!a$3)return;let w=ht(r,"stroke");if(!w||w==="none"){b("Element has no stroke \u2014 path will not be visible.",r);return}let d=(r.getAttribute("fill")??"").trim();d&&!gt.has(d)&&!gt.has(ht(r,"fill"))&&b("Element has a fill \u2014 it may obscure the stroke animation.",r);}function Ot(r,w,d){let b=document.createElement("div");b.setAttribute("data-svg-scroll-draw-debug",""),b.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 W(){let N=d==="x"?window.scrollX:window.scrollY,F=r-N,V=w-N,H=d==="x";b.innerHTML=`
|
|
2
|
-
<div style="position:absolute;${H?`left:${F}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${F}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${H?`left:${V}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${V}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(b),window.addEventListener("scroll",W,{passive:true}),W(),{el:b,destroy(){window.removeEventListener("scroll",W),b.remove();}}}var vt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,wt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Nt(r,w,d){if(!a$3)return;let b$1=(r.match(wt)??[]).join("").toUpperCase(),W=(w.match(wt)??[]).join("").toUpperCase(),N=(r.match(vt)??[]).length,F=(w.match(vt)??[]).length;if(b$1!==W){b(`morphTo: command sequence differs (${b$1||"\u2205"} \u2192 ${W||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,d);return}N!==F&&b(`morphTo: coordinate count differs (${N} \u2192 ${F}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,d);}function _e(r,w,d){let b=(w.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),W=0;return r.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,N=>{let F=parseFloat(N),V=b[W++]??F;return String(+(F+(V-F)*d).toFixed(4))})}function Ut(r,w={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:d$2,...b$4}=w,W=d$2?{...yt[d$2],...b$4}:b$4,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:F="path, polyline, line, polygon, rect, circle",speed:V=1,fade:H=false,easing:pe="linear",trigger:be={},stagger:J=0,direction:y="forward",once:K=false,debug:bt=false,axis:U="y",scrollContainer:Oe,autoReverse:$e=false,delay:de=0,strokeColor:ee,strokeWidth:te,fillOpacity:re,waypoints:se,velocityScale:ye=false,threshold:Ue=0,rootMargin:je="0px",repeat:oe=0,repeatDelay:Ne=0,morphTo:P,clip:Fe,autoplay:$t=false,duration:Et=1e3,native:Tt=true,onProgress:he,onStart:Ee,onComplete:le,onEnter:Xe,onLeave:Ye,onEnterBack:Qe,onLeaveBack:Ze}=W,j=Fe===true?"left":typeof Fe=="string"?Fe:false,ne=typeof pe=="function"?pe:d[pe]??d.linear,Je=a(be.start??"top bottom"),Ke=a(be.end??"bottom top"),R=typeof Oe=="string"?document.querySelector(Oe):Oe??null,q=Array.isArray(ee)?ee[0]:null,$=Array.isArray(ee)?ee[1]:typeof ee=="string"?ee:null,S=Array.isArray(te)?te[0]:null,E=Array.isArray(te)?te[1]:typeof te=="number"?te:null,x=Array.isArray(re)?re[0]:null,T=Array.isArray(re)?re[1]:typeof re=="number"?re:null;function ie(e){let t=e*100;switch(j){case "right":return `inset(0 0 0 ${100-t}%)`;case "top":return `inset(0 0 ${100-t}% 0)`;case "bottom":return `inset(${100-t}% 0 0 0)`;case "center":return `circle(${e*150}% at 50% 50%)`;default:return `inset(0 ${100-t}% 0 0)`}}let p=j?[]:Array.from(r.querySelectorAll(F)),l=[],L=[],M=0,D=0,Te=J,et=0,v=false,I=false,A=0,ke=false,X=-1,ge=[],Se=-1,h=false,G=0,_=0,Y,He=null;function tt(){He?.destroy(),He=null;}let Q=new Set,rt=NaN,Z=true,xe=-1,st=performance.now(),fe=NaN;function ve(){return R?U==="x"?R.scrollLeft:R.scrollTop:U==="x"?window.scrollX:window.scrollY}function ot(){return R?U==="x"?R.clientWidth:R.clientHeight:U==="x"?window.innerWidth:window.innerHeight}function nt(){let e=a$2(r,R,U);return c(e,e.scroll,ot(),Je,Ke)}function kt(){let e=D-M,t=p.length-1,o=R??document.documentElement,u=U==="x"?"Width":"Height";if(Te=J,J>0&&t>0&&e>0){let C=o[`scroll${u}`]-o[`client${u}`]-1-M-e/V;C>=0&&(Te=Math.min(J,C/(t*e)));}et=D+t*Te*e;}function it(){(({tStart:M,tEnd:D}=nt())),kt(),bt&&a$3&&(tt(),He=Ot(M,D,U));}function Re(e,t=nt){a$4(r,{type:"draw",getProgress:()=>e.getProgress(),getTrigger:t});let o=e.destroy;return e.destroy=()=>{o.call(e),b$2(r);},e}function St(e,t){if(r.style.setProperty("--scroll-draw-progress",String(e)),j){let o=t==="reverse"?1-e:e;r.style.clipPath=ie(o);return}p.forEach((o,u)=>{o.style.strokeDashoffset=t==="reverse"?`${l[u]*e}`:`${l[u]*(1-e)}`,H&&(o.style.opacity=t==="reverse"?`${1-e}`:`${e}`),q&&$?o.style.stroke=a$5(q,$,e):$&&(o.style.stroke=$),S!==null&&E!==null?o.style.strokeWidth=`${S+(E-S)*e}`:E!==null&&(o.style.strokeWidth=`${E}`),x!==null&&T!==null?o.style.fillOpacity=`${x+(T-x)*e}`:T!==null&&(o.style.fillOpacity=`${T}`),P&&o.tagName.toLowerCase()==="path"&&L[u]&&o.setAttribute("d",_e(L[u],P,e));});}function Ae(){if(r.style.setProperty("--scroll-draw-progress","0"),j){r.style.clipPath=ie(0);return}p.forEach((e,t)=>{e.style.strokeDasharray=`${l[t]}`,e.style.strokeDashoffset=y==="reverse"?"0":`${l[t]}`,H?e.style.opacity=y==="reverse"?"1":"0":e.style.opacity="",q&&(e.style.stroke=q),S!==null&&(e.style.strokeWidth=`${S}`),x!==null&&(e.style.fillOpacity=`${x}`),P&&e.tagName.toLowerCase()==="path"&&L[t]&&e.setAttribute("d",L[t]);});}if(p.forEach(e=>{Ct(e);let t=a$1(e);l.push(t);let o=e.tagName.toLowerCase()==="path";o?L.push(e.getAttribute("d")??""):L.push(""),P&&(o?Nt(L[L.length-1],P,e):b(`morphTo only applies to <path> elements \u2014 ignored on <${e.tagName}>.`,e)),N?(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=y==="reverse"?`${t}`:"0",H&&(e.style.opacity="1"),$&&(e.style.stroke=$),E!==null&&(e.style.strokeWidth=`${E}`),T!==null&&(e.style.fillOpacity=`${T}`),P&&e.tagName.toLowerCase()==="path"&&e.setAttribute("d",P)):(e.style.strokeDasharray=`${t}`,e.style.strokeDashoffset=y==="reverse"?"0":`${t}`,H?e.style.opacity=y==="reverse"?"1":"0":e.style.opacity="",q&&(e.style.stroke=q),S!==null&&(e.style.strokeWidth=`${S}`),x!==null&&(e.style.fillOpacity=`${x}`));}),j){if(N)return r.style.clipPath=ie(1),le?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};r.style.clipPath=ie(0);}else if(N)return le?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let at=typeof pe=="string"?b$1(pe):null;function xt(){return !(Tt===false||!Dt()||!p.length||!at||j||U!=="y"||R||V!==1||J!==0||K||$e||ye!==false||P||se||oe||de>0||he||Ee||le||Xe||Ye||Qe||Ze||ee!=null||te!=null||re!=null||(be.start??"top bottom").trim()!=="top bottom"||(be.end??"bottom top").trim()!=="bottom top")}function At(){let e=++Mt,t=`svg-scroll-draw-${e}`,o=`svg-scroll-draw-host-${e}`,u=`--svg-scroll-draw-${e}`,C=y==="reverse"?"0":"var(--ssd-len)",B=y==="reverse"?"var(--ssd-len)":"0",z=`stroke-dashoffset:${C};`,i=`stroke-dashoffset:${B};`;H&&(z+=`opacity:${y==="reverse"?1:0};`,i+=`opacity:${y==="reverse"?0:1};`);let a=document.createElement("style");a.setAttribute("data-svg-scroll-draw",""),a.textContent=`@keyframes ${t}{from{${z}}to{${i}}}.${o}{view-timeline-name:${u};view-timeline-axis:block;}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${at};animation-fill-mode:both;animation-timeline:${u};animation-range:cover 0% cover 100%;}`,document.head.appendChild(a),r.classList.add(o);function g(s,m){s.style.setProperty("--ssd-len",String(l[m])),s.style.strokeDasharray=`${l[m]}`,s.style.strokeDashoffset="",s.style.opacity="",s.style.animationPlayState="",s.classList.add(t);}p.forEach(g);let n=false,f=-1;function c$1(){if(f>=0)return f;let s=r.getBoundingClientRect(),{tStart:m,tEnd:O}=c({top:s.top,height:s.height},ve(),ot(),Je,Ke);return ne(b$3(ve(),m,O,V))}return {destroy(){r.classList.remove(o),p.forEach(s=>{s.classList.remove(t),s.style.removeProperty("--ssd-len"),s.style.animationPlayState="";}),a.remove();},replay(){n=false,f=-1,p.forEach(g);},pause(){n=true,p.forEach(s=>{s.style.animationPlayState="paused";});},resume(){n&&(n=false,p.forEach(s=>{s.style.animationPlayState="running";}));},seek(s){let m=Math.min(1,Math.max(0,s));f=m,n=true,p.forEach((O,k)=>{O.classList.remove(t),O.style.strokeDashoffset=y==="reverse"?`${l[k]*m}`:`${l[k]*(1-m)}`,H&&(O.style.opacity=y==="reverse"?`${1-m}`:`${m}`);});},getProgress(){return c$1()},refresh(){p.forEach((s,m)=>{l[m]=a$1(s),s.style.setProperty("--ssd-len",String(l[m])),s.style.strokeDasharray=`${l[m]}`;});}}}if(xt())return Re(At());function Pt(){let e=Math.max(1,Et),t=0,o=0,u=false;function C(n){let f=true;if(j){let c=Math.min(1,Math.max(0,n/e)),s=ne(c);G=s,r.style.setProperty("--scroll-draw-progress",String(s)),r.style.clipPath=ie(y==="reverse"?1-s:s),he?.(s),c<1&&(f=false);}else p.forEach((c,s)=>{let m=s*J*e,O=Math.min(1,Math.max(0,(n-m)/e)),k=ne(O);c.style.strokeDashoffset=y==="reverse"?`${l[s]*k}`:`${l[s]*(1-k)}`,H&&(c.style.opacity=y==="reverse"?`${1-k}`:`${k}`),q&&$?c.style.stroke=a$5(q,$,k):$&&(c.style.stroke=$),S!==null&&E!==null?c.style.strokeWidth=`${S+(E-S)*k}`:E!==null&&(c.style.strokeWidth=`${E}`),x!==null&&T!==null?c.style.fillOpacity=`${x+(T-x)*k}`:T!==null&&(c.style.fillOpacity=`${T}`),P&&c.tagName.toLowerCase()==="path"&&L[s]&&c.setAttribute("d",_e(L[s],P,k)),s===0&&(G=k,he?.(k),r.style.setProperty("--scroll-draw-progress",String(k))),O<1&&(f=false);});if(se){let c=Math.min(1,Math.max(0,n/e)),s=ne(c);for(let m in se){let O=parseFloat(m);s>=O&&!Q.has(O)&&(Q.add(O),se[m]?.());}}return f}function B(n){if(h)return;let f=n-t;I||(I=true,Ee?.());let c=C(f);if(c&&!v){v=true,C(e*(1+Math.max(0,p.length-1)*J)),le?.(),_<(oe==="infinite"?1/0:oe??0)&&(_++,Y=setTimeout(()=>{t=performance.now(),I=false,v=false,Q.clear(),Ae(),A=requestAnimationFrame(B);},Ne));return}c||(A=requestAnimationFrame(B));}function z(){cancelAnimationFrame(A),clearTimeout(Y),t=performance.now(),o=0,h=false,I=false,v=false,_=0,u=true,G=0,Q.clear(),Ae(),A=requestAnimationFrame(B);}let i=new IntersectionObserver(n=>{n.forEach(f=>{f.isIntersecting&&!(K&&v)?z():!f.isIntersecting&&!K&&!v&&(cancelAnimationFrame(A),clearTimeout(Y),u=false);});},{root:R??null,threshold:Ue,rootMargin:je}),a;function g(){clearTimeout(a),a=setTimeout(()=>{p.forEach((n,f)=>{l[f]=a$1(n),n.style.strokeDasharray=`${l[f]}`;});},150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),de>0?setTimeout(()=>i.observe(r),de):i.observe(r),{destroy(){cancelAnimationFrame(A),clearTimeout(Y),i.disconnect(),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(a);},replay(){_=0,z();},pause(){h||!u||(h=true,o=performance.now()-t,cancelAnimationFrame(A));},resume(){h&&(h=false,u=true,t=performance.now()-o,A=requestAnimationFrame(B));},seek(n){let f=Math.min(1,Math.max(0,n));G=f,h=true,o=f*e,t=performance.now()-o,cancelAnimationFrame(A),C(o);},getProgress(){return G},refresh(){clearTimeout(a),p.forEach((n,f)=>{l[f]=a$1(n),n.style.strokeDasharray=`${l[f]}`;});}}}if($t)return Re(Pt());it();function lt(){if(h||!ce)return;let e=performance.now(),t=ve();if(!Z&&ye===false&&t===rt){ze(t);return}Z=false,rt=t;let o=V;if(ye!==false){let i=e-st,a=i>0?Math.abs(t-(xe<0?t:xe))/i:0;o=V*Math.max(.2,1+a*(typeof ye=="number"?ye:1)*.04);}xe=t,st=e;let u=$e?Se===-1||t>=Se?"forward":"reverse":y;Se=t;let C=D-M,B=true,z=C===0?0:(t-M)/C;if(isNaN(fe)||(fe<=0&&z>0?Xe?.():fe>0&&z<=0&&Ze?.(),fe<1&&z>=1?Ye?.():fe>=1&&z<1&&Qe?.()),fe=z,j){let i=ne(b$3(t,M,D,o));K&&!$e&&(X=Math.max(X,i),i=X),G=i,r.style.setProperty("--scroll-draw-progress",String(i));let a=u==="reverse"?1-i:i;r.style.clipPath=ie(a),he?.(i),!I&&b$3(t,M,D,o)>0&&(I=true,Ee?.()),i>=1&&!v?(v=true,le?.(),_<(oe==="infinite"?1/0:oe??0)&&(_++,Y=setTimeout(()=>{X=-1,I=false,v=false,r.style.clipPath=ie(0);},Ne))):i<1&&!K&&(v=false),ze(t);return}if(p.forEach((i,a)=>{let g=a*Te*C,n=ne(b$3(t,M+g,D+g,o));K&&!$e&&(n=ge[a]=Math.max(ge[a]??X,n)),i.style.strokeDashoffset=u==="reverse"?`${l[a]*n}`:`${l[a]*(1-n)}`,H&&(i.style.opacity=u==="reverse"?`${1-n}`:`${n}`),q&&$?i.style.stroke=a$5(q,$,n):$&&(i.style.stroke=$),S!==null&&E!==null?i.style.strokeWidth=`${S+(E-S)*n}`:E!==null&&(i.style.strokeWidth=`${E}`),x!==null&&T!==null?i.style.fillOpacity=`${x+(T-x)*n}`:T!==null&&(i.style.fillOpacity=`${T}`),P&&i.tagName.toLowerCase()==="path"&&L[a]&&i.setAttribute("d",_e(L[a],P,n)),a===0&&(G=n,he?.(n),r.style.setProperty("--scroll-draw-progress",String(n))),n<1&&(B=false);}),se){let i=ne(b$3(t,M,D,o));for(let a in se){let g=parseFloat(a);i>=g&&!Q.has(g)&&(Q.add(g),se[a]?.());}}!I&&b$3(t,M,D,o)>0&&(I=true,Ee?.()),B&&!v?(v=true,le?.(),_<(oe==="infinite"?1/0:oe??0)&&(_++,Y=setTimeout(()=>{X=-1,ge=[],I=false,v=false,Q.clear(),Ae(),Z=true;},Ne))):!B&&!K&&(v=false),ze(t);}function Ie(e){return e>=D&&e<et}function ze(e){ke||Ie(e)?A=requestAnimationFrame(lt):ce=false;}function We(){return ke||Ie(ve())}let ce=false;function Pe(){ce||(ce=true,A=requestAnimationFrame(function(){lt();}));}function Le(){ce=false,cancelAnimationFrame(A);}let Ve=new IntersectionObserver(e=>{e.forEach(t=>{ke=t.isIntersecting,ke&&!h?(Z=true,Pe()):ce&&!h&&Ie(ve())||Le();});},{root:R??null,threshold:Ue,rootMargin:je});function ft(){p.forEach((e,t)=>{l[t]=a$1(e),e.style.strokeDasharray=`${l[t]}`;}),it(),Z=true;}let Me;function we(){clearTimeout(Me),Me=setTimeout(ft,150);}window.addEventListener("resize",we),window.addEventListener("orientationchange",we);let Lt=d$1([r],we);return de>0?setTimeout(()=>Ve.observe(r),de):Ve.observe(r),Re({destroy(){cancelAnimationFrame(A),clearTimeout(Y),Le(),Ve.disconnect(),Lt(),window.removeEventListener("resize",we),window.removeEventListener("orientationchange",we),clearTimeout(Me),tt();},replay(){X=-1,ge=[],Se=-1,xe=-1,I=false,v=false,_=0,h=false,G=0,Q.clear(),clearTimeout(Y),Ae(),Z=true,We()&&Pe();},pause(){h=true,Le();},resume(){h&&(h=false,Z=true,We()&&Pe());},seek(e){let t=Math.min(1,Math.max(0,e));G=t,X=t,ge=[],h=true,Le(),St(t,y),Z=true;},getProgress(){return G},refresh(){clearTimeout(Me),ft(),We()&&!h&&Pe();}},()=>({tStart:M,tEnd:D}))}export{yt as a,Ut as b};
|
package/dist/chunk-I45LCJUP.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,d as d$1,c,b as b$2}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';function B(n){let o=n.textContent??"";return n.textContent="",o.split(/(\s+)/).filter(Boolean).map(t=>{let e=document.createElement("span");return e.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(e.textContent=t,e.style.whiteSpace="pre"):(e.textContent=t,e.style.display="inline-block"),n.appendChild(e),/^\s+$/.test(t)?null:e}).filter(t=>t!==null)}function K(n){let o=n.textContent??"";return n.textContent="",o.split("").map(t=>{let e=document.createElement("span");return e.setAttribute("aria-hidden","true"),e.textContent=t,t===" "?e.style.whiteSpace="pre":e.style.display="inline-block",n.appendChild(e),t===" "?null:e}).filter(t=>t!==null)}function D(n){let o=B(n),t=new Map;for(let s of o){let i=s.offsetTop;t.has(i)||t.set(i,[]),t.get(i).push(s);}let e=[],c=Array.from(t.keys()).sort((s,i)=>s-i);for(let s of c){let i=t.get(s),l=document.createElement("span");l.setAttribute("aria-hidden","true"),l.style.display="inline-block",i.forEach((y,T)=>{let m=y.nextElementSibling;l.appendChild(y),T<i.length-1&&m&&m.style.whiteSpace==="pre"&&l.appendChild(m);}),e.push(l);}return n.textContent="",e.forEach((s,i)=>{n.appendChild(s),i<e.length-1&&n.appendChild(document.createTextNode(" "));}),e}function Q(n,o,t,e){if(t<=1||e===0)return n;let c=(t-1)*e,s=o*e,i=s+(1-c);return i<=s?n>=s?1:0:Math.min(1,Math.max(0,(n-s)/(i-s)))}function Z(n,o){let t=[];if(o?.y!==void 0&&t.push(`translateY(${o.y*(1-n)}px)`),o?.x!==void 0&&t.push(`translateX(${o.x*(1-n)}px)`),o?.rotate!==void 0&&t.push(`rotate(${o.rotate*(1-n)}deg)`),o?.scale!==void 0){let e=o.scale+(1-o.scale)*n;t.push(`scale(${e})`);}return t.join(" ")||""}var R={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ie(n,o={}){if(typeof window>"u")return R;let t=typeof n=="string"?document.querySelector(n):n;if(!t)return b("scrollText: element not found:",n),R;let e=t,{split:c$1="words",stagger:s=.04,easing:i="ease-out",from:l={opacity:0,y:24},trigger:y={},once:T=true,onComplete:m}=o,Y=window.matchMedia("(prefers-reduced-motion: reduce)").matches,_=typeof i=="function"?i:d[i]??d["ease-out"],j=a(y.start??"top 85%"),G=a(y.end??"top 40%"),S=e.innerHTML;e.setAttribute("aria-label",e.textContent??"");let d$2;c$1==="chars"?d$2=K(e):c$1==="lines"?d$2=D(e):d$2=B(e);let U=d$2.length;function V(r,a){l?.opacity!==void 0&&(r.style.opacity=String(l.opacity+(1-l.opacity)*a));let x=Z(a,l);x&&(r.style.transform=x);}function f(r){e.style.setProperty("--scroll-draw-progress",String(r)),d$2.forEach((a,x)=>{let J=_(Q(r,x,U,s));V(a,J);});}if(Y)return f(1),m?.(),{destroy(){e.innerHTML=S,e.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};f(0);let C=0,M=0,p=0,w=false,u=false,b$3=-1,g=0,E=false,I=()=>window.scrollY,W=()=>window.innerHeight;function F(){let r=e.getBoundingClientRect(),a=c({top:r.top,height:r.height},I(),W(),j,G);C=a.tStart,M=a.tEnd;}function L(){if(!w||u)return;let r=b$2(I(),C,M,1);T&&(b$3=Math.max(b$3,r),r=b$3),g=r,f(r),r>=1&&!E?(E=true,m?.()):r<1&&!T&&(E=false),p=requestAnimationFrame(L);}F();let P=new IntersectionObserver(r=>{r.forEach(a=>{w=a.isIntersecting,w&&!u?p=requestAnimationFrame(L):cancelAnimationFrame(p);});}),v;function h(){clearTimeout(v),v=setTimeout(()=>{if(c$1==="lines"){let r=g;e.innerHTML=S,e.setAttribute("aria-label",e.textContent??""),d$2=D(e),f(r);}F();},150);}window.addEventListener("resize",h),window.addEventListener("orientationchange",h);let X=d$1([e],h);return P.observe(e),a$1(e,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:C,tEnd:M})}),{destroy(){cancelAnimationFrame(p),P.disconnect(),window.removeEventListener("resize",h),window.removeEventListener("orientationchange",h),X(),clearTimeout(v),e.innerHTML=S,e.removeAttribute("aria-label"),b$1(e);},replay(){b$3=-1,E=false,g=0,u=false,f(0);},pause(){u=true,cancelAnimationFrame(p);},resume(){u&&(u=false,w&&(p=requestAnimationFrame(L)));},seek(r){let a=Math.min(1,Math.max(0,r));g=a,b$3=a,u=true,cancelAnimationFrame(p),f(a);},getProgress(){return g}}}export{ie as a};
|
package/dist/chunk-KGAJQP2N.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {d}from'./chunk-DM6EDKWH.mjs';import {a,b as b$1}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var C="http://www.w3.org/2000/svg",M="cinematic-photo",y=a=>a<0?0:a>1?1:a;function u(a){let i=parseFloat(a);return Number.isFinite(i)?y(i/100):0}function I(a){return d[a]??d.linear}var P={destroy:()=>{},getProgress:()=>0},H=class{constructor(i){if(typeof document>"u"){this.mount=null;return}this.mount=typeof i.wrapper=="string"?document.querySelector(i.wrapper):i.wrapper,this.mount||b("Cinematic: wrapper not found:",i.wrapper);}loadStory(i){let s=this.mount;if(typeof window>"u"||!s)return P;s.style.position="relative",s.style.height=i.totalHeight,s.style.display="block";let c=document.createElement("div");c.setAttribute("data-cinematic-stage",""),c.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",s.appendChild(c);let p=[];for(let n of i.scenes){if(n.background){let t=document.createElement("img");t.id=M,t.src=n.background,t.alt="",t.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",c.appendChild(t);}let e=n.animations.filter(t=>t.type==="draw");if(e.length){let t=document.createElementNS(C,"svg");t.setAttribute("viewBox",`0 0 ${i.canvas.width} ${i.canvas.height}`),t.setAttribute("preserveAspectRatio","xMidYMid meet"),t.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",c.appendChild(t);for(let o of e){let r=document.createElementNS(C,"path");r.id=o.target.replace(/^#/,""),r.setAttribute("d",o.d),r.setAttribute("fill","none"),r.setAttribute("stroke",o.stroke),r.setAttribute("stroke-width",String(o.strokeWidth)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round");let h=o.length||r.getTotalLength?.()||0;r.style.strokeDasharray=String(h),r.style.strokeDashoffset=String(h),t.appendChild(r),p.push({kind:"draw",el:r,start:u(o.start),end:u(o.end),ease:I(o.easing),length:h});}}for(let t of n.animations){if(t.type!=="fade")continue;let o=c.querySelector(t.target)??document.querySelector(t.target);o&&(o.style.opacity=String(t.from),p.push({kind:"fade",el:o,start:u(t.start),end:u(t.end),ease:d["ease-in-out"]??d.linear,from:t.from,to:t.to}));}}let d$1=0,b=()=>{let n=s.offsetHeight-window.innerHeight;return n<=0?s.getBoundingClientRect().top<=0?1:0:y(-s.getBoundingClientRect().top/n)},f=n=>{for(let e of p){let t=e.end-e.start,o=t<=0?n>=e.end?1:0:y((n-e.start)/t),r=e.ease(o);e.kind==="draw"?e.el.style.strokeDashoffset=String(e.length*(1-r)):e.el.style.opacity=String(e.from+(e.to-e.from)*r);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let g=0,m=false,w=false,S=()=>{d$1=b(),f(d$1),m&&(g=requestAnimationFrame(S));},T=()=>{m||(m=true,g=requestAnimationFrame(S));},v=()=>{m=false,cancelAnimationFrame(g);},A=new IntersectionObserver(n=>{for(let e of n)w=e.isIntersecting,w?T():v();},{threshold:0});return A.observe(c),d$1=b(),f(d$1),a(s,{type:"draw",getProgress:()=>d$1,getTrigger:()=>{let n=s.getBoundingClientRect().top+window.scrollY;return {tStart:n,tEnd:n+Math.max(0,s.offsetHeight-window.innerHeight)}}}),{destroy(){v(),A.disconnect(),b$1(s);},getProgress:()=>d$1}}};
|
|
2
|
-
export{H as a};
|
package/dist/chunk-KHQ7OGQK.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import {a,b as b$1,d as d$1,c}from'./chunk-A4JCC3QQ.mjs';import {d}from'./chunk-DM6EDKWH.mjs';import {a as a$1,b as b$2}from'./chunk-BCV4RAIX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var C={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function X(m,H){if(typeof window>"u")return C;let E=typeof m=="string"?document.querySelector(m):m;if(!E)return b("scrollCounter: element not found:",m),C;let r=E,{from:T=0,to:A,format:_,easing:p="ease-out",trigger:F={},once:g=true,decimals:M,onComplete:x}=H,I=M!==void 0?e=>e.toFixed(M):_??(e=>String(Math.round(e))),P=typeof p=="function"?p:d[p]??d["ease-out"],B=a(F.start??"top 80%"),G=a(F.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r.textContent=I(A),x?.(),C;let a$2=0,c$1=0,z=false,n=0,u=false,o=false,i=-1,s=0,f=false,w=()=>window.scrollY,V=()=>window.innerHeight;function L(){let e=r.getBoundingClientRect(),t=c({top:e.top,height:e.height},w(),V(),B,G);z&&Math.abs(t.tStart-a$2)<1&&Math.abs(t.tEnd-c$1)<1||(z=true,a$2=t.tStart,c$1=t.tEnd);}function d$2(e){r.textContent=I(T+(A-T)*e),r.style.setProperty("--scroll-draw-progress",String(e));}function h(){if(!u||o)return;let e=P(b$1(w(),a$2,c$1,1));g&&(i=Math.max(i,e),e=i),s=e,d$2(e),e>=1&&!f?(f=true,x?.()):e<1&&!g&&(f=false),n=requestAnimationFrame(h);}L();{let e=P(b$1(w(),a$2,c$1,1));g&&e>0&&(i=e),s=e,d$2(e);}let O=new IntersectionObserver(e=>{e.forEach(t=>{u=t.isIntersecting,u&&!o?n=requestAnimationFrame(h):cancelAnimationFrame(n);});}),b$3;function l(){clearTimeout(b$3),b$3=setTimeout(L,150);}window.addEventListener("resize",l),window.addEventListener("orientationchange",l);let Y=d$1([r],l);return O.observe(r),a$1(r,{type:"counter",getProgress:()=>s,getTrigger:()=>({tStart:a$2,tEnd:c$1})}),{destroy(){cancelAnimationFrame(n),O.disconnect(),window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),Y(),clearTimeout(b$3),b$2(r);},replay(){i=-1,f=false,s=0,o=false,d$2(0);},pause(){o=true,cancelAnimationFrame(n);},resume(){o&&(o=false,u&&(n=requestAnimationFrame(h)));},seek(e){let t=Math.min(1,Math.max(0,e));s=t,i=t,o=true,cancelAnimationFrame(n),d$2(t);},getProgress(){return s}}}export{X as a};
|
package/dist/chunk-OMI46IXL.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-AJ22VSHC.mjs';var K="4.0.9",G=()=>typeof window<"u"&&typeof document<"u",C=e=>e!==null&&typeof e=="object"&&Object.prototype.toString.call(e)==="[object Object]";function q(e,...n){for(let t of n)if(C(t))for(let o of Object.keys(t)){let i=t[o];C(i)?(C(e[o])||(e[o]={}),q(e[o],i)):e[o]=i;}return e}function L(e){if(typeof e=="string")try{return Array.from(document.querySelectorAll(e))}catch{return []}return e instanceof Element?[e]:e&&typeof e.length=="number"?Array.from(e).filter(n=>n instanceof Element):[]}var $=(e=navigator.userAgent)=>/Android|iPhone|iPad|iPod/i.test(e),F=false;function P(e,...n){F&&typeof console<"u"&&console.log(`%cScrollReveal: ${e}${n.map(t=>`
|
|
2
|
-
\u2014 ${t}`).join("")}`,"color: #ea654b;");}var T=()=>[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function oe(e,n){let t=[];for(let o=0;o<4;o++)for(let i=0;i<4;i++){let r=0;for(let s=0;s<4;s++)r+=e[i+4*s]*n[4*o+s];t[i+4*o]=r;}return t}function ie(e){let n=/matrix(3d)?\(([^)]+)\)/.exec(e||"");if(!n)return T();let t=n[2].split(", ").map(parseFloat);if(t.length===16)return t;let o=T();return [o[0],o[1],o[4],o[5],o[12],o[13]]=t,o}function z(e,n){let t=Math.PI/180*n,o=Math.cos(t),i=Math.sin(t),r=T(),[s,l,c,h]=e==="x"?[5,10,6,9]:e==="y"?[0,10,8,2]:[0,5,1,4];return r[s]=r[l]=o,r[c]=i,r[h]=-i,r}function re(e,n){let t=T();return t[e==="X"?12:13]=n,t}function se(e){let n=T();return n[0]=n[5]=e,n}function v(e,n){for(let t of n.split(";")){let o=t.indexOf(":");if(o<1)continue;let i=t.slice(0,o).trim(),r=t.slice(o+1).trim();i&&r&&e.style.setProperty(i,r);}}function le(e){let{node:n,config:t}=e,o=window.getComputedStyle(n),i=(n.getAttribute("style")||"").match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[],r=i.map(d=>d.trim()),s=`${r.join("; ")};`,l=i.some(d=>/visibility\s?:\s?visible/i.test(d))?s:`${[...r,"visibility: visible"].join("; ")};`,c=parseFloat(o.opacity),h=t.opacity!==null&&!isNaN(parseFloat(String(t.opacity)))?parseFloat(String(t.opacity)):c,b=c!==h?{computed:`opacity: ${c};`,generated:`opacity: ${h};`}:{computed:"",generated:""},u=[];if(parseFloat(t.distance)){let d=t.origin==="top"||t.origin==="bottom"?"Y":"X",f=t.distance;(t.origin==="top"||t.origin==="left")&&(f=f.startsWith("-")?f.slice(1):`-${f}`);let E=f.match(/(^-?\d+\.?\d?)|(em$|px$|%$)/g)||[],m=Number(E[0]),A=E[1],I;if(A==="em")I=parseInt(o.fontSize,10)*m;else if(A==="px")I=m;else if(A==="%"){let Y=n.getBoundingClientRect();I=(d==="Y"?Y.height:Y.width)*m/100;}else throw new RangeError("Unrecognized or missing distance unit.");u.push(re(d,I));}t.rotate.x&&u.push(z("x",t.rotate.x)),t.rotate.y&&u.push(z("y",t.rotate.y)),t.rotate.z&&u.push(z("z",t.rotate.z)),t.scale!==1&&u.push(se(t.scale===0?2e-4:t.scale));let g={initial:"",final:""};if(u.length){let d=ie(o.transform);g={initial:`transform: matrix3d(${u.reduce(oe,d).join(", ")});`,final:`transform: matrix3d(${d.join(", ")});`};}let w={delayed:"",instant:""};if(b.generated||g.initial){let d=m=>`${m/1e3}s`,f=[],E=m=>({delayed:`${m} ${d(t.duration)} ${t.easing} ${d(t.delay)}`,instant:`${m} ${d(t.duration)} ${t.easing} 0s`});o.transition&&!/all 0s|none 0s/.test(o.transition)&&f.push({delayed:o.transition,instant:o.transition}),b.generated&&f.push(E("opacity")),g.initial&&f.push(E("transform")),w={delayed:`transition: ${f.map(m=>m.delayed).join(", ")};`,instant:`transition: ${f.map(m=>m.instant).join(", ")};`};}return {inline:{computed:s,generated:l},opacity:b,position:o.position,transform:g,transition:w}}var x=(...e)=>e.filter(n=>n!=="").join(" "),ae=()=>({delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.5, 0, 0, 1)",interval:0,opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,cleanup:false,container:document.documentElement,desktop:true,mobile:true,reset:false,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:()=>{},afterReveal:()=>{},beforeReset:()=>{},beforeReveal:()=>{}}),p=null,O=null,a={containers:{},elements:{},history:[],sequences:{}},W=true,j=null,R=0,D=false,ce=0,H=()=>ce++;function U(e,n=false){let t=e,o=n?t.clientHeight:t.offsetHeight,i=n?t.clientWidth:t.offsetWidth,r=0,s=0,l=t;for(;l;)isNaN(l.offsetTop)||(r+=l.offsetTop),isNaN(l.offsetLeft)||(s+=l.offsetLeft),l=l.offsetParent;return {bounds:{top:r,right:s+i,bottom:r+o,left:s},height:o,width:i}}var de=e=>e.node===document.documentElement?{top:window.pageYOffset,left:window.pageXOffset}:{top:e.node.scrollTop,left:e.node.scrollLeft};function ue(e){let n=a.containers[e.containerId];if(!n||!n.geometry||!n.scroll||!e.geometry)return false;let t=Math.max(0,Math.min(1,e.config.viewFactor)),o=e.config.viewOffset,i=e.geometry,r={top:i.bounds.top+i.height*t,right:i.bounds.right-i.width*t,bottom:i.bounds.bottom-i.height*t,left:i.bounds.left+i.width*t},s={top:n.geometry.bounds.top+n.scroll.top+o.top,right:n.geometry.bounds.right+n.scroll.left-o.right,bottom:n.geometry.bounds.bottom+n.scroll.top-o.bottom,left:n.geometry.bounds.left+n.scroll.left+o.left};return r.top<s.bottom&&r.right>s.left&&r.bottom>s.top&&r.left<s.right||e.styles.position==="fixed"}function Q(e,n=false){let t=n?e.config.duration+e.config.delay:e.config.duration,o=0;e.timer&&(o=Date.now()-e.timer.start,clearTimeout(e.timer.clock)),(e.revealed?e.config.beforeReveal:e.config.beforeReset)(e.node),e.timer={start:Date.now(),clock:setTimeout(()=>{(e.revealed?e.config.afterReveal:e.config.afterReset)(e.node),e.timer=null,e.revealed&&!e.config.reset&&e.config.cleanup&&B(e.node);},t-o)};}function fe(e,n){let t=e.styles;e.revealed=e.seen=true,v(e.node,x(t.inline.generated,t.opacity.computed,t.transform.final,n?t.transition.delayed:t.transition.instant)),Q(e,n);}function me(e){let n=e.styles;e.revealed=false,v(e.node,x(n.inline.generated,n.opacity.generated,n.transform.initial,n.transition.instant)),Q(e);}function k(e,n={}){let t=n.pristine||W,o=e.config.useDelay,i=o==="always"||o==="onload"&&t||o==="once"&&!e.seen;if(n.reveal||e.visible&&!e.revealed)return fe(e,i);if(n.reset||!e.visible&&e.revealed&&e.config.reset)return me(e)}function J(e,n){let t=[],o=[],i=[];return e.members.forEach((r,s)=>{a.elements[r]?.[n]&&o.push(s);}),o.length&&e.members.forEach((r,s)=>{let l=a.elements[r];l&&!l[n]&&(s<o[0]?t:i).push(s);}),{head:t,body:o,foot:i}}function M(e,n,t,o){let i=t<0?"head":"foot",r=a.elements[e.members[n+t]];e.blocked[i]=true,setTimeout(()=>{e.blocked[i]=false,r&&Z(r,o);},e.interval);}function Z(e,n=W){if(!e.visible&&e.revealed&&e.config.reset)return k(e,{reset:true});let t=e.sequence&&a.sequences[e.sequence.id];if(!t||!e.sequence)return;let o=e.sequence.index,i=J(t,"visible"),r=J(t,"revealed");if(!r.body.length){let l=i.body[0],c=a.elements[t.members[l]];if(c)return M(t,l,-1,n),M(t,l,1,n),k(c,{reveal:true,pristine:n})}let s=l=>l[l.length-1];if(!t.blocked.head&&o===s(r.head)&&o>=(i.body[0]??1/0))return M(t,o,-1,n),k(e,{reveal:true,pristine:n});if(!t.blocked.foot&&o===r.foot[0]&&o<=(s(i.body)??-1/0))return M(t,o,1,n),k(e,{reveal:true,pristine:n})}function be(){R=0;let e=D;D=false;for(let t of Object.values(a.containers))(e||!t.geometry)&&(t.geometry=U(t.node,true)),t.scroll=de(t);let n=Object.values(a.elements);for(let t of n)(e||!t.geometry)&&(t.geometry=U(t.node)),t.visible=ue(t);for(let t of n)t.sequence?Z(t):k(t);W=false;}function y(e){let n=e?e.type:"init";(n==="init"||n==="resize")&&(D=true),R||(R=requestAnimationFrame(be));}var S=e=>e.node===document.documentElement?window:e.node;function _(){let e=new Set(Array.from(document.querySelectorAll("[data-sr-id]")).map(o=>parseInt(o.getAttribute("data-sr-id")||"",10)));for(let o of Object.values(a.elements))e.has(o.id)||delete a.elements[o.id];let n=new Set,t=new Set;for(let o of Object.values(a.elements))n.add(o.containerId),o.sequence&&t.add(o.sequence.id);for(let o of Object.values(a.containers))n.has(o.id)||(S(o).removeEventListener("scroll",y),S(o).removeEventListener("resize",y),delete a.containers[o.id]);for(let o of Object.values(a.sequences))t.has(o.id)||delete a.sequences[o.id];}function ee(){j=null,_();let e=a$1();for(let n of Object.values(a.elements)){let t=n.styles;e?(n.visible=n.revealed=n.seen=true,v(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final,"transition: none;"))):n.visible?(n.revealed=true,v(n.node,x(t.inline.generated,t.opacity.computed,t.transform.final))):(n.revealed=false,v(n.node,x(t.inline.generated,t.opacity.generated,t.transform.initial)));}if(!e){for(let n of Object.values(a.containers))S(n).addEventListener("scroll",y),S(n).addEventListener("resize",y);y();}}function te(e,n={},t=false){if(!p)return;let o=[],i=n.interval||0,r,s;try{if(i){let c=Math.abs(i);if(isNaN(c))throw new RangeError("Invalid sequence interval.");r={id:H(),interval:Math.max(c,16),members:[],blocked:{head:!1,foot:!1}};}let l=L(e);if(!l.length)throw new Error("Invalid reveal target.");s=[];for(let c of l){let h=c.getAttribute("data-sr-id"),b=h!==null?a.elements[Number(h)]:void 0,u=b?q({},b):{id:H(),node:c,seen:!1,revealed:!1,visible:!1};b&&v(c,b.styles.inline.computed);let g=q({},b?b.config:p,n);if(!g.mobile&&$()||!g.desktop&&!$()){b&&B(c);continue}let w=L(g.container)[0];if(!w)throw new Error("Invalid container.");if(!w.contains(c))continue;let d=[...o,...Object.values(a.containers)].find(f=>f.node===w)?.id;d===void 0&&(d=H(),o.push({id:d,node:w})),u.config=g,u.containerId=d,u.styles=le(u),r&&(u.sequence={id:r.id,index:r.members.length},r.members.push(u.id)),s.push(u);}for(let c of s)a.elements[c.id]=c,c.node.setAttribute("data-sr-id",String(c.id));}catch(l){return P("Reveal failed.",l.message)}for(let l of o)a.containers[l.id]=l;r&&(a.sequences[r.id]=r),t||(a.history.push({target:e,options:n}),j&&clearTimeout(j),j=setTimeout(ee,0));}function B(e){let n=false;for(let t of L(e)){let o=t.getAttribute("data-sr-id");if(o===null)continue;n=true;let i=a.elements[Number(o)];i&&(i.timer&&clearTimeout(i.timer.clock),v(i.node,i.styles.inline.generated),delete a.elements[i.id]),t.removeAttribute("data-sr-id");}n&&_();}function ge(){for(let e of Object.values(a.elements))v(e.node,e.styles.inline.generated),e.node.removeAttribute("data-sr-id");for(let e of Object.values(a.containers))S(e).removeEventListener("scroll",y),S(e).removeEventListener("resize",y);R&&cancelAnimationFrame(R),R=0,a={containers:{},elements:{},history:[],sequences:{}};}function pe(){for(let e of a.history)te(e.target,e.options,true);ee();}var N=()=>(G()&&document.documentElement.classList.remove("sr"),{reveal(){},clean(){},destroy(){},sync(){},defaults:{},version:K,noop:true});function ne(){if(!G())return false;let e=document.documentElement.style;return ("transform"in e||"WebkitTransform"in e)&&("transition"in e||"WebkitTransition"in e)}function ve(){document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",()=>{document.body.style.height="100%";},{once:true});}function ye(e={}){if(!G()||!ne())return N();let n;try{if(n=q({},p??ae(),e),!L(n.container)[0])throw new Error("Invalid container.")}catch(t){return P("Invalid configuration.",t.message),N()}return p=n,!p.mobile&&$()||!p.desktop&&!$()?(P("This device is disabled.",`desktop: ${p.desktop}`,`mobile: ${p.mobile}`),N()):(ve(),O||(O={reveal:(t,o)=>te(t,o),clean:B,destroy:ge,sync:pe,get defaults(){return p},version:K,noop:false},Object.defineProperty(O,"delegate",{value:y})),O)}var X=ye;X.isSupported=ne;Object.defineProperty(X,"debug",{get:()=>F,set:e=>{typeof e=="boolean"&&(F=e);}});var we=X;export{X as a,we as b};
|