"use strict";var h=Object.defineProperty;var m=Object.getOwnPropertySymbols;var f=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable;var c=(n,t,e)=>t in n?h(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,r=(n,t)=>{for(var e in t||(t={}))f.call(t,e)&&c(n,e,t[e]);if(m)for(var e of m(t))d.call(t,e)&&c(n,e,t[e]);return n};var A=require("../../../../common/vendor.js");class u{constructor(t,e){this.options=t,this.animation=A.index.createAnimation(r({},t)),this.currentStepAnimates={},this.next=0,this.$=e}_nvuePushAnimates(t,e){let s=this.currentStepAnimates[this.next],i={};if(s?i=s:i={styles:{},config:{}},l.includes(t)){i.styles.transform||(i.styles.transform="");let a="";t==="rotate"&&(a="deg"),i.styles.transform+=`${t}(${e+a}) `}else i.styles[t]=`${e}`;this.currentStepAnimates[this.next]=i}_animateRun(t={},e={}){let s=this.$.$refs.ani.ref;if(!!s)return new Promise((i,a)=>{nvueAnimation.transition(s,r({styles:t},e),o=>{i()})})}_nvueNextAnimate(t,e=0,s){let i=t[e];if(i){let{styles:a,config:o}=i;this._animateRun(a,o).then(()=>{e+=1,this._nvueNextAnimate(t,e,s)})}else this.currentStepAnimates={},typeof s=="function"&&s(),this.isEnd=!0}step(t={}){return this.animation.step(t),this}run(t){this.$.animationData=this.animation.export(),this.$.timer=setTimeout(()=>{typeof t=="function"&&t()},this.$.durationTime)}}const l=["matrix","matrix3d","rotate","rotate3d","rotateX","rotateY","rotateZ","scale","scale3d","scaleX","scaleY","scaleZ","skew","skewX","skewY","translate","translate3d","translateX","translateY","translateZ"],p=["opacity","backgroundColor"],y=["width","height","left","right","top","bottom"];l.concat(p,y).forEach(n=>{u.prototype[n]=function(...t){return this.animation[n](...t),this}});function x(n,t){if(!!t)return clearTimeout(t.timer),new u(n,t)}exports.createAnimation=x;
