"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _cssAnimation=require("css-animation"),_cssAnimation2=_interopRequireDefault(_cssAnimation),_getRequestAnimationFrame=require("./getRequestAnimationFrame"),_getRequestAnimationFrame2=_interopRequireDefault(_getRequestAnimationFrame);function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var reqAnimFrame=(0,_getRequestAnimationFrame2.default)();function animate(e,t,i){var n=void 0,a=void 0;return(0,_cssAnimation2.default)(e,"dt-motion-collapse",{start:function(){t?(n=e.offsetHeight,e.style.height="0px",e.style.opacity="0"):(e.style.height=e.offsetHeight+"px",e.style.opacity="1")},active:function(){a&&(0,_getRequestAnimationFrame.cancelRequestAnimationFrame)(a),a=reqAnimFrame(function(){e.style.height=(t?n:0)+"px",e.style.opacity=t?"1":"0"})},end:function(){a&&(0,_getRequestAnimationFrame.cancelRequestAnimationFrame)(a),e.style.height="",e.style.opacity="",i()}})}var animation={enter:function(e,t){return animate(e,!0,t)},leave:function(e,t){return animate(e,!1,t)},appear:function(e,t){return animate(e,!0,t)}};exports.default=animation,module.exports=exports.default;