Initial commit
This commit is contained in:
6
node_modules/chardet/lib/encoding/ascii.d.ts
generated
vendored
Normal file
6
node_modules/chardet/lib/encoding/ascii.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Context, Recogniser } from '.';
|
||||
import { Match } from '../match';
|
||||
export default class Ascii implements Recogniser {
|
||||
name(): string;
|
||||
match(det: Context): Match | null;
|
||||
}
|
23
node_modules/chardet/lib/encoding/ascii.js
generated
vendored
Normal file
23
node_modules/chardet/lib/encoding/ascii.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const match_1 = __importDefault(require("../match"));
|
||||
class Ascii {
|
||||
name() {
|
||||
return 'ASCII';
|
||||
}
|
||||
match(det) {
|
||||
const input = det.rawInput;
|
||||
for (let i = 0; i < det.rawLen; i++) {
|
||||
const b = input[i];
|
||||
if (b < 32 || b > 126) {
|
||||
return (0, match_1.default)(det, this, 0);
|
||||
}
|
||||
}
|
||||
return (0, match_1.default)(det, this, 100);
|
||||
}
|
||||
}
|
||||
exports.default = Ascii;
|
||||
//# sourceMappingURL=ascii.js.map
|
1
node_modules/chardet/lib/encoding/ascii.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/ascii.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ascii.js","sourceRoot":"","sources":["../../src/encoding/ascii.ts"],"names":[],"mappings":";;;;;AACA,qDAAwC;AAExC,MAAqB,KAAK;IACxB,IAAI;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE3B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,GAAG,EAAE;gBACrB,OAAO,IAAA,eAAK,EAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;aAC5B;SACF;QAED,OAAO,IAAA,eAAK,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;CACF;AAjBD,wBAiBC"}
|
14
node_modules/chardet/lib/encoding/index.d.ts
generated
vendored
Normal file
14
node_modules/chardet/lib/encoding/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Match } from '../match';
|
||||
export interface Recogniser {
|
||||
match(input: Context): Match | null;
|
||||
name(input?: Context): string;
|
||||
language?(): string | undefined;
|
||||
}
|
||||
export interface Context {
|
||||
byteStats: number[];
|
||||
c1Bytes: boolean;
|
||||
rawInput: Uint8Array;
|
||||
rawLen: number;
|
||||
inputBytes: Uint8Array;
|
||||
inputLen: number;
|
||||
}
|
3
node_modules/chardet/lib/encoding/index.js
generated
vendored
Normal file
3
node_modules/chardet/lib/encoding/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/chardet/lib/encoding/index.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/encoding/index.ts"],"names":[],"mappings":""}
|
23
node_modules/chardet/lib/encoding/iso2022.d.ts
generated
vendored
Normal file
23
node_modules/chardet/lib/encoding/iso2022.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Context, Recogniser } from '.';
|
||||
import { Match } from '../match';
|
||||
declare class ISO_2022 implements Recogniser {
|
||||
escapeSequences: number[][];
|
||||
name(): string;
|
||||
match(det: Context): Match | null;
|
||||
}
|
||||
export declare class ISO_2022_JP extends ISO_2022 {
|
||||
name(): string;
|
||||
language(): string;
|
||||
escapeSequences: number[][];
|
||||
}
|
||||
export declare class ISO_2022_KR extends ISO_2022 {
|
||||
name(): string;
|
||||
language(): string;
|
||||
escapeSequences: number[][];
|
||||
}
|
||||
export declare class ISO_2022_CN extends ISO_2022 {
|
||||
name(): string;
|
||||
language(): string;
|
||||
escapeSequences: number[][];
|
||||
}
|
||||
export {};
|
114
node_modules/chardet/lib/encoding/iso2022.js
generated
vendored
Normal file
114
node_modules/chardet/lib/encoding/iso2022.js
generated
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ISO_2022_CN = exports.ISO_2022_KR = exports.ISO_2022_JP = void 0;
|
||||
const match_1 = __importDefault(require("../match"));
|
||||
class ISO_2022 {
|
||||
constructor() {
|
||||
this.escapeSequences = [];
|
||||
}
|
||||
name() {
|
||||
return 'ISO_2022';
|
||||
}
|
||||
match(det) {
|
||||
let i, j;
|
||||
let escN;
|
||||
let hits = 0;
|
||||
let misses = 0;
|
||||
let shifts = 0;
|
||||
let confidence;
|
||||
const text = det.inputBytes;
|
||||
const textLen = det.inputLen;
|
||||
scanInput: for (i = 0; i < textLen; i++) {
|
||||
if (text[i] == 0x1b) {
|
||||
checkEscapes: for (escN = 0; escN < this.escapeSequences.length; escN++) {
|
||||
const seq = this.escapeSequences[escN];
|
||||
if (textLen - i < seq.length)
|
||||
continue checkEscapes;
|
||||
for (j = 1; j < seq.length; j++)
|
||||
if (seq[j] != text[i + j])
|
||||
continue checkEscapes;
|
||||
hits++;
|
||||
i += seq.length - 1;
|
||||
continue scanInput;
|
||||
}
|
||||
misses++;
|
||||
}
|
||||
if (text[i] == 0x0e || text[i] == 0x0f)
|
||||
shifts++;
|
||||
}
|
||||
if (hits == 0)
|
||||
return null;
|
||||
confidence = (100 * hits - 100 * misses) / (hits + misses);
|
||||
if (hits + shifts < 5)
|
||||
confidence -= (5 - (hits + shifts)) * 10;
|
||||
return confidence <= 0 ? null : (0, match_1.default)(det, this, confidence);
|
||||
}
|
||||
}
|
||||
class ISO_2022_JP extends ISO_2022 {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.escapeSequences = [
|
||||
[0x1b, 0x24, 0x28, 0x43],
|
||||
[0x1b, 0x24, 0x28, 0x44],
|
||||
[0x1b, 0x24, 0x40],
|
||||
[0x1b, 0x24, 0x41],
|
||||
[0x1b, 0x24, 0x42],
|
||||
[0x1b, 0x26, 0x40],
|
||||
[0x1b, 0x28, 0x42],
|
||||
[0x1b, 0x28, 0x48],
|
||||
[0x1b, 0x28, 0x49],
|
||||
[0x1b, 0x28, 0x4a],
|
||||
[0x1b, 0x2e, 0x41],
|
||||
[0x1b, 0x2e, 0x46],
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'ISO-2022-JP';
|
||||
}
|
||||
language() {
|
||||
return 'ja';
|
||||
}
|
||||
}
|
||||
exports.ISO_2022_JP = ISO_2022_JP;
|
||||
class ISO_2022_KR extends ISO_2022 {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.escapeSequences = [[0x1b, 0x24, 0x29, 0x43]];
|
||||
}
|
||||
name() {
|
||||
return 'ISO-2022-KR';
|
||||
}
|
||||
language() {
|
||||
return 'kr';
|
||||
}
|
||||
}
|
||||
exports.ISO_2022_KR = ISO_2022_KR;
|
||||
class ISO_2022_CN extends ISO_2022 {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.escapeSequences = [
|
||||
[0x1b, 0x24, 0x29, 0x41],
|
||||
[0x1b, 0x24, 0x29, 0x47],
|
||||
[0x1b, 0x24, 0x2a, 0x48],
|
||||
[0x1b, 0x24, 0x29, 0x45],
|
||||
[0x1b, 0x24, 0x2b, 0x49],
|
||||
[0x1b, 0x24, 0x2b, 0x4a],
|
||||
[0x1b, 0x24, 0x2b, 0x4b],
|
||||
[0x1b, 0x24, 0x2b, 0x4c],
|
||||
[0x1b, 0x24, 0x2b, 0x4d],
|
||||
[0x1b, 0x4e],
|
||||
[0x1b, 0x4f],
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'ISO-2022-CN';
|
||||
}
|
||||
language() {
|
||||
return 'zh';
|
||||
}
|
||||
}
|
||||
exports.ISO_2022_CN = ISO_2022_CN;
|
||||
//# sourceMappingURL=iso2022.js.map
|
1
node_modules/chardet/lib/encoding/iso2022.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/iso2022.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"iso2022.js","sourceRoot":"","sources":["../../src/encoding/iso2022.ts"],"names":[],"mappings":";;;;;;AACA,qDAAwC;AAQxC,MAAM,QAAQ;IAAd;QACE,oBAAe,GAAe,EAAE,CAAC;IA0EnC,CAAC;IAxEC,IAAI;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,GAAY;QAchB,IAAI,CAAC,EAAE,CAAC,CAAC;QACT,IAAI,IAAI,CAAC;QACT,IAAI,IAAI,GAAG,CAAC,CAAC;QACb,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,IAAI,UAAU,CAAC;QAGf,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC;QAC5B,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE7B,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;YACvC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;gBACnB,YAAY,EAAE,KACZ,IAAI,GAAG,CAAC,EACR,IAAI,GAAG,IAAI,CAAC,eAAe,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I,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YACxB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YACxB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YACxB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YACxB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC;YACxB,CAAC,IAAI,EAAE,IAAI,CAAC;YACZ,CAAC,IAAI,EAAE,IAAI,CAAC;SACb,CAAC;IACJ,CAAC;IAnBC,IAAI;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;IACD,QAAQ;QACN,OAAO,IAAI,CAAC;IACd,CAAC;CAcF;AApBD,kCAoBC"}
|
50
node_modules/chardet/lib/encoding/mbcs.d.ts
generated
vendored
Normal file
50
node_modules/chardet/lib/encoding/mbcs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Context, Recogniser } from '.';
|
||||
import { Match } from '../match';
|
||||
declare class IteratedChar {
|
||||
charValue: number;
|
||||
index: number;
|
||||
nextIndex: number;
|
||||
error: boolean;
|
||||
done: boolean;
|
||||
constructor();
|
||||
reset(): void;
|
||||
nextByte(det: Context): number;
|
||||
}
|
||||
declare class mbcs implements Recogniser {
|
||||
commonChars: number[];
|
||||
name(): string;
|
||||
match(det: Context): Match | null;
|
||||
nextChar(_iter: IteratedChar, _det: Context): boolean;
|
||||
}
|
||||
export declare class sjis extends mbcs {
|
||||
name(): string;
|
||||
language(): string;
|
||||
commonChars: number[];
|
||||
nextChar(iter: IteratedChar, det: Context): boolean;
|
||||
}
|
||||
export declare class big5 extends mbcs {
|
||||
name(): string;
|
||||
language(): string;
|
||||
commonChars: number[];
|
||||
nextChar(iter: IteratedChar, det: Context): boolean;
|
||||
}
|
||||
declare function eucNextChar(iter: IteratedChar, det: Context): boolean;
|
||||
export declare class euc_jp extends mbcs {
|
||||
name(): string;
|
||||
language(): string;
|
||||
commonChars: number[];
|
||||
nextChar: typeof eucNextChar;
|
||||
}
|
||||
export declare class euc_kr extends mbcs {
|
||||
name(): string;
|
||||
language(): string;
|
||||
commonChars: number[];
|
||||
nextChar: typeof eucNextChar;
|
||||
}
|
||||
export declare class gb_18030 extends mbcs {
|
||||
name(): string;
|
||||
language(): string;
|
||||
nextChar(iter: IteratedChar, det: Context): boolean;
|
||||
commonChars: number[];
|
||||
}
|
||||
export {};
|
347
node_modules/chardet/lib/encoding/mbcs.js
generated
vendored
Normal file
347
node_modules/chardet/lib/encoding/mbcs.js
generated
vendored
Normal file
@@ -0,0 +1,347 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.gb_18030 = exports.euc_kr = exports.euc_jp = exports.big5 = exports.sjis = void 0;
|
||||
const match_1 = __importDefault(require("../match"));
|
||||
function binarySearch(arr, searchValue) {
|
||||
const find = (arr, searchValue, left, right) => {
|
||||
if (right < left)
|
||||
return -1;
|
||||
const mid = Math.floor((left + right) >>> 1);
|
||||
if (searchValue > arr[mid])
|
||||
return find(arr, searchValue, mid + 1, right);
|
||||
if (searchValue < arr[mid])
|
||||
return find(arr, searchValue, left, mid - 1);
|
||||
return mid;
|
||||
};
|
||||
return find(arr, searchValue, 0, arr.length - 1);
|
||||
}
|
||||
class IteratedChar {
|
||||
constructor() {
|
||||
this.charValue = 0;
|
||||
this.index = 0;
|
||||
this.nextIndex = 0;
|
||||
this.error = false;
|
||||
this.done = false;
|
||||
}
|
||||
reset() {
|
||||
this.charValue = 0;
|
||||
this.index = -1;
|
||||
this.nextIndex = 0;
|
||||
this.error = false;
|
||||
this.done = false;
|
||||
}
|
||||
nextByte(det) {
|
||||
if (this.nextIndex >= det.rawLen) {
|
||||
this.done = true;
|
||||
return -1;
|
||||
}
|
||||
const byteValue = det.rawInput[this.nextIndex++] & 0x00ff;
|
||||
return byteValue;
|
||||
}
|
||||
}
|
||||
class mbcs {
|
||||
constructor() {
|
||||
this.commonChars = [];
|
||||
}
|
||||
name() {
|
||||
return 'mbcs';
|
||||
}
|
||||
match(det) {
|
||||
let doubleByteCharCount = 0, commonCharCount = 0, badCharCount = 0, totalCharCount = 0, confidence = 0;
|
||||
const iter = new IteratedChar();
|
||||
detectBlock: {
|
||||
for (iter.reset(); this.nextChar(iter, det);) {
|
||||
totalCharCount++;
|
||||
if (iter.error) {
|
||||
badCharCount++;
|
||||
}
|
||||
else {
|
||||
const cv = iter.charValue & 0xffffffff;
|
||||
if (cv > 0xff) {
|
||||
doubleByteCharCount++;
|
||||
if (this.commonChars != null) {
|
||||
if (binarySearch(this.commonChars, cv) >= 0) {
|
||||
commonCharCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (badCharCount >= 2 && badCharCount * 5 >= doubleByteCharCount) {
|
||||
break detectBlock;
|
||||
}
|
||||
}
|
||||
if (doubleByteCharCount <= 10 && badCharCount == 0) {
|
||||
if (doubleByteCharCount == 0 && totalCharCount < 10) {
|
||||
confidence = 0;
|
||||
}
|
||||
else {
|
||||
confidence = 10;
|
||||
}
|
||||
break detectBlock;
|
||||
}
|
||||
if (doubleByteCharCount < 20 * badCharCount) {
|
||||
confidence = 0;
|
||||
break detectBlock;
|
||||
}
|
||||
if (this.commonChars == null) {
|
||||
confidence = 30 + doubleByteCharCount - 20 * badCharCount;
|
||||
if (confidence > 100) {
|
||||
confidence = 100;
|
||||
}
|
||||
}
|
||||
else {
|
||||
const maxVal = Math.log(doubleByteCharCount / 4);
|
||||
const scaleFactor = 90.0 / maxVal;
|
||||
confidence = Math.floor(Math.log(commonCharCount + 1) * scaleFactor + 10);
|
||||
confidence = Math.min(confidence, 100);
|
||||
}
|
||||
}
|
||||
return confidence == 0 ? null : (0, match_1.default)(det, this, confidence);
|
||||
}
|
||||
nextChar(_iter, _det) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
class sjis extends mbcs {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.commonChars = [
|
||||
0x8140, 0x8141, 0x8142, 0x8145, 0x815b, 0x8169, 0x816a, 0x8175, 0x8176,
|
||||
0x82a0, 0x82a2, 0x82a4, 0x82a9, 0x82aa, 0x82ab, 0x82ad, 0x82af, 0x82b1,
|
||||
0x82b3, 0x82b5, 0x82b7, 0x82bd, 0x82be, 0x82c1, 0x82c4, 0x82c5, 0x82c6,
|
||||
0x82c8, 0x82c9, 0x82cc, 0x82cd, 0x82dc, 0x82e0, 0x82e7, 0x82e8, 0x82e9,
|
||||
0x82ea, 0x82f0, 0x82f1, 0x8341, 0x8343, 0x834e, 0x834f, 0x8358, 0x835e,
|
||||
0x8362, 0x8367, 0x8375, 0x8376, 0x8389, 0x838a, 0x838b, 0x838d, 0x8393,
|
||||
0x8e96, 0x93fa, 0x95aa,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'Shift_JIS';
|
||||
}
|
||||
language() {
|
||||
return 'ja';
|
||||
}
|
||||
nextChar(iter, det) {
|
||||
iter.index = iter.nextIndex;
|
||||
iter.error = false;
|
||||
const firstByte = (iter.charValue = iter.nextByte(det));
|
||||
if (firstByte < 0)
|
||||
return false;
|
||||
if (firstByte <= 0x7f || (firstByte > 0xa0 && firstByte <= 0xdf))
|
||||
return true;
|
||||
const secondByte = iter.nextByte(det);
|
||||
if (secondByte < 0)
|
||||
return false;
|
||||
iter.charValue = (firstByte << 8) | secondByte;
|
||||
if (!((secondByte >= 0x40 && secondByte <= 0x7f) ||
|
||||
(secondByte >= 0x80 && secondByte <= 0xff))) {
|
||||
iter.error = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
exports.sjis = sjis;
|
||||
class big5 extends mbcs {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.commonChars = [
|
||||
0xa140, 0xa141, 0xa142, 0xa143, 0xa147, 0xa149, 0xa175, 0xa176, 0xa440,
|
||||
0xa446, 0xa447, 0xa448, 0xa451, 0xa454, 0xa457, 0xa464, 0xa46a, 0xa46c,
|
||||
0xa477, 0xa4a3, 0xa4a4, 0xa4a7, 0xa4c1, 0xa4ce, 0xa4d1, 0xa4df, 0xa4e8,
|
||||
0xa4fd, 0xa540, 0xa548, 0xa558, 0xa569, 0xa5cd, 0xa5e7, 0xa657, 0xa661,
|
||||
0xa662, 0xa668, 0xa670, 0xa6a8, 0xa6b3, 0xa6b9, 0xa6d3, 0xa6db, 0xa6e6,
|
||||
0xa6f2, 0xa740, 0xa751, 0xa759, 0xa7da, 0xa8a3, 0xa8a5, 0xa8ad, 0xa8d1,
|
||||
0xa8d3, 0xa8e4, 0xa8fc, 0xa9c0, 0xa9d2, 0xa9f3, 0xaa6b, 0xaaba, 0xaabe,
|
||||
0xaacc, 0xaafc, 0xac47, 0xac4f, 0xacb0, 0xacd2, 0xad59, 0xaec9, 0xafe0,
|
||||
0xb0ea, 0xb16f, 0xb2b3, 0xb2c4, 0xb36f, 0xb44c, 0xb44e, 0xb54c, 0xb5a5,
|
||||
0xb5bd, 0xb5d0, 0xb5d8, 0xb671, 0xb7ed, 0xb867, 0xb944, 0xbad8, 0xbb44,
|
||||
0xbba1, 0xbdd1, 0xc2c4, 0xc3b9, 0xc440, 0xc45f,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'Big5';
|
||||
}
|
||||
language() {
|
||||
return 'zh';
|
||||
}
|
||||
nextChar(iter, det) {
|
||||
iter.index = iter.nextIndex;
|
||||
iter.error = false;
|
||||
const firstByte = (iter.charValue = iter.nextByte(det));
|
||||
if (firstByte < 0)
|
||||
return false;
|
||||
if (firstByte <= 0x7f || firstByte == 0xff)
|
||||
return true;
|
||||
const secondByte = iter.nextByte(det);
|
||||
if (secondByte < 0)
|
||||
return false;
|
||||
iter.charValue = (iter.charValue << 8) | secondByte;
|
||||
if (secondByte < 0x40 || secondByte == 0x7f || secondByte == 0xff)
|
||||
iter.error = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
exports.big5 = big5;
|
||||
function eucNextChar(iter, det) {
|
||||
iter.index = iter.nextIndex;
|
||||
iter.error = false;
|
||||
let firstByte = 0;
|
||||
let secondByte = 0;
|
||||
let thirdByte = 0;
|
||||
buildChar: {
|
||||
firstByte = iter.charValue = iter.nextByte(det);
|
||||
if (firstByte < 0) {
|
||||
iter.done = true;
|
||||
break buildChar;
|
||||
}
|
||||
if (firstByte <= 0x8d) {
|
||||
break buildChar;
|
||||
}
|
||||
secondByte = iter.nextByte(det);
|
||||
iter.charValue = (iter.charValue << 8) | secondByte;
|
||||
if (firstByte >= 0xa1 && firstByte <= 0xfe) {
|
||||
if (secondByte < 0xa1) {
|
||||
iter.error = true;
|
||||
}
|
||||
break buildChar;
|
||||
}
|
||||
if (firstByte == 0x8e) {
|
||||
if (secondByte < 0xa1) {
|
||||
iter.error = true;
|
||||
}
|
||||
break buildChar;
|
||||
}
|
||||
if (firstByte == 0x8f) {
|
||||
thirdByte = iter.nextByte(det);
|
||||
iter.charValue = (iter.charValue << 8) | thirdByte;
|
||||
if (thirdByte < 0xa1) {
|
||||
iter.error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return iter.done == false;
|
||||
}
|
||||
class euc_jp extends mbcs {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.commonChars = [
|
||||
0xa1a1, 0xa1a2, 0xa1a3, 0xa1a6, 0xa1bc, 0xa1ca, 0xa1cb, 0xa1d6, 0xa1d7,
|
||||
0xa4a2, 0xa4a4, 0xa4a6, 0xa4a8, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4af,
|
||||
0xa4b1, 0xa4b3, 0xa4b5, 0xa4b7, 0xa4b9, 0xa4bb, 0xa4bd, 0xa4bf, 0xa4c0,
|
||||
0xa4c1, 0xa4c3, 0xa4c4, 0xa4c6, 0xa4c7, 0xa4c8, 0xa4c9, 0xa4ca, 0xa4cb,
|
||||
0xa4ce, 0xa4cf, 0xa4d0, 0xa4de, 0xa4df, 0xa4e1, 0xa4e2, 0xa4e4, 0xa4e8,
|
||||
0xa4e9, 0xa4ea, 0xa4eb, 0xa4ec, 0xa4ef, 0xa4f2, 0xa4f3, 0xa5a2, 0xa5a3,
|
||||
0xa5a4, 0xa5a6, 0xa5a7, 0xa5aa, 0xa5ad, 0xa5af, 0xa5b0, 0xa5b3, 0xa5b5,
|
||||
0xa5b7, 0xa5b8, 0xa5b9, 0xa5bf, 0xa5c3, 0xa5c6, 0xa5c7, 0xa5c8, 0xa5c9,
|
||||
0xa5cb, 0xa5d0, 0xa5d5, 0xa5d6, 0xa5d7, 0xa5de, 0xa5e0, 0xa5e1, 0xa5e5,
|
||||
0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5f3, 0xb8a9, 0xb9d4, 0xbaee,
|
||||
0xbbc8, 0xbef0, 0xbfb7, 0xc4ea, 0xc6fc, 0xc7bd, 0xcab8, 0xcaf3, 0xcbdc,
|
||||
0xcdd1,
|
||||
];
|
||||
this.nextChar = eucNextChar;
|
||||
}
|
||||
name() {
|
||||
return 'EUC-JP';
|
||||
}
|
||||
language() {
|
||||
return 'ja';
|
||||
}
|
||||
}
|
||||
exports.euc_jp = euc_jp;
|
||||
class euc_kr extends mbcs {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.commonChars = [
|
||||
0xb0a1, 0xb0b3, 0xb0c5, 0xb0cd, 0xb0d4, 0xb0e6, 0xb0ed, 0xb0f8, 0xb0fa,
|
||||
0xb0fc, 0xb1b8, 0xb1b9, 0xb1c7, 0xb1d7, 0xb1e2, 0xb3aa, 0xb3bb, 0xb4c2,
|
||||
0xb4cf, 0xb4d9, 0xb4eb, 0xb5a5, 0xb5b5, 0xb5bf, 0xb5c7, 0xb5e9, 0xb6f3,
|
||||
0xb7af, 0xb7c2, 0xb7ce, 0xb8a6, 0xb8ae, 0xb8b6, 0xb8b8, 0xb8bb, 0xb8e9,
|
||||
0xb9ab, 0xb9ae, 0xb9cc, 0xb9ce, 0xb9fd, 0xbab8, 0xbace, 0xbad0, 0xbaf1,
|
||||
0xbbe7, 0xbbf3, 0xbbfd, 0xbcad, 0xbcba, 0xbcd2, 0xbcf6, 0xbdba, 0xbdc0,
|
||||
0xbdc3, 0xbdc5, 0xbec6, 0xbec8, 0xbedf, 0xbeee, 0xbef8, 0xbefa, 0xbfa1,
|
||||
0xbfa9, 0xbfc0, 0xbfe4, 0xbfeb, 0xbfec, 0xbff8, 0xc0a7, 0xc0af, 0xc0b8,
|
||||
0xc0ba, 0xc0bb, 0xc0bd, 0xc0c7, 0xc0cc, 0xc0ce, 0xc0cf, 0xc0d6, 0xc0da,
|
||||
0xc0e5, 0xc0fb, 0xc0fc, 0xc1a4, 0xc1a6, 0xc1b6, 0xc1d6, 0xc1df, 0xc1f6,
|
||||
0xc1f8, 0xc4a1, 0xc5cd, 0xc6ae, 0xc7cf, 0xc7d1, 0xc7d2, 0xc7d8, 0xc7e5,
|
||||
0xc8ad,
|
||||
];
|
||||
this.nextChar = eucNextChar;
|
||||
}
|
||||
name() {
|
||||
return 'EUC-KR';
|
||||
}
|
||||
language() {
|
||||
return 'ko';
|
||||
}
|
||||
}
|
||||
exports.euc_kr = euc_kr;
|
||||
class gb_18030 extends mbcs {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.commonChars = [
|
||||
0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1b0, 0xa1b1, 0xa1f1, 0xa1f3, 0xa3a1,
|
||||
0xa3ac, 0xa3ba, 0xb1a8, 0xb1b8, 0xb1be, 0xb2bb, 0xb3c9, 0xb3f6, 0xb4f3,
|
||||
0xb5bd, 0xb5c4, 0xb5e3, 0xb6af, 0xb6d4, 0xb6e0, 0xb7a2, 0xb7a8, 0xb7bd,
|
||||
0xb7d6, 0xb7dd, 0xb8b4, 0xb8df, 0xb8f6, 0xb9ab, 0xb9c9, 0xb9d8, 0xb9fa,
|
||||
0xb9fd, 0xbacd, 0xbba7, 0xbbd6, 0xbbe1, 0xbbfa, 0xbcbc, 0xbcdb, 0xbcfe,
|
||||
0xbdcc, 0xbecd, 0xbedd, 0xbfb4, 0xbfc6, 0xbfc9, 0xc0b4, 0xc0ed, 0xc1cb,
|
||||
0xc2db, 0xc3c7, 0xc4dc, 0xc4ea, 0xc5cc, 0xc6f7, 0xc7f8, 0xc8ab, 0xc8cb,
|
||||
0xc8d5, 0xc8e7, 0xc9cf, 0xc9fa, 0xcab1, 0xcab5, 0xcac7, 0xcad0, 0xcad6,
|
||||
0xcaf5, 0xcafd, 0xccec, 0xcdf8, 0xceaa, 0xcec4, 0xced2, 0xcee5, 0xcfb5,
|
||||
0xcfc2, 0xcfd6, 0xd0c2, 0xd0c5, 0xd0d0, 0xd0d4, 0xd1a7, 0xd2aa, 0xd2b2,
|
||||
0xd2b5, 0xd2bb, 0xd2d4, 0xd3c3, 0xd3d0, 0xd3fd, 0xd4c2, 0xd4da, 0xd5e2,
|
||||
0xd6d0,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'GB18030';
|
||||
}
|
||||
language() {
|
||||
return 'zh';
|
||||
}
|
||||
nextChar(iter, det) {
|
||||
iter.index = iter.nextIndex;
|
||||
iter.error = false;
|
||||
let firstByte = 0;
|
||||
let secondByte = 0;
|
||||
let thirdByte = 0;
|
||||
let fourthByte = 0;
|
||||
buildChar: {
|
||||
firstByte = iter.charValue = iter.nextByte(det);
|
||||
if (firstByte < 0) {
|
||||
iter.done = true;
|
||||
break buildChar;
|
||||
}
|
||||
if (firstByte <= 0x80) {
|
||||
break buildChar;
|
||||
}
|
||||
secondByte = iter.nextByte(det);
|
||||
iter.charValue = (iter.charValue << 8) | secondByte;
|
||||
if (firstByte >= 0x81 && firstByte <= 0xfe) {
|
||||
if ((secondByte >= 0x40 && secondByte <= 0x7e) ||
|
||||
(secondByte >= 80 && secondByte <= 0xfe)) {
|
||||
break buildChar;
|
||||
}
|
||||
if (secondByte >= 0x30 && secondByte <= 0x39) {
|
||||
thirdByte = iter.nextByte(det);
|
||||
if (thirdByte >= 0x81 && thirdByte <= 0xfe) {
|
||||
fourthByte = iter.nextByte(det);
|
||||
if (fourthByte >= 0x30 && fourthByte <= 0x39) {
|
||||
iter.charValue =
|
||||
(iter.charValue << 16) | (thirdByte << 8) | fourthByte;
|
||||
break buildChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
iter.error = true;
|
||||
break buildChar;
|
||||
}
|
||||
}
|
||||
return iter.done == false;
|
||||
}
|
||||
}
|
||||
exports.gb_18030 = gb_18030;
|
||||
//# sourceMappingURL=mbcs.js.map
|
1
node_modules/chardet/lib/encoding/mbcs.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/mbcs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
75
node_modules/chardet/lib/encoding/sbcs.d.ts
generated
vendored
Normal file
75
node_modules/chardet/lib/encoding/sbcs.d.ts
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
import { Context, Recogniser } from '../encoding/index';
|
||||
import { Match } from '../match';
|
||||
declare class NGramsPlusLang {
|
||||
fLang: string;
|
||||
fNGrams: number[];
|
||||
constructor(la: string, ng: number[]);
|
||||
}
|
||||
declare class sbcs implements Recogniser {
|
||||
spaceChar: number;
|
||||
private nGramLang?;
|
||||
ngrams(): NGramsPlusLang[] | number[];
|
||||
byteMap(): number[];
|
||||
name(_input: Context): string;
|
||||
language(): string | undefined;
|
||||
match(det: Context): Match | null;
|
||||
}
|
||||
export declare class ISO_8859_1 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): NGramsPlusLang[];
|
||||
name(input: Context): string;
|
||||
}
|
||||
export declare class ISO_8859_2 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): NGramsPlusLang[];
|
||||
name(det: Context): string;
|
||||
}
|
||||
export declare class ISO_8859_5 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class ISO_8859_6 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class ISO_8859_7 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(det: Context): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class ISO_8859_8 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): NGramsPlusLang[];
|
||||
name(det: Context): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class ISO_8859_9 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(det: Context): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class windows_1251 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class windows_1256 extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(): string;
|
||||
language(): string;
|
||||
}
|
||||
export declare class KOI8_R extends sbcs {
|
||||
byteMap(): number[];
|
||||
ngrams(): number[];
|
||||
name(): string;
|
||||
language(): string;
|
||||
}
|
||||
export {};
|
764
node_modules/chardet/lib/encoding/sbcs.js
generated
vendored
Normal file
764
node_modules/chardet/lib/encoding/sbcs.js
generated
vendored
Normal file
@@ -0,0 +1,764 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.KOI8_R = exports.windows_1256 = exports.windows_1251 = exports.ISO_8859_9 = exports.ISO_8859_8 = exports.ISO_8859_7 = exports.ISO_8859_6 = exports.ISO_8859_5 = exports.ISO_8859_2 = exports.ISO_8859_1 = void 0;
|
||||
const match_1 = __importDefault(require("../match"));
|
||||
const N_GRAM_MASK = 0xffffff;
|
||||
class NGramParser {
|
||||
constructor(theNgramList, theByteMap) {
|
||||
this.byteIndex = 0;
|
||||
this.ngram = 0;
|
||||
this.ngramCount = 0;
|
||||
this.hitCount = 0;
|
||||
this.spaceChar = 0x20;
|
||||
this.ngramList = theNgramList;
|
||||
this.byteMap = theByteMap;
|
||||
}
|
||||
search(table, value) {
|
||||
let index = 0;
|
||||
if (table[index + 32] <= value)
|
||||
index += 32;
|
||||
if (table[index + 16] <= value)
|
||||
index += 16;
|
||||
if (table[index + 8] <= value)
|
||||
index += 8;
|
||||
if (table[index + 4] <= value)
|
||||
index += 4;
|
||||
if (table[index + 2] <= value)
|
||||
index += 2;
|
||||
if (table[index + 1] <= value)
|
||||
index += 1;
|
||||
if (table[index] > value)
|
||||
index -= 1;
|
||||
if (index < 0 || table[index] != value)
|
||||
return -1;
|
||||
return index;
|
||||
}
|
||||
lookup(thisNgram) {
|
||||
this.ngramCount += 1;
|
||||
if (this.search(this.ngramList, thisNgram) >= 0) {
|
||||
this.hitCount += 1;
|
||||
}
|
||||
}
|
||||
addByte(b) {
|
||||
this.ngram = ((this.ngram << 8) + (b & 0xff)) & N_GRAM_MASK;
|
||||
this.lookup(this.ngram);
|
||||
}
|
||||
nextByte(det) {
|
||||
if (this.byteIndex >= det.inputLen)
|
||||
return -1;
|
||||
return det.inputBytes[this.byteIndex++] & 0xff;
|
||||
}
|
||||
parse(det, spaceCh) {
|
||||
let b, ignoreSpace = false;
|
||||
this.spaceChar = spaceCh;
|
||||
while ((b = this.nextByte(det)) >= 0) {
|
||||
const mb = this.byteMap[b];
|
||||
if (mb != 0) {
|
||||
if (!(mb == this.spaceChar && ignoreSpace)) {
|
||||
this.addByte(mb);
|
||||
}
|
||||
ignoreSpace = mb == this.spaceChar;
|
||||
}
|
||||
}
|
||||
this.addByte(this.spaceChar);
|
||||
const rawPercent = this.hitCount / this.ngramCount;
|
||||
if (rawPercent > 0.33)
|
||||
return 98;
|
||||
return Math.floor(rawPercent * 300.0);
|
||||
}
|
||||
}
|
||||
class NGramsPlusLang {
|
||||
constructor(la, ng) {
|
||||
this.fLang = la;
|
||||
this.fNGrams = ng;
|
||||
}
|
||||
}
|
||||
const isFlatNgrams = (val) => Array.isArray(val) && isFinite(val[0]);
|
||||
class sbcs {
|
||||
constructor() {
|
||||
this.spaceChar = 0x20;
|
||||
this.nGramLang = undefined;
|
||||
}
|
||||
ngrams() {
|
||||
return [];
|
||||
}
|
||||
byteMap() {
|
||||
return [];
|
||||
}
|
||||
name(_input) {
|
||||
return 'sbcs';
|
||||
}
|
||||
language() {
|
||||
return this.nGramLang;
|
||||
}
|
||||
match(det) {
|
||||
this.nGramLang = undefined;
|
||||
const ngrams = this.ngrams();
|
||||
if (isFlatNgrams(ngrams)) {
|
||||
const parser = new NGramParser(ngrams, this.byteMap());
|
||||
const confidence = parser.parse(det, this.spaceChar);
|
||||
return confidence <= 0 ? null : (0, match_1.default)(det, this, confidence);
|
||||
}
|
||||
let bestConfidence = -1;
|
||||
for (let i = ngrams.length - 1; i >= 0; i--) {
|
||||
const ngl = ngrams[i];
|
||||
const parser = new NGramParser(ngl.fNGrams, this.byteMap());
|
||||
const confidence = parser.parse(det, this.spaceChar);
|
||||
if (confidence > bestConfidence) {
|
||||
bestConfidence = confidence;
|
||||
this.nGramLang = ngl.fLang;
|
||||
}
|
||||
}
|
||||
return bestConfidence <= 0 ? null : (0, match_1.default)(det, this, bestConfidence);
|
||||
}
|
||||
}
|
||||
class ISO_8859_1 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0xaa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0xb5, 0x20, 0x20, 0x20, 0x20, 0xba, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
|
||||
0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x20,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x20, 0xf8, 0xf9, 0xfa, 0xfb,
|
||||
0xfc, 0xfd, 0xfe, 0xff,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
new NGramsPlusLang('da', [
|
||||
0x206166, 0x206174, 0x206465, 0x20656e, 0x206572, 0x20666f, 0x206861,
|
||||
0x206920, 0x206d65, 0x206f67, 0x2070e5, 0x207369, 0x207374, 0x207469,
|
||||
0x207669, 0x616620, 0x616e20, 0x616e64, 0x617220, 0x617420, 0x646520,
|
||||
0x64656e, 0x646572, 0x646574, 0x652073, 0x656420, 0x656465, 0x656e20,
|
||||
0x656e64, 0x657220, 0x657265, 0x657320, 0x657420, 0x666f72, 0x676520,
|
||||
0x67656e, 0x676572, 0x696765, 0x696c20, 0x696e67, 0x6b6520, 0x6b6b65,
|
||||
0x6c6572, 0x6c6967, 0x6c6c65, 0x6d6564, 0x6e6465, 0x6e6520, 0x6e6720,
|
||||
0x6e6765, 0x6f6720, 0x6f6d20, 0x6f7220, 0x70e520, 0x722064, 0x722065,
|
||||
0x722073, 0x726520, 0x737465, 0x742073, 0x746520, 0x746572, 0x74696c,
|
||||
0x766572,
|
||||
]),
|
||||
new NGramsPlusLang('de', [
|
||||
0x20616e, 0x206175, 0x206265, 0x206461, 0x206465, 0x206469, 0x206569,
|
||||
0x206765, 0x206861, 0x20696e, 0x206d69, 0x207363, 0x207365, 0x20756e,
|
||||
0x207665, 0x20766f, 0x207765, 0x207a75, 0x626572, 0x636820, 0x636865,
|
||||
0x636874, 0x646173, 0x64656e, 0x646572, 0x646965, 0x652064, 0x652073,
|
||||
0x65696e, 0x656974, 0x656e20, 0x657220, 0x657320, 0x67656e, 0x68656e,
|
||||
0x687420, 0x696368, 0x696520, 0x696e20, 0x696e65, 0x697420, 0x6c6963,
|
||||
0x6c6c65, 0x6e2061, 0x6e2064, 0x6e2073, 0x6e6420, 0x6e6465, 0x6e6520,
|
||||
0x6e6720, 0x6e6765, 0x6e7465, 0x722064, 0x726465, 0x726569, 0x736368,
|
||||
0x737465, 0x742064, 0x746520, 0x74656e, 0x746572, 0x756e64, 0x756e67,
|
||||
0x766572,
|
||||
]),
|
||||
new NGramsPlusLang('en', [
|
||||
0x206120, 0x20616e, 0x206265, 0x20636f, 0x20666f, 0x206861, 0x206865,
|
||||
0x20696e, 0x206d61, 0x206f66, 0x207072, 0x207265, 0x207361, 0x207374,
|
||||
0x207468, 0x20746f, 0x207768, 0x616964, 0x616c20, 0x616e20, 0x616e64,
|
||||
0x617320, 0x617420, 0x617465, 0x617469, 0x642061, 0x642074, 0x652061,
|
||||
0x652073, 0x652074, 0x656420, 0x656e74, 0x657220, 0x657320, 0x666f72,
|
||||
0x686174, 0x686520, 0x686572, 0x696420, 0x696e20, 0x696e67, 0x696f6e,
|
||||
0x697320, 0x6e2061, 0x6e2074, 0x6e6420, 0x6e6720, 0x6e7420, 0x6f6620,
|
||||
0x6f6e20, 0x6f7220, 0x726520, 0x727320, 0x732061, 0x732074, 0x736169,
|
||||
0x737420, 0x742074, 0x746572, 0x746861, 0x746865, 0x74696f, 0x746f20,
|
||||
0x747320,
|
||||
]),
|
||||
new NGramsPlusLang('es', [
|
||||
0x206120, 0x206361, 0x20636f, 0x206465, 0x20656c, 0x20656e, 0x206573,
|
||||
0x20696e, 0x206c61, 0x206c6f, 0x207061, 0x20706f, 0x207072, 0x207175,
|
||||
0x207265, 0x207365, 0x20756e, 0x207920, 0x612063, 0x612064, 0x612065,
|
||||
0x61206c, 0x612070, 0x616369, 0x61646f, 0x616c20, 0x617220, 0x617320,
|
||||
0x6369f3, 0x636f6e, 0x646520, 0x64656c, 0x646f20, 0x652064, 0x652065,
|
||||
0x65206c, 0x656c20, 0x656e20, 0x656e74, 0x657320, 0x657374, 0x69656e,
|
||||
0x69f36e, 0x6c6120, 0x6c6f73, 0x6e2065, 0x6e7465, 0x6f2064, 0x6f2065,
|
||||
0x6f6e20, 0x6f7220, 0x6f7320, 0x706172, 0x717565, 0x726120, 0x726573,
|
||||
0x732064, 0x732065, 0x732070, 0x736520, 0x746520, 0x746f20, 0x756520,
|
||||
0xf36e20,
|
||||
]),
|
||||
new NGramsPlusLang('fr', [
|
||||
0x206175, 0x20636f, 0x206461, 0x206465, 0x206475, 0x20656e, 0x206574,
|
||||
0x206c61, 0x206c65, 0x207061, 0x20706f, 0x207072, 0x207175, 0x207365,
|
||||
0x20736f, 0x20756e, 0x20e020, 0x616e74, 0x617469, 0x636520, 0x636f6e,
|
||||
0x646520, 0x646573, 0x647520, 0x652061, 0x652063, 0x652064, 0x652065,
|
||||
0x65206c, 0x652070, 0x652073, 0x656e20, 0x656e74, 0x657220, 0x657320,
|
||||
0x657420, 0x657572, 0x696f6e, 0x697320, 0x697420, 0x6c6120, 0x6c6520,
|
||||
0x6c6573, 0x6d656e, 0x6e2064, 0x6e6520, 0x6e7320, 0x6e7420, 0x6f6e20,
|
||||
0x6f6e74, 0x6f7572, 0x717565, 0x72206c, 0x726520, 0x732061, 0x732064,
|
||||
0x732065, 0x73206c, 0x732070, 0x742064, 0x746520, 0x74696f, 0x756520,
|
||||
0x757220,
|
||||
]),
|
||||
new NGramsPlusLang('it', [
|
||||
0x20616c, 0x206368, 0x20636f, 0x206465, 0x206469, 0x206520, 0x20696c,
|
||||
0x20696e, 0x206c61, 0x207065, 0x207072, 0x20756e, 0x612063, 0x612064,
|
||||
0x612070, 0x612073, 0x61746f, 0x636865, 0x636f6e, 0x64656c, 0x646920,
|
||||
0x652061, 0x652063, 0x652064, 0x652069, 0x65206c, 0x652070, 0x652073,
|
||||
0x656c20, 0x656c6c, 0x656e74, 0x657220, 0x686520, 0x692061, 0x692063,
|
||||
0x692064, 0x692073, 0x696120, 0x696c20, 0x696e20, 0x696f6e, 0x6c6120,
|
||||
0x6c6520, 0x6c6920, 0x6c6c61, 0x6e6520, 0x6e6920, 0x6e6f20, 0x6e7465,
|
||||
0x6f2061, 0x6f2064, 0x6f2069, 0x6f2073, 0x6f6e20, 0x6f6e65, 0x706572,
|
||||
0x726120, 0x726520, 0x736920, 0x746120, 0x746520, 0x746920, 0x746f20,
|
||||
0x7a696f,
|
||||
]),
|
||||
new NGramsPlusLang('nl', [
|
||||
0x20616c, 0x206265, 0x206461, 0x206465, 0x206469, 0x206565, 0x20656e,
|
||||
0x206765, 0x206865, 0x20696e, 0x206d61, 0x206d65, 0x206f70, 0x207465,
|
||||
0x207661, 0x207665, 0x20766f, 0x207765, 0x207a69, 0x61616e, 0x616172,
|
||||
0x616e20, 0x616e64, 0x617220, 0x617420, 0x636874, 0x646520, 0x64656e,
|
||||
0x646572, 0x652062, 0x652076, 0x65656e, 0x656572, 0x656e20, 0x657220,
|
||||
0x657273, 0x657420, 0x67656e, 0x686574, 0x696520, 0x696e20, 0x696e67,
|
||||
0x697320, 0x6e2062, 0x6e2064, 0x6e2065, 0x6e2068, 0x6e206f, 0x6e2076,
|
||||
0x6e6465, 0x6e6720, 0x6f6e64, 0x6f6f72, 0x6f7020, 0x6f7220, 0x736368,
|
||||
0x737465, 0x742064, 0x746520, 0x74656e, 0x746572, 0x76616e, 0x766572,
|
||||
0x766f6f,
|
||||
]),
|
||||
new NGramsPlusLang('no', [
|
||||
0x206174, 0x206176, 0x206465, 0x20656e, 0x206572, 0x20666f, 0x206861,
|
||||
0x206920, 0x206d65, 0x206f67, 0x2070e5, 0x207365, 0x20736b, 0x20736f,
|
||||
0x207374, 0x207469, 0x207669, 0x20e520, 0x616e64, 0x617220, 0x617420,
|
||||
0x646520, 0x64656e, 0x646574, 0x652073, 0x656420, 0x656e20, 0x656e65,
|
||||
0x657220, 0x657265, 0x657420, 0x657474, 0x666f72, 0x67656e, 0x696b6b,
|
||||
0x696c20, 0x696e67, 0x6b6520, 0x6b6b65, 0x6c6520, 0x6c6c65, 0x6d6564,
|
||||
0x6d656e, 0x6e2073, 0x6e6520, 0x6e6720, 0x6e6765, 0x6e6e65, 0x6f6720,
|
||||
0x6f6d20, 0x6f7220, 0x70e520, 0x722073, 0x726520, 0x736f6d, 0x737465,
|
||||
0x742073, 0x746520, 0x74656e, 0x746572, 0x74696c, 0x747420, 0x747465,
|
||||
0x766572,
|
||||
]),
|
||||
new NGramsPlusLang('pt', [
|
||||
0x206120, 0x20636f, 0x206461, 0x206465, 0x20646f, 0x206520, 0x206573,
|
||||
0x206d61, 0x206e6f, 0x206f20, 0x207061, 0x20706f, 0x207072, 0x207175,
|
||||
0x207265, 0x207365, 0x20756d, 0x612061, 0x612063, 0x612064, 0x612070,
|
||||
0x616465, 0x61646f, 0x616c20, 0x617220, 0x617261, 0x617320, 0x636f6d,
|
||||
0x636f6e, 0x646120, 0x646520, 0x646f20, 0x646f73, 0x652061, 0x652064,
|
||||
0x656d20, 0x656e74, 0x657320, 0x657374, 0x696120, 0x696361, 0x6d656e,
|
||||
0x6e7465, 0x6e746f, 0x6f2061, 0x6f2063, 0x6f2064, 0x6f2065, 0x6f2070,
|
||||
0x6f7320, 0x706172, 0x717565, 0x726120, 0x726573, 0x732061, 0x732064,
|
||||
0x732065, 0x732070, 0x737461, 0x746520, 0x746f20, 0x756520, 0xe36f20,
|
||||
0xe7e36f,
|
||||
]),
|
||||
new NGramsPlusLang('sv', [
|
||||
0x206174, 0x206176, 0x206465, 0x20656e, 0x2066f6, 0x206861, 0x206920,
|
||||
0x20696e, 0x206b6f, 0x206d65, 0x206f63, 0x2070e5, 0x20736b, 0x20736f,
|
||||
0x207374, 0x207469, 0x207661, 0x207669, 0x20e472, 0x616465, 0x616e20,
|
||||
0x616e64, 0x617220, 0x617474, 0x636820, 0x646520, 0x64656e, 0x646572,
|
||||
0x646574, 0x656420, 0x656e20, 0x657220, 0x657420, 0x66f672, 0x67656e,
|
||||
0x696c6c, 0x696e67, 0x6b6120, 0x6c6c20, 0x6d6564, 0x6e2073, 0x6e6120,
|
||||
0x6e6465, 0x6e6720, 0x6e6765, 0x6e696e, 0x6f6368, 0x6f6d20, 0x6f6e20,
|
||||
0x70e520, 0x722061, 0x722073, 0x726120, 0x736b61, 0x736f6d, 0x742073,
|
||||
0x746120, 0x746520, 0x746572, 0x74696c, 0x747420, 0x766172, 0xe47220,
|
||||
0xf67220,
|
||||
]),
|
||||
];
|
||||
}
|
||||
name(input) {
|
||||
return input && input.c1Bytes ? 'windows-1252' : 'ISO-8859-1';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_1 = ISO_8859_1;
|
||||
class ISO_8859_2 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0xb1, 0x20, 0xb3, 0x20, 0xb5, 0xb6, 0x20,
|
||||
0x20, 0xb9, 0xba, 0xbb, 0xbc, 0x20, 0xbe, 0xbf, 0x20, 0xb1, 0x20, 0xb3,
|
||||
0x20, 0xb5, 0xb6, 0xb7, 0x20, 0xb9, 0xba, 0xbb, 0xbc, 0x20, 0xbe, 0xbf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
|
||||
0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x20,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x20, 0xf8, 0xf9, 0xfa, 0xfb,
|
||||
0xfc, 0xfd, 0xfe, 0x20,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
new NGramsPlusLang('cs', [
|
||||
0x206120, 0x206279, 0x20646f, 0x206a65, 0x206e61, 0x206e65, 0x206f20,
|
||||
0x206f64, 0x20706f, 0x207072, 0x2070f8, 0x20726f, 0x207365, 0x20736f,
|
||||
0x207374, 0x20746f, 0x207620, 0x207679, 0x207a61, 0x612070, 0x636520,
|
||||
0x636820, 0x652070, 0x652073, 0x652076, 0x656d20, 0x656eed, 0x686f20,
|
||||
0x686f64, 0x697374, 0x6a6520, 0x6b7465, 0x6c6520, 0x6c6920, 0x6e6120,
|
||||
0x6ee920, 0x6eec20, 0x6eed20, 0x6f2070, 0x6f646e, 0x6f6a69, 0x6f7374,
|
||||
0x6f7520, 0x6f7661, 0x706f64, 0x706f6a, 0x70726f, 0x70f865, 0x736520,
|
||||
0x736f75, 0x737461, 0x737469, 0x73746e, 0x746572, 0x746eed, 0x746f20,
|
||||
0x752070, 0xbe6520, 0xe16eed, 0xe9686f, 0xed2070, 0xed2073, 0xed6d20,
|
||||
0xf86564,
|
||||
]),
|
||||
new NGramsPlusLang('hu', [
|
||||
0x206120, 0x20617a, 0x206265, 0x206567, 0x20656c, 0x206665, 0x206861,
|
||||
0x20686f, 0x206973, 0x206b65, 0x206b69, 0x206bf6, 0x206c65, 0x206d61,
|
||||
0x206d65, 0x206d69, 0x206e65, 0x20737a, 0x207465, 0x20e973, 0x612061,
|
||||
0x61206b, 0x61206d, 0x612073, 0x616b20, 0x616e20, 0x617a20, 0x62616e,
|
||||
0x62656e, 0x656779, 0x656b20, 0x656c20, 0x656c65, 0x656d20, 0x656e20,
|
||||
0x657265, 0x657420, 0x657465, 0x657474, 0x677920, 0x686f67, 0x696e74,
|
||||
0x697320, 0x6b2061, 0x6bf67a, 0x6d6567, 0x6d696e, 0x6e2061, 0x6e616b,
|
||||
0x6e656b, 0x6e656d, 0x6e7420, 0x6f6779, 0x732061, 0x737a65, 0x737a74,
|
||||
0x737ae1, 0x73e967, 0x742061, 0x747420, 0x74e173, 0x7a6572, 0xe16e20,
|
||||
0xe97320,
|
||||
]),
|
||||
new NGramsPlusLang('pl', [
|
||||
0x20637a, 0x20646f, 0x206920, 0x206a65, 0x206b6f, 0x206d61, 0x206d69,
|
||||
0x206e61, 0x206e69, 0x206f64, 0x20706f, 0x207072, 0x207369, 0x207720,
|
||||
0x207769, 0x207779, 0x207a20, 0x207a61, 0x612070, 0x612077, 0x616e69,
|
||||
0x636820, 0x637a65, 0x637a79, 0x646f20, 0x647a69, 0x652070, 0x652073,
|
||||
0x652077, 0x65207a, 0x65676f, 0x656a20, 0x656d20, 0x656e69, 0x676f20,
|
||||
0x696120, 0x696520, 0x69656a, 0x6b6120, 0x6b6920, 0x6b6965, 0x6d6965,
|
||||
0x6e6120, 0x6e6961, 0x6e6965, 0x6f2070, 0x6f7761, 0x6f7769, 0x706f6c,
|
||||
0x707261, 0x70726f, 0x70727a, 0x727a65, 0x727a79, 0x7369ea, 0x736b69,
|
||||
0x737461, 0x776965, 0x796368, 0x796d20, 0x7a6520, 0x7a6965, 0x7a7920,
|
||||
0xf37720,
|
||||
]),
|
||||
new NGramsPlusLang('ro', [
|
||||
0x206120, 0x206163, 0x206361, 0x206365, 0x20636f, 0x206375, 0x206465,
|
||||
0x206469, 0x206c61, 0x206d61, 0x207065, 0x207072, 0x207365, 0x2073e3,
|
||||
0x20756e, 0x20ba69, 0x20ee6e, 0x612063, 0x612064, 0x617265, 0x617420,
|
||||
0x617465, 0x617520, 0x636172, 0x636f6e, 0x637520, 0x63e320, 0x646520,
|
||||
0x652061, 0x652063, 0x652064, 0x652070, 0x652073, 0x656120, 0x656920,
|
||||
0x656c65, 0x656e74, 0x657374, 0x692061, 0x692063, 0x692064, 0x692070,
|
||||
0x696520, 0x696920, 0x696e20, 0x6c6120, 0x6c6520, 0x6c6f72, 0x6c7569,
|
||||
0x6e6520, 0x6e7472, 0x6f7220, 0x70656e, 0x726520, 0x726561, 0x727520,
|
||||
0x73e320, 0x746520, 0x747275, 0x74e320, 0x756920, 0x756c20, 0xba6920,
|
||||
0xee6e20,
|
||||
]),
|
||||
];
|
||||
}
|
||||
name(det) {
|
||||
return det && det.c1Bytes ? 'windows-1250' : 'ISO-8859-2';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_2 = ISO_8859_2;
|
||||
class ISO_8859_5 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x20, 0xfe, 0xff, 0xd0, 0xd1, 0xd2, 0xd3,
|
||||
0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
|
||||
0xec, 0xed, 0xee, 0xef, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
||||
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0x20, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
|
||||
0xfc, 0x20, 0xfe, 0xff,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x20d220, 0x20d2de, 0x20d4de, 0x20d7d0, 0x20d820, 0x20dad0, 0x20dade,
|
||||
0x20ddd0, 0x20ddd5, 0x20ded1, 0x20dfde, 0x20dfe0, 0x20e0d0, 0x20e1de,
|
||||
0x20e1e2, 0x20e2de, 0x20e7e2, 0x20ede2, 0xd0ddd8, 0xd0e2ec, 0xd3de20,
|
||||
0xd5dbec, 0xd5ddd8, 0xd5e1e2, 0xd5e220, 0xd820df, 0xd8d520, 0xd8d820,
|
||||
0xd8ef20, 0xdbd5dd, 0xdbd820, 0xdbecdd, 0xddd020, 0xddd520, 0xddd8d5,
|
||||
0xddd8ef, 0xddde20, 0xddded2, 0xde20d2, 0xde20df, 0xde20e1, 0xded220,
|
||||
0xded2d0, 0xded3de, 0xded920, 0xdedbec, 0xdedc20, 0xdee1e2, 0xdfdedb,
|
||||
0xdfe0d5, 0xdfe0d8, 0xdfe0de, 0xe0d0d2, 0xe0d5d4, 0xe1e2d0, 0xe1e2d2,
|
||||
0xe1e2d8, 0xe1ef20, 0xe2d5db, 0xe2de20, 0xe2dee0, 0xe2ec20, 0xe7e2de,
|
||||
0xebe520,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'ISO-8859-5';
|
||||
}
|
||||
language() {
|
||||
return 'ru';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_5 = ISO_8859_5;
|
||||
class ISO_8859_6 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
|
||||
0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
||||
0xd8, 0xd9, 0xda, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x20c7e4, 0x20c7e6, 0x20c8c7, 0x20d9e4, 0x20e1ea, 0x20e4e4, 0x20e5e6,
|
||||
0x20e8c7, 0xc720c7, 0xc7c120, 0xc7ca20, 0xc7d120, 0xc7e420, 0xc7e4c3,
|
||||
0xc7e4c7, 0xc7e4c8, 0xc7e4ca, 0xc7e4cc, 0xc7e4cd, 0xc7e4cf, 0xc7e4d3,
|
||||
0xc7e4d9, 0xc7e4e2, 0xc7e4e5, 0xc7e4e8, 0xc7e4ea, 0xc7e520, 0xc7e620,
|
||||
0xc7e6ca, 0xc820c7, 0xc920c7, 0xc920e1, 0xc920e4, 0xc920e5, 0xc920e8,
|
||||
0xca20c7, 0xcf20c7, 0xcfc920, 0xd120c7, 0xd1c920, 0xd320c7, 0xd920c7,
|
||||
0xd9e4e9, 0xe1ea20, 0xe420c7, 0xe4c920, 0xe4e920, 0xe4ea20, 0xe520c7,
|
||||
0xe5c720, 0xe5c920, 0xe5e620, 0xe620c7, 0xe720c7, 0xe7c720, 0xe8c7e4,
|
||||
0xe8e620, 0xe920c7, 0xea20c7, 0xea20e5, 0xea20e8, 0xeac920, 0xead120,
|
||||
0xeae620,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'ISO-8859-6';
|
||||
}
|
||||
language() {
|
||||
return 'ar';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_6 = ISO_8859_6;
|
||||
class ISO_8859_7 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0xa1, 0xa2, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0xdc, 0x20, 0xdd, 0xde, 0xdf, 0x20, 0xfc, 0x20, 0xfd, 0xfe,
|
||||
0xc0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
|
||||
0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0x20, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
|
||||
0xfc, 0xfd, 0xfe, 0x20,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x20e1ed, 0x20e1f0, 0x20e3e9, 0x20e4e9, 0x20e5f0, 0x20e720, 0x20eae1,
|
||||
0x20ece5, 0x20ede1, 0x20ef20, 0x20f0e1, 0x20f0ef, 0x20f0f1, 0x20f3f4,
|
||||
0x20f3f5, 0x20f4e7, 0x20f4ef, 0xdfe120, 0xe120e1, 0xe120f4, 0xe1e920,
|
||||
0xe1ed20, 0xe1f0fc, 0xe1f220, 0xe3e9e1, 0xe5e920, 0xe5f220, 0xe720f4,
|
||||
0xe7ed20, 0xe7f220, 0xe920f4, 0xe9e120, 0xe9eade, 0xe9f220, 0xeae1e9,
|
||||
0xeae1f4, 0xece520, 0xed20e1, 0xed20e5, 0xed20f0, 0xede120, 0xeff220,
|
||||
0xeff520, 0xf0eff5, 0xf0f1ef, 0xf0fc20, 0xf220e1, 0xf220e5, 0xf220ea,
|
||||
0xf220f0, 0xf220f4, 0xf3e520, 0xf3e720, 0xf3f4ef, 0xf4e120, 0xf4e1e9,
|
||||
0xf4e7ed, 0xf4e7f2, 0xf4e9ea, 0xf4ef20, 0xf4eff5, 0xf4f9ed, 0xf9ed20,
|
||||
0xfeed20,
|
||||
];
|
||||
}
|
||||
name(det) {
|
||||
return det && det.c1Bytes ? 'windows-1253' : 'ISO-8859-7';
|
||||
}
|
||||
language() {
|
||||
return 'el';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_7 = ISO_8859_7;
|
||||
class ISO_8859_8 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0xb5, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
new NGramsPlusLang('he', [
|
||||
0x20e0e5, 0x20e0e7, 0x20e0e9, 0x20e0fa, 0x20e1e9, 0x20e1ee, 0x20e4e0,
|
||||
0x20e4e5, 0x20e4e9, 0x20e4ee, 0x20e4f2, 0x20e4f9, 0x20e4fa, 0x20ece0,
|
||||
0x20ece4, 0x20eee0, 0x20f2ec, 0x20f9ec, 0xe0fa20, 0xe420e0, 0xe420e1,
|
||||
0xe420e4, 0xe420ec, 0xe420ee, 0xe420f9, 0xe4e5e0, 0xe5e020, 0xe5ed20,
|
||||
0xe5ef20, 0xe5f820, 0xe5fa20, 0xe920e4, 0xe9e420, 0xe9e5fa, 0xe9e9ed,
|
||||
0xe9ed20, 0xe9ef20, 0xe9f820, 0xe9fa20, 0xec20e0, 0xec20e4, 0xece020,
|
||||
0xece420, 0xed20e0, 0xed20e1, 0xed20e4, 0xed20ec, 0xed20ee, 0xed20f9,
|
||||
0xeee420, 0xef20e4, 0xf0e420, 0xf0e920, 0xf0e9ed, 0xf2ec20, 0xf820e4,
|
||||
0xf8e9ed, 0xf9ec20, 0xfa20e0, 0xfa20e1, 0xfa20e4, 0xfa20ec, 0xfa20ee,
|
||||
0xfa20f9,
|
||||
]),
|
||||
new NGramsPlusLang('he', [
|
||||
0x20e0e5, 0x20e0ec, 0x20e4e9, 0x20e4ec, 0x20e4ee, 0x20e4f0, 0x20e9f0,
|
||||
0x20ecf2, 0x20ecf9, 0x20ede5, 0x20ede9, 0x20efe5, 0x20efe9, 0x20f8e5,
|
||||
0x20f8e9, 0x20fae0, 0x20fae5, 0x20fae9, 0xe020e4, 0xe020ec, 0xe020ed,
|
||||
0xe020fa, 0xe0e420, 0xe0e5e4, 0xe0ec20, 0xe0ee20, 0xe120e4, 0xe120ed,
|
||||
0xe120fa, 0xe420e4, 0xe420e9, 0xe420ec, 0xe420ed, 0xe420ef, 0xe420f8,
|
||||
0xe420fa, 0xe4ec20, 0xe5e020, 0xe5e420, 0xe7e020, 0xe9e020, 0xe9e120,
|
||||
0xe9e420, 0xec20e4, 0xec20ed, 0xec20fa, 0xecf220, 0xecf920, 0xede9e9,
|
||||
0xede9f0, 0xede9f8, 0xee20e4, 0xee20ed, 0xee20fa, 0xeee120, 0xeee420,
|
||||
0xf2e420, 0xf920e4, 0xf920ed, 0xf920fa, 0xf9e420, 0xfae020, 0xfae420,
|
||||
0xfae5e9,
|
||||
]),
|
||||
];
|
||||
}
|
||||
name(det) {
|
||||
return det && det.c1Bytes ? 'windows-1255' : 'ISO-8859-8';
|
||||
}
|
||||
language() {
|
||||
return 'he';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_8 = ISO_8859_8;
|
||||
class ISO_8859_9 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0xaa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0xb5, 0x20, 0x20, 0x20, 0x20, 0xba, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
|
||||
0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x20,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x69, 0xfe, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x20, 0xf8, 0xf9, 0xfa, 0xfb,
|
||||
0xfc, 0xfd, 0xfe, 0xff,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x206261, 0x206269, 0x206275, 0x206461, 0x206465, 0x206765, 0x206861,
|
||||
0x20696c, 0x206b61, 0x206b6f, 0x206d61, 0x206f6c, 0x207361, 0x207461,
|
||||
0x207665, 0x207961, 0x612062, 0x616b20, 0x616c61, 0x616d61, 0x616e20,
|
||||
0x616efd, 0x617220, 0x617261, 0x6172fd, 0x6173fd, 0x617961, 0x626972,
|
||||
0x646120, 0x646520, 0x646920, 0x652062, 0x65206b, 0x656469, 0x656e20,
|
||||
0x657220, 0x657269, 0x657369, 0x696c65, 0x696e20, 0x696e69, 0x697220,
|
||||
0x6c616e, 0x6c6172, 0x6c6520, 0x6c6572, 0x6e2061, 0x6e2062, 0x6e206b,
|
||||
0x6e6461, 0x6e6465, 0x6e6520, 0x6e6920, 0x6e696e, 0x6efd20, 0x72696e,
|
||||
0x72fd6e, 0x766520, 0x796120, 0x796f72, 0xfd6e20, 0xfd6e64, 0xfd6efd,
|
||||
0xfdf0fd,
|
||||
];
|
||||
}
|
||||
name(det) {
|
||||
return det && det.c1Bytes ? 'windows-1254' : 'ISO-8859-9';
|
||||
}
|
||||
language() {
|
||||
return 'tr';
|
||||
}
|
||||
}
|
||||
exports.ISO_8859_9 = ISO_8859_9;
|
||||
class windows_1251 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x90, 0x83, 0x20, 0x83,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x9a, 0x20, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x9a, 0x20,
|
||||
0x9c, 0x9d, 0x9e, 0x9f, 0x20, 0xa2, 0xa2, 0xbc, 0x20, 0xb4, 0x20, 0x20,
|
||||
0xb8, 0x20, 0xba, 0x20, 0x20, 0x20, 0x20, 0xbf, 0x20, 0x20, 0xb3, 0xb3,
|
||||
0xb4, 0xb5, 0x20, 0x20, 0xb8, 0x20, 0xba, 0x20, 0xbc, 0xbe, 0xbe, 0xbf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb,
|
||||
0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
|
||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb,
|
||||
0xfc, 0xfd, 0xfe, 0xff,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x20e220, 0x20e2ee, 0x20e4ee, 0x20e7e0, 0x20e820, 0x20eae0, 0x20eaee,
|
||||
0x20ede0, 0x20ede5, 0x20eee1, 0x20efee, 0x20eff0, 0x20f0e0, 0x20f1ee,
|
||||
0x20f1f2, 0x20f2ee, 0x20f7f2, 0x20fdf2, 0xe0ede8, 0xe0f2fc, 0xe3ee20,
|
||||
0xe5ebfc, 0xe5ede8, 0xe5f1f2, 0xe5f220, 0xe820ef, 0xe8e520, 0xe8e820,
|
||||
0xe8ff20, 0xebe5ed, 0xebe820, 0xebfced, 0xede020, 0xede520, 0xede8e5,
|
||||
0xede8ff, 0xedee20, 0xedeee2, 0xee20e2, 0xee20ef, 0xee20f1, 0xeee220,
|
||||
0xeee2e0, 0xeee3ee, 0xeee920, 0xeeebfc, 0xeeec20, 0xeef1f2, 0xefeeeb,
|
||||
0xeff0e5, 0xeff0e8, 0xeff0ee, 0xf0e0e2, 0xf0e5e4, 0xf1f2e0, 0xf1f2e2,
|
||||
0xf1f2e8, 0xf1ff20, 0xf2e5eb, 0xf2ee20, 0xf2eef0, 0xf2fc20, 0xf7f2ee,
|
||||
0xfbf520,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'windows-1251';
|
||||
}
|
||||
language() {
|
||||
return 'ru';
|
||||
}
|
||||
}
|
||||
exports.windows_1251 = windows_1251;
|
||||
class windows_1256 extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x81, 0x20, 0x83,
|
||||
0x20, 0x20, 0x20, 0x20, 0x88, 0x20, 0x8a, 0x20, 0x9c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x98, 0x20, 0x9a, 0x20,
|
||||
0x9c, 0x20, 0x20, 0x9f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0xaa, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0xb5, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
|
||||
0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x20,
|
||||
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe2, 0xe3,
|
||||
0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0x20, 0x20, 0x20, 0x20, 0xf4, 0x20, 0x20, 0x20, 0x20, 0xf9, 0x20, 0xfb,
|
||||
0xfc, 0x20, 0x20, 0xff,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x20c7e1, 0x20c7e4, 0x20c8c7, 0x20dae1, 0x20dded, 0x20e1e1, 0x20e3e4,
|
||||
0x20e6c7, 0xc720c7, 0xc7c120, 0xc7ca20, 0xc7d120, 0xc7e120, 0xc7e1c3,
|
||||
0xc7e1c7, 0xc7e1c8, 0xc7e1ca, 0xc7e1cc, 0xc7e1cd, 0xc7e1cf, 0xc7e1d3,
|
||||
0xc7e1da, 0xc7e1de, 0xc7e1e3, 0xc7e1e6, 0xc7e1ed, 0xc7e320, 0xc7e420,
|
||||
0xc7e4ca, 0xc820c7, 0xc920c7, 0xc920dd, 0xc920e1, 0xc920e3, 0xc920e6,
|
||||
0xca20c7, 0xcf20c7, 0xcfc920, 0xd120c7, 0xd1c920, 0xd320c7, 0xda20c7,
|
||||
0xdae1ec, 0xdded20, 0xe120c7, 0xe1c920, 0xe1ec20, 0xe1ed20, 0xe320c7,
|
||||
0xe3c720, 0xe3c920, 0xe3e420, 0xe420c7, 0xe520c7, 0xe5c720, 0xe6c7e1,
|
||||
0xe6e420, 0xec20c7, 0xed20c7, 0xed20e3, 0xed20e6, 0xedc920, 0xedd120,
|
||||
0xede420,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'windows-1256';
|
||||
}
|
||||
language() {
|
||||
return 'ar';
|
||||
}
|
||||
}
|
||||
exports.windows_1256 = windows_1256;
|
||||
class KOI8_R extends sbcs {
|
||||
byteMap() {
|
||||
return [
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
|
||||
0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73,
|
||||
0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b,
|
||||
0x6c, 0x6d, 0x6e, 0x6f, 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
|
||||
0x78, 0x79, 0x7a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa3, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xa3,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb,
|
||||
0xcc, 0xcd, 0xce, 0xcf, 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
|
||||
0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xc0, 0xc1, 0xc2, 0xc3,
|
||||
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb,
|
||||
0xdc, 0xdd, 0xde, 0xdf,
|
||||
];
|
||||
}
|
||||
ngrams() {
|
||||
return [
|
||||
0x20c4cf, 0x20c920, 0x20cbc1, 0x20cbcf, 0x20cec1, 0x20cec5, 0x20cfc2,
|
||||
0x20d0cf, 0x20d0d2, 0x20d2c1, 0x20d3cf, 0x20d3d4, 0x20d4cf, 0x20d720,
|
||||
0x20d7cf, 0x20dac1, 0x20dcd4, 0x20ded4, 0xc1cec9, 0xc1d4d8, 0xc5ccd8,
|
||||
0xc5cec9, 0xc5d3d4, 0xc5d420, 0xc7cf20, 0xc920d0, 0xc9c520, 0xc9c920,
|
||||
0xc9d120, 0xccc5ce, 0xccc920, 0xccd8ce, 0xcec120, 0xcec520, 0xcec9c5,
|
||||
0xcec9d1, 0xcecf20, 0xcecfd7, 0xcf20d0, 0xcf20d3, 0xcf20d7, 0xcfc7cf,
|
||||
0xcfca20, 0xcfccd8, 0xcfcd20, 0xcfd3d4, 0xcfd720, 0xcfd7c1, 0xd0cfcc,
|
||||
0xd0d2c5, 0xd0d2c9, 0xd0d2cf, 0xd2c1d7, 0xd2c5c4, 0xd3d120, 0xd3d4c1,
|
||||
0xd3d4c9, 0xd3d4d7, 0xd4c5cc, 0xd4cf20, 0xd4cfd2, 0xd4d820, 0xd9c820,
|
||||
0xded4cf,
|
||||
];
|
||||
}
|
||||
name() {
|
||||
return 'KOI8-R';
|
||||
}
|
||||
language() {
|
||||
return 'ru';
|
||||
}
|
||||
}
|
||||
exports.KOI8_R = KOI8_R;
|
||||
//# sourceMappingURL=sbcs.js.map
|
1
node_modules/chardet/lib/encoding/sbcs.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/sbcs.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
27
node_modules/chardet/lib/encoding/unicode.d.ts
generated
vendored
Normal file
27
node_modules/chardet/lib/encoding/unicode.d.ts
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import { Context, Recogniser } from '.';
|
||||
import { Match } from '../match';
|
||||
export declare class UTF_16BE implements Recogniser {
|
||||
name(): string;
|
||||
match(det: Context): Match | null;
|
||||
}
|
||||
export declare class UTF_16LE implements Recogniser {
|
||||
name(): string;
|
||||
match(det: Context): Match | null;
|
||||
}
|
||||
interface WithGetChar {
|
||||
getChar(input: Uint8Array, index: number): number;
|
||||
}
|
||||
declare class UTF_32 implements Recogniser, WithGetChar {
|
||||
name(): string;
|
||||
getChar(_input: Uint8Array, _index: number): number;
|
||||
match(det: Context): Match | null;
|
||||
}
|
||||
export declare class UTF_32BE extends UTF_32 {
|
||||
name(): string;
|
||||
getChar(input: Uint8Array, index: number): number;
|
||||
}
|
||||
export declare class UTF_32LE extends UTF_32 {
|
||||
name(): string;
|
||||
getChar(input: Uint8Array, index: number): number;
|
||||
}
|
||||
export {};
|
109
node_modules/chardet/lib/encoding/unicode.js
generated
vendored
Normal file
109
node_modules/chardet/lib/encoding/unicode.js
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.UTF_32LE = exports.UTF_32BE = exports.UTF_16LE = exports.UTF_16BE = void 0;
|
||||
const match_1 = __importDefault(require("../match"));
|
||||
class UTF_16BE {
|
||||
name() {
|
||||
return 'UTF-16BE';
|
||||
}
|
||||
match(det) {
|
||||
const input = det.rawInput;
|
||||
if (input.length >= 2 &&
|
||||
(input[0] & 0xff) == 0xfe &&
|
||||
(input[1] & 0xff) == 0xff) {
|
||||
return (0, match_1.default)(det, this, 100);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.UTF_16BE = UTF_16BE;
|
||||
class UTF_16LE {
|
||||
name() {
|
||||
return 'UTF-16LE';
|
||||
}
|
||||
match(det) {
|
||||
const input = det.rawInput;
|
||||
if (input.length >= 2 &&
|
||||
(input[0] & 0xff) == 0xff &&
|
||||
(input[1] & 0xff) == 0xfe) {
|
||||
if (input.length >= 4 && input[2] == 0x00 && input[3] == 0x00) {
|
||||
return null;
|
||||
}
|
||||
return (0, match_1.default)(det, this, 100);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
exports.UTF_16LE = UTF_16LE;
|
||||
class UTF_32 {
|
||||
name() {
|
||||
return 'UTF-32';
|
||||
}
|
||||
getChar(_input, _index) {
|
||||
return -1;
|
||||
}
|
||||
match(det) {
|
||||
let numValid = 0, numInvalid = 0, hasBOM = false, confidence = 0;
|
||||
const limit = (det.rawLen / 4) * 4;
|
||||
const input = det.rawInput;
|
||||
if (limit == 0) {
|
||||
return null;
|
||||
}
|
||||
if (this.getChar(input, 0) == 0x0000feff) {
|
||||
hasBOM = true;
|
||||
}
|
||||
for (let i = 0; i < limit; i += 4) {
|
||||
const ch = this.getChar(input, i);
|
||||
if (ch < 0 || ch >= 0x10ffff || (ch >= 0xd800 && ch <= 0xdfff)) {
|
||||
numInvalid += 1;
|
||||
}
|
||||
else {
|
||||
numValid += 1;
|
||||
}
|
||||
}
|
||||
if (hasBOM && numInvalid == 0) {
|
||||
confidence = 100;
|
||||
}
|
||||
else if (hasBOM && numValid > numInvalid * 10) {
|
||||
confidence = 80;
|
||||
}
|
||||
else if (numValid > 3 && numInvalid == 0) {
|
||||
confidence = 100;
|
||||
}
|
||||
else if (numValid > 0 && numInvalid == 0) {
|
||||
confidence = 80;
|
||||
}
|
||||
else if (numValid > numInvalid * 10) {
|
||||
confidence = 25;
|
||||
}
|
||||
return confidence == 0 ? null : (0, match_1.default)(det, this, confidence);
|
||||
}
|
||||
}
|
||||
class UTF_32BE extends UTF_32 {
|
||||
name() {
|
||||
return 'UTF-32BE';
|
||||
}
|
||||
getChar(input, index) {
|
||||
return (((input[index + 0] & 0xff) << 24) |
|
||||
((input[index + 1] & 0xff) << 16) |
|
||||
((input[index + 2] & 0xff) << 8) |
|
||||
(input[index + 3] & 0xff));
|
||||
}
|
||||
}
|
||||
exports.UTF_32BE = UTF_32BE;
|
||||
class UTF_32LE extends UTF_32 {
|
||||
name() {
|
||||
return 'UTF-32LE';
|
||||
}
|
||||
getChar(input, index) {
|
||||
return (((input[index + 3] & 0xff) << 24) |
|
||||
((input[index + 2] & 0xff) << 16) |
|
||||
((input[index + 1] & 0xff) << 8) |
|
||||
(input[index + 0] & 0xff));
|
||||
}
|
||||
}
|
||||
exports.UTF_32LE = UTF_32LE;
|
||||
//# sourceMappingURL=unicode.js.map
|
1
node_modules/chardet/lib/encoding/unicode.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/unicode.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"unicode.js","sourceRoot":"","sources":["../../src/encoding/unicode.ts"],"names":[],"mappings":";;;;;;AACA,qDAAwC;AAMxC,MAAa,QAAQ;IACnB,IAAI;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE3B,IACE,KAAK,CAAC,MAAM,IAAI,CAAC;YACjB,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI;YACzB,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EACzB;YACA,OAAO,IAAA,eAAK,EAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;SAC9B;QAGD,OAAO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,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACjC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAC1B,CAAC;IACJ,CAAC;CACF;AAZD,4BAYC;AAED,MAAa,QAAS,SAAQ,MAAM;IAClC,IAAI;QACF,OAAO,UAAU,CAAC;IACpB,CAAC;IAED,OAAO,CAAC,KAAiB,EAAE,KAAa;QACtC,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACjC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACjC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YAChC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAC1B,CAAC;IACJ,CAAC;CACF;AAbD,4BAaC"}
|
6
node_modules/chardet/lib/encoding/utf8.d.ts
generated
vendored
Normal file
6
node_modules/chardet/lib/encoding/utf8.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Context, Recogniser } from '.';
|
||||
import { Match } from '../match';
|
||||
export default class Utf8 implements Recogniser {
|
||||
name(): string;
|
||||
match(det: Context): Match | null;
|
||||
}
|
72
node_modules/chardet/lib/encoding/utf8.js
generated
vendored
Normal file
72
node_modules/chardet/lib/encoding/utf8.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const match_1 = __importDefault(require("../match"));
|
||||
class Utf8 {
|
||||
name() {
|
||||
return 'UTF-8';
|
||||
}
|
||||
match(det) {
|
||||
let hasBOM = false, numValid = 0, numInvalid = 0, trailBytes = 0, confidence;
|
||||
const input = det.rawInput;
|
||||
if (det.rawLen >= 3 &&
|
||||
(input[0] & 0xff) == 0xef &&
|
||||
(input[1] & 0xff) == 0xbb &&
|
||||
(input[2] & 0xff) == 0xbf) {
|
||||
hasBOM = true;
|
||||
}
|
||||
for (let i = 0; i < det.rawLen; i++) {
|
||||
const b = input[i];
|
||||
if ((b & 0x80) == 0)
|
||||
continue;
|
||||
if ((b & 0x0e0) == 0x0c0) {
|
||||
trailBytes = 1;
|
||||
}
|
||||
else if ((b & 0x0f0) == 0x0e0) {
|
||||
trailBytes = 2;
|
||||
}
|
||||
else if ((b & 0x0f8) == 0xf0) {
|
||||
trailBytes = 3;
|
||||
}
|
||||
else {
|
||||
numInvalid++;
|
||||
if (numInvalid > 5)
|
||||
break;
|
||||
trailBytes = 0;
|
||||
}
|
||||
for (;;) {
|
||||
i++;
|
||||
if (i >= det.rawLen)
|
||||
break;
|
||||
if ((input[i] & 0xc0) != 0x080) {
|
||||
numInvalid++;
|
||||
break;
|
||||
}
|
||||
if (--trailBytes == 0) {
|
||||
numValid++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
confidence = 0;
|
||||
if (hasBOM && numInvalid == 0)
|
||||
confidence = 100;
|
||||
else if (hasBOM && numValid > numInvalid * 10)
|
||||
confidence = 80;
|
||||
else if (numValid > 3 && numInvalid == 0)
|
||||
confidence = 100;
|
||||
else if (numValid > 0 && numInvalid == 0)
|
||||
confidence = 80;
|
||||
else if (numValid == 0 && numInvalid == 0)
|
||||
confidence = 10;
|
||||
else if (numValid > numInvalid * 10)
|
||||
confidence = 25;
|
||||
else
|
||||
return null;
|
||||
return (0, match_1.default)(det, this, confidence);
|
||||
}
|
||||
}
|
||||
exports.default = Utf8;
|
||||
//# sourceMappingURL=utf8.js.map
|
1
node_modules/chardet/lib/encoding/utf8.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/encoding/utf8.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../../src/encoding/utf8.ts"],"names":[],"mappings":";;;;;AACA,qDAAwC;AAExC,MAAqB,IAAI;IACvB,IAAI;QACF,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,KAAK,CAAC,GAAY;QAChB,IAAI,MAAM,GAAG,KAAK,EAChB,QAAQ,GAAG,CAAC,EACZ,UAAU,GAAG,CAAC,EACd,UAAU,GAAG,CAAC,EACd,UAAU,CAAC;QACb,MAAM,KAAK,GAAG,GAAG,CAAC,QAAQ,CAAC;QAE3B,IACE,GAAG,CAAC,MAAM,IAAI,CAAC;YACf,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI;YACzB,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI;YACzB,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EACzB;YACA,MAAM,GAAG,IAAI,CAAC;SACf;QAGD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACnB,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC;gBAAE,SAAS;YAG9B,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,EAAE;gBACxB,UAAU,GAAG,CAAC,CAAC;aAChB;iBAAM,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,EAAE;gBAC/B,UAAU,GAAG,CAAC,CAAC;aAChB;iBAAM,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,I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 +1,2 @@
|
||||
declare const _default: () => never;
|
||||
export default _default;
|
6
node_modules/chardet/lib/fs/browser.js
generated
vendored
Normal file
6
node_modules/chardet/lib/fs/browser.js
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = () => {
|
||||
throw new Error('File system is not available');
|
||||
};
|
||||
//# sourceMappingURL=browser.js.map
|
1
node_modules/chardet/lib/fs/browser.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/fs/browser.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/fs/browser.ts"],"names":[],"mappings":";;AAAA,kBAAe,GAAG,EAAE;IAClB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
2
node_modules/chardet/lib/fs/node.d.ts
generated
vendored
Normal file
2
node_modules/chardet/lib/fs/node.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
declare const _default: () => any;
|
||||
export default _default;
|
11
node_modules/chardet/lib/fs/node.js
generated
vendored
Normal file
11
node_modules/chardet/lib/fs/node.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
let fsModule;
|
||||
exports.default = () => {
|
||||
if (typeof module === 'object' && typeof module.exports === 'object') {
|
||||
fsModule = fsModule ? fsModule : require('fs');
|
||||
return fsModule;
|
||||
}
|
||||
throw new Error('File system is not available');
|
||||
};
|
||||
//# sourceMappingURL=node.js.map
|
1
node_modules/chardet/lib/fs/node.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/fs/node.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/fs/node.ts"],"names":[],"mappings":";;AAAA,IAAI,QAAa,CAAC;AAElB,kBAAe,GAAG,EAAE;IAClB,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE;QACpE,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;KACjB;IACD,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;AAClD,CAAC,CAAC"}
|
19
node_modules/chardet/lib/index.d.ts
generated
vendored
Normal file
19
node_modules/chardet/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Match } from './match';
|
||||
interface FullOptions {
|
||||
sampleSize: number;
|
||||
offset: number;
|
||||
}
|
||||
export type Options = Partial<FullOptions>;
|
||||
export type AnalyseResult = Match[];
|
||||
export type DetectResult = string | null;
|
||||
export declare const detect: (buffer: Uint8Array) => string | null;
|
||||
export declare const analyse: (buffer: Uint8Array) => AnalyseResult;
|
||||
export declare const detectFile: (filepath: string, opts?: Options) => Promise<DetectResult>;
|
||||
export declare const detectFileSync: (filepath: string, opts?: Options) => DetectResult;
|
||||
declare const _default: {
|
||||
analyse: (buffer: Uint8Array) => AnalyseResult;
|
||||
detect: (buffer: Uint8Array) => string | null;
|
||||
detectFileSync: (filepath: string, opts?: Partial<FullOptions>) => DetectResult;
|
||||
detectFile: (filepath: string, opts?: Partial<FullOptions>) => Promise<DetectResult>;
|
||||
};
|
||||
export default _default;
|
149
node_modules/chardet/lib/index.js
generated
vendored
Normal file
149
node_modules/chardet/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.detectFileSync = exports.detectFile = exports.analyse = exports.detect = void 0;
|
||||
const node_1 = __importDefault(require("./fs/node"));
|
||||
const ascii_1 = __importDefault(require("./encoding/ascii"));
|
||||
const utf8_1 = __importDefault(require("./encoding/utf8"));
|
||||
const unicode = __importStar(require("./encoding/unicode"));
|
||||
const mbcs = __importStar(require("./encoding/mbcs"));
|
||||
const sbcs = __importStar(require("./encoding/sbcs"));
|
||||
const iso2022 = __importStar(require("./encoding/iso2022"));
|
||||
const utils_1 = require("./utils");
|
||||
const recognisers = [
|
||||
new utf8_1.default(),
|
||||
new unicode.UTF_16BE(),
|
||||
new unicode.UTF_16LE(),
|
||||
new unicode.UTF_32BE(),
|
||||
new unicode.UTF_32LE(),
|
||||
new mbcs.sjis(),
|
||||
new mbcs.big5(),
|
||||
new mbcs.euc_jp(),
|
||||
new mbcs.euc_kr(),
|
||||
new mbcs.gb_18030(),
|
||||
new iso2022.ISO_2022_JP(),
|
||||
new iso2022.ISO_2022_KR(),
|
||||
new iso2022.ISO_2022_CN(),
|
||||
new sbcs.ISO_8859_1(),
|
||||
new sbcs.ISO_8859_2(),
|
||||
new sbcs.ISO_8859_5(),
|
||||
new sbcs.ISO_8859_6(),
|
||||
new sbcs.ISO_8859_7(),
|
||||
new sbcs.ISO_8859_8(),
|
||||
new sbcs.ISO_8859_9(),
|
||||
new sbcs.windows_1251(),
|
||||
new sbcs.windows_1256(),
|
||||
new sbcs.KOI8_R(),
|
||||
new ascii_1.default(),
|
||||
];
|
||||
const detect = (buffer) => {
|
||||
const matches = (0, exports.analyse)(buffer);
|
||||
return matches.length > 0 ? matches[0].name : null;
|
||||
};
|
||||
exports.detect = detect;
|
||||
const analyse = (buffer) => {
|
||||
if (!(0, utils_1.isByteArray)(buffer)) {
|
||||
throw new Error('Input must be a byte array, e.g. Buffer or Uint8Array');
|
||||
}
|
||||
const byteStats = [];
|
||||
for (let i = 0; i < 256; i++)
|
||||
byteStats[i] = 0;
|
||||
for (let i = buffer.length - 1; i >= 0; i--)
|
||||
byteStats[buffer[i] & 0x00ff]++;
|
||||
let c1Bytes = false;
|
||||
for (let i = 0x80; i <= 0x9f; i += 1) {
|
||||
if (byteStats[i] !== 0) {
|
||||
c1Bytes = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const context = {
|
||||
byteStats,
|
||||
c1Bytes,
|
||||
rawInput: buffer,
|
||||
rawLen: buffer.length,
|
||||
inputBytes: buffer,
|
||||
inputLen: buffer.length,
|
||||
};
|
||||
const matches = recognisers
|
||||
.map((rec) => {
|
||||
return rec.match(context);
|
||||
})
|
||||
.filter((match) => {
|
||||
return !!match;
|
||||
})
|
||||
.sort((a, b) => {
|
||||
return b.confidence - a.confidence;
|
||||
});
|
||||
return matches;
|
||||
};
|
||||
exports.analyse = analyse;
|
||||
const detectFile = (filepath, opts = {}) => new Promise((resolve, reject) => {
|
||||
let fd;
|
||||
const fs = (0, node_1.default)();
|
||||
const handler = (err, buffer) => {
|
||||
if (fd) {
|
||||
fs.closeSync(fd);
|
||||
}
|
||||
if (err) {
|
||||
reject(err);
|
||||
}
|
||||
else {
|
||||
resolve((0, exports.detect)(buffer));
|
||||
}
|
||||
};
|
||||
if (opts && opts.sampleSize) {
|
||||
fd = fs.openSync(filepath, 'r');
|
||||
const sample = Buffer.allocUnsafe(opts.sampleSize);
|
||||
fs.read(fd, sample, 0, opts.sampleSize, opts.offset, (err) => {
|
||||
handler(err, sample);
|
||||
});
|
||||
return;
|
||||
}
|
||||
fs.readFile(filepath, handler);
|
||||
});
|
||||
exports.detectFile = detectFile;
|
||||
const detectFileSync = (filepath, opts = {}) => {
|
||||
const fs = (0, node_1.default)();
|
||||
if (opts && opts.sampleSize) {
|
||||
const fd = fs.openSync(filepath, 'r');
|
||||
const sample = Buffer.allocUnsafe(opts.sampleSize);
|
||||
fs.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
|
||||
fs.closeSync(fd);
|
||||
return (0, exports.detect)(sample);
|
||||
}
|
||||
return (0, exports.detect)(fs.readFileSync(filepath));
|
||||
};
|
||||
exports.detectFileSync = detectFileSync;
|
||||
exports.default = {
|
||||
analyse: exports.analyse,
|
||||
detect: exports.detect,
|
||||
detectFileSync: exports.detectFileSync,
|
||||
detectFile: exports.detectFile,
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/chardet/lib/index.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,qDAA+B;AAE/B,6DAAqC;AACrC,2DAAmC;AACnC,4DAA8C;AAC9C,sDAAwC;AACxC,sDAAwC;AACxC,4DAA8C;AAC9C,mCAAsC;AAStC,MAAM,WAAW,GAAiB;IAChC,IAAI,cAAI,EAAE;IACV,IAAI,OAAO,CAAC,QAAQ,EAAE;IACtB,IAAI,OAAO,CAAC,QAAQ,EAAE;IACtB,IAAI,OAAO,CAAC,QA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AAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEnD,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACzD,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QACjB,OAAO,IAAA,cAAM,EAAC,MAAM,CAAC,CAAC;KACvB;IAED,OAAO,IAAA,cAAM,EAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC3C,CAAC,CAAC;AAhBW,QAAA,cAAc,kBAgBzB;AAEF,kBAAe;IACb,OAAO,EAAP,eAAO;IACP,MAAM,EAAN,cAAM;IACN,cAAc,EAAd,sBAAc;IACd,UAAU,EAAV,kBAAU;CACX,CAAC"}
|
8
node_modules/chardet/lib/match.d.ts
generated
vendored
Normal file
8
node_modules/chardet/lib/match.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Context, Recogniser } from "./encoding";
|
||||
export interface Match {
|
||||
confidence: number;
|
||||
name: string;
|
||||
lang?: string;
|
||||
}
|
||||
declare const _default: (ctx: Context, rec: Recogniser, confidence: number) => Match;
|
||||
export default _default;
|
8
node_modules/chardet/lib/match.js
generated
vendored
Normal file
8
node_modules/chardet/lib/match.js
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = (ctx, rec, confidence) => ({
|
||||
confidence,
|
||||
name: rec.name(ctx),
|
||||
lang: rec.language ? rec.language() : undefined,
|
||||
});
|
||||
//# sourceMappingURL=match.js.map
|
1
node_modules/chardet/lib/match.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/match.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"match.js","sourceRoot":"","sources":["../src/match.ts"],"names":[],"mappings":";;AAQA,kBAAe,CAAC,GAAY,EAAE,GAAe,EAAE,UAAkB,EAAS,EAAE,CAAC,CAAC;IAC5E,UAAU;IACV,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;IACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,SAAS;CAChD,CAAC,CAAC"}
|
1
node_modules/chardet/lib/utils.d.ts
generated
vendored
Normal file
1
node_modules/chardet/lib/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export declare const isByteArray: (input: any) => input is Uint8Array;
|
10
node_modules/chardet/lib/utils.js
generated
vendored
Normal file
10
node_modules/chardet/lib/utils.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.isByteArray = void 0;
|
||||
const isByteArray = (input) => {
|
||||
if (input == null || typeof input != 'object')
|
||||
return false;
|
||||
return isFinite(input.length) && input.length >= 0;
|
||||
};
|
||||
exports.isByteArray = isByteArray;
|
||||
//# sourceMappingURL=utils.js.map
|
1
node_modules/chardet/lib/utils.js.map
generated
vendored
Normal file
1
node_modules/chardet/lib/utils.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AAEO,MAAM,WAAW,GAAG,CAAC,KAAU,EAAuB,EAAE;IAC7D,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,IAAI,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5D,OAAO,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;AACrD,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB"}
|
Reference in New Issue
Block a user