'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactAddonsPureRenderMixin = require('react-addons-pure-render-mixin');

var _reactAddonsPureRenderMixin2 = _interopRequireDefault(_reactAddonsPureRenderMixin);

var _immutable = require('immutable');

var _immutable2 = _interopRequireDefault(_immutable);

var _transformimeReact = require('transformime-react');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Pager extends _react2.default.Component {

  constructor(props) {
    super(props);
    this.shouldComponentUpdate = _reactAddonsPureRenderMixin2.default.shouldComponentUpdate.bind(this);
  }

  render() {
    const bundle = this.props.pager.get('data');
    const mimetype = (0, _transformimeReact.richestMimetype)(bundle, this.props.displayOrder, this.props.transforms);
    const Transform = this.props.transforms.get(mimetype);
    return _react2.default.createElement(Transform, { data: bundle.get(mimetype) });
  }
}

Pager.propTypes = {
  displayOrder: _react2.default.PropTypes.instanceOf(_immutable2.default.List).isRequired,
  transforms: _react2.default.PropTypes.instanceOf(_immutable2.default.Map).isRequired,
  pager: _react2.default.PropTypes.instanceOf(_immutable2.default.Map).isRequired
};
exports.default = Pager;