animejs
Version:
JavaScript animation engine
7 lines • 118 kB
JavaScript
/**
* Anime.js - UMD minified bundle
* @version v4.5.0
* @license MIT
* @copyright 2026 - Julian Garnier
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).anime={})}(this,function(t){"use strict";const e="undefined"!=typeof window,s=e?window:null,i=e?document:null,r={replace:0,none:1,blend:2},n=Symbol(),o=Symbol(),a=Symbol(),l=Symbol(),h=Symbol(),d=1e-11,c=1e12,u=1e3,p="",m=[],f=(()=>{const t=new Map;return t.set("x","translateX"),t.set("y","translateY"),t.set("z","translateZ"),t})(),g=["perspective","translateX","translateY","translateZ","rotate","rotateX","rotateY","rotateZ","scale","scaleX","scaleY","scaleZ","skew","skewX","skewY"],y=g.reduce((t,e)=>({...t,[e]:e+"("}),{}),_=()=>{},b=/\)\s*[-.\d]/,v=/(^#([\da-f]{3}){1,2}$)|(^#([\da-f]{4}){1,2}$)/i,T=/rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i,x=/rgba\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,S=/hsl\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*\)/i,w=/hsla\(\s*(-?\d+|-?\d*.\d+)\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)%\s*,\s*(-?\d+|-?\d*.\d+)\s*\)/i,$=/[-+]?\d*\.?\d+(?:e[-+]?\d)?/gi,C=/^([-+]?\d*\.?\d+(?:e[-+]?\d+)?)([a-z]+|%)$/i,E=/([a-z])([A-Z])/g,k=/(\*=|\+=|-=)/,N=/var\(\s*(--[\w-]+)(?:\s*,\s*([^)]+))?\s*\)/,D={id:null,keyframes:null,playbackEase:null,playbackRate:1,frameRate:240,loop:0,reversed:!1,alternate:!1,autoplay:!0,persist:!1,duration:u,delay:0,loopDelay:0,ease:"out(2)",composition:r.replace,modifier:t=>t,onBegin:_,onBeforeUpdate:_,onUpdate:_,onLoop:_,onPause:_,onComplete:_,onRender:_},A={current:null,root:i},I={defaults:D,precision:4,timeScale:1,tickThreshold:200,editor:null},R={version:"4.5.0",engine:null};e&&(s.AnimeJS||(s.AnimeJS=[]),s.AnimeJS.push(R));const L=t=>t.replace(E,"$1-$2").toLowerCase(),B=(t,e)=>0===t.indexOf(e),P=Date.now,F=Array.isArray,M=t=>t&&t.constructor===Object,V=t=>"number"==typeof t&&!isNaN(t),O=t=>"string"==typeof t,z=t=>"function"==typeof t,H=t=>void 0===t,X=t=>H(t)||null===t,Y=t=>e&&t instanceof SVGElement,W=t=>v.test(t),U=t=>B(t,"rgb"),q=t=>B(t,"hsl"),j=t=>!I.defaults.hasOwnProperty(t),G=["opacity","rotate","overflow","color"],Z=t=>O(t)?parseFloat(t):t,Q=Math.pow,J=Math.sqrt,K=Math.sin,tt=Math.cos,et=Math.abs,st=Math.exp,it=Math.ceil,rt=Math.floor,nt=Math.asin,ot=Math.max,at=Math.atan2,lt=Math.PI,ht=Math.round,dt=(t,e,s)=>t<e?e:t>s?s:t,ct=(t,e)=>{if(e<0)return t;if(!e)return ht(t);const s=10**e;return ht(t*s)/s},ut=(t,e)=>F(e)?e.reduce((e,s)=>et(s-t)<et(e-t)?s:e):e?ht(t/e)*e:t,pt=(t,e,s)=>1===s?e:0===s?t:t+(e-t)*s,mt=t=>t===1/0?c:t===-1/0?-c:t,ft=t=>t<=d?d:mt(ct(t,11)),gt=t=>F(t)?[...t]:t,yt=(t,e)=>{const s={...t};for(let i in e){const r=t[i];s[i]=H(r)?e[i]:r}return s},_t=(t,e,s,i="_prev",r="_next")=>{let n=t._head,o=r;for(s&&(n=t._tail,o=i);n;){const t=n[o];e(n),n=t}},bt=(t,e,s="_prev",i="_next")=>{const r=e[s],n=e[i];r?r[i]=n:t._head=n,n?n[s]=r:t._tail=r,e[s]=null,e[i]=null},vt=(t,e,s,i="_prev",r="_next")=>{let n=t._tail;for(;n&&s&&s(n,e);)n=n[i];const o=n?n[r]:t._head;n?n[r]=e:t._head=e,o?o[i]=e:t._tail=e,e[i]=n,e[r]=o},Tt=t=>{let e=p;for(let s=0,i=g.length;s<i;s++){const i=g[s],r=t[i];if(void 0!==r){if("translateX"===i){const i=t.translateY;if(void 0!==i){const n=t.translateZ;void 0!==n?(e+=`translate3d(${r},${i},${n}) `,s+=2):(e+=`translate(${r},${i}) `,s+=1);continue}}if("scaleX"===i&&void 0===t.scale){const i=t.scaleY;if(void 0!==i){const n=t.scaleZ;void 0!==n?(e+=`scale3d(${r},${i},${n}) `,s+=2):(e+=`scale(${r},${i}) `,s+=1);continue}}e+=`${y[i]}${r}) `}"rotateZ"===i&&void 0!==t.rotate3d&&(e+=`rotate3d(${t.rotate3d}) `)}return void 0!==t.matrix&&(e+=`matrix(${t.matrix}) `),void 0!==t.matrix3d&&(e+=`matrix3d(${t.matrix3d}) `),e},xt=[];function St(t,e){if(!t)return null;const s=xt.length;t:for(let i=0;i<s;i++){const s=xt[i];if(s.detect&&!s.detect(t))continue;const r=s.targetAdapters;for(let s=0,i=r.length;s<i;s++){const i=r[s];if(i.detect(t)){const s=i.props[e];if(s&&(!s.gate||s.gate(t)))return s;break t}}}for(let i=0;i<s;i++){const s=xt[i];if(s.detect&&!s.detect(t))continue;const r=s.propertyResolvers;for(let s=0,i=r.length;s<i;s++){const i=r[s](t,e);if(i)return i}}return null}const wt=(t,e,s)=>(s<0&&(s+=1),s>1&&(s-=1),s<1/6?t+6*(e-t)*s:s<.5?e:s<2/3?t+(e-t)*(2/3-s)*6:t),$t=(t,e)=>H(t)?e:t,Ct=(t,e)=>{const s=t.match(N),i=e[o]?e:document.documentElement;let r=getComputedStyle(i)?.getPropertyValue(s[1]);return r&&r.trim()!==p||!s[2]||(r=s[2].trim()),r||0},Et=(t,e,s,i,r,n)=>{if(z(t)){if(!r){const r=t(e,s,i,n);return isNaN(+r)?r||0:+r}const o=()=>{const r=t(e,s,i,n);return isNaN(+r)?r||0:+r};return r.func=o,o()}if(O(t)&&B(t,"var(")){if(!r)return Ct(t,e);const s=()=>Ct(t,e);return r.func=s,s()}return t},kt=(t,e)=>t[o]?t[a]&&((t,e)=>{if(G.includes(e))return!1;if(t.getAttribute(e)||e in t){if("scale"===e){const e=t.parentNode;return e&&"filter"===e.tagName}return!0}})(t,e)?1:g.includes(e)||f.get(e)?3:B(e,"--")?4:e in t.style?2:e in t?0:1:0,Nt=(t,e,s)=>{const i=t.style[e];i&&s&&(s[e]=i);const r=i||getComputedStyle(t[h]||t).getPropertyValue(e);return"auto"===r?"0":r},Dt=(t,e,s,i)=>{const r=H(s)?kt(t,e):s,n=St(t,e);if(n){const s=n.get(t);return s&&i&&(i[e]=s),null==s?0:s}if(0===r){const s=t[e];return s&&i&&(i[e]=s),s||0}if(1===r){const s=t.getAttribute(e);return s&&i&&(i[e]=s),s}return 3===r?((t,e,s)=>{const i=t.style.transform;if(i){const r=t[l];let n=0;const o=i.length;let a;for(;n<o;){for(;n<o&&32===i.charCodeAt(n);)n++;if(n>=o)break;const t=n;for(;n<o&&40!==i.charCodeAt(n);)n++;if(n>=o)break;const e=i.substring(t,n);let s=1;const l=n+1;let h=-1,d=-1;for(n++;n<o&&s>0;){const t=i.charCodeAt(n);40===t?s++:41===t?s--:44===t&&1===s&&(-1===h?h=n:-1===d&&(d=n)),n++}const c=n-1;"translate"===e||"translate3d"===e?(-1===h?r.translateX=i.substring(l,c).trim():(r.translateX=i.substring(l,h).trim(),-1===d?r.translateY=i.substring(h+1,c).trim():(r.translateY=i.substring(h+1,d).trim(),r.translateZ=i.substring(d+1,c).trim())),a=i.substring(l,c)):"scale"===e||"scale3d"===e?-1===h?r.scale=i.substring(l,c).trim():(r.scaleX=i.substring(l,h).trim(),-1===d?r.scaleY=i.substring(h+1,c).trim():(r.scaleY=i.substring(h+1,d).trim(),r.scaleZ=i.substring(d+1,c).trim())):r[e]=i.substring(l,c)}if("translate3d"===e&&a)return s&&(s[e]=a),a;const h=r[e];if(!H(h))return s&&(s[e]=h),h}return"translate3d"===e?"0px, 0px, 0px":"rotate3d"===e?"0, 0, 0, 0deg":B(e,"scale")?"1":B(e,"rotate")||B(e,"skew")?"0deg":"0px"})(t,e,i):4===r?Nt(t,e,i).trimStart():Nt(t,e,i)},At=(t,e,s)=>"-"===s?t-e:"+"===s?t+e:t*e,It=(t,e)=>{if(e.t=0,e.n=0,e.u=null,e.o=null,e.d=null,e.s=null,!t)return e;const s=+t;if(!isNaN(s))return e.n=s,e;let i=t;"="===i[1]&&(e.o=i[0],i=i.slice(2));const r=!i.includes(" ")&&C.exec(i);if(r)return e.t=1,e.n=+r[1],e.u=r[2],e;if(e.o)return e.n=+i,e;if(W(o=i)||(U(o)||q(o))&&(")"===o[o.length-1]||!b.test(o)))return e.t=2,e.d=U(n=i)?(t=>{const e=T.exec(t)||x.exec(t),s=H(e[4])?1:+e[4];return[+e[1],+e[2],+e[3],s]})(n):W(n)?(t=>{const e=t.length,s=4===e||5===e;return[+("0x"+t[1]+t[s?1:2]),+("0x"+t[s?2:3]+t[s?2:4]),+("0x"+t[s?3:5]+t[s?3:6]),5===e||9===e?+(+("0x"+t[s?4:7]+t[s?4:8])/255).toFixed(3):1]})(n):q(n)?(t=>{const e=S.exec(t)||w.exec(t),s=+e[1]/360,i=+e[2]/100,r=+e[3]/100,n=H(e[4])?1:+e[4];let o,a,l;if(0===i)o=a=l=r;else{const t=r<.5?r*(1+i):r+i-r*i,e=2*r-t;o=ct(255*wt(e,t,s+1/3),0),a=ct(255*wt(e,t,s),0),l=ct(255*wt(e,t,s-1/3),0)}return[o,a,l,n]})(n):[0,0,0,1],e;var n,o;{const t=i.match($);return e.t=3,e.d=t?t.map(Number):[],e.s=i.split($)||[],e}},Rt=(t,e)=>(e.t=t._valueType,e.n=t._toNumber,e.u=t._unit,e.o=null,e.d=gt(t._toNumbers),e.s=gt(t._strings),e),Lt={t:0,n:0,u:null,o:null,d:null,s:null},Bt=(t,e,s)=>{const i=t._modifier,r=t._fromNumbers,n=t._toNumbers,o=t._strings;let a=o[0];for(let l=0,h=n.length;l<h;l++){const h=i(ct(pt(r[l],n[l],e),s)),d=o[l+1];a+=`${d?h+d:h}`,t._numbers[l]=h}return a},Pt=(t,e,s,i,n)=>{const o=t.parent,a=t.duration,h=t.completed,c=t.iterationDuration,u=t.iterationCount,p=t._currentIteration,m=t._loopDelay,f=t._reversed,g=t._alternate,y=t._hasChildren,_=t._delay,b=t._currentTime,v=_+c,T=e-_,x=dt(b,-_,a),S=dt(T,-_,a),w=T-b,$=S>0,C=S>=a,E=a<=d,k=2===n;let N=0,D=T,A=0;if(u>1){const e=c+(C?0:m),s=~~(S/e);t._currentIteration=dt(s,0,u),C&&t._currentIteration--,N=t._currentIteration%2,D=S-s*e||0}const R=f^(g&&N),L=t._ease;let B=C?R?0:a:R?c-D:D;L&&(B=c*L(B/c)||0);const P=(o?o.backwards:T<b)?!R:!!R;if(t._currentTime=T,t._iterationTime=B,t.backwards=P,$&&!t.began?(t.began=!0,s||o&&(P||!o.began)||t.onBegin(t)):T<=0&&(t.began=!1),s||y||!$||t._currentIteration===p||t.onLoop(t),k||1===n&&(e>=(o&&_>0?0:_)&&e<=v||e<=_&&x>_||e>=v&&x!==a)||B>=v&&x!==a||B<=_&&x>0&&!C||e<=x&&x===a&&h||C&&!h&&E){if($&&(t.computeDeltaTime(x),s||t.onBeforeUpdate(t)),!y){const e=k||(P?-1*w:w)>=I.tickThreshold,n=ct(t._offset+(o?o._offset:0)+_+B,12);let a,h,d,c,u=t._head,p=0;for(;u;){const t=u._composition,s=u._currentTime,o=u._changeDuration,m=u._absoluteStartTime+u._changeDuration,f=u._nextRep,g=u._prevRep,y=t!==r.none,_=g?g._absoluteStartTime+g._changeDuration:0,b=g&&g.parent!==u.parent,v=!f||f._isOverridden?m:f.parent===u.parent?m+f._delay:f._absoluteStartTime<f._absoluteUpdateStartTime?f._absoluteStartTime:f._absoluteUpdateStartTime;if((e||(s!==o||n<=v||g&&!b&&(!f||f.parent!==u.parent))&&(0!==s||n>=u._absoluteStartTime||b&&!u._hasFromValue&&!g._isOverridden&&n>=_||f&&!f._isOverridden&&f.parent===u.parent&&0!==f._currentTime&&B<f._startTime))&&(!g||b||B>=u._startTime)&&(!y||!u._isOverridden&&(!u._isOverlapped||n<=m)&&(!f||f._isOverridden||n<=v)&&(!g||g._isOverridden||(b?n>=u._absoluteStartTime||!u._hasFromValue&&n>=_:n>=_+u._delay)))){const e=u._currentTime=dt(B-u._startTime,0,o),s=u._ease(e/u._updateDuration),n=u._modifier,m=u._valueType,f=u._tweenType,g=0===f,_=0===m,b=_&&g||0===s||1===s?-1:I.precision;let v,T;if(_)v=T=n(ct(pt(u._fromNumber,u._toNumber,s),b));else if(1===m)T=n(ct(pt(u._fromNumber,u._toNumber,s),b)),v=`${T}${u._unit}`;else if(2===m){const t=u._numbers,e=u._fromNumbers,r=u._toNumbers,o=1-s,a=e[0],l=e[1],h=e[2],d=r[0],c=r[1],p=r[2];t[0]=n(Math.sqrt(a*a*o+d*d*s)),t[1]=n(Math.sqrt(l*l*o+c*c*s)),t[2]=n(Math.sqrt(h*h*o+p*p*s)),t[3]=n(pt(e[3],r[3],s)),u._setter&&!i||(v=`rgba(${ct(t[0],0)},${ct(t[1],0)},${ct(t[2],0)},${t[3]})`)}else 3===m&&(v=Bt(u,s,b));if(y&&(u._number=T),i||t===r.blend)u._value=v;else{const t=u.property;a=u.target,u._setter?u._setter(a,T,u):g?a[t]=v:1===f?a.setAttribute(t,v):(h=a.style,3===f?(a!==d&&(d=a,c=a[l]),c[t]=v,p=1):2===f?h[t]=v:4===f&&h.setProperty(t,v)),$&&(A=1)}}else s&&g&&!b&&B<u._startTime&&(u._currentTime=0);p&&u._renderTransforms&&(h.transform=Tt(c),p=0),u=u._next}!s&&A&&t.onRender(t)}!s&&$&&t.onUpdate(t)}return o&&E?!s&&(o.began&&!P&&T>0&&!h||P&&T<=d&&h)&&(t.onComplete(t),t.completed=!P):$&&C?u===1/0?t._startTime+=t.duration:t._currentIteration>=u-1&&(t.paused=!0,h||y||(t.completed=!0,s||o&&(P||!o.began)||(t.onComplete(t),t._resolve(t)))):t.completed=!1,A},Ft=(t,e,s,i,r)=>{const n=t._currentIteration;if(Pt(t,e,s,i,r),t._hasChildren){const o=t,a=o.backwards,l=i?e:o._iterationTime,h=P();let c=0,u=!0;if(!i&&o._currentIteration!==n){const t=o.iterationDuration;_t(o,e=>{if(a){const i=e.duration,r=e._offset+e._delay;s||!(i<=d)||r&&r+i!==t||e.onComplete(e)}else!e.completed&&!e.backwards&&e._currentTime<e.iterationDuration&&Pt(e,t,s,1,2),e.began=!1,e.completed=!1}),s||o.onLoop(o)}_t(o,t=>{const e=ct((l-t._offset)*t._speed,12);if(a&&e>t._delay+t.duration)return;const n=t._fps<o._fps?t.requestTick(h):r;c+=Pt(t,e,s,i,n),!t.completed&&u&&(u=!1)},a),!s&&c&&o.onRender(o),(u||a)&&o._currentTime>=o.duration&&(o.paused=!0,o.completed||(o.completed=!0,s||(o.onComplete(o),o._resolve(o))))}},Mt={},Vt=(t,e,s)=>{if(3===s)return f.get(t)||t;if(2===s||1===s&&Y(e)&&t in e.style){const e=Mt[t];if(e)return e;{const e=t?L(t):t;return Mt[t]=e,e}}return t},Ot=(t,e=!1)=>{if(t._hasChildren)_t(t,t=>Ot(t,e),!0);else{const s=t;s.pause(),_t(s,t=>{const i=t.property,r=t.target,n=t._tweenType,a=t._inlineValue,h=X(a)||a===p;if(t._setter){if(!e&&!h){if(It(a,Lt),Lt.d){const e=Lt.d,s=t._numbers;for(let t=0,i=e.length;t<i;t++)s[t]=e[t]}else t._number=Lt.n;t._setter(t.target,t._number,t)}}else if(0===n)e||h||(r[i]=a);else if(r[o])if(1===n)e||(h?r.removeAttribute(i):r.setAttribute(i,a));else{const e=r.style;if(3===n){const s=r[l];h?delete s[i]:s[i]=a,t._renderTransforms&&(Object.keys(s).length?e.transform=Tt(s):e.removeProperty("transform"))}else h?e.removeProperty(L(i)):e[i]=a}r[o]&&s._tail===t&&s.targets.forEach(t=>{t.getAttribute&&t.getAttribute("style")===p&&t.removeAttribute("style")})})}return t},zt=t=>Ot(t,!0);class Ht{constructor(t=0){this.deltaTime=0,this._currentTime=t,this._lastTickTime=t,this._startTime=t,this._lastTime=t,this._frameDuration=u/240,this._fps=240,this._speed=1,this._hasChildren=!1,this._head=null,this._tail=null}get fps(){return this._fps}set fps(t){const e=+t,s=e<d?d:e,i=u/s;s>D.frameRate&&(D.frameRate=s),this._fps=s,this._frameDuration=i}get speed(){return this._speed}set speed(t){const e=+t;this._speed=e<d?d:e}requestTick(t){const e=this._frameDuration,s=t-this._lastTickTime,i=.25*e;return s+(i<4?i:4)<e?0:(this._lastTickTime=s>=e?t-s%e:t,1)}computeDeltaTime(t){const e=t-this._lastTime;return this.deltaTime=e,this._lastTime=t,e}}const Xt={animation:null,update:_},Yt=(()=>e?requestAnimationFrame:setImmediate)(),Wt=(()=>e?cancelAnimationFrame:clearImmediate)();class Ut extends Ht{constructor(t){super(t),this.useDefaultMainLoop=!0,this.pauseOnDocumentHidden=!0,this.defaults=D,this.paused=!0,this.reqId=0}update(){const t=this._currentTime=P();if(this.requestTick(t)){this.computeDeltaTime(t);const e=this._speed,s=this._fps;let i=this._head;for(;i;){const r=i._next;i.paused?(bt(this,i),this._hasChildren=!!this._tail,i._running=!1,i.completed&&!i._cancelled&&i.cancel()):Ft(i,(t-i._startTime)*i._speed*e,0,0,i._fps<s?i.requestTick(t):1),i=r}Xt.update()}}wake(){return this.useDefaultMainLoop&&!this.reqId&&(this.requestTick(P()),this.reqId=Yt(jt)),this}pause(){if(this.reqId)return this.paused=!0,Gt()}resume(){if(this.paused)return this.paused=!1,_t(this,t=>t.resetTime()),this.wake()}get speed(){return this._speed*(1===I.timeScale?1:u)}set speed(t){const e=t*I.timeScale;this._speed!==e&&(this._speed=e,_t(this,t=>t.speed=t._speed))}get timeUnit(){return 1===I.timeScale?"ms":"s"}set timeUnit(t){const e="s"===t,s=e?.001:1;if(I.timeScale!==s){I.timeScale=s,I.tickThreshold=200*s;const t=e?.001:u;this.defaults.duration*=t,this._speed*=t}}get precision(){return I.precision}set precision(t){I.precision=t}}const qt=(()=>{const t=new Ut(P());return e&&(R.engine=t,i.addEventListener("visibilitychange",()=>{t.pauseOnDocumentHidden&&(i.hidden?t.pause():t.resume())})),t})(),jt=()=>{qt._head?(qt.reqId=Yt(jt),qt.update()):qt.reqId=0},Gt=()=>(Wt(qt.reqId),qt.reqId=0,qt),Zt={_rep:new WeakMap,_add:new Map},Qt=(t,e,s="_rep")=>{const i=Zt[s];let r=i.get(t);return r||(r={},i.set(t,r)),r[e]?r[e]:r[e]={_head:null,_tail:null}},Jt=(t,e)=>t._isOverridden||t._absoluteStartTime>e._absoluteStartTime,Kt=t=>{t._isOverlapped=1,t._isOverridden=1,t._changeDuration=d,t._currentTime=d},te=(t,e)=>{const s=t._composition;if(s===r.replace){const s=t._absoluteStartTime;vt(e,t,Jt,"_prevRep","_nextRep");const i=t._prevRep;if(i){const e=i.parent,r=i._absoluteEndTime;if(t.parent.id!==e.id&&e.iterationCount>1&&r+(e.duration-e.iterationDuration)>s){Kt(i);let t=i._prevRep;for(;t&&t.parent.id===e.id;)Kt(t),t=t._prevRep}const n=t._absoluteUpdateStartTime;if(r>n){const t=i._startTime,e=r-(t+i._updateDuration),s=ct(n-e-t,12);i._changeDuration=s,i._currentTime=s,i._isOverlapped=1,s<d&&Kt(i)}const o=t.parent.parent;if(!o||o!==e.parent){let t=!0;if(_t(e,e=>{e._isOverlapped||(t=!1)}),t){const t=e.parent;if(t){let s=!0;_t(t,t=>{t!==e&&_t(t,t=>{t._isOverlapped||(s=!1)})}),s&&t.cancel()}else e.cancel()}}}}else if(s===r.blend){const e=Qt(t.target,t.property,"_add"),s=(t=>{let e=Xt.animation;return e||(e={duration:d,computeDeltaTime:_,_offset:0,_delay:0,_head:null,_tail:null},Xt.animation=e,Xt.update=()=>{t.forEach(t=>{for(let e in t){const s=t[e],i=s._head;if(i){const t=i._valueType,e=3===t||2===t?gt(i._fromNumbers):null;let r=i._fromNumber,n=s._tail;for(;n&&n!==i;){if(e)for(let t=0,s=n._numbers.length;t<s;t++)e[t]+=n._numbers[t];else r+=n._number;n=n._prevAdd}i._toNumber=r,i._toNumbers=e}}}),Pt(e,1,1,0,2)}),e})(Zt._add);let i=e._head;i||(i={...t},i._composition=r.replace,i._updateDuration=d,i._startTime=0,i._numbers=gt(t._fromNumbers),i._number=0,i._next=null,i._prev=null,vt(e,i),vt(s,i));const n=t._toNumber;if(t._fromNumber=i._fromNumber-n,t._toNumber=0,t._numbers=gt(t._fromNumbers),t._number=0,i._fromNumber=n,t._toNumbers.length){const e=gt(t._toNumbers);e.forEach((e,s)=>{t._fromNumbers[s]=i._fromNumbers[s]-e,t._toNumbers[s]=0}),i._fromNumbers=e}vt(e,t,null,"_prevAdd","_nextAdd")}return t},ee=t=>{const e=t._composition;if(e!==r.none){const s=t.target,i=t.property,n=Zt._rep.get(s)[i];if(bt(n,t,"_prevRep","_nextRep"),e===r.blend){const e=Zt._add,r=e.get(s);if(!r)return;const n=r[i],o=Xt.animation;bt(n,t,"_prevAdd","_nextAdd");const a=n._head;if(a&&a===n._tail){bt(n,a,"_prevAdd","_nextAdd"),bt(o,a);let t=!0;for(let e in r)if(r[e]._head){t=!1;break}t&&e.delete(s)}}}return t},se=(t,e,s)=>{let i=!1;return _t(e,r=>{const n=r.target;if(t.includes(n)){const t=r.property,o=r._tweenType,a=Vt(s,n,o);(!a||a&&a===t)&&(r.parent._tail===r&&3===r._tweenType&&r._prev&&3===r._prev._tweenType&&(r._prev._renderTransforms=1),bt(e,r),ee(r),i=!0)}},!0),i},ie=(t,e,s)=>{const i=e||qt;let r;if(i._hasChildren){let e=0;_t(i,n=>{if(!n._hasChildren)if(r=se(t,n,s),r&&!n._head)n.cancel(),bt(i,n);else{const t=n._offset+n._delay+n.duration;t>e&&(e=t)}n._head?ie(t,n,s):n._hasChildren=!1},!0),H(i.iterationDuration)||(i.iterationDuration=e)}else r=se(t,i,s);r&&!i._head&&(i._hasChildren=!1,i.cancel&&i.cancel())},re=t=>(t.paused=!0,t.began=!1,t.completed=!1,t),ne=t=>t._cancelled?(t._hasChildren?_t(t,ne):_t(t,t=>{t._composition!==r.none&&te(t,Qt(t.target,t.property))}),t._cancelled=0,t):t;let oe=0;const ae=(t,e)=>t._priority>e._priority;class le extends Ht{constructor(t={},e=null,s=0){super(0),++oe;const{id:i,delay:r,duration:n,reversed:o,alternate:a,loop:l,loopDelay:h,autoplay:c,frameRate:u,playbackRate:p,priority:m,onComplete:f,onLoop:g,onPause:y,onBegin:b,onBeforeUpdate:v,onUpdate:T}=t;A.current&&A.current.register(this);const x=e?0:qt._lastTickTime,S=e?e.defaults:I.defaults,w=z(r)||H(r)?S.delay:+r,$=z(n)||H(n)?1/0:+n,C=$t(l,S.loop),E=$t(h,S.loopDelay);let k=!0===C||C===1/0||C<0?1/0:C+1,N=0;e?N=s:(qt.reqId||qt.requestTick(P()),N=(qt._lastTickTime-qt._startTime)*I.timeScale),this.id=H(i)?oe:i,this.parent=e,this.duration=mt(($+E)*k-E)||d,this.backwards=!1,this.paused=!0,this.began=!1,this.completed=!1,this.onBegin=b||S.onBegin,this.onBeforeUpdate=v||S.onBeforeUpdate,this.onUpdate=T||S.onUpdate,this.onLoop=g||S.onLoop,this.onPause=y||S.onPause,this.onComplete=f||S.onComplete,this.iterationDuration=$,this.iterationCount=k,this._autoplay=!e&&$t(c,S.autoplay),this._offset=N,this._delay=w,this._loopDelay=E,this._iterationTime=0,this._currentIteration=0,this._resolve=_,this._running=!1,this._reversed=+$t(o,S.reversed),this._reverse=this._reversed,this._cancelled=0,this._alternate=$t(a,S.alternate),this._prev=null,this._next=null,this._lastTickTime=x,this._startTime=x,this._lastTime=x,this._fps=$t(u,S.frameRate),this._speed=$t(p,S.playbackRate),this._priority=+$t(m,1)}get cancelled(){return!!this._cancelled}set cancelled(t){t?this.cancel():this.reset(!0).play()}get currentTime(){return dt(ct(this._currentTime,I.precision),-this._delay,this.duration)}set currentTime(t){const e=this.paused;this.pause().seek(+t),e||this.resume()}get iterationCurrentTime(){return dt(ct(this._iterationTime,I.precision),0,this.iterationDuration)}set iterationCurrentTime(t){this.currentTime=this.iterationDuration*this._currentIteration+t}get progress(){return dt(ct(this._currentTime/this.duration,10),0,1)}set progress(t){this.currentTime=this.duration*t}get iterationProgress(){return dt(ct(this._iterationTime/this.iterationDuration,10),0,1)}set iterationProgress(t){const e=this.iterationDuration;this.currentTime=e*this._currentIteration+e*t}get currentIteration(){return this._currentIteration}set currentIteration(t){this.currentTime=this.iterationDuration*dt(+t,0,this.iterationCount-1)}get reversed(){return!!this._reversed}set reversed(t){t?this.reverse():this.play()}get speed(){return super.speed}set speed(t){super.speed=t,this.resetTime()}reset(t=!1){return ne(this),this._reversed&&!this._reverse&&(this.reversed=!1),this._iterationTime=this.iterationDuration,Ft(this,0,1,~~t,2),re(this),this._hasChildren&&_t(this,re),this}init(t=!1){this.fps=this._fps,this.speed=this._speed,!t&&this._hasChildren&&Ft(this,this.duration,1,~~t,2),this.reset(t);const e=this._autoplay;return!0===e?this.resume():e&&!H(e.linked)&&e.link(this),this}resetTime(){const t=1/(this._speed*qt._speed);return this._startTime=P()-(this._currentTime+this._delay)*t,this}pause(){return this.paused||(this.paused=!0,this.onPause(this)),this}resume(){return this.paused?(this.paused=!1,this.duration<=d&&!this._hasChildren?Ft(this,d,0,0,2):(this._running||(vt(qt,this,ae),qt._hasChildren=!0,this._running=!0),this.resetTime(),this._startTime-=12,qt.wake()),this):this}restart(){return this.reset().resume()}seek(t,e=0,s=0){ne(this),this.completed=!1;const i=this.paused;return this.paused=!0,Ft(this,t+this._delay,~~e,~~s,1),i?this:this.resume()}alternate(){const t=this._reversed,e=this.iterationCount,s=this.iterationDuration,i=e===1/0?rt(c/s):e;return this._reversed=+(!this._alternate||i%2?!t:t),e===1/0?this.iterationProgress=this._reversed?1-this.iterationProgress:this.iterationProgress:this.seek(s*i-this._currentTime),this.resetTime(),this}play(){return this._reversed&&this.alternate(),this.resume()}reverse(){return this._reversed||this.alternate(),this.resume()}cancel(){return this._hasChildren?_t(this,t=>t.cancel(),!0):_t(this,ee),this._cancelled=1,this.pause()}stretch(t){const e=this.duration,s=ft(t);if(e===s)return this;const i=t/e,r=t<=d;return this.duration=r?d:s,this.iterationDuration=r?d:ft(this.iterationDuration*i),this._offset*=i,this._delay*=i,this._loopDelay*=i,this}revert(){Ft(this,0,1,0,1);const t=this._autoplay;return t&&t.linked&&t.linked===this&&t.revert(),this.cancel()}complete(t=0){return this.seek(this.duration,t).cancel()}then(t=_){const e=this.then,s=()=>{this.then=null,t(this),this.then=e,this._resolve=_};return new Promise(t=>(this._resolve=()=>t(s()),this.completed&&this._resolve(),this))}}function he(t){const e=O(t)?A.root.querySelectorAll(t):t;if(e instanceof NodeList||e instanceof HTMLCollection)return e}function de(t){if(X(t))return[];if(!e)return F(t)&&t.flat(1/0)||[t];if(F(t)){const e=t.flat(1/0),s=[];for(let t=0,i=e.length;t<i;t++){const i=e[t];if(!X(i)){const t=he(i);if(t)for(let e=0,i=t.length;e<i;e++){const i=t[e];if(!X(i)){let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}else{let t=!1;for(let e=0,r=s.length;e<r;e++)if(s[e]===i){t=!0;break}t||s.push(i)}}}return s}const s=he(t);return s?Array.from(s):[t]}function ce(t){const e=de(t),s=e.length;for(let t=0;t<s;t++){const s=e[t];if(!s[n]){s[n]=!0;const t=Y(s);(s.nodeType||t)&&(s[o]=!0,s[a]=t,s[l]={})}}return e}const ue={deg:1,rad:180/lt,turn:360},pe={},me=(t,e,s,r=!1)=>{const n=e.u,o=e.n;if(1===e.t&&n===s)return e;const a=o+n+s,l=pe[a];if(H(l)||r){let r;if(n in ue)r=o*ue[n]/ue[s];else{const e=100,a=t.cloneNode(),l=t.parentNode,h=l&&l!==i?l:i.body;h.appendChild(a);const d=a.style;d.width=e+n;const c=a.offsetWidth||e;d.width=e+s;const u=c/(a.offsetWidth||e);h.removeChild(a),r=u*o}e.n=r,pe[a]=r}else e.n=l;return e.t,e.u=s,e},fe=t=>t,ge=(t=1.68)=>e=>Q(e,+t),ye={in:t=>e=>t(e),out:t=>e=>1-t(1-e),inOut:t=>e=>e<.5?t(2*e)/2:1-t(-2*e+2)/2,outIn:t=>e=>e<.5?(1-t(1-2*e))/2:(t(2*e-1)+1)/2},_e=lt/2,be=2*lt,ve={[p]:ge,Quad:ge(2),Cubic:ge(3),Quart:ge(4),Quint:ge(5),Sine:t=>1-tt(t*_e),Circ:t=>1-J(1-t*t),Expo:t=>t?Q(2,10*t-10):0,Bounce:t=>{let e,s=4;for(;t<((e=Q(2,--s))-1)/11;);return 1/Q(4,3-s)-7.5625*Q((3*e-2)/22-t,2)},Back:(t=1.7)=>e=>(+t+1)*e*e*e-+t*e*e,Elastic:(t=1,e=.3)=>{const s=dt(+t,1,10),i=dt(+e,d,2),r=i/be*nt(1/s),n=be/i;return t=>0===t||1===t?t:-s*Q(2,-10*(1-t))*K((1-t-r)*n)}},Te=(()=>{const t={linear:fe,none:fe};for(let e in ye)for(let s in ve){const i=ve[s],r=ye[e];t[e+s]=s===p||"Back"===s||"Elastic"===s?(t,e)=>r(i(t,e)):r(i)}return t})(),xe={linear:fe,none:fe},Se=t=>{if(xe[t])return xe[t];if(t.indexOf("(")<=-1){const e=ye[t]||t.includes("Back")||t.includes("Elastic")?Te[t]():Te[t];return e?xe[t]=e:fe}{const e=t.slice(0,-1).split("("),s=Te[e[0]];return s?xe[t]=s(...e[1].split(",")):fe}},we=["steps(","irregular(","linear(","cubicBezier("],$e=t=>{if(O(t))for(let e=0,s=we.length;e<s;e++)if(B(t,we[e]))return console.warn(`String syntax for \`ease: "${t}"\` has been removed from the core and replaced by importing and passing the easing function directly: \`ease: ${t}\``),fe;return z(t)?t:O(t)?Se(t):fe},Ce={t:0,n:0,u:null,o:null,d:null,s:null},Ee={t:0,n:0,u:null,o:null,d:null,s:null},ke={},Ne={func:null},De={func:null},Ae=[null],Ie=[null,null],Re={to:null};let Le,Be,Pe=0,Fe=0;class Me extends le{constructor(t,e,s,i,n=!1,o=0,a){super(e,s,i),this._head,this._tail,++Fe;const l=ce(t),h=l.length,c=e.keyframes,p=c?yt(((t,e)=>{const s={};if(F(t)){const e=[].concat(...t.map(t=>Object.keys(t))).filter(j);for(let i=0,r=e.length;i<r;i++){const r=e[i],n=t.map(t=>{const e={};for(let s in t){const i=t[s];j(s)?s===r&&(e.to=i):e[s]=i}return e});s[r]=n}}else{const i=$t(e.duration,I.defaults.duration),r=Object.keys(t).map(e=>({o:parseFloat(e)/100,p:t[e]})).sort((t,e)=>t.o-e.o);r.forEach(t=>{const e=t.o,r=t.p;for(let t in r)if(j(t)){let n=s[t];n||(n=s[t]=[]);const o=e*i;let a=n.length,l=n[a-1];const h={to:r[t]};let d=0;for(let t=0;t<a;t++)d+=n[t].duration;1===a&&(h.from=l.to),r.ease&&(h.ease=r.ease),h.duration=o-(a?d:0),n.push(h)}return t});for(let t in s){const e=s[t];let i;for(let t=0,s=e.length;t<s;t++){const s=e[t],r=s.ease;s.ease=i||void 0,i=r}e[0].duration||e.shift()}}return s})(c,e),e):e,{id:f,delay:g,duration:y,ease:_,playbackEase:b,modifier:v,composition:T,onRender:x}=p,S=s?s.defaults:I.defaults,w=$t(_,S.ease),$=$t(b,S.playbackEase),C=$?$e($):null,E=!H(w.ease),k=E?w.ease:$t(_,C?"linear":S.ease),N=E?w.settlingDuration:$t(y,S.duration),D=$t(g,S.delay),A=v||S.modifier,R=H(T)&&h>=u?r.none:H(T)?S.composition:T,L=this._offset+(s?s._offset:0);E&&(w.parent=this);let B=NaN,P=NaN,Y=0,W=0;for(let t=0;t<h;t++){const e=l[t],i=o||t,h=a||l;let c=NaN,u=NaN;for(let t in p)if(j(t)){const o=kt(e,t),a=St(e,t),l=Vt(t,e,o);let f=p[t];const g=F(f);if(n&&!g&&(Ie[0]=f,Ie[1]=f,f=Ie),g){const t=f.length,e=!M(f[0]);2===t&&e?(Re.to=f,Ae[0]=Re,Le=Ae):t>2&&e?(Le=[],f.forEach((t,e)=>{e?1===e?(Ie[1]=t,Le.push(Ie)):Le.push(t):Ie[0]=t})):Le=f}else Ae[0]=f,Le=Ae;let y=null,_=null,b=NaN,v=0,T=0;for(let t=Le.length;T<t;T++){const n=Le[T];M(n)?Be=n:(Re.to=n,Be=Re),Ne.func=null,De.func=null;const c=Et($t(Be.composition,R),e,i,h,null,null),u=V(c)?c:r[c];y||u===r.none||(y=Qt(e,l));const p=y?y._tail:null,f=s&&p&&p.parent.parent===s?p:_,g=Et(Be.to,e,i,h,Ne,f);let x;M(g)&&!H(g.to)?(Be=g,x=g.to):x=g;const S=Et(Be.from,e,i,h,De,f),w=Be.ease||k,$=Et(w,e,i,h,null,f),C=z($)||O($)?$:w,E=!H(C)&&!H(C.ease),I=E?C.ease:C,B=E?C.settlingDuration:Et($t(Be.duration,t>1?Et(N,e,i,h,null,f)/t:N),e,i,h,null,f),P=Et($t(Be.delay,T?0:D),e,i,h,null,f),U=Be.modifier||A,q=!H(S),j=!H(x),G=F(x),Z=G||q&&j,Q=_?v:0,J=_?v+P:P,K=ct(L+J,12),tt=ct(L+Q,12);W||!q&&!G||(W=1);let et=_;if(u!==r.none){let t=y._head;for(;t&&t._absoluteStartTime<=K;)if(t._isOverridden||(et=t),t=t._nextRep,t&&t._absoluteStartTime>=K)for(;t;)Kt(t),t=t._nextRep}if(Z){It(G?Et(x[0],e,i,h,De,f):S,Ce),It(G?Et(x[1],e,i,h,Ne,f):x,Ee);const t=Dt(e,l,o,ke);0===Ce.t&&(et?1===et._valueType&&(Ce.t=1,Ce.u=et._unit):(It(t,Lt),1===Lt.t&&(Ce.t=1,Ce.u=Lt.u)))}else j?It(x,Ee):_?Rt(_,Ee):It(s&&et&&et.parent.parent===s?et._value:Dt(e,l,o,ke),Ee),q?It(S,Ce):_?Rt(_,Ce):It(s&&et&&et.parent.parent===s?et._value:Dt(e,l,o,ke),Ce);if(Ce.o&&(Ce.n=At(et?et._toNumber:It(Dt(e,l,o,ke),Lt).n,Ce.n,Ce.o)),Ee.o&&(Ee.n=At(Ce.n,Ee.n,Ee.o)),Ce.t!==Ee.t)if(3===Ce.t||3===Ee.t){const t=3===Ce.t?Ce:Ee,e=3===Ce.t?Ee:Ce;e.t=3,e.s=gt(t.s),e.d=t.d.map(()=>e.n)}else if(1===Ce.t||1===Ee.t){const t=1===Ce.t?Ce:Ee,e=1===Ce.t?Ee:Ce;e.t=1,e.u=t.u}else if(2===Ce.t||2===Ee.t){const t=2===Ce.t?Ce:Ee,e=2===Ce.t?Ee:Ce;e.t=2,e.d=t.d.map(()=>0)}if(Ce.u!==Ee.u){let t=Ee.u?Ce:Ee;t=me(e,t,Ee.u?Ee.u:Ce.u,!1)}if(Ee.d&&Ce.d&&Ee.d.length!==Ce.d.length){const t=Ce.d.length>Ee.d.length?Ce:Ee,e=t===Ce?Ee:Ce;e.d=t.d.map((t,s)=>H(e.d[s])?0:e.d[s]),e.s=gt(t.s)}const st=ct(+B||d,12);let it=ke[l];X(it)||(ke[l]=null);const rt=a?a.set:null;v=ct(J+st,12);const nt=Ce.d,ot=Ee.d,at=Ee.s,lt={parent:this,id:Pe++,property:l,target:e,_value:null,_toFunc:Ne.func,_fromFunc:De.func,_ease:$e(I),_fromNumbers:nt?gt(nt):m,_toNumbers:ot?gt(ot):m,_strings:at?gt(at):m,_fromNumber:Ce.n,_toNumber:Ee.n,_numbers:nt?gt(nt):m,_number:Ce.n,_unit:Ee.u,_modifier:U,_currentTime:0,_startTime:J,_delay:+P,_updateDuration:st,_changeDuration:st,_absoluteStartTime:K,_absoluteUpdateStartTime:tt,_absoluteEndTime:ct(L+v,12),_hasFromValue:q||G?1:0,_tweenType:o,_setter:rt,_valueType:Ee.t,_composition:u,_isOverlapped:0,_isOverridden:0,_renderTransforms:0,_inlineValue:it,_prevRep:null,_nextRep:null,_prevAdd:null,_nextAdd:null,_prev:null,_next:null};u!==r.none&&te(lt,y);const ht=lt._valueType;if(3===ht)lt._value=Bt(lt,1,-1);else if(1===ht)lt._value=`${U(lt._toNumber)}${lt._unit}`;else if(2===ht){const t=Ee.d;lt._value=`rgba(${ct(t[0],0)},${ct(t[1],0)},${ct(t[2],0)},${t[3]})`}else lt._value=U(lt._toNumber);isNaN(b)&&(b=lt._startTime),_=lt,Y++,vt(this,lt)}(isNaN(P)||b<P)&&(P=b),(isNaN(B)||v>B)&&(B=v),3===o&&(c=Y-T,u=Y)}if(!isNaN(c)){let t=0;_t(this,e=>{t>=c&&t<u&&(e._renderTransforms=1,e._composition===r.blend&&_t(Xt.animation,t=>{t.id===e.id&&(t._renderTransforms=1)})),t++})}}h||console.warn("No target found. Make sure the element you're trying to animate is accessible before creating your animation."),P?(_t(this,t=>{t._startTime-t._delay||(t._delay-=P),t._startTime-=P}),B-=P):P=0,B||(B=d,this.iterationCount=0),this.targets=l,this.id=H(f)?Fe:f,this.duration=B===d?d:mt((B+this._loopDelay)*this.iterationCount-this._loopDelay)||d,this.onRender=x||S.onRender,this._ease=C,this._delay=P,this.iterationDuration=B,!this._autoplay&&W&&this.onRender(this)}stretch(t){const e=this.duration;if(e===ft(t))return this;const s=t/e;return _t(this,t=>{t._updateDuration=ft(t._updateDuration*s),t._changeDuration=ft(t._changeDuration*s),t._currentTime*=s,t._delay*=s,t._startTime*=s,t._absoluteStartTime*=s,t._absoluteUpdateStartTime*=s,t._absoluteEndTime*=s}),super.stretch(t)}refresh(){return _t(this,t=>{const e=t._toFunc,s=t._fromFunc;(e||s)&&(s?(It(s(),Ce),Ce.u!==t._unit&&t.target[o]&&me(t.target,Ce,t._unit,!0),t._fromNumbers=gt(Ce.d),t._fromNumber=Ce.n):e&&(It(Dt(t.target,t.property,t._tweenType),Lt),t._fromNumbers=gt(Lt.d),t._fromNumber=Lt.n),e&&(It(e(),Ee),t._toNumbers=gt(Ee.d),t._strings=gt(Ee.s),t._toNumber=Ee.o?At(t._fromNumber,Ee.n,Ee.o):Ee.n))}),this.duration===d&&this.restart(),this}revert(){return super.revert(),Ot(this)}then(t){return super.then(t)}}const Ve=(t,e)=>{let s=t.iterationDuration;if(s===d&&(s=0),H(e))return s;if(V(+e))return+e;const i=e,r=t?t.labels:null,n=!X(r),o=((t,e)=>{if(B(e,"<")){const s="<"===e[1],i=t._tail,r=i?i._offset+i._delay:0;return s?r:r+i.duration}})(t,i),a=!H(o),l=k.exec(i);if(l){const t=l[0],e=i.split(t),h=n&&e[0]?r[e[0]]:s,d=a?o:n?h:s,c=+e[1];return At(d,c,t[0])}return a?o:n?H(r[i])?s:r[i]:s};function Oe(t,e,s,i,r,n){const o=V(t.duration)&&t.duration<=d?s-d:s;e.composition&&Ft(e,o,1,1,1);const a=i?new Me(i,t,e,o,!1,r,n):new le(t,e,o);return e.composition&&a.init(!0),vt(e,a),_t(e,t=>{const s=t._offset+t._delay+t.duration;s>e.iterationDuration&&(e.iterationDuration=s)}),e.duration=function(t){return mt((t.iterationDuration+t._loopDelay)*t.iterationCount-t._loopDelay)||d}(e),e}let ze=0;class He extends le{constructor(t={}){super(t,null,0),++ze,this.id=H(t.id)?ze:t.id,this.duration=0,this.labels={};const e=t.defaults,s=I.defaults;this.defaults=e?yt(e,s):s,this.composition=$t(t.composition,!0),this.onRender=t.onRender||s.onRender;const i=$t(t.playbackEase,s.playbackEase);this._ease=i?$e(i):null,this.iterationDuration=0}add(t,e,s){const i=M(e),r=M(t);if(i||r){if(this._hasChildren=!0,i){const i=e,r=I.editor&&I.editor.addTimelineChild,n=s&&"Stagger"===s.type&&I.editor,o=z(s)?s:null;if(o||n){const e=de(t),n=this.duration,a=this.iterationDuration,l=i.id;let h=0;const d=e.length,c=r?r(t,i,this.id,s,d):null,u=o||I.editor.resolveStagger(s.defaultValue);e.forEach(t=>{const s={...c||i};this.duration=n,this.iterationDuration=a,H(l)||(s.id=l+"-"+h),Oe(s,this,Ve(this,u(t,h,e,null,this)),t,h,e),h++})}else{const e=r?r(t,i,this.id,s):i,n=s&&s.type?s.defaultValue:s;Oe(e,this,Ve(this,n),t)}}else Oe(t,this,Ve(this,e));return this.composition&&this.init(!0),this}}sync(t,e){if(H(t)||t&&H(t.pause))return this;t.pause();const s=+(t.effect?t.effect.getTiming().duration:t.duration);H(t)||H(t.persist)||(t.persist=!0);const i=I.editor,r=i&&i.addTimelineChild;i&&i.addTimelineSync&&(e=i.addTimelineSync(t,e,this.id),i.addTimelineChild=null);const n=this.add(t,{currentTime:[0,s],duration:s,delay:0,ease:"linear",playbackEase:"linear"},e);return i&&(i.addTimelineChild=r),n}set(t,e,s){return H(e)?this:(e.duration=d,e.composition=r.replace,this.add(t,e,s))}call(t,e){return H(t)||t&&!z(t)?this:(I.editor&&I.editor.addTimelineCall&&(e=I.editor.addTimelineCall(t,e,this.id)),this.add({duration:0,delay:0,onComplete:()=>t(this)},e))}label(t,e){return H(t)||t&&!O(t)||(I.editor&&I.editor.addTimelineLabel&&(e=I.editor.addTimelineLabel(t,e,this.id)),this.labels[t]=Ve(this,e)),this}remove(t,e){return ie(de(t),this,e),this}stretch(t){const e=this.duration;if(e===ft(t))return this;const s=t/e,i=this.labels;_t(this,t=>t.stretch(t.duration*s));for(let t in i)i[t]*=s;return super.stretch(t)}refresh(){return _t(this,t=>{t.refresh&&t.refresh()}),this}revert(){return super.revert(),_t(this,t=>t.revert,!0),Ot(this)}then(t){return super.then(t)}}const Xe=t=>I.editor?I.editor.addTimeline(t):new He(t).init();class Ye{constructor(t,e){A.current&&A.current.register(this);const s=()=>{if(this.callbacks.completed)return;let t=!0;for(let e in this.animations)if(!this.animations[e].paused&&t){t=!1;break}t&&this.callbacks.complete()},i={onBegin:()=>{this.callbacks.completed&&this.callbacks.reset(),this.callbacks.play()},onComplete:s,onPause:s},n={v:1,autoplay:!1},o={};if(this.targets=[],this.animations={},this.callbacks=null,!H(t)&&!H(e)){for(let t in e){const s=e[t];j(t)?o[t]=s:B(t,"on")?n[t]=s:i[t]=s}this.callbacks=new Me({v:0},n);for(let e in o){const s=o[e],n=M(s);let a={},l="+=0";if(n){const t=s.unit;O(t)&&(l+=t)}else a.duration=s;a[e]=n?yt({to:l},s):l;const h=yt(i,a);h.composition=r.replace,h.autoplay=!1;const d=this.animations[e]=new Me(t,h,null,0,!1).init();this.targets.length||this.targets.push(...d.targets),this[e]=(t,e,s)=>{const i=d._head;if(H(t)&&i){const t=i._numbers;return t&&t.length?t:i._modifier(i._number)}return _t(d,e=>{if(F(t))for(let s=0,i=t.length;s<i;s++)H(e._numbers[s])||(e._fromNumbers[s]=e._modifier(e._numbers[s]),e._toNumbers[s]=t[s]);else e._fromNumber=e._modifier(e._number),e._toNumber=t;H(s)||(e._ease=$e(s)),e._currentTime=0}),H(e)||d.stretch(e),d.reset(!0).resume(),this}}}}revert(){for(let t in this.animations)this[t]=_,this.animations[t].revert();return this.animations={},this.targets.length=0,this.callbacks&&this.callbacks.revert(),this}}const We=(t,e,s,i,r)=>i+(t-e)/(s-e)*(r-i);var Ue=Object.freeze({__proto__:null,clamp:dt,damp:(t,e,s,i)=>i?1===i?e:pt(t,e,1-Math.exp(-i*s*.1)):t,degToRad:t=>t*Math.PI/180,lerp:pt,mapRange:We,padEnd:(t,e,s)=>`${t}`.padEnd(e,s),padStart:(t,e,s)=>`${t}`.padStart(e,s),radToDeg:t=>180*t/Math.PI,round:ct,roundPad:(t,e)=>(+t).toFixed(e),snap:ut,wrap:(t,e,s)=>((t-e)%(s-e)+(s-e))%(s-e)+e});const qe=10*u;class je{constructor(t={}){const e=!H(t.bounce)||!H(t.duration);this.timeStep=.02,this.restThreshold=5e-4,this.restDuration=200,this.maxDuration=6e4,this.maxRestSteps=this.restDuration/this.timeStep/u,this.maxIterations=this.maxDuration/this.timeStep/u,this.bn=dt($t(t.bounce,.5),-1,1),this.pd=dt($t(t.duration,628),10*I.timeScale,qe*I.timeScale),this.m=dt($t(t.mass,1),1,qe),this.s=dt($t(t.stiffness,100),d,qe),this.d=dt($t(t.damping,10),d,qe),this.v=dt($t(t.velocity,0),-1e4,qe),this.w0=0,this.zeta=0,this.wd=0,this.b=0,this.completed=!1,this.solverDuration=0,this.settlingDuration=0,this.parent=null,this.onComplete=t.onComplete||_,e&&this.calculateSDFromBD(),this.compute(),this.ease=t=>{const e=t*this.settlingDuration,s=this.completed,i=this.pd;return e>=i&&!s&&(this.completed=!0,this.onComplete(this.parent)),e<i&&s&&(this.completed=!1),0===t||1===t?t:this.solve(t*this.solverDuration)}}solve(t){const{zeta:e,w0:s,wd:i,b:r}=this;let n=t;return n=e<1?st(-n*e*s)*(1*tt(i*n)+r*K(i*n)):1===e?(1+r*n)*st(-n*s):((1+r)*st((-e*s+i)*n)+(1-r)*st((-e*s-i)*n))/2,1-n}calculateSDFromBD(){const t=1===I.timeScale?this.pd/u:this.pd;this.m=1,this.v=0,this.s=Q(2*lt/t,2),this.bn>=0?this.d=4*(1-this.bn)*lt/t:this.d=4*lt/(t*(1+this.bn)),this.s=ct(dt(this.s,d,qe),3),this.d=ct(dt(this.d,d,300),3)}calculateBDFromSD(){const t=2*lt/J(this.s);this.pd=t*(1===I.timeScale?u:1);const e=this.d/(2*J(this.s));this.bn=e<=1?1-this.d*t/(4*lt):4*lt/(this.d*t)-1,this.bn=ct(dt(this.bn,-1,1),3),this.pd=ct(dt(this.pd,10*I.timeScale,qe*I.timeScale),3)}compute(){const{maxRestSteps:t,maxIterations:e,restThreshold:s,timeStep:i,m:r,d:n,s:o,v:a}=this,l=this.w0=dt(J(o/r),d,u),h=this.zeta=n/(2*J(o*r));h<1?(this.wd=l*J(1-h*h),this.b=(h*l-a)/this.wd):1===h?(this.wd=0,this.b=-a+l):(this.wd=l*J(h*h-1),this.b=(h*l-a)/this.wd);let c=0,p=0,m=0;for(;p<=t&&m<=e;)et(1-this.solve(c))<s?p++:p=0,this.solverDuration=c,c+=i,m++;this.settlingDuration=ct(this.solverDuration*u,0)*I.timeScale}get bounce(){return this.bn}set bounce(t){this.bn=dt($t(t,1),-1,1),this.calculateSDFromBD(),this.compute()}get duration(){return this.pd}set duration(t){this.pd=dt($t(t,1),10*I.timeScale,qe*I.timeScale),this.calculateSDFromBD(),this.compute()}get stiffness(){return this.s}set stiffness(t){this.s=dt($t(t,100),d,qe),this.calculateBDFromSD(),this.compute()}get damping(){return this.d}set damping(t){this.d=dt($t(t,10),d,qe),this.calculateBDFromSD(),this.compute()}get mass(){return this.m}set mass(t){this.m=dt($t(t,1),1,qe),this.compute()}get velocity(){return this.v}set velocity(t){this.v=dt($t(t,0),-1e4,qe),this.compute()}}const Ge=t=>new je(t),Ze=t=>(console.warn("createSpring() is deprecated use spring() instead"),new je(t)),Qe={_head:null,_tail:null},Je=(t,e,s)=>{let i,r=Qe._head;for(;r;){const n=r._next,o=r.$el===t,a=!e||r.property===e,l=!s||r.parent===s;if(o&&a&&l){i=r.animation;try{i.commitStyles()}catch{}i.cancel(),bt(Qe,r);const t=r.parent;t&&(t._completed++,t.animations.length===t._completed&&(t.completed=!0,t.paused=!0,t.muteCallbacks||(t.onComplete(t),t._resolve(t))))}r=n}return i},Ke=(t,e,s,i,r)=>{const n=e.animate(i,r),o=r.delay+ +r.duration*r.iterations;n.playbackRate=t._speed,t.paused&&n.pause(),t.duration<o&&(t.duration=o,t.controlAnimation=n),t.animations.push(n),Je(e,s),vt(Qe,{parent:t,animation:n,$el:e,property:s,_next:null,_prev:null});const a=()=>Je(e,s,t);return n.oncancel=a,n.onremove=a,t.persist||(n.onfinish=a),n};function ts(t,e,s){const i=ce(t);if(!i.length)return;const[r]=i,n=kt(r,e),o=Vt(e,r,n);let a=Dt(r,o);if(H(s))return a;if(It(a,Lt),0===Lt.t||1===Lt.t){if(!1===s)return Lt.n;{const t=me(r,Lt,s,!1);return`${ct(t.n,I.precision)}${t.u}`}}}const es=(t,e)=>{if(!H(e))return I.editor&&I.editor.addSet?I.editor.addSet(t,e):(e.duration=d,e.composition=$t(e.composition,r.none),new Me(t,e,null,0,!0).resume())},ss=(t,e,s)=>{const i=de(t);for(let t=0,r=i.length;t<r;t++)Je(i[t],s,e&&e.controlAnimation&&e);return ie(i,e,s),i},is=t=>{t.cancelable&&t.preventDefault()};class rs{constructor(t){this.el=t,this.zIndex=0,this.parentElement=null,this.classList={add:_,remove:_}}get x(){return this.el.x||0}set x(t){this.el.x=t}get y(){return this.el.y||0}set y(t){this.el.y=t}get width(){return this.el.width||0}set width(t){this.el.width=t}get height(){return this.el.height||0}set height(t){this.el.height=t}getBoundingClientRect(){return{top:this.y,right:this.x,bottom:this.y+this.height,left:this.x+this.width}}}class ns{constructor(t){this.$el=t,this.inlineTransforms=[],this.point=new DOMPoint,this.inversedMatrix=this.getMatrix().inverse()}normalizePoint(t,e){return this.point.x=t,this.point.y=e,this.point.matrixTransform(this.inversedMatrix)}traverseUp(t){let e=this.$el.parentElement,s=0;for(;e&&e!==i;)t(e,s),e=e.parentElement,s++}getMatrix(){const t=new DOMMatrix;return this.traverseUp(e=>{const s=getComputedStyle(e).transform;if(s){const e=new DOMMatrix(s);t.preMultiplySelf(e)}}),t}remove(){this.traverseUp((t,e)=>{this.inlineTransforms[e]=t.style.transform,t.style.transform="none"})}revert(){this.traverseUp((t,e)=>{const s=this.inlineTransforms[e];""===s?t.style.removeProperty("transform"):t.style.transform=s})}}const os=(t,e)=>t&&z(t)?t(e):t;let as=0;class ls{constructor(t,e={}){if(!t)return;A.current&&A.current.register(this);const r=e.x,n=e.y,o=e.trigger,a=e.modifier,l=e.releaseEase,h=l&&$e(l),d=!H(l)&&!H(l.ease),u=M(r)&&!H(r.mapTo)?r.mapTo:"translateX",p=M(n)&&!H(n.mapTo)?n.mapTo:"translateY",m=os(e.container,this);this.containerArray=F(m)?m:null,this.$container=m&&!this.containerArray?de(m)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.$target=M(t)?new rs(t):de(t)[0],this.$trigger=de(o||t)[0],this.fixed="fixed"===ts(this.$target,"position"),this.isFinePointer=!0,this.containerPadding=[0,0,0,0],this.containerFriction=0,this.releaseContainerFriction=0,this.snapX=0,this.snapY=0,this.scrollSpeed=0,this.scrollThreshold=0,this.dragSpeed=0,this.dragThreshold=3,this.maxVelocity=0,this.minVelocity=0,this.velocityMultiplier=0,this.cursor=!1,this.releaseXSpring=d?l:Ge({mass:$t(e.releaseMass,1),stiffness:$t(e.releaseStiffness,80),damping:$t(e.releaseDamping,20)}),this.releaseYSpring=d?l:Ge({mass:$t(e.releaseMass,1),stiffness:$t(e.releaseStiffness,80),damping:$t(e.releaseDamping,20)}),this.releaseEase=h||Te.outQuint,this.hasReleaseSpring=d,this.onGrab=e.onGrab||_,this.onDrag=e.onDrag||_,this.onRelease=e.onRelease||_,this.onUpdate=e.onUpdate||_,this.onSettle=e.onSettle||_,this.onSnap=e.onSnap||_,this.onResize=e.onResize||_,this.onAfterResize=e.onAfterResize||_,this.disabled=[0,0];const f={};if(a&&(f.modifier=a),H(r)||!0===r)f[u]=0;else if(M(r)){const t=r,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[u]=e}else!1===r&&(f[u]=0,this.disabled[0]=1);if(H(n)||!0===n)f[p]=0;else if(M(n)){const t=n,e={};t.modifier&&(e.modifier=t.modifier),t.composition&&(e.composition=t.composition),f[p]=e}else!1===n&&(f[p]=0,this.disabled[1]=1);this.animate=new Ye(this.$target,f),this.xProp=u,this.yProp=p,this.destX=0,this.destY=0,this.deltaX=0,this.deltaY=0,this.scroll={x:0,y:0},this.coords=[this.x,this.y,0,0],this.snapped=[0,0],this.pointer=[0,0,0,0,0,0,0,0],this.scrollView=[0,0],this.dragArea=[0,0,0,0],this.containerBounds=[-c,c,c,-c],this.scrollBounds=[0,0,0,0],this.targetBounds=[0,0,0,0],this.window=[0,0],this.velocityStack=[0,0,0],this.velocityStackIndex=0,this.velocityTime=P(),this.velocity=0,this.angle=0,this.cursorStyles=null,this.triggerStyles=null,this.bodyStyles=null,this.targetStyles=null,this.touchActionStyles=null,this.transforms=new ns(this.$target),this.overshootCoords={x:0,y:0},this.overshootTicker=new le({autoplay:!1,onUpdate:()=>{this.updated=!0,this.manual=!0,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,1),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,1)},onComplete:()=>{this.manual=!1,this.disabled[0]||this.animate[this.xProp](this.overshootCoords.x,0),this.disabled[1]||this.animate[this.yProp](this.overshootCoords.y,0)}},null,0).init(),this.updateTicker=new le({autoplay:!1,onUpdate:()=>this.update()},null,0).init(),this.contained=!H(m),this.manual=!1,this.grabbed=!1,this.dragged=!1,this.updated=!1,this.released=!1,this.canScroll=!1,this.enabled=!1,this.initialized=!1,this.activeProp=this.disabled[1]?u:p,this.animate.callbacks.onRender=()=>{const t=this.updated,e=!(this.grabbed&&t)&&this.released,s=this.x,i=this.y,r=s-this.coords[2],n=i-this.coords[3];this.deltaX=r,this.deltaY=n,this.coords[2]=s,this.coords[3]=i,t&&(r||n)&&this.onUpdate(this),e?(this.computeVelocity(r,n),this.angle=at(n,r)):this.updated=!1},this.animate.callbacks.onComplete=()=>{!this.grabbed&&this.released&&(this.released=!1),this.manual||(this.deltaX=0,this.deltaY=0,this.velocity=0,this.velocityStack[0]=0,this.velocityStack[1]=0,this.velocityStack[2]=0,this.velocityStackIndex=0,this.onSettle(this))},this.resizeTicker=new le({autoplay:!1,duration:150*I.timeScale,onComplete:()=>{this.onResize(this),this.refresh(),this.onAfterResize(this)}}).init(),this.parameters=e,this.resizeObserver=new ResizeObserver(()=>{this.initialized?this.resizeTicker.restart():this.initialized=!0}),this.enable(),this.refresh(),this.resizeObserver.observe(this.$container),M(t)||this.resizeObserver.observe(this.$target)}computeVelocity(t,e){const s=this.velocityTime,i=P(),r=i-s;if(r<17)return this.velocity;this.velocityTime=i;const n=this.velocityStack,o=this.velocityMultiplier,a=this.minVelocity,l=this.maxVelocity,h=this.velocityStackIndex;n[h]=ct(dt(J(t*t+e*e)/r*o,a,l),5);const d=ot(n[0],n[1],n[2]);return this.velocity=d,this.velocityStackIndex=(h+1)%3,d}setX(t,e=!1){if(this.disabled[0])return;const s=ct(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destX=s,this.snapped[0]=ut(s,this.snapX),this.animate[this.xProp](s,0),this.manual=!1,this}setY(t,e=!1){if(this.disabled[1])return;const s=ct(t,5);return this.overshootTicker.pause(),this.manual=!0,this.updated=!e,this.destY=s,this.snapped[1]=ut(s,this.snapY),this.animate[this.yProp](s,0),this.manual=!1,this}get x(){return ct(this.animate[this.xProp](),I.precision)}set x(t){this.setX(t,!1)}get y(){return ct(this.animate[this.yProp](),I.precision)}set y(t){this.setY(t,!1)}get progressX(){return We(this.x,this.containerBounds[3],this.containerBounds[1],0,1)}set progressX(t){this.setX(We(t,0,1,this.containerBounds[3],this.containerBounds[1]),!1)}get progressY(){return We(this.y,this.containerBounds[0],this.containerBounds[2],0,1)}set progressY(t){this.setY(We(t,0,1,this.containerBounds[0],this.containerBounds[2]),!1)}updateScrollCoords(){const t=ct(this.useWin?s.scrollX:this.$container.scrollLeft,0),e=ct(this.useWin?s.scrollY:this.$container.scrollTop,0),[i,r,n,o]=this.containerPadding,a=this.scrollThreshold;this.scroll.x=t,this.scroll.y=e,this.scrollBounds[0]=e-this.targetBounds[0]+i-a,this.scrollBounds[1]=t-this.targetBounds[1]-r+a,this.scrollBounds[2]=e-this.targetBounds[2]-n+a,this.scrollBounds[3]=t-this.targetBounds[3]+o-a}updateBoundingValues(){const t=this.$container;if(!t)return;const e=this.x,r=this.y,n=this.coords[2],o=this.coords[3];this.coords[2]=0,this.coords[3]=0,this.setX(0,!0),this.setY(0,!0),this.transforms.remove();const a=this.window[0]=s.innerWidth,l=this.window[1]=s.innerHeight,h=this.useWin,d=t.scrollWidth,c=t.scrollHeight,u=this.fixed,p=t.getBoundingClientRect(),[m,f,g,y]=this.containerPadding;this.dragArea[0]=h?0:p.left,this.dragArea[1]=h?0:p.top,this.scrollView[0]=h?dt(d,a,d):d,this.scrollView[1]=h?dt(c,l,c):c,this.updateScrollCoords();const{width:_,height:b,left:v,top:T,right:x,bottom:S}=t.getBoundingClientRect();this.dragArea[2]=ct(h?dt(_,a,a):_,0),this.dragArea[3]=ct(h?dt(b,l,l):b,0);const w=ts(t,"overflow"),$="visible"===w,C="hidden"===w;if(this.canScroll=!u&&this.contained&&(t===i.body&&$||!C&&!$)&&(d>this.dragArea[2]+y-f||c>this.dragArea[3]+m-g)&&(!this.containerArray||this.containerArray&&!F(this.containerArray)),this.contained){const e=this.scroll.x,s=this.scroll.y,i=this.canScroll,r=this.$target.getBoundingClientRect(),n=i?h?0:t.scrollLeft:0,o=i?h?0:t.scrollTop:0,d=i?this.scrollView[0]-n-_:0,c=i?this.scrollView[1]-o-b:0;this.targetBounds[0]=ct(r.top+s-(h?0:T),0),this.targetBounds[1]=ct(r.right+e-(h?a:x),0),this.targetBounds[2]=ct(r.bottom+s-(h?l:S),0),this.targetBounds[3]=ct(r.left+e-(h?0:v),0),this.containerArray?(this.containerBounds[0]=this.containerArray[0]+m,this.containerBounds[1]=this.containerArray[1]-f,this.containerBounds[2]=this.containerArray[2]-g,this.containerBounds[3]=this.containerArray[3]+y):(this.containerBounds[0]=-ct(r.top-(u?dt(T,0,l):T)+o-m,0),this.containerBounds[1]=-ct(r.right-(u?dt(x,0,a):x)-d+f,0),this.containerBounds[2]=-ct(r.bottom-(u?dt(S,0,l):S)-c+g,0),this.containerBounds[3]=-ct(r.left-(u?dt(v,0,a):v)+n-y,0))}this.transforms.revert(),this.coords[2]=n,this.coords[3]=o,this.setX(e,!0),this.setY(r,!0)}isOutOfBounds(t,e,s){if(!this.contained)return 0;const[i,r,n,o]=t,[a,l]=this.disabled,h=!a&&e<o||!a&&e>r,d=!l&&s<i||!l&&s>n;return h&&!d?1:!h&&d?2:h&&d?3:0}refresh(){const t=this.parameters,e=t.x,r=t.y,n=os(t.container,this),o=os(t.containerPadding,this)||0,a=F(o)?o:[o,o,o,o],l=this.x,h=this.y,d=os(t.cursor,this),c={onHover:"grab",onGrab:"grabbing"};if(d){const{onHover:t,onGrab:e}=d;t&&(c.onHover=t),e&&(c.onGrab=e)}const u=os(t.dragThreshold,this),p={mouse:3,touch:7};if(V(u))p.mouse=u,p.touch=u;else if(u){const{mouse:t,touch:e}=u;H(t)||(p.mouse=t),H(e)||(p.touch=e)}this.containerArray=F(n)?n:null,this.$container=n&&!this.containerArray?de(n)[0]:i.body,this.useWin=this.$container===i.body,this.$scrollContainer=this.useWin?s:this.$container,this.isFinePointer=matchMedia("(pointer:fine)").matches,this.containerPadding=$t(a,[0,0,0,0]),this.containerFriction=dt($t(os(t.containerFriction,this),.8),0,1),this.releaseContainerFriction=dt($t(os(t.releaseContainerFriction,this),this.containerFriction),0,1),this.snapX=os(M(e)&&!H(e.snap)?e.snap:t.snap,this),this.snapY=os(M(r)&&!H(r.snap)?r.snap:t.snap,this),this.scrollSpeed=$t(os(t.scrollSpeed,this),1.5