var FileTypes = /* @__PURE__ */ ((FileTypes2) => {
  FileTypes2[FileTypes2["IMAGE"] = 1] = "IMAGE";
  FileTypes2[FileTypes2["VIDEO"] = 2] = "VIDEO";
  FileTypes2[FileTypes2["WORD"] = 3] = "WORD";
  FileTypes2[FileTypes2["EXCEL"] = 4] = "EXCEL";
  FileTypes2[FileTypes2["ARCHIVE"] = 5] = "ARCHIVE";
  FileTypes2[FileTypes2["PDF"] = 6] = "PDF";
  FileTypes2[FileTypes2["POWERPOINT"] = 7] = "POWERPOINT";
  FileTypes2[FileTypes2["AUDIO"] = 8] = "AUDIO";
  FileTypes2[FileTypes2["MISC"] = 9] = "MISC";
  return FileTypes2;
})(FileTypes || {});
const doc = new RegExp("^doc([a-z]*)$");
const excel = new RegExp("^xl([a-z]*)$");
const ppt = new RegExp("^ppt([a-z]*)$");
const images = [
  "jpg",
  "png",
  "gif",
  "jpeg",
  "jpe",
  "jfif",
  "bmp",
  "heic",
  "heif",
  "tfif",
  "tif",
  "webp"
];
const videos = [
  "avi",
  "mpeg",
  "mpg",
  "mpe",
  "mp4",
  "mkv",
  "webm",
  "mov",
  "ogv",
  "vob",
  "m4v",
  "3gp",
  "divx",
  "xvid",
  "mxf",
  "wmv",
  "m1v",
  "flv"
];
const audios = ["mp3", "pcm", "wav", "aiff", "aif", "aac", "ogg", "wma", "m4a", "flac"];
const pdf = ["pdf"];
const folder = ["zip", "rar", "tar", "gz", "gzip", "jar", "7z", "fgz", "webarchive"];
const extRegList = [
  { data: doc, fileType: 3 /* WORD */ },
  { data: excel, fileType: 4 /* EXCEL */ },
  { data: ppt, fileType: 7 /* POWERPOINT */ }
];
const extList = [
  { data: images, fileType: 1 /* IMAGE */ },
  { data: videos, fileType: 2 /* VIDEO */ },
  { data: audios, fileType: 8 /* AUDIO */ },
  { data: pdf, fileType: 6 /* PDF */ },
  { data: folder, fileType: 5 /* ARCHIVE */ }
];
function getFileTypeFromList(extension, checkList, extensionPredicate) {
  let retVal;
  checkList.some(({ data, fileType }) => {
    if (extensionPredicate(data, extension)) {
      retVal = fileType;
      return true;
    }
    return false;
  });
  return retVal;
}
const fileExtensionToType = (extension) => {
  const fileType = extension && (getFileTypeFromList(extension, extRegList, (regExp, extension2) => regExp.test(extension2)) || getFileTypeFromList(
    extension,
    extList,
    (typeList, extension2) => typeList.includes(extension2)
  ));
  return fileType || 9 /* MISC */;
};
export {
  FileTypes,
  fileExtensionToType
};
//# sourceMappingURL=file-extension-to-type.js.map
