@wix/interact 2.0.1 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -14
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react.js +2 -2
- package/dist/cjs/react.js.map +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/cjs/web.js.map +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +2 -2
- package/dist/es/web.js.map +1 -1
- package/dist/{index-BnI6W-7u.mjs → index-BfcN_rkn.mjs} +864 -838
- package/dist/index-BfcN_rkn.mjs.map +1 -0
- package/dist/index-HXLBEIjG.js +18 -0
- package/dist/index-HXLBEIjG.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/handlers/constants.d.ts +13 -0
- package/dist/types/handlers/constants.d.ts.map +1 -0
- package/dist/types/handlers/effectHandlers.d.ts +6 -0
- package/dist/types/handlers/effectHandlers.d.ts.map +1 -0
- package/dist/types/handlers/eventTrigger.d.ts +9 -0
- package/dist/types/handlers/eventTrigger.d.ts.map +1 -0
- package/dist/types/handlers/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +10 -0
- package/dist/types/types.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/package.json +3 -3
- package/dist/index-BnI6W-7u.mjs.map +0 -1
- package/dist/index-emAFXYqb.js +0 -18
- package/dist/index-emAFXYqb.js.map +0 -1
- package/dist/types/handlers/click.d.ts +0 -9
- package/dist/types/handlers/click.d.ts.map +0 -1
- package/dist/types/handlers/hover.d.ts +0 -9
- package/dist/types/handlers/hover.d.ts.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";function Qe(e){return[...e.matchAll(/\[([-\w]+)]/g)].map(([t,n])=>n)}function R(e,t){const n=Qe(t);let s=0;return n.length?e.replace(/\[]/g,()=>{const r=n[s++];return r!==void 0?`[${r}]`:"[]"}):e}class ue{animations;options;ready;isCSS;constructor(t,n){this.animations=t,this.options=n,this.ready=n?.measured||Promise.resolve(),this.isCSS=t[0]instanceof CSSAnimation}getProgress(){return this.animations[0]?.effect?.getComputedTiming().progress||0}async play(t){await this.ready;for(const n of this.animations)n.play();await Promise.all(this.animations.map(n=>n.ready)),t&&t()}pause(){for(const t of this.animations)t.pause()}async reverse(t){await this.ready;for(const n of this.animations)n.reverse();await Promise.all(this.animations.map(n=>n.ready)),t&&t()}progress(t){for(const n of this.animations){const{delay:s,duration:r,iterations:i}=n.effect.getTiming(),o=(Number.isFinite(r)?r:0)*(Number.isFinite(i)?i:1);n.currentTime=((s||0)+o)*t}}cancel(){for(const t of this.animations)t.cancel()}setPlaybackRate(t){for(const n of this.animations)n.playbackRate=t}async onFinish(t){try{await Promise.all(this.animations.map(s=>s.finished));const n=this.animations[0];if(n&&!this.isCSS){const s=n.effect?.target;if(s){const r=new Event("animationend");s.dispatchEvent(r)}}t()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}get finished(){return Promise.all(this.animations.map(t=>t.finished))}get playState(){return this.animations[0]?.playState}}const Xe=e=>e,Ue=e=>1-Math.cos(e*Math.PI/2),Je=e=>Math.sin(e*Math.PI/2),Ze=e=>-(Math.cos(Math.PI*e)-1)/2,et=e=>e**2,tt=e=>1-(1-e)**2,nt=e=>e<.5?2*e**2:1-(-2*e+2)**2/2,st=e=>e**3,it=e=>1-(1-e)**3,rt=e=>e<.5?4*e**3:1-(-2*e+2)**3/2,ot=e=>e**4,ct=e=>1-(1-e)**4,at=e=>e<.5?8*e**4:1-(-2*e+2)**4/2,ft=e=>e**5,lt=e=>1-(1-e)**5,ut=e=>e<.5?16*e**5:1-(-2*e+2)**5/2,dt=e=>e===0?0:2**(10*e-10),ht=e=>e===1?1:1-2**(-10*e),mt=e=>e===0?0:e===1?1:e<.5?2**(20*e-10)/2:(2-2**(-20*e+10))/2,gt=e=>1-Math.sqrt(1-e**2),vt=e=>Math.sqrt(1-(e-1)**2),pt=e=>e<.5?(1-Math.sqrt(1-4*e**2))/2:(Math.sqrt(-(2*e-3)*(2*e-1))+1)/2,yt=e=>2.70158*e**3-1.70158*e**2,Et=e=>1+2.70158*(e-1)**3+1.70158*(e-1)**2,wt=(e,t=1.70158*1.525)=>e<.5?(2*e)**2*((t+1)*2*e-t)/2:((2*e-2)**2*((t+1)*(e*2-2)+t)+2)/2,bt={linear:Xe,sineIn:Ue,sineOut:Je,sineInOut:Ze,quadIn:et,quadOut:tt,quadInOut:nt,cubicIn:st,cubicOut:it,cubicInOut:rt,quartIn:ot,quartOut:ct,quartInOut:at,quintIn:ft,quintOut:lt,quintInOut:ut,expoIn:dt,expoOut:ht,expoInOut:mt,circIn:gt,circOut:vt,circInOut:pt,backIn:yt,backOut:Et,backInOut:wt},ve={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",sineIn:"cubic-bezier(0.47, 0, 0.745, 0.715)",sineOut:"cubic-bezier(0.39, 0.575, 0.565, 1)",sineInOut:"cubic-bezier(0.445, 0.05, 0.55, 0.95)",quadIn:"cubic-bezier(0.55, 0.085, 0.68, 0.53)",quadOut:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",quadInOut:"cubic-bezier(0.455, 0.03, 0.515, 0.955)",cubicIn:"cubic-bezier(0.55, 0.055, 0.675, 0.19)",cubicOut:"cubic-bezier(0.215, 0.61, 0.355, 1)",cubicInOut:"cubic-bezier(0.645, 0.045, 0.355, 1)",quartIn:"cubic-bezier(0.895, 0.03, 0.685, 0.22)",quartOut:"cubic-bezier(0.165, 0.84, 0.44, 1)",quartInOut:"cubic-bezier(0.77, 0, 0.175, 1)",quintIn:"cubic-bezier(0.755, 0.05, 0.855, 0.06)",quintOut:"cubic-bezier(0.23, 1, 0.32, 1)",quintInOut:"cubic-bezier(0.86, 0, 0.07, 1)",expoIn:"cubic-bezier(0.95, 0.05, 0.795, 0.035)",expoOut:"cubic-bezier(0.19, 1, 0.22, 1)",expoInOut:"cubic-bezier(1, 0, 0, 1)",circIn:"cubic-bezier(0.6, 0.04, 0.98, 0.335)",circOut:"cubic-bezier(0.075, 0.82, 0.165, 1)",circInOut:"cubic-bezier(0.785, 0.135, 0.15, 0.86)",backIn:"cubic-bezier(0.6, -0.28, 0.735, 0.045)",backOut:"cubic-bezier(0.175, 0.885, 0.32, 1.275)",backInOut:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"};function St(e){return e==="percentage"?"%":e||"px"}function D(e){return e?ve[e]||e:ve.linear}function Tt(e){return e?bt[e]:void 0}class It{_animation;customEffect;progress;_tickCbId;_finishHandler;constructor(t,n,s,r){const i=new KeyframeEffect(n,[],{...s,composite:"add"}),{timeline:o}=r;this._animation=new Animation(i,o),this._tickCbId=null,this.progress=null,this.customEffect=c=>t(i.target,c),this._finishHandler=c=>{this.effect.target?.getAnimations().find(u=>u===this._animation)||this.cancel()},this.addEventListener("finish",this._finishHandler),this.addEventListener("remove",this._finishHandler)}_tick(){try{const t=this.effect?.getComputedTiming().progress??null;t!==this.progress&&(this.customEffect?.(t),this.progress=t),this._tickCbId=requestAnimationFrame(()=>{this._tick()})}catch(t){this._tickCbId=null,console.error(`failed to run customEffect! effectId: ${this.id}, error: ${t instanceof Error?t.message:t}`)}}get currentTime(){return this._animation.currentTime}set currentTime(t){this._animation.currentTime=t}get startTime(){return this._animation.startTime}set startTime(t){this._animation.startTime=t}get playbackRate(){return this._animation.playbackRate}set playbackRate(t){this._animation.playbackRate=t}get id(){return this._animation.id}set id(t){this._animation.id=t}get effect(){return this._animation.effect}set effect(t){this._animation.effect=t}get timeline(){return this._animation.timeline}set timeline(t){this._animation.timeline=t}get finished(){return this._animation.finished}get pending(){return this._animation.pending}get playState(){return this._animation.playState}get ready(){return this._animation.ready}get replaceState(){return this._animation.replaceState}get oncancel(){return this._animation.oncancel}set oncancel(t){this._animation.oncancel=t}get onfinish(){return this._animation.onfinish}set onfinish(t){this._animation.onfinish=t}get onremove(){return this._animation.onremove}set onremove(t){this._animation.onremove=t}play(){this._animation.play(),cancelAnimationFrame(this._tickCbId),this._tickCbId=requestAnimationFrame(()=>this._tick())}pause(){this._animation.pause(),cancelAnimationFrame(this._tickCbId),this._tickCbId=null}cancel(){this.removeEventListener("finish",this._finishHandler),this.removeEventListener("remove",this._finishHandler),this._animation.cancel(),this.customEffect(null),cancelAnimationFrame(this._tickCbId),this._tickCbId=null}commitStyles(){console.warn("CustomEffect animations do not support commitStyles method as they have no style to commit")}finish(){this._animation.finish()}persist(){this._animation.persist()}reverse(){this._animation.reverse()}updatePlaybackRate(t){this._animation.updatePlaybackRate(t)}addEventListener(t,n,s){this._animation.addEventListener(t,n,s)}removeEventListener(t,n,s){this._animation.removeEventListener(t,n,s)}dispatchEvent(t){return this._animation.dispatchEvent(t)}}function Ot(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var W={exports:{}},pe=W.exports,ye;function _t(){return ye||(ye=1,(function(e){(function(t){var n=function(){},s=t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||function(a){return setTimeout(a,16)};function r(){var a=this;a.reads=[],a.writes=[],a.raf=s.bind(t)}r.prototype={constructor:r,runTasks:function(a){for(var f;f=a.shift();)f()},measure:function(a,f){var d=f?a.bind(f):a;return this.reads.push(d),i(this),d},mutate:function(a,f){var d=f?a.bind(f):a;return this.writes.push(d),i(this),d},clear:function(a){return c(this.reads,a)||c(this.writes,a)},extend:function(a){if(typeof a!="object")throw new Error("expected object");var f=Object.create(this);return u(f,a),f.fastdom=this,f.initialize&&f.initialize(),f},catch:null};function i(a){a.scheduled||(a.scheduled=!0,a.raf(o.bind(null,a)))}function o(a){var f=a.writes,d=a.reads,v;try{n("flushing reads",d.length),a.runTasks(d),n("flushing writes",f.length),a.runTasks(f)}catch(m){v=m}if(a.scheduled=!1,(d.length||f.length)&&i(a),v)if(n("task errored",v.message),a.catch)a.catch(v);else throw v}function c(a,f){var d=a.indexOf(f);return!!~d&&!!a.splice(d,1)}function u(a,f){for(var d in f)f.hasOwnProperty(d)&&(a[d]=f[d])}var l=t.fastdom=t.fastdom||new r;e.exports=l})(typeof window<"u"?window:typeof pe<"u"?pe:globalThis)})(W)),W.exports}var kt=_t();const S=Ot(kt),re={};function Ct(e){Object.assign(re,e)}function xt(e){return e in re?re[e]:(console.warn(`${e} not found in registry. Please make sure to import and register the preset.`),null)}function k(e,t){return e?document.getElementById(e):null}function At(e,t){return e?.matches(`[data-motion-part~="${t}"]`)?e:e?.querySelector(`[data-motion-part~="${t}"]`)}function Lt(e){const t=e.alternate?"alternate":"";return e.reversed?`${t?`${t}-`:""}reverse`:t||"normal"}function ne(e){return`${e.value}${St(e.unit)}`}function Ee(e,t,n){return`${e.name||"cover"} ${n&&e.offset.unit!=="percentage"?`calc(100% + ${ne(e.offset)}${t?` + ${t}`:""})`:t?`calc(${ne(e.offset)} + ${t})`:ne(e.offset)}`}function Pt(e){return{start:Ee(e.startOffset,e.startOffsetAdd),end:Ee(e.endOffset,e.endOffsetAdd,!0)}}function Re(e){return t=>S.measure(()=>t(e))}function $e(e){return t=>S.mutate(()=>t(e))}function B(e){if(e.namedEffect){const t=e.namedEffect.type;return typeof t=="string"?xt(t):null}else if(e.keyframeEffect){const t=s=>{const{name:r,keyframes:i}=s.keyframeEffect;return[{...s,name:r,keyframes:i}]};return{web:t,style:t,getNames:s=>{const{effectId:r}=s,{name:i}=s.keyframeEffect,o=i||r;return o?[o]:[]}}}else if(e.customEffect)return t=>[{...t,keyframes:[]}];return null}function Rt(e,t,n){return e.map((s,r)=>{const i={fill:s.fill,easing:D(s.easing),iterations:s.iterations===0?1/0:s.iterations||1,composite:s.composite,direction:Lt(s)};return Fe(t)?(i.duration=s.duration,i.delay=s.delay||0):window.ViewTimeline&&t?.trigger==="view-progress"?i.duration="auto":(i.duration=99.99,i.delay=.01),{effect:s,options:i,id:n&&`${n}-${r+1}`,part:s.part}})}function Fe(e){return!e||e.trigger!=="pointer-move"&&e.trigger!=="view-progress"}function we(e,t,n,s,r){if(e){if(Fe(s)&&(t.duration=t.duration||1,r?.reducedMotion))if(t.iterations===1||t.iterations==null)t={...t,duration:1};else return[];let i;return n instanceof HTMLElement&&(i={measure:Re(n),mutate:$e(n)}),e.web?e.web(t,i,r):e(t,i,r)}return[]}function de(e,t,n,s,r){const i=e instanceof HTMLElement?e:k(e);if(n?.trigger==="pointer-move"&&!t.keyframeEffect){let d=t;t.customEffect&&(d={...t,namedEffect:{id:"",type:"CustomMouse"}});const v=B(d),m=we(v,t,i,n,s);return typeof m!="function"?null:m(i)}const o=B(t),c=we(o,t,i,n,s);if(!c||c.length===0)return null;const u=Rt(c,n,t.effectId);let l;const a=n?.trigger==="view-progress";a&&window.ViewTimeline&&(l=new ViewTimeline({subject:n.element||k(n.componentId)}));const f=u.map(({effect:d,options:v,id:m,part:h})=>{const g=h?At(i,h):i,y=new KeyframeEffect(g||null,[],v);S.mutate(()=>{"timing"in d&&y.updateTiming(d.timing),y.setKeyframes(d.keyframes)});const p=a&&l?{timeline:l}:{},w=typeof d.customEffect=="function"?new It(d.customEffect,g||null,v,p):new Animation(y,p.timeline);if(a)if(l)S.mutate(()=>{const{start:b,end:T}=Pt(d);w.rangeStart=b,w.rangeEnd=T,w.play()});else{const{startOffset:b,endOffset:T}=t;S.mutate(()=>{const C=d.startOffset||b,Z=d.endOffset||T;Object.assign(w,{start:{name:C.name,offset:C.offset?.value,add:d.startOffsetAdd},end:{name:Z.name,offset:Z.offset?.value,add:d.endOffsetAdd}})})}return m&&(w.id=m),w});return new ue(f,{...t,trigger:{...n||{}},measured:new Promise(d=>S.mutate(d))})}function $t(e,t,n){const s=B(t),r=e instanceof HTMLElement?e:k(e);if(s&&s.prepare&&r){const i={measure:Re(r),mutate:$e(r)};s.prepare(t,i)}n&&S.mutate(n)}function Ft(e,t){const n=B(t);if(!n)return null;if(!n.style)return t.effectId&&e?Mt(e,t.effectId):null;const s=n.getNames(t),i=(typeof e=="string"?k(e):e)?.getAnimations(),o=i?.map(u=>u.animationName)||[],c=[];return s.forEach(u=>{o.includes(u)&&c.push(i?.find(l=>l.animationName===u))}),c?.length?new ue(c):null}function Mt(e,t){const s=(typeof e=="string"?k(e):e)?.getAnimations().filter(r=>{const i=r.id||r.animationName;return i?i.startsWith(t):!0});return s?.length?new ue(s):null}function Me(e,t,n,s={}){const{disabled:r,allowActiveEvent:i,...o}=s,c=de(e,t,n,o);if(!c)return null;let u={};if(n.trigger==="view-progress"&&!window.ViewTimeline){const l=n.element||k(n.componentId),{ready:a}=c;return c.animations.map(f=>({get start(){return f.start},get end(){return f.end},viewSource:l,ready:a,getProgress(){return c.getProgress()},effect(d,v){const{activeDuration:m}=f.effect.getComputedTiming(),{delay:h}=f.effect.getTiming();f.currentTime=((h||0)+(m||0))*v},disabled:r,destroy(){f.cancel()}}))}else if(n.trigger==="pointer-move"){const l=t,{centeredToTarget:a,transitionDuration:f,transitionEasing:d}=l,v=n.axis;if(l.keyframeEffect){const m=c;return m.animations?.length===0?null:{target:void 0,centeredToTarget:a,ready:m.ready,_currentProgress:0,getProgress(){return this._currentProgress},effect(g,y){const p=v==="x"?y.x:y.y;this._currentProgress=p,m.progress(p)},disabled:r??!1,destroy(){m.cancel()}}}u={centeredToTarget:a,allowActiveEvent:i},t.customEffect&&f&&(u.transitionDuration=f,u.transitionEasing=Tt(d)),u.target=c.target}return{...u,getProgress(){return c.getProgress()},effect(l,a,f,d){c.progress(f?{...a,v:f,active:d}:a)},disabled:r,destroy(){c.cancel()}}}function he(e,t,n,s=!1){const r=Ft(e,t);return r?(r.ready=new Promise(i=>{$t(e,t,i)}),r):de(e,t,n,{reducedMotion:s})}function j(e,t){return t.includes("&")?t.replace(/&/g,e):`${e}${t}`}function qt(){return"wi-12343210".replace(/\d/g,e=>String.fromCharCode((+e^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+e/4)+97))}function Ht({key:e,effectId:t,transition:n,properties:s,childSelector:r="> :first-child",selectorCondition:i}){let o=[];if(n?.styleProperties){const{duration:m,easing:h,delay:g}=n;m&&(n.styleProperties.some(p=>p.name.startsWith("--"))?o=[`all ${m}ms ${D(h||"ease")}${g?` ${g}ms`:""}`,"visibility 0s"]:o=n.styleProperties.map(p=>`${p.name} ${m}ms ${D(h||"ease")}${g?` ${g}ms`:""}`)),s=n.styleProperties}else o=s?.filter(m=>m.duration).map(m=>`${m.name} ${m.duration}ms ${D(m.easing)||"ease"}${m.delay?` ${m.delay}ms`:""}`)||[];const c=s?.map(m=>`${m.name}: ${m.value};`)||[],u=e.replace(/"/g,"'"),l=`:is(:state(${t}), :--${t}) ${r}`,a=`[data-interact-effect~="${t}"] ${r}`,f=i?j(l,i):l,d=i?j(a,i):a,v=[`${f},
|
|
2
|
+
${d} {
|
|
3
|
+
${c.join(`
|
|
4
|
+
`)}
|
|
5
|
+
}`];if(o.length){const m=`[data-interact-key="${u}"] ${r}`,h=i?j(m,i):m;v.push(`@media (prefers-reduced-motion: no-preference) { ${h} {
|
|
6
|
+
transition: ${o.join(", ")};
|
|
7
|
+
} }`)}return v}function $(e,t){const n=(e||[]).filter(i=>t[i]?.type==="media"&&t[i].predicate).map(i=>t[i].predicate).join(") and ("),s=n&&`(${n})`;return s&&window.matchMedia(s)}function Q(e,t){for(const n of e||[]){const s=t[n];if(s?.type==="selector"&&s.predicate)return s.predicate}}const q={rangeStart:{name:"cover",offset:{value:0,unit:"percentage"}},rangeEnd:{name:"cover",offset:{value:100,unit:"percentage"}}};function zt(e,t){const n=e?.name??q.rangeStart.name,s=t?.name??e?.name??q.rangeEnd.name,r={name:n,offset:e?.offset||q.rangeStart.offset},i={name:s,offset:t?.offset||q.rangeEnd.offset};return{startOffset:r,endOffset:i}}function F(e){if("keyframeEffect"in e&&!e.keyframeEffect.name&&"effectId"in e&&(e.keyframeEffect.name=e.effectId),"duration"in e)return{id:"",...e};const{rangeStart:t,rangeEnd:n,...s}=e,{startOffset:r,endOffset:i}=zt(t,n);return{id:"",startOffset:r,endOffset:i,...s}}function I(e,t,n){let s=e.get(t);s||(s=new Set,e.set(t,s)),s.add(n)}function M(e,t){e.get(t)?.forEach(s=>{const{source:r,target:i,cleanup:o}=s;o();const c=r===t?i:r;e.get(c)?.delete(s)}),e.delete(t)}const Nt={root:null,rootMargin:"0px 0px -10% 0px",threshold:[0]},Vt={root:null,rootMargin:"0px",threshold:[0]},L={},X=new WeakMap,Y=new WeakSet,G=new WeakMap;let qe={},x=null;function Dt(e){qe=e}function He(e,t){X.get(e)?.forEach(({source:s,handler:r})=>{s===e&&r(t)})}function be(){return x||(x=new IntersectionObserver(e=>{e.forEach(t=>{const n=t.target;t.isIntersecting||He(n,!1)})},Vt),x)}function ze(e,t=!1){const n=JSON.stringify({...e,isSafeMode:t});if(L[n])return L[n];const s=t?Nt:{root:null,rootMargin:e.inset?`${e.inset} 0px ${e.inset}`:"0px",threshold:e.threshold},r=new IntersectionObserver(i=>{i.forEach(o=>{const c=o.target,u=!Y.has(c);if(u&&(Y.add(c),e.useSafeViewEnter&&!o.isIntersecting)){S.measure(()=>{const a=o.boundingClientRect.height,f=o.rootBounds?.height;if(!f)return;const d=Array.isArray(e.threshold)?Math.min(...e.threshold):e.threshold;d&&a*d>f&&S.mutate(()=>{r.unobserve(c);const m=ze(e,!0);G.set(c,m),m.observe(c)})});return}const l=e.type||"once";(o.isIntersecting||l==="alternate"&&!u)&&(He(c,o.isIntersecting),l==="once"&&(r.unobserve(o.target),Y.delete(c)))})},s);return L[n]=r,r}function Wt(e,t,n,s={},{reducedMotion:r,selectorCondition:i}={}){const o={...qe,...s},c=o.type||"once",u=he(t,F(n),void 0,r);if(!u)return;const l=ze(o);c!=="once"&&u.persist?.();let a=!0;const v={source:e,target:t,handler:m=>{i&&!t.matches(i)||(c==="once"?m&&u.play(()=>{const h=()=>{t.dataset.interactEnter="start"};u.isCSS?(S.mutate(()=>{requestAnimationFrame(h)}),u.onFinish(()=>{S.mutate(()=>{t.dataset.interactEnter="done"})})):S.mutate(h)}):c==="alternate"?a&&m?(a=!1,u.play()):a||u.reverse():c==="repeat"?m?(u.progress(0),u.play()):(u.pause(),u.progress(0)):c==="state"&&(m?u.play():u.pause()))},cleanup:()=>{(G.get(e)||l).unobserve(e),(c==="repeat"||c==="state")&&be().unobserve(e),u.cancel(),Y.delete(e),G.delete(e)}};I(X,e,v),I(X,t,v),G.set(e,l),l.observe(e),(c==="repeat"||c==="state")&&be().observe(e)}function jt(e){M(X,e)}function Yt(){x=null,Object.keys(L).forEach(e=>delete L[e])}const Se={add:Wt,remove:jt,setOptions:Dt,reset:Yt};function Ne(e,t){return Object.assign(Object.create(t),e)}function Gt(e,t,n,s){let r=e*(1-n)+t*n;if(s){const i=r-e;Math.abs(i)<s&&(r=e+s*Math.sign(i));const o=t-r;if(Math.abs(o)<s)return t}return r}function Kt(e){let t=!1;return function(){t||(t=!0,window.requestAnimationFrame(()=>{t=!1,e()}))}}function Te(e,t){let n=0;return function(){n&&window.clearTimeout(n),n=window.setTimeout(()=>{n=0,e()},t)}}function Bt(e,t){const n=e.match(/^calc\s*\(\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\+\s*(-?\d+((px)|([lsd]?vh)|([lsd]?vw)))\s*\)\s*$/);return U(n[1],t)+U(n[6],t)}function U(e,t){return e?/^-?\d+px$/.test(e)?parseInt(e):/^-?\d+[lsd]?vh$/.test(e)?parseInt(e)*t.viewportHeight/100:/^-?\d+[lsd]?vw$/.test(e)?parseInt(e)*t.viewportWidth/100:/^calc\s*\(\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\+\s*-?\d+((px)|([lsd]?vh)|([lsd]?vw))\s*\)\s*$/.test(e)?Bt(e,t):parseInt(e)||0:0}function O(e,t,n){const{name:s,offset:r=0}=e,{start:i,end:o}=n,c=o-i,u=r/100;let l,a;return s==="entry"?(l=i-t,a=Math.min(t,c)):s==="entry-crossing"?(l=i-t,a=c):s==="contain"?(l=Math.min(o-t,i),a=Math.abs(t-c)):s==="exit"?(l=Math.max(i,o-t),a=Math.min(t,c)):s==="exit-crossing"?(l=i,a=c):s==="cover"&&(l=i-t,a=c+t),l+u*a|0}function se(e,t,n,s,r){let i=0;const o={start:t,end:n};return e.forEach((c,u)=>{i+=c.offset;const l=c.sticky;if(l){if("end"in l&&e[u-1]?.element){const d=((r?c.element.offsetWidth:c.element.offsetHeight)||0)+l.end-s,v=i+d-c.offset,m=v<o.start,h=!m&&v<=n;let g=0;(m||h)&&(g=c.offset,o.end+=g),m&&(o.start+=g)}if("start"in l){const a=i-l.start,f=a<o.start,d=!f&&a<=o.end;let v=0;const m=e[u-1]?.element;if(m){if(f||d){const h=(r?m.offsetWidth:m.offsetHeight)||0,g=c.offset,y=(r?c.element.offsetWidth:c.element.offsetHeight)||0;v=h-(g+y),i+=v,o.end+=v}f&&(o.start+=v)}}}}),o}function Qt(e,t,n,s,r,i){const{start:o,end:c,duration:u}=e;let l=o,a=c,f=e.startRange,d=e.endRange,v;if(typeof u=="string"){f={name:u,offset:0},d={name:u,offset:100},l=O(f,n,t),a=O(d,n,t),v=a-l;const m=se(i,l,a,n,s);l=m.start,a=m.end}else{if(f||o?.name){f=f||o;const m=U(f.add,r),h=O({...f,offset:0},n,t),g=O({...f,offset:100},n,t),y=se(i,h,g,n,s);l=y.start+f.offset/100*(y.end-y.start)+m}if(d||c?.name){d=d||c;const m=U(d.add,r),h=O({...d,offset:0},n,t),g=O({...d,offset:100},n,t),y=se(i,h,g,n,s);a=y.start+d.offset/100*(y.end-y.start)+m}else typeof u=="number"&&(a=l+u)}return!v&&!u&&(v=a-l),{...e,start:l,end:a,startRange:f,endRange:d,duration:v||u}}function Xt(e){return e.position==="sticky"}function Ut(e,t,n){return e.position==="fixed"&&(!t||t===window.document.body||t===n)}function Jt(e,t){return parseInt(t?e.left:e.top)}function Zt(e,t){return parseInt(t?e.right:e.bottom)}function en(e,t,n){n&&(e.style.position="static");const s=(t?e.offsetLeft:e.offsetTop)||0;return n&&(e.style.position=null),s}function tn(e,t){let n;const s=Jt(e,t),r=Zt(e,t),i=!isNaN(s),o=!isNaN(r);return(i||o)&&(n={},i&&(n.start=s),o&&(n.end=r)),n}function H(e,t,n,s,r){const i=e[0].viewSource,o=[];let c=(s?i.offsetWidth:i.offsetHeight)||0,u=0,l=i;for(;l;){const f=window.getComputedStyle(l),d=Xt(f),v=d?tn(f,s):void 0,m=en(l,s,d);if((!v||!("end"in v))&&(u+=m),o.push({element:l,offset:m,sticky:v}),l=l.offsetParent,Ut(f,l,t))break;if(l===t){o.push({element:l,offset:0});break}}return o.reverse(),e.map(f=>({...Qt(f,{start:u,end:u+c},n,s,r,o)}))}const Ie=100,nn={horizontal:!1,observeViewportEntry:!0,viewportRootMargin:"7% 7%",observeViewportResize:!1,observeSourcesResize:!1,observeContentResize:!1};function sn(e,t,n,s){let r=0;return e>=t&&e<=n?r=s?(e-t)/s:1:e>n&&(r=1),r}function Oe(e,t){return e===window?t?window.document.documentElement.clientWidth:window.document.documentElement.clientHeight:t?e.clientWidth:e.clientHeight}function rn(){return{viewportWidth:window.document.documentElement.clientWidth,viewportHeight:window.document.documentElement.clientHeight}}function on(e){const t=Ne(e,nn),n=t.root,s=t.horizontal,r=new WeakMap;let i=Oe(n,s),o,c,u,l,a;const f=[],d=rn();if(t.scenes=Object.values(e.scenes.reduce((h,g,y)=>{const p=g.groupId?`group-${g.groupId}`:String(y);return h[p]?h[p].push(g):h[p]=[g],h},{})).flatMap(h=>(h.every(g=>g.viewSource&&(typeof g.duration=="string"||g.start?.name))?(h=H(h,n,i,s,d),(t.observeSourcesResize||t.observeContentResize)&&f.push(h)):h.forEach(g=>{g.end==null&&(g.end=g.start+g.duration),g.duration==null&&(g.duration=g.end-g.start)}),h)),t.scenes.forEach((h,g)=>{h.index=g}),f.length){const h=new Map;window.ResizeObserver&&(u=new window.ResizeObserver(function(g){g.forEach(y=>{const p=h.get(y.target),w=H(p,n,i,s,d);w.forEach((b,T)=>{t.scenes[b.index]=w[T]}),f.splice(f.indexOf(p),1,w)})}),f.forEach(g=>{u.observe(g[0].viewSource,{box:"border-box"}),h.set(g[0].viewSource,g)}),t.observeContentResize&&t.contentRoot&&new window.ResizeObserver(Te(()=>{const y=f.map(p=>{const w=H(p,n,i,s,d);return w.forEach((b,T)=>{t.scenes[b.index]=w[T]}),w});f.length=0,f.push(...y),f.forEach(p=>{h.set(p[0].viewSource,p)})},Ie)).observe(t.contentRoot,{box:"border-box"})),t.observeViewportResize&&(l=Te(function(){i=Oe(n,s);const g=f.map(y=>{const p=H(y,n,i,s,d);return p.forEach((w,b)=>{t.scenes[w.index]=p[b]}),p});f.length=0,f.push(...g),f.forEach(y=>{h.set(y[0].viewSource,y)})},Ie),n===window?window.addEventListener("resize",l):window.ResizeObserver&&(a=new window.ResizeObserver(l),a.observe(n,{box:"border-box"})))}t.observeViewportEntry&&window.IntersectionObserver&&(c=new window.IntersectionObserver(function(h){h.forEach(g=>{(r.get(g.target)||[]).forEach(y=>{y.disabled=!g.isIntersecting})})},{root:n===window?window.document:n,rootMargin:t.viewportRootMargin,threshold:0}),t.scenes.forEach(h=>{if(h.viewSource){let g=r.get(h.viewSource);g||(g=[],r.set(h.viewSource,g),c.observe(h.viewSource)),g.push(h)}}));function v({p:h,vp:g}){h=+h.toFixed(1);const y=+g.toFixed(4);if(h!==o){for(let p of t.scenes)if(!p.disabled){const{start:w,end:b,duration:T}=p,C=sn(h,w,b,T);p.effect(p,C,y)}o=h}}function m(){t.scenes.forEach(h=>h.destroy?.()),c&&(c.disconnect(),c=null),u&&(u.disconnect(),u=null),l&&(a?(a.disconnect(),a=null):window.removeEventListener("resize",l))}return{tick:v,destroy:m}}const cn={transitionActive:!1,transitionFriction:.9,transitionEpsilon:1,velocityActive:!1,velocityMax:1};class an{constructor(t={}){this.config=Ne(t,cn),this.progress={p:0,prevP:0,vp:0},this.currentProgress={p:0,prevP:0,vp:0},this._lerpFrameId=0,this.effect=null;const n=!this.config.root||this.config.root===window.document.body;this.config.root=n?window:this.config.root,this.config.contentRoot=this.config.contentRoot||(n?window.document.body:this.config.root.firstElementChild),this.config.resetProgress=this.config.resetProgress||this.resetProgress.bind(this),this._measure=this.config.measure||(()=>{const s=this.config.root;this.progress.p=this.config.horizontal?s.scrollX||s.scrollLeft||0:s.scrollY||s.scrollTop||0}),this._trigger=Kt(()=>{this._measure?.(),this.tick(!0)})}start(){this.setupEffect(),this.setupEvent(),this.resetProgress(),this.tick()}pause(){this.removeEvent()}resetProgress(t={}){const n=this.config.root,s=t.x||t.x===0?t.x:n.scrollX||n.scrollLeft||0,r=t.y||t.y===0?t.y:n.scrollY||n.scrollTop||0,i=this.config.horizontal?s:r;this.progress.p=i,this.progress.prevP=i,this.progress.vp=0,this.config.transitionActive&&(this.currentProgress.p=i,this.currentProgress.prevP=i,this.currentProgress.vp=0),t&&this.config.root.scrollTo(s,r)}tick(t){const n=this.config.transitionActive;n&&this.lerp();const s=n?this.currentProgress:this.progress;if(this.config.velocityActive){const r=s.p-s.prevP,i=r<0?-1:1;s.vp=Math.min(this.config.velocityMax,Math.abs(r))/this.config.velocityMax*i}this.effect.tick(s),n&&s.p!==this.progress.p&&(t&&this._lerpFrameId&&window.cancelAnimationFrame(this._lerpFrameId),this._lerpFrameId=window.requestAnimationFrame(()=>this.tick())),s.prevP=s.p}lerp(){this.currentProgress.p=Gt(this.currentProgress.p,this.progress.p,+(1-this.config.transitionFriction).toFixed(3),this.config.transitionEpsilon)}destroy(){this.pause(),this.removeEffect()}setupEvent(){this.removeEvent(),this.config.root.addEventListener("scroll",this._trigger)}removeEvent(){this.config.root.removeEventListener("scroll",this._trigger)}setupEffect(){this.removeEffect(),this.effect=on(this.config)}removeEffect(){this.effect&&this.effect.destroy(),this.effect=null}}const oe=new WeakMap;let Ve=()=>({});function fn(e){Ve=e}function ln(e,t,n,s,{reducedMotion:r}){if(r)return;const i={trigger:"view-progress",element:e},o=F(n);let c;if("ViewTimeline"in window){const l=de(t,o,i);l&&(l.play(),c=()=>{l.ready.then(()=>{l.cancel()})})}else{const l=Me(t,o,i);if(l){const a=Array.isArray(l)?l:[l],f=new an({viewSource:e,scenes:a,observeViewportEntry:!1,observeViewportResize:!1,observeSourcesResize:!0,root:document.body,...Ve()});c=()=>{f.destroy()},Promise.all(a.map(d=>d.ready||Promise.resolve())).then(()=>{f.start()})}}if(!c)return;const u={source:e,target:t,cleanup:c};I(oe,e,u),I(oe,t,u)}function un(e){M(oe,e)}const dn={add:ln,remove:un,registerOptionsGetter:fn};function _e(e,t,n){return Math.min(Math.max(e,n),t)}function ke(e){let t=!1;return function(){if(!t)return t=!0,window.requestAnimationFrame(()=>{t=!1,e()})}}function hn(e){let t=e,n=0,s=0;if(t.offsetParent)do n+=t.offsetLeft,s+=t.offsetTop,t=t.offsetParent;while(t);return{left:n,top:s,width:e.offsetWidth,height:e.offsetHeight}}function mn(){const e=window.devicePixelRatio;let t=!1;if(e===1)return!1;document.body.addEventListener("pointerdown",s=>{t=s.offsetX!==10},{once:!0});const n=new PointerEvent("pointerdown",{clientX:10});return document.body.dispatchEvent(n),t}function gn(){return new Promise(e=>{const t=window.scrollY;let n=!1,s;function r(){document.body.addEventListener("pointerdown",c=>{s===void 0?s=c.offsetY:n=c.offsetY===s},{once:!0});const o=new PointerEvent("pointerdown",{clientY:500});document.body.dispatchEvent(o)}function i(){window.scrollY!==t&&(window.removeEventListener("scroll",i),r(),e(n))}r(),window.addEventListener("scroll",i),window.scrollY>0&&window.scrollBy(0,-1)})}function vn(e){gn().then(t=>{e.fixRequired=t,t&&(window.addEventListener("scroll",e.scrollHandler),e.scrollHandler())})}let z=0;const K=new Set;function pn(){const e=n=>{for(let s of n.changedTouches)K.add(s.identifier)},t=n=>{for(let s of n.changedTouches)K.delete(s.identifier)};return document.addEventListener("touchstart",e,{passive:!0}),document.addEventListener("touchend",t,{passive:!0}),function(){K.clear(),document.removeEventListener("touchstart",e),document.removeEventListener("touchend",t)}}function yn(e,t){if("onscrollend"in window)return e.addEventListener("scrollend",t),function(){e.removeEventListener("scrollend",t)};let n=0,s;z||(s=pn()),z+=1;function r(i){clearTimeout(n),n=setTimeout(()=>{K.size?setTimeout(r,100):(t(i),n=0)},100)}return e.addEventListener("scroll",r),function(){e.removeEventListener("scroll",r),z-=1,z||s()}}function En(e,t,n){return{x(s){const r=e.left-n.x+e.width/2,i=r>=t.width/2,o=(i?r:t.width-r)*2,c=i?0:r-o/2;return(s-c)/o},y(s){const r=e.top-n.y+e.height/2,i=r>=t.height/2,o=(i?r:t.height-r)*2,c=i?0:r-o/2;return(s-c)/o}}}function wn(e,t){this.x=window.scrollX,this.y=window.scrollY,requestAnimationFrame(()=>e&&e(t))}function bn(e){e.rect.width=window.document.documentElement.clientWidth,e.rect.height=window.document.documentElement.clientHeight}function Sn(e){const t=new ResizeObserver(n=>{n.forEach(s=>{e.rect.width=s.borderBoxSize[0].inlineSize,e.rect.height=s.borderBoxSize[0].blockSize})});return t.observe(e.root,{box:"border-box"}),t}function Tn(e){let t=!1,n={x:e.rect.width/2,y:e.rect.height/2,vx:0,vy:0},s,r,i,o,c;const u={x:0,y:0};e.scenes.forEach(a=>{a.target&&a.centeredToTarget&&(a.transform=En(hn(a.target),e.rect,u),t=!0),e.root?r=Sn(e):(i=bn.bind(null,e),window.addEventListener("resize",i))}),s=function(a){for(let f of e.scenes)if(!f.disabled){const d=f.transform?.x(a.x)||a.x/e.rect.width,v=f.transform?.y(a.y)||a.y/e.rect.height,m=+_e(0,1,d).toPrecision(4),h=+_e(0,1,v).toPrecision(4),g={x:a.vx,y:a.vy};e.allowActiveEvent&&(a.active=d<=1&&v<=1&&d>=0&&v>=0),f.effect(f,{x:m,y:h},g,a.active)}Object.assign(n,a)},t&&(o=wn.bind(u,s,n),c=yn(document,o));function l(){e.scenes.forEach(a=>a.destroy?.()),c?.(),r?(r.disconnect(),r=null):(window.removeEventListener("resize",i),i=null),s=null,n=null}return{tick:s,destroy:l}}const In=1e3/60*3;let N;function On(){_.x=window.scrollX,_.y=window.scrollY}const _={x:0,y:0,scrollHandler:On,fixRequired:void 0};class _n{constructor(t={}){this.config={...t},this.effect=null,this._nextTick=null,this._nextTransitionTick=null,this._startTime=0;let n;this.config.transitionDuration?n=this.config.noThrottle?()=>this.transition():ke(()=>this.transition()):n=this.config.noThrottle?()=>(this.tick(),null):ke(()=>{this.tick()}),this.config.rect=this.config.root?{width:this.config.root.offsetWidth,height:this.config.root.offsetHeight}:{width:window.document.documentElement.clientWidth,height:window.document.documentElement.clientHeight},this.progress={x:this.config.rect.width/2,y:this.config.rect.height/2,vx:0,vy:0},this.previousProgress={...this.progress},this.currentProgress=null;const s=r=>{const i=this.config.root?r.offsetX:r.x,o=this.config.root?r.offsetY:r.y;this.progress.vx=i-this.progress.x,this.progress.vy=o-this.progress.y,this.progress.x=i,this.progress.y=o,this._nextTick=n()};if(this._pointerLeave=()=>{this.progress.active=!1,this.progress.vx=0,this.progress.vy=0,this._nextTick=n()},this._pointerEnter=()=>{this.progress.active=!0,this._nextTick=n()},this.config.root){N=typeof N=="boolean"?N:mn();const r=N?window.devicePixelRatio:1;typeof _.fixRequired>"u"&&vn(_),this._measure=i=>{if(i.target!==this.config.root){const o=new PointerEvent("pointermove",{bubbles:!0,cancelable:!0,clientX:i.x*r+_.x,clientY:i.y*r+_.y});i.stopPropagation(),this.config.root.dispatchEvent(o)}else s(i)}}else this._measure=s}start(){this.setupEffect(),this.setupEvent()}pause(){this.removeEvent()}tick(){this.effect.tick(this.progress)}transition(){const t=this.config.transitionDuration,n=this.config.transitionEasing||(o=>o),s=performance.now();let r=!1;const i=o=>{const c=(o-this._startTime)/t,u=n(Math.min(1,c));r&&(this.progress.vx=0,this.progress.vy=0,r=!1),this.currentProgress=Object.entries(this.progress).reduce((l,[a,f])=>(a==="active"?l[a]=f:l[a]=this.previousProgress[a]+(f-this.previousProgress[a])*u,l),this.currentProgress||{}),c<1&&(this._nextTransitionTick=requestAnimationFrame(i),r=o-this._startTime>In),this.effect.tick(this.currentProgress)};return this._startTime?(this._nextTransitionTick&&cancelAnimationFrame(this._nextTransitionTick),Object.assign(this.previousProgress,this.currentProgress),this._startTime=s,i(s)):this._startTime=s,this._nextTransitionTick}destroy(){this.pause(),this.removeEffect(),this._nextTick&&cancelAnimationFrame(this._nextTick),this._nextTransitionTick&&cancelAnimationFrame(this._nextTransitionTick)}setupEvent(){this.removeEvent();const t=this.config.root||window;t.addEventListener("pointermove",this._measure,{passive:!0}),this.config.eventSource&&this.config.eventSource.addEventListener("pointermove",this._measure,{passive:!0}),this.config.allowActiveEvent&&(t.addEventListener("pointerleave",this._pointerLeave,{passive:!0}),t.addEventListener("pointerenter",this._pointerEnter,{passive:!0}),this.config.eventSource&&(this.config.eventSource.addEventListener("pointerleave",this._pointerLeave,{passive:!0}),this.config.eventSource.addEventListener("pointerenter",this._pointerEnter,{passive:!0})))}removeEvent(){const t=this.config.root||window;t.removeEventListener("pointermove",this._measure),this.config.eventSource&&this.config.eventSource.removeEventListener("pointermove",this._measure),this.config.allowActiveEvent&&(t.removeEventListener("pointerleave",this._pointerLeave),t.removeEventListener("pointerenter",this._pointerEnter),this.config.eventSource&&(this.config.eventSource.removeEventListener("pointerleave",this._pointerLeave),this.config.eventSource.removeEventListener("pointerenter",this._pointerEnter)))}setupEffect(){this.removeEffect(),this.effect=Tn(this.config)}removeEffect(){this.effect&&this.effect.destroy(),this.effect=null}}const ce=new WeakMap;let De=()=>({});function kn(e){De=e}function Cn(e,t,n,s={},{reducedMotion:r}){if(r)return;const i={trigger:"pointer-move",element:e,axis:s.axis??"y"},o=Me(t,F(n),i);if(o){const c=Array.isArray(o)?o:[o],u=new _n({root:s.hitArea==="self"?e:void 0,scenes:c,...De()}),a={source:e,target:t,cleanup:()=>{u.destroy()}};I(ce,e,a),I(ce,t,a),Promise.all(c.map(f=>f.ready||Promise.resolve())).then(()=>{u.start()})}}function xn(e){M(ce,e)}const An={add:Cn,remove:xn,registerOptionsGetter:kn},ae=new WeakMap;function Ln(e,t,n,s,{reducedMotion:r,selectorCondition:i}){const o=he(t,F(n),void 0,r);if(!o)return;const c=()=>{i&&!t.matches(i)||o.play()},l={source:e,target:t,cleanup:()=>{o.cancel(),e.removeEventListener("animationend",c)}};I(ae,e,l),I(ae,t,l),e.addEventListener("animationend",c)}function Pn(e){M(ae,e)}const Rn={add:Ln,remove:Pn};function $n(e,t,n,s=!1,r,i){const o=he(e,F(t),void 0,s);if(!o)return null;let c=!0;const u=n.type||"alternate";return l=>{if(r&&!e.matches(r))return;const a=!i,f=i?.enter?.includes(l.type),d=i?.leave?.includes(l.type);if(f||a){u==="alternate"||u==="state"?c?(c=!1,o.play()):u==="alternate"?o.reverse():u==="state"&&(o.playState==="running"?o.pause():o.playState!=="finished"&&o.play()):(o.progress(0),delete e.dataset.interactEnter,o.isCSS&&o.onFinish(()=>{S.mutate(()=>{e.dataset.interactEnter="done"})}),o.play());return}d&&(u==="alternate"?o.reverse():u==="repeat"?(o.cancel(),S.mutate(()=>{delete e.dataset.interactEnter})):u==="state"&&o.playState==="running"&&o.pause())}}function Fn(e,t,{effectId:n,listContainer:s,listItemSelector:r},i,o,c){const u=!!s,l=i.method||"toggle",a=l==="toggle";return f=>{if(o&&!e.matches(o))return;const d=u?e.closest(`${s} > ${r||""}:has(:scope)`):void 0,v=!c,m=c?.enter?.includes(f.type),h=c?.leave?.includes(f.type);v?t.toggleEffect(n,l,d):(m&&t.toggleEffect(n,a?"add":l,d),h&&a&&t.toggleEffect(n,"remove",d))}}const fe=new WeakMap;function Ce(e,t){return n=>{const s=n;e.contains(s.relatedTarget)||t(s)}}function Mn(e){return t=>{const n=t;n.pointerType&&e(n)}}function qn(e){return t=>{const n=t;n.code==="Space"?(n.preventDefault(),e(n)):n.code==="Enter"&&e(n)}}const Hn={focusin:(e,t)=>Ce(e,t),focusout:(e,t)=>Ce(e,t),click:(e,t)=>Mn(t),keydown:(e,t)=>qn(t)};function zn(e,t,n){const s=Hn[e];return s?s(t,n):r=>n(r)}function Nn(e){return typeof e=="object"&&!Array.isArray(e)&&("enter"in e||"leave"in e)}function Vn(e){if(typeof e=="string")return{toggle:[e]};if(Array.isArray(e))return{toggle:[...e]};if(Nn(e)){const t=e.enter?[...e.enter]:[],n=e.leave?[...e.leave]:[];return{enter:t,leave:n}}return{}}function Dn(e){return!!(e.enter?.length||e.leave?.length)}function Wn(e){return Dn(e)?{enter:e.enter??[],leave:e.leave??[]}:void 0}function jn(e,t,n,s,{reducedMotion:r,targetController:i,selectorCondition:o}){const c=Vn(s.eventConfig),u=n.transition||n.transitionProperties,l=Wn(c);let a,f=!1;if(u?a=Fn(t,i,n,s,o,l):(a=$n(t,n,s,r,o,l),f=s.type==="once"),!a)return;const d=a,v=new AbortController;function m(y,p,w){const b=zn(p,e,d);y.addEventListener(p,b,{...w,signal:v.signal})}const g={source:e,target:t,cleanup:()=>{v.abort()}};if(I(fe,e,g),I(fe,t,g),l){const y=c.enter,p=c.leave;y.forEach(b=>{b==="focusin"&&(e.tabIndex=0),m(e,b,{passive:!0,once:f})}),(u?s.method==="toggle":s.type!=="once")&&p.forEach(b=>{if(b==="focusout"){m(e,b,{once:f});return}m(e,b,{passive:!0})})}else(c.toggle??[]).forEach(p=>{m(e,p,{once:f,passive:p!=="keydown"})})}function Yn(e){M(fe,e)}const A={add:jn,remove:Yn},le={click:["click"],activate:["click","keydown"],hover:{enter:["mouseenter"],leave:["mouseleave"]},interest:{enter:["mouseenter","focusin"],leave:["mouseleave","focusout"]}},xe={click:le.activate,hover:le.interest};function V(e){const t=le[e];return(n,s,r,i,o)=>{const c=o?.allowA11yTriggers&&e in xe?xe[e]:t;A.add(n,s,r,{...i,eventConfig:c},o??{})}}const P={viewEnter:Se,hover:{add:V("hover"),remove:A.remove},click:{add:V("click"),remove:A.remove},pageVisible:Se,animationEnd:Rn,viewProgress:dn,pointerMove:An,activate:{add:V("activate"),remove:A.remove},interest:{add:V("interest"),remove:A.remove}};function Gn(e){return e.replace(/\[([-\w]+)]/g,"[]")}class E{static defineInteractElement;dataCache;addedInteractions;mediaQueryListeners;listInteractionsCache;controllers;static forceReducedMotion=!1;static allowA11yTriggers=!0;static instances=[];static controllerCache=new Map;constructor(){this.dataCache={effects:{},conditions:{},interactions:{}},this.addedInteractions={},this.mediaQueryListeners=new Map,this.listInteractionsCache={},this.controllers=new Set}init(t,n){if(typeof window>"u"||!window.customElements)return;const s=n?.useCutsomElement??!!E.defineInteractElement;this.dataCache=Bn(t,s);const r=E.defineInteractElement?.();s&&r===!1?document.querySelectorAll("interact-element").forEach(i=>{i.connect()}):E.controllerCache.forEach((i,o)=>i.connect(o))}destroy(){for(const t of this.controllers)t.disconnect();for(const[,t]of this.mediaQueryListeners.entries())t.mql.removeEventListener("change",t.handler);this.mediaQueryListeners.clear(),this.addedInteractions={},this.listInteractionsCache={},this.controllers.clear(),this.dataCache={effects:{},conditions:{},interactions:{}},E.instances.splice(E.instances.indexOf(this),1)}setController(t,n){this.controllers.add(n),E.setController(t,n)}deleteController(t,n=!1){const s=E.controllerCache.get(t);this.clearInteractionStateForKey(t),this.clearMediaQueryListenersForKey(t),s&&n&&(this.controllers.delete(s),E.deleteController(t))}has(t){return!!this.get(t)}get(t){const n=Gn(t);return this.dataCache.interactions[n]}clearMediaQueryListenersForKey(t){for(const[n,s]of this.mediaQueryListeners.entries())s.key===t&&(s.mql.removeEventListener("change",s.handler),this.mediaQueryListeners.delete(n))}clearInteractionStateForKey(t){(this.get(t)?.interactionIds||[]).forEach(s=>{const r=R(s,t);delete this.addedInteractions[r]})}setupMediaQueryListener(t,n,s,r){this.mediaQueryListeners.has(t)||(n.addEventListener("change",r),this.mediaQueryListeners.set(t,{mql:n,handler:r,key:s}))}static create(t,n){const s=new E;return E.instances.push(s),s.init(t,n),s}static destroy(){E.controllerCache.forEach(t=>{t.disconnect()}),E.instances.length=0,E.controllerCache.clear()}static setup(t){t.scrollOptionsGetter&&P.viewProgress.registerOptionsGetter?.(t.scrollOptionsGetter),t.pointerOptionsGetter&&P.pointerMove.registerOptionsGetter?.(t.pointerOptionsGetter),t.viewEnter&&P.viewEnter.setOptions(t.viewEnter),t.allowA11yTriggers!==void 0&&(E.allowA11yTriggers=t.allowA11yTriggers)}static getInstance(t){return E.instances.find(n=>n.has(t))}static getController(t){return t?E.controllerCache.get(t):void 0}static setController(t,n){E.controllerCache.set(t,n)}static deleteController(t){E.controllerCache.delete(t)}static registerEffects=Ct}let Kn=0;function J(e,{asCombinator:t=!1,addItemFilter:n=!1,useFirstChild:s=!1}={}){if(e.listContainer){const r=`${n&&e.listItemSelector?` > ${e.listItemSelector}`:""}`;return e.selector?`${e.listContainer}${r} ${e.selector}`:`${e.listContainer}${r||" > *"}`}else if(e.selector)return e.selector;return s?t?"> :first-child":":scope > :first-child":""}function Bn(e,t=!1){const n=e.conditions||{},s={};return e.interactions?.forEach(r=>{const i=r.key,o=++Kn,{effects:c,...u}=r;if(!i){console.error(`Interaction ${o} is missing a key for source element.`);return}s[i]||(s[i]={triggers:[],effects:{},interactionIds:new Set,selectors:new Set});const l=Array.from(c);l.reverse();const a={...u,effects:l};s[i].triggers.push(a),s[i].selectors.add(J(a,{useFirstChild:t}));const f=a.listContainer;l.forEach(d=>{let v=d.key;if(!v&&d.effectId){const g=e.effects[d.effectId];g&&(v=g.key)}d.effectId||(d.effectId=qt()),v=v||i,d.key=v;const m=d.effectId;if(f&&d.listContainer&&(v!==i||d.listContainer!==f))return;const h=`${i}::${v}::${m}::${o}`;d.interactionId=h,s[i].interactionIds.add(h),v!==i&&(s[v]?s[v].effects[h]||(s[v].effects[h]=[],s[v].interactionIds.add(h)):s[v]={triggers:[],effects:{[h]:[]},interactionIds:new Set,selectors:new Set},s[v].effects[h].push({...u,effect:d}),s[v].selectors.add(J(d,{useFirstChild:t})))})}),{effects:e.effects||{},conditions:n,interactions:s}}function Ae(e,t,n){if(e.listContainer){const s=t.querySelector(e.listContainer);return s?e.selector?Array.from(s.querySelectorAll(e.selector)):Array.from(s.children):(console.warn(`Interact: No container found for list container "${e.listContainer}"`),[])}if(e.selector){const s=t.querySelectorAll(e.selector);if(s.length>0)return Array.from(s);console.warn(`Interact: No elements found for selector "${e.selector}"`)}return n?t.firstElementChild:t}function Le(e,t){return t.map(n=>e.selector?n.querySelector(e.selector):n).filter(Boolean)}function We(e,t,n,s,r,i,o,c){return[o?Le(e,o):Ae(e,n,s),c?Le(t,c):Ae(t,r,i)]}function je(e,t,n,s,r,i,o){const c=Array.isArray(s),u=Array.isArray(r);c?s.forEach((l,a)=>{const f=u?r[a]:r;f&&Pe(e,l,t.trigger,f,n,t.params,i,o)}):(u?r:[r]).forEach(a=>{Pe(e,s,t.trigger,a,n,t.params,i,o)})}function Ye(e,t,n,s,r){const i={},o=[];s.effects.forEach(c=>{const u=c.effectId,l={...n.dataCache.effects[u]||{},...c,effectId:u},a=l.key,f=R(c.interactionId,e);if(i[f]||n.addedInteractions[f]&&!r)return;const d=$(l.conditions||[],n.dataCache.conditions);if(d&&n.setupMediaQueryListener(f,d,e,()=>{t.update()}),!d||d.matches){i[f]=!0;const v=a&&R(a,e);let m;if(v){if(m=E.getController(v),!m)return;l.listContainer&&m.watchChildList(l.listContainer)}else m=t;const[h,g]=We(s,l,t.element,t.useFirstChild,m.element,m.useFirstChild,r);if(!h||!g)return;n.addedInteractions[f]=!0;const y=v||s.key,p=Q(l.conditions||[],n.dataCache.conditions);o.push([y,s,l,h,g,p,m.useFirstChild])}}),o.reverse().forEach(c=>{je(...c)})}function Ge(e,t,n,s,r){const i=n.get(e)?.effects||{},o=Object.keys(i),c=[];return o.forEach(u=>{const l=R(u,e);if(n.addedInteractions[l]&&!r)return;i[u].some(({effect:f,...d})=>{const v=$(d.conditions||[],n.dataCache.conditions);if(v&&!v.matches)return!1;const m=f.effectId,h={...n.dataCache.effects[m]||{},...f,effectId:m};if(s&&h.listContainer!==s)return!1;const g=$(h.conditions||[],n.dataCache.conditions);if(g&&n.setupMediaQueryListener(l,g,e,()=>{t.update()}),!g||g.matches){const y=d.key&&R(d.key,e),p=E.getController(y);if(!p)return!0;h.listContainer&&t.watchChildList(h.listContainer);const[w,b]=We(d,h,p.element,p.useFirstChild,t.element,t.useFirstChild,void 0,r);if(!w||!b)return!0;n.addedInteractions[l]=!0;const T=Q(h.conditions||[],n.dataCache.conditions);return c.push([e,d,h,w,b,T,t.useFirstChild]),!0}return!1})}),c.reverse().forEach(u=>{je(...u)}),o.length>0}function Pe(e,t,n,s,r,i,o,c){let u;if(r.transition||r.transitionProperties){const l={key:e,effectId:r.effectId,transition:r.transition,properties:r.transitionProperties,childSelector:J(r,{asCombinator:!0,addItemFilter:!0,useFirstChild:c}),selectorCondition:o};if(u=E.getController(e),!u)return;u.renderStyle(Ht(l))}P[n]?.add(t,s,r,i,{reducedMotion:E.forceReducedMotion,targetController:u,selectorCondition:o,allowA11yTriggers:E.allowA11yTriggers})}function Qn(e){const t=e.key,n=E.getInstance(t);if(!n)return console.warn(`No instance found for key: ${t}`),E.setController(t,e),!1;const{triggers:s=[]}=n?.get(t)||{},r=s.length>0;n.setController(t,e),s.forEach((o,c)=>{const u=$(o.conditions,n.dataCache.conditions);if(u){const l=`${t}::trigger::${c}`;n.setupMediaQueryListener(l,u,t,()=>{e.update()})}(!u||u.matches)&&(o.listContainer&&e.watchChildList(o.listContainer),Ye(t,e,n,o))});let i=!1;return n&&(i=Ge(t,e,n)),r||i}function Xn(e,t,n){const s=e.key,r=E.getInstance(s);if(r){const{triggers:i=[]}=r?.get(s)||{};i.forEach((o,c)=>{if(o.listContainer!==t)return;const u=$(o.conditions,r.dataCache.conditions);if(u){const l=`${s}::listTrigger::${t}::${c}`;r.setupMediaQueryListener(l,u,s,()=>{e.update()})}(!u||u.matches)&&Ye(s,e,r,o,n)}),Ge(s,e,r,t,n)}}function Un(e,t=!1){const n=e.key,s=E.getInstance(n);if(!s)return;const r=[...s.get(n)?.selectors.values()||[]].filter(Boolean).join(",");let i;r?(i=[...e.element.querySelectorAll(r)],e.useFirstChild||i.push(e.element)):i=[e.element],Ke(i),s.deleteController(n,t)}function Ke(e){const t=Object.values(P);for(const n of e)for(const s of t)s.remove(n)}const ie="interactEffect";class Be{element;key;connected;sheet;useFirstChild;_observers;constructor(t,n,s){this.element=t,this.key=n,this.connected=!1,this.sheet=null,this._observers=new WeakMap,this.useFirstChild=s?.useFirstChild??!1}connect(t){if(this.connected)return;const n=this.element.dataset.interactKey;if(t=t||this.key||n,!t){console.warn("Interact: No key provided");return}n!==t&&(n&&console.warn(`Interact: Key mismatch between element ${n} and parameter ${t}, updating element key`),this.element.dataset.interactKey=t),this.key=t,this.connected=Qn(this)}disconnect({removeFromCache:t=!1}={}){if((this.key||this.element.dataset.interactKey)&&Un(this,t),this.sheet){const s=document.adoptedStyleSheets.indexOf(this.sheet);document.adoptedStyleSheets.splice(s,1)}this._observers=new WeakMap,this.sheet=null,this.connected=!1}update(){this.disconnect(),this.connect()}renderStyle(t){if(!this.sheet)this.sheet=new CSSStyleSheet,this.sheet.replaceSync(t.join(`
|
|
8
|
+
`)),document.adoptedStyleSheets.push(this.sheet);else{let n=this.sheet.cssRules.length;for(const s of t)try{this.sheet.insertRule(s,n),n++}catch(r){console.error(r)}}}toggleEffect(t,n,s,r){if(s===null)return;if(!r&&this.element.toggleEffect){this.element.toggleEffect(t,n,s);return}const i=new Set(this.element.dataset[ie]?.split(" ")||[]);n==="toggle"?i.has(t)?i.delete(t):i.add(t):n==="add"?i.add(t):n==="remove"?i.delete(t):n==="clear"&&i.clear(),(s||this.element).dataset[ie]=Array.from(i).join(" ")}getActiveEffects(){const n=(this.element.dataset[ie]||"").trim();return n?n.split(/\s+/):[]}watchChildList(t){const n=this.element.querySelector(t);if(n){let s=this._observers.get(n);s||(s=new MutationObserver(this._childListChangeHandler.bind(this,t)),this._observers.set(n,s),s.observe(n,{childList:!0}))}}_childListChangeHandler(t,n){const s=this.key||this.element.dataset.interactKey,r=[],i=[];n.forEach(o=>{o.removedNodes.forEach(c=>{c instanceof HTMLElement&&r.push(c)}),o.addedNodes.forEach(c=>{c instanceof HTMLElement&&i.push(c)})}),Ke(r),s&&Xn(this,t,i)}}function Jn(e,t){new Be(e,t).connect()}function Zn(e){const t=E.getController(e);t&&t.disconnect({removeFromCache:!0})}const es=(e,t,n,s)=>{let i=`[data-interact-key="${e.replace(/"/g,"'")}"]`;const o=J(t,{asCombinator:!0,useFirstChild:s});return o&&(i=`${i} ${o}`),n&&(i=j(i,n)),i};function ts(e,t=!1){const n=[],s=new Set;return e.interactions.forEach(({key:r,selector:i,listContainer:o,listItemSelector:c,trigger:u,params:l,effects:a,conditions:f})=>{if(u==="viewEnter"){const v=l;(!v?.type||v.type==="once")&&a.forEach(h=>{const g=h?.effectId&&e.effects[h.effectId]||h,{key:y,selector:p,listContainer:w,listItemSelector:b,conditions:T}=g;if(!(!y||y===r)||!(!p&&!i||p===i)||!(!w&&!o||w===o)||!(!b&&!c||b===c))return;const me=e.conditions||{},ge=Q(T,me),ee=Q(f,me);if(!(!ge&&!ee||ge===ee))return;const te=es(r,g,ee,t);s.has(te)||(s.add(te),n.push(`@media (prefers-reduced-motion: no-preference) {
|
|
9
|
+
${te}:not([data-interact-enter]) {
|
|
10
|
+
visibility: hidden;
|
|
11
|
+
transform: none;
|
|
12
|
+
translate: none;
|
|
13
|
+
scale: none;
|
|
14
|
+
rotate: none;
|
|
15
|
+
}
|
|
16
|
+
}`))})}}),n.join(`
|
|
17
|
+
`)}exports.I=Be;exports.a=E;exports.b=Jn;exports.g=ts;exports.r=Zn;
|
|
18
|
+
//# sourceMappingURL=index-HXLBEIjG.js.map
|