@wix/motion 2.0.1-0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/motion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class w{animations;options;ready;isCSS;constructor(e,n){this.animations=e,this.options=n,this.ready=n?.measured||Promise.resolve(),this.isCSS=e[0]instanceof CSSAnimation}getProgress(){return this.animations[0]?.effect?.getComputedTiming().progress||0}async play(e){await this.ready;for(const n of this.animations)n.play();await Promise.all(this.animations.map(n=>n.ready)),e&&e()}pause(){for(const e of this.animations)e.pause()}async reverse(e){await this.ready;for(const n of this.animations)n.reverse();await Promise.all(this.animations.map(n=>n.ready)),e&&e()}progress(e){for(const n of this.animations){const{delay:i,duration:s,iterations:r}=n.effect.getTiming(),u=(Number.isFinite(s)?s:0)*(Number.isFinite(r)?r:1);n.currentTime=((i||0)+u)*e}}cancel(){for(const e of this.animations)e.cancel()}setPlaybackRate(e){for(const n of this.animations)n.playbackRate=e}async onFinish(e){try{await Promise.all(this.animations.map(i=>i.finished));const n=this.animations[0];if(n&&!this.isCSS){const i=n.effect?.target;if(i){const s=new Event("animationend");i.dispatchEvent(s)}}e()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}get finished(){return Promise.all(this.animations.map(e=>e.finished))}get playState(){return this.animations[0]?.playState}getTimingOptions(){return this.animations.map(e=>{const n=e.effect?.getTiming(),i=n?.delay??0,s=Number(n?.duration)||0,r=n?.iterations??1;return{delay:i,duration:s,iterations:r}})}}const P=t=>t,L=t=>1-Math.cos(t*Math.PI/2),j=t=>Math.sin(t*Math.PI/2),H=t=>-(Math.cos(Math.PI*t)-1)/2,W=t=>t**2,V=t=>1-(1-t)**2,B=t=>t<.5?2*t**2:1-(-2*t+2)**2/2,K=t=>t**3,J=t=>1-(1-t)**3,U=t=>t<.5?4*t**3:1-(-2*t+2)**3/2,X=t=>t**4,Y=t=>1-(1-t)**4,Q=t=>t<.5?8*t**4:1-(-2*t+2)**4/2,Z=t=>t**5,tt=t=>1-(1-t)**5,et=t=>t<.5?16*t**5:1-(-2*t+2)**5/2,nt=t=>t===0?0:2**(10*t-10),it=t=>t===1?1:1-2**(-10*t),st=t=>t===0?0:t===1?1:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,rt=t=>1-Math.sqrt(1-t**2),ot=t=>Math.sqrt(1-(t-1)**2),at=t=>t<.5?(1-Math.sqrt(1-4*t**2))/2:(Math.sqrt(-(2*t-3)*(2*t-1))+1)/2,ct=t=>2.70158*t**3-1.70158*t**2,ut=t=>1+2.70158*(t-1)**3+1.70158*(t-1)**2,ft=(t,e=1.70158*1.525)=>t<.5?(2*t)**2*((e+1)*2*t-e)/2:((2*t-2)**2*((e+1)*(t*2-2)+e)+2)/2,S={linear:P,sineIn:L,sineOut:j,sineInOut:H,quadIn:W,quadOut:V,quadInOut:B,cubicIn:K,cubicOut:J,cubicInOut:U,quartIn:X,quartOut:Y,quartInOut:Q,quintIn:Z,quintOut:tt,quintInOut:et,expoIn:nt,expoOut:it,expoInOut:st,circIn:rt,circOut:ot,circInOut:at,backIn:ct,backOut:ut,backInOut:ft},T={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 lt(t){return t==="percentage"?"%":t||"px"}function mt(t){return t?T[t]||t:T.linear}function Ot(t,e,n,i){const s=3*t,r=3*(n-t)-s,u=1-s-r,a=3*e,l=3*(i-e)-a,m=1-a-l,o=d=>((u*d+r)*d+s)*d,c=d=>((m*d+l)*d+a)*d,f=d=>(3*u*d+2*r)*d+s;function p(d){let h=d;for(let b=0;b<8;b++){const y=o(h)-d;if(Math.abs(y)<1e-7)return h;const I=f(h);if(Math.abs(I)<1e-6)break;h-=y/I}let v=0,g=1;for(h=(v+g)/2;g-v>1e-7;){const b=o(h);if(Math.abs(b-d)<1e-7)return h;d>b?v=h:g=h,h=(v+g)/2}return h}return d=>d<=0?0:d>=1?1:c(p(d))}function _t(t){const e=t.match(/^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/);if(!e)return;const n=parseFloat(e[1]),i=parseFloat(e[2]),s=parseFloat(e[3]),r=parseFloat(e[4]);if(![n,i,s,r].some(isNaN))return Ot(n,i,s,r)}function wt(t){const e=t.match(/^linear\((.+)\)$/);if(!e)return;const n=e[1].split(",").map(u=>u.trim()).filter(Boolean);if(n.length===0)return;const i=[];for(const u of n){const a=u.split(/\s+/),l=parseFloat(a[0]);if(isNaN(l))return;const m=[];for(let o=1;o<a.length;o++)if(a[o].endsWith("%")){const c=parseFloat(a[o])/100;if(isNaN(c))return;m.push(c)}m.length===0?i.push({output:l,pos:null}):m.length===1?i.push({output:l,pos:m[0]}):(i.push({output:l,pos:m[0]}),i.push({output:l,pos:m[1]}))}if(i.length===0)return;i[0].pos===null&&(i[0].pos=0),i[i.length-1].pos===null&&(i[i.length-1].pos=1);let s=0;for(;s<i.length;)if(i[s].pos===null){const u=s-1;let a=s;for(;a<i.length&&i[a].pos===null;)a++;const l=i[u].pos,m=i[a].pos,o=a-u;for(let c=u+1;c<a;c++)i[c].pos=l+(m-l)*(c-u)/o;s=a+1}else s++;for(let u=1;u<i.length;u++)i[u].pos<i[u-1].pos&&(i[u].pos=i[u-1].pos);const r=i;return u=>{if(u<=r[0].pos)return r[0].output;const a=r[r.length-1];if(u>=a.pos)return a.output;let l=0,m=r.length-1;for(;l<m-1;){const f=l+m>>>1;r[f].pos<=u?l=f:m=f}const o=r[l],c=r[m];return c.pos===o.pos?c.output:o.output+(c.output-o.output)*(u-o.pos)/(c.pos-o.pos)}}function C(t){if(!t)return;const e=S[t];return e||(_t(t)??wt(t)??S.linear)}class At extends w{animationGroups;delay;offset;offsetEasing;timingOptions;constructor(e,n={}){const i=e.flatMap(s=>[...s.animations]);super(i),this.animationGroups=e,this.delay=n.delay??0,this.offset=n.offset??0,this.offsetEasing=typeof n.offsetEasing=="function"?n.offsetEasing:C(n.offsetEasing)??P,this.timingOptions=this.animationGroups.map(s=>s.getTimingOptions().map(({delay:r,duration:u,iterations:a})=>({delay:r,duration:Number.isFinite(u)?u:0,iterations:Number.isFinite(a)?a:1}))),this.applyOffsets(),this.ready=Promise.all(e.map(s=>s.ready)).then(()=>{})}calculateOffsets(){const e=this.animationGroups.length;if(e<=1)return[0];const n=e-1;return Array.from({length:e},(i,s)=>this.offsetEasing(s/n)*n*this.offset|0)}applyOffsets(){const e=this.calculateOffsets(),n=this.getSequenceActiveDuration(e);this.animationGroups.forEach((i,s)=>{i.animations.forEach((r,u)=>{const a=r.effect;if(!a)return;const{delay:l,duration:m,iterations:o}=this.timingOptions[s][u],c=l+e[s],f=n-(c+m*o);a.updateTiming({delay:c+this.delay,endDelay:f})})})}getSequenceActiveDuration(e){const n=[];for(let i=0;i<this.timingOptions.length;i++){const s=this.timingOptions[i].reduce((r,u)=>{if(!u)return r;const{delay:a,duration:l,iterations:m}=u;return Math.max(r,a+l*m)},0);n.push(e[i]+s)}return Math.max(...n)}addGroups(e){if(e.length===0)return;const n=[...e].sort((i,s)=>s.index-i.index);for(const{index:i,group:s}of n){const r=Math.min(i,this.animationGroups.length);this.animationGroups.splice(r,0,s),this.timingOptions.splice(r,0,s.getTimingOptions());const u=[...s.animations],a=this.animationGroups.slice(0,r).reduce((l,m)=>l+m.animations.length,0);this.animations.splice(a,0,...u)}this.applyOffsets(),this.ready=Promise.all(this.animationGroups.map(i=>i.ready)).then(()=>{})}async onFinish(e){try{await Promise.all(this.animationGroups.map(n=>n.finished)),e()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}}class qt{_animation;customEffect;progress;_tickCbId;_finishHandler;constructor(e,n,i,s){const r=new KeyframeEffect(n,[],{...i,composite:"add"}),{timeline:u}=s;this._animation=new Animation(r,u),this._tickCbId=null,this.progress=null,this.customEffect=a=>e(r.target,a),this._finishHandler=a=>{this.effect.target?.getAnimations().find(l=>l===this._animation)||this.cancel()},this.addEventListener("finish",this._finishHandler),this.addEventListener("remove",this._finishHandler)}_tick(){try{const e=this.effect?.getComputedTiming().progress??null;e!==this.progress&&(this.customEffect?.(e),this.progress=e),this._tickCbId=requestAnimationFrame(()=>{this._tick()})}catch(e){this._tickCbId=null,console.error(`failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error?e.message:e}`)}}get currentTime(){return this._animation.currentTime}set currentTime(e){this._animation.currentTime=e}get startTime(){return this._animation.startTime}set startTime(e){this._animation.startTime=e}get playbackRate(){return this._animation.playbackRate}set playbackRate(e){this._animation.playbackRate=e}get id(){return this._animation.id}set id(e){this._animation.id=e}get effect(){return this._animation.effect}set effect(e){this._animation.effect=e}get timeline(){return this._animation.timeline}set timeline(e){this._animation.timeline=e}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(e){this._animation.oncancel=e}get onfinish(){return this._animation.onfinish}set onfinish(e){this._animation.onfinish=e}get onremove(){return this._animation.onremove}set onremove(e){this._animation.onremove=e}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(e){this._animation.updatePlaybackRate(e)}addEventListener(e,n,i){this._animation.addEventListener(e,n,i)}removeEventListener(e,n,i){this._animation.removeEventListener(e,n,i)}dispatchEvent(e){return this._animation.dispatchEvent(e)}}function kt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var A={exports:{}},N=A.exports,D;function St(){return D||(D=1,(function(t){(function(e){var n=function(){},i=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.msRequestAnimationFrame||function(o){return setTimeout(o,16)};function s(){var o=this;o.reads=[],o.writes=[],o.raf=i.bind(e)}s.prototype={constructor:s,runTasks:function(o){for(var c;c=o.shift();)c()},measure:function(o,c){var f=c?o.bind(c):o;return this.reads.push(f),r(this),f},mutate:function(o,c){var f=c?o.bind(c):o;return this.writes.push(f),r(this),f},clear:function(o){return a(this.reads,o)||a(this.writes,o)},extend:function(o){if(typeof o!="object")throw new Error("expected object");var c=Object.create(this);return l(c,o),c.fastdom=this,c.initialize&&c.initialize(),c},catch:null};function r(o){o.scheduled||(o.scheduled=!0,o.raf(u.bind(null,o)))}function u(o){var c=o.writes,f=o.reads,p;try{n("flushing reads",f.length),o.runTasks(f),n("flushing writes",c.length),o.runTasks(c)}catch(d){p=d}if(o.scheduled=!1,(f.length||c.length)&&r(o),p)if(n("task errored",p.message),o.catch)o.catch(p);else throw p}function a(o,c){var f=o.indexOf(c);return!!~f&&!!o.splice(f,1)}function l(o,c){for(var f in c)c.hasOwnProperty(f)&&(o[f]=c[f])}var m=e.fastdom=e.fastdom||new s;t.exports=m})(typeof window<"u"?window:typeof N<"u"?N:globalThis)})(A)),A.exports}var Tt=St();const E=kt(Tt),$={};function $t(t){Object.assign($,t)}function Pt(t){return t in $?$[t]:(console.warn(`${t} not found in registry. Please make sure to import and register the preset.`),null)}function O(t,e){return t?(e||document).getElementById(t):null}function Ct(t,e){return t?.matches(`[data-motion-part~="${e}"]`)?t:t?.querySelector(`[data-motion-part~="${e}"]`)}function zt(t){const e=t.alternate?"alternate":"";return t.reversed?`${e?`${e}-`:""}reverse`:e||"normal"}function k(t){return`${t.value}${lt(t.unit)}`}function R(t,e,n){return`${t.name||"cover"} ${n&&t.offset.unit!=="percentage"?`calc(100% + ${k(t.offset)}${e?` + ${e}`:""})`:e?`calc(${k(t.offset)} + ${e})`:k(t.offset)}`}function dt(t){return{start:R(t.startOffset,t.startOffsetAdd),end:R(t.endOffset,t.endOffsetAdd,!0)}}function ht(t){return e=>E.measure(()=>e(t))}function pt(t){return e=>E.mutate(()=>e(t))}function _(t){if(t.namedEffect){const e=t.namedEffect.type;return typeof e=="string"?Pt(e):null}else if(t.keyframeEffect){const e=i=>{const{name:s,keyframes:r}=i.keyframeEffect;return[{...i,name:s,keyframes:r}]};return{web:e,style:e,getNames:i=>{const{effectId:s}=i,{name:r}=i.keyframeEffect,u=r||s;return u?[u]:[]}}}else if(t.customEffect)return e=>[{...e,keyframes:[]}];return null}function gt(t,e,n){return t.map((i,s)=>{const r={fill:i.fill,easing:mt(i.easing),iterations:i.iterations===0?1/0:i.iterations||1,composite:i.composite,direction:zt(i)};return z(e)?(r.duration=i.duration,r.delay=i.delay||0):window.ViewTimeline&&e?.trigger==="view-progress"?r.duration="auto":(r.duration=99.99,r.delay=.01),{effect:i,options:r,id:n&&`${n}-${s+1}`,part:i.part}})}function z(t){return!t||t.trigger!=="pointer-move"&&t.trigger!=="view-progress"}function G(t,e,n,i,s){if(t){if(z(i)&&(e.duration=e.duration||1,s?.reducedMotion))if(e.iterations===1||e.iterations==null)e={...e,duration:1};else return[];let r;return n instanceof HTMLElement&&(r={measure:ht(n),mutate:pt(n)}),t.web?t.web(e,r,s):t(e,r,s)}return[]}function x(t,e,n,i,s){const r=t instanceof HTMLElement?t:O(t,s);if(n?.trigger==="pointer-move"&&!e.keyframeEffect){let f=e;e.customEffect&&(f={...e,namedEffect:{id:"",type:"CustomMouse"}});const p=_(f),d=G(p,e,r,n,i);return typeof d!="function"?null:d(r)}const u=_(e),a=G(u,e,r,n,i);if(!a||a.length===0)return null;const l=gt(a,n,e.effectId);let m;const o=n?.trigger==="view-progress";o&&window.ViewTimeline&&(m=new ViewTimeline({subject:n.element||O(n.componentId)}));const c=l.map(({effect:f,options:p,id:d,part:h})=>{const v=h?Ct(r,h):r,g=new KeyframeEffect(v||null,[],p);E.mutate(()=>{"timing"in f&&g.updateTiming(f.timing),g.setKeyframes(f.keyframes)});const b=o&&m?{timeline:m}:{},y=typeof f.customEffect=="function"?new qt(f.customEffect,v||null,p,b):new Animation(g,b.timeline);if(o)if(m)E.mutate(()=>{const{start:I,end:q}=dt(f);y.rangeStart=I,y.rangeEnd=q,y.play()});else{const{startOffset:I,endOffset:q}=e;E.mutate(()=>{const F=f.startOffset||I,M=f.endOffset||q;Object.assign(y,{start:{name:F.name,offset:F.offset?.value,add:f.startOffsetAdd},end:{name:M.name,offset:M.offset?.value,add:f.endOffsetAdd}})})}return d&&(y.id=d),y});return new w(c,{...e,trigger:{...n||{}},measured:new Promise(f=>E.mutate(f))})}function xt(t,e){return t?`#${t}${e?`[data-motion-part~="${e}"]`:""}`:""}function Ft(t,e){const{duration:n,delay:i,iterations:s=1,fill:r,easing:u="linear",direction:a}=t.options,l=t.effect.name,m=n==="auto";return`${l} ${m?"auto":`${n}ms`}${m?" ":` ${i||1}ms `}${u}${r&&r!=="none"?` ${r}`:""} ${!s||s===1/0?"infinite":s}${a==="normal"?"":` ${a}`} ${e?"":"paused"}`}function Mt(t,e,n){return t?.style?(z(n)&&(e.duration=e.duration||1),t.style(e)):[]}function Nt(t,e,n){const i=_(e),s=Mt(i,e),r=gt(s,n,e.effectId),u=n?.trigger==="view-progress";return r.map((a,l)=>{const{start:m,end:o}=u?dt(a.effect):{};return{target:xt(t,a.part),animation:Ft(a,u),composition:a.options.composite,custom:a.effect.custom,name:a.effect.name,keyframes:a.effect.keyframes,id:a.id&&`${a.id}-${l+1}`,animationTimeline:u?`--${n?.id}`:"",animationRange:m||o?`${m} ${o}`:""}})}function bt(t,e,n){const i=_(e),s=t instanceof HTMLElement?t:O(t);if(i&&i.prepare&&s){const r={measure:ht(s),mutate:pt(s)};i.prepare(e,r)}n&&E.mutate(n)}function yt(t,e){const n=_(e);if(!n)return null;if(!n.style)return e.effectId&&t?vt(t,e.effectId):null;const i=n.getNames(e),r=(typeof t=="string"?O(t):t)?.getAnimations(),u=r?.map(l=>l.animationName)||[],a=[];return i.forEach(l=>{u.includes(l)&&a.push(r?.find(m=>m.animationName===l))}),a?.length?new w(a):null}function vt(t,e){const i=(typeof t=="string"?O(t):t)?.getAnimations().filter(s=>{const r=s.id||s.animationName;return r?r.startsWith(e):!0});return i?.length?new w(i):null}function Dt(t,e,n,i={}){const{disabled:s,allowActiveEvent:r,...u}=i,a=x(t,e,n,u);if(!a)return null;let l={};if(n.trigger==="view-progress"&&!window.ViewTimeline){const m=n.element||O(n.componentId),{ready:o}=a;return a.animations.map(c=>({get start(){return c.start},get end(){return c.end},viewSource:m,ready:o,getProgress(){return a.getProgress()},effect(f,p){const{activeDuration:d}=c.effect.getComputedTiming(),{delay:h}=c.effect.getTiming();c.currentTime=((h||0)+(d||0))*p},disabled:s,destroy(){c.cancel()}}))}else if(n.trigger==="pointer-move"){const m=e,{centeredToTarget:o,transitionDuration:c,transitionEasing:f}=m,p=n.axis;if(m.keyframeEffect){const d=a;return d.animations?.length===0?null:{target:void 0,centeredToTarget:o,ready:d.ready,_currentProgress:0,getProgress(){return this._currentProgress},effect(v,g){const b=p==="x"?g.x:g.y;this._currentProgress=b,d.progress(b)},disabled:s??!1,destroy(){d.cancel()}}}l={centeredToTarget:o,allowActiveEvent:r},e.customEffect&&c&&(l.transitionDuration=c,l.transitionEasing=C(f)),l.target=a.target}return{...l,getProgress(){return a.getProgress()},effect(m,o,c,f){a.progress(c?{...o,v:c,active:f}:o)},disabled:s,destroy(){a.cancel()}}}function Et(t,e,n,i=!1){const s=yt(t,e);return s?(s.ready=new Promise(r=>{bt(t,e,r)}),s):x(t,e,n,{reducedMotion:i})}function Rt(t){return t===null?[null]:typeof t=="string"?Array.from(document.querySelectorAll(t)):Array.isArray(t)?t:[t]}function It(t,e){const n=[];for(const{target:i,options:s}of t){const r=Rt(i);for(const u of r){const a=Et(u,s,void 0,e?.reducedMotion);a instanceof w&&n.push(a)}}return n}function Gt(t,e,n){const i=It(e,n);return new At(i,t)}exports.backIn=ct;exports.backInOut=ft;exports.backOut=ut;exports.circIn=rt;exports.circInOut=at;exports.circOut=ot;exports.createAnimationGroups=It;exports.cssEasings=T;exports.cubicIn=K;exports.cubicInOut=U;exports.cubicOut=J;exports.expoIn=nt;exports.expoInOut=st;exports.expoOut=it;exports.getAnimation=Et;exports.getCSSAnimation=Nt;exports.getCssUnits=lt;exports.getEasing=mt;exports.getElementAnimation=vt;exports.getElementCSSAnimation=yt;exports.getJsEasing=C;exports.getScrubScene=Dt;exports.getSequence=Gt;exports.getWebAnimation=x;exports.jsEasings=S;exports.linear=P;exports.prepareAnimation=bt;exports.quadIn=W;exports.quadInOut=B;exports.quadOut=V;exports.quartIn=X;exports.quartInOut=Q;exports.quartOut=Y;exports.quintIn=Z;exports.quintInOut=et;exports.quintOut=tt;exports.registerEffects=$t;exports.sineIn=L;exports.sineInOut=H;exports.sineOut=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class w{animations;options;ready;isCSS;constructor(e,n){this.animations=e,this.options=n,this.ready=n?.measured||Promise.resolve(),this.isCSS=e[0]instanceof CSSAnimation}getProgress(){return this.animations[0]?.effect?.getComputedTiming().progress||0}async play(e){await this.ready;for(const n of this.animations)n.play();await Promise.all(this.animations.map(n=>n.ready)),e&&e()}pause(){for(const e of this.animations)e.pause()}async reverse(e){await this.ready;for(const n of this.animations)n.reverse();await Promise.all(this.animations.map(n=>n.ready)),e&&e()}progress(e){for(const n of this.animations){const{delay:i,duration:r,iterations:s}=n.effect.getTiming(),u=(Number.isFinite(r)?r:0)*(Number.isFinite(s)?s:1);n.currentTime=((i||0)+u)*e}}cancel(){for(const e of this.animations)e.cancel()}setPlaybackRate(e){for(const n of this.animations)n.playbackRate=e}async onFinish(e){try{await Promise.all(this.animations.map(i=>i.finished));const n=this.animations[0];if(n&&!this.isCSS){const i=n.effect?.target;if(i){const r=new Event("animationend");i.dispatchEvent(r)}}e()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}get finished(){return Promise.all(this.animations.map(e=>e.finished))}get playState(){return this.animations[0]?.playState}getTimingOptions(){return this.animations.map(e=>{const n=e.effect?.getTiming(),i=n?.delay??0,r=Number(n?.duration)||0,s=n?.iterations??1;return{delay:i,duration:r,iterations:s}})}}const P=t=>t,L=t=>1-Math.cos(t*Math.PI/2),j=t=>Math.sin(t*Math.PI/2),H=t=>-(Math.cos(Math.PI*t)-1)/2,W=t=>t**2,V=t=>1-(1-t)**2,B=t=>t<.5?2*t**2:1-(-2*t+2)**2/2,K=t=>t**3,J=t=>1-(1-t)**3,U=t=>t<.5?4*t**3:1-(-2*t+2)**3/2,X=t=>t**4,Y=t=>1-(1-t)**4,Q=t=>t<.5?8*t**4:1-(-2*t+2)**4/2,Z=t=>t**5,tt=t=>1-(1-t)**5,et=t=>t<.5?16*t**5:1-(-2*t+2)**5/2,nt=t=>t===0?0:2**(10*t-10),it=t=>t===1?1:1-2**(-10*t),st=t=>t===0?0:t===1?1:t<.5?2**(20*t-10)/2:(2-2**(-20*t+10))/2,rt=t=>1-Math.sqrt(1-t**2),ot=t=>Math.sqrt(1-(t-1)**2),at=t=>t<.5?(1-Math.sqrt(1-4*t**2))/2:(Math.sqrt(-(2*t-3)*(2*t-1))+1)/2,ct=t=>2.70158*t**3-1.70158*t**2,ut=t=>1+2.70158*(t-1)**3+1.70158*(t-1)**2,ft=(t,e=1.70158*1.525)=>t<.5?(2*t)**2*((e+1)*2*t-e)/2:((2*t-2)**2*((e+1)*(t*2-2)+e)+2)/2,S={linear:P,sineIn:L,sineOut:j,sineInOut:H,quadIn:W,quadOut:V,quadInOut:B,cubicIn:K,cubicOut:J,cubicInOut:U,quartIn:X,quartOut:Y,quartInOut:Q,quintIn:Z,quintOut:tt,quintInOut:et,expoIn:nt,expoOut:it,expoInOut:st,circIn:rt,circOut:ot,circInOut:at,backIn:ct,backOut:ut,backInOut:ft},T={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 mt(t){return t==="percentage"?"%":t||"px"}function lt(t){return t?T[t]||t:T.linear}function It(t,e,n,i){const r=3*t,s=3*(n-t)-r,u=1-r-s,a=3*e,m=3*(i-e)-a,l=1-a-m,o=h=>((u*h+s)*h+r)*h,c=h=>((l*h+m)*h+a)*h,f=h=>(3*u*h+2*s)*h+r;function p(h){let d=h;for(let b=0;b<8;b++){const y=o(d)-h;if(Math.abs(y)<1e-7)return d;const O=f(d);if(Math.abs(O)<1e-6)break;d-=y/O}let v=0,g=1;for(d=(v+g)/2;g-v>1e-7;){const b=o(d);if(Math.abs(b-h)<1e-7)return d;h>b?v=d:g=d,d=(v+g)/2}return d}return h=>h<=0?0:h>=1?1:c(p(h))}function _t(t){const e=t.match(/^cubic-bezier\(\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*,\s*(-?[\d.]+)\s*\)$/);if(!e)return;const n=parseFloat(e[1]),i=parseFloat(e[2]),r=parseFloat(e[3]),s=parseFloat(e[4]);if(![n,i,r,s].some(isNaN))return It(n,i,r,s)}function wt(t){const e=t.match(/^linear\((.+)\)$/);if(!e)return;const n=e[1].split(",").map(u=>u.trim()).filter(Boolean);if(n.length===0)return;const i=[];for(const u of n){const a=u.split(/\s+/),m=parseFloat(a[0]);if(isNaN(m))return;const l=[];for(let o=1;o<a.length;o++)if(a[o].endsWith("%")){const c=parseFloat(a[o])/100;if(isNaN(c))return;l.push(c)}l.length===0?i.push({output:m,pos:null}):l.length===1?i.push({output:m,pos:l[0]}):(i.push({output:m,pos:l[0]}),i.push({output:m,pos:l[1]}))}if(i.length===0)return;i[0].pos===null&&(i[0].pos=0),i[i.length-1].pos===null&&(i[i.length-1].pos=1);let r=0;for(;r<i.length;)if(i[r].pos===null){const u=r-1;let a=r;for(;a<i.length&&i[a].pos===null;)a++;const m=i[u].pos,l=i[a].pos,o=a-u;for(let c=u+1;c<a;c++)i[c].pos=m+(l-m)*(c-u)/o;r=a+1}else r++;for(let u=1;u<i.length;u++)i[u].pos<i[u-1].pos&&(i[u].pos=i[u-1].pos);const s=i;return u=>{if(u<=s[0].pos)return s[0].output;const a=s[s.length-1];if(u>=a.pos)return a.output;let m=0,l=s.length-1;for(;m<l-1;){const f=m+l>>>1;s[f].pos<=u?m=f:l=f}const o=s[m],c=s[l];return c.pos===o.pos?c.output:o.output+(c.output-o.output)*(u-o.pos)/(c.pos-o.pos)}}function C(t){if(!t)return;const e=S[t];return e||(_t(t)??wt(t)??S.linear)}class At extends w{animationGroups;delay;offset;offsetEasing;timingOptions;constructor(e,n={}){const i=e.flatMap(r=>[...r.animations]);super(i),this.animationGroups=e,this.delay=n.delay??0,this.offset=n.offset??0,this.offsetEasing=typeof n.offsetEasing=="function"?n.offsetEasing:C(n.offsetEasing)??P,this.timingOptions=this.animationGroups.map(r=>r.getTimingOptions().map(({delay:s,duration:u,iterations:a})=>({delay:s,duration:Number.isFinite(u)?u:0,iterations:Number.isFinite(a)?a:1}))),this.applyOffsets(),this.ready=Promise.all(e.map(r=>r.ready)).then(()=>{})}calculateOffsets(){const e=this.animationGroups.length;if(e<=1)return[0];const n=e-1;return Array.from({length:e},(i,r)=>this.offsetEasing(r/n)*n*this.offset|0)}applyOffsets(){const e=this.calculateOffsets(),n=this.getSequenceActiveDuration(e);this.animationGroups.forEach((i,r)=>{i.animations.forEach((s,u)=>{const a=s.effect;if(!a)return;const{delay:m,duration:l,iterations:o}=this.timingOptions[r][u],c=m+e[r],f=n-(c+l*o);a.updateTiming({delay:c+this.delay,endDelay:f})})})}getSequenceActiveDuration(e){const n=[];for(let i=0;i<this.timingOptions.length;i++){const r=this.timingOptions[i].reduce((s,u)=>{if(!u)return s;const{delay:a,duration:m,iterations:l}=u;return Math.max(s,a+m*l)},0);n.push(e[i]+r)}return Math.max(...n)}addGroups(e){if(e.length===0)return;const n=[...e].sort((i,r)=>r.index-i.index);for(const{index:i,group:r}of n){const s=Math.min(i,this.animationGroups.length);this.animationGroups.splice(s,0,r),this.timingOptions.splice(s,0,r.getTimingOptions());const u=[...r.animations],a=this.animationGroups.slice(0,s).reduce((m,l)=>m+l.animations.length,0);this.animations.splice(a,0,...u)}this.applyOffsets(),this.ready=Promise.all(this.animationGroups.map(i=>i.ready)).then(()=>{})}removeGroups(e){const n=[],i=[],r=[];for(let s=0;s<this.animationGroups.length;s++)e(this.animationGroups[s])?n.push(this.animationGroups[s]):(i.push(this.animationGroups[s]),r.push(this.timingOptions[s]));if(n.length===0)return n;for(const s of n)s.cancel();return this.animationGroups=i,this.timingOptions=r,this.animations=i.flatMap(s=>[...s.animations]),this.applyOffsets(),this.ready=Promise.all(this.animationGroups.map(s=>s.ready)).then(()=>{}),n}async onFinish(e){try{await Promise.all(this.animationGroups.map(n=>n.finished)),e()}catch(n){console.warn("animation was interrupted - aborting onFinish callback - ",n)}}}class kt{_animation;customEffect;progress;_tickCbId;_finishHandler;constructor(e,n,i,r){const s=new KeyframeEffect(n,[],{...i,composite:"add"}),{timeline:u}=r;this._animation=new Animation(s,u),this._tickCbId=null,this.progress=null,this.customEffect=a=>e(s.target,a),this._finishHandler=a=>{this.effect.target?.getAnimations().find(m=>m===this._animation)||this.cancel()},this.addEventListener("finish",this._finishHandler),this.addEventListener("remove",this._finishHandler)}_tick(){try{const e=this.effect?.getComputedTiming().progress??null;e!==this.progress&&(this.customEffect?.(e),this.progress=e),this._tickCbId=requestAnimationFrame(()=>{this._tick()})}catch(e){this._tickCbId=null,console.error(`failed to run customEffect! effectId: ${this.id}, error: ${e instanceof Error?e.message:e}`)}}get currentTime(){return this._animation.currentTime}set currentTime(e){this._animation.currentTime=e}get startTime(){return this._animation.startTime}set startTime(e){this._animation.startTime=e}get playbackRate(){return this._animation.playbackRate}set playbackRate(e){this._animation.playbackRate=e}get id(){return this._animation.id}set id(e){this._animation.id=e}get effect(){return this._animation.effect}set effect(e){this._animation.effect=e}get timeline(){return this._animation.timeline}set timeline(e){this._animation.timeline=e}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(e){this._animation.oncancel=e}get onfinish(){return this._animation.onfinish}set onfinish(e){this._animation.onfinish=e}get onremove(){return this._animation.onremove}set onremove(e){this._animation.onremove=e}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(e){this._animation.updatePlaybackRate(e)}addEventListener(e,n,i){this._animation.addEventListener(e,n,i)}removeEventListener(e,n,i){this._animation.removeEventListener(e,n,i)}dispatchEvent(e){return this._animation.dispatchEvent(e)}}function qt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var A={exports:{}},N=A.exports,G;function St(){return G||(G=1,(function(t){(function(e){var n=function(){},i=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.msRequestAnimationFrame||function(o){return setTimeout(o,16)};function r(){var o=this;o.reads=[],o.writes=[],o.raf=i.bind(e)}r.prototype={constructor:r,runTasks:function(o){for(var c;c=o.shift();)c()},measure:function(o,c){var f=c?o.bind(c):o;return this.reads.push(f),s(this),f},mutate:function(o,c){var f=c?o.bind(c):o;return this.writes.push(f),s(this),f},clear:function(o){return a(this.reads,o)||a(this.writes,o)},extend:function(o){if(typeof o!="object")throw new Error("expected object");var c=Object.create(this);return m(c,o),c.fastdom=this,c.initialize&&c.initialize(),c},catch:null};function s(o){o.scheduled||(o.scheduled=!0,o.raf(u.bind(null,o)))}function u(o){var c=o.writes,f=o.reads,p;try{n("flushing reads",f.length),o.runTasks(f),n("flushing writes",c.length),o.runTasks(c)}catch(h){p=h}if(o.scheduled=!1,(f.length||c.length)&&s(o),p)if(n("task errored",p.message),o.catch)o.catch(p);else throw p}function a(o,c){var f=o.indexOf(c);return!!~f&&!!o.splice(f,1)}function m(o,c){for(var f in c)c.hasOwnProperty(f)&&(o[f]=c[f])}var l=e.fastdom=e.fastdom||new r;t.exports=l})(typeof window<"u"?window:typeof N<"u"?N:globalThis)})(A)),A.exports}var Tt=St();const E=qt(Tt),$={};function $t(t){Object.assign($,t)}function Pt(t){return t in $?$[t]:(console.warn(`${t} not found in registry. Please make sure to import and register the preset.`),null)}function I(t,e){return t?(e||document).getElementById(t):null}function Ct(t,e){return t?.matches(`[data-motion-part~="${e}"]`)?t:t?.querySelector(`[data-motion-part~="${e}"]`)}function zt(t){const e=t.alternate?"alternate":"";return t.reversed?`${e?`${e}-`:""}reverse`:e||"normal"}function q(t){return`${t.value}${mt(t.unit)}`}function D(t,e,n){return`${t.name||"cover"} ${n&&t.offset.unit!=="percentage"?`calc(100% + ${q(t.offset)}${e?` + ${e}`:""})`:e?`calc(${q(t.offset)} + ${e})`:q(t.offset)}`}function ht(t){return{start:D(t.startOffset,t.startOffsetAdd),end:D(t.endOffset,t.endOffsetAdd,!0)}}function dt(t){return e=>E.measure(()=>e(t))}function pt(t){return e=>E.mutate(()=>e(t))}function _(t){if(t.namedEffect){const e=t.namedEffect.type;return typeof e=="string"?Pt(e):null}else if(t.keyframeEffect){const e=i=>{const{name:r,keyframes:s}=i.keyframeEffect;return[{...i,name:r,keyframes:s}]};return{web:e,style:e,getNames:i=>{const{effectId:r}=i,{name:s}=i.keyframeEffect,u=s||r;return u?[u]:[]}}}else if(t.customEffect)return e=>[{...e,keyframes:[]}];return null}function gt(t,e,n){return t.map((i,r)=>{const s={fill:i.fill,easing:lt(i.easing),iterations:i.iterations===0?1/0:i.iterations||1,composite:i.composite,direction:zt(i)};return z(e)?(s.duration=i.duration,s.delay=i.delay||0):window.ViewTimeline&&e?.trigger==="view-progress"?s.duration="auto":(s.duration=99.99,s.delay=.01),{effect:i,options:s,id:n&&`${n}-${r+1}`,part:i.part}})}function z(t){return!t||t.trigger!=="pointer-move"&&t.trigger!=="view-progress"}function R(t,e,n,i,r){if(t){if(z(i)&&(e.duration=e.duration||1,r?.reducedMotion))if(e.iterations===1||e.iterations==null)e={...e,duration:1};else return[];let s;return n instanceof HTMLElement&&(s={measure:dt(n),mutate:pt(n)}),t.web?t.web(e,s,r):t(e,s,r)}return[]}function x(t,e,n,i,r){const s=t instanceof HTMLElement?t:I(t,r);if(n?.trigger==="pointer-move"&&!e.keyframeEffect){let f=e;e.customEffect&&(f={...e,namedEffect:{id:"",type:"CustomMouse"}});const p=_(f),h=R(p,e,s,n,i);return typeof h!="function"?null:h(s)}const u=_(e),a=R(u,e,s,n,i);if(!a||a.length===0)return null;const m=gt(a,n,e.effectId);let l;const o=n?.trigger==="view-progress";o&&window.ViewTimeline&&(l=new ViewTimeline({subject:n.element||I(n.componentId)}));const c=m.map(({effect:f,options:p,id:h,part:d})=>{const v=d?Ct(s,d):s,g=new KeyframeEffect(v||null,[],p);E.mutate(()=>{"timing"in f&&g.updateTiming(f.timing),g.setKeyframes(f.keyframes)});const b=o&&l?{timeline:l}:{},y=typeof f.customEffect=="function"?new kt(f.customEffect,v||null,p,b):new Animation(g,b.timeline);if(o)if(l)E.mutate(()=>{const{start:O,end:k}=ht(f);y.rangeStart=O,y.rangeEnd=k,y.play()});else{const{startOffset:O,endOffset:k}=e;E.mutate(()=>{const F=f.startOffset||O,M=f.endOffset||k;Object.assign(y,{start:{name:F.name,offset:F.offset?.value,add:f.startOffsetAdd},end:{name:M.name,offset:M.offset?.value,add:f.endOffsetAdd}})})}return h&&(y.id=h),y});return new w(c,{...e,trigger:{...n||{}},measured:new Promise(f=>E.mutate(f))})}function xt(t,e){return t?`#${t}${e?`[data-motion-part~="${e}"]`:""}`:""}function Ft(t,e){const{duration:n,delay:i,iterations:r=1,fill:s,easing:u="linear",direction:a}=t.options,m=t.effect.name,l=n==="auto";return`${m} ${l?"auto":`${n}ms`}${l?" ":` ${i||1}ms `}${u}${s&&s!=="none"?` ${s}`:""} ${!r||r===1/0?"infinite":r}${a==="normal"?"":` ${a}`} ${e?"":"paused"}`}function Mt(t,e,n){return t?.style?(z(n)&&(e.duration=e.duration||1),t.style(e)):[]}function Nt(t,e,n){const i=_(e),r=Mt(i,e),s=gt(r,n,e.effectId),u=n?.trigger==="view-progress";return s.map((a,m)=>{const{start:l,end:o}=u?ht(a.effect):{};return{target:xt(t,a.part),animation:Ft(a,u),composition:a.options.composite,custom:a.effect.custom,name:a.effect.name,keyframes:a.effect.keyframes,id:a.id&&`${a.id}-${m+1}`,animationTimeline:u?`--${n?.id}`:"",animationRange:l||o?`${l} ${o}`:""}})}function bt(t,e,n){const i=_(e),r=t instanceof HTMLElement?t:I(t);if(i&&i.prepare&&r){const s={measure:dt(r),mutate:pt(r)};i.prepare(e,s)}n&&E.mutate(n)}function yt(t,e){const n=_(e);if(!n)return null;if(!n.style)return e.effectId&&t?vt(t,e.effectId):null;const i=n.getNames(e),s=(typeof t=="string"?I(t):t)?.getAnimations(),u=s?.map(m=>m.animationName)||[],a=[];return i.forEach(m=>{u.includes(m)&&a.push(s?.find(l=>l.animationName===m))}),a?.length?new w(a):null}function vt(t,e){const i=(typeof t=="string"?I(t):t)?.getAnimations().filter(r=>{const s=r.id||r.animationName;return s?s.startsWith(e):!0});return i?.length?new w(i):null}function Gt(t,e,n,i={}){const{disabled:r,allowActiveEvent:s,...u}=i,a=x(t,e,n,u);if(!a)return null;let m={};if(n.trigger==="view-progress"&&!window.ViewTimeline){const l=n.element||I(n.componentId),{ready:o}=a;return a.animations.map(c=>({get start(){return c.start},get end(){return c.end},viewSource:l,ready:o,getProgress(){return a.getProgress()},effect(f,p){const{activeDuration:h}=c.effect.getComputedTiming(),{delay:d}=c.effect.getTiming();c.currentTime=((d||0)+(h||0))*p},disabled:r,destroy(){c.cancel()}}))}else if(n.trigger==="pointer-move"){const l=e,{centeredToTarget:o,transitionDuration:c,transitionEasing:f}=l,p=n.axis;if(l.keyframeEffect){const h=a;return h.animations?.length===0?null:{target:void 0,centeredToTarget:o,ready:h.ready,_currentProgress:0,getProgress(){return this._currentProgress},effect(v,g){const b=p==="x"?g.x:g.y;this._currentProgress=b,h.progress(b)},disabled:r??!1,destroy(){h.cancel()}}}m={centeredToTarget:o,allowActiveEvent:s},e.customEffect&&c&&(m.transitionDuration=c,m.transitionEasing=C(f)),m.target=a.target}return{...m,getProgress(){return a.getProgress()},effect(l,o,c,f){a.progress(c?{...o,v:c,active:f}:o)},disabled:r,destroy(){a.cancel()}}}function Et(t,e,n,i=!1){const r=yt(t,e);return r?(r.ready=new Promise(s=>{bt(t,e,s)}),r):x(t,e,n,{reducedMotion:i})}function Dt(t){return t===null?[null]:typeof t=="string"?Array.from(document.querySelectorAll(t)):Array.isArray(t)?t:[t]}function Ot(t,e){const n=[];for(const{target:i,options:r}of t){const s=Dt(i);for(const u of s){const a=Et(u,r,void 0,e?.reducedMotion);a instanceof w&&n.push(a)}}return n}function Rt(t,e,n){const i=Ot(e,n);return new At(i,t)}exports.backIn=ct;exports.backInOut=ft;exports.backOut=ut;exports.circIn=rt;exports.circInOut=at;exports.circOut=ot;exports.createAnimationGroups=Ot;exports.cssEasings=T;exports.cubicIn=K;exports.cubicInOut=U;exports.cubicOut=J;exports.expoIn=nt;exports.expoInOut=st;exports.expoOut=it;exports.getAnimation=Et;exports.getCSSAnimation=Nt;exports.getCssUnits=mt;exports.getEasing=lt;exports.getElementAnimation=vt;exports.getElementCSSAnimation=yt;exports.getJsEasing=C;exports.getScrubScene=Gt;exports.getSequence=Rt;exports.getWebAnimation=x;exports.jsEasings=S;exports.linear=P;exports.prepareAnimation=bt;exports.quadIn=W;exports.quadInOut=B;exports.quadOut=V;exports.quartIn=X;exports.quartInOut=Q;exports.quartOut=Y;exports.quintIn=Z;exports.quintInOut=et;exports.quintOut=tt;exports.registerEffects=$t;exports.sineIn=L;exports.sineInOut=H;exports.sineOut=j;
|
|
2
2
|
//# sourceMappingURL=motion.js.map
|
package/dist/cjs/motion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"motion.js","sources":["../../src/AnimationGroup.ts","../../src/easings.ts","../../src/utils.ts","../../src/Sequence.ts","../../src/CustomAnimation.ts","../../../../node_modules/fastdom/fastdom.js","../../src/api/registry.ts","../../src/api/common.ts","../../src/api/webAnimations.ts","../../src/api/cssAnimations.ts","../../src/api/prepare.ts","../../src/motion.ts"],"sourcesContent":["import { AnimationGroupOptions, RangeOffset } from './types';\n\n/**\n * @class AnimationGroup\n *\n * A wrapper object for simulating a GroupEffect and managing multiple animations.\n * See: https://www.w3.org/TR/web-animations-2/#grouping-and-synchronization\n */\nexport class AnimationGroup {\n animations: (Animation & {\n start?: RangeOffset;\n end?: RangeOffset;\n })[];\n options?: AnimationGroupOptions;\n ready: Promise<void>;\n isCSS: boolean;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n this.isCSS = animations[0] instanceof CSSAnimation;\n }\n\n getProgress() {\n return this.animations[0]?.effect?.getComputedTiming().progress || 0;\n }\n\n async play(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.play();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n pause() {\n for (const animation of this.animations) {\n animation.pause();\n }\n }\n\n async reverse(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.reverse();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n progress(p: number) {\n for (const animation of this.animations) {\n const { delay, duration, iterations } = animation.effect!.getTiming();\n const time =\n (Number.isFinite(duration) ? (duration as number) : 0) *\n (Number.isFinite(iterations) ? (iterations as number) : 1);\n animation.currentTime = ((delay || 0) + time) * p;\n }\n }\n\n cancel() {\n for (const animation of this.animations) {\n animation.cancel();\n }\n }\n\n setPlaybackRate(rate: number) {\n for (const animation of this.animations) {\n animation.playbackRate = rate;\n }\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animations.map((animation) => animation.finished));\n\n const a = this.animations[0];\n\n if (a && !this.isCSS) {\n const target = (a.effect as KeyframeEffect)?.target;\n\n if (target) {\n const endEvent = new Event('animationend');\n target.dispatchEvent(endEvent);\n }\n }\n\n callback();\n } catch (_error) {\n console.warn('animation was interrupted - aborting onFinish callback - ', _error);\n }\n }\n\n get finished() {\n return Promise.all(this.animations.map((animation) => animation.finished));\n }\n\n get playState() {\n return this.animations[0]?.playState;\n }\n\n getTimingOptions() {\n return this.animations.map((a) => {\n const timing = a.effect?.getTiming();\n const delay = timing?.delay ?? 0;\n const duration = Number(timing?.duration) || 0;\n const iterations = timing?.iterations ?? 1;\n\n return {\n delay,\n duration,\n iterations,\n };\n });\n }\n}\n","/**\n * @file Easing functions as defined by Robert Penner.\n * @example A playground I made https://codepen.io/tombigel/pen/eYLLVRg\n */\n\n/**\n * Linear easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const linear = (t: number) => t;\n\n/**\n * Sine-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const sineIn = (t: number) => 1 - Math.cos((t * Math.PI) / 2);\n\n/**\n * Sine-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const sineOut = (t: number) => Math.sin((t * Math.PI) / 2);\n\n/**\n * Sine-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const sineInOut = (t: number) => -(Math.cos(Math.PI * t) - 1) / 2;\n\n/**\n * Quadratic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quadIn = (t: number) => t ** 2;\n\n/**\n * Quadratic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quadOut = (t: number) => 1 - (1 - t) ** 2;\n\n/**\n * Quadratic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quadInOut = (t: number) => (t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2);\n\n/**\n * Cubic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const cubicIn = (t: number) => t ** 3;\n\n/**\n * Cubic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const cubicOut = (t: number) => 1 - (1 - t) ** 3;\n\n/**\n * Cubic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const cubicInOut = (t: number) => (t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2);\n\n/**\n * Quartic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quartIn = (t: number) => t ** 4;\n\n/**\n * Quartic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quartOut = (t: number) => 1 - (1 - t) ** 4;\n\n/**\n * Quartic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quartInOut = (t: number) => (t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2);\n\n/**\n * Quintic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quintIn = (t: number) => t ** 5;\n\n/**\n * Quintic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quintOut = (t: number) => 1 - (1 - t) ** 5;\n\n/**\n * Quintic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quintInOut = (t: number) => (t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2);\n\n/**\n * Exponential-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const expoIn = (t: number) => (t === 0 ? 0 : 2 ** (10 * t - 10));\n\n/**\n * Exponential-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const expoOut = (t: number) => (t === 1 ? 1 : 1 - 2 ** (-10 * t));\n\n/**\n * Exponential-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const expoInOut = (t: number) =>\n t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2;\n\n/**\n * Circular-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const circIn = (t: number) => 1 - Math.sqrt(1 - t ** 2);\n\n/**\n * Circular-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const circOut = (t: number) => Math.sqrt(1 - (t - 1) ** 2);\n\n/**\n * Circular-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const circInOut = (t: number) =>\n t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2;\n\n/**\n * Back-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const backIn = (t: number) => 2.70158 * t ** 3 - 1.70158 * t ** 2;\n\n/**\n * Back-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const backOut = (t: number) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2;\n\n/**\n * Back-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @param k - The back factor (optional, default is 1.70158 * 1.525).\n * @returns The eased value.\n */\nexport const backInOut = (t: number, k = 1.70158 * 1.525) =>\n t < 0.5\n ? ((2 * t) ** 2 * ((k + 1) * 2 * t - k)) / 2\n : ((2 * t - 2) ** 2 * ((k + 1) * (t * 2 - 2) + k) + 2) / 2;\n\nexport const jsEasings = {\n linear,\n sineIn,\n sineOut,\n sineInOut,\n quadIn,\n quadOut,\n quadInOut,\n cubicIn,\n cubicOut,\n cubicInOut,\n quartIn,\n quartOut,\n quartInOut,\n quintIn,\n quintOut,\n quintInOut,\n expoIn,\n expoOut,\n expoInOut,\n circIn,\n circOut,\n circInOut,\n backIn,\n backOut,\n backInOut,\n};\n\n/**\n * CSS cubic-bezier easings based on PostCSS Easings\n */\nexport const cssEasings = {\n linear: 'linear',\n ease: 'ease',\n easeIn: 'ease-in',\n easeOut: 'ease-out',\n easeInOut: 'ease-in-out',\n sineIn: 'cubic-bezier(0.47, 0, 0.745, 0.715)',\n sineOut: 'cubic-bezier(0.39, 0.575, 0.565, 1)',\n sineInOut: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)',\n quadIn: 'cubic-bezier(0.55, 0.085, 0.68, 0.53)',\n quadOut: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',\n quadInOut: 'cubic-bezier(0.455, 0.03, 0.515, 0.955)',\n cubicIn: 'cubic-bezier(0.55, 0.055, 0.675, 0.19)',\n cubicOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',\n cubicInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',\n quartIn: 'cubic-bezier(0.895, 0.03, 0.685, 0.22)',\n quartOut: 'cubic-bezier(0.165, 0.84, 0.44, 1)',\n quartInOut: 'cubic-bezier(0.77, 0, 0.175, 1)',\n quintIn: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',\n quintOut: 'cubic-bezier(0.23, 1, 0.32, 1)',\n quintInOut: 'cubic-bezier(0.86, 0, 0.07, 1)',\n expoIn: 'cubic-bezier(0.95, 0.05, 0.795, 0.035)',\n expoOut: 'cubic-bezier(0.19, 1, 0.22, 1)',\n expoInOut: 'cubic-bezier(1, 0, 0, 1)',\n circIn: 'cubic-bezier(0.6, 0.04, 0.98, 0.335)',\n circOut: 'cubic-bezier(0.075, 0.82, 0.165, 1)',\n circInOut: 'cubic-bezier(0.785, 0.135, 0.15, 0.86)',\n backIn: 'cubic-bezier(0.6, -0.28, 0.735, 0.045)',\n backOut: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n backInOut: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n} as const;\n","import { cssEasings, jsEasings } from './easings';\n\nexport function getCssUnits(unit: 'percentage' | string) {\n return unit === 'percentage' ? '%' : unit || 'px';\n}\n\nexport function getEasing(easing?: keyof typeof cssEasings | string): string {\n return easing ? cssEasings[easing as keyof typeof cssEasings] || easing : cssEasings.linear;\n}\n\nfunction cubicBezierEasing(x1: number, y1: number, x2: number, y2: number): (t: number) => number {\n const cx = 3 * x1;\n const bx = 3 * (x2 - x1) - cx;\n const ax = 1 - cx - bx;\n const cy = 3 * y1;\n const by = 3 * (y2 - y1) - cy;\n const ay = 1 - cy - by;\n\n const sampleX = (t: number) => ((ax * t + bx) * t + cx) * t;\n const sampleY = (t: number) => ((ay * t + by) * t + cy) * t;\n const sampleDX = (t: number) => (3 * ax * t + 2 * bx) * t + cx;\n\n function solveT(x: number): number {\n let t = x;\n\n for (let i = 0; i < 8; i++) {\n const dx = sampleX(t) - x;\n\n if (Math.abs(dx) < 1e-7) return t;\n\n const d = sampleDX(t);\n\n if (Math.abs(d) < 1e-6) break;\n\n t -= dx / d;\n }\n // Bisection fallback\n let lo = 0,\n hi = 1;\n t = (lo + hi) / 2;\n\n while (hi - lo > 1e-7) {\n const xMid = sampleX(t);\n if (Math.abs(xMid - x) < 1e-7) return t;\n if (x > xMid) lo = t;\n else hi = t;\n t = (lo + hi) / 2;\n }\n\n return t;\n }\n\n return (t: number) => {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n return sampleY(solveT(t));\n };\n}\n\nfunction parseCubicBezier(str: string): ((t: number) => number) | undefined {\n const m = str.match(\n /^cubic-bezier\\(\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*\\)$/,\n );\n\n if (!m) return undefined;\n\n const x1 = parseFloat(m[1]);\n const y1 = parseFloat(m[2]);\n const x2 = parseFloat(m[3]);\n const y2 = parseFloat(m[4]);\n\n if ([x1, y1, x2, y2].some(isNaN)) return undefined;\n\n return cubicBezierEasing(x1, y1, x2, y2);\n}\n\nfunction parseCssLinear(str: string): ((t: number) => number) | undefined {\n const m = str.match(/^linear\\((.+)\\)$/);\n if (!m) return undefined;\n\n const parts = m[1]\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean);\n\n if (parts.length === 0) return undefined;\n\n type Stop = { output: number; pos: number | null };\n const stops: Stop[] = [];\n\n for (const part of parts) {\n const tokens = part.split(/\\s+/);\n const output = parseFloat(tokens[0]);\n\n if (isNaN(output)) return undefined;\n\n const pcts: number[] = [];\n\n for (let i = 1; i < tokens.length; i++) {\n if (tokens[i].endsWith('%')) {\n const v = parseFloat(tokens[i]) / 100;\n if (isNaN(v)) return undefined;\n pcts.push(v);\n }\n }\n\n if (pcts.length === 0) {\n stops.push({ output, pos: null });\n } else if (pcts.length === 1) {\n stops.push({ output, pos: pcts[0] });\n } else {\n // Two percentages: creates a plateau between the two positions\n stops.push({ output, pos: pcts[0] });\n stops.push({ output, pos: pcts[1] });\n }\n }\n\n if (stops.length === 0) return undefined;\n if (stops[0].pos === null) stops[0].pos = 0;\n if (stops[stops.length - 1].pos === null) stops[stops.length - 1].pos = 1;\n\n // Distribute positions for stops without an explicit position\n let i = 0;\n\n while (i < stops.length) {\n if (stops[i].pos === null) {\n const start = i - 1;\n let end = i;\n\n while (end < stops.length && stops[end].pos === null) end++;\n\n const startPos = stops[start].pos!;\n const endPos = stops[end].pos!;\n const span = end - start;\n\n for (let k = start + 1; k < end; k++) {\n stops[k].pos = startPos + ((endPos - startPos) * (k - start)) / span;\n }\n\n i = end + 1;\n } else {\n i++;\n }\n }\n\n // Clamp: each stop must be no earlier than the previous one\n for (let j = 1; j < stops.length; j++) {\n if (stops[j].pos! < stops[j - 1].pos!) stops[j].pos = stops[j - 1].pos;\n }\n\n const resolved = stops as Array<{ output: number; pos: number }>;\n\n return (t: number) => {\n if (t <= resolved[0].pos) return resolved[0].output;\n\n const last = resolved[resolved.length - 1];\n\n if (t >= last.pos) return last.output;\n\n let lo = 0,\n hi = resolved.length - 1;\n\n while (lo < hi - 1) {\n const mid = (lo + hi) >>> 1;\n\n if (resolved[mid].pos <= t) lo = mid;\n else hi = mid;\n }\n\n const a = resolved[lo];\n const b = resolved[hi];\n if (b.pos === a.pos) return b.output;\n return a.output + ((b.output - a.output) * (t - a.pos)) / (b.pos - a.pos);\n };\n}\n\nexport function getJsEasing(\n easing?: keyof typeof jsEasings | string,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined;\n\n const named = jsEasings[easing as keyof typeof jsEasings];\n\n if (named) return named;\n\n return parseCubicBezier(easing) ?? parseCssLinear(easing) ?? jsEasings.linear;\n}\n","import { AnimationGroup } from './AnimationGroup';\nimport type { IndexedGroup, SequenceOptions } from './types';\nimport { linear } from './easings';\nimport { getJsEasing } from './utils';\n\n/**\n * @class Sequence\n *\n * Manages multiple AnimationGroups as a coordinated timeline with staggered delays.\n * Extends AnimationGroup to inherit the playback control API while delegating\n * to child AnimationGroup instances.\n */\nexport class Sequence extends AnimationGroup {\n animationGroups: AnimationGroup[];\n delay: number;\n offset: number;\n offsetEasing: (p: number) => number;\n private timingOptions: { delay: number; duration: number; iterations: number }[][];\n\n constructor(animationGroups: AnimationGroup[], options: SequenceOptions = {}) {\n const allAnimations = animationGroups.flatMap((group) => [...group.animations]);\n super(allAnimations);\n\n this.animationGroups = animationGroups;\n this.delay = options.delay ?? 0;\n this.offset = options.offset ?? 0;\n this.offsetEasing =\n typeof options.offsetEasing === 'function'\n ? options.offsetEasing\n : (getJsEasing(options.offsetEasing) ?? linear);\n\n this.timingOptions = this.animationGroups.map((g) => {\n return g.getTimingOptions().map(({ delay, duration, iterations }) => {\n return {\n delay,\n duration: Number.isFinite(duration) ? duration : 0,\n iterations: Number.isFinite(iterations) ? iterations : 1,\n };\n });\n });\n\n this.applyOffsets();\n\n this.ready = Promise.all(animationGroups.map((g) => g.ready)).then(() => {});\n }\n\n /**\n * Calculates stagger delay offsets for each animation group using the formula:\n * easing(i / last) * last * offset\n * where i is the group index and last is the index of the final group.\n */\n private calculateOffsets(): number[] {\n const count = this.animationGroups.length;\n if (count <= 1) return [0];\n\n const last = count - 1;\n\n return Array.from(\n { length: count },\n (_, i) => (this.offsetEasing(i / last) * last * this.offset) | 0,\n );\n }\n\n private applyOffsets(): void {\n const offsets = this.calculateOffsets();\n const sequenceDuration = this.getSequenceActiveDuration(offsets);\n\n this.animationGroups.forEach((group, groupIdx) => {\n group.animations.forEach((animation, animIdx) => {\n const effect = animation.effect;\n\n if (!effect) return;\n\n const { delay: baseDelay, duration, iterations } = this.timingOptions[groupIdx][animIdx];\n const delay = baseDelay + offsets[groupIdx];\n const endDelay = sequenceDuration - (delay + duration * iterations);\n\n // add the sequence delay to the animation delay at the end - it doesn't need to affect the endDelay\n effect.updateTiming({ delay: delay + this.delay, endDelay });\n });\n });\n }\n\n private getSequenceActiveDuration(offsets: number[]): number {\n const result: number[] = [];\n\n for (let i = 0; i < this.timingOptions.length; i++) {\n const activeDuration = this.timingOptions[i].reduce((max, options) => {\n if (!options) return max;\n\n const { delay, duration, iterations } = options;\n\n return Math.max(max, delay + duration * iterations);\n }, 0);\n\n result.push(offsets[i] + activeDuration);\n }\n\n return Math.max(...result);\n }\n\n /**\n * Inserts new AnimationGroups at specified indices, then recalculates\n * stagger offsets for all groups. Each entry specifies the target index\n * in the animationGroups array where the group should be inserted.\n */\n addGroups(entries: IndexedGroup[]): void {\n if (entries.length === 0) return;\n\n const sorted = [...entries].sort((a, b) => b.index - a.index);\n\n for (const { index, group } of sorted) {\n const clampedIndex = Math.min(index, this.animationGroups.length);\n this.animationGroups.splice(clampedIndex, 0, group);\n this.timingOptions.splice(clampedIndex, 0, group.getTimingOptions());\n\n const flatAnimations = [...group.animations];\n const insertAt = this.animationGroups\n .slice(0, clampedIndex)\n .reduce((sum, g) => sum + g.animations.length, 0);\n this.animations.splice(insertAt, 0, ...flatAnimations);\n }\n\n this.applyOffsets();\n this.ready = Promise.all(this.animationGroups.map((g) => g.ready)).then(() => {});\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animationGroups.map((group) => group.finished));\n callback();\n } catch (_error) {\n console.warn('animation was interrupted - aborting onFinish callback - ', _error);\n }\n }\n}\n","/**\n * @class CustomAnimation\n *\n * A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.\n * The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.\n */\nexport class CustomAnimation {\n _animation: Animation;\n customEffect: (progress: number | null) => void;\n progress: number | null;\n _tickCbId: number | null;\n _finishHandler: (_: any) => void;\n\n constructor(\n customEffect: (element: Element | null, progress: number | null) => void,\n target: Element | null,\n effectOptions: KeyframeEffectOptions,\n timingOptions: { timeline?: AnimationTimeline | null },\n ) {\n // overriding composite so that animation is not replaced and removed\n const effect = new KeyframeEffect(target, [], {\n ...effectOptions,\n composite: 'add',\n });\n const { timeline } = timingOptions;\n this._animation = new Animation(effect, timeline);\n\n this._tickCbId = null;\n this.progress = null;\n this.customEffect = (progress: number | null) => customEffect(effect.target, progress);\n\n // stop loop if animation is removed from the DOM after finish (does not fire 'remove' event)\n this._finishHandler = (_: any) => {\n if (\n !(this.effect as KeyframeEffect).target?.getAnimations().find((a) => a === this._animation)\n ) {\n this.cancel();\n }\n };\n this.addEventListener('finish', this._finishHandler);\n this.addEventListener('remove', this._finishHandler);\n }\n\n // private tick method for customEffect loop implementation\n private _tick() {\n try {\n const progress = this.effect?.getComputedTiming().progress ?? null;\n if (progress !== this.progress) {\n this.customEffect?.(progress);\n this.progress = progress;\n }\n this._tickCbId = requestAnimationFrame(() => {\n this._tick();\n });\n } catch (error) {\n this._tickCbId = null;\n console.error(\n `failed to run customEffect! effectId: ${this.id}, error: ${\n error instanceof Error ? error.message : error\n }`,\n );\n }\n }\n\n // Animation timing properties\n get currentTime() {\n return this._animation.currentTime;\n }\n set currentTime(time: CSSNumberish | null) {\n this._animation.currentTime = time;\n }\n get startTime() {\n return this._animation.startTime;\n }\n set startTime(time: CSSNumberish | null) {\n this._animation.startTime = time;\n }\n get playbackRate() {\n return this._animation.playbackRate;\n }\n set playbackRate(speed: number) {\n this._animation.playbackRate = speed;\n }\n\n // Animation basic properties\n get id() {\n return this._animation.id;\n }\n set id(uid: string) {\n this._animation.id = uid;\n }\n get effect() {\n return this._animation.effect;\n }\n set effect(e: AnimationEffect | null) {\n this._animation.effect = e;\n }\n get timeline() {\n return this._animation.timeline;\n }\n set timeline(tl: AnimationTimeline | null) {\n this._animation.timeline = tl;\n }\n\n // Animation readonly state properties\n get finished() {\n return this._animation.finished;\n }\n get pending() {\n return this._animation.pending;\n }\n get playState() {\n return this._animation.playState;\n }\n get ready() {\n return this._animation.ready;\n }\n get replaceState() {\n return this._animation.replaceState;\n }\n\n // Animation event handlers\n get oncancel() {\n return this._animation.oncancel;\n }\n set oncancel(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null) {\n this._animation.oncancel = cb;\n }\n get onfinish() {\n return this._animation.onfinish;\n }\n set onfinish(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null) {\n this._animation.onfinish = cb;\n }\n get onremove() {\n return this._animation.onremove;\n }\n set onremove(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null) {\n this._animation.onremove = cb;\n }\n\n // CustomAnimation overridden methods\n play() {\n this._animation.play();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = requestAnimationFrame(() => this._tick());\n }\n\n pause() {\n this._animation.pause();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n cancel() {\n this.removeEventListener('finish', this._finishHandler);\n this.removeEventListener('remove', this._finishHandler);\n this._animation.cancel();\n // signaling cancelation for customEffect to handle it as desired\n this.customEffect(null);\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n commitStyles() {\n console.warn(\n 'CustomEffect animations do not support commitStyles method as they have no style to commit',\n );\n }\n\n // Animation methods without override\n finish() {\n this._animation.finish();\n }\n persist() {\n this._animation.persist();\n }\n reverse() {\n this._animation.reverse();\n }\n updatePlaybackRate(playbackRate: number) {\n this._animation.updatePlaybackRate(playbackRate);\n }\n\n // Animation events API\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.addEventListener(type, listener, options);\n }\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.removeEventListener(type, listener, options);\n }\n dispatchEvent(event: Event) {\n return this._animation.dispatchEvent(event);\n }\n}\n","!(function(win) {\n\n/**\n * FastDom\n *\n * Eliminates layout thrashing\n * by batching DOM read/write\n * interactions.\n *\n * @author Wilson Page <wilsonpage@me.com>\n * @author Kornel Lesinski <kornel.lesinski@ft.com>\n */\n\n'use strict';\n\n/**\n * Mini logger\n *\n * @return {Function}\n */\nvar debug = 0 ? console.log.bind(console, '[fastdom]') : function() {};\n\n/**\n * Normalized rAF\n *\n * @type {Function}\n */\nvar raf = win.requestAnimationFrame\n || win.webkitRequestAnimationFrame\n || win.mozRequestAnimationFrame\n || win.msRequestAnimationFrame\n || function(cb) { return setTimeout(cb, 16); };\n\n/**\n * Initialize a `FastDom`.\n *\n * @constructor\n */\nfunction FastDom() {\n var self = this;\n self.reads = [];\n self.writes = [];\n self.raf = raf.bind(win); // test hook\n debug('initialized', self);\n}\n\nFastDom.prototype = {\n constructor: FastDom,\n\n /**\n * We run this inside a try catch\n * so that if any jobs error, we\n * are able to recover and continue\n * to flush the batch until it's empty.\n *\n * @param {Array} tasks\n */\n runTasks: function(tasks) {\n debug('run tasks');\n var task; while (task = tasks.shift()) task();\n },\n\n /**\n * Adds a job to the read batch and\n * schedules a new frame if need be.\n *\n * @param {Function} fn\n * @param {Object} ctx the context to be bound to `fn` (optional).\n * @public\n */\n measure: function(fn, ctx) {\n debug('measure');\n var task = !ctx ? fn : fn.bind(ctx);\n this.reads.push(task);\n scheduleFlush(this);\n return task;\n },\n\n /**\n * Adds a job to the\n * write batch and schedules\n * a new frame if need be.\n *\n * @param {Function} fn\n * @param {Object} ctx the context to be bound to `fn` (optional).\n * @public\n */\n mutate: function(fn, ctx) {\n debug('mutate');\n var task = !ctx ? fn : fn.bind(ctx);\n this.writes.push(task);\n scheduleFlush(this);\n return task;\n },\n\n /**\n * Clears a scheduled 'read' or 'write' task.\n *\n * @param {Object} task\n * @return {Boolean} success\n * @public\n */\n clear: function(task) {\n debug('clear', task);\n return remove(this.reads, task) || remove(this.writes, task);\n },\n\n /**\n * Extend this FastDom with some\n * custom functionality.\n *\n * Because fastdom must *always* be a\n * singleton, we're actually extending\n * the fastdom instance. This means tasks\n * scheduled by an extension still enter\n * fastdom's global task queue.\n *\n * The 'super' instance can be accessed\n * from `this.fastdom`.\n *\n * @example\n *\n * var myFastdom = fastdom.extend({\n * initialize: function() {\n * // runs on creation\n * },\n *\n * // override a method\n * measure: function(fn) {\n * // do extra stuff ...\n *\n * // then call the original\n * return this.fastdom.measure(fn);\n * },\n *\n * ...\n * });\n *\n * @param {Object} props properties to mixin\n * @return {FastDom}\n */\n extend: function(props) {\n debug('extend', props);\n if (typeof props != 'object') throw new Error('expected object');\n\n var child = Object.create(this);\n mixin(child, props);\n child.fastdom = this;\n\n // run optional creation hook\n if (child.initialize) child.initialize();\n\n return child;\n },\n\n // override this with a function\n // to prevent Errors in console\n // when tasks throw\n catch: null\n};\n\n/**\n * Schedules a new read/write\n * batch if one isn't pending.\n *\n * @private\n */\nfunction scheduleFlush(fastdom) {\n if (!fastdom.scheduled) {\n fastdom.scheduled = true;\n fastdom.raf(flush.bind(null, fastdom));\n debug('flush scheduled');\n }\n}\n\n/**\n * Runs queued `read` and `write` tasks.\n *\n * Errors are caught and thrown by default.\n * If a `.catch` function has been defined\n * it is called instead.\n *\n * @private\n */\nfunction flush(fastdom) {\n debug('flush');\n\n var writes = fastdom.writes;\n var reads = fastdom.reads;\n var error;\n\n try {\n debug('flushing reads', reads.length);\n fastdom.runTasks(reads);\n debug('flushing writes', writes.length);\n fastdom.runTasks(writes);\n } catch (e) { error = e; }\n\n fastdom.scheduled = false;\n\n // If the batch errored we may still have tasks queued\n if (reads.length || writes.length) scheduleFlush(fastdom);\n\n if (error) {\n debug('task errored', error.message);\n if (fastdom.catch) fastdom.catch(error);\n else throw error;\n }\n}\n\n/**\n * Remove an item from an Array.\n *\n * @param {Array} array\n * @param {*} item\n * @return {Boolean}\n */\nfunction remove(array, item) {\n var index = array.indexOf(item);\n return !!~index && !!array.splice(index, 1);\n}\n\n/**\n * Mixin own properties of source\n * object into the target.\n *\n * @param {Object} target\n * @param {Object} source\n */\nfunction mixin(target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) target[key] = source[key];\n }\n}\n\n// There should never be more than\n// one instance of `FastDom` in an app\nvar exports = win.fastdom = (win.fastdom || new FastDom()); // jshint ignore:line\n\n// Expose to CJS & AMD\nif ((typeof define) == 'function') define(function() { return exports; });\nelse if ((typeof module) == 'object') module.exports = exports;\n\n})( typeof window !== 'undefined' ? window : typeof this != 'undefined' ? this : globalThis);\n","import type { EffectModule } from '../types';\n\nconst registry: Record<string, EffectModule> = {};\n\nexport function registerEffects(effects: Record<string, EffectModule>) {\n Object.assign(registry, effects);\n}\n\nexport function getRegisteredEffect(name: string) {\n if (name in registry) {\n return registry[name];\n } else {\n console.warn(\n `${name} not found in registry. Please make sure to import and register the preset.`,\n );\n return null;\n }\n}\n","import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationOptions,\n MeasureCallback,\n RangeOffset,\n TimeAnimationOptions,\n TriggerVariant,\n UnitLengthPercentage,\n} from '../types';\nimport { getCssUnits, getEasing } from '../utils';\nimport fastdom from 'fastdom';\nimport { getRegisteredEffect } from './registry';\n\nfunction getElement(id: string | null, ownerDocument?: Document): HTMLElement | null {\n return id ? (ownerDocument || document).getElementById(id) : null;\n}\n\nfunction getElementMotionPart(element: Element | null, part: string) {\n if (element?.matches(`[data-motion-part~=\"${part}\"]`)) {\n return element;\n }\n return element?.querySelector(`[data-motion-part~=\"${part}\"]`);\n}\n\nfunction getDirection(effect: AnimationData): KeyframeEffectOptions['direction'] {\n const alternate = effect.alternate ? 'alternate' : '';\n return effect.reversed\n ? (`${alternate ? `${alternate}-` : ''}reverse` as 'reverse' | 'alternate-reverse')\n : alternate || 'normal';\n}\n\nfunction getLength(length: UnitLengthPercentage): string {\n return `${length.value}${getCssUnits(length.unit)}`;\n}\n\nfunction getRange(range: RangeOffset, add: string | undefined, isEnd?: boolean) {\n // according to the CSS spec if the end range is a <length> then it is calculated from the start of the named range\n // our model assumes that <length> in end range is calculated from the end of the named range\n return `${range.name || 'cover'} ${\n isEnd && range.offset!.unit !== 'percentage'\n ? `calc(100% + ${getLength(range.offset!)}${add ? ` + ${add}` : ''})`\n : add\n ? `calc(${getLength(range.offset!)} + ${add})`\n : getLength(range.offset!)\n }`;\n}\n\nfunction getRanges(effect: AnimationDataForScrub) {\n return {\n start: getRange(effect.startOffset!, effect.startOffsetAdd),\n end: getRange(effect.endOffset!, effect.endOffsetAdd, true),\n };\n}\n\nfunction measure(target: HTMLElement | null): MeasureCallback {\n return (fn) => fastdom.measure(() => fn(target));\n}\n\nfunction mutate(target: HTMLElement | null): MeasureCallback {\n return (fn) => fastdom.mutate(() => fn(target));\n}\n\nfunction getNamedEffect(animation: AnimationOptions) {\n if (animation.namedEffect) {\n const effectName = animation.namedEffect.type;\n return typeof effectName === 'string' ? getRegisteredEffect(effectName) : null;\n } else if (animation.keyframeEffect) {\n const effect = (animation_: AnimationOptions) => {\n const { name, keyframes } = animation_.keyframeEffect!;\n\n return [{ ...animation_, name, keyframes }];\n };\n const getNames = (animation_: AnimationOptions) => {\n const { effectId } = animation_;\n const { name } = animation_.keyframeEffect!;\n const uid = name || effectId;\n\n return uid ? [uid] : [];\n };\n return { web: effect, style: effect, getNames };\n } else if (animation.customEffect) {\n return (animation_: AnimationOptions) => [{ ...animation_, keyframes: [] }];\n }\n return null;\n}\n\nfunction getEffectsData(\n animations: AnimationData[],\n trigger?: Partial<TriggerVariant>,\n effectId?: string,\n) {\n // process each AnimationData object into a KeyframeEffect object\n return animations.map((effect, index) => {\n // prepare the KeyframeEffectOptions object\n const effectOptions = {\n fill: effect.fill,\n easing: getEasing(effect.easing),\n iterations: effect.iterations === 0 ? Infinity : effect.iterations || 1,\n composite: effect.composite,\n direction: getDirection(effect),\n } as KeyframeEffectOptions & { rangeStart: string; rangeEnd: string };\n\n // if this is a time-based animation then set the duration and delay as time values\n if (isNotAScrubTrigger(trigger)) {\n effectOptions.duration = effect.duration as number;\n effectOptions.delay = (effect as TimeAnimationOptions).delay || 0;\n } else {\n // if ViewTimeline is supported AND this is a view-progress trigger\n if (window.ViewTimeline && trigger?.trigger === 'view-progress') {\n // set duration to 'auto'\n effectOptions.duration = 'auto';\n } else {\n // if ViewTimeline not supported then put a 100ms value in duration get a progress we can easily relate to\n // we split the duration to 99.99ms and delay of 0.01ms to get the fill-mode effect working\n effectOptions.duration = 99.99;\n effectOptions.delay = 0.01;\n }\n }\n\n return {\n effect,\n options: effectOptions,\n id: effectId && `${effectId}-${index + 1}`,\n part: effect.part,\n };\n });\n}\n\nfunction isNotAScrubTrigger(trigger?: Partial<TriggerVariant>) {\n return !trigger || (trigger.trigger !== 'pointer-move' && trigger.trigger !== 'view-progress');\n}\n\nexport {\n isNotAScrubTrigger,\n getElement,\n getElementMotionPart,\n getNamedEffect,\n getEffectsData,\n measure,\n mutate,\n getDirection,\n getLength,\n getRanges,\n};\n","import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n getElementMotionPart,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n isNotAScrubTrigger,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n trigger?: Partial<TriggerVariant>,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance | null {\n const element = target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move' && !animationOptions.keyframeEffect) {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n trigger,\n options,\n ) as MouseAnimationFactory;\n\n if (typeof mouseAnimationFactory !== 'function') {\n return null;\n }\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(animationOptions) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n trigger,\n options,\n ) as AnimationData[];\n\n // Return null if animation data cannot be generated\n if (!animationsData || animationsData.length === 0) {\n return null;\n }\n\n const data = getEffectsData(animationsData, trigger, animationOptions.effectId);\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part ? getElementMotionPart(element, part) : element;\n\n const keyframeEffect = new KeyframeEffect(effectTarget || null, [], effectOptions);\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline ? { timeline: timeline as AnimationTimeline } : {};\n const animation: Animation | CustomAnimation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } = animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite = (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite = (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n });\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n","import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n TriggerVariant,\n} from '../types';\nimport { getEffectsData, getRanges, getNamedEffect, isNotAScrubTrigger } from './common';\n\nfunction getAnimationTarget(target: string | null, part: string | undefined) {\n return target ? `#${target}${part ? `[data-motion-part~=\"${part}\"]` : ''}` : '';\n}\n\nfunction getAnimationAsCSS(\n data: {\n effect: AnimationData;\n options: KeyframeEffectOptions;\n id: string | undefined;\n part: string | undefined;\n },\n isRunning?: boolean,\n) {\n const { duration, delay, iterations = 1, fill, easing = 'linear', direction } = data.options;\n const animationName = data.effect.name;\n const isAutoDuration = duration === 'auto';\n\n return `${animationName} ${isAutoDuration ? 'auto' : `${duration}ms`}${\n isAutoDuration ? ' ' : ` ${delay || 1}ms `\n }${easing}${fill && fill !== 'none' ? ` ${fill}` : ''} ${\n !iterations || iterations === Infinity ? 'infinite' : iterations\n }${direction === 'normal' ? '' : ` ${direction}`} ${isRunning ? '' : 'paused'}`;\n}\n\nfunction getCSSAnimationEffect(\n preset: AnimationEffectAPI<any> | null,\n animation: AnimationOptions,\n trigger?: Partial<TriggerVariant>,\n): AnimationData[] {\n if (preset?.style) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n }\n\n return preset.style(animation);\n }\n\n return [];\n}\n\nfunction getCSSAnimation(\n target: string | null,\n animationOptions: AnimationOptions,\n trigger?: TriggerVariant,\n) {\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(animationOptions) as AnimationEffectAPI<any> | null;\n\n const animationsData = getCSSAnimationEffect(namedEffect, animationOptions);\n const data = getEffectsData(animationsData, trigger, animationOptions.effectId);\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n return data.map((item, index) => {\n const { start, end }: { start?: string; end?: string } = isViewProgress\n ? getRanges(item.effect as AnimationDataForScrub)\n : {};\n\n return {\n target: getAnimationTarget(target, item.part),\n animation: getAnimationAsCSS(item, isViewProgress),\n composition: item.options.composite,\n custom: item.effect.custom,\n name: item.effect.name,\n keyframes: item.effect.keyframes,\n id: item.id && `${item.id}-${index + 1}`,\n animationTimeline: isViewProgress ? `--${trigger?.id}` : '',\n animationRange: start || end ? `${start} ${end}` : '',\n };\n });\n}\n\nexport { getCSSAnimation, getCSSAnimationEffect, getAnimationAsCSS };\n","import type { AnimationEffectAPI, AnimationOptions, TimeAnimationOptions } from '../types';\nimport { getElement, getNamedEffect, measure, mutate } from './common';\nimport fastdom from 'fastdom';\n\nfunction prepareAnimation(\n target: HTMLElement | string | null,\n animation: AnimationOptions,\n callback?: () => void,\n) {\n const preset = getNamedEffect(animation);\n const element = target instanceof HTMLElement ? target : getElement(target);\n\n if (preset && (preset as AnimationEffectAPI<'time'>).prepare && element) {\n const domApi = { measure: measure(element), mutate: mutate(element) };\n\n (preset as AnimationEffectAPI<'time'>).prepare!(animation as TimeAnimationOptions, domApi);\n }\n\n if (callback) {\n fastdom.mutate(callback);\n }\n}\n\nexport { prepareAnimation };\n","import type {\n AnimationOptions,\n ScrubAnimationOptions,\n TriggerVariant,\n MouseAnimationInstance,\n AnimationEffectAPI,\n CustomMouseAnimationInstance,\n ScrubScrollScene,\n ScrubPointerScene,\n PointerMoveAxis,\n SequenceOptions,\n AnimationGroupArgs,\n} from './types';\nimport { AnimationGroup } from './AnimationGroup';\nimport { Sequence } from './Sequence';\nimport { getEasing, getJsEasing } from './utils';\nimport { getWebAnimation } from './api/webAnimations';\nimport { getCSSAnimation } from './api/cssAnimations';\nimport { prepareAnimation } from './api/prepare';\nimport { getElement, getNamedEffect } from './api/common';\n\nfunction getElementCSSAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n): AnimationGroup | null {\n const namedEffect = getNamedEffect(animationOptions) as AnimationEffectAPI<any> | null;\n\n if (!namedEffect) {\n return null;\n }\n\n if (!namedEffect.style) {\n // if this named effect does not have a style method, attempt to get group of Web Animations\n if (animationOptions.effectId && target) {\n return getElementAnimation(target, animationOptions.effectId);\n }\n\n return null;\n }\n\n const effectNames = namedEffect.getNames(animationOptions);\n const element = typeof target === 'string' ? getElement(target) : target;\n const animations = element?.getAnimations();\n const animationNames =\n animations?.map((anim) => (anim as CSSAnimation).animationName) || ([] as string[]);\n const filteredAnimations: CSSAnimation[] = [];\n\n effectNames.forEach((name) => {\n if (animationNames.includes(name)) {\n filteredAnimations.push(\n animations?.find((anim) => (anim as CSSAnimation).animationName === name) as CSSAnimation,\n );\n }\n });\n\n return filteredAnimations?.length ? new AnimationGroup(filteredAnimations) : null;\n}\n\nfunction getElementAnimation(\n target: HTMLElement | string,\n effectId: string,\n): AnimationGroup | null {\n const element = typeof target === 'string' ? getElement(target) : target;\n // somehow get the right animations\n const animations = element?.getAnimations().filter((anim: Animation | CSSAnimation) => {\n const id = anim.id || (anim as CSSAnimation).animationName;\n // if no id/name just return all animations\n return id ? id.startsWith(effectId) : true;\n });\n\n return animations?.length ? new AnimationGroup(animations) : null;\n}\n\nfunction getScrubScene(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger: Partial<TriggerVariant> & { element?: HTMLElement },\n sceneOptions: Record<string, any> = {},\n): ScrubScrollScene[] | ScrubPointerScene | ScrubPointerScene[] | null {\n const { disabled, allowActiveEvent, ...rest } = sceneOptions;\n const animation = getWebAnimation(target, animationOptions, trigger, rest);\n\n // Return null if animation could not be created\n if (!animation) {\n return null;\n }\n\n let typeSpecificOptions = {} as Record<string, any>;\n\n if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {\n // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects\n const viewSource = trigger.element || getElement(trigger.componentId!);\n const { ready } = animation as AnimationGroup;\n\n return (animation as AnimationGroup).animations.map((partialAnimation) => {\n return {\n /* we use getters for start and end in order to access the animation's start and end\n only when initializing the scrub scene rather than immediately */\n get start() {\n return partialAnimation.start;\n },\n get end() {\n return partialAnimation.end;\n },\n viewSource,\n ready,\n getProgress() {\n return (animation as AnimationGroup).getProgress();\n },\n effect(__: any, p: number) {\n const { activeDuration } = partialAnimation.effect!.getComputedTiming();\n const { delay } = partialAnimation.effect!.getTiming();\n\n partialAnimation.currentTime = ((delay || 0) + ((activeDuration as number) || 0)) * p;\n },\n disabled,\n destroy() {\n partialAnimation.cancel();\n },\n } as ScrubScrollScene;\n });\n } else if (trigger.trigger === 'pointer-move') {\n const scrubOptions = animationOptions as ScrubAnimationOptions;\n const { centeredToTarget, transitionDuration, transitionEasing } = scrubOptions;\n const axis = (trigger as { axis?: PointerMoveAxis }).axis;\n\n if (scrubOptions.keyframeEffect) {\n const animationGroup = animation as AnimationGroup;\n\n if (animationGroup.animations?.length === 0) {\n return null;\n }\n\n const scene: ScrubPointerScene & { _currentProgress: number } = {\n target: undefined,\n centeredToTarget,\n ready: animationGroup.ready,\n _currentProgress: 0,\n getProgress() {\n return this._currentProgress;\n },\n effect(__: any, p: { x: number; y: number }) {\n const linearProgress = axis === 'x' ? p.x : p.y;\n this._currentProgress = linearProgress;\n animationGroup.progress(linearProgress);\n },\n disabled: disabled ?? false,\n destroy() {\n animationGroup.cancel();\n },\n };\n\n return scene;\n }\n\n typeSpecificOptions = {\n centeredToTarget,\n allowActiveEvent,\n };\n\n if (animationOptions.customEffect && transitionDuration) {\n typeSpecificOptions.transitionDuration = transitionDuration;\n // TODO: refactor js easings\n typeSpecificOptions.transitionEasing = getJsEasing(transitionEasing);\n }\n typeSpecificOptions.target = (animation as MouseAnimationInstance).target;\n }\n\n return {\n ...typeSpecificOptions,\n getProgress() {\n return (animation as AnimationGroup | CustomMouseAnimationInstance).getProgress();\n },\n effect(\n __: any,\n p: number | { x: number; y: number },\n v?: { x: number; y: number },\n active?: boolean,\n ) {\n animation.progress(\n v\n ? {\n // @ts-expect-error spread error on p\n ...p,\n v,\n active,\n }\n : p,\n );\n },\n disabled,\n destroy() {\n animation.cancel();\n },\n } as ScrubPointerScene;\n}\n\nfunction getAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n reducedMotion: boolean = false,\n): AnimationGroup | MouseAnimationInstance | null {\n const animation = getElementCSSAnimation(target, animationOptions);\n\n if (animation) {\n animation.ready = new Promise((resolve) => {\n prepareAnimation(target, animationOptions, resolve);\n });\n\n return animation;\n }\n\n return getWebAnimation(target, animationOptions, trigger, { reducedMotion });\n}\n\nfunction resolveTargets(\n target: HTMLElement | HTMLElement[] | string | null,\n): (HTMLElement | null)[] {\n if (target === null) return [null];\n if (typeof target === 'string') {\n return Array.from(document.querySelectorAll<HTMLElement>(target));\n }\n if (Array.isArray(target)) return target;\n\n return [target];\n}\n\n/**\n * Creates AnimationGroup instances from AnimationGroupArgs without wrapping them in a Sequence.\n */\nfunction createAnimationGroups(\n animationGroupArgs: AnimationGroupArgs[],\n context?: Record<string, any>,\n): AnimationGroup[] {\n const groups: AnimationGroup[] = [];\n\n for (const { target, options: animationGroupOptions } of animationGroupArgs) {\n const elements = resolveTargets(target);\n\n for (const element of elements) {\n const result = getAnimation(\n element,\n animationGroupOptions,\n undefined,\n context?.reducedMotion,\n );\n\n if (result instanceof AnimationGroup) {\n groups.push(result);\n }\n }\n }\n\n return groups;\n}\n\n/**\n * Creates a Sequence that coordinates multiple AnimationGroups with staggered delays.\n */\nfunction getSequence(\n options: SequenceOptions,\n animationGroups: AnimationGroupArgs[],\n context?: Record<string, any>,\n): Sequence {\n const groups = createAnimationGroups(animationGroups, context);\n return new Sequence(groups, options);\n}\n\nexport {\n getCSSAnimation,\n getWebAnimation,\n getElementCSSAnimation,\n getElementAnimation,\n getScrubScene,\n prepareAnimation,\n getAnimation,\n getSequence,\n createAnimationGroups,\n getEasing,\n};\n\nexport type { AnimationGroup, Sequence };\n"],"names":["AnimationGroup","animations","options","callback","animation","p","delay","duration","iterations","time","rate","a","target","endEvent","_error","timing","linear","sineIn","sineOut","sineInOut","quadIn","quadOut","quadInOut","cubicIn","cubicOut","cubicInOut","quartIn","quartOut","quartInOut","quintIn","quintOut","quintInOut","expoIn","expoOut","expoInOut","circIn","circOut","circInOut","backIn","backOut","backInOut","k","jsEasings","cssEasings","getCssUnits","unit","getEasing","easing","cubicBezierEasing","x1","y1","x2","y2","cx","bx","ax","cy","by","ay","sampleX","t","sampleY","sampleDX","solveT","x","i","dx","d","lo","hi","xMid","parseCubicBezier","str","m","parseCssLinear","parts","s","stops","part","tokens","output","pcts","v","start","end","startPos","endPos","span","j","resolved","last","mid","b","getJsEasing","named","Sequence","animationGroups","allAnimations","group","g","count","_","offsets","sequenceDuration","groupIdx","animIdx","effect","baseDelay","endDelay","result","activeDuration","max","entries","sorted","index","clampedIndex","flatAnimations","insertAt","sum","CustomAnimation","customEffect","effectOptions","timingOptions","timeline","progress","error","speed","uid","tl","cb","playbackRate","type","listener","event","getDefaultExportFromCjs","win","debug","raf","FastDom","self","tasks","task","fn","ctx","scheduleFlush","remove","props","child","mixin","fastdom","flush","writes","reads","e","array","item","source","key","exports","module","this","registry","registerEffects","effects","getRegisteredEffect","name","getElement","id","ownerDocument","getElementMotionPart","element","getDirection","alternate","getLength","length","getRange","range","add","isEnd","getRanges","measure","mutate","getNamedEffect","effectName","animation_","keyframes","effectId","getEffectsData","trigger","isNotAScrubTrigger","getWebAnimationEffect","preset","domApi","getWebAnimation","animationOptions","mouseAnimationPreset","mouseAnimationFactory","namedEffect","animationsData","data","isViewProgress","effectTarget","keyframeEffect","startOffset","endOffset","startOffsetToWrite","endOffsetToWrite","resolve","getAnimationTarget","getAnimationAsCSS","isRunning","fill","direction","animationName","isAutoDuration","getCSSAnimationEffect","getCSSAnimation","prepareAnimation","getElementCSSAnimation","getElementAnimation","effectNames","animationNames","anim","filteredAnimations","getScrubScene","sceneOptions","disabled","allowActiveEvent","rest","typeSpecificOptions","viewSource","ready","partialAnimation","__","scrubOptions","centeredToTarget","transitionDuration","transitionEasing","axis","animationGroup","linearProgress","active","getAnimation","reducedMotion","resolveTargets","createAnimationGroups","animationGroupArgs","context","groups","animationGroupOptions","elements","getSequence"],"mappings":"aAQO,OAAA,eAAA,QAAA,OAAA,YAAA,CAAA,MAAA,QAAA,CAAA,EAAA,MAAMA,CAAe,CAC1B,WAIA,QACA,MACA,MAEA,YAAYC,EAAyBC,EAAiC,CACpE,KAAK,WAAaD,EAClB,KAAK,QAAUC,EACf,KAAK,MAAQA,GAAS,UAAY,QAAQ,QAAA,EAC1C,KAAK,MAAQD,EAAW,CAAC,YAAa,YACxC,CAEA,aAAc,CACZ,OAAO,KAAK,WAAW,CAAC,GAAG,QAAQ,kBAAA,EAAoB,UAAY,CACrE,CAEA,MAAM,KAAKE,EAAsC,CAC/C,MAAM,KAAK,MAEX,UAAWC,KAAa,KAAK,WAC3BA,EAAU,KAAA,EAKZ,MAAM,QAAQ,IAAI,KAAK,WAAW,IAAKA,GAAcA,EAAU,KAAK,CAAC,EAEjED,GACFA,EAAA,CAEJ,CAEA,OAAQ,CACN,UAAWC,KAAa,KAAK,WAC3BA,EAAU,MAAA,CAEd,CAEA,MAAM,QAAQD,EAAsC,CAClD,MAAM,KAAK,MAEX,UAAWC,KAAa,KAAK,WAC3BA,EAAU,QAAA,EAKZ,MAAM,QAAQ,IAAI,KAAK,WAAW,IAAKA,GAAcA,EAAU,KAAK,CAAC,EAEjED,GACFA,EAAA,CAEJ,CAEA,SAASE,EAAW,CAClB,UAAWD,KAAa,KAAK,WAAY,CACvC,KAAM,CAAE,MAAAE,EAAO,SAAAC,EAAU,WAAAC,GAAeJ,EAAU,O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AA,QAAA,QAAAE,EAAA,QAAA,WAAAE,GAAA,QAAA,SAAAD,GAAA,QAAA,gBAAAoI,GAAA,QAAA,OAAAjJ,EAAA,QAAA,UAAAE,EAAA,QAAA,QAAAD","x_google_ignoreList":[5]}
|
|
1
|
+
{"version":3,"file":"motion.js","sources":["../../src/AnimationGroup.ts","../../src/easings.ts","../../src/utils.ts","../../src/Sequence.ts","../../src/CustomAnimation.ts","../../../../node_modules/fastdom/fastdom.js","../../src/api/registry.ts","../../src/api/common.ts","../../src/api/webAnimations.ts","../../src/api/cssAnimations.ts","../../src/api/prepare.ts","../../src/motion.ts"],"sourcesContent":["import { AnimationGroupOptions, RangeOffset } from './types';\n\n/**\n * @class AnimationGroup\n *\n * A wrapper object for simulating a GroupEffect and managing multiple animations.\n * See: https://www.w3.org/TR/web-animations-2/#grouping-and-synchronization\n */\nexport class AnimationGroup {\n animations: (Animation & {\n start?: RangeOffset;\n end?: RangeOffset;\n })[];\n options?: AnimationGroupOptions;\n ready: Promise<void>;\n isCSS: boolean;\n\n constructor(animations: Animation[], options?: AnimationGroupOptions) {\n this.animations = animations;\n this.options = options;\n this.ready = options?.measured || Promise.resolve();\n this.isCSS = animations[0] instanceof CSSAnimation;\n }\n\n getProgress() {\n return this.animations[0]?.effect?.getComputedTiming().progress || 0;\n }\n\n async play(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.play();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n pause() {\n for (const animation of this.animations) {\n animation.pause();\n }\n }\n\n async reverse(callback?: () => void): Promise<void> {\n await this.ready;\n\n for (const animation of this.animations) {\n animation.reverse();\n }\n\n // TODO: Wait for all animations to be ready, using allSettled to handle rejections gracefully\n // await Promise.allSettled(\n await Promise.all(this.animations.map((animation) => animation.ready));\n\n if (callback) {\n callback();\n }\n }\n\n progress(p: number) {\n for (const animation of this.animations) {\n const { delay, duration, iterations } = animation.effect!.getTiming();\n const time =\n (Number.isFinite(duration) ? (duration as number) : 0) *\n (Number.isFinite(iterations) ? (iterations as number) : 1);\n animation.currentTime = ((delay || 0) + time) * p;\n }\n }\n\n cancel() {\n for (const animation of this.animations) {\n animation.cancel();\n }\n }\n\n setPlaybackRate(rate: number) {\n for (const animation of this.animations) {\n animation.playbackRate = rate;\n }\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animations.map((animation) => animation.finished));\n\n const a = this.animations[0];\n\n if (a && !this.isCSS) {\n const target = (a.effect as KeyframeEffect)?.target;\n\n if (target) {\n const endEvent = new Event('animationend');\n target.dispatchEvent(endEvent);\n }\n }\n\n callback();\n } catch (_error) {\n console.warn('animation was interrupted - aborting onFinish callback - ', _error);\n }\n }\n\n get finished() {\n return Promise.all(this.animations.map((animation) => animation.finished));\n }\n\n get playState() {\n return this.animations[0]?.playState;\n }\n\n getTimingOptions() {\n return this.animations.map((a) => {\n const timing = a.effect?.getTiming();\n const delay = timing?.delay ?? 0;\n const duration = Number(timing?.duration) || 0;\n const iterations = timing?.iterations ?? 1;\n\n return {\n delay,\n duration,\n iterations,\n };\n });\n }\n}\n","/**\n * @file Easing functions as defined by Robert Penner.\n * @example A playground I made https://codepen.io/tombigel/pen/eYLLVRg\n */\n\n/**\n * Linear easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const linear = (t: number) => t;\n\n/**\n * Sine-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const sineIn = (t: number) => 1 - Math.cos((t * Math.PI) / 2);\n\n/**\n * Sine-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const sineOut = (t: number) => Math.sin((t * Math.PI) / 2);\n\n/**\n * Sine-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const sineInOut = (t: number) => -(Math.cos(Math.PI * t) - 1) / 2;\n\n/**\n * Quadratic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quadIn = (t: number) => t ** 2;\n\n/**\n * Quadratic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quadOut = (t: number) => 1 - (1 - t) ** 2;\n\n/**\n * Quadratic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quadInOut = (t: number) => (t < 0.5 ? 2 * t ** 2 : 1 - (-2 * t + 2) ** 2 / 2);\n\n/**\n * Cubic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const cubicIn = (t: number) => t ** 3;\n\n/**\n * Cubic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const cubicOut = (t: number) => 1 - (1 - t) ** 3;\n\n/**\n * Cubic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const cubicInOut = (t: number) => (t < 0.5 ? 4 * t ** 3 : 1 - (-2 * t + 2) ** 3 / 2);\n\n/**\n * Quartic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quartIn = (t: number) => t ** 4;\n\n/**\n * Quartic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quartOut = (t: number) => 1 - (1 - t) ** 4;\n\n/**\n * Quartic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quartInOut = (t: number) => (t < 0.5 ? 8 * t ** 4 : 1 - (-2 * t + 2) ** 4 / 2);\n\n/**\n * Quintic-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quintIn = (t: number) => t ** 5;\n\n/**\n * Quintic-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quintOut = (t: number) => 1 - (1 - t) ** 5;\n\n/**\n * Quintic-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const quintInOut = (t: number) => (t < 0.5 ? 16 * t ** 5 : 1 - (-2 * t + 2) ** 5 / 2);\n\n/**\n * Exponential-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const expoIn = (t: number) => (t === 0 ? 0 : 2 ** (10 * t - 10));\n\n/**\n * Exponential-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const expoOut = (t: number) => (t === 1 ? 1 : 1 - 2 ** (-10 * t));\n\n/**\n * Exponential-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const expoInOut = (t: number) =>\n t === 0 ? 0 : t === 1 ? 1 : t < 0.5 ? 2 ** (20 * t - 10) / 2 : (2 - 2 ** (-20 * t + 10)) / 2;\n\n/**\n * Circular-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const circIn = (t: number) => 1 - Math.sqrt(1 - t ** 2);\n\n/**\n * Circular-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const circOut = (t: number) => Math.sqrt(1 - (t - 1) ** 2);\n\n/**\n * Circular-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const circInOut = (t: number) =>\n t < 0.5 ? (1 - Math.sqrt(1 - 4 * t ** 2)) / 2 : (Math.sqrt(-(2 * t - 3) * (2 * t - 1)) + 1) / 2;\n\n/**\n * Back-in easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const backIn = (t: number) => 2.70158 * t ** 3 - 1.70158 * t ** 2;\n\n/**\n * Back-out easing function.\n * @param t - The time value (between 0 and 1).\n * @returns The eased value.\n */\nexport const backOut = (t: number) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2;\n\n/**\n * Back-in-out easing function.\n * @param t - The time value (between 0 and 1).\n * @param k - The back factor (optional, default is 1.70158 * 1.525).\n * @returns The eased value.\n */\nexport const backInOut = (t: number, k = 1.70158 * 1.525) =>\n t < 0.5\n ? ((2 * t) ** 2 * ((k + 1) * 2 * t - k)) / 2\n : ((2 * t - 2) ** 2 * ((k + 1) * (t * 2 - 2) + k) + 2) / 2;\n\nexport const jsEasings = {\n linear,\n sineIn,\n sineOut,\n sineInOut,\n quadIn,\n quadOut,\n quadInOut,\n cubicIn,\n cubicOut,\n cubicInOut,\n quartIn,\n quartOut,\n quartInOut,\n quintIn,\n quintOut,\n quintInOut,\n expoIn,\n expoOut,\n expoInOut,\n circIn,\n circOut,\n circInOut,\n backIn,\n backOut,\n backInOut,\n};\n\n/**\n * CSS cubic-bezier easings based on PostCSS Easings\n */\nexport const cssEasings = {\n linear: 'linear',\n ease: 'ease',\n easeIn: 'ease-in',\n easeOut: 'ease-out',\n easeInOut: 'ease-in-out',\n sineIn: 'cubic-bezier(0.47, 0, 0.745, 0.715)',\n sineOut: 'cubic-bezier(0.39, 0.575, 0.565, 1)',\n sineInOut: 'cubic-bezier(0.445, 0.05, 0.55, 0.95)',\n quadIn: 'cubic-bezier(0.55, 0.085, 0.68, 0.53)',\n quadOut: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)',\n quadInOut: 'cubic-bezier(0.455, 0.03, 0.515, 0.955)',\n cubicIn: 'cubic-bezier(0.55, 0.055, 0.675, 0.19)',\n cubicOut: 'cubic-bezier(0.215, 0.61, 0.355, 1)',\n cubicInOut: 'cubic-bezier(0.645, 0.045, 0.355, 1)',\n quartIn: 'cubic-bezier(0.895, 0.03, 0.685, 0.22)',\n quartOut: 'cubic-bezier(0.165, 0.84, 0.44, 1)',\n quartInOut: 'cubic-bezier(0.77, 0, 0.175, 1)',\n quintIn: 'cubic-bezier(0.755, 0.05, 0.855, 0.06)',\n quintOut: 'cubic-bezier(0.23, 1, 0.32, 1)',\n quintInOut: 'cubic-bezier(0.86, 0, 0.07, 1)',\n expoIn: 'cubic-bezier(0.95, 0.05, 0.795, 0.035)',\n expoOut: 'cubic-bezier(0.19, 1, 0.22, 1)',\n expoInOut: 'cubic-bezier(1, 0, 0, 1)',\n circIn: 'cubic-bezier(0.6, 0.04, 0.98, 0.335)',\n circOut: 'cubic-bezier(0.075, 0.82, 0.165, 1)',\n circInOut: 'cubic-bezier(0.785, 0.135, 0.15, 0.86)',\n backIn: 'cubic-bezier(0.6, -0.28, 0.735, 0.045)',\n backOut: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',\n backInOut: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',\n} as const;\n","import { cssEasings, jsEasings } from './easings';\n\nexport function getCssUnits(unit: 'percentage' | string) {\n return unit === 'percentage' ? '%' : unit || 'px';\n}\n\nexport function getEasing(easing?: keyof typeof cssEasings | string): string {\n return easing ? cssEasings[easing as keyof typeof cssEasings] || easing : cssEasings.linear;\n}\n\nfunction cubicBezierEasing(x1: number, y1: number, x2: number, y2: number): (t: number) => number {\n const cx = 3 * x1;\n const bx = 3 * (x2 - x1) - cx;\n const ax = 1 - cx - bx;\n const cy = 3 * y1;\n const by = 3 * (y2 - y1) - cy;\n const ay = 1 - cy - by;\n\n const sampleX = (t: number) => ((ax * t + bx) * t + cx) * t;\n const sampleY = (t: number) => ((ay * t + by) * t + cy) * t;\n const sampleDX = (t: number) => (3 * ax * t + 2 * bx) * t + cx;\n\n function solveT(x: number): number {\n let t = x;\n\n for (let i = 0; i < 8; i++) {\n const dx = sampleX(t) - x;\n\n if (Math.abs(dx) < 1e-7) return t;\n\n const d = sampleDX(t);\n\n if (Math.abs(d) < 1e-6) break;\n\n t -= dx / d;\n }\n // Bisection fallback\n let lo = 0,\n hi = 1;\n t = (lo + hi) / 2;\n\n while (hi - lo > 1e-7) {\n const xMid = sampleX(t);\n if (Math.abs(xMid - x) < 1e-7) return t;\n if (x > xMid) lo = t;\n else hi = t;\n t = (lo + hi) / 2;\n }\n\n return t;\n }\n\n return (t: number) => {\n if (t <= 0) return 0;\n if (t >= 1) return 1;\n return sampleY(solveT(t));\n };\n}\n\nfunction parseCubicBezier(str: string): ((t: number) => number) | undefined {\n const m = str.match(\n /^cubic-bezier\\(\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*,\\s*(-?[\\d.]+)\\s*\\)$/,\n );\n\n if (!m) return undefined;\n\n const x1 = parseFloat(m[1]);\n const y1 = parseFloat(m[2]);\n const x2 = parseFloat(m[3]);\n const y2 = parseFloat(m[4]);\n\n if ([x1, y1, x2, y2].some(isNaN)) return undefined;\n\n return cubicBezierEasing(x1, y1, x2, y2);\n}\n\nfunction parseCssLinear(str: string): ((t: number) => number) | undefined {\n const m = str.match(/^linear\\((.+)\\)$/);\n if (!m) return undefined;\n\n const parts = m[1]\n .split(',')\n .map((s) => s.trim())\n .filter(Boolean);\n\n if (parts.length === 0) return undefined;\n\n type Stop = { output: number; pos: number | null };\n const stops: Stop[] = [];\n\n for (const part of parts) {\n const tokens = part.split(/\\s+/);\n const output = parseFloat(tokens[0]);\n\n if (isNaN(output)) return undefined;\n\n const pcts: number[] = [];\n\n for (let i = 1; i < tokens.length; i++) {\n if (tokens[i].endsWith('%')) {\n const v = parseFloat(tokens[i]) / 100;\n if (isNaN(v)) return undefined;\n pcts.push(v);\n }\n }\n\n if (pcts.length === 0) {\n stops.push({ output, pos: null });\n } else if (pcts.length === 1) {\n stops.push({ output, pos: pcts[0] });\n } else {\n // Two percentages: creates a plateau between the two positions\n stops.push({ output, pos: pcts[0] });\n stops.push({ output, pos: pcts[1] });\n }\n }\n\n if (stops.length === 0) return undefined;\n if (stops[0].pos === null) stops[0].pos = 0;\n if (stops[stops.length - 1].pos === null) stops[stops.length - 1].pos = 1;\n\n // Distribute positions for stops without an explicit position\n let i = 0;\n\n while (i < stops.length) {\n if (stops[i].pos === null) {\n const start = i - 1;\n let end = i;\n\n while (end < stops.length && stops[end].pos === null) end++;\n\n const startPos = stops[start].pos!;\n const endPos = stops[end].pos!;\n const span = end - start;\n\n for (let k = start + 1; k < end; k++) {\n stops[k].pos = startPos + ((endPos - startPos) * (k - start)) / span;\n }\n\n i = end + 1;\n } else {\n i++;\n }\n }\n\n // Clamp: each stop must be no earlier than the previous one\n for (let j = 1; j < stops.length; j++) {\n if (stops[j].pos! < stops[j - 1].pos!) stops[j].pos = stops[j - 1].pos;\n }\n\n const resolved = stops as Array<{ output: number; pos: number }>;\n\n return (t: number) => {\n if (t <= resolved[0].pos) return resolved[0].output;\n\n const last = resolved[resolved.length - 1];\n\n if (t >= last.pos) return last.output;\n\n let lo = 0,\n hi = resolved.length - 1;\n\n while (lo < hi - 1) {\n const mid = (lo + hi) >>> 1;\n\n if (resolved[mid].pos <= t) lo = mid;\n else hi = mid;\n }\n\n const a = resolved[lo];\n const b = resolved[hi];\n if (b.pos === a.pos) return b.output;\n return a.output + ((b.output - a.output) * (t - a.pos)) / (b.pos - a.pos);\n };\n}\n\nexport function getJsEasing(\n easing?: keyof typeof jsEasings | string,\n): ((t: number) => number) | undefined {\n if (!easing) return undefined;\n\n const named = jsEasings[easing as keyof typeof jsEasings];\n\n if (named) return named;\n\n return parseCubicBezier(easing) ?? parseCssLinear(easing) ?? jsEasings.linear;\n}\n","import { AnimationGroup } from './AnimationGroup';\nimport type { IndexedGroup, SequenceOptions } from './types';\nimport { linear } from './easings';\nimport { getJsEasing } from './utils';\n\n/**\n * @class Sequence\n *\n * Manages multiple AnimationGroups as a coordinated timeline with staggered delays.\n * Extends AnimationGroup to inherit the playback control API while delegating\n * to child AnimationGroup instances.\n */\nexport class Sequence extends AnimationGroup {\n animationGroups: AnimationGroup[];\n delay: number;\n offset: number;\n offsetEasing: (p: number) => number;\n private timingOptions: { delay: number; duration: number; iterations: number }[][];\n\n constructor(animationGroups: AnimationGroup[], options: SequenceOptions = {}) {\n const allAnimations = animationGroups.flatMap((group) => [...group.animations]);\n super(allAnimations);\n\n this.animationGroups = animationGroups;\n this.delay = options.delay ?? 0;\n this.offset = options.offset ?? 0;\n this.offsetEasing =\n typeof options.offsetEasing === 'function'\n ? options.offsetEasing\n : (getJsEasing(options.offsetEasing) ?? linear);\n\n this.timingOptions = this.animationGroups.map((g) => {\n return g.getTimingOptions().map(({ delay, duration, iterations }) => {\n return {\n delay,\n duration: Number.isFinite(duration) ? duration : 0,\n iterations: Number.isFinite(iterations) ? iterations : 1,\n };\n });\n });\n\n this.applyOffsets();\n\n this.ready = Promise.all(animationGroups.map((g) => g.ready)).then(() => {});\n }\n\n /**\n * Calculates stagger delay offsets for each animation group using the formula:\n * easing(i / last) * last * offset\n * where i is the group index and last is the index of the final group.\n */\n private calculateOffsets(): number[] {\n const count = this.animationGroups.length;\n if (count <= 1) return [0];\n\n const last = count - 1;\n\n return Array.from(\n { length: count },\n (_, i) => (this.offsetEasing(i / last) * last * this.offset) | 0,\n );\n }\n\n private applyOffsets(): void {\n const offsets = this.calculateOffsets();\n const sequenceDuration = this.getSequenceActiveDuration(offsets);\n\n this.animationGroups.forEach((group, groupIdx) => {\n group.animations.forEach((animation, animIdx) => {\n const effect = animation.effect;\n\n if (!effect) return;\n\n const { delay: baseDelay, duration, iterations } = this.timingOptions[groupIdx][animIdx];\n const delay = baseDelay + offsets[groupIdx];\n const endDelay = sequenceDuration - (delay + duration * iterations);\n\n // add the sequence delay to the animation delay at the end - it doesn't need to affect the endDelay\n effect.updateTiming({ delay: delay + this.delay, endDelay });\n });\n });\n }\n\n private getSequenceActiveDuration(offsets: number[]): number {\n const result: number[] = [];\n\n for (let i = 0; i < this.timingOptions.length; i++) {\n const activeDuration = this.timingOptions[i].reduce((max, options) => {\n if (!options) return max;\n\n const { delay, duration, iterations } = options;\n\n return Math.max(max, delay + duration * iterations);\n }, 0);\n\n result.push(offsets[i] + activeDuration);\n }\n\n return Math.max(...result);\n }\n\n /**\n * Inserts new AnimationGroups at specified indices, then recalculates\n * stagger offsets for all groups. Each entry specifies the target index\n * in the animationGroups array where the group should be inserted.\n */\n addGroups(entries: IndexedGroup[]): void {\n if (entries.length === 0) return;\n\n const sorted = [...entries].sort((a, b) => b.index - a.index);\n\n for (const { index, group } of sorted) {\n const clampedIndex = Math.min(index, this.animationGroups.length);\n this.animationGroups.splice(clampedIndex, 0, group);\n this.timingOptions.splice(clampedIndex, 0, group.getTimingOptions());\n\n const flatAnimations = [...group.animations];\n const insertAt = this.animationGroups\n .slice(0, clampedIndex)\n .reduce((sum, g) => sum + g.animations.length, 0);\n this.animations.splice(insertAt, 0, ...flatAnimations);\n }\n\n this.applyOffsets();\n this.ready = Promise.all(this.animationGroups.map((g) => g.ready)).then(() => {});\n }\n\n /**\n * Removes AnimationGroups that match the predicate, then recalculates\n * stagger offsets for remaining groups. Cancelled animations in removed\n * groups are returned.\n */\n removeGroups(predicate: (group: AnimationGroup) => boolean): AnimationGroup[] {\n const removed: AnimationGroup[] = [];\n const keptGroups: AnimationGroup[] = [];\n const keptTimingOptions: { delay: number; duration: number; iterations: number }[][] = [];\n\n for (let i = 0; i < this.animationGroups.length; i++) {\n if (predicate(this.animationGroups[i])) {\n removed.push(this.animationGroups[i]);\n } else {\n keptGroups.push(this.animationGroups[i]);\n keptTimingOptions.push(this.timingOptions[i]);\n }\n }\n\n if (removed.length === 0) return removed;\n\n for (const group of removed) {\n group.cancel();\n }\n\n this.animationGroups = keptGroups;\n this.timingOptions = keptTimingOptions;\n this.animations = keptGroups.flatMap((group) => [...group.animations]);\n\n this.applyOffsets();\n this.ready = Promise.all(this.animationGroups.map((g) => g.ready)).then(() => {});\n\n return removed;\n }\n\n async onFinish(callback: () => void): Promise<void> {\n try {\n await Promise.all(this.animationGroups.map((group) => group.finished));\n callback();\n } catch (_error) {\n console.warn('animation was interrupted - aborting onFinish callback - ', _error);\n }\n }\n}\n","/**\n * @class CustomAnimation\n *\n * A wrapper object for Animation that mimics the same interface but implements CustomEffect that runs JS code instead of KeyframeEffect.\n * The class is implemented by holding an inner Animation object instead of inheritance due to some browsers not allowing extension of built-in objects.\n */\nexport class CustomAnimation {\n _animation: Animation;\n customEffect: (progress: number | null) => void;\n progress: number | null;\n _tickCbId: number | null;\n _finishHandler: (_: any) => void;\n\n constructor(\n customEffect: (element: Element | null, progress: number | null) => void,\n target: Element | null,\n effectOptions: KeyframeEffectOptions,\n timingOptions: { timeline?: AnimationTimeline | null },\n ) {\n // overriding composite so that animation is not replaced and removed\n const effect = new KeyframeEffect(target, [], {\n ...effectOptions,\n composite: 'add',\n });\n const { timeline } = timingOptions;\n this._animation = new Animation(effect, timeline);\n\n this._tickCbId = null;\n this.progress = null;\n this.customEffect = (progress: number | null) => customEffect(effect.target, progress);\n\n // stop loop if animation is removed from the DOM after finish (does not fire 'remove' event)\n this._finishHandler = (_: any) => {\n if (\n !(this.effect as KeyframeEffect).target?.getAnimations().find((a) => a === this._animation)\n ) {\n this.cancel();\n }\n };\n this.addEventListener('finish', this._finishHandler);\n this.addEventListener('remove', this._finishHandler);\n }\n\n // private tick method for customEffect loop implementation\n private _tick() {\n try {\n const progress = this.effect?.getComputedTiming().progress ?? null;\n if (progress !== this.progress) {\n this.customEffect?.(progress);\n this.progress = progress;\n }\n this._tickCbId = requestAnimationFrame(() => {\n this._tick();\n });\n } catch (error) {\n this._tickCbId = null;\n console.error(\n `failed to run customEffect! effectId: ${this.id}, error: ${\n error instanceof Error ? error.message : error\n }`,\n );\n }\n }\n\n // Animation timing properties\n get currentTime() {\n return this._animation.currentTime;\n }\n set currentTime(time: CSSNumberish | null) {\n this._animation.currentTime = time;\n }\n get startTime() {\n return this._animation.startTime;\n }\n set startTime(time: CSSNumberish | null) {\n this._animation.startTime = time;\n }\n get playbackRate() {\n return this._animation.playbackRate;\n }\n set playbackRate(speed: number) {\n this._animation.playbackRate = speed;\n }\n\n // Animation basic properties\n get id() {\n return this._animation.id;\n }\n set id(uid: string) {\n this._animation.id = uid;\n }\n get effect() {\n return this._animation.effect;\n }\n set effect(e: AnimationEffect | null) {\n this._animation.effect = e;\n }\n get timeline() {\n return this._animation.timeline;\n }\n set timeline(tl: AnimationTimeline | null) {\n this._animation.timeline = tl;\n }\n\n // Animation readonly state properties\n get finished() {\n return this._animation.finished;\n }\n get pending() {\n return this._animation.pending;\n }\n get playState() {\n return this._animation.playState;\n }\n get ready() {\n return this._animation.ready;\n }\n get replaceState() {\n return this._animation.replaceState;\n }\n\n // Animation event handlers\n get oncancel() {\n return this._animation.oncancel;\n }\n set oncancel(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null) {\n this._animation.oncancel = cb;\n }\n get onfinish() {\n return this._animation.onfinish;\n }\n set onfinish(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null) {\n this._animation.onfinish = cb;\n }\n get onremove() {\n return this._animation.onremove;\n }\n set onremove(cb: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null) {\n this._animation.onremove = cb;\n }\n\n // CustomAnimation overridden methods\n play() {\n this._animation.play();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = requestAnimationFrame(() => this._tick());\n }\n\n pause() {\n this._animation.pause();\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n cancel() {\n this.removeEventListener('finish', this._finishHandler);\n this.removeEventListener('remove', this._finishHandler);\n this._animation.cancel();\n // signaling cancelation for customEffect to handle it as desired\n this.customEffect(null);\n cancelAnimationFrame(this._tickCbId!);\n this._tickCbId = null;\n }\n\n commitStyles() {\n console.warn(\n 'CustomEffect animations do not support commitStyles method as they have no style to commit',\n );\n }\n\n // Animation methods without override\n finish() {\n this._animation.finish();\n }\n persist() {\n this._animation.persist();\n }\n reverse() {\n this._animation.reverse();\n }\n updatePlaybackRate(playbackRate: number) {\n this._animation.updatePlaybackRate(playbackRate);\n }\n\n // Animation events API\n addEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.addEventListener(type, listener, options);\n }\n removeEventListener(\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) {\n this._animation.removeEventListener(type, listener, options);\n }\n dispatchEvent(event: Event) {\n return this._animation.dispatchEvent(event);\n }\n}\n","!(function(win) {\n\n/**\n * FastDom\n *\n * Eliminates layout thrashing\n * by batching DOM read/write\n * interactions.\n *\n * @author Wilson Page <wilsonpage@me.com>\n * @author Kornel Lesinski <kornel.lesinski@ft.com>\n */\n\n'use strict';\n\n/**\n * Mini logger\n *\n * @return {Function}\n */\nvar debug = 0 ? console.log.bind(console, '[fastdom]') : function() {};\n\n/**\n * Normalized rAF\n *\n * @type {Function}\n */\nvar raf = win.requestAnimationFrame\n || win.webkitRequestAnimationFrame\n || win.mozRequestAnimationFrame\n || win.msRequestAnimationFrame\n || function(cb) { return setTimeout(cb, 16); };\n\n/**\n * Initialize a `FastDom`.\n *\n * @constructor\n */\nfunction FastDom() {\n var self = this;\n self.reads = [];\n self.writes = [];\n self.raf = raf.bind(win); // test hook\n debug('initialized', self);\n}\n\nFastDom.prototype = {\n constructor: FastDom,\n\n /**\n * We run this inside a try catch\n * so that if any jobs error, we\n * are able to recover and continue\n * to flush the batch until it's empty.\n *\n * @param {Array} tasks\n */\n runTasks: function(tasks) {\n debug('run tasks');\n var task; while (task = tasks.shift()) task();\n },\n\n /**\n * Adds a job to the read batch and\n * schedules a new frame if need be.\n *\n * @param {Function} fn\n * @param {Object} ctx the context to be bound to `fn` (optional).\n * @public\n */\n measure: function(fn, ctx) {\n debug('measure');\n var task = !ctx ? fn : fn.bind(ctx);\n this.reads.push(task);\n scheduleFlush(this);\n return task;\n },\n\n /**\n * Adds a job to the\n * write batch and schedules\n * a new frame if need be.\n *\n * @param {Function} fn\n * @param {Object} ctx the context to be bound to `fn` (optional).\n * @public\n */\n mutate: function(fn, ctx) {\n debug('mutate');\n var task = !ctx ? fn : fn.bind(ctx);\n this.writes.push(task);\n scheduleFlush(this);\n return task;\n },\n\n /**\n * Clears a scheduled 'read' or 'write' task.\n *\n * @param {Object} task\n * @return {Boolean} success\n * @public\n */\n clear: function(task) {\n debug('clear', task);\n return remove(this.reads, task) || remove(this.writes, task);\n },\n\n /**\n * Extend this FastDom with some\n * custom functionality.\n *\n * Because fastdom must *always* be a\n * singleton, we're actually extending\n * the fastdom instance. This means tasks\n * scheduled by an extension still enter\n * fastdom's global task queue.\n *\n * The 'super' instance can be accessed\n * from `this.fastdom`.\n *\n * @example\n *\n * var myFastdom = fastdom.extend({\n * initialize: function() {\n * // runs on creation\n * },\n *\n * // override a method\n * measure: function(fn) {\n * // do extra stuff ...\n *\n * // then call the original\n * return this.fastdom.measure(fn);\n * },\n *\n * ...\n * });\n *\n * @param {Object} props properties to mixin\n * @return {FastDom}\n */\n extend: function(props) {\n debug('extend', props);\n if (typeof props != 'object') throw new Error('expected object');\n\n var child = Object.create(this);\n mixin(child, props);\n child.fastdom = this;\n\n // run optional creation hook\n if (child.initialize) child.initialize();\n\n return child;\n },\n\n // override this with a function\n // to prevent Errors in console\n // when tasks throw\n catch: null\n};\n\n/**\n * Schedules a new read/write\n * batch if one isn't pending.\n *\n * @private\n */\nfunction scheduleFlush(fastdom) {\n if (!fastdom.scheduled) {\n fastdom.scheduled = true;\n fastdom.raf(flush.bind(null, fastdom));\n debug('flush scheduled');\n }\n}\n\n/**\n * Runs queued `read` and `write` tasks.\n *\n * Errors are caught and thrown by default.\n * If a `.catch` function has been defined\n * it is called instead.\n *\n * @private\n */\nfunction flush(fastdom) {\n debug('flush');\n\n var writes = fastdom.writes;\n var reads = fastdom.reads;\n var error;\n\n try {\n debug('flushing reads', reads.length);\n fastdom.runTasks(reads);\n debug('flushing writes', writes.length);\n fastdom.runTasks(writes);\n } catch (e) { error = e; }\n\n fastdom.scheduled = false;\n\n // If the batch errored we may still have tasks queued\n if (reads.length || writes.length) scheduleFlush(fastdom);\n\n if (error) {\n debug('task errored', error.message);\n if (fastdom.catch) fastdom.catch(error);\n else throw error;\n }\n}\n\n/**\n * Remove an item from an Array.\n *\n * @param {Array} array\n * @param {*} item\n * @return {Boolean}\n */\nfunction remove(array, item) {\n var index = array.indexOf(item);\n return !!~index && !!array.splice(index, 1);\n}\n\n/**\n * Mixin own properties of source\n * object into the target.\n *\n * @param {Object} target\n * @param {Object} source\n */\nfunction mixin(target, source) {\n for (var key in source) {\n if (source.hasOwnProperty(key)) target[key] = source[key];\n }\n}\n\n// There should never be more than\n// one instance of `FastDom` in an app\nvar exports = win.fastdom = (win.fastdom || new FastDom()); // jshint ignore:line\n\n// Expose to CJS & AMD\nif ((typeof define) == 'function') define(function() { return exports; });\nelse if ((typeof module) == 'object') module.exports = exports;\n\n})( typeof window !== 'undefined' ? window : typeof this != 'undefined' ? this : globalThis);\n","import type { EffectModule } from '../types';\n\nconst registry: Record<string, EffectModule> = {};\n\nexport function registerEffects(effects: Record<string, EffectModule>) {\n Object.assign(registry, effects);\n}\n\nexport function getRegisteredEffect(name: string) {\n if (name in registry) {\n return registry[name];\n } else {\n console.warn(\n `${name} not found in registry. Please make sure to import and register the preset.`,\n );\n return null;\n }\n}\n","import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationOptions,\n MeasureCallback,\n RangeOffset,\n TimeAnimationOptions,\n TriggerVariant,\n UnitLengthPercentage,\n} from '../types';\nimport { getCssUnits, getEasing } from '../utils';\nimport fastdom from 'fastdom';\nimport { getRegisteredEffect } from './registry';\n\nfunction getElement(id: string | null, ownerDocument?: Document): HTMLElement | null {\n return id ? (ownerDocument || document).getElementById(id) : null;\n}\n\nfunction getElementMotionPart(element: Element | null, part: string) {\n if (element?.matches(`[data-motion-part~=\"${part}\"]`)) {\n return element;\n }\n return element?.querySelector(`[data-motion-part~=\"${part}\"]`);\n}\n\nfunction getDirection(effect: AnimationData): KeyframeEffectOptions['direction'] {\n const alternate = effect.alternate ? 'alternate' : '';\n return effect.reversed\n ? (`${alternate ? `${alternate}-` : ''}reverse` as 'reverse' | 'alternate-reverse')\n : alternate || 'normal';\n}\n\nfunction getLength(length: UnitLengthPercentage): string {\n return `${length.value}${getCssUnits(length.unit)}`;\n}\n\nfunction getRange(range: RangeOffset, add: string | undefined, isEnd?: boolean) {\n // according to the CSS spec if the end range is a <length> then it is calculated from the start of the named range\n // our model assumes that <length> in end range is calculated from the end of the named range\n return `${range.name || 'cover'} ${\n isEnd && range.offset!.unit !== 'percentage'\n ? `calc(100% + ${getLength(range.offset!)}${add ? ` + ${add}` : ''})`\n : add\n ? `calc(${getLength(range.offset!)} + ${add})`\n : getLength(range.offset!)\n }`;\n}\n\nfunction getRanges(effect: AnimationDataForScrub) {\n return {\n start: getRange(effect.startOffset!, effect.startOffsetAdd),\n end: getRange(effect.endOffset!, effect.endOffsetAdd, true),\n };\n}\n\nfunction measure(target: HTMLElement | null): MeasureCallback {\n return (fn) => fastdom.measure(() => fn(target));\n}\n\nfunction mutate(target: HTMLElement | null): MeasureCallback {\n return (fn) => fastdom.mutate(() => fn(target));\n}\n\nfunction getNamedEffect(animation: AnimationOptions) {\n if (animation.namedEffect) {\n const effectName = animation.namedEffect.type;\n return typeof effectName === 'string' ? getRegisteredEffect(effectName) : null;\n } else if (animation.keyframeEffect) {\n const effect = (animation_: AnimationOptions) => {\n const { name, keyframes } = animation_.keyframeEffect!;\n\n return [{ ...animation_, name, keyframes }];\n };\n const getNames = (animation_: AnimationOptions) => {\n const { effectId } = animation_;\n const { name } = animation_.keyframeEffect!;\n const uid = name || effectId;\n\n return uid ? [uid] : [];\n };\n return { web: effect, style: effect, getNames };\n } else if (animation.customEffect) {\n return (animation_: AnimationOptions) => [{ ...animation_, keyframes: [] }];\n }\n return null;\n}\n\nfunction getEffectsData(\n animations: AnimationData[],\n trigger?: Partial<TriggerVariant>,\n effectId?: string,\n) {\n // process each AnimationData object into a KeyframeEffect object\n return animations.map((effect, index) => {\n // prepare the KeyframeEffectOptions object\n const effectOptions = {\n fill: effect.fill,\n easing: getEasing(effect.easing),\n iterations: effect.iterations === 0 ? Infinity : effect.iterations || 1,\n composite: effect.composite,\n direction: getDirection(effect),\n } as KeyframeEffectOptions & { rangeStart: string; rangeEnd: string };\n\n // if this is a time-based animation then set the duration and delay as time values\n if (isNotAScrubTrigger(trigger)) {\n effectOptions.duration = effect.duration as number;\n effectOptions.delay = (effect as TimeAnimationOptions).delay || 0;\n } else {\n // if ViewTimeline is supported AND this is a view-progress trigger\n if (window.ViewTimeline && trigger?.trigger === 'view-progress') {\n // set duration to 'auto'\n effectOptions.duration = 'auto';\n } else {\n // if ViewTimeline not supported then put a 100ms value in duration get a progress we can easily relate to\n // we split the duration to 99.99ms and delay of 0.01ms to get the fill-mode effect working\n effectOptions.duration = 99.99;\n effectOptions.delay = 0.01;\n }\n }\n\n return {\n effect,\n options: effectOptions,\n id: effectId && `${effectId}-${index + 1}`,\n part: effect.part,\n };\n });\n}\n\nfunction isNotAScrubTrigger(trigger?: Partial<TriggerVariant>) {\n return !trigger || (trigger.trigger !== 'pointer-move' && trigger.trigger !== 'view-progress');\n}\n\nexport {\n isNotAScrubTrigger,\n getElement,\n getElementMotionPart,\n getNamedEffect,\n getEffectsData,\n measure,\n mutate,\n getDirection,\n getLength,\n getRanges,\n};\n","import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n MouseAnimationFactory,\n MouseAnimationInstance,\n ScrubAnimationOptions,\n TriggerVariant,\n WebAnimationEffectFactory,\n} from '../types';\nimport { CustomAnimation } from '../CustomAnimation';\nimport { AnimationGroup } from '../AnimationGroup';\nimport {\n getElement,\n getElementMotionPart,\n measure,\n mutate,\n getRanges,\n getNamedEffect,\n getEffectsData,\n isNotAScrubTrigger,\n} from './common';\nimport fastdom from 'fastdom';\n\nfunction getWebAnimationEffect(\n preset: AnimationEffectAPI<any> | WebAnimationEffectFactory<any> | null,\n animation: AnimationOptions,\n target: HTMLElement | string | null,\n trigger?: Partial<TriggerVariant>,\n options?: Record<string, any>,\n): AnimationData[] | MouseAnimationFactory {\n if (preset) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n\n if (options?.reducedMotion) {\n if (animation.iterations === 1 || animation.iterations == undefined) {\n animation = { ...animation, duration: 1 };\n } else {\n return [];\n }\n }\n }\n\n let domApi;\n if (target instanceof HTMLElement) {\n domApi = { measure: measure(target), mutate: mutate(target) };\n }\n\n return (preset as AnimationEffectAPI<any>).web\n ? (preset as AnimationEffectAPI<any>).web(animation, domApi, options)\n : (preset as WebAnimationEffectFactory<any>)(animation, domApi, options);\n }\n\n return [];\n}\n\nfunction getWebAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n options?: Record<string, any>,\n ownerDocument?: Document,\n): AnimationGroup | MouseAnimationInstance | null {\n const element = target instanceof HTMLElement ? target : getElement(target, ownerDocument);\n\n if (trigger?.trigger === 'pointer-move' && !animationOptions.keyframeEffect) {\n let effectOptions = animationOptions;\n\n if (animationOptions.customEffect) {\n effectOptions = {\n ...animationOptions,\n namedEffect: { id: '', type: 'CustomMouse' },\n };\n }\n\n // TODO: need to fix the type here, currently lying about the returned type to be WebAnimationEffectFactory instead of MouseAnimationFactoryCreate\n const mouseAnimationPreset = getNamedEffect(\n effectOptions,\n ) as WebAnimationEffectFactory<'scrub'>;\n const mouseAnimationFactory = getWebAnimationEffect(\n mouseAnimationPreset,\n animationOptions,\n element,\n trigger,\n options,\n ) as MouseAnimationFactory;\n\n if (typeof mouseAnimationFactory !== 'function') {\n return null;\n }\n\n return mouseAnimationFactory(element as HTMLElement);\n }\n\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(animationOptions) as AnimationEffectAPI<any> | null;\n\n const animationsData = getWebAnimationEffect(\n namedEffect,\n animationOptions,\n element,\n trigger,\n options,\n ) as AnimationData[];\n\n // Return null if animation data cannot be generated\n if (!animationsData || animationsData.length === 0) {\n return null;\n }\n\n const data = getEffectsData(animationsData, trigger, animationOptions.effectId);\n\n let timeline: typeof window.ViewTimeline | undefined;\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress && window.ViewTimeline) {\n // generate the timeline object\n // @ts-expect-error\n timeline = new ViewTimeline({\n subject: trigger.element || getElement(trigger.componentId!),\n });\n }\n\n // generate an Animation object for each data object\n const animations = data.map(({ effect, options: effectOptions, id, part }) => {\n const effectTarget = part ? getElementMotionPart(element, part) : element;\n\n const keyframeEffect = new KeyframeEffect(effectTarget || null, [], effectOptions);\n\n // set the keyframes for the KeyframeEffect after measurements and mutations\n fastdom.mutate(() => {\n if ('timing' in effect) {\n keyframeEffect.updateTiming(effect.timing as OptionalEffectTiming);\n }\n\n keyframeEffect.setKeyframes(effect.keyframes);\n });\n\n const timingOptions =\n isViewProgress && timeline ? { timeline: timeline as AnimationTimeline } : {};\n const animation: Animation | CustomAnimation =\n typeof effect.customEffect === 'function'\n ? (new CustomAnimation(\n effect.customEffect,\n effectTarget || null,\n effectOptions,\n timingOptions,\n ) as Animation)\n : new Animation(keyframeEffect, timingOptions.timeline);\n\n // if this is a ScrubAnimation with view-progress trigger and the browser supports the ViewTimeline API\n if (isViewProgress) {\n if (timeline) {\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const { start, end } = getRanges(effect as AnimationDataForScrub);\n // @ts-expect-error\n animation.rangeStart = start;\n // @ts-expect-error\n animation.rangeEnd = end;\n\n animation.play();\n });\n } else {\n const { startOffset, endOffset } = animationOptions as ScrubAnimationOptions;\n\n // set the ranges for the animation after measurements and mutations\n fastdom.mutate(() => {\n const startOffsetToWrite = (effect as AnimationDataForScrub).startOffset || startOffset;\n const endOffsetToWrite = (effect as AnimationDataForScrub).endOffset || endOffset;\n\n Object.assign(animation, {\n start: {\n name: startOffsetToWrite!.name,\n offset: startOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.startOffsetAdd,\n },\n end: {\n name: endOffsetToWrite!.name,\n offset: endOffsetToWrite!.offset?.value,\n add: (effect as AnimationDataForScrub)!.endOffsetAdd,\n },\n });\n });\n }\n }\n\n if (id) {\n animation.id = id;\n }\n\n return animation;\n });\n\n // create an AnimationGroup with the generate animations\n return new AnimationGroup(animations, {\n ...animationOptions,\n trigger: { ...(trigger || ({} as Partial<TriggerVariant>)) },\n // make sure the group is ready after all animation targets are measured and mutated\n measured: new Promise((resolve) => fastdom.mutate(resolve)),\n });\n}\n\nexport { getWebAnimation };\n","import type {\n AnimationData,\n AnimationDataForScrub,\n AnimationEffectAPI,\n AnimationOptions,\n TriggerVariant,\n} from '../types';\nimport { getEffectsData, getRanges, getNamedEffect, isNotAScrubTrigger } from './common';\n\nfunction getAnimationTarget(target: string | null, part: string | undefined) {\n return target ? `#${target}${part ? `[data-motion-part~=\"${part}\"]` : ''}` : '';\n}\n\nfunction getAnimationAsCSS(\n data: {\n effect: AnimationData;\n options: KeyframeEffectOptions;\n id: string | undefined;\n part: string | undefined;\n },\n isRunning?: boolean,\n) {\n const { duration, delay, iterations = 1, fill, easing = 'linear', direction } = data.options;\n const animationName = data.effect.name;\n const isAutoDuration = duration === 'auto';\n\n return `${animationName} ${isAutoDuration ? 'auto' : `${duration}ms`}${\n isAutoDuration ? ' ' : ` ${delay || 1}ms `\n }${easing}${fill && fill !== 'none' ? ` ${fill}` : ''} ${\n !iterations || iterations === Infinity ? 'infinite' : iterations\n }${direction === 'normal' ? '' : ` ${direction}`} ${isRunning ? '' : 'paused'}`;\n}\n\nfunction getCSSAnimationEffect(\n preset: AnimationEffectAPI<any> | null,\n animation: AnimationOptions,\n trigger?: Partial<TriggerVariant>,\n): AnimationData[] {\n if (preset?.style) {\n // validate duration is a number over 0\n if (isNotAScrubTrigger(trigger)) {\n animation.duration = animation.duration || 1;\n }\n\n return preset.style(animation);\n }\n\n return [];\n}\n\nfunction getCSSAnimation(\n target: string | null,\n animationOptions: AnimationOptions,\n trigger?: TriggerVariant,\n) {\n // get the preset for the given animation options\n const namedEffect = getNamedEffect(animationOptions) as AnimationEffectAPI<any> | null;\n\n const animationsData = getCSSAnimationEffect(namedEffect, animationOptions);\n const data = getEffectsData(animationsData, trigger, animationOptions.effectId);\n const isViewProgress = trigger?.trigger === 'view-progress';\n\n return data.map((item, index) => {\n const { start, end }: { start?: string; end?: string } = isViewProgress\n ? getRanges(item.effect as AnimationDataForScrub)\n : {};\n\n return {\n target: getAnimationTarget(target, item.part),\n animation: getAnimationAsCSS(item, isViewProgress),\n composition: item.options.composite,\n custom: item.effect.custom,\n name: item.effect.name,\n keyframes: item.effect.keyframes,\n id: item.id && `${item.id}-${index + 1}`,\n animationTimeline: isViewProgress ? `--${trigger?.id}` : '',\n animationRange: start || end ? `${start} ${end}` : '',\n };\n });\n}\n\nexport { getCSSAnimation, getCSSAnimationEffect, getAnimationAsCSS };\n","import type { AnimationEffectAPI, AnimationOptions, TimeAnimationOptions } from '../types';\nimport { getElement, getNamedEffect, measure, mutate } from './common';\nimport fastdom from 'fastdom';\n\nfunction prepareAnimation(\n target: HTMLElement | string | null,\n animation: AnimationOptions,\n callback?: () => void,\n) {\n const preset = getNamedEffect(animation);\n const element = target instanceof HTMLElement ? target : getElement(target);\n\n if (preset && (preset as AnimationEffectAPI<'time'>).prepare && element) {\n const domApi = { measure: measure(element), mutate: mutate(element) };\n\n (preset as AnimationEffectAPI<'time'>).prepare!(animation as TimeAnimationOptions, domApi);\n }\n\n if (callback) {\n fastdom.mutate(callback);\n }\n}\n\nexport { prepareAnimation };\n","import type {\n AnimationOptions,\n ScrubAnimationOptions,\n TriggerVariant,\n MouseAnimationInstance,\n AnimationEffectAPI,\n CustomMouseAnimationInstance,\n ScrubScrollScene,\n ScrubPointerScene,\n PointerMoveAxis,\n SequenceOptions,\n AnimationGroupArgs,\n} from './types';\nimport { AnimationGroup } from './AnimationGroup';\nimport { Sequence } from './Sequence';\nimport { getEasing, getJsEasing } from './utils';\nimport { getWebAnimation } from './api/webAnimations';\nimport { getCSSAnimation } from './api/cssAnimations';\nimport { prepareAnimation } from './api/prepare';\nimport { getElement, getNamedEffect } from './api/common';\n\nfunction getElementCSSAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n): AnimationGroup | null {\n const namedEffect = getNamedEffect(animationOptions) as AnimationEffectAPI<any> | null;\n\n if (!namedEffect) {\n return null;\n }\n\n if (!namedEffect.style) {\n // if this named effect does not have a style method, attempt to get group of Web Animations\n if (animationOptions.effectId && target) {\n return getElementAnimation(target, animationOptions.effectId);\n }\n\n return null;\n }\n\n const effectNames = namedEffect.getNames(animationOptions);\n const element = typeof target === 'string' ? getElement(target) : target;\n const animations = element?.getAnimations();\n const animationNames =\n animations?.map((anim) => (anim as CSSAnimation).animationName) || ([] as string[]);\n const filteredAnimations: CSSAnimation[] = [];\n\n effectNames.forEach((name) => {\n if (animationNames.includes(name)) {\n filteredAnimations.push(\n animations?.find((anim) => (anim as CSSAnimation).animationName === name) as CSSAnimation,\n );\n }\n });\n\n return filteredAnimations?.length ? new AnimationGroup(filteredAnimations) : null;\n}\n\nfunction getElementAnimation(\n target: HTMLElement | string,\n effectId: string,\n): AnimationGroup | null {\n const element = typeof target === 'string' ? getElement(target) : target;\n // somehow get the right animations\n const animations = element?.getAnimations().filter((anim: Animation | CSSAnimation) => {\n const id = anim.id || (anim as CSSAnimation).animationName;\n // if no id/name just return all animations\n return id ? id.startsWith(effectId) : true;\n });\n\n return animations?.length ? new AnimationGroup(animations) : null;\n}\n\nfunction getScrubScene(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger: Partial<TriggerVariant> & { element?: HTMLElement },\n sceneOptions: Record<string, any> = {},\n): ScrubScrollScene[] | ScrubPointerScene | ScrubPointerScene[] | null {\n const { disabled, allowActiveEvent, ...rest } = sceneOptions;\n const animation = getWebAnimation(target, animationOptions, trigger, rest);\n\n // Return null if animation could not be created\n if (!animation) {\n return null;\n }\n\n let typeSpecificOptions = {} as Record<string, any>;\n\n if (trigger.trigger === 'view-progress' && !window.ViewTimeline) {\n // TODO(ameerf): consider doing this only for bgscrub to not affect the other scroll effects\n const viewSource = trigger.element || getElement(trigger.componentId!);\n const { ready } = animation as AnimationGroup;\n\n return (animation as AnimationGroup).animations.map((partialAnimation) => {\n return {\n /* we use getters for start and end in order to access the animation's start and end\n only when initializing the scrub scene rather than immediately */\n get start() {\n return partialAnimation.start;\n },\n get end() {\n return partialAnimation.end;\n },\n viewSource,\n ready,\n getProgress() {\n return (animation as AnimationGroup).getProgress();\n },\n effect(__: any, p: number) {\n const { activeDuration } = partialAnimation.effect!.getComputedTiming();\n const { delay } = partialAnimation.effect!.getTiming();\n\n partialAnimation.currentTime = ((delay || 0) + ((activeDuration as number) || 0)) * p;\n },\n disabled,\n destroy() {\n partialAnimation.cancel();\n },\n } as ScrubScrollScene;\n });\n } else if (trigger.trigger === 'pointer-move') {\n const scrubOptions = animationOptions as ScrubAnimationOptions;\n const { centeredToTarget, transitionDuration, transitionEasing } = scrubOptions;\n const axis = (trigger as { axis?: PointerMoveAxis }).axis;\n\n if (scrubOptions.keyframeEffect) {\n const animationGroup = animation as AnimationGroup;\n\n if (animationGroup.animations?.length === 0) {\n return null;\n }\n\n const scene: ScrubPointerScene & { _currentProgress: number } = {\n target: undefined,\n centeredToTarget,\n ready: animationGroup.ready,\n _currentProgress: 0,\n getProgress() {\n return this._currentProgress;\n },\n effect(__: any, p: { x: number; y: number }) {\n const linearProgress = axis === 'x' ? p.x : p.y;\n this._currentProgress = linearProgress;\n animationGroup.progress(linearProgress);\n },\n disabled: disabled ?? false,\n destroy() {\n animationGroup.cancel();\n },\n };\n\n return scene;\n }\n\n typeSpecificOptions = {\n centeredToTarget,\n allowActiveEvent,\n };\n\n if (animationOptions.customEffect && transitionDuration) {\n typeSpecificOptions.transitionDuration = transitionDuration;\n // TODO: refactor js easings\n typeSpecificOptions.transitionEasing = getJsEasing(transitionEasing);\n }\n typeSpecificOptions.target = (animation as MouseAnimationInstance).target;\n }\n\n return {\n ...typeSpecificOptions,\n getProgress() {\n return (animation as AnimationGroup | CustomMouseAnimationInstance).getProgress();\n },\n effect(\n __: any,\n p: number | { x: number; y: number },\n v?: { x: number; y: number },\n active?: boolean,\n ) {\n animation.progress(\n v\n ? {\n // @ts-expect-error spread error on p\n ...p,\n v,\n active,\n }\n : p,\n );\n },\n disabled,\n destroy() {\n animation.cancel();\n },\n } as ScrubPointerScene;\n}\n\nfunction getAnimation(\n target: HTMLElement | string | null,\n animationOptions: AnimationOptions,\n trigger?: Partial<TriggerVariant> & { element?: HTMLElement },\n reducedMotion: boolean = false,\n): AnimationGroup | MouseAnimationInstance | null {\n const animation = getElementCSSAnimation(target, animationOptions);\n\n if (animation) {\n animation.ready = new Promise((resolve) => {\n prepareAnimation(target, animationOptions, resolve);\n });\n\n return animation;\n }\n\n return getWebAnimation(target, animationOptions, trigger, { reducedMotion });\n}\n\nfunction resolveTargets(\n target: HTMLElement | HTMLElement[] | string | null,\n): (HTMLElement | null)[] {\n if (target === null) return [null];\n if (typeof target === 'string') {\n return Array.from(document.querySelectorAll<HTMLElement>(target));\n }\n if (Array.isArray(target)) return target;\n\n return [target];\n}\n\n/**\n * Creates AnimationGroup instances from AnimationGroupArgs without wrapping them in a Sequence.\n */\nfunction createAnimationGroups(\n animationGroupArgs: AnimationGroupArgs[],\n context?: Record<string, any>,\n): AnimationGroup[] {\n const groups: AnimationGroup[] = [];\n\n for (const { target, options: animationGroupOptions } of animationGroupArgs) {\n const elements = resolveTargets(target);\n\n for (const element of elements) {\n const result = getAnimation(\n element,\n animationGroupOptions,\n undefined,\n context?.reducedMotion,\n );\n\n if (result instanceof AnimationGroup) {\n groups.push(result);\n }\n }\n }\n\n return groups;\n}\n\n/**\n * Creates a Sequence that coordinates multiple AnimationGroups with staggered delays.\n */\nfunction getSequence(\n options: SequenceOptions,\n animationGroups: AnimationGroupArgs[],\n context?: Record<string, any>,\n): Sequence {\n const groups = createAnimationGroups(animationGroups, context);\n return new Sequence(groups, options);\n}\n\nexport {\n getCSSAnimation,\n getWebAnimation,\n getElementCSSAnimation,\n getElementAnimation,\n getScrubScene,\n prepareAnimation,\n getAnimation,\n getSequence,\n createAnimationGroups,\n getEasing,\n};\n\nexport type { AnimationGroup, Sequence };\n"],"names":["AnimationGroup","animations","options","callback","animation","p","delay","duration","iterations","time","rate","a","target","endEvent","_error","timing","linear","sineIn","sineOut","sineInOut","quadIn","quadOut","quadInOut","cubicIn","cubicOut","cubicInOut","quartIn","quartOut","quartInOut","quintIn","quintOut","quintInOut","expoIn","expoOut","expoInOut","circIn","circOut","circInOut","backIn","backOut","backInOut","k","jsEasings","cssEasings","getCssUnits","unit","getEasing","easing","cubicBezierEasing","x1","y1","x2","y2","cx","bx","ax","cy","by","ay","sampleX","t","sampleY","sampleDX","solveT","x","i","dx","d","lo","hi","xMid","parseCubicBezier","str","m","parseCssLinear","parts","s","stops","part","tokens","output","pcts","v","start","end","startPos","endPos","span","j","resolved","last","mid","b","getJsEasing","named","Sequence","animationGroups","allAnimations","group","g","count","_","offsets","sequenceDuration","groupIdx","animIdx","effect","baseDelay","endDelay","result","activeDuration","max","entries","sorted","index","clampedIndex","flatAnimations","insertAt","sum","predicate","removed","keptGroups","keptTimingOptions","CustomAnimation","customEffect","effectOptions","timingOptions","timeline","progress","error","speed","uid","tl","cb","playbackRate","type","listener","event","getDefaultExportFromCjs","win","debug","raf","FastDom","self","tasks","task","fn","ctx","scheduleFlush","remove","props","child","mixin","fastdom","flush","writes","reads","e","array","item","source","key","exports","module","this","registry","registerEffects","effects","getRegisteredEffect","name","getElement","id","ownerDocument","getElementMotionPart","element","getDirection","alternate","getLength","length","getRange","range","add","isEnd","getRanges","measure","mutate","getNamedEffect","effectName","animation_","keyframes","effectId","getEffectsData","trigger","isNotAScrubTrigger","getWebAnimationEffect","preset","domApi","getWebAnimation","animationOptions","mouseAnimationPreset","mouseAnimationFactory","namedEffect","animationsData","data","isViewProgress","effectTarget","keyframeEffect","startOffset","endOffset","startOffsetToWrite","endOffsetToWrite","resolve","getAnimationTarget","getAnimationAsCSS","isRunning","fill","direction","animationName","isAutoDuration","getCSSAnimationEffect","getCSSAnimation","prepareAnimation","getElementCSSAnimation","getElementAnimation","effectNames","animationNames","anim","filteredAnimations","getScrubScene","sceneOptions","disabled","allowActiveEvent","rest","typeSpecificOptions","viewSource","ready","partialAnimation","__","scrubOptions","centeredToTarget","transitionDuration","transitionEasing","axis","animationGroup","linearProgress","active","getAnimation","reducedMotion","resolveTargets","createAnimationGroups","animationGroupArgs","context","groups","animationGroupOptions","elements","getSequence"],"mappings":"aAQO,OAAA,eAAA,QAAA,OAAA,YAAA,CAAA,MAAA,QAAA,CAAA,EAAA,MAAMA,CAAe,CAC1B,WAIA,QACA,MACA,MAEA,YAAYC,EAAyBC,EAAiC,CACpE,KAAK,WAAaD,EAClB,KAAK,QAAUC,EACf,KAAK,MAAQA,GAAS,UAAY,QAAQ,QAAA,EAC1C,KAAK,MAAQD,EAAW,CAAC,YAAa,YACxC,CAEA,aAAc,CACZ,OAAO,KAAK,WAAW,CAAC,GAAG,QAAQ,kBAAA,EAAoB,UAAY,CACrE,CAEA,MAAM,KAAKE,EAAsC,CAC/C,MAAM,KAAK,MAEX,UAAWC,KAAa,KAAK,WAC3BA,EAAU,KAAA,EAKZ,MAAM,QAAQ,IAAI,KAAK,WAAW,IAAKA,GAAcA,EAAU,KAAK,CAAC,EAEjED,GACFA,EAAA,CAEJ,CAEA,OAAQ,CACN,UAAWC,KAAa,KAAK,WAC3BA,EAAU,MAAA,CAEd,CAEA,MAAM,QAAQD,EAAsC,CAClD,MAAM,KAAK,MAEX,UAAWC,KAAa,KAAK,WAC3BA,EAAU,QAAA,EAKZ,MAAM,QAAQ,IAAI,KAAK,WAAW,IAAKA,GAAcA,EAAU,KAAK,CAAC,EAEjED,GACFA,EAAA,CAEJ,CAEA,SAASE,EAAW,CAClB,UAAWD,KAAa,KAAK,WAAY,CACvC,KAAM,CAAE,MAAAE,EAAO,SAAAC,EAAU,WAAAC,GAAeJ,EAAU,OAAQ,UAAA,EACpDK,GACH,OAAO,SAASF,CAAQ,EAAKA,EAAsB,IACnD,OAAO,SAASC,CAAU,EAAKA,EAAwB,GAC1DJ,EAAU,cAAgBE,GAAS,GAAKG,GAAQJ,CAClD,CACF,CAEA,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