@pie-element/simple-cloze 0.1.4-next.12 → 0.1.4-next.14
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/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/{i18n-BDkxR45Z.js → i18n-gsOjC7sf.js} +292 -253
- package/dist/browser/editor-runtime/i18n-gsOjC7sf.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/{i18n-BDkxR45Z.js → i18n-gsOjC7sf.js} +292 -253
- package/dist/browser/i18n-gsOjC7sf.js.map +1 -0
- package/dist/browser/print/index.js +1 -1
- package/dist/delivery/index.js +107 -61
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/print/index.js +107 -61
- package/dist/print/index.js.map +1 -1
- package/module/print.js +241 -202
- package/module/print.js.map +1 -1
- package/package.json +5 -1
- package/dist/browser/editor-runtime/i18n-BDkxR45Z.js.map +0 -1
- package/dist/browser/i18n-BDkxR45Z.js.map +0 -1
|
@@ -1,83 +1,122 @@
|
|
|
1
1
|
//#region ../../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
-
var e =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
2
|
+
var e = {
|
|
3
|
+
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
4
|
+
overarc: "\\overparen",
|
|
5
|
+
napprox: "\\not\\approx",
|
|
6
|
+
longdiv: "\\enclose{longdiv}",
|
|
7
|
+
abs: ["\\left|#1\\right|", 1]
|
|
8
|
+
}, t = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", n = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, r = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, i = /\\embed\{newLine\}\[\]/g, a = [
|
|
9
|
+
["$$", "$$"],
|
|
10
|
+
["$", "$"],
|
|
11
|
+
["\\[", "\\]"],
|
|
12
|
+
["\\(", "\\)"]
|
|
13
|
+
], o = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading");
|
|
14
|
+
function s() {
|
|
15
|
+
return window.MathJax;
|
|
16
|
+
}
|
|
17
|
+
function c(e) {
|
|
18
|
+
let t = e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e;
|
|
19
|
+
for (let [e, n] of a) if (t.startsWith(e) && t.endsWith(n)) return t.substring(e.length, t.length - n.length);
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
function l(e) {
|
|
23
|
+
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
24
|
+
if (t.dataset.mathHandled || t.closest("mjx-container")) continue;
|
|
25
|
+
let e = t.textContent;
|
|
26
|
+
e && (t.textContent = `\\(${c(e)}\\)`.replace(i, "\\newline "), t.dataset.mathHandled = "true");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function u(e, t) {
|
|
30
|
+
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
31
|
+
return (t ? r : n).test(e.textContent ?? "");
|
|
32
|
+
}
|
|
33
|
+
function d(n) {
|
|
34
|
+
return new Promise((r, i) => {
|
|
35
|
+
let { useSingleDollar: a = !1, accessibility: o = !0, loadFonts: c = !0, srcUrl: l } = n, u = {
|
|
36
|
+
loader: {
|
|
37
|
+
load: o ? ["a11y/assistive-mml"] : [],
|
|
38
|
+
failed: (e) => i(e)
|
|
27
39
|
},
|
|
28
40
|
startup: {
|
|
41
|
+
typeset: !1,
|
|
29
42
|
ready: () => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
43
|
+
let e = s()?.startup;
|
|
44
|
+
e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => r(), i);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
tex: { macros: { ...e } },
|
|
48
|
+
options: {
|
|
49
|
+
enableMenu: o,
|
|
50
|
+
menuOptions: { settings: {
|
|
51
|
+
assistiveMml: o,
|
|
52
|
+
enrich: !1,
|
|
53
|
+
inTabOrder: !1
|
|
54
|
+
} }
|
|
33
55
|
}
|
|
34
56
|
};
|
|
35
|
-
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
setTimeout(e, 100);
|
|
39
|
-
}, c.onerror = () => {
|
|
40
|
-
n(/* @__PURE__ */ Error("Failed to load MathJax"));
|
|
41
|
-
}, document.head.appendChild(c);
|
|
57
|
+
a && u.tex && (console.warn(t), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), c || (u.chtml = { fontURL: "" }), window.MathJax = u;
|
|
58
|
+
let d = document.createElement("script");
|
|
59
|
+
d.src = l || "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", d.async = !0, d.onerror = () => i(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(d);
|
|
42
60
|
});
|
|
43
|
-
return n[e] = i, i;
|
|
44
61
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
e.
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
function f(e) {
|
|
63
|
+
return new Promise((t, n) => {
|
|
64
|
+
let r = e.startup ?? {};
|
|
65
|
+
e.startup = r;
|
|
66
|
+
let i = r.ready;
|
|
67
|
+
r.ready = () => {
|
|
68
|
+
let e = s()?.startup;
|
|
69
|
+
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function p(e) {
|
|
74
|
+
let t = s();
|
|
75
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : f(t) : d(e);
|
|
52
76
|
}
|
|
53
|
-
function
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
77
|
+
function m(e) {
|
|
78
|
+
return p(e).then(() => {
|
|
79
|
+
typeof s()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function h(e) {
|
|
83
|
+
let t = globalThis, n = t[o];
|
|
84
|
+
return n || (n = m(e), t[o] = n), n;
|
|
85
|
+
}
|
|
86
|
+
function g(e = {}) {
|
|
87
|
+
let t = e.useSingleDollar ?? !1;
|
|
88
|
+
return async (n) => {
|
|
89
|
+
if (typeof window > "u") return;
|
|
90
|
+
l(n);
|
|
91
|
+
let r = h(e);
|
|
92
|
+
if (!u(n, t)) {
|
|
93
|
+
r.catch(() => {});
|
|
57
94
|
return;
|
|
58
95
|
}
|
|
59
|
-
await
|
|
96
|
+
await r;
|
|
97
|
+
let i = s();
|
|
98
|
+
await i?.startup?.promise, typeof i?.typesetPromise == "function" && await i.typesetPromise([n]);
|
|
60
99
|
};
|
|
61
100
|
}
|
|
62
|
-
var
|
|
63
|
-
function
|
|
64
|
-
return
|
|
65
|
-
accessibility: !0,
|
|
66
|
-
useSingleDollar: !0
|
|
67
|
-
}), a;
|
|
101
|
+
var _ = "@pie-lib/math-rendering", v = "@pie-lib/math-rendering@2", y = null;
|
|
102
|
+
function b() {
|
|
103
|
+
return !!window[v]?.opts?.useSingleDollar;
|
|
68
104
|
}
|
|
69
|
-
function
|
|
105
|
+
function x() {
|
|
106
|
+
return y ||= g({ useSingleDollar: b() }), y;
|
|
107
|
+
}
|
|
108
|
+
function S() {
|
|
70
109
|
if (typeof window > "u") return null;
|
|
71
|
-
let e = window[
|
|
110
|
+
let e = window[_];
|
|
72
111
|
return typeof e?.renderMath == "function" ? e : null;
|
|
73
112
|
}
|
|
74
|
-
var
|
|
113
|
+
var ee = async (e) => {
|
|
75
114
|
if (typeof window > "u") return;
|
|
76
115
|
let t = typeof e == "string", n;
|
|
77
116
|
t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
|
|
78
|
-
let r =
|
|
79
|
-
return r ? await r.renderMath?.(n) : await
|
|
80
|
-
},
|
|
117
|
+
let r = S();
|
|
118
|
+
return r ? await r.renderMath?.(n) : await x()(n), t ? n.innerHTML : void 0;
|
|
119
|
+
}, C = {
|
|
81
120
|
translation: {
|
|
82
121
|
categorize: {
|
|
83
122
|
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
@@ -217,7 +256,7 @@ var c = async (e) => {
|
|
|
217
256
|
hideNote: "Hide Note",
|
|
218
257
|
cancel: "Cancel"
|
|
219
258
|
}
|
|
220
|
-
},
|
|
259
|
+
}, w = {
|
|
221
260
|
translation: {
|
|
222
261
|
categorize: {
|
|
223
262
|
limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
|
|
@@ -357,55 +396,55 @@ var c = async (e) => {
|
|
|
357
396
|
hideNote: "Ocultar Nota",
|
|
358
397
|
cancel: "Cancelar"
|
|
359
398
|
}
|
|
360
|
-
},
|
|
399
|
+
}, T = (e) => typeof e == "string", E = () => {
|
|
361
400
|
let e, t, n = new Promise((n, r) => {
|
|
362
401
|
e = n, t = r;
|
|
363
402
|
});
|
|
364
403
|
return n.resolve = e, n.reject = t, n;
|
|
365
|
-
},
|
|
404
|
+
}, D = (e) => e == null ? "" : "" + e, O = (e, t, n) => {
|
|
366
405
|
e.forEach((e) => {
|
|
367
406
|
t[e] && (n[e] = t[e]);
|
|
368
407
|
});
|
|
369
|
-
},
|
|
370
|
-
let r =
|
|
408
|
+
}, te = /###/g, k = (e) => e && e.indexOf("###") > -1 ? e.replace(te, ".") : e, ne = (e) => !e || T(e), A = (e, t, n) => {
|
|
409
|
+
let r = T(t) ? t.split(".") : t, i = 0;
|
|
371
410
|
for (; i < r.length - 1;) {
|
|
372
|
-
if (
|
|
373
|
-
let t =
|
|
411
|
+
if (ne(e)) return {};
|
|
412
|
+
let t = k(r[i]);
|
|
374
413
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
375
414
|
}
|
|
376
|
-
return
|
|
415
|
+
return ne(e) ? {} : {
|
|
377
416
|
obj: e,
|
|
378
|
-
k:
|
|
417
|
+
k: k(r[i])
|
|
379
418
|
};
|
|
380
|
-
},
|
|
381
|
-
let { obj: r, k: i } =
|
|
419
|
+
}, re = (e, t, n) => {
|
|
420
|
+
let { obj: r, k: i } = A(e, t, Object);
|
|
382
421
|
if (r !== void 0 || t.length === 1) {
|
|
383
422
|
r[i] = n;
|
|
384
423
|
return;
|
|
385
424
|
}
|
|
386
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
387
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
425
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = A(e, o, Object);
|
|
426
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = A(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
388
427
|
s.obj[`${s.k}.${a}`] = n;
|
|
389
|
-
},
|
|
390
|
-
let { obj: i, k: a } =
|
|
428
|
+
}, ie = (e, t, n, r) => {
|
|
429
|
+
let { obj: i, k: a } = A(e, t, Object);
|
|
391
430
|
i[a] = i[a] || [], i[a].push(n);
|
|
392
|
-
},
|
|
393
|
-
let { obj: n, k: r } =
|
|
431
|
+
}, j = (e, t) => {
|
|
432
|
+
let { obj: n, k: r } = A(e, t);
|
|
394
433
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
395
|
-
},
|
|
396
|
-
let r =
|
|
397
|
-
return r === void 0 ?
|
|
398
|
-
},
|
|
399
|
-
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ?
|
|
434
|
+
}, ae = (e, t, n) => {
|
|
435
|
+
let r = j(e, n);
|
|
436
|
+
return r === void 0 ? j(t, n) : r;
|
|
437
|
+
}, M = (e, t, n) => {
|
|
438
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? T(e[r]) || e[r] instanceof String || T(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : M(e[r], t[r], n) : e[r] = t[r]);
|
|
400
439
|
return e;
|
|
401
|
-
},
|
|
440
|
+
}, N = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), oe = {
|
|
402
441
|
"&": "&",
|
|
403
442
|
"<": "<",
|
|
404
443
|
">": ">",
|
|
405
444
|
"\"": """,
|
|
406
445
|
"'": "'",
|
|
407
446
|
"/": "/"
|
|
408
|
-
},
|
|
447
|
+
}, se = (e) => T(e) ? e.replace(/[&<>"'\/]/g, (e) => oe[e]) : e, ce = class {
|
|
409
448
|
constructor(e) {
|
|
410
449
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
411
450
|
}
|
|
@@ -415,23 +454,23 @@ var c = async (e) => {
|
|
|
415
454
|
let n = new RegExp(e);
|
|
416
455
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
417
456
|
}
|
|
418
|
-
},
|
|
457
|
+
}, le = [
|
|
419
458
|
" ",
|
|
420
459
|
",",
|
|
421
460
|
"?",
|
|
422
461
|
"!",
|
|
423
462
|
";"
|
|
424
|
-
],
|
|
463
|
+
], ue = new ce(20), de = (e, t, n) => {
|
|
425
464
|
t ||= "", n ||= "";
|
|
426
|
-
let r =
|
|
465
|
+
let r = le.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
427
466
|
if (r.length === 0) return !0;
|
|
428
|
-
let i =
|
|
467
|
+
let i = ue.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
429
468
|
if (!a) {
|
|
430
469
|
let t = e.indexOf(n);
|
|
431
470
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
432
471
|
}
|
|
433
472
|
return a;
|
|
434
|
-
},
|
|
473
|
+
}, P = (e, t, n = ".") => {
|
|
435
474
|
if (!e) return;
|
|
436
475
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
437
476
|
let r = t.split(n), i = e;
|
|
@@ -450,7 +489,7 @@ var c = async (e) => {
|
|
|
450
489
|
i = t;
|
|
451
490
|
}
|
|
452
491
|
return i;
|
|
453
|
-
},
|
|
492
|
+
}, F = (e) => e?.replace(/_/g, "-"), fe = {
|
|
454
493
|
type: "logger",
|
|
455
494
|
log(e) {
|
|
456
495
|
this.output("log", e);
|
|
@@ -464,12 +503,12 @@ var c = async (e) => {
|
|
|
464
503
|
output(e, t) {
|
|
465
504
|
console?.[e]?.apply?.(console, t);
|
|
466
505
|
}
|
|
467
|
-
},
|
|
506
|
+
}, I = new class e {
|
|
468
507
|
constructor(e, t = {}) {
|
|
469
508
|
this.init(e, t);
|
|
470
509
|
}
|
|
471
510
|
init(e, t = {}) {
|
|
472
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
511
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || fe, this.options = t, this.debug = t.debug;
|
|
473
512
|
}
|
|
474
513
|
log(...e) {
|
|
475
514
|
return this.forward(e, "log", "", !0);
|
|
@@ -484,7 +523,7 @@ var c = async (e) => {
|
|
|
484
523
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
485
524
|
}
|
|
486
525
|
forward(e, t, n, r) {
|
|
487
|
-
return r && !this.debug ? null : (
|
|
526
|
+
return r && !this.debug ? null : (T(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
488
527
|
}
|
|
489
528
|
create(t) {
|
|
490
529
|
return new e(this.logger, {
|
|
@@ -495,7 +534,7 @@ var c = async (e) => {
|
|
|
495
534
|
clone(t) {
|
|
496
535
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
497
536
|
}
|
|
498
|
-
}(),
|
|
537
|
+
}(), L = class {
|
|
499
538
|
constructor() {
|
|
500
539
|
this.observers = {};
|
|
501
540
|
}
|
|
@@ -522,7 +561,7 @@ var c = async (e) => {
|
|
|
522
561
|
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
523
562
|
});
|
|
524
563
|
}
|
|
525
|
-
},
|
|
564
|
+
}, pe = class extends L {
|
|
526
565
|
constructor(e, t = {
|
|
527
566
|
ns: ["translation"],
|
|
528
567
|
defaultNS: "translation"
|
|
@@ -538,16 +577,16 @@ var c = async (e) => {
|
|
|
538
577
|
}
|
|
539
578
|
getResource(e, t, n, r = {}) {
|
|
540
579
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
541
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
542
|
-
let s =
|
|
543
|
-
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !
|
|
580
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : T(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
581
|
+
let s = j(this.data, o);
|
|
582
|
+
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !T(n) ? s : P(this.data?.[e]?.[t], n, i);
|
|
544
583
|
}
|
|
545
584
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
546
585
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
547
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
586
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), re(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
548
587
|
}
|
|
549
588
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
550
|
-
for (let r in n) (
|
|
589
|
+
for (let r in n) (T(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
551
590
|
r.silent || this.emit("added", e, t, n);
|
|
552
591
|
}
|
|
553
592
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -556,11 +595,11 @@ var c = async (e) => {
|
|
|
556
595
|
}) {
|
|
557
596
|
let o = [e, t];
|
|
558
597
|
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
559
|
-
let s =
|
|
560
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
598
|
+
let s = j(this.data, o) || {};
|
|
599
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? M(s, n, i) : s = {
|
|
561
600
|
...s,
|
|
562
601
|
...n
|
|
563
|
-
},
|
|
602
|
+
}, re(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
564
603
|
}
|
|
565
604
|
removeResourceBundle(e, t) {
|
|
566
605
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -581,7 +620,7 @@ var c = async (e) => {
|
|
|
581
620
|
toJSON() {
|
|
582
621
|
return this.data;
|
|
583
622
|
}
|
|
584
|
-
},
|
|
623
|
+
}, R = {
|
|
585
624
|
processors: {},
|
|
586
625
|
addPostProcessor(e) {
|
|
587
626
|
this.processors[e.name] = e;
|
|
@@ -591,22 +630,22 @@ var c = async (e) => {
|
|
|
591
630
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
592
631
|
}), t;
|
|
593
632
|
}
|
|
594
|
-
},
|
|
595
|
-
function
|
|
633
|
+
}, z = Symbol("i18next/PATH_KEY");
|
|
634
|
+
function me() {
|
|
596
635
|
let e = [], t = Object.create(null), n;
|
|
597
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
636
|
+
return t.get = (r, i) => (n?.revoke?.(), i === z ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
598
637
|
}
|
|
599
|
-
function
|
|
600
|
-
let { [
|
|
638
|
+
function B(e, t) {
|
|
639
|
+
let { [z]: n } = e(me()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
601
640
|
if (n.length > 1 && i) {
|
|
602
641
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
603
642
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
604
643
|
}
|
|
605
644
|
return n.join(r);
|
|
606
645
|
}
|
|
607
|
-
var
|
|
646
|
+
var V = {}, H = (e) => !T(e) && typeof e != "boolean" && typeof e != "number", U = class e extends L {
|
|
608
647
|
constructor(e, t = {}) {
|
|
609
|
-
super(),
|
|
648
|
+
super(), O([
|
|
610
649
|
"resourceStore",
|
|
611
650
|
"languageUtils",
|
|
612
651
|
"pluralResolver",
|
|
@@ -614,7 +653,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
614
653
|
"backendConnector",
|
|
615
654
|
"i18nFormat",
|
|
616
655
|
"utils"
|
|
617
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
656
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = I.create("translator");
|
|
618
657
|
}
|
|
619
658
|
changeLanguage(e) {
|
|
620
659
|
e && (this.language = e);
|
|
@@ -624,95 +663,95 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
624
663
|
if (e == null) return !1;
|
|
625
664
|
let r = this.resolve(e, n);
|
|
626
665
|
if (r?.res === void 0) return !1;
|
|
627
|
-
let i =
|
|
666
|
+
let i = H(r.res);
|
|
628
667
|
return !(n.returnObjects === !1 && i);
|
|
629
668
|
}
|
|
630
669
|
extractFromKey(e, t) {
|
|
631
670
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
632
671
|
n === void 0 && (n = ":");
|
|
633
|
-
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !
|
|
672
|
+
let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !de(e, n, r);
|
|
634
673
|
if (a && !o) {
|
|
635
674
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
636
675
|
if (t && t.length > 0) return {
|
|
637
676
|
key: e,
|
|
638
|
-
namespaces:
|
|
677
|
+
namespaces: T(i) ? [i] : i
|
|
639
678
|
};
|
|
640
679
|
let a = e.split(n);
|
|
641
680
|
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
642
681
|
}
|
|
643
682
|
return {
|
|
644
683
|
key: e,
|
|
645
|
-
namespaces:
|
|
684
|
+
namespaces: T(i) ? [i] : i
|
|
646
685
|
};
|
|
647
686
|
}
|
|
648
687
|
translate(t, n, r) {
|
|
649
688
|
let i = typeof n == "object" ? { ...n } : n;
|
|
650
689
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
651
|
-
typeof t == "function" && (t =
|
|
690
|
+
typeof t == "function" && (t = B(t, {
|
|
652
691
|
...this.options,
|
|
653
692
|
...i
|
|
654
|
-
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ?
|
|
693
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? B(e, {
|
|
655
694
|
...this.options,
|
|
656
695
|
...i
|
|
657
696
|
}) : String(e));
|
|
658
697
|
let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), l = c[c.length - 1], u = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
|
|
659
698
|
u === void 0 && (u = ":");
|
|
660
|
-
let
|
|
661
|
-
if (
|
|
699
|
+
let d = i.lng || this.language, f = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
700
|
+
if (d?.toLowerCase() === "cimode") return f ? a ? {
|
|
662
701
|
res: `${l}${u}${s}`,
|
|
663
702
|
usedKey: s,
|
|
664
703
|
exactUsedKey: s,
|
|
665
|
-
usedLng:
|
|
704
|
+
usedLng: d,
|
|
666
705
|
usedNS: l,
|
|
667
706
|
usedParams: this.getUsedParamsDetails(i)
|
|
668
707
|
} : `${l}${u}${s}` : a ? {
|
|
669
708
|
res: s,
|
|
670
709
|
usedKey: s,
|
|
671
710
|
exactUsedKey: s,
|
|
672
|
-
usedLng:
|
|
711
|
+
usedLng: d,
|
|
673
712
|
usedNS: l,
|
|
674
713
|
usedParams: this.getUsedParamsDetails(i)
|
|
675
714
|
} : s;
|
|
676
|
-
let
|
|
715
|
+
let p = this.resolve(t, i), m = p?.res, h = p?.usedKey || s, g = p?.exactUsedKey || s, _ = [
|
|
677
716
|
"[object Number]",
|
|
678
717
|
"[object Function]",
|
|
679
718
|
"[object RegExp]"
|
|
680
|
-
],
|
|
681
|
-
|
|
682
|
-
let
|
|
683
|
-
if (
|
|
719
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !T(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", ee = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", C = b && !i.ordinal && i.count === 0, w = C && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${ee}`] || i.defaultValue, E = m;
|
|
720
|
+
y && !m && x && (E = w);
|
|
721
|
+
let D = H(E), O = Object.prototype.toString.apply(E);
|
|
722
|
+
if (y && E && D && _.indexOf(O) < 0 && !(T(v) && Array.isArray(E))) {
|
|
684
723
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
685
724
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
686
|
-
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(
|
|
725
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
|
|
687
726
|
...i,
|
|
688
727
|
ns: c
|
|
689
728
|
}) : `key '${s} (${this.language})' returned an object instead of string.`;
|
|
690
|
-
return a ? (
|
|
729
|
+
return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
|
|
691
730
|
}
|
|
692
731
|
if (o) {
|
|
693
|
-
let e = Array.isArray(
|
|
694
|
-
for (let e in
|
|
732
|
+
let e = Array.isArray(E), t = e ? [] : {}, n = e ? g : h;
|
|
733
|
+
for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
|
|
695
734
|
let r = `${n}${o}${e}`;
|
|
696
|
-
|
|
735
|
+
x && !m ? t[e] = this.translate(r, {
|
|
697
736
|
...i,
|
|
698
|
-
defaultValue:
|
|
737
|
+
defaultValue: H(w) ? w[e] : void 0,
|
|
699
738
|
joinArrays: !1,
|
|
700
739
|
ns: c
|
|
701
740
|
}) : t[e] = this.translate(r, {
|
|
702
741
|
...i,
|
|
703
742
|
joinArrays: !1,
|
|
704
743
|
ns: c
|
|
705
|
-
}), t[e] === r && (t[e] =
|
|
744
|
+
}), t[e] === r && (t[e] = E[e]);
|
|
706
745
|
}
|
|
707
|
-
|
|
746
|
+
m = t;
|
|
708
747
|
}
|
|
709
|
-
} else if (
|
|
748
|
+
} else if (y && T(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
|
|
710
749
|
else {
|
|
711
750
|
let e = !1, n = !1;
|
|
712
|
-
!this.isValidLookup(
|
|
713
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 :
|
|
751
|
+
!this.isValidLookup(m) && x && (e = !0, m = w), this.isValidLookup(m) || (n = !0, m = s);
|
|
752
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && w !== m && this.options.updateMissing;
|
|
714
753
|
if (n || e || c) {
|
|
715
|
-
if (this.logger.log(c ? "updateKey" : "missingKey",
|
|
754
|
+
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? w : m), o) {
|
|
716
755
|
let e = this.resolve(s, {
|
|
717
756
|
...i,
|
|
718
757
|
keySeparator: !1
|
|
@@ -723,19 +762,19 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
723
762
|
if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
|
|
724
763
|
else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
|
|
725
764
|
let n = (e, t, n) => {
|
|
726
|
-
let r =
|
|
727
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t,
|
|
765
|
+
let r = x && n !== m ? n : a;
|
|
766
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t, m);
|
|
728
767
|
};
|
|
729
|
-
this.options.saveMissing && (this.options.saveMissingPlurals &&
|
|
768
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
|
|
730
769
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
731
|
-
|
|
732
|
-
n([e], s + t, i[`defaultValue${t}`] ||
|
|
770
|
+
C && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
771
|
+
n([e], s + t, i[`defaultValue${t}`] || w);
|
|
733
772
|
});
|
|
734
|
-
}) : n(e, s,
|
|
773
|
+
}) : n(e, s, w));
|
|
735
774
|
}
|
|
736
|
-
|
|
775
|
+
m = this.extendTranslation(m, t, i, p, r), n && m === s && this.options.appendNamespaceToMissingKey && (m = `${l}${u}${s}`), (n || e) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${u}${s}` : s, e ? m : void 0, i));
|
|
737
776
|
}
|
|
738
|
-
return a ? (
|
|
777
|
+
return a ? (p.res = m, p.usedParams = this.getUsedParamsDetails(i), p) : m;
|
|
739
778
|
}
|
|
740
779
|
extendTranslation(e, t, n, r, i) {
|
|
741
780
|
if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
|
|
@@ -750,12 +789,12 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
750
789
|
...n.interpolation
|
|
751
790
|
}
|
|
752
791
|
});
|
|
753
|
-
let a =
|
|
792
|
+
let a = T(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
754
793
|
if (a) {
|
|
755
794
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
756
795
|
o = t && t.length;
|
|
757
796
|
}
|
|
758
|
-
let s = n.replace && !
|
|
797
|
+
let s = n.replace && !T(n.replace) ? n.replace : n;
|
|
759
798
|
if (this.options.interpolation.defaultVariables && (s = {
|
|
760
799
|
...this.options.interpolation.defaultVariables,
|
|
761
800
|
...s
|
|
@@ -765,8 +804,8 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
765
804
|
}
|
|
766
805
|
!n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
|
|
767
806
|
}
|
|
768
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
769
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
807
|
+
let a = n.postProcess || this.options.postProcess, o = T(a) ? [a] : a;
|
|
808
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = R.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
770
809
|
i18nResolved: {
|
|
771
810
|
...r,
|
|
772
811
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -776,7 +815,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
776
815
|
}
|
|
777
816
|
resolve(e, t = {}) {
|
|
778
817
|
let n, r, i, a, o;
|
|
779
|
-
return
|
|
818
|
+
return T(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? B(e, {
|
|
780
819
|
...this.options,
|
|
781
820
|
...t
|
|
782
821
|
}) : e)), e.forEach((e) => {
|
|
@@ -785,9 +824,9 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
785
824
|
r = c;
|
|
786
825
|
let l = s.namespaces;
|
|
787
826
|
this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
|
|
788
|
-
let u = t.count !== void 0 && !
|
|
827
|
+
let u = t.count !== void 0 && !T(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (T(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
789
828
|
l.forEach((e) => {
|
|
790
|
-
this.isValidLookup(n) || (o = e, !
|
|
829
|
+
this.isValidLookup(n) || (o = e, !V[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (V[`${p[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${p.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((r) => {
|
|
791
830
|
if (this.isValidLookup(n)) return;
|
|
792
831
|
a = r;
|
|
793
832
|
let o = [c];
|
|
@@ -796,9 +835,9 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
796
835
|
let e;
|
|
797
836
|
u && (e = this.pluralResolver.getSuffix(r, t.count, t));
|
|
798
837
|
let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
799
|
-
if (u && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e),
|
|
838
|
+
if (u && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), d && o.push(c + n)), f) {
|
|
800
839
|
let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
801
|
-
o.push(r), u && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e),
|
|
840
|
+
o.push(r), u && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), d && o.push(r + n));
|
|
802
841
|
}
|
|
803
842
|
}
|
|
804
843
|
let s;
|
|
@@ -836,7 +875,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
836
875
|
"joinArrays",
|
|
837
876
|
"postProcess",
|
|
838
877
|
"interpolation"
|
|
839
|
-
], n = e.replace && !
|
|
878
|
+
], n = e.replace && !T(e.replace), r = n ? e.replace : e;
|
|
840
879
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
841
880
|
...this.options.interpolation.defaultVariables,
|
|
842
881
|
...r
|
|
@@ -850,22 +889,22 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
850
889
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
851
890
|
return !1;
|
|
852
891
|
}
|
|
853
|
-
},
|
|
892
|
+
}, W = class {
|
|
854
893
|
constructor(e) {
|
|
855
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
894
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = I.create("languageUtils");
|
|
856
895
|
}
|
|
857
896
|
getScriptPartFromCode(e) {
|
|
858
|
-
if (e =
|
|
897
|
+
if (e = F(e), !e || e.indexOf("-") < 0) return null;
|
|
859
898
|
let t = e.split("-");
|
|
860
899
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
861
900
|
}
|
|
862
901
|
getLanguagePartFromCode(e) {
|
|
863
|
-
if (e =
|
|
902
|
+
if (e = F(e), !e || e.indexOf("-") < 0) return e;
|
|
864
903
|
let t = e.split("-");
|
|
865
904
|
return this.formatLanguageCode(t[0]);
|
|
866
905
|
}
|
|
867
906
|
formatLanguageCode(e) {
|
|
868
|
-
if (
|
|
907
|
+
if (T(e) && e.indexOf("-") > -1) {
|
|
869
908
|
let t;
|
|
870
909
|
try {
|
|
871
910
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -897,7 +936,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
897
936
|
}
|
|
898
937
|
getFallbackCodes(e, t) {
|
|
899
938
|
if (!e) return [];
|
|
900
|
-
if (typeof e == "function" && (e = e(t)),
|
|
939
|
+
if (typeof e == "function" && (e = e(t)), T(e) && (e = [e]), Array.isArray(e)) return e;
|
|
901
940
|
if (!t) return e.default || [];
|
|
902
941
|
let n = e[t];
|
|
903
942
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -906,29 +945,29 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
906
945
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
907
946
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
908
947
|
};
|
|
909
|
-
return
|
|
948
|
+
return T(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : T(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
910
949
|
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
911
950
|
}), r;
|
|
912
951
|
}
|
|
913
|
-
},
|
|
952
|
+
}, G = {
|
|
914
953
|
zero: 0,
|
|
915
954
|
one: 1,
|
|
916
955
|
two: 2,
|
|
917
956
|
few: 3,
|
|
918
957
|
many: 4,
|
|
919
958
|
other: 5
|
|
920
|
-
},
|
|
959
|
+
}, K = {
|
|
921
960
|
select: (e) => e === 1 ? "one" : "other",
|
|
922
961
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
923
|
-
},
|
|
962
|
+
}, he = class {
|
|
924
963
|
constructor(e, t = {}) {
|
|
925
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
964
|
+
this.languageUtils = e, this.options = t, this.logger = I.create("pluralResolver"), this.pluralRulesCache = {};
|
|
926
965
|
}
|
|
927
966
|
clearCache() {
|
|
928
967
|
this.pluralRulesCache = {};
|
|
929
968
|
}
|
|
930
969
|
getRule(e, t = {}) {
|
|
931
|
-
let n =
|
|
970
|
+
let n = F(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
932
971
|
cleanedCode: n,
|
|
933
972
|
type: r
|
|
934
973
|
});
|
|
@@ -937,8 +976,8 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
937
976
|
try {
|
|
938
977
|
a = new Intl.PluralRules(n, { type: r });
|
|
939
978
|
} catch {
|
|
940
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
941
|
-
if (!e.match(/-|_/)) return
|
|
979
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), K;
|
|
980
|
+
if (!e.match(/-|_/)) return K;
|
|
942
981
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
943
982
|
a = this.getRule(n, t);
|
|
944
983
|
}
|
|
@@ -953,23 +992,23 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
953
992
|
}
|
|
954
993
|
getSuffixes(e, t = {}) {
|
|
955
994
|
let n = this.getRule(e, t);
|
|
956
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
995
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => G[e] - G[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
957
996
|
}
|
|
958
997
|
getSuffix(e, t, n = {}) {
|
|
959
998
|
let r = this.getRule(e, n);
|
|
960
999
|
return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
961
1000
|
}
|
|
962
|
-
},
|
|
963
|
-
let a =
|
|
964
|
-
return !a && i &&
|
|
965
|
-
},
|
|
1001
|
+
}, q = (e, t, n, r = ".", i = !0) => {
|
|
1002
|
+
let a = ae(e, t, n);
|
|
1003
|
+
return !a && i && T(n) && (a = P(e, n, r), a === void 0 && (a = P(t, n, r))), a;
|
|
1004
|
+
}, J = (e) => e.replace(/\$/g, "$$$$"), Y = class {
|
|
966
1005
|
constructor(e = {}) {
|
|
967
|
-
this.logger =
|
|
1006
|
+
this.logger = I.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
968
1007
|
}
|
|
969
1008
|
init(e = {}) {
|
|
970
1009
|
e.interpolation ||= { escapeValue: !0 };
|
|
971
1010
|
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
|
|
972
|
-
this.escape = t === void 0 ?
|
|
1011
|
+
this.escape = t === void 0 ? se : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? N(i) : a || "{{", this.suffix = o ? N(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? N(d) : f || N("$t("), this.nestingSuffix = p ? N(p) : m || N(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
973
1012
|
}
|
|
974
1013
|
reset() {
|
|
975
1014
|
this.options && this.init(this.options);
|
|
@@ -981,7 +1020,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
981
1020
|
interpolate(e, t, n, r) {
|
|
982
1021
|
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
983
1022
|
if (e.indexOf(this.formatSeparator) < 0) {
|
|
984
|
-
let i =
|
|
1023
|
+
let i = q(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
985
1024
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
986
1025
|
...r,
|
|
987
1026
|
...t,
|
|
@@ -989,7 +1028,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
989
1028
|
}) : i;
|
|
990
1029
|
}
|
|
991
1030
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
992
|
-
return this.format(
|
|
1031
|
+
return this.format(q(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
993
1032
|
...r,
|
|
994
1033
|
...t,
|
|
995
1034
|
interpolationkey: a
|
|
@@ -999,22 +1038,22 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
999
1038
|
let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
1000
1039
|
return [{
|
|
1001
1040
|
regex: this.regexpUnescape,
|
|
1002
|
-
safeValue: (e) =>
|
|
1041
|
+
safeValue: (e) => J(e)
|
|
1003
1042
|
}, {
|
|
1004
1043
|
regex: this.regexp,
|
|
1005
|
-
safeValue: (e) => this.escapeValue ?
|
|
1044
|
+
safeValue: (e) => this.escapeValue ? J(this.escape(e)) : J(e)
|
|
1006
1045
|
}].forEach((t) => {
|
|
1007
1046
|
for (o = 0; i = t.regex.exec(e);) {
|
|
1008
1047
|
let n = i[1].trim();
|
|
1009
1048
|
if (a = c(n), a === void 0) if (typeof l == "function") {
|
|
1010
1049
|
let t = l(e, i, r);
|
|
1011
|
-
a =
|
|
1050
|
+
a = T(t) ? t : "";
|
|
1012
1051
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
1013
1052
|
else if (u) {
|
|
1014
1053
|
a = i[0];
|
|
1015
1054
|
continue;
|
|
1016
1055
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
1017
|
-
else !
|
|
1056
|
+
else !T(a) && !this.useRawValueToEscape && (a = D(a));
|
|
1018
1057
|
let s = t.safeValue(a);
|
|
1019
1058
|
if (e = e.replace(i[0], s), u ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
|
|
1020
1059
|
}
|
|
@@ -1024,7 +1063,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1024
1063
|
let r, i, a, o = (e, t) => {
|
|
1025
1064
|
let n = this.nestingOptionsSeparator;
|
|
1026
1065
|
if (e.indexOf(n) < 0) return e;
|
|
1027
|
-
let r = e.split(RegExp(`${
|
|
1066
|
+
let r = e.split(RegExp(`${N(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
1028
1067
|
e = r[0], i = this.interpolate(i, a);
|
|
1029
1068
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
1030
1069
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -1040,17 +1079,17 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1040
1079
|
};
|
|
1041
1080
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
1042
1081
|
let s = [];
|
|
1043
|
-
a = { ...n }, a = a.replace && !
|
|
1082
|
+
a = { ...n }, a = a.replace && !T(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
1044
1083
|
let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
1045
|
-
if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !
|
|
1046
|
-
|
|
1084
|
+
if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !T(i)) return i;
|
|
1085
|
+
T(i) || (i = D(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
|
|
1047
1086
|
...n,
|
|
1048
1087
|
interpolationkey: r[1].trim()
|
|
1049
1088
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
1050
1089
|
}
|
|
1051
1090
|
return e;
|
|
1052
1091
|
}
|
|
1053
|
-
},
|
|
1092
|
+
}, ge = (e) => {
|
|
1054
1093
|
let t = e.toLowerCase().trim(), n = {};
|
|
1055
1094
|
if (e.indexOf("(") > -1) {
|
|
1056
1095
|
let r = e.split("(");
|
|
@@ -1067,7 +1106,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1067
1106
|
formatName: t,
|
|
1068
1107
|
formatOptions: n
|
|
1069
1108
|
};
|
|
1070
|
-
},
|
|
1109
|
+
}, X = (e) => {
|
|
1071
1110
|
let t = {};
|
|
1072
1111
|
return (n, r, i) => {
|
|
1073
1112
|
let a = i;
|
|
@@ -1076,15 +1115,15 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1076
1115
|
[i.interpolationkey]: void 0
|
|
1077
1116
|
});
|
|
1078
1117
|
let o = r + JSON.stringify(a), s = t[o];
|
|
1079
|
-
return s || (s = e(
|
|
1118
|
+
return s || (s = e(F(r), i), t[o] = s), s(n);
|
|
1080
1119
|
};
|
|
1081
|
-
},
|
|
1120
|
+
}, _e = (e) => (t, n, r) => e(F(n), r)(t), ve = class {
|
|
1082
1121
|
constructor(e = {}) {
|
|
1083
|
-
this.logger =
|
|
1122
|
+
this.logger = I.create("formatter"), this.options = e, this.init(e);
|
|
1084
1123
|
}
|
|
1085
1124
|
init(e, t = { interpolation: {} }) {
|
|
1086
1125
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
1087
|
-
let n = t.cacheInBuiltFormats ?
|
|
1126
|
+
let n = t.cacheInBuiltFormats ? X : _e;
|
|
1088
1127
|
this.formats = {
|
|
1089
1128
|
number: n((e, t) => {
|
|
1090
1129
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -1115,7 +1154,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1115
1154
|
this.formats[e.toLowerCase().trim()] = t;
|
|
1116
1155
|
}
|
|
1117
1156
|
addCached(e, t) {
|
|
1118
|
-
this.formats[e.toLowerCase().trim()] =
|
|
1157
|
+
this.formats[e.toLowerCase().trim()] = X(t);
|
|
1119
1158
|
}
|
|
1120
1159
|
format(e, t, n, r = {}) {
|
|
1121
1160
|
let i = t.split(this.formatSeparator);
|
|
@@ -1124,7 +1163,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1124
1163
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
1125
1164
|
}
|
|
1126
1165
|
return i.reduce((e, t) => {
|
|
1127
|
-
let { formatName: i, formatOptions: a } =
|
|
1166
|
+
let { formatName: i, formatOptions: a } = ge(t);
|
|
1128
1167
|
if (this.formats[i]) {
|
|
1129
1168
|
let t = e;
|
|
1130
1169
|
try {
|
|
@@ -1142,11 +1181,11 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1142
1181
|
return e;
|
|
1143
1182
|
}, e);
|
|
1144
1183
|
}
|
|
1145
|
-
},
|
|
1184
|
+
}, ye = (e, t) => {
|
|
1146
1185
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
1147
|
-
},
|
|
1186
|
+
}, be = class extends L {
|
|
1148
1187
|
constructor(e, t, n, r = {}) {
|
|
1149
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
1188
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = I.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
|
|
1150
1189
|
}
|
|
1151
1190
|
queueLoad(e, t, n, r) {
|
|
1152
1191
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -1174,7 +1213,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1174
1213
|
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
1175
1214
|
let o = {};
|
|
1176
1215
|
this.queue.forEach((n) => {
|
|
1177
|
-
|
|
1216
|
+
ie(n.loaded, [i], a), ye(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
1178
1217
|
o[e] || (o[e] = {});
|
|
1179
1218
|
let t = n.loaded[e];
|
|
1180
1219
|
t.length && t.forEach((t) => {
|
|
@@ -1223,7 +1262,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1223
1262
|
}
|
|
1224
1263
|
prepareLoading(e, t, n = {}, r) {
|
|
1225
1264
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
1226
|
-
|
|
1265
|
+
T(e) && (e = this.languageUtils.toResolveHierarchy(e)), T(t) && (t = [t]);
|
|
1227
1266
|
let i = this.queueLoad(e, t, n, r);
|
|
1228
1267
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
1229
1268
|
i.toLoad.forEach((e) => {
|
|
@@ -1264,7 +1303,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1264
1303
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
1265
1304
|
}
|
|
1266
1305
|
}
|
|
1267
|
-
},
|
|
1306
|
+
}, Z = () => ({
|
|
1268
1307
|
debug: !1,
|
|
1269
1308
|
initAsync: !0,
|
|
1270
1309
|
ns: ["translation"],
|
|
@@ -1299,7 +1338,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1299
1338
|
appendNamespaceToCIMode: !1,
|
|
1300
1339
|
overloadTranslationOptionHandler: (e) => {
|
|
1301
1340
|
let t = {};
|
|
1302
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1341
|
+
if (typeof e[1] == "object" && (t = e[1]), T(e[1]) && (t.defaultValue = e[1]), T(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1303
1342
|
let n = e[3] || e[2];
|
|
1304
1343
|
Object.keys(n).forEach((e) => {
|
|
1305
1344
|
t[e] = n[e];
|
|
@@ -1321,15 +1360,15 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1321
1360
|
skipOnVariables: !0
|
|
1322
1361
|
},
|
|
1323
1362
|
cacheInBuiltFormats: !0
|
|
1324
|
-
}),
|
|
1363
|
+
}), xe = (e) => (T(e.ns) && (e.ns = [e.ns]), T(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), T(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs?.indexOf?.("cimode") < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e), Q = () => {}, Se = (e) => {
|
|
1325
1364
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1326
1365
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1327
1366
|
});
|
|
1328
|
-
},
|
|
1329
|
-
typeof globalThis < "u" && (globalThis[
|
|
1330
|
-
},
|
|
1367
|
+
}, Ce = "__i18next_supportNoticeShown", we = () => !!(typeof globalThis < "u" && globalThis[Ce] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Te = () => {
|
|
1368
|
+
typeof globalThis < "u" && (globalThis[Ce] = !0);
|
|
1369
|
+
}, Ee = (e) => !!(e?.modules?.backend?.name?.indexOf("Locize") > 0 || e?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || e?.options?.backend?.backends && e.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0) || e?.options?.backend?.projectId || e?.options?.backend?.backendOptions && e.options.backend.backendOptions.some((e) => e?.projectId)), $ = class e extends L {
|
|
1331
1370
|
constructor(e = {}, t) {
|
|
1332
|
-
if (super(), this.options =
|
|
1371
|
+
if (super(), this.options = xe(e), this.services = {}, this.logger = I, this.modules = { external: [] }, Se(this), t && !this.isInitialized && !e.isClone) {
|
|
1333
1372
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1334
1373
|
setTimeout(() => {
|
|
1335
1374
|
this.init(e, t);
|
|
@@ -1337,36 +1376,36 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1337
1376
|
}
|
|
1338
1377
|
}
|
|
1339
1378
|
init(e = {}, t) {
|
|
1340
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1341
|
-
let n =
|
|
1379
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (T(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1380
|
+
let n = Z();
|
|
1342
1381
|
this.options = {
|
|
1343
1382
|
...n,
|
|
1344
1383
|
...this.options,
|
|
1345
|
-
...
|
|
1384
|
+
...xe(e)
|
|
1346
1385
|
}, this.options.interpolation = {
|
|
1347
1386
|
...n.interpolation,
|
|
1348
1387
|
...this.options.interpolation
|
|
1349
|
-
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !
|
|
1388
|
+
}, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !Ee(this) && !we() && (typeof console < "u" && console.info !== void 0 && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), Te());
|
|
1350
1389
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1351
1390
|
if (!this.options.isClone) {
|
|
1352
|
-
this.modules.logger ?
|
|
1391
|
+
this.modules.logger ? I.init(r(this.modules.logger), this.options) : I.init(null, this.options);
|
|
1353
1392
|
let e;
|
|
1354
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1355
|
-
let t = new
|
|
1356
|
-
this.store = new
|
|
1393
|
+
e = this.modules.formatter ? this.modules.formatter : ve;
|
|
1394
|
+
let t = new W(this.options);
|
|
1395
|
+
this.store = new pe(this.options.resources, this.options);
|
|
1357
1396
|
let i = this.services;
|
|
1358
|
-
i.logger =
|
|
1397
|
+
i.logger = I, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new he(t, {
|
|
1359
1398
|
prepend: this.options.pluralSeparator,
|
|
1360
1399
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1361
|
-
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new
|
|
1400
|
+
}), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new Y(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new be(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
1362
1401
|
this.emit(e, ...t);
|
|
1363
|
-
}), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new
|
|
1402
|
+
}), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new U(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1364
1403
|
this.emit(e, ...t);
|
|
1365
1404
|
}), this.modules.external.forEach((e) => {
|
|
1366
1405
|
e.init && e.init(this);
|
|
1367
1406
|
});
|
|
1368
1407
|
}
|
|
1369
|
-
if (this.format = this.options.interpolation.format, t ||=
|
|
1408
|
+
if (this.format = this.options.interpolation.format, t ||= Q, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1370
1409
|
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1371
1410
|
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1372
1411
|
}
|
|
@@ -1385,7 +1424,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1385
1424
|
].forEach((e) => {
|
|
1386
1425
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1387
1426
|
});
|
|
1388
|
-
let i =
|
|
1427
|
+
let i = E(), a = () => {
|
|
1389
1428
|
let e = (e, n) => {
|
|
1390
1429
|
this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), i.resolve(n), t(e, n);
|
|
1391
1430
|
};
|
|
@@ -1394,8 +1433,8 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1394
1433
|
};
|
|
1395
1434
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1396
1435
|
}
|
|
1397
|
-
loadResources(e, t =
|
|
1398
|
-
let n = t, r =
|
|
1436
|
+
loadResources(e, t = Q) {
|
|
1437
|
+
let n = t, r = T(e) ? e : this.language;
|
|
1399
1438
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1400
1439
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1401
1440
|
let e = [], t = (t) => {
|
|
@@ -1409,15 +1448,15 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1409
1448
|
} else n(null);
|
|
1410
1449
|
}
|
|
1411
1450
|
reloadResources(e, t, n) {
|
|
1412
|
-
let r =
|
|
1413
|
-
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||=
|
|
1451
|
+
let r = E();
|
|
1452
|
+
return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= Q, this.services.backendConnector.reload(e, t, (e) => {
|
|
1414
1453
|
r.resolve(), n(e);
|
|
1415
1454
|
}), r;
|
|
1416
1455
|
}
|
|
1417
1456
|
use(e) {
|
|
1418
1457
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1419
1458
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1420
|
-
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" &&
|
|
1459
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && R.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1421
1460
|
}
|
|
1422
1461
|
setResolvedLanguage(e) {
|
|
1423
1462
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -1433,7 +1472,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1433
1472
|
}
|
|
1434
1473
|
changeLanguage(e, t) {
|
|
1435
1474
|
this.isLanguageChangingTo = e;
|
|
1436
|
-
let n =
|
|
1475
|
+
let n = E();
|
|
1437
1476
|
this.emit("languageChanging", e);
|
|
1438
1477
|
let r = (e) => {
|
|
1439
1478
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1441,7 +1480,7 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1441
1480
|
a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
|
|
1442
1481
|
}, a = (t) => {
|
|
1443
1482
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1444
|
-
let n =
|
|
1483
|
+
let n = T(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(T(t) ? [t] : t);
|
|
1445
1484
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1446
1485
|
i(e, a);
|
|
1447
1486
|
});
|
|
@@ -1456,11 +1495,11 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1456
1495
|
...this.options,
|
|
1457
1496
|
...a
|
|
1458
1497
|
};
|
|
1459
|
-
typeof a.keyPrefix == "function" && (a.keyPrefix =
|
|
1498
|
+
typeof a.keyPrefix == "function" && (a.keyPrefix = B(a.keyPrefix, o));
|
|
1460
1499
|
let s = this.options.keySeparator || ".", c;
|
|
1461
|
-
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e =
|
|
1500
|
+
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = B(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = B(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
|
|
1462
1501
|
};
|
|
1463
|
-
return
|
|
1502
|
+
return T(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1464
1503
|
}
|
|
1465
1504
|
t(...e) {
|
|
1466
1505
|
return this.translator?.translate(...e);
|
|
@@ -1487,16 +1526,16 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1487
1526
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1488
1527
|
}
|
|
1489
1528
|
loadNamespaces(e, t) {
|
|
1490
|
-
let n =
|
|
1491
|
-
return this.options.ns ? (
|
|
1529
|
+
let n = E();
|
|
1530
|
+
return this.options.ns ? (T(e) && (e = [e]), e.forEach((e) => {
|
|
1492
1531
|
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1493
1532
|
}), this.loadResources((e) => {
|
|
1494
1533
|
n.resolve(), t && t(e);
|
|
1495
1534
|
}), n) : (t && t(), Promise.resolve());
|
|
1496
1535
|
}
|
|
1497
1536
|
loadLanguages(e, t) {
|
|
1498
|
-
let n =
|
|
1499
|
-
|
|
1537
|
+
let n = E();
|
|
1538
|
+
T(e) && (e = [e]);
|
|
1500
1539
|
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1501
1540
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1502
1541
|
n.resolve(), t && t(e);
|
|
@@ -1511,14 +1550,14 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1511
1550
|
if (e && e.direction) return e.direction;
|
|
1512
1551
|
}
|
|
1513
1552
|
} catch {}
|
|
1514
|
-
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new
|
|
1553
|
+
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new W(Z());
|
|
1515
1554
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1516
1555
|
}
|
|
1517
1556
|
static createInstance(t = {}, n) {
|
|
1518
1557
|
let r = new e(t, n);
|
|
1519
1558
|
return r.createInstance = e.createInstance, r;
|
|
1520
1559
|
}
|
|
1521
|
-
cloneInstance(t = {}, n =
|
|
1560
|
+
cloneInstance(t = {}, n = Q) {
|
|
1522
1561
|
let r = t.forkResourceStore;
|
|
1523
1562
|
r && delete t.forkResourceStore;
|
|
1524
1563
|
let i = {
|
|
@@ -1532,18 +1571,18 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1532
1571
|
"language"
|
|
1533
1572
|
].forEach((e) => {
|
|
1534
1573
|
a[e] = this[e];
|
|
1535
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1574
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new pe(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
|
|
1536
1575
|
let e = {
|
|
1537
|
-
...
|
|
1576
|
+
...Z().interpolation,
|
|
1538
1577
|
...this.options.interpolation,
|
|
1539
1578
|
...t.interpolation
|
|
1540
1579
|
}, n = {
|
|
1541
1580
|
...i,
|
|
1542
1581
|
interpolation: e
|
|
1543
1582
|
};
|
|
1544
|
-
a.services.interpolator = new
|
|
1583
|
+
a.services.interpolator = new Y(n);
|
|
1545
1584
|
}
|
|
1546
|
-
return a.translator = new
|
|
1585
|
+
return a.translator = new U(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1547
1586
|
a.emit(e, ...t);
|
|
1548
1587
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1549
1588
|
}
|
|
@@ -1559,20 +1598,20 @@ var R = {}, z = (e) => !d(e) && typeof e != "boolean" && typeof e != "number", B
|
|
|
1559
1598
|
}.createInstance();
|
|
1560
1599
|
//#endregion
|
|
1561
1600
|
//#region ../../shared/translator/dist/index.js
|
|
1562
|
-
|
|
1601
|
+
$.createInstance, $.dir, $.init, $.loadResources, $.reloadResources, $.use, $.changeLanguage, $.getFixedT, $.t, $.exists, $.setDefaultNamespace, $.hasLoadedNamespace, $.loadNamespaces, $.loadLanguages, $.init({
|
|
1563
1602
|
fallbackLng: "en",
|
|
1564
1603
|
lng: "en",
|
|
1565
1604
|
showSupportNotice: !1,
|
|
1566
1605
|
resources: {
|
|
1567
|
-
en:
|
|
1568
|
-
es:
|
|
1606
|
+
en: C,
|
|
1607
|
+
es: w
|
|
1569
1608
|
}
|
|
1570
1609
|
});
|
|
1571
1610
|
//#endregion
|
|
1572
1611
|
//#region src/i18n.ts
|
|
1573
|
-
var { translator:
|
|
1612
|
+
var { translator: De } = {
|
|
1574
1613
|
translator: {
|
|
1575
|
-
|
|
1614
|
+
...$,
|
|
1576
1615
|
t: (e, t) => {
|
|
1577
1616
|
let { lng: n } = t;
|
|
1578
1617
|
switch (n) {
|
|
@@ -1588,7 +1627,7 @@ var { translator: $ } = {
|
|
|
1588
1627
|
break;
|
|
1589
1628
|
default: break;
|
|
1590
1629
|
}
|
|
1591
|
-
return
|
|
1630
|
+
return $.t(e, {
|
|
1592
1631
|
lng: n,
|
|
1593
1632
|
...t
|
|
1594
1633
|
});
|
|
@@ -1602,13 +1641,13 @@ var { translator: $ } = {
|
|
|
1602
1641
|
label: "Spanish"
|
|
1603
1642
|
}]
|
|
1604
1643
|
};
|
|
1605
|
-
function
|
|
1606
|
-
return
|
|
1644
|
+
function Oe(e, t) {
|
|
1645
|
+
return De.t(`translation:simpleCloze:${e}`, { lng: t });
|
|
1607
1646
|
}
|
|
1608
|
-
function
|
|
1609
|
-
return
|
|
1647
|
+
function ke(e, t) {
|
|
1648
|
+
return De.t(`common:${e}`, { lng: t });
|
|
1610
1649
|
}
|
|
1611
1650
|
//#endregion
|
|
1612
|
-
export {
|
|
1651
|
+
export { ke as n, ee as r, Oe as t };
|
|
1613
1652
|
|
|
1614
|
-
//# sourceMappingURL=i18n-
|
|
1653
|
+
//# sourceMappingURL=i18n-gsOjC7sf.js.map
|