svg-scroll-draw 2.26.0 → 2.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- "use strict";var SvgScrollDraw=(()=>{var wt=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Sr=Object.prototype.hasOwnProperty;var xr=(e,r)=>{for(var t in r)wt(e,t,{get:r[t],enumerable:!0})},Tr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Er(r))!Sr.call(e,o)&&o!==t&&wt(e,o,{get:()=>r[o],enumerable:!(n=vr(r,o))||n.enumerable});return e};var Mr=e=>Tr(wt({},"__esModule",{value:!0}),e);var Yr={};xr(Yr,{Cinematic:()=>mt,PRESETS:()=>rt,createBounce:()=>Et,createElastic:()=>St,createSpring:()=>vt,scrollAnimate:()=>ir,scrollCounter:()=>lr,scrollDraw:()=>er,scrollParallax:()=>ar});function I(e,...r){}function vt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Et({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),o=Math.sqrt(n),i=0,a=[];for(let f=0;f<t;f++){let h=Math.pow(o,f);a.push(h),i+=h}let c=[0],m=0;for(let f=0;f<t;f++)m+=a[f]/i,c.push(m);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let h=0;h<t;h++)if(f<=c[h+1]){let E=(f-c[h])/(c[h+1]-c[h]);if(h===0)return E*(2-E);let y=1-Math.pow(n,h);return y+(1-y)*(2*E-1)*(2*E-1)}return 1}}function St({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),o=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/n)+1}var _e={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:vt(),bounce:Et(),elastic:St()};function Ar(e,r,t,n){let o=(i,a,c)=>((1+3*i-3*a)*c+3*a-6*i)*c*c+3*i*c;return i=>{if(i<=0||i>=1)return+(i>0);let a=i;for(let c=0;c<8;c++)a-=(o(e,t,a)-i)/((3*(1+3*e-3*t)*a+6*t-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(o(e,t,a)-i)<1e-9))for(let c=0,m=0,f=1;c<30;c++)a=(m+f)/2,o(e,t,a)<i?m=a:f=a;return o(r,n,a)}}function xt(e){let r=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=r?r[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return[Ar(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var _t=new Set;function Le(e,r="linear"){if(typeof e=="function")return e;if(e==null)return _e[r];if({}.hasOwnProperty.call(_e,e))return _e[e];let t=xt(String(e));return t?t[0]:(!_t.has(e)&&_t.add(e)&&I(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),_e[r])}function Vt(e,r,t){return Math.min(t,Math.max(r,e))}function xe(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}}var Wt=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function zt(e,r,t,n){return e+t+r*Wt(n,0)}function Gt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Wt(e,1))}function H(e,r,t,n){return t===r?0:Vt((e-r)/(t-r)*n,0,1)}function ke(e,r,t,n,o){let i=zt(e.top,e.height,r,n.element)-Gt(n.viewport,t),a=zt(e.top,e.height,r,o.element)-Gt(o.viewport,t);return{tStart:i,tEnd:a}}function Ke(e,r,t){let n=e.getBoundingClientRect(),o=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:o,scroll:0}:{top:t==="x"?n.left:n.top,height:o,scroll:t==="x"?window.scrollX:window.scrollY}}function et(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"),o=parseFloat(e.getAttribute("height")??"0");return 2*(n+o)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Ve(e){return`${e} ${e*2}`}function Bt(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 tt(e,r,t){let n=Bt(e),o=Bt(r);return!n||!o?e:`rgb(${Math.round(n[0]+(o[0]-n[0])*t)},${Math.round(n[1]+(o[1]-n[1])*t)},${Math.round(n[2]+(o[2]-n[2])*t)})`}var rt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};var Pr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Lr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",qt=33;function kr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Cr(e){let r=[];for(let t=0;t<qt;t++){let n=t/(qt-1);r.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${r.join(",")})`}function nt(e){switch(e){case"linear":return"linear";case"ease-in":return Pr;case"ease-out":return Lr;case"ease-in-out":return kr()?Cr(_e["ease-in-out"]):null;default:return xt(e)?.[1]??null}}var jt=Symbol.for("svg-scroll-draw.registry");function Yt(){let e=globalThis;return e[jt]||(e[jt]=new Map)}function Te(e,r){Yt().set(e,r)}function fe(e){Yt().delete(e)}function ot(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.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 ze(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,!0);let t=r(e,!1),n=ot(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,!0)}),o={};for(let i of Object.keys(t))o[i]=(...a)=>t[i]?.(...a);return o.destroy=()=>{n(),t.destroy()},o}var Ye,st=new Set,it=new WeakMap,Qe=new Map,Qt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function $r(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 Ut(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let t=()=>r();Ye??(Ye=new ResizeObserver(o=>{let i=!1;for(let{target:a}of o)it.get(a)!==Qt(a)&&(i=!0),it.set(a,"");i&&st.forEach(a=>a())})),st.add(t);let n=$r(e);return[document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{it.has(o)||it.set(o,Qt(o)),Qe.set(o,(Qe.get(o)??0)+1),Ye.observe(o)}),()=>{st.delete(t)&&(n.forEach(o=>{let i=(Qe.get(o)??1)-1;if(i)return void Qe.set(o,i);Qe.delete(o),Ye?.unobserve(o)}),st.size||(Ye?.disconnect(),Ye=void 0))}}function Ce(e,r,t,n,o){let i,a=NaN,c,m,f=()=>{i=0,n(),!c&&!i&&(a=t())>0&&a<1&&(i=requestAnimationFrame(f))},h=()=>{!i&&!c&&t()!==a&&(i=requestAnimationFrame(f))},E=v=>{c=v,cancelAnimationFrame(i),i=a=NaN,h()},y=()=>{clearTimeout(m),o(),h()},R=()=>{clearTimeout(m),m=setTimeout(y,150)},oe=Ut(r,R),p=v=>{e[v]("scroll",h,{passive:!0}),window[v]("resize",R),window[v]("orientationchange",R)};return p("addEventListener"),h(),{hold:E,remeasure:y,off(){E(!0),p("removeEventListener"),oe(),clearTimeout(m)}}}var Dr=0;function Or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Xt(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 Ir(e){if(!!1)return;let r=Xt(e,"stroke");if(!r||r==="none"){I("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Jt.has(t)&&!Jt.has(Xt(e,"fill"))&&I("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Rr(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 o(){let i=t==="x"?window.scrollX:window.scrollY,a=e-i,c=r-i,m=t==="x";n.innerHTML=`
1
+ "use strict";var SvgScrollDraw=(()=>{var wt=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Sr=Object.prototype.hasOwnProperty;var xr=(e,r)=>{for(var t in r)wt(e,t,{get:r[t],enumerable:!0})},Tr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Er(r))!Sr.call(e,o)&&o!==t&&wt(e,o,{get:()=>r[o],enumerable:!(n=vr(r,o))||n.enumerable});return e};var Mr=e=>Tr(wt({},"__esModule",{value:!0}),e);var Qr={};xr(Qr,{Cinematic:()=>ut,PRESETS:()=>tt,createBounce:()=>Et,createElastic:()=>St,createSpring:()=>vt,scrollAnimate:()=>ir,scrollCounter:()=>lr,scrollDraw:()=>er,scrollParallax:()=>ar});function R(e,...r){}function vt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Et({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),o=Math.sqrt(n),i=0,a=[];for(let f=0;f<t;f++){let h=Math.pow(o,f);a.push(h),i+=h}let c=[0],m=0;for(let f=0;f<t;f++)m+=a[f]/i,c.push(m);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let h=0;h<t;h++)if(f<=c[h+1]){let E=(f-c[h])/(c[h+1]-c[h]);if(h===0)return E*(2-E);let b=1-Math.pow(n,h);return b+(1-b)*(2*E-1)*(2*E-1)}return 1}}function St({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),o=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/n)+1}var Fe={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:vt(),bounce:Et(),elastic:St()};function Ar(e,r,t,n){let o=(i,a,c)=>((1+3*i-3*a)*c+3*a-6*i)*c*c+3*i*c;return i=>{if(i<=0||i>=1)return+(i>0);let a=i;for(let c=0;c<8;c++)a-=(o(e,t,a)-i)/((3*(1+3*e-3*t)*a+6*t-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(o(e,t,a)-i)<1e-9))for(let c=0,m=0,f=1;c<30;c++)a=(m+f)/2,o(e,t,a)<i?m=a:f=a;return o(r,n,a)}}function xt(e){let r=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=r?r[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return[Ar(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var _t=new Set;function Ae(e,r="linear"){if(typeof e=="function")return e;if(e==null)return Fe[r];if({}.hasOwnProperty.call(Fe,e))return Fe[e];let t=xt(String(e));return t?t[0]:(!_t.has(e)&&_t.add(e)&&R(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),Fe[r])}function Vt(e,r,t){return Math.min(t,Math.max(r,e))}function Se(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}}var Wt=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function zt(e,r,t,n){return e+t+r*Wt(n,0)}function Gt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Wt(e,1))}function N(e,r,t,n){return t===r?0:Vt((e-r)/(t-r)*n,0,1)}function Pe(e,r,t,n,o){let i=zt(e.top,e.height,r,n.element)-Gt(n.viewport,t),a=zt(e.top,e.height,r,o.element)-Gt(o.viewport,t);return{tStart:i,tEnd:a}}function Ze(e,r,t){let n=e.getBoundingClientRect(),o=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:o,scroll:0}:{top:t==="x"?n.left:n.top,height:o,scroll:t==="x"?window.scrollX:window.scrollY}}function Ke(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"),o=parseFloat(e.getAttribute("height")??"0");return 2*(n+o)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function _e(e){return`${e} ${e*2}`}function Bt(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 et(e,r,t){let n=Bt(e),o=Bt(r);return!n||!o?e:`rgb(${Math.round(n[0]+(o[0]-n[0])*t)},${Math.round(n[1]+(o[1]-n[1])*t)},${Math.round(n[2]+(o[2]-n[2])*t)})`}var tt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};var Pr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Lr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",qt=33;function kr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Cr(e){let r=[];for(let t=0;t<qt;t++){let n=t/(qt-1);r.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${r.join(",")})`}function rt(e){switch(e){case"linear":return"linear";case"ease-in":return Pr;case"ease-out":return Lr;case"ease-in-out":return kr()?Cr(Fe["ease-in-out"]):null;default:return xt(e)?.[1]??null}}var jt=Symbol.for("svg-scroll-draw.registry");function Yt(){let e=globalThis;return e[jt]||(e[jt]=new Map)}function xe(e,r){Yt().set(e,r)}function me(e){Yt().delete(e)}function nt(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.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 Ve(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,!0);let t=r(e,!1),n=nt(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,!0)}),o={};for(let i of Object.keys(t))o[i]=(...a)=>t[i]?.(...a);return o.destroy=()=>{n(),t.destroy()},o}var qe,ot=new Set,st=new WeakMap,je=new Map,Qt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function $r(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 Ut(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let t=()=>r();qe??(qe=new ResizeObserver(o=>{let i=!1;for(let{target:a}of o)st.get(a)!==Qt(a)&&(i=!0),st.set(a,"");i&&ot.forEach(a=>a())})),ot.add(t);let n=$r(e);return[document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{st.has(o)||st.set(o,Qt(o)),je.set(o,(je.get(o)??0)+1),qe.observe(o)}),()=>{ot.delete(t)&&(n.forEach(o=>{let i=(je.get(o)??1)-1;if(i)return void je.set(o,i);je.delete(o),qe?.unobserve(o)}),ot.size||(qe?.disconnect(),qe=void 0))}}function Le(e,r,t,n,o){let i,a=NaN,c,m,f=()=>{i=0,n(),!c&&!i&&(a=t())>0&&a<1&&(i=requestAnimationFrame(f))},h=()=>{!i&&!c&&t()!==a&&(i=requestAnimationFrame(f))},E=v=>{c=v,cancelAnimationFrame(i),i=a=NaN,h()},b=()=>{clearTimeout(m),o(),h()},L=()=>{clearTimeout(m),m=setTimeout(b,150)},F=Ut(r,L),d=v=>{e[v]("scroll",h,{passive:!0}),window[v]("resize",L),window[v]("orientationchange",L)};return d("addEventListener"),h(),{hold:E,remeasure:b,off(){E(!0),d("removeEventListener"),F(),clearTimeout(m)}}}var Or=0;function Dr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Xt(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 Ir(e){if(!!1)return;let r=Xt(e,"stroke");if(!r||r==="none"){R("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Jt.has(t)&&!Jt.has(Xt(e,"fill"))&&R("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Rr(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 o(){let i=t==="x"?window.scrollX:window.scrollY,a=e-i,c=r-i,m=t==="x";n.innerHTML=`
2
2
  <div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}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",o,{passive:!0}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove()}}}var Zt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Kt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Hr(e,r,t){if(!!1)return;let n=(e.match(Kt)??[]).join("").toUpperCase(),o=(r.match(Kt)??[]).join("").toUpperCase(),i=(e.match(Zt)??[]).length,a=(r.match(Zt)??[]).length;if(n!==o){I(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==a&&I(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t)}function Nr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),c=n[o++]??a;return String(+(a+(c-a)*t).toFixed(4))})}function lt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ze(r,(t,n)=>Fr(e,t,n))}function Fr(e,r,t){let{preset:n,...o}=r,i=n?{...rt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:c=1,fade:m=!1,easing:f="linear",trigger:h={},stagger:E=0,direction:y="forward",once:R=!1,debug:oe=!1,axis:p="y",scrollContainer:v,autoReverse:b=!1,delay:x=0,strokeColor:w,strokeWidth:L,fillOpacity:U,waypoints:W,velocityScale:N=!1,threshold:K=0,rootMargin:Ge="0px",repeat:ae=0,repeatDelay:pe=0,morphTo:B,clip:ee,autoplay:Me=!1,duration:P=1e3,native:F=!0,onProgress:$e,onStart:X,onComplete:te,onEnter:de,onLeave:Re,onEnterBack:ge,onLeaveBack:ue}=i,J=ee===!0?"left":typeof ee=="string"?ee:!1,q=Le(f),He=xe(h.start||"top bottom"),We=xe(h.end||"bottom top"),_=typeof v=="string"?document.querySelector(v):v??null,ye=Array.isArray(w)?w[0]:null,he=Array.isArray(w)?w[1]:typeof w=="string"?w:null,le=Array.isArray(L)?L[0]:null,Ae=Array.isArray(L)?L[1]:typeof L=="number"?L:null,be=Array.isArray(U)?U[0]:null,ce=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function we(s){let u=s*100;switch(J){case"right":return`inset(0 0 0 ${100-u}%)`;case"top":return`inset(0 0 ${100-u}% 0)`;case"bottom":return`inset(${100-u}% 0 0 0)`;case"center":return`circle(${s*150}% at 50% 50%)`;default:return`inset(0 ${100-u}% 0 0)`}}let l=J?[]:Array.from(e.querySelectorAll(a)),d=[],V=[],M=0,k=0,O=E,C=0,Pe=0,z=!1,ve=!1,Ee=0,ft=-1,Ue=[],Xe=-1,se=!1,me=0,De=0,Oe,pt=!1,dt=null;function At(){dt?.destroy(),dt=null}let Ie=new Set,Pt=NaN,Ne=!0,Je=-1,Lt=performance.now(),Fe=NaN;function Ze(){return _?p==="x"?_.scrollLeft:_.scrollTop:p==="x"?window.scrollX:window.scrollY}function kt(){return _?p==="x"?_.clientWidth:_.clientHeight:p==="x"?window.innerWidth:window.innerHeight}function Ct(){let s=Ke(e,_,p);return ke(s,s.scroll,kt(),He,We)}function pr(){let s=k-M,u=l.length-1,g=_??document.documentElement,T=p==="x"?"Width":"Height";if(O=E,E>0&&u>0&&s>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-s/c;j>=0&&(O=Math.min(E,j/(u*s)))}let G=Math.max(0,u)*O*s,re=s/Math.min(c,1);C=M+Math.min(0,G,re,G+re),Pe=M+Math.max(0,G,re,G+re)}function $t(){({tStart:M,tEnd:k}=Ct()),pr(),oe&&!1&&(At(),dt=Rr(M,k,p))}function gt(s,u=Ct){Te(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:u});let g=s.destroy;return s.destroy=()=>{g.call(s),fe(e)},s}function Dt(s,u){return R&&!b?Math.max(ft,q(Ue[s]=Math.max(Ue[s]??0,u))):q(u)}function dr(s,u){if(e.style.setProperty("--scroll-draw-progress",String(s)),J){let g=u==="reverse"?1-s:s;e.style.clipPath=we(g);return}l.forEach((g,T)=>yt(g,T,s,u))}function yt(s,u,g,T){s.style.strokeDashoffset=T==="reverse"?`${d[u]*g}`:`${d[u]*(1-g)}`,m&&(s.style.opacity=T==="reverse"?`${1-g}`:`${g}`),ye&&he?s.style.stroke=tt(ye,he,g):he&&(s.style.stroke=he),le!==null&&Ae!==null?s.style.strokeWidth=`${le+(Ae-le)*g}`:Ae!==null&&(s.style.strokeWidth=`${Ae}`),be!==null&&ce!==null?s.style.fillOpacity=`${be+(ce-be)*g}`:ce!==null&&(s.style.fillOpacity=`${ce}`),B&&s.tagName.toLowerCase()==="path"&&V[u]&&s.setAttribute("d",Nr(V[u],B,g))}function ht(){if(e.style.setProperty("--scroll-draw-progress","0"),J){e.style.clipPath=we(y==="reverse"?1:0);return}l.forEach((s,u)=>{s.style.strokeDasharray=Ve(d[u]),s.style.strokeDashoffset=y==="reverse"?"0":`${d[u]}`,m?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ye&&(s.style.stroke=ye),le!==null&&(s.style.strokeWidth=`${le}`),be!==null&&(s.style.fillOpacity=`${be}`),B&&s.tagName.toLowerCase()==="path"&&V[u]&&s.setAttribute("d",V[u])})}function Be(s,u){let g=s.getAttribute("d"),T=et(s);if(B&&V[u]){s.setAttribute("d",B);let G=et(s);s.setAttribute("d",V[u]),T=Math.max(et(s),G),s.setAttribute("d",g)}d[u]=T,s.style.strokeDasharray=Ve(T)}if(l.forEach((s,u)=>{Ir(s);let g=s.tagName.toLowerCase()==="path";g?V.push(s.getAttribute("d")??""):V.push(""),Be(s,u);let T=d[u];B&&(g?Hr(V[V.length-1],B,s):I(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),t?(s.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(s.style.opacity="1"),he&&(s.style.stroke=he),Ae!==null&&(s.style.strokeWidth=`${Ae}`),ce!==null&&(s.style.fillOpacity=`${ce}`),B&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",B)):(s.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ye&&(s.style.stroke=ye),le!==null&&(s.style.strokeWidth=`${le}`),be!==null&&(s.style.fillOpacity=`${be}`))}),t)return J&&(e.style.clipPath=we(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};J&&(e.style.clipPath=we(y==="reverse"?1:0));let Ot=typeof f=="string"?nt(f):null;function gr(){return!(F===!1||Me||oe&&!1||!Or()||!l.length||!Ot||J||p!=="y"||_||c!==1||E!==0||R||b||N!==!1||B||W||ae||x>0||$e||X||te||de||Re||ge||ue||w!=null||L!=null||U!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function yr(){let s=++Dr,u=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,T=`--svg-scroll-draw-${s}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,$=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,$+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${u}{from{${j}}to{${$}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${u}{animation-name:${u};animation-duration:auto;animation-timing-function:${Ot};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function Z(S,A){S.style.setProperty("--ssd-len",String(d[A])),S.style.strokeDasharray=Ve(d[A]),S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(u)}l.forEach(Z);let Y=!1,ne=-1;function ie(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=ke({top:S.top,height:S.height},Ze(),kt(),He,We);return q(H(Ze(),A,Q,c))}return{destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(u),S.style.removeProperty("--ssd-len"),S.style.animationPlayState=""}),D.remove()},replay(){Y=!1,ne=-1,l.forEach(Z)},pause(){Y=!0,l.forEach(S=>{S.style.animationPlayState="paused"})},resume(){Y&&(Y=!1,l.forEach(S=>{S.style.animationPlayState="running"}))},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=!0,l.forEach((Q,Se)=>{Q.classList.remove(u),Q.style.strokeDashoffset=y==="reverse"?`${d[Se]*A}`:`${d[Se]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`)})},getProgress(){return ie()},refresh(){l.forEach((S,A)=>{Be(S,A),S.style.setProperty("--ssd-len",String(d[A]))})}}}if(gr())return gt(yr());function hr(){let s=Math.max(1,P),u=J?s:s*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=!1;function re(ne){let ie=!0,S=Math.min(1,Math.max(0,ne/u));if(J){let A=Math.min(1,Math.max(0,ne/s)),Q=q(A);me=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=we(y==="reverse"?1-Q:Q),$e?.(Q),A<1&&(ie=!1)}else{l.forEach((Q,Se)=>{let wr=Se*E*s,Ft=Math.min(1,Math.max(0,(ne-wr)/s));yt(Q,Se,q(Ft),y),Ft<1&&(ie=!1)});let A=q(S);me=A,$e?.(A),e.style.setProperty("--scroll-draw-progress",String(A))}if(W){let A=q(S);for(let Q in W){let Se=parseFloat(Q);A>=Se&&!Ie.has(Se)&&(Ie.add(Se),W[Q]?.())}}return ie}function j(ne){if(se)return;let ie=ne-g;ve||(ve=!0,X?.());let S=re(ie);if(S&&!z){z=!0,re(u),te?.(),De<(ae==="infinite"?1/0:ae??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),ve=!1,z=!1,Ie.clear(),ht(),Ee=requestAnimationFrame(j)},pe));return}S||(Ee=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Ee),clearTimeout(Oe),g=performance.now(),T=0,se=!1,ve=!1,z=!1,De=0,G=!0,me=0,Ie.clear(),ht(),Ee=requestAnimationFrame(j)}let D=new IntersectionObserver(ne=>{ne.forEach(ie=>{ie.isIntersecting&&!(R&&z)?$():!ie.isIntersecting&&!R&&!z&&(cancelAnimationFrame(Ee),clearTimeout(Oe),G=!1)})},{root:_??null,threshold:K,rootMargin:Ge}),Z;function Y(){clearTimeout(Z),Z=setTimeout(()=>l.forEach(Be),150)}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(Z)},replay(){De=0,$()},pause(){se||!G||(se=!0,T=performance.now()-g,cancelAnimationFrame(Ee))},resume(){se&&(se=!1,G=!0,g=performance.now()-T,Ee=requestAnimationFrame(j))},seek(ne){let ie=Math.min(1,Math.max(0,ne));me=ie,se=!0,T=ie*u,g=performance.now()-T,cancelAnimationFrame(Ee),re(T)},getProgress(){return me},refresh(){clearTimeout(Z),l.forEach(Be)}}}if(Me)return gt(hr());$t();let It=()=>H(Ze(),C,Pe,1);function Rt(){z=!0,te?.(),De<(ae==="infinite"?1/0:ae)&&(De++,Oe=setTimeout(()=>{pt=!0},pe))}function Ht(){ft=-1,Ue=[],ve=!1,z=!1,pt=!1,Ie.clear(),ht(),Ne=!0}function br(){let s=performance.now(),u=Ze();if(pt&&It()%1&&Ht(),!Ne&&N===!1&&u===Pt)return;Ne=!1,Pt=u;let g=c;if(N!==!1){let $=s-Lt,D=$>0?Math.abs(u-(Je<0?u:Je))/$:0;g=c*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Je=u,Lt=s;let T=b?Xe===-1||u>=Xe?"forward":"reverse":y;Xe=u;let G=k-M,re=!0,j=G===0?0:(u-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&de?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ge?.(),Fe>0&&j<=0&&ue?.()),Fe=j,J){let $=Dt(0,H(u,M,k,g));me=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=we(D),$e?.($),!ve&&H(u,M,k,g)>0&&(ve=!0,X?.()),$>=1&&!z?Rt():$<1&&!R&&(z=!1);return}if(l.forEach(($,D)=>{let Z=D*O*G,Y=Dt(D,H(u,M+Z,k+Z,g));yt($,D,Y,T),D===0&&(me=Y,$e?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=!1)}),W){let $=q(H(u,M,k,g));for(let D in W){let Z=parseFloat(D);$>=Z&&!Ie.has(Z)&&(Ie.add(Z),W[D]?.())}}!ve&&H(u,M,k,g)>0&&(ve=!0,X?.()),re&&!z?Rt():!re&&!R&&(z=!1)}let qe=Ce(_??window,[e],It,br,()=>{let s=d.join();l.forEach(Be),$t(),Ne=!0,d.join()!==s&&je()}),bt=x>0;function je(){qe.hold(se||bt)}let Nt;return bt&&(Nt=setTimeout(()=>{bt=!1,je()},x)),je(),gt({destroy(){clearTimeout(Oe),clearTimeout(Nt),qe.off(),At()},replay(){Ht(),Xe=-1,Je=-1,De=0,se=!1,me=0,clearTimeout(Oe),je()},pause(){se=!0,qe.hold(!0)},resume(){se&&(se=!1,Ne=!0,je())},seek(s){let u=Math.min(1,Math.max(0,s));me=u,ft=u,Ue=[],se=!0,qe.hold(!0),dr(u,y),Ne=!0},getProgress(){return me},refresh:qe.remeasure},()=>({tStart:M,tEnd:k}))}function er(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?lt(n,r):(I("Container not found:",e),t)}function _r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function tr(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let o=[],i=[],a=n[2].trim();if(a)for(let c of a.split(/[\s,]+/)){let m=c.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"")}r.push({fn:n[1],nums:o,units:i})}return r}function Vr(e,r,t){let n=tr(e),o=tr(r);return n.length===0||n.length!==o.length?t<1?e:r:n.map((i,a)=>{let c=o[a];return i.fn!==c.fn||i.nums.length!==c.nums.length?t<1?`${i.fn}(${i.nums.map((m,f)=>`${m}${i.units[f]}`).join(", ")})`:`${c.fn}(${c.nums.map((m,f)=>`${m}${c.units[f]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,f)=>`${m+(c.nums[f]-m)*t}${i.units[f]}`).join(", ")})`}).join(" ")}function rr(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),o=String(r);if(_r(n))return tt(n,o,t);if(n.includes("("))return Vr(n,o,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let c=parseFloat(i[1]),m=parseFloat(a[1]);return`${c+(m-c)*t}${i[2]||a[2]}`}return t<1?n:o}function zr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Gr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Wr=0,nr="--scroll-draw-progress";function Br(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var sr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tt(e,r){return typeof window>"u"?sr:r.respectReducedMotion===!1?or(e,r,!1):ze(r,(t,n)=>or(e,t,n))}function or(e,r,t){let{props:n,trigger:o={},easing:i="ease-out",speed:a=1,once:c=!1,axis:m="y",scrollContainer:f,native:h=!0,velocityScale:E=!1,triggerElement:y,onProgress:R,onComplete:oe,onEnter:p,onLeave:v,onEnterBack:b,onLeaveBack:x}=r,w=Le(i,"ease-out"),L=xe(o.start||"top bottom"),U=xe(o.end||"bottom top"),W=y??e,N=typeof f=="string"?document.querySelector(f):f??null,K=Object.entries(n).map(([l,d])=>({prop:zr(l),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function Ge(){let l=window.getComputedStyle(e);for(let d of K)d.from===""&&(d.from=l.getPropertyValue(d.prop).trim()||"0")}function ae(){for(let l of K)e.style.setProperty(l.prop,String(l.to))}let pe=new Map;for(let l of[...K.map(d=>d.prop),nr])pe.set(l,e.style.getPropertyValue(l));function B(){for(let[l,d]of pe)d?e.style.setProperty(l,d):e.style.removeProperty(l)}if(t)return ae(),oe?.(),{...sr,destroy:B,getProgress:()=>1};Ge();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Me=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?nt(i):null;function F(){if(!h||!Br()||!P||m!=="y"||N||W!==e||c||a!==1||R||oe||p||v||b||x||E!==!1||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return!1;for(let l of K)if(!Gr.has(l.prop))return!1;return!0}function $e(){let l=`ssd-a-${++Wr}`,d=K.map(C=>`${C.prop}:${C.from}`).join(";"),V=K.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${d}}to{${V}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},ee(),Me(),L,U)};Te(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:k});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),fe(e)},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Pe=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let z of K)e.style.setProperty(z.prop,rr(z.from,z.to,Pe))},getProgress(){let{tStart:C,tEnd:Pe}=k();return w(H(ee(),C,Pe,a))}};return O}if(F())return $e();let X=0,te=0,de=!1,Re=-1,ge=0,ue=0,J=!1,q=NaN,He=-1,We=0,_=W===e?K:[],ye=!1;function he(){let l=e.style,d=_.map(O=>l.getPropertyValue(O.prop)),V=l.transition;_.length&&(l.transition="none"),_.forEach(O=>l.setProperty(O.prop,pe.get(O.prop)??""));let M=Ke(W,N,m);_.forEach((O,C)=>l.setProperty(O.prop,d[C])),_.length&&(e.offsetWidth,l.transition=V);let k=ke(M,M.scroll,Me(),L,U);ye&&Math.abs(k.tStart-X)<1&&Math.abs(k.tEnd-te)<1||(ye=!0,X=k.tStart,te=k.tEnd)}function le(l){e.style.setProperty(nr,String(l));for(let d of K)e.style.setProperty(d.prop,rr(d.from,d.to,l));R?.(l)}function Ae(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&p?.(),q<1&&l>=1&&v?.(),q>=1&&l<1&&b?.(),q>0&&l<=0&&x?.(),q=l}function be(){if(de)return;let l=performance.now(),d=ee(),V=a;if(E!==!1){let C=l-We,Pe=C>0?Math.abs(d-(He<0?d:He))/C:0;V=a*Math.max(.2,1+Pe*(typeof E=="number"?E:1)*.04)}He=d,We=l;let M=te===X?0:(d-X)/(te-X);Ae(M);let k=H(d,X,te,V),O=c?Math.max(Re,w(ge=Math.max(ge,k))):w(k);ue=O,le(O),O>=1&&!J?(J=!0,oe?.()):O<1&&!c&&(J=!1)}let ce=Ce(N??window,[W],()=>H(ee(),X,te,Math.min(a,1)),be,he);he(),te===X&&I("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ge=H(ee(),X,te,a),ue=w(ge),le(ue),Te(e,{type:"animate",getProgress:()=>ue,getTrigger:()=>({tStart:X,tEnd:te})});function we(){de=!0,ce.hold(!0)}return{destroy(){de=!0,ce.off(),B(),fe(e)},replay(){Re=-1,ge=0,J=!1,ue=0,de=!1,le(0),ce.hold(!1)},pause:we,resume(){de&&(de=!1,ce.hold(!1))},seek(l){let d=Math.min(1,Math.max(0,l));ue=d,Re=d,ge=0,we(),le(d)},getProgress(){return ue},refresh:ce.remeasure}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ir(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;return t?Tt(t,r):(I("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 I("scrollParallax: element not found:",e),ct;let{speed:n=.3,axis:o="y",easing:i="linear",trigger:a,onProgress:c}=r,m=-n*100,f=t.style,h=!!t.ownerSVGElement,E=f.getPropertyValue("transform-box");h&&f.setProperty("transform-box","fill-box");let y=Tt(t,{props:o==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:c});return h?{...y,destroy(){y.destroy(),f.setProperty("transform-box",E)}}:y}var Mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,r){if(typeof window>"u")return Mt;let t=typeof e=="string"?document.querySelector(e):e;return t?ze(r,(n,o)=>qr(t,n,o)):(I("scrollCounter: element not found:",e),Mt)}function qr(e,r,t){let{from:n=0,to:o,format:i,easing:a="ease-out",trigger:c={},once:m=!0,decimals:f,onComplete:h}=r,E=f!==void 0?P=>P.toFixed(f):i??(P=>String(Math.round(P))),y=Le(a,"ease-out"),R=xe(c.start||"top 80%"),oe=xe(c.end||"top 20%");if(t)return e.textContent=E(o),h?.(),{...Mt,getProgress:()=>1};let p=0,v=0,b=!1,x=-1,w=0,L=0,U=!1,W=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),F=ke({top:P.top,height:P.height},W(),N(),R,oe);b&&Math.abs(F.tStart-p)<1&&Math.abs(F.tEnd-v)<1||(b=!0,p=F.tStart,v=F.tEnd)}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function ae(P){e.textContent=E(n+(o-n)*P),e.style.setProperty("--scroll-draw-progress",String(P))}let pe=()=>H(W(),p,v,1);function B(){let P=pe(),F=m?Math.max(x,y(w=Math.max(w,P))):y(P);L=F,ae(F),F>=1&&!U?(U=!0,h?.()):F<1&&!m&&(U=!1)}K();{w=H(W(),p,v,1);let P=y(w);L=P,ae(P)}let ee=Ce(window,[e],pe,B,K);Te(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:p,tEnd:v})});let Me=()=>ee.hold(!1);return{destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ge),fe(e)},replay(){x=-1,w=0,U=!1,L=0,ae(0),Me()},pause:()=>ee.hold(!0),resume:Me,seek(P){let F=Math.min(1,Math.max(0,P));L=F,x=F,w=0,ee.hold(!0),ae(F)},getProgress(){return L}}}var cr="http://www.w3.org/2000/svg",jr="cinematic-photo",fr=e=>e<0?0:e>1?1:e;function ut(e){let r=parseFloat(e);return Number.isFinite(r)?fr(r/100):0}function ur(e){return Le(e)}var mr=e=>({destroy(){},getProgress:()=>e}),mt=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||I("Cinematic: wrapper not found:",r.wrapper)}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return mr(0);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 o=[];for(let p of r.scenes){if(p.background){let b=document.createElement("img");b.id=jr,b.src=p.background,b.alt="",b.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(b)}let v=p.animations.filter(b=>b.type==="draw");if(v.length){let b=document.createElementNS(cr,"svg");b.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),b.setAttribute("preserveAspectRatio","xMidYMid meet"),b.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(b);for(let x of v){let w=document.createElementNS(cr,"path");w.id=x.target.replace(/^#/,""),w.setAttribute("d",x.d),w.setAttribute("fill","none"),w.setAttribute("stroke",x.stroke),w.setAttribute("stroke-width",String(x.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let L=x.length||w.getTotalLength?.()||0;w.style.strokeDasharray=Ve(L),w.style.strokeDashoffset=String(L),b.appendChild(w),o.push({kind:"draw",el:w,start:ut(x.start),end:ut(x.end),ease:ur(x.easing),length:L})}}for(let b of p.animations){if(b.type!=="fade")continue;let x=n.querySelector(b.target)??document.querySelector(b.target);x&&(x.style.opacity=String(b.from),o.push({kind:"fade",el:x,start:ut(b.start),end:ut(b.end),ease:ur("ease-in-out"),from:b.from,to:b.to}))}}let i=0,a=null;for(let p=t.parentElement;p?.parentElement;p=p.parentElement)if(/[ao]/.test(getComputedStyle(p).overflowY)&&p.scrollHeight>p.clientHeight&&(p!==document.body||/[aoh]/.test(getComputedStyle(p.parentElement).overflowY))){a=p;break}let c=0,m=0,f=()=>{let p=t.getBoundingClientRect().top;c=a?p-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:p+window.scrollY,m=c+Math.max(0,t.offsetHeight-(a?a.clientHeight:window.innerHeight))},h=()=>{let p=a?a.scrollTop:window.scrollY;return m<=c?p>=c?1:0:H(p,c,m,1)},E=p=>{for(let v of o){let b=v.end-v.start,x=b<=0?p>=v.end?1:0:fr((p-v.start)/b),w=v.ease(x);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),mr(1);let y=()=>{i=h(),E(i)};f(),y();let R=Ce(a||window,[t],h,y,f);Te(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:c,tEnd:m})});let oe=ot(p=>{p&&(oe(),R.off(),fe(t),i=1,E(1))});return{destroy(){oe(),R.off(),fe(t)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let o=JSON.stringify(e.map(E=>this.getAttribute(E)));if(this.instance&&o===this.key)return;this.instance?.destroy(),this.key=o;let i={},a=this.getAttribute("speed"),c=this.getAttribute("easing"),m=this.getAttribute("stagger"),f=this.getAttribute("direction"),h=this.getAttribute("selector");a&&(i.speed=parseFloat(a)),c&&(i.easing=c),m&&(i.stagger=parseFloat(m)),f&&(i.direction=f),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=lt(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}r.observedAttributes=e,customElements.define("scroll-draw",r)}return Mr(Yr);})();
3
+ <div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}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",o,{passive:!0}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove()}}}var Zt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Kt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Hr(e,r,t){if(!!1)return;let n=(e.match(Kt)??[]).join("").toUpperCase(),o=(r.match(Kt)??[]).join("").toUpperCase(),i=(e.match(Zt)??[]).length,a=(r.match(Zt)??[]).length;if(n!==o){R(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==a&&R(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t)}function Nr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),c=n[o++]??a;return String(+(a+(c-a)*t).toFixed(4))})}function at(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ve(r,(t,n)=>Fr(e,t,n))}function Fr(e,r,t){let{preset:n,...o}=r,i=n?{...tt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:c=1,fade:m=!1,easing:f="linear",trigger:h={},stagger:E=0,direction:b="forward",once:L=!1,debug:F=!1,axis:d="y",scrollContainer:v,autoReverse:y=!1,delay:S=0,strokeColor:w,strokeWidth:H,fillOpacity:se,waypoints:X,velocityScale:_=!1,threshold:q=0,rootMargin:De="0px",repeat:fe=0,repeatDelay:le=0,morphTo:V,clip:A,autoplay:D=!1,duration:Ye=1e3,native:mt=!0,onProgress:ke,onStart:J,onComplete:ee,onEnter:pe,onLeave:Ie,onEnterBack:de,onLeaveBack:ce}=i,Z=A===!0?"left":typeof A=="string"?A:!1,j=Ae(f),Re=Se(h.start||"top bottom"),ze=Se(h.end||"bottom top"),z=typeof v=="string"?document.querySelector(v):v??null,ge=Array.isArray(w)?w[0]:null,ye=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ie=Array.isArray(H)?H[0]:null,Te=Array.isArray(H)?H[1]:typeof H=="number"?H:null,he=Array.isArray(se)?se[0]:null,ae=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function be(s){let u=s*100;switch(Z){case"right":return`inset(0 0 0 ${100-u}%)`;case"top":return`inset(0 0 ${100-u}% 0)`;case"bottom":return`inset(${100-u}% 0 0 0)`;case"center":return`circle(${s*150}% at 50% 50%)`;default:return`inset(0 ${100-u}% 0 0)`}}let l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],G=[],M=0,k=0,I=E,C=0,Me=0,W=!1,we=!1,ve=0,ft=-1,Qe=[],Ue=-1,ne=!1,ue=0,Ce=0,$e,pt=!1,dt=null;function At(){dt?.destroy(),dt=null}let Oe=new Set,Pt=NaN,He=!0,Xe=-1,Lt=performance.now(),Ne=NaN;function Je(){return z?d==="x"?z.scrollLeft:z.scrollTop:d==="x"?window.scrollX:window.scrollY}function kt(){return z?d==="x"?z.clientWidth:z.clientHeight:d==="x"?window.innerWidth:window.innerHeight}function Ct(){let s=Ze(e,z,d);return Pe(s,s.scroll,kt(),Re,ze)}function pr(){let s=k-M,u=l.length-1,g=z??document.documentElement,T=d==="x"?"Width":"Height";if(I=E,E>0&&u>0&&s>0){let Y=g[`scroll${T}`]-g[`client${T}`]-1-M-s/c;Y>=0&&(I=Math.min(E,Y/(u*s)))}let B=Math.max(0,u)*I*s,te=s/Math.min(c,1);C=M+Math.min(0,B,te,B+te),Me=M+Math.max(0,B,te,B+te)}function $t(){({tStart:M,tEnd:k}=Ct()),pr(),F&&!1&&(At(),dt=Rr(M,k,d))}function gt(s,u=Ct){xe(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:u});let g=s.destroy;return s.destroy=()=>{g.call(s),me(e)},s}function Ot(s,u){return L&&!y?Math.max(ft,j(Qe[s]=Math.max(Qe[s]??0,u))):j(u)}function dr(s,u){if(e.style.setProperty("--scroll-draw-progress",String(s)),Z){let g=u==="reverse"?1-s:s;e.style.clipPath=be(g);return}l.forEach((g,T)=>yt(g,T,s,u))}function yt(s,u,g,T){s.style.strokeDashoffset=T==="reverse"?`${p[u]*g}`:`${p[u]*(1-g)}`,m&&(s.style.opacity=T==="reverse"?`${1-g}`:`${g}`),ge&&ye?s.style.stroke=et(ge,ye,g):ye&&(s.style.stroke=ye),ie!==null&&Te!==null?s.style.strokeWidth=`${ie+(Te-ie)*g}`:Te!==null&&(s.style.strokeWidth=`${Te}`),he!==null&&ae!==null?s.style.fillOpacity=`${he+(ae-he)*g}`:ae!==null&&(s.style.fillOpacity=`${ae}`),V&&s.tagName.toLowerCase()==="path"&&G[u]&&s.setAttribute("d",Nr(G[u],V,g))}function ht(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=be(b==="reverse"?1:0);return}l.forEach((s,u)=>{s.style.strokeDasharray=_e(p[u]),s.style.strokeDashoffset=b==="reverse"?"0":`${p[u]}`,m?s.style.opacity=b==="reverse"?"1":"0":s.style.opacity="",ge&&(s.style.stroke=ge),ie!==null&&(s.style.strokeWidth=`${ie}`),he!==null&&(s.style.fillOpacity=`${he}`),V&&s.tagName.toLowerCase()==="path"&&G[u]&&s.setAttribute("d",G[u])})}function Ge(s,u){let g=s.getAttribute("d"),T=Ke(s);if(V&&G[u]){s.setAttribute("d",V);let B=Ke(s);s.setAttribute("d",G[u]),T=Math.max(Ke(s),B),s.setAttribute("d",g)}p[u]=T,s.style.strokeDasharray=_e(T)}if(l.forEach((s,u)=>{Ir(s);let g=s.tagName.toLowerCase()==="path";g?G.push(s.getAttribute("d")??""):G.push(""),Ge(s,u);let T=p[u];V&&(g?Hr(G[G.length-1],V,s):R(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),t?(s.style.strokeDashoffset=b==="reverse"?`${T}`:"0",m&&(s.style.opacity="1"),ye&&(s.style.stroke=ye),Te!==null&&(s.style.strokeWidth=`${Te}`),ae!==null&&(s.style.fillOpacity=`${ae}`),V&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",V)):(s.style.strokeDashoffset=b==="reverse"?"0":`${T}`,m?s.style.opacity=b==="reverse"?"1":"0":s.style.opacity="",ge&&(s.style.stroke=ge),ie!==null&&(s.style.strokeWidth=`${ie}`),he!==null&&(s.style.fillOpacity=`${he}`))}),t)return Z&&(e.style.clipPath=be(1)),ee?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=be(b==="reverse"?1:0));let Dt=typeof f=="string"?rt(f):null;function gr(){return!(mt===!1||D||F&&!1||!Dr()||!l.length||!Dt||Z||d!=="y"||z||c!==1||E!==0||L||y||_!==!1||V||X||fe||S>0||ke||J||ee||pe||Ie||de||ce||w!=null||H!=null||se!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function yr(){let s=++Or,u=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,T=`--svg-scroll-draw-${s}`,B=b==="reverse"?"0":"var(--ssd-len)",te=b==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${B};`,$=`stroke-dashoffset:${te};`;m&&(Y+=`opacity:${b==="reverse"?1:0};`,$+=`opacity:${b==="reverse"?0:1};`);let O=document.createElement("style");O.setAttribute("data-svg-scroll-draw",""),O.textContent=`@keyframes ${u}{from{${Y}}to{${$}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${u}{animation-name:${u};animation-duration:auto;animation-timing-function:${Dt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(g);function K(x,P){x.style.setProperty("--ssd-len",String(p[P])),x.style.strokeDasharray=_e(p[P]),x.style.strokeDashoffset="",x.style.opacity="",x.style.animationPlayState="",x.classList.add(u)}l.forEach(K);let Q=!1,re=-1;function oe(){if(re>=0)return re;let x=e.getBoundingClientRect(),{tStart:P,tEnd:U}=Pe({top:x.top,height:x.height},Je(),kt(),Re,ze);return j(N(Je(),P,U,c))}return{destroy(){e.classList.remove(g),l.forEach(x=>{x.classList.remove(u),x.style.removeProperty("--ssd-len"),x.style.animationPlayState=""}),O.remove()},replay(){Q=!1,re=-1,l.forEach(K)},pause(){Q=!0,l.forEach(x=>{x.style.animationPlayState="paused"})},resume(){Q&&(Q=!1,l.forEach(x=>{x.style.animationPlayState="running"}))},seek(x){let P=Math.min(1,Math.max(0,x));re=P,Q=!0,l.forEach((U,Ee)=>{U.classList.remove(u),U.style.strokeDashoffset=b==="reverse"?`${p[Ee]*P}`:`${p[Ee]*(1-P)}`,m&&(U.style.opacity=b==="reverse"?`${1-P}`:`${P}`)})},getProgress(){return oe()},refresh(){l.forEach((x,P)=>{Ge(x,P),x.style.setProperty("--ssd-len",String(p[P]))})}}}if(gr())return gt(yr());function hr(){let s=Math.max(1,Ye),u=Z?s:s*(1+Math.max(0,l.length-1)*E),g=0,T=0,B=!1;function te(re){let oe=!0,x=Math.min(1,Math.max(0,re/u));if(Z){let P=Math.min(1,Math.max(0,re/s)),U=j(P);ue=U,e.style.setProperty("--scroll-draw-progress",String(U)),e.style.clipPath=be(b==="reverse"?1-U:U),ke?.(U),P<1&&(oe=!1)}else{l.forEach((U,Ee)=>{let wr=Ee*E*s,Ft=Math.min(1,Math.max(0,(re-wr)/s));yt(U,Ee,j(Ft),b),Ft<1&&(oe=!1)});let P=j(x);ue=P,ke?.(P),e.style.setProperty("--scroll-draw-progress",String(P))}if(X){let P=j(x);for(let U in X){let Ee=parseFloat(U);P>=Ee&&!Oe.has(Ee)&&(Oe.add(Ee),X[U]?.())}}return oe}function Y(re){if(ne)return;let oe=re-g;we||(we=!0,J?.());let x=te(oe);if(x&&!W){W=!0,te(u),ee?.(),Ce<(fe==="infinite"?1/0:fe??0)&&(Ce++,$e=setTimeout(()=>{g=performance.now(),we=!1,W=!1,Oe.clear(),ht(),ve=requestAnimationFrame(Y)},le));return}x||(ve=requestAnimationFrame(Y))}function $(){cancelAnimationFrame(ve),clearTimeout($e),g=performance.now(),T=0,ne=!1,we=!1,W=!1,Ce=0,B=!0,ue=0,Oe.clear(),ht(),ve=requestAnimationFrame(Y)}let O=new IntersectionObserver(re=>{re.forEach(oe=>{oe.isIntersecting&&!(L&&W)?$():!oe.isIntersecting&&!L&&!W&&(cancelAnimationFrame(ve),clearTimeout($e),B=!1)})},{root:z??null,threshold:q,rootMargin:De}),K;function Q(){clearTimeout(K),K=setTimeout(()=>l.forEach(Ge),150)}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),S>0?setTimeout(()=>O.observe(e),S):O.observe(e),{destroy(){cancelAnimationFrame(ve),clearTimeout($e),O.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(K)},replay(){Ce=0,$()},pause(){ne||!B||(ne=!0,T=performance.now()-g,cancelAnimationFrame(ve))},resume(){ne&&(ne=!1,B=!0,g=performance.now()-T,ve=requestAnimationFrame(Y))},seek(re){let oe=Math.min(1,Math.max(0,re));ue=oe,ne=!0,T=oe*u,g=performance.now()-T,cancelAnimationFrame(ve),te(T)},getProgress(){return ue},refresh(){clearTimeout(K),l.forEach(Ge)}}}if(D)return gt(hr());$t();let It=()=>N(Je(),C,Me,1);function Rt(){W=!0,ee?.(),Ce<(fe==="infinite"?1/0:fe)&&(Ce++,$e=setTimeout(()=>{pt=!0},le))}function Ht(){ft=-1,Qe=[],we=!1,W=!1,pt=!1,Oe.clear(),ht(),He=!0}function br(){let s=performance.now(),u=Je();if(pt&&It()%1&&Ht(),!He&&_===!1&&u===Pt)return;He=!1,Pt=u;let g=c;if(_!==!1){let $=s-Lt,O=$>0?Math.abs(u-(Xe<0?u:Xe))/$:0;g=c*Math.max(.2,1+O*(typeof _=="number"?_:1)*.04)}Xe=u,Lt=s;let T=y?Ue===-1||u>=Ue?"forward":"reverse":b;Ue=u;let B=k-M,te=!0,Y=B===0?0:(u-M)/B;if(isNaN(Ne)||(Ne<=0&&Y>0&&pe?.(),Ne<1&&Y>=1&&Ie?.(),Ne>=1&&Y<1&&de?.(),Ne>0&&Y<=0&&ce?.()),Ne=Y,Z){let $=Ot(0,N(u,M,k,g));ue=$,e.style.setProperty("--scroll-draw-progress",String($));let O=T==="reverse"?1-$:$;e.style.clipPath=be(O),ke?.($),!we&&N(u,M,k,g)>0&&(we=!0,J?.()),$>=1&&!W?Rt():$<1&&!L&&(W=!1);return}if(l.forEach(($,O)=>{let K=O*I*B,Q=Ot(O,N(u,M+K,k+K,g));yt($,O,Q,T),O===0&&(ue=Q,ke?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(te=!1)}),X){let $=j(N(u,M,k,g));for(let O in X){let K=parseFloat(O);$>=K&&!Oe.has(K)&&(Oe.add(K),X[O]?.())}}!we&&N(u,M,k,g)>0&&(we=!0,J?.()),te&&!W?Rt():!te&&!L&&(W=!1)}let We=Le(z??window,[e],It,br,()=>{let s=p.join();l.forEach(Ge),$t(),He=!0,p.join()!==s&&Be()}),bt=S>0;function Be(){We.hold(ne||bt)}let Nt;return bt&&(Nt=setTimeout(()=>{bt=!1,Be()},S)),Be(),gt({destroy(){clearTimeout($e),clearTimeout(Nt),We.off(),At()},replay(){Ht(),Ue=-1,Xe=-1,Ce=0,ne=!1,ue=0,clearTimeout($e),Be()},pause(){ne=!0,We.hold(!0)},resume(){ne&&(ne=!1,He=!0,Be())},seek(s){let u=Math.min(1,Math.max(0,s));ue=u,ft=u,Qe=[],ne=!0,We.hold(!0),dr(u,b),He=!0},getProgress(){return ue},refresh:We.remeasure},()=>({tStart:M,tEnd:k}))}function er(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?at(n,r):(R("Container not found:",e),t)}function _r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function tr(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let o=[],i=[],a=n[2].trim();if(a)for(let c of a.split(/[\s,]+/)){let m=c.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"")}r.push({fn:n[1],nums:o,units:i})}return r}function Vr(e,r,t){let n=tr(e),o=tr(r);return n.length===0||n.length!==o.length?t<1?e:r:n.map((i,a)=>{let c=o[a];return i.fn!==c.fn||i.nums.length!==c.nums.length?t<1?`${i.fn}(${i.nums.map((m,f)=>`${m}${i.units[f]}`).join(", ")})`:`${c.fn}(${c.nums.map((m,f)=>`${m}${c.units[f]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,f)=>`${m+(c.nums[f]-m)*t}${i.units[f]}`).join(", ")})`}).join(" ")}function rr(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),o=String(r);if(_r(n))return et(n,o,t);if(n.includes("("))return Vr(n,o,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let c=parseFloat(i[1]),m=parseFloat(a[1]);return`${c+(m-c)*t}${i[2]||a[2]}`}return t<1?n:o}function zr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Gr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Wr=0,nr="--scroll-draw-progress";function Br(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var sr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tt(e,r){return typeof window>"u"?sr:r.respectReducedMotion===!1?or(e,r,!1):Ve(r,(t,n)=>or(e,t,n))}function or(e,r,t){let{props:n,trigger:o={},easing:i="ease-out",speed:a=1,once:c=!1,axis:m="y",scrollContainer:f,native:h=!0,velocityScale:E=!1,triggerElement:b,onProgress:L,onComplete:F,onEnter:d,onLeave:v,onEnterBack:y,onLeaveBack:S}=r,w=Ae(i,"ease-out"),H=Se(o.start||"top bottom"),se=Se(o.end||"bottom top"),X=b??e,_=typeof f=="string"?document.querySelector(f):f??null,q=Object.entries(n).map(([l,p])=>({prop:zr(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function De(){let l=window.getComputedStyle(e);for(let p of q)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0")}function fe(){for(let l of q)e.style.setProperty(l.prop,String(l.to))}let le=new Map;for(let l of[...q.map(p=>p.prop),nr])le.set(l,e.style.getPropertyValue(l));function V(){for(let[l,p]of le)p?e.style.setProperty(l,p):e.style.removeProperty(l)}if(t)return fe(),F?.(),{...sr,destroy:V,getProgress:()=>1};De();let A=()=>_?m==="x"?_.scrollLeft:_.scrollTop:m==="x"?window.scrollX:window.scrollY,D=()=>_?m==="x"?_.clientWidth:_.clientHeight:m==="x"?window.innerWidth:window.innerHeight,Ye=typeof i=="string"?rt(i):null;function mt(){if(!h||!Br()||!Ye||m!=="y"||_||X!==e||c||a!==1||L||F||d||v||y||S||E!==!1||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return!1;for(let l of q)if(!Gr.has(l.prop))return!1;return!0}function ke(){let l=`ssd-a-${++Wr}`,p=q.map(C=>`${C.prop}:${C.from}`).join(";"),G=q.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${p}}to{${G}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Ye};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let k=()=>{let C=e.getBoundingClientRect();return Pe({top:C.top,height:C.height},A(),D(),H,se)};xe(e,{type:"animate",getProgress:()=>I.getProgress(),getTrigger:k});let I={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",V(),me(e)},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Me=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let W of q)e.style.setProperty(W.prop,rr(W.from,W.to,Me))},getProgress(){let{tStart:C,tEnd:Me}=k();return w(N(A(),C,Me,a))}};return I}if(mt())return ke();let J=0,ee=0,pe=!1,Ie=-1,de=0,ce=0,Z=!1,j=NaN,Re=-1,ze=0,z=X===e?q:[],ge=!1;function ye(){let l=e.style,p=z.map(I=>l.getPropertyValue(I.prop)),G=l.transition;z.length&&(l.transition="none"),z.forEach(I=>l.setProperty(I.prop,le.get(I.prop)??""));let M=Ze(X,_,m);z.forEach((I,C)=>l.setProperty(I.prop,p[C])),z.length&&(e.offsetWidth,l.transition=G);let k=Pe(M,M.scroll,D(),H,se);ge&&Math.abs(k.tStart-J)<1&&Math.abs(k.tEnd-ee)<1||(ge=!0,J=k.tStart,ee=k.tEnd)}function ie(l){e.style.setProperty(nr,String(l));for(let p of q)e.style.setProperty(p.prop,rr(p.from,p.to,l));L?.(l)}function Te(l){if(isNaN(j)){j=l;return}j<=0&&l>0&&d?.(),j<1&&l>=1&&v?.(),j>=1&&l<1&&y?.(),j>0&&l<=0&&S?.(),j=l}function he(){if(pe)return;let l=performance.now(),p=A(),G=a;if(E!==!1){let C=l-ze,Me=C>0?Math.abs(p-(Re<0?p:Re))/C:0;G=a*Math.max(.2,1+Me*(typeof E=="number"?E:1)*.04)}Re=p,ze=l;let M=ee===J?0:(p-J)/(ee-J);Te(M);let k=N(p,J,ee,G),I=c?Math.max(Ie,w(de=Math.max(de,k))):w(k);ce=I,ie(I),I>=1&&!Z?(Z=!0,F?.()):I<1&&!c&&(Z=!1)}let ae=Le(_??window,[X],()=>N(A(),J,ee,Math.min(a,1)),he,ye);ye(),ee===J&&R("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),de=N(A(),J,ee,a),ce=w(de),ie(ce),xe(e,{type:"animate",getProgress:()=>ce,getTrigger:()=>({tStart:J,tEnd:ee})});function be(){pe=!0,ae.hold(!0)}return{destroy(){pe=!0,ae.off(),V(),me(e)},replay(){Ie=-1,de=0,Z=!1,ce=0,pe=!1,ie(0),ae.hold(!1)},pause:be,resume(){pe&&(pe=!1,ae.hold(!1))},seek(l){let p=Math.min(1,Math.max(0,l));ce=p,Ie=p,de=0,be(),ie(p)},getProgress(){return ce},refresh:ae.remeasure}}var lt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ir(e,r){if(typeof window>"u")return lt;let t=typeof e=="string"?document.querySelector(e):e;return t?Tt(t,r):(R("scrollAnimate: element not found:",e),lt)}function ar(e,r={}){if(typeof window>"u")return lt;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return R("scrollParallax: element not found:",e),lt;let{speed:n=.3,axis:o="y",easing:i="linear",trigger:a,onProgress:c}=r,m=-n*100,f=t.style,h=!!t.ownerSVGElement,E=f.getPropertyValue("transform-box");h&&f.setProperty("transform-box","fill-box");let b=Tt(t,{props:o==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:c});return h?{...b,destroy(){b.destroy(),f.setProperty("transform-box",E)}}:b}var qr=({decimals:e,format:r})=>e!==void 0?t=>t.toFixed(e):r??(t=>String(Math.round(t)));var Mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,r){if(typeof window>"u")return Mt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ve(r,(n,o)=>jr(t,n,o)):(R("scrollCounter: element not found:",e),Mt)}function jr(e,r,t){let{from:n=0,to:o,easing:i="ease-out",trigger:a={},once:c=!0,onComplete:m}=r,f=qr(r),h=Ae(i,"ease-out"),E=Se(a.start||"top 80%"),b=Se(a.end||"top 20%");if(t)return e.textContent=f(o),m?.(),{...Mt,getProgress:()=>1};let L=0,F=0,d=!1,v=-1,y=0,S=0,w=!1,H=()=>window.scrollY,se=()=>window.innerHeight;function X(){let A=e.getBoundingClientRect(),D=Pe({top:A.top,height:A.height},H(),se(),E,b);d&&Math.abs(D.tStart-L)<1&&Math.abs(D.tEnd-F)<1||(d=!0,L=D.tStart,F=D.tEnd)}let _=e.style.getPropertyValue("--scroll-draw-progress");function q(A){e.textContent=f(n+(o-n)*A),e.style.setProperty("--scroll-draw-progress",String(A))}let De=()=>N(H(),L,F,1);function fe(){let A=De(),D=c?Math.max(v,h(y=Math.max(y,A))):h(A);S=D,q(D),D>=1&&!w?(w=!0,m?.()):D<1&&!c&&(w=!1)}X();{y=N(H(),L,F,1);let A=h(y);S=A,q(A)}let le=Le(window,[e],De,fe,X);xe(e,{type:"counter",getProgress:()=>S,getTrigger:()=>({tStart:L,tEnd:F})});let V=()=>le.hold(!1);return{destroy(){le.off(),e.style.setProperty("--scroll-draw-progress",_),me(e)},replay(){v=-1,y=0,w=!1,S=0,q(0),V()},pause:()=>le.hold(!0),resume:V,seek(A){let D=Math.min(1,Math.max(0,A));S=D,v=D,y=0,le.hold(!0),q(D)},getProgress(){return S}}}var cr="http://www.w3.org/2000/svg",Yr="cinematic-photo",fr=e=>e<0?0:e>1?1:e;function ct(e){let r=parseFloat(e);return Number.isFinite(r)?fr(r/100):0}function ur(e){return Ae(e)}var mr=e=>({destroy(){},getProgress:()=>e}),ut=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||R("Cinematic: wrapper not found:",r.wrapper)}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return mr(0);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 o=[];for(let d of r.scenes){if(d.background){let y=document.createElement("img");y.id=Yr,y.src=d.background,y.alt="",y.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(y)}let v=d.animations.filter(y=>y.type==="draw");if(v.length){let y=document.createElementNS(cr,"svg");y.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),y.setAttribute("preserveAspectRatio","xMidYMid meet"),y.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(y);for(let S of v){let w=document.createElementNS(cr,"path");w.id=S.target.replace(/^#/,""),w.setAttribute("d",S.d),w.setAttribute("fill","none"),w.setAttribute("stroke",S.stroke),w.setAttribute("stroke-width",String(S.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let H=S.length||w.getTotalLength?.()||0;w.style.strokeDasharray=_e(H),w.style.strokeDashoffset=String(H),y.appendChild(w),o.push({kind:"draw",el:w,start:ct(S.start),end:ct(S.end),ease:ur(S.easing),length:H})}}for(let y of d.animations){if(y.type!=="fade")continue;let S=n.querySelector(y.target)??document.querySelector(y.target);S&&(S.style.opacity=String(y.from),o.push({kind:"fade",el:S,start:ct(y.start),end:ct(y.end),ease:ur("ease-in-out"),from:y.from,to:y.to}))}}let i=0,a=null;for(let d=t.parentElement;d?.parentElement;d=d.parentElement)if(/[ao]/.test(getComputedStyle(d).overflowY)&&d.scrollHeight>d.clientHeight&&(d!==document.body||/[aoh]/.test(getComputedStyle(d.parentElement).overflowY))){a=d;break}let c=0,m=0,f=()=>{let d=t.getBoundingClientRect().top;c=a?d-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:d+window.scrollY,m=c+Math.max(0,t.offsetHeight-(a?a.clientHeight:window.innerHeight))},h=()=>{let d=a?a.scrollTop:window.scrollY;return m<=c?d>=c?1:0:N(d,c,m,1)},E=d=>{for(let v of o){let y=v.end-v.start,S=y<=0?d>=v.end?1:0:fr((d-v.start)/y),w=v.ease(S);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),mr(1);let b=()=>{i=h(),E(i)};f(),b();let L=Le(a||window,[t],h,b,f);xe(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:c,tEnd:m})});let F=nt(d=>{d&&(F(),L.off(),me(t),i=1,E(1))});return{destroy(){F(),L.off(),me(t)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let o=JSON.stringify(e.map(E=>this.getAttribute(E)));if(this.instance&&o===this.key)return;this.instance?.destroy(),this.key=o;let i={},a=this.getAttribute("speed"),c=this.getAttribute("easing"),m=this.getAttribute("stagger"),f=this.getAttribute("direction"),h=this.getAttribute("selector");a&&(i.speed=parseFloat(a)),c&&(i.easing=c),m&&(i.stagger=parseFloat(m)),f&&(i.direction=f),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=at(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}r.observedAttributes=e,customElements.define("scroll-draw",r)}return Mr(Qr);})();
@@ -0,0 +1 @@
1
+ import {a as a$4}from'./chunk-NJV6S5LD.mjs';import {a,d,b as b$1,c}from'./chunk-KN2YB54Z.mjs';import {a as a$3}from'./chunk-HJTHOZK5.mjs';import {a as a$5}from'./chunk-UF3MO5XQ.mjs';import {a as a$1,b as b$3}from'./chunk-OGFXZCKC.mjs';import {a as a$2}from'./chunk-HAGTU5EX.mjs';import {b as b$2}from'./chunk-XLXVGQ3P.mjs';import {defineComponent,ref,h,onMounted,watch,onUnmounted,unref}from'vue';var u=e=>typeof e=="function"?e():unref(e);function l(e,t,n,o=a){let s=null,i=t(),R=()=>{s?.destroy(),s=e.value?n(e.value,b$1(i,()=>i),i):null;};onMounted(R),watch(()=>o(i=t()),R),onUnmounted(()=>{s?.destroy(),s=null;});}function N(e={}){let t=ref(null);return l(t,()=>u(e),b$2),t}var v={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},L=[null,Boolean,[Boolean,String],[Boolean,Number]],g=e=>({type:e,default:void 0}),q=defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(v).map(([e,t])=>[e,t?g(L[t]):null])),setup(e,{slots:t}){let n=ref(null);return l(n,()=>{let o={};for(let s in v){let i=e[s];i!=null&&(o[s]=i);}return o},b$2),()=>h("div",{ref:n},t.default?.())}});function K(e){let t=ref(null);return l(t,()=>u(e),a$2),t}var P=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:t}){let n=ref(null);return l(n,()=>e.options,a$2),()=>h("div",{ref:n},t.default?.())}});function Y(e){let t=ref(null);return l(t,()=>u(e),b$3),t}var _=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:g(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let t=ref(null);l(t,()=>{let o={to:e.to};return e.from!=null&&(o.from=e.from),e.format!=null&&(o.format=e.format),e.easing!=null&&(o.easing=e.easing),e.trigger!=null&&(o.trigger=e.trigger),e.once!=null&&(o.once=e.once),e.decimals!=null&&(o.decimals=e.decimals),e.onComplete!=null&&(o.onComplete=e.onComplete),o},b$3);let n=a$1({to:e.to,decimals:e.decimals,format:e.format});return ()=>h("span",{ref:t},n)}});function W(e={}){let t=ref(null);return l(t,()=>u(e),a$3),t}var U=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let t=ref(null);return l(t,()=>e.options??{},a$3),()=>h("video",{ref:t,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function z(e){let t=ref(null);return l(t,()=>u(e),a$4,c),t}var b={frames:0,count:0,trigger:0,easing:0,once:1,axis:0,triggerElement:0,fit:0,concurrency:0,onReady:0,onLoad:0,onComplete:0,onProgress:0},J=defineComponent({name:"ScrollFrames",props:Object.fromEntries(Object.entries(b).map(([e,t])=>[e,t?g(Boolean):e==="frames"?{required:true}:null])),setup(e){let t=ref(null);return l(t,()=>{let n={};for(let o in b){let s=e[o];s!=null&&(n[o]=s);}return n},a$4,c),onMounted(()=>d(t.value)),()=>h("canvas",{ref:t,role:"img"})}});function Q(e={}){let t=ref(null);return l(t,()=>u(e),a$5),t}var X=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:t}){let n=ref(null);return l(n,()=>e.options??{},a$5),()=>h(e.tag,{ref:n},t.default?.())}});export{N as a,q as b,K as c,P as d,Y as e,_ as f,W as g,U as h,z as i,J as j,Q as k,X as l};
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,b as b$1,e,c}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.mjs';import {a as a$2,b as b$2}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var k=({decimals:e,format:n})=>e!==void 0?o=>o.toFixed(e):n??(o=>String(Math.round(o))),Q=e=>k(e)(e.to),C={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function U(e,n){if(typeof window>"u")return C;let o=typeof e=="string"?document.querySelector(e):e;return o?a(n,(c,u)=>G(o,c,u)):(b("scrollCounter: element not found:",e),C)}function G(e$1,n,o){let{from:c$1=0,to:u,easing:F="ease-out",trigger:S={},once:b=true,onComplete:x}=n,P=k(n),f$1=f(F,"ease-out"),L=a$1(S.start||"top 80%"),V=a$1(S.end||"top 20%");if(o)return e$1.textContent=P(u),x?.(),{...C,getProgress:()=>1};let a=0,l=0,v=false,d=-1,s=0,i=0,g=false,h=()=>window.scrollY,_=()=>window.innerHeight;function E(){let t=e$1.getBoundingClientRect(),r=c({top:t.top,height:t.height},h(),_(),L,V);v&&Math.abs(r.tStart-a)<1&&Math.abs(r.tEnd-l)<1||(v=true,a=r.tStart,l=r.tEnd);}let q=e$1.style.getPropertyValue("--scroll-draw-progress");function m(t){e$1.textContent=P(c$1+(u-c$1)*t),e$1.style.setProperty("--scroll-draw-progress",String(t));}let M=()=>b$1(h(),a,l,1);function B(){let t=M(),r=b?Math.max(d,f$1(s=Math.max(s,t))):f$1(t);i=r,m(r),r>=1&&!g?(g=true,x?.()):r<1&&!b&&(g=false);}E();{s=b$1(h(),a,l,1);let t=f$1(s);i=t,m(t);}let p=e(window,[e$1],M,B,E);a$2(e$1,{type:"counter",getProgress:()=>i,getTrigger:()=>({tStart:a,tEnd:l})});let T=()=>p.hold(false);return {destroy(){p.off(),e$1.style.setProperty("--scroll-draw-progress",q),b$2(e$1);},replay(){d=-1,s=0,g=false,i=0,m(0),T();},pause:()=>p.hold(true),resume:T,seek(t){let r=Math.min(1,Math.max(0,t));i=r,d=r,s=0,p.hold(true),m(r);},getProgress(){return i}}}export{Q as a,U as b};
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var _e=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function R(e,...r){_e&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function It({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ht({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),i=0,a=[];for(let d=0;d<t;d++){let v=Math.pow(s,d);a.push(v),i+=v;}let u=[0],m=0;for(let d=0;d<t;d++)m+=a[d]/i,u.push(m);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let v=0;v<t;v++)if(d<=u[v+1]){let E=(d-u[v])/(u[v+1]-u[v]);if(v===0)return E*(2-E);let y=1-Math.pow(n,v);return y+(1-y)*(2*E-1)*(2*E-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 i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var Ve={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:It(),bounce:Ht(),elastic:Nt()};function gr(e,r,t,n){let s=(i,a,u)=>((1+3*i-3*a)*u+3*a-6*i)*u*u+3*i*u;return i=>{if(i<=0||i>=1)return +(i>0);let a=i;for(let u=0;u<8;u++)a-=(s(e,t,a)-i)/((3*(1+3*e-3*t)*a+6*t-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(s(e,t,a)-i)<1e-9))for(let u=0,m=0,d=1;u<30;u++)a=(m+d)/2,s(e,t,a)<i?m=a:d=a;return s(r,n,a)}}function yt(e){let r=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=r?r[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [gr(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var Rt=new Set;function Le(e,r="linear"){if(typeof e=="function")return e;if(e==null)return Ve[r];if({}.hasOwnProperty.call(Ve,e))return Ve[e];let t=yt(String(e));return t?t[0]:(!Rt.has(e)&&Rt.add(e)&&R(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),Ve[r])}function Ft(e,r,t){return Math.min(t,Math.max(r,e))}function xe(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}}var zt=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function _t(e,r,t,n){return e+t+r*zt(n,0)}function Vt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:zt(e,1))}function H(e,r,t,n){return t===r?0:Ft((e-r)/(t-r)*n,0,1)}function $e(e,r,t,n,s){let i=_t(e.top,e.height,r,n.element)-Vt(n.viewport,t),a=_t(e.top,e.height,r,s.element)-Vt(s.viewport,t);return {tStart:i,tEnd:a}}function et(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 tt(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 ze(e){return `${e} ${e*2}`}function Gt(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 rt(e,r,t){let n=Gt(e),s=Gt(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 ht={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 yr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",hr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Wt=33;function br(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function wr(e){let r=[];for(let t=0;t<Wt;t++){let n=t/(Wt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function nt(e){switch(e){case "linear":return "linear";case "ease-in":return yr;case "ease-out":return hr;case "ease-in-out":return br()?wr(Ve["ease-in-out"]):null;default:return yt(e)?.[1]??null}}var Bt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[Bt]||(e[Bt]=new Map)}function Te(e,r){qt().set(e,r);}function fe(e){qt().delete(e);}function ot(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 Ge(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=ot(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...a)=>t[i]?.(...a);return s.destroy=()=>{n(),t.destroy();},s}var Qe,st=new Set,it=new WeakMap,Ue=new Map,jt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function vr(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 Yt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();Qe??(Qe=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)it.get(a)!==jt(a)&&(i=true),it.set(a,"");i&&st.forEach(a=>a());})),st.add(t);let n=vr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{it.has(s)||it.set(s,jt(s)),Ue.set(s,(Ue.get(s)??0)+1),Qe.observe(s);}),()=>{st.delete(t)&&(n.forEach(s=>{let i=(Ue.get(s)??1)-1;if(i)return void Ue.set(s,i);Ue.delete(s),Qe?.unobserve(s);}),st.size||(Qe?.disconnect(),Qe=void 0));}}function ke(e,r,t,n,s){let i,a=NaN,u,m,d=()=>{i=0,n(),!u&&!i&&(a=t())>0&&a<1&&(i=requestAnimationFrame(d));},v=()=>{!i&&!u&&t()!==a&&(i=requestAnimationFrame(d));},E=w=>{u=w,cancelAnimationFrame(i),i=a=NaN,v();},y=()=>{clearTimeout(m),s(),v();},I=()=>{clearTimeout(m),m=setTimeout(y,150);},oe=Yt(r,I),f=w=>{e[w]("scroll",v,{passive:true}),window[w]("resize",I),window[w]("orientationchange",I);};return f("addEventListener"),v(),{hold:E,remeasure:y,off(){E(true),f("removeEventListener"),oe(),clearTimeout(m);}}}var Er=0;function Sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Ut=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function xr(e){if(!_e)return;let r=Qt(e,"stroke");if(!r||r==="none"){R("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Ut.has(t)&&!Ut.has(Qt(e,"fill"))&&R("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Tr(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 i=t==="x"?window.scrollX:window.scrollY,a=e-i,u=r-i,m=t==="x";n.innerHTML=`
1
+ 'use strict';var Fe=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function I(e,...r){Fe&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function It({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Ht({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),i=0,a=[];for(let p=0;p<t;p++){let b=Math.pow(s,p);a.push(b),i+=b;}let u=[0],m=0;for(let p=0;p<t;p++)m+=a[p]/i,u.push(m);return p=>{if(p<=0)return 0;if(p>=1)return 1;for(let b=0;b<t;b++)if(p<=u[b+1]){let S=(p-u[b])/(u[b+1]-u[b]);if(b===0)return S*(2-S);let h=1-Math.pow(n,b);return h+(1-h)*(2*S-1)*(2*S-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 i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-s)*(2*Math.PI)/n)+1}var _e={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:It(),bounce:Ht(),elastic:Nt()};function gr(e,r,t,n){let s=(i,a,u)=>((1+3*i-3*a)*u+3*a-6*i)*u*u+3*i*u;return i=>{if(i<=0||i>=1)return +(i>0);let a=i;for(let u=0;u<8;u++)a-=(s(e,t,a)-i)/((3*(1+3*e-3*t)*a+6*t-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(s(e,t,a)-i)<1e-9))for(let u=0,m=0,p=1;u<30;u++)a=(m+p)/2,s(e,t,a)<i?m=a:p=a;return s(r,n,a)}}function yt(e){let r=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=r?r[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [gr(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var Rt=new Set;function Ae(e,r="linear"){if(typeof e=="function")return e;if(e==null)return _e[r];if({}.hasOwnProperty.call(_e,e))return _e[e];let t=yt(String(e));return t?t[0]:(!Rt.has(e)&&Rt.add(e)&&I(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),_e[r])}function Ft(e,r,t){return Math.min(t,Math.max(r,e))}function Se(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}}var zt=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function _t(e,r,t,n){return e+t+r*zt(n,0)}function Vt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:zt(e,1))}function N(e,r,t,n){return t===r?0:Ft((e-r)/(t-r)*n,0,1)}function Pe(e,r,t,n,s){let i=_t(e.top,e.height,r,n.element)-Vt(n.viewport,t),a=_t(e.top,e.height,r,s.element)-Vt(s.viewport,t);return {tStart:i,tEnd:a}}function Ke(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 et(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 Ve(e){return `${e} ${e*2}`}function Gt(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 tt(e,r,t){let n=Gt(e),s=Gt(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 ht={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 yr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",hr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",Wt=33;function br(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function wr(e){let r=[];for(let t=0;t<Wt;t++){let n=t/(Wt-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function rt(e){switch(e){case "linear":return "linear";case "ease-in":return yr;case "ease-out":return hr;case "ease-in-out":return br()?wr(_e["ease-in-out"]):null;default:return yt(e)?.[1]??null}}var Bt=Symbol.for("svg-scroll-draw.registry");function qt(){let e=globalThis;return e[Bt]||(e[Bt]=new Map)}function xe(e,r){qt().set(e,r);}function me(e){qt().delete(e);}function nt(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 ze(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=nt(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...a)=>t[i]?.(...a);return s.destroy=()=>{n(),t.destroy();},s}var je,ot=new Set,st=new WeakMap,Ye=new Map,jt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function vr(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 Yt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();je??(je=new ResizeObserver(s=>{let i=false;for(let{target:a}of s)st.get(a)!==jt(a)&&(i=true),st.set(a,"");i&&ot.forEach(a=>a());})),ot.add(t);let n=vr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{st.has(s)||st.set(s,jt(s)),Ye.set(s,(Ye.get(s)??0)+1),je.observe(s);}),()=>{ot.delete(t)&&(n.forEach(s=>{let i=(Ye.get(s)??1)-1;if(i)return void Ye.set(s,i);Ye.delete(s),je?.unobserve(s);}),ot.size||(je?.disconnect(),je=void 0));}}function Le(e,r,t,n,s){let i,a=NaN,u,m,p=()=>{i=0,n(),!u&&!i&&(a=t())>0&&a<1&&(i=requestAnimationFrame(p));},b=()=>{!i&&!u&&t()!==a&&(i=requestAnimationFrame(p));},S=v=>{u=v,cancelAnimationFrame(i),i=a=NaN,b();},h=()=>{clearTimeout(m),s(),b();},L=()=>{clearTimeout(m),m=setTimeout(h,150);},F=Yt(r,L),d=v=>{e[v]("scroll",b,{passive:true}),window[v]("resize",L),window[v]("orientationchange",L);};return d("addEventListener"),b(),{hold:S,remeasure:h,off(){S(true),d("removeEventListener"),F(),clearTimeout(m);}}}var Er=0;function Sr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Qt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var Ut=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function xr(e){if(!Fe)return;let r=Qt(e,"stroke");if(!r||r==="none"){I("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Ut.has(t)&&!Ut.has(Qt(e,"fill"))&&I("Element has a fill \u2014 it may obscure the stroke animation.",e);}function Tr(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 i=t==="x"?window.scrollX:window.scrollY,a=e-i,u=r-i,m=t==="x";n.innerHTML=`
2
2
  <div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
3
- <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Zt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mr(e,r,t){if(!_e)return;let n=(e.match(Zt)??[]).join("").toUpperCase(),s=(r.match(Zt)??[]).join("").toUpperCase(),i=(e.match(Xt)??[]).length,a=(r.match(Xt)??[]).length;if(n!==s){R(`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}i!==a&&R(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Ar(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=n[s++]??a;return String(+(a+(u-a)*t).toFixed(4))})}function Jt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ge(r,(t,n)=>Pr(e,t,n))}function Pr(e,r,t){let{preset:n,...s}=r,i=n?{...ht[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:d="linear",trigger:v={},stagger:E=0,direction:y="forward",once:I=false,debug:oe=false,axis:f="y",scrollContainer:w,autoReverse:h=false,delay:x=0,strokeColor:b,strokeWidth:L,fillOpacity:U,waypoints:W,velocityScale:N=false,threshold:K=0,rootMargin:We="0px",repeat:ae=0,repeatDelay:pe=0,morphTo:B,clip:ee,autoplay:Me=false,duration:P=1e3,native:F=true,onProgress:Ce,onStart:X,onComplete:te,onEnter:de,onLeave:Ie,onEnterBack:ge,onLeaveBack:ue}=i,Z=ee===true?"left":typeof ee=="string"?ee:false,q=Le(d),He=xe(v.start||"top bottom"),Be=xe(v.end||"bottom top"),_=typeof w=="string"?document.querySelector(w):w??null,ye=Array.isArray(b)?b[0]:null,he=Array.isArray(b)?b[1]:typeof b=="string"?b:null,le=Array.isArray(L)?L[0]:null,Ae=Array.isArray(L)?L[1]:typeof L=="number"?L:null,be=Array.isArray(U)?U[0]:null,ce=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function we(o){let c=o*100;switch(Z){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],V=[],M=0,$=0,O=E,k=0,Pe=0,z=false,ve=false,Ee=0,ct=-1,Xe=[],Ze=-1,se=false,me=0,De=0,Oe,ut=false,mt=null;function Et(){mt?.destroy(),mt=null;}let Re=new Set,St=NaN,Ne=true,Je=-1,xt=performance.now(),Fe=NaN;function Ke(){return _?f==="x"?_.scrollLeft:_.scrollTop:f==="x"?window.scrollX:window.scrollY}function Tt(){return _?f==="x"?_.clientWidth:_.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function Mt(){let o=et(e,_,f);return $e(o,o.scroll,Tt(),He,Be)}function lr(){let o=$-M,c=l.length-1,g=_??document.documentElement,T=f==="x"?"Width":"Height";if(O=E,E>0&&c>0&&o>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;j>=0&&(O=Math.min(E,j/(c*o)));}let G=Math.max(0,c)*O*o,re=o/Math.min(u,1);k=M+Math.min(0,G,re,G+re),Pe=M+Math.max(0,G,re,G+re);}function At(){(({tStart:M,tEnd:$}=Mt())),lr(),oe&&_e&&(Et(),mt=Tr(M,$,f));}function ft(o,c=Mt){Te(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),fe(e);},o}function Pt(o,c){return I&&!h?Math.max(ct,q(Xe[o]=Math.max(Xe[o]??0,c))):q(c)}function cr(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=we(g);return}l.forEach((g,T)=>pt(g,T,o,c));}function pt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${p[c]*g}`:`${p[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),ye&&he?o.style.stroke=rt(ye,he,g):he&&(o.style.stroke=he),le!==null&&Ae!==null?o.style.strokeWidth=`${le+(Ae-le)*g}`:Ae!==null&&(o.style.strokeWidth=`${Ae}`),be!==null&&ce!==null?o.style.fillOpacity=`${be+(ce-be)*g}`:ce!==null&&(o.style.fillOpacity=`${ce}`),B&&o.tagName.toLowerCase()==="path"&&V[c]&&o.setAttribute("d",Ar(V[c],B,g));}function dt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=we(y==="reverse"?1:0);return}l.forEach((o,c)=>{o.style.strokeDasharray=ze(p[c]),o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",ye&&(o.style.stroke=ye),le!==null&&(o.style.strokeWidth=`${le}`),be!==null&&(o.style.fillOpacity=`${be}`),B&&o.tagName.toLowerCase()==="path"&&V[c]&&o.setAttribute("d",V[c]);});}function qe(o,c){let g=o.getAttribute("d"),T=tt(o);if(B&&V[c]){o.setAttribute("d",B);let G=tt(o);o.setAttribute("d",V[c]),T=Math.max(tt(o),G),o.setAttribute("d",g);}p[c]=T,o.style.strokeDasharray=ze(T);}if(l.forEach((o,c)=>{xr(o);let g=o.tagName.toLowerCase()==="path";g?V.push(o.getAttribute("d")??""):V.push(""),qe(o,c);let T=p[c];B&&(g?Mr(V[V.length-1],B,o):R(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),he&&(o.style.stroke=he),Ae!==null&&(o.style.strokeWidth=`${Ae}`),ce!==null&&(o.style.fillOpacity=`${ce}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",ye&&(o.style.stroke=ye),le!==null&&(o.style.strokeWidth=`${le}`),be!==null&&(o.style.fillOpacity=`${be}`));}),t)return Z&&(e.style.clipPath=we(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=we(y==="reverse"?1:0));let Lt=typeof d=="string"?nt(d):null;function ur(){return !(F===false||Me||oe&&_e||!Sr()||!l.length||!Lt||Z||f!=="y"||_||u!==1||E!==0||I||h||N!==false||B||W||ae||x>0||Ce||X||te||de||Ie||ge||ue||b!=null||L!=null||U!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function mr(){let o=++Er,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,C+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${C}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Lt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function J(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=ze(p[A]),S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c);}l.forEach(J);let Y=false,ne=-1;function ie(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=$e({top:S.top,height:S.height},Ke(),Tt(),He,Be);return q(H(Ke(),A,Q,u))}return {destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){Y=false,ne=-1,l.forEach(J);},pause(){Y=true,l.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,l.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=true,l.forEach((Q,Se)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[Se]*A}`:`${p[Se]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return ie()},refresh(){l.forEach((S,A)=>{qe(S,A),S.style.setProperty("--ssd-len",String(p[A]));});}}}if(ur())return ft(mr());function fr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=false;function re(ne){let ie=true,S=Math.min(1,Math.max(0,ne/c));if(Z){let A=Math.min(1,Math.max(0,ne/o)),Q=q(A);me=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=we(y==="reverse"?1-Q:Q),Ce?.(Q),A<1&&(ie=false);}else {l.forEach((Q,Se)=>{let dr=Se*E*o,Ot=Math.min(1,Math.max(0,(ne-dr)/o));pt(Q,Se,q(Ot),y),Ot<1&&(ie=false);});let A=q(S);me=A,Ce?.(A),e.style.setProperty("--scroll-draw-progress",String(A));}if(W){let A=q(S);for(let Q in W){let Se=parseFloat(Q);A>=Se&&!Re.has(Se)&&(Re.add(Se),W[Q]?.());}}return ie}function j(ne){if(se)return;let ie=ne-g;ve||(ve=true,X?.());let S=re(ie);if(S&&!z){z=true,re(c),te?.(),De<(ae==="infinite"?1/0:ae??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),ve=false,z=false,Re.clear(),dt(),Ee=requestAnimationFrame(j);},pe));return}S||(Ee=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Ee),clearTimeout(Oe),g=performance.now(),T=0,se=false,ve=false,z=false,De=0,G=true,me=0,Re.clear(),dt(),Ee=requestAnimationFrame(j);}let D=new IntersectionObserver(ne=>{ne.forEach(ie=>{ie.isIntersecting&&!(I&&z)?C():!ie.isIntersecting&&!I&&!z&&(cancelAnimationFrame(Ee),clearTimeout(Oe),G=false);});},{root:_??null,threshold:K,rootMargin:We}),J;function Y(){clearTimeout(J),J=setTimeout(()=>l.forEach(qe),150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(J);},replay(){De=0,C();},pause(){se||!G||(se=true,T=performance.now()-g,cancelAnimationFrame(Ee));},resume(){se&&(se=false,G=true,g=performance.now()-T,Ee=requestAnimationFrame(j));},seek(ne){let ie=Math.min(1,Math.max(0,ne));me=ie,se=true,T=ie*c,g=performance.now()-T,cancelAnimationFrame(Ee),re(T);},getProgress(){return me},refresh(){clearTimeout(J),l.forEach(qe);}}}if(Me)return ft(fr());At();let $t=()=>H(Ke(),k,Pe,1);function kt(){z=true,te?.(),De<(ae==="infinite"?1/0:ae)&&(De++,Oe=setTimeout(()=>{ut=true;},pe));}function Ct(){ct=-1,Xe=[],ve=false,z=false,ut=false,Re.clear(),dt(),Ne=true;}function pr(){let o=performance.now(),c=Ke();if(ut&&$t()%1&&Ct(),!Ne&&N===false&&c===St)return;Ne=false,St=c;let g=u;if(N!==false){let C=o-xt,D=C>0?Math.abs(c-(Je<0?c:Je))/C:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Je=c,xt=o;let T=h?Ze===-1||c>=Ze?"forward":"reverse":y;Ze=c;let G=$-M,re=true,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&de?.(),Fe<1&&j>=1&&Ie?.(),Fe>=1&&j<1&&ge?.(),Fe>0&&j<=0&&ue?.()),Fe=j,Z){let C=Pt(0,H(c,M,$,g));me=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=we(D),Ce?.(C),!ve&&H(c,M,$,g)>0&&(ve=true,X?.()),C>=1&&!z?kt():C<1&&!I&&(z=false);return}if(l.forEach((C,D)=>{let J=D*O*G,Y=Pt(D,H(c,M+J,$+J,g));pt(C,D,Y,T),D===0&&(me=Y,Ce?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=false);}),W){let C=q(H(c,M,$,g));for(let D in W){let J=parseFloat(D);C>=J&&!Re.has(J)&&(Re.add(J),W[D]?.());}}!ve&&H(c,M,$,g)>0&&(ve=true,X?.()),re&&!z?kt():!re&&!I&&(z=false);}let je=ke(_??window,[e],$t,pr,()=>{let o=p.join();l.forEach(qe),At(),Ne=true,p.join()!==o&&Ye();}),gt=x>0;function Ye(){je.hold(se||gt);}let Dt;return gt&&(Dt=setTimeout(()=>{gt=false,Ye();},x)),Ye(),ft({destroy(){clearTimeout(Oe),clearTimeout(Dt),je.off(),Et();},replay(){Ct(),Ze=-1,Je=-1,De=0,se=false,me=0,clearTimeout(Oe),Ye();},pause(){se=true,je.hold(true);},resume(){se&&(se=false,Ne=true,Ye());},seek(o){let c=Math.min(1,Math.max(0,o));me=c,ct=c,Xe=[],se=true,je.hold(true),cr(c,y),Ne=true;},getProgress(){return me},refresh:je.remeasure},()=>({tStart:M,tEnd:$}))}function Lr(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):(R("Container not found:",e),t)}function $r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Kt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function kr(e,r,t){let n=Kt(e),s=Kt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?t<1?`${i.fn}(${i.nums.map((m,d)=>`${m}${i.units[d]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,d)=>`${m}${u.units[d]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,d)=>`${m+(u.nums[d]-m)*t}${i.units[d]}`).join(", ")})`}).join(" ")}function er(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if($r(n))return rt(n,s,t);if(n.includes("("))return kr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),m=parseFloat(a[1]);return `${u+(m-u)*t}${i[2]||a[2]}`}return t<1?n:s}function Cr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Dr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Or=0,tr="--scroll-draw-progress";function Rr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var nr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function bt(e,r){return typeof window>"u"?nr:r.respectReducedMotion===false?rr(e,r,false):Ge(r,(t,n)=>rr(e,t,n))}function rr(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:E=false,triggerElement:y,onProgress:I,onComplete:oe,onEnter:f,onLeave:w,onEnterBack:h,onLeaveBack:x}=r,b=Le(i,"ease-out"),L=xe(s.start||"top bottom"),U=xe(s.end||"bottom top"),W=y??e,N=typeof d=="string"?document.querySelector(d):d??null,K=Object.entries(n).map(([l,p])=>({prop:Cr(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function We(){let l=window.getComputedStyle(e);for(let p of K)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0");}function ae(){for(let l of K)e.style.setProperty(l.prop,String(l.to));}let pe=new Map;for(let l of [...K.map(p=>p.prop),tr])pe.set(l,e.style.getPropertyValue(l));function B(){for(let[l,p]of pe)p?e.style.setProperty(l,p):e.style.removeProperty(l);}if(t)return ae(),oe?.(),{...nr,destroy:B,getProgress:()=>1};We();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Me=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?nt(i):null;function F(){if(!v||!Rr()||!P||m!=="y"||N||W!==e||u||a!==1||I||oe||f||w||h||x||E!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of K)if(!Dr.has(l.prop))return false;return true}function Ce(){let l=`ssd-a-${++Or}`,p=K.map(k=>`${k.prop}:${k.from}`).join(";"),V=K.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${p}}to{${V}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},ee(),Me(),L,U)};Te(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:$});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),fe(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Pe=Math.min(1,Math.max(0,k));e.classList.remove(l);for(let z of K)e.style.setProperty(z.prop,er(z.from,z.to,Pe));},getProgress(){let{tStart:k,tEnd:Pe}=$();return b(H(ee(),k,Pe,a))}};return O}if(F())return Ce();let X=0,te=0,de=false,Ie=-1,ge=0,ue=0,Z=false,q=NaN,He=-1,Be=0,_=W===e?K:[],ye=false;function he(){let l=e.style,p=_.map(O=>l.getPropertyValue(O.prop)),V=l.transition;_.length&&(l.transition="none"),_.forEach(O=>l.setProperty(O.prop,pe.get(O.prop)??""));let M=et(W,N,m);_.forEach((O,k)=>l.setProperty(O.prop,p[k])),_.length&&(e.offsetWidth,l.transition=V);let $=$e(M,M.scroll,Me(),L,U);ye&&Math.abs($.tStart-X)<1&&Math.abs($.tEnd-te)<1||(ye=true,X=$.tStart,te=$.tEnd);}function le(l){e.style.setProperty(tr,String(l));for(let p of K)e.style.setProperty(p.prop,er(p.from,p.to,l));I?.(l);}function Ae(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&f?.(),q<1&&l>=1&&w?.(),q>=1&&l<1&&h?.(),q>0&&l<=0&&x?.(),q=l;}function be(){if(de)return;let l=performance.now(),p=ee(),V=a;if(E!==false){let k=l-Be,Pe=k>0?Math.abs(p-(He<0?p:He))/k:0;V=a*Math.max(.2,1+Pe*(typeof E=="number"?E:1)*.04);}He=p,Be=l;let M=te===X?0:(p-X)/(te-X);Ae(M);let $=H(p,X,te,V),O=u?Math.max(Ie,b(ge=Math.max(ge,$))):b($);ue=O,le(O),O>=1&&!Z?(Z=true,oe?.()):O<1&&!u&&(Z=false);}let ce=ke(N??window,[W],()=>H(ee(),X,te,Math.min(a,1)),be,he);he(),te===X&&R("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ge=H(ee(),X,te,a),ue=b(ge),le(ue),Te(e,{type:"animate",getProgress:()=>ue,getTrigger:()=>({tStart:X,tEnd:te})});function we(){de=true,ce.hold(true);}return {destroy(){de=true,ce.off(),B(),fe(e);},replay(){Ie=-1,ge=0,Z=false,ue=0,de=false,le(0),ce.hold(false);},pause:we,resume(){de&&(de=false,ce.hold(false));},seek(l){let p=Math.min(1,Math.max(0,l));ue=p,Ie=p,ge=0,we(),le(p);},getProgress(){return ue},refresh:ce.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ir(e,r){if(typeof window>"u")return at;let t=typeof e=="string"?document.querySelector(e):e;return t?bt(t,r):(R("scrollAnimate: element not found:",e),at)}function Hr(e,r={}){if(typeof window>"u")return at;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return R("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:a,onProgress:u}=r,m=-n*100,d=t.style,v=!!t.ownerSVGElement,E=d.getPropertyValue("transform-box");v&&d.setProperty("transform-box","fill-box");let y=bt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:u});return v?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E);}}:y}var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Nr(e,r){if(typeof window>"u")return wt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ge(r,(n,s)=>Fr(t,n,s)):(R("scrollCounter: element not found:",e),wt)}function Fr(e,r,t){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:u={},once:m=true,decimals:d,onComplete:v}=r,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=Le(a,"ease-out"),I=xe(u.start||"top 80%"),oe=xe(u.end||"top 20%");if(t)return e.textContent=E(s),v?.(),{...wt,getProgress:()=>1};let f=0,w=0,h=false,x=-1,b=0,L=0,U=false,W=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),F=$e({top:P.top,height:P.height},W(),N(),I,oe);h&&Math.abs(F.tStart-f)<1&&Math.abs(F.tEnd-w)<1||(h=true,f=F.tStart,w=F.tEnd);}let We=e.style.getPropertyValue("--scroll-draw-progress");function ae(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P));}let pe=()=>H(W(),f,w,1);function B(){let P=pe(),F=m?Math.max(x,y(b=Math.max(b,P))):y(P);L=F,ae(F),F>=1&&!U?(U=true,v?.()):F<1&&!m&&(U=false);}K();{b=H(W(),f,w,1);let P=y(b);L=P,ae(P);}let ee=ke(window,[e],pe,B,K);Te(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:w})});let Me=()=>ee.hold(false);return {destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",We),fe(e);},replay(){x=-1,b=0,U=false,L=0,ae(0),Me();},pause:()=>ee.hold(true),resume:Me,seek(P){let F=Math.min(1,Math.max(0,P));L=F,x=F,b=0,ee.hold(true),ae(F);},getProgress(){return L}}}var or="http://www.w3.org/2000/svg",_r="cinematic-photo",ar=e=>e<0?0:e>1?1:e;function lt(e){let r=parseFloat(e);return Number.isFinite(r)?ar(r/100):0}function sr(e){return Le(e)}var ir=e=>({destroy(){},getProgress:()=>e}),vt=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||R("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return ir(0);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 f of r.scenes){if(f.background){let h=document.createElement("img");h.id=_r,h.src=f.background,h.alt="",h.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(h);}let w=f.animations.filter(h=>h.type==="draw");if(w.length){let h=document.createElementNS(or,"svg");h.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),h.setAttribute("preserveAspectRatio","xMidYMid meet"),h.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(h);for(let x of w){let b=document.createElementNS(or,"path");b.id=x.target.replace(/^#/,""),b.setAttribute("d",x.d),b.setAttribute("fill","none"),b.setAttribute("stroke",x.stroke),b.setAttribute("stroke-width",String(x.strokeWidth)),b.setAttribute("stroke-linecap","round"),b.setAttribute("stroke-linejoin","round");let L=x.length||b.getTotalLength?.()||0;b.style.strokeDasharray=ze(L),b.style.strokeDashoffset=String(L),h.appendChild(b),s.push({kind:"draw",el:b,start:lt(x.start),end:lt(x.end),ease:sr(x.easing),length:L});}}for(let h of f.animations){if(h.type!=="fade")continue;let x=n.querySelector(h.target)??document.querySelector(h.target);x&&(x.style.opacity=String(h.from),s.push({kind:"fade",el:x,start:lt(h.start),end:lt(h.end),ease:sr("ease-in-out"),from:h.from,to:h.to}));}}let i=0,a=null;for(let f=t.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){a=f;break}let u=0,m=0,d=()=>{let f=t.getBoundingClientRect().top;u=a?f-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:f+window.scrollY,m=u+Math.max(0,t.offsetHeight-(a?a.clientHeight:window.innerHeight));},v=()=>{let f=a?a.scrollTop:window.scrollY;return m<=u?f>=u?1:0:H(f,u,m,1)},E=f=>{for(let w of s){let h=w.end-w.start,x=h<=0?f>=w.end?1:0:ar((f-w.start)/h),b=w.ease(x);w.kind==="draw"?w.el.style.strokeDashoffset=String(w.length*(1-b)):w.el.style.opacity=String(w.from+(w.to-w.from)*b);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),ir(1);let y=()=>{i=v(),E(i);};d(),y();let I=ke(a||window,[t],v,y,d);Te(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let oe=ot(f=>{f&&(oe(),I.off(),fe(t),i=1,E(1));});return {destroy(){oe(),I.off(),fe(t);},getProgress:()=>i}}};
4
- exports.Cinematic=vt;exports.PRESETS=ht;exports.createBounce=Ht;exports.createElastic=Nt;exports.createSpring=It;exports.scrollAnimate=Ir;exports.scrollCounter=Nr;exports.scrollDraw=Lr;exports.scrollParallax=Hr;
3
+ <div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Xt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Zt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Mr(e,r,t){if(!Fe)return;let n=(e.match(Zt)??[]).join("").toUpperCase(),s=(r.match(Zt)??[]).join("").toUpperCase(),i=(e.match(Xt)??[]).length,a=(r.match(Xt)??[]).length;if(n!==s){I(`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}i!==a&&I(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Ar(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=n[s++]??a;return String(+(a+(u-a)*t).toFixed(4))})}function Jt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ze(r,(t,n)=>Pr(e,t,n))}function Pr(e,r,t){let{preset:n,...s}=r,i=n?{...ht[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=false,easing:p="linear",trigger:b={},stagger:S=0,direction:h="forward",once:L=false,debug:F=false,axis:d="y",scrollContainer:v,autoReverse:y=false,delay:E=0,strokeColor:w,strokeWidth:H,fillOpacity:se,waypoints:X,velocityScale:_=false,threshold:q=0,rootMargin:De="0px",repeat:fe=0,repeatDelay:le=0,morphTo:V,clip:A,autoplay:D=false,duration:Qe=1e3,native:lt=true,onProgress:$e,onStart:Z,onComplete:ee,onEnter:pe,onLeave:Re,onEnterBack:de,onLeaveBack:ce}=i,J=A===true?"left":typeof A=="string"?A:false,j=Ae(p),Ie=Se(b.start||"top bottom"),Ge=Se(b.end||"bottom top"),z=typeof v=="string"?document.querySelector(v):v??null,ge=Array.isArray(w)?w[0]:null,ye=Array.isArray(w)?w[1]:typeof w=="string"?w:null,ie=Array.isArray(H)?H[0]:null,Te=Array.isArray(H)?H[1]:typeof H=="number"?H:null,he=Array.isArray(se)?se[0]:null,ae=Array.isArray(se)?se[1]:typeof se=="number"?se:null;function be(o){let c=o*100;switch(J){case "right":return `inset(0 0 0 ${100-c}%)`;case "top":return `inset(0 0 ${100-c}% 0)`;case "bottom":return `inset(${100-c}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-c}% 0 0)`}}let l=J?[]:Array.from(e.querySelectorAll(a)),f=[],G=[],M=0,$=0,R=S,C=0,Me=0,W=false,we=false,ve=0,ct=-1,Ue=[],Xe=-1,ne=false,ue=0,Ce=0,ke,ut=false,mt=null;function Et(){mt?.destroy(),mt=null;}let Oe=new Set,St=NaN,He=true,Ze=-1,xt=performance.now(),Ne=NaN;function Je(){return z?d==="x"?z.scrollLeft:z.scrollTop:d==="x"?window.scrollX:window.scrollY}function Tt(){return z?d==="x"?z.clientWidth:z.clientHeight:d==="x"?window.innerWidth:window.innerHeight}function Mt(){let o=Ke(e,z,d);return Pe(o,o.scroll,Tt(),Ie,Ge)}function lr(){let o=$-M,c=l.length-1,g=z??document.documentElement,T=d==="x"?"Width":"Height";if(R=S,S>0&&c>0&&o>0){let Y=g[`scroll${T}`]-g[`client${T}`]-1-M-o/u;Y>=0&&(R=Math.min(S,Y/(c*o)));}let B=Math.max(0,c)*R*o,te=o/Math.min(u,1);C=M+Math.min(0,B,te,B+te),Me=M+Math.max(0,B,te,B+te);}function At(){(({tStart:M,tEnd:$}=Mt())),lr(),F&&Fe&&(Et(),mt=Tr(M,$,d));}function ft(o,c=Mt){xe(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),me(e);},o}function Pt(o,c){return L&&!y?Math.max(ct,j(Ue[o]=Math.max(Ue[o]??0,c))):j(c)}function cr(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),J){let g=c==="reverse"?1-o:o;e.style.clipPath=be(g);return}l.forEach((g,T)=>pt(g,T,o,c));}function pt(o,c,g,T){o.style.strokeDashoffset=T==="reverse"?`${f[c]*g}`:`${f[c]*(1-g)}`,m&&(o.style.opacity=T==="reverse"?`${1-g}`:`${g}`),ge&&ye?o.style.stroke=tt(ge,ye,g):ye&&(o.style.stroke=ye),ie!==null&&Te!==null?o.style.strokeWidth=`${ie+(Te-ie)*g}`:Te!==null&&(o.style.strokeWidth=`${Te}`),he!==null&&ae!==null?o.style.fillOpacity=`${he+(ae-he)*g}`:ae!==null&&(o.style.fillOpacity=`${ae}`),V&&o.tagName.toLowerCase()==="path"&&G[c]&&o.setAttribute("d",Ar(G[c],V,g));}function dt(){if(e.style.setProperty("--scroll-draw-progress","0"),J){e.style.clipPath=be(h==="reverse"?1:0);return}l.forEach((o,c)=>{o.style.strokeDasharray=Ve(f[c]),o.style.strokeDashoffset=h==="reverse"?"0":`${f[c]}`,m?o.style.opacity=h==="reverse"?"1":"0":o.style.opacity="",ge&&(o.style.stroke=ge),ie!==null&&(o.style.strokeWidth=`${ie}`),he!==null&&(o.style.fillOpacity=`${he}`),V&&o.tagName.toLowerCase()==="path"&&G[c]&&o.setAttribute("d",G[c]);});}function We(o,c){let g=o.getAttribute("d"),T=et(o);if(V&&G[c]){o.setAttribute("d",V);let B=et(o);o.setAttribute("d",G[c]),T=Math.max(et(o),B),o.setAttribute("d",g);}f[c]=T,o.style.strokeDasharray=Ve(T);}if(l.forEach((o,c)=>{xr(o);let g=o.tagName.toLowerCase()==="path";g?G.push(o.getAttribute("d")??""):G.push(""),We(o,c);let T=f[c];V&&(g?Mr(G[G.length-1],V,o):I(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=h==="reverse"?`${T}`:"0",m&&(o.style.opacity="1"),ye&&(o.style.stroke=ye),Te!==null&&(o.style.strokeWidth=`${Te}`),ae!==null&&(o.style.fillOpacity=`${ae}`),V&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",V)):(o.style.strokeDashoffset=h==="reverse"?"0":`${T}`,m?o.style.opacity=h==="reverse"?"1":"0":o.style.opacity="",ge&&(o.style.stroke=ge),ie!==null&&(o.style.strokeWidth=`${ie}`),he!==null&&(o.style.fillOpacity=`${he}`));}),t)return J&&(e.style.clipPath=be(1)),ee?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};J&&(e.style.clipPath=be(h==="reverse"?1:0));let Lt=typeof p=="string"?rt(p):null;function ur(){return !(lt===false||D||F&&Fe||!Sr()||!l.length||!Lt||J||d!=="y"||z||u!==1||S!==0||L||y||_!==false||V||X||fe||E>0||$e||Z||ee||pe||Re||de||ce||w!=null||H!=null||se!=null||(b.start||"top bottom").trim()!=="top bottom"||(b.end||"bottom top").trim()!=="bottom top")}function mr(){let o=++Er,c=`svg-scroll-draw-${o}`,g=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,B=h==="reverse"?"0":"var(--ssd-len)",te=h==="reverse"?"var(--ssd-len)":"0",Y=`stroke-dashoffset:${B};`,k=`stroke-dashoffset:${te};`;m&&(Y+=`opacity:${h==="reverse"?1:0};`,k+=`opacity:${h==="reverse"?0:1};`);let O=document.createElement("style");O.setAttribute("data-svg-scroll-draw",""),O.textContent=`@keyframes ${c}{from{${Y}}to{${k}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Lt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(O),e.classList.add(g);function K(x,P){x.style.setProperty("--ssd-len",String(f[P])),x.style.strokeDasharray=Ve(f[P]),x.style.strokeDashoffset="",x.style.opacity="",x.style.animationPlayState="",x.classList.add(c);}l.forEach(K);let Q=false,re=-1;function oe(){if(re>=0)return re;let x=e.getBoundingClientRect(),{tStart:P,tEnd:U}=Pe({top:x.top,height:x.height},Je(),Tt(),Ie,Ge);return j(N(Je(),P,U,u))}return {destroy(){e.classList.remove(g),l.forEach(x=>{x.classList.remove(c),x.style.removeProperty("--ssd-len"),x.style.animationPlayState="";}),O.remove();},replay(){Q=false,re=-1,l.forEach(K);},pause(){Q=true,l.forEach(x=>{x.style.animationPlayState="paused";});},resume(){Q&&(Q=false,l.forEach(x=>{x.style.animationPlayState="running";}));},seek(x){let P=Math.min(1,Math.max(0,x));re=P,Q=true,l.forEach((U,Ee)=>{U.classList.remove(c),U.style.strokeDashoffset=h==="reverse"?`${f[Ee]*P}`:`${f[Ee]*(1-P)}`,m&&(U.style.opacity=h==="reverse"?`${1-P}`:`${P}`);});},getProgress(){return oe()},refresh(){l.forEach((x,P)=>{We(x,P),x.style.setProperty("--ssd-len",String(f[P]));});}}}if(ur())return ft(mr());function fr(){let o=Math.max(1,Qe),c=J?o:o*(1+Math.max(0,l.length-1)*S),g=0,T=0,B=false;function te(re){let oe=true,x=Math.min(1,Math.max(0,re/c));if(J){let P=Math.min(1,Math.max(0,re/o)),U=j(P);ue=U,e.style.setProperty("--scroll-draw-progress",String(U)),e.style.clipPath=be(h==="reverse"?1-U:U),$e?.(U),P<1&&(oe=false);}else {l.forEach((U,Ee)=>{let dr=Ee*S*o,Dt=Math.min(1,Math.max(0,(re-dr)/o));pt(U,Ee,j(Dt),h),Dt<1&&(oe=false);});let P=j(x);ue=P,$e?.(P),e.style.setProperty("--scroll-draw-progress",String(P));}if(X){let P=j(x);for(let U in X){let Ee=parseFloat(U);P>=Ee&&!Oe.has(Ee)&&(Oe.add(Ee),X[U]?.());}}return oe}function Y(re){if(ne)return;let oe=re-g;we||(we=true,Z?.());let x=te(oe);if(x&&!W){W=true,te(c),ee?.(),Ce<(fe==="infinite"?1/0:fe??0)&&(Ce++,ke=setTimeout(()=>{g=performance.now(),we=false,W=false,Oe.clear(),dt(),ve=requestAnimationFrame(Y);},le));return}x||(ve=requestAnimationFrame(Y));}function k(){cancelAnimationFrame(ve),clearTimeout(ke),g=performance.now(),T=0,ne=false,we=false,W=false,Ce=0,B=true,ue=0,Oe.clear(),dt(),ve=requestAnimationFrame(Y);}let O=new IntersectionObserver(re=>{re.forEach(oe=>{oe.isIntersecting&&!(L&&W)?k():!oe.isIntersecting&&!L&&!W&&(cancelAnimationFrame(ve),clearTimeout(ke),B=false);});},{root:z??null,threshold:q,rootMargin:De}),K;function Q(){clearTimeout(K),K=setTimeout(()=>l.forEach(We),150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),E>0?setTimeout(()=>O.observe(e),E):O.observe(e),{destroy(){cancelAnimationFrame(ve),clearTimeout(ke),O.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(K);},replay(){Ce=0,k();},pause(){ne||!B||(ne=true,T=performance.now()-g,cancelAnimationFrame(ve));},resume(){ne&&(ne=false,B=true,g=performance.now()-T,ve=requestAnimationFrame(Y));},seek(re){let oe=Math.min(1,Math.max(0,re));ue=oe,ne=true,T=oe*c,g=performance.now()-T,cancelAnimationFrame(ve),te(T);},getProgress(){return ue},refresh(){clearTimeout(K),l.forEach(We);}}}if(D)return ft(fr());At();let $t=()=>N(Je(),C,Me,1);function Ct(){W=true,ee?.(),Ce<(fe==="infinite"?1/0:fe)&&(Ce++,ke=setTimeout(()=>{ut=true;},le));}function kt(){ct=-1,Ue=[],we=false,W=false,ut=false,Oe.clear(),dt(),He=true;}function pr(){let o=performance.now(),c=Je();if(ut&&$t()%1&&kt(),!He&&_===false&&c===St)return;He=false,St=c;let g=u;if(_!==false){let k=o-xt,O=k>0?Math.abs(c-(Ze<0?c:Ze))/k:0;g=u*Math.max(.2,1+O*(typeof _=="number"?_:1)*.04);}Ze=c,xt=o;let T=y?Xe===-1||c>=Xe?"forward":"reverse":h;Xe=c;let B=$-M,te=true,Y=B===0?0:(c-M)/B;if(isNaN(Ne)||(Ne<=0&&Y>0&&pe?.(),Ne<1&&Y>=1&&Re?.(),Ne>=1&&Y<1&&de?.(),Ne>0&&Y<=0&&ce?.()),Ne=Y,J){let k=Pt(0,N(c,M,$,g));ue=k,e.style.setProperty("--scroll-draw-progress",String(k));let O=T==="reverse"?1-k:k;e.style.clipPath=be(O),$e?.(k),!we&&N(c,M,$,g)>0&&(we=true,Z?.()),k>=1&&!W?Ct():k<1&&!L&&(W=false);return}if(l.forEach((k,O)=>{let K=O*R*B,Q=Pt(O,N(c,M+K,$+K,g));pt(k,O,Q,T),O===0&&(ue=Q,$e?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(te=false);}),X){let k=j(N(c,M,$,g));for(let O in X){let K=parseFloat(O);k>=K&&!Oe.has(K)&&(Oe.add(K),X[O]?.());}}!we&&N(c,M,$,g)>0&&(we=true,Z?.()),te&&!W?Ct():!te&&!L&&(W=false);}let Be=Le(z??window,[e],$t,pr,()=>{let o=f.join();l.forEach(We),At(),He=true,f.join()!==o&&qe();}),gt=E>0;function qe(){Be.hold(ne||gt);}let Ot;return gt&&(Ot=setTimeout(()=>{gt=false,qe();},E)),qe(),ft({destroy(){clearTimeout(ke),clearTimeout(Ot),Be.off(),Et();},replay(){kt(),Xe=-1,Ze=-1,Ce=0,ne=false,ue=0,clearTimeout(ke),qe();},pause(){ne=true,Be.hold(true);},resume(){ne&&(ne=false,He=true,qe());},seek(o){let c=Math.min(1,Math.max(0,o));ue=c,ct=c,Ue=[],ne=true,Be.hold(true),cr(c,h),He=true;},getProgress(){return ue},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function Lr(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):(I("Container not found:",e),t)}function $r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Kt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function Cr(e,r,t){let n=Kt(e),s=Kt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?t<1?`${i.fn}(${i.nums.map((m,p)=>`${m}${i.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((m,p)=>`${m}${u.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,p)=>`${m+(u.nums[p]-m)*t}${i.units[p]}`).join(", ")})`}).join(" ")}function er(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if($r(n))return tt(n,s,t);if(n.includes("("))return Cr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),m=parseFloat(a[1]);return `${u+(m-u)*t}${i[2]||a[2]}`}return t<1?n:s}function kr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Or=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Dr=0,tr="--scroll-draw-progress";function Rr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var nr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function bt(e,r){return typeof window>"u"?nr:r.respectReducedMotion===false?rr(e,r,false):ze(r,(t,n)=>rr(e,t,n))}function rr(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:u=false,axis:m="y",scrollContainer:p,native:b=true,velocityScale:S=false,triggerElement:h,onProgress:L,onComplete:F,onEnter:d,onLeave:v,onEnterBack:y,onLeaveBack:E}=r,w=Ae(i,"ease-out"),H=Se(s.start||"top bottom"),se=Se(s.end||"bottom top"),X=h??e,_=typeof p=="string"?document.querySelector(p):p??null,q=Object.entries(n).map(([l,f])=>({prop:kr(l),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function De(){let l=window.getComputedStyle(e);for(let f of q)f.from===""&&(f.from=l.getPropertyValue(f.prop).trim()||"0");}function fe(){for(let l of q)e.style.setProperty(l.prop,String(l.to));}let le=new Map;for(let l of [...q.map(f=>f.prop),tr])le.set(l,e.style.getPropertyValue(l));function V(){for(let[l,f]of le)f?e.style.setProperty(l,f):e.style.removeProperty(l);}if(t)return fe(),F?.(),{...nr,destroy:V,getProgress:()=>1};De();let A=()=>_?m==="x"?_.scrollLeft:_.scrollTop:m==="x"?window.scrollX:window.scrollY,D=()=>_?m==="x"?_.clientWidth:_.clientHeight:m==="x"?window.innerWidth:window.innerHeight,Qe=typeof i=="string"?rt(i):null;function lt(){if(!b||!Rr()||!Qe||m!=="y"||_||X!==e||u||a!==1||L||F||d||v||y||E||S!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let l of q)if(!Or.has(l.prop))return false;return true}function $e(){let l=`ssd-a-${++Dr}`,f=q.map(C=>`${C.prop}:${C.from}`).join(";"),G=q.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${f}}to{${G}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${Qe};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let $=()=>{let C=e.getBoundingClientRect();return Pe({top:C.top,height:C.height},A(),D(),H,se)};xe(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:$});let R={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",V(),me(e);},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(C){let Me=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let W of q)e.style.setProperty(W.prop,er(W.from,W.to,Me));},getProgress(){let{tStart:C,tEnd:Me}=$();return w(N(A(),C,Me,a))}};return R}if(lt())return $e();let Z=0,ee=0,pe=false,Re=-1,de=0,ce=0,J=false,j=NaN,Ie=-1,Ge=0,z=X===e?q:[],ge=false;function ye(){let l=e.style,f=z.map(R=>l.getPropertyValue(R.prop)),G=l.transition;z.length&&(l.transition="none"),z.forEach(R=>l.setProperty(R.prop,le.get(R.prop)??""));let M=Ke(X,_,m);z.forEach((R,C)=>l.setProperty(R.prop,f[C])),z.length&&(e.offsetWidth,l.transition=G);let $=Pe(M,M.scroll,D(),H,se);ge&&Math.abs($.tStart-Z)<1&&Math.abs($.tEnd-ee)<1||(ge=true,Z=$.tStart,ee=$.tEnd);}function ie(l){e.style.setProperty(tr,String(l));for(let f of q)e.style.setProperty(f.prop,er(f.from,f.to,l));L?.(l);}function Te(l){if(isNaN(j)){j=l;return}j<=0&&l>0&&d?.(),j<1&&l>=1&&v?.(),j>=1&&l<1&&y?.(),j>0&&l<=0&&E?.(),j=l;}function he(){if(pe)return;let l=performance.now(),f=A(),G=a;if(S!==false){let C=l-Ge,Me=C>0?Math.abs(f-(Ie<0?f:Ie))/C:0;G=a*Math.max(.2,1+Me*(typeof S=="number"?S:1)*.04);}Ie=f,Ge=l;let M=ee===Z?0:(f-Z)/(ee-Z);Te(M);let $=N(f,Z,ee,G),R=u?Math.max(Re,w(de=Math.max(de,$))):w($);ce=R,ie(R),R>=1&&!J?(J=true,F?.()):R<1&&!u&&(J=false);}let ae=Le(_??window,[X],()=>N(A(),Z,ee,Math.min(a,1)),he,ye);ye(),ee===Z&&I("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),de=N(A(),Z,ee,a),ce=w(de),ie(ce),xe(e,{type:"animate",getProgress:()=>ce,getTrigger:()=>({tStart:Z,tEnd:ee})});function be(){pe=true,ae.hold(true);}return {destroy(){pe=true,ae.off(),V(),me(e);},replay(){Re=-1,de=0,J=false,ce=0,pe=false,ie(0),ae.hold(false);},pause:be,resume(){pe&&(pe=false,ae.hold(false));},seek(l){let f=Math.min(1,Math.max(0,l));ce=f,Re=f,de=0,be(),ie(f);},getProgress(){return ce},refresh:ae.remeasure}}var it={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ir(e,r){if(typeof window>"u")return it;let t=typeof e=="string"?document.querySelector(e):e;return t?bt(t,r):(I("scrollAnimate: element not found:",e),it)}function Hr(e,r={}){if(typeof window>"u")return it;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return I("scrollParallax: element not found:",e),it;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:a,onProgress:u}=r,m=-n*100,p=t.style,b=!!t.ownerSVGElement,S=p.getPropertyValue("transform-box");b&&p.setProperty("transform-box","fill-box");let h=bt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:u});return b?{...h,destroy(){h.destroy(),p.setProperty("transform-box",S);}}:h}var Nr=({decimals:e,format:r})=>e!==void 0?t=>t.toFixed(e):r??(t=>String(Math.round(t)));var wt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Fr(e,r){if(typeof window>"u")return wt;let t=typeof e=="string"?document.querySelector(e):e;return t?ze(r,(n,s)=>_r(t,n,s)):(I("scrollCounter: element not found:",e),wt)}function _r(e,r,t){let{from:n=0,to:s,easing:i="ease-out",trigger:a={},once:u=true,onComplete:m}=r,p=Nr(r),b=Ae(i,"ease-out"),S=Se(a.start||"top 80%"),h=Se(a.end||"top 20%");if(t)return e.textContent=p(s),m?.(),{...wt,getProgress:()=>1};let L=0,F=0,d=false,v=-1,y=0,E=0,w=false,H=()=>window.scrollY,se=()=>window.innerHeight;function X(){let A=e.getBoundingClientRect(),D=Pe({top:A.top,height:A.height},H(),se(),S,h);d&&Math.abs(D.tStart-L)<1&&Math.abs(D.tEnd-F)<1||(d=true,L=D.tStart,F=D.tEnd);}let _=e.style.getPropertyValue("--scroll-draw-progress");function q(A){e.textContent=p(n+(s-n)*A),e.style.setProperty("--scroll-draw-progress",String(A));}let De=()=>N(H(),L,F,1);function fe(){let A=De(),D=u?Math.max(v,b(y=Math.max(y,A))):b(A);E=D,q(D),D>=1&&!w?(w=true,m?.()):D<1&&!u&&(w=false);}X();{y=N(H(),L,F,1);let A=b(y);E=A,q(A);}let le=Le(window,[e],De,fe,X);xe(e,{type:"counter",getProgress:()=>E,getTrigger:()=>({tStart:L,tEnd:F})});let V=()=>le.hold(false);return {destroy(){le.off(),e.style.setProperty("--scroll-draw-progress",_),me(e);},replay(){v=-1,y=0,w=false,E=0,q(0),V();},pause:()=>le.hold(true),resume:V,seek(A){let D=Math.min(1,Math.max(0,A));E=D,v=D,y=0,le.hold(true),q(D);},getProgress(){return E}}}var or="http://www.w3.org/2000/svg",Vr="cinematic-photo",ar=e=>e<0?0:e>1?1:e;function at(e){let r=parseFloat(e);return Number.isFinite(r)?ar(r/100):0}function sr(e){return Ae(e)}var ir=e=>({destroy(){},getProgress:()=>e}),vt=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||I("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return ir(0);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 d of r.scenes){if(d.background){let y=document.createElement("img");y.id=Vr,y.src=d.background,y.alt="",y.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(y);}let v=d.animations.filter(y=>y.type==="draw");if(v.length){let y=document.createElementNS(or,"svg");y.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),y.setAttribute("preserveAspectRatio","xMidYMid meet"),y.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(y);for(let E of v){let w=document.createElementNS(or,"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 H=E.length||w.getTotalLength?.()||0;w.style.strokeDasharray=Ve(H),w.style.strokeDashoffset=String(H),y.appendChild(w),s.push({kind:"draw",el:w,start:at(E.start),end:at(E.end),ease:sr(E.easing),length:H});}}for(let y of d.animations){if(y.type!=="fade")continue;let E=n.querySelector(y.target)??document.querySelector(y.target);E&&(E.style.opacity=String(y.from),s.push({kind:"fade",el:E,start:at(y.start),end:at(y.end),ease:sr("ease-in-out"),from:y.from,to:y.to}));}}let i=0,a=null;for(let d=t.parentElement;d?.parentElement;d=d.parentElement)if(/[ao]/.test(getComputedStyle(d).overflowY)&&d.scrollHeight>d.clientHeight&&(d!==document.body||/[aoh]/.test(getComputedStyle(d.parentElement).overflowY))){a=d;break}let u=0,m=0,p=()=>{let d=t.getBoundingClientRect().top;u=a?d-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:d+window.scrollY,m=u+Math.max(0,t.offsetHeight-(a?a.clientHeight:window.innerHeight));},b=()=>{let d=a?a.scrollTop:window.scrollY;return m<=u?d>=u?1:0:N(d,u,m,1)},S=d=>{for(let v of s){let y=v.end-v.start,E=y<=0?d>=v.end?1:0:ar((d-v.start)/y),w=v.ease(E);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return S(1),ir(1);let h=()=>{i=b(),S(i);};p(),h();let L=Le(a||window,[t],b,h,p);xe(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let F=nt(d=>{d&&(F(),L.off(),me(t),i=1,S(1));});return {destroy(){F(),L.off(),me(t);},getProgress:()=>i}}};
4
+ exports.Cinematic=vt;exports.PRESETS=ht;exports.createBounce=Ht;exports.createElastic=Nt;exports.createSpring=It;exports.scrollAnimate=Ir;exports.scrollCounter=Fr;exports.scrollDraw=Lr;exports.scrollParallax=Hr;
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- export{a as scrollAnimate,b as scrollParallax}from'./chunk-UBH4K5YD.mjs';export{a as Cinematic}from'./chunk-ASCOHQQD.mjs';export{a as scrollDraw}from'./chunk-5U4JXBHR.mjs';export{a as scrollCounter}from'./chunk-Z72TVDHY.mjs';import'./chunk-HAGTU5EX.mjs';export{a as PRESETS}from'./chunk-XLXVGQ3P.mjs';import'./chunk-7LDSB4FT.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-YOOPMYT6.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-IXR6RML7.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-EBU6E26L.mjs';import'./chunk-LFSU6LR3.mjs';
1
+ export{a as scrollAnimate,b as scrollParallax}from'./chunk-UBH4K5YD.mjs';export{a as Cinematic}from'./chunk-ASCOHQQD.mjs';export{a as scrollDraw}from'./chunk-5U4JXBHR.mjs';export{b as scrollCounter}from'./chunk-OGFXZCKC.mjs';import'./chunk-HAGTU5EX.mjs';export{a as PRESETS}from'./chunk-XLXVGQ3P.mjs';import'./chunk-7LDSB4FT.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-YOOPMYT6.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-IXR6RML7.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-EBU6E26L.mjs';import'./chunk-LFSU6LR3.mjs';