@occluze/umber 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /*! Umber v0.2.0 | (c) Ravi Klaassens | UNLICENSED */
2
- "use strict";(()=>{var be=new Set;function W(t,...r){be.has(t)||(be.add(t),console.warn("[umber]",t,...r))}function ve(t,r){return t.ctrlKey||t.defaultPrevented||t.shiftKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)?0:t.deltaY*(t.deltaMode===1?19.2:t.deltaMode===2?r:1)}var qe=/^(Arrow(Up|Down)|Page(Up|Down)|Home|End| |Spacebar|Tab)$/;function ye(t){if(!qe.test(t.key)||t.ctrlKey||t.metaKey||t.altKey)return!1;let r=t.target;return!(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName)))}var te={any:"[data-gl-scroll-prevent],[data-lenis-prevent]",wheel:"[data-gl-scroll-prevent-wheel],[data-lenis-prevent-wheel]",touch:"[data-gl-scroll-prevent-touch],[data-lenis-prevent-touch]"};function ze(t,r,s,l,i,f=!0,d=$e){let o=t.composedPath();for(let b=0;b<o.length;b++){let c=o[b];if(c===r||!c.matches)break;if(c.matches(te.any)||te[s]&&c.matches(te[s])||i&&i(c))return!0;if(!f||!l||c===document.body)continue;let u=d(c);if(u&1&&c.scrollHeight>c.clientHeight&&(u&2||(l<0?c.scrollTop>0:c.scrollTop+c.clientHeight<c.scrollHeight-1)))return!0}return!1}var $e=t=>{let r=getComputedStyle(t);return(/auto|scroll|overlay/.test(r.overflowY)?1:0)+(/contain|none/.test(r.overscrollBehaviorY)?2:0)};function ge(t,r,s,l){let i=l.options,f=l.page;return l.destroyed||l.stopped||f.off||r.defaultPrevented||(t==="anchor"?!i.anchors:t!=="key"&&!i[t])?0:t==="key"?l.locked&&r.key!=="Tab"?1:0:t==="anchor"?l.locked?1:f.limit?2:0:l.reduced||!s||f.snap||f.held||ze(r,f.root,t,s,i.prevent,i.nested,f.style)?0:l.locked?1:!l.active&&(s<0?l.at<=0:l.at>=f.limit)?0:2}function Ee(t){if(t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return null;let r=t.target?.closest?.("a[href]");if(!r||!r.hash||r.target&&r.target!=="_self"||r.hasAttribute("download")||r.origin!==location.origin||r.pathname!==location.pathname||r.search!==location.search)return null;let s=decodeURIComponent(r.hash.slice(1)),l=document.getElementById(s)||(s==="top"?document.documentElement:null);return l&&[r,l]}function Se(t,r){for(let s of[t,r,document.body,document.documentElement]){let l=parseFloat(s?.getAttribute("data-gl-scroll-offset")??"");if(!isNaN(l))return l}return null}function we(t,r,s){if(location.hash!==t.hash){let i=location.href;history.pushState(null,"",t.href),dispatchEvent(new HashChangeEvent("hashchange",{oldURL:i,newURL:location.href}))}if(!s||r===document.documentElement)return;let l=r;!l.hasAttribute("tabindex")&&l.tabIndex<0&&(l.setAttribute("tabindex","-1"),l.addEventListener("blur",()=>l.removeAttribute("tabindex"),{once:!0})),l.focus({preventScroll:!0})}var I="data-gl-scroll-state",je=[()=>window.ScrollTrigger?.update?.()];function Te(t,r){let s=new Set,l="",i=d=>{try{d()}catch(o){console.error("[umber]",o)}},f=d=>{try{d(r())}catch(o){console.error("[umber]",o)}};return{publish(d,o){d&&je.forEach(i),o!==l&&(l=o,o?t.setAttribute(I,o):t.removeAttribute(I)),s.forEach(f)},on(d){return s.add(d),()=>void s.delete(d)},off:d=>void s.delete(d),clear(){s.clear(),t.removeAttribute(I)}}}var Xe="html.lenis, html.has-scroll-smooth, #smooth-wrapper";function Me(t,r,s){let l=window,i=document.documentElement,f=t||i,d=new WeakMap,o=0,b=[],c={root:f,wrapper:t,limit:0,vh:800,gutter:0,version:0,snap:!1,held:!1,off:!1,attr:u=>document.body?.getAttribute(u)??i.getAttribute(u),measure(){let u=t||document.scrollingElement||i,h=Math.max(0,u.scrollHeight-u.clientHeight),w=(t?t.clientHeight:l.innerHeight)||800;(h!==c.limit||w!==c.vh)&&c.version++,c.limit=h,c.vh=w,/stopped/.test(f.getAttribute("data-gl-scroll-state")||"")||(c.gutter=Math.max(0,(t?t.offsetWidth-2*t.clientLeft:l.innerWidth)-f.clientWidth))},revalidate(){o++;let u=getComputedStyle(f),h=t?u:getComputedStyle(document.body);c.snap=(u.scrollSnapType||"none")+(h.scrollSnapType||"none")!=="nonenone",c.held=/hidden|clip/.test(u.overflowY+h.overflowY)||!t&&h.position==="fixed",c.off=/^(off|native)$/.test(c.attr("data-gl-scroll")||"")||!!document.querySelector(Xe)},style(u){let h=d.get(u);if(h===void 0||h>>2!==o){let w=getComputedStyle(u),O=w.overflowY,m=w.overscrollBehaviorY;d.set(u,h=o*4+(O==="auto"||O==="scroll"||O==="overlay"?1:0)+(m==="contain"||m==="none"?2:0))}return h&3},destroy:()=>b.splice(0).forEach(u=>u())};if(c.measure(),c.revalidate(),s){let u=()=>c.measure();if(l.addEventListener("resize",u),b.push(()=>l.removeEventListener("resize",u)),l.ResizeObserver){let h=new ResizeObserver(u);h.observe(r||t?.firstElementChild||i),t&&h.observe(t),b.push(()=>h.disconnect())}}return c}var Ge=`[${I}~=stopped]{overflow:hidden!important}[${I}~=gutter]{scrollbar-gutter:stable!important}[${I}~=smooth] iframe{pointer-events:none}[data-gl-scroll-prevent],[data-lenis-prevent]{overscroll-behavior:contain}`,xe=0,_=null;function Ae(){xe++||(_=document.createElement("style"),_.setAttribute("data-gl-scroll-style",""),_.textContent=Ge,document.head.append(_));let t=!0;return()=>{t&&!(t=!1)&&!--xe&&(_?.remove(),_=null)}}var oe=16.666666666666668,ne=0,re=1,le=2;function Oe(t){let r=0,s=0,l=0,i=-1e9,f=o=>o&&(l=o>0?1:-1),d={written:t,get velocity(){return s},get direction(){return l},recent:(o=performance.now())=>o-i<150,wrote(o,b){d.written=o,r=b},reconcile(o,b,c,u,h){let w=o-d.written;return w<=1.5&&w>=-1.5?ne:b&&u!==r&&!c&&Math.abs(w)<h?re:le},step(o,b){s=o/(b||1),f(o)},native(o,b,c){let u=Math.max(1,(b-i)/oe);s=0,!c&&(u<30&&(s=o/u),i=b,f(o))},rest:()=>void(s=0),turn:f};return d}var Ie=t=>t<1?1-2**(-10*t):1,Je={lerp:.1,duration:0,easing:Ie,wheelMultiplier:1,wheel:!0,touchMultiplier:1,anchors:!0,autoResize:!0,nested:!0},Ze=(t,r,s,l)=>t+(r-t)*(1-Math.pow(1-Math.min(1,s),l*60)),Re=325,et=.5,tt=300,ot=100,nt=1500,rt=100,lt=100,it=30,Le=t=>typeof t=="string"?document.querySelector(t):t instanceof Element?t:null,at=t=>t==null||t.trim()===""?NaN:+t,st=t=>document.body?.getAttribute(t)??document.documentElement.getAttribute(t);function ct(t,r={}){let s=window,l=document.documentElement,i={...Je};/touch/.test(st("data-gl-scroll")||"")&&(i.touch=!0);for(let e in r)r[e]!==void 0&&(i[e]=r[e]);let f=new Set(Object.keys(r).filter(e=>r[e]!==void 0));for(let e of["lerp","duration"]){let n=i[e];Object.defineProperty(i,e,{enumerable:!0,get(){let a=f.has(e)?NaN:at(o.attr("data-gl-scroll-"+e));return a>0||a===0&&e!=="lerp"?a:n},set(a){n=a,f.add(e)}})}let d=i.wrapper===s?null:Le(i.wrapper)||(i.wrapper==null?document.querySelector("[data-gl-scroll-wrapper]"):null);d&&!d.hasAttribute("data-gl-scroll-wrapper")&&W("gl.scroll: mark the wrapper data-gl-scroll-wrapper",d);let o=Me(d,Le(i.content),i.autoResize),b=o.root,c=d||s,u=d?()=>d.scrollTop:()=>s.scrollY||0,h={top:0,behavior:"instant"},w=e=>{h.top=e,y.wrote(e,o.version),(d||s).scrollTo(h)},O=Te(o.root,()=>R),m=u(),g=m,y=Oe(m),v=!1,N=!1,k=!1,M=!1,ae=i.lerp,C=0,$=0,U=0,se=Ie,j=!1,X=null,ce=-1e9,ue=-1e9,G=0,de=0,Q=0,F=0,K=0,T=0,V=!1,H=e=>Math.max(0,Math.min(o.limit,e)),x=e=>O.publish(!!e,N?o.gutter?"stopped gutter":"stopped":v?"smooth":""),me=0,ke=d||document;function _e(){me=performance.now()+ot,ke.dispatchEvent(new CustomEvent("scrollend",{bubbles:!d,detail:{umber:!0}}))}let He=e=>{(v||performance.now()<me)&&!e.detail?.umber&&e.stopImmediatePropagation()};function J(){let e=v;A(),e&&x()}function A(e=u()){D?.(),D=null,v=j=k=!1,X=null,y.rest(),m=g=y.written=e}let D=null,Pe=e=>ue<performance.now()-rt&&fe(e.dt);function Ce(){v=!0,D=t.on("frame",Pe,{phase:"measure",order:-2e3})}function fe(e){if(!v||M)return;let n=u(),a=y.reconcile(n,v,!!T,o.version,o.vh);if(a===le)return A(n),x();if(a===re){let E=n-y.written;m=n,U+=E,g=H(g+E)}let p=m,S;if(C>0){$+=e;let E=Math.min(1,$/C);m=U+(g-U)*se(E),S=E>=1}else m=Ze(m,g,ae,e),S=Math.abs(g-m)<et;if(S&&(m=g),w(m),y.step(m-p,e*60),S){let E=X;A(u()),x(!0),_e(),E?.(R)}else x(!0)}function Y(e,n,a){let p=n.duration??i.duration;j=a,X=n.onComplete||null,k=!!n.lock,ae=n.lerp??i.lerp,p>0?(C=p,$=0,U=m,se=n.easing||i.easing):C=0,y.turn(e-g),g=e,Ce()}function Ue(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^(#|#?top|start)$/.test(e))return 0;if(/^(#?bottom|end)$/.test(e))return 1/0;let a=e[0]==="#"?document.getElementById(decodeURIComponent(e.slice(1))):null;try{e=a||document.querySelector(e)}catch{e=null}}return e instanceof Element?e.getBoundingClientRect().top-(d?d.getBoundingClientRect().top:0)+u()-(parseFloat(getComputedStyle(e).scrollMarginTop)||0)-(parseFloat(getComputedStyle(b).scrollPaddingTop)||0):null}function pe(e,n={}){if(M||(N||k)&&!n.force&&!n.immediate)return;let a=Ue(e);if(a===null||Number.isNaN(a))return W("gl.scroll.scrollTo(): no target",e);if(o.measure(),a=H(a+(n.offset||0)),n.immediate||V){let p=a-(v?m:u());return A(a),w(a),y.native(p,performance.now(),!!n.jump||Math.abs(p)>=o.vh),x(!0),t.wake(1),n.onComplete?.(R)}if(v||A(),o.revalidate(),o.snap||Z){(d||s).scrollTo({top:a,behavior:"smooth"});let p=n.onComplete;if(p){let S=d||document,E=()=>{clearTimeout(We),S.removeEventListener("scrollend",E),p(R)},We=setTimeout(E,nt);S.addEventListener("scrollend",E)}return}Y(a,n,!0)}let Z=!!t.licensed&&t.licence!==!0,B=(e,n,a)=>Z?0:ge(e,n,a,Fe),Fe={page:o,options:i,get destroyed(){return M},get stopped(){return N},get reduced(){return V},get locked(){return k},get active(){return v},get at(){return m}};function Ke(e){e.timeStamp-ce>tt&&o.revalidate(),ce=e.timeStamp,!v&&!M&&A();let n=ve(e,o.vh)*i.wheelMultiplier,a=B("wheel",e,n);a&&(e.preventDefault(),a>1&&Y(H((j?m:g)+n),{},!1))}function Ve(e){if(v||M)return;let n=u();if(y.reconcile(n,!1,!1,o.version,o.vh)===ne)return void(m=g=n);let a=n-y.written;y.native(a,e.timeStamp,Math.abs(a)>=o.vh),m=g=y.written=n,x()}function De(e){ye(e)&&(B("key",e,0)?e.preventDefault():v&&!e.defaultPrevented&&J())}function Ye(e){let n=Ee(e);if(!n)return;let[a,p]=n;o.revalidate();let S=B("anchor",e,0);if(!S||(e.preventDefault(),S===1))return;let E=typeof i.anchors=="object"?i.anchors:{};pe(p===l?0:p,{...E,offset:Se(a,p)??E.offset??0}),we(a,p,!e.detail)}function Be(e){let n=e.touches[0];if(e.type==="touchstart"){if(T=0,M||e.touches.length>1)return;o.revalidate(),de=n.clientX,Q=n.clientY,F=e.timeStamp,K=0,T=1,k||J()}else if(!n)T>2&&Y(H(g+(e.timeStamp-F>lt?0:K*Re)),{lerp:1-Math.exp(-oe/Re)},!1),T=0;else if(T){let a=(Q-n.clientY)*i.touchMultiplier;if(T===1){let S=Math.abs(n.clientX-de)>Math.abs(a)?0:B("touch",e,a);if(S===0)return void(T=0);T=1+S}if(e.cancelable&&e.preventDefault(),T<3)return;let p=e.timeStamp-F;p>0&&(K+=(a/p-K)*Math.min(1,p/it)),Q=n.clientY,F=e.timeStamp,Y(H(g+a),{lerp:1},!1)}}let P=[],L=(e,n,a,p={passive:!0})=>{e.addEventListener(n,a,p),P.push(()=>e.removeEventListener(n,a,p))};if(L(c,"wheel",Ke,{passive:!1}),L(c,"scroll",Ve),L(s,"scrollend",He,{capture:!0}),L(s,"keydown",De,{capture:!1}),L(document,"click",Ye,{capture:!1}),i.touch)for(let e of["touchstart","touchmove","touchend","touchcancel"])L(c,e,Be,{passive:e[5]!="m"});let ee=s.matchMedia?.("(prefers-reduced-motion: reduce)"),he=()=>{V=!!ee?.matches,V&&J()};he(),ee&&L(ee,"change",he),P.push(o.destroy,Ae()),P.push(()=>D?.()),P.push(t.on("destroy",()=>R.destroy())),o.off&&l.classList.contains("lenis")&&W("gl.scroll: Lenis runs here too; the wheel stays with it");let R={get animatedScroll(){return m},get scroll(){return m},get targetScroll(){return g},get actualScroll(){return u()},get limit(){return o.limit},get velocity(){return v||y.recent()?y.velocity:0},get direction(){return y.direction},get progress(){return o.limit?Math.min(1,Math.max(0,m/o.limit)):0},get isScrolling(){return v?"smooth":y.recent()&&"native"},get isStopped(){return N},get isLocked(){return k},rootElement:b,options:i,scrollTo:pe,stop(){N||M||(A(),N=!0,x())},start(){N&&(N=!1,A(),x())},resize(){o.revalidate(),o.measure(),v||A(),x()},on:(e,n)=>e==="scroll"?O.on(n):()=>{},off:(e,n)=>O.off(n),raf(e){ue=performance.now();let n=G?Math.min(.1,Math.max(0,(e-G)/1e3)):1/60;G=e,fe(n)},destroy(){M||(M=!0,v=!1,P.splice(0).forEach(e=>e()),O.clear(),t.scroll===R&&(t.scroll=void 0))}};return t.scroll=R,t.licensed?.().then(e=>Z=!e),R}var q={name:"scroll",version:"0.2.0",attributes:[],install(t,r){ct(t,r)}};var z=window;z.Umber?.use?z.Umber.use(q):((z.UmberModules||=[]).push(q),z.__umber?.engine?.use?.(q));})();
1
+ /*! Umber v0.2.1 | (c) Ravi Klaassens | UNLICENSED */
2
+ "use strict";(()=>{var be=new Set;function W(t,...r){be.has(t)||(be.add(t),console.warn("[umber]",t,...r))}function ve(t,r){return t.ctrlKey||t.defaultPrevented||t.shiftKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)?0:t.deltaY*(t.deltaMode===1?19.2:t.deltaMode===2?r:1)}var qe=/^(Arrow(Up|Down)|Page(Up|Down)|Home|End| |Spacebar|Tab)$/;function ye(t){if(!qe.test(t.key)||t.ctrlKey||t.metaKey||t.altKey)return!1;let r=t.target;return!(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName)))}var te={any:"[data-gl-scroll-prevent],[data-lenis-prevent]",wheel:"[data-gl-scroll-prevent-wheel],[data-lenis-prevent-wheel]",touch:"[data-gl-scroll-prevent-touch],[data-lenis-prevent-touch]"};function ze(t,r,s,l,i,f=!0,d=$e){let o=t.composedPath();for(let b=0;b<o.length;b++){let c=o[b];if(c===r||!c.matches)break;if(c.matches(te.any)||te[s]&&c.matches(te[s])||i&&i(c))return!0;if(!f||!l||c===document.body)continue;let u=d(c);if(u&1&&c.scrollHeight>c.clientHeight&&(u&2||(l<0?c.scrollTop>0:c.scrollTop+c.clientHeight<c.scrollHeight-1)))return!0}return!1}var $e=t=>{let r=getComputedStyle(t);return(/auto|scroll|overlay/.test(r.overflowY)?1:0)+(/contain|none/.test(r.overscrollBehaviorY)?2:0)};function ge(t,r,s,l){let i=l.options,f=l.page;return l.destroyed||l.stopped||f.off||r.defaultPrevented||(t==="anchor"?!i.anchors:t!=="key"&&!i[t])?0:t==="key"?l.locked&&r.key!=="Tab"?1:0:t==="anchor"?l.locked?1:f.limit?2:0:l.reduced||!s||f.snap||f.held||ze(r,f.root,t,s,i.prevent,i.nested,f.style)?0:l.locked?1:!l.active&&(s<0?l.at<=0:l.at>=f.limit)?0:2}function Ee(t){if(t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return null;let r=t.target?.closest?.("a[href]");if(!r||!r.hash||r.target&&r.target!=="_self"||r.hasAttribute("download")||r.origin!==location.origin||r.pathname!==location.pathname||r.search!==location.search)return null;let s=decodeURIComponent(r.hash.slice(1)),l=document.getElementById(s)||(s==="top"?document.documentElement:null);return l&&[r,l]}function Se(t,r){for(let s of[t,r,document.body,document.documentElement]){let l=parseFloat(s?.getAttribute("data-gl-scroll-offset")??"");if(!isNaN(l))return l}return null}function we(t,r,s){if(location.hash!==t.hash){let i=location.href;history.pushState(null,"",t.href),dispatchEvent(new HashChangeEvent("hashchange",{oldURL:i,newURL:location.href}))}if(!s||r===document.documentElement)return;let l=r;!l.hasAttribute("tabindex")&&l.tabIndex<0&&(l.setAttribute("tabindex","-1"),l.addEventListener("blur",()=>l.removeAttribute("tabindex"),{once:!0})),l.focus({preventScroll:!0})}var I="data-gl-scroll-state",je=[()=>window.ScrollTrigger?.update?.()];function Te(t,r){let s=new Set,l="",i=d=>{try{d()}catch(o){console.error("[umber]",o)}},f=d=>{try{d(r())}catch(o){console.error("[umber]",o)}};return{publish(d,o){d&&je.forEach(i),o!==l&&(l=o,o?t.setAttribute(I,o):t.removeAttribute(I)),s.forEach(f)},on(d){return s.add(d),()=>void s.delete(d)},off:d=>void s.delete(d),clear(){s.clear(),t.removeAttribute(I)}}}var Xe="html.lenis, html.has-scroll-smooth, #smooth-wrapper";function Me(t,r,s){let l=window,i=document.documentElement,f=t||i,d=new WeakMap,o=0,b=[],c={root:f,wrapper:t,limit:0,vh:800,gutter:0,version:0,snap:!1,held:!1,off:!1,attr:u=>document.body?.getAttribute(u)??i.getAttribute(u),measure(){let u=t||document.scrollingElement||i,h=Math.max(0,u.scrollHeight-u.clientHeight),w=(t?t.clientHeight:l.innerHeight)||800;(h!==c.limit||w!==c.vh)&&c.version++,c.limit=h,c.vh=w,/stopped/.test(f.getAttribute("data-gl-scroll-state")||"")||(c.gutter=Math.max(0,(t?t.offsetWidth-2*t.clientLeft:l.innerWidth)-f.clientWidth))},revalidate(){o++;let u=getComputedStyle(f),h=t?u:getComputedStyle(document.body);c.snap=(u.scrollSnapType||"none")+(h.scrollSnapType||"none")!=="nonenone",c.held=/hidden|clip/.test(u.overflowY+h.overflowY)||!t&&h.position==="fixed",c.off=/^(off|native)$/.test(c.attr("data-gl-scroll")||"")||!!document.querySelector(Xe)},style(u){let h=d.get(u);if(h===void 0||h>>2!==o){let w=getComputedStyle(u),O=w.overflowY,m=w.overscrollBehaviorY;d.set(u,h=o*4+(O==="auto"||O==="scroll"||O==="overlay"?1:0)+(m==="contain"||m==="none"?2:0))}return h&3},destroy:()=>b.splice(0).forEach(u=>u())};if(c.measure(),c.revalidate(),s){let u=()=>c.measure();if(l.addEventListener("resize",u),b.push(()=>l.removeEventListener("resize",u)),l.ResizeObserver){let h=new ResizeObserver(u);h.observe(r||t?.firstElementChild||i),t&&h.observe(t),b.push(()=>h.disconnect())}}return c}var Ge=`[${I}~=stopped]{overflow:hidden!important}[${I}~=gutter]{scrollbar-gutter:stable!important}[${I}~=smooth] iframe{pointer-events:none}[data-gl-scroll-prevent],[data-lenis-prevent]{overscroll-behavior:contain}`,xe=0,_=null;function Ae(){xe++||(_=document.createElement("style"),_.setAttribute("data-gl-scroll-style",""),_.textContent=Ge,document.head.append(_));let t=!0;return()=>{t&&!(t=!1)&&!--xe&&(_?.remove(),_=null)}}var oe=16.666666666666668,ne=0,re=1,le=2;function Oe(t){let r=0,s=0,l=0,i=-1e9,f=o=>o&&(l=o>0?1:-1),d={written:t,get velocity(){return s},get direction(){return l},recent:(o=performance.now())=>o-i<150,wrote(o,b){d.written=o,r=b},reconcile(o,b,c,u,h){let w=o-d.written;return w<=1.5&&w>=-1.5?ne:b&&u!==r&&!c&&Math.abs(w)<h?re:le},step(o,b){s=o/(b||1),f(o)},native(o,b,c){let u=Math.max(1,(b-i)/oe);s=0,!c&&(u<30&&(s=o/u),i=b,f(o))},rest:()=>void(s=0),turn:f};return d}var Ie=t=>t<1?1-2**(-10*t):1,Je={lerp:.1,duration:0,easing:Ie,wheelMultiplier:1,wheel:!0,touchMultiplier:1,anchors:!0,autoResize:!0,nested:!0},Ze=(t,r,s,l)=>t+(r-t)*(1-Math.pow(1-Math.min(1,s),l*60)),Re=325,et=.5,tt=300,ot=100,nt=1500,rt=100,lt=100,it=30,Le=t=>typeof t=="string"?document.querySelector(t):t instanceof Element?t:null,at=t=>t==null||t.trim()===""?NaN:+t,st=t=>document.body?.getAttribute(t)??document.documentElement.getAttribute(t);function ct(t,r={}){let s=window,l=document.documentElement,i={...Je};/touch/.test(st("data-gl-scroll")||"")&&(i.touch=!0);for(let e in r)r[e]!==void 0&&(i[e]=r[e]);let f=new Set(Object.keys(r).filter(e=>r[e]!==void 0));for(let e of["lerp","duration"]){let n=i[e];Object.defineProperty(i,e,{enumerable:!0,get(){let a=f.has(e)?NaN:at(o.attr("data-gl-scroll-"+e));return a>0||a===0&&e!=="lerp"?a:n},set(a){n=a,f.add(e)}})}let d=i.wrapper===s?null:Le(i.wrapper)||(i.wrapper==null?document.querySelector("[data-gl-scroll-wrapper]"):null);d&&!d.hasAttribute("data-gl-scroll-wrapper")&&W("gl.scroll: mark the wrapper data-gl-scroll-wrapper",d);let o=Me(d,Le(i.content),i.autoResize),b=o.root,c=d||s,u=d?()=>d.scrollTop:()=>s.scrollY||0,h={top:0,behavior:"instant"},w=e=>{h.top=e,y.wrote(e,o.version),(d||s).scrollTo(h)},O=Te(o.root,()=>R),m=u(),g=m,y=Oe(m),v=!1,N=!1,k=!1,M=!1,ae=i.lerp,C=0,$=0,U=0,se=Ie,j=!1,X=null,ce=-1e9,ue=-1e9,G=0,de=0,Q=0,F=0,K=0,T=0,V=!1,H=e=>Math.max(0,Math.min(o.limit,e)),x=e=>O.publish(!!e,N?o.gutter?"stopped gutter":"stopped":v?"smooth":""),me=0,ke=d||document;function _e(){me=performance.now()+ot,ke.dispatchEvent(new CustomEvent("scrollend",{bubbles:!d,detail:{umber:!0}}))}let He=e=>{(v||performance.now()<me)&&!e.detail?.umber&&e.stopImmediatePropagation()};function J(){let e=v;A(),e&&x()}function A(e=u()){D?.(),D=null,v=j=k=!1,X=null,y.rest(),m=g=y.written=e}let D=null,Pe=e=>ue<performance.now()-rt&&fe(e.dt);function Ce(){v=!0,D=t.on("frame",Pe,{phase:"measure",order:-2e3})}function fe(e){if(!v||M)return;let n=u(),a=y.reconcile(n,v,!!T,o.version,o.vh);if(a===le)return A(n),x();if(a===re){let E=n-y.written;m=n,U+=E,g=H(g+E)}let p=m,S;if(C>0){$+=e;let E=Math.min(1,$/C);m=U+(g-U)*se(E),S=E>=1}else m=Ze(m,g,ae,e),S=Math.abs(g-m)<et;if(S&&(m=g),w(m),y.step(m-p,e*60),S){let E=X;A(u()),x(!0),_e(),E?.(R)}else x(!0)}function Y(e,n,a){let p=n.duration??i.duration;j=a,X=n.onComplete||null,k=!!n.lock,ae=n.lerp??i.lerp,p>0?(C=p,$=0,U=m,se=n.easing||i.easing):C=0,y.turn(e-g),g=e,Ce()}function Ue(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^(#|#?top|start)$/.test(e))return 0;if(/^(#?bottom|end)$/.test(e))return 1/0;let a=e[0]==="#"?document.getElementById(decodeURIComponent(e.slice(1))):null;try{e=a||document.querySelector(e)}catch{e=null}}return e instanceof Element?e.getBoundingClientRect().top-(d?d.getBoundingClientRect().top:0)+u()-(parseFloat(getComputedStyle(e).scrollMarginTop)||0)-(parseFloat(getComputedStyle(b).scrollPaddingTop)||0):null}function pe(e,n={}){if(M||(N||k)&&!n.force&&!n.immediate)return;let a=Ue(e);if(a===null||Number.isNaN(a))return W("gl.scroll.scrollTo(): no target",e);if(o.measure(),a=H(a+(n.offset||0)),n.immediate||V){let p=a-(v?m:u());return A(a),w(a),y.native(p,performance.now(),!!n.jump||Math.abs(p)>=o.vh),x(!0),t.wake(1),n.onComplete?.(R)}if(v||A(),o.revalidate(),o.snap||Z){(d||s).scrollTo({top:a,behavior:"smooth"});let p=n.onComplete;if(p){let S=d||document,E=()=>{clearTimeout(We),S.removeEventListener("scrollend",E),p(R)},We=setTimeout(E,nt);S.addEventListener("scrollend",E)}return}Y(a,n,!0)}let Z=!!t.licensed&&t.licence!==!0,B=(e,n,a)=>Z?0:ge(e,n,a,Fe),Fe={page:o,options:i,get destroyed(){return M},get stopped(){return N},get reduced(){return V},get locked(){return k},get active(){return v},get at(){return m}};function Ke(e){e.timeStamp-ce>tt&&o.revalidate(),ce=e.timeStamp,!v&&!M&&A();let n=ve(e,o.vh)*i.wheelMultiplier,a=B("wheel",e,n);a&&(e.preventDefault(),a>1&&Y(H((j?m:g)+n),{},!1))}function Ve(e){if(v||M)return;let n=u();if(y.reconcile(n,!1,!1,o.version,o.vh)===ne)return void(m=g=n);let a=n-y.written;y.native(a,e.timeStamp,Math.abs(a)>=o.vh),m=g=y.written=n,x()}function De(e){ye(e)&&(B("key",e,0)?e.preventDefault():v&&!e.defaultPrevented&&J())}function Ye(e){let n=Ee(e);if(!n)return;let[a,p]=n;o.revalidate();let S=B("anchor",e,0);if(!S||(e.preventDefault(),S===1))return;let E=typeof i.anchors=="object"?i.anchors:{};pe(p===l?0:p,{...E,offset:Se(a,p)??E.offset??0}),we(a,p,!e.detail)}function Be(e){let n=e.touches[0];if(e.type==="touchstart"){if(T=0,M||e.touches.length>1)return;o.revalidate(),de=n.clientX,Q=n.clientY,F=e.timeStamp,K=0,T=1,k||J()}else if(!n)T>2&&Y(H(g+(e.timeStamp-F>lt?0:K*Re)),{lerp:1-Math.exp(-oe/Re)},!1),T=0;else if(T){let a=(Q-n.clientY)*i.touchMultiplier;if(T===1){let S=Math.abs(n.clientX-de)>Math.abs(a)?0:B("touch",e,a);if(S===0)return void(T=0);T=1+S}if(e.cancelable&&e.preventDefault(),T<3)return;let p=e.timeStamp-F;p>0&&(K+=(a/p-K)*Math.min(1,p/it)),Q=n.clientY,F=e.timeStamp,Y(H(g+a),{lerp:1},!1)}}let P=[],L=(e,n,a,p={passive:!0})=>{e.addEventListener(n,a,p),P.push(()=>e.removeEventListener(n,a,p))};if(L(c,"wheel",Ke,{passive:!1}),L(c,"scroll",Ve),L(s,"scrollend",He,{capture:!0}),L(s,"keydown",De,{capture:!1}),L(document,"click",Ye,{capture:!1}),i.touch)for(let e of["touchstart","touchmove","touchend","touchcancel"])L(c,e,Be,{passive:e[5]!="m"});let ee=s.matchMedia?.("(prefers-reduced-motion: reduce)"),he=()=>{V=!!ee?.matches,V&&J()};he(),ee&&L(ee,"change",he),P.push(o.destroy,Ae()),P.push(()=>D?.()),P.push(t.on("destroy",()=>R.destroy())),o.off&&l.classList.contains("lenis")&&W("gl.scroll: Lenis runs here too; the wheel stays with it");let R={get animatedScroll(){return m},get scroll(){return m},get targetScroll(){return g},get actualScroll(){return u()},get limit(){return o.limit},get velocity(){return v||y.recent()?y.velocity:0},get direction(){return y.direction},get progress(){return o.limit?Math.min(1,Math.max(0,m/o.limit)):0},get isScrolling(){return v?"smooth":y.recent()&&"native"},get isStopped(){return N},get isLocked(){return k},rootElement:b,options:i,scrollTo:pe,stop(){N||M||(A(),N=!0,x())},start(){N&&(N=!1,A(),x())},resize(){o.revalidate(),o.measure(),v||A(),x()},on:(e,n)=>e==="scroll"?O.on(n):()=>{},off:(e,n)=>O.off(n),raf(e){ue=performance.now();let n=G?Math.min(.1,Math.max(0,(e-G)/1e3)):1/60;G=e,fe(n)},destroy(){M||(M=!0,v=!1,P.splice(0).forEach(e=>e()),O.clear(),t.scroll===R&&(t.scroll=void 0))}};return t.scroll=R,t.licensed?.().then(e=>Z=!e),R}var q={name:"scroll",version:"0.2.1",attributes:[],install(t,r){ct(t,r)}};var z=window;z.Umber?.use?z.Umber.use(q):((z.UmberModules||=[]).push(q),z.__umber?.engine?.use?.(q));})();
@@ -1,2 +1,2 @@
1
- /*! Umber v0.2.0 | (c) Ravi Klaassens | UNLICENSED */
2
- var be=new Set;function W(t,...r){be.has(t)||(be.add(t),console.warn("[umber]",t,...r))}var Be=19.2;function Z(t,r){return t.ctrlKey||t.defaultPrevented||t.shiftKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)?0:t.deltaY*(t.deltaMode===1?19.2:t.deltaMode===2?r:1)}var We=/^(Arrow(Up|Down)|Page(Up|Down)|Home|End| |Spacebar|Tab)$/;function ee(t){if(!We.test(t.key)||t.ctrlKey||t.metaKey||t.altKey)return!1;let r=t.target;return!(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName)))}var te={any:"[data-gl-scroll-prevent],[data-lenis-prevent]",wheel:"[data-gl-scroll-prevent-wheel],[data-lenis-prevent-wheel]",touch:"[data-gl-scroll-prevent-touch],[data-lenis-prevent-touch]"};function qe(t,r,s,l,i,f=!0,d=ze){let o=t.composedPath();for(let b=0;b<o.length;b++){let c=o[b];if(c===r||!c.matches)break;if(c.matches(te.any)||te[s]&&c.matches(te[s])||i&&i(c))return!0;if(!f||!l||c===document.body)continue;let u=d(c);if(u&1&&c.scrollHeight>c.clientHeight&&(u&2||(l<0?c.scrollTop>0:c.scrollTop+c.clientHeight<c.scrollHeight-1)))return!0}return!1}var ze=t=>{let r=getComputedStyle(t);return(/auto|scroll|overlay/.test(r.overflowY)?1:0)+(/contain|none/.test(r.overscrollBehaviorY)?2:0)};function ve(t,r,s,l){let i=l.options,f=l.page;return l.destroyed||l.stopped||f.off||r.defaultPrevented||(t==="anchor"?!i.anchors:t!=="key"&&!i[t])?0:t==="key"?l.locked&&r.key!=="Tab"?1:0:t==="anchor"?l.locked?1:f.limit?2:0:l.reduced||!s||f.snap||f.held||qe(r,f.root,t,s,i.prevent,i.nested,f.style)?0:l.locked?1:!l.active&&(s<0?l.at<=0:l.at>=f.limit)?0:2}function ye(t){if(t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return null;let r=t.target?.closest?.("a[href]");if(!r||!r.hash||r.target&&r.target!=="_self"||r.hasAttribute("download")||r.origin!==location.origin||r.pathname!==location.pathname||r.search!==location.search)return null;let s=decodeURIComponent(r.hash.slice(1)),l=document.getElementById(s)||(s==="top"?document.documentElement:null);return l&&[r,l]}function ge(t,r){for(let s of[t,r,document.body,document.documentElement]){let l=parseFloat(s?.getAttribute("data-gl-scroll-offset")??"");if(!isNaN(l))return l}return null}function Ee(t,r,s){if(location.hash!==t.hash){let i=location.href;history.pushState(null,"",t.href),dispatchEvent(new HashChangeEvent("hashchange",{oldURL:i,newURL:location.href}))}if(!s||r===document.documentElement)return;let l=r;!l.hasAttribute("tabindex")&&l.tabIndex<0&&(l.setAttribute("tabindex","-1"),l.addEventListener("blur",()=>l.removeAttribute("tabindex"),{once:!0})),l.focus({preventScroll:!0})}var I="data-gl-scroll-state",$e=[()=>globalThis.ScrollTrigger?.update?.()];function Se(t,r){let s=new Set,l="",i=d=>{try{d()}catch(o){console.error("[umber]",o)}},f=d=>{try{d(r())}catch(o){console.error("[umber]",o)}};return{publish(d,o){d&&$e.forEach(i),o!==l&&(l=o,o?t.setAttribute(I,o):t.removeAttribute(I)),s.forEach(f)},on(d){return s.add(d),()=>void s.delete(d)},off:d=>void s.delete(d),clear(){s.clear(),t.removeAttribute(I)}}}var je="html.lenis, html.has-scroll-smooth, #smooth-wrapper";function we(t,r,s){let l=globalThis,i=document.documentElement,f=t||i,d=new WeakMap,o=0,b=[],c={root:f,wrapper:t,limit:0,vh:800,gutter:0,version:0,snap:!1,held:!1,off:!1,attr:u=>document.body?.getAttribute(u)??i.getAttribute(u),measure(){let u=t||document.scrollingElement||i,h=Math.max(0,u.scrollHeight-u.clientHeight),w=(t?t.clientHeight:l.innerHeight)||800;(h!==c.limit||w!==c.vh)&&c.version++,c.limit=h,c.vh=w,/stopped/.test(f.getAttribute("data-gl-scroll-state")||"")||(c.gutter=Math.max(0,(t?t.offsetWidth-2*t.clientLeft:l.innerWidth)-f.clientWidth))},revalidate(){o++;let u=getComputedStyle(f),h=t?u:getComputedStyle(document.body);c.snap=(u.scrollSnapType||"none")+(h.scrollSnapType||"none")!=="nonenone",c.held=/hidden|clip/.test(u.overflowY+h.overflowY)||!t&&h.position==="fixed",c.off=/^(off|native)$/.test(c.attr("data-gl-scroll")||"")||!!document.querySelector(je)},style(u){let h=d.get(u);if(h===void 0||h>>2!==o){let w=getComputedStyle(u),O=w.overflowY,m=w.overscrollBehaviorY;d.set(u,h=o*4+(O==="auto"||O==="scroll"||O==="overlay"?1:0)+(m==="contain"||m==="none"?2:0))}return h&3},destroy:()=>b.splice(0).forEach(u=>u())};if(c.measure(),c.revalidate(),s){let u=()=>c.measure();if(l.addEventListener("resize",u),b.push(()=>l.removeEventListener("resize",u)),l.ResizeObserver){let h=new ResizeObserver(u);h.observe(r||t?.firstElementChild||i),t&&h.observe(t),b.push(()=>h.disconnect())}}return c}var Xe=`[${I}~=stopped]{overflow:hidden!important}[${I}~=gutter]{scrollbar-gutter:stable!important}[${I}~=smooth] iframe{pointer-events:none}[data-gl-scroll-prevent],[data-lenis-prevent]{overscroll-behavior:contain}`,Te=0,H=null;function Me(){Te++||(H=document.createElement("style"),H.setAttribute("data-gl-scroll-style",""),H.textContent=Xe,document.head.append(H));let t=!0;return()=>{t&&!(t=!1)&&!--Te&&(H?.remove(),H=null)}}var oe=16.666666666666668,ne=0,re=1,le=2;function xe(t){let r=0,s=0,l=0,i=-1e9,f=o=>o&&(l=o>0?1:-1),d={written:t,get velocity(){return s},get direction(){return l},recent:(o=performance.now())=>o-i<150,wrote(o,b){d.written=o,r=b},reconcile(o,b,c,u,h){let w=o-d.written;return w<=1.5&&w>=-1.5?ne:b&&u!==r&&!c&&Math.abs(w)<h?re:le},step(o,b){s=o/(b||1),f(o)},native(o,b,c){let u=Math.max(1,(b-i)/oe);s=0,!c&&(u<30&&(s=o/u),i=b,f(o))},rest:()=>void(s=0),turn:f};return d}var Re=t=>t<1?1-2**(-10*t):1,Qe={lerp:.1,duration:0,easing:Re,wheelMultiplier:1,wheel:!0,touchMultiplier:1,anchors:!0,autoResize:!0,nested:!0},Je=(t,r,s,l)=>t+(r-t)*(1-Math.pow(1-Math.min(1,s),l*60)),Oe=325,Ze=.5,et=300,tt=100,ot=1500,nt=100,rt=100,lt=30,Ne=t=>typeof t=="string"?document.querySelector(t):t instanceof Element?t:null,it=t=>t==null||t.trim()===""?NaN:+t,at=t=>document.body?.getAttribute(t)??document.documentElement.getAttribute(t);function st(t,r={}){let s=globalThis,l=document.documentElement,i={...Qe};/touch/.test(at("data-gl-scroll")||"")&&(i.touch=!0);for(let e in r)r[e]!==void 0&&(i[e]=r[e]);let f=new Set(Object.keys(r).filter(e=>r[e]!==void 0));for(let e of["lerp","duration"]){let n=i[e];Object.defineProperty(i,e,{enumerable:!0,get(){let a=f.has(e)?NaN:it(o.attr("data-gl-scroll-"+e));return a>0||a===0&&e!=="lerp"?a:n},set(a){n=a,f.add(e)}})}let d=i.wrapper===s?null:Ne(i.wrapper)||(i.wrapper==null?document.querySelector("[data-gl-scroll-wrapper]"):null);d&&!d.hasAttribute("data-gl-scroll-wrapper")&&W("gl.scroll: mark the wrapper data-gl-scroll-wrapper",d);let o=we(d,Ne(i.content),i.autoResize),b=o.root,c=d||s,u=d?()=>d.scrollTop:()=>s.scrollY||0,h={top:0,behavior:"instant"},w=e=>{h.top=e,y.wrote(e,o.version),(d||s).scrollTo(h)},O=Se(o.root,()=>R),m=u(),g=m,y=xe(m),v=!1,N=!1,k=!1,M=!1,ae=i.lerp,C=0,q=0,F=0,se=Re,z=!1,$=null,ce=-1e9,ue=-1e9,j=0,de=0,X=0,K=0,V=0,T=0,U=!1,P=e=>Math.max(0,Math.min(o.limit,e)),x=e=>O.publish(!!e,N?o.gutter?"stopped gutter":"stopped":v?"smooth":""),me=0,Le=d||document;function Ie(){me=performance.now()+tt,Le.dispatchEvent(new CustomEvent("scrollend",{bubbles:!d,detail:{umber:!0}}))}let ke=e=>{(v||performance.now()<me)&&!e.detail?.umber&&e.stopImmediatePropagation()};function G(){let e=v;A(),e&&x()}function A(e=u()){D?.(),D=null,v=z=k=!1,$=null,y.rest(),m=g=y.written=e}let D=null,He=e=>ue<performance.now()-nt&&fe(e.dt);function Pe(){v=!0,D=t.on("frame",He,{phase:"measure",order:-2e3})}function fe(e){if(!v||M)return;let n=u(),a=y.reconcile(n,v,!!T,o.version,o.vh);if(a===le)return A(n),x();if(a===re){let E=n-y.written;m=n,F+=E,g=P(g+E)}let p=m,S;if(C>0){q+=e;let E=Math.min(1,q/C);m=F+(g-F)*se(E),S=E>=1}else m=Je(m,g,ae,e),S=Math.abs(g-m)<Ze;if(S&&(m=g),w(m),y.step(m-p,e*60),S){let E=$;A(u()),x(!0),Ie(),E?.(R)}else x(!0)}function Y(e,n,a){let p=n.duration??i.duration;z=a,$=n.onComplete||null,k=!!n.lock,ae=n.lerp??i.lerp,p>0?(C=p,q=0,F=m,se=n.easing||i.easing):C=0,y.turn(e-g),g=e,Pe()}function _e(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^(#|#?top|start)$/.test(e))return 0;if(/^(#?bottom|end)$/.test(e))return 1/0;let a=e[0]==="#"?document.getElementById(decodeURIComponent(e.slice(1))):null;try{e=a||document.querySelector(e)}catch{e=null}}return e instanceof Element?e.getBoundingClientRect().top-(d?d.getBoundingClientRect().top:0)+u()-(parseFloat(getComputedStyle(e).scrollMarginTop)||0)-(parseFloat(getComputedStyle(b).scrollPaddingTop)||0):null}function pe(e,n={}){if(M||(N||k)&&!n.force&&!n.immediate)return;let a=_e(e);if(a===null||Number.isNaN(a))return W("gl.scroll.scrollTo(): no target",e);if(o.measure(),a=P(a+(n.offset||0)),n.immediate||U){let p=a-(v?m:u());return A(a),w(a),y.native(p,performance.now(),!!n.jump||Math.abs(p)>=o.vh),x(!0),t.wake(1),n.onComplete?.(R)}if(v||A(),o.revalidate(),o.snap||Q){(d||s).scrollTo({top:a,behavior:"smooth"});let p=n.onComplete;if(p){let S=d||document,E=()=>{clearTimeout(Ye),S.removeEventListener("scrollend",E),p(R)},Ye=setTimeout(E,ot);S.addEventListener("scrollend",E)}return}Y(a,n,!0)}let Q=!!t.licensed&&t.licence!==!0,B=(e,n,a)=>Q?0:ve(e,n,a,Ce),Ce={page:o,options:i,get destroyed(){return M},get stopped(){return N},get reduced(){return U},get locked(){return k},get active(){return v},get at(){return m}};function Fe(e){e.timeStamp-ce>et&&o.revalidate(),ce=e.timeStamp,!v&&!M&&A();let n=Z(e,o.vh)*i.wheelMultiplier,a=B("wheel",e,n);a&&(e.preventDefault(),a>1&&Y(P((z?m:g)+n),{},!1))}function Ke(e){if(v||M)return;let n=u();if(y.reconcile(n,!1,!1,o.version,o.vh)===ne)return void(m=g=n);let a=n-y.written;y.native(a,e.timeStamp,Math.abs(a)>=o.vh),m=g=y.written=n,x()}function Ve(e){ee(e)&&(B("key",e,0)?e.preventDefault():v&&!e.defaultPrevented&&G())}function Ue(e){let n=ye(e);if(!n)return;let[a,p]=n;o.revalidate();let S=B("anchor",e,0);if(!S||(e.preventDefault(),S===1))return;let E=typeof i.anchors=="object"?i.anchors:{};pe(p===l?0:p,{...E,offset:ge(a,p)??E.offset??0}),Ee(a,p,!e.detail)}function De(e){let n=e.touches[0];if(e.type==="touchstart"){if(T=0,M||e.touches.length>1)return;o.revalidate(),de=n.clientX,X=n.clientY,K=e.timeStamp,V=0,T=1,k||G()}else if(!n)T>2&&Y(P(g+(e.timeStamp-K>rt?0:V*Oe)),{lerp:1-Math.exp(-oe/Oe)},!1),T=0;else if(T){let a=(X-n.clientY)*i.touchMultiplier;if(T===1){let S=Math.abs(n.clientX-de)>Math.abs(a)?0:B("touch",e,a);if(S===0)return void(T=0);T=1+S}if(e.cancelable&&e.preventDefault(),T<3)return;let p=e.timeStamp-K;p>0&&(V+=(a/p-V)*Math.min(1,p/lt)),X=n.clientY,K=e.timeStamp,Y(P(g+a),{lerp:1},!1)}}let _=[],L=(e,n,a,p={passive:!0})=>{e.addEventListener(n,a,p),_.push(()=>e.removeEventListener(n,a,p))};if(L(c,"wheel",Fe,{passive:!1}),L(c,"scroll",Ke),L(s,"scrollend",ke,{capture:!0}),L(s,"keydown",Ve,{capture:!1}),L(document,"click",Ue,{capture:!1}),i.touch)for(let e of["touchstart","touchmove","touchend","touchcancel"])L(c,e,De,{passive:e[5]!="m"});let J=s.matchMedia?.("(prefers-reduced-motion: reduce)"),he=()=>{U=!!J?.matches,U&&G()};he(),J&&L(J,"change",he),_.push(o.destroy,Me()),_.push(()=>D?.()),_.push(t.on("destroy",()=>R.destroy())),o.off&&l.classList.contains("lenis")&&W("gl.scroll: Lenis runs here too; the wheel stays with it");let R={get animatedScroll(){return m},get scroll(){return m},get targetScroll(){return g},get actualScroll(){return u()},get limit(){return o.limit},get velocity(){return v||y.recent()?y.velocity:0},get direction(){return y.direction},get progress(){return o.limit?Math.min(1,Math.max(0,m/o.limit)):0},get isScrolling(){return v?"smooth":y.recent()&&"native"},get isStopped(){return N},get isLocked(){return k},rootElement:b,options:i,scrollTo:pe,stop(){N||M||(A(),N=!0,x())},start(){N&&(N=!1,A(),x())},resize(){o.revalidate(),o.measure(),v||A(),x()},on:(e,n)=>e==="scroll"?O.on(n):()=>{},off:(e,n)=>O.off(n),raf(e){ue=performance.now();let n=j?Math.min(.1,Math.max(0,(e-j)/1e3)):1/60;j=e,fe(n)},destroy(){M||(M=!0,v=!1,_.splice(0).forEach(e=>e()),O.clear(),t.scroll===R&&(t.scroll=void 0))}};return t.scroll=R,t.licensed?.().then(e=>Q=!e),R}var ct={name:"scroll",version:"0.2.0",attributes:[],install(t,r){st(t,r)}},Ot=ct;export{Qe as DEFAULTS,Be as LINE,ct as Scroll,Je as damp,Ot as default,Re as expoOut,ee as scrollKey,st as smoothScroll,Z as wheelY};
1
+ /*! Umber v0.2.1 | (c) Ravi Klaassens | UNLICENSED */
2
+ var be=new Set;function W(t,...r){be.has(t)||(be.add(t),console.warn("[umber]",t,...r))}var Be=19.2;function Z(t,r){return t.ctrlKey||t.defaultPrevented||t.shiftKey||Math.abs(t.deltaX)>Math.abs(t.deltaY)?0:t.deltaY*(t.deltaMode===1?19.2:t.deltaMode===2?r:1)}var We=/^(Arrow(Up|Down)|Page(Up|Down)|Home|End| |Spacebar|Tab)$/;function ee(t){if(!We.test(t.key)||t.ctrlKey||t.metaKey||t.altKey)return!1;let r=t.target;return!(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName)))}var te={any:"[data-gl-scroll-prevent],[data-lenis-prevent]",wheel:"[data-gl-scroll-prevent-wheel],[data-lenis-prevent-wheel]",touch:"[data-gl-scroll-prevent-touch],[data-lenis-prevent-touch]"};function qe(t,r,s,l,i,f=!0,d=ze){let o=t.composedPath();for(let b=0;b<o.length;b++){let c=o[b];if(c===r||!c.matches)break;if(c.matches(te.any)||te[s]&&c.matches(te[s])||i&&i(c))return!0;if(!f||!l||c===document.body)continue;let u=d(c);if(u&1&&c.scrollHeight>c.clientHeight&&(u&2||(l<0?c.scrollTop>0:c.scrollTop+c.clientHeight<c.scrollHeight-1)))return!0}return!1}var ze=t=>{let r=getComputedStyle(t);return(/auto|scroll|overlay/.test(r.overflowY)?1:0)+(/contain|none/.test(r.overscrollBehaviorY)?2:0)};function ve(t,r,s,l){let i=l.options,f=l.page;return l.destroyed||l.stopped||f.off||r.defaultPrevented||(t==="anchor"?!i.anchors:t!=="key"&&!i[t])?0:t==="key"?l.locked&&r.key!=="Tab"?1:0:t==="anchor"?l.locked?1:f.limit?2:0:l.reduced||!s||f.snap||f.held||qe(r,f.root,t,s,i.prevent,i.nested,f.style)?0:l.locked?1:!l.active&&(s<0?l.at<=0:l.at>=f.limit)?0:2}function ye(t){if(t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return null;let r=t.target?.closest?.("a[href]");if(!r||!r.hash||r.target&&r.target!=="_self"||r.hasAttribute("download")||r.origin!==location.origin||r.pathname!==location.pathname||r.search!==location.search)return null;let s=decodeURIComponent(r.hash.slice(1)),l=document.getElementById(s)||(s==="top"?document.documentElement:null);return l&&[r,l]}function ge(t,r){for(let s of[t,r,document.body,document.documentElement]){let l=parseFloat(s?.getAttribute("data-gl-scroll-offset")??"");if(!isNaN(l))return l}return null}function Ee(t,r,s){if(location.hash!==t.hash){let i=location.href;history.pushState(null,"",t.href),dispatchEvent(new HashChangeEvent("hashchange",{oldURL:i,newURL:location.href}))}if(!s||r===document.documentElement)return;let l=r;!l.hasAttribute("tabindex")&&l.tabIndex<0&&(l.setAttribute("tabindex","-1"),l.addEventListener("blur",()=>l.removeAttribute("tabindex"),{once:!0})),l.focus({preventScroll:!0})}var I="data-gl-scroll-state",$e=[()=>globalThis.ScrollTrigger?.update?.()];function Se(t,r){let s=new Set,l="",i=d=>{try{d()}catch(o){console.error("[umber]",o)}},f=d=>{try{d(r())}catch(o){console.error("[umber]",o)}};return{publish(d,o){d&&$e.forEach(i),o!==l&&(l=o,o?t.setAttribute(I,o):t.removeAttribute(I)),s.forEach(f)},on(d){return s.add(d),()=>void s.delete(d)},off:d=>void s.delete(d),clear(){s.clear(),t.removeAttribute(I)}}}var je="html.lenis, html.has-scroll-smooth, #smooth-wrapper";function we(t,r,s){let l=globalThis,i=document.documentElement,f=t||i,d=new WeakMap,o=0,b=[],c={root:f,wrapper:t,limit:0,vh:800,gutter:0,version:0,snap:!1,held:!1,off:!1,attr:u=>document.body?.getAttribute(u)??i.getAttribute(u),measure(){let u=t||document.scrollingElement||i,h=Math.max(0,u.scrollHeight-u.clientHeight),w=(t?t.clientHeight:l.innerHeight)||800;(h!==c.limit||w!==c.vh)&&c.version++,c.limit=h,c.vh=w,/stopped/.test(f.getAttribute("data-gl-scroll-state")||"")||(c.gutter=Math.max(0,(t?t.offsetWidth-2*t.clientLeft:l.innerWidth)-f.clientWidth))},revalidate(){o++;let u=getComputedStyle(f),h=t?u:getComputedStyle(document.body);c.snap=(u.scrollSnapType||"none")+(h.scrollSnapType||"none")!=="nonenone",c.held=/hidden|clip/.test(u.overflowY+h.overflowY)||!t&&h.position==="fixed",c.off=/^(off|native)$/.test(c.attr("data-gl-scroll")||"")||!!document.querySelector(je)},style(u){let h=d.get(u);if(h===void 0||h>>2!==o){let w=getComputedStyle(u),O=w.overflowY,m=w.overscrollBehaviorY;d.set(u,h=o*4+(O==="auto"||O==="scroll"||O==="overlay"?1:0)+(m==="contain"||m==="none"?2:0))}return h&3},destroy:()=>b.splice(0).forEach(u=>u())};if(c.measure(),c.revalidate(),s){let u=()=>c.measure();if(l.addEventListener("resize",u),b.push(()=>l.removeEventListener("resize",u)),l.ResizeObserver){let h=new ResizeObserver(u);h.observe(r||t?.firstElementChild||i),t&&h.observe(t),b.push(()=>h.disconnect())}}return c}var Xe=`[${I}~=stopped]{overflow:hidden!important}[${I}~=gutter]{scrollbar-gutter:stable!important}[${I}~=smooth] iframe{pointer-events:none}[data-gl-scroll-prevent],[data-lenis-prevent]{overscroll-behavior:contain}`,Te=0,H=null;function Me(){Te++||(H=document.createElement("style"),H.setAttribute("data-gl-scroll-style",""),H.textContent=Xe,document.head.append(H));let t=!0;return()=>{t&&!(t=!1)&&!--Te&&(H?.remove(),H=null)}}var oe=16.666666666666668,ne=0,re=1,le=2;function xe(t){let r=0,s=0,l=0,i=-1e9,f=o=>o&&(l=o>0?1:-1),d={written:t,get velocity(){return s},get direction(){return l},recent:(o=performance.now())=>o-i<150,wrote(o,b){d.written=o,r=b},reconcile(o,b,c,u,h){let w=o-d.written;return w<=1.5&&w>=-1.5?ne:b&&u!==r&&!c&&Math.abs(w)<h?re:le},step(o,b){s=o/(b||1),f(o)},native(o,b,c){let u=Math.max(1,(b-i)/oe);s=0,!c&&(u<30&&(s=o/u),i=b,f(o))},rest:()=>void(s=0),turn:f};return d}var Re=t=>t<1?1-2**(-10*t):1,Qe={lerp:.1,duration:0,easing:Re,wheelMultiplier:1,wheel:!0,touchMultiplier:1,anchors:!0,autoResize:!0,nested:!0},Je=(t,r,s,l)=>t+(r-t)*(1-Math.pow(1-Math.min(1,s),l*60)),Oe=325,Ze=.5,et=300,tt=100,ot=1500,nt=100,rt=100,lt=30,Ne=t=>typeof t=="string"?document.querySelector(t):t instanceof Element?t:null,it=t=>t==null||t.trim()===""?NaN:+t,at=t=>document.body?.getAttribute(t)??document.documentElement.getAttribute(t);function st(t,r={}){let s=globalThis,l=document.documentElement,i={...Qe};/touch/.test(at("data-gl-scroll")||"")&&(i.touch=!0);for(let e in r)r[e]!==void 0&&(i[e]=r[e]);let f=new Set(Object.keys(r).filter(e=>r[e]!==void 0));for(let e of["lerp","duration"]){let n=i[e];Object.defineProperty(i,e,{enumerable:!0,get(){let a=f.has(e)?NaN:it(o.attr("data-gl-scroll-"+e));return a>0||a===0&&e!=="lerp"?a:n},set(a){n=a,f.add(e)}})}let d=i.wrapper===s?null:Ne(i.wrapper)||(i.wrapper==null?document.querySelector("[data-gl-scroll-wrapper]"):null);d&&!d.hasAttribute("data-gl-scroll-wrapper")&&W("gl.scroll: mark the wrapper data-gl-scroll-wrapper",d);let o=we(d,Ne(i.content),i.autoResize),b=o.root,c=d||s,u=d?()=>d.scrollTop:()=>s.scrollY||0,h={top:0,behavior:"instant"},w=e=>{h.top=e,y.wrote(e,o.version),(d||s).scrollTo(h)},O=Se(o.root,()=>R),m=u(),g=m,y=xe(m),v=!1,N=!1,k=!1,M=!1,ae=i.lerp,C=0,q=0,F=0,se=Re,z=!1,$=null,ce=-1e9,ue=-1e9,j=0,de=0,X=0,K=0,V=0,T=0,U=!1,P=e=>Math.max(0,Math.min(o.limit,e)),x=e=>O.publish(!!e,N?o.gutter?"stopped gutter":"stopped":v?"smooth":""),me=0,Le=d||document;function Ie(){me=performance.now()+tt,Le.dispatchEvent(new CustomEvent("scrollend",{bubbles:!d,detail:{umber:!0}}))}let ke=e=>{(v||performance.now()<me)&&!e.detail?.umber&&e.stopImmediatePropagation()};function G(){let e=v;A(),e&&x()}function A(e=u()){D?.(),D=null,v=z=k=!1,$=null,y.rest(),m=g=y.written=e}let D=null,He=e=>ue<performance.now()-nt&&fe(e.dt);function Pe(){v=!0,D=t.on("frame",He,{phase:"measure",order:-2e3})}function fe(e){if(!v||M)return;let n=u(),a=y.reconcile(n,v,!!T,o.version,o.vh);if(a===le)return A(n),x();if(a===re){let E=n-y.written;m=n,F+=E,g=P(g+E)}let p=m,S;if(C>0){q+=e;let E=Math.min(1,q/C);m=F+(g-F)*se(E),S=E>=1}else m=Je(m,g,ae,e),S=Math.abs(g-m)<Ze;if(S&&(m=g),w(m),y.step(m-p,e*60),S){let E=$;A(u()),x(!0),Ie(),E?.(R)}else x(!0)}function Y(e,n,a){let p=n.duration??i.duration;z=a,$=n.onComplete||null,k=!!n.lock,ae=n.lerp??i.lerp,p>0?(C=p,q=0,F=m,se=n.easing||i.easing):C=0,y.turn(e-g),g=e,Pe()}function _e(e){if(typeof e=="number")return e;if(typeof e=="string"){if(/^(#|#?top|start)$/.test(e))return 0;if(/^(#?bottom|end)$/.test(e))return 1/0;let a=e[0]==="#"?document.getElementById(decodeURIComponent(e.slice(1))):null;try{e=a||document.querySelector(e)}catch{e=null}}return e instanceof Element?e.getBoundingClientRect().top-(d?d.getBoundingClientRect().top:0)+u()-(parseFloat(getComputedStyle(e).scrollMarginTop)||0)-(parseFloat(getComputedStyle(b).scrollPaddingTop)||0):null}function pe(e,n={}){if(M||(N||k)&&!n.force&&!n.immediate)return;let a=_e(e);if(a===null||Number.isNaN(a))return W("gl.scroll.scrollTo(): no target",e);if(o.measure(),a=P(a+(n.offset||0)),n.immediate||U){let p=a-(v?m:u());return A(a),w(a),y.native(p,performance.now(),!!n.jump||Math.abs(p)>=o.vh),x(!0),t.wake(1),n.onComplete?.(R)}if(v||A(),o.revalidate(),o.snap||Q){(d||s).scrollTo({top:a,behavior:"smooth"});let p=n.onComplete;if(p){let S=d||document,E=()=>{clearTimeout(Ye),S.removeEventListener("scrollend",E),p(R)},Ye=setTimeout(E,ot);S.addEventListener("scrollend",E)}return}Y(a,n,!0)}let Q=!!t.licensed&&t.licence!==!0,B=(e,n,a)=>Q?0:ve(e,n,a,Ce),Ce={page:o,options:i,get destroyed(){return M},get stopped(){return N},get reduced(){return U},get locked(){return k},get active(){return v},get at(){return m}};function Fe(e){e.timeStamp-ce>et&&o.revalidate(),ce=e.timeStamp,!v&&!M&&A();let n=Z(e,o.vh)*i.wheelMultiplier,a=B("wheel",e,n);a&&(e.preventDefault(),a>1&&Y(P((z?m:g)+n),{},!1))}function Ke(e){if(v||M)return;let n=u();if(y.reconcile(n,!1,!1,o.version,o.vh)===ne)return void(m=g=n);let a=n-y.written;y.native(a,e.timeStamp,Math.abs(a)>=o.vh),m=g=y.written=n,x()}function Ve(e){ee(e)&&(B("key",e,0)?e.preventDefault():v&&!e.defaultPrevented&&G())}function Ue(e){let n=ye(e);if(!n)return;let[a,p]=n;o.revalidate();let S=B("anchor",e,0);if(!S||(e.preventDefault(),S===1))return;let E=typeof i.anchors=="object"?i.anchors:{};pe(p===l?0:p,{...E,offset:ge(a,p)??E.offset??0}),Ee(a,p,!e.detail)}function De(e){let n=e.touches[0];if(e.type==="touchstart"){if(T=0,M||e.touches.length>1)return;o.revalidate(),de=n.clientX,X=n.clientY,K=e.timeStamp,V=0,T=1,k||G()}else if(!n)T>2&&Y(P(g+(e.timeStamp-K>rt?0:V*Oe)),{lerp:1-Math.exp(-oe/Oe)},!1),T=0;else if(T){let a=(X-n.clientY)*i.touchMultiplier;if(T===1){let S=Math.abs(n.clientX-de)>Math.abs(a)?0:B("touch",e,a);if(S===0)return void(T=0);T=1+S}if(e.cancelable&&e.preventDefault(),T<3)return;let p=e.timeStamp-K;p>0&&(V+=(a/p-V)*Math.min(1,p/lt)),X=n.clientY,K=e.timeStamp,Y(P(g+a),{lerp:1},!1)}}let _=[],L=(e,n,a,p={passive:!0})=>{e.addEventListener(n,a,p),_.push(()=>e.removeEventListener(n,a,p))};if(L(c,"wheel",Fe,{passive:!1}),L(c,"scroll",Ke),L(s,"scrollend",ke,{capture:!0}),L(s,"keydown",Ve,{capture:!1}),L(document,"click",Ue,{capture:!1}),i.touch)for(let e of["touchstart","touchmove","touchend","touchcancel"])L(c,e,De,{passive:e[5]!="m"});let J=s.matchMedia?.("(prefers-reduced-motion: reduce)"),he=()=>{U=!!J?.matches,U&&G()};he(),J&&L(J,"change",he),_.push(o.destroy,Me()),_.push(()=>D?.()),_.push(t.on("destroy",()=>R.destroy())),o.off&&l.classList.contains("lenis")&&W("gl.scroll: Lenis runs here too; the wheel stays with it");let R={get animatedScroll(){return m},get scroll(){return m},get targetScroll(){return g},get actualScroll(){return u()},get limit(){return o.limit},get velocity(){return v||y.recent()?y.velocity:0},get direction(){return y.direction},get progress(){return o.limit?Math.min(1,Math.max(0,m/o.limit)):0},get isScrolling(){return v?"smooth":y.recent()&&"native"},get isStopped(){return N},get isLocked(){return k},rootElement:b,options:i,scrollTo:pe,stop(){N||M||(A(),N=!0,x())},start(){N&&(N=!1,A(),x())},resize(){o.revalidate(),o.measure(),v||A(),x()},on:(e,n)=>e==="scroll"?O.on(n):()=>{},off:(e,n)=>O.off(n),raf(e){ue=performance.now();let n=j?Math.min(.1,Math.max(0,(e-j)/1e3)):1/60;j=e,fe(n)},destroy(){M||(M=!0,v=!1,_.splice(0).forEach(e=>e()),O.clear(),t.scroll===R&&(t.scroll=void 0))}};return t.scroll=R,t.licensed?.().then(e=>Q=!e),R}var ct={name:"scroll",version:"0.2.1",attributes:[],install(t,r){st(t,r)}},Ot=ct;export{Qe as DEFAULTS,Be as LINE,ct as Scroll,Je as damp,Ot as default,Re as expoOut,ee as scrollKey,st as smoothScroll,Z as wheelY};
@@ -1,8 +1,8 @@
1
- /*! Umber v0.2.0 | (c) Ravi Klaassens | UNLICENSED */
1
+ /*! Umber v0.2.1 | (c) Ravi Klaassens | UNLICENSED */
2
2
  "use strict";(()=>{function qe(n){let e=n.trim().toLowerCase();if(e===""||e==="true"||e==="1"||e==="yes")return!0;if(e==="false"||e==="0"||e==="no")return!1}function Ee(n,e){let t=n.trim();if(e==="number"){let r=parseFloat(t);return Number.isFinite(r)?r:void 0}return e==="boolean"?qe(t):e==="list"?t.split(/[\s,]+/).filter(Boolean):t.replace(/^["']|["']$/g,"")}function Xe(n){return n.type?n.type:typeof n.default=="number"?"number":typeof n.default=="boolean"?"boolean":Array.isArray(n.default)?"list":"string"}var xe=n=>n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function Te(n,e,t,r){if(typeof e=="string"){let o=e.replace(/^data-/,""),i=t||{},a={};for(let s in i)a[s]={attr:`data-${o}-${xe(s)}`,css:`--${o}-${xe(s)}`,default:i[s]};return ke(n,a,r)}return ke(n,e,t)}function ke(n,e,t){let r={},o=t;for(let i in e){let a=e[i],s=Xe(a),f;if(a.attr){let l=n.getAttribute(a.attr);l!==null&&(f=Ee(l,s))}if(f===void 0&&a.css){o||=getComputedStyle(n);let l=o.getPropertyValue(a.css);l&&l.trim()!==""&&(f=Ee(l,s))}r[i]=f===void 0?a.default:f}return r}var Ae={top:0,left:0,center:.5,middle:.5,bottom:1,right:1};function Ke(n){let e=/^(top|left|center|middle|bottom|right|-?\d*\.?\d+(?:px|%)?)?(?:([+-])=?(\d*\.?\d+)(px|%)?)?$/.exec(n);if(!e||!e[1]&&!e[2])return null;let t=0,r=0;if(e[1]&&e[1]in Ae)t=Ae[e[1]];else if(e[1]){let o=parseFloat(e[1]);e[1].endsWith("%")?t=o/100:r=o}if(e[2]){let o=parseFloat(e[3])*(e[2]==="-"?-1:1);e[4]==="%"?t+=o/100:r+=o}return[t,r]}function K(n,e){let t=(n||"").trim().toLowerCase();if(!t)return e;let r=Ke(t);return r?/^[+-]/.test(t)&&!/^-\d/.test(t)?[e[0]+r[0],e[1]+r[1]]:r:e}var Qe={cover:"0110",contain:"11000011",entry:"01110100",exit:"00101110","entry-crossing":"0111","exit-crossing":"0010"};function Ye(n,e){let t=Qe[n[0]],r=n[1]||(e?"100%":"0%"),o=r.endsWith("%")?0:parseFloat(r)||0,i=o?0:parseFloat(r)/100||0,a=s=>({el:+t[s]+(+t[s+2]-+t[s])*i,elPx:o,vp:+t[s+1]+(+t[s+3]-+t[s+1])*i,vpPx:0});return t?{...a(0),alt:t[4]?a(4):void 0}:null}function Q(n,e){let t=(n||e).trim().split(/\s+/),r=Ye(t.map(l=>l.toLowerCase()),e.startsWith("bottom"));if(r)return r;let o=e.split(/\s+/),[i,a]=K(t[0],K(o[0],[0,0])),[s,f]=K(t[1],K(o[1],[0,0]));return{el:i,elPx:a,vp:s,vpPx:f}}function fe(n,e,t,r,o){let i=l=>(l.alt&&e>t&&(l=l.alt),n+e*l.el+l.elPx-(t*l.vp+l.vpPx)),a=i(r),s=i(o),f=a-s;return Math.abs(f)>1e-6?Math.min(1,Math.max(0,a/f)):a<=0?1:0}function Ue(n,e,t,r){return!(t>0)||!(r>0)?e:n+(e-n)*(1-Math.exp(-r/t))}function Ce(n,e,t,r,o){if(e<=0)return null;let i=Math.max(0,Math.min(e-1,n)),a=Math.floor(i),s=i-a;if(o&&s>.001&&a+1<e&&t(a)&&t(a+1))return{a,b:a+1,mix:s};let f=Math.round(i);if(t(f))return{a:f,b:-1,mix:0};let l=-1;for(let M of r())(l<0||Math.abs(M-i)<Math.abs(l-i))&&(l=M);return l<0?null:{a:l,b:-1,mix:0}}function Fe(n,e){return n.replace(/\{(\d+)\}/,(t,r)=>String(parseInt(r,10)+e).padStart(r.length,"0"))}var Re=(n,e)=>String.fromCharCode(n[e],n[e+1],n[e+2],n[e+3]);function W(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function G(n,e,t=n.length){if(e+8>t)return null;let r=W(n),o=r.getUint32(e),i=Re(n,e+4),a=e+8;if(o===1){if(e+16>t)return null;o=r.getUint32(e+8)*2**32+r.getUint32(e+12),a=e+16}else o===0&&(o=1/0);return o<a-e?null:{type:i,start:e,body:a,end:e+o}}function me(n,e,t){let r=[],o=e;for(;o<t;){let i=G(n,o,t);if(!i||i.end>t||i.end<=o)break;r.push(i),o=i.end}return r}var V=(n,e,t)=>me(n,e.body,e.end).find(r=>r.type===t)||null;function Y(n,e,...t){for(let r of t){if(!e)return null;e=V(n,e,r)}return e}function Ge(n){let e=t=>t.toString(16).padStart(2,"0");return`avc1.${e(n[1])}${e(n[2])}${e(n[3])}`}function Pe(n,e){let t=V(n,e,"mvhd"),r=t?W(n).getUint32(t.body+(n[t.body]===1?20:12)):0;for(let o of me(n,e.body,e.end)){if(o.type!=="trak")continue;let i=Y(n,o,"mdia","hdlr");if(!i||Re(n,i.body+8)!=="vide")continue;let a=Ze(n,o,r);if(a)return V(n,e,"mvex")&&(a.fragmented=!0),a}return null}function Ze(n,e,t){let r=W(n),o=Y(n,e,"mdia","mdhd"),i=Y(n,e,"mdia","minf","stbl");if(!o||!i)return null;let a=n[o.body]===1,s=r.getUint32(o.body+(a?20:12))||1,f=V(n,i,"stsd");if(!f)return null;let l=G(n,f.body+8,f.end);if(!l)return null;let M=l.type,E=r.getUint16(l.body+24),w=r.getUint16(l.body+26),U="",F=null,m=me(n,l.body+78,l.end).find(u=>u.type==="avcC");m&&(M==="avc1"||M==="avc3")&&(F=n.slice(m.body,m.end),U=Ge(F));let x=V(n,e,"tkhd");if(x){let u=x.body+(n[x.body]===1?88:76);if(u+8<=x.end){let v=r.getUint32(u)/65536,C=r.getUint32(u+4)/65536;v&&C&&(E=Math.round(v),w=Math.round(C))}}let g=Je(n,i);if(!g)return null;let T=g.length,P=je(n,e,s,t||s),S=P==="cuts"?null:P,b=g.map((u,v)=>v).filter(u=>!S||g[u].cts+g[u].duration/2>=S[0]&&g[u].cts+g[u].duration/2<S[1]).sort((u,v)=>g[u].cts-g[v].cts||u-v),H=new Array(T),k=0,A=1;for(let u=0;u<T;u++)g[u].key&&(u&&(A=Math.max(A,u-k)),k=u),H[u]=k;T&&(A=Math.max(A,T-k));let _=b.length?g[b[b.length-1]]:null,c=(_?_.cts+_.duration-g[b[0]].cts:0)/s;return{codec:U,format:M,description:F,width:E,height:w,timescale:s,duration:c,fps:c>0?b.length/c:30,samples:g,order:b,keyOf:H,gop:A,cuts:P==="cuts"}}function je(n,e,t,r){let o=Y(n,e,"edts","elst");if(!o)return null;let i=W(n),a=n[o.body]===1,s=a?20:12,f=i.getUint32(o.body+4),l=null;for(let M=0;M<f;M++){let E=o.body+8+M*s;if(E+s>o.end)break;let w=a?i.getUint32(E)*2**32+i.getUint32(E+4):i.getUint32(E),U=a?i.getInt32(E+8)*2**32+i.getUint32(E+12):i.getInt32(E+4);if(!(U<0)){if(l)return"cuts";l=[U,w?U+w*t/r:1/0]}}return l}function Je(n,e){let t=W(n),r=h=>V(n,e,h),o=[],i=r("stsz"),a=r("stz2");if(i){let h=t.getUint32(i.body+4),c=t.getUint32(i.body+8);o=new Array(c);for(let u=0;u<c;u++)o[u]=h||t.getUint32(i.body+12+u*4)}else if(a){let h=n[a.body+7],c=t.getUint32(a.body+8);o=new Array(c);for(let u=0;u<c;u++){let v=a.body+12;h===16?o[u]=t.getUint16(v+u*2):h===8?o[u]=n[v+u]:o[u]=n[v+(u>>1)]>>(u&1?0:4)&15}}else return null;let s=o.length,f=r("stco"),l=r("co64"),M=[];if(f){let h=t.getUint32(f.body+4);for(let c=0;c<h;c++)M.push(t.getUint32(f.body+8+c*4))}else if(l){let h=t.getUint32(l.body+4);for(let c=0;c<h;c++)M.push(t.getUint32(l.body+8+c*8)*2**32+t.getUint32(l.body+12+c*8))}else return null;let E=r("stsc");if(!E)return null;let w=[],U=t.getUint32(E.body+4);for(let h=0;h<U;h++){let c=E.body+8+h*12;w.push({first:t.getUint32(c)-1,per:t.getUint32(c+4)})}let F=new Array(s),m=0;for(let h=0;h<w.length&&m<s;h++){let c=h+1<w.length?w[h+1].first:M.length;for(let u=w[h].first;u<c&&m<s;u++){let v=M[u];for(let C=0;C<w[h].per&&m<s;C++)F[m]=v,v+=o[m],m++}}if(m<s)return null;let x=r("stts");if(!x)return null;let g=new Array(s),T=new Array(s),P=0;m=0;let S=t.getUint32(x.body+4);for(let h=0;h<S&&m<s;h++){let c=t.getUint32(x.body+8+h*8),u=t.getUint32(x.body+12+h*8);for(let v=0;v<c&&m<s;v++)g[m]=P,T[m]=u,P+=u,m++}for(;m<s;m++)g[m]=P,T[m]=0;let b=g.slice(),H=r("ctts");if(H){let h=t.getUint32(H.body+4);m=0;for(let c=0;c<h&&m<s;c++){let u=t.getUint32(H.body+8+c*8),v=t.getInt32(H.body+12+c*8);for(let C=0;C<u&&m<s;C++)b[m++]+=v}}let k=r("stss"),A=new Array(s).fill(!k);if(k){let h=t.getUint32(k.body+4);for(let c=0;c<h;c++){let u=t.getUint32(k.body+8+c*4)-1;u>=0&&u<s&&(A[u]=!0)}}s&&(A[0]=!0);let _=new Array(s);for(let h=0;h<s;h++)_[h]={offset:F[h],size:o[h],dts:g[h],cts:b[h],duration:T[h],key:A[h]};return _}var Z=class{constructor(){this.bytes=new Uint8Array(0);this.loaded=0;this.total=0;this.done=!1;this.track=null;this.late=!1;this.onTrack=null;this.onData=null;this.onError=null;this.cursor=0;this.sawMdat=!1;this.abort=null}start(e){this.abort=typeof AbortController<"u"?new AbortController:null,this.run(e).catch(t=>{this.abort?.signal.aborted||this.onError?.(t)})}async run(e){let t=await fetch(e,{mode:"cors",credentials:"omit",signal:this.abort?.signal});if(!t.ok)throw new Error(`HTTP ${t.status}`);let r=Number(t.headers.get("content-length"))||0;r&&!t.headers.get("content-encoding")&&(this.total=r);let o=t.body?.getReader?.();if(!o){this.push(new Uint8Array(await t.arrayBuffer())),this.finish();return}for(;;){let{done:i,value:a}=await o.read();if(i)break;a?.length&&this.push(a)}this.finish()}push(e){let t=this.loaded+e.length;if(t>this.bytes.length){let r=new Uint8Array(Math.max(t,this.total,this.bytes.length*2,1048576));r.set(this.bytes.subarray(0,this.loaded)),this.bytes=r}this.bytes.set(e,this.loaded),this.loaded=t,this.scan(),this.onData?.()}finish(){this.done=!0,this.scan(),this.track||this.onError?.(new Error("no H.264 video track found (is it an MP4?)")),this.onData?.()}scan(){for(;!this.track;){let e=G(this.bytes,this.cursor,this.loaded);if(!e)return;if(e.type==="moov"){if(e.end>this.loaded)return;this.late=this.sawMdat;let t=Pe(this.bytes,e);if(!t){this.onError?.(new Error("the MP4 has no video track"));return}this.track=t,this.onTrack?.(t);return}if(e.type==="mdat"&&(this.sawMdat=!0),!Number.isFinite(e.end))return;this.cursor=e.end}}has(e){return e.offset+e.size<=this.loaded}data(e){return this.bytes.subarray(e.offset,e.offset+e.size)}stop(){this.abort?.abort(),this.onTrack=this.onData=this.onError=null}};var j=class{constructor(e,t){this.track=e;this.host=t;this.target=-1;this.dir=0;this.busy=null;this.fetched=new Set;this.present=new Array(e.order.length),e.order.forEach((r,o)=>this.present[r]=o)}get frames(){return this.track.order.length}want(e,t=0){let r=this.frames,o=r?Math.max(0,Math.min(r-1,Math.round(e))):-1;o!==this.target&&this.fetched.clear(),this.target=o,this.dir=t>0?1:t<0?-1:0}next(){if(this.busy||this.target<0)return null;let e=this.reachable(this.target);if(e<0)return null;let t=this.host.has(e)?this.ahead(e):e;if(t<0)return null;t!==e&&this.fetched.add(t);let r=this.track.order[t],o=this.track.keyOf[r],i=Math.max(1,Math.floor(this.host.window()/2)),a=new Set([t]);for(let s=o;s<r;s++){let f=this.present[s];Math.abs(f-e)<=i&&!this.host.has(f)&&a.add(f)}return this.busy={from:o,to:r,goal:t,keep:a},this.busy}forget(){this.fetched.clear()}done(){this.busy=null}ready(e){let t=this.track.order[e];return t!==void 0&&this.host.available(t)&&this.host.available(this.track.keyOf[t])}reachable(e){if(this.ready(e))return e;let t=this.frames;for(let r=1;r<t;r++){if(e-r>=0&&this.ready(e-r))return e-r;if(e+r<t&&this.ready(e+r))return e+r}return-1}ahead(e){let t=this.frames,r=this.host.window(),o=Math.min(12,Math.max(1,Math.floor(r/2)-1),Math.floor((r-1)/2));for(let i=1;i<=o;i++)for(let a=0;a<(this.dir?1:2);a++){let s=e+i*(this.dir||1-2*a);if(!(s<0||s>=t)&&!this.host.has(s)&&!this.fetched.has(s)&&this.ready(s))return s}return-1}},et=25,tt=10;function rt(n){if(!n.length)return 0;let e=n.slice().sort((t,r)=>t-r);return e[Math.min(e.length-1,Math.ceil(e.length*.95)-1)]}function He(n){return n.length<tt?null:rt(n)>et}var st=3,_e="umber:scrub-decode",ot=()=>typeof navigator<"u"&&/Android/i.test(navigator.userAgent||"");function it(){try{let n=localStorage.getItem(_e);return n==="prefer-software"||n==="prefer-hardware"?n:null}catch{return null}}var at={hvc1:"HEVC (hvc1)",hev1:"HEVC (hev1)",av01:"AV1",vp09:"VP9",vp08:"VP8"},Oe=()=>typeof globalThis.VideoDecoder=="function"&&typeof globalThis.EncodedVideoChunk=="function",J=class{constructor(e,t){this.url=e;this.host=t;this.tier="decoder";this.stream=new Z;this.track=null;this.schedule=null;this.decoder=null;this.config=null;this.made=null;this.accel="no-preference";this.byTime=new Map;this.running=!1;this.on=!0;this.dead=!1;this.errors=0;this.timings=[];this.keep=null;this.outputs=0}start(){let e=this.stream;e.onTrack=t=>this.configure(t),e.onData=()=>this.pump(),e.onError=t=>this.fail(`could not read the video (${t instanceof Error?t.message:t})`),e.start(this.url)}async configure(e){if(!e.codec||!e.description)return this.fail(`is ${at[e.format]||e.format||"not H.264"}, and WebCodecs scrubbing reads H.264`,!0);if(e.fragmented&&!e.order.length)return this.fail("is a fragmented MP4 (its frames are indexed in fragments), which WebCodecs scrubbing doesn't read",!0);if(!e.order.length)return this.fail("has no frames in its index",!0);this.stream.late&&!this.stream.done&&this.host.log.warn('scrub video is not "faststart" (its index is at the end), so nothing shows until it fully downloads. Encode it with: npm run scrub -- input.mov'),e.cuts&&this.host.log.warn("scrub video has an edit list with several cuts, which the scrub does not follow: it shows every frame of the file. Re-encode it with: npm run scrub -- input.mov"),e.gop>10&&this.host.log.warn(`scrub video has a keyframe only every ${e.gop} frames: each step back decodes up to that many. For smooth scrubbing encode it with: npm run scrub -- input.mov`);let t=globalThis.VideoDecoder,r={codec:e.codec,codedWidth:e.width,codedHeight:e.height,description:e.description,optimizeForLatency:!0},o=ot()?it()||"prefer-hardware":"no-preference",i=o==="no-preference"?["no-preference"]:[o,"no-preference"];for(let s of i)try{let f=s==="no-preference"?r:{...r,hardwareAcceleration:s},l=await t.isConfigSupported(f);if(this.dead)return;if(l?.supported){this.config=f,this.accel=s;break}}catch{}if(!this.config)return this.fail(`this browser can't decode ${e.codec} with WebCodecs`);this.track=e,e.order.forEach((s,f)=>this.byTime.set(this.micros(e.samples[s].cts),f));let a=this.host.frames;this.schedule=new j(e,{has:s=>a.has(s),available:s=>this.stream.has(e.samples[s]),window:()=>Math.min(a.capacity(e.width,e.height),48)}),this.host.ready({frames:e.order.length,fps:e.fps,width:e.width,height:e.height}),this.pump()}micros(e){return Math.round(e/this.track.timescale*1e6)}request(e,t){this.schedule&&(this.schedule.want(e,t),this.pump())}active(e){this.on=e,e?(this.schedule?.forget(),this.pump()):this.close()}reset(){this.schedule?.forget(),this.pump()}decoderNow(){if(this.decoder&&this.decoder.state!=="closed"&&this.made===this.config)return this.decoder;this.close();let e=globalThis.VideoDecoder,t=new e({output:r=>this.output(r),error:r=>this.onError(t,r)});return t.configure(this.made=this.config),this.decoder=t,t}output(e){this.outputs++;let t=this.byTime.get(e.timestamp);if(t===void 0||this.dead||!this.keep?.has(t)||this.host.frames.ready(t)){e.close();return}this.host.frames.put(t,e,!0),this.host.delivered()}onError(e,t){e===this.decoder&&(this.decoder=null),t?.name!=="QuotaExceededError"&&this.host.log.info("scrub decoder error",t)}async pump(){if(this.running||this.dead||!this.on||!this.schedule||!this.track)return;let e=this.schedule.next();if(!e)return;this.running=!0;let t=this.track,r=performance.now(),o=this.errors,i=!0;try{let a=this.decoderNow();this.keep=e.keep,this.outputs=0;let s=globalThis.EncodedVideoChunk;for(let f=e.from;f<=e.to;f++){let l=t.samples[f];a.decode(new s({type:f===e.from||l.key?"key":"delta",timestamp:this.micros(l.cts),duration:this.micros(l.duration),data:this.stream.data(l)}))}await a.flush(),this.outputs===0&&(i=!1,this.errors++,this.close())}catch(a){i=!1,a?.name!=="QuotaExceededError"&&a?.name!=="AbortError"&&this.errors++,this.close()}if(this.running=!1,this.schedule?.done(),!this.dead){if(i)this.errors=0,this.time((performance.now()-r)/(e.to-e.from+1));else{if(this.errors>=st)return this.fail("the video decoder keeps failing");this.errors>o&&this.schedule?.forget()}this.pump()}}time(e){if(this.accel!=="prefer-hardware"||(this.timings.push(e),this.timings.length===1))return;let t=He(this.timings.slice(1));if(t===null)return;let r=t?"prefer-software":"prefer-hardware";try{localStorage.setItem(_e,r)}catch{}if(this.accel="no-preference",!t)return;let o={...this.config,hardwareAcceleration:"prefer-software"};globalThis.VideoDecoder.isConfigSupported(o).then(i=>{!i?.supported||this.dead||(this.host.log.info("scrub: hardware decoding is slow at seeking here; using the software decoder"),this.config=o,this.accel="prefer-software",this.running||this.close())}).catch(()=>{})}close(){let e=this.decoder;if(this.decoder=null,e&&e.state!=="closed")try{e.close()}catch{}}fail(e,t){this.dead||(this.destroy(),this.host.failed(e,t))}destroy(){this.dead=!0,this.stream.stop(),this.close(),this.schedule=null}};var ee=class{constructor(e,t,r,o){this.video=e;this.host=t;this.fps=r;this.src=o;this.tier="video";this.frames=0;this.target=-1;this.seeking=-1;this.landed=-1;this.fastFor=-1;this.errors=0;this.on=!0;this.dead=!1;this.cors=!1;this.offs=[]}start(){let e=this.video;e.muted=!0,e.playsInline=!0,e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.disableRemotePlayback=!0,e.pause();let t=e.currentSrc||e.getAttribute("src")||e.querySelector("source")?.getAttribute("src")||"",r=this.src||t,o=e.preload!=="auto";e.preload="auto";try{r&&new URL(r,location.href).origin!==location.origin&&!e.crossOrigin&&(e.crossOrigin="anonymous",this.cors=o=!0)}catch{}this.src&&this.src!==t&&(e.src=this.src,o=!0),this.listen("seeked",()=>this.onSeeked()),this.listen("error",a=>{let s=e.querySelectorAll("source");(a.target===e||a.target===s[s.length-1])&&this.fail(this.cors?"the video failed to load (another domain: no CORS headers?)":"the video failed to load")},!0),e.readyState>=1&&!o?this.onMeta():(this.listen("loadedmetadata",()=>this.onMeta()),this.meta()),o&&e.load();let i=()=>{this.dead||e.readyState>=2||e.play().then(()=>e.pause()).catch(()=>{})};addEventListener("touchstart",i,{once:!0,passive:!0}),this.offs.push(()=>removeEventListener("touchstart",i))}listen(e,t,r=!1){this.video.addEventListener(e,t,r),this.offs.push(()=>this.video.removeEventListener(e,t,r))}meta(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.frames||this.dead||(this.video.networkState===1?this.meta():this.fail("the video's metadata never loaded"))},1e4)}onMeta(){if(this.frames||this.dead)return;let e=this.video;if(!Number.isFinite(e.duration)||e.duration<=0)return this.fail("the video has no duration (a live stream?)");this.frames=Math.max(1,Math.round(e.duration*this.fps)),this.host.ready({frames:this.frames,fps:this.fps,width:e.videoWidth,height:e.videoHeight}),this.pump()}request(e){this.frames&&(this.target=Math.max(0,Math.min(this.frames-1,Math.round(e))),this.pump())}active(e){this.on=e,this.pump()}reset(){this.seeking=-1,this.landed=-1,this.pump()}pump(){if(this.dead||!this.on||this.target<0)return;if(this.seeking>=0){let i=this.host.frames;if(this.landed>=0&&(i.ready(this.landed)||!i.has(this.landed)))this.seeking=-1,this.landed=-1;else return}let e=this.target;if(this.host.frames.has(e))return;let t=this.video;if(t.readyState<1)return;this.seeking=e,this.landed=-1;let r=Math.min((e+.5)/this.fps,Math.max(0,t.duration-.001)),o=Math.round(t.currentTime*this.fps-.5);typeof t.fastSeek=="function"&&Math.abs(e-o)>6&&e!==this.fastFor?(this.fastFor=e,t.fastSeek(r)):t.currentTime=r,clearTimeout(this.timer),this.timer=setTimeout(()=>{this.seeking<0||this.landed>=0||(this.seeking=-1,++this.errors>=3?this.fail("seeking the video never lands"):this.pump())},4e3)}onSeeked(){if(this.dead||this.seeking<0)return;clearTimeout(this.timer),this.errors=0;let e=this.video,t=Math.max(0,Math.min(this.frames-1,Math.floor(e.currentTime*this.fps+.001)));this.landed=t,this.host.frames.put(t,e,!1),this.host.delivered()}fail(e){this.dead||(this.destroy(),this.cors&&(this.video.removeAttribute("crossorigin"),this.video.load()),this.host.failed(e))}destroy(){this.dead=!0,clearTimeout(this.timer),this.offs.forEach(e=>e()),this.offs=[]}};var ut=4,ct=8,lt=2,dt=4,te=class{constructor(e,t,r,o){this.pattern=e;this.count=t;this.fps=r;this.host=o;this.tier="frames";this.target=-1;this.dir=0;this.loading=new Set;this.failedFrames=new Set;this.errors=0;this.known=!1;this.width=0;this.height=0;this.on=!0;this.dead=!1;this.abort=typeof AbortController<"u"?new AbortController:null}start(){if(!(this.count>0))return this.fail('data-gl-scrub-frames needs data-gl-scrub-count="<number of frames>"');this.load(0)}request(e,t){this.target=Math.max(0,Math.min(this.count-1,Math.round(e))),this.dir=t>0?1:t<0?-1:0,this.pump()}active(e){this.on=e,this.pump()}reset(){this.pump()}pump(){if(this.dead||!this.on||!this.known||this.target<0)return;let e=this.host.frames,t=this.dir>=0?1:-1,r=e.capacity(this.width,this.height)-1,o=Math.min(lt,r>>2),i=Math.min(ct,r-o);for(let a=0;a<=Math.max(0,i+o)&&this.loading.size<ut;a++){let s=this.target+(a<=i?a:i-a)*t;s<0||s>=this.count||e.has(s)||this.loading.has(s)||this.failedFrames.has(s)||this.load(s)}}async load(e){this.loading.add(e);let t=Fe(this.pattern,e);try{let r=await fetch(t,{mode:"cors",credentials:"omit",signal:this.abort?.signal});if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.blob(),i=await createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"default"}),a=this.host.maxTexture;if(i.width>a||i.height>a){let s=a/Math.max(i.width,i.height),f=await createImageBitmap(i,{resizeWidth:Math.floor(i.width*s),resizeHeight:Math.floor(i.height*s),resizeQuality:"high"});i.close(),i=f}if(this.loading.delete(e),this.dead)return i.close();this.errors=0,this.known||(this.known=!0,this.width=i.width,this.height=i.height,this.host.ready({frames:this.count,fps:this.fps,width:i.width,height:i.height})),this.host.frames.put(e,i,!0),this.host.delivered()}catch(r){if(this.loading.delete(e),this.dead)return;if(this.failedFrames.add(e),this.host.log.warn(`scrub frame ${t} failed to load`,r),!this.known||++this.errors>=dt)return this.fail(`the image sequence ${this.pattern} does not load`)}this.pump()}fail(e){this.dead||(this.destroy(),this.host.failed(e))}destroy(){this.dead=!0,this.abort?.abort()}};var Le=()=>{let n=typeof window<"u"&&window.occluzeCapture;return n?.version==1?n:null},pe=()=>new Promise(n=>{let e=new MessageChannel;e.port1.onmessage=n,e.port2.postMessage(0)});var Be=n=>new Promise(e=>{let t=AbortSignal.timeout?.(n);t?t.onabort=()=>e():setTimeout(e,n)});var ht={high:128,mid:48,low:32},Ve=new Set,ft=.12,mt=250,pt=20,be={start:"top bottom",end:"bottom top",track:"",smooth:-1,source:"auto",src:"",srcMobile:"",frames:"",count:0,fps:0,blend:!0,cache:0,reduced:""},$e={uniforms:{uScrubProgress:0,uScrubVelocity:0},fragment:{head:`uniform sampler2D uFrameNext;
3
3
  uniform float uFrameMix;
4
4
  vec4 scrubNext(vec2 uv) {
5
5
  vec2 f = fitUv(uv);
6
6
  if (uFit > 0.5 && uFit < 1.5 && (f.x < 0.0 || f.y < 0.0 || f.x > 1.0 || f.y > 1.0)) return vec4(0.0);
7
7
  return texture(uFrameNext, f);
8
- }`,color:"if (uFrameMix > 0.0) color = mix(color, scrubNext(uv), uFrameMix);"}};function bt(n,e){let t=e.trim();if(!t||t==="self")return null;if(t==="parent")return n.parentElement;try{return t.startsWith("closest ")?n.closest(t.slice(8).trim()):n.closest(t)||document.querySelector(t)}catch{return null}}function gt(n,e){return e||n?.currentSrc||n?.getAttribute("src")||n?.querySelector("source")?.getAttribute("src")||""}function De(n){let{el:e,log:t}=n,r=Te(e,"gl-scrub",be),o=(e.getAttribute("data-gl-scrub")||"").trim().toLowerCase(),i=Q(r.start,be.start),a=Q(r.end,be.end),s=n.media instanceof HTMLVideoElement?n.media:null,f=n.tier!=="high"&&!!r.srcMobile,l=gt(s,f?r.srcMobile:r.src),M=(f?r.srcMobile:r.src)||"",E=n.options,w=null,U=()=>w||(w=n.frames,w.budget=(r.cache>0?r.cache:E.cacheMB||ht[n.tier])*2**20,w),F=String(r.source||"auto").toLowerCase(),m;F==="decoder"||F==="video"||F==="frames"?m=[F]:(m=[],l&&Oe()&&m.push("decoder"),s&&l&&m.push("video"),r.frames&&m.push("frames"));let x=new Map,g=d=>{let p=x.get(d);if(p){for(let y of[...p])if(p.has(y))try{y(B)}catch(R){t.error(`a scrub "${d}" handler threw:`,R)}}},T="loading",P=0,S=null,b=null,H=!1,k=!1,A=o==="manual",_=0,h=0,c=0,u=0,v=0,C=0,$=!0,se=!0,q=()=>{},Ie=new Promise(d=>q=d),ge=Le(),O=null,ye=[],oe=0,ve=()=>ye.every(d=>U().has(d));function ze(d){ye=d,!(O||oe>=pt)&&ge.wait(new Promise(p=>{let y=O=R=>{O===y&&(O=null,R&&oe++,p())};ve()&&pe().then(()=>y()),Be(mt).then(()=>y(!0))}))}let ie=bt(e,r.track);r.track&&!ie&&r.track.trim()!=="self"&&t.warn(`data-gl-scrub-track="${r.track}": no such element; the video's own position drives it.`,e);let we=n.engine,D=ie&&we.track?we.track(ie):null,I=null;function ae(d){!s||d===(I!==null)||(d?(I=s.autoplay,s.autoplay=!1,s.pause()):(s.autoplay=I,I&&s.isConnected&&s.play().catch(()=>{}),I=null))}function ue(d){ae(!1),T="poster",S?.destroy(),S=null,b=null,n.busy(!1),n.fail(d),q(!1),O?.(),g("tier")}let ce={get frames(){return U()},log:t,maxTexture:n.maxTexture,ready(d){k||(T==="decoder"&&(P=d.fps),b&&b.frames!==d.frames&&(c=Math.min(c,d.frames-1)),b=d,$=!0,n.wake())},delivered(){k||(se&&(se=!1,q(!0),g("ready")),O&&ve()&&pe().then(()=>O?.()),n.wake())},failed(d,p){if(k)return;let y=p?new URL(l,location.href).href:"";if(p&&(d=`the video ${y} ${d}. Encode it with: npm run scrub -- input.mov`),p&&m.length&&!Ve.has(y)){Ve.add(y);let R=m[0]==="video"?"by seeking the <video>, which is choppier":"from its image sequence";t.warn(`scrub: ${d.replace(/\. Encode/,`, so it scrubs ${R}. Encode`)}`,e)}else t.info(`scrub: ${T} tier failed (${d})`,e);w?.clear(),b=null,S=null,O?.(),le(d)}};function le(d){let p=m.shift();if(!p)return g("error"),ue(`scrub: ${d||"nothing to scrub (no video src and no data-gl-scrub-frames)"}; the <video> and its poster show instead.`);if(T=p,ae(!0),p==="decoder"){let y=new J(new URL(l,location.href).href,ce);S=y,y.start()}else if(p==="video"){if(!s)return le('data-gl-scrub-source="video" needs a <video>');let y=new ee(s,ce,r.fps>0?r.fps:P||30,M);S=y,y.start()}else{let y=new te(r.frames,Math.round(r.count),r.fps>0?r.fps:30,ce);S=y,y.start()}g("tier")}function Ne(){return n.reducedMotion?0:r.smooth>=0?r.smooth:n.scrollKind==="lenis"||n.engine.scroll||document.documentElement.classList.contains("lenis")?0:ft}let B={get progress(){return h},set progress(d){A=!0,_=Math.min(1,Math.max(0,Number(d)||0)),n.wake()},get drive(){return A?"manual":"scroll"},set drive(d){A=d==="manual",A&&(_=h),n.wake()},get time(){return b?c/b.fps:0},set time(d){b&&(B.progress=d*b.fps/Math.max(1,b.frames-1))},get frame(){return c},get frames(){return b?.frames||0},get fps(){return b?.fps||0},get duration(){return b?b.frames/b.fps:0},get tier(){return T},ready:Ie,on(d,p){return x.has(d)||x.set(d,new Set),x.get(d).add(p),()=>B.off(d,p)},off(d,p){x.get(d)?.delete(p)},destroy(){n.plane.destroy()}},Me={uniforms:$e.uniforms},We=String(r.reduced||E.reducedMotion||"poster").toLowerCase();return n.reducedMotion&&We!=="scrub"?(ue(),{api:B,source:!0,effect:Me}):m.length?{api:B,source:!0,effect:$e,near(d){if(!(k||T==="poster")){if(d&&($=!0),!H&&d){H=!0,le();return}S?.active(d),d||w?.clear(!0)}},update(d,p,y){if(!b||!S||k)return!1;if(A)h=_;else{let L=D?D.rect.y:p[1],Se=D?D.rect.height:p[3];if(!(Se>0))return!1;h=fe(L,Se,y.height,i,a)}let R=b.frames;u=h*(R-1);let de=c;c=$?u:Ue(c,u,Ne(),d.dt),$=!1,Math.abs(u-c)<.01&&(c=u),v=d.dt>0?(c-de)/Math.max(1,R-1)/d.dt:0,C=Math.sign(u-c)||Math.sign(c-de)||C,n.busy(c!==u);let z=U();z.focus(Math.round(c)),S.request(c,C);let X=Ce(c,R,L=>z.ready(L),()=>z.keys(),r.blend!==!1);if(X&&z.show(X.a,X.b,X.mix),ge&&p[1]<y.height&&p[1]+p[3]>0&&p[0]<y.width&&p[0]+p[2]>0){let L=[Math.round(Math.max(0,Math.min(R-1,c)))];z.ready(L[0])?oe=0:ze(L)}let N=n.plane.uniforms;N.uScrubProgress&&(N.uScrubProgress.value=c/Math.max(1,R-1));let he=c!==de;if(N.uScrubVelocity){let L=he?v:0;he||=N.uScrubVelocity.value!==L,N.uScrubVelocity.value=L}return he},lost(){$=!0},src:()=>!M,restored(){S?.reset(),n.wake()},destroy(){k=!0,S?.destroy(),S=null,ae(!1),D?.destroy(),x.clear(),O?.(),se&&q(!1)}}:(ue(`scrub: nothing to scrub here (${s?"the <video> has no src":"no <video> inside"} and no data-gl-scrub-frames); it shows as plain DOM.`),{api:B,source:!0,effect:Me})}var re={name:"scrub",version:"0.2.0",attributes:["scrub"],plane:n=>De(n)};var ne=window;ne.Umber?.use?ne.Umber.use(re):((ne.UmberModules||=[]).push(re),ne.__umber?.engine?.use?.(re));})();
8
+ }`,color:"if (uFrameMix > 0.0) color = mix(color, scrubNext(uv), uFrameMix);"}};function bt(n,e){let t=e.trim();if(!t||t==="self")return null;if(t==="parent")return n.parentElement;try{return t.startsWith("closest ")?n.closest(t.slice(8).trim()):n.closest(t)||document.querySelector(t)}catch{return null}}function gt(n,e){return e||n?.currentSrc||n?.getAttribute("src")||n?.querySelector("source")?.getAttribute("src")||""}function De(n){let{el:e,log:t}=n,r=Te(e,"gl-scrub",be),o=(e.getAttribute("data-gl-scrub")||"").trim().toLowerCase(),i=Q(r.start,be.start),a=Q(r.end,be.end),s=n.media instanceof HTMLVideoElement?n.media:null,f=n.tier!=="high"&&!!r.srcMobile,l=gt(s,f?r.srcMobile:r.src),M=(f?r.srcMobile:r.src)||"",E=n.options,w=null,U=()=>w||(w=n.frames,w.budget=(r.cache>0?r.cache:E.cacheMB||ht[n.tier])*2**20,w),F=String(r.source||"auto").toLowerCase(),m;F==="decoder"||F==="video"||F==="frames"?m=[F]:(m=[],l&&Oe()&&m.push("decoder"),s&&l&&m.push("video"),r.frames&&m.push("frames"));let x=new Map,g=d=>{let p=x.get(d);if(p){for(let y of[...p])if(p.has(y))try{y(B)}catch(R){t.error(`a scrub "${d}" handler threw:`,R)}}},T="loading",P=0,S=null,b=null,H=!1,k=!1,A=o==="manual",_=0,h=0,c=0,u=0,v=0,C=0,$=!0,se=!0,q=()=>{},Ie=new Promise(d=>q=d),ge=Le(),O=null,ye=[],oe=0,ve=()=>ye.every(d=>U().has(d));function ze(d){ye=d,!(O||oe>=pt)&&ge.wait(new Promise(p=>{let y=O=R=>{O===y&&(O=null,R&&oe++,p())};ve()&&pe().then(()=>y()),Be(mt).then(()=>y(!0))}))}let ie=bt(e,r.track);r.track&&!ie&&r.track.trim()!=="self"&&t.warn(`data-gl-scrub-track="${r.track}": no such element; the video's own position drives it.`,e);let we=n.engine,D=ie&&we.track?we.track(ie):null,I=null;function ae(d){!s||d===(I!==null)||(d?(I=s.autoplay,s.autoplay=!1,s.pause()):(s.autoplay=I,I&&s.isConnected&&s.play().catch(()=>{}),I=null))}function ue(d){ae(!1),T="poster",S?.destroy(),S=null,b=null,n.busy(!1),n.fail(d),q(!1),O?.(),g("tier")}let ce={get frames(){return U()},log:t,maxTexture:n.maxTexture,ready(d){k||(T==="decoder"&&(P=d.fps),b&&b.frames!==d.frames&&(c=Math.min(c,d.frames-1)),b=d,$=!0,n.wake())},delivered(){k||(se&&(se=!1,q(!0),g("ready")),O&&ve()&&pe().then(()=>O?.()),n.wake())},failed(d,p){if(k)return;let y=p?new URL(l,location.href).href:"";if(p&&(d=`the video ${y} ${d}. Encode it with: npm run scrub -- input.mov`),p&&m.length&&!Ve.has(y)){Ve.add(y);let R=m[0]==="video"?"by seeking the <video>, which is choppier":"from its image sequence";t.warn(`scrub: ${d.replace(/\. Encode/,`, so it scrubs ${R}. Encode`)}`,e)}else t.info(`scrub: ${T} tier failed (${d})`,e);w?.clear(),b=null,S=null,O?.(),le(d)}};function le(d){let p=m.shift();if(!p)return g("error"),ue(`scrub: ${d||"nothing to scrub (no video src and no data-gl-scrub-frames)"}; the <video> and its poster show instead.`);if(T=p,ae(!0),p==="decoder"){let y=new J(new URL(l,location.href).href,ce);S=y,y.start()}else if(p==="video"){if(!s)return le('data-gl-scrub-source="video" needs a <video>');let y=new ee(s,ce,r.fps>0?r.fps:P||30,M);S=y,y.start()}else{let y=new te(r.frames,Math.round(r.count),r.fps>0?r.fps:30,ce);S=y,y.start()}g("tier")}function Ne(){return n.reducedMotion?0:r.smooth>=0?r.smooth:n.scrollKind==="lenis"||n.engine.scroll||document.documentElement.classList.contains("lenis")?0:ft}let B={get progress(){return h},set progress(d){A=!0,_=Math.min(1,Math.max(0,Number(d)||0)),n.wake()},get drive(){return A?"manual":"scroll"},set drive(d){A=d==="manual",A&&(_=h),n.wake()},get time(){return b?c/b.fps:0},set time(d){b&&(B.progress=d*b.fps/Math.max(1,b.frames-1))},get frame(){return c},get frames(){return b?.frames||0},get fps(){return b?.fps||0},get duration(){return b?b.frames/b.fps:0},get tier(){return T},ready:Ie,on(d,p){return x.has(d)||x.set(d,new Set),x.get(d).add(p),()=>B.off(d,p)},off(d,p){x.get(d)?.delete(p)},destroy(){n.plane.destroy()}},Me={uniforms:$e.uniforms},We=String(r.reduced||E.reducedMotion||"poster").toLowerCase();return n.reducedMotion&&We!=="scrub"?(ue(),{api:B,source:!0,effect:Me}):m.length?{api:B,source:!0,effect:$e,near(d){if(!(k||T==="poster")){if(d&&($=!0),!H&&d){H=!0,le();return}S?.active(d),d||w?.clear(!0)}},update(d,p,y){if(!b||!S||k)return!1;if(A)h=_;else{let L=D?D.rect.y:p[1],Se=D?D.rect.height:p[3];if(!(Se>0))return!1;h=fe(L,Se,y.height,i,a)}let R=b.frames;u=h*(R-1);let de=c;c=$?u:Ue(c,u,Ne(),d.dt),$=!1,Math.abs(u-c)<.01&&(c=u),v=d.dt>0?(c-de)/Math.max(1,R-1)/d.dt:0,C=Math.sign(u-c)||Math.sign(c-de)||C,n.busy(c!==u);let z=U();z.focus(Math.round(c)),S.request(c,C);let X=Ce(c,R,L=>z.ready(L),()=>z.keys(),r.blend!==!1);if(X&&z.show(X.a,X.b,X.mix),ge&&p[1]<y.height&&p[1]+p[3]>0&&p[0]<y.width&&p[0]+p[2]>0){let L=[Math.round(Math.max(0,Math.min(R-1,c)))];z.ready(L[0])?oe=0:ze(L)}let N=n.plane.uniforms;N.uScrubProgress&&(N.uScrubProgress.value=c/Math.max(1,R-1));let he=c!==de;if(N.uScrubVelocity){let L=he?v:0;he||=N.uScrubVelocity.value!==L,N.uScrubVelocity.value=L}return he},lost(){$=!0},src:()=>!M,restored(){S?.reset(),n.wake()},destroy(){k=!0,S?.destroy(),S=null,ae(!1),D?.destroy(),x.clear(),O?.(),se&&q(!1)}}:(ue(`scrub: nothing to scrub here (${s?"the <video> has no src":"no <video> inside"} and no data-gl-scrub-frames); it shows as plain DOM.`),{api:B,source:!0,effect:Me})}var re={name:"scrub",version:"0.2.1",attributes:["scrub"],plane:n=>De(n)};var ne=window;ne.Umber?.use?ne.Umber.use(re):((ne.UmberModules||=[]).push(re),ne.__umber?.engine?.use?.(re));})();
@@ -1,8 +1,8 @@
1
- /*! Umber v0.2.0 | (c) Ravi Klaassens | UNLICENSED */
1
+ /*! Umber v0.2.1 | (c) Ravi Klaassens | UNLICENSED */
2
2
  function Ne(n){let e=n.trim().toLowerCase();if(e===""||e==="true"||e==="1"||e==="yes")return!0;if(e==="false"||e==="0"||e==="no")return!1}function Me(n,e){let t=n.trim();if(e==="number"){let r=parseFloat(t);return Number.isFinite(r)?r:void 0}return e==="boolean"?Ne(t):e==="list"?t.split(/[\s,]+/).filter(Boolean):t.replace(/^["']|["']$/g,"")}function We(n){return n.type?n.type:typeof n.default=="number"?"number":typeof n.default=="boolean"?"boolean":Array.isArray(n.default)?"list":"string"}var Se=n=>n.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);function xe(n,e,t,r){if(typeof e=="string"){let o=e.replace(/^data-/,""),i=t||{},a={};for(let s in i)a[s]={attr:`data-${o}-${Se(s)}`,css:`--${o}-${Se(s)}`,default:i[s]};return Ee(n,a,r)}return Ee(n,e,t)}function Ee(n,e,t){let r={},o=t;for(let i in e){let a=e[i],s=We(a),f;if(a.attr){let l=n.getAttribute(a.attr);l!==null&&(f=Me(l,s))}if(f===void 0&&a.css){o||=getComputedStyle(n);let l=o.getPropertyValue(a.css);l&&l.trim()!==""&&(f=Me(l,s))}r[i]=f===void 0?a.default:f}return r}var ke={top:0,left:0,center:.5,middle:.5,bottom:1,right:1};function qe(n){let e=/^(top|left|center|middle|bottom|right|-?\d*\.?\d+(?:px|%)?)?(?:([+-])=?(\d*\.?\d+)(px|%)?)?$/.exec(n);if(!e||!e[1]&&!e[2])return null;let t=0,r=0;if(e[1]&&e[1]in ke)t=ke[e[1]];else if(e[1]){let o=parseFloat(e[1]);e[1].endsWith("%")?t=o/100:r=o}if(e[2]){let o=parseFloat(e[3])*(e[2]==="-"?-1:1);e[4]==="%"?t+=o/100:r+=o}return[t,r]}function K(n,e){let t=(n||"").trim().toLowerCase();if(!t)return e;let r=qe(t);return r?/^[+-]/.test(t)&&!/^-\d/.test(t)?[e[0]+r[0],e[1]+r[1]]:r:e}var Xe={cover:"0110",contain:"11000011",entry:"01110100",exit:"00101110","entry-crossing":"0111","exit-crossing":"0010"};function Ke(n,e){let t=Xe[n[0]],r=n[1]||(e?"100%":"0%"),o=r.endsWith("%")?0:parseFloat(r)||0,i=o?0:parseFloat(r)/100||0,a=s=>({el:+t[s]+(+t[s+2]-+t[s])*i,elPx:o,vp:+t[s+1]+(+t[s+3]-+t[s+1])*i,vpPx:0});return t?{...a(0),alt:t[4]?a(4):void 0}:null}function Q(n,e){let t=(n||e).trim().split(/\s+/),r=Ke(t.map(l=>l.toLowerCase()),e.startsWith("bottom"));if(r)return r;let o=e.split(/\s+/),[i,a]=K(t[0],K(o[0],[0,0])),[s,f]=K(t[1],K(o[1],[0,0]));return{el:i,elPx:a,vp:s,vpPx:f}}function de(n,e,t,r,o){let i=l=>(l.alt&&e>t&&(l=l.alt),n+e*l.el+l.elPx-(t*l.vp+l.vpPx)),a=i(r),s=i(o),f=a-s;return Math.abs(f)>1e-6?Math.min(1,Math.max(0,a/f)):a<=0?1:0}function Te(n,e,t,r){return!(t>0)||!(r>0)?e:n+(e-n)*(1-Math.exp(-r/t))}function Ae(n,e,t,r,o){if(e<=0)return null;let i=Math.max(0,Math.min(e-1,n)),a=Math.floor(i),s=i-a;if(o&&s>.001&&a+1<e&&t(a)&&t(a+1))return{a,b:a+1,mix:s};let f=Math.round(i);if(t(f))return{a:f,b:-1,mix:0};let l=-1;for(let M of r())(l<0||Math.abs(M-i)<Math.abs(l-i))&&(l=M);return l<0?null:{a:l,b:-1,mix:0}}function Ue(n,e){return n.replace(/\{(\d+)\}/,(t,r)=>String(parseInt(r,10)+e).padStart(r.length,"0"))}var Ce=(n,e)=>String.fromCharCode(n[e],n[e+1],n[e+2],n[e+3]);function W(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function G(n,e,t=n.length){if(e+8>t)return null;let r=W(n),o=r.getUint32(e),i=Ce(n,e+4),a=e+8;if(o===1){if(e+16>t)return null;o=r.getUint32(e+8)*2**32+r.getUint32(e+12),a=e+16}else o===0&&(o=1/0);return o<a-e?null:{type:i,start:e,body:a,end:e+o}}function he(n,e,t){let r=[],o=e;for(;o<t;){let i=G(n,o,t);if(!i||i.end>t||i.end<=o)break;r.push(i),o=i.end}return r}var V=(n,e,t)=>he(n,e.body,e.end).find(r=>r.type===t)||null;function Y(n,e,...t){for(let r of t){if(!e)return null;e=V(n,e,r)}return e}function Qe(n){let e=t=>t.toString(16).padStart(2,"0");return`avc1.${e(n[1])}${e(n[2])}${e(n[3])}`}function Fe(n,e){let t=V(n,e,"mvhd"),r=t?W(n).getUint32(t.body+(n[t.body]===1?20:12)):0;for(let o of he(n,e.body,e.end)){if(o.type!=="trak")continue;let i=Y(n,o,"mdia","hdlr");if(!i||Ce(n,i.body+8)!=="vide")continue;let a=Ye(n,o,r);if(a)return V(n,e,"mvex")&&(a.fragmented=!0),a}return null}function Ye(n,e,t){let r=W(n),o=Y(n,e,"mdia","mdhd"),i=Y(n,e,"mdia","minf","stbl");if(!o||!i)return null;let a=n[o.body]===1,s=r.getUint32(o.body+(a?20:12))||1,f=V(n,i,"stsd");if(!f)return null;let l=G(n,f.body+8,f.end);if(!l)return null;let M=l.type,E=r.getUint16(l.body+24),w=r.getUint16(l.body+26),U="",F=null,m=he(n,l.body+78,l.end).find(u=>u.type==="avcC");m&&(M==="avc1"||M==="avc3")&&(F=n.slice(m.body,m.end),U=Qe(F));let x=V(n,e,"tkhd");if(x){let u=x.body+(n[x.body]===1?88:76);if(u+8<=x.end){let v=r.getUint32(u)/65536,C=r.getUint32(u+4)/65536;v&&C&&(E=Math.round(v),w=Math.round(C))}}let b=Ze(n,i);if(!b)return null;let T=b.length,P=Ge(n,e,s,t||s),S=P==="cuts"?null:P,g=b.map((u,v)=>v).filter(u=>!S||b[u].cts+b[u].duration/2>=S[0]&&b[u].cts+b[u].duration/2<S[1]).sort((u,v)=>b[u].cts-b[v].cts||u-v),H=new Array(T),k=0,A=1;for(let u=0;u<T;u++)b[u].key&&(u&&(A=Math.max(A,u-k)),k=u),H[u]=k;T&&(A=Math.max(A,T-k));let O=g.length?b[g[g.length-1]]:null,c=(O?O.cts+O.duration-b[g[0]].cts:0)/s;return{codec:U,format:M,description:F,width:E,height:w,timescale:s,duration:c,fps:c>0?g.length/c:30,samples:b,order:g,keyOf:H,gop:A,cuts:P==="cuts"}}function Ge(n,e,t,r){let o=Y(n,e,"edts","elst");if(!o)return null;let i=W(n),a=n[o.body]===1,s=a?20:12,f=i.getUint32(o.body+4),l=null;for(let M=0;M<f;M++){let E=o.body+8+M*s;if(E+s>o.end)break;let w=a?i.getUint32(E)*2**32+i.getUint32(E+4):i.getUint32(E),U=a?i.getInt32(E+8)*2**32+i.getUint32(E+12):i.getInt32(E+4);if(!(U<0)){if(l)return"cuts";l=[U,w?U+w*t/r:1/0]}}return l}function Ze(n,e){let t=W(n),r=h=>V(n,e,h),o=[],i=r("stsz"),a=r("stz2");if(i){let h=t.getUint32(i.body+4),c=t.getUint32(i.body+8);o=new Array(c);for(let u=0;u<c;u++)o[u]=h||t.getUint32(i.body+12+u*4)}else if(a){let h=n[a.body+7],c=t.getUint32(a.body+8);o=new Array(c);for(let u=0;u<c;u++){let v=a.body+12;h===16?o[u]=t.getUint16(v+u*2):h===8?o[u]=n[v+u]:o[u]=n[v+(u>>1)]>>(u&1?0:4)&15}}else return null;let s=o.length,f=r("stco"),l=r("co64"),M=[];if(f){let h=t.getUint32(f.body+4);for(let c=0;c<h;c++)M.push(t.getUint32(f.body+8+c*4))}else if(l){let h=t.getUint32(l.body+4);for(let c=0;c<h;c++)M.push(t.getUint32(l.body+8+c*8)*2**32+t.getUint32(l.body+12+c*8))}else return null;let E=r("stsc");if(!E)return null;let w=[],U=t.getUint32(E.body+4);for(let h=0;h<U;h++){let c=E.body+8+h*12;w.push({first:t.getUint32(c)-1,per:t.getUint32(c+4)})}let F=new Array(s),m=0;for(let h=0;h<w.length&&m<s;h++){let c=h+1<w.length?w[h+1].first:M.length;for(let u=w[h].first;u<c&&m<s;u++){let v=M[u];for(let C=0;C<w[h].per&&m<s;C++)F[m]=v,v+=o[m],m++}}if(m<s)return null;let x=r("stts");if(!x)return null;let b=new Array(s),T=new Array(s),P=0;m=0;let S=t.getUint32(x.body+4);for(let h=0;h<S&&m<s;h++){let c=t.getUint32(x.body+8+h*8),u=t.getUint32(x.body+12+h*8);for(let v=0;v<c&&m<s;v++)b[m]=P,T[m]=u,P+=u,m++}for(;m<s;m++)b[m]=P,T[m]=0;let g=b.slice(),H=r("ctts");if(H){let h=t.getUint32(H.body+4);m=0;for(let c=0;c<h&&m<s;c++){let u=t.getUint32(H.body+8+c*8),v=t.getInt32(H.body+12+c*8);for(let C=0;C<u&&m<s;C++)g[m++]+=v}}let k=r("stss"),A=new Array(s).fill(!k);if(k){let h=t.getUint32(k.body+4);for(let c=0;c<h;c++){let u=t.getUint32(k.body+8+c*4)-1;u>=0&&u<s&&(A[u]=!0)}}s&&(A[0]=!0);let O=new Array(s);for(let h=0;h<s;h++)O[h]={offset:F[h],size:o[h],dts:b[h],cts:g[h],duration:T[h],key:A[h]};return O}var Z=class{constructor(){this.bytes=new Uint8Array(0);this.loaded=0;this.total=0;this.done=!1;this.track=null;this.late=!1;this.onTrack=null;this.onData=null;this.onError=null;this.cursor=0;this.sawMdat=!1;this.abort=null}start(e){this.abort=typeof AbortController<"u"?new AbortController:null,this.run(e).catch(t=>{this.abort?.signal.aborted||this.onError?.(t)})}async run(e){let t=await fetch(e,{mode:"cors",credentials:"omit",signal:this.abort?.signal});if(!t.ok)throw new Error(`HTTP ${t.status}`);let r=Number(t.headers.get("content-length"))||0;r&&!t.headers.get("content-encoding")&&(this.total=r);let o=t.body?.getReader?.();if(!o){this.push(new Uint8Array(await t.arrayBuffer())),this.finish();return}for(;;){let{done:i,value:a}=await o.read();if(i)break;a?.length&&this.push(a)}this.finish()}push(e){let t=this.loaded+e.length;if(t>this.bytes.length){let r=new Uint8Array(Math.max(t,this.total,this.bytes.length*2,1048576));r.set(this.bytes.subarray(0,this.loaded)),this.bytes=r}this.bytes.set(e,this.loaded),this.loaded=t,this.scan(),this.onData?.()}finish(){this.done=!0,this.scan(),this.track||this.onError?.(new Error("no H.264 video track found (is it an MP4?)")),this.onData?.()}scan(){for(;!this.track;){let e=G(this.bytes,this.cursor,this.loaded);if(!e)return;if(e.type==="moov"){if(e.end>this.loaded)return;this.late=this.sawMdat;let t=Fe(this.bytes,e);if(!t){this.onError?.(new Error("the MP4 has no video track"));return}this.track=t,this.onTrack?.(t);return}if(e.type==="mdat"&&(this.sawMdat=!0),!Number.isFinite(e.end))return;this.cursor=e.end}}has(e){return e.offset+e.size<=this.loaded}data(e){return this.bytes.subarray(e.offset,e.offset+e.size)}stop(){this.abort?.abort(),this.onTrack=this.onData=this.onError=null}};var j=class{constructor(e,t){this.track=e;this.host=t;this.target=-1;this.dir=0;this.busy=null;this.fetched=new Set;this.present=new Array(e.order.length),e.order.forEach((r,o)=>this.present[r]=o)}get frames(){return this.track.order.length}want(e,t=0){let r=this.frames,o=r?Math.max(0,Math.min(r-1,Math.round(e))):-1;o!==this.target&&this.fetched.clear(),this.target=o,this.dir=t>0?1:t<0?-1:0}next(){if(this.busy||this.target<0)return null;let e=this.reachable(this.target);if(e<0)return null;let t=this.host.has(e)?this.ahead(e):e;if(t<0)return null;t!==e&&this.fetched.add(t);let r=this.track.order[t],o=this.track.keyOf[r],i=Math.max(1,Math.floor(this.host.window()/2)),a=new Set([t]);for(let s=o;s<r;s++){let f=this.present[s];Math.abs(f-e)<=i&&!this.host.has(f)&&a.add(f)}return this.busy={from:o,to:r,goal:t,keep:a},this.busy}forget(){this.fetched.clear()}done(){this.busy=null}ready(e){let t=this.track.order[e];return t!==void 0&&this.host.available(t)&&this.host.available(this.track.keyOf[t])}reachable(e){if(this.ready(e))return e;let t=this.frames;for(let r=1;r<t;r++){if(e-r>=0&&this.ready(e-r))return e-r;if(e+r<t&&this.ready(e+r))return e+r}return-1}ahead(e){let t=this.frames,r=this.host.window(),o=Math.min(12,Math.max(1,Math.floor(r/2)-1),Math.floor((r-1)/2));for(let i=1;i<=o;i++)for(let a=0;a<(this.dir?1:2);a++){let s=e+i*(this.dir||1-2*a);if(!(s<0||s>=t)&&!this.host.has(s)&&!this.fetched.has(s)&&this.ready(s))return s}return-1}},je=25,Je=10;function et(n){if(!n.length)return 0;let e=n.slice().sort((t,r)=>t-r);return e[Math.min(e.length-1,Math.ceil(e.length*.95)-1)]}function Re(n){return n.length<Je?null:et(n)>je}var rt=3,Pe="umber:scrub-decode",nt=()=>typeof navigator<"u"&&/Android/i.test(navigator.userAgent||"");function st(){try{let n=localStorage.getItem(Pe);return n==="prefer-software"||n==="prefer-hardware"?n:null}catch{return null}}var ot={hvc1:"HEVC (hvc1)",hev1:"HEVC (hev1)",av01:"AV1",vp09:"VP9",vp08:"VP8"},He=()=>typeof globalThis.VideoDecoder=="function"&&typeof globalThis.EncodedVideoChunk=="function",J=class{constructor(e,t){this.url=e;this.host=t;this.tier="decoder";this.stream=new Z;this.track=null;this.schedule=null;this.decoder=null;this.config=null;this.made=null;this.accel="no-preference";this.byTime=new Map;this.running=!1;this.on=!0;this.dead=!1;this.errors=0;this.timings=[];this.keep=null;this.outputs=0}start(){let e=this.stream;e.onTrack=t=>this.configure(t),e.onData=()=>this.pump(),e.onError=t=>this.fail(`could not read the video (${t instanceof Error?t.message:t})`),e.start(this.url)}async configure(e){if(!e.codec||!e.description)return this.fail(`is ${ot[e.format]||e.format||"not H.264"}, and WebCodecs scrubbing reads H.264`,!0);if(e.fragmented&&!e.order.length)return this.fail("is a fragmented MP4 (its frames are indexed in fragments), which WebCodecs scrubbing doesn't read",!0);if(!e.order.length)return this.fail("has no frames in its index",!0);this.stream.late&&!this.stream.done&&this.host.log.warn('scrub video is not "faststart" (its index is at the end), so nothing shows until it fully downloads. Encode it with: npm run scrub -- input.mov'),e.cuts&&this.host.log.warn("scrub video has an edit list with several cuts, which the scrub does not follow: it shows every frame of the file. Re-encode it with: npm run scrub -- input.mov"),e.gop>10&&this.host.log.warn(`scrub video has a keyframe only every ${e.gop} frames: each step back decodes up to that many. For smooth scrubbing encode it with: npm run scrub -- input.mov`);let t=globalThis.VideoDecoder,r={codec:e.codec,codedWidth:e.width,codedHeight:e.height,description:e.description,optimizeForLatency:!0},o=nt()?st()||"prefer-hardware":"no-preference",i=o==="no-preference"?["no-preference"]:[o,"no-preference"];for(let s of i)try{let f=s==="no-preference"?r:{...r,hardwareAcceleration:s},l=await t.isConfigSupported(f);if(this.dead)return;if(l?.supported){this.config=f,this.accel=s;break}}catch{}if(!this.config)return this.fail(`this browser can't decode ${e.codec} with WebCodecs`);this.track=e,e.order.forEach((s,f)=>this.byTime.set(this.micros(e.samples[s].cts),f));let a=this.host.frames;this.schedule=new j(e,{has:s=>a.has(s),available:s=>this.stream.has(e.samples[s]),window:()=>Math.min(a.capacity(e.width,e.height),48)}),this.host.ready({frames:e.order.length,fps:e.fps,width:e.width,height:e.height}),this.pump()}micros(e){return Math.round(e/this.track.timescale*1e6)}request(e,t){this.schedule&&(this.schedule.want(e,t),this.pump())}active(e){this.on=e,e?(this.schedule?.forget(),this.pump()):this.close()}reset(){this.schedule?.forget(),this.pump()}decoderNow(){if(this.decoder&&this.decoder.state!=="closed"&&this.made===this.config)return this.decoder;this.close();let e=globalThis.VideoDecoder,t=new e({output:r=>this.output(r),error:r=>this.onError(t,r)});return t.configure(this.made=this.config),this.decoder=t,t}output(e){this.outputs++;let t=this.byTime.get(e.timestamp);if(t===void 0||this.dead||!this.keep?.has(t)||this.host.frames.ready(t)){e.close();return}this.host.frames.put(t,e,!0),this.host.delivered()}onError(e,t){e===this.decoder&&(this.decoder=null),t?.name!=="QuotaExceededError"&&this.host.log.info("scrub decoder error",t)}async pump(){if(this.running||this.dead||!this.on||!this.schedule||!this.track)return;let e=this.schedule.next();if(!e)return;this.running=!0;let t=this.track,r=performance.now(),o=this.errors,i=!0;try{let a=this.decoderNow();this.keep=e.keep,this.outputs=0;let s=globalThis.EncodedVideoChunk;for(let f=e.from;f<=e.to;f++){let l=t.samples[f];a.decode(new s({type:f===e.from||l.key?"key":"delta",timestamp:this.micros(l.cts),duration:this.micros(l.duration),data:this.stream.data(l)}))}await a.flush(),this.outputs===0&&(i=!1,this.errors++,this.close())}catch(a){i=!1,a?.name!=="QuotaExceededError"&&a?.name!=="AbortError"&&this.errors++,this.close()}if(this.running=!1,this.schedule?.done(),!this.dead){if(i)this.errors=0,this.time((performance.now()-r)/(e.to-e.from+1));else{if(this.errors>=rt)return this.fail("the video decoder keeps failing");this.errors>o&&this.schedule?.forget()}this.pump()}}time(e){if(this.accel!=="prefer-hardware"||(this.timings.push(e),this.timings.length===1))return;let t=Re(this.timings.slice(1));if(t===null)return;let r=t?"prefer-software":"prefer-hardware";try{localStorage.setItem(Pe,r)}catch{}if(this.accel="no-preference",!t)return;let o={...this.config,hardwareAcceleration:"prefer-software"};globalThis.VideoDecoder.isConfigSupported(o).then(i=>{!i?.supported||this.dead||(this.host.log.info("scrub: hardware decoding is slow at seeking here; using the software decoder"),this.config=o,this.accel="prefer-software",this.running||this.close())}).catch(()=>{})}close(){let e=this.decoder;if(this.decoder=null,e&&e.state!=="closed")try{e.close()}catch{}}fail(e,t){this.dead||(this.destroy(),this.host.failed(e,t))}destroy(){this.dead=!0,this.stream.stop(),this.close(),this.schedule=null}};var ee=class{constructor(e,t,r,o){this.video=e;this.host=t;this.fps=r;this.src=o;this.tier="video";this.frames=0;this.target=-1;this.seeking=-1;this.landed=-1;this.fastFor=-1;this.errors=0;this.on=!0;this.dead=!1;this.cors=!1;this.offs=[]}start(){let e=this.video;e.muted=!0,e.playsInline=!0,e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.disableRemotePlayback=!0,e.pause();let t=e.currentSrc||e.getAttribute("src")||e.querySelector("source")?.getAttribute("src")||"",r=this.src||t,o=e.preload!=="auto";e.preload="auto";try{r&&new URL(r,location.href).origin!==location.origin&&!e.crossOrigin&&(e.crossOrigin="anonymous",this.cors=o=!0)}catch{}this.src&&this.src!==t&&(e.src=this.src,o=!0),this.listen("seeked",()=>this.onSeeked()),this.listen("error",a=>{let s=e.querySelectorAll("source");(a.target===e||a.target===s[s.length-1])&&this.fail(this.cors?"the video failed to load (another domain: no CORS headers?)":"the video failed to load")},!0),e.readyState>=1&&!o?this.onMeta():(this.listen("loadedmetadata",()=>this.onMeta()),this.meta()),o&&e.load();let i=()=>{this.dead||e.readyState>=2||e.play().then(()=>e.pause()).catch(()=>{})};addEventListener("touchstart",i,{once:!0,passive:!0}),this.offs.push(()=>removeEventListener("touchstart",i))}listen(e,t,r=!1){this.video.addEventListener(e,t,r),this.offs.push(()=>this.video.removeEventListener(e,t,r))}meta(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.frames||this.dead||(this.video.networkState===1?this.meta():this.fail("the video's metadata never loaded"))},1e4)}onMeta(){if(this.frames||this.dead)return;let e=this.video;if(!Number.isFinite(e.duration)||e.duration<=0)return this.fail("the video has no duration (a live stream?)");this.frames=Math.max(1,Math.round(e.duration*this.fps)),this.host.ready({frames:this.frames,fps:this.fps,width:e.videoWidth,height:e.videoHeight}),this.pump()}request(e){this.frames&&(this.target=Math.max(0,Math.min(this.frames-1,Math.round(e))),this.pump())}active(e){this.on=e,this.pump()}reset(){this.seeking=-1,this.landed=-1,this.pump()}pump(){if(this.dead||!this.on||this.target<0)return;if(this.seeking>=0){let i=this.host.frames;if(this.landed>=0&&(i.ready(this.landed)||!i.has(this.landed)))this.seeking=-1,this.landed=-1;else return}let e=this.target;if(this.host.frames.has(e))return;let t=this.video;if(t.readyState<1)return;this.seeking=e,this.landed=-1;let r=Math.min((e+.5)/this.fps,Math.max(0,t.duration-.001)),o=Math.round(t.currentTime*this.fps-.5);typeof t.fastSeek=="function"&&Math.abs(e-o)>6&&e!==this.fastFor?(this.fastFor=e,t.fastSeek(r)):t.currentTime=r,clearTimeout(this.timer),this.timer=setTimeout(()=>{this.seeking<0||this.landed>=0||(this.seeking=-1,++this.errors>=3?this.fail("seeking the video never lands"):this.pump())},4e3)}onSeeked(){if(this.dead||this.seeking<0)return;clearTimeout(this.timer),this.errors=0;let e=this.video,t=Math.max(0,Math.min(this.frames-1,Math.floor(e.currentTime*this.fps+.001)));this.landed=t,this.host.frames.put(t,e,!1),this.host.delivered()}fail(e){this.dead||(this.destroy(),this.cors&&(this.video.removeAttribute("crossorigin"),this.video.load()),this.host.failed(e))}destroy(){this.dead=!0,clearTimeout(this.timer),this.offs.forEach(e=>e()),this.offs=[]}};var it=4,at=8,ut=2,ct=4,te=class{constructor(e,t,r,o){this.pattern=e;this.count=t;this.fps=r;this.host=o;this.tier="frames";this.target=-1;this.dir=0;this.loading=new Set;this.failedFrames=new Set;this.errors=0;this.known=!1;this.width=0;this.height=0;this.on=!0;this.dead=!1;this.abort=typeof AbortController<"u"?new AbortController:null}start(){if(!(this.count>0))return this.fail('data-gl-scrub-frames needs data-gl-scrub-count="<number of frames>"');this.load(0)}request(e,t){this.target=Math.max(0,Math.min(this.count-1,Math.round(e))),this.dir=t>0?1:t<0?-1:0,this.pump()}active(e){this.on=e,this.pump()}reset(){this.pump()}pump(){if(this.dead||!this.on||!this.known||this.target<0)return;let e=this.host.frames,t=this.dir>=0?1:-1,r=e.capacity(this.width,this.height)-1,o=Math.min(ut,r>>2),i=Math.min(at,r-o);for(let a=0;a<=Math.max(0,i+o)&&this.loading.size<it;a++){let s=this.target+(a<=i?a:i-a)*t;s<0||s>=this.count||e.has(s)||this.loading.has(s)||this.failedFrames.has(s)||this.load(s)}}async load(e){this.loading.add(e);let t=Ue(this.pattern,e);try{let r=await fetch(t,{mode:"cors",credentials:"omit",signal:this.abort?.signal});if(!r.ok)throw new Error(`HTTP ${r.status}`);let o=await r.blob(),i=await createImageBitmap(o,{premultiplyAlpha:"none",colorSpaceConversion:"default"}),a=this.host.maxTexture;if(i.width>a||i.height>a){let s=a/Math.max(i.width,i.height),f=await createImageBitmap(i,{resizeWidth:Math.floor(i.width*s),resizeHeight:Math.floor(i.height*s),resizeQuality:"high"});i.close(),i=f}if(this.loading.delete(e),this.dead)return i.close();this.errors=0,this.known||(this.known=!0,this.width=i.width,this.height=i.height,this.host.ready({frames:this.count,fps:this.fps,width:i.width,height:i.height})),this.host.frames.put(e,i,!0),this.host.delivered()}catch(r){if(this.loading.delete(e),this.dead)return;if(this.failedFrames.add(e),this.host.log.warn(`scrub frame ${t} failed to load`,r),!this.known||++this.errors>=ct)return this.fail(`the image sequence ${this.pattern} does not load`)}this.pump()}fail(e){this.dead||(this.destroy(),this.host.failed(e))}destroy(){this.dead=!0,this.abort?.abort()}};var Oe=()=>{let n=typeof globalThis<"u"&&globalThis.occluzeCapture;return n?.version==1?n:null},fe=()=>new Promise(n=>{let e=new MessageChannel;e.port1.onmessage=n,e.port2.postMessage(0)});var Le=n=>new Promise(e=>{let t=AbortSignal.timeout?.(n);t?t.onabort=()=>e():setTimeout(e,n)});var lt={high:128,mid:48,low:32},_e=new Set,dt=.12,ht=250,ft=20,me={start:"top bottom",end:"bottom top",track:"",smooth:-1,source:"auto",src:"",srcMobile:"",frames:"",count:0,fps:0,blend:!0,cache:0,reduced:""},Be={uniforms:{uScrubProgress:0,uScrubVelocity:0},fragment:{head:`uniform sampler2D uFrameNext;
3
3
  uniform float uFrameMix;
4
4
  vec4 scrubNext(vec2 uv) {
5
5
  vec2 f = fitUv(uv);
6
6
  if (uFit > 0.5 && uFit < 1.5 && (f.x < 0.0 || f.y < 0.0 || f.x > 1.0 || f.y > 1.0)) return vec4(0.0);
7
7
  return texture(uFrameNext, f);
8
- }`,color:"if (uFrameMix > 0.0) color = mix(color, scrubNext(uv), uFrameMix);"}};function mt(n,e){let t=e.trim();if(!t||t==="self")return null;if(t==="parent")return n.parentElement;try{return t.startsWith("closest ")?n.closest(t.slice(8).trim()):n.closest(t)||document.querySelector(t)}catch{return null}}function pt(n,e){return e||n?.currentSrc||n?.getAttribute("src")||n?.querySelector("source")?.getAttribute("src")||""}function Ve(n){let{el:e,log:t}=n,r=xe(e,"gl-scrub",me),o=(e.getAttribute("data-gl-scrub")||"").trim().toLowerCase(),i=Q(r.start,me.start),a=Q(r.end,me.end),s=n.media instanceof HTMLVideoElement?n.media:null,f=n.tier!=="high"&&!!r.srcMobile,l=pt(s,f?r.srcMobile:r.src),M=(f?r.srcMobile:r.src)||"",E=n.options,w=null,U=()=>w||(w=n.frames,w.budget=(r.cache>0?r.cache:E.cacheMB||lt[n.tier])*2**20,w),F=String(r.source||"auto").toLowerCase(),m;F==="decoder"||F==="video"||F==="frames"?m=[F]:(m=[],l&&He()&&m.push("decoder"),s&&l&&m.push("video"),r.frames&&m.push("frames"));let x=new Map,b=d=>{let p=x.get(d);if(p){for(let y of[...p])if(p.has(y))try{y(B)}catch(R){t.error(`a scrub "${d}" handler threw:`,R)}}},T="loading",P=0,S=null,g=null,H=!1,k=!1,A=o==="manual",O=0,h=0,c=0,u=0,v=0,C=0,$=!0,re=!0,q=()=>{},$e=new Promise(d=>q=d),pe=Oe(),L=null,ge=[],ne=0,be=()=>ge.every(d=>U().has(d));function De(d){ge=d,!(L||ne>=ft)&&pe.wait(new Promise(p=>{let y=L=R=>{L===y&&(L=null,R&&ne++,p())};be()&&fe().then(()=>y()),Le(ht).then(()=>y(!0))}))}let se=mt(e,r.track);r.track&&!se&&r.track.trim()!=="self"&&t.warn(`data-gl-scrub-track="${r.track}": no such element; the video's own position drives it.`,e);let ye=n.engine,D=se&&ye.track?ye.track(se):null,I=null;function oe(d){!s||d===(I!==null)||(d?(I=s.autoplay,s.autoplay=!1,s.pause()):(s.autoplay=I,I&&s.isConnected&&s.play().catch(()=>{}),I=null))}function ie(d){oe(!1),T="poster",S?.destroy(),S=null,g=null,n.busy(!1),n.fail(d),q(!1),L?.(),b("tier")}let ae={get frames(){return U()},log:t,maxTexture:n.maxTexture,ready(d){k||(T==="decoder"&&(P=d.fps),g&&g.frames!==d.frames&&(c=Math.min(c,d.frames-1)),g=d,$=!0,n.wake())},delivered(){k||(re&&(re=!1,q(!0),b("ready")),L&&be()&&fe().then(()=>L?.()),n.wake())},failed(d,p){if(k)return;let y=p?new URL(l,location.href).href:"";if(p&&(d=`the video ${y} ${d}. Encode it with: npm run scrub -- input.mov`),p&&m.length&&!_e.has(y)){_e.add(y);let R=m[0]==="video"?"by seeking the <video>, which is choppier":"from its image sequence";t.warn(`scrub: ${d.replace(/\. Encode/,`, so it scrubs ${R}. Encode`)}`,e)}else t.info(`scrub: ${T} tier failed (${d})`,e);w?.clear(),g=null,S=null,L?.(),ue(d)}};function ue(d){let p=m.shift();if(!p)return b("error"),ie(`scrub: ${d||"nothing to scrub (no video src and no data-gl-scrub-frames)"}; the <video> and its poster show instead.`);if(T=p,oe(!0),p==="decoder"){let y=new J(new URL(l,location.href).href,ae);S=y,y.start()}else if(p==="video"){if(!s)return ue('data-gl-scrub-source="video" needs a <video>');let y=new ee(s,ae,r.fps>0?r.fps:P||30,M);S=y,y.start()}else{let y=new te(r.frames,Math.round(r.count),r.fps>0?r.fps:30,ae);S=y,y.start()}b("tier")}function Ie(){return n.reducedMotion?0:r.smooth>=0?r.smooth:n.scrollKind==="lenis"||n.engine.scroll||document.documentElement.classList.contains("lenis")?0:dt}let B={get progress(){return h},set progress(d){A=!0,O=Math.min(1,Math.max(0,Number(d)||0)),n.wake()},get drive(){return A?"manual":"scroll"},set drive(d){A=d==="manual",A&&(O=h),n.wake()},get time(){return g?c/g.fps:0},set time(d){g&&(B.progress=d*g.fps/Math.max(1,g.frames-1))},get frame(){return c},get frames(){return g?.frames||0},get fps(){return g?.fps||0},get duration(){return g?g.frames/g.fps:0},get tier(){return T},ready:$e,on(d,p){return x.has(d)||x.set(d,new Set),x.get(d).add(p),()=>B.off(d,p)},off(d,p){x.get(d)?.delete(p)},destroy(){n.plane.destroy()}},ve={uniforms:Be.uniforms},ze=String(r.reduced||E.reducedMotion||"poster").toLowerCase();return n.reducedMotion&&ze!=="scrub"?(ie(),{api:B,source:!0,effect:ve}):m.length?{api:B,source:!0,effect:Be,near(d){if(!(k||T==="poster")){if(d&&($=!0),!H&&d){H=!0,ue();return}S?.active(d),d||w?.clear(!0)}},update(d,p,y){if(!g||!S||k)return!1;if(A)h=O;else{let _=D?D.rect.y:p[1],we=D?D.rect.height:p[3];if(!(we>0))return!1;h=de(_,we,y.height,i,a)}let R=g.frames;u=h*(R-1);let ce=c;c=$?u:Te(c,u,Ie(),d.dt),$=!1,Math.abs(u-c)<.01&&(c=u),v=d.dt>0?(c-ce)/Math.max(1,R-1)/d.dt:0,C=Math.sign(u-c)||Math.sign(c-ce)||C,n.busy(c!==u);let z=U();z.focus(Math.round(c)),S.request(c,C);let X=Ae(c,R,_=>z.ready(_),()=>z.keys(),r.blend!==!1);if(X&&z.show(X.a,X.b,X.mix),pe&&p[1]<y.height&&p[1]+p[3]>0&&p[0]<y.width&&p[0]+p[2]>0){let _=[Math.round(Math.max(0,Math.min(R-1,c)))];z.ready(_[0])?ne=0:De(_)}let N=n.plane.uniforms;N.uScrubProgress&&(N.uScrubProgress.value=c/Math.max(1,R-1));let le=c!==ce;if(N.uScrubVelocity){let _=le?v:0;le||=N.uScrubVelocity.value!==_,N.uScrubVelocity.value=_}return le},lost(){$=!0},src:()=>!M,restored(){S?.reset(),n.wake()},destroy(){k=!0,S?.destroy(),S=null,oe(!1),D?.destroy(),x.clear(),L?.(),re&&q(!1)}}:(ie(`scrub: nothing to scrub here (${s?"the <video> has no src":"no <video> inside"} and no data-gl-scrub-frames); it shows as plain DOM.`),{api:B,source:!0,effect:ve})}var gt={name:"scrub",version:"0.2.0",attributes:["scrub"],plane:n=>Ve(n)},Dt=gt;export{gt as Scrub,Dt as default};
8
+ }`,color:"if (uFrameMix > 0.0) color = mix(color, scrubNext(uv), uFrameMix);"}};function mt(n,e){let t=e.trim();if(!t||t==="self")return null;if(t==="parent")return n.parentElement;try{return t.startsWith("closest ")?n.closest(t.slice(8).trim()):n.closest(t)||document.querySelector(t)}catch{return null}}function pt(n,e){return e||n?.currentSrc||n?.getAttribute("src")||n?.querySelector("source")?.getAttribute("src")||""}function Ve(n){let{el:e,log:t}=n,r=xe(e,"gl-scrub",me),o=(e.getAttribute("data-gl-scrub")||"").trim().toLowerCase(),i=Q(r.start,me.start),a=Q(r.end,me.end),s=n.media instanceof HTMLVideoElement?n.media:null,f=n.tier!=="high"&&!!r.srcMobile,l=pt(s,f?r.srcMobile:r.src),M=(f?r.srcMobile:r.src)||"",E=n.options,w=null,U=()=>w||(w=n.frames,w.budget=(r.cache>0?r.cache:E.cacheMB||lt[n.tier])*2**20,w),F=String(r.source||"auto").toLowerCase(),m;F==="decoder"||F==="video"||F==="frames"?m=[F]:(m=[],l&&He()&&m.push("decoder"),s&&l&&m.push("video"),r.frames&&m.push("frames"));let x=new Map,b=d=>{let p=x.get(d);if(p){for(let y of[...p])if(p.has(y))try{y(B)}catch(R){t.error(`a scrub "${d}" handler threw:`,R)}}},T="loading",P=0,S=null,g=null,H=!1,k=!1,A=o==="manual",O=0,h=0,c=0,u=0,v=0,C=0,$=!0,re=!0,q=()=>{},$e=new Promise(d=>q=d),pe=Oe(),L=null,ge=[],ne=0,be=()=>ge.every(d=>U().has(d));function De(d){ge=d,!(L||ne>=ft)&&pe.wait(new Promise(p=>{let y=L=R=>{L===y&&(L=null,R&&ne++,p())};be()&&fe().then(()=>y()),Le(ht).then(()=>y(!0))}))}let se=mt(e,r.track);r.track&&!se&&r.track.trim()!=="self"&&t.warn(`data-gl-scrub-track="${r.track}": no such element; the video's own position drives it.`,e);let ye=n.engine,D=se&&ye.track?ye.track(se):null,I=null;function oe(d){!s||d===(I!==null)||(d?(I=s.autoplay,s.autoplay=!1,s.pause()):(s.autoplay=I,I&&s.isConnected&&s.play().catch(()=>{}),I=null))}function ie(d){oe(!1),T="poster",S?.destroy(),S=null,g=null,n.busy(!1),n.fail(d),q(!1),L?.(),b("tier")}let ae={get frames(){return U()},log:t,maxTexture:n.maxTexture,ready(d){k||(T==="decoder"&&(P=d.fps),g&&g.frames!==d.frames&&(c=Math.min(c,d.frames-1)),g=d,$=!0,n.wake())},delivered(){k||(re&&(re=!1,q(!0),b("ready")),L&&be()&&fe().then(()=>L?.()),n.wake())},failed(d,p){if(k)return;let y=p?new URL(l,location.href).href:"";if(p&&(d=`the video ${y} ${d}. Encode it with: npm run scrub -- input.mov`),p&&m.length&&!_e.has(y)){_e.add(y);let R=m[0]==="video"?"by seeking the <video>, which is choppier":"from its image sequence";t.warn(`scrub: ${d.replace(/\. Encode/,`, so it scrubs ${R}. Encode`)}`,e)}else t.info(`scrub: ${T} tier failed (${d})`,e);w?.clear(),g=null,S=null,L?.(),ue(d)}};function ue(d){let p=m.shift();if(!p)return b("error"),ie(`scrub: ${d||"nothing to scrub (no video src and no data-gl-scrub-frames)"}; the <video> and its poster show instead.`);if(T=p,oe(!0),p==="decoder"){let y=new J(new URL(l,location.href).href,ae);S=y,y.start()}else if(p==="video"){if(!s)return ue('data-gl-scrub-source="video" needs a <video>');let y=new ee(s,ae,r.fps>0?r.fps:P||30,M);S=y,y.start()}else{let y=new te(r.frames,Math.round(r.count),r.fps>0?r.fps:30,ae);S=y,y.start()}b("tier")}function Ie(){return n.reducedMotion?0:r.smooth>=0?r.smooth:n.scrollKind==="lenis"||n.engine.scroll||document.documentElement.classList.contains("lenis")?0:dt}let B={get progress(){return h},set progress(d){A=!0,O=Math.min(1,Math.max(0,Number(d)||0)),n.wake()},get drive(){return A?"manual":"scroll"},set drive(d){A=d==="manual",A&&(O=h),n.wake()},get time(){return g?c/g.fps:0},set time(d){g&&(B.progress=d*g.fps/Math.max(1,g.frames-1))},get frame(){return c},get frames(){return g?.frames||0},get fps(){return g?.fps||0},get duration(){return g?g.frames/g.fps:0},get tier(){return T},ready:$e,on(d,p){return x.has(d)||x.set(d,new Set),x.get(d).add(p),()=>B.off(d,p)},off(d,p){x.get(d)?.delete(p)},destroy(){n.plane.destroy()}},ve={uniforms:Be.uniforms},ze=String(r.reduced||E.reducedMotion||"poster").toLowerCase();return n.reducedMotion&&ze!=="scrub"?(ie(),{api:B,source:!0,effect:ve}):m.length?{api:B,source:!0,effect:Be,near(d){if(!(k||T==="poster")){if(d&&($=!0),!H&&d){H=!0,ue();return}S?.active(d),d||w?.clear(!0)}},update(d,p,y){if(!g||!S||k)return!1;if(A)h=O;else{let _=D?D.rect.y:p[1],we=D?D.rect.height:p[3];if(!(we>0))return!1;h=de(_,we,y.height,i,a)}let R=g.frames;u=h*(R-1);let ce=c;c=$?u:Te(c,u,Ie(),d.dt),$=!1,Math.abs(u-c)<.01&&(c=u),v=d.dt>0?(c-ce)/Math.max(1,R-1)/d.dt:0,C=Math.sign(u-c)||Math.sign(c-ce)||C,n.busy(c!==u);let z=U();z.focus(Math.round(c)),S.request(c,C);let X=Ae(c,R,_=>z.ready(_),()=>z.keys(),r.blend!==!1);if(X&&z.show(X.a,X.b,X.mix),pe&&p[1]<y.height&&p[1]+p[3]>0&&p[0]<y.width&&p[0]+p[2]>0){let _=[Math.round(Math.max(0,Math.min(R-1,c)))];z.ready(_[0])?ne=0:De(_)}let N=n.plane.uniforms;N.uScrubProgress&&(N.uScrubProgress.value=c/Math.max(1,R-1));let le=c!==ce;if(N.uScrubVelocity){let _=le?v:0;le||=N.uScrubVelocity.value!==_,N.uScrubVelocity.value=_}return le},lost(){$=!0},src:()=>!M,restored(){S?.reset(),n.wake()},destroy(){k=!0,S?.destroy(),S=null,oe(!1),D?.destroy(),x.clear(),L?.(),re&&q(!1)}}:(ie(`scrub: nothing to scrub here (${s?"the <video> has no src":"no <video> inside"} and no data-gl-scrub-frames); it shows as plain DOM.`),{api:B,source:!0,effect:ve})}var gt={name:"scrub",version:"0.2.1",attributes:["scrub"],plane:n=>Ve(n)},Dt=gt;export{gt as Scrub,Dt as default};
package/dist/umber.css CHANGED
@@ -1,2 +1,2 @@
1
- /*! Umber v0.2.0 */
1
+ /*! Umber v0.2.1 */
2
2
  [data-gl-host]{position:fixed;top:0;left:0;right:0;height:100vh;height:100lvh;pointer-events:none}[data-gl-host]>canvas{position:absolute;inset:0;width:100%;height:100%;display:block}@media print{[data-gl-host]{display:none!important}}@media not print{.has-gl [data-gl]:not([data-gl=group])[data-gl-status=ready] [data-gl-media],.has-gl [data-gl][data-gl-status=ready][data-gl-media]{opacity:0!important}.has-gl [data-gl=text][data-gl-status=ready],.has-gl [data-gl=text][data-gl-status=ready] *{-webkit-text-fill-color:transparent!important;text-shadow:none!important;text-decoration-color:transparent!important}.has-gl [data-gl=shader][data-gl-status=ready]{background:transparent!important}.has-gl [data-gl]:not([data-gl=group])[data-gl-status=loading][data-gl-play] [data-gl-media],.has-gl [data-gl][data-gl-status=loading][data-gl-play][data-gl-media]{opacity:0!important}.has-gl [data-gl=text][data-gl-status=loading][data-gl-play],.has-gl [data-gl=text][data-gl-status=loading][data-gl-play] *{-webkit-text-fill-color:transparent!important;text-shadow:none!important;text-decoration-color:transparent!important}.has-gl [data-gl][data-gl-morphing] [data-gl-media],.has-gl [data-gl][data-gl-morphing][data-gl-media]{opacity:0!important}.has-gl [data-gl=text][data-gl-morphing],.has-gl [data-gl=text][data-gl-morphing] *{-webkit-text-fill-color:transparent!important;text-shadow:none!important;text-decoration-color:transparent!important}.has-gl [data-gl=shader][data-gl-morphing]{background:transparent!important}}:where([data-gl-above]){position:relative;z-index:2}
package/dist/umber.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! Umber v0.2.0 | (c) Ravi Klaassens | UNLICENSED */
2
- "use strict";(()=>{var ve="[umber]";var je=!1,Ue=!0,we=0,$e=new Set;function At(e){return $e.has(e)||we>=100?!1:($e.add(e),we++,we===100&&console.warn(ve,"100 messages shown; the rest of this visit stays quiet."),!0)}var O={configure(e){e.debug!==void 0&&(je=e.debug),e.warnings!==void 0&&(Ue=e.warnings)},get debug(){return je},get warnings(){return Ue},info(...e){je&&console.log(ve,...e)},warn(e,...t){Ue&&At(e)&&console.warn(ve,e,...t)},once(e,...t){O.warn(e,...t)},error(e,...t){At(String(e))&&console.error(ve,e,...t)},reset(){$e.clear(),we=0}};function Ee(e){try{return new URLSearchParams(location.search).get(e)}catch{return null}}var Ge;function ke(e){Ge=e}function V(e,t,...n){O.warnings&&D(e,t,O.warn,...n)}function D(e,t,n,...o){(Ge?Ge():Promise.reject()).then(i=>n(i.words[e](...t),...o),()=>n(e,...t,...o))}var Fn=["measure","update","render"];function Ct(e={}){let t=e.auto!==!1,n=e.raf||(k=>requestAnimationFrame(k)),o=e.caf||(k=>cancelAnimationFrame(k)),i={time:0,dt:1/60,ratio:1,frame:0,woke:!0,scroll:{x:0,y:0,velocity:0}},f=[],u=0,c=0,a=!1,m=0,y=0,E=!1,g=!1,d=!1,x=500,l=33,w=1e3/60;function M(){return c>0||u>0}function b(k=typeof performance<"u"?performance.now():Date.now()){if(E||d)return;let S=y?k-y:w;i.woke=!y,y&&S>0&&S<=50&&(w=S),S>x&&(S=l,i.woke=!0),S<=0&&(S=.1),y=k,i.dt=S/1e3,i.time+=i.dt,i.ratio=i.dt*60,i.frame++,c>0&&c--,E=!0;let W=f;try{for(let B=0;B<W.length;B++){let X=W[B];if(!X.dead)try{X.fn(i)}catch(U){X.errored||(X.errored=!0,D("frame",[],O.error,U))}}}finally{E=!1}a&&!M()&&C()}let h=k=>{m=n(h),b(k)};function T(){!t||a||d||!M()||(a=!0,m=n(h))}function C(){a&&(a=!1,o(m),m=0,y=0)}function _(k,S={}){let W={fn:k,phase:Math.max(0,Fn.indexOf(S.phase||"update")),order:S.order||0,always:!!S.always,dead:!1,errored:!1};return W.always&&u++,f=[...f,W].sort((B,X)=>B.phase-X.phase||B.order-X.order),W.always&&T(),()=>A(W)}function A(k){k.dead||(k.dead=!0,k.always&&u--,f=f.filter(S=>S!==k))}return{frame:i,add:_,tick:b,wake(k=1){c=Math.max(c,k),T()},follow(){!a||g||(g=!0,queueMicrotask(()=>{g=!1,a&&(o(m),m=n(h))}))},lagSmoothing(k,S=33){x=k>0?k:1/0,l=Math.min(S,x)},get running(){return a},get auto(){return t},destroy(){C(),d=!0,f.forEach(k=>k.dead=!0),f=[],u=0}}}var Nt=(e,t)=>{let n=typeof e=="function"?e():e;return typeof n=="number"&&Number.isFinite(n)?n:t};function zn(e){let t=e;return!!t&&typeof t.on=="function"&&(typeof t.animatedScroll=="number"||typeof t.scroll=="number")}var Vt=e=>typeof window<"u"&&e===window;function _t(e,t,n=!1){return e.addEventListener("scroll",t,{passive:!0,capture:n}),()=>e.removeEventListener("scroll",t,n)}function xe(e){let t=NaN,n=NaN,o={x:0,y:0},i={x:0,y:0,velocity:0},f=a=>(o.x=a?a.scrollLeft:window.scrollX||0,o.y=a?a.scrollTop:window.scrollY||0,o),u=a=>(i.x=n=o.x,i.y=t=o.y,i.velocity=a,i),c=(a,m,y=Math.abs(o.x-n)>Math.abs(o.y-t)?"x":"y")=>{let E=y==="y"?t:n;if(m||!Number.isFinite(E)||a<=0)return 0;let g=o[y]-E,d=y==="y"?window.innerHeight||800:window.innerWidth||1200;return Math.abs(g)>d?0:g/a};if(e??=document.querySelector("[data-gl-scroll-wrapper]"),e==null||Vt(e)){let a=!1,m=()=>f(a?document.body:null);return{kind:"window",root:null,read:m,sample(y,E=!1){return m(),u(c(y,E))},contains:()=>!0,ma:y=>_t(window,E=>{let g=E.target;(g===document.body||!g.tagName)&&(a=!!g.tagName,y())},!0)}}if(zn(e)){let a=e,m=a.options?.wrapper,y=m&&!Vt(m)&&m.nodeType===1?m:null,E=()=>!!a.isHorizontal||a.options?.orientation==="horizontal",g=()=>f(y);return{kind:"lenis",root:y,read:g,sample(d,x=!1){g();let l=a.velocity;return u(typeof l=="number"&&Number.isFinite(l)?x||d<=0||o.x===n&&o.y===t?0:l/d:c(d,x,E()?"x":"y"))},contains:d=>!y||y.contains(d),ma(d){let x=a.on("scroll",d);return()=>{typeof x=="function"?x():a.off?.("scroll",d)}}}}if(typeof Element<"u"&&e instanceof Element){let a=e,m=()=>f(a);return{kind:"element",root:a,read:m,sample(y,E=!1){return m(),u(c(y,E))},contains:y=>a.contains(y),ma:y=>_t(a,y)}}if(typeof e=="object"){let a=e;if(a.y===void 0&&a.x===void 0)return V("scroll",[!0]),xe(void 0);let m=()=>(o.x=Nt(a.x,0),o.y=Nt(a.y,0),o);return{kind:"object",root:null,read:m,sample(y,E=!1){m();let g=typeof a.velocity=="function"?a.velocity():a.velocity;return u(typeof g=="number"&&Number.isFinite(g)?E||y<=0?0:g/y:c(y,E))},contains:()=>!0,ma:()=>()=>{}}}return V("scroll",[!1]),xe(void 0)}function Dt(){let e=0,t=0,n,o=new Set,i=()=>typeof performance<"u"?performance.now():Date.now();function f(){clearTimeout(n),n=void 0;let u=t-i();if(e>0)return;if(u>1){n=setTimeout(f,u);return}let c=[...o];o.clear(),c.forEach(a=>a())}return{get held(){return e>0||t-i()>1},whenOpen(u){return this.held?(o.add(u),()=>o.delete(u)):(u(),()=>{})},hold(u){e++;let c=!1,a=(m=0)=>{if(c)return;c=!0,e--;let y=Number(m);Number.isFinite(y)&&y>0&&(t=Math.max(t,i()+y*1e3)),f()};return u&&typeof u.then=="function"&&u.then(()=>a(),()=>a()),a},reset(){e=0,t=0,clearTimeout(n),o.clear()}}}var J=[];function q(e=!0,t=""){let n=new Map;function o(c,a){return n.has(c)||n.set(c,new Set),n.get(c).add(a),()=>i(c,a)}function i(c,a){n.get(c)?.delete(a)}function f(c,a){let m=n.get(c),y=J.length;if(m)for(let E of m)J.push(E);for(let E=y,g=J.length;E<g;E++)if(m.has(J[E]))try{J[E](a)}catch(d){D("handler",[t,c],O.error,d)}J.length=y,e&&typeof document<"u"&&document.dispatchEvent(new CustomEvent(`umber:${c}`,{detail:a}))}function u(){n.clear()}return{on:o,off:i,emit:f,clear:u}}var G="[data-gl]",Ut=new Set(["data-gl","data-gl-effect","data-gl-shader","data-gl-layer","data-gl-instances"]),In=[...Ut,"style","class","hidden","media","disabled","data-gl-src","src","srcset","sizes","data-gl-occlude","data-gl-pass","data-gl-under"],Ht=e=>(e||"").replace(/lenis(-s(crolling|mooth))?|\s/g,""),Wt=e=>e.hasAttribute("data-gl-host")||e.hasAttribute("data-gl-canvas"),Se=e=>e.nodeName==="STYLE"||e.nodeName==="LINK"&&/(^|\s)stylesheet(\s|$)/i.test(e.getAttribute("rel")||""),Ft=e=>Se(e)||e.nodeType===1&&!!e.firstElementChild&&!!e.querySelector("style, link[rel~='stylesheet' i]"),qe="[data-gl-occlude]",zt=G+","+qe,Te=e=>e.nodeType===1&&(e.matches(zt)||!!e.querySelector(zt)),It=e=>[].some.call(e,t=>t.nodeType===1&&!Te(t)&&(t.matches(jt)||!!t.querySelector(jt))),jt="img, video, picture, source",jn=e=>e.matches("img, video, picture")&&!!e.parentElement?.closest(G),Be='[data-gl]:not([data-gl-status="error"]),[data-gl-occlude]',Un=(e,t)=>!!e.parentElement?.parentElement&&!(t?e.matches(Be)||e.querySelector(Be):e.parentElement.closest(G).matches(Be));function $t(e,t){let n=null,o=new Set,i=new Set,f=new Set,u=new Set,c=new Set,a=0,m=!1,y=!1,E=!1,g=!1,d=!1,x=0,l=null,w=null,M=()=>{d||(d=!0,e())},b=()=>a||=setTimeout(()=>(m=!0,M()),250);function h(C){let _=!1;for(let A of C)if(A.type==="characterData")A.target.parentNode?.nodeName==="STYLE"&&(g=!0);else if(A.type==="childList"){x++,!g&&Se(A.target)&&(g=!0),A.addedNodes.forEach(S=>{S.nodeType===1&&!Wt(S)&&((Te(S)||l?.(S)||w?.())&&o.add(S),!g&&Ft(S)&&(g=!0))}),g||A.removedNodes.forEach(S=>g||=Ft(S));let k=A.target.closest?.(G);k&&/^(image|video)?$/.test(Bt(k))&&(It(A.addedNodes)||It(A.removedNodes))&&i.add(k),A.target.closest?.(qe)&&b(),y||A.removedNodes.forEach(S=>y||=Te(S)),l&&!E&&A.removedNodes.forEach(S=>E||=S.nodeType===1&&l(S))}else if(A.type==="attributes"){let k=A.target;if(Wt(k))continue;let S=A.attributeName||"";if(A.oldValue!==null&&A.oldValue===k.getAttribute(S))continue;if(S==="media"||S==="disabled"){Se(k)&&(g=!0);continue}if(S==="data-gl-occlude"||S==="data-gl-pass"){g=!0;continue}if(S==="class"&&Ht(A.oldValue)===Ht(k.getAttribute("class"))){_=!0;continue}if(x++,Ut.has(S))i.add(k);else if(/src|siz/.test(S)){let W=k.closest(G);W&&f.add(W)}else if(!c.has(k)){let W=Te(k);W||jn(k)||l?.(k)?l?.(k)||!Un(k,W)?c.add(k):b():k.closest(qe)&&b()}}C.length&&t?.(),o.size||i.size||f.size||c.size||y||E||g?M():_&&e()}let T=C=>{let _=C.target,A=_?.nodeName==="IMG"&&_.closest(G);if(A)u.add(A);else if(_&&Se(_))g=!0;else return;M()};return{start(){n||typeof MutationObserver>"u"||(n=new MutationObserver(h),n.observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeOldValue:!0,attributeFilter:In}),document.addEventListener("load",T,!0),o.add(document.documentElement),M())},watch(C,_){l=C,w=_||null},collect(){n&&h(n.takeRecords()),d=!1},take(){n&&h(n.takeRecords()),d=!1;let C=!o.size&&!i.size&&!f.size&&!c.size&&!m&&!y&&!E&&!g;if(C&&!u.size)return null;for(let k of u)f.add(k);u.clear();let _=[];for(let k of o){if(!k.isConnected)continue;let S=k.parentElement;for(;S&&!o.has(S);)S=S.parentElement;S||_.push(k)}let A={added:_,removed:y,rebuild:[...i].filter(k=>k.isConnected),sources:[...f].filter(k=>k.isConnected),still:C,touched:[...c].filter(k=>k.isConnected),look:m,detached:E||y,styles:g};return o.clear(),i.clear(),f.clear(),c.clear(),m&&(a=0,m=!1),y=!1,E=!1,g=!1,A},get pending(){return d},get changes(){return x},stop(){n&&document.removeEventListener("load",T,!0),n?.disconnect(),n=null,o.clear(),i.clear(),f.clear(),u.clear(),c.clear(),clearTimeout(a),a=0,m=!1,y=!1,E=!1,g=!1,d=!1}}}function Me(e){return e.matches("img, video")?e:e.querySelector("video, img")}function Ke(e,t=Me(e)){if(!t)return;t.setAttribute("data-gl-media","");let n=t.parentElement?.closest("picture");n&&e.contains(n)&&n.setAttribute("data-gl-media","")}function Gt(e){return/^(text|shader|group)$/.test(Bt(e))}var Bt=e=>(e.getAttribute("data-gl")||"").trim().toLowerCase();function Xe(e){e.hasAttribute("data-gl-media")&&e.removeAttribute("data-gl-media"),e.querySelectorAll("[data-gl-media]").forEach(t=>t.removeAttribute("data-gl-media"))}function Le(e){let t=[];return e instanceof HTMLElement&&e.matches(G)&&t.push(e),e.querySelectorAll(G).forEach(n=>t.push(n)),t}function Re(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){if(t.classList.contains("pin-spacer"))return!0;let n=getComputedStyle(t).position;if(n==="sticky"||n==="fixed")return!0;t=t.parentElement}return!1}function Pe(e,t){return e.getAttribute(t)}function $n(e,t,n=0){let o=Pe(e,t);if(o===null||o.trim()==="")return n;let i=parseFloat(o);return Number.isFinite(i)?i:n}function Gn(e,t,n=""){let o=Pe(e,t);return o===null||o===""?n:o}function Yt(e){let t=e.trim().toLowerCase();if(t===""||t==="true"||t==="1"||t==="yes")return!0;if(t==="false"||t==="0"||t==="no")return!1}function Bn(e,t,n=!1){let o=Pe(e,t);return o===null?n:Yt(o)??n}function qn(e,t){let n=Pe(e,t);return n?n.split(/[\s,]+/).filter(Boolean):[]}function qt(e,t){let n=e.trim();if(t==="number"){let o=parseFloat(n);return Number.isFinite(o)?o:void 0}return t==="boolean"?Yt(n):t==="list"?n.split(/[\s,]+/).filter(Boolean):n.replace(/^["']|["']$/g,"")}function Kn(e){return e.type?e.type:typeof e.default=="number"?"number":typeof e.default=="boolean"?"boolean":Array.isArray(e.default)?"list":"string"}var Kt=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function Ye(e,t,n,o){if(typeof t=="string"){let i=t.replace(/^data-/,""),f=n||{},u={};for(let c in f)u[c]={attr:`data-${i}-${Kt(c)}`,css:`--${i}-${Kt(c)}`,default:f[c]};return Xt(e,u,o)}return Xt(e,t,n)}function Xt(e,t,n){let o={},i=n;for(let f in t){let u=t[f],c=Kn(u),a;if(u.attr){let m=e.getAttribute(u.attr);m!==null&&(a=qt(m,c))}if(a===void 0&&u.css){i||=getComputedStyle(e);let m=i.getPropertyValue(u.css);m&&m.trim()!==""&&(a=qt(m,c))}o[f]=a===void 0?u.default:a}return o}var Oe={num:$n,str:Gn,bool:Bn,list:qn,options:Ye};var Qe=new Map,ee=e=>(Qe.has(e)||Qe.set(e,typeof matchMedia=="function"?matchMedia(e):null),Qe.get(e)),Xn="(prefers-reduced-motion: reduce)",Yn="(pointer: coarse)",Qn="(hover: hover) and (pointer: fine) and (min-width: 768px)",Qt="(forced-colors: active)",Zn="(prefers-reduced-data: reduce)";function Jn(e,t){let n=ee(e),o=i=>t(i.matches);return n?.addEventListener?.("change",o),()=>n?.removeEventListener?.("change",o)}var I={get reducedMotion(){return!!ee(Xn)?.matches},get isTouch(){return!!ee(Yn)?.matches},get isDesktop(){return!!ee(Qn)?.matches},get forcedColors(){return!!ee(Qt)?.matches},get saveData(){let e=typeof navigator<"u"?navigator.connection:null;return!!(e&&(e.saveData||/(^|-)2g$/.test(e.effectiveType||"")))||!!ee(Zn)?.matches},get webgl2(){return typeof window<"u"&&"WebGL2RenderingContext"in window},get designer(){if(typeof document>"u")return!1;let e=document.documentElement;return e.classList.contains("w-editor")||e.classList.contains("wf-design-mode")||!!document.body?.classList.contains("w-editor")},onForcedColorsChange:e=>Jn(Qt,e)};var er=1.5;function Zt(e,t){let n=new Set,o=new Map,i=null,f=null,u=innerWidth;function c(l){!i&&typeof ResizeObserver<"u"&&(i=new ResizeObserver(w=>{for(let M of w)(M.target===document.documentElement?n:o.get(M.target))?.forEach(b=>b.stale=!0);t()}),i.observe(document.documentElement)),i?.observe(l.el),!f&&typeof addEventListener=="function"&&(f=()=>{(innerWidth!==u||!I.isTouch)&&n.forEach(w=>w.stale=!0),u=innerWidth,t()},addEventListener("resize",f,{passive:!0}))}let a={x:0,y:0};function m(l,w){return l.scrolls?w?w.scroll:e.read():(a.x=window.scrollX||0,a.y=window.scrollY||0,a)}function y(l,w){let M=l.el.getBoundingClientRect(),b=m(l),h=l.measured&&(l.doc.w!==M.width||l.doc.h!==M.height);l.doc.x=M.left+b.x,l.doc.y=M.top+b.y,l.doc.w=M.width,l.doc.h=M.height,l.measured=!0,l.stale=!1,E(l,w),h&&g(l,"resize")}function E(l,w){let M=m(l,w),b=l.rect;b.x=l.doc.x-M.x,b.y=l.doc.y-M.y,b.width=l.doc.w,b.height=l.doc.h;let h=window.innerWidth||1,T=window.innerHeight||1,C=b.width>0||b.height>0,_=C&&b.x<h&&b.x+b.width>0&&b.y<T&&b.y+b.height>0,A=T*er;l.near=C&&b.x<h+A&&b.x+b.width>-A&&b.y<T+A&&b.y+b.height>-A;let k=(T-b.y)/Math.max(T+b.height,1);l.progress=k<0?0:k>1?1:k,l.inView=_,w&&_!==l.told&&g(l,(l.told=_)?"enter":"leave"),l.placed?.(b,T)}function g(l,w){l.emitter.emit(w,l.t)}function d(l){if(l.destroyed)return;l.destroyed=!0,n.delete(l);let w=o.get(l.el);w?.delete(l),w&&!w.size&&(o.delete(l.el),i?.unobserve(l.el)),g(l,"destroy"),l.emitter.clear()}function x(l,w={},M){let b={t:null,el:l,doc:{x:0,y:0,w:0,h:0},rect:{x:0,y:0,width:0,height:0},stale:!0,live:w.live??Re(l),scrolls:e.contains(l),inView:!1,told:!1,near:!1,progress:0,measured:!1,emitter:q(!1),destroyed:!1,placed:M};return b.t={el:l,get rect(){return b.rect},get inView(){return b.inView},get near(){return b.near},get progress(){return b.progress},get dpr(){return window.devicePixelRatio||1},get destroyed(){return b.destroyed},on(h,T){return b.emitter.on(h,T)},off(h,T){b.emitter.off(h,T)},destroy:()=>d(b),revert:()=>d(b)},n.add(b),o.has(l)||o.set(l,new Set),o.get(l).add(b),c(b),l.isConnected&&y(b),t(),b.t}return{track:x,get size(){return n.size},holds(l){for(let w of o.keys())if(l===w||l.contains(w))return!0;return!1},frame(l){for(let w of n){if(!w.el.isConnected){d(w);continue}try{w.stale||w.live&&w.near?y(w,l):E(w,l)}catch(M){D("tracker",[],O.error,M)}}},Ma(){for(let l of n)l.el.isConnected||d(l)},touch(l){for(let w of n)l.some(M=>M===w.el||M.contains(w.el))&&(w.stale=!0)},invalidate(l){for(let w of n)(!l||w.el===l)&&(w.stale=!0);t()},destroy(){for(let l of[...n])d(l);i?.disconnect(),i=null,f&&removeEventListener("resize",f),f=null}}}function ce(e){let t={x:0,y:0,width:0,height:0},n=()=>{};return{el:e,rect:t,inView:!1,near:!1,progress:0,dpr:1,destroyed:!1,on:()=>n,off:n,destroy:n,revert:n}}var Jt={top:0,left:0,center:.5,middle:.5,bottom:1,right:1};function tr(e){let t=/^(top|left|center|middle|bottom|right|-?\d*\.?\d+(?:px|%)?)?(?:([+-])=?(\d*\.?\d+)(px|%)?)?$/.exec(e);if(!t||!t[1]&&!t[2])return null;let n=0,o=0;if(t[1]&&t[1]in Jt)n=Jt[t[1]];else if(t[1]){let i=parseFloat(t[1]);t[1].endsWith("%")?n=i/100:o=i}if(t[2]){let i=parseFloat(t[3])*(t[2]==="-"?-1:1);t[4]==="%"?n+=i/100:o+=i}return[n,o]}function Ae(e,t){let n=(e||"").trim().toLowerCase();if(!n)return t;let o=tr(n);return o?/^[+-]/.test(n)&&!/^-\d/.test(n)?[t[0]+o[0],t[1]+o[1]]:o:t}var nr={cover:"0110",contain:"11000011",entry:"01110100",exit:"00101110","entry-crossing":"0111","exit-crossing":"0010"};function rr(e,t){let n=nr[e[0]],o=e[1]||(t?"100%":"0%"),i=o.endsWith("%")?0:parseFloat(o)||0,f=i?0:parseFloat(o)/100||0,u=c=>({el:+n[c]+(+n[c+2]-+n[c])*f,elPx:i,vp:+n[c+1]+(+n[c+3]-+n[c+1])*f,vpPx:0});return n?{...u(0),alt:n[4]?u(4):void 0}:null}function te(e,t){let n=(e||t).trim().split(/\s+/),o=rr(n.map(m=>m.toLowerCase()),t.startsWith("bottom"));if(o)return o;let i=t.split(/\s+/),[f,u]=Ae(n[0],Ae(i[0],[0,0])),[c,a]=Ae(n[1],Ae(i[1],[0,0]));return{el:f,elPx:u,vp:c,vpPx:a}}function Ce(e,t,n,o,i){let f=m=>(m.alt&&t>n&&(m=m.alt),e+t*m.el+m.elPx-(n*m.vp+m.vpPx)),u=f(o),c=f(i),a=u-c;return Math.abs(a)>1e-6?Math.min(1,Math.max(0,u/a)):u<=0?1:0}function de(e,t,n,o){let i=1-Math.min(1,Math.max(0,n));return e+(t-e)*(1-Math.pow(i,Math.max(0,o)*60))}var Ze=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),en=(e,t,n)=>e+(t-e)*n,tn=(e,t,n,o,i)=>o+(e-t)/(n-t)*(i-o);function nn(e,t,n){if(e===t)return n<e?0:1;let o=Ze((n-e)/(t-e));return o*o*(3-2*o)}function rn(e,t="top bottom",n="bottom top",o=typeof innerHeight=="number"?innerHeight:0){return Ce(e.top??e.y??0,e.height,o,te(t,"top bottom"),te(n,"bottom top"))}var Je,or=0;function ir(e,t){let n=e.getAttribute("data-gl-css")||++or;e.setAttribute("data-gl-css",""+n);let o,i,f,u,c=()=>{Je?.isConnected||(Je=document.head.appendChild(document.createElement("style"))),i=(o=Je).sheet,f=i.cssRules[i.insertRule(`[data-gl-css="${n}"]{}`)],u=NaN};c();let a=m=>{o.isConnected||c(),m!==u&&f.style.setProperty(t,(u=m).toFixed(4),"important")};return a.end=()=>{let m=e.isConnected?-1:[...i.cssRules].indexOf(f);m>=0&&i.deleteRule(m)},a}function on(e,t={}){let n=t.start||"top bottom",o=t.end||"bottom top",i=te(n,"top bottom"),f=te(o,"bottom top"),u=q(!1),c=t.css?ir(e,t.css):null,a=null,m=!1,y={value:0,el:e,start:n,end:o,get destroyed(){return m},on(d,x){return u.on(d,x)},off(d,x){u.off(d,x)},destroy(){a?.destroy()},revert(){a?.destroy()}};return{signal:y,place:(d,x)=>{let l=Ce(d.y,d.height,x,i,f);c?.(l),l!==y.value&&(y.value=l,u.emit("change",y))},bind:d=>{a=d,d.on("destroy",()=>{m||(m=!0,c?.end(),u.emit("destroy",y),u.clear())})}}}function tt(e,t={}){let n=()=>{};return{value:0,el:e,start:t.start||"top bottom",end:t.end||"bottom top",destroyed:!0,on:()=>n,off:n,destroy:n,revert:n}}function et(){let e=typeof document<"u"&&document.timeline?document.timeline.currentTime:null;return typeof e=="number"?e:typeof performance<"u"?performance.now():Date.now()}var sn=()=>typeof innerWidth=="number"?[Math.round(innerWidth/2),Math.round(innerHeight/2)]:[0,0];function an(e,t){let n=sn(),o={value:[0,0]},i=[n[0],n[1]],f=et(),u=!1,c=!1,a=[],m=(x,l)=>{!Number.isFinite(x)||!Number.isFinite(l)||(u||(i[0]=x,i[1]=l,f=et()),u=!0,n[0]=x,n[1]=l,c=!0,e(2))},y=x=>m(x.clientX,x.clientY),E=x=>{let l=x.touches?.[0];l&&m(l.clientX,l.clientY)},g=(x,l)=>{addEventListener(x,l,{passive:!0}),a.push(()=>removeEventListener(x,l))};return g("pointermove",y),g("pointerdown",y),g("touchstart",E),g("touchmove",E),a.push(t(x=>{let l=x.dt>0?x.dt:.016666666666666666,w=et(),M=w>f?(w-f)/1e3:l;f=w;let b=(n[0]-i[0])/M,h=(n[1]-i[1])/M;i[0]=n[0],i[1]=n[1];let T=o.value;T[0]=de(T[0],b,.25,l),T[1]=de(T[1],h,.25,l),Math.abs(T[0])+Math.abs(T[1])<1&&!c&&(T[0]=0,T[1]=0),c=!1,(T[0]!==0||T[1]!==0)&&e()})),{signal:{value:n,velocity:o,get active(){return u}},destroy(){a.forEach(x=>x()),a.length=0}}}function ln(){return{value:sn(),velocity:{value:[0,0]},active:!1}}function un(e){try{e()}catch(t){D("undo",[],O.error,t)}}function cn(){let e=[];function t(c){let a=e[e.length-1];return a?a.gen!==a.scope.gen?(un(c),!0):(a.scope.items.push(c),a.scope.reverted=!1,!0):!1}function n(c){let a=E=>E&&(typeof E=="function"?E():E.release?E.release():E.destroy?.());if(!e.length||!c)return c;if(typeof c.then!="function")return t(()=>a(c)),c;let m,y=!1;return t(()=>a((y=!0)&&m)),c.then(E=>y?a(E):m=E,()=>{}),c}function o(c,a){e.push(c);try{return a()}finally{let m=e.lastIndexOf(c);m!==-1&&e.splice(m,1)}}function i(c){let a=e.splice(0);try{c()}finally{e.unshift(...a)}}function f(){for(let c=e.length-1;c>=0;c--)if(e[c].scope.container)return e[c].scope.container;return document}function u(c,a,m){let y={items:[],gen:0,container:a,reverted:!1},E=[],g=Promise.resolve(),d=l=>w=>o({scope:y,gen:l<0?y.gen:l},w),x=Object.assign({get container(){return y.container},get reverted(){return y.reverted},get ready(){return g},run(l){let w=y.gen,M=Object.assign(Object.create(x),m(d(w),()=>w!==y.gen)),b;try{b=o({scope:y,gen:w},()=>l(M))}catch(h){D("scopeFn",[],O.error,h);return}if(b&&typeof b.then=="function"){let h=Promise.resolve(b).then(()=>{},T=>D("scopeAsync",[],O.error,T));E.push(h),g=Promise.all(E).then(()=>{})}return b},revert(){y.gen++;let l=y.items.splice(0);for(let w=l.length-1;w>=0;w--)un(l[w]);y.reverted=!0,E=[]},destroy(){x.revert()}},m(d(-1),()=>!1));return t(()=>x.revert()),c&&!y.gen&&x.run(c),x}return{own:t,keep:n,root:f,create:u,outside:i}}var st=e=>e.left??e.x??0,at=e=>e.top??e.y??0;function lt(){return{left:0,top:0,width:typeof innerWidth=="number"?innerWidth:1,height:typeof innerHeight=="number"?innerHeight:1}}function ne(e,t,n,o,i){let f=e[3]*t+e[7]*n+e[11]*o+e[15]||1;return i[0]=(e[0]*t+e[4]*n+e[8]*o+e[12])/f,i[1]=(e[1]*t+e[5]*n+e[9]*o+e[13])/f,i[2]=(e[2]*t+e[6]*n+e[10]*o+e[14])/f,f}var F=[0,0,0],z=[0,0,0];function nt(e,t,n,o,i){ne(e.projectionMatrixInverse.elements,t,n,-1,F),ne(e.matrixWorld.elements,F[0],F[1],F[2],F),ne(e.projectionMatrixInverse.elements,t,n,1,z),ne(e.matrixWorld.elements,z[0],z[1],z[2],z);let f=z[2]-F[2],u=Math.abs(f)<1e-12?0:(o-F[2])/f;return i[0]=F[0]+(z[0]-F[0])*u,i[1]=F[1]+(z[1]-F[1])*u,i[2]=o,i}function sr(e){return e.updateMatrixWorld?.(),e.matrixWorld.elements[14]}function dn(e,t,n){let o=n??lt().height,i=e.zoom||1;if(e.isOrthographicCamera)return o*i/Math.max(1e-9,(e.top??1)-(e.bottom??-1));let f=Math.abs(t??sr(e)),u=(e.fov??50)*Math.PI/180;return o*i/Math.max(1e-9,2*f*Math.tan(u/2))}function fn(e,t,n=1){let o=Math.max(1e-6,t.width)/n,i=Math.max(1e-6,t.height)/n;if(e.isOrthographicCamera)e.left=-o/2,e.right=o/2,e.top=i/2,e.bottom=-i/2,e.zoom=1;else{let f=(e.fov??50)*Math.PI/180,u=i/2/Math.tan(f/2);e.aspect=o/i,e.zoom=1,e.position&&(e.position.z=u),typeof e.far=="number"&&e.far<u*2&&(e.far=u*2)}return e.updateProjectionMatrix?.(),e.updateMatrixWorld?.(!0),e}var rt=[0,0,0],ot=[0,0,0],it=[0,0,0];function Ne(e,t,n,o={}){let i=o.frame||lt(),f=o.z??0;t.updateMatrixWorld?.();let u=Math.max(i.width,1e-6),c=Math.max(i.height,1e-6),a=(g,d)=>[(g-st(i))/u*2-1,1-(d-at(i))/c*2],m=st(e),y=at(e);nt(t,...a(m,y),f,rt),nt(t,...a(m+e.width,y+e.height),f,ot),nt(t,...a(m+e.width/2,y+e.height/2),f,it);let E={x:it[0],y:it[1],z:f,width:Math.abs(ot[0]-rt[0]),height:Math.abs(rt[1]-ot[1])};return n&&(n.x=E.x,n.y=E.y,n.z=E.z),E}function Ve(e,t,n=lt()){t.updateMatrixWorld?.(),ne(t.matrixWorldInverse.elements,e.x,e.y,e.z,F);let o=ne(t.projectionMatrix.elements,F[0],F[1],F[2],z),i=t.isOrthographicCamera?!0:o>0;return{x:st(n)+(z[0]+1)/2*n.width,y:at(n)+(1-z[1])/2*n.height,visible:i&&Math.abs(z[0])<=1&&Math.abs(z[1])<=1&&z[2]>=-1&&z[2]<=1}}function ut(e,t,n,o,i){let f=q(!1),u="loading",c=null,a=null,m=!1,y=()=>{},E=new Promise(h=>y=h),g={kind:e,el:t,options:n,tracker:o,view:null,busy:new Set,wanted:0,get destroyed(){return m},emit(h,T){f.emit(h,T??b)},setStatus(h,T=null){if(m)return;let C=u;u=h,c=h==="off"||h==="error"?T:null,t.setAttribute("data-gl-view",h),h==="ready"&&y(!0),(h==="off"||h==="error")&&y(!1),h!==C&&(h==="ready"&&C==="loading"&&f.emit("ready",b),h==="error"&&f.emit("error",b))}},d=o.on("enter",()=>f.emit("enter",b)),x=o.on("leave",()=>f.emit("leave",b)),l=o.on("destroy",()=>w());function w(){if(!m){d(),x(),l();try{a?.destroy()}catch{}a=null,u="destroyed",m=!0,y(!1),t.removeAttribute("data-gl-view"),o.destroy(),i(),f.emit("destroy",b),f.clear()}}let M=()=>a?.frame?.()||{left:o.rect.x,top:o.rect.y,width:o.rect.width,height:o.rect.height},b={el:t,kind:e,get status(){return u},get enabled(){return u!=="off"&&u!=="error"&&u!=="destroyed"},get reason(){return c},ready:E,get rect(){return o.rect},get inView(){return o.inView},get progress(){return o.progress},get width(){return a?.width||0},get height(){return a?.height||0},get dpr(){return a?.dpr||0},wake(h=1){m||(a?a.wake(h):g.wanted=Math.max(g.wanted,h))},busy(h,T){m||(typeof h=="boolean"&&(T=h,h="busy"),T===!1?g.busy.delete(h):g.busy.add(h),a?.busy())},on(h,T){return f.on(h,T)},off(h,T){f.off(h,T)},rectToWorld(h,T,C=0){return Ne(h,n.camera,T,{z:C,frame:M()})},worldToRect(h){return Ve(h,n.camera,M())},destroy:w,revert:w};return g.view=b,t.setAttribute("data-gl-view","loading"),{view:b,state:g,drive(h){if(m){h?.destroy();return}a=h}}}function K(e,t,n,o){let i=t||(typeof document<"u"?document.createElement("div"):{setAttribute(){},removeAttribute(){}}),f=ut(e,i,o||{},ce(i),()=>{});return f.state.setStatus("off",n),t||i.removeAttribute("data-gl-view"),f.view}var mn="0.2.0";var ar=/^(_|(id|el|kind|status|rect|inView|progress|effects|uniforms|set|get|tween|play|on|off|wake|destroy|revert)$)/,_e=[],ct=new Set;function pn(e,t={}){let n=[e,t];_e.push(n),ct.forEach(o=>o(n))}function gn(){let e=typeof window<"u"?window:null,t=Array.isArray(e?.UmberModules)?e.UmberModules.splice(0):[];for(let n of t)Array.isArray(n)?_e.push([n[0],n[1]||{}]):n&&_e.push([n,{}]);return _e.slice()}function yn(e){return ct.add(e),()=>void ct.delete(e)}function hn(e,t,n){if(!t||typeof t!="object"||typeof t.name!="string"||!t.name)return V("use",[]),!1;let o=t.name;if(ar.test(o))return V("own",[o]),!1;let i=e.modules.get(o);return i?(i.module!==t&&V("useTwice",[o]),!1):(t.version&&t.version!==mn&&V("version",[o,t.version,mn]),e.modules.set(o,{module:t,options:n||{}}),!0)}function bn(e){if(!e||typeof e.tagName!="string")return"<?>";let t=e.tagName.toLowerCase();if(e.id)return`<${t}#${e.id}>`;let n=typeof e.className=="string"?e.className.trim().split(/\s+/)[0]:"";return n?`<${t}.${n}>`:`<${t}>`}var vn=()=>new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(0)});function De(e){let t=self.occluzeCapture;return t?.version==1&&t.wait(Promise.race([e,lr(1e4)]).then(vn,vn)),e}var lr=e=>new Promise(t=>{let n=AbortSignal.timeout?.(e);n?n.onabort=()=>t():setTimeout(t,e)});var fe="0.2.0",wn=4e3,En=8e3,He=null,ur=()=>typeof window<"u"&&typeof document<"u"&&typeof location<"u";function re(e,t,n=document){let o=typeof e=="string"?n.querySelector(e):e;if(o&&o.nodeType===1){if(o.isConnected)return o;V("unplaced",[t],o)}else V("absent",[t,e]);return null}function Sn(e){e.removeAttribute("data-gl-status"),e.removeAttribute("data-gl-morphing"),e.removeAttribute("data-gl-play"),Xe(e)}function kn(){document.documentElement.classList.remove("has-gl"),document.querySelectorAll(G).forEach(Sn)}var cr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function dr(e){let t={"data-gl":e.type||""},n=typeof e.effects=="string"?e.effects.split(/[\s,]+/).filter(Boolean):e.effects||[];n.length&&(t["data-gl-effect"]=n.join(" "));for(let o in e.options||{}){let i=e.options[o]||{};for(let f in i){let u=i[f];u!=null&&(t[`data-gl-${o}-${cr(f)}`]=Array.isArray(u)?u.join(" "):String(u))}}return e.shader&&(t["data-gl-shader"]=e.shader),e.layer&&(t["data-gl-layer"]=e.layer),e.src&&(t["data-gl-src"]=e.src),e.fit&&(t["data-gl-fit"]=e.fit),e.instances!==void 0&&(t["data-gl-instances"]=String(e.instances)),e.order!==void 0&&(t["data-gl-order"]=String(e.order)),e.live!==void 0&&(t["data-gl-live"]=e.live?"":"false"),e.clip!==void 0&&(t["data-gl-clip"]=e.clip?"true":"false"),t}function fr(e){let t=document.body?.getAttribute("data-gl-devices")??document.documentElement.getAttribute("data-gl-devices"),n=e.devices??(t==="desktop"?"desktop":"all");return{...e,devices:n,reducedMotion:e.reducedMotion==="off"?"off":"static"}}function xn(e){if(e.devices===!1||Ee("umber")==="off")return"disabled";if(!I.webgl2)return"no-webgl2";if(I.designer&&!e.designer)return"editor";if(I.forcedColors)return"forced-colors";if(typeof e.devices=="function"){let n=!1;try{n=!!e.devices(I)}catch(o){D("devicesThrew",[],O.error,o)}if(!n)return"device"}else if(e.devices!=="all"&&!I.isDesktop)return"device";let t=e.media??document.body?.getAttribute("data-gl-media");return t&&!matchMedia(t).matches?"device":e.reducedMotion==="off"&&I.reducedMotion?"reduced-motion":e.respectSaveData!==!1&&I.saveData?"save-data":null}function Tn(e={},t){if(!ur())return t.inert("server");ke(t.loadInspect);let n=He||window.__umber?.engine;if(n&&!n.destroyed)return V("twice",[]),n;let o=mr(e,t);return He=o,o}function mr(e,t){let n=fr(e);O.configure({debug:!!n.debug||Ee("umber-debug")!=null,warnings:n.warnings!==!1}),![void 0,!1,"all","desktop"].includes(e.devices)&&typeof e.devices!="function"&&V("devices",[e.devices]);let o={effects:new Map,shaders:new Map,layers:new Map,chunks:new Map,modules:new Map},i=q(),f=Dt(),u=Ct({auto:n.loop!==!1,raf:t.raf,caf:t.caf}),c=xe(n.scroll),a={value:0},m=new Map,y=new Map,E=[],g=xn(n),d=null,x,l=!1,w=!1,M=null,b,h=!1,T=!1,C=()=>{},_=new Promise(r=>C=r),A=c.kind==="lenis",k=()=>{let r=typeof document.timeline<"u"?document.timeline.currentTime:null;return typeof r=="number"?r:null},S=null,W=!1,B=()=>{!u.running||S===null||k()===S&&u.follow()},U=$t(()=>{W||B(),u.wake(1)},()=>{if(g||!d)return;let r=mt();r?Q(r):d.keep()&&u.auto&&u.tick()}),j=Zt(c,()=>u.wake(1)),Fe=new Set,N=cn(),me=null,mt=()=>document.body?.hasAttribute("data-gl-disable")?"disabled":I.designer&&!n.designer?"editor":null;function pt(){try{d?.destroy()}catch(r){O.error("GL destroy failed",r)}d=null}function Q(r){g=r,clearTimeout(b),x=d?.info||x,pt(),kn(),vt(),C(!1),i.emit("off",{reason:r}),O.debug&&D("off",[r],O.info)}let pe=()=>(d||j.size)&&u.wake(1),Pn=()=>{if(A&&(B(),!u.running))return queueMicrotask(pe);pe()},oe=0,ie=new Map;function se(){let r=U.take();r&&(oe&&r.added.length&&N.outside(()=>i.emit("added",r.added)),r.detached&&j.Ma(),r.styles?j.invalidate():r.touched.length&&j.touch(r.touched),yt(r))}u.add(r=>{let s=c.sample(r.dt,r.woke);r.scroll.x=s.x,r.scroll.y=s.y,r.scroll.velocity=s.velocity,S=k(),W=!0,se(),j.frame(r),vt()},{phase:"measure",order:-1e3}),u.add(()=>{U.collect(),W=!1},{phase:"render",order:1/0});let ge={...t,options:n,registry:o,ticker:u,scroll:c,clock:f,env:I,log:O,emit:(r,s)=>i.emit(r,s),off:r=>queueMicrotask(()=>g||Q(r)),engine:null,velocity:a,gpu:Ee("umber-gpu"),changes:()=>U.changes,lib:{attr:Oe,config:Ye,describe:bn,findGL:Le,findMedia:Me,markMedia:Ke,unmarkMedia:Xe,needsLive:Re,say:V,tell:D,createEmitter:q}};function gt(r){for(let s of r)s.hasAttribute("data-gl-status")||(s.setAttribute("data-gl-status","loading"),Gt(s)||Ke(s,Me(s)),Oe.list(s,"data-gl-effect").some(p=>o.effects.get(p)?.play)&&s.setAttribute("data-gl-play",""))}function yt(r){if(g)return;let s=mt();if(s)return Q(s);if(d)return d.apply(r);let p=[];for(let v of[...r.added,...r.rebuild])p.push(...Le(v));if(!p.length){!M&&document.readyState!=="loading"&&(T=!0,C(!1));return}gt(p),ye()}let On,ht=t.loadLicence?null:!0;function ze(){return On||=t.loadLicence?t.loadLicence().then(r=>r.ok(),()=>!1).then(r=>ht=r):Promise.resolve(!0)}function ye(){return d?Promise.resolve(d):M||(T=!1,b=setTimeout(()=>{d||g||(O.warn(`chunks/gl.js took more than ${wn/1e3} s to download; the plain DOM shows for this visit (slow network?).`),Q("load-timeout"))},wn),t.loadText&&document.querySelector('[data-gl="text"]')&&t.loadText().catch(()=>{}),t.loadVideo&&document.querySelector("[data-gl] video,video[data-gl]")&&t.loadVideo().catch(()=>{}),M=Promise.all([t.load(),ze()]).then(([r,s])=>{if(clearTimeout(b),g)return null;if(s===!1)return Q("unlicensed"),null;let p=r.mount(ge);return p?(d=p,$&&p.begin($.next),p.scan(document.documentElement),l&&p.pause(),w&&p.live(w),C(!0),i.emit("ready",H),p):(Q("context"),null)}).catch(r=>(clearTimeout(b),g||(O.error("chunks/gl.js failed to load; the site keeps working without GL.",r),Q("load-failed")),null)),De(M))}let $=null;function An(r){if(g||h)return()=>Promise.resolve();if($)return d?.begin(r,!0),$.end;let s={next:r,release:f.hold(),timer:setTimeout(()=>{let p=!1;try{p=!!n.busy&&document.documentElement.matches(n.busy)}catch{}V("change",[p?n.busy:"",En/1e3]),s.end()},En),end(p){if($!==s)return Promise.resolve();$=null,clearTimeout(s.timer);let v=()=>(s.release(typeof p=="number"?p:0),se(),d?.end());return p&&typeof p.then=="function"?Promise.resolve(p).then(v,v):Promise.resolve(v())}};return $=s,d?.begin(r),s.end}let ae=null;function bt(){if(ae||h)return;let r=c.ma(Pn);c.kind!=="window"&&addEventListener("scroll",pe,{passive:!0}),ae=()=>{ae=null,r(),removeEventListener("scroll",pe)}}let vt=()=>g&&!j.size&&!oe&&(U.stop(),ae?.());function he(){bt(),U.watch(r=>j.holds(r),()=>oe>0),U.start()}function wt(r,s){let p=re(r,"gl.track()",N.root());if(!p||h)return ce(p||document.createElement("div"));he();let v=j.track(p,s);return N.own(()=>v.destroy()),v}function Et(r,s={}){let p=re(r,"gl.progress()",N.root());if(!p||h)return tt(p||document.createElement("div"),s);he();let v=on(p,s);return v.bind(j.track(p,{live:s.live},v.place)),N.own(()=>v.signal.destroy()),v.signal}function Cn(r,s={}){if(h||typeof r!="function")return()=>{};let p=u.add(v=>{p(),r(v)},{phase:s.phase||"update",order:s.order});return u.wake(1),N.own(p),p}function kt(r,s={}){let p=re(r,"gl.add()",N.root());if(!p||h||g)return Promise.resolve(null);let v=()=>d&&d.plane(p)||null;if(p.hasAttribute("data-gl"))return O.debug&&D("added",[],O.info,p),d?Promise.resolve(v()):H.ready.then(v);let R=dr(s),L={};for(let P in R)L[P]=p.getAttribute(P),p.setAttribute(P,R[P]);return se(),N.own(()=>{d?.remove(p);for(let P in L)L[P]===null?p.removeAttribute(P):p.setAttribute(P,L[P]);p.hasAttribute("data-gl")||Sn(p),se()}),d?Promise.resolve(v()):H.ready.then(v)}let xt=["effect","shader","layer","chunk","on","nextFrame","scope","target","snapshot","sim","flow","brush","preload","warm","leave","flip"];function Nn(r,s){let p=s==null?null:re(s,"gl.scope(fn, container)")||document.createElement("div");return N.create(r,p,(v,R)=>({...Object.fromEntries(xt.map(L=>[L,(...P)=>v(()=>H[L](...P))])),add:(L,P)=>R()?Promise.resolve(null):v(()=>kt(L,P)),track:(L,P)=>R()?ce(document.createElement("div")):v(()=>wt(L,P)),progress:(L,P)=>R()?tt(document.createElement("div"),P):v(()=>Et(L,P)),attach:(L,P)=>R()?K("attach",null,"destroyed",P):v(()=>Lt(L,P)),view:(L,P)=>R()?K("view",null,"destroyed",P||{}):v(()=>Rt(L,P))}))}function St(r){return g&&!/^(c|l|er|dev)/.test(g)?g:xn({...n,devices:r??n.devices})}function Tt(r,s,p){he();let v=ut(r,s,p,j.track(s),()=>Fe.delete(v));return Fe.add(v),v}let Mt=null,Ie=null;function Vn(r){return(t.loadInspect?t.loadInspect():Promise.reject()).then(s=>s.print(r,{log:O,stage:d?.stage,off:g,loading:!!M}),s=>(O.error("chunks/inspect.js failed to load; gl.inspect() can't answer.",s),null))}function Lt(r,s){let p=re(r,"gl.attach()",N.root());if(!p)return K("attach",null,"not-found",s);if(!s||!s.renderer)return V("renderer",[]),K("attach",p,"no-renderer",s);let v=St(s.devices);if(v)return O.debug&&D("attachOff",[v],O.info,p),K("attach",p,v,s);if(!t.loadViews)return V("noViews",[]),K("attach",p,"load-failed",s);let R=Tt("attach",p,s);return N.own(()=>R.view.destroy()),Mt||={options:n,ticker:u,env:I,log:O,gpu:ge.gpu,lib:ge.lib},Promise.all([t.loadViews(),ze()]).then(([L,P])=>P?R.drive(L.attach(Mt,R.state)):R.state.destroyed||R.state.setStatus("off","unlicensed"),L=>{O.error("chunks/views.js failed to load; gl.attach() views are not drawn.",L),R.state.setStatus("error","load-failed")}),R.view}function Rt(r,s={}){let p=re(r,"gl.view()",N.root());if(!p)return K("view",null,"not-found",s);let v=St(s.devices)||g;if(v)return v===g&&g==="device"&&V("view",[],p),K("view",p,v,s);let R=Tt("view",p,s);return N.own(()=>R.view.destroy()),ye().then(async L=>{if(R.state.destroyed)return;if(!L)return R.state.setStatus("off",g||"context");let P=await L.view(R.state);if(R.state.destroyed)return P?.destroy();if(!P)return R.state.setStatus("error","plane");R.drive(P)}),R.view}function _n(r,s){return g||h?Promise.resolve(null):ye().then(p=>p?p.renderer(r,s):null)}function Y(r,s){if(g||h)return Promise.resolve(null);let p=ye().then(v=>v&&v.fx(r,s));return N.keep(r==="flow"?p.then(v=>v&&!Pt.has(v)&&Pt.add(v)?v:null,()=>null):p),p}let Pt=new WeakSet,Z=[];function Dn(r,s){let p=[r,s],v=!1;return Z.push(p),N.own(()=>{let L=Z.indexOf(p);L<0||(Z.splice(L,1),v&&L===Z.length&&Y("setLeave",Z[L-1]||[null]))})||(Z=[p]),Z.includes(p)?(v=!0,Y("setLeave",p)):Promise.resolve()}function Ot(r,s,p){let v=Y(r,{what:s,fn:p,set:R=>v.value=R}).then(()=>{v.value<1&&p?.(v.value=1)});return v.value=+!!(g||h),v}function be(r,s,p){if(!s||typeof s!="string"||!p||typeof p!=(r==="chunk"?"string":"object")){V("define",[r]);return}let v=o[`${r}s`],R=v.get(s);v.set(s,p);let L=r+":"+s,P=y.get(L)||[R];if(y.set(L,P),P.push(p),r==="effect"&&p.play&&!d&&!g)for(let ue of document.querySelectorAll('[data-gl-status="loading"]:not([data-gl-play])'))Oe.list(ue,"data-gl-effect").includes(s)&&ue.setAttribute("data-gl-play","");R!==void 0&&R!==p&&d?.redefined(r,s),d?.defined(r,s);let Wn=()=>{if(P.splice(P.lastIndexOf(p),1),v.get(s)!==p)return;let ue=P[P.length-1];ue===void 0?v.delete(s):v.set(s,ue),d?.redefined(r,s)};N.own(Wn)||y.delete(L)}function le(r,s={}){if(r&&r.name==="debug"&&typeof e.debug=="object"&&e.debug&&(s={...e.debug,...s}),h||!hn(o,r,s))return H;let p=new Set(Object.keys(H));try{N.outside(()=>r.install?.(H,s,N.keep,N.root))}catch(v){D("install",[r.name],O.error,v)}for(let v in H){let R=Object.getOwnPropertyDescriptor(H,v).value;!p.has(v)&&typeof R=="function"&&(H[v]=(...L)=>N.keep(R.apply(H,L)),xt.push(v))}return d?.defined("module",r.name),H}function Hn(r){if(arguments.length){r?d?.remove(r):V("destroy",[]);return}if(!h){h=!0,clearTimeout(b),$&&clearTimeout($.timer),$=null;for(let s of[...Fe])s.view.destroy();j.destroy(),me?.destroy(),me=null,pt(),U.stop(),ae?.(),u.destroy(),f.reset(),E.forEach(s=>s()),kn(),g="destroyed",C(!1),i.emit("destroy"),i.clear(),He===H&&(He=null),window.__umber?.engine===H&&delete window.__umber}}let H={version:fe,get ready(){return g?Promise.resolve(!1):d?Promise.resolve(!0):M?M.then(r=>!!r):T?Promise.resolve(!1):_},get enabled(){return!g},get licence(){return ht},get reason(){return g},get destroyed(){return h},velocity:a,get pointer(){return h?ln():(me||=an((r=1)=>u.wake(r),r=>u.add(r,{phase:"measure",order:-900})),me.signal)},on(r,s,p={}){if(r==="frame"){m.get(s)?.();let R=u.add(s,{always:!0,...p}),L=()=>{R(),m.get(s)===L&&m.delete(s)};return m.set(s,L),N.own(L),L}if(r==="added"&&!h){ie.get(s)?.(),oe++,he();let R=i.on(r,s),L=()=>{ie.get(s)===L&&(ie.delete(s),oe--,R())};return ie.set(s,L),N.own(L),L}let v=i.on(r,s);return N.own(v),v},off(r,s){r==="frame"?m.get(s)?.():r==="added"?ie.get(s)?.():i.off(r,s)},effect(r,s){be("effect",r,s)},shader(r,s){be("shader",r,s)},layer(r,s){be("layer",r,s)},chunk(r,s){be("chunk",r,s)},use:le,licensed:ze,add:kt,scope:Nn,progress:Et,nextFrame:Cn,scan(r=document){if(!g)if(d)d.scan(r);else{let s=r instanceof Element?r:document.documentElement;yt({added:[s],removed:!1,rebuild:[],sources:[],touched:[],detached:!1,styles:!1})}},prune(){d?.prune()},destroy:Hn,invalidate(r){d?.invalidate(r),j.invalidate(r)},live(r){w=r,d?.live(r)},wake(r=1){d?d.wake(r):u.wake(r)},pause(){l=!0,d?.pause()},resume(){l=!1,d?.resume()},inspect:Vn,plane(r){return r&&d&&d.plane(r)||null},planes(r){return d?d.planes(r):[]},hold(r){return f.hold(r)},render(r){if(h)return;if(u.auto&&u.running){V("loop",[]);return}let s=r??performance.now();Ie!==null&&Math.abs(s-Ie)<1&&V("render",[]),Ie=s,u.tick(r)},track:wt,attach:Lt,view:Rt,renderer:_n,target:r=>Y("target",r),snapshot:r=>Y("snapshot",r),sim:r=>Y("sim",r),flow:r=>Y("flow",r),brush:(r,s)=>N.keep(r?.brush?r.brush(s):null),preload:(r,s)=>Ot("preload",r,s),warm:(r,s)=>Ot("warm",r,s),placeholder:r=>Y("placeholder",r),leave:Dn,flip:(r,s,p)=>d?d.flip(r,s,p):(s?.(),Promise.resolve()),transition:An,morph:{capture(r){d?.morph.capture(r)},settle(){se(),d?.morph.settle()}},get info(){return d?.info||{...g&&x,state:g?`off (${g})`:"dormant"}},get canvas(){return d?.canvas||null},get context(){return d?.gl||null}};ge.engine=H;for(let r of n.modules||[])Array.isArray(r)?le(r[0],r[1]):le(r);for(let[r,s]of gn())le(r,s);if(E.push(yn(([r,s])=>le(r,s))),window.__umber={version:fe,engine:H,get modules(){return[...o.modules.keys()]}},g){O.debug&&D("off",[g],O.info),C(!1);let r=g;return queueMicrotask(()=>h||i.emit("off",{reason:r})),H}if(document.documentElement.classList.add("has-gl"),document.body?.hasAttribute("data-gl-disable")||gt(Le(document.documentElement)),bt(),U.start(),document.readyState==="loading"){let r=()=>{!d&&!M&&!g&&!U.pending&&(T=!0,C(!1))};document.addEventListener("DOMContentLoaded",r,{once:!0}),E.push(()=>document.removeEventListener("DOMContentLoaded",r))}return H}var pr="https://umber.occluze.com";function Mn(e){if(!e)return"";try{let t=new URL(e,location.href),n=t.pathname.match(/^(.*\/umber@)[^/]+\//);return n?`${t.origin}${n[1]}0.2.0/`:t.href.replace(/[^/]*$/,"")}catch{return""}}function dt(){return`${pr}/umber@0.2.0/`}var gr=e=>e&&!e.endsWith("/")?`${e}/`:e,Ln=["views","text","shapes","layers","morph","video","glsl","restore","fx","warm","flip","instances","covers","inspect","licence","capture"];function We(e,t="gl"){let n=null;return()=>{if(n)return n;let o=`${gr(e)}chunks/${t}.js`;return n=De(import(o).catch(i=>{throw n=null,i})),n}}var Rn=Mn(document.currentScript?.src);function yr(e={}){let t=e.base||Rn||dt(),n={load:We(t)};for(let o of Ln)n[`load${o[0].toUpperCase()}${o.slice(1)}`]=We(t,o);return Tn(e,n)}var hr=Object.freeze({pxPerWorld:dn,fitCamera:fn,rectToWorld:Ne,worldToRect:Ve,damp:de,clamp:Ze,lerp:en,mapRange:tn,smoothstep:nn,rectProgress:rn}),ft=window;ft.Umber?.version?(ke(We(Rn||dt(),"inspect")),V("script",[fe,ft.Umber.version])):ft.Umber=Object.freeze({version:fe,createGL:yr,math:hr,use:pn});})();
1
+ /*! Umber v0.2.1 | (c) Ravi Klaassens | UNLICENSED */
2
+ "use strict";(()=>{var ve="[umber]";var je=!1,Ue=!0,we=0,$e=new Set;function At(e){return $e.has(e)||we>=100?!1:($e.add(e),we++,we===100&&console.warn(ve,"100 messages shown; the rest of this visit stays quiet."),!0)}var O={configure(e){e.debug!==void 0&&(je=e.debug),e.warnings!==void 0&&(Ue=e.warnings)},get debug(){return je},get warnings(){return Ue},info(...e){je&&console.log(ve,...e)},warn(e,...t){Ue&&At(e)&&console.warn(ve,e,...t)},once(e,...t){O.warn(e,...t)},error(e,...t){At(String(e))&&console.error(ve,e,...t)},reset(){$e.clear(),we=0}};function Ee(e){try{return new URLSearchParams(location.search).get(e)}catch{return null}}var Ge;function ke(e){Ge=e}function V(e,t,...n){O.warnings&&D(e,t,O.warn,...n)}function D(e,t,n,...o){(Ge?Ge():Promise.reject()).then(i=>n(i.words[e](...t),...o),()=>n(e,...t,...o))}var Fn=["measure","update","render"];function Ct(e={}){let t=e.auto!==!1,n=e.raf||(k=>requestAnimationFrame(k)),o=e.caf||(k=>cancelAnimationFrame(k)),i={time:0,dt:1/60,ratio:1,frame:0,woke:!0,scroll:{x:0,y:0,velocity:0}},f=[],u=0,c=0,a=!1,m=0,y=0,E=!1,g=!1,d=!1,x=500,l=33,w=1e3/60;function M(){return c>0||u>0}function b(k=typeof performance<"u"?performance.now():Date.now()){if(E||d)return;let S=y?k-y:w;i.woke=!y,y&&S>0&&S<=50&&(w=S),S>x&&(S=l,i.woke=!0),S<=0&&(S=.1),y=k,i.dt=S/1e3,i.time+=i.dt,i.ratio=i.dt*60,i.frame++,c>0&&c--,E=!0;let W=f;try{for(let B=0;B<W.length;B++){let X=W[B];if(!X.dead)try{X.fn(i)}catch(U){X.errored||(X.errored=!0,D("frame",[],O.error,U))}}}finally{E=!1}a&&!M()&&C()}let h=k=>{m=n(h),b(k)};function T(){!t||a||d||!M()||(a=!0,m=n(h))}function C(){a&&(a=!1,o(m),m=0,y=0)}function _(k,S={}){let W={fn:k,phase:Math.max(0,Fn.indexOf(S.phase||"update")),order:S.order||0,always:!!S.always,dead:!1,errored:!1};return W.always&&u++,f=[...f,W].sort((B,X)=>B.phase-X.phase||B.order-X.order),W.always&&T(),()=>A(W)}function A(k){k.dead||(k.dead=!0,k.always&&u--,f=f.filter(S=>S!==k))}return{frame:i,add:_,tick:b,wake(k=1){c=Math.max(c,k),T()},follow(){!a||g||(g=!0,queueMicrotask(()=>{g=!1,a&&(o(m),m=n(h))}))},lagSmoothing(k,S=33){x=k>0?k:1/0,l=Math.min(S,x)},get running(){return a},get auto(){return t},destroy(){C(),d=!0,f.forEach(k=>k.dead=!0),f=[],u=0}}}var Nt=(e,t)=>{let n=typeof e=="function"?e():e;return typeof n=="number"&&Number.isFinite(n)?n:t};function zn(e){let t=e;return!!t&&typeof t.on=="function"&&(typeof t.animatedScroll=="number"||typeof t.scroll=="number")}var Vt=e=>typeof window<"u"&&e===window;function _t(e,t,n=!1){return e.addEventListener("scroll",t,{passive:!0,capture:n}),()=>e.removeEventListener("scroll",t,n)}function xe(e){let t=NaN,n=NaN,o={x:0,y:0},i={x:0,y:0,velocity:0},f=a=>(o.x=a?a.scrollLeft:window.scrollX||0,o.y=a?a.scrollTop:window.scrollY||0,o),u=a=>(i.x=n=o.x,i.y=t=o.y,i.velocity=a,i),c=(a,m,y=Math.abs(o.x-n)>Math.abs(o.y-t)?"x":"y")=>{let E=y==="y"?t:n;if(m||!Number.isFinite(E)||a<=0)return 0;let g=o[y]-E,d=y==="y"?window.innerHeight||800:window.innerWidth||1200;return Math.abs(g)>d?0:g/a};if(e??=document.querySelector("[data-gl-scroll-wrapper]"),e==null||Vt(e)){let a=!1,m=()=>f(a?document.body:null);return{kind:"window",root:null,read:m,sample(y,E=!1){return m(),u(c(y,E))},contains:()=>!0,ma:y=>_t(window,E=>{let g=E.target;(g===document.body||!g.tagName)&&(a=!!g.tagName,y())},!0)}}if(zn(e)){let a=e,m=a.options?.wrapper,y=m&&!Vt(m)&&m.nodeType===1?m:null,E=()=>!!a.isHorizontal||a.options?.orientation==="horizontal",g=()=>f(y);return{kind:"lenis",root:y,read:g,sample(d,x=!1){g();let l=a.velocity;return u(typeof l=="number"&&Number.isFinite(l)?x||d<=0||o.x===n&&o.y===t?0:l/d:c(d,x,E()?"x":"y"))},contains:d=>!y||y.contains(d),ma(d){let x=a.on("scroll",d);return()=>{typeof x=="function"?x():a.off?.("scroll",d)}}}}if(typeof Element<"u"&&e instanceof Element){let a=e,m=()=>f(a);return{kind:"element",root:a,read:m,sample(y,E=!1){return m(),u(c(y,E))},contains:y=>a.contains(y),ma:y=>_t(a,y)}}if(typeof e=="object"){let a=e;if(a.y===void 0&&a.x===void 0)return V("scroll",[!0]),xe(void 0);let m=()=>(o.x=Nt(a.x,0),o.y=Nt(a.y,0),o);return{kind:"object",root:null,read:m,sample(y,E=!1){m();let g=typeof a.velocity=="function"?a.velocity():a.velocity;return u(typeof g=="number"&&Number.isFinite(g)?E||y<=0?0:g/y:c(y,E))},contains:()=>!0,ma:()=>()=>{}}}return V("scroll",[!1]),xe(void 0)}function Dt(){let e=0,t=0,n,o=new Set,i=()=>typeof performance<"u"?performance.now():Date.now();function f(){clearTimeout(n),n=void 0;let u=t-i();if(e>0)return;if(u>1){n=setTimeout(f,u);return}let c=[...o];o.clear(),c.forEach(a=>a())}return{get held(){return e>0||t-i()>1},whenOpen(u){return this.held?(o.add(u),()=>o.delete(u)):(u(),()=>{})},hold(u){e++;let c=!1,a=(m=0)=>{if(c)return;c=!0,e--;let y=Number(m);Number.isFinite(y)&&y>0&&(t=Math.max(t,i()+y*1e3)),f()};return u&&typeof u.then=="function"&&u.then(()=>a(),()=>a()),a},reset(){e=0,t=0,clearTimeout(n),o.clear()}}}var J=[];function q(e=!0,t=""){let n=new Map;function o(c,a){return n.has(c)||n.set(c,new Set),n.get(c).add(a),()=>i(c,a)}function i(c,a){n.get(c)?.delete(a)}function f(c,a){let m=n.get(c),y=J.length;if(m)for(let E of m)J.push(E);for(let E=y,g=J.length;E<g;E++)if(m.has(J[E]))try{J[E](a)}catch(d){D("handler",[t,c],O.error,d)}J.length=y,e&&typeof document<"u"&&document.dispatchEvent(new CustomEvent(`umber:${c}`,{detail:a}))}function u(){n.clear()}return{on:o,off:i,emit:f,clear:u}}var G="[data-gl]",Ut=new Set(["data-gl","data-gl-effect","data-gl-shader","data-gl-layer","data-gl-instances"]),In=[...Ut,"style","class","hidden","media","disabled","data-gl-src","src","srcset","sizes","data-gl-occlude","data-gl-pass","data-gl-under"],Ht=e=>(e||"").replace(/lenis(-s(crolling|mooth))?|\s/g,""),Wt=e=>e.hasAttribute("data-gl-host")||e.hasAttribute("data-gl-canvas"),Se=e=>e.nodeName==="STYLE"||e.nodeName==="LINK"&&/(^|\s)stylesheet(\s|$)/i.test(e.getAttribute("rel")||""),Ft=e=>Se(e)||e.nodeType===1&&!!e.firstElementChild&&!!e.querySelector("style, link[rel~='stylesheet' i]"),qe="[data-gl-occlude]",zt=G+","+qe,Te=e=>e.nodeType===1&&(e.matches(zt)||!!e.querySelector(zt)),It=e=>[].some.call(e,t=>t.nodeType===1&&!Te(t)&&(t.matches(jt)||!!t.querySelector(jt))),jt="img, video, picture, source",jn=e=>e.matches("img, video, picture")&&!!e.parentElement?.closest(G),Be='[data-gl]:not([data-gl-status="error"]),[data-gl-occlude]',Un=(e,t)=>!!e.parentElement?.parentElement&&!(t?e.matches(Be)||e.querySelector(Be):e.parentElement.closest(G).matches(Be));function $t(e,t){let n=null,o=new Set,i=new Set,f=new Set,u=new Set,c=new Set,a=0,m=!1,y=!1,E=!1,g=!1,d=!1,x=0,l=null,w=null,M=()=>{d||(d=!0,e())},b=()=>a||=setTimeout(()=>(m=!0,M()),250);function h(C){let _=!1;for(let A of C)if(A.type==="characterData")A.target.parentNode?.nodeName==="STYLE"&&(g=!0);else if(A.type==="childList"){x++,!g&&Se(A.target)&&(g=!0),A.addedNodes.forEach(S=>{S.nodeType===1&&!Wt(S)&&((Te(S)||l?.(S)||w?.())&&o.add(S),!g&&Ft(S)&&(g=!0))}),g||A.removedNodes.forEach(S=>g||=Ft(S));let k=A.target.closest?.(G);k&&/^(image|video)?$/.test(Bt(k))&&(It(A.addedNodes)||It(A.removedNodes))&&i.add(k),A.target.closest?.(qe)&&b(),y||A.removedNodes.forEach(S=>y||=Te(S)),l&&!E&&A.removedNodes.forEach(S=>E||=S.nodeType===1&&l(S))}else if(A.type==="attributes"){let k=A.target;if(Wt(k))continue;let S=A.attributeName||"";if(A.oldValue!==null&&A.oldValue===k.getAttribute(S))continue;if(S==="media"||S==="disabled"){Se(k)&&(g=!0);continue}if(S==="data-gl-occlude"||S==="data-gl-pass"){g=!0;continue}if(S==="class"&&Ht(A.oldValue)===Ht(k.getAttribute("class"))){_=!0;continue}if(x++,Ut.has(S))i.add(k);else if(/src|siz/.test(S)){let W=k.closest(G);W&&f.add(W)}else if(!c.has(k)){let W=Te(k);W||jn(k)||l?.(k)?l?.(k)||!Un(k,W)?c.add(k):b():k.closest(qe)&&b()}}C.length&&t?.(),o.size||i.size||f.size||c.size||y||E||g?M():_&&e()}let T=C=>{let _=C.target,A=_?.nodeName==="IMG"&&_.closest(G);if(A)u.add(A);else if(_&&Se(_))g=!0;else return;M()};return{start(){n||typeof MutationObserver>"u"||(n=new MutationObserver(h),n.observe(document.documentElement,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeOldValue:!0,attributeFilter:In}),document.addEventListener("load",T,!0),o.add(document.documentElement),M())},watch(C,_){l=C,w=_||null},collect(){n&&h(n.takeRecords()),d=!1},take(){n&&h(n.takeRecords()),d=!1;let C=!o.size&&!i.size&&!f.size&&!c.size&&!m&&!y&&!E&&!g;if(C&&!u.size)return null;for(let k of u)f.add(k);u.clear();let _=[];for(let k of o){if(!k.isConnected)continue;let S=k.parentElement;for(;S&&!o.has(S);)S=S.parentElement;S||_.push(k)}let A={added:_,removed:y,rebuild:[...i].filter(k=>k.isConnected),sources:[...f].filter(k=>k.isConnected),still:C,touched:[...c].filter(k=>k.isConnected),look:m,detached:E||y,styles:g};return o.clear(),i.clear(),f.clear(),c.clear(),m&&(a=0,m=!1),y=!1,E=!1,g=!1,A},get pending(){return d},get changes(){return x},stop(){n&&document.removeEventListener("load",T,!0),n?.disconnect(),n=null,o.clear(),i.clear(),f.clear(),u.clear(),c.clear(),clearTimeout(a),a=0,m=!1,y=!1,E=!1,g=!1,d=!1}}}function Me(e){return e.matches("img, video")?e:e.querySelector("video, img")}function Ke(e,t=Me(e)){if(!t)return;t.setAttribute("data-gl-media","");let n=t.parentElement?.closest("picture");n&&e.contains(n)&&n.setAttribute("data-gl-media","")}function Gt(e){return/^(text|shader|group)$/.test(Bt(e))}var Bt=e=>(e.getAttribute("data-gl")||"").trim().toLowerCase();function Xe(e){e.hasAttribute("data-gl-media")&&e.removeAttribute("data-gl-media"),e.querySelectorAll("[data-gl-media]").forEach(t=>t.removeAttribute("data-gl-media"))}function Le(e){let t=[];return e instanceof HTMLElement&&e.matches(G)&&t.push(e),e.querySelectorAll(G).forEach(n=>t.push(n)),t}function Re(e){let t=e;for(;t&&t!==document.body&&t!==document.documentElement;){if(t.classList.contains("pin-spacer"))return!0;let n=getComputedStyle(t).position;if(n==="sticky"||n==="fixed")return!0;t=t.parentElement}return!1}function Pe(e,t){return e.getAttribute(t)}function $n(e,t,n=0){let o=Pe(e,t);if(o===null||o.trim()==="")return n;let i=parseFloat(o);return Number.isFinite(i)?i:n}function Gn(e,t,n=""){let o=Pe(e,t);return o===null||o===""?n:o}function Yt(e){let t=e.trim().toLowerCase();if(t===""||t==="true"||t==="1"||t==="yes")return!0;if(t==="false"||t==="0"||t==="no")return!1}function Bn(e,t,n=!1){let o=Pe(e,t);return o===null?n:Yt(o)??n}function qn(e,t){let n=Pe(e,t);return n?n.split(/[\s,]+/).filter(Boolean):[]}function qt(e,t){let n=e.trim();if(t==="number"){let o=parseFloat(n);return Number.isFinite(o)?o:void 0}return t==="boolean"?Yt(n):t==="list"?n.split(/[\s,]+/).filter(Boolean):n.replace(/^["']|["']$/g,"")}function Kn(e){return e.type?e.type:typeof e.default=="number"?"number":typeof e.default=="boolean"?"boolean":Array.isArray(e.default)?"list":"string"}var Kt=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function Ye(e,t,n,o){if(typeof t=="string"){let i=t.replace(/^data-/,""),f=n||{},u={};for(let c in f)u[c]={attr:`data-${i}-${Kt(c)}`,css:`--${i}-${Kt(c)}`,default:f[c]};return Xt(e,u,o)}return Xt(e,t,n)}function Xt(e,t,n){let o={},i=n;for(let f in t){let u=t[f],c=Kn(u),a;if(u.attr){let m=e.getAttribute(u.attr);m!==null&&(a=qt(m,c))}if(a===void 0&&u.css){i||=getComputedStyle(e);let m=i.getPropertyValue(u.css);m&&m.trim()!==""&&(a=qt(m,c))}o[f]=a===void 0?u.default:a}return o}var Oe={num:$n,str:Gn,bool:Bn,list:qn,options:Ye};var Qe=new Map,ee=e=>(Qe.has(e)||Qe.set(e,typeof matchMedia=="function"?matchMedia(e):null),Qe.get(e)),Xn="(prefers-reduced-motion: reduce)",Yn="(pointer: coarse)",Qn="(hover: hover) and (pointer: fine) and (min-width: 768px)",Qt="(forced-colors: active)",Zn="(prefers-reduced-data: reduce)";function Jn(e,t){let n=ee(e),o=i=>t(i.matches);return n?.addEventListener?.("change",o),()=>n?.removeEventListener?.("change",o)}var I={get reducedMotion(){return!!ee(Xn)?.matches},get isTouch(){return!!ee(Yn)?.matches},get isDesktop(){return!!ee(Qn)?.matches},get forcedColors(){return!!ee(Qt)?.matches},get saveData(){let e=typeof navigator<"u"?navigator.connection:null;return!!(e&&(e.saveData||/(^|-)2g$/.test(e.effectiveType||"")))||!!ee(Zn)?.matches},get webgl2(){return typeof window<"u"&&"WebGL2RenderingContext"in window},get designer(){if(typeof document>"u")return!1;let e=document.documentElement;return e.classList.contains("w-editor")||e.classList.contains("wf-design-mode")||!!document.body?.classList.contains("w-editor")},onForcedColorsChange:e=>Jn(Qt,e)};var er=1.5;function Zt(e,t){let n=new Set,o=new Map,i=null,f=null,u=innerWidth;function c(l){!i&&typeof ResizeObserver<"u"&&(i=new ResizeObserver(w=>{for(let M of w)(M.target===document.documentElement?n:o.get(M.target))?.forEach(b=>b.stale=!0);t()}),i.observe(document.documentElement)),i?.observe(l.el),!f&&typeof addEventListener=="function"&&(f=()=>{(innerWidth!==u||!I.isTouch)&&n.forEach(w=>w.stale=!0),u=innerWidth,t()},addEventListener("resize",f,{passive:!0}))}let a={x:0,y:0};function m(l,w){return l.scrolls?w?w.scroll:e.read():(a.x=window.scrollX||0,a.y=window.scrollY||0,a)}function y(l,w){let M=l.el.getBoundingClientRect(),b=m(l),h=l.measured&&(l.doc.w!==M.width||l.doc.h!==M.height);l.doc.x=M.left+b.x,l.doc.y=M.top+b.y,l.doc.w=M.width,l.doc.h=M.height,l.measured=!0,l.stale=!1,E(l,w),h&&g(l,"resize")}function E(l,w){let M=m(l,w),b=l.rect;b.x=l.doc.x-M.x,b.y=l.doc.y-M.y,b.width=l.doc.w,b.height=l.doc.h;let h=window.innerWidth||1,T=window.innerHeight||1,C=b.width>0||b.height>0,_=C&&b.x<h&&b.x+b.width>0&&b.y<T&&b.y+b.height>0,A=T*er;l.near=C&&b.x<h+A&&b.x+b.width>-A&&b.y<T+A&&b.y+b.height>-A;let k=(T-b.y)/Math.max(T+b.height,1);l.progress=k<0?0:k>1?1:k,l.inView=_,w&&_!==l.told&&g(l,(l.told=_)?"enter":"leave"),l.placed?.(b,T)}function g(l,w){l.emitter.emit(w,l.t)}function d(l){if(l.destroyed)return;l.destroyed=!0,n.delete(l);let w=o.get(l.el);w?.delete(l),w&&!w.size&&(o.delete(l.el),i?.unobserve(l.el)),g(l,"destroy"),l.emitter.clear()}function x(l,w={},M){let b={t:null,el:l,doc:{x:0,y:0,w:0,h:0},rect:{x:0,y:0,width:0,height:0},stale:!0,live:w.live??Re(l),scrolls:e.contains(l),inView:!1,told:!1,near:!1,progress:0,measured:!1,emitter:q(!1),destroyed:!1,placed:M};return b.t={el:l,get rect(){return b.rect},get inView(){return b.inView},get near(){return b.near},get progress(){return b.progress},get dpr(){return window.devicePixelRatio||1},get destroyed(){return b.destroyed},on(h,T){return b.emitter.on(h,T)},off(h,T){b.emitter.off(h,T)},destroy:()=>d(b),revert:()=>d(b)},n.add(b),o.has(l)||o.set(l,new Set),o.get(l).add(b),c(b),l.isConnected&&y(b),t(),b.t}return{track:x,get size(){return n.size},holds(l){for(let w of o.keys())if(l===w||l.contains(w))return!0;return!1},frame(l){for(let w of n){if(!w.el.isConnected){d(w);continue}try{w.stale||w.live&&w.near?y(w,l):E(w,l)}catch(M){D("tracker",[],O.error,M)}}},Ma(){for(let l of n)l.el.isConnected||d(l)},touch(l){for(let w of n)l.some(M=>M===w.el||M.contains(w.el))&&(w.stale=!0)},invalidate(l){for(let w of n)(!l||w.el===l)&&(w.stale=!0);t()},destroy(){for(let l of[...n])d(l);i?.disconnect(),i=null,f&&removeEventListener("resize",f),f=null}}}function ce(e){let t={x:0,y:0,width:0,height:0},n=()=>{};return{el:e,rect:t,inView:!1,near:!1,progress:0,dpr:1,destroyed:!1,on:()=>n,off:n,destroy:n,revert:n}}var Jt={top:0,left:0,center:.5,middle:.5,bottom:1,right:1};function tr(e){let t=/^(top|left|center|middle|bottom|right|-?\d*\.?\d+(?:px|%)?)?(?:([+-])=?(\d*\.?\d+)(px|%)?)?$/.exec(e);if(!t||!t[1]&&!t[2])return null;let n=0,o=0;if(t[1]&&t[1]in Jt)n=Jt[t[1]];else if(t[1]){let i=parseFloat(t[1]);t[1].endsWith("%")?n=i/100:o=i}if(t[2]){let i=parseFloat(t[3])*(t[2]==="-"?-1:1);t[4]==="%"?n+=i/100:o+=i}return[n,o]}function Ae(e,t){let n=(e||"").trim().toLowerCase();if(!n)return t;let o=tr(n);return o?/^[+-]/.test(n)&&!/^-\d/.test(n)?[t[0]+o[0],t[1]+o[1]]:o:t}var nr={cover:"0110",contain:"11000011",entry:"01110100",exit:"00101110","entry-crossing":"0111","exit-crossing":"0010"};function rr(e,t){let n=nr[e[0]],o=e[1]||(t?"100%":"0%"),i=o.endsWith("%")?0:parseFloat(o)||0,f=i?0:parseFloat(o)/100||0,u=c=>({el:+n[c]+(+n[c+2]-+n[c])*f,elPx:i,vp:+n[c+1]+(+n[c+3]-+n[c+1])*f,vpPx:0});return n?{...u(0),alt:n[4]?u(4):void 0}:null}function te(e,t){let n=(e||t).trim().split(/\s+/),o=rr(n.map(m=>m.toLowerCase()),t.startsWith("bottom"));if(o)return o;let i=t.split(/\s+/),[f,u]=Ae(n[0],Ae(i[0],[0,0])),[c,a]=Ae(n[1],Ae(i[1],[0,0]));return{el:f,elPx:u,vp:c,vpPx:a}}function Ce(e,t,n,o,i){let f=m=>(m.alt&&t>n&&(m=m.alt),e+t*m.el+m.elPx-(n*m.vp+m.vpPx)),u=f(o),c=f(i),a=u-c;return Math.abs(a)>1e-6?Math.min(1,Math.max(0,u/a)):u<=0?1:0}function de(e,t,n,o){let i=1-Math.min(1,Math.max(0,n));return e+(t-e)*(1-Math.pow(i,Math.max(0,o)*60))}var Ze=(e,t=0,n=1)=>Math.min(n,Math.max(t,e)),en=(e,t,n)=>e+(t-e)*n,tn=(e,t,n,o,i)=>o+(e-t)/(n-t)*(i-o);function nn(e,t,n){if(e===t)return n<e?0:1;let o=Ze((n-e)/(t-e));return o*o*(3-2*o)}function rn(e,t="top bottom",n="bottom top",o=typeof innerHeight=="number"?innerHeight:0){return Ce(e.top??e.y??0,e.height,o,te(t,"top bottom"),te(n,"bottom top"))}var Je,or=0;function ir(e,t){let n=e.getAttribute("data-gl-css")||++or;e.setAttribute("data-gl-css",""+n);let o,i,f,u,c=()=>{Je?.isConnected||(Je=document.head.appendChild(document.createElement("style"))),i=(o=Je).sheet,f=i.cssRules[i.insertRule(`[data-gl-css="${n}"]{}`)],u=NaN};c();let a=m=>{o.isConnected||c(),m!==u&&f.style.setProperty(t,(u=m).toFixed(4),"important")};return a.end=()=>{let m=e.isConnected?-1:[...i.cssRules].indexOf(f);m>=0&&i.deleteRule(m)},a}function on(e,t={}){let n=t.start||"top bottom",o=t.end||"bottom top",i=te(n,"top bottom"),f=te(o,"bottom top"),u=q(!1),c=t.css?ir(e,t.css):null,a=null,m=!1,y={value:0,el:e,start:n,end:o,get destroyed(){return m},on(d,x){return u.on(d,x)},off(d,x){u.off(d,x)},destroy(){a?.destroy()},revert(){a?.destroy()}};return{signal:y,place:(d,x)=>{let l=Ce(d.y,d.height,x,i,f);c?.(l),l!==y.value&&(y.value=l,u.emit("change",y))},bind:d=>{a=d,d.on("destroy",()=>{m||(m=!0,c?.end(),u.emit("destroy",y),u.clear())})}}}function tt(e,t={}){let n=()=>{};return{value:0,el:e,start:t.start||"top bottom",end:t.end||"bottom top",destroyed:!0,on:()=>n,off:n,destroy:n,revert:n}}function et(){let e=typeof document<"u"&&document.timeline?document.timeline.currentTime:null;return typeof e=="number"?e:typeof performance<"u"?performance.now():Date.now()}var sn=()=>typeof innerWidth=="number"?[Math.round(innerWidth/2),Math.round(innerHeight/2)]:[0,0];function an(e,t){let n=sn(),o={value:[0,0]},i=[n[0],n[1]],f=et(),u=!1,c=!1,a=[],m=(x,l)=>{!Number.isFinite(x)||!Number.isFinite(l)||(u||(i[0]=x,i[1]=l,f=et()),u=!0,n[0]=x,n[1]=l,c=!0,e(2))},y=x=>m(x.clientX,x.clientY),E=x=>{let l=x.touches?.[0];l&&m(l.clientX,l.clientY)},g=(x,l)=>{addEventListener(x,l,{passive:!0}),a.push(()=>removeEventListener(x,l))};return g("pointermove",y),g("pointerdown",y),g("touchstart",E),g("touchmove",E),a.push(t(x=>{let l=x.dt>0?x.dt:.016666666666666666,w=et(),M=w>f?(w-f)/1e3:l;f=w;let b=(n[0]-i[0])/M,h=(n[1]-i[1])/M;i[0]=n[0],i[1]=n[1];let T=o.value;T[0]=de(T[0],b,.25,l),T[1]=de(T[1],h,.25,l),Math.abs(T[0])+Math.abs(T[1])<1&&!c&&(T[0]=0,T[1]=0),c=!1,(T[0]!==0||T[1]!==0)&&e()})),{signal:{value:n,velocity:o,get active(){return u}},destroy(){a.forEach(x=>x()),a.length=0}}}function ln(){return{value:sn(),velocity:{value:[0,0]},active:!1}}function un(e){try{e()}catch(t){D("undo",[],O.error,t)}}function cn(){let e=[];function t(c){let a=e[e.length-1];return a?a.gen!==a.scope.gen?(un(c),!0):(a.scope.items.push(c),a.scope.reverted=!1,!0):!1}function n(c){let a=E=>E&&(typeof E=="function"?E():E.release?E.release():E.destroy?.());if(!e.length||!c)return c;if(typeof c.then!="function")return t(()=>a(c)),c;let m,y=!1;return t(()=>a((y=!0)&&m)),c.then(E=>y?a(E):m=E,()=>{}),c}function o(c,a){e.push(c);try{return a()}finally{let m=e.lastIndexOf(c);m!==-1&&e.splice(m,1)}}function i(c){let a=e.splice(0);try{c()}finally{e.unshift(...a)}}function f(){for(let c=e.length-1;c>=0;c--)if(e[c].scope.container)return e[c].scope.container;return document}function u(c,a,m){let y={items:[],gen:0,container:a,reverted:!1},E=[],g=Promise.resolve(),d=l=>w=>o({scope:y,gen:l<0?y.gen:l},w),x=Object.assign({get container(){return y.container},get reverted(){return y.reverted},get ready(){return g},run(l){let w=y.gen,M=Object.assign(Object.create(x),m(d(w),()=>w!==y.gen)),b;try{b=o({scope:y,gen:w},()=>l(M))}catch(h){D("scopeFn",[],O.error,h);return}if(b&&typeof b.then=="function"){let h=Promise.resolve(b).then(()=>{},T=>D("scopeAsync",[],O.error,T));E.push(h),g=Promise.all(E).then(()=>{})}return b},revert(){y.gen++;let l=y.items.splice(0);for(let w=l.length-1;w>=0;w--)un(l[w]);y.reverted=!0,E=[]},destroy(){x.revert()}},m(d(-1),()=>!1));return t(()=>x.revert()),c&&!y.gen&&x.run(c),x}return{own:t,keep:n,root:f,create:u,outside:i}}var st=e=>e.left??e.x??0,at=e=>e.top??e.y??0;function lt(){return{left:0,top:0,width:typeof innerWidth=="number"?innerWidth:1,height:typeof innerHeight=="number"?innerHeight:1}}function ne(e,t,n,o,i){let f=e[3]*t+e[7]*n+e[11]*o+e[15]||1;return i[0]=(e[0]*t+e[4]*n+e[8]*o+e[12])/f,i[1]=(e[1]*t+e[5]*n+e[9]*o+e[13])/f,i[2]=(e[2]*t+e[6]*n+e[10]*o+e[14])/f,f}var F=[0,0,0],z=[0,0,0];function nt(e,t,n,o,i){ne(e.projectionMatrixInverse.elements,t,n,-1,F),ne(e.matrixWorld.elements,F[0],F[1],F[2],F),ne(e.projectionMatrixInverse.elements,t,n,1,z),ne(e.matrixWorld.elements,z[0],z[1],z[2],z);let f=z[2]-F[2],u=Math.abs(f)<1e-12?0:(o-F[2])/f;return i[0]=F[0]+(z[0]-F[0])*u,i[1]=F[1]+(z[1]-F[1])*u,i[2]=o,i}function sr(e){return e.updateMatrixWorld?.(),e.matrixWorld.elements[14]}function dn(e,t,n){let o=n??lt().height,i=e.zoom||1;if(e.isOrthographicCamera)return o*i/Math.max(1e-9,(e.top??1)-(e.bottom??-1));let f=Math.abs(t??sr(e)),u=(e.fov??50)*Math.PI/180;return o*i/Math.max(1e-9,2*f*Math.tan(u/2))}function fn(e,t,n=1){let o=Math.max(1e-6,t.width)/n,i=Math.max(1e-6,t.height)/n;if(e.isOrthographicCamera)e.left=-o/2,e.right=o/2,e.top=i/2,e.bottom=-i/2,e.zoom=1;else{let f=(e.fov??50)*Math.PI/180,u=i/2/Math.tan(f/2);e.aspect=o/i,e.zoom=1,e.position&&(e.position.z=u),typeof e.far=="number"&&e.far<u*2&&(e.far=u*2)}return e.updateProjectionMatrix?.(),e.updateMatrixWorld?.(!0),e}var rt=[0,0,0],ot=[0,0,0],it=[0,0,0];function Ne(e,t,n,o={}){let i=o.frame||lt(),f=o.z??0;t.updateMatrixWorld?.();let u=Math.max(i.width,1e-6),c=Math.max(i.height,1e-6),a=(g,d)=>[(g-st(i))/u*2-1,1-(d-at(i))/c*2],m=st(e),y=at(e);nt(t,...a(m,y),f,rt),nt(t,...a(m+e.width,y+e.height),f,ot),nt(t,...a(m+e.width/2,y+e.height/2),f,it);let E={x:it[0],y:it[1],z:f,width:Math.abs(ot[0]-rt[0]),height:Math.abs(rt[1]-ot[1])};return n&&(n.x=E.x,n.y=E.y,n.z=E.z),E}function Ve(e,t,n=lt()){t.updateMatrixWorld?.(),ne(t.matrixWorldInverse.elements,e.x,e.y,e.z,F);let o=ne(t.projectionMatrix.elements,F[0],F[1],F[2],z),i=t.isOrthographicCamera?!0:o>0;return{x:st(n)+(z[0]+1)/2*n.width,y:at(n)+(1-z[1])/2*n.height,visible:i&&Math.abs(z[0])<=1&&Math.abs(z[1])<=1&&z[2]>=-1&&z[2]<=1}}function ut(e,t,n,o,i){let f=q(!1),u="loading",c=null,a=null,m=!1,y=()=>{},E=new Promise(h=>y=h),g={kind:e,el:t,options:n,tracker:o,view:null,busy:new Set,wanted:0,get destroyed(){return m},emit(h,T){f.emit(h,T??b)},setStatus(h,T=null){if(m)return;let C=u;u=h,c=h==="off"||h==="error"?T:null,t.setAttribute("data-gl-view",h),h==="ready"&&y(!0),(h==="off"||h==="error")&&y(!1),h!==C&&(h==="ready"&&C==="loading"&&f.emit("ready",b),h==="error"&&f.emit("error",b))}},d=o.on("enter",()=>f.emit("enter",b)),x=o.on("leave",()=>f.emit("leave",b)),l=o.on("destroy",()=>w());function w(){if(!m){d(),x(),l();try{a?.destroy()}catch{}a=null,u="destroyed",m=!0,y(!1),t.removeAttribute("data-gl-view"),o.destroy(),i(),f.emit("destroy",b),f.clear()}}let M=()=>a?.frame?.()||{left:o.rect.x,top:o.rect.y,width:o.rect.width,height:o.rect.height},b={el:t,kind:e,get status(){return u},get enabled(){return u!=="off"&&u!=="error"&&u!=="destroyed"},get reason(){return c},ready:E,get rect(){return o.rect},get inView(){return o.inView},get progress(){return o.progress},get width(){return a?.width||0},get height(){return a?.height||0},get dpr(){return a?.dpr||0},wake(h=1){m||(a?a.wake(h):g.wanted=Math.max(g.wanted,h))},busy(h,T){m||(typeof h=="boolean"&&(T=h,h="busy"),T===!1?g.busy.delete(h):g.busy.add(h),a?.busy())},on(h,T){return f.on(h,T)},off(h,T){f.off(h,T)},rectToWorld(h,T,C=0){return Ne(h,n.camera,T,{z:C,frame:M()})},worldToRect(h){return Ve(h,n.camera,M())},destroy:w,revert:w};return g.view=b,t.setAttribute("data-gl-view","loading"),{view:b,state:g,drive(h){if(m){h?.destroy();return}a=h}}}function K(e,t,n,o){let i=t||(typeof document<"u"?document.createElement("div"):{setAttribute(){},removeAttribute(){}}),f=ut(e,i,o||{},ce(i),()=>{});return f.state.setStatus("off",n),t||i.removeAttribute("data-gl-view"),f.view}var mn="0.2.1";var ar=/^(_|(id|el|kind|status|rect|inView|progress|effects|uniforms|set|get|tween|play|on|off|wake|destroy|revert)$)/,_e=[],ct=new Set;function pn(e,t={}){let n=[e,t];_e.push(n),ct.forEach(o=>o(n))}function gn(){let e=typeof window<"u"?window:null,t=Array.isArray(e?.UmberModules)?e.UmberModules.splice(0):[];for(let n of t)Array.isArray(n)?_e.push([n[0],n[1]||{}]):n&&_e.push([n,{}]);return _e.slice()}function yn(e){return ct.add(e),()=>void ct.delete(e)}function hn(e,t,n){if(!t||typeof t!="object"||typeof t.name!="string"||!t.name)return V("use",[]),!1;let o=t.name;if(ar.test(o))return V("own",[o]),!1;let i=e.modules.get(o);return i?(i.module!==t&&V("useTwice",[o]),!1):(t.version&&t.version!==mn&&V("version",[o,t.version,mn]),e.modules.set(o,{module:t,options:n||{}}),!0)}function bn(e){if(!e||typeof e.tagName!="string")return"<?>";let t=e.tagName.toLowerCase();if(e.id)return`<${t}#${e.id}>`;let n=typeof e.className=="string"?e.className.trim().split(/\s+/)[0]:"";return n?`<${t}.${n}>`:`<${t}>`}var vn=()=>new Promise(e=>{let t=new MessageChannel;t.port1.onmessage=e,t.port2.postMessage(0)});function De(e){let t=self.occluzeCapture;return t?.version==1&&t.wait(Promise.race([e,lr(1e4)]).then(vn,vn)),e}var lr=e=>new Promise(t=>{let n=AbortSignal.timeout?.(e);n?n.onabort=()=>t():setTimeout(t,e)});var fe="0.2.1",wn=4e3,En=8e3,He=null,ur=()=>typeof window<"u"&&typeof document<"u"&&typeof location<"u";function re(e,t,n=document){let o=typeof e=="string"?n.querySelector(e):e;if(o&&o.nodeType===1){if(o.isConnected)return o;V("unplaced",[t],o)}else V("absent",[t,e]);return null}function Sn(e){e.removeAttribute("data-gl-status"),e.removeAttribute("data-gl-morphing"),e.removeAttribute("data-gl-play"),Xe(e)}function kn(){document.documentElement.classList.remove("has-gl"),document.querySelectorAll(G).forEach(Sn)}var cr=e=>e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`);function dr(e){let t={"data-gl":e.type||""},n=typeof e.effects=="string"?e.effects.split(/[\s,]+/).filter(Boolean):e.effects||[];n.length&&(t["data-gl-effect"]=n.join(" "));for(let o in e.options||{}){let i=e.options[o]||{};for(let f in i){let u=i[f];u!=null&&(t[`data-gl-${o}-${cr(f)}`]=Array.isArray(u)?u.join(" "):String(u))}}return e.shader&&(t["data-gl-shader"]=e.shader),e.layer&&(t["data-gl-layer"]=e.layer),e.src&&(t["data-gl-src"]=e.src),e.fit&&(t["data-gl-fit"]=e.fit),e.instances!==void 0&&(t["data-gl-instances"]=String(e.instances)),e.order!==void 0&&(t["data-gl-order"]=String(e.order)),e.live!==void 0&&(t["data-gl-live"]=e.live?"":"false"),e.clip!==void 0&&(t["data-gl-clip"]=e.clip?"true":"false"),t}function fr(e){let t=document.body?.getAttribute("data-gl-devices")??document.documentElement.getAttribute("data-gl-devices"),n=e.devices??(t==="desktop"?"desktop":"all");return{...e,devices:n,reducedMotion:e.reducedMotion==="off"?"off":"static"}}function xn(e){if(e.devices===!1||Ee("umber")==="off")return"disabled";if(!I.webgl2)return"no-webgl2";if(I.designer&&!e.designer)return"editor";if(I.forcedColors)return"forced-colors";if(typeof e.devices=="function"){let n=!1;try{n=!!e.devices(I)}catch(o){D("devicesThrew",[],O.error,o)}if(!n)return"device"}else if(e.devices!=="all"&&!I.isDesktop)return"device";let t=e.media??document.body?.getAttribute("data-gl-media");return t&&!matchMedia(t).matches?"device":e.reducedMotion==="off"&&I.reducedMotion?"reduced-motion":e.respectSaveData!==!1&&I.saveData?"save-data":null}function Tn(e={},t){if(!ur())return t.inert("server");ke(t.loadInspect);let n=He||window.__umber?.engine;if(n&&!n.destroyed)return V("twice",[]),n;let o=mr(e,t);return He=o,o}function mr(e,t){let n=fr(e);O.configure({debug:!!n.debug||Ee("umber-debug")!=null,warnings:n.warnings!==!1}),![void 0,!1,"all","desktop"].includes(e.devices)&&typeof e.devices!="function"&&V("devices",[e.devices]);let o={effects:new Map,shaders:new Map,layers:new Map,chunks:new Map,modules:new Map},i=q(),f=Dt(),u=Ct({auto:n.loop!==!1,raf:t.raf,caf:t.caf}),c=xe(n.scroll),a={value:0},m=new Map,y=new Map,E=[],g=xn(n),d=null,x,l=!1,w=!1,M=null,b,h=!1,T=!1,C=()=>{},_=new Promise(r=>C=r),A=c.kind==="lenis",k=()=>{let r=typeof document.timeline<"u"?document.timeline.currentTime:null;return typeof r=="number"?r:null},S=null,W=!1,B=()=>{!u.running||S===null||k()===S&&u.follow()},U=$t(()=>{W||B(),u.wake(1)},()=>{if(g||!d)return;let r=mt();r?Q(r):d.keep()&&u.auto&&u.tick()}),j=Zt(c,()=>u.wake(1)),Fe=new Set,N=cn(),me=null,mt=()=>document.body?.hasAttribute("data-gl-disable")?"disabled":I.designer&&!n.designer?"editor":null;function pt(){try{d?.destroy()}catch(r){O.error("GL destroy failed",r)}d=null}function Q(r){g=r,clearTimeout(b),x=d?.info||x,pt(),kn(),vt(),C(!1),i.emit("off",{reason:r}),O.debug&&D("off",[r],O.info)}let pe=()=>(d||j.size)&&u.wake(1),Pn=()=>{if(A&&(B(),!u.running))return queueMicrotask(pe);pe()},oe=0,ie=new Map;function se(){let r=U.take();r&&(oe&&r.added.length&&N.outside(()=>i.emit("added",r.added)),r.detached&&j.Ma(),r.styles?j.invalidate():r.touched.length&&j.touch(r.touched),yt(r))}u.add(r=>{let s=c.sample(r.dt,r.woke);r.scroll.x=s.x,r.scroll.y=s.y,r.scroll.velocity=s.velocity,S=k(),W=!0,se(),j.frame(r),vt()},{phase:"measure",order:-1e3}),u.add(()=>{U.collect(),W=!1},{phase:"render",order:1/0});let ge={...t,options:n,registry:o,ticker:u,scroll:c,clock:f,env:I,log:O,emit:(r,s)=>i.emit(r,s),off:r=>queueMicrotask(()=>g||Q(r)),engine:null,velocity:a,gpu:Ee("umber-gpu"),changes:()=>U.changes,lib:{attr:Oe,config:Ye,describe:bn,findGL:Le,findMedia:Me,markMedia:Ke,unmarkMedia:Xe,needsLive:Re,say:V,tell:D,createEmitter:q}};function gt(r){for(let s of r)s.hasAttribute("data-gl-status")||(s.setAttribute("data-gl-status","loading"),Gt(s)||Ke(s,Me(s)),Oe.list(s,"data-gl-effect").some(p=>o.effects.get(p)?.play)&&s.setAttribute("data-gl-play",""))}function yt(r){if(g)return;let s=mt();if(s)return Q(s);if(d)return d.apply(r);let p=[];for(let v of[...r.added,...r.rebuild])p.push(...Le(v));if(!p.length){!M&&document.readyState!=="loading"&&(T=!0,C(!1));return}gt(p),ye()}let On,ht=t.loadLicence?null:!0;function ze(){return On||=t.loadLicence?t.loadLicence().then(r=>r.ok(),()=>!1).then(r=>ht=r):Promise.resolve(!0)}function ye(){return d?Promise.resolve(d):M||(T=!1,b=setTimeout(()=>{d||g||(O.warn(`chunks/gl.js took more than ${wn/1e3} s to download; the plain DOM shows for this visit (slow network?).`),Q("load-timeout"))},wn),t.loadText&&document.querySelector('[data-gl="text"]')&&t.loadText().catch(()=>{}),t.loadVideo&&document.querySelector("[data-gl] video,video[data-gl]")&&t.loadVideo().catch(()=>{}),M=Promise.all([t.load(),ze()]).then(([r,s])=>{if(clearTimeout(b),g)return null;if(s===!1)return Q("unlicensed"),null;let p=r.mount(ge);return p?(d=p,$&&p.begin($.next),p.scan(document.documentElement),l&&p.pause(),w&&p.live(w),C(!0),i.emit("ready",H),p):(Q("context"),null)}).catch(r=>(clearTimeout(b),g||(O.error("chunks/gl.js failed to load; the site keeps working without GL.",r),Q("load-failed")),null)),De(M))}let $=null;function An(r){if(g||h)return()=>Promise.resolve();if($)return d?.begin(r,!0),$.end;let s={next:r,release:f.hold(),timer:setTimeout(()=>{let p=!1;try{p=!!n.busy&&document.documentElement.matches(n.busy)}catch{}V("change",[p?n.busy:"",En/1e3]),s.end()},En),end(p){if($!==s)return Promise.resolve();$=null,clearTimeout(s.timer);let v=()=>(s.release(typeof p=="number"?p:0),se(),d?.end());return p&&typeof p.then=="function"?Promise.resolve(p).then(v,v):Promise.resolve(v())}};return $=s,d?.begin(r),s.end}let ae=null;function bt(){if(ae||h)return;let r=c.ma(Pn);c.kind!=="window"&&addEventListener("scroll",pe,{passive:!0}),ae=()=>{ae=null,r(),removeEventListener("scroll",pe)}}let vt=()=>g&&!j.size&&!oe&&(U.stop(),ae?.());function he(){bt(),U.watch(r=>j.holds(r),()=>oe>0),U.start()}function wt(r,s){let p=re(r,"gl.track()",N.root());if(!p||h)return ce(p||document.createElement("div"));he();let v=j.track(p,s);return N.own(()=>v.destroy()),v}function Et(r,s={}){let p=re(r,"gl.progress()",N.root());if(!p||h)return tt(p||document.createElement("div"),s);he();let v=on(p,s);return v.bind(j.track(p,{live:s.live},v.place)),N.own(()=>v.signal.destroy()),v.signal}function Cn(r,s={}){if(h||typeof r!="function")return()=>{};let p=u.add(v=>{p(),r(v)},{phase:s.phase||"update",order:s.order});return u.wake(1),N.own(p),p}function kt(r,s={}){let p=re(r,"gl.add()",N.root());if(!p||h||g)return Promise.resolve(null);let v=()=>d&&d.plane(p)||null;if(p.hasAttribute("data-gl"))return O.debug&&D("added",[],O.info,p),d?Promise.resolve(v()):H.ready.then(v);let R=dr(s),L={};for(let P in R)L[P]=p.getAttribute(P),p.setAttribute(P,R[P]);return se(),N.own(()=>{d?.remove(p);for(let P in L)L[P]===null?p.removeAttribute(P):p.setAttribute(P,L[P]);p.hasAttribute("data-gl")||Sn(p),se()}),d?Promise.resolve(v()):H.ready.then(v)}let xt=["effect","shader","layer","chunk","on","nextFrame","scope","target","snapshot","sim","flow","brush","preload","warm","leave","flip"];function Nn(r,s){let p=s==null?null:re(s,"gl.scope(fn, container)")||document.createElement("div");return N.create(r,p,(v,R)=>({...Object.fromEntries(xt.map(L=>[L,(...P)=>v(()=>H[L](...P))])),add:(L,P)=>R()?Promise.resolve(null):v(()=>kt(L,P)),track:(L,P)=>R()?ce(document.createElement("div")):v(()=>wt(L,P)),progress:(L,P)=>R()?tt(document.createElement("div"),P):v(()=>Et(L,P)),attach:(L,P)=>R()?K("attach",null,"destroyed",P):v(()=>Lt(L,P)),view:(L,P)=>R()?K("view",null,"destroyed",P||{}):v(()=>Rt(L,P))}))}function St(r){return g&&!/^(c|l|er|dev)/.test(g)?g:xn({...n,devices:r??n.devices})}function Tt(r,s,p){he();let v=ut(r,s,p,j.track(s),()=>Fe.delete(v));return Fe.add(v),v}let Mt=null,Ie=null;function Vn(r){return(t.loadInspect?t.loadInspect():Promise.reject()).then(s=>s.print(r,{log:O,stage:d?.stage,off:g,loading:!!M}),s=>(O.error("chunks/inspect.js failed to load; gl.inspect() can't answer.",s),null))}function Lt(r,s){let p=re(r,"gl.attach()",N.root());if(!p)return K("attach",null,"not-found",s);if(!s||!s.renderer)return V("renderer",[]),K("attach",p,"no-renderer",s);let v=St(s.devices);if(v)return O.debug&&D("attachOff",[v],O.info,p),K("attach",p,v,s);if(!t.loadViews)return V("noViews",[]),K("attach",p,"load-failed",s);let R=Tt("attach",p,s);return N.own(()=>R.view.destroy()),Mt||={options:n,ticker:u,env:I,log:O,gpu:ge.gpu,lib:ge.lib},Promise.all([t.loadViews(),ze()]).then(([L,P])=>P?R.drive(L.attach(Mt,R.state)):R.state.destroyed||R.state.setStatus("off","unlicensed"),L=>{O.error("chunks/views.js failed to load; gl.attach() views are not drawn.",L),R.state.setStatus("error","load-failed")}),R.view}function Rt(r,s={}){let p=re(r,"gl.view()",N.root());if(!p)return K("view",null,"not-found",s);let v=St(s.devices)||g;if(v)return v===g&&g==="device"&&V("view",[],p),K("view",p,v,s);let R=Tt("view",p,s);return N.own(()=>R.view.destroy()),ye().then(async L=>{if(R.state.destroyed)return;if(!L)return R.state.setStatus("off",g||"context");let P=await L.view(R.state);if(R.state.destroyed)return P?.destroy();if(!P)return R.state.setStatus("error","plane");R.drive(P)}),R.view}function _n(r,s){return g||h?Promise.resolve(null):ye().then(p=>p?p.renderer(r,s):null)}function Y(r,s){if(g||h)return Promise.resolve(null);let p=ye().then(v=>v&&v.fx(r,s));return N.keep(r==="flow"?p.then(v=>v&&!Pt.has(v)&&Pt.add(v)?v:null,()=>null):p),p}let Pt=new WeakSet,Z=[];function Dn(r,s){let p=[r,s],v=!1;return Z.push(p),N.own(()=>{let L=Z.indexOf(p);L<0||(Z.splice(L,1),v&&L===Z.length&&Y("setLeave",Z[L-1]||[null]))})||(Z=[p]),Z.includes(p)?(v=!0,Y("setLeave",p)):Promise.resolve()}function Ot(r,s,p){let v=Y(r,{what:s,fn:p,set:R=>v.value=R}).then(()=>{v.value<1&&p?.(v.value=1)});return v.value=+!!(g||h),v}function be(r,s,p){if(!s||typeof s!="string"||!p||typeof p!=(r==="chunk"?"string":"object")){V("define",[r]);return}let v=o[`${r}s`],R=v.get(s);v.set(s,p);let L=r+":"+s,P=y.get(L)||[R];if(y.set(L,P),P.push(p),r==="effect"&&p.play&&!d&&!g)for(let ue of document.querySelectorAll('[data-gl-status="loading"]:not([data-gl-play])'))Oe.list(ue,"data-gl-effect").includes(s)&&ue.setAttribute("data-gl-play","");R!==void 0&&R!==p&&d?.redefined(r,s),d?.defined(r,s);let Wn=()=>{if(P.splice(P.lastIndexOf(p),1),v.get(s)!==p)return;let ue=P[P.length-1];ue===void 0?v.delete(s):v.set(s,ue),d?.redefined(r,s)};N.own(Wn)||y.delete(L)}function le(r,s={}){if(r&&r.name==="debug"&&typeof e.debug=="object"&&e.debug&&(s={...e.debug,...s}),h||!hn(o,r,s))return H;let p=new Set(Object.keys(H));try{N.outside(()=>r.install?.(H,s,N.keep,N.root))}catch(v){D("install",[r.name],O.error,v)}for(let v in H){let R=Object.getOwnPropertyDescriptor(H,v).value;!p.has(v)&&typeof R=="function"&&(H[v]=(...L)=>N.keep(R.apply(H,L)),xt.push(v))}return d?.defined("module",r.name),H}function Hn(r){if(arguments.length){r?d?.remove(r):V("destroy",[]);return}if(!h){h=!0,clearTimeout(b),$&&clearTimeout($.timer),$=null;for(let s of[...Fe])s.view.destroy();j.destroy(),me?.destroy(),me=null,pt(),U.stop(),ae?.(),u.destroy(),f.reset(),E.forEach(s=>s()),kn(),g="destroyed",C(!1),i.emit("destroy"),i.clear(),He===H&&(He=null),window.__umber?.engine===H&&delete window.__umber}}let H={version:fe,get ready(){return g?Promise.resolve(!1):d?Promise.resolve(!0):M?M.then(r=>!!r):T?Promise.resolve(!1):_},get enabled(){return!g},get licence(){return ht},get reason(){return g},get destroyed(){return h},velocity:a,get pointer(){return h?ln():(me||=an((r=1)=>u.wake(r),r=>u.add(r,{phase:"measure",order:-900})),me.signal)},on(r,s,p={}){if(r==="frame"){m.get(s)?.();let R=u.add(s,{always:!0,...p}),L=()=>{R(),m.get(s)===L&&m.delete(s)};return m.set(s,L),N.own(L),L}if(r==="added"&&!h){ie.get(s)?.(),oe++,he();let R=i.on(r,s),L=()=>{ie.get(s)===L&&(ie.delete(s),oe--,R())};return ie.set(s,L),N.own(L),L}let v=i.on(r,s);return N.own(v),v},off(r,s){r==="frame"?m.get(s)?.():r==="added"?ie.get(s)?.():i.off(r,s)},effect(r,s){be("effect",r,s)},shader(r,s){be("shader",r,s)},layer(r,s){be("layer",r,s)},chunk(r,s){be("chunk",r,s)},use:le,licensed:ze,add:kt,scope:Nn,progress:Et,nextFrame:Cn,scan(r=document){if(!g)if(d)d.scan(r);else{let s=r instanceof Element?r:document.documentElement;yt({added:[s],removed:!1,rebuild:[],sources:[],touched:[],detached:!1,styles:!1})}},prune(){d?.prune()},destroy:Hn,invalidate(r){d?.invalidate(r),j.invalidate(r)},live(r){w=r,d?.live(r)},wake(r=1){d?d.wake(r):u.wake(r)},pause(){l=!0,d?.pause()},resume(){l=!1,d?.resume()},inspect:Vn,plane(r){return r&&d&&d.plane(r)||null},planes(r){return d?d.planes(r):[]},hold(r){return f.hold(r)},render(r){if(h)return;if(u.auto&&u.running){V("loop",[]);return}let s=r??performance.now();Ie!==null&&Math.abs(s-Ie)<1&&V("render",[]),Ie=s,u.tick(r)},track:wt,attach:Lt,view:Rt,renderer:_n,target:r=>Y("target",r),snapshot:r=>Y("snapshot",r),sim:r=>Y("sim",r),flow:r=>Y("flow",r),brush:(r,s)=>N.keep(r?.brush?r.brush(s):null),preload:(r,s)=>Ot("preload",r,s),warm:(r,s)=>Ot("warm",r,s),placeholder:r=>Y("placeholder",r),leave:Dn,flip:(r,s,p)=>d?d.flip(r,s,p):(s?.(),Promise.resolve()),transition:An,morph:{capture(r){d?.morph.capture(r)},settle(){se(),d?.morph.settle()}},get info(){return d?.info||{...g&&x,state:g?`off (${g})`:"dormant"}},get canvas(){return d?.canvas||null},get context(){return d?.gl||null}};ge.engine=H;for(let r of n.modules||[])Array.isArray(r)?le(r[0],r[1]):le(r);for(let[r,s]of gn())le(r,s);if(E.push(yn(([r,s])=>le(r,s))),window.__umber={version:fe,engine:H,get modules(){return[...o.modules.keys()]}},g){O.debug&&D("off",[g],O.info),C(!1);let r=g;return queueMicrotask(()=>h||i.emit("off",{reason:r})),H}if(document.documentElement.classList.add("has-gl"),document.body?.hasAttribute("data-gl-disable")||gt(Le(document.documentElement)),bt(),U.start(),document.readyState==="loading"){let r=()=>{!d&&!M&&!g&&!U.pending&&(T=!0,C(!1))};document.addEventListener("DOMContentLoaded",r,{once:!0}),E.push(()=>document.removeEventListener("DOMContentLoaded",r))}return H}var pr="https://umber.occluze.com";function Mn(e){if(!e)return"";try{let t=new URL(e,location.href),n=t.pathname.match(/^(.*\/umber@)[^/]+\//);return n?`${t.origin}${n[1]}0.2.1/`:t.href.replace(/[^/]*$/,"")}catch{return""}}function dt(){return`${pr}/umber@0.2.1/`}var gr=e=>e&&!e.endsWith("/")?`${e}/`:e,Ln=["views","text","shapes","layers","morph","video","glsl","restore","fx","warm","flip","instances","covers","inspect","licence","capture"];function We(e,t="gl"){let n=null;return()=>{if(n)return n;let o=`${gr(e)}chunks/${t}.js`;return n=De(import(o).catch(i=>{throw n=null,i})),n}}var Rn=Mn(document.currentScript?.src);function yr(e={}){let t=e.base||Rn||dt(),n={load:We(t)};for(let o of Ln)n[`load${o[0].toUpperCase()}${o.slice(1)}`]=We(t,o);return Tn(e,n)}var hr=Object.freeze({pxPerWorld:dn,fitCamera:fn,rectToWorld:Ne,worldToRect:Ve,damp:de,clamp:Ze,lerp:en,mapRange:tn,smoothstep:nn,rectProgress:rn}),ft=window;ft.Umber?.version?(ke(We(Rn||dt(),"inspect")),V("script",[fe,ft.Umber.version])):ft.Umber=Object.freeze({version:fe,createGL:yr,math:hr,use:pn});})();