svg-scroll-draw 2.23.3 → 2.23.4
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 +10 -10
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +64 -59
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/chunk-6TWFLRUB.mjs +3 -0
- package/dist/{chunk-BLY6F6EC.mjs → chunk-DSFD227B.mjs} +1 -1
- package/dist/chunk-I73SOXBN.mjs +1 -0
- package/dist/chunk-NLPSVYFP.mjs +1 -0
- package/dist/chunk-OPXWNJBG.mjs +1 -0
- package/dist/chunk-QFSTKVA3.mjs +1 -0
- package/dist/chunk-XC5NR2MU.mjs +1 -0
- package/dist/{chunk-ETACBG7W.mjs → chunk-XTPAW6XR.mjs} +1 -1
- package/dist/{chunk-4I7MLTP5.mjs → chunk-ZNCZYV3Q.mjs} +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +10 -7
- package/dist/horizontal/index.d.ts +10 -7
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/react/index.cjs +2 -2
- package/dist/react/index.d.mts +3 -1
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +9 -3
- package/dist/reveal/index.d.ts +9 -3
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-23EALNDF.mjs +0 -3
- package/dist/chunk-4H2SGMAQ.mjs +0 -1
- package/dist/chunk-GMBIGV3M.mjs +0 -1
- package/dist/chunk-LGJQWZHH.mjs +0 -1
- package/dist/chunk-V4L3ELVC.mjs +0 -1
- package/dist/chunk-YZV4Z3EQ.mjs +0 -1
package/dist/group/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${f?`left:${a}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${a}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",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var Gt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,qt=/[MmLlHhVvCcSsQqTtAaZz]/g;function gr(e,n,r){if(!qe)return;let t=(e.match(qt)??[]).join("").toUpperCase(),o=(n.match(qt)??[]).join("").toUpperCase(),c=(e.match(Gt)??[]).length,u=(n.match(Gt)??[]).length;if(t!==o){ue(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==u&&ue(`morphTo: coordinate count differs (${c} \u2192 ${u}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function yr(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let u=parseFloat(c),a=t[o++]??u;return String(+(u+(a-u)*r).toFixed(4))})}function bt(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ct(n,(r,t)=>hr(e,r,t))}function hr(e,n,r){let{preset:t,...o}=n,c=t?{...Rt[t],...o}:o,{selector:u="path, polyline, line, polygon, rect, circle",speed:a=1,fade:f=false,easing:d="linear",trigger:x={},stagger:$=0,direction:h="forward",once:fe=false,debug:ke=false,axis:Z="y",scrollContainer:De,autoReverse:Ie=false,delay:be=0,strokeColor:B,strokeWidth:te,fillOpacity:re,waypoints:Q,velocityScale:F=false,threshold:j=0,rootMargin:Ye="0px",repeat:me=0,repeatDelay:Me=0,morphTo:U,clip:we,autoplay:Ve=false,duration:Ze=1e3,native:ut=true,onProgress:Pe,onStart:H,onComplete:V,onEnter:ne,onLeave:Ae,onEnterBack:oe,onLeaveBack:Ce}=c,D=we===true?"left":typeof we=="string"?we:false,I=typeof d=="function"?d:Te[d]??Te.linear,Le=Ne(x.start||"top bottom"),se=Ne(x.end||"bottom top"),_=typeof De=="string"?document.querySelector(De):De??null,pe=Array.isArray(B)?B[0]:null,X=Array.isArray(B)?B[1]:typeof B=="string"?B:null,ie=Array.isArray(te)?te[0]:null,ae=Array.isArray(te)?te[1]:typeof te=="number"?te:null,Y=Array.isArray(re)?re[0]:null,ve=Array.isArray(re)?re[1]:typeof re=="number"?re:null;function le(s){let i=s*100;switch(D){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let T=D?[]:Array.from(e.querySelectorAll(u)),v=[],z=[],W=0,l=0,m=$,de=0,b=false,E=false,y=0,S=false,K=-1,J=[],Ke=-1,C=false,ce=0,ge=0,Ee,ft=null;function vt(){ft?.destroy(),ft=null;}let Se=new Set,Et=NaN,xe=true,Je=-1,St=performance.now(),Oe=NaN;function ze(){return _?Z==="x"?_.scrollLeft:_.scrollTop:Z==="x"?window.scrollX:window.scrollY}function xt(){return _?Z==="x"?_.clientWidth:_.clientHeight:Z==="x"?window.innerWidth:window.innerHeight}function Tt(){let s=nt(e,_,Z);return Fe(s,s.scroll,xt(),Le,se)}function Zt(){let s=l-W,i=T.length-1,p=_??document.documentElement,P=Z==="x"?"Width":"Height";if(m=$,$>0&&i>0&&s>0){let G=p[`scroll${P}`]-p[`client${P}`]-1-W-s/a;G>=0&&(m=Math.min($,G/(i*s)));}de=l+i*m*s;}function Mt(){(({tStart:W,tEnd:l}=Tt())),Zt(),ke&&qe&&(vt(),ft=dr(W,l,Z));}function mt(s,i=Tt){Be(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:i});let p=s.destroy;return s.destroy=()=>{p.call(s),Qe(e);},s}function Pt(s,i){return fe&&!Ie?Math.max(K,I(J[s]=Math.max(J[s]??0,i))):I(i)}function Kt(s,i){if(e.style.setProperty("--scroll-draw-progress",String(s)),D){let p=i==="reverse"?1-s:s;e.style.clipPath=le(p);return}T.forEach((p,P)=>pt(p,P,s,i));}function pt(s,i,p,P){s.style.strokeDashoffset=P==="reverse"?`${v[i]*p}`:`${v[i]*(1-p)}`,f&&(s.style.opacity=P==="reverse"?`${1-p}`:`${p}`),pe&&X?s.style.stroke=ot(pe,X,p):X&&(s.style.stroke=X),ie!==null&&ae!==null?s.style.strokeWidth=`${ie+(ae-ie)*p}`:ae!==null&&(s.style.strokeWidth=`${ae}`),Y!==null&&ve!==null?s.style.fillOpacity=`${Y+(ve-Y)*p}`:ve!==null&&(s.style.fillOpacity=`${ve}`),U&&s.tagName.toLowerCase()==="path"&&z[i]&&s.setAttribute("d",yr(z[i],U,p));}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),D){e.style.clipPath=le(h==="reverse"?1:0);return}T.forEach((s,i)=>{s.style.strokeDasharray=`${v[i]}`,s.style.strokeDashoffset=h==="reverse"?"0":`${v[i]}`,f?s.style.opacity=h==="reverse"?"1":"0":s.style.opacity="",pe&&(s.style.stroke=pe),ie!==null&&(s.style.strokeWidth=`${ie}`),Y!==null&&(s.style.fillOpacity=`${Y}`),U&&s.tagName.toLowerCase()==="path"&&z[i]&&s.setAttribute("d",z[i]);});}if(T.forEach(s=>{pr(s);let i=_e(s);v.push(i);let p=s.tagName.toLowerCase()==="path";p?z.push(s.getAttribute("d")??""):z.push(""),U&&(p?gr(z[z.length-1],U,s):ue(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),r?(s.style.strokeDasharray=`${i}`,s.style.strokeDashoffset=h==="reverse"?`${i}`:"0",f&&(s.style.opacity="1"),X&&(s.style.stroke=X),ae!==null&&(s.style.strokeWidth=`${ae}`),ve!==null&&(s.style.fillOpacity=`${ve}`),U&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",U)):(s.style.strokeDasharray=`${i}`,s.style.strokeDashoffset=h==="reverse"?"0":`${i}`,f?s.style.opacity=h==="reverse"?"1":"0":s.style.opacity="",pe&&(s.style.stroke=pe),ie!==null&&(s.style.strokeWidth=`${ie}`),Y!==null&&(s.style.fillOpacity=`${Y}`));}),r)return D&&(e.style.clipPath=le(1)),V?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};D&&(e.style.clipPath=le(h==="reverse"?1:0));let At=typeof d=="string"?st(d):null;function Jt(){return !(ut===false||Ve||ke||!mr()||!T.length||!At||D||Z!=="y"||_||a!==1||$!==0||fe||Ie||F!==false||U||Q||me||be>0||Pe||H||V||ne||Ae||oe||Ce||B!=null||te!=null||re!=null||(x.start||"top bottom").trim()!=="top bottom"||(x.end||"bottom top").trim()!=="bottom top")}function er(){let s=++fr,i=`svg-scroll-draw-${s}`,p=`svg-scroll-draw-host-${s}`,P=`--svg-scroll-draw-${s}`,G=h==="reverse"?"0":"var(--ssd-len)",ye=h==="reverse"?"var(--ssd-len)":"0",q=`stroke-dashoffset:${G};`,M=`stroke-dashoffset:${ye};`;f&&(q+=`opacity:${h==="reverse"?1:0};`,M+=`opacity:${h==="reverse"?0:1};`);let A=document.createElement("style");A.setAttribute("data-svg-scroll-draw",""),A.textContent=`@keyframes ${i}{from{${q}}to{${M}}}.${p}{view-timeline-name:${P};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${P};animation-range:cover 0% cover 100%;}`,document.head.appendChild(A),e.classList.add(p);function O(g,w){g.style.setProperty("--ssd-len",String(v[w])),g.style.strokeDasharray=`${v[w]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(i);}T.forEach(O);let R=false,L=-1;function k(){if(L>=0)return L;let g=e.getBoundingClientRect(),{tStart:w,tEnd:N}=Fe({top:g.top,height:g.height},ze(),xt(),Le,se);return I(ee(ze(),w,N,a))}return {destroy(){e.classList.remove(p),T.forEach(g=>{g.classList.remove(i),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),A.remove();},replay(){R=false,L=-1,T.forEach(O);},pause(){R=true,T.forEach(g=>{g.style.animationPlayState="paused";});},resume(){R&&(R=false,T.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let w=Math.min(1,Math.max(0,g));L=w,R=true,T.forEach((N,he)=>{N.classList.remove(i),N.style.strokeDashoffset=h==="reverse"?`${v[he]*w}`:`${v[he]*(1-w)}`,f&&(N.style.opacity=h==="reverse"?`${1-w}`:`${w}`);});},getProgress(){return k()},refresh(){T.forEach((g,w)=>{v[w]=_e(g),g.style.setProperty("--ssd-len",String(v[w])),g.style.strokeDasharray=`${v[w]}`;});}}}if(Jt())return mt(er());function tr(){let s=Math.max(1,Ze),i=D?s:s*(1+Math.max(0,T.length-1)*$),p=0,P=0,G=false;function ye(L){let k=true,g=Math.min(1,Math.max(0,L/i));if(D){let w=Math.min(1,Math.max(0,L/s)),N=I(w);ce=N,e.style.setProperty("--scroll-draw-progress",String(N)),e.style.clipPath=le(h==="reverse"?1-N:N),Pe?.(N),w<1&&(k=false);}else {T.forEach((N,he)=>{let nr=he*$*s,kt=Math.min(1,Math.max(0,(L-nr)/s));pt(N,he,I(kt),h),kt<1&&(k=false);});let w=I(g);ce=w,Pe?.(w),e.style.setProperty("--scroll-draw-progress",String(w));}if(Q){let w=I(g);for(let N in Q){let he=parseFloat(N);w>=he&&!Se.has(he)&&(Se.add(he),Q[N]?.());}}return k}function q(L){if(C)return;let k=L-p;E||(E=true,H?.());let g=ye(k);if(g&&!b){b=true,ye(i),V?.(),ge<(me==="infinite"?1/0:me??0)&&(ge++,Ee=setTimeout(()=>{p=performance.now(),E=false,b=false,Se.clear(),We(),y=requestAnimationFrame(q);},Me));return}g||(y=requestAnimationFrame(q));}function M(){cancelAnimationFrame(y),clearTimeout(Ee),p=performance.now(),P=0,C=false,E=false,b=false,ge=0,G=true,ce=0,Se.clear(),We(),y=requestAnimationFrame(q);}let A=new IntersectionObserver(L=>{L.forEach(k=>{k.isIntersecting&&!(fe&&b)?M():!k.isIntersecting&&!fe&&!b&&(cancelAnimationFrame(y),clearTimeout(Ee),G=false);});},{root:_??null,threshold:j,rootMargin:Ye}),O;function R(){clearTimeout(O),O=setTimeout(()=>{T.forEach((L,k)=>{v[k]=_e(L),L.style.strokeDasharray=`${v[k]}`;});},150);}return window.addEventListener("resize",R),window.addEventListener("orientationchange",R),be>0?setTimeout(()=>A.observe(e),be):A.observe(e),{destroy(){cancelAnimationFrame(y),clearTimeout(Ee),A.disconnect(),window.removeEventListener("resize",R),window.removeEventListener("orientationchange",R),clearTimeout(O);},replay(){ge=0,M();},pause(){C||!G||(C=true,P=performance.now()-p,cancelAnimationFrame(y));},resume(){C&&(C=false,G=true,p=performance.now()-P,y=requestAnimationFrame(q));},seek(L){let k=Math.min(1,Math.max(0,L));ce=k,C=true,P=k*i,p=performance.now()-P,cancelAnimationFrame(y),ye(P);},getProgress(){return ce},refresh(){clearTimeout(O),T.forEach((L,k)=>{v[k]=_e(L),L.style.strokeDasharray=`${v[k]}`;});}}}if(Ve)return mt(tr());Mt();function Lt(){if(C||!Re)return;let s=performance.now(),i=ze();if(!xe&&F===false&&i===Et){gt(i);return}xe=false,Et=i;let p=a;if(F!==false){let M=s-St,A=M>0?Math.abs(i-(Je<0?i:Je))/M:0;p=a*Math.max(.2,1+A*(typeof F=="number"?F:1)*.04);}Je=i,St=s;let P=Ie?Ke===-1||i>=Ke?"forward":"reverse":h;Ke=i;let G=l-W,ye=true,q=G===0?0:(i-W)/G;if(isNaN(Oe)||(Oe<=0&&q>0?ne?.():Oe>0&&q<=0&&Ce?.(),Oe<1&&q>=1?Ae?.():Oe>=1&&q<1&&oe?.()),Oe=q,D){let M=Pt(0,ee(i,W,l,p));ce=M,e.style.setProperty("--scroll-draw-progress",String(M));let A=P==="reverse"?1-M:M;e.style.clipPath=le(A),Pe?.(M),!E&&ee(i,W,l,p)>0&&(E=true,H?.()),M>=1&&!b?(b=true,V?.(),ge<(me==="infinite"?1/0:me??0)&&(ge++,Ee=setTimeout(()=>{K=-1,J=[],E=false,b=false,We();},Me))):M<1&&!fe&&(b=false),gt(i);return}if(T.forEach((M,A)=>{let O=A*m*G,R=Pt(A,ee(i,W+O,l+O,p));pt(M,A,R,P),A===0&&(ce=R,Pe?.(R),e.style.setProperty("--scroll-draw-progress",String(R))),R<1&&(ye=false);}),Q){let M=I(ee(i,W,l,p));for(let A in Q){let O=parseFloat(A);M>=O&&!Se.has(O)&&(Se.add(O),Q[A]?.());}}!E&&ee(i,W,l,p)>0&&(E=true,H?.()),ye&&!b?(b=true,V?.(),ge<(me==="infinite"?1/0:me??0)&&(ge++,Ee=setTimeout(()=>{K=-1,J=[],E=false,b=false,Se.clear(),We(),xe=true;},Me))):!ye&&!fe&&(b=false),gt(i);}function dt(s){return s>=l&&s<de}function gt(s){S||dt(s)?y=requestAnimationFrame(Lt):Re=false;}function yt(){return S||dt(ze())}let Re=false;function et(){Re||(Re=true,y=requestAnimationFrame(function(){Lt();}));}function tt(){Re=false,cancelAnimationFrame(y);}let ht=new IntersectionObserver(s=>{s.forEach(i=>{S=i.isIntersecting,S&&!C?(xe=true,et()):Re&&!C&&dt(ze())||tt();});},{root:_??null,threshold:j,rootMargin:Ye});function $t(){T.forEach((s,i)=>{v[i]=_e(s),s.style.strokeDasharray=`${v[i]}`;}),Mt(),xe=true;}let rt;function Ge(){clearTimeout(rt),rt=setTimeout($t,150);}window.addEventListener("resize",Ge),window.addEventListener("orientationchange",Ge);let rr=lt([e],Ge);return be>0?setTimeout(()=>ht.observe(e),be):ht.observe(e),mt({destroy(){cancelAnimationFrame(y),clearTimeout(Ee),tt(),ht.disconnect(),rr(),window.removeEventListener("resize",Ge),window.removeEventListener("orientationchange",Ge),clearTimeout(rt),vt();},replay(){K=-1,J=[],Ke=-1,Je=-1,E=false,b=false,ge=0,C=false,ce=0,Se.clear(),clearTimeout(Ee),We(),xe=true,yt()&&et();},pause(){C=true,tt();},resume(){C&&(C=false,xe=true,yt()&&et());},seek(s){let i=Math.min(1,Math.max(0,s));ce=i,K=i,J=[],C=true,tt(),Kt(i,h),xe=true;},getProgress(){return ce},refresh(){clearTimeout(rt),$t(),yt()&&!C&&et();}},()=>({tStart:W,tEnd:l}))}function br(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Bt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],u=t[2].trim();if(u)for(let a of u.split(/[\s,]+/)){let f=a.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(f?parseFloat(f[1]):0),c.push(f?f[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function wr(e,n,r){let t=Bt(e),o=Bt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,u)=>{let a=o[u];return c.fn!==a.fn||c.nums.length!==a.nums.length?r<1?`${c.fn}(${c.nums.map((f,d)=>`${f}${c.units[d]}`).join(", ")})`:`${a.fn}(${a.nums.map((f,d)=>`${f}${a.units[d]}`).join(", ")})`:`${c.fn}(${c.nums.map((f,d)=>`${f+(a.nums[d]-f)*r}${c.units[d]}`).join(", ")})`}).join(" ")}function wt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(br(t))return ot(t,o,r);if(t.includes("("))return wr(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),u=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&u){let a=parseFloat(c[1]),f=parseFloat(u[1]);return `${a+(f-a)*r}${c[2]||u[2]}`}return r<1?t:o}function vr(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Er=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Sr=0,Qt="--scroll-draw-progress";function xr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function He(e,n){return typeof window>"u"?Ut:n.respectReducedMotion===false?jt(e,n,false):ct(n,(r,t)=>jt(e,r,t))}function jt(e,n,r){let{props:t,trigger:o={},easing:c="ease-out",speed:u=1,once:a=false,axis:f="y",scrollContainer:d,native:x=true,velocityScale:$=false,triggerElement:h,onProgress:fe,onComplete:ke,onEnter:Z,onLeave:De,onEnterBack:Ie,onLeaveBack:be}=n,B=typeof c=="function"?c:Te[c]??Te["ease-out"],te=Ne(o.start||"top bottom"),re=Ne(o.end||"bottom top"),Q=h??e,F=typeof d=="string"?document.querySelector(d):d??null,j=Object.entries(t).map(([l,m])=>({prop:vr(l),from:Array.isArray(m)?m[0]:"",to:Array.isArray(m)?m[1]:m}));function Ye(){let l=window.getComputedStyle(e);for(let m of j)m.from===""&&(m.from=l.getPropertyValue(m.prop).trim()||"0");}function me(){for(let l of j)e.style.setProperty(l.prop,String(l.to));}let Me=new Map;for(let l of [...j.map(m=>m.prop),Qt])Me.set(l,e.style.getPropertyValue(l));function U(){for(let[l,m]of Me)m?e.style.setProperty(l,m):e.style.removeProperty(l);}if(r)return me(),ke?.(),{...Ut,destroy:U,getProgress:()=>1};Ye();let we=()=>F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY,Ve=()=>F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight,Ze=typeof c=="string"?st(c):null;function ut(){if(!x||!xr()||!Ze||f!=="y"||F||Q!==e||a||u!==1||fe||ke||Z||De||Ie||be||$!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let l of j)if(!Er.has(l.prop))return false;return true}function Pe(){let l=`ssd-a-${++Sr}`,m=j.map(S=>`${S.prop}:${S.from}`).join(";"),de=j.map(S=>`${S.prop}:${S.to}`).join(";"),b=document.createElement("style");b.setAttribute("data-ssd-animate",""),b.textContent=`@keyframes ${l}{from{${m}}to{${de}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ze};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(b),e.classList.add(l);let E=()=>{let S=e.getBoundingClientRect();return Fe({top:S.top,height:S.height},we(),Ve(),te,re)};Be(e,{type:"animate",getProgress:()=>y.getProgress(),getTrigger:E});let y={refresh(){},destroy(){e.classList.remove(l),b.remove(),e.style.animationPlayState="",U(),Qe(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(S){let K=Math.min(1,Math.max(0,S));e.classList.remove(l);for(let J of j)e.style.setProperty(J.prop,wt(J.from,J.to,K));},getProgress(){let{tStart:S,tEnd:K}=E();return B(ee(we(),S,K,u))}};return y}if(ut())return Pe();let H=0,V=0,ne=0,Ae=false,oe=false,Ce=-1,D=0,I=0,Le=false,se=NaN,_=-1,pe=0,X=Q===e?j:[],ie=false;function ae(){let l=e.style,m=X.map(y=>l.getPropertyValue(y.prop)),de=l.transition;X.length&&(l.transition="none"),X.forEach(y=>l.setProperty(y.prop,Me.get(y.prop)??""));let b=nt(Q,F,f);X.forEach((y,S)=>l.setProperty(y.prop,m[S])),X.length&&(e.offsetWidth,l.transition=de);let E=Fe(b,b.scroll,Ve(),te,re);ie&&Math.abs(E.tStart-H)<1&&Math.abs(E.tEnd-V)<1||(ie=true,H=E.tStart,V=E.tEnd);}function Y(l){e.style.setProperty(Qt,String(l));for(let m of j)e.style.setProperty(m.prop,wt(m.from,m.to,l));fe?.(l);}function ve(l){if(isNaN(se)){se=l;return}se<=0&&l>0?Z?.():se>0&&l<=0&&be?.(),se<1&&l>=1?De?.():se>=1&&l<1&&Ie?.(),se=l;}function le(){if(!Ae||oe)return;let l=performance.now(),m=we(),de=u;if($!==false){let S=l-pe,K=S>0?Math.abs(m-(_<0?m:_))/S:0;de=u*Math.max(.2,1+K*(typeof $=="number"?$:1)*.04);}_=m,pe=l;let b=V===H?0:(m-H)/(V-H);ve(b);let E=ee(m,H,V,de),y=a?Math.max(Ce,B(D=Math.max(D,E))):B(E);I=y,Y(y),y>=1&&!Le?(Le=true,ke?.()):y<1&&!a&&(Le=false),ne=requestAnimationFrame(le);}ae(),V===H&&ue("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),D=ee(we(),H,V,u),I=B(D),Y(I);let T=new IntersectionObserver(l=>{l.forEach(m=>{Ae=m.isIntersecting,Ae&&!oe?ne=requestAnimationFrame(le):cancelAnimationFrame(ne);});},{root:F??null}),v;function z(){clearTimeout(v),v=setTimeout(ae,150);}window.addEventListener("resize",z),window.addEventListener("orientationchange",z);let W=lt([Q],z);return T.observe(e),Be(e,{type:"animate",getProgress:()=>I,getTrigger:()=>({tStart:H,tEnd:V})}),{destroy(){cancelAnimationFrame(ne),T.disconnect(),window.removeEventListener("resize",z),window.removeEventListener("orientationchange",z),W(),clearTimeout(v),U(),Qe(e);},replay(){Ce=-1,D=0,Le=false,I=0,oe=false,Y(0);},pause(){oe=true,cancelAnimationFrame(ne);},resume(){oe&&(oe=false,Ae&&(ne=requestAnimationFrame(le)));},seek(l){let m=Math.min(1,Math.max(0,l));I=m,Ce=m,D=0,oe=true,cancelAnimationFrame(ne),Y(m);},getProgress(){return I},refresh(){ae();}}}var Xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Yt(e,n={}){if(typeof window>"u")return Xt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return ue("scrollParallax: element not found:",e),Xt;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:u,onProgress:a}=n,f=-t*100,d=r.style,x=!!r.ownerSVGElement,$=d.getPropertyValue("transform-box");x&&d.setProperty("transform-box","fill-box");let h=He(r,{props:o==="x"?{transform:["translateX(0%)",`translateX(${f}%)`]}:{transform:["translateY(0%)",`translateY(${f}%)`]},trigger:u??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:a});return x?{...h,destroy(){h.destroy(),d.setProperty("transform-box",$);}}:h}function Xe(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var $e={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gn(e,n={}){if(typeof window>"u")return $e;let r=Xe(e).map(t=>bt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function yn(e,n={}){if(typeof window>"u")return $e;let r=Xe(e);if(r.length===0)return $e;let t=0,o=[];function c(a){return bt(r[a],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(a+1,r.length-1),t>a&&o[t]?.resume();}})}function u(){r.forEach((a,f)=>{o[f]=c(f);});for(let a=1;a<o.length;a++)o[a].pause();}return u(),{destroy(){o.forEach(a=>a.destroy()),o.length=0;},replay(){o.forEach(a=>a.destroy()),o.length=0,t=0,u();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(a){o[t]?.seek(a);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(a=>a.refresh?.());}}}function hn(e,n){if(typeof window>"u")return $e;let r=Xe(e).map(t=>He(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function bn(e,n){if(typeof window>"u")return $e;let r=Xe(e);if(r.length===0)return $e;let t=0,o=[];function c(a){return He(r[a],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(a+1,r.length-1),t>a&&o[t]?.resume();}})}function u(){r.forEach((a,f)=>{o[f]=c(f);});for(let a=1;a<o.length;a++)o[a].pause();}return u(),{destroy(){o.forEach(a=>a.destroy()),o.length=0;},replay(){o.forEach(a=>a.destroy()),o.length=0,t=0,u();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(a){o[t]?.seek(a);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(a=>a.refresh?.());}}}function wn(e,n={}){if(typeof window>"u")return $e;let r=Xe(e).map(t=>Yt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}exports.scrollAnimateGroup=hn;exports.scrollAnimateSequence=bn;exports.scrollDrawGroup=gn;exports.scrollDrawSequence=yn;exports.scrollParallaxGroup=wn;
|
|
1
|
+
'use strict';function sr({bounces:e=3,decay:n=.5}={}){let r=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(t),c=0,u=[];for(let g=0;g<r;g++){let E=Math.pow(o,g);u.push(E),c+=E;}let i=[0],m=0;for(let g=0;g<r;g++)m+=u[g]/c,i.push(m);return g=>{if(g<=0)return 0;if(g>=1)return 1;for(let E=0;E<r;E++)if(g<=i[E+1]){let T=(g-i[E])/(i[E+1]-i[E]);if(E===0)return T*(2-T);let b=1-Math.pow(t,E);return b+(1-b)*(2*T-1)*(2*T-1)}return 1}}function ir({amplitude:e=1,period:n=.4}={}){let r=Math.max(1,e),t=Math.max(.1,n),o=r<=1?t/4:t/(2*Math.PI)*Math.asin(1/r);return c=>c<=0?0:c>=1?1:r*Math.pow(2,-10*c)*Math.sin((c-o)*(2*Math.PI)/t)+1}var Te={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:sr(),elastic:ir()};function It(e,n,r){return Math.min(r,Math.max(n,e))}function Ne(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[r="top",t="bottom"]=n.split(/\s+/).filter(Boolean);return {element:r,viewport:t}}function Ct(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 Ot(e,n){if(/^\d+(\.\d+)?%$/.test(e))return n*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return n/2;case "bottom":return n;default:return n}}function ee(e,n,r,t){return r===n?0:It((e-n)/(r-n)*t,0,1)}function Fe(e,n,r,t,o){let c=Ct(e.top,e.height,n,t.element)-Ot(t.viewport,r),u=Ct(e.top,e.height,n,o.element)-Ot(o.viewport,r);return {tStart:c,tEnd:u}}function nt(e,n,r){let t=e.getBoundingClientRect(),o=r==="x"?t.width:t.height;return n?{top:r==="x"?t.left-n.getBoundingClientRect().left-n.clientLeft+n.scrollLeft:t.top-n.getBoundingClientRect().top-n.clientTop+n.scrollTop,height:o,scroll:0}:{top:r==="x"?t.left:t.top,height:o,scroll:r==="x"?window.scrollX:window.scrollY}}function ot(e){let n=parseFloat(e.getAttribute("pathLength")??"");if(n>0)return n;let r=e.tagName.toLowerCase();if(r==="rect"){let t=parseFloat(e.getAttribute("width")??"0"),o=parseFloat(e.getAttribute("height")??"0");return 2*(t+o)}if(r==="circle"){let t=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*t}return e.getTotalLength()}function Rt(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 st(e,n,r){let t=Rt(e),o=Rt(n);return !t||!o?e:`rgb(${Math.round(t[0]+(o[0]-t[0])*r)},${Math.round(t[1]+(o[1]-t[1])*r)},${Math.round(t[2]+(o[2]-t[2])*r)})`}var Nt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var _e=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function le(e,...n){_e&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var ar="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",lr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ft=33;function cr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function ur(e){let n=[];for(let r=0;r<Ft;r++){let t=r/(Ft-1);n.push(String(Math.round(e(t)*1e5)/1e5));}return `linear(${n.join(",")})`}function it(e){switch(e){case "linear":return "linear";case "ease-in":return ar;case "ease-out":return lr;case "ease-in-out":return cr()?ur(Te["ease-in-out"]):null;default:return null}}var _t=Symbol.for("svg-scroll-draw.registry");function Ht(){let e=globalThis;return e[_t]||(e[_t]=new Map)}function Be(e,n){Ht().set(e,n);}function Qe(e){Ht().delete(e);}var je,at=new Set,lt=new WeakMap,Ue=new Map,Vt=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function fr(e){let n=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let t=r;t;t=t.previousElementSibling)n.add(t);return n}function ct(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let r=()=>n();je??(je=new ResizeObserver(o=>{let c=false;for(let{target:u}of o)lt.get(u)!==Vt(u)&&(c=true),lt.set(u,"");c&&at.forEach(u=>u());})),at.add(r);let t=fr(e);return [document.body,document.documentElement].forEach(o=>o&&t.add(o)),t.forEach(o=>{lt.has(o)||lt.set(o,Vt(o)),Ue.set(o,(Ue.get(o)??0)+1),je.observe(o);}),()=>{at.delete(r)&&(t.forEach(o=>{let c=(Ue.get(o)??1)-1;if(c)return void Ue.set(o,c);Ue.delete(o),je?.unobserve(o);}),at.size||(je?.disconnect(),je=void 0));}}function zt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o=>e(!!o.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",r),()=>n.removeEventListener("change",r);let t=n;return t.addListener?.(r),()=>t.removeListener?.(r)}function ut(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let r=n(e,false),t=zt(c=>{if(!c)return;t();let u=(r.getProgress?.()??0)>=1;r.destroy(),r=n(u?{...e,onComplete:void 0}:e,true);}),o={};for(let c of Object.keys(r))o[c]=(...u)=>r[c]?.(...u);return o.destroy=()=>{t(),r.destroy();},o}var mr=0;function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Wt(e,n){let r="";try{r=getComputedStyle(e).getPropertyValue(n).trim();}catch{}return r||(e.getAttribute(n)??"").trim()}var Gt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function dr(e){if(!_e)return;let n=Wt(e,"stroke");if(!n||n==="none"){le("Element has no stroke \u2014 path will not be visible.",e);return}let r=(e.getAttribute("fill")??"").trim();r&&!Gt.has(r)&&!Gt.has(Wt(e,"fill"))&&le("Element has a fill \u2014 it may obscure the stroke animation.",e);}function gr(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 o(){let c=r==="x"?window.scrollX:window.scrollY,u=e-c,i=n-c,m=r==="x";t.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${u}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:${i}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${i}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",o,{passive:true}),o(),{el:t,destroy(){window.removeEventListener("scroll",o),t.remove();}}}var qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Bt=/[MmLlHhVvCcSsQqTtAaZz]/g;function yr(e,n,r){if(!_e)return;let t=(e.match(Bt)??[]).join("").toUpperCase(),o=(n.match(Bt)??[]).join("").toUpperCase(),c=(e.match(qt)??[]).length,u=(n.match(qt)??[]).length;if(t!==o){le(`morphTo: command sequence differs (${t||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,r);return}c!==u&&le(`morphTo: coordinate count differs (${c} \u2192 ${u}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r);}function hr(e,n,r){let t=(n.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,c=>{let u=parseFloat(c),i=t[o++]??u;return String(+(u+(i-u)*r).toFixed(4))})}function wt(e,n={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ut(n,(r,t)=>br(e,r,t))}function br(e,n,r){let{preset:t,...o}=n,c=t?{...Nt[t],...o}:o,{selector:u="path, polyline, line, polygon, rect, circle",speed:i=1,fade:m=false,easing:g="linear",trigger:E={},stagger:T=0,direction:b="forward",once:ce=false,debug:ke=false,axis:te="y",scrollContainer:De,autoReverse:Ie=false,delay:be=0,strokeColor:X,strokeWidth:ne,fillOpacity:oe,waypoints:Y,velocityScale:N=false,threshold:Z=0,rootMargin:Ye="0px",repeat:ue=0,repeatDelay:Me=0,morphTo:W,clip:fe,autoplay:Ve=false,duration:Ze=1e3,native:ft=true,onProgress:Pe,onStart:F,onComplete:_,onEnter:we,onLeave:me,onEnterBack:se,onLeaveBack:Ce}=c,L=fe===true?"left":typeof fe=="string"?fe:false,k=typeof g=="function"?g:Te[g]??Te.linear,Ae=Ne(E.start||"top bottom"),ie=Ne(E.end||"bottom top"),H=typeof De=="string"?document.querySelector(De):De??null,pe=Array.isArray(X)?X[0]:null,K=Array.isArray(X)?X[1]:typeof X=="string"?X:null,ae=Array.isArray(ne)?ne[0]:null,de=Array.isArray(ne)?ne[1]:typeof ne=="number"?ne:null,J=Array.isArray(oe)?oe[0]:null,ve=Array.isArray(oe)?oe[1]:typeof oe=="number"?oe:null;function ge(s){let a=s*100;switch(L){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(${s*150}% at 50% 50%)`;default:return `inset(0 ${100-a}% 0 0)`}}let w=L?[]:Array.from(e.querySelectorAll(u)),G=[],Q=[],D=0,A=0,Le=T,Ke=0,M=false,l=false,f=0,re=false,V=-1,$=[],P=-1,d=false,I=0,q=0,Ee,mt=null;function Et(){mt?.destroy(),mt=null;}let Se=new Set,St=NaN,xe=true,Je=-1,xt=performance.now(),Oe=NaN;function ze(){return H?te==="x"?H.scrollLeft:H.scrollTop:te==="x"?window.scrollX:window.scrollY}function Tt(){return H?te==="x"?H.clientWidth:H.clientHeight:te==="x"?window.innerWidth:window.innerHeight}function Mt(){let s=nt(e,H,te);return Fe(s,s.scroll,Tt(),Ae,ie)}function Kt(){let s=A-D,a=w.length-1,p=H??document.documentElement,h=te==="x"?"Width":"Height";if(Le=T,T>0&&a>0&&s>0){let z=p[`scroll${h}`]-p[`client${h}`]-1-D-s/i;z>=0&&(Le=Math.min(T,z/(a*s)));}Ke=A+a*Le*s;}function Pt(){(({tStart:D,tEnd:A}=Mt())),Kt(),ke&&_e&&(Et(),mt=gr(D,A,te));}function pt(s,a=Mt){Be(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:a});let p=s.destroy;return s.destroy=()=>{p.call(s),Qe(e);},s}function At(s,a){return ce&&!Ie?Math.max(V,k($[s]=Math.max($[s]??0,a))):k(a)}function Jt(s,a){if(e.style.setProperty("--scroll-draw-progress",String(s)),L){let p=a==="reverse"?1-s:s;e.style.clipPath=ge(p);return}w.forEach((p,h)=>dt(p,h,s,a));}function dt(s,a,p,h){s.style.strokeDashoffset=h==="reverse"?`${G[a]*p}`:`${G[a]*(1-p)}`,m&&(s.style.opacity=h==="reverse"?`${1-p}`:`${p}`),pe&&K?s.style.stroke=st(pe,K,p):K&&(s.style.stroke=K),ae!==null&&de!==null?s.style.strokeWidth=`${ae+(de-ae)*p}`:de!==null&&(s.style.strokeWidth=`${de}`),J!==null&&ve!==null?s.style.fillOpacity=`${J+(ve-J)*p}`:ve!==null&&(s.style.fillOpacity=`${ve}`),W&&s.tagName.toLowerCase()==="path"&&Q[a]&&s.setAttribute("d",hr(Q[a],W,p));}function We(){if(e.style.setProperty("--scroll-draw-progress","0"),L){e.style.clipPath=ge(b==="reverse"?1:0);return}w.forEach((s,a)=>{s.style.strokeDasharray=`${G[a]}`,s.style.strokeDashoffset=b==="reverse"?"0":`${G[a]}`,m?s.style.opacity=b==="reverse"?"1":"0":s.style.opacity="",pe&&(s.style.stroke=pe),ae!==null&&(s.style.strokeWidth=`${ae}`),J!==null&&(s.style.fillOpacity=`${J}`),W&&s.tagName.toLowerCase()==="path"&&Q[a]&&s.setAttribute("d",Q[a]);});}function Ge(s,a){let p=s.getAttribute("d"),h=ot(s);if(W&&Q[a]){s.setAttribute("d",W);let z=ot(s);s.setAttribute("d",Q[a]),h=Math.max(ot(s),z),s.setAttribute("d",p);}G[a]=h,s.style.strokeDasharray=`${h}`;}if(w.forEach((s,a)=>{dr(s);let p=s.tagName.toLowerCase()==="path";p?Q.push(s.getAttribute("d")??""):Q.push(""),Ge(s,a);let h=G[a];W&&(p?yr(Q[Q.length-1],W,s):le(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),r?(s.style.strokeDashoffset=b==="reverse"?`${h}`:"0",m&&(s.style.opacity="1"),K&&(s.style.stroke=K),de!==null&&(s.style.strokeWidth=`${de}`),ve!==null&&(s.style.fillOpacity=`${ve}`),W&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",W)):(s.style.strokeDashoffset=b==="reverse"?"0":`${h}`,m?s.style.opacity=b==="reverse"?"1":"0":s.style.opacity="",pe&&(s.style.stroke=pe),ae!==null&&(s.style.strokeWidth=`${ae}`),J!==null&&(s.style.fillOpacity=`${J}`));}),r)return L&&(e.style.clipPath=ge(1)),_?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};L&&(e.style.clipPath=ge(b==="reverse"?1:0));let Lt=typeof g=="string"?it(g):null;function er(){return !(ft===false||Ve||ke&&_e||!pr()||!w.length||!Lt||L||te!=="y"||H||i!==1||T!==0||ce||Ie||N!==false||W||Y||ue||be>0||Pe||F||_||we||me||se||Ce||X!=null||ne!=null||oe!=null||(E.start||"top bottom").trim()!=="top bottom"||(E.end||"bottom top").trim()!=="bottom top")}function tr(){let s=++mr,a=`svg-scroll-draw-${s}`,p=`svg-scroll-draw-host-${s}`,h=`--svg-scroll-draw-${s}`,z=b==="reverse"?"0":"var(--ssd-len)",ye=b==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${z};`,S=`stroke-dashoffset:${ye};`;m&&(j+=`opacity:${b==="reverse"?1:0};`,S+=`opacity:${b==="reverse"?0:1};`);let x=document.createElement("style");x.setAttribute("data-svg-scroll-draw",""),x.textContent=`@keyframes ${a}{from{${j}}to{${S}}}.${p}{view-timeline-name:${h};view-timeline-axis:block;}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${Lt};animation-fill-mode:both;animation-timeline:${h};animation-range:cover 0% cover 100%;}`,document.head.appendChild(x),e.classList.add(p);function C(y,v){y.style.setProperty("--ssd-len",String(G[v])),y.style.strokeDasharray=`${G[v]}`,y.style.strokeDashoffset="",y.style.opacity="",y.style.animationPlayState="",y.classList.add(a);}w.forEach(C);let O=false,B=-1;function U(){if(B>=0)return B;let y=e.getBoundingClientRect(),{tStart:v,tEnd:R}=Fe({top:y.top,height:y.height},ze(),Tt(),Ae,ie);return k(ee(ze(),v,R,i))}return {destroy(){e.classList.remove(p),w.forEach(y=>{y.classList.remove(a),y.style.removeProperty("--ssd-len"),y.style.animationPlayState="";}),x.remove();},replay(){O=false,B=-1,w.forEach(C);},pause(){O=true,w.forEach(y=>{y.style.animationPlayState="paused";});},resume(){O&&(O=false,w.forEach(y=>{y.style.animationPlayState="running";}));},seek(y){let v=Math.min(1,Math.max(0,y));B=v,O=true,w.forEach((R,he)=>{R.classList.remove(a),R.style.strokeDashoffset=b==="reverse"?`${G[he]*v}`:`${G[he]*(1-v)}`,m&&(R.style.opacity=b==="reverse"?`${1-v}`:`${v}`);});},getProgress(){return U()},refresh(){w.forEach((y,v)=>{Ge(y,v),y.style.setProperty("--ssd-len",String(G[v]));});}}}if(er())return pt(tr());function rr(){let s=Math.max(1,Ze),a=L?s:s*(1+Math.max(0,w.length-1)*T),p=0,h=0,z=false;function ye(B){let U=true,y=Math.min(1,Math.max(0,B/a));if(L){let v=Math.min(1,Math.max(0,B/s)),R=k(v);I=R,e.style.setProperty("--scroll-draw-progress",String(R)),e.style.clipPath=ge(b==="reverse"?1-R:R),Pe?.(R),v<1&&(U=false);}else {w.forEach((R,he)=>{let or=he*T*s,Dt=Math.min(1,Math.max(0,(B-or)/s));dt(R,he,k(Dt),b),Dt<1&&(U=false);});let v=k(y);I=v,Pe?.(v),e.style.setProperty("--scroll-draw-progress",String(v));}if(Y){let v=k(y);for(let R in Y){let he=parseFloat(R);v>=he&&!Se.has(he)&&(Se.add(he),Y[R]?.());}}return U}function j(B){if(d)return;let U=B-p;l||(l=true,F?.());let y=ye(U);if(y&&!M){M=true,ye(a),_?.(),q<(ue==="infinite"?1/0:ue??0)&&(q++,Ee=setTimeout(()=>{p=performance.now(),l=false,M=false,Se.clear(),We(),f=requestAnimationFrame(j);},Me));return}y||(f=requestAnimationFrame(j));}function S(){cancelAnimationFrame(f),clearTimeout(Ee),p=performance.now(),h=0,d=false,l=false,M=false,q=0,z=true,I=0,Se.clear(),We(),f=requestAnimationFrame(j);}let x=new IntersectionObserver(B=>{B.forEach(U=>{U.isIntersecting&&!(ce&&M)?S():!U.isIntersecting&&!ce&&!M&&(cancelAnimationFrame(f),clearTimeout(Ee),z=false);});},{root:H??null,threshold:Z,rootMargin:Ye}),C;function O(){clearTimeout(C),C=setTimeout(()=>w.forEach(Ge),150);}return window.addEventListener("resize",O),window.addEventListener("orientationchange",O),be>0?setTimeout(()=>x.observe(e),be):x.observe(e),{destroy(){cancelAnimationFrame(f),clearTimeout(Ee),x.disconnect(),window.removeEventListener("resize",O),window.removeEventListener("orientationchange",O),clearTimeout(C);},replay(){q=0,S();},pause(){d||!z||(d=true,h=performance.now()-p,cancelAnimationFrame(f));},resume(){d&&(d=false,z=true,p=performance.now()-h,f=requestAnimationFrame(j));},seek(B){let U=Math.min(1,Math.max(0,B));I=U,d=true,h=U*a,p=performance.now()-h,cancelAnimationFrame(f),ye(h);},getProgress(){return I},refresh(){clearTimeout(C),w.forEach(Ge);}}}if(Ve)return pt(rr());Pt();function $t(){if(d||!Re)return;let s=performance.now(),a=ze();if(!xe&&N===false&&a===St){yt(a);return}xe=false,St=a;let p=i;if(N!==false){let S=s-xt,x=S>0?Math.abs(a-(Je<0?a:Je))/S:0;p=i*Math.max(.2,1+x*(typeof N=="number"?N:1)*.04);}Je=a,xt=s;let h=Ie?P===-1||a>=P?"forward":"reverse":b;P=a;let z=A-D,ye=true,j=z===0?0:(a-D)/z;if(isNaN(Oe)||(Oe<=0&&j>0?we?.():Oe>0&&j<=0&&Ce?.(),Oe<1&&j>=1?me?.():Oe>=1&&j<1&&se?.()),Oe=j,L){let S=At(0,ee(a,D,A,p));I=S,e.style.setProperty("--scroll-draw-progress",String(S));let x=h==="reverse"?1-S:S;e.style.clipPath=ge(x),Pe?.(S),!l&&ee(a,D,A,p)>0&&(l=true,F?.()),S>=1&&!M?(M=true,_?.(),q<(ue==="infinite"?1/0:ue??0)&&(q++,Ee=setTimeout(()=>{V=-1,$=[],l=false,M=false,We();},Me))):S<1&&!ce&&(M=false),yt(a);return}if(w.forEach((S,x)=>{let C=x*Le*z,O=At(x,ee(a,D+C,A+C,p));dt(S,x,O,h),x===0&&(I=O,Pe?.(O),e.style.setProperty("--scroll-draw-progress",String(O))),O<1&&(ye=false);}),Y){let S=k(ee(a,D,A,p));for(let x in Y){let C=parseFloat(x);S>=C&&!Se.has(C)&&(Se.add(C),Y[x]?.());}}!l&&ee(a,D,A,p)>0&&(l=true,F?.()),ye&&!M?(M=true,_?.(),q<(ue==="infinite"?1/0:ue??0)&&(q++,Ee=setTimeout(()=>{V=-1,$=[],l=false,M=false,Se.clear(),We(),xe=true;},Me))):!ye&&!ce&&(M=false),yt(a);}function gt(s){return s>=A&&s<Ke}function yt(s){re||gt(s)?f=requestAnimationFrame($t):Re=false;}function ht(){return re||gt(ze())}let Re=false;function et(){Re||(Re=true,f=requestAnimationFrame(function(){$t();}));}function tt(){Re=false,cancelAnimationFrame(f);}let bt=new IntersectionObserver(s=>{s.forEach(a=>{re=a.isIntersecting,re&&!d?(xe=true,et()):Re&&!d&>(ze())||tt();});},{root:H??null,threshold:Z,rootMargin:Ye});function kt(){w.forEach(Ge),Pt(),xe=true;}let rt;function qe(){clearTimeout(rt),rt=setTimeout(kt,150);}window.addEventListener("resize",qe),window.addEventListener("orientationchange",qe);let nr=ct([e],qe);return be>0?setTimeout(()=>bt.observe(e),be):bt.observe(e),pt({destroy(){cancelAnimationFrame(f),clearTimeout(Ee),tt(),bt.disconnect(),nr(),window.removeEventListener("resize",qe),window.removeEventListener("orientationchange",qe),clearTimeout(rt),Et();},replay(){V=-1,$=[],P=-1,Je=-1,l=false,M=false,q=0,d=false,I=0,Se.clear(),clearTimeout(Ee),We(),xe=true,ht()&&et();},pause(){d=true,tt();},resume(){d&&(d=false,xe=true,ht()&&et());},seek(s){let a=Math.min(1,Math.max(0,s));I=a,V=a,$=[],d=true,tt(),Jt(a,b),xe=true;},getProgress(){return I},refresh(){clearTimeout(rt),kt(),ht()&&!d&&et();}},()=>({tStart:D,tEnd:A}))}function wr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Qt(e){let n=[],r=/([\w]+)\(([^)]*)\)/g,t;for(;(t=r.exec(e))!==null;){let o=[],c=[],u=t[2].trim();if(u)for(let i of u.split(/[\s,]+/)){let m=i.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),c.push(m?m[2]:"");}n.push({fn:t[1],nums:o,units:c});}return n}function vr(e,n,r){let t=Qt(e),o=Qt(n);return t.length===0||t.length!==o.length?r<1?e:n:t.map((c,u)=>{let i=o[u];return c.fn!==i.fn||c.nums.length!==i.nums.length?r<1?`${c.fn}(${c.nums.map((m,g)=>`${m}${c.units[g]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,g)=>`${m}${i.units[g]}`).join(", ")})`:`${c.fn}(${c.nums.map((m,g)=>`${m+(i.nums[g]-m)*r}${c.units[g]}`).join(", ")})`}).join(" ")}function vt(e,n,r){if(typeof e=="number"&&typeof n=="number")return String(e+(n-e)*r);let t=String(e),o=String(n);if(wr(t))return st(t,o,r);if(t.includes("("))return vr(t,o,r);let c=t.match(/^([-+]?[\d.]+)(.*)$/),u=o.match(/^([-+]?[\d.]+)(.*)$/);if(c&&u){let i=parseFloat(c[1]),m=parseFloat(u[1]);return `${i+(m-i)*r}${c[2]||u[2]}`}return r<1?t:o}function Er(e){return e.replace(/([A-Z])/g,n=>`-${n.toLowerCase()}`)}var Sr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),xr=0,jt="--scroll-draw-progress";function Tr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Xt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function He(e,n){return typeof window>"u"?Xt:n.respectReducedMotion===false?Ut(e,n,false):ut(n,(r,t)=>Ut(e,r,t))}function Ut(e,n,r){let{props:t,trigger:o={},easing:c="ease-out",speed:u=1,once:i=false,axis:m="y",scrollContainer:g,native:E=true,velocityScale:T=false,triggerElement:b,onProgress:ce,onComplete:ke,onEnter:te,onLeave:De,onEnterBack:Ie,onLeaveBack:be}=n,X=typeof c=="function"?c:Te[c]??Te["ease-out"],ne=Ne(o.start||"top bottom"),oe=Ne(o.end||"bottom top"),Y=b??e,N=typeof g=="string"?document.querySelector(g):g??null,Z=Object.entries(t).map(([l,f])=>({prop:Er(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Ye(){let l=window.getComputedStyle(e);for(let f of Z)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function ue(){for(let l of Z)e.style.setProperty(l.prop,String(l.to));}let Me=new Map;for(let l of [...Z.map(f=>f.prop),jt])Me.set(l,e.style.getPropertyValue(l));function W(){for(let[l,f]of Me)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(r)return ue(),ke?.(),{...Xt,destroy:W,getProgress:()=>1};Ye();let fe=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Ve=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,Ze=typeof c=="string"?it(c):null;function ft(){if(!E||!Tr()||!Ze||m!=="y"||N||Y!==e||i||u!==1||ce||ke||te||De||Ie||be||T!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let l of Z)if(!Sr.has(l.prop))return false;return true}function Pe(){let l=`ssd-a-${++xr}`,f=Z.map(d=>`${d.prop}:${d.from}`).join(";"),re=Z.map(d=>`${d.prop}:${d.to}`).join(";"),V=document.createElement("style");V.setAttribute("data-ssd-animate",""),V.textContent=`@keyframes ${l}{from{${f}}to{${re}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ze};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(V),e.classList.add(l);let $=()=>{let d=e.getBoundingClientRect();return Fe({top:d.top,height:d.height},fe(),Ve(),ne,oe)};Be(e,{type:"animate",getProgress:()=>P.getProgress(),getTrigger:$});let P={refresh(){},destroy(){e.classList.remove(l),V.remove(),e.style.animationPlayState="",W(),Qe(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let I=Math.min(1,Math.max(0,d));e.classList.remove(l);for(let q of Z)e.style.setProperty(q.prop,vt(q.from,q.to,I));},getProgress(){let{tStart:d,tEnd:I}=$();return X(ee(fe(),d,I,u))}};return P}if(ft())return Pe();let F=0,_=0,we=0,me=NaN,se=false,Ce=-1,L=0,k=0,Ae=false,ie=NaN,H=-1,pe=0,K=Y===e?Z:[],ae=false;function de(){let l=e.style,f=K.map(P=>l.getPropertyValue(P.prop)),re=l.transition;K.length&&(l.transition="none"),K.forEach(P=>l.setProperty(P.prop,Me.get(P.prop)??""));let V=nt(Y,N,m);K.forEach((P,d)=>l.setProperty(P.prop,f[d])),K.length&&(e.offsetWidth,l.transition=re);let $=Fe(V,V.scroll,Ve(),ne,oe);ae&&Math.abs($.tStart-F)<1&&Math.abs($.tEnd-_)<1||(ae=true,F=$.tStart,_=$.tEnd);}function J(l){e.style.setProperty(jt,String(l));for(let f of Z)e.style.setProperty(f.prop,vt(f.from,f.to,l));ce?.(l);}function ve(l){if(isNaN(ie)){ie=l;return}ie<=0&&l>0?te?.():ie>0&&l<=0&&be?.(),ie<1&&l>=1?De?.():ie>=1&&l<1&&Ie?.(),ie=l;}let ge=l=>ee(l,F,_,Math.min(u,1));function w(){!we&&!se&&ge(fe())!==me&&(we=requestAnimationFrame(G));}function G(){if(se)return;let l=performance.now(),f=fe(),re=u;if(T!==false){let d=l-pe,I=d>0?Math.abs(f-(H<0?f:H))/d:0;re=u*Math.max(.2,1+I*(typeof T=="number"?T:1)*.04);}H=f,pe=l;let V=_===F?0:(f-F)/(_-F);ve(V);let $=ee(f,F,_,re),P=i?Math.max(Ce,X(L=Math.max(L,$))):X($);k=P,J(P),P>=1&&!Ae?(Ae=true,ke?.()):P<1&&!i&&(Ae=false),!se&&(me=ge(f),we=me>0&&me<1?requestAnimationFrame(G):0);}de(),_===F&&le("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),L=ee(fe(),F,_,u),k=X(L),J(k);function Q(){de(),w();}let D;function A(){clearTimeout(D),D=setTimeout(Q,150);}let Le=N??window;Le.addEventListener("scroll",w,{passive:true}),window.addEventListener("resize",A),window.addEventListener("orientationchange",A);let Ke=ct([Y],A);w(),Be(e,{type:"animate",getProgress:()=>k,getTrigger:()=>({tStart:F,tEnd:_})});function M(){se=true,cancelAnimationFrame(we),we=0,me=NaN;}return {destroy(){M(),Le.removeEventListener("scroll",w),window.removeEventListener("resize",A),window.removeEventListener("orientationchange",A),Ke(),clearTimeout(D),W(),Qe(e);},replay(){Ce=-1,L=0,Ae=false,k=0,se=false,J(0),me=0,w();},pause:M,resume(){se&&(se=false,w());},seek(l){let f=Math.min(1,Math.max(0,l));k=f,Ce=f,L=0,M(),J(f);},getProgress(){return k},refresh:Q}}var Yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Zt(e,n={}){if(typeof window>"u")return Yt;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return le("scrollParallax: element not found:",e),Yt;let{speed:t=.3,axis:o="y",easing:c="linear",trigger:u,onProgress:i}=n,m=-t*100,g=r.style,E=!!r.ownerSVGElement,T=g.getPropertyValue("transform-box");E&&g.setProperty("transform-box","fill-box");let b=He(r,{props:o==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:u??{start:"top bottom",end:"bottom top"},easing:c,native:false,onProgress:i});return E?{...b,destroy(){b.destroy(),g.setProperty("transform-box",T);}}:b}function Xe(e){return e.map(n=>typeof n=="string"?document.querySelector(n):n).filter(n=>n!==null)}var $e={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function yn(e,n={}){if(typeof window>"u")return $e;let r=Xe(e).map(t=>wt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function hn(e,n={}){if(typeof window>"u")return $e;let r=Xe(e);if(r.length===0)return $e;let t=0,o=[];function c(i){return wt(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function u(){r.forEach((i,m)=>{o[m]=c(m);});for(let i=1;i<o.length;i++)o[i].pause();}return u(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,u();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function bn(e,n){if(typeof window>"u")return $e;let r=Xe(e).map(t=>He(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}function wn(e,n){if(typeof window>"u")return $e;let r=Xe(e);if(r.length===0)return $e;let t=0,o=[];function c(i){return He(r[i],{...n,once:true,onComplete(){n.onComplete?.(),t=Math.min(i+1,r.length-1),t>i&&o[t]?.resume();}})}function u(){r.forEach((i,m)=>{o[m]=c(m);});for(let i=1;i<o.length;i++)o[i].pause();}return u(),{destroy(){o.forEach(i=>i.destroy()),o.length=0;},replay(){o.forEach(i=>i.destroy()),o.length=0,t=0,u();},pause(){o[t]?.pause();},resume(){o[t]?.resume();},seek(i){o[t]?.seek(i);},getProgress(){return o[t]?.getProgress()??0},refresh(){o.forEach(i=>i.refresh?.());}}}function vn(e,n={}){if(typeof window>"u")return $e;let r=Xe(e).map(t=>Zt(t,n));return {destroy(){r.forEach(t=>t.destroy());},replay(){r.forEach(t=>t.replay());},pause(){r.forEach(t=>t.pause());},resume(){r.forEach(t=>t.resume());},seek(t){r.forEach(o=>o.seek(t));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(t=>t.refresh?.());}}}exports.scrollAnimateGroup=bn;exports.scrollAnimateSequence=wn;exports.scrollDrawGroup=yn;exports.scrollDrawSequence=hn;exports.scrollParallaxGroup=vn;
|
package/dist/group/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1}from'../chunk-
|
|
1
|
+
import {b as b$1}from'../chunk-XTPAW6XR.mjs';import {a as a$1}from'../chunk-OPXWNJBG.mjs';import {b}from'../chunk-6TWFLRUB.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function u(s){return s.map(o=>typeof o=="string"?document.querySelector(o):o).filter(o=>o!==null)}var a={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function y(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function E(s,o={}){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return b(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function d(s,o){if(typeof window>"u")return a;let r=u(s).map(e=>a$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function w(s,o){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return a$1(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function S(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}export{d as scrollAnimateGroup,w as scrollAnimateSequence,y as scrollDrawGroup,E as scrollDrawSequence,S as scrollParallaxGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function Be({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(r),s=0,a=[];for(let c=0;c<n;c++){let p=Math.pow(o,c);a.push(p),s+=p;}let f=[0],m=0;for(let c=0;c<n;c++)m+=a[c]/s,f.push(m);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=f[p+1]){let E=(c-f[p])/(f[p+1]-f[p]);if(p===0)return E*(2-E);let x=1-Math.pow(r,p);return x+(1-x)*(2*E-1)*(2*E-1)}return 1}}function Qe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),o=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var q={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:Be(),elastic:Qe()};function we(e,t,n){return Math.min(n,Math.max(t,e))}function le(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function ve(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function Se(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function te(e,t,n,r){return n===t?0:we((e-t)/(n-t)*r,0,1)}function me(e,t,n,r,o){let s=ve(e.top,e.height,t,r.element)-Se(r.viewport,n),a=ve(e.top,e.height,t,o.element)-Se(o.viewport,n);return {tStart:s,tEnd:a}}function Me(e,t,n){let r=e.getBoundingClientRect(),o=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:r.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:n==="x"?r.left:r.top,height:o,scroll:n==="x"?window.scrollX:window.scrollY}}function Le(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function Te(e,t,n){let r=Le(e),o=Le(t);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*n)},${Math.round(r[1]+(o[1]-r[1])*n)},${Math.round(r[2]+(o[2]-r[2])*n)})`}var qe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",je="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",xe=33;function Ge(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ue(e){let t=[];for(let n=0;n<xe;n++){let r=n/(xe-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function Pe(e){switch(e){case "linear":return "linear";case "ease-in":return qe;case "ease-out":return je;case "ease-in-out":return Ge()?Ue(q["ease-in-out"]):null;default:return null}}var Re=Symbol.for("svg-scroll-draw.registry");function $e(){let e=globalThis;return e[Re]||(e[Re]=new Map)}function fe(e,t){$e().set(e,t);}function de(e){$e().delete(e);}var Xe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function j(e,...t){Xe&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var G,ne=new Set,re=new WeakMap,U=new Map,Ae=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Ke(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function oe(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();G??(G=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)re.get(a)!==Ae(a)&&(s=true),re.set(a,"");s&&ne.forEach(a=>a());})),ne.add(n);let r=Ke(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{re.has(o)||re.set(o,Ae(o)),U.set(o,(U.get(o)??0)+1),G.observe(o);}),()=>{ne.delete(n)&&(r.forEach(o=>{let s=(U.get(o)??1)-1;if(s)return void U.set(o,s);U.delete(o),G?.unobserve(o);}),ne.size||(G?.disconnect(),G=void 0));}}function Ce(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function Ie(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=Ce(s=>{if(!s)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(n))o[s]=(...a)=>n[s]?.(...a);return o.destroy=()=>{r(),n.destroy();},o}function Ye(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function _e(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],s=[],a=r[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let m=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}t.push({fn:r[1],nums:o,units:s});}return t}function Ze(e,t,n){let r=_e(e),o=_e(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((s,a)=>{let f=o[a];return s.fn!==f.fn||s.nums.length!==f.nums.length?n<1?`${s.fn}(${s.nums.map((m,c)=>`${m}${s.units[c]}`).join(", ")})`:`${f.fn}(${f.nums.map((m,c)=>`${m}${f.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,c)=>`${m+(f.nums[c]-m)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function Oe(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(Ye(r))return Te(r,o,n);if(r.includes("("))return Ze(r,o,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let f=parseFloat(s[1]),m=parseFloat(a[1]);return `${f+(m-f)*n}${s[2]||a[2]}`}return n<1?r:o}function Je(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var et=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),tt=0,ke="--scroll-draw-progress";function nt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var ze={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pe(e,t){return typeof window>"u"?ze:t.respectReducedMotion===false?He(e,t,false):Ie(t,(n,r)=>He(e,n,r))}function He(e,t,n){let{props:r,trigger:o={},easing:s="ease-out",speed:a=1,once:f=false,axis:m="y",scrollContainer:c,native:p=true,velocityScale:E=false,triggerElement:x,onProgress:k,onComplete:$,onEnter:v,onLeave:y,onEnterBack:F,onLeaveBack:M}=t,A=typeof s=="function"?s:q[s]??q["ease-out"],H=le(o.start||"top bottom"),W=le(o.end||"bottom top"),P=x??e,w=typeof c=="string"?document.querySelector(c):c??null,b=Object.entries(r).map(([i,u])=>({prop:Je(i),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function D(){let i=window.getComputedStyle(e);for(let u of b)u.from===""&&(u.from=i.getPropertyValue(u.prop).trim()||"0");}function X(){for(let i of b)e.style.setProperty(i.prop,String(i.to));}let l=new Map;for(let i of [...b.map(u=>u.prop),ke])l.set(i,e.style.getPropertyValue(i));function g(){for(let[i,u]of l)u?e.style.setProperty(i,u):e.style.removeProperty(i);}if(n)return X(),$?.(),{...ze,destroy:g,getProgress:()=>1};D();let K=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ge=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight,be=typeof s=="string"?Pe(s):null;function Fe(){if(!p||!nt()||!be||m!=="y"||w||P!==e||f||a!==1||k||$||v||y||F||M||E!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let i of b)if(!et.has(i.prop))return false;return true}function We(){let i=`ssd-a-${++tt}`,u=b.map(d=>`${d.prop}:${d.from}`).join(";"),N=b.map(d=>`${d.prop}:${d.to}`).join(";"),T=document.createElement("style");T.setAttribute("data-ssd-animate",""),T.textContent=`@keyframes ${i}{from{${u}}to{${N}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${be};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(T),e.classList.add(i);let S=()=>{let d=e.getBoundingClientRect();return me({top:d.top,height:d.height},K(),ge(),H,W)};fe(e,{type:"animate",getProgress:()=>h.getProgress(),getTrigger:S});let h={refresh(){},destroy(){e.classList.remove(i),T.remove(),e.style.animationPlayState="",g(),de(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let Q=Math.min(1,Math.max(0,d));e.classList.remove(i);for(let ee of b)e.style.setProperty(ee.prop,Oe(ee.from,ee.to,Q));},getProgress(){let{tStart:d,tEnd:Q}=S();return A(te(K(),d,Q,a))}};return h}if(Fe())return We();let L=0,R=0,C=0,Y=false,I=false,ie=-1,z=0,_=0,Z=false,O=NaN,se=-1,ye=0,V=P===e?b:[],he=false;function ae(){let i=e.style,u=V.map(h=>i.getPropertyValue(h.prop)),N=i.transition;V.length&&(i.transition="none"),V.forEach(h=>i.setProperty(h.prop,l.get(h.prop)??""));let T=Me(P,w,m);V.forEach((h,d)=>i.setProperty(h.prop,u[d])),V.length&&(e.offsetWidth,i.transition=N);let S=me(T,T.scroll,ge(),H,W);he&&Math.abs(S.tStart-L)<1&&Math.abs(S.tEnd-R)<1||(he=true,L=S.tStart,R=S.tEnd);}function J(i){e.style.setProperty(ke,String(i));for(let u of b)e.style.setProperty(u.prop,Oe(u.from,u.to,i));k?.(i);}function De(i){if(isNaN(O)){O=i;return}O<=0&&i>0?v?.():O>0&&i<=0&&M?.(),O<1&&i>=1?y?.():O>=1&&i<1&&F?.(),O=i;}function ue(){if(!Y||I)return;let i=performance.now(),u=K(),N=a;if(E!==false){let d=i-ye,Q=d>0?Math.abs(u-(se<0?u:se))/d:0;N=a*Math.max(.2,1+Q*(typeof E=="number"?E:1)*.04);}se=u,ye=i;let T=R===L?0:(u-L)/(R-L);De(T);let S=te(u,L,R,N),h=f?Math.max(ie,A(z=Math.max(z,S))):A(S);_=h,J(h),h>=1&&!Z?(Z=true,$?.()):h<1&&!f&&(Z=false),C=requestAnimationFrame(ue);}ae(),R===L&&j("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),z=te(K(),L,R,a),_=A(z),J(_);let Ee=new IntersectionObserver(i=>{i.forEach(u=>{Y=u.isIntersecting,Y&&!I?C=requestAnimationFrame(ue):cancelAnimationFrame(C);});},{root:w??null}),ce;function B(){clearTimeout(ce),ce=setTimeout(ae,150);}window.addEventListener("resize",B),window.addEventListener("orientationchange",B);let Ve=oe([P],B);return Ee.observe(e),fe(e,{type:"animate",getProgress:()=>_,getTrigger:()=>({tStart:L,tEnd:R})}),{destroy(){cancelAnimationFrame(C),Ee.disconnect(),window.removeEventListener("resize",B),window.removeEventListener("orientationchange",B),Ve(),clearTimeout(ce),g(),de(e);},replay(){ie=-1,z=0,Z=false,_=0,I=false,J(0);},pause(){I=true,cancelAnimationFrame(C);},resume(){I&&(I=false,Y&&(C=requestAnimationFrame(ue)));},seek(i){let u=Math.min(1,Math.max(0,i));_=u,ie=u,z=0,I=true,cancelAnimationFrame(C),J(u);},getProgress(){return _},refresh(){ae();}}}var Ne={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function At(e,t={}){if(typeof window>"u")return Ne;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return j("scrollHorizontal: track element not found:",e),Ne;let r=n,{easing:o="linear",trigger:s={start:"top top",end:"bottom bottom"},scrollContainer:a,respectReducedMotion:f=false,onProgress:m}=t,c=typeof a=="string"?document.querySelector(a):a??null;function p(){for(let l=r.parentElement;l;l=l.parentElement)if(window.getComputedStyle(l).position==="sticky")return l;return null}function E(){let l=p();if(l){let g=window.getComputedStyle(l);return l.clientWidth-(parseFloat(g.paddingLeft)||0)-(parseFloat(g.paddingRight)||0)}return c?c.clientWidth:document.documentElement.clientWidth||window.innerWidth}function x(){return t.distance??r.scrollWidth-E()}function k(){if(t.triggerElement!==void 0){let g=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(g)return g;j("scrollHorizontal: triggerElement not found:",t.triggerElement);}let l=p();return l?l.parentElement??l:r}let $=x(),v=k(),y=pe(r,A($,v)),F=H(),M=null;function A(l,g){return {props:{transform:["translateX(0px)",`translateX(${-l}px)`]},trigger:s,easing:o,native:false,respectReducedMotion:f,...g!==r&&{triggerElement:g},...a!==void 0&&{scrollContainer:a},...m!==void 0&&{onProgress:m}}}function H(){let l=v.getBoundingClientRect(),g=c?l.top-c.getBoundingClientRect().top+c.scrollTop:l.top+window.scrollY;return `${x()} ${Math.round(g)} ${Math.round(l.height)}`}function W(){y.destroy();let l=k(),g=l!==v;$=x(),v=l,y=pe(r,A($,v)),F=H(),M!==null&&y.seek(M),g&&X();}let P;function w(){(k()!==v||H()!==F)&&W();}function b(){clearTimeout(P),P=setTimeout(w,150);}window.addEventListener("resize",b),window.addEventListener("orientationchange",b);let D=()=>{};function X(){D(),D=oe([r,v],b);}return X(),{destroy(){clearTimeout(P),window.removeEventListener("resize",b),window.removeEventListener("orientationchange",b),D(),y.destroy();},replay(){M=null,y.replay();},pause(){y.pause(),M=y.getProgress();},resume(){M=null,y.resume();},seek(l){y.seek(l),M=y.getProgress();},getProgress(){return y.getProgress()},refresh(){W();}}}exports.scrollHorizontal=At;
|
|
1
|
+
'use strict';function Ge({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(r),s=0,a=[];for(let c=0;c<n;c++){let p=Math.pow(o,c);a.push(p),s+=p;}let f=[0],m=0;for(let c=0;c<n;c++)m+=a[c]/s,f.push(m);return c=>{if(c<=0)return 0;if(c>=1)return 1;for(let p=0;p<n;p++)if(c<=f[p+1]){let E=(c-f[p])/(f[p+1]-f[p]);if(p===0)return E*(2-E);let P=1-Math.pow(r,p);return P+(1-P)*(2*E-1)*(2*E-1)}return 1}}function Ue({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),o=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return s=>s<=0?0:s>=1?1:n*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var U={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:Ge(),elastic:Ue()};function Le(e,t,n){return Math.min(n,Math.max(t,e))}function le(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",r="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:r}}function Te(e,t,n,r){switch(r){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function xe(e,t){if(/^\d+(\.\d+)?%$/.test(e))return t*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return t/2;case "bottom":return t;default:return t}}function X(e,t,n,r){return n===t?0:Le((e-t)/(n-t)*r,0,1)}function me(e,t,n,r,o){let s=Te(e.top,e.height,t,r.element)-xe(r.viewport,n),a=Te(e.top,e.height,t,o.element)-xe(o.viewport,n);return {tStart:s,tEnd:a}}function Pe(e,t,n){let r=e.getBoundingClientRect(),o=n==="x"?r.width:r.height;return t?{top:n==="x"?r.left-t.getBoundingClientRect().left-t.clientLeft+t.scrollLeft:r.top-t.getBoundingClientRect().top-t.clientTop+t.scrollTop,height:o,scroll:0}:{top:n==="x"?r.left:r.top,height:o,scroll:n==="x"?window.scrollX:window.scrollY}}function Re(e){let t=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(t)return [parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)];let n=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(n)return [parseInt(n[1],16),parseInt(n[2],16),parseInt(n[3],16)];let r=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return r?[parseInt(r[1]),parseInt(r[2]),parseInt(r[3])]:null}function $e(e,t,n){let r=Re(e),o=Re(t);return !r||!o?e:`rgb(${Math.round(r[0]+(o[0]-r[0])*n)},${Math.round(r[1]+(o[1]-r[1])*n)},${Math.round(r[2]+(o[2]-r[2])*n)})`}var Xe="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Ke="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Ce=33;function Ye(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Ze(e){let t=[];for(let n=0;n<Ce;n++){let r=n/(Ce-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function Ae(e){switch(e){case "linear":return "linear";case "ease-in":return Xe;case "ease-out":return Ke;case "ease-in-out":return Ye()?Ze(U["ease-in-out"]):null;default:return null}}var Ie=Symbol.for("svg-scroll-draw.registry");function _e(){let e=globalThis;return e[Ie]||(e[Ie]=new Map)}function fe(e,t){_e().set(e,t);}function de(e){_e().delete(e);}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 K(e,...t){Je&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var Y,re=new Set,oe=new WeakMap,Z=new Map,ke=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function et(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let r=n;r;r=r.previousElementSibling)t.add(r);return t}function ie(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();Y??(Y=new ResizeObserver(o=>{let s=false;for(let{target:a}of o)oe.get(a)!==ke(a)&&(s=true),oe.set(a,"");s&&re.forEach(a=>a());})),re.add(n);let r=et(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{oe.has(o)||oe.set(o,ke(o)),Z.set(o,(Z.get(o)??0)+1),Y.observe(o);}),()=>{re.delete(n)&&(r.forEach(o=>{let s=(Z.get(o)??1)-1;if(s)return void Z.set(o,s);Z.delete(o),Y?.unobserve(o);}),re.size||(Y?.disconnect(),Y=void 0));}}function Ne(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",n),()=>t.removeEventListener("change",n);let r=t;return r.addListener?.(n),()=>r.removeListener?.(n)}function Oe(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=Ne(s=>{if(!s)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),o={};for(let s of Object.keys(n))o[s]=(...a)=>n[s]?.(...a);return o.destroy=()=>{r(),n.destroy();},o}function tt(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function He(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let o=[],s=[],a=r[2].trim();if(a)for(let f of a.split(/[\s,]+/)){let m=f.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),s.push(m?m[2]:"");}t.push({fn:r[1],nums:o,units:s});}return t}function nt(e,t,n){let r=He(e),o=He(t);return r.length===0||r.length!==o.length?n<1?e:t:r.map((s,a)=>{let f=o[a];return s.fn!==f.fn||s.nums.length!==f.nums.length?n<1?`${s.fn}(${s.nums.map((m,c)=>`${m}${s.units[c]}`).join(", ")})`:`${f.fn}(${f.nums.map((m,c)=>`${m}${f.units[c]}`).join(", ")})`:`${s.fn}(${s.nums.map((m,c)=>`${m+(f.nums[c]-m)*n}${s.units[c]}`).join(", ")})`}).join(" ")}function ze(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),o=String(t);if(tt(r))return $e(r,o,n);if(r.includes("("))return nt(r,o,n);let s=r.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(s&&a){let f=parseFloat(s[1]),m=parseFloat(a[1]);return `${f+(m-f)*n}${s[2]||a[2]}`}return n<1?r:o}function rt(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var ot=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),it=0,We="--scroll-draw-progress";function st(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Ve={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function pe(e,t){return typeof window>"u"?Ve:t.respectReducedMotion===false?De(e,t,false):Oe(t,(n,r)=>De(e,n,r))}function De(e,t,n){let{props:r,trigger:o={},easing:s="ease-out",speed:a=1,once:f=false,axis:m="y",scrollContainer:c,native:p=true,velocityScale:E=false,triggerElement:P,onProgress:k,onComplete:$,onEnter:v,onLeave:b,onEnterBack:D,onLeaveBack:L}=t,C=typeof s=="function"?s:U[s]??U["ease-out"],N=le(o.start||"top bottom"),V=le(o.end||"bottom top"),R=P??e,w=typeof c=="string"?document.querySelector(c):c??null,y=Object.entries(r).map(([i,u])=>({prop:rt(i),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function F(){let i=window.getComputedStyle(e);for(let u of y)u.from===""&&(u.from=i.getPropertyValue(u.prop).trim()||"0");}function J(){for(let i of y)e.style.setProperty(i.prop,String(i.to));}let l=new Map;for(let i of [...y.map(u=>u.prop),We])l.set(i,e.style.getPropertyValue(i));function g(){for(let[i,u]of l)u?e.style.setProperty(i,u):e.style.removeProperty(i);}if(n)return J(),$?.(),{...Ve,destroy:g,getProgress:()=>1};F();let B=()=>w?m==="x"?w.scrollLeft:w.scrollTop:m==="x"?window.scrollX:window.scrollY,ge=()=>w?m==="x"?w.clientWidth:w.clientHeight:m==="x"?window.innerWidth:window.innerHeight,ye=typeof s=="string"?Ae(s):null;function Be(){if(!p||!st()||!ye||m!=="y"||w||R!==e||f||a!==1||k||$||v||b||D||L||E!==false||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return false;for(let i of y)if(!ot.has(i.prop))return false;return true}function Qe(){let i=`ssd-a-${++it}`,u=y.map(d=>`${d.prop}:${d.from}`).join(";"),W=y.map(d=>`${d.prop}:${d.to}`).join(";"),x=document.createElement("style");x.setAttribute("data-ssd-animate",""),x.textContent=`@keyframes ${i}{from{${u}}to{${W}}}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${ye};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(x),e.classList.add(i);let M=()=>{let d=e.getBoundingClientRect();return me({top:d.top,height:d.height},B(),ge(),N,V)};fe(e,{type:"animate",getProgress:()=>h.getProgress(),getTrigger:M});let h={refresh(){},destroy(){e.classList.remove(i),x.remove(),e.style.animationPlayState="",g(),de(e);},replay(){e.classList.remove(i),e.offsetWidth,e.classList.add(i);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(d){let G=Math.min(1,Math.max(0,d));e.classList.remove(i);for(let ne of y)e.style.setProperty(ne.prop,ze(ne.from,ne.to,G));},getProgress(){let{tStart:d,tEnd:G}=M();return C(X(B(),d,G,a))}};return h}if(Be())return Qe();let S=0,T=0,Q=0,O=NaN,A=false,se=-1,H=0,I=0,ee=false,_=NaN,ae=-1,be=0,q=R===e?y:[],he=false;function Ee(){let i=e.style,u=q.map(h=>i.getPropertyValue(h.prop)),W=i.transition;q.length&&(i.transition="none"),q.forEach(h=>i.setProperty(h.prop,l.get(h.prop)??""));let x=Pe(R,w,m);q.forEach((h,d)=>i.setProperty(h.prop,u[d])),q.length&&(e.offsetWidth,i.transition=W);let M=me(x,x.scroll,ge(),N,V);he&&Math.abs(M.tStart-S)<1&&Math.abs(M.tEnd-T)<1||(he=true,S=M.tStart,T=M.tEnd);}function te(i){e.style.setProperty(We,String(i));for(let u of y)e.style.setProperty(u.prop,ze(u.from,u.to,i));k?.(i);}function qe(i){if(isNaN(_)){_=i;return}_<=0&&i>0?v?.():_>0&&i<=0&&L?.(),_<1&&i>=1?b?.():_>=1&&i<1&&D?.(),_=i;}let we=i=>X(i,S,T,Math.min(a,1));function z(){!Q&&!A&&we(B())!==O&&(Q=requestAnimationFrame(ve));}function ve(){if(A)return;let i=performance.now(),u=B(),W=a;if(E!==false){let d=i-be,G=d>0?Math.abs(u-(ae<0?u:ae))/d:0;W=a*Math.max(.2,1+G*(typeof E=="number"?E:1)*.04);}ae=u,be=i;let x=T===S?0:(u-S)/(T-S);qe(x);let M=X(u,S,T,W),h=f?Math.max(se,C(H=Math.max(H,M))):C(M);I=h,te(h),h>=1&&!ee?(ee=true,$?.()):h<1&&!f&&(ee=false),!A&&(O=we(u),Q=O>0&&O<1?requestAnimationFrame(ve):0);}Ee(),T===S&&K("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),H=X(B(),S,T,a),I=C(H),te(I);function Se(){Ee(),z();}let ue;function j(){clearTimeout(ue),ue=setTimeout(Se,150);}let Me=w??window;Me.addEventListener("scroll",z,{passive:true}),window.addEventListener("resize",j),window.addEventListener("orientationchange",j);let je=ie([R],j);z(),fe(e,{type:"animate",getProgress:()=>I,getTrigger:()=>({tStart:S,tEnd:T})});function ce(){A=true,cancelAnimationFrame(Q),Q=0,O=NaN;}return {destroy(){ce(),Me.removeEventListener("scroll",z),window.removeEventListener("resize",j),window.removeEventListener("orientationchange",j),je(),clearTimeout(ue),g(),de(e);},replay(){se=-1,H=0,ee=false,I=0,A=false,te(0),O=0,z();},pause:ce,resume(){A&&(A=false,z());},seek(i){let u=Math.min(1,Math.max(0,i));I=u,se=u,H=0,ce(),te(u);},getProgress(){return I},refresh:Se}}var Fe={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function kt(e,t={}){if(typeof window>"u")return Fe;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return K("scrollHorizontal: track element not found:",e),Fe;let r=n,{easing:o="linear",trigger:s={start:"top top",end:"bottom bottom"},scrollContainer:a,respectReducedMotion:f=false,onProgress:m}=t,c=typeof a=="string"?document.querySelector(a):a??null;function p(){for(let l=r.parentElement;l;l=l.parentElement)if(window.getComputedStyle(l).position==="sticky")return l;return null}function E(){let l=p();if(l){let g=window.getComputedStyle(l);return l.clientWidth-(parseFloat(g.paddingLeft)||0)-(parseFloat(g.paddingRight)||0)}return c?c.clientWidth:document.documentElement.clientWidth||window.innerWidth}function P(){return t.distance??r.scrollWidth-E()}function k(){if(t.triggerElement!==void 0){let g=typeof t.triggerElement=="string"?document.querySelector(t.triggerElement):t.triggerElement;if(g)return g;K("scrollHorizontal: triggerElement not found:",t.triggerElement);}let l=p();return l?l.parentElement??l:r}let $=P(),v=k(),b=pe(r,C($,v)),D=N(),L=null;function C(l,g){return {props:{transform:["translateX(0px)",`translateX(${-l}px)`]},trigger:s,easing:o,native:false,respectReducedMotion:f,...g!==r&&{triggerElement:g},...a!==void 0&&{scrollContainer:a},...m!==void 0&&{onProgress:m}}}function N(){let l=v.getBoundingClientRect(),g=c?l.top-c.getBoundingClientRect().top+c.scrollTop:l.top+window.scrollY;return `${P()} ${Math.round(g)} ${Math.round(l.height)}`}function V(){b.destroy();let l=k(),g=l!==v;$=P(),v=l,b=pe(r,C($,v)),D=N(),L!==null&&b.seek(L),g&&J();}let R;function w(){(k()!==v||N()!==D)&&V();}function y(){clearTimeout(R),R=setTimeout(w,150);}window.addEventListener("resize",y),window.addEventListener("orientationchange",y);let F=()=>{};function J(){F(),F=ie([r,v],y);}return J(),{destroy(){clearTimeout(R),window.removeEventListener("resize",y),window.removeEventListener("orientationchange",y),F(),b.destroy();},replay(){L=null,b.replay();},pause(){b.pause(),L=b.getProgress();},resume(){L=null,b.resume();},seek(l){b.seek(l),L=b.getProgress();},getProgress(){return b.getProgress()},refresh(){V();}}}exports.scrollHorizontal=kt;
|
|
@@ -43,7 +43,7 @@ interface ScrollHorizontalOptions {
|
|
|
43
43
|
* motion. It advances only as the user scrolls, 1:1 with their input, so it is
|
|
44
44
|
* direct manipulation rather than something that plays at them. And the
|
|
45
45
|
* alternative is worse than the motion — the panels are only reachable *via*
|
|
46
|
-
* the transform, inside a sticky `overflow:
|
|
46
|
+
* the transform, inside a sticky `overflow: clip` stage, so applying a
|
|
47
47
|
* final state (or none at all) silently hides all of the content except one
|
|
48
48
|
* panel from exactly the users who asked for less motion.
|
|
49
49
|
*
|
|
@@ -69,15 +69,18 @@ interface ScrollHorizontalInstance extends ScrollDrawInstance {
|
|
|
69
69
|
*
|
|
70
70
|
* Minimal CSS setup:
|
|
71
71
|
* .outer { height: 400vh; }
|
|
72
|
-
* .sticky { position: sticky; top: 0; height: 100vh; overflow:
|
|
72
|
+
* .sticky { position: sticky; top: 0; height: 100vh; overflow: clip; }
|
|
73
73
|
* .track { display: flex; width: max-content; }
|
|
74
74
|
*
|
|
75
|
+
* `overflow: clip`, not `hidden`: a hidden stage is still a scroll container,
|
|
76
|
+
* so Tab to a panel off to the side scrolls the stage itself and leaves the
|
|
77
|
+
* strip shifted against the page. Keyboard users then need the page scrolled
|
|
78
|
+
* to the focused panel; the horizontal-scroll generator writes that handler.
|
|
79
|
+
*
|
|
75
80
|
* @example
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* easing: 'linear',
|
|
80
|
-
* });
|
|
81
|
+
* // Measures its own travel (the track's width less the stage's) and follows
|
|
82
|
+
* // the layout: pass `distance` only for a fixed number of pixels.
|
|
83
|
+
* scrollHorizontal('.track');
|
|
81
84
|
*/
|
|
82
85
|
declare function scrollHorizontal(track: string | Element, options?: ScrollHorizontalOptions): ScrollHorizontalInstance;
|
|
83
86
|
|
|
@@ -43,7 +43,7 @@ interface ScrollHorizontalOptions {
|
|
|
43
43
|
* motion. It advances only as the user scrolls, 1:1 with their input, so it is
|
|
44
44
|
* direct manipulation rather than something that plays at them. And the
|
|
45
45
|
* alternative is worse than the motion — the panels are only reachable *via*
|
|
46
|
-
* the transform, inside a sticky `overflow:
|
|
46
|
+
* the transform, inside a sticky `overflow: clip` stage, so applying a
|
|
47
47
|
* final state (or none at all) silently hides all of the content except one
|
|
48
48
|
* panel from exactly the users who asked for less motion.
|
|
49
49
|
*
|
|
@@ -69,15 +69,18 @@ interface ScrollHorizontalInstance extends ScrollDrawInstance {
|
|
|
69
69
|
*
|
|
70
70
|
* Minimal CSS setup:
|
|
71
71
|
* .outer { height: 400vh; }
|
|
72
|
-
* .sticky { position: sticky; top: 0; height: 100vh; overflow:
|
|
72
|
+
* .sticky { position: sticky; top: 0; height: 100vh; overflow: clip; }
|
|
73
73
|
* .track { display: flex; width: max-content; }
|
|
74
74
|
*
|
|
75
|
+
* `overflow: clip`, not `hidden`: a hidden stage is still a scroll container,
|
|
76
|
+
* so Tab to a panel off to the side scrolls the stage itself and leaves the
|
|
77
|
+
* strip shifted against the page. Keyboard users then need the page scrolled
|
|
78
|
+
* to the focused panel; the horizontal-scroll generator writes that handler.
|
|
79
|
+
*
|
|
75
80
|
* @example
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* easing: 'linear',
|
|
80
|
-
* });
|
|
81
|
+
* // Measures its own travel (the track's width less the stage's) and follows
|
|
82
|
+
* // the layout: pass `distance` only for a fixed number of pixels.
|
|
83
|
+
* scrollHorizontal('.track');
|
|
81
84
|
*/
|
|
82
85
|
declare function scrollHorizontal(track: string | Element, options?: ScrollHorizontalOptions): ScrollHorizontalInstance;
|
|
83
86
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-OPXWNJBG.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-2PYLM3E7.mjs';import {d}from'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var x={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function $(a$1,r={}){if(typeof window>"u")return x;let h=typeof a$1=="string"?document.querySelector(a$1):a$1;if(!h)return b("scrollHorizontal: track element not found:",a$1),x;let o=h,{easing:C="linear",trigger:P={start:"top top",end:"bottom bottom"},scrollContainer:s,respectReducedMotion:R=false,onProgress:v}=r,u=typeof s=="string"?document.querySelector(s):s??null;function b$1(){for(let e=o.parentElement;e;e=e.parentElement)if(window.getComputedStyle(e).position==="sticky")return e;return null}function M(){let e=b$1();if(e){let t=window.getComputedStyle(e);return e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)}return u?u.clientWidth:document.documentElement.clientWidth||window.innerWidth}function d$1(){return r.distance??o.scrollWidth-M()}function g(){if(r.triggerElement!==void 0){let t=typeof r.triggerElement=="string"?document.querySelector(r.triggerElement):r.triggerElement;if(t)return t;b("scrollHorizontal: triggerElement not found:",r.triggerElement);}let e=b$1();return e?e.parentElement??e:o}let m=d$1(),i=g(),n=a(o,T(m,i)),S=f(),l=null;function T(e,t){return {props:{transform:["translateX(0px)",`translateX(${-e}px)`]},trigger:P,easing:C,native:false,respectReducedMotion:R,...t!==o&&{triggerElement:t},...s!==void 0&&{scrollContainer:s},...v!==void 0&&{onProgress:v}}}function f(){let e=i.getBoundingClientRect(),t=u?e.top-u.getBoundingClientRect().top+u.scrollTop:e.top+window.scrollY;return `${d$1()} ${Math.round(t)} ${Math.round(e.height)}`}function z(){n.destroy();let e=g(),t=e!==i;m=d$1(),i=e,n=a(o,T(m,i)),S=f(),l!==null&&n.seek(l),t&&H();}let p;function W(){(g()!==i||f()!==S)&&z();}function c(){clearTimeout(p),p=setTimeout(W,150);}window.addEventListener("resize",c),window.addEventListener("orientationchange",c);let E=()=>{};function H(){E(),E=d([o,i],c);}return H(),{destroy(){clearTimeout(p),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),E(),n.destroy();},replay(){l=null,n.replay();},pause(){n.pause(),l=n.getProgress();},resume(){l=null,n.resume();},seek(e){n.seek(e),l=n.getProgress();},getProgress(){return n.getProgress()},refresh(){z();}}}export{$ as scrollHorizontal};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Qt=/[MmLlHhVvCcSsQqTtAaZz]/g;function br(e,r,t){if(!Ye)return;let n=(e.match(Qt)??[]).join("").toUpperCase(),s=(r.match(Qt)??[]).join("").toUpperCase(),a=(e.match(jt)??[]).length,c=(r.match(jt)??[]).length;if(n!==s){G(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}a!==c&&G(`morphTo: coordinate count differs (${a} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function wr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let c=parseFloat(a),m=n[s++]??c;return String(+(c+(m-c)*t).toFixed(4))})}function Ut(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(r,(t,n)=>vr(e,t,n))}function vr(e,r,t){let{preset:n,...s}=r,a=n?{...bt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:p="linear",trigger:T={},stagger:A=0,direction:b="forward",once:K=false,debug:se=false,axis:R="y",scrollContainer:v,autoReverse:M=false,delay:f=0,strokeColor:w,strokeWidth:y,fillOpacity:z,waypoints:_,velocityScale:$=false,threshold:q=0,rootMargin:ke="0px",repeat:ce=0,repeatDelay:fe=0,morphTo:W,clip:ie,autoplay:Ce=false,duration:Ie=1e3,native:Ee=true,onProgress:Se,onStart:h,onComplete:E,onEnter:pe,onLeave:He,onEnterBack:de,onLeaveBack:Ve}=a,B=ie===true?"left":typeof ie=="string"?ie:false,j=typeof p=="function"?p:Z[p]??Z.linear,_e=Pe(T.start||"top bottom"),ge=Pe(T.end||"bottom top"),J=typeof v=="string"?document.querySelector(v):v??null,xe=Array.isArray(w)?w[0]:null,ae=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ye=Array.isArray(y)?y[0]:null,he=Array.isArray(y)?y[1]:typeof y=="number"?y:null,le=Array.isArray(z)?z[0]:null,De=Array.isArray(z)?z[1]:typeof z=="number"?z:null;function be(o){let i=o*100;switch(B){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let D=B?[]:Array.from(e.querySelectorAll(c)),k=[],ee=[],te=0,l=0,d=A,Te=0,L=false,C=false,x=0,I=false,ue=-1,me=[],Ke=-1,Q=false,we=0,Me=0,Oe,mt=null;function xt(){mt?.destroy(),mt=null;}let Re=new Set,Tt=NaN,Fe=true,Je=-1,Mt=performance.now(),ze=NaN;function je(){return J?R==="x"?J.scrollLeft:J.scrollTop:R==="x"?window.scrollX:window.scrollY}function At(){return J?R==="x"?J.clientWidth:J.clientHeight:R==="x"?window.innerWidth:window.innerHeight}function Lt(){let o=nt(e,J,R);return Ne(o,o.scroll,At(),_e,ge)}function tr(){let o=l-te,i=D.length-1,g=J??document.documentElement,F=R==="x"?"Width":"Height";if(d=A,A>0&&i>0&&o>0){let ne=g[`scroll${F}`]-g[`client${F}`]-1-te-o/m;ne>=0&&(d=Math.min(A,ne/(i*o)));}Te=l+i*d*o;}function Pt(){(({tStart:te,tEnd:l}=Lt())),tr(),se&&Ye&&(xt(),mt=hr(te,l,R));}function ft(o,i=Lt){$e(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let g=o.destroy;return o.destroy=()=>{g.call(o),ve(e);},o}function $t(o,i){return K&&!M?Math.max(ue,j(me[o]=Math.max(me[o]??0,i))):j(i)}function rr(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),B){let g=i==="reverse"?1-o:o;e.style.clipPath=be(g);return}D.forEach((g,F)=>pt(g,F,o,i));}function pt(o,i,g,F){o.style.strokeDashoffset=F==="reverse"?`${k[i]*g}`:`${k[i]*(1-g)}`,u&&(o.style.opacity=F==="reverse"?`${1-g}`:`${g}`),xe&&ae?o.style.stroke=ot(xe,ae,g):ae&&(o.style.stroke=ae),ye!==null&&he!==null?o.style.strokeWidth=`${ye+(he-ye)*g}`:he!==null&&(o.style.strokeWidth=`${he}`),le!==null&&De!==null?o.style.fillOpacity=`${le+(De-le)*g}`:De!==null&&(o.style.fillOpacity=`${De}`),W&&o.tagName.toLowerCase()==="path"&&ee[i]&&o.setAttribute("d",wr(ee[i],W,g));}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),B){e.style.clipPath=be(b==="reverse"?1:0);return}D.forEach((o,i)=>{o.style.strokeDasharray=`${k[i]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${k[i]}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ye!==null&&(o.style.strokeWidth=`${ye}`),le!==null&&(o.style.fillOpacity=`${le}`),W&&o.tagName.toLowerCase()==="path"&&ee[i]&&o.setAttribute("d",ee[i]);});}if(D.forEach(o=>{yr(o);let i=We(o);k.push(i);let g=o.tagName.toLowerCase()==="path";g?ee.push(o.getAttribute("d")??""):ee.push(""),W&&(g?br(ee[ee.length-1],W,o):G(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=b==="reverse"?`${i}`:"0",u&&(o.style.opacity="1"),ae&&(o.style.stroke=ae),he!==null&&(o.style.strokeWidth=`${he}`),De!==null&&(o.style.fillOpacity=`${De}`),W&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",W)):(o.style.strokeDasharray=`${i}`,o.style.strokeDashoffset=b==="reverse"?"0":`${i}`,u?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ye!==null&&(o.style.strokeWidth=`${ye}`),le!==null&&(o.style.fillOpacity=`${le}`));}),t)return B&&(e.style.clipPath=be(1)),E?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};B&&(e.style.clipPath=be(b==="reverse"?1:0));let kt=typeof p=="string"?st(p):null;function nr(){return !(Ee===false||Ce||se||!gr()||!D.length||!kt||B||R!=="y"||J||m!==1||A!==0||K||M||$!==false||W||_||ce||f>0||Se||h||E||pe||He||de||Ve||w!=null||y!=null||z!=null||(T.start||"top bottom").trim()!=="top bottom"||(T.end||"bottom top").trim()!=="bottom top")}function or(){let o=++dr,i=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,F=`--svg-scroll-draw-${o}`,ne=b==="reverse"?"0":"var(--ssd-len)",Ae=b==="reverse"?"var(--ssd-len)":"0",oe=`stroke-dashoffset:${ne};`,O=`stroke-dashoffset:${Ae};`;u&&(oe+=`opacity:${b==="reverse"?1:0};`,O+=`opacity:${b==="reverse"?0:1};`);let N=document.createElement("style");N.setAttribute("data-svg-scroll-draw",""),N.textContent=`@keyframes ${i}{from{${oe}}to{${O}}}.${g}{view-timeline-name:${F};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${kt};animation-fill-mode:both;animation-timeline:${F};animation-range:cover 0% cover 100%;}`,document.head.appendChild(N),e.classList.add(g);function U(S,P){S.style.setProperty("--ssd-len",String(k[P])),S.style.strokeDasharray=`${k[P]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(i);}D.forEach(U);let Y=false,H=-1;function V(){if(H>=0)return H;let S=e.getBoundingClientRect(),{tStart:P,tEnd:X}=Ne({top:S.top,height:S.height},je(),At(),_e,ge);return j(re(je(),P,X,m))}return {destroy(){e.classList.remove(g),D.forEach(S=>{S.classList.remove(i),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),N.remove();},replay(){Y=false,H=-1,D.forEach(U);},pause(){Y=true,D.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,D.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let P=Math.min(1,Math.max(0,S));H=P,Y=true,D.forEach((X,Le)=>{X.classList.remove(i),X.style.strokeDashoffset=b==="reverse"?`${k[Le]*P}`:`${k[Le]*(1-P)}`,u&&(X.style.opacity=b==="reverse"?`${1-P}`:`${P}`);});},getProgress(){return V()},refresh(){D.forEach((S,P)=>{k[P]=We(S),S.style.setProperty("--ssd-len",String(k[P])),S.style.strokeDasharray=`${k[P]}`;});}}}if(nr())return ft(or());function sr(){let o=Math.max(1,Ie),i=B?o:o*(1+Math.max(0,D.length-1)*A),g=0,F=0,ne=false;function Ae(H){let V=true,S=Math.min(1,Math.max(0,H/i));if(B){let P=Math.min(1,Math.max(0,H/o)),X=j(P);we=X,e.style.setProperty("--scroll-draw-progress",String(X)),e.style.clipPath=be(b==="reverse"?1-X:X),Se?.(X),P<1&&(V=false);}else {D.forEach((X,Le)=>{let ar=Le*A*o,Dt=Math.min(1,Math.max(0,(H-ar)/o));pt(X,Le,j(Dt),b),Dt<1&&(V=false);});let P=j(S);we=P,Se?.(P),e.style.setProperty("--scroll-draw-progress",String(P));}if(_){let P=j(S);for(let X in _){let Le=parseFloat(X);P>=Le&&!Re.has(Le)&&(Re.add(Le),_[X]?.());}}return V}function oe(H){if(Q)return;let V=H-g;C||(C=true,h?.());let S=Ae(V);if(S&&!L){L=true,Ae(i),E?.(),Me<(ce==="infinite"?1/0:ce??0)&&(Me++,Oe=setTimeout(()=>{g=performance.now(),C=false,L=false,Re.clear(),Qe(),x=requestAnimationFrame(oe);},fe));return}S||(x=requestAnimationFrame(oe));}function O(){cancelAnimationFrame(x),clearTimeout(Oe),g=performance.now(),F=0,Q=false,C=false,L=false,Me=0,ne=true,we=0,Re.clear(),Qe(),x=requestAnimationFrame(oe);}let N=new IntersectionObserver(H=>{H.forEach(V=>{V.isIntersecting&&!(K&&L)?O():!V.isIntersecting&&!K&&!L&&(cancelAnimationFrame(x),clearTimeout(Oe),ne=false);});},{root:J??null,threshold:q,rootMargin:ke}),U;function Y(){clearTimeout(U),U=setTimeout(()=>{D.forEach((H,V)=>{k[V]=We(H),H.style.strokeDasharray=`${k[V]}`;});},150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),f>0?setTimeout(()=>N.observe(e),f):N.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(Oe),N.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(U);},replay(){Me=0,O();},pause(){Q||!ne||(Q=true,F=performance.now()-g,cancelAnimationFrame(x));},resume(){Q&&(Q=false,ne=true,g=performance.now()-F,x=requestAnimationFrame(oe));},seek(H){let V=Math.min(1,Math.max(0,H));we=V,Q=true,F=V*i,g=performance.now()-F,cancelAnimationFrame(x),Ae(F);},getProgress(){return we},refresh(){clearTimeout(U),D.forEach((H,V)=>{k[V]=We(H),H.style.strokeDasharray=`${k[V]}`;});}}}if(Ce)return ft(sr());Pt();function Ct(){if(Q||!qe)return;let o=performance.now(),i=je();if(!Fe&&$===false&&i===Tt){gt(i);return}Fe=false,Tt=i;let g=m;if($!==false){let O=o-Mt,N=O>0?Math.abs(i-(Je<0?i:Je))/O:0;g=m*Math.max(.2,1+N*(typeof $=="number"?$:1)*.04);}Je=i,Mt=o;let F=M?Ke===-1||i>=Ke?"forward":"reverse":b;Ke=i;let ne=l-te,Ae=true,oe=ne===0?0:(i-te)/ne;if(isNaN(ze)||(ze<=0&&oe>0?pe?.():ze>0&&oe<=0&&Ve?.(),ze<1&&oe>=1?He?.():ze>=1&&oe<1&&de?.()),ze=oe,B){let O=$t(0,re(i,te,l,g));we=O,e.style.setProperty("--scroll-draw-progress",String(O));let N=F==="reverse"?1-O:O;e.style.clipPath=be(N),Se?.(O),!C&&re(i,te,l,g)>0&&(C=true,h?.()),O>=1&&!L?(L=true,E?.(),Me<(ce==="infinite"?1/0:ce??0)&&(Me++,Oe=setTimeout(()=>{ue=-1,me=[],C=false,L=false,Qe();},fe))):O<1&&!K&&(L=false),gt(i);return}if(D.forEach((O,N)=>{let U=N*d*ne,Y=$t(N,re(i,te+U,l+U,g));pt(O,N,Y,F),N===0&&(we=Y,Se?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(Ae=false);}),_){let O=j(re(i,te,l,g));for(let N in _){let U=parseFloat(N);O>=U&&!Re.has(U)&&(Re.add(U),_[N]?.());}}!C&&re(i,te,l,g)>0&&(C=true,h?.()),Ae&&!L?(L=true,E?.(),Me<(ce==="infinite"?1/0:ce??0)&&(Me++,Oe=setTimeout(()=>{ue=-1,me=[],C=false,L=false,Re.clear(),Qe(),Fe=true;},fe))):!Ae&&!K&&(L=false),gt(i);}function dt(o){return o>=l&&o<Te}function gt(o){I||dt(o)?x=requestAnimationFrame(Ct):qe=false;}function yt(){return I||dt(je())}let qe=false;function et(){qe||(qe=true,x=requestAnimationFrame(function(){Ct();}));}function tt(){qe=false,cancelAnimationFrame(x);}let ht=new IntersectionObserver(o=>{o.forEach(i=>{I=i.isIntersecting,I&&!Q?(Fe=true,et()):qe&&!Q&&dt(je())||tt();});},{root:J??null,threshold:q,rootMargin:ke});function It(){D.forEach((o,i)=>{k[i]=We(o),o.style.strokeDasharray=`${k[i]}`;}),Pt(),Fe=true;}let rt;function Ue(){clearTimeout(rt),rt=setTimeout(It,150);}window.addEventListener("resize",Ue),window.addEventListener("orientationchange",Ue);let ir=Be([e],Ue);return f>0?setTimeout(()=>ht.observe(e),f):ht.observe(e),ft({destroy(){cancelAnimationFrame(x),clearTimeout(Oe),tt(),ht.disconnect(),ir(),window.removeEventListener("resize",Ue),window.removeEventListener("orientationchange",Ue),clearTimeout(rt),xt();},replay(){ue=-1,me=[],Ke=-1,Je=-1,C=false,L=false,Me=0,Q=false,we=0,Re.clear(),clearTimeout(Oe),Qe(),Fe=true,yt()&&et();},pause(){Q=true,tt();},resume(){Q&&(Q=false,Fe=true,yt()&&et());},seek(o){let i=Math.min(1,Math.max(0,o));we=i,ue=i,me=[],Q=true,tt(),rr(i,b),Fe=true;},getProgress(){return we},refresh(){clearTimeout(rt),It(),yt()&&!Q&&et();}},()=>({tStart:te,tEnd:l}))}function Er(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Ut(n,r):(G("Container not found:",e),t)}function Sr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Yt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],a=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),a.push(u?u[2]:"");}r.push({fn:n[1],nums:s,units:a});}return r}function xr(e,r,t){let n=Yt(e),s=Yt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((a,c)=>{let m=s[c];return a.fn!==m.fn||a.nums.length!==m.nums.length?t<1?`${a.fn}(${a.nums.map((u,p)=>`${u}${a.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,p)=>`${u}${m.units[p]}`).join(", ")})`:`${a.fn}(${a.nums.map((u,p)=>`${u+(m.nums[p]-u)*t}${a.units[p]}`).join(", ")})`}).join(" ")}function Xt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Sr(n))return ot(n,s,t);if(n.includes("("))return xr(n,s,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(a&&c){let m=parseFloat(a[1]),u=parseFloat(c[1]);return `${m+(u-m)*t}${a[2]||c[2]}`}return t<1?n:s}function Tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ar=0,Zt="--scroll-draw-progress";function Lr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function wt(e,r){return typeof window>"u"?Jt:r.respectReducedMotion===false?Kt(e,r,false):Ge(r,(t,n)=>Kt(e,t,n))}function Kt(e,r,t){let{props:n,trigger:s={},easing:a="ease-out",speed:c=1,once:m=false,axis:u="y",scrollContainer:p,native:T=true,velocityScale:A=false,triggerElement:b,onProgress:K,onComplete:se,onEnter:R,onLeave:v,onEnterBack:M,onLeaveBack:f}=r,w=typeof a=="function"?a:Z[a]??Z["ease-out"],y=Pe(s.start||"top bottom"),z=Pe(s.end||"bottom top"),_=b??e,$=typeof p=="string"?document.querySelector(p):p??null,q=Object.entries(n).map(([l,d])=>({prop:Tr(l),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function ke(){let l=window.getComputedStyle(e);for(let d of q)d.from===""&&(d.from=l.getPropertyValue(d.prop).trim()||"0");}function ce(){for(let l of q)e.style.setProperty(l.prop,String(l.to));}let fe=new Map;for(let l of [...q.map(d=>d.prop),Zt])fe.set(l,e.style.getPropertyValue(l));function W(){for(let[l,d]of fe)d?e.style.setProperty(l,d):e.style.removeProperty(l);}if(t)return ce(),se?.(),{...Jt,destroy:W,getProgress:()=>1};ke();let ie=()=>$?u==="x"?$.scrollLeft:$.scrollTop:u==="x"?window.scrollX:window.scrollY,Ce=()=>$?u==="x"?$.clientWidth:$.clientHeight:u==="x"?window.innerWidth:window.innerHeight,Ie=typeof a=="string"?st(a):null;function Ee(){if(!T||!Lr()||!Ie||u!=="y"||$||_!==e||m||c!==1||K||se||R||v||M||f||A!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of q)if(!Mr.has(l.prop))return false;return true}function Se(){let l=`ssd-a-${++Ar}`,d=q.map(I=>`${I.prop}:${I.from}`).join(";"),Te=q.map(I=>`${I.prop}:${I.to}`).join(";"),L=document.createElement("style");L.setAttribute("data-ssd-animate",""),L.textContent=`@keyframes ${l}{from{${d}}to{${Te}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ie};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(L),e.classList.add(l);let C=()=>{let I=e.getBoundingClientRect();return Ne({top:I.top,height:I.height},ie(),Ce(),y,z)};$e(e,{type:"animate",getProgress:()=>x.getProgress(),getTrigger:C});let x={refresh(){},destroy(){e.classList.remove(l),L.remove(),e.style.animationPlayState="",W(),ve(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(I){let ue=Math.min(1,Math.max(0,I));e.classList.remove(l);for(let me of q)e.style.setProperty(me.prop,Xt(me.from,me.to,ue));},getProgress(){let{tStart:I,tEnd:ue}=C();return w(re(ie(),I,ue,c))}};return x}if(Ee())return Se();let h=0,E=0,pe=0,He=false,de=false,Ve=-1,B=0,j=0,_e=false,ge=NaN,J=-1,xe=0,ae=_===e?q:[],ye=false;function he(){let l=e.style,d=ae.map(x=>l.getPropertyValue(x.prop)),Te=l.transition;ae.length&&(l.transition="none"),ae.forEach(x=>l.setProperty(x.prop,fe.get(x.prop)??""));let L=nt(_,$,u);ae.forEach((x,I)=>l.setProperty(x.prop,d[I])),ae.length&&(e.offsetWidth,l.transition=Te);let C=Ne(L,L.scroll,Ce(),y,z);ye&&Math.abs(C.tStart-h)<1&&Math.abs(C.tEnd-E)<1||(ye=true,h=C.tStart,E=C.tEnd);}function le(l){e.style.setProperty(Zt,String(l));for(let d of q)e.style.setProperty(d.prop,Xt(d.from,d.to,l));K?.(l);}function De(l){if(isNaN(ge)){ge=l;return}ge<=0&&l>0?R?.():ge>0&&l<=0&&f?.(),ge<1&&l>=1?v?.():ge>=1&&l<1&&M?.(),ge=l;}function be(){if(!He||de)return;let l=performance.now(),d=ie(),Te=c;if(A!==false){let I=l-xe,ue=I>0?Math.abs(d-(J<0?d:J))/I:0;Te=c*Math.max(.2,1+ue*(typeof A=="number"?A:1)*.04);}J=d,xe=l;let L=E===h?0:(d-h)/(E-h);De(L);let C=re(d,h,E,Te),x=m?Math.max(Ve,w(B=Math.max(B,C))):w(C);j=x,le(x),x>=1&&!_e?(_e=true,se?.()):x<1&&!m&&(_e=false),pe=requestAnimationFrame(be);}he(),E===h&&G("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),B=re(ie(),h,E,c),j=w(B),le(j);let D=new IntersectionObserver(l=>{l.forEach(d=>{He=d.isIntersecting,He&&!de?pe=requestAnimationFrame(be):cancelAnimationFrame(pe);});},{root:$??null}),k;function ee(){clearTimeout(k),k=setTimeout(he,150);}window.addEventListener("resize",ee),window.addEventListener("orientationchange",ee);let te=Be([_],ee);return D.observe(e),$e(e,{type:"animate",getProgress:()=>j,getTrigger:()=>({tStart:h,tEnd:E})}),{destroy(){cancelAnimationFrame(pe),D.disconnect(),window.removeEventListener("resize",ee),window.removeEventListener("orientationchange",ee),te(),clearTimeout(k),W(),ve(e);},replay(){Ve=-1,B=0,_e=false,j=0,de=false,le(0);},pause(){de=true,cancelAnimationFrame(pe);},resume(){de&&(de=false,He&&(pe=requestAnimationFrame(be)));},seek(l){let d=Math.min(1,Math.max(0,l));j=d,Ve=d,B=0,de=true,cancelAnimationFrame(pe),le(d);},getProgress(){return j},refresh(){he();}}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Pr(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;return t?wt(t,r):(G("scrollAnimate: element not found:",e),ct)}function $r(e,r={}){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return G("scrollParallax: element not found:",e),ct;let{speed:n=.3,axis:s="y",easing:a="linear",trigger:c,onProgress:m}=r,u=-n*100,p=t.style,T=!!t.ownerSVGElement,A=p.getPropertyValue("transform-box");T&&p.setProperty("transform-box","fill-box");let b=wt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:m});return T?{...b,destroy(){b.destroy(),p.setProperty("transform-box",A);}}:b}var vt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return vt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(r,(n,s)=>Cr(t,n,s)):(G("scrollCounter: element not found:",e),vt)}function Cr(e,r,t){let{from:n=0,to:s,format:a,easing:c="ease-out",trigger:m={},once:u=true,decimals:p,onComplete:T}=r,A=p!==void 0?h=>h.toFixed(p):a??(h=>String(Math.round(h))),b=typeof c=="function"?c:Z[c]??Z["ease-out"],K=Pe(m.start||"top 80%"),se=Pe(m.end||"top 20%");if(t)return e.textContent=A(s),T?.(),{...vt,getProgress:()=>1};let R=0,v=0,M=false,f=0,w=false,y=false,z=-1,_=0,$=0,q=false,ke=()=>window.scrollY,ce=()=>window.innerHeight;function fe(){let h=e.getBoundingClientRect(),E=Ne({top:h.top,height:h.height},ke(),ce(),K,se);M&&Math.abs(E.tStart-R)<1&&Math.abs(E.tEnd-v)<1||(M=true,R=E.tStart,v=E.tEnd);}function W(h){e.textContent=A(n+(s-n)*h),e.style.setProperty("--scroll-draw-progress",String(h));}function ie(){if(!w||y)return;let h=re(ke(),R,v,1),E=u?Math.max(z,b(_=Math.max(_,h))):b(h);$=E,W(E),E>=1&&!q?(q=true,T?.()):E<1&&!u&&(q=false),f=requestAnimationFrame(ie);}fe();{_=re(ke(),R,v,1);let h=b(_);$=h,W(h);}let Ce=new IntersectionObserver(h=>{h.forEach(E=>{w=E.isIntersecting,w&&!y?f=requestAnimationFrame(ie):cancelAnimationFrame(f);});}),Ie;function Ee(){clearTimeout(Ie),Ie=setTimeout(fe,150);}window.addEventListener("resize",Ee),window.addEventListener("orientationchange",Ee);let Se=Be([e],Ee);return Ce.observe(e),$e(e,{type:"counter",getProgress:()=>$,getTrigger:()=>({tStart:R,tEnd:v})}),{destroy(){cancelAnimationFrame(f),Ce.disconnect(),window.removeEventListener("resize",Ee),window.removeEventListener("orientationchange",Ee),Se(),clearTimeout(Ie),ve(e);},replay(){z=-1,_=0,q=false,$=0,y=false,W(0);},pause(){y=true,cancelAnimationFrame(f);},resume(){y&&(y=false,w&&(f=requestAnimationFrame(ie)));},seek(h){let E=Math.min(1,Math.max(0,h));$=E,z=E,_=0,y=true,cancelAnimationFrame(f),W(E);},getProgress(){return $}}}var er="http://www.w3.org/2000/svg",Ir="cinematic-photo",Et=e=>e<0?0:e>1?1:e;function ut(e){let r=parseFloat(e);return Number.isFinite(r)?Et(r/100):0}function Dr(e){return Z[e]??Z.linear}var Or={destroy:()=>{},getProgress:()=>0},St=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||G("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Or;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let v of r.scenes){if(v.background){let f=document.createElement("img");f.id=Ir,f.src=v.background,f.alt="",f.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(f);}let M=v.animations.filter(f=>f.type==="draw");if(M.length){let f=document.createElementNS(er,"svg");f.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),f.setAttribute("preserveAspectRatio","xMidYMid meet"),f.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(f);for(let w of M){let y=document.createElementNS(er,"path");y.id=w.target.replace(/^#/,""),y.setAttribute("d",w.d),y.setAttribute("fill","none"),y.setAttribute("stroke",w.stroke),y.setAttribute("stroke-width",String(w.strokeWidth)),y.setAttribute("stroke-linecap","round"),y.setAttribute("stroke-linejoin","round");let z=w.length||y.getTotalLength?.()||0;y.style.strokeDasharray=String(z),y.style.strokeDashoffset=String(z),f.appendChild(y),s.push({kind:"draw",el:y,start:ut(w.start),end:ut(w.end),ease:Dr(w.easing),length:z});}}for(let f of v.animations){if(f.type!=="fade")continue;let w=n.querySelector(f.target)??document.querySelector(f.target);w&&(w.style.opacity=String(f.from),s.push({kind:"fade",el:w,start:ut(f.start),end:ut(f.end),ease:Z["ease-in-out"]??Z.linear,from:f.from,to:f.to}));}}let a=0,c=()=>{let v=t.offsetHeight-window.innerHeight;return v<=0?t.getBoundingClientRect().top<=0?1:0:Et(-t.getBoundingClientRect().top/v)},m=v=>{for(let M of s){let f=M.end-M.start,w=f<=0?v>=M.end?1:0:Et((v-M.start)/f),y=M.ease(w);M.kind==="draw"?M.el.style.strokeDashoffset=String(M.length*(1-y)):M.el.style.opacity=String(M.from+(M.to-M.from)*y);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,p=false,T=false,A=()=>{a=c(),m(a),p&&(u=requestAnimationFrame(A));},b=()=>{p||(p=true,u=requestAnimationFrame(A));},K=()=>{p=false,cancelAnimationFrame(u);},se=new IntersectionObserver(v=>{for(let M of v)T=M.isIntersecting,T?b():K();},{threshold:0});se.observe(n),a=c(),m(a),$e(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let v=t.getBoundingClientRect().top+window.scrollY;return {tStart:v,tEnd:v+Math.max(0,t.offsetHeight-window.innerHeight)}}});let R=lt(v=>{v&&(R(),K(),se.disconnect(),ve(t),a=1,m(1));});return {destroy(){R(),K(),se.disconnect(),ve(t);},getProgress:()=>a}}};
|
|
4
|
-
exports.Cinematic=
|
|
1
|
+
'use strict';function cr({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Rt({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(n),a=0,c=[];for(let d=0;d<t;d++){let x=Math.pow(s,d);c.push(x),a+=x;}let f=[0],m=0;for(let d=0;d<t;d++)m+=c[d]/a,f.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let x=0;x<t;x++)if(d<=f[x+1]){let A=(d-f[x])/(f[x+1]-f[x]);if(x===0)return A*(2-A);let b=1-Math.pow(n,x);return b+(1-b)*(2*A-1)*(2*A-1)}return 1}}function Nt({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),s=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return a=>a<=0?0:a>=1?1:t*Math.pow(2,-10*a)*Math.sin((a-s)*(2*Math.PI)/n)+1}var K={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:Rt(),elastic:Nt()};function Ft(e,r,t){return Math.min(t,Math.max(r,e))}function Pe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return {element:t,viewport:n}}function Ht(e,r,t,n){switch(n){case "top":return e+t;case "center":return e+t+r/2;case "bottom":return e+t+r;default:return e+t}}function _t(e,r){if(/^\d+(\.\d+)?%$/.test(e))return r*(parseFloat(e)/100);switch(e){case "top":return 0;case "center":return r/2;case "bottom":return r;default:return r}}function ne(e,r,t,n){return t===r?0:Ft((e-r)/(t-r)*n,0,1)}function Re(e,r,t,n,s){let a=Ht(e.top,e.height,r,n.element)-_t(n.viewport,t),c=Ht(e.top,e.height,r,s.element)-_t(s.viewport,t);return {tStart:a,tEnd:c}}function nt(e,r,t){let n=e.getBoundingClientRect(),s=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:s,scroll:0}:{top:t==="x"?n.left:n.top,height:s,scroll:t==="x"?window.scrollX:window.scrollY}}function ot(e){let r=parseFloat(e.getAttribute("pathLength")??"");if(r>0)return r;let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),s=parseFloat(e.getAttribute("height")??"0");return 2*(n+s)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Vt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return [parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return [parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function st(e,r,t){let n=Vt(e),s=Vt(r);return !n||!s?e:`rgb(${Math.round(n[0]+(s[0]-n[0])*t)},${Math.round(n[1]+(s[1]-n[1])*t)},${Math.round(n[2]+(s[2]-n[2])*t)})`}var wt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var We=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function G(e,...r){We&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var ur="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",mr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",zt=33;function fr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function pr(e){let r=[];for(let t=0;t<zt;t++){let n=t/(zt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function it(e){switch(e){case "linear":return "linear";case "ease-in":return ur;case "ease-out":return mr;case "ease-in-out":return fr()?pr(K["ease-in-out"]):null;default:return null}}var qt=Symbol.for("svg-scroll-draw.registry");function Wt(){let e=globalThis;return e[qt]||(e[qt]=new Map)}function $e(e,r){Wt().set(e,r);}function Ee(e){Wt().delete(e);}var Xe,at=new Set,lt=new WeakMap,Ze=new Map,Gt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function dr(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Ge(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();Xe??(Xe=new ResizeObserver(s=>{let a=false;for(let{target:c}of s)lt.get(c)!==Gt(c)&&(a=true),lt.set(c,"");a&&at.forEach(c=>c());})),at.add(t);let n=dr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{lt.has(s)||lt.set(s,Gt(s)),Ze.set(s,(Ze.get(s)??0)+1),Xe.observe(s);}),()=>{at.delete(t)&&(n.forEach(s=>{let a=(Ze.get(s)??1)-1;if(a)return void Ze.set(s,a);Ze.delete(s),Xe?.unobserve(s);}),at.size||(Xe?.disconnect(),Xe=void 0));}}function ct(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function Be(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=ct(a=>{if(!a)return;n();let c=(t.getProgress?.()??0)>=1;t.destroy(),t=r(c?{...e,onComplete:void 0}:e,true);}),s={};for(let a of Object.keys(t))s[a]=(...c)=>t[a]?.(...c);return s.destroy=()=>{n(),t.destroy();},s}var gr=0;function yr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Bt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function hr(e){if(!We)return;let r=Bt(e,"stroke");if(!r||r==="none"){G("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!jt.has(t)&&!jt.has(Bt(e,"fill"))&&G("Element has a fill \u2014 it may obscure the stroke animation.",e);}function br(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let a=t==="x"?window.scrollX:window.scrollY,c=e-a,f=r-a,m=t==="x";n.innerHTML=`
|
|
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:${f}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${f}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function wr(e,r,t){if(!We)return;let n=(e.match(Ut)??[]).join("").toUpperCase(),s=(r.match(Ut)??[]).join("").toUpperCase(),a=(e.match(Qt)??[]).length,c=(r.match(Qt)??[]).length;if(n!==s){G(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${s||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}a!==c&&G(`morphTo: coordinate count differs (${a} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function vr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,a=>{let c=parseFloat(a),f=n[s++]??c;return String(+(c+(f-c)*t).toFixed(4))})}function Yt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Be(r,(t,n)=>Er(e,t,n))}function Er(e,r,t){let{preset:n,...s}=r,a=n?{...wt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:f=1,fade:m=false,easing:d="linear",trigger:x={},stagger:A=0,direction:b="forward",once:J=false,debug:fe=false,axis:I="y",scrollContainer:v,autoReverse:T=false,delay:p=0,strokeColor:w,strokeWidth:h,fillOpacity:F,waypoints:O,velocityScale:C=false,threshold:V=0,rootMargin:Ce="0px",repeat:ge=0,repeatDelay:he=0,morphTo:B,clip:oe,autoplay:Se=false,duration:Ne=1e3,native:Fe=true,onProgress:le,onStart:z,onComplete:H,onEnter:E,onLeave:L,onEnterBack:be,onLeaveBack:Ve}=a,q=oe===true?"left":typeof oe=="string"?oe:false,j=typeof d=="function"?d:K[d]??K.linear,He=Pe(x.start||"top bottom"),we=Pe(x.end||"bottom top"),ee=typeof v=="string"?document.querySelector(v):v??null,xe=Array.isArray(w)?w[0]:null,pe=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ve=Array.isArray(h)?h[0]:null,Te=Array.isArray(h)?h[1]:typeof h=="number"?h:null,de=Array.isArray(F)?F[0]:null,ke=Array.isArray(F)?F[1]:typeof F=="number"?F:null;function Me(o){let i=o*100;switch(q){case "right":return `inset(0 0 0 ${100-i}%)`;case "top":return `inset(0 0 ${100-i}% 0)`;case "bottom":return `inset(${100-i}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-i}% 0 0)`}}let P=q?[]:Array.from(e.querySelectorAll(c)),se=[],ce=[],Q=0,_=0,_e=A,Ke=0,R=false,l=false,u=0,ye=false,te=-1,W=[],N=-1,y=false,U=0,ie=0,Ie,ft=null;function Tt(){ft?.destroy(),ft=null;}let De=new Set,Mt=NaN,Oe=true,Je=-1,At=performance.now(),ze=NaN;function je(){return ee?I==="x"?ee.scrollLeft:ee.scrollTop:I==="x"?window.scrollX:window.scrollY}function Lt(){return ee?I==="x"?ee.clientWidth:ee.clientHeight:I==="x"?window.innerWidth:window.innerHeight}function Pt(){let o=nt(e,ee,I);return Re(o,o.scroll,Lt(),He,we)}function rr(){let o=_-Q,i=P.length-1,g=ee??document.documentElement,M=I==="x"?"Width":"Height";if(_e=A,A>0&&i>0&&o>0){let re=g[`scroll${M}`]-g[`client${M}`]-1-Q-o/f;re>=0&&(_e=Math.min(A,re/(i*o)));}Ke=_+i*_e*o;}function $t(){(({tStart:Q,tEnd:_}=Pt())),rr(),fe&&We&&(Tt(),ft=br(Q,_,I));}function pt(o,i=Pt){$e(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:i});let g=o.destroy;return o.destroy=()=>{g.call(o),Ee(e);},o}function Ct(o,i){return J&&!T?Math.max(te,j(W[o]=Math.max(W[o]??0,i))):j(i)}function nr(o,i){if(e.style.setProperty("--scroll-draw-progress",String(o)),q){let g=i==="reverse"?1-o:o;e.style.clipPath=Me(g);return}P.forEach((g,M)=>dt(g,M,o,i));}function dt(o,i,g,M){o.style.strokeDashoffset=M==="reverse"?`${se[i]*g}`:`${se[i]*(1-g)}`,m&&(o.style.opacity=M==="reverse"?`${1-g}`:`${g}`),xe&&pe?o.style.stroke=st(xe,pe,g):pe&&(o.style.stroke=pe),ve!==null&&Te!==null?o.style.strokeWidth=`${ve+(Te-ve)*g}`:Te!==null&&(o.style.strokeWidth=`${Te}`),de!==null&&ke!==null?o.style.fillOpacity=`${de+(ke-de)*g}`:ke!==null&&(o.style.fillOpacity=`${ke}`),B&&o.tagName.toLowerCase()==="path"&&ce[i]&&o.setAttribute("d",vr(ce[i],B,g));}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),q){e.style.clipPath=Me(b==="reverse"?1:0);return}P.forEach((o,i)=>{o.style.strokeDasharray=`${se[i]}`,o.style.strokeDashoffset=b==="reverse"?"0":`${se[i]}`,m?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ve!==null&&(o.style.strokeWidth=`${ve}`),de!==null&&(o.style.fillOpacity=`${de}`),B&&o.tagName.toLowerCase()==="path"&&ce[i]&&o.setAttribute("d",ce[i]);});}function Ue(o,i){let g=o.getAttribute("d"),M=ot(o);if(B&&ce[i]){o.setAttribute("d",B);let re=ot(o);o.setAttribute("d",ce[i]),M=Math.max(ot(o),re),o.setAttribute("d",g);}se[i]=M,o.style.strokeDasharray=`${M}`;}if(P.forEach((o,i)=>{hr(o);let g=o.tagName.toLowerCase()==="path";g?ce.push(o.getAttribute("d")??""):ce.push(""),Ue(o,i);let M=se[i];B&&(g?wr(ce[ce.length-1],B,o):G(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=b==="reverse"?`${M}`:"0",m&&(o.style.opacity="1"),pe&&(o.style.stroke=pe),Te!==null&&(o.style.strokeWidth=`${Te}`),ke!==null&&(o.style.fillOpacity=`${ke}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=b==="reverse"?"0":`${M}`,m?o.style.opacity=b==="reverse"?"1":"0":o.style.opacity="",xe&&(o.style.stroke=xe),ve!==null&&(o.style.strokeWidth=`${ve}`),de!==null&&(o.style.fillOpacity=`${de}`));}),t)return q&&(e.style.clipPath=Me(1)),H?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};q&&(e.style.clipPath=Me(b==="reverse"?1:0));let kt=typeof d=="string"?it(d):null;function or(){return !(Fe===false||Se||fe&&We||!yr()||!P.length||!kt||q||I!=="y"||ee||f!==1||A!==0||J||T||C!==false||B||O||ge||p>0||le||z||H||E||L||be||Ve||w!=null||h!=null||F!=null||(x.start||"top bottom").trim()!=="top bottom"||(x.end||"bottom top").trim()!=="bottom top")}function sr(){let o=++gr,i=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,M=`--svg-scroll-draw-${o}`,re=b==="reverse"?"0":"var(--ssd-len)",Ae=b==="reverse"?"var(--ssd-len)":"0",ue=`stroke-dashoffset:${re};`,k=`stroke-dashoffset:${Ae};`;m&&(ue+=`opacity:${b==="reverse"?1:0};`,k+=`opacity:${b==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${i}{from{${ue}}to{${k}}}.${g}{view-timeline-name:${M};view-timeline-axis:block;}.${i}{animation-name:${i};animation-duration:auto;animation-timing-function:${kt};animation-fill-mode:both;animation-timeline:${M};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function Y(S,$){S.style.setProperty("--ssd-len",String(se[$])),S.style.strokeDasharray=`${se[$]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(i);}P.forEach(Y);let X=false,ae=-1;function me(){if(ae>=0)return ae;let S=e.getBoundingClientRect(),{tStart:$,tEnd:Z}=Re({top:S.top,height:S.height},je(),Lt(),He,we);return j(ne(je(),$,Z,f))}return {destroy(){e.classList.remove(g),P.forEach(S=>{S.classList.remove(i),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){X=false,ae=-1,P.forEach(Y);},pause(){X=true,P.forEach(S=>{S.style.animationPlayState="paused";});},resume(){X&&(X=false,P.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let $=Math.min(1,Math.max(0,S));ae=$,X=true,P.forEach((Z,Le)=>{Z.classList.remove(i),Z.style.strokeDashoffset=b==="reverse"?`${se[Le]*$}`:`${se[Le]*(1-$)}`,m&&(Z.style.opacity=b==="reverse"?`${1-$}`:`${$}`);});},getProgress(){return me()},refresh(){P.forEach((S,$)=>{Ue(S,$),S.style.setProperty("--ssd-len",String(se[$]));});}}}if(or())return pt(sr());function ir(){let o=Math.max(1,Ne),i=q?o:o*(1+Math.max(0,P.length-1)*A),g=0,M=0,re=false;function Ae(ae){let me=true,S=Math.min(1,Math.max(0,ae/i));if(q){let $=Math.min(1,Math.max(0,ae/o)),Z=j($);U=Z,e.style.setProperty("--scroll-draw-progress",String(Z)),e.style.clipPath=Me(b==="reverse"?1-Z:Z),le?.(Z),$<1&&(me=false);}else {P.forEach((Z,Le)=>{let lr=Le*A*o,Ot=Math.min(1,Math.max(0,(ae-lr)/o));dt(Z,Le,j(Ot),b),Ot<1&&(me=false);});let $=j(S);U=$,le?.($),e.style.setProperty("--scroll-draw-progress",String($));}if(O){let $=j(S);for(let Z in O){let Le=parseFloat(Z);$>=Le&&!De.has(Le)&&(De.add(Le),O[Z]?.());}}return me}function ue(ae){if(y)return;let me=ae-g;l||(l=true,z?.());let S=Ae(me);if(S&&!R){R=true,Ae(i),H?.(),ie<(ge==="infinite"?1/0:ge??0)&&(ie++,Ie=setTimeout(()=>{g=performance.now(),l=false,R=false,De.clear(),Qe(),u=requestAnimationFrame(ue);},he));return}S||(u=requestAnimationFrame(ue));}function k(){cancelAnimationFrame(u),clearTimeout(Ie),g=performance.now(),M=0,y=false,l=false,R=false,ie=0,re=true,U=0,De.clear(),Qe(),u=requestAnimationFrame(ue);}let D=new IntersectionObserver(ae=>{ae.forEach(me=>{me.isIntersecting&&!(J&&R)?k():!me.isIntersecting&&!J&&!R&&(cancelAnimationFrame(u),clearTimeout(Ie),re=false);});},{root:ee??null,threshold:V,rootMargin:Ce}),Y;function X(){clearTimeout(Y),Y=setTimeout(()=>P.forEach(Ue),150);}return window.addEventListener("resize",X),window.addEventListener("orientationchange",X),p>0?setTimeout(()=>D.observe(e),p):D.observe(e),{destroy(){cancelAnimationFrame(u),clearTimeout(Ie),D.disconnect(),window.removeEventListener("resize",X),window.removeEventListener("orientationchange",X),clearTimeout(Y);},replay(){ie=0,k();},pause(){y||!re||(y=true,M=performance.now()-g,cancelAnimationFrame(u));},resume(){y&&(y=false,re=true,g=performance.now()-M,u=requestAnimationFrame(ue));},seek(ae){let me=Math.min(1,Math.max(0,ae));U=me,y=true,M=me*i,g=performance.now()-M,cancelAnimationFrame(u),Ae(M);},getProgress(){return U},refresh(){clearTimeout(Y),P.forEach(Ue);}}}if(Se)return pt(ir());$t();function It(){if(y||!qe)return;let o=performance.now(),i=je();if(!Oe&&C===false&&i===Mt){yt(i);return}Oe=false,Mt=i;let g=f;if(C!==false){let k=o-At,D=k>0?Math.abs(i-(Je<0?i:Je))/k:0;g=f*Math.max(.2,1+D*(typeof C=="number"?C:1)*.04);}Je=i,At=o;let M=T?N===-1||i>=N?"forward":"reverse":b;N=i;let re=_-Q,Ae=true,ue=re===0?0:(i-Q)/re;if(isNaN(ze)||(ze<=0&&ue>0?E?.():ze>0&&ue<=0&&Ve?.(),ze<1&&ue>=1?L?.():ze>=1&&ue<1&&be?.()),ze=ue,q){let k=Ct(0,ne(i,Q,_,g));U=k,e.style.setProperty("--scroll-draw-progress",String(k));let D=M==="reverse"?1-k:k;e.style.clipPath=Me(D),le?.(k),!l&&ne(i,Q,_,g)>0&&(l=true,z?.()),k>=1&&!R?(R=true,H?.(),ie<(ge==="infinite"?1/0:ge??0)&&(ie++,Ie=setTimeout(()=>{te=-1,W=[],l=false,R=false,Qe();},he))):k<1&&!J&&(R=false),yt(i);return}if(P.forEach((k,D)=>{let Y=D*_e*re,X=Ct(D,ne(i,Q+Y,_+Y,g));dt(k,D,X,M),D===0&&(U=X,le?.(X),e.style.setProperty("--scroll-draw-progress",String(X))),X<1&&(Ae=false);}),O){let k=j(ne(i,Q,_,g));for(let D in O){let Y=parseFloat(D);k>=Y&&!De.has(Y)&&(De.add(Y),O[D]?.());}}!l&&ne(i,Q,_,g)>0&&(l=true,z?.()),Ae&&!R?(R=true,H?.(),ie<(ge==="infinite"?1/0:ge??0)&&(ie++,Ie=setTimeout(()=>{te=-1,W=[],l=false,R=false,De.clear(),Qe(),Oe=true;},he))):!Ae&&!J&&(R=false),yt(i);}function gt(o){return o>=_&&o<Ke}function yt(o){ye||gt(o)?u=requestAnimationFrame(It):qe=false;}function ht(){return ye||gt(je())}let qe=false;function et(){qe||(qe=true,u=requestAnimationFrame(function(){It();}));}function tt(){qe=false,cancelAnimationFrame(u);}let bt=new IntersectionObserver(o=>{o.forEach(i=>{ye=i.isIntersecting,ye&&!y?(Oe=true,et()):qe&&!y&>(je())||tt();});},{root:ee??null,threshold:V,rootMargin:Ce});function Dt(){P.forEach(Ue),$t(),Oe=true;}let rt;function Ye(){clearTimeout(rt),rt=setTimeout(Dt,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let ar=Ge([e],Ye);return p>0?setTimeout(()=>bt.observe(e),p):bt.observe(e),pt({destroy(){cancelAnimationFrame(u),clearTimeout(Ie),tt(),bt.disconnect(),ar(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(rt),Tt();},replay(){te=-1,W=[],N=-1,Je=-1,l=false,R=false,ie=0,y=false,U=0,De.clear(),clearTimeout(Ie),Qe(),Oe=true,ht()&&et();},pause(){y=true,tt();},resume(){y&&(y=false,Oe=true,ht()&&et());},seek(o){let i=Math.min(1,Math.max(0,o));U=i,te=i,W=[],y=true,tt(),nr(i,b),Oe=true;},getProgress(){return U},refresh(){clearTimeout(rt),Dt(),ht()&&!y&&et();}},()=>({tStart:Q,tEnd:_}))}function Sr(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Yt(n,r):(G("Container not found:",e),t)}function xr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],a=[],c=n[2].trim();if(c)for(let f of c.split(/[\s,]+/)){let m=f.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),a.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:a});}return r}function Tr(e,r,t){let n=Xt(e),s=Xt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((a,c)=>{let f=s[c];return a.fn!==f.fn||a.nums.length!==f.nums.length?t<1?`${a.fn}(${a.nums.map((m,d)=>`${m}${a.units[d]}`).join(", ")})`:`${f.fn}(${f.nums.map((m,d)=>`${m}${f.units[d]}`).join(", ")})`:`${a.fn}(${a.nums.map((m,d)=>`${m+(f.nums[d]-m)*t}${a.units[d]}`).join(", ")})`}).join(" ")}function Zt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(xr(n))return st(n,s,t);if(n.includes("("))return Tr(n,s,t);let a=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(a&&c){let f=parseFloat(a[1]),m=parseFloat(c[1]);return `${f+(m-f)*t}${a[2]||c[2]}`}return t<1?n:s}function Mr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Ar=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Lr=0,Kt="--scroll-draw-progress";function Pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var er={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vt(e,r){return typeof window>"u"?er:r.respectReducedMotion===false?Jt(e,r,false):Be(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:s={},easing:a="ease-out",speed:c=1,once:f=false,axis:m="y",scrollContainer:d,native:x=true,velocityScale:A=false,triggerElement:b,onProgress:J,onComplete:fe,onEnter:I,onLeave:v,onEnterBack:T,onLeaveBack:p}=r,w=typeof a=="function"?a:K[a]??K["ease-out"],h=Pe(s.start||"top bottom"),F=Pe(s.end||"bottom top"),O=b??e,C=typeof d=="string"?document.querySelector(d):d??null,V=Object.entries(n).map(([l,u])=>({prop:Mr(l),from:Array.isArray(u)?u[0]:"",to:Array.isArray(u)?u[1]:u}));function Ce(){let l=window.getComputedStyle(e);for(let u of V)u.from===""&&(u.from=l.getPropertyValue(u.prop).trim()||"0");}function ge(){for(let l of V)e.style.setProperty(l.prop,String(l.to));}let he=new Map;for(let l of [...V.map(u=>u.prop),Kt])he.set(l,e.style.getPropertyValue(l));function B(){for(let[l,u]of he)u?e.style.setProperty(l,u):e.style.removeProperty(l);}if(t)return ge(),fe?.(),{...er,destroy:B,getProgress:()=>1};Ce();let oe=()=>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,Ne=typeof a=="string"?it(a):null;function Fe(){if(!x||!Pr()||!Ne||m!=="y"||C||O!==e||f||c!==1||J||fe||I||v||T||p||A!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of V)if(!Ar.has(l.prop))return false;return true}function le(){let l=`ssd-a-${++Lr}`,u=V.map(y=>`${y.prop}:${y.from}`).join(";"),ye=V.map(y=>`${y.prop}:${y.to}`).join(";"),te=document.createElement("style");te.setAttribute("data-ssd-animate",""),te.textContent=`@keyframes ${l}{from{${u}}to{${ye}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ne};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(te),e.classList.add(l);let W=()=>{let y=e.getBoundingClientRect();return Re({top:y.top,height:y.height},oe(),Se(),h,F)};$e(e,{type:"animate",getProgress:()=>N.getProgress(),getTrigger:W});let N={refresh(){},destroy(){e.classList.remove(l),te.remove(),e.style.animationPlayState="",B(),Ee(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(y){let U=Math.min(1,Math.max(0,y));e.classList.remove(l);for(let ie of V)e.style.setProperty(ie.prop,Zt(ie.from,ie.to,U));},getProgress(){let{tStart:y,tEnd:U}=W();return w(ne(oe(),y,U,c))}};return N}if(Fe())return le();let z=0,H=0,E=0,L=NaN,be=false,Ve=-1,q=0,j=0,He=false,we=NaN,ee=-1,xe=0,pe=O===e?V:[],ve=false;function Te(){let l=e.style,u=pe.map(N=>l.getPropertyValue(N.prop)),ye=l.transition;pe.length&&(l.transition="none"),pe.forEach(N=>l.setProperty(N.prop,he.get(N.prop)??""));let te=nt(O,C,m);pe.forEach((N,y)=>l.setProperty(N.prop,u[y])),pe.length&&(e.offsetWidth,l.transition=ye);let W=Re(te,te.scroll,Se(),h,F);ve&&Math.abs(W.tStart-z)<1&&Math.abs(W.tEnd-H)<1||(ve=true,z=W.tStart,H=W.tEnd);}function de(l){e.style.setProperty(Kt,String(l));for(let u of V)e.style.setProperty(u.prop,Zt(u.from,u.to,l));J?.(l);}function ke(l){if(isNaN(we)){we=l;return}we<=0&&l>0?I?.():we>0&&l<=0&&p?.(),we<1&&l>=1?v?.():we>=1&&l<1&&T?.(),we=l;}let Me=l=>ne(l,z,H,Math.min(c,1));function P(){!E&&!be&&Me(oe())!==L&&(E=requestAnimationFrame(se));}function se(){if(be)return;let l=performance.now(),u=oe(),ye=c;if(A!==false){let y=l-xe,U=y>0?Math.abs(u-(ee<0?u:ee))/y:0;ye=c*Math.max(.2,1+U*(typeof A=="number"?A:1)*.04);}ee=u,xe=l;let te=H===z?0:(u-z)/(H-z);ke(te);let W=ne(u,z,H,ye),N=f?Math.max(Ve,w(q=Math.max(q,W))):w(W);j=N,de(N),N>=1&&!He?(He=true,fe?.()):N<1&&!f&&(He=false),!be&&(L=Me(u),E=L>0&&L<1?requestAnimationFrame(se):0);}Te(),H===z&&G("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),q=ne(oe(),z,H,c),j=w(q),de(j);function ce(){Te(),P();}let Q;function _(){clearTimeout(Q),Q=setTimeout(ce,150);}let _e=C??window;_e.addEventListener("scroll",P,{passive:true}),window.addEventListener("resize",_),window.addEventListener("orientationchange",_);let Ke=Ge([O],_);P(),$e(e,{type:"animate",getProgress:()=>j,getTrigger:()=>({tStart:z,tEnd:H})});function R(){be=true,cancelAnimationFrame(E),E=0,L=NaN;}return {destroy(){R(),_e.removeEventListener("scroll",P),window.removeEventListener("resize",_),window.removeEventListener("orientationchange",_),Ke(),clearTimeout(Q),B(),Ee(e);},replay(){Ve=-1,q=0,He=false,j=0,be=false,de(0),L=0,P();},pause:R,resume(){be&&(be=false,P());},seek(l){let u=Math.min(1,Math.max(0,l));j=u,Ve=u,q=0,R(),de(u);},getProgress(){return j},refresh:ce}}var ut={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function $r(e,r){if(typeof window>"u")return ut;let t=typeof e=="string"?document.querySelector(e):e;return t?vt(t,r):(G("scrollAnimate: element not found:",e),ut)}function Cr(e,r={}){if(typeof window>"u")return ut;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return G("scrollParallax: element not found:",e),ut;let{speed:n=.3,axis:s="y",easing:a="linear",trigger:c,onProgress:f}=r,m=-n*100,d=t.style,x=!!t.ownerSVGElement,A=d.getPropertyValue("transform-box");x&&d.setProperty("transform-box","fill-box");let b=vt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:a,native:false,onProgress:f});return x?{...b,destroy(){b.destroy(),d.setProperty("transform-box",A);}}:b}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return Et;let t=typeof e=="string"?document.querySelector(e):e;return t?Be(r,(n,s)=>Ir(t,n,s)):(G("scrollCounter: element not found:",e),Et)}function Ir(e,r,t){let{from:n=0,to:s,format:a,easing:c="ease-out",trigger:f={},once:m=true,decimals:d,onComplete:x}=r,A=d!==void 0?E=>E.toFixed(d):a??(E=>String(Math.round(E))),b=typeof c=="function"?c:K[c]??K["ease-out"],J=Pe(f.start||"top 80%"),fe=Pe(f.end||"top 20%");if(t)return e.textContent=A(s),x?.(),{...Et,getProgress:()=>1};let I=0,v=0,T=false,p=0,w=false,h=false,F=-1,O=0,C=0,V=false,Ce=()=>window.scrollY,ge=()=>window.innerHeight;function he(){let E=e.getBoundingClientRect(),L=Re({top:E.top,height:E.height},Ce(),ge(),J,fe);T&&Math.abs(L.tStart-I)<1&&Math.abs(L.tEnd-v)<1||(T=true,I=L.tStart,v=L.tEnd);}let B=e.style.getPropertyValue("--scroll-draw-progress");function oe(E){e.textContent=A(n+(s-n)*E),e.style.setProperty("--scroll-draw-progress",String(E));}function Se(){if(!w||h)return;let E=ne(Ce(),I,v,1),L=m?Math.max(F,b(O=Math.max(O,E))):b(E);C=L,oe(L),L>=1&&!V?(V=true,x?.()):L<1&&!m&&(V=false),p=requestAnimationFrame(Se);}he();{O=ne(Ce(),I,v,1);let E=b(O);C=E,oe(E);}let Ne=new IntersectionObserver(E=>{E.forEach(L=>{w=L.isIntersecting,w&&!h?p=requestAnimationFrame(Se):cancelAnimationFrame(p);});}),Fe;function le(){clearTimeout(Fe),Fe=setTimeout(he,150);}window.addEventListener("resize",le),window.addEventListener("orientationchange",le);let z=Ge([e],le);Ne.observe(e),$e(e,{type:"counter",getProgress:()=>C,getTrigger:()=>({tStart:I,tEnd:v})});function H(){h&&(h=false,w&&(p=requestAnimationFrame(Se)));}return {destroy(){cancelAnimationFrame(p),Ne.disconnect(),window.removeEventListener("resize",le),window.removeEventListener("orientationchange",le),z(),clearTimeout(Fe),e.style.setProperty("--scroll-draw-progress",B),Ee(e);},replay(){F=-1,O=0,V=false,C=0,oe(0),H();},pause(){h=true,cancelAnimationFrame(p);},resume:H,seek(E){let L=Math.min(1,Math.max(0,E));C=L,F=L,O=0,h=true,cancelAnimationFrame(p),oe(L);},getProgress(){return C}}}var tr="http://www.w3.org/2000/svg",Dr="cinematic-photo",St=e=>e<0?0:e>1?1:e;function mt(e){let r=parseFloat(e);return Number.isFinite(r)?St(r/100):0}function Or(e){return K[e]??K.linear}var Rr={destroy:()=>{},getProgress:()=>0},xt=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||G("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Rr;t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let s=[];for(let v of r.scenes){if(v.background){let p=document.createElement("img");p.id=Dr,p.src=v.background,p.alt="",p.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(p);}let T=v.animations.filter(p=>p.type==="draw");if(T.length){let p=document.createElementNS(tr,"svg");p.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),p.setAttribute("preserveAspectRatio","xMidYMid meet"),p.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(p);for(let w of T){let h=document.createElementNS(tr,"path");h.id=w.target.replace(/^#/,""),h.setAttribute("d",w.d),h.setAttribute("fill","none"),h.setAttribute("stroke",w.stroke),h.setAttribute("stroke-width",String(w.strokeWidth)),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round");let F=w.length||h.getTotalLength?.()||0;h.style.strokeDasharray=String(F),h.style.strokeDashoffset=String(F),p.appendChild(h),s.push({kind:"draw",el:h,start:mt(w.start),end:mt(w.end),ease:Or(w.easing),length:F});}}for(let p of v.animations){if(p.type!=="fade")continue;let w=n.querySelector(p.target)??document.querySelector(p.target);w&&(w.style.opacity=String(p.from),s.push({kind:"fade",el:w,start:mt(p.start),end:mt(p.end),ease:K["ease-in-out"]??K.linear,from:p.from,to:p.to}));}}let a=0,c=()=>{let v=t.offsetHeight-window.innerHeight;return v<=0?t.getBoundingClientRect().top<=0?1:0:St(-t.getBoundingClientRect().top/v)},f=v=>{for(let T of s){let p=T.end-T.start,w=p<=0?v>=T.end?1:0:St((v-T.start)/p),h=T.ease(w);T.kind==="draw"?T.el.style.strokeDashoffset=String(T.length*(1-h)):T.el.style.opacity=String(T.from+(T.to-T.from)*h);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return f(1),{destroy:()=>{},getProgress:()=>1};let m=0,d=false,x=false,A=()=>{a=c(),f(a),d&&(m=requestAnimationFrame(A));},b=()=>{d||(d=true,m=requestAnimationFrame(A));},J=()=>{d=false,cancelAnimationFrame(m);},fe=new IntersectionObserver(v=>{for(let T of v)x=T.isIntersecting,x?b():J();},{threshold:0});fe.observe(n),a=c(),f(a),$e(t,{type:"draw",getProgress:()=>a,getTrigger:()=>{let v=t.getBoundingClientRect().top+window.scrollY;return {tStart:v,tEnd:v+Math.max(0,t.offsetHeight-window.innerHeight)}}});let I=ct(v=>{v&&(I(),J(),fe.disconnect(),Ee(t),a=1,f(1));});return {destroy(){I(),J(),fe.disconnect(),Ee(t);},getProgress:()=>a}}};
|
|
4
|
+
exports.Cinematic=xt;exports.PRESETS=wt;exports.createBounce=Rt;exports.createElastic=Nt;exports.createSpring=cr;exports.scrollAnimate=$r;exports.scrollCounter=kr;exports.scrollDraw=Sr;exports.scrollParallax=Cr;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollAnimate,b as scrollParallax}from'./chunk-
|
|
1
|
+
export{a as scrollAnimate,b as scrollParallax}from'./chunk-XTPAW6XR.mjs';export{a as Cinematic}from'./chunk-YNNA33A5.mjs';export{a as scrollDraw}from'./chunk-DSFD227B.mjs';export{a as scrollCounter}from'./chunk-I73SOXBN.mjs';import'./chunk-OPXWNJBG.mjs';export{a as PRESETS}from'./chunk-6TWFLRUB.mjs';import'./chunk-OJFWQ6CU.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-A4JCC3QQ.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-DM6EDKWH.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-BCV4RAIX.mjs';import'./chunk-LFSU6LR3.mjs';
|