@fiddle-digital/string-tune
Version:
StringTune is a cutting-edge JavaScript library designed to deliver high-performance, modular web effects. Whether you're looking to add smooth parallax scrolling, dynamic cursor interactions, progress tracking, or autoplay videos, StringTune empowers dev
1 lines • 472 kB
JavaScript
"use strict";var pi=Object.defineProperty;var Xn=Object.getOwnPropertyDescriptor;var qn=Object.getOwnPropertyNames;var Kn=Object.prototype.hasOwnProperty;var Zn=(u,r)=>{for(var t in r)pi(u,t,{get:r[t],enumerable:!0})},Qn=(u,r,t,e)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of qn(r))!Kn.call(u,i)&&i!==t&&pi(u,i,{get:()=>r[i],enumerable:!(e=Xn(r,i))||e.enumerable});return u};var Jn=u=>Qn(pi({},"__esModule",{value:!0}),u);var Yo={};Zn(Yo,{CursorReactiveModule:()=>It,DOMBatcher:()=>Dt,GridAdapter:()=>z,ScrollController:()=>et,StringAnchor:()=>nr,StringCursor:()=>Xe,StringData:()=>Xt,StringDelayLerpTracker:()=>fr,StringDevIconRegistry:()=>ce,StringDevInview:()=>xe,StringDevLayout:()=>Se,StringDevModule:()=>Z,StringDevOverlayRegistry:()=>Wt,StringDevProgress:()=>Ce,StringDevRulers:()=>we,StringFPSTracker:()=>vr,StringForm:()=>Mr,StringGlide:()=>sr,StringImpulse:()=>qe,StringLazy:()=>tr,StringLerp:()=>or,StringLerpTracker:()=>br,StringLoading:()=>er,StringMagnetic:()=>Qe,StringMasonry:()=>Ze,StringModule:()=>C,StringObject:()=>kt,StringParallax:()=>ar,StringPositionTracker:()=>yr,StringProgress:()=>Ht,StringProgressPart:()=>Ir,StringRandom:()=>Rr,StringResponsive:()=>ir,StringScrollContainer:()=>Or,StringScrollbar:()=>cr,StringScroller:()=>Dr,StringSequence:()=>Er,StringSplit:()=>mr,StringSpotlight:()=>Je,StringTune:()=>Hi,StringVideoAutoplay:()=>Lr,buildDevtoolsThemeBlock:()=>Pr,default:()=>Hi,ensureStringDevtoolsSharedStyles:()=>Vt,frameDOM:()=>U,resolveDevtoolsIcon:()=>F,styleTxn:()=>E});module.exports=Jn(Yo);var Ae=class{constructor(r=.1,t){this.SETTLE_THRESHOLD_SQ=.01;this.lastMouseX=0;this.lastMouseY=0;this.lastMouseTime=0;this._lerpStepXArgs={from:0,to:0,progress:0};this._lerpStepYArgs={from:0,to:0,progress:0};this.smoothingFactor=r,this.context=t,this.onSettingsChange({isDesktop:t.data.viewport.windowWidth>1024,isForceRebuild:!1,widthChanged:!0,heightChanged:!0,scrollHeightChanged:!0})}onMouseMove(r){let t=this.context.data.cursor;t.targetX=r.clientX,t.targetY=r.clientY;let e=performance.now(),i=Math.max(1,e-this.lastMouseTime);t.velocityX=(r.clientX-this.lastMouseX)/i,t.velocityY=(r.clientY-this.lastMouseY)/i,this.lastMouseX=r.clientX,this.lastMouseY=r.clientY,this.lastMouseTime=e}onFrame(){let r=this.context.data.cursor,t=r.targetX,e=r.targetY,i=r.smoothedX,n=r.smoothedY;this._lerpStepXArgs.from=i,this._lerpStepXArgs.to=t,this._lerpStepXArgs.progress=this.smoothingFactor,this._lerpStepYArgs.from=n,this._lerpStepYArgs.to=e,this._lerpStepYArgs.progress=this.smoothingFactor;let s=this.context.tools.lerp.process(this._lerpStepXArgs),o=this.context.tools.lerp.process(this._lerpStepYArgs);s*s+o*o<this.SETTLE_THRESHOLD_SQ?(r.smoothedX=t,r.smoothedY=e,r.stepX=0,r.stepY=0):(r.smoothedX+=s,r.smoothedY+=o,r.stepX=s,r.stepY=o)}onSettingsChange(r){let t=Number(this.context.settings["cursor-lerp"]);this.setLerpFactor(t)}setLerpFactor(r){this.smoothingFactor=this.context.tools.adaptiveLerp.process({value:r,inMin:.1,inMax:1,outMin:.05,outMax:.65})}};var At=class{constructor(){this.listeners={};this.stateEvents=new Set;this.lastPayloads={};this.stateEvents.add("screen:mobile"),this.stateEvents.add("screen:tablet"),this.stateEvents.add("screen:laptop"),this.stateEvents.add("screen:desktop"),this.stateEvents.add("start")}registerStateEvent(r,t){this.stateEvents.add(r),t!==void 0&&(this.lastPayloads[r]=t)}on(r,t,e){let i=e?`${r}:${e}`:r;this.listeners[i]||(this.listeners[i]=new Set),this.listeners[i].add(t),this.stateEvents.has(i)&&this.lastPayloads[i]!==void 0&&t(this.lastPayloads[i])}off(r,t,e){let i=e?`${r}:${e}`:r;this.listeners[i]&&this.listeners[i].delete(t)}emit(r,t){this.stateEvents.has(r)&&(this.lastPayloads[r]=t);let e=this.listeners[r];if(e)for(let i of e)i(t)}onProgress(r,t){this.on(`progress:${r}`,t)}emitProgress(r,t){this.emit(`progress:${r}`,t)}onInview(r,t){this.on(`object:inview:${r}`,t)}emitInview(r,t){this.emit(`object:inview:${r}`,t)}onScroll(r){this.on("scroll",r)}emitScroll(r){this.emit("scroll",r)}onUpdate(r){this.on("update",r)}emitUpdate(){this.emit("update")}clear(r){delete this.listeners[r]}clearAll(){this.listeners={}}};var ke=class{constructor(r){this.data=r;this.modules=[];this.uiModules=[];this.allModules=[]}register(r){if(r.type===1?this.modules.push(r):r.type===2&&this.uiModules.push(r),r.cssProperties&&r.cssProperties.length>0&&typeof window.CSS<"u"&&"registerProperty"in window.CSS)for(let t=0;t<r.cssProperties.length;t++)try{window.CSS.registerProperty(r.cssProperties[t])}catch{}r.onSubscribe(),this.rebuildAllModules()}find(r){for(let t=0;t<this.allModules.length;t++){let e=this.allModules[t];if(e instanceof r)return e}}onInit(){this.callAll("onInit")}onFrame(){this.callAll("onFrame")}onMutate(){this.callAll("onMutate")}onScrollMeasure(){this.callAll("onScrollMeasure")}onMouseMoveMeasure(){this.callAll("onMouseMoveMeasure")}onScroll(){this.callAll("onScroll")}onResizeWidth(){this.callAll("onResizeWidth")}onResize(){this.callAll("onResize")}onMouseMove(r){this.callAll("onMouseMove",r)}onWheel(r){this.callAll("onWheel",r)}onDirectionChange(){this.callAll("onDirectionChange")}onScrollStart(){this.callAll("onScrollStart")}onScrollStop(){this.callAll("onScrollStop")}onAxisChange(){this.callAll("onAxisChange")}onDeviceChange(){this.callAll("onDeviceChange")}onScrollConfigChange(){this.callAll("onScrollConfigChange")}onSettingsChange(r){this.callAll("onSettingsChange")}onDOMMutate(r,t){this.callAll("onDOMMutate",r,t)}destroy(){this.callAll("onUnsubscribe"),this.callAll("destroy"),this.modules=[],this.uiModules=[],this.allModules=[]}get all(){return this.allModules}get core(){return this.modules}get ui(){return this.uiModules}callAll(r,t,e){this.modules.length>0&&this.callLifecycleStrict(this.modules,r,t,e),this.uiModules.length>0&&this.callLifecycleStrict(this.uiModules,r,t,e)}callLifecycleStrict(r,t,e,i){let n=r.length;switch(t){case"onFrame":case"onMutate":case"onScrollMeasure":case"onMouseMoveMeasure":case"onScroll":for(let s=0;s<n;s++){let o=r[s];o&&o[t](this.data)}break;case"onDOMMutate":for(let s=0;s<n;s++){let o=r[s];o&&o[t](e,i)}break;case"onMouseMove":case"onWheel":for(let s=0;s<n;s++){let o=r[s];o&&o[t](e)}break;default:for(let s=0;s<n;s++){let o=r[s];o&&o[t]()}break}}rebuildAllModules(){this.allModules.length=0;for(let r=0;r<this.modules.length;r++)this.allModules.push(this.modules[r]);for(let r=0;r<this.uiModules.length;r++)this.allModules.push(this.uiModules[r])}};var De=class{constructor(r,t,e){this.parent=e;this.properties=new Map;this.id=r,this.htmlElement=t}get parentObject(){return this.parent}setProperty(r,t){this.properties.set(r,t)}getProperty(r){return this.properties.get(r)??null}setEasing(r){this.easingFn=r??void 0}getEasing(){return this.easingFn}applyProgress(r,t){let e=this.easingFn??t;return e?e(r):r}};var kt=class{constructor(r,t){this.id="";this.keys=[];this.tokens=[];this.mirrors=new Map;this._cachedMirrorObjects=[];this._cachedConnects=[];this._mirrorsDirty=!1;this.properties=new Map;this.modules=[];this.events=new At;this.eventNameCache=new Map;this.eventNameSuffixCache=new Map;this.htmlElement=t,this.id=r}getScopedEventName(r,t){if(t==null){let s=this.eventNameCache.get(r);if(s)return s;let o=`${r}:${this.id}`;return this.eventNameCache.set(r,o),o}let e=this.eventNameSuffixCache.get(r);e||(e=new Map,this.eventNameSuffixCache.set(r,e));let i=e.get(t);if(i)return i;let n=`${r}:${this.id}:${t}`;return e.set(t,n),n}setProperty(r,t){this.properties.set(r,t)}getProperty(r){return this.properties.get(r)??null}enter(){this.events.emit("enter",this),this.setProperty("active",!0),this.modules.forEach(r=>{r.enterObject(this.id,this)})}leave(){this.events.emit("leave",this),this.setProperty("active",!1),this.modules.forEach(r=>{r.exitObject(this.id)})}remove(){this.modules.forEach(r=>{r.removeObject(this.id)})}setInviewAutoBlocked(r){this.setProperty("inview-auto-blocked",r)}isInviewAutoBlocked(){return this.getProperty("inview-auto-blocked")===!0}setInviewManualActive(r){this.setProperty("inview-manual-active",r)}isInviewManualActive(){return this.getProperty("inview-manual-active")===!0}syncInviewClass(){if(this.isInviewAutoBlocked()){this.htmlElement.classList.remove("-inview");return}if(this.isInviewManualActive()){this.htmlElement.classList.add("-inview");return}if(this.getProperty("is-inview")===!0){this.htmlElement.classList.add("-inview");return}this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}show(){this.isInviewAutoBlocked()||this.htmlElement.classList.add("-inview")}hide(){if(this.isInviewAutoBlocked()){this.htmlElement.classList.remove("-inview");return}if(this.isInviewManualActive())return;this.getProperty("repeat")&&this.htmlElement.classList.remove("-inview")}connect(r){return this.modules.includes(r)?!1:(this.modules.push(r),!0)}disconnect(r){let t=this.modules.indexOf(r);return t===-1?!1:(this.modules.splice(t,1),!0)}isConnectedTo(r){return this.modules.includes(r)}setTokens(r){this.tokens=r,this.keys=r.map(t=>t.key)}getToken(r){for(let t=0;t<this.tokens.length;t++)if(this.tokens[t].key===r)return this.tokens[t];return null}updateMirrorsCache(){if(this._mirrorsDirty){this._cachedMirrorObjects=Array.from(this.mirrors.values());let r=this._cachedMirrorObjects.length;this._cachedConnects=new Array(r);for(let t=0;t<r;t++)this._cachedConnects[t]=this._cachedMirrorObjects[t].htmlElement;this._mirrorsDirty=!1}}addMirror(r){this.mirrors.has(r.id)||(this.mirrors.set(r.id,r),this._mirrorsDirty=!0)}removeMirror(r){this.mirrors.delete(r)&&(this._mirrorsDirty=!0)}get mirrorObjects(){return this.updateMirrorsCache(),this._cachedMirrorObjects}get connects(){return this.updateMirrorsCache(),this._cachedConnects}};var Dt=class{constructor(){this.readQueue=[];this.writeQueue=[];this.computeQueue=[];this.isProcessing=!1;this.pendingFrame=null;this.rectCache=new WeakMap;this.dimensionCache=new WeakMap}scheduleRead(r,t=0){this.readQueue.push({priority:t,execute:r}),this.scheduleFlush()}scheduleCompute(r,t=0){this.computeQueue.push({priority:t,execute:r}),this.scheduleFlush()}scheduleWrite(r,t=0){this.writeQueue.push({priority:t,execute:r}),this.scheduleFlush()}batchModuleInitialization(r){r.forEach(({module:t,object:e,element:i,attributes:n,globalId:s})=>{this.scheduleRead(()=>{let o=i.getBoundingClientRect();this.rectCache.set(i,o),this.dimensionCache.set(i,{width:i.offsetWidth||i.clientWidth||o.width,height:i.offsetHeight||i.clientHeight||o.height}),t.initializeObject(s,e,i,n)},1)}),r.forEach(({module:t,object:e,windowSize:i})=>{this.scheduleCompute(()=>{t.calculatePositions(e,i)},2)}),r.forEach(({module:t,object:e})=>{this.scheduleWrite(()=>{t.connectObject(e),t.addObject(e.id,e)},3)})}getCachedRect(r){return this.rectCache.get(r)}getCachedDimensions(r){return this.dimensionCache.get(r)}scheduleFlush(){this.pendingFrame!==null||this.isProcessing||(this.pendingFrame=requestAnimationFrame(()=>{this.flush()}))}flush(){this.isProcessing=!0,this.pendingFrame=null;let r=(t,e)=>e.priority-t.priority;try{[...this.readQueue].sort(r).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Read task error:",s)}}),this.readQueue=[],[...this.computeQueue].sort(r).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Compute task error:",s)}}),this.computeQueue=[],[...this.writeQueue].sort(r).forEach(n=>{try{n.execute()}catch(s){console.error("[DOMBatcher] Write task error:",s)}}),this.writeQueue=[]}finally{this.rectCache=new WeakMap,this.dimensionCache=new WeakMap,this.isProcessing=!1}}flushSync(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.flush()}clear(){this.pendingFrame!==null&&(cancelAnimationFrame(this.pendingFrame),this.pendingFrame=null),this.readQueue=[],this.writeQueue=[],this.computeQueue=[],this.rectCache=new WeakMap,this.dimensionCache=new WeakMap}};var Oe=class{constructor(){this.desktop={rebuild:{width:!0,height:!0,scrollHeight:!0}};this.mobile={rebuild:{width:!0,height:!0,scrollHeight:!0}}}};var ts=Object.freeze({}),C=class{constructor(r){this.cssProperties=[];this.objectMapOnPage=new Map;this.allObjectMapOnPage=new Map;this.objectsOnPage=[];this.allObjectsOnPage=[];this.objectMap=new Map;this.allObjectMap=new Map;this.objects=[];this.allObjects=[];this.htmlKey="";this.defaultModeScope="all";this._type=1;this.permissions=new Oe;this.tools=r.tools,this.data=r.data,this.settings=r.settings,this.events=r.events,this.centers=r.centers,this.hover=r.hover,this.objectManager=r.objectManager,this.attributesToMap=[{key:"active",type:"boolean",fallback:this.settings.active},{key:"fixed",type:"boolean",fallback:this.settings.fixed},{key:"outside-container",type:"boolean",fallback:this.settings["outside-container"]},{key:"repeat",type:"boolean",fallback:this.settings.repeat},{key:"self-disable",type:"boolean",fallback:this.settings["self-disable"]},{key:"abs",type:"boolean",fallback:this.settings.abs},{key:"key",type:"string",fallback:this.settings.key},{key:"offset-top",type:"dimension",fallback:this.settings["offset-top"]},{key:"offset-bottom",type:"dimension",fallback:this.settings["offset-bottom"]},{key:"offset-enter",type:"dimension",fallback:this.settings["offset-enter"]},{key:"offset-exit",type:"dimension",fallback:this.settings["offset-exit"]},{key:"inview-top",type:"dimension",fallback:this.settings["inview-top"]},{key:"inview-bottom",type:"dimension",fallback:this.settings["inview-bottom"]},{key:"start",type:"number",fallback:(t,e,i)=>{let n=i.top;return Math.floor(n)+this.data.scroll.transformedCurrent}},{key:"end",type:"number",fallback:(t,e,i)=>{let n=i.top,s=i.height;return n+s-this.data.scroll.transformedCurrent}},{key:"size",type:"number",fallback:(t,e,i)=>i.height},{key:"half-width",type:"number",fallback:(t,e,i)=>i.width/2},{key:"half-height",type:"number",fallback:(t,e,i)=>i.height/2},{key:"enter-el",type:"string",fallback:this.settings["enter-el"]},{key:"enter-vp",type:"string",fallback:this.settings["enter-vp"]},{key:"exit-el",type:"string",fallback:this.settings["exit-el"]},{key:"exit-vp",type:"string",fallback:this.settings["exit-vp"]}]}get type(){return this._type}get key(){return this.htmlKey}initializeObject(r,t,e,i){let n=this.tools.boundingClientRect.process({element:e});for(let{key:s,type:o,fallback:a,transform:l}of this.attributesToMap){let d=typeof a=="function"?a(e,t,n):a,c=i[s]??i[`string-${s}`]??i[`data-string-${s}`],p=this.tools.domAttribute.process({element:e,key:s,fallback:c??this.settings[s]??d}),g=this.parseAttribute(p,o,{element:e,boundingRect:n,viewportHeight:this.data.viewport.windowHeight,baseRem:this.data.viewport.baseRem});l&&(g=l(g)),t.setProperty(s,g)}this.cacheLayoutSnapshot(t,e)}cacheLayoutSnapshot(r,t){let e=this.data.scroll.container??document.body??document.documentElement,i=this.data.scroll.elementContainer??document.documentElement,n=this.tools.transformNullify.process({element:t}),s=window.getComputedStyle(t),o=this.getOffsetSize(t,s),a=0,l=0,d=n.width,c=n.height;if((!Number.isFinite(d)||d<=0)&&(d=o.width),(!Number.isFinite(c)||c<=0)&&(c=o.height),Number.isFinite(n.left)&&Number.isFinite(n.top)&&n.width>0&&n.height>0)if(e===document.body||e===document.documentElement)a=n.left+i.scrollLeft,l=n.top+i.scrollTop;else{let p=e.getBoundingClientRect();a=n.left-p.left+e.scrollLeft,l=n.top-p.top+e.scrollTop}else{let p=this.getOffsetChainPosition(t);if(e===document.body||e===document.documentElement)a=p.left,l=p.top;else{let g=this.getOffsetChainPosition(e);a=p.left-g.left+e.scrollLeft,l=p.top-g.top+e.scrollTop}}r.setProperty("layout-doc-left",a),r.setProperty("layout-doc-top",l),r.setProperty("layout-width",d),r.setProperty("layout-height",c),r.setProperty("layout-border-radius",s.borderRadius||"0px")}getOffsetSize(r,t){let e=parseFloat(t.width),i=parseFloat(t.height);return{width:r.offsetWidth||r.clientWidth||(Number.isFinite(e)?e:0),height:r.offsetHeight||r.clientHeight||(Number.isFinite(i)?i:0)}}getOffsetChainPosition(r){let t=0,e=0,i=r;for(;i;)t+=i.offsetLeft||0,e+=i.offsetTop||0,i=i.offsetParent;return{left:t,top:e}}calculatePositions(r,t){let e=r.getProperty("start"),i=r.getProperty("size"),n=r.getProperty("offset-enter")??r.getProperty("offset-bottom"),s=r.getProperty("offset-exit")??r.getProperty("offset-top"),o=r.getProperty("enter-el"),a=r.getProperty("enter-vp"),l=r.getProperty("exit-el"),d=r.getProperty("exit-vp"),c=-0,p=-0,g=-0,h=-0;o==="top"&&a==="top"||o==="left"&&a==="left"?(g=-t+1,c=e-n):o==="top"&&a==="bottom"||o==="left"&&a==="right"?c=e-t-n:o==="bottom"&&a==="top"||o==="right"&&a==="left"?(g=-t-i+1,c=e+i-n):(o==="bottom"&&a==="bottom"||o==="right"&&a==="right")&&(g=-i+1,c=e-t+i-n),l==="top"&&d==="top"||l==="left"&&d==="left"?(h=-i+1,p=e+s):l==="top"&&d==="bottom"||l==="left"&&d==="right"?(h=-t-i+1,p=e-t+s):l==="bottom"&&d==="top"||l==="right"&&d==="left"?p=e+i+s:(l==="bottom"&&d==="bottom"||l==="right"&&d==="right")&&(h=-t+1,p=e-t+i+s),r.setProperty("start-bias",g),r.setProperty("end-bias",h),r.setProperty("start-position",c-this.data.scroll.topPosition),r.setProperty("end-position",p-this.data.scroll.topPosition),r.setProperty("difference-position",p-c);let m=r.getProperty("inview-top")??-0,f=r.getProperty("inview-bottom")??-0;r.setProperty("inview-start-position",r.getProperty("start-position")+m),r.setProperty("inview-end-position",r.getProperty("end-position")+f)}parseAttribute(r,t,e=ts){if(r==null)return null;if(typeof t=="object"&&t.type==="enum")return t.values.includes(r)?r:t.values[0];switch(t){case"number":return typeof r=="string"?+r||parseFloat(r):r;case"boolean":return r===""||r==="true";case"json":try{return JSON.parse(r)}catch{return null}case"tuple":return r.trim().split(/\s+/);case"easing":return this.tools.easingFunction.process({easing:r});case"color":return this.tools.colorParser.process({value:r});case"dimension":return r=="0"?0:e.element!=null&&e.viewportHeight!=null&&e.baseRem!=null&&e.boundingRect!=null?this.tools.unitParser.process({value:r,element:e.element,viewportHeight:e.viewportHeight,boundingRect:e.boundingRect,baseRem:e.baseRem}):0;case"breakpoint-dimension":if(e.element!=null&&e.viewportHeight!=null&&e.baseRem!=null&&e.boundingRect!=null){let i=r.trim().split("|"),n=[];for(let s of i)if(s.includes(":")){let[o,a]=s.split(":");n.push({breakpoint:parseInt(o),value:this.tools.unitParser.process({value:`${a}|`,element:e.element,viewportHeight:e.viewportHeight,boundingRect:e.boundingRect,baseRem:e.baseRem})})}else n.push({breakpoint:0,value:this.tools.unitParser.process({value:s,element:e.element,viewportHeight:e.viewportHeight,boundingRect:e.boundingRect,baseRem:e.baseRem})});return n}default:return r}}canConnect(r){return r.keys.includes(this.htmlKey)}isTokenEnabledInCurrentMode(r){let t=this.data.scroll.mode;return r.modeSpec.kind==="all"?!0:r.modeSpec.kind==="include"?r.modeSpec.values.includes(t):this.defaultModeScope==="all"?!0:this.defaultModeScope.includes(t)}isObjectEnabledInCurrentMode(r){let t=r.getToken(this.htmlKey);return t?this.isTokenEnabledInCurrentMode(t):!1}disconnectObject(r){r.disconnect(this)}connectObject(r){r.connect(this)&&this.onObjectConnected(r)}enterObject(r,t){this.allObjectMap.has(r)||(this.allObjectMap.set(r,t),this.allObjects.push(t)),this.isObjectEnabledInCurrentMode(t)&&!this.objectMap.has(r)&&(this.objectMap.set(r,t),this.objects.push(t))}fastRemoveFromArray(r,t){if(t===-1)return;let e=r.length-1;t!==e&&(r[t]=r[e]),r.pop()}exitObject(r){let t=this.objectMap.get(r);if(t){this.objectMap.delete(r);let n=this.objects.indexOf(t);this.fastRemoveFromArray(this.objects,n)}let e=this.allObjectMap.get(r);if(!e)return;this.allObjectMap.delete(r);let i=this.allObjects.indexOf(e);this.fastRemoveFromArray(this.allObjects,i)}addObject(r,t){this.allObjectMapOnPage.has(r)||(this.allObjectMapOnPage.set(r,t),this.allObjectsOnPage.push(t)),this.isObjectEnabledInCurrentMode(t)&&!this.objectMapOnPage.has(r)&&(this.objectMapOnPage.set(r,t),this.objectsOnPage.push(t))}removeObject(r){let t=this.objectMapOnPage.get(r);if(t){this.objectMapOnPage.delete(r);let n=this.objectsOnPage.indexOf(t);this.fastRemoveFromArray(this.objectsOnPage,n)}let e=this.allObjectMapOnPage.get(r);if(!e)return;this.allObjectMapOnPage.delete(r);let i=this.allObjectsOnPage.indexOf(e);this.fastRemoveFromArray(this.allObjectsOnPage,i),this.exitObject(r),this.onObjectDisconnected(e)}onObjectConnected(r){}onObjectDisconnected(r){}get respectSelfDisable(){return!0}isPrimaryElementEnabled(r){return!this.respectSelfDisable||r.getProperty("self-disable")!==!0}applyToElementAndConnects(r,t,e=t){this.isPrimaryElementEnabled(r)&&t(r.htmlElement),r.mirrorObjects.forEach(i=>e(i.htmlElement,i))}applyVarToElement(r,t,e){this.isPrimaryElementEnabled(r)&&this.tools.styleTxn.setVar(r.htmlElement,t,e)}applyPropToElement(r,t,e){this.isPrimaryElementEnabled(r)&&this.tools.styleTxn.setProp(r.htmlElement,t,e)}applyVarToConnects(r,t,e){for(let i of r.mirrorObjects)this.tools.styleTxn.setVar(i.htmlElement,t,e)}applyPropToConnects(r,t,e){for(let i of r.mirrorObjects)this.tools.styleTxn.setProp(i.htmlElement,t,e)}getObjectEventName(r,t,e){return r.getScopedEventName(t,e)}clearManagedStyles(r){let t=i=>{for(let s=0;s<this.cssProperties.length;s++)i.style.removeProperty(this.cssProperties[s].name);let n=r.getProperty("key");typeof n=="string"&&n.length>0&&i.style.removeProperty(n)};t(r.htmlElement);let e=r.mirrorObjects;for(let i=0;i<e.length;i++)t(e[i].htmlElement)}onObjectModeActivated(r){}onObjectModeDeactivated(r){this.clearManagedStyles(r)}rebuildActiveObjectsForCurrentMode(){let r=new Map(this.objectMapOnPage);this.objectMapOnPage=new Map,this.objectsOnPage=[];for(let t=0;t<this.allObjectsOnPage.length;t++){let e=this.allObjectsOnPage[t];this.isObjectEnabledInCurrentMode(e)&&(this.objectMapOnPage.set(e.id,e),this.objectsOnPage.push(e))}this.objectMap=new Map,this.objects=[];for(let t=0;t<this.allObjects.length;t++){let e=this.allObjects[t];this.isObjectEnabledInCurrentMode(e)&&(this.objectMap.set(e.id,e),this.objects.push(e))}r.forEach((t,e)=>{this.objectMapOnPage.has(e)||this.onObjectModeDeactivated(t)}),this.objectMapOnPage.forEach((t,e)=>{r.has(e)||this.onObjectModeActivated(t)})}destroy(){this.objects=[],this.allObjects=[],this.objectMap=new Map,this.allObjectMap=new Map,this.objectsOnPage=[],this.allObjectsOnPage=[],this.objectMapOnPage=new Map,this.allObjectMapOnPage=new Map}onInit(){}onSubscribe(){}onUnsubscribe(){}onFrame(r){}onMutate(r){}onScrollMeasure(r){}onMouseMoveMeasure(r){}onResize(){}onResizeWidth(){}onScroll(r){}onDirectionChange(){}onScrollStart(){}onScrollStop(){}onScrollDirectionChange(){}onAxisChange(){}onDeviceChange(){}onScrollConfigChange(){this.rebuildActiveObjectsForCurrentMode()}onSettingsChange(){}onDOMRebuild(){}onMouseMove(r){}onWheel(r){}onDOMMutate(r,t){}};var Ie=class{constructor(r,t,e,i){this.data=r;this.modules=t;this.events=e;this.tools=i;this.objects=new Map;this.connectQueue=[];this.connectableModulesBuffer=[];this.mirrors=new Map;this.mirrorId=1;this.globalId=1;this.domBatcher=new Dt;this.domBatcherEnabled=!1;this.inviewStarts=[];this.inviewEnds=[];this.inviewActive=new Set;this.inviewStartIdx=0;this.inviewEndIdx=0;this.inviewIndexDirty=!0;this.lastInviewScrollPos=0;this.intersectionObserverEnabled=!0;this.domObserver=null}get all(){return this.objects}add(r){let t=`string-${this.globalId++}`,e="string-id";r.getAttribute("string-id")&&(t=r.getAttribute("string-id"),e="string-id"),r.getAttribute("data-string-id")&&(t=r.getAttribute("data-string-id"),e="data-string-id");let i=t&&this.objects.has(t)?this.objects.get(t):new kt(t,r);r.setAttribute(e,i.id);let n=r.getAttribute("string")??r.getAttribute("data-string");n&&i.setTokens(this.parseStringTokens(n)),r.setAttribute("string-inited",""),this.objects.set(i.id,i);let s=this.getAllAttributes(r),o=this.modules.core;for(let c=0;c<o.length;c++){let p=o[c];"setupCoreProperties"in p&&typeof p.setupCoreProperties=="function"&&p.setupCoreProperties(i,r,s)}let a=this.connectableModulesBuffer;a.length=0;let l=this.modules.all,d=null;for(let c=0;c<l.length;c++){let p=l[c];p instanceof C&&p.key===""&&(d=p),p instanceof C&&p.canConnect(i)&&a.push(p)}if(a.length===0&&d&&(i.setProperty("inview-fallback",!0),a.push(d)),this.domBatcherEnabled&&a.length>0){let c=new Array(a.length);for(let p=0;p<a.length;p++)c[p]={module:a[p],object:i,element:r,attributes:s,globalId:this.globalId,windowSize:this.data.viewport.windowHeight};this.domBatcher.batchModuleInitialization(c),this.domBatcher.scheduleWrite(()=>{this.initObservers(i,r),this.checkInviewForObject(i)})}else{for(let c=0;c<a.length;c++){let p=a[c];p.initializeObject(this.globalId,i,r,s),p.calculatePositions(i,this.data.viewport.windowHeight),p.connectObject(i),p.addObject(i.id,i)}this.initObservers(i,r),this.checkInviewForObject(i)}if(this.connectQueue.length>0){let c=0;for(let p=0;p<this.connectQueue.length;p++){let g=this.connectQueue[p];if(g.id===i.id){this.attachMirrorToObject(i,g.element);continue}this.connectQueue[c++]=g}this.connectQueue.length=c}a.length=0,this.inviewIndexDirty=!0}setDOMBatcherEnabled(r){this.domBatcherEnabled=r,r||this.domBatcher.flushSync()}setIntersectionObserverEnabled(r){if(this.intersectionObserverEnabled!==r){this.intersectionObserverEnabled=r;for(let t of this.objects.values())t.getProperty("observer-progress")?.disconnect(),r&&this.initObservers(t,t.htmlElement)}}attachModule(r){this.objects.forEach(t=>{if(!r.canConnect(t))return;let e=t.htmlElement,i=this.getAllAttributes(e);r.initializeObject(this.globalId,t,e,i),r.calculatePositions(t,this.data.viewport.windowHeight),r.connectObject(t),r.addObject(t.id,t),t.getProperty("active")===!0&&r.enterObject(t.id,t)})}refreshModuleConnectionsForCurrentMode(){let r=this.modules.all;for(let t of this.objects.values()){let e=t.htmlElement;if(!e||!e.isConnected)continue;let i=null;for(let n=0;n<r.length;n++){let s=r[n];if(!(s instanceof C)||!t.keys.includes(s.key))continue;let o=s.canConnect(t),a=t.isConnectedTo(s);if(o&&!a){i==null&&(i=this.getAllAttributes(e)),s.initializeObject(this.globalId,t,e,i),s.calculatePositions(t,this.data.viewport.windowHeight),s.connectObject(t),s.addObject(t.id,t),t.getProperty("active")===!0&&s.enterObject(t.id,t);continue}!o&&a&&(s.exitObject(t.id),s.removeObject(t.id),s.disconnectObject(t))}}}invalidateInviewIndex(){this.inviewIndexDirty=!0}refreshLayoutForRoot(r){if(!r)return;let t=new Set,e=n=>{let s=n.getAttribute("string-id")??n.getAttribute("data-string-id");if(!s)return;let o=this.objects.get(s);o&&t.add(o)};if(r instanceof HTMLElement){e(r);let n=r.querySelectorAll("[string-id],[data-string-id]");for(let s=0;s<n.length;s++)e(n[s])}if(t.size===0)return;let i=this.data.viewport.windowHeight;for(let n of t){let s=n.htmlElement;if(!s||!s.isConnected)continue;let o=this.getAllAttributes(s),a=this.modules.all;for(let l=0;l<a.length;l++){let d=a[l];d instanceof C&&d.canConnect(n)&&(d.initializeObject(this.globalId,n,s,o),d.calculatePositions(n,i))}}this.inviewIndexDirty=!0,this.checkInview()}remove(r){let t=this.objects.get(r);t&&(t.events.clearAll(),t.getProperty("observer-progress")?.disconnect(),t.getProperty("observer-inview")?.disconnect(),t.htmlElement.removeAttribute("string-inited"),t.leave(),t.remove(),t.mirrorObjects.forEach(e=>{let i=this.getMirrorIds(e.htmlElement);this.setMirrorIds(e.htmlElement,i.filter(s=>s!==e.id)),this.mirrors.delete(e.id);let n=e.htmlElement.getAttribute("string-copy-from")??e.htmlElement.getAttribute("data-string-copy-from");n&&this.enqueueConnection(n,e.htmlElement)}),this.objects.delete(r),this.inviewActive.delete(t),this.inviewIndexDirty=!0)}enqueueConnection(r,t){let e=this.splitPipeAndTrim(r);for(let i=0;i<e.length;i++){let n=e[i];this.connectQueue.some(s=>s.id===n&&s.element===t)||this.connectQueue.push({id:n,element:t})}}linkMirror(r,t){let e=this.splitPipeAndTrim(r);for(let i=0;i<e.length;i++){let n=e[i],s=this.objects.get(n);s?this.attachMirrorToObject(s,t):this.enqueueConnection(n,t)}}attachMirrorToObject(r,t){let e=this.getMirrorIds(t);for(let d of e){let c=this.mirrors.get(d);if(c&&c.parentObject===r)return c}let i=`string-mirror-${this.mirrorId++}`,n=new De(i,t,r);this.setMirrorIds(t,[...e,i]),r.addMirror(n),this.mirrors.set(i,n);let s=t.getAttribute("string-easing")??t.getAttribute("data-string-easing");s&&s.trim().length>0&&(n.setEasing(this.tools.easingFunction.process({easing:s})),n.setProperty("easing",s));let o=r.getProperty("key"),a=r.getProperty("progress-raw"),l=r.getProperty("progress-value");if(typeof a=="number"){let d=r.getProperty("easing")??void 0,c=n.applyProgress(a,d);n.setProperty("progress",c),o&&this.tools.styleTxn.setVar(n.htmlElement,o,c)}else typeof l=="number"&&(n.setProperty("progress",l),o&&this.tools.styleTxn.setVar(n.htmlElement,o,l));return n}detachMirrorByElement(r){let t=this.getMirrorIds(r);t.length!==0&&(t.forEach(e=>this.detachMirrorById(e)),this.clearMirrorIds(r))}detachMirrorById(r){let t=this.mirrors.get(r);t&&(t.parentObject.removeMirror(r),this.mirrors.delete(r))}getMirrorIds(r){let t=r.getAttribute("string-mirror-id")??r.getAttribute("data-string-mirror-id");return t?this.splitPipeAndTrim(t):[]}setMirrorIds(r,t){if(t.length===0){this.clearMirrorIds(r);return}r.setAttribute("string-mirror-id",t.join("|"))}clearMirrorIds(r){r.removeAttribute("string-mirror-id"),r.removeAttribute("data-string-mirror-id")}getAllAttributes(r){let t={},e=r.attributes;for(let i=0;i<e.length;i++){let n=e[i];t[n.name]=n.value}return t}initObservers(r,t){if(!this.intersectionObserverEnabled)return;let e=r.getProperty("offset-exit")??r.getProperty("offset-top")??0,i=r.getProperty("offset-enter")??r.getProperty("offset-bottom")??0;r.getProperty("observer-progress")?.disconnect();let n=g=>{g.forEach(h=>{this.events.emit(r.getScopedEventName("object:activate"),h.isIntersecting),h.isIntersecting?r.enter():r.leave()})},s=r.getProperty("outside-container"),o=t.getAttribute("string-outside-container")??t.getAttribute("data-string-outside-container"),a=o!=null?o.trim().toLowerCase():null,l=a===""||a==="true"||a==="1",d=s!=null?s===!0:l,c=this.data.scroll.container===document.body||d?null:this.data.scroll.container,p=new IntersectionObserver(n,{root:c,rootMargin:`${i+this.data.viewport.windowHeight}px 0px ${e+this.data.viewport.windowHeight}px 0px`,threshold:0});p.observe(t),r.setProperty("observer-progress",p)}observeDOM(){this.domObserver?.disconnect();let r=new MutationObserver(t=>{let e=!1;for(let i=0;i<t.length;i++){let n=t[i];if(n.type==="childList"){let s=!1;for(let o=0;o<n.removedNodes.length;o++){let a=n.removedNodes[o];if(a.nodeType!==Node.ELEMENT_NODE)continue;s=!0;let l=a;if(this.detachMirrorByElement(l),this.isFixed(l))continue;l.hasAttribute("string")&&this.handleRemoved(l);let d=l.querySelectorAll("[string],[data-string]");for(let p=0;p<d.length;p++){let g=d[p];this.isFixed(g)||this.handleRemoved(g)}let c=l.querySelectorAll("[string-copy-from],[data-string-copy-from]");for(let p=0;p<c.length;p++)this.detachMirrorByElement(c[p])}for(let o=0;o<n.addedNodes.length;o++){let a=n.addedNodes[o];if(a.nodeType!==Node.ELEMENT_NODE)continue;s=!0;let l=a;if(this.isFixed(l))continue;l.hasAttribute("string")&&!l.hasAttribute("string-inited")&&this.add(l);let d=l.querySelectorAll("[string]:not([string-inited]),[data-string]:not([string-inited])");for(let g=0;g<d.length;g++)this.add(d[g]);let c=l.getAttribute("string-copy-from")??l.getAttribute("data-string-copy-from");c&&this.linkMirror(c,l);let p=l.querySelectorAll("[string-copy-from],[data-string-copy-from]");for(let g=0;g<p.length;g++){let h=p[g],m=h.getAttribute("string-copy-from")??h.getAttribute("data-string-copy-from");m&&this.linkMirror(m,h)}}s&&(this.modules.onDOMMutate(n.addedNodes,n.removedNodes),e=!0)}}if(e){let i=this.modules.all;for(let n=0;n<i.length;n++)i[n].onDOMRebuild();this.events.emit("dom:changed",null)}});r.observe(document.body,{childList:!0,subtree:!0}),this.domObserver=r}handleRemoved(r){let t=r.getAttribute("string-id")??r.getAttribute("data-string-id");if(!t)return;let e=r.getAttribute("string-copy-from")??r.getAttribute("data-string-copy-from");e&&(this.connectQueue=this.connectQueue.filter(i=>i.id!==e)),this.remove(t)}onSettingsChange(r){for(let t of this.objects.values()){if(!t.htmlElement||!t.htmlElement.isConnected)continue;let e=null,i=this.modules.all;for(let n=0;n<i.length;n++){let s=i[n],o=!1;r.isDesktop?(s.permissions.desktop.rebuild.scrollHeight&&r.scrollHeightChanged&&(o=!0),s.permissions.desktop.rebuild.width&&r.widthChanged&&(o=!0),s.permissions.desktop.rebuild.height&&r.heightChanged&&(o=!0)):(s.permissions.mobile.rebuild.scrollHeight&&r.scrollHeightChanged&&(o=!0),s.permissions.mobile.rebuild.width&&r.widthChanged&&(o=!0),s.permissions.mobile.rebuild.height&&r.heightChanged&&(o=!0)),(o||r.isForceRebuild)&&s.canConnect(t)&&(e==null&&(e=this.getAllAttributes(t.htmlElement)),s.initializeObject(this.globalId,t,t.htmlElement,e),s.calculatePositions(t,this.data.viewport.windowHeight),s.connectObject(t))}}this.inviewIndexDirty=!0}isFixed(r){return r.hasAttribute("string-fixed")}checkInview(){let r=this.data.scroll.transformedCurrent;this.updateInviewWindow(r);for(let t of this.inviewActive)this.checkInviewForObject(t)}checkInviewForObject(r){let t=this.data.scroll.transformedCurrent;if(!this.intersectionObserverEnabled){let d=r.getProperty("start-position"),c=r.getProperty("end-position");if(d!=null&&c!=null){let p=Math.min(d,c),g=Math.max(d,c),h=r.getProperty("is-active")??!1,m=t>=p&&t<=g;m!==h&&(r.setProperty("is-active",m),this.events.emit(r.getScopedEventName("object:activate"),m),m?r.enter():r.leave())}}let e=r.getProperty("inview-start-position"),i=r.getProperty("inview-end-position"),n=r.getProperty("is-inview")??!1,s=Math.min(e,i),o=Math.max(e,i),a=t>=s&&t<=o,l=null;if(!n&&a){let d=Math.abs(t-s),c=Math.abs(o-t);l=d<=c?"enter-top":"enter-bottom"}else n&&!a&&(l=t<s?"exit-top":"exit-bottom");a!==n&&(r.setProperty("is-inview",a),r.setInviewAutoBlocked(!1),r.setInviewManualActive(!1),a?r.show():r.hide(),this.events.emit(r.getScopedEventName("object:inview"),{inView:a,direction:l}))}updateInviewWindow(r){let t=this.data.viewport.windowHeight,e=r-t,i=r+this.data.viewport.windowHeight+t;for((this.inviewIndexDirty||r<this.lastInviewScrollPos)&&this.rebuildInviewIndex(e,i);this.inviewStartIdx<this.inviewStarts.length&&this.inviewStarts[this.inviewStartIdx].pos<=i;)this.inviewActive.add(this.inviewStarts[this.inviewStartIdx].object),this.inviewStartIdx++;for(;this.inviewEndIdx<this.inviewEnds.length&&this.inviewEnds[this.inviewEndIdx].pos<e;)this.inviewActive.delete(this.inviewEnds[this.inviewEndIdx].object),this.inviewEndIdx++;this.lastInviewScrollPos=r}rebuildInviewIndex(r,t){this.inviewStarts=[],this.inviewEnds=[];for(let e of this.objects.values()){let i=e.getProperty("inview-start-position"),n=e.getProperty("inview-end-position");i==null||n==null||(this.inviewStarts.push({pos:Math.min(i,n),object:e}),this.inviewEnds.push({pos:Math.max(i,n),object:e}))}this.inviewStarts.sort((e,i)=>e.pos-i.pos),this.inviewEnds.sort((e,i)=>e.pos-i.pos),this.inviewActive.clear(),this.inviewStartIdx=this.upperBound(this.inviewStarts,t),this.inviewEndIdx=this.upperBound(this.inviewEnds,r-1);for(let e=0;e<this.inviewStartIdx;e++)this.inviewActive.add(this.inviewStarts[e].object);for(let e=0;e<this.inviewEndIdx;e++)this.inviewActive.delete(this.inviewEnds[e].object);this.inviewIndexDirty=!1}upperBound(r,t){let e=0,i=r.length;for(;e<i;){let n=e+i>>>1;r[n].pos<=t?e=n+1:i=n}return e}splitPipeAndTrim(r){let t=r.split("|"),e=[];for(let i=0;i<t.length;i++){let n=t[i].trim();n.length>0&&e.push(n)}return e}parseStringTokens(r){let t=this.splitTopLevelPipe(r),e=[];for(let i=0;i<t.length;i++){let n=t[i].trim();if(n.length===0)continue;let s=n.match(/^([^\[\]]+?)(?:\[([^\]]*)\])?$/);if(!s){e.push({raw:n,key:n,modeSpec:{kind:"default",values:[]}});continue}let o=s[1].trim(),a=s[2];if(!o)continue;if(a==null){e.push({raw:n,key:o,modeSpec:{kind:"default",values:[]}});continue}let l=a.trim();if(l.length===0){e.push({raw:n,key:o,modeSpec:{kind:"all",values:[]}});continue}let d=this.splitTopLevelPipe(l).map(c=>c.trim()).filter(c=>c.length>0);e.push({raw:n,key:o,modeSpec:d.length>0?{kind:"include",values:d}:{kind:"all",values:[]}})}return e}splitTopLevelPipe(r){let t=[],e="",i=0;for(let n=0;n<r.length;n++){let s=r[n];if(s==="["){i++,e+=s;continue}if(s==="]"){i=Math.max(0,i-1),e+=s;continue}if(s==="|"&&i===0){t.push(e),e="";continue}e+=s}return e.length>0&&t.push(e),t}destroy(){this.domObserver?.disconnect(),this.domObserver=null,this.domBatcher.clear()}};var K={SCROLL_FORWARD:"-scroll-forward",SCROLL_BACKWARD:"-scroll-backward",SCROLLING_FORWARD:"-scrolling-forward",SCROLLING_BACKWARD:"-scrolling-backward"};var et=class{constructor(r){this.name="";this.isProg=!1;this.isParallaxEnabled=!1;this._isVertical=!0;this._scrollDirState=-1;this._lastAppliedDirState=-1;this.isLastBottomScrollDirection=!0;this.scrollTriggerRules=[];this.isActive=!1;this.onChangeDirection=()=>{};this.onScrollStart=()=>{};this.onScrollStop=()=>{};this.document=document,this.context=r}set scrollDirection(r){this._isVertical=r==="vertical"}onCalcUpdate(){if(!this.isActive)return;let r=this.context.data.scroll.scrollContainer,t=this.context.data.scroll.current;r&&(this._isVertical?r.scrollTo(0,t):r.scrollTo(t,0)),this._isVertical&&this.triggerScrollRules()}onFrame(){}onWheel(r){}onScroll(r){}onTouchStart(r){}onTouchMove(r){}onTouchEnd(r){}disableScrollEvents(){}enableScrollEvents(){}activate(){this.isActive||(this.isActive=!0,this.enableScrollEvents())}deactivate(){if(!this.isActive)return;this.isActive=!1,this.disableScrollEvents(),this.isProg=!1;let r=this.context.data.scroll;r.target=r.current,r.delta=0,r.lerped=0,r.displacement=0,this.clearScrollingClasses(),this._scrollDirState=-1,this._lastAppliedDirState=-1,this.onScrollStop()}destroy(){}updateScrollDirection(r){this.isLastBottomScrollDirection=r;let t=r?1:0;if(this._scrollDirState===-1){this._scrollDirState=t;return}if(this._scrollDirState=t,this.context.data.scroll.isScrollingDown=r,this.onChangeDirection(),this.context.events.emit("scroll:direction:change",r),this.context.settings["global-class"]&&this._lastAppliedDirState!==t){let e=document.documentElement.classList;r?(e.remove(K.SCROLLING_BACKWARD,K.SCROLL_BACKWARD),e.add(K.SCROLLING_FORWARD,K.SCROLL_FORWARD)):(e.remove(K.SCROLLING_FORWARD,K.SCROLL_FORWARD),e.add(K.SCROLLING_BACKWARD,K.SCROLL_BACKWARD)),this._lastAppliedDirState=t}}clearScrollingClasses(){document.documentElement.classList.remove(K.SCROLLING_BACKWARD,K.SCROLLING_FORWARD,K.SCROLL_BACKWARD,K.SCROLL_FORWARD)}triggerScrollRules(){let r=this.scrollTriggerRules,t=r.length,e=this.context.data.scroll.current,i=this.isLastBottomScrollDirection;for(let n=0;n<t;n++){let s=r[n],a=(s.direction==="any"||i&&s.direction==="forward"||!i&&s.direction==="backward")&&e>=s.offset;a&&!s.isActive?(s.isActive=!0,s.onEnter?.(),s.toggleClass&&s.toggleClass.target.classList.add(s.toggleClass.className)):!a&&s.isActive&&(s.isActive=!1,s.onLeave?.(),s.toggleClass&&s.toggleClass.target.classList.remove(s.toggleClass.className))}}addScrollMark(r){this.scrollTriggerRules.push(r)}removeScrollMark(r){let t=this.scrollTriggerRules;for(let e=0;e<t.length;e++)if(t[e].id===r){t.splice(e,1);break}}scrollTo(r,t){}};var Re=class extends et{constructor(t){super(t);this.name="default";this.previousScrollTop=0;this.previousScrollTime=0;this.isScrolling=!1;this.lastScrollEventTime=0;this.nativeVelocity=0;this.nativeVelocityTarget=0;this.scrollStopDelay=120;this.nativeVelocityFollow=.2;this.nativeVelocityDecay=.84;this.nativeVelocityBoost=2;this.nativeVelocityDeadzone=.25}onFrame(){let t=0;if(this.context.data.scroll.delta!==0){let i=this.context.data.scroll.delta*this.context.data.scroll.speedAccelerate;this.context.data.scroll.delta-=i,t=i,Math.abs(t)<.1&&(this.context.data.scroll.delta=0,t=0)}let e=performance.now();this.nativeVelocityTarget*=this.nativeVelocityDecay,Math.abs(this.nativeVelocityTarget)<this.nativeVelocityDeadzone&&(this.nativeVelocityTarget=0),this.nativeVelocity+=(this.nativeVelocityTarget-this.nativeVelocity)*this.nativeVelocityFollow,Math.abs(this.nativeVelocity)<this.nativeVelocityDeadzone&&(this.nativeVelocity=0),Math.abs(this.nativeVelocity)>Math.abs(t)&&(t=this.nativeVelocity),this.context.data.scroll.lerped=t,this.isScrolling&&!(this.context.data.scroll.delta!==0||this.nativeVelocityTarget!==0||this.nativeVelocity!==0)&&e-this.lastScrollEventTime>this.scrollStopDelay&&(this.isScrolling=!1,this.onScrollStop(),this.clearScrollingClasses())}onScroll(t){let e=performance.now(),i=this.context.data.scroll.elementContainer.scrollTop,n=i-this.previousScrollTop;if(this.context.data.scroll.current=i,this.context.data.scroll.target=i,this.context.data.scroll.transformedCurrent=i*this.context.data.viewport.transformScale,n!==0){this.updateScrollDirection(n>0);let s=this.previousScrollTime===0?16.6667:e-this.previousScrollTime,o=n*(16.6667/Math.max(8,s))*this.nativeVelocityBoost;this.nativeVelocityTarget=o,this.previousScrollTop=i,this.previousScrollTime=e}this.triggerScrollRules(),this.lastScrollEventTime=e,this.isScrolling||(this.isScrolling=!0,this.onScrollStart())}onWheel(t){t.deltaY!==0&&(this.context.data.scroll.delta===0&&!this.isScrolling&&(this.isScrolling=!0,this.onScrollStart()),this.context.data.scroll.delta+=t.deltaY,this.lastScrollEventTime=performance.now())}deactivate(){super.deactivate(),this.isScrolling=!1,this.lastScrollEventTime=0,this.previousScrollTop=this.context.data.scroll.current,this.previousScrollTime=0,this.nativeVelocity=0,this.nativeVelocityTarget=0}scrollTo(t,e){this.context.data.scroll.target=t,this.context.data.scroll.current=t,this.context.data.scroll.delta=0,this.context.data.scroll.lerped=0,this.nativeVelocity=0,this.nativeVelocityTarget=0,this.previousScrollTop=t,this.previousScrollTime=0,this.triggerScrollRules(),this._scrollDirection==="vertical"?this.context.data.scroll.scrollContainer?.scrollTo({top:t,left:0,behavior:e?"auto":"smooth"}):this.context.data.scroll.scrollContainer?.scrollTo({left:t,top:0,behavior:e?"auto":"smooth"})}};var He=class extends et{constructor(t){super(t);this.name="disable";this.preventScroll=t=>{t.preventDefault()};this.preventKeyScroll=t=>{["ArrowUp","ArrowDown","PageUp","PageDown"," ","Home","End"].includes(t.key)&&t.preventDefault()};this.onPreventScroll=this.preventScroll.bind(this);this.onPreventKeyScroll=this.preventKeyScroll.bind(this)}enableScrollEvents(){window.addEventListener("touchmove",this.onPreventScroll,{passive:!1}),window.addEventListener("keydown",this.onPreventKeyScroll)}disableScrollEvents(){window.removeEventListener("touchmove",this.onPreventScroll),window.removeEventListener("keydown",this.onPreventKeyScroll)}onFrame(){}onWheel(t){t.preventDefault()}onScroll(t){t.preventDefault()}};var Be=class extends et{constructor(t){super(t);this.name="smooth";this.scrollForce=0;this.wheelImpulse=0;this.previousCurrent=0;this.velocityThreshold=.01;this.stepResult={current:.1,target:.1,delta:.1,lerped:.1,scrollForce:.1,absVelocity:.1};this.stepResult.current=0,this.stepResult.target=0,this.stepResult.delta=0,this.stepResult.lerped=0,this.stepResult.scrollForce=0,this.stepResult.absVelocity=0}stopScroll(){let t=this.context.data.scroll;t.lerped=0,t.delta=0,t.target=t.current,this.isProg=!1,this.onCalcUpdate(),this.clearScrollingClasses(),this._scrollDirState=-1,this._lastAppliedDirState=-1}onFrame(){let t=this.context.data.scroll;if(t.delta!==0){this.computeStep(t.current,t.target,t.delta,t.speed,t.speedAccelerate,t.bottomPosition,this.stepResult),this.scrollForce=this.stepResult.scrollForce,t.target=this.stepResult.target,t.delta=this.stepResult.delta,t.lerped=this.stepResult.lerped,t.current=this.stepResult.current;let e=this.context.data.viewport.transformScale;t.transformedCurrent=e!==1?t.current*e:t.current,this.updateScrollDirection(t.lerped>0),this.stepResult.absVelocity<this.velocityThreshold?(t.current=Math.round(t.target),this.previousCurrent=t.current,this.onCalcUpdate(),this.stopScroll(),this.onScrollStop()):(this.isProg=!0,this.previousCurrent!==t.current&&(this.previousCurrent=t.current,this.onCalcUpdate()))}}onWheel(t){if(t.deltaY!==0&&t.preventDefault(),this.wheelImpulse=t.deltaY,this.wheelImpulse===0)return;let e=this.context.data.scroll;e.delta===0&&this.onScrollStart();let i=this.wheelImpulse<0,n=e.target===0&&i,s=e.target===e.bottomPosition&&!i;!n&&!s&&(e.delta+=this.wheelImpulse)}onScroll(t){if(!this.isProg){let e=this.context.data.scroll,i=e.elementContainer.scrollTop,n=i-e.current;e.current=i,e.target=i,e.delta=0,e.lerped=n,e.displacement=0;let s=this.context.data.viewport.transformScale;e.transformedCurrent=s!==1?i*s:i,this.scrollForce=0,this.wheelImpulse=0,this.isProg=!1,this.previousCurrent=i,n!==0&&(this.updateScrollDirection(n>0),this.triggerScrollRules())}}deactivate(){super.deactivate(),this.scrollForce=0,this.wheelImpulse=0,this.previousCurrent=this.context.data.scroll.current}scrollTo(t,e){let i=this.context.data.scroll;if(e){i.current=t,i.target=t,i.delta=0,i.lerped=0;let n=this.context.data.viewport.transformScale;i.transformedCurrent=n!==1?t*n:t,this.onCalcUpdate();return}i.target=t,i.delta=1}computeStep(t,e,i,n,s,o,a){let l=i*s,d=Math.min(Math.max(0,e+l),o),c=(d-t)*n,p=i-l,g=t+c;a.current=g,a.target=d,a.delta=p,a.lerped=c,a.scrollForce=l,a.absVelocity=Math.abs(c)}};var _e=class{constructor(r){this.context=r;this.modes=new Map;this.boundEvents=null;this.scrollMarks=[];this.registerMode("smooth",new Be(r)),this.registerMode("default",new Re(r)),this.registerMode("disable",new He(r)),this.updateResponsiveMode()}registerMode(r,t){let e=this.context.data.scroll.mode===r,i=this.modes.get(r);i&&(e&&i.deactivate(),i.destroy()),t.name||(t.name=String(r)),this.modes.set(r,t),this.boundEvents&&(t.onScrollStart=this.boundEvents.onScrollStart,t.onScrollStop=this.boundEvents.onScrollStop,t.onChangeDirection=this.boundEvents.onDirectionChange),this.scrollMarks.length>0&&this.scrollMarks.forEach(n=>t.addScrollMark(n)),e&&t.activate()}setMobileMode(r){this.context.data.scroll.modeMobile=r,this.updateResponsiveMode()}setDesktopMode(r){this.context.data.scroll.modeDesktop=r,this.updateResponsiveMode()}updateResponsiveMode(){let t=window.innerWidth<1024?this.context.data.scroll.modeMobile:this.context.data.scroll.modeDesktop;this.setMode(t)}updatePosition(){this.get().onCalcUpdate()}setMode(r){if(!this.modes.has(r)){console.warn(`[ScrollManager] Unknown scroll mode: ${r}`);return}if(this.context.data.scroll.mode===r){this.get().activate();return}this.get().deactivate(),this.context.data.scroll.mode=r,this.get().activate(),this.boundEvents?.onModeChange()}get(){return this.modes.get(this.context.data.scroll.mode)}getEngines(){return this.modes}onFrame(){this.get().onFrame()}onScroll(r){this.get().onScroll(r)}onWheel(r){this.get().onWheel(r)}onTouchStart(r){this.get().onTouchStart(r)}onTouchMove(r){this.get().onTouchMove(r)}onTouchEnd(r){this.get().onTouchEnd(r)}bindEvents(r){this.boundEvents=r,this.modes.forEach(t=>{t.onScrollStart=r.onScrollStart,t.onScrollStop=r.onScrollStop,t.onChangeDirection=r.onDirectionChange})}addScrollMark(r){this.scrollMarks.push(r),this.modes.forEach(t=>{t.addScrollMark(r)})}removeScrollMark(r){this.scrollMarks=this.scrollMarks.filter(t=>t.id!==r),this.modes.forEach(t=>{t.removeScrollMark(r)})}destroy(){this.modes.forEach(r=>{r.deactivate(),r.destroy()})}};var Fe=class{constructor(){this.targetX=0;this.targetY=0;this.smoothedX=0;this.smoothedY=0;this.stepX=0;this.stepY=0;this.velocityX=0;this.velocityY=0}};var Ve=class{constructor(){this.threeInstance=null}};var We=class{constructor(){this.target=0;this.current=0;this.transformedCurrent=0;this.delta=0;this.lerped=0;this.displacement=0;this.isScrollingDown=!1;this.topPosition=0;this.bottomPosition=0;this.direction="vertical";this.elementContainer=document.documentElement;this.scrollContainer=window;this.container=document.body;this.mode="smooth";this.modeMobile="default";this.modeDesktop="smooth";this.speed=.1;this.speedAccelerate=.25}};var Ne=class{constructor(){this.fpsTracker=!1;this.positionTracker=!1;this.suppressMasonryResize=!1}};var ze=class{constructor(){this.now=0;this.previous=0;this.delta=0;this.elapsed=0}};var Ge=class{constructor(){this.windowWidth=0;this.windowHeight=0;this.contentWidth=0;this.contentHeight=0;this.scaleWidth=1;this.scaleHeight=1;this.transformScale=1;this.baseRem=16}};var Xt=class{constructor(){this.scroll=new We;this.viewport=new Ge;this.cursor=new Fe;this.render=new Ve;this.time=new ze;this.system=new Ne}};var qt=class{process({element:r}){return r.getBoundingClientRect()}};var Kt=class{process({element:r,key:t,fallback:e=null}){return r.getAttribute(`string-${t}`)??r.getAttribute(`data-string-${t}`)??e}};var Zt=class{process({record:r,name:t,fallback:e=null}){return r[t]??r[`data-${t}`]??e}};var Mt=class{process({element:r}){let t=r.getBoundingClientRect(),i=getComputedStyle(r).transform.match(/-?[\d.]+/g)?.map(parseFloat)??[];if(i.length===6){let[n,s,o,a,l,d]=i,c=n*a-s*o;return{width:t.width/(n||1),height:t.height/(a||1),left:(t.left*a-t.top*o+o*d-l*a)/c,top:(-t.left*s+t.top*n+l*s-n*d)/c}}return t}};var Qt=class{constructor(r=new Mt){this.transformTool=r}process({element:r,container:t=document.body}){let e;try{e=t.getBoundingClientRect()}catch{e=document.body.getBoundingClientRect()}let i=this.transformTool.process({element:r});return{top:i.top-e.top,left:i.left-e.left}}};var Jt=class{process({from:r,to:t,progress:e}){return(t-r)*e}};var te=class{process({value:r,element:t,viewportHeight:e,baseRem:i,boundingRect:n}){let s=r.split("|").map(a=>a.trim()).filter(Boolean),o=0;for(let a of s){let l=a,d=!1;l.startsWith("-")&&(d=!0,l=l.slice(1));let c=0;l==="selfHeight"?c=t.offsetHeight:l.endsWith("px")?c=parseFloat(l):l.endsWith("%")?c=parseFloat(l)/100*e:l.endsWith("rem")?c=parseFloat(l)*i:l.endsWith("sh")?c=parseFloat(l)*n.height/100:c=parseFloat(l),o+=d?-c:c}return o}};var ee=class{process({value:r,inMin:t=.1,inMax:e=1,outMin:i=.05,outMax:n=.65}){if(r<t)return n;if(r>1&&(r=1),r<=e){let s=(r-t)/(e-t);ret