@andre1502/react-utilities 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -0
- package/dist/{EnvironmentEnum-CXTWJxNo.js → EnvironmentEnum-F4hjulGN.js} +3 -1
- package/dist/EnvironmentEnum-F4hjulGN.js.map +1 -0
- package/dist/{Utils-CJ7ureSW.js → Utils-Bb2yUYbQ.js} +1 -1
- package/dist/{Utils-CJ7ureSW.js.map → Utils-Bb2yUYbQ.js.map} +1 -1
- package/dist/{config-cli-BIF4xuoO.js → config-cli-CY_z5CYp.js} +285 -283
- package/dist/config-cli-CY_z5CYp.js.map +1 -0
- package/dist/config-cli.js +3 -3
- package/dist/enums/EnvironmentEnum.d.ts +2 -0
- package/dist/{format-BgweN3o5.js → format-DOgTlvp7.js} +1 -1
- package/dist/{format-BgweN3o5.js.map → format-DOgTlvp7.js.map} +1 -1
- package/dist/format.js +1 -1
- package/dist/{hooks-oAipbPQ2.js → hooks-BBCIHhac.js} +1 -1
- package/dist/{hooks-oAipbPQ2.js.map → hooks-BBCIHhac.js.map} +1 -1
- package/dist/hooks.js +1 -1
- package/dist/{i18n-D1jKJPI0.js → i18n-CJthsaWo.js} +475 -597
- package/dist/i18n-CJthsaWo.js.map +1 -0
- package/dist/i18n.js +2 -2
- package/dist/index-cli.js +3 -3
- package/dist/index-rn.js +4 -4
- package/dist/index.js +4 -4
- package/dist/{sentry-rn-DZwIel7y.js → sentry-rn-DNJphpGY.js} +2 -2
- package/dist/{sentry-rn-DZwIel7y.js.map → sentry-rn-DNJphpGY.js.map} +1 -1
- package/dist/sentry-rn.js +1 -1
- package/dist/sentry.js +1 -1
- package/package.json +2 -2
- package/src/Config/Config.ts +1 -1
- package/src/enums/EnvironmentEnum.ts +2 -0
- package/dist/EnvironmentEnum-CXTWJxNo.js.map +0 -1
- package/dist/browser-ponyfill-C-HVh7ck.js +0 -321
- package/dist/browser-ponyfill-C-HVh7ck.js.map +0 -1
- package/dist/chunk-vKJrgz-R.js +0 -16
- package/dist/config-cli-BIF4xuoO.js.map +0 -1
- package/dist/i18n-D1jKJPI0.js.map +0 -1
|
@@ -1,55 +1,54 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getV as t } from "./utils.js";
|
|
1
|
+
import { getV as e } from "./utils.js";
|
|
3
2
|
//#region node_modules/i18next/dist/esm/i18next.js
|
|
4
|
-
var
|
|
3
|
+
var t = (e) => typeof e == "string", n = () => {
|
|
5
4
|
let e, t, n = new Promise((n, r) => {
|
|
6
5
|
e = n, t = r;
|
|
7
6
|
});
|
|
8
7
|
return n.resolve = e, n.reject = t, n;
|
|
9
|
-
},
|
|
8
|
+
}, r = (e) => e == null ? "" : String(e), i = (e, t, n) => {
|
|
10
9
|
e.forEach((e) => {
|
|
11
10
|
t[e] && (n[e] = t[e]);
|
|
12
11
|
});
|
|
13
|
-
},
|
|
14
|
-
let i = n
|
|
12
|
+
}, a = /###/g, o = (e) => e && e.includes("###") ? e.replace(a, ".") : e, s = (e) => !e || t(e), c = (e, n, r) => {
|
|
13
|
+
let i = t(n) ? n.split(".") : n, a = 0;
|
|
15
14
|
for (; a < i.length - 1;) {
|
|
16
|
-
if (
|
|
17
|
-
let t =
|
|
15
|
+
if (s(e)) return {};
|
|
16
|
+
let t = o(i[a]);
|
|
18
17
|
!e[t] && r && (e[t] = new r()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++a;
|
|
19
18
|
}
|
|
20
|
-
return
|
|
19
|
+
return s(e) ? {} : {
|
|
21
20
|
obj: e,
|
|
22
|
-
k:
|
|
21
|
+
k: o(i[a])
|
|
23
22
|
};
|
|
24
|
-
},
|
|
25
|
-
let { obj: r, k: i } =
|
|
23
|
+
}, l = (e, t, n) => {
|
|
24
|
+
let { obj: r, k: i } = c(e, t, Object);
|
|
26
25
|
if (r !== void 0 || t.length === 1) {
|
|
27
26
|
r[i] = n;
|
|
28
27
|
return;
|
|
29
28
|
}
|
|
30
|
-
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s =
|
|
31
|
-
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s =
|
|
29
|
+
let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = c(e, o, Object);
|
|
30
|
+
for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = c(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
|
|
32
31
|
s.obj[`${s.k}.${a}`] = n;
|
|
33
|
-
},
|
|
34
|
-
let { obj: i, k: a } =
|
|
32
|
+
}, u = (e, t, n, r) => {
|
|
33
|
+
let { obj: i, k: a } = c(e, t, Object);
|
|
35
34
|
i[a] = i[a] || [], i[a].push(n);
|
|
36
|
-
},
|
|
37
|
-
let { obj: n, k: r } =
|
|
35
|
+
}, d = (e, t) => {
|
|
36
|
+
let { obj: n, k: r } = c(e, t);
|
|
38
37
|
if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
|
|
39
|
-
},
|
|
40
|
-
let r =
|
|
41
|
-
return r === void 0 ?
|
|
42
|
-
},
|
|
43
|
-
for (let i in
|
|
38
|
+
}, f = (e, t, n) => {
|
|
39
|
+
let r = d(e, n);
|
|
40
|
+
return r === void 0 ? d(t, n) : r;
|
|
41
|
+
}, p = (e, n, r) => {
|
|
42
|
+
for (let i in n) i !== "__proto__" && i !== "constructor" && (i in e ? t(e[i]) || e[i] instanceof String || t(n[i]) || n[i] instanceof String ? r && (e[i] = n[i]) : p(e[i], n[i], r) : e[i] = n[i]);
|
|
44
43
|
return e;
|
|
45
|
-
},
|
|
44
|
+
}, m = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), h = {
|
|
46
45
|
"&": "&",
|
|
47
46
|
"<": "<",
|
|
48
47
|
">": ">",
|
|
49
48
|
"\"": """,
|
|
50
49
|
"'": "'",
|
|
51
50
|
"/": "/"
|
|
52
|
-
},
|
|
51
|
+
}, g = (e) => t(e) ? e.replace(/[&<>"'\/]/g, (e) => h[e]) : e, _ = class {
|
|
53
52
|
constructor(e) {
|
|
54
53
|
this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
|
|
55
54
|
}
|
|
@@ -59,23 +58,23 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
59
58
|
let n = new RegExp(e);
|
|
60
59
|
return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
|
|
61
60
|
}
|
|
62
|
-
},
|
|
61
|
+
}, v = [
|
|
63
62
|
" ",
|
|
64
63
|
",",
|
|
65
64
|
"?",
|
|
66
65
|
"!",
|
|
67
66
|
";"
|
|
68
|
-
],
|
|
67
|
+
], y = new _(20), b = (e, t, n) => {
|
|
69
68
|
t ||= "", n ||= "";
|
|
70
|
-
let r =
|
|
69
|
+
let r = v.filter((e) => !t.includes(e) && !n.includes(e));
|
|
71
70
|
if (r.length === 0) return !0;
|
|
72
|
-
let i =
|
|
71
|
+
let i = y.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
|
|
73
72
|
if (!a) {
|
|
74
73
|
let t = e.indexOf(n);
|
|
75
74
|
t > 0 && !i.test(e.substring(0, t)) && (a = !0);
|
|
76
75
|
}
|
|
77
76
|
return a;
|
|
78
|
-
},
|
|
77
|
+
}, x = (e, t, n = ".") => {
|
|
79
78
|
if (!e) return;
|
|
80
79
|
if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
|
|
81
80
|
let r = t.split(n), i = e;
|
|
@@ -94,7 +93,7 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
94
93
|
i = t;
|
|
95
94
|
}
|
|
96
95
|
return i;
|
|
97
|
-
},
|
|
96
|
+
}, S = (e) => e?.replace(/_/g, "-"), ee = {
|
|
98
97
|
type: "logger",
|
|
99
98
|
log(e) {
|
|
100
99
|
this.output("log", e);
|
|
@@ -108,7 +107,7 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
108
107
|
output(e, t) {
|
|
109
108
|
console?.[e]?.apply?.(console, t);
|
|
110
109
|
}
|
|
111
|
-
},
|
|
110
|
+
}, C = new class e {
|
|
112
111
|
constructor(e, t = {}) {
|
|
113
112
|
this.init(e, t);
|
|
114
113
|
}
|
|
@@ -127,8 +126,8 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
127
126
|
deprecate(...e) {
|
|
128
127
|
return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
|
|
129
128
|
}
|
|
130
|
-
forward(e,
|
|
131
|
-
return i && !this.debug ? null : (
|
|
129
|
+
forward(e, n, r, i) {
|
|
130
|
+
return i && !this.debug ? null : (t(e[0]) && (e[0] = `${r}${this.prefix} ${e[0]}`), this.logger[n](e));
|
|
132
131
|
}
|
|
133
132
|
create(t) {
|
|
134
133
|
return new e(this.logger, {
|
|
@@ -139,7 +138,7 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
139
138
|
clone(t) {
|
|
140
139
|
return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
|
|
141
140
|
}
|
|
142
|
-
}(),
|
|
141
|
+
}(), w = class {
|
|
143
142
|
constructor() {
|
|
144
143
|
this.observers = {};
|
|
145
144
|
}
|
|
@@ -172,7 +171,7 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
172
171
|
for (let i = 0; i < r; i++) n(e, ...t);
|
|
173
172
|
});
|
|
174
173
|
}
|
|
175
|
-
},
|
|
174
|
+
}, T = class extends w {
|
|
176
175
|
constructor(e, t = {
|
|
177
176
|
ns: ["translation"],
|
|
178
177
|
defaultNS: "translation"
|
|
@@ -186,19 +185,19 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
186
185
|
let t = this.options.ns.indexOf(e);
|
|
187
186
|
t > -1 && this.options.ns.splice(t, 1);
|
|
188
187
|
}
|
|
189
|
-
getResource(e,
|
|
188
|
+
getResource(e, n, r, i = {}) {
|
|
190
189
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = i.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : i.ignoreJSONStructure, s;
|
|
191
|
-
e.includes(".") ? s = e.split(".") : (s = [e,
|
|
192
|
-
let c =
|
|
193
|
-
return !c && !
|
|
190
|
+
e.includes(".") ? s = e.split(".") : (s = [e, n], r && (Array.isArray(r) ? s.push(...r) : t(r) && a ? s.push(...r.split(a)) : s.push(r)));
|
|
191
|
+
let c = d(this.data, s);
|
|
192
|
+
return !c && !n && !r && e.includes(".") && (e = s[0], n = s[1], r = s.slice(2).join(".")), c || !o || !t(r) ? c : x(this.data?.[e]?.[n], r, a);
|
|
194
193
|
}
|
|
195
194
|
addResource(e, t, n, r, i = { silent: !1 }) {
|
|
196
195
|
let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
|
|
197
|
-
n && (o = o.concat(a ? n.split(a) : n)), e.includes(".") && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t),
|
|
196
|
+
n && (o = o.concat(a ? n.split(a) : n)), e.includes(".") && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), l(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
|
|
198
197
|
}
|
|
199
|
-
addResources(e,
|
|
200
|
-
for (let i in r) (
|
|
201
|
-
i.silent || this.emit("added", e,
|
|
198
|
+
addResources(e, n, r, i = { silent: !1 }) {
|
|
199
|
+
for (let i in r) (t(r[i]) || Array.isArray(r[i])) && this.addResource(e, n, i, r[i], { silent: !0 });
|
|
200
|
+
i.silent || this.emit("added", e, n, r);
|
|
202
201
|
}
|
|
203
202
|
addResourceBundle(e, t, n, r, i, a = {
|
|
204
203
|
silent: !1,
|
|
@@ -206,11 +205,11 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
206
205
|
}) {
|
|
207
206
|
let o = [e, t];
|
|
208
207
|
e.includes(".") && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
|
|
209
|
-
let s =
|
|
210
|
-
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ?
|
|
208
|
+
let s = d(this.data, o) || {};
|
|
209
|
+
a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? p(s, n, i) : s = {
|
|
211
210
|
...s,
|
|
212
211
|
...n
|
|
213
|
-
},
|
|
212
|
+
}, l(this.data, o, s), a.silent || this.emit("added", e, t, n);
|
|
214
213
|
}
|
|
215
214
|
removeResourceBundle(e, t) {
|
|
216
215
|
this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
|
|
@@ -231,7 +230,7 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
231
230
|
toJSON() {
|
|
232
231
|
return this.data;
|
|
233
232
|
}
|
|
234
|
-
},
|
|
233
|
+
}, E = {
|
|
235
234
|
processors: {},
|
|
236
235
|
addPostProcessor(e) {
|
|
237
236
|
this.processors[e.name] = e;
|
|
@@ -241,22 +240,22 @@ var n = (e) => typeof e == "string", r = () => {
|
|
|
241
240
|
t = this.processors[e]?.process(t, n, r, i) ?? t;
|
|
242
241
|
}), t;
|
|
243
242
|
}
|
|
244
|
-
},
|
|
243
|
+
}, D = Symbol("i18next/PATH_KEY");
|
|
245
244
|
function te() {
|
|
246
245
|
let e = [], t = Object.create(null), n;
|
|
247
|
-
return t.get = (r, i) => (n?.revoke?.(), i ===
|
|
246
|
+
return t.get = (r, i) => (n?.revoke?.(), i === D ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
|
|
248
247
|
}
|
|
249
|
-
function
|
|
250
|
-
let { [
|
|
248
|
+
function O(e, t) {
|
|
249
|
+
let { [D]: n } = e(te()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
|
|
251
250
|
if (n.length > 1 && i) {
|
|
252
251
|
let e = t?.ns, a = Array.isArray(e) ? e : null;
|
|
253
252
|
if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
|
|
254
253
|
}
|
|
255
254
|
return n.join(r);
|
|
256
255
|
}
|
|
257
|
-
var
|
|
256
|
+
var k = (e) => !t(e) && typeof e != "boolean" && typeof e != "number", A = class e extends w {
|
|
258
257
|
constructor(e, t = {}) {
|
|
259
|
-
super(),
|
|
258
|
+
super(), i([
|
|
260
259
|
"resourceStore",
|
|
261
260
|
"languageUtils",
|
|
262
261
|
"pluralResolver",
|
|
@@ -264,7 +263,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
264
263
|
"backendConnector",
|
|
265
264
|
"i18nFormat",
|
|
266
265
|
"utils"
|
|
267
|
-
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger =
|
|
266
|
+
], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = C.create("translator"), this.checkedLoadedFor = {};
|
|
268
267
|
}
|
|
269
268
|
changeLanguage(e) {
|
|
270
269
|
e && (this.language = e);
|
|
@@ -274,38 +273,38 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
274
273
|
if (e == null) return !1;
|
|
275
274
|
let r = this.resolve(e, n);
|
|
276
275
|
if (r?.res === void 0) return !1;
|
|
277
|
-
let i =
|
|
276
|
+
let i = k(r.res);
|
|
278
277
|
return !(n.returnObjects === !1 && i);
|
|
279
278
|
}
|
|
280
|
-
extractFromKey(e,
|
|
281
|
-
let r =
|
|
279
|
+
extractFromKey(e, n) {
|
|
280
|
+
let r = n.nsSeparator === void 0 ? this.options.nsSeparator : n.nsSeparator;
|
|
282
281
|
r === void 0 && (r = ":");
|
|
283
|
-
let i =
|
|
282
|
+
let i = n.keySeparator === void 0 ? this.options.keySeparator : n.keySeparator, a = n.ns || this.options.defaultNS || [], o = r && e.includes(r), s = !this.options.userDefinedKeySeparator && !n.keySeparator && !this.options.userDefinedNsSeparator && !n.nsSeparator && !b(e, r, i);
|
|
284
283
|
if (o && !s) {
|
|
285
|
-
let
|
|
286
|
-
if (
|
|
284
|
+
let n = e.match(this.interpolator.nestingRegexp);
|
|
285
|
+
if (n && n.length > 0) return {
|
|
287
286
|
key: e,
|
|
288
|
-
namespaces:
|
|
287
|
+
namespaces: t(a) ? [a] : a
|
|
289
288
|
};
|
|
290
289
|
let o = e.split(r);
|
|
291
290
|
(r !== i || r === i && this.options.ns.includes(o[0])) && (a = o.shift()), e = o.join(i);
|
|
292
291
|
}
|
|
293
292
|
return {
|
|
294
293
|
key: e,
|
|
295
|
-
namespaces:
|
|
294
|
+
namespaces: t(a) ? [a] : a
|
|
296
295
|
};
|
|
297
296
|
}
|
|
298
|
-
translate(
|
|
297
|
+
translate(n, r, i) {
|
|
299
298
|
let a = typeof r == "object" ? { ...r } : r;
|
|
300
|
-
if (typeof a != "object" && this.options.overloadTranslationOptionHandler && (a = this.options.overloadTranslationOptionHandler(arguments)), typeof a == "object" && (a = { ...a }), a ||= {},
|
|
301
|
-
typeof
|
|
299
|
+
if (typeof a != "object" && this.options.overloadTranslationOptionHandler && (a = this.options.overloadTranslationOptionHandler(arguments)), typeof a == "object" && (a = { ...a }), a ||= {}, n == null) return "";
|
|
300
|
+
typeof n == "function" && (n = O(n, {
|
|
302
301
|
...this.options,
|
|
303
302
|
...a
|
|
304
|
-
})), Array.isArray(
|
|
303
|
+
})), Array.isArray(n) || (n = [String(n)]), n = n.map((e) => typeof e == "function" ? O(e, {
|
|
305
304
|
...this.options,
|
|
306
305
|
...a
|
|
307
306
|
}) : String(e));
|
|
308
|
-
let o = a.returnDetails === void 0 ? this.options.returnDetails : a.returnDetails, s = a.keySeparator === void 0 ? this.options.keySeparator : a.keySeparator, { key: c, namespaces: l } = this.extractFromKey(
|
|
307
|
+
let o = a.returnDetails === void 0 ? this.options.returnDetails : a.returnDetails, s = a.keySeparator === void 0 ? this.options.keySeparator : a.keySeparator, { key: c, namespaces: l } = this.extractFromKey(n[n.length - 1], a), u = l[l.length - 1], d = a.nsSeparator === void 0 ? this.options.nsSeparator : a.nsSeparator;
|
|
309
308
|
d === void 0 && (d = ":");
|
|
310
309
|
let f = a.lng || this.language, p = a.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
|
|
311
310
|
if (f?.toLowerCase() === "cimode") return p ? o ? {
|
|
@@ -323,14 +322,14 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
323
322
|
usedNS: u,
|
|
324
323
|
usedParams: this.getUsedParamsDetails(a)
|
|
325
324
|
} : c;
|
|
326
|
-
let m = this.resolve(
|
|
325
|
+
let m = this.resolve(n, a), h = m?.res, g = m?.usedKey || c, _ = m?.exactUsedKey || c, v = [
|
|
327
326
|
"[object Number]",
|
|
328
327
|
"[object Function]",
|
|
329
328
|
"[object RegExp]"
|
|
330
|
-
], y = a.joinArrays === void 0 ? this.options.joinArrays : a.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = a.count !== void 0 && !
|
|
329
|
+
], y = a.joinArrays === void 0 ? this.options.joinArrays : a.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = a.count !== void 0 && !t(a.count), S = e.hasDefaultValue(a), ee = x ? this.pluralResolver.getSuffix(f, a.count, a) : "", C = a.ordinal && x ? this.pluralResolver.getSuffix(f, a.count, { ordinal: !1 }) : "", w = x && !a.ordinal && a.count === 0, T = w && a[`defaultValue${this.options.pluralSeparator}zero`] || a[`defaultValue${ee}`] || a[`defaultValue${C}`] || a.defaultValue, E = h;
|
|
331
330
|
b && !h && S && (E = T);
|
|
332
|
-
let D =
|
|
333
|
-
if (b && E && D && !v.includes(
|
|
331
|
+
let D = k(E), te = Object.prototype.toString.apply(E);
|
|
332
|
+
if (b && E && D && !v.includes(te) && !(t(y) && Array.isArray(E))) {
|
|
334
333
|
if (!a.returnObjects && !this.options.returnObjects) {
|
|
335
334
|
this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
|
|
336
335
|
let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, E, {
|
|
@@ -345,7 +344,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
345
344
|
let r = `${n}${s}${e}`;
|
|
346
345
|
S && !h ? t[e] = this.translate(r, {
|
|
347
346
|
...a,
|
|
348
|
-
defaultValue:
|
|
347
|
+
defaultValue: k(T) ? T[e] : void 0,
|
|
349
348
|
joinArrays: !1,
|
|
350
349
|
ns: l
|
|
351
350
|
}) : t[e] = this.translate(r, {
|
|
@@ -356,12 +355,12 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
356
355
|
}
|
|
357
356
|
h = t;
|
|
358
357
|
}
|
|
359
|
-
} else if (b &&
|
|
358
|
+
} else if (b && t(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, n, a, i);
|
|
360
359
|
else {
|
|
361
|
-
let e = !1,
|
|
362
|
-
!this.isValidLookup(h) && S && (e = !0, h = T), this.isValidLookup(h) || (
|
|
363
|
-
let r = (a.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) &&
|
|
364
|
-
if (
|
|
360
|
+
let e = !1, t = !1;
|
|
361
|
+
!this.isValidLookup(h) && S && (e = !0, h = T), this.isValidLookup(h) || (t = !0, h = c);
|
|
362
|
+
let r = (a.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && t ? void 0 : h, o = S && T !== h && this.options.updateMissing;
|
|
363
|
+
if (t || e || o) {
|
|
365
364
|
if (this.logger.log(o ? "updateKey" : "missingKey", f, u, c, o ? T : h), s) {
|
|
366
365
|
let e = this.resolve(c, {
|
|
367
366
|
...a,
|
|
@@ -383,11 +382,11 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
383
382
|
});
|
|
384
383
|
}) : n(e, c, T));
|
|
385
384
|
}
|
|
386
|
-
h = this.extendTranslation(h,
|
|
385
|
+
h = this.extendTranslation(h, n, a, m, i), t && h === c && this.options.appendNamespaceToMissingKey && (h = `${u}${d}${c}`), (t || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${d}${c}` : c, e ? h : void 0, a));
|
|
387
386
|
}
|
|
388
387
|
return o ? (m.res = h, m.usedParams = this.getUsedParamsDetails(a), m) : h;
|
|
389
388
|
}
|
|
390
|
-
extendTranslation(e,
|
|
389
|
+
extendTranslation(e, n, r, i, a) {
|
|
391
390
|
if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
|
|
392
391
|
...this.options.interpolation.defaultVariables,
|
|
393
392
|
...r
|
|
@@ -400,12 +399,12 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
400
399
|
...r.interpolation
|
|
401
400
|
}
|
|
402
401
|
});
|
|
403
|
-
let o =
|
|
402
|
+
let o = t(e) && (r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables), s;
|
|
404
403
|
if (o) {
|
|
405
404
|
let t = e.match(this.interpolator.nestingRegexp);
|
|
406
405
|
s = t && t.length;
|
|
407
406
|
}
|
|
408
|
-
let c = r.replace && !
|
|
407
|
+
let c = r.replace && !t(r.replace) ? r.replace : r;
|
|
409
408
|
if (this.options.interpolation.defaultVariables && (c = {
|
|
410
409
|
...this.options.interpolation.defaultVariables,
|
|
411
410
|
...c
|
|
@@ -413,10 +412,10 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
413
412
|
let t = e.match(this.interpolator.nestingRegexp), n = t && t.length;
|
|
414
413
|
s < n && (r.nest = !1);
|
|
415
414
|
}
|
|
416
|
-
!r.lng && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, (...e) => a?.[0] === e[0] && !r.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${
|
|
415
|
+
!r.lng && i && i.res && (r.lng = this.language || i.usedLng), r.nest !== !1 && (e = this.interpolator.nest(e, (...e) => a?.[0] === e[0] && !r.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${n[0]}`), null) : this.translate(...e, n), r)), r.interpolation && this.interpolator.reset();
|
|
417
416
|
}
|
|
418
|
-
let o = r.postProcess || this.options.postProcess, s =
|
|
419
|
-
return e != null && s?.length && r.applyPostProcessor !== !1 && (e =
|
|
417
|
+
let o = r.postProcess || this.options.postProcess, s = t(o) ? [o] : o;
|
|
418
|
+
return e != null && s?.length && r.applyPostProcessor !== !1 && (e = E.handle(s, e, n, this.options && this.options.postProcessPassResolved ? {
|
|
420
419
|
i18nResolved: {
|
|
421
420
|
...i,
|
|
422
421
|
usedParams: this.getUsedParamsDetails(r)
|
|
@@ -424,35 +423,35 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
424
423
|
...r
|
|
425
424
|
} : r, this)), e;
|
|
426
425
|
}
|
|
427
|
-
resolve(e,
|
|
426
|
+
resolve(e, n = {}) {
|
|
428
427
|
let r, i, a, o, s;
|
|
429
|
-
return
|
|
428
|
+
return t(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? O(e, {
|
|
430
429
|
...this.options,
|
|
431
|
-
...
|
|
430
|
+
...n
|
|
432
431
|
}) : e)), e.forEach((e) => {
|
|
433
432
|
if (this.isValidLookup(r)) return;
|
|
434
|
-
let c = this.extractFromKey(e,
|
|
433
|
+
let c = this.extractFromKey(e, n), l = c.key;
|
|
435
434
|
i = l;
|
|
436
435
|
let u = c.namespaces;
|
|
437
436
|
this.options.fallbackNS && (u = u.concat(this.options.fallbackNS));
|
|
438
|
-
let d =
|
|
437
|
+
let d = n.count !== void 0 && !t(n.count), f = d && !n.ordinal && n.count === 0, p = n.context !== void 0 && (t(n.context) || typeof n.context == "number") && n.context !== "", m = n.lngs ? n.lngs : this.languageUtils.toResolveHierarchy(n.lng || this.language, n.fallbackLng);
|
|
439
438
|
u.forEach((e) => {
|
|
440
|
-
this.isValidLookup(r) || (s = e, !this.checkedLoadedFor[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(s) && (this.checkedLoadedFor[`${m[0]}-${e}`] = !0, this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" 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!!!")), m.forEach((
|
|
439
|
+
this.isValidLookup(r) || (s = e, !this.checkedLoadedFor[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(s) && (this.checkedLoadedFor[`${m[0]}-${e}`] = !0, this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" 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!!!")), m.forEach((t) => {
|
|
441
440
|
if (this.isValidLookup(r)) return;
|
|
442
|
-
o =
|
|
441
|
+
o = t;
|
|
443
442
|
let i = [l];
|
|
444
|
-
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(i, l,
|
|
443
|
+
if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(i, l, t, e, n);
|
|
445
444
|
else {
|
|
446
445
|
let e;
|
|
447
|
-
d && (e = this.pluralResolver.getSuffix(
|
|
446
|
+
d && (e = this.pluralResolver.getSuffix(t, n.count, n));
|
|
448
447
|
let r = `${this.options.pluralSeparator}zero`, a = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
|
|
449
|
-
if (d && (
|
|
450
|
-
let
|
|
451
|
-
i.push(
|
|
448
|
+
if (d && (n.ordinal && e.startsWith(a) && i.push(l + e.replace(a, this.options.pluralSeparator)), i.push(l + e), f && i.push(l + r)), p) {
|
|
449
|
+
let t = `${l}${this.options.contextSeparator || "_"}${n.context}`;
|
|
450
|
+
i.push(t), d && (n.ordinal && e.startsWith(a) && i.push(t + e.replace(a, this.options.pluralSeparator)), i.push(t + e), f && i.push(t + r));
|
|
452
451
|
}
|
|
453
452
|
}
|
|
454
453
|
let s;
|
|
455
|
-
for (; s = i.pop();) this.isValidLookup(r) || (a = s, r = this.getResource(
|
|
454
|
+
for (; s = i.pop();) this.isValidLookup(r) || (a = s, r = this.getResource(t, e, s, n));
|
|
456
455
|
}));
|
|
457
456
|
});
|
|
458
457
|
}), {
|
|
@@ -470,7 +469,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
470
469
|
return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
|
|
471
470
|
}
|
|
472
471
|
getUsedParamsDetails(e = {}) {
|
|
473
|
-
let
|
|
472
|
+
let n = [
|
|
474
473
|
"defaultValue",
|
|
475
474
|
"ordinal",
|
|
476
475
|
"context",
|
|
@@ -486,13 +485,13 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
486
485
|
"joinArrays",
|
|
487
486
|
"postProcess",
|
|
488
487
|
"interpolation"
|
|
489
|
-
], r = e.replace && !
|
|
488
|
+
], r = e.replace && !t(e.replace), i = r ? e.replace : e;
|
|
490
489
|
if (r && e.count !== void 0 && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
|
|
491
490
|
...this.options.interpolation.defaultVariables,
|
|
492
491
|
...i
|
|
493
492
|
}), !r) {
|
|
494
493
|
i = { ...i };
|
|
495
|
-
for (let e of
|
|
494
|
+
for (let e of n) delete i[e];
|
|
496
495
|
}
|
|
497
496
|
return i;
|
|
498
497
|
}
|
|
@@ -500,22 +499,22 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
500
499
|
for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.startsWith("defaultValue") && e[t] !== void 0) return !0;
|
|
501
500
|
return !1;
|
|
502
501
|
}
|
|
503
|
-
},
|
|
502
|
+
}, j = class {
|
|
504
503
|
constructor(e) {
|
|
505
|
-
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger =
|
|
504
|
+
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = C.create("languageUtils");
|
|
506
505
|
}
|
|
507
506
|
getScriptPartFromCode(e) {
|
|
508
|
-
if (e =
|
|
507
|
+
if (e = S(e), !e || !e.includes("-")) return null;
|
|
509
508
|
let t = e.split("-");
|
|
510
509
|
return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
|
|
511
510
|
}
|
|
512
511
|
getLanguagePartFromCode(e) {
|
|
513
|
-
if (e =
|
|
512
|
+
if (e = S(e), !e || !e.includes("-")) return e;
|
|
514
513
|
let t = e.split("-");
|
|
515
514
|
return this.formatLanguageCode(t[0]);
|
|
516
515
|
}
|
|
517
516
|
formatLanguageCode(e) {
|
|
518
|
-
if (
|
|
517
|
+
if (t(e) && e.includes("-")) {
|
|
519
518
|
let t;
|
|
520
519
|
try {
|
|
521
520
|
t = Intl.getCanonicalLocales(e)[0];
|
|
@@ -543,40 +542,40 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
543
542
|
t = this.options.supportedLngs.find((e) => e === r ? !0 : !e.includes("-") && !r.includes("-") ? !1 : !!(e.includes("-") && !r.includes("-") && e.slice(0, e.indexOf("-")) === r || e.startsWith(r) && r.length > 1));
|
|
544
543
|
}), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
|
|
545
544
|
}
|
|
546
|
-
getFallbackCodes(e,
|
|
545
|
+
getFallbackCodes(e, n) {
|
|
547
546
|
if (!e) return [];
|
|
548
|
-
if (typeof e == "function" && (e = e(
|
|
549
|
-
if (!
|
|
550
|
-
let r = e[
|
|
551
|
-
return r ||= e[this.getScriptPartFromCode(
|
|
547
|
+
if (typeof e == "function" && (e = e(n)), t(e) && (e = [e]), Array.isArray(e)) return e;
|
|
548
|
+
if (!n) return e.default || [];
|
|
549
|
+
let r = e[n];
|
|
550
|
+
return r ||= e[this.getScriptPartFromCode(n)], r ||= e[this.formatLanguageCode(n)], r ||= e[this.getLanguagePartFromCode(n)], r ||= e.default, r || [];
|
|
552
551
|
}
|
|
553
|
-
toResolveHierarchy(e,
|
|
554
|
-
let r = this.getFallbackCodes((
|
|
552
|
+
toResolveHierarchy(e, n) {
|
|
553
|
+
let r = this.getFallbackCodes((n === !1 ? [] : n) || this.options.fallbackLng || [], e), i = [], a = (e) => {
|
|
555
554
|
e && (this.isSupportedCode(e) ? i.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
|
|
556
555
|
};
|
|
557
|
-
return
|
|
556
|
+
return t(e) && (e.includes("-") || e.includes("_")) ? (this.options.load !== "languageOnly" && a(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && a(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && a(this.getLanguagePartFromCode(e))) : t(e) && a(this.formatLanguageCode(e)), r.forEach((e) => {
|
|
558
557
|
i.includes(e) || a(this.formatLanguageCode(e));
|
|
559
558
|
}), i;
|
|
560
559
|
}
|
|
561
|
-
},
|
|
560
|
+
}, M = {
|
|
562
561
|
zero: 0,
|
|
563
562
|
one: 1,
|
|
564
563
|
two: 2,
|
|
565
564
|
few: 3,
|
|
566
565
|
many: 4,
|
|
567
566
|
other: 5
|
|
568
|
-
},
|
|
567
|
+
}, N = {
|
|
569
568
|
select: (e) => e === 1 ? "one" : "other",
|
|
570
569
|
resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
|
|
571
|
-
},
|
|
570
|
+
}, ne = class {
|
|
572
571
|
constructor(e, t = {}) {
|
|
573
|
-
this.languageUtils = e, this.options = t, this.logger =
|
|
572
|
+
this.languageUtils = e, this.options = t, this.logger = C.create("pluralResolver"), this.pluralRulesCache = {};
|
|
574
573
|
}
|
|
575
574
|
clearCache() {
|
|
576
575
|
this.pluralRulesCache = {};
|
|
577
576
|
}
|
|
578
577
|
getRule(e, t = {}) {
|
|
579
|
-
let n =
|
|
578
|
+
let n = S(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
|
|
580
579
|
cleanedCode: n,
|
|
581
580
|
type: r
|
|
582
581
|
});
|
|
@@ -585,8 +584,8 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
585
584
|
try {
|
|
586
585
|
a = new Intl.PluralRules(n, { type: r });
|
|
587
586
|
} catch {
|
|
588
|
-
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"),
|
|
589
|
-
if (!e.match(/-|_/)) return
|
|
587
|
+
if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), N;
|
|
588
|
+
if (!e.match(/-|_/)) return N;
|
|
590
589
|
let n = this.languageUtils.getLanguagePartFromCode(e);
|
|
591
590
|
a = this.getRule(n, t);
|
|
592
591
|
}
|
|
@@ -601,23 +600,23 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
601
600
|
}
|
|
602
601
|
getSuffixes(e, t = {}) {
|
|
603
602
|
let n = this.getRule(e, t);
|
|
604
|
-
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) =>
|
|
603
|
+
return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => M[e] - M[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
|
|
605
604
|
}
|
|
606
605
|
getSuffix(e, t, n = {}) {
|
|
607
606
|
let r = this.getRule(e, n);
|
|
608
607
|
return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
|
|
609
608
|
}
|
|
610
|
-
},
|
|
611
|
-
let o =
|
|
612
|
-
return !o && a &&
|
|
613
|
-
},
|
|
609
|
+
}, P = (e, n, r, i = ".", a = !0) => {
|
|
610
|
+
let o = f(e, n, r);
|
|
611
|
+
return !o && a && t(r) && (o = x(e, r, i), o === void 0 && (o = x(n, r, i))), o;
|
|
612
|
+
}, F = (e) => e.replace(/\$/g, "$$$$"), re = class {
|
|
614
613
|
constructor(e = {}) {
|
|
615
|
-
this.logger =
|
|
614
|
+
this.logger = C.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
|
|
616
615
|
}
|
|
617
616
|
init(e = {}) {
|
|
618
617
|
e.interpolation ||= { escapeValue: !0 };
|
|
619
|
-
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped:
|
|
620
|
-
this.escape = t === void 0 ?
|
|
618
|
+
let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: h, nestingOptionsSeparator: _, maxReplaces: v, alwaysFormat: y } = e.interpolation;
|
|
619
|
+
this.escape = t === void 0 ? g : t, this.escapeValue = n === void 0 ? !0 : n, this.useRawValueToEscape = r === void 0 ? !1 : r, this.prefix = i ? m(i) : a || "{{", this.suffix = o ? m(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? m(d) : f || m("$t("), this.nestingSuffix = p ? m(p) : h || m(")"), this.nestingOptionsSeparator = _ || ",", this.maxReplaces = v || 1e3, this.alwaysFormat = y === void 0 ? !1 : y, this.resetRegExp();
|
|
621
620
|
}
|
|
622
621
|
reset() {
|
|
623
622
|
this.options && this.init(this.options);
|
|
@@ -626,53 +625,53 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
626
625
|
let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
|
|
627
626
|
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}`);
|
|
628
627
|
}
|
|
629
|
-
interpolate(e,
|
|
628
|
+
interpolate(e, n, i, a) {
|
|
630
629
|
let o, s, c, l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (e) => {
|
|
631
630
|
if (!e.includes(this.formatSeparator)) {
|
|
632
|
-
let
|
|
633
|
-
return this.alwaysFormat ? this.format(
|
|
631
|
+
let t = P(n, l, e, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
632
|
+
return this.alwaysFormat ? this.format(t, void 0, i, {
|
|
634
633
|
...a,
|
|
635
|
-
...
|
|
634
|
+
...n,
|
|
636
635
|
interpolationkey: e
|
|
637
|
-
}) :
|
|
636
|
+
}) : t;
|
|
638
637
|
}
|
|
639
|
-
let
|
|
640
|
-
return this.format(
|
|
638
|
+
let t = e.split(this.formatSeparator), r = t.shift().trim(), o = t.join(this.formatSeparator).trim();
|
|
639
|
+
return this.format(P(n, l, r, this.options.keySeparator, this.options.ignoreJSONStructure), o, i, {
|
|
641
640
|
...a,
|
|
642
|
-
...
|
|
643
|
-
interpolationkey:
|
|
641
|
+
...n,
|
|
642
|
+
interpolationkey: r
|
|
644
643
|
});
|
|
645
644
|
};
|
|
646
645
|
this.resetRegExp();
|
|
647
646
|
let d = a?.missingInterpolationHandler || this.options.missingInterpolationHandler, f = a?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : a.interpolation.skipOnVariables;
|
|
648
647
|
return [{
|
|
649
648
|
regex: this.regexpUnescape,
|
|
650
|
-
safeValue: (e) =>
|
|
649
|
+
safeValue: (e) => F(e)
|
|
651
650
|
}, {
|
|
652
651
|
regex: this.regexp,
|
|
653
|
-
safeValue: (e) => this.escapeValue ?
|
|
654
|
-
}].forEach((
|
|
655
|
-
for (c = 0; o =
|
|
656
|
-
let
|
|
657
|
-
if (s = u(
|
|
658
|
-
let
|
|
659
|
-
s = n
|
|
660
|
-
} else if (a && Object.prototype.hasOwnProperty.call(a,
|
|
652
|
+
safeValue: (e) => this.escapeValue ? F(this.escape(e)) : F(e)
|
|
653
|
+
}].forEach((n) => {
|
|
654
|
+
for (c = 0; o = n.regex.exec(e);) {
|
|
655
|
+
let i = o[1].trim();
|
|
656
|
+
if (s = u(i), s === void 0) if (typeof d == "function") {
|
|
657
|
+
let n = d(e, o, a);
|
|
658
|
+
s = t(n) ? n : "";
|
|
659
|
+
} else if (a && Object.prototype.hasOwnProperty.call(a, i)) s = "";
|
|
661
660
|
else if (f) {
|
|
662
661
|
s = o[0];
|
|
663
662
|
continue;
|
|
664
|
-
} else this.logger.warn(`missed to pass in variable ${
|
|
665
|
-
else !
|
|
666
|
-
let l =
|
|
667
|
-
if (e = e.replace(o[0], l), f ? (
|
|
663
|
+
} else this.logger.warn(`missed to pass in variable ${i} for interpolating ${e}`), s = "";
|
|
664
|
+
else !t(s) && !this.useRawValueToEscape && (s = r(s));
|
|
665
|
+
let l = n.safeValue(s);
|
|
666
|
+
if (e = e.replace(o[0], l), f ? (n.regex.lastIndex += s.length, n.regex.lastIndex -= o[0].length) : n.regex.lastIndex = 0, c++, c >= this.maxReplaces) break;
|
|
668
667
|
}
|
|
669
668
|
}), e;
|
|
670
669
|
}
|
|
671
|
-
nest(e,
|
|
670
|
+
nest(e, n, i = {}) {
|
|
672
671
|
let a, o, s, c = (e, t) => {
|
|
673
672
|
let n = this.nestingOptionsSeparator;
|
|
674
673
|
if (!e.includes(n)) return e;
|
|
675
|
-
let r = e.split(RegExp(`${
|
|
674
|
+
let r = e.split(RegExp(`${m(n)}[ ]*{`)), i = `{${r[1]}`;
|
|
676
675
|
e = r[0], i = this.interpolate(i, s);
|
|
677
676
|
let a = i.match(/'/g), o = i.match(/"/g);
|
|
678
677
|
((a?.length ?? 0) % 2 == 0 && !o || (o?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
|
|
@@ -688,17 +687,17 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
688
687
|
};
|
|
689
688
|
for (; a = this.nestingRegexp.exec(e);) {
|
|
690
689
|
let l = [];
|
|
691
|
-
s = { ...
|
|
690
|
+
s = { ...i }, s = s.replace && !t(s.replace) ? s.replace : s, s.applyPostProcessor = !1, delete s.defaultValue;
|
|
692
691
|
let u = /{.*}/.test(a[1]) ? a[1].lastIndexOf("}") + 1 : a[1].indexOf(this.formatSeparator);
|
|
693
|
-
if (u !== -1 && (l = a[1].slice(u).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), a[1] = a[1].slice(0, u)), o =
|
|
694
|
-
|
|
695
|
-
...
|
|
692
|
+
if (u !== -1 && (l = a[1].slice(u).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), a[1] = a[1].slice(0, u)), o = n(c.call(this, a[1].trim(), s), s), o && a[0] === e && !t(o)) return o;
|
|
693
|
+
t(o) || (o = r(o)), o ||= (this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`), ""), l.length && (o = l.reduce((e, t) => this.format(e, t, i.lng, {
|
|
694
|
+
...i,
|
|
696
695
|
interpolationkey: a[1].trim()
|
|
697
696
|
}), o.trim())), e = e.replace(a[0], o), this.regexp.lastIndex = 0;
|
|
698
697
|
}
|
|
699
698
|
return e;
|
|
700
699
|
}
|
|
701
|
-
},
|
|
700
|
+
}, ie = (e) => {
|
|
702
701
|
let t = e.toLowerCase().trim(), n = {};
|
|
703
702
|
if (e.includes("(")) {
|
|
704
703
|
let r = e.split("(");
|
|
@@ -715,7 +714,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
715
714
|
formatName: t,
|
|
716
715
|
formatOptions: n
|
|
717
716
|
};
|
|
718
|
-
},
|
|
717
|
+
}, ae = (e) => {
|
|
719
718
|
let t = {};
|
|
720
719
|
return (n, r, i) => {
|
|
721
720
|
let a = i;
|
|
@@ -724,15 +723,15 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
724
723
|
[i.interpolationkey]: void 0
|
|
725
724
|
});
|
|
726
725
|
let o = r + JSON.stringify(a), s = t[o];
|
|
727
|
-
return s || (s = e(
|
|
726
|
+
return s || (s = e(S(r), i), t[o] = s), s(n);
|
|
728
727
|
};
|
|
729
|
-
},
|
|
728
|
+
}, oe = (e) => (t, n, r) => e(S(n), r)(t), se = class {
|
|
730
729
|
constructor(e = {}) {
|
|
731
|
-
this.logger =
|
|
730
|
+
this.logger = C.create("formatter"), this.options = e, this.init(e);
|
|
732
731
|
}
|
|
733
732
|
init(e, t = { interpolation: {} }) {
|
|
734
733
|
this.formatSeparator = t.interpolation.formatSeparator || ",";
|
|
735
|
-
let n = t.cacheInBuiltFormats ?
|
|
734
|
+
let n = t.cacheInBuiltFormats ? ae : oe;
|
|
736
735
|
this.formats = {
|
|
737
736
|
number: n((e, t) => {
|
|
738
737
|
let n = new Intl.NumberFormat(e, { ...t });
|
|
@@ -763,7 +762,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
763
762
|
this.formats[e.toLowerCase().trim()] = t;
|
|
764
763
|
}
|
|
765
764
|
addCached(e, t) {
|
|
766
|
-
this.formats[e.toLowerCase().trim()] =
|
|
765
|
+
this.formats[e.toLowerCase().trim()] = ae(t);
|
|
767
766
|
}
|
|
768
767
|
format(e, t, n, r = {}) {
|
|
769
768
|
if (!t || e == null) return e;
|
|
@@ -773,7 +772,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
773
772
|
i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
|
|
774
773
|
}
|
|
775
774
|
return i.reduce((e, t) => {
|
|
776
|
-
let { formatName: i, formatOptions: a } =
|
|
775
|
+
let { formatName: i, formatOptions: a } = ie(t);
|
|
777
776
|
if (this.formats[i]) {
|
|
778
777
|
let t = e;
|
|
779
778
|
try {
|
|
@@ -791,11 +790,11 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
791
790
|
return e;
|
|
792
791
|
}, e);
|
|
793
792
|
}
|
|
794
|
-
},
|
|
793
|
+
}, ce = (e, t) => {
|
|
795
794
|
e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
|
|
796
|
-
},
|
|
795
|
+
}, le = class extends w {
|
|
797
796
|
constructor(e, t, n, r = {}) {
|
|
798
|
-
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger =
|
|
797
|
+
super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = C.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
|
|
799
798
|
}
|
|
800
799
|
queueLoad(e, t, n, r) {
|
|
801
800
|
let i = {}, a = {}, o = {}, s = {};
|
|
@@ -823,7 +822,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
823
822
|
t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
|
|
824
823
|
let o = {};
|
|
825
824
|
this.queue.forEach((n) => {
|
|
826
|
-
|
|
825
|
+
u(n.loaded, [i], a), ce(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
|
|
827
826
|
o[e] || (o[e] = {});
|
|
828
827
|
let t = n.loaded[e];
|
|
829
828
|
t.length && t.forEach((t) => {
|
|
@@ -870,10 +869,10 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
870
869
|
}
|
|
871
870
|
return s(e, t, o);
|
|
872
871
|
}
|
|
873
|
-
prepareLoading(e,
|
|
872
|
+
prepareLoading(e, n, r = {}, i) {
|
|
874
873
|
if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
|
|
875
|
-
|
|
876
|
-
let a = this.queueLoad(e,
|
|
874
|
+
t(e) && (e = this.languageUtils.toResolveHierarchy(e)), t(n) && (n = [n]);
|
|
875
|
+
let a = this.queueLoad(e, n, r, i);
|
|
877
876
|
if (!a.toLoad.length) return a.pending.length || i(), null;
|
|
878
877
|
a.toLoad.forEach((e) => {
|
|
879
878
|
this.loadOne(e);
|
|
@@ -913,7 +912,7 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
913
912
|
!e || !e[0] || this.store.addResource(e[0], t, n, r);
|
|
914
913
|
}
|
|
915
914
|
}
|
|
916
|
-
},
|
|
915
|
+
}, I = () => ({
|
|
917
916
|
debug: !1,
|
|
918
917
|
initAsync: !0,
|
|
919
918
|
ns: ["translation"],
|
|
@@ -946,14 +945,14 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
946
945
|
appendNamespaceToMissingKey: !1,
|
|
947
946
|
appendNamespaceToCIMode: !1,
|
|
948
947
|
overloadTranslationOptionHandler: (e) => {
|
|
949
|
-
let
|
|
950
|
-
if (typeof e[1] == "object" && (
|
|
951
|
-
let
|
|
952
|
-
Object.keys(
|
|
953
|
-
|
|
948
|
+
let n = {};
|
|
949
|
+
if (typeof e[1] == "object" && (n = e[1]), t(e[1]) && (n.defaultValue = e[1]), t(e[2]) && (n.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
|
|
950
|
+
let t = e[3] || e[2];
|
|
951
|
+
Object.keys(t).forEach((e) => {
|
|
952
|
+
n[e] = t[e];
|
|
954
953
|
});
|
|
955
954
|
}
|
|
956
|
-
return
|
|
955
|
+
return n;
|
|
957
956
|
},
|
|
958
957
|
interpolation: {
|
|
959
958
|
escapeValue: !0,
|
|
@@ -968,47 +967,47 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
968
967
|
skipOnVariables: !0
|
|
969
968
|
},
|
|
970
969
|
cacheInBuiltFormats: !0
|
|
971
|
-
}),
|
|
970
|
+
}), L = (e) => (t(e.ns) && (e.ns = [e.ns]), t(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), t(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs && !e.supportedLngs.includes("cimode") && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), e), R = () => {}, ue = (e) => {
|
|
972
971
|
Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
|
|
973
972
|
typeof e[t] == "function" && (e[t] = e[t].bind(e));
|
|
974
973
|
});
|
|
975
|
-
},
|
|
974
|
+
}, z = class e extends w {
|
|
976
975
|
constructor(e = {}, t) {
|
|
977
|
-
if (super(), this.options =
|
|
976
|
+
if (super(), this.options = L(e), this.services = {}, this.logger = C, this.modules = { external: [] }, ue(this), t && !this.isInitialized && !e.isClone) {
|
|
978
977
|
if (!this.options.initAsync) return this.init(e, t), this;
|
|
979
978
|
setTimeout(() => {
|
|
980
979
|
this.init(e, t);
|
|
981
980
|
}, 0);
|
|
982
981
|
}
|
|
983
982
|
}
|
|
984
|
-
init(e = {},
|
|
985
|
-
this.isInitializing = !0, typeof e == "function" && (
|
|
986
|
-
let i =
|
|
983
|
+
init(e = {}, r) {
|
|
984
|
+
this.isInitializing = !0, typeof e == "function" && (r = e, e = {}), e.defaultNS == null && e.ns && (t(e.ns) ? e.defaultNS = e.ns : e.ns.includes("translation") || (e.defaultNS = e.ns[0]));
|
|
985
|
+
let i = I();
|
|
987
986
|
this.options = {
|
|
988
987
|
...i,
|
|
989
988
|
...this.options,
|
|
990
|
-
...
|
|
989
|
+
...L(e)
|
|
991
990
|
}, this.options.interpolation = {
|
|
992
991
|
...i.interpolation,
|
|
993
992
|
...this.options.interpolation
|
|
994
993
|
}, 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);
|
|
995
994
|
let a = (e) => e ? typeof e == "function" ? new e() : e : null;
|
|
996
995
|
if (!this.options.isClone) {
|
|
997
|
-
this.modules.logger ?
|
|
996
|
+
this.modules.logger ? C.init(a(this.modules.logger), this.options) : C.init(null, this.options);
|
|
998
997
|
let e;
|
|
999
|
-
e = this.modules.formatter ? this.modules.formatter :
|
|
1000
|
-
let t = new
|
|
1001
|
-
this.store = new
|
|
998
|
+
e = this.modules.formatter ? this.modules.formatter : se;
|
|
999
|
+
let t = new j(this.options);
|
|
1000
|
+
this.store = new T(this.options.resources, this.options);
|
|
1002
1001
|
let n = this.services;
|
|
1003
|
-
n.logger =
|
|
1002
|
+
n.logger = C, n.resourceStore = this.store, n.languageUtils = t, n.pluralResolver = new ne(t, { prepend: this.options.pluralSeparator }), e && (n.formatter = a(e), n.formatter.init && n.formatter.init(n, this.options), this.options.interpolation.format = n.formatter.format.bind(n.formatter)), n.interpolator = new re(this.options), n.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, n.backendConnector = new le(a(this.modules.backend), n.resourceStore, n, this.options), n.backendConnector.on("*", (e, ...t) => {
|
|
1004
1003
|
this.emit(e, ...t);
|
|
1005
|
-
}), this.modules.languageDetector && (n.languageDetector = a(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = a(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new
|
|
1004
|
+
}), this.modules.languageDetector && (n.languageDetector = a(this.modules.languageDetector), n.languageDetector.init && n.languageDetector.init(n, this.options.detection, this.options)), this.modules.i18nFormat && (n.i18nFormat = a(this.modules.i18nFormat), n.i18nFormat.init && n.i18nFormat.init(this)), this.translator = new A(this.services, this.options), this.translator.on("*", (e, ...t) => {
|
|
1006
1005
|
this.emit(e, ...t);
|
|
1007
1006
|
}), this.modules.external.forEach((e) => {
|
|
1008
1007
|
e.init && e.init(this);
|
|
1009
1008
|
});
|
|
1010
1009
|
}
|
|
1011
|
-
if (this.format = this.options.interpolation.format,
|
|
1010
|
+
if (this.format = this.options.interpolation.format, r ||= R, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1012
1011
|
let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1013
1012
|
e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
|
|
1014
1013
|
}
|
|
@@ -1027,17 +1026,17 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1027
1026
|
].forEach((e) => {
|
|
1028
1027
|
this[e] = (...t) => (this.store[e](...t), this);
|
|
1029
1028
|
});
|
|
1030
|
-
let o =
|
|
1031
|
-
let e = (e,
|
|
1032
|
-
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(
|
|
1029
|
+
let o = n(), s = () => {
|
|
1030
|
+
let e = (e, t) => {
|
|
1031
|
+
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(t), r(e, t);
|
|
1033
1032
|
};
|
|
1034
1033
|
if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
|
|
1035
1034
|
this.changeLanguage(this.options.lng, e);
|
|
1036
1035
|
};
|
|
1037
1036
|
return this.options.resources || !this.options.initAsync ? s() : setTimeout(s, 0), o;
|
|
1038
1037
|
}
|
|
1039
|
-
loadResources(e,
|
|
1040
|
-
let r =
|
|
1038
|
+
loadResources(e, n = R) {
|
|
1039
|
+
let r = n, i = t(e) ? e : this.language;
|
|
1041
1040
|
if (typeof e == "function" && (r = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1042
1041
|
if (i?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return r();
|
|
1043
1042
|
let e = [], t = (t) => {
|
|
@@ -1050,16 +1049,16 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1050
1049
|
});
|
|
1051
1050
|
} else r(null);
|
|
1052
1051
|
}
|
|
1053
|
-
reloadResources(e, t,
|
|
1054
|
-
let i =
|
|
1055
|
-
return typeof e == "function" && (
|
|
1056
|
-
i.resolve(),
|
|
1052
|
+
reloadResources(e, t, r) {
|
|
1053
|
+
let i = n();
|
|
1054
|
+
return typeof e == "function" && (r = e, e = void 0), typeof t == "function" && (r = t, t = void 0), e ||= this.languages, t ||= this.options.ns, r ||= R, this.services.backendConnector.reload(e, t, (e) => {
|
|
1055
|
+
i.resolve(), r(e);
|
|
1057
1056
|
}), i;
|
|
1058
1057
|
}
|
|
1059
1058
|
use(e) {
|
|
1060
1059
|
if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1061
1060
|
if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1062
|
-
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" &&
|
|
1061
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && E.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1063
1062
|
}
|
|
1064
1063
|
setResolvedLanguage(e) {
|
|
1065
1064
|
if (!(!e || !this.languages) && !["cimode", "dev"].includes(e)) {
|
|
@@ -1073,24 +1072,24 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1073
1072
|
!this.resolvedLanguage && !this.languages.includes(e) && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
|
|
1074
1073
|
}
|
|
1075
1074
|
}
|
|
1076
|
-
changeLanguage(e,
|
|
1075
|
+
changeLanguage(e, r) {
|
|
1077
1076
|
this.isLanguageChangingTo = e;
|
|
1078
|
-
let i =
|
|
1077
|
+
let i = n();
|
|
1079
1078
|
this.emit("languageChanging", e);
|
|
1080
1079
|
let a = (e) => {
|
|
1081
1080
|
this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
|
|
1082
|
-
}, o = (
|
|
1083
|
-
|
|
1084
|
-
}, s = (
|
|
1085
|
-
!e && !
|
|
1086
|
-
let r = n
|
|
1081
|
+
}, o = (t, n) => {
|
|
1082
|
+
n ? this.isLanguageChangingTo === e && (a(n), this.translator.changeLanguage(n), this.isLanguageChangingTo = void 0, this.emit("languageChanged", n), this.logger.log("languageChanged", n)) : this.isLanguageChangingTo = void 0, i.resolve((...e) => this.t(...e)), r && r(t, (...e) => this.t(...e));
|
|
1083
|
+
}, s = (n) => {
|
|
1084
|
+
!e && !n && this.services.languageDetector && (n = []);
|
|
1085
|
+
let r = t(n) ? n : n && n[0], i = this.store.hasLanguageSomeTranslations(r) ? r : this.services.languageUtils.getBestMatchFromCodes(t(n) ? [n] : n);
|
|
1087
1086
|
i && (this.language || a(i), this.translator.language || this.translator.changeLanguage(i), this.services.languageDetector?.cacheUserLanguage?.(i)), this.loadResources(i, (e) => {
|
|
1088
1087
|
o(e, i);
|
|
1089
1088
|
});
|
|
1090
1089
|
};
|
|
1091
1090
|
return !e && this.services.languageDetector && !this.services.languageDetector.async ? s(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(s) : this.services.languageDetector.detect(s) : s(e), i;
|
|
1092
1091
|
}
|
|
1093
|
-
getFixedT(e,
|
|
1092
|
+
getFixedT(e, n, r) {
|
|
1094
1093
|
let i = (e, t, ...n) => {
|
|
1095
1094
|
let a;
|
|
1096
1095
|
a = typeof t == "object" ? { ...t } : this.options.overloadTranslationOptionHandler([e, t].concat(n)), a.lng = a.lng || i.lng, a.lngs = a.lngs || i.lngs, a.ns = a.ns || i.ns, a.keyPrefix !== "" && (a.keyPrefix = a.keyPrefix || r || i.keyPrefix);
|
|
@@ -1098,11 +1097,11 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1098
1097
|
...this.options,
|
|
1099
1098
|
...a
|
|
1100
1099
|
};
|
|
1101
|
-
typeof a.keyPrefix == "function" && (a.keyPrefix =
|
|
1100
|
+
typeof a.keyPrefix == "function" && (a.keyPrefix = O(a.keyPrefix, o));
|
|
1102
1101
|
let s = this.options.keySeparator || ".", c;
|
|
1103
|
-
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e =
|
|
1102
|
+
return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = O(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = O(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
|
|
1104
1103
|
};
|
|
1105
|
-
return
|
|
1104
|
+
return t(e) ? i.lng = e : i.lngs = e, i.ns = n, i.keyPrefix = r, i;
|
|
1106
1105
|
}
|
|
1107
1106
|
t(...e) {
|
|
1108
1107
|
return this.translator?.translate(...e);
|
|
@@ -1128,21 +1127,21 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1128
1127
|
}
|
|
1129
1128
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
|
|
1130
1129
|
}
|
|
1131
|
-
loadNamespaces(e,
|
|
1132
|
-
let i =
|
|
1133
|
-
return this.options.ns ? (
|
|
1130
|
+
loadNamespaces(e, r) {
|
|
1131
|
+
let i = n();
|
|
1132
|
+
return this.options.ns ? (t(e) && (e = [e]), e.forEach((e) => {
|
|
1134
1133
|
this.options.ns.includes(e) || this.options.ns.push(e);
|
|
1135
1134
|
}), this.loadResources((e) => {
|
|
1136
|
-
i.resolve(),
|
|
1137
|
-
}), i) : (
|
|
1135
|
+
i.resolve(), r && r(e);
|
|
1136
|
+
}), i) : (r && r(), Promise.resolve());
|
|
1138
1137
|
}
|
|
1139
|
-
loadLanguages(e,
|
|
1140
|
-
let i =
|
|
1141
|
-
|
|
1138
|
+
loadLanguages(e, r) {
|
|
1139
|
+
let i = n();
|
|
1140
|
+
t(e) && (e = [e]);
|
|
1142
1141
|
let a = this.options.preload || [], o = e.filter((e) => !a.includes(e) && this.services.languageUtils.isSupportedCode(e));
|
|
1143
1142
|
return o.length ? (this.options.preload = a.concat(o), this.loadResources((e) => {
|
|
1144
|
-
i.resolve(),
|
|
1145
|
-
}), i) : (
|
|
1143
|
+
i.resolve(), r && r(e);
|
|
1144
|
+
}), i) : (r && r(), Promise.resolve());
|
|
1146
1145
|
}
|
|
1147
1146
|
dir(e) {
|
|
1148
1147
|
if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
|
|
@@ -1153,14 +1152,14 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1153
1152
|
if (e && e.direction) return e.direction;
|
|
1154
1153
|
}
|
|
1155
1154
|
} catch {}
|
|
1156
|
-
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new
|
|
1155
|
+
let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new j(I());
|
|
1157
1156
|
return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.includes(n.getLanguagePartFromCode(e)) || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1158
1157
|
}
|
|
1159
1158
|
static createInstance(t = {}, n) {
|
|
1160
1159
|
let r = new e(t, n);
|
|
1161
1160
|
return r.createInstance = e.createInstance, r;
|
|
1162
1161
|
}
|
|
1163
|
-
cloneInstance(t = {}, n =
|
|
1162
|
+
cloneInstance(t = {}, n = R) {
|
|
1164
1163
|
let r = t.forkResourceStore;
|
|
1165
1164
|
r && delete t.forkResourceStore;
|
|
1166
1165
|
let i = {
|
|
@@ -1174,18 +1173,18 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1174
1173
|
"language"
|
|
1175
1174
|
].forEach((e) => {
|
|
1176
1175
|
a[e] = this[e];
|
|
1177
|
-
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new
|
|
1176
|
+
}), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new T(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
|
|
1178
1177
|
let e = {
|
|
1179
|
-
...
|
|
1178
|
+
...I().interpolation,
|
|
1180
1179
|
...this.options.interpolation,
|
|
1181
1180
|
...t.interpolation
|
|
1182
1181
|
}, n = {
|
|
1183
1182
|
...i,
|
|
1184
1183
|
interpolation: e
|
|
1185
1184
|
};
|
|
1186
|
-
a.services.interpolator = new
|
|
1185
|
+
a.services.interpolator = new re(n);
|
|
1187
1186
|
}
|
|
1188
|
-
return a.translator = new
|
|
1187
|
+
return a.translator = new A(a.services, i), a.translator.on("*", (e, ...t) => {
|
|
1189
1188
|
a.emit(e, ...t);
|
|
1190
1189
|
}), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
|
|
1191
1190
|
}
|
|
@@ -1199,69 +1198,69 @@ var A = (e) => !n(e) && typeof e != "boolean" && typeof e != "number", j = class
|
|
|
1199
1198
|
};
|
|
1200
1199
|
}
|
|
1201
1200
|
}.createInstance();
|
|
1202
|
-
|
|
1201
|
+
z.createInstance, z.dir, z.init, z.loadResources, z.reloadResources, z.use, z.changeLanguage, z.getFixedT, z.t, z.exists, z.setDefaultNamespace, z.hasLoadedNamespace, z.loadNamespaces, z.loadLanguages;
|
|
1203
1202
|
//#endregion
|
|
1204
1203
|
//#region node_modules/@babel/runtime/helpers/esm/classCallCheck.js
|
|
1205
|
-
function
|
|
1204
|
+
function B(e, t) {
|
|
1206
1205
|
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
1207
1206
|
}
|
|
1208
1207
|
//#endregion
|
|
1209
1208
|
//#region node_modules/@babel/runtime/helpers/esm/typeof.js
|
|
1210
|
-
function
|
|
1209
|
+
function V(e) {
|
|
1211
1210
|
"@babel/helpers - typeof";
|
|
1212
|
-
return
|
|
1211
|
+
return V = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1213
1212
|
return typeof e;
|
|
1214
1213
|
} : function(e) {
|
|
1215
1214
|
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1216
|
-
},
|
|
1215
|
+
}, V(e);
|
|
1217
1216
|
}
|
|
1218
1217
|
//#endregion
|
|
1219
1218
|
//#region node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
1220
|
-
function
|
|
1221
|
-
if (
|
|
1219
|
+
function de(e, t) {
|
|
1220
|
+
if (V(e) != "object" || !e) return e;
|
|
1222
1221
|
var n = e[Symbol.toPrimitive];
|
|
1223
1222
|
if (n !== void 0) {
|
|
1224
1223
|
var r = n.call(e, t || "default");
|
|
1225
|
-
if (
|
|
1224
|
+
if (V(r) != "object") return r;
|
|
1226
1225
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
1227
1226
|
}
|
|
1228
1227
|
return (t === "string" ? String : Number)(e);
|
|
1229
1228
|
}
|
|
1230
1229
|
//#endregion
|
|
1231
1230
|
//#region node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
1232
|
-
function
|
|
1233
|
-
var t =
|
|
1234
|
-
return
|
|
1231
|
+
function H(e) {
|
|
1232
|
+
var t = de(e, "string");
|
|
1233
|
+
return V(t) == "symbol" ? t : t + "";
|
|
1235
1234
|
}
|
|
1236
1235
|
//#endregion
|
|
1237
1236
|
//#region node_modules/@babel/runtime/helpers/esm/createClass.js
|
|
1238
|
-
function
|
|
1237
|
+
function U(e, t) {
|
|
1239
1238
|
for (var n = 0; n < t.length; n++) {
|
|
1240
1239
|
var r = t[n];
|
|
1241
|
-
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e,
|
|
1240
|
+
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, H(r.key), r);
|
|
1242
1241
|
}
|
|
1243
1242
|
}
|
|
1244
|
-
function
|
|
1245
|
-
return t &&
|
|
1243
|
+
function W(e, t, n) {
|
|
1244
|
+
return t && U(e.prototype, t), n && U(e, n), Object.defineProperty(e, "prototype", { writable: !1 }), e;
|
|
1246
1245
|
}
|
|
1247
1246
|
//#endregion
|
|
1248
1247
|
//#region node_modules/i18next-chained-backend/dist/esm/index.js
|
|
1249
|
-
var
|
|
1250
|
-
function
|
|
1251
|
-
return
|
|
1248
|
+
var G = [], fe = G.forEach, pe = G.slice;
|
|
1249
|
+
function me(e) {
|
|
1250
|
+
return fe.call(pe.call(arguments, 1), function(t) {
|
|
1252
1251
|
if (t) for (var n in t) e[n] === void 0 && (e[n] = t[n]);
|
|
1253
1252
|
}), e;
|
|
1254
1253
|
}
|
|
1255
|
-
function
|
|
1254
|
+
function he(e) {
|
|
1256
1255
|
return e ? typeof e == "function" ? new e() : e : null;
|
|
1257
1256
|
}
|
|
1258
|
-
function
|
|
1257
|
+
function ge() {
|
|
1259
1258
|
return {
|
|
1260
1259
|
handleEmptyResourcesAsFailed: !0,
|
|
1261
1260
|
cacheHitMode: "none"
|
|
1262
1261
|
};
|
|
1263
1262
|
}
|
|
1264
|
-
function
|
|
1263
|
+
function K(e, t, n, r) {
|
|
1265
1264
|
var i = e.read.bind(e);
|
|
1266
1265
|
if (i.length === 2) {
|
|
1267
1266
|
try {
|
|
@@ -1276,18 +1275,18 @@ function be(e, t, n, r) {
|
|
|
1276
1275
|
}
|
|
1277
1276
|
i(t, n, r);
|
|
1278
1277
|
}
|
|
1279
|
-
var
|
|
1278
|
+
var q = /* @__PURE__ */ function() {
|
|
1280
1279
|
function e(t) {
|
|
1281
1280
|
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1282
|
-
|
|
1281
|
+
B(this, e), this.backends = [], this.type = "backend", this.allOptions = r, this.init(t, n);
|
|
1283
1282
|
}
|
|
1284
|
-
return
|
|
1283
|
+
return W(e, [
|
|
1285
1284
|
{
|
|
1286
1285
|
key: "init",
|
|
1287
1286
|
value: function(e) {
|
|
1288
1287
|
var t = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1289
|
-
this.services = e, this.options =
|
|
1290
|
-
t.backends[i] = t.backends[i] ||
|
|
1288
|
+
this.services = e, this.options = me(n, this.options || {}, ge()), this.allOptions = r, this.options.backends && this.options.backends.length > 1 && (this.allOptions.saveMissing || this.allOptions.updateMissing) && this.services && this.services.logger && this.services.logger.warn("i18next-chained-backend: Using multiple backends in combination with saveMissing/updateMissing is not recommended, as it may trigger based on stale data."), this.options.backends && this.options.backends.forEach(function(n, i) {
|
|
1289
|
+
t.backends[i] = t.backends[i] || he(n), t.backends[i].init(e, t.options.backendOptions && t.options.backendOptions[i] || {}, r);
|
|
1291
1290
|
}), this.services && this.options.reloadInterval && setInterval(function() {
|
|
1292
1291
|
return t.reload();
|
|
1293
1292
|
}, this.options.reloadInterval);
|
|
@@ -1299,12 +1298,12 @@ var xe = /* @__PURE__ */ function() {
|
|
|
1299
1298
|
var r = this, i = this.backends.length, a = function(s) {
|
|
1300
1299
|
if (s >= i) return n(Error("non of the backend loaded data", !0));
|
|
1301
1300
|
var c = s === i - 1, l = r.options.handleEmptyResourcesAsFailed && !c ? 0 : -1, u = r.backends[s];
|
|
1302
|
-
u.read ?
|
|
1301
|
+
u.read ? K(u, e, t, function(i, c, d) {
|
|
1303
1302
|
if (!i && c && Object.keys(c).length > l) {
|
|
1304
1303
|
if (n(null, c, s), o(s - 1, c), u.save && r.options.cacheHitMode && ["refresh", "refreshAndUpdateStore"].indexOf(r.options.cacheHitMode) > -1) {
|
|
1305
1304
|
if (d && r.options.refreshExpirationTime && d + r.options.refreshExpirationTime > Date.now()) return;
|
|
1306
1305
|
var f = r.backends[s + 1];
|
|
1307
|
-
f && f.read &&
|
|
1306
|
+
f && f.read && K(f, e, t, function(n, i) {
|
|
1308
1307
|
n || i && (Object.keys(i).length <= l || (o(s, i), r.options.cacheHitMode === "refreshAndUpdateStore" && r.services && r.services.resourceStore && r.services.resourceStore.addResourceBundle(e, t, i)));
|
|
1309
1308
|
});
|
|
1310
1309
|
}
|
|
@@ -1366,109 +1365,81 @@ var xe = /* @__PURE__ */ function() {
|
|
|
1366
1365
|
}
|
|
1367
1366
|
]);
|
|
1368
1367
|
}();
|
|
1369
|
-
|
|
1368
|
+
q.type = "backend";
|
|
1370
1369
|
//#endregion
|
|
1371
|
-
//#region node_modules/i18next-http-backend/esm/
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
Se.forEach, Se.slice;
|
|
1382
|
-
function Ce() {
|
|
1383
|
-
return typeof XMLHttpRequest == "function" || (typeof XMLHttpRequest > "u" ? "undefined" : W(XMLHttpRequest)) === "object";
|
|
1370
|
+
//#region node_modules/i18next-http-backend/esm/index.js
|
|
1371
|
+
var _e = [];
|
|
1372
|
+
_e.forEach, _e.slice;
|
|
1373
|
+
var ve = [
|
|
1374
|
+
"__proto__",
|
|
1375
|
+
"constructor",
|
|
1376
|
+
"prototype"
|
|
1377
|
+
];
|
|
1378
|
+
function ye(e) {
|
|
1379
|
+
return !(typeof e != "string" || e.length === 0 || e.length > 128 || ve.indexOf(e) > -1 || e.indexOf("..") > -1 || e.indexOf("\\") > -1 || /[?#%\s@]/.test(e) || /[\x00-\x1F\x7F]/.test(e));
|
|
1384
1380
|
}
|
|
1385
|
-
function
|
|
1386
|
-
return
|
|
1381
|
+
function be(e) {
|
|
1382
|
+
return !(!ye(e) || e.indexOf("/") > -1);
|
|
1387
1383
|
}
|
|
1388
|
-
function
|
|
1389
|
-
return
|
|
1384
|
+
function xe(e) {
|
|
1385
|
+
return ye(e);
|
|
1390
1386
|
}
|
|
1391
|
-
var
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1387
|
+
var Se = {
|
|
1388
|
+
lng: be,
|
|
1389
|
+
ns: xe
|
|
1390
|
+
};
|
|
1391
|
+
function J(e) {
|
|
1392
|
+
return typeof e == "string" ? e.replace(/[\r\n\x00-\x1F\x7F]/g, " ") : e;
|
|
1396
1393
|
}
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
1405
|
-
})), n.push.apply(n, r);
|
|
1394
|
+
function Ce(e) {
|
|
1395
|
+
if (typeof e != "string" || e.length === 0) return e;
|
|
1396
|
+
try {
|
|
1397
|
+
let t = new URL(e);
|
|
1398
|
+
return t.username || t.password ? (t.username = "", t.password = "", t.toString()) : e;
|
|
1399
|
+
} catch {
|
|
1400
|
+
return e.replace(/(\/\/)[^/@\s]+@/g, "$1");
|
|
1406
1401
|
}
|
|
1407
|
-
return n;
|
|
1408
1402
|
}
|
|
1409
|
-
function
|
|
1410
|
-
|
|
1411
|
-
var n = arguments[t] == null ? {} : arguments[t];
|
|
1412
|
-
t % 2 ? Oe(Object(n), !0).forEach(function(t) {
|
|
1413
|
-
Ae(e, t, n[t]);
|
|
1414
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Oe(Object(n)).forEach(function(t) {
|
|
1415
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
1416
|
-
});
|
|
1417
|
-
}
|
|
1418
|
-
return e;
|
|
1403
|
+
function we() {
|
|
1404
|
+
return typeof XMLHttpRequest == "function" || typeof XMLHttpRequest == "object";
|
|
1419
1405
|
}
|
|
1420
|
-
function
|
|
1421
|
-
return
|
|
1422
|
-
value: n,
|
|
1423
|
-
enumerable: !0,
|
|
1424
|
-
configurable: !0,
|
|
1425
|
-
writable: !0
|
|
1426
|
-
}) : e[t] = n, e;
|
|
1406
|
+
function Te(e) {
|
|
1407
|
+
return !!e && typeof e.then == "function";
|
|
1427
1408
|
}
|
|
1428
|
-
function
|
|
1429
|
-
|
|
1430
|
-
return G(t) == "symbol" ? t : t + "";
|
|
1409
|
+
function Ee(e) {
|
|
1410
|
+
return Te(e) ? e : Promise.resolve(e);
|
|
1431
1411
|
}
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
return G = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
|
|
1445
|
-
return typeof e;
|
|
1446
|
-
} : function(e) {
|
|
1447
|
-
return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
1448
|
-
}, G(e);
|
|
1412
|
+
var De = /\{\{(.+?)\}\}/g;
|
|
1413
|
+
function Oe(e, t) {
|
|
1414
|
+
let n = !1, r = e.replace(De, (e, r) => {
|
|
1415
|
+
let i = r.trim();
|
|
1416
|
+
if (ve.indexOf(i) > -1) return e;
|
|
1417
|
+
let a = t[i];
|
|
1418
|
+
if (a == null) return e;
|
|
1419
|
+
let o = Se[i] || be, s = String(a).split("+");
|
|
1420
|
+
for (let t of s) if (!o(t)) return n = !0, e;
|
|
1421
|
+
return s.join("+");
|
|
1422
|
+
});
|
|
1423
|
+
return n ? null : r;
|
|
1449
1424
|
}
|
|
1450
|
-
var
|
|
1451
|
-
typeof
|
|
1452
|
-
var
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
var Y = function(e, t) {
|
|
1461
|
-
if (t && G(t) === "object") {
|
|
1462
|
-
var n = "";
|
|
1463
|
-
for (var r in t) n += "&" + encodeURIComponent(r) + "=" + encodeURIComponent(t[r]);
|
|
1425
|
+
var Y = typeof globalThis < "u" ? globalThis : typeof global < "u" ? global : typeof window < "u" ? window : void 0, X;
|
|
1426
|
+
typeof fetch == "function" ? X = fetch : Y && typeof Y.fetch == "function" && (X = Y.fetch);
|
|
1427
|
+
var ke = we() && Y ? Y.XMLHttpRequest : void 0, Ae = typeof ActiveXObject == "function" && Y ? Y.ActiveXObject : void 0, je = [
|
|
1428
|
+
"__proto__",
|
|
1429
|
+
"constructor",
|
|
1430
|
+
"prototype"
|
|
1431
|
+
], Z = (e, t) => {
|
|
1432
|
+
if (t && typeof t == "object") {
|
|
1433
|
+
let n = "";
|
|
1434
|
+
for (let e of Object.keys(t)) je.indexOf(e) > -1 || (n += "&" + encodeURIComponent(e) + "=" + encodeURIComponent(t[e]));
|
|
1464
1435
|
if (!n) return e;
|
|
1465
1436
|
e = e + (e.indexOf("?") === -1 ? "?" : "&") + n.slice(1);
|
|
1466
1437
|
}
|
|
1467
1438
|
return e;
|
|
1468
|
-
},
|
|
1469
|
-
|
|
1439
|
+
}, Me = (e, t, n, r) => {
|
|
1440
|
+
let i = (e) => {
|
|
1470
1441
|
if (!e.ok) return n(e.statusText || "Error", { status: e.status });
|
|
1471
|
-
e.text().then(
|
|
1442
|
+
e.text().then((t) => {
|
|
1472
1443
|
n(null, {
|
|
1473
1444
|
status: e.status,
|
|
1474
1445
|
data: t
|
|
@@ -1476,42 +1447,43 @@ var Y = function(e, t) {
|
|
|
1476
1447
|
}).catch(n);
|
|
1477
1448
|
};
|
|
1478
1449
|
if (r) {
|
|
1479
|
-
|
|
1450
|
+
let a = r(e, t);
|
|
1480
1451
|
if (a instanceof Promise) {
|
|
1481
1452
|
a.then(i).catch(n);
|
|
1482
1453
|
return;
|
|
1483
1454
|
}
|
|
1484
1455
|
}
|
|
1485
|
-
typeof fetch == "function" ? fetch(e, t).then(i).catch(n) :
|
|
1486
|
-
},
|
|
1487
|
-
e.queryStringParams && (t =
|
|
1488
|
-
|
|
1456
|
+
typeof fetch == "function" ? fetch(e, t).then(i).catch(n) : X(e, t).then(i).catch(n);
|
|
1457
|
+
}, Ne = (e, t, n, r) => {
|
|
1458
|
+
e.queryStringParams && (t = Z(t, e.queryStringParams));
|
|
1459
|
+
let i = { ...typeof e.customHeaders == "function" ? e.customHeaders() : e.customHeaders };
|
|
1489
1460
|
typeof window > "u" && typeof global < "u" && global.process !== void 0 && global.process.versions && global.process.versions.node && (i["User-Agent"] = `i18next-http-backend (node/${global.process.version}; ${global.process.platform} ${global.process.arch})`), n && (i["Content-Type"] = "application/json");
|
|
1490
|
-
|
|
1461
|
+
let a = typeof e.requestOptions == "function" ? e.requestOptions(n) : e.requestOptions, o = {
|
|
1491
1462
|
method: n ? "POST" : "GET",
|
|
1492
1463
|
body: n ? e.stringify(n) : void 0,
|
|
1493
|
-
headers: i
|
|
1494
|
-
|
|
1464
|
+
headers: i,
|
|
1465
|
+
...e._omitFetchOptions ? {} : a
|
|
1466
|
+
}, s = typeof e.alternateFetch == "function" && e.alternateFetch.length >= 1 ? e.alternateFetch : void 0;
|
|
1495
1467
|
try {
|
|
1496
|
-
|
|
1497
|
-
} catch (
|
|
1498
|
-
if (!a || Object.keys(a).length === 0 || !
|
|
1468
|
+
Me(t, o, r, s);
|
|
1469
|
+
} catch (n) {
|
|
1470
|
+
if (!a || Object.keys(a).length === 0 || !n.message || n.message.indexOf("not implemented") < 0) return r(n);
|
|
1499
1471
|
try {
|
|
1500
|
-
Object.keys(a).forEach(
|
|
1472
|
+
Object.keys(a).forEach((e) => {
|
|
1501
1473
|
delete o[e];
|
|
1502
|
-
}),
|
|
1474
|
+
}), Me(t, o, r, s), e._omitFetchOptions = !0;
|
|
1503
1475
|
} catch (e) {
|
|
1504
1476
|
r(e);
|
|
1505
1477
|
}
|
|
1506
1478
|
}
|
|
1507
|
-
},
|
|
1508
|
-
n &&
|
|
1479
|
+
}, Pe = (e, t, n, r) => {
|
|
1480
|
+
n && typeof n == "object" && (n = Z("", n).slice(1)), e.queryStringParams && (t = Z(t, e.queryStringParams));
|
|
1509
1481
|
try {
|
|
1510
|
-
|
|
1482
|
+
let i = ke ? new ke() : new Ae("MSXML2.XMLHTTP.3.0");
|
|
1511
1483
|
i.open(n ? "POST" : "GET", t, 1), e.crossDomain || i.setRequestHeader("X-Requested-With", "XMLHttpRequest"), i.withCredentials = !!e.withCredentials, n && i.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), i.overrideMimeType && i.overrideMimeType("application/json");
|
|
1512
|
-
|
|
1513
|
-
if (a = typeof a == "function" ? a() : a, a) for (
|
|
1514
|
-
i.onreadystatechange =
|
|
1484
|
+
let a = e.customHeaders;
|
|
1485
|
+
if (a = typeof a == "function" ? a() : a, a) for (let e of Object.keys(a)) je.indexOf(e) > -1 || i.setRequestHeader(e, a[e]);
|
|
1486
|
+
i.onreadystatechange = () => {
|
|
1515
1487
|
i.readyState > 3 && r(i.status >= 400 ? i.statusText : null, {
|
|
1516
1488
|
status: i.status,
|
|
1517
1489
|
data: i.responseText
|
|
@@ -1520,225 +1492,131 @@ var Y = function(e, t) {
|
|
|
1520
1492
|
} catch (e) {
|
|
1521
1493
|
console && console.log(e);
|
|
1522
1494
|
}
|
|
1523
|
-
},
|
|
1524
|
-
if (typeof n == "function" && (r = n, n = void 0), r ||=
|
|
1525
|
-
if (
|
|
1495
|
+
}, Fe = (e, t, n, r) => {
|
|
1496
|
+
if (typeof n == "function" && (r = n, n = void 0), r ||= (() => {}), X && t.indexOf("file:") !== 0) return Ne(e, t, n, r);
|
|
1497
|
+
if (we() || typeof ActiveXObject == "function") return Pe(e, t, n, r);
|
|
1526
1498
|
r(/* @__PURE__ */ Error("No fetch and no xhr implementation found!"));
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
},
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1499
|
+
}, Ie = () => ({
|
|
1500
|
+
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
1501
|
+
addPath: "/locales/add/{{lng}}/{{ns}}",
|
|
1502
|
+
parse: (e) => JSON.parse(e),
|
|
1503
|
+
stringify: JSON.stringify,
|
|
1504
|
+
parsePayload: (e, t, n) => ({ [t]: n || "" }),
|
|
1505
|
+
parseLoadPayload: (e, t) => void 0,
|
|
1506
|
+
request: Fe,
|
|
1507
|
+
reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
|
|
1508
|
+
customHeaders: {},
|
|
1509
|
+
queryStringParams: {},
|
|
1510
|
+
crossDomain: !1,
|
|
1511
|
+
withCredentials: !1,
|
|
1512
|
+
overrideMimeType: !1,
|
|
1513
|
+
requestOptions: {
|
|
1514
|
+
mode: "cors",
|
|
1515
|
+
credentials: "same-origin",
|
|
1516
|
+
cache: "default"
|
|
1517
|
+
}
|
|
1518
|
+
}), Le = class {
|
|
1519
|
+
constructor(e, t = {}, n = {}) {
|
|
1520
|
+
this.services = e, this.options = t, this.allOptions = n, this.type = "backend", this.init(e, t, n);
|
|
1521
|
+
}
|
|
1522
|
+
init(e, t = {}, n = {}) {
|
|
1523
|
+
if (this.services = e, this.options = {
|
|
1524
|
+
...Ie(),
|
|
1525
|
+
...this.options || {},
|
|
1526
|
+
...t
|
|
1527
|
+
}, this.allOptions = n, this.services && this.options.reloadInterval) {
|
|
1528
|
+
let e = setInterval(() => this.reload(), this.options.reloadInterval);
|
|
1529
|
+
typeof e == "object" && typeof e.unref == "function" && e.unref();
|
|
1530
|
+
}
|
|
1545
1531
|
}
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
function Z(e) {
|
|
1549
|
-
for (var t = 1; t < arguments.length; t++) {
|
|
1550
|
-
var n = arguments[t] == null ? {} : arguments[t];
|
|
1551
|
-
t % 2 ? Re(Object(n), !0).forEach(function(t) {
|
|
1552
|
-
He(e, t, n[t]);
|
|
1553
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : Re(Object(n)).forEach(function(t) {
|
|
1554
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
1555
|
-
});
|
|
1532
|
+
readMulti(e, t, n) {
|
|
1533
|
+
this._readAny(e, e, t, t, n);
|
|
1556
1534
|
}
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
function ze(e, t) {
|
|
1560
|
-
if (!(e instanceof t)) throw TypeError("Cannot call a class as a function");
|
|
1561
|
-
}
|
|
1562
|
-
function Be(e, t) {
|
|
1563
|
-
for (var n = 0; n < t.length; n++) {
|
|
1564
|
-
var r = t[n];
|
|
1565
|
-
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0), Object.defineProperty(e, Q(r.key), r);
|
|
1535
|
+
read(e, t, n) {
|
|
1536
|
+
this._readAny([e], e, [t], t, n);
|
|
1566
1537
|
}
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
}
|
|
1579
|
-
function Q(e) {
|
|
1580
|
-
var t = Ue(e, "string");
|
|
1581
|
-
return X(t) == "symbol" ? t : t + "";
|
|
1582
|
-
}
|
|
1583
|
-
function Ue(e, t) {
|
|
1584
|
-
if (X(e) != "object" || !e) return e;
|
|
1585
|
-
var n = e[Symbol.toPrimitive];
|
|
1586
|
-
if (n !== void 0) {
|
|
1587
|
-
var r = n.call(e, t || "default");
|
|
1588
|
-
if (X(r) != "object") return r;
|
|
1589
|
-
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
1590
|
-
}
|
|
1591
|
-
return (t === "string" ? String : Number)(e);
|
|
1592
|
-
}
|
|
1593
|
-
var We = function() {
|
|
1594
|
-
return {
|
|
1595
|
-
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
1596
|
-
addPath: "/locales/add/{{lng}}/{{ns}}",
|
|
1597
|
-
parse: function(e) {
|
|
1598
|
-
return JSON.parse(e);
|
|
1599
|
-
},
|
|
1600
|
-
stringify: JSON.stringify,
|
|
1601
|
-
parsePayload: function(e, t, n) {
|
|
1602
|
-
return He({}, t, n || "");
|
|
1603
|
-
},
|
|
1604
|
-
parseLoadPayload: function(e, t) {},
|
|
1605
|
-
request: Le,
|
|
1606
|
-
reloadInterval: typeof window < "u" ? !1 : 3600 * 1e3,
|
|
1607
|
-
customHeaders: {},
|
|
1608
|
-
queryStringParams: {},
|
|
1609
|
-
crossDomain: !1,
|
|
1610
|
-
withCredentials: !1,
|
|
1611
|
-
overrideMimeType: !1,
|
|
1612
|
-
requestOptions: {
|
|
1613
|
-
mode: "cors",
|
|
1614
|
-
credentials: "same-origin",
|
|
1615
|
-
cache: "default"
|
|
1616
|
-
}
|
|
1617
|
-
};
|
|
1618
|
-
}, Ge = function() {
|
|
1619
|
-
function e(t) {
|
|
1620
|
-
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1621
|
-
ze(this, e), this.services = t, this.options = n, this.allOptions = r, this.type = "backend", this.init(t, n, r);
|
|
1622
|
-
}
|
|
1623
|
-
return Ve(e, [
|
|
1624
|
-
{
|
|
1625
|
-
key: "init",
|
|
1626
|
-
value: function(e) {
|
|
1627
|
-
var t = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
1628
|
-
if (this.services = e, this.options = Z(Z(Z({}, We()), this.options || {}), n), this.allOptions = r, this.services && this.options.reloadInterval) {
|
|
1629
|
-
var i = setInterval(function() {
|
|
1630
|
-
return t.reload();
|
|
1631
|
-
}, this.options.reloadInterval);
|
|
1632
|
-
X(i) === "object" && typeof i.unref == "function" && i.unref();
|
|
1633
|
-
}
|
|
1538
|
+
_readAny(e, t, n, r, i) {
|
|
1539
|
+
let a = this.options.loadPath;
|
|
1540
|
+
typeof this.options.loadPath == "function" && (a = this.options.loadPath(e, n)), a = Ee(a), a.then((a) => {
|
|
1541
|
+
if (!a) return i(null, {});
|
|
1542
|
+
let o = Oe(a, {
|
|
1543
|
+
lng: e.join("+"),
|
|
1544
|
+
ns: n.join("+")
|
|
1545
|
+
});
|
|
1546
|
+
if (o == null) {
|
|
1547
|
+
let t = e.map(J).join(", "), r = n.map(J).join(", ");
|
|
1548
|
+
return i(/* @__PURE__ */ Error("i18next-http-backend: unsafe lng/ns value — refusing to build request URL for languages=[" + t + "] namespaces=[" + r + "]"), !1);
|
|
1634
1549
|
}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1550
|
+
this.loadUrl(o, i, t, r);
|
|
1551
|
+
});
|
|
1552
|
+
}
|
|
1553
|
+
loadUrl(e, t, n, r) {
|
|
1554
|
+
let i = typeof n == "string" ? [n] : n, a = typeof r == "string" ? [r] : r, o = this.options.parseLoadPayload(i, a), s = J(Ce(e));
|
|
1555
|
+
this.options.request(this.options, e, o, (e, i) => {
|
|
1556
|
+
if (i && (i.status >= 500 && i.status < 600 || !i.status)) return t("failed loading " + s + "; status code: " + i.status, !0);
|
|
1557
|
+
if (i && i.status >= 400 && i.status < 500) return t("failed loading " + s + "; status code: " + i.status, !1);
|
|
1558
|
+
if (!i && e && e.message) {
|
|
1559
|
+
let n = e.message.toLowerCase();
|
|
1560
|
+
if ([
|
|
1561
|
+
"failed",
|
|
1562
|
+
"fetch",
|
|
1563
|
+
"network",
|
|
1564
|
+
"load"
|
|
1565
|
+
].find((e) => n.indexOf(e) > -1)) return t("failed loading " + s + ": " + J(e.message), !0);
|
|
1640
1566
|
}
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1567
|
+
if (e) return t(e, !1);
|
|
1568
|
+
let a, o;
|
|
1569
|
+
try {
|
|
1570
|
+
a = typeof i.data == "string" ? this.options.parse(i.data, n, r) : i.data;
|
|
1571
|
+
} catch {
|
|
1572
|
+
o = "failed parsing " + s + " to json";
|
|
1646
1573
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1574
|
+
if (o) return t(o, !1);
|
|
1575
|
+
t(null, a);
|
|
1576
|
+
});
|
|
1577
|
+
}
|
|
1578
|
+
create(e, t, n, r, i) {
|
|
1579
|
+
if (!this.options.addPath) return;
|
|
1580
|
+
typeof e == "string" && (e = [e]);
|
|
1581
|
+
let a = this.options.parsePayload(t, n, r), o = 0, s = [], c = [];
|
|
1582
|
+
e.forEach((n) => {
|
|
1583
|
+
let r = this.options.addPath;
|
|
1584
|
+
typeof this.options.addPath == "function" && (r = this.options.addPath(n, t));
|
|
1585
|
+
let l = Oe(r, {
|
|
1586
|
+
lng: n,
|
|
1587
|
+
ns: t
|
|
1588
|
+
});
|
|
1589
|
+
if (l == null) {
|
|
1590
|
+
o += 1, i && o === e.length && i(s, c);
|
|
1591
|
+
return;
|
|
1660
1592
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
})) return t("failed loading " + e + ": " + a.message, !0);
|
|
1679
|
-
}
|
|
1680
|
-
if (a) return t(a, !1);
|
|
1681
|
-
var c, l;
|
|
1682
|
-
try {
|
|
1683
|
-
c = typeof o.data == "string" ? i.options.parse(o.data, n, r) : o.data;
|
|
1684
|
-
} catch {
|
|
1685
|
-
l = "failed parsing " + e + " to json";
|
|
1686
|
-
}
|
|
1687
|
-
if (l) return t(l, !1);
|
|
1688
|
-
t(null, c);
|
|
1593
|
+
this.options.request(this.options, l, a, (t, n) => {
|
|
1594
|
+
o += 1, s.push(t), c.push(n), o === e.length && typeof i == "function" && i(s, c);
|
|
1595
|
+
});
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
reload() {
|
|
1599
|
+
let { backendConnector: e, languageUtils: t, logger: n } = this.services, r = e.language;
|
|
1600
|
+
if (r && r.toLowerCase() === "cimode") return;
|
|
1601
|
+
let i = [], a = (e) => {
|
|
1602
|
+
t.toResolveHierarchy(e).forEach((e) => {
|
|
1603
|
+
i.indexOf(e) < 0 && i.push(e);
|
|
1604
|
+
});
|
|
1605
|
+
};
|
|
1606
|
+
a(r), this.allOptions.preload && this.allOptions.preload.forEach((e) => a(e)), i.forEach((t) => {
|
|
1607
|
+
this.allOptions.ns.forEach((r) => {
|
|
1608
|
+
e.read(t, r, "read", null, null, (i, a) => {
|
|
1609
|
+
i && n.warn(`loading namespace ${r} for language ${t} failed`, i), !i && a && n.log(`loaded namespace ${r} for language ${t}`, a), e.loaded(`${t}|${r}`, i, a);
|
|
1689
1610
|
});
|
|
1690
|
-
}
|
|
1691
|
-
}
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
var a = this;
|
|
1696
|
-
if (this.options.addPath) {
|
|
1697
|
-
typeof e == "string" && (e = [e]);
|
|
1698
|
-
var o = this.options.parsePayload(t, n, r), s = 0, c = [], l = [];
|
|
1699
|
-
e.forEach(function(n) {
|
|
1700
|
-
var r = a.options.addPath;
|
|
1701
|
-
typeof a.options.addPath == "function" && (r = a.options.addPath(n, t));
|
|
1702
|
-
var u = De(r, {
|
|
1703
|
-
lng: n,
|
|
1704
|
-
ns: t
|
|
1705
|
-
});
|
|
1706
|
-
a.options.request(a.options, u, o, function(t, n) {
|
|
1707
|
-
s += 1, c.push(t), l.push(n), s === e.length && typeof i == "function" && i(c, l);
|
|
1708
|
-
});
|
|
1709
|
-
});
|
|
1710
|
-
}
|
|
1711
|
-
}
|
|
1712
|
-
},
|
|
1713
|
-
{
|
|
1714
|
-
key: "reload",
|
|
1715
|
-
value: function() {
|
|
1716
|
-
var e = this, t = this.services, n = t.backendConnector, r = t.languageUtils, i = t.logger, a = n.language;
|
|
1717
|
-
if (!(a && a.toLowerCase() === "cimode")) {
|
|
1718
|
-
var o = [], s = function(e) {
|
|
1719
|
-
r.toResolveHierarchy(e).forEach(function(e) {
|
|
1720
|
-
o.indexOf(e) < 0 && o.push(e);
|
|
1721
|
-
});
|
|
1722
|
-
};
|
|
1723
|
-
s(a), this.allOptions.preload && this.allOptions.preload.forEach(function(e) {
|
|
1724
|
-
return s(e);
|
|
1725
|
-
}), o.forEach(function(t) {
|
|
1726
|
-
e.allOptions.ns.forEach(function(e) {
|
|
1727
|
-
n.read(t, e, "read", null, null, function(r, a) {
|
|
1728
|
-
r && i.warn(`loading namespace ${e} for language ${t} failed`, r), !r && a && i.log(`loaded namespace ${e} for language ${t}`, a), n.loaded(`${t}|${e}`, r, a);
|
|
1729
|
-
});
|
|
1730
|
-
});
|
|
1731
|
-
});
|
|
1732
|
-
}
|
|
1733
|
-
}
|
|
1734
|
-
}
|
|
1735
|
-
]);
|
|
1736
|
-
}();
|
|
1737
|
-
Ge.type = "backend";
|
|
1611
|
+
});
|
|
1612
|
+
});
|
|
1613
|
+
}
|
|
1614
|
+
};
|
|
1615
|
+
Le.type = "backend";
|
|
1738
1616
|
//#endregion
|
|
1739
1617
|
//#region node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
1740
|
-
function
|
|
1741
|
-
return (t =
|
|
1618
|
+
function Re(e, t, n) {
|
|
1619
|
+
return (t = H(t)) in e ? Object.defineProperty(e, t, {
|
|
1742
1620
|
value: n,
|
|
1743
1621
|
enumerable: !0,
|
|
1744
1622
|
configurable: !0,
|
|
@@ -1747,7 +1625,7 @@ function Ke(e, t, n) {
|
|
|
1747
1625
|
}
|
|
1748
1626
|
//#endregion
|
|
1749
1627
|
//#region node_modules/i18next-localstorage-backend/dist/esm/i18nextLocalStorageBackend.js
|
|
1750
|
-
function
|
|
1628
|
+
function ze(e, t) {
|
|
1751
1629
|
var n = Object.keys(e);
|
|
1752
1630
|
if (Object.getOwnPropertySymbols) {
|
|
1753
1631
|
var r = Object.getOwnPropertySymbols(e);
|
|
@@ -1757,22 +1635,22 @@ function qe(e, t) {
|
|
|
1757
1635
|
}
|
|
1758
1636
|
return n;
|
|
1759
1637
|
}
|
|
1760
|
-
function
|
|
1638
|
+
function Q(e) {
|
|
1761
1639
|
for (var t = 1; t < arguments.length; t++) {
|
|
1762
1640
|
var n = arguments[t] == null ? {} : arguments[t];
|
|
1763
|
-
t % 2 ?
|
|
1764
|
-
|
|
1765
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) :
|
|
1641
|
+
t % 2 ? ze(Object(n), !0).forEach(function(t) {
|
|
1642
|
+
Re(e, t, n[t]);
|
|
1643
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : ze(Object(n)).forEach(function(t) {
|
|
1766
1644
|
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
1767
1645
|
});
|
|
1768
1646
|
}
|
|
1769
1647
|
return e;
|
|
1770
1648
|
}
|
|
1771
|
-
var
|
|
1649
|
+
var Be = /* @__PURE__ */ function() {
|
|
1772
1650
|
function e(t) {
|
|
1773
|
-
|
|
1651
|
+
B(this, e), this.store = t.store;
|
|
1774
1652
|
}
|
|
1775
|
-
return
|
|
1653
|
+
return W(e, [{
|
|
1776
1654
|
key: "setItem",
|
|
1777
1655
|
value: function(e, t) {
|
|
1778
1656
|
if (this.store) try {
|
|
@@ -1788,7 +1666,7 @@ var Je = /* @__PURE__ */ function() {
|
|
|
1788
1666
|
}
|
|
1789
1667
|
}]);
|
|
1790
1668
|
}();
|
|
1791
|
-
function
|
|
1669
|
+
function Ve() {
|
|
1792
1670
|
var e = null;
|
|
1793
1671
|
try {
|
|
1794
1672
|
e = window.localStorage;
|
|
@@ -1804,17 +1682,17 @@ function Ye() {
|
|
|
1804
1682
|
store: e
|
|
1805
1683
|
};
|
|
1806
1684
|
}
|
|
1807
|
-
var
|
|
1685
|
+
var $ = /* @__PURE__ */ function() {
|
|
1808
1686
|
function e(t) {
|
|
1809
1687
|
var n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1810
|
-
|
|
1688
|
+
B(this, e), this.init(t, n), this.type = "backend";
|
|
1811
1689
|
}
|
|
1812
|
-
return
|
|
1690
|
+
return W(e, [
|
|
1813
1691
|
{
|
|
1814
1692
|
key: "init",
|
|
1815
1693
|
value: function(e) {
|
|
1816
1694
|
var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
1817
|
-
this.services = e, this.options =
|
|
1695
|
+
this.services = e, this.options = Q(Q(Q({}, Ve()), this.options), t), this.storage = new Be(this.options);
|
|
1818
1696
|
}
|
|
1819
1697
|
},
|
|
1820
1698
|
{
|
|
@@ -1853,10 +1731,10 @@ var Xe = /* @__PURE__ */ function() {
|
|
|
1853
1731
|
}
|
|
1854
1732
|
]);
|
|
1855
1733
|
}();
|
|
1856
|
-
|
|
1734
|
+
$.type = "backend";
|
|
1857
1735
|
//#endregion
|
|
1858
1736
|
//#region node_modules/i18next-resources-to-backend/dist/esm/index.js
|
|
1859
|
-
var
|
|
1737
|
+
var He = function(e) {
|
|
1860
1738
|
return {
|
|
1861
1739
|
type: "backend",
|
|
1862
1740
|
init: function(e, t, n) {},
|
|
@@ -1879,21 +1757,21 @@ var Ze = function(e) {
|
|
|
1879
1757
|
r(null, e && e[t] && e[t][n]);
|
|
1880
1758
|
}
|
|
1881
1759
|
};
|
|
1882
|
-
},
|
|
1760
|
+
}, Ue = ({ initReactI18next: t, lang: n, fallbackLang: r, langCacheExpiredTimeMs: i, resources: a, version: o, useBackend: s, withLocalstorageBackend: c = !1, cdnUrl: l = "", debug: u = !1 }) => {
|
|
1883
1761
|
let d = [], f = [], p = Object.keys(a);
|
|
1884
1762
|
if (s && c) {
|
|
1885
1763
|
let e = {};
|
|
1886
|
-
p.forEach((t) => Object.assign(e, { [t]: o })), d.push(
|
|
1764
|
+
p.forEach((t) => Object.assign(e, { [t]: o })), d.push($), f.push({
|
|
1887
1765
|
prefix: "i18next_res_",
|
|
1888
1766
|
expirationTime: i,
|
|
1889
1767
|
versions: e
|
|
1890
1768
|
});
|
|
1891
1769
|
}
|
|
1892
|
-
s && l && (d.push(
|
|
1770
|
+
s && l && (d.push(Le), f.push({
|
|
1893
1771
|
loadPath: `${l}/locales/{{lng}}.json`,
|
|
1894
|
-
queryStringParams: { v: `${o}.${
|
|
1772
|
+
queryStringParams: { v: `${o}.${e(i)}` },
|
|
1895
1773
|
reloadInterval: i
|
|
1896
|
-
})), s && d.push(
|
|
1774
|
+
})), s && d.push(He(a));
|
|
1897
1775
|
let m = {
|
|
1898
1776
|
type: "languageDetector",
|
|
1899
1777
|
name: "customDetector",
|
|
@@ -1925,9 +1803,9 @@ var Ze = function(e) {
|
|
|
1925
1803
|
} : {
|
|
1926
1804
|
...h,
|
|
1927
1805
|
resources: a
|
|
1928
|
-
}, !
|
|
1929
|
-
let
|
|
1930
|
-
s && (
|
|
1806
|
+
}, !z.isInitialized) {
|
|
1807
|
+
let e = z;
|
|
1808
|
+
s && (e = e.use(q)), e.use(m).use(t).init(h, (e, t) => {
|
|
1931
1809
|
if (e) {
|
|
1932
1810
|
console.error("Error when i18n init", e);
|
|
1933
1811
|
return;
|
|
@@ -1936,6 +1814,6 @@ var Ze = function(e) {
|
|
|
1936
1814
|
}
|
|
1937
1815
|
};
|
|
1938
1816
|
//#endregion
|
|
1939
|
-
export {
|
|
1817
|
+
export { Ue as t };
|
|
1940
1818
|
|
|
1941
|
-
//# sourceMappingURL=i18n-
|
|
1819
|
+
//# sourceMappingURL=i18n-CJthsaWo.js.map
|