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