import _extend from "lodash/fp/extend";
import _get from "lodash/fp/get";
import _pipe from "lodash/fp/pipe";
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import ResourcePlayer, { TYPE_IMAGE, TYPE_VIDEO, TYPE_PDF, TYPE_AUDIO } from '../resource-player';
import style from './style.css';
const Feedback = (props, context) => {
  const {
    media,
    mediaDescription,
    title,
    description,
    mode = 'default'
  } = props;
  const resource = media && media.type && {
    ...media,
    ..._pipe(_get('src.0'), _extend({
      description: mediaDescription
    }))(media)
  };
  return (resource || title || description ? /*#__PURE__*/React.createElement("div", {
    className: mode === 'scorm' ? style.feedbackContainerScorm : null
  }, /*#__PURE__*/React.createElement("div", {
    className: style.feedback,
    "data-name": "feedback",
    id: "feedback"
  }, /*#__PURE__*/React.createElement("div", {
    className: classnames(style.title, style.innerHTML),
    "data-name": "title"
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: title
    }
  }), /*#__PURE__*/React.createElement("div", {
    className: style.descWrapper
  }, /*#__PURE__*/React.createElement("div", {
    className: classnames(style.description, style.innerHTML),
    "data-name": "description"
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: description
    }
  }), resource ? /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(ResourcePlayer, {
    className: style.resourcePlayer,
    resource: resource
  }), /*#__PURE__*/React.createElement("div", {
    "data-name": "mediaDescription",
    className: classnames(style.mediaDescription, style.innerHTML)
    // eslint-disable-next-line react/no-danger
    ,
    dangerouslySetInnerHTML: {
      __html: mediaDescription
    }
  })) : null))) : null) || null;
};
Feedback.propTypes = process.env.NODE_ENV !== "production" ? {
  title: PropTypes.string,
  description: PropTypes.string,
  media: PropTypes.shape({
    type: PropTypes.oneOf([TYPE_IMAGE, TYPE_PDF, TYPE_VIDEO, TYPE_AUDIO]),
    src: PropTypes.arrayOf(PropTypes.any)
  }),
  mediaDescription: PropTypes.string
} : {};
export default Feedback;
//# sourceMappingURL=index.js.map