@ogcio/design-system-react 1.32.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/dist/accordion/accordion-item.js +62 -57
  2. package/dist/alert/alert.js +37 -39
  3. package/dist/alert/variants.d.ts +49 -52
  4. package/dist/alert/variants.js +17 -18
  5. package/dist/atoms/Button.d.ts +2 -2
  6. package/dist/atoms/Button.js +3 -2
  7. package/dist/atoms/heading/styles.js +1 -1
  8. package/dist/atoms/storybook/Heading.meta.d.ts +1 -1
  9. package/dist/atoms/storybook/Heading.meta.js +4 -4
  10. package/dist/atoms/storybook/Icons.meta.d.ts +1 -1
  11. package/dist/atoms/storybook/Icons.meta.js +7 -7
  12. package/dist/atoms/storybook/InsetText.meta.d.ts +1 -1
  13. package/dist/atoms/storybook/InsetText.meta.js +1 -1
  14. package/dist/atoms/storybook/Logos.meta.d.ts +1 -1
  15. package/dist/atoms/storybook/Logos.meta.js +1 -1
  16. package/dist/autocomplete/autocomplete.js +1 -1
  17. package/dist/autocomplete/use-autocomplete-controller.js +2 -2
  18. package/dist/browser-support/browser-support.js +202 -30
  19. package/dist/button/button.d.ts +2 -9
  20. package/dist/button/button.js +65 -32
  21. package/dist/button/helpers.d.ts +2 -1
  22. package/dist/button/types.d.ts +25 -8
  23. package/dist/button-group/button-group.js +43 -45
  24. package/dist/button-group/types.d.ts +5 -5
  25. package/dist/card/card-legacy.js +1 -1
  26. package/dist/card/types.d.ts +1 -1
  27. package/dist/chip/chip.js +1 -1
  28. package/dist/combo-box/dropdown-item.js +1 -1
  29. package/dist/cookie-banner/cookie-banner.d.ts +1 -1
  30. package/dist/data-table/data-table-footer.js +2 -2
  31. package/dist/data-table/data-table-header.js +2 -2
  32. package/dist/data-table/data-table-selected-rows.js +1 -1
  33. package/dist/data-table/editable-table-cell.js +1 -1
  34. package/dist/details/details.js +13 -16
  35. package/dist/drawer/drawer.d.ts +1 -1
  36. package/dist/drawer/drawer.js +18 -18
  37. package/dist/error-text/error-text.js +28 -27
  38. package/dist/forms/form-field/form-field.js +24 -25
  39. package/dist/header/components/header-search.js +2 -2
  40. package/dist/header/header-legacy.js +6 -6
  41. package/dist/header/header-next/header-next.js +3 -3
  42. package/dist/header/variants.js +1 -1
  43. package/dist/hint-text/hint-text.js +26 -20
  44. package/dist/i18n/config.js +2 -2
  45. package/dist/i18n/utility.js +1 -1
  46. package/dist/{i18nInstance-AYICsHJu.js → i18nInstance-DiZ0lVPL.js} +2 -2
  47. package/dist/i18next-zBkzxGW1.js +1388 -0
  48. package/dist/icon-button/icon-button.d.ts +3 -5
  49. package/dist/{index-CB-zPpNk.js → index-C7W4ssMN.js} +1 -1
  50. package/dist/index-DqBV2TCd.js +23108 -0
  51. package/dist/index.d.ts +1 -1
  52. package/dist/index.js +1 -1
  53. package/dist/label/label.d.ts +78 -30
  54. package/dist/label/label.js +29 -14
  55. package/dist/{lodash-82PmXrjJ.js → lodash-DTZaBYO8.js} +289 -272
  56. package/dist/modal/modal.content.js +2 -2
  57. package/dist/modal/modal.js +38 -38
  58. package/dist/modal/types.d.ts +5 -4
  59. package/dist/pagination/pagination.js +82 -80
  60. package/dist/progress-stepper/progress-stepper.js +1 -1
  61. package/dist/score-select/type.d.ts +2 -2
  62. package/dist/select/select-native.js +1 -1
  63. package/dist/select/select-next.js +87 -87
  64. package/dist/side-nav/side-nav.js +1 -1
  65. package/dist/spinner/spinner.js +1 -1
  66. package/dist/stack/stack.js +2 -2
  67. package/dist/styles.css +1 -1
  68. package/dist/table/table.js +1 -1
  69. package/dist/tabs/tab-item.js +53 -71
  70. package/dist/tabs/variants.d.ts +269 -0
  71. package/dist/tabs/variants.js +87 -0
  72. package/dist/toast/ds-toast.js +1 -1
  73. package/dist/tooltip/tooltip.js +27 -35
  74. package/dist/tooltip/variants.d.ts +115 -0
  75. package/dist/tooltip/variants.js +59 -0
  76. package/dist/{useTranslation-DiBQuy8S.js → useTranslation-CRbS3UeG.js} +94 -85
  77. package/package.json +14 -7
  78. package/dist/i18next-Bfi2-LyH.js +0 -1370
  79. package/dist/index-Bh2cTIps.js +0 -33899
