@1024pix/epreuves-components 4.0.1 → 4.0.2
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/{Button.ce-CTKrSDrC.js → Button.ce-CIdOR7Ut.js} +2 -2
- package/dist/{ButtonTooltip.ce-CtHo2Dwx.js → ButtonTooltip.ce-DcDedpxX.js} +8 -8
- package/dist/{Cross.ce.vue_vue_type_script_setup_true_lang-CVBFTfq5.js → Cross.ce.vue_vue_type_script_setup_true_lang-BZa1HfxH.js} +4 -4
- package/dist/FocusManager.ce-B9q14nBB.js +131 -0
- package/dist/{LLMMessage.ce-Bdmf0R1g.js → LLMMessage.ce-m7gAgj3M.js} +11 -11
- package/dist/{Loading.ce-Bh7-h48F.js → Loading.ce-Diq78Qvm.js} +2 -2
- package/dist/{NavigationButton.ce-CA1M8sgV.js → NavigationButton.ce-CgVczgG8.js} +2 -2
- package/dist/PixMailMessage.ce-CI8R0PnN.js +261 -0
- package/dist/Popin.ce-BczgRCZ5.js +67 -0
- package/dist/{Retry-BZf7NJz9.js → Retry-vIN7ZGdK.js} +2 -2
- package/dist/{Stepper.ce-B1yDelzC.js → Stepper.ce-DwjG4jda.js} +4 -4
- package/dist/{_plugin-vue_export-helper-D0N_62VD.js → _plugin-vue_export-helper-VRfPs3B6.js} +1643 -1611
- package/dist/components/analyse-mails-phishing.ce.js.js +14 -14
- package/dist/components/calcul-impact.ce.js.js +20 -20
- package/dist/components/capacity-calculation.ce.js.js +22 -22
- package/dist/components/clickable-image.ce.js.js +30 -30
- package/dist/components/complete-phrase.ce.js.js +18 -18
- package/dist/components/flip-cards.ce.js.js +10 -10
- package/dist/components/image-quiz.ce.js.js +3 -3
- package/dist/components/image-quizzes.ce.js.js +3 -3
- package/dist/components/llm-compare-messages.ce.js.js +7 -7
- package/dist/components/llm-messages.ce.js.js +7 -7
- package/dist/components/llm-prompt-select.ce.js.js +5 -5
- package/dist/components/mdp-classement.ce.js.js +29 -29
- package/dist/components/message-conversation.ce.js.js +34 -34
- package/dist/components/mobile-shell.ce.js.js +8 -8
- package/dist/components/phishing-message.ce.js.js +128 -128
- package/dist/components/phishing-notification.ce.js.js +30 -30
- package/dist/components/pix-anonymisation.ce.js.js +27 -27
- package/dist/components/pix-article.ce.js.js +5 -5
- package/dist/components/pix-carousel.ce.js.js +38 -38
- package/dist/components/pix-combinaisons.ce.js.js +75 -74
- package/dist/components/pix-cursor.ce.js.js +26 -26
- package/dist/components/pix-mail-message.ce.js.js +3 -3
- package/dist/components/proteger-mail-spam.ce.js.js +55 -53
- package/dist/components/qcm-deepfake.ce.js.js +16 -16
- package/dist/components/quiz-stepper.ce.js.js +21 -21
- package/dist/components/select-conversation.ce.js.js +11 -11
- package/dist/components/template-mail.ce.js.js +4 -4
- package/dist/components/test-top-mdp.ce.js.js +24 -24
- package/dist/components/trouver-mdp-rs.ce.js.js +311 -409
- package/dist/{i18n-ekiZvzf6.js → i18n-C-9bWDxP.js} +270 -268
- package/dist/{i18n-lite-t2jNOu0C.js → i18n-lite-CZIis7T7.js} +1 -1
- package/dist/{image-quiz.ce-DqalWHKw.js → image-quiz.ce-COX8VOUE.js} +9 -9
- package/dist/{index-BpqxFmwz.js → index-DgWpXIzq.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/shadow-dom-5ECgVh4w.js +14 -0
- package/dist/{temporal.utils-7Uvm62ss.js → temporal.utils-DgmGPVba.js} +537 -536
- package/package.json +1 -1
- package/dist/PixMailMessage.ce-XPDbJiyC.js +0 -219
- package/dist/Popin.ce-DUQ7-GMT.js +0 -197
- package/dist/shadow-dom-C3AZuSZe.js +0 -9
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
const d = (
|
|
3
|
-
let
|
|
1
|
+
import { n as Re, b as Ce, A as Pe, i as $e } from "./_plugin-vue_export-helper-VRfPs3B6.js";
|
|
2
|
+
const d = (a) => typeof a == "string", A = () => {
|
|
3
|
+
let a, e;
|
|
4
4
|
const t = new Promise((i, s) => {
|
|
5
|
-
|
|
5
|
+
a = i, e = s;
|
|
6
6
|
});
|
|
7
|
-
return t.resolve =
|
|
8
|
-
}, ie = (
|
|
9
|
-
|
|
7
|
+
return t.resolve = a, t.reject = e, t;
|
|
8
|
+
}, ie = (a) => a == null ? "" : "" + a, Ne = (a, e, t) => {
|
|
9
|
+
a.forEach((i) => {
|
|
10
10
|
e[i] && (t[i] = e[i]);
|
|
11
11
|
});
|
|
12
|
-
},
|
|
12
|
+
}, ke = /###/g, ne = (a) => a && a.indexOf("###") > -1 ? a.replace(ke, ".") : a, re = (a) => !a || d(a), V = (a, e, t) => {
|
|
13
13
|
const i = d(e) ? e.split(".") : e;
|
|
14
14
|
let s = 0;
|
|
15
15
|
for (; s < i.length - 1; ) {
|
|
16
|
-
if (re(
|
|
16
|
+
if (re(a)) return {};
|
|
17
17
|
const n = ne(i[s]);
|
|
18
|
-
!
|
|
18
|
+
!a[n] && t && (a[n] = new t()), Object.prototype.hasOwnProperty.call(a, n) ? a = a[n] : a = {}, ++s;
|
|
19
19
|
}
|
|
20
|
-
return re(
|
|
21
|
-
obj:
|
|
20
|
+
return re(a) ? {} : {
|
|
21
|
+
obj: a,
|
|
22
22
|
k: ne(i[s])
|
|
23
23
|
};
|
|
24
|
-
}, ae = (
|
|
24
|
+
}, ae = (a, e, t) => {
|
|
25
25
|
const {
|
|
26
26
|
obj: i,
|
|
27
27
|
k: s
|
|
28
|
-
} =
|
|
28
|
+
} = V(a, e, Object);
|
|
29
29
|
if (i !== void 0 || e.length === 1) {
|
|
30
30
|
i[s] = t;
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
-
let n = e[e.length - 1], r = e.slice(0, e.length - 1),
|
|
34
|
-
for (;
|
|
35
|
-
n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1),
|
|
36
|
-
|
|
37
|
-
},
|
|
33
|
+
let n = e[e.length - 1], r = e.slice(0, e.length - 1), o = V(a, r, Object);
|
|
34
|
+
for (; o.obj === void 0 && r.length; )
|
|
35
|
+
n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), o = V(a, r, Object), o?.obj && typeof o.obj[`${o.k}.${n}`] < "u" && (o.obj = void 0);
|
|
36
|
+
o.obj[`${o.k}.${n}`] = t;
|
|
37
|
+
}, Ee = (a, e, t, i) => {
|
|
38
38
|
const {
|
|
39
39
|
obj: s,
|
|
40
40
|
k: n
|
|
41
|
-
} =
|
|
41
|
+
} = V(a, e, Object);
|
|
42
42
|
s[n] = s[n] || [], s[n].push(t);
|
|
43
|
-
}, B = (
|
|
43
|
+
}, B = (a, e) => {
|
|
44
44
|
const {
|
|
45
45
|
obj: t,
|
|
46
46
|
k: i
|
|
47
|
-
} =
|
|
47
|
+
} = V(a, e);
|
|
48
48
|
if (t && Object.prototype.hasOwnProperty.call(t, i))
|
|
49
49
|
return t[i];
|
|
50
|
-
},
|
|
51
|
-
const i = B(
|
|
50
|
+
}, je = (a, e, t) => {
|
|
51
|
+
const i = B(a, t);
|
|
52
52
|
return i !== void 0 ? i : B(e, t);
|
|
53
|
-
}, xe = (
|
|
53
|
+
}, xe = (a, e, t) => {
|
|
54
54
|
for (const i in e)
|
|
55
|
-
i !== "__proto__" && i !== "constructor" && (i in
|
|
56
|
-
return
|
|
57
|
-
},
|
|
55
|
+
i !== "__proto__" && i !== "constructor" && (i in a ? d(a[i]) || a[i] instanceof String || d(e[i]) || e[i] instanceof String ? t && (a[i] = e[i]) : xe(a[i], e[i], t) : a[i] = e[i]);
|
|
56
|
+
return a;
|
|
57
|
+
}, F = (a) => a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
58
58
|
var Fe = {
|
|
59
59
|
"&": "&",
|
|
60
60
|
"<": "<",
|
|
@@ -63,8 +63,8 @@ var Fe = {
|
|
|
63
63
|
"'": "'",
|
|
64
64
|
"/": "/"
|
|
65
65
|
};
|
|
66
|
-
const
|
|
67
|
-
class
|
|
66
|
+
const Ie = (a) => d(a) ? a.replace(/[&<>"'\/]/g, (e) => Fe[e]) : a;
|
|
67
|
+
class Te {
|
|
68
68
|
constructor(e) {
|
|
69
69
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
70
70
|
}
|
|
@@ -76,29 +76,29 @@ class Ie {
|
|
|
76
76
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, i), this.regExpQueue.push(e), i;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const
|
|
79
|
+
const De = [" ", ",", "?", "!", ";"], Ke = new Te(20), Ae = (a, e, t) => {
|
|
80
80
|
e = e || "", t = t || "";
|
|
81
|
-
const i =
|
|
81
|
+
const i = De.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
|
|
82
82
|
if (i.length === 0) return !0;
|
|
83
|
-
const s =
|
|
84
|
-
let n = !s.test(
|
|
83
|
+
const s = Ke.getRegExp(`(${i.map((r) => r === "?" ? "\\?" : r).join("|")})`);
|
|
84
|
+
let n = !s.test(a);
|
|
85
85
|
if (!n) {
|
|
86
|
-
const r =
|
|
87
|
-
r > 0 && !s.test(
|
|
86
|
+
const r = a.indexOf(t);
|
|
87
|
+
r > 0 && !s.test(a.substring(0, r)) && (n = !0);
|
|
88
88
|
}
|
|
89
89
|
return n;
|
|
90
|
-
}, Z = (
|
|
91
|
-
if (!
|
|
92
|
-
if (
|
|
93
|
-
return Object.prototype.hasOwnProperty.call(
|
|
90
|
+
}, Z = (a, e, t = ".") => {
|
|
91
|
+
if (!a) return;
|
|
92
|
+
if (a[e])
|
|
93
|
+
return Object.prototype.hasOwnProperty.call(a, e) ? a[e] : void 0;
|
|
94
94
|
const i = e.split(t);
|
|
95
|
-
let s =
|
|
95
|
+
let s = a;
|
|
96
96
|
for (let n = 0; n < i.length; ) {
|
|
97
97
|
if (!s || typeof s != "object")
|
|
98
98
|
return;
|
|
99
|
-
let r,
|
|
99
|
+
let r, o = "";
|
|
100
100
|
for (let l = n; l < i.length; ++l)
|
|
101
|
-
if (l !== n && (
|
|
101
|
+
if (l !== n && (o += t), o += i[l], r = s[o], r !== void 0) {
|
|
102
102
|
if (["string", "number", "boolean"].indexOf(typeof r) > -1 && l < i.length - 1)
|
|
103
103
|
continue;
|
|
104
104
|
n += l - n + 1;
|
|
@@ -107,19 +107,19 @@ const Te = [" ", ",", "?", "!", ";"], De = new Ie(20), Ke = (o, e, t) => {
|
|
|
107
107
|
s = r;
|
|
108
108
|
}
|
|
109
109
|
return s;
|
|
110
|
-
}, M = (
|
|
110
|
+
}, M = (a) => a?.replace(/_/g, "-"), Ve = {
|
|
111
111
|
type: "logger",
|
|
112
|
-
log(
|
|
113
|
-
this.output("log",
|
|
112
|
+
log(a) {
|
|
113
|
+
this.output("log", a);
|
|
114
114
|
},
|
|
115
|
-
warn(
|
|
116
|
-
this.output("warn",
|
|
115
|
+
warn(a) {
|
|
116
|
+
this.output("warn", a);
|
|
117
117
|
},
|
|
118
|
-
error(
|
|
119
|
-
this.output("error",
|
|
118
|
+
error(a) {
|
|
119
|
+
this.output("error", a);
|
|
120
120
|
},
|
|
121
|
-
output(
|
|
122
|
-
console?.[
|
|
121
|
+
output(a, e) {
|
|
122
|
+
console?.[a]?.apply?.(console, e);
|
|
123
123
|
}
|
|
124
124
|
};
|
|
125
125
|
class J {
|
|
@@ -155,7 +155,7 @@ class J {
|
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
157
|
var P = new J();
|
|
158
|
-
class
|
|
158
|
+
class Y {
|
|
159
159
|
constructor() {
|
|
160
160
|
this.observers = {};
|
|
161
161
|
}
|
|
@@ -185,7 +185,7 @@ class W {
|
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
class oe extends
|
|
188
|
+
class oe extends Y {
|
|
189
189
|
constructor(e, t = {
|
|
190
190
|
ns: ["translation"],
|
|
191
191
|
defaultNS: "translation"
|
|
@@ -201,17 +201,17 @@ class oe extends W {
|
|
|
201
201
|
}
|
|
202
202
|
getResource(e, t, i, s = {}) {
|
|
203
203
|
const n = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, r = s.ignoreJSONStructure !== void 0 ? s.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
204
|
-
let
|
|
205
|
-
e.indexOf(".") > -1 ?
|
|
206
|
-
const l = B(this.data,
|
|
207
|
-
return !l && !t && !i && e.indexOf(".") > -1 && (e =
|
|
204
|
+
let o;
|
|
205
|
+
e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], i && (Array.isArray(i) ? o.push(...i) : d(i) && n ? o.push(...i.split(n)) : o.push(i)));
|
|
206
|
+
const l = B(this.data, o);
|
|
207
|
+
return !l && !t && !i && e.indexOf(".") > -1 && (e = o[0], t = o[1], i = o.slice(2).join(".")), l || !r || !d(i) ? l : Z(this.data?.[e]?.[t], i, n);
|
|
208
208
|
}
|
|
209
209
|
addResource(e, t, i, s, n = {
|
|
210
210
|
silent: !1
|
|
211
211
|
}) {
|
|
212
212
|
const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
|
|
213
|
-
let
|
|
214
|
-
i && (
|
|
213
|
+
let o = [e, t];
|
|
214
|
+
i && (o = o.concat(r ? i.split(r) : i)), e.indexOf(".") > -1 && (o = e.split("."), s = t, t = o[1]), this.addNamespaces(t), ae(this.data, o, s), n.silent || this.emit("added", e, t, i, s);
|
|
215
215
|
}
|
|
216
216
|
addResources(e, t, i, s = {
|
|
217
217
|
silent: !1
|
|
@@ -226,13 +226,13 @@ class oe extends W {
|
|
|
226
226
|
silent: !1,
|
|
227
227
|
skipCopy: !1
|
|
228
228
|
}) {
|
|
229
|
-
let
|
|
230
|
-
e.indexOf(".") > -1 && (
|
|
231
|
-
let l = B(this.data,
|
|
229
|
+
let o = [e, t];
|
|
230
|
+
e.indexOf(".") > -1 && (o = e.split("."), s = i, i = t, t = o[1]), this.addNamespaces(t);
|
|
231
|
+
let l = B(this.data, o) || {};
|
|
232
232
|
r.skipCopy || (i = JSON.parse(JSON.stringify(i))), s ? xe(l, i, n) : l = {
|
|
233
233
|
...l,
|
|
234
234
|
...i
|
|
235
|
-
}, ae(this.data,
|
|
235
|
+
}, ae(this.data, o, l), r.silent || this.emit("added", e, t, i);
|
|
236
236
|
}
|
|
237
237
|
removeResourceBundle(e, t) {
|
|
238
238
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -256,31 +256,31 @@ class oe extends W {
|
|
|
256
256
|
}
|
|
257
257
|
var ye = {
|
|
258
258
|
processors: {},
|
|
259
|
-
addPostProcessor(
|
|
260
|
-
this.processors[
|
|
259
|
+
addPostProcessor(a) {
|
|
260
|
+
this.processors[a.name] = a;
|
|
261
261
|
},
|
|
262
|
-
handle(
|
|
263
|
-
return
|
|
262
|
+
handle(a, e, t, i, s) {
|
|
263
|
+
return a.forEach((n) => {
|
|
264
264
|
e = this.processors[n]?.process(e, t, i, s) ?? e;
|
|
265
265
|
}), e;
|
|
266
266
|
}
|
|
267
267
|
};
|
|
268
268
|
const Se = /* @__PURE__ */ Symbol("i18next/PATH_KEY");
|
|
269
|
-
function
|
|
270
|
-
const
|
|
269
|
+
function Ue() {
|
|
270
|
+
const a = [], e = /* @__PURE__ */ Object.create(null);
|
|
271
271
|
let t;
|
|
272
|
-
return e.get = (i, s) => (t?.revoke?.(), s === Se ?
|
|
272
|
+
return e.get = (i, s) => (t?.revoke?.(), s === Se ? a : (a.push(s), t = Proxy.revocable(i, e), t.proxy)), Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
|
|
273
273
|
}
|
|
274
|
-
function X(
|
|
274
|
+
function X(a, e) {
|
|
275
275
|
const {
|
|
276
276
|
[Se]: t
|
|
277
|
-
} =
|
|
277
|
+
} = a(Ue());
|
|
278
278
|
return t.join(e?.keySeparator ?? ".");
|
|
279
279
|
}
|
|
280
|
-
const le = {},
|
|
281
|
-
class _ extends
|
|
280
|
+
const le = {}, W = (a) => !d(a) && typeof a != "boolean" && typeof a != "number";
|
|
281
|
+
class _ extends Y {
|
|
282
282
|
constructor(e, t = {}) {
|
|
283
|
-
super(),
|
|
283
|
+
super(), Ne(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = P.create("translator");
|
|
284
284
|
}
|
|
285
285
|
changeLanguage(e) {
|
|
286
286
|
e && (this.language = e);
|
|
@@ -294,7 +294,7 @@ class _ extends W {
|
|
|
294
294
|
if (e == null) return !1;
|
|
295
295
|
const s = this.resolve(e, i);
|
|
296
296
|
if (s?.res === void 0) return !1;
|
|
297
|
-
const n =
|
|
297
|
+
const n = W(s.res);
|
|
298
298
|
return !(i.returnObjects === !1 && n);
|
|
299
299
|
}
|
|
300
300
|
extractFromKey(e, t) {
|
|
@@ -302,8 +302,8 @@ class _ extends W {
|
|
|
302
302
|
i === void 0 && (i = ":");
|
|
303
303
|
const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
304
304
|
let n = t.ns || this.options.defaultNS || [];
|
|
305
|
-
const r = i && e.indexOf(i) > -1,
|
|
306
|
-
if (r && !
|
|
305
|
+
const r = i && e.indexOf(i) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ae(e, i, s);
|
|
306
|
+
if (r && !o) {
|
|
307
307
|
const l = e.match(this.interpolator.nestingRegexp);
|
|
308
308
|
if (l && l.length > 0)
|
|
309
309
|
return {
|
|
@@ -330,7 +330,7 @@ class _ extends W {
|
|
|
330
330
|
...s
|
|
331
331
|
})), Array.isArray(e) || (e = [String(e)]);
|
|
332
332
|
const n = s.returnDetails !== void 0 ? s.returnDetails : this.options.returnDetails, r = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, {
|
|
333
|
-
key:
|
|
333
|
+
key: o,
|
|
334
334
|
namespaces: l
|
|
335
335
|
} = this.extractFromKey(e[e.length - 1], s), u = l[l.length - 1];
|
|
336
336
|
let c = s.nsSeparator !== void 0 ? s.nsSeparator : this.options.nsSeparator;
|
|
@@ -338,35 +338,35 @@ class _ extends W {
|
|
|
338
338
|
const f = s.lng || this.language, g = s.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
339
339
|
if (f?.toLowerCase() === "cimode")
|
|
340
340
|
return g ? n ? {
|
|
341
|
-
res: `${u}${c}${
|
|
342
|
-
usedKey:
|
|
343
|
-
exactUsedKey:
|
|
341
|
+
res: `${u}${c}${o}`,
|
|
342
|
+
usedKey: o,
|
|
343
|
+
exactUsedKey: o,
|
|
344
344
|
usedLng: f,
|
|
345
345
|
usedNS: u,
|
|
346
346
|
usedParams: this.getUsedParamsDetails(s)
|
|
347
|
-
} : `${u}${c}${
|
|
348
|
-
res:
|
|
349
|
-
usedKey:
|
|
350
|
-
exactUsedKey:
|
|
347
|
+
} : `${u}${c}${o}` : n ? {
|
|
348
|
+
res: o,
|
|
349
|
+
usedKey: o,
|
|
350
|
+
exactUsedKey: o,
|
|
351
351
|
usedLng: f,
|
|
352
352
|
usedNS: u,
|
|
353
353
|
usedParams: this.getUsedParamsDetails(s)
|
|
354
|
-
} :
|
|
354
|
+
} : o;
|
|
355
355
|
const p = this.resolve(e, s);
|
|
356
356
|
let h = p?.res;
|
|
357
|
-
const x = p?.usedKey ||
|
|
357
|
+
const x = p?.usedKey || o, S = p?.exactUsedKey || o, L = ["[object Number]", "[object Function]", "[object RegExp]"], y = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, E = !this.i18nFormat || this.i18nFormat.handleAsObject, O = s.count !== void 0 && !d(s.count), N = _.hasDefaultValue(s), I = O ? this.pluralResolver.getSuffix(f, s.count, s) : "", T = s.ordinal && O ? this.pluralResolver.getSuffix(f, s.count, {
|
|
358
358
|
ordinal: !1
|
|
359
|
-
}) : "", q = O && !s.ordinal && s.count === 0, k = q && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${
|
|
359
|
+
}) : "", q = O && !s.ordinal && s.count === 0, k = q && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${I}`] || s[`defaultValue${T}`] || s.defaultValue;
|
|
360
360
|
let v = h;
|
|
361
361
|
E && !h && N && (v = k);
|
|
362
|
-
const
|
|
363
|
-
if (E && v &&
|
|
362
|
+
const we = W(v), ve = Object.prototype.toString.apply(v);
|
|
363
|
+
if (E && v && we && L.indexOf(ve) < 0 && !(d(y) && Array.isArray(v))) {
|
|
364
364
|
if (!s.returnObjects && !this.options.returnObjects) {
|
|
365
365
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
366
366
|
const R = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(x, v, {
|
|
367
367
|
...s,
|
|
368
368
|
ns: l
|
|
369
|
-
}) : `key '${
|
|
369
|
+
}) : `key '${o} (${this.language})' returned an object instead of string.`;
|
|
370
370
|
return n ? (p.res = R, p.usedParams = this.getUsedParamsDetails(s), p) : R;
|
|
371
371
|
}
|
|
372
372
|
if (r) {
|
|
@@ -376,7 +376,7 @@ class _ extends W {
|
|
|
376
376
|
const $ = `${ee}${r}${C}`;
|
|
377
377
|
N && !h ? w[C] = this.translate($, {
|
|
378
378
|
...s,
|
|
379
|
-
defaultValue:
|
|
379
|
+
defaultValue: W(k) ? k[C] : void 0,
|
|
380
380
|
joinArrays: !1,
|
|
381
381
|
ns: l
|
|
382
382
|
}) : w[C] = this.translate($, {
|
|
@@ -391,34 +391,34 @@ class _ extends W {
|
|
|
391
391
|
h = h.join(y), h && (h = this.extendTranslation(h, e, s, i));
|
|
392
392
|
else {
|
|
393
393
|
let R = !1, w = !1;
|
|
394
|
-
!this.isValidLookup(h) && N && (R = !0, h = k), this.isValidLookup(h) || (w = !0, h =
|
|
394
|
+
!this.isValidLookup(h) && N && (R = !0, h = k), this.isValidLookup(h) || (w = !0, h = o);
|
|
395
395
|
const C = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && w ? void 0 : h, $ = N && k !== h && this.options.updateMissing;
|
|
396
396
|
if (w || R || $) {
|
|
397
|
-
if (this.logger.log($ ? "updateKey" : "missingKey", f, u,
|
|
398
|
-
const b = this.resolve(
|
|
397
|
+
if (this.logger.log($ ? "updateKey" : "missingKey", f, u, o, $ ? k : h), r) {
|
|
398
|
+
const b = this.resolve(o, {
|
|
399
399
|
...s,
|
|
400
400
|
keySeparator: !1
|
|
401
401
|
});
|
|
402
402
|
b && b.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
403
403
|
}
|
|
404
404
|
let D = [];
|
|
405
|
-
const
|
|
406
|
-
if (this.options.saveMissingTo === "fallback" &&
|
|
407
|
-
for (let b = 0; b <
|
|
408
|
-
D.push(
|
|
405
|
+
const z = this.languageUtils.getFallbackCodes(this.options.fallbackLng, s.lng || this.language);
|
|
406
|
+
if (this.options.saveMissingTo === "fallback" && z && z[0])
|
|
407
|
+
for (let b = 0; b < z.length; b++)
|
|
408
|
+
D.push(z[b]);
|
|
409
409
|
else this.options.saveMissingTo === "all" ? D = this.languageUtils.toResolveHierarchy(s.lng || this.language) : D.push(s.lng || this.language);
|
|
410
|
-
const te = (b,
|
|
410
|
+
const te = (b, j, K) => {
|
|
411
411
|
const se = N && K !== h ? K : C;
|
|
412
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(b, u,
|
|
412
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(b, u, j, se, $, s) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(b, u, j, se, $, s), this.emit("missingKey", b, u, j, h);
|
|
413
413
|
};
|
|
414
414
|
this.options.saveMissing && (this.options.saveMissingPlurals && O ? D.forEach((b) => {
|
|
415
|
-
const
|
|
416
|
-
q && s[`defaultValue${this.options.pluralSeparator}zero`] &&
|
|
417
|
-
te([b],
|
|
415
|
+
const j = this.pluralResolver.getSuffixes(b, s);
|
|
416
|
+
q && s[`defaultValue${this.options.pluralSeparator}zero`] && j.indexOf(`${this.options.pluralSeparator}zero`) < 0 && j.push(`${this.options.pluralSeparator}zero`), j.forEach((K) => {
|
|
417
|
+
te([b], o + K, s[`defaultValue${K}`] || k);
|
|
418
418
|
});
|
|
419
|
-
}) : te(D,
|
|
419
|
+
}) : te(D, o, k));
|
|
420
420
|
}
|
|
421
|
-
h = this.extendTranslation(h, e, s, p, i), w && h ===
|
|
421
|
+
h = this.extendTranslation(h, e, s, p, i), w && h === o && this.options.appendNamespaceToMissingKey && (h = `${u}${c}${o}`), (w || R) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${c}${o}` : o, R ? h : void 0, s));
|
|
422
422
|
}
|
|
423
423
|
return n ? (p.res = h, p.usedParams = this.getUsedParamsDetails(s), p) : h;
|
|
424
424
|
}
|
|
@@ -454,8 +454,8 @@ class _ extends W {
|
|
|
454
454
|
}
|
|
455
455
|
!i.lng && s && s.res && (i.lng = this.language || s.usedLng), i.nest !== !1 && (e = this.interpolator.nest(e, (...f) => n?.[0] === f[0] && !i.context ? (this.logger.warn(`It seems you are nesting recursively key: ${f[0]} in key: ${t[0]}`), null) : this.translate(...f, t), i)), i.interpolation && this.interpolator.reset();
|
|
456
456
|
}
|
|
457
|
-
const r = i.postProcess || this.options.postProcess,
|
|
458
|
-
return e != null &&
|
|
457
|
+
const r = i.postProcess || this.options.postProcess, o = d(r) ? [r] : r;
|
|
458
|
+
return e != null && o?.length && i.applyPostProcessor !== !1 && (e = ye.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
459
459
|
i18nResolved: {
|
|
460
460
|
...s,
|
|
461
461
|
usedParams: this.getUsedParamsDetails(i)
|
|
@@ -464,7 +464,7 @@ class _ extends W {
|
|
|
464
464
|
} : i, this)), e;
|
|
465
465
|
}
|
|
466
466
|
resolve(e, t = {}) {
|
|
467
|
-
let i, s, n, r,
|
|
467
|
+
let i, s, n, r, o;
|
|
468
468
|
return d(e) && (e = [e]), e.forEach((l) => {
|
|
469
469
|
if (this.isValidLookup(i)) return;
|
|
470
470
|
const u = this.extractFromKey(l, t), c = u.key;
|
|
@@ -473,7 +473,7 @@ class _ extends W {
|
|
|
473
473
|
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
474
474
|
const g = t.count !== void 0 && !d(t.count), p = g && !t.ordinal && t.count === 0, h = t.context !== void 0 && (d(t.context) || typeof t.context == "number") && t.context !== "", x = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
|
|
475
475
|
f.forEach((S) => {
|
|
476
|
-
this.isValidLookup(i) || (
|
|
476
|
+
this.isValidLookup(i) || (o = S, !le[`${x[0]}-${S}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (le[`${x[0]}-${S}`] = !0, this.logger.warn(`key "${s}" for languages "${x.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!!!")), x.forEach((L) => {
|
|
477
477
|
if (this.isValidLookup(i)) return;
|
|
478
478
|
r = L;
|
|
479
479
|
const y = [c];
|
|
@@ -482,10 +482,10 @@ class _ extends W {
|
|
|
482
482
|
else {
|
|
483
483
|
let O;
|
|
484
484
|
g && (O = this.pluralResolver.getSuffix(L, t.count, t));
|
|
485
|
-
const N = `${this.options.pluralSeparator}zero`,
|
|
486
|
-
if (g && (t.ordinal && O.indexOf(
|
|
487
|
-
const
|
|
488
|
-
y.push(
|
|
485
|
+
const N = `${this.options.pluralSeparator}zero`, I = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
486
|
+
if (g && (t.ordinal && O.indexOf(I) === 0 && y.push(c + O.replace(I, this.options.pluralSeparator)), y.push(c + O), p && y.push(c + N)), h) {
|
|
487
|
+
const T = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
488
|
+
y.push(T), g && (t.ordinal && O.indexOf(I) === 0 && y.push(T + O.replace(I, this.options.pluralSeparator)), y.push(T + O), p && y.push(T + N));
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
491
|
let E;
|
|
@@ -498,7 +498,7 @@ class _ extends W {
|
|
|
498
498
|
usedKey: s,
|
|
499
499
|
exactUsedKey: n,
|
|
500
500
|
usedLng: r,
|
|
501
|
-
usedNS:
|
|
501
|
+
usedNS: o
|
|
502
502
|
};
|
|
503
503
|
}
|
|
504
504
|
isValidLookup(e) {
|
|
@@ -602,12 +602,12 @@ const fe = {
|
|
|
602
602
|
many: 4,
|
|
603
603
|
other: 5
|
|
604
604
|
}, ce = {
|
|
605
|
-
select: (
|
|
605
|
+
select: (a) => a === 1 ? "one" : "other",
|
|
606
606
|
resolvedOptions: () => ({
|
|
607
607
|
pluralCategories: ["one", "other"]
|
|
608
608
|
})
|
|
609
609
|
};
|
|
610
|
-
class
|
|
610
|
+
class Me {
|
|
611
611
|
constructor(e, t = {}) {
|
|
612
612
|
this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), this.pluralRulesCache = {};
|
|
613
613
|
}
|
|
@@ -627,7 +627,7 @@ class Ue {
|
|
|
627
627
|
type: s
|
|
628
628
|
});
|
|
629
629
|
} catch {
|
|
630
|
-
if (
|
|
630
|
+
if (typeof Intl > "u")
|
|
631
631
|
return this.logger.error("No Intl support, please use an Intl polyfill!"), ce;
|
|
632
632
|
if (!e.match(/-|_/)) return ce;
|
|
633
633
|
const l = this.languageUtils.getLanguagePartFromCode(e);
|
|
@@ -651,10 +651,10 @@ class Ue {
|
|
|
651
651
|
return s ? `${this.options.prepend}${i.ordinal ? `ordinal${this.options.prepend}` : ""}${s.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, i));
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
const he = (
|
|
655
|
-
let n =
|
|
656
|
-
return !n && s && d(t) && (n = Z(
|
|
657
|
-
}, Q = (
|
|
654
|
+
const he = (a, e, t, i = ".", s = !0) => {
|
|
655
|
+
let n = je(a, e, t);
|
|
656
|
+
return !n && s && d(t) && (n = Z(a, t, i), n === void 0 && (n = Z(e, t, i))), n;
|
|
657
|
+
}, Q = (a) => a.replace(/\$/g, "$$$$");
|
|
658
658
|
class de {
|
|
659
659
|
constructor(e = {}) {
|
|
660
660
|
this.logger = P.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
|
|
@@ -669,7 +669,7 @@ class de {
|
|
|
669
669
|
useRawValueToEscape: s,
|
|
670
670
|
prefix: n,
|
|
671
671
|
prefixEscaped: r,
|
|
672
|
-
suffix:
|
|
672
|
+
suffix: o,
|
|
673
673
|
suffixEscaped: l,
|
|
674
674
|
formatSeparator: u,
|
|
675
675
|
unescapeSuffix: c,
|
|
@@ -682,7 +682,7 @@ class de {
|
|
|
682
682
|
maxReplaces: L,
|
|
683
683
|
alwaysFormat: y
|
|
684
684
|
} = e.interpolation;
|
|
685
|
-
this.escape = t !== void 0 ? t :
|
|
685
|
+
this.escape = t !== void 0 ? t : Ie, this.escapeValue = i !== void 0 ? i : !0, this.useRawValueToEscape = s !== void 0 ? s : !1, this.prefix = n ? F(n) : r || "{{", this.suffix = o ? F(o) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = c ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : c || "", this.nestingPrefix = g ? F(g) : p || F("$t("), this.nestingSuffix = h ? F(h) : x || F(")"), this.nestingOptionsSeparator = S || ",", this.maxReplaces = L || 1e3, this.alwaysFormat = y !== void 0 ? y : !1, this.resetRegExp();
|
|
686
686
|
}
|
|
687
687
|
reset() {
|
|
688
688
|
this.options && this.init(this.options);
|
|
@@ -692,7 +692,7 @@ class de {
|
|
|
692
692
|
this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
|
|
693
693
|
}
|
|
694
694
|
interpolate(e, t, i, s) {
|
|
695
|
-
let n, r,
|
|
695
|
+
let n, r, o;
|
|
696
696
|
const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (p) => {
|
|
697
697
|
if (p.indexOf(this.formatSeparator) < 0) {
|
|
698
698
|
const L = he(t, l, p, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
@@ -718,7 +718,7 @@ class de {
|
|
|
718
718
|
regex: this.regexp,
|
|
719
719
|
safeValue: (p) => this.escapeValue ? Q(this.escape(p)) : Q(p)
|
|
720
720
|
}].forEach((p) => {
|
|
721
|
-
for (
|
|
721
|
+
for (o = 0; n = p.regex.exec(e); ) {
|
|
722
722
|
const h = n[1].trim();
|
|
723
723
|
if (r = u(h), r === void 0)
|
|
724
724
|
if (typeof c == "function") {
|
|
@@ -733,21 +733,21 @@ class de {
|
|
|
733
733
|
this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`), r = "";
|
|
734
734
|
else !d(r) && !this.useRawValueToEscape && (r = ie(r));
|
|
735
735
|
const x = p.safeValue(r);
|
|
736
|
-
if (e = e.replace(n[0], x), f ? (p.regex.lastIndex += r.length, p.regex.lastIndex -= n[0].length) : p.regex.lastIndex = 0,
|
|
736
|
+
if (e = e.replace(n[0], x), f ? (p.regex.lastIndex += r.length, p.regex.lastIndex -= n[0].length) : p.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
737
737
|
break;
|
|
738
738
|
}
|
|
739
739
|
}), e;
|
|
740
740
|
}
|
|
741
741
|
nest(e, t, i = {}) {
|
|
742
742
|
let s, n, r;
|
|
743
|
-
const
|
|
743
|
+
const o = (l, u) => {
|
|
744
744
|
const c = this.nestingOptionsSeparator;
|
|
745
745
|
if (l.indexOf(c) < 0) return l;
|
|
746
|
-
const f = l.split(new RegExp(`${c}[ ]*{`));
|
|
746
|
+
const f = l.split(new RegExp(`${F(c)}[ ]*{`));
|
|
747
747
|
let g = `{${f[1]}`;
|
|
748
748
|
l = f[0], g = this.interpolate(g, r);
|
|
749
749
|
const p = g.match(/'/g), h = g.match(/"/g);
|
|
750
|
-
((p?.length ?? 0) % 2 === 0 && !h || h
|
|
750
|
+
((p?.length ?? 0) % 2 === 0 && !h || (h?.length ?? 0) % 2 !== 0) && (g = g.replace(/'/g, '"'));
|
|
751
751
|
try {
|
|
752
752
|
r = JSON.parse(g), u && (r = {
|
|
753
753
|
...u,
|
|
@@ -764,7 +764,7 @@ class de {
|
|
|
764
764
|
...i
|
|
765
765
|
}, r = r.replace && !d(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
|
|
766
766
|
const u = /{.*}/.test(s[1]) ? s[1].lastIndexOf("}") + 1 : s[1].indexOf(this.formatSeparator);
|
|
767
|
-
if (u !== -1 && (l = s[1].slice(u).split(this.formatSeparator).map((c) => c.trim()).filter(Boolean), s[1] = s[1].slice(0, u)), n = t(
|
|
767
|
+
if (u !== -1 && (l = s[1].slice(u).split(this.formatSeparator).map((c) => c.trim()).filter(Boolean), s[1] = s[1].slice(0, u)), n = t(o.call(this, s[1].trim(), r), r), n && s[0] === e && !d(n)) return n;
|
|
768
768
|
d(n) || (n = ie(n)), n || (this.logger.warn(`missed to resolve ${s[1]} for nesting ${e}`), n = ""), l.length && (n = l.reduce((c, f) => this.format(c, f, i.lng, {
|
|
769
769
|
...i,
|
|
770
770
|
interpolationkey: s[1].trim()
|
|
@@ -773,16 +773,16 @@ class de {
|
|
|
773
773
|
return e;
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
|
-
const
|
|
777
|
-
let e =
|
|
776
|
+
const ze = (a) => {
|
|
777
|
+
let e = a.toLowerCase().trim();
|
|
778
778
|
const t = {};
|
|
779
|
-
if (
|
|
780
|
-
const i =
|
|
779
|
+
if (a.indexOf("(") > -1) {
|
|
780
|
+
const i = a.split("(");
|
|
781
781
|
e = i[0].toLowerCase().trim();
|
|
782
782
|
const s = i[1].substring(0, i[1].length - 1);
|
|
783
783
|
e === "currency" && s.indexOf(":") < 0 ? t.currency || (t.currency = s.trim()) : e === "relativetime" && s.indexOf(":") < 0 ? t.range || (t.range = s.trim()) : s.split(";").forEach((r) => {
|
|
784
784
|
if (r) {
|
|
785
|
-
const [
|
|
785
|
+
const [o, ...l] = r.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), c = o.trim();
|
|
786
786
|
t[c] || (t[c] = u), u === "false" && (t[c] = !1), u === "true" && (t[c] = !0), isNaN(u) || (t[c] = parseInt(u, 10));
|
|
787
787
|
}
|
|
788
788
|
});
|
|
@@ -791,7 +791,7 @@ const Me = (o) => {
|
|
|
791
791
|
formatName: e,
|
|
792
792
|
formatOptions: t
|
|
793
793
|
};
|
|
794
|
-
}, pe = (
|
|
794
|
+
}, pe = (a) => {
|
|
795
795
|
const e = {};
|
|
796
796
|
return (t, i, s) => {
|
|
797
797
|
let n = s;
|
|
@@ -800,11 +800,11 @@ const Me = (o) => {
|
|
|
800
800
|
[s.interpolationkey]: void 0
|
|
801
801
|
});
|
|
802
802
|
const r = i + JSON.stringify(n);
|
|
803
|
-
let
|
|
804
|
-
return
|
|
803
|
+
let o = e[r];
|
|
804
|
+
return o || (o = a(M(i), s), e[r] = o), o(t);
|
|
805
805
|
};
|
|
806
|
-
}, He = (
|
|
807
|
-
class
|
|
806
|
+
}, He = (a) => (e, t, i) => a(M(t), i)(e);
|
|
807
|
+
class Be {
|
|
808
808
|
constructor(e = {}) {
|
|
809
809
|
this.logger = P.create("formatter"), this.options = e, this.init(e);
|
|
810
810
|
}
|
|
@@ -818,32 +818,32 @@ class ze {
|
|
|
818
818
|
const r = new Intl.NumberFormat(s, {
|
|
819
819
|
...n
|
|
820
820
|
});
|
|
821
|
-
return (
|
|
821
|
+
return (o) => r.format(o);
|
|
822
822
|
}),
|
|
823
823
|
currency: i((s, n) => {
|
|
824
824
|
const r = new Intl.NumberFormat(s, {
|
|
825
825
|
...n,
|
|
826
826
|
style: "currency"
|
|
827
827
|
});
|
|
828
|
-
return (
|
|
828
|
+
return (o) => r.format(o);
|
|
829
829
|
}),
|
|
830
830
|
datetime: i((s, n) => {
|
|
831
831
|
const r = new Intl.DateTimeFormat(s, {
|
|
832
832
|
...n
|
|
833
833
|
});
|
|
834
|
-
return (
|
|
834
|
+
return (o) => r.format(o);
|
|
835
835
|
}),
|
|
836
836
|
relativetime: i((s, n) => {
|
|
837
837
|
const r = new Intl.RelativeTimeFormat(s, {
|
|
838
838
|
...n
|
|
839
839
|
});
|
|
840
|
-
return (
|
|
840
|
+
return (o) => r.format(o, n.range || "day");
|
|
841
841
|
}),
|
|
842
842
|
list: i((s, n) => {
|
|
843
843
|
const r = new Intl.ListFormat(s, {
|
|
844
844
|
...n
|
|
845
845
|
});
|
|
846
|
-
return (
|
|
846
|
+
return (o) => r.format(o);
|
|
847
847
|
})
|
|
848
848
|
};
|
|
849
849
|
}
|
|
@@ -855,20 +855,20 @@ class ze {
|
|
|
855
855
|
}
|
|
856
856
|
format(e, t, i, s = {}) {
|
|
857
857
|
const n = t.split(this.formatSeparator);
|
|
858
|
-
if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((
|
|
859
|
-
const
|
|
860
|
-
n[0] = [n[0], ...n.splice(1,
|
|
858
|
+
if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((o) => o.indexOf(")") > -1)) {
|
|
859
|
+
const o = n.findIndex((l) => l.indexOf(")") > -1);
|
|
860
|
+
n[0] = [n[0], ...n.splice(1, o)].join(this.formatSeparator);
|
|
861
861
|
}
|
|
862
|
-
return n.reduce((
|
|
862
|
+
return n.reduce((o, l) => {
|
|
863
863
|
const {
|
|
864
864
|
formatName: u,
|
|
865
865
|
formatOptions: c
|
|
866
|
-
} =
|
|
866
|
+
} = ze(l);
|
|
867
867
|
if (this.formats[u]) {
|
|
868
|
-
let f =
|
|
868
|
+
let f = o;
|
|
869
869
|
try {
|
|
870
870
|
const g = s?.formatParams?.[s.interpolationkey] || {}, p = g.locale || g.lng || s.locale || s.lng || i;
|
|
871
|
-
f = this.formats[u](
|
|
871
|
+
f = this.formats[u](o, p, {
|
|
872
872
|
...c,
|
|
873
873
|
...s,
|
|
874
874
|
...g
|
|
@@ -879,25 +879,25 @@ class ze {
|
|
|
879
879
|
return f;
|
|
880
880
|
} else
|
|
881
881
|
this.logger.warn(`there was no format function for ${u}`);
|
|
882
|
-
return
|
|
882
|
+
return o;
|
|
883
883
|
}, e);
|
|
884
884
|
}
|
|
885
885
|
}
|
|
886
|
-
const
|
|
887
|
-
|
|
886
|
+
const Je = (a, e) => {
|
|
887
|
+
a.pending[e] !== void 0 && (delete a.pending[e], a.pendingCount--);
|
|
888
888
|
};
|
|
889
|
-
class
|
|
889
|
+
class _e extends Y {
|
|
890
890
|
constructor(e, t, i, s = {}) {
|
|
891
891
|
super(), this.backend = e, this.store = t, this.services = i, this.languageUtils = i.languageUtils, this.options = s, this.logger = P.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = s.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = s.maxRetries >= 0 ? s.maxRetries : 5, this.retryTimeout = s.retryTimeout >= 1 ? s.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(i, s.backend, s);
|
|
892
892
|
}
|
|
893
893
|
queueLoad(e, t, i, s) {
|
|
894
|
-
const n = {}, r = {},
|
|
894
|
+
const n = {}, r = {}, o = {}, l = {};
|
|
895
895
|
return e.forEach((u) => {
|
|
896
896
|
let c = !0;
|
|
897
897
|
t.forEach((f) => {
|
|
898
898
|
const g = `${u}|${f}`;
|
|
899
899
|
!i.reload && this.store.hasResourceBundle(u, f) ? this.state[g] = 2 : this.state[g] < 0 || (this.state[g] === 1 ? r[g] === void 0 && (r[g] = !0) : (this.state[g] = 1, c = !1, r[g] === void 0 && (r[g] = !0), n[g] === void 0 && (n[g] = !0), l[f] === void 0 && (l[f] = !0)));
|
|
900
|
-
}), c || (
|
|
900
|
+
}), c || (o[u] = !0);
|
|
901
901
|
}), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
|
|
902
902
|
pending: r,
|
|
903
903
|
pendingCount: Object.keys(r).length,
|
|
@@ -907,7 +907,7 @@ class Je extends W {
|
|
|
907
907
|
}), {
|
|
908
908
|
toLoad: Object.keys(n),
|
|
909
909
|
pending: Object.keys(r),
|
|
910
|
-
toLoadLanguages: Object.keys(
|
|
910
|
+
toLoadLanguages: Object.keys(o),
|
|
911
911
|
toLoadNamespaces: Object.keys(l)
|
|
912
912
|
};
|
|
913
913
|
}
|
|
@@ -916,16 +916,16 @@ class Je extends W {
|
|
|
916
916
|
t && this.emit("failedLoading", n, r, t), !t && i && this.store.addResourceBundle(n, r, i, void 0, void 0, {
|
|
917
917
|
skipCopy: !0
|
|
918
918
|
}), this.state[e] = t ? -1 : 2, t && i && (this.state[e] = 0);
|
|
919
|
-
const
|
|
919
|
+
const o = {};
|
|
920
920
|
this.queue.forEach((l) => {
|
|
921
|
-
|
|
922
|
-
|
|
921
|
+
Ee(l.loaded, [n], r), Je(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
|
|
922
|
+
o[u] || (o[u] = {});
|
|
923
923
|
const c = l.loaded[u];
|
|
924
924
|
c.length && c.forEach((f) => {
|
|
925
|
-
|
|
925
|
+
o[u][f] === void 0 && (o[u][f] = !0);
|
|
926
926
|
});
|
|
927
927
|
}), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
|
|
928
|
-
}), this.emit("loaded",
|
|
928
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((l) => !l.done);
|
|
929
929
|
}
|
|
930
930
|
read(e, t, i, s = 0, n = this.retryTimeout, r) {
|
|
931
931
|
if (!e.length) return r(null, {});
|
|
@@ -941,7 +941,7 @@ class Je extends W {
|
|
|
941
941
|
return;
|
|
942
942
|
}
|
|
943
943
|
this.readingCalls++;
|
|
944
|
-
const
|
|
944
|
+
const o = (u, c) => {
|
|
945
945
|
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
946
946
|
const f = this.waitingReads.shift();
|
|
947
947
|
this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
|
|
@@ -957,13 +957,13 @@ class Je extends W {
|
|
|
957
957
|
if (l.length === 2) {
|
|
958
958
|
try {
|
|
959
959
|
const u = l(e, t);
|
|
960
|
-
u && typeof u.then == "function" ? u.then((c) =>
|
|
960
|
+
u && typeof u.then == "function" ? u.then((c) => o(null, c)).catch(o) : o(null, u);
|
|
961
961
|
} catch (u) {
|
|
962
|
-
|
|
962
|
+
o(u);
|
|
963
963
|
}
|
|
964
964
|
return;
|
|
965
965
|
}
|
|
966
|
-
return l(e, t,
|
|
966
|
+
return l(e, t, o);
|
|
967
967
|
}
|
|
968
968
|
prepareLoading(e, t, i = {}, s) {
|
|
969
969
|
if (!this.backend)
|
|
@@ -986,11 +986,11 @@ class Je extends W {
|
|
|
986
986
|
}
|
|
987
987
|
loadOne(e, t = "") {
|
|
988
988
|
const i = e.split("|"), s = i[0], n = i[1];
|
|
989
|
-
this.read(s, n, "read", void 0, void 0, (r,
|
|
990
|
-
r && this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`, r), !r &&
|
|
989
|
+
this.read(s, n, "read", void 0, void 0, (r, o) => {
|
|
990
|
+
r && this.logger.warn(`${t}loading namespace ${n} for language ${s} failed`, r), !r && o && this.logger.log(`${t}loaded namespace ${n} for language ${s}`, o), this.loaded(e, r, o);
|
|
991
991
|
});
|
|
992
992
|
}
|
|
993
|
-
saveMissing(e, t, i, s, n, r = {},
|
|
993
|
+
saveMissing(e, t, i, s, n, r = {}, o = () => {
|
|
994
994
|
}) {
|
|
995
995
|
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
|
|
996
996
|
this.logger.warn(`did not save key "${i}" as the namespace "${t}" 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!!!");
|
|
@@ -1005,12 +1005,12 @@ class Je extends W {
|
|
|
1005
1005
|
if (u.length < 6)
|
|
1006
1006
|
try {
|
|
1007
1007
|
let c;
|
|
1008
|
-
u.length === 5 ? c = u(e, t, i, s, l) : c = u(e, t, i, s), c && typeof c.then == "function" ? c.then((f) =>
|
|
1008
|
+
u.length === 5 ? c = u(e, t, i, s, l) : c = u(e, t, i, s), c && typeof c.then == "function" ? c.then((f) => o(null, f)).catch(o) : o(null, c);
|
|
1009
1009
|
} catch (c) {
|
|
1010
|
-
|
|
1010
|
+
o(c);
|
|
1011
1011
|
}
|
|
1012
1012
|
else
|
|
1013
|
-
u(e, t, i, s,
|
|
1013
|
+
u(e, t, i, s, o, l);
|
|
1014
1014
|
}
|
|
1015
1015
|
!e || !e[0] || this.store.addResource(e[0], t, i, s);
|
|
1016
1016
|
}
|
|
@@ -1049,10 +1049,10 @@ const G = () => ({
|
|
|
1049
1049
|
parseMissingKeyHandler: !1,
|
|
1050
1050
|
appendNamespaceToMissingKey: !1,
|
|
1051
1051
|
appendNamespaceToCIMode: !1,
|
|
1052
|
-
overloadTranslationOptionHandler: (
|
|
1052
|
+
overloadTranslationOptionHandler: (a) => {
|
|
1053
1053
|
let e = {};
|
|
1054
|
-
if (typeof
|
|
1055
|
-
const t =
|
|
1054
|
+
if (typeof a[1] == "object" && (e = a[1]), d(a[1]) && (e.defaultValue = a[1]), d(a[2]) && (e.tDescription = a[2]), typeof a[2] == "object" || typeof a[3] == "object") {
|
|
1055
|
+
const t = a[3] || a[2];
|
|
1056
1056
|
Object.keys(t).forEach((i) => {
|
|
1057
1057
|
e[i] = t[i];
|
|
1058
1058
|
});
|
|
@@ -1061,7 +1061,7 @@ const G = () => ({
|
|
|
1061
1061
|
},
|
|
1062
1062
|
interpolation: {
|
|
1063
1063
|
escapeValue: !0,
|
|
1064
|
-
format: (
|
|
1064
|
+
format: (a) => a,
|
|
1065
1065
|
prefix: "{{",
|
|
1066
1066
|
suffix: "}}",
|
|
1067
1067
|
formatSeparator: ",",
|
|
@@ -1073,17 +1073,19 @@ const G = () => ({
|
|
|
1073
1073
|
skipOnVariables: !0
|
|
1074
1074
|
},
|
|
1075
1075
|
cacheInBuiltFormats: !0
|
|
1076
|
-
}), ge = (
|
|
1077
|
-
},
|
|
1078
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(
|
|
1079
|
-
typeof
|
|
1076
|
+
}), ge = (a) => (d(a.ns) && (a.ns = [a.ns]), d(a.fallbackLng) && (a.fallbackLng = [a.fallbackLng]), d(a.fallbackNS) && (a.fallbackNS = [a.fallbackNS]), a.supportedLngs?.indexOf?.("cimode") < 0 && (a.supportedLngs = a.supportedLngs.concat(["cimode"])), typeof a.initImmediate == "boolean" && (a.initAsync = a.initImmediate), a), H = () => {
|
|
1077
|
+
}, Ye = (a) => {
|
|
1078
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach((t) => {
|
|
1079
|
+
typeof a[t] == "function" && (a[t] = a[t].bind(a));
|
|
1080
1080
|
});
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1081
|
+
}, be = "__i18next_supportNoticeShown", We = () => typeof globalThis < "u" && !!globalThis[be], Qe = () => {
|
|
1082
|
+
typeof globalThis < "u" && (globalThis[be] = !0);
|
|
1083
|
+
}, Ge = (a) => !!(a?.modules?.backend?.name?.indexOf("Locize") > 0 || a?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || a?.options?.backend?.backends && a.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0) || a?.options?.backend?.projectId || a?.options?.backend?.backendOptions && a.options.backend.backendOptions.some((e) => e?.projectId));
|
|
1084
|
+
class U extends Y {
|
|
1083
1085
|
constructor(e = {}, t) {
|
|
1084
1086
|
if (super(), this.options = ge(e), this.services = {}, this.logger = P, this.modules = {
|
|
1085
1087
|
external: []
|
|
1086
|
-
},
|
|
1088
|
+
}, Ye(this), t && !this.isInitialized && !e.isClone) {
|
|
1087
1089
|
if (!this.options.initAsync)
|
|
1088
1090
|
return this.init(e, t), this;
|
|
1089
1091
|
setTimeout(() => {
|
|
@@ -1101,21 +1103,21 @@ class U extends W {
|
|
|
1101
1103
|
}, this.options.interpolation = {
|
|
1102
1104
|
...i.interpolation,
|
|
1103
1105
|
...this.options.interpolation
|
|
1104
|
-
}, 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 = i.overloadTranslationOptionHandler);
|
|
1106
|
+
}, 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 = i.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !Ge(this) && !We() && (typeof console < "u" && typeof console.info < "u" && console.info("🌐 i18next is maintained with support from Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), Qe());
|
|
1105
1107
|
const s = (u) => u ? typeof u == "function" ? new u() : u : null;
|
|
1106
1108
|
if (!this.options.isClone) {
|
|
1107
1109
|
this.modules.logger ? P.init(s(this.modules.logger), this.options) : P.init(null, this.options);
|
|
1108
1110
|
let u;
|
|
1109
|
-
this.modules.formatter ? u = this.modules.formatter : u =
|
|
1111
|
+
this.modules.formatter ? u = this.modules.formatter : u = Be;
|
|
1110
1112
|
const c = new ue(this.options);
|
|
1111
1113
|
this.store = new oe(this.options.resources, this.options);
|
|
1112
1114
|
const f = this.services;
|
|
1113
|
-
f.logger = P, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new
|
|
1115
|
+
f.logger = P, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new Me(c, {
|
|
1114
1116
|
prepend: this.options.pluralSeparator,
|
|
1115
1117
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1116
1118
|
}), this.options.interpolation.format && this.options.interpolation.format !== i.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"), u && (!this.options.interpolation.format || this.options.interpolation.format === i.interpolation.format) && (f.formatter = s(u), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new de(this.options), f.utils = {
|
|
1117
1119
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1118
|
-
}, f.backendConnector = new
|
|
1120
|
+
}, f.backendConnector = new _e(s(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (p, ...h) => {
|
|
1119
1121
|
this.emit(p, ...h);
|
|
1120
1122
|
}), this.modules.languageDetector && (f.languageDetector = s(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = s(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new _(this.services, this.options), this.translator.on("*", (p, ...h) => {
|
|
1121
1123
|
this.emit(p, ...h);
|
|
@@ -1123,7 +1125,7 @@ class U extends W {
|
|
|
1123
1125
|
p.init && p.init(this);
|
|
1124
1126
|
});
|
|
1125
1127
|
}
|
|
1126
|
-
if (this.format = this.options.interpolation.format, t || (t =
|
|
1128
|
+
if (this.format = this.options.interpolation.format, t || (t = H), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1127
1129
|
const u = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1128
1130
|
u.length > 0 && u[0] !== "dev" && (this.options.lng = u[0]);
|
|
1129
1131
|
}
|
|
@@ -1132,35 +1134,35 @@ class U extends W {
|
|
|
1132
1134
|
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((u) => {
|
|
1133
1135
|
this[u] = (...c) => (this.store[u](...c), this);
|
|
1134
1136
|
});
|
|
1135
|
-
const
|
|
1137
|
+
const o = A(), l = () => {
|
|
1136
1138
|
const u = (c, f) => {
|
|
1137
|
-
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),
|
|
1139
|
+
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), o.resolve(f), t(c, f);
|
|
1138
1140
|
};
|
|
1139
1141
|
if (this.languages && !this.isInitialized) return u(null, this.t.bind(this));
|
|
1140
1142
|
this.changeLanguage(this.options.lng, u);
|
|
1141
1143
|
};
|
|
1142
|
-
return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0),
|
|
1144
|
+
return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), o;
|
|
1143
1145
|
}
|
|
1144
|
-
loadResources(e, t =
|
|
1146
|
+
loadResources(e, t = H) {
|
|
1145
1147
|
let i = t;
|
|
1146
1148
|
const s = d(e) ? e : this.language;
|
|
1147
1149
|
if (typeof e == "function" && (i = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1148
1150
|
if (s?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return i();
|
|
1149
|
-
const n = [], r = (
|
|
1150
|
-
if (!
|
|
1151
|
-
this.services.languageUtils.toResolveHierarchy(
|
|
1151
|
+
const n = [], r = (o) => {
|
|
1152
|
+
if (!o || o === "cimode") return;
|
|
1153
|
+
this.services.languageUtils.toResolveHierarchy(o).forEach((u) => {
|
|
1152
1154
|
u !== "cimode" && n.indexOf(u) < 0 && n.push(u);
|
|
1153
1155
|
});
|
|
1154
1156
|
};
|
|
1155
|
-
s ? r(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => r(l)), this.options.preload?.forEach?.((
|
|
1156
|
-
!
|
|
1157
|
+
s ? r(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => r(l)), this.options.preload?.forEach?.((o) => r(o)), this.services.backendConnector.load(n, this.options.ns, (o) => {
|
|
1158
|
+
!o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), i(o);
|
|
1157
1159
|
});
|
|
1158
1160
|
} else
|
|
1159
1161
|
i(null);
|
|
1160
1162
|
}
|
|
1161
1163
|
reloadResources(e, t, i) {
|
|
1162
|
-
const s =
|
|
1163
|
-
return typeof e == "function" && (i = e, e = void 0), typeof t == "function" && (i = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), i || (i =
|
|
1164
|
+
const s = A();
|
|
1165
|
+
return typeof e == "function" && (i = e, e = void 0), typeof t == "function" && (i = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), i || (i = H), this.services.backendConnector.reload(e, t, (n) => {
|
|
1164
1166
|
s.resolve(), i(n);
|
|
1165
1167
|
}), s;
|
|
1166
1168
|
}
|
|
@@ -1183,15 +1185,15 @@ class U extends W {
|
|
|
1183
1185
|
}
|
|
1184
1186
|
changeLanguage(e, t) {
|
|
1185
1187
|
this.isLanguageChangingTo = e;
|
|
1186
|
-
const i =
|
|
1188
|
+
const i = A();
|
|
1187
1189
|
this.emit("languageChanging", e);
|
|
1188
|
-
const s = (
|
|
1189
|
-
this.language =
|
|
1190
|
-
}, n = (
|
|
1191
|
-
l ? this.isLanguageChangingTo === e && (s(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, i.resolve((...u) => this.t(...u)), t && t(
|
|
1192
|
-
}, r = (
|
|
1193
|
-
!e && !
|
|
1194
|
-
const l = d(
|
|
1190
|
+
const s = (o) => {
|
|
1191
|
+
this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
|
|
1192
|
+
}, n = (o, l) => {
|
|
1193
|
+
l ? this.isLanguageChangingTo === e && (s(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, i.resolve((...u) => this.t(...u)), t && t(o, (...u) => this.t(...u));
|
|
1194
|
+
}, r = (o) => {
|
|
1195
|
+
!e && !o && this.services.languageDetector && (o = []);
|
|
1196
|
+
const l = d(o) ? o : o && o[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(d(o) ? [o] : o);
|
|
1195
1197
|
u && (this.language || s(u), this.translator.language || this.translator.changeLanguage(u), this.services.languageDetector?.cacheUserLanguage?.(u)), this.loadResources(u, (c) => {
|
|
1196
1198
|
n(c, u);
|
|
1197
1199
|
});
|
|
@@ -1199,9 +1201,9 @@ class U extends W {
|
|
|
1199
1201
|
return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e), i;
|
|
1200
1202
|
}
|
|
1201
1203
|
getFixedT(e, t, i) {
|
|
1202
|
-
const s = (n, r, ...
|
|
1204
|
+
const s = (n, r, ...o) => {
|
|
1203
1205
|
let l;
|
|
1204
|
-
typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(
|
|
1206
|
+
typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(o)) : l = {
|
|
1205
1207
|
...r
|
|
1206
1208
|
}, l.lng = l.lng || s.lng, l.lngs = l.lngs || s.lngs, l.ns = l.ns || s.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || i || s.keyPrefix);
|
|
1207
1209
|
const u = this.options.keySeparator || ".";
|
|
@@ -1232,18 +1234,18 @@ class U extends W {
|
|
|
1232
1234
|
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1233
1235
|
const i = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
|
|
1234
1236
|
if (i.toLowerCase() === "cimode") return !0;
|
|
1235
|
-
const r = (
|
|
1236
|
-
const u = this.services.backendConnector.state[`${
|
|
1237
|
+
const r = (o, l) => {
|
|
1238
|
+
const u = this.services.backendConnector.state[`${o}|${l}`];
|
|
1237
1239
|
return u === -1 || u === 0 || u === 2;
|
|
1238
1240
|
};
|
|
1239
1241
|
if (t.precheck) {
|
|
1240
|
-
const
|
|
1241
|
-
if (
|
|
1242
|
+
const o = t.precheck(this, r);
|
|
1243
|
+
if (o !== void 0) return o;
|
|
1242
1244
|
}
|
|
1243
1245
|
return !!(this.hasResourceBundle(i, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(i, e) && (!s || r(n, e)));
|
|
1244
1246
|
}
|
|
1245
1247
|
loadNamespaces(e, t) {
|
|
1246
|
-
const i =
|
|
1248
|
+
const i = A();
|
|
1247
1249
|
return this.options.ns ? (d(e) && (e = [e]), e.forEach((s) => {
|
|
1248
1250
|
this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
|
|
1249
1251
|
}), this.loadResources((s) => {
|
|
@@ -1251,7 +1253,7 @@ class U extends W {
|
|
|
1251
1253
|
}), i) : (t && t(), Promise.resolve());
|
|
1252
1254
|
}
|
|
1253
1255
|
loadLanguages(e, t) {
|
|
1254
|
-
const i =
|
|
1256
|
+
const i = A();
|
|
1255
1257
|
d(e) && (e = [e]);
|
|
1256
1258
|
const s = this.options.preload || [], n = e.filter((r) => s.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
|
|
1257
1259
|
return n.length ? (this.options.preload = s.concat(n), this.loadResources((r) => {
|
|
@@ -1275,7 +1277,7 @@ class U extends W {
|
|
|
1275
1277
|
const i = new U(e, t);
|
|
1276
1278
|
return i.createInstance = U.createInstance, i;
|
|
1277
1279
|
}
|
|
1278
|
-
cloneInstance(e = {}, t =
|
|
1280
|
+
cloneInstance(e = {}, t = H) {
|
|
1279
1281
|
const i = e.forkResourceStore;
|
|
1280
1282
|
i && delete e.forkResourceStore;
|
|
1281
1283
|
const s = {
|
|
@@ -1283,19 +1285,19 @@ class U extends W {
|
|
|
1283
1285
|
...e,
|
|
1284
1286
|
isClone: !0
|
|
1285
1287
|
}, n = new U(s);
|
|
1286
|
-
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((
|
|
1287
|
-
n[
|
|
1288
|
+
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
|
|
1289
|
+
n[o] = this[o];
|
|
1288
1290
|
}), n.services = {
|
|
1289
1291
|
...this.services
|
|
1290
1292
|
}, n.services.utils = {
|
|
1291
1293
|
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1292
1294
|
}, i) {
|
|
1293
|
-
const
|
|
1295
|
+
const o = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
|
|
1294
1296
|
...this.store.data[u]
|
|
1295
1297
|
}, l[u] = Object.keys(l[u]).reduce((c, f) => (c[f] = {
|
|
1296
1298
|
...l[u][f]
|
|
1297
1299
|
}, c), l[u]), l), {});
|
|
1298
|
-
n.store = new oe(
|
|
1300
|
+
n.store = new oe(o, s), n.services.resourceStore = n.store;
|
|
1299
1301
|
}
|
|
1300
1302
|
if (e.interpolation) {
|
|
1301
1303
|
const l = {
|
|
@@ -1308,8 +1310,8 @@ class U extends W {
|
|
|
1308
1310
|
};
|
|
1309
1311
|
n.services.interpolator = new de(u);
|
|
1310
1312
|
}
|
|
1311
|
-
return n.translator = new _(n.services, s), n.translator.on("*", (
|
|
1312
|
-
n.emit(
|
|
1313
|
+
return n.translator = new _(n.services, s), n.translator.on("*", (o, ...l) => {
|
|
1314
|
+
n.emit(o, ...l);
|
|
1313
1315
|
}), n.init(s, t), n.translator.options = s, n.translator.backendConnector.services.utils = {
|
|
1314
1316
|
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1315
1317
|
}, n;
|
|
@@ -1339,16 +1341,16 @@ m.setDefaultNamespace;
|
|
|
1339
1341
|
m.hasLoadedNamespace;
|
|
1340
1342
|
m.loadNamespaces;
|
|
1341
1343
|
m.loadLanguages;
|
|
1342
|
-
const
|
|
1343
|
-
function
|
|
1344
|
+
const Oe = /* @__PURE__ */ Symbol();
|
|
1345
|
+
function nt(a, { i18next: e, rerenderOn: t = [
|
|
1344
1346
|
"languageChanged",
|
|
1345
1347
|
"loaded",
|
|
1346
1348
|
"added",
|
|
1347
1349
|
"removed"
|
|
1348
1350
|
], slotStart: i = "{", slotEnd: s = "}" }) {
|
|
1349
|
-
const n =
|
|
1351
|
+
const n = Pe(/* @__PURE__ */ new Date()), r = () => Re(() => {
|
|
1350
1352
|
n.value = /* @__PURE__ */ new Date();
|
|
1351
|
-
}),
|
|
1353
|
+
}), o = () => n.value;
|
|
1352
1354
|
t.forEach((c) => {
|
|
1353
1355
|
switch (c) {
|
|
1354
1356
|
case "added":
|
|
@@ -1359,87 +1361,87 @@ function et(o, { i18next: e, rerenderOn: t = [
|
|
|
1359
1361
|
e.on(c, r);
|
|
1360
1362
|
break;
|
|
1361
1363
|
}
|
|
1362
|
-
}),
|
|
1364
|
+
}), a.component("i18next", qe);
|
|
1363
1365
|
const l = () => e.isInitialized;
|
|
1364
|
-
|
|
1366
|
+
a.config.globalProperties.$t = me(e.t.bind(e), o, l);
|
|
1365
1367
|
const u = new Proxy(e, { get(c, f) {
|
|
1366
|
-
return
|
|
1368
|
+
return o(), Reflect.get(c, f);
|
|
1367
1369
|
} });
|
|
1368
|
-
|
|
1370
|
+
a.config.globalProperties.$i18next = u, a.provide(Oe, {
|
|
1369
1371
|
i18next: u,
|
|
1370
|
-
slotPattern:
|
|
1372
|
+
slotPattern: Xe(i, s),
|
|
1371
1373
|
withAccessRecording(c, f) {
|
|
1372
|
-
return me(c,
|
|
1374
|
+
return me(c, o, f);
|
|
1373
1375
|
}
|
|
1374
1376
|
});
|
|
1375
1377
|
}
|
|
1376
|
-
function
|
|
1377
|
-
const { i18next: t, withAccessRecording: i } =
|
|
1378
|
+
function rt(a, e) {
|
|
1379
|
+
const { i18next: t, withAccessRecording: i } = Le();
|
|
1378
1380
|
let s;
|
|
1379
1381
|
return s = t.getFixedT(null, null, e?.keyPrefix), {
|
|
1380
1382
|
i18next: t,
|
|
1381
|
-
t: i(s,
|
|
1383
|
+
t: i(s, Ze(t, a))
|
|
1382
1384
|
};
|
|
1383
1385
|
}
|
|
1384
|
-
function
|
|
1386
|
+
function Ze(a, e = []) {
|
|
1385
1387
|
let t;
|
|
1386
1388
|
return () => {
|
|
1387
|
-
if (t === void 0) if (
|
|
1388
|
-
const i = (typeof e == "string" ? [e] : e).filter((s) => !
|
|
1389
|
-
i.length ? (t = !1,
|
|
1389
|
+
if (t === void 0) if (a.isInitialized) {
|
|
1390
|
+
const i = (typeof e == "string" ? [e] : e).filter((s) => !a.hasLoadedNamespace(s));
|
|
1391
|
+
i.length ? (t = !1, a.loadNamespaces(i).then(() => t = !0)) : t = !0;
|
|
1390
1392
|
} else
|
|
1391
1393
|
return !1;
|
|
1392
1394
|
return t;
|
|
1393
1395
|
};
|
|
1394
1396
|
}
|
|
1395
|
-
function me(
|
|
1396
|
-
return new Proxy(
|
|
1397
|
+
function me(a, e, t) {
|
|
1398
|
+
return new Proxy(a, { apply: function(i, s, n) {
|
|
1397
1399
|
return e(), t() ? Reflect.apply(i, s, n) : "";
|
|
1398
1400
|
} });
|
|
1399
1401
|
}
|
|
1400
|
-
function
|
|
1401
|
-
const
|
|
1402
|
-
if (!
|
|
1403
|
-
return
|
|
1402
|
+
function Le() {
|
|
1403
|
+
const a = $e(Oe);
|
|
1404
|
+
if (!a) throw new Error("i18next-vue: Make sure to register the i18next-vue plugin using app.use(...).");
|
|
1405
|
+
return a;
|
|
1404
1406
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const t = `${
|
|
1407
|
+
function Xe(a, e) {
|
|
1408
|
+
const t = `${a}\\s*([a-z0-9\\-]+)\\s*${e}`;
|
|
1407
1409
|
return new RegExp(t, "gi");
|
|
1408
1410
|
}
|
|
1409
|
-
const
|
|
1411
|
+
const qe = Ce({
|
|
1410
1412
|
props: { translation: {
|
|
1411
1413
|
type: String,
|
|
1412
1414
|
required: !0
|
|
1413
1415
|
} },
|
|
1414
|
-
setup(
|
|
1415
|
-
const { slotPattern: t } =
|
|
1416
|
+
setup(a, { slots: e }) {
|
|
1417
|
+
const { slotPattern: t } = Le();
|
|
1416
1418
|
return () => {
|
|
1417
|
-
const i =
|
|
1419
|
+
const i = a.translation, s = [];
|
|
1418
1420
|
let n, r = 0;
|
|
1419
1421
|
for (; (n = t.exec(i)) !== null; ) {
|
|
1420
1422
|
s.push(i.substring(r, n.index));
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1423
|
+
const o = e[n[1]];
|
|
1424
|
+
o ? s.push(...o()) : s.push(n[0]), r = t.lastIndex;
|
|
1423
1425
|
}
|
|
1424
1426
|
return s.push(i.substring(r)), s;
|
|
1425
1427
|
};
|
|
1426
1428
|
}
|
|
1427
|
-
}),
|
|
1428
|
-
async function
|
|
1429
|
-
for (const [e, t] of Object.entries(
|
|
1429
|
+
}), et = "translation";
|
|
1430
|
+
async function at(a) {
|
|
1431
|
+
for (const [e, t] of Object.entries(a)) {
|
|
1430
1432
|
const i = e.match(/\/([^/]+)\.json$/)[1];
|
|
1431
|
-
await
|
|
1433
|
+
await tt(i, t);
|
|
1432
1434
|
}
|
|
1433
1435
|
}
|
|
1434
|
-
async function
|
|
1435
|
-
await
|
|
1436
|
+
async function tt(a, e) {
|
|
1437
|
+
await st(), m.addResourceBundle(a, et, e, !0, !0);
|
|
1436
1438
|
}
|
|
1437
|
-
async function
|
|
1439
|
+
async function st() {
|
|
1438
1440
|
m.isInitialized || await m.init();
|
|
1439
1441
|
}
|
|
1440
1442
|
export {
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
+
at as a,
|
|
1444
|
+
nt as b,
|
|
1443
1445
|
m as i,
|
|
1444
|
-
|
|
1446
|
+
rt as u
|
|
1445
1447
|
};
|