MIME_TYPES = {
    # Текстовые форматы
    "txt": "text/plain",
    "html": "text/html",
    "htm": "text/html",
    "shtml": "text/html",
    "css": "text/css",
    "csv": "text/csv",
    "ics": "text/calendar",
    "ifb": "text/calendar",
    "md": "text/markdown",
    "markdown": "text/markdown",
    "rtx": "text/richtext",
    "rtf": "text/rtf",
    "sgml": "text/sgml",
    "sgm": "text/sgml",
    "tsv": "text/tab-separated-values",
    "vcf": "text/vcard",
    "vcard": "text/vcard",
    "curl": "text/vnd.curl",
    "dcurl": "text/vnd.curl.dcurl",
    "scurl": "text/vnd.curl.scurl",
    "mcurl": "text/vnd.curl.mcurl",
    "fly": "text/vnd.fly",
    "flx": "text/vnd.fmi.flexstor",
    "gv": "text/vnd.graphviz",
    # "dot": "text/vnd.graphviz",
    "3dml": "text/vnd.in3d.3dml",
    "spot": "text/vnd.in3d.spot",
    "jad": "text/vnd.sun.j2me.app-descriptor",
    "wml": "text/vnd.wap.wml",
    "wmls": "text/vnd.wap.wmlscript",
    "vtt": "text/vtt",
    "s": "text/x-asm",
    "asm": "text/x-asm",
    "c": "text/x-c",
    "h": "text/x-c",
    "cpp": "text/x-c++",
    "cxx": "text/x-c++",
    "cc": "text/x-c++",
    "hpp": "text/x-c++",
    "hh": "text/x-c++",
    "cs": "text/x-csharp",
    "f": "text/x-fortran",
    "for": "text/x-fortran",
    "f77": "text/x-fortran",
    "f90": "text/x-fortran",
    "java": "text/x-java",
    "p": "text/x-pascal",
    "pas": "text/x-pascal",
    "py": "text/x-python",
    "pyw": "text/x-python",
    "scala": "text/x-scala",
    "nfo": "text/x-nfo",
    "opml": "text/x-opml",
    "org": "text/x-org",
    "pod": "text/x-pod",
    "tex": "text/x-tex",
    "ltx": "text/x-tex",
    "sty": "text/x-tex",
    "cls": "text/x-tex",
    "vcs": "text/x-vcalendar",
    "js": "application/javascript",  # Официально с 2022
    "mjs": "application/javascript",

    # Изображения
    "avif": "image/avif",
    "bmp": "image/bmp",
    "dib": "image/bmp",
    "gif": "image/gif",
    "heic": "image/heic",
    "heif": "image/heif",
    "jpg": "image/jpeg",
    "jpeg": "image/jpeg",
    "jpe": "image/jpeg",
    "jif": "image/jpeg",
    "jfif": "image/jpeg",
    "jfi": "image/jpeg",
    "png": "image/png",
    "svg": "image/svg+xml",
    "svgz": "image/svg+xml",
    "tiff": "image/tiff",
    "tif": "image/tiff",
    "webp": "image/webp",
    "ico": "image/x-icon",
    "icon": "image/x-icon",
    "pcx": "image/x-pcx",
    "pct": "image/x-pict",
    "pic": "image/x-pict",
    "pnm": "image/x-portable-anymap",
    "pbm": "image/x-portable-bitmap",
    "pgm": "image/x-portable-graymap",
    "ppm": "image/x-portable-pixmap",
    "rgb": "image/x-rgb",
    "xbm": "image/x-xbitmap",
    "xpm": "image/x-xpixmap",
    "xwd": "image/x-xwindowdump",

    # Аудио
    "aac": "audio/aac",
    "flac": "audio/flac",
    "mid": "audio/midi",
    "midi": "audio/midi",
    "kar": "audio/midi",
    "rmi": "audio/midi",
    "mp3": "audio/mpeg",
    "mpga": "audio/mpeg",
    "mp2": "audio/mpeg",
    "mp2a": "audio/mpeg",
    "m2a": "audio/mpeg",
    "m3a": "audio/mpeg",
    "oga": "audio/ogg",
    "ogg": "audio/ogg",
    "spx": "audio/ogg",
    "opus": "audio/ogg",
    "wav": "audio/wav",
    "weba": "audio/webm",
    "aif": "audio/x-aiff",
    "aiff": "audio/x-aiff",
    "aifc": "audio/x-aiff",
    "m4a": "audio/x-m4a",
    "mka": "audio/x-matroska",
    "wma": "audio/x-ms-wma",
    "ram": "audio/x-pn-realaudio",
    "ra": "audio/x-pn-realaudio",

    # Видео
    "3gp": "video/3gpp",
    "3gpp": "video/3gpp",
    "3g2": "video/3gpp2",
    "h261": "video/h261",
    "h263": "video/h263",
    "h264": "video/h264",
    "jpgv": "video/jpeg",
    "jpm": "video/jpm",
    "jpgm": "video/jpm",
    "mj2": "video/mj2",
    "mjp2": "video/mj2",
    "mp4": "video/mp4",
    "mp4v": "video/mp4",
    "mpg4": "video/mp4",
    "mpeg": "video/mpeg",
    "mpg": "video/mpeg",
    "mpe": "video/mpeg",
    "m1v": "video/mpeg",
    "m2v": "video/mpeg",
    "ogv": "video/ogg",
    "qt": "video/quicktime",
    "mov": "video/quicktime",
    "mxu": "video/vnd.mpegurl",
    "m4u": "video/vnd.mpegurl",
    "webm": "video/webm",
    "f4v": "video/x-f4v",
    "flv": "video/x-flv",
    "m4v": "video/x-m4v",
    "mkv": "video/x-matroska",
    "mk3d": "video/x-matroska",
    "mks": "video/x-matroska",
    "asf": "video/x-ms-asf",
    "asx": "video/x-ms-asf",
    "wm": "video/x-ms-wm",
    "wmv": "video/x-ms-wmv",
    "wmx": "video/x-ms-wmx",
    "wvx": "video/x-ms-wvx",
    "avi": "video/x-msvideo",
    "movie": "video/x-sgi-movie",
    "smv": "video/x-smv",

    # Документы и офисные форматы
    "pdf": "application/pdf",
    "doc": "application/msword",
    "dot": "application/msword",
    "xls": "application/vnd.ms-excel",
    "xlt": "application/vnd.ms-excel",
    "xla": "application/vnd.ms-excel",
    "ppt": "application/vnd.ms-powerpoint",
    "pot": "application/vnd.ms-powerpoint",
    "pps": "application/vnd.ms-powerpoint",
    "ppa": "application/vnd.ms-powerpoint",
    "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
    "dotx": "application/vnd.openxmlformats-officedocument.wordprocessingml.template",
    "xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
    "xltx": "application/vnd.openxmlformats-officedocument.spreadsheetml.template",
    "pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
    "potx": "application/vnd.openxmlformats-officedocument.presentationml.template",
    "ppsx": "application/vnd.openxmlformats-officedocument.presentationml.slideshow",
    "odt": "application/vnd.oasis.opendocument.text",
    "ods": "application/vnd.oasis.opendocument.spreadsheet",
    "odp": "application/vnd.oasis.opendocument.presentation",
    "odg": "application/vnd.oasis.opendocument.graphics",
    "odc": "application/vnd.oasis.opendocument.chart",
    "odf": "application/vnd.oasis.opendocument.formula",
    "odb": "application/vnd.oasis.opendocument.database",
    "odi": "application/vnd.oasis.opendocument.image",
    "odm": "application/vnd.oasis.opendocument.text-master",
    "epub": "application/epub+zip",

    # Архивы
    "gz": "application/gzip",
    "gzip": "application/gzip",
    "bz": "application/x-bzip",
    "bz2": "application/x-bzip2",
    "boz": "application/x-bzip2",
    "7z": "application/x-7z-compressed",
    "rar": "application/x-rar-compressed",
    "tar": "application/x-tar",
    "zip": "application/zip",
    "ace": "application/x-ace-compressed",
    "afa": "application/x-astrotite-afa",
    "alz": "application/x-alz-compressed",
    "dmg": "application/x-apple-diskimage",
    "arj": "application/x-arj",
    "cfs": "application/x-cfs-compressed",
    "dgc": "application/x-dgc-compressed",
    "lzh": "application/x-lzh",
    "lha": "application/x-lzh",
    "lzx": "application/x-lzx",
    "rpm": "application/x-rpm",
    "sit": "application/x-stuffit",
    "sitx": "application/x-stuffitx",
    "xz": "application/x-xz",

    # Данные и форматы обмена
    "json": "application/json",
    "jsonld": "application/ld+json",
    "xml": "application/xml",
    "xhtml": "application/xhtml+xml",
    "xht": "application/xhtml+xml",
    "xsl": "application/xslt+xml",
    "xslt": "application/xslt+xml",
    "php": "application/x-httpd-php",
    "phtml": "application/x-httpd-php",
    "php3": "application/x-httpd-php",
    "php4": "application/x-httpd-php",
    "php5": "application/x-httpd-php",
    "phps": "application/x-httpd-php-source",
    "es": "application/ecmascript",
    "ecma": "application/ecmascript",
    "wasm": "application/wasm",
    "sql": "application/sql",
    "cgi": "application/x-httpd-cgi",
    "sh": "application/x-sh",
    "csh": "application/x-csh",

    # Веб и интернет
    "atom": "application/atom+xml",
    "rss": "application/rss+xml",
    "jar": "application/x-java-archive",
    "jnlp": "application/x-java-jnlp-file",
    "run": "application/x-makeself",
    "pl": "application/x-perl",
    "pm": "application/x-perl",
    # "prc": "application/x-pilot",
    # "pdb": "application/x-pilot",
    "sea": "application/x-sea",
    "swf": "application/x-shockwave-flash",
    "xap": "application/x-silverlight-app",

    # Бинарные и исполняемые файлы
    "bin": "application/octet-stream",
    "dms": "application/octet-stream",
    "lrf": "application/octet-stream",
    "mar": "application/octet-stream",
    "so": "application/octet-stream",
    "dist": "application/octet-stream",
    "distz": "application/octet-stream",
    "pkg": "application/octet-stream",
    "bpk": "application/octet-stream",
    "dump": "application/octet-stream",
    "elc": "application/octet-stream",
    "deploy": "application/octet-stream",
    "exe": "application/x-msdownload",
    "dll": "application/x-msdownload",
    "com": "application/x-msdownload",
    "bat": "application/x-msdownload",
    "msi": "application/x-msdownload",
    "deb": "application/x-debian-package",
    "udeb": "application/x-debian-package",
    "iso": "application/x-iso9660-image",
    "img": "application/octet-stream",
    "msp": "application/octet-stream",
    "msm": "application/octet-stream",

    # Криптография и сертификаты
    "pgp": "application/pgp-encrypted",
    "sig": "application/pgp-signature",
    "asc": "application/pgp-signature",
    "p10": "application/pkcs10",
    "p7m": "application/pkcs7-mime",
    "p7c": "application/pkcs7-mime",
    "p7s": "application/pkcs7-signature",
    "p8": "application/pkcs8",
    "ac": "application/pkix-attr-cert",
    "cer": "application/pkix-cert",
    "crl": "application/pkix-crl",
    "pkipath": "application/pkix-pkipath",
    "pki": "application/pkixcmp",

    # Графика и векторные форматы
    "ps": "application/postscript",
    "ai": "application/postscript",
    "eps": "application/postscript",

    # Шрифты
    "ttc": "font/collection",
    "otf": "font/otf",
    "ttf": "font/ttf",
    "woff": "font/woff",
    "woff2": "font/woff2",

    # 3D модели
    "3mf": "model/3mf",
    "gltf": "model/gltf+json",
    "glb": "model/gltf-binary",
    "igs": "model/iges",
    "iges": "model/iges",
    "msh": "model/mesh",
    "mesh": "model/mesh",
    "silo": "model/mesh",
    "stl": "model/stl",
    "wrl": "model/vrml",
    "vrml": "model/vrml",
    "x3db": "model/x3d+binary",
    "x3dbz": "model/x3d+binary",
    "x3dv": "model/x3d+vrml",
    "x3dvz": "model/x3d+vrml",
    "x3d": "model/x3d+xml",
    "x3dz": "model/x3d+xml",

    # Химические форматы
    "cdx": "chemical/x-cdx",
    "cif": "chemical/x-cif",
    "cmdf": "chemical/x-cmdf",
    "cml": "chemical/x-cml",
    "csml": "chemical/x-csml",
    "pdb": "chemical/x-pdb",
    "xyz": "chemical/x-pdb",

    # Электронные книги
    "azw": "application/vnd.amazon.ebook",
    "prc": "application/x-mobipocket-ebook",
    "mobi": "application/x-mobipocket-ebook",

    # Форматы данных ГИС и карт
    "kml": "application/vnd.google-earth.kml+xml",
    "kmz": "application/vnd.google-earth.kmz",
    "gpx": "application/gpx+xml",
    "osm": "application/vnd.openstreetmap.data+xml",

    # Специализированные форматы приложений
    "apk": "application/vnd.android.package-archive",
    "m3u8": "application/vnd.apple.mpegurl",
    "mpkg": "application/vnd.apple.installer+xml",
    "xul": "application/vnd.mozilla.xul+xml",
    "xpi": "application/x-xpinstall",
    "crx": "application/x-chrome-extension",
    "eot": "application/vnd.ms-fontobject",
    "chm": "application/vnd.ms-htmlhelp",
    "ims": "application/vnd.ms-ims",
    "lrm": "application/vnd.ms-lrm",
    "thmx": "application/vnd.ms-officetheme",
    "msg": "application/vnd.ms-outlook",
    "cat": "application/vnd.ms-pki.seccat",
    "xps": "application/vnd.ms-xpsdocument",
    "mdb": "application/x-msaccess",
    "obd": "application/x-msbinder",
    "crd": "application/x-mscardfile",
    "clp": "application/x-msclip",
    "mvb": "application/x-msmediaview",
    "m13": "application/x-msmediaview",
    "m14": "application/x-msmediaview",
    "wmf": "application/x-msmetafile",
    "emf": "application/x-msmetafile",
    "emz": "application/x-msmetafile",
    "mny": "application/x-msmoney",
    "pub": "application/x-mspublisher",
    "scd": "application/x-msschedule",
    "trm": "application/x-msterminal",
    "wri": "application/x-mswrite",
    "nc": "application/x-netcdf",
    "cdf": "application/x-netcdf",
    "nzb": "application/x-nzb",
    "p12": "application/x-pkcs12",
    "pfx": "application/x-pkcs12",
    "p7b": "application/x-pkcs7-certificates",
    "spc": "application/x-pkcs7-certificates",
    "p7r": "application/x-pkcs7-certreqresp",
    "ris": "application/x-research-info-systems",
    "shar": "application/x-shar",
    "srt": "application/x-subrip",
    "sv4cpio": "application/x-sv4cpio",
    "sv4crc": "application/x-sv4crc",
    "t3": "application/x-t3vm-image",
    "gam": "application/x-tads",
    "tcl": "application/x-tcl",
    "tk": "application/x-tcl",
    "texinfo": "application/x-texinfo",
    "texi": "application/x-texinfo",
    "obj": "application/x-tgif",
    "ustar": "application/x-ustar",
    "src": "application/x-wais-source",
    "der": "application/x-x509-ca-cert",
    "crt": "application/x-x509-ca-cert",
    "pem": "application/x-x509-ca-cert",
    "fig": "application/x-xfig",
    "xlf": "application/x-xliff+xml",
    "z1": "application/x-zmachine",
    "z2": "application/x-zmachine",
    "z3": "application/x-zmachine",
    "z4": "application/x-zmachine",
    "z5": "application/x-zmachine",
    "z6": "application/x-zmachine",
    "z7": "application/x-zmachine",
    "z8": "application/x-zmachine",
    "xaml": "application/xaml+xml",
    "xav": "application/xcap-att+xml",
    "xca": "application/xcap-caps+xml",
    "xdf": "application/xcap-diff+xml",
    "xel": "application/xcap-el+xml",
    "xns": "application/xcap-ns+xml",
    "xenc": "application/xenc+xml",
    "xop": "application/xop+xml",
    "xpl": "application/xproc+xml",
    "xspf": "application/xspf+xml",
    "mxml": "application/xv+xml",
    "xhvml": "application/xv+xml",
    "xvml": "application/xv+xml",
    "xvm": "application/xv+xml",
    "yang": "application/yang",
    "yin": "application/yin+xml",
    "wgt": "application/widget",
    "hlp": "application/winhlp",

    # Дополнительные форматы
    "abw": "application/x-abiword",
    "arc": "application/x-freearc",
    "spl": "application/x-futuresplash",
    "gca": "application/x-gca-compressed",
    "ulx": "application/x-glulx",
    "gnumeric": "application/x-gnumeric",
    "gramps": "application/x-gramps-xml",
    "gtar": "application/x-gtar",
    "hdf": "application/x-hdf",
    "install": "application/x-install-instructions",
    "jardiff": "application/x-java-archive-diff",
    "latex": "application/x-latex",
    "mie": "application/x-mie",
    "application": "application/x-ms-application",
    "lnk": "application/x-ms-shortcut",
    "wmd": "application/x-ms-wmd",
    "wmz": "application/x-ms-wmz",
    "xbap": "application/x-ms-xbap",

    # Сообщения и почта
    "eml": "message/rfc822",
    "mime": "message/rfc822",

    # Виртуальная реальность
    "usdz": "model/vnd.usdz+zip",
    "vmt": "application/vnd.valve.source.material",
    "vtf": "application/vnd.valve.source.texture",
}

# Дополнительная функция для обработки составных расширений
COMPOUND_EXTENSIONS = {
    "tar.gz": "application/gzip",
    "tar.bz2": "application/x-bzip2",
    "tar.xz": "application/x-xz",
}
