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GAAU,EAEzD,QAAQ,eAAiB,eACzB,QAAQ,QAAU,CACd,QAAS,QAAQ,QACjB,OAAQ,QAAQ,OAChB,eAAgB,QAAQ,eACxB,WAAY,QAAQ","file":"/npm/chardet@2.1.1/lib/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/chardet@2.1.1/lib/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n    if (k2 === undefined) k2 = k;\n    var desc = Object.getOwnPropertyDescriptor(m, k);\n    if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n      desc = { enumerable: true, get: function() { return m[k]; } };\n    }\n    Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n    if (k2 === undefined) k2 = k;\n    o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n    Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n    o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || (function () {\n    var ownKeys = function(o) {\n        ownKeys = Object.getOwnPropertyNames || function (o) {\n            var ar = [];\n            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n            return ar;\n        };\n        return ownKeys(o);\n    };\n    return function (mod) {\n        if (mod && mod.__esModule) return mod;\n        var result = {};\n        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n        __setModuleDefault(result, mod);\n        return result;\n    };\n})();\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.detectFileSync = exports.detectFile = exports.analyse = exports.detect = void 0;\nconst node_1 = __importDefault(require(\"./fs/node\"));\nconst ascii_1 = __importDefault(require(\"./encoding/ascii\"));\nconst utf8_1 = __importDefault(require(\"./encoding/utf8\"));\nconst unicode = __importStar(require(\"./encoding/unicode\"));\nconst mbcs = __importStar(require(\"./encoding/mbcs\"));\nconst sbcs = __importStar(require(\"./encoding/sbcs\"));\nconst iso2022 = __importStar(require(\"./encoding/iso2022\"));\nconst utils_1 = require(\"./utils\");\nconst recognisers = [\n    new utf8_1.default(),\n    new unicode.UTF_16BE(),\n    new unicode.UTF_16LE(),\n    new unicode.UTF_32BE(),\n    new unicode.UTF_32LE(),\n    new mbcs.sjis(),\n    new mbcs.big5(),\n    new mbcs.euc_jp(),\n    new mbcs.euc_kr(),\n    new mbcs.gb_18030(),\n    new iso2022.ISO_2022_JP(),\n    new iso2022.ISO_2022_KR(),\n    new iso2022.ISO_2022_CN(),\n    new sbcs.ISO_8859_1(),\n    new sbcs.ISO_8859_2(),\n    new sbcs.ISO_8859_5(),\n    new sbcs.ISO_8859_6(),\n    new sbcs.ISO_8859_7(),\n    new sbcs.ISO_8859_8(),\n    new sbcs.ISO_8859_9(),\n    new sbcs.windows_1251(),\n    new sbcs.windows_1256(),\n    new sbcs.KOI8_R(),\n    new ascii_1.default(),\n];\nconst detect = (buffer) => {\n    const matches = (0, exports.analyse)(buffer);\n    return matches.length > 0 ? matches[0].name : null;\n};\nexports.detect = detect;\nconst analyse = (buffer) => {\n    if (!(0, utils_1.isByteArray)(buffer)) {\n        throw new Error('Input must be a byte array, e.g. Buffer or Uint8Array');\n    }\n    const byteStats = [];\n    for (let i = 0; i < 256; i++)\n        byteStats[i] = 0;\n    for (let i = buffer.length - 1; i >= 0; i--)\n        byteStats[buffer[i] & 0x00ff]++;\n    let c1Bytes = false;\n    for (let i = 0x80; i <= 0x9f; i += 1) {\n        if (byteStats[i] !== 0) {\n            c1Bytes = true;\n            break;\n        }\n    }\n    const context = {\n        byteStats,\n        c1Bytes,\n        rawInput: buffer,\n        rawLen: buffer.length,\n        inputBytes: buffer,\n        inputLen: buffer.length,\n    };\n    const matches = recognisers\n        .map((rec) => {\n        return rec.match(context);\n    })\n        .filter((match) => {\n        return !!match;\n    })\n        .sort((a, b) => {\n        return b.confidence - a.confidence;\n    });\n    return matches;\n};\nexports.analyse = analyse;\nconst detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {\n    let fd;\n    const fs = (0, node_1.default)();\n    const handler = (err, buffer) => {\n        if (fd) {\n            fs.closeSync(fd);\n        }\n        if (err) {\n            reject(err);\n        }\n        else if (buffer) {\n            resolve((0, exports.detect)(buffer));\n        }\n        else {\n            reject(new Error('No error and no buffer received'));\n        }\n    };\n    const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;\n    if (sampleSize > 0) {\n        fd = fs.openSync(filepath, 'r');\n        let sample = Buffer.allocUnsafe(sampleSize);\n        fs.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {\n            if (err) {\n                handler(err, null);\n            }\n            else {\n                if (bytesRead < sampleSize) {\n                    sample = sample.subarray(0, bytesRead);\n                }\n                handler(null, sample);\n            }\n        });\n        return;\n    }\n    fs.readFile(filepath, handler);\n});\nexports.detectFile = detectFile;\nconst detectFileSync = (filepath, opts = {}) => {\n    const fs = (0, node_1.default)();\n    if (opts && opts.sampleSize) {\n        const fd = fs.openSync(filepath, 'r');\n        let sample = Buffer.allocUnsafe(opts.sampleSize);\n        const bytesRead = fs.readSync(fd, sample, 0, opts.sampleSize, opts.offset);\n        if (bytesRead < opts.sampleSize) {\n            sample = sample.subarray(0, bytesRead);\n        }\n        fs.closeSync(fd);\n        return (0, exports.detect)(sample);\n    }\n    return (0, exports.detect)(fs.readFileSync(filepath));\n};\nexports.detectFileSync = detectFileSync;\nexports.default = {\n    analyse: exports.analyse,\n    detect: exports.detect,\n    detectFileSync: exports.detectFileSync,\n    detectFile: exports.detectFile,\n};\n"]}