svg-scroll-draw 2.23.1 → 2.23.3
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 +12 -13
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +77 -118
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-23EALNDF.mjs +3 -0
- package/dist/{chunk-DY5JCXVR.mjs → chunk-4H2SGMAQ.mjs} +1 -1
- package/dist/{chunk-VMUJMXKO.mjs → chunk-4I7MLTP5.mjs} +1 -1
- package/dist/{chunk-OTDD2ROH.mjs → chunk-BLY6F6EC.mjs} +1 -1
- package/dist/{chunk-GVBO5GRD.mjs → chunk-ETACBG7W.mjs} +1 -1
- package/dist/chunk-GMBIGV3M.mjs +1 -0
- package/dist/chunk-LGJQWZHH.mjs +1 -0
- package/dist/chunk-UPWWULKI.mjs +1 -0
- package/dist/chunk-V4L3ELVC.mjs +1 -0
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +4 -2
- package/dist/group/index.d.ts +4 -2
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- 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.cjs +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/vue/index.cjs +3 -3
- 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-HX4SP5WN.mjs +0 -3
- package/dist/chunk-KV3WCPQ5.mjs +0 -1
- package/dist/chunk-LTCJVVSC.mjs +0 -1
- package/dist/chunk-WXUOF4NM.mjs +0 -1
- package/dist/chunk-YWKPTYSG.mjs +0 -1
package/dist/react/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
3
|
-
<div style="position:absolute;${
|
|
4
|
-
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",o,{passive:true}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove();}}}var _t=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Wt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Ln(e,r,t){if(!Je)return;let n=(e.match(Wt)??[]).join("").toUpperCase(),o=(r.match(Wt)??[]).join("").toUpperCase(),s=(e.match(_t)??[]).length,a=(r.match(_t)??[]).length;if(n!==o){we(`morphTo: command sequence differs (${n||"\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}s!==a&&we(`morphTo: coordinate count differs (${s} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function wt(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let a=parseFloat(s),m=n[o++]??a;return String(+(a+(m-a)*t).toFixed(4))})}function qt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:qe(r,(t,n)=>An(e,t,n))}function An(e,r,t){let{preset:n,...o}=r,s=n?{...It[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:d="linear",trigger:x={},stagger:P=0,direction:C="forward",once:j=false,debug:oe=false,axis:O="y",scrollContainer:Q,autoReverse:U=false,delay:I=0,strokeColor:H,strokeWidth:$,fillOpacity:M,waypoints:y,velocityScale:h=false,threshold:v=0,rootMargin:_="0px",repeat:S=0,repeatDelay:D=0,morphTo:T,clip:ee,autoplay:se=false,duration:X=1e3,native:W=true,onProgress:f,onStart:k,onComplete:w,onEnter:N,onLeave:ce,onEnterBack:ye,onLeaveBack:Te}=s,ie=ee===true?"left":typeof ee=="string"?ee:false,L=typeof d=="function"?d:J[d]??J.linear,he=le(x.start??"top bottom"),Ae=le(x.end??"bottom top"),fe=typeof Q=="string"?document.querySelector(Q):Q??null,pe=Array.isArray(H)?H[0]:null,ue=Array.isArray(H)?H[1]:typeof H=="string"?H:null,me=Array.isArray($)?$[0]:null,te=Array.isArray($)?$[1]:typeof $=="number"?$:null,be=Array.isArray(M)?M[0]:null,ae=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Re(i){let c=i*100;switch(ie){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(${i*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let q=ie?[]:Array.from(e.querySelectorAll(a)),F=[],ve=[],l=0,p=0,Pe=P,xe=0,R=false,V=false,Y=0,He=false,G=-1,Fe=[],ze=-1,de=false,Oe=0,Ne=0,Ve,pt=null;function Et(){pt?.destroy(),pt=null;}let _e=new Set,St=NaN,We=true,rt=-1,Tt=performance.now(),Be=NaN;function Ye(){return fe?O==="x"?fe.scrollLeft:fe.scrollTop:O==="x"?window.scrollX:window.scrollY}function xt(){return fe?O==="x"?fe.clientWidth:fe.clientHeight:O==="x"?window.innerWidth:window.innerHeight}function Mt(){let i=lt(e,fe,O);return Se(i,i.scroll,xt(),he,Ae)}function cn(){let i=p-l,c=q.length-1,b=fe??document.documentElement,ne=O==="x"?"Width":"Height";if(Pe=P,P>0&&c>0&&i>0){let Me=b[`scroll${ne}`]-b[`client${ne}`]-1-l-i/m;Me>=0&&(Pe=Math.min(P,Me/(c*i)));}xe=p+c*Pe*i;}function Lt(){(({tStart:l,tEnd:p}=Mt())),cn(),oe&&Je&&(Et(),pt=Mn(l,p,O));}function dt(i,c=Mt){$e(e,{type:"draw",getProgress:()=>i.getProgress(),getTrigger:c});let b=i.destroy;return i.destroy=()=>{b.call(i),ke(e);},i}function un(i,c){if(e.style.setProperty("--scroll-draw-progress",String(i)),ie){let b=c==="reverse"?1-i:i;e.style.clipPath=Re(b);return}q.forEach((b,ne)=>{b.style.strokeDashoffset=c==="reverse"?`${F[ne]*i}`:`${F[ne]*(1-i)}`,u&&(b.style.opacity=c==="reverse"?`${1-i}`:`${i}`),pe&&ue?b.style.stroke=Qe(pe,ue,i):ue&&(b.style.stroke=ue),me!==null&&te!==null?b.style.strokeWidth=`${me+(te-me)*i}`:te!==null&&(b.style.strokeWidth=`${te}`),be!==null&&ae!==null?b.style.fillOpacity=`${be+(ae-be)*i}`:ae!==null&&(b.style.fillOpacity=`${ae}`),T&&b.tagName.toLowerCase()==="path"&&ve[ne]&&b.setAttribute("d",wt(ve[ne],T,i));});}function ot(){if(e.style.setProperty("--scroll-draw-progress","0"),ie){e.style.clipPath=Re(0);return}q.forEach((i,c)=>{i.style.strokeDasharray=`${F[c]}`,i.style.strokeDashoffset=C==="reverse"?"0":`${F[c]}`,u?i.style.opacity=C==="reverse"?"1":"0":i.style.opacity="",pe&&(i.style.stroke=pe),me!==null&&(i.style.strokeWidth=`${me}`),be!==null&&(i.style.fillOpacity=`${be}`),T&&i.tagName.toLowerCase()==="path"&&ve[c]&&i.setAttribute("d",ve[c]);});}if(q.forEach(i=>{xn(i);let c=Ge(i);F.push(c);let b=i.tagName.toLowerCase()==="path";b?ve.push(i.getAttribute("d")??""):ve.push(""),T&&(b?Ln(ve[ve.length-1],T,i):we(`morphTo only applies to <path> elements \u2014 ignored on <${i.tagName}>.`,i)),t?(i.style.strokeDasharray=`${c}`,i.style.strokeDashoffset=C==="reverse"?`${c}`:"0",u&&(i.style.opacity="1"),ue&&(i.style.stroke=ue),te!==null&&(i.style.strokeWidth=`${te}`),ae!==null&&(i.style.fillOpacity=`${ae}`),T&&i.tagName.toLowerCase()==="path"&&i.setAttribute("d",T)):(i.style.strokeDasharray=`${c}`,i.style.strokeDashoffset=C==="reverse"?"0":`${c}`,u?i.style.opacity=C==="reverse"?"1":"0":i.style.opacity="",pe&&(i.style.stroke=pe),me!==null&&(i.style.strokeWidth=`${me}`),be!==null&&(i.style.fillOpacity=`${be}`));}),ie){if(t)return e.style.clipPath=Re(1),w?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Re(0);}else if(t)return w?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let At=typeof d=="string"?ct(d):null;function mn(){return !(W===false||!Tn()||!q.length||!At||ie||O!=="y"||fe||m!==1||P!==0||j||U||h!==false||T||y||S||I>0||f||k||w||N||ce||ye||Te||H!=null||$!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function fn(){let i=++Sn,c=`svg-scroll-draw-${i}`,b=`svg-scroll-draw-host-${i}`,ne=`--svg-scroll-draw-${i}`,Me=C==="reverse"?"0":"var(--ssd-len)",Ie=C==="reverse"?"var(--ssd-len)":"0",Ce=`stroke-dashoffset:${Me};`,A=`stroke-dashoffset:${Ie};`;u&&(Ce+=`opacity:${C==="reverse"?1:0};`,A+=`opacity:${C==="reverse"?0:1};`);let z=document.createElement("style");z.setAttribute("data-svg-scroll-draw",""),z.textContent=`@keyframes ${c}{from{${Ce}}to{${A}}}.${b}{view-timeline-name:${ne};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${ne};animation-range:cover 0% cover 100%;}`,document.head.appendChild(z),e.classList.add(b);function ge(g,re){g.style.setProperty("--ssd-len",String(F[re])),g.style.strokeDasharray=`${F[re]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(c);}q.forEach(ge);let E=false,B=-1;function K(){if(B>=0)return B;let g=e.getBoundingClientRect(),{tStart:re,tEnd:Le}=Se({top:g.top,height:g.height},Ye(),xt(),he,Ae);return L(Z(Ye(),re,Le,m))}return {destroy(){e.classList.remove(b),q.forEach(g=>{g.classList.remove(c),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),z.remove();},replay(){E=false,B=-1,q.forEach(ge);},pause(){E=true,q.forEach(g=>{g.style.animationPlayState="paused";});},resume(){E&&(E=false,q.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let re=Math.min(1,Math.max(0,g));B=re,E=true,q.forEach((Le,Ee)=>{Le.classList.remove(c),Le.style.strokeDashoffset=C==="reverse"?`${F[Ee]*re}`:`${F[Ee]*(1-re)}`,u&&(Le.style.opacity=C==="reverse"?`${1-re}`:`${re}`);});},getProgress(){return K()},refresh(){q.forEach((g,re)=>{F[re]=Ge(g),g.style.setProperty("--ssd-len",String(F[re])),g.style.strokeDasharray=`${F[re]}`;});}}}if(mn())return dt(fn());function pn(){let i=Math.max(1,X),c=0,b=0,ne=false;function Me(E){let B=true;if(ie){let K=Math.min(1,Math.max(0,E/i)),g=L(K);Oe=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=Re(C==="reverse"?1-g:g),f?.(g),K<1&&(B=false);}else q.forEach((K,g)=>{let re=g*P*i,Le=Math.min(1,Math.max(0,(E-re)/i)),Ee=L(Le);K.style.strokeDashoffset=C==="reverse"?`${F[g]*Ee}`:`${F[g]*(1-Ee)}`,u&&(K.style.opacity=C==="reverse"?`${1-Ee}`:`${Ee}`),pe&&ue?K.style.stroke=Qe(pe,ue,Ee):ue&&(K.style.stroke=ue),me!==null&&te!==null?K.style.strokeWidth=`${me+(te-me)*Ee}`:te!==null&&(K.style.strokeWidth=`${te}`),be!==null&&ae!==null?K.style.fillOpacity=`${be+(ae-be)*Ee}`:ae!==null&&(K.style.fillOpacity=`${ae}`),T&&K.tagName.toLowerCase()==="path"&&ve[g]&&K.setAttribute("d",wt(ve[g],T,Ee)),g===0&&(Oe=Ee,f?.(Ee),e.style.setProperty("--scroll-draw-progress",String(Ee))),Le<1&&(B=false);});if(y){let K=Math.min(1,Math.max(0,E/i)),g=L(K);for(let re in y){let Le=parseFloat(re);g>=Le&&!_e.has(Le)&&(_e.add(Le),y[re]?.());}}return B}function Ie(E){if(de)return;let B=E-c;V||(V=true,k?.());let K=Me(B);if(K&&!R){R=true,Me(i*(1+Math.max(0,q.length-1)*P)),w?.(),Ne<(S==="infinite"?1/0:S??0)&&(Ne++,Ve=setTimeout(()=>{c=performance.now(),V=false,R=false,_e.clear(),ot(),Y=requestAnimationFrame(Ie);},D));return}K||(Y=requestAnimationFrame(Ie));}function Ce(){cancelAnimationFrame(Y),clearTimeout(Ve),c=performance.now(),b=0,de=false,V=false,R=false,Ne=0,ne=true,Oe=0,_e.clear(),ot(),Y=requestAnimationFrame(Ie);}let A=new IntersectionObserver(E=>{E.forEach(B=>{B.isIntersecting&&!(j&&R)?Ce():!B.isIntersecting&&!j&&!R&&(cancelAnimationFrame(Y),clearTimeout(Ve),ne=false);});},{root:fe??null,threshold:v,rootMargin:_}),z;function ge(){clearTimeout(z),z=setTimeout(()=>{q.forEach((E,B)=>{F[B]=Ge(E),E.style.strokeDasharray=`${F[B]}`;});},150);}return window.addEventListener("resize",ge),window.addEventListener("orientationchange",ge),I>0?setTimeout(()=>A.observe(e),I):A.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Ve),A.disconnect(),window.removeEventListener("resize",ge),window.removeEventListener("orientationchange",ge),clearTimeout(z);},replay(){Ne=0,Ce();},pause(){de||!ne||(de=true,b=performance.now()-c,cancelAnimationFrame(Y));},resume(){de&&(de=false,ne=true,c=performance.now()-b,Y=requestAnimationFrame(Ie));},seek(E){let B=Math.min(1,Math.max(0,E));Oe=B,de=true,b=B*i,c=performance.now()-b,cancelAnimationFrame(Y),Me(b);},getProgress(){return Oe},refresh(){clearTimeout(z),q.forEach((E,B)=>{F[B]=Ge(E),E.style.strokeDasharray=`${F[B]}`;});}}}if(se)return dt(pn());Lt();function Pt(){if(de||!je)return;let i=performance.now(),c=Ye();if(!We&&h===false&&c===St){yt(c);return}We=false,St=c;let b=m;if(h!==false){let A=i-Tt,z=A>0?Math.abs(c-(rt<0?c:rt))/A:0;b=m*Math.max(.2,1+z*(typeof h=="number"?h:1)*.04);}rt=c,Tt=i;let ne=U?ze===-1||c>=ze?"forward":"reverse":C;ze=c;let Me=p-l,Ie=true,Ce=Me===0?0:(c-l)/Me;if(isNaN(Be)||(Be<=0&&Ce>0?N?.():Be>0&&Ce<=0&&Te?.(),Be<1&&Ce>=1?ce?.():Be>=1&&Ce<1&&ye?.()),Be=Ce,ie){let A=L(Z(c,l,p,b));j&&!U&&(G=Math.max(G,A),A=G),Oe=A,e.style.setProperty("--scroll-draw-progress",String(A));let z=ne==="reverse"?1-A:A;e.style.clipPath=Re(z),f?.(A),!V&&Z(c,l,p,b)>0&&(V=true,k?.()),A>=1&&!R?(R=true,w?.(),Ne<(S==="infinite"?1/0:S??0)&&(Ne++,Ve=setTimeout(()=>{G=-1,V=false,R=false,e.style.clipPath=Re(0);},D))):A<1&&!j&&(R=false),yt(c);return}if(q.forEach((A,z)=>{let ge=z*Pe*Me,E=L(Z(c,l+ge,p+ge,b));j&&!U&&(E=Fe[z]=Math.max(Fe[z]??G,E)),A.style.strokeDashoffset=ne==="reverse"?`${F[z]*E}`:`${F[z]*(1-E)}`,u&&(A.style.opacity=ne==="reverse"?`${1-E}`:`${E}`),pe&&ue?A.style.stroke=Qe(pe,ue,E):ue&&(A.style.stroke=ue),me!==null&&te!==null?A.style.strokeWidth=`${me+(te-me)*E}`:te!==null&&(A.style.strokeWidth=`${te}`),be!==null&&ae!==null?A.style.fillOpacity=`${be+(ae-be)*E}`:ae!==null&&(A.style.fillOpacity=`${ae}`),T&&A.tagName.toLowerCase()==="path"&&ve[z]&&A.setAttribute("d",wt(ve[z],T,E)),z===0&&(Oe=E,f?.(E),e.style.setProperty("--scroll-draw-progress",String(E))),E<1&&(Ie=false);}),y){let A=L(Z(c,l,p,b));for(let z in y){let ge=parseFloat(z);A>=ge&&!_e.has(ge)&&(_e.add(ge),y[z]?.());}}!V&&Z(c,l,p,b)>0&&(V=true,k?.()),Ie&&!R?(R=true,w?.(),Ne<(S==="infinite"?1/0:S??0)&&(Ne++,Ve=setTimeout(()=>{G=-1,Fe=[],V=false,R=false,_e.clear(),ot(),We=true;},D))):!Ie&&!j&&(R=false),yt(c);}function gt(i){return i>=p&&i<xe}function yt(i){He||gt(i)?Y=requestAnimationFrame(Pt):je=false;}function ht(){return He||gt(Ye())}let je=false;function st(){je||(je=true,Y=requestAnimationFrame(function(){Pt();}));}function it(){je=false,cancelAnimationFrame(Y);}let bt=new IntersectionObserver(i=>{i.forEach(c=>{He=c.isIntersecting,He&&!de?(We=true,st()):je&&!de&>(Ye())||it();});},{root:fe??null,threshold:v,rootMargin:_});function Ct(){q.forEach((i,c)=>{F[c]=Ge(i),i.style.strokeDasharray=`${F[c]}`;}),Lt(),We=true;}let at;function Ke(){clearTimeout(at),at=setTimeout(Ct,150);}window.addEventListener("resize",Ke),window.addEventListener("orientationchange",Ke);let dn=De([e],Ke);return I>0?setTimeout(()=>bt.observe(e),I):bt.observe(e),dt({destroy(){cancelAnimationFrame(Y),clearTimeout(Ve),it(),bt.disconnect(),dn(),window.removeEventListener("resize",Ke),window.removeEventListener("orientationchange",Ke),clearTimeout(at),Et();},replay(){G=-1,Fe=[],ze=-1,rt=-1,V=false,R=false,Ne=0,de=false,Oe=0,_e.clear(),clearTimeout(Ve),ot(),We=true,ht()&&st();},pause(){de=true,it();},resume(){de&&(de=false,We=true,ht()&&st());},seek(i){let c=Math.min(1,Math.max(0,i));Oe=c,G=c,Fe=[],de=true,it(),un(c,C),We=true;},getProgress(){return Oe},refresh(){clearTimeout(at),Ct(),ht()&&!de&&st();}},()=>({tStart:l,tEnd:p}))}var Bt=new WeakMap,Pn=0;function jt(e){return JSON.stringify(e,(r,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let n=Bt.get(t);return n===void 0&&Bt.set(t,n=++Pn),`el#${n}`}return t})}function Gt(e,r){let t={...e};for(let n of Object.keys(t))typeof t[n]=="function"&&(t[n]=(...o)=>r()[n]?.(...o));return t}function Cn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Qt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let o=[],s=[],a=n[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}r.push({fn:n[1],nums:o,units:s});}return r}function $n(e,r,t){let n=Qt(e),o=Qt(r);return n.length===0||n.length!==o.length?t<1?e:r:n.map((s,a)=>{let m=o[a];return s.fn!==m.fn||s.nums.length!==m.nums.length?t<1?`${s.fn}(${s.nums.map((u,d)=>`${u}${s.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,d)=>`${u}${m.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,d)=>`${u+(m.nums[d]-u)*t}${s.units[d]}`).join(", ")})`}).join(" ")}function Ut(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),o=String(r);if(Cn(n))return Qe(n,o,t);if(n.includes("("))return $n(n,o,t);let s=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let m=parseFloat(s[1]),u=parseFloat(a[1]);return `${m+(u-m)*t}${s[2]||a[2]}`}return t<1?n:o}function kn(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Rn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),On=0,Xt="--scroll-draw-progress";function In(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Kt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Jt(e,r){return typeof window>"u"?Kt:r.respectReducedMotion===false?Yt(e,r,false):qe(r,(t,n)=>Yt(e,t,n))}function Yt(e,r,t){let{props:n,trigger:o={},easing:s="ease-out",speed:a=1,once:m=false,axis:u="y",scrollContainer:d,native:x=true,velocityScale:P=false,triggerElement:C,onProgress:j,onComplete:oe,onEnter:O,onLeave:Q,onEnterBack:U,onLeaveBack:I}=r,H=typeof s=="function"?s:J[s]??J["ease-out"],$=le(o.start??"top bottom"),M=le(o.end??"bottom top"),y=C??e,h=typeof d=="string"?document.querySelector(d):d??null,v=Object.entries(n).map(([l,p])=>({prop:kn(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function _(){let l=window.getComputedStyle(e);for(let p of v)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function S(){for(let l of v)e.style.setProperty(l.prop,String(l.to));}let D=new Map;for(let l of [...v.map(p=>p.prop),Xt])D.set(l,e.style.getPropertyValue(l));function T(){for(let[l,p]of D)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(t)return S(),oe?.(),{...Kt,destroy:T,getProgress:()=>1};_();let ee=typeof s=="string"?ct(s):null;function se(){if(!x||!In()||!ee||u!=="y"||h||y!==e||m||a!==1||j||oe||O||Q||U||I||P!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let l of v)if(!Rn.has(l.prop))return false;return true}function X(){let l=`ssd-a-${++On}`,p=v.map(G=>`${G.prop}:${G.from}`).join(";"),Pe=v.map(G=>`${G.prop}:${G.to}`).join(";"),xe=document.createElement("style");xe.setAttribute("data-ssd-animate",""),xe.textContent=`@keyframes ${l}{from{${p}}to{${Pe}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(xe),e.classList.add(l);let R=()=>u==="x"?window.scrollX:window.scrollY,V=()=>u==="x"?window.innerWidth:window.innerHeight,Y=()=>{let G=e.getBoundingClientRect();return Se({top:G.top,height:G.height},R(),V(),$,M)};$e(e,{type:"animate",getProgress:()=>He.getProgress(),getTrigger:Y});let He={refresh(){},destroy(){e.classList.remove(l),xe.remove(),e.style.animationPlayState="",T(),ke(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(G){let Fe=Math.min(1,Math.max(0,G));e.classList.remove(l);for(let ze of v)e.style.setProperty(ze.prop,Ut(ze.from,ze.to,Fe));},getProgress(){let{tStart:G,tEnd:Fe}=Y();return H(Z(R(),G,Fe,a))}};return He}if(se())return X();let W=0,f=0,k=0,w=false,N=false,ce=-1,ye=0,Te=false,ie=NaN,L=-1,he=0,Ae=()=>h?u==="x"?h.scrollLeft:h.scrollTop:u==="x"?window.scrollX:window.scrollY,fe=()=>h?u==="x"?h.clientWidth:h.clientHeight:u==="x"?window.innerWidth:window.innerHeight,pe=y===e?v:[],ue=false;function me(){let l=e.style,p=pe.map(V=>l.getPropertyValue(V.prop)),Pe=l.transition;pe.length&&(l.transition="none"),pe.forEach(V=>l.setProperty(V.prop,D.get(V.prop)??""));let xe=lt(y,h,u);pe.forEach((V,Y)=>l.setProperty(V.prop,p[Y])),pe.length&&(e.offsetWidth,l.transition=Pe);let R=Se(xe,xe.scroll,fe(),$,M);ue&&Math.abs(R.tStart-W)<1&&Math.abs(R.tEnd-f)<1||(ue=true,W=R.tStart,f=R.tEnd);}function te(l){e.style.setProperty(Xt,String(l));for(let p of v)e.style.setProperty(p.prop,Ut(p.from,p.to,l));j?.(l);}function be(l){if(isNaN(ie)){ie=l;return}ie<=0&&l>0?O?.():ie>0&&l<=0&&I?.(),ie<1&&l>=1?Q?.():ie>=1&&l<1&&U?.(),ie=l;}function ae(){if(!w||N)return;let l=performance.now(),p=Ae(),Pe=a;if(P!==false){let V=l-he,Y=V>0?Math.abs(p-(L<0?p:L))/V:0;Pe=a*Math.max(.2,1+Y*(typeof P=="number"?P:1)*.04);}L=p,he=l;let xe=f===W?0:(p-W)/(f-W);be(xe);let R=H(Z(p,W,f,Pe));m&&(ce=Math.max(ce,R),R=ce),ye=R,te(R),R>=1&&!Te?(Te=true,oe?.()):R<1&&!m&&(Te=false),k=requestAnimationFrame(ae);}me(),f===W&&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 l=H(Z(Ae(),W,f,a));m&&l>0&&(ce=l),ye=l,te(l);}let Re=new IntersectionObserver(l=>{l.forEach(p=>{w=p.isIntersecting,w&&!N?k=requestAnimationFrame(ae):cancelAnimationFrame(k);});},{root:h??null}),q;function F(){clearTimeout(q),q=setTimeout(me,150);}window.addEventListener("resize",F),window.addEventListener("orientationchange",F);let ve=De([y],F);return Re.observe(e),$e(e,{type:"animate",getProgress:()=>ye,getTrigger:()=>({tStart:W,tEnd:f})}),{destroy(){cancelAnimationFrame(k),Re.disconnect(),window.removeEventListener("resize",F),window.removeEventListener("orientationchange",F),ve(),clearTimeout(q),T(),ke(e);},replay(){ce=-1,Te=false,ye=0,N=false,te(0);},pause(){N=true,cancelAnimationFrame(k);},resume(){N&&(N=false,w&&(k=requestAnimationFrame(ae)));},seek(l){let p=Math.min(1,Math.max(0,l));ye=p,ce=p,N=true,cancelAnimationFrame(k),te(p);},getProgress(){return ye},refresh(){me();}}}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Zt(e,r){if(typeof window>"u")return vt;let t=typeof e=="string"?document.querySelector(e):e;return t?qe(r,(n,o)=>Dn(t,n,o)):(we("scrollCounter: element not found:",e),vt)}function Dn(e,r,t){let{from:n=0,to:o,format:s,easing:a="ease-out",trigger:m={},once:u=true,decimals:d,onComplete:x}=r,P=d!==void 0?f=>f.toFixed(d):s??(f=>String(Math.round(f))),C=typeof a=="function"?a:J[a]??J["ease-out"],j=le(m.start??"top 80%"),oe=le(m.end??"top 20%");if(t)return e.textContent=P(o),x?.(),{...vt,getProgress:()=>1};let O=0,Q=0,U=false,I=0,H=false,$=false,M=-1,y=0,h=false,v=()=>window.scrollY,_=()=>window.innerHeight;function S(){let f=e.getBoundingClientRect(),k=Se({top:f.top,height:f.height},v(),_(),j,oe);U&&Math.abs(k.tStart-O)<1&&Math.abs(k.tEnd-Q)<1||(U=true,O=k.tStart,Q=k.tEnd);}function D(f){e.textContent=P(n+(o-n)*f),e.style.setProperty("--scroll-draw-progress",String(f));}function T(){if(!H||$)return;let f=C(Z(v(),O,Q,1));u&&(M=Math.max(M,f),f=M),y=f,D(f),f>=1&&!h?(h=true,x?.()):f<1&&!u&&(h=false),I=requestAnimationFrame(T);}S();{let f=C(Z(v(),O,Q,1));u&&f>0&&(M=f),y=f,D(f);}let ee=new IntersectionObserver(f=>{f.forEach(k=>{H=k.isIntersecting,H&&!$?I=requestAnimationFrame(T):cancelAnimationFrame(I);});}),se;function X(){clearTimeout(se),se=setTimeout(S,150);}window.addEventListener("resize",X),window.addEventListener("orientationchange",X);let W=De([e],X);return ee.observe(e),$e(e,{type:"counter",getProgress:()=>y,getTrigger:()=>({tStart:O,tEnd:Q})}),{destroy(){cancelAnimationFrame(I),ee.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),W(),clearTimeout(se),ke(e);},replay(){M=-1,h=false,y=0,$=false,D(0);},pause(){$=true,cancelAnimationFrame(I);},resume(){$&&($=false,H&&(I=requestAnimationFrame(T)));},seek(f){let k=Math.min(1,Math.max(0,f));y=k,M=k,$=true,cancelAnimationFrame(I),D(k);},getProgress(){return y}}}var en={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tn(e,r={}){if(typeof window>"u")return en;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),en;let n=t,{trigger:o={},easing:s="linear",once:a=false,axis:m="y",preload:u="auto",triggerElement:d,onReady:x,onComplete:P,onProgress:C}=r,j=d??n,oe=window.matchMedia("(prefers-reduced-motion: reduce)").matches,O=typeof s=="function"?s:J[s]??J.linear,Q=le(o.start??"top top"),U=le(o.end??"bottom top");n.pause(),n.hasAttribute("preload")||(n.preload=u);let I=r.from??0,H=r.to,$=0,M=0,y=0,h=false,v=false,_=-1,S=0,D=false,T=false,ee=()=>m==="x"?window.scrollX:window.scrollY,se=()=>m==="x"?window.innerWidth:window.innerHeight;function X(){let L=j.getBoundingClientRect(),he=m==="x"?L.left:L.top,Ae=m==="x"?L.width:L.height,fe=Se({top:he,height:Ae},ee(),se(),Q,U);$=fe.tStart,M=fe.tEnd,T&&M===$&&we("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",n);}let W=NaN;function f(L){if(!T)return;let he=H??n.duration??0,Ae=I+(he-I)*L;Ae!==W&&(W=Ae,n.currentTime=Ae),n.style.setProperty("--scroll-draw-progress",String(L)),C?.(L);}function k(){if(!h||v||!T||oe)return;let L=O(Z(ee(),$,M,1));a&&(_=Math.max(_,L),L=_),S=L,f(L),L>=1&&!D?(D=true,P?.()):L<1&&!a&&(D=false),y=requestAnimationFrame(k);}function w(){if(T=true,H===void 0&&(H=n.duration),oe){f(1),x?.();return}X(),x?.(),h&&!v&&(y=requestAnimationFrame(k));}n.readyState>=1?w():n.addEventListener("loadedmetadata",w,{once:true}),T||X();let N=oe?()=>{}:Ue(L=>{L&&(N(),oe=true,cancelAnimationFrame(y),f(1));}),ce=new IntersectionObserver(L=>{L.forEach(he=>{h=he.isIntersecting,h&&!v&&T?y=requestAnimationFrame(k):cancelAnimationFrame(y);});}),ye;function Te(){clearTimeout(ye),ye=setTimeout(X,150);}window.addEventListener("resize",Te),window.addEventListener("orientationchange",Te);let ie=De([j],Te);return ce.observe(n),$e(n,{type:"video",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:M})}),{destroy(){cancelAnimationFrame(y),ce.disconnect(),n.removeEventListener("loadedmetadata",w),window.removeEventListener("resize",Te),window.removeEventListener("orientationchange",Te),ie(),N(),clearTimeout(ye),ke(n);},replay(){_=-1,D=false,S=0,v=false,W=NaN,f(0);},pause(){v=true,cancelAnimationFrame(y);},resume(){v&&(v=false,h&&T&&(y=requestAnimationFrame(k)));},seek(L){let he=Math.min(1,Math.max(0,L));S=he,_=he,v=true,cancelAnimationFrame(y),W=NaN,f(he);},getProgress(){return S}}}function nn(e,r){let t=document.createElement("span");t.textContent=r,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 sn(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(n.textContent=t,n.style.whiteSpace="pre"):(n.textContent=t,n.style.display="inline-block"),e.appendChild(n),/^\s+$/.test(t)?null:n}).filter(t=>t!==null)}function Fn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=t,t===" "?n.style.whiteSpace="pre":n.style.display="inline-block",e.appendChild(n),t===" "?null:n}).filter(t=>t!==null)}function rn(e){let r=sn(e),t=new Map;for(let s of r){let a=s.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(s);}let n=[],o=Array.from(t.keys()).sort((s,a)=>s-a);for(let s of o){let a=t.get(s),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",a.forEach((u,d)=>{let x=u.nextElementSibling;m.appendChild(u),d<a.length-1&&x&&x.style.whiteSpace==="pre"&&m.appendChild(x);}),n.push(m);}return e.textContent="",n.forEach((s,a)=>{e.appendChild(s),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function Nn(e,r,t,n){if(t<=1||n===0)return e;let o=(t-1)*n,s=r*n,a=s+(1-o);return a<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(a-s)))}function Hn(e,r){let t=[];if(r?.y!==void 0&&t.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&t.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&t.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let n=r.scale+(1-r.scale)*e;t.push(`scale(${n})`);}return t.join(" ")||""}var on={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function an(e,r={}){if(typeof window>"u")return on;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return we("scrollText: element not found:",e),on;let n=t;return qe(r,(o,s)=>zn(n,o,s))}function zn(e,r,t){let{split:n="words",stagger:o=.04,easing:s="ease-out",from:a={opacity:0,y:24},trigger:m={},once:u=true,onComplete:d}=r,x=typeof s=="function"?s:J[s]??J["ease-out"],P=le(m.start??"top 85%"),C=le(m.end??"top 40%"),j=e.innerHTML,oe=e.textContent??"",O;n==="chars"?O=Fn(e):n==="lines"?O=rn(e):O=sn(e),nn(e,oe);let Q=O.length;function U(w,N){a?.opacity!==void 0&&(w.style.opacity=String(a.opacity+(1-a.opacity)*N));let ce=Hn(N,a);ce&&(w.style.transform=ce);}function I(w){e.style.setProperty("--scroll-draw-progress",String(w)),O.forEach((N,ce)=>{let ye=x(Nn(w,ce,Q,o));U(N,ye);});}if(t)return I(1),d?.(),{destroy(){e.innerHTML=j;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};I(0);let H=0,$=0,M=0,y=false,h=false,v=-1,_=0,S=false,D=()=>window.scrollY,T=()=>window.innerHeight;function ee(){let w=e.getBoundingClientRect(),N=Se({top:w.top,height:w.height},D(),T(),P,C);H=N.tStart,$=N.tEnd;}function se(){if(!y||h)return;let w=Z(D(),H,$,1);u&&(v=Math.max(v,w),w=v),_=w,I(w),w>=1&&!S?(S=true,d?.()):w<1&&!u&&(S=false),M=requestAnimationFrame(se);}ee();let X=new IntersectionObserver(w=>{w.forEach(N=>{y=N.isIntersecting,y&&!h?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),W;function f(){clearTimeout(W),W=setTimeout(()=>{if(n==="lines"){let w=_;e.innerHTML=j,O=rn(e),nn(e,oe),I(w);}ee();},150);}window.addEventListener("resize",f),window.addEventListener("orientationchange",f);let k=De([e],f);return X.observe(e),$e(e,{type:"text",getProgress:()=>_,getTrigger:()=>({tStart:H,tEnd:$})}),{destroy(){cancelAnimationFrame(M),X.disconnect(),window.removeEventListener("resize",f),window.removeEventListener("orientationchange",f),k(),clearTimeout(W),e.innerHTML=j,ke(e);},replay(){v=-1,S=false,_=0,h=false,I(0);},pause(){h=true,cancelAnimationFrame(M);},resume(){h&&(h=false,y&&(M=requestAnimationFrame(se)));},seek(w){let N=Math.min(1,Math.max(0,w));_=N,v=N,h=true,cancelAnimationFrame(M),I(N);},getProgress(){return _}}}function Wn(e,r={}){let[t,n]=qn.useState(0),o=qn.useRef(r);o.current=r;let s=qn.useRef(-1);return qn.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){n(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let m=a,{axis:u="y",scrollContainer:d,trigger:x={}}=o.current,P=typeof d=="string"?document.querySelector(d):d??null,C=le(x.start??"top bottom"),j=le(x.end??"bottom top"),oe=0,O=0,Q=false,U=0;function I(){return P?u==="x"?P.scrollLeft:P.scrollTop:u==="x"?window.scrollX:window.scrollY}function H(){return P?u==="x"?P.clientWidth:P.clientHeight:u==="x"?window.innerWidth:window.innerHeight}function $(){let S=m.getBoundingClientRect(),D=I(),T=u==="x"?S.left:S.top,ee=u==="x"?S.width:S.height,se=Se({top:T,height:ee},D,H(),C,j);oe=se.tStart,O=se.tEnd;}function M(){if(!Q)return;let{speed:S=1,easing:D="linear",once:T=false}=o.current,ee=typeof D=="function"?D:J[D]??J.linear,se=Z(I(),oe,O,S),X=ee(se);T&&(s.current=Math.max(s.current,X),X=s.current),n(X),U=requestAnimationFrame(M);}let y=new IntersectionObserver(S=>{S.forEach(D=>{Q=D.isIntersecting,Q?U=requestAnimationFrame(M):cancelAnimationFrame(U);});},{root:P??null,threshold:0});$(),y.observe(m);let h;function v(){clearTimeout(h),h=setTimeout($,150);}window.addEventListener("resize",v),window.addEventListener("orientationchange",v);let _=Ue(S=>{S&&(_(),cancelAnimationFrame(U),y.disconnect(),n(1));});return ()=>{_(),cancelAnimationFrame(U),clearTimeout(h),y.disconnect(),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v);}},[]),t}function tt(e,r,t){let n=qn.useRef(r);n.current=r;let o=jt(r);qn.useEffect(()=>{if(!e.current)return;let s=t(e.current,Gt(n.current,()=>n.current));return ()=>s.destroy()},[o]);}var jn=/^(data-|aria-)|^(id|role|title|tabIndex|lang|dir|hidden)$/;function nt(e){let r={},t={};for(let[n,o]of Object.entries(e))(jn.test(n)?t:r)[n]=o;return [r,t]}function uo({children:e,className:r,style:t,...n}){let o=qn.useRef(null),[s,a]=nt(n);return tt(o,s,qt),jsxRuntime.jsx("div",{ref:o,className:r,style:t,...a,children:e})}function mo({children:e,className:r,style:t,...n}){let o=qn.useRef(null),[s,a]=nt(n);return tt(o,s,Jt),jsxRuntime.jsx("div",{ref:o,className:r,style:t,...a,children:e})}function fo({className:e,style:r,...t}){let n=qn.useRef(null),[o,s]=nt(t);return tt(n,o,Zt),jsxRuntime.jsx("span",{ref:n,className:e,style:r,...s})}function po({src:e,className:r,style:t,muted:n=true,playsInline:o=true,...s}){let a=qn.useRef(null),[m,u]=nt(s);return tt(a,m,tn),jsxRuntime.jsx("video",{...u,ref:a,src:e,className:r,style:t,muted:n,playsInline:o,preload:"auto"})}function go({children:e,as:r="p",className:t,style:n,...o}){let s=qn.useRef(null),[a,m]=nt(o);return tt(s,a,an),qn__default.default.createElement(r,{...m,ref:s,className:t,style:n},e)}exports.ScrollAnimate=mo;exports.ScrollCounter=fo;exports.ScrollDraw=uo;exports.ScrollText=go;exports.ScrollVideo=po;exports.useScrollDrawProgress=Wn;
|
|
2
|
+
'use strict';var Qn=require('react'),jsxRuntime=require('react/jsx-runtime');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Qn__default=/*#__PURE__*/_interopDefault(Qn);function bn({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),o=Math.sqrt(n),s=0,a=[];for(let p=0;p<t;p++){let v=Math.pow(o,p);a.push(v),s+=v;}let m=[0],f=0;for(let p=0;p<t;p++)f+=a[p]/s,m.push(f);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let v=0;v<t;v++)if(p<=m[v+1]){let E=(p-m[v])/(m[v+1]-m[v]);if(v===0)return E*(2-E);let S=1-Math.pow(n,v);return S+(1-S)*(2*E-1)*(2*E-1)}return 1}}function wn({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),o=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/n)+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:bn(),elastic:wn()};function kt(e,r,t){return Math.min(t,Math.max(r,e))}function ie(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function Ot(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function It(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 te(e,r,t,n){return t===r?0:kt((e-r)/(t-r)*n,0,1)}function be(e,r,t,n,o){let s=Ot(e.top,e.height,r,n.element)-It(n.viewport,t),a=Ot(e.top,e.height,r,o.element)-It(o.viewport,t);return {tStart:s,tEnd:a}}function at(e,r,t){let n=e.getBoundingClientRect(),o=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:o,scroll:0}:{top:t==="x"?n.left:n.top,height:o,scroll:t==="x"?window.scrollX:window.scrollY}}function Ge(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function Ft(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function lt(e,r,t){let n=Ft(e),o=Ft(r);return !n||!o?e:`rgb(${Math.round(n[0]+(o[0]-n[0])*t)},${Math.round(n[1]+(o[1]-n[1])*t)},${Math.round(n[2]+(o[2]-n[2])*t)})`}var Dt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ge(e,...r){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var vn="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",En="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Nt=33;function Sn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Tn(e){let r=[];for(let t=0;t<Nt;t++){let n=t/(Nt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function ct(e){switch(e){case "linear":return "linear";case "ease-in":return vn;case "ease-out":return En;case "ease-in-out":return Sn()?Tn(ee["ease-in-out"]):null;default:return null}}var Ht=Symbol.for("svg-scroll-draw.registry");function zt(){let e=globalThis;return e[Ht]||(e[Ht]=new Map)}function Le(e,r){zt().set(e,r);}function Ae(e){zt().delete(e);}var Je,ut=new Set,mt=new WeakMap,Ze=new Map,Vt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function xn(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Oe(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();Je??(Je=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)mt.get(a)!==Vt(a)&&(s=true),mt.set(a,"");s&&ut.forEach(a=>a());})),ut.add(t);let n=xn(e);return [document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{mt.has(o)||mt.set(o,Vt(o)),Ze.set(o,(Ze.get(o)??0)+1),Je.observe(o);}),()=>{ut.delete(t)&&(n.forEach(o=>{let s=(Ze.get(o)??1)-1;if(s)return void Ze.set(o,s);Ze.delete(o),Je?.unobserve(o);}),ut.size||(Je?.disconnect(),Je=void 0));}}function je(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function qe(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=je(s=>{if(!s)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(t))o[s]=(...a)=>t[s]?.(...a);return o.destroy=()=>{n(),t.destroy();},o}var Mn=0;function Ln(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function _t(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var qt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function An(e){if(!Ke)return;let r=_t(e,"stroke");if(!r||r==="none"){ge("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!qt.has(t)&&!qt.has(_t(e,"fill"))&&ge("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Pn(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function o(){let s=t==="x"?window.scrollX:window.scrollY,a=e-s,m=r-s,f=t==="x";n.innerHTML=`
|
|
3
|
+
<div style="position:absolute;${f?`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>
|
|
4
|
+
<div style="position:absolute;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",o,{passive:true}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove();}}}var Wt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Bt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Cn(e,r,t){if(!Ke)return;let n=(e.match(Bt)??[]).join("").toUpperCase(),o=(r.match(Bt)??[]).join("").toUpperCase(),s=(e.match(Wt)??[]).length,a=(r.match(Wt)??[]).length;if(n!==o){ge(`morphTo: command sequence differs (${n||"\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}s!==a&&ge(`morphTo: coordinate count differs (${s} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function $n(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let a=parseFloat(s),m=n[o++]??a;return String(+(a+(m-a)*t).toFixed(4))})}function Gt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:qe(r,(t,n)=>Rn(e,t,n))}function Rn(e,r,t){let{preset:n,...o}=r,s=n?{...Dt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:p="linear",trigger:v={},stagger:E=0,direction:S="forward",once:U=false,debug:ne=false,axis:x="y",scrollContainer:X,autoReverse:re=false,delay:A=0,strokeColor:k,strokeWidth:M,fillOpacity:L,waypoints:h,velocityScale:g=false,threshold:w=0,rootMargin:V="0px",repeat:T=0,repeatDelay:O=0,morphTo:C,clip:I,autoplay:B=false,duration:fe=1e3,native:ae=true,onProgress:Y,onStart:d,onComplete:u,onEnter:$,onLeave:pe,onEnterBack:de,onLeaveBack:Pe}=s,z=I===true?"left":typeof I=="string"?I:false,se=typeof p=="function"?p:ee[p]??ee.linear,F=ie(v.start||"top bottom"),D=ie(v.end||"bottom top"),G=typeof X=="string"?document.querySelector(X):X??null,Ee=Array.isArray(k)?k[0]:null,Se=Array.isArray(k)?k[1]:typeof k=="string"?k:null,Ce=Array.isArray(M)?M[0]:null,$e=Array.isArray(M)?M[1]:typeof M=="number"?M:null,Te=Array.isArray(L)?L[0]:null,He=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Re(i){let l=i*100;switch(z){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${i*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let j=z?[]:Array.from(e.querySelectorAll(a)),_=[],ye=[],he=0,c=0,y=E,Ie=0,N=false,q=false,R=0,W=false,xe=-1,Me=[],nt=-1,le=false,ke=0,Fe=0,ze,pt=null;function Et(){pt?.destroy(),pt=null;}let Ve=new Set,St=NaN,_e=true,rt=-1,Tt=performance.now(),We=NaN;function Ue(){return G?x==="x"?G.scrollLeft:G.scrollTop:x==="x"?window.scrollX:window.scrollY}function xt(){return G?x==="x"?G.clientWidth:G.clientHeight:x==="x"?window.innerWidth:window.innerHeight}function Mt(){let i=at(e,G,x);return be(i,i.scroll,xt(),F,D)}function mn(){let i=c-he,l=j.length-1,b=G??document.documentElement,K=x==="x"?"Width":"Height";if(y=E,E>0&&l>0&&i>0){let we=b[`scroll${K}`]-b[`client${K}`]-1-he-i/m;we>=0&&(y=Math.min(E,we/(l*i)));}Ie=c+l*y*i;}function Lt(){(({tStart:he,tEnd:c}=Mt())),mn(),ne&&Ke&&(Et(),pt=Pn(he,c,x));}function dt(i,l=Mt){Le(e,{type:"draw",getProgress:()=>i.getProgress(),getTrigger:l});let b=i.destroy;return i.destroy=()=>{b.call(i),Ae(e);},i}function At(i,l){return U&&!re?Math.max(xe,se(Me[i]=Math.max(Me[i]??0,l))):se(l)}function fn(i,l){if(e.style.setProperty("--scroll-draw-progress",String(i)),z){let b=l==="reverse"?1-i:i;e.style.clipPath=Re(b);return}j.forEach((b,K)=>gt(b,K,i,l));}function gt(i,l,b,K){i.style.strokeDashoffset=K==="reverse"?`${_[l]*b}`:`${_[l]*(1-b)}`,f&&(i.style.opacity=K==="reverse"?`${1-b}`:`${b}`),Ee&&Se?i.style.stroke=lt(Ee,Se,b):Se&&(i.style.stroke=Se),Ce!==null&&$e!==null?i.style.strokeWidth=`${Ce+($e-Ce)*b}`:$e!==null&&(i.style.strokeWidth=`${$e}`),Te!==null&&He!==null?i.style.fillOpacity=`${Te+(He-Te)*b}`:He!==null&&(i.style.fillOpacity=`${He}`),C&&i.tagName.toLowerCase()==="path"&&ye[l]&&i.setAttribute("d",$n(ye[l],C,b));}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),z){e.style.clipPath=Re(S==="reverse"?1:0);return}j.forEach((i,l)=>{i.style.strokeDasharray=`${_[l]}`,i.style.strokeDashoffset=S==="reverse"?"0":`${_[l]}`,f?i.style.opacity=S==="reverse"?"1":"0":i.style.opacity="",Ee&&(i.style.stroke=Ee),Ce!==null&&(i.style.strokeWidth=`${Ce}`),Te!==null&&(i.style.fillOpacity=`${Te}`),C&&i.tagName.toLowerCase()==="path"&&ye[l]&&i.setAttribute("d",ye[l]);});}if(j.forEach(i=>{An(i);let l=Ge(i);_.push(l);let b=i.tagName.toLowerCase()==="path";b?ye.push(i.getAttribute("d")??""):ye.push(""),C&&(b?Cn(ye[ye.length-1],C,i):ge(`morphTo only applies to <path> elements \u2014 ignored on <${i.tagName}>.`,i)),t?(i.style.strokeDasharray=`${l}`,i.style.strokeDashoffset=S==="reverse"?`${l}`:"0",f&&(i.style.opacity="1"),Se&&(i.style.stroke=Se),$e!==null&&(i.style.strokeWidth=`${$e}`),He!==null&&(i.style.fillOpacity=`${He}`),C&&i.tagName.toLowerCase()==="path"&&i.setAttribute("d",C)):(i.style.strokeDasharray=`${l}`,i.style.strokeDashoffset=S==="reverse"?"0":`${l}`,f?i.style.opacity=S==="reverse"?"1":"0":i.style.opacity="",Ee&&(i.style.stroke=Ee),Ce!==null&&(i.style.strokeWidth=`${Ce}`),Te!==null&&(i.style.fillOpacity=`${Te}`));}),t)return z&&(e.style.clipPath=Re(1)),u?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};z&&(e.style.clipPath=Re(S==="reverse"?1:0));let Pt=typeof p=="string"?ct(p):null;function pn(){return !(ae===false||B||ne||!Ln()||!j.length||!Pt||z||x!=="y"||G||m!==1||E!==0||U||re||g!==false||C||h||T||A>0||Y||d||u||$||pe||de||Pe||k!=null||M!=null||L!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function dn(){let i=++Mn,l=`svg-scroll-draw-${i}`,b=`svg-scroll-draw-host-${i}`,K=`--svg-scroll-draw-${i}`,we=S==="reverse"?"0":"var(--ssd-len)",De=S==="reverse"?"var(--ssd-len)":"0",ve=`stroke-dashoffset:${we};`,Q=`stroke-dashoffset:${De};`;f&&(ve+=`opacity:${S==="reverse"?1:0};`,Q+=`opacity:${S==="reverse"?0:1};`);let J=document.createElement("style");J.setAttribute("data-svg-scroll-draw",""),J.textContent=`@keyframes ${l}{from{${ve}}to{${Q}}}.${b}{view-timeline-name:${K};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Pt};animation-fill-mode:both;animation-timeline:${K};animation-range:cover 0% cover 100%;}`,document.head.appendChild(J),e.classList.add(b);function ce(P,H){P.style.setProperty("--ssd-len",String(_[H])),P.style.strokeDasharray=`${_[H]}`,P.style.strokeDashoffset="",P.style.opacity="",P.style.animationPlayState="",P.classList.add(l);}j.forEach(ce);let ue=false,Z=-1;function oe(){if(Z>=0)return Z;let P=e.getBoundingClientRect(),{tStart:H,tEnd:me}=be({top:P.top,height:P.height},Ue(),xt(),F,D);return se(te(Ue(),H,me,m))}return {destroy(){e.classList.remove(b),j.forEach(P=>{P.classList.remove(l),P.style.removeProperty("--ssd-len"),P.style.animationPlayState="";}),J.remove();},replay(){ue=false,Z=-1,j.forEach(ce);},pause(){ue=true,j.forEach(P=>{P.style.animationPlayState="paused";});},resume(){ue&&(ue=false,j.forEach(P=>{P.style.animationPlayState="running";}));},seek(P){let H=Math.min(1,Math.max(0,P));Z=H,ue=true,j.forEach((me,Ne)=>{me.classList.remove(l),me.style.strokeDashoffset=S==="reverse"?`${_[Ne]*H}`:`${_[Ne]*(1-H)}`,f&&(me.style.opacity=S==="reverse"?`${1-H}`:`${H}`);});},getProgress(){return oe()},refresh(){j.forEach((P,H)=>{_[H]=Ge(P),P.style.setProperty("--ssd-len",String(_[H])),P.style.strokeDasharray=`${_[H]}`;});}}}if(pn())return dt(dn());function gn(){let i=Math.max(1,fe),l=z?i:i*(1+Math.max(0,j.length-1)*E),b=0,K=0,we=false;function De(Z){let oe=true,P=Math.min(1,Math.max(0,Z/l));if(z){let H=Math.min(1,Math.max(0,Z/i)),me=se(H);ke=me,e.style.setProperty("--scroll-draw-progress",String(me)),e.style.clipPath=Re(S==="reverse"?1-me:me),Y?.(me),H<1&&(oe=false);}else {j.forEach((me,Ne)=>{let hn=Ne*E*i,Rt=Math.min(1,Math.max(0,(Z-hn)/i));gt(me,Ne,se(Rt),S),Rt<1&&(oe=false);});let H=se(P);ke=H,Y?.(H),e.style.setProperty("--scroll-draw-progress",String(H));}if(h){let H=se(P);for(let me in h){let Ne=parseFloat(me);H>=Ne&&!Ve.has(Ne)&&(Ve.add(Ne),h[me]?.());}}return oe}function ve(Z){if(le)return;let oe=Z-b;q||(q=true,d?.());let P=De(oe);if(P&&!N){N=true,De(l),u?.(),Fe<(T==="infinite"?1/0:T??0)&&(Fe++,ze=setTimeout(()=>{b=performance.now(),q=false,N=false,Ve.clear(),Xe(),R=requestAnimationFrame(ve);},O));return}P||(R=requestAnimationFrame(ve));}function Q(){cancelAnimationFrame(R),clearTimeout(ze),b=performance.now(),K=0,le=false,q=false,N=false,Fe=0,we=true,ke=0,Ve.clear(),Xe(),R=requestAnimationFrame(ve);}let J=new IntersectionObserver(Z=>{Z.forEach(oe=>{oe.isIntersecting&&!(U&&N)?Q():!oe.isIntersecting&&!U&&!N&&(cancelAnimationFrame(R),clearTimeout(ze),we=false);});},{root:G??null,threshold:w,rootMargin:V}),ce;function ue(){clearTimeout(ce),ce=setTimeout(()=>{j.forEach((Z,oe)=>{_[oe]=Ge(Z),Z.style.strokeDasharray=`${_[oe]}`;});},150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),A>0?setTimeout(()=>J.observe(e),A):J.observe(e),{destroy(){cancelAnimationFrame(R),clearTimeout(ze),J.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(ce);},replay(){Fe=0,Q();},pause(){le||!we||(le=true,K=performance.now()-b,cancelAnimationFrame(R));},resume(){le&&(le=false,we=true,b=performance.now()-K,R=requestAnimationFrame(ve));},seek(Z){let oe=Math.min(1,Math.max(0,Z));ke=oe,le=true,K=oe*l,b=performance.now()-K,cancelAnimationFrame(R),De(K);},getProgress(){return ke},refresh(){clearTimeout(ce),j.forEach((Z,oe)=>{_[oe]=Ge(Z),Z.style.strokeDasharray=`${_[oe]}`;});}}}if(B)return dt(gn());Lt();function Ct(){if(le||!Be)return;let i=performance.now(),l=Ue();if(!_e&&g===false&&l===St){ht(l);return}_e=false,St=l;let b=m;if(g!==false){let Q=i-Tt,J=Q>0?Math.abs(l-(rt<0?l:rt))/Q:0;b=m*Math.max(.2,1+J*(typeof g=="number"?g:1)*.04);}rt=l,Tt=i;let K=re?nt===-1||l>=nt?"forward":"reverse":S;nt=l;let we=c-he,De=true,ve=we===0?0:(l-he)/we;if(isNaN(We)||(We<=0&&ve>0?$?.():We>0&&ve<=0&&Pe?.(),We<1&&ve>=1?pe?.():We>=1&&ve<1&&de?.()),We=ve,z){let Q=At(0,te(l,he,c,b));ke=Q,e.style.setProperty("--scroll-draw-progress",String(Q));let J=K==="reverse"?1-Q:Q;e.style.clipPath=Re(J),Y?.(Q),!q&&te(l,he,c,b)>0&&(q=true,d?.()),Q>=1&&!N?(N=true,u?.(),Fe<(T==="infinite"?1/0:T??0)&&(Fe++,ze=setTimeout(()=>{xe=-1,Me=[],q=false,N=false,Xe();},O))):Q<1&&!U&&(N=false),ht(l);return}if(j.forEach((Q,J)=>{let ce=J*y*we,ue=At(J,te(l,he+ce,c+ce,b));gt(Q,J,ue,K),J===0&&(ke=ue,Y?.(ue),e.style.setProperty("--scroll-draw-progress",String(ue))),ue<1&&(De=false);}),h){let Q=se(te(l,he,c,b));for(let J in h){let ce=parseFloat(J);Q>=ce&&!Ve.has(ce)&&(Ve.add(ce),h[J]?.());}}!q&&te(l,he,c,b)>0&&(q=true,d?.()),De&&!N?(N=true,u?.(),Fe<(T==="infinite"?1/0:T??0)&&(Fe++,ze=setTimeout(()=>{xe=-1,Me=[],q=false,N=false,Ve.clear(),Xe(),_e=true;},O))):!De&&!U&&(N=false),ht(l);}function yt(i){return i>=c&&i<Ie}function ht(i){W||yt(i)?R=requestAnimationFrame(Ct):Be=false;}function bt(){return W||yt(Ue())}let Be=false;function ot(){Be||(Be=true,R=requestAnimationFrame(function(){Ct();}));}function st(){Be=false,cancelAnimationFrame(R);}let wt=new IntersectionObserver(i=>{i.forEach(l=>{W=l.isIntersecting,W&&!le?(_e=true,ot()):Be&&!le&&yt(Ue())||st();});},{root:G??null,threshold:w,rootMargin:V});function $t(){j.forEach((i,l)=>{_[l]=Ge(i),i.style.strokeDasharray=`${_[l]}`;}),Lt(),_e=true;}let it;function Ye(){clearTimeout(it),it=setTimeout($t,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let yn=Oe([e],Ye);return A>0?setTimeout(()=>wt.observe(e),A):wt.observe(e),dt({destroy(){cancelAnimationFrame(R),clearTimeout(ze),st(),wt.disconnect(),yn(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(it),Et();},replay(){xe=-1,Me=[],nt=-1,rt=-1,q=false,N=false,Fe=0,le=false,ke=0,Ve.clear(),clearTimeout(ze),Xe(),_e=true,bt()&&ot();},pause(){le=true,st();},resume(){le&&(le=false,_e=true,bt()&&ot());},seek(i){let l=Math.min(1,Math.max(0,i));ke=l,xe=l,Me=[],le=true,st(),fn(l,S),_e=true;},getProgress(){return ke},refresh(){clearTimeout(it),$t(),bt()&&!le&&ot();}},()=>({tStart:he,tEnd:c}))}var jt=new WeakMap,kn=0;function Qt(e){return JSON.stringify(e,(r,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let n=jt.get(t);return n===void 0&&jt.set(t,n=++kn),`el#${n}`}return t})}function Ut(e,r){let t={...e};for(let n of Object.keys(t))typeof t[n]=="function"&&(t[n]=(...o)=>r()[n]?.(...o));return t}function On(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let o=[],s=[],a=n[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(f?parseFloat(f[1]):0),s.push(f?f[2]:"");}r.push({fn:n[1],nums:o,units:s});}return r}function In(e,r,t){let n=Xt(e),o=Xt(r);return n.length===0||n.length!==o.length?t<1?e:r:n.map((s,a)=>{let m=o[a];return s.fn!==m.fn||s.nums.length!==m.nums.length?t<1?`${s.fn}(${s.nums.map((f,p)=>`${f}${s.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,p)=>`${f}${m.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((f,p)=>`${f+(m.nums[p]-f)*t}${s.units[p]}`).join(", ")})`}).join(" ")}function Yt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),o=String(r);if(On(n))return lt(n,o,t);if(n.includes("("))return In(n,o,t);let s=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let m=parseFloat(s[1]),f=parseFloat(a[1]);return `${m+(f-m)*t}${s[2]||a[2]}`}return t<1?n:o}function Fn(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Dn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Nn=0,Kt="--scroll-draw-progress";function Hn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function en(e,r){return typeof window>"u"?Zt:r.respectReducedMotion===false?Jt(e,r,false):qe(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:o={},easing:s="ease-out",speed:a=1,once:m=false,axis:f="y",scrollContainer:p,native:v=true,velocityScale:E=false,triggerElement:S,onProgress:U,onComplete:ne,onEnter:x,onLeave:X,onEnterBack:re,onLeaveBack:A}=r,k=typeof s=="function"?s:ee[s]??ee["ease-out"],M=ie(o.start||"top bottom"),L=ie(o.end||"bottom top"),h=S??e,g=typeof p=="string"?document.querySelector(p):p??null,w=Object.entries(n).map(([c,y])=>({prop:Fn(c),from:Array.isArray(y)?y[0]:"",to:Array.isArray(y)?y[1]:y}));function V(){let c=window.getComputedStyle(e);for(let y of w)y.from===""&&(y.from=c.getPropertyValue(y.prop).trim()||"0");}function T(){for(let c of w)e.style.setProperty(c.prop,String(c.to));}let O=new Map;for(let c of [...w.map(y=>y.prop),Kt])O.set(c,e.style.getPropertyValue(c));function C(){for(let[c,y]of O)y?e.style.setProperty(c,y):e.style.removeProperty(c);}if(t)return T(),ne?.(),{...Zt,destroy:C,getProgress:()=>1};V();let I=()=>g?f==="x"?g.scrollLeft:g.scrollTop:f==="x"?window.scrollX:window.scrollY,B=()=>g?f==="x"?g.clientWidth:g.clientHeight:f==="x"?window.innerWidth:window.innerHeight,fe=typeof s=="string"?ct(s):null;function ae(){if(!v||!Hn()||!fe||f!=="y"||g||h!==e||m||a!==1||U||ne||x||X||re||A||E!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let c of w)if(!Dn.has(c.prop))return false;return true}function Y(){let c=`ssd-a-${++Nn}`,y=w.map(W=>`${W.prop}:${W.from}`).join(";"),Ie=w.map(W=>`${W.prop}:${W.to}`).join(";"),N=document.createElement("style");N.setAttribute("data-ssd-animate",""),N.textContent=`@keyframes ${c}{from{${y}}to{${Ie}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(c);let q=()=>{let W=e.getBoundingClientRect();return be({top:W.top,height:W.height},I(),B(),M,L)};Le(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:q});let R={refresh(){},destroy(){e.classList.remove(c),N.remove(),e.style.animationPlayState="",C(),Ae(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(W){let xe=Math.min(1,Math.max(0,W));e.classList.remove(c);for(let Me of w)e.style.setProperty(Me.prop,Yt(Me.from,Me.to,xe));},getProgress(){let{tStart:W,tEnd:xe}=q();return k(te(I(),W,xe,a))}};return R}if(ae())return Y();let d=0,u=0,$=0,pe=false,de=false,Pe=-1,z=0,se=0,F=false,D=NaN,G=-1,Ee=0,Se=h===e?w:[],Ce=false;function $e(){let c=e.style,y=Se.map(R=>c.getPropertyValue(R.prop)),Ie=c.transition;Se.length&&(c.transition="none"),Se.forEach(R=>c.setProperty(R.prop,O.get(R.prop)??""));let N=at(h,g,f);Se.forEach((R,W)=>c.setProperty(R.prop,y[W])),Se.length&&(e.offsetWidth,c.transition=Ie);let q=be(N,N.scroll,B(),M,L);Ce&&Math.abs(q.tStart-d)<1&&Math.abs(q.tEnd-u)<1||(Ce=true,d=q.tStart,u=q.tEnd);}function Te(c){e.style.setProperty(Kt,String(c));for(let y of w)e.style.setProperty(y.prop,Yt(y.from,y.to,c));U?.(c);}function He(c){if(isNaN(D)){D=c;return}D<=0&&c>0?x?.():D>0&&c<=0&&A?.(),D<1&&c>=1?X?.():D>=1&&c<1&&re?.(),D=c;}function Re(){if(!pe||de)return;let c=performance.now(),y=I(),Ie=a;if(E!==false){let W=c-Ee,xe=W>0?Math.abs(y-(G<0?y:G))/W:0;Ie=a*Math.max(.2,1+xe*(typeof E=="number"?E:1)*.04);}G=y,Ee=c;let N=u===d?0:(y-d)/(u-d);He(N);let q=te(y,d,u,Ie),R=m?Math.max(Pe,k(z=Math.max(z,q))):k(q);se=R,Te(R),R>=1&&!F?(F=true,ne?.()):R<1&&!m&&(F=false),$=requestAnimationFrame(Re);}$e(),u===d&&ge("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),z=te(I(),d,u,a),se=k(z),Te(se);let j=new IntersectionObserver(c=>{c.forEach(y=>{pe=y.isIntersecting,pe&&!de?$=requestAnimationFrame(Re):cancelAnimationFrame($);});},{root:g??null}),_;function ye(){clearTimeout(_),_=setTimeout($e,150);}window.addEventListener("resize",ye),window.addEventListener("orientationchange",ye);let he=Oe([h],ye);return j.observe(e),Le(e,{type:"animate",getProgress:()=>se,getTrigger:()=>({tStart:d,tEnd:u})}),{destroy(){cancelAnimationFrame($),j.disconnect(),window.removeEventListener("resize",ye),window.removeEventListener("orientationchange",ye),he(),clearTimeout(_),C(),Ae(e);},replay(){Pe=-1,z=0,F=false,se=0,de=false,Te(0);},pause(){de=true,cancelAnimationFrame($);},resume(){de&&(de=false,pe&&($=requestAnimationFrame(Re)));},seek(c){let y=Math.min(1,Math.max(0,c));se=y,Pe=y,z=0,de=true,cancelAnimationFrame($),Te(y);},getProgress(){return se},refresh(){$e();}}}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function tn(e,r){if(typeof window>"u")return vt;let t=typeof e=="string"?document.querySelector(e):e;return t?qe(r,(n,o)=>zn(t,n,o)):(ge("scrollCounter: element not found:",e),vt)}function zn(e,r,t){let{from:n=0,to:o,format:s,easing:a="ease-out",trigger:m={},once:f=true,decimals:p,onComplete:v}=r,E=p!==void 0?d=>d.toFixed(p):s??(d=>String(Math.round(d))),S=typeof a=="function"?a:ee[a]??ee["ease-out"],U=ie(m.start||"top 80%"),ne=ie(m.end||"top 20%");if(t)return e.textContent=E(o),v?.(),{...vt,getProgress:()=>1};let x=0,X=0,re=false,A=0,k=false,M=false,L=-1,h=0,g=0,w=false,V=()=>window.scrollY,T=()=>window.innerHeight;function O(){let d=e.getBoundingClientRect(),u=be({top:d.top,height:d.height},V(),T(),U,ne);re&&Math.abs(u.tStart-x)<1&&Math.abs(u.tEnd-X)<1||(re=true,x=u.tStart,X=u.tEnd);}function C(d){e.textContent=E(n+(o-n)*d),e.style.setProperty("--scroll-draw-progress",String(d));}function I(){if(!k||M)return;let d=te(V(),x,X,1),u=f?Math.max(L,S(h=Math.max(h,d))):S(d);g=u,C(u),u>=1&&!w?(w=true,v?.()):u<1&&!f&&(w=false),A=requestAnimationFrame(I);}O();{h=te(V(),x,X,1);let d=S(h);g=d,C(d);}let B=new IntersectionObserver(d=>{d.forEach(u=>{k=u.isIntersecting,k&&!M?A=requestAnimationFrame(I):cancelAnimationFrame(A);});}),fe;function ae(){clearTimeout(fe),fe=setTimeout(O,150);}window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae);let Y=Oe([e],ae);return B.observe(e),Le(e,{type:"counter",getProgress:()=>g,getTrigger:()=>({tStart:x,tEnd:X})}),{destroy(){cancelAnimationFrame(A),B.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),Y(),clearTimeout(fe),Ae(e);},replay(){L=-1,h=0,w=false,g=0,M=false,C(0);},pause(){M=true,cancelAnimationFrame(A);},resume(){M&&(M=false,k&&(A=requestAnimationFrame(I)));},seek(d){let u=Math.min(1,Math.max(0,d));g=u,L=u,h=0,M=true,cancelAnimationFrame(A),C(u);},getProgress(){return g}}}var nn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rn(e,r={}){if(typeof window>"u")return nn;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return ge("scrollVideo: <video> element not found:",e),nn;let n=t,{trigger:o={},easing:s="linear",once:a=false,axis:m="y",preload:f="auto",triggerElement:p,onReady:v,onComplete:E,onProgress:S}=r,U=p??n,ne=window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof s=="function"?s:ee[s]??ee.linear,X=ie(o.start||"top top"),re=ie(o.end||"bottom top");n.pause(),n.hasAttribute("preload")||(n.preload=f);let A=r.from??0,k=r.to,M=0,L=0,h=0,g=false,w=false,V=-1,T=0,O=0,C=false,I=false,B=()=>m==="x"?window.scrollX:window.scrollY,fe=()=>m==="x"?window.innerWidth:window.innerHeight;function ae(){let F=U.getBoundingClientRect(),D=m==="x"?F.left:F.top,G=m==="x"?F.width:F.height,Ee=be({top:D,height:G},B(),fe(),X,re);M=Ee.tStart,L=Ee.tEnd,I&&L===M&&ge("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",n);}let Y=NaN;function d(F){if(!I)return;let D=k??n.duration??0,G=A+(D-A)*F;G!==Y&&(Y=G,n.currentTime=G),n.style.setProperty("--scroll-draw-progress",String(F)),S?.(F);}function u(){if(!g||w||!I||ne)return;let F=te(B(),M,L,1),D=a?Math.max(V,x(T=Math.max(T,F))):x(F);O=D,d(D),D>=1&&!C?(C=true,E?.()):D<1&&!a&&(C=false),h=requestAnimationFrame(u);}function $(){if(I=true,k===void 0&&(k=n.duration),ne){d(1),v?.();return}ae(),v?.(),g&&!w&&(h=requestAnimationFrame(u));}n.readyState>=1?$():n.addEventListener("loadedmetadata",$,{once:true}),I||ae();let pe=ne?()=>{}:je(F=>{F&&(pe(),ne=true,cancelAnimationFrame(h),d(1));}),de=new IntersectionObserver(F=>{F.forEach(D=>{g=D.isIntersecting,g&&!w&&I?h=requestAnimationFrame(u):cancelAnimationFrame(h);});}),Pe;function z(){clearTimeout(Pe),Pe=setTimeout(ae,150);}window.addEventListener("resize",z),window.addEventListener("orientationchange",z);let se=Oe([U],z);return de.observe(n),Le(n,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:M,tEnd:L})}),{destroy(){cancelAnimationFrame(h),de.disconnect(),n.removeEventListener("loadedmetadata",$),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),se(),pe(),clearTimeout(Pe),Ae(n);},replay(){V=-1,T=0,C=false,O=0,w=false,Y=NaN,d(0);},pause(){w=true,cancelAnimationFrame(h);},resume(){w&&(w=false,g&&I&&(h=requestAnimationFrame(u)));},seek(F){let D=Math.min(1,Math.max(0,F));O=D,V=D,T=0,w=true,cancelAnimationFrame(h),Y=NaN,d(D);},getProgress(){return O}}}function on(e,r){let t=document.createElement("span");t.textContent=r,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 r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(n.textContent=t,n.style.whiteSpace="pre"):(n.textContent=t,n.style.display="inline-block"),e.appendChild(n),/^\s+$/.test(t)?null:n}).filter(t=>t!==null)}function Vn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=t,t===" "?n.style.whiteSpace="pre":n.style.display="inline-block",e.appendChild(n),t===" "?null:n}).filter(t=>t!==null)}function sn(e){let r=ln(e),t=new Map;for(let s of r){let a=s.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(s);}let n=[],o=Array.from(t.keys()).sort((s,a)=>s-a);for(let s of o){let a=t.get(s),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",a.forEach((f,p)=>{let v=f.nextElementSibling;m.appendChild(f),p<a.length-1&&v&&v.style.whiteSpace==="pre"&&m.appendChild(v);}),n.push(m);}return e.textContent="",n.forEach((s,a)=>{e.appendChild(s),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function _n(e,r,t,n){if(t<=1||n===0)return e;let o=(t-1)*n,s=r*n,a=s+(1-o);return a<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(a-s)))}function qn(e,r){let t=[];if(r?.y!==void 0&&t.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&t.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&t.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let n=r.scale+(1-r.scale)*e;t.push(`scale(${n})`);}return t.join(" ")||""}var an={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function cn(e,r={}){if(typeof window>"u")return an;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return ge("scrollText: element not found:",e),an;let n=t;return qe(r,(o,s)=>Wn(n,o,s))}function Wn(e,r,t){let{split:n="words",stagger:o=.04,easing:s="ease-out",from:a={opacity:0,y:24},trigger:m={},once:f=true,onComplete:p}=r,v=typeof s=="function"?s:ee[s]??ee["ease-out"],E=ie(m.start||"top 85%"),S=ie(m.end||"top 40%"),U=e.innerHTML,ne=e.textContent??"",x;n==="chars"?x=Vn(e):n==="lines"?x=sn(e):x=ln(e),on(e,ne);let X=x.length;function re(u,$){a?.opacity!==void 0&&(u.style.opacity=String(a.opacity+(1-a.opacity)*$));let pe=qn($,a);pe&&(u.style.transform=pe);}function A(u){e.style.setProperty("--scroll-draw-progress",String(u)),x.forEach(($,pe)=>{let de=v(_n(u,pe,X,o));re($,de);});}if(t)return A(1),p?.(),{destroy(){e.innerHTML=U;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let k=0,M=0,L=0,h=false,g=false,w=-1,V=0,T=false,O=()=>window.scrollY,C=()=>window.innerHeight;function I(){let u=e.getBoundingClientRect(),$=be({top:u.top,height:u.height},O(),C(),E,S);k=$.tStart,M=$.tEnd;}function B(){if(!h||g)return;let u=te(O(),k,M,1);f&&(w=Math.max(w,u),u=w),V=u,A(u),u>=1&&!T?(T=true,p?.()):u<1&&!f&&(T=false),L=requestAnimationFrame(B);}I();let fe=new IntersectionObserver(u=>{u.forEach($=>{h=$.isIntersecting,h&&!g?L=requestAnimationFrame(B):cancelAnimationFrame(L);});}),ae;function Y(){clearTimeout(ae),ae=setTimeout(()=>{if(n==="lines"){let u=V;e.innerHTML=U,x=sn(e),on(e,ne),A(u);}I();},150);}window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y);let d=Oe([e],Y);return fe.observe(e),Le(e,{type:"text",getProgress:()=>V,getTrigger:()=>({tStart:k,tEnd:M})}),{destroy(){cancelAnimationFrame(L),fe.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),d(),clearTimeout(ae),e.innerHTML=U,Ae(e);},replay(){w=-1,T=false,V=0,g=false,A(0);},pause(){g=true,cancelAnimationFrame(L);},resume(){g&&(g=false,h&&(L=requestAnimationFrame(B)));},seek(u){let $=Math.min(1,Math.max(0,u));V=$,w=$,g=true,cancelAnimationFrame(L),A($);},getProgress(){return V}}}function jn(e,r={}){let[t,n]=Qn.useState(0),o=Qn.useRef(r);o.current=r;let s=Qn.useRef(0);return Qn.useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){n(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let m=a,{axis:f="y",scrollContainer:p,trigger:v={}}=o.current,E=typeof p=="string"?document.querySelector(p):p??null,S=ie(v.start||"top bottom"),U=ie(v.end||"bottom top"),ne=0,x=0,X=false,re=0;function A(){return E?f==="x"?E.scrollLeft:E.scrollTop:f==="x"?window.scrollX:window.scrollY}function k(){return E?f==="x"?E.clientWidth:E.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function M(){let T=m.getBoundingClientRect(),O=A(),C=f==="x"?T.left:T.top,I=f==="x"?T.width:T.height,B=be({top:C,height:I},O,k(),S,U);ne=B.tStart,x=B.tEnd;}function L(){if(!X)return;let{speed:T=1,easing:O="linear",once:C=false}=o.current,I=typeof O=="function"?O:ee[O]??ee.linear,B=te(A(),ne,x,T),fe=I(C?s.current=Math.max(s.current,B):B);n(fe),re=requestAnimationFrame(L);}let h=new IntersectionObserver(T=>{T.forEach(O=>{X=O.isIntersecting,X?re=requestAnimationFrame(L):cancelAnimationFrame(re);});},{root:E??null,threshold:0});M(),h.observe(m);let g;function w(){clearTimeout(g),g=setTimeout(M,150);}window.addEventListener("resize",w),window.addEventListener("orientationchange",w);let V=je(T=>{T&&(V(),cancelAnimationFrame(re),h.disconnect(),n(1));});return ()=>{V(),cancelAnimationFrame(re),clearTimeout(g),h.disconnect(),window.removeEventListener("resize",w),window.removeEventListener("orientationchange",w);}},[]),t}function et(e,r,t){let n=Qn.useRef(r);n.current=r;let o=Qt(r);Qn.useEffect(()=>{if(!e.current)return;let s=t(e.current,Ut(n.current,()=>n.current));return ()=>s.destroy()},[o]);}var Xn=/^(data-|aria-)|^(id|role|title|tabIndex|lang|dir|hidden)$/;function tt(e){let r={},t={};for(let[n,o]of Object.entries(e))(Xn.test(n)?t:r)[n]=o;return [r,t]}function go({children:e,className:r,style:t,...n}){let o=Qn.useRef(null),[s,a]=tt(n);return et(o,s,Gt),jsxRuntime.jsx("div",{ref:o,className:r,style:t,...a,children:e})}function yo({children:e,className:r,style:t,...n}){let o=Qn.useRef(null),[s,a]=tt(n);return et(o,s,en),jsxRuntime.jsx("div",{ref:o,className:r,style:t,...a,children:e})}function ho({className:e,style:r,...t}){let n=Qn.useRef(null),[o,s]=tt(t);return et(n,o,tn),jsxRuntime.jsx("span",{ref:n,className:e,style:r,...s})}function bo({src:e,className:r,style:t,muted:n=true,playsInline:o=true,...s}){let a=Qn.useRef(null),[m,f]=tt(s);return et(a,m,rn),jsxRuntime.jsx("video",{...f,ref:a,src:e,className:r,style:t,muted:n,playsInline:o,preload:"auto"})}function wo({children:e,as:r="p",className:t,style:n,...o}){let s=Qn.useRef(null),[a,m]=tt(o);return et(s,a,cn),Qn__default.default.createElement(r,{...m,ref:s,className:t,style:n},e)}exports.ScrollAnimate=yo;exports.ScrollCounter=ho;exports.ScrollDraw=go;exports.ScrollText=wo;exports.ScrollVideo=bo;exports.useScrollDrawProgress=jn;
|
package/dist/react/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {a as a$2,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$5}from'../chunk-
|
|
2
|
+
import {a as a$2,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$5}from'../chunk-GMBIGV3M.mjs';import {a as a$6}from'../chunk-4H2SGMAQ.mjs';import {a as a$4}from'../chunk-LGJQWZHH.mjs';import {a as a$3}from'../chunk-V4L3ELVC.mjs';import {b as b$2}from'../chunk-23EALNDF.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-2PYLM3E7.mjs';import {a,c,b}from'../chunk-A4JCC3QQ.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import {a as a$1}from'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';import Z,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function Q(n,t={}){let[o,e]=useState(0),r=useRef(t);r.current=t;let s=useRef(0);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){e(1);return}let i=typeof n=="string"?document.querySelector(n):n.current;if(!i)return;let p=i,{axis:c$1="y",scrollContainer:E,trigger:P={}}=r.current,a$2=typeof E=="string"?document.querySelector(E):E??null,$=a(P.start||"top bottom"),B=a(P.end||"bottom top"),A=0,C=0,O=false,d$1=0;function D(){return a$2?c$1==="x"?a$2.scrollLeft:a$2.scrollTop:c$1==="x"?window.scrollX:window.scrollY}function G(){return a$2?c$1==="x"?a$2.clientWidth:a$2.clientHeight:c$1==="x"?window.innerWidth:window.innerHeight}function N(){let l=p.getBoundingClientRect(),m=D(),R=c$1==="x"?l.left:l.top,T=c$1==="x"?l.width:l.height,f=c({top:R,height:T},m,G(),$,B);A=f.tStart,C=f.tEnd;}function L(){if(!O)return;let{speed:l=1,easing:m="linear",once:R=false}=r.current,T=typeof m=="function"?m:d[m]??d.linear,f=b(D(),A,C,l),J=T(R?s.current=Math.max(s.current,f):f);e(J),d$1=requestAnimationFrame(L);}let b$1=new IntersectionObserver(l=>{l.forEach(m=>{O=m.isIntersecting,O?d$1=requestAnimationFrame(L):cancelAnimationFrame(d$1);});},{root:a$2??null,threshold:0});N(),b$1.observe(p);let x;function y(){clearTimeout(x),x=setTimeout(N,150);}window.addEventListener("resize",y),window.addEventListener("orientationchange",y);let M=a$1(l=>{l&&(M(),cancelAnimationFrame(d$1),b$1.disconnect(),e(1));});return ()=>{M(),cancelAnimationFrame(d$1),clearTimeout(x),b$1.disconnect(),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y);}},[]),o}function g(n,t,o){let e=useRef(t);e.current=t;let r=a$2(t);useEffect(()=>{if(!n.current)return;let s=o(n.current,b$1(e.current,()=>e.current));return ()=>s.destroy()},[r]);}var ee=/^(data-|aria-)|^(id|role|title|tabIndex|lang|dir|hidden)$/;function S(n){let t={},o={};for(let[e,r]of Object.entries(n))(ee.test(e)?o:t)[e]=r;return [t,o]}function de({children:n,className:t,style:o,...e}){let r=useRef(null),[s,i]=S(e);return g(r,s,b$2),jsx("div",{ref:r,className:t,style:o,...i,children:n})}function fe({children:n,className:t,style:o,...e}){let r=useRef(null),[s,i]=S(e);return g(r,s,a$3),jsx("div",{ref:r,className:t,style:o,...i,children:n})}function ge({className:n,style:t,...o}){let e=useRef(null),[r,s]=S(o);return g(e,r,a$4),jsx("span",{ref:e,className:n,style:t,...s})}function Se({src:n,className:t,style:o,muted:e=true,playsInline:r=true,...s}){let i=useRef(null),[p,c]=S(s);return g(i,p,a$5),jsx("video",{...c,ref:i,src:n,className:t,style:o,muted:e,playsInline:r,preload:"auto"})}function ye({children:n,as:t="p",className:o,style:e,...r}){let s=useRef(null),[i,p]=S(r);return g(s,i,a$6),Z.createElement(t,{...p,ref:s,className:o,style:e},n)}export{fe as ScrollAnimate,ge as ScrollCounter,de as ScrollDraw,ye as ScrollText,Se as ScrollVideo,Q as useScrollDrawProgress};
|
package/dist/reveal/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function je({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(r),i=0,u=[];for(let l=0;l<n;l++){let f=Math.pow(o,l);u.push(f),i+=f;}let m=[0],c=0;for(let l=0;l<n;l++)c+=u[l]/i,m.push(c);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let f=0;f<n;f++)if(l<=m[f+1]){let g=(l-m[f])/(m[f+1]-m[f]);if(f===0)return g*(2-g);let T=1-Math.pow(r,f);return T+(1-T)*(2*g-1)*(2*g-1)}return 1}}function Ye({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),o=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return i=>i<=0?0:i>=1?1:n*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/r)+1}var D={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:je(),elastic:Ye()};function be(e,t,n){return Math.min(n,Math.max(t,e))}function ae(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function ye(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function ve(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function q(e,t,n,r){return n===t?0:be((e-t)/(n-t)*r,0,1)}function ue(e,t,n,r,o){let i=ye(e.top,e.height,t,r.element)-ve(r.viewport,n),u=ye(e.top,e.height,t,o.element)-ve(o.viewport,n);return {tStart:i,tEnd:u}}function Ee(e,t,n){let r=e.getBoundingClientRect(),o=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left+t.scrollLeft:r.top-t.getBoundingClientRect().top+t.scrollTop,height:o,scroll:0}:{top:n==="x"?r.left:r.top,height:o,scroll:n==="x"?window.scrollX:window.scrollY}}function we(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let 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 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 Se(e,t,n){let r=we(e),o=we(t);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*n)},${Math.round(r[1]+(o[1]-r[1])*n)},${Math.round(r[2]+(o[2]-r[2])*n)})`}var qe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ge="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Me=33;function Ue(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ke(e){let t=[];for(let n=0;n<Me;n++){let r=n/(Me-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function xe(e){switch(e){case "linear":return "linear";case "ease-in":return qe;case "ease-out":return Ge;case "ease-in-out":return Ue()?Ke(D["ease-in-out"]):null;default:return null}}var Le=Symbol.for("svg-scroll-draw.registry");function Re(){let e=globalThis;return e[Le]||(e[Le]=new Map)}function ce(e,t){Re().set(e,t);}function le(e){Re().delete(e);}var Ze=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function G(e,...t){Ze&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var H,U=new Set,K=new WeakMap,W=new Map,Te=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Je(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function Pe(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();H??(H=new ResizeObserver(o=>{let i=false;for(let{target:u}of o)K.get(u)!==Te(u)&&(i=true),K.set(u,"");i&&U.forEach(u=>u());})),U.add(n);let r=Je(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{K.has(o)||K.set(o,Te(o)),W.set(o,(W.get(o)??0)+1),H.observe(o);}),()=>{U.delete(n)&&(r.forEach(o=>{let i=(W.get(o)??1)-1;if(i)return void W.set(o,i);W.delete(o),H?.unobserve(o);}),U.size||(H?.disconnect(),H=void 0));}}function $e(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function Ae(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=$e(i=>{if(!i)return;r();let u=(n.getProgress?.()??0)>=1;n.destroy(),n=t(u?{...e,onComplete:void 0}:e,true);}),o={};for(let i of Object.keys(n))o[i]=(...u)=>n[i]?.(...u);return o.destroy=()=>{r(),n.destroy();},o}function et(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ie(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],i=[],u=r[2].trim();if(u)for(let m of u.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(c?parseFloat(c[1]):0),i.push(c?c[2]:"");}t.push({fn:r[1],nums:o,units:i});}return t}function tt(e,t,n){let r=Ie(e),o=Ie(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((i,u)=>{let m=o[u];return i.fn!==m.fn||i.nums.length!==m.nums.length?n<1?`${i.fn}(${i.nums.map((c,l)=>`${c}${i.units[l]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,l)=>`${c}${m.units[l]}`).join(", ")})`:`${i.fn}(${i.nums.map((c,l)=>`${c+(m.nums[l]-c)*n}${i.units[l]}`).join(", ")})`}).join(" ")}function Ce(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(et(r))return Se(r,o,n);if(r.includes("("))return tt(r,o,n);let i=r.match(/^([-+]?[\d.]+)(.*)$/),u=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&u){let m=parseFloat(i[1]),c=parseFloat(u[1]);return `${m+(c-m)*n}${i[2]||u[2]}`}return n<1?r:o}function nt(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var rt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ot=0,_e="--scroll-draw-progress";function st(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Oe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Fe(e,t){return typeof window>"u"?Oe:t.respectReducedMotion===false?Ne(e,t,false):Ae(t,(n,r)=>Ne(e,n,r))}function Ne(e,t,n){let{props:r,trigger:o={},easing:i="ease-out",speed:u=1,once:m=false,axis:c="y",scrollContainer:l,native:f=true,velocityScale:g=false,triggerElement:T,onProgress:P,onComplete:S,onEnter:O,onLeave:F,onEnterBack:z,onLeaveBack:B}=t,M=typeof i=="function"?i:D[i]??D["ease-out"],$=ae(o.start??"top bottom"),A=ae(o.end??"bottom top"),X=T??e,b=typeof l=="string"?document.querySelector(l):l??null,y=Object.entries(r).map(([s,a])=>({prop:nt(s),from:Array.isArray(a)?a[0]:"",to:Array.isArray(a)?a[1]:a}));function De(){let s=window.getComputedStyle(e);for(let a of y)a.from===""&&(a.from=s.getPropertyValue(a.prop).trim()||"0");}function He(){for(let s of y)e.style.setProperty(s.prop,String(s.to));}let Z=new Map;for(let s of [...y.map(a=>a.prop),_e])Z.set(s,e.style.getPropertyValue(s));function J(){for(let[s,a]of Z)a?e.style.setProperty(s,a):e.style.removeProperty(s);}if(n)return He(),S?.(),{...Oe,destroy:J,getProgress:()=>1};De();let fe=typeof i=="string"?xe(i):null;function We(){if(!f||!st()||!fe||c!=="y"||b||X!==e||m||u!==1||P||S||O||F||z||B||g!==false||(o.start??"top bottom").trim()!=="top bottom"||(o.end??"bottom top").trim()!=="bottom top")return false;for(let s of y)if(!rt.has(s.prop))return false;return true}function ze(){let s=`ssd-a-${++ot}`,a=y.map(d=>`${d.prop}:${d.from}`).join(";"),_=y.map(d=>`${d.prop}:${d.to}`).join(";"),E=document.createElement("style");E.setAttribute("data-ssd-animate",""),E.textContent=`@keyframes ${s}{from{${a}}to{${_}}}.${s}{animation-name:${s};animation-duration:auto;animation-timing-function:${fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(E),e.classList.add(s);let p=()=>c==="x"?window.scrollX:window.scrollY,h=()=>c==="x"?window.innerWidth:window.innerHeight,N=()=>{let d=e.getBoundingClientRect();return ue({top:d.top,height:d.height},p(),h(),$,A)};ce(e,{type:"animate",getProgress:()=>oe.getProgress(),getTrigger:N});let oe={refresh(){},destroy(){e.classList.remove(s),E.remove(),e.style.animationPlayState="",J(),le(e);},replay(){e.classList.remove(s),e.offsetWidth,e.classList.add(s);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let se=Math.min(1,Math.max(0,d));e.classList.remove(s);for(let ie of y)e.style.setProperty(ie.prop,Ce(ie.from,ie.to,se));},getProgress(){let{tStart:d,tEnd:se}=N();return M(q(p(),d,se,u))}};return oe}if(We())return ze();let v=0,w=0,x=0,Q=false,L=false,I=-1,C=0,j=false,R=NaN,ee=-1,pe=0,de=()=>b?c==="x"?b.scrollLeft:b.scrollTop:c==="x"?window.scrollX:window.scrollY,Be=()=>b?c==="x"?b.clientWidth:b.clientHeight:c==="x"?window.innerWidth:window.innerHeight,k=X===e?y:[],ge=false;function te(){let s=e.style,a=k.map(h=>s.getPropertyValue(h.prop)),_=s.transition;k.length&&(s.transition="none"),k.forEach(h=>s.setProperty(h.prop,Z.get(h.prop)??""));let E=Ee(X,b,c);k.forEach((h,N)=>s.setProperty(h.prop,a[N])),k.length&&(e.offsetWidth,s.transition=_);let p=ue(E,E.scroll,Be(),$,A);ge&&Math.abs(p.tStart-v)<1&&Math.abs(p.tEnd-w)<1||(ge=true,v=p.tStart,w=p.tEnd);}function Y(s){e.style.setProperty(_e,String(s));for(let a of y)e.style.setProperty(a.prop,Ce(a.from,a.to,s));P?.(s);}function Xe(s){if(isNaN(R)){R=s;return}R<=0&&s>0?O?.():R>0&&s<=0&&B?.(),R<1&&s>=1?F?.():R>=1&&s<1&&z?.(),R=s;}function ne(){if(!Q||L)return;let s=performance.now(),a=de(),_=u;if(g!==false){let h=s-pe,N=h>0?Math.abs(a-(ee<0?a:ee))/h:0;_=u*Math.max(.2,1+N*(typeof g=="number"?g:1)*.04);}ee=a,pe=s;let E=w===v?0:(a-v)/(w-v);Xe(E);let p=M(q(a,v,w,_));m&&(I=Math.max(I,p),p=I),C=p,Y(p),p>=1&&!j?(j=true,S?.()):p<1&&!m&&(j=false),x=requestAnimationFrame(ne);}te(),w===v&&G("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let s=M(q(de(),v,w,u));m&&s>0&&(I=s),C=s,Y(s);}let he=new IntersectionObserver(s=>{s.forEach(a=>{Q=a.isIntersecting,Q&&!L?x=requestAnimationFrame(ne):cancelAnimationFrame(x);});},{root:b??null}),re;function V(){clearTimeout(re),re=setTimeout(te,150);}window.addEventListener("resize",V),window.addEventListener("orientationchange",V);let Qe=Pe([X],V);return he.observe(e),ce(e,{type:"animate",getProgress:()=>C,getTrigger:()=>({tStart:v,tEnd:w})}),{destroy(){cancelAnimationFrame(x),he.disconnect(),window.removeEventListener("resize",V),window.removeEventListener("orientationchange",V),Qe(),clearTimeout(re),J(),le(e);},replay(){I=-1,j=false,C=0,L=false,Y(0);},pause(){L=true,cancelAnimationFrame(x);},resume(){L&&(L=false,Q&&(x=requestAnimationFrame(ne)));},seek(s){let a=Math.min(1,Math.max(0,s));C=a,I=a,L=true,cancelAnimationFrame(x),Y(a);},getProgress(){return C},refresh(){te();}}}var it={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function at(e){let t={};e.opacity!==void 0&&(t.opacity=[e.opacity,1]);let n=[],r=[];return e.x!==void 0&&(n.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(n.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(n.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(n.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(n.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(n.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),n.length>0&&(t.transform=[n.join(" "),r.join(" ")]),t}function ut(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function me(e){let t=e.trim().split(/\s+/),[n,r]=t.length>1?t:/%$/.test(t[0])?["top",t[0]]:[t[0],"bottom"];return [n,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function ke(e,t){let[n,r]=me(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function ct(e){let t=NaN,n=0,r=0;return e.map(o=>{let i=o.getBoundingClientRect();return Math.abs(i.top-t)<=Math.max(8,Math.min(i.height,n||i.height)/2)?r++:(t=i.top,n=i.height,r=0),r})}var Ve={destroy:()=>{}};function Ft(e,t={}){if(typeof window>"u")return Ve;let n=ut(e);if(!n.length)return G("scrollReveal: no elements found:",e),Ve;let{preset:r="fadeUp",from:o,stagger:i=.15,easing:u="ease-out",once:m=true,trigger:c,onEnter:l,onLeave:f}=t,g={...it[r],...o},T=at(g),P=c?.start??"top 88%",S=c?.end??"top 53%",O=Math.abs(me(P)[1]-me(S)[1]),F=Math.min(Math.max(i,0),1)*O,z=F>0?ct(n):n.map(()=>0),B=n.map((M,$)=>{let A=Math.min(z[$]*F,O);return Fe(M,{props:T,easing:u,once:m,native:false,trigger:A>0?{start:ke(P,A),end:ke(S,A)}:{start:P,end:S},onEnter:$===0?l:void 0,onLeave:$===n.length-1?f:void 0})});return {destroy(){B.forEach(M=>M.destroy());}}}exports.scrollReveal=Ft;
|
|
1
|
+
'use strict';function Qe({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(r),s=0,u=[];for(let l=0;l<n;l++){let p=Math.pow(o,l);u.push(p),s+=p;}let m=[0],c=0;for(let l=0;l<n;l++)c+=u[l]/s,m.push(c);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let p=0;p<n;p++)if(l<=m[p+1]){let g=(l-m[p])/(m[p+1]-m[p]);if(p===0)return g*(2-g);let P=1-Math.pow(r,p);return P+(1-P)*(2*g-1)*(2*g-1)}return 1}}function je({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),o=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var D={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:Qe(),elastic:je()};function be(e,t,n){return Math.min(n,Math.max(t,e))}function ae(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function ye(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function ve(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function U(e,t,n,r){return n===t?0:be((e-t)/(n-t)*r,0,1)}function ue(e,t,n,r,o){let s=ye(e.top,e.height,t,r.element)-ve(r.viewport,n),u=ye(e.top,e.height,t,o.element)-ve(o.viewport,n);return {tStart:s,tEnd:u}}function Ee(e,t,n){let r=e.getBoundingClientRect(),o=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:r.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:n==="x"?r.left:r.top,height:o,scroll:n==="x"?window.scrollX:window.scrollY}}function we(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let 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 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 Se(e,t,n){let r=we(e),o=we(t);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*n)},${Math.round(r[1]+(o[1]-r[1])*n)},${Math.round(r[2]+(o[2]-r[2])*n)})`}var Ye="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",qe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Me=33;function Ge(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ue(e){let t=[];for(let n=0;n<Me;n++){let r=n/(Me-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function xe(e){switch(e){case "linear":return "linear";case "ease-in":return Ye;case "ease-out":return qe;case "ease-in-out":return Ge()?Ue(D["ease-in-out"]):null;default:return null}}var Le=Symbol.for("svg-scroll-draw.registry");function Re(){let e=globalThis;return e[Le]||(e[Le]=new Map)}function ce(e,t){Re().set(e,t);}function le(e){Re().delete(e);}var Ke=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function K(e,...t){Ke&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var H,Z=new Set,J=new WeakMap,z=new Map,Te=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Ze(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function Pe(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();H??(H=new ResizeObserver(o=>{let s=false;for(let{target:u}of o)J.get(u)!==Te(u)&&(s=true),J.set(u,"");s&&Z.forEach(u=>u());})),Z.add(n);let r=Ze(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{J.has(o)||J.set(o,Te(o)),z.set(o,(z.get(o)??0)+1),H.observe(o);}),()=>{Z.delete(n)&&(r.forEach(o=>{let s=(z.get(o)??1)-1;if(s)return void z.set(o,s);z.delete(o),H?.unobserve(o);}),Z.size||(H?.disconnect(),H=void 0));}}function $e(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function Ae(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=$e(s=>{if(!s)return;r();let u=(n.getProgress?.()??0)>=1;n.destroy(),n=t(u?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(n))o[s]=(...u)=>n[s]?.(...u);return o.destroy=()=>{r(),n.destroy();},o}function Je(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ie(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],s=[],u=r[2].trim();if(u)for(let m of u.split(/[\s,]+/)){let c=m.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(c?parseFloat(c[1]):0),s.push(c?c[2]:"");}t.push({fn:r[1],nums:o,units:s});}return t}function et(e,t,n){let r=Ie(e),o=Ie(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((s,u)=>{let m=o[u];return s.fn!==m.fn||s.nums.length!==m.nums.length?n<1?`${s.fn}(${s.nums.map((c,l)=>`${c}${s.units[l]}`).join(", ")})`:`${m.fn}(${m.nums.map((c,l)=>`${c}${m.units[l]}`).join(", ")})`:`${s.fn}(${s.nums.map((c,l)=>`${c+(m.nums[l]-c)*n}${s.units[l]}`).join(", ")})`}).join(" ")}function Ce(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(Je(r))return Se(r,o,n);if(r.includes("("))return et(r,o,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),u=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&u){let m=parseFloat(s[1]),c=parseFloat(u[1]);return `${m+(c-m)*n}${s[2]||u[2]}`}return n<1?r:o}function tt(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var nt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),rt=0,_e="--scroll-draw-progress";function ot(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Oe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Fe(e,t){return typeof window>"u"?Oe:t.respectReducedMotion===false?Ne(e,t,false):Ae(t,(n,r)=>Ne(e,n,r))}function Ne(e,t,n){let{props:r,trigger:o={},easing:s="ease-out",speed:u=1,once:m=false,axis:c="y",scrollContainer:l,native:p=true,velocityScale:g=false,triggerElement:P,onProgress:$,onComplete:M,onEnter:N,onLeave:O,onEnterBack:W,onLeaveBack:B}=t,w=typeof s=="function"?s:D[s]??D["ease-out"],A=ae(o.start||"top bottom"),I=ae(o.end||"bottom top"),X=P??e,b=typeof l=="string"?document.querySelector(l):l??null,y=Object.entries(r).map(([i,a])=>({prop:tt(i),from:Array.isArray(a)?a[0]:"",to:Array.isArray(a)?a[1]:a}));function De(){let i=window.getComputedStyle(e);for(let a of y)a.from===""&&(a.from=i.getPropertyValue(a.prop).trim()||"0");}function He(){for(let i of y)e.style.setProperty(i.prop,String(i.to));}let ee=new Map;for(let i of [...y.map(a=>a.prop),_e])ee.set(i,e.style.getPropertyValue(i));function te(){for(let[i,a]of ee)a?e.style.setProperty(i,a):e.style.removeProperty(i);}if(n)return He(),M?.(),{...Oe,destroy:te,getProgress:()=>1};De();let Q=()=>b?c==="x"?b.scrollLeft:b.scrollTop:c==="x"?window.scrollX:window.scrollY,fe=()=>b?c==="x"?b.clientWidth:b.clientHeight:c==="x"?window.innerWidth:window.innerHeight,pe=typeof s=="string"?xe(s):null;function ze(){if(!p||!ot()||!pe||c!=="y"||b||X!==e||m||u!==1||$||M||N||O||W||B||g!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let i of y)if(!nt.has(i.prop))return false;return true}function We(){let i=`ssd-a-${++rt}`,a=y.map(f=>`${f.prop}:${f.from}`).join(";"),_=y.map(f=>`${f.prop}:${f.to}`).join(";"),E=document.createElement("style");E.setAttribute("data-ssd-animate",""),E.textContent=`@keyframes ${i}{from{${a}}to{${_}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${pe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(E),e.classList.add(i);let h=()=>{let f=e.getBoundingClientRect();return ue({top:f.top,height:f.height},Q(),fe(),A,I)};ce(e,{type:"animate",getProgress:()=>d.getProgress(),getTrigger:h});let d={refresh(){},destroy(){e.classList.remove(i),E.remove(),e.style.animationPlayState="",te(),le(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let V=Math.min(1,Math.max(0,f));e.classList.remove(i);for(let G of y)e.style.setProperty(G.prop,Ce(G.from,G.to,V));},getProgress(){let{tStart:f,tEnd:V}=h();return w(U(Q(),f,V,u))}};return d}if(ze())return We();let v=0,S=0,x=0,j=false,L=false,ne=-1,C=0,R=0,Y=false,T=NaN,re=-1,de=0,F=X===e?y:[],ge=false;function oe(){let i=e.style,a=F.map(d=>i.getPropertyValue(d.prop)),_=i.transition;F.length&&(i.transition="none"),F.forEach(d=>i.setProperty(d.prop,ee.get(d.prop)??""));let E=Ee(X,b,c);F.forEach((d,f)=>i.setProperty(d.prop,a[f])),F.length&&(e.offsetWidth,i.transition=_);let h=ue(E,E.scroll,fe(),A,I);ge&&Math.abs(h.tStart-v)<1&&Math.abs(h.tEnd-S)<1||(ge=true,v=h.tStart,S=h.tEnd);}function q(i){e.style.setProperty(_e,String(i));for(let a of y)e.style.setProperty(a.prop,Ce(a.from,a.to,i));$?.(i);}function Be(i){if(isNaN(T)){T=i;return}T<=0&&i>0?N?.():T>0&&i<=0&&B?.(),T<1&&i>=1?O?.():T>=1&&i<1&&W?.(),T=i;}function se(){if(!j||L)return;let i=performance.now(),a=Q(),_=u;if(g!==false){let f=i-de,V=f>0?Math.abs(a-(re<0?a:re))/f:0;_=u*Math.max(.2,1+V*(typeof g=="number"?g:1)*.04);}re=a,de=i;let E=S===v?0:(a-v)/(S-v);Be(E);let h=U(a,v,S,_),d=m?Math.max(ne,w(C=Math.max(C,h))):w(h);R=d,q(d),d>=1&&!Y?(Y=true,M?.()):d<1&&!m&&(Y=false),x=requestAnimationFrame(se);}oe(),S===v&&K("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),C=U(Q(),v,S,u),R=w(C),q(R);let he=new IntersectionObserver(i=>{i.forEach(a=>{j=a.isIntersecting,j&&!L?x=requestAnimationFrame(se):cancelAnimationFrame(x);});},{root:b??null}),ie;function k(){clearTimeout(ie),ie=setTimeout(oe,150);}window.addEventListener("resize",k),window.addEventListener("orientationchange",k);let Xe=Pe([X],k);return he.observe(e),ce(e,{type:"animate",getProgress:()=>R,getTrigger:()=>({tStart:v,tEnd:S})}),{destroy(){cancelAnimationFrame(x),he.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k),Xe(),clearTimeout(ie),te(),le(e);},replay(){ne=-1,C=0,Y=false,R=0,L=false,q(0);},pause(){L=true,cancelAnimationFrame(x);},resume(){L&&(L=false,j&&(x=requestAnimationFrame(se)));},seek(i){let a=Math.min(1,Math.max(0,i));R=a,ne=a,C=0,L=true,cancelAnimationFrame(x),q(a);},getProgress(){return R},refresh(){oe();}}}var st={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function it(e){let t={};e.opacity!==void 0&&(t.opacity=[e.opacity,1]);let n=[],r=[];return e.x!==void 0&&(n.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(n.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(n.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(n.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(n.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(n.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),n.length>0&&(t.transform=[n.join(" "),r.join(" ")]),t}function at(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function me(e){let t=e.trim().split(/\s+/),[n,r]=t.length>1?t:/%$/.test(t[0])?["top",t[0]]:[t[0],"bottom"];return [n,/%$/.test(r)?parseFloat(r):r==="top"?0:r==="center"?50:100]}function ke(e,t){let[n,r]=me(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function ut(e){let t=NaN,n=0,r=0;return e.map(o=>{let s=o.getBoundingClientRect();return Math.abs(s.top-t)<=Math.max(8,Math.min(s.height,n||s.height)/2)?r++:(t=s.top,n=s.height,r=0),r})}var Ve={destroy:()=>{}};function Ot(e,t={}){if(typeof window>"u")return Ve;let n=at(e);if(!n.length)return K("scrollReveal: no elements found:",e),Ve;let{preset:r="fadeUp",from:o,stagger:s=.15,easing:u="ease-out",once:m=true,trigger:c,onEnter:l,onLeave:p}=t,g={...st[r],...o},P=it(g),$=c?.start||"top 88%",M=c?.end||"top 53%",N=Math.abs(me($)[1]-me(M)[1]),O=Math.min(Math.max(s,0),1)*N,W=O>0?ut(n):n.map(()=>0),B=n.map((w,A)=>{let I=Math.min(W[A]*O,N);return Fe(w,{props:P,easing:u,once:m,native:false,trigger:I>0?{start:ke($,I),end:ke(M,I)}:{start:$,end:M},onEnter:A===0?l:void 0,onLeave:A===n.length-1?p:void 0})});return {destroy(){B.forEach(w=>w.destroy());}}}exports.scrollReveal=Ot;
|
package/dist/reveal/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-V4L3ELVC.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.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 {b}from'../chunk-LFSU6LR3.mjs';var M={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function N(e){let r={};e.opacity!==void 0&&(r.opacity=[e.opacity,1]);let t=[],n=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),n.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),n.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),n.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),n.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),n.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),n.push("rotateY(0deg)")),t.length>0&&(r.transform=[t.join(" "),n.join(" ")]),r}function P(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function u(e){let r=e.trim().split(/\s+/),[t,n]=r.length>1?r:/%$/.test(r[0])?["top",r[0]]:[r[0],"bottom"];return [t,/%$/.test(n)?parseFloat(n):n==="top"?0:n==="center"?50:100]}function y(e,r){let[t,n]=u(e);return `${t} ${+Math.max(0,n-r).toFixed(3)}%`}function Y(e){let r=NaN,t=0,n=0;return e.map(a=>{let o=a.getBoundingClientRect();return Math.abs(o.top-r)<=Math.max(8,Math.min(o.height,t||o.height)/2)?n++:(r=o.top,t=o.height,n=0),n})}var v={destroy:()=>{}};function A(e,r={}){if(typeof window>"u")return v;let t=P(e);if(!t.length)return b("scrollReveal: no elements found:",e),v;let{preset:n="fadeUp",from:a$1,stagger:o=.15,easing:b$1="ease-out",once:R=true,trigger:d,onEnter:x,onLeave:E}=r,S={...M[n],...a$1},X=N(S),s=d?.start||"top 88%",i=d?.end||"top 53%",f=Math.abs(u(s)[1]-u(i)[1]),g=Math.min(Math.max(o,0),1)*f,$=g>0?Y(t):t.map(()=>0),L=t.map((l,c)=>{let p=Math.min($[c]*g,f);return a(l,{props:X,easing:b$1,once:R,native:false,trigger:p>0?{start:y(s,p),end:y(i,p)}:{start:s,end:i},onEnter:c===0?x:void 0,onLeave:c===t.length-1?E:void 0})});return {destroy(){L.forEach(l=>l.destroy());}}}export{A as scrollReveal};
|
package/dist/solid/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var solidJs=require('solid-js');function
|
|
1
|
+
'use strict';var solidJs=require('solid-js');function dn({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(n),i=0,a=[];for(let d=0;d<t;d++){let v=Math.pow(s,d);a.push(v),i+=v;}let m=[0],f=0;for(let d=0;d<t;d++)f+=a[d]/i,m.push(f);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<t;v++)if(d<=m[v+1]){let I=(d-m[v])/(m[v+1]-m[v]);if(v===0)return I*(2-I);let E=1-Math.pow(n,v);return E+(1-E)*(2*I-1)*(2*I-1)}return 1}}function gn({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),s=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var ne={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:dn(),elastic:gn()};function Rt(e,r,t){return Math.min(t,Math.max(r,e))}function fe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function Dt(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function Ft(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 ee(e,r,t,n){return t===r?0:Rt((e-r)/(t-r)*n,0,1)}function Te(e,r,t,n,s){let i=Dt(e.top,e.height,r,n.element)-Ft(n.viewport,t),a=Dt(e.top,e.height,r,s.element)-Ft(s.viewport,t);return {tStart:i,tEnd:a}}function ot(e,r,t){let n=e.getBoundingClientRect(),s=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:s,scroll:0}:{top:t==="x"?n.left:n.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function je(e){let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),n=parseFloat(e.getAttribute("height")??"0");return 2*(t+n)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function Ht(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function st(e,r,t){let n=Ht(e),s=Ht(r);return !n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*t)},${Math.round(n[1]+(s[1]-n[1])*t)},${Math.round(n[2]+(s[2]-n[2])*t)})`}var Nt={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 Xe=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){Xe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var yn="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",hn="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Vt=33;function bn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function wn(e){let r=[];for(let t=0;t<Vt;t++){let n=t/(Vt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function it(e){switch(e){case "linear":return "linear";case "ease-in":return yn;case "ease-out":return hn;case "ease-in-out":return bn()?wn(ne["ease-in-out"]):null;default:return null}}var zt=Symbol.for("svg-scroll-draw.registry");function _t(){let e=globalThis;return e[zt]||(e[zt]=new Map)}function Le(e,r){_t().set(e,r);}function Ae(e){_t().delete(e);}var Ke,at=new Set,lt=new WeakMap,Ze=new Map,Wt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function vn(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Ie(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();Ke??(Ke=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)lt.get(a)!==Wt(a)&&(i=true),lt.set(a,"");i&&at.forEach(a=>a());})),at.add(t);let n=vn(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{lt.has(s)||lt.set(s,Wt(s)),Ze.set(s,(Ze.get(s)??0)+1),Ke.observe(s);}),()=>{at.delete(t)&&(n.forEach(s=>{let i=(Ze.get(s)??1)-1;if(i)return void Ze.set(s,i);Ze.delete(s),Ke?.unobserve(s);}),at.size||(Ke?.disconnect(),Ke=void 0));}}function ct(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function qe(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=ct(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...a)=>t[i]?.(...a);return s.destroy=()=>{n(),t.destroy();},s}var En=0;function Sn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function qt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Bt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Tn(e){if(!Xe)return;let r=qt(e,"stroke");if(!r||r==="none"){pe("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Bt.has(t)&&!Bt.has(qt(e,"fill"))&&pe("Element has a fill \u2014 it may obscure the stroke animation.",e);}function xn(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=t==="x"?window.scrollX:window.scrollY,a=e-i,m=r-i,f=t==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${f?`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;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Bt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Sn(e,r,t){if(!Ke)return;let n=(e.match(Bt)??[]).join("").toUpperCase(),s=(r.match(Bt)??[]).join("").toUpperCase(),i=(e.match(qt)??[]).length,a=(r.match(qt)??[]).length;if(n!==s){he(`morphTo: command sequence differs (${n||"\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.`,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 yt(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),m=n[s++]??a;return String(+(a+(m-a)*t).toFixed(4))})}function ht(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Be(r,(t,n)=>Tn(e,t,n))}function Tn(e,r,t){let{preset:n,...s}=r,i=n?{...Rt[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:d="linear",trigger:x={},stagger:R=0,direction:C="forward",once:Q=false,debug:me=false,axis:I="y",scrollContainer:se,autoReverse:be=false,delay:D=0,strokeColor:H,strokeWidth:k,fillOpacity:M,waypoints:w,velocityScale:v=false,threshold:T=0,rootMargin:U="0px",repeat:N=0,repeatDelay:B=0,morphTo:L,clip:fe,autoplay:Ee=false,duration:ie=1e3,native:z=true,onProgress:u,onStart:A,onComplete:h,onEnter:O,onLeave:te,onEnterBack:pe,onLeaveBack:Se}=i,Z=fe===true?"left":typeof fe=="string"?fe: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(k)?k[0]:null,Y=Array.isArray(k)?k[1]:typeof k=="number"?k:null,ge=Array.isArray(M)?M[0]:null,J=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Oe(o){let c=o*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(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let _=Z?[]:Array.from(e.querySelectorAll(a)),P=[],we=[],l=0,p=0,$e=R,Te=0,$=false,V=false,G=0,Ve=false,q=-1,He=[],ze=-1,ce=false,Ie=0,Ne=0,_e,ut=null;function Tt(){ut?.destroy(),ut=null;}let We=new Set,xt=NaN,qe=true,et=-1,Mt=performance.now(),Ge=NaN;function Ye(){return ae?I==="x"?ae.scrollLeft:ae.scrollTop:I==="x"?window.scrollX:window.scrollY}function Lt(){return ae?I==="x"?ae.clientWidth:ae.clientHeight:I==="x"?window.innerWidth:window.innerHeight}function At(){let o=st(e,ae,I);return Le(o,o.scroll,Lt(),de,Ae)}function on(){let o=p-l,c=_.length-1,y=ae??document.documentElement,X=I==="x"?"Width":"Height";if($e=R,R>0&&c>0&&o>0){let xe=y[`scroll${X}`]-y[`client${X}`]-1-l-o/m;xe>=0&&($e=Math.min(R,xe/(c*o)));}Te=p+c*$e*o;}function $t(){(({tStart:l,tEnd:p}=At())),on(),me&&Ke&&(Tt(),ut=En(l,p,I));}function mt(o,c=At){Pe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let y=o.destroy;return o.destroy=()=>{y.call(o),ke(e);},o}function sn(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let y=c==="reverse"?1-o:o;e.style.clipPath=Oe(y);return}_.forEach((y,X)=>{y.style.strokeDashoffset=c==="reverse"?`${P[X]*o}`:`${P[X]*(1-o)}`,f&&(y.style.opacity=c==="reverse"?`${1-o}`:`${o}`),le&&ne?y.style.stroke=Ue(le,ne,o):ne&&(y.style.stroke=ne),re!==null&&Y!==null?y.style.strokeWidth=`${re+(Y-re)*o}`:Y!==null&&(y.style.strokeWidth=`${Y}`),ge!==null&&J!==null?y.style.fillOpacity=`${ge+(J-ge)*o}`:J!==null&&(y.style.fillOpacity=`${J}`),L&&y.tagName.toLowerCase()==="path"&&we[X]&&y.setAttribute("d",yt(we[X],L,o));});}function tt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=Oe(0);return}_.forEach((o,c)=>{o.style.strokeDasharray=`${P[c]}`,o.style.strokeDashoffset=C==="reverse"?"0":`${P[c]}`,f?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),re!==null&&(o.style.strokeWidth=`${re}`),ge!==null&&(o.style.fillOpacity=`${ge}`),L&&o.tagName.toLowerCase()==="path"&&we[c]&&o.setAttribute("d",we[c]);});}if(_.forEach(o=>{vn(o);let c=Qe(o);P.push(c);let y=o.tagName.toLowerCase()==="path";y?we.push(o.getAttribute("d")??""):we.push(""),L&&(y?Sn(we[we.length-1],L,o):he(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=C==="reverse"?`${c}`:"0",f&&(o.style.opacity="1"),ne&&(o.style.stroke=ne),Y!==null&&(o.style.strokeWidth=`${Y}`),J!==null&&(o.style.fillOpacity=`${J}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=C==="reverse"?"0":`${c}`,f?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),re!==null&&(o.style.strokeWidth=`${re}`),ge!==null&&(o.style.fillOpacity=`${ge}`));}),Z){if(t)return e.style.clipPath=Oe(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Oe(0);}else if(t)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let Ct=typeof d=="string"?it(d):null;function an(){return !(z===false||!wn()||!_.length||!Ct||Z||I!=="y"||ae||m!==1||R!==0||Q||be||v!==false||L||w||N||D>0||u||A||h||O||te||pe||Se||H!=null||k!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function ln(){let o=++bn,c=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,X=`--svg-scroll-draw-${o}`,xe=C==="reverse"?"0":"var(--ssd-len)",De=C==="reverse"?"var(--ssd-len)":"0",Ce=`stroke-dashoffset:${xe};`,S=`stroke-dashoffset:${De};`;f&&(Ce+=`opacity:${C==="reverse"?1:0};`,S+=`opacity:${C==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Ce}}to{${S}}}.${y}{view-timeline-name:${X};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(y);function ue(g,K){g.style.setProperty("--ssd-len",String(P[K])),g.style.strokeDasharray=`${P[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},Ye(),Lt(),de,Ae);return E(ee(Ye(),K,Me,m))}return {destroy(){e.classList.remove(y),_.forEach(g=>{g.classList.remove(c),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),F.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=C==="reverse"?`${P[ve]*K}`:`${P[ve]*(1-K)}`,f&&(Me.style.opacity=C==="reverse"?`${1-K}`:`${K}`);});},getProgress(){return j()},refresh(){_.forEach((g,K)=>{P[K]=Qe(g),g.style.setProperty("--ssd-len",String(P[K])),g.style.strokeDasharray=`${P[K]}`;});}}}if(an())return mt(ln());function cn(){let o=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/o)),g=E(j);Ie=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=Oe(C==="reverse"?1-g:g),u?.(g),j<1&&(W=false);}else _.forEach((j,g)=>{let K=g*R*o,Me=Math.min(1,Math.max(0,(b-K)/o)),ve=E(Me);j.style.strokeDashoffset=C==="reverse"?`${P[g]*ve}`:`${P[g]*(1-ve)}`,f&&(j.style.opacity=C==="reverse"?`${1-ve}`:`${ve}`),le&&ne?j.style.stroke=Ue(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",yt(we[g],L,ve)),g===0&&(Ie=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/o)),g=E(j);for(let K in w){let Me=parseFloat(K);g>=Me&&!We.has(Me)&&(We.add(Me),w[K]?.());}}return W}function De(b){if(ce)return;let W=b-c;V||(V=true,A?.());let j=xe(W);if(j&&!$){$=true,xe(o*(1+Math.max(0,_.length-1)*R)),h?.(),Ne<(N==="infinite"?1/0:N??0)&&(Ne++,_e=setTimeout(()=>{c=performance.now(),V=false,$=false,We.clear(),tt(),G=requestAnimationFrame(De);},B));return}j||(G=requestAnimationFrame(De));}function Ce(){cancelAnimationFrame(G),clearTimeout(_e),c=performance.now(),y=0,ce=false,V=false,$=false,Ne=0,X=true,Ie=0,We.clear(),tt(),G=requestAnimationFrame(De);}let S=new IntersectionObserver(b=>{b.forEach(W=>{W.isIntersecting&&!(Q&&$)?Ce():!W.isIntersecting&&!Q&&!$&&(cancelAnimationFrame(G),clearTimeout(_e),X=false);});},{root:ae??null,threshold:T,rootMargin:U}),F;function ue(){clearTimeout(F),F=setTimeout(()=>{_.forEach((b,W)=>{P[W]=Qe(b),b.style.strokeDasharray=`${P[W]}`;});},150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),D>0?setTimeout(()=>S.observe(e),D):S.observe(e),{destroy(){cancelAnimationFrame(G),clearTimeout(_e),S.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(F);},replay(){Ne=0,Ce();},pause(){ce||!X||(ce=true,y=performance.now()-c,cancelAnimationFrame(G));},resume(){ce&&(ce=false,X=true,c=performance.now()-y,G=requestAnimationFrame(De));},seek(b){let W=Math.min(1,Math.max(0,b));Ie=W,ce=true,y=W*o,c=performance.now()-y,cancelAnimationFrame(G),xe(y);},getProgress(){return Ie},refresh(){clearTimeout(F),_.forEach((b,W)=>{P[W]=Qe(b),b.style.strokeDasharray=`${P[W]}`;});}}}if(Ee)return mt(cn());$t();function Pt(){if(ce||!je)return;let o=performance.now(),c=Ye();if(!qe&&v===false&&c===xt){pt(c);return}qe=false,xt=c;let y=m;if(v!==false){let S=o-Mt,F=S>0?Math.abs(c-(et<0?c:et))/S:0;y=m*Math.max(.2,1+F*(typeof v=="number"?v:1)*.04);}et=c,Mt=o;let X=be?ze===-1||c>=ze?"forward":"reverse":C;ze=c;let xe=p-l,De=true,Ce=xe===0?0:(c-l)/xe;if(isNaN(Ge)||(Ge<=0&&Ce>0?O?.():Ge>0&&Ce<=0&&Se?.(),Ge<1&&Ce>=1?te?.():Ge>=1&&Ce<1&&pe?.()),Ge=Ce,Z){let S=E(ee(c,l,p,y));Q&&!be&&(q=Math.max(q,S),S=q),Ie=S,e.style.setProperty("--scroll-draw-progress",String(S));let F=X==="reverse"?1-S:S;e.style.clipPath=Oe(F),u?.(S),!V&&ee(c,l,p,y)>0&&(V=true,A?.()),S>=1&&!$?($=true,h?.(),Ne<(N==="infinite"?1/0:N??0)&&(Ne++,_e=setTimeout(()=>{q=-1,V=false,$=false,e.style.clipPath=Oe(0);},B))):S<1&&!Q&&($=false),pt(c);return}if(_.forEach((S,F)=>{let ue=F*$e*xe,b=E(ee(c,l+ue,p+ue,y));Q&&!be&&(b=He[F]=Math.max(He[F]??q,b)),S.style.strokeDashoffset=X==="reverse"?`${P[F]*b}`:`${P[F]*(1-b)}`,f&&(S.style.opacity=X==="reverse"?`${1-b}`:`${b}`),le&&ne?S.style.stroke=Ue(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[F]&&S.setAttribute("d",yt(we[F],L,b)),F===0&&(Ie=b,u?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(De=false);}),w){let S=E(ee(c,l,p,y));for(let F in w){let ue=parseFloat(F);S>=ue&&!We.has(ue)&&(We.add(ue),w[F]?.());}}!V&&ee(c,l,p,y)>0&&(V=true,A?.()),De&&!$?($=true,h?.(),Ne<(N==="infinite"?1/0:N??0)&&(Ne++,_e=setTimeout(()=>{q=-1,He=[],V=false,$=false,We.clear(),tt(),qe=true;},B))):!De&&!Q&&($=false),pt(c);}function ft(o){return o>=p&&o<Te}function pt(o){Ve||ft(o)?G=requestAnimationFrame(Pt):je=false;}function dt(){return Ve||ft(Ye())}let je=false;function nt(){je||(je=true,G=requestAnimationFrame(function(){Pt();}));}function rt(){je=false,cancelAnimationFrame(G);}let gt=new IntersectionObserver(o=>{o.forEach(c=>{Ve=c.isIntersecting,Ve&&!ce?(qe=true,nt()):je&&!ce&&ft(Ye())||rt();});},{root:ae??null,threshold:T,rootMargin:U});function kt(){_.forEach((o,c)=>{P[c]=Qe(o),o.style.strokeDasharray=`${P[c]}`;}),$t(),qe=true;}let ot;function Xe(){clearTimeout(ot),ot=setTimeout(kt,150);}window.addEventListener("resize",Xe),window.addEventListener("orientationchange",Xe);let un=Fe([e],Xe);return D>0?setTimeout(()=>gt.observe(e),D):gt.observe(e),mt({destroy(){cancelAnimationFrame(G),clearTimeout(_e),rt(),gt.disconnect(),un(),window.removeEventListener("resize",Xe),window.removeEventListener("orientationchange",Xe),clearTimeout(ot),Tt();},replay(){q=-1,He=[],ze=-1,et=-1,V=false,$=false,Ne=0,ce=false,Ie=0,We.clear(),clearTimeout(_e),tt(),qe=true,dt()&&nt();},pause(){ce=true,rt();},resume(){ce&&(ce=false,qe=true,dt()&&nt());},seek(o){let c=Math.min(1,Math.max(0,o));Ie=c,q=c,He=[],ce=true,rt(),sn(c,C),qe=true;},getProgress(){return Ie},refresh(){clearTimeout(ot),kt(),dt()&&!ce&&nt();}},()=>({tStart:l,tEnd:p}))}var Gt=new WeakMap,xn=0;function jt(e){return JSON.stringify(e,(r,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let n=Gt.get(t);return n===void 0&&Gt.set(t,n=++xn),`el#${n}`}return t})}function Qt(e,r){let t={...e};for(let n of Object.keys(t))typeof t[n]=="function"&&(t[n]=(...s)=>r()[n]?.(...s));return t}function Mn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ut(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function Ln(e,r,t){let n=Ut(e),s=Ut(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,a)=>{let m=s[a];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,d)=>`${f}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(m.nums[d]-f)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function Yt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Mn(n))return Ue(n,s,t);if(n.includes("("))return Ln(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let m=parseFloat(i[1]),f=parseFloat(a[1]);return `${m+(f-m)*t}${i[2]||a[2]}`}return t<1?n:s}function An(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var $n=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Cn=0,Xt="--scroll-draw-progress";function Pn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function bt(e,r){return typeof window>"u"?Zt:r.respectReducedMotion===false?Kt(e,r,false):Be(r,(t,n)=>Kt(e,t,n))}function Kt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:m=false,axis:f="y",scrollContainer:d,native:x=true,velocityScale:R=false,triggerElement:C,onProgress:Q,onComplete:me,onEnter:I,onLeave:se,onEnterBack:be,onLeaveBack:D}=r,H=typeof i=="function"?i:oe[i]??oe["ease-out"],k=ye(s.start??"top bottom"),M=ye(s.end??"bottom top"),w=C??e,v=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(n).map(([l,p])=>({prop:An(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),Xt])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(),me?.(),{...Zt,destroy:L,getProgress:()=>1};U();let fe=typeof i=="string"?it(i):null;function Ee(){if(!x||!Pn()||!fe||f!=="y"||v||w!==e||m||a!==1||Q||me||I||se||be||D||R!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let l of T)if(!$n.has(l.prop))return false;return true}function ie(){let l=`ssd-a-${++Cn}`,p=T.map(q=>`${q.prop}:${q.from}`).join(";"),$e=T.map(q=>`${q.prop}:${q.to}`).join(";"),Te=document.createElement("style");Te.setAttribute("data-ssd-animate",""),Te.textContent=`@keyframes ${l}{from{${p}}to{${$e}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(Te),e.classList.add(l);let $=()=>f==="x"?window.scrollX:window.scrollY,V=()=>f==="x"?window.innerWidth:window.innerHeight,G=()=>{let q=e.getBoundingClientRect();return Le({top:q.top,height:q.height},$(),V(),k,M)};Pe(e,{type:"animate",getProgress:()=>Ve.getProgress(),getTrigger:G});let Ve={refresh(){},destroy(){e.classList.remove(l),Te.remove(),e.style.animationPlayState="",L(),ke(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(q){let He=Math.min(1,Math.max(0,q));e.classList.remove(l);for(let ze of T)e.style.setProperty(ze.prop,Yt(ze.from,ze.to,He));},getProgress(){let{tStart:q,tEnd:He}=G();return H(ee($(),q,He,a))}};return Ve}if(Ee())return ie();let z=0,u=0,A=0,h=false,O=false,te=-1,pe=0,Se=false,Z=NaN,E=-1,de=0,Ae=()=>v?f==="x"?v.scrollLeft:v.scrollTop:f==="x"?window.scrollX:window.scrollY,ae=()=>v?f==="x"?v.clientWidth:v.clientHeight:f==="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)),$e=l.transition;le.length&&(l.transition="none"),le.forEach(V=>l.setProperty(V.prop,B.get(V.prop)??""));let Te=st(w,v,f);le.forEach((V,G)=>l.setProperty(V.prop,p[G])),le.length&&(e.offsetWidth,l.transition=$e);let $=Le(Te,Te.scroll,ae(),k,M);ne&&Math.abs($.tStart-z)<1&&Math.abs($.tEnd-u)<1||(ne=true,z=$.tStart,u=$.tEnd);}function Y(l){e.style.setProperty(Xt,String(l));for(let p of T)e.style.setProperty(p.prop,Yt(p.from,p.to,l));Q?.(l);}function ge(l){if(isNaN(Z)){Z=l;return}Z<=0&&l>0?I?.():Z>0&&l<=0&&D?.(),Z<1&&l>=1?se?.():Z>=1&&l<1&&be?.(),Z=l;}function J(){if(!h||O)return;let l=performance.now(),p=Ae(),$e=a;if(R!==false){let V=l-de,G=V>0?Math.abs(p-(E<0?p:E))/V:0;$e=a*Math.max(.2,1+G*(typeof R=="number"?R:1)*.04);}E=p,de=l;let Te=u===z?0:(p-z)/(u-z);ge(Te);let $=H(ee(p,z,u,$e));m&&(te=Math.max(te,$),$=te),pe=$,Y($),$>=1&&!Se?(Se=true,me?.()):$<1&&!m&&(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));m&&l>0&&(te=l),pe=l,Y(l);}let Oe=new IntersectionObserver(l=>{l.forEach(p=>{h=p.isIntersecting,h&&!O?A=requestAnimationFrame(J):cancelAnimationFrame(A);});},{root:v??null}),_;function P(){clearTimeout(_),_=setTimeout(re,150);}window.addEventListener("resize",P),window.addEventListener("orientationchange",P);let we=Fe([w],P);return Oe.observe(e),Pe(e,{type:"animate",getProgress:()=>pe,getTrigger:()=>({tStart:z,tEnd:u})}),{destroy(){cancelAnimationFrame(A),Oe.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),we(),clearTimeout(_),L(),ke(e);},replay(){te=-1,Se=false,pe=0,O=false,Y(0);},pause(){O=true,cancelAnimationFrame(A);},resume(){O&&(O=false,h&&(A=requestAnimationFrame(J)));},seek(l){let p=Math.min(1,Math.max(0,l));pe=p,te=p,O=true,cancelAnimationFrame(A),Y(p);},getProgress(){return pe},refresh(){re();}}}var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vt(e,r){if(typeof window>"u")return wt;let t=typeof e=="string"?document.querySelector(e):e;return t?Be(r,(n,s)=>kn(t,n,s)):(he("scrollCounter: element not found:",e),wt)}function kn(e,r,t){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:m={},once:f=true,decimals:d,onComplete:x}=r,R=d!==void 0?u=>u.toFixed(d):i??(u=>String(Math.round(u))),C=typeof a=="function"?a:oe[a]??oe["ease-out"],Q=ye(m.start??"top 80%"),me=ye(m.end??"top 20%");if(t)return e.textContent=R(s),x?.(),{...wt,getProgress:()=>1};let I=0,se=0,be=false,D=0,H=false,k=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,me);be&&Math.abs(A.tStart-I)<1&&Math.abs(A.tEnd-se)<1||(be=true,I=A.tStart,se=A.tEnd);}function B(u){e.textContent=R(n+(s-n)*u),e.style.setProperty("--scroll-draw-progress",String(u));}function L(){if(!H||k)return;let u=C(ee(T(),I,se,1));f&&(M=Math.max(M,u),u=M),w=u,B(u),u>=1&&!v?(v=true,x?.()):u<1&&!f&&(v=false),D=requestAnimationFrame(L);}N();{let u=C(ee(T(),I,se,1));f&&u>0&&(M=u),w=u,B(u);}let fe=new IntersectionObserver(u=>{u.forEach(A=>{H=A.isIntersecting,H&&!k?D=requestAnimationFrame(L):cancelAnimationFrame(D);});}),Ee;function ie(){clearTimeout(Ee),Ee=setTimeout(N,150);}window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie);let z=Fe([e],ie);return fe.observe(e),Pe(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:I,tEnd:se})}),{destroy(){cancelAnimationFrame(D),fe.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),z(),clearTimeout(Ee),ke(e);},replay(){M=-1,v=false,w=0,k=false,B(0);},pause(){k=true,cancelAnimationFrame(D);},resume(){k&&(k=false,H&&(D=requestAnimationFrame(L)));},seek(u){let A=Math.min(1,Math.max(0,u));w=A,M=A,k=true,cancelAnimationFrame(D),B(A);},getProgress(){return w}}}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,r={}){if(typeof window>"u")return Jt;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Jt;let n=t,{trigger:s={},easing:i="linear",once:a=false,axis:m="y",preload:f="auto",triggerElement:d,onReady:x,onComplete:R,onProgress:C}=r,Q=d??n,me=window.matchMedia("(prefers-reduced-motion: reduce)").matches,I=typeof i=="function"?i:oe[i]??oe.linear,se=ye(s.start??"top top"),be=ye(s.end??"bottom top");n.pause(),n.hasAttribute("preload")||(n.preload=f);let D=r.from??0,H=r.to,k=0,M=0,w=0,v=false,T=false,U=-1,N=0,B=false,L=false,fe=()=>m==="x"?window.scrollX:window.scrollY,Ee=()=>m==="x"?window.innerWidth:window.innerHeight;function ie(){let E=Q.getBoundingClientRect(),de=m==="x"?E.left:E.top,Ae=m==="x"?E.width:E.height,ae=Le({top:de,height:Ae},fe(),Ee(),se,be);k=ae.tStart,M=ae.tEnd,L&&M===k&&he("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",n);}let z=NaN;function u(E){if(!L)return;let de=H??n.duration??0,Ae=D+(de-D)*E;Ae!==z&&(z=Ae,n.currentTime=Ae),n.style.setProperty("--scroll-draw-progress",String(E)),C?.(E);}function A(){if(!v||T||!L||me)return;let E=I(ee(fe(),k,M,1));a&&(U=Math.max(U,E),E=U),N=E,u(E),E>=1&&!B?(B=true,R?.()):E<1&&!a&&(B=false),w=requestAnimationFrame(A);}function h(){if(L=true,H===void 0&&(H=n.duration),me){u(1),x?.();return}ie(),x?.(),v&&!T&&(w=requestAnimationFrame(A));}n.readyState>=1?h():n.addEventListener("loadedmetadata",h,{once:true}),L||ie();let O=me?()=>{}:ct(E=>{E&&(O(),me=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=Fe([Q],Se);return te.observe(n),Pe(n,{type:"video",getProgress:()=>N,getTrigger:()=>({tStart:k,tEnd:M})}),{destroy(){cancelAnimationFrame(w),te.disconnect(),n.removeEventListener("loadedmetadata",h),window.removeEventListener("resize",Se),window.removeEventListener("orientationchange",Se),Z(),O(),clearTimeout(pe),ke(n);},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 en(e,r){let t=document.createElement("span");t.textContent=r,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 rn(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(n.textContent=t,n.style.whiteSpace="pre"):(n.textContent=t,n.style.display="inline-block"),e.appendChild(n),/^\s+$/.test(t)?null:n}).filter(t=>t!==null)}function On(e){let r=e.textContent??"";return e.textContent="",r.split("").map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=t,t===" "?n.style.whiteSpace="pre":n.style.display="inline-block",e.appendChild(n),t===" "?null:n}).filter(t=>t!==null)}function tn(e){let r=rn(e),t=new Map;for(let i of r){let a=i.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(i);}let n=[],s=Array.from(t.keys()).sort((i,a)=>i-a);for(let i of s){let a=t.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",a.forEach((f,d)=>{let x=f.nextElementSibling;m.appendChild(f),d<a.length-1&&x&&x.style.whiteSpace==="pre"&&m.appendChild(x);}),n.push(m);}return e.textContent="",n.forEach((i,a)=>{e.appendChild(i),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function In(e,r,t,n){if(t<=1||n===0)return e;let s=(t-1)*n,i=r*n,a=i+(1-s);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Dn(e,r){let t=[];if(r?.y!==void 0&&t.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&t.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&t.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let n=r.scale+(1-r.scale)*e;t.push(`scale(${n})`);}return t.join(" ")||""}var nn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,r={}){if(typeof window>"u")return nn;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return he("scrollText: element not found:",e),nn;let n=t;return Be(r,(s,i)=>Fn(n,s,i))}function Fn(e,r,t){let{split:n="words",stagger:s=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:f=true,onComplete:d}=r,x=typeof i=="function"?i:oe[i]??oe["ease-out"],R=ye(m.start??"top 85%"),C=ye(m.end??"top 40%"),Q=e.innerHTML,me=e.textContent??"",I;n==="chars"?I=On(e):n==="lines"?I=tn(e):I=rn(e),en(e,me);let se=I.length;function be(h,O){a?.opacity!==void 0&&(h.style.opacity=String(a.opacity+(1-a.opacity)*O));let te=Dn(O,a);te&&(h.style.transform=te);}function D(h){e.style.setProperty("--scroll-draw-progress",String(h)),I.forEach((O,te)=>{let pe=x(In(h,te,se,s));be(O,pe);});}if(t)return D(1),d?.(),{destroy(){e.innerHTML=Q;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};D(0);let H=0,k=0,M=0,w=false,v=false,T=-1,U=0,N=false,B=()=>window.scrollY,L=()=>window.innerHeight;function fe(){let h=e.getBoundingClientRect(),O=Le({top:h.top,height:h.height},B(),L(),R,C);H=O.tStart,k=O.tEnd;}function Ee(){if(!w||v)return;let h=ee(B(),H,k,1);f&&(T=Math.max(T,h),h=T),U=h,D(h),h>=1&&!N?(N=true,d?.()):h<1&&!f&&(N=false),M=requestAnimationFrame(Ee);}fe();let ie=new IntersectionObserver(h=>{h.forEach(O=>{w=O.isIntersecting,w&&!v?M=requestAnimationFrame(Ee):cancelAnimationFrame(M);});}),z;function u(){clearTimeout(z),z=setTimeout(()=>{if(n==="lines"){let h=U;e.innerHTML=Q,I=tn(e),en(e,me),D(h);}fe();},150);}window.addEventListener("resize",u),window.addEventListener("orientationchange",u);let A=Fe([e],u);return ie.observe(e),Pe(e,{type:"text",getProgress:()=>U,getTrigger:()=>({tStart:H,tEnd:k})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",u),window.removeEventListener("orientationchange",u),A(),clearTimeout(z),e.innerHTML=Q,ke(e);},replay(){T=-1,N=false,U=0,v=false,D(0);},pause(){v=true,cancelAnimationFrame(M);},resume(){v&&(v=false,w&&(M=requestAnimationFrame(Ee)));},seek(h){let O=Math.min(1,Math.max(0,h));U=O,T=O,v=true,cancelAnimationFrame(M),D(O);},getProgress(){return U}}}function Re(e,r){let t,n,s,i;return solidJs.createEffect(()=>{i=typeof e=="function"?e():e;let a=jt(i);!t||a===s||(s=a,solidJs.untrack(()=>{n?.destroy(),n=r(t,Qt(i,()=>i));}));}),solidJs.onCleanup(()=>{n?.destroy(),n=s=void 0;}),{ref:a=>{t=a;},getInstance:()=>n}}function Zr(e={}){return Re(e,ht).ref}function Jr(e={}){return Re(e,ht)}function eo(e){return Re(e,bt).ref}function to(e){return Re(e,bt)}function no(e){return Re(e,vt).ref}function ro(e){return Re(e,vt)}function oo(e={}){return Re(e,Et).ref}function so(e={}){return Re(e,Et)}function io(e={}){return Re(e,St).ref}function ao(e={}){return Re(e,St)}exports.createScrollAnimate=to;exports.createScrollCounter=ro;exports.createScrollDraw=Jr;exports.createScrollText=ao;exports.createScrollVideo=so;exports.useScrollAnimate=eo;exports.useScrollCounter=no;exports.useScrollDraw=Zr;exports.useScrollText=io;exports.useScrollVideo=oo;
|
|
3
|
+
<div style="position:absolute;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Gt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mn(e,r,t){if(!Xe)return;let n=(e.match(jt)??[]).join("").toUpperCase(),s=(r.match(jt)??[]).join("").toUpperCase(),i=(e.match(Gt)??[]).length,a=(r.match(Gt)??[]).length;if(n!==s){pe(`morphTo: command sequence differs (${n||"\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.`,t);return}i!==a&&pe(`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 Ln(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),m=n[s++]??a;return String(+(a+(m-a)*t).toFixed(4))})}function ht(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:qe(r,(t,n)=>An(e,t,n))}function An(e,r,t){let{preset:n,...s}=r,i=n?{...Nt[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:d="linear",trigger:v={},stagger:I=0,direction:E="forward",once:Z=false,debug:re=false,axis:M="y",scrollContainer:oe,autoReverse:ye=false,delay:C=0,strokeColor:P,strokeWidth:L,fillOpacity:A,waypoints:b,velocityScale:h=false,threshold:w=0,rootMargin:Y="0px",repeat:_=0,repeatDelay:X=0,morphTo:R,clip:F,autoplay:ce=false,duration:he=1e3,native:te=true,onProgress:G,onStart:p,onComplete:u,onEnter:T,onLeave:ue,onEnterBack:me,onLeaveBack:Ce}=i,H=F===true?"left":typeof F=="string"?F:false,J=typeof d=="function"?d:ne[d]??ne.linear,$=fe(v.start||"top bottom"),O=fe(v.end||"bottom top"),W=typeof oe=="string"?document.querySelector(oe):oe??null,ve=Array.isArray(P)?P[0]:null,Ee=Array.isArray(P)?P[1]:typeof P=="string"?P:null,Pe=Array.isArray(L)?L[0]:null,$e=Array.isArray(L)?L[1]:typeof L=="number"?L:null,Se=Array.isArray(A)?A[0]:null,Ve=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function Oe(o){let l=o*100;switch(H){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let q=H?[]:Array.from(e.querySelectorAll(a)),N=[],de=[],ge=0,c=0,g=I,De=0,k=false,V=false,x=0,z=false,xe=-1,Me=[],Je=-1,se=false,ke=0,Fe=0,ze,ut=null;function Tt(){ut?.destroy(),ut=null;}let _e=new Set,xt=NaN,We=true,et=-1,Mt=performance.now(),Be=NaN;function Qe(){return W?M==="x"?W.scrollLeft:W.scrollTop:M==="x"?window.scrollX:window.scrollY}function Lt(){return W?M==="x"?W.clientWidth:W.clientHeight:M==="x"?window.innerWidth:window.innerHeight}function At(){let o=ot(e,W,M);return Te(o,o.scroll,Lt(),$,O)}function an(){let o=c-ge,l=q.length-1,y=W??document.documentElement,j=M==="x"?"Width":"Height";if(g=I,I>0&&l>0&&o>0){let be=y[`scroll${j}`]-y[`client${j}`]-1-ge-o/m;be>=0&&(g=Math.min(I,be/(l*o)));}De=c+l*g*o;}function Ct(){(({tStart:ge,tEnd:c}=At())),an(),re&&Xe&&(Tt(),ut=xn(ge,c,M));}function mt(o,l=At){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let y=o.destroy;return o.destroy=()=>{y.call(o),Ae(e);},o}function Pt(o,l){return Z&&!ye?Math.max(xe,J(Me[o]=Math.max(Me[o]??0,l))):J(l)}function ln(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),H){let y=l==="reverse"?1-o:o;e.style.clipPath=Oe(y);return}q.forEach((y,j)=>ft(y,j,o,l));}function ft(o,l,y,j){o.style.strokeDashoffset=j==="reverse"?`${N[l]*y}`:`${N[l]*(1-y)}`,f&&(o.style.opacity=j==="reverse"?`${1-y}`:`${y}`),ve&&Ee?o.style.stroke=st(ve,Ee,y):Ee&&(o.style.stroke=Ee),Pe!==null&&$e!==null?o.style.strokeWidth=`${Pe+($e-Pe)*y}`:$e!==null&&(o.style.strokeWidth=`${$e}`),Se!==null&&Ve!==null?o.style.fillOpacity=`${Se+(Ve-Se)*y}`:Ve!==null&&(o.style.fillOpacity=`${Ve}`),R&&o.tagName.toLowerCase()==="path"&&de[l]&&o.setAttribute("d",Ln(de[l],R,y));}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),H){e.style.clipPath=Oe(E==="reverse"?1:0);return}q.forEach((o,l)=>{o.style.strokeDasharray=`${N[l]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${N[l]}`,f?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Pe!==null&&(o.style.strokeWidth=`${Pe}`),Se!==null&&(o.style.fillOpacity=`${Se}`),R&&o.tagName.toLowerCase()==="path"&&de[l]&&o.setAttribute("d",de[l]);});}if(q.forEach(o=>{Tn(o);let l=je(o);N.push(l);let y=o.tagName.toLowerCase()==="path";y?de.push(o.getAttribute("d")??""):de.push(""),R&&(y?Mn(de[de.length-1],R,o):pe(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=E==="reverse"?`${l}`:"0",f&&(o.style.opacity="1"),Ee&&(o.style.stroke=Ee),$e!==null&&(o.style.strokeWidth=`${$e}`),Ve!==null&&(o.style.fillOpacity=`${Ve}`),R&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",R)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=E==="reverse"?"0":`${l}`,f?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Pe!==null&&(o.style.strokeWidth=`${Pe}`),Se!==null&&(o.style.fillOpacity=`${Se}`));}),t)return H&&(e.style.clipPath=Oe(1)),u?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};H&&(e.style.clipPath=Oe(E==="reverse"?1:0));let $t=typeof d=="string"?it(d):null;function cn(){return !(te===false||ce||re||!Sn()||!q.length||!$t||H||M!=="y"||W||m!==1||I!==0||Z||ye||h!==false||R||b||_||C>0||G||p||u||T||ue||me||Ce||P!=null||L!=null||A!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function un(){let o=++En,l=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,j=`--svg-scroll-draw-${o}`,be=E==="reverse"?"0":"var(--ssd-len)",He=E==="reverse"?"var(--ssd-len)":"0",we=`stroke-dashoffset:${be};`,B=`stroke-dashoffset:${He};`;f&&(we+=`opacity:${E==="reverse"?1:0};`,B+=`opacity:${E==="reverse"?0:1};`);let Q=document.createElement("style");Q.setAttribute("data-svg-scroll-draw",""),Q.textContent=`@keyframes ${l}{from{${we}}to{${B}}}.${y}{view-timeline-name:${j};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${$t};animation-fill-mode:both;animation-timeline:${j};animation-range:cover 0% cover 100%;}`,document.head.appendChild(Q),e.classList.add(y);function ie(S,D){S.style.setProperty("--ssd-len",String(N[D])),S.style.strokeDasharray=`${N[D]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(l);}q.forEach(ie);let ae=false,U=-1;function K(){if(U>=0)return U;let S=e.getBoundingClientRect(),{tStart:D,tEnd:le}=Te({top:S.top,height:S.height},Qe(),Lt(),$,O);return J(ee(Qe(),D,le,m))}return {destroy(){e.classList.remove(y),q.forEach(S=>{S.classList.remove(l),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),Q.remove();},replay(){ae=false,U=-1,q.forEach(ie);},pause(){ae=true,q.forEach(S=>{S.style.animationPlayState="paused";});},resume(){ae&&(ae=false,q.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let D=Math.min(1,Math.max(0,S));U=D,ae=true,q.forEach((le,Ne)=>{le.classList.remove(l),le.style.strokeDashoffset=E==="reverse"?`${N[Ne]*D}`:`${N[Ne]*(1-D)}`,f&&(le.style.opacity=E==="reverse"?`${1-D}`:`${D}`);});},getProgress(){return K()},refresh(){q.forEach((S,D)=>{N[D]=je(S),S.style.setProperty("--ssd-len",String(N[D])),S.style.strokeDasharray=`${N[D]}`;});}}}if(cn())return mt(un());function mn(){let o=Math.max(1,he),l=H?o:o*(1+Math.max(0,q.length-1)*I),y=0,j=0,be=false;function He(U){let K=true,S=Math.min(1,Math.max(0,U/l));if(H){let D=Math.min(1,Math.max(0,U/o)),le=J(D);ke=le,e.style.setProperty("--scroll-draw-progress",String(le)),e.style.clipPath=Oe(E==="reverse"?1-le:le),G?.(le),D<1&&(K=false);}else {q.forEach((le,Ne)=>{let pn=Ne*I*o,It=Math.min(1,Math.max(0,(U-pn)/o));ft(le,Ne,J(It),E),It<1&&(K=false);});let D=J(S);ke=D,G?.(D),e.style.setProperty("--scroll-draw-progress",String(D));}if(b){let D=J(S);for(let le in b){let Ne=parseFloat(le);D>=Ne&&!_e.has(Ne)&&(_e.add(Ne),b[le]?.());}}return K}function we(U){if(se)return;let K=U-y;V||(V=true,p?.());let S=He(K);if(S&&!k){k=true,He(l),u?.(),Fe<(_==="infinite"?1/0:_??0)&&(Fe++,ze=setTimeout(()=>{y=performance.now(),V=false,k=false,_e.clear(),Ue(),x=requestAnimationFrame(we);},X));return}S||(x=requestAnimationFrame(we));}function B(){cancelAnimationFrame(x),clearTimeout(ze),y=performance.now(),j=0,se=false,V=false,k=false,Fe=0,be=true,ke=0,_e.clear(),Ue(),x=requestAnimationFrame(we);}let Q=new IntersectionObserver(U=>{U.forEach(K=>{K.isIntersecting&&!(Z&&k)?B():!K.isIntersecting&&!Z&&!k&&(cancelAnimationFrame(x),clearTimeout(ze),be=false);});},{root:W??null,threshold:w,rootMargin:Y}),ie;function ae(){clearTimeout(ie),ie=setTimeout(()=>{q.forEach((U,K)=>{N[K]=je(U),U.style.strokeDasharray=`${N[K]}`;});},150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),C>0?setTimeout(()=>Q.observe(e),C):Q.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(ze),Q.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ie);},replay(){Fe=0,B();},pause(){se||!be||(se=true,j=performance.now()-y,cancelAnimationFrame(x));},resume(){se&&(se=false,be=true,y=performance.now()-j,x=requestAnimationFrame(we));},seek(U){let K=Math.min(1,Math.max(0,U));ke=K,se=true,j=K*l,y=performance.now()-j,cancelAnimationFrame(x),He(j);},getProgress(){return ke},refresh(){clearTimeout(ie),q.forEach((U,K)=>{N[K]=je(U),U.style.strokeDasharray=`${N[K]}`;});}}}if(ce)return mt(mn());Ct();function Ot(){if(se||!Ge)return;let o=performance.now(),l=Qe();if(!We&&h===false&&l===xt){dt(l);return}We=false,xt=l;let y=m;if(h!==false){let B=o-Mt,Q=B>0?Math.abs(l-(et<0?l:et))/B:0;y=m*Math.max(.2,1+Q*(typeof h=="number"?h:1)*.04);}et=l,Mt=o;let j=ye?Je===-1||l>=Je?"forward":"reverse":E;Je=l;let be=c-ge,He=true,we=be===0?0:(l-ge)/be;if(isNaN(Be)||(Be<=0&&we>0?T?.():Be>0&&we<=0&&Ce?.(),Be<1&&we>=1?ue?.():Be>=1&&we<1&&me?.()),Be=we,H){let B=Pt(0,ee(l,ge,c,y));ke=B,e.style.setProperty("--scroll-draw-progress",String(B));let Q=j==="reverse"?1-B:B;e.style.clipPath=Oe(Q),G?.(B),!V&&ee(l,ge,c,y)>0&&(V=true,p?.()),B>=1&&!k?(k=true,u?.(),Fe<(_==="infinite"?1/0:_??0)&&(Fe++,ze=setTimeout(()=>{xe=-1,Me=[],V=false,k=false,Ue();},X))):B<1&&!Z&&(k=false),dt(l);return}if(q.forEach((B,Q)=>{let ie=Q*g*be,ae=Pt(Q,ee(l,ge+ie,c+ie,y));ft(B,Q,ae,j),Q===0&&(ke=ae,G?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),ae<1&&(He=false);}),b){let B=J(ee(l,ge,c,y));for(let Q in b){let ie=parseFloat(Q);B>=ie&&!_e.has(ie)&&(_e.add(ie),b[Q]?.());}}!V&&ee(l,ge,c,y)>0&&(V=true,p?.()),He&&!k?(k=true,u?.(),Fe<(_==="infinite"?1/0:_??0)&&(Fe++,ze=setTimeout(()=>{xe=-1,Me=[],V=false,k=false,_e.clear(),Ue(),We=true;},X))):!He&&!Z&&(k=false),dt(l);}function pt(o){return o>=c&&o<De}function dt(o){z||pt(o)?x=requestAnimationFrame(Ot):Ge=false;}function gt(){return z||pt(Qe())}let Ge=false;function tt(){Ge||(Ge=true,x=requestAnimationFrame(function(){Ot();}));}function nt(){Ge=false,cancelAnimationFrame(x);}let yt=new IntersectionObserver(o=>{o.forEach(l=>{z=l.isIntersecting,z&&!se?(We=true,tt()):Ge&&!se&&pt(Qe())||nt();});},{root:W??null,threshold:w,rootMargin:Y});function kt(){q.forEach((o,l)=>{N[l]=je(o),o.style.strokeDasharray=`${N[l]}`;}),Ct(),We=true;}let rt;function Ye(){clearTimeout(rt),rt=setTimeout(kt,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let fn=Ie([e],Ye);return C>0?setTimeout(()=>yt.observe(e),C):yt.observe(e),mt({destroy(){cancelAnimationFrame(x),clearTimeout(ze),nt(),yt.disconnect(),fn(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(rt),Tt();},replay(){xe=-1,Me=[],Je=-1,et=-1,V=false,k=false,Fe=0,se=false,ke=0,_e.clear(),clearTimeout(ze),Ue(),We=true,gt()&&tt();},pause(){se=true,nt();},resume(){se&&(se=false,We=true,gt()&&tt());},seek(o){let l=Math.min(1,Math.max(0,o));ke=l,xe=l,Me=[],se=true,nt(),ln(l,E),We=true;},getProgress(){return ke},refresh(){clearTimeout(rt),kt(),gt()&&!se&&tt();}},()=>({tStart:ge,tEnd:c}))}var Qt=new WeakMap,Cn=0;function Ut(e){return JSON.stringify(e,(r,t)=>{if(typeof t=="function")return "\u0192";if(typeof Element<"u"&&t instanceof Element){let n=Qt.get(t);return n===void 0&&Qt.set(t,n=++Cn),`el#${n}`}return t})}function Yt(e,r){let t={...e};for(let n of Object.keys(t))typeof t[n]=="function"&&(t[n]=(...s)=>r()[n]?.(...s));return t}function Pn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function $n(e,r,t){let n=Xt(e),s=Xt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,a)=>{let m=s[a];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,d)=>`${f}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(m.nums[d]-f)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function Kt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Pn(n))return st(n,s,t);if(n.includes("("))return $n(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let m=parseFloat(i[1]),f=parseFloat(a[1]);return `${m+(f-m)*t}${i[2]||a[2]}`}return t<1?n:s}function On(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var kn=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),In=0,Zt="--scroll-draw-progress";function Rn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var en={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function bt(e,r){return typeof window>"u"?en:r.respectReducedMotion===false?Jt(e,r,false):qe(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:m=false,axis:f="y",scrollContainer:d,native:v=true,velocityScale:I=false,triggerElement:E,onProgress:Z,onComplete:re,onEnter:M,onLeave:oe,onEnterBack:ye,onLeaveBack:C}=r,P=typeof i=="function"?i:ne[i]??ne["ease-out"],L=fe(s.start||"top bottom"),A=fe(s.end||"bottom top"),b=E??e,h=typeof d=="string"?document.querySelector(d):d??null,w=Object.entries(n).map(([c,g])=>({prop:On(c),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function Y(){let c=window.getComputedStyle(e);for(let g of w)g.from===""&&(g.from=c.getPropertyValue(g.prop).trim()||"0");}function _(){for(let c of w)e.style.setProperty(c.prop,String(c.to));}let X=new Map;for(let c of [...w.map(g=>g.prop),Zt])X.set(c,e.style.getPropertyValue(c));function R(){for(let[c,g]of X)g?e.style.setProperty(c,g):e.style.removeProperty(c);}if(t)return _(),re?.(),{...en,destroy:R,getProgress:()=>1};Y();let F=()=>h?f==="x"?h.scrollLeft:h.scrollTop:f==="x"?window.scrollX:window.scrollY,ce=()=>h?f==="x"?h.clientWidth:h.clientHeight:f==="x"?window.innerWidth:window.innerHeight,he=typeof i=="string"?it(i):null;function te(){if(!v||!Rn()||!he||f!=="y"||h||b!==e||m||a!==1||Z||re||M||oe||ye||C||I!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of w)if(!kn.has(c.prop))return false;return true}function G(){let c=`ssd-a-${++In}`,g=w.map(z=>`${z.prop}:${z.from}`).join(";"),De=w.map(z=>`${z.prop}:${z.to}`).join(";"),k=document.createElement("style");k.setAttribute("data-ssd-animate",""),k.textContent=`@keyframes ${c}{from{${g}}to{${De}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${he};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(k),e.classList.add(c);let V=()=>{let z=e.getBoundingClientRect();return Te({top:z.top,height:z.height},F(),ce(),L,A)};Le(e,{type:"animate",getProgress:()=>x.getProgress(),getTrigger:V});let x={refresh(){},destroy(){e.classList.remove(c),k.remove(),e.style.animationPlayState="",R(),Ae(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(z){let xe=Math.min(1,Math.max(0,z));e.classList.remove(c);for(let Me of w)e.style.setProperty(Me.prop,Kt(Me.from,Me.to,xe));},getProgress(){let{tStart:z,tEnd:xe}=V();return P(ee(F(),z,xe,a))}};return x}if(te())return G();let p=0,u=0,T=0,ue=false,me=false,Ce=-1,H=0,J=0,$=false,O=NaN,W=-1,ve=0,Ee=b===e?w:[],Pe=false;function $e(){let c=e.style,g=Ee.map(x=>c.getPropertyValue(x.prop)),De=c.transition;Ee.length&&(c.transition="none"),Ee.forEach(x=>c.setProperty(x.prop,X.get(x.prop)??""));let k=ot(b,h,f);Ee.forEach((x,z)=>c.setProperty(x.prop,g[z])),Ee.length&&(e.offsetWidth,c.transition=De);let V=Te(k,k.scroll,ce(),L,A);Pe&&Math.abs(V.tStart-p)<1&&Math.abs(V.tEnd-u)<1||(Pe=true,p=V.tStart,u=V.tEnd);}function Se(c){e.style.setProperty(Zt,String(c));for(let g of w)e.style.setProperty(g.prop,Kt(g.from,g.to,c));Z?.(c);}function Ve(c){if(isNaN(O)){O=c;return}O<=0&&c>0?M?.():O>0&&c<=0&&C?.(),O<1&&c>=1?oe?.():O>=1&&c<1&&ye?.(),O=c;}function Oe(){if(!ue||me)return;let c=performance.now(),g=F(),De=a;if(I!==false){let z=c-ve,xe=z>0?Math.abs(g-(W<0?g:W))/z:0;De=a*Math.max(.2,1+xe*(typeof I=="number"?I:1)*.04);}W=g,ve=c;let k=u===p?0:(g-p)/(u-p);Ve(k);let V=ee(g,p,u,De),x=m?Math.max(Ce,P(H=Math.max(H,V))):P(V);J=x,Se(x),x>=1&&!$?($=true,re?.()):x<1&&!m&&($=false),T=requestAnimationFrame(Oe);}$e(),u===p&&pe("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),H=ee(F(),p,u,a),J=P(H),Se(J);let q=new IntersectionObserver(c=>{c.forEach(g=>{ue=g.isIntersecting,ue&&!me?T=requestAnimationFrame(Oe):cancelAnimationFrame(T);});},{root:h??null}),N;function de(){clearTimeout(N),N=setTimeout($e,150);}window.addEventListener("resize",de),window.addEventListener("orientationchange",de);let ge=Ie([b],de);return q.observe(e),Le(e,{type:"animate",getProgress:()=>J,getTrigger:()=>({tStart:p,tEnd:u})}),{destroy(){cancelAnimationFrame(T),q.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),ge(),clearTimeout(N),R(),Ae(e);},replay(){Ce=-1,H=0,$=false,J=0,me=false,Se(0);},pause(){me=true,cancelAnimationFrame(T);},resume(){me&&(me=false,ue&&(T=requestAnimationFrame(Oe)));},seek(c){let g=Math.min(1,Math.max(0,c));J=g,Ce=g,H=0,me=true,cancelAnimationFrame(T),Se(g);},getProgress(){return J},refresh(){$e();}}}var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vt(e,r){if(typeof window>"u")return wt;let t=typeof e=="string"?document.querySelector(e):e;return t?qe(r,(n,s)=>Dn(t,n,s)):(pe("scrollCounter: element not found:",e),wt)}function Dn(e,r,t){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:m={},once:f=true,decimals:d,onComplete:v}=r,I=d!==void 0?p=>p.toFixed(d):i??(p=>String(Math.round(p))),E=typeof a=="function"?a:ne[a]??ne["ease-out"],Z=fe(m.start||"top 80%"),re=fe(m.end||"top 20%");if(t)return e.textContent=I(s),v?.(),{...wt,getProgress:()=>1};let M=0,oe=0,ye=false,C=0,P=false,L=false,A=-1,b=0,h=0,w=false,Y=()=>window.scrollY,_=()=>window.innerHeight;function X(){let p=e.getBoundingClientRect(),u=Te({top:p.top,height:p.height},Y(),_(),Z,re);ye&&Math.abs(u.tStart-M)<1&&Math.abs(u.tEnd-oe)<1||(ye=true,M=u.tStart,oe=u.tEnd);}function R(p){e.textContent=I(n+(s-n)*p),e.style.setProperty("--scroll-draw-progress",String(p));}function F(){if(!P||L)return;let p=ee(Y(),M,oe,1),u=f?Math.max(A,E(b=Math.max(b,p))):E(p);h=u,R(u),u>=1&&!w?(w=true,v?.()):u<1&&!f&&(w=false),C=requestAnimationFrame(F);}X();{b=ee(Y(),M,oe,1);let p=E(b);h=p,R(p);}let ce=new IntersectionObserver(p=>{p.forEach(u=>{P=u.isIntersecting,P&&!L?C=requestAnimationFrame(F):cancelAnimationFrame(C);});}),he;function te(){clearTimeout(he),he=setTimeout(X,150);}window.addEventListener("resize",te),window.addEventListener("orientationchange",te);let G=Ie([e],te);return ce.observe(e),Le(e,{type:"counter",getProgress:()=>h,getTrigger:()=>({tStart:M,tEnd:oe})}),{destroy(){cancelAnimationFrame(C),ce.disconnect(),window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),G(),clearTimeout(he),Ae(e);},replay(){A=-1,b=0,w=false,h=0,L=false,R(0);},pause(){L=true,cancelAnimationFrame(C);},resume(){L&&(L=false,P&&(C=requestAnimationFrame(F)));},seek(p){let u=Math.min(1,Math.max(0,p));h=u,A=u,b=0,L=true,cancelAnimationFrame(C),R(u);},getProgress(){return h}}}var tn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,r={}){if(typeof window>"u")return tn;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="video")return pe("scrollVideo: <video> element not found:",e),tn;let n=t,{trigger:s={},easing:i="linear",once:a=false,axis:m="y",preload:f="auto",triggerElement:d,onReady:v,onComplete:I,onProgress:E}=r,Z=d??n,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof i=="function"?i:ne[i]??ne.linear,oe=fe(s.start||"top top"),ye=fe(s.end||"bottom top");n.pause(),n.hasAttribute("preload")||(n.preload=f);let C=r.from??0,P=r.to,L=0,A=0,b=0,h=false,w=false,Y=-1,_=0,X=0,R=false,F=false,ce=()=>m==="x"?window.scrollX:window.scrollY,he=()=>m==="x"?window.innerWidth:window.innerHeight;function te(){let $=Z.getBoundingClientRect(),O=m==="x"?$.left:$.top,W=m==="x"?$.width:$.height,ve=Te({top:O,height:W},ce(),he(),oe,ye);L=ve.tStart,A=ve.tEnd,F&&A===L&&pe("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",n);}let G=NaN;function p($){if(!F)return;let O=P??n.duration??0,W=C+(O-C)*$;W!==G&&(G=W,n.currentTime=W),n.style.setProperty("--scroll-draw-progress",String($)),E?.($);}function u(){if(!h||w||!F||re)return;let $=ee(ce(),L,A,1),O=a?Math.max(Y,M(_=Math.max(_,$))):M($);X=O,p(O),O>=1&&!R?(R=true,I?.()):O<1&&!a&&(R=false),b=requestAnimationFrame(u);}function T(){if(F=true,P===void 0&&(P=n.duration),re){p(1),v?.();return}te(),v?.(),h&&!w&&(b=requestAnimationFrame(u));}n.readyState>=1?T():n.addEventListener("loadedmetadata",T,{once:true}),F||te();let ue=re?()=>{}:ct($=>{$&&(ue(),re=true,cancelAnimationFrame(b),p(1));}),me=new IntersectionObserver($=>{$.forEach(O=>{h=O.isIntersecting,h&&!w&&F?b=requestAnimationFrame(u):cancelAnimationFrame(b);});}),Ce;function H(){clearTimeout(Ce),Ce=setTimeout(te,150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let J=Ie([Z],H);return me.observe(n),Le(n,{type:"video",getProgress:()=>X,getTrigger:()=>({tStart:L,tEnd:A})}),{destroy(){cancelAnimationFrame(b),me.disconnect(),n.removeEventListener("loadedmetadata",T),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),J(),ue(),clearTimeout(Ce),Ae(n);},replay(){Y=-1,_=0,R=false,X=0,w=false,G=NaN,p(0);},pause(){w=true,cancelAnimationFrame(b);},resume(){w&&(w=false,h&&F&&(b=requestAnimationFrame(u)));},seek($){let O=Math.min(1,Math.max(0,$));X=O,Y=O,_=0,w=true,cancelAnimationFrame(b),G=NaN,p(O);},getProgress(){return X}}}function nn(e,r){let t=document.createElement("span");t.textContent=r,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 sn(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(n.textContent=t,n.style.whiteSpace="pre"):(n.textContent=t,n.style.display="inline-block"),e.appendChild(n),/^\s+$/.test(t)?null:n}).filter(t=>t!==null)}function Fn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(t=>{let n=document.createElement("span");return n.setAttribute("aria-hidden","true"),n.textContent=t,t===" "?n.style.whiteSpace="pre":n.style.display="inline-block",e.appendChild(n),t===" "?null:n}).filter(t=>t!==null)}function rn(e){let r=sn(e),t=new Map;for(let i of r){let a=i.offsetTop;t.has(a)||t.set(a,[]),t.get(a).push(i);}let n=[],s=Array.from(t.keys()).sort((i,a)=>i-a);for(let i of s){let a=t.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",a.forEach((f,d)=>{let v=f.nextElementSibling;m.appendChild(f),d<a.length-1&&v&&v.style.whiteSpace==="pre"&&m.appendChild(v);}),n.push(m);}return e.textContent="",n.forEach((i,a)=>{e.appendChild(i),a<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function Hn(e,r,t,n){if(t<=1||n===0)return e;let s=(t-1)*n,i=r*n,a=i+(1-s);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Nn(e,r){let t=[];if(r?.y!==void 0&&t.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&t.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&t.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let n=r.scale+(1-r.scale)*e;t.push(`scale(${n})`);}return t.join(" ")||""}var on={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,r={}){if(typeof window>"u")return on;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return pe("scrollText: element not found:",e),on;let n=t;return qe(r,(s,i)=>Vn(n,s,i))}function Vn(e,r,t){let{split:n="words",stagger:s=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:f=true,onComplete:d}=r,v=typeof i=="function"?i:ne[i]??ne["ease-out"],I=fe(m.start||"top 85%"),E=fe(m.end||"top 40%"),Z=e.innerHTML,re=e.textContent??"",M;n==="chars"?M=Fn(e):n==="lines"?M=rn(e):M=sn(e),nn(e,re);let oe=M.length;function ye(u,T){a?.opacity!==void 0&&(u.style.opacity=String(a.opacity+(1-a.opacity)*T));let ue=Nn(T,a);ue&&(u.style.transform=ue);}function C(u){e.style.setProperty("--scroll-draw-progress",String(u)),M.forEach((T,ue)=>{let me=v(Hn(u,ue,oe,s));ye(T,me);});}if(t)return C(1),d?.(),{destroy(){e.innerHTML=Z;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};C(0);let P=0,L=0,A=0,b=false,h=false,w=-1,Y=0,_=false,X=()=>window.scrollY,R=()=>window.innerHeight;function F(){let u=e.getBoundingClientRect(),T=Te({top:u.top,height:u.height},X(),R(),I,E);P=T.tStart,L=T.tEnd;}function ce(){if(!b||h)return;let u=ee(X(),P,L,1);f&&(w=Math.max(w,u),u=w),Y=u,C(u),u>=1&&!_?(_=true,d?.()):u<1&&!f&&(_=false),A=requestAnimationFrame(ce);}F();let he=new IntersectionObserver(u=>{u.forEach(T=>{b=T.isIntersecting,b&&!h?A=requestAnimationFrame(ce):cancelAnimationFrame(A);});}),te;function G(){clearTimeout(te),te=setTimeout(()=>{if(n==="lines"){let u=Y;e.innerHTML=Z,M=rn(e),nn(e,re),C(u);}F();},150);}window.addEventListener("resize",G),window.addEventListener("orientationchange",G);let p=Ie([e],G);return he.observe(e),Le(e,{type:"text",getProgress:()=>Y,getTrigger:()=>({tStart:P,tEnd:L})}),{destroy(){cancelAnimationFrame(A),he.disconnect(),window.removeEventListener("resize",G),window.removeEventListener("orientationchange",G),p(),clearTimeout(te),e.innerHTML=Z,Ae(e);},replay(){w=-1,_=false,Y=0,h=false,C(0);},pause(){h=true,cancelAnimationFrame(A);},resume(){h&&(h=false,b&&(A=requestAnimationFrame(ce)));},seek(u){let T=Math.min(1,Math.max(0,u));Y=T,w=T,h=true,cancelAnimationFrame(A),C(T);},getProgress(){return Y}}}function Re(e,r){let t,n,s,i;return solidJs.createEffect(()=>{i=typeof e=="function"?e():e;let a=Ut(i);!t||a===s||(s=a,solidJs.untrack(()=>{n?.destroy(),n=r(t,Yt(i,()=>i));}));}),solidJs.onCleanup(()=>{n?.destroy(),n=s=void 0;}),{ref:a=>{t=a;},getInstance:()=>n}}function no(e={}){return Re(e,ht).ref}function ro(e={}){return Re(e,ht)}function oo(e){return Re(e,bt).ref}function so(e){return Re(e,bt)}function io(e){return Re(e,vt).ref}function ao(e){return Re(e,vt)}function lo(e={}){return Re(e,Et).ref}function co(e={}){return Re(e,Et)}function uo(e={}){return Re(e,St).ref}function mo(e={}){return Re(e,St)}exports.createScrollAnimate=so;exports.createScrollCounter=ao;exports.createScrollDraw=ro;exports.createScrollText=mo;exports.createScrollVideo=co;exports.useScrollAnimate=oo;exports.useScrollCounter=io;exports.useScrollDraw=no;exports.useScrollText=uo;exports.useScrollVideo=lo;
|
package/dist/solid/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a,b}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-GMBIGV3M.mjs';import {a as a$4}from'../chunk-4H2SGMAQ.mjs';import {a as a$2}from'../chunk-LGJQWZHH.mjs';import {a as a$1}from'../chunk-V4L3ELVC.mjs';import {b as b$1}from'../chunk-23EALNDF.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.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';import {createEffect,onCleanup,untrack}from'solid-js';function o(e,f){let l,t,c,r;return createEffect(()=>{r=typeof e=="function"?e():e;let n=a(r);!l||n===c||(c=n,untrack(()=>{t?.destroy(),t=f(l,b(r,()=>r));}));}),onCleanup(()=>{t?.destroy(),t=c=void 0;}),{ref:n=>{l=n;},getInstance:()=>t}}function D(e={}){return o(e,b$1).ref}function V(e={}){return o(e,b$1)}function C(e){return o(e,a$1).ref}function H(e){return o(e,a$1)}function L(e){return o(e,a$2).ref}function g(e){return o(e,a$2)}function I(e={}){return o(e,a$3).ref}function k(e={}){return o(e,a$3)}function v(e={}){return o(e,a$4).ref}function j(e={}){return o(e,a$4)}export{H as createScrollAnimate,g as createScrollCounter,V as createScrollDraw,j as createScrollText,k as createScrollVideo,C as useScrollAnimate,L as useScrollCounter,D as useScrollDraw,v as useScrollText,I as useScrollVideo};
|