mtranserver 4.0.18 → 4.0.20
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/README.md +4 -0
- package/dist/{cld2-8mh0n580.wasm → cld2-22jkf0ae.wasm} +0 -0
- package/dist/icon-2r5te9sp.png +0 -0
- package/dist/index-B5MwS93W-8btbkjwj.css +1 -0
- package/dist/index-CViVzJTS-xrkq8wea.js +53 -0
- package/dist/{index-g3cdpfvc.html → index-wzc7qnpt.html} +2 -2
- package/dist/index.js +659 -489
- package/dist/index.js.map +10 -10
- package/dist/lib/cld2/cld2.d.ts.map +1 -1
- package/dist/main.js +832 -548
- package/dist/main.js.map +25 -23
- package/dist/mtran.d.ts.map +1 -1
- package/dist/services/detector.d.ts +2 -2
- package/dist/services/detector.d.ts.map +1 -1
- package/dist/utils/lang-alias.d.ts +1 -1
- package/package.json +9 -8
- package/dist/icon-tjp1feba.png +0 -0
- package/dist/index-B7vzjIqN-ma6ncj8z.css +0 -1
- package/dist/index-D6lVFqDO-3a1nn40g.js +0 -53
package/dist/index.js
CHANGED
|
@@ -131,7 +131,7 @@ function getConfig() {
|
|
|
131
131
|
logConsole: getBool("--log-console", "MT_LOG_CONSOLE", true),
|
|
132
132
|
logRequests: getBool("--log-requests", "MT_LOG_REQUESTS", false),
|
|
133
133
|
checkUpdate: getBool("--check-update", "MT_CHECK_UPDATE", true),
|
|
134
|
-
cacheSize: getInt("--cache-size", "MT_CACHE_SIZE",
|
|
134
|
+
cacheSize: getInt("--cache-size", "MT_CACHE_SIZE", 1000)
|
|
135
135
|
};
|
|
136
136
|
return globalConfig;
|
|
137
137
|
}
|
|
@@ -1051,7 +1051,7 @@ function getLanguagePairs() {
|
|
|
1051
1051
|
return [];
|
|
1052
1052
|
const pairs = new Set;
|
|
1053
1053
|
for (const record of globalRecords.data) {
|
|
1054
|
-
pairs.add(`${record.sourceLanguage}
|
|
1054
|
+
pairs.add(`${record.sourceLanguage}_${record.targetLanguage}`);
|
|
1055
1055
|
}
|
|
1056
1056
|
return Array.from(pairs);
|
|
1057
1057
|
}
|
|
@@ -1468,10 +1468,10 @@ class TranslationEngine {
|
|
|
1468
1468
|
return chunks;
|
|
1469
1469
|
}
|
|
1470
1470
|
_hideEmojis(text) {
|
|
1471
|
-
const emojiRegex = /(\p{Emoji_Presentation}|\p{Extended_Pictographic})/gu;
|
|
1471
|
+
const emojiRegex = /(\p{RI}\p{RI}|\p{Emoji_Presentation}|\p{Extended_Pictographic})/gu;
|
|
1472
1472
|
const replacements = [];
|
|
1473
1473
|
const cleanText = text.replace(emojiRegex, (match) => {
|
|
1474
|
-
const placeholder =
|
|
1474
|
+
const placeholder = `<e${replacements.length}>`;
|
|
1475
1475
|
replacements.push({ original: match, placeholder });
|
|
1476
1476
|
return placeholder;
|
|
1477
1477
|
});
|
|
@@ -4400,23 +4400,23 @@ var init_bergamot_translator = () => {};
|
|
|
4400
4400
|
|
|
4401
4401
|
// src/lib/cld2/cld2.js
|
|
4402
4402
|
var require_cld2 = __commonJS((exports, module) => {
|
|
4403
|
-
var __dirname = "/
|
|
4403
|
+
var __dirname = "/Volumes/MacData/Users/xxnuo/projects/MTranServer/src/lib/cld2", __filename = "/Volumes/MacData/Users/xxnuo/projects/MTranServer/src/lib/cld2/cld2.js";
|
|
4404
4404
|
var loadCLD2 = (() => {
|
|
4405
4405
|
var _scriptName = globalThis.document?.currentScript?.src;
|
|
4406
4406
|
return async function(moduleArg = {}) {
|
|
4407
4407
|
var moduleRtn;
|
|
4408
|
-
function
|
|
4408
|
+
function ba(a) {
|
|
4409
4409
|
var b = 0;
|
|
4410
4410
|
return function() {
|
|
4411
4411
|
return b < a.length ? { done: false, value: a[b++] } : { done: true };
|
|
4412
4412
|
};
|
|
4413
4413
|
}
|
|
4414
|
-
function
|
|
4414
|
+
function h(a) {
|
|
4415
4415
|
var b = typeof Symbol != "undefined" && Symbol.iterator && a[Symbol.iterator];
|
|
4416
4416
|
if (b)
|
|
4417
4417
|
return b.call(a);
|
|
4418
4418
|
if (typeof a.length == "number")
|
|
4419
|
-
return { next:
|
|
4419
|
+
return { next: ba(a) };
|
|
4420
4420
|
throw Error(String(a) + " is not an iterable or ArrayLike");
|
|
4421
4421
|
}
|
|
4422
4422
|
var l = typeof Object.defineProperties == "function" ? Object.defineProperty : function(a, b, c) {
|
|
@@ -4425,7 +4425,7 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4425
4425
|
a[b] = c.value;
|
|
4426
4426
|
return a;
|
|
4427
4427
|
};
|
|
4428
|
-
function
|
|
4428
|
+
function ca(a) {
|
|
4429
4429
|
a = [typeof globalThis == "object" && globalThis, a, typeof window == "object" && window, typeof self == "object" && self, typeof global == "object" && global];
|
|
4430
4430
|
for (var b = 0;b < a.length; ++b) {
|
|
4431
4431
|
var c = a[b];
|
|
@@ -4434,17 +4434,17 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4434
4434
|
}
|
|
4435
4435
|
throw Error("Cannot find global object");
|
|
4436
4436
|
}
|
|
4437
|
-
var
|
|
4437
|
+
var n = ca(this);
|
|
4438
4438
|
function r(a, b) {
|
|
4439
4439
|
if (b)
|
|
4440
4440
|
a: {
|
|
4441
|
-
var c =
|
|
4441
|
+
var c = n;
|
|
4442
4442
|
a = a.split(".");
|
|
4443
4443
|
for (var d = 0;d < a.length - 1; d++) {
|
|
4444
|
-
var
|
|
4445
|
-
if (!(
|
|
4444
|
+
var e = a[d];
|
|
4445
|
+
if (!(e in c))
|
|
4446
4446
|
break a;
|
|
4447
|
-
c = c[
|
|
4447
|
+
c = c[e];
|
|
4448
4448
|
}
|
|
4449
4449
|
a = a[a.length - 1];
|
|
4450
4450
|
d = c[a];
|
|
@@ -4453,138 +4453,138 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4453
4453
|
}
|
|
4454
4454
|
}
|
|
4455
4455
|
function t() {
|
|
4456
|
-
this.
|
|
4457
|
-
this.
|
|
4458
|
-
this.
|
|
4459
|
-
this.
|
|
4460
|
-
this.
|
|
4461
|
-
this.
|
|
4456
|
+
this.H = false;
|
|
4457
|
+
this.C = null;
|
|
4458
|
+
this.D = undefined;
|
|
4459
|
+
this.A = 1;
|
|
4460
|
+
this.K = this.G = 0;
|
|
4461
|
+
this.F = null;
|
|
4462
4462
|
}
|
|
4463
4463
|
function u(a) {
|
|
4464
|
-
if (a.
|
|
4464
|
+
if (a.H)
|
|
4465
4465
|
throw new TypeError("Generator is already running");
|
|
4466
|
-
a.
|
|
4466
|
+
a.H = true;
|
|
4467
4467
|
}
|
|
4468
|
-
t.prototype.
|
|
4469
|
-
this.
|
|
4468
|
+
t.prototype.I = function(a) {
|
|
4469
|
+
this.D = a;
|
|
4470
4470
|
};
|
|
4471
4471
|
function v(a, b) {
|
|
4472
|
-
a.
|
|
4473
|
-
a.
|
|
4472
|
+
a.F = { S: b, aa: true };
|
|
4473
|
+
a.A = a.G || a.K;
|
|
4474
4474
|
}
|
|
4475
4475
|
t.prototype.return = function(a) {
|
|
4476
|
-
this.
|
|
4477
|
-
this.
|
|
4476
|
+
this.F = { return: a };
|
|
4477
|
+
this.A = this.K;
|
|
4478
4478
|
};
|
|
4479
|
-
function
|
|
4480
|
-
a.
|
|
4479
|
+
function w(a, b, c) {
|
|
4480
|
+
a.A = c;
|
|
4481
4481
|
return { value: b };
|
|
4482
4482
|
}
|
|
4483
4483
|
function y(a) {
|
|
4484
|
-
a.
|
|
4485
|
-
var b = a.
|
|
4486
|
-
a.
|
|
4484
|
+
a.G = 0;
|
|
4485
|
+
var b = a.F.S;
|
|
4486
|
+
a.F = null;
|
|
4487
4487
|
return b;
|
|
4488
4488
|
}
|
|
4489
|
-
function
|
|
4490
|
-
this.
|
|
4491
|
-
this.
|
|
4489
|
+
function da(a) {
|
|
4490
|
+
this.A = new t;
|
|
4491
|
+
this.C = a;
|
|
4492
4492
|
}
|
|
4493
|
-
function
|
|
4494
|
-
u(a.
|
|
4495
|
-
var c = a.
|
|
4493
|
+
function ea(a, b) {
|
|
4494
|
+
u(a.A);
|
|
4495
|
+
var c = a.A.C;
|
|
4496
4496
|
if (c)
|
|
4497
4497
|
return z(a, "return" in c ? c["return"] : function(d) {
|
|
4498
4498
|
return { value: d, done: true };
|
|
4499
|
-
}, b, a.
|
|
4500
|
-
a.
|
|
4499
|
+
}, b, a.A.return);
|
|
4500
|
+
a.A.return(b);
|
|
4501
4501
|
return C(a);
|
|
4502
4502
|
}
|
|
4503
4503
|
function z(a, b, c, d) {
|
|
4504
4504
|
try {
|
|
4505
|
-
var
|
|
4506
|
-
if (!(
|
|
4507
|
-
throw new TypeError("Iterator result " +
|
|
4508
|
-
if (!
|
|
4509
|
-
return a.
|
|
4510
|
-
var
|
|
4511
|
-
} catch (
|
|
4512
|
-
return a.
|
|
4513
|
-
}
|
|
4514
|
-
a.
|
|
4515
|
-
d.call(a.
|
|
4505
|
+
var e = b.call(a.A.C, c);
|
|
4506
|
+
if (!(e instanceof Object))
|
|
4507
|
+
throw new TypeError("Iterator result " + e + " is not an object");
|
|
4508
|
+
if (!e.done)
|
|
4509
|
+
return a.A.H = false, e;
|
|
4510
|
+
var g = e.value;
|
|
4511
|
+
} catch (f) {
|
|
4512
|
+
return a.A.C = null, v(a.A, f), C(a);
|
|
4513
|
+
}
|
|
4514
|
+
a.A.C = null;
|
|
4515
|
+
d.call(a.A, g);
|
|
4516
4516
|
return C(a);
|
|
4517
4517
|
}
|
|
4518
4518
|
function C(a) {
|
|
4519
|
-
for (;a.
|
|
4519
|
+
for (;a.A.A; )
|
|
4520
4520
|
try {
|
|
4521
|
-
var b = a.
|
|
4521
|
+
var b = a.C(a.A);
|
|
4522
4522
|
if (b)
|
|
4523
|
-
return a.
|
|
4523
|
+
return a.A.H = false, { value: b.value, done: false };
|
|
4524
4524
|
} catch (c) {
|
|
4525
|
-
a.
|
|
4525
|
+
a.A.D = undefined, v(a.A, c);
|
|
4526
4526
|
}
|
|
4527
|
-
a.
|
|
4528
|
-
if (a.
|
|
4529
|
-
b = a.
|
|
4530
|
-
a.
|
|
4531
|
-
if (b
|
|
4532
|
-
throw b.
|
|
4527
|
+
a.A.H = false;
|
|
4528
|
+
if (a.A.F) {
|
|
4529
|
+
b = a.A.F;
|
|
4530
|
+
a.A.F = null;
|
|
4531
|
+
if (b.aa)
|
|
4532
|
+
throw b.S;
|
|
4533
4533
|
return { value: b.return, done: true };
|
|
4534
4534
|
}
|
|
4535
4535
|
return { value: undefined, done: true };
|
|
4536
4536
|
}
|
|
4537
|
-
function
|
|
4537
|
+
function fa(a) {
|
|
4538
4538
|
this.next = function(b) {
|
|
4539
|
-
u(a.
|
|
4540
|
-
a.
|
|
4539
|
+
u(a.A);
|
|
4540
|
+
a.A.C ? b = z(a, a.A.C.next, b, a.A.I) : (a.A.I(b), b = C(a));
|
|
4541
4541
|
return b;
|
|
4542
4542
|
};
|
|
4543
4543
|
this.throw = function(b) {
|
|
4544
|
-
u(a.
|
|
4545
|
-
a.
|
|
4544
|
+
u(a.A);
|
|
4545
|
+
a.A.C ? b = z(a, a.A.C["throw"], b, a.A.I) : (v(a.A, b), b = C(a));
|
|
4546
4546
|
return b;
|
|
4547
4547
|
};
|
|
4548
4548
|
this.return = function(b) {
|
|
4549
|
-
return
|
|
4549
|
+
return ea(a, b);
|
|
4550
4550
|
};
|
|
4551
4551
|
this[Symbol.iterator] = function() {
|
|
4552
4552
|
return this;
|
|
4553
4553
|
};
|
|
4554
4554
|
}
|
|
4555
|
-
function
|
|
4555
|
+
function ha(a) {
|
|
4556
4556
|
function b(d) {
|
|
4557
4557
|
return a.next(d);
|
|
4558
4558
|
}
|
|
4559
4559
|
function c(d) {
|
|
4560
4560
|
return a.throw(d);
|
|
4561
4561
|
}
|
|
4562
|
-
return new Promise(function(d,
|
|
4563
|
-
function
|
|
4564
|
-
|
|
4562
|
+
return new Promise(function(d, e) {
|
|
4563
|
+
function g(f) {
|
|
4564
|
+
f.done ? d(f.value) : Promise.resolve(f.value).then(b, c).then(g, e);
|
|
4565
4565
|
}
|
|
4566
|
-
|
|
4566
|
+
g(a.next());
|
|
4567
4567
|
});
|
|
4568
4568
|
}
|
|
4569
4569
|
function D(a) {
|
|
4570
|
-
return
|
|
4570
|
+
return ha(new fa(new da(a)));
|
|
4571
4571
|
}
|
|
4572
4572
|
r("Symbol", function(a) {
|
|
4573
|
-
function b(
|
|
4573
|
+
function b(g) {
|
|
4574
4574
|
if (this instanceof b)
|
|
4575
4575
|
throw new TypeError("Symbol is not a constructor");
|
|
4576
|
-
return new c(d + (
|
|
4576
|
+
return new c(d + (g || "") + "_" + e++, g);
|
|
4577
4577
|
}
|
|
4578
|
-
function c(
|
|
4579
|
-
this.
|
|
4580
|
-
l(this, "description", { configurable: true, writable: true, value:
|
|
4578
|
+
function c(g, f) {
|
|
4579
|
+
this.A = g;
|
|
4580
|
+
l(this, "description", { configurable: true, writable: true, value: f });
|
|
4581
4581
|
}
|
|
4582
4582
|
if (a)
|
|
4583
4583
|
return a;
|
|
4584
4584
|
c.prototype.toString = function() {
|
|
4585
|
-
return this.
|
|
4585
|
+
return this.A;
|
|
4586
4586
|
};
|
|
4587
|
-
var d = "jscomp_symbol_" + (1e9 * Math.random() >>> 0) + "_",
|
|
4587
|
+
var d = "jscomp_symbol_" + (1e9 * Math.random() >>> 0) + "_", e = 0;
|
|
4588
4588
|
return b;
|
|
4589
4589
|
});
|
|
4590
4590
|
r("Symbol.iterator", function(a) {
|
|
@@ -4592,14 +4592,14 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4592
4592
|
return a;
|
|
4593
4593
|
a = Symbol("Symbol.iterator");
|
|
4594
4594
|
for (var b = "Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "), c = 0;c < b.length; c++) {
|
|
4595
|
-
var d =
|
|
4595
|
+
var d = n[b[c]];
|
|
4596
4596
|
typeof d === "function" && typeof d.prototype[a] != "function" && l(d.prototype, a, { configurable: true, writable: true, value: function() {
|
|
4597
|
-
return
|
|
4597
|
+
return ia(ba(this));
|
|
4598
4598
|
} });
|
|
4599
4599
|
}
|
|
4600
4600
|
return a;
|
|
4601
4601
|
});
|
|
4602
|
-
function
|
|
4602
|
+
function ia(a) {
|
|
4603
4603
|
a = { next: a };
|
|
4604
4604
|
a[Symbol.iterator] = function() {
|
|
4605
4605
|
return this;
|
|
@@ -4607,82 +4607,82 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4607
4607
|
return a;
|
|
4608
4608
|
}
|
|
4609
4609
|
r("Promise", function(a) {
|
|
4610
|
-
function b(
|
|
4611
|
-
this.
|
|
4612
|
-
this.
|
|
4613
|
-
this.
|
|
4614
|
-
this.
|
|
4615
|
-
var k = this.
|
|
4610
|
+
function b(f) {
|
|
4611
|
+
this.C = 0;
|
|
4612
|
+
this.D = undefined;
|
|
4613
|
+
this.A = [];
|
|
4614
|
+
this.I = false;
|
|
4615
|
+
var k = this.F();
|
|
4616
4616
|
try {
|
|
4617
|
-
|
|
4617
|
+
f(k.resolve, k.reject);
|
|
4618
4618
|
} catch (m) {
|
|
4619
4619
|
k.reject(m);
|
|
4620
4620
|
}
|
|
4621
4621
|
}
|
|
4622
4622
|
function c() {
|
|
4623
|
-
this.
|
|
4623
|
+
this.A = null;
|
|
4624
4624
|
}
|
|
4625
|
-
function d(
|
|
4626
|
-
return
|
|
4627
|
-
k(
|
|
4625
|
+
function d(f) {
|
|
4626
|
+
return f instanceof b ? f : new b(function(k) {
|
|
4627
|
+
k(f);
|
|
4628
4628
|
});
|
|
4629
4629
|
}
|
|
4630
4630
|
if (a)
|
|
4631
4631
|
return a;
|
|
4632
|
-
c.prototype.
|
|
4633
|
-
if (this.
|
|
4634
|
-
this.
|
|
4632
|
+
c.prototype.C = function(f) {
|
|
4633
|
+
if (this.A == null) {
|
|
4634
|
+
this.A = [];
|
|
4635
4635
|
var k = this;
|
|
4636
|
-
this.
|
|
4637
|
-
k.
|
|
4636
|
+
this.D(function() {
|
|
4637
|
+
k.G();
|
|
4638
4638
|
});
|
|
4639
4639
|
}
|
|
4640
|
-
this.
|
|
4640
|
+
this.A.push(f);
|
|
4641
4641
|
};
|
|
4642
|
-
var
|
|
4643
|
-
c.prototype.
|
|
4644
|
-
f
|
|
4642
|
+
var e = n.setTimeout;
|
|
4643
|
+
c.prototype.D = function(f) {
|
|
4644
|
+
e(f, 0);
|
|
4645
4645
|
};
|
|
4646
|
-
c.prototype.
|
|
4647
|
-
for (;this.
|
|
4648
|
-
var
|
|
4649
|
-
this.
|
|
4650
|
-
for (var k = 0;k <
|
|
4651
|
-
var m =
|
|
4652
|
-
|
|
4646
|
+
c.prototype.G = function() {
|
|
4647
|
+
for (;this.A && this.A.length; ) {
|
|
4648
|
+
var f = this.A;
|
|
4649
|
+
this.A = [];
|
|
4650
|
+
for (var k = 0;k < f.length; ++k) {
|
|
4651
|
+
var m = f[k];
|
|
4652
|
+
f[k] = null;
|
|
4653
4653
|
try {
|
|
4654
4654
|
m();
|
|
4655
|
-
} catch (
|
|
4656
|
-
this.
|
|
4655
|
+
} catch (p) {
|
|
4656
|
+
this.F(p);
|
|
4657
4657
|
}
|
|
4658
4658
|
}
|
|
4659
4659
|
}
|
|
4660
|
-
this.
|
|
4660
|
+
this.A = null;
|
|
4661
4661
|
};
|
|
4662
|
-
c.prototype.
|
|
4663
|
-
this.
|
|
4664
|
-
throw
|
|
4662
|
+
c.prototype.F = function(f) {
|
|
4663
|
+
this.D(function() {
|
|
4664
|
+
throw f;
|
|
4665
4665
|
});
|
|
4666
4666
|
};
|
|
4667
|
-
b.prototype.
|
|
4668
|
-
function
|
|
4667
|
+
b.prototype.F = function() {
|
|
4668
|
+
function f(p) {
|
|
4669
4669
|
return function(q) {
|
|
4670
|
-
m || (m = true,
|
|
4670
|
+
m || (m = true, p.call(k, q));
|
|
4671
4671
|
};
|
|
4672
4672
|
}
|
|
4673
4673
|
var k = this, m = false;
|
|
4674
|
-
return { resolve:
|
|
4674
|
+
return { resolve: f(this.W), reject: f(this.G) };
|
|
4675
4675
|
};
|
|
4676
|
-
b.prototype.
|
|
4677
|
-
if (
|
|
4678
|
-
this.
|
|
4679
|
-
else if (
|
|
4680
|
-
this.
|
|
4676
|
+
b.prototype.W = function(f) {
|
|
4677
|
+
if (f === this)
|
|
4678
|
+
this.G(new TypeError("A Promise cannot resolve to itself"));
|
|
4679
|
+
else if (f instanceof b)
|
|
4680
|
+
this.Y(f);
|
|
4681
4681
|
else {
|
|
4682
4682
|
a:
|
|
4683
|
-
switch (typeof
|
|
4683
|
+
switch (typeof f) {
|
|
4684
4684
|
case "object":
|
|
4685
|
-
var k =
|
|
4685
|
+
var k = f != null;
|
|
4686
4686
|
break a;
|
|
4687
4687
|
case "function":
|
|
4688
4688
|
k = true;
|
|
@@ -4690,144 +4690,144 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4690
4690
|
default:
|
|
4691
4691
|
k = false;
|
|
4692
4692
|
}
|
|
4693
|
-
k ? this.
|
|
4693
|
+
k ? this.V(f) : this.H(f);
|
|
4694
4694
|
}
|
|
4695
4695
|
};
|
|
4696
|
-
b.prototype.
|
|
4696
|
+
b.prototype.V = function(f) {
|
|
4697
4697
|
var k = undefined;
|
|
4698
4698
|
try {
|
|
4699
|
-
k =
|
|
4699
|
+
k = f.then;
|
|
4700
4700
|
} catch (m) {
|
|
4701
|
-
this.
|
|
4701
|
+
this.G(m);
|
|
4702
4702
|
return;
|
|
4703
4703
|
}
|
|
4704
|
-
typeof k == "function" ? this.
|
|
4704
|
+
typeof k == "function" ? this.Z(k, f) : this.H(f);
|
|
4705
4705
|
};
|
|
4706
|
-
b.prototype.
|
|
4707
|
-
this.
|
|
4706
|
+
b.prototype.G = function(f) {
|
|
4707
|
+
this.K(2, f);
|
|
4708
4708
|
};
|
|
4709
|
-
b.prototype.
|
|
4710
|
-
this.
|
|
4709
|
+
b.prototype.H = function(f) {
|
|
4710
|
+
this.K(1, f);
|
|
4711
4711
|
};
|
|
4712
|
-
b.prototype.
|
|
4713
|
-
if (this.
|
|
4714
|
-
throw Error("Cannot settle(" +
|
|
4715
|
-
this.
|
|
4716
|
-
this.
|
|
4717
|
-
this.
|
|
4718
|
-
this.
|
|
4712
|
+
b.prototype.K = function(f, k) {
|
|
4713
|
+
if (this.C != 0)
|
|
4714
|
+
throw Error("Cannot settle(" + f + ", " + k + "): Promise already settled in state" + this.C);
|
|
4715
|
+
this.C = f;
|
|
4716
|
+
this.D = k;
|
|
4717
|
+
this.C === 2 && this.X();
|
|
4718
|
+
this.T();
|
|
4719
4719
|
};
|
|
4720
|
-
b.prototype.
|
|
4721
|
-
var
|
|
4722
|
-
|
|
4723
|
-
if (
|
|
4724
|
-
var k =
|
|
4725
|
-
typeof k !== "undefined" && k.error(
|
|
4720
|
+
b.prototype.X = function() {
|
|
4721
|
+
var f = this;
|
|
4722
|
+
e(function() {
|
|
4723
|
+
if (f.U()) {
|
|
4724
|
+
var k = n.console;
|
|
4725
|
+
typeof k !== "undefined" && k.error(f.D);
|
|
4726
4726
|
}
|
|
4727
4727
|
}, 1);
|
|
4728
4728
|
};
|
|
4729
|
-
b.prototype.
|
|
4730
|
-
if (this.
|
|
4729
|
+
b.prototype.U = function() {
|
|
4730
|
+
if (this.I)
|
|
4731
4731
|
return false;
|
|
4732
|
-
var { CustomEvent:
|
|
4732
|
+
var { CustomEvent: f, Event: k, dispatchEvent: m } = n;
|
|
4733
4733
|
if (typeof m === "undefined")
|
|
4734
4734
|
return true;
|
|
4735
|
-
typeof
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
return m(
|
|
4735
|
+
typeof f === "function" ? f = new f("unhandledrejection", { cancelable: true }) : typeof k === "function" ? f = new k("unhandledrejection", { cancelable: true }) : (f = n.document.createEvent("CustomEvent"), f.initCustomEvent("unhandledrejection", false, true, f));
|
|
4736
|
+
f.promise = this;
|
|
4737
|
+
f.reason = this.D;
|
|
4738
|
+
return m(f);
|
|
4739
4739
|
};
|
|
4740
|
-
b.prototype.
|
|
4741
|
-
if (this.
|
|
4742
|
-
for (var
|
|
4743
|
-
|
|
4744
|
-
this.
|
|
4740
|
+
b.prototype.T = function() {
|
|
4741
|
+
if (this.A != null) {
|
|
4742
|
+
for (var f = 0;f < this.A.length; ++f)
|
|
4743
|
+
g.C(this.A[f]);
|
|
4744
|
+
this.A = null;
|
|
4745
4745
|
}
|
|
4746
4746
|
};
|
|
4747
|
-
var
|
|
4748
|
-
b.prototype.
|
|
4749
|
-
var k = this.
|
|
4750
|
-
|
|
4747
|
+
var g = new c;
|
|
4748
|
+
b.prototype.Y = function(f) {
|
|
4749
|
+
var k = this.F();
|
|
4750
|
+
f.O(k.resolve, k.reject);
|
|
4751
4751
|
};
|
|
4752
|
-
b.prototype.
|
|
4753
|
-
var m = this.
|
|
4752
|
+
b.prototype.Z = function(f, k) {
|
|
4753
|
+
var m = this.F();
|
|
4754
4754
|
try {
|
|
4755
|
-
|
|
4756
|
-
} catch (
|
|
4757
|
-
m.reject(
|
|
4755
|
+
f.call(k, m.resolve, m.reject);
|
|
4756
|
+
} catch (p) {
|
|
4757
|
+
m.reject(p);
|
|
4758
4758
|
}
|
|
4759
4759
|
};
|
|
4760
|
-
b.prototype.then = function(
|
|
4761
|
-
function m(
|
|
4762
|
-
return typeof
|
|
4760
|
+
b.prototype.then = function(f, k) {
|
|
4761
|
+
function m(x, A) {
|
|
4762
|
+
return typeof x == "function" ? function(Z) {
|
|
4763
4763
|
try {
|
|
4764
|
-
|
|
4765
|
-
} catch (
|
|
4766
|
-
q(
|
|
4764
|
+
p(x(Z));
|
|
4765
|
+
} catch (aa) {
|
|
4766
|
+
q(aa);
|
|
4767
4767
|
}
|
|
4768
4768
|
} : A;
|
|
4769
4769
|
}
|
|
4770
|
-
var
|
|
4771
|
-
|
|
4770
|
+
var p, q, B = new b(function(x, A) {
|
|
4771
|
+
p = x;
|
|
4772
4772
|
q = A;
|
|
4773
4773
|
});
|
|
4774
|
-
this.
|
|
4774
|
+
this.O(m(f, p), m(k, q));
|
|
4775
4775
|
return B;
|
|
4776
4776
|
};
|
|
4777
|
-
b.prototype.catch = function(
|
|
4778
|
-
return this.then(undefined,
|
|
4777
|
+
b.prototype.catch = function(f) {
|
|
4778
|
+
return this.then(undefined, f);
|
|
4779
4779
|
};
|
|
4780
|
-
b.prototype.
|
|
4780
|
+
b.prototype.O = function(f, k) {
|
|
4781
4781
|
function m() {
|
|
4782
|
-
switch (
|
|
4782
|
+
switch (p.C) {
|
|
4783
4783
|
case 1:
|
|
4784
|
-
|
|
4784
|
+
f(p.D);
|
|
4785
4785
|
break;
|
|
4786
4786
|
case 2:
|
|
4787
|
-
k(
|
|
4787
|
+
k(p.D);
|
|
4788
4788
|
break;
|
|
4789
4789
|
default:
|
|
4790
|
-
throw Error("Unexpected state: " +
|
|
4790
|
+
throw Error("Unexpected state: " + p.C);
|
|
4791
4791
|
}
|
|
4792
4792
|
}
|
|
4793
|
-
var
|
|
4794
|
-
this.
|
|
4795
|
-
this.
|
|
4793
|
+
var p = this;
|
|
4794
|
+
this.A == null ? g.C(m) : this.A.push(m);
|
|
4795
|
+
this.I = true;
|
|
4796
4796
|
};
|
|
4797
4797
|
b.resolve = d;
|
|
4798
|
-
b.reject = function(
|
|
4798
|
+
b.reject = function(f) {
|
|
4799
4799
|
return new b(function(k, m) {
|
|
4800
|
-
m(
|
|
4800
|
+
m(f);
|
|
4801
4801
|
});
|
|
4802
4802
|
};
|
|
4803
|
-
b.race = function(
|
|
4803
|
+
b.race = function(f) {
|
|
4804
4804
|
return new b(function(k, m) {
|
|
4805
|
-
for (var
|
|
4806
|
-
d(q.value).
|
|
4805
|
+
for (var p = h(f), q = p.next();!q.done; q = p.next())
|
|
4806
|
+
d(q.value).O(k, m);
|
|
4807
4807
|
});
|
|
4808
4808
|
};
|
|
4809
|
-
b.all = function(
|
|
4810
|
-
var k =
|
|
4811
|
-
return m.done ? d([]) : new b(function(
|
|
4812
|
-
function B(
|
|
4813
|
-
return function(
|
|
4814
|
-
|
|
4809
|
+
b.all = function(f) {
|
|
4810
|
+
var k = h(f), m = k.next();
|
|
4811
|
+
return m.done ? d([]) : new b(function(p, q) {
|
|
4812
|
+
function B(Z) {
|
|
4813
|
+
return function(aa) {
|
|
4814
|
+
x[Z] = aa;
|
|
4815
4815
|
A--;
|
|
4816
|
-
A == 0 &&
|
|
4816
|
+
A == 0 && p(x);
|
|
4817
4817
|
};
|
|
4818
4818
|
}
|
|
4819
|
-
var
|
|
4819
|
+
var x = [], A = 0;
|
|
4820
4820
|
do
|
|
4821
|
-
|
|
4821
|
+
x.push(undefined), A++, d(m.value).O(B(x.length - 1), q), m = k.next();
|
|
4822
4822
|
while (!m.done);
|
|
4823
4823
|
});
|
|
4824
4824
|
};
|
|
4825
4825
|
return b;
|
|
4826
4826
|
});
|
|
4827
4827
|
r("globalThis", function(a) {
|
|
4828
|
-
return a ||
|
|
4828
|
+
return a || n;
|
|
4829
4829
|
});
|
|
4830
|
-
function
|
|
4830
|
+
function ja(a, b, c) {
|
|
4831
4831
|
if (a == null)
|
|
4832
4832
|
throw new TypeError("The 'this' value for String.prototype." + c + " must not be null or undefined");
|
|
4833
4833
|
if (b instanceof RegExp)
|
|
@@ -4836,61 +4836,61 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4836
4836
|
}
|
|
4837
4837
|
r("String.prototype.startsWith", function(a) {
|
|
4838
4838
|
return a ? a : function(b, c) {
|
|
4839
|
-
var d =
|
|
4839
|
+
var d = ja(this, b, "startsWith"), e = d.length, g = b.length;
|
|
4840
4840
|
c = Math.max(0, Math.min(c | 0, d.length));
|
|
4841
|
-
for (var
|
|
4842
|
-
if (d[c++] != b[
|
|
4841
|
+
for (var f = 0;f < g && c < e; )
|
|
4842
|
+
if (d[c++] != b[f++])
|
|
4843
4843
|
return false;
|
|
4844
|
-
return
|
|
4844
|
+
return f >= g;
|
|
4845
4845
|
};
|
|
4846
4846
|
});
|
|
4847
4847
|
r("String.prototype.codePointAt", function(a) {
|
|
4848
4848
|
return a ? a : function(b) {
|
|
4849
|
-
var c =
|
|
4849
|
+
var c = ja(this, null, "codePointAt"), d = c.length;
|
|
4850
4850
|
b = Number(b) || 0;
|
|
4851
4851
|
if (0 <= b && b < d) {
|
|
4852
4852
|
b |= 0;
|
|
4853
|
-
var
|
|
4854
|
-
if (55296 >
|
|
4855
|
-
return
|
|
4853
|
+
var e = c.charCodeAt(b);
|
|
4854
|
+
if (55296 > e || 56319 < e || b + 1 === d)
|
|
4855
|
+
return e;
|
|
4856
4856
|
b = c.charCodeAt(b + 1);
|
|
4857
|
-
return 56320 > b || 57343 < b ?
|
|
4857
|
+
return 56320 > b || 57343 < b ? e : 1024 * (e - 55296) + b + 9216;
|
|
4858
4858
|
}
|
|
4859
4859
|
};
|
|
4860
4860
|
});
|
|
4861
|
-
function
|
|
4861
|
+
function ka(a, b) {
|
|
4862
4862
|
a instanceof String && (a += "");
|
|
4863
|
-
var c = 0, d = false,
|
|
4863
|
+
var c = 0, d = false, e = { next: function() {
|
|
4864
4864
|
if (!d && c < a.length) {
|
|
4865
|
-
var
|
|
4866
|
-
return { value: b(
|
|
4865
|
+
var g = c++;
|
|
4866
|
+
return { value: b(g, a[g]), done: false };
|
|
4867
4867
|
}
|
|
4868
4868
|
d = true;
|
|
4869
4869
|
return { done: true, value: undefined };
|
|
4870
4870
|
} };
|
|
4871
|
-
|
|
4872
|
-
return
|
|
4871
|
+
e[Symbol.iterator] = function() {
|
|
4872
|
+
return e;
|
|
4873
4873
|
};
|
|
4874
|
-
return
|
|
4874
|
+
return e;
|
|
4875
4875
|
}
|
|
4876
4876
|
r("Array.prototype.keys", function(a) {
|
|
4877
4877
|
return a ? a : function() {
|
|
4878
|
-
return
|
|
4878
|
+
return ka(this, function(b) {
|
|
4879
4879
|
return b;
|
|
4880
4880
|
});
|
|
4881
4881
|
};
|
|
4882
4882
|
});
|
|
4883
|
-
var E = moduleArg,
|
|
4884
|
-
typeof __filename != "undefined" ? _scriptName = __filename :
|
|
4885
|
-
var F = "",
|
|
4886
|
-
if (
|
|
4883
|
+
var E = moduleArg, la = !!globalThis.window, ma = !!globalThis.WorkerGlobalScope, na, oa, pa, qa = ((na = globalThis.process) == null ? undefined : (oa = na.versions) == null ? undefined : oa.node) && ((pa = globalThis.process) == null ? undefined : pa.type) != "renderer";
|
|
4884
|
+
typeof __filename != "undefined" ? _scriptName = __filename : ma && (_scriptName = self.location.href);
|
|
4885
|
+
var F = "", ra, G;
|
|
4886
|
+
if (qa) {
|
|
4887
4887
|
var fs5 = __require("fs");
|
|
4888
4888
|
F = __dirname + "/";
|
|
4889
4889
|
G = function(a) {
|
|
4890
4890
|
a = H(a) ? new URL(a) : a;
|
|
4891
4891
|
return fs5.readFileSync(a);
|
|
4892
4892
|
};
|
|
4893
|
-
|
|
4893
|
+
ra = function(a) {
|
|
4894
4894
|
var b = b === undefined ? true : b;
|
|
4895
4895
|
var c;
|
|
4896
4896
|
return D(function(d) {
|
|
@@ -4900,46 +4900,46 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4900
4900
|
});
|
|
4901
4901
|
};
|
|
4902
4902
|
process.argv.slice(2);
|
|
4903
|
-
} else if (
|
|
4903
|
+
} else if (la || ma) {
|
|
4904
4904
|
try {
|
|
4905
4905
|
F = new URL(".", _scriptName).href;
|
|
4906
4906
|
} catch (a) {}
|
|
4907
|
-
|
|
4907
|
+
ma && (G = function(a) {
|
|
4908
4908
|
var b = new XMLHttpRequest;
|
|
4909
4909
|
b.open("GET", a, false);
|
|
4910
4910
|
b.responseType = "arraybuffer";
|
|
4911
4911
|
b.send(null);
|
|
4912
4912
|
return new Uint8Array(b.response);
|
|
4913
4913
|
});
|
|
4914
|
-
|
|
4914
|
+
ra = function(a) {
|
|
4915
4915
|
var b;
|
|
4916
4916
|
return D(function(c) {
|
|
4917
|
-
if (c.
|
|
4918
|
-
return H(a) ? c.return(new Promise(function(d,
|
|
4919
|
-
var
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4917
|
+
if (c.A == 1)
|
|
4918
|
+
return H(a) ? c.return(new Promise(function(d, e) {
|
|
4919
|
+
var g = new XMLHttpRequest;
|
|
4920
|
+
g.open("GET", a, true);
|
|
4921
|
+
g.responseType = "arraybuffer";
|
|
4922
|
+
g.onload = function() {
|
|
4923
|
+
g.status == 200 || g.status == 0 && g.response ? d(g.response) : e(g.status);
|
|
4924
4924
|
};
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
})) :
|
|
4928
|
-
b = c.
|
|
4925
|
+
g.onerror = e;
|
|
4926
|
+
g.send(null);
|
|
4927
|
+
})) : w(c, fetch(a, { credentials: "same-origin" }), 2);
|
|
4928
|
+
b = c.D;
|
|
4929
4929
|
if (b.ok)
|
|
4930
4930
|
return c.return(b.arrayBuffer());
|
|
4931
4931
|
throw Error(b.status + " : " + b.url);
|
|
4932
4932
|
});
|
|
4933
4933
|
};
|
|
4934
4934
|
}
|
|
4935
|
-
var
|
|
4935
|
+
var sa = console.log.bind(console), I = console.error.bind(console), J, ta = false;
|
|
4936
4936
|
function H(a) {
|
|
4937
4937
|
return a.startsWith("file://");
|
|
4938
4938
|
}
|
|
4939
|
-
var
|
|
4940
|
-
function
|
|
4939
|
+
var ua, va, wa, K, L, xa = false;
|
|
4940
|
+
function ya() {
|
|
4941
4941
|
var a = M.buffer;
|
|
4942
|
-
|
|
4942
|
+
wa = new Int8Array(a);
|
|
4943
4943
|
new Int16Array(a);
|
|
4944
4944
|
K = new Uint8Array(a);
|
|
4945
4945
|
new Uint16Array(a);
|
|
@@ -4955,130 +4955,130 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
4955
4955
|
(b = E.onAbort) == null || b.call(E, a);
|
|
4956
4956
|
a = "Aborted(" + a + ")";
|
|
4957
4957
|
I(a);
|
|
4958
|
-
|
|
4958
|
+
ta = true;
|
|
4959
4959
|
a = new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info.");
|
|
4960
4960
|
var c;
|
|
4961
|
-
(c =
|
|
4961
|
+
(c = va) == null || c(a);
|
|
4962
4962
|
throw a;
|
|
4963
4963
|
}
|
|
4964
4964
|
var O;
|
|
4965
|
-
function
|
|
4965
|
+
function za(a) {
|
|
4966
4966
|
var b;
|
|
4967
4967
|
return D(function(c) {
|
|
4968
|
-
switch (c.
|
|
4968
|
+
switch (c.A) {
|
|
4969
4969
|
case 1:
|
|
4970
4970
|
if (J) {
|
|
4971
|
-
c.
|
|
4971
|
+
c.A = 2;
|
|
4972
4972
|
break;
|
|
4973
4973
|
}
|
|
4974
|
-
c.
|
|
4975
|
-
return
|
|
4974
|
+
c.G = 3;
|
|
4975
|
+
return w(c, ra(a), 5);
|
|
4976
4976
|
case 5:
|
|
4977
|
-
return b = c.
|
|
4977
|
+
return b = c.D, c.return(new Uint8Array(b));
|
|
4978
4978
|
case 3:
|
|
4979
4979
|
y(c);
|
|
4980
4980
|
case 2:
|
|
4981
4981
|
var d = c.return;
|
|
4982
4982
|
if (a == O && J)
|
|
4983
|
-
var
|
|
4983
|
+
var e = new Uint8Array(J);
|
|
4984
4984
|
else if (G)
|
|
4985
|
-
|
|
4985
|
+
e = G(a);
|
|
4986
4986
|
else
|
|
4987
4987
|
throw "both async and sync fetching of the wasm failed";
|
|
4988
|
-
return d.call(c,
|
|
4988
|
+
return d.call(c, e);
|
|
4989
4989
|
}
|
|
4990
4990
|
});
|
|
4991
4991
|
}
|
|
4992
|
-
function
|
|
4993
|
-
var c, d,
|
|
4994
|
-
return D(function(
|
|
4995
|
-
switch (
|
|
4992
|
+
function Aa(a, b) {
|
|
4993
|
+
var c, d, e;
|
|
4994
|
+
return D(function(g) {
|
|
4995
|
+
switch (g.A) {
|
|
4996
4996
|
case 1:
|
|
4997
|
-
return
|
|
4997
|
+
return g.G = 2, w(g, za(a), 4);
|
|
4998
4998
|
case 4:
|
|
4999
|
-
return c =
|
|
4999
|
+
return c = g.D, w(g, WebAssembly.instantiate(c, b), 5);
|
|
5000
5000
|
case 5:
|
|
5001
|
-
return d =
|
|
5001
|
+
return d = g.D, g.return(d);
|
|
5002
5002
|
case 2:
|
|
5003
|
-
|
|
5003
|
+
e = y(g), I("failed to asynchronously prepare wasm: " + e), N(e), g.A = 0;
|
|
5004
5004
|
}
|
|
5005
5005
|
});
|
|
5006
5006
|
}
|
|
5007
|
-
function
|
|
5008
|
-
var b = J, c = O, d,
|
|
5009
|
-
return D(function(
|
|
5010
|
-
switch (
|
|
5007
|
+
function Ba(a) {
|
|
5008
|
+
var b = J, c = O, d, e, g;
|
|
5009
|
+
return D(function(f) {
|
|
5010
|
+
switch (f.A) {
|
|
5011
5011
|
case 1:
|
|
5012
|
-
if (b || H(c) ||
|
|
5013
|
-
|
|
5012
|
+
if (b || H(c) || qa) {
|
|
5013
|
+
f.A = 2;
|
|
5014
5014
|
break;
|
|
5015
5015
|
}
|
|
5016
|
-
|
|
5016
|
+
f.G = 3;
|
|
5017
5017
|
d = fetch(c, { credentials: "same-origin" });
|
|
5018
|
-
return
|
|
5018
|
+
return w(f, WebAssembly.instantiateStreaming(d, a), 5);
|
|
5019
5019
|
case 5:
|
|
5020
|
-
return
|
|
5020
|
+
return e = f.D, f.return(e);
|
|
5021
5021
|
case 3:
|
|
5022
|
-
|
|
5022
|
+
g = y(f), I("wasm streaming compile failed: " + g), I("falling back to ArrayBuffer instantiation");
|
|
5023
5023
|
case 2:
|
|
5024
|
-
return
|
|
5024
|
+
return f.return(Aa(c, a));
|
|
5025
5025
|
}
|
|
5026
5026
|
});
|
|
5027
5027
|
}
|
|
5028
|
-
function
|
|
5028
|
+
function Ca(a) {
|
|
5029
5029
|
for (;0 < a.length; )
|
|
5030
5030
|
a.shift()(E);
|
|
5031
5031
|
}
|
|
5032
|
-
var
|
|
5033
|
-
function
|
|
5032
|
+
var Da = [], Ea = [];
|
|
5033
|
+
function Fa() {
|
|
5034
5034
|
var a = E.preRun.shift();
|
|
5035
|
-
|
|
5035
|
+
Ea.push(a);
|
|
5036
5036
|
}
|
|
5037
|
-
function
|
|
5038
|
-
this.
|
|
5037
|
+
function Ga(a) {
|
|
5038
|
+
this.B = a - 24;
|
|
5039
5039
|
}
|
|
5040
|
-
var
|
|
5041
|
-
function
|
|
5040
|
+
var Ha = 0, Ia = 0, Ja = [null, [], []], Ka = globalThis.TextDecoder && new TextDecoder;
|
|
5041
|
+
function La(a, b) {
|
|
5042
5042
|
b = b === undefined ? 0 : b;
|
|
5043
5043
|
var c = b;
|
|
5044
5044
|
for (var d = c + undefined;a[c] && !(c >= d); )
|
|
5045
5045
|
++c;
|
|
5046
|
-
if (16 < c - b && a.buffer &&
|
|
5047
|
-
return
|
|
5046
|
+
if (16 < c - b && a.buffer && Ka)
|
|
5047
|
+
return Ka.decode(a.subarray(b, c));
|
|
5048
5048
|
for (d = "";b < c; ) {
|
|
5049
|
-
var
|
|
5050
|
-
if (
|
|
5051
|
-
var
|
|
5052
|
-
if ((
|
|
5053
|
-
d += String.fromCharCode((
|
|
5049
|
+
var e = a[b++];
|
|
5050
|
+
if (e & 128) {
|
|
5051
|
+
var g = a[b++] & 63;
|
|
5052
|
+
if ((e & 224) == 192)
|
|
5053
|
+
d += String.fromCharCode((e & 31) << 6 | g);
|
|
5054
5054
|
else {
|
|
5055
|
-
var
|
|
5056
|
-
|
|
5057
|
-
65536 >
|
|
5055
|
+
var f = a[b++] & 63;
|
|
5056
|
+
e = (e & 240) == 224 ? (e & 15) << 12 | g << 6 | f : (e & 7) << 18 | g << 12 | f << 6 | a[b++] & 63;
|
|
5057
|
+
65536 > e ? d += String.fromCharCode(e) : (e -= 65536, d += String.fromCharCode(55296 | e >> 10, 56320 | e & 1023));
|
|
5058
5058
|
}
|
|
5059
5059
|
} else
|
|
5060
|
-
d += String.fromCharCode(
|
|
5060
|
+
d += String.fromCharCode(e);
|
|
5061
5061
|
}
|
|
5062
5062
|
return d;
|
|
5063
5063
|
}
|
|
5064
|
-
function
|
|
5065
|
-
return a ?
|
|
5064
|
+
function Ma(a) {
|
|
5065
|
+
return a ? La(K, a) : "";
|
|
5066
5066
|
}
|
|
5067
|
-
var
|
|
5068
|
-
E.print && (
|
|
5067
|
+
var Na = [];
|
|
5068
|
+
E.print && (sa = E.print);
|
|
5069
5069
|
E.printErr && (I = E.printErr);
|
|
5070
5070
|
E.wasmBinary && (J = E.wasmBinary);
|
|
5071
5071
|
if (E.preInit)
|
|
5072
5072
|
for (typeof E.preInit == "function" && (E.preInit = [E.preInit]);0 < E.preInit.length; )
|
|
5073
5073
|
E.preInit.shift()();
|
|
5074
|
-
var
|
|
5075
|
-
var d = new
|
|
5076
|
-
L[d.
|
|
5077
|
-
L[d.
|
|
5078
|
-
L[d.
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
throw
|
|
5074
|
+
var Oa, Pa, Qa, Ra, Sa, Ta, Ua, Va, Wa, Xa, Ya, Za, $a, ab2, M, bb = { a: function(a, b, c) {
|
|
5075
|
+
var d = new Ga(a);
|
|
5076
|
+
L[d.B + 16 >> 2] = 0;
|
|
5077
|
+
L[d.B + 4 >> 2] = b;
|
|
5078
|
+
L[d.B + 8 >> 2] = c;
|
|
5079
|
+
Ha = a;
|
|
5080
|
+
Ia++;
|
|
5081
|
+
throw Ha;
|
|
5082
5082
|
}, c: function() {
|
|
5083
5083
|
return N("");
|
|
5084
5084
|
}, e: function(a, b) {
|
|
@@ -5095,89 +5095,91 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
5095
5095
|
d = (Math.min(2147483648, 65536 * Math.ceil(Math.max(a, d) / 65536)) - M.buffer.byteLength + 65535) / 65536 | 0;
|
|
5096
5096
|
try {
|
|
5097
5097
|
M.grow(d);
|
|
5098
|
-
|
|
5099
|
-
var
|
|
5098
|
+
ya();
|
|
5099
|
+
var e = 1;
|
|
5100
5100
|
break a;
|
|
5101
|
-
} catch (
|
|
5102
|
-
|
|
5101
|
+
} catch (g) {}
|
|
5102
|
+
e = undefined;
|
|
5103
5103
|
}
|
|
5104
|
-
if (
|
|
5104
|
+
if (e)
|
|
5105
5105
|
return true;
|
|
5106
5106
|
}
|
|
5107
5107
|
return false;
|
|
5108
5108
|
}, b: function(a, b, c, d) {
|
|
5109
|
-
for (var
|
|
5110
|
-
var
|
|
5109
|
+
for (var e = 0, g = 0;g < c; g++) {
|
|
5110
|
+
var f = L[b >> 2], k = L[b + 4 >> 2];
|
|
5111
5111
|
b += 8;
|
|
5112
5112
|
for (var m = 0;m < k; m++) {
|
|
5113
|
-
var
|
|
5114
|
-
q === 0 || q === 10 ? ((
|
|
5113
|
+
var p = a, q = K[f + m], B = Ja[p];
|
|
5114
|
+
q === 0 || q === 10 ? ((p === 1 ? sa : I)(La(B)), B.length = 0) : B.push(q);
|
|
5115
5115
|
}
|
|
5116
|
-
|
|
5116
|
+
e += k;
|
|
5117
5117
|
}
|
|
5118
|
-
L[d >> 2] =
|
|
5118
|
+
L[d >> 2] = e;
|
|
5119
5119
|
return 0;
|
|
5120
5120
|
} }, P;
|
|
5121
5121
|
P = await function() {
|
|
5122
|
-
function a(
|
|
5123
|
-
|
|
5124
|
-
E._webidl_free =
|
|
5125
|
-
E._webidl_malloc =
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5122
|
+
function a(e) {
|
|
5123
|
+
e = P = e.exports;
|
|
5124
|
+
E._webidl_free = e.h;
|
|
5125
|
+
E._webidl_malloc = e.i;
|
|
5126
|
+
Oa = E._emscripten_bind_Language_getLanguageCode_0 = e.j;
|
|
5127
|
+
Pa = E._emscripten_bind_Language___destroy___0 = e.k;
|
|
5128
|
+
Qa = E._emscripten_bind_VoidPtr___destroy___0 = e.l;
|
|
5129
|
+
Ra = E._emscripten_bind_LanguageGuess_getPercent_0 = e.m;
|
|
5130
|
+
Sa = E._emscripten_bind_LanguageGuess_getLanguageCode_0 = e.n;
|
|
5131
|
+
Ta = E._emscripten_bind_LanguageGuess___destroy___0 = e.o;
|
|
5132
|
+
Ua = E._emscripten_bind_LanguageInfo_detectLanguageWithLength_3 = e.p;
|
|
5133
|
+
Va = E._emscripten_bind_LanguageInfo_detectLanguageWithLength_6 = e.q;
|
|
5134
|
+
Wa = E._emscripten_bind_LanguageInfo_detectLanguage_2 = e.r;
|
|
5135
|
+
Xa = E._emscripten_bind_LanguageInfo_detectLanguage_5 = e.s;
|
|
5136
|
+
Ya = E._emscripten_bind_LanguageInfo_getIsReliable_0 = e.t;
|
|
5137
|
+
Za = E._emscripten_bind_LanguageInfo_getLanguageCode_0 = e.u;
|
|
5138
|
+
$a = E._emscripten_bind_LanguageInfo_get_languages_1 = e.v;
|
|
5139
|
+
ab2 = E._emscripten_bind_LanguageInfo___destroy___0 = e.w;
|
|
5140
|
+
M = e.f;
|
|
5141
|
+
ya();
|
|
5140
5142
|
return P;
|
|
5141
5143
|
}
|
|
5142
5144
|
var b, c, d;
|
|
5143
|
-
return D(function(
|
|
5144
|
-
if (
|
|
5145
|
-
b = { a:
|
|
5145
|
+
return D(function(e) {
|
|
5146
|
+
if (e.A == 1) {
|
|
5147
|
+
b = { a: bb };
|
|
5146
5148
|
if (E.instantiateWasm)
|
|
5147
|
-
return
|
|
5148
|
-
E.instantiateWasm(b, function(
|
|
5149
|
-
|
|
5149
|
+
return e.return(new Promise(function(g) {
|
|
5150
|
+
E.instantiateWasm(b, function(f, k) {
|
|
5151
|
+
g(a(f, k));
|
|
5150
5152
|
});
|
|
5151
5153
|
}));
|
|
5152
5154
|
O != null || (O = E.locateFile ? E.locateFile("cld2.wasm", F) : F + "cld2.wasm");
|
|
5153
|
-
return
|
|
5155
|
+
return w(e, Ba(b), 2);
|
|
5154
5156
|
}
|
|
5155
|
-
c =
|
|
5157
|
+
c = e.D;
|
|
5156
5158
|
d = a(c.instance);
|
|
5157
|
-
return
|
|
5159
|
+
return e.return(d);
|
|
5158
5160
|
});
|
|
5159
5161
|
}();
|
|
5160
5162
|
(function() {
|
|
5161
5163
|
function a() {
|
|
5162
5164
|
E.calledRun = true;
|
|
5163
|
-
if (!
|
|
5164
|
-
|
|
5165
|
-
|
|
5165
|
+
if (!ta) {
|
|
5166
|
+
xa = true;
|
|
5167
|
+
Ca(Na);
|
|
5166
5168
|
P.g();
|
|
5167
5169
|
var b;
|
|
5168
|
-
(b =
|
|
5170
|
+
(b = ua) == null || b(E);
|
|
5169
5171
|
var c;
|
|
5170
5172
|
(c = E.onRuntimeInitialized) == null || c.call(E);
|
|
5171
5173
|
if (E.postRun)
|
|
5172
5174
|
for (typeof E.postRun == "function" && (E.postRun = [E.postRun]);E.postRun.length; )
|
|
5173
|
-
b = E.postRun.shift(),
|
|
5174
|
-
|
|
5175
|
+
b = E.postRun.shift(), Da.push(b);
|
|
5176
|
+
Ca(Da);
|
|
5175
5177
|
}
|
|
5176
5178
|
}
|
|
5177
5179
|
if (E.preRun)
|
|
5178
5180
|
for (typeof E.preRun == "function" && (E.preRun = [E.preRun]);E.preRun.length; )
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
+
Fa();
|
|
5182
|
+
Ca(Ea);
|
|
5181
5183
|
E.setStatus ? (E.setStatus("Running..."), setTimeout(function() {
|
|
5182
5184
|
setTimeout(function() {
|
|
5183
5185
|
return E.setStatus("");
|
|
@@ -5188,61 +5190,61 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
5188
5190
|
function Q() {}
|
|
5189
5191
|
Q.prototype = Object.create(Q.prototype);
|
|
5190
5192
|
Q.prototype.constructor = Q;
|
|
5191
|
-
Q.prototype.
|
|
5192
|
-
Q.
|
|
5193
|
+
Q.prototype.J = Q;
|
|
5194
|
+
Q.L = {};
|
|
5193
5195
|
E.WrapperObject = Q;
|
|
5194
|
-
function
|
|
5195
|
-
return (a || Q).
|
|
5196
|
+
function cb(a) {
|
|
5197
|
+
return (a || Q).L;
|
|
5196
5198
|
}
|
|
5197
|
-
E.getCache =
|
|
5199
|
+
E.getCache = cb;
|
|
5198
5200
|
function R(a, b) {
|
|
5199
|
-
var c =
|
|
5201
|
+
var c = cb(b), d = c[a];
|
|
5200
5202
|
if (d)
|
|
5201
5203
|
return d;
|
|
5202
5204
|
d = Object.create((b || Q).prototype);
|
|
5203
|
-
d.
|
|
5205
|
+
d.B = a;
|
|
5204
5206
|
return c[a] = d;
|
|
5205
5207
|
}
|
|
5206
5208
|
E.wrapPointer = R;
|
|
5207
5209
|
E.castObject = function(a, b) {
|
|
5208
|
-
return R(a.
|
|
5210
|
+
return R(a.B, b);
|
|
5209
5211
|
};
|
|
5210
5212
|
E.NULL = R(0);
|
|
5211
5213
|
E.destroy = function(a) {
|
|
5212
5214
|
if (!a.__destroy__)
|
|
5213
5215
|
throw "Error: Cannot destroy object. (Did you create it yourself?)";
|
|
5214
5216
|
a.__destroy__();
|
|
5215
|
-
delete
|
|
5217
|
+
delete cb(a.J)[a.B];
|
|
5216
5218
|
};
|
|
5217
5219
|
E.compare = function(a, b) {
|
|
5218
|
-
return a.
|
|
5220
|
+
return a.B === b.B;
|
|
5219
5221
|
};
|
|
5220
5222
|
E.getPointer = function(a) {
|
|
5221
|
-
return a.
|
|
5223
|
+
return a.B;
|
|
5222
5224
|
};
|
|
5223
5225
|
E.getClass = function(a) {
|
|
5224
|
-
return a.
|
|
5226
|
+
return a.J;
|
|
5225
5227
|
};
|
|
5226
|
-
var S = { buffer: 0, size: 0,
|
|
5227
|
-
if (S.
|
|
5228
|
-
for (var a = 0;a < S.
|
|
5229
|
-
E._webidl_free(S.
|
|
5230
|
-
S.
|
|
5228
|
+
var S = { buffer: 0, size: 0, N: 0, R: [], M: 0, P: function() {
|
|
5229
|
+
if (S.M) {
|
|
5230
|
+
for (var a = 0;a < S.R.length; a++)
|
|
5231
|
+
E._webidl_free(S.R[a]);
|
|
5232
|
+
S.R.length = 0;
|
|
5231
5233
|
E._webidl_free(S.buffer);
|
|
5232
5234
|
S.buffer = 0;
|
|
5233
|
-
S.size += S.
|
|
5234
|
-
S.
|
|
5235
|
+
S.size += S.M;
|
|
5236
|
+
S.M = 0;
|
|
5235
5237
|
}
|
|
5236
5238
|
S.buffer || (S.size += 128, S.buffer = E._webidl_malloc(S.size), S.buffer || N());
|
|
5237
|
-
S.
|
|
5239
|
+
S.N = 0;
|
|
5238
5240
|
}, alloc: function(a, b) {
|
|
5239
5241
|
S.buffer || N();
|
|
5240
5242
|
a = a.length * b.BYTES_PER_ELEMENT;
|
|
5241
5243
|
a = 8 * Math.ceil(a / 8);
|
|
5242
|
-
S.
|
|
5244
|
+
S.N + a >= S.size ? (0 < a || N(), S.M += a, b = E._webidl_malloc(a), S.R.push(b)) : (b = S.buffer + S.N, S.N += a);
|
|
5243
5245
|
return b;
|
|
5244
5246
|
} };
|
|
5245
|
-
function
|
|
5247
|
+
function T(a) {
|
|
5246
5248
|
if (typeof a === "string") {
|
|
5247
5249
|
for (var b = 0, c = 0;c < a.length; ++c) {
|
|
5248
5250
|
var d = a.charCodeAt(c);
|
|
@@ -5253,119 +5255,129 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
5253
5255
|
c = 0;
|
|
5254
5256
|
if (0 < d) {
|
|
5255
5257
|
d = c + d - 1;
|
|
5256
|
-
for (var
|
|
5257
|
-
var
|
|
5258
|
-
if (127 >=
|
|
5258
|
+
for (var e = 0;e < a.length; ++e) {
|
|
5259
|
+
var g = a.codePointAt(e);
|
|
5260
|
+
if (127 >= g) {
|
|
5259
5261
|
if (c >= d)
|
|
5260
5262
|
break;
|
|
5261
|
-
b[c++] =
|
|
5262
|
-
} else if (2047 >=
|
|
5263
|
+
b[c++] = g;
|
|
5264
|
+
} else if (2047 >= g) {
|
|
5263
5265
|
if (c + 1 >= d)
|
|
5264
5266
|
break;
|
|
5265
|
-
b[c++] = 192 |
|
|
5266
|
-
b[c++] = 128 |
|
|
5267
|
-
} else if (65535 >=
|
|
5267
|
+
b[c++] = 192 | g >> 6;
|
|
5268
|
+
b[c++] = 128 | g & 63;
|
|
5269
|
+
} else if (65535 >= g) {
|
|
5268
5270
|
if (c + 2 >= d)
|
|
5269
5271
|
break;
|
|
5270
|
-
b[c++] = 224 |
|
|
5271
|
-
b[c++] = 128 |
|
|
5272
|
-
b[c++] = 128 |
|
|
5272
|
+
b[c++] = 224 | g >> 12;
|
|
5273
|
+
b[c++] = 128 | g >> 6 & 63;
|
|
5274
|
+
b[c++] = 128 | g & 63;
|
|
5273
5275
|
} else {
|
|
5274
5276
|
if (c + 3 >= d)
|
|
5275
5277
|
break;
|
|
5276
|
-
b[c++] = 240 |
|
|
5277
|
-
b[c++] = 128 |
|
|
5278
|
-
b[c++] = 128 |
|
|
5279
|
-
b[c++] = 128 |
|
|
5280
|
-
|
|
5278
|
+
b[c++] = 240 | g >> 18;
|
|
5279
|
+
b[c++] = 128 | g >> 12 & 63;
|
|
5280
|
+
b[c++] = 128 | g >> 6 & 63;
|
|
5281
|
+
b[c++] = 128 | g & 63;
|
|
5282
|
+
e++;
|
|
5281
5283
|
}
|
|
5282
5284
|
}
|
|
5283
5285
|
b[c] = 0;
|
|
5284
5286
|
}
|
|
5285
|
-
a = S.alloc(b,
|
|
5287
|
+
a = S.alloc(b, wa);
|
|
5286
5288
|
for (c = 0;c < b.length; c++)
|
|
5287
|
-
|
|
5289
|
+
wa[a + c] = b[c];
|
|
5288
5290
|
return a;
|
|
5289
5291
|
}
|
|
5290
5292
|
return a;
|
|
5291
5293
|
}
|
|
5292
|
-
function T() {
|
|
5293
|
-
throw "cannot construct a Language, no constructor in IDL";
|
|
5294
|
-
}
|
|
5295
|
-
T.prototype = Object.create(Q.prototype);
|
|
5296
|
-
T.prototype.constructor = T;
|
|
5297
|
-
T.prototype.I = T;
|
|
5298
|
-
T.K = {};
|
|
5299
|
-
E.Language = T;
|
|
5300
|
-
T.prototype.getLanguageCode = function() {
|
|
5301
|
-
return La(Na(this.A));
|
|
5302
|
-
};
|
|
5303
|
-
T.prototype.__destroy__ = function() {
|
|
5304
|
-
Oa(this.A);
|
|
5305
|
-
};
|
|
5306
5294
|
function U() {
|
|
5307
|
-
throw "cannot construct a
|
|
5295
|
+
throw "cannot construct a Language, no constructor in IDL";
|
|
5308
5296
|
}
|
|
5309
5297
|
U.prototype = Object.create(Q.prototype);
|
|
5310
5298
|
U.prototype.constructor = U;
|
|
5311
|
-
U.prototype.
|
|
5312
|
-
U.
|
|
5313
|
-
E.
|
|
5299
|
+
U.prototype.J = U;
|
|
5300
|
+
U.L = {};
|
|
5301
|
+
E.Language = U;
|
|
5302
|
+
U.prototype.getLanguageCode = function() {
|
|
5303
|
+
return Ma(Oa(this.B));
|
|
5304
|
+
};
|
|
5314
5305
|
U.prototype.__destroy__ = function() {
|
|
5315
|
-
Pa(this.
|
|
5306
|
+
Pa(this.B);
|
|
5316
5307
|
};
|
|
5317
5308
|
function V() {
|
|
5318
|
-
throw "cannot construct a
|
|
5309
|
+
throw "cannot construct a VoidPtr, no constructor in IDL";
|
|
5319
5310
|
}
|
|
5320
|
-
V.prototype = Object.create(
|
|
5311
|
+
V.prototype = Object.create(Q.prototype);
|
|
5321
5312
|
V.prototype.constructor = V;
|
|
5322
|
-
V.prototype.
|
|
5323
|
-
V.
|
|
5324
|
-
E.
|
|
5325
|
-
V.prototype.getPercent = function() {
|
|
5326
|
-
return Qa(this.A);
|
|
5327
|
-
};
|
|
5328
|
-
V.prototype.getLanguageCode = function() {
|
|
5329
|
-
return La(Ra(this.A));
|
|
5330
|
-
};
|
|
5313
|
+
V.prototype.J = V;
|
|
5314
|
+
V.L = {};
|
|
5315
|
+
E.VoidPtr = V;
|
|
5331
5316
|
V.prototype.__destroy__ = function() {
|
|
5332
|
-
|
|
5317
|
+
Qa(this.B);
|
|
5333
5318
|
};
|
|
5334
5319
|
function W() {
|
|
5335
|
-
throw "cannot construct a
|
|
5320
|
+
throw "cannot construct a LanguageGuess, no constructor in IDL";
|
|
5336
5321
|
}
|
|
5337
|
-
W.prototype = Object.create(
|
|
5322
|
+
W.prototype = Object.create(U.prototype);
|
|
5338
5323
|
W.prototype.constructor = W;
|
|
5339
|
-
W.prototype.
|
|
5340
|
-
W.
|
|
5341
|
-
E.
|
|
5342
|
-
W.prototype.
|
|
5324
|
+
W.prototype.J = W;
|
|
5325
|
+
W.L = {};
|
|
5326
|
+
E.LanguageGuess = W;
|
|
5327
|
+
W.prototype.getPercent = function() {
|
|
5328
|
+
return Ra(this.B);
|
|
5329
|
+
};
|
|
5330
|
+
W.prototype.getLanguageCode = function() {
|
|
5331
|
+
return Ma(Sa(this.B));
|
|
5332
|
+
};
|
|
5333
|
+
W.prototype.__destroy__ = function() {
|
|
5334
|
+
Ta(this.B);
|
|
5335
|
+
};
|
|
5336
|
+
function X() {
|
|
5337
|
+
throw "cannot construct a LanguageInfo, no constructor in IDL";
|
|
5338
|
+
}
|
|
5339
|
+
X.prototype = Object.create(U.prototype);
|
|
5340
|
+
X.prototype.constructor = X;
|
|
5341
|
+
X.prototype.J = X;
|
|
5342
|
+
X.L = {};
|
|
5343
|
+
E.LanguageInfo = X;
|
|
5344
|
+
X.prototype.detectLanguageWithLength = function(a, b, c, d, e, g) {
|
|
5343
5345
|
S.P();
|
|
5344
|
-
a = a && typeof a === "object" ? a.
|
|
5345
|
-
b && typeof b === "object" && (b = b.
|
|
5346
|
-
c
|
|
5347
|
-
d && typeof d === "object"
|
|
5348
|
-
|
|
5349
|
-
|
|
5346
|
+
a = a && typeof a === "object" ? a.B : T(a);
|
|
5347
|
+
b && typeof b === "object" && (b = b.B);
|
|
5348
|
+
c && typeof c === "object" && (c = c.B);
|
|
5349
|
+
d = d && typeof d === "object" ? d.B : T(d);
|
|
5350
|
+
e && typeof e === "object" && (e = e.B);
|
|
5351
|
+
g = g && typeof g === "object" ? g.B : T(g);
|
|
5352
|
+
return d === undefined ? R(Ua(a, b, c), X) : e === undefined ? R(_emscripten_bind_LanguageInfo_detectLanguageWithLength_4(a, b, c, d), X) : g === undefined ? R(_emscripten_bind_LanguageInfo_detectLanguageWithLength_5(a, b, c, d, e), X) : R(Va(a, b, c, d, e, g), X);
|
|
5350
5353
|
};
|
|
5351
|
-
|
|
5352
|
-
|
|
5354
|
+
X.prototype.detectLanguage = function(a, b, c, d, e) {
|
|
5355
|
+
S.P();
|
|
5356
|
+
a = a && typeof a === "object" ? a.B : T(a);
|
|
5357
|
+
b && typeof b === "object" && (b = b.B);
|
|
5358
|
+
c = c && typeof c === "object" ? c.B : T(c);
|
|
5359
|
+
d && typeof d === "object" && (d = d.B);
|
|
5360
|
+
e = e && typeof e === "object" ? e.B : T(e);
|
|
5361
|
+
return c === undefined ? R(Wa(a, b), X) : d === undefined ? R(_emscripten_bind_LanguageInfo_detectLanguage_3(a, b, c), X) : e === undefined ? R(_emscripten_bind_LanguageInfo_detectLanguage_4(a, b, c, d), X) : R(Xa(a, b, c, d, e), X);
|
|
5353
5362
|
};
|
|
5354
|
-
|
|
5355
|
-
return
|
|
5363
|
+
X.prototype.getIsReliable = function() {
|
|
5364
|
+
return !!Ya(this.B);
|
|
5356
5365
|
};
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
a && typeof a === "object" && (a = a.A);
|
|
5360
|
-
return R(Xa(b, a), V);
|
|
5366
|
+
X.prototype.getLanguageCode = function() {
|
|
5367
|
+
return Ma(Za(this.B));
|
|
5361
5368
|
};
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5369
|
+
X.prototype.get_languages = X.prototype.$ = function(a) {
|
|
5370
|
+
var b = this.B;
|
|
5371
|
+
a && typeof a === "object" && (a = a.B);
|
|
5372
|
+
return R($a(b, a), W);
|
|
5373
|
+
};
|
|
5374
|
+
Object.defineProperty(X.prototype, "languages", { get: X.prototype.$ });
|
|
5375
|
+
X.prototype.__destroy__ = function() {
|
|
5376
|
+
ab2(this.B);
|
|
5365
5377
|
};
|
|
5366
5378
|
S.alloc = S.alloc.bind(S);
|
|
5367
5379
|
S.P = S.P.bind(S);
|
|
5368
|
-
for (var
|
|
5380
|
+
for (var Y = {
|
|
5369
5381
|
ISO_8859_1: 0,
|
|
5370
5382
|
ISO_8859_2: 1,
|
|
5371
5383
|
ISO_8859_3: 2,
|
|
@@ -5466,14 +5478,14 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
5466
5478
|
KDDI_ISO_2022_JP: 73,
|
|
5467
5479
|
ISO_2022_JP: 73,
|
|
5468
5480
|
SOFTBANK_ISO_2022_JP: 74
|
|
5469
|
-
},
|
|
5470
|
-
var
|
|
5471
|
-
|
|
5472
|
-
}
|
|
5473
|
-
E.Encodings =
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
|
|
5481
|
+
}, db = h(Object.keys(Y)), eb = db.next();!eb.done; eb = db.next()) {
|
|
5482
|
+
var fb = eb.value;
|
|
5483
|
+
fb.includes("_") && (Y[fb.replace(/_/g, "")] = Y[fb]);
|
|
5484
|
+
}
|
|
5485
|
+
E.Encodings = Y;
|
|
5486
|
+
xa ? moduleRtn = E : moduleRtn = new Promise(function(a, b) {
|
|
5487
|
+
ua = a;
|
|
5488
|
+
va = b;
|
|
5477
5489
|
});
|
|
5478
5490
|
return moduleRtn;
|
|
5479
5491
|
};
|
|
@@ -5486,7 +5498,7 @@ var require_cld2 = __commonJS((exports, module) => {
|
|
|
5486
5498
|
});
|
|
5487
5499
|
|
|
5488
5500
|
// src/lib/cld2/cld2.wasm
|
|
5489
|
-
var cld2_default = "./cld2-
|
|
5501
|
+
var cld2_default = "./cld2-22jkf0ae.wasm";
|
|
5490
5502
|
var init_cld2 = () => {};
|
|
5491
5503
|
|
|
5492
5504
|
// src/services/detector.ts
|
|
@@ -5500,6 +5512,52 @@ __export(exports_detector, {
|
|
|
5500
5512
|
import path5 from "path";
|
|
5501
5513
|
import { fileURLToPath } from "url";
|
|
5502
5514
|
import { readFile } from "fs/promises";
|
|
5515
|
+
function sanitizeInput(text) {
|
|
5516
|
+
let sanitized = text.replace(/\0/g, "");
|
|
5517
|
+
sanitized = sanitized.replace(/[\x01-\x08\x0B-\x0C\x0E-\x1F\x7F]/g, "");
|
|
5518
|
+
return sanitized;
|
|
5519
|
+
}
|
|
5520
|
+
function truncateByUtf8Bytes(text, maxBytes) {
|
|
5521
|
+
const encoder = new TextEncoder;
|
|
5522
|
+
const bytes = encoder.encode(text);
|
|
5523
|
+
if (bytes.length <= maxBytes) {
|
|
5524
|
+
return text;
|
|
5525
|
+
}
|
|
5526
|
+
let truncated = bytes.slice(0, maxBytes);
|
|
5527
|
+
while (truncated.length > 0) {
|
|
5528
|
+
try {
|
|
5529
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(truncated);
|
|
5530
|
+
} catch {
|
|
5531
|
+
truncated = truncated.slice(0, -1);
|
|
5532
|
+
}
|
|
5533
|
+
}
|
|
5534
|
+
return "";
|
|
5535
|
+
}
|
|
5536
|
+
function validateAndSanitizeInput(text, maxBytes = MAX_DETECTION_BYTES) {
|
|
5537
|
+
if (!text || text.length === 0) {
|
|
5538
|
+
return text;
|
|
5539
|
+
}
|
|
5540
|
+
const sanitized = sanitizeInput(text);
|
|
5541
|
+
const truncated = truncateByUtf8Bytes(sanitized, maxBytes);
|
|
5542
|
+
if (truncated !== text) {
|
|
5543
|
+
debug(`Input sanitized/truncated: ${text.length} → ${truncated.length} chars (limit: ${maxBytes})`);
|
|
5544
|
+
}
|
|
5545
|
+
return truncated;
|
|
5546
|
+
}
|
|
5547
|
+
function handleCldError(error2, context) {
|
|
5548
|
+
const errStr = error2.toString();
|
|
5549
|
+
if (errStr.includes("RuntimeError") || errStr.includes("memory access")) {
|
|
5550
|
+
error("CLD2 crashed (RuntimeError), resetting module", {
|
|
5551
|
+
error: errStr,
|
|
5552
|
+
stack: error2.stack,
|
|
5553
|
+
textLength: context?.text?.length,
|
|
5554
|
+
textPreview: context?.text?.substring(0, 100),
|
|
5555
|
+
operation: context?.operation
|
|
5556
|
+
});
|
|
5557
|
+
cldModule = null;
|
|
5558
|
+
initPromise = null;
|
|
5559
|
+
}
|
|
5560
|
+
}
|
|
5503
5561
|
async function initCLD() {
|
|
5504
5562
|
if (cldModule)
|
|
5505
5563
|
return;
|
|
@@ -5517,8 +5575,13 @@ async function initCLD() {
|
|
|
5517
5575
|
printErr: (msg) => error(`[CLD2 Error]: ${msg}`),
|
|
5518
5576
|
wasmBinary: wasmBuffer
|
|
5519
5577
|
});
|
|
5520
|
-
if (module.LanguageInfo && module.LanguageInfo.prototype
|
|
5521
|
-
|
|
5578
|
+
if (module.LanguageInfo && module.LanguageInfo.prototype) {
|
|
5579
|
+
if (module.LanguageInfo.prototype.detectLanguage) {
|
|
5580
|
+
module.LanguageInfo.detectLanguage = module.LanguageInfo.prototype.detectLanguage;
|
|
5581
|
+
}
|
|
5582
|
+
if (module.LanguageInfo.prototype.detectLanguageWithLength) {
|
|
5583
|
+
module.LanguageInfo.detectLanguageWithLength = module.LanguageInfo.prototype.detectLanguageWithLength;
|
|
5584
|
+
}
|
|
5522
5585
|
}
|
|
5523
5586
|
cldModule = module;
|
|
5524
5587
|
debug("CLD2 language detector initialized");
|
|
@@ -5529,15 +5592,25 @@ async function initCLD() {
|
|
|
5529
5592
|
})();
|
|
5530
5593
|
return initPromise;
|
|
5531
5594
|
}
|
|
5532
|
-
function detectLanguageWithCLD(text, isHTML = false) {
|
|
5595
|
+
function detectLanguageWithCLD(text, isHTML = false, maxBytes = MAX_DETECTION_BYTES) {
|
|
5533
5596
|
if (!cldModule) {
|
|
5534
5597
|
throw new Error("CLD2 module not initialized");
|
|
5535
5598
|
}
|
|
5599
|
+
const validatedText = validateAndSanitizeInput(text, maxBytes);
|
|
5600
|
+
if (!validatedText) {
|
|
5601
|
+
warn("Input validation resulted in empty text");
|
|
5602
|
+
return {
|
|
5603
|
+
language: "un",
|
|
5604
|
+
confident: false,
|
|
5605
|
+
languages: [],
|
|
5606
|
+
percentScore: 0
|
|
5607
|
+
};
|
|
5608
|
+
}
|
|
5536
5609
|
const LanguageInfo = cldModule.LanguageInfo;
|
|
5537
5610
|
if (!LanguageInfo || !LanguageInfo.detectLanguage) {
|
|
5538
5611
|
throw new Error("CLD2 LanguageInfo or detectLanguage not available");
|
|
5539
5612
|
}
|
|
5540
|
-
const result = LanguageInfo.detectLanguage(
|
|
5613
|
+
const result = LanguageInfo.detectLanguage(validatedText, !isHTML);
|
|
5541
5614
|
const languages = Array(3).fill(0).map((_, i) => {
|
|
5542
5615
|
const lang = result.get_languages(i);
|
|
5543
5616
|
return {
|
|
@@ -5562,26 +5635,27 @@ function bcp47Normalize(code) {
|
|
|
5562
5635
|
return code.toLowerCase();
|
|
5563
5636
|
}
|
|
5564
5637
|
}
|
|
5565
|
-
async function detectLanguage(text) {
|
|
5638
|
+
async function detectLanguage(text, maxBytes = MAX_DETECTION_BYTES) {
|
|
5566
5639
|
if (!text) {
|
|
5567
5640
|
return "";
|
|
5568
5641
|
}
|
|
5569
5642
|
await initCLD();
|
|
5570
5643
|
try {
|
|
5571
|
-
const result = detectLanguageWithCLD(text);
|
|
5644
|
+
const result = detectLanguageWithCLD(text, false, maxBytes);
|
|
5572
5645
|
return bcp47Normalize(result.language);
|
|
5573
5646
|
} catch (error2) {
|
|
5574
5647
|
warn(`Language detection failed: ${error2}`);
|
|
5648
|
+
handleCldError(error2, { text, operation: "detectLanguage" });
|
|
5575
5649
|
return "en";
|
|
5576
5650
|
}
|
|
5577
5651
|
}
|
|
5578
|
-
async function detectLanguageWithConfidence(text, minConfidence = DEFAULT_CONFIDENCE_THRESHOLD) {
|
|
5652
|
+
async function detectLanguageWithConfidence(text, minConfidence = DEFAULT_CONFIDENCE_THRESHOLD, maxBytes = MAX_DETECTION_BYTES) {
|
|
5579
5653
|
if (!text) {
|
|
5580
5654
|
return { language: "", confidence: 0 };
|
|
5581
5655
|
}
|
|
5582
5656
|
await initCLD();
|
|
5583
5657
|
try {
|
|
5584
|
-
const result = detectLanguageWithCLD(text);
|
|
5658
|
+
const result = detectLanguageWithCLD(text, false, maxBytes);
|
|
5585
5659
|
const confidence = result.percentScore / 100;
|
|
5586
5660
|
if (confidence < minConfidence) {
|
|
5587
5661
|
return { language: "", confidence };
|
|
@@ -5592,6 +5666,7 @@ async function detectLanguageWithConfidence(text, minConfidence = DEFAULT_CONFID
|
|
|
5592
5666
|
};
|
|
5593
5667
|
} catch (error2) {
|
|
5594
5668
|
warn(`Language detection with confidence failed: ${error2}`);
|
|
5669
|
+
handleCldError(error2, { text, operation: "detectLanguageWithConfidence" });
|
|
5595
5670
|
return { language: "en", confidence: 0 };
|
|
5596
5671
|
}
|
|
5597
5672
|
}
|
|
@@ -5611,6 +5686,28 @@ function hasMixedScripts(text) {
|
|
|
5611
5686
|
}
|
|
5612
5687
|
return false;
|
|
5613
5688
|
}
|
|
5689
|
+
function getScriptType(text) {
|
|
5690
|
+
let hasCJK = false;
|
|
5691
|
+
let hasLatin = false;
|
|
5692
|
+
for (const char of text) {
|
|
5693
|
+
const code = char.charCodeAt(0);
|
|
5694
|
+
if (code >= 19968 && code <= 40959 || code >= 12352 && code <= 12447 || code >= 12448 && code <= 12543 || code >= 44032 && code <= 55215) {
|
|
5695
|
+
hasCJK = true;
|
|
5696
|
+
} else if (code >= 65 && code <= 90 || code >= 97 && code <= 122) {
|
|
5697
|
+
hasLatin = true;
|
|
5698
|
+
}
|
|
5699
|
+
if (hasCJK && hasLatin)
|
|
5700
|
+
return "Mixed";
|
|
5701
|
+
}
|
|
5702
|
+
if (hasCJK)
|
|
5703
|
+
return "CJK";
|
|
5704
|
+
if (hasLatin)
|
|
5705
|
+
return "Latin";
|
|
5706
|
+
return "Other";
|
|
5707
|
+
}
|
|
5708
|
+
function isCJKLanguage(lang) {
|
|
5709
|
+
return ["zh", "zh-Hans", "zh-Hant", "ja", "ko"].includes(lang) || lang.startsWith("zh-");
|
|
5710
|
+
}
|
|
5614
5711
|
async function detectMultipleLanguages(text) {
|
|
5615
5712
|
return detectMultipleLanguagesWithThreshold(text, DEFAULT_CONFIDENCE_THRESHOLD);
|
|
5616
5713
|
}
|
|
@@ -5619,7 +5716,7 @@ async function detectMultipleLanguagesWithThreshold(text, threshold) {
|
|
|
5619
5716
|
return [];
|
|
5620
5717
|
}
|
|
5621
5718
|
await initCLD();
|
|
5622
|
-
const fallbackLang = await detectLanguage(text);
|
|
5719
|
+
const fallbackLang = await detectLanguage(text, MAX_FALLBACK_DETECTION_BYTES);
|
|
5623
5720
|
const effectiveFallback = fallbackLang || "en";
|
|
5624
5721
|
if (!hasMixedScripts(text)) {
|
|
5625
5722
|
debug(`DetectMultipleLanguages: no mixed scripts, using single language: ${effectiveFallback}`);
|
|
@@ -5637,18 +5734,43 @@ async function detectMultipleLanguagesWithThreshold(text, threshold) {
|
|
|
5637
5734
|
const sentenceSegments = Array.from(segmenterAny.segment(text));
|
|
5638
5735
|
for (const { segment, index } of sentenceSegments) {
|
|
5639
5736
|
try {
|
|
5737
|
+
await initCLD();
|
|
5640
5738
|
const result = detectLanguageWithCLD(segment);
|
|
5641
5739
|
const detectedLang = bcp47Normalize(result.language);
|
|
5642
5740
|
const confidence = result.percentScore / 100;
|
|
5741
|
+
const scriptType = getScriptType(segment);
|
|
5742
|
+
let finalLang = effectiveFallback;
|
|
5743
|
+
let usedLogic = "fallback";
|
|
5744
|
+
if (confidence >= threshold) {
|
|
5745
|
+
finalLang = detectedLang;
|
|
5746
|
+
usedLogic = "confidence";
|
|
5747
|
+
} else {
|
|
5748
|
+
if (scriptType === "Latin" && isCJKLanguage(effectiveFallback)) {
|
|
5749
|
+
if (detectedLang && detectedLang !== "un") {
|
|
5750
|
+
finalLang = detectedLang;
|
|
5751
|
+
usedLogic = "script-override-latin";
|
|
5752
|
+
} else {
|
|
5753
|
+
finalLang = "en";
|
|
5754
|
+
usedLogic = "script-override-en";
|
|
5755
|
+
}
|
|
5756
|
+
} else if (scriptType === "CJK" && !isCJKLanguage(effectiveFallback)) {
|
|
5757
|
+
if (detectedLang && detectedLang !== "un") {
|
|
5758
|
+
finalLang = detectedLang;
|
|
5759
|
+
usedLogic = "script-override-cjk";
|
|
5760
|
+
}
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5763
|
+
debug(`Segment[${segments.length}]: "${segment.replace(/\n/g, "\\n")}" -> lang=${detectedLang}, conf=${confidence.toFixed(2)}, script=${scriptType}, final=${finalLang} (${usedLogic})`);
|
|
5643
5764
|
segments.push({
|
|
5644
5765
|
text: segment,
|
|
5645
|
-
language:
|
|
5766
|
+
language: finalLang,
|
|
5646
5767
|
start: index,
|
|
5647
5768
|
end: index + segment.length,
|
|
5648
5769
|
confidence
|
|
5649
5770
|
});
|
|
5650
5771
|
} catch (error2) {
|
|
5651
5772
|
warn(`Failed to detect language for segment: ${error2}`);
|
|
5773
|
+
handleCldError(error2, { text: segment, operation: "detectMultipleLanguages" });
|
|
5652
5774
|
segments.push({
|
|
5653
5775
|
text: segment,
|
|
5654
5776
|
language: effectiveFallback,
|
|
@@ -5708,7 +5830,7 @@ function limitLanguages(segments, originalText, maxLangs) {
|
|
|
5708
5830
|
debug(`limitLanguages: reduced to ${maxLangs} languages, ${result.length} segments`);
|
|
5709
5831
|
return result;
|
|
5710
5832
|
}
|
|
5711
|
-
var import_cld2, DEFAULT_CONFIDENCE_THRESHOLD = 0.5, MAXIMUM_LANGUAGES_IN_ONE_TEXT = 2, cldModule = null, initPromise = null;
|
|
5833
|
+
var import_cld2, DEFAULT_CONFIDENCE_THRESHOLD = 0.5, MAXIMUM_LANGUAGES_IN_ONE_TEXT = 2, MAX_DETECTION_BYTES = 512, MAX_FALLBACK_DETECTION_BYTES = 1024, cldModule = null, initPromise = null;
|
|
5712
5834
|
var init_detector = __esm(() => {
|
|
5713
5835
|
init_cld2();
|
|
5714
5836
|
init_logger();
|
|
@@ -5743,11 +5865,11 @@ class Stack {
|
|
|
5743
5865
|
return this.heap[--this.length];
|
|
5744
5866
|
}
|
|
5745
5867
|
}
|
|
5746
|
-
var
|
|
5868
|
+
var defaultPerf, warned, PROCESS, emitWarning = (msg, type, code, fn) => {
|
|
5747
5869
|
typeof PROCESS.emitWarning === "function" ? PROCESS.emitWarning(msg, type, code, fn) : console.error(`[${code}] ${type}: ${msg}`);
|
|
5748
5870
|
}, AC, AS, shouldWarn = (code) => !warned.has(code), TYPE, isPosInt = (n) => n && n === Math.floor(n) && n > 0 && isFinite(n), getUintArray = (max) => !isPosInt(max) ? null : max <= Math.pow(2, 8) ? Uint8Array : max <= Math.pow(2, 16) ? Uint16Array : max <= Math.pow(2, 32) ? Uint32Array : max <= Number.MAX_SAFE_INTEGER ? ZeroArray : null, ZeroArray, LRUCache;
|
|
5749
5871
|
var init_esm2 = __esm(() => {
|
|
5750
|
-
|
|
5872
|
+
defaultPerf = typeof performance === "object" && performance && typeof performance.now === "function" ? performance : Date;
|
|
5751
5873
|
warned = new Set;
|
|
5752
5874
|
PROCESS = typeof process === "object" && !!process ? process : {};
|
|
5753
5875
|
AC = globalThis.AbortController;
|
|
@@ -5797,9 +5919,14 @@ var init_esm2 = __esm(() => {
|
|
|
5797
5919
|
#max;
|
|
5798
5920
|
#maxSize;
|
|
5799
5921
|
#dispose;
|
|
5922
|
+
#onInsert;
|
|
5800
5923
|
#disposeAfter;
|
|
5801
5924
|
#fetchMethod;
|
|
5802
5925
|
#memoMethod;
|
|
5926
|
+
#perf;
|
|
5927
|
+
get perf() {
|
|
5928
|
+
return this.#perf;
|
|
5929
|
+
}
|
|
5803
5930
|
ttl;
|
|
5804
5931
|
ttlResolution;
|
|
5805
5932
|
ttlAutopurge;
|
|
@@ -5829,13 +5956,16 @@ var init_esm2 = __esm(() => {
|
|
|
5829
5956
|
#sizes;
|
|
5830
5957
|
#starts;
|
|
5831
5958
|
#ttls;
|
|
5959
|
+
#autopurgeTimers;
|
|
5832
5960
|
#hasDispose;
|
|
5833
5961
|
#hasFetchMethod;
|
|
5834
5962
|
#hasDisposeAfter;
|
|
5963
|
+
#hasOnInsert;
|
|
5835
5964
|
static unsafeExposeInternals(c) {
|
|
5836
5965
|
return {
|
|
5837
5966
|
starts: c.#starts,
|
|
5838
5967
|
ttls: c.#ttls,
|
|
5968
|
+
autopurgeTimers: c.#autopurgeTimers,
|
|
5839
5969
|
sizes: c.#sizes,
|
|
5840
5970
|
keyMap: c.#keyMap,
|
|
5841
5971
|
keyList: c.#keyList,
|
|
@@ -5878,11 +6008,20 @@ var init_esm2 = __esm(() => {
|
|
|
5878
6008
|
get dispose() {
|
|
5879
6009
|
return this.#dispose;
|
|
5880
6010
|
}
|
|
6011
|
+
get onInsert() {
|
|
6012
|
+
return this.#onInsert;
|
|
6013
|
+
}
|
|
5881
6014
|
get disposeAfter() {
|
|
5882
6015
|
return this.#disposeAfter;
|
|
5883
6016
|
}
|
|
5884
6017
|
constructor(options) {
|
|
5885
|
-
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort } = options;
|
|
6018
|
+
const { max = 0, ttl, ttlResolution = 1, ttlAutopurge, updateAgeOnGet, updateAgeOnHas, allowStale, dispose, onInsert, disposeAfter, noDisposeOnSet, noUpdateTTL, maxSize = 0, maxEntrySize = 0, sizeCalculation, fetchMethod, memoMethod, noDeleteOnFetchRejection, noDeleteOnStaleGet, allowStaleOnFetchRejection, allowStaleOnFetchAbort, ignoreFetchAbort, perf } = options;
|
|
6019
|
+
if (perf !== undefined) {
|
|
6020
|
+
if (typeof perf?.now !== "function") {
|
|
6021
|
+
throw new TypeError("perf option must have a now() method if specified");
|
|
6022
|
+
}
|
|
6023
|
+
}
|
|
6024
|
+
this.#perf = perf ?? defaultPerf;
|
|
5886
6025
|
if (max !== 0 && !isPosInt(max)) {
|
|
5887
6026
|
throw new TypeError("max option must be a nonnegative integer");
|
|
5888
6027
|
}
|
|
@@ -5924,6 +6063,9 @@ var init_esm2 = __esm(() => {
|
|
|
5924
6063
|
if (typeof dispose === "function") {
|
|
5925
6064
|
this.#dispose = dispose;
|
|
5926
6065
|
}
|
|
6066
|
+
if (typeof onInsert === "function") {
|
|
6067
|
+
this.#onInsert = onInsert;
|
|
6068
|
+
}
|
|
5927
6069
|
if (typeof disposeAfter === "function") {
|
|
5928
6070
|
this.#disposeAfter = disposeAfter;
|
|
5929
6071
|
this.#disposed = [];
|
|
@@ -5932,6 +6074,7 @@ var init_esm2 = __esm(() => {
|
|
|
5932
6074
|
this.#disposed = undefined;
|
|
5933
6075
|
}
|
|
5934
6076
|
this.#hasDispose = !!this.#dispose;
|
|
6077
|
+
this.#hasOnInsert = !!this.#onInsert;
|
|
5935
6078
|
this.#hasDisposeAfter = !!this.#disposeAfter;
|
|
5936
6079
|
this.noDisposeOnSet = !!noDisposeOnSet;
|
|
5937
6080
|
this.noUpdateTTL = !!noUpdateTTL;
|
|
@@ -5983,10 +6126,16 @@ var init_esm2 = __esm(() => {
|
|
|
5983
6126
|
const starts = new ZeroArray(this.#max);
|
|
5984
6127
|
this.#ttls = ttls;
|
|
5985
6128
|
this.#starts = starts;
|
|
5986
|
-
|
|
6129
|
+
const purgeTimers = this.ttlAutopurge ? new Array(this.#max) : undefined;
|
|
6130
|
+
this.#autopurgeTimers = purgeTimers;
|
|
6131
|
+
this.#setItemTTL = (index, ttl, start = this.#perf.now()) => {
|
|
5987
6132
|
starts[index] = ttl !== 0 ? start : 0;
|
|
5988
6133
|
ttls[index] = ttl;
|
|
5989
|
-
if (
|
|
6134
|
+
if (purgeTimers?.[index]) {
|
|
6135
|
+
clearTimeout(purgeTimers[index]);
|
|
6136
|
+
purgeTimers[index] = undefined;
|
|
6137
|
+
}
|
|
6138
|
+
if (ttl !== 0 && purgeTimers) {
|
|
5990
6139
|
const t = setTimeout(() => {
|
|
5991
6140
|
if (this.#isStale(index)) {
|
|
5992
6141
|
this.#delete(this.#keyList[index], "expire");
|
|
@@ -5995,10 +6144,11 @@ var init_esm2 = __esm(() => {
|
|
|
5995
6144
|
if (t.unref) {
|
|
5996
6145
|
t.unref();
|
|
5997
6146
|
}
|
|
6147
|
+
purgeTimers[index] = t;
|
|
5998
6148
|
}
|
|
5999
6149
|
};
|
|
6000
6150
|
this.#updateItemAge = (index) => {
|
|
6001
|
-
starts[index] = ttls[index] !== 0 ? perf.now() : 0;
|
|
6151
|
+
starts[index] = ttls[index] !== 0 ? this.#perf.now() : 0;
|
|
6002
6152
|
};
|
|
6003
6153
|
this.#statusTTL = (status, index) => {
|
|
6004
6154
|
if (ttls[index]) {
|
|
@@ -6015,7 +6165,7 @@ var init_esm2 = __esm(() => {
|
|
|
6015
6165
|
};
|
|
6016
6166
|
let cachedNow = 0;
|
|
6017
6167
|
const getNow = () => {
|
|
6018
|
-
const n = perf.now();
|
|
6168
|
+
const n = this.#perf.now();
|
|
6019
6169
|
if (this.ttlResolution > 0) {
|
|
6020
6170
|
cachedNow = n;
|
|
6021
6171
|
const t = setTimeout(() => cachedNow = 0, this.ttlResolution);
|
|
@@ -6237,7 +6387,7 @@ var init_esm2 = __esm(() => {
|
|
|
6237
6387
|
const ttl = this.#ttls[i];
|
|
6238
6388
|
const start = this.#starts[i];
|
|
6239
6389
|
if (ttl && start) {
|
|
6240
|
-
const remain = ttl - (perf.now() - start);
|
|
6390
|
+
const remain = ttl - (this.#perf.now() - start);
|
|
6241
6391
|
entry.ttl = remain;
|
|
6242
6392
|
entry.start = Date.now();
|
|
6243
6393
|
}
|
|
@@ -6258,7 +6408,7 @@ var init_esm2 = __esm(() => {
|
|
|
6258
6408
|
const entry = { value };
|
|
6259
6409
|
if (this.#ttls && this.#starts) {
|
|
6260
6410
|
entry.ttl = this.#ttls[i];
|
|
6261
|
-
const age = perf.now() - this.#starts[i];
|
|
6411
|
+
const age = this.#perf.now() - this.#starts[i];
|
|
6262
6412
|
entry.start = Math.floor(Date.now() - age);
|
|
6263
6413
|
}
|
|
6264
6414
|
if (this.#sizes) {
|
|
@@ -6273,7 +6423,7 @@ var init_esm2 = __esm(() => {
|
|
|
6273
6423
|
for (const [key, entry] of arr) {
|
|
6274
6424
|
if (entry.start) {
|
|
6275
6425
|
const age = Date.now() - entry.start;
|
|
6276
|
-
entry.start = perf.now() - age;
|
|
6426
|
+
entry.start = this.#perf.now() - age;
|
|
6277
6427
|
}
|
|
6278
6428
|
this.set(key, entry.value, entry);
|
|
6279
6429
|
}
|
|
@@ -6308,6 +6458,9 @@ var init_esm2 = __esm(() => {
|
|
|
6308
6458
|
if (status)
|
|
6309
6459
|
status.set = "add";
|
|
6310
6460
|
noUpdateTTL = false;
|
|
6461
|
+
if (this.#hasOnInsert) {
|
|
6462
|
+
this.#onInsert?.(v, k, "add");
|
|
6463
|
+
}
|
|
6311
6464
|
} else {
|
|
6312
6465
|
this.#moveToTail(index);
|
|
6313
6466
|
const oldVal = this.#valList[index];
|
|
@@ -6343,6 +6496,9 @@ var init_esm2 = __esm(() => {
|
|
|
6343
6496
|
} else if (status) {
|
|
6344
6497
|
status.set = "update";
|
|
6345
6498
|
}
|
|
6499
|
+
if (this.#hasOnInsert) {
|
|
6500
|
+
this.onInsert?.(v, k, v === oldVal ? "update" : "replace");
|
|
6501
|
+
}
|
|
6346
6502
|
}
|
|
6347
6503
|
if (ttl !== 0 && !this.#ttls) {
|
|
6348
6504
|
this.#initializeTTLTracking();
|
|
@@ -6401,6 +6557,10 @@ var init_esm2 = __esm(() => {
|
|
|
6401
6557
|
}
|
|
6402
6558
|
}
|
|
6403
6559
|
this.#removeItemSize(head);
|
|
6560
|
+
if (this.#autopurgeTimers?.[head]) {
|
|
6561
|
+
clearTimeout(this.#autopurgeTimers[head]);
|
|
6562
|
+
this.#autopurgeTimers[head] = undefined;
|
|
6563
|
+
}
|
|
6404
6564
|
if (free) {
|
|
6405
6565
|
this.#keyList[head] = undefined;
|
|
6406
6566
|
this.#valList[head] = undefined;
|
|
@@ -6483,9 +6643,10 @@ var init_esm2 = __esm(() => {
|
|
|
6483
6643
|
return fetchFail(ac.signal.reason);
|
|
6484
6644
|
}
|
|
6485
6645
|
const bf2 = p;
|
|
6486
|
-
|
|
6646
|
+
const vl = this.#valList[index];
|
|
6647
|
+
if (vl === p || ignoreAbort && updateCache && vl === undefined) {
|
|
6487
6648
|
if (v2 === undefined) {
|
|
6488
|
-
if (bf2.__staleWhileFetching) {
|
|
6649
|
+
if (bf2.__staleWhileFetching !== undefined) {
|
|
6489
6650
|
this.#valList[index] = bf2.__staleWhileFetching;
|
|
6490
6651
|
} else {
|
|
6491
6652
|
this.#delete(k, "fetch");
|
|
@@ -6734,6 +6895,10 @@ var init_esm2 = __esm(() => {
|
|
|
6734
6895
|
if (this.#size !== 0) {
|
|
6735
6896
|
const index = this.#keyMap.get(k);
|
|
6736
6897
|
if (index !== undefined) {
|
|
6898
|
+
if (this.#autopurgeTimers?.[index]) {
|
|
6899
|
+
clearTimeout(this.#autopurgeTimers?.[index]);
|
|
6900
|
+
this.#autopurgeTimers[index] = undefined;
|
|
6901
|
+
}
|
|
6737
6902
|
deleted = true;
|
|
6738
6903
|
if (this.#size === 1) {
|
|
6739
6904
|
this.#clear(reason);
|
|
@@ -6801,6 +6966,11 @@ var init_esm2 = __esm(() => {
|
|
|
6801
6966
|
if (this.#ttls && this.#starts) {
|
|
6802
6967
|
this.#ttls.fill(0);
|
|
6803
6968
|
this.#starts.fill(0);
|
|
6969
|
+
for (const t of this.#autopurgeTimers ?? []) {
|
|
6970
|
+
if (t !== undefined)
|
|
6971
|
+
clearTimeout(t);
|
|
6972
|
+
}
|
|
6973
|
+
this.#autopurgeTimers?.fill(undefined);
|
|
6804
6974
|
}
|
|
6805
6975
|
if (this.#sizes) {
|
|
6806
6976
|
this.#sizes.fill(0);
|
|
@@ -7110,7 +7280,7 @@ var init_services = __esm(() => {
|
|
|
7110
7280
|
});
|
|
7111
7281
|
|
|
7112
7282
|
// src/utils/lang-alias.ts
|
|
7113
|
-
function
|
|
7283
|
+
function NormalizeLanguageCode(code) {
|
|
7114
7284
|
if (!code)
|
|
7115
7285
|
return "";
|
|
7116
7286
|
const normalized = code.toLowerCase().replace(/_/g, "-");
|
|
@@ -7209,10 +7379,10 @@ var init_memory = () => {};
|
|
|
7209
7379
|
// src/utils/index.ts
|
|
7210
7380
|
var exports_utils = {};
|
|
7211
7381
|
__export(exports_utils, {
|
|
7212
|
-
normalizeLanguageCode: () => normalizeLanguageCode,
|
|
7213
7382
|
getLargestVersion: () => getLargestVersion,
|
|
7214
7383
|
getFreePort: () => getFreePort,
|
|
7215
|
-
getAvailableMemoryMB: () => getAvailableMemoryMB
|
|
7384
|
+
getAvailableMemoryMB: () => getAvailableMemoryMB,
|
|
7385
|
+
NormalizeLanguageCode: () => NormalizeLanguageCode
|
|
7216
7386
|
});
|
|
7217
7387
|
var init_utils = __esm(() => {
|
|
7218
7388
|
init_lang_alias();
|
|
@@ -7237,16 +7407,16 @@ class MTran {
|
|
|
7237
7407
|
await initRecords();
|
|
7238
7408
|
}
|
|
7239
7409
|
async translate(from, to, text, html = false) {
|
|
7240
|
-
const normalizedFrom = from === "auto" ? "auto" :
|
|
7241
|
-
const normalizedTo =
|
|
7410
|
+
const normalizedFrom = from === "auto" ? "auto" : NormalizeLanguageCode(from);
|
|
7411
|
+
const normalizedTo = NormalizeLanguageCode(to);
|
|
7242
7412
|
return translateWithPivot(normalizedFrom, normalizedTo, text, html);
|
|
7243
7413
|
}
|
|
7244
7414
|
async detect(text) {
|
|
7245
7415
|
return detectLanguage(text);
|
|
7246
7416
|
}
|
|
7247
7417
|
async downloadModel(from, to) {
|
|
7248
|
-
const normalizedFrom =
|
|
7249
|
-
const normalizedTo =
|
|
7418
|
+
const normalizedFrom = NormalizeLanguageCode(from);
|
|
7419
|
+
const normalizedTo = NormalizeLanguageCode(to);
|
|
7250
7420
|
await downloadModel(normalizedTo, normalizedFrom);
|
|
7251
7421
|
}
|
|
7252
7422
|
async close() {
|
|
@@ -7263,7 +7433,6 @@ init_models();
|
|
|
7263
7433
|
init_utils();
|
|
7264
7434
|
export {
|
|
7265
7435
|
setConfig,
|
|
7266
|
-
normalizeLanguageCode,
|
|
7267
7436
|
initRecords,
|
|
7268
7437
|
hasLanguagePair,
|
|
7269
7438
|
globalRecords,
|
|
@@ -7275,8 +7444,9 @@ export {
|
|
|
7275
7444
|
getConfig,
|
|
7276
7445
|
getAvailableMemoryMB,
|
|
7277
7446
|
downloadModel,
|
|
7447
|
+
NormalizeLanguageCode,
|
|
7278
7448
|
MTran
|
|
7279
7449
|
};
|
|
7280
7450
|
|
|
7281
|
-
//# debugId=
|
|
7451
|
+
//# debugId=370A66A1D6D9E42264756E2164756E21
|
|
7282
7452
|
//# sourceMappingURL=index.js.map
|