svg-scroll-draw 2.23.6 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +84 -3
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +33 -49
- package/dist/cdn/svg-scroll-draw.global.js +3 -3
- package/dist/{chunk-XNM3VKEK.mjs → chunk-32ZCSGFZ.mjs} +1 -1
- package/dist/{chunk-OSGWGHQJ.mjs → chunk-5SKWSPQT.mjs} +1 -1
- package/dist/{chunk-VJ5ZU55P.mjs → chunk-7USW2XFB.mjs} +1 -1
- package/dist/{chunk-K6VATIJH.mjs → chunk-7XOFQCQE.mjs} +1 -1
- package/dist/chunk-BDXWPUBJ.mjs +2 -0
- package/dist/{chunk-NYQJPPMP.mjs → chunk-BRV2B2YW.mjs} +1 -1
- package/dist/chunk-EBU6E26L.mjs +1 -0
- package/dist/{chunk-22B37AWY.mjs → chunk-NX74KN5X.mjs} +1 -1
- package/dist/{chunk-CZLUBJAI.mjs → chunk-QZKYGS74.mjs} +1 -1
- package/dist/{chunk-PAGN26EH.mjs → chunk-U5TKLHGW.mjs} +1 -1
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.d.mts +1 -1
- package/dist/cinematic/index.d.ts +1 -1
- package/dist/cinematic/index.mjs +1 -1
- package/dist/devtools/index.cjs +1 -1
- package/dist/devtools/index.mjs +1 -1
- package/dist/frames/index.cjs +1 -0
- package/dist/frames/index.d.mts +42 -0
- package/dist/frames/index.d.ts +42 -0
- package/dist/frames/index.mjs +1 -0
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.mjs +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +1 -1
- package/dist/nuxt/index.mjs +1 -1
- package/dist/pin/index.mjs +1 -1
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.mjs +1 -1
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.mjs +1 -1
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.mjs +1 -1
- package/package.json +18 -2
- package/dist/chunk-BCV4RAIX.mjs +0 -1
- package/dist/chunk-BSW7W2Y5.mjs +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {e,b as b$2}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$1}from'./chunk-5PJEKEEP.mjs';import {a,b as b$1}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var x="http://www.w3.org/2000/svg",G="cinematic-photo",D=a=>a<0?0:a>1?1:a;function u(a){let i=parseFloat(a);return Number.isFinite(i)?D(i/100):0}function L(a){return d[a]??d.linear}var P=a=>({destroy(){},getProgress:()=>a}),R=class{constructor(i){if(typeof document>"u"){this.mount=null;return}this.mount=typeof i.wrapper=="string"?document.querySelector(i.wrapper):i.wrapper,this.mount||b("Cinematic: wrapper not found:",i.wrapper);}loadStory(i){let s=this.mount;if(typeof window>"u"||!s)return P(0);s.style.position="relative",s.style.height=i.totalHeight,s.style.display="block";let l=document.createElement("div");l.setAttribute("data-cinematic-stage",""),l.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",s.appendChild(l);let f=[];for(let t of i.scenes){if(t.background){let e=document.createElement("img");e.id=G,e.src=t.background,e.alt="",e.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",l.appendChild(e);}let n=t.animations.filter(e=>e.type==="draw");if(n.length){let e=document.createElementNS(x,"svg");e.setAttribute("viewBox",`0 0 ${i.canvas.width} ${i.canvas.height}`),e.setAttribute("preserveAspectRatio","xMidYMid meet"),e.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",l.appendChild(e);for(let o of n){let r=document.createElementNS(x,"path");r.id=o.target.replace(/^#/,""),r.setAttribute("d",o.d),r.setAttribute("fill","none"),r.setAttribute("stroke",o.stroke),r.setAttribute("stroke-width",String(o.strokeWidth)),r.setAttribute("stroke-linecap","round"),r.setAttribute("stroke-linejoin","round");let h=o.length||r.getTotalLength?.()||0;r.style.strokeDasharray=String(h),r.style.strokeDashoffset=String(h),e.appendChild(r),f.push({kind:"draw",el:r,start:u(o.start),end:u(o.end),ease:L(o.easing),length:h});}}for(let e of t.animations){if(e.type!=="fade")continue;let o=l.querySelector(e.target)??document.querySelector(e.target);o&&(o.style.opacity=String(e.from),f.push({kind:"fade",el:o,start:u(e.start),end:u(e.end),ease:L("ease-in-out"),from:e.from,to:e.to}));}}let d=0,c=null;for(let t=s.parentElement;t?.parentElement;t=t.parentElement)if(/[ao]/.test(getComputedStyle(t).overflowY)&&t.scrollHeight>t.clientHeight&&(t!==document.body||/[aoh]/.test(getComputedStyle(t.parentElement).overflowY))){c=t;break}let m=0,p=0,b=()=>{let t=s.getBoundingClientRect().top;m=c?t-c.getBoundingClientRect().top-c.clientTop+c.scrollTop:t+window.scrollY,p=m+Math.max(0,s.offsetHeight-(c?c.clientHeight:window.innerHeight));},S=()=>{let t=c?c.scrollTop:window.scrollY;return p<=m?t>=m?1:0:b$2(t,m,p,1)},g=t=>{for(let n of f){let e=n.end-n.start,o=e<=0?t>=n.end?1:0:D((t-n.start)/e),r=n.ease(o);n.kind==="draw"?n.el.style.strokeDashoffset=String(n.length*(1-r)):n.el.style.opacity=String(n.from+(n.to-n.from)*r);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return g(1),P(1);let E=()=>{d=S(),g(d);};b(),E();let v=e(c||window,[s],S,E,b);a(s,{type:"draw",getProgress:()=>d,getTrigger:()=>({tStart:m,tEnd:p})});let k=a$1(t=>{t&&(k(),v.off(),b$1(s),d=1,g(1));});return {destroy(){k(),v.off(),b$1(s);},getProgress:()=>d}}};
|
|
2
|
+
export{R as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$1}from'./chunk-5PJEKEEP.mjs';import {a as a$2,b as b$1}from'./chunk-
|
|
1
|
+
import {a,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$1}from'./chunk-5PJEKEEP.mjs';import {a as a$2,b as b$1}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var X={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function se(c$1,h={}){if(typeof window>"u")return X;let y=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!y||y.tagName.toLowerCase()!=="video")return b("scrollVideo: <video> element not found:",c$1),X;let t=y,{trigger:C={},easing:v="linear",once:V=false,axis:u="y",preload:Y="auto",triggerElement:j,onReady:L,onComplete:J,onProgress:K}=h,R=j??t,a$3=window.matchMedia("(prefers-reduced-motion: reduce)").matches,z=typeof v=="function"?v:d[v]??d.linear,Q=a(C.start||"top top"),U=a(C.end||"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=Y);let A=h.from??0,b$3=h.to,m=0,f=0,r=false,E=-1,g=0,n=0,p=false,i=false,I=()=>u==="x"?window.scrollX:window.scrollY,Z=()=>u==="x"?window.innerWidth:window.innerHeight;function S(){let e=R.getBoundingClientRect(),o=u==="x"?e.left:e.top,d=u==="x"?e.width:e.height,H=c({top:o,height:d},I(),Z(),Q,U);m=H.tStart,f=H.tEnd,i&&f===m&&b("scrollVideo: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t);}let w=NaN;function s(e){if(!i)return;let o=b$3??t.duration??0,d=A+(o-A)*e;d!==w&&(w=d,t.currentTime=d),t.style.setProperty("--scroll-draw-progress",String(e)),K?.(e);}let O=()=>b$2(I(),m,f,1);function $(){if(!i||a$3)return;let e=O(),o=V?Math.max(E,z(g=Math.max(g,e))):z(e);n=o,s(o),o>=1&&!p?(p=true,J?.()):o<1&&!V&&(p=false);}let l=e(window,[R],O,$,S),x=()=>l.hold(r||!i||a$3);x();function N(){if(i=true,b$3===void 0&&(b$3=t.duration),a$3){s(1),L?.();return}S(),L?.(),r?s(n):x();}t.readyState>=1?N():t.addEventListener("loadedmetadata",N,{once:true}),i||S();let k=a$3?()=>{}:a$1(e=>{e&&(k(),a$3=true,l.hold(true),s(1));});a$2(t,{type:"video",getProgress:()=>n,getTrigger:()=>({tStart:m,tEnd:f})});function D(){r&&(r=false,x());}return {destroy(){l.off(),t.removeEventListener("loadedmetadata",N),k(),b$1(t);},replay(){E=-1,g=0,p=false,n=0,w=NaN,s(0),D();},pause(){r=true,l.hold(true);},resume:D,seek(e){let o=Math.min(1,Math.max(0,e));n=o,E=o,g=0,r=true,l.hold(true),w=NaN,s(o);},getProgress(){return n}}}export{se as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=Symbol.for("svg-scroll-draw.registry");function t(){let e=globalThis;return e[r]||(e[r]=new Map)}function s(e,n){t().set(e,n);}function o(e){t().delete(e);}function i(){return t()}export{s as a,o as b,i as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-7XOFQCQE.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';function l(r,s){let n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return n;let o=typeof r=="string"?document.querySelector(r):r;return o?b(o,s):(b$1("Container not found:",r),n)}export{l as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-7USW2XFB.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';var n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function b(e,o){if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;return r?a(r,o):(b$1("scrollAnimate: element not found:",e),n)}function P(e,o={}){if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return b$1("scrollParallax: element not found:",e),n;let{speed:c=.3,axis:p="y",easing:f="linear",trigger:u,onProgress:g}=o,i=-c*100,s=r.style,m=!!r.ownerSVGElement,y=s.getPropertyValue("transform-box");m&&s.setProperty("transform-box","fill-box");let l=a(r,{props:p==="x"?{transform:["translateX(0%)",`translateX(${i}%)`]}:{transform:["translateY(0%)",`translateY(${i}%)`]},trigger:u??{start:"top bottom",end:"bottom top"},easing:f,native:false,onProgress:g});return m?{...l,destroy(){l.destroy(),s.setProperty("transform-box",y);}}:l}export{b as a,P as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,b as b$1,e,c}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$2,b as b$2}from'./chunk-
|
|
1
|
+
import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,b as b$1,e,c}from'./chunk-NV6YTPHI.mjs';import {d}from'./chunk-THPTANES.mjs';import {a as a$2,b as b$2}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var C={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function U(t,p){if(typeof window>"u")return C;let a$1=typeof t=="string"?document.querySelector(t):t;return a$1?a(p,(l,c)=>B(a$1,l,c)):(b("scrollCounter: element not found:",t),C)}function B(t,p,a){let{from:l=0,to:c$1,format:F,easing:f="ease-out",trigger:P={},once:E=true,decimals:M,onComplete:v}=p,x=M!==void 0?e=>e.toFixed(M):F??(e=>String(Math.round(e))),d$1=typeof f=="function"?f:d[f]??d["ease-out"],G=a$1(P.start||"top 80%"),L=a$1(P.end||"top 20%");if(a)return t.textContent=x(c$1),v?.(),{...C,getProgress:()=>1};let s=0,i=0,T=false,h=-1,o=0,n=0,u=false,w=()=>window.scrollY,V=()=>window.innerHeight;function A(){let e=t.getBoundingClientRect(),r=c({top:e.top,height:e.height},w(),V(),G,L);T&&Math.abs(r.tStart-s)<1&&Math.abs(r.tEnd-i)<1||(T=true,s=r.tStart,i=r.tEnd);}let _=t.style.getPropertyValue("--scroll-draw-progress");function m(e){t.textContent=x(l+(c$1-l)*e),t.style.setProperty("--scroll-draw-progress",String(e));}let I=()=>b$1(w(),s,i,1);function q(){let e=I(),r=E?Math.max(h,d$1(o=Math.max(o,e))):d$1(e);n=r,m(r),r>=1&&!u?(u=true,v?.()):r<1&&!E&&(u=false);}A();{o=b$1(w(),s,i,1);let e=d$1(o);n=e,m(e);}let g=e(window,[t],I,q,A);a$2(t,{type:"counter",getProgress:()=>n,getTrigger:()=>({tStart:s,tEnd:i})});let O=()=>g.hold(false);return {destroy(){g.off(),t.style.setProperty("--scroll-draw-progress",_),b$2(t);},replay(){h=-1,o=0,u=false,n=0,m(0),O();},pause:()=>g.hold(true),resume:O,seek(e){let r=Math.min(1,Math.max(0,e));n=r,h=r,o=0,g.hold(true),m(r);},getProgress(){return n}}}export{U as a};
|
package/dist/cinematic/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
exports.Cinematic=
|
|
1
|
+
'use strict';function W({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function Y({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),o=Math.sqrt(r),s=0,u=[];for(let d=0;d<t;d++){let m=Math.pow(o,d);u.push(m),s+=m;}let l=[0],g=0;for(let d=0;d<t;d++)g+=u[d]/s,l.push(g);return d=>{if(d<=0)return 0;if(d>=1)return 1;for(let m=0;m<t;m++)if(d<=l[m+1]){let b=(d-l[m])/(l[m+1]-l[m]);if(m===0)return b*(2-b);let h=1-Math.pow(r,m);return h+(1-h)*(2*b-1)*(2*b-1)}return 1}}function B({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),o=t<=1?r/4:r/(2*Math.PI)*Math.asin(1/t);return s=>s<=0?0:s>=1?1:t*Math.pow(2,-10*s)*Math.sin((s-o)*(2*Math.PI)/r)+1}var A={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:W(),bounce:Y(),elastic:B()};var z=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function T(e,...n){z&&console.warn(`[svg-scroll-draw] ${e}`,...n);}var R=Symbol.for("svg-scroll-draw.registry");function k(){let e=globalThis;return e[R]||(e[R]=new Map)}function C(e,n){k().set(e,n);}function _(e){k().delete(e);}function D(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let r=n;return r.addListener?.(t),()=>r.removeListener?.(t)}var w,M=new Set,S=new WeakMap,v=new Map,H=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function $(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let r=t;r;r=r.previousElementSibling)n.add(r);return n}function O(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();w??(w=new ResizeObserver(o=>{let s=false;for(let{target:u}of o)S.get(u)!==H(u)&&(s=true),S.set(u,"");s&&M.forEach(u=>u());})),M.add(t);let r=$(e);return [document.body,document.documentElement].forEach(o=>o&&r.add(o)),r.forEach(o=>{S.has(o)||S.set(o,H(o)),v.set(o,(v.get(o)??0)+1),w.observe(o);}),()=>{M.delete(t)&&(r.forEach(o=>{let s=(v.get(o)??1)-1;if(s)return void v.set(o,s);v.delete(o),w?.unobserve(o);}),M.size||(w?.disconnect(),w=void 0));}}function G(e,n,t,r,o){let s,u=NaN,l,g,d=()=>{s=0,r(),!l&&!s&&(u=t())>0&&u<1&&(s=requestAnimationFrame(d));},m=()=>{!s&&!l&&t()!==u&&(s=requestAnimationFrame(d));},b=c=>{l=c,cancelAnimationFrame(s),s=u=NaN,m();},h=()=>{clearTimeout(g),o(),m();},y=()=>{clearTimeout(g),g=setTimeout(h,150);},E=O(n,y),i=c=>{e[c]("scroll",m,{passive:true}),window[c]("resize",y),window[c]("orientationchange",y);};return i("addEventListener"),m(),{hold:b,remeasure:h,off(){b(true),i("removeEventListener"),E(),clearTimeout(g);}}}function I(e,n,t){return Math.min(t,Math.max(n,e))}function N(e,n,t,r){return t===n?0:I((e-n)/(t-n)*r,0,1)}var P="http://www.w3.org/2000/svg",j="cinematic-photo",q=e=>e<0?0:e>1?1:e;function x(e){let n=parseFloat(e);return Number.isFinite(n)?q(n/100):0}function V(e){return A[e]??A.linear}var F=e=>({destroy(){},getProgress:()=>e}),Q=class{constructor(n){if(typeof document>"u"){this.mount=null;return}this.mount=typeof n.wrapper=="string"?document.querySelector(n.wrapper):n.wrapper,this.mount||T("Cinematic: wrapper not found:",n.wrapper);}loadStory(n){let t=this.mount;if(typeof window>"u"||!t)return F(0);t.style.position="relative",t.style.height=n.totalHeight,t.style.display="block";let r=document.createElement("div");r.setAttribute("data-cinematic-stage",""),r.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(r);let o=[];for(let i of n.scenes){if(i.background){let a=document.createElement("img");a.id=j,a.src=i.background,a.alt="",a.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",r.appendChild(a);}let c=i.animations.filter(a=>a.type==="draw");if(c.length){let a=document.createElementNS(P,"svg");a.setAttribute("viewBox",`0 0 ${n.canvas.width} ${n.canvas.height}`),a.setAttribute("preserveAspectRatio","xMidYMid meet"),a.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",r.appendChild(a);for(let f of c){let p=document.createElementNS(P,"path");p.id=f.target.replace(/^#/,""),p.setAttribute("d",f.d),p.setAttribute("fill","none"),p.setAttribute("stroke",f.stroke),p.setAttribute("stroke-width",String(f.strokeWidth)),p.setAttribute("stroke-linecap","round"),p.setAttribute("stroke-linejoin","round");let L=f.length||p.getTotalLength?.()||0;p.style.strokeDasharray=String(L),p.style.strokeDashoffset=String(L),a.appendChild(p),o.push({kind:"draw",el:p,start:x(f.start),end:x(f.end),ease:V(f.easing),length:L});}}for(let a of i.animations){if(a.type!=="fade")continue;let f=r.querySelector(a.target)??document.querySelector(a.target);f&&(f.style.opacity=String(a.from),o.push({kind:"fade",el:f,start:x(a.start),end:x(a.end),ease:V("ease-in-out"),from:a.from,to:a.to}));}}let s=0,u=null;for(let i=t.parentElement;i?.parentElement;i=i.parentElement)if(/[ao]/.test(getComputedStyle(i).overflowY)&&i.scrollHeight>i.clientHeight&&(i!==document.body||/[aoh]/.test(getComputedStyle(i.parentElement).overflowY))){u=i;break}let l=0,g=0,d=()=>{let i=t.getBoundingClientRect().top;l=u?i-u.getBoundingClientRect().top-u.clientTop+u.scrollTop:i+window.scrollY,g=l+Math.max(0,t.offsetHeight-(u?u.clientHeight:window.innerHeight));},m=()=>{let i=u?u.scrollTop:window.scrollY;return g<=l?i>=l?1:0:N(i,l,g,1)},b=i=>{for(let c of o){let a=c.end-c.start,f=a<=0?i>=c.end?1:0:q((i-c.start)/a),p=c.ease(f);c.kind==="draw"?c.el.style.strokeDashoffset=String(c.length*(1-p)):c.el.style.opacity=String(c.from+(c.to-c.from)*p);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return b(1),F(1);let h=()=>{s=m(),b(s);};d(),h();let y=G(u||window,[t],m,h,d);C(t,{type:"draw",getProgress:()=>s,getTrigger:()=>({tStart:l,tEnd:g})});let E=D(i=>{i&&(E(),y.off(),_(t),s=1,b(1));});return {destroy(){E(),y.off(),_(t);},getProgress:()=>s}}};
|
|
2
|
+
exports.Cinematic=Q;
|
|
@@ -49,7 +49,7 @@ interface CinematicOptions {
|
|
|
49
49
|
wrapper: string | HTMLElement;
|
|
50
50
|
}
|
|
51
51
|
interface CinematicInstance {
|
|
52
|
-
/** Stop the scroll loop and detach
|
|
52
|
+
/** Stop the scroll loop and detach its listeners (built DOM is left in place). */
|
|
53
53
|
destroy: () => void;
|
|
54
54
|
/** Current global scroll progress through the story (0–1). */
|
|
55
55
|
getProgress: () => number;
|
|
@@ -49,7 +49,7 @@ interface CinematicOptions {
|
|
|
49
49
|
wrapper: string | HTMLElement;
|
|
50
50
|
}
|
|
51
51
|
interface CinematicInstance {
|
|
52
|
-
/** Stop the scroll loop and detach
|
|
52
|
+
/** Stop the scroll loop and detach its listeners (built DOM is left in place). */
|
|
53
53
|
destroy: () => void;
|
|
54
54
|
/** Current global scroll progress through the story (0–1). */
|
|
55
55
|
getProgress: () => number;
|
package/dist/cinematic/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as Cinematic}from'../chunk-
|
|
1
|
+
export{a as Cinematic}from'../chunk-BDXWPUBJ.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';
|
package/dist/devtools/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var E=Symbol.for("svg-scroll-draw.registry");function L(){let e=globalThis;return e[E]||(e[E]=new Map)}function g(){return L()}var h=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",text:"#fb923c",pin:"#f43f5e",snap:"#22d3ee"},n=null,o=null,b=0,p=false,m=null;function R(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function M(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of g()){let{tStart:i,tEnd:r}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=i-e,s=r-e;if(s<-100||f>l+100)continue;let c=(u,y)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let x=document.createElement("span");return x.textContent=y,x.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(x),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function $(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function S(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=g();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,i]of e){let r=i.getProgress(),d=v[i.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:i.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${i.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let y=document.createElement("div");y.style.cssText=`height:100%;width:${Math.round(r*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(y),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(r*100)}%`,s.appendChild(a),n.appendChild(s);}}function w(){M(),S(),b=requestAnimationFrame(w);}function T(){h&&(p||(p=true,R(),$(),b=requestAnimationFrame(w),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),C());},window.addEventListener("keydown",m)));}function _(){p&&(p=false,cancelAnimationFrame(b),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function C(){p?_():T();}function k(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=g().get(l);if(!t)return;let i=v[t.type]??"#60a5fa",r=l,d=r.style.outline;r.style.outline=`2px solid ${i}`,r.style.outlineOffset="2px",setTimeout(()=>{r.style.outline=d,r.style.outlineOffset="";},2e3);}var A={enable:T,disable:_,toggle:C,highlight:k};exports.devtools=A;
|
|
1
|
+
'use strict';var E=Symbol.for("svg-scroll-draw.registry");function L(){let e=globalThis;return e[E]||(e[E]=new Map)}function g(){return L()}var h=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",frames:"#e879f9",text:"#fb923c",pin:"#f43f5e",snap:"#22d3ee"},n=null,o=null,b=0,p=false,m=null;function R(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function M(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of g()){let{tStart:i,tEnd:r}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=i-e,s=r-e;if(s<-100||f>l+100)continue;let c=(u,y)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let x=document.createElement("span");return x.textContent=y,x.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(x),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function $(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function S(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=g();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,i]of e){let r=i.getProgress(),d=v[i.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:i.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${i.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let y=document.createElement("div");y.style.cssText=`height:100%;width:${Math.round(r*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(y),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(r*100)}%`,s.appendChild(a),n.appendChild(s);}}function w(){M(),S(),b=requestAnimationFrame(w);}function T(){h&&(p||(p=true,R(),$(),b=requestAnimationFrame(w),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),C());},window.addEventListener("keydown",m)));}function _(){p&&(p=false,cancelAnimationFrame(b),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function C(){p?_():T();}function k(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=g().get(l);if(!t)return;let i=v[t.type]??"#60a5fa",r=l,d=r.style.outline;r.style.outline=`2px solid ${i}`,r.style.outlineOffset="2px",setTimeout(()=>{r.style.outline=d,r.style.outlineOffset="";},2e3);}var A={enable:T,disable:_,toggle:C,highlight:k};exports.devtools=A;
|
package/dist/devtools/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c}from'../chunk-
|
|
1
|
+
import {c}from'../chunk-EBU6E26L.mjs';import {a}from'../chunk-LFSU6LR3.mjs';var v={draw:"#60a5fa",animate:"#4ade80",counter:"#fbbf24",video:"#c084fc",frames:"#e879f9",text:"#fb923c",pin:"#f43f5e",snap:"#22d3ee"},n=null,o=null,h=0,p=false,m=null;function L(){o?.remove(),o=document.createElement("div"),o.setAttribute("data-ssd-devtools-overlay",""),o.style.cssText="position:fixed;pointer-events:none;z-index:99998;inset:0;overflow:hidden;",document.body.appendChild(o);}function $(){if(!o)return;o.innerHTML="";let e=window.scrollY,l=window.innerHeight;for(let[,t]of c()){let{tStart:r,tEnd:i}=t.getTrigger(),d=v[t.type]??"#60a5fa",f=r-e,s=i-e;if(s<-100||f>l+100)continue;let c=(u,x)=>{let a=document.createElement("div");a.style.cssText=`position:absolute;left:0;right:0;top:${u}px;height:2px;background:${d};opacity:0.85;`;let g=document.createElement("span");return g.textContent=x,g.style.cssText=`position:absolute;right:8px;top:-18px;font:bold 9px/1 monospace;color:#fff;background:${d};padding:2px 5px;border-radius:3px;white-space:nowrap;`,a.appendChild(g),a};o.appendChild(c(f,`\u25B6 ${t.type}:start`)),o.appendChild(c(s,`\u25A0 ${t.type}:end`));}}function M(){n?.remove(),n=document.createElement("div"),n.setAttribute("data-ssd-devtools-panel",""),n.style.cssText="position:fixed;bottom:12px;right:12px;z-index:99999;background:rgba(10,10,10,0.92);color:#e8e8e3;border-radius:10px;border:1px solid #333;font:12px/1.5 monospace;padding:10px 14px;min-width:220px;max-width:280px;pointer-events:none;backdrop-filter:blur(4px);";let e=document.createElement("div");e.style.cssText="font-weight:bold;font-size:11px;letter-spacing:0.1em;text-transform:uppercase;color:#888;margin-bottom:8px;",e.textContent="\u26A1 svg-scroll-draw devtools",n.appendChild(e),document.body.appendChild(n);}function k(){if(!n)return;for(;n.children.length>1;)n.removeChild(n.lastChild);let e=c();if(e.size===0){let t=document.createElement("div");t.style.cssText="color:#555;font-size:11px;",t.textContent="No active instances.",n.appendChild(t);return}for(let[t,r]of e){let i=r.getProgress(),d=v[r.type]??"#60a5fa",f=t.id?`#${t.id}`:t.className?`.${t.className.split(" ")[0]}`:r.type,s=document.createElement("div");s.style.cssText="margin-bottom:6px;";let c=document.createElement("div");c.style.cssText=`font-size:10px;color:${d};margin-bottom:2px;`,c.textContent=`${r.type} ${f}`;let u=document.createElement("div");u.style.cssText="height:6px;background:#222;border-radius:3px;overflow:hidden;";let x=document.createElement("div");x.style.cssText=`height:100%;width:${Math.round(i*100)}%;background:${d};border-radius:3px;transition:width 0.1s;`,u.appendChild(x),s.appendChild(c),s.appendChild(u);let a=document.createElement("div");a.style.cssText="font-size:9px;color:#555;text-align:right;margin-top:1px;",a.textContent=`${Math.round(i*100)}%`,s.appendChild(a),n.appendChild(s);}}function E(){$(),k(),h=requestAnimationFrame(E);}function T(){a&&(p||(p=true,L(),M(),h=requestAnimationFrame(E),m=e=>{(e.metaKey||e.ctrlKey)&&e.shiftKey&&e.key.toLowerCase()==="s"&&(e.preventDefault(),C());},window.addEventListener("keydown",m)));}function w(){p&&(p=false,cancelAnimationFrame(h),n?.remove(),n=null,o?.remove(),o=null,m&&(window.removeEventListener("keydown",m),m=null));}function C(){p?w():T();}function H(e){if(!p)return;let l=typeof e=="string"?document.querySelector(e):e;if(!l)return;let t=c().get(l);if(!t)return;let r=v[t.type]??"#60a5fa",i=l,d=i.style.outline;i.style.outline=`2px solid ${r}`,i.style.outlineOffset="2px",setTimeout(()=>{i.style.outline=d,i.style.outlineOffset="";},2e3);}var K={enable:T,disable:w,toggle:C,highlight:H};export{K as devtools};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict';function qe({tension:e=2.5,friction:r=2.2}={}){return o=>1-Math.cos(o*Math.PI*e)*Math.pow(1-o,r)}function He({bounces:e=3,decay:r=.5}={}){let o=Math.max(1,Math.round(e)),t=Math.max(.01,Math.min(.99,r)),s=Math.sqrt(t),a=0,c=[];for(let l=0;l<o;l++){let d=Math.pow(s,l);c.push(d),a+=d;}let f=[0],p=0;for(let l=0;l<o;l++)p+=c[l]/a,f.push(p);return l=>{if(l<=0)return 0;if(l>=1)return 1;for(let d=0;d<o;d++)if(l<=f[d+1]){let h=(l-f[d])/(f[d+1]-f[d]);if(d===0)return h*(2-h);let M=1-Math.pow(t,d);return M+(1-M)*(2*h-1)*(2*h-1)}return 1}}function Be({amplitude:e=1,period:r=.4}={}){let o=Math.max(1,e),t=Math.max(.1,r),s=o<=1?t/4:t/(2*Math.PI)*Math.asin(1/o);return a=>a<=0?0:a>=1?1:o*Math.pow(2,-10*a)*Math.sin((a-s)*(2*Math.PI)/t)+1}var ie={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:qe(),bounce:He(),elastic:Be()};function Me(e,r,o){return Math.min(o,Math.max(r,e))}function se(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return {element:"top",viewport:r};let[o="top",t="bottom"]=r.split(/\s+/).filter(Boolean);return {element:o,viewport:t}}var Re=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function xe(e,r,o,t){return e+o+r*Re(t,0)}function Le(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Re(e,1))}function Se(e,r,o,t){return o===r?0:Me((e-r)/(o-r)*t,0,1)}function _e(e,r,o,t,s){let a=xe(e.top,e.height,r,t.element)-Le(t.viewport,o),c=xe(e.top,e.height,r,s.element)-Le(s.viewport,o);return {tStart:a,tEnd:c}}var Te=Symbol.for("svg-scroll-draw.registry");function Ae(){let e=globalThis;return e[Te]||(e[Te]=new Map)}function Fe(e,r){Ae().set(e,r);}function Oe(e){Ae().delete(e);}var Ue=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function E(e,...r){Ue&&console.warn(`[svg-scroll-draw] ${e}`,...r);}function Ie(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),o=s=>e(!!s.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",o),()=>r.removeEventListener("change",o);let t=r;return t.addListener?.(o),()=>t.removeListener?.(o)}var z,H=new Set,B=new WeakMap,k=new Map,Ne=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function Ye(e){let r=new Set;for(let o of e)for(;o&&o!==document.body;o=o.parentElement)for(let t=o;t;t=t.previousElementSibling)r.add(t);return r}function Pe(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let o=()=>r();z??(z=new ResizeObserver(s=>{let a=false;for(let{target:c}of s)B.get(c)!==Ne(c)&&(a=true),B.set(c,"");a&&H.forEach(c=>c());})),H.add(o);let t=Ye(e);return [document.body,document.documentElement].forEach(s=>s&&t.add(s)),t.forEach(s=>{B.has(s)||B.set(s,Ne(s)),k.set(s,(k.get(s)??0)+1),z.observe(s);}),()=>{H.delete(o)&&(t.forEach(s=>{let a=(k.get(s)??1)-1;if(a)return void k.set(s,a);k.delete(s),z?.unobserve(s);}),H.size||(z?.disconnect(),z=void 0));}}function ze(e,r,o,t,s){let a,c=NaN,f,p,l=()=>{a=0,t(),!f&&!a&&(c=o())>0&&c<1&&(a=requestAnimationFrame(l));},d=()=>{!a&&!f&&o()!==c&&(a=requestAnimationFrame(l));},h=y=>{f=y,cancelAnimationFrame(a),a=c=NaN,d();},M=()=>{clearTimeout(p),s(),d();},F=()=>{clearTimeout(p),p=setTimeout(M,150);},Y=Pe(r,F),b=y=>{e[y]("scroll",d,{passive:true}),window[y]("resize",F),window[y]("orientationchange",F);};return b("addEventListener"),d(),{hold:h,remeasure:M,off(){h(true),b("removeEventListener"),Y(),clearTimeout(p);}}}var U={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ke(e){let r=e>1?[0,e-1]:[0],o=[[0,e-1]];for(let t=0;t<o.length;t++){let[s,a]=o[t];if(a-s<2)continue;let c=s+a>>1;r.push(c),o.push([s,c],[c,a]);}return r}function mt(e,r){if(typeof window>"u")return U;let o=typeof e=="string"?document.querySelector(e):e;if(!o||o.tagName.toLowerCase()!=="canvas")return E("scrollFrames: <canvas> element not found:",e),U;let t=o,{frames:s,trigger:a={},easing:c="linear",once:f=false,axis:p="y",fit:l="cover",triggerElement:d,onReady:h,onLoad:M,onComplete:F,onProgress:Y}=r||{},b=Array.isArray(s)?s:null,y=r?.count,L=Math.floor(b?Math.min(y??b.length,b.length):y??NaN);if(!(b||typeof s=="function")||!Number.isFinite(L)||L<1)return E("scrollFrames: no frames. Pass `frames` as an array of URLs, or a function with a finite `count` of 1 or more.",t),U;let R=r.concurrency??6;(!Number.isFinite(R)||R<1)&&(E("scrollFrames: `concurrency` must be a finite number of 1 or more; using 6.",r.concurrency),R=6),R=Math.floor(R);let K=t.getContext("2d");if(!K)return E("scrollFrames: the canvas has no 2D context.",t),U;let S=L-1,ae=d??t,w=window.matchMedia("(prefers-reduced-motion: reduce)").matches,ke=typeof c=="function"?c:ie[c]??ie.linear,ue=n=>{let i=ke(n);return i===i?i:0},Ce=se(a.start||"top top"),De=se(a.end||"bottom top"),C=0,D=0,O=false,X=-1,W=0,_=0,G=false,v=false,ce=false,de=false,j=0,J=-1,Q=new Array(L),Z=new Uint8Array(L),I=new Set,T=w?[S]:Ke(L),ee=0,te=0,le=false,V=(n,...i)=>{if(n)try{n(...i);}catch(u){typeof reportError=="function"?reportError(u):setTimeout(()=>{throw u});}},me=false,We=n=>{let i;try{i=b?b[n]:s(n);}catch(u){i=u;}return typeof i=="string"&&i?i:(me||(me=true,E(`scrollFrames: no URL for frame ${n}; it is skipped for its nearest neighbour.`,i)),null)},fe=()=>p==="x"?window.scrollX:window.scrollY,Ge=()=>p==="x"?window.innerWidth:window.innerHeight;function ne(){!le&&te===T.length&&(le=true,V(M));}function re(){for(;!v&&I.size<R&&ee<T.length;){let n=T[ee++];Z[n]||Qe(n);}}function Qe(n){Z[n]=1;let i=We(n);if(i===null){te++,queueMicrotask(()=>{v||ne();});return}let u=new Image,m=false,g=x=>{m||v||(m=true,u.onload=u.onerror=null,I.delete(u),x?Q[n]=u:E("scrollFrames: a frame failed to load; its nearest neighbour shows instead:",i),te++,re(),$(),ne());};I.add(u),u.decoding="async",u.onerror=()=>g(false),u.src=i,typeof u.decode=="function"?u.decode().then(()=>g(true),()=>{u.complete?g(u.naturalWidth>0):u.onload=()=>g(true);}):u.onload=()=>g(true);}function Ve(n){for(let i=0;i<=S;i++){if(Q[n-i])return n-i;if(Q[n+i])return n+i}return -1}function oe(){let n=t.clientWidth,i=t.clientHeight;if(!n||!i)return;let u=Math.min(window.devicePixelRatio||1,2),m=Math.round(n*u),g=Math.round(i*u);if(Math.abs(t.width-m)<=1&&Math.abs(t.height-g)<=1)return;t.width=m,t.height=g,J=-1;let x=t.clientWidth,P=t.clientHeight;if(x!==n||P!==i){let A=t.style;x!==n&&P!==i?(A.width=`${n}px`,A.height=`${i}px`):A.aspectRatio=`${n} / ${i}`;}}function $(){let n=Ve(j);if(n<0||n===J)return;let i=Q[n],u=t.width,m=t.height,g=i.naturalWidth||u,x=i.naturalHeight||m,P=(l==="contain"?Math.min:Math.max)(u/g,m/x),A=g*P,Ee=x*P;K.clearRect(0,0,u,m),K.drawImage(i,(u-A)/2,(m-Ee)/2,A,Ee),J=n,ce||(ce=true,V(h));}function q(n){j=Math.min(S,Math.max(0,Math.round(n*S))),t.style.setProperty("--scroll-draw-progress",String(n)),$(),V(Y,n,j);}function pe(){let n=ae.getBoundingClientRect(),i=p==="x"?n.left:n.top,u=p==="x"?n.width:n.height,m=_e({top:i,height:u},fe(),Ge(),Ce,De);C=m.tStart,D=m.tEnd,D===C&&u>0&&!w&&!de&&(de=true,E("scrollFrames: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",t));}let ge=()=>Se(fe(),C,D,1);function $e(){if(w)return;let n=ge(),i=f?Math.max(X,ue(W=Math.max(W,n))):ue(n);_=i,q(i),i>=1&&!G?(G=true,V(F)):i<1&&!f&&(G=false);}function he(){_=1,q(1);}oe(),w||pe();let N=ze(window,[ae],ge,$e,()=>{oe(),w||pe(),$();}),be=()=>N.hold(O||w);be(),w&&he(),re();let we=typeof ResizeObserver=="function"?new ResizeObserver(()=>{oe(),$();}):null;we?.observe(t);let ve=w?()=>{}:Ie(n=>{n&&(ve(),w=true,N.hold(true),T=T.slice(0,ee),Z[S]||T.push(S),ne(),he(),re());});Fe(t,{type:"frames",getProgress:()=>_,getTrigger:()=>({tStart:C,tEnd:D})});function ye(){v||!O||(O=false,be());}return {destroy(){if(!v){v=true,N.off(),we?.disconnect(),ve();for(let n of I)n.onload=n.onerror=null,n.src="";I.clear(),Oe(t);}},replay(){v||(X=-1,W=0,G=false,_=0,q(0),ye());},pause(){v||(O=true,N.hold(true));},resume:ye,seek(n){if(v)return;let i=Math.min(1,Math.max(0,n===n?n:0));_=i,X=i,W=0,O=true,N.hold(true),q(i);},getProgress(){return _}}}exports.scrollFrames=mt;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { T as TriggerConfig, E as EasingName, S as ScrollDrawInstance } from '../types-9bcJdVcg.mjs';
|
|
2
|
+
|
|
3
|
+
interface ScrollFramesOptions {
|
|
4
|
+
/** Image URLs in order, or a function from index (0-based) to URL. */
|
|
5
|
+
frames: string[] | ((index: number) => string);
|
|
6
|
+
/** Number of frames; required when `frames` is a function, else frames.length. */
|
|
7
|
+
count?: number;
|
|
8
|
+
trigger?: TriggerConfig;
|
|
9
|
+
easing?: EasingName | ((t: number) => number);
|
|
10
|
+
once?: boolean;
|
|
11
|
+
axis?: 'x' | 'y';
|
|
12
|
+
/**
|
|
13
|
+
* Measure the trigger window from this element instead of the canvas: the
|
|
14
|
+
* pinned-stage pattern, as in scrollVideo. Point it at the tall track that
|
|
15
|
+
* holds the scroll room, with `start: 'top top'` and `end: 'bottom bottom'`.
|
|
16
|
+
*/
|
|
17
|
+
triggerElement?: Element;
|
|
18
|
+
/** How each frame fills the canvas box: 'cover' (default) or 'contain'. */
|
|
19
|
+
fit?: 'cover' | 'contain';
|
|
20
|
+
/** How many images load at once. Default 6. */
|
|
21
|
+
concurrency?: number;
|
|
22
|
+
/** The first frame is drawn. */
|
|
23
|
+
onReady?: () => void;
|
|
24
|
+
/** Every frame has loaded (or failed). */
|
|
25
|
+
onLoad?: () => void;
|
|
26
|
+
onComplete?: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Every animation frame while the scroll is inside the trigger window (and on
|
|
29
|
+
* seek(), replay() and the frame that crosses an edge), as scrollVideo's
|
|
30
|
+
* does: the eased progress, and the index of the frame it calls for. The
|
|
31
|
+
* canvas shows the nearest loaded frame until that one arrives.
|
|
32
|
+
*/
|
|
33
|
+
onProgress?: (alpha: number, frame: number) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Scrub an image sequence on a canvas with the scroll: the Apple product-page
|
|
37
|
+
* film. Frame `round(alpha × (count − 1))` is drawn, or the nearest one that
|
|
38
|
+
* has loaded until it arrives.
|
|
39
|
+
*/
|
|
40
|
+
declare function scrollFrames(target: string | HTMLCanvasElement, options: ScrollFramesOptions): ScrollDrawInstance;
|
|
41
|
+
|
|
42
|
+
export { type ScrollFramesOptions, scrollFrames };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { T as TriggerConfig, E as EasingName, S as ScrollDrawInstance } from '../types-9bcJdVcg.js';
|
|
2
|
+
|
|
3
|
+
interface ScrollFramesOptions {
|
|
4
|
+
/** Image URLs in order, or a function from index (0-based) to URL. */
|
|
5
|
+
frames: string[] | ((index: number) => string);
|
|
6
|
+
/** Number of frames; required when `frames` is a function, else frames.length. */
|
|
7
|
+
count?: number;
|
|
8
|
+
trigger?: TriggerConfig;
|
|
9
|
+
easing?: EasingName | ((t: number) => number);
|
|
10
|
+
once?: boolean;
|
|
11
|
+
axis?: 'x' | 'y';
|
|
12
|
+
/**
|
|
13
|
+
* Measure the trigger window from this element instead of the canvas: the
|
|
14
|
+
* pinned-stage pattern, as in scrollVideo. Point it at the tall track that
|
|
15
|
+
* holds the scroll room, with `start: 'top top'` and `end: 'bottom bottom'`.
|
|
16
|
+
*/
|
|
17
|
+
triggerElement?: Element;
|
|
18
|
+
/** How each frame fills the canvas box: 'cover' (default) or 'contain'. */
|
|
19
|
+
fit?: 'cover' | 'contain';
|
|
20
|
+
/** How many images load at once. Default 6. */
|
|
21
|
+
concurrency?: number;
|
|
22
|
+
/** The first frame is drawn. */
|
|
23
|
+
onReady?: () => void;
|
|
24
|
+
/** Every frame has loaded (or failed). */
|
|
25
|
+
onLoad?: () => void;
|
|
26
|
+
onComplete?: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Every animation frame while the scroll is inside the trigger window (and on
|
|
29
|
+
* seek(), replay() and the frame that crosses an edge), as scrollVideo's
|
|
30
|
+
* does: the eased progress, and the index of the frame it calls for. The
|
|
31
|
+
* canvas shows the nearest loaded frame until that one arrives.
|
|
32
|
+
*/
|
|
33
|
+
onProgress?: (alpha: number, frame: number) => void;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Scrub an image sequence on a canvas with the scroll: the Apple product-page
|
|
37
|
+
* film. Frame `round(alpha × (count − 1))` is drawn, or the nearest one that
|
|
38
|
+
* has loaded until it arrives.
|
|
39
|
+
*/
|
|
40
|
+
declare function scrollFrames(target: string | HTMLCanvasElement, options: ScrollFramesOptions): ScrollDrawInstance;
|
|
41
|
+
|
|
42
|
+
export { type ScrollFramesOptions, scrollFrames };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,e,c,b as b$2}from'../chunk-NV6YTPHI.mjs';import {d}from'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$1}from'../chunk-5PJEKEEP.mjs';import {a as a$2,b as b$1}from'../chunk-EBU6E26L.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var k={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Oe(c){let f=c>1?[0,c-1]:[0],d=[[0,c-1]];for(let r=0;r<d.length;r++){let[l,h]=d[r];if(h-l<2)continue;let m=l+h>>1;f.push(m),d.push([l,m],[m,h]);}return f}function $e(c$1,f){if(typeof window>"u")return k;let d$1=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!d$1||d$1.tagName.toLowerCase()!=="canvas")return b("scrollFrames: <canvas> element not found:",c$1),k;let r=d$1,{frames:l,trigger:h={},easing:m="linear",once:J=false,axis:A="y",fit:be="cover",triggerElement:ye,onReady:ve,onLoad:Me,onComplete:xe,onProgress:Ee}=f||{},p=Array.isArray(l)?l:null,K=f?.count,w=Math.floor(p?Math.min(K??p.length,p.length):K??NaN);if(!(p||typeof l=="function")||!Number.isFinite(w)||w<1)return b("scrollFrames: no frames. Pass `frames` as an array of URLs, or a function with a finite `count` of 1 or more.",r),k;let b$3=f.concurrency??6;(!Number.isFinite(b$3)||b$3<1)&&(b("scrollFrames: `concurrency` must be a finite number of 1 or more; using 6.",f.concurrency),b$3=6),b$3=Math.floor(b$3);let H=r.getContext("2d");if(!H)return b("scrollFrames: the canvas has no 2D context.",r),k;let y=w-1,Q=ye??r,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Fe=typeof m=="function"?m:d[m]??d.linear,V=e=>{let t=Fe(e);return t===t?t:0},Se=a(h.start||"top top"),Re=a(h.end||"bottom top"),C=0,P=0,E=false,W=-1,T=0,v=0,L=false,a$3=false,Z=false,ee=false,$=0,D=-1,O=new Array(w),U=new Uint8Array(w),F=new Set,M=i?[y]:Oe(w),q=0,G=0,te=false,z=(e,...t)=>{if(e)try{e(...t);}catch(n){typeof reportError=="function"?reportError(n):setTimeout(()=>{throw n});}},ne=false,Ae=e=>{let t;try{t=p?p[e]:l(e);}catch(n){t=n;}return typeof t=="string"&&t?t:(ne||(ne=true,b(`scrollFrames: no URL for frame ${e}; it is skipped for its nearest neighbour.`,t)),null)},re=()=>A==="x"?window.scrollX:window.scrollY,Ce=()=>A==="x"?window.innerWidth:window.innerHeight;function _(){!te&&G===M.length&&(te=true,z(Me));}function B(){for(;!a$3&&F.size<b$3&&q<M.length;){let e=M[q++];U[e]||Pe(e);}}function Pe(e){U[e]=1;let t=Ae(e);if(t===null){G++,queueMicrotask(()=>{a$3||_();});return}let n=new Image,o=false,s=g=>{o||a$3||(o=true,n.onload=n.onerror=null,F.delete(n),g?O[e]=n:b("scrollFrames: a frame failed to load; its nearest neighbour shows instead:",t),G++,B(),I(),_());};F.add(n),n.decoding="async",n.onerror=()=>s(false),n.src=t,typeof n.decode=="function"?n.decode().then(()=>s(true),()=>{n.complete?s(n.naturalWidth>0):n.onload=()=>s(true);}):n.onload=()=>s(true);}function Te(e){for(let t=0;t<=y;t++){if(O[e-t])return e-t;if(O[e+t])return e+t}return -1}function X(){let e=r.clientWidth,t=r.clientHeight;if(!e||!t)return;let n=Math.min(window.devicePixelRatio||1,2),o=Math.round(e*n),s=Math.round(t*n);if(Math.abs(r.width-o)<=1&&Math.abs(r.height-s)<=1)return;r.width=o,r.height=s,D=-1;let g=r.clientWidth,R=r.clientHeight;if(g!==e||R!==t){let x=r.style;g!==e&&R!==t?(x.width=`${e}px`,x.height=`${t}px`):x.aspectRatio=`${e} / ${t}`;}}function I(){let e=Te($);if(e<0||e===D)return;let t=O[e],n=r.width,o=r.height,s=t.naturalWidth||n,g=t.naturalHeight||o,R=(be==="contain"?Math.min:Math.max)(n/s,o/g),x=s*R,fe=g*R;H.clearRect(0,0,n,o),H.drawImage(t,(n-x)/2,(o-fe)/2,x,fe),D=e,Z||(Z=true,z(ve));}function N(e){$=Math.min(y,Math.max(0,Math.round(e*y))),r.style.setProperty("--scroll-draw-progress",String(e)),I(),z(Ee,e,$);}function oe(){let e=Q.getBoundingClientRect(),t=A==="x"?e.left:e.top,n=A==="x"?e.width:e.height,o=c({top:t,height:n},re(),Ce(),Se,Re);C=o.tStart,P=o.tEnd,P===C&&n>0&&!i&&!ee&&(ee=true,b("scrollFrames: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r));}let se=()=>b$2(re(),C,P,1);function Le(){if(i)return;let e=se(),t=J?Math.max(W,V(T=Math.max(T,e))):V(e);v=t,N(t),t>=1&&!L?(L=true,z(xe)):t<1&&!J&&(L=false);}function ie(){v=1,N(1);}X(),i||oe();let S=e(window,[Q],se,Le,()=>{X(),i||oe(),I();}),ae=()=>S.hold(E||i);ae(),i&&ie(),B();let ce=typeof ResizeObserver=="function"?new ResizeObserver(()=>{X(),I();}):null;ce?.observe(r);let le=i?()=>{}:a$1(e=>{e&&(le(),i=true,S.hold(true),M=M.slice(0,q),U[y]||M.push(y),_(),ie(),B());});a$2(r,{type:"frames",getProgress:()=>v,getTrigger:()=>({tStart:C,tEnd:P})});function ue(){a$3||!E||(E=false,ae());}return {destroy(){if(!a$3){a$3=true,S.off(),ce?.disconnect(),le();for(let e of F)e.onload=e.onerror=null,e.src="";F.clear(),b$1(r);}},replay(){a$3||(W=-1,T=0,L=false,v=0,N(0),ue());},pause(){a$3||(E=true,S.hold(true));},resume:ue,seek(e){if(a$3)return;let t=Math.min(1,Math.max(0,e===e?e:0));v=t,W=t,T=0,E=true,S.hold(true),N(t);},getProgress(){return v}}}export{$e as scrollFrames};
|
package/dist/group/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b as b$1}from'../chunk-
|
|
1
|
+
import {b as b$1}from'../chunk-QZKYGS74.mjs';import {a as a$1}from'../chunk-7USW2XFB.mjs';import {b}from'../chunk-7XOFQCQE.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';function u(s){return s.map(o=>typeof o=="string"?document.querySelector(o):o).filter(o=>o!==null)}var a={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function y(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function E(s,o={}){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return b(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function d(s,o){if(typeof window>"u")return a;let r=u(s).map(e=>a$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}function w(s,o){if(typeof window>"u")return a;let r=u(s);if(r.length===0)return a;let e=0,n=[];function i(t){return a$1(r[t],{...o,once:true,onComplete(){o.onComplete?.(),e=Math.min(t+1,r.length-1),e>t&&n[e]?.resume();}})}function l(){r.forEach((t,c)=>{n[c]=i(c);});for(let t=1;t<n.length;t++)n[t].pause();}return l(),{destroy(){n.forEach(t=>t.destroy()),n.length=0;},replay(){n.forEach(t=>t.destroy()),n.length=0,e=0,l();},pause(){n[e]?.pause();},resume(){n[e]?.resume();},seek(t){n[e]?.seek(t);},getProgress(){return n[e]?.getProgress()??0},refresh(){n.forEach(t=>t.refresh?.());}}}function S(s,o={}){if(typeof window>"u")return a;let r=u(s).map(e=>b$1(e,o));return {destroy(){r.forEach(e=>e.destroy());},replay(){r.forEach(e=>e.replay());},pause(){r.forEach(e=>e.pause());},resume(){r.forEach(e=>e.resume());},seek(e){r.forEach(n=>n.seek(e));},getProgress(){return r[0]?.getProgress()??0},refresh(){r.forEach(e=>e.refresh?.());}}}export{d as scrollAnimateGroup,w as scrollAnimateSequence,y as scrollDrawGroup,E as scrollDrawSequence,S as scrollParallaxGroup};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a}from'../chunk-
|
|
1
|
+
import {a}from'../chunk-7USW2XFB.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-2PYLM3E7.mjs';import {d}from'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var x={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0,refresh:()=>{}};function $(a$1,r={}){if(typeof window>"u")return x;let h=typeof a$1=="string"?document.querySelector(a$1):a$1;if(!h)return b("scrollHorizontal: track element not found:",a$1),x;let o=h,{easing:C="linear",trigger:P={start:"top top",end:"bottom bottom"},scrollContainer:s,respectReducedMotion:R=false,onProgress:v}=r,u=typeof s=="string"?document.querySelector(s):s??null;function b$1(){for(let e=o.parentElement;e;e=e.parentElement)if(window.getComputedStyle(e).position==="sticky")return e;return null}function M(){let e=b$1();if(e){let t=window.getComputedStyle(e);return e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)}return u?u.clientWidth:document.documentElement.clientWidth||window.innerWidth}function d$1(){return r.distance??o.scrollWidth-M()}function g(){if(r.triggerElement!==void 0){let t=typeof r.triggerElement=="string"?document.querySelector(r.triggerElement):r.triggerElement;if(t)return t;b("scrollHorizontal: triggerElement not found:",r.triggerElement);}let e=b$1();return e?e.parentElement??e:o}let m=d$1(),i=g(),n=a(o,T(m,i)),S=f(),l=null;function T(e,t){return {props:{transform:["translateX(0px)",`translateX(${-e}px)`]},trigger:P,easing:C,native:false,respectReducedMotion:R,...t!==o&&{triggerElement:t},...s!==void 0&&{scrollContainer:s},...v!==void 0&&{onProgress:v}}}function f(){let e=i.getBoundingClientRect(),t=u?e.top-u.getBoundingClientRect().top+u.scrollTop:e.top+window.scrollY;return `${d$1()} ${Math.round(t)} ${Math.round(e.height)}`}function z(){n.destroy();let e=g(),t=e!==i;m=d$1(),i=e,n=a(o,T(m,i)),S=f(),l!==null&&n.seek(l),t&&H();}let p;function W(){(g()!==i||f()!==S)&&z();}function c(){clearTimeout(p),p=setTimeout(W,150);}window.addEventListener("resize",c),window.addEventListener("orientationchange",c);let E=()=>{};function H(){E(),E=d([o,i],c);}return H(),{destroy(){clearTimeout(p),window.removeEventListener("resize",c),window.removeEventListener("orientationchange",c),E(),n.destroy();},replay(){l=null,n.replay();},pause(){n.pause(),l=n.getProgress();},resume(){l=null,n.resume();},seek(e){n.seek(e),l=n.getProgress();},getProgress(){return n.getProgress()},refresh(){z();}}}export{$ as scrollHorizontal};
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';function
|
|
2
|
-
<div style="position:absolute;${
|
|
3
|
-
<div style="position:absolute;${u?`left:${m}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${m}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`;}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:true}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove();}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function br(e,r,t){if(!Fe)return;let n=(e.match(Yt)??[]).join("").toUpperCase(),s=(r.match(Yt)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,c=(r.match(Qt)??[]).length;if(n!==s){W(`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!==c&&W(`morphTo: coordinate count differs (${i} \u2192 ${c}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function wr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let c=parseFloat(i),m=n[s++]??c;return String(+(c+(m-c)*t).toFixed(4))})}function Ut(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(r,(t,n)=>vr(e,t,n))}function vr(e,r,t){let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,{selector:c="path, polyline, line, polygon, rect, circle",speed:m=1,fade:u=false,easing:p="linear",trigger:v={},stagger:S=0,direction:h="forward",once:O=false,debug:ee=false,axis:A="y",scrollContainer:y,autoReverse:x=false,delay:g=0,strokeColor:b,strokeWidth:w,fillOpacity:I,waypoints:z,velocityScale:N=false,threshold:te=0,rootMargin:Ge="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:re,autoplay:Ae=false,duration:L=1e3,native:H=true,onProgress:ke,onStart:Z,onComplete:ne,onEnter:ge,onLeave:Ie,onEnterBack:ye,onLeaveBack:me}=i,K=re===true?"left":typeof re=="string"?re:false,q=typeof p=="function"?p:U[p]??U.linear,Re=Te(v.start||"top bottom"),We=Te(v.end||"bottom top"),F=typeof y=="string"?document.querySelector(y):y??null,he=Array.isArray(b)?b[0]:null,be=Array.isArray(b)?b[1]:typeof b=="string"?b:null,ce=Array.isArray(w)?w[0]:null,Pe=Array.isArray(w)?w[1]:typeof w=="number"?w:null,we=Array.isArray(I)?I[0]:null,ue=Array.isArray(I)?I[1]:typeof I=="number"?I:null;function ve(o){let l=o*100;switch(K){case "right":return `inset(0 0 0 ${100-l}%)`;case "top":return `inset(0 0 ${100-l}% 0)`;case "bottom":return `inset(${100-l}% 0 0 0)`;case "center":return `circle(${o*150}% at 50% 50%)`;default:return `inset(0 ${100-l}% 0 0)`}}let a=K?[]:Array.from(e.querySelectorAll(c)),f=[],_=[],M=0,$=0,R=S,k=0,Le=0,V=false,Se=false,Ee=0,at=-1,Ye=[],Ue=-1,ie=false,fe=0,Ce=0,De,lt=false,ct=null;function wt(){ct?.destroy(),ct=null;}let Oe=new Set,vt=NaN,Ne=true,Xe=-1,St=performance.now(),He=NaN;function Ze(){return F?A==="x"?F.scrollLeft:F.scrollTop:A==="x"?window.scrollX:window.scrollY}function Et(){return F?A==="x"?F.clientWidth:F.clientHeight:A==="x"?window.innerWidth:window.innerHeight}function xt(){let o=Ke(e,F,A);return $e(o,o.scroll,Et(),Re,We)}function rr(){let o=$-M,l=a.length-1,d=F??document.documentElement,T=A==="x"?"Width":"Height";if(R=S,S>0&&l>0&&o>0){let j=d[`scroll${T}`]-d[`client${T}`]-1-M-o/m;j>=0&&(R=Math.min(S,j/(l*o)));}let G=Math.max(0,l)*R*o,oe=o/Math.min(m,1);k=M+Math.min(0,G,oe,G+oe),Le=M+Math.max(0,G,oe,G+oe);}function Tt(){(({tStart:M,tEnd:$}=xt())),rr(),ee&&Fe&&(wt(),ct=hr(M,$,A));}function ut(o,l=xt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:l});let d=o.destroy;return o.destroy=()=>{d.call(o),pe(e);},o}function Mt(o,l){return O&&!x?Math.max(at,q(Ye[o]=Math.max(Ye[o]??0,l))):q(l)}function nr(o,l){if(e.style.setProperty("--scroll-draw-progress",String(o)),K){let d=l==="reverse"?1-o:o;e.style.clipPath=ve(d);return}a.forEach((d,T)=>mt(d,T,o,l));}function mt(o,l,d,T){o.style.strokeDashoffset=T==="reverse"?`${f[l]*d}`:`${f[l]*(1-d)}`,u&&(o.style.opacity=T==="reverse"?`${1-d}`:`${d}`),he&&be?o.style.stroke=et(he,be,d):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*d}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*d}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",wr(_[l],B,d));}function ft(){if(e.style.setProperty("--scroll-draw-progress","0"),K){e.style.clipPath=ve(h==="reverse"?1:0);return}a.forEach((o,l)=>{o.style.strokeDasharray=`${f[l]}`,o.style.strokeDashoffset=h==="reverse"?"0":`${f[l]}`,u?o.style.opacity=h==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[l]&&o.setAttribute("d",_[l]);});}function ze(o,l){let d=o.getAttribute("d"),T=Je(o);if(B&&_[l]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[l]),T=Math.max(Je(o),G),o.setAttribute("d",d);}f[l]=T,o.style.strokeDasharray=`${T}`;}if(a.forEach((o,l)=>{yr(o);let d=o.tagName.toLowerCase()==="path";d?_.push(o.getAttribute("d")??""):_.push(""),ze(o,l);let T=f[l];B&&(d?br(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),t?(o.style.strokeDashoffset=h==="reverse"?`${T}`:"0",u&&(o.style.opacity="1"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&o.setAttribute("d",B)):(o.style.strokeDashoffset=h==="reverse"?"0":`${T}`,u?o.style.opacity=h==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`));}),t)return K&&(e.style.clipPath=ve(1)),ne?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};K&&(e.style.clipPath=ve(h==="reverse"?1:0));let At=typeof p=="string"?tt(p):null;function or(){return !(H===false||Ae||ee&&Fe||!gr()||!a.length||!At||K||A!=="y"||F||m!==1||S!==0||O||x||N!==false||B||z||le||g>0||ke||Z||ne||ge||Ie||ye||me||b!=null||w!=null||I!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function sr(){let o=++dr,l=`svg-scroll-draw-${o}`,d=`svg-scroll-draw-host-${o}`,T=`--svg-scroll-draw-${o}`,G=h==="reverse"?"0":"var(--ssd-len)",oe=h==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,C=`stroke-dashoffset:${oe};`;u&&(j+=`opacity:${h==="reverse"?1:0};`,C+=`opacity:${h==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${l}{from{${j}}to{${C}}}.${d}{view-timeline-name:${T};view-timeline-axis:block;}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${At};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(d);function J(E,P){E.style.setProperty("--ssd-len",String(f[P])),E.style.strokeDasharray=`${f[P]}`,E.style.strokeDashoffset="",E.style.opacity="",E.style.animationPlayState="",E.classList.add(l);}a.forEach(J);let Q=false,se=-1;function ae(){if(se>=0)return se;let E=e.getBoundingClientRect(),{tStart:P,tEnd:Y}=$e({top:E.top,height:E.height},Ze(),Et(),Re,We);return q(X(Ze(),P,Y,m))}return {destroy(){e.classList.remove(d),a.forEach(E=>{E.classList.remove(l),E.style.removeProperty("--ssd-len"),E.style.animationPlayState="";}),D.remove();},replay(){Q=false,se=-1,a.forEach(J);},pause(){Q=true,a.forEach(E=>{E.style.animationPlayState="paused";});},resume(){Q&&(Q=false,a.forEach(E=>{E.style.animationPlayState="running";}));},seek(E){let P=Math.min(1,Math.max(0,E));se=P,Q=true,a.forEach((Y,xe)=>{Y.classList.remove(l),Y.style.strokeDashoffset=h==="reverse"?`${f[xe]*P}`:`${f[xe]*(1-P)}`,u&&(Y.style.opacity=h==="reverse"?`${1-P}`:`${P}`);});},getProgress(){return ae()},refresh(){a.forEach((E,P)=>{ze(E,P),E.style.setProperty("--ssd-len",String(f[P]));});}}}if(or())return ut(sr());function ir(){let o=Math.max(1,L),l=K?o:o*(1+Math.max(0,a.length-1)*S),d=0,T=0,G=false;function oe(se){let ae=true,E=Math.min(1,Math.max(0,se/l));if(K){let P=Math.min(1,Math.max(0,se/o)),Y=q(P);fe=Y,e.style.setProperty("--scroll-draw-progress",String(Y)),e.style.clipPath=ve(h==="reverse"?1-Y:Y),ke?.(Y),P<1&&(ae=false);}else {a.forEach((Y,xe)=>{let lr=xe*S*o,Ct=Math.min(1,Math.max(0,(se-lr)/o));mt(Y,xe,q(Ct),h),Ct<1&&(ae=false);});let P=q(E);fe=P,ke?.(P),e.style.setProperty("--scroll-draw-progress",String(P));}if(z){let P=q(E);for(let Y in z){let xe=parseFloat(Y);P>=xe&&!Oe.has(xe)&&(Oe.add(xe),z[Y]?.());}}return ae}function j(se){if(ie)return;let ae=se-d;Se||(Se=true,Z?.());let E=oe(ae);if(E&&!V){V=true,oe(l),ne?.(),Ce<(le==="infinite"?1/0:le??0)&&(Ce++,De=setTimeout(()=>{d=performance.now(),Se=false,V=false,Oe.clear(),ft(),Ee=requestAnimationFrame(j);},de));return}E||(Ee=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Ee),clearTimeout(De),d=performance.now(),T=0,ie=false,Se=false,V=false,Ce=0,G=true,fe=0,Oe.clear(),ft(),Ee=requestAnimationFrame(j);}let D=new IntersectionObserver(se=>{se.forEach(ae=>{ae.isIntersecting&&!(O&&V)?C():!ae.isIntersecting&&!O&&!V&&(cancelAnimationFrame(Ee),clearTimeout(De),G=false);});},{root:F??null,threshold:te,rootMargin:Ge}),J;function Q(){clearTimeout(J),J=setTimeout(()=>a.forEach(ze),150);}return window.addEventListener("resize",Q),window.addEventListener("orientationchange",Q),g>0?setTimeout(()=>D.observe(e),g):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(De),D.disconnect(),window.removeEventListener("resize",Q),window.removeEventListener("orientationchange",Q),clearTimeout(J);},replay(){Ce=0,C();},pause(){ie||!G||(ie=true,T=performance.now()-d,cancelAnimationFrame(Ee));},resume(){ie&&(ie=false,G=true,d=performance.now()-T,Ee=requestAnimationFrame(j));},seek(se){let ae=Math.min(1,Math.max(0,se));fe=ae,ie=true,T=ae*l,d=performance.now()-T,cancelAnimationFrame(Ee),oe(T);},getProgress(){return fe},refresh(){clearTimeout(J),a.forEach(ze);}}}if(Ae)return ut(ir());Tt();let Pt=()=>X(Ze(),k,Le,1);function Lt(){V=true,ne?.(),Ce<(le==="infinite"?1/0:le)&&(Ce++,De=setTimeout(()=>{lt=true;},de));}function $t(){at=-1,Ye=[],Se=false,V=false,lt=false,Oe.clear(),ft(),Ne=true;}function ar(){let o=performance.now(),l=Ze();if(lt&&Pt()%1&&$t(),!Ne&&N===false&&l===vt)return;Ne=false,vt=l;let d=m;if(N!==false){let C=o-St,D=C>0?Math.abs(l-(Xe<0?l:Xe))/C:0;d=m*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Xe=l,St=o;let T=x?Ue===-1||l>=Ue?"forward":"reverse":h;Ue=l;let G=$-M,oe=true,j=G===0?0:(l-M)/G;if(isNaN(He)||(He<=0&&j>0&&ge?.(),He<1&&j>=1&&Ie?.(),He>=1&&j<1&&ye?.(),He>0&&j<=0&&me?.()),He=j,K){let C=Mt(0,X(l,M,$,d));fe=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=ve(D),ke?.(C),!Se&&X(l,M,$,d)>0&&(Se=true,Z?.()),C>=1&&!V?Lt():C<1&&!O&&(V=false);return}if(a.forEach((C,D)=>{let J=D*R*G,Q=Mt(D,X(l,M+J,$+J,d));mt(C,D,Q,T),D===0&&(fe=Q,ke?.(Q),e.style.setProperty("--scroll-draw-progress",String(Q))),Q<1&&(oe=false);}),z){let C=q(X(l,M,$,d));for(let D in z){let J=parseFloat(D);C>=J&&!Oe.has(J)&&(Oe.add(J),z[D]?.());}}!Se&&X(l,M,$,d)>0&&(Se=true,Z?.()),oe&&!V?Lt():!oe&&!O&&(V=false);}let Be=Ve(F??window,[e],Pt,ar,()=>{let o=f.join();a.forEach(ze),Tt(),Ne=true,f.join()!==o&&qe();}),pt=g>0;function qe(){Be.hold(ie||pt);}let kt;return pt&&(kt=setTimeout(()=>{pt=false,qe();},g)),qe(),ut({destroy(){clearTimeout(De),clearTimeout(kt),Be.off(),wt();},replay(){$t(),Ue=-1,Xe=-1,Ce=0,ie=false,fe=0,clearTimeout(De),qe();},pause(){ie=true,Be.hold(true);},resume(){ie&&(ie=false,Ne=true,qe());},seek(o){let l=Math.min(1,Math.max(0,o));fe=l,at=l,Ye=[],ie=true,Be.hold(true),nr(l,h),Ne=true;},getProgress(){return fe},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function Sr(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?Ut(n,r):(W("Container not found:",e),t)}function Er(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Xt(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],c=n[2].trim();if(c)for(let m of c.split(/[\s,]+/)){let u=m.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(u?parseFloat(u[1]):0),i.push(u?u[2]:"");}r.push({fn:n[1],nums:s,units:i});}return r}function xr(e,r,t){let n=Xt(e),s=Xt(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,c)=>{let m=s[c];return i.fn!==m.fn||i.nums.length!==m.nums.length?t<1?`${i.fn}(${i.nums.map((u,p)=>`${u}${i.units[p]}`).join(", ")})`:`${m.fn}(${m.nums.map((u,p)=>`${u}${m.units[p]}`).join(", ")})`:`${i.fn}(${i.nums.map((u,p)=>`${u+(m.nums[p]-u)*t}${i.units[p]}`).join(", ")})`}).join(" ")}function Zt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Er(n))return et(n,s,t);if(n.includes("("))return xr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),c=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&c){let m=parseFloat(i[1]),u=parseFloat(c[1]);return `${m+(u-m)*t}${i[2]||c[2]}`}return t<1?n:s}function Tr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Mr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Ar=0,Kt="--scroll-draw-progress";function Pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var er={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,r){return typeof window>"u"?er:r.respectReducedMotion===false?Jt(e,r,false):_e(r,(t,n)=>Jt(e,t,n))}function Jt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:c=1,once:m=false,axis:u="y",scrollContainer:p,native:v=true,velocityScale:S=false,triggerElement:h,onProgress:O,onComplete:ee,onEnter:A,onLeave:y,onEnterBack:x,onLeaveBack:g}=r,b=typeof i=="function"?i:U[i]??U["ease-out"],w=Te(s.start||"top bottom"),I=Te(s.end||"bottom top"),z=h??e,N=typeof p=="string"?document.querySelector(p):p??null,te=Object.entries(n).map(([a,f])=>({prop:Tr(a),from:Array.isArray(f)?f[0]:"",to:Array.isArray(f)?f[1]:f}));function Ge(){let a=window.getComputedStyle(e);for(let f of te)f.from===""&&(f.from=a.getPropertyValue(f.prop).trim()||"0");}function le(){for(let a of te)e.style.setProperty(a.prop,String(a.to));}let de=new Map;for(let a of [...te.map(f=>f.prop),Kt])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,f]of de)f?e.style.setProperty(a,f):e.style.removeProperty(a);}if(t)return le(),ee?.(),{...er,destroy:B,getProgress:()=>1};Ge();let re=()=>N?u==="x"?N.scrollLeft:N.scrollTop:u==="x"?window.scrollX:window.scrollY,Ae=()=>N?u==="x"?N.clientWidth:N.clientHeight:u==="x"?window.innerWidth:window.innerHeight,L=typeof i=="string"?tt(i):null;function H(){if(!v||!Pr()||!L||u!=="y"||N||z!==e||m||c!==1||O||ee||A||y||x||g||S!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of te)if(!Mr.has(a.prop))return false;return true}function ke(){let a=`ssd-a-${++Ar}`,f=te.map(k=>`${k.prop}:${k.from}`).join(";"),_=te.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${f}}to{${_}}}.${a}{animation-name:${a};animation-duration:auto;animation-timing-function:${L};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(a);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},re(),Ae(),w,I)};Me(e,{type:"animate",getProgress:()=>R.getProgress(),getTrigger:$});let R={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Le=Math.min(1,Math.max(0,k));e.classList.remove(a);for(let V of te)e.style.setProperty(V.prop,Zt(V.from,V.to,Le));},getProgress(){let{tStart:k,tEnd:Le}=$();return b(X(re(),k,Le,c))}};return R}if(H())return ke();let Z=0,ne=0,ge=false,Ie=-1,ye=0,me=0,K=false,q=NaN,Re=-1,We=0,F=z===e?te:[],he=false;function be(){let a=e.style,f=F.map(R=>a.getPropertyValue(R.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(R=>a.setProperty(R.prop,de.get(R.prop)??""));let M=Ke(z,N,u);F.forEach((R,k)=>a.setProperty(R.prop,f[k])),F.length&&(e.offsetWidth,a.transition=_);let $=$e(M,M.scroll,Ae(),w,I);he&&Math.abs($.tStart-Z)<1&&Math.abs($.tEnd-ne)<1||(he=true,Z=$.tStart,ne=$.tEnd);}function ce(a){e.style.setProperty(Kt,String(a));for(let f of te)e.style.setProperty(f.prop,Zt(f.from,f.to,a));O?.(a);}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&A?.(),q<1&&a>=1&&y?.(),q>=1&&a<1&&x?.(),q>0&&a<=0&&g?.(),q=a;}function we(){if(ge)return;let a=performance.now(),f=re(),_=c;if(S!==false){let k=a-We,Le=k>0?Math.abs(f-(Re<0?f:Re))/k:0;_=c*Math.max(.2,1+Le*(typeof S=="number"?S:1)*.04);}Re=f,We=a;let M=ne===Z?0:(f-Z)/(ne-Z);Pe(M);let $=X(f,Z,ne,_),R=m?Math.max(Ie,b(ye=Math.max(ye,$))):b($);me=R,ce(R),R>=1&&!K?(K=true,ee?.()):R<1&&!m&&(K=false);}let ue=Ve(N??window,[z],()=>X(re(),Z,ne,Math.min(c,1)),we,be);be(),ne===Z&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=X(re(),Z,ne,c),me=b(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:Z,tEnd:ne})});function ve(){ge=true,ue.hold(true);}return {destroy(){ge=true,ue.off(),B(),pe(e);},replay(){Ie=-1,ye=0,K=false,me=0,ge=false,ce(0),ue.hold(false);},pause:ve,resume(){ge&&(ge=false,ue.hold(false));},seek(a){let f=Math.min(1,Math.max(0,a));me=f,Ie=f,ye=0,ve(),ce(f);},getProgress(){return me},refresh:ue.remeasure}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Lr(e,r){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;return t?gt(t,r):(W("scrollAnimate: element not found:",e),st)}function $r(e,r={}){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return W("scrollParallax: element not found:",e),st;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:c,onProgress:m}=r,u=-n*100,p=t.style,v=!!t.ownerSVGElement,S=p.getPropertyValue("transform-box");v&&p.setProperty("transform-box","fill-box");let h=gt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${u}%)`]}:{transform:["translateY(0%)",`translateY(${u}%)`]},trigger:c??{start:"top bottom",end:"bottom top"},easing:i,native:false,onProgress:m});return v?{...h,destroy(){h.destroy(),p.setProperty("transform-box",S);}}:h}var yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return yt;let t=typeof e=="string"?document.querySelector(e):e;return t?_e(r,(n,s)=>Cr(t,n,s)):(W("scrollCounter: element not found:",e),yt)}function Cr(e,r,t){let{from:n=0,to:s,format:i,easing:c="ease-out",trigger:m={},once:u=true,decimals:p,onComplete:v}=r,S=p!==void 0?L=>L.toFixed(p):i??(L=>String(Math.round(L))),h=typeof c=="function"?c:U[c]??U["ease-out"],O=Te(m.start||"top 80%"),ee=Te(m.end||"top 20%");if(t)return e.textContent=S(s),v?.(),{...yt,getProgress:()=>1};let A=0,y=0,x=false,g=-1,b=0,w=0,I=false,z=()=>window.scrollY,N=()=>window.innerHeight;function te(){let L=e.getBoundingClientRect(),H=$e({top:L.top,height:L.height},z(),N(),O,ee);x&&Math.abs(H.tStart-A)<1&&Math.abs(H.tEnd-y)<1||(x=true,A=H.tStart,y=H.tEnd);}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function le(L){e.textContent=S(n+(s-n)*L),e.style.setProperty("--scroll-draw-progress",String(L));}let de=()=>X(z(),A,y,1);function B(){let L=de(),H=u?Math.max(g,h(b=Math.max(b,L))):h(L);w=H,le(H),H>=1&&!I?(I=true,v?.()):H<1&&!u&&(I=false);}te();{b=X(z(),A,y,1);let L=h(b);w=L,le(L);}let re=Ve(window,[e],de,B,te);Me(e,{type:"counter",getProgress:()=>w,getTrigger:()=>({tStart:A,tEnd:y})});let Ae=()=>re.hold(false);return {destroy(){re.off(),e.style.setProperty("--scroll-draw-progress",Ge),pe(e);},replay(){g=-1,b=0,I=false,w=0,le(0),Ae();},pause:()=>re.hold(true),resume:Ae,seek(L){let H=Math.min(1,Math.max(0,L));w=H,g=H,b=0,re.hold(true),le(H);},getProgress(){return w}}}var tr="http://www.w3.org/2000/svg",Dr="cinematic-photo",ht=e=>e<0?0:e>1?1:e;function it(e){let r=parseFloat(e);return Number.isFinite(r)?ht(r/100):0}function Or(e){return U[e]??U.linear}var Ir={destroy:()=>{},getProgress:()=>0},bt=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||W("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return Ir;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 y of r.scenes){if(y.background){let g=document.createElement("img");g.id=Dr,g.src=y.background,g.alt="",g.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(g);}let x=y.animations.filter(g=>g.type==="draw");if(x.length){let g=document.createElementNS(tr,"svg");g.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),g.setAttribute("preserveAspectRatio","xMidYMid meet"),g.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(g);for(let b of x){let w=document.createElementNS(tr,"path");w.id=b.target.replace(/^#/,""),w.setAttribute("d",b.d),w.setAttribute("fill","none"),w.setAttribute("stroke",b.stroke),w.setAttribute("stroke-width",String(b.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let I=b.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(I),w.style.strokeDashoffset=String(I),g.appendChild(w),s.push({kind:"draw",el:w,start:it(b.start),end:it(b.end),ease:Or(b.easing),length:I});}}for(let g of y.animations){if(g.type!=="fade")continue;let b=n.querySelector(g.target)??document.querySelector(g.target);b&&(b.style.opacity=String(g.from),s.push({kind:"fade",el:b,start:it(g.start),end:it(g.end),ease:U["ease-in-out"]??U.linear,from:g.from,to:g.to}));}}let i=0,c=()=>{let y=t.offsetHeight-window.innerHeight;return y<=0?t.getBoundingClientRect().top<=0?1:0:ht(-t.getBoundingClientRect().top/y)},m=y=>{for(let x of s){let g=x.end-x.start,b=g<=0?y>=x.end?1:0:ht((y-x.start)/g),w=x.ease(b);x.kind==="draw"?x.el.style.strokeDashoffset=String(x.length*(1-w)):x.el.style.opacity=String(x.from+(x.to-x.from)*w);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return m(1),{destroy:()=>{},getProgress:()=>1};let u=0,p=false,v=false,S=()=>{i=c(),m(i),p&&(u=requestAnimationFrame(S));},h=()=>{p||(p=true,u=requestAnimationFrame(S));},O=()=>{p=false,cancelAnimationFrame(u);},ee=new IntersectionObserver(y=>{for(let x of y)v=x.isIntersecting,v?h():O();},{threshold:0});ee.observe(n),i=c(),m(i),Me(t,{type:"draw",getProgress:()=>i,getTrigger:()=>{let y=t.getBoundingClientRect().top+window.scrollY;return {tStart:y,tEnd:y+Math.max(0,t.offsetHeight-window.innerHeight)}}});let A=rt(y=>{y&&(A(),O(),ee.disconnect(),pe(t),i=1,m(1));});return {destroy(){A(),O(),ee.disconnect(),pe(t);},getProgress:()=>i}}};
|
|
4
|
-
exports.Cinematic=
|
|
1
|
+
'use strict';function Ct({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Dt({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,l=[];for(let d=0;d<t;d++){let v=Math.pow(s,d);l.push(v),i+=v;}let u=[0],m=0;for(let d=0;d<t;d++)m+=l[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 Ot({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 oe={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:Ct(),bounce:Dt(),elastic:Ot()};function It(e,r,t){return Math.min(t,Math.max(r,e))}function Te(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 Ht=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function Rt(e,r,t,n){return e+t+r*Ht(n,0)}function Nt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Ht(e,1))}function R(e,r,t,n){return t===r?0:It((e-r)/(t-r)*n,0,1)}function $e(e,r,t,n,s){let i=Rt(e.top,e.height,r,n.element)-Nt(n.viewport,t),l=Rt(e.top,e.height,r,s.element)-Nt(s.viewport,t);return {tStart:i,tEnd:l}}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 Je(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 Ft(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=Ft(e),s=Ft(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 dt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var _e=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function W(e,...r){_e&&console.warn(`[svg-scroll-draw] ${e}`,...r);}var mr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",fr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",_t=33;function pr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function dr(e){let r=[];for(let t=0;t<_t;t++){let n=t/(_t-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function tt(e){switch(e){case "linear":return "linear";case "ease-in":return mr;case "ease-out":return fr;case "ease-in-out":return pr()?dr(oe["ease-in-out"]):null;default:return null}}var Vt=Symbol.for("svg-scroll-draw.registry");function Gt(){let e=globalThis;return e[Vt]||(e[Vt]=new Map)}function Me(e,r){Gt().set(e,r);}function pe(e){Gt().delete(e);}function rt(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 Ve(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,true);let t=r(e,false),n=rt(i=>{if(!i)return;n();let l=(t.getProgress?.()??0)>=1;t.destroy(),t=r(l?{...e,onComplete:void 0}:e,true);}),s={};for(let i of Object.keys(t))s[i]=(...l)=>t[i]?.(...l);return s.destroy=()=>{n(),t.destroy();},s}var je,nt=new Set,ot=new WeakMap,Ye=new Map,Wt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function gr(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 zt(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>r();je??(je=new ResizeObserver(s=>{let i=false;for(let{target:l}of s)ot.get(l)!==Wt(l)&&(i=true),ot.set(l,"");i&&nt.forEach(l=>l());})),nt.add(t);let n=gr(e);return [document.body,document.documentElement].forEach(s=>s&&n.add(s)),n.forEach(s=>{ot.has(s)||ot.set(s,Wt(s)),Ye.set(s,(Ye.get(s)??0)+1),je.observe(s);}),()=>{nt.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);}),nt.size||(je?.disconnect(),je=void 0));}}function ke(e,r,t,n,s){let i,l=NaN,u,m,d=()=>{i=0,n(),!u&&!i&&(l=t())>0&&l<1&&(i=requestAnimationFrame(d));},v=()=>{!i&&!u&&t()!==l&&(i=requestAnimationFrame(d));},E=w=>{u=w,cancelAnimationFrame(i),i=l=NaN,v();},y=()=>{clearTimeout(m),s(),v();},I=()=>{clearTimeout(m),m=setTimeout(y,150);},se=zt(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"),se(),clearTimeout(m);}}}var yr=0;function hr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Bt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim();}catch{}return t||(e.getAttribute(r)??"").trim()}var qt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function br(e){if(!_e)return;let r=Bt(e,"stroke");if(!r||r==="none"){W("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!qt.has(t)&&!qt.has(Bt(e,"fill"))&&W("Element has a fill \u2014 it may obscure the stroke animation.",e);}function wr(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,l=e-i,u=r-i,m=t==="x";n.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${m?`left:${l}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${l}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 jt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Yt=/[MmLlHhVvCcSsQqTtAaZz]/g;function vr(e,r,t){if(!_e)return;let n=(e.match(Yt)??[]).join("").toUpperCase(),s=(r.match(Yt)??[]).join("").toUpperCase(),i=(e.match(jt)??[]).length,l=(r.match(jt)??[]).length;if(n!==s){W(`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!==l&&W(`morphTo: coordinate count differs (${i} \u2192 ${l}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t);}function Er(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 l=parseFloat(i),u=n[s++]??l;return String(+(l+(u-l)*t).toFixed(4))})}function Qt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:Ve(r,(t,n)=>Sr(e,t,n))}function Sr(e,r,t){let{preset:n,...s}=r,i=n?{...dt[n],...s}:s,{selector:l="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:se=false,axis:f="y",scrollContainer:w,autoReverse:h=false,delay:x=0,strokeColor:b,strokeWidth:L,fillOpacity:U,waypoints:z,velocityScale:N=false,threshold:J=0,rootMargin:Ge="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:ee,autoplay:Ae=false,duration:P=1e3,native:H=true,onProgress:Ce,onStart:X,onComplete:te,onEnter:ge,onLeave:Re,onEnterBack:ye,onLeaveBack:me}=i,Z=ee===true?"left":typeof ee=="string"?ee:false,q=typeof d=="function"?d:oe[d]??oe.linear,Ne=Te(v.start||"top bottom"),We=Te(v.end||"bottom top"),F=typeof w=="string"?document.querySelector(w):w??null,he=Array.isArray(b)?b[0]:null,be=Array.isArray(b)?b[1]:typeof b=="string"?b:null,ce=Array.isArray(L)?L[0]:null,Pe=Array.isArray(L)?L[1]:typeof L=="number"?L:null,we=Array.isArray(U)?U[0]:null,ue=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function ve(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 a=Z?[]:Array.from(e.querySelectorAll(l)),p=[],_=[],M=0,$=0,O=E,k=0,Le=0,V=false,Ee=false,Se=0,at=-1,Qe=[],Ue=-1,ie=false,fe=0,De=0,Oe,lt=false,ct=null;function bt(){ct?.destroy(),ct=null;}let Ie=new Set,wt=NaN,He=true,Xe=-1,vt=performance.now(),Fe=NaN;function Ze(){return F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY}function Et(){return F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function St(){let o=Ke(e,F,f);return $e(o,o.scroll,Et(),Ne,We)}function or(){let o=$-M,c=a.length-1,g=F??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),Le=M+Math.max(0,G,re,G+re);}function xt(){(({tStart:M,tEnd:$}=St())),or(),se&&_e&&(bt(),ct=wr(M,$,f));}function ut(o,c=St){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),pe(e);},o}function Tt(o,c){return I&&!h?Math.max(at,q(Qe[o]=Math.max(Qe[o]??0,c))):q(c)}function sr(o,c){if(e.style.setProperty("--scroll-draw-progress",String(o)),Z){let g=c==="reverse"?1-o:o;e.style.clipPath=ve(g);return}a.forEach((g,T)=>mt(g,T,o,c));}function mt(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}`),he&&be?o.style.stroke=et(he,be,g):be&&(o.style.stroke=be),ce!==null&&Pe!==null?o.style.strokeWidth=`${ce+(Pe-ce)*g}`:Pe!==null&&(o.style.strokeWidth=`${Pe}`),we!==null&&ue!==null?o.style.fillOpacity=`${we+(ue-we)*g}`:ue!==null&&(o.style.fillOpacity=`${ue}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",Er(_[c],B,g));}function ft(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ve(y==="reverse"?1:0);return}a.forEach((o,c)=>{o.style.strokeDasharray=`${p[c]}`,o.style.strokeDashoffset=y==="reverse"?"0":`${p[c]}`,m?o.style.opacity=y==="reverse"?"1":"0":o.style.opacity="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`),B&&o.tagName.toLowerCase()==="path"&&_[c]&&o.setAttribute("d",_[c]);});}function ze(o,c){let g=o.getAttribute("d"),T=Je(o);if(B&&_[c]){o.setAttribute("d",B);let G=Je(o);o.setAttribute("d",_[c]),T=Math.max(Je(o),G),o.setAttribute("d",g);}p[c]=T,o.style.strokeDasharray=`${T}`;}if(a.forEach((o,c)=>{br(o);let g=o.tagName.toLowerCase()==="path";g?_.push(o.getAttribute("d")??""):_.push(""),ze(o,c);let T=p[c];B&&(g?vr(_[_.length-1],B,o):W(`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"),be&&(o.style.stroke=be),Pe!==null&&(o.style.strokeWidth=`${Pe}`),ue!==null&&(o.style.fillOpacity=`${ue}`),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="",he&&(o.style.stroke=he),ce!==null&&(o.style.strokeWidth=`${ce}`),we!==null&&(o.style.fillOpacity=`${we}`));}),t)return Z&&(e.style.clipPath=ve(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};Z&&(e.style.clipPath=ve(y==="reverse"?1:0));let Mt=typeof d=="string"?tt(d):null;function ir(){return !(H===false||Ae||se&&_e||!hr()||!a.length||!Mt||Z||f!=="y"||F||u!==1||E!==0||I||h||N!==false||B||z||le||x>0||Ce||X||te||ge||Re||ye||me||b!=null||L!=null||U!=null||(v.start||"top bottom").trim()!=="top bottom"||(v.end||"bottom top").trim()!=="bottom top")}function ar(){let o=++yr,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:${Mt};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function K(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=`${p[A]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c);}a.forEach(K);let Y=false,ne=-1;function ae(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=$e({top:S.top,height:S.height},Ze(),Et(),Ne,We);return q(R(Ze(),A,Q,u))}return {destroy(){e.classList.remove(g),a.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState="";}),D.remove();},replay(){Y=false,ne=-1,a.forEach(K);},pause(){Y=true,a.forEach(S=>{S.style.animationPlayState="paused";});},resume(){Y&&(Y=false,a.forEach(S=>{S.style.animationPlayState="running";}));},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=true,a.forEach((Q,xe)=>{Q.classList.remove(c),Q.style.strokeDashoffset=y==="reverse"?`${p[xe]*A}`:`${p[xe]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`);});},getProgress(){return ae()},refresh(){a.forEach((S,A)=>{ze(S,A),S.style.setProperty("--ssd-len",String(p[A]));});}}}if(ir())return ut(ar());function lr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,a.length-1)*E),g=0,T=0,G=false;function re(ne){let ae=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);fe=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=ve(y==="reverse"?1-Q:Q),Ce?.(Q),A<1&&(ae=false);}else {a.forEach((Q,xe)=>{let ur=xe*E*o,kt=Math.min(1,Math.max(0,(ne-ur)/o));mt(Q,xe,q(kt),y),kt<1&&(ae=false);});let A=q(S);fe=A,Ce?.(A),e.style.setProperty("--scroll-draw-progress",String(A));}if(z){let A=q(S);for(let Q in z){let xe=parseFloat(Q);A>=xe&&!Ie.has(xe)&&(Ie.add(xe),z[Q]?.());}}return ae}function j(ne){if(ie)return;let ae=ne-g;Ee||(Ee=true,X?.());let S=re(ae);if(S&&!V){V=true,re(c),te?.(),De<(le==="infinite"?1/0:le??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),Ee=false,V=false,Ie.clear(),ft(),Se=requestAnimationFrame(j);},de));return}S||(Se=requestAnimationFrame(j));}function C(){cancelAnimationFrame(Se),clearTimeout(Oe),g=performance.now(),T=0,ie=false,Ee=false,V=false,De=0,G=true,fe=0,Ie.clear(),ft(),Se=requestAnimationFrame(j);}let D=new IntersectionObserver(ne=>{ne.forEach(ae=>{ae.isIntersecting&&!(I&&V)?C():!ae.isIntersecting&&!I&&!V&&(cancelAnimationFrame(Se),clearTimeout(Oe),G=false);});},{root:F??null,threshold:J,rootMargin:Ge}),K;function Y(){clearTimeout(K),K=setTimeout(()=>a.forEach(ze),150);}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Se),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(K);},replay(){De=0,C();},pause(){ie||!G||(ie=true,T=performance.now()-g,cancelAnimationFrame(Se));},resume(){ie&&(ie=false,G=true,g=performance.now()-T,Se=requestAnimationFrame(j));},seek(ne){let ae=Math.min(1,Math.max(0,ne));fe=ae,ie=true,T=ae*c,g=performance.now()-T,cancelAnimationFrame(Se),re(T);},getProgress(){return fe},refresh(){clearTimeout(K),a.forEach(ze);}}}if(Ae)return ut(lr());xt();let At=()=>R(Ze(),k,Le,1);function Pt(){V=true,te?.(),De<(le==="infinite"?1/0:le)&&(De++,Oe=setTimeout(()=>{lt=true;},de));}function Lt(){at=-1,Qe=[],Ee=false,V=false,lt=false,Ie.clear(),ft(),He=true;}function cr(){let o=performance.now(),c=Ze();if(lt&&At()%1&&Lt(),!He&&N===false&&c===wt)return;He=false,wt=c;let g=u;if(N!==false){let C=o-vt,D=C>0?Math.abs(c-(Xe<0?c:Xe))/C:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04);}Xe=c,vt=o;let T=h?Ue===-1||c>=Ue?"forward":"reverse":y;Ue=c;let G=$-M,re=true,j=G===0?0:(c-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&ge?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ye?.(),Fe>0&&j<=0&&me?.()),Fe=j,Z){let C=Tt(0,R(c,M,$,g));fe=C,e.style.setProperty("--scroll-draw-progress",String(C));let D=T==="reverse"?1-C:C;e.style.clipPath=ve(D),Ce?.(C),!Ee&&R(c,M,$,g)>0&&(Ee=true,X?.()),C>=1&&!V?Pt():C<1&&!I&&(V=false);return}if(a.forEach((C,D)=>{let K=D*O*G,Y=Tt(D,R(c,M+K,$+K,g));mt(C,D,Y,T),D===0&&(fe=Y,Ce?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=false);}),z){let C=q(R(c,M,$,g));for(let D in z){let K=parseFloat(D);C>=K&&!Ie.has(K)&&(Ie.add(K),z[D]?.());}}!Ee&&R(c,M,$,g)>0&&(Ee=true,X?.()),re&&!V?Pt():!re&&!I&&(V=false);}let Be=ke(F??window,[e],At,cr,()=>{let o=p.join();a.forEach(ze),xt(),He=true,p.join()!==o&&qe();}),pt=x>0;function qe(){Be.hold(ie||pt);}let $t;return pt&&($t=setTimeout(()=>{pt=false,qe();},x)),qe(),ut({destroy(){clearTimeout(Oe),clearTimeout($t),Be.off(),bt();},replay(){Lt(),Ue=-1,Xe=-1,De=0,ie=false,fe=0,clearTimeout(Oe),qe();},pause(){ie=true,Be.hold(true);},resume(){ie&&(ie=false,He=true,qe());},seek(o){let c=Math.min(1,Math.max(0,o));fe=c,at=c,Qe=[],ie=true,Be.hold(true),sr(c,y),He=true;},getProgress(){return fe},refresh:Be.remeasure},()=>({tStart:M,tEnd:$}))}function xr(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?Qt(n,r):(W("Container not found:",e),t)}function Tr(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Ut(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let s=[],i=[],l=n[2].trim();if(l)for(let u of l.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 Mr(e,r,t){let n=Ut(e),s=Ut(r);return n.length===0||n.length!==s.length?t<1?e:r:n.map((i,l)=>{let u=s[l];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 Xt(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),s=String(r);if(Tr(n))return et(n,s,t);if(n.includes("("))return Mr(n,s,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),l=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&l){let u=parseFloat(i[1]),m=parseFloat(l[1]);return `${u+(m-u)*t}${i[2]||l[2]}`}return t<1?n:s}function Ar(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Pr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Lr=0,Zt="--scroll-draw-progress";function $r(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var Jt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function gt(e,r){return typeof window>"u"?Jt:r.respectReducedMotion===false?Kt(e,r,false):Ve(r,(t,n)=>Kt(e,t,n))}function Kt(e,r,t){let{props:n,trigger:s={},easing:i="ease-out",speed:l=1,once:u=false,axis:m="y",scrollContainer:d,native:v=true,velocityScale:E=false,triggerElement:y,onProgress:I,onComplete:se,onEnter:f,onLeave:w,onEnterBack:h,onLeaveBack:x}=r,b=typeof i=="function"?i:oe[i]??oe["ease-out"],L=Te(s.start||"top bottom"),U=Te(s.end||"bottom top"),z=y??e,N=typeof d=="string"?document.querySelector(d):d??null,J=Object.entries(n).map(([a,p])=>({prop:Ar(a),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ge(){let a=window.getComputedStyle(e);for(let p of J)p.from===""&&(p.from=a.getPropertyValue(p.prop).trim()||"0");}function le(){for(let a of J)e.style.setProperty(a.prop,String(a.to));}let de=new Map;for(let a of [...J.map(p=>p.prop),Zt])de.set(a,e.style.getPropertyValue(a));function B(){for(let[a,p]of de)p?e.style.setProperty(a,p):e.style.removeProperty(a);}if(t)return le(),se?.(),{...Jt,destroy:B,getProgress:()=>1};Ge();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Ae=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?tt(i):null;function H(){if(!v||!$r()||!P||m!=="y"||N||z!==e||u||l!==1||I||se||f||w||h||x||E!==false||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return false;for(let a of J)if(!Pr.has(a.prop))return false;return true}function Ce(){let a=`ssd-a-${++Lr}`,p=J.map(k=>`${k.prop}:${k.from}`).join(";"),_=J.map(k=>`${k.prop}:${k.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${a}{from{${p}}to{${_}}}.${a}{animation-name:${a};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(a);let $=()=>{let k=e.getBoundingClientRect();return $e({top:k.top,height:k.height},ee(),Ae(),L,U)};Me(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:$});let O={refresh(){},destroy(){e.classList.remove(a),M.remove(),e.style.animationPlayState="",B(),pe(e);},replay(){e.classList.remove(a),e.offsetWidth,e.classList.add(a);},pause(){e.style.animationPlayState="paused";},resume(){e.style.animationPlayState="";},seek(k){let Le=Math.min(1,Math.max(0,k));e.classList.remove(a);for(let V of J)e.style.setProperty(V.prop,Xt(V.from,V.to,Le));},getProgress(){let{tStart:k,tEnd:Le}=$();return b(R(ee(),k,Le,l))}};return O}if(H())return Ce();let X=0,te=0,ge=false,Re=-1,ye=0,me=0,Z=false,q=NaN,Ne=-1,We=0,F=z===e?J:[],he=false;function be(){let a=e.style,p=F.map(O=>a.getPropertyValue(O.prop)),_=a.transition;F.length&&(a.transition="none"),F.forEach(O=>a.setProperty(O.prop,de.get(O.prop)??""));let M=Ke(z,N,m);F.forEach((O,k)=>a.setProperty(O.prop,p[k])),F.length&&(e.offsetWidth,a.transition=_);let $=$e(M,M.scroll,Ae(),L,U);he&&Math.abs($.tStart-X)<1&&Math.abs($.tEnd-te)<1||(he=true,X=$.tStart,te=$.tEnd);}function ce(a){e.style.setProperty(Zt,String(a));for(let p of J)e.style.setProperty(p.prop,Xt(p.from,p.to,a));I?.(a);}function Pe(a){if(isNaN(q)){q=a;return}q<=0&&a>0&&f?.(),q<1&&a>=1&&w?.(),q>=1&&a<1&&h?.(),q>0&&a<=0&&x?.(),q=a;}function we(){if(ge)return;let a=performance.now(),p=ee(),_=l;if(E!==false){let k=a-We,Le=k>0?Math.abs(p-(Ne<0?p:Ne))/k:0;_=l*Math.max(.2,1+Le*(typeof E=="number"?E:1)*.04);}Ne=p,We=a;let M=te===X?0:(p-X)/(te-X);Pe(M);let $=R(p,X,te,_),O=u?Math.max(Re,b(ye=Math.max(ye,$))):b($);me=O,ce(O),O>=1&&!Z?(Z=true,se?.()):O<1&&!u&&(Z=false);}let ue=ke(N??window,[z],()=>R(ee(),X,te,Math.min(l,1)),we,be);be(),te===X&&W("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ye=R(ee(),X,te,l),me=b(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:X,tEnd:te})});function ve(){ge=true,ue.hold(true);}return {destroy(){ge=true,ue.off(),B(),pe(e);},replay(){Re=-1,ye=0,Z=false,me=0,ge=false,ce(0),ue.hold(false);},pause:ve,resume(){ge&&(ge=false,ue.hold(false));},seek(a){let p=Math.min(1,Math.max(0,a));me=p,Re=p,ye=0,ve(),ce(p);},getProgress(){return me},refresh:ue.remeasure}}var st={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function kr(e,r){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;return t?gt(t,r):(W("scrollAnimate: element not found:",e),st)}function Cr(e,r={}){if(typeof window>"u")return st;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return W("scrollParallax: element not found:",e),st;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:l,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=gt(t,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:l??{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 yt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Dr(e,r){if(typeof window>"u")return yt;let t=typeof e=="string"?document.querySelector(e):e;return t?Ve(r,(n,s)=>Or(t,n,s)):(W("scrollCounter: element not found:",e),yt)}function Or(e,r,t){let{from:n=0,to:s,format:i,easing:l="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=typeof l=="function"?l:oe[l]??oe["ease-out"],I=Te(u.start||"top 80%"),se=Te(u.end||"top 20%");if(t)return e.textContent=E(s),v?.(),{...yt,getProgress:()=>1};let f=0,w=0,h=false,x=-1,b=0,L=0,U=false,z=()=>window.scrollY,N=()=>window.innerHeight;function J(){let P=e.getBoundingClientRect(),H=$e({top:P.top,height:P.height},z(),N(),I,se);h&&Math.abs(H.tStart-f)<1&&Math.abs(H.tEnd-w)<1||(h=true,f=H.tStart,w=H.tEnd);}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function le(P){e.textContent=E(n+(s-n)*P),e.style.setProperty("--scroll-draw-progress",String(P));}let de=()=>R(z(),f,w,1);function B(){let P=de(),H=m?Math.max(x,y(b=Math.max(b,P))):y(P);L=H,le(H),H>=1&&!U?(U=true,v?.()):H<1&&!m&&(U=false);}J();{b=R(z(),f,w,1);let P=y(b);L=P,le(P);}let ee=ke(window,[e],de,B,J);Me(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:w})});let Ae=()=>ee.hold(false);return {destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ge),pe(e);},replay(){x=-1,b=0,U=false,L=0,le(0),Ae();},pause:()=>ee.hold(true),resume:Ae,seek(P){let H=Math.min(1,Math.max(0,P));L=H,x=H,b=0,ee.hold(true),le(H);},getProgress(){return L}}}var er="http://www.w3.org/2000/svg",Ir="cinematic-photo",nr=e=>e<0?0:e>1?1:e;function it(e){let r=parseFloat(e);return Number.isFinite(r)?nr(r/100):0}function tr(e){return oe[e]??oe.linear}var rr=e=>({destroy(){},getProgress:()=>e}),ht=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||W("Cinematic: wrapper not found:",r.wrapper);}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return rr(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=Ir,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(er,"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(er,"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=String(L),b.style.strokeDashoffset=String(L),h.appendChild(b),s.push({kind:"draw",el:b,start:it(x.start),end:it(x.end),ease:tr(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:it(h.start),end:it(h.end),ease:tr("ease-in-out"),from:h.from,to:h.to}));}}let i=0,l=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))){l=f;break}let u=0,m=0,d=()=>{let f=t.getBoundingClientRect().top;u=l?f-l.getBoundingClientRect().top-l.clientTop+l.scrollTop:f+window.scrollY,m=u+Math.max(0,t.offsetHeight-(l?l.clientHeight:window.innerHeight));},v=()=>{let f=l?l.scrollTop:window.scrollY;return m<=u?f>=u?1:0:R(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:nr((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),rr(1);let y=()=>{i=v(),E(i);};d(),y();let I=ke(l||window,[t],v,y,d);Me(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let se=rt(f=>{f&&(se(),I.off(),pe(t),i=1,E(1));});return {destroy(){se(),I.off(),pe(t);},getProgress:()=>i}}};
|
|
4
|
+
exports.Cinematic=ht;exports.PRESETS=dt;exports.createBounce=Dt;exports.createElastic=Ot;exports.createSpring=Ct;exports.scrollAnimate=kr;exports.scrollCounter=Dr;exports.scrollDraw=xr;exports.scrollParallax=Cr;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as scrollAnimate,b as scrollParallax}from'./chunk-
|
|
1
|
+
export{a as scrollAnimate,b as scrollParallax}from'./chunk-QZKYGS74.mjs';export{a as Cinematic}from'./chunk-BDXWPUBJ.mjs';export{a as scrollDraw}from'./chunk-NX74KN5X.mjs';export{a as scrollCounter}from'./chunk-U5TKLHGW.mjs';import'./chunk-7USW2XFB.mjs';export{a as PRESETS}from'./chunk-7XOFQCQE.mjs';import'./chunk-V3Z6G5JE.mjs';import'./chunk-UPWWULKI.mjs';import'./chunk-XC5NR2MU.mjs';import'./chunk-2PYLM3E7.mjs';import'./chunk-NV6YTPHI.mjs';export{b as createBounce,c as createElastic,a as createSpring}from'./chunk-THPTANES.mjs';import'./chunk-4DOJSIEQ.mjs';import'./chunk-5PJEKEEP.mjs';import'./chunk-EBU6E26L.mjs';import'./chunk-LFSU6LR3.mjs';
|
package/dist/nuxt/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b,d,f,h,j}from'../chunk-
|
|
1
|
+
import {b,d,f,h,j}from'../chunk-5SKWSPQT.mjs';export{d as ScrollAnimate,f as ScrollCounter,b as ScrollDraw,j as ScrollText,h as ScrollVideo,c as useScrollAnimate,e as useScrollCounter,a as useScrollDraw,i as useScrollText,g as useScrollVideo}from'../chunk-5SKWSPQT.mjs';import'../chunk-XSVTHCLO.mjs';import'../chunk-BRV2B2YW.mjs';import'../chunk-32ZCSGFZ.mjs';import'../chunk-U5TKLHGW.mjs';import'../chunk-7USW2XFB.mjs';import'../chunk-7XOFQCQE.mjs';import'../chunk-V3Z6G5JE.mjs';import'../chunk-UPWWULKI.mjs';import'../chunk-XC5NR2MU.mjs';import'../chunk-2PYLM3E7.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';function s(){return {install(o){o.component("ScrollDraw",b),o.component("ScrollAnimate",d),o.component("ScrollCounter",f),o.component("ScrollVideo",h),o.component("ScrollText",j);}}}export{s as createScrollDrawPlugin};
|
package/dist/pin/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$1}from'../chunk-4DOJSIEQ.mjs';import {a,b as b$1}from'../chunk-
|
|
1
|
+
import {a as a$1}from'../chunk-4DOJSIEQ.mjs';import {a,b as b$1}from'../chunk-EBU6E26L.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var C={destroy:()=>{},refresh:()=>{},getProgress:()=>0};function V(c,P={}){if(typeof window>"u")return C;let S=typeof c=="string"?document.querySelector(c):c;if(!S)return b("scrollPin: element not found:",c),C;let e=S,{top:p=0,scrollContainer:m,onEnter:O,onLeave:k,onEnterBack:D,onLeaveBack:I,onProgress:q}=P,A=typeof m=="string"?document.querySelector(m):m??null,i={position:e.style.position,top:e.style.top,bottom:e.style.bottom,left:e.style.left,width:e.style.width,boxSizing:e.style.boxSizing},t=document.createElement("div");t.setAttribute("data-ssd-pin-wrapper",""),t.style.cssText="position:relative;",e.parentNode?.insertBefore(t,e),t.appendChild(e);let y=0,g=0,b$2=0,f="before",v=0,z=0,h=false,T=false;function F(){let n=P.pinDistance;if(n===void 0)return window.innerHeight;if(typeof n=="number")return n;let o=parseFloat(n),s=n.trim().slice(-2);if(o===o&&s==="px")return o;if(o===o&&s==="vh"){let r=document.createElement("div");r.style.cssText="position:fixed;height:100vh",document.body.appendChild(r);let W=r.offsetHeight||window.innerHeight;return r.remove(),o*W/100}return T||b("scrollPin: pinDistance is not a number, vh or px; using window.innerHeight:",n),T=true,window.innerHeight}function L(){y=t.offsetWidth,g=e.offsetHeight,b$2=F(),t.style.height=`${g+b$2}px`;}function w(n){if(f===n)return;let o=f;if(f=n,n==="before")e.style.position=i.position,e.style.top=i.top,e.style.bottom=i.bottom,e.style.left=i.left,e.style.width=i.width,e.style.boxSizing=i.boxSizing,o==="pinned"&&I?.();else if(n==="pinned"){let s=t.getBoundingClientRect();e.style.position="fixed",e.style.top=`${p}px`,e.style.bottom="",e.style.left=`${s.left}px`,e.style.width=`${y}px`,e.style.boxSizing="border-box",o==="before"?O?.():o==="after"&&D?.();}else e.style.position="absolute",e.style.top="",e.style.bottom="0",e.style.left="0",e.style.width="100%",e.style.boxSizing="border-box",o==="pinned"&&k?.();}function N(){h=false;let n=t.getBoundingClientRect(),o=n.top,s=n.bottom,r=a$1((p-o)/b$2,0,1);v=r,q?.(r),o>p?w("before"):s-g<=p?w("after"):w("pinned");}function a$2(){h||(h=true,z=requestAnimationFrame(()=>N()));}function x(){L(),f==="pinned"&&(e.style.left=`${t.getBoundingClientRect().left}px`,e.style.width=`${y}px`),a$2();}let B=A??window;B.addEventListener("scroll",a$2,{passive:true});let l;function u(){clearTimeout(l),l=setTimeout(x,150);}window.addEventListener("resize",u),window.addEventListener("orientationchange",u);let d=null;return typeof ResizeObserver<"u"&&(d=new ResizeObserver(()=>{clearTimeout(l),l=setTimeout(x,100);}),d.observe(t),d.observe(document.documentElement),d.observe(e)),L(),a$2(),a(t,{type:"pin",getProgress:()=>v,getTrigger:()=>({tStart:0,tEnd:1})}),{destroy(){cancelAnimationFrame(z),clearTimeout(l),B.removeEventListener("scroll",a$2),window.removeEventListener("resize",u),window.removeEventListener("orientationchange",u),d?.disconnect(),e.style.position=i.position,e.style.top=i.top,e.style.bottom=i.bottom,e.style.left=i.left,e.style.width=i.width,e.style.boxSizing=i.boxSizing,t.parentNode?.insertBefore(e,t),t.remove(),b$1(t);},refresh(){x();},getProgress(){return v}}}export{V as scrollPin};
|
package/dist/progress/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import {a as a$2}from'../chunk-UPWWULKI.mjs';import {a,b as b$1,e,c}from'../chunk-NV6YTPHI.mjs';import {d}from'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$1,b as b$2}from'../chunk-
|
|
1
|
+
import {a as a$2}from'../chunk-UPWWULKI.mjs';import {a,b as b$1,e,c}from'../chunk-NV6YTPHI.mjs';import {d}from'../chunk-THPTANES.mjs';import'../chunk-4DOJSIEQ.mjs';import {a as a$1,b as b$2}from'../chunk-EBU6E26L.mjs';import {b}from'../chunk-LFSU6LR3.mjs';var O={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function X(c$1,D={}){if(typeof window>"u")return O;let g=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!g)return b("scrollProgress: element not found:",c$1),O;let o=g,{variable:h="--scroll-progress",easedVariable:m="--scroll-progress-eased",trigger:E={},easing:p="linear",speed:d$1=1,axis:n="y",scrollContainer:f,onProgress:H}=D,y=typeof p=="function"?p:d[p]??d.linear,k=a(E.start||"top bottom"),q=a(E.end||"bottom top"),t=typeof f=="string"?document.querySelector(f):f??null,s=0,i=0,l=0,w=()=>t?n==="x"?t.scrollLeft:t.scrollTop:n==="x"?window.scrollX:window.scrollY,F=()=>t?n==="x"?t.clientWidth:t.clientHeight:n==="x"?window.innerWidth:window.innerHeight;function x(){let e=a$2(o,t,n),r=c(e,e.scroll,F(),k,q);s=r.tStart,i=r.tEnd;}function P(e,r){o.style.setProperty(h,String(e)),m!=null&&o.style.setProperty(m,String(r)),H?.(e,r);}function G(){let e=b$1(w(),s,i,d$1),r=y(e);l=e,P(e,r);}x();{let e=b$1(w(),s,i,d$1),r=y(e);l=e,P(e,r);}let a$3=e(t??window,[o],()=>b$1(w(),s,i,Math.min(d$1,1)),G,x);return a$1(g,{type:"animate",getProgress:()=>l,getTrigger:()=>({tStart:s,tEnd:i})}),{destroy(){a$3.off(),o.style.removeProperty(h),m!=null&&o.style.removeProperty(m),b$2(g);},replay:a$3.remeasure,pause:()=>a$3.hold(true),resume:()=>a$3.hold(false),seek(e){let r=Math.min(1,Math.max(0,e)),L=y(r);l=r,a$3.hold(true),P(r,L);},getProgress(){return l}}}export{X as scrollProgress};
|