"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _LastMessageVideo = _interopRequireDefault(require("./styled/LastMessageVideo"));
var _LastTextMessage = _interopRequireDefault(require("./styled/LastTextMessage"));
var _LastMessagePhoto = _interopRequireDefault(require("./styled/LastMessagePhoto"));
var _LastMessageEmoji = _interopRequireDefault(require("./styled/LastMessageEmoji"));
var _LastMessageFile = _interopRequireDefault(require("./styled/LastMessageFile"));
var _LastAudioMessage = _interopRequireDefault(require("./styled/LastAudioMessage"));
var _jsxRuntime = require("react/jsx-runtime");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const LastMessageItem = ({
  lastMessage
}) => {
  const {
    body,
    emoji,
    mimetype
  } = lastMessage;
  if (mimetype) {
    if (mimetype.startsWith('image/')) {
      return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LastMessagePhoto.default, {
        ...lastMessage
      });
    }
    if (mimetype.startsWith('video/')) {
      return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LastMessageVideo.default, {
        ...lastMessage
      });
    }
    if (mimetype.startsWith('audio/') || mimetype.includes('application/octet-stream')) {
      return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LastAudioMessage.default, {
        ...lastMessage
      });
    }
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LastMessageFile.default, {
      ...lastMessage
    });
  }
  if (emoji) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LastMessageEmoji.default, {
      ...lastMessage
    });
  }
  if (body) {
    return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LastTextMessage.default, {
      ...lastMessage
    });
  }
  return undefined;
};
var _default = exports.default = LastMessageItem;
//# sourceMappingURL=LastMessageItem.js.map