svg-scroll-draw 2.23.0 → 2.23.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -13
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +77 -118
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-23EALNDF.mjs +3 -0
- package/dist/{chunk-DY5JCXVR.mjs → chunk-4H2SGMAQ.mjs} +1 -1
- package/dist/{chunk-VMUJMXKO.mjs → chunk-4I7MLTP5.mjs} +1 -1
- package/dist/{chunk-OTDD2ROH.mjs → chunk-BLY6F6EC.mjs} +1 -1
- package/dist/{chunk-GVBO5GRD.mjs → chunk-ETACBG7W.mjs} +1 -1
- package/dist/chunk-GMBIGV3M.mjs +1 -0
- package/dist/chunk-LGJQWZHH.mjs +1 -0
- package/dist/chunk-UPWWULKI.mjs +1 -0
- package/dist/chunk-V4L3ELVC.mjs +1 -0
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +4 -2
- package/dist/group/index.d.ts +4 -2
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/solid/index.cjs +2 -2
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +2 -2
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-HX4SP5WN.mjs +0 -3
- package/dist/chunk-KV3WCPQ5.mjs +0 -1
- package/dist/chunk-LTCJVVSC.mjs +0 -1
- package/dist/chunk-WXUOF4NM.mjs +0 -1
- package/dist/chunk-YWKPTYSG.mjs +0 -1
package/dist/svelte/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function dn({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,t)),s=Math.sqrt(r),i=0,a=[];for(let d=0;d<n;d++){let v=Math.pow(s,d);a.push(v),i+=v;}let m=[0],f=0;for(let d=0;d<n;d++)f+=a[d]/i,m.push(f);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<n;v++)if(d<=m[v+1]){let O=(d-m[v])/(m[v+1]-m[v]);if(v===0)return O*(2-O);let E=1-Math.pow(r,v);return E+(1-E)*(2*O-1)*(2*O-1)}return 1}}function gn({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),r=Math.max(.1,t),s=n<=1?r/4:r/(2*Math.PI)*Math.asin(1/n);return i=>i<=0?0:i>=1?1:n*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/r)+1}var ne={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:e=>1-Math.cos(e*Math.PI*2.5)*Math.pow(1-e,2.2),bounce:dn(),elastic:gn()};function Ft(e,t,n){return Math.min(n,Math.max(t,e))}function fe(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 Ht(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 Nt(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 ee(e,t,n,r){return n===t?0:Ft((e-t)/(n-t)*r,0,1)}function Te(e,t,n,r,s){let i=Ht(e.top,e.height,t,r.element)-Nt(r.viewport,n),a=Ht(e.top,e.height,t,s.element)-Nt(s.viewport,n);return {tStart:i,tEnd:a}}function ot(e,t,n){let r=e.getBoundingClientRect(),s=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:s,scroll:0}:{top:n==="x"?r.left:r.top,height:s,scroll:n==="x"?window.scrollX:window.scrollY}}function Ge(e){let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),r=parseFloat(e.getAttribute("height")??"0");return 2*(n+r)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Vt(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 st(e,t,n){let r=Vt(e),s=Vt(t);return !r||!s?e:`rgb(${Math.round(r[0]+(s[0]-r[0])*n)},${Math.round(r[1]+(s[1]-r[1])*n)},${Math.round(r[2]+(s[2]-r[2])*n)})`}var zt={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 Ye=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function pe(e,...t){Ye&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var yn="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",hn="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",_t=33;function bn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function wn(e){let t=[];for(let n=0;n<_t;n++){let r=n/(_t-1);t.push(String(Math.round(e(r)*1e5)/1e5));}return `linear(${t.join(",")})`}function it(e){switch(e){case "linear":return "linear";case "ease-in":return yn;case "ease-out":return hn;case "ease-in-out":return bn()?wn(ne["ease-in-out"]):null;default:return null}}var Wt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[Wt]||(e[Wt]=new Map)}function Le(e,t){qt().set(e,t);}function Ae(e){qt().delete(e);}var Xe,at=new Set,lt=new WeakMap,Ke=new Map,Bt=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function vn(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();Xe??(Xe=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)lt.get(a)!==Bt(a)&&(i=true),lt.set(a,"");i&&at.forEach(a=>a());})),at.add(n);let r=vn(e);return [document.body,document.documentElement].forEach(s=>s&&r.add(s)),r.forEach(s=>{lt.has(s)||lt.set(s,Bt(s)),Ke.set(s,(Ke.get(s)??0)+1),Xe.observe(s);}),()=>{at.delete(n)&&(r.forEach(s=>{let i=(Ke.get(s)??1)-1;if(i)return void Ke.set(s,i);Ke.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 t=window.matchMedia("(prefers-reduced-motion: reduce)"),n=s=>e(!!s.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 We(e,t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return t(e,true);let n=t(e,false),r=ct(i=>{if(!i)return;r();let a=(n.getProgress?.()??0)>=1;n.destroy(),n=t(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(n))s[i]=(...a)=>n[i]?.(...a);return s.destroy=()=>{r(),n.destroy();},s}var En=0;function Sn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Gt(e,t){let n="";try{n=getComputedStyle(e).getPropertyValue(t).trim();}catch{}return n||(e.getAttribute(t)??"").trim()}var jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Tn(e){if(!Ye)return;let t=Gt(e,"stroke");if(!t||t==="none"){pe("Element has no stroke \u2014 path will not be visible.",e);return}let n=(e.getAttribute("fill")??"").trim();n&&!jt.has(n)&&!jt.has(Gt(e,"fill"))&&pe("Element has a fill \u2014 it may obscure the stroke animation.",e);}function xn(e,t,n){let r=document.createElement("div");r.setAttribute("data-svg-scroll-draw-debug",""),r.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function s(){let i=n==="x"?window.scrollX:window.scrollY,a=e-i,m=t-i,f=n==="x";r.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${f?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${f?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(r),window.addEventListener("scroll",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var Gt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,jt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Sn(e,t,n){if(!Xe)return;let r=(e.match(jt)??[]).join("").toUpperCase(),s=(t.match(jt)??[]).join("").toUpperCase(),i=(e.match(Gt)??[]).length,a=(t.match(Gt)??[]).length;if(r!==s){he(`morphTo: command sequence differs (${r||"\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.`,n);return}i!==a&&he(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function yt(e,t,n){let r=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=r[s++]??a;return String(+(a+(u-a)*n).toFixed(4))})}function ht(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:qe(t,(n,r)=>Tn(e,n,r))}function Tn(e,t,n){let{preset:r,...s}=t,i=r?{...Nt[r],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:f=false,easing:d="linear",trigger:x={},stagger:R=0,direction:C="forward",once:Q=false,debug:me=false,axis:I="y",scrollContainer:se,autoReverse:be=false,delay:D=0,strokeColor:H,strokeWidth:k,fillOpacity:M,waypoints:w,velocityScale:v=false,threshold:T=0,rootMargin:U="0px",repeat:N=0,repeatDelay:B=0,morphTo:L,clip:fe,autoplay:Ee=false,duration:ie=1e3,native:z=true,onProgress:m,onStart:A,onComplete:h,onEnter:O,onLeave:te,onEnterBack:pe,onLeaveBack:Se}=i,Z=fe===true?"left":typeof fe=="string"?fe:false,E=typeof d=="function"?d:oe[d]??oe.linear,de=ye(x.start??"top bottom"),Ae=ye(x.end??"bottom top"),ae=typeof se=="string"?document.querySelector(se):se??null,le=Array.isArray(H)?H[0]:null,ne=Array.isArray(H)?H[1]:typeof H=="string"?H:null,re=Array.isArray(k)?k[0]:null,Y=Array.isArray(k)?k[1]:typeof k=="number"?k:null,ge=Array.isArray(M)?M[0]:null,J=Array.isArray(M)?M[1]:typeof M=="number"?M:null;function Oe(o){let c=o*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let _=Z?[]:Array.from(e.querySelectorAll(a)),P=[],we=[],l=0,p=0,$e=R,Te=0,$=false,V=false,G=0,Ne=false,q=-1,Re=[],Ve=-1,ce=false,Ie=0,He=0,ze,ut=null;function Mt(){ut?.destroy(),ut=null;}let _e=new Set,Lt=NaN,We=true,et=-1,At=performance.now(),Be=NaN;function Ue(){return ae?I==="x"?ae.scrollLeft:ae.scrollTop:I==="x"?window.scrollX:window.scrollY}function $t(){return ae?I==="x"?ae.clientWidth:ae.clientHeight:I==="x"?window.innerWidth:window.innerHeight}function Ct(){let o=st(e,ae,I);return Le(o,o.scroll,$t(),de,Ae)}function on(){let o=p-l,c=_.length-1,y=ae??document.documentElement,X=I==="x"?"Width":"Height";if($e=R,R>0&&c>0&&o>0){let xe=y[`scroll${X}`]-y[`client${X}`]-1-l-o/u;xe>=0&&($e=Math.min(R,xe/(c*o)));}Te=p+c*$e*o;}function Pt(){(({tStart:l,tEnd:p}=Ct())),on(),me&&Xe&&(Mt(),ut=En(l,p,I));}function mt(o,c=Ct){Pe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let y=o.destroy;return o.destroy=()=>{y.call(o),ke(e);},o}function sn(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let y=c==="reverse"?1-o:o;e.style.clipPath=Oe(y);return}_.forEach((y,X)=>{y.style.strokeDashoffset=c==="reverse"?`${P[X]*o}`:`${P[X]*(1-o)}`,f&&(y.style.opacity=c==="reverse"?`${1-o}`:`${o}`),le&&ne?y.style.stroke=Qe(le,ne,o):ne&&(y.style.stroke=ne),re!==null&&Y!==null?y.style.strokeWidth=`${re+(Y-re)*o}`:Y!==null&&(y.style.strokeWidth=`${Y}`),ge!==null&&J!==null?y.style.fillOpacity=`${ge+(J-ge)*o}`:J!==null&&(y.style.fillOpacity=`${J}`),L&&y.tagName.toLowerCase()==="path"&&we[X]&&y.setAttribute("d",yt(we[X],L,o));});}function tt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=Oe(0);return}_.forEach((o,c)=>{o.style.strokeDasharray=`${P[c]}`,o.style.strokeDashoffset=C==="reverse"?"0":`${P[c]}`,f?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),re!==null&&(o.style.strokeWidth=`${re}`),ge!==null&&(o.style.fillOpacity=`${ge}`),L&&o.tagName.toLowerCase()==="path"&&we[c]&&o.setAttribute("d",we[c]);});}if(_.forEach(o=>{vn(o);let c=je(o);P.push(c);let y=o.tagName.toLowerCase()==="path";y?we.push(o.getAttribute("d")??""):we.push(""),L&&(y?Sn(we[we.length-1],L,o):he(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),n?(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=C==="reverse"?`${c}`:"0",f&&(o.style.opacity="1"),ne&&(o.style.stroke=ne),Y!==null&&(o.style.strokeWidth=`${Y}`),J!==null&&(o.style.fillOpacity=`${J}`),L&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",L)):(o.style.strokeDasharray=`${c}`,o.style.strokeDashoffset=C==="reverse"?"0":`${c}`,f?o.style.opacity=C==="reverse"?"1":"0":o.style.opacity="",le&&(o.style.stroke=le),re!==null&&(o.style.strokeWidth=`${re}`),ge!==null&&(o.style.fillOpacity=`${ge}`));}),Z){if(n)return e.style.clipPath=Oe(1),h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};e.style.clipPath=Oe(0);}else if(n)return h?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};let kt=typeof d=="string"?it(d):null;function an(){return !(z===false||!wn()||!_.length||!kt||Z||I!=="y"||ae||u!==1||R!==0||Q||be||v!==false||L||w||N||D>0||m||A||h||O||te||pe||Se||H!=null||k!=null||M!=null||(x.start??"top bottom").trim()!=="top bottom"||(x.end??"bottom top").trim()!=="bottom top")}function ln(){let o=++bn,c=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,X=`--svg-scroll-draw-${o}`,xe=C==="reverse"?"0":"var(--ssd-len)",De=C==="reverse"?"var(--ssd-len)":"0",Ce=`stroke-dashoffset:${xe};`,S=`stroke-dashoffset:${De};`;f&&(Ce+=`opacity:${C==="reverse"?1:0};`,S+=`opacity:${C==="reverse"?0:1};`);let F=document.createElement("style");F.setAttribute("data-svg-scroll-draw",""),F.textContent=`@keyframes ${c}{from{${Ce}}to{${S}}}.${y}{view-timeline-name:${X};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${kt};animation-fill-mode:both;animation-timeline:${X};animation-range:cover 0% cover 100%;}`,document.head.appendChild(F),e.classList.add(y);function ue(g,K){g.style.setProperty("--ssd-len",String(P[K])),g.style.strokeDasharray=`${P[K]}`,g.style.strokeDashoffset="",g.style.opacity="",g.style.animationPlayState="",g.classList.add(c);}_.forEach(ue);let b=false,W=-1;function j(){if(W>=0)return W;let g=e.getBoundingClientRect(),{tStart:K,tEnd:Me}=Le({top:g.top,height:g.height},Ue(),$t(),de,Ae);return E(ee(Ue(),K,Me,u))}return {destroy(){e.classList.remove(y),_.forEach(g=>{g.classList.remove(c),g.style.removeProperty("--ssd-len"),g.style.animationPlayState="";}),F.remove();},replay(){b=false,W=-1,_.forEach(ue);},pause(){b=true,_.forEach(g=>{g.style.animationPlayState="paused";});},resume(){b&&(b=false,_.forEach(g=>{g.style.animationPlayState="running";}));},seek(g){let K=Math.min(1,Math.max(0,g));W=K,b=true,_.forEach((Me,ve)=>{Me.classList.remove(c),Me.style.strokeDashoffset=C==="reverse"?`${P[ve]*K}`:`${P[ve]*(1-K)}`,f&&(Me.style.opacity=C==="reverse"?`${1-K}`:`${K}`);});},getProgress(){return j()},refresh(){_.forEach((g,K)=>{P[K]=je(g),g.style.setProperty("--ssd-len",String(P[K])),g.style.strokeDasharray=`${P[K]}`;});}}}if(an())return mt(ln());function cn(){let o=Math.max(1,ie),c=0,y=0,X=false;function xe(b){let W=true;if(Z){let j=Math.min(1,Math.max(0,b/o)),g=E(j);Ie=g,e.style.setProperty("--scroll-draw-progress",String(g)),e.style.clipPath=Oe(C==="reverse"?1-g:g),m?.(g),j<1&&(W=false);}else _.forEach((j,g)=>{let K=g*R*o,Me=Math.min(1,Math.max(0,(b-K)/o)),ve=E(Me);j.style.strokeDashoffset=C==="reverse"?`${P[g]*ve}`:`${P[g]*(1-ve)}`,f&&(j.style.opacity=C==="reverse"?`${1-ve}`:`${ve}`),le&&ne?j.style.stroke=Qe(le,ne,ve):ne&&(j.style.stroke=ne),re!==null&&Y!==null?j.style.strokeWidth=`${re+(Y-re)*ve}`:Y!==null&&(j.style.strokeWidth=`${Y}`),ge!==null&&J!==null?j.style.fillOpacity=`${ge+(J-ge)*ve}`:J!==null&&(j.style.fillOpacity=`${J}`),L&&j.tagName.toLowerCase()==="path"&&we[g]&&j.setAttribute("d",yt(we[g],L,ve)),g===0&&(Ie=ve,m?.(ve),e.style.setProperty("--scroll-draw-progress",String(ve))),Me<1&&(W=false);});if(w){let j=Math.min(1,Math.max(0,b/o)),g=E(j);for(let K in w){let Me=parseFloat(K);g>=Me&&!_e.has(Me)&&(_e.add(Me),w[K]?.());}}return W}function De(b){if(ce)return;let W=b-c;V||(V=true,A?.());let j=xe(W);if(j&&!$){$=true,xe(o*(1+Math.max(0,_.length-1)*R)),h?.(),He<(N==="infinite"?1/0:N??0)&&(He++,ze=setTimeout(()=>{c=performance.now(),V=false,$=false,_e.clear(),tt(),G=requestAnimationFrame(De);},B));return}j||(G=requestAnimationFrame(De));}function Ce(){cancelAnimationFrame(G),clearTimeout(ze),c=performance.now(),y=0,ce=false,V=false,$=false,He=0,X=true,Ie=0,_e.clear(),tt(),G=requestAnimationFrame(De);}let S=new IntersectionObserver(b=>{b.forEach(W=>{W.isIntersecting&&!(Q&&$)?Ce():!W.isIntersecting&&!Q&&!$&&(cancelAnimationFrame(G),clearTimeout(ze),X=false);});},{root:ae??null,threshold:T,rootMargin:U}),F;function ue(){clearTimeout(F),F=setTimeout(()=>{_.forEach((b,W)=>{P[W]=je(b),b.style.strokeDasharray=`${P[W]}`;});},150);}return window.addEventListener("resize",ue),window.addEventListener("orientationchange",ue),D>0?setTimeout(()=>S.observe(e),D):S.observe(e),{destroy(){cancelAnimationFrame(G),clearTimeout(ze),S.disconnect(),window.removeEventListener("resize",ue),window.removeEventListener("orientationchange",ue),clearTimeout(F);},replay(){He=0,Ce();},pause(){ce||!X||(ce=true,y=performance.now()-c,cancelAnimationFrame(G));},resume(){ce&&(ce=false,X=true,c=performance.now()-y,G=requestAnimationFrame(De));},seek(b){let W=Math.min(1,Math.max(0,b));Ie=W,ce=true,y=W*o,c=performance.now()-y,cancelAnimationFrame(G),xe(y);},getProgress(){return Ie},refresh(){clearTimeout(F),_.forEach((b,W)=>{P[W]=je(b),b.style.strokeDasharray=`${P[W]}`;});}}}if(Ee)return mt(cn());Pt();function Ot(){if(ce||!Ge)return;let o=performance.now(),c=Ue();if(!We&&v===false&&c===Lt){pt(c);return}We=false,Lt=c;let y=u;if(v!==false){let S=o-At,F=S>0?Math.abs(c-(et<0?c:et))/S:0;y=u*Math.max(.2,1+F*(typeof v=="number"?v:1)*.04);}et=c,At=o;let X=be?Ve===-1||c>=Ve?"forward":"reverse":C;Ve=c;let xe=p-l,De=true,Ce=xe===0?0:(c-l)/xe;if(isNaN(Be)||(Be<=0&&Ce>0?O?.():Be>0&&Ce<=0&&Se?.(),Be<1&&Ce>=1?te?.():Be>=1&&Ce<1&&pe?.()),Be=Ce,Z){let S=E(ee(c,l,p,y));Q&&!be&&(q=Math.max(q,S),S=q),Ie=S,e.style.setProperty("--scroll-draw-progress",String(S));let F=X==="reverse"?1-S:S;e.style.clipPath=Oe(F),m?.(S),!V&&ee(c,l,p,y)>0&&(V=true,A?.()),S>=1&&!$?($=true,h?.(),He<(N==="infinite"?1/0:N??0)&&(He++,ze=setTimeout(()=>{q=-1,V=false,$=false,e.style.clipPath=Oe(0);},B))):S<1&&!Q&&($=false),pt(c);return}if(_.forEach((S,F)=>{let ue=F*$e*xe,b=E(ee(c,l+ue,p+ue,y));Q&&!be&&(b=Re[F]=Math.max(Re[F]??q,b)),S.style.strokeDashoffset=X==="reverse"?`${P[F]*b}`:`${P[F]*(1-b)}`,f&&(S.style.opacity=X==="reverse"?`${1-b}`:`${b}`),le&&ne?S.style.stroke=Qe(le,ne,b):ne&&(S.style.stroke=ne),re!==null&&Y!==null?S.style.strokeWidth=`${re+(Y-re)*b}`:Y!==null&&(S.style.strokeWidth=`${Y}`),ge!==null&&J!==null?S.style.fillOpacity=`${ge+(J-ge)*b}`:J!==null&&(S.style.fillOpacity=`${J}`),L&&S.tagName.toLowerCase()==="path"&&we[F]&&S.setAttribute("d",yt(we[F],L,b)),F===0&&(Ie=b,m?.(b),e.style.setProperty("--scroll-draw-progress",String(b))),b<1&&(De=false);}),w){let S=E(ee(c,l,p,y));for(let F in w){let ue=parseFloat(F);S>=ue&&!_e.has(ue)&&(_e.add(ue),w[F]?.());}}!V&&ee(c,l,p,y)>0&&(V=true,A?.()),De&&!$?($=true,h?.(),He<(N==="infinite"?1/0:N??0)&&(He++,ze=setTimeout(()=>{q=-1,Re=[],V=false,$=false,_e.clear(),tt(),We=true;},B))):!De&&!Q&&($=false),pt(c);}function ft(o){return o>=p&&o<Te}function pt(o){Ne||ft(o)?G=requestAnimationFrame(Ot):Ge=false;}function dt(){return Ne||ft(Ue())}let Ge=false;function nt(){Ge||(Ge=true,G=requestAnimationFrame(function(){Ot();}));}function rt(){Ge=false,cancelAnimationFrame(G);}let gt=new IntersectionObserver(o=>{o.forEach(c=>{Ne=c.isIntersecting,Ne&&!ce?(We=true,nt()):Ge&&!ce&&ft(Ue())||rt();});},{root:ae??null,threshold:T,rootMargin:U});function It(){_.forEach((o,c)=>{P[c]=je(o),o.style.strokeDasharray=`${P[c]}`;}),Pt(),We=true;}let ot;function Ye(){clearTimeout(ot),ot=setTimeout(It,150);}window.addEventListener("resize",Ye),window.addEventListener("orientationchange",Ye);let un=Fe([e],Ye);return D>0?setTimeout(()=>gt.observe(e),D):gt.observe(e),mt({destroy(){cancelAnimationFrame(G),clearTimeout(ze),rt(),gt.disconnect(),un(),window.removeEventListener("resize",Ye),window.removeEventListener("orientationchange",Ye),clearTimeout(ot),Mt();},replay(){q=-1,Re=[],Ve=-1,et=-1,V=false,$=false,He=0,ce=false,Ie=0,_e.clear(),clearTimeout(ze),tt(),We=true,dt()&&nt();},pause(){ce=true,rt();},resume(){ce&&(ce=false,We=true,dt()&&nt());},seek(o){let c=Math.min(1,Math.max(0,o));Ie=c,q=c,Re=[],ce=true,rt(),sn(c,C),We=true;},getProgress(){return Ie},refresh(){clearTimeout(ot),It(),dt()&&!ce&&nt();}},()=>({tStart:l,tEnd:p}))}var Qt=new WeakMap,xn=0;function bt(e){return JSON.stringify(e,(t,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let r=Qt.get(n);return r===void 0&&Qt.set(n,r=++xn),`el#${r}`}return n})}function wt(e,t){let n={...e};for(let r of Object.keys(n))typeof n[r]=="function"&&(n[r]=(...s)=>t()[r]?.(...s));return n}function Mn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ut(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let s=[],i=[],a=r[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let f=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}t.push({fn:r[1],nums:s,units:i});}return t}function Ln(e,t,n){let r=Ut(e),s=Ut(t);return r.length===0||r.length!==s.length?n<1?e:t:r.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?n<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((f,d)=>`${f}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(u.nums[d]-f)*n}${i.units[d]}`).join(", ")})`}).join(" ")}function Yt(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),s=String(t);if(Mn(r))return Qe(r,s,n);if(r.includes("("))return Ln(r,s,n);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),f=parseFloat(a[1]);return `${u+(f-u)*n}${i[2]||a[2]}`}return n<1?r:s}function An(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var $n=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Cn=0,Xt="--scroll-draw-progress";function Pn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Zt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vt(e,t){return typeof window>"u"?Zt:t.respectReducedMotion===false?Kt(e,t,false):qe(t,(n,r)=>Kt(e,n,r))}function Kt(e,t,n){let{props:r,trigger:s={},easing:i="ease-out",speed:a=1,once:u=false,axis:f="y",scrollContainer:d,native:x=true,velocityScale:R=false,triggerElement:C,onProgress:Q,onComplete:me,onEnter:I,onLeave:se,onEnterBack:be,onLeaveBack:D}=t,H=typeof i=="function"?i:oe[i]??oe["ease-out"],k=ye(s.start??"top bottom"),M=ye(s.end??"bottom top"),w=C??e,v=typeof d=="string"?document.querySelector(d):d??null,T=Object.entries(r).map(([l,p])=>({prop:An(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function U(){let l=window.getComputedStyle(e);for(let p of T)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function N(){for(let l of T)e.style.setProperty(l.prop,String(l.to));}let B=new Map;for(let l of [...T.map(p=>p.prop),Xt])B.set(l,e.style.getPropertyValue(l));function L(){for(let[l,p]of B)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(n)return N(),me?.(),{...Zt,destroy:L,getProgress:()=>1};U();let fe=typeof i=="string"?it(i):null;function Ee(){if(!x||!Pn()||!fe||f!=="y"||v||w!==e||u||a!==1||Q||me||I||se||be||D||R!==false||(s.start??"top bottom").trim()!=="top bottom"||(s.end??"bottom top").trim()!=="bottom top")return false;for(let l of T)if(!$n.has(l.prop))return false;return true}function ie(){let l=`ssd-a-${++Cn}`,p=T.map(q=>`${q.prop}:${q.from}`).join(";"),$e=T.map(q=>`${q.prop}:${q.to}`).join(";"),Te=document.createElement("style");Te.setAttribute("data-ssd-animate",""),Te.textContent=`@keyframes ${l}{from{${p}}to{${$e}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${fe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(Te),e.classList.add(l);let $=()=>f==="x"?window.scrollX:window.scrollY,V=()=>f==="x"?window.innerWidth:window.innerHeight,G=()=>{let q=e.getBoundingClientRect();return Le({top:q.top,height:q.height},$(),V(),k,M)};Pe(e,{type:"animate",getProgress:()=>Ne.getProgress(),getTrigger:G});let Ne={refresh(){},destroy(){e.classList.remove(l),Te.remove(),e.style.animationPlayState="",L(),ke(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(q){let Re=Math.min(1,Math.max(0,q));e.classList.remove(l);for(let Ve of T)e.style.setProperty(Ve.prop,Yt(Ve.from,Ve.to,Re));},getProgress(){let{tStart:q,tEnd:Re}=G();return H(ee($(),q,Re,a))}};return Ne}if(Ee())return ie();let z=0,m=0,A=0,h=false,O=false,te=-1,pe=0,Se=false,Z=NaN,E=-1,de=0,Ae=()=>v?f==="x"?v.scrollLeft:v.scrollTop:f==="x"?window.scrollX:window.scrollY,ae=()=>v?f==="x"?v.clientWidth:v.clientHeight:f==="x"?window.innerWidth:window.innerHeight,le=w===e?T:[],ne=false;function re(){let l=e.style,p=le.map(V=>l.getPropertyValue(V.prop)),$e=l.transition;le.length&&(l.transition="none"),le.forEach(V=>l.setProperty(V.prop,B.get(V.prop)??""));let Te=st(w,v,f);le.forEach((V,G)=>l.setProperty(V.prop,p[G])),le.length&&(e.offsetWidth,l.transition=$e);let $=Le(Te,Te.scroll,ae(),k,M);ne&&Math.abs($.tStart-z)<1&&Math.abs($.tEnd-m)<1||(ne=true,z=$.tStart,m=$.tEnd);}function Y(l){e.style.setProperty(Xt,String(l));for(let p of T)e.style.setProperty(p.prop,Yt(p.from,p.to,l));Q?.(l);}function ge(l){if(isNaN(Z)){Z=l;return}Z<=0&&l>0?I?.():Z>0&&l<=0&&D?.(),Z<1&&l>=1?se?.():Z>=1&&l<1&&be?.(),Z=l;}function J(){if(!h||O)return;let l=performance.now(),p=Ae(),$e=a;if(R!==false){let V=l-de,G=V>0?Math.abs(p-(E<0?p:E))/V:0;$e=a*Math.max(.2,1+G*(typeof R=="number"?R:1)*.04);}E=p,de=l;let Te=m===z?0:(p-z)/(m-z);ge(Te);let $=H(ee(p,z,m,$e));u&&(te=Math.max(te,$),$=te),pe=$,Y($),$>=1&&!Se?(Se=true,me?.()):$<1&&!u&&(Se=false),A=requestAnimationFrame(J);}re(),m===z&&he("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e);{let l=H(ee(Ae(),z,m,a));u&&l>0&&(te=l),pe=l,Y(l);}let Oe=new IntersectionObserver(l=>{l.forEach(p=>{h=p.isIntersecting,h&&!O?A=requestAnimationFrame(J):cancelAnimationFrame(A);});},{root:v??null}),_;function P(){clearTimeout(_),_=setTimeout(re,150);}window.addEventListener("resize",P),window.addEventListener("orientationchange",P);let we=Fe([w],P);return Oe.observe(e),Pe(e,{type:"animate",getProgress:()=>pe,getTrigger:()=>({tStart:z,tEnd:m})}),{destroy(){cancelAnimationFrame(A),Oe.disconnect(),window.removeEventListener("resize",P),window.removeEventListener("orientationchange",P),we(),clearTimeout(_),L(),ke(e);},replay(){te=-1,Se=false,pe=0,O=false,Y(0);},pause(){O=true,cancelAnimationFrame(A);},resume(){O&&(O=false,h&&(A=requestAnimationFrame(J)));},seek(l){let p=Math.min(1,Math.max(0,l));pe=p,te=p,O=true,cancelAnimationFrame(A),Y(p);},getProgress(){return pe},refresh(){re();}}}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,t){if(typeof window>"u")return Et;let n=typeof e=="string"?document.querySelector(e):e;return n?qe(t,(r,s)=>kn(n,r,s)):(he("scrollCounter: element not found:",e),Et)}function kn(e,t,n){let{from:r=0,to:s,format:i,easing:a="ease-out",trigger:u={},once:f=true,decimals:d,onComplete:x}=t,R=d!==void 0?m=>m.toFixed(d):i??(m=>String(Math.round(m))),C=typeof a=="function"?a:oe[a]??oe["ease-out"],Q=ye(u.start??"top 80%"),me=ye(u.end??"top 20%");if(n)return e.textContent=R(s),x?.(),{...Et,getProgress:()=>1};let I=0,se=0,be=false,D=0,H=false,k=false,M=-1,w=0,v=false,T=()=>window.scrollY,U=()=>window.innerHeight;function N(){let m=e.getBoundingClientRect(),A=Le({top:m.top,height:m.height},T(),U(),Q,me);be&&Math.abs(A.tStart-I)<1&&Math.abs(A.tEnd-se)<1||(be=true,I=A.tStart,se=A.tEnd);}function B(m){e.textContent=R(r+(s-r)*m),e.style.setProperty("--scroll-draw-progress",String(m));}function L(){if(!H||k)return;let m=C(ee(T(),I,se,1));f&&(M=Math.max(M,m),m=M),w=m,B(m),m>=1&&!v?(v=true,x?.()):m<1&&!f&&(v=false),D=requestAnimationFrame(L);}N();{let m=C(ee(T(),I,se,1));f&&m>0&&(M=m),w=m,B(m);}let fe=new IntersectionObserver(m=>{m.forEach(A=>{H=A.isIntersecting,H&&!k?D=requestAnimationFrame(L):cancelAnimationFrame(D);});}),Ee;function ie(){clearTimeout(Ee),Ee=setTimeout(N,150);}window.addEventListener("resize",ie),window.addEventListener("orientationchange",ie);let z=Fe([e],ie);return fe.observe(e),Pe(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:I,tEnd:se})}),{destroy(){cancelAnimationFrame(D),fe.disconnect(),window.removeEventListener("resize",ie),window.removeEventListener("orientationchange",ie),z(),clearTimeout(Ee),ke(e);},replay(){M=-1,v=false,w=0,k=false,B(0);},pause(){k=true,cancelAnimationFrame(D);},resume(){k&&(k=false,H&&(D=requestAnimationFrame(L)));},seek(m){let A=Math.min(1,Math.max(0,m));w=A,M=A,k=true,cancelAnimationFrame(D),B(A);},getProgress(){return w}}}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tt(e,t={}){if(typeof window>"u")return Jt;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return he("scrollVideo: <video> element not found:",e),Jt;let r=n,{trigger:s={},easing:i="linear",once:a=false,axis:u="y",preload:f="auto",triggerElement:d,onReady:x,onComplete:R,onProgress:C}=t,Q=d??r,me=window.matchMedia("(prefers-reduced-motion: reduce)").matches,I=typeof i=="function"?i:oe[i]??oe.linear,se=ye(s.start??"top top"),be=ye(s.end??"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=f);let D=t.from??0,H=t.to,k=0,M=0,w=0,v=false,T=false,U=-1,N=0,B=false,L=false,fe=()=>u==="x"?window.scrollX:window.scrollY,Ee=()=>u==="x"?window.innerWidth:window.innerHeight;function ie(){let E=Q.getBoundingClientRect(),de=u==="x"?E.left:E.top,Ae=u==="x"?E.width:E.height,ae=Le({top:de,height:Ae},fe(),Ee(),se,be);k=ae.tStart,M=ae.tEnd,L&&M===k&&he("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let z=NaN;function m(E){if(!L)return;let de=H??r.duration??0,Ae=D+(de-D)*E;Ae!==z&&(z=Ae,r.currentTime=Ae),r.style.setProperty("--scroll-draw-progress",String(E)),C?.(E);}function A(){if(!v||T||!L||me)return;let E=I(ee(fe(),k,M,1));a&&(U=Math.max(U,E),E=U),N=E,m(E),E>=1&&!B?(B=true,R?.()):E<1&&!a&&(B=false),w=requestAnimationFrame(A);}function h(){if(L=true,H===void 0&&(H=r.duration),me){m(1),x?.();return}ie(),x?.(),v&&!T&&(w=requestAnimationFrame(A));}r.readyState>=1?h():r.addEventListener("loadedmetadata",h,{once:true}),L||ie();let O=me?()=>{}:ct(E=>{E&&(O(),me=true,cancelAnimationFrame(w),m(1));}),te=new IntersectionObserver(E=>{E.forEach(de=>{v=de.isIntersecting,v&&!T&&L?w=requestAnimationFrame(A):cancelAnimationFrame(w);});}),pe;function Se(){clearTimeout(pe),pe=setTimeout(ie,150);}window.addEventListener("resize",Se),window.addEventListener("orientationchange",Se);let Z=Fe([Q],Se);return te.observe(r),Pe(r,{type:"video",getProgress:()=>N,getTrigger:()=>({tStart:k,tEnd:M})}),{destroy(){cancelAnimationFrame(w),te.disconnect(),r.removeEventListener("loadedmetadata",h),window.removeEventListener("resize",Se),window.removeEventListener("orientationchange",Se),Z(),O(),clearTimeout(pe),ke(r);},replay(){U=-1,B=false,N=0,T=false,z=NaN,m(0);},pause(){T=true,cancelAnimationFrame(w);},resume(){T&&(T=false,v&&L&&(w=requestAnimationFrame(A)));},seek(E){let de=Math.min(1,Math.max(0,E));N=de,U=de,T=true,cancelAnimationFrame(w),z=NaN,m(de);},getProgress(){return N}}}function en(e,t){let n=document.createElement("span");n.textContent=t,n.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(n);}function rn(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(n=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(r.textContent=n,r.style.whiteSpace="pre"):(r.textContent=n,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(n)?null:r}).filter(n=>n!==null)}function On(e){let t=e.textContent??"";return e.textContent="",t.split("").map(n=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=n,n===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),n===" "?null:r}).filter(n=>n!==null)}function tn(e){let t=rn(e),n=new Map;for(let i of t){let a=i.offsetTop;n.has(a)||n.set(a,[]),n.get(a).push(i);}let r=[],s=Array.from(n.keys()).sort((i,a)=>i-a);for(let i of s){let a=n.get(i),u=document.createElement("span");u.setAttribute("aria-hidden","true"),u.style.display="inline-block",a.forEach((f,d)=>{let x=f.nextElementSibling;u.appendChild(f),d<a.length-1&&x&&x.style.whiteSpace==="pre"&&u.appendChild(x);}),r.push(u);}return e.textContent="",r.forEach((i,a)=>{e.appendChild(i),a<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function In(e,t,n,r){if(n<=1||r===0)return e;let s=(n-1)*r,i=t*r,a=i+(1-s);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Dn(e,t){let n=[];if(t?.y!==void 0&&n.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&n.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&n.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let r=t.scale+(1-t.scale)*e;n.push(`scale(${r})`);}return n.join(" ")||""}var nn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function xt(e,t={}){if(typeof window>"u")return nn;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return he("scrollText: element not found:",e),nn;let r=n;return qe(t,(s,i)=>Fn(r,s,i))}function Fn(e,t,n){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:u={},once:f=true,onComplete:d}=t,x=typeof i=="function"?i:oe[i]??oe["ease-out"],R=ye(u.start??"top 85%"),C=ye(u.end??"top 40%"),Q=e.innerHTML,me=e.textContent??"",I;r==="chars"?I=On(e):r==="lines"?I=tn(e):I=rn(e),en(e,me);let se=I.length;function be(h,O){a?.opacity!==void 0&&(h.style.opacity=String(a.opacity+(1-a.opacity)*O));let te=Dn(O,a);te&&(h.style.transform=te);}function D(h){e.style.setProperty("--scroll-draw-progress",String(h)),I.forEach((O,te)=>{let pe=x(In(h,te,se,s));be(O,pe);});}if(n)return D(1),d?.(),{destroy(){e.innerHTML=Q;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};D(0);let H=0,k=0,M=0,w=false,v=false,T=-1,U=0,N=false,B=()=>window.scrollY,L=()=>window.innerHeight;function fe(){let h=e.getBoundingClientRect(),O=Le({top:h.top,height:h.height},B(),L(),R,C);H=O.tStart,k=O.tEnd;}function Ee(){if(!w||v)return;let h=ee(B(),H,k,1);f&&(T=Math.max(T,h),h=T),U=h,D(h),h>=1&&!N?(N=true,d?.()):h<1&&!f&&(N=false),M=requestAnimationFrame(Ee);}fe();let ie=new IntersectionObserver(h=>{h.forEach(O=>{w=O.isIntersecting,w&&!v?M=requestAnimationFrame(Ee):cancelAnimationFrame(M);});}),z;function m(){clearTimeout(z),z=setTimeout(()=>{if(r==="lines"){let h=U;e.innerHTML=Q,I=tn(e),en(e,me),D(h);}fe();},150);}window.addEventListener("resize",m),window.addEventListener("orientationchange",m);let A=Fe([e],m);return ie.observe(e),Pe(e,{type:"text",getProgress:()=>U,getTrigger:()=>({tStart:H,tEnd:k})}),{destroy(){cancelAnimationFrame(M),ie.disconnect(),window.removeEventListener("resize",m),window.removeEventListener("orientationchange",m),A(),clearTimeout(z),e.innerHTML=Q,ke(e);},replay(){T=-1,N=false,U=0,v=false,D(0);},pause(){v=true,cancelAnimationFrame(M);},resume(){v&&(v=false,w&&(M=requestAnimationFrame(Ee)));},seek(h){let O=Math.min(1,Math.max(0,h));U=O,T=O,v=true,cancelAnimationFrame(M),D(O);},getProgress(){return U}}}function Je(e,t,n){let r=t,s=bt(t),i=n(e,wt(t,()=>r));return {update(a){r=a;let u=bt(a);u!==s&&(s=u,i.destroy(),i=n(e,wt(a,()=>r)));},destroy(){i.destroy();}}}function Ur(e,t={}){return Je(e,t,ht)}function Yr(e={}){let t=null;function n(r){return t=ht(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function Xr(e,t){return Je(e,t,vt)}function Kr(e){let t=null;function n(r){return t=vt(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function Zr(e,t){return Je(e,t,St)}function Jr(e){let t=null;function n(r){return t=St(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function eo(e,t={}){return Je(e,t,Tt)}function to(e={}){let t=null;function n(r){return t=Tt(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function no(e,t={}){return Je(e,t,xt)}function ro(e={}){let t=null;function n(r){return t=xt(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}exports.createScrollAnimate=Kr;exports.createScrollCounter=Jr;exports.createScrollDraw=Yr;exports.createScrollText=ro;exports.createScrollVideo=to;exports.scrollAnimate=Xr;exports.scrollCounterAction=Zr;exports.scrollDraw=Ur;exports.scrollTextAction=no;exports.scrollVideoAction=eo;
|
|
3
|
+
<div style="position:absolute;${f?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(r),window.addEventListener("scroll",s,{passive:true}),s(),{el:r,destroy(){window.removeEventListener("scroll",s),r.remove();}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mn(e,t,n){if(!Ye)return;let r=(e.match(Ut)??[]).join("").toUpperCase(),s=(t.match(Ut)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,a=(t.match(Qt)??[]).length;if(r!==s){pe(`morphTo: command sequence differs (${r||"\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.`,n);return}i!==a&&pe(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,n);}function Ln(e,t,n){let r=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),m=r[s++]??a;return String(+(a+(m-a)*n).toFixed(4))})}function ht(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:We(t,(n,r)=>An(e,n,r))}function An(e,t,n){let{preset:r,...s}=t,i=r?{...zt[r],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:m=1,fade:f=false,easing:d="linear",trigger:v={},stagger:O=0,direction:E="forward",once:Z=false,debug:re=false,axis:M="y",scrollContainer:oe,autoReverse:ye=false,delay:C=0,strokeColor:P,strokeWidth:L,fillOpacity:A,waypoints:b,velocityScale:h=false,threshold:w=0,rootMargin:Y="0px",repeat:_=0,repeatDelay:X=0,morphTo:R,clip:F,autoplay:ce=false,duration:he=1e3,native:te=true,onProgress:G,onStart:p,onComplete:u,onEnter:T,onLeave:ue,onEnterBack:me,onLeaveBack:Ce}=i,H=F===true?"left":typeof F=="string"?F:false,J=typeof d=="function"?d:ne[d]??ne.linear,$=fe(v.start||"top bottom"),k=fe(v.end||"bottom top"),W=typeof oe=="string"?document.querySelector(oe):oe??null,ve=Array.isArray(P)?P[0]:null,Ee=Array.isArray(P)?P[1]:typeof P=="string"?P:null,Pe=Array.isArray(L)?L[0]:null,$e=Array.isArray(L)?L[1]:typeof L=="number"?L:null,Se=Array.isArray(A)?A[0]:null,Ne=Array.isArray(A)?A[1]:typeof A=="number"?A:null;function ke(o){let l=o*100;switch(H){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let q=H?[]:Array.from(e.querySelectorAll(a)),N=[],de=[],ge=0,c=0,g=O,Re=0,I=false,V=false,x=0,z=false,xe=-1,Me=[],Je=-1,se=false,Ie=0,De=0,Ve,ut=null;function Mt(){ut?.destroy(),ut=null;}let ze=new Set,Lt=NaN,_e=true,et=-1,At=performance.now(),qe=NaN;function je(){return W?M==="x"?W.scrollLeft:W.scrollTop:M==="x"?window.scrollX:window.scrollY}function Ct(){return W?M==="x"?W.clientWidth:W.clientHeight:M==="x"?window.innerWidth:window.innerHeight}function Pt(){let o=ot(e,W,M);return Te(o,o.scroll,Ct(),$,k)}function an(){let o=c-ge,l=q.length-1,y=W??document.documentElement,j=M==="x"?"Width":"Height";if(g=O,O>0&&l>0&&o>0){let be=y[`scroll${j}`]-y[`client${j}`]-1-ge-o/m;be>=0&&(g=Math.min(O,be/(l*o)));}Re=c+l*g*o;}function $t(){(({tStart:ge,tEnd:c}=Pt())),an(),re&&Ye&&(Mt(),ut=xn(ge,c,M));}function mt(o,l=Pt){Le(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let y=o.destroy;return o.destroy=()=>{y.call(o),Ae(e);},o}function kt(o,l){return Z&&!ye?Math.max(xe,J(Me[o]=Math.max(Me[o]??0,l))):J(l)}function ln(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),H){let y=l==="reverse"?1-o:o;e.style.clipPath=ke(y);return}q.forEach((y,j)=>ft(y,j,o,l));}function ft(o,l,y,j){o.style.strokeDashoffset=j==="reverse"?`${N[l]*y}`:`${N[l]*(1-y)}`,f&&(o.style.opacity=j==="reverse"?`${1-y}`:`${y}`),ve&&Ee?o.style.stroke=st(ve,Ee,y):Ee&&(o.style.stroke=Ee),Pe!==null&&$e!==null?o.style.strokeWidth=`${Pe+($e-Pe)*y}`:$e!==null&&(o.style.strokeWidth=`${$e}`),Se!==null&&Ne!==null?o.style.fillOpacity=`${Se+(Ne-Se)*y}`:Ne!==null&&(o.style.fillOpacity=`${Ne}`),R&&o.tagName.toLowerCase()==="path"&&de[l]&&o.setAttribute("d",Ln(de[l],R,y));}function Qe(){if(e.style.setProperty("--scroll-draw-progress","0"),H){e.style.clipPath=ke(E==="reverse"?1:0);return}q.forEach((o,l)=>{o.style.strokeDasharray=`${N[l]}`,o.style.strokeDashoffset=E==="reverse"?"0":`${N[l]}`,f?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Pe!==null&&(o.style.strokeWidth=`${Pe}`),Se!==null&&(o.style.fillOpacity=`${Se}`),R&&o.tagName.toLowerCase()==="path"&&de[l]&&o.setAttribute("d",de[l]);});}if(q.forEach(o=>{Tn(o);let l=Ge(o);N.push(l);let y=o.tagName.toLowerCase()==="path";y?de.push(o.getAttribute("d")??""):de.push(""),R&&(y?Mn(de[de.length-1],R,o):pe(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),n?(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=E==="reverse"?`${l}`:"0",f&&(o.style.opacity="1"),Ee&&(o.style.stroke=Ee),$e!==null&&(o.style.strokeWidth=`${$e}`),Ne!==null&&(o.style.fillOpacity=`${Ne}`),R&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",R)):(o.style.strokeDasharray=`${l}`,o.style.strokeDashoffset=E==="reverse"?"0":`${l}`,f?o.style.opacity=E==="reverse"?"1":"0":o.style.opacity="",ve&&(o.style.stroke=ve),Pe!==null&&(o.style.strokeWidth=`${Pe}`),Se!==null&&(o.style.fillOpacity=`${Se}`));}),n)return H&&(e.style.clipPath=ke(1)),u?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};H&&(e.style.clipPath=ke(E==="reverse"?1:0));let It=typeof d=="string"?it(d):null;function cn(){return !(te===false||ce||re||!Sn()||!q.length||!It||H||M!=="y"||W||m!==1||O!==0||Z||ye||h!==false||R||b||_||C>0||G||p||u||T||ue||me||Ce||P!=null||L!=null||A!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function un(){let o=++En,l=`svg-scroll-draw-${o}`,y=`svg-scroll-draw-host-${o}`,j=`--svg-scroll-draw-${o}`,be=E==="reverse"?"0":"var(--ssd-len)",Fe=E==="reverse"?"var(--ssd-len)":"0",we=`stroke-dashoffset:${be};`,B=`stroke-dashoffset:${Fe};`;f&&(we+=`opacity:${E==="reverse"?1:0};`,B+=`opacity:${E==="reverse"?0:1};`);let Q=document.createElement("style");Q.setAttribute("data-svg-scroll-draw",""),Q.textContent=`@keyframes ${l}{from{${we}}to{${B}}}.${y}{view-timeline-name:${j};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${It};animation-fill-mode:both;animation-timeline:${j};animation-range:cover 0% cover 100%;}`,document.head.appendChild(Q),e.classList.add(y);function ie(S,D){S.style.setProperty("--ssd-len",String(N[D])),S.style.strokeDasharray=`${N[D]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(l);}q.forEach(ie);let ae=false,U=-1;function K(){if(U>=0)return U;let S=e.getBoundingClientRect(),{tStart:D,tEnd:le}=Te({top:S.top,height:S.height},je(),Ct(),$,k);return J(ee(je(),D,le,m))}return {destroy(){e.classList.remove(y),q.forEach(S=>{S.classList.remove(l),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),Q.remove();},replay(){ae=false,U=-1,q.forEach(ie);},pause(){ae=true,q.forEach(S=>{S.style.animationPlayState="paused";});},resume(){ae&&(ae=false,q.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let D=Math.min(1,Math.max(0,S));U=D,ae=true,q.forEach((le,He)=>{le.classList.remove(l),le.style.strokeDashoffset=E==="reverse"?`${N[He]*D}`:`${N[He]*(1-D)}`,f&&(le.style.opacity=E==="reverse"?`${1-D}`:`${D}`);});},getProgress(){return K()},refresh(){q.forEach((S,D)=>{N[D]=Ge(S),S.style.setProperty("--ssd-len",String(N[D])),S.style.strokeDasharray=`${N[D]}`;});}}}if(cn())return mt(un());function mn(){let o=Math.max(1,he),l=H?o:o*(1+Math.max(0,q.length-1)*O),y=0,j=0,be=false;function Fe(U){let K=true,S=Math.min(1,Math.max(0,U/l));if(H){let D=Math.min(1,Math.max(0,U/o)),le=J(D);Ie=le,e.style.setProperty("--scroll-draw-progress",String(le)),e.style.clipPath=ke(E==="reverse"?1-le:le),G?.(le),D<1&&(K=false);}else {q.forEach((le,He)=>{let pn=He*O*o,Dt=Math.min(1,Math.max(0,(U-pn)/o));ft(le,He,J(Dt),E),Dt<1&&(K=false);});let D=J(S);Ie=D,G?.(D),e.style.setProperty("--scroll-draw-progress",String(D));}if(b){let D=J(S);for(let le in b){let He=parseFloat(le);D>=He&&!ze.has(He)&&(ze.add(He),b[le]?.());}}return K}function we(U){if(se)return;let K=U-y;V||(V=true,p?.());let S=Fe(K);if(S&&!I){I=true,Fe(l),u?.(),De<(_==="infinite"?1/0:_??0)&&(De++,Ve=setTimeout(()=>{y=performance.now(),V=false,I=false,ze.clear(),Qe(),x=requestAnimationFrame(we);},X));return}S||(x=requestAnimationFrame(we));}function B(){cancelAnimationFrame(x),clearTimeout(Ve),y=performance.now(),j=0,se=false,V=false,I=false,De=0,be=true,Ie=0,ze.clear(),Qe(),x=requestAnimationFrame(we);}let Q=new IntersectionObserver(U=>{U.forEach(K=>{K.isIntersecting&&!(Z&&I)?B():!K.isIntersecting&&!Z&&!I&&(cancelAnimationFrame(x),clearTimeout(Ve),be=false);});},{root:W??null,threshold:w,rootMargin:Y}),ie;function ae(){clearTimeout(ie),ie=setTimeout(()=>{q.forEach((U,K)=>{N[K]=Ge(U),U.style.strokeDasharray=`${N[K]}`;});},150);}return window.addEventListener("resize",ae),window.addEventListener("orientationchange",ae),C>0?setTimeout(()=>Q.observe(e),C):Q.observe(e),{destroy(){cancelAnimationFrame(x),clearTimeout(Ve),Q.disconnect(),window.removeEventListener("resize",ae),window.removeEventListener("orientationchange",ae),clearTimeout(ie);},replay(){De=0,B();},pause(){se||!be||(se=true,j=performance.now()-y,cancelAnimationFrame(x));},resume(){se&&(se=false,be=true,y=performance.now()-j,x=requestAnimationFrame(we));},seek(U){let K=Math.min(1,Math.max(0,U));Ie=K,se=true,j=K*l,y=performance.now()-j,cancelAnimationFrame(x),Fe(j);},getProgress(){return Ie},refresh(){clearTimeout(ie),q.forEach((U,K)=>{N[K]=Ge(U),U.style.strokeDasharray=`${N[K]}`;});}}}if(ce)return mt(mn());$t();function Ot(){if(se||!Be)return;let o=performance.now(),l=je();if(!_e&&h===false&&l===Lt){dt(l);return}_e=false,Lt=l;let y=m;if(h!==false){let B=o-At,Q=B>0?Math.abs(l-(et<0?l:et))/B:0;y=m*Math.max(.2,1+Q*(typeof h=="number"?h:1)*.04);}et=l,At=o;let j=ye?Je===-1||l>=Je?"forward":"reverse":E;Je=l;let be=c-ge,Fe=true,we=be===0?0:(l-ge)/be;if(isNaN(qe)||(qe<=0&&we>0?T?.():qe>0&&we<=0&&Ce?.(),qe<1&&we>=1?ue?.():qe>=1&&we<1&&me?.()),qe=we,H){let B=kt(0,ee(l,ge,c,y));Ie=B,e.style.setProperty("--scroll-draw-progress",String(B));let Q=j==="reverse"?1-B:B;e.style.clipPath=ke(Q),G?.(B),!V&&ee(l,ge,c,y)>0&&(V=true,p?.()),B>=1&&!I?(I=true,u?.(),De<(_==="infinite"?1/0:_??0)&&(De++,Ve=setTimeout(()=>{xe=-1,Me=[],V=false,I=false,Qe();},X))):B<1&&!Z&&(I=false),dt(l);return}if(q.forEach((B,Q)=>{let ie=Q*g*be,ae=kt(Q,ee(l,ge+ie,c+ie,y));ft(B,Q,ae,j),Q===0&&(Ie=ae,G?.(ae),e.style.setProperty("--scroll-draw-progress",String(ae))),ae<1&&(Fe=false);}),b){let B=J(ee(l,ge,c,y));for(let Q in b){let ie=parseFloat(Q);B>=ie&&!ze.has(ie)&&(ze.add(ie),b[Q]?.());}}!V&&ee(l,ge,c,y)>0&&(V=true,p?.()),Fe&&!I?(I=true,u?.(),De<(_==="infinite"?1/0:_??0)&&(De++,Ve=setTimeout(()=>{xe=-1,Me=[],V=false,I=false,ze.clear(),Qe(),_e=true;},X))):!Fe&&!Z&&(I=false),dt(l);}function pt(o){return o>=c&&o<Re}function dt(o){z||pt(o)?x=requestAnimationFrame(Ot):Be=false;}function gt(){return z||pt(je())}let Be=false;function tt(){Be||(Be=true,x=requestAnimationFrame(function(){Ot();}));}function nt(){Be=false,cancelAnimationFrame(x);}let yt=new IntersectionObserver(o=>{o.forEach(l=>{z=l.isIntersecting,z&&!se?(_e=true,tt()):Be&&!se&&pt(je())||nt();});},{root:W??null,threshold:w,rootMargin:Y});function Rt(){q.forEach((o,l)=>{N[l]=Ge(o),o.style.strokeDasharray=`${N[l]}`;}),$t(),_e=true;}let rt;function Ue(){clearTimeout(rt),rt=setTimeout(Rt,150);}window.addEventListener("resize",Ue),window.addEventListener("orientationchange",Ue);let fn=Oe([e],Ue);return C>0?setTimeout(()=>yt.observe(e),C):yt.observe(e),mt({destroy(){cancelAnimationFrame(x),clearTimeout(Ve),nt(),yt.disconnect(),fn(),window.removeEventListener("resize",Ue),window.removeEventListener("orientationchange",Ue),clearTimeout(rt),Mt();},replay(){xe=-1,Me=[],Je=-1,et=-1,V=false,I=false,De=0,se=false,Ie=0,ze.clear(),clearTimeout(Ve),Qe(),_e=true,gt()&&tt();},pause(){se=true,nt();},resume(){se&&(se=false,_e=true,gt()&&tt());},seek(o){let l=Math.min(1,Math.max(0,o));Ie=l,xe=l,Me=[],se=true,nt(),ln(l,E),_e=true;},getProgress(){return Ie},refresh(){clearTimeout(rt),Rt(),gt()&&!se&&tt();}},()=>({tStart:ge,tEnd:c}))}var Yt=new WeakMap,Cn=0;function bt(e){return JSON.stringify(e,(t,n)=>{if(typeof n=="function")return "\u0192";if(typeof Element<"u"&&n instanceof Element){let r=Yt.get(n);return r===void 0&&Yt.set(n,r=++Cn),`el#${r}`}return n})}function wt(e,t){let n={...e};for(let r of Object.keys(n))typeof n[r]=="function"&&(n[r]=(...s)=>t()[r]?.(...s));return n}function Pn(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let t=[],n=/([\w]+)\(([^)]*)\)/g,r;for(;(r=n.exec(e))!==null;){let s=[],i=[],a=r[2].trim();if(a)for(let m of a.split(/[\s,]+/)){let f=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(f?parseFloat(f[1]):0),i.push(f?f[2]:"");}t.push({fn:r[1],nums:s,units:i});}return t}function $n(e,t,n){let r=Xt(e),s=Xt(t);return r.length===0||r.length!==s.length?n<1?e:t:r.map((i,a)=>{let m=s[a];return i.fn!==m.fn||i.nums.length!==m.nums.length?n<1?`${i.fn}(${i.nums.map((f,d)=>`${f}${i.units[d]}`).join(", ")})`:`${m.fn}(${m.nums.map((f,d)=>`${f}${m.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((f,d)=>`${f+(m.nums[d]-f)*n}${i.units[d]}`).join(", ")})`}).join(" ")}function Kt(e,t,n){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*n);let r=String(e),s=String(t);if(Pn(r))return st(r,s,n);if(r.includes("("))return $n(r,s,n);let i=r.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let m=parseFloat(i[1]),f=parseFloat(a[1]);return `${m+(f-m)*n}${i[2]||a[2]}`}return n<1?r:s}function kn(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var In=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),On=0,Zt="--scroll-draw-progress";function Rn(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var en={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function vt(e,t){return typeof window>"u"?en:t.respectReducedMotion===false?Jt(e,t,false):We(t,(n,r)=>Jt(e,n,r))}function Jt(e,t,n){let{props:r,trigger:s={},easing:i="ease-out",speed:a=1,once:m=false,axis:f="y",scrollContainer:d,native:v=true,velocityScale:O=false,triggerElement:E,onProgress:Z,onComplete:re,onEnter:M,onLeave:oe,onEnterBack:ye,onLeaveBack:C}=t,P=typeof i=="function"?i:ne[i]??ne["ease-out"],L=fe(s.start||"top bottom"),A=fe(s.end||"bottom top"),b=E??e,h=typeof d=="string"?document.querySelector(d):d??null,w=Object.entries(r).map(([c,g])=>({prop:kn(c),from:Array.isArray(g)?g[0]:"",to:Array.isArray(g)?g[1]:g}));function Y(){let c=window.getComputedStyle(e);for(let g of w)g.from===""&&(g.from=c.getPropertyValue(g.prop).trim()||"0");}function _(){for(let c of w)e.style.setProperty(c.prop,String(c.to));}let X=new Map;for(let c of [...w.map(g=>g.prop),Zt])X.set(c,e.style.getPropertyValue(c));function R(){for(let[c,g]of X)g?e.style.setProperty(c,g):e.style.removeProperty(c);}if(n)return _(),re?.(),{...en,destroy:R,getProgress:()=>1};Y();let F=()=>h?f==="x"?h.scrollLeft:h.scrollTop:f==="x"?window.scrollX:window.scrollY,ce=()=>h?f==="x"?h.clientWidth:h.clientHeight:f==="x"?window.innerWidth:window.innerHeight,he=typeof i=="string"?it(i):null;function te(){if(!v||!Rn()||!he||f!=="y"||h||b!==e||m||a!==1||Z||re||M||oe||ye||C||O!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let c of w)if(!In.has(c.prop))return false;return true}function G(){let c=`ssd-a-${++On}`,g=w.map(z=>`${z.prop}:${z.from}`).join(";"),Re=w.map(z=>`${z.prop}:${z.to}`).join(";"),I=document.createElement("style");I.setAttribute("data-ssd-animate",""),I.textContent=`@keyframes ${c}{from{${g}}to{${Re}}}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${he};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(I),e.classList.add(c);let V=()=>{let z=e.getBoundingClientRect();return Te({top:z.top,height:z.height},F(),ce(),L,A)};Le(e,{type:"animate",getProgress:()=>x.getProgress(),getTrigger:V});let x={refresh(){},destroy(){e.classList.remove(c),I.remove(),e.style.animationPlayState="",R(),Ae(e);},replay(){e.classList.remove(c),e.offsetWidth,e.classList.add(c);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(z){let xe=Math.min(1,Math.max(0,z));e.classList.remove(c);for(let Me of w)e.style.setProperty(Me.prop,Kt(Me.from,Me.to,xe));},getProgress(){let{tStart:z,tEnd:xe}=V();return P(ee(F(),z,xe,a))}};return x}if(te())return G();let p=0,u=0,T=0,ue=false,me=false,Ce=-1,H=0,J=0,$=false,k=NaN,W=-1,ve=0,Ee=b===e?w:[],Pe=false;function $e(){let c=e.style,g=Ee.map(x=>c.getPropertyValue(x.prop)),Re=c.transition;Ee.length&&(c.transition="none"),Ee.forEach(x=>c.setProperty(x.prop,X.get(x.prop)??""));let I=ot(b,h,f);Ee.forEach((x,z)=>c.setProperty(x.prop,g[z])),Ee.length&&(e.offsetWidth,c.transition=Re);let V=Te(I,I.scroll,ce(),L,A);Pe&&Math.abs(V.tStart-p)<1&&Math.abs(V.tEnd-u)<1||(Pe=true,p=V.tStart,u=V.tEnd);}function Se(c){e.style.setProperty(Zt,String(c));for(let g of w)e.style.setProperty(g.prop,Kt(g.from,g.to,c));Z?.(c);}function Ne(c){if(isNaN(k)){k=c;return}k<=0&&c>0?M?.():k>0&&c<=0&&C?.(),k<1&&c>=1?oe?.():k>=1&&c<1&&ye?.(),k=c;}function ke(){if(!ue||me)return;let c=performance.now(),g=F(),Re=a;if(O!==false){let z=c-ve,xe=z>0?Math.abs(g-(W<0?g:W))/z:0;Re=a*Math.max(.2,1+xe*(typeof O=="number"?O:1)*.04);}W=g,ve=c;let I=u===p?0:(g-p)/(u-p);Ne(I);let V=ee(g,p,u,Re),x=m?Math.max(Ce,P(H=Math.max(H,V))):P(V);J=x,Se(x),x>=1&&!$?($=true,re?.()):x<1&&!m&&($=false),T=requestAnimationFrame(ke);}$e(),u===p&&pe("scrollAnimate: the trigger window has zero length (start and end resolve to the same scroll position), so this element will never animate. If the target is inside a position:sticky stage, measure the trigger from the container that holds the scroll room via `triggerElement`.",e),H=ee(F(),p,u,a),J=P(H),Se(J);let q=new IntersectionObserver(c=>{c.forEach(g=>{ue=g.isIntersecting,ue&&!me?T=requestAnimationFrame(ke):cancelAnimationFrame(T);});},{root:h??null}),N;function de(){clearTimeout(N),N=setTimeout($e,150);}window.addEventListener("resize",de),window.addEventListener("orientationchange",de);let ge=Oe([b],de);return q.observe(e),Le(e,{type:"animate",getProgress:()=>J,getTrigger:()=>({tStart:p,tEnd:u})}),{destroy(){cancelAnimationFrame(T),q.disconnect(),window.removeEventListener("resize",de),window.removeEventListener("orientationchange",de),ge(),clearTimeout(N),R(),Ae(e);},replay(){Ce=-1,H=0,$=false,J=0,me=false,Se(0);},pause(){me=true,cancelAnimationFrame(T);},resume(){me&&(me=false,ue&&(T=requestAnimationFrame(ke)));},seek(c){let g=Math.min(1,Math.max(0,c));J=g,Ce=g,H=0,me=true,cancelAnimationFrame(T),Se(g);},getProgress(){return J},refresh(){$e();}}}var Et={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function St(e,t){if(typeof window>"u")return Et;let n=typeof e=="string"?document.querySelector(e):e;return n?We(t,(r,s)=>Dn(n,r,s)):(pe("scrollCounter: element not found:",e),Et)}function Dn(e,t,n){let{from:r=0,to:s,format:i,easing:a="ease-out",trigger:m={},once:f=true,decimals:d,onComplete:v}=t,O=d!==void 0?p=>p.toFixed(d):i??(p=>String(Math.round(p))),E=typeof a=="function"?a:ne[a]??ne["ease-out"],Z=fe(m.start||"top 80%"),re=fe(m.end||"top 20%");if(n)return e.textContent=O(s),v?.(),{...Et,getProgress:()=>1};let M=0,oe=0,ye=false,C=0,P=false,L=false,A=-1,b=0,h=0,w=false,Y=()=>window.scrollY,_=()=>window.innerHeight;function X(){let p=e.getBoundingClientRect(),u=Te({top:p.top,height:p.height},Y(),_(),Z,re);ye&&Math.abs(u.tStart-M)<1&&Math.abs(u.tEnd-oe)<1||(ye=true,M=u.tStart,oe=u.tEnd);}function R(p){e.textContent=O(r+(s-r)*p),e.style.setProperty("--scroll-draw-progress",String(p));}function F(){if(!P||L)return;let p=ee(Y(),M,oe,1),u=f?Math.max(A,E(b=Math.max(b,p))):E(p);h=u,R(u),u>=1&&!w?(w=true,v?.()):u<1&&!f&&(w=false),C=requestAnimationFrame(F);}X();{b=ee(Y(),M,oe,1);let p=E(b);h=p,R(p);}let ce=new IntersectionObserver(p=>{p.forEach(u=>{P=u.isIntersecting,P&&!L?C=requestAnimationFrame(F):cancelAnimationFrame(C);});}),he;function te(){clearTimeout(he),he=setTimeout(X,150);}window.addEventListener("resize",te),window.addEventListener("orientationchange",te);let G=Oe([e],te);return ce.observe(e),Le(e,{type:"counter",getProgress:()=>h,getTrigger:()=>({tStart:M,tEnd:oe})}),{destroy(){cancelAnimationFrame(C),ce.disconnect(),window.removeEventListener("resize",te),window.removeEventListener("orientationchange",te),G(),clearTimeout(he),Ae(e);},replay(){A=-1,b=0,w=false,h=0,L=false,R(0);},pause(){L=true,cancelAnimationFrame(C);},resume(){L&&(L=false,P&&(C=requestAnimationFrame(F)));},seek(p){let u=Math.min(1,Math.max(0,p));h=u,A=u,b=0,L=true,cancelAnimationFrame(C),R(u);},getProgress(){return h}}}var tn={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tt(e,t={}){if(typeof window>"u")return tn;let n=typeof e=="string"?document.querySelector(e):e;if(!n||n.tagName.toLowerCase()!=="video")return pe("scrollVideo: <video> element not found:",e),tn;let r=n,{trigger:s={},easing:i="linear",once:a=false,axis:m="y",preload:f="auto",triggerElement:d,onReady:v,onComplete:O,onProgress:E}=t,Z=d??r,re=window.matchMedia("(prefers-reduced-motion: reduce)").matches,M=typeof i=="function"?i:ne[i]??ne.linear,oe=fe(s.start||"top top"),ye=fe(s.end||"bottom top");r.pause(),r.hasAttribute("preload")||(r.preload=f);let C=t.from??0,P=t.to,L=0,A=0,b=0,h=false,w=false,Y=-1,_=0,X=0,R=false,F=false,ce=()=>m==="x"?window.scrollX:window.scrollY,he=()=>m==="x"?window.innerWidth:window.innerHeight;function te(){let $=Z.getBoundingClientRect(),k=m==="x"?$.left:$.top,W=m==="x"?$.width:$.height,ve=Te({top:k,height:W},ce(),he(),oe,ye);L=ve.tStart,A=ve.tEnd,F&&A===L&&pe("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r);}let G=NaN;function p($){if(!F)return;let k=P??r.duration??0,W=C+(k-C)*$;W!==G&&(G=W,r.currentTime=W),r.style.setProperty("--scroll-draw-progress",String($)),E?.($);}function u(){if(!h||w||!F||re)return;let $=ee(ce(),L,A,1),k=a?Math.max(Y,M(_=Math.max(_,$))):M($);X=k,p(k),k>=1&&!R?(R=true,O?.()):k<1&&!a&&(R=false),b=requestAnimationFrame(u);}function T(){if(F=true,P===void 0&&(P=r.duration),re){p(1),v?.();return}te(),v?.(),h&&!w&&(b=requestAnimationFrame(u));}r.readyState>=1?T():r.addEventListener("loadedmetadata",T,{once:true}),F||te();let ue=re?()=>{}:ct($=>{$&&(ue(),re=true,cancelAnimationFrame(b),p(1));}),me=new IntersectionObserver($=>{$.forEach(k=>{h=k.isIntersecting,h&&!w&&F?b=requestAnimationFrame(u):cancelAnimationFrame(b);});}),Ce;function H(){clearTimeout(Ce),Ce=setTimeout(te,150);}window.addEventListener("resize",H),window.addEventListener("orientationchange",H);let J=Oe([Z],H);return me.observe(r),Le(r,{type:"video",getProgress:()=>X,getTrigger:()=>({tStart:L,tEnd:A})}),{destroy(){cancelAnimationFrame(b),me.disconnect(),r.removeEventListener("loadedmetadata",T),window.removeEventListener("resize",H),window.removeEventListener("orientationchange",H),J(),ue(),clearTimeout(Ce),Ae(r);},replay(){Y=-1,_=0,R=false,X=0,w=false,G=NaN,p(0);},pause(){w=true,cancelAnimationFrame(b);},resume(){w&&(w=false,h&&F&&(b=requestAnimationFrame(u)));},seek($){let k=Math.min(1,Math.max(0,$));X=k,Y=k,_=0,w=true,cancelAnimationFrame(b),G=NaN,p(k);},getProgress(){return X}}}function nn(e,t){let n=document.createElement("span");n.textContent=t,n.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(n);}function sn(e){let t=e.textContent??"";return e.textContent="",t.split(/(\s+)/).filter(Boolean).map(n=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(n)?(r.textContent=n,r.style.whiteSpace="pre"):(r.textContent=n,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(n)?null:r}).filter(n=>n!==null)}function Fn(e){let t=e.textContent??"";return e.textContent="",t.split("").map(n=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=n,n===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),n===" "?null:r}).filter(n=>n!==null)}function rn(e){let t=sn(e),n=new Map;for(let i of t){let a=i.offsetTop;n.has(a)||n.set(a,[]),n.get(a).push(i);}let r=[],s=Array.from(n.keys()).sort((i,a)=>i-a);for(let i of s){let a=n.get(i),m=document.createElement("span");m.setAttribute("aria-hidden","true"),m.style.display="inline-block",a.forEach((f,d)=>{let v=f.nextElementSibling;m.appendChild(f),d<a.length-1&&v&&v.style.whiteSpace==="pre"&&m.appendChild(v);}),r.push(m);}return e.textContent="",r.forEach((i,a)=>{e.appendChild(i),a<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function Hn(e,t,n,r){if(n<=1||r===0)return e;let s=(n-1)*r,i=t*r,a=i+(1-s);return a<=i?e>=i?1:0:Math.min(1,Math.max(0,(e-i)/(a-i)))}function Nn(e,t){let n=[];if(t?.y!==void 0&&n.push(`translateY(${t.y*(1-e)}px)`),t?.x!==void 0&&n.push(`translateX(${t.x*(1-e)}px)`),t?.rotate!==void 0&&n.push(`rotate(${t.rotate*(1-e)}deg)`),t?.scale!==void 0){let r=t.scale+(1-t.scale)*e;n.push(`scale(${r})`);}return n.join(" ")||""}var on={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function xt(e,t={}){if(typeof window>"u")return on;let n=typeof e=="string"?document.querySelector(e):e;if(!n)return pe("scrollText: element not found:",e),on;let r=n;return We(t,(s,i)=>Vn(r,s,i))}function Vn(e,t,n){let{split:r="words",stagger:s=.04,easing:i="ease-out",from:a={opacity:0,y:24},trigger:m={},once:f=true,onComplete:d}=t,v=typeof i=="function"?i:ne[i]??ne["ease-out"],O=fe(m.start||"top 85%"),E=fe(m.end||"top 40%"),Z=e.innerHTML,re=e.textContent??"",M;r==="chars"?M=Fn(e):r==="lines"?M=rn(e):M=sn(e),nn(e,re);let oe=M.length;function ye(u,T){a?.opacity!==void 0&&(u.style.opacity=String(a.opacity+(1-a.opacity)*T));let ue=Nn(T,a);ue&&(u.style.transform=ue);}function C(u){e.style.setProperty("--scroll-draw-progress",String(u)),M.forEach((T,ue)=>{let me=v(Hn(u,ue,oe,s));ye(T,me);});}if(n)return C(1),d?.(),{destroy(){e.innerHTML=Z;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};C(0);let P=0,L=0,A=0,b=false,h=false,w=-1,Y=0,_=false,X=()=>window.scrollY,R=()=>window.innerHeight;function F(){let u=e.getBoundingClientRect(),T=Te({top:u.top,height:u.height},X(),R(),O,E);P=T.tStart,L=T.tEnd;}function ce(){if(!b||h)return;let u=ee(X(),P,L,1);f&&(w=Math.max(w,u),u=w),Y=u,C(u),u>=1&&!_?(_=true,d?.()):u<1&&!f&&(_=false),A=requestAnimationFrame(ce);}F();let he=new IntersectionObserver(u=>{u.forEach(T=>{b=T.isIntersecting,b&&!h?A=requestAnimationFrame(ce):cancelAnimationFrame(A);});}),te;function G(){clearTimeout(te),te=setTimeout(()=>{if(r==="lines"){let u=Y;e.innerHTML=Z,M=rn(e),nn(e,re),C(u);}F();},150);}window.addEventListener("resize",G),window.addEventListener("orientationchange",G);let p=Oe([e],G);return he.observe(e),Le(e,{type:"text",getProgress:()=>Y,getTrigger:()=>({tStart:P,tEnd:L})}),{destroy(){cancelAnimationFrame(A),he.disconnect(),window.removeEventListener("resize",G),window.removeEventListener("orientationchange",G),p(),clearTimeout(te),e.innerHTML=Z,Ae(e);},replay(){w=-1,_=false,Y=0,h=false,C(0);},pause(){h=true,cancelAnimationFrame(A);},resume(){h&&(h=false,b&&(A=requestAnimationFrame(ce)));},seek(u){let T=Math.min(1,Math.max(0,u));Y=T,w=T,h=true,cancelAnimationFrame(A),C(T);},getProgress(){return Y}}}function Ze(e,t,n){let r=t,s=bt(t),i=n(e,wt(t,()=>r));return {update(a){r=a;let m=bt(a);m!==s&&(s=m,i.destroy(),i=n(e,wt(a,()=>r)));},destroy(){i.destroy();}}}function Zr(e,t={}){return Ze(e,t,ht)}function Jr(e={}){let t=null;function n(r){return t=ht(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function eo(e,t){return Ze(e,t,vt)}function to(e){let t=null;function n(r){return t=vt(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function no(e,t){return Ze(e,t,St)}function ro(e){let t=null;function n(r){return t=St(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function oo(e,t={}){return Ze(e,t,Tt)}function so(e={}){let t=null;function n(r){return t=Tt(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}function io(e,t={}){return Ze(e,t,xt)}function ao(e={}){let t=null;function n(r){return t=xt(r,e),{destroy(){t?.destroy(),t=null;}}}return {action:n,getInstance:()=>t}}exports.createScrollAnimate=to;exports.createScrollCounter=ro;exports.createScrollDraw=Jr;exports.createScrollText=ao;exports.createScrollVideo=so;exports.scrollAnimate=eo;exports.scrollCounterAction=no;exports.scrollDraw=Zr;exports.scrollTextAction=io;exports.scrollVideoAction=oo;
|
package/dist/svelte/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$4,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-
|
|
1
|
+
import {a as a$4,b as b$1}from'../chunk-XSVTHCLO.mjs';import {a as a$3}from'../chunk-GMBIGV3M.mjs';import {a as a$2}from'../chunk-4H2SGMAQ.mjs';import {a as a$1}from'../chunk-LGJQWZHH.mjs';import {a}from'../chunk-V4L3ELVC.mjs';import {b}from'../chunk-23EALNDF.mjs';import'../chunk-OJFWQ6CU.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-YZV4Z3EQ.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-A4JCC3QQ.mjs';import'../chunk-DM6EDKWH.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-BCV4RAIX.mjs';import'../chunk-LFSU6LR3.mjs';function r(n,t,o){let e=t,f=a$4(t),l=o(n,b$1(t,()=>e));return {update(c){e=c;let d=a$4(c);d!==f&&(f=d,l.destroy(),l=o(n,b$1(c,()=>e)));},destroy(){l.destroy();}}}function D(n,t={}){return r(n,t,b)}function I(n={}){let t=null;function o(e){return t=b(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function A(n,t){return r(n,t,a)}function H(n){let t=null;function o(e){return t=a(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function L(n,t){return r(n,t,a$1)}function M(n){let t=null;function o(e){return t=a$1(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function V(n,t={}){return r(n,t,a$3)}function g(n={}){let t=null;function o(e){return t=a$3(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}function C(n,t={}){return r(n,t,a$2)}function v(n={}){let t=null;function o(e){return t=a$2(e,n),{destroy(){t?.destroy(),t=null;}}}return {action:o,getInstance:()=>t}}export{H as createScrollAnimate,M as createScrollCounter,I as createScrollDraw,v as createScrollText,g as createScrollVideo,A as scrollAnimate,L as scrollCounterAction,D as scrollDraw,C as scrollTextAction,V as scrollVideoAction};
|
package/dist/text/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function ce({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(r),o=0,s=[];for(let u=0;u<t;u++){let c=Math.pow(i,u);s.push(c),o+=c;}let d=[0],m=0;for(let u=0;u<t;u++)m+=s[u]/o,d.push(m);return u=>{if(u<=0)return 0;if(u>=1)return 1;for(let c=0;c<t;c++)if(u<=d[c+1]){let g=(u-d[c])/(d[c+1]-d[c]);if(c===0)return g*(2-g);let v=1-Math.pow(r,c);return v+(1-v)*(2*g-1)*(2*g-1)}return 1}}function de({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),i=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return o=>o<=0?0:o>=1?1:t*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/r)+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:ce(),elastic:de()};function V(e,n,t){return Math.min(t,Math.max(n,e))}function D(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function W(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function $(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 N(e,n,t,r){return t===n?0:V((e-n)/(t-n)*r,0,1)}function q(e,n,t,r,i){let o=W(e.top,e.height,n,r.element)-$(r.viewport,t),s=W(e.top,e.height,n,i.element)-$(i.viewport,t);return {tStart:o,tEnd:s}}var B=Symbol.for("svg-scroll-draw.registry");function G(){let e=globalThis;return e[B]||(e[B]=new Map)}function j(e,n){G().set(e,n);}function K(e){G().delete(e);}var x,C=new Set,R=new WeakMap,M=new Map,U=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function le(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function X(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();x??(x=new ResizeObserver(i=>{let o=false;for(let{target:s}of i)R.get(s)!==U(s)&&(o=true),R.set(s,"");o&&C.forEach(s=>s());})),C.add(t);let r=le(e);return [document.body,document.documentElement].forEach(i=>i&&r.add(i)),r.forEach(i=>{R.has(i)||R.set(i,U(i)),M.set(i,(M.get(i)??0)+1),x.observe(i);}),()=>{C.delete(t)&&(r.forEach(i=>{let o=(M.get(i)??1)-1;if(o)return void M.set(i,o);M.delete(i),x?.unobserve(i);}),C.size||(x?.disconnect(),x=void 0));}}var me=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Y(e,...n){me&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function J(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=i=>e(!!i.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function Z(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=J(o=>{if(!o)return;r();let s=(t.getProgress?.()??0)>=1;t.destroy(),t=n(s?{...e,onComplete:void 0}:e,true);}),i={};for(let o of Object.keys(t))i[o]=(...s)=>t[o]?.(...s);return i.destroy=()=>{r(),t.destroy();},i}function ee(e,n){let t=document.createElement("span");t.textContent=n,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function re(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(r.textContent=t,r.style.whiteSpace="pre"):(r.textContent=t,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(t)?null:r}).filter(t=>t!==null)}function pe(e){let n=e.textContent??"";return e.textContent="",n.split("").map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=t,t===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),t===" "?null:r}).filter(t=>t!==null)}function te(e){let n=re(e),t=new Map;for(let o of n){let s=o.offsetTop;t.has(s)||t.set(s,[]),t.get(s).push(o);}let r=[],i=Array.from(t.keys()).sort((o,s)=>o-s);for(let o of i){let s=t.get(o),d=document.createElement("span");d.setAttribute("aria-hidden","true"),d.style.display="inline-block",s.forEach((m,u)=>{let c=m.nextElementSibling;d.appendChild(m),u<s.length-1&&c&&c.style.whiteSpace==="pre"&&d.appendChild(c);}),r.push(d);}return e.textContent="",r.forEach((o,s)=>{e.appendChild(o),s<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function fe(e,n,t,r){if(t<=1||r===0)return e;let i=(t-1)*r,o=n*r,s=o+(1-i);return s<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(s-o)))}function ge(e,n){let t=[];if(n?.y!==void 0&&t.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&t.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&t.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let r=n.scale+(1-n.scale)*e;t.push(`scale(${r})`);}return t.join(" ")||""}var ne={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Pe(e,n={}){if(typeof window>"u")return ne;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return Y("scrollText: element not found:",e),ne;let r=t;return Z(n,(i,o)=>be(r,i,o))}function be(e,n,t){let{split:r="words",stagger:i=.04,easing:o="ease-out",from:s={opacity:0,y:24},trigger:d={},once:m=true,onComplete:u}=n,c=typeof o=="function"?o:k[o]??k["ease-out"],g=D(d.start
|
|
1
|
+
'use strict';function ce({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(r),o=0,s=[];for(let u=0;u<t;u++){let c=Math.pow(i,u);s.push(c),o+=c;}let d=[0],m=0;for(let u=0;u<t;u++)m+=s[u]/o,d.push(m);return u=>{if(u<=0)return 0;if(u>=1)return 1;for(let c=0;c<t;c++)if(u<=d[c+1]){let g=(u-d[c])/(d[c+1]-d[c]);if(c===0)return g*(2-g);let v=1-Math.pow(r,c);return v+(1-v)*(2*g-1)*(2*g-1)}return 1}}function de({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),i=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return o=>o<=0?0:o>=1?1:t*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/r)+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:ce(),elastic:de()};function V(e,n,t){return Math.min(t,Math.max(n,e))}function D(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}function W(e,n,t,r){switch(r){case "top":return e+t;case "center":return e+t+n/2;case "bottom":return e+t+n;default:return e+t}}function $(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 N(e,n,t,r){return t===n?0:V((e-n)/(t-n)*r,0,1)}function q(e,n,t,r,i){let o=W(e.top,e.height,n,r.element)-$(r.viewport,t),s=W(e.top,e.height,n,i.element)-$(i.viewport,t);return {tStart:o,tEnd:s}}var B=Symbol.for("svg-scroll-draw.registry");function G(){let e=globalThis;return e[B]||(e[B]=new Map)}function j(e,n){G().set(e,n);}function K(e){G().delete(e);}var x,C=new Set,R=new WeakMap,M=new Map,U=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function le(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function X(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();x??(x=new ResizeObserver(i=>{let o=false;for(let{target:s}of i)R.get(s)!==U(s)&&(o=true),R.set(s,"");o&&C.forEach(s=>s());})),C.add(t);let r=le(e);return [document.body,document.documentElement].forEach(i=>i&&r.add(i)),r.forEach(i=>{R.has(i)||R.set(i,U(i)),M.set(i,(M.get(i)??0)+1),x.observe(i);}),()=>{C.delete(t)&&(r.forEach(i=>{let o=(M.get(i)??1)-1;if(o)return void M.set(i,o);M.delete(i),x?.unobserve(i);}),C.size||(x?.disconnect(),x=void 0));}}var me=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function Y(e,...n){me&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function J(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=i=>e(!!i.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}function Z(e,n){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return n(e,true);let t=n(e,false),r=J(o=>{if(!o)return;r();let s=(t.getProgress?.()??0)>=1;t.destroy(),t=n(s?{...e,onComplete:void 0}:e,true);}),i={};for(let o of Object.keys(t))i[o]=(...s)=>t[o]?.(...s);return i.destroy=()=>{r(),t.destroy();},i}function ee(e,n){let t=document.createElement("span");t.textContent=n,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function re(e){let n=e.textContent??"";return e.textContent="",n.split(/(\s+)/).filter(Boolean).map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),/^\s+$/.test(t)?(r.textContent=t,r.style.whiteSpace="pre"):(r.textContent=t,r.style.display="inline-block"),e.appendChild(r),/^\s+$/.test(t)?null:r}).filter(t=>t!==null)}function pe(e){let n=e.textContent??"";return e.textContent="",n.split("").map(t=>{let r=document.createElement("span");return r.setAttribute("aria-hidden","true"),r.textContent=t,t===" "?r.style.whiteSpace="pre":r.style.display="inline-block",e.appendChild(r),t===" "?null:r}).filter(t=>t!==null)}function te(e){let n=re(e),t=new Map;for(let o of n){let s=o.offsetTop;t.has(s)||t.set(s,[]),t.get(s).push(o);}let r=[],i=Array.from(t.keys()).sort((o,s)=>o-s);for(let o of i){let s=t.get(o),d=document.createElement("span");d.setAttribute("aria-hidden","true"),d.style.display="inline-block",s.forEach((m,u)=>{let c=m.nextElementSibling;d.appendChild(m),u<s.length-1&&c&&c.style.whiteSpace==="pre"&&d.appendChild(c);}),r.push(d);}return e.textContent="",r.forEach((o,s)=>{e.appendChild(o),s<r.length-1&&e.appendChild(document.createTextNode(" "));}),r}function fe(e,n,t,r){if(t<=1||r===0)return e;let i=(t-1)*r,o=n*r,s=o+(1-i);return s<=o?e>=o?1:0:Math.min(1,Math.max(0,(e-o)/(s-o)))}function ge(e,n){let t=[];if(n?.y!==void 0&&t.push(`translateY(${n.y*(1-e)}px)`),n?.x!==void 0&&t.push(`translateX(${n.x*(1-e)}px)`),n?.rotate!==void 0&&t.push(`rotate(${n.rotate*(1-e)}deg)`),n?.scale!==void 0){let r=n.scale+(1-n.scale)*e;t.push(`scale(${r})`);}return t.join(" ")||""}var ne={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Pe(e,n={}){if(typeof window>"u")return ne;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return Y("scrollText: element not found:",e),ne;let r=t;return Z(n,(i,o)=>be(r,i,o))}function be(e,n,t){let{split:r="words",stagger:i=.04,easing:o="ease-out",from:s={opacity:0,y:24},trigger:d={},once:m=true,onComplete:u}=n,c=typeof o=="function"?o:k[o]??k["ease-out"],g=D(d.start||"top 85%"),v=D(d.end||"top 40%"),_=e.innerHTML,H=e.textContent??"",b;r==="chars"?b=pe(e):r==="lines"?b=te(e):b=re(e),ee(e,H);let oe=b.length;function ie(a,l){s?.opacity!==void 0&&(a.style.opacity=String(s.opacity+(1-s.opacity)*l));let L=ge(l,s);L&&(a.style.transform=L);}function h(a){e.style.setProperty("--scroll-draw-progress",String(a)),b.forEach((l,L)=>{let ue=c(fe(a,L,oe,i));ie(l,ue);});}if(t)return h(1),u?.(),{destroy(){e.innerHTML=_;},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};h(0);let A=0,I=0,p=0,T=false,f=false,w=-1,y=0,S=false,z=()=>window.scrollY,se=()=>window.innerHeight;function F(){let a=e.getBoundingClientRect(),l=q({top:a.top,height:a.height},z(),se(),g,v);A=l.tStart,I=l.tEnd;}function O(){if(!T||f)return;let a=N(z(),A,I,1);m&&(w=Math.max(w,a),a=w),y=a,h(a),a>=1&&!S?(S=true,u?.()):a<1&&!m&&(S=false),p=requestAnimationFrame(O);}F();let Q=new IntersectionObserver(a=>{a.forEach(l=>{T=l.isIntersecting,T&&!f?p=requestAnimationFrame(O):cancelAnimationFrame(p);});}),P;function E(){clearTimeout(P),P=setTimeout(()=>{if(r==="lines"){let a=y;e.innerHTML=_,b=te(e),ee(e,H),h(a);}F();},150);}window.addEventListener("resize",E),window.addEventListener("orientationchange",E);let ae=X([e],E);return Q.observe(e),j(e,{type:"text",getProgress:()=>y,getTrigger:()=>({tStart:A,tEnd:I})}),{destroy(){cancelAnimationFrame(p),Q.disconnect(),window.removeEventListener("resize",E),window.removeEventListener("orientationchange",E),ae(),clearTimeout(P),e.innerHTML=_,K(e);},replay(){w=-1,S=false,y=0,f=false,h(0);},pause(){f=true,cancelAnimationFrame(p);},resume(){f&&(f=false,T&&(p=requestAnimationFrame(O)));},seek(a){let l=Math.min(1,Math.max(0,a));y=l,w=l,f=true,cancelAnimationFrame(p),h(l);},getProgress(){return y}}}exports.scrollText=Pe;
|
package/dist/text/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollText}from'../chunk-
|
|
1
|
+
export{a as scrollText}from'../chunk-4H2SGMAQ.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';
|
package/dist/timeline/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function ke({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),i=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(i),a=0,f=[];for(let l=0;l<n;l++){let p=Math.pow(o,l);f.push(p),a+=p;}let b=[0],v=0;for(let l=0;l<n;l++)v+=f[l]/a,b.push(v);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let p=0;p<n;p++)if(l<=b[p+1]){let g=(l-b[p])/(b[p+1]-b[p]);if(p===0)return g*(2-g);let L=1-Math.pow(i,p);return L+(1-L)*(2*g-1)*(2*g-1)}return 1}}function Fe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),i=Math.max(.1,t),o=n<=1?i/4:i/(2*Math.PI)*Math.asin(1/n);return a=>a<=0?0:a>=1?1:n*Math.pow(2,-10*a)*Math.sin((a-o)*(2*Math.PI)/i)+1}var J={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:ke(),elastic:Fe()};function ae(e,t,n){return Math.min(n,Math.max(t,e))}function Y(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",i="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:i}}function ue(e,t,n,i){switch(i){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function ce(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 le(e,t,n,i){return n===t?0:ae((e-t)/(n-t)*i,0,1)}function de(e,t,n,i,o){let a=ue(e.top,e.height,t,i.element)-ce(i.viewport,n),f=ue(e.top,e.height,t,o.element)-ce(o.viewport,n);return {tStart:a,tEnd:f}}function Z(e){let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),i=parseFloat(e.getAttribute("height")??"0");return 2*(n+i)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function me(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function pe(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 i=t;return i.addListener?.(n),()=>i.removeListener?.(n)}var Oe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function fe(e,...t){Oe&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var be=Symbol.for("svg-scroll-draw.registry");function ge(){let e=globalThis;return e[be]||(e[be]=new Map)}function he(e,t){ge().set(e,t);}function ye(e){ge().delete(e);}var I,V=new Set,C=new WeakMap,A=new Map,we=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Pe(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let i=n;i;i=i.previousElementSibling)t.add(i);return t}function ve(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();I??(I=new ResizeObserver(o=>{let a=false;for(let{target:f}of o)C.get(f)!==we(f)&&(a=true),C.set(f,"");a&&V.forEach(f=>f());})),V.add(n);let i=Pe(e);return [document.body,document.documentElement].forEach(o=>o&&i.add(o)),i.forEach(o=>{C.has(o)||C.set(o,we(o)),A.set(o,(A.get(o)??0)+1),I.observe(o);}),()=>{V.delete(n)&&(i.forEach(o=>{let a=(A.get(o)??1)-1;if(a)return void A.set(o,a);A.delete(o),I?.unobserve(o);}),V.size||(I?.disconnect(),I=void 0));}}var xe=["#ff90e8","#ffc900","#5865F2","#22c55e","#f59e0b","#ef4444","#aaa","#60a5fa"];function tt(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let i=typeof e=="string"?document.querySelector(e):e;if(!i)return fe("timeline: Container not found:",e),n;let o=i,{trigger:a={},speed:f=1,once:b=false,axis:v="y",tracks:l,onComplete:p,repeat:g,repeatDelay:L=0,loop:G=false,loopDuration:Ee=1500,debug:Me=false,label:Le,respectReducedMotion:ee=true}=t,Te=Y(a.start
|
|
1
|
+
'use strict';function ke({bounces:e=3,decay:t=.5}={}){let n=Math.max(1,Math.round(e)),i=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(i),a=0,f=[];for(let l=0;l<n;l++){let p=Math.pow(o,l);f.push(p),a+=p;}let b=[0],v=0;for(let l=0;l<n;l++)v+=f[l]/a,b.push(v);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let p=0;p<n;p++)if(l<=b[p+1]){let g=(l-b[p])/(b[p+1]-b[p]);if(p===0)return g*(2-g);let L=1-Math.pow(i,p);return L+(1-L)*(2*g-1)*(2*g-1)}return 1}}function Fe({amplitude:e=1,period:t=.4}={}){let n=Math.max(1,e),i=Math.max(.1,t),o=n<=1?i/4:i/(2*Math.PI)*Math.asin(1/n);return a=>a<=0?0:a>=1?1:n*Math.pow(2,-10*a)*Math.sin((a-o)*(2*Math.PI)/i)+1}var J={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:ke(),elastic:Fe()};function ae(e,t,n){return Math.min(n,Math.max(t,e))}function Y(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[n="top",i="bottom"]=t.split(/\s+/).filter(Boolean);return {element:n,viewport:i}}function ue(e,t,n,i){switch(i){case "top":return e+n;case "center":return e+n+t/2;case "bottom":return e+n+t;default:return e+n}}function ce(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 le(e,t,n,i){return n===t?0:ae((e-t)/(n-t)*i,0,1)}function de(e,t,n,i,o){let a=ue(e.top,e.height,t,i.element)-ce(i.viewport,n),f=ue(e.top,e.height,t,o.element)-ce(o.viewport,n);return {tStart:a,tEnd:f}}function Z(e){let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),i=parseFloat(e.getAttribute("height")??"0");return 2*(n+i)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function me(){return typeof window>"u"||typeof window.matchMedia!="function"?false:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function pe(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 i=t;return i.addListener?.(n),()=>i.removeListener?.(n)}var Oe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function fe(e,...t){Oe&&console.warn(`[svg-scroll-draw] ${e}`,...t);}var be=Symbol.for("svg-scroll-draw.registry");function ge(){let e=globalThis;return e[be]||(e[be]=new Map)}function he(e,t){ge().set(e,t);}function ye(e){ge().delete(e);}var I,V=new Set,C=new WeakMap,A=new Map,we=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function Pe(e){let t=new Set;for(let n of e)for(;n&&n!==document.body;n=n.parentElement)for(let i=n;i;i=i.previousElementSibling)t.add(i);return t}function ve(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let n=()=>t();I??(I=new ResizeObserver(o=>{let a=false;for(let{target:f}of o)C.get(f)!==we(f)&&(a=true),C.set(f,"");a&&V.forEach(f=>f());})),V.add(n);let i=Pe(e);return [document.body,document.documentElement].forEach(o=>o&&i.add(o)),i.forEach(o=>{C.has(o)||C.set(o,we(o)),A.set(o,(A.get(o)??0)+1),I.observe(o);}),()=>{V.delete(n)&&(i.forEach(o=>{let a=(A.get(o)??1)-1;if(a)return void A.set(o,a);A.delete(o),I?.unobserve(o);}),V.size||(I?.disconnect(),I=void 0));}}var xe=["#ff90e8","#ffc900","#5865F2","#22c55e","#f59e0b","#ef4444","#aaa","#60a5fa"];function tt(e,t){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let i=typeof e=="string"?document.querySelector(e):e;if(!i)return fe("timeline: Container not found:",e),n;let o=i,{trigger:a={},speed:f=1,once:b=false,axis:v="y",tracks:l,onComplete:p,repeat:g,repeatDelay:L=0,loop:G=false,loopDuration:Ee=1500,debug:Me=false,label:Le,respectReducedMotion:ee=true}=t,Te=Y(a.start||"top bottom"),Se=Y(a.end||"bottom top"),$=g==="infinite"?1/0:g??0,d,Q=G===true?1/0:typeof G=="number"?G:0,h=false,W=0,T=Q,q=ee&&me(),Re=pe(r=>{q=ee&&r,q&&(h=false,clearTimeout(d),d=void 0);}),N=()=>Q>0&&!q,B=new Map,j=l.map(r=>{let u=typeof r.easing=="function"?r.easing:J[r.easing??"linear"]??J.linear,m=Array.from(o.querySelectorAll(r.selector)),c=m.map(s=>Z(s));return m.forEach((s,y)=>{B.has(s)||B.set(s,s.getAttribute("style")??""),s.style.strokeDasharray=`${c[y]}`,s.style.strokeDashoffset=`${c[y]}`,r.fade&&(s.style.opacity="0");}),{...r,elements:m,lengths:c,easeFn:u}});function De(){for(let[r,u]of B)u?r.setAttribute("style",u):r.removeAttribute("style");}let H=0,K=0,k=false,x=false,E=0,R=false,D=-1,M=0,w=null;Me&&(w=document.createElement("div"),Object.assign(w.style,{position:"fixed",bottom:"16px",left:"16px",zIndex:"9999",background:"rgba(0,0,0,0.88)",backdropFilter:"blur(8px)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"10px",padding:"10px 14px",fontFamily:"monospace",fontSize:"11px",color:"#fff",minWidth:"240px",pointerEvents:"none",lineHeight:"1.4"}),document.body.appendChild(w));function _e(r){if(!w)return;let u=Le??(typeof e=="string"?e:"timeline"),m=l.map(({selector:c,from:s,to:y},X)=>{let S=xe[X%xe.length],P=y>s?Math.min(1,Math.max(0,(r-s)/(y-s))):0,z=Math.round(P*100);return `<div style="margin:4px 0">
|
|
2
2
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:2px">
|
|
3
3
|
<span style="color:${S};max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${c}</span>
|
|
4
4
|
<span style="color:#666;margin-left:8px">${z}%</span>
|
package/dist/timeline/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$1}from'../chunk-AJ22VSHC.mjs';import {a as a$3}from'../chunk-YZV4Z3EQ.mjs';import {a,d as d$1,c,b as b$2}from'../chunk-A4JCC3QQ.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import {a as a$2}from'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$4,b as b$1}from'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var le=["#ff90e8","#ffc900","#5865F2","#22c55e","#f59e0b","#ef4444","#aaa","#60a5fa"];function Ae(u,ce){let V={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return V;let W=typeof u=="string"?document.querySelector(u):u;if(!W)return b("timeline: Container not found:",u),V;let s=W,{trigger:_={},speed:pe=1,once:$=false,axis:w="y",tracks:B,onComplete:de,repeat:x,repeatDelay:I=0,loop:L=false,loopDuration:fe=1500,debug:ue=false,label:me,respectReducedMotion:U=true}=ce,ge=a(_.start
|
|
1
|
+
import {a as a$1}from'../chunk-AJ22VSHC.mjs';import {a as a$3}from'../chunk-YZV4Z3EQ.mjs';import {a,d as d$1,c,b as b$2}from'../chunk-A4JCC3QQ.mjs';import {d}from'../chunk-DM6EDKWH.mjs';import {a as a$2}from'../chunk-5PJEKEEP.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$4,b as b$1}from'../chunk-BCV4RAIX.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var le=["#ff90e8","#ffc900","#5865F2","#22c55e","#f59e0b","#ef4444","#aaa","#60a5fa"];function Ae(u,ce){let V={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return V;let W=typeof u=="string"?document.querySelector(u):u;if(!W)return b("timeline: Container not found:",u),V;let s=W,{trigger:_={},speed:pe=1,once:$=false,axis:w="y",tracks:B,onComplete:de,repeat:x,repeatDelay:I=0,loop:L=false,loopDuration:fe=1500,debug:ue=false,label:me,respectReducedMotion:U=true}=ce,ge=a(_.start||"top bottom"),ye=a(_.end||"bottom top"),v=x==="infinite"?1/0:x??0,r,k=L===true?1/0:typeof L=="number"?L:0,a$5=false,A=0,m=k,R=U&&a$1(),be=a$2(e=>{R=U&&e,R&&(a$5=false,clearTimeout(r),r=void 0);}),F=()=>k>0&&!R,z=new Map,C=B.map(e=>{let n=typeof e.easing=="function"?e.easing:d[e.easing??"linear"]??d.linear,i=Array.from(s.querySelectorAll(e.selector)),o=i.map(t=>a$3(t));return i.forEach((t,l)=>{z.has(t)||z.set(t,t.getAttribute("style")??""),t.style.strokeDasharray=`${o[l]}`,t.style.strokeDashoffset=`${o[l]}`,e.fade&&(t.style.opacity="0");}),{...e,elements:i,lengths:o,easeFn:n}});function he(){for(let[e,n]of z)n?e.setAttribute("style",n):e.removeAttribute("style");}let P=0,H=0,T=false,p=false,d$2=0,y=false,b$3=-1,f=0,c$1=null;ue&&(c$1=document.createElement("div"),Object.assign(c$1.style,{position:"fixed",bottom:"16px",left:"16px",zIndex:"9999",background:"rgba(0,0,0,0.88)",backdropFilter:"blur(8px)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:"10px",padding:"10px 14px",fontFamily:"monospace",fontSize:"11px",color:"#fff",minWidth:"240px",pointerEvents:"none",lineHeight:"1.4"}),document.body.appendChild(c$1));function we(e){if(!c$1)return;let n=me??(typeof u=="string"?u:"timeline"),i=B.map(({selector:o,from:t,to:l},q)=>{let g=le[q%le.length],D=l>t?Math.min(1,Math.max(0,(e-t)/(l-t))):0,S=Math.round(D*100);return `<div style="margin:4px 0">
|
|
2
2
|
<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:2px">
|
|
3
3
|
<span style="color:${g};max-width:160px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">${o}</span>
|
|
4
4
|
<span style="color:#666;margin-left:8px">${S}%</span>
|
package/dist/video/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';function le({bounces:e=3,decay:t=.5}={}){let r=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,t)),o=Math.sqrt(n),i=0,d=[];for(let a=0;a<r;a++){let u=Math.pow(o,a);d.push(u),i+=u;}let m=[0],x=0;for(let a=0;a<r;a++)x+=d[a]/i,m.push(x);return a=>{if(a<=0)return 0;if(a>=1)return 1;for(let u=0;u<r;u++)if(a<=m[u+1]){let g=(a-m[u])/(m[u+1]-m[u]);if(u===0)return g*(2-g);let L=1-Math.pow(n,u);return L+(1-L)*(2*g-1)*(2*g-1)}return 1}}function fe({amplitude:e=1,period:t=.4}={}){let r=Math.max(1,e),n=Math.max(.1,t),o=r<=1?n/4:n/(2*Math.PI)*Math.asin(1/r);return i=>i<=0?0:i>=1?1:r*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/n)+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:le(),elastic:fe()};function J(e,t,r){return Math.min(r,Math.max(t,e))}function q(e="top bottom"){let t=e.trim();if(/^\d+(\.\d+)?%$/.test(t))return {element:"top",viewport:t};let[r="top",n="bottom"]=t.split(/\s+/).filter(Boolean);return {element:r,viewport:n}}function U(e,t,r,n){switch(n){case "top":return e+r;case "center":return e+r+t/2;case "bottom":return e+r+t;default:return e+r}}function Y(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 Z(e,t,r,n){return r===t?0:J((e-t)/(r-t)*n,0,1)}function H(e,t,r,n,o){let i=U(e.top,e.height,t,n.element)-Y(n.viewport,r),d=U(e.top,e.height,t,o.element)-Y(o.viewport,r);return {tStart:i,tEnd:d}}var ee=Symbol.for("svg-scroll-draw.registry");function te(){let e=globalThis;return e[ee]||(e[ee]=new Map)}function ne(e,t){te().set(e,t);}function re(e){te().delete(e);}var E,P=new Set,N=new WeakMap,M=new Map,oe=e=>{let t=e.getBoundingClientRect();return t.width+" "+t.height};function pe(e){let t=new Set;for(let r of e)for(;r&&r!==document.body;r=r.parentElement)for(let n=r;n;n=n.previousElementSibling)t.add(n);return t}function ie(e,t){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let r=()=>t();E??(E=new ResizeObserver(o=>{let i=false;for(let{target:d}of o)N.get(d)!==oe(d)&&(i=true),N.set(d,"");i&&P.forEach(d=>d());})),P.add(r);let n=pe(e);return [document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{N.has(o)||N.set(o,oe(o)),M.set(o,(M.get(o)??0)+1),E.observe(o);}),()=>{P.delete(r)&&(n.forEach(o=>{let i=(M.get(o)??1)-1;if(i)return void M.set(o,i);M.delete(o),E?.unobserve(o);}),P.size||(E?.disconnect(),E=void 0));}}var ge=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function W(e,...t){ge&&console.warn(`[svg-scroll-draw] ${e}`,...t);}function se(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let t=window.matchMedia("(prefers-reduced-motion: reduce)"),r=o=>e(!!o.matches);if(typeof t.addEventListener=="function")return t.addEventListener("change",r),()=>t.removeEventListener("change",r);let n=t;return n.addListener?.(r),()=>n.removeListener?.(r)}var ae={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ie(e,t={}){if(typeof window>"u")return ae;let r=typeof e=="string"?document.querySelector(e):e;if(!r||r.tagName.toLowerCase()!=="video")return W("scrollVideo: <video> element not found:",e),ae;let n=r,{trigger:o={},easing:i="linear",once:d=false,axis:m="y",preload:x="auto",triggerElement:a,onReady:u,onComplete:g,onProgress:L}=t,k=a??n,S=window.matchMedia("(prefers-reduced-motion: reduce)").matches,G=typeof i=="function"?i:Q[i]??Q.linear,ue=q(o.start||"top top"),ce=q(o.end||"bottom top");n.pause(),n.hasAttribute("preload")||(n.preload=x);let B=t.from??0,z=t.to,R=0,_=0,l=0,b=false,f=false,O=-1,T=0,w=0,A=false,p=false,$=()=>m==="x"?window.scrollX:window.scrollY,de=()=>m==="x"?window.innerWidth:window.innerHeight;function D(){let s=k.getBoundingClientRect(),c=m==="x"?s.left:s.top,y=m==="x"?s.width:s.height,j=H({top:c,height:y},$(),de(),ue,ce);R=j.tStart,_=j.tEnd,p&&_===R&&W("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",n);}let I=NaN;function h(s){if(!p)return;let c=z??n.duration??0,y=B+(c-B)*s;y!==I&&(I=y,n.currentTime=y),n.style.setProperty("--scroll-draw-progress",String(s)),L?.(s);}function V(){if(!b||f||!p||S)return;let s=Z($(),R,_,1),c=d?Math.max(O,G(T=Math.max(T,s))):G(s);w=c,h(c),c>=1&&!A?(A=true,g?.()):c<1&&!d&&(A=false),l=requestAnimationFrame(V);}function F(){if(p=true,z===void 0&&(z=n.duration),S){h(1),u?.();return}D(),u?.(),b&&!f&&(l=requestAnimationFrame(V));}n.readyState>=1?F():n.addEventListener("loadedmetadata",F,{once:true}),p||D();let K=S?()=>{}:se(s=>{s&&(K(),S=true,cancelAnimationFrame(l),h(1));}),X=new IntersectionObserver(s=>{s.forEach(c=>{b=c.isIntersecting,b&&!f&&p?l=requestAnimationFrame(V):cancelAnimationFrame(l);});}),C;function v(){clearTimeout(C),C=setTimeout(D,150);}window.addEventListener("resize",v),window.addEventListener("orientationchange",v);let me=ie([k],v);return X.observe(n),ne(n,{type:"video",getProgress:()=>w,getTrigger:()=>({tStart:R,tEnd:_})}),{destroy(){cancelAnimationFrame(l),X.disconnect(),n.removeEventListener("loadedmetadata",F),window.removeEventListener("resize",v),window.removeEventListener("orientationchange",v),me(),K(),clearTimeout(C),re(n);},replay(){O=-1,T=0,A=false,w=0,f=false,I=NaN,h(0);},pause(){f=true,cancelAnimationFrame(l);},resume(){f&&(f=false,b&&p&&(l=requestAnimationFrame(V)));},seek(s){let c=Math.min(1,Math.max(0,s));w=c,O=c,T=0,f=true,cancelAnimationFrame(l),I=NaN,h(c);},getProgress(){return w}}}exports.scrollVideo=Ie;
|
package/dist/video/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollVideo}from'../chunk-
|
|
1
|
+
export{a as scrollVideo}from'../chunk-GMBIGV3M.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';
|