mp-front-cli 0.0.43 → 0.0.45

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.
@@ -0,0 +1,1644 @@
1
+ import { CustomEncoder as ge } from "./mp-front-cli-encoder.es.js";
2
+ import { t as he } from "./index-df4e0539.js";
3
+ import { CustomLogger as ce } from "./mp-front-cli-logger.es.js";
4
+ import { getServerSession as de } from "next-auth";
5
+ const pe = {
6
+ type: "logger",
7
+ log(i) {
8
+ this.output("log", i);
9
+ },
10
+ warn(i) {
11
+ this.output("warn", i);
12
+ },
13
+ error(i) {
14
+ this.output("error", i);
15
+ },
16
+ output(i, e) {
17
+ console && console[i] && console[i].apply(console, e);
18
+ }
19
+ };
20
+ class M {
21
+ constructor(e) {
22
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
23
+ this.init(e, t);
24
+ }
25
+ init(e) {
26
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
27
+ this.prefix = t.prefix || "i18next:", this.logger = e || pe, this.options = t, this.debug = t.debug;
28
+ }
29
+ log() {
30
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
31
+ t[s] = arguments[s];
32
+ return this.forward(t, "log", "", !0);
33
+ }
34
+ warn() {
35
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
36
+ t[s] = arguments[s];
37
+ return this.forward(t, "warn", "", !0);
38
+ }
39
+ error() {
40
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
41
+ t[s] = arguments[s];
42
+ return this.forward(t, "error", "");
43
+ }
44
+ deprecate() {
45
+ for (var e = arguments.length, t = new Array(e), s = 0; s < e; s++)
46
+ t[s] = arguments[s];
47
+ return this.forward(t, "warn", "WARNING DEPRECATED: ", !0);
48
+ }
49
+ forward(e, t, s, n) {
50
+ return n && !this.debug ? null : (typeof e[0] == "string" && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
51
+ }
52
+ create(e) {
53
+ return new M(this.logger, {
54
+ prefix: `${this.prefix}:${e}:`,
55
+ ...this.options
56
+ });
57
+ }
58
+ clone(e) {
59
+ return e = e || this.options, e.prefix = e.prefix || this.prefix, new M(this.logger, e);
60
+ }
61
+ }
62
+ var N = new M();
63
+ class W {
64
+ constructor() {
65
+ this.observers = {};
66
+ }
67
+ on(e, t) {
68
+ return e.split(" ").forEach((s) => {
69
+ this.observers[s] = this.observers[s] || [], this.observers[s].push(t);
70
+ }), this;
71
+ }
72
+ off(e, t) {
73
+ if (this.observers[e]) {
74
+ if (!t) {
75
+ delete this.observers[e];
76
+ return;
77
+ }
78
+ this.observers[e] = this.observers[e].filter((s) => s !== t);
79
+ }
80
+ }
81
+ emit(e) {
82
+ for (var t = arguments.length, s = new Array(t > 1 ? t - 1 : 0), n = 1; n < t; n++)
83
+ s[n - 1] = arguments[n];
84
+ this.observers[e] && [].concat(this.observers[e]).forEach((a) => {
85
+ a(...s);
86
+ }), this.observers["*"] && [].concat(this.observers["*"]).forEach((a) => {
87
+ a.apply(a, [e, ...s]);
88
+ });
89
+ }
90
+ }
91
+ function I() {
92
+ let i, e;
93
+ const t = new Promise((s, n) => {
94
+ i = s, e = n;
95
+ });
96
+ return t.resolve = i, t.reject = e, t;
97
+ }
98
+ function q(i) {
99
+ return i == null ? "" : "" + i;
100
+ }
101
+ function me(i, e, t) {
102
+ i.forEach((s) => {
103
+ e[s] && (t[s] = e[s]);
104
+ });
105
+ }
106
+ function Y(i, e, t) {
107
+ function s(a) {
108
+ return a && a.indexOf("###") > -1 ? a.replace(/###/g, ".") : a;
109
+ }
110
+ function n() {
111
+ return !i || typeof i == "string";
112
+ }
113
+ const r = typeof e != "string" ? [].concat(e) : e.split(".");
114
+ for (; r.length > 1; ) {
115
+ if (n())
116
+ return {};
117
+ const a = s(r.shift());
118
+ !i[a] && t && (i[a] = new t()), Object.prototype.hasOwnProperty.call(i, a) ? i = i[a] : i = {};
119
+ }
120
+ return n() ? {} : {
121
+ obj: i,
122
+ k: s(r.shift())
123
+ };
124
+ }
125
+ function _(i, e, t) {
126
+ const {
127
+ obj: s,
128
+ k: n
129
+ } = Y(i, e, Object);
130
+ s[n] = t;
131
+ }
132
+ function ye(i, e, t, s) {
133
+ const {
134
+ obj: n,
135
+ k: r
136
+ } = Y(i, e, Object);
137
+ n[r] = n[r] || [], s && (n[r] = n[r].concat(t)), s || n[r].push(t);
138
+ }
139
+ function H(i, e) {
140
+ const {
141
+ obj: t,
142
+ k: s
143
+ } = Y(i, e);
144
+ if (t)
145
+ return t[s];
146
+ }
147
+ function be(i, e, t) {
148
+ const s = H(i, t);
149
+ return s !== void 0 ? s : H(e, t);
150
+ }
151
+ function oe(i, e, t) {
152
+ for (const s in e)
153
+ s !== "__proto__" && s !== "constructor" && (s in i ? typeof i[s] == "string" || i[s] instanceof String || typeof e[s] == "string" || e[s] instanceof String ? t && (i[s] = e[s]) : oe(i[s], e[s], t) : i[s] = e[s]);
154
+ return i;
155
+ }
156
+ function C(i) {
157
+ return i.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
158
+ }
159
+ var xe = {
160
+ "&": "&amp;",
161
+ "<": "&lt;",
162
+ ">": "&gt;",
163
+ '"': "&quot;",
164
+ "'": "&#39;",
165
+ "/": "&#x2F;"
166
+ };
167
+ function Se(i) {
168
+ return typeof i == "string" ? i.replace(/[&<>"'\/]/g, (e) => xe[e]) : i;
169
+ }
170
+ const ve = [" ", ",", "?", "!", ";"];
171
+ function Le(i, e, t) {
172
+ e = e || "", t = t || "";
173
+ const s = ve.filter((a) => e.indexOf(a) < 0 && t.indexOf(a) < 0);
174
+ if (s.length === 0)
175
+ return !0;
176
+ const n = new RegExp(`(${s.map((a) => a === "?" ? "\\?" : a).join("|")})`);
177
+ let r = !n.test(i);
178
+ if (!r) {
179
+ const a = i.indexOf(t);
180
+ a > 0 && !n.test(i.substring(0, a)) && (r = !0);
181
+ }
182
+ return r;
183
+ }
184
+ function z(i, e) {
185
+ let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
186
+ if (!i)
187
+ return;
188
+ if (i[e])
189
+ return i[e];
190
+ const s = e.split(t);
191
+ let n = i;
192
+ for (let r = 0; r < s.length; ++r) {
193
+ if (!n || typeof n[s[r]] == "string" && r + 1 < s.length)
194
+ return;
195
+ if (n[s[r]] === void 0) {
196
+ let a = 2, l = s.slice(r, r + a).join(t), o = n[l];
197
+ for (; o === void 0 && s.length > r + a; )
198
+ a++, l = s.slice(r, r + a).join(t), o = n[l];
199
+ if (o === void 0)
200
+ return;
201
+ if (o === null)
202
+ return null;
203
+ if (e.endsWith(l)) {
204
+ if (typeof o == "string")
205
+ return o;
206
+ if (l && typeof o[l] == "string")
207
+ return o[l];
208
+ }
209
+ const f = s.slice(r + a).join(t);
210
+ return f ? z(o, f, t) : void 0;
211
+ }
212
+ n = n[s[r]];
213
+ }
214
+ return n;
215
+ }
216
+ function J(i) {
217
+ return i && i.indexOf("_") > 0 ? i.replace("_", "-") : i;
218
+ }
219
+ class ee extends W {
220
+ constructor(e) {
221
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
222
+ ns: ["translation"],
223
+ defaultNS: "translation"
224
+ };
225
+ super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
226
+ }
227
+ addNamespaces(e) {
228
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
229
+ }
230
+ removeNamespaces(e) {
231
+ const t = this.options.ns.indexOf(e);
232
+ t > -1 && this.options.ns.splice(t, 1);
233
+ }
234
+ getResource(e, t, s) {
235
+ let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
236
+ const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator, a = n.ignoreJSONStructure !== void 0 ? n.ignoreJSONStructure : this.options.ignoreJSONStructure;
237
+ let l = [e, t];
238
+ s && typeof s != "string" && (l = l.concat(s)), s && typeof s == "string" && (l = l.concat(r ? s.split(r) : s)), e.indexOf(".") > -1 && (l = e.split("."));
239
+ const o = H(this.data, l);
240
+ return o || !a || typeof s != "string" ? o : z(this.data && this.data[e] && this.data[e][t], s, r);
241
+ }
242
+ addResource(e, t, s, n) {
243
+ let r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
244
+ silent: !1
245
+ };
246
+ const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
247
+ let l = [e, t];
248
+ s && (l = l.concat(a ? s.split(a) : s)), e.indexOf(".") > -1 && (l = e.split("."), n = t, t = l[1]), this.addNamespaces(t), _(this.data, l, n), r.silent || this.emit("added", e, t, s, n);
249
+ }
250
+ addResources(e, t, s) {
251
+ let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
252
+ silent: !1
253
+ };
254
+ for (const r in s)
255
+ (typeof s[r] == "string" || Object.prototype.toString.apply(s[r]) === "[object Array]") && this.addResource(e, t, r, s[r], {
256
+ silent: !0
257
+ });
258
+ n.silent || this.emit("added", e, t, s);
259
+ }
260
+ addResourceBundle(e, t, s, n, r) {
261
+ let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {
262
+ silent: !1
263
+ }, l = [e, t];
264
+ e.indexOf(".") > -1 && (l = e.split("."), n = s, s = t, t = l[1]), this.addNamespaces(t);
265
+ let o = H(this.data, l) || {};
266
+ n ? oe(o, s, r) : o = {
267
+ ...o,
268
+ ...s
269
+ }, _(this.data, l, o), a.silent || this.emit("added", e, t, s);
270
+ }
271
+ removeResourceBundle(e, t) {
272
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
273
+ }
274
+ hasResourceBundle(e, t) {
275
+ return this.getResource(e, t) !== void 0;
276
+ }
277
+ getResourceBundle(e, t) {
278
+ return t || (t = this.options.defaultNS), this.options.compatibilityAPI === "v1" ? {
279
+ ...this.getResource(e, t)
280
+ } : this.getResource(e, t);
281
+ }
282
+ getDataByLanguage(e) {
283
+ return this.data[e];
284
+ }
285
+ hasLanguageSomeTranslations(e) {
286
+ const t = this.getDataByLanguage(e);
287
+ return !!(t && Object.keys(t) || []).find((n) => t[n] && Object.keys(t[n]).length > 0);
288
+ }
289
+ toJSON() {
290
+ return this.data;
291
+ }
292
+ }
293
+ var le = {
294
+ processors: {},
295
+ addPostProcessor(i) {
296
+ this.processors[i.name] = i;
297
+ },
298
+ handle(i, e, t, s, n) {
299
+ return i.forEach((r) => {
300
+ this.processors[r] && (e = this.processors[r].process(e, t, s, n));
301
+ }), e;
302
+ }
303
+ };
304
+ const te = {};
305
+ class B extends W {
306
+ constructor(e) {
307
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
308
+ super(), me(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = N.create("translator");
309
+ }
310
+ changeLanguage(e) {
311
+ e && (this.language = e);
312
+ }
313
+ exists(e) {
314
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
315
+ interpolation: {}
316
+ };
317
+ if (e == null)
318
+ return !1;
319
+ const s = this.resolve(e, t);
320
+ return s && s.res !== void 0;
321
+ }
322
+ extractFromKey(e, t) {
323
+ let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
324
+ s === void 0 && (s = ":");
325
+ const n = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
326
+ let r = t.ns || this.options.defaultNS || [];
327
+ const a = s && e.indexOf(s) > -1, l = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Le(e, s, n);
328
+ if (a && !l) {
329
+ const o = e.match(this.interpolator.nestingRegexp);
330
+ if (o && o.length > 0)
331
+ return {
332
+ key: e,
333
+ namespaces: r
334
+ };
335
+ const f = e.split(s);
336
+ (s !== n || s === n && this.options.ns.indexOf(f[0]) > -1) && (r = f.shift()), e = f.join(n);
337
+ }
338
+ return typeof r == "string" && (r = [r]), {
339
+ key: e,
340
+ namespaces: r
341
+ };
342
+ }
343
+ translate(e, t, s) {
344
+ if (typeof t != "object" && this.options.overloadTranslationOptionHandler && (t = this.options.overloadTranslationOptionHandler(arguments)), typeof t == "object" && (t = {
345
+ ...t
346
+ }), t || (t = {}), e == null)
347
+ return "";
348
+ Array.isArray(e) || (e = [String(e)]);
349
+ const n = t.returnDetails !== void 0 ? t.returnDetails : this.options.returnDetails, r = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator, {
350
+ key: a,
351
+ namespaces: l
352
+ } = this.extractFromKey(e[e.length - 1], t), o = l[l.length - 1], f = t.lng || this.language, g = t.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
353
+ if (f && f.toLowerCase() === "cimode") {
354
+ if (g) {
355
+ const y = t.nsSeparator || this.options.nsSeparator;
356
+ return n ? {
357
+ res: `${o}${y}${a}`,
358
+ usedKey: a,
359
+ exactUsedKey: a,
360
+ usedLng: f,
361
+ usedNS: o,
362
+ usedParams: this.getUsedParamsDetails(t)
363
+ } : `${o}${y}${a}`;
364
+ }
365
+ return n ? {
366
+ res: a,
367
+ usedKey: a,
368
+ exactUsedKey: a,
369
+ usedLng: f,
370
+ usedNS: o,
371
+ usedParams: this.getUsedParamsDetails(t)
372
+ } : a;
373
+ }
374
+ const h = this.resolve(e, t);
375
+ let u = h && h.res;
376
+ const d = h && h.usedKey || a, c = h && h.exactUsedKey || a, p = Object.prototype.toString.apply(u), m = ["[object Number]", "[object Function]", "[object RegExp]"], v = t.joinArrays !== void 0 ? t.joinArrays : this.options.joinArrays, x = !this.i18nFormat || this.i18nFormat.handleAsObject;
377
+ if (x && u && (typeof u != "string" && typeof u != "boolean" && typeof u != "number") && m.indexOf(p) < 0 && !(typeof v == "string" && p === "[object Array]")) {
378
+ if (!t.returnObjects && !this.options.returnObjects) {
379
+ this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
380
+ const y = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(d, u, {
381
+ ...t,
382
+ ns: l
383
+ }) : `key '${a} (${this.language})' returned an object instead of string.`;
384
+ return n ? (h.res = y, h.usedParams = this.getUsedParamsDetails(t), h) : y;
385
+ }
386
+ if (r) {
387
+ const y = p === "[object Array]", L = y ? [] : {}, w = y ? c : d;
388
+ for (const S in u)
389
+ if (Object.prototype.hasOwnProperty.call(u, S)) {
390
+ const T = `${w}${r}${S}`;
391
+ L[S] = this.translate(T, {
392
+ ...t,
393
+ joinArrays: !1,
394
+ ns: l
395
+ }), L[S] === T && (L[S] = u[S]);
396
+ }
397
+ u = L;
398
+ }
399
+ } else if (x && typeof v == "string" && p === "[object Array]")
400
+ u = u.join(v), u && (u = this.extendTranslation(u, e, t, s));
401
+ else {
402
+ let y = !1, L = !1;
403
+ const w = t.count !== void 0 && typeof t.count != "string", S = B.hasDefaultValue(t), T = w ? this.pluralResolver.getSuffix(f, t.count, t) : "", ue = t.ordinal && w ? this.pluralResolver.getSuffix(f, t.count, {
404
+ ordinal: !1
405
+ }) : "", Z = w && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), k = Z && t[`defaultValue${this.options.pluralSeparator}zero`] || t[`defaultValue${T}`] || t[`defaultValue${ue}`] || t.defaultValue;
406
+ !this.isValidLookup(u) && S && (y = !0, u = k), this.isValidLookup(u) || (L = !0, u = a);
407
+ const fe = (t.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && L ? void 0 : u, E = S && k !== u && this.options.updateMissing;
408
+ if (L || y || E) {
409
+ if (this.logger.log(E ? "updateKey" : "missingKey", f, o, a, E ? k : u), r) {
410
+ const O = this.resolve(a, {
411
+ ...t,
412
+ keySeparator: !1
413
+ });
414
+ O && O.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
415
+ }
416
+ let F = [];
417
+ const V = this.languageUtils.getFallbackCodes(this.options.fallbackLng, t.lng || this.language);
418
+ if (this.options.saveMissingTo === "fallback" && V && V[0])
419
+ for (let O = 0; O < V.length; O++)
420
+ F.push(V[O]);
421
+ else
422
+ this.options.saveMissingTo === "all" ? F = this.languageUtils.toResolveHierarchy(t.lng || this.language) : F.push(t.lng || this.language);
423
+ const Q = (O, P, j) => {
424
+ const X = S && j !== u ? j : fe;
425
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(O, o, P, X, E, t) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(O, o, P, X, E, t), this.emit("missingKey", O, o, P, u);
426
+ };
427
+ this.options.saveMissing && (this.options.saveMissingPlurals && w ? F.forEach((O) => {
428
+ const P = this.pluralResolver.getSuffixes(O, t);
429
+ Z && t[`defaultValue${this.options.pluralSeparator}zero`] && P.indexOf(`${this.options.pluralSeparator}zero`) < 0 && P.push(`${this.options.pluralSeparator}zero`), P.forEach((j) => {
430
+ Q([O], a + j, t[`defaultValue${j}`] || k);
431
+ });
432
+ }) : Q(F, a, k));
433
+ }
434
+ u = this.extendTranslation(u, e, t, h, s), L && u === a && this.options.appendNamespaceToMissingKey && (u = `${o}:${a}`), (L || y) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? u = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${o}:${a}` : a, y ? u : void 0) : u = this.options.parseMissingKeyHandler(u));
435
+ }
436
+ return n ? (h.res = u, h.usedParams = this.getUsedParamsDetails(t), h) : u;
437
+ }
438
+ extendTranslation(e, t, s, n, r) {
439
+ var a = this;
440
+ if (this.i18nFormat && this.i18nFormat.parse)
441
+ e = this.i18nFormat.parse(e, {
442
+ ...this.options.interpolation.defaultVariables,
443
+ ...s
444
+ }, s.lng || this.language || n.usedLng, n.usedNS, n.usedKey, {
445
+ resolved: n
446
+ });
447
+ else if (!s.skipInterpolation) {
448
+ s.interpolation && this.interpolator.init({
449
+ ...s,
450
+ interpolation: {
451
+ ...this.options.interpolation,
452
+ ...s.interpolation
453
+ }
454
+ });
455
+ const f = typeof e == "string" && (s && s.interpolation && s.interpolation.skipOnVariables !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
456
+ let g;
457
+ if (f) {
458
+ const u = e.match(this.interpolator.nestingRegexp);
459
+ g = u && u.length;
460
+ }
461
+ let h = s.replace && typeof s.replace != "string" ? s.replace : s;
462
+ if (this.options.interpolation.defaultVariables && (h = {
463
+ ...this.options.interpolation.defaultVariables,
464
+ ...h
465
+ }), e = this.interpolator.interpolate(e, h, s.lng || this.language, s), f) {
466
+ const u = e.match(this.interpolator.nestingRegexp), d = u && u.length;
467
+ g < d && (s.nest = !1);
468
+ }
469
+ !s.lng && this.options.compatibilityAPI !== "v1" && n && n.res && (s.lng = n.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, function() {
470
+ for (var u = arguments.length, d = new Array(u), c = 0; c < u; c++)
471
+ d[c] = arguments[c];
472
+ return r && r[0] === d[0] && !s.context ? (a.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${t[0]}`), null) : a.translate(...d, t);
473
+ }, s)), s.interpolation && this.interpolator.reset();
474
+ }
475
+ const l = s.postProcess || this.options.postProcess, o = typeof l == "string" ? [l] : l;
476
+ return e != null && o && o.length && s.applyPostProcessor !== !1 && (e = le.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
477
+ i18nResolved: {
478
+ ...n,
479
+ usedParams: this.getUsedParamsDetails(s)
480
+ },
481
+ ...s
482
+ } : s, this)), e;
483
+ }
484
+ resolve(e) {
485
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, s, n, r, a, l;
486
+ return typeof e == "string" && (e = [e]), e.forEach((o) => {
487
+ if (this.isValidLookup(s))
488
+ return;
489
+ const f = this.extractFromKey(o, t), g = f.key;
490
+ n = g;
491
+ let h = f.namespaces;
492
+ this.options.fallbackNS && (h = h.concat(this.options.fallbackNS));
493
+ const u = t.count !== void 0 && typeof t.count != "string", d = u && !t.ordinal && t.count === 0 && this.pluralResolver.shouldUseIntlApi(), c = t.context !== void 0 && (typeof t.context == "string" || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
494
+ h.forEach((m) => {
495
+ this.isValidLookup(s) || (l = m, !te[`${p[0]}-${m}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(l) && (te[`${p[0]}-${m}`] = !0, this.logger.warn(`key "${n}" for languages "${p.join(", ")}" won't get resolved as namespace "${l}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), p.forEach((v) => {
496
+ if (this.isValidLookup(s))
497
+ return;
498
+ a = v;
499
+ const x = [g];
500
+ if (this.i18nFormat && this.i18nFormat.addLookupKeys)
501
+ this.i18nFormat.addLookupKeys(x, g, v, m, t);
502
+ else {
503
+ let y;
504
+ u && (y = this.pluralResolver.getSuffix(v, t.count, t));
505
+ const L = `${this.options.pluralSeparator}zero`, w = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
506
+ if (u && (x.push(g + y), t.ordinal && y.indexOf(w) === 0 && x.push(g + y.replace(w, this.options.pluralSeparator)), d && x.push(g + L)), c) {
507
+ const S = `${g}${this.options.contextSeparator}${t.context}`;
508
+ x.push(S), u && (x.push(S + y), t.ordinal && y.indexOf(w) === 0 && x.push(S + y.replace(w, this.options.pluralSeparator)), d && x.push(S + L));
509
+ }
510
+ }
511
+ let D;
512
+ for (; D = x.pop(); )
513
+ this.isValidLookup(s) || (r = D, s = this.getResource(v, m, D, t));
514
+ }));
515
+ });
516
+ }), {
517
+ res: s,
518
+ usedKey: n,
519
+ exactUsedKey: r,
520
+ usedLng: a,
521
+ usedNS: l
522
+ };
523
+ }
524
+ isValidLookup(e) {
525
+ return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
526
+ }
527
+ getResource(e, t, s) {
528
+ let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
529
+ return this.i18nFormat && this.i18nFormat.getResource ? this.i18nFormat.getResource(e, t, s, n) : this.resourceStore.getResource(e, t, s, n);
530
+ }
531
+ getUsedParamsDetails() {
532
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
533
+ const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && typeof e.replace != "string";
534
+ let n = s ? e.replace : e;
535
+ if (s && typeof e.count < "u" && (n.count = e.count), this.options.interpolation.defaultVariables && (n = {
536
+ ...this.options.interpolation.defaultVariables,
537
+ ...n
538
+ }), !s) {
539
+ n = {
540
+ ...n
541
+ };
542
+ for (const r of t)
543
+ delete n[r];
544
+ }
545
+ return n;
546
+ }
547
+ static hasDefaultValue(e) {
548
+ const t = "defaultValue";
549
+ for (const s in e)
550
+ if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
551
+ return !0;
552
+ return !1;
553
+ }
554
+ }
555
+ function G(i) {
556
+ return i.charAt(0).toUpperCase() + i.slice(1);
557
+ }
558
+ class se {
559
+ constructor(e) {
560
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = N.create("languageUtils");
561
+ }
562
+ getScriptPartFromCode(e) {
563
+ if (e = J(e), !e || e.indexOf("-") < 0)
564
+ return null;
565
+ const t = e.split("-");
566
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
567
+ }
568
+ getLanguagePartFromCode(e) {
569
+ if (e = J(e), !e || e.indexOf("-") < 0)
570
+ return e;
571
+ const t = e.split("-");
572
+ return this.formatLanguageCode(t[0]);
573
+ }
574
+ formatLanguageCode(e) {
575
+ if (typeof e == "string" && e.indexOf("-") > -1) {
576
+ const t = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
577
+ let s = e.split("-");
578
+ return this.options.lowerCaseLng ? s = s.map((n) => n.toLowerCase()) : s.length === 2 ? (s[0] = s[0].toLowerCase(), s[1] = s[1].toUpperCase(), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = G(s[1].toLowerCase()))) : s.length === 3 && (s[0] = s[0].toLowerCase(), s[1].length === 2 && (s[1] = s[1].toUpperCase()), s[0] !== "sgn" && s[2].length === 2 && (s[2] = s[2].toUpperCase()), t.indexOf(s[1].toLowerCase()) > -1 && (s[1] = G(s[1].toLowerCase())), t.indexOf(s[2].toLowerCase()) > -1 && (s[2] = G(s[2].toLowerCase()))), s.join("-");
579
+ }
580
+ return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
581
+ }
582
+ isSupportedCode(e) {
583
+ return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
584
+ }
585
+ getBestMatchFromCodes(e) {
586
+ if (!e)
587
+ return null;
588
+ let t;
589
+ return e.forEach((s) => {
590
+ if (t)
591
+ return;
592
+ const n = this.formatLanguageCode(s);
593
+ (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
594
+ }), !t && this.options.supportedLngs && e.forEach((s) => {
595
+ if (t)
596
+ return;
597
+ const n = this.getLanguagePartFromCode(s);
598
+ if (this.isSupportedCode(n))
599
+ return t = n;
600
+ t = this.options.supportedLngs.find((r) => {
601
+ if (r === n)
602
+ return r;
603
+ if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && r.indexOf(n) === 0)
604
+ return r;
605
+ });
606
+ }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
607
+ }
608
+ getFallbackCodes(e, t) {
609
+ if (!e)
610
+ return [];
611
+ if (typeof e == "function" && (e = e(t)), typeof e == "string" && (e = [e]), Object.prototype.toString.apply(e) === "[object Array]")
612
+ return e;
613
+ if (!t)
614
+ return e.default || [];
615
+ let s = e[t];
616
+ return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
617
+ }
618
+ toResolveHierarchy(e, t) {
619
+ const s = this.getFallbackCodes(t || this.options.fallbackLng || [], e), n = [], r = (a) => {
620
+ a && (this.isSupportedCode(a) ? n.push(a) : this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`));
621
+ };
622
+ return typeof e == "string" && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && r(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && r(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && r(this.getLanguagePartFromCode(e))) : typeof e == "string" && r(this.formatLanguageCode(e)), s.forEach((a) => {
623
+ n.indexOf(a) < 0 && r(this.formatLanguageCode(a));
624
+ }), n;
625
+ }
626
+ }
627
+ let Oe = [{
628
+ lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
629
+ nr: [1, 2],
630
+ fc: 1
631
+ }, {
632
+ lngs: ["af", "an", "ast", "az", "bg", "bn", "ca", "da", "de", "dev", "el", "en", "eo", "es", "et", "eu", "fi", "fo", "fur", "fy", "gl", "gu", "ha", "hi", "hu", "hy", "ia", "it", "kk", "kn", "ku", "lb", "mai", "ml", "mn", "mr", "nah", "nap", "nb", "ne", "nl", "nn", "no", "nso", "pa", "pap", "pms", "ps", "pt-PT", "rm", "sco", "se", "si", "so", "son", "sq", "sv", "sw", "ta", "te", "tk", "ur", "yo"],
633
+ nr: [1, 2],
634
+ fc: 2
635
+ }, {
636
+ lngs: ["ay", "bo", "cgg", "fa", "ht", "id", "ja", "jbo", "ka", "km", "ko", "ky", "lo", "ms", "sah", "su", "th", "tt", "ug", "vi", "wo", "zh"],
637
+ nr: [1],
638
+ fc: 3
639
+ }, {
640
+ lngs: ["be", "bs", "cnr", "dz", "hr", "ru", "sr", "uk"],
641
+ nr: [1, 2, 5],
642
+ fc: 4
643
+ }, {
644
+ lngs: ["ar"],
645
+ nr: [0, 1, 2, 3, 11, 100],
646
+ fc: 5
647
+ }, {
648
+ lngs: ["cs", "sk"],
649
+ nr: [1, 2, 5],
650
+ fc: 6
651
+ }, {
652
+ lngs: ["csb", "pl"],
653
+ nr: [1, 2, 5],
654
+ fc: 7
655
+ }, {
656
+ lngs: ["cy"],
657
+ nr: [1, 2, 3, 8],
658
+ fc: 8
659
+ }, {
660
+ lngs: ["fr"],
661
+ nr: [1, 2],
662
+ fc: 9
663
+ }, {
664
+ lngs: ["ga"],
665
+ nr: [1, 2, 3, 7, 11],
666
+ fc: 10
667
+ }, {
668
+ lngs: ["gd"],
669
+ nr: [1, 2, 3, 20],
670
+ fc: 11
671
+ }, {
672
+ lngs: ["is"],
673
+ nr: [1, 2],
674
+ fc: 12
675
+ }, {
676
+ lngs: ["jv"],
677
+ nr: [0, 1],
678
+ fc: 13
679
+ }, {
680
+ lngs: ["kw"],
681
+ nr: [1, 2, 3, 4],
682
+ fc: 14
683
+ }, {
684
+ lngs: ["lt"],
685
+ nr: [1, 2, 10],
686
+ fc: 15
687
+ }, {
688
+ lngs: ["lv"],
689
+ nr: [1, 2, 0],
690
+ fc: 16
691
+ }, {
692
+ lngs: ["mk"],
693
+ nr: [1, 2],
694
+ fc: 17
695
+ }, {
696
+ lngs: ["mnk"],
697
+ nr: [0, 1, 2],
698
+ fc: 18
699
+ }, {
700
+ lngs: ["mt"],
701
+ nr: [1, 2, 11, 20],
702
+ fc: 19
703
+ }, {
704
+ lngs: ["or"],
705
+ nr: [2, 1],
706
+ fc: 2
707
+ }, {
708
+ lngs: ["ro"],
709
+ nr: [1, 2, 20],
710
+ fc: 20
711
+ }, {
712
+ lngs: ["sl"],
713
+ nr: [5, 1, 2, 3],
714
+ fc: 21
715
+ }, {
716
+ lngs: ["he", "iw"],
717
+ nr: [1, 2, 20, 21],
718
+ fc: 22
719
+ }], we = {
720
+ 1: function(i) {
721
+ return +(i > 1);
722
+ },
723
+ 2: function(i) {
724
+ return +(i != 1);
725
+ },
726
+ 3: function(i) {
727
+ return 0;
728
+ },
729
+ 4: function(i) {
730
+ return i % 10 == 1 && i % 100 != 11 ? 0 : i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
731
+ },
732
+ 5: function(i) {
733
+ return i == 0 ? 0 : i == 1 ? 1 : i == 2 ? 2 : i % 100 >= 3 && i % 100 <= 10 ? 3 : i % 100 >= 11 ? 4 : 5;
734
+ },
735
+ 6: function(i) {
736
+ return i == 1 ? 0 : i >= 2 && i <= 4 ? 1 : 2;
737
+ },
738
+ 7: function(i) {
739
+ return i == 1 ? 0 : i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
740
+ },
741
+ 8: function(i) {
742
+ return i == 1 ? 0 : i == 2 ? 1 : i != 8 && i != 11 ? 2 : 3;
743
+ },
744
+ 9: function(i) {
745
+ return +(i >= 2);
746
+ },
747
+ 10: function(i) {
748
+ return i == 1 ? 0 : i == 2 ? 1 : i < 7 ? 2 : i < 11 ? 3 : 4;
749
+ },
750
+ 11: function(i) {
751
+ return i == 1 || i == 11 ? 0 : i == 2 || i == 12 ? 1 : i > 2 && i < 20 ? 2 : 3;
752
+ },
753
+ 12: function(i) {
754
+ return +(i % 10 != 1 || i % 100 == 11);
755
+ },
756
+ 13: function(i) {
757
+ return +(i !== 0);
758
+ },
759
+ 14: function(i) {
760
+ return i == 1 ? 0 : i == 2 ? 1 : i == 3 ? 2 : 3;
761
+ },
762
+ 15: function(i) {
763
+ return i % 10 == 1 && i % 100 != 11 ? 0 : i % 10 >= 2 && (i % 100 < 10 || i % 100 >= 20) ? 1 : 2;
764
+ },
765
+ 16: function(i) {
766
+ return i % 10 == 1 && i % 100 != 11 ? 0 : i !== 0 ? 1 : 2;
767
+ },
768
+ 17: function(i) {
769
+ return i == 1 || i % 10 == 1 && i % 100 != 11 ? 0 : 1;
770
+ },
771
+ 18: function(i) {
772
+ return i == 0 ? 0 : i == 1 ? 1 : 2;
773
+ },
774
+ 19: function(i) {
775
+ return i == 1 ? 0 : i == 0 || i % 100 > 1 && i % 100 < 11 ? 1 : i % 100 > 10 && i % 100 < 20 ? 2 : 3;
776
+ },
777
+ 20: function(i) {
778
+ return i == 1 ? 0 : i == 0 || i % 100 > 0 && i % 100 < 20 ? 1 : 2;
779
+ },
780
+ 21: function(i) {
781
+ return i % 100 == 1 ? 1 : i % 100 == 2 ? 2 : i % 100 == 3 || i % 100 == 4 ? 3 : 0;
782
+ },
783
+ 22: function(i) {
784
+ return i == 1 ? 0 : i == 2 ? 1 : (i < 0 || i > 10) && i % 10 == 0 ? 2 : 3;
785
+ }
786
+ };
787
+ const Ne = ["v1", "v2", "v3"], Re = ["v4"], ne = {
788
+ zero: 0,
789
+ one: 1,
790
+ two: 2,
791
+ few: 3,
792
+ many: 4,
793
+ other: 5
794
+ };
795
+ function Pe() {
796
+ const i = {};
797
+ return Oe.forEach((e) => {
798
+ e.lngs.forEach((t) => {
799
+ i[t] = {
800
+ numbers: e.nr,
801
+ plurals: we[e.fc]
802
+ };
803
+ });
804
+ }), i;
805
+ }
806
+ class Ce {
807
+ constructor(e) {
808
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
809
+ this.languageUtils = e, this.options = t, this.logger = N.create("pluralResolver"), (!this.options.compatibilityJSON || Re.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = Pe();
810
+ }
811
+ addRule(e, t) {
812
+ this.rules[e] = t;
813
+ }
814
+ getRule(e) {
815
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
816
+ if (this.shouldUseIntlApi())
817
+ try {
818
+ return new Intl.PluralRules(J(e === "dev" ? "en" : e), {
819
+ type: t.ordinal ? "ordinal" : "cardinal"
820
+ });
821
+ } catch {
822
+ return;
823
+ }
824
+ return this.rules[e] || this.rules[this.languageUtils.getLanguagePartFromCode(e)];
825
+ }
826
+ needsPlural(e) {
827
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
828
+ const s = this.getRule(e, t);
829
+ return this.shouldUseIntlApi() ? s && s.resolvedOptions().pluralCategories.length > 1 : s && s.numbers.length > 1;
830
+ }
831
+ getPluralFormsOfKey(e, t) {
832
+ let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
833
+ return this.getSuffixes(e, s).map((n) => `${t}${n}`);
834
+ }
835
+ getSuffixes(e) {
836
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
837
+ const s = this.getRule(e, t);
838
+ return s ? this.shouldUseIntlApi() ? s.resolvedOptions().pluralCategories.sort((n, r) => ne[n] - ne[r]).map((n) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${n}`) : s.numbers.map((n) => this.getSuffix(e, n, t)) : [];
839
+ }
840
+ getSuffix(e, t) {
841
+ let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
842
+ const n = this.getRule(e, s);
843
+ return n ? this.shouldUseIntlApi() ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${n.select(t)}` : this.getSuffixRetroCompatible(n, t) : (this.logger.warn(`no plural rule found for: ${e}`), "");
844
+ }
845
+ getSuffixRetroCompatible(e, t) {
846
+ const s = e.noAbs ? e.plurals(t) : e.plurals(Math.abs(t));
847
+ let n = e.numbers[s];
848
+ this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 && (n === 2 ? n = "plural" : n === 1 && (n = ""));
849
+ const r = () => this.options.prepend && n.toString() ? this.options.prepend + n.toString() : n.toString();
850
+ return this.options.compatibilityJSON === "v1" ? n === 1 ? "" : typeof n == "number" ? `_plural_${n.toString()}` : r() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? r() : this.options.prepend && s.toString() ? this.options.prepend + s.toString() : s.toString();
851
+ }
852
+ shouldUseIntlApi() {
853
+ return !Ne.includes(this.options.compatibilityJSON);
854
+ }
855
+ }
856
+ function ie(i, e, t) {
857
+ let s = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, r = be(i, e, t);
858
+ return !r && n && typeof t == "string" && (r = z(i, t, s), r === void 0 && (r = z(e, t, s))), r;
859
+ }
860
+ class $e {
861
+ constructor() {
862
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
863
+ this.logger = N.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((t) => t), this.init(e);
864
+ }
865
+ init() {
866
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
867
+ e.interpolation || (e.interpolation = {
868
+ escapeValue: !0
869
+ });
870
+ const t = e.interpolation;
871
+ this.escape = t.escape !== void 0 ? t.escape : Se, this.escapeValue = t.escapeValue !== void 0 ? t.escapeValue : !0, this.useRawValueToEscape = t.useRawValueToEscape !== void 0 ? t.useRawValueToEscape : !1, this.prefix = t.prefix ? C(t.prefix) : t.prefixEscaped || "{{", this.suffix = t.suffix ? C(t.suffix) : t.suffixEscaped || "}}", this.formatSeparator = t.formatSeparator ? t.formatSeparator : t.formatSeparator || ",", this.unescapePrefix = t.unescapeSuffix ? "" : t.unescapePrefix || "-", this.unescapeSuffix = this.unescapePrefix ? "" : t.unescapeSuffix || "", this.nestingPrefix = t.nestingPrefix ? C(t.nestingPrefix) : t.nestingPrefixEscaped || C("$t("), this.nestingSuffix = t.nestingSuffix ? C(t.nestingSuffix) : t.nestingSuffixEscaped || C(")"), this.nestingOptionsSeparator = t.nestingOptionsSeparator ? t.nestingOptionsSeparator : t.nestingOptionsSeparator || ",", this.maxReplaces = t.maxReplaces ? t.maxReplaces : 1e3, this.alwaysFormat = t.alwaysFormat !== void 0 ? t.alwaysFormat : !1, this.resetRegExp();
872
+ }
873
+ reset() {
874
+ this.options && this.init(this.options);
875
+ }
876
+ resetRegExp() {
877
+ const e = `${this.prefix}(.+?)${this.suffix}`;
878
+ this.regexp = new RegExp(e, "g");
879
+ const t = `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;
880
+ this.regexpUnescape = new RegExp(t, "g");
881
+ const s = `${this.nestingPrefix}(.+?)${this.nestingSuffix}`;
882
+ this.nestingRegexp = new RegExp(s, "g");
883
+ }
884
+ interpolate(e, t, s, n) {
885
+ let r, a, l;
886
+ const o = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
887
+ function f(c) {
888
+ return c.replace(/\$/g, "$$$$");
889
+ }
890
+ const g = (c) => {
891
+ if (c.indexOf(this.formatSeparator) < 0) {
892
+ const x = ie(t, o, c, this.options.keySeparator, this.options.ignoreJSONStructure);
893
+ return this.alwaysFormat ? this.format(x, void 0, s, {
894
+ ...n,
895
+ ...t,
896
+ interpolationkey: c
897
+ }) : x;
898
+ }
899
+ const p = c.split(this.formatSeparator), m = p.shift().trim(), v = p.join(this.formatSeparator).trim();
900
+ return this.format(ie(t, o, m, this.options.keySeparator, this.options.ignoreJSONStructure), v, s, {
901
+ ...n,
902
+ ...t,
903
+ interpolationkey: m
904
+ });
905
+ };
906
+ this.resetRegExp();
907
+ const h = n && n.missingInterpolationHandler || this.options.missingInterpolationHandler, u = n && n.interpolation && n.interpolation.skipOnVariables !== void 0 ? n.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
908
+ return [{
909
+ regex: this.regexpUnescape,
910
+ safeValue: (c) => f(c)
911
+ }, {
912
+ regex: this.regexp,
913
+ safeValue: (c) => this.escapeValue ? f(this.escape(c)) : f(c)
914
+ }].forEach((c) => {
915
+ for (l = 0; r = c.regex.exec(e); ) {
916
+ const p = r[1].trim();
917
+ if (a = g(p), a === void 0)
918
+ if (typeof h == "function") {
919
+ const v = h(e, r, n);
920
+ a = typeof v == "string" ? v : "";
921
+ } else if (n && Object.prototype.hasOwnProperty.call(n, p))
922
+ a = "";
923
+ else if (u) {
924
+ a = r[0];
925
+ continue;
926
+ } else
927
+ this.logger.warn(`missed to pass in variable ${p} for interpolating ${e}`), a = "";
928
+ else
929
+ typeof a != "string" && !this.useRawValueToEscape && (a = q(a));
930
+ const m = c.safeValue(a);
931
+ if (e = e.replace(r[0], m), u ? (c.regex.lastIndex += a.length, c.regex.lastIndex -= r[0].length) : c.regex.lastIndex = 0, l++, l >= this.maxReplaces)
932
+ break;
933
+ }
934
+ }), e;
935
+ }
936
+ nest(e, t) {
937
+ let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n, r, a;
938
+ function l(o, f) {
939
+ const g = this.nestingOptionsSeparator;
940
+ if (o.indexOf(g) < 0)
941
+ return o;
942
+ const h = o.split(new RegExp(`${g}[ ]*{`));
943
+ let u = `{${h[1]}`;
944
+ o = h[0], u = this.interpolate(u, a);
945
+ const d = u.match(/'/g), c = u.match(/"/g);
946
+ (d && d.length % 2 === 0 && !c || c.length % 2 !== 0) && (u = u.replace(/'/g, '"'));
947
+ try {
948
+ a = JSON.parse(u), f && (a = {
949
+ ...f,
950
+ ...a
951
+ });
952
+ } catch (p) {
953
+ return this.logger.warn(`failed parsing options string in nesting for key ${o}`, p), `${o}${g}${u}`;
954
+ }
955
+ return delete a.defaultValue, o;
956
+ }
957
+ for (; n = this.nestingRegexp.exec(e); ) {
958
+ let o = [];
959
+ a = {
960
+ ...s
961
+ }, a = a.replace && typeof a.replace != "string" ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
962
+ let f = !1;
963
+ if (n[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(n[1])) {
964
+ const g = n[1].split(this.formatSeparator).map((h) => h.trim());
965
+ n[1] = g.shift(), o = g, f = !0;
966
+ }
967
+ if (r = t(l.call(this, n[1].trim(), a), a), r && n[0] === e && typeof r != "string")
968
+ return r;
969
+ typeof r != "string" && (r = q(r)), r || (this.logger.warn(`missed to resolve ${n[1]} for nesting ${e}`), r = ""), f && (r = o.reduce((g, h) => this.format(g, h, s.lng, {
970
+ ...s,
971
+ interpolationkey: n[1].trim()
972
+ }), r.trim())), e = e.replace(n[0], r), this.regexp.lastIndex = 0;
973
+ }
974
+ return e;
975
+ }
976
+ }
977
+ function ke(i) {
978
+ let e = i.toLowerCase().trim();
979
+ const t = {};
980
+ if (i.indexOf("(") > -1) {
981
+ const s = i.split("(");
982
+ e = s[0].toLowerCase().trim();
983
+ const n = s[1].substring(0, s[1].length - 1);
984
+ e === "currency" && n.indexOf(":") < 0 ? t.currency || (t.currency = n.trim()) : e === "relativetime" && n.indexOf(":") < 0 ? t.range || (t.range = n.trim()) : n.split(";").forEach((a) => {
985
+ if (!a)
986
+ return;
987
+ const [l, ...o] = a.split(":"), f = o.join(":").trim().replace(/^'+|'+$/g, "");
988
+ t[l.trim()] || (t[l.trim()] = f), f === "false" && (t[l.trim()] = !1), f === "true" && (t[l.trim()] = !0), isNaN(f) || (t[l.trim()] = parseInt(f, 10));
989
+ });
990
+ }
991
+ return {
992
+ formatName: e,
993
+ formatOptions: t
994
+ };
995
+ }
996
+ function $(i) {
997
+ const e = {};
998
+ return function(s, n, r) {
999
+ const a = n + JSON.stringify(r);
1000
+ let l = e[a];
1001
+ return l || (l = i(J(n), r), e[a] = l), l(s);
1002
+ };
1003
+ }
1004
+ class Ee {
1005
+ constructor() {
1006
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1007
+ this.logger = N.create("formatter"), this.options = e, this.formats = {
1008
+ number: $((t, s) => {
1009
+ const n = new Intl.NumberFormat(t, {
1010
+ ...s
1011
+ });
1012
+ return (r) => n.format(r);
1013
+ }),
1014
+ currency: $((t, s) => {
1015
+ const n = new Intl.NumberFormat(t, {
1016
+ ...s,
1017
+ style: "currency"
1018
+ });
1019
+ return (r) => n.format(r);
1020
+ }),
1021
+ datetime: $((t, s) => {
1022
+ const n = new Intl.DateTimeFormat(t, {
1023
+ ...s
1024
+ });
1025
+ return (r) => n.format(r);
1026
+ }),
1027
+ relativetime: $((t, s) => {
1028
+ const n = new Intl.RelativeTimeFormat(t, {
1029
+ ...s
1030
+ });
1031
+ return (r) => n.format(r, s.range || "day");
1032
+ }),
1033
+ list: $((t, s) => {
1034
+ const n = new Intl.ListFormat(t, {
1035
+ ...s
1036
+ });
1037
+ return (r) => n.format(r);
1038
+ })
1039
+ }, this.init(e);
1040
+ }
1041
+ init(e) {
1042
+ const s = (arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
1043
+ interpolation: {}
1044
+ }).interpolation;
1045
+ this.formatSeparator = s.formatSeparator ? s.formatSeparator : s.formatSeparator || ",";
1046
+ }
1047
+ add(e, t) {
1048
+ this.formats[e.toLowerCase().trim()] = t;
1049
+ }
1050
+ addCached(e, t) {
1051
+ this.formats[e.toLowerCase().trim()] = $(t);
1052
+ }
1053
+ format(e, t, s) {
1054
+ let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1055
+ return t.split(this.formatSeparator).reduce((l, o) => {
1056
+ const {
1057
+ formatName: f,
1058
+ formatOptions: g
1059
+ } = ke(o);
1060
+ if (this.formats[f]) {
1061
+ let h = l;
1062
+ try {
1063
+ const u = n && n.formatParams && n.formatParams[n.interpolationkey] || {}, d = u.locale || u.lng || n.locale || n.lng || s;
1064
+ h = this.formats[f](l, d, {
1065
+ ...g,
1066
+ ...n,
1067
+ ...u
1068
+ });
1069
+ } catch (u) {
1070
+ this.logger.warn(u);
1071
+ }
1072
+ return h;
1073
+ } else
1074
+ this.logger.warn(`there was no format function for ${f}`);
1075
+ return l;
1076
+ }, e);
1077
+ }
1078
+ }
1079
+ function Fe(i, e) {
1080
+ i.pending[e] !== void 0 && (delete i.pending[e], i.pendingCount--);
1081
+ }
1082
+ class je extends W {
1083
+ constructor(e, t, s) {
1084
+ let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1085
+ super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = n, this.logger = N.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = n.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = n.maxRetries >= 0 ? n.maxRetries : 5, this.retryTimeout = n.retryTimeout >= 1 ? n.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(s, n.backend, n);
1086
+ }
1087
+ queueLoad(e, t, s, n) {
1088
+ const r = {}, a = {}, l = {}, o = {};
1089
+ return e.forEach((f) => {
1090
+ let g = !0;
1091
+ t.forEach((h) => {
1092
+ const u = `${f}|${h}`;
1093
+ !s.reload && this.store.hasResourceBundle(f, h) ? this.state[u] = 2 : this.state[u] < 0 || (this.state[u] === 1 ? a[u] === void 0 && (a[u] = !0) : (this.state[u] = 1, g = !1, a[u] === void 0 && (a[u] = !0), r[u] === void 0 && (r[u] = !0), o[h] === void 0 && (o[h] = !0)));
1094
+ }), g || (l[f] = !0);
1095
+ }), (Object.keys(r).length || Object.keys(a).length) && this.queue.push({
1096
+ pending: a,
1097
+ pendingCount: Object.keys(a).length,
1098
+ loaded: {},
1099
+ errors: [],
1100
+ callback: n
1101
+ }), {
1102
+ toLoad: Object.keys(r),
1103
+ pending: Object.keys(a),
1104
+ toLoadLanguages: Object.keys(l),
1105
+ toLoadNamespaces: Object.keys(o)
1106
+ };
1107
+ }
1108
+ loaded(e, t, s) {
1109
+ const n = e.split("|"), r = n[0], a = n[1];
1110
+ t && this.emit("failedLoading", r, a, t), s && this.store.addResourceBundle(r, a, s), this.state[e] = t ? -1 : 2;
1111
+ const l = {};
1112
+ this.queue.forEach((o) => {
1113
+ ye(o.loaded, [r], a), Fe(o, e), t && o.errors.push(t), o.pendingCount === 0 && !o.done && (Object.keys(o.loaded).forEach((f) => {
1114
+ l[f] || (l[f] = {});
1115
+ const g = o.loaded[f];
1116
+ g.length && g.forEach((h) => {
1117
+ l[f][h] === void 0 && (l[f][h] = !0);
1118
+ });
1119
+ }), o.done = !0, o.errors.length ? o.callback(o.errors) : o.callback());
1120
+ }), this.emit("loaded", l), this.queue = this.queue.filter((o) => !o.done);
1121
+ }
1122
+ read(e, t, s) {
1123
+ let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0, r = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : this.retryTimeout, a = arguments.length > 5 ? arguments[5] : void 0;
1124
+ if (!e.length)
1125
+ return a(null, {});
1126
+ if (this.readingCalls >= this.maxParallelReads) {
1127
+ this.waitingReads.push({
1128
+ lng: e,
1129
+ ns: t,
1130
+ fcName: s,
1131
+ tried: n,
1132
+ wait: r,
1133
+ callback: a
1134
+ });
1135
+ return;
1136
+ }
1137
+ this.readingCalls++;
1138
+ const l = (f, g) => {
1139
+ if (this.readingCalls--, this.waitingReads.length > 0) {
1140
+ const h = this.waitingReads.shift();
1141
+ this.read(h.lng, h.ns, h.fcName, h.tried, h.wait, h.callback);
1142
+ }
1143
+ if (f && g && n < this.maxRetries) {
1144
+ setTimeout(() => {
1145
+ this.read.call(this, e, t, s, n + 1, r * 2, a);
1146
+ }, r);
1147
+ return;
1148
+ }
1149
+ a(f, g);
1150
+ }, o = this.backend[s].bind(this.backend);
1151
+ if (o.length === 2) {
1152
+ try {
1153
+ const f = o(e, t);
1154
+ f && typeof f.then == "function" ? f.then((g) => l(null, g)).catch(l) : l(null, f);
1155
+ } catch (f) {
1156
+ l(f);
1157
+ }
1158
+ return;
1159
+ }
1160
+ return o(e, t, l);
1161
+ }
1162
+ prepareLoading(e, t) {
1163
+ let s = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = arguments.length > 3 ? arguments[3] : void 0;
1164
+ if (!this.backend)
1165
+ return this.logger.warn("No backend was added via i18next.use. Will not load resources."), n && n();
1166
+ typeof e == "string" && (e = this.languageUtils.toResolveHierarchy(e)), typeof t == "string" && (t = [t]);
1167
+ const r = this.queueLoad(e, t, s, n);
1168
+ if (!r.toLoad.length)
1169
+ return r.pending.length || n(), null;
1170
+ r.toLoad.forEach((a) => {
1171
+ this.loadOne(a);
1172
+ });
1173
+ }
1174
+ load(e, t, s) {
1175
+ this.prepareLoading(e, t, {}, s);
1176
+ }
1177
+ reload(e, t, s) {
1178
+ this.prepareLoading(e, t, {
1179
+ reload: !0
1180
+ }, s);
1181
+ }
1182
+ loadOne(e) {
1183
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
1184
+ const s = e.split("|"), n = s[0], r = s[1];
1185
+ this.read(n, r, "read", void 0, void 0, (a, l) => {
1186
+ a && this.logger.warn(`${t}loading namespace ${r} for language ${n} failed`, a), !a && l && this.logger.log(`${t}loaded namespace ${r} for language ${n}`, l), this.loaded(e, a, l);
1187
+ });
1188
+ }
1189
+ saveMissing(e, t, s, n, r) {
1190
+ let a = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {}, l = arguments.length > 6 && arguments[6] !== void 0 ? arguments[6] : () => {
1191
+ };
1192
+ if (this.services.utils && this.services.utils.hasLoadedNamespace && !this.services.utils.hasLoadedNamespace(t)) {
1193
+ this.logger.warn(`did not save key "${s}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1194
+ return;
1195
+ }
1196
+ if (!(s == null || s === "")) {
1197
+ if (this.backend && this.backend.create) {
1198
+ const o = {
1199
+ ...a,
1200
+ isUpdate: r
1201
+ }, f = this.backend.create.bind(this.backend);
1202
+ if (f.length < 6)
1203
+ try {
1204
+ let g;
1205
+ f.length === 5 ? g = f(e, t, s, n, o) : g = f(e, t, s, n), g && typeof g.then == "function" ? g.then((h) => l(null, h)).catch(l) : l(null, g);
1206
+ } catch (g) {
1207
+ l(g);
1208
+ }
1209
+ else
1210
+ f(e, t, s, n, l, o);
1211
+ }
1212
+ !e || !e[0] || this.store.addResource(e[0], t, s, n);
1213
+ }
1214
+ }
1215
+ }
1216
+ function re() {
1217
+ return {
1218
+ debug: !1,
1219
+ initImmediate: !0,
1220
+ ns: ["translation"],
1221
+ defaultNS: ["translation"],
1222
+ fallbackLng: ["dev"],
1223
+ fallbackNS: !1,
1224
+ supportedLngs: !1,
1225
+ nonExplicitSupportedLngs: !1,
1226
+ load: "all",
1227
+ preload: !1,
1228
+ simplifyPluralSuffix: !0,
1229
+ keySeparator: ".",
1230
+ nsSeparator: ":",
1231
+ pluralSeparator: "_",
1232
+ contextSeparator: "_",
1233
+ partialBundledLanguages: !1,
1234
+ saveMissing: !1,
1235
+ updateMissing: !1,
1236
+ saveMissingTo: "fallback",
1237
+ saveMissingPlurals: !0,
1238
+ missingKeyHandler: !1,
1239
+ missingInterpolationHandler: !1,
1240
+ postProcess: !1,
1241
+ postProcessPassResolved: !1,
1242
+ returnNull: !1,
1243
+ returnEmptyString: !0,
1244
+ returnObjects: !1,
1245
+ joinArrays: !1,
1246
+ returnedObjectHandler: !1,
1247
+ parseMissingKeyHandler: !1,
1248
+ appendNamespaceToMissingKey: !1,
1249
+ appendNamespaceToCIMode: !1,
1250
+ overloadTranslationOptionHandler: function(e) {
1251
+ let t = {};
1252
+ if (typeof e[1] == "object" && (t = e[1]), typeof e[1] == "string" && (t.defaultValue = e[1]), typeof e[2] == "string" && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1253
+ const s = e[3] || e[2];
1254
+ Object.keys(s).forEach((n) => {
1255
+ t[n] = s[n];
1256
+ });
1257
+ }
1258
+ return t;
1259
+ },
1260
+ interpolation: {
1261
+ escapeValue: !0,
1262
+ format: (i) => i,
1263
+ prefix: "{{",
1264
+ suffix: "}}",
1265
+ formatSeparator: ",",
1266
+ unescapePrefix: "-",
1267
+ nestingPrefix: "$t(",
1268
+ nestingSuffix: ")",
1269
+ nestingOptionsSeparator: ",",
1270
+ maxReplaces: 1e3,
1271
+ skipOnVariables: !0
1272
+ }
1273
+ };
1274
+ }
1275
+ function ae(i) {
1276
+ return typeof i.ns == "string" && (i.ns = [i.ns]), typeof i.fallbackLng == "string" && (i.fallbackLng = [i.fallbackLng]), typeof i.fallbackNS == "string" && (i.fallbackNS = [i.fallbackNS]), i.supportedLngs && i.supportedLngs.indexOf("cimode") < 0 && (i.supportedLngs = i.supportedLngs.concat(["cimode"])), i;
1277
+ }
1278
+ function U() {
1279
+ }
1280
+ function Ie(i) {
1281
+ Object.getOwnPropertyNames(Object.getPrototypeOf(i)).forEach((t) => {
1282
+ typeof i[t] == "function" && (i[t] = i[t].bind(i));
1283
+ });
1284
+ }
1285
+ class A extends W {
1286
+ constructor() {
1287
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1288
+ if (super(), this.options = ae(e), this.services = {}, this.logger = N, this.modules = {
1289
+ external: []
1290
+ }, Ie(this), t && !this.isInitialized && !e.isClone) {
1291
+ if (!this.options.initImmediate)
1292
+ return this.init(e, t), this;
1293
+ setTimeout(() => {
1294
+ this.init(e, t);
1295
+ }, 0);
1296
+ }
1297
+ }
1298
+ init() {
1299
+ var e = this;
1300
+ let t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, s = arguments.length > 1 ? arguments[1] : void 0;
1301
+ typeof t == "function" && (s = t, t = {}), !t.defaultNS && t.defaultNS !== !1 && t.ns && (typeof t.ns == "string" ? t.defaultNS = t.ns : t.ns.indexOf("translation") < 0 && (t.defaultNS = t.ns[0]));
1302
+ const n = re();
1303
+ this.options = {
1304
+ ...n,
1305
+ ...this.options,
1306
+ ...ae(t)
1307
+ }, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = {
1308
+ ...n.interpolation,
1309
+ ...this.options.interpolation
1310
+ }), t.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = t.keySeparator), t.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = t.nsSeparator);
1311
+ function r(g) {
1312
+ return g ? typeof g == "function" ? new g() : g : null;
1313
+ }
1314
+ if (!this.options.isClone) {
1315
+ this.modules.logger ? N.init(r(this.modules.logger), this.options) : N.init(null, this.options);
1316
+ let g;
1317
+ this.modules.formatter ? g = this.modules.formatter : typeof Intl < "u" && (g = Ee);
1318
+ const h = new se(this.options);
1319
+ this.store = new ee(this.options.resources, this.options);
1320
+ const u = this.services;
1321
+ u.logger = N, u.resourceStore = this.store, u.languageUtils = h, u.pluralResolver = new Ce(h, {
1322
+ prepend: this.options.pluralSeparator,
1323
+ compatibilityJSON: this.options.compatibilityJSON,
1324
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1325
+ }), g && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (u.formatter = r(g), u.formatter.init(u, this.options), this.options.interpolation.format = u.formatter.format.bind(u.formatter)), u.interpolator = new $e(this.options), u.utils = {
1326
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1327
+ }, u.backendConnector = new je(r(this.modules.backend), u.resourceStore, u, this.options), u.backendConnector.on("*", function(d) {
1328
+ for (var c = arguments.length, p = new Array(c > 1 ? c - 1 : 0), m = 1; m < c; m++)
1329
+ p[m - 1] = arguments[m];
1330
+ e.emit(d, ...p);
1331
+ }), this.modules.languageDetector && (u.languageDetector = r(this.modules.languageDetector), u.languageDetector.init && u.languageDetector.init(u, this.options.detection, this.options)), this.modules.i18nFormat && (u.i18nFormat = r(this.modules.i18nFormat), u.i18nFormat.init && u.i18nFormat.init(this)), this.translator = new B(this.services, this.options), this.translator.on("*", function(d) {
1332
+ for (var c = arguments.length, p = new Array(c > 1 ? c - 1 : 0), m = 1; m < c; m++)
1333
+ p[m - 1] = arguments[m];
1334
+ e.emit(d, ...p);
1335
+ }), this.modules.external.forEach((d) => {
1336
+ d.init && d.init(this);
1337
+ });
1338
+ }
1339
+ if (this.format = this.options.interpolation.format, s || (s = U), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1340
+ const g = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1341
+ g.length > 0 && g[0] !== "dev" && (this.options.lng = g[0]);
1342
+ }
1343
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((g) => {
1344
+ this[g] = function() {
1345
+ return e.store[g](...arguments);
1346
+ };
1347
+ }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((g) => {
1348
+ this[g] = function() {
1349
+ return e.store[g](...arguments), e;
1350
+ };
1351
+ });
1352
+ const o = I(), f = () => {
1353
+ const g = (h, u) => {
1354
+ 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(u), s(h, u);
1355
+ };
1356
+ if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized)
1357
+ return g(null, this.t.bind(this));
1358
+ this.changeLanguage(this.options.lng, g);
1359
+ };
1360
+ return this.options.resources || !this.options.initImmediate ? f() : setTimeout(f, 0), o;
1361
+ }
1362
+ loadResources(e) {
1363
+ let s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : U;
1364
+ const n = typeof e == "string" ? e : this.language;
1365
+ if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1366
+ if (n && n.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0))
1367
+ return s();
1368
+ const r = [], a = (l) => {
1369
+ if (!l || l === "cimode")
1370
+ return;
1371
+ this.services.languageUtils.toResolveHierarchy(l).forEach((f) => {
1372
+ f !== "cimode" && r.indexOf(f) < 0 && r.push(f);
1373
+ });
1374
+ };
1375
+ n ? a(n) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((o) => a(o)), this.options.preload && this.options.preload.forEach((l) => a(l)), this.services.backendConnector.load(r, this.options.ns, (l) => {
1376
+ !l && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(l);
1377
+ });
1378
+ } else
1379
+ s(null);
1380
+ }
1381
+ reloadResources(e, t, s) {
1382
+ const n = I();
1383
+ return e || (e = this.languages), t || (t = this.options.ns), s || (s = U), this.services.backendConnector.reload(e, t, (r) => {
1384
+ n.resolve(), s(r);
1385
+ }), n;
1386
+ }
1387
+ use(e) {
1388
+ if (!e)
1389
+ throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1390
+ if (!e.type)
1391
+ throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1392
+ 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" && le.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1393
+ }
1394
+ setResolvedLanguage(e) {
1395
+ if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
1396
+ for (let t = 0; t < this.languages.length; t++) {
1397
+ const s = this.languages[t];
1398
+ if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1399
+ this.resolvedLanguage = s;
1400
+ break;
1401
+ }
1402
+ }
1403
+ }
1404
+ changeLanguage(e, t) {
1405
+ var s = this;
1406
+ this.isLanguageChangingTo = e;
1407
+ const n = I();
1408
+ this.emit("languageChanging", e);
1409
+ const r = (o) => {
1410
+ this.language = o, this.languages = this.services.languageUtils.toResolveHierarchy(o), this.resolvedLanguage = void 0, this.setResolvedLanguage(o);
1411
+ }, a = (o, f) => {
1412
+ f ? (r(f), this.translator.changeLanguage(f), this.isLanguageChangingTo = void 0, this.emit("languageChanged", f), this.logger.log("languageChanged", f)) : this.isLanguageChangingTo = void 0, n.resolve(function() {
1413
+ return s.t(...arguments);
1414
+ }), t && t(o, function() {
1415
+ return s.t(...arguments);
1416
+ });
1417
+ }, l = (o) => {
1418
+ !e && !o && this.services.languageDetector && (o = []);
1419
+ const f = typeof o == "string" ? o : this.services.languageUtils.getBestMatchFromCodes(o);
1420
+ f && (this.language || r(f), this.translator.language || this.translator.changeLanguage(f), this.services.languageDetector && this.services.languageDetector.cacheUserLanguage && this.services.languageDetector.cacheUserLanguage(f)), this.loadResources(f, (g) => {
1421
+ a(g, f);
1422
+ });
1423
+ };
1424
+ return !e && this.services.languageDetector && !this.services.languageDetector.async ? l(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(l) : this.services.languageDetector.detect(l) : l(e), n;
1425
+ }
1426
+ getFixedT(e, t, s) {
1427
+ var n = this;
1428
+ const r = function(a, l) {
1429
+ let o;
1430
+ if (typeof l != "object") {
1431
+ for (var f = arguments.length, g = new Array(f > 2 ? f - 2 : 0), h = 2; h < f; h++)
1432
+ g[h - 2] = arguments[h];
1433
+ o = n.options.overloadTranslationOptionHandler([a, l].concat(g));
1434
+ } else
1435
+ o = {
1436
+ ...l
1437
+ };
1438
+ o.lng = o.lng || r.lng, o.lngs = o.lngs || r.lngs, o.ns = o.ns || r.ns, o.keyPrefix = o.keyPrefix || s || r.keyPrefix;
1439
+ const u = n.options.keySeparator || ".";
1440
+ let d;
1441
+ return o.keyPrefix && Array.isArray(a) ? d = a.map((c) => `${o.keyPrefix}${u}${c}`) : d = o.keyPrefix ? `${o.keyPrefix}${u}${a}` : a, n.t(d, o);
1442
+ };
1443
+ return typeof e == "string" ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = s, r;
1444
+ }
1445
+ t() {
1446
+ return this.translator && this.translator.translate(...arguments);
1447
+ }
1448
+ exists() {
1449
+ return this.translator && this.translator.exists(...arguments);
1450
+ }
1451
+ setDefaultNamespace(e) {
1452
+ this.options.defaultNS = e;
1453
+ }
1454
+ hasLoadedNamespace(e) {
1455
+ let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1456
+ if (!this.isInitialized)
1457
+ return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1458
+ if (!this.languages || !this.languages.length)
1459
+ return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1460
+ const s = t.lng || this.resolvedLanguage || this.languages[0], n = this.options ? this.options.fallbackLng : !1, r = this.languages[this.languages.length - 1];
1461
+ if (s.toLowerCase() === "cimode")
1462
+ return !0;
1463
+ const a = (l, o) => {
1464
+ const f = this.services.backendConnector.state[`${l}|${o}`];
1465
+ return f === -1 || f === 2;
1466
+ };
1467
+ if (t.precheck) {
1468
+ const l = t.precheck(this, a);
1469
+ if (l !== void 0)
1470
+ return l;
1471
+ }
1472
+ return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(s, e) && (!n || a(r, e)));
1473
+ }
1474
+ loadNamespaces(e, t) {
1475
+ const s = I();
1476
+ return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach((n) => {
1477
+ this.options.ns.indexOf(n) < 0 && this.options.ns.push(n);
1478
+ }), this.loadResources((n) => {
1479
+ s.resolve(), t && t(n);
1480
+ }), s) : (t && t(), Promise.resolve());
1481
+ }
1482
+ loadLanguages(e, t) {
1483
+ const s = I();
1484
+ typeof e == "string" && (e = [e]);
1485
+ const n = this.options.preload || [], r = e.filter((a) => n.indexOf(a) < 0);
1486
+ return r.length ? (this.options.preload = n.concat(r), this.loadResources((a) => {
1487
+ s.resolve(), t && t(a);
1488
+ }), s) : (t && t(), Promise.resolve());
1489
+ }
1490
+ dir(e) {
1491
+ if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e)
1492
+ return "rtl";
1493
+ const t = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], s = this.services && this.services.languageUtils || new se(re());
1494
+ return t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1495
+ }
1496
+ static createInstance() {
1497
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 ? arguments[1] : void 0;
1498
+ return new A(e, t);
1499
+ }
1500
+ cloneInstance() {
1501
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : U;
1502
+ const s = e.forkResourceStore;
1503
+ s && delete e.forkResourceStore;
1504
+ const n = {
1505
+ ...this.options,
1506
+ ...e,
1507
+ isClone: !0
1508
+ }, r = new A(n);
1509
+ return (e.debug !== void 0 || e.prefix !== void 0) && (r.logger = r.logger.clone(e)), ["store", "services", "language"].forEach((l) => {
1510
+ r[l] = this[l];
1511
+ }), r.services = {
1512
+ ...this.services
1513
+ }, r.services.utils = {
1514
+ hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1515
+ }, s && (r.store = new ee(this.store.data, n), r.services.resourceStore = r.store), r.translator = new B(r.services, n), r.translator.on("*", function(l) {
1516
+ for (var o = arguments.length, f = new Array(o > 1 ? o - 1 : 0), g = 1; g < o; g++)
1517
+ f[g - 1] = arguments[g];
1518
+ r.emit(l, ...f);
1519
+ }), r.init(n, t), r.translator.options = n, r.translator.backendConnector.services.utils = {
1520
+ hasLoadedNamespace: r.hasLoadedNamespace.bind(r)
1521
+ }, r;
1522
+ }
1523
+ toJSON() {
1524
+ return {
1525
+ options: this.options,
1526
+ store: this.store,
1527
+ language: this.language,
1528
+ languages: this.languages,
1529
+ resolvedLanguage: this.resolvedLanguage
1530
+ };
1531
+ }
1532
+ }
1533
+ const b = A.createInstance();
1534
+ b.createInstance = A.createInstance;
1535
+ b.createInstance;
1536
+ b.dir;
1537
+ b.init;
1538
+ b.loadResources;
1539
+ b.reloadResources;
1540
+ b.use;
1541
+ b.changeLanguage;
1542
+ b.getFixedT;
1543
+ const K = b.t;
1544
+ b.exists;
1545
+ b.setDefaultNamespace;
1546
+ b.hasLoadedNamespace;
1547
+ b.loadNamespaces;
1548
+ b.loadLanguages;
1549
+ const Ae = {
1550
+ es: {
1551
+ translation: {
1552
+ ...he
1553
+ }
1554
+ }
1555
+ };
1556
+ b.init({
1557
+ resources: Ae,
1558
+ lng: "es",
1559
+ // language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
1560
+ // you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
1561
+ // if you're using a language detector, do not define the lng option
1562
+ supportedLngs: ["es", "en"],
1563
+ interpolation: {
1564
+ escapeValue: !1
1565
+ // react already safes from xss
1566
+ },
1567
+ debug: !1
1568
+ });
1569
+ const R = {
1570
+ // EXAMPLE ERROR
1571
+ "MP-001": {
1572
+ code: 400,
1573
+ type: "modal",
1574
+ message: "errors.MP-001.message",
1575
+ title: "errors.MP-001.title",
1576
+ level: "info"
1577
+ },
1578
+ UNAUTHORIZED: {
1579
+ level: "error",
1580
+ type: "modal",
1581
+ message: "errors.UnAuthorized.message",
1582
+ title: "errors.UnAuthorized.title",
1583
+ code: 310
1584
+ },
1585
+ "ERR-GENERAL-01": {
1586
+ level: "error",
1587
+ type: "modal",
1588
+ message: "errors.ERR-GENERAL-01.message",
1589
+ title: "errors.ERR-GENERAL-01.title",
1590
+ code: 400
1591
+ },
1592
+ internalError: {
1593
+ level: "error",
1594
+ type: "modal",
1595
+ message: "errors.internalError.message",
1596
+ title: "errors.internalError.title",
1597
+ code: 500
1598
+ },
1599
+ default: {
1600
+ code: 520,
1601
+ type: "modal",
1602
+ message: "errors.default.message",
1603
+ title: "errors.default.title",
1604
+ level: "warning"
1605
+ }
1606
+ };
1607
+ class De extends ce {
1608
+ get(e = "default", t) {
1609
+ var r, a;
1610
+ if (e instanceof Error)
1611
+ return this.logError(e.message), {
1612
+ ...R.internalError,
1613
+ title: K(R.internalError.title),
1614
+ message: K(R.internalError.message),
1615
+ uuid: t
1616
+ };
1617
+ const s = typeof e == "string" ? e : e.code ?? e.errorType, n = typeof e == "string" ? {} : { ...e };
1618
+ return {
1619
+ ...R[s] ?? R.default,
1620
+ title: K(
1621
+ ((r = R[s]) == null ? void 0 : r.title) ?? R.default.title,
1622
+ n
1623
+ ),
1624
+ message: K(
1625
+ ((a = R[s]) == null ? void 0 : a.message) ?? R.default.message,
1626
+ n
1627
+ ),
1628
+ uuid: t
1629
+ };
1630
+ }
1631
+ }
1632
+ class He extends ge {
1633
+ async validateTokenFront(e, t, s) {
1634
+ this.logDebug("entra validate Token Front");
1635
+ const n = de(e, t, s);
1636
+ if (this.logDebug("Token Front", JSON.stringify(n)), !n)
1637
+ throw new De().get("UNAUTHORIZED");
1638
+ return e;
1639
+ }
1640
+ }
1641
+ export {
1642
+ He as C,
1643
+ De as E
1644
+ };