svg-scroll-draw 2.15.1 → 2.15.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 +1 -1
- package/dist/angular/index.cjs +2 -2
- package/dist/angular/index.d.mts +4 -2
- package/dist/angular/index.d.ts +4 -2
- package/dist/angular/index.mjs +2 -2
- package/dist/aos/react/index.d.mts +44 -0
- package/dist/aos/react/index.d.ts +44 -0
- package/dist/astro/index.d.mts +4 -2
- package/dist/astro/index.d.ts +4 -2
- package/dist/group/index.d.mts +4 -2
- package/dist/group/index.d.ts +4 -2
- package/dist/horizontal/index.d.mts +108 -0
- package/dist/horizontal/index.d.ts +108 -0
- package/dist/index.d.mts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/lenis/index.d.mts +51 -0
- package/dist/lenis/index.d.ts +51 -0
- package/dist/nuxt/index.cjs +2 -2
- package/dist/nuxt/index.d.mts +4 -2
- package/dist/nuxt/index.d.ts +4 -2
- package/dist/nuxt/index.mjs +2 -2
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +4 -2
- package/dist/react/index.d.ts +4 -2
- package/dist/react/index.mjs +2 -2
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +9 -3
- package/dist/reveal/index.d.ts +9 -3
- package/dist/reveal/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.d.mts +4 -2
- package/dist/solid/index.d.ts +4 -2
- package/dist/solid/index.mjs +2 -2
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.d.mts +4 -2
- package/dist/svelte/index.d.ts +4 -2
- package/dist/svelte/index.mjs +2 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vivus/react/index.d.mts +116 -0
- package/dist/vivus/react/index.d.ts +116 -0
- package/dist/vue/index.cjs +2 -2
- package/dist/vue/index.d.mts +4 -2
- package/dist/vue/index.d.ts +4 -2
- package/dist/vue/index.mjs +2 -2
- package/package.json +1 -1
package/dist/react/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import gr,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function Gt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,a=[];for(let p=0;p<r;p++){let E=Math.pow(i,p);a.push(E),o+=E;}let u=[0],m=0;for(let p=0;p<r;p++)m+=a[p]/o,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let E=0;E<r;E++)if(p<=u[E+1]){let R=(p-u[E])/(u[E+1]-u[E]);if(E===0)return R*(2-R);let
|
|
1
|
+
import gr,{useState,useRef,useEffect}from'react';import {jsx}from'react/jsx-runtime';function Gt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(t),o=0,a=[];for(let p=0;p<r;p++){let E=Math.pow(i,p);a.push(E),o+=E;}let u=[0],m=0;for(let p=0;p<r;p++)m+=a[p]/o,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let E=0;E<r;E++)if(p<=u[E+1]){let R=(p-u[E])/(u[E+1]-u[E]);if(E===0)return R*(2-R);let M=1-Math.pow(t,E);return M+(1-M)*(2*R-1)*(2*R-1)}return 1}}function Ut({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),i=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return o=>o<=0?0:o>=1?1:r*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/t)+1}var Z={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:Gt(),elastic:Ut()};function se(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function ht(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function bt(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ve(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function jt(e,n,r){return Math.min(r,Math.max(n,e))}function J(e,n,r,t){return r===n?0:jt((e-n)/(r-n)*t,0,1)}function Ke(e,n,r){let t=e.getBoundingClientRect(),i=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:i,scroll:0}:{top:r==="x"?t.left:t.top,height:i,scroll:r==="x"?window.scrollX:window.scrollY}}function we(e,n,r,t,i){let o=ht(e.top,e.height,n,t.element)-bt(t.viewport,r),a=ht(e.top,e.height,n,i.element)-bt(i.viewport,r);return {tStart:o,tEnd:a}}function wt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function _e(e,n,r){let t=wt(e),i=wt(n);return !t||!i?e:`rgb(${Math.round(t[0]+(i[0]-t[0])*r)},${Math.round(t[1]+(i[1]-t[1])*r)},${Math.round(t[2]+(i[2]-t[2])*r)})`}var vt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function ve(e,...n){Be&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Xt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Yt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",St=33;function Qt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Zt(e){let n=[];for(let r=0;r<St;r++){let t=r/(St-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Xt;case "ease-out":return Yt;case "ease-in-out":return Qt()?Zt(Z["ease-in-out"]):null;default:return null}}var Et=Symbol.for("svg-scroll-draw.registry");function Tt(){let e=globalThis;return e[Et]||(e[Et]=new Map)}function Le(e,n){Tt().set(e,n);}function Ce(e){Tt().delete(e);}var Jt=0;function Kt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function xt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var At=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function er(e){if(!Be)return;let n=xt(e,"stroke");if(!n||n==="none"){ve("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!At.has(r)&&!At.has(xt(e,"fill"))&&ve("Element has a fill \u2014 it may obscure the stroke animation.",e);}function tr(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function i(){let o=r==="x"?window.scrollX:window.scrollY,a=e-o,u=n-o,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,n,r){if(!Be)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),i=(n.match(Pt)??[]).join("").toUpperCase(),o=(e.match(Mt)??[]).length,a=(n.match(Mt)??[]).length;if(t!==i){ve(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==a&&ve(`morphTo: coordinate count differs (${o} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let a=parseFloat(o),u=t[i++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function Lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...vt[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:E={},stagger:R=0,direction:P="forward",once:re=false,debug:Se=false,axis:H="y",scrollContainer:W,autoReverse:D=false,delay:z=0,strokeColor:M,strokeWidth:L,fillOpacity:x,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:w="0px",repeat:g=0,repeatDelay:j=0,morphTo:O,clip:B,autoplay:X=false,duration:ie=1e3,native:le=true,onProgress:d,onStart:$,onComplete:y,onEnter:I,onLeave:A,onEnterBack:V,onLeaveBack:pe}=i,ne=B===true?"left":typeof B=="string"?B:false,xe=typeof p=="function"?p:Z[p]??Z.linear,$e=se(E.start??"top bottom"),He=se(E.end??"bottom top"),Ee=typeof W=="string"?document.querySelector(W):W??null,Te=Array.isArray(M)?M[0]:null,ce=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ue=Array.isArray(L)?L[0]:null,K=Array.isArray(L)?L[1]:typeof L=="number"?L:null,de=Array.isArray(x)?x[0]:null,oe=Array.isArray(x)?x[1]:typeof x=="number"?x:null;function Re(s){let c=s*100;switch(ne){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let G=ne?[]:Array.from(e.querySelectorAll(a)),N=[],l=[],f=0,ge=0,_=false,U=false,Y=0,Me=false,ye=-1,ae=-1,ee=false,he=0,Ie=0,Ne,rt=null;function ct(){rt?.destroy(),rt=null;}let De=new Set,ut=NaN,Fe=true,je=-1,mt=performance.now(),ze=NaN;function nt(){return Ee?H==="x"?Ee.scrollLeft:Ee.scrollTop:H==="x"?window.scrollX:window.scrollY}function ft(){return Ee?H==="x"?Ee.clientWidth:Ee.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ke(e,Ee,H);return we(s,s.scroll,ft(),$e,He)}function dt(){(({tStart:f,tEnd:ge}=pt())),Se&&Be&&(ct(),rt=tr(f,ge,H));}function ot(s,c=pt){Le(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let S=s.destroy;return s.destroy=()=>{S.call(s),Ce(e);},s}function _t(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),ne){let S=c==="reverse"?1-s:s;e.style.clipPath=Re(S);return}G.forEach((S,me)=>{S.style.strokeDashoffset=c==="reverse"?`${N[me]*s}`:`${N[me]*(1-s)}`,m&&(S.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Te&&ce?S.style.stroke=_e(Te,ce,s):ce&&(S.style.stroke=ce),ue!==null&&K!==null?S.style.strokeWidth=`${ue+(K-ue)*s}`:K!==null&&(S.style.strokeWidth=`${K}`),de!==null&&oe!==null?S.style.fillOpacity=`${de+(oe-de)*s}`:oe!==null&&(S.style.fillOpacity=`${oe}`),O&&S.tagName.toLowerCase()==="path"&&l[me]&&S.setAttribute("d",at(l[me],O,s));});}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),ne){e.style.clipPath=Re(0);return}G.forEach((s,c)=>{s.style.strokeDasharray=`${N[c]}`,s.style.strokeDashoffset=P==="reverse"?"0":`${N[c]}`,m?s.style.opacity=P==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`),O&&s.tagName.toLowerCase()==="path"&&l[c]&&s.setAttribute("d",l[c]);});}if(G.forEach(s=>{er(s);let c=Ve(s);N.push(c);let S=s.tagName.toLowerCase()==="path";S?l.push(s.getAttribute("d")??""):l.push(""),O&&(S?rr(l[l.length-1],O,s):ve(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=P==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ce&&(s.style.stroke=ce),K!==null&&(s.style.strokeWidth=`${K}`),oe!==null&&(s.style.fillOpacity=`${oe}`),O&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",O)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=P==="reverse"?"0":`${c}`,m?s.style.opacity=P==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`));}),ne){if(o)return e.style.clipPath=Re(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Re(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof p=="string"?et(p):null;function qt(){return !(le===false||!Kt()||!G.length||!gt||ne||H!=="y"||Ee||u!==1||R!==0||re||D||C!==false||O||b||g||z>0||d||$||y||I||A||V||pe||M!=null||L!=null||x!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Wt(){let s=++Jt,c=`svg-scroll-draw-${s}`,S=`svg-scroll-draw-host-${s}`,me=`--svg-scroll-draw-${s}`,Oe=P==="reverse"?"0":"var(--ssd-len)",ke=P==="reverse"?"var(--ssd-len)":"0",Pe=`stroke-dashoffset:${Oe};`,T=`stroke-dashoffset:${ke};`;m&&(Pe+=`opacity:${P==="reverse"?1:0};`,T+=`opacity:${P==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Pe}}to{${T}}}.${S}{view-timeline-name:${me};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${me};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(S);function fe(h,te){h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}G.forEach(fe);let v=false,q=-1;function Q(){if(q>=0)return q;let h=e.getBoundingClientRect(),{tStart:te,tEnd:Ae}=we({top:h.top,height:h.height},nt(),ft(),$e,He);return xe(J(nt(),te,Ae,u))}return {destroy(){e.classList.remove(S),G.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),F.remove();},replay(){v=false,q=-1,G.forEach(fe);},pause(){v=true,G.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,G.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let te=Math.min(1,Math.max(0,h));q=te,v=true,G.forEach((Ae,be)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=P==="reverse"?`${N[be]*te}`:`${N[be]*(1-te)}`,m&&(Ae.style.opacity=P==="reverse"?`${1-te}`:`${te}`);});},getProgress(){return Q()},refresh(){G.forEach((h,te)=>{N[te]=Ve(h),h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`;});}}}if(qt())return ot(Wt());function Bt(){let s=Math.max(1,ie),c=0,S=0,me=false;function Oe(v){let q=true;if(ne){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);he=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Re(P==="reverse"?1-h:h),d?.(h),Q<1&&(q=false);}else G.forEach((Q,h)=>{let te=h*R*s,Ae=Math.min(1,Math.max(0,(v-te)/s)),be=xe(Ae);Q.style.strokeDashoffset=P==="reverse"?`${N[h]*be}`:`${N[h]*(1-be)}`,m&&(Q.style.opacity=P==="reverse"?`${1-be}`:`${be}`),Te&&ce?Q.style.stroke=_e(Te,ce,be):ce&&(Q.style.stroke=ce),ue!==null&&K!==null?Q.style.strokeWidth=`${ue+(K-ue)*be}`:K!==null&&(Q.style.strokeWidth=`${K}`),de!==null&&oe!==null?Q.style.fillOpacity=`${de+(oe-de)*be}`:oe!==null&&(Q.style.fillOpacity=`${oe}`),O&&Q.tagName.toLowerCase()==="path"&&l[h]&&Q.setAttribute("d",at(l[h],O,be)),h===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Ae<1&&(q=false);});if(b){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);for(let te in b){let Ae=parseFloat(te);h>=Ae&&!De.has(Ae)&&(De.add(Ae),b[te]?.());}}return q}function ke(v){if(ee)return;let q=v-c;U||(U=true,$?.());let Q=Oe(q);if(Q&&!_){_=true,Oe(s*(1+Math.max(0,G.length-1)*R)),y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{c=performance.now(),U=false,_=false,De.clear(),Xe(),Y=requestAnimationFrame(ke);},j));return}Q||(Y=requestAnimationFrame(ke));}function Pe(){cancelAnimationFrame(Y),clearTimeout(Ne),c=performance.now(),S=0,ee=false,U=false,_=false,Ie=0,me=true,he=0,De.clear(),Xe(),Y=requestAnimationFrame(ke);}let T=new IntersectionObserver(v=>{v.forEach(q=>{q.isIntersecting&&!(re&&_)?Pe():!q.isIntersecting&&!re&&!_&&(cancelAnimationFrame(Y),clearTimeout(Ne),me=false);});},{root:Ee??null,threshold:k,rootMargin:w}),F;function fe(){clearTimeout(F),F=setTimeout(()=>{G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});},150);}return window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),z>0?setTimeout(()=>T.observe(e),z):T.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),T.disconnect(),window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),clearTimeout(F);},replay(){Ie=0,Pe();},pause(){ee||!me||(ee=true,S=performance.now()-c,cancelAnimationFrame(Y));},resume(){ee&&(ee=false,me=true,c=performance.now()-S,Y=requestAnimationFrame(ke));},seek(v){let q=Math.min(1,Math.max(0,v));he=q,ee=true,S=q*s,c=performance.now()-S,cancelAnimationFrame(Y),Oe(S);},getProgress(){return he},refresh(){clearTimeout(F),G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});}}}if(X)return ot(Bt());dt();function Ye(){if(!Me||ee)return;let s=performance.now(),c=nt();if(!Fe&&C===false&&c===ut){Y=requestAnimationFrame(Ye);return}Fe=false,ut=c;let S=u;if(C!==false){let T=s-mt,F=T>0?Math.abs(c-(je<0?c:je))/T:0;S=u*Math.max(.2,1+F*(typeof C=="number"?C:1)*.04);}je=c,mt=s;let me=D?ae===-1||c>=ae?"forward":"reverse":P;ae=c;let Oe=ge-f,ke=true,Pe=Oe===0?0:(c-f)/Oe;if(isNaN(ze)||(ze<=0&&Pe>0?I?.():ze>0&&Pe<=0&&pe?.(),ze<1&&Pe>=1?A?.():ze>=1&&Pe<1&&V?.()),ze=Pe,ne){let T=xe(J(c,f,ge,S));re&&!D&&(ye=Math.max(ye,T),T=ye),he=T,e.style.setProperty("--scroll-draw-progress",String(T));let F=me==="reverse"?1-T:T;e.style.clipPath=Re(F),d?.(T),!U&&J(c,f,ge,S)>0&&(U=true,$?.()),T>=1&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,e.style.clipPath=Re(0);},j))):T<1&&!re&&(_=false),Y=requestAnimationFrame(Ye);return}if(G.forEach((T,F)=>{let fe=F*R*Oe,v=xe(J(c,f+fe,ge+fe,S));re&&!D&&(ye=Math.max(ye,v),v=ye),he=v,T.style.strokeDashoffset=me==="reverse"?`${N[F]*v}`:`${N[F]*(1-v)}`,m&&(T.style.opacity=me==="reverse"?`${1-v}`:`${v}`),Te&&ce?T.style.stroke=_e(Te,ce,v):ce&&(T.style.stroke=ce),ue!==null&&K!==null?T.style.strokeWidth=`${ue+(K-ue)*v}`:K!==null&&(T.style.strokeWidth=`${K}`),de!==null&&oe!==null?T.style.fillOpacity=`${de+(oe-de)*v}`:oe!==null&&(T.style.fillOpacity=`${oe}`),O&&T.tagName.toLowerCase()==="path"&&l[F]&&T.setAttribute("d",at(l[F],O,v)),F===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(ke=false);}),b){let T=xe(J(c,f,ge,S));for(let F in b){let fe=parseFloat(F);T>=fe&&!De.has(fe)&&(De.add(fe),b[F]?.());}}!U&&J(c,f,ge,S)>0&&(U=true,$?.()),ke&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,De.clear(),Xe(),Fe=true;},j))):!ke&&!re&&(_=false),Y=requestAnimationFrame(Ye);}let st=false;function Qe(){st||(st=true,Y=requestAnimationFrame(function(){Ye();}));}function Ze(){st=false,cancelAnimationFrame(Y);}let it=new IntersectionObserver(s=>{s.forEach(c=>{Me=c.isIntersecting,Me&&!ee?(Fe=true,Qe()):Ze();});},{root:Ee??null,threshold:k,rootMargin:w});function yt(){G.forEach((s,c)=>{N[c]=Ve(s),s.style.strokeDasharray=`${N[c]}`;}),dt(),Fe=true;}let Je;function qe(){clearTimeout(Je),Je=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),z>0?setTimeout(()=>it.observe(e),z):it.observe(e),ot({destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),Ze(),it.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Je),ct();},replay(){ye=-1,ae=-1,je=-1,U=false,_=false,Ie=0,ee=false,he=0,De.clear(),clearTimeout(Ne),Xe(),Fe=true,Me&&Qe();},pause(){ee=true,Ze();},resume(){ee&&(ee=false,Fe=true,Me&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));he=c,ye=c,ee=true,Ze(),_t(c,P),Fe=true;},getProgress(){return he},refresh(){clearTimeout(Je),yt(),Me&&!ee&&Qe();}},()=>({tStart:f,tEnd:ge}))}function nr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],a=t[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function or(e,n,r){let t=Ct(e),i=Ct(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,a)=>{let u=i[a];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function $t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(nr(t))return _e(t,i,r);if(t.includes("("))return or(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),a=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&a){let u=parseFloat(o[1]),m=parseFloat(a[1]);return `${u+(m-u)*r}${o[2]||a[2]}`}return r<1?t:i}function sr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ir=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ar=0,Rt="--scroll-draw-progress";function lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function kt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:p,native:E=true,velocityScale:R=false,respectReducedMotion:P=true,triggerElement:re,onProgress:Se,onComplete:H,onEnter:W,onLeave:D,onEnterBack:z,onLeaveBack:M}=n,L=P&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:Z[o]??Z["ease-out"],b=se(i.start??"top bottom"),C=se(i.end??"bottom top"),k=re??e,w=typeof p=="string"?document.querySelector(p):p??null,g=Object.entries(t).map(([l,f])=>({prop:sr(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function j(){let l=window.getComputedStyle(e);for(let f of g)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function O(){for(let l of g)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...g.map(f=>f.prop),Rt])B.set(l,e.style.getPropertyValue(l));function X(){for(let[l,f]of B)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(L)return O(),H?.(),{...r,destroy:X,getProgress:()=>1};j();let ie=typeof o=="string"?et(o):null;function le(){if(!E||!lr()||!ie||m!=="y"||w||k!==e||u||a!==1||Se||H||W||D||z||M||R!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let l of g)if(!ir.has(l.prop))return false;return true}function d(){let l=`ssd-a-${++ar}`,f=g.map(ae=>`${ae.prop}:${ae.from}`).join(";"),ge=g.map(ae=>`${ae.prop}:${ae.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${l}{from{${f}}to{${ge}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(l);let U=()=>m==="x"?window.scrollX:window.scrollY,Y=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let ae=e.getBoundingClientRect();return we({top:ae.top,height:ae.height},U(),Y(),b,C)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(l),_.remove(),e.style.animationPlayState="",X(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let ee=Math.min(1,Math.max(0,ae));e.classList.remove(l);for(let he of g)e.style.setProperty(he.prop,$t(he.from,he.to,ee));},getProgress(){let{tStart:ae,tEnd:ee}=Me();return x(J(U(),ae,ee,a))}};return ye}if(le())return d();let $=0,y=0,I=0,A=false,V=false,pe=-1,ne=0,xe=false,$e=NaN,He=-1,Ee=0,Te=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ce=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ue(){let l=Ke(k,w,m),f=we(l,l.scroll,ce(),b,C);$=f.tStart,y=f.tEnd;}function K(l){e.style.setProperty(Rt,String(l));for(let f of g)e.style.setProperty(f.prop,$t(f.from,f.to,l));Se?.(l);}function de(l){if(isNaN($e)){$e=l;return}$e<=0&&l>0?W?.():$e>0&&l<=0&&M?.(),$e<1&&l>=1?D?.():$e>=1&&l<1&&z?.(),$e=l;}function oe(){if(!A||V)return;let l=performance.now(),f=Te(),ge=a;if(R!==false){let Y=l-Ee,Me=Y>0?Math.abs(f-(He<0?f:He))/Y:0;ge=a*Math.max(.2,1+Me*(typeof R=="number"?R:1)*.04);}He=f,Ee=l;let _=y===$?0:(f-$)/(y-$);de(_);let U=x(J(f,$,y,ge));u&&(pe=Math.max(pe,U),U=pe),ne=U,K(U),U>=1&&!xe?(xe=true,H?.()):U<1&&!u&&(xe=false),I=requestAnimationFrame(oe);}ue(),y===$&&ve("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=x(J(Te(),$,y,a));u&&l>0&&(pe=l),ne=l,K(l);}let Re=new IntersectionObserver(l=>{l.forEach(f=>{A=f.isIntersecting,A&&!V?I=requestAnimationFrame(oe):cancelAnimationFrame(I);});},{root:w??null}),G;function N(){clearTimeout(G),G=setTimeout(ue,150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Re.observe(e),Le(e,{type:"animate",getProgress:()=>ne,getTrigger:()=>({tStart:$,tEnd:y})}),{destroy(){cancelAnimationFrame(I),Re.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(G),X(),Ce(e);},replay(){pe=-1,xe=false,ne=0,V=false,K(0);},pause(){V=true,cancelAnimationFrame(I);},resume(){V&&(V=false,A&&(I=requestAnimationFrame(oe)));},seek(l){let f=Math.min(1,Math.max(0,l));ne=f,pe=f,V=true,cancelAnimationFrame(I),K(f);},getProgress(){return ne}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollCounter: element not found:",e),lt;let t=r,{from:i=0,to:o,format:a,easing:u="ease-out",trigger:m={},once:p=true,decimals:E,onComplete:R}=n,P=E!==void 0?d=>d.toFixed(E):a??(d=>String(Math.round(d))),re=typeof u=="function"?u:Z[u]??Z["ease-out"],Se=se(m.start??"top 80%"),H=se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=P(o),R?.(),lt;let D=0,z=0,M=0,L=false,x=false,b=-1,C=0,k=false,w=()=>window.scrollY,g=()=>window.innerHeight;function j(){let d=t.getBoundingClientRect(),$=we({top:d.top,height:d.height},w(),g(),Se,H);D=$.tStart,z=$.tEnd;}function O(d){t.textContent=P(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function B(){if(!L||x)return;let d=re(J(w(),D,z,1));p&&(b=Math.max(b,d),d=b),C=d,O(d),d>=1&&!k?(k=true,R?.()):d<1&&!p&&(k=false),M=requestAnimationFrame(B);}j();{let d=re(J(w(),D,z,1));p&&d>0&&(b=d),C=d,O(d);}let X=new IntersectionObserver(d=>{d.forEach($=>{L=$.isIntersecting,L&&!x?M=requestAnimationFrame(B):cancelAnimationFrame(M);});}),ie;function le(){clearTimeout(ie),ie=setTimeout(j,150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),X.observe(t),Le(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:D,tEnd:z})}),{destroy(){cancelAnimationFrame(M),X.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(ie),Ce(t);},replay(){b=-1,k=false,C=0,x=false,O(0);},pause(){x=true,cancelAnimationFrame(M);},resume(){x&&(x=false,L&&(M=requestAnimationFrame(B)));},seek(d){let $=Math.min(1,Math.max(0,d));C=$,b=$,x=true,cancelAnimationFrame(M),O($);},getProgress(){return C}}}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ve("scrollVideo: <video> element not found:",e),Ot;let t=r,{trigger:i={},easing:o="linear",once:a=false,axis:u="y",preload:m="auto",onReady:p,onComplete:E,onProgress:R}=n,P=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:Z[o]??Z.linear,Se=se(i.start??"top top"),H=se(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,D=n.to,z=0,M=0,L=0,x=false,b=false,C=-1,k=0,w=false,g=false,j=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;function B(){let A=t.getBoundingClientRect(),V=u==="x"?A.left:A.top,pe=u==="x"?A.width:A.height,ne=we({top:V,height:pe},j(),O(),Se,H);z=ne.tStart,M=ne.tEnd;}let X=NaN;function ie(A){if(!g)return;let V=D??t.duration??0,pe=W+(V-W)*A;pe!==X&&(X=pe,t.currentTime=pe),t.style.setProperty("--scroll-draw-progress",String(A)),R?.(A);}function le(){if(!x||b||!g)return;let A=re(J(j(),z,M,1));a&&(C=Math.max(C,A),A=C),k=A,ie(A),A>=1&&!w?(w=true,E?.()):A<1&&!a&&(w=false),L=requestAnimationFrame(le);}function d(){if(g=true,D===void 0&&(D=t.duration),P){ie(1),p?.();return}B(),p?.(),x&&!b&&(L=requestAnimationFrame(le));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),g||B();let $=new IntersectionObserver(A=>{A.forEach(V=>{x=V.isIntersecting,x&&!b&&g?L=requestAnimationFrame(le):cancelAnimationFrame(L);});}),y;function I(){clearTimeout(y),y=setTimeout(B,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),$.observe(t),Le(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:z,tEnd:M})}),{destroy(){cancelAnimationFrame(L),$.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(y),Ce(t);},replay(){C=-1,w=false,k=0,b=false,X=NaN,ie(0);},pause(){b=true,cancelAnimationFrame(L);},resume(){b&&(b=false,x&&g&&(L=requestAnimationFrame(le)));},seek(A){let V=Math.min(1,Math.max(0,A));k=V,C=V,b=true,cancelAnimationFrame(L),X=NaN,ie(V);},getProgress(){return k}}}function Ht(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function cr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=Ht(e),r=new Map;for(let o of n){let a=o.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(o);}let t=[],i=Array.from(r.keys()).sort((o,a)=>o-a);for(let o of i){let a=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((m,p)=>{let E=m.nextElementSibling;u.appendChild(m),p<a.length-1&&E&&E.style.whiteSpace==="pre"&&u.appendChild(E);}),t.push(u);}return e.textContent="",t.forEach((o,a)=>{e.appendChild(o),a<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ur(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,a=o+(1-i);return a<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(a-o)))}function mr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,n={}){if(typeof window>"u")return Ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollText: element not found:",e),Ft;let t=r,{split:i="words",stagger:o=.04,easing:a="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:E}=n,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,P=typeof a=="function"?a:Z[a]??Z["ease-out"],re=se(m.start??"top 85%"),Se=se(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let W;i==="chars"?W=cr(t):i==="lines"?W=Dt(t):W=Ht(t);let D=W.length;function z(y,I){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*I));let A=mr(I,u);A&&(y.style.transform=A);}function M(y){t.style.setProperty("--scroll-draw-progress",String(y)),W.forEach((I,A)=>{let V=P(ur(y,A,D,o));z(I,V);});}if(R)return M(1),E?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let L=0,x=0,b=0,C=false,k=false,w=-1,g=0,j=false,O=()=>window.scrollY,B=()=>window.innerHeight;function X(){let y=t.getBoundingClientRect(),I=we({top:y.top,height:y.height},O(),B(),re,Se);L=I.tStart,x=I.tEnd;}function ie(){if(!C||k)return;let y=J(O(),L,x,1);p&&(w=Math.max(w,y),y=w),g=y,M(y),y>=1&&!j?(j=true,E?.()):y<1&&!p&&(j=false),b=requestAnimationFrame(ie);}X();let le=new IntersectionObserver(y=>{y.forEach(I=>{C=I.isIntersecting,C&&!k?b=requestAnimationFrame(ie):cancelAnimationFrame(b);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=g;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),W=Dt(t),M(y);}X();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),le.observe(t),Le(t,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:L,tEnd:x})}),{destroy(){cancelAnimationFrame(b),le.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ce(t);},replay(){w=-1,j=false,g=0,k=false,M(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(ie)));},seek(y){let I=Math.min(1,Math.max(0,y));g=I,w=I,k=true,cancelAnimationFrame(b),M(I);},getProgress(){return g}}}function dr(e,n={}){let[r,t]=useState(0),i=useRef(n);i.current=n;let o=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let u=a,{axis:m="y",scrollContainer:p,trigger:E={}}=i.current,R=typeof p=="string"?document.querySelector(p):p??null,P=se(E.start??"top bottom"),re=se(E.end??"bottom top"),Se=0,H=0,W=false,D=0;function z(){return R?m==="x"?R.scrollLeft:R.scrollTop:m==="x"?window.scrollX:window.scrollY}function M(){return R?m==="x"?R.clientWidth:R.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function L(){let w=u.getBoundingClientRect(),g=z(),j=m==="x"?w.left:w.top,O=m==="x"?w.width:w.height,B=we({top:j,height:O},g,M(),P,re);Se=B.tStart,H=B.tEnd;}function x(){if(!W)return;let{speed:w=1,easing:g="linear",once:j=false}=i.current,O=typeof g=="function"?g:Z[g]??Z.linear,B=J(z(),Se,H,w),X=O(B);j&&(o.current=Math.max(o.current,X),X=o.current),t(X),D=requestAnimationFrame(x);}let b=new IntersectionObserver(w=>{w.forEach(g=>{W=g.isIntersecting,W?D=requestAnimationFrame(x):cancelAnimationFrame(D);});},{root:R??null,threshold:0});L(),b.observe(u);let C;function k(){clearTimeout(C),C=setTimeout(L,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),()=>{cancelAnimationFrame(D),clearTimeout(C),b.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k);}},[]),r}function en({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=Lt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function tn({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=kt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function rn({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let i=It(t.current,r);return ()=>i.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function nn({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let a=useRef(null);return useEffect(()=>{if(!a.current)return;let u=Nt(a.current,o);return ()=>u.destroy()},[]),jsx("video",{ref:a,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function on({children:e,as:n="p",className:r,style:t,...i}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let a=zt(o.current,i);return ()=>a.destroy()},[]),gr.createElement(n,{ref:o,className:r,style:t},e)}export{tn as ScrollAnimate,rn as ScrollCounter,en as ScrollDraw,on as ScrollText,nn as ScrollVideo,dr as useScrollDrawProgress};
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",i,{passive:true}),i(),{el:t,destroy(){window.removeEventListener("scroll",i),t.remove();}}}var Mt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Pt=/[MmLlHhVvCcSsQqTtAaZz]/g;function rr(e,n,r){if(!Be)return;let t=(e.match(Pt)??[]).join("").toUpperCase(),i=(n.match(Pt)??[]).join("").toUpperCase(),o=(e.match(Mt)??[]).length,a=(n.match(Mt)??[]).length;if(t!==i){ve(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${i||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}o!==a&&ve(`morphTo: coordinate count differs (${o} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function at(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),i=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,o=>{let a=parseFloat(o),u=t[i++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function Lt(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,i=r?{...vt[r],...t}:t,o=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:E={},stagger:R=0,direction:M="forward",once:re=false,debug:Se=false,axis:H="y",scrollContainer:W,autoReverse:D=false,delay:z=0,strokeColor:P,strokeWidth:L,fillOpacity:x,waypoints:b,velocityScale:C=false,threshold:k=0,rootMargin:w="0px",repeat:g=0,repeatDelay:j=0,morphTo:O,clip:B,autoplay:X=false,duration:ie=1e3,native:le=true,onProgress:d,onStart:$,onComplete:y,onEnter:I,onLeave:A,onEnterBack:V,onLeaveBack:pe}=i,ne=B===true?"left":typeof B=="string"?B:false,xe=typeof p=="function"?p:Z[p]??Z.linear,$e=se(E.start??"top bottom"),He=se(E.end??"bottom top"),Ee=typeof W=="string"?document.querySelector(W):W??null,Te=Array.isArray(P)?P[0]:null,ce=Array.isArray(P)?P[1]:typeof P=="string"?P:null,ue=Array.isArray(L)?L[0]:null,K=Array.isArray(L)?L[1]:typeof L=="number"?L:null,de=Array.isArray(x)?x[0]:null,oe=Array.isArray(x)?x[1]:typeof x=="number"?x:null;function Re(s){let c=s*100;switch(ne){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let G=ne?[]:Array.from(e.querySelectorAll(a)),N=[],l=[],f=0,ge=0,_=false,U=false,Y=0,Me=false,ye=-1,ae=-1,ee=false,he=0,Ie=0,Ne,rt=null;function ct(){rt?.destroy(),rt=null;}let De=new Set,ut=NaN,Fe=true,je=-1,mt=performance.now(),ze=NaN;function nt(){return Ee?H==="x"?Ee.scrollLeft:Ee.scrollTop:H==="x"?window.scrollX:window.scrollY}function ft(){return Ee?H==="x"?Ee.clientWidth:Ee.clientHeight:H==="x"?window.innerWidth:window.innerHeight}function pt(){let s=Ke(e,Ee,H);return we(s,s.scroll,ft(),$e,He)}function dt(){(({tStart:f,tEnd:ge}=pt())),Se&&Be&&(ct(),rt=tr(f,ge,H));}function ot(s,c=pt){Le(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:c});let S=s.destroy;return s.destroy=()=>{S.call(s),Ce(e);},s}function _t(s,c){if(e.style.setProperty("--scroll-draw-progress",String(s)),ne){let S=c==="reverse"?1-s:s;e.style.clipPath=Re(S);return}G.forEach((S,me)=>{S.style.strokeDashoffset=c==="reverse"?`${N[me]*s}`:`${N[me]*(1-s)}`,m&&(S.style.opacity=c==="reverse"?`${1-s}`:`${s}`),Te&&ce?S.style.stroke=_e(Te,ce,s):ce&&(S.style.stroke=ce),ue!==null&&K!==null?S.style.strokeWidth=`${ue+(K-ue)*s}`:K!==null&&(S.style.strokeWidth=`${K}`),de!==null&&oe!==null?S.style.fillOpacity=`${de+(oe-de)*s}`:oe!==null&&(S.style.fillOpacity=`${oe}`),O&&S.tagName.toLowerCase()==="path"&&l[me]&&S.setAttribute("d",at(l[me],O,s));});}function Xe(){if(e.style.setProperty("--scroll-draw-progress","0"),ne){e.style.clipPath=Re(0);return}G.forEach((s,c)=>{s.style.strokeDasharray=`${N[c]}`,s.style.strokeDashoffset=M==="reverse"?"0":`${N[c]}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`),O&&s.tagName.toLowerCase()==="path"&&l[c]&&s.setAttribute("d",l[c]);});}if(G.forEach(s=>{er(s);let c=Ve(s);N.push(c);let S=s.tagName.toLowerCase()==="path";S?l.push(s.getAttribute("d")??""):l.push(""),O&&(S?rr(l[l.length-1],O,s):ve(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),o?(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?`${c}`:"0",m&&(s.style.opacity="1"),ce&&(s.style.stroke=ce),K!==null&&(s.style.strokeWidth=`${K}`),oe!==null&&(s.style.fillOpacity=`${oe}`),O&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",O)):(s.style.strokeDasharray=`${c}`,s.style.strokeDashoffset=M==="reverse"?"0":`${c}`,m?s.style.opacity=M==="reverse"?"1":"0":s.style.opacity="",Te&&(s.style.stroke=Te),ue!==null&&(s.style.strokeWidth=`${ue}`),de!==null&&(s.style.fillOpacity=`${de}`));}),ne){if(o)return e.style.clipPath=Re(1),y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Re(0);}else if(o)return y?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let gt=typeof p=="string"?et(p):null;function qt(){return !(le===false||!Kt()||!G.length||!gt||ne||H!=="y"||Ee||u!==1||R!==0||re||D||C!==false||O||b||g||z>0||d||$||y||I||A||V||pe||P!=null||L!=null||x!=null||(E.start??"top bottom").trim()!=="top bottom"||(E.end??"bottom top").trim()!=="bottom top")}function Wt(){let s=++Jt,c=`svg-scroll-draw-${s}`,S=`svg-scroll-draw-host-${s}`,me=`--svg-scroll-draw-${s}`,Oe=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Pe=`stroke-dashoffset:${Oe};`,T=`stroke-dashoffset:${ke};`;m&&(Pe+=`opacity:${M==="reverse"?1:0};`,T+=`opacity:${M==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Pe}}to{${T}}}.${S}{view-timeline-name:${me};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${gt};animation-fill-mode:both;animation-timeline:${me};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(S);function fe(h,te){h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(c);}G.forEach(fe);let v=false,q=-1;function Q(){if(q>=0)return q;let h=e.getBoundingClientRect(),{tStart:te,tEnd:Ae}=we({top:h.top,height:h.height},nt(),ft(),$e,He);return xe(J(nt(),te,Ae,u))}return {destroy(){e.classList.remove(S),G.forEach(h=>{h.classList.remove(c),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),F.remove();},replay(){v=false,q=-1,G.forEach(fe);},pause(){v=true,G.forEach(h=>{h.style.animationPlayState="paused";});},resume(){v&&(v=false,G.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let te=Math.min(1,Math.max(0,h));q=te,v=true,G.forEach((Ae,be)=>{Ae.classList.remove(c),Ae.style.strokeDashoffset=M==="reverse"?`${N[be]*te}`:`${N[be]*(1-te)}`,m&&(Ae.style.opacity=M==="reverse"?`${1-te}`:`${te}`);});},getProgress(){return Q()},refresh(){G.forEach((h,te)=>{N[te]=Ve(h),h.style.setProperty("--ssd-len",String(N[te])),h.style.strokeDasharray=`${N[te]}`;});}}}if(qt())return ot(Wt());function Bt(){let s=Math.max(1,ie),c=0,S=0,me=false;function Oe(v){let q=true;if(ne){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);he=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=Re(M==="reverse"?1-h:h),d?.(h),Q<1&&(q=false);}else G.forEach((Q,h)=>{let te=h*R*s,Ae=Math.min(1,Math.max(0,(v-te)/s)),be=xe(Ae);Q.style.strokeDashoffset=M==="reverse"?`${N[h]*be}`:`${N[h]*(1-be)}`,m&&(Q.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Te&&ce?Q.style.stroke=_e(Te,ce,be):ce&&(Q.style.stroke=ce),ue!==null&&K!==null?Q.style.strokeWidth=`${ue+(K-ue)*be}`:K!==null&&(Q.style.strokeWidth=`${K}`),de!==null&&oe!==null?Q.style.fillOpacity=`${de+(oe-de)*be}`:oe!==null&&(Q.style.fillOpacity=`${oe}`),O&&Q.tagName.toLowerCase()==="path"&&l[h]&&Q.setAttribute("d",at(l[h],O,be)),h===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Ae<1&&(q=false);});if(b){let Q=Math.min(1,Math.max(0,v/s)),h=xe(Q);for(let te in b){let Ae=parseFloat(te);h>=Ae&&!De.has(Ae)&&(De.add(Ae),b[te]?.());}}return q}function ke(v){if(ee)return;let q=v-c;U||(U=true,$?.());let Q=Oe(q);if(Q&&!_){_=true,Oe(s*(1+Math.max(0,G.length-1)*R)),y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{c=performance.now(),U=false,_=false,De.clear(),Xe(),Y=requestAnimationFrame(ke);},j));return}Q||(Y=requestAnimationFrame(ke));}function Pe(){cancelAnimationFrame(Y),clearTimeout(Ne),c=performance.now(),S=0,ee=false,U=false,_=false,Ie=0,me=true,he=0,De.clear(),Xe(),Y=requestAnimationFrame(ke);}let T=new IntersectionObserver(v=>{v.forEach(q=>{q.isIntersecting&&!(re&&_)?Pe():!q.isIntersecting&&!re&&!_&&(cancelAnimationFrame(Y),clearTimeout(Ne),me=false);});},{root:Ee??null,threshold:k,rootMargin:w}),F;function fe(){clearTimeout(F),F=setTimeout(()=>{G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});},150);}return window.addEventListener("resize",fe),window.addEventListener("orientationchange",fe),z>0?setTimeout(()=>T.observe(e),z):T.observe(e),{destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),T.disconnect(),window.removeEventListener("resize",fe),window.removeEventListener("orientationchange",fe),clearTimeout(F);},replay(){Ie=0,Pe();},pause(){ee||!me||(ee=true,S=performance.now()-c,cancelAnimationFrame(Y));},resume(){ee&&(ee=false,me=true,c=performance.now()-S,Y=requestAnimationFrame(ke));},seek(v){let q=Math.min(1,Math.max(0,v));he=q,ee=true,S=q*s,c=performance.now()-S,cancelAnimationFrame(Y),Oe(S);},getProgress(){return he},refresh(){clearTimeout(F),G.forEach((v,q)=>{N[q]=Ve(v),v.style.strokeDasharray=`${N[q]}`;});}}}if(X)return ot(Bt());dt();function Ye(){if(!Me||ee)return;let s=performance.now(),c=nt();if(!Fe&&C===false&&c===ut){Y=requestAnimationFrame(Ye);return}Fe=false,ut=c;let S=u;if(C!==false){let T=s-mt,F=T>0?Math.abs(c-(je<0?c:je))/T:0;S=u*Math.max(.2,1+F*(typeof C=="number"?C:1)*.04);}je=c,mt=s;let me=D?ae===-1||c>=ae?"forward":"reverse":M;ae=c;let Oe=ge-f,ke=true,Pe=Oe===0?0:(c-f)/Oe;if(isNaN(ze)||(ze<=0&&Pe>0?I?.():ze>0&&Pe<=0&&pe?.(),ze<1&&Pe>=1?A?.():ze>=1&&Pe<1&&V?.()),ze=Pe,ne){let T=xe(J(c,f,ge,S));re&&!D&&(ye=Math.max(ye,T),T=ye),he=T,e.style.setProperty("--scroll-draw-progress",String(T));let F=me==="reverse"?1-T:T;e.style.clipPath=Re(F),d?.(T),!U&&J(c,f,ge,S)>0&&(U=true,$?.()),T>=1&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,e.style.clipPath=Re(0);},j))):T<1&&!re&&(_=false),Y=requestAnimationFrame(Ye);return}if(G.forEach((T,F)=>{let fe=F*R*Oe,v=xe(J(c,f+fe,ge+fe,S));re&&!D&&(ye=Math.max(ye,v),v=ye),he=v,T.style.strokeDashoffset=me==="reverse"?`${N[F]*v}`:`${N[F]*(1-v)}`,m&&(T.style.opacity=me==="reverse"?`${1-v}`:`${v}`),Te&&ce?T.style.stroke=_e(Te,ce,v):ce&&(T.style.stroke=ce),ue!==null&&K!==null?T.style.strokeWidth=`${ue+(K-ue)*v}`:K!==null&&(T.style.strokeWidth=`${K}`),de!==null&&oe!==null?T.style.fillOpacity=`${de+(oe-de)*v}`:oe!==null&&(T.style.fillOpacity=`${oe}`),O&&T.tagName.toLowerCase()==="path"&&l[F]&&T.setAttribute("d",at(l[F],O,v)),F===0&&(d?.(v),e.style.setProperty("--scroll-draw-progress",String(v))),v<1&&(ke=false);}),b){let T=xe(J(c,f,ge,S));for(let F in b){let fe=parseFloat(F);T>=fe&&!De.has(fe)&&(De.add(fe),b[F]?.());}}!U&&J(c,f,ge,S)>0&&(U=true,$?.()),ke&&!_?(_=true,y?.(),Ie<(g==="infinite"?1/0:g??0)&&(Ie++,Ne=setTimeout(()=>{ye=-1,U=false,_=false,De.clear(),Xe(),Fe=true;},j))):!ke&&!re&&(_=false),Y=requestAnimationFrame(Ye);}let st=false;function Qe(){st||(st=true,Y=requestAnimationFrame(function(){Ye();}));}function Ze(){st=false,cancelAnimationFrame(Y);}let it=new IntersectionObserver(s=>{s.forEach(c=>{Me=c.isIntersecting,Me&&!ee?(Fe=true,Qe()):Ze();});},{root:Ee??null,threshold:k,rootMargin:w});function yt(){G.forEach((s,c)=>{N[c]=Ve(s),s.style.strokeDasharray=`${N[c]}`;}),dt(),Fe=true;}let Je;function qe(){clearTimeout(Je),Je=setTimeout(yt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let We;return typeof ResizeObserver<"u"&&(We=new ResizeObserver(()=>qe()),We.observe(document.body),We.observe(document.documentElement),We.observe(e)),z>0?setTimeout(()=>it.observe(e),z):it.observe(e),ot({destroy(){cancelAnimationFrame(Y),clearTimeout(Ne),Ze(),it.disconnect(),We?.disconnect(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(Je),ct();},replay(){ye=-1,ae=-1,je=-1,U=false,_=false,Ie=0,ee=false,he=0,De.clear(),clearTimeout(Ne),Xe(),Fe=true,Me&&Qe();},pause(){ee=true,Ze();},resume(){ee&&(ee=false,Fe=true,Me&&Qe());},seek(s){let c=Math.min(1,Math.max(0,s));he=c,ye=c,ee=true,Ze(),_t(c,M),Fe=true;},getProgress(){return he},refresh(){clearTimeout(Je),yt(),Me&&!ee&&Qe();}},()=>({tStart:f,tEnd:ge}))}function nr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ct(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let i=[],o=[],a=t[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);i.push(m?parseFloat(m[1]):0),o.push(m?m[2]:"");}n.push({fn:t[1],nums:i,units:o});}return n}function or(e,n,r){let t=Ct(e),i=Ct(n);return t.length===0||t.length!==i.length?r<1?e:n:t.map((o,a)=>{let u=i[a];return o.fn!==u.fn||o.nums.length!==u.nums.length?r<1?`${o.fn}(${o.nums.map((m,p)=>`${m}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${o.units[p]}`).join(", ")})`}).join(" ")}function $t(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),i=String(n);if(nr(t))return _e(t,i,r);if(t.includes("("))return or(t,i,r);let o=t.match(/^([-+]?[\d.]+)(.*)$/),a=i.match(/^([-+]?[\d.]+)(.*)$/);if(o&&a){let u=parseFloat(o[1]),m=parseFloat(a[1]);return `${u+(m-u)*r}${o[2]||a[2]}`}return r<1?t:i}function sr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ir=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),ar=0,Rt="--scroll-draw-progress";function lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function kt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:i={},easing:o="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:p,native:E=true,velocityScale:R=false,respectReducedMotion:M=true,triggerElement:re,onProgress:Se,onComplete:H,onEnter:W,onLeave:D,onEnterBack:z,onLeaveBack:P}=n,L=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,x=typeof o=="function"?o:Z[o]??Z["ease-out"],b=se(i.start??"top bottom"),C=se(i.end??"bottom top"),k=re??e,w=typeof p=="string"?document.querySelector(p):p??null,g=Object.entries(t).map(([l,f])=>({prop:sr(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function j(){let l=window.getComputedStyle(e);for(let f of g)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function O(){for(let l of g)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...g.map(f=>f.prop),Rt])B.set(l,e.style.getPropertyValue(l));function X(){for(let[l,f]of B)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(L)return O(),H?.(),{...r,destroy:X,getProgress:()=>1};j();let ie=typeof o=="string"?et(o):null;function le(){if(!E||!lr()||!ie||m!=="y"||w||k!==e||u||a!==1||Se||H||W||D||z||P||R!==false||(i.start??"top bottom").trim()!=="top bottom"||(i.end??"bottom top").trim()!=="bottom top")return false;for(let l of g)if(!ir.has(l.prop))return false;return true}function d(){let l=`ssd-a-${++ar}`,f=g.map(ae=>`${ae.prop}:${ae.from}`).join(";"),ge=g.map(ae=>`${ae.prop}:${ae.to}`).join(";"),_=document.createElement("style");_.setAttribute("data-ssd-animate",""),_.textContent=`@keyframes ${l}{from{${f}}to{${ge}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(_),e.classList.add(l);let U=()=>m==="x"?window.scrollX:window.scrollY,Y=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let ae=e.getBoundingClientRect();return we({top:ae.top,height:ae.height},U(),Y(),b,C)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(l),_.remove(),e.style.animationPlayState="",X(),Ce(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(ae){let ee=Math.min(1,Math.max(0,ae));e.classList.remove(l);for(let he of g)e.style.setProperty(he.prop,$t(he.from,he.to,ee));},getProgress(){let{tStart:ae,tEnd:ee}=Me();return x(J(U(),ae,ee,a))}};return ye}if(le())return d();let $=0,y=0,I=0,A=false,V=false,pe=-1,ne=0,xe=false,$e=NaN,He=-1,Ee=0,Te=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ce=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ue(){let l=Ke(k,w,m),f=we(l,l.scroll,ce(),b,C);$=f.tStart,y=f.tEnd;}function K(l){e.style.setProperty(Rt,String(l));for(let f of g)e.style.setProperty(f.prop,$t(f.from,f.to,l));Se?.(l);}function de(l){if(isNaN($e)){$e=l;return}$e<=0&&l>0?W?.():$e>0&&l<=0&&P?.(),$e<1&&l>=1?D?.():$e>=1&&l<1&&z?.(),$e=l;}function oe(){if(!A||V)return;let l=performance.now(),f=Te(),ge=a;if(R!==false){let Y=l-Ee,Me=Y>0?Math.abs(f-(He<0?f:He))/Y:0;ge=a*Math.max(.2,1+Me*(typeof R=="number"?R:1)*.04);}He=f,Ee=l;let _=y===$?0:(f-$)/(y-$);de(_);let U=x(J(f,$,y,ge));u&&(pe=Math.max(pe,U),U=pe),ne=U,K(U),U>=1&&!xe?(xe=true,H?.()):U<1&&!u&&(xe=false),I=requestAnimationFrame(oe);}ue(),y===$&&ve("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=x(J(Te(),$,y,a));u&&l>0&&(pe=l),ne=l,K(l);}let Re=new IntersectionObserver(l=>{l.forEach(f=>{A=f.isIntersecting,A&&!V?I=requestAnimationFrame(oe):cancelAnimationFrame(I);});},{root:w??null}),G;function N(){clearTimeout(G),G=setTimeout(ue,150);}return window.addEventListener("resize",N),window.addEventListener("orientationchange",N),Re.observe(e),Le(e,{type:"animate",getProgress:()=>ne,getTrigger:()=>({tStart:$,tEnd:y})}),{destroy(){cancelAnimationFrame(I),Re.disconnect(),window.removeEventListener("resize",N),window.removeEventListener("orientationchange",N),clearTimeout(G),X(),Ce(e);},replay(){pe=-1,xe=false,ne=0,V=false,K(0);},pause(){V=true,cancelAnimationFrame(I);},resume(){V&&(V=false,A&&(I=requestAnimationFrame(oe)));},seek(l){let f=Math.min(1,Math.max(0,l));ne=f,pe=f,V=true,cancelAnimationFrame(I),K(f);},getProgress(){return ne}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function It(e,n){if(typeof window>"u")return lt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollCounter: element not found:",e),lt;let t=r,{from:i=0,to:o,format:a,easing:u="ease-out",trigger:m={},once:p=true,decimals:E,onComplete:R}=n,M=E!==void 0?d=>d.toFixed(E):a??(d=>String(Math.round(d))),re=typeof u=="function"?u:Z[u]??Z["ease-out"],Se=se(m.start??"top 80%"),H=se(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(o),R?.(),lt;let D=0,z=0,P=0,L=false,x=false,b=-1,C=0,k=false,w=()=>window.scrollY,g=()=>window.innerHeight;function j(){let d=t.getBoundingClientRect(),$=we({top:d.top,height:d.height},w(),g(),Se,H);D=$.tStart,z=$.tEnd;}function O(d){t.textContent=M(i+(o-i)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function B(){if(!L||x)return;let d=re(J(w(),D,z,1));p&&(b=Math.max(b,d),d=b),C=d,O(d),d>=1&&!k?(k=true,R?.()):d<1&&!p&&(k=false),P=requestAnimationFrame(B);}j();{let d=re(J(w(),D,z,1));p&&d>0&&(b=d),C=d,O(d);}let X=new IntersectionObserver(d=>{d.forEach($=>{L=$.isIntersecting,L&&!x?P=requestAnimationFrame(B):cancelAnimationFrame(P);});}),ie;function le(){clearTimeout(ie),ie=setTimeout(j,150);}return window.addEventListener("resize",le),window.addEventListener("orientationchange",le),X.observe(t),Le(t,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:D,tEnd:z})}),{destroy(){cancelAnimationFrame(P),X.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),clearTimeout(ie),Ce(t);},replay(){b=-1,k=false,C=0,x=false,O(0);},pause(){x=true,cancelAnimationFrame(P);},resume(){x&&(x=false,L&&(P=requestAnimationFrame(B)));},seek(d){let $=Math.min(1,Math.max(0,d));C=$,b=$,x=true,cancelAnimationFrame(P),O($);},getProgress(){return C}}}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return ve("scrollVideo: <video> element not found:",e),Ot;let t=r,{trigger:i={},easing:o="linear",once:a=false,axis:u="y",preload:m="auto",onReady:p,onComplete:E,onProgress:R}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,re=typeof o=="function"?o:Z[o]??Z.linear,Se=se(i.start??"top top"),H=se(i.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let W=n.from??0,D=n.to,z=0,P=0,L=0,x=false,b=false,C=-1,k=0,w=false,g=false,j=()=>u==="x"?window.scrollX:window.scrollY,O=()=>u==="x"?window.innerWidth:window.innerHeight;function B(){let A=t.getBoundingClientRect(),V=u==="x"?A.left:A.top,pe=u==="x"?A.width:A.height,ne=we({top:V,height:pe},j(),O(),Se,H);z=ne.tStart,P=ne.tEnd;}let X=NaN;function ie(A){if(!g)return;let V=D??t.duration??0,pe=W+(V-W)*A;pe!==X&&(X=pe,t.currentTime=pe),t.style.setProperty("--scroll-draw-progress",String(A)),R?.(A);}function le(){if(!x||b||!g||M)return;let A=re(J(j(),z,P,1));a&&(C=Math.max(C,A),A=C),k=A,ie(A),A>=1&&!w?(w=true,E?.()):A<1&&!a&&(w=false),L=requestAnimationFrame(le);}function d(){if(g=true,D===void 0&&(D=t.duration),M){ie(1),p?.();return}B(),p?.(),x&&!b&&(L=requestAnimationFrame(le));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),g||B();let $=new IntersectionObserver(A=>{A.forEach(V=>{x=V.isIntersecting,x&&!b&&g?L=requestAnimationFrame(le):cancelAnimationFrame(L);});}),y;function I(){clearTimeout(y),y=setTimeout(B,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),$.observe(t),Le(t,{type:"video",getProgress:()=>k,getTrigger:()=>({tStart:z,tEnd:P})}),{destroy(){cancelAnimationFrame(L),$.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(y),Ce(t);},replay(){C=-1,w=false,k=0,b=false,X=NaN,ie(0);},pause(){b=true,cancelAnimationFrame(L);},resume(){b&&(b=false,x&&g&&(L=requestAnimationFrame(le)));},seek(A){let V=Math.min(1,Math.max(0,A));k=V,C=V,b=true,cancelAnimationFrame(L),X=NaN,ie(V);},getProgress(){return k}}}function Ht(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function cr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=Ht(e),r=new Map;for(let o of n){let a=o.offsetTop;r.has(a)||r.set(a,[]),r.get(a).push(o);}let t=[],i=Array.from(r.keys()).sort((o,a)=>o-a);for(let o of i){let a=r.get(o),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((m,p)=>{let E=m.nextElementSibling;u.appendChild(m),p<a.length-1&&E&&E.style.whiteSpace==="pre"&&u.appendChild(E);}),t.push(u);}return e.textContent="",t.forEach((o,a)=>{e.appendChild(o),a<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ur(e,n,r,t){if(r<=1||t===0)return e;let i=(r-1)*t,o=n*t,a=o+(1-i);return a<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(a-o)))}function mr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Ft={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function zt(e,n={}){if(typeof window>"u")return Ft;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ve("scrollText: element not found:",e),Ft;let t=r,{split:i="words",stagger:o=.04,easing:a="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:E}=n,R=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof a=="function"?a:Z[a]??Z["ease-out"],re=se(m.start??"top 85%"),Se=se(m.end??"top 40%"),H=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let W;i==="chars"?W=cr(t):i==="lines"?W=Dt(t):W=Ht(t);let D=W.length;function z(y,I){u?.opacity!==void 0&&(y.style.opacity=String(u.opacity+(1-u.opacity)*I));let A=mr(I,u);A&&(y.style.transform=A);}function P(y){t.style.setProperty("--scroll-draw-progress",String(y)),W.forEach((I,A)=>{let V=M(ur(y,A,D,o));z(I,V);});}if(R)return P(1),E?.(),{destroy(){t.innerHTML=H,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};P(0);let L=0,x=0,b=0,C=false,k=false,w=-1,g=0,j=false,O=()=>window.scrollY,B=()=>window.innerHeight;function X(){let y=t.getBoundingClientRect(),I=we({top:y.top,height:y.height},O(),B(),re,Se);L=I.tStart,x=I.tEnd;}function ie(){if(!C||k)return;let y=J(O(),L,x,1);p&&(w=Math.max(w,y),y=w),g=y,P(y),y>=1&&!j?(j=true,E?.()):y<1&&!p&&(j=false),b=requestAnimationFrame(ie);}X();let le=new IntersectionObserver(y=>{y.forEach(I=>{C=I.isIntersecting,C&&!k?b=requestAnimationFrame(ie):cancelAnimationFrame(b);});}),d;function $(){clearTimeout(d),d=setTimeout(()=>{if(i==="lines"){let y=g;t.innerHTML=H,t.setAttribute("aria-label",t.textContent??""),W=Dt(t),P(y);}X();},150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),le.observe(t),Le(t,{type:"text",getProgress:()=>g,getTrigger:()=>({tStart:L,tEnd:x})}),{destroy(){cancelAnimationFrame(b),le.disconnect(),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(d),t.innerHTML=H,t.removeAttribute("aria-label"),Ce(t);},replay(){w=-1,j=false,g=0,k=false,P(0);},pause(){k=true,cancelAnimationFrame(b);},resume(){k&&(k=false,C&&(b=requestAnimationFrame(ie)));},seek(y){let I=Math.min(1,Math.max(0,y));g=I,w=I,k=true,cancelAnimationFrame(b),P(I);},getProgress(){return g}}}function dr(e,n={}){let[r,t]=useState(0),i=useRef(n);i.current=n;let o=useRef(-1);return useEffect(()=>{if(typeof window>"u")return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t(1);return}let a=typeof e=="string"?document.querySelector(e):e.current;if(!a)return;let u=a,{axis:m="y",scrollContainer:p,trigger:E={}}=i.current,R=typeof p=="string"?document.querySelector(p):p??null,M=se(E.start??"top bottom"),re=se(E.end??"bottom top"),Se=0,H=0,W=false,D=0;function z(){return R?m==="x"?R.scrollLeft:R.scrollTop:m==="x"?window.scrollX:window.scrollY}function P(){return R?m==="x"?R.clientWidth:R.clientHeight:m==="x"?window.innerWidth:window.innerHeight}function L(){let w=u.getBoundingClientRect(),g=z(),j=m==="x"?w.left:w.top,O=m==="x"?w.width:w.height,B=we({top:j,height:O},g,P(),M,re);Se=B.tStart,H=B.tEnd;}function x(){if(!W)return;let{speed:w=1,easing:g="linear",once:j=false}=i.current,O=typeof g=="function"?g:Z[g]??Z.linear,B=J(z(),Se,H,w),X=O(B);j&&(o.current=Math.max(o.current,X),X=o.current),t(X),D=requestAnimationFrame(x);}let b=new IntersectionObserver(w=>{w.forEach(g=>{W=g.isIntersecting,W?D=requestAnimationFrame(x):cancelAnimationFrame(D);});},{root:R??null,threshold:0});L(),b.observe(u);let C;function k(){clearTimeout(C),C=setTimeout(L,150);}return window.addEventListener("resize",k),window.addEventListener("orientationchange",k),()=>{cancelAnimationFrame(D),clearTimeout(C),b.disconnect(),window.removeEventListener("resize",k),window.removeEventListener("orientationchange",k);}},[]),r}function en({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=Lt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function tn({children:e,className:n,style:r,...t}){let i=useRef(null);return useEffect(()=>{if(!i.current)return;let o=kt(i.current,t);return ()=>o.destroy()},[]),jsx("div",{ref:i,className:n,style:r,children:e})}function rn({className:e,style:n,...r}){let t=useRef(null);return useEffect(()=>{if(!t.current)return;let i=It(t.current,r);return ()=>i.destroy()},[]),jsx("span",{ref:t,className:e,style:n})}function nn({src:e,className:n,style:r,muted:t=true,playsInline:i=true,...o}){let a=useRef(null);return useEffect(()=>{if(!a.current)return;let u=Nt(a.current,o);return ()=>u.destroy()},[]),jsx("video",{ref:a,src:e,className:n,style:r,muted:t,playsInline:i,preload:"auto"})}function on({children:e,as:n="p",className:r,style:t,...i}){let o=useRef(null);return useEffect(()=>{if(!o.current)return;let a=zt(o.current,i);return ()=>a.destroy()},[]),gr.createElement(n,{ref:o,className:r,style:t},e)}export{tn as ScrollAnimate,rn as ScrollCounter,en as ScrollDraw,on as ScrollText,nn as ScrollVideo,dr as useScrollDrawProgress};
|
package/dist/reveal/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function _e({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),i=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(a,c);m.push(p),i+=p;}let l=[0],u=0;for(let c=0;c<t;c++)u+=m[c]/i,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Ce({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/r)+1}var $={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:_e(),elastic:Ce()};function K(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function me(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function pe(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ne(e,n,t){return Math.min(t,Math.max(n,e))}function X(e,n,t,r){return t===n?0:Ne((e-n)/(t-n)*r,0,1)}function ge(e,n,t){let r=e.getBoundingClientRect(),a=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:t==="x"?r.left:r.top,height:a,scroll:t==="x"?window.scrollX:window.scrollY}}function Z(e,n,t,r,a){let i=me(e.top,e.height,n,r.element)-pe(r.viewport,t),m=me(e.top,e.height,n,a.element)-pe(a.viewport,t);return {tStart:i,tEnd:m}}function fe(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function de(e,n,t){let r=fe(e),a=fe(n);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*t)},${Math.round(r[1]+(a[1]-r[1])*t)},${Math.round(r[2]+(a[2]-r[2])*t)})`}var Fe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",be=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ve(e){let n=[];for(let t=0;t<be;t++){let r=t/(be-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function ye(e){switch(e){case "linear":return "linear";case "ease-in":return Fe;case "ease-out":return Oe;case "ease-in-out":return De()?Ve($["ease-in-out"]):null;default:return null}}var he=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[he]||(e[he]=new Map)}function J(e,n){we().set(e,n);}function ee(e){we().delete(e);}var He=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,...n){He&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Xe(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ee(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let a=[],i=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}n.push({fn:r[1],nums:a,units:i});}return n}function ke(e,n,t){let r=Ee(e),a=Ee(n);return r.length===0||r.length!==a.length?t<1?e:n:r.map((i,m)=>{let l=a[m];return i.fn!==l.fn||i.nums.length!==l.nums.length?t<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(l.nums[c]-u)*t}${i.units[c]}`).join(", ")})`}).join(" ")}function Se(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),a=String(n);if(Xe(r))return de(r,a,t);if(r.includes("("))return ke(r,a,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&m){let l=parseFloat(i[1]),u=parseFloat(m[1]);return `${l+(u-l)*t}${i[2]||m[2]}`}return t<1?r:a}function Be(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ze=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),We=0,ve="--scroll-draw-progress";function Ye(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function xe(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:a={},easing:i="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:B,onProgress:I,onComplete:w,onEnter:P,onLeave:A,onEnterBack:_,onLeaveBack:te}=n,Pe=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,z=typeof i=="function"?i:$[i]??$["ease-out"],ne=K(a.start??"top bottom"),re=K(a.end??"bottom top"),oe=B??e,d=typeof c=="string"?document.querySelector(c):c??null,y=Object.entries(r).map(([o,s])=>({prop:Be(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Te(){let o=window.getComputedStyle(e);for(let s of y)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Re(){for(let o of y)e.style.setProperty(o.prop,String(o.to));}let se=new Map;for(let o of [...y.map(s=>s.prop),ve])se.set(o,e.style.getPropertyValue(o));function W(){for(let[o,s]of se)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Pe)return Re(),w?.(),{...t,destroy:W,getProgress:()=>1};Te();let ie=typeof i=="string"?ye(i):null;function Le(){if(!p||!Ye()||!ie||u!=="y"||d||oe!==e||l||m!==1||I||w||P||A||_||te||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of y)if(!ze.has(o.prop))return false;return true}function Ae(){let o=`ssd-a-${++We}`,s=y.map(f=>`${f.prop}:${f.from}`).join(";"),D=y.map(f=>`${f.prop}:${f.to}`).join(";"),L=document.createElement("style");L.setAttribute("data-ssd-animate",""),L.textContent=`@keyframes ${o}{from{${s}}to{${D}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,V=()=>u==="x"?window.innerWidth:window.innerHeight,H=()=>{let f=e.getBoundingClientRect();return Z({top:f.top,height:f.height},b(),V(),ne,re)};J(e,{type:"animate",getProgress:()=>q.getProgress(),getTrigger:H});let q={destroy(){e.classList.remove(o),L.remove(),e.style.animationPlayState="",W(),ee(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let U=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Q of y)e.style.setProperty(Q.prop,Se(Q.from,Q.to,U));},getProgress(){let{tStart:f,tEnd:U}=H();return z(X(b(),f,U,m))}};return q}if(Le())return Ae();let h=0,E=0,S=0,C=false,v=false,T=-1,R=0,N=false,x=NaN,Y=-1,ae=0,ue=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=ge(oe,d,u),s=Z(o,o.scroll,$e(),ne,re);h=s.tStart,E=s.tEnd;}function F(o){e.style.setProperty(ve,String(o));for(let s of y)e.style.setProperty(s.prop,Se(s.from,s.to,o));I?.(o);}function Ie(o){if(isNaN(x)){x=o;return}x<=0&&o>0?P?.():x>0&&o<=0&&te?.(),x<1&&o>=1?A?.():x>=1&&o<1&&_?.(),x=o;}function G(){if(!C||v)return;let o=performance.now(),s=ue(),D=m;if(g!==false){let V=o-ae,H=V>0?Math.abs(s-(Y<0?s:Y))/V:0;D=m*Math.max(.2,1+H*(typeof g=="number"?g:1)*.04);}Y=s,ae=o;let L=E===h?0:(s-h)/(E-h);Ie(L);let b=z(X(s,h,E,D));l&&(T=Math.max(T,b),b=T),R=b,F(b),b>=1&&!N?(N=true,w?.()):b<1&&!l&&(N=false),S=requestAnimationFrame(G);}ce(),E===h&&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);{let o=z(X(ue(),h,E,m));l&&o>0&&(T=o),R=o,F(o);}let le=new IntersectionObserver(o=>{o.forEach(s=>{C=s.isIntersecting,C&&!v?S=requestAnimationFrame(G):cancelAnimationFrame(S);});},{root:d??null}),j;function O(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),le.observe(e),J(e,{type:"animate",getProgress:()=>R,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(S),le.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(j),W(),ee(e);},replay(){T=-1,N=false,R=0,v=false,F(0);},pause(){v=true,cancelAnimationFrame(S);},resume(){v&&(v=false,C&&(S=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));R=s,T=s,v=true,cancelAnimationFrame(S),F(s);},getProgress(){return R}}}var Ge={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 je(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var Me={destroy:()=>{}};function at(e,n={}){if(typeof window>"u")return Me;let t=qe(e);if(!t.length)return k("scrollReveal: no elements found:",e),Me;let{preset:r="fadeUp",from:a,stagger:i=.08,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=n,g={...Ge[r],...a},M=je(g),B=Math.min(i*4,4),I=t.map((w,P)=>{let A=Math.max(50,88-P*B),_=Math.max(20,A-35);return xe(w,{props:M,easing:m,once:l,native:false,trigger:u??{start:`top ${A}%`,end:`top ${_}%`},onEnter:P===0?c:void 0,onLeave:P===t.length-1?p:void 0})});return {destroy(){I.forEach(w=>w.destroy());}}}exports.scrollReveal=at;
|
|
1
|
+
'use strict';function Ne({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(r),s=0,m=[];for(let c=0;c<n;c++){let p=Math.pow(a,c);m.push(p),s+=p;}let l=[0],u=0;for(let c=0;c<n;c++)u+=m[c]/s,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Fe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),a=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-a)*(2*Math.PI)/r)+1}var N={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:Ne(),elastic:Fe()};function J(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 fe(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 ge(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 Oe(e,t,n){return Math.min(n,Math.max(t,e))}function W(e,t,n,r){return n===t?0:Oe((e-t)/(n-t)*r,0,1)}function be(e,t,n){let r=e.getBoundingClientRect(),a=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:a,scroll:0}:{top:n==="x"?r.left:r.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function ee(e,t,n,r,a){let s=fe(e.top,e.height,t,r.element)-ge(r.viewport,n),m=fe(e.top,e.height,t,a.element)-ge(a.viewport,n);return {tStart:s,tEnd:m}}function de(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 he(e,t,n){let r=de(e),a=de(t);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*n)},${Math.round(r[1]+(a[1]-r[1])*n)},${Math.round(r[2]+(a[2]-r[2])*n)})`}var De="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ve="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function He(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Xe(e){let t=[];for(let n=0;n<ye;n++){let r=n/(ye-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function we(e){switch(e){case "linear":return "linear";case "ease-in":return De;case "ease-out":return Ve;case "ease-in-out":return He()?Xe(N["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function ve(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function te(e,t){ve().set(e,t);}function ne(e){ve().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 Y(e,...t){ke&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Be(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let a=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:r[1],nums:a,units:s});}return t}function ze(e,t,n){let r=Se(e),a=Se(t);return r.length===0||r.length!==a.length?n<1?e:t:r.map((s,m)=>{let l=a[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?n<1?`${s.fn}(${s.nums.map((u,c)=>`${u}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,c)=>`${u+(l.nums[c]-u)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function xe(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),a=String(t);if(Be(r))return he(r,a,n);if(r.includes("("))return ze(r,a,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),u=parseFloat(m[1]);return `${l+(u-l)*n}${s[2]||m[2]}`}return n<1?r:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Ye=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ge=0,Me="--scroll-draw-progress";function je(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Te(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:r,trigger:a={},easing:s="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:I,onProgress:T,onComplete:P,onEnter:C,onLeave:F,onEnterBack:O,onLeaveBack:R}=t,_=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,w=typeof s=="function"?s:N[s]??N["ease-out"],oe=J(a.start??"top bottom"),se=J(a.end??"bottom top"),ie=I??e,d=typeof c=="string"?document.querySelector(c):c??null,h=Object.entries(r).map(([o,i])=>({prop:We(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function Le(){let o=window.getComputedStyle(e);for(let i of h)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function $e(){for(let o of h)e.style.setProperty(o.prop,String(o.to));}let ae=new Map;for(let o of [...h.map(i=>i.prop),Me])ae.set(o,e.style.getPropertyValue(o));function G(){for(let[o,i]of ae)i?e.style.setProperty(o,i):e.style.removeProperty(o);}if(_)return $e(),P?.(),{...n,destroy:G,getProgress:()=>1};Le();let ue=typeof s=="string"?we(s):null;function Ae(){if(!p||!je()||!ue||u!=="y"||d||ie!==e||l||m!==1||T||P||C||F||O||R||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of h)if(!Ye.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++Ge}`,i=h.map(f=>`${f.prop}:${f.from}`).join(";"),k=h.map(f=>`${f.prop}:${f.to}`).join(";"),A=document.createElement("style");A.setAttribute("data-ssd-animate",""),A.textContent=`@keyframes ${o}{from{${i}}to{${k}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,B=()=>u==="x"?window.innerWidth:window.innerHeight,z=()=>{let f=e.getBoundingClientRect();return ee({top:f.top,height:f.height},b(),B(),oe,se)};te(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:z});let Q={destroy(){e.classList.remove(o),A.remove(),e.style.animationPlayState="",G(),ne(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let K=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Z of h)e.style.setProperty(Z.prop,xe(Z.from,Z.to,K));},getProgress(){let{tStart:f,tEnd:K}=z();return w(W(b(),f,K,m))}};return Q}if(Ae())return Ie();let y=0,E=0,v=0,D=false,S=false,L=-1,$=0,V=false,x=NaN,j=-1,ce=0,le=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function me(){let o=be(ie,d,u),i=ee(o,o.scroll,Ce(),oe,se);y=i.tStart,E=i.tEnd;}function H(o){e.style.setProperty(Me,String(o));for(let i of h)e.style.setProperty(i.prop,xe(i.from,i.to,o));T?.(o);}function _e(o){if(isNaN(x)){x=o;return}x<=0&&o>0?C?.():x>0&&o<=0&&R?.(),x<1&&o>=1?F?.():x>=1&&o<1&&O?.(),x=o;}function q(){if(!D||S)return;let o=performance.now(),i=le(),k=m;if(g!==false){let B=o-ce,z=B>0?Math.abs(i-(j<0?i:j))/B:0;k=m*Math.max(.2,1+z*(typeof g=="number"?g:1)*.04);}j=i,ce=o;let A=E===y?0:(i-y)/(E-y);_e(A);let b=w(W(i,y,E,k));l&&(L=Math.max(L,b),b=L),$=b,H(b),b>=1&&!V?(V=true,P?.()):b<1&&!l&&(V=false),v=requestAnimationFrame(q);}me(),E===y&&Y("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 o=w(W(le(),y,E,m));l&&o>0&&(L=o),$=o,H(o);}let pe=new IntersectionObserver(o=>{o.forEach(i=>{D=i.isIntersecting,D&&!S?v=requestAnimationFrame(q):cancelAnimationFrame(v);});},{root:d??null}),U;function X(){clearTimeout(U),U=setTimeout(me,150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),pe.observe(e),te(e,{type:"animate",getProgress:()=>$,getTrigger:()=>({tStart:y,tEnd:E})}),{destroy(){cancelAnimationFrame(v),pe.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(U),G(),ne(e);},replay(){L=-1,V=false,$=0,S=false,H(0);},pause(){S=true,cancelAnimationFrame(v);},resume(){S&&(S=false,D&&(v=requestAnimationFrame(q)));},seek(o){let i=Math.min(1,Math.max(0,o));$=i,L=i,S=true,cancelAnimationFrame(v),H(i);},getProgress(){return $}}}var qe={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 Ue(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 Qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function re(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 Pe(e,t){let[n,r]=re(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function Ke(e){let t=NaN,n=0,r=0;return e.map(a=>{let s=a.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 Re={destroy:()=>{}};function lt(e,t={}){if(typeof window>"u")return Re;let n=Qe(e);if(!n.length)return Y("scrollReveal: no elements found:",e),Re;let{preset:r="fadeUp",from:a,stagger:s=.15,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=t,g={...qe[r],...a},M=Ue(g),I=u?.start??"top 88%",T=u?.end??"top 53%",P=Math.abs(re(I)[1]-re(T)[1]),C=Math.min(Math.max(s,0),1)*P,F=C>0?Ke(n):n.map(()=>0),O=n.map((R,_)=>{let w=Math.min(F[_]*C,P);return Te(R,{props:M,easing:m,once:l,native:false,trigger:w>0?{start:Pe(I,w),end:Pe(T,w)}:{start:I,end:T},onEnter:_===0?c:void 0,onLeave:_===n.length-1?p:void 0})});return {destroy(){O.forEach(R=>R.destroy());}}}exports.scrollReveal=lt;
|
package/dist/reveal/index.d.mts
CHANGED
|
@@ -39,9 +39,15 @@ interface ScrollRevealOptions {
|
|
|
39
39
|
/** Custom start state. Keys: opacity, x, y, scale, rotate, rotateX, rotateY. */
|
|
40
40
|
from?: ScrollRevealFrom;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* How far behind its neighbour each element in the same row starts, as a
|
|
43
|
+
* fraction of the reveal window (0–1). At `0.15` each card begins 15% of the
|
|
44
|
+
* way into the previous card's reveal; `0` reveals a row all at once.
|
|
45
|
+
*
|
|
46
|
+
* Rows are read from the layout: elements whose tops line up (a grid row, a
|
|
47
|
+
* line of badges) cascade one after another, and each new row starts its own
|
|
48
|
+
* count — its place further down the page already staggers it. A row's last
|
|
49
|
+
* element never starts more than one full window after its first. The offset
|
|
50
|
+
* applies on top of a custom `trigger` as well. Default: 0.15.
|
|
45
51
|
*/
|
|
46
52
|
stagger?: number;
|
|
47
53
|
/** Animation easing. Default: `'ease-out'`. */
|
package/dist/reveal/index.d.ts
CHANGED
|
@@ -39,9 +39,15 @@ interface ScrollRevealOptions {
|
|
|
39
39
|
/** Custom start state. Keys: opacity, x, y, scale, rotate, rotateX, rotateY. */
|
|
40
40
|
from?: ScrollRevealFrom;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* How far behind its neighbour each element in the same row starts, as a
|
|
43
|
+
* fraction of the reveal window (0–1). At `0.15` each card begins 15% of the
|
|
44
|
+
* way into the previous card's reveal; `0` reveals a row all at once.
|
|
45
|
+
*
|
|
46
|
+
* Rows are read from the layout: elements whose tops line up (a grid row, a
|
|
47
|
+
* line of badges) cascade one after another, and each new row starts its own
|
|
48
|
+
* count — its place further down the page already staggers it. A row's last
|
|
49
|
+
* element never starts more than one full window after its first. The offset
|
|
50
|
+
* applies on top of a custom `trigger` as well. Default: 0.15.
|
|
45
51
|
*/
|
|
46
52
|
stagger?: number;
|
|
47
53
|
/** Animation easing. Default: `'ease-out'`. */
|
package/dist/reveal/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function _e({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),i=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(a,c);m.push(p),i+=p;}let l=[0],u=0;for(let c=0;c<t;c++)u+=m[c]/i,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Ce({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/r)+1}var $={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:_e(),elastic:Ce()};function K(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function me(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function pe(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ne(e,n,t){return Math.min(t,Math.max(n,e))}function X(e,n,t,r){return t===n?0:Ne((e-n)/(t-n)*r,0,1)}function ge(e,n,t){let r=e.getBoundingClientRect(),a=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:t==="x"?r.left:r.top,height:a,scroll:t==="x"?window.scrollX:window.scrollY}}function Z(e,n,t,r,a){let i=me(e.top,e.height,n,r.element)-pe(r.viewport,t),m=me(e.top,e.height,n,a.element)-pe(a.viewport,t);return {tStart:i,tEnd:m}}function fe(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function de(e,n,t){let r=fe(e),a=fe(n);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*t)},${Math.round(r[1]+(a[1]-r[1])*t)},${Math.round(r[2]+(a[2]-r[2])*t)})`}var Fe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",be=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ve(e){let n=[];for(let t=0;t<be;t++){let r=t/(be-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function ye(e){switch(e){case "linear":return "linear";case "ease-in":return Fe;case "ease-out":return Oe;case "ease-in-out":return De()?Ve($["ease-in-out"]):null;default:return null}}var he=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[he]||(e[he]=new Map)}function J(e,n){we().set(e,n);}function ee(e){we().delete(e);}var He=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,...n){He&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Xe(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ee(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let a=[],i=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}n.push({fn:r[1],nums:a,units:i});}return n}function ke(e,n,t){let r=Ee(e),a=Ee(n);return r.length===0||r.length!==a.length?t<1?e:n:r.map((i,m)=>{let l=a[m];return i.fn!==l.fn||i.nums.length!==l.nums.length?t<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(l.nums[c]-u)*t}${i.units[c]}`).join(", ")})`}).join(" ")}function Se(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),a=String(n);if(Xe(r))return de(r,a,t);if(r.includes("("))return ke(r,a,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&m){let l=parseFloat(i[1]),u=parseFloat(m[1]);return `${l+(u-l)*t}${i[2]||m[2]}`}return t<1?r:a}function Be(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ze=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),We=0,ve="--scroll-draw-progress";function Ye(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function xe(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:a={},easing:i="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:B,onProgress:I,onComplete:w,onEnter:P,onLeave:A,onEnterBack:_,onLeaveBack:te}=n,Pe=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,z=typeof i=="function"?i:$[i]??$["ease-out"],ne=K(a.start??"top bottom"),re=K(a.end??"bottom top"),oe=B??e,d=typeof c=="string"?document.querySelector(c):c??null,y=Object.entries(r).map(([o,s])=>({prop:Be(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Te(){let o=window.getComputedStyle(e);for(let s of y)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Re(){for(let o of y)e.style.setProperty(o.prop,String(o.to));}let se=new Map;for(let o of [...y.map(s=>s.prop),ve])se.set(o,e.style.getPropertyValue(o));function W(){for(let[o,s]of se)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Pe)return Re(),w?.(),{...t,destroy:W,getProgress:()=>1};Te();let ie=typeof i=="string"?ye(i):null;function Le(){if(!p||!Ye()||!ie||u!=="y"||d||oe!==e||l||m!==1||I||w||P||A||_||te||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of y)if(!ze.has(o.prop))return false;return true}function Ae(){let o=`ssd-a-${++We}`,s=y.map(f=>`${f.prop}:${f.from}`).join(";"),D=y.map(f=>`${f.prop}:${f.to}`).join(";"),L=document.createElement("style");L.setAttribute("data-ssd-animate",""),L.textContent=`@keyframes ${o}{from{${s}}to{${D}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,V=()=>u==="x"?window.innerWidth:window.innerHeight,H=()=>{let f=e.getBoundingClientRect();return Z({top:f.top,height:f.height},b(),V(),ne,re)};J(e,{type:"animate",getProgress:()=>q.getProgress(),getTrigger:H});let q={destroy(){e.classList.remove(o),L.remove(),e.style.animationPlayState="",W(),ee(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let U=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Q of y)e.style.setProperty(Q.prop,Se(Q.from,Q.to,U));},getProgress(){let{tStart:f,tEnd:U}=H();return z(X(b(),f,U,m))}};return q}if(Le())return Ae();let h=0,E=0,S=0,C=false,v=false,T=-1,R=0,N=false,x=NaN,Y=-1,ae=0,ue=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=ge(oe,d,u),s=Z(o,o.scroll,$e(),ne,re);h=s.tStart,E=s.tEnd;}function F(o){e.style.setProperty(ve,String(o));for(let s of y)e.style.setProperty(s.prop,Se(s.from,s.to,o));I?.(o);}function Ie(o){if(isNaN(x)){x=o;return}x<=0&&o>0?P?.():x>0&&o<=0&&te?.(),x<1&&o>=1?A?.():x>=1&&o<1&&_?.(),x=o;}function G(){if(!C||v)return;let o=performance.now(),s=ue(),D=m;if(g!==false){let V=o-ae,H=V>0?Math.abs(s-(Y<0?s:Y))/V:0;D=m*Math.max(.2,1+H*(typeof g=="number"?g:1)*.04);}Y=s,ae=o;let L=E===h?0:(s-h)/(E-h);Ie(L);let b=z(X(s,h,E,D));l&&(T=Math.max(T,b),b=T),R=b,F(b),b>=1&&!N?(N=true,w?.()):b<1&&!l&&(N=false),S=requestAnimationFrame(G);}ce(),E===h&&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);{let o=z(X(ue(),h,E,m));l&&o>0&&(T=o),R=o,F(o);}let le=new IntersectionObserver(o=>{o.forEach(s=>{C=s.isIntersecting,C&&!v?S=requestAnimationFrame(G):cancelAnimationFrame(S);});},{root:d??null}),j;function O(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),le.observe(e),J(e,{type:"animate",getProgress:()=>R,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(S),le.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(j),W(),ee(e);},replay(){T=-1,N=false,R=0,v=false,F(0);},pause(){v=true,cancelAnimationFrame(S);},resume(){v&&(v=false,C&&(S=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));R=s,T=s,v=true,cancelAnimationFrame(S),F(s);},getProgress(){return R}}}var Ge={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 je(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var Me={destroy:()=>{}};function at(e,n={}){if(typeof window>"u")return Me;let t=qe(e);if(!t.length)return k("scrollReveal: no elements found:",e),Me;let{preset:r="fadeUp",from:a,stagger:i=.08,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=n,g={...Ge[r],...a},M=je(g),B=Math.min(i*4,4),I=t.map((w,P)=>{let A=Math.max(50,88-P*B),_=Math.max(20,A-35);return xe(w,{props:M,easing:m,once:l,native:false,trigger:u??{start:`top ${A}%`,end:`top ${_}%`},onEnter:P===0?c:void 0,onLeave:P===t.length-1?p:void 0})});return {destroy(){I.forEach(w=>w.destroy());}}}export{at as scrollReveal};
|
|
1
|
+
function Ne({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),a=Math.sqrt(r),s=0,m=[];for(let c=0;c<n;c++){let p=Math.pow(a,c);m.push(p),s+=p;}let l=[0],u=0;for(let c=0;c<n;c++)u+=m[c]/s,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Fe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),a=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-a)*(2*Math.PI)/r)+1}var N={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:Ne(),elastic:Fe()};function J(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 fe(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 ge(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 Oe(e,t,n){return Math.min(n,Math.max(t,e))}function W(e,t,n,r){return n===t?0:Oe((e-t)/(n-t)*r,0,1)}function be(e,t,n){let r=e.getBoundingClientRect(),a=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:a,scroll:0}:{top:n==="x"?r.left:r.top,height:a,scroll:n==="x"?window.scrollX:window.scrollY}}function ee(e,t,n,r,a){let s=fe(e.top,e.height,t,r.element)-ge(r.viewport,n),m=fe(e.top,e.height,t,a.element)-ge(a.viewport,n);return {tStart:s,tEnd:m}}function de(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 he(e,t,n){let r=de(e),a=de(t);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*n)},${Math.round(r[1]+(a[1]-r[1])*n)},${Math.round(r[2]+(a[2]-r[2])*n)})`}var De="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ve="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",ye=33;function He(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Xe(e){let t=[];for(let n=0;n<ye;n++){let r=n/(ye-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function we(e){switch(e){case "linear":return "linear";case "ease-in":return De;case "ease-out":return Ve;case "ease-in-out":return He()?Xe(N["ease-in-out"]):null;default:return null}}var Ee=Symbol.for("svg-scroll-draw.registry");function ve(){let e=globalThis;return e[Ee]||(e[Ee]=new Map)}function te(e,t){ve().set(e,t);}function ne(e){ve().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 Y(e,...t){ke&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function Be(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Se(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let a=[],s=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),s.push(u?u[2]:"");}t.push({fn:r[1],nums:a,units:s});}return t}function ze(e,t,n){let r=Se(e),a=Se(t);return r.length===0||r.length!==a.length?n<1?e:t:r.map((s,m)=>{let l=a[m];return s.fn!==l.fn||s.nums.length!==l.nums.length?n<1?`${s.fn}(${s.nums.map((u,c)=>`${u}${s.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((u,c)=>`${u+(l.nums[c]-u)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function xe(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),a=String(t);if(Be(r))return he(r,a,n);if(r.includes("("))return ze(r,a,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(s&&m){let l=parseFloat(s[1]),u=parseFloat(m[1]);return `${l+(u-l)*n}${s[2]||m[2]}`}return n<1?r:a}function We(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Ye=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ge=0,Me="--scroll-draw-progress";function je(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function Te(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:r,trigger:a={},easing:s="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:I,onProgress:T,onComplete:P,onEnter:C,onLeave:F,onEnterBack:O,onLeaveBack:R}=t,_=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,w=typeof s=="function"?s:N[s]??N["ease-out"],oe=J(a.start??"top bottom"),se=J(a.end??"bottom top"),ie=I??e,d=typeof c=="string"?document.querySelector(c):c??null,h=Object.entries(r).map(([o,i])=>({prop:We(o),from:Array.isArray(i)?i[0]:"",to:Array.isArray(i)?i[1]:i}));function Le(){let o=window.getComputedStyle(e);for(let i of h)i.from===""&&(i.from=o.getPropertyValue(i.prop).trim()||"0");}function $e(){for(let o of h)e.style.setProperty(o.prop,String(o.to));}let ae=new Map;for(let o of [...h.map(i=>i.prop),Me])ae.set(o,e.style.getPropertyValue(o));function G(){for(let[o,i]of ae)i?e.style.setProperty(o,i):e.style.removeProperty(o);}if(_)return $e(),P?.(),{...n,destroy:G,getProgress:()=>1};Le();let ue=typeof s=="string"?we(s):null;function Ae(){if(!p||!je()||!ue||u!=="y"||d||ie!==e||l||m!==1||T||P||C||F||O||R||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of h)if(!Ye.has(o.prop))return false;return true}function Ie(){let o=`ssd-a-${++Ge}`,i=h.map(f=>`${f.prop}:${f.from}`).join(";"),k=h.map(f=>`${f.prop}:${f.to}`).join(";"),A=document.createElement("style");A.setAttribute("data-ssd-animate",""),A.textContent=`@keyframes ${o}{from{${i}}to{${k}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ue};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,B=()=>u==="x"?window.innerWidth:window.innerHeight,z=()=>{let f=e.getBoundingClientRect();return ee({top:f.top,height:f.height},b(),B(),oe,se)};te(e,{type:"animate",getProgress:()=>Q.getProgress(),getTrigger:z});let Q={destroy(){e.classList.remove(o),A.remove(),e.style.animationPlayState="",G(),ne(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let K=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Z of h)e.style.setProperty(Z.prop,xe(Z.from,Z.to,K));},getProgress(){let{tStart:f,tEnd:K}=z();return w(W(b(),f,K,m))}};return Q}if(Ae())return Ie();let y=0,E=0,v=0,D=false,S=false,L=-1,$=0,V=false,x=NaN,j=-1,ce=0,le=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function me(){let o=be(ie,d,u),i=ee(o,o.scroll,Ce(),oe,se);y=i.tStart,E=i.tEnd;}function H(o){e.style.setProperty(Me,String(o));for(let i of h)e.style.setProperty(i.prop,xe(i.from,i.to,o));T?.(o);}function _e(o){if(isNaN(x)){x=o;return}x<=0&&o>0?C?.():x>0&&o<=0&&R?.(),x<1&&o>=1?F?.():x>=1&&o<1&&O?.(),x=o;}function q(){if(!D||S)return;let o=performance.now(),i=le(),k=m;if(g!==false){let B=o-ce,z=B>0?Math.abs(i-(j<0?i:j))/B:0;k=m*Math.max(.2,1+z*(typeof g=="number"?g:1)*.04);}j=i,ce=o;let A=E===y?0:(i-y)/(E-y);_e(A);let b=w(W(i,y,E,k));l&&(L=Math.max(L,b),b=L),$=b,H(b),b>=1&&!V?(V=true,P?.()):b<1&&!l&&(V=false),v=requestAnimationFrame(q);}me(),E===y&&Y("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 o=w(W(le(),y,E,m));l&&o>0&&(L=o),$=o,H(o);}let pe=new IntersectionObserver(o=>{o.forEach(i=>{D=i.isIntersecting,D&&!S?v=requestAnimationFrame(q):cancelAnimationFrame(v);});},{root:d??null}),U;function X(){clearTimeout(U),U=setTimeout(me,150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),pe.observe(e),te(e,{type:"animate",getProgress:()=>$,getTrigger:()=>({tStart:y,tEnd:E})}),{destroy(){cancelAnimationFrame(v),pe.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(U),G(),ne(e);},replay(){L=-1,V=false,$=0,S=false,H(0);},pause(){S=true,cancelAnimationFrame(v);},resume(){S&&(S=false,D&&(v=requestAnimationFrame(q)));},seek(o){let i=Math.min(1,Math.max(0,o));$=i,L=i,S=true,cancelAnimationFrame(v),H(i);},getProgress(){return $}}}var qe={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 Ue(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 Qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function re(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 Pe(e,t){let[n,r]=re(e);return `${n} ${+Math.max(0,r-t).toFixed(3)}%`}function Ke(e){let t=NaN,n=0,r=0;return e.map(a=>{let s=a.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 Re={destroy:()=>{}};function lt(e,t={}){if(typeof window>"u")return Re;let n=Qe(e);if(!n.length)return Y("scrollReveal: no elements found:",e),Re;let{preset:r="fadeUp",from:a,stagger:s=.15,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=t,g={...qe[r],...a},M=Ue(g),I=u?.start??"top 88%",T=u?.end??"top 53%",P=Math.abs(re(I)[1]-re(T)[1]),C=Math.min(Math.max(s,0),1)*P,F=C>0?Ke(n):n.map(()=>0),O=n.map((R,_)=>{let w=Math.min(F[_]*C,P);return Te(R,{props:M,easing:m,once:l,native:false,trigger:w>0?{start:Pe(I,w),end:Pe(T,w)}:{start:I,end:T},onEnter:_===0?c:void 0,onLeave:_===n.length-1?p:void 0})});return {destroy(){O.forEach(R=>R.destroy());}}}export{lt as scrollReveal};
|
package/dist/solid/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var solidJs=require('solid-js');function Wt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let
|
|
1
|
+
'use strict';var solidJs=require('solid-js');function Wt({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let M=1-Math.pow(t,T);return M+(1-M)*(2*V-1)*(2*V-1)}return 1}}function Bt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Wt(),elastic:Bt()};function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function Et(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function St(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function qe(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Gt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:Gt((e-n)/(r-n)*t,0,1)}function Je(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=Et(e.top,e.height,n,t.element)-St(t.viewport,r),c=Et(e.top,e.height,n,l.element)-St(l.viewport,r);return {tStart:s,tEnd:c}}function Tt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function We(e,n,r){let t=Tt(e),l=Tt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var xt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...n){je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var jt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Yt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function Ut(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Xt(e){let n=[];for(let r=0;r<Mt;r++){let t=r/(Mt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return jt;case "ease-out":return Yt;case "ease-in-out":return Ut()?Xt(re["ease-in-out"]):null;default:return null}}var At=Symbol.for("svg-scroll-draw.registry");function Lt(){let e=globalThis;return e[At]||(e[At]=new Map)}function Le(e,n){Lt().set(e,n);}function $e(e){Lt().delete(e);}var Qt=0;function Zt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function $t(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Pt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Kt(e){if(!je)return;let n=$t(e,"stroke");if(!n||n==="none"){we("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Pt.has(r)&&!Pt.has($t(e,"fill"))&&we("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Jt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,It=/[MmLlHhVvCcSsQqTtAaZz]/g;function er(e,n,r){if(!je)return;let t=(e.match(It)??[]).join("").toUpperCase(),l=(n.match(It)??[]).join("").toUpperCase(),s=(e.match(Ct)??[]).length,c=(n.match(Ct)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...xt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:$="forward",once:ne=false,debug:Pe=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:P,fillOpacity:A,waypoints:w,velocityScale:k=false,threshold:O=0,rootMargin:C="0px",repeat:E=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:L,onLeave:S,onEnterBack:F,onLeaveBack:fe}=l,Q=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Ce=de(T.start??"top bottom"),ze=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(P)?P[0]:null,j=Array.isArray(P)?P[1]:typeof P=="number"?P:null,pe=Array.isArray(A)?A[0]:null,Z=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function Ie(o){let a=o*100;switch(Q){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=Q?[]:Array.from(e.querySelectorAll(c)),I=[],i=[],f=0,ge=0,R=false,_=false,q=0,Me=false,ye=-1,te=-1,Y=false,he=0,He=0,Re,tt=null;function pt(){tt?.destroy(),tt=null;}let Ne=new Set,dt=NaN,Ve=true,Ye=-1,gt=performance.now(),_e=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function yt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Je(e,ve,B);return xe(o,o.scroll,yt(),Ce,ze)}function bt(){(({tStart:f,tEnd:ge}=ht())),Pe&&je&&(pt(),tt=Jt(f,ge,B));}function nt(o,a=ht){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Vt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),Q){let b=a==="reverse"?1-o:o;e.style.clipPath=Ie(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${I[ue]*o}`:`${I[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=We(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*o}`:Z!==null&&(b.style.fillOpacity=`${Z}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Ie(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=$==="reverse"?"0":`${I[a]}`,m?o.style.opacity=$==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{Kt(o);let a=qe(o);I.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?er(i[i.length-1],D,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=$==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=$==="reverse"?"0":`${a}`,m?o.style.opacity=$==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Ie(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ie(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let wt=typeof p=="string"?et(p):null;function zt(){return !(ae===false||!Zt()||!z.length||!wt||Q||B!=="y"||ve||u!==1||V!==0||ne||X||k!==false||D||w||E||G>0||d||x||g||L||S||F||fe||M!=null||P!=null||A!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function _t(){let o=++Qt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=$==="reverse"?"0":"var(--ssd-len)",ke=$==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${$==="reverse"?1:0};`,v+=`opacity:${$==="reverse"?0:1};`);let H=document.createElement("style");H.setAttribute("data-svg-scroll-draw",""),H.textContent=`@keyframes ${a}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${wt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},rt(),yt(),Ce,ze);return Se(K(rt(),U,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),H.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));N=U,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=$==="reverse"?`${I[be]*U}`:`${I[be]*(1-U)}`,m&&(Te.style.opacity=$==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){z.forEach((y,U)=>{I[U]=qe(y),y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`;});}}}if(zt())return nt(_t());function qt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Fe(h){let N=true;if(Q){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Ie($==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let U=y*V*o,Te=Math.min(1,Math.max(0,(h-U)/o)),be=Se(Te);W.style.strokeDashoffset=$==="reverse"?`${I[y]*be}`:`${I[y]*(1-be)}`,m&&(W.style.opacity=$==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=We(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Z!==null?W.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(W.style.fillOpacity=`${Z}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],D,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let U in w){let Te=parseFloat(U);y>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[U]?.());}}return N}function ke(h){if(Y)return;let N=h-a;_||(_=true,x?.());let W=Fe(N);if(W&&!R){R=true,Fe(o*(1+Math.max(0,z.length-1)*V)),g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{a=performance.now(),_=false,R=false,Ne.clear(),Ue(),q=requestAnimationFrame(ke);},oe));return}W||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(Re),a=performance.now(),b=0,Y=false,_=false,R=false,He=0,ue=true,he=0,Ne.clear(),Ue(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&R)?Ae():!N.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(Re),ue=false);});},{root:ve??null,threshold:O,rootMargin:C}),H;function me(){clearTimeout(H),H=setTimeout(()=>{z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Re),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(H);},replay(){He=0,Ae();},pause(){Y||!ue||(Y=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){Y&&(Y=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let N=Math.min(1,Math.max(0,h));he=N,Y=true,b=N*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return he},refresh(){clearTimeout(H),z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});}}}if(ie)return nt(qt());bt();function Xe(){if(!Me||Y)return;let o=performance.now(),a=rt();if(!Ve&&k===false&&a===dt){q=requestAnimationFrame(Xe);return}Ve=false,dt=a;let b=u;if(k!==false){let v=o-gt,H=v>0?Math.abs(a-(Ye<0?a:Ye))/v:0;b=u*Math.max(.2,1+H*(typeof k=="number"?k:1)*.04);}Ye=a,gt=o;let ue=X?te===-1||a>=te?"forward":"reverse":$;te=a;let Fe=ge-f,ke=true,Ae=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Ae>0?L?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&F?.()),_e=Ae,Q){let v=Se(K(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let H=ue==="reverse"?1-v:v;e.style.clipPath=Ie(H),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,e.style.clipPath=Ie(0);},oe))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Xe);return}if(z.forEach((v,H)=>{let me=H*V*Fe,h=Se(K(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${I[H]*h}`:`${I[H]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=We(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*h}`:Z!==null&&(v.style.fillOpacity=`${Z}`),D&&v.tagName.toLowerCase()==="path"&&i[H]&&v.setAttribute("d",it(i[H],D,h)),H===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=Se(K(a,f,ge,b));for(let H in w){let me=parseFloat(H);v>=me&&!Ne.has(me)&&(Ne.add(me),w[H]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,Ne.clear(),Ue(),Ve=true;},oe))):!ke&&!ne&&(R=false),q=requestAnimationFrame(Xe);}let ot=false;function Qe(){ot||(ot=true,q=requestAnimationFrame(function(){Xe();}));}function Ze(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Me=a.isIntersecting,Me&&!Y?(Ve=true,Qe()):Ze();});},{root:ve??null,threshold:O,rootMargin:C});function vt(){z.forEach((o,a)=>{I[a]=qe(o),o.style.strokeDasharray=`${I[a]}`;}),bt(),Ve=true;}let Ke;function Be(){clearTimeout(Ke),Ke=setTimeout(vt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),G>0?setTimeout(()=>st.observe(e),G):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Re),Ze(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ke),pt();},replay(){ye=-1,te=-1,Ye=-1,_=false,R=false,He=0,Y=false,he=0,Ne.clear(),clearTimeout(Re),Ue(),Ve=true,Me&&Qe();},pause(){Y=true,Ze();},resume(){Y&&(Y=false,Ve=true,Me&&Qe());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,Y=true,Ze(),Vt(a,$),Ve=true;},getProgress(){return he},refresh(){clearTimeout(Ke),vt(),Me&&!Y&&Qe();}},()=>({tStart:f,tEnd:ge}))}function tr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function kt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function rr(e,n,r){let t=kt(e),l=kt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function Ot(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(tr(t))return We(t,l,r);if(t.includes("("))return rr(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function nr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var or=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),sr=0,Dt="--scroll-draw-progress";function ir(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function lt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:$=true,triggerElement:ne,onProgress:Pe,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,P=$&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),O=ne??e,C=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:nr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),Dt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(P)return D(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?et(s):null;function ae(){if(!T||!ir()||!ee||m!=="y"||C||O!==e||u||c!==1||Pe||B||J||X||G||M||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!or.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++sr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},_(),q(),w,k)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let Y=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,Ot(he.from,he.to,Y));},getProgress(){let{tStart:te,tEnd:Y}=Me();return A(K(_(),te,Y,c))}};return ye}if(ae())return d();let x=0,g=0,L=0,S=false,F=false,fe=-1,Q=0,Se=false,Ce=NaN,ze=-1,ve=0,Ee=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Je(O,C,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Dt,String(i));for(let f of E)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Pe?.(i);}function pe(i){if(isNaN(Ce)){Ce=i;return}Ce<=0&&i>0?J?.():Ce>0&&i<=0&&M?.(),Ce<1&&i>=1?X?.():Ce>=1&&i<1&&G?.(),Ce=i;}function Z(){if(!S||F)return;let i=performance.now(),f=Ee(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(ze<0?f:ze))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}ze=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let _=A(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Se?(Se=true,B?.()):_<1&&!u&&(Se=false),L=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=A(K(Ee(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let Ie=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!F?L=requestAnimationFrame(Z):cancelAnimationFrame(L);});},{root:C??null}),z;function I(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Ie.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(L),Ie.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(z),ie(),$e(e);},replay(){fe=-1,Se=false,Q=0,F=false,j(0);},pause(){F=true,cancelAnimationFrame(L);},resume(){F&&(F=false,S&&(L=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,F=true,cancelAnimationFrame(L),j(f);},getProgress(){return Q}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ct;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,$=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Pe=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=$(s),V?.(),ct;let X=0,G=0,M=0,P=false,A=false,w=-1,k=0,O=false,C=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},C(),E(),Pe,B);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=$(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!P||A)return;let d=ne(K(C(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,D(d),d>=1&&!O?(O=true,V?.()):d<1&&!p&&(O=false),M=requestAnimationFrame(se);}oe();{let d=ne(K(C(),X,G,1));p&&d>0&&(w=d),k=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{P=x.isIntersecting,P&&!A?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,O=false,k=0,A=false,D(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,P&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,A=true,cancelAnimationFrame(M),D(x);},getProgress(){return k}}}var Ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return Ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Ht;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,$=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Pe=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,M=0,P=0,A=false,w=false,k=-1,O=0,C=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),F=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,Q=xe({top:F,height:fe},oe(),D(),Pe,B);G=Q.tStart,M=Q.tEnd;}let ie=NaN;function ee(S){if(!E)return;let F=X??t.duration??0,fe=J+(F-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!A||w||!E)return;let S=ne(K(oe(),G,M,1));c&&(k=Math.max(k,S),S=k),O=S,ee(S),S>=1&&!C?(C=true,T?.()):S<1&&!c&&(C=false),P=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),$){ee(1),p?.();return}se(),p?.(),A&&!w&&(P=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(F=>{A=F.isIntersecting,A&&!w&&E?P=requestAnimationFrame(ae):cancelAnimationFrame(P);});}),g;function L(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),x.observe(t),Le(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(P),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(g),$e(t);},replay(){k=-1,C=false,O=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(P);},resume(){w&&(w=false,A&&E&&(P=requestAnimationFrame(ae)));},seek(S){let F=Math.min(1,Math.max(0,S));O=F,k=F,w=true,cancelAnimationFrame(P),ie=NaN,ee(F);},getProgress(){return O}}}function Nt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function ar(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Ft(e){let n=Nt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function lr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function cr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Rt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,n={}){if(typeof window>"u")return Rt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Rt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Pe=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=ar(t):l==="lines"?J=Ft(t):J=Nt(t);let X=J.length;function G(g,L){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*L));let S=cr(L,u);S&&(g.style.transform=S);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((L,S)=>{let F=$(lr(g,S,X,s));G(L,F);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let P=0,A=0,w=0,k=false,O=false,C=-1,E=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),L=xe({top:g.top,height:g.height},D(),se(),ne,Pe);P=L.tStart,A=L.tEnd;}function ee(){if(!k||O)return;let g=K(D(),P,A,1);p&&(C=Math.max(C,g),g=C),E=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach(L=>{k=L.isIntersecting,k&&!O?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Ft(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:A})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){C=-1,oe=false,E=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let L=Math.min(1,Math.max(0,g));E=L,C=L,O=true,cancelAnimationFrame(w),M(L);},getProgress(){return E}}}function Gr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=at(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function jr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=at(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Yr(e){let n,r;return solidJs.onMount(()=>{n&&(r=lt(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Ur(e){let n,r;return solidJs.onMount(()=>{n&&(r=lt(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Xr(e){let n,r;return solidJs.onMount(()=>{n&&(r=ut(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Qr(e){let n,r;return solidJs.onMount(()=>{n&&(r=ut(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Zr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=mt(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Kr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=mt(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Jr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=ft(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function en(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=ft(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}exports.createScrollAnimate=Ur;exports.createScrollCounter=Qr;exports.createScrollDraw=jr;exports.createScrollText=en;exports.createScrollVideo=Kr;exports.useScrollAnimate=Yr;exports.useScrollCounter=Xr;exports.useScrollDraw=Gr;exports.useScrollText=Jr;exports.useScrollVideo=Zr;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var Ct=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,It=/[MmLlHhVvCcSsQqTtAaZz]/g;function er(e,n,r){if(!je)return;let t=(e.match(It)??[]).join("").toUpperCase(),l=(n.match(It)??[]).join("").toUpperCase(),s=(e.match(Ct)??[]).length,c=(n.match(Ct)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...xt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:M="forward",once:ne=false,debug:Pe=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:A,strokeWidth:P,fillOpacity:L,waypoints:w,velocityScale:k=false,threshold:O=0,rootMargin:C="0px",repeat:E=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:$,onLeave:S,onEnterBack:F,onLeaveBack:fe}=l,Q=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Ce=de(T.start??"top bottom"),ze=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(A)?A[0]:null,le=Array.isArray(A)?A[1]:typeof A=="string"?A:null,ce=Array.isArray(P)?P[0]:null,j=Array.isArray(P)?P[1]:typeof P=="number"?P:null,pe=Array.isArray(L)?L[0]:null,Z=Array.isArray(L)?L[1]:typeof L=="number"?L:null;function Ie(o){let a=o*100;switch(Q){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=Q?[]:Array.from(e.querySelectorAll(c)),I=[],i=[],f=0,ge=0,R=false,_=false,q=0,Me=false,ye=-1,te=-1,Y=false,he=0,He=0,Re,tt=null;function pt(){tt?.destroy(),tt=null;}let Ne=new Set,dt=NaN,Ve=true,Ye=-1,gt=performance.now(),_e=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function yt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Je(e,ve,B);return xe(o,o.scroll,yt(),Ce,ze)}function bt(){(({tStart:f,tEnd:ge}=ht())),Pe&&je&&(pt(),tt=Jt(f,ge,B));}function nt(o,a=ht){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Vt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),Q){let b=a==="reverse"?1-o:o;e.style.clipPath=Ie(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${I[ue]*o}`:`${I[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=We(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*o}`:Z!==null&&(b.style.fillOpacity=`${Z}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],D,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Ie(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=M==="reverse"?"0":`${I[a]}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{Kt(o);let a=qe(o);I.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?er(i[i.length-1],D,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=M==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=M==="reverse"?"0":`${a}`,m?o.style.opacity=M==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Ie(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ie(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let wt=typeof p=="string"?et(p):null;function zt(){return !(ae===false||!Zt()||!z.length||!wt||Q||B!=="y"||ve||u!==1||V!==0||ne||X||k!==false||D||w||E||G>0||d||x||g||$||S||F||fe||A!=null||P!=null||L!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function _t(){let o=++Qt,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=M==="reverse"?"0":"var(--ssd-len)",ke=M==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${M==="reverse"?1:0};`,v+=`opacity:${M==="reverse"?0:1};`);let H=document.createElement("style");H.setAttribute("data-svg-scroll-draw",""),H.textContent=`@keyframes ${a}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${wt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},rt(),yt(),Ce,ze);return Se(K(rt(),U,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),H.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));N=U,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=M==="reverse"?`${I[be]*U}`:`${I[be]*(1-U)}`,m&&(Te.style.opacity=M==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){z.forEach((y,U)=>{I[U]=qe(y),y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`;});}}}if(zt())return nt(_t());function qt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Fe(h){let N=true;if(Q){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Ie(M==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let U=y*V*o,Te=Math.min(1,Math.max(0,(h-U)/o)),be=Se(Te);W.style.strokeDashoffset=M==="reverse"?`${I[y]*be}`:`${I[y]*(1-be)}`,m&&(W.style.opacity=M==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=We(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Z!==null?W.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(W.style.fillOpacity=`${Z}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],D,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let U in w){let Te=parseFloat(U);y>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[U]?.());}}return N}function ke(h){if(Y)return;let N=h-a;_||(_=true,x?.());let W=Fe(N);if(W&&!R){R=true,Fe(o*(1+Math.max(0,z.length-1)*V)),g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{a=performance.now(),_=false,R=false,Ne.clear(),Ue(),q=requestAnimationFrame(ke);},oe));return}W||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(Re),a=performance.now(),b=0,Y=false,_=false,R=false,He=0,ue=true,he=0,Ne.clear(),Ue(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&R)?Ae():!N.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(Re),ue=false);});},{root:ve??null,threshold:O,rootMargin:C}),H;function me(){clearTimeout(H),H=setTimeout(()=>{z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Re),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(H);},replay(){He=0,Ae();},pause(){Y||!ue||(Y=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){Y&&(Y=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let N=Math.min(1,Math.max(0,h));he=N,Y=true,b=N*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return he},refresh(){clearTimeout(H),z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});}}}if(ie)return nt(qt());bt();function Xe(){if(!Me||Y)return;let o=performance.now(),a=rt();if(!Ve&&k===false&&a===dt){q=requestAnimationFrame(Xe);return}Ve=false,dt=a;let b=u;if(k!==false){let v=o-gt,H=v>0?Math.abs(a-(Ye<0?a:Ye))/v:0;b=u*Math.max(.2,1+H*(typeof k=="number"?k:1)*.04);}Ye=a,gt=o;let ue=X?te===-1||a>=te?"forward":"reverse":M;te=a;let Fe=ge-f,ke=true,Ae=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Ae>0?$?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&F?.()),_e=Ae,Q){let v=Se(K(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let H=ue==="reverse"?1-v:v;e.style.clipPath=Ie(H),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,e.style.clipPath=Ie(0);},oe))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Xe);return}if(z.forEach((v,H)=>{let me=H*V*Fe,h=Se(K(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${I[H]*h}`:`${I[H]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=We(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*h}`:Z!==null&&(v.style.fillOpacity=`${Z}`),D&&v.tagName.toLowerCase()==="path"&&i[H]&&v.setAttribute("d",it(i[H],D,h)),H===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=Se(K(a,f,ge,b));for(let H in w){let me=parseFloat(H);v>=me&&!Ne.has(me)&&(Ne.add(me),w[H]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,Ne.clear(),Ue(),Ve=true;},oe))):!ke&&!ne&&(R=false),q=requestAnimationFrame(Xe);}let ot=false;function Qe(){ot||(ot=true,q=requestAnimationFrame(function(){Xe();}));}function Ze(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Me=a.isIntersecting,Me&&!Y?(Ve=true,Qe()):Ze();});},{root:ve??null,threshold:O,rootMargin:C});function vt(){z.forEach((o,a)=>{I[a]=qe(o),o.style.strokeDasharray=`${I[a]}`;}),bt(),Ve=true;}let Ke;function Be(){clearTimeout(Ke),Ke=setTimeout(vt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),G>0?setTimeout(()=>st.observe(e),G):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Re),Ze(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ke),pt();},replay(){ye=-1,te=-1,Ye=-1,_=false,R=false,He=0,Y=false,he=0,Ne.clear(),clearTimeout(Re),Ue(),Ve=true,Me&&Qe();},pause(){Y=true,Ze();},resume(){Y&&(Y=false,Ve=true,Me&&Qe());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,Y=true,Ze(),Vt(a,M),Ve=true;},getProgress(){return he},refresh(){clearTimeout(Ke),vt(),Me&&!Y&&Qe();}},()=>({tStart:f,tEnd:ge}))}function tr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function kt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function rr(e,n,r){let t=kt(e),l=kt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function Ot(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(tr(t))return We(t,l,r);if(t.includes("("))return rr(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function nr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var or=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),sr=0,Dt="--scroll-draw-progress";function ir(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function lt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:M=true,triggerElement:ne,onProgress:Pe,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:A}=n,P=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),O=ne??e,C=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:nr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),Dt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(P)return D(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?et(s):null;function ae(){if(!T||!ir()||!ee||m!=="y"||C||O!==e||u||c!==1||Pe||B||J||X||G||A||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!or.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++sr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},_(),q(),w,k)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let Y=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,Ot(he.from,he.to,Y));},getProgress(){let{tStart:te,tEnd:Y}=Me();return L(K(_(),te,Y,c))}};return ye}if(ae())return d();let x=0,g=0,$=0,S=false,F=false,fe=-1,Q=0,Se=false,Ce=NaN,ze=-1,ve=0,Ee=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Je(O,C,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(Dt,String(i));for(let f of E)e.style.setProperty(f.prop,Ot(f.from,f.to,i));Pe?.(i);}function pe(i){if(isNaN(Ce)){Ce=i;return}Ce<=0&&i>0?J?.():Ce>0&&i<=0&&A?.(),Ce<1&&i>=1?X?.():Ce>=1&&i<1&&G?.(),Ce=i;}function Z(){if(!S||F)return;let i=performance.now(),f=Ee(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(ze<0?f:ze))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}ze=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let _=L(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Se?(Se=true,B?.()):_<1&&!u&&(Se=false),$=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=L(K(Ee(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let Ie=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!F?$=requestAnimationFrame(Z):cancelAnimationFrame($);});},{root:C??null}),z;function I(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Ie.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame($),Ie.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(z),ie(),$e(e);},replay(){fe=-1,Se=false,Q=0,F=false,j(0);},pause(){F=true,cancelAnimationFrame($);},resume(){F&&(F=false,S&&($=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,F=true,cancelAnimationFrame($),j(f);},getProgress(){return Q}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ct;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,M=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Pe=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=M(s),V?.(),ct;let X=0,G=0,A=0,P=false,L=false,w=-1,k=0,O=false,C=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},C(),E(),Pe,B);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=M(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!P||L)return;let d=ne(K(C(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,D(d),d>=1&&!O?(O=true,V?.()):d<1&&!p&&(O=false),A=requestAnimationFrame(se);}oe();{let d=ne(K(C(),X,G,1));p&&d>0&&(w=d),k=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{P=x.isIntersecting,P&&!L?A=requestAnimationFrame(se):cancelAnimationFrame(A);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(A),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,O=false,k=0,L=false,D(0);},pause(){L=true,cancelAnimationFrame(A);},resume(){L&&(L=false,P&&(A=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,L=true,cancelAnimationFrame(A),D(x);},getProgress(){return k}}}var Ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return Ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Ht;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,M=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Pe=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,A=0,P=0,L=false,w=false,k=-1,O=0,C=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),F=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,Q=xe({top:F,height:fe},oe(),D(),Pe,B);G=Q.tStart,A=Q.tEnd;}let ie=NaN;function ee(S){if(!E)return;let F=X??t.duration??0,fe=J+(F-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!L||w||!E||M)return;let S=ne(K(oe(),G,A,1));c&&(k=Math.max(k,S),S=k),O=S,ee(S),S>=1&&!C?(C=true,T?.()):S<1&&!c&&(C=false),P=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),M){ee(1),p?.();return}se(),p?.(),L&&!w&&(P=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(F=>{L=F.isIntersecting,L&&!w&&E?P=requestAnimationFrame(ae):cancelAnimationFrame(P);});}),g;function $(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",$),window.addEventListener("orientationchange",$),x.observe(t),Le(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:G,tEnd:A})}),{destroy(){cancelAnimationFrame(P),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",$),window.removeEventListener("orientationchange",$),clearTimeout(g),$e(t);},replay(){k=-1,C=false,O=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(P);},resume(){w&&(w=false,L&&E&&(P=requestAnimationFrame(ae)));},seek(S){let F=Math.min(1,Math.max(0,S));O=F,k=F,w=true,cancelAnimationFrame(P),ie=NaN,ee(F);},getProgress(){return O}}}function Nt(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(r)?(t.textContent=r,t.style.whiteSpace="pre"):(t.textContent=r,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(r)?null:t}).filter(r=>r!==null)}function ar(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Ft(e){let n=Nt(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function lr(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function cr(e,n){let r=[];if(n?.y!==void 0&&r.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&r.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&r.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let t=n.scale+(1-n.scale)*e;r.push(`scale(${t})`);}return r.join(" ")||""}var Rt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,n={}){if(typeof window>"u")return Rt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Rt;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Pe=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=ar(t):l==="lines"?J=Ft(t):J=Nt(t);let X=J.length;function G(g,$){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*$));let S=cr($,u);S&&(g.style.transform=S);}function A(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach(($,S)=>{let F=M(lr(g,S,X,s));G($,F);});}if(V)return A(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};A(0);let P=0,L=0,w=0,k=false,O=false,C=-1,E=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),$=xe({top:g.top,height:g.height},D(),se(),ne,Pe);P=$.tStart,L=$.tEnd;}function ee(){if(!k||O)return;let g=K(D(),P,L,1);p&&(C=Math.max(C,g),g=C),E=g,A(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach($=>{k=$.isIntersecting,k&&!O?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Ft(t),A(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:P,tEnd:L})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){C=-1,oe=false,E=0,O=false,A(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let $=Math.min(1,Math.max(0,g));E=$,C=$,O=true,cancelAnimationFrame(w),A($);},getProgress(){return E}}}function Gr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=at(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function jr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=at(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Yr(e){let n,r;return solidJs.onMount(()=>{n&&(r=lt(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Ur(e){let n,r;return solidJs.onMount(()=>{n&&(r=lt(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Xr(e){let n,r;return solidJs.onMount(()=>{n&&(r=ut(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Qr(e){let n,r;return solidJs.onMount(()=>{n&&(r=ut(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Zr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=mt(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Kr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=mt(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Jr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=ft(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function en(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=ft(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}exports.createScrollAnimate=Ur;exports.createScrollCounter=Qr;exports.createScrollDraw=jr;exports.createScrollText=en;exports.createScrollVideo=Kr;exports.useScrollAnimate=Yr;exports.useScrollCounter=Xr;exports.useScrollDraw=Gr;exports.useScrollText=Jr;exports.useScrollVideo=Zr;
|
package/dist/solid/index.d.mts
CHANGED
|
@@ -101,8 +101,10 @@ interface ScrollDrawOptions {
|
|
|
101
101
|
/**
|
|
102
102
|
* Use the browser's native CSS scroll-driven animation
|
|
103
103
|
* (`animation-timeline: view()`) when the configuration is simple enough and
|
|
104
|
-
* the browser supports it.
|
|
105
|
-
* zero per-frame JavaScript, zero scroll/resize listeners.
|
|
104
|
+
* the browser supports it. The browser drives the draw from the scroll
|
|
105
|
+
* position — zero per-frame JavaScript, zero scroll/resize listeners. (It
|
|
106
|
+
* still repaints on the main thread: browsers don't composite
|
|
107
|
+
* `stroke-dashoffset`.)
|
|
106
108
|
*
|
|
107
109
|
* Falls back to the JS engine automatically when unsupported or when the
|
|
108
110
|
* config uses a feature native CSS can't express (callbacks, stagger, morph,
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -101,8 +101,10 @@ interface ScrollDrawOptions {
|
|
|
101
101
|
/**
|
|
102
102
|
* Use the browser's native CSS scroll-driven animation
|
|
103
103
|
* (`animation-timeline: view()`) when the configuration is simple enough and
|
|
104
|
-
* the browser supports it.
|
|
105
|
-
* zero per-frame JavaScript, zero scroll/resize listeners.
|
|
104
|
+
* the browser supports it. The browser drives the draw from the scroll
|
|
105
|
+
* position — zero per-frame JavaScript, zero scroll/resize listeners. (It
|
|
106
|
+
* still repaints on the main thread: browsers don't composite
|
|
107
|
+
* `stroke-dashoffset`.)
|
|
106
108
|
*
|
|
107
109
|
* Falls back to the JS engine automatically when unsupported or when the
|
|
108
110
|
* config uses a feature native CSS can't express (callbacks, stagger, morph,
|