@pie-element/simple-cloze 0.1.4-next.18 → 0.1.4-next.19
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-D6nL3i8G.js → i18n-CBClmRAq.js} +226 -201
- package/dist/browser/editor-runtime/i18n-CBClmRAq.js.map +1 -0
- package/dist/browser/editor-runtime/print/index.js +1 -1
- package/dist/browser/{i18n-D6nL3i8G.js → i18n-CBClmRAq.js} +226 -201
- package/dist/browser/i18n-CBClmRAq.js.map +1 -0
- package/dist/browser/print/index.js +1 -1
- package/dist/delivery/index.js +37 -9
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.js +2 -2
- package/dist/print/index.js +37 -9
- package/dist/print/index.js.map +1 -1
- package/module/print.js +179 -154
- package/module/print.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/editor-runtime/i18n-D6nL3i8G.js.map +0 -1
- package/dist/browser/i18n-D6nL3i8G.js.map +0 -1
|
@@ -67,7 +67,7 @@ function x(e) {
|
|
|
67
67
|
typeset: !1,
|
|
68
68
|
ready: () => {
|
|
69
69
|
let e = _(), r = e?.startup, i = !!e?.version?.startsWith("4.");
|
|
70
|
-
i && S(e), r?.defaultReady?.(), i &&
|
|
70
|
+
i && S(e), r?.defaultReady?.(), i && C(r?.document), Promise.resolve(r?.promise).then(() => t(), n);
|
|
71
71
|
}
|
|
72
72
|
},
|
|
73
73
|
tex: { macros: { ...a } },
|
|
@@ -89,7 +89,7 @@ function S(e) {
|
|
|
89
89
|
let t = e?._?.output?.chtml_ts?.CHTML;
|
|
90
90
|
t && (t.STYLESHEETID = f);
|
|
91
91
|
}
|
|
92
|
-
function
|
|
92
|
+
function C(e) {
|
|
93
93
|
if (!e) return;
|
|
94
94
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
95
95
|
let n = e.typesetRoot;
|
|
@@ -103,32 +103,32 @@ function ee(e) {
|
|
|
103
103
|
return t && g(t), !1;
|
|
104
104
|
});
|
|
105
105
|
let r = e.outputJax?.chtmlStyles;
|
|
106
|
-
r?.id === p && (r.id = f),
|
|
106
|
+
r?.id === p && (r.id = f), E();
|
|
107
107
|
}
|
|
108
|
-
function
|
|
108
|
+
function w(e) {
|
|
109
109
|
return e instanceof HTMLStyleElement && m.includes(e.id);
|
|
110
110
|
}
|
|
111
|
-
function
|
|
111
|
+
function T(e) {
|
|
112
112
|
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
113
113
|
}
|
|
114
|
-
function
|
|
115
|
-
let e = document.head, t = [...e.children].find(
|
|
114
|
+
function E() {
|
|
115
|
+
let e = document.head, t = [...e.children].find(w);
|
|
116
116
|
if (t) {
|
|
117
|
-
|
|
117
|
+
T(t);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
let n = new MutationObserver((e) => {
|
|
121
121
|
for (let t of e) {
|
|
122
|
-
let e = [...t.addedNodes].find(
|
|
122
|
+
let e = [...t.addedNodes].find(w);
|
|
123
123
|
if (e) {
|
|
124
|
-
|
|
124
|
+
T(e), n.disconnect();
|
|
125
125
|
return;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
n.observe(e, { childList: !0 });
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function D(e) {
|
|
132
132
|
return new Promise((t, n) => {
|
|
133
133
|
let r = e.startup ?? {};
|
|
134
134
|
e.startup = r;
|
|
@@ -139,26 +139,26 @@ function E(e) {
|
|
|
139
139
|
};
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
function
|
|
142
|
+
function O(e) {
|
|
143
143
|
let t = _();
|
|
144
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() :
|
|
144
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : D(t) : x(e);
|
|
145
145
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
146
|
+
function ee(e) {
|
|
147
|
+
return O(e).then(() => {
|
|
148
148
|
typeof _()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
|
-
function
|
|
151
|
+
function te(e) {
|
|
152
152
|
let t = globalThis, n = t[d];
|
|
153
|
-
return n || (n =
|
|
153
|
+
return n || (n = ee(e), t[d] = n), n;
|
|
154
154
|
}
|
|
155
|
-
function
|
|
155
|
+
function ne(e = {}) {
|
|
156
156
|
let t = e.useSingleDollar ?? !1;
|
|
157
157
|
return async (i) => {
|
|
158
158
|
if (typeof window > "u") return;
|
|
159
159
|
let a = r();
|
|
160
160
|
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), y(i);
|
|
161
|
-
let o =
|
|
161
|
+
let o = te(e);
|
|
162
162
|
if (!b(i, t)) {
|
|
163
163
|
o.catch(() => {});
|
|
164
164
|
return;
|
|
@@ -168,25 +168,50 @@ function re(e = {}) {
|
|
|
168
168
|
await s?.startup?.promise, typeof s?.typesetPromise == "function" && (await s.typesetPromise([i]), g(i));
|
|
169
169
|
};
|
|
170
170
|
}
|
|
171
|
-
var
|
|
172
|
-
function
|
|
173
|
-
return !!window[
|
|
171
|
+
var re = "@pie-lib/math-rendering", ie = "@pie-lib/math-rendering@2", ae = "pie-print", oe = 50, se = 1e4, ce = null;
|
|
172
|
+
function le() {
|
|
173
|
+
return !!window[ie]?.opts?.useSingleDollar;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
175
|
+
function ue() {
|
|
176
|
+
return ce ||= ne({ useSingleDollar: le() }), ce;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function de() {
|
|
179
179
|
if (typeof window > "u") return null;
|
|
180
|
-
let e = window[
|
|
180
|
+
let e = window[re];
|
|
181
181
|
return typeof e?.renderMath == "function" ? e : null;
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
function fe(e) {
|
|
184
|
+
let t = e;
|
|
185
|
+
for (; t;) {
|
|
186
|
+
if (t instanceof Element && t.localName === ae) return t;
|
|
187
|
+
t = t instanceof ShadowRoot ? t.host : t.parentNode;
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
function k() {
|
|
192
|
+
let e = window.renderMath;
|
|
193
|
+
return typeof e == "function" ? e : null;
|
|
194
|
+
}
|
|
195
|
+
async function pe(e) {
|
|
196
|
+
let t = fe(e);
|
|
197
|
+
if (!t) return null;
|
|
198
|
+
let n = k();
|
|
199
|
+
if (n || t.mathRenderingModuleUrlImported !== !0) return n;
|
|
200
|
+
let r = Date.now() + se;
|
|
201
|
+
for (; Date.now() < r;) {
|
|
202
|
+
await new Promise((e) => setTimeout(e, oe));
|
|
203
|
+
let e = k();
|
|
204
|
+
if (e) return e;
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
var me = async (e) => {
|
|
184
209
|
if (typeof window > "u") return;
|
|
185
210
|
let t = typeof e == "string", n;
|
|
186
211
|
t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
|
|
187
|
-
let r =
|
|
188
|
-
return r ? await r.renderMath?.(n) : await
|
|
189
|
-
},
|
|
212
|
+
let r = de(), i = r || t ? null : await pe(n);
|
|
213
|
+
return r ? await r.renderMath?.(n) : i ? await i(n) : await ue()(n), t ? n.innerHTML : void 0;
|
|
214
|
+
}, he = {
|
|
190
215
|
translation: {
|
|
191
216
|
categorize: {
|
|
192
217
|
limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
|
|
@@ -326,7 +351,7 @@ var le = async (e) => {
|
|
|
326
351
|
hideNote: "Hide Note",
|
|
327
352
|
cancel: "Cancel"
|
|
328
353
|
}
|
|
329
|
-
},
|
|
354
|
+
}, ge = {
|
|
330
355
|
translation: {
|
|
331
356
|
categorize: {
|
|
332
357
|
limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
|
|
@@ -466,55 +491,55 @@ var le = async (e) => {
|
|
|
466
491
|
hideNote: "Ocultar Nota",
|
|
467
492
|
cancel: "Cancelar"
|
|
468
493
|
}
|
|
469
|
-
},
|
|
494
|
+
}, A = (e) => typeof e == "string", j = () => {
|
|
470
495
|
let e, t, n = new Promise((n, r) => {
|
|
471
496
|
e = n, t = r;
|
|
472
497
|
});
|
|
473
498
|
return n.resolve = e, n.reject = t, n;
|
|
474
|
-
},
|
|
499
|
+
}, M = (e) => e == null ? "" : "" + e, _e = (e, t, n) => {
|
|
475
500
|
e.forEach((e) => {
|
|
476
501
|
t[e] && (n[e] = t[e]);
|
|
477
502
|
});
|
|
478
|
-
},
|
|
479
|
-
let r =
|
|
503
|
+
}, ve = /###/g, N = (e) => e && e.indexOf("###") > -1 ? e.replace(ve, ".") : e, P = (e) => !e || A(e), F = (e, t, n) => {
|
|
504
|
+
let r = A(t) ? t.split(".") : t, i = 0;
|
|
480
505
|
for (; i < r.length - 1;) {
|
|
481
|
-
if (
|
|
482
|
-
let t =
|
|
506
|
+
if (P(e)) return {};
|
|
507
|
+
let t = N(r[i]);
|
|
483
508
|
!e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
|
|
484
509
|
}
|
|
485
|
-
return
|
|
510
|
+
return P(e) ? {} : {
|
|
486
511
|
obj: e,
|
|
487
|
-
k:
|
|
512
|
+
k: N(r[i])
|
|
488
513
|
};
|
|
489
|
-
},
|
|
490
|
-
let { obj: r, k: i } =
|
|
514
|
+
}, I = (e, t, n) => {
|
|
515
|
+
let { obj: r, k: i } = F(e, t, Object);
|
|
491
516
|
if (r !== void 0 || t.length === 1) {
|
|
492
517
|
r[i] = n;
|
|
493
518
|
return;
|
|
494
519
|
}
|
|
495
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
496
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
520
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = F(e, o, Object);
|
|
521
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = F(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
497
522
|
s.obj[`${s.k}.${a}`] = n;
|
|
498
|
-
},
|
|
499
|
-
let { obj: i, k: a } =
|
|
523
|
+
}, ye = (e, t, n, r) => {
|
|
524
|
+
let { obj: i, k: a } = F(e, t, Object);
|
|
500
525
|
i[a] = i[a] || [], i[a].push(n);
|
|
501
|
-
},
|
|
502
|
-
let { obj: n, k: r } =
|
|
526
|
+
}, L = (e, t) => {
|
|
527
|
+
let { obj: n, k: r } = F(e, t);
|
|
503
528
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
504
|
-
},
|
|
505
|
-
let r =
|
|
506
|
-
return r === void 0 ?
|
|
507
|
-
},
|
|
508
|
-
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ?
|
|
529
|
+
}, be = (e, t, n) => {
|
|
530
|
+
let r = L(e, n);
|
|
531
|
+
return r === void 0 ? L(t, n) : r;
|
|
532
|
+
}, R = (e, t, n) => {
|
|
533
|
+
for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? A(e[r]) || e[r] instanceof String || A(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : R(e[r], t[r], n) : e[r] = t[r]);
|
|
509
534
|
return e;
|
|
510
|
-
},
|
|
535
|
+
}, z = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), xe = {
|
|
511
536
|
"&": "&",
|
|
512
537
|
"<": "<",
|
|
513
538
|
">": ">",
|
|
514
539
|
"\"": """,
|
|
515
540
|
"'": "'",
|
|
516
541
|
"/": "/"
|
|
517
|
-
},
|
|
542
|
+
}, Se = (e) => A(e) ? e.replace(/[&<>"'\/]/g, (e) => xe[e]) : e, Ce = class {
|
|
518
543
|
constructor(e) {
|
|
519
544
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
520
545
|
}
|
|
@@ -524,23 +549,23 @@ var le = async (e) => {
|
|
|
524
549
|
let n = new RegExp(e);
|
|
525
550
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
526
551
|
}
|
|
527
|
-
},
|
|
552
|
+
}, we = [
|
|
528
553
|
" ",
|
|
529
554
|
",",
|
|
530
555
|
"?",
|
|
531
556
|
"!",
|
|
532
557
|
";"
|
|
533
|
-
],
|
|
558
|
+
], Te = new Ce(20), Ee = (e, t, n) => {
|
|
534
559
|
t ||= "", n ||= "";
|
|
535
|
-
let r =
|
|
560
|
+
let r = we.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
|
|
536
561
|
if (r.length === 0) return !0;
|
|
537
|
-
let i =
|
|
562
|
+
let i = Te.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
538
563
|
if (!a) {
|
|
539
564
|
let t = e.indexOf(n);
|
|
540
565
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
541
566
|
}
|
|
542
567
|
return a;
|
|
543
|
-
},
|
|
568
|
+
}, B = (e, t, n = ".") => {
|
|
544
569
|
if (!e) return;
|
|
545
570
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
546
571
|
let r = t.split(n), i = e;
|
|
@@ -559,7 +584,7 @@ var le = async (e) => {
|
|
|
559
584
|
i = t;
|
|
560
585
|
}
|
|
561
586
|
return i;
|
|
562
|
-
},
|
|
587
|
+
}, V = (e) => e?.replace(/_/g, "-"), De = {
|
|
563
588
|
type: "logger",
|
|
564
589
|
log(e) {
|
|
565
590
|
this.output("log", e);
|
|
@@ -573,12 +598,12 @@ var le = async (e) => {
|
|
|
573
598
|
output(e, t) {
|
|
574
599
|
console?.[e]?.apply?.(console, t);
|
|
575
600
|
}
|
|
576
|
-
},
|
|
601
|
+
}, H = new class e {
|
|
577
602
|
constructor(e, t = {}) {
|
|
578
603
|
this.init(e, t);
|
|
579
604
|
}
|
|
580
605
|
init(e, t = {}) {
|
|
581
|
-
this.prefix = t.prefix || "i18next:", this.logger = e ||
|
|
606
|
+
this.prefix = t.prefix || "i18next:", this.logger = e || De, this.options = t, this.debug = t.debug;
|
|
582
607
|
}
|
|
583
608
|
log(...e) {
|
|
584
609
|
return this.forward(e, "log", "", !0);
|
|
@@ -593,7 +618,7 @@ var le = async (e) => {
|
|
|
593
618
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
594
619
|
}
|
|
595
620
|
forward(e, t, n, r) {
|
|
596
|
-
return r && !this.debug ? null : (
|
|
621
|
+
return r && !this.debug ? null : (A(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
597
622
|
}
|
|
598
623
|
create(t) {
|
|
599
624
|
return new e(this.logger, {
|
|
@@ -604,7 +629,7 @@ var le = async (e) => {
|
|
|
604
629
|
clone(t) {
|
|
605
630
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
606
631
|
}
|
|
607
|
-
}(),
|
|
632
|
+
}(), U = class {
|
|
608
633
|
constructor() {
|
|
609
634
|
this.observers = {};
|
|
610
635
|
}
|
|
@@ -631,7 +656,7 @@ var le = async (e) => {
|
|
|
631
656
|
for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
|
|
632
657
|
});
|
|
633
658
|
}
|
|
634
|
-
},
|
|
659
|
+
}, W = class extends U {
|
|
635
660
|
constructor(e, t = {
|
|
636
661
|
ns: ["translation"],
|
|
637
662
|
defaultNS: "translation"
|
|
@@ -647,16 +672,16 @@ var le = async (e) => {
|
|
|
647
672
|
}
|
|
648
673
|
getResource(e, t, n, r = {}) {
|
|
649
674
|
let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
|
|
650
|
-
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) :
|
|
651
|
-
let s =
|
|
652
|
-
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !
|
|
675
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : A(n) && i ? o.push(...n.split(i)) : o.push(n)));
|
|
676
|
+
let s = L(this.data, o);
|
|
677
|
+
return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !A(n) ? s : B(this.data?.[e]?.[t], n, i);
|
|
653
678
|
}
|
|
654
679
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
655
680
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
656
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
681
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), I(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
657
682
|
}
|
|
658
683
|
addResources(e, t, n, r = { silent: !1 }) {
|
|
659
|
-
for (let r in n) (
|
|
684
|
+
for (let r in n) (A(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
|
|
660
685
|
r.silent || this.emit("added", e, t, n);
|
|
661
686
|
}
|
|
662
687
|
addResourceBundle(e, t, n, r, i, a = {
|
|
@@ -665,11 +690,11 @@ var le = async (e) => {
|
|
|
665
690
|
}) {
|
|
666
691
|
let o = [e, t];
|
|
667
692
|
e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
668
|
-
let s =
|
|
669
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
693
|
+
let s = L(this.data, o) || {};
|
|
694
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? R(s, n, i) : s = {
|
|
670
695
|
...s,
|
|
671
696
|
...n
|
|
672
|
-
},
|
|
697
|
+
}, I(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
673
698
|
}
|
|
674
699
|
removeResourceBundle(e, t) {
|
|
675
700
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -690,7 +715,7 @@ var le = async (e) => {
|
|
|
690
715
|
toJSON() {
|
|
691
716
|
return this.data;
|
|
692
717
|
}
|
|
693
|
-
},
|
|
718
|
+
}, G = {
|
|
694
719
|
processors: {},
|
|
695
720
|
addPostProcessor(e) {
|
|
696
721
|
this.processors[e.name] = e;
|
|
@@ -700,22 +725,22 @@ var le = async (e) => {
|
|
|
700
725
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
701
726
|
}), t;
|
|
702
727
|
}
|
|
703
|
-
},
|
|
704
|
-
function
|
|
728
|
+
}, K = Symbol("i18next/PATH_KEY");
|
|
729
|
+
function Oe() {
|
|
705
730
|
let e = [], t = Object.create(null), n;
|
|
706
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
731
|
+
return t.get = (r, i) => (n?.revoke?.(), i === K ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
707
732
|
}
|
|
708
|
-
function
|
|
709
|
-
let { [
|
|
733
|
+
function q(e, t) {
|
|
734
|
+
let { [K]: n } = e(Oe()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
710
735
|
if (n.length > 1 && i) {
|
|
711
736
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
712
737
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
713
738
|
}
|
|
714
739
|
return n.join(r);
|
|
715
740
|
}
|
|
716
|
-
var
|
|
741
|
+
var J = {}, Y = (e) => !A(e) && typeof e != "boolean" && typeof e != "number", ke = class e extends U {
|
|
717
742
|
constructor(e, t = {}) {
|
|
718
|
-
super(),
|
|
743
|
+
super(), _e([
|
|
719
744
|
"resourceStore",
|
|
720
745
|
"languageUtils",
|
|
721
746
|
"pluralResolver",
|
|
@@ -723,7 +748,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
723
748
|
"backendConnector",
|
|
724
749
|
"i18nFormat",
|
|
725
750
|
"utils"
|
|
726
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
751
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = H.create("translator");
|
|
727
752
|
}
|
|
728
753
|
changeLanguage(e) {
|
|
729
754
|
e && (this.language = e);
|
|
@@ -733,34 +758,34 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
733
758
|
if (e == null) return !1;
|
|
734
759
|
let r = this.resolve(e, n);
|
|
735
760
|
if (r?.res === void 0) return !1;
|
|
736
|
-
let i =
|
|
761
|
+
let i = Y(r.res);
|
|
737
762
|
return !(n.returnObjects === !1 && i);
|
|
738
763
|
}
|
|
739
764
|
extractFromKey(e, t) {
|
|
740
765
|
let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
|
|
741
766
|
n === void 0 && (n = ":");
|
|
742
|
-
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 && !
|
|
767
|
+
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 && !Ee(e, n, r);
|
|
743
768
|
if (a && !o) {
|
|
744
769
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
745
770
|
if (t && t.length > 0) return {
|
|
746
771
|
key: e,
|
|
747
|
-
namespaces:
|
|
772
|
+
namespaces: A(i) ? [i] : i
|
|
748
773
|
};
|
|
749
774
|
let a = e.split(n);
|
|
750
775
|
(n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
|
|
751
776
|
}
|
|
752
777
|
return {
|
|
753
778
|
key: e,
|
|
754
|
-
namespaces:
|
|
779
|
+
namespaces: A(i) ? [i] : i
|
|
755
780
|
};
|
|
756
781
|
}
|
|
757
782
|
translate(t, n, r) {
|
|
758
783
|
let i = typeof n == "object" ? { ...n } : n;
|
|
759
784
|
if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
|
|
760
|
-
typeof t == "function" && (t =
|
|
785
|
+
typeof t == "function" && (t = q(t, {
|
|
761
786
|
...this.options,
|
|
762
787
|
...i
|
|
763
|
-
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ?
|
|
788
|
+
})), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? q(e, {
|
|
764
789
|
...this.options,
|
|
765
790
|
...i
|
|
766
791
|
}) : String(e));
|
|
@@ -786,42 +811,42 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
786
811
|
"[object Number]",
|
|
787
812
|
"[object Function]",
|
|
788
813
|
"[object RegExp]"
|
|
789
|
-
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !
|
|
790
|
-
y && !m && x && (
|
|
791
|
-
let
|
|
792
|
-
if (y &&
|
|
814
|
+
], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !A(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", C = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", w = b && !i.ordinal && i.count === 0, T = w && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${C}`] || i.defaultValue, E = m;
|
|
815
|
+
y && !m && x && (E = T);
|
|
816
|
+
let D = Y(E), O = Object.prototype.toString.apply(E);
|
|
817
|
+
if (y && E && D && _.indexOf(O) < 0 && !(A(v) && Array.isArray(E))) {
|
|
793
818
|
if (!i.returnObjects && !this.options.returnObjects) {
|
|
794
819
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
795
|
-
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h,
|
|
820
|
+
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
|
|
796
821
|
...i,
|
|
797
822
|
ns: c
|
|
798
823
|
}) : `key '${s} (${this.language})' returned an object instead of string.`;
|
|
799
824
|
return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
|
|
800
825
|
}
|
|
801
826
|
if (o) {
|
|
802
|
-
let e = Array.isArray(
|
|
803
|
-
for (let e in
|
|
827
|
+
let e = Array.isArray(E), t = e ? [] : {}, n = e ? g : h;
|
|
828
|
+
for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
|
|
804
829
|
let r = `${n}${o}${e}`;
|
|
805
830
|
x && !m ? t[e] = this.translate(r, {
|
|
806
831
|
...i,
|
|
807
|
-
defaultValue:
|
|
832
|
+
defaultValue: Y(T) ? T[e] : void 0,
|
|
808
833
|
joinArrays: !1,
|
|
809
834
|
ns: c
|
|
810
835
|
}) : t[e] = this.translate(r, {
|
|
811
836
|
...i,
|
|
812
837
|
joinArrays: !1,
|
|
813
838
|
ns: c
|
|
814
|
-
}), t[e] === r && (t[e] =
|
|
839
|
+
}), t[e] === r && (t[e] = E[e]);
|
|
815
840
|
}
|
|
816
841
|
m = t;
|
|
817
842
|
}
|
|
818
|
-
} else if (y &&
|
|
843
|
+
} else if (y && A(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
|
|
819
844
|
else {
|
|
820
845
|
let e = !1, n = !1;
|
|
821
|
-
!this.isValidLookup(m) && x && (e = !0, m =
|
|
822
|
-
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x &&
|
|
846
|
+
!this.isValidLookup(m) && x && (e = !0, m = T), this.isValidLookup(m) || (n = !0, m = s);
|
|
847
|
+
let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && T !== m && this.options.updateMissing;
|
|
823
848
|
if (n || e || c) {
|
|
824
|
-
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ?
|
|
849
|
+
if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? T : m), o) {
|
|
825
850
|
let e = this.resolve(s, {
|
|
826
851
|
...i,
|
|
827
852
|
keySeparator: !1
|
|
@@ -837,10 +862,10 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
837
862
|
};
|
|
838
863
|
this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
|
|
839
864
|
let t = this.pluralResolver.getSuffixes(e, i);
|
|
840
|
-
|
|
841
|
-
n([e], s + t, i[`defaultValue${t}`] ||
|
|
865
|
+
w && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
|
|
866
|
+
n([e], s + t, i[`defaultValue${t}`] || T);
|
|
842
867
|
});
|
|
843
|
-
}) : n(e, s,
|
|
868
|
+
}) : n(e, s, T));
|
|
844
869
|
}
|
|
845
870
|
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));
|
|
846
871
|
}
|
|
@@ -859,12 +884,12 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
859
884
|
...n.interpolation
|
|
860
885
|
}
|
|
861
886
|
});
|
|
862
|
-
let a =
|
|
887
|
+
let a = A(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
|
|
863
888
|
if (a) {
|
|
864
889
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
865
890
|
o = t && t.length;
|
|
866
891
|
}
|
|
867
|
-
let s = n.replace && !
|
|
892
|
+
let s = n.replace && !A(n.replace) ? n.replace : n;
|
|
868
893
|
if (this.options.interpolation.defaultVariables && (s = {
|
|
869
894
|
...this.options.interpolation.defaultVariables,
|
|
870
895
|
...s
|
|
@@ -874,8 +899,8 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
874
899
|
}
|
|
875
900
|
!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();
|
|
876
901
|
}
|
|
877
|
-
let a = n.postProcess || this.options.postProcess, o =
|
|
878
|
-
return e != null && o?.length && n.applyPostProcessor !== !1 && (e =
|
|
902
|
+
let a = n.postProcess || this.options.postProcess, o = A(a) ? [a] : a;
|
|
903
|
+
return e != null && o?.length && n.applyPostProcessor !== !1 && (e = G.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
879
904
|
i18nResolved: {
|
|
880
905
|
...r,
|
|
881
906
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -885,7 +910,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
885
910
|
}
|
|
886
911
|
resolve(e, t = {}) {
|
|
887
912
|
let n, r, i, a, o;
|
|
888
|
-
return
|
|
913
|
+
return A(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? q(e, {
|
|
889
914
|
...this.options,
|
|
890
915
|
...t
|
|
891
916
|
}) : e)), e.forEach((e) => {
|
|
@@ -894,9 +919,9 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
894
919
|
r = c;
|
|
895
920
|
let l = s.namespaces;
|
|
896
921
|
this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
|
|
897
|
-
let u = t.count !== void 0 && !
|
|
922
|
+
let u = t.count !== void 0 && !A(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (A(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
898
923
|
l.forEach((e) => {
|
|
899
|
-
this.isValidLookup(n) || (o = e, !
|
|
924
|
+
this.isValidLookup(n) || (o = e, !J[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (J[`${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) => {
|
|
900
925
|
if (this.isValidLookup(n)) return;
|
|
901
926
|
a = r;
|
|
902
927
|
let o = [c];
|
|
@@ -945,7 +970,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
945
970
|
"joinArrays",
|
|
946
971
|
"postProcess",
|
|
947
972
|
"interpolation"
|
|
948
|
-
], n = e.replace && !
|
|
973
|
+
], n = e.replace && !A(e.replace), r = n ? e.replace : e;
|
|
949
974
|
if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
|
|
950
975
|
...this.options.interpolation.defaultVariables,
|
|
951
976
|
...r
|
|
@@ -959,22 +984,22 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
959
984
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
|
|
960
985
|
return !1;
|
|
961
986
|
}
|
|
962
|
-
},
|
|
987
|
+
}, Ae = class {
|
|
963
988
|
constructor(e) {
|
|
964
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
989
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = H.create("languageUtils");
|
|
965
990
|
}
|
|
966
991
|
getScriptPartFromCode(e) {
|
|
967
|
-
if (e =
|
|
992
|
+
if (e = V(e), !e || e.indexOf("-") < 0) return null;
|
|
968
993
|
let t = e.split("-");
|
|
969
994
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
970
995
|
}
|
|
971
996
|
getLanguagePartFromCode(e) {
|
|
972
|
-
if (e =
|
|
997
|
+
if (e = V(e), !e || e.indexOf("-") < 0) return e;
|
|
973
998
|
let t = e.split("-");
|
|
974
999
|
return this.formatLanguageCode(t[0]);
|
|
975
1000
|
}
|
|
976
1001
|
formatLanguageCode(e) {
|
|
977
|
-
if (
|
|
1002
|
+
if (A(e) && e.indexOf("-") > -1) {
|
|
978
1003
|
let t;
|
|
979
1004
|
try {
|
|
980
1005
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -1006,7 +1031,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1006
1031
|
}
|
|
1007
1032
|
getFallbackCodes(e, t) {
|
|
1008
1033
|
if (!e) return [];
|
|
1009
|
-
if (typeof e == "function" && (e = e(t)),
|
|
1034
|
+
if (typeof e == "function" && (e = e(t)), A(e) && (e = [e]), Array.isArray(e)) return e;
|
|
1010
1035
|
if (!t) return e.default || [];
|
|
1011
1036
|
let n = e[t];
|
|
1012
1037
|
return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
|
|
@@ -1015,29 +1040,29 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1015
1040
|
let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
|
|
1016
1041
|
e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
1017
1042
|
};
|
|
1018
|
-
return
|
|
1043
|
+
return A(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))) : A(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
|
|
1019
1044
|
r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
|
|
1020
1045
|
}), r;
|
|
1021
1046
|
}
|
|
1022
|
-
},
|
|
1047
|
+
}, je = {
|
|
1023
1048
|
zero: 0,
|
|
1024
1049
|
one: 1,
|
|
1025
1050
|
two: 2,
|
|
1026
1051
|
few: 3,
|
|
1027
1052
|
many: 4,
|
|
1028
1053
|
other: 5
|
|
1029
|
-
},
|
|
1054
|
+
}, Me = {
|
|
1030
1055
|
select: (e) => e === 1 ? "one" : "other",
|
|
1031
1056
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
1032
|
-
},
|
|
1057
|
+
}, Ne = class {
|
|
1033
1058
|
constructor(e, t = {}) {
|
|
1034
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
1059
|
+
this.languageUtils = e, this.options = t, this.logger = H.create("pluralResolver"), this.pluralRulesCache = {};
|
|
1035
1060
|
}
|
|
1036
1061
|
clearCache() {
|
|
1037
1062
|
this.pluralRulesCache = {};
|
|
1038
1063
|
}
|
|
1039
1064
|
getRule(e, t = {}) {
|
|
1040
|
-
let n =
|
|
1065
|
+
let n = V(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
1041
1066
|
cleanedCode: n,
|
|
1042
1067
|
type: r
|
|
1043
1068
|
});
|
|
@@ -1046,8 +1071,8 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1046
1071
|
try {
|
|
1047
1072
|
a = new Intl.PluralRules(n, { type: r });
|
|
1048
1073
|
} catch {
|
|
1049
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
1050
|
-
if (!e.match(/-|_/)) return
|
|
1074
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), Me;
|
|
1075
|
+
if (!e.match(/-|_/)) return Me;
|
|
1051
1076
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
1052
1077
|
a = this.getRule(n, t);
|
|
1053
1078
|
}
|
|
@@ -1062,23 +1087,23 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1062
1087
|
}
|
|
1063
1088
|
getSuffixes(e, t = {}) {
|
|
1064
1089
|
let n = this.getRule(e, t);
|
|
1065
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
1090
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => je[e] - je[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
1066
1091
|
}
|
|
1067
1092
|
getSuffix(e, t, n = {}) {
|
|
1068
1093
|
let r = this.getRule(e, n);
|
|
1069
1094
|
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));
|
|
1070
1095
|
}
|
|
1071
|
-
},
|
|
1072
|
-
let a =
|
|
1073
|
-
return !a && i &&
|
|
1074
|
-
},
|
|
1096
|
+
}, Pe = (e, t, n, r = ".", i = !0) => {
|
|
1097
|
+
let a = be(e, t, n);
|
|
1098
|
+
return !a && i && A(n) && (a = B(e, n, r), a === void 0 && (a = B(t, n, r))), a;
|
|
1099
|
+
}, X = (e) => e.replace(/\$/g, "$$$$"), Fe = class {
|
|
1075
1100
|
constructor(e = {}) {
|
|
1076
|
-
this.logger =
|
|
1101
|
+
this.logger = H.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
1077
1102
|
}
|
|
1078
1103
|
init(e = {}) {
|
|
1079
1104
|
e.interpolation ||= { escapeValue: !0 };
|
|
1080
1105
|
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;
|
|
1081
|
-
this.escape = t === void 0 ?
|
|
1106
|
+
this.escape = t === void 0 ? Se : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? z(i) : a || "{{", this.suffix = o ? z(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? z(d) : f || z("$t("), this.nestingSuffix = p ? z(p) : m || z(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
|
|
1082
1107
|
}
|
|
1083
1108
|
reset() {
|
|
1084
1109
|
this.options && this.init(this.options);
|
|
@@ -1090,7 +1115,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1090
1115
|
interpolate(e, t, n, r) {
|
|
1091
1116
|
let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
|
|
1092
1117
|
if (e.indexOf(this.formatSeparator) < 0) {
|
|
1093
|
-
let i =
|
|
1118
|
+
let i = Pe(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
1094
1119
|
return this.alwaysFormat ? this.format(i, void 0, n, {
|
|
1095
1120
|
...r,
|
|
1096
1121
|
...t,
|
|
@@ -1098,7 +1123,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1098
1123
|
}) : i;
|
|
1099
1124
|
}
|
|
1100
1125
|
let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
|
|
1101
|
-
return this.format(
|
|
1126
|
+
return this.format(Pe(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
|
|
1102
1127
|
...r,
|
|
1103
1128
|
...t,
|
|
1104
1129
|
interpolationkey: a
|
|
@@ -1108,22 +1133,22 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1108
1133
|
let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
|
|
1109
1134
|
return [{
|
|
1110
1135
|
regex: this.regexpUnescape,
|
|
1111
|
-
safeValue: (e) =>
|
|
1136
|
+
safeValue: (e) => X(e)
|
|
1112
1137
|
}, {
|
|
1113
1138
|
regex: this.regexp,
|
|
1114
|
-
safeValue: (e) => this.escapeValue ?
|
|
1139
|
+
safeValue: (e) => this.escapeValue ? X(this.escape(e)) : X(e)
|
|
1115
1140
|
}].forEach((t) => {
|
|
1116
1141
|
for (o = 0; i = t.regex.exec(e);) {
|
|
1117
1142
|
let n = i[1].trim();
|
|
1118
1143
|
if (a = c(n), a === void 0) if (typeof l == "function") {
|
|
1119
1144
|
let t = l(e, i, r);
|
|
1120
|
-
a =
|
|
1145
|
+
a = A(t) ? t : "";
|
|
1121
1146
|
} else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
|
|
1122
1147
|
else if (u) {
|
|
1123
1148
|
a = i[0];
|
|
1124
1149
|
continue;
|
|
1125
1150
|
} else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
|
|
1126
|
-
else !
|
|
1151
|
+
else !A(a) && !this.useRawValueToEscape && (a = M(a));
|
|
1127
1152
|
let s = t.safeValue(a);
|
|
1128
1153
|
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;
|
|
1129
1154
|
}
|
|
@@ -1133,7 +1158,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1133
1158
|
let r, i, a, o = (e, t) => {
|
|
1134
1159
|
let n = this.nestingOptionsSeparator;
|
|
1135
1160
|
if (e.indexOf(n) < 0) return e;
|
|
1136
|
-
let r = e.split(RegExp(`${
|
|
1161
|
+
let r = e.split(RegExp(`${z(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
1137
1162
|
e = r[0], i = this.interpolate(i, a);
|
|
1138
1163
|
let o = i.match(/'/g), s = i.match(/"/g);
|
|
1139
1164
|
((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -1149,17 +1174,17 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1149
1174
|
};
|
|
1150
1175
|
for (; r = this.nestingRegexp.exec(e);) {
|
|
1151
1176
|
let s = [];
|
|
1152
|
-
a = { ...n }, a = a.replace && !
|
|
1177
|
+
a = { ...n }, a = a.replace && !A(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
|
|
1153
1178
|
let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
|
|
1154
|
-
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 && !
|
|
1155
|
-
|
|
1179
|
+
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 && !A(i)) return i;
|
|
1180
|
+
A(i) || (i = M(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, {
|
|
1156
1181
|
...n,
|
|
1157
1182
|
interpolationkey: r[1].trim()
|
|
1158
1183
|
}), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
|
|
1159
1184
|
}
|
|
1160
1185
|
return e;
|
|
1161
1186
|
}
|
|
1162
|
-
},
|
|
1187
|
+
}, Ie = (e) => {
|
|
1163
1188
|
let t = e.toLowerCase().trim(), n = {};
|
|
1164
1189
|
if (e.indexOf("(") > -1) {
|
|
1165
1190
|
let r = e.split("(");
|
|
@@ -1176,7 +1201,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1176
1201
|
formatName: t,
|
|
1177
1202
|
formatOptions: n
|
|
1178
1203
|
};
|
|
1179
|
-
},
|
|
1204
|
+
}, Le = (e) => {
|
|
1180
1205
|
let t = {};
|
|
1181
1206
|
return (n, r, i) => {
|
|
1182
1207
|
let a = i;
|
|
@@ -1185,15 +1210,15 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1185
1210
|
[i.interpolationkey]: void 0
|
|
1186
1211
|
});
|
|
1187
1212
|
let o = r + JSON.stringify(a), s = t[o];
|
|
1188
|
-
return s || (s = e(
|
|
1213
|
+
return s || (s = e(V(r), i), t[o] = s), s(n);
|
|
1189
1214
|
};
|
|
1190
|
-
},
|
|
1215
|
+
}, Re = (e) => (t, n, r) => e(V(n), r)(t), ze = class {
|
|
1191
1216
|
constructor(e = {}) {
|
|
1192
|
-
this.logger =
|
|
1217
|
+
this.logger = H.create("formatter"), this.options = e, this.init(e);
|
|
1193
1218
|
}
|
|
1194
1219
|
init(e, t = { interpolation: {} }) {
|
|
1195
1220
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
1196
|
-
let n = t.cacheInBuiltFormats ?
|
|
1221
|
+
let n = t.cacheInBuiltFormats ? Le : Re;
|
|
1197
1222
|
this.formats = {
|
|
1198
1223
|
number: n((e, t) => {
|
|
1199
1224
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -1224,7 +1249,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1224
1249
|
this.formats[e.toLowerCase().trim()] = t;
|
|
1225
1250
|
}
|
|
1226
1251
|
addCached(e, t) {
|
|
1227
|
-
this.formats[e.toLowerCase().trim()] =
|
|
1252
|
+
this.formats[e.toLowerCase().trim()] = Le(t);
|
|
1228
1253
|
}
|
|
1229
1254
|
format(e, t, n, r = {}) {
|
|
1230
1255
|
let i = t.split(this.formatSeparator);
|
|
@@ -1233,7 +1258,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1233
1258
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
1234
1259
|
}
|
|
1235
1260
|
return i.reduce((e, t) => {
|
|
1236
|
-
let { formatName: i, formatOptions: a } =
|
|
1261
|
+
let { formatName: i, formatOptions: a } = Ie(t);
|
|
1237
1262
|
if (this.formats[i]) {
|
|
1238
1263
|
let t = e;
|
|
1239
1264
|
try {
|
|
@@ -1251,11 +1276,11 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1251
1276
|
return e;
|
|
1252
1277
|
}, e);
|
|
1253
1278
|
}
|
|
1254
|
-
},
|
|
1279
|
+
}, Be = (e, t) => {
|
|
1255
1280
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
1256
|
-
},
|
|
1281
|
+
}, Ve = class extends U {
|
|
1257
1282
|
constructor(e, t, n, r = {}) {
|
|
1258
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
1283
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = H.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);
|
|
1259
1284
|
}
|
|
1260
1285
|
queueLoad(e, t, n, r) {
|
|
1261
1286
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -1283,7 +1308,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1283
1308
|
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);
|
|
1284
1309
|
let o = {};
|
|
1285
1310
|
this.queue.forEach((n) => {
|
|
1286
|
-
|
|
1311
|
+
ye(n.loaded, [i], a), Be(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
1287
1312
|
o[e] || (o[e] = {});
|
|
1288
1313
|
let t = n.loaded[e];
|
|
1289
1314
|
t.length && t.forEach((t) => {
|
|
@@ -1332,7 +1357,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1332
1357
|
}
|
|
1333
1358
|
prepareLoading(e, t, n = {}, r) {
|
|
1334
1359
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
|
|
1335
|
-
|
|
1360
|
+
A(e) && (e = this.languageUtils.toResolveHierarchy(e)), A(t) && (t = [t]);
|
|
1336
1361
|
let i = this.queueLoad(e, t, n, r);
|
|
1337
1362
|
if (!i.toLoad.length) return i.pending.length || r(), null;
|
|
1338
1363
|
i.toLoad.forEach((e) => {
|
|
@@ -1373,7 +1398,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1373
1398
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
1374
1399
|
}
|
|
1375
1400
|
}
|
|
1376
|
-
},
|
|
1401
|
+
}, Z = () => ({
|
|
1377
1402
|
debug: !1,
|
|
1378
1403
|
initAsync: !0,
|
|
1379
1404
|
ns: ["translation"],
|
|
@@ -1408,7 +1433,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1408
1433
|
appendNamespaceToCIMode: !1,
|
|
1409
1434
|
overloadTranslationOptionHandler: (e) => {
|
|
1410
1435
|
let t = {};
|
|
1411
|
-
if (typeof e[1] == "object" && (t = e[1]),
|
|
1436
|
+
if (typeof e[1] == "object" && (t = e[1]), A(e[1]) && (t.defaultValue = e[1]), A(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
1412
1437
|
let n = e[3] || e[2];
|
|
1413
1438
|
Object.keys(n).forEach((e) => {
|
|
1414
1439
|
t[e] = n[e];
|
|
@@ -1430,15 +1455,15 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1430
1455
|
skipOnVariables: !0
|
|
1431
1456
|
},
|
|
1432
1457
|
cacheInBuiltFormats: !0
|
|
1433
|
-
}),
|
|
1458
|
+
}), He = (e) => (A(e.ns) && (e.ns = [e.ns]), A(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), A(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 = () => {}, Ue = (e) => {
|
|
1434
1459
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
1435
1460
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
1436
1461
|
});
|
|
1437
|
-
},
|
|
1438
|
-
typeof globalThis < "u" && (globalThis[
|
|
1439
|
-
},
|
|
1462
|
+
}, We = "__i18next_supportNoticeShown", Ge = () => !!(typeof globalThis < "u" && globalThis[We] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Ke = () => {
|
|
1463
|
+
typeof globalThis < "u" && (globalThis[We] = !0);
|
|
1464
|
+
}, qe = (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 U {
|
|
1440
1465
|
constructor(e = {}, t) {
|
|
1441
|
-
if (super(), this.options =
|
|
1466
|
+
if (super(), this.options = He(e), this.services = {}, this.logger = H, this.modules = { external: [] }, Ue(this), t && !this.isInitialized && !e.isClone) {
|
|
1442
1467
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
1443
1468
|
setTimeout(() => {
|
|
1444
1469
|
this.init(e, t);
|
|
@@ -1446,30 +1471,30 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1446
1471
|
}
|
|
1447
1472
|
}
|
|
1448
1473
|
init(e = {}, t) {
|
|
1449
|
-
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (
|
|
1450
|
-
let n =
|
|
1474
|
+
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (A(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1475
|
+
let n = Z();
|
|
1451
1476
|
this.options = {
|
|
1452
1477
|
...n,
|
|
1453
1478
|
...this.options,
|
|
1454
|
-
...
|
|
1479
|
+
...He(e)
|
|
1455
1480
|
}, this.options.interpolation = {
|
|
1456
1481
|
...n.interpolation,
|
|
1457
1482
|
...this.options.interpolation
|
|
1458
|
-
}, 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 && !
|
|
1483
|
+
}, 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 && !qe(this) && !Ge() && (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 💙"), Ke());
|
|
1459
1484
|
let r = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
1460
1485
|
if (!this.options.isClone) {
|
|
1461
|
-
this.modules.logger ?
|
|
1486
|
+
this.modules.logger ? H.init(r(this.modules.logger), this.options) : H.init(null, this.options);
|
|
1462
1487
|
let e;
|
|
1463
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1464
|
-
let t = new
|
|
1465
|
-
this.store = new
|
|
1488
|
+
e = this.modules.formatter ? this.modules.formatter : ze;
|
|
1489
|
+
let t = new Ae(this.options);
|
|
1490
|
+
this.store = new W(this.options.resources, this.options);
|
|
1466
1491
|
let i = this.services;
|
|
1467
|
-
i.logger =
|
|
1492
|
+
i.logger = H, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new Ne(t, {
|
|
1468
1493
|
prepend: this.options.pluralSeparator,
|
|
1469
1494
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1470
|
-
}), 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
|
|
1495
|
+
}), 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 Fe(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new Ve(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
|
|
1471
1496
|
this.emit(e, ...t);
|
|
1472
|
-
}), 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
|
|
1497
|
+
}), 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 ke(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1473
1498
|
this.emit(e, ...t);
|
|
1474
1499
|
}), this.modules.external.forEach((e) => {
|
|
1475
1500
|
e.init && e.init(this);
|
|
@@ -1494,7 +1519,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1494
1519
|
].forEach((e) => {
|
|
1495
1520
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1496
1521
|
});
|
|
1497
|
-
let i =
|
|
1522
|
+
let i = j(), a = () => {
|
|
1498
1523
|
let e = (e, n) => {
|
|
1499
1524
|
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);
|
|
1500
1525
|
};
|
|
@@ -1504,7 +1529,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1504
1529
|
return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
|
|
1505
1530
|
}
|
|
1506
1531
|
loadResources(e, t = Q) {
|
|
1507
|
-
let n = t, r =
|
|
1532
|
+
let n = t, r = A(e) ? e : this.language;
|
|
1508
1533
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1509
1534
|
if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
|
|
1510
1535
|
let e = [], t = (t) => {
|
|
@@ -1518,7 +1543,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1518
1543
|
} else n(null);
|
|
1519
1544
|
}
|
|
1520
1545
|
reloadResources(e, t, n) {
|
|
1521
|
-
let r =
|
|
1546
|
+
let r = j();
|
|
1522
1547
|
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) => {
|
|
1523
1548
|
r.resolve(), n(e);
|
|
1524
1549
|
}), r;
|
|
@@ -1526,7 +1551,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1526
1551
|
use(e) {
|
|
1527
1552
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1528
1553
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1529
|
-
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" &&
|
|
1554
|
+
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" && G.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1530
1555
|
}
|
|
1531
1556
|
setResolvedLanguage(e) {
|
|
1532
1557
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
|
|
@@ -1542,7 +1567,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1542
1567
|
}
|
|
1543
1568
|
changeLanguage(e, t) {
|
|
1544
1569
|
this.isLanguageChangingTo = e;
|
|
1545
|
-
let n =
|
|
1570
|
+
let n = j();
|
|
1546
1571
|
this.emit("languageChanging", e);
|
|
1547
1572
|
let r = (e) => {
|
|
1548
1573
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
@@ -1550,7 +1575,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1550
1575
|
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));
|
|
1551
1576
|
}, a = (t) => {
|
|
1552
1577
|
!e && !t && this.services.languageDetector && (t = []);
|
|
1553
|
-
let n =
|
|
1578
|
+
let n = A(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(A(t) ? [t] : t);
|
|
1554
1579
|
a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
|
|
1555
1580
|
i(e, a);
|
|
1556
1581
|
});
|
|
@@ -1565,11 +1590,11 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1565
1590
|
...this.options,
|
|
1566
1591
|
...a
|
|
1567
1592
|
};
|
|
1568
|
-
typeof a.keyPrefix == "function" && (a.keyPrefix =
|
|
1593
|
+
typeof a.keyPrefix == "function" && (a.keyPrefix = q(a.keyPrefix, o));
|
|
1569
1594
|
let s = this.options.keySeparator || ".", c;
|
|
1570
|
-
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e =
|
|
1595
|
+
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = q(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = q(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
|
|
1571
1596
|
};
|
|
1572
|
-
return
|
|
1597
|
+
return A(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
|
|
1573
1598
|
}
|
|
1574
1599
|
t(...e) {
|
|
1575
1600
|
return this.translator?.translate(...e);
|
|
@@ -1596,16 +1621,16 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1596
1621
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1597
1622
|
}
|
|
1598
1623
|
loadNamespaces(e, t) {
|
|
1599
|
-
let n =
|
|
1600
|
-
return this.options.ns ? (
|
|
1624
|
+
let n = j();
|
|
1625
|
+
return this.options.ns ? (A(e) && (e = [e]), e.forEach((e) => {
|
|
1601
1626
|
this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
|
|
1602
1627
|
}), this.loadResources((e) => {
|
|
1603
1628
|
n.resolve(), t && t(e);
|
|
1604
1629
|
}), n) : (t && t(), Promise.resolve());
|
|
1605
1630
|
}
|
|
1606
1631
|
loadLanguages(e, t) {
|
|
1607
|
-
let n =
|
|
1608
|
-
|
|
1632
|
+
let n = j();
|
|
1633
|
+
A(e) && (e = [e]);
|
|
1609
1634
|
let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
|
|
1610
1635
|
return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
|
|
1611
1636
|
n.resolve(), t && t(e);
|
|
@@ -1620,7 +1645,7 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1620
1645
|
if (e && e.direction) return e.direction;
|
|
1621
1646
|
}
|
|
1622
1647
|
} catch {}
|
|
1623
|
-
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
|
|
1648
|
+
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 Ae(Z());
|
|
1624
1649
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1625
1650
|
}
|
|
1626
1651
|
static createInstance(t = {}, n) {
|
|
@@ -1641,18 +1666,18 @@ var q = {}, J = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", w
|
|
|
1641
1666
|
"language"
|
|
1642
1667
|
].forEach((e) => {
|
|
1643
1668
|
a[e] = this[e];
|
|
1644
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1669
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new W(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) {
|
|
1645
1670
|
let e = {
|
|
1646
|
-
...
|
|
1671
|
+
...Z().interpolation,
|
|
1647
1672
|
...this.options.interpolation,
|
|
1648
1673
|
...t.interpolation
|
|
1649
1674
|
}, n = {
|
|
1650
1675
|
...i,
|
|
1651
1676
|
interpolation: e
|
|
1652
1677
|
};
|
|
1653
|
-
a.services.interpolator = new
|
|
1678
|
+
a.services.interpolator = new Fe(n);
|
|
1654
1679
|
}
|
|
1655
|
-
return a.translator = new
|
|
1680
|
+
return a.translator = new ke(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1656
1681
|
a.emit(e, ...t);
|
|
1657
1682
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1658
1683
|
}
|
|
@@ -1673,13 +1698,13 @@ $.createInstance, $.dir, $.init, $.loadResources, $.reloadResources, $.use, $.ch
|
|
|
1673
1698
|
lng: "en",
|
|
1674
1699
|
showSupportNotice: !1,
|
|
1675
1700
|
resources: {
|
|
1676
|
-
en:
|
|
1677
|
-
es:
|
|
1701
|
+
en: he,
|
|
1702
|
+
es: ge
|
|
1678
1703
|
}
|
|
1679
1704
|
});
|
|
1680
1705
|
//#endregion
|
|
1681
1706
|
//#region src/i18n.ts
|
|
1682
|
-
var { translator:
|
|
1707
|
+
var { translator: Je } = {
|
|
1683
1708
|
translator: {
|
|
1684
1709
|
...$,
|
|
1685
1710
|
t: (e, t) => {
|
|
@@ -1711,13 +1736,13 @@ var { translator: He } = {
|
|
|
1711
1736
|
label: "Spanish"
|
|
1712
1737
|
}]
|
|
1713
1738
|
};
|
|
1714
|
-
function
|
|
1715
|
-
return
|
|
1739
|
+
function Ye(e, t) {
|
|
1740
|
+
return Je.t(`translation:simpleCloze:${e}`, { lng: t });
|
|
1716
1741
|
}
|
|
1717
|
-
function
|
|
1718
|
-
return
|
|
1742
|
+
function Xe(e, t) {
|
|
1743
|
+
return Je.t(`common:${e}`, { lng: t });
|
|
1719
1744
|
}
|
|
1720
1745
|
//#endregion
|
|
1721
|
-
export {
|
|
1746
|
+
export { Xe as n, me as r, Ye as t };
|
|
1722
1747
|
|
|
1723
|
-
//# sourceMappingURL=i18n-
|
|
1748
|
+
//# sourceMappingURL=i18n-CBClmRAq.js.map
|