"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.isImg = exports.getFileTypeMapIcon = void 0;

var _newFileListDoc = _interopRequireDefault(require("./img/new-file-list-doc.svg"));

var _newFileListOther = _interopRequireDefault(require("./img/new-file-list-other.svg"));

var _newFileListPdf = _interopRequireDefault(require("./img/new-file-list-pdf.svg"));

var _newFileListPpt = _interopRequireDefault(require("./img/new-file-list-ppt.svg"));

var _newFileListRadio = _interopRequireDefault(require("./img/new-file-list-radio.svg"));

var _newFileListVideo = _interopRequireDefault(require("./img/new-file-list-video.svg"));

var _newFileListXls = _interopRequireDefault(require("./img/new-file-list-xls.svg"));

var _folder = _interopRequireDefault(require("./img/folder.svg"));

var _form = _interopRequireDefault(require("./img/form.svg"));

var _mind = _interopRequireDefault(require("./img/mind.svg"));

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

var getFileTypeMapIcon = function getFileTypeMapIcon(fileType) {
  var isImg = false;
  var backGroundColor = "";
  var fileImg;
  var canPreview = false;

  if (/^(jpg|png|gif|jpeg|image|JPG|PNG|GIF|JPEG)$/.test(fileType)) {
    isImg = true;
    canPreview = true;
  } else if (/^(mp3|ogg|ape|flac)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListRadio["default"];
    backGroundColor = "#FFE6FC";
  } else if (/^(avi|wmv|mov|mp4|rmvb)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListVideo["default"];
    backGroundColor = "#F5E6FF";
  } else if (/^(pptx|ppt|slide)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListPpt["default"];
    backGroundColor = "#FFF5E6";
    canPreview = true;
  } else if (/^(doc|docx)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListDoc["default"];
    backGroundColor = "#E6F0FF";
    canPreview = true;
  } else if (/^(xls|xlsx|sheet)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListXls["default"];
    backGroundColor = "#E6FFF5";
    canPreview = true;
  } else if (/^(pdf)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListPdf["default"];
    backGroundColor = "#FFE7E6";
    canPreview = true;
  } else if (/^(folder)$/.test(fileType.toLowerCase())) {
    fileImg = _folder["default"];
    backGroundColor = "#FFF5E6";
    canPreview = true;
  } else if (/^(form)$/.test(fileType.toLowerCase())) {
    fileImg = _form["default"];
    backGroundColor = "#FFF5E6";
    canPreview = true;
  } else if (/^(mind)$/.test(fileType.toLowerCase())) {
    fileImg = _mind["default"];
    backGroundColor = "#E6F8FF";
    canPreview = true;
  } else if (/^(txt)$/.test(fileType.toLowerCase())) {
    fileImg = _newFileListOther["default"];
    backGroundColor = "#E6FCFF";
    canPreview = true;
  } else {
    fileImg = _newFileListOther["default"];
    backGroundColor = "#E6FCFF";
  }

  return {
    isImg: isImg,
    fileImg: fileImg,
    backGroundColor: backGroundColor,
    canPreview: canPreview
  };
};

exports.getFileTypeMapIcon = getFileTypeMapIcon;

var isImg = function isImg(fileType) {
  if (/^(jpg|png|gif|jpeg|image|JPG|PNG|GIF|JPEG)$/.test(fileType)) {
    return true;
  }

  return false;
};

exports.isImg = isImg;