mp-front-cli 0.0.55 → 0.0.57

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