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