svg-scroll-draw 2.24.0 → 2.26.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 +174 -30
- package/dist/angular/index.cjs +3 -3
- package/dist/angular/index.d.mts +60 -6
- package/dist/angular/index.d.ts +60 -6
- package/dist/angular/index.mjs +1 -1
- package/dist/astro/index.cjs +2 -2
- package/dist/astro/index.d.mts +3 -3
- package/dist/astro/index.d.ts +3 -3
- package/dist/astro/index.mjs +1 -1
- package/dist/cdn/svg-scroll-draw.dev.global.js +69 -31
- package/dist/cdn/svg-scroll-draw.global.js +2 -2
- package/dist/chunk-5SJE7725.mjs +1 -0
- package/dist/{chunk-NX74KN5X.mjs → chunk-5U4JXBHR.mjs} +1 -1
- package/dist/chunk-7LDSB4FT.mjs +1 -0
- package/dist/chunk-ASCOHQQD.mjs +2 -0
- package/dist/chunk-GBFWTY5L.mjs +1 -0
- package/dist/chunk-HAGTU5EX.mjs +1 -0
- package/dist/chunk-HJTHOZK5.mjs +1 -0
- package/dist/chunk-IXR6RML7.mjs +1 -0
- package/dist/chunk-KN2YB54Z.mjs +1 -0
- package/dist/chunk-NJV6S5LD.mjs +1 -0
- package/dist/chunk-UBH4K5YD.mjs +1 -0
- package/dist/chunk-UF3MO5XQ.mjs +1 -0
- package/dist/chunk-XLXVGQ3P.mjs +3 -0
- package/dist/chunk-YOOPMYT6.mjs +1 -0
- package/dist/chunk-Z72TVDHY.mjs +1 -0
- package/dist/cinematic/index.cjs +2 -2
- package/dist/cinematic/index.d.mts +3 -1
- package/dist/cinematic/index.d.ts +3 -1
- package/dist/cinematic/index.mjs +1 -1
- package/dist/{engine-6VsjEwzb.d.ts → engine-Bi2x8-X-.d.mts} +2 -2
- package/dist/{engine-BLWKCfxC.d.mts → engine-DAlvk6i0.d.ts} +2 -2
- package/dist/frames/index.cjs +1 -1
- package/dist/frames/index.d.mts +2 -2
- package/dist/frames/index.d.ts +2 -2
- package/dist/frames/index.mjs +1 -1
- package/dist/group/index.cjs +3 -3
- package/dist/group/index.d.mts +3 -3
- package/dist/group/index.d.ts +3 -3
- package/dist/group/index.mjs +1 -1
- package/dist/horizontal/index.cjs +1 -1
- package/dist/horizontal/index.d.mts +2 -2
- package/dist/horizontal/index.d.ts +2 -2
- package/dist/horizontal/index.mjs +1 -1
- package/dist/{index-BN8yKeQ3.d.ts → index-BMMZ8aW7.d.mts} +2 -2
- package/dist/{index-hSQqLVbg.d.ts → index-CEMsUTEG.d.ts} +3 -3
- package/dist/{index-DAiRJgtF.d.mts → index-ClAFxNEp.d.mts} +3 -3
- package/dist/{index-DVjblK_4.d.mts → index-MdQ4ti_z.d.ts} +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +1 -1
- package/dist/lenis/index.cjs +1 -1
- package/dist/lenis/index.d.mts +15 -16
- package/dist/lenis/index.d.ts +15 -16
- package/dist/lenis/index.mjs +1 -1
- package/dist/nuxt/index.cjs +3 -3
- package/dist/nuxt/index.d.mts +8 -5
- package/dist/nuxt/index.d.ts +8 -5
- package/dist/nuxt/index.mjs +1 -1
- package/dist/progress/index.cjs +1 -1
- package/dist/progress/index.d.mts +2 -2
- package/dist/progress/index.d.ts +2 -2
- package/dist/progress/index.mjs +1 -1
- package/dist/react/index.cjs +3 -3
- package/dist/react/index.d.mts +21 -5
- package/dist/react/index.d.ts +21 -5
- package/dist/react/index.mjs +1 -1
- package/dist/reveal/index.cjs +1 -1
- package/dist/reveal/index.d.mts +2 -2
- package/dist/reveal/index.d.ts +2 -2
- package/dist/reveal/index.mjs +1 -1
- package/dist/{scroll-draw-Fzir8hlU.d.mts → scroll-draw-CKZysh22.d.mts} +1 -1
- package/dist/{scroll-draw-BsU_Ohmu.d.ts → scroll-draw-DbY8RUJE.d.ts} +1 -1
- package/dist/snap/index.cjs +1 -1
- package/dist/snap/index.d.mts +2 -2
- package/dist/snap/index.d.ts +2 -2
- package/dist/snap/index.mjs +1 -1
- package/dist/solid/index.cjs +3 -3
- package/dist/solid/index.d.mts +40 -4
- package/dist/solid/index.d.ts +40 -4
- package/dist/solid/index.mjs +1 -1
- package/dist/svelte/index.cjs +3 -3
- package/dist/svelte/index.d.mts +47 -4
- package/dist/svelte/index.d.ts +47 -4
- package/dist/svelte/index.mjs +1 -1
- package/dist/text/index.cjs +1 -1
- package/dist/text/index.d.mts +2 -2
- package/dist/text/index.d.ts +2 -2
- package/dist/text/index.mjs +1 -1
- package/dist/timeline/index.cjs +10 -10
- package/dist/timeline/index.d.mts +2 -2
- package/dist/timeline/index.d.ts +2 -2
- package/dist/timeline/index.mjs +2 -2
- package/dist/{types-9bcJdVcg.d.mts → types-iITMwrru.d.mts} +10 -2
- package/dist/{types-9bcJdVcg.d.ts → types-iITMwrru.d.ts} +10 -2
- package/dist/video/index.cjs +1 -1
- package/dist/video/index.d.mts +2 -2
- package/dist/video/index.d.ts +2 -2
- package/dist/video/index.mjs +1 -1
- package/dist/vue/index.cjs +3 -3
- package/dist/vue/index.d.mts +37 -4
- package/dist/vue/index.d.ts +37 -4
- package/dist/vue/index.mjs +1 -1
- package/dist/web-component/index.cjs +3 -3
- package/dist/web-component/index.mjs +1 -1
- package/dist/wrapper-BOHrDnBO.d.mts +8 -0
- package/dist/wrapper-Cm7JTIVl.d.ts +8 -0
- package/package.json +1 -1
- package/dist/chunk-32ZCSGFZ.mjs +0 -1
- package/dist/chunk-5SKWSPQT.mjs +0 -1
- package/dist/chunk-7USW2XFB.mjs +0 -1
- package/dist/chunk-7XOFQCQE.mjs +0 -3
- package/dist/chunk-BDXWPUBJ.mjs +0 -2
- package/dist/chunk-BRV2B2YW.mjs +0 -1
- package/dist/chunk-QZKYGS74.mjs +0 -1
- package/dist/chunk-THPTANES.mjs +0 -1
- package/dist/chunk-U5TKLHGW.mjs +0 -1
- package/dist/chunk-V3Z6G5JE.mjs +0 -1
- package/dist/chunk-XSVTHCLO.mjs +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";var SvgScrollDraw=(()=>{var
|
|
1
|
+
"use strict";var SvgScrollDraw=(()=>{var wt=Object.defineProperty;var vr=Object.getOwnPropertyDescriptor;var Er=Object.getOwnPropertyNames;var Sr=Object.prototype.hasOwnProperty;var xr=(e,r)=>{for(var t in r)wt(e,t,{get:r[t],enumerable:!0})},Tr=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of Er(r))!Sr.call(e,o)&&o!==t&&wt(e,o,{get:()=>r[o],enumerable:!(n=vr(r,o))||n.enumerable});return e};var Mr=e=>Tr(wt({},"__esModule",{value:!0}),e);var Yr={};xr(Yr,{Cinematic:()=>mt,PRESETS:()=>rt,createBounce:()=>Et,createElastic:()=>St,createSpring:()=>vt,scrollAnimate:()=>ir,scrollCounter:()=>lr,scrollDraw:()=>er,scrollParallax:()=>ar});function I(e,...r){}function vt({tension:e=2.5,friction:r=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,r)}function Et({bounces:e=3,decay:r=.5}={}){let t=Math.max(1,Math.round(e)),n=Math.max(.01,Math.min(.99,r)),o=Math.sqrt(n),i=0,a=[];for(let f=0;f<t;f++){let h=Math.pow(o,f);a.push(h),i+=h}let c=[0],m=0;for(let f=0;f<t;f++)m+=a[f]/i,c.push(m);return f=>{if(f<=0)return 0;if(f>=1)return 1;for(let h=0;h<t;h++)if(f<=c[h+1]){let E=(f-c[h])/(c[h+1]-c[h]);if(h===0)return E*(2-E);let y=1-Math.pow(n,h);return y+(1-y)*(2*E-1)*(2*E-1)}return 1}}function St({amplitude:e=1,period:r=.4}={}){let t=Math.max(1,e),n=Math.max(.1,r),o=t<=1?n/4:n/(2*Math.PI)*Math.asin(1/t);return i=>i<=0?0:i>=1?1:t*Math.pow(2,-10*i)*Math.sin((i-o)*(2*Math.PI)/n)+1}var _e={linear:e=>e,"ease-in":e=>e*e,"ease-out":e=>e*(2-e),"ease-in-out":e=>e<.5?2*e*e:-1+(4-2*e)*e,spring:vt(),bounce:Et(),elastic:St()};function Ar(e,r,t,n){let o=(i,a,c)=>((1+3*i-3*a)*c+3*a-6*i)*c*c+3*i*c;return i=>{if(i<=0||i>=1)return+(i>0);let a=i;for(let c=0;c<8;c++)a-=(o(e,t,a)-i)/((3*(1+3*e-3*t)*a+6*t-12*e)*a+3*e);if(!(a>=0&&a<=1&&Math.abs(o(e,t,a)-i)<1e-9))for(let c=0,m=0,f=1;c<30;c++)a=(m+f)/2,o(e,t,a)<i?m=a:f=a;return o(r,n,a)}}function xt(e){let r=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=r?r[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return[Ar(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var _t=new Set;function Le(e,r="linear"){if(typeof e=="function")return e;if(e==null)return _e[r];if({}.hasOwnProperty.call(_e,e))return _e[e];let t=xt(String(e));return t?t[0]:(!_t.has(e)&&_t.add(e)&&I(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),_e[r])}function Vt(e,r,t){return Math.min(t,Math.max(r,e))}function xe(e="top bottom"){let r=e.trim();if(/^\d+(\.\d+)?%$/.test(r))return{element:"top",viewport:r};let[t="top",n="bottom"]=r.split(/\s+/).filter(Boolean);return{element:t,viewport:n}}var Wt=(e,r)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:r;function zt(e,r,t,n){return e+t+r*Wt(n,0)}function Gt(e,r){return r*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:Wt(e,1))}function H(e,r,t,n){return t===r?0:Vt((e-r)/(t-r)*n,0,1)}function ke(e,r,t,n,o){let i=zt(e.top,e.height,r,n.element)-Gt(n.viewport,t),a=zt(e.top,e.height,r,o.element)-Gt(o.viewport,t);return{tStart:i,tEnd:a}}function Ke(e,r,t){let n=e.getBoundingClientRect(),o=t==="x"?n.width:n.height;return r?{top:t==="x"?n.left-r.getBoundingClientRect().left-r.clientLeft+r.scrollLeft:n.top-r.getBoundingClientRect().top-r.clientTop+r.scrollTop,height:o,scroll:0}:{top:t==="x"?n.left:n.top,height:o,scroll:t==="x"?window.scrollX:window.scrollY}}function et(e){let r=parseFloat(e.getAttribute("pathLength")??"");if(r>0)return r;let t=e.tagName.toLowerCase();if(t==="rect"){let n=parseFloat(e.getAttribute("width")??"0"),o=parseFloat(e.getAttribute("height")??"0");return 2*(n+o)}if(t==="circle"){let n=parseFloat(e.getAttribute("r")??"0");return 2*Math.PI*n}return e.getTotalLength()}function Ve(e){return`${e} ${e*2}`}function Bt(e){let r=/^#([a-f\d])([a-f\d])([a-f\d])$/i.exec(e);if(r)return[parseInt(r[1]+r[1],16),parseInt(r[2]+r[2],16),parseInt(r[3]+r[3],16)];let t=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(t)return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)];let n=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i.exec(e);return n?[parseInt(n[1]),parseInt(n[2]),parseInt(n[3])]:null}function tt(e,r,t){let n=Bt(e),o=Bt(r);return!n||!o?e:`rgb(${Math.round(n[0]+(o[0]-n[0])*t)},${Math.round(n[1]+(o[1]-n[1])*t)},${Math.round(n[2]+(o[2]-n[2])*t)})`}var rt={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:!1},reveal:{easing:"ease-out",fade:!0,speed:1.2,once:!0},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:!0,speed:.75},spring:{easing:"spring",speed:1.1}};var Pr="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",Lr="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",qt=33;function kr(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function Cr(e){let r=[];for(let t=0;t<qt;t++){let n=t/(qt-1);r.push(String(Math.round(e(n)*1e5)/1e5))}return`linear(${r.join(",")})`}function nt(e){switch(e){case"linear":return"linear";case"ease-in":return Pr;case"ease-out":return Lr;case"ease-in-out":return kr()?Cr(_e["ease-in-out"]):null;default:return xt(e)?.[1]??null}}var jt=Symbol.for("svg-scroll-draw.registry");function Yt(){let e=globalThis;return e[jt]||(e[jt]=new Map)}function Te(e,r){Yt().set(e,r)}function fe(e){Yt().delete(e)}function ot(e){if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let r=window.matchMedia("(prefers-reduced-motion: reduce)"),t=o=>e(!!o.matches);if(typeof r.addEventListener=="function")return r.addEventListener("change",t),()=>r.removeEventListener("change",t);let n=r;return n.addListener?.(t),()=>n.removeListener?.(t)}function ze(e,r){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return r(e,!0);let t=r(e,!1),n=ot(i=>{if(!i)return;n();let a=(t.getProgress?.()??0)>=1;t.destroy(),t=r(a?{...e,onComplete:void 0}:e,!0)}),o={};for(let i of Object.keys(t))o[i]=(...a)=>t[i]?.(...a);return o.destroy=()=>{n(),t.destroy()},o}var Ye,st=new Set,it=new WeakMap,Qe=new Map,Qt=e=>{let r=e.getBoundingClientRect();return r.width+" "+r.height};function $r(e){let r=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let n=t;n;n=n.previousElementSibling)r.add(n);return r}function Ut(e,r){if(typeof ResizeObserver>"u"||typeof document>"u")return()=>{};let t=()=>r();Ye??(Ye=new ResizeObserver(o=>{let i=!1;for(let{target:a}of o)it.get(a)!==Qt(a)&&(i=!0),it.set(a,"");i&&st.forEach(a=>a())})),st.add(t);let n=$r(e);return[document.body,document.documentElement].forEach(o=>o&&n.add(o)),n.forEach(o=>{it.has(o)||it.set(o,Qt(o)),Qe.set(o,(Qe.get(o)??0)+1),Ye.observe(o)}),()=>{st.delete(t)&&(n.forEach(o=>{let i=(Qe.get(o)??1)-1;if(i)return void Qe.set(o,i);Qe.delete(o),Ye?.unobserve(o)}),st.size||(Ye?.disconnect(),Ye=void 0))}}function Ce(e,r,t,n,o){let i,a=NaN,c,m,f=()=>{i=0,n(),!c&&!i&&(a=t())>0&&a<1&&(i=requestAnimationFrame(f))},h=()=>{!i&&!c&&t()!==a&&(i=requestAnimationFrame(f))},E=v=>{c=v,cancelAnimationFrame(i),i=a=NaN,h()},y=()=>{clearTimeout(m),o(),h()},R=()=>{clearTimeout(m),m=setTimeout(y,150)},oe=Ut(r,R),p=v=>{e[v]("scroll",h,{passive:!0}),window[v]("resize",R),window[v]("orientationchange",R)};return p("addEventListener"),h(),{hold:E,remeasure:y,off(){E(!0),p("removeEventListener"),oe(),clearTimeout(m)}}}var Dr=0;function Or(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function Xt(e,r){let t="";try{t=getComputedStyle(e).getPropertyValue(r).trim()}catch{}return t||(e.getAttribute(r)??"").trim()}var Jt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ir(e){if(!!1)return;let r=Xt(e,"stroke");if(!r||r==="none"){I("Element has no stroke \u2014 path will not be visible.",e);return}let t=(e.getAttribute("fill")??"").trim();t&&!Jt.has(t)&&!Jt.has(Xt(e,"fill"))&&I("Element has a fill \u2014 it may obscure the stroke animation.",e)}function Rr(e,r,t){let n=document.createElement("div");n.setAttribute("data-svg-scroll-draw-debug",""),n.style.cssText="position:fixed;pointer-events:none;z-index:9999;font-family:monospace;font-size:11px;top:0;left:0;right:0;bottom:0;";function o(){let i=t==="x"?window.scrollX:window.scrollY,a=e-i,c=r-i,m=t==="x";n.innerHTML=`
|
|
2
2
|
<div style="position:absolute;${m?`left:${a}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${a}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
-
<div style="position:absolute;${m?`left:${u}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${u}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",s,{passive:!0}),s(),{el:n,destroy(){window.removeEventListener("scroll",s),n.remove()}}}var Qt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Ut=/[MmLlHhVvCcSsQqTtAaZz]/g;function $r(e,t,r){if(!!1)return;let n=(e.match(Ut)??[]).join("").toUpperCase(),s=(t.match(Ut)??[]).join("").toUpperCase(),i=(e.match(Qt)??[]).length,a=(t.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.`,r);return}i!==a&&W(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,r)}function Dr(e,t,r){let n=(t.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),s=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),u=n[s++]??a;return String(+(a+(u-a)*r).toFixed(4))})}function it(e,t={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:_e(t,(r,n)=>Or(e,r,n))}function Or(e,t,r){let{preset:n,...s}=t,i=n?{...et[n],...s}:s,{selector:a="path, polyline, line, polygon, rect, circle",speed:u=1,fade:m=!1,easing:d="linear",trigger:h={},stagger:E=0,direction:y="forward",once:I=!1,debug:se=!1,axis:f="y",scrollContainer:v,autoReverse:b=!1,delay:x=0,strokeColor:w,strokeWidth:L,fillOpacity:U,waypoints:z,velocityScale:N=!1,threshold:K=0,rootMargin:Ve="0px",repeat:le=0,repeatDelay:de=0,morphTo:B,clip:ee,autoplay:Ae=!1,duration:P=1e3,native:H=!0,onProgress:$e,onStart:X,onComplete:te,onEnter:ge,onLeave:Re,onEnterBack:ye,onLeaveBack:me}=i,Z=ee===!0?"left":typeof ee=="string"?ee:!1,q=typeof d=="function"?d:oe[d]??oe.linear,Ne=Te(h.start||"top bottom"),Ge=Te(h.end||"bottom top"),F=typeof v=="string"?document.querySelector(v):v??null,he=Array.isArray(w)?w[0]:null,be=Array.isArray(w)?w[1]:typeof w=="string"?w: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 l=Z?[]:Array.from(e.querySelectorAll(a)),p=[],_=[],M=0,k=0,O=E,C=0,Le=0,V=!1,Ee=!1,Se=0,ut=-1,Ye=[],Qe=-1,ie=!1,fe=0,De=0,Oe,mt=!1,ft=null;function xt(){ft?.destroy(),ft=null}let Ie=new Set,Tt=NaN,He=!0,Ue=-1,Mt=performance.now(),Fe=NaN;function Xe(){return F?f==="x"?F.scrollLeft:F.scrollTop:f==="x"?window.scrollX:window.scrollY}function At(){return F?f==="x"?F.clientWidth:F.clientHeight:f==="x"?window.innerWidth:window.innerHeight}function Pt(){let o=Ze(e,F,f);return ke(o,o.scroll,At(),Ne,Ge)}function cr(){let o=k-M,c=l.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);C=M+Math.min(0,G,re,G+re),Le=M+Math.max(0,G,re,G+re)}function Lt(){({tStart:M,tEnd:k}=Pt()),cr(),se&&!1&&(xt(),ft=Cr(M,k,f))}function pt(o,c=Pt){Me(e,{type:"draw",getProgress:()=>o.getProgress(),getTrigger:c});let g=o.destroy;return o.destroy=()=>{g.call(o),pe(e)},o}function kt(o,c){return I&&!b?Math.max(ut,q(Ye[o]=Math.max(Ye[o]??0,c))):q(c)}function ur(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}l.forEach((g,T)=>dt(g,T,o,c))}function dt(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=Ke(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",Dr(_[c],B,g))}function gt(){if(e.style.setProperty("--scroll-draw-progress","0"),Z){e.style.clipPath=ve(y==="reverse"?1:0);return}l.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 We(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(l.forEach((o,c)=>{kr(o);let g=o.tagName.toLowerCase()==="path";g?_.push(o.getAttribute("d")??""):_.push(""),We(o,c);let T=p[c];B&&(g?$r(_[_.length-1],B,o):W(`morphTo only applies to <path> elements \u2014 ignored on <${o.tagName}>.`,o)),r?(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}`))}),r)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 Ct=typeof d=="string"?tt(d):null;function mr(){return!(H===!1||Ae||se&&!1||!Lr()||!l.length||!Ct||Z||f!=="y"||F||u!==1||E!==0||I||b||N!==!1||B||z||le||x>0||$e||X||te||ge||Re||ye||me||w!=null||L!=null||U!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function fr(){let o=++Pr,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};`,$=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,$+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${c}{from{${j}}to{${$}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${c}{animation-name:${c};animation-duration:auto;animation-timing-function:${Ct};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function J(S,A){S.style.setProperty("--ssd-len",String(p[A])),S.style.strokeDasharray=`${p[A]}`,S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(c)}l.forEach(J);let Y=!1,ne=-1;function ae(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=ke({top:S.top,height:S.height},Xe(),At(),Ne,Ge);return q(R(Xe(),A,Q,u))}return{destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(c),S.style.removeProperty("--ssd-len"),S.style.animationPlayState=""}),D.remove()},replay(){Y=!1,ne=-1,l.forEach(J)},pause(){Y=!0,l.forEach(S=>{S.style.animationPlayState="paused"})},resume(){Y&&(Y=!1,l.forEach(S=>{S.style.animationPlayState="running"}))},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=!0,l.forEach((Q,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(){l.forEach((S,A)=>{We(S,A),S.style.setProperty("--ssd-len",String(p[A]))})}}}if(mr())return pt(fr());function pr(){let o=Math.max(1,P),c=Z?o:o*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=!1;function re(ne){let ae=!0,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),$e?.(Q),A<1&&(ae=!1)}else{l.forEach((Q,xe)=>{let gr=xe*E*o,Rt=Math.min(1,Math.max(0,(ne-gr)/o));dt(Q,xe,q(Rt),y),Rt<1&&(ae=!1)});let A=q(S);fe=A,$e?.(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=!0,X?.());let S=re(ae);if(S&&!V){V=!0,re(c),te?.(),De<(le==="infinite"?1/0:le??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),Ee=!1,V=!1,Ie.clear(),gt(),Se=requestAnimationFrame(j)},de));return}S||(Se=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Se),clearTimeout(Oe),g=performance.now(),T=0,ie=!1,Ee=!1,V=!1,De=0,G=!0,fe=0,Ie.clear(),gt(),Se=requestAnimationFrame(j)}let D=new IntersectionObserver(ne=>{ne.forEach(ae=>{ae.isIntersecting&&!(I&&V)?$():!ae.isIntersecting&&!I&&!V&&(cancelAnimationFrame(Se),clearTimeout(Oe),G=!1)})},{root:F??null,threshold:K,rootMargin:Ve}),J;function Y(){clearTimeout(J),J=setTimeout(()=>l.forEach(We),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(J)},replay(){De=0,$()},pause(){ie||!G||(ie=!0,T=performance.now()-g,cancelAnimationFrame(Se))},resume(){ie&&(ie=!1,G=!0,g=performance.now()-T,Se=requestAnimationFrame(j))},seek(ne){let ae=Math.min(1,Math.max(0,ne));fe=ae,ie=!0,T=ae*c,g=performance.now()-T,cancelAnimationFrame(Se),re(T)},getProgress(){return fe},refresh(){clearTimeout(J),l.forEach(We)}}}if(Ae)return pt(pr());Lt();let $t=()=>R(Xe(),C,Le,1);function Dt(){V=!0,te?.(),De<(le==="infinite"?1/0:le)&&(De++,Oe=setTimeout(()=>{mt=!0},de))}function Ot(){ut=-1,Ye=[],Ee=!1,V=!1,mt=!1,Ie.clear(),gt(),He=!0}function dr(){let o=performance.now(),c=Xe();if(mt&&$t()%1&&Ot(),!He&&N===!1&&c===Tt)return;He=!1,Tt=c;let g=u;if(N!==!1){let $=o-Mt,D=$>0?Math.abs(c-(Ue<0?c:Ue))/$:0;g=u*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Ue=c,Mt=o;let T=b?Qe===-1||c>=Qe?"forward":"reverse":y;Qe=c;let G=k-M,re=!0,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 $=kt(0,R(c,M,k,g));fe=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=ve(D),$e?.($),!Ee&&R(c,M,k,g)>0&&(Ee=!0,X?.()),$>=1&&!V?Dt():$<1&&!I&&(V=!1);return}if(l.forEach(($,D)=>{let J=D*O*G,Y=kt(D,R(c,M+J,k+J,g));dt($,D,Y,T),D===0&&(fe=Y,$e?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=!1)}),z){let $=q(R(c,M,k,g));for(let D in z){let J=parseFloat(D);$>=J&&!Ie.has(J)&&(Ie.add(J),z[D]?.())}}!Ee&&R(c,M,k,g)>0&&(Ee=!0,X?.()),re&&!V?Dt():!re&&!I&&(V=!1)}let ze=Ce(F??window,[e],$t,dr,()=>{let o=p.join();l.forEach(We),Lt(),He=!0,p.join()!==o&&Be()}),yt=x>0;function Be(){ze.hold(ie||yt)}let It;return yt&&(It=setTimeout(()=>{yt=!1,Be()},x)),Be(),pt({destroy(){clearTimeout(Oe),clearTimeout(It),ze.off(),xt()},replay(){Ot(),Qe=-1,Ue=-1,De=0,ie=!1,fe=0,clearTimeout(Oe),Be()},pause(){ie=!0,ze.hold(!0)},resume(){ie&&(ie=!1,He=!0,Be())},seek(o){let c=Math.min(1,Math.max(0,o));fe=c,ut=c,Ye=[],ie=!0,ze.hold(!0),ur(c,y),He=!0},getProgress(){return fe},refresh:ze.remeasure},()=>({tStart:M,tEnd:k}))}function Xt(e,t){let r={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return r;let n=typeof e=="string"?document.querySelector(e):e;return n?it(n,t):(W("Container not found:",e),r)}function Ir(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function Zt(e){let t=[],r=/([\w]+)\(([^)]*)\)/g,n;for(;(n=r.exec(e))!==null;){let s=[],i=[],a=n[2].trim();if(a)for(let u of a.split(/[\s,]+/)){let m=u.match(/^([-+]?[\d.eE]+)(.*)$/);s.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"")}t.push({fn:n[1],nums:s,units:i})}return t}function Rr(e,t,r){let n=Zt(e),s=Zt(t);return n.length===0||n.length!==s.length?r<1?e:t:n.map((i,a)=>{let u=s[a];return i.fn!==u.fn||i.nums.length!==u.nums.length?r<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)*r}${i.units[d]}`).join(", ")})`}).join(" ")}function Jt(e,t,r){if(typeof e=="number"&&typeof t=="number")return String(e+(t-e)*r);let n=String(e),s=String(t);if(Ir(n))return Ke(n,s,r);if(n.includes("("))return Rr(n,s,r);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=s.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let u=parseFloat(i[1]),m=parseFloat(a[1]);return`${u+(m-u)*r}${i[2]||a[2]}`}return r<1?n:s}function Nr(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}var Hr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Fr=0,Kt="--scroll-draw-progress";function _r(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var tr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Et(e,t){return typeof window>"u"?tr:t.respectReducedMotion===!1?er(e,t,!1):_e(t,(r,n)=>er(e,r,n))}function er(e,t,r){let{props:n,trigger:s={},easing:i="ease-out",speed:a=1,once:u=!1,axis:m="y",scrollContainer:d,native:h=!0,velocityScale:E=!1,triggerElement:y,onProgress:I,onComplete:se,onEnter:f,onLeave:v,onEnterBack:b,onLeaveBack:x}=t,w=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,K=Object.entries(n).map(([l,p])=>({prop:Nr(l),from:Array.isArray(p)?p[0]:"",to:Array.isArray(p)?p[1]:p}));function Ve(){let l=window.getComputedStyle(e);for(let p of K)p.from===""&&(p.from=l.getPropertyValue(p.prop).trim()||"0")}function le(){for(let l of K)e.style.setProperty(l.prop,String(l.to))}let de=new Map;for(let l of[...K.map(p=>p.prop),Kt])de.set(l,e.style.getPropertyValue(l));function B(){for(let[l,p]of de)p?e.style.setProperty(l,p):e.style.removeProperty(l)}if(r)return le(),se?.(),{...tr,destroy:B,getProgress:()=>1};Ve();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(!h||!_r()||!P||m!=="y"||N||z!==e||u||a!==1||I||se||f||v||b||x||E!==!1||(s.start||"top bottom").trim()!=="top bottom"||(s.end||"bottom top").trim()!=="bottom top")return!1;for(let l of K)if(!Hr.has(l.prop))return!1;return!0}function $e(){let l=`ssd-a-${++Fr}`,p=K.map(C=>`${C.prop}:${C.from}`).join(";"),_=K.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${p}}to{${_}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},ee(),Ae(),L,U)};Me(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:k});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),pe(e)},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Le=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let V of K)e.style.setProperty(V.prop,Jt(V.from,V.to,Le))},getProgress(){let{tStart:C,tEnd:Le}=k();return w(R(ee(),C,Le,a))}};return O}if(H())return $e();let X=0,te=0,ge=!1,Re=-1,ye=0,me=0,Z=!1,q=NaN,Ne=-1,Ge=0,F=z===e?K:[],he=!1;function be(){let l=e.style,p=F.map(O=>l.getPropertyValue(O.prop)),_=l.transition;F.length&&(l.transition="none"),F.forEach(O=>l.setProperty(O.prop,de.get(O.prop)??""));let M=Ze(z,N,m);F.forEach((O,C)=>l.setProperty(O.prop,p[C])),F.length&&(e.offsetWidth,l.transition=_);let k=ke(M,M.scroll,Ae(),L,U);he&&Math.abs(k.tStart-X)<1&&Math.abs(k.tEnd-te)<1||(he=!0,X=k.tStart,te=k.tEnd)}function ce(l){e.style.setProperty(Kt,String(l));for(let p of K)e.style.setProperty(p.prop,Jt(p.from,p.to,l));I?.(l)}function Pe(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&f?.(),q<1&&l>=1&&v?.(),q>=1&&l<1&&b?.(),q>0&&l<=0&&x?.(),q=l}function we(){if(ge)return;let l=performance.now(),p=ee(),_=a;if(E!==!1){let C=l-Ge,Le=C>0?Math.abs(p-(Ne<0?p:Ne))/C:0;_=a*Math.max(.2,1+Le*(typeof E=="number"?E:1)*.04)}Ne=p,Ge=l;let M=te===X?0:(p-X)/(te-X);Pe(M);let k=R(p,X,te,_),O=u?Math.max(Re,w(ye=Math.max(ye,k))):w(k);me=O,ce(O),O>=1&&!Z?(Z=!0,se?.()):O<1&&!u&&(Z=!1)}let ue=Ce(N??window,[z],()=>R(ee(),X,te,Math.min(a,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,a),me=w(ye),ce(me),Me(e,{type:"animate",getProgress:()=>me,getTrigger:()=>({tStart:X,tEnd:te})});function ve(){ge=!0,ue.hold(!0)}return{destroy(){ge=!0,ue.off(),B(),pe(e)},replay(){Re=-1,ye=0,Z=!1,me=0,ge=!1,ce(0),ue.hold(!1)},pause:ve,resume(){ge&&(ge=!1,ue.hold(!1))},seek(l){let p=Math.min(1,Math.max(0,l));me=p,Re=p,ye=0,ve(),ce(p)},getProgress(){return me},refresh:ue.remeasure}}var at={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function rr(e,t){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;return r?Et(r,t):(W("scrollAnimate: element not found:",e),at)}function nr(e,t={}){if(typeof window>"u")return at;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return W("scrollParallax: element not found:",e),at;let{speed:n=.3,axis:s="y",easing:i="linear",trigger:a,onProgress:u}=t,m=-n*100,d=r.style,h=!!r.ownerSVGElement,E=d.getPropertyValue("transform-box");h&&d.setProperty("transform-box","fill-box");let y=Et(r,{props:s==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:u});return h?{...y,destroy(){y.destroy(),d.setProperty("transform-box",E)}}:y}var St={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function or(e,t){if(typeof window>"u")return St;let r=typeof e=="string"?document.querySelector(e):e;return r?_e(t,(n,s)=>Vr(r,n,s)):(W("scrollCounter: element not found:",e),St)}function Vr(e,t,r){let{from:n=0,to:s,format:i,easing:a="ease-out",trigger:u={},once:m=!0,decimals:d,onComplete:h}=t,E=d!==void 0?P=>P.toFixed(d):i??(P=>String(Math.round(P))),y=typeof a=="function"?a:oe[a]??oe["ease-out"],I=Te(u.start||"top 80%"),se=Te(u.end||"top 20%");if(r)return e.textContent=E(s),h?.(),{...St,getProgress:()=>1};let f=0,v=0,b=!1,x=-1,w=0,L=0,U=!1,z=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),H=ke({top:P.top,height:P.height},z(),N(),I,se);b&&Math.abs(H.tStart-f)<1&&Math.abs(H.tEnd-v)<1||(b=!0,f=H.tStart,v=H.tEnd)}let Ve=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,v,1);function B(){let P=de(),H=m?Math.max(x,y(w=Math.max(w,P))):y(P);L=H,le(H),H>=1&&!U?(U=!0,h?.()):H<1&&!m&&(U=!1)}K();{w=R(z(),f,v,1);let P=y(w);L=P,le(P)}let ee=Ce(window,[e],de,B,K);Me(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:f,tEnd:v})});let Ae=()=>ee.hold(!1);return{destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ve),pe(e)},replay(){x=-1,w=0,U=!1,L=0,le(0),Ae()},pause:()=>ee.hold(!0),resume:Ae,seek(P){let H=Math.min(1,Math.max(0,P));L=H,x=H,w=0,ee.hold(!0),le(H)},getProgress(){return L}}}var sr="http://www.w3.org/2000/svg",Gr="cinematic-photo",lr=e=>e<0?0:e>1?1:e;function lt(e){let t=parseFloat(e);return Number.isFinite(t)?lr(t/100):0}function ir(e){return oe[e]??oe.linear}var ar=e=>({destroy(){},getProgress:()=>e}),ct=class{constructor(t){if(typeof document>"u"){this.mount=null;return}this.mount=typeof t.wrapper=="string"?document.querySelector(t.wrapper):t.wrapper,this.mount||W("Cinematic: wrapper not found:",t.wrapper)}loadStory(t){let r=this.mount;if(typeof window>"u"||!r)return ar(0);r.style.position="relative",r.style.height=t.totalHeight,r.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;",r.appendChild(n);let s=[];for(let f of t.scenes){if(f.background){let b=document.createElement("img");b.id=Gr,b.src=f.background,b.alt="",b.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(b)}let v=f.animations.filter(b=>b.type==="draw");if(v.length){let b=document.createElementNS(sr,"svg");b.setAttribute("viewBox",`0 0 ${t.canvas.width} ${t.canvas.height}`),b.setAttribute("preserveAspectRatio","xMidYMid meet"),b.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(b);for(let x of v){let w=document.createElementNS(sr,"path");w.id=x.target.replace(/^#/,""),w.setAttribute("d",x.d),w.setAttribute("fill","none"),w.setAttribute("stroke",x.stroke),w.setAttribute("stroke-width",String(x.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let L=x.length||w.getTotalLength?.()||0;w.style.strokeDasharray=String(L),w.style.strokeDashoffset=String(L),b.appendChild(w),s.push({kind:"draw",el:w,start:lt(x.start),end:lt(x.end),ease:ir(x.easing),length:L})}}for(let b of f.animations){if(b.type!=="fade")continue;let x=n.querySelector(b.target)??document.querySelector(b.target);x&&(x.style.opacity=String(b.from),s.push({kind:"fade",el:x,start:lt(b.start),end:lt(b.end),ease:ir("ease-in-out"),from:b.from,to:b.to}))}}let i=0,a=null;for(let f=r.parentElement;f?.parentElement;f=f.parentElement)if(/[ao]/.test(getComputedStyle(f).overflowY)&&f.scrollHeight>f.clientHeight&&(f!==document.body||/[aoh]/.test(getComputedStyle(f.parentElement).overflowY))){a=f;break}let u=0,m=0,d=()=>{let f=r.getBoundingClientRect().top;u=a?f-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:f+window.scrollY,m=u+Math.max(0,r.offsetHeight-(a?a.clientHeight:window.innerHeight))},h=()=>{let f=a?a.scrollTop:window.scrollY;return m<=u?f>=u?1:0:R(f,u,m,1)},E=f=>{for(let v of s){let b=v.end-v.start,x=b<=0?f>=v.end?1:0:lr((f-v.start)/b),w=v.ease(x);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),ar(1);let y=()=>{i=h(),E(i)};d(),y();let I=Ce(a||window,[r],h,y,d);Me(r,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:u,tEnd:m})});let se=rt(f=>{f&&(se(),I.off(),pe(r),i=1,E(1))});return{destroy(){se(),I.off(),pe(r)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class t extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let s=JSON.stringify(e.map(E=>this.getAttribute(E)));if(this.instance&&s===this.key)return;this.instance?.destroy(),this.key=s;let i={},a=this.getAttribute("speed"),u=this.getAttribute("easing"),m=this.getAttribute("stagger"),d=this.getAttribute("direction"),h=this.getAttribute("selector");a&&(i.speed=parseFloat(a)),u&&(i.easing=u),m&&(i.stagger=parseFloat(m)),d&&(i.direction=d),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=it(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}t.observedAttributes=e,customElements.define("scroll-draw",t)}return Er(Wr);})();
|
|
3
|
+
<div style="position:absolute;${m?`left:${c}px;top:0;bottom:0;border-left:2px dashed #ef4444;`:`top:${c}px;left:0;right:0;border-top:2px dashed #ef4444;`}padding:2px 6px;color:#ef4444;background:rgba(0,0,0,.6)">\u25A0 end</div>`}return document.body.appendChild(n),window.addEventListener("scroll",o,{passive:!0}),o(),{el:n,destroy(){window.removeEventListener("scroll",o),n.remove()}}}var Zt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Kt=/[MmLlHhVvCcSsQqTtAaZz]/g;function Hr(e,r,t){if(!!1)return;let n=(e.match(Kt)??[]).join("").toUpperCase(),o=(r.match(Kt)??[]).join("").toUpperCase(),i=(e.match(Zt)??[]).length,a=(r.match(Zt)??[]).length;if(n!==o){I(`morphTo: command sequence differs (${n||"\u2205"} \u2192 ${o||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,t);return}i!==a&&I(`morphTo: coordinate count differs (${i} \u2192 ${a}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,t)}function Nr(e,r,t){let n=(r.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),o=0;return e.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,i=>{let a=parseFloat(i),c=n[o++]??a;return String(+(a+(c-a)*t).toFixed(4))})}function lt(e,r={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:ze(r,(t,n)=>Fr(e,t,n))}function Fr(e,r,t){let{preset:n,...o}=r,i=n?{...rt[n],...o}:o,{selector:a="path, polyline, line, polygon, rect, circle",speed:c=1,fade:m=!1,easing:f="linear",trigger:h={},stagger:E=0,direction:y="forward",once:R=!1,debug:oe=!1,axis:p="y",scrollContainer:v,autoReverse:b=!1,delay:x=0,strokeColor:w,strokeWidth:L,fillOpacity:U,waypoints:W,velocityScale:N=!1,threshold:K=0,rootMargin:Ge="0px",repeat:ae=0,repeatDelay:pe=0,morphTo:B,clip:ee,autoplay:Me=!1,duration:P=1e3,native:F=!0,onProgress:$e,onStart:X,onComplete:te,onEnter:de,onLeave:Re,onEnterBack:ge,onLeaveBack:ue}=i,J=ee===!0?"left":typeof ee=="string"?ee:!1,q=Le(f),He=xe(h.start||"top bottom"),We=xe(h.end||"bottom top"),_=typeof v=="string"?document.querySelector(v):v??null,ye=Array.isArray(w)?w[0]:null,he=Array.isArray(w)?w[1]:typeof w=="string"?w:null,le=Array.isArray(L)?L[0]:null,Ae=Array.isArray(L)?L[1]:typeof L=="number"?L:null,be=Array.isArray(U)?U[0]:null,ce=Array.isArray(U)?U[1]:typeof U=="number"?U:null;function we(s){let u=s*100;switch(J){case"right":return`inset(0 0 0 ${100-u}%)`;case"top":return`inset(0 0 ${100-u}% 0)`;case"bottom":return`inset(${100-u}% 0 0 0)`;case"center":return`circle(${s*150}% at 50% 50%)`;default:return`inset(0 ${100-u}% 0 0)`}}let l=J?[]:Array.from(e.querySelectorAll(a)),d=[],V=[],M=0,k=0,O=E,C=0,Pe=0,z=!1,ve=!1,Ee=0,ft=-1,Ue=[],Xe=-1,se=!1,me=0,De=0,Oe,pt=!1,dt=null;function At(){dt?.destroy(),dt=null}let Ie=new Set,Pt=NaN,Ne=!0,Je=-1,Lt=performance.now(),Fe=NaN;function Ze(){return _?p==="x"?_.scrollLeft:_.scrollTop:p==="x"?window.scrollX:window.scrollY}function kt(){return _?p==="x"?_.clientWidth:_.clientHeight:p==="x"?window.innerWidth:window.innerHeight}function Ct(){let s=Ke(e,_,p);return ke(s,s.scroll,kt(),He,We)}function pr(){let s=k-M,u=l.length-1,g=_??document.documentElement,T=p==="x"?"Width":"Height";if(O=E,E>0&&u>0&&s>0){let j=g[`scroll${T}`]-g[`client${T}`]-1-M-s/c;j>=0&&(O=Math.min(E,j/(u*s)))}let G=Math.max(0,u)*O*s,re=s/Math.min(c,1);C=M+Math.min(0,G,re,G+re),Pe=M+Math.max(0,G,re,G+re)}function $t(){({tStart:M,tEnd:k}=Ct()),pr(),oe&&!1&&(At(),dt=Rr(M,k,p))}function gt(s,u=Ct){Te(e,{type:"draw",getProgress:()=>s.getProgress(),getTrigger:u});let g=s.destroy;return s.destroy=()=>{g.call(s),fe(e)},s}function Dt(s,u){return R&&!b?Math.max(ft,q(Ue[s]=Math.max(Ue[s]??0,u))):q(u)}function dr(s,u){if(e.style.setProperty("--scroll-draw-progress",String(s)),J){let g=u==="reverse"?1-s:s;e.style.clipPath=we(g);return}l.forEach((g,T)=>yt(g,T,s,u))}function yt(s,u,g,T){s.style.strokeDashoffset=T==="reverse"?`${d[u]*g}`:`${d[u]*(1-g)}`,m&&(s.style.opacity=T==="reverse"?`${1-g}`:`${g}`),ye&&he?s.style.stroke=tt(ye,he,g):he&&(s.style.stroke=he),le!==null&&Ae!==null?s.style.strokeWidth=`${le+(Ae-le)*g}`:Ae!==null&&(s.style.strokeWidth=`${Ae}`),be!==null&&ce!==null?s.style.fillOpacity=`${be+(ce-be)*g}`:ce!==null&&(s.style.fillOpacity=`${ce}`),B&&s.tagName.toLowerCase()==="path"&&V[u]&&s.setAttribute("d",Nr(V[u],B,g))}function ht(){if(e.style.setProperty("--scroll-draw-progress","0"),J){e.style.clipPath=we(y==="reverse"?1:0);return}l.forEach((s,u)=>{s.style.strokeDasharray=Ve(d[u]),s.style.strokeDashoffset=y==="reverse"?"0":`${d[u]}`,m?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ye&&(s.style.stroke=ye),le!==null&&(s.style.strokeWidth=`${le}`),be!==null&&(s.style.fillOpacity=`${be}`),B&&s.tagName.toLowerCase()==="path"&&V[u]&&s.setAttribute("d",V[u])})}function Be(s,u){let g=s.getAttribute("d"),T=et(s);if(B&&V[u]){s.setAttribute("d",B);let G=et(s);s.setAttribute("d",V[u]),T=Math.max(et(s),G),s.setAttribute("d",g)}d[u]=T,s.style.strokeDasharray=Ve(T)}if(l.forEach((s,u)=>{Ir(s);let g=s.tagName.toLowerCase()==="path";g?V.push(s.getAttribute("d")??""):V.push(""),Be(s,u);let T=d[u];B&&(g?Hr(V[V.length-1],B,s):I(`morphTo only applies to <path> elements \u2014 ignored on <${s.tagName}>.`,s)),t?(s.style.strokeDashoffset=y==="reverse"?`${T}`:"0",m&&(s.style.opacity="1"),he&&(s.style.stroke=he),Ae!==null&&(s.style.strokeWidth=`${Ae}`),ce!==null&&(s.style.fillOpacity=`${ce}`),B&&s.tagName.toLowerCase()==="path"&&s.setAttribute("d",B)):(s.style.strokeDashoffset=y==="reverse"?"0":`${T}`,m?s.style.opacity=y==="reverse"?"1":"0":s.style.opacity="",ye&&(s.style.stroke=ye),le!==null&&(s.style.strokeWidth=`${le}`),be!==null&&(s.style.fillOpacity=`${be}`))}),t)return J&&(e.style.clipPath=we(1)),te?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};J&&(e.style.clipPath=we(y==="reverse"?1:0));let Ot=typeof f=="string"?nt(f):null;function gr(){return!(F===!1||Me||oe&&!1||!Or()||!l.length||!Ot||J||p!=="y"||_||c!==1||E!==0||R||b||N!==!1||B||W||ae||x>0||$e||X||te||de||Re||ge||ue||w!=null||L!=null||U!=null||(h.start||"top bottom").trim()!=="top bottom"||(h.end||"bottom top").trim()!=="bottom top")}function yr(){let s=++Dr,u=`svg-scroll-draw-${s}`,g=`svg-scroll-draw-host-${s}`,T=`--svg-scroll-draw-${s}`,G=y==="reverse"?"0":"var(--ssd-len)",re=y==="reverse"?"var(--ssd-len)":"0",j=`stroke-dashoffset:${G};`,$=`stroke-dashoffset:${re};`;m&&(j+=`opacity:${y==="reverse"?1:0};`,$+=`opacity:${y==="reverse"?0:1};`);let D=document.createElement("style");D.setAttribute("data-svg-scroll-draw",""),D.textContent=`@keyframes ${u}{from{${j}}to{${$}}}.${g}{view-timeline-name:${T};view-timeline-axis:block;}.${u}{animation-name:${u};animation-duration:auto;animation-timing-function:${Ot};animation-fill-mode:both;animation-timeline:${T};animation-range:cover 0% cover 100%;}`,document.head.appendChild(D),e.classList.add(g);function Z(S,A){S.style.setProperty("--ssd-len",String(d[A])),S.style.strokeDasharray=Ve(d[A]),S.style.strokeDashoffset="",S.style.opacity="",S.style.animationPlayState="",S.classList.add(u)}l.forEach(Z);let Y=!1,ne=-1;function ie(){if(ne>=0)return ne;let S=e.getBoundingClientRect(),{tStart:A,tEnd:Q}=ke({top:S.top,height:S.height},Ze(),kt(),He,We);return q(H(Ze(),A,Q,c))}return{destroy(){e.classList.remove(g),l.forEach(S=>{S.classList.remove(u),S.style.removeProperty("--ssd-len"),S.style.animationPlayState=""}),D.remove()},replay(){Y=!1,ne=-1,l.forEach(Z)},pause(){Y=!0,l.forEach(S=>{S.style.animationPlayState="paused"})},resume(){Y&&(Y=!1,l.forEach(S=>{S.style.animationPlayState="running"}))},seek(S){let A=Math.min(1,Math.max(0,S));ne=A,Y=!0,l.forEach((Q,Se)=>{Q.classList.remove(u),Q.style.strokeDashoffset=y==="reverse"?`${d[Se]*A}`:`${d[Se]*(1-A)}`,m&&(Q.style.opacity=y==="reverse"?`${1-A}`:`${A}`)})},getProgress(){return ie()},refresh(){l.forEach((S,A)=>{Be(S,A),S.style.setProperty("--ssd-len",String(d[A]))})}}}if(gr())return gt(yr());function hr(){let s=Math.max(1,P),u=J?s:s*(1+Math.max(0,l.length-1)*E),g=0,T=0,G=!1;function re(ne){let ie=!0,S=Math.min(1,Math.max(0,ne/u));if(J){let A=Math.min(1,Math.max(0,ne/s)),Q=q(A);me=Q,e.style.setProperty("--scroll-draw-progress",String(Q)),e.style.clipPath=we(y==="reverse"?1-Q:Q),$e?.(Q),A<1&&(ie=!1)}else{l.forEach((Q,Se)=>{let wr=Se*E*s,Ft=Math.min(1,Math.max(0,(ne-wr)/s));yt(Q,Se,q(Ft),y),Ft<1&&(ie=!1)});let A=q(S);me=A,$e?.(A),e.style.setProperty("--scroll-draw-progress",String(A))}if(W){let A=q(S);for(let Q in W){let Se=parseFloat(Q);A>=Se&&!Ie.has(Se)&&(Ie.add(Se),W[Q]?.())}}return ie}function j(ne){if(se)return;let ie=ne-g;ve||(ve=!0,X?.());let S=re(ie);if(S&&!z){z=!0,re(u),te?.(),De<(ae==="infinite"?1/0:ae??0)&&(De++,Oe=setTimeout(()=>{g=performance.now(),ve=!1,z=!1,Ie.clear(),ht(),Ee=requestAnimationFrame(j)},pe));return}S||(Ee=requestAnimationFrame(j))}function $(){cancelAnimationFrame(Ee),clearTimeout(Oe),g=performance.now(),T=0,se=!1,ve=!1,z=!1,De=0,G=!0,me=0,Ie.clear(),ht(),Ee=requestAnimationFrame(j)}let D=new IntersectionObserver(ne=>{ne.forEach(ie=>{ie.isIntersecting&&!(R&&z)?$():!ie.isIntersecting&&!R&&!z&&(cancelAnimationFrame(Ee),clearTimeout(Oe),G=!1)})},{root:_??null,threshold:K,rootMargin:Ge}),Z;function Y(){clearTimeout(Z),Z=setTimeout(()=>l.forEach(Be),150)}return window.addEventListener("resize",Y),window.addEventListener("orientationchange",Y),x>0?setTimeout(()=>D.observe(e),x):D.observe(e),{destroy(){cancelAnimationFrame(Ee),clearTimeout(Oe),D.disconnect(),window.removeEventListener("resize",Y),window.removeEventListener("orientationchange",Y),clearTimeout(Z)},replay(){De=0,$()},pause(){se||!G||(se=!0,T=performance.now()-g,cancelAnimationFrame(Ee))},resume(){se&&(se=!1,G=!0,g=performance.now()-T,Ee=requestAnimationFrame(j))},seek(ne){let ie=Math.min(1,Math.max(0,ne));me=ie,se=!0,T=ie*u,g=performance.now()-T,cancelAnimationFrame(Ee),re(T)},getProgress(){return me},refresh(){clearTimeout(Z),l.forEach(Be)}}}if(Me)return gt(hr());$t();let It=()=>H(Ze(),C,Pe,1);function Rt(){z=!0,te?.(),De<(ae==="infinite"?1/0:ae)&&(De++,Oe=setTimeout(()=>{pt=!0},pe))}function Ht(){ft=-1,Ue=[],ve=!1,z=!1,pt=!1,Ie.clear(),ht(),Ne=!0}function br(){let s=performance.now(),u=Ze();if(pt&&It()%1&&Ht(),!Ne&&N===!1&&u===Pt)return;Ne=!1,Pt=u;let g=c;if(N!==!1){let $=s-Lt,D=$>0?Math.abs(u-(Je<0?u:Je))/$:0;g=c*Math.max(.2,1+D*(typeof N=="number"?N:1)*.04)}Je=u,Lt=s;let T=b?Xe===-1||u>=Xe?"forward":"reverse":y;Xe=u;let G=k-M,re=!0,j=G===0?0:(u-M)/G;if(isNaN(Fe)||(Fe<=0&&j>0&&de?.(),Fe<1&&j>=1&&Re?.(),Fe>=1&&j<1&&ge?.(),Fe>0&&j<=0&&ue?.()),Fe=j,J){let $=Dt(0,H(u,M,k,g));me=$,e.style.setProperty("--scroll-draw-progress",String($));let D=T==="reverse"?1-$:$;e.style.clipPath=we(D),$e?.($),!ve&&H(u,M,k,g)>0&&(ve=!0,X?.()),$>=1&&!z?Rt():$<1&&!R&&(z=!1);return}if(l.forEach(($,D)=>{let Z=D*O*G,Y=Dt(D,H(u,M+Z,k+Z,g));yt($,D,Y,T),D===0&&(me=Y,$e?.(Y),e.style.setProperty("--scroll-draw-progress",String(Y))),Y<1&&(re=!1)}),W){let $=q(H(u,M,k,g));for(let D in W){let Z=parseFloat(D);$>=Z&&!Ie.has(Z)&&(Ie.add(Z),W[D]?.())}}!ve&&H(u,M,k,g)>0&&(ve=!0,X?.()),re&&!z?Rt():!re&&!R&&(z=!1)}let qe=Ce(_??window,[e],It,br,()=>{let s=d.join();l.forEach(Be),$t(),Ne=!0,d.join()!==s&&je()}),bt=x>0;function je(){qe.hold(se||bt)}let Nt;return bt&&(Nt=setTimeout(()=>{bt=!1,je()},x)),je(),gt({destroy(){clearTimeout(Oe),clearTimeout(Nt),qe.off(),At()},replay(){Ht(),Xe=-1,Je=-1,De=0,se=!1,me=0,clearTimeout(Oe),je()},pause(){se=!0,qe.hold(!0)},resume(){se&&(se=!1,Ne=!0,je())},seek(s){let u=Math.min(1,Math.max(0,s));me=u,ft=u,Ue=[],se=!0,qe.hold(!0),dr(u,y),Ne=!0},getProgress(){return me},refresh:qe.remeasure},()=>({tStart:M,tEnd:k}))}function er(e,r){let t={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};if(typeof window>"u")return t;let n=typeof e=="string"?document.querySelector(e):e;return n?lt(n,r):(I("Container not found:",e),t)}function _r(e){return e.startsWith("#")||e.startsWith("rgb")||e.startsWith("hsl")}function tr(e){let r=[],t=/([\w]+)\(([^)]*)\)/g,n;for(;(n=t.exec(e))!==null;){let o=[],i=[],a=n[2].trim();if(a)for(let c of a.split(/[\s,]+/)){let m=c.match(/^([-+]?[\d.eE]+)(.*)$/);o.push(m?parseFloat(m[1]):0),i.push(m?m[2]:"")}r.push({fn:n[1],nums:o,units:i})}return r}function Vr(e,r,t){let n=tr(e),o=tr(r);return n.length===0||n.length!==o.length?t<1?e:r:n.map((i,a)=>{let c=o[a];return i.fn!==c.fn||i.nums.length!==c.nums.length?t<1?`${i.fn}(${i.nums.map((m,f)=>`${m}${i.units[f]}`).join(", ")})`:`${c.fn}(${c.nums.map((m,f)=>`${m}${c.units[f]}`).join(", ")})`:`${i.fn}(${i.nums.map((m,f)=>`${m+(c.nums[f]-m)*t}${i.units[f]}`).join(", ")})`}).join(" ")}function rr(e,r,t){if(typeof e=="number"&&typeof r=="number")return String(e+(r-e)*t);let n=String(e),o=String(r);if(_r(n))return tt(n,o,t);if(n.includes("("))return Vr(n,o,t);let i=n.match(/^([-+]?[\d.]+)(.*)$/),a=o.match(/^([-+]?[\d.]+)(.*)$/);if(i&&a){let c=parseFloat(i[1]),m=parseFloat(a[1]);return`${c+(m-c)*t}${i[2]||a[2]}`}return t<1?n:o}function zr(e){return e.replace(/([A-Z])/g,r=>`-${r.toLowerCase()}`)}var Gr=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),Wr=0,nr="--scroll-draw-progress";function Br(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var sr={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Tt(e,r){return typeof window>"u"?sr:r.respectReducedMotion===!1?or(e,r,!1):ze(r,(t,n)=>or(e,t,n))}function or(e,r,t){let{props:n,trigger:o={},easing:i="ease-out",speed:a=1,once:c=!1,axis:m="y",scrollContainer:f,native:h=!0,velocityScale:E=!1,triggerElement:y,onProgress:R,onComplete:oe,onEnter:p,onLeave:v,onEnterBack:b,onLeaveBack:x}=r,w=Le(i,"ease-out"),L=xe(o.start||"top bottom"),U=xe(o.end||"bottom top"),W=y??e,N=typeof f=="string"?document.querySelector(f):f??null,K=Object.entries(n).map(([l,d])=>({prop:zr(l),from:Array.isArray(d)?d[0]:"",to:Array.isArray(d)?d[1]:d}));function Ge(){let l=window.getComputedStyle(e);for(let d of K)d.from===""&&(d.from=l.getPropertyValue(d.prop).trim()||"0")}function ae(){for(let l of K)e.style.setProperty(l.prop,String(l.to))}let pe=new Map;for(let l of[...K.map(d=>d.prop),nr])pe.set(l,e.style.getPropertyValue(l));function B(){for(let[l,d]of pe)d?e.style.setProperty(l,d):e.style.removeProperty(l)}if(t)return ae(),oe?.(),{...sr,destroy:B,getProgress:()=>1};Ge();let ee=()=>N?m==="x"?N.scrollLeft:N.scrollTop:m==="x"?window.scrollX:window.scrollY,Me=()=>N?m==="x"?N.clientWidth:N.clientHeight:m==="x"?window.innerWidth:window.innerHeight,P=typeof i=="string"?nt(i):null;function F(){if(!h||!Br()||!P||m!=="y"||N||W!==e||c||a!==1||R||oe||p||v||b||x||E!==!1||(o.start||"top bottom").trim()!=="top bottom"||(o.end||"bottom top").trim()!=="bottom top")return!1;for(let l of K)if(!Gr.has(l.prop))return!1;return!0}function $e(){let l=`ssd-a-${++Wr}`,d=K.map(C=>`${C.prop}:${C.from}`).join(";"),V=K.map(C=>`${C.prop}:${C.to}`).join(";"),M=document.createElement("style");M.setAttribute("data-ssd-animate",""),M.textContent=`@keyframes ${l}{from{${d}}to{${V}}}.${l}{animation-name:${l};animation-duration:auto;animation-timing-function:${P};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(M),e.classList.add(l);let k=()=>{let C=e.getBoundingClientRect();return ke({top:C.top,height:C.height},ee(),Me(),L,U)};Te(e,{type:"animate",getProgress:()=>O.getProgress(),getTrigger:k});let O={refresh(){},destroy(){e.classList.remove(l),M.remove(),e.style.animationPlayState="",B(),fe(e)},replay(){e.classList.remove(l),e.offsetWidth,e.classList.add(l)},pause(){e.style.animationPlayState="paused"},resume(){e.style.animationPlayState=""},seek(C){let Pe=Math.min(1,Math.max(0,C));e.classList.remove(l);for(let z of K)e.style.setProperty(z.prop,rr(z.from,z.to,Pe))},getProgress(){let{tStart:C,tEnd:Pe}=k();return w(H(ee(),C,Pe,a))}};return O}if(F())return $e();let X=0,te=0,de=!1,Re=-1,ge=0,ue=0,J=!1,q=NaN,He=-1,We=0,_=W===e?K:[],ye=!1;function he(){let l=e.style,d=_.map(O=>l.getPropertyValue(O.prop)),V=l.transition;_.length&&(l.transition="none"),_.forEach(O=>l.setProperty(O.prop,pe.get(O.prop)??""));let M=Ke(W,N,m);_.forEach((O,C)=>l.setProperty(O.prop,d[C])),_.length&&(e.offsetWidth,l.transition=V);let k=ke(M,M.scroll,Me(),L,U);ye&&Math.abs(k.tStart-X)<1&&Math.abs(k.tEnd-te)<1||(ye=!0,X=k.tStart,te=k.tEnd)}function le(l){e.style.setProperty(nr,String(l));for(let d of K)e.style.setProperty(d.prop,rr(d.from,d.to,l));R?.(l)}function Ae(l){if(isNaN(q)){q=l;return}q<=0&&l>0&&p?.(),q<1&&l>=1&&v?.(),q>=1&&l<1&&b?.(),q>0&&l<=0&&x?.(),q=l}function be(){if(de)return;let l=performance.now(),d=ee(),V=a;if(E!==!1){let C=l-We,Pe=C>0?Math.abs(d-(He<0?d:He))/C:0;V=a*Math.max(.2,1+Pe*(typeof E=="number"?E:1)*.04)}He=d,We=l;let M=te===X?0:(d-X)/(te-X);Ae(M);let k=H(d,X,te,V),O=c?Math.max(Re,w(ge=Math.max(ge,k))):w(k);ue=O,le(O),O>=1&&!J?(J=!0,oe?.()):O<1&&!c&&(J=!1)}let ce=Ce(N??window,[W],()=>H(ee(),X,te,Math.min(a,1)),be,he);he(),te===X&&I("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",e),ge=H(ee(),X,te,a),ue=w(ge),le(ue),Te(e,{type:"animate",getProgress:()=>ue,getTrigger:()=>({tStart:X,tEnd:te})});function we(){de=!0,ce.hold(!0)}return{destroy(){de=!0,ce.off(),B(),fe(e)},replay(){Re=-1,ge=0,J=!1,ue=0,de=!1,le(0),ce.hold(!1)},pause:we,resume(){de&&(de=!1,ce.hold(!1))},seek(l){let d=Math.min(1,Math.max(0,l));ue=d,Re=d,ge=0,we(),le(d)},getProgress(){return ue},refresh:ce.remeasure}}var ct={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function ir(e,r){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;return t?Tt(t,r):(I("scrollAnimate: element not found:",e),ct)}function ar(e,r={}){if(typeof window>"u")return ct;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return I("scrollParallax: element not found:",e),ct;let{speed:n=.3,axis:o="y",easing:i="linear",trigger:a,onProgress:c}=r,m=-n*100,f=t.style,h=!!t.ownerSVGElement,E=f.getPropertyValue("transform-box");h&&f.setProperty("transform-box","fill-box");let y=Tt(t,{props:o==="x"?{transform:["translateX(0%)",`translateX(${m}%)`]}:{transform:["translateY(0%)",`translateY(${m}%)`]},trigger:a??{start:"top bottom",end:"bottom top"},easing:i,native:!1,onProgress:c});return h?{...y,destroy(){y.destroy(),f.setProperty("transform-box",E)}}:y}var Mt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function lr(e,r){if(typeof window>"u")return Mt;let t=typeof e=="string"?document.querySelector(e):e;return t?ze(r,(n,o)=>qr(t,n,o)):(I("scrollCounter: element not found:",e),Mt)}function qr(e,r,t){let{from:n=0,to:o,format:i,easing:a="ease-out",trigger:c={},once:m=!0,decimals:f,onComplete:h}=r,E=f!==void 0?P=>P.toFixed(f):i??(P=>String(Math.round(P))),y=Le(a,"ease-out"),R=xe(c.start||"top 80%"),oe=xe(c.end||"top 20%");if(t)return e.textContent=E(o),h?.(),{...Mt,getProgress:()=>1};let p=0,v=0,b=!1,x=-1,w=0,L=0,U=!1,W=()=>window.scrollY,N=()=>window.innerHeight;function K(){let P=e.getBoundingClientRect(),F=ke({top:P.top,height:P.height},W(),N(),R,oe);b&&Math.abs(F.tStart-p)<1&&Math.abs(F.tEnd-v)<1||(b=!0,p=F.tStart,v=F.tEnd)}let Ge=e.style.getPropertyValue("--scroll-draw-progress");function ae(P){e.textContent=E(n+(o-n)*P),e.style.setProperty("--scroll-draw-progress",String(P))}let pe=()=>H(W(),p,v,1);function B(){let P=pe(),F=m?Math.max(x,y(w=Math.max(w,P))):y(P);L=F,ae(F),F>=1&&!U?(U=!0,h?.()):F<1&&!m&&(U=!1)}K();{w=H(W(),p,v,1);let P=y(w);L=P,ae(P)}let ee=Ce(window,[e],pe,B,K);Te(e,{type:"counter",getProgress:()=>L,getTrigger:()=>({tStart:p,tEnd:v})});let Me=()=>ee.hold(!1);return{destroy(){ee.off(),e.style.setProperty("--scroll-draw-progress",Ge),fe(e)},replay(){x=-1,w=0,U=!1,L=0,ae(0),Me()},pause:()=>ee.hold(!0),resume:Me,seek(P){let F=Math.min(1,Math.max(0,P));L=F,x=F,w=0,ee.hold(!0),ae(F)},getProgress(){return L}}}var cr="http://www.w3.org/2000/svg",jr="cinematic-photo",fr=e=>e<0?0:e>1?1:e;function ut(e){let r=parseFloat(e);return Number.isFinite(r)?fr(r/100):0}function ur(e){return Le(e)}var mr=e=>({destroy(){},getProgress:()=>e}),mt=class{constructor(r){if(typeof document>"u"){this.mount=null;return}this.mount=typeof r.wrapper=="string"?document.querySelector(r.wrapper):r.wrapper,this.mount||I("Cinematic: wrapper not found:",r.wrapper)}loadStory(r){let t=this.mount;if(typeof window>"u"||!t)return mr(0);t.style.position="relative",t.style.height=r.totalHeight,t.style.display="block";let n=document.createElement("div");n.setAttribute("data-cinematic-stage",""),n.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(n);let o=[];for(let p of r.scenes){if(p.background){let b=document.createElement("img");b.id=jr,b.src=p.background,b.alt="",b.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",n.appendChild(b)}let v=p.animations.filter(b=>b.type==="draw");if(v.length){let b=document.createElementNS(cr,"svg");b.setAttribute("viewBox",`0 0 ${r.canvas.width} ${r.canvas.height}`),b.setAttribute("preserveAspectRatio","xMidYMid meet"),b.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",n.appendChild(b);for(let x of v){let w=document.createElementNS(cr,"path");w.id=x.target.replace(/^#/,""),w.setAttribute("d",x.d),w.setAttribute("fill","none"),w.setAttribute("stroke",x.stroke),w.setAttribute("stroke-width",String(x.strokeWidth)),w.setAttribute("stroke-linecap","round"),w.setAttribute("stroke-linejoin","round");let L=x.length||w.getTotalLength?.()||0;w.style.strokeDasharray=Ve(L),w.style.strokeDashoffset=String(L),b.appendChild(w),o.push({kind:"draw",el:w,start:ut(x.start),end:ut(x.end),ease:ur(x.easing),length:L})}}for(let b of p.animations){if(b.type!=="fade")continue;let x=n.querySelector(b.target)??document.querySelector(b.target);x&&(x.style.opacity=String(b.from),o.push({kind:"fade",el:x,start:ut(b.start),end:ut(b.end),ease:ur("ease-in-out"),from:b.from,to:b.to}))}}let i=0,a=null;for(let p=t.parentElement;p?.parentElement;p=p.parentElement)if(/[ao]/.test(getComputedStyle(p).overflowY)&&p.scrollHeight>p.clientHeight&&(p!==document.body||/[aoh]/.test(getComputedStyle(p.parentElement).overflowY))){a=p;break}let c=0,m=0,f=()=>{let p=t.getBoundingClientRect().top;c=a?p-a.getBoundingClientRect().top-a.clientTop+a.scrollTop:p+window.scrollY,m=c+Math.max(0,t.offsetHeight-(a?a.clientHeight:window.innerHeight))},h=()=>{let p=a?a.scrollTop:window.scrollY;return m<=c?p>=c?1:0:H(p,c,m,1)},E=p=>{for(let v of o){let b=v.end-v.start,x=b<=0?p>=v.end?1:0:fr((p-v.start)/b),w=v.ease(x);v.kind==="draw"?v.el.style.strokeDashoffset=String(v.length*(1-w)):v.el.style.opacity=String(v.from+(v.to-v.from)*w)}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return E(1),mr(1);let y=()=>{i=h(),E(i)};f(),y();let R=Ce(a||window,[t],h,y,f);Te(t,{type:"draw",getProgress:()=>i,getTrigger:()=>({tStart:c,tEnd:m})});let oe=ot(p=>{p&&(oe(),R.off(),fe(t),i=1,E(1))});return{destroy(){oe(),R.off(),fe(t)},getProgress:()=>i}}};if(typeof HTMLElement<"u"&&typeof customElements<"u"&&!customElements.get("scroll-draw")){let e=["speed","easing","stagger","direction","selector","fade","once"];class r extends HTMLElement{constructor(){super(...arguments);this.instance=null;this.key=""}connectedCallback(){this.build()}attributeChangedCallback(){this.instance&&this.build()}build(){let o=JSON.stringify(e.map(E=>this.getAttribute(E)));if(this.instance&&o===this.key)return;this.instance?.destroy(),this.key=o;let i={},a=this.getAttribute("speed"),c=this.getAttribute("easing"),m=this.getAttribute("stagger"),f=this.getAttribute("direction"),h=this.getAttribute("selector");a&&(i.speed=parseFloat(a)),c&&(i.easing=c),m&&(i.stagger=parseFloat(m)),f&&(i.direction=f),h&&(i.selector=h),this.hasAttribute("fade")&&(i.fade=this.getAttribute("fade")!=="false"),this.hasAttribute("once")&&(i.once=this.getAttribute("once")!=="false"),this.instance=lt(this,i)}disconnectedCallback(){this.instance?.destroy(),this.instance=null}}r.observedAttributes=e,customElements.define("scroll-draw",r)}return Mr(Yr);})();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a as a$4}from'./chunk-NJV6S5LD.mjs';import {a,d,b,c}from'./chunk-KN2YB54Z.mjs';import {a as a$3}from'./chunk-HJTHOZK5.mjs';import {a as a$5}from'./chunk-UF3MO5XQ.mjs';import {a as a$2}from'./chunk-Z72TVDHY.mjs';import {a as a$1}from'./chunk-HAGTU5EX.mjs';import {b as b$1}from'./chunk-XLXVGQ3P.mjs';import {defineComponent,ref,h,onMounted,watch,onUnmounted,unref}from'vue';var u=e=>typeof e=="function"?e():unref(e);function r(e,t,o,s=a){let l=null,i=t(),R=()=>{l?.destroy(),l=e.value?o(e.value,b(i,()=>i),i):null;};onMounted(R),watch(()=>s(i=t()),R),onUnmounted(()=>{l?.destroy(),l=null;});}function I(e={}){let t=ref(null);return r(t,()=>u(e),b$1),t}var C={preset:0,selector:0,speed:0,fade:1,easing:0,trigger:0,stagger:0,direction:0,once:1,debug:1,axis:0,scrollContainer:0,autoReverse:1,delay:0,strokeColor:0,strokeWidth:0,fillOpacity:0,clip:2,waypoints:0,velocityScale:3,threshold:0,rootMargin:0,repeat:0,repeatDelay:0,morphTo:0,onProgress:0,onStart:0,onComplete:0,onEnter:0,onLeave:0,onEnterBack:0,onLeaveBack:0,autoplay:1,duration:0,native:1},k=[null,Boolean,[Boolean,String],[Boolean,Number]],g=e=>({type:e,default:void 0}),N=defineComponent({name:"ScrollDraw",props:Object.fromEntries(Object.entries(C).map(([e,t])=>[e,t?g(k[t]):null])),setup(e,{slots:t}){let o=ref(null);return r(o,()=>{let s={};for(let l in C){let i=e[l];i!=null&&(s[l]=i);}return s},b$1),()=>h("div",{ref:o},t.default?.())}});function q(e){let t=ref(null);return r(t,()=>u(e),a$1),t}var K=defineComponent({name:"ScrollAnimate",props:{options:{type:Object,required:true}},setup(e,{slots:t}){let o=ref(null);return r(o,()=>e.options,a$1),()=>h("div",{ref:o},t.default?.())}});function P(e){let t=ref(null);return r(t,()=>u(e),a$2),t}var Y=defineComponent({name:"ScrollCounter",props:{to:{type:Number,required:true},from:{type:Number},format:{type:Function},easing:{type:[String,Function]},trigger:{type:Object},once:g(Boolean),decimals:{type:Number},onComplete:{type:Function}},setup(e){let t=ref(null);return r(t,()=>{let o={to:e.to};return e.from!=null&&(o.from=e.from),e.format!=null&&(o.format=e.format),e.easing!=null&&(o.easing=e.easing),e.trigger!=null&&(o.trigger=e.trigger),e.once!=null&&(o.once=e.once),e.decimals!=null&&(o.decimals=e.decimals),e.onComplete!=null&&(o.onComplete=e.onComplete),o},a$2),()=>h("span",{ref:t})}});function _(e={}){let t=ref(null);return r(t,()=>u(e),a$3),t}var W=defineComponent({name:"ScrollVideo",props:{src:{type:String,required:true},options:{type:Object},muted:{type:Boolean,default:true},playsInline:{type:Boolean,default:true},class:{type:String}},setup(e){let t=ref(null);return r(t,()=>e.options??{},a$3),()=>h("video",{ref:t,src:e.src,muted:e.muted,playsinline:e.playsInline,preload:"auto",class:e.class})}});function U(e){let t=ref(null);return r(t,()=>u(e),a$4,c),t}var v={frames:0,count:0,trigger:0,easing:0,once:1,axis:0,triggerElement:0,fit:0,concurrency:0,onReady:0,onLoad:0,onComplete:0,onProgress:0},z=defineComponent({name:"ScrollFrames",props:Object.fromEntries(Object.entries(v).map(([e,t])=>[e,t?g(Boolean):e==="frames"?{required:true}:null])),setup(e){let t=ref(null);return r(t,()=>{let o={};for(let s in v){let l=e[s];l!=null&&(o[s]=l);}return o},a$4,c),onMounted(()=>d(t.value)),()=>h("canvas",{ref:t,role:"img"})}});function J(e={}){let t=ref(null);return r(t,()=>u(e),a$5),t}var Q=defineComponent({name:"ScrollText",props:{options:{type:Object},tag:{type:String,default:"p"}},setup(e,{slots:t}){let o=ref(null);return r(o,()=>e.options??{},a$5),()=>h(e.tag,{ref:o},t.default?.())}});export{I as a,N as b,q as c,K as d,P as e,Y as f,_ as g,W as h,U as i,z as j,J as k,Q as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import {b}from'./chunk-
|
|
1
|
+
import {b}from'./chunk-XLXVGQ3P.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {e,d as d$1}from'./chunk-IXR6RML7.mjs';function a(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 d(e,r,t){let n=a(e),s=a(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 c="cubic-bezier(0.333333, 0, 0.666667, 0.333333)",p="cubic-bezier(0.333333, 0.666667, 0.666667, 1)",o=33;function f(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timing-function: linear(0, 1)")}function l(e){let r=[];for(let t=0;t<o;t++){let n=t/(o-1);r.push(String(Math.round(e(n)*1e5)/1e5));}return `linear(${r.join(",")})`}function m(e$1){switch(e$1){case "linear":return "linear";case "ease-in":return c;case "ease-out":return p;case "ease-in-out":return f()?l(d$1["ease-in-out"]):null;default:return e(e$1)?.[1]??null}}export{d as a,m as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {a}from'./chunk-YOOPMYT6.mjs';import {e,b as b$2}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.mjs';import {a as a$2}from'./chunk-5PJEKEEP.mjs';import {a as a$1,b as b$1}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var L="http://www.w3.org/2000/svg",Y="cinematic-photo",O=a=>a<0?0:a>1?1:a;function u(a){let i=parseFloat(a);return Number.isFinite(i)?O(i/100):0}function P(a){return f(a)}var R=a=>({destroy(){},getProgress:()=>a}),D=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 R(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=Y,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(L,"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(L,"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=a(h),r.style.strokeDashoffset=String(h),e.appendChild(r),f.push({kind:"draw",el:r,start:u(o.start),end:u(o.end),ease:P(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:P("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,w=()=>{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));},b=()=>{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:O((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),R(1);let S=()=>{d=b(),g(d);};w(),S();let E=e(c||window,[s],b,S,w);a$1(s,{type:"draw",getProgress:()=>d,getTrigger:()=>({tStart:m,tEnd:p})});let v=a$2(t=>{t&&(v(),E.off(),b$1(s),d=1,g(1));});return {destroy(){v(),E.off(),b$1(s);},getProgress:()=>d}}};
|
|
2
|
+
export{D as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.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 I={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Oe(c){let d=c>1?[0,c-1]:[0],f=[[0,c-1]];for(let n=0;n<f.length;n++){let[l,g]=f[n];if(g-l<2)continue;let x=l+g>>1;d.push(x),f.push([l,x],[x,g]);}return d}function $e(c$1,d){if(typeof window>"u")return I;let f$1=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!f$1||f$1.tagName.toLowerCase()!=="canvas")return b("scrollFrames: <canvas> element not found:",c$1),I;let n=f$1,{frames:l,trigger:g={},easing:x="linear",once:j=false,axis:A="y",fit:ye="cover",triggerElement:be,onReady:ve,onLoad:Me,onComplete:xe,onProgress:Ee}=d||{},h=Array.isArray(l)?l:null,J=d?.count,p=Math.floor(h?Math.min(J??h.length,h.length):J??NaN);if(!(h||typeof l=="function")||!Number.isFinite(p)||p<1)return b("scrollFrames: no frames. Pass `frames` as an array of URLs, or a function with a finite `count` of 1 or more.",n),I;let w=d.concurrency??6;(!Number.isFinite(w)||w<1)&&(b("scrollFrames: `concurrency` must be a finite number of 1 or more; using 6.",d.concurrency),w=6),w=Math.floor(w);let N=n.getContext("2d");if(!N)return b("scrollFrames: the canvas has no 2D context.",n),I;let y=p-1,K=be??n,i=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Fe=f(x),Q=e=>{let t=Fe(e);return t===t?t:0},Re=a(g.start||"top top"),Se=a(g.end||"bottom top"),C=0,P=0,E=false,W=-1,T=0,b$3=0,L=false,a$3=false,V=false,Z=false,$=0,D=-1,O=new Array(p),U=new Uint8Array(p),F=new Set,v=i?[y]:Oe(p),q=0,_=0,ee=false,z=(e,...t)=>{if(e)try{e(...t);}catch(r){typeof reportError=="function"?reportError(r):setTimeout(()=>{throw r});}},te=false,Ae=e=>{let t;try{t=h?h[e]:l(e);}catch(r){t=r;}return typeof t=="string"&&t?t:(te||(te=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 B(){!ee&&_===v.length&&(ee=true,z(Me));}function G(){for(;!a$3&&F.size<w&&q<v.length;){let e=v[q++];U[e]||Pe(e);}}function Pe(e){U[e]=1;let t=Ae(e);if(t===null){_++,queueMicrotask(()=>{a$3||B();});return}let r=new Image,o=false,s=m=>{o||a$3||(o=true,r.onload=r.onerror=null,F.delete(r),m?O[e]=r:b("scrollFrames: a frame failed to load; its nearest neighbour shows instead:",t),_++,G(),k(),B());};F.add(r),r.decoding="async",r.onerror=()=>s(false),r.src=t,typeof r.decode=="function"?r.decode().then(()=>s(true),()=>{r.complete?s(r.naturalWidth>0):r.onload=()=>s(true);}):r.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=n.clientWidth,t=n.clientHeight;if(!e||!t)return;let r=Math.min(window.devicePixelRatio||1,2),o=Math.round(e*r),s=Math.round(t*r);if(Math.abs(n.width-o)<=1&&Math.abs(n.height-s)<=1)return;n.width=o,n.height=s,D=-1;let m=n.clientWidth,S=n.clientHeight;if(m!==e||S!==t){let M=n.style;m!==e&&S!==t?(M.width=`${e}px`,M.height=`${t}px`):M.aspectRatio=`${e} / ${t}`;}}function k(){let e=Te($);if(e<0||e===D)return;let t=O[e],r=n.width,o=n.height,s=t.naturalWidth||r,m=t.naturalHeight||o,S=(ye==="contain"?Math.min:Math.max)(r/s,o/m),M=s*S,ue=m*S;N.clearRect(0,0,r,o),N.drawImage(t,(r-M)/2,(o-ue)/2,M,ue),D=e,V||(V=true,z(ve));}function H(e){$=Math.min(y,Math.max(0,Math.round(e*y))),n.style.setProperty("--scroll-draw-progress",String(e)),k(),z(Ee,e,$);}function ne(){let e=K.getBoundingClientRect(),t=A==="x"?e.left:e.top,r=A==="x"?e.width:e.height,o=c({top:t,height:r},re(),Ce(),Re,Se);C=o.tStart,P=o.tEnd,P===C&&r>0&&!i&&!Z&&(Z=true,b("scrollFrames: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",n));}let oe=()=>b$2(re(),C,P,1);function Le(){if(i)return;let e=oe(),t=j?Math.max(W,Q(T=Math.max(T,e))):Q(e);b$3=t,H(t),t>=1&&!L?(L=true,z(xe)):t<1&&!j&&(L=false);}function se(){b$3=1,H(1);}X(),i||ne();let R=e(window,[K],oe,Le,()=>{X(),i||ne(),k();}),ie=()=>R.hold(E||i);ie(),i&&se(),G();let ae=typeof ResizeObserver=="function"?new ResizeObserver(()=>{X(),k();}):null;ae?.observe(n);let ce=i?()=>{}:a$1(e=>{e&&(ce(),i=true,R.hold(true),v=v.slice(0,q),U[y]||v.push(y),B(),se(),G());});a$2(n,{type:"frames",getProgress:()=>b$3,getTrigger:()=>({tStart:C,tEnd:P})});function le(){a$3||!E||(E=false,ie());}return {destroy(){if(!a$3){a$3=true,R.off(),ae?.disconnect(),ce();for(let e of F)e.onload=e.onerror=null,e.src="";F.clear(),b$1(n);}},replay(){a$3||(W=-1,T=0,L=false,b$3=0,H(0),le());},pause(){a$3||(E=true,R.hold(true));},resume:le,seek(e){if(a$3)return;let t=Math.min(1,Math.max(0,e===e?e:0));b$3=t,W=t,T=0,E=true,R.hold(true),H(t);},getProgress(){return b$3}}}export{$e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b,a as a$4}from'./chunk-7LDSB4FT.mjs';import {a as a$3}from'./chunk-UPWWULKI.mjs';import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,b as b$1,c}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.mjs';import {a as a$2,b as b$3}from'./chunk-EBU6E26L.mjs';import {b as b$2}from'./chunk-LFSU6LR3.mjs';function wt(t){return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")}function ut(t){let i=[],l=/([\w]+)\(([^)]*)\)/g,s;for(;(s=l.exec(t))!==null;){let m=[],o=[],c=s[2].trim();if(c)for(let u of c.split(/[\s,]+/)){let n=u.match(/^([-+]?[\d.eE]+)(.*)$/);m.push(n?parseFloat(n[1]):0),o.push(n?n[2]:"");}i.push({fn:s[1],nums:m,units:o});}return i}function Mt(t,i,l){let s=ut(t),m=ut(i);return s.length===0||s.length!==m.length?l<1?t:i:s.map((o,c)=>{let u=m[c];return o.fn!==u.fn||o.nums.length!==u.nums.length?l<1?`${o.fn}(${o.nums.map((n,p)=>`${n}${o.units[p]}`).join(", ")})`:`${u.fn}(${u.nums.map((n,p)=>`${n}${u.units[p]}`).join(", ")})`:`${o.fn}(${o.nums.map((n,p)=>`${n+(u.nums[p]-n)*l}${o.units[p]}`).join(", ")})`}).join(" ")}function ft(t,i,l){if(typeof t=="number"&&typeof i=="number")return String(t+(i-t)*l);let s=String(t),m=String(i);if(wt(s))return a$4(s,m,l);if(s.includes("("))return Mt(s,m,l);let o=s.match(/^([-+]?[\d.]+)(.*)$/),c=m.match(/^([-+]?[\d.]+)(.*)$/);if(o&&c){let u=parseFloat(o[1]),n=parseFloat(c[1]);return `${u+(n-u)*l}${o[2]||c[2]}`}return l<1?s:m}function Lt(t){return t.replace(/([A-Z])/g,i=>`-${i.toLowerCase()}`)}var $t=new Set(["opacity","transform","background-color","color","filter","scale","translate","rotate"]),At=0,pt="--scroll-draw-progress";function Ct(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")}var dt={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Wt(t,i){return typeof window>"u"?dt:i.respectReducedMotion===false?gt(t,i,false):a(i,(l,s)=>gt(t,l,s))}function gt(t,i,l){let{props:s,trigger:m={},easing:o="ease-out",speed:c$1=1,once:u=false,axis:n="y",scrollContainer:p,native:yt=true,velocityScale:H=false,triggerElement:ht,onProgress:G,onComplete:I,onEnter:q,onLeave:U,onEnterBack:X,onLeaveBack:Y}=i,x=f(o,"ease-out"),Z=a$1(m.start||"top bottom"),J=a$1(m.end||"bottom top"),R=ht??t,y=typeof p=="string"?document.querySelector(p):p??null,h=Object.entries(s).map(([e,r])=>({prop:Lt(e),from:Array.isArray(r)?r[0]:"",to:Array.isArray(r)?r[1]:r}));function Et(){let e=window.getComputedStyle(t);for(let r of h)r.from===""&&(r.from=e.getPropertyValue(r.prop).trim()||"0");}function bt(){for(let e of h)t.style.setProperty(e.prop,String(e.to));}let V=new Map;for(let e of [...h.map(r=>r.prop),pt])V.set(e,t.style.getPropertyValue(e));function O(){for(let[e,r]of V)r?t.style.setProperty(e,r):t.style.removeProperty(e);}if(l)return bt(),I?.(),{...dt,destroy:O,getProgress:()=>1};Et();let M=()=>y?n==="x"?y.scrollLeft:y.scrollTop:n==="x"?window.scrollX:window.scrollY,K=()=>y?n==="x"?y.clientWidth:y.clientHeight:n==="x"?window.innerWidth:window.innerHeight,Q=typeof o=="string"?b(o):null;function vt(){if(!yt||!Ct()||!Q||n!=="y"||y||R!==t||u||c$1!==1||G||I||q||U||X||Y||H!==false||(m.start||"top bottom").trim()!=="top bottom"||(m.end||"bottom top").trim()!=="bottom top")return false;for(let e of h)if(!$t.has(e.prop))return false;return true}function St(){let e=`ssd-a-${++At}`,r=h.map(a=>`${a.prop}:${a.from}`).join(";"),w=h.map(a=>`${a.prop}:${a.to}`).join(";"),b=document.createElement("style");b.setAttribute("data-ssd-animate",""),b.textContent=`@keyframes ${e}{from{${r}}to{${w}}}.${e}{animation-name:${e};animation-duration:auto;animation-timing-function:${Q};animation-fill-mode:both;animation-timeline:view();animation-range:cover 0% cover 100%;}`,document.head.appendChild(b),t.classList.add(e);let d=()=>{let a=t.getBoundingClientRect();return c({top:a.top,height:a.height},M(),K(),Z,J)};a$2(t,{type:"animate",getProgress:()=>f.getProgress(),getTrigger:d});let f={refresh(){},destroy(){t.classList.remove(e),b.remove(),t.style.animationPlayState="",O(),b$3(t);},replay(){t.classList.remove(e),t.offsetWidth,t.classList.add(e);},pause(){t.style.animationPlayState="paused";},resume(){t.style.animationPlayState="";},seek(a){let A=Math.min(1,Math.max(0,a));t.classList.remove(e);for(let F of h)t.style.setProperty(F.prop,ft(F.from,F.to,A));},getProgress(){let{tStart:a,tEnd:A}=d();return x(b$1(M(),a,A,c$1))}};return f}if(vt())return St();let g=0,E=0,T=false,W=-1,P=0,v=0,k=false,S=NaN,B=-1,tt=0,L=R===t?h:[],et=false;function rt(){let e=t.style,r=L.map(f=>e.getPropertyValue(f.prop)),w=e.transition;L.length&&(e.transition="none"),L.forEach(f=>e.setProperty(f.prop,V.get(f.prop)??""));let b=a$3(R,y,n);L.forEach((f,a)=>e.setProperty(f.prop,r[a])),L.length&&(t.offsetWidth,e.transition=w);let d=c(b,b.scroll,K(),Z,J);et&&Math.abs(d.tStart-g)<1&&Math.abs(d.tEnd-E)<1||(et=true,g=d.tStart,E=d.tEnd);}function N(e){t.style.setProperty(pt,String(e));for(let r of h)t.style.setProperty(r.prop,ft(r.from,r.to,e));G?.(e);}function Tt(e){if(isNaN(S)){S=e;return}S<=0&&e>0&&q?.(),S<1&&e>=1&&U?.(),S>=1&&e<1&&X?.(),S>0&&e<=0&&Y?.(),S=e;}function Pt(){if(T)return;let e=performance.now(),r=M(),w=c$1;if(H!==false){let a=e-tt,A=a>0?Math.abs(r-(B<0?r:B))/a:0;w=c$1*Math.max(.2,1+A*(typeof H=="number"?H:1)*.04);}B=r,tt=e;let b=E===g?0:(r-g)/(E-g);Tt(b);let d=b$1(r,g,E,w),f=u?Math.max(W,x(P=Math.max(P,d))):x(d);v=f,N(f),f>=1&&!k?(k=true,I?.()):f<1&&!u&&(k=false);}let $=e(y??window,[R],()=>b$1(M(),g,E,Math.min(c$1,1)),Pt,rt);rt(),E===g&&b$2("scrollAnimate: zero-length trigger window, so it never animates. In a sticky stage, set triggerElement.",t),P=b$1(M(),g,E,c$1),v=x(P),N(v),a$2(t,{type:"animate",getProgress:()=>v,getTrigger:()=>({tStart:g,tEnd:E})});function nt(){T=true,$.hold(true);}return {destroy(){T=true,$.off(),O(),b$3(t);},replay(){W=-1,P=0,k=false,v=0,T=false,N(0),$.hold(false);},pause:nt,resume(){T&&(T=false,$.hold(false));},seek(e){let r=Math.min(1,Math.max(0,e));v=r,W=r,P=0,nt(),N(r);},getProgress(){return v},refresh:$.remeasure}}export{Wt as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.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 W={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function se(c$1,h={}){if(typeof window>"u")return W;let v=typeof c$1=="string"?document.querySelector(c$1):c$1;if(!v||v.tagName.toLowerCase()!=="video")return b("scrollVideo: <video> element not found:",c$1),W;let t=v,{trigger:P={},easing:X="linear",once:C=false,axis:u="y",preload:Y="auto",triggerElement:j,onReady:N,onComplete:J,onProgress:K}=h,V=j??t,a$3=window.matchMedia("(prefers-reduced-motion: reduce)").matches,L=f(X),Q=a(P.start||"top top"),U=a(P.end||"bottom top");t.pause(),t.hasAttribute("preload")||(t.preload=Y);let R=h.from??0,y=h.to,m=0,f$1=0,r=false,E=-1,g=0,n=0,p=false,i=false,z=()=>u==="x"?window.scrollX:window.scrollY,Z=()=>u==="x"?window.innerWidth:window.innerHeight;function b$3(){let e=V.getBoundingClientRect(),o=u==="x"?e.left:e.top,d=u==="x"?e.width:e.height,k=c({top:o,height:d},z(),Z(),Q,U);m=k.tStart,f$1=k.tEnd,i&&f$1===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=y??t.duration??0,d=R+(o-R)*e;d!==w&&(w=d,t.currentTime=d),t.style.setProperty("--scroll-draw-progress",String(e)),K?.(e);}let A=()=>b$2(z(),m,f$1,1);function $(){if(!i||a$3)return;let e=A(),o=C?Math.max(E,L(g=Math.max(g,e))):L(e);n=o,s(o),o>=1&&!p?(p=true,J?.()):o<1&&!C&&(p=false);}let l=e(window,[V],A,$,b$3),x=()=>l.hold(r||!i||a$3);x();function S(){if(i=true,y===void 0&&(y=t.duration),a$3){s(1),N?.();return}b$3(),N?.(),r?s(n):x();}t.readyState>=1?S():t.addEventListener("loadedmetadata",S,{once:true}),i||b$3();let I=a$3?()=>{}:a$1(e=>{e&&(I(),a$3=true,l.hold(true),s(1));});a$2(t,{type:"video",getProgress:()=>n,getTrigger:()=>({tStart:m,tEnd:f$1})});function O(){r&&(r=false,x());}return {destroy(){l.off(),t.removeEventListener("loadedmetadata",S),I(),b$1(t);},replay(){E=-1,g=0,p=false,n=0,w=NaN,s(0),O();},pause(){r=true,l.hold(true);},resume:O,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
|
+
import {b}from'./chunk-LFSU6LR3.mjs';function M({tension:e=2.5,friction:o=2.2}={}){return n=>1-Math.cos(n*Math.PI*e)*Math.pow(1-n,o)}function d({bounces:e=3,decay:o=.5}={}){let n=Math.max(1,Math.round(e)),a=Math.max(.01,Math.min(.99,o)),c=Math.sqrt(a),r=0,t=[];for(let i=0;i<n;i++){let s=Math.pow(c,i);t.push(s),r+=s;}let u=[0],m=0;for(let i=0;i<n;i++)m+=t[i]/r,u.push(m);return i=>{if(i<=0)return 0;if(i>=1)return 1;for(let s=0;s<n;s++)if(i<=u[s+1]){let b=(i-u[s])/(u[s+1]-u[s]);if(s===0)return b*(2-b);let p=1-Math.pow(a,s);return p+(1-p)*(2*b-1)*(2*b-1)}return 1}}function w({amplitude:e=1,period:o=.4}={}){let n=Math.max(1,e),a=Math.max(.1,o),c=n<=1?a/4:a/(2*Math.PI)*Math.asin(1/n);return r=>r<=0?0:r>=1?1:n*Math.pow(2,-10*r)*Math.sin((r-c)*(2*Math.PI)/a)+1}var f={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:M(),bounce:d(),elastic:w()};function E(e,o,n,a){let c=(r,t,u)=>((1+3*r-3*t)*u+3*t-6*r)*u*u+3*r*u;return r=>{if(r<=0||r>=1)return +(r>0);let t=r;for(let u=0;u<8;u++)t-=(c(e,n,t)-r)/((3*(1+3*e-3*n)*t+6*n-12*e)*t+3*e);if(!(t>=0&&t<=1&&Math.abs(c(e,n,t)-r)<1e-9))for(let u=0,m=0,i=1;u<30;u++)t=(m+i)/2,c(e,n,t)<r?m=t:i=t;return c(o,a,t)}}function g(e){let o=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),n=o?o[1].split(",").map(parseFloat):[];if(n.length===4&&n.every(Number.isFinite)&&n[0]*(1-n[0])>=0&&n[2]*(1-n[2])>=0)return [E(n[0],n[1],n[2],n[3]),`cubic-bezier(${n})`]}var l=new Set;function S(e,o="linear"){if(typeof e=="function")return e;if(e==null)return f[o];if({}.hasOwnProperty.call(f,e))return f[e];let n=g(String(e));return n?n[0]:(!l.has(e)&&l.add(e)&&b(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),f[o])}export{M as a,d as b,w as c,f as d,g as e,S as f};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {b as b$1}from'./chunk-LFSU6LR3.mjs';var f=new WeakMap,a=0;function i(t){return JSON.stringify(t,(r,e)=>{if(typeof e=="function")return "\u0192";if(typeof Element<"u"&&e instanceof Element){let n=f.get(e);return n===void 0&&f.set(e,n=++a),`el#${n}`}return e})}function c(t,r){let e={...t};for(let n of Object.keys(e))typeof e[n]=="function"&&(e[n]=(...o)=>r()[n]?.(...o));return e}var l=1e4;function y(t){let{frames:r,count:e}=t;if(typeof r!="function")return i(t);let n=Number.isFinite(e)?Math.min(Math.max(Math.floor(e),0),l):0,o;try{o=Array.from({length:n},(m,s)=>r(s));}catch{o=["throws"];}return i({...t,frames:o})}function b(t,r="<ScrollFrames>"){if(!t||t.getAttribute("aria-hidden")==="true")return;let e=t.getAttribute("role");e==="presentation"||e==="none"||t.getAttribute("aria-label")||t.getAttribute("aria-labelledby")||b$1(`${r}: the canvas has no aria-label. Say what the frames show, or set aria-hidden="true" if they are decoration.`,t);}export{i as a,c as b,y as c,b as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-GBFWTY5L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';function l(m,{triggerElement:e,...a$1},s){let r=e;return typeof e=="string"&&typeof document<"u"&&(r=document.querySelector(e),r||b(`scrollFrames: triggerElement "${e}" matches nothing; measuring the canvas.`)),a(m,{...a$1,frames:s.frames,triggerElement:r??void 0})}export{l as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-HAGTU5EX.mjs';import {b}from'./chunk-LFSU6LR3.mjs';var n={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function P(e,o){if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;return r?a(r,o):(b("scrollAnimate: element not found:",e),n)}function w(e,o={}){if(typeof window>"u")return n;let r=typeof e=="string"?document.querySelector(e):e;if(!r)return b("scrollParallax: element not found:",e),n;let{speed:m=.3,axis:p="y",easing:f="linear",trigger:g,onProgress:u}=o,i=-m*100,s=r.style,c=!!r.ownerSVGElement,y=s.getPropertyValue("transform-box");c&&s.setProperty("transform-box","fill-box");let l=a(r,{props:p==="x"?{transform:["translateX(0%)",`translateX(${i}%)`]}:{transform:["translateY(0%)",`translateY(${i}%)`]},trigger:g??{start:"top bottom",end:"bottom top"},easing:f,native:false,onProgress:u});return c?{...l,destroy(){l.destroy(),s.setProperty("transform-box",y);}}:l}export{P as a,w as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,c,b as b$2}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.mjs';import {a as a$3}from'./chunk-4DOJSIEQ.mjs';import {a as a$2,b as b$1}from'./chunk-EBU6E26L.mjs';import {b}from'./chunk-LFSU6LR3.mjs';function R(e,o){let t=document.createElement("span");t.textContent=o,t.style.cssText="position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;user-select:none",e.appendChild(t);}function w(e=""){let o=document.createElement("span");return o.setAttribute("aria-hidden","true"),o.textContent=e,o}function _(e){let o=e.textContent??"";return e.textContent="",o.split(/(\s+)/).filter(Boolean).map(t=>{let n=e.appendChild(w(t)),i=/^\s+$/.test(t);return i?n.style.whiteSpace="pre":n.style.display="inline-block",i?null:n}).filter(t=>t!==null)}function X(e){let o=e.textContent??"";e.textContent="";let t=[],n=null;for(let i of o){let r=w(i),s=i===" ";s?r.style.whiteSpace="pre":(r.style.display="inline-block",t.push(r)),s||i>"\u0DFF"?n=null:n||(n=e.appendChild(w()),n.style.cssText="display:inline-block;white-space:nowrap"),(n??e).appendChild(r);}return t}function W(e){let o=_(e),t=new Map;for(let r of o){let s=r.offsetTop;t.has(s)||t.set(s,[]),t.get(s).push(r);}let n=[],i=Array.from(t.keys()).sort((r,s)=>r-s);for(let r of i){let s=t.get(r),p=w();p.style.display="inline-block",s.forEach((d,m)=>{let f=d.nextElementSibling;p.appendChild(d),m<s.length-1&&f&&f.style.whiteSpace==="pre"&&p.appendChild(f);}),n.push(p);}return e.textContent="",n.forEach((r,s)=>{e.appendChild(r),s<n.length-1&&e.appendChild(document.createTextNode(" "));}),n}function J(e,o,t,n){if(t<=1||n===0)return e;n=Math.min(n,1/t);let i=(t-1)*n,r=o*n,s=r+(1-i);return s<=r?e>=r?1:0:a$3((e-r)/(s-r),0,1)}function K(e,o){let t=[];if(o?.y!==void 0&&t.push(`translateY(${o.y*(1-e)}px)`),o?.x!==void 0&&t.push(`translateX(${o.x*(1-e)}px)`),o?.rotate!==void 0&&t.push(`rotate(${o.rotate*(1-e)}deg)`),o?.scale!==void 0){let n=o.scale+(1-o.scale)*e;t.push(`scale(${n})`);}return t.join(" ")}var L={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function se(e,o={}){if(typeof window>"u")return L;let t=typeof e=="string"?document.querySelector(e):e;if(!t)return b("scrollText: element not found:",e),L;let n=t;return a(o,(i,r)=>Q(n,i,r))}function Q(e$1,o,t){let{split:n="words",stagger:i=.04,easing:r="ease-out",from:s={opacity:0,y:24},trigger:p={},once:d=true,onComplete:m}=o,f$1=f(r,"ease-out"),j=a$1(p.start||"top 85%"),q=a$1(p.end||"top 40%"),S=e$1.innerHTML,v=e$1.textContent??"",a;n==="chars"?a=X(e$1):n==="lines"?a=W(e$1):a=_(e$1),R(e$1,v);let z=a.length;function F(l,T){s?.opacity!==void 0&&(l.style.opacity=String(s.opacity+(1-s.opacity)*T));let x=K(T,s);x&&(l.style.transform=x);}function c$1(l){e$1.style.setProperty("--scroll-draw-progress",String(l)),a.forEach((T,x)=>{let U=f$1(J(l,x,z,i));F(T,U);});}if(t)return c$1(1),m?.(),{...L,destroy:()=>{e$1.innerHTML=S;},getProgress:()=>1};c$1(0);let b=0,E=0,g=-1,u=0,h=false;function I(){({tStart:b,tEnd:E}=c(e$1.getBoundingClientRect(),window.scrollY,window.innerHeight,j,q));}let C=()=>b$2(window.scrollY,b,E,1);function G(){let l=d?g=Math.max(g,C()):C();u=l,c$1(l),l>=1&&!h?(h=true,m?.()):l<1&&!d&&(h=false);}I();let y=e(window,[e$1],C,G,()=>{n==="lines"&&(e$1.innerHTML=S,a=W(e$1),R(e$1,v),c$1(u)),I();});a$2(e$1,{type:"text",getProgress:()=>u,getTrigger:()=>({tStart:b,tEnd:E})});let P=()=>y.hold(false);return {destroy(){y.off(),e$1.innerHTML=S,b$1(e$1);},replay(){g=-1,h=false,u=0,c$1(0),P();},pause:()=>y.hold(true),resume:P,seek(l){y.hold(true),c$1(u=g=a$3(l,0,1));},getProgress(){return u}}}export{se as a};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {b as b$1,a as a$7}from'./chunk-7LDSB4FT.mjs';import {a as a$2}from'./chunk-UPWWULKI.mjs';import {a as a$5}from'./chunk-XC5NR2MU.mjs';import {a as a$6}from'./chunk-YOOPMYT6.mjs';import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,e,c,b as b$3}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.mjs';import {a as a$4,b as b$2}from'./chunk-EBU6E26L.mjs';import {b,a as a$3}from'./chunk-LFSU6LR3.mjs';var ht={sketch:{easing:"ease-in",stagger:.1,speed:.9,fade:false},reveal:{easing:"ease-out",fade:true,speed:1.2,once:true},typewriter:{easing:"linear",stagger:.05,speed:1.5},cinematic:{easing:"ease-in-out",fade:true,speed:.75},spring:{easing:"spring",speed:1.1}};var Ot=0;function Nt(){return typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("animation-timeline: view()")&&CSS.supports("view-timeline-name: --x")}function vt(r,p){let f="";try{f=getComputedStyle(r).getPropertyValue(p).trim();}catch{}return f||(r.getAttribute(p)??"").trim()}var wt=new Set(["","none","transparent","rgba(0, 0, 0, 0)"]);function Ft(r){if(!a$3)return;let p=vt(r,"stroke");if(!p||p==="none"){b("Element has no stroke \u2014 path will not be visible.",r);return}let f=(r.getAttribute("fill")??"").trim();f&&!wt.has(f)&&!wt.has(vt(r,"fill"))&&b("Element has a fill \u2014 it may obscure the stroke animation.",r);}function Ht(r,p,f){let d=document.createElement("div");d.setAttribute("data-svg-scroll-draw-debug",""),d.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 x(){let F=f==="x"?window.scrollX:window.scrollY,A=r-F,M=p-F,H=f==="x";d.innerHTML=`
|
|
2
|
+
<div style="position:absolute;${H?`left:${A}px;top:0;bottom:0;border-left:2px dashed #22c55e;`:`top:${A}px;left:0;right:0;border-top:2px dashed #22c55e;`}padding:2px 6px;color:#22c55e;background:rgba(0,0,0,.6)">\u25B6 start</div>
|
|
3
|
+
<div style="position:absolute;${H?`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(d),window.addEventListener("scroll",x,{passive:true}),x(),{el:d,destroy(){window.removeEventListener("scroll",x),d.remove();}}}var bt=/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,Et=/[MmLlHhVvCcSsQqTtAaZz]/g;function It(r,p,f){if(!a$3)return;let d=(r.match(Et)??[]).join("").toUpperCase(),x=(p.match(Et)??[]).join("").toUpperCase(),F=(r.match(bt)??[]).length,A=(p.match(bt)??[]).length;if(d!==x){b(`morphTo: command sequence differs (${d||"\u2205"} \u2192 ${x||"\u2205"}). Interpolation is coordinate-for-coordinate, so the result will not reach the target shape. Redraw both paths with the same commands.`,f);return}F!==A&&b(`morphTo: coordinate count differs (${F} \u2192 ${A}). Extra coordinates are ignored and missing ones hold their start value, so the result will not reach the target shape.`,f);}function Rt(r,p,f){let d=(p.match(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g)??[]).map(Number),x=0;return r.replace(/[-+]?(?:\d*\.)?\d+(?:[eE][-+]?\d+)?/g,F=>{let A=parseFloat(F),M=d[x++]??A;return String(+(A+(M-A)*f).toFixed(4))})}function Kt(r,p={}){return typeof window>"u"?{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0}:a(p,(f,d)=>Vt(r,f,d))}function Vt(r,p,f$1){let{preset:d,...x}=p,F=d?{...ht[d],...x}:x,{selector:A="path, polyline, line, polygon, rect, circle",speed:M=1,fade:H=false,easing:xe="linear",trigger:ge={},stagger:q=0,direction:u="forward",once:K=false,debug:Ve=false,axis:W="y",scrollContainer:Ae,autoReverse:Me=false,delay:le=0,strokeColor:B,strokeWidth:_,fillOpacity:j,waypoints:U,velocityScale:fe=false,threshold:St=0,rootMargin:Tt="0px",repeat:ce=0,repeatDelay:We=0,morphTo:L,clip:Pe,autoplay:ze=false,duration:$t=1e3,native:kt=true,onProgress:ue,onStart:he,onComplete:ve,onEnter:Ge,onLeave:qe,onEnterBack:Be,onLeaveBack:_e}=F,D=Pe===true?"left":typeof Pe=="string"?Pe:false,z=f(xe),je=a$1(ge.start||"top bottom"),Ue=a$1(ge.end||"bottom top"),P=typeof Ae=="string"?document.querySelector(Ae):Ae??null,ee=Array.isArray(B)?B[0]:null,te=Array.isArray(B)?B[1]:typeof B=="string"?B:null,X=Array.isArray(_)?_[0]:null,re=Array.isArray(_)?_[1]:typeof _=="number"?_:null,Y=Array.isArray(j)?j[0]:null,se=Array.isArray(j)?j[1]:typeof j=="number"?j:null;function oe(e){let t=e*100;switch(D){case "right":return `inset(0 0 0 ${100-t}%)`;case "top":return `inset(0 0 ${100-t}% 0)`;case "bottom":return `inset(${100-t}% 0 0 0)`;case "center":return `circle(${e*150}% at 50% 50%)`;default:return `inset(0 ${100-t}% 0 0)`}}let c$1=D?[]:Array.from(r.querySelectorAll(A)),S=[],C=[],w=0,O=0,we=q,Xe=0,Ye=0,k=false,I=false,R=0,Le=-1,be=[],Ee=-1,T=false,N=0,Q=0,Z,De=false,Ce=null;function Qe(){Ce?.destroy(),Ce=null;}let J=new Set,Ze=NaN,ne=true,Se=-1,Je=performance.now(),ie=NaN;function Te(){return P?W==="x"?P.scrollLeft:P.scrollTop:W==="x"?window.scrollX:window.scrollY}function Ke(){return P?W==="x"?P.clientWidth:P.clientHeight:W==="x"?window.innerWidth:window.innerHeight}function et(){let e=a$2(r,P,W);return c(e,e.scroll,Ke(),je,Ue)}function xt(){let e=O-w,t=c$1.length-1,s=P??document.documentElement,n=W==="x"?"Width":"Height";if(we=q,q>0&&t>0&&e>0){let y=s[`scroll${n}`]-s[`client${n}`]-1-w-e/M;y>=0&&(we=Math.min(q,y/(t*e)));}let m=Math.max(0,t)*we*e,b=e/Math.min(M,1);Xe=w+Math.min(0,m,b,m+b),Ye=w+Math.max(0,m,b,m+b);}function tt(){(({tStart:w,tEnd:O}=et())),xt(),Ve&&a$3&&(Qe(),Ce=Ht(w,O,W));}function Oe(e,t=et){a$4(r,{type:"draw",getProgress:()=>e.getProgress(),getTrigger:t});let s=e.destroy;return e.destroy=()=>{s.call(e),b$2(r);},e}function rt(e,t){return K&&!Me?Math.max(Le,z(be[e]=Math.max(be[e]??0,t))):z(t)}function At(e,t){if(r.style.setProperty("--scroll-draw-progress",String(e)),D){let s=t==="reverse"?1-e:e;r.style.clipPath=oe(s);return}c$1.forEach((s,n)=>Ne(s,n,e,t));}function Ne(e,t,s,n){e.style.strokeDashoffset=n==="reverse"?`${S[t]*s}`:`${S[t]*(1-s)}`,H&&(e.style.opacity=n==="reverse"?`${1-s}`:`${s}`),ee&&te?e.style.stroke=a$7(ee,te,s):te&&(e.style.stroke=te),X!==null&&re!==null?e.style.strokeWidth=`${X+(re-X)*s}`:re!==null&&(e.style.strokeWidth=`${re}`),Y!==null&&se!==null?e.style.fillOpacity=`${Y+(se-Y)*s}`:se!==null&&(e.style.fillOpacity=`${se}`),L&&e.tagName.toLowerCase()==="path"&&C[t]&&e.setAttribute("d",Rt(C[t],L,s));}function Fe(){if(r.style.setProperty("--scroll-draw-progress","0"),D){r.style.clipPath=oe(u==="reverse"?1:0);return}c$1.forEach((e,t)=>{e.style.strokeDasharray=a$6(S[t]),e.style.strokeDashoffset=u==="reverse"?"0":`${S[t]}`,H?e.style.opacity=u==="reverse"?"1":"0":e.style.opacity="",ee&&(e.style.stroke=ee),X!==null&&(e.style.strokeWidth=`${X}`),Y!==null&&(e.style.fillOpacity=`${Y}`),L&&e.tagName.toLowerCase()==="path"&&C[t]&&e.setAttribute("d",C[t]);});}function me(e,t){let s=e.getAttribute("d"),n=a$5(e);if(L&&C[t]){e.setAttribute("d",L);let m=a$5(e);e.setAttribute("d",C[t]),n=Math.max(a$5(e),m),e.setAttribute("d",s);}S[t]=n,e.style.strokeDasharray=a$6(n);}if(c$1.forEach((e,t)=>{Ft(e);let s=e.tagName.toLowerCase()==="path";s?C.push(e.getAttribute("d")??""):C.push(""),me(e,t);let n=S[t];L&&(s?It(C[C.length-1],L,e):b(`morphTo only applies to <path> elements \u2014 ignored on <${e.tagName}>.`,e)),f$1?(e.style.strokeDashoffset=u==="reverse"?`${n}`:"0",H&&(e.style.opacity="1"),te&&(e.style.stroke=te),re!==null&&(e.style.strokeWidth=`${re}`),se!==null&&(e.style.fillOpacity=`${se}`),L&&e.tagName.toLowerCase()==="path"&&e.setAttribute("d",L)):(e.style.strokeDashoffset=u==="reverse"?"0":`${n}`,H?e.style.opacity=u==="reverse"?"1":"0":e.style.opacity="",ee&&(e.style.stroke=ee),X!==null&&(e.style.strokeWidth=`${X}`),Y!==null&&(e.style.fillOpacity=`${Y}`));}),f$1)return D&&(r.style.clipPath=oe(1)),ve?.(),{destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>1};D&&(r.style.clipPath=oe(u==="reverse"?1:0));let st=typeof xe=="string"?b$1(xe):null;function Mt(){return !(kt===false||ze||Ve&&a$3||!Nt()||!c$1.length||!st||D||W!=="y"||P||M!==1||q!==0||K||Me||fe!==false||L||U||ce||le>0||ue||he||ve||Ge||qe||Be||_e||B!=null||_!=null||j!=null||(ge.start||"top bottom").trim()!=="top bottom"||(ge.end||"bottom top").trim()!=="bottom top")}function Pt(){let e=++Ot,t=`svg-scroll-draw-${e}`,s=`svg-scroll-draw-host-${e}`,n=`--svg-scroll-draw-${e}`,m=u==="reverse"?"0":"var(--ssd-len)",b=u==="reverse"?"var(--ssd-len)":"0",y=`stroke-dashoffset:${m};`,a=`stroke-dashoffset:${b};`;H&&(y+=`opacity:${u==="reverse"?1:0};`,a+=`opacity:${u==="reverse"?0:1};`);let l=document.createElement("style");l.setAttribute("data-svg-scroll-draw",""),l.textContent=`@keyframes ${t}{from{${y}}to{${a}}}.${s}{view-timeline-name:${n};view-timeline-axis:block;}.${t}{animation-name:${t};animation-duration:auto;animation-timing-function:${st};animation-fill-mode:both;animation-timeline:${n};animation-range:cover 0% cover 100%;}`,document.head.appendChild(l),r.classList.add(s);function v(o,i){o.style.setProperty("--ssd-len",String(S[i])),o.style.strokeDasharray=a$6(S[i]),o.style.strokeDashoffset="",o.style.opacity="",o.style.animationPlayState="",o.classList.add(t);}c$1.forEach(v);let g=false,E=-1;function $(){if(E>=0)return E;let o=r.getBoundingClientRect(),{tStart:i,tEnd:h}=c({top:o.top,height:o.height},Te(),Ke(),je,Ue);return z(b$3(Te(),i,h,M))}return {destroy(){r.classList.remove(s),c$1.forEach(o=>{o.classList.remove(t),o.style.removeProperty("--ssd-len"),o.style.animationPlayState="";}),l.remove();},replay(){g=false,E=-1,c$1.forEach(v);},pause(){g=true,c$1.forEach(o=>{o.style.animationPlayState="paused";});},resume(){g&&(g=false,c$1.forEach(o=>{o.style.animationPlayState="running";}));},seek(o){let i=Math.min(1,Math.max(0,o));E=i,g=true,c$1.forEach((h,V)=>{h.classList.remove(t),h.style.strokeDashoffset=u==="reverse"?`${S[V]*i}`:`${S[V]*(1-i)}`,H&&(h.style.opacity=u==="reverse"?`${1-i}`:`${i}`);});},getProgress(){return $()},refresh(){c$1.forEach((o,i)=>{me(o,i),o.style.setProperty("--ssd-len",String(S[i]));});}}}if(Mt())return Oe(Pt());function Lt(){let e=Math.max(1,$t),t=D?e:e*(1+Math.max(0,c$1.length-1)*q),s=0,n=0,m=false;function b(E){let $=true,o=Math.min(1,Math.max(0,E/t));if(D){let i=Math.min(1,Math.max(0,E/e)),h=z(i);N=h,r.style.setProperty("--scroll-draw-progress",String(h)),r.style.clipPath=oe(u==="reverse"?1-h:h),ue?.(h),i<1&&($=false);}else {c$1.forEach((h,V)=>{let Ct=V*q*e,lt=Math.min(1,Math.max(0,(E-Ct)/e));Ne(h,V,z(lt),u),lt<1&&($=false);});let i=z(o);N=i,ue?.(i),r.style.setProperty("--scroll-draw-progress",String(i));}if(U){let i=z(o);for(let h in U){let V=parseFloat(h);i>=V&&!J.has(V)&&(J.add(V),U[h]?.());}}return $}function y(E){if(T)return;let $=E-s;I||(I=true,he?.());let o=b($);if(o&&!k){k=true,b(t),ve?.(),Q<(ce==="infinite"?1/0:ce??0)&&(Q++,Z=setTimeout(()=>{s=performance.now(),I=false,k=false,J.clear(),Fe(),R=requestAnimationFrame(y);},We));return}o||(R=requestAnimationFrame(y));}function a(){cancelAnimationFrame(R),clearTimeout(Z),s=performance.now(),n=0,T=false,I=false,k=false,Q=0,m=true,N=0,J.clear(),Fe(),R=requestAnimationFrame(y);}let l=new IntersectionObserver(E=>{E.forEach($=>{$.isIntersecting&&!(K&&k)?a():!$.isIntersecting&&!K&&!k&&(cancelAnimationFrame(R),clearTimeout(Z),m=false);});},{root:P??null,threshold:St,rootMargin:Tt}),v;function g(){clearTimeout(v),v=setTimeout(()=>c$1.forEach(me),150);}return window.addEventListener("resize",g),window.addEventListener("orientationchange",g),le>0?setTimeout(()=>l.observe(r),le):l.observe(r),{destroy(){cancelAnimationFrame(R),clearTimeout(Z),l.disconnect(),window.removeEventListener("resize",g),window.removeEventListener("orientationchange",g),clearTimeout(v);},replay(){Q=0,a();},pause(){T||!m||(T=true,n=performance.now()-s,cancelAnimationFrame(R));},resume(){T&&(T=false,m=true,s=performance.now()-n,R=requestAnimationFrame(y));},seek(E){let $=Math.min(1,Math.max(0,E));N=$,T=true,n=$*t,s=performance.now()-n,cancelAnimationFrame(R),b(n);},getProgress(){return N},refresh(){clearTimeout(v),c$1.forEach(me);}}}if(ze)return Oe(Lt());tt();let ot=()=>b$3(Te(),Xe,Ye,1);function nt(){k=true,ve?.(),Q<(ce==="infinite"?1/0:ce)&&(Q++,Z=setTimeout(()=>{De=true;},We));}function it(){Le=-1,be=[],I=false,k=false,De=false,J.clear(),Fe(),ne=true;}function Dt(){let e=performance.now(),t=Te();if(De&&ot()%1&&it(),!ne&&fe===false&&t===Ze)return;ne=false,Ze=t;let s=M;if(fe!==false){let a=e-Je,l=a>0?Math.abs(t-(Se<0?t:Se))/a:0;s=M*Math.max(.2,1+l*(typeof fe=="number"?fe:1)*.04);}Se=t,Je=e;let n=Me?Ee===-1||t>=Ee?"forward":"reverse":u;Ee=t;let m=O-w,b=true,y=m===0?0:(t-w)/m;if(isNaN(ie)||(ie<=0&&y>0&&Ge?.(),ie<1&&y>=1&&qe?.(),ie>=1&&y<1&&Be?.(),ie>0&&y<=0&&_e?.()),ie=y,D){let a=rt(0,b$3(t,w,O,s));N=a,r.style.setProperty("--scroll-draw-progress",String(a));let l=n==="reverse"?1-a:a;r.style.clipPath=oe(l),ue?.(a),!I&&b$3(t,w,O,s)>0&&(I=true,he?.()),a>=1&&!k?nt():a<1&&!K&&(k=false);return}if(c$1.forEach((a,l)=>{let v=l*we*m,g=rt(l,b$3(t,w+v,O+v,s));Ne(a,l,g,n),l===0&&(N=g,ue?.(g),r.style.setProperty("--scroll-draw-progress",String(g))),g<1&&(b=false);}),U){let a=z(b$3(t,w,O,s));for(let l in U){let v=parseFloat(l);a>=v&&!J.has(v)&&(J.add(v),U[l]?.());}}!I&&b$3(t,w,O,s)>0&&(I=true,he?.()),b&&!k?nt():!b&&!K&&(k=false);}let pe=e(P??window,[r],ot,Dt,()=>{let e=S.join();c$1.forEach(me),tt(),ne=true,S.join()!==e&&de();}),He=le>0;function de(){pe.hold(T||He);}let at;return He&&(at=setTimeout(()=>{He=false,de();},le)),de(),Oe({destroy(){clearTimeout(Z),clearTimeout(at),pe.off(),Qe();},replay(){it(),Ee=-1,Se=-1,Q=0,T=false,N=0,clearTimeout(Z),de();},pause(){T=true,pe.hold(true);},resume(){T&&(T=false,ne=true,de());},seek(e){let t=Math.min(1,Math.max(0,e));N=t,Le=t,be=[],T=true,pe.hold(true),At(t,u),ne=true;},getProgress(){return N},refresh:pe.remeasure},()=>({tStart:w,tEnd:O}))}export{ht as a,Kt as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(r){return `${r} ${r*2}`}export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {a}from'./chunk-2PYLM3E7.mjs';import {a as a$1,b as b$2,e,c}from'./chunk-NV6YTPHI.mjs';import {f}from'./chunk-IXR6RML7.mjs';import {a as a$2,b as b$3}from'./chunk-EBU6E26L.mjs';import {b as b$1}from'./chunk-LFSU6LR3.mjs';var b={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function U(t,p){if(typeof window>"u")return b;let a$1=typeof t=="string"?document.querySelector(t):t;return a$1?a(p,(l,c)=>N(a$1,l,c)):(b$1("scrollCounter: element not found:",t),b)}function N(t,p,a){let{from:l=0,to:c$1,format:F,easing:L="ease-out",trigger:C={},once:S=true,decimals:P,onComplete:v}=p,E=P!==void 0?e=>e.toFixed(P):F??(e=>String(Math.round(e))),f$1=f(L,"ease-out"),V=a$1(C.start||"top 80%"),_=a$1(C.end||"top 20%");if(a)return t.textContent=E(c$1),v?.(),{...b,getProgress:()=>1};let s=0,i=0,M=false,d=-1,o=0,n=0,u=false,h=()=>window.scrollY,q=()=>window.innerHeight;function x(){let e=t.getBoundingClientRect(),r=c({top:e.top,height:e.height},h(),q(),V,_);M&&Math.abs(r.tStart-s)<1&&Math.abs(r.tEnd-i)<1||(M=true,s=r.tStart,i=r.tEnd);}let B=t.style.getPropertyValue("--scroll-draw-progress");function g(e){t.textContent=E(l+(c$1-l)*e),t.style.setProperty("--scroll-draw-progress",String(e));}let T=()=>b$2(h(),s,i,1);function G(){let e=T(),r=S?Math.max(d,f$1(o=Math.max(o,e))):f$1(e);n=r,g(r),r>=1&&!u?(u=true,v?.()):r<1&&!S&&(u=false);}x();{o=b$2(h(),s,i,1);let e=f$1(o);n=e,g(e);}let m=e(window,[t],T,G,x);a$2(t,{type:"counter",getProgress:()=>n,getTrigger:()=>({tStart:s,tEnd:i})});let O=()=>m.hold(false);return {destroy(){m.off(),t.style.setProperty("--scroll-draw-progress",B),b$3(t);},replay(){d=-1,o=0,u=false,n=0,g(0),O();},pause:()=>m.hold(true),resume:O,seek(e){let r=Math.min(1,Math.max(0,e));n=r,d=r,o=0,m.hold(true),g(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';var B=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function M(e,...n){B&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Y({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function j({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),s=Math.max(.01,Math.min(.99,n)),i=Math.sqrt(s),o=0,r=[];for(let m=0;m<t;m++){let l=Math.pow(i,m);r.push(l),o+=l;}let u=[0],p=0;for(let m=0;m<t;m++)p+=r[m]/o,u.push(p);return m=>{if(m<=0)return 0;if(m>=1)return 1;for(let l=0;l<t;l++)if(m<=u[l+1]){let g=(m-u[l])/(u[l+1]-u[l]);if(l===0)return g*(2-g);let h=1-Math.pow(s,l);return h+(1-h)*(2*g-1)*(2*g-1)}return 1}}function J({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),s=Math.max(.1,n),i=t<=1?s/4:s/(2*Math.PI)*Math.asin(1/t);return o=>o<=0?0:o>=1?1:t*Math.pow(2,-10*o)*Math.sin((o-i)*(2*Math.PI)/s)+1}var S={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:Y(),bounce:j(),elastic:J()};function K(e,n,t,s){let i=(o,r,u)=>((1+3*o-3*r)*u+3*r-6*o)*u*u+3*o*u;return o=>{if(o<=0||o>=1)return +(o>0);let r=o;for(let u=0;u<8;u++)r-=(i(e,t,r)-o)/((3*(1+3*e-3*t)*r+6*t-12*e)*r+3*e);if(!(r>=0&&r<=1&&Math.abs(i(e,t,r)-o)<1e-9))for(let u=0,p=0,m=1;u<30;u++)r=(p+m)/2,i(e,t,r)<o?p=r:m=r;return i(n,s,r)}}function U(e){let n=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=n?n[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [K(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var R=new Set;function k(e,n="linear"){if(typeof e=="function")return e;if(e==null)return S[n];if({}.hasOwnProperty.call(S,e))return S[e];let t=U(String(e));return t?t[0]:(!R.has(e)&&R.add(e)&&M(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),S[n])}function C(e){return `${e} ${e*2}`}var N=Symbol.for("svg-scroll-draw.registry");function O(){let e=globalThis;return e[N]||(e[N]=new Map)}function D(e,n){O().set(e,n);}function T(e){O().delete(e);}function F(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=i=>e(!!i.matches);if(typeof n.addEventListener=="function")return n.addEventListener("change",t),()=>n.removeEventListener("change",t);let s=n;return s.addListener?.(t),()=>s.removeListener?.(t)}var w,L=new Set,x=new WeakMap,v=new Map,H=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function X(e){let n=new Set;for(let t of e)for(;t&&t!==document.body;t=t.parentElement)for(let s=t;s;s=s.previousElementSibling)n.add(s);return n}function P(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();w??(w=new ResizeObserver(i=>{let o=false;for(let{target:r}of i)x.get(r)!==H(r)&&(o=true),x.set(r,"");o&&L.forEach(r=>r());})),L.add(t);let s=X(e);return [document.body,document.documentElement].forEach(i=>i&&s.add(i)),s.forEach(i=>{x.has(i)||x.set(i,H(i)),v.set(i,(v.get(i)??0)+1),w.observe(i);}),()=>{L.delete(t)&&(s.forEach(i=>{let o=(v.get(i)??1)-1;if(o)return void v.set(i,o);v.delete(i),w?.unobserve(i);}),L.size||(w?.disconnect(),w=void 0));}}function G(e,n,t,s,i){let o,r=NaN,u,p,m=()=>{o=0,s(),!u&&!o&&(r=t())>0&&r<1&&(o=requestAnimationFrame(m));},l=()=>{!o&&!u&&t()!==r&&(o=requestAnimationFrame(m));},g=d=>{u=d,cancelAnimationFrame(o),o=r=NaN,l();},h=()=>{clearTimeout(p),i(),l();},y=()=>{clearTimeout(p),p=setTimeout(h,150);},E=P(n,y),a=d=>{e[d]("scroll",l,{passive:true}),window[d]("resize",y),window[d]("orientationchange",y);};return a("addEventListener"),l(),{hold:g,remeasure:h,off(){g(true),a("removeEventListener"),E(),clearTimeout(p);}}}function I(e,n,t){return Math.min(t,Math.max(n,e))}function V(e,n,t,s){return t===n?0:I((e-n)/(t-n)*s,0,1)}var z="http://www.w3.org/2000/svg",Z="cinematic-photo",W=e=>e<0?0:e>1?1:e;function _(e){let n=parseFloat(e);return Number.isFinite(n)?W(n/100):0}function $(e){return k(e)}var Q=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||M("Cinematic: wrapper not found:",n.wrapper);}loadStory(n){let t=this.mount;if(typeof window>"u"||!t)return Q(0);t.style.position="relative",t.style.height=n.totalHeight,t.style.display="block";let s=document.createElement("div");s.setAttribute("data-cinematic-stage",""),s.style.cssText="position:sticky;top:0;height:100vh;width:100%;overflow:hidden;display:block;",t.appendChild(s);let i=[];for(let a of n.scenes){if(a.background){let c=document.createElement("img");c.id=Z,c.src=a.background,c.alt="",c.style.cssText="position:absolute;inset:0;width:100%;height:100%;object-fit:contain;opacity:0;pointer-events:none;",s.appendChild(c);}let d=a.animations.filter(c=>c.type==="draw");if(d.length){let c=document.createElementNS(z,"svg");c.setAttribute("viewBox",`0 0 ${n.canvas.width} ${n.canvas.height}`),c.setAttribute("preserveAspectRatio","xMidYMid meet"),c.style.cssText="position:absolute;inset:0;width:100%;height:100%;overflow:visible;",s.appendChild(c);for(let b of d){let f=document.createElementNS(z,"path");f.id=b.target.replace(/^#/,""),f.setAttribute("d",b.d),f.setAttribute("fill","none"),f.setAttribute("stroke",b.stroke),f.setAttribute("stroke-width",String(b.strokeWidth)),f.setAttribute("stroke-linecap","round"),f.setAttribute("stroke-linejoin","round");let A=b.length||f.getTotalLength?.()||0;f.style.strokeDasharray=C(A),f.style.strokeDashoffset=String(A),c.appendChild(f),i.push({kind:"draw",el:f,start:_(b.start),end:_(b.end),ease:$(b.easing),length:A});}}for(let c of a.animations){if(c.type!=="fade")continue;let b=s.querySelector(c.target)??document.querySelector(c.target);b&&(b.style.opacity=String(c.from),i.push({kind:"fade",el:b,start:_(c.start),end:_(c.end),ease:$("ease-in-out"),from:c.from,to:c.to}));}}let o=0,r=null;for(let a=t.parentElement;a?.parentElement;a=a.parentElement)if(/[ao]/.test(getComputedStyle(a).overflowY)&&a.scrollHeight>a.clientHeight&&(a!==document.body||/[aoh]/.test(getComputedStyle(a.parentElement).overflowY))){r=a;break}let u=0,p=0,m=()=>{let a=t.getBoundingClientRect().top;u=r?a-r.getBoundingClientRect().top-r.clientTop+r.scrollTop:a+window.scrollY,p=u+Math.max(0,t.offsetHeight-(r?r.clientHeight:window.innerHeight));},l=()=>{let a=r?r.scrollTop:window.scrollY;return p<=u?a>=u?1:0:V(a,u,p,1)},g=a=>{for(let d of i){let c=d.end-d.start,b=c<=0?a>=d.end?1:0:W((a-d.start)/c),f=d.ease(b);d.kind==="draw"?d.el.style.strokeDashoffset=String(d.length*(1-f)):d.el.style.opacity=String(d.from+(d.to-d.from)*f);}};if(window.matchMedia("(prefers-reduced-motion: reduce)").matches)return g(1),Q(1);let h=()=>{o=l(),g(o);};m(),h();let y=G(r||window,[t],l,h,m);D(t,{type:"draw",getProgress:()=>o,getTrigger:()=>({tStart:u,tEnd:p})});let E=F(a=>{a&&(E(),y.off(),T(t),o=1,g(1));});return {destroy(){E(),y.off(),T(t);},getProgress:()=>o}}};
|
|
2
|
+
exports.Cinematic=q;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as CssEasing } from '../types-iITMwrru.mjs';
|
|
2
|
+
|
|
3
|
+
type StoryEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic' | CssEasing;
|
|
2
4
|
/** A traced path that strokes itself on across a scroll range. */
|
|
3
5
|
interface DrawAnimation {
|
|
4
6
|
type: 'draw';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { C as CssEasing } from '../types-iITMwrru.js';
|
|
2
|
+
|
|
3
|
+
type StoryEasing = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'spring' | 'bounce' | 'elastic' | CssEasing;
|
|
2
4
|
/** A traced path that strokes itself on across a scroll range. */
|
|
3
5
|
interface DrawAnimation {
|
|
4
6
|
type: 'draw';
|
package/dist/cinematic/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as Cinematic}from'../chunk-
|
|
1
|
+
export{a as Cinematic}from'../chunk-ASCOHQQD.mjs';import'../chunk-YOOPMYT6.mjs';import'../chunk-NV6YTPHI.mjs';import'../chunk-IXR6RML7.mjs';import'../chunk-4DOJSIEQ.mjs';import'../chunk-5PJEKEEP.mjs';import'../chunk-EBU6E26L.mjs';import'../chunk-LFSU6LR3.mjs';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TriggerConfig, E as
|
|
1
|
+
import { T as TriggerConfig, E as Easing } from './types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
interface ScrollAnimateOptions {
|
|
4
4
|
props: Record<string, string | number | [string | number, string | number]>;
|
|
5
5
|
trigger?: TriggerConfig;
|
|
6
|
-
easing?:
|
|
6
|
+
easing?: Easing;
|
|
7
7
|
speed?: number;
|
|
8
8
|
once?: boolean;
|
|
9
9
|
axis?: 'x' | 'y';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { T as TriggerConfig, E as
|
|
1
|
+
import { T as TriggerConfig, E as Easing } from './types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
interface ScrollAnimateOptions {
|
|
4
4
|
props: Record<string, string | number | [string | number, string | number]>;
|
|
5
5
|
trigger?: TriggerConfig;
|
|
6
|
-
easing?:
|
|
6
|
+
easing?: Easing;
|
|
7
7
|
speed?: number;
|
|
8
8
|
once?: boolean;
|
|
9
9
|
axis?: 'x' | 'y';
|
package/dist/frames/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';var Be=typeof __SVG_SCROLL_DRAW_DEV__<"u"?__SVG_SCROLL_DRAW_DEV__:typeof process<"u"&&typeof process.env<"u"&&process.env.NODE_ENV!=="production";function h(e,...n){Be&&console.warn(`[svg-scroll-draw] ${e}`,...n);}function Ue({tension:e=2.5,friction:n=2.2}={}){return t=>1-Math.cos(t*Math.PI*e)*Math.pow(1-t,n)}function Ye({bounces:e=3,decay:n=.5}={}){let t=Math.max(1,Math.round(e)),r=Math.max(.01,Math.min(.99,n)),a=Math.sqrt(r),s=0,u=[];for(let d=0;d<t;d++){let m=Math.pow(a,d);u.push(m),s+=m;}let l=[0],f=0;for(let d=0;d<t;d++)f+=u[d]/s,l.push(f);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 M=1-Math.pow(r,m);return M+(1-M)*(2*b-1)*(2*b-1)}return 1}}function Je({amplitude:e=1,period:n=.4}={}){let t=Math.max(1,e),r=Math.max(.1,n),a=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-a)*(2*Math.PI)/r)+1}var H={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:Ue(),bounce:Ye(),elastic:Je()};function Ke(e,n,t,r){let a=(s,u,l)=>((1+3*s-3*u)*l+3*u-6*s)*l*l+3*s*l;return s=>{if(s<=0||s>=1)return +(s>0);let u=s;for(let l=0;l<8;l++)u-=(a(e,t,u)-s)/((3*(1+3*e-3*t)*u+6*t-12*e)*u+3*e);if(!(u>=0&&u<=1&&Math.abs(a(e,t,u)-s)<1e-9))for(let l=0,f=0,d=1;l<30;l++)u=(f+d)/2,a(e,t,u)<s?f=u:d=u;return a(n,r,u)}}function Xe(e){let n=/^cubic-bezier\((.*)\)$/.exec(e==="ease"?"cubic-bezier(.25,.1,.25,1)":e.trim()),t=n?n[1].split(",").map(parseFloat):[];if(t.length===4&&t.every(Number.isFinite)&&t[0]*(1-t[0])>=0&&t[2]*(1-t[2])>=0)return [Ke(t[0],t[1],t[2],t[3]),`cubic-bezier(${t})`]}var Me=new Set;function xe(e,n="linear"){if(typeof e=="function")return e;if(e==null)return H[n];if({}.hasOwnProperty.call(H,e))return H[e];let t=Xe(String(e));return t?t[0]:(!Me.has(e)&&Me.add(e)&&h(`Unknown easing ${JSON.stringify(e)}: use a name, cubic-bezier() or a function.`),H[n])}function Le(e,n,t){return Math.min(t,Math.max(n,e))}function se(e="top bottom"){let n=e.trim();if(/^\d+(\.\d+)?%$/.test(n))return {element:"top",viewport:n};let[t="top",r="bottom"]=n.split(/\s+/).filter(Boolean);return {element:t,viewport:r}}var _e=(e,n)=>e==="top"?0:e==="center"?.5:e==="bottom"?1:n;function Re(e,n,t,r){return e+t+n*_e(r,0)}function Se(e,n){return n*(/^\d+(\.\d+)?%$/.test(e)?parseFloat(e)/100:_e(e,1))}function Fe(e,n,t,r){return t===n?0:Le((e-n)/(t-n)*r,0,1)}function Te(e,n,t,r,a){let s=Re(e.top,e.height,n,r.element)-Se(r.viewport,t),u=Re(e.top,e.height,n,a.element)-Se(a.viewport,t);return {tStart:s,tEnd:u}}var Ae=Symbol.for("svg-scroll-draw.registry");function Oe(){let e=globalThis;return e[Ae]||(e[Ae]=new Map)}function ze(e,n){Oe().set(e,n);}function Ne(e){Oe().delete(e);}function Pe(e){if(typeof window>"u"||typeof window.matchMedia!="function")return ()=>{};let n=window.matchMedia("(prefers-reduced-motion: reduce)"),t=a=>e(!!a.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 I,B=new Set,U=new WeakMap,k=new Map,Ie=e=>{let n=e.getBoundingClientRect();return n.width+" "+n.height};function je(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 ke(e,n){if(typeof ResizeObserver>"u"||typeof document>"u")return ()=>{};let t=()=>n();I??(I=new ResizeObserver(a=>{let s=false;for(let{target:u}of a)U.get(u)!==Ie(u)&&(s=true),U.set(u,"");s&&B.forEach(u=>u());})),B.add(t);let r=je(e);return [document.body,document.documentElement].forEach(a=>a&&r.add(a)),r.forEach(a=>{U.has(a)||U.set(a,Ie(a)),k.set(a,(k.get(a)??0)+1),I.observe(a);}),()=>{B.delete(t)&&(r.forEach(a=>{let s=(k.get(a)??1)-1;if(s)return void k.set(a,s);k.delete(a),I?.unobserve(a);}),B.size||(I?.disconnect(),I=void 0));}}function Ce(e,n,t,r,a){let s,u=NaN,l,f,d=()=>{s=0,r(),!l&&!s&&(u=t())>0&&u<1&&(s=requestAnimationFrame(d));},m=()=>{!s&&!l&&t()!==u&&(s=requestAnimationFrame(d));},b=E=>{l=E,cancelAnimationFrame(s),s=u=NaN,m();},M=()=>{clearTimeout(f),a(),m();},A=()=>{clearTimeout(f),f=setTimeout(M,150);},J=ke(n,A),w=E=>{e[E]("scroll",m,{passive:true}),window[E]("resize",A),window[E]("orientationchange",A);};return w("addEventListener"),m(),{hold:b,remeasure:M,off(){b(true),w("removeEventListener"),J(),clearTimeout(f);}}}var Y={destroy:()=>{},replay:()=>{},pause:()=>{},resume:()=>{},seek:()=>{},getProgress:()=>0};function Ze(e){let n=e>1?[0,e-1]:[0],t=[[0,e-1]];for(let r=0;r<t.length;r++){let[a,s]=t[r];if(s-a<2)continue;let u=a+s>>1;n.push(u),t.push([a,u],[u,s]);}return n}function bt(e,n){if(typeof window>"u")return Y;let t=typeof e=="string"?document.querySelector(e):e;if(!t||t.tagName.toLowerCase()!=="canvas")return h("scrollFrames: <canvas> element not found:",e),Y;let r=t,{frames:a,trigger:s={},easing:u="linear",once:l=false,axis:f="y",fit:d="cover",triggerElement:m,onReady:b,onLoad:M,onComplete:A,onProgress:J}=n||{},w=Array.isArray(a)?a:null,E=n?.count,L=Math.floor(w?Math.min(E??w.length,w.length):E??NaN);if(!(w||typeof a=="function")||!Number.isFinite(L)||L<1)return h("scrollFrames: no frames. Pass `frames` as an array of URLs, or a function with a finite `count` of 1 or more.",r),Y;let R=n.concurrency??6;(!Number.isFinite(R)||R<1)&&(h("scrollFrames: `concurrency` must be a finite number of 1 or more; using 6.",n.concurrency),R=6),R=Math.floor(R);let K=r.getContext("2d");if(!K)return h("scrollFrames: the canvas has no 2D context.",r),Y;let S=L-1,ae=m??r,v=window.matchMedia("(prefers-reduced-motion: reduce)").matches,De=xe(u),ue=o=>{let i=De(o);return i===i?i:0},We=se(s.start||"top top"),$e=se(s.end||"bottom top"),C=0,D=0,O=false,X=-1,W=0,_=0,$=false,y=false,ce=false,le=false,j=0,Z=-1,Q=new Array(L),ee=new Uint8Array(L),z=new Set,F=v?[S]:Ze(L),te=0,ne=0,de=false,G=(o,...i)=>{if(o)try{o(...i);}catch(c){typeof reportError=="function"?reportError(c):setTimeout(()=>{throw c});}},me=false,Qe=o=>{let i;try{i=w?w[o]:a(o);}catch(c){i=c;}return typeof i=="string"&&i?i:(me||(me=true,h(`scrollFrames: no URL for frame ${o}; it is skipped for its nearest neighbour.`,i)),null)},fe=()=>f==="x"?window.scrollX:window.scrollY,Ge=()=>f==="x"?window.innerWidth:window.innerHeight;function re(){!de&&ne===F.length&&(de=true,G(M));}function oe(){for(;!y&&z.size<R&&te<F.length;){let o=F[te++];ee[o]||Ve(o);}}function Ve(o){ee[o]=1;let i=Qe(o);if(i===null){ne++,queueMicrotask(()=>{y||re();});return}let c=new Image,p=false,g=x=>{p||y||(p=true,c.onload=c.onerror=null,z.delete(c),x?Q[o]=c:h("scrollFrames: a frame failed to load; its nearest neighbour shows instead:",i),ne++,oe(),V(),re());};z.add(c),c.decoding="async",c.onerror=()=>g(false),c.src=i,typeof c.decode=="function"?c.decode().then(()=>g(true),()=>{c.complete?g(c.naturalWidth>0):c.onload=()=>g(true);}):c.onload=()=>g(true);}function qe(o){for(let i=0;i<=S;i++){if(Q[o-i])return o-i;if(Q[o+i])return o+i}return -1}function ie(){let o=r.clientWidth,i=r.clientHeight;if(!o||!i)return;let c=Math.min(window.devicePixelRatio||1,2),p=Math.round(o*c),g=Math.round(i*c);if(Math.abs(r.width-p)<=1&&Math.abs(r.height-g)<=1)return;r.width=p,r.height=g,Z=-1;let x=r.clientWidth,P=r.clientHeight;if(x!==o||P!==i){let T=r.style;x!==o&&P!==i?(T.width=`${o}px`,T.height=`${i}px`):T.aspectRatio=`${o} / ${i}`;}}function V(){let o=qe(j);if(o<0||o===Z)return;let i=Q[o],c=r.width,p=r.height,g=i.naturalWidth||c,x=i.naturalHeight||p,P=(d==="contain"?Math.min:Math.max)(c/g,p/x),T=g*P,Ee=x*P;K.clearRect(0,0,c,p),K.drawImage(i,(c-T)/2,(p-Ee)/2,T,Ee),Z=o,ce||(ce=true,G(b));}function q(o){j=Math.min(S,Math.max(0,Math.round(o*S))),r.style.setProperty("--scroll-draw-progress",String(o)),V(),G(J,o,j);}function pe(){let o=ae.getBoundingClientRect(),i=f==="x"?o.left:o.top,c=f==="x"?o.width:o.height,p=Te({top:i,height:c},fe(),Ge(),We,$e);C=p.tStart,D=p.tEnd,D===C&&c>0&&!v&&!le&&(le=true,h("scrollFrames: zero-length trigger window, so it never scrubs. In a sticky stage, set triggerElement.",r));}let ge=()=>Fe(fe(),C,D,1);function He(){if(v)return;let o=ge(),i=l?Math.max(X,ue(W=Math.max(W,o))):ue(o);_=i,q(i),i>=1&&!$?($=true,G(A)):i<1&&!l&&($=false);}function he(){_=1,q(1);}ie(),v||pe();let N=Ce(window,[ae],ge,He,()=>{ie(),v||pe(),V();}),be=()=>N.hold(O||v);be(),v&&he(),oe();let we=typeof ResizeObserver=="function"?new ResizeObserver(()=>{ie(),V();}):null;we?.observe(r);let ve=v?()=>{}:Pe(o=>{o&&(ve(),v=true,N.hold(true),F=F.slice(0,te),ee[S]||F.push(S),re(),he(),oe());});ze(r,{type:"frames",getProgress:()=>_,getTrigger:()=>({tStart:C,tEnd:D})});function ye(){y||!O||(O=false,be());}return {destroy(){if(!y){y=true,N.off(),we?.disconnect(),ve();for(let o of z)o.onload=o.onerror=null,o.src="";z.clear(),Ne(r);}},replay(){y||(X=-1,W=0,$=false,_=0,q(0),ye());},pause(){y||(O=true,N.hold(true));},resume:ye,seek(o){if(y)return;let i=Math.min(1,Math.max(0,o===o?o:0));_=i,X=i,W=0,O=true,N.hold(true),q(i);},getProgress(){return _}}}exports.scrollFrames=bt;
|
package/dist/frames/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TriggerConfig, E as
|
|
1
|
+
import { T as TriggerConfig, E as Easing, S as ScrollDrawInstance } from '../types-iITMwrru.mjs';
|
|
2
2
|
|
|
3
3
|
interface ScrollFramesOptions {
|
|
4
4
|
/** Image URLs in order, or a function from index (0-based) to URL. */
|
|
@@ -6,7 +6,7 @@ interface ScrollFramesOptions {
|
|
|
6
6
|
/** Number of frames; required when `frames` is a function, else frames.length. */
|
|
7
7
|
count?: number;
|
|
8
8
|
trigger?: TriggerConfig;
|
|
9
|
-
easing?:
|
|
9
|
+
easing?: Easing;
|
|
10
10
|
once?: boolean;
|
|
11
11
|
axis?: 'x' | 'y';
|
|
12
12
|
/**
|
package/dist/frames/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as TriggerConfig, E as
|
|
1
|
+
import { T as TriggerConfig, E as Easing, S as ScrollDrawInstance } from '../types-iITMwrru.js';
|
|
2
2
|
|
|
3
3
|
interface ScrollFramesOptions {
|
|
4
4
|
/** Image URLs in order, or a function from index (0-based) to URL. */
|
|
@@ -6,7 +6,7 @@ interface ScrollFramesOptions {
|
|
|
6
6
|
/** Number of frames; required when `frames` is a function, else frames.length. */
|
|
7
7
|
count?: number;
|
|
8
8
|
trigger?: TriggerConfig;
|
|
9
|
-
easing?:
|
|
9
|
+
easing?: Easing;
|
|
10
10
|
once?: boolean;
|
|
11
11
|
axis?: 'x' | 'y';
|
|
12
12
|
/**
|