text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  
  var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  
  var _simpleAssign = require('simple-assign');
  
  var _simpleAssign2 = _interopRequireDefault(_simpleAssign);
  
  var _react = require('react');
  
  var _react2 = _interopRequireDefault(_react);
  
  var _reactDom = require('react-dom');
  
  var _reactDom2 = _interopRequireDefault(_reactDom);
  
  var _autoPrefix = require('../utils/autoPrefix');
  
  var _autoPrefix2 = _interopRequireDefault(_autoPrefix);
  
  var _transitions = require('../styles/transitions');
  
  var _transitions2 = _interopRequireDefault(_transitions);
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  
  function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
  
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  
  function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  
  var SlideInChild = function (_Component) {
    _inherits(SlideInChild, _Component);
  
    function SlideInChild() {
      _classCallCheck(this, SlideInChild);
  
      return _possibleConstructorReturn(this, Object.getPrototypeOf(SlideInChild).apply(this, arguments));
    }
  
    _createClass(SlideInChild, [{
      key: 'componentWillUnmount',
      value: function componentWillUnmount() {
        clearTimeout(this.enterTimer);
        clearTimeout(this.leaveTimer);
      }
    }, {
      key: 'componentWillEnter',
      value: function componentWillEnter(callback) {
        var style = _reactDom2.default.findDOMNode(this).style;
        var x = this.props.direction === 'left' ? '100%' : this.props.direction === 'right' ? '-100%' : '0';
        var y = this.props.direction === 'up' ? '100%' : this.props.direction === 'down' ? '-100%' : '0';
  
        style.opacity = '0';
        _autoPrefix2.default.set(style, 'transform', 'translate(' + x + ', ' + y + ')');
  
        this.enterTimer = setTimeout(callback, this.props.enterDelay);
      }
    }, {
      key: 'componentDidEnter',
      value: function componentDidEnter() {
        var style = _reactDom2.default.findDOMNode(this).style;
        style.opacity = '1';
        _autoPrefix2.default.set(style, 'transform', 'translate(0,0)');
      }
    }, {
      key: 'componentWillLeave',
      value: function componentWillLeave(callback) {
        var style = _reactDom2.default.findDOMNode(this).style;
        var direction = this.props.getLeaveDirection();
        var x = direction === 'left' ? '-100%' : direction === 'right' ? '100%' : '0';
        var y = direction === 'up' ? '-100%' : direction === 'down' ? '100%' : '0';
  
        style.opacity = '0';
        _autoPrefix2.default.set(style, 'transform', 'translate(' + x + ', ' + y + ')');
  
        this.leaveTimer = setTimeout(callback, 450);
      }
    }, {
      key: 'render',
      value: function render() {
        var _props = this.props;
        var children = _props.children;
        var enterDelay = _props.enterDelay;
        var getLeaveDirection = _props.getLeaveDirection;
        var style = _props.style;
  
        var other = _objectWithoutProperties(_props, ['children', 'enterDelay', 'getLeaveDirection', 'style']);
  
        var prepareStyles = this.context.muiTheme.prepareStyles;
  
  
        var mergedRootStyles = (0, _simpleAssign2.default)({}, {
          position: 'absolute',
          height: '100%',
          width: '100%',
          top: 0,
          left: 0,
          transition: _transitions2.default.easeOut(null, ['transform', 'opacity'])
        }, style);
  
        return _react2.default.createElement(
          'div',
          _extends({}, other, { style: prepareStyles(mergedRootStyles) }),
          children
        );
      }
    }]);
  
    return SlideInChild;
  }(_react.Component);
  
  SlideInChild.propTypes = {
    children: _react.PropTypes.node,
    direction: _react.PropTypes.string,
    enterDelay: _react.PropTypes.number,
    // This callback is needed bacause the direction could change when leaving the DOM
    getLeaveDirection: _react.PropTypes.func.isRequired,
    style: _react.PropTypes.object
  };
  SlideInChild.defaultProps = {
    enterDelay: 0
  };
  SlideInChild.contextTypes = {
    muiTheme: _react.PropTypes.object.isRequired
  };
  exports.default = SlideInChild;