(function(s,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("mime-db")):typeof define=="function"&&define.amd?define(["exports","mime-db"],o):(s=typeof globalThis<"u"?globalThis:s||self,o(s["@whykhamist/mime-types"]={},s.mimeDb))})(this,function(s,o){"use strict";var b=Object.defineProperty;var P=(s,o,f)=>o in s?b(s,o,{enumerable:!0,configurable:!0,writable:!0,value:f}):s[o]=f;var i=(s,o,f)=>P(s,typeof o!="symbol"?o+"":o,f);class f{constructor(e,t){i(this,"db");i(this,"EXTRACT_TYPE_REGEXP");i(this,"TEXT_TYPE_REGEXP");i(this,"EXTRACT_EXT_REGEXP");i(this,"types");i(this,"extensions");i(this,"typeSets");i(this,"extname",e=>{const t=this.EXTRACT_EXT_REGEXP.exec(e);return t==null?"":`.${t[1]}`});i(this,"extractExtension",e=>{if(!e||typeof e!="string")return!1;const t=this.extname("x."+e).toLowerCase().substring(1);return t||!1});i(this,"populateMaps",()=>{const e=["nginx","apache",void 0,"iana"],t=this.db,n=this.types,E=this.typeSets;Object.keys(t).forEach(a=>{const T=t[a],r=T.extensions;if(!(!r||!r.length)){Object.assign(this.extensions,{[a]:r});for(let c=0;cm||l===m&&n[u].substr(0,12)==="application/"))continue}n[u]=a}}})});i(this,"getCharset",e=>{if(!e||typeof e!="string")return!1;const t=this.EXTRACT_TYPE_REGEXP.exec(e),n=t&&this.db[t[1].toLowerCase()];return n&&n.charset?n.charset:t&&this.TEXT_TYPE_REGEXP.test(t[1])?"UTF-8":!1});i(this,"getContentType",e=>{if(!e||typeof e!="string")return!1;let t=e.indexOf("/")===-1?this.getMime(e):e;if(!t)return!1;if(t.indexOf("charset")===-1){const n=this.getCharset(t);n&&(t+="; charset="+n.toLowerCase())}return t});i(this,"getExtension",e=>{if(!e||typeof e!="string")return!1;const t=this.EXTRACT_TYPE_REGEXP.exec(e),n=t&&this.extensions[t[1].toLowerCase()];return!n||!n.length?!1:n[0]});i(this,"getMime",e=>{if(!e||typeof e!="string")return!1;const t=this.extname("x."+e).toLowerCase().substring(1);return t&&this.types[t]||!1});i(this,"getMimes",e=>{const t=this.extractExtension(e);return t&&this.typeSets[t]||!1});this.db=e,t&&this.setExtNameFn(t),this.EXTRACT_TYPE_REGEXP=/^\s*([^;\s]*)(?:;|\s|$)/,this.TEXT_TYPE_REGEXP=/^text\//i,this.EXTRACT_EXT_REGEXP=/^.+\.([^.]+)$/,this.types=Object.create(null),this.extensions=Object.create(null),this.typeSets=Object.create(null),this.populateMaps()}setExtNameFn(e){this.extname=e}}const h=new f(o),{types:g,extensions:x,typeSets:d,getCharset:p,getContentType:y,getExtension:X,getMime:_,getMimes:C}=h;s.MimeDb=o,s.MimeTypes=f,s.default=h,s.extensions=x,s.getCharset=p,s.getContentType=y,s.getExtension=X,s.getMime=_,s.getMimes=C,s.typeSets=d,s.types=g,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});