var t,s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,e=Object.prototype.hasOwnProperty,r={};((t,i)=>{for(var h in i)s(t,h,{get:i[h],enumerable:!0})})(r,{Expo:()=>b,Interpol:()=>k,InterpolOptions:()=>o,Power1:()=>c,Power2:()=>m,Power3:()=>f,Power4:()=>g,Ticker:()=>n,Timeline:()=>j,easeAdapter:()=>v,styles:()=>M}),module.exports=(t=r,((t,r,n,o)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let a of h(r))e.call(t,a)||a===n||s(t,a,{get:()=>r[a],enumerable:!(o=i(r,a))||o.enumerable});return t})(s({},"__esModule",{value:!0}),t));var n=class{#t=!1;#s;#i;#h;#e;#r;#n;#o;#a;#l;#u;constructor(){this.#s=[],this.#i={delta:null,time:null,elapsed:null},this.#n=0,this.#u=!0,this.#l=typeof window<"u",this.#p(),setTimeout((()=>this.play()),0)}disable(){this.#u=!1}add(t){this.#s.push(t)}remove(t){this.#s=this.#s.filter((s=>s!==t))}play(){this.#t=!0,this.#h=performance.now(),this.#e=this.#h,this.#r=this.#n+(this.#e-this.#h),this.#o=16,this.#u&&this.#l&&(this.#a=requestAnimationFrame(this.#d))}pause(){this.#t=!1,this.#n=this.#r}stop(){this.#t=!1,this.#n=0,this.#r=0,this.#c(),this.#u&&this.#l&&this.#a&&(cancelAnimationFrame(this.#a),this.#a=null)}raf(t){this.#o=t-(this.#e||t),this.#e=t,this.#r=this.#n+(this.#e-this.#h),this.#i.delta=this.#o,this.#i.time=this.#e,this.#i.elapsed=this.#r;for(const t of this.#s)t(this.#i)}#p(){this.#l&&document.addEventListener("visibilitychange",this.#m)}#c(){this.#l&&document.removeEventListener("visibilitychange",this.#m)}#m=()=>{document.hidden?this.pause():this.play()};#d=(t=performance.now())=>{this.#t&&(this.#u&&this.#l&&(this.#a=requestAnimationFrame(this.#d)),this.raf(t))}},o={ticker:new n,duration:1e3,ease:"linear"};function a(){const t={};return t.promise=new Promise((s=>{t.resolve=s})),t}function l(t,s,i){return Math.max(t,Math.min(s,i))}var u=(t,s=1e3)=>Math.round(t*s)/s,p=t=>"function"==typeof t?t():t,d=()=>{},c={in:t=>t*t,out:t=>t*(2-t),inOut:t=>t<.5?2*t*t:(4-2*t)*t-1},m={in:t=>t*t*t,out:t=>1-Math.pow(1-t,3),inOut:t=>t<.5?4*t*t*t:1-Math.pow(-2*t+2,3)/2},f={in:t=>t*t*t*t,out:t=>1-Math.pow(1-t,4),inOut:t=>t<.5?8*t*t*t*t:1-Math.pow(-2*t+2,4)/2},g={in:t=>t*t*t*t*t,out:t=>1-Math.pow(1-t,5),inOut:t=>t<.5?16*t*t*t*t*t:1-Math.pow(-2*t+2,5)/2},b={in:t=>0===t?0:Math.pow(2,10*(t-1)),out:t=>1===t?1:1-Math.pow(2,-10*t),inOut:t=>0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(2-Math.pow(2,-10*--t))},y=t=>t,v=t=>{let[s,i]=t.split(".");s[0]===s[0].toLowerCase()&&(s=s[0].toUpperCase()+s.slice(1));const h={Linear:y,Power1:c,Power2:m,Power3:f,Power4:g,Expo:b};return h?.[s]?.[i]??y},P=new Map,w=["x","y","z"],M=(t,s)=>{if(t){Array.isArray(t)||(t=[t]);for(const i of t){const t=P.get(i)||{};for(let h in s)if(w.includes(h)){const i=i=>s?.[i]||t?.[i]||"0px";t.translate3d=`translate3d(${i("x")}, ${i("y")}, ${i("z")})`,t[h]=`${s[h]}`}else h.match(/^(translate|rotate|scale|skew)/)?t[h]=`${h}(${s[h]})`:i.style?i.style[h]=s[h]&&`${s[h]}`:i[h]=s[h];const h=Object.keys(t).reduce(((s,i)=>w.includes(i)?s:s+t[i]+" "),"").trim();""!==h&&(i.style.transform=h),P.set(i,t)}}},O=0,k=class{ID=++O;ticker;inTl=!1;debugEnable;#f;#g;get duration(){return this.#g}#e=0;get time(){return this.#e}#b=0;#y=0;get progress(){return this.#y}#v=!1;get isReversed(){return this.#v}#P=!1;get isPlaying(){return this.#P}#w=!1;get isPaused(){return this.#w}#M;get props(){return this.#M}#O;#k;#T;#j;#C;#E;#R;#A;#U;#$=a();#F;#x=!1;constructor({props:t=null,duration:s=o.duration,ease:i=o.ease,reverseEase:h=i,paused:e=!1,delay:r=0,immediateRender:n=!1,beforeStart:a=d,onUpdate:l=d,onComplete:u=d,debug:p=!1,el:c=null}){this.ticker=o.ticker,this.#f=s,this.#w=e,this.#T=r,this.#k=n,this.#E=a,this.#F=c,this.#R=(t,s,i,h)=>{M(this.#F,t),l(t,s,i,h)},this.#A=(t,s,i,h)=>{M(this.#F,t),u(t,s,i,h)},this.debugEnable=p,this.#j=i,this.#C=h,this.#M=this.#D(t),this.refreshComputedValues(),this.#O=this.#I(this.#M),this.#k&&this.#R(this.#O,this.#e,this.#y,this),this.#E(this.#O,this.#e,this.#y,this),this.#w||this.play()}refreshComputedValues(){this.#g=p(this.#f),this.#V((t=>{t._from=p(t.from),t._to=p(t.to)}))}async play(t=0,s=!0){if(!this.#P||s){if(!this.#P||!this.#v)return this.#P?(this.stop(),await this.play(t)):(this.#V((s=>s.value=s._to*t)),this.#e=this.#g*t,this.#y=t,this.#v=!1,this.#P=!0,this.#w=!1,this.#U=setTimeout((()=>{this.ticker.add(this.#_)}),this.#e>0?0:this.#T),this.#$=a(),this.#$.promise);this.#v=!1}}async reverse(t=1,s=!0){if(!this.#P||s){if(!this.#P||this.#v)return this.#P&&this.#v?(this.stop(),await this.reverse(t)):(this.#V((s=>s.value=s._to*t)),this.#e=this.#g*t,this.#y=t,this.#v=!0,this.#P=!0,this.#w=!1,this.ticker.add(this.#_),this.#$=a(),this.#$.promise);this.#v=!0}}pause(){this.#w=!0,this.#P=!1,this.inTl||this.ticker.remove(this.#_)}resume(){this.#w&&(this.#w=!1,this.#P=!0,this.inTl||this.ticker.add(this.#_))}stop(){(!this.inTl||this.inTl&&this.#v)&&(this.#V((t=>t.value=t._from)),this.#e=0,this.#b=this.#y,this.#y=0),this.#P=!1,this.#w=!1,clearTimeout(this.#U),this.inTl||(this.#v=!1,this.ticker.remove(this.#_))}seek(t,s=!0){this.#P&&this.pause(),this.#b=this.#y,this.#y=l(0,t,1),(0!==this.#y&&0===this.#b||1!==this.#y&&1===this.#b)&&this.refreshComputedValues(),this.#e=l(0,this.#g*this.#y,this.#g),this.#S(this.#y),this.#O=this.#q(this.#O,this.#M),this.#b===this.#y&&t!==this.#y||(this.#b!==this.#y&&(this.#x=!1),this.#R(this.#O,this.#e,this.#y,this),this.#z("seek onUpdate",{props:this.#O,time:this.#e,progress:this.#y})),1!==this.#y||this.#x||s||(this.#A(this.#O,this.#e,this.#y,this),this.#b=this.#y,this.#x=!0,this.#z("seek onComplete",{props:this.#O,time:this.#e,progress:this.#y})),0===this.#y&&(this.#b=this.#y,this.#x=!1)}#_=async({delta:t})=>{if(this.#g<=0){this.#V((t=>t.value=t._to));const t={props:this.#q(this.#O,this.#M),time:this.#g,progress:1};return this.#R(t.props,t.time,t.progress,this),this.#A(t.props,t.time,t.progress,this),this.#$.resolve(),void this.stop()}this.#e=l(0,this.#g,this.#e+(this.#v?-t:t)),this.#y=l(0,u(this.#e/this.#g),1),this.#S(this.#y),this.#O=this.#q(this.#O,this.#M),this.#R(this.#O,this.#e,this.#y,this),this.#z("handleTick onUpdate",{props:this.#O,t:this.#e,p:this.#y}),this.#v||1!==this.#y||(this.#z("handleTick onComplete!"),this.#A(this.#O,this.#e,this.#y,this),this.#$.resolve(),this.stop()),this.#v&&0===this.#y&&(this.#$.resolve(),this.stop())};#V(t){for(const s of Object.keys(this.#M))t(this.#M[s])}#S(t){const s=t=>this.#v&&t.reverseEase?t.reverseEase:t.ease;this.#V((i=>i.value=u(i._from+(i._to-i._from)*s(i)(t),1e3)))}#D(t){return Object.keys(t).reduce(((s,i)=>{let h=t[i];return s[i]={from:h?.[0]??h?.from??0,_from:null,to:h?.[1]??h?.to??h??0,_to:null,value:null,unit:h?.[2]??h?.unit??null,ease:this.#L(h?.ease||this.#j),reverseEase:this.#L(h?.reverseEase||h?.ease||this.#C)},s}),{})}#I(t){return Object.keys(t).reduce(((s,i)=>(s[i]=t[i]._from+t[i].unit,s)),{})}#q(t,s){for(const i of Object.keys(t))t[i]=s[i].value+s[i].unit;return this.#O}#L(t){return null!=t?"string"==typeof t?v(t):t:null}#z(...t){this.debugEnable&&console.log("%cinterpol","color: rgb(53,158,182)",this.ID||"",...t)}},T=0,j=class{ID;#y=0;get progress(){return this.#y}#e=0;get time(){return this.#e}#P=!1;get isPlaying(){return this.#P}#v=!1;get isReversed(){return this.#v}#w=!1;get isPaused(){return this.#w}#B=[];#G=0;#H=1;#$=a();#J;#K=0;#N;#R;#A;#Q=0;#W=!1;constructor({onUpdate:t=d,onComplete:s=d,debug:i=!1,paused:h=!1}={}){this.#R=t,this.#A=s,this.#N=i,this.#w=h,this.ID=++T,this.#J=o.ticker,setTimeout((()=>this.#z("adds",this.#B)),1)}add(t,s="0"){const i=t instanceof k?t:new k(t);i.stop(),i.refreshComputedValues(),i.ticker=this.#J,i.inTl=!0,this.#N&&(i.debugEnable=this.#N);const h=this.#B?.[this.#B.length-1];let e,r;return"string"==typeof s?(e=parseFloat(s.includes("=")?s.split("=").join(""):s),this.#K=Math.max(this.#K,this.#K+i.duration+e),r=h?h.time.end+e:0):"number"==typeof s&&(e=s,this.#K=Math.max(0,this.#K,e+i.duration),r=e??0),this.#B.push({itp:i,time:{start:r,end:r+i.duration,offset:e},progress:{start:null,end:null,current:0,last:0}}),this.#X(((t,s)=>{this.#B[s].progress.start=t.time.start/this.#K||0,this.#B[s].progress.end=t.time.end/this.#K||0})),this.isPaused||setTimeout((()=>this.play()),0),this}async play(t=0){if(this.#G=t,!this.#P||!this.#v)return this.#P?(this.stop(),await this.play(t)):(this.#e=this.#K*t,this.#y=t,this.#v=!1,this.#P=!0,this.#w=!1,this.#J.add(this.#_),this.#$=a(),this.#$.promise);this.#v=!1}async reverse(t=1){if(this.#H=t,!this.#P||this.#v)return this.#P&&this.#v?(this.stop(),await this.reverse(t)):(this.#e=this.#K*t,this.#y=t,this.#v=!0,this.#P=!0,this.#w=!1,this.#J.add(this.#_),this.#$=a(),this.#$.promise);this.#v=!0}pause(){this.#P=!1,this.#w=!0,this.#X((t=>t.itp.pause())),this.#J.remove(this.#_)}resume(){this.#w&&(this.#w=!1,this.#P=!0,this.#X((t=>t.itp.resume())),this.#J.add(this.#_))}stop(){this.#y=0,this.#e=0,this.#P=!1,this.#w=!1,this.#v=!1,this.#X((t=>t.itp.stop())),this.#J.remove(this.#_)}seek(t,s=!0,i=!0){this.#P&&this.pause(),this.#y=l(0,t,1),this.#e=l(0,this.#K*this.#y,this.#K),this.#Y(this.#e,this.#y,s),1!==t||i||this.#A(this.#e,this.#y)}refreshComputedValues(){this.#X((t=>t.itp.refreshComputedValues()))}#_=async({delta:t})=>{this.#e=l(0,this.#K,this.#e+(this.#v?-t:t)),this.#y=l(0,u(this.#e/this.#K),1),this.#Y(this.#e,this.#y,!1),(!this.#v&&1===this.#y||0===this.#K)&&(this.#A(this.#e,this.#y),this.#$.resolve(),this.stop()),(this.#v&&0===this.#y||0===this.#K)&&(this.#$.resolve(),this.stop())};#Y(t,s,i=!0){this.#Q>s&&!this.#W&&(this.#W=!0),this.#Q{s.progress.last=s.progress.current,s.progress.current=(t-s.time.start)/s.itp.duration,s.itp.seek(s.progress.current,i)}),this.#W)}#X(t,s=!1){const i=s?this.#B.length-1:0,h=s?-1:this.#B.length,e=s?-1:1;for(let s=i;s!==h;s+=e)t(this.#B[s],s)}#z(...t){this.#N&&console.log("%ctimeline","color: rgb(217,50,133)",this.ID||"",...t)}};//# sourceMappingURL=interpol.cjs.map