import "core-js/modules/web.dom.iterable";
import "core-js/modules/es6.array.iterator";
import "core-js/modules/es6.object.keys";
import "core-js/modules/es6.object.assign";
import "core-js/modules/es7.array.includes";

function _extends() { _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; }; return _extends.apply(this, arguments); }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

import React from 'react';
import PropTypes from 'prop-types';
import { snakeCase } from "../../utils/snakeCase";
import { Spinner } from "../..";

var ChatContentItem = function ChatContentItem(props) {
  var actionNode = props.actionNode,
      aspect = props.aspect,
      className = props.className,
      content = props.content,
      fileSize = props.fileSize,
      isProtected = props.isProtected,
      loading = props.loading,
      style = props.style,
      title = props.title,
      otherProps = _objectWithoutPropertiesLoose(props, ["actionNode", "aspect", "className", "content", "fileSize", "isProtected", "loading", "style", "title"]);

  var kebabify = function kebabify(holder, aspect) {
    var cases = ['fourThree', 'sixteenNine', 'threeTwo'];
    var kebab = snakeCase(aspect);

    if (holder === 'container') {
      if (cases.includes(aspect)) {
        return " cui-content__chat-" + kebab;
      }
    } else if (holder === 'inner') {
      if (cases.includes(aspect)) {
        return ' cui-content-file--full';
      } else {
        return " cui-content-file--chat-" + kebab;
      }
    }
  };

  return React.createElement("div", _extends({
    className: 'cui-content__chat-inner-container' + ("" + (aspect === 'wide' && ' cui-content__chat-wide-container' || '')) + ("" + (aspect && kebabify('container', aspect) || ''))
  }, otherProps), React.createElement("div", {
    className: "" + (aspect && kebabify('inner', aspect) || '') + ("" + (!aspect && ' cui-content-file--full' || '')) + ("" + (className && " " + className || '')),
    style: Object.assign({
      backgroundImage: content && "url(" + content + ")"
    }, style)
  }, loading && React.createElement("div", {
    className: "" + ((content ? 'cui-content--opacity' : 'cui-content--centered') || '')
  }, React.createElement(Spinner, null))), !loading && React.createElement("div", {
    className: 'cui-content__hover' + ("" + (aspect === 'wide' && ' cui-content__hover--wide' || ''))
  }, React.createElement("div", {
    className: "cui-content__hover-files"
  }, React.createElement("span", {
    className: "cui-content__hover-files--file-name"
  }, title), React.createElement("span", {
    className: "cui-content__hover-files--file-size"
  }, fileSize)), actionNode && !isProtected && React.createElement("div", {
    className: "cui-content__hover-icons"
  }, actionNode)));
};

ChatContentItem.defaultProps = {
  actionNode: null,
  aspect: null,
  className: '',
  content: '',
  fileSize: '',
  isProtected: null,
  loading: false,
  style: null,
  title: '',
  type: ''
};
ChatContentItem.propTypes = {
  actionNode: PropTypes.node,
  aspect: PropTypes.oneOf(['oneOne', 'tall', 'threeFour', 'wide', 'fourThree', 'nineSixteen', 'sixteenNine', 'twoThree', 'threeTwo']),
  className: PropTypes.string,
  content: PropTypes.string,
  fileSize: PropTypes.string,
  isProtected: PropTypes.bool,
  loading: PropTypes.bool,
  style: PropTypes.object,
  title: PropTypes.string,
  type: PropTypes.string
};
ChatContentItem.displayName = 'ChatContentItem';
export default ChatContentItem;