import{__assign as e,__rest as t,__spread as o}from"../../../../node_modules/tslib/tslib.es6.js";import{warning as r}from"../../../../../hey-listen/dist/hey-listen.es.js";import{secondsToMilliseconds as n}from"../../utils/time-conversion.js";import{isEasingArray as a,easingDefinitionToFunction as i}from"./easing.js";import{isAnimatable as l}from"./is-animatable.js";import{getDefaultTransition as p}from"./default-transitions.js";import{getAnimatableNone as s}from"../../render/dom/utils/value-types.js";import{inertia as u}from"../../../../../popmotion/dist/es/animations/inertia.js";import{animate as m}from"../../../../../popmotion/dist/es/animations/index.js";function y(e){e.when,e.delay,e.delayChildren,e.staggerChildren,e.staggerDirection,e.repeat,e.repeatType,e.repeatDelay,e.from;var o=t(e,["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from"]);return!!Object.keys(o).length}var f=!1;function d(o){var l=o.ease,p=o.times,s=o.yoyo,u=o.flip,m=o.loop,y=t(o,["ease","times","yoyo","flip","loop"]),d=e({},y);return p&&(d.offset=p),y.duration&&(d.duration=n(y.duration)),y.repeatDelay&&(d.repeatDelay=n(y.repeatDelay)),l&&(d.ease=a(l)?l.map(i):i(l)),"tween"===y.type&&(d.type="keyframes"),(s||m||u)&&(r(!f,"yoyo, loop and flip have been removed from the API. Replace with repeat and repeatType options."),f=!0,s?d.repeatType="reverse":m?d.repeatType="loop":u&&(d.repeatType="mirror"),d.repeat=m||s||u||y.repeat),"spring"!==y.type&&(d.type="keyframes"),d}function c(e,t){var o;return null!==(o=(h(e,t)||{}).delay)&&void 0!==o?o:0}function v(e){return Array.isArray(e.to)&&null===e.to[0]&&(e.to=o(e.to),e.to[0]=e.from),e}function g(t,o,r){var n;return Array.isArray(o.to)&&(null!==(n=t.duration)&&void 0!==n||(t.duration=.8)),v(o),y(t)||(t=e(e({},t),p(r,o.to))),e(e({},o),d(t))}function h(e,t){return e[t]||e.default||e}function j(t,o,a,i){return void 0===i&&(i={}),o.start((function(p){var y,f,d=function(t,o,n,a,i){var p,y=h(a,t),f=null!==(p=y.from)&&void 0!==p?p:o.get(),d=l(t,n);"none"===f&&d&&"string"==typeof n&&(f=s(t,n));var c=l(t,f);return r(c===d,"You are trying to animate "+t+' from "'+f+'" to "'+n+'". '+f+" is not an animatable value - to enable this animation set "+f+" to a value animatable to "+n+" via the `style` property."),c&&d&&!1!==y.type?function(){var r={from:f,to:n,velocity:o.getVelocity(),onComplete:i,onUpdate:function(e){return o.set(e)}};return"inertia"===y.type||"decay"===y.type?u(e(e({},r),y)):m(e(e({},g(y,r,t)),{onUpdate:function(e){var t;r.onUpdate(e),null===(t=y.onUpdate)||void 0===t||t.call(y,e)},onComplete:function(){var e;r.onComplete(),null===(e=y.onComplete)||void 0===e||e.call(y)}}))}:function(){var e;return o.set(n),i(),null===(e=null==y?void 0:y.onComplete)||void 0===e||e.call(y),{stop:function(){}}}}(t,o,a,i,p),v=c(i,t),j=function(){return f=d()};return v?y=setTimeout(j,n(v)):j(),function(){clearTimeout(y),null==f||f.stop()}}))}export{d as convertTransitionToAnimationOptions,c as getDelayFromTransition,g as getPopmotionAnimationOptions,h as getValueTransition,v as hydrateKeyframes,y as isTransitionDefined,j as startAnimation};
//# sourceMappingURL=transitions.js.map
