svg-scroll-draw 2.10.0 → 2.10.2
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 +19 -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 +55 -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 +255 -68
package/dist/reveal/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
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());}}}export{it as scrollReveal};
|
|
1
|
+
function _e({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),i=0,m=[];for(let c=0;c<t;c++){let p=Math.pow(a,c);m.push(p),i+=p;}let l=[0],u=0;for(let c=0;c<t;c++)u+=m[c]/i,l.push(u);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<t;p++)if(c<=l[p+1]){let g=(c-l[p])/(l[p+1]-l[p]);if(p===0)return g*(2-g);let M=1-Math.pow(r,p);return M+(1-M)*(2*g-1)*(2*g-1)}return 1}}function Ce({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-a)*(2*Math.PI)/r)+1}var $={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:_e(),elastic:Ce()};function K(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function me(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function pe(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function Ne(e,n,t){return Math.min(t,Math.max(n,e))}function X(e,n,t,r){return t===n?0:Ne((e-n)/(t-n)*r,0,1)}function ge(e,n,t){let r=e.getBoundingClientRect(),a=t==="x"?r.width:r.height;return n?{top:t==="x"?r.left-n.getBoundingClientRect().left+n.scrollLeft:r.top-n.getBoundingClientRect().top+n.scrollTop,height:a,scroll:0}:{top:t==="x"?r.left:r.top,height:a,scroll:t==="x"?window.scrollX:window.scrollY}}function Z(e,n,t,r,a){let i=me(e.top,e.height,n,r.element)-pe(r.viewport,t),m=me(e.top,e.height,n,a.element)-pe(a.viewport,t);return {tStart:i,tEnd:m}}function fe(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function de(e,n,t){let r=fe(e),a=fe(n);return !r||!a?e:`rgb(${Math.round(r[0]+(a[0]-r[0])*t)},${Math.round(r[1]+(a[1]-r[1])*t)},${Math.round(r[2]+(a[2]-r[2])*t)})`}var Fe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Oe="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",be=33;function De(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ve(e){let n=[];for(let t=0;t<be;t++){let r=t/(be-1);n.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${n.join(",")})`}function ye(e){switch(e){case "linear":return "linear";case "ease-in":return Fe;case "ease-out":return Oe;case "ease-in-out":return De()?Ve($["ease-in-out"]):null;default:return null}}var he=Symbol.for("svg-scroll-draw.registry");function we(){let e=globalThis;return e[he]||(e[he]=new Map)}function J(e,n){we().set(e,n);}function ee(e){we().delete(e);}var He=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function k(e,...n){He&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Xe(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ee(e){let n=[],t=/([\w]+)\(([^)]*)\)/g,r;for(;(r=t.exec(e))!==null;){let a=[],i=[],m=r[2].trim();if(m)for(let l of m.split(/[\s,]+/)){let u=l.match(/^([-+]?[\d.eE]+)(.*)$/);a.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}n.push({fn:r[1],nums:a,units:i});}return n}function ke(e,n,t){let r=Ee(e),a=Ee(n);return r.length===0||r.length!==a.length?t<1?e:n:r.map((i,m)=>{let l=a[m];return i.fn!==l.fn||i.nums.length!==l.nums.length?t<1?`${i.fn}(${i.nums.map((u,c)=>`${u}${i.units[c]}`).join(", ")})`:`${l.fn}(${l.nums.map((u,c)=>`${u}${l.units[c]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,c)=>`${u+(l.nums[c]-u)*t}${i.units[c]}`).join(", ")})`}).join(" ")}function Se(e,n,t){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*t);let r=String(e),a=String(n);if(Xe(r))return de(r,a,t);if(r.includes("("))return ke(r,a,t);let i=r.match(/^([-+]?[\d.]+)(.*)$/),m=a.match(/^([-+]?[\d.]+)(.*)$/);if(i&&m){let l=parseFloat(i[1]),u=parseFloat(m[1]);return `${l+(u-l)*t}${i[2]||m[2]}`}return t<1?r:a}function Be(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var ze=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),We=0,ve="--scroll-draw-progress";function Ye(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function xe(e,n){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let{props:r,trigger:a={},easing:i="ease-out",speed:m=1,once:l=false,axis:u="y",scrollContainer:c,native:p=true,velocityScale:g=false,respectReducedMotion:M=true,triggerElement:B,onProgress:I,onComplete:w,onEnter:P,onLeave:A,onEnterBack:_,onLeaveBack:te}=n,Pe=M&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,z=typeof i=="function"?i:$[i]??$["ease-out"],ne=K(a.start??"top bottom"),re=K(a.end??"bottom top"),oe=B??e,d=typeof c=="string"?document.querySelector(c):c??null,y=Object.entries(r).map(([o,s])=>({prop:Be(o),from:Array.isArray(s)?s[0]:"",to:Array.isArray(s)?s[1]:s}));function Te(){let o=window.getComputedStyle(e);for(let s of y)s.from===""&&(s.from=o.getPropertyValue(s.prop).trim()||"0");}function Re(){for(let o of y)e.style.setProperty(o.prop,String(o.to));}let se=new Map;for(let o of [...y.map(s=>s.prop),ve])se.set(o,e.style.getPropertyValue(o));function W(){for(let[o,s]of se)s?e.style.setProperty(o,s):e.style.removeProperty(o);}if(Pe)return Re(),w?.(),{...t,destroy:W,getProgress:()=>1};Te();let ie=typeof i=="string"?ye(i):null;function Le(){if(!p||!Ye()||!ie||u!=="y"||d||oe!==e||l||m!==1||I||w||P||A||_||te||g!==false||(a.start??"top bottom").trim()!=="top bottom"||(a.end??"bottom top").trim()!=="bottom top")return false;for(let o of y)if(!ze.has(o.prop))return false;return true}function Ae(){let o=`ssd-a-${++We}`,s=y.map(f=>`${f.prop}:${f.from}`).join(";"),D=y.map(f=>`${f.prop}:${f.to}`).join(";"),L=document.createElement("style");L.setAttribute("data-ssd-animate",""),L.textContent=`@keyframes ${o}{from{${s}}to{${D}}}.${o}{animation-name:${o};animation-duration:auto;animation-timing-function:${ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L),e.classList.add(o);let b=()=>u==="x"?window.scrollX:window.scrollY,V=()=>u==="x"?window.innerWidth:window.innerHeight,H=()=>{let f=e.getBoundingClientRect();return Z({top:f.top,height:f.height},b(),V(),ne,re)};J(e,{type:"animate",getProgress:()=>q.getProgress(),getTrigger:H});let q={destroy(){e.classList.remove(o),L.remove(),e.style.animationPlayState="",W(),ee(e);},replay(){e.classList.remove(o),e.offsetWidth,e.classList.add(o);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(f){let U=Math.min(1,Math.max(0,f));e.classList.remove(o);for(let Q of y)e.style.setProperty(Q.prop,Se(Q.from,Q.to,U));},getProgress(){let{tStart:f,tEnd:U}=H();return z(X(b(),f,U,m))}};return q}if(Le())return Ae();let h=0,E=0,S=0,C=false,v=false,T=-1,R=0,N=false,x=NaN,Y=-1,ae=0,ue=()=>d?u==="x"?d.scrollLeft:d.scrollTop:u==="x"?window.scrollX:window.scrollY,$e=()=>d?u==="x"?d.clientWidth:d.clientHeight:u==="x"?window.innerWidth:window.innerHeight;function ce(){let o=ge(oe,d,u),s=Z(o,o.scroll,$e(),ne,re);h=s.tStart,E=s.tEnd;}function F(o){e.style.setProperty(ve,String(o));for(let s of y)e.style.setProperty(s.prop,Se(s.from,s.to,o));I?.(o);}function Ie(o){if(isNaN(x)){x=o;return}x<=0&&o>0?P?.():x>0&&o<=0&&te?.(),x<1&&o>=1?A?.():x>=1&&o<1&&_?.(),x=o;}function G(){if(!C||v)return;let o=performance.now(),s=ue(),D=m;if(g!==false){let V=o-ae,H=V>0?Math.abs(s-(Y<0?s:Y))/V:0;D=m*Math.max(.2,1+H*(typeof g=="number"?g:1)*.04);}Y=s,ae=o;let L=E===h?0:(s-h)/(E-h);Ie(L);let b=z(X(s,h,E,D));l&&(T=Math.max(T,b),b=T),R=b,F(b),b>=1&&!N?(N=true,w?.()):b<1&&!l&&(N=false),S=requestAnimationFrame(G);}ce(),E===h&&k("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let o=z(X(ue(),h,E,m));l&&o>0&&(T=o),R=o,F(o);}let le=new IntersectionObserver(o=>{o.forEach(s=>{C=s.isIntersecting,C&&!v?S=requestAnimationFrame(G):cancelAnimationFrame(S);});},{root:d??null}),j;function O(){clearTimeout(j),j=setTimeout(ce,150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),le.observe(e),J(e,{type:"animate",getProgress:()=>R,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(S),le.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(j),W(),ee(e);},replay(){T=-1,N=false,R=0,v=false,F(0);},pause(){v=true,cancelAnimationFrame(S);},resume(){v&&(v=false,C&&(S=requestAnimationFrame(G)));},seek(o){let s=Math.min(1,Math.max(0,o));R=s,T=s,v=true,cancelAnimationFrame(S),F(s);},getProgress(){return R}}}var Ge={fadeUp:{opacity:0,y:32},fadeDown:{opacity:0,y:-32},fadeLeft:{opacity:0,x:32},fadeRight:{opacity:0,x:-32},scale:{opacity:0,scale:.88},flip:{opacity:0,rotateX:20},flipX:{opacity:0,rotateY:20}};function je(e){let n={};e.opacity!==void 0&&(n.opacity=[e.opacity,1]);let t=[],r=[];return e.x!==void 0&&(t.push(`translateX(${e.x}px)`),r.push("translateX(0px)")),e.y!==void 0&&(t.push(`translateY(${e.y}px)`),r.push("translateY(0px)")),e.scale!==void 0&&(t.push(`scale(${e.scale})`),r.push("scale(1)")),e.rotate!==void 0&&(t.push(`rotate(${e.rotate}deg)`),r.push("rotate(0deg)")),e.rotateX!==void 0&&(t.push(`rotateX(${e.rotateX}deg)`),r.push("rotateX(0deg)")),e.rotateY!==void 0&&(t.push(`rotateY(${e.rotateY}deg)`),r.push("rotateY(0deg)")),t.length>0&&(n.transform=[t.join(" "),r.join(" ")]),n}function qe(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}var Me={destroy:()=>{}};function at(e,n={}){if(typeof window>"u")return Me;let t=qe(e);if(!t.length)return k("scrollReveal: no elements found:",e),Me;let{preset:r="fadeUp",from:a,stagger:i=.08,easing:m="ease-out",once:l=true,trigger:u,onEnter:c,onLeave:p}=n,g={...Ge[r],...a},M=je(g),B=Math.min(i*4,4),I=t.map((w,P)=>{let A=Math.max(50,88-P*B),_=Math.max(20,A-35);return xe(w,{props:M,easing:m,once:l,native:false,trigger:u??{start:`top ${A}%`,end:`top ${_}%`},onEnter:P===0?c:void 0,onLeave:P===t.length-1?p:void 0})});return {destroy(){I.forEach(w=>w.destroy());}}}export{at as scrollReveal};
|
package/dist/snap/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function z({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),a=Math.max(.01,Math.min(.99,r)),m=Math.sqrt(a),c=0,y=[];for(let o=0;o<t;o++){let s=Math.pow(m,o);y.push(s),c+=s;}let d=[0],b=0;for(let o=0;o<t;o++)b+=y[o]/c,d.push(b);return o=>{if(o<=0)return 0;if(o>=1)return 1;for(let s=0;s<t;s++)if(o<=d[s+1]){let h=(o-d[s])/(d[s+1]-d[s]);if(s===0)return h*(2-h);let M=1-Math.pow(a,s);return M+(1-M)*(2*h-1)*(2*h-1)}return 1}}function X({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),a=Math.max(.1,r),m=t<=1?a/4:a/(2*Math.PI)*Math.asin(1/t);return c=>c<=0?0:c>=1?1:t*Math.pow(2,-10*c)*Math.sin((c-m)*(2*Math.PI)/a)+1}var T={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:z(),elastic:X()};function I(e,r,t){return Math.min(t,Math.max(r,e))}var k=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...r){k&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function D(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=m=>e(!!m.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let a=r;return a.addListener?.(t),()=>a.removeListener?.(t)}var P=Symbol.for("svg-scroll-draw.registry");function Q(){let e=globalThis;return e[P]||(e[P]=new Map)}function $(e,r){Q().set(e,r);}function G(e){Q().delete(e);}var q={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function H(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function ne(e,r={}){if(typeof window>"u")return q;let t=H(e);if(!t.length)return V("scrollSnap: no sections found"),q;let{direction:a="vertical",duration:m=600,easing:c="ease-in-out",threshold:y=.3,scrollContainer:d,onSnap:b,respectReducedMotion:o=true}=r,s=o&&D(),h=o?O(n=>{s=n;}):()=>{},M=typeof c=="function"?c:T[c]??T["ease-in-out"],f=a==="horizontal",l=typeof d=="string"?document.querySelector(d):d??null,u=0,p=false,E=0;function R(){return l?f?l.scrollLeft:l.scrollTop:f?window.scrollX:window.scrollY}function _(n){l?f?l.scrollLeft=n:l.scrollTop=n:window.scrollTo(f?{left:n}:{top:n});}function v(){return t.map(n=>{let i=n.getBoundingClientRect();if(l){let g=l.getBoundingClientRect();return f?i.left-g.left+l.scrollLeft:i.top-g.top+l.scrollTop}return f?i.left+window.scrollX:i.top+window.scrollY})}function x(n){let i=I(n,0,t.length-1);p&&(cancelAnimationFrame(E),p=false),p=true;let g=v(),w=R(),L=g[i];if(Math.abs(w-L)<1){p=false,u=i,b?.(i);return}if(s){_(L),p=false,u=i,b?.(i);return}let B=performance.now();function N(W){let F=I((W-B)/m,0,1);_(w+(L-w)*M(F)),F<1?E=requestAnimationFrame(N):(p=false,u=i,b?.(i));}E=requestAnimationFrame(N);}let S;function A(){p||(clearTimeout(S),S=setTimeout(()=>{let n=R(),i=v();if(Math.abs(n-i[u])<1)return;let g=f?t[u].offsetWidth:t[u].offsetHeight,w=n-i[u];w>g*y&&u<t.length-1?x(u+1):w<-(g*y)&&u>0?x(u-1):x(u);},100));}let C=l??window;return C.addEventListener("scroll",A,{passive:true}),$(t[0],{type:"snap",getProgress:()=>u/(t.length-1||1),getTrigger:()=>{let n=v();return {tStart:n[0],tEnd:n[n.length-1]}}}),{destroy(){cancelAnimationFrame(E),clearTimeout(S),C.removeEventListener("scroll",A),h(),G(t[0]);},snapTo:x,getCurrentIndex(){return u}}}exports.scrollSnap=ne;
|
package/dist/snap/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function z({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),a=Math.max(.01,Math.min(.99,r)),m=Math.sqrt(a),c=0,y=[];for(let o=0;o<t;o++){let s=Math.pow(m,o);y.push(s),c+=s;}let d=[0],b=0;for(let o=0;o<t;o++)b+=y[o]/c,d.push(b);return o=>{if(o<=0)return 0;if(o>=1)return 1;for(let s=0;s<t;s++)if(o<=d[s+1]){let h=(o-d[s])/(d[s+1]-d[s]);if(s===0)return h*(2-h);let M=1-Math.pow(a,s);return M+(1-M)*(2*h-1)*(2*h-1)}return 1}}function X({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),a=Math.max(.1,r),m=t<=1?a/4:a/(2*Math.PI)*Math.asin(1/t);return c=>c<=0?0:c>=1?1:t*Math.pow(2,-10*c)*Math.sin((c-m)*(2*Math.PI)/a)+1}var T={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:z(),elastic:X()};function I(e,r,t){return Math.min(t,Math.max(r,e))}var k=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function V(e,...r){k&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function D(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function O(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=m=>e(!!m.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let a=r;return a.addListener?.(t),()=>a.removeListener?.(t)}var P=Symbol.for("svg-scroll-draw.registry");function Q(){let e=globalThis;return e[P]||(e[P]=new Map)}function $(e,r){Q().set(e,r);}function G(e){Q().delete(e);}var q={destroy:()=>{},snapTo:()=>{},getCurrentIndex:()=>0};function H(e){return typeof e=="string"?Array.from(document.querySelectorAll(e)):e instanceof NodeList?Array.from(e):e}function ne(e,r={}){if(typeof window>"u")return q;let t=H(e);if(!t.length)return V("scrollSnap: no sections found"),q;let{direction:a="vertical",duration:m=600,easing:c="ease-in-out",threshold:y=.3,scrollContainer:d,onSnap:b,respectReducedMotion:o=true}=r,s=o&&D(),h=o?O(n=>{s=n;}):()=>{},M=typeof c=="function"?c:T[c]??T["ease-in-out"],f=a==="horizontal",l=typeof d=="string"?document.querySelector(d):d??null,u=0,p=false,E=0;function R(){return l?f?l.scrollLeft:l.scrollTop:f?window.scrollX:window.scrollY}function _(n){l?f?l.scrollLeft=n:l.scrollTop=n:window.scrollTo(f?{left:n}:{top:n});}function v(){return t.map(n=>{let i=n.getBoundingClientRect();if(l){let g=l.getBoundingClientRect();return f?i.left-g.left+l.scrollLeft:i.top-g.top+l.scrollTop}return f?i.left+window.scrollX:i.top+window.scrollY})}function x(n){let i=I(n,0,t.length-1);p&&(cancelAnimationFrame(E),p=false),p=true;let g=v(),w=R(),L=g[i];if(Math.abs(w-L)<1){p=false,u=i,b?.(i);return}if(s){_(L),p=false,u=i,b?.(i);return}let B=performance.now();function N(W){let F=I((W-B)/m,0,1);_(w+(L-w)*M(F)),F<1?E=requestAnimationFrame(N):(p=false,u=i,b?.(i));}E=requestAnimationFrame(N);}let S;function A(){p||(clearTimeout(S),S=setTimeout(()=>{let n=R(),i=v();if(Math.abs(n-i[u])<1)return;let g=f?t[u].offsetWidth:t[u].offsetHeight,w=n-i[u];w>g*y&&u<t.length-1?x(u+1):w<-(g*y)&&u>0?x(u-1):x(u);},100));}let C=l??window;return C.addEventListener("scroll",A,{passive:true}),$(t[0],{type:"snap",getProgress:()=>u/(t.length-1||1),getTrigger:()=>{let n=v();return {tStart:n[0],tEnd:n[n.length-1]}}}),{destroy(){cancelAnimationFrame(E),clearTimeout(S),C.removeEventListener("scroll",A),h(),G(t[0]);},snapTo:x,getCurrentIndex(){return u}}}export{ne as scrollSnap};
|
package/dist/solid/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var solidJs=require('solid-js');function
|
|
1
|
+
'use strict';var solidJs=require('solid-js');function _t({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let $=1-Math.pow(t,T);return $+(1-$)*(2*V-1)*(2*V-1)}return 1}}function qt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:_t(),elastic:qt()};function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function Et(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function St(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function qe(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Wt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:Wt((e-n)/(r-n)*t,0,1)}function Ke(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=Et(e.top,e.height,n,t.element)-St(t.viewport,r),c=Et(e.top,e.height,n,l.element)-St(l.viewport,r);return {tStart:s,tEnd:c}}function Tt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function We(e,n,r){let t=Tt(e),l=Tt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var xt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...n){Je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Bt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Yt(e){let n=[];for(let r=0;r<Mt;r++){let t=r/(Mt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Bt;case "ease-out":return Gt;case "ease-in-out":return jt()?Yt(re["ease-in-out"]):null;default:return null}}var At=Symbol.for("svg-scroll-draw.registry");function Lt(){let e=globalThis;return e[At]||(e[At]=new Map)}function Le(e,n){Lt().set(e,n);}function $e(e){Lt().delete(e);}var Ut=0;function Xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(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 Zt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Mt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Yt(e,r,n){if(!Ke)return;let t=(e.match(Mt)??[]).join("").toUpperCase(),l=(r.match(Mt)??[]).join("").toUpperCase(),s=(e.match(xt)??[]).length,c=(r.match(xt)??[]).length;if(t!==l){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}s!==c&&ye(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function st(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function it(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...St[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Ae=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:M,strokeWidth:$,fillOpacity:A,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:C="0px",repeat:S=0,repeatDelay:ne=0,morphTo:k,clip:re,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:H,onEnterBack:de,onLeaveBack:ve}=l,me=re===true?"left":typeof re=="string"?re:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),ze=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(M)?M[0]:null,se=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(A)?A[0]:null,Y=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function $e(o){let a=o*100;switch(me){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let V=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,F=false,z=false,_=0,j=false,ae=-1,Ce=-1,K=false,Se=0,ke=0,He,tt=null;function ft(){tt?.destroy(),tt=null;}let Fe=new Set,pt=NaN,Re=true,je=-1,dt=performance.now(),_e=NaN;function nt(){return he?W==="x"?he.scrollLeft:he.scrollTop:W==="x"?window.scrollX:window.scrollY}function gt(){return he?W==="x"?he.clientWidth:he.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function yt(){let o=Je(e,he,W),a=xe(o,o.scroll,gt(),Le,ze);f=a.tStart,we=a.tEnd,Ae&&Ke&&(ft(),tt=Xt(f,we,W));}function Dt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=$e(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=We(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),k&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",st(i[le],k,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),k&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Ut(o);let a=qe(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),k&&(v?Yt(i[i.length-1],k,o):ye(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),k&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",k)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){if(s)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof d=="string"?et(d):null;function Ht(){return !(ue===false||!jt()||!V.length||!ht||me||W!=="y"||he||u!==1||N!==0||te||X||I!==false||k||w||S||B>0||y||T||g||p||H||de||ve||M!=null||$!=null||A!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Ft(){let o=++Gt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,De=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${De};`,E=`stroke-dashoffset:${Pe};`;m&&(Me+=`opacity:${L==="reverse"?1:0};`,E+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Me}}to{${E}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,R=-1;function q(){if(R>=0)return R;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},nt(),gt(),Le,ze);return Ee(Q(nt(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){b=false,R=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));R=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=qe(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(Ht())return Ft();function Rt(){let o=Math.max(1,J),a=0,v=0,le=false;function De(b){let R=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);Se=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(L==="reverse"?1-h:h),y?.(h),q<1&&(R=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Ee(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=We(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),k&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",st(i[h],k,ge)),h===0&&(Se=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(R=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!Fe.has(Te)&&(Fe.add(Te),w[U]?.());}}return R}function Pe(b){if(K)return;let R=b-a;z||(z=true,T?.());let q=De(R);if(q&&!F){F=true,De(o*(1+Math.max(0,V.length-1)*N)),g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{a=performance.now(),z=false,F=false,Fe.clear(),Ue(),_=requestAnimationFrame(Pe);},ne));return}q||(_=requestAnimationFrame(Pe));}function Me(){cancelAnimationFrame(_),clearTimeout(He),a=performance.now(),v=0,K=false,z=false,F=false,ke=0,le=true,Se=0,Fe.clear(),Ue(),_=requestAnimationFrame(Pe);}let E=new IntersectionObserver(b=>{b.forEach(R=>{R.isIntersecting&&!(te&&F)?Me():!R.isIntersecting&&!te&&!F&&(cancelAnimationFrame(_),clearTimeout(He),le=false);});},{root:he??null,threshold:O,rootMargin:C}),D;function ce(){clearTimeout(D),D=setTimeout(()=>{V.forEach((b,R)=>{P[R]=qe(b),b.style.strokeDasharray=`${P[R]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>E.observe(e),B):E.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(He),E.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(D);},replay(){ke=0,Me();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let R=Math.min(1,Math.max(0,b));Se=R,K=true,v=R*o,a=performance.now()-v,cancelAnimationFrame(_),De(v);},getProgress(){return Se},refresh(){clearTimeout(D),V.forEach((b,R)=>{P[R]=qe(b),b.style.strokeDasharray=`${P[R]}`;});}}}if(oe)return Rt();yt();function Xe(){if(!j||K)return;let o=performance.now(),a=nt();if(!Re&&I===false&&a===pt){_=requestAnimationFrame(Xe);return}Re=false,pt=a;let v=u;if(I!==false){let E=o-dt,D=E>0?Math.abs(a-(je<0?a:je))/E:0;v=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}je=a,dt=o;let le=X?Ce===-1||a>=Ce?"forward":"reverse":L;Ce=a;let De=we-f,Pe=true,Me=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Me>0?p?.():_e>0&&Me<=0&&ve?.(),_e<1&&Me>=1?H?.():_e>=1&&Me<1&&de?.()),_e=Me,me){let E=Ee(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,E),E=ae),Se=E,e.style.setProperty("--scroll-draw-progress",String(E));let D=le==="reverse"?1-E:E;e.style.clipPath=$e(D),y?.(E),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),E>=1&&!F?(F=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{ae=-1,z=false,F=false,e.style.clipPath=$e(0);},ne))):E<1&&!te&&(F=false),_=requestAnimationFrame(Xe);return}if(V.forEach((E,D)=>{let ce=D*N*De,b=Ee(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Se=b,E.style.strokeDashoffset=le==="reverse"?`${P[D]*b}`:`${P[D]*(1-b)}`,m&&(E.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?E.style.stroke=We(be,se,b):se&&(E.style.stroke=se),ie!==null&&G!==null?E.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(E.style.strokeWidth=`${G}`),fe!==null&&Y!==null?E.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(E.style.fillOpacity=`${Y}`),k&&E.tagName.toLowerCase()==="path"&&i[D]&&E.setAttribute("d",st(i[D],k,b)),D===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let E=Ee(Q(a,f,we,v));for(let D in w){let ce=parseFloat(D);E>=ce&&!Fe.has(ce)&&(Fe.add(ce),w[D]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!F?(F=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{ae=-1,z=false,F=false,Fe.clear(),Ue(),Re=true;},ne))):!Pe&&!te&&(F=false),_=requestAnimationFrame(Xe);}let rt=false;function Ye(){rt||(rt=true,_=requestAnimationFrame(function(){Xe();}));}function Qe(){rt=false,cancelAnimationFrame(_);}let ot=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Re=true,Ye()):Qe();});},{root:he??null,threshold:O,rootMargin:C});function bt(){V.forEach((o,a)=>{P[a]=qe(o),o.style.strokeDasharray=`${P[a]}`;}),yt(),Re=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(bt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),B>0?setTimeout(()=>ot.observe(e),B):ot.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(He),Qe(),ot.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),ft();},replay(){ae=-1,Ce=-1,je=-1,z=false,F=false,ke=0,K=false,Se=0,Fe.clear(),clearTimeout(He),Ue(),Re=true,j&&Ye();},pause(){K=true,Qe();},resume(){K&&(K=false,Re=true,j&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));Se=a,ae=a,K=true,Qe(),Dt(a,L),Re=true;},getProgress(){return Se},refresh(){clearTimeout(Ze),bt(),j&&!K&&Ye();}}}var At=new Map;function Ne(e,r){At.set(e,r);}function Ve(e){At.delete(e);}function Qt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function Zt(e,r,n){let t=Lt(e),l=Lt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*n}${s.units[d]}`).join(", ")})`}).join(" ")}function $t(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Qt(t))return We(t,l,n);if(t.includes("("))return Zt(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*n}${s[2]||c[2]}`}return n<1?t:l}function Jt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),en=0,Ct="--scroll-draw-progress";function tn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function at(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Ae,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:M}=r,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),I=pe(l.end??"bottom top"),O=te??e,C=typeof d=="string"?document.querySelector(d):d??null,S=Object.entries(t).map(([i,f])=>({prop:Jt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function ne(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function k(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let re=new Map;for(let i of [...S.map(f=>f.prop),Ct])re.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of re)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return k(),W?.(),{...n,destroy:oe,getProgress:()=>1};ne();let J=typeof s=="string"?et(s):null;function ue(){if(!x||!tn()||!J||m!=="y"||C||O!==e||u||c!==1||Ae||W||Z||X||B||M||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!Kt.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++en}`,f=S.map(j=>`${j.prop}:${j.from}`).join(";"),we=S.map(j=>`${j.prop}:${j.to}`).join(";"),F=document.createElement("style");F.setAttribute("data-ssd-animate",""),F.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),F.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Ce of S)e.style.setProperty(Ce.prop,$t(Ce.from,Ce.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),Ce=_(),{tStart:K,tEnd:Se}=xe({top:j.top,height:j.height},ae,Ce,w,I);return A(Q(ae,K,Se,c))}}}if(ue())return y();let T=0,g=0,p=0,H=false,de=false,ve=-1,me=0,Ee=false,Le=NaN,ze=-1,he=0,be=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Je(O,C,m),f=xe(i,i.scroll,se(),w,I);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Ct,String(i));for(let f of S)e.style.setProperty(f.prop,$t(f.from,f.to,i));Ae?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&M?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!H||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(ze<0?f:ze))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}ze=f,he=i;let F=g===T?0:(f-T)/(g-T);fe(F);let z=A(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Ee?(Ee=true,W?.()):z<1&&!u&&(Ee=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=A(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{H=f.isIntersecting,H&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:C??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),$e.observe(e),Ne(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),Ve(e);},replay(){ve=-1,Ee=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,H&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ct(e,r){if(typeof window>"u")return lt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollCounter: element not found:",e),lt;let t=n,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Ae=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),lt;let X=0,B=0,M=0,$=false,A=false,w=-1,I=0,O=false,C=()=>window.scrollY,S=()=>window.innerHeight;function ne(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},C(),S(),Ae,W);X=T.tStart,B=T.tEnd;}function k(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function re(){if(!$||A)return;let y=te(Q(C(),X,B,1));d&&(w=Math.max(w,y),y=w),I=y,k(y),y>=1&&!O?(O=true,N?.()):y<1&&!d&&(O=false),M=requestAnimationFrame(re);}ne();{let y=te(Q(C(),X,B,1));d&&y>0&&(w=y),I=y,k(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{$=T.isIntersecting,$&&!A?M=requestAnimationFrame(re):cancelAnimationFrame(M);});}),J;function ue(){clearTimeout(J),J=setTimeout(ne,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Ne(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(M),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),Ve(t);},replay(){w=-1,O=false,I=0,A=false,k(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,$&&(M=requestAnimationFrame(re)));},seek(y){let T=Math.min(1,Math.max(0,y));I=T,w=T,A=true,cancelAnimationFrame(M),k(T);},getProgress(){return I}}}var Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r={}){if(typeof window>"u")return Pt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),Pt;let t=n,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Ae=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,B=0,M=0,$=0,A=false,w=false,I=-1,O=0,C=false,S=false,ne=()=>u==="x"?window.scrollX:window.scrollY,k=()=>u==="x"?window.innerWidth:window.innerHeight;function re(){let p=t.getBoundingClientRect(),H=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:H,height:de},ne(),k(),Ae,W);B=ve.tStart,M=ve.tEnd;}function oe(p){if(!S)return;let H=X??t.duration??0;t.currentTime=Z+(H-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!A||w||!S)return;let p=te(Q(ne(),B,M,1));c&&(I=Math.max(I,p),p=I),O=p,oe(p),p>=1&&!C?(C=true,x?.()):p<1&&!c&&(C=false),$=requestAnimationFrame(J);}function ue(){if(S=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}re(),d?.(),A&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),S||re();let y=new IntersectionObserver(p=>{p.forEach(H=>{A=H.isIntersecting,A&&!w&&S?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(re,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ne(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:B,tEnd:M})}),{destroy(){cancelAnimationFrame($),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),Ve(t);},replay(){I=-1,C=false,O=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,A&&S&&($=requestAnimationFrame(J)));},seek(p){let H=Math.min(1,Math.max(0,p));O=H,I=H,w=true,cancelAnimationFrame($),oe(H);},getProgress(){return O}}}function kt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function nn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function It(e){let r=kt(e),n=new Map;for(let s of r){let c=s.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(s);}let t=[],l=Array.from(n.keys()).sort((s,c)=>s-c);for(let s of l){let c=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function rn(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function on(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,r={}){if(typeof window>"u")return Ot;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollText: element not found:",e),Ot;let t=n,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Ae=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=nn(t):l==="lines"?Z=It(t):Z=kt(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let H=on(p,u);H&&(g.style.transform=H);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,H)=>{let de=L(rn(g,H,X,s));B(p,de);});}if(N)return M(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let $=0,A=0,w=0,I=false,O=false,C=-1,S=0,ne=false,k=()=>window.scrollY,re=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},k(),re(),te,Ae);$=p.tStart,A=p.tEnd;}function J(){if(!I||O)return;let g=Q(k(),$,A,1);d&&(C=Math.max(C,g),g=C),S=g,M(g),g>=1&&!ne?(ne=true,x?.()):g<1&&!d&&(ne=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{I=p.isIntersecting,I&&!O?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=It(t),M(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Ne(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:A})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=W,t.removeAttribute("aria-label"),Ve(t);},replay(){C=-1,ne=false,S=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));S=p,C=p,O=true,cancelAnimationFrame(w),M(p);},getProgress(){return S}}}function zn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=it(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function _n(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=it(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function qn(e){let r,n;return solidJs.onMount(()=>{r&&(n=at(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Wn(e){let r,n;return solidJs.onMount(()=>{r&&(n=at(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function Bn(e){let r,n;return solidJs.onMount(()=>{r&&(n=ct(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Gn(e){let r,n;return solidJs.onMount(()=>{r&&(n=ct(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function jn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=ut(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Un(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=ut(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function Xn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=mt(r,e));}),solidJs.onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Yn(e={}){let r,n;return solidJs.onMount(()=>{r&&(n=mt(r,e));}),solidJs.onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}exports.createScrollAnimate=Wn;exports.createScrollCounter=Gn;exports.createScrollDraw=_n;exports.createScrollText=Yn;exports.createScrollVideo=Un;exports.useScrollAnimate=qn;exports.useScrollCounter=Bn;exports.useScrollDraw=zn;exports.useScrollText=Xn;exports.useScrollVideo=jn;
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var $t=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function Kt(e,n,r){if(!Je)return;let t=(e.match(Ct)??[]).join("").toUpperCase(),l=(n.match(Ct)??[]).join("").toUpperCase(),s=(e.match($t)??[]).length,c=(n.match($t)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...xt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:$="forward",once:ne=false,debug:Ce=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:C,fillOpacity:A,waypoints:w,velocityScale:k=false,threshold:O=0,rootMargin:P="0px",repeat:E=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:L,onLeave:S,onEnterBack:F,onLeaveBack:fe}=l,Q=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Pe=de(T.start??"top bottom"),ze=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(C)?C[0]:null,j=Array.isArray(C)?C[1]:typeof C=="number"?C:null,pe=Array.isArray(A)?A[0]:null,Z=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function Ie(o){let a=o*100;switch(Q){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=Q?[]:Array.from(e.querySelectorAll(c)),I=[],i=[],f=0,ge=0,R=false,_=false,q=0,Me=false,ye=-1,te=-1,Y=false,he=0,He=0,Re,tt=null;function pt(){tt?.destroy(),tt=null;}let Ne=new Set,dt=NaN,Ve=true,je=-1,gt=performance.now(),_e=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function yt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Ke(e,ve,B);return xe(o,o.scroll,yt(),Pe,ze)}function bt(){(({tStart:f,tEnd:ge}=ht())),Ce&&Je&&(pt(),tt=Zt(f,ge,B));}function nt(o,a=ht){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Rt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),Q){let b=a==="reverse"?1-o:o;e.style.clipPath=Ie(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${I[ue]*o}`:`${I[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=We(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*o}`:Z!==null&&(b.style.fillOpacity=`${Z}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],D,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Ie(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=$==="reverse"?"0":`${I[a]}`,m?o.style.opacity=$==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{Qt(o);let a=qe(o);I.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Kt(i[i.length-1],D,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=$==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=$==="reverse"?"0":`${a}`,m?o.style.opacity=$==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Ie(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ie(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let wt=typeof p=="string"?et(p):null;function Nt(){return !(ae===false||!Xt()||!z.length||!wt||Q||B!=="y"||ve||u!==1||V!==0||ne||X||k!==false||D||w||E||G>0||d||x||g||L||S||F||fe||M!=null||C!=null||A!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Vt(){let o=++Ut,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=$==="reverse"?"0":"var(--ssd-len)",ke=$==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${$==="reverse"?1:0};`,v+=`opacity:${$==="reverse"?0:1};`);let H=document.createElement("style");H.setAttribute("data-svg-scroll-draw",""),H.textContent=`@keyframes ${a}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${wt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},rt(),yt(),Pe,ze);return Se(K(rt(),U,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),H.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));N=U,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=$==="reverse"?`${I[be]*U}`:`${I[be]*(1-U)}`,m&&(Te.style.opacity=$==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){z.forEach((y,U)=>{I[U]=qe(y),y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`;});}}}if(Nt())return nt(Vt());function zt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Fe(h){let N=true;if(Q){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Ie($==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let U=y*V*o,Te=Math.min(1,Math.max(0,(h-U)/o)),be=Se(Te);W.style.strokeDashoffset=$==="reverse"?`${I[y]*be}`:`${I[y]*(1-be)}`,m&&(W.style.opacity=$==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=We(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Z!==null?W.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(W.style.fillOpacity=`${Z}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],D,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let U in w){let Te=parseFloat(U);y>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[U]?.());}}return N}function ke(h){if(Y)return;let N=h-a;_||(_=true,x?.());let W=Fe(N);if(W&&!R){R=true,Fe(o*(1+Math.max(0,z.length-1)*V)),g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{a=performance.now(),_=false,R=false,Ne.clear(),Ye(),q=requestAnimationFrame(ke);},oe));return}W||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(Re),a=performance.now(),b=0,Y=false,_=false,R=false,He=0,ue=true,he=0,Ne.clear(),Ye(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&R)?Ae():!N.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(Re),ue=false);});},{root:ve??null,threshold:O,rootMargin:P}),H;function me(){clearTimeout(H),H=setTimeout(()=>{z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Re),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(H);},replay(){He=0,Ae();},pause(){Y||!ue||(Y=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){Y&&(Y=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let N=Math.min(1,Math.max(0,h));he=N,Y=true,b=N*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return he},refresh(){clearTimeout(H),z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});}}}if(ie)return nt(zt());bt();function Ue(){if(!Me||Y)return;let o=performance.now(),a=rt();if(!Ve&&k===false&&a===dt){q=requestAnimationFrame(Ue);return}Ve=false,dt=a;let b=u;if(k!==false){let v=o-gt,H=v>0?Math.abs(a-(je<0?a:je))/v:0;b=u*Math.max(.2,1+H*(typeof k=="number"?k:1)*.04);}je=a,gt=o;let ue=X?te===-1||a>=te?"forward":"reverse":$;te=a;let Fe=ge-f,ke=true,Ae=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Ae>0?L?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&F?.()),_e=Ae,Q){let v=Se(K(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let H=ue==="reverse"?1-v:v;e.style.clipPath=Ie(H),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,e.style.clipPath=Ie(0);},oe))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Ue);return}if(z.forEach((v,H)=>{let me=H*V*Fe,h=Se(K(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${I[H]*h}`:`${I[H]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=We(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*h}`:Z!==null&&(v.style.fillOpacity=`${Z}`),D&&v.tagName.toLowerCase()==="path"&&i[H]&&v.setAttribute("d",it(i[H],D,h)),H===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=Se(K(a,f,ge,b));for(let H in w){let me=parseFloat(H);v>=me&&!Ne.has(me)&&(Ne.add(me),w[H]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,Ne.clear(),Ye(),Ve=true;},oe))):!ke&&!ne&&(R=false),q=requestAnimationFrame(Ue);}let ot=false;function Xe(){ot||(ot=true,q=requestAnimationFrame(function(){Ue();}));}function Qe(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Me=a.isIntersecting,Me&&!Y?(Ve=true,Xe()):Qe();});},{root:ve??null,threshold:O,rootMargin:P});function vt(){z.forEach((o,a)=>{I[a]=qe(o),o.style.strokeDasharray=`${I[a]}`;}),bt(),Ve=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(vt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),G>0?setTimeout(()=>st.observe(e),G):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Re),Qe(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),pt();},replay(){ye=-1,te=-1,je=-1,_=false,R=false,He=0,Y=false,he=0,Ne.clear(),clearTimeout(Re),Ye(),Ve=true,Me&&Xe();},pause(){Y=true,Qe();},resume(){Y&&(Y=false,Ve=true,Me&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,Y=true,Qe(),Rt(a,$),Ve=true;},getProgress(){return he},refresh(){clearTimeout(Ze),vt(),Me&&!Y&&Xe();}},()=>({tStart:f,tEnd:ge}))}function Jt(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 l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function er(e,n,r){let t=Pt(e),l=Pt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function It(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Jt(t))return We(t,l,r);if(t.includes("("))return er(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function tr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,kt="--scroll-draw-progress";function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function lt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:$=true,triggerElement:ne,onProgress:Ce,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,C=$&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),O=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:tr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),kt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return D(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?et(s):null;function ae(){if(!T||!or()||!ee||m!=="y"||P||O!==e||u||c!==1||Ce||B||J||X||G||M||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!rr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++nr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},_(),q(),w,k)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let Y=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,It(he.from,he.to,Y));},getProgress(){let{tStart:te,tEnd:Y}=Me();return A(K(_(),te,Y,c))}};return ye}if(ae())return d();let x=0,g=0,L=0,S=false,F=false,fe=-1,Q=0,Se=false,Pe=NaN,ze=-1,ve=0,Ee=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ke(O,P,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(kt,String(i));for(let f of E)e.style.setProperty(f.prop,It(f.from,f.to,i));Ce?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&M?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Z(){if(!S||F)return;let i=performance.now(),f=Ee(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(ze<0?f:ze))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}ze=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let _=A(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Se?(Se=true,B?.()):_<1&&!u&&(Se=false),L=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=A(K(Ee(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let Ie=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!F?L=requestAnimationFrame(Z):cancelAnimationFrame(L);});},{root:P??null}),z;function I(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Ie.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(L),Ie.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(z),ie(),$e(e);},replay(){fe=-1,Se=false,Q=0,F=false,j(0);},pause(){F=true,cancelAnimationFrame(L);},resume(){F&&(F=false,S&&(L=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,F=true,cancelAnimationFrame(L),j(f);},getProgress(){return Q}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ct;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,$=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Ce=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=$(s),V?.(),ct;let X=0,G=0,M=0,C=false,A=false,w=-1,k=0,O=false,P=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},P(),E(),Ce,B);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=$(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!C||A)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,D(d),d>=1&&!O?(O=true,V?.()):d<1&&!p&&(O=false),M=requestAnimationFrame(se);}oe();{let d=ne(K(P(),X,G,1));p&&d>0&&(w=d),k=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{C=x.isIntersecting,C&&!A?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,O=false,k=0,A=false,D(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,C&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,A=true,cancelAnimationFrame(M),D(x);},getProgress(){return k}}}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Ot;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,$=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Ce=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,M=0,C=0,A=false,w=false,k=-1,O=0,P=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),F=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,Q=xe({top:F,height:fe},oe(),D(),Ce,B);G=Q.tStart,M=Q.tEnd;}let ie=NaN;function ee(S){if(!E)return;let F=X??t.duration??0,fe=J+(F-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!A||w||!E)return;let S=ne(K(oe(),G,M,1));c&&(k=Math.max(k,S),S=k),O=S,ee(S),S>=1&&!P?(P=true,T?.()):S<1&&!c&&(P=false),C=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),$){ee(1),p?.();return}se(),p?.(),A&&!w&&(C=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(F=>{A=F.isIntersecting,A&&!w&&E?C=requestAnimationFrame(ae):cancelAnimationFrame(C);});}),g;function L(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),x.observe(t),Le(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(C),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(g),$e(t);},replay(){k=-1,P=false,O=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,A&&E&&(C=requestAnimationFrame(ae)));},seek(S){let F=Math.min(1,Math.max(0,S));O=F,k=F,w=true,cancelAnimationFrame(C),ie=NaN,ee(F);},getProgress(){return O}}}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 sr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=Ft(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ir(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ar(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 Ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,n={}){if(typeof window>"u")return Ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Ht;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Ce=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=sr(t):l==="lines"?J=Dt(t):J=Ft(t);let X=J.length;function G(g,L){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*L));let S=ar(L,u);S&&(g.style.transform=S);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((L,S)=>{let F=$(ir(g,S,X,s));G(L,F);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let C=0,A=0,w=0,k=false,O=false,P=-1,E=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),L=xe({top:g.top,height:g.height},D(),se(),ne,Ce);C=L.tStart,A=L.tEnd;}function ee(){if(!k||O)return;let g=K(D(),C,A,1);p&&(P=Math.max(P,g),g=P),E=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach(L=>{k=L.isIntersecting,k&&!O?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Dt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:A})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){P=-1,oe=false,E=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let L=Math.min(1,Math.max(0,g));E=L,P=L,O=true,cancelAnimationFrame(w),M(L);},getProgress(){return E}}}function Wr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=at(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Br(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=at(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Gr(e){let n,r;return solidJs.onMount(()=>{n&&(r=lt(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function jr(e){let n,r;return solidJs.onMount(()=>{n&&(r=lt(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Yr(e){let n,r;return solidJs.onMount(()=>{n&&(r=ut(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Ur(e){let n,r;return solidJs.onMount(()=>{n&&(r=ut(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Xr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=mt(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Qr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=mt(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Zr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=ft(n,e));}),solidJs.onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Kr(e={}){let n,r;return solidJs.onMount(()=>{n&&(r=ft(n,e));}),solidJs.onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}exports.createScrollAnimate=jr;exports.createScrollCounter=Ur;exports.createScrollDraw=Br;exports.createScrollText=Kr;exports.createScrollVideo=Qr;exports.useScrollAnimate=Gr;exports.useScrollCounter=Yr;exports.useScrollDraw=Wr;exports.useScrollText=Zr;exports.useScrollVideo=Xr;
|
package/dist/solid/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {onMount,onCleanup}from'solid-js';function
|
|
1
|
+
import {onMount,onCleanup}from'solid-js';function _t({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),l=Math.sqrt(t),s=0,c=[];for(let p=0;p<r;p++){let T=Math.pow(l,p);c.push(T),s+=T;}let u=[0],m=0;for(let p=0;p<r;p++)m+=c[p]/s,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let T=0;T<r;T++)if(p<=u[T+1]){let V=(p-u[T])/(u[T+1]-u[T]);if(T===0)return V*(2-V);let $=1-Math.pow(t,T);return $+(1-$)*(2*V-1)*(2*V-1)}return 1}}function qt({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),l=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return s=>s<=0?0:s>=1?1:r*Math.pow(2,-10*s)*Math.sin((s-l)*(2*Math.PI)/t)+1}var re={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:_t(),elastic:qt()};function de(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function Et(e,n,r,t){switch(t){case "top":return e+r;case "center":return e+r+n/2;case "bottom":return e+r+n;default:return e+r}}function St(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function qe(e){let n=e.tagName.toLowerCase();if(n==="rect"){let r=parseFloat(e.getAttribute("width")??"0"),t=parseFloat(e.getAttribute("height")??"0");return 2*(r+t)}if(n==="circle"){let r=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*r}return e.getTotalLength()}function Wt(e,n,r){return Math.min(r,Math.max(n,e))}function K(e,n,r,t){return r===n?0:Wt((e-n)/(r-n)*t,0,1)}function Ke(e,n,r){let t=e.getBoundingClientRect(),l=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left+n.scrollLeft:t.top-n.getBoundingClientRect().top+n.scrollTop,height:l,scroll:0}:{top:r==="x"?t.left:t.top,height:l,scroll:r==="x"?window.scrollX:window.scrollY}}function xe(e,n,r,t,l){let s=Et(e.top,e.height,n,t.element)-St(t.viewport,r),c=Et(e.top,e.height,n,l.element)-St(l.viewport,r);return {tStart:s,tEnd:c}}function Tt(e){let n=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(n)return [parseInt(n[1]+n[1],16),parseInt(n[2]+n[2],16),parseInt(n[3]+n[3],16)];let r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(r)return [parseInt(r[1],16),parseInt(r[2],16),parseInt(r[3],16)];let t=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return t?[parseInt(t[1]),parseInt(t[2]),parseInt(t[3])]:null}function We(e,n,r){let t=Tt(e),l=Tt(n);return !t||!l?e:`rgb(${Math.round(t[0]+(l[0]-t[0])*r)},${Math.round(t[1]+(l[1]-t[1])*r)},${Math.round(t[2]+(l[2]-t[2])*r)})`}var xt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Je=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function we(e,...n){Je&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var Bt="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Gt="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Mt=33;function jt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Yt(e){let n=[];for(let r=0;r<Mt;r++){let t=r/(Mt-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function et(e){switch(e){case "linear":return "linear";case "ease-in":return Bt;case "ease-out":return Gt;case "ease-in-out":return jt()?Yt(re["ease-in-out"]):null;default:return null}}var At=Symbol.for("svg-scroll-draw.registry");function Lt(){let e=globalThis;return e[At]||(e[At]=new Map)}function Le(e,n){Lt().set(e,n);}function $e(e){Lt().delete(e);}var Ut=0;function Xt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(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 Zt(e,n,r){let t=document.createElement("div");t.setAttribute("data-svg-scroll-draw-debug",""),t.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function l(){let s=r==="x"?window.scrollX:window.scrollY,c=e-s,u=n-s,m=r==="x";t.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${c}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Mt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Yt(e,r,n){if(!Ke)return;let t=(e.match(Mt)??[]).join("").toUpperCase(),l=(r.match(Mt)??[]).join("").toUpperCase(),s=(e.match(xt)??[]).length,c=(r.match(xt)??[]).length;if(t!==l){ye(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,n);return}s!==c&&ye(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function st(e,r,n){let t=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*n).toFixed(4))})}function it(e,r={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:n,...t}=r,l=n?{...St[n],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:x={},stagger:N=0,direction:L="forward",once:te=false,debug:Ae=false,axis:W="y",scrollContainer:Z,autoReverse:X=false,delay:B=0,strokeColor:M,strokeWidth:$,fillOpacity:A,waypoints:w,velocityScale:I=false,threshold:O=0,rootMargin:C="0px",repeat:S=0,repeatDelay:ne=0,morphTo:k,clip:re,autoplay:oe=false,duration:J=1e3,native:ue=true,onProgress:y,onStart:T,onComplete:g,onEnter:p,onLeave:H,onEnterBack:de,onLeaveBack:ve}=l,me=re===true?"left":typeof re=="string"?re:false,Ee=typeof d=="function"?d:ee[d]??ee.linear,Le=pe(x.start??"top bottom"),ze=pe(x.end??"bottom top"),he=typeof Z=="string"?document.querySelector(Z):Z??null,be=Array.isArray(M)?M[0]:null,se=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ie=Array.isArray($)?$[0]:null,G=Array.isArray($)?$[1]:typeof $=="number"?$:null,fe=Array.isArray(A)?A[0]:null,Y=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function $e(o){let a=o*100;switch(me){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let V=me?[]:Array.from(e.querySelectorAll(c)),P=[],i=[],f=0,we=0,F=false,z=false,_=0,j=false,ae=-1,Ce=-1,K=false,Se=0,ke=0,He,tt=null;function ft(){tt?.destroy(),tt=null;}let Fe=new Set,pt=NaN,Re=true,je=-1,dt=performance.now(),_e=NaN;function nt(){return he?W==="x"?he.scrollLeft:he.scrollTop:W==="x"?window.scrollX:window.scrollY}function gt(){return he?W==="x"?he.clientWidth:he.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function yt(){let o=Je(e,he,W),a=xe(o,o.scroll,gt(),Le,ze);f=a.tStart,we=a.tEnd,Ae&&Ke&&(ft(),tt=Xt(f,we,W));}function Dt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),me){let v=a==="reverse"?1-o:o;e.style.clipPath=$e(v);return}V.forEach((v,le)=>{v.style.strokeDashoffset=a==="reverse"?`${P[le]*o}`:`${P[le]*(1-o)}`,m&&(v.style.opacity=a==="reverse"?`${1-o}`:`${o}`),be&&se?v.style.stroke=We(be,se,o):se&&(v.style.stroke=se),ie!==null&&G!==null?v.style.strokeWidth=`${ie+(G-ie)*o}`:G!==null&&(v.style.strokeWidth=`${G}`),fe!==null&&Y!==null?v.style.fillOpacity=`${fe+(Y-fe)*o}`:Y!==null&&(v.style.fillOpacity=`${Y}`),k&&v.tagName.toLowerCase()==="path"&&i[le]&&v.setAttribute("d",st(i[le],k,o));});}function Ue(){if(e.style.setProperty("--scroll-draw-progress","0"),me){e.style.clipPath=$e(0);return}V.forEach((o,a)=>{o.style.strokeDasharray=`${P[a]}`,o.style.strokeDashoffset=L==="reverse"?"0":`${P[a]}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`),k&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(V.forEach(o=>{Ut(o);let a=qe(o);P.push(a);let v=o.tagName.toLowerCase()==="path";v?i.push(o.getAttribute("d")??""):i.push(""),k&&(v?Yt(i[i.length-1],k,o):ye(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),se&&(o.style.stroke=se),G!==null&&(o.style.strokeWidth=`${G}`),Y!==null&&(o.style.fillOpacity=`${Y}`),k&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",k)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=L==="reverse"?"0":`${a}`,m?o.style.opacity=L==="reverse"?"1":"0":o.style.opacity="",be&&(o.style.stroke=be),ie!==null&&(o.style.strokeWidth=`${ie}`),fe!==null&&(o.style.fillOpacity=`${fe}`));}),me){if(s)return e.style.clipPath=$e(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=$e(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let ht=typeof d=="string"?et(d):null;function Ht(){return !(ue===false||!jt()||!V.length||!ht||me||W!=="y"||he||u!==1||N!==0||te||X||I!==false||k||w||S||B>0||y||T||g||p||H||de||ve||M!=null||$!=null||A!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function Ft(){let o=++Gt,a=`svg-scroll-draw-${o}`,v=`svg-scroll-draw-host-${o}`,le=`--svg-scroll-draw-${o}`,De=L==="reverse"?"0":"var(--ssd-len)",Pe=L==="reverse"?"var(--ssd-len)":"0",Me=`stroke-dashoffset:${De};`,E=`stroke-dashoffset:${Pe};`;m&&(Me+=`opacity:${L==="reverse"?1:0};`,E+=`opacity:${L==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${a}{from{${Me}}to{${E}}}.${v}{view-timeline-name:${le};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${ht};animation-fill-mode:both;animation-timeline:${le};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(v);function ce(h,U){h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`,h.style.strokeDashoffset="",h.style.opacity="",h.style.animationPlayState="",h.classList.add(a);}V.forEach(ce);let b=false,R=-1;function q(){if(R>=0)return R;let h=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:h.top,height:h.height},nt(),gt(),Le,ze);return Ee(Q(nt(),U,Te,u))}return {destroy(){e.classList.remove(v),V.forEach(h=>{h.classList.remove(a),h.style.removeProperty("--ssd-len"),h.style.animationPlayState="";}),D.remove();},replay(){b=false,R=-1,V.forEach(ce);},pause(){b=true,V.forEach(h=>{h.style.animationPlayState="paused";});},resume(){b&&(b=false,V.forEach(h=>{h.style.animationPlayState="running";}));},seek(h){let U=Math.min(1,Math.max(0,h));R=U,b=true,V.forEach((Te,ge)=>{Te.classList.remove(a),Te.style.strokeDashoffset=L==="reverse"?`${P[ge]*U}`:`${P[ge]*(1-U)}`,m&&(Te.style.opacity=L==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return q()},refresh(){V.forEach((h,U)=>{P[U]=qe(h),h.style.setProperty("--ssd-len",String(P[U])),h.style.strokeDasharray=`${P[U]}`;});}}}if(Ht())return Ft();function Rt(){let o=Math.max(1,J),a=0,v=0,le=false;function De(b){let R=true;if(me){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);Se=h,e.style.setProperty("--scroll-draw-progress",String(h)),e.style.clipPath=$e(L==="reverse"?1-h:h),y?.(h),q<1&&(R=false);}else V.forEach((q,h)=>{let U=h*N*o,Te=Math.min(1,Math.max(0,(b-U)/o)),ge=Ee(Te);q.style.strokeDashoffset=L==="reverse"?`${P[h]*ge}`:`${P[h]*(1-ge)}`,m&&(q.style.opacity=L==="reverse"?`${1-ge}`:`${ge}`),be&&se?q.style.stroke=We(be,se,ge):se&&(q.style.stroke=se),ie!==null&&G!==null?q.style.strokeWidth=`${ie+(G-ie)*ge}`:G!==null&&(q.style.strokeWidth=`${G}`),fe!==null&&Y!==null?q.style.fillOpacity=`${fe+(Y-fe)*ge}`:Y!==null&&(q.style.fillOpacity=`${Y}`),k&&q.tagName.toLowerCase()==="path"&&i[h]&&q.setAttribute("d",st(i[h],k,ge)),h===0&&(Se=ge,y?.(ge),e.style.setProperty("--scroll-draw-progress",String(ge))),Te<1&&(R=false);});if(w){let q=Math.min(1,Math.max(0,b/o)),h=Ee(q);for(let U in w){let Te=parseFloat(U);h>=Te&&!Fe.has(Te)&&(Fe.add(Te),w[U]?.());}}return R}function Pe(b){if(K)return;let R=b-a;z||(z=true,T?.());let q=De(R);if(q&&!F){F=true,De(o*(1+Math.max(0,V.length-1)*N)),g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{a=performance.now(),z=false,F=false,Fe.clear(),Ue(),_=requestAnimationFrame(Pe);},ne));return}q||(_=requestAnimationFrame(Pe));}function Me(){cancelAnimationFrame(_),clearTimeout(He),a=performance.now(),v=0,K=false,z=false,F=false,ke=0,le=true,Se=0,Fe.clear(),Ue(),_=requestAnimationFrame(Pe);}let E=new IntersectionObserver(b=>{b.forEach(R=>{R.isIntersecting&&!(te&&F)?Me():!R.isIntersecting&&!te&&!F&&(cancelAnimationFrame(_),clearTimeout(He),le=false);});},{root:he??null,threshold:O,rootMargin:C}),D;function ce(){clearTimeout(D),D=setTimeout(()=>{V.forEach((b,R)=>{P[R]=qe(b),b.style.strokeDasharray=`${P[R]}`;});},150);}return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),B>0?setTimeout(()=>E.observe(e),B):E.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(He),E.disconnect(),window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce),clearTimeout(D);},replay(){ke=0,Me();},pause(){K||!le||(K=true,v=performance.now()-a,cancelAnimationFrame(_));},resume(){K&&(K=false,le=true,a=performance.now()-v,_=requestAnimationFrame(Pe));},seek(b){let R=Math.min(1,Math.max(0,b));Se=R,K=true,v=R*o,a=performance.now()-v,cancelAnimationFrame(_),De(v);},getProgress(){return Se},refresh(){clearTimeout(D),V.forEach((b,R)=>{P[R]=qe(b),b.style.strokeDasharray=`${P[R]}`;});}}}if(oe)return Rt();yt();function Xe(){if(!j||K)return;let o=performance.now(),a=nt();if(!Re&&I===false&&a===pt){_=requestAnimationFrame(Xe);return}Re=false,pt=a;let v=u;if(I!==false){let E=o-dt,D=E>0?Math.abs(a-(je<0?a:je))/E:0;v=u*Math.max(.2,1+D*(typeof I=="number"?I:1)*.04);}je=a,dt=o;let le=X?Ce===-1||a>=Ce?"forward":"reverse":L;Ce=a;let De=we-f,Pe=true,Me=De===0?0:(a-f)/De;if(isNaN(_e)||(_e<=0&&Me>0?p?.():_e>0&&Me<=0&&ve?.(),_e<1&&Me>=1?H?.():_e>=1&&Me<1&&de?.()),_e=Me,me){let E=Ee(Q(a,f,we,v));te&&!X&&(ae=Math.max(ae,E),E=ae),Se=E,e.style.setProperty("--scroll-draw-progress",String(E));let D=le==="reverse"?1-E:E;e.style.clipPath=$e(D),y?.(E),!z&&Q(a,f,we,v)>0&&(z=true,T?.()),E>=1&&!F?(F=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{ae=-1,z=false,F=false,e.style.clipPath=$e(0);},ne))):E<1&&!te&&(F=false),_=requestAnimationFrame(Xe);return}if(V.forEach((E,D)=>{let ce=D*N*De,b=Ee(Q(a,f+ce,we+ce,v));te&&!X&&(ae=Math.max(ae,b),b=ae),Se=b,E.style.strokeDashoffset=le==="reverse"?`${P[D]*b}`:`${P[D]*(1-b)}`,m&&(E.style.opacity=le==="reverse"?`${1-b}`:`${b}`),be&&se?E.style.stroke=We(be,se,b):se&&(E.style.stroke=se),ie!==null&&G!==null?E.style.strokeWidth=`${ie+(G-ie)*b}`:G!==null&&(E.style.strokeWidth=`${G}`),fe!==null&&Y!==null?E.style.fillOpacity=`${fe+(Y-fe)*b}`:Y!==null&&(E.style.fillOpacity=`${Y}`),k&&E.tagName.toLowerCase()==="path"&&i[D]&&E.setAttribute("d",st(i[D],k,b)),D===0&&(y?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(Pe=false);}),w){let E=Ee(Q(a,f,we,v));for(let D in w){let ce=parseFloat(D);E>=ce&&!Fe.has(ce)&&(Fe.add(ce),w[D]?.());}}!z&&Q(a,f,we,v)>0&&(z=true,T?.()),Pe&&!F?(F=true,g?.(),ke<(S==="infinite"?1/0:S??0)&&(ke++,He=setTimeout(()=>{ae=-1,z=false,F=false,Fe.clear(),Ue(),Re=true;},ne))):!Pe&&!te&&(F=false),_=requestAnimationFrame(Xe);}let rt=false;function Ye(){rt||(rt=true,_=requestAnimationFrame(function(){Xe();}));}function Qe(){rt=false,cancelAnimationFrame(_);}let ot=new IntersectionObserver(o=>{o.forEach(a=>{j=a.isIntersecting,j&&!K?(Re=true,Ye()):Qe();});},{root:he??null,threshold:O,rootMargin:C});function bt(){V.forEach((o,a)=>{P[a]=qe(o),o.style.strokeDasharray=`${P[a]}`;}),yt(),Re=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(bt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),B>0?setTimeout(()=>ot.observe(e),B):ot.observe(e),{destroy(){cancelAnimationFrame(_),clearTimeout(He),Qe(),ot.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),ft();},replay(){ae=-1,Ce=-1,je=-1,z=false,F=false,ke=0,K=false,Se=0,Fe.clear(),clearTimeout(He),Ue(),Re=true,j&&Ye();},pause(){K=true,Qe();},resume(){K&&(K=false,Re=true,j&&Ye());},seek(o){let a=Math.min(1,Math.max(0,o));Se=a,ae=a,K=true,Qe(),Dt(a,L),Re=true;},getProgress(){return Se},refresh(){clearTimeout(Ze),bt(),j&&!K&&Ye();}}}var At=new Map;function Ne(e,r){At.set(e,r);}function Ve(e){At.delete(e);}function Qt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Lt(e){let r=[],n=/([\w]+)\(([^)]*)\)/g,t;for(;(t=n.exec(e))!==null;){let l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}r.push({fn:t[1],nums:l,units:s});}return r}function Zt(e,r,n){let t=Lt(e),l=Lt(r);return t.length===0||t.length!==l.length?n<1?e:r:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?n<1?`${s.fn}(${s.nums.map((m,d)=>`${m}${s.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,d)=>`${m+(u.nums[d]-m)*n}${s.units[d]}`).join(", ")})`}).join(" ")}function $t(e,r,n){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*n);let t=String(e),l=String(r);if(Qt(t))return We(t,l,n);if(t.includes("("))return Zt(t,l,n);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*n}${s[2]||c[2]}`}return n<1?t:l}function Jt(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Kt=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),en=0,Ct="--scroll-draw-progress";function tn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function at(e,r){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:N=false,respectReducedMotion:L=true,triggerElement:te,onProgress:Ae,onComplete:W,onEnter:Z,onLeave:X,onEnterBack:B,onLeaveBack:M}=r,$=L&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof s=="function"?s:ee[s]??ee["ease-out"],w=pe(l.start??"top bottom"),I=pe(l.end??"bottom top"),O=te??e,C=typeof d=="string"?document.querySelector(d):d??null,S=Object.entries(t).map(([i,f])=>({prop:Jt(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function ne(){let i=window.getComputedStyle(e);for(let f of S)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function k(){for(let i of S)e.style.setProperty(i.prop,String(i.to));}let re=new Map;for(let i of [...S.map(f=>f.prop),Ct])re.set(i,e.style.getPropertyValue(i));function oe(){for(let[i,f]of re)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if($)return k(),W?.(),{...n,destroy:oe,getProgress:()=>1};ne();let J=typeof s=="string"?et(s):null;function ue(){if(!x||!tn()||!J||m!=="y"||C||O!==e||u||c!==1||Ae||W||Z||X||B||M||N!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of S)if(!Kt.has(i.prop))return false;return true}function y(){let i=`ssd-a-${++en}`,f=S.map(j=>`${j.prop}:${j.from}`).join(";"),we=S.map(j=>`${j.prop}:${j.to}`).join(";"),F=document.createElement("style");F.setAttribute("data-ssd-animate",""),F.textContent=`@keyframes ${i}{from{${f}}to{${we}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${J};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(i);let z=()=>m==="x"?window.scrollX:window.scrollY,_=()=>m==="x"?window.innerWidth:window.innerHeight;return {destroy(){e.classList.remove(i),F.remove(),e.style.animationPlayState="",oe();},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(j){let ae=Math.min(1,Math.max(0,j));e.classList.remove(i);for(let Ce of S)e.style.setProperty(Ce.prop,$t(Ce.from,Ce.to,ae));},getProgress(){let j=e.getBoundingClientRect(),ae=z(),Ce=_(),{tStart:K,tEnd:Se}=xe({top:j.top,height:j.height},ae,Ce,w,I);return A(Q(ae,K,Se,c))}}}if(ue())return y();let T=0,g=0,p=0,H=false,de=false,ve=-1,me=0,Ee=false,Le=NaN,ze=-1,he=0,be=()=>C?m==="x"?C.scrollLeft:C.scrollTop:m==="x"?window.scrollX:window.scrollY,se=()=>C?m==="x"?C.clientWidth:C.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ie(){let i=Je(O,C,m),f=xe(i,i.scroll,se(),w,I);T=f.tStart,g=f.tEnd;}function G(i){e.style.setProperty(Ct,String(i));for(let f of S)e.style.setProperty(f.prop,$t(f.from,f.to,i));Ae?.(i);}function fe(i){if(isNaN(Le)){Le=i;return}Le<=0&&i>0?Z?.():Le>0&&i<=0&&M?.(),Le<1&&i>=1?X?.():Le>=1&&i<1&&B?.(),Le=i;}function Y(){if(!H||de)return;let i=performance.now(),f=be(),we=c;if(N!==false){let _=i-he,j=_>0?Math.abs(f-(ze<0?f:ze))/_:0;we=c*Math.max(.2,1+j*(typeof N=="number"?N:1)*.04);}ze=f,he=i;let F=g===T?0:(f-T)/(g-T);fe(F);let z=A(Q(f,T,g,we));u&&(ve=Math.max(ve,z),z=ve),me=z,G(z),z>=1&&!Ee?(Ee=true,W?.()):z<1&&!u&&(Ee=false),p=requestAnimationFrame(Y);}ie(),g===T&&ye("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=A(Q(be(),T,g,c));u&&i>0&&(ve=i),me=i,G(i);}let $e=new IntersectionObserver(i=>{i.forEach(f=>{H=f.isIntersecting,H&&!de?p=requestAnimationFrame(Y):cancelAnimationFrame(p);});},{root:C??null}),V;function P(){clearTimeout(V),V=setTimeout(ie,150);}return window.addEventListener("resize",P),window.addEventListener("orientationchange",P),$e.observe(e),Ne(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:T,tEnd:g})}),{destroy(){cancelAnimationFrame(p),$e.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),clearTimeout(V),oe(),Ve(e);},replay(){ve=-1,Ee=false,me=0,de=false,G(0);},pause(){de=true,cancelAnimationFrame(p);},resume(){de&&(de=false,H&&(p=requestAnimationFrame(Y)));},seek(i){let f=Math.min(1,Math.max(0,i));me=f,ve=f,de=true,cancelAnimationFrame(p),G(f);},getProgress(){return me}}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ct(e,r){if(typeof window>"u")return lt;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollCounter: element not found:",e),lt;let t=n,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:d=true,decimals:x,onComplete:N}=r,L=x!==void 0?y=>y.toFixed(x):c??(y=>String(Math.round(y))),te=typeof u=="function"?u:ee[u]??ee["ease-out"],Ae=pe(m.start??"top 80%"),W=pe(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=L(s),N?.(),lt;let X=0,B=0,M=0,$=false,A=false,w=-1,I=0,O=false,C=()=>window.scrollY,S=()=>window.innerHeight;function ne(){let y=t.getBoundingClientRect(),T=xe({top:y.top,height:y.height},C(),S(),Ae,W);X=T.tStart,B=T.tEnd;}function k(y){t.textContent=L(l+(s-l)*y),t.style.setProperty("--scroll-draw-progress",String(y));}function re(){if(!$||A)return;let y=te(Q(C(),X,B,1));d&&(w=Math.max(w,y),y=w),I=y,k(y),y>=1&&!O?(O=true,N?.()):y<1&&!d&&(O=false),M=requestAnimationFrame(re);}ne();{let y=te(Q(C(),X,B,1));d&&y>0&&(w=y),I=y,k(y);}let oe=new IntersectionObserver(y=>{y.forEach(T=>{$=T.isIntersecting,$&&!A?M=requestAnimationFrame(re):cancelAnimationFrame(M);});}),J;function ue(){clearTimeout(J),J=setTimeout(ne,150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),oe.observe(t),Ne(t,{type:"counter",getProgress:()=>I,getTrigger:()=>({tStart:X,tEnd:B})}),{destroy(){cancelAnimationFrame(M),oe.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(J),Ve(t);},replay(){w=-1,O=false,I=0,A=false,k(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,$&&(M=requestAnimationFrame(re)));},seek(y){let T=Math.min(1,Math.max(0,y));I=T,w=T,A=true,cancelAnimationFrame(M),k(T);},getProgress(){return I}}}var Pt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,r={}){if(typeof window>"u")return Pt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return ye("scrollVideo: <video> element not found:",e),Pt;let t=n,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:d,onComplete:x,onProgress:N}=r,L=window.matchMedia("(prefers-reduced-motion: reduce)").matches,te=typeof s=="function"?s:ee[s]??ee.linear,Ae=pe(l.start??"top top"),W=pe(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let Z=r.from??0,X=r.to,B=0,M=0,$=0,A=false,w=false,I=-1,O=0,C=false,S=false,ne=()=>u==="x"?window.scrollX:window.scrollY,k=()=>u==="x"?window.innerWidth:window.innerHeight;function re(){let p=t.getBoundingClientRect(),H=u==="x"?p.left:p.top,de=u==="x"?p.width:p.height,ve=xe({top:H,height:de},ne(),k(),Ae,W);B=ve.tStart,M=ve.tEnd;}function oe(p){if(!S)return;let H=X??t.duration??0;t.currentTime=Z+(H-Z)*p,t.style.setProperty("--scroll-draw-progress",String(p)),N?.(p);}function J(){if(!A||w||!S)return;let p=te(Q(ne(),B,M,1));c&&(I=Math.max(I,p),p=I),O=p,oe(p),p>=1&&!C?(C=true,x?.()):p<1&&!c&&(C=false),$=requestAnimationFrame(J);}function ue(){if(S=true,X===void 0&&(X=t.duration),L){oe(1),d?.();return}re(),d?.(),A&&!w&&($=requestAnimationFrame(J));}t.readyState>=1?ue():t.addEventListener("loadedmetadata",ue,{once:true}),S||re();let y=new IntersectionObserver(p=>{p.forEach(H=>{A=H.isIntersecting,A&&!w&&S?$=requestAnimationFrame(J):cancelAnimationFrame($);});}),T;function g(){clearTimeout(T),T=setTimeout(re,150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),y.observe(t),Ne(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:B,tEnd:M})}),{destroy(){cancelAnimationFrame($),y.disconnect(),t.removeEventListener("loadedmetadata",ue),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(T),Ve(t);},replay(){I=-1,C=false,O=0,w=false,oe(0);},pause(){w=true,cancelAnimationFrame($);},resume(){w&&(w=false,A&&S&&($=requestAnimationFrame(J)));},seek(p){let H=Math.min(1,Math.max(0,p));O=H,I=H,w=true,cancelAnimationFrame($),oe(H);},getProgress(){return O}}}function kt(e){let r=e.textContent??"";return e.textContent="",r.split(/(\s+)/).filter(Boolean).map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(t.textContent=n,t.style.whiteSpace="pre"):(t.textContent=n,t.style.display="inline-block"),e.appendChild(t),/^\s+$/.test(n)?null:t}).filter(n=>n!==null)}function nn(e){let r=e.textContent??"";return e.textContent="",r.split("").map(n=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=n,n===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),n===" "?null:t}).filter(n=>n!==null)}function It(e){let r=kt(e),n=new Map;for(let s of r){let c=s.offsetTop;n.has(c)||n.set(c,[]),n.get(c).push(s);}let t=[],l=Array.from(n.keys()).sort((s,c)=>s-c);for(let s of l){let c=n.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,d)=>{let x=m.nextElementSibling;u.appendChild(m),d<c.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function rn(e,r,n,t){if(n<=1||t===0)return e;let l=(n-1)*t,s=r*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function on(e,r){let n=[];if(r?.y!==void 0&&n.push(`translateY(${r.y*(1-e)}px)`),r?.x!==void 0&&n.push(`translateX(${r.x*(1-e)}px)`),r?.rotate!==void 0&&n.push(`rotate(${r.rotate*(1-e)}deg)`),r?.scale!==void 0){let t=r.scale+(1-r.scale)*e;n.push(`scale(${t})`);}return n.join(" ")||""}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,r={}){if(typeof window>"u")return Ot;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return ye("scrollText: element not found:",e),Ot;let t=n,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:d=true,onComplete:x}=r,N=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=typeof c=="function"?c:ee[c]??ee["ease-out"],te=pe(m.start??"top 85%"),Ae=pe(m.end??"top 40%"),W=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let Z;l==="chars"?Z=nn(t):l==="lines"?Z=It(t):Z=kt(t);let X=Z.length;function B(g,p){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*p));let H=on(p,u);H&&(g.style.transform=H);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),Z.forEach((p,H)=>{let de=L(rn(g,H,X,s));B(p,de);});}if(N)return M(1),x?.(),{destroy(){t.innerHTML=W,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let $=0,A=0,w=0,I=false,O=false,C=-1,S=0,ne=false,k=()=>window.scrollY,re=()=>window.innerHeight;function oe(){let g=t.getBoundingClientRect(),p=xe({top:g.top,height:g.height},k(),re(),te,Ae);$=p.tStart,A=p.tEnd;}function J(){if(!I||O)return;let g=Q(k(),$,A,1);d&&(C=Math.max(C,g),g=C),S=g,M(g),g>=1&&!ne?(ne=true,x?.()):g<1&&!d&&(ne=false),w=requestAnimationFrame(J);}oe();let ue=new IntersectionObserver(g=>{g.forEach(p=>{I=p.isIntersecting,I&&!O?w=requestAnimationFrame(J):cancelAnimationFrame(w);});}),y;function T(){clearTimeout(y),y=setTimeout(()=>{if(l==="lines"){let g=S;t.innerHTML=W,t.setAttribute("aria-label",t.textContent??""),Z=It(t),M(g);}oe();},150);}return window.addEventListener("resize",T),window.addEventListener("orientationchange",T),ue.observe(t),Ne(t,{type:"text",getProgress:()=>S,getTrigger:()=>({tStart:$,tEnd:A})}),{destroy(){cancelAnimationFrame(w),ue.disconnect(),window.removeEventListener("resize",T),window.removeEventListener("orientationchange",T),clearTimeout(y),t.innerHTML=W,t.removeAttribute("aria-label"),Ve(t);},replay(){C=-1,ne=false,S=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,I&&(w=requestAnimationFrame(J)));},seek(g){let p=Math.min(1,Math.max(0,g));S=p,C=p,O=true,cancelAnimationFrame(w),M(p);},getProgress(){return S}}}function zn(e={}){let r,n;return onMount(()=>{r&&(n=it(r,e));}),onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function _n(e={}){let r,n;return onMount(()=>{r&&(n=it(r,e));}),onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function qn(e){let r,n;return onMount(()=>{r&&(n=at(r,e));}),onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Wn(e){let r,n;return onMount(()=>{r&&(n=at(r,e));}),onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function Bn(e){let r,n;return onMount(()=>{r&&(n=ct(r,e));}),onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Gn(e){let r,n;return onMount(()=>{r&&(n=ct(r,e));}),onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function jn(e={}){let r,n;return onMount(()=>{r&&(n=ut(r,e));}),onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Un(e={}){let r,n;return onMount(()=>{r&&(n=ut(r,e));}),onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}function Xn(e={}){let r,n;return onMount(()=>{r&&(n=mt(r,e));}),onCleanup(()=>{n?.destroy();}),t=>{r=t;}}function Yn(e={}){let r,n;return onMount(()=>{r&&(n=mt(r,e));}),onCleanup(()=>{n?.destroy(),n=void 0;}),{ref:t=>{r=t;},getInstance:()=>n}}export{Wn as createScrollAnimate,Gn as createScrollCounter,_n as createScrollDraw,Yn as createScrollText,Un as createScrollVideo,qn as useScrollAnimate,Bn as useScrollCounter,zn as useScrollDraw,Xn as useScrollText,jn as useScrollVideo};
|
|
3
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(t),window.addEventListener("scroll",l,{passive:true}),l(),{el:t,destroy(){window.removeEventListener("scroll",l),t.remove();}}}var $t=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ct=/[MmLlHhVvCcSsQqTtAaZz]/g;function Kt(e,n,r){if(!Je)return;let t=(e.match(Ct)??[]).join("").toUpperCase(),l=(n.match(Ct)??[]).join("").toUpperCase(),s=(e.match($t)??[]).length,c=(n.match($t)??[]).length;if(t!==l){we(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${l||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}s!==c&&we(`morphTo: coordinate count differs (${s} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function it(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),l=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,s=>{let c=parseFloat(s),u=t[l++]??c;return String(+(c+(u-c)*r).toFixed(4))})}function at(e,n={}){if(typeof window>"u")return {destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};let{preset:r,...t}=n,l=r?{...xt[r],...t}:t,s=window.matchMedia("(prefers-reduced-motion: reduce)").matches,{selector:c="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:T={},stagger:V=0,direction:$="forward",once:ne=false,debug:Ce=false,axis:B="y",scrollContainer:J,autoReverse:X=false,delay:G=0,strokeColor:M,strokeWidth:C,fillOpacity:A,waypoints:w,velocityScale:k=false,threshold:O=0,rootMargin:P="0px",repeat:E=0,repeatDelay:oe=0,morphTo:D,clip:se,autoplay:ie=false,duration:ee=1e3,native:ae=true,onProgress:d,onStart:x,onComplete:g,onEnter:L,onLeave:S,onEnterBack:F,onLeaveBack:fe}=l,Q=se===true?"left":typeof se=="string"?se:false,Se=typeof p=="function"?p:re[p]??re.linear,Pe=de(T.start??"top bottom"),ze=de(T.end??"bottom top"),ve=typeof J=="string"?document.querySelector(J):J??null,Ee=Array.isArray(M)?M[0]:null,le=Array.isArray(M)?M[1]:typeof M=="string"?M:null,ce=Array.isArray(C)?C[0]:null,j=Array.isArray(C)?C[1]:typeof C=="number"?C:null,pe=Array.isArray(A)?A[0]:null,Z=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function Ie(o){let a=o*100;switch(Q){case "right":return `inset(0 0 0 ${100-a}%)`;case "top":return `inset(0 0 ${100-a}% 0)`;case "bottom":return `inset(${100-a}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let z=Q?[]:Array.from(e.querySelectorAll(c)),I=[],i=[],f=0,ge=0,R=false,_=false,q=0,Me=false,ye=-1,te=-1,Y=false,he=0,He=0,Re,tt=null;function pt(){tt?.destroy(),tt=null;}let Ne=new Set,dt=NaN,Ve=true,je=-1,gt=performance.now(),_e=NaN;function rt(){return ve?B==="x"?ve.scrollLeft:ve.scrollTop:B==="x"?window.scrollX:window.scrollY}function yt(){return ve?B==="x"?ve.clientWidth:ve.clientHeight:B==="x"?window.innerWidth:window.innerHeight}function ht(){let o=Ke(e,ve,B);return xe(o,o.scroll,yt(),Pe,ze)}function bt(){(({tStart:f,tEnd:ge}=ht())),Ce&&Je&&(pt(),tt=Zt(f,ge,B));}function nt(o,a=ht){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:a});let b=o.destroy;return o.destroy=()=>{b.call(o),$e(e);},o}function Rt(o,a){if(e.style.setProperty("--scroll-draw-progress",String(o)),Q){let b=a==="reverse"?1-o:o;e.style.clipPath=Ie(b);return}z.forEach((b,ue)=>{b.style.strokeDashoffset=a==="reverse"?`${I[ue]*o}`:`${I[ue]*(1-o)}`,m&&(b.style.opacity=a==="reverse"?`${1-o}`:`${o}`),Ee&&le?b.style.stroke=We(Ee,le,o):le&&(b.style.stroke=le),ce!==null&&j!==null?b.style.strokeWidth=`${ce+(j-ce)*o}`:j!==null&&(b.style.strokeWidth=`${j}`),pe!==null&&Z!==null?b.style.fillOpacity=`${pe+(Z-pe)*o}`:Z!==null&&(b.style.fillOpacity=`${Z}`),D&&b.tagName.toLowerCase()==="path"&&i[ue]&&b.setAttribute("d",it(i[ue],D,o));});}function Ye(){if(e.style.setProperty("--scroll-draw-progress","0"),Q){e.style.clipPath=Ie(0);return}z.forEach((o,a)=>{o.style.strokeDasharray=`${I[a]}`,o.style.strokeDashoffset=$==="reverse"?"0":`${I[a]}`,m?o.style.opacity=$==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`),D&&o.tagName.toLowerCase()==="path"&&i[a]&&o.setAttribute("d",i[a]);});}if(z.forEach(o=>{Qt(o);let a=qe(o);I.push(a);let b=o.tagName.toLowerCase()==="path";b?i.push(o.getAttribute("d")??""):i.push(""),D&&(b?Kt(i[i.length-1],D,o):we(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),s?(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=$==="reverse"?`${a}`:"0",m&&(o.style.opacity="1"),le&&(o.style.stroke=le),j!==null&&(o.style.strokeWidth=`${j}`),Z!==null&&(o.style.fillOpacity=`${Z}`),D&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",D)):(o.style.strokeDasharray=`${a}`,o.style.strokeDashoffset=$==="reverse"?"0":`${a}`,m?o.style.opacity=$==="reverse"?"1":"0":o.style.opacity="",Ee&&(o.style.stroke=Ee),ce!==null&&(o.style.strokeWidth=`${ce}`),pe!==null&&(o.style.fillOpacity=`${pe}`));}),Q){if(s)return e.style.clipPath=Ie(1),g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Ie(0);}else if(s)return g?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let wt=typeof p=="string"?et(p):null;function Nt(){return !(ae===false||!Xt()||!z.length||!wt||Q||B!=="y"||ve||u!==1||V!==0||ne||X||k!==false||D||w||E||G>0||d||x||g||L||S||F||fe||M!=null||C!=null||A!=null||(T.start??"top bottom").trim()!=="top bottom"||(T.end??"bottom top").trim()!=="bottom top")}function Vt(){let o=++Ut,a=`svg-scroll-draw-${o}`,b=`svg-scroll-draw-host-${o}`,ue=`--svg-scroll-draw-${o}`,Fe=$==="reverse"?"0":"var(--ssd-len)",ke=$==="reverse"?"var(--ssd-len)":"0",Ae=`stroke-dashoffset:${Fe};`,v=`stroke-dashoffset:${ke};`;m&&(Ae+=`opacity:${$==="reverse"?1:0};`,v+=`opacity:${$==="reverse"?0:1};`);let H=document.createElement("style");H.setAttribute("data-svg-scroll-draw",""),H.textContent=`@keyframes ${a}{from{${Ae}}to{${v}}}.${b}{view-timeline-name:${ue};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${wt};animation-fill-mode:both;animation-timeline:${ue};animation-range:cover 0% cover 100%;}`,document.head.appendChild(H),e.classList.add(b);function me(y,U){y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}z.forEach(me);let h=false,N=-1;function W(){if(N>=0)return N;let y=e.getBoundingClientRect(),{tStart:U,tEnd:Te}=xe({top:y.top,height:y.height},rt(),yt(),Pe,ze);return Se(K(rt(),U,Te,u))}return {destroy(){e.classList.remove(b),z.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),H.remove();},replay(){h=false,N=-1,z.forEach(me);},pause(){h=true,z.forEach(y=>{y.style.animationPlayState="paused";});},resume(){h&&(h=false,z.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let U=Math.min(1,Math.max(0,y));N=U,h=true,z.forEach((Te,be)=>{Te.classList.remove(a),Te.style.strokeDashoffset=$==="reverse"?`${I[be]*U}`:`${I[be]*(1-U)}`,m&&(Te.style.opacity=$==="reverse"?`${1-U}`:`${U}`);});},getProgress(){return W()},refresh(){z.forEach((y,U)=>{I[U]=qe(y),y.style.setProperty("--ssd-len",String(I[U])),y.style.strokeDasharray=`${I[U]}`;});}}}if(Nt())return nt(Vt());function zt(){let o=Math.max(1,ee),a=0,b=0,ue=false;function Fe(h){let N=true;if(Q){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);he=y,e.style.setProperty("--scroll-draw-progress",String(y)),e.style.clipPath=Ie($==="reverse"?1-y:y),d?.(y),W<1&&(N=false);}else z.forEach((W,y)=>{let U=y*V*o,Te=Math.min(1,Math.max(0,(h-U)/o)),be=Se(Te);W.style.strokeDashoffset=$==="reverse"?`${I[y]*be}`:`${I[y]*(1-be)}`,m&&(W.style.opacity=$==="reverse"?`${1-be}`:`${be}`),Ee&&le?W.style.stroke=We(Ee,le,be):le&&(W.style.stroke=le),ce!==null&&j!==null?W.style.strokeWidth=`${ce+(j-ce)*be}`:j!==null&&(W.style.strokeWidth=`${j}`),pe!==null&&Z!==null?W.style.fillOpacity=`${pe+(Z-pe)*be}`:Z!==null&&(W.style.fillOpacity=`${Z}`),D&&W.tagName.toLowerCase()==="path"&&i[y]&&W.setAttribute("d",it(i[y],D,be)),y===0&&(he=be,d?.(be),e.style.setProperty("--scroll-draw-progress",String(be))),Te<1&&(N=false);});if(w){let W=Math.min(1,Math.max(0,h/o)),y=Se(W);for(let U in w){let Te=parseFloat(U);y>=Te&&!Ne.has(Te)&&(Ne.add(Te),w[U]?.());}}return N}function ke(h){if(Y)return;let N=h-a;_||(_=true,x?.());let W=Fe(N);if(W&&!R){R=true,Fe(o*(1+Math.max(0,z.length-1)*V)),g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{a=performance.now(),_=false,R=false,Ne.clear(),Ye(),q=requestAnimationFrame(ke);},oe));return}W||(q=requestAnimationFrame(ke));}function Ae(){cancelAnimationFrame(q),clearTimeout(Re),a=performance.now(),b=0,Y=false,_=false,R=false,He=0,ue=true,he=0,Ne.clear(),Ye(),q=requestAnimationFrame(ke);}let v=new IntersectionObserver(h=>{h.forEach(N=>{N.isIntersecting&&!(ne&&R)?Ae():!N.isIntersecting&&!ne&&!R&&(cancelAnimationFrame(q),clearTimeout(Re),ue=false);});},{root:ve??null,threshold:O,rootMargin:P}),H;function me(){clearTimeout(H),H=setTimeout(()=>{z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});},150);}return window.addEventListener("resize",me),window.addEventListener("orientationchange",me),G>0?setTimeout(()=>v.observe(e),G):v.observe(e),{destroy(){cancelAnimationFrame(q),clearTimeout(Re),v.disconnect(),window.removeEventListener("resize",me),window.removeEventListener("orientationchange",me),clearTimeout(H);},replay(){He=0,Ae();},pause(){Y||!ue||(Y=true,b=performance.now()-a,cancelAnimationFrame(q));},resume(){Y&&(Y=false,ue=true,a=performance.now()-b,q=requestAnimationFrame(ke));},seek(h){let N=Math.min(1,Math.max(0,h));he=N,Y=true,b=N*o,a=performance.now()-b,cancelAnimationFrame(q),Fe(b);},getProgress(){return he},refresh(){clearTimeout(H),z.forEach((h,N)=>{I[N]=qe(h),h.style.strokeDasharray=`${I[N]}`;});}}}if(ie)return nt(zt());bt();function Ue(){if(!Me||Y)return;let o=performance.now(),a=rt();if(!Ve&&k===false&&a===dt){q=requestAnimationFrame(Ue);return}Ve=false,dt=a;let b=u;if(k!==false){let v=o-gt,H=v>0?Math.abs(a-(je<0?a:je))/v:0;b=u*Math.max(.2,1+H*(typeof k=="number"?k:1)*.04);}je=a,gt=o;let ue=X?te===-1||a>=te?"forward":"reverse":$;te=a;let Fe=ge-f,ke=true,Ae=Fe===0?0:(a-f)/Fe;if(isNaN(_e)||(_e<=0&&Ae>0?L?.():_e>0&&Ae<=0&&fe?.(),_e<1&&Ae>=1?S?.():_e>=1&&Ae<1&&F?.()),_e=Ae,Q){let v=Se(K(a,f,ge,b));ne&&!X&&(ye=Math.max(ye,v),v=ye),he=v,e.style.setProperty("--scroll-draw-progress",String(v));let H=ue==="reverse"?1-v:v;e.style.clipPath=Ie(H),d?.(v),!_&&K(a,f,ge,b)>0&&(_=true,x?.()),v>=1&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,e.style.clipPath=Ie(0);},oe))):v<1&&!ne&&(R=false),q=requestAnimationFrame(Ue);return}if(z.forEach((v,H)=>{let me=H*V*Fe,h=Se(K(a,f+me,ge+me,b));ne&&!X&&(ye=Math.max(ye,h),h=ye),he=h,v.style.strokeDashoffset=ue==="reverse"?`${I[H]*h}`:`${I[H]*(1-h)}`,m&&(v.style.opacity=ue==="reverse"?`${1-h}`:`${h}`),Ee&&le?v.style.stroke=We(Ee,le,h):le&&(v.style.stroke=le),ce!==null&&j!==null?v.style.strokeWidth=`${ce+(j-ce)*h}`:j!==null&&(v.style.strokeWidth=`${j}`),pe!==null&&Z!==null?v.style.fillOpacity=`${pe+(Z-pe)*h}`:Z!==null&&(v.style.fillOpacity=`${Z}`),D&&v.tagName.toLowerCase()==="path"&&i[H]&&v.setAttribute("d",it(i[H],D,h)),H===0&&(d?.(h),e.style.setProperty("--scroll-draw-progress",String(h))),h<1&&(ke=false);}),w){let v=Se(K(a,f,ge,b));for(let H in w){let me=parseFloat(H);v>=me&&!Ne.has(me)&&(Ne.add(me),w[H]?.());}}!_&&K(a,f,ge,b)>0&&(_=true,x?.()),ke&&!R?(R=true,g?.(),He<(E==="infinite"?1/0:E??0)&&(He++,Re=setTimeout(()=>{ye=-1,_=false,R=false,Ne.clear(),Ye(),Ve=true;},oe))):!ke&&!ne&&(R=false),q=requestAnimationFrame(Ue);}let ot=false;function Xe(){ot||(ot=true,q=requestAnimationFrame(function(){Ue();}));}function Qe(){ot=false,cancelAnimationFrame(q);}let st=new IntersectionObserver(o=>{o.forEach(a=>{Me=a.isIntersecting,Me&&!Y?(Ve=true,Xe()):Qe();});},{root:ve??null,threshold:O,rootMargin:P});function vt(){z.forEach((o,a)=>{I[a]=qe(o),o.style.strokeDasharray=`${I[a]}`;}),bt(),Ve=true;}let Ze;function Be(){clearTimeout(Ze),Ze=setTimeout(vt,150);}window.addEventListener("resize",Be),window.addEventListener("orientationchange",Be);let Ge;return typeof ResizeObserver<"u"&&(Ge=new ResizeObserver(()=>Be()),Ge.observe(document.body),Ge.observe(document.documentElement),Ge.observe(e)),G>0?setTimeout(()=>st.observe(e),G):st.observe(e),nt({destroy(){cancelAnimationFrame(q),clearTimeout(Re),Qe(),st.disconnect(),Ge?.disconnect(),window.removeEventListener("resize",Be),window.removeEventListener("orientationchange",Be),clearTimeout(Ze),pt();},replay(){ye=-1,te=-1,je=-1,_=false,R=false,He=0,Y=false,he=0,Ne.clear(),clearTimeout(Re),Ye(),Ve=true,Me&&Xe();},pause(){Y=true,Qe();},resume(){Y&&(Y=false,Ve=true,Me&&Xe());},seek(o){let a=Math.min(1,Math.max(0,o));he=a,ye=a,Y=true,Qe(),Rt(a,$),Ve=true;},getProgress(){return he},refresh(){clearTimeout(Ze),vt(),Me&&!Y&&Xe();}},()=>({tStart:f,tEnd:ge}))}function Jt(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 l=[],s=[],c=t[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);l.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}n.push({fn:t[1],nums:l,units:s});}return n}function er(e,n,r){let t=Pt(e),l=Pt(n);return t.length===0||t.length!==l.length?r<1?e:n:t.map((s,c)=>{let u=l[c];return s.fn!==u.fn||s.nums.length!==u.nums.length?r<1?`${s.fn}(${s.nums.map((m,p)=>`${m}${s.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,p)=>`${m+(u.nums[p]-m)*r}${s.units[p]}`).join(", ")})`}).join(" ")}function It(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),l=String(n);if(Jt(t))return We(t,l,r);if(t.includes("("))return er(t,l,r);let s=t.match(/^([-+]?[\d.]+)(.*)$/),c=l.match(/^([-+]?[\d.]+)(.*)$/);if(s&&c){let u=parseFloat(s[1]),m=parseFloat(c[1]);return `${u+(m-u)*r}${s[2]||c[2]}`}return r<1?t:l}function tr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var rr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),nr=0,kt="--scroll-draw-progress";function or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}function lt(e,n){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let{props:t,trigger:l={},easing:s="ease-out",speed:c=1,once:u=false,axis:m="y",scrollContainer:p,native:T=true,velocityScale:V=false,respectReducedMotion:$=true,triggerElement:ne,onProgress:Ce,onComplete:B,onEnter:J,onLeave:X,onEnterBack:G,onLeaveBack:M}=n,C=$&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,A=typeof s=="function"?s:re[s]??re["ease-out"],w=de(l.start??"top bottom"),k=de(l.end??"bottom top"),O=ne??e,P=typeof p=="string"?document.querySelector(p):p??null,E=Object.entries(t).map(([i,f])=>({prop:tr(i),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function oe(){let i=window.getComputedStyle(e);for(let f of E)f.from===""&&(f.from=i.getPropertyValue(f.prop).trim()||"0");}function D(){for(let i of E)e.style.setProperty(i.prop,String(i.to));}let se=new Map;for(let i of [...E.map(f=>f.prop),kt])se.set(i,e.style.getPropertyValue(i));function ie(){for(let[i,f]of se)f?e.style.setProperty(i,f):e.style.removeProperty(i);}if(C)return D(),B?.(),{...r,destroy:ie,getProgress:()=>1};oe();let ee=typeof s=="string"?et(s):null;function ae(){if(!T||!or()||!ee||m!=="y"||P||O!==e||u||c!==1||Ce||B||J||X||G||M||V!==false||(l.start??"top bottom").trim()!=="top bottom"||(l.end??"bottom top").trim()!=="bottom top")return false;for(let i of E)if(!rr.has(i.prop))return false;return true}function d(){let i=`ssd-a-${++nr}`,f=E.map(te=>`${te.prop}:${te.from}`).join(";"),ge=E.map(te=>`${te.prop}:${te.to}`).join(";"),R=document.createElement("style");R.setAttribute("data-ssd-animate",""),R.textContent=`@keyframes ${i}{from{${f}}to{${ge}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ee};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(R),e.classList.add(i);let _=()=>m==="x"?window.scrollX:window.scrollY,q=()=>m==="x"?window.innerWidth:window.innerHeight,Me=()=>{let te=e.getBoundingClientRect();return xe({top:te.top,height:te.height},_(),q(),w,k)};Le(e,{type:"animate",getProgress:()=>ye.getProgress(),getTrigger:Me});let ye={destroy(){e.classList.remove(i),R.remove(),e.style.animationPlayState="",ie(),$e(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(te){let Y=Math.min(1,Math.max(0,te));e.classList.remove(i);for(let he of E)e.style.setProperty(he.prop,It(he.from,he.to,Y));},getProgress(){let{tStart:te,tEnd:Y}=Me();return A(K(_(),te,Y,c))}};return ye}if(ae())return d();let x=0,g=0,L=0,S=false,F=false,fe=-1,Q=0,Se=false,Pe=NaN,ze=-1,ve=0,Ee=()=>P?m==="x"?P.scrollLeft:P.scrollTop:m==="x"?window.scrollX:window.scrollY,le=()=>P?m==="x"?P.clientWidth:P.clientHeight:m==="x"?window.innerWidth:window.innerHeight;function ce(){let i=Ke(O,P,m),f=xe(i,i.scroll,le(),w,k);x=f.tStart,g=f.tEnd;}function j(i){e.style.setProperty(kt,String(i));for(let f of E)e.style.setProperty(f.prop,It(f.from,f.to,i));Ce?.(i);}function pe(i){if(isNaN(Pe)){Pe=i;return}Pe<=0&&i>0?J?.():Pe>0&&i<=0&&M?.(),Pe<1&&i>=1?X?.():Pe>=1&&i<1&&G?.(),Pe=i;}function Z(){if(!S||F)return;let i=performance.now(),f=Ee(),ge=c;if(V!==false){let q=i-ve,Me=q>0?Math.abs(f-(ze<0?f:ze))/q:0;ge=c*Math.max(.2,1+Me*(typeof V=="number"?V:1)*.04);}ze=f,ve=i;let R=g===x?0:(f-x)/(g-x);pe(R);let _=A(K(f,x,g,ge));u&&(fe=Math.max(fe,_),_=fe),Q=_,j(_),_>=1&&!Se?(Se=true,B?.()):_<1&&!u&&(Se=false),L=requestAnimationFrame(Z);}ce(),g===x&&we("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let i=A(K(Ee(),x,g,c));u&&i>0&&(fe=i),Q=i,j(i);}let Ie=new IntersectionObserver(i=>{i.forEach(f=>{S=f.isIntersecting,S&&!F?L=requestAnimationFrame(Z):cancelAnimationFrame(L);});},{root:P??null}),z;function I(){clearTimeout(z),z=setTimeout(ce,150);}return window.addEventListener("resize",I),window.addEventListener("orientationchange",I),Ie.observe(e),Le(e,{type:"animate",getProgress:()=>Q,getTrigger:()=>({tStart:x,tEnd:g})}),{destroy(){cancelAnimationFrame(L),Ie.disconnect(),window.removeEventListener("resize",I),window.removeEventListener("orientationchange",I),clearTimeout(z),ie(),$e(e);},replay(){fe=-1,Se=false,Q=0,F=false,j(0);},pause(){F=true,cancelAnimationFrame(L);},resume(){F&&(F=false,S&&(L=requestAnimationFrame(Z)));},seek(i){let f=Math.min(1,Math.max(0,i));Q=f,fe=f,F=true,cancelAnimationFrame(L),j(f);},getProgress(){return Q}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ut(e,n){if(typeof window>"u")return ct;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollCounter: element not found:",e),ct;let t=r,{from:l=0,to:s,format:c,easing:u="ease-out",trigger:m={},once:p=true,decimals:T,onComplete:V}=n,$=T!==void 0?d=>d.toFixed(T):c??(d=>String(Math.round(d))),ne=typeof u=="function"?u:re[u]??re["ease-out"],Ce=de(m.start??"top 80%"),B=de(m.end??"top 20%");if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t.textContent=$(s),V?.(),ct;let X=0,G=0,M=0,C=false,A=false,w=-1,k=0,O=false,P=()=>window.scrollY,E=()=>window.innerHeight;function oe(){let d=t.getBoundingClientRect(),x=xe({top:d.top,height:d.height},P(),E(),Ce,B);X=x.tStart,G=x.tEnd;}function D(d){t.textContent=$(l+(s-l)*d),t.style.setProperty("--scroll-draw-progress",String(d));}function se(){if(!C||A)return;let d=ne(K(P(),X,G,1));p&&(w=Math.max(w,d),d=w),k=d,D(d),d>=1&&!O?(O=true,V?.()):d<1&&!p&&(O=false),M=requestAnimationFrame(se);}oe();{let d=ne(K(P(),X,G,1));p&&d>0&&(w=d),k=d,D(d);}let ie=new IntersectionObserver(d=>{d.forEach(x=>{C=x.isIntersecting,C&&!A?M=requestAnimationFrame(se):cancelAnimationFrame(M);});}),ee;function ae(){clearTimeout(ee),ee=setTimeout(oe,150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),ie.observe(t),Le(t,{type:"counter",getProgress:()=>k,getTrigger:()=>({tStart:X,tEnd:G})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ee),$e(t);},replay(){w=-1,O=false,k=0,A=false,D(0);},pause(){A=true,cancelAnimationFrame(M);},resume(){A&&(A=false,C&&(M=requestAnimationFrame(se)));},seek(d){let x=Math.min(1,Math.max(0,d));k=x,w=x,A=true,cancelAnimationFrame(M),D(x);},getProgress(){return k}}}var Ot={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function mt(e,n={}){if(typeof window>"u")return Ot;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return we("scrollVideo: <video> element not found:",e),Ot;let t=r,{trigger:l={},easing:s="linear",once:c=false,axis:u="y",preload:m="auto",onReady:p,onComplete:T,onProgress:V}=n,$=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ne=typeof s=="function"?s:re[s]??re.linear,Ce=de(l.start??"top top"),B=de(l.end??"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=m);let J=n.from??0,X=n.to,G=0,M=0,C=0,A=false,w=false,k=-1,O=0,P=false,E=false,oe=()=>u==="x"?window.scrollX:window.scrollY,D=()=>u==="x"?window.innerWidth:window.innerHeight;function se(){let S=t.getBoundingClientRect(),F=u==="x"?S.left:S.top,fe=u==="x"?S.width:S.height,Q=xe({top:F,height:fe},oe(),D(),Ce,B);G=Q.tStart,M=Q.tEnd;}let ie=NaN;function ee(S){if(!E)return;let F=X??t.duration??0,fe=J+(F-J)*S;fe!==ie&&(ie=fe,t.currentTime=fe),t.style.setProperty("--scroll-draw-progress",String(S)),V?.(S);}function ae(){if(!A||w||!E)return;let S=ne(K(oe(),G,M,1));c&&(k=Math.max(k,S),S=k),O=S,ee(S),S>=1&&!P?(P=true,T?.()):S<1&&!c&&(P=false),C=requestAnimationFrame(ae);}function d(){if(E=true,X===void 0&&(X=t.duration),$){ee(1),p?.();return}se(),p?.(),A&&!w&&(C=requestAnimationFrame(ae));}t.readyState>=1?d():t.addEventListener("loadedmetadata",d,{once:true}),E||se();let x=new IntersectionObserver(S=>{S.forEach(F=>{A=F.isIntersecting,A&&!w&&E?C=requestAnimationFrame(ae):cancelAnimationFrame(C);});}),g;function L(){clearTimeout(g),g=setTimeout(se,150);}return window.addEventListener("resize",L),window.addEventListener("orientationchange",L),x.observe(t),Le(t,{type:"video",getProgress:()=>O,getTrigger:()=>({tStart:G,tEnd:M})}),{destroy(){cancelAnimationFrame(C),x.disconnect(),t.removeEventListener("loadedmetadata",d),window.removeEventListener("resize",L),window.removeEventListener("orientationchange",L),clearTimeout(g),$e(t);},replay(){k=-1,P=false,O=0,w=false,ie=NaN,ee(0);},pause(){w=true,cancelAnimationFrame(C);},resume(){w&&(w=false,A&&E&&(C=requestAnimationFrame(ae)));},seek(S){let F=Math.min(1,Math.max(0,S));O=F,k=F,w=true,cancelAnimationFrame(C),ie=NaN,ee(F);},getProgress(){return O}}}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 sr(e){let n=e.textContent??"";return e.textContent="",n.split("").map(r=>{let t=document.createElement("span");return t.setAttribute("aria-hidden","true"),t.textContent=r,r===" "?t.style.whiteSpace="pre":t.style.display="inline-block",e.appendChild(t),r===" "?null:t}).filter(r=>r!==null)}function Dt(e){let n=Ft(e),r=new Map;for(let s of n){let c=s.offsetTop;r.has(c)||r.set(c,[]),r.get(c).push(s);}let t=[],l=Array.from(r.keys()).sort((s,c)=>s-c);for(let s of l){let c=r.get(s),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",c.forEach((m,p)=>{let T=m.nextElementSibling;u.appendChild(m),p<c.length-1&&T&&T.style.whiteSpace==="pre"&&u.appendChild(T);}),t.push(u);}return e.textContent="",t.forEach((s,c)=>{e.appendChild(s),c<t.length-1&&e.appendChild(document.createTextNode(" "));}),t}function ir(e,n,r,t){if(r<=1||t===0)return e;let l=(r-1)*t,s=n*t,c=s+(1-l);return c<=s?e>=s?1:0:Math.min(1,Math.max(0,(e-s)/(c-s)))}function ar(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 Ht={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ft(e,n={}){if(typeof window>"u")return Ht;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return we("scrollText: element not found:",e),Ht;let t=r,{split:l="words",stagger:s=.04,easing:c="ease-out",from:u={opacity:0,y:24},trigger:m={},once:p=true,onComplete:T}=n,V=window.matchMedia("(prefers-reduced-motion: reduce)").matches,$=typeof c=="function"?c:re[c]??re["ease-out"],ne=de(m.start??"top 85%"),Ce=de(m.end??"top 40%"),B=t.innerHTML;t.setAttribute("aria-label",t.textContent??"");let J;l==="chars"?J=sr(t):l==="lines"?J=Dt(t):J=Ft(t);let X=J.length;function G(g,L){u?.opacity!==void 0&&(g.style.opacity=String(u.opacity+(1-u.opacity)*L));let S=ar(L,u);S&&(g.style.transform=S);}function M(g){t.style.setProperty("--scroll-draw-progress",String(g)),J.forEach((L,S)=>{let F=$(ir(g,S,X,s));G(L,F);});}if(V)return M(1),T?.(),{destroy(){t.innerHTML=B,t.removeAttribute("aria-label");},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};M(0);let C=0,A=0,w=0,k=false,O=false,P=-1,E=0,oe=false,D=()=>window.scrollY,se=()=>window.innerHeight;function ie(){let g=t.getBoundingClientRect(),L=xe({top:g.top,height:g.height},D(),se(),ne,Ce);C=L.tStart,A=L.tEnd;}function ee(){if(!k||O)return;let g=K(D(),C,A,1);p&&(P=Math.max(P,g),g=P),E=g,M(g),g>=1&&!oe?(oe=true,T?.()):g<1&&!p&&(oe=false),w=requestAnimationFrame(ee);}ie();let ae=new IntersectionObserver(g=>{g.forEach(L=>{k=L.isIntersecting,k&&!O?w=requestAnimationFrame(ee):cancelAnimationFrame(w);});}),d;function x(){clearTimeout(d),d=setTimeout(()=>{if(l==="lines"){let g=E;t.innerHTML=B,t.setAttribute("aria-label",t.textContent??""),J=Dt(t),M(g);}ie();},150);}return window.addEventListener("resize",x),window.addEventListener("orientationchange",x),ae.observe(t),Le(t,{type:"text",getProgress:()=>E,getTrigger:()=>({tStart:C,tEnd:A})}),{destroy(){cancelAnimationFrame(w),ae.disconnect(),window.removeEventListener("resize",x),window.removeEventListener("orientationchange",x),clearTimeout(d),t.innerHTML=B,t.removeAttribute("aria-label"),$e(t);},replay(){P=-1,oe=false,E=0,O=false,M(0);},pause(){O=true,cancelAnimationFrame(w);},resume(){O&&(O=false,k&&(w=requestAnimationFrame(ee)));},seek(g){let L=Math.min(1,Math.max(0,g));E=L,P=L,O=true,cancelAnimationFrame(w),M(L);},getProgress(){return E}}}function Wr(e={}){let n,r;return onMount(()=>{n&&(r=at(n,e));}),onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Br(e={}){let n,r;return onMount(()=>{n&&(r=at(n,e));}),onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Gr(e){let n,r;return onMount(()=>{n&&(r=lt(n,e));}),onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function jr(e){let n,r;return onMount(()=>{n&&(r=lt(n,e));}),onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Yr(e){let n,r;return onMount(()=>{n&&(r=ut(n,e));}),onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Ur(e){let n,r;return onMount(()=>{n&&(r=ut(n,e));}),onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Xr(e={}){let n,r;return onMount(()=>{n&&(r=mt(n,e));}),onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Qr(e={}){let n,r;return onMount(()=>{n&&(r=mt(n,e));}),onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}function Zr(e={}){let n,r;return onMount(()=>{n&&(r=ft(n,e));}),onCleanup(()=>{r?.destroy();}),t=>{n=t;}}function Kr(e={}){let n,r;return onMount(()=>{n&&(r=ft(n,e));}),onCleanup(()=>{r?.destroy(),r=void 0;}),{ref:t=>{n=t;},getInstance:()=>r}}export{jr as createScrollAnimate,Ur as createScrollCounter,Br as createScrollDraw,Kr as createScrollText,Qr as createScrollVideo,Gr as useScrollAnimate,Yr as useScrollCounter,Wr as useScrollDraw,Zr as useScrollText,Xr as useScrollVideo};
|