@1024pix/epreuves-components 4.0.1 → 4.1.0
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-DZ8jDtW5.js} +2 -2
- package/dist/{ButtonTooltip.ce-CtHo2Dwx.js → ButtonTooltip.ce-BnJlaEqx.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-l4hAa4eW.js} +16 -14
- package/dist/FocusManager.ce-DHXwg6WZ.js +131 -0
- package/dist/{LLMMessage.ce-Bdmf0R1g.js → LLMMessage.ce-jLEqjxsl.js} +11 -11
- package/dist/{Loading.ce-Bh7-h48F.js → Loading.ce-DDtlSLlu.js} +2 -2
- package/dist/{NavigationButton.ce-CA1M8sgV.js → NavigationButton.ce-BnnVUwGr.js} +2 -2
- package/dist/PixMailMessage.ce-oCccQFGV.js +261 -0
- package/dist/Popin.ce-Co12R3C8.js +75 -0
- package/dist/{Retry-BZf7NJz9.js → Retry-C7C78Wpj.js} +2 -2
- package/dist/{Stepper.ce-B1yDelzC.js → Stepper.ce-Dttf3Dsf.js} +4 -4
- package/dist/{_plugin-vue_export-helper-D0N_62VD.js → _plugin-vue_export-helper-B-lVMTio.js} +1777 -1713
- 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 +93 -92
- 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 +66 -64
- 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 +86 -79
- package/dist/components/trouver-mdp-rs.ce.js.js +334 -418
- package/dist/{i18n-ekiZvzf6.js → i18n-CsT7k7zW.js} +329 -316
- package/dist/{i18n-lite-t2jNOu0C.js → i18n-lite-BIJ2LVs6.js} +19 -12
- package/dist/{image-quiz.ce-DqalWHKw.js → image-quiz.ce-BK6-8YF1.js} +9 -9
- package/dist/{index-BpqxFmwz.js → index-BaI3Qosp.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/props.examples.js +13 -13
- package/dist/schema.js +77 -67
- package/dist/shadow-dom-Bouq869n.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-B-lVMTio.js";
|
|
2
|
+
const d = (a) => typeof a == "string", K = () => {
|
|
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
|
-
},
|
|
43
|
+
}, J = (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 =
|
|
52
|
-
return i !== void 0 ? i :
|
|
53
|
-
}, xe = (
|
|
50
|
+
}, je = (a, e, t) => {
|
|
51
|
+
const i = J(a, t);
|
|
52
|
+
return i !== void 0 ? i : J(e, t);
|
|
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 Ae = [" ", ",", "?", "!", ";"], De = new Te(20), Ke = (a, e, t) => {
|
|
80
80
|
e = e || "", t = t || "";
|
|
81
|
-
const i =
|
|
81
|
+
const i = Ae.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
|
|
82
82
|
if (i.length === 0) return !0;
|
|
83
83
|
const s = De.getRegExp(`(${i.map((r) => r === "?" ? "\\?" : r).join("|")})`);
|
|
84
|
-
let n = !s.test(
|
|
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
|
-
},
|
|
91
|
-
if (!
|
|
92
|
-
if (
|
|
93
|
-
return Object.prototype.hasOwnProperty.call(
|
|
90
|
+
}, X = (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,22 +107,22 @@ const Te = [" ", ",", "?", "!", ";"], De = new Ie(20), Ke = (o, e, t) => {
|
|
|
107
107
|
s = r;
|
|
108
108
|
}
|
|
109
109
|
return s;
|
|
110
|
-
},
|
|
110
|
+
}, z = (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
|
-
class
|
|
125
|
+
class _ {
|
|
126
126
|
constructor(e, t = {}) {
|
|
127
127
|
this.init(e, t);
|
|
128
128
|
}
|
|
@@ -145,16 +145,16 @@ class J {
|
|
|
145
145
|
return s && !this.debug ? null : (d(e[0]) && (e[0] = `${i}${this.prefix} ${e[0]}`), this.logger[t](e));
|
|
146
146
|
}
|
|
147
147
|
create(e) {
|
|
148
|
-
return new
|
|
148
|
+
return new _(this.logger, {
|
|
149
149
|
prefix: `${this.prefix}:${e}:`,
|
|
150
150
|
...this.options
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
clone(e) {
|
|
154
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new
|
|
154
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new _(this.logger, e);
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
var P = new
|
|
157
|
+
var P = new _();
|
|
158
158
|
class W {
|
|
159
159
|
constructor() {
|
|
160
160
|
this.observers = {};
|
|
@@ -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 =
|
|
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 = J(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 : X(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 =
|
|
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 = J(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,36 @@ 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
|
|
274
|
+
function U(a, e) {
|
|
275
275
|
const {
|
|
276
276
|
[Se]: t
|
|
277
|
-
} =
|
|
278
|
-
|
|
277
|
+
} = a(Ue()), i = e?.keySeparator ?? ".", s = e?.nsSeparator ?? ":";
|
|
278
|
+
if (t.length > 1 && s) {
|
|
279
|
+
const n = e?.ns;
|
|
280
|
+
if ((n ? Array.isArray(n) ? n : [n] : []).includes(t[0]))
|
|
281
|
+
return `${t[0]}${s}${t.slice(1).join(i)}`;
|
|
282
|
+
}
|
|
283
|
+
return t.join(i);
|
|
279
284
|
}
|
|
280
|
-
const le = {},
|
|
281
|
-
class
|
|
285
|
+
const le = {}, Q = (a) => !d(a) && typeof a != "boolean" && typeof a != "number";
|
|
286
|
+
class Y extends W {
|
|
282
287
|
constructor(e, t = {}) {
|
|
283
|
-
super(),
|
|
288
|
+
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
289
|
}
|
|
285
290
|
changeLanguage(e) {
|
|
286
291
|
e && (this.language = e);
|
|
@@ -294,7 +299,7 @@ class _ extends W {
|
|
|
294
299
|
if (e == null) return !1;
|
|
295
300
|
const s = this.resolve(e, i);
|
|
296
301
|
if (s?.res === void 0) return !1;
|
|
297
|
-
const n =
|
|
302
|
+
const n = Q(s.res);
|
|
298
303
|
return !(i.returnObjects === !1 && n);
|
|
299
304
|
}
|
|
300
305
|
extractFromKey(e, t) {
|
|
@@ -302,8 +307,8 @@ class _ extends W {
|
|
|
302
307
|
i === void 0 && (i = ":");
|
|
303
308
|
const s = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
|
|
304
309
|
let n = t.ns || this.options.defaultNS || [];
|
|
305
|
-
const r = i && e.indexOf(i) > -1,
|
|
306
|
-
if (r && !
|
|
310
|
+
const r = i && e.indexOf(i) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Ke(e, i, s);
|
|
311
|
+
if (r && !o) {
|
|
307
312
|
const l = e.match(this.interpolator.nestingRegexp);
|
|
308
313
|
if (l && l.length > 0)
|
|
309
314
|
return {
|
|
@@ -325,12 +330,15 @@ class _ extends W {
|
|
|
325
330
|
if (typeof s != "object" && this.options.overloadTranslationOptionHandler && (s = this.options.overloadTranslationOptionHandler(arguments)), typeof s == "object" && (s = {
|
|
326
331
|
...s
|
|
327
332
|
}), s || (s = {}), e == null) return "";
|
|
328
|
-
typeof e == "function" && (e =
|
|
333
|
+
typeof e == "function" && (e = U(e, {
|
|
334
|
+
...this.options,
|
|
335
|
+
...s
|
|
336
|
+
})), Array.isArray(e) || (e = [String(e)]), e = e.map((b) => typeof b == "function" ? U(b, {
|
|
329
337
|
...this.options,
|
|
330
338
|
...s
|
|
331
|
-
})
|
|
339
|
+
}) : String(b));
|
|
332
340
|
const n = s.returnDetails !== void 0 ? s.returnDetails : this.options.returnDetails, r = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator, {
|
|
333
|
-
key:
|
|
341
|
+
key: o,
|
|
334
342
|
namespaces: l
|
|
335
343
|
} = this.extractFromKey(e[e.length - 1], s), u = l[l.length - 1];
|
|
336
344
|
let c = s.nsSeparator !== void 0 ? s.nsSeparator : this.options.nsSeparator;
|
|
@@ -338,87 +346,87 @@ class _ extends W {
|
|
|
338
346
|
const f = s.lng || this.language, g = s.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
339
347
|
if (f?.toLowerCase() === "cimode")
|
|
340
348
|
return g ? n ? {
|
|
341
|
-
res: `${u}${c}${
|
|
342
|
-
usedKey:
|
|
343
|
-
exactUsedKey:
|
|
349
|
+
res: `${u}${c}${o}`,
|
|
350
|
+
usedKey: o,
|
|
351
|
+
exactUsedKey: o,
|
|
344
352
|
usedLng: f,
|
|
345
353
|
usedNS: u,
|
|
346
354
|
usedParams: this.getUsedParamsDetails(s)
|
|
347
|
-
} : `${u}${c}${
|
|
348
|
-
res:
|
|
349
|
-
usedKey:
|
|
350
|
-
exactUsedKey:
|
|
355
|
+
} : `${u}${c}${o}` : n ? {
|
|
356
|
+
res: o,
|
|
357
|
+
usedKey: o,
|
|
358
|
+
exactUsedKey: o,
|
|
351
359
|
usedLng: f,
|
|
352
360
|
usedNS: u,
|
|
353
361
|
usedParams: this.getUsedParamsDetails(s)
|
|
354
|
-
} :
|
|
362
|
+
} : o;
|
|
355
363
|
const p = this.resolve(e, s);
|
|
356
364
|
let h = p?.res;
|
|
357
|
-
const x = p?.usedKey ||
|
|
365
|
+
const x = p?.usedKey || o, S = p?.exactUsedKey || o, w = ["[object Number]", "[object Function]", "[object RegExp]"], y = s.joinArrays !== void 0 ? s.joinArrays : this.options.joinArrays, E = !this.i18nFormat || this.i18nFormat.handleAsObject, L = s.count !== void 0 && !d(s.count), N = Y.hasDefaultValue(s), I = L ? this.pluralResolver.getSuffix(f, s.count, s) : "", T = s.ordinal && L ? this.pluralResolver.getSuffix(f, s.count, {
|
|
358
366
|
ordinal: !1
|
|
359
|
-
}) : "", q =
|
|
360
|
-
let
|
|
361
|
-
E && !h && N && (
|
|
362
|
-
const
|
|
363
|
-
if (E &&
|
|
367
|
+
}) : "", q = L && !s.ordinal && s.count === 0, k = q && s[`defaultValue${this.options.pluralSeparator}zero`] || s[`defaultValue${I}`] || s[`defaultValue${T}`] || s.defaultValue;
|
|
368
|
+
let R = h;
|
|
369
|
+
E && !h && N && (R = k);
|
|
370
|
+
const we = Q(R), ve = Object.prototype.toString.apply(R);
|
|
371
|
+
if (E && R && we && w.indexOf(ve) < 0 && !(d(y) && Array.isArray(R))) {
|
|
364
372
|
if (!s.returnObjects && !this.options.returnObjects) {
|
|
365
373
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
366
|
-
const
|
|
374
|
+
const b = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(x, R, {
|
|
367
375
|
...s,
|
|
368
376
|
ns: l
|
|
369
|
-
}) : `key '${
|
|
370
|
-
return n ? (p.res =
|
|
377
|
+
}) : `key '${o} (${this.language})' returned an object instead of string.`;
|
|
378
|
+
return n ? (p.res = b, p.usedParams = this.getUsedParamsDetails(s), p) : b;
|
|
371
379
|
}
|
|
372
380
|
if (r) {
|
|
373
|
-
const
|
|
374
|
-
for (const C in
|
|
375
|
-
if (Object.prototype.hasOwnProperty.call(
|
|
381
|
+
const b = Array.isArray(R), v = b ? [] : {}, ee = b ? S : x;
|
|
382
|
+
for (const C in R)
|
|
383
|
+
if (Object.prototype.hasOwnProperty.call(R, C)) {
|
|
376
384
|
const $ = `${ee}${r}${C}`;
|
|
377
|
-
N && !h ?
|
|
385
|
+
N && !h ? v[C] = this.translate($, {
|
|
378
386
|
...s,
|
|
379
|
-
defaultValue:
|
|
387
|
+
defaultValue: Q(k) ? k[C] : void 0,
|
|
380
388
|
joinArrays: !1,
|
|
381
389
|
ns: l
|
|
382
|
-
}) :
|
|
390
|
+
}) : v[C] = this.translate($, {
|
|
383
391
|
...s,
|
|
384
392
|
joinArrays: !1,
|
|
385
393
|
ns: l
|
|
386
|
-
}),
|
|
394
|
+
}), v[C] === $ && (v[C] = R[C]);
|
|
387
395
|
}
|
|
388
|
-
h =
|
|
396
|
+
h = v;
|
|
389
397
|
}
|
|
390
398
|
} else if (E && d(y) && Array.isArray(h))
|
|
391
399
|
h = h.join(y), h && (h = this.extendTranslation(h, e, s, i));
|
|
392
400
|
else {
|
|
393
|
-
let
|
|
394
|
-
!this.isValidLookup(h) && N && (
|
|
395
|
-
const C = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) &&
|
|
396
|
-
if (
|
|
397
|
-
if (this.logger.log($ ? "updateKey" : "missingKey", f, u,
|
|
398
|
-
const
|
|
401
|
+
let b = !1, v = !1;
|
|
402
|
+
!this.isValidLookup(h) && N && (b = !0, h = k), this.isValidLookup(h) || (v = !0, h = o);
|
|
403
|
+
const C = (s.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && v ? void 0 : h, $ = N && k !== h && this.options.updateMissing;
|
|
404
|
+
if (v || b || $) {
|
|
405
|
+
if (this.logger.log($ ? "updateKey" : "missingKey", f, u, o, $ ? k : h), r) {
|
|
406
|
+
const O = this.resolve(o, {
|
|
399
407
|
...s,
|
|
400
408
|
keySeparator: !1
|
|
401
409
|
});
|
|
402
|
-
|
|
410
|
+
O && O.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
411
|
}
|
|
404
|
-
let
|
|
412
|
+
let A = [];
|
|
405
413
|
const H = this.languageUtils.getFallbackCodes(this.options.fallbackLng, s.lng || this.language);
|
|
406
414
|
if (this.options.saveMissingTo === "fallback" && H && H[0])
|
|
407
|
-
for (let
|
|
408
|
-
|
|
409
|
-
else this.options.saveMissingTo === "all" ?
|
|
410
|
-
const te = (
|
|
411
|
-
const se = N &&
|
|
412
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(
|
|
415
|
+
for (let O = 0; O < H.length; O++)
|
|
416
|
+
A.push(H[O]);
|
|
417
|
+
else this.options.saveMissingTo === "all" ? A = this.languageUtils.toResolveHierarchy(s.lng || this.language) : A.push(s.lng || this.language);
|
|
418
|
+
const te = (O, j, D) => {
|
|
419
|
+
const se = N && D !== h ? D : C;
|
|
420
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(O, u, j, se, $, s) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(O, u, j, se, $, s), this.emit("missingKey", O, u, j, h);
|
|
413
421
|
};
|
|
414
|
-
this.options.saveMissing && (this.options.saveMissingPlurals &&
|
|
415
|
-
const
|
|
416
|
-
q && s[`defaultValue${this.options.pluralSeparator}zero`] &&
|
|
417
|
-
te([
|
|
422
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && L ? A.forEach((O) => {
|
|
423
|
+
const j = this.pluralResolver.getSuffixes(O, s);
|
|
424
|
+
q && s[`defaultValue${this.options.pluralSeparator}zero`] && j.indexOf(`${this.options.pluralSeparator}zero`) < 0 && j.push(`${this.options.pluralSeparator}zero`), j.forEach((D) => {
|
|
425
|
+
te([O], o + D, s[`defaultValue${D}`] || k);
|
|
418
426
|
});
|
|
419
|
-
}) : te(
|
|
427
|
+
}) : te(A, o, k));
|
|
420
428
|
}
|
|
421
|
-
h = this.extendTranslation(h, e, s, p, i),
|
|
429
|
+
h = this.extendTranslation(h, e, s, p, i), v && h === o && this.options.appendNamespaceToMissingKey && (h = `${u}${c}${o}`), (v || b) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${c}${o}` : o, b ? h : void 0, s));
|
|
422
430
|
}
|
|
423
431
|
return n ? (p.res = h, p.usedParams = this.getUsedParamsDetails(s), p) : h;
|
|
424
432
|
}
|
|
@@ -454,8 +462,8 @@ class _ extends W {
|
|
|
454
462
|
}
|
|
455
463
|
!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
464
|
}
|
|
457
|
-
const r = i.postProcess || this.options.postProcess,
|
|
458
|
-
return e != null &&
|
|
465
|
+
const r = i.postProcess || this.options.postProcess, o = d(r) ? [r] : r;
|
|
466
|
+
return e != null && o?.length && i.applyPostProcessor !== !1 && (e = ye.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
|
|
459
467
|
i18nResolved: {
|
|
460
468
|
...s,
|
|
461
469
|
usedParams: this.getUsedParamsDetails(i)
|
|
@@ -464,8 +472,11 @@ class _ extends W {
|
|
|
464
472
|
} : i, this)), e;
|
|
465
473
|
}
|
|
466
474
|
resolve(e, t = {}) {
|
|
467
|
-
let i, s, n, r,
|
|
468
|
-
return d(e) && (e = [e]), e.
|
|
475
|
+
let i, s, n, r, o;
|
|
476
|
+
return d(e) && (e = [e]), Array.isArray(e) && (e = e.map((l) => typeof l == "function" ? U(l, {
|
|
477
|
+
...this.options,
|
|
478
|
+
...t
|
|
479
|
+
}) : l)), e.forEach((l) => {
|
|
469
480
|
if (this.isValidLookup(i)) return;
|
|
470
481
|
const u = this.extractFromKey(l, t), c = u.key;
|
|
471
482
|
s = c;
|
|
@@ -473,24 +484,24 @@ class _ extends W {
|
|
|
473
484
|
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
474
485
|
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
486
|
f.forEach((S) => {
|
|
476
|
-
this.isValidLookup(i) || (
|
|
487
|
+
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((w) => {
|
|
477
488
|
if (this.isValidLookup(i)) return;
|
|
478
|
-
r =
|
|
489
|
+
r = w;
|
|
479
490
|
const y = [c];
|
|
480
491
|
if (this.i18nFormat?.addLookupKeys)
|
|
481
|
-
this.i18nFormat.addLookupKeys(y, c,
|
|
492
|
+
this.i18nFormat.addLookupKeys(y, c, w, S, t);
|
|
482
493
|
else {
|
|
483
|
-
let
|
|
484
|
-
g && (
|
|
485
|
-
const N = `${this.options.pluralSeparator}zero`,
|
|
486
|
-
if (g && (t.ordinal &&
|
|
487
|
-
const
|
|
488
|
-
y.push(
|
|
494
|
+
let L;
|
|
495
|
+
g && (L = this.pluralResolver.getSuffix(w, t.count, t));
|
|
496
|
+
const N = `${this.options.pluralSeparator}zero`, I = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
497
|
+
if (g && (t.ordinal && L.indexOf(I) === 0 && y.push(c + L.replace(I, this.options.pluralSeparator)), y.push(c + L), p && y.push(c + N)), h) {
|
|
498
|
+
const T = `${c}${this.options.contextSeparator || "_"}${t.context}`;
|
|
499
|
+
y.push(T), g && (t.ordinal && L.indexOf(I) === 0 && y.push(T + L.replace(I, this.options.pluralSeparator)), y.push(T + L), p && y.push(T + N));
|
|
489
500
|
}
|
|
490
501
|
}
|
|
491
502
|
let E;
|
|
492
503
|
for (; E = y.pop(); )
|
|
493
|
-
this.isValidLookup(i) || (n = E, i = this.getResource(
|
|
504
|
+
this.isValidLookup(i) || (n = E, i = this.getResource(w, S, E, t));
|
|
494
505
|
}));
|
|
495
506
|
});
|
|
496
507
|
}), {
|
|
@@ -498,7 +509,7 @@ class _ extends W {
|
|
|
498
509
|
usedKey: s,
|
|
499
510
|
exactUsedKey: n,
|
|
500
511
|
usedLng: r,
|
|
501
|
-
usedNS:
|
|
512
|
+
usedNS: o
|
|
502
513
|
};
|
|
503
514
|
}
|
|
504
515
|
isValidLookup(e) {
|
|
@@ -535,12 +546,12 @@ class ue {
|
|
|
535
546
|
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = P.create("languageUtils");
|
|
536
547
|
}
|
|
537
548
|
getScriptPartFromCode(e) {
|
|
538
|
-
if (e =
|
|
549
|
+
if (e = z(e), !e || e.indexOf("-") < 0) return null;
|
|
539
550
|
const t = e.split("-");
|
|
540
551
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
541
552
|
}
|
|
542
553
|
getLanguagePartFromCode(e) {
|
|
543
|
-
if (e =
|
|
554
|
+
if (e = z(e), !e || e.indexOf("-") < 0) return e;
|
|
544
555
|
const t = e.split("-");
|
|
545
556
|
return this.formatLanguageCode(t[0]);
|
|
546
557
|
}
|
|
@@ -602,12 +613,12 @@ const fe = {
|
|
|
602
613
|
many: 4,
|
|
603
614
|
other: 5
|
|
604
615
|
}, ce = {
|
|
605
|
-
select: (
|
|
616
|
+
select: (a) => a === 1 ? "one" : "other",
|
|
606
617
|
resolvedOptions: () => ({
|
|
607
618
|
pluralCategories: ["one", "other"]
|
|
608
619
|
})
|
|
609
620
|
};
|
|
610
|
-
class
|
|
621
|
+
class Me {
|
|
611
622
|
constructor(e, t = {}) {
|
|
612
623
|
this.languageUtils = e, this.options = t, this.logger = P.create("pluralResolver"), this.pluralRulesCache = {};
|
|
613
624
|
}
|
|
@@ -615,7 +626,7 @@ class Ue {
|
|
|
615
626
|
this.pluralRulesCache = {};
|
|
616
627
|
}
|
|
617
628
|
getRule(e, t = {}) {
|
|
618
|
-
const i =
|
|
629
|
+
const i = z(e === "dev" ? "en" : e), s = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
|
|
619
630
|
cleanedCode: i,
|
|
620
631
|
type: s
|
|
621
632
|
});
|
|
@@ -627,7 +638,7 @@ class Ue {
|
|
|
627
638
|
type: s
|
|
628
639
|
});
|
|
629
640
|
} catch {
|
|
630
|
-
if (
|
|
641
|
+
if (typeof Intl > "u")
|
|
631
642
|
return this.logger.error("No Intl support, please use an Intl polyfill!"), ce;
|
|
632
643
|
if (!e.match(/-|_/)) return ce;
|
|
633
644
|
const l = this.languageUtils.getLanguagePartFromCode(e);
|
|
@@ -651,10 +662,10 @@ class Ue {
|
|
|
651
662
|
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
663
|
}
|
|
653
664
|
}
|
|
654
|
-
const he = (
|
|
655
|
-
let n =
|
|
656
|
-
return !n && s && d(t) && (n =
|
|
657
|
-
},
|
|
665
|
+
const he = (a, e, t, i = ".", s = !0) => {
|
|
666
|
+
let n = je(a, e, t);
|
|
667
|
+
return !n && s && d(t) && (n = X(a, t, i), n === void 0 && (n = X(e, t, i))), n;
|
|
668
|
+
}, G = (a) => a.replace(/\$/g, "$$$$");
|
|
658
669
|
class de {
|
|
659
670
|
constructor(e = {}) {
|
|
660
671
|
this.logger = P.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((t) => t), this.init(e);
|
|
@@ -669,7 +680,7 @@ class de {
|
|
|
669
680
|
useRawValueToEscape: s,
|
|
670
681
|
prefix: n,
|
|
671
682
|
prefixEscaped: r,
|
|
672
|
-
suffix:
|
|
683
|
+
suffix: o,
|
|
673
684
|
suffixEscaped: l,
|
|
674
685
|
formatSeparator: u,
|
|
675
686
|
unescapeSuffix: c,
|
|
@@ -679,10 +690,10 @@ class de {
|
|
|
679
690
|
nestingSuffix: h,
|
|
680
691
|
nestingSuffixEscaped: x,
|
|
681
692
|
nestingOptionsSeparator: S,
|
|
682
|
-
maxReplaces:
|
|
693
|
+
maxReplaces: w,
|
|
683
694
|
alwaysFormat: y
|
|
684
695
|
} = e.interpolation;
|
|
685
|
-
this.escape = t !== void 0 ? t :
|
|
696
|
+
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 = w || 1e3, this.alwaysFormat = y !== void 0 ? y : !1, this.resetRegExp();
|
|
686
697
|
}
|
|
687
698
|
reset() {
|
|
688
699
|
this.options && this.init(this.options);
|
|
@@ -692,15 +703,15 @@ class de {
|
|
|
692
703
|
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
704
|
}
|
|
694
705
|
interpolate(e, t, i, s) {
|
|
695
|
-
let n, r,
|
|
706
|
+
let n, r, o;
|
|
696
707
|
const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (p) => {
|
|
697
708
|
if (p.indexOf(this.formatSeparator) < 0) {
|
|
698
|
-
const
|
|
699
|
-
return this.alwaysFormat ? this.format(
|
|
709
|
+
const w = he(t, l, p, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
710
|
+
return this.alwaysFormat ? this.format(w, void 0, i, {
|
|
700
711
|
...s,
|
|
701
712
|
...t,
|
|
702
713
|
interpolationkey: p
|
|
703
|
-
}) :
|
|
714
|
+
}) : w;
|
|
704
715
|
}
|
|
705
716
|
const h = p.split(this.formatSeparator), x = h.shift().trim(), S = h.join(this.formatSeparator).trim();
|
|
706
717
|
return this.format(he(t, l, x, this.options.keySeparator, this.options.ignoreJSONStructure), S, i, {
|
|
@@ -713,12 +724,12 @@ class de {
|
|
|
713
724
|
const c = s?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = s?.interpolation?.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
|
|
714
725
|
return [{
|
|
715
726
|
regex: this.regexpUnescape,
|
|
716
|
-
safeValue: (p) =>
|
|
727
|
+
safeValue: (p) => G(p)
|
|
717
728
|
}, {
|
|
718
729
|
regex: this.regexp,
|
|
719
|
-
safeValue: (p) => this.escapeValue ?
|
|
730
|
+
safeValue: (p) => this.escapeValue ? G(this.escape(p)) : G(p)
|
|
720
731
|
}].forEach((p) => {
|
|
721
|
-
for (
|
|
732
|
+
for (o = 0; n = p.regex.exec(e); ) {
|
|
722
733
|
const h = n[1].trim();
|
|
723
734
|
if (r = u(h), r === void 0)
|
|
724
735
|
if (typeof c == "function") {
|
|
@@ -733,21 +744,21 @@ class de {
|
|
|
733
744
|
this.logger.warn(`missed to pass in variable ${h} for interpolating ${e}`), r = "";
|
|
734
745
|
else !d(r) && !this.useRawValueToEscape && (r = ie(r));
|
|
735
746
|
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,
|
|
747
|
+
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
748
|
break;
|
|
738
749
|
}
|
|
739
750
|
}), e;
|
|
740
751
|
}
|
|
741
752
|
nest(e, t, i = {}) {
|
|
742
753
|
let s, n, r;
|
|
743
|
-
const
|
|
754
|
+
const o = (l, u) => {
|
|
744
755
|
const c = this.nestingOptionsSeparator;
|
|
745
756
|
if (l.indexOf(c) < 0) return l;
|
|
746
|
-
const f = l.split(new RegExp(`${c}[ ]*{`));
|
|
757
|
+
const f = l.split(new RegExp(`${F(c)}[ ]*{`));
|
|
747
758
|
let g = `{${f[1]}`;
|
|
748
759
|
l = f[0], g = this.interpolate(g, r);
|
|
749
760
|
const p = g.match(/'/g), h = g.match(/"/g);
|
|
750
|
-
((p?.length ?? 0) % 2 === 0 && !h || h
|
|
761
|
+
((p?.length ?? 0) % 2 === 0 && !h || (h?.length ?? 0) % 2 !== 0) && (g = g.replace(/'/g, '"'));
|
|
751
762
|
try {
|
|
752
763
|
r = JSON.parse(g), u && (r = {
|
|
753
764
|
...u,
|
|
@@ -764,7 +775,7 @@ class de {
|
|
|
764
775
|
...i
|
|
765
776
|
}, r = r.replace && !d(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
|
|
766
777
|
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(
|
|
778
|
+
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
779
|
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
780
|
...i,
|
|
770
781
|
interpolationkey: s[1].trim()
|
|
@@ -773,16 +784,16 @@ class de {
|
|
|
773
784
|
return e;
|
|
774
785
|
}
|
|
775
786
|
}
|
|
776
|
-
const
|
|
777
|
-
let e =
|
|
787
|
+
const ze = (a) => {
|
|
788
|
+
let e = a.toLowerCase().trim();
|
|
778
789
|
const t = {};
|
|
779
|
-
if (
|
|
780
|
-
const i =
|
|
790
|
+
if (a.indexOf("(") > -1) {
|
|
791
|
+
const i = a.split("(");
|
|
781
792
|
e = i[0].toLowerCase().trim();
|
|
782
793
|
const s = i[1].substring(0, i[1].length - 1);
|
|
783
794
|
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
795
|
if (r) {
|
|
785
|
-
const [
|
|
796
|
+
const [o, ...l] = r.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), c = o.trim();
|
|
786
797
|
t[c] || (t[c] = u), u === "false" && (t[c] = !1), u === "true" && (t[c] = !0), isNaN(u) || (t[c] = parseInt(u, 10));
|
|
787
798
|
}
|
|
788
799
|
});
|
|
@@ -791,7 +802,7 @@ const Me = (o) => {
|
|
|
791
802
|
formatName: e,
|
|
792
803
|
formatOptions: t
|
|
793
804
|
};
|
|
794
|
-
}, pe = (
|
|
805
|
+
}, pe = (a) => {
|
|
795
806
|
const e = {};
|
|
796
807
|
return (t, i, s) => {
|
|
797
808
|
let n = s;
|
|
@@ -800,11 +811,11 @@ const Me = (o) => {
|
|
|
800
811
|
[s.interpolationkey]: void 0
|
|
801
812
|
});
|
|
802
813
|
const r = i + JSON.stringify(n);
|
|
803
|
-
let
|
|
804
|
-
return
|
|
814
|
+
let o = e[r];
|
|
815
|
+
return o || (o = a(z(i), s), e[r] = o), o(t);
|
|
805
816
|
};
|
|
806
|
-
}, He = (
|
|
807
|
-
class
|
|
817
|
+
}, He = (a) => (e, t, i) => a(z(t), i)(e);
|
|
818
|
+
class Be {
|
|
808
819
|
constructor(e = {}) {
|
|
809
820
|
this.logger = P.create("formatter"), this.options = e, this.init(e);
|
|
810
821
|
}
|
|
@@ -818,32 +829,32 @@ class ze {
|
|
|
818
829
|
const r = new Intl.NumberFormat(s, {
|
|
819
830
|
...n
|
|
820
831
|
});
|
|
821
|
-
return (
|
|
832
|
+
return (o) => r.format(o);
|
|
822
833
|
}),
|
|
823
834
|
currency: i((s, n) => {
|
|
824
835
|
const r = new Intl.NumberFormat(s, {
|
|
825
836
|
...n,
|
|
826
837
|
style: "currency"
|
|
827
838
|
});
|
|
828
|
-
return (
|
|
839
|
+
return (o) => r.format(o);
|
|
829
840
|
}),
|
|
830
841
|
datetime: i((s, n) => {
|
|
831
842
|
const r = new Intl.DateTimeFormat(s, {
|
|
832
843
|
...n
|
|
833
844
|
});
|
|
834
|
-
return (
|
|
845
|
+
return (o) => r.format(o);
|
|
835
846
|
}),
|
|
836
847
|
relativetime: i((s, n) => {
|
|
837
848
|
const r = new Intl.RelativeTimeFormat(s, {
|
|
838
849
|
...n
|
|
839
850
|
});
|
|
840
|
-
return (
|
|
851
|
+
return (o) => r.format(o, n.range || "day");
|
|
841
852
|
}),
|
|
842
853
|
list: i((s, n) => {
|
|
843
854
|
const r = new Intl.ListFormat(s, {
|
|
844
855
|
...n
|
|
845
856
|
});
|
|
846
|
-
return (
|
|
857
|
+
return (o) => r.format(o);
|
|
847
858
|
})
|
|
848
859
|
};
|
|
849
860
|
}
|
|
@@ -855,20 +866,20 @@ class ze {
|
|
|
855
866
|
}
|
|
856
867
|
format(e, t, i, s = {}) {
|
|
857
868
|
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,
|
|
869
|
+
if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((o) => o.indexOf(")") > -1)) {
|
|
870
|
+
const o = n.findIndex((l) => l.indexOf(")") > -1);
|
|
871
|
+
n[0] = [n[0], ...n.splice(1, o)].join(this.formatSeparator);
|
|
861
872
|
}
|
|
862
|
-
return n.reduce((
|
|
873
|
+
return n.reduce((o, l) => {
|
|
863
874
|
const {
|
|
864
875
|
formatName: u,
|
|
865
876
|
formatOptions: c
|
|
866
|
-
} =
|
|
877
|
+
} = ze(l);
|
|
867
878
|
if (this.formats[u]) {
|
|
868
|
-
let f =
|
|
879
|
+
let f = o;
|
|
869
880
|
try {
|
|
870
881
|
const g = s?.formatParams?.[s.interpolationkey] || {}, p = g.locale || g.lng || s.locale || s.lng || i;
|
|
871
|
-
f = this.formats[u](
|
|
882
|
+
f = this.formats[u](o, p, {
|
|
872
883
|
...c,
|
|
873
884
|
...s,
|
|
874
885
|
...g
|
|
@@ -879,25 +890,25 @@ class ze {
|
|
|
879
890
|
return f;
|
|
880
891
|
} else
|
|
881
892
|
this.logger.warn(`there was no format function for ${u}`);
|
|
882
|
-
return
|
|
893
|
+
return o;
|
|
883
894
|
}, e);
|
|
884
895
|
}
|
|
885
896
|
}
|
|
886
|
-
const
|
|
887
|
-
|
|
897
|
+
const Je = (a, e) => {
|
|
898
|
+
a.pending[e] !== void 0 && (delete a.pending[e], a.pendingCount--);
|
|
888
899
|
};
|
|
889
|
-
class
|
|
900
|
+
class _e extends W {
|
|
890
901
|
constructor(e, t, i, s = {}) {
|
|
891
902
|
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
903
|
}
|
|
893
904
|
queueLoad(e, t, i, s) {
|
|
894
|
-
const n = {}, r = {},
|
|
905
|
+
const n = {}, r = {}, o = {}, l = {};
|
|
895
906
|
return e.forEach((u) => {
|
|
896
907
|
let c = !0;
|
|
897
908
|
t.forEach((f) => {
|
|
898
909
|
const g = `${u}|${f}`;
|
|
899
910
|
!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 || (
|
|
911
|
+
}), c || (o[u] = !0);
|
|
901
912
|
}), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
|
|
902
913
|
pending: r,
|
|
903
914
|
pendingCount: Object.keys(r).length,
|
|
@@ -907,7 +918,7 @@ class Je extends W {
|
|
|
907
918
|
}), {
|
|
908
919
|
toLoad: Object.keys(n),
|
|
909
920
|
pending: Object.keys(r),
|
|
910
|
-
toLoadLanguages: Object.keys(
|
|
921
|
+
toLoadLanguages: Object.keys(o),
|
|
911
922
|
toLoadNamespaces: Object.keys(l)
|
|
912
923
|
};
|
|
913
924
|
}
|
|
@@ -916,16 +927,16 @@ class Je extends W {
|
|
|
916
927
|
t && this.emit("failedLoading", n, r, t), !t && i && this.store.addResourceBundle(n, r, i, void 0, void 0, {
|
|
917
928
|
skipCopy: !0
|
|
918
929
|
}), this.state[e] = t ? -1 : 2, t && i && (this.state[e] = 0);
|
|
919
|
-
const
|
|
930
|
+
const o = {};
|
|
920
931
|
this.queue.forEach((l) => {
|
|
921
|
-
|
|
922
|
-
|
|
932
|
+
Ee(l.loaded, [n], r), Je(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
|
|
933
|
+
o[u] || (o[u] = {});
|
|
923
934
|
const c = l.loaded[u];
|
|
924
935
|
c.length && c.forEach((f) => {
|
|
925
|
-
|
|
936
|
+
o[u][f] === void 0 && (o[u][f] = !0);
|
|
926
937
|
});
|
|
927
938
|
}), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
|
|
928
|
-
}), this.emit("loaded",
|
|
939
|
+
}), this.emit("loaded", o), this.queue = this.queue.filter((l) => !l.done);
|
|
929
940
|
}
|
|
930
941
|
read(e, t, i, s = 0, n = this.retryTimeout, r) {
|
|
931
942
|
if (!e.length) return r(null, {});
|
|
@@ -941,7 +952,7 @@ class Je extends W {
|
|
|
941
952
|
return;
|
|
942
953
|
}
|
|
943
954
|
this.readingCalls++;
|
|
944
|
-
const
|
|
955
|
+
const o = (u, c) => {
|
|
945
956
|
if (this.readingCalls--, this.waitingReads.length > 0) {
|
|
946
957
|
const f = this.waitingReads.shift();
|
|
947
958
|
this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
|
|
@@ -957,13 +968,13 @@ class Je extends W {
|
|
|
957
968
|
if (l.length === 2) {
|
|
958
969
|
try {
|
|
959
970
|
const u = l(e, t);
|
|
960
|
-
u && typeof u.then == "function" ? u.then((c) =>
|
|
971
|
+
u && typeof u.then == "function" ? u.then((c) => o(null, c)).catch(o) : o(null, u);
|
|
961
972
|
} catch (u) {
|
|
962
|
-
|
|
973
|
+
o(u);
|
|
963
974
|
}
|
|
964
975
|
return;
|
|
965
976
|
}
|
|
966
|
-
return l(e, t,
|
|
977
|
+
return l(e, t, o);
|
|
967
978
|
}
|
|
968
979
|
prepareLoading(e, t, i = {}, s) {
|
|
969
980
|
if (!this.backend)
|
|
@@ -986,11 +997,11 @@ class Je extends W {
|
|
|
986
997
|
}
|
|
987
998
|
loadOne(e, t = "") {
|
|
988
999
|
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 &&
|
|
1000
|
+
this.read(s, n, "read", void 0, void 0, (r, o) => {
|
|
1001
|
+
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
1002
|
});
|
|
992
1003
|
}
|
|
993
|
-
saveMissing(e, t, i, s, n, r = {},
|
|
1004
|
+
saveMissing(e, t, i, s, n, r = {}, o = () => {
|
|
994
1005
|
}) {
|
|
995
1006
|
if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
|
|
996
1007
|
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,18 +1016,18 @@ class Je extends W {
|
|
|
1005
1016
|
if (u.length < 6)
|
|
1006
1017
|
try {
|
|
1007
1018
|
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) =>
|
|
1019
|
+
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
1020
|
} catch (c) {
|
|
1010
|
-
|
|
1021
|
+
o(c);
|
|
1011
1022
|
}
|
|
1012
1023
|
else
|
|
1013
|
-
u(e, t, i, s,
|
|
1024
|
+
u(e, t, i, s, o, l);
|
|
1014
1025
|
}
|
|
1015
1026
|
!e || !e[0] || this.store.addResource(e[0], t, i, s);
|
|
1016
1027
|
}
|
|
1017
1028
|
}
|
|
1018
1029
|
}
|
|
1019
|
-
const
|
|
1030
|
+
const Z = () => ({
|
|
1020
1031
|
debug: !1,
|
|
1021
1032
|
initAsync: !0,
|
|
1022
1033
|
ns: ["translation"],
|
|
@@ -1049,10 +1060,10 @@ const G = () => ({
|
|
|
1049
1060
|
parseMissingKeyHandler: !1,
|
|
1050
1061
|
appendNamespaceToMissingKey: !1,
|
|
1051
1062
|
appendNamespaceToCIMode: !1,
|
|
1052
|
-
overloadTranslationOptionHandler: (
|
|
1063
|
+
overloadTranslationOptionHandler: (a) => {
|
|
1053
1064
|
let e = {};
|
|
1054
|
-
if (typeof
|
|
1055
|
-
const t =
|
|
1065
|
+
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") {
|
|
1066
|
+
const t = a[3] || a[2];
|
|
1056
1067
|
Object.keys(t).forEach((i) => {
|
|
1057
1068
|
e[i] = t[i];
|
|
1058
1069
|
});
|
|
@@ -1061,7 +1072,7 @@ const G = () => ({
|
|
|
1061
1072
|
},
|
|
1062
1073
|
interpolation: {
|
|
1063
1074
|
escapeValue: !0,
|
|
1064
|
-
format: (
|
|
1075
|
+
format: (a) => a,
|
|
1065
1076
|
prefix: "{{",
|
|
1066
1077
|
suffix: "}}",
|
|
1067
1078
|
formatSeparator: ",",
|
|
@@ -1073,17 +1084,19 @@ const G = () => ({
|
|
|
1073
1084
|
skipOnVariables: !0
|
|
1074
1085
|
},
|
|
1075
1086
|
cacheInBuiltFormats: !0
|
|
1076
|
-
}), ge = (
|
|
1077
|
-
},
|
|
1078
|
-
Object.getOwnPropertyNames(Object.getPrototypeOf(
|
|
1079
|
-
typeof
|
|
1087
|
+
}), 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), B = () => {
|
|
1088
|
+
}, Ye = (a) => {
|
|
1089
|
+
Object.getOwnPropertyNames(Object.getPrototypeOf(a)).forEach((t) => {
|
|
1090
|
+
typeof a[t] == "function" && (a[t] = a[t].bind(a));
|
|
1080
1091
|
});
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1092
|
+
}, be = "__i18next_supportNoticeShown", We = () => typeof globalThis < "u" && !!globalThis[be], Qe = () => {
|
|
1093
|
+
typeof globalThis < "u" && (globalThis[be] = !0);
|
|
1094
|
+
}, 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));
|
|
1095
|
+
class M extends W {
|
|
1083
1096
|
constructor(e = {}, t) {
|
|
1084
1097
|
if (super(), this.options = ge(e), this.services = {}, this.logger = P, this.modules = {
|
|
1085
1098
|
external: []
|
|
1086
|
-
},
|
|
1099
|
+
}, Ye(this), t && !this.isInitialized && !e.isClone) {
|
|
1087
1100
|
if (!this.options.initAsync)
|
|
1088
1101
|
return this.init(e, t), this;
|
|
1089
1102
|
setTimeout(() => {
|
|
@@ -1093,7 +1106,7 @@ class U extends W {
|
|
|
1093
1106
|
}
|
|
1094
1107
|
init(e = {}, t) {
|
|
1095
1108
|
this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (d(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
|
|
1096
|
-
const i =
|
|
1109
|
+
const i = Z();
|
|
1097
1110
|
this.options = {
|
|
1098
1111
|
...i,
|
|
1099
1112
|
...this.options,
|
|
@@ -1101,29 +1114,29 @@ class U extends W {
|
|
|
1101
1114
|
}, this.options.interpolation = {
|
|
1102
1115
|
...i.interpolation,
|
|
1103
1116
|
...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);
|
|
1117
|
+
}, 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 made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), Qe());
|
|
1105
1118
|
const s = (u) => u ? typeof u == "function" ? new u() : u : null;
|
|
1106
1119
|
if (!this.options.isClone) {
|
|
1107
1120
|
this.modules.logger ? P.init(s(this.modules.logger), this.options) : P.init(null, this.options);
|
|
1108
1121
|
let u;
|
|
1109
|
-
this.modules.formatter ? u = this.modules.formatter : u =
|
|
1122
|
+
this.modules.formatter ? u = this.modules.formatter : u = Be;
|
|
1110
1123
|
const c = new ue(this.options);
|
|
1111
1124
|
this.store = new oe(this.options.resources, this.options);
|
|
1112
1125
|
const f = this.services;
|
|
1113
|
-
f.logger = P, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new
|
|
1126
|
+
f.logger = P, f.resourceStore = this.store, f.languageUtils = c, f.pluralResolver = new Me(c, {
|
|
1114
1127
|
prepend: this.options.pluralSeparator,
|
|
1115
1128
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1116
1129
|
}), 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
1130
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1118
|
-
}, f.backendConnector = new
|
|
1131
|
+
}, f.backendConnector = new _e(s(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (p, ...h) => {
|
|
1119
1132
|
this.emit(p, ...h);
|
|
1120
|
-
}), 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
|
|
1133
|
+
}), 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 Y(this.services, this.options), this.translator.on("*", (p, ...h) => {
|
|
1121
1134
|
this.emit(p, ...h);
|
|
1122
1135
|
}), this.modules.external.forEach((p) => {
|
|
1123
1136
|
p.init && p.init(this);
|
|
1124
1137
|
});
|
|
1125
1138
|
}
|
|
1126
|
-
if (this.format = this.options.interpolation.format, t || (t =
|
|
1139
|
+
if (this.format = this.options.interpolation.format, t || (t = B), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1127
1140
|
const u = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1128
1141
|
u.length > 0 && u[0] !== "dev" && (this.options.lng = u[0]);
|
|
1129
1142
|
}
|
|
@@ -1132,35 +1145,35 @@ class U extends W {
|
|
|
1132
1145
|
}), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((u) => {
|
|
1133
1146
|
this[u] = (...c) => (this.store[u](...c), this);
|
|
1134
1147
|
});
|
|
1135
|
-
const
|
|
1148
|
+
const o = K(), l = () => {
|
|
1136
1149
|
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),
|
|
1150
|
+
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
1151
|
};
|
|
1139
1152
|
if (this.languages && !this.isInitialized) return u(null, this.t.bind(this));
|
|
1140
1153
|
this.changeLanguage(this.options.lng, u);
|
|
1141
1154
|
};
|
|
1142
|
-
return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0),
|
|
1155
|
+
return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), o;
|
|
1143
1156
|
}
|
|
1144
|
-
loadResources(e, t =
|
|
1157
|
+
loadResources(e, t = B) {
|
|
1145
1158
|
let i = t;
|
|
1146
1159
|
const s = d(e) ? e : this.language;
|
|
1147
1160
|
if (typeof e == "function" && (i = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1148
1161
|
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(
|
|
1162
|
+
const n = [], r = (o) => {
|
|
1163
|
+
if (!o || o === "cimode") return;
|
|
1164
|
+
this.services.languageUtils.toResolveHierarchy(o).forEach((u) => {
|
|
1152
1165
|
u !== "cimode" && n.indexOf(u) < 0 && n.push(u);
|
|
1153
1166
|
});
|
|
1154
1167
|
};
|
|
1155
|
-
s ? r(s) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((l) => r(l)), this.options.preload?.forEach?.((
|
|
1156
|
-
!
|
|
1168
|
+
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) => {
|
|
1169
|
+
!o && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), i(o);
|
|
1157
1170
|
});
|
|
1158
1171
|
} else
|
|
1159
1172
|
i(null);
|
|
1160
1173
|
}
|
|
1161
1174
|
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 =
|
|
1175
|
+
const s = K();
|
|
1176
|
+
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 = B), this.services.backendConnector.reload(e, t, (n) => {
|
|
1164
1177
|
s.resolve(), i(n);
|
|
1165
1178
|
}), s;
|
|
1166
1179
|
}
|
|
@@ -1183,15 +1196,15 @@ class U extends W {
|
|
|
1183
1196
|
}
|
|
1184
1197
|
changeLanguage(e, t) {
|
|
1185
1198
|
this.isLanguageChangingTo = e;
|
|
1186
|
-
const i =
|
|
1199
|
+
const i = K();
|
|
1187
1200
|
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(
|
|
1201
|
+
const s = (o) => {
|
|
1202
|
+
this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
|
|
1203
|
+
}, n = (o, l) => {
|
|
1204
|
+
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));
|
|
1205
|
+
}, r = (o) => {
|
|
1206
|
+
!e && !o && this.services.languageDetector && (o = []);
|
|
1207
|
+
const l = d(o) ? o : o && o[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(d(o) ? [o] : o);
|
|
1195
1208
|
u && (this.language || s(u), this.translator.language || this.translator.changeLanguage(u), this.services.languageDetector?.cacheUserLanguage?.(u)), this.loadResources(u, (c) => {
|
|
1196
1209
|
n(c, u);
|
|
1197
1210
|
});
|
|
@@ -1199,17 +1212,17 @@ class U extends W {
|
|
|
1199
1212
|
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
1213
|
}
|
|
1201
1214
|
getFixedT(e, t, i) {
|
|
1202
|
-
const s = (n, r, ...
|
|
1215
|
+
const s = (n, r, ...o) => {
|
|
1203
1216
|
let l;
|
|
1204
|
-
typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(
|
|
1217
|
+
typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(o)) : l = {
|
|
1205
1218
|
...r
|
|
1206
1219
|
}, 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
1220
|
const u = this.options.keySeparator || ".";
|
|
1208
1221
|
let c;
|
|
1209
|
-
return l.keyPrefix && Array.isArray(n) ? c = n.map((f) => (typeof f == "function" && (f =
|
|
1222
|
+
return l.keyPrefix && Array.isArray(n) ? c = n.map((f) => (typeof f == "function" && (f = U(f, {
|
|
1210
1223
|
...this.options,
|
|
1211
1224
|
...r
|
|
1212
|
-
})), `${l.keyPrefix}${u}${f}`)) : (typeof n == "function" && (n =
|
|
1225
|
+
})), `${l.keyPrefix}${u}${f}`)) : (typeof n == "function" && (n = U(n, {
|
|
1213
1226
|
...this.options,
|
|
1214
1227
|
...r
|
|
1215
1228
|
})), c = l.keyPrefix ? `${l.keyPrefix}${u}${n}` : n), this.t(c, l);
|
|
@@ -1232,18 +1245,18 @@ class U extends W {
|
|
|
1232
1245
|
return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
|
|
1233
1246
|
const i = t.lng || this.resolvedLanguage || this.languages[0], s = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
|
|
1234
1247
|
if (i.toLowerCase() === "cimode") return !0;
|
|
1235
|
-
const r = (
|
|
1236
|
-
const u = this.services.backendConnector.state[`${
|
|
1248
|
+
const r = (o, l) => {
|
|
1249
|
+
const u = this.services.backendConnector.state[`${o}|${l}`];
|
|
1237
1250
|
return u === -1 || u === 0 || u === 2;
|
|
1238
1251
|
};
|
|
1239
1252
|
if (t.precheck) {
|
|
1240
|
-
const
|
|
1241
|
-
if (
|
|
1253
|
+
const o = t.precheck(this, r);
|
|
1254
|
+
if (o !== void 0) return o;
|
|
1242
1255
|
}
|
|
1243
1256
|
return !!(this.hasResourceBundle(i, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(i, e) && (!s || r(n, e)));
|
|
1244
1257
|
}
|
|
1245
1258
|
loadNamespaces(e, t) {
|
|
1246
|
-
const i =
|
|
1259
|
+
const i = K();
|
|
1247
1260
|
return this.options.ns ? (d(e) && (e = [e]), e.forEach((s) => {
|
|
1248
1261
|
this.options.ns.indexOf(s) < 0 && this.options.ns.push(s);
|
|
1249
1262
|
}), this.loadResources((s) => {
|
|
@@ -1251,7 +1264,7 @@ class U extends W {
|
|
|
1251
1264
|
}), i) : (t && t(), Promise.resolve());
|
|
1252
1265
|
}
|
|
1253
1266
|
loadLanguages(e, t) {
|
|
1254
|
-
const i =
|
|
1267
|
+
const i = K();
|
|
1255
1268
|
d(e) && (e = [e]);
|
|
1256
1269
|
const s = this.options.preload || [], n = e.filter((r) => s.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
|
|
1257
1270
|
return n.length ? (this.options.preload = s.concat(n), this.loadResources((r) => {
|
|
@@ -1268,38 +1281,38 @@ class U extends W {
|
|
|
1268
1281
|
}
|
|
1269
1282
|
} catch {
|
|
1270
1283
|
}
|
|
1271
|
-
const t = ["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"], i = this.services?.languageUtils || new ue(
|
|
1284
|
+
const t = ["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"], i = this.services?.languageUtils || new ue(Z());
|
|
1272
1285
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(i.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1273
1286
|
}
|
|
1274
1287
|
static createInstance(e = {}, t) {
|
|
1275
|
-
const i = new
|
|
1276
|
-
return i.createInstance =
|
|
1288
|
+
const i = new M(e, t);
|
|
1289
|
+
return i.createInstance = M.createInstance, i;
|
|
1277
1290
|
}
|
|
1278
|
-
cloneInstance(e = {}, t =
|
|
1291
|
+
cloneInstance(e = {}, t = B) {
|
|
1279
1292
|
const i = e.forkResourceStore;
|
|
1280
1293
|
i && delete e.forkResourceStore;
|
|
1281
1294
|
const s = {
|
|
1282
1295
|
...this.options,
|
|
1283
1296
|
...e,
|
|
1284
1297
|
isClone: !0
|
|
1285
|
-
}, n = new
|
|
1286
|
-
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((
|
|
1287
|
-
n[
|
|
1298
|
+
}, n = new M(s);
|
|
1299
|
+
if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
|
|
1300
|
+
n[o] = this[o];
|
|
1288
1301
|
}), n.services = {
|
|
1289
1302
|
...this.services
|
|
1290
1303
|
}, n.services.utils = {
|
|
1291
1304
|
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1292
1305
|
}, i) {
|
|
1293
|
-
const
|
|
1306
|
+
const o = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
|
|
1294
1307
|
...this.store.data[u]
|
|
1295
1308
|
}, l[u] = Object.keys(l[u]).reduce((c, f) => (c[f] = {
|
|
1296
1309
|
...l[u][f]
|
|
1297
1310
|
}, c), l[u]), l), {});
|
|
1298
|
-
n.store = new oe(
|
|
1311
|
+
n.store = new oe(o, s), n.services.resourceStore = n.store;
|
|
1299
1312
|
}
|
|
1300
1313
|
if (e.interpolation) {
|
|
1301
1314
|
const l = {
|
|
1302
|
-
...
|
|
1315
|
+
...Z().interpolation,
|
|
1303
1316
|
...this.options.interpolation,
|
|
1304
1317
|
...e.interpolation
|
|
1305
1318
|
}, u = {
|
|
@@ -1308,8 +1321,8 @@ class U extends W {
|
|
|
1308
1321
|
};
|
|
1309
1322
|
n.services.interpolator = new de(u);
|
|
1310
1323
|
}
|
|
1311
|
-
return n.translator = new
|
|
1312
|
-
n.emit(
|
|
1324
|
+
return n.translator = new Y(n.services, s), n.translator.on("*", (o, ...l) => {
|
|
1325
|
+
n.emit(o, ...l);
|
|
1313
1326
|
}), n.init(s, t), n.translator.options = s, n.translator.backendConnector.services.utils = {
|
|
1314
1327
|
hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
|
|
1315
1328
|
}, n;
|
|
@@ -1324,7 +1337,7 @@ class U extends W {
|
|
|
1324
1337
|
};
|
|
1325
1338
|
}
|
|
1326
1339
|
}
|
|
1327
|
-
const m =
|
|
1340
|
+
const m = M.createInstance();
|
|
1328
1341
|
m.createInstance;
|
|
1329
1342
|
m.dir;
|
|
1330
1343
|
m.init;
|
|
@@ -1339,16 +1352,16 @@ m.setDefaultNamespace;
|
|
|
1339
1352
|
m.hasLoadedNamespace;
|
|
1340
1353
|
m.loadNamespaces;
|
|
1341
1354
|
m.loadLanguages;
|
|
1342
|
-
const
|
|
1343
|
-
function
|
|
1355
|
+
const Oe = /* @__PURE__ */ Symbol();
|
|
1356
|
+
function nt(a, { i18next: e, rerenderOn: t = [
|
|
1344
1357
|
"languageChanged",
|
|
1345
1358
|
"loaded",
|
|
1346
1359
|
"added",
|
|
1347
1360
|
"removed"
|
|
1348
1361
|
], slotStart: i = "{", slotEnd: s = "}" }) {
|
|
1349
|
-
const n =
|
|
1362
|
+
const n = Pe(/* @__PURE__ */ new Date()), r = () => Re(() => {
|
|
1350
1363
|
n.value = /* @__PURE__ */ new Date();
|
|
1351
|
-
}),
|
|
1364
|
+
}), o = () => n.value;
|
|
1352
1365
|
t.forEach((c) => {
|
|
1353
1366
|
switch (c) {
|
|
1354
1367
|
case "added":
|
|
@@ -1359,87 +1372,87 @@ function et(o, { i18next: e, rerenderOn: t = [
|
|
|
1359
1372
|
e.on(c, r);
|
|
1360
1373
|
break;
|
|
1361
1374
|
}
|
|
1362
|
-
}),
|
|
1375
|
+
}), a.component("i18next", qe);
|
|
1363
1376
|
const l = () => e.isInitialized;
|
|
1364
|
-
|
|
1377
|
+
a.config.globalProperties.$t = me(e.t.bind(e), o, l);
|
|
1365
1378
|
const u = new Proxy(e, { get(c, f) {
|
|
1366
|
-
return
|
|
1379
|
+
return o(), Reflect.get(c, f);
|
|
1367
1380
|
} });
|
|
1368
|
-
|
|
1381
|
+
a.config.globalProperties.$i18next = u, a.provide(Oe, {
|
|
1369
1382
|
i18next: u,
|
|
1370
|
-
slotPattern:
|
|
1383
|
+
slotPattern: Xe(i, s),
|
|
1371
1384
|
withAccessRecording(c, f) {
|
|
1372
|
-
return me(c,
|
|
1385
|
+
return me(c, o, f);
|
|
1373
1386
|
}
|
|
1374
1387
|
});
|
|
1375
1388
|
}
|
|
1376
|
-
function
|
|
1377
|
-
const { i18next: t, withAccessRecording: i } =
|
|
1389
|
+
function rt(a, e) {
|
|
1390
|
+
const { i18next: t, withAccessRecording: i } = Le();
|
|
1378
1391
|
let s;
|
|
1379
1392
|
return s = t.getFixedT(null, null, e?.keyPrefix), {
|
|
1380
1393
|
i18next: t,
|
|
1381
|
-
t: i(s,
|
|
1394
|
+
t: i(s, Ze(t, a))
|
|
1382
1395
|
};
|
|
1383
1396
|
}
|
|
1384
|
-
function
|
|
1397
|
+
function Ze(a, e = []) {
|
|
1385
1398
|
let t;
|
|
1386
1399
|
return () => {
|
|
1387
|
-
if (t === void 0) if (
|
|
1388
|
-
const i = (typeof e == "string" ? [e] : e).filter((s) => !
|
|
1389
|
-
i.length ? (t = !1,
|
|
1400
|
+
if (t === void 0) if (a.isInitialized) {
|
|
1401
|
+
const i = (typeof e == "string" ? [e] : e).filter((s) => !a.hasLoadedNamespace(s));
|
|
1402
|
+
i.length ? (t = !1, a.loadNamespaces(i).then(() => t = !0)) : t = !0;
|
|
1390
1403
|
} else
|
|
1391
1404
|
return !1;
|
|
1392
1405
|
return t;
|
|
1393
1406
|
};
|
|
1394
1407
|
}
|
|
1395
|
-
function me(
|
|
1396
|
-
return new Proxy(
|
|
1408
|
+
function me(a, e, t) {
|
|
1409
|
+
return new Proxy(a, { apply: function(i, s, n) {
|
|
1397
1410
|
return e(), t() ? Reflect.apply(i, s, n) : "";
|
|
1398
1411
|
} });
|
|
1399
1412
|
}
|
|
1400
|
-
function
|
|
1401
|
-
const
|
|
1402
|
-
if (!
|
|
1403
|
-
return
|
|
1413
|
+
function Le() {
|
|
1414
|
+
const a = $e(Oe);
|
|
1415
|
+
if (!a) throw new Error("i18next-vue: Make sure to register the i18next-vue plugin using app.use(...).");
|
|
1416
|
+
return a;
|
|
1404
1417
|
}
|
|
1405
|
-
function
|
|
1406
|
-
const t = `${
|
|
1418
|
+
function Xe(a, e) {
|
|
1419
|
+
const t = `${a}\\s*([a-z0-9\\-]+)\\s*${e}`;
|
|
1407
1420
|
return new RegExp(t, "gi");
|
|
1408
1421
|
}
|
|
1409
|
-
const
|
|
1422
|
+
const qe = Ce({
|
|
1410
1423
|
props: { translation: {
|
|
1411
1424
|
type: String,
|
|
1412
1425
|
required: !0
|
|
1413
1426
|
} },
|
|
1414
|
-
setup(
|
|
1415
|
-
const { slotPattern: t } =
|
|
1427
|
+
setup(a, { slots: e }) {
|
|
1428
|
+
const { slotPattern: t } = Le();
|
|
1416
1429
|
return () => {
|
|
1417
|
-
const i =
|
|
1430
|
+
const i = a.translation, s = [];
|
|
1418
1431
|
let n, r = 0;
|
|
1419
1432
|
for (; (n = t.exec(i)) !== null; ) {
|
|
1420
1433
|
s.push(i.substring(r, n.index));
|
|
1421
|
-
const
|
|
1422
|
-
|
|
1434
|
+
const o = e[n[1]];
|
|
1435
|
+
o ? s.push(...o()) : s.push(n[0]), r = t.lastIndex;
|
|
1423
1436
|
}
|
|
1424
1437
|
return s.push(i.substring(r)), s;
|
|
1425
1438
|
};
|
|
1426
1439
|
}
|
|
1427
|
-
}),
|
|
1428
|
-
async function
|
|
1429
|
-
for (const [e, t] of Object.entries(
|
|
1440
|
+
}), et = "translation";
|
|
1441
|
+
async function at(a) {
|
|
1442
|
+
for (const [e, t] of Object.entries(a)) {
|
|
1430
1443
|
const i = e.match(/\/([^/]+)\.json$/)[1];
|
|
1431
|
-
await
|
|
1444
|
+
await tt(i, t);
|
|
1432
1445
|
}
|
|
1433
1446
|
}
|
|
1434
|
-
async function
|
|
1435
|
-
await
|
|
1447
|
+
async function tt(a, e) {
|
|
1448
|
+
await st(), m.addResourceBundle(a, et, e, !0, !0);
|
|
1436
1449
|
}
|
|
1437
|
-
async function
|
|
1450
|
+
async function st() {
|
|
1438
1451
|
m.isInitialized || await m.init();
|
|
1439
1452
|
}
|
|
1440
1453
|
export {
|
|
1441
|
-
|
|
1442
|
-
|
|
1454
|
+
at as a,
|
|
1455
|
+
nt as b,
|
|
1443
1456
|
m as i,
|
|
1444
|
-
|
|
1457
|
+
rt as u
|
|
1445
1458
|
};
|