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