"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;

var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));

var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));

var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));

var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _react = _interopRequireDefault(require("react"));

var _propTypes = _interopRequireDefault(require("prop-types"));

var _classnames = _interopRequireDefault(require("classnames"));

var _styles = require("@material-ui/core/styles");

var _excluded = ["editor", "classes", "children", "width"];

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

var useStyles = (0, _styles.withStyles)(function () {
  return {
    root: {
      position: 'relative'
    },
    editor: {
      display: 'inline-block',
      overflow: 'hidden'
    }
  };
});

var MediaWrapper = /*#__PURE__*/function (_React$Component) {
  (0, _inherits2["default"])(MediaWrapper, _React$Component);

  var _super = _createSuper(MediaWrapper);

  function MediaWrapper() {
    (0, _classCallCheck2["default"])(this, MediaWrapper);
    return _super.apply(this, arguments);
  }

  (0, _createClass2["default"])(MediaWrapper, [{
    key: "render",
    value: function render() {
      var _this$props = this.props,
          editor = _this$props.editor,
          classes = _this$props.classes,
          children = _this$props.children,
          width = _this$props.width,
          rest = (0, _objectWithoutProperties2["default"])(_this$props, _excluded);
      return /*#__PURE__*/_react["default"].createElement("span", (0, _extends2["default"])({
        className: (0, _classnames["default"])(classes.root, (0, _defineProperty2["default"])({}, classes.editor, editor))
      }, rest, {
        style: {
          width: width || 300
        }
      }), children);
    }
  }]);
  return MediaWrapper;
}(_react["default"].Component);

(0, _defineProperty2["default"])(MediaWrapper, "propTypes", {
  classes: _propTypes["default"].object,
  children: _propTypes["default"].array,
  editor: _propTypes["default"].bool,
  width: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].string])
});

var _default = useStyles(MediaWrapper);

exports["default"] = _default;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy9jb2RlL2VkaXRhYmxlLWh0bWwvcGx1Z2lucy9tZWRpYS9tZWRpYS13cmFwcGVyLmpzeCJdLCJuYW1lcyI6WyJ1c2VTdHlsZXMiLCJyb290IiwicG9zaXRpb24iLCJlZGl0b3IiLCJkaXNwbGF5Iiwib3ZlcmZsb3ciLCJNZWRpYVdyYXBwZXIiLCJwcm9wcyIsImNsYXNzZXMiLCJjaGlsZHJlbiIsIndpZHRoIiwicmVzdCIsIlJlYWN0IiwiQ29tcG9uZW50IiwiUHJvcFR5cGVzIiwib2JqZWN0IiwiYXJyYXkiLCJib29sIiwib25lT2ZUeXBlIiwibnVtYmVyIiwic3RyaW5nIl0sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0FBQ0E7O0FBQ0E7O0FBQ0E7Ozs7Ozs7O0F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