@@ -0,0 +1,1388 @@
1
+ const g = (o) => typeof o == "string", K = () => {
2
+ let o, e;
3
+ const t = new Promise((s, i) => {
4
+ o = s, e = i;
5
+ });
6
+ return t.resolve = o, t.reject = e, t;
7
+ }, ne = (o) => o == null ? "" : "" + o, we = (o, e, t) => {
8
+ o.forEach((s) => {
9
+ e[s] && (t[s] = e[s]);
10
+ });
11
+ }, Ce = /###/g, re = (o) => o && o.indexOf("###") > -1 ? o.replace(Ce, ".") : o, ae = (o) => !o || g(o), U = (o, e, t) => {
12
+ const s = g(e) ? e.split(".") : e;
13
+ let i = 0;
14
+ for (; i < s.length - 1; ) {
15
+ if (ae(o)) return {};
16
+ const n = re(s[i]);
17
+ !o[n] && t && (o[n] = new t()), Object.prototype.hasOwnProperty.call(o, n) ? o = o[n] : o = {}, ++i;
18
+ }
19
+ return ae(o) ? {} : {
20
+ obj: o,
21
+ k: re(s[i])
22
+ };
23
+ }, oe = (o, e, t) => {
24
+ const {
25
+ obj: s,
26
+ k: i
27
+ } = U(o, e, Object);
28
+ if (s !== void 0 || e.length === 1) {
29
+ s[i] = t;
30
+ return;
31
+ }
32
+ let n = e[e.length - 1], r = e.slice(0, e.length - 1), a = U(o, r, Object);
33
+ for (; a.obj === void 0 && r.length; )
34
+ n = `${r[r.length - 1]}.${n}`, r = r.slice(0, r.length - 1), a = U(o, r, Object), a != null && a.obj && typeof a.obj[`${a.k}.${n}`] < "u" && (a.obj = void 0);
35
+ a.obj[`${a.k}.${n}`] = t;
36
+ }, ve = (o, e, t, s) => {
37
+ const {
38
+ obj: i,
39
+ k: n
40
+ } = U(o, e, Object);
41
+ i[n] = i[n] || [], i[n].push(t);
42
+ }, _ = (o, e) => {
43
+ const {
44
+ obj: t,
45
+ k: s
46
+ } = U(o, e);
47
+ if (t && Object.prototype.hasOwnProperty.call(t, s))
48
+ return t[s];
49
+ }, Pe = (o, e, t) => {
50
+ const s = _(o, t);
51
+ return s !== void 0 ? s : _(e, t);
52
+ }, xe = (o, e, t) => {
53
+ for (const s in e)
54
+ s !== "__proto__" && s !== "constructor" && (s in o ? g(o[s]) || o[s] instanceof String || g(e[s]) || e[s] instanceof String ? t && (o[s] = e[s]) : xe(o[s], e[s], t) : o[s] = e[s]);
55
+ return o;
56
+ }, T = (o) => o.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
57
+ var $e = {
58
+ "&": "&amp;",
59
+ "<": "&lt;",
60
+ ">": "&gt;",
61
+ '"': "&quot;",
62
+ "'": "&#39;",
63
+ "/": "&#x2F;"
64
+ };
65
+ const Re = (o) => g(o) ? o.replace(/[&<>"'\/]/g, (e) => $e[e]) : o;
66
+ class Ne {
67
+ constructor(e) {
68
+ this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
69
+ }
70
+ getRegExp(e) {
71
+ const t = this.regExpMap.get(e);
72
+ if (t !== void 0)
73
+ return t;
74
+ const s = new RegExp(e);
75
+ return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, s), this.regExpQueue.push(e), s;
76
+ }
77
+ }
78
+ const ke = [" ", ",", "?", "!", ";"], je = new Ne(20), Fe = (o, e, t) => {
79
+ e = e || "", t = t || "";
80
+ const s = ke.filter((r) => e.indexOf(r) < 0 && t.indexOf(r) < 0);
81
+ if (s.length === 0) return !0;
82
+ const i = je.getRegExp(`(${s.map((r) => r === "?" ? "\\?" : r).join("|")})`);
83
+ let n = !i.test(o);
84
+ if (!n) {
85
+ const r = o.indexOf(t);
86
+ r > 0 && !i.test(o.substring(0, r)) && (n = !0);
87
+ }
88
+ return n;
89
+ }, q = (o, e, t = ".") => {
90
+ if (!o) return;
91
+ if (o[e])
92
+ return Object.prototype.hasOwnProperty.call(o, e) ? o[e] : void 0;
93
+ const s = e.split(t);
94
+ let i = o;
95
+ for (let n = 0; n < s.length; ) {
96
+ if (!i || typeof i != "object")
97
+ return;
98
+ let r, a = "";
99
+ for (let l = n; l < s.length; ++l)
100
+ if (l !== n && (a += t), a += s[l], r = i[a], r !== void 0) {
101
+ if (["string", "number", "boolean"].indexOf(typeof r) > -1 && l < s.length - 1)
102
+ continue;
103
+ n += l - n + 1;
104
+ break;
105
+ }
106
+ i = r;
107
+ }
108
+ return i;
109
+ }, M = (o) => o == null ? void 0 : o.replace(/_/g, "-"), Ee = {
110
+ type: "logger",
111
+ log(o) {
112
+ this.output("log", o);
113
+ },
114
+ warn(o) {
115
+ this.output("warn", o);
116
+ },
117
+ error(o) {
118
+ this.output("error", o);
119
+ },
120
+ output(o, e) {
121
+ var t, s;
122
+ (s = (t = console == null ? void 0 : console[o]) == null ? void 0 : t.apply) == null || s.call(t, console, e);
123
+ }
124
+ };
125
+ class W {
126
+ constructor(e, t = {}) {
127
+ this.init(e, t);
128
+ }
129
+ init(e, t = {}) {
130
+ this.prefix = t.prefix || "i18next:", this.logger = e || Ee, this.options = t, this.debug = t.debug;
131
+ }
132
+ log(...e) {
133
+ return this.forward(e, "log", "", !0);
134
+ }
135
+ warn(...e) {
136
+ return this.forward(e, "warn", "", !0);
137
+ }
138
+ error(...e) {
139
+ return this.forward(e, "error", "");
140
+ }
141
+ deprecate(...e) {
142
+ return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
143
+ }
144
+ forward(e, t, s, i) {
145
+ return i && !this.debug ? null : (g(e[0]) && (e[0] = `${s}${this.prefix} ${e[0]}`), this.logger[t](e));
146
+ }
147
+ create(e) {
148
+ return new W(this.logger, {
149
+ prefix: `${this.prefix}:${e}:`,
150
+ ...this.options
151
+ });
152
+ }
153
+ clone(e) {
154
+ return e = e || this.options, e.prefix = e.prefix || this.prefix, new W(this.logger, e);
155
+ }
156
+ }
157
+ var R = new W();
158
+ class G {
159
+ constructor() {
160
+ this.observers = {};
161
+ }
162
+ on(e, t) {
163
+ return e.split(" ").forEach((s) => {
164
+ this.observers[s] || (this.observers[s] = /* @__PURE__ */ new Map());
165
+ const i = this.observers[s].get(t) || 0;
166
+ this.observers[s].set(t, i + 1);
167
+ }), this;
168
+ }
169
+ off(e, t) {
170
+ if (this.observers[e]) {
171
+ if (!t) {
172
+ delete this.observers[e];
173
+ return;
174
+ }
175
+ this.observers[e].delete(t);
176
+ }
177
+ }
178
+ emit(e, ...t) {
179
+ this.observers[e] && Array.from(this.observers[e].entries()).forEach(([i, n]) => {
180
+ for (let r = 0; r < n; r++)
181
+ i(...t);
182
+ }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([i, n]) => {
183
+ for (let r = 0; r < n; r++)
184
+ i.apply(i, [e, ...t]);
185
+ });
186
+ }
187
+ }
188
+ class le extends G {
189
+ constructor(e, t = {
190
+ ns: ["translation"],
191
+ defaultNS: "translation"
192
+ }) {
193
+ super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
194
+ }
195
+ addNamespaces(e) {
196
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
197
+ }
198
+ removeNamespaces(e) {
199
+ const t = this.options.ns.indexOf(e);
200
+ t > -1 && this.options.ns.splice(t, 1);
201
+ }
202
+ getResource(e, t, s, i = {}) {
203
+ var u, h;
204
+ const n = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, r = i.ignoreJSONStructure !== void 0 ? i.ignoreJSONStructure : this.options.ignoreJSONStructure;
205
+ let a;
206
+ e.indexOf(".") > -1 ? a = e.split(".") : (a = [e, t], s && (Array.isArray(s) ? a.push(...s) : g(s) && n ? a.push(...s.split(n)) : a.push(s)));
207
+ const l = _(this.data, a);
208
+ return !l && !t && !s && e.indexOf(".") > -1 && (e = a[0], t = a[1], s = a.slice(2).join(".")), l || !r || !g(s) ? l : q((h = (u = this.data) == null ? void 0 : u[e]) == null ? void 0 : h[t], s, n);
209
+ }
210
+ addResource(e, t, s, i, n = {
211
+ silent: !1
212
+ }) {
213
+ const r = n.keySeparator !== void 0 ? n.keySeparator : this.options.keySeparator;
214
+ let a = [e, t];
215
+ s && (a = a.concat(r ? s.split(r) : s)), e.indexOf(".") > -1 && (a = e.split("."), i = t, t = a[1]), this.addNamespaces(t), oe(this.data, a, i), n.silent || this.emit("added", e, t, s, i);
216
+ }
217
+ addResources(e, t, s, i = {
218
+ silent: !1
219
+ }) {
220
+ for (const n in s)
221
+ (g(s[n]) || Array.isArray(s[n])) && this.addResource(e, t, n, s[n], {
222
+ silent: !0
223
+ });
224
+ i.silent || this.emit("added", e, t, s);
225
+ }
226
+ addResourceBundle(e, t, s, i, n, r = {
227
+ silent: !1,
228
+ skipCopy: !1
229
+ }) {
230
+ let a = [e, t];
231
+ e.indexOf(".") > -1 && (a = e.split("."), i = s, s = t, t = a[1]), this.addNamespaces(t);
232
+ let l = _(this.data, a) || {};
233
+ r.skipCopy || (s = JSON.parse(JSON.stringify(s))), i ? xe(l, s, n) : l = {
234
+ ...l,
235
+ ...s
236
+ }, oe(this.data, a, l), r.silent || this.emit("added", e, t, s);
237
+ }
238
+ removeResourceBundle(e, t) {
239
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
240
+ }
241
+ hasResourceBundle(e, t) {
242
+ return this.getResource(e, t) !== void 0;
243
+ }
244
+ getResourceBundle(e, t) {
245
+ return t || (t = this.options.defaultNS), this.getResource(e, t);
246
+ }
247
+ getDataByLanguage(e) {
248
+ return this.data[e];
249
+ }
250
+ hasLanguageSomeTranslations(e) {
251
+ const t = this.getDataByLanguage(e);
252
+ return !!(t && Object.keys(t) || []).find((i) => t[i] && Object.keys(t[i]).length > 0);
253
+ }
254
+ toJSON() {
255
+ return this.data;
256
+ }
257
+ }
258
+ var ye = {
259
+ processors: {},
260
+ addPostProcessor(o) {
261
+ this.processors[o.name] = o;
262
+ },
263
+ handle(o, e, t, s, i) {
264
+ return o.forEach((n) => {
265
+ var r;
266
+ e = ((r = this.processors[n]) == null ? void 0 : r.process(e, t, s, i)) ?? e;
267
+ }), e;
268
+ }
269
+ };
270
+ const Se = Symbol("i18next/PATH_KEY");
271
+ function Te() {
272
+ const o = [], e = /* @__PURE__ */ Object.create(null);
273
+ let t;
274
+ return e.get = (s, i) => {
275
+ var n;
276
+ return (n = t == null ? void 0 : t.revoke) == null || n.call(t), i === Se ? o : (o.push(i), t = Proxy.revocable(s, e), t.proxy);
277
+ }, Proxy.revocable(/* @__PURE__ */ Object.create(null), e).proxy;
278
+ }
279
+ function I(o, e) {
280
+ const {
281
+ [Se]: t
282
+ } = o(Te()), s = (e == null ? void 0 : e.keySeparator) ?? ".", i = (e == null ? void 0 : e.nsSeparator) ?? ":";
283
+ if (t.length > 1 && i) {
284
+ const n = e == null ? void 0 : e.ns, r = Array.isArray(n) ? n : null;
285
+ if (r && r.length > 1 && r.slice(1).includes(t[0]))
286
+ return `${t[0]}${i}${t.slice(1).join(s)}`;
287
+ }
288
+ return t.join(s);
289
+ }
290
+ const ue = {}, Q = (o) => !g(o) && typeof o != "boolean" && typeof o != "number";
291
+ class Y extends G {
292
+ constructor(e, t = {}) {
293
+ super(), we(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = R.create("translator");
294
+ }
295
+ changeLanguage(e) {
296
+ e && (this.language = e);
297
+ }
298
+ exists(e, t = {
299
+ interpolation: {}
300
+ }) {
301
+ const s = {
302
+ ...t
303
+ };
304
+ if (e == null) return !1;
305
+ const i = this.resolve(e, s);
306
+ if ((i == null ? void 0 : i.res) === void 0) return !1;
307
+ const n = Q(i.res);
308
+ return !(s.returnObjects === !1 && n);
309
+ }
310
+ extractFromKey(e, t) {
311
+ let s = t.nsSeparator !== void 0 ? t.nsSeparator : this.options.nsSeparator;
312
+ s === void 0 && (s = ":");
313
+ const i = t.keySeparator !== void 0 ? t.keySeparator : this.options.keySeparator;
314
+ let n = t.ns || this.options.defaultNS || [];
315
+ const r = s && e.indexOf(s) > -1, a = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !Fe(e, s, i);
316
+ if (r && !a) {
317
+ const l = e.match(this.interpolator.nestingRegexp);
318
+ if (l && l.length > 0)
319
+ return {
320
+ key: e,
321
+ namespaces: g(n) ? [n] : n
322
+ };
323
+ const u = e.split(s);
324
+ (s !== i || s === i && this.options.ns.indexOf(u[0]) > -1) && (n = u.shift()), e = u.join(i);
325
+ }
326
+ return {
327
+ key: e,
328
+ namespaces: g(n) ? [n] : n
329
+ };
330
+ }
331
+ translate(e, t, s) {
332
+ let i = typeof t == "object" ? {
333
+ ...t
334
+ } : t;
335
+ if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = {
336
+ ...i
337
+ }), i || (i = {}), e == null) return "";
338
+ typeof e == "function" && (e = I(e, {
339
+ ...this.options,
340
+ ...i
341
+ })), Array.isArray(e) || (e = [String(e)]), e = e.map((b) => typeof b == "function" ? I(b, {
342
+ ...this.options,
343
+ ...i
344
+ }) : String(b));
345
+ const n = i.returnDetails !== void 0 ? i.returnDetails : this.options.returnDetails, r = i.keySeparator !== void 0 ? i.keySeparator : this.options.keySeparator, {
346
+ key: a,
347
+ namespaces: l
348
+ } = this.extractFromKey(e[e.length - 1], i), u = l[l.length - 1];
349
+ let h = i.nsSeparator !== void 0 ? i.nsSeparator : this.options.nsSeparator;
350
+ h === void 0 && (h = ":");
351
+ const f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
352
+ if ((f == null ? void 0 : f.toLowerCase()) === "cimode")
353
+ return p ? n ? {
354
+ res: `${u}${h}${a}`,
355
+ usedKey: a,
356
+ exactUsedKey: a,
357
+ usedLng: f,
358
+ usedNS: u,
359
+ usedParams: this.getUsedParamsDetails(i)
360
+ } : `${u}${h}${a}` : n ? {
361
+ res: a,
362
+ usedKey: a,
363
+ exactUsedKey: a,
364
+ usedLng: f,
365
+ usedNS: u,
366
+ usedParams: this.getUsedParamsDetails(i)
367
+ } : a;
368
+ const d = this.resolve(e, i);
369
+ let c = d == null ? void 0 : d.res;
370
+ const m = (d == null ? void 0 : d.usedKey) || a, x = (d == null ? void 0 : d.exactUsedKey) || a, S = ["[object Number]", "[object Function]", "[object RegExp]"], v = i.joinArrays !== void 0 ? i.joinArrays : this.options.joinArrays, F = !this.i18nFormat || this.i18nFormat.handleAsObject, O = i.count !== void 0 && !g(i.count), N = Y.hasDefaultValue(i), z = O ? this.pluralResolver.getSuffix(f, i.count, i) : "", k = i.ordinal && O ? this.pluralResolver.getSuffix(f, i.count, {
371
+ ordinal: !1
372
+ }) : "", V = O && !i.ordinal && i.count === 0, w = V && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${z}`] || i[`defaultValue${k}`] || i.defaultValue;
373
+ let y = c;
374
+ F && !c && N && (y = w);
375
+ const be = Q(y), Le = Object.prototype.toString.apply(y);
376
+ if (F && y && be && S.indexOf(Le) < 0 && !(g(v) && Array.isArray(y))) {
377
+ if (!i.returnObjects && !this.options.returnObjects) {
378
+ this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
379
+ const b = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(m, y, {
380
+ ...i,
381
+ ns: l
382
+ }) : `key '${a} (${this.language})' returned an object instead of string.`;
383
+ return n ? (d.res = b, d.usedParams = this.getUsedParamsDetails(i), d) : b;
384
+ }
385
+ if (r) {
386
+ const b = Array.isArray(y), P = b ? [] : {}, ee = b ? x : m;
387
+ for (const $ in y)
388
+ if (Object.prototype.hasOwnProperty.call(y, $)) {
389
+ const j = `${ee}${r}${$}`;
390
+ N && !c ? P[$] = this.translate(j, {
391
+ ...i,
392
+ defaultValue: Q(w) ? w[$] : void 0,
393
+ joinArrays: !1,
394
+ ns: l
395
+ }) : P[$] = this.translate(j, {
396
+ ...i,
397
+ joinArrays: !1,
398
+ ns: l
399
+ }), P[$] === j && (P[$] = y[$]);
400
+ }
401
+ c = P;
402
+ }
403
+ } else if (F && g(v) && Array.isArray(c))
404
+ c = c.join(v), c && (c = this.extendTranslation(c, e, i, s));
405
+ else {
406
+ let b = !1, P = !1;
407
+ !this.isValidLookup(c) && N && (b = !0, c = w), this.isValidLookup(c) || (P = !0, c = a);
408
+ const $ = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && P ? void 0 : c, j = N && w !== c && this.options.updateMissing;
409
+ if (P || b || j) {
410
+ if (this.logger.log(j ? "updateKey" : "missingKey", f, u, a, j ? w : c), r) {
411
+ const C = this.resolve(a, {
412
+ ...i,
413
+ keySeparator: !1
414
+ });
415
+ C && C.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.");
416
+ }
417
+ let D = [];
418
+ const B = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
419
+ if (this.options.saveMissingTo === "fallback" && B && B[0])
420
+ for (let C = 0; C < B.length; C++)
421
+ D.push(B[C]);
422
+ else this.options.saveMissingTo === "all" ? D = this.languageUtils.toResolveHierarchy(i.lng || this.language) : D.push(i.lng || this.language);
423
+ const te = (C, E, A) => {
424
+ var se;
425
+ const ie = N && A !== c ? A : $;
426
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(C, u, E, ie, j, i) : (se = this.backendConnector) != null && se.saveMissing && this.backendConnector.saveMissing(C, u, E, ie, j, i), this.emit("missingKey", C, u, E, c);
427
+ };
428
+ this.options.saveMissing && (this.options.saveMissingPlurals && O ? D.forEach((C) => {
429
+ const E = this.pluralResolver.getSuffixes(C, i);
430
+ V && i[`defaultValue${this.options.pluralSeparator}zero`] && E.indexOf(`${this.options.pluralSeparator}zero`) < 0 && E.push(`${this.options.pluralSeparator}zero`), E.forEach((A) => {
431
+ te([C], a + A, i[`defaultValue${A}`] || w);
432
+ });
433
+ }) : te(D, a, w));
434
+ }
435
+ c = this.extendTranslation(c, e, i, d, s), P && c === a && this.options.appendNamespaceToMissingKey && (c = `${u}${h}${a}`), (P || b) && this.options.parseMissingKeyHandler && (c = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${u}${h}${a}` : a, b ? c : void 0, i));
436
+ }
437
+ return n ? (d.res = c, d.usedParams = this.getUsedParamsDetails(i), d) : c;
438
+ }
439
+ extendTranslation(e, t, s, i, n) {
440
+ var l, u;
441
+ if ((l = this.i18nFormat) != null && l.parse)
442
+ e = this.i18nFormat.parse(e, {
443
+ ...this.options.interpolation.defaultVariables,
444
+ ...s
445
+ }, s.lng || this.language || i.usedLng, i.usedNS, i.usedKey, {
446
+ resolved: i
447
+ });
448
+ else if (!s.skipInterpolation) {
449
+ s.interpolation && this.interpolator.init({
450
+ ...s,
451
+ interpolation: {
452
+ ...this.options.interpolation,
453
+ ...s.interpolation
454
+ }
455
+ });
456
+ const h = g(e) && (((u = s == null ? void 0 : s.interpolation) == null ? void 0 : u.skipOnVariables) !== void 0 ? s.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
457
+ let f;
458
+ if (h) {
459
+ const d = e.match(this.interpolator.nestingRegexp);
460
+ f = d && d.length;
461
+ }
462
+ let p = s.replace && !g(s.replace) ? s.replace : s;
463
+ if (this.options.interpolation.defaultVariables && (p = {
464
+ ...this.options.interpolation.defaultVariables,
465
+ ...p
466
+ }), e = this.interpolator.interpolate(e, p, s.lng || this.language || i.usedLng, s), h) {
467
+ const d = e.match(this.interpolator.nestingRegexp), c = d && d.length;
468
+ f < c && (s.nest = !1);
469
+ }
470
+ !s.lng && i && i.res && (s.lng = this.language || i.usedLng), s.nest !== !1 && (e = this.interpolator.nest(e, (...d) => (n == null ? void 0 : n[0]) === d[0] && !s.context ? (this.logger.warn(`It seems you are nesting recursively key: ${d[0]} in key: ${t[0]}`), null) : this.translate(...d, t), s)), s.interpolation && this.interpolator.reset();
471
+ }
472
+ const r = s.postProcess || this.options.postProcess, a = g(r) ? [r] : r;
473
+ return e != null && (a != null && a.length) && s.applyPostProcessor !== !1 && (e = ye.handle(a, e, t, this.options && this.options.postProcessPassResolved ? {
474
+ i18nResolved: {
475
+ ...i,
476
+ usedParams: this.getUsedParamsDetails(s)
477
+ },
478
+ ...s
479
+ } : s, this)), e;
480
+ }
481
+ resolve(e, t = {}) {
482
+ let s, i, n, r, a;
483
+ return g(e) && (e = [e]), Array.isArray(e) && (e = e.map((l) => typeof l == "function" ? I(l, {
484
+ ...this.options,
485
+ ...t
486
+ }) : l)), e.forEach((l) => {
487
+ if (this.isValidLookup(s)) return;
488
+ const u = this.extractFromKey(l, t), h = u.key;
489
+ i = h;
490
+ let f = u.namespaces;
491
+ this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
492
+ const p = t.count !== void 0 && !g(t.count), d = p && !t.ordinal && t.count === 0, c = t.context !== void 0 && (g(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
493
+ f.forEach((x) => {
494
+ var S, v;
495
+ this.isValidLookup(s) || (a = x, !ue[`${m[0]}-${x}`] && ((S = this.utils) != null && S.hasLoadedNamespace) && !((v = this.utils) != null && v.hasLoadedNamespace(a)) && (ue[`${m[0]}-${x}`] = !0, this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${a}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((F) => {
496
+ var z;
497
+ if (this.isValidLookup(s)) return;
498
+ r = F;
499
+ const O = [h];
500
+ if ((z = this.i18nFormat) != null && z.addLookupKeys)
501
+ this.i18nFormat.addLookupKeys(O, h, F, x, t);
502
+ else {
503
+ let k;
504
+ p && (k = this.pluralResolver.getSuffix(F, t.count, t));
505
+ const V = `${this.options.pluralSeparator}zero`, w = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
506
+ if (p && (t.ordinal && k.indexOf(w) === 0 && O.push(h + k.replace(w, this.options.pluralSeparator)), O.push(h + k), d && O.push(h + V)), c) {
507
+ const y = `${h}${this.options.contextSeparator || "_"}${t.context}`;
508
+ O.push(y), p && (t.ordinal && k.indexOf(w) === 0 && O.push(y + k.replace(w, this.options.pluralSeparator)), O.push(y + k), d && O.push(y + V));
509
+ }
510
+ }
511
+ let N;
512
+ for (; N = O.pop(); )
513
+ this.isValidLookup(s) || (n = N, s = this.getResource(F, x, N, t));
514
+ }));
515
+ });
516
+ }), {
517
+ res: s,
518
+ usedKey: i,
519
+ exactUsedKey: n,
520
+ usedLng: r,
521
+ usedNS: a
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, i = {}) {
528
+ var n;
529
+ return (n = this.i18nFormat) != null && n.getResource ? this.i18nFormat.getResource(e, t, s, i) : this.resourceStore.getResource(e, t, s, i);
530
+ }
531
+ getUsedParamsDetails(e = {}) {
532
+ const t = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"], s = e.replace && !g(e.replace);
533
+ let i = s ? e.replace : e;
534
+ if (s && typeof e.count < "u" && (i.count = e.count), this.options.interpolation.defaultVariables && (i = {
535
+ ...this.options.interpolation.defaultVariables,
536
+ ...i
537
+ }), !s) {
538
+ i = {
539
+ ...i
540
+ };
541
+ for (const n of t)
542
+ delete i[n];
543
+ }
544
+ return i;
545
+ }
546
+ static hasDefaultValue(e) {
547
+ const t = "defaultValue";
548
+ for (const s in e)
549
+ if (Object.prototype.hasOwnProperty.call(e, s) && t === s.substring(0, t.length) && e[s] !== void 0)
550
+ return !0;
551
+ return !1;
552
+ }
553
+ }
554
+ class fe {
555
+ constructor(e) {
556
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = R.create("languageUtils");
557
+ }
558
+ getScriptPartFromCode(e) {
559
+ if (e = M(e), !e || e.indexOf("-") < 0) return null;
560
+ const t = e.split("-");
561
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
562
+ }
563
+ getLanguagePartFromCode(e) {
564
+ if (e = M(e), !e || e.indexOf("-") < 0) return e;
565
+ const t = e.split("-");
566
+ return this.formatLanguageCode(t[0]);
567
+ }
568
+ formatLanguageCode(e) {
569
+ if (g(e) && e.indexOf("-") > -1) {
570
+ let t;
571
+ try {
572
+ t = Intl.getCanonicalLocales(e)[0];
573
+ } catch {
574
+ }
575
+ return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
576
+ }
577
+ return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
578
+ }
579
+ isSupportedCode(e) {
580
+ return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
581
+ }
582
+ getBestMatchFromCodes(e) {
583
+ if (!e) return null;
584
+ let t;
585
+ return e.forEach((s) => {
586
+ if (t) return;
587
+ const i = this.formatLanguageCode(s);
588
+ (!this.options.supportedLngs || this.isSupportedCode(i)) && (t = i);
589
+ }), !t && this.options.supportedLngs && e.forEach((s) => {
590
+ if (t) return;
591
+ const i = this.getScriptPartFromCode(s);
592
+ if (this.isSupportedCode(i)) return t = i;
593
+ const n = this.getLanguagePartFromCode(s);
594
+ if (this.isSupportedCode(n)) return t = n;
595
+ t = this.options.supportedLngs.find((r) => {
596
+ if (r === n) return r;
597
+ if (!(r.indexOf("-") < 0 && n.indexOf("-") < 0) && (r.indexOf("-") > 0 && n.indexOf("-") < 0 && r.substring(0, r.indexOf("-")) === n || r.indexOf(n) === 0 && n.length > 1))
598
+ return r;
599
+ });
600
+ }), t || (t = this.getFallbackCodes(this.options.fallbackLng)[0]), t;
601
+ }
602
+ getFallbackCodes(e, t) {
603
+ if (!e) return [];
604
+ if (typeof e == "function" && (e = e(t)), g(e) && (e = [e]), Array.isArray(e)) return e;
605
+ if (!t) return e.default || [];
606
+ let s = e[t];
607
+ return s || (s = e[this.getScriptPartFromCode(t)]), s || (s = e[this.formatLanguageCode(t)]), s || (s = e[this.getLanguagePartFromCode(t)]), s || (s = e.default), s || [];
608
+ }
609
+ toResolveHierarchy(e, t) {
610
+ const s = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), i = [], n = (r) => {
611
+ r && (this.isSupportedCode(r) ? i.push(r) : this.logger.warn(`rejecting language code not found in supportedLngs: ${r}`));
612
+ };
613
+ return g(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && n(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && n(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && n(this.getLanguagePartFromCode(e))) : g(e) && n(this.formatLanguageCode(e)), s.forEach((r) => {
614
+ i.indexOf(r) < 0 && n(this.formatLanguageCode(r));
615
+ }), i;
616
+ }
617
+ }
618
+ const he = {
619
+ zero: 0,
620
+ one: 1,
621
+ two: 2,
622
+ few: 3,
623
+ many: 4,
624
+ other: 5
625
+ }, ce = {
626
+ select: (o) => o === 1 ? "one" : "other",
627
+ resolvedOptions: () => ({
628
+ pluralCategories: ["one", "other"]
629
+ })
630
+ };
631
+ class Ie {
632
+ constructor(e, t = {}) {
633
+ this.languageUtils = e, this.options = t, this.logger = R.create("pluralResolver"), this.pluralRulesCache = {};
634
+ }
635
+ clearCache() {
636
+ this.pluralRulesCache = {};
637
+ }
638
+ getRule(e, t = {}) {
639
+ const s = M(e === "dev" ? "en" : e), i = t.ordinal ? "ordinal" : "cardinal", n = JSON.stringify({
640
+ cleanedCode: s,
641
+ type: i
642
+ });
643
+ if (n in this.pluralRulesCache)
644
+ return this.pluralRulesCache[n];
645
+ let r;
646
+ try {
647
+ r = new Intl.PluralRules(s, {
648
+ type: i
649
+ });
650
+ } catch {
651
+ if (typeof Intl > "u")
652
+ return this.logger.error("No Intl support, please use an Intl polyfill!"), ce;
653
+ if (!e.match(/-|_/)) return ce;
654
+ const l = this.languageUtils.getLanguagePartFromCode(e);
655
+ r = this.getRule(l, t);
656
+ }
657
+ return this.pluralRulesCache[n] = r, r;
658
+ }
659
+ needsPlural(e, t = {}) {
660
+ let s = this.getRule(e, t);
661
+ return s || (s = this.getRule("dev", t)), (s == null ? void 0 : s.resolvedOptions().pluralCategories.length) > 1;
662
+ }
663
+ getPluralFormsOfKey(e, t, s = {}) {
664
+ return this.getSuffixes(e, s).map((i) => `${t}${i}`);
665
+ }
666
+ getSuffixes(e, t = {}) {
667
+ let s = this.getRule(e, t);
668
+ return s || (s = this.getRule("dev", t)), s ? s.resolvedOptions().pluralCategories.sort((i, n) => he[i] - he[n]).map((i) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${i}`) : [];
669
+ }
670
+ getSuffix(e, t, s = {}) {
671
+ const i = this.getRule(e, s);
672
+ return i ? `${this.options.prepend}${s.ordinal ? `ordinal${this.options.prepend}` : ""}${i.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, s));
673
+ }
674
+ }
675
+ const de = (o, e, t, s = ".", i = !0) => {
676
+ let n = Pe(o, e, t);
677
+ return !n && i && g(t) && (n = q(o, t, s), n === void 0 && (n = q(e, t, s))), n;
678
+ }, Z = (o) => o.replace(/\$/g, "$$$$");
679
+ class pe {
680
+ constructor(e = {}) {
681
+ var t;
682
+ this.logger = R.create("interpolator"), this.options = e, this.format = ((t = e == null ? void 0 : e.interpolation) == null ? void 0 : t.format) || ((s) => s), this.init(e);
683
+ }
684
+ init(e = {}) {
685
+ e.interpolation || (e.interpolation = {
686
+ escapeValue: !0
687
+ });
688
+ const {
689
+ escape: t,
690
+ escapeValue: s,
691
+ useRawValueToEscape: i,
692
+ prefix: n,
693
+ prefixEscaped: r,
694
+ suffix: a,
695
+ suffixEscaped: l,
696
+ formatSeparator: u,
697
+ unescapeSuffix: h,
698
+ unescapePrefix: f,
699
+ nestingPrefix: p,
700
+ nestingPrefixEscaped: d,
701
+ nestingSuffix: c,
702
+ nestingSuffixEscaped: m,
703
+ nestingOptionsSeparator: x,
704
+ maxReplaces: S,
705
+ alwaysFormat: v
706
+ } = e.interpolation;
707
+ this.escape = t !== void 0 ? t : Re, this.escapeValue = s !== void 0 ? s : !0, this.useRawValueToEscape = i !== void 0 ? i : !1, this.prefix = n ? T(n) : r || "{{", this.suffix = a ? T(a) : l || "}}", this.formatSeparator = u || ",", this.unescapePrefix = h ? "" : f || "-", this.unescapeSuffix = this.unescapePrefix ? "" : h || "", this.nestingPrefix = p ? T(p) : d || T("$t("), this.nestingSuffix = c ? T(c) : m || T(")"), this.nestingOptionsSeparator = x || ",", this.maxReplaces = S || 1e3, this.alwaysFormat = v !== void 0 ? v : !1, this.resetRegExp();
708
+ }
709
+ reset() {
710
+ this.options && this.init(this.options);
711
+ }
712
+ resetRegExp() {
713
+ const e = (t, s) => (t == null ? void 0 : t.source) === s ? (t.lastIndex = 0, t) : new RegExp(s, "g");
714
+ this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
715
+ }
716
+ interpolate(e, t, s, i) {
717
+ var d;
718
+ let n, r, a;
719
+ const l = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, u = (c) => {
720
+ if (c.indexOf(this.formatSeparator) < 0) {
721
+ const v = de(t, l, c, this.options.keySeparator, this.options.ignoreJSONStructure);
722
+ return this.alwaysFormat ? this.format(v, void 0, s, {
723
+ ...i,
724
+ ...t,
725
+ interpolationkey: c
726
+ }) : v;
727
+ }
728
+ const m = c.split(this.formatSeparator), x = m.shift().trim(), S = m.join(this.formatSeparator).trim();
729
+ return this.format(de(t, l, x, this.options.keySeparator, this.options.ignoreJSONStructure), S, s, {
730
+ ...i,
731
+ ...t,
732
+ interpolationkey: x
733
+ });
734
+ };
735
+ this.resetRegExp();
736
+ const h = (i == null ? void 0 : i.missingInterpolationHandler) || this.options.missingInterpolationHandler, f = ((d = i == null ? void 0 : i.interpolation) == null ? void 0 : d.skipOnVariables) !== void 0 ? i.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
737
+ return [{
738
+ regex: this.regexpUnescape,
739
+ safeValue: (c) => Z(c)
740
+ }, {
741
+ regex: this.regexp,
742
+ safeValue: (c) => this.escapeValue ? Z(this.escape(c)) : Z(c)
743
+ }].forEach((c) => {
744
+ for (a = 0; n = c.regex.exec(e); ) {
745
+ const m = n[1].trim();
746
+ if (r = u(m), r === void 0)
747
+ if (typeof h == "function") {
748
+ const S = h(e, n, i);
749
+ r = g(S) ? S : "";
750
+ } else if (i && Object.prototype.hasOwnProperty.call(i, m))
751
+ r = "";
752
+ else if (f) {
753
+ r = n[0];
754
+ continue;
755
+ } else
756
+ this.logger.warn(`missed to pass in variable ${m} for interpolating ${e}`), r = "";
757
+ else !g(r) && !this.useRawValueToEscape && (r = ne(r));
758
+ const x = c.safeValue(r);
759
+ if (e = e.replace(n[0], x), f ? (c.regex.lastIndex += r.length, c.regex.lastIndex -= n[0].length) : c.regex.lastIndex = 0, a++, a >= this.maxReplaces)
760
+ break;
761
+ }
762
+ }), e;
763
+ }
764
+ nest(e, t, s = {}) {
765
+ let i, n, r;
766
+ const a = (l, u) => {
767
+ const h = this.nestingOptionsSeparator;
768
+ if (l.indexOf(h) < 0) return l;
769
+ const f = l.split(new RegExp(`${T(h)}[ ]*{`));
770
+ let p = `{${f[1]}`;
771
+ l = f[0], p = this.interpolate(p, r);
772
+ const d = p.match(/'/g), c = p.match(/"/g);
773
+ (((d == null ? void 0 : d.length) ?? 0) % 2 === 0 && !c || ((c == null ? void 0 : c.length) ?? 0) % 2 !== 0) && (p = p.replace(/'/g, '"'));
774
+ try {
775
+ r = JSON.parse(p), u && (r = {
776
+ ...u,
777
+ ...r
778
+ });
779
+ } catch (m) {
780
+ return this.logger.warn(`failed parsing options string in nesting for key ${l}`, m), `${l}${h}${p}`;
781
+ }
782
+ return r.defaultValue && r.defaultValue.indexOf(this.prefix) > -1 && delete r.defaultValue, l;
783
+ };
784
+ for (; i = this.nestingRegexp.exec(e); ) {
785
+ let l = [];
786
+ r = {
787
+ ...s
788
+ }, r = r.replace && !g(r.replace) ? r.replace : r, r.applyPostProcessor = !1, delete r.defaultValue;
789
+ const u = /{.*}/.test(i[1]) ? i[1].lastIndexOf("}") + 1 : i[1].indexOf(this.formatSeparator);
790
+ if (u !== -1 && (l = i[1].slice(u).split(this.formatSeparator).map((h) => h.trim()).filter(Boolean), i[1] = i[1].slice(0, u)), n = t(a.call(this, i[1].trim(), r), r), n && i[0] === e && !g(n)) return n;
791
+ g(n) || (n = ne(n)), n || (this.logger.warn(`missed to resolve ${i[1]} for nesting ${e}`), n = ""), l.length && (n = l.reduce((h, f) => this.format(h, f, s.lng, {
792
+ ...s,
793
+ interpolationkey: i[1].trim()
794
+ }), n.trim())), e = e.replace(i[0], n), this.regexp.lastIndex = 0;
795
+ }
796
+ return e;
797
+ }
798
+ }
799
+ const Ve = (o) => {
800
+ let e = o.toLowerCase().trim();
801
+ const t = {};
802
+ if (o.indexOf("(") > -1) {
803
+ const s = o.split("(");
804
+ e = s[0].toLowerCase().trim();
805
+ const i = s[1].substring(0, s[1].length - 1);
806
+ e === "currency" && i.indexOf(":") < 0 ? t.currency || (t.currency = i.trim()) : e === "relativetime" && i.indexOf(":") < 0 ? t.range || (t.range = i.trim()) : i.split(";").forEach((r) => {
807
+ if (r) {
808
+ const [a, ...l] = r.split(":"), u = l.join(":").trim().replace(/^'+|'+$/g, ""), h = a.trim();
809
+ t[h] || (t[h] = u), u === "false" && (t[h] = !1), u === "true" && (t[h] = !0), isNaN(u) || (t[h] = parseInt(u, 10));
810
+ }
811
+ });
812
+ }
813
+ return {
814
+ formatName: e,
815
+ formatOptions: t
816
+ };
817
+ }, ge = (o) => {
818
+ const e = {};
819
+ return (t, s, i) => {
820
+ let n = i;
821
+ i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (n = {
822
+ ...n,
823
+ [i.interpolationkey]: void 0
824
+ });
825
+ const r = s + JSON.stringify(n);
826
+ let a = e[r];
827
+ return a || (a = o(M(s), i), e[r] = a), a(t);
828
+ };
829
+ }, De = (o) => (e, t, s) => o(M(t), s)(e);
830
+ class Ae {
831
+ constructor(e = {}) {
832
+ this.logger = R.create("formatter"), this.options = e, this.init(e);
833
+ }
834
+ init(e, t = {
835
+ interpolation: {}
836
+ }) {
837
+ this.formatSeparator = t.interpolation.formatSeparator || ",";
838
+ const s = t.cacheInBuiltFormats ? ge : De;
839
+ this.formats = {
840
+ number: s((i, n) => {
841
+ const r = new Intl.NumberFormat(i, {
842
+ ...n
843
+ });
844
+ return (a) => r.format(a);
845
+ }),
846
+ currency: s((i, n) => {
847
+ const r = new Intl.NumberFormat(i, {
848
+ ...n,
849
+ style: "currency"
850
+ });
851
+ return (a) => r.format(a);
852
+ }),
853
+ datetime: s((i, n) => {
854
+ const r = new Intl.DateTimeFormat(i, {
855
+ ...n
856
+ });
857
+ return (a) => r.format(a);
858
+ }),
859
+ relativetime: s((i, n) => {
860
+ const r = new Intl.RelativeTimeFormat(i, {
861
+ ...n
862
+ });
863
+ return (a) => r.format(a, n.range || "day");
864
+ }),
865
+ list: s((i, n) => {
866
+ const r = new Intl.ListFormat(i, {
867
+ ...n
868
+ });
869
+ return (a) => r.format(a);
870
+ })
871
+ };
872
+ }
873
+ add(e, t) {
874
+ this.formats[e.toLowerCase().trim()] = t;
875
+ }
876
+ addCached(e, t) {
877
+ this.formats[e.toLowerCase().trim()] = ge(t);
878
+ }
879
+ format(e, t, s, i = {}) {
880
+ const n = t.split(this.formatSeparator);
881
+ if (n.length > 1 && n[0].indexOf("(") > 1 && n[0].indexOf(")") < 0 && n.find((a) => a.indexOf(")") > -1)) {
882
+ const a = n.findIndex((l) => l.indexOf(")") > -1);
883
+ n[0] = [n[0], ...n.splice(1, a)].join(this.formatSeparator);
884
+ }
885
+ return n.reduce((a, l) => {
886
+ var f;
887
+ const {
888
+ formatName: u,
889
+ formatOptions: h
890
+ } = Ve(l);
891
+ if (this.formats[u]) {
892
+ let p = a;
893
+ try {
894
+ const d = ((f = i == null ? void 0 : i.formatParams) == null ? void 0 : f[i.interpolationkey]) || {}, c = d.locale || d.lng || i.locale || i.lng || s;
895
+ p = this.formats[u](a, c, {
896
+ ...h,
897
+ ...i,
898
+ ...d
899
+ });
900
+ } catch (d) {
901
+ this.logger.warn(d);
902
+ }
903
+ return p;
904
+ } else
905
+ this.logger.warn(`there was no format function for ${u}`);
906
+ return a;
907
+ }, e);
908
+ }
909
+ }
910
+ const Ke = (o, e) => {
911
+ o.pending[e] !== void 0 && (delete o.pending[e], o.pendingCount--);
912
+ };
913
+ class Ue extends G {
914
+ constructor(e, t, s, i = {}) {
915
+ var n, r;
916
+ super(), this.backend = e, this.store = t, this.services = s, this.languageUtils = s.languageUtils, this.options = i, this.logger = R.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = i.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = i.maxRetries >= 0 ? i.maxRetries : 5, this.retryTimeout = i.retryTimeout >= 1 ? i.retryTimeout : 350, this.state = {}, this.queue = [], (r = (n = this.backend) == null ? void 0 : n.init) == null || r.call(n, s, i.backend, i);
917
+ }
918
+ queueLoad(e, t, s, i) {
919
+ const n = {}, r = {}, a = {}, l = {};
920
+ return e.forEach((u) => {
921
+ let h = !0;
922
+ t.forEach((f) => {
923
+ const p = `${u}|${f}`;
924
+ !s.reload && this.store.hasResourceBundle(u, f) ? this.state[p] = 2 : this.state[p] < 0 || (this.state[p] === 1 ? r[p] === void 0 && (r[p] = !0) : (this.state[p] = 1, h = !1, r[p] === void 0 && (r[p] = !0), n[p] === void 0 && (n[p] = !0), l[f] === void 0 && (l[f] = !0)));
925
+ }), h || (a[u] = !0);
926
+ }), (Object.keys(n).length || Object.keys(r).length) && this.queue.push({
927
+ pending: r,
928
+ pendingCount: Object.keys(r).length,
929
+ loaded: {},
930
+ errors: [],
931
+ callback: i
932
+ }), {
933
+ toLoad: Object.keys(n),
934
+ pending: Object.keys(r),
935
+ toLoadLanguages: Object.keys(a),
936
+ toLoadNamespaces: Object.keys(l)
937
+ };
938
+ }
939
+ loaded(e, t, s) {
940
+ const i = e.split("|"), n = i[0], r = i[1];
941
+ t && this.emit("failedLoading", n, r, t), !t && s && this.store.addResourceBundle(n, r, s, void 0, void 0, {
942
+ skipCopy: !0
943
+ }), this.state[e] = t ? -1 : 2, t && s && (this.state[e] = 0);
944
+ const a = {};
945
+ this.queue.forEach((l) => {
946
+ ve(l.loaded, [n], r), Ke(l, e), t && l.errors.push(t), l.pendingCount === 0 && !l.done && (Object.keys(l.loaded).forEach((u) => {
947
+ a[u] || (a[u] = {});
948
+ const h = l.loaded[u];
949
+ h.length && h.forEach((f) => {
950
+ a[u][f] === void 0 && (a[u][f] = !0);
951
+ });
952
+ }), l.done = !0, l.errors.length ? l.callback(l.errors) : l.callback());
953
+ }), this.emit("loaded", a), this.queue = this.queue.filter((l) => !l.done);
954
+ }
955
+ read(e, t, s, i = 0, n = this.retryTimeout, r) {
956
+ if (!e.length) return r(null, {});
957
+ if (this.readingCalls >= this.maxParallelReads) {
958
+ this.waitingReads.push({
959
+ lng: e,
960
+ ns: t,
961
+ fcName: s,
962
+ tried: i,
963
+ wait: n,
964
+ callback: r
965
+ });
966
+ return;
967
+ }
968
+ this.readingCalls++;
969
+ const a = (u, h) => {
970
+ if (this.readingCalls--, this.waitingReads.length > 0) {
971
+ const f = this.waitingReads.shift();
972
+ this.read(f.lng, f.ns, f.fcName, f.tried, f.wait, f.callback);
973
+ }
974
+ if (u && h && i < this.maxRetries) {
975
+ setTimeout(() => {
976
+ this.read.call(this, e, t, s, i + 1, n * 2, r);
977
+ }, n);
978
+ return;
979
+ }
980
+ r(u, h);
981
+ }, l = this.backend[s].bind(this.backend);
982
+ if (l.length === 2) {
983
+ try {
984
+ const u = l(e, t);
985
+ u && typeof u.then == "function" ? u.then((h) => a(null, h)).catch(a) : a(null, u);
986
+ } catch (u) {
987
+ a(u);
988
+ }
989
+ return;
990
+ }
991
+ return l(e, t, a);
992
+ }
993
+ prepareLoading(e, t, s = {}, i) {
994
+ if (!this.backend)
995
+ return this.logger.warn("No backend was added via i18next.use. Will not load resources."), i && i();
996
+ g(e) && (e = this.languageUtils.toResolveHierarchy(e)), g(t) && (t = [t]);
997
+ const n = this.queueLoad(e, t, s, i);
998
+ if (!n.toLoad.length)
999
+ return n.pending.length || i(), null;
1000
+ n.toLoad.forEach((r) => {
1001
+ this.loadOne(r);
1002
+ });
1003
+ }
1004
+ load(e, t, s) {
1005
+ this.prepareLoading(e, t, {}, s);
1006
+ }
1007
+ reload(e, t, s) {
1008
+ this.prepareLoading(e, t, {
1009
+ reload: !0
1010
+ }, s);
1011
+ }
1012
+ loadOne(e, t = "") {
1013
+ const s = e.split("|"), i = s[0], n = s[1];
1014
+ this.read(i, n, "read", void 0, void 0, (r, a) => {
1015
+ r && this.logger.warn(`${t}loading namespace ${n} for language ${i} failed`, r), !r && a && this.logger.log(`${t}loaded namespace ${n} for language ${i}`, a), this.loaded(e, r, a);
1016
+ });
1017
+ }
1018
+ saveMissing(e, t, s, i, n, r = {}, a = () => {
1019
+ }) {
1020
+ var l, u, h, f, p;
1021
+ if ((u = (l = this.services) == null ? void 0 : l.utils) != null && u.hasLoadedNamespace && !((f = (h = this.services) == null ? void 0 : h.utils) != null && f.hasLoadedNamespace(t))) {
1022
+ 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!!!");
1023
+ return;
1024
+ }
1025
+ if (!(s == null || s === "")) {
1026
+ if ((p = this.backend) != null && p.create) {
1027
+ const d = {
1028
+ ...r,
1029
+ isUpdate: n
1030
+ }, c = this.backend.create.bind(this.backend);
1031
+ if (c.length < 6)
1032
+ try {
1033
+ let m;
1034
+ c.length === 5 ? m = c(e, t, s, i, d) : m = c(e, t, s, i), m && typeof m.then == "function" ? m.then((x) => a(null, x)).catch(a) : a(null, m);
1035
+ } catch (m) {
1036
+ a(m);
1037
+ }
1038
+ else
1039
+ c(e, t, s, i, a, d);
1040
+ }
1041
+ !e || !e[0] || this.store.addResource(e[0], t, s, i);
1042
+ }
1043
+ }
1044
+ }
1045
+ const X = () => ({
1046
+ debug: !1,
1047
+ initAsync: !0,
1048
+ ns: ["translation"],
1049
+ defaultNS: ["translation"],
1050
+ fallbackLng: ["dev"],
1051
+ fallbackNS: !1,
1052
+ supportedLngs: !1,
1053
+ nonExplicitSupportedLngs: !1,
1054
+ load: "all",
1055
+ preload: !1,
1056
+ simplifyPluralSuffix: !0,
1057
+ keySeparator: ".",
1058
+ nsSeparator: ":",
1059
+ pluralSeparator: "_",
1060
+ contextSeparator: "_",
1061
+ partialBundledLanguages: !1,
1062
+ saveMissing: !1,
1063
+ updateMissing: !1,
1064
+ saveMissingTo: "fallback",
1065
+ saveMissingPlurals: !0,
1066
+ missingKeyHandler: !1,
1067
+ missingInterpolationHandler: !1,
1068
+ postProcess: !1,
1069
+ postProcessPassResolved: !1,
1070
+ returnNull: !1,
1071
+ returnEmptyString: !0,
1072
+ returnObjects: !1,
1073
+ joinArrays: !1,
1074
+ returnedObjectHandler: !1,
1075
+ parseMissingKeyHandler: !1,
1076
+ appendNamespaceToMissingKey: !1,
1077
+ appendNamespaceToCIMode: !1,
1078
+ overloadTranslationOptionHandler: (o) => {
1079
+ let e = {};
1080
+ if (typeof o[1] == "object" && (e = o[1]), g(o[1]) && (e.defaultValue = o[1]), g(o[2]) && (e.tDescription = o[2]), typeof o[2] == "object" || typeof o[3] == "object") {
1081
+ const t = o[3] || o[2];
1082
+ Object.keys(t).forEach((s) => {
1083
+ e[s] = t[s];
1084
+ });
1085
+ }
1086
+ return e;
1087
+ },
1088
+ interpolation: {
1089
+ escapeValue: !0,
1090
+ format: (o) => o,
1091
+ prefix: "{{",
1092
+ suffix: "}}",
1093
+ formatSeparator: ",",
1094
+ unescapePrefix: "-",
1095
+ nestingPrefix: "$t(",
1096
+ nestingSuffix: ")",
1097
+ nestingOptionsSeparator: ",",
1098
+ maxReplaces: 1e3,
1099
+ skipOnVariables: !0
1100
+ },
1101
+ cacheInBuiltFormats: !0
1102
+ }), me = (o) => {
1103
+ var e, t;
1104
+ return g(o.ns) && (o.ns = [o.ns]), g(o.fallbackLng) && (o.fallbackLng = [o.fallbackLng]), g(o.fallbackNS) && (o.fallbackNS = [o.fallbackNS]), ((t = (e = o.supportedLngs) == null ? void 0 : e.indexOf) == null ? void 0 : t.call(e, "cimode")) < 0 && (o.supportedLngs = o.supportedLngs.concat(["cimode"])), typeof o.initImmediate == "boolean" && (o.initAsync = o.initImmediate), o;
1105
+ }, J = () => {
1106
+ }, He = (o) => {
1107
+ Object.getOwnPropertyNames(Object.getPrototypeOf(o)).forEach((t) => {
1108
+ typeof o[t] == "function" && (o[t] = o[t].bind(o));
1109
+ });
1110
+ }, Oe = "__i18next_supportNoticeShown", Me = () => !!(typeof globalThis < "u" && globalThis[Oe] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE), ze = () => {
1111
+ typeof globalThis < "u" && (globalThis[Oe] = !0);
1112
+ }, Be = (o) => {
1113
+ var e, t, s, i, n, r, a, l, u, h, f, p, d;
1114
+ return !!(((s = (t = (e = o == null ? void 0 : o.modules) == null ? void 0 : e.backend) == null ? void 0 : t.name) == null ? void 0 : s.indexOf("Locize")) > 0 || ((a = (r = (n = (i = o == null ? void 0 : o.modules) == null ? void 0 : i.backend) == null ? void 0 : n.constructor) == null ? void 0 : r.name) == null ? void 0 : a.indexOf("Locize")) > 0 || (u = (l = o == null ? void 0 : o.options) == null ? void 0 : l.backend) != null && u.backends && o.options.backend.backends.some((c) => {
1115
+ var m, x, S;
1116
+ return ((m = c == null ? void 0 : c.name) == null ? void 0 : m.indexOf("Locize")) > 0 || ((S = (x = c == null ? void 0 : c.constructor) == null ? void 0 : x.name) == null ? void 0 : S.indexOf("Locize")) > 0;
1117
+ }) || (f = (h = o == null ? void 0 : o.options) == null ? void 0 : h.backend) != null && f.projectId || (d = (p = o == null ? void 0 : o.options) == null ? void 0 : p.backend) != null && d.backendOptions && o.options.backend.backendOptions.some((c) => c == null ? void 0 : c.projectId));
1118
+ };
1119
+ class H extends G {
1120
+ constructor(e = {}, t) {
1121
+ if (super(), this.options = me(e), this.services = {}, this.logger = R, this.modules = {
1122
+ external: []
1123
+ }, He(this), t && !this.isInitialized && !e.isClone) {
1124
+ if (!this.options.initAsync)
1125
+ return this.init(e, t), this;
1126
+ setTimeout(() => {
1127
+ this.init(e, t);
1128
+ }, 0);
1129
+ }
1130
+ }
1131
+ init(e = {}, t) {
1132
+ this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (g(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1133
+ const s = X();
1134
+ this.options = {
1135
+ ...s,
1136
+ ...this.options,
1137
+ ...me(e)
1138
+ }, this.options.interpolation = {
1139
+ ...s.interpolation,
1140
+ ...this.options.interpolation
1141
+ }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = s.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !Be(this) && !Me() && (typeof console < "u" && typeof console.info < "u" && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), ze());
1142
+ const i = (u) => u ? typeof u == "function" ? new u() : u : null;
1143
+ if (!this.options.isClone) {
1144
+ this.modules.logger ? R.init(i(this.modules.logger), this.options) : R.init(null, this.options);
1145
+ let u;
1146
+ this.modules.formatter ? u = this.modules.formatter : u = Ae;
1147
+ const h = new fe(this.options);
1148
+ this.store = new le(this.options.resources, this.options);
1149
+ const f = this.services;
1150
+ f.logger = R, f.resourceStore = this.store, f.languageUtils = h, f.pluralResolver = new Ie(h, {
1151
+ prepend: this.options.pluralSeparator,
1152
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1153
+ }), this.options.interpolation.format && this.options.interpolation.format !== s.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), u && (!this.options.interpolation.format || this.options.interpolation.format === s.interpolation.format) && (f.formatter = i(u), f.formatter.init && f.formatter.init(f, this.options), this.options.interpolation.format = f.formatter.format.bind(f.formatter)), f.interpolator = new pe(this.options), f.utils = {
1154
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1155
+ }, f.backendConnector = new Ue(i(this.modules.backend), f.resourceStore, f, this.options), f.backendConnector.on("*", (d, ...c) => {
1156
+ this.emit(d, ...c);
1157
+ }), this.modules.languageDetector && (f.languageDetector = i(this.modules.languageDetector), f.languageDetector.init && f.languageDetector.init(f, this.options.detection, this.options)), this.modules.i18nFormat && (f.i18nFormat = i(this.modules.i18nFormat), f.i18nFormat.init && f.i18nFormat.init(this)), this.translator = new Y(this.services, this.options), this.translator.on("*", (d, ...c) => {
1158
+ this.emit(d, ...c);
1159
+ }), this.modules.external.forEach((d) => {
1160
+ d.init && d.init(this);
1161
+ });
1162
+ }
1163
+ if (this.format = this.options.interpolation.format, t || (t = J), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1164
+ const u = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1165
+ u.length > 0 && u[0] !== "dev" && (this.options.lng = u[0]);
1166
+ }
1167
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"].forEach((u) => {
1168
+ this[u] = (...h) => this.store[u](...h);
1169
+ }), ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"].forEach((u) => {
1170
+ this[u] = (...h) => (this.store[u](...h), this);
1171
+ });
1172
+ const a = K(), l = () => {
1173
+ const u = (h, f) => {
1174
+ this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), a.resolve(f), t(h, f);
1175
+ };
1176
+ if (this.languages && !this.isInitialized) return u(null, this.t.bind(this));
1177
+ this.changeLanguage(this.options.lng, u);
1178
+ };
1179
+ return this.options.resources || !this.options.initAsync ? l() : setTimeout(l, 0), a;
1180
+ }
1181
+ loadResources(e, t = J) {
1182
+ var n, r;
1183
+ let s = t;
1184
+ const i = g(e) ? e : this.language;
1185
+ if (typeof e == "function" && (s = e), !this.options.resources || this.options.partialBundledLanguages) {
1186
+ if ((i == null ? void 0 : i.toLowerCase()) === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return s();
1187
+ const a = [], l = (u) => {
1188
+ if (!u || u === "cimode") return;
1189
+ this.services.languageUtils.toResolveHierarchy(u).forEach((f) => {
1190
+ f !== "cimode" && a.indexOf(f) < 0 && a.push(f);
1191
+ });
1192
+ };
1193
+ i ? l(i) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((h) => l(h)), (r = (n = this.options.preload) == null ? void 0 : n.forEach) == null || r.call(n, (u) => l(u)), this.services.backendConnector.load(a, this.options.ns, (u) => {
1194
+ !u && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), s(u);
1195
+ });
1196
+ } else
1197
+ s(null);
1198
+ }
1199
+ reloadResources(e, t, s) {
1200
+ const i = K();
1201
+ return typeof e == "function" && (s = e, e = void 0), typeof t == "function" && (s = t, t = void 0), e || (e = this.languages), t || (t = this.options.ns), s || (s = J), this.services.backendConnector.reload(e, t, (n) => {
1202
+ i.resolve(), s(n);
1203
+ }), i;
1204
+ }
1205
+ use(e) {
1206
+ if (!e) throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1207
+ if (!e.type) throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1208
+ 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" && ye.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1209
+ }
1210
+ setResolvedLanguage(e) {
1211
+ if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1212
+ for (let t = 0; t < this.languages.length; t++) {
1213
+ const s = this.languages[t];
1214
+ if (!(["cimode", "dev"].indexOf(s) > -1) && this.store.hasLanguageSomeTranslations(s)) {
1215
+ this.resolvedLanguage = s;
1216
+ break;
1217
+ }
1218
+ }
1219
+ !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1220
+ }
1221
+ }
1222
+ changeLanguage(e, t) {
1223
+ this.isLanguageChangingTo = e;
1224
+ const s = K();
1225
+ this.emit("languageChanging", e);
1226
+ const i = (a) => {
1227
+ this.language = a, this.languages = this.services.languageUtils.toResolveHierarchy(a), this.resolvedLanguage = void 0, this.setResolvedLanguage(a);
1228
+ }, n = (a, l) => {
1229
+ l ? this.isLanguageChangingTo === e && (i(l), this.translator.changeLanguage(l), this.isLanguageChangingTo = void 0, this.emit("languageChanged", l), this.logger.log("languageChanged", l)) : this.isLanguageChangingTo = void 0, s.resolve((...u) => this.t(...u)), t && t(a, (...u) => this.t(...u));
1230
+ }, r = (a) => {
1231
+ var h, f;
1232
+ !e && !a && this.services.languageDetector && (a = []);
1233
+ const l = g(a) ? a : a && a[0], u = this.store.hasLanguageSomeTranslations(l) ? l : this.services.languageUtils.getBestMatchFromCodes(g(a) ? [a] : a);
1234
+ u && (this.language || i(u), this.translator.language || this.translator.changeLanguage(u), (f = (h = this.services.languageDetector) == null ? void 0 : h.cacheUserLanguage) == null || f.call(h, u)), this.loadResources(u, (p) => {
1235
+ n(p, u);
1236
+ });
1237
+ };
1238
+ return !e && this.services.languageDetector && !this.services.languageDetector.async ? r(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(r) : this.services.languageDetector.detect(r) : r(e), s;
1239
+ }
1240
+ getFixedT(e, t, s) {
1241
+ const i = (n, r, ...a) => {
1242
+ let l;
1243
+ typeof r != "object" ? l = this.options.overloadTranslationOptionHandler([n, r].concat(a)) : l = {
1244
+ ...r
1245
+ }, l.lng = l.lng || i.lng, l.lngs = l.lngs || i.lngs, l.ns = l.ns || i.ns, l.keyPrefix !== "" && (l.keyPrefix = l.keyPrefix || s || i.keyPrefix);
1246
+ const u = {
1247
+ ...this.options,
1248
+ ...l
1249
+ };
1250
+ typeof l.keyPrefix == "function" && (l.keyPrefix = I(l.keyPrefix, u));
1251
+ const h = this.options.keySeparator || ".";
1252
+ let f;
1253
+ return l.keyPrefix && Array.isArray(n) ? f = n.map((p) => (typeof p == "function" && (p = I(p, u)), `${l.keyPrefix}${h}${p}`)) : (typeof n == "function" && (n = I(n, u)), f = l.keyPrefix ? `${l.keyPrefix}${h}${n}` : n), this.t(f, l);
1254
+ };
1255
+ return g(e) ? i.lng = e : i.lngs = e, i.ns = t, i.keyPrefix = s, i;
1256
+ }
1257
+ t(...e) {
1258
+ var t;
1259
+ return (t = this.translator) == null ? void 0 : t.translate(...e);
1260
+ }
1261
+ exists(...e) {
1262
+ var t;
1263
+ return (t = this.translator) == null ? void 0 : t.exists(...e);
1264
+ }
1265
+ setDefaultNamespace(e) {
1266
+ this.options.defaultNS = e;
1267
+ }
1268
+ hasLoadedNamespace(e, t = {}) {
1269
+ if (!this.isInitialized)
1270
+ return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1271
+ if (!this.languages || !this.languages.length)
1272
+ return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1273
+ const s = t.lng || this.resolvedLanguage || this.languages[0], i = this.options ? this.options.fallbackLng : !1, n = this.languages[this.languages.length - 1];
1274
+ if (s.toLowerCase() === "cimode") return !0;
1275
+ const r = (a, l) => {
1276
+ const u = this.services.backendConnector.state[`${a}|${l}`];
1277
+ return u === -1 || u === 0 || u === 2;
1278
+ };
1279
+ if (t.precheck) {
1280
+ const a = t.precheck(this, r);
1281
+ if (a !== void 0) return a;
1282
+ }
1283
+ return !!(this.hasResourceBundle(s, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || r(s, e) && (!i || r(n, e)));
1284
+ }
1285
+ loadNamespaces(e, t) {
1286
+ const s = K();
1287
+ return this.options.ns ? (g(e) && (e = [e]), e.forEach((i) => {
1288
+ this.options.ns.indexOf(i) < 0 && this.options.ns.push(i);
1289
+ }), this.loadResources((i) => {
1290
+ s.resolve(), t && t(i);
1291
+ }), s) : (t && t(), Promise.resolve());
1292
+ }
1293
+ loadLanguages(e, t) {
1294
+ const s = K();
1295
+ g(e) && (e = [e]);
1296
+ const i = this.options.preload || [], n = e.filter((r) => i.indexOf(r) < 0 && this.services.languageUtils.isSupportedCode(r));
1297
+ return n.length ? (this.options.preload = i.concat(n), this.loadResources((r) => {
1298
+ s.resolve(), t && t(r);
1299
+ }), s) : (t && t(), Promise.resolve());
1300
+ }
1301
+ dir(e) {
1302
+ var i, n;
1303
+ if (e || (e = this.resolvedLanguage || (((i = this.languages) == null ? void 0 : i.length) > 0 ? this.languages[0] : this.language)), !e) return "rtl";
1304
+ try {
1305
+ const r = new Intl.Locale(e);
1306
+ if (r && r.getTextInfo) {
1307
+ const a = r.getTextInfo();
1308
+ if (a && a.direction) return a.direction;
1309
+ }
1310
+ } catch {
1311
+ }
1312
+ 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 = ((n = this.services) == null ? void 0 : n.languageUtils) || new fe(X());
1313
+ return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(s.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1314
+ }
1315
+ static createInstance(e = {}, t) {
1316
+ const s = new H(e, t);
1317
+ return s.createInstance = H.createInstance, s;
1318
+ }
1319
+ cloneInstance(e = {}, t = J) {
1320
+ const s = e.forkResourceStore;
1321
+ s && delete e.forkResourceStore;
1322
+ const i = {
1323
+ ...this.options,
1324
+ ...e,
1325
+ isClone: !0
1326
+ }, n = new H(i);
1327
+ if ((e.debug !== void 0 || e.prefix !== void 0) && (n.logger = n.logger.clone(e)), ["store", "services", "language"].forEach((a) => {
1328
+ n[a] = this[a];
1329
+ }), n.services = {
1330
+ ...this.services
1331
+ }, n.services.utils = {
1332
+ hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
1333
+ }, s) {
1334
+ const a = Object.keys(this.store.data).reduce((l, u) => (l[u] = {
1335
+ ...this.store.data[u]
1336
+ }, l[u] = Object.keys(l[u]).reduce((h, f) => (h[f] = {
1337
+ ...l[u][f]
1338
+ }, h), l[u]), l), {});
1339
+ n.store = new le(a, i), n.services.resourceStore = n.store;
1340
+ }
1341
+ if (e.interpolation) {
1342
+ const l = {
1343
+ ...X().interpolation,
1344
+ ...this.options.interpolation,
1345
+ ...e.interpolation
1346
+ }, u = {
1347
+ ...i,
1348
+ interpolation: l
1349
+ };
1350
+ n.services.interpolator = new pe(u);
1351
+ }
1352
+ return n.translator = new Y(n.services, i), n.translator.on("*", (a, ...l) => {
1353
+ n.emit(a, ...l);
1354
+ }), n.init(i, t), n.translator.options = i, n.translator.backendConnector.services.utils = {
1355
+ hasLoadedNamespace: n.hasLoadedNamespace.bind(n)
1356
+ }, n;
1357
+ }
1358
+ toJSON() {
1359
+ return {
1360
+ options: this.options,
1361
+ store: this.store,
1362
+ language: this.language,
1363
+ languages: this.languages,
1364
+ resolvedLanguage: this.resolvedLanguage
1365
+ };
1366
+ }
1367
+ }
1368
+ const L = H.createInstance();
1369
+ L.createInstance;
1370
+ L.dir;
1371
+ L.init;
1372
+ L.loadResources;
1373
+ L.reloadResources;
1374
+ const Je = L.use;
1375
+ L.changeLanguage;
1376
+ L.getFixedT;
1377
+ const _e = L.t;
1378
+ L.exists;
1379
+ L.setDefaultNamespace;
1380
+ L.hasLoadedNamespace;
1381
+ L.loadNamespaces;
1382
+ L.loadLanguages;
1383
+ export {
1384
+ L as i,
1385
+ I as k,
1386
+ _e as t,
1387
+ Je as u
1388
+ };