mtranserver 4.0.31 → 4.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +80 -59
- package/dist/main.js +111 -90
- package/dist/services/engine.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
function __accessProp(key) {
|
|
8
|
+
return this[key];
|
|
9
|
+
}
|
|
10
|
+
var __toESMCache_node;
|
|
11
|
+
var __toESMCache_esm;
|
|
7
12
|
var __toESM = (mod, isNodeMode, target) => {
|
|
13
|
+
var canCache = mod != null && typeof mod === "object";
|
|
14
|
+
if (canCache) {
|
|
15
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
16
|
+
var cached = cache.get(mod);
|
|
17
|
+
if (cached)
|
|
18
|
+
return cached;
|
|
19
|
+
}
|
|
8
20
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
9
21
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
10
22
|
for (let key of __getOwnPropNames(mod))
|
|
11
23
|
if (!__hasOwnProp.call(to, key))
|
|
12
24
|
__defProp(to, key, {
|
|
13
|
-
get: (
|
|
25
|
+
get: __accessProp.bind(mod, key),
|
|
14
26
|
enumerable: true
|
|
15
27
|
});
|
|
28
|
+
if (canCache)
|
|
29
|
+
cache.set(mod, to);
|
|
16
30
|
return to;
|
|
17
31
|
};
|
|
18
32
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
33
|
+
var __returnValue = (v) => v;
|
|
34
|
+
function __exportSetter(name, newValue) {
|
|
35
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
36
|
+
}
|
|
19
37
|
var __export = (target, all) => {
|
|
20
38
|
for (var name in all)
|
|
21
39
|
__defProp(target, name, {
|
|
22
40
|
get: all[name],
|
|
23
41
|
enumerable: true,
|
|
24
42
|
configurable: true,
|
|
25
|
-
set: (
|
|
43
|
+
set: __exportSetter.bind(all, name)
|
|
26
44
|
});
|
|
27
45
|
};
|
|
28
46
|
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
@@ -825,7 +843,7 @@ class TranslationEngine {
|
|
|
825
843
|
const effectiveOptions = forceHtml ? { ...options, html: true } : options;
|
|
826
844
|
let translation;
|
|
827
845
|
try {
|
|
828
|
-
if (cleanText.length > this.maxSentenceLength) {
|
|
846
|
+
if (cleanText.length > this.maxSentenceLength && !effectiveOptions.html) {
|
|
829
847
|
translation = this._translateLongText(cleanText, effectiveOptions);
|
|
830
848
|
} else {
|
|
831
849
|
translation = this._translateInternal(cleanText, effectiveOptions);
|
|
@@ -5557,10 +5575,10 @@ function formatChinesePunctuation(text, toLang, isHTML, enabled) {
|
|
|
5557
5575
|
if (!enabled || isHTML || !toLang.startsWith("zh")) {
|
|
5558
5576
|
return text;
|
|
5559
5577
|
}
|
|
5560
|
-
if (!
|
|
5578
|
+
if (!zhCommaTest.test(text)) {
|
|
5561
5579
|
return text;
|
|
5562
5580
|
}
|
|
5563
|
-
return text.replace(
|
|
5581
|
+
return text.replace(zhCommaGlobal, ",");
|
|
5564
5582
|
}
|
|
5565
5583
|
function needsPivotTranslation(fromLang, toLang) {
|
|
5566
5584
|
if (fromLang === "en" || toLang === "en") {
|
|
@@ -5696,63 +5714,66 @@ async function translateSegment(fromLang, toLang, text, isHTML) {
|
|
|
5696
5714
|
}
|
|
5697
5715
|
async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
5698
5716
|
debug(`TranslateWithPivot: ${fromLang} -> ${toLang}, text length: ${text.length}, isHTML: ${isHTML}`);
|
|
5699
|
-
|
|
5700
|
-
|
|
5717
|
+
let config2 = null;
|
|
5718
|
+
let result = text;
|
|
5701
5719
|
if (fromLang !== "auto" && fromLang === toLang) {
|
|
5702
|
-
|
|
5703
|
-
}
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
}
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
effectiveFromLang
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
}
|
|
5729
|
-
const translated = await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5730
|
-
return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
|
|
5731
|
-
}
|
|
5732
|
-
debug(`Detected ${segments.length} language segments`);
|
|
5733
|
-
let result = "";
|
|
5734
|
-
let lastEnd = 0;
|
|
5735
|
-
for (const seg of segments) {
|
|
5736
|
-
if (seg.start > lastEnd) {
|
|
5737
|
-
result += text.substring(lastEnd, seg.start);
|
|
5738
|
-
}
|
|
5739
|
-
if (seg.language === toLang) {
|
|
5740
|
-
result += seg.text;
|
|
5720
|
+
result = text;
|
|
5721
|
+
} else if (fromLang !== "auto" && text.length <= 512) {
|
|
5722
|
+
result = await translateSegment(fromLang, toLang, text, isHTML);
|
|
5723
|
+
} else {
|
|
5724
|
+
const segments = await detectMultipleLanguages(text);
|
|
5725
|
+
if (segments.length <= 1) {
|
|
5726
|
+
let effectiveFromLang;
|
|
5727
|
+
if (segments.length === 1) {
|
|
5728
|
+
effectiveFromLang = segments[0].language;
|
|
5729
|
+
} else if (fromLang === "auto") {
|
|
5730
|
+
const detected = await detectLanguage(text);
|
|
5731
|
+
if (!detected) {
|
|
5732
|
+
throw new Error("Failed to detect source language");
|
|
5733
|
+
}
|
|
5734
|
+
effectiveFromLang = detected;
|
|
5735
|
+
} else {
|
|
5736
|
+
effectiveFromLang = fromLang;
|
|
5737
|
+
}
|
|
5738
|
+
if (effectiveFromLang === toLang) {
|
|
5739
|
+
result = text;
|
|
5740
|
+
} else if (!isHTML) {
|
|
5741
|
+
config2 = config2 ?? getConfig();
|
|
5742
|
+
result = text.length > config2.maxSentenceLength ? await translateLongText(effectiveFromLang, toLang, text) : await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5743
|
+
} else {
|
|
5744
|
+
result = await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5745
|
+
}
|
|
5741
5746
|
} else {
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5747
|
+
debug(`Detected ${segments.length} language segments`);
|
|
5748
|
+
result = "";
|
|
5749
|
+
let lastEnd = 0;
|
|
5750
|
+
for (const seg of segments) {
|
|
5751
|
+
if (seg.start > lastEnd) {
|
|
5752
|
+
result += text.substring(lastEnd, seg.start);
|
|
5753
|
+
}
|
|
5754
|
+
if (seg.language === toLang) {
|
|
5755
|
+
result += seg.text;
|
|
5756
|
+
} else {
|
|
5757
|
+
try {
|
|
5758
|
+
const translated = await translateSegment(seg.language, toLang, seg.text, isHTML);
|
|
5759
|
+
result += translated;
|
|
5760
|
+
} catch (error2) {
|
|
5761
|
+
error(`Failed to translate segment: ${error2}`);
|
|
5762
|
+
result += seg.text;
|
|
5763
|
+
}
|
|
5764
|
+
}
|
|
5765
|
+
lastEnd = seg.end;
|
|
5766
|
+
}
|
|
5767
|
+
if (lastEnd < text.length) {
|
|
5768
|
+
result += text.substring(lastEnd);
|
|
5748
5769
|
}
|
|
5749
5770
|
}
|
|
5750
|
-
lastEnd = seg.end;
|
|
5751
5771
|
}
|
|
5752
|
-
if (
|
|
5753
|
-
result
|
|
5772
|
+
if (!toLang.startsWith("zh")) {
|
|
5773
|
+
return result;
|
|
5754
5774
|
}
|
|
5755
|
-
|
|
5775
|
+
config2 = config2 ?? getConfig();
|
|
5776
|
+
return formatChinesePunctuation(result, toLang, isHTML, config2.fullwidthZhPunctuation);
|
|
5756
5777
|
}
|
|
5757
5778
|
async function translateLongText(fromLang, toLang, text) {
|
|
5758
5779
|
debug(`Splitting long text (${text.length} chars) into sentences`);
|
|
@@ -5787,7 +5808,7 @@ function cleanupAllEngines() {
|
|
|
5787
5808
|
engines.clear();
|
|
5788
5809
|
info("All engines cleaned up successfully");
|
|
5789
5810
|
}
|
|
5790
|
-
var import_bergamot_translator, engines, loadingPromises,
|
|
5811
|
+
var import_bergamot_translator, engines, loadingPromises, zhCommaTest, zhCommaGlobal;
|
|
5791
5812
|
var init_engine2 = __esm(() => {
|
|
5792
5813
|
init_engine();
|
|
5793
5814
|
init_factory();
|
|
@@ -5800,8 +5821,8 @@ var init_engine2 = __esm(() => {
|
|
|
5800
5821
|
import_bergamot_translator = __toESM(require_bergamot_translator(), 1);
|
|
5801
5822
|
engines = new Map;
|
|
5802
5823
|
loadingPromises = new Map;
|
|
5803
|
-
|
|
5804
|
-
|
|
5824
|
+
zhCommaTest = /,/;
|
|
5825
|
+
zhCommaGlobal = /,/g;
|
|
5805
5826
|
});
|
|
5806
5827
|
|
|
5807
5828
|
// src/services/index.ts
|
package/dist/main.js
CHANGED
|
@@ -5,25 +5,43 @@ var __getProtoOf = Object.getPrototypeOf;
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
function __accessProp(key) {
|
|
9
|
+
return this[key];
|
|
10
|
+
}
|
|
11
|
+
var __toESMCache_node;
|
|
12
|
+
var __toESMCache_esm;
|
|
8
13
|
var __toESM = (mod, isNodeMode, target) => {
|
|
14
|
+
var canCache = mod != null && typeof mod === "object";
|
|
15
|
+
if (canCache) {
|
|
16
|
+
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
17
|
+
var cached = cache.get(mod);
|
|
18
|
+
if (cached)
|
|
19
|
+
return cached;
|
|
20
|
+
}
|
|
9
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
10
22
|
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
11
23
|
for (let key of __getOwnPropNames(mod))
|
|
12
24
|
if (!__hasOwnProp.call(to, key))
|
|
13
25
|
__defProp(to, key, {
|
|
14
|
-
get: (
|
|
26
|
+
get: __accessProp.bind(mod, key),
|
|
15
27
|
enumerable: true
|
|
16
28
|
});
|
|
29
|
+
if (canCache)
|
|
30
|
+
cache.set(mod, to);
|
|
17
31
|
return to;
|
|
18
32
|
};
|
|
19
33
|
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
+
var __returnValue = (v) => v;
|
|
35
|
+
function __exportSetter(name, newValue) {
|
|
36
|
+
this[name] = __returnValue.bind(null, newValue);
|
|
37
|
+
}
|
|
20
38
|
var __export = (target, all) => {
|
|
21
39
|
for (var name in all)
|
|
22
40
|
__defProp(target, name, {
|
|
23
41
|
get: all[name],
|
|
24
42
|
enumerable: true,
|
|
25
43
|
configurable: true,
|
|
26
|
-
set: (
|
|
44
|
+
set: __exportSetter.bind(all, name)
|
|
27
45
|
});
|
|
28
46
|
};
|
|
29
47
|
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
@@ -826,7 +844,7 @@ class TranslationEngine {
|
|
|
826
844
|
const effectiveOptions = forceHtml ? { ...options, html: true } : options;
|
|
827
845
|
let translation;
|
|
828
846
|
try {
|
|
829
|
-
if (cleanText.length > this.maxSentenceLength) {
|
|
847
|
+
if (cleanText.length > this.maxSentenceLength && !effectiveOptions.html) {
|
|
830
848
|
translation = this._translateLongText(cleanText, effectiveOptions);
|
|
831
849
|
} else {
|
|
832
850
|
translation = this._translateInternal(cleanText, effectiveOptions);
|
|
@@ -5558,10 +5576,10 @@ function formatChinesePunctuation(text, toLang, isHTML, enabled) {
|
|
|
5558
5576
|
if (!enabled || isHTML || !toLang.startsWith("zh")) {
|
|
5559
5577
|
return text;
|
|
5560
5578
|
}
|
|
5561
|
-
if (!
|
|
5579
|
+
if (!zhCommaTest.test(text)) {
|
|
5562
5580
|
return text;
|
|
5563
5581
|
}
|
|
5564
|
-
return text.replace(
|
|
5582
|
+
return text.replace(zhCommaGlobal, ",");
|
|
5565
5583
|
}
|
|
5566
5584
|
function needsPivotTranslation(fromLang, toLang) {
|
|
5567
5585
|
if (fromLang === "en" || toLang === "en") {
|
|
@@ -5697,63 +5715,66 @@ async function translateSegment(fromLang, toLang, text, isHTML) {
|
|
|
5697
5715
|
}
|
|
5698
5716
|
async function translateWithPivot(fromLang, toLang, text, isHTML = false) {
|
|
5699
5717
|
debug(`TranslateWithPivot: ${fromLang} -> ${toLang}, text length: ${text.length}, isHTML: ${isHTML}`);
|
|
5700
|
-
|
|
5701
|
-
|
|
5718
|
+
let config2 = null;
|
|
5719
|
+
let result = text;
|
|
5702
5720
|
if (fromLang !== "auto" && fromLang === toLang) {
|
|
5703
|
-
|
|
5704
|
-
}
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
}
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
effectiveFromLang
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
}
|
|
5730
|
-
const translated = await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5731
|
-
return formatChinesePunctuation(translated, toLang, isHTML, shouldFullwidth);
|
|
5732
|
-
}
|
|
5733
|
-
debug(`Detected ${segments.length} language segments`);
|
|
5734
|
-
let result = "";
|
|
5735
|
-
let lastEnd = 0;
|
|
5736
|
-
for (const seg of segments) {
|
|
5737
|
-
if (seg.start > lastEnd) {
|
|
5738
|
-
result += text.substring(lastEnd, seg.start);
|
|
5739
|
-
}
|
|
5740
|
-
if (seg.language === toLang) {
|
|
5741
|
-
result += seg.text;
|
|
5721
|
+
result = text;
|
|
5722
|
+
} else if (fromLang !== "auto" && text.length <= 512) {
|
|
5723
|
+
result = await translateSegment(fromLang, toLang, text, isHTML);
|
|
5724
|
+
} else {
|
|
5725
|
+
const segments = await detectMultipleLanguages(text);
|
|
5726
|
+
if (segments.length <= 1) {
|
|
5727
|
+
let effectiveFromLang;
|
|
5728
|
+
if (segments.length === 1) {
|
|
5729
|
+
effectiveFromLang = segments[0].language;
|
|
5730
|
+
} else if (fromLang === "auto") {
|
|
5731
|
+
const detected = await detectLanguage(text);
|
|
5732
|
+
if (!detected) {
|
|
5733
|
+
throw new Error("Failed to detect source language");
|
|
5734
|
+
}
|
|
5735
|
+
effectiveFromLang = detected;
|
|
5736
|
+
} else {
|
|
5737
|
+
effectiveFromLang = fromLang;
|
|
5738
|
+
}
|
|
5739
|
+
if (effectiveFromLang === toLang) {
|
|
5740
|
+
result = text;
|
|
5741
|
+
} else if (!isHTML) {
|
|
5742
|
+
config2 = config2 ?? getConfig();
|
|
5743
|
+
result = text.length > config2.maxSentenceLength ? await translateLongText(effectiveFromLang, toLang, text) : await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5744
|
+
} else {
|
|
5745
|
+
result = await translateSegment(effectiveFromLang, toLang, text, isHTML);
|
|
5746
|
+
}
|
|
5742
5747
|
} else {
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5748
|
+
debug(`Detected ${segments.length} language segments`);
|
|
5749
|
+
result = "";
|
|
5750
|
+
let lastEnd = 0;
|
|
5751
|
+
for (const seg of segments) {
|
|
5752
|
+
if (seg.start > lastEnd) {
|
|
5753
|
+
result += text.substring(lastEnd, seg.start);
|
|
5754
|
+
}
|
|
5755
|
+
if (seg.language === toLang) {
|
|
5756
|
+
result += seg.text;
|
|
5757
|
+
} else {
|
|
5758
|
+
try {
|
|
5759
|
+
const translated = await translateSegment(seg.language, toLang, seg.text, isHTML);
|
|
5760
|
+
result += translated;
|
|
5761
|
+
} catch (error2) {
|
|
5762
|
+
error(`Failed to translate segment: ${error2}`);
|
|
5763
|
+
result += seg.text;
|
|
5764
|
+
}
|
|
5765
|
+
}
|
|
5766
|
+
lastEnd = seg.end;
|
|
5767
|
+
}
|
|
5768
|
+
if (lastEnd < text.length) {
|
|
5769
|
+
result += text.substring(lastEnd);
|
|
5749
5770
|
}
|
|
5750
5771
|
}
|
|
5751
|
-
lastEnd = seg.end;
|
|
5752
5772
|
}
|
|
5753
|
-
if (
|
|
5754
|
-
result
|
|
5773
|
+
if (!toLang.startsWith("zh")) {
|
|
5774
|
+
return result;
|
|
5755
5775
|
}
|
|
5756
|
-
|
|
5776
|
+
config2 = config2 ?? getConfig();
|
|
5777
|
+
return formatChinesePunctuation(result, toLang, isHTML, config2.fullwidthZhPunctuation);
|
|
5757
5778
|
}
|
|
5758
5779
|
async function translateLongText(fromLang, toLang, text) {
|
|
5759
5780
|
debug(`Splitting long text (${text.length} chars) into sentences`);
|
|
@@ -5788,7 +5809,7 @@ function cleanupAllEngines() {
|
|
|
5788
5809
|
engines.clear();
|
|
5789
5810
|
info("All engines cleaned up successfully");
|
|
5790
5811
|
}
|
|
5791
|
-
var import_bergamot_translator, engines, loadingPromises,
|
|
5812
|
+
var import_bergamot_translator, engines, loadingPromises, zhCommaTest, zhCommaGlobal;
|
|
5792
5813
|
var init_engine2 = __esm(() => {
|
|
5793
5814
|
init_engine();
|
|
5794
5815
|
init_factory();
|
|
@@ -5801,8 +5822,8 @@ var init_engine2 = __esm(() => {
|
|
|
5801
5822
|
import_bergamot_translator = __toESM(require_bergamot_translator(), 1);
|
|
5802
5823
|
engines = new Map;
|
|
5803
5824
|
loadingPromises = new Map;
|
|
5804
|
-
|
|
5805
|
-
|
|
5825
|
+
zhCommaTest = /,/;
|
|
5826
|
+
zhCommaGlobal = /,/g;
|
|
5806
5827
|
});
|
|
5807
5828
|
|
|
5808
5829
|
// src/services/index.ts
|
|
@@ -7874,7 +7895,7 @@ var require_includesString = __commonJS((exports, module) => {
|
|
|
7874
7895
|
value: true
|
|
7875
7896
|
});
|
|
7876
7897
|
exports.default = undefined;
|
|
7877
|
-
var includes = function
|
|
7898
|
+
var includes = function includes2(str, val) {
|
|
7878
7899
|
return str.indexOf(val) !== -1;
|
|
7879
7900
|
};
|
|
7880
7901
|
var _default = exports.default = includes;
|
|
@@ -7989,7 +8010,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
7989
8010
|
url = split.shift();
|
|
7990
8011
|
var protocol_match = url.match(/^([a-z][a-z0-9+\-.]*):/i);
|
|
7991
8012
|
var had_explicit_protocol = false;
|
|
7992
|
-
var cleanUpProtocol = function
|
|
8013
|
+
var cleanUpProtocol = function cleanUpProtocol2(potential_protocol2) {
|
|
7993
8014
|
had_explicit_protocol = true;
|
|
7994
8015
|
protocol = potential_protocol2.toLowerCase();
|
|
7995
8016
|
if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) {
|
|
@@ -8261,10 +8282,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
8261
8282
|
if (!t) {
|
|
8262
8283
|
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && typeof r.length == "number") {
|
|
8263
8284
|
t && (r = t);
|
|
8264
|
-
var _n = 0, F = function
|
|
8285
|
+
var _n = 0, F = function F2() {};
|
|
8265
8286
|
return { s: F, n: function n() {
|
|
8266
8287
|
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
8267
|
-
}, e: function
|
|
8288
|
+
}, e: function e2(r2) {
|
|
8268
8289
|
throw r2;
|
|
8269
8290
|
}, f: F };
|
|
8270
8291
|
}
|
|
@@ -8277,7 +8298,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
8277
8298
|
}, n: function n() {
|
|
8278
8299
|
var r2 = t.next();
|
|
8279
8300
|
return a = r2.done, r2;
|
|
8280
|
-
}, e: function
|
|
8301
|
+
}, e: function e2(r2) {
|
|
8281
8302
|
u = true, o = r2;
|
|
8282
8303
|
}, f: function f() {
|
|
8283
8304
|
try {
|
|
@@ -8427,7 +8448,7 @@ var require_includesArray = __commonJS((exports, module) => {
|
|
|
8427
8448
|
value: true
|
|
8428
8449
|
});
|
|
8429
8450
|
exports.default = undefined;
|
|
8430
|
-
var includes = function
|
|
8451
|
+
var includes = function includes2(arr, val) {
|
|
8431
8452
|
return arr.some(function(arrVal) {
|
|
8432
8453
|
return val === arrVal;
|
|
8433
8454
|
});
|
|
@@ -10075,10 +10096,10 @@ var require_isIdentityCard = __commonJS((exports, module) => {
|
|
|
10075
10096
|
];
|
|
10076
10097
|
var powers = ["7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7", "9", "10", "5", "8", "4", "2"];
|
|
10077
10098
|
var parityBit = ["1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2"];
|
|
10078
|
-
var checkAddressCode = function
|
|
10099
|
+
var checkAddressCode = function checkAddressCode2(addressCode) {
|
|
10079
10100
|
return (0, _includesArray.default)(provincesAndCities, addressCode);
|
|
10080
10101
|
};
|
|
10081
|
-
var checkBirthDayCode = function
|
|
10102
|
+
var checkBirthDayCode = function checkBirthDayCode2(birDayCode) {
|
|
10082
10103
|
var yyyy = parseInt(birDayCode.substring(0, 4), 10);
|
|
10083
10104
|
var mm = parseInt(birDayCode.substring(4, 6), 10);
|
|
10084
10105
|
var dd = parseInt(birDayCode.substring(6), 10);
|
|
@@ -10090,7 +10111,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
|
|
|
10090
10111
|
}
|
|
10091
10112
|
return false;
|
|
10092
10113
|
};
|
|
10093
|
-
var getParityBit = function
|
|
10114
|
+
var getParityBit = function getParityBit2(idCardNo) {
|
|
10094
10115
|
var id17 = idCardNo.substring(0, 17);
|
|
10095
10116
|
var power = 0;
|
|
10096
10117
|
for (var i = 0;i < 17; i++) {
|
|
@@ -10099,10 +10120,10 @@ var require_isIdentityCard = __commonJS((exports, module) => {
|
|
|
10099
10120
|
var mod = power % 11;
|
|
10100
10121
|
return parityBit[mod];
|
|
10101
10122
|
};
|
|
10102
|
-
var checkParityBit = function
|
|
10123
|
+
var checkParityBit = function checkParityBit2(idCardNo) {
|
|
10103
10124
|
return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase();
|
|
10104
10125
|
};
|
|
10105
|
-
var check15IdCardNo = function
|
|
10126
|
+
var check15IdCardNo = function check15IdCardNo2(idCardNo) {
|
|
10106
10127
|
var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo);
|
|
10107
10128
|
if (!check)
|
|
10108
10129
|
return false;
|
|
@@ -10116,7 +10137,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
|
|
|
10116
10137
|
return false;
|
|
10117
10138
|
return true;
|
|
10118
10139
|
};
|
|
10119
|
-
var check18IdCardNo = function
|
|
10140
|
+
var check18IdCardNo = function check18IdCardNo2(idCardNo) {
|
|
10120
10141
|
var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo);
|
|
10121
10142
|
if (!check)
|
|
10122
10143
|
return false;
|
|
@@ -10130,7 +10151,7 @@ var require_isIdentityCard = __commonJS((exports, module) => {
|
|
|
10130
10151
|
return false;
|
|
10131
10152
|
return checkParityBit(idCardNo);
|
|
10132
10153
|
};
|
|
10133
|
-
var checkIdCardNo = function
|
|
10154
|
+
var checkIdCardNo = function checkIdCardNo2(idCardNo) {
|
|
10134
10155
|
var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo);
|
|
10135
10156
|
if (!check)
|
|
10136
10157
|
return false;
|
|
@@ -10503,7 +10524,7 @@ var require_isTaxID = __commonJS((exports, module) => {
|
|
|
10503
10524
|
function _interopRequireWildcard(e, t) {
|
|
10504
10525
|
if (typeof WeakMap == "function")
|
|
10505
10526
|
var r = new WeakMap, n = new WeakMap;
|
|
10506
|
-
return (_interopRequireWildcard = function
|
|
10527
|
+
return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
|
|
10507
10528
|
if (!t2 && e2 && e2.__esModule)
|
|
10508
10529
|
return e2;
|
|
10509
10530
|
var o, i, f = { __proto__: null, default: e2 };
|
|
@@ -11931,7 +11952,7 @@ var require_isISO8601 = __commonJS((exports, module) => {
|
|
|
11931
11952
|
}
|
|
11932
11953
|
var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
|
11933
11954
|
var iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;
|
|
11934
|
-
var isValidDate = function
|
|
11955
|
+
var isValidDate = function isValidDate2(str) {
|
|
11935
11956
|
var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/);
|
|
11936
11957
|
if (ordinalMatch) {
|
|
11937
11958
|
var oYear = Number(ordinalMatch[1]);
|
|
@@ -12308,10 +12329,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
12308
12329
|
if (!t) {
|
|
12309
12330
|
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && typeof r.length == "number") {
|
|
12310
12331
|
t && (r = t);
|
|
12311
|
-
var _n = 0, F = function
|
|
12332
|
+
var _n = 0, F = function F2() {};
|
|
12312
12333
|
return { s: F, n: function n() {
|
|
12313
12334
|
return _n >= r.length ? { done: true } : { done: false, value: r[_n++] };
|
|
12314
|
-
}, e: function
|
|
12335
|
+
}, e: function e2(r2) {
|
|
12315
12336
|
throw r2;
|
|
12316
12337
|
}, f: F };
|
|
12317
12338
|
}
|
|
@@ -12324,7 +12345,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
12324
12345
|
}, n: function n() {
|
|
12325
12346
|
var r2 = t.next();
|
|
12326
12347
|
return a = r2.done, r2;
|
|
12327
|
-
}, e: function
|
|
12348
|
+
}, e: function e2(r2) {
|
|
12328
12349
|
u = true, o = r2;
|
|
12329
12350
|
}, f: function f() {
|
|
12330
12351
|
try {
|
|
@@ -12991,7 +13012,7 @@ var require_isVAT = __commonJS((exports) => {
|
|
|
12991
13012
|
function _interopRequireWildcard(e, t) {
|
|
12992
13013
|
if (typeof WeakMap == "function")
|
|
12993
13014
|
var r = new WeakMap, n = new WeakMap;
|
|
12994
|
-
return (_interopRequireWildcard = function
|
|
13015
|
+
return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
|
|
12995
13016
|
if (!t2 && e2 && e2.__esModule)
|
|
12996
13017
|
return e2;
|
|
12997
13018
|
var o, i, f = { __proto__: null, default: e2 };
|
|
@@ -13010,7 +13031,7 @@ var require_isVAT = __commonJS((exports) => {
|
|
|
13010
13031
|
function _interopRequireDefault(e) {
|
|
13011
13032
|
return e && e.__esModule ? e : { default: e };
|
|
13012
13033
|
}
|
|
13013
|
-
var AU = function
|
|
13034
|
+
var AU = function AU2(str) {
|
|
13014
13035
|
var match = str.match(/^(AU)?(\d{11})$/);
|
|
13015
13036
|
if (!match) {
|
|
13016
13037
|
return false;
|
|
@@ -13024,8 +13045,8 @@ var require_isVAT = __commonJS((exports) => {
|
|
|
13024
13045
|
}
|
|
13025
13046
|
return total !== 0 && total % 89 === 0;
|
|
13026
13047
|
};
|
|
13027
|
-
var CH = function
|
|
13028
|
-
var hasValidCheckNumber = function
|
|
13048
|
+
var CH = function CH2(str) {
|
|
13049
|
+
var hasValidCheckNumber = function hasValidCheckNumber2(digits) {
|
|
13029
13050
|
var lastDigit = digits.pop();
|
|
13030
13051
|
var weights = [5, 4, 3, 2, 7, 6, 5, 4];
|
|
13031
13052
|
var calculatedCheckNumber = (11 - digits.reduce(function(acc, el, idx) {
|
|
@@ -13037,7 +13058,7 @@ var require_isVAT = __commonJS((exports) => {
|
|
|
13037
13058
|
return +el;
|
|
13038
13059
|
}));
|
|
13039
13060
|
};
|
|
13040
|
-
var PT = function
|
|
13061
|
+
var PT = function PT2(str) {
|
|
13041
13062
|
var match = str.match(/^(PT)?(\d{9})$/);
|
|
13042
13063
|
if (!match) {
|
|
13043
13064
|
return false;
|
|
@@ -13380,7 +13401,7 @@ var require_validator = __commonJS((exports, module) => {
|
|
|
13380
13401
|
function _interopRequireWildcard(e, t) {
|
|
13381
13402
|
if (typeof WeakMap == "function")
|
|
13382
13403
|
var r = new WeakMap, n = new WeakMap;
|
|
13383
|
-
return (_interopRequireWildcard = function
|
|
13404
|
+
return (_interopRequireWildcard = function _interopRequireWildcard2(e2, t2) {
|
|
13384
13405
|
if (!t2 && e2 && e2.__esModule)
|
|
13385
13406
|
return e2;
|
|
13386
13407
|
var o, i, f = { __proto__: null, default: e2 };
|
|
@@ -203010,7 +203031,7 @@ var require_utils = __commonJS((exports) => {
|
|
|
203010
203031
|
}
|
|
203011
203032
|
var toString2 = Object.prototype.toString;
|
|
203012
203033
|
exports.toString = toString2;
|
|
203013
|
-
var isFunction = function
|
|
203034
|
+
var isFunction = function isFunction2(value) {
|
|
203014
203035
|
return typeof value === "function";
|
|
203015
203036
|
};
|
|
203016
203037
|
if (isFunction(/x/)) {
|
|
@@ -203455,7 +203476,7 @@ var require_logger = __commonJS((exports, module) => {
|
|
|
203455
203476
|
}
|
|
203456
203477
|
return level;
|
|
203457
203478
|
},
|
|
203458
|
-
log: function
|
|
203479
|
+
log: function log2(level) {
|
|
203459
203480
|
level = logger.lookupLevel(level);
|
|
203460
203481
|
if (typeof console !== "undefined" && logger.lookupLevel(logger.level) <= level) {
|
|
203461
203482
|
var method = logger.methodMap[level];
|
|
@@ -203664,7 +203685,7 @@ var require_wrapHelper = __commonJS((exports) => {
|
|
|
203664
203685
|
if (typeof helper !== "function") {
|
|
203665
203686
|
return helper;
|
|
203666
203687
|
}
|
|
203667
|
-
var wrapper = function
|
|
203688
|
+
var wrapper = function wrapper2() {
|
|
203668
203689
|
var options = arguments[arguments.length - 1];
|
|
203669
203690
|
arguments[arguments.length - 1] = transformOptionsFn(options);
|
|
203670
203691
|
return helper.apply(this, arguments);
|
|
@@ -205328,7 +205349,7 @@ var require_compiler = __commonJS((exports) => {
|
|
|
205328
205349
|
return true;
|
|
205329
205350
|
},
|
|
205330
205351
|
guid: 0,
|
|
205331
|
-
compile: function
|
|
205352
|
+
compile: function compile2(program, options) {
|
|
205332
205353
|
this.sourceNode = [];
|
|
205333
205354
|
this.opcodes = [];
|
|
205334
205355
|
this.children = [];
|
|
@@ -205742,7 +205763,7 @@ var require_code_gen = __commonJS((exports, module) => {
|
|
|
205742
205763
|
toStringWithSourceMap: function toStringWithSourceMap() {
|
|
205743
205764
|
return { code: this.toString() };
|
|
205744
205765
|
},
|
|
205745
|
-
toString: function
|
|
205766
|
+
toString: function toString2() {
|
|
205746
205767
|
return this.src;
|
|
205747
205768
|
}
|
|
205748
205769
|
};
|
|
@@ -213930,7 +213951,7 @@ __export(exports_version, {
|
|
|
213930
213951
|
function getVersion() {
|
|
213931
213952
|
return VERSION;
|
|
213932
213953
|
}
|
|
213933
|
-
var VERSION = "4.0.
|
|
213954
|
+
var VERSION = "4.0.33";
|
|
213934
213955
|
|
|
213935
213956
|
// src/server/index.ts
|
|
213936
213957
|
init_config();
|
|
@@ -215732,7 +215753,7 @@ var swagger_default = {
|
|
|
215732
215753
|
},
|
|
215733
215754
|
info: {
|
|
215734
215755
|
title: "MTranServer API",
|
|
215735
|
-
version: "4.0.
|
|
215756
|
+
version: "4.0.33",
|
|
215736
215757
|
description: "Translation server API",
|
|
215737
215758
|
license: {
|
|
215738
215759
|
name: "Apache-2.0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/services/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/services/engine.ts"],"names":[],"mappings":"AAiOA,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,OAAe,GACtB,OAAO,CAAC,MAAM,CAAC,CA0EjB;AAkCD,wBAAgB,iBAAiB,SAahC"}
|