@viasoftbr/shared-ui 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/i18n.cjs ADDED
@@ -0,0 +1,3277 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // node_modules/.pnpm/void-elements@3.1.0/node_modules/void-elements/index.js
34
+ var require_void_elements = __commonJS({
35
+ "node_modules/.pnpm/void-elements@3.1.0/node_modules/void-elements/index.js"(exports, module2) {
36
+ module2.exports = {
37
+ "area": true,
38
+ "base": true,
39
+ "br": true,
40
+ "col": true,
41
+ "embed": true,
42
+ "hr": true,
43
+ "img": true,
44
+ "input": true,
45
+ "link": true,
46
+ "meta": true,
47
+ "param": true,
48
+ "source": true,
49
+ "track": true,
50
+ "wbr": true
51
+ };
52
+ }
53
+ });
54
+
55
+ // src/i18n.ts
56
+ var i18n_exports = {};
57
+ __export(i18n_exports, {
58
+ default: () => i18n_default
59
+ });
60
+ module.exports = __toCommonJS(i18n_exports);
61
+
62
+ // node_modules/.pnpm/i18next@25.8.2_typescript@5.9.3/node_modules/i18next/dist/esm/i18next.js
63
+ var isString = (obj) => typeof obj === "string";
64
+ var defer = () => {
65
+ let res;
66
+ let rej;
67
+ const promise = new Promise((resolve, reject) => {
68
+ res = resolve;
69
+ rej = reject;
70
+ });
71
+ promise.resolve = res;
72
+ promise.reject = rej;
73
+ return promise;
74
+ };
75
+ var makeString = (object) => {
76
+ if (object == null)
77
+ return "";
78
+ return "" + object;
79
+ };
80
+ var copy = (a, s, t2) => {
81
+ a.forEach((m) => {
82
+ if (s[m])
83
+ t2[m] = s[m];
84
+ });
85
+ };
86
+ var lastOfPathSeparatorRegExp = /###/g;
87
+ var cleanKey = (key) => key && key.indexOf("###") > -1 ? key.replace(lastOfPathSeparatorRegExp, ".") : key;
88
+ var canNotTraverseDeeper = (object) => !object || isString(object);
89
+ var getLastOfPath = (object, path, Empty) => {
90
+ const stack = !isString(path) ? path : path.split(".");
91
+ let stackIndex = 0;
92
+ while (stackIndex < stack.length - 1) {
93
+ if (canNotTraverseDeeper(object))
94
+ return {};
95
+ const key = cleanKey(stack[stackIndex]);
96
+ if (!object[key] && Empty)
97
+ object[key] = new Empty();
98
+ if (Object.prototype.hasOwnProperty.call(object, key)) {
99
+ object = object[key];
100
+ } else {
101
+ object = {};
102
+ }
103
+ ++stackIndex;
104
+ }
105
+ if (canNotTraverseDeeper(object))
106
+ return {};
107
+ return {
108
+ obj: object,
109
+ k: cleanKey(stack[stackIndex])
110
+ };
111
+ };
112
+ var setPath = (object, path, newValue) => {
113
+ const {
114
+ obj,
115
+ k
116
+ } = getLastOfPath(object, path, Object);
117
+ if (obj !== void 0 || path.length === 1) {
118
+ obj[k] = newValue;
119
+ return;
120
+ }
121
+ let e2 = path[path.length - 1];
122
+ let p = path.slice(0, path.length - 1);
123
+ let last = getLastOfPath(object, p, Object);
124
+ while (last.obj === void 0 && p.length) {
125
+ e2 = `${p[p.length - 1]}.${e2}`;
126
+ p = p.slice(0, p.length - 1);
127
+ last = getLastOfPath(object, p, Object);
128
+ if (last?.obj && typeof last.obj[`${last.k}.${e2}`] !== "undefined") {
129
+ last.obj = void 0;
130
+ }
131
+ }
132
+ last.obj[`${last.k}.${e2}`] = newValue;
133
+ };
134
+ var pushPath = (object, path, newValue, concat) => {
135
+ const {
136
+ obj,
137
+ k
138
+ } = getLastOfPath(object, path, Object);
139
+ obj[k] = obj[k] || [];
140
+ obj[k].push(newValue);
141
+ };
142
+ var getPath = (object, path) => {
143
+ const {
144
+ obj,
145
+ k
146
+ } = getLastOfPath(object, path);
147
+ if (!obj)
148
+ return void 0;
149
+ if (!Object.prototype.hasOwnProperty.call(obj, k))
150
+ return void 0;
151
+ return obj[k];
152
+ };
153
+ var getPathWithDefaults = (data, defaultData, key) => {
154
+ const value = getPath(data, key);
155
+ if (value !== void 0) {
156
+ return value;
157
+ }
158
+ return getPath(defaultData, key);
159
+ };
160
+ var deepExtend = (target, source, overwrite) => {
161
+ for (const prop in source) {
162
+ if (prop !== "__proto__" && prop !== "constructor") {
163
+ if (prop in target) {
164
+ if (isString(target[prop]) || target[prop] instanceof String || isString(source[prop]) || source[prop] instanceof String) {
165
+ if (overwrite)
166
+ target[prop] = source[prop];
167
+ } else {
168
+ deepExtend(target[prop], source[prop], overwrite);
169
+ }
170
+ } else {
171
+ target[prop] = source[prop];
172
+ }
173
+ }
174
+ }
175
+ return target;
176
+ };
177
+ var regexEscape = (str) => str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
178
+ var _entityMap = {
179
+ "&": "&amp;",
180
+ "<": "&lt;",
181
+ ">": "&gt;",
182
+ '"': "&quot;",
183
+ "'": "&#39;",
184
+ "/": "&#x2F;"
185
+ };
186
+ var escape = (data) => {
187
+ if (isString(data)) {
188
+ return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
189
+ }
190
+ return data;
191
+ };
192
+ var RegExpCache = class {
193
+ constructor(capacity) {
194
+ this.capacity = capacity;
195
+ this.regExpMap = /* @__PURE__ */ new Map();
196
+ this.regExpQueue = [];
197
+ }
198
+ getRegExp(pattern) {
199
+ const regExpFromCache = this.regExpMap.get(pattern);
200
+ if (regExpFromCache !== void 0) {
201
+ return regExpFromCache;
202
+ }
203
+ const regExpNew = new RegExp(pattern);
204
+ if (this.regExpQueue.length === this.capacity) {
205
+ this.regExpMap.delete(this.regExpQueue.shift());
206
+ }
207
+ this.regExpMap.set(pattern, regExpNew);
208
+ this.regExpQueue.push(pattern);
209
+ return regExpNew;
210
+ }
211
+ };
212
+ var chars = [" ", ",", "?", "!", ";"];
213
+ var looksLikeObjectPathRegExpCache = new RegExpCache(20);
214
+ var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
215
+ nsSeparator = nsSeparator || "";
216
+ keySeparator = keySeparator || "";
217
+ const possibleChars = chars.filter((c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
218
+ if (possibleChars.length === 0)
219
+ return true;
220
+ const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => c === "?" ? "\\?" : c).join("|")})`);
221
+ let matched = !r.test(key);
222
+ if (!matched) {
223
+ const ki = key.indexOf(keySeparator);
224
+ if (ki > 0 && !r.test(key.substring(0, ki))) {
225
+ matched = true;
226
+ }
227
+ }
228
+ return matched;
229
+ };
230
+ var deepFind = (obj, path, keySeparator = ".") => {
231
+ if (!obj)
232
+ return void 0;
233
+ if (obj[path]) {
234
+ if (!Object.prototype.hasOwnProperty.call(obj, path))
235
+ return void 0;
236
+ return obj[path];
237
+ }
238
+ const tokens = path.split(keySeparator);
239
+ let current = obj;
240
+ for (let i = 0; i < tokens.length; ) {
241
+ if (!current || typeof current !== "object") {
242
+ return void 0;
243
+ }
244
+ let next;
245
+ let nextPath = "";
246
+ for (let j = i; j < tokens.length; ++j) {
247
+ if (j !== i) {
248
+ nextPath += keySeparator;
249
+ }
250
+ nextPath += tokens[j];
251
+ next = current[nextPath];
252
+ if (next !== void 0) {
253
+ if (["string", "number", "boolean"].indexOf(typeof next) > -1 && j < tokens.length - 1) {
254
+ continue;
255
+ }
256
+ i += j - i + 1;
257
+ break;
258
+ }
259
+ }
260
+ current = next;
261
+ }
262
+ return current;
263
+ };
264
+ var getCleanedCode = (code) => code?.replace("_", "-");
265
+ var consoleLogger = {
266
+ type: "logger",
267
+ log(args) {
268
+ this.output("log", args);
269
+ },
270
+ warn(args) {
271
+ this.output("warn", args);
272
+ },
273
+ error(args) {
274
+ this.output("error", args);
275
+ },
276
+ output(type, args) {
277
+ console?.[type]?.apply?.(console, args);
278
+ }
279
+ };
280
+ var Logger = class _Logger {
281
+ constructor(concreteLogger, options = {}) {
282
+ this.init(concreteLogger, options);
283
+ }
284
+ init(concreteLogger, options = {}) {
285
+ this.prefix = options.prefix || "i18next:";
286
+ this.logger = concreteLogger || consoleLogger;
287
+ this.options = options;
288
+ this.debug = options.debug;
289
+ }
290
+ log(...args) {
291
+ return this.forward(args, "log", "", true);
292
+ }
293
+ warn(...args) {
294
+ return this.forward(args, "warn", "", true);
295
+ }
296
+ error(...args) {
297
+ return this.forward(args, "error", "");
298
+ }
299
+ deprecate(...args) {
300
+ return this.forward(args, "warn", "WARNING DEPRECATED: ", true);
301
+ }
302
+ forward(args, lvl, prefix, debugOnly) {
303
+ if (debugOnly && !this.debug)
304
+ return null;
305
+ if (isString(args[0]))
306
+ args[0] = `${prefix}${this.prefix} ${args[0]}`;
307
+ return this.logger[lvl](args);
308
+ }
309
+ create(moduleName) {
310
+ return new _Logger(this.logger, {
311
+ ...{
312
+ prefix: `${this.prefix}:${moduleName}:`
313
+ },
314
+ ...this.options
315
+ });
316
+ }
317
+ clone(options) {
318
+ options = options || this.options;
319
+ options.prefix = options.prefix || this.prefix;
320
+ return new _Logger(this.logger, options);
321
+ }
322
+ };
323
+ var baseLogger = new Logger();
324
+ var EventEmitter = class {
325
+ constructor() {
326
+ this.observers = {};
327
+ }
328
+ on(events, listener) {
329
+ events.split(" ").forEach((event) => {
330
+ if (!this.observers[event])
331
+ this.observers[event] = /* @__PURE__ */ new Map();
332
+ const numListeners = this.observers[event].get(listener) || 0;
333
+ this.observers[event].set(listener, numListeners + 1);
334
+ });
335
+ return this;
336
+ }
337
+ off(event, listener) {
338
+ if (!this.observers[event])
339
+ return;
340
+ if (!listener) {
341
+ delete this.observers[event];
342
+ return;
343
+ }
344
+ this.observers[event].delete(listener);
345
+ }
346
+ emit(event, ...args) {
347
+ if (this.observers[event]) {
348
+ const cloned = Array.from(this.observers[event].entries());
349
+ cloned.forEach(([observer, numTimesAdded]) => {
350
+ for (let i = 0; i < numTimesAdded; i++) {
351
+ observer(...args);
352
+ }
353
+ });
354
+ }
355
+ if (this.observers["*"]) {
356
+ const cloned = Array.from(this.observers["*"].entries());
357
+ cloned.forEach(([observer, numTimesAdded]) => {
358
+ for (let i = 0; i < numTimesAdded; i++) {
359
+ observer.apply(observer, [event, ...args]);
360
+ }
361
+ });
362
+ }
363
+ }
364
+ };
365
+ var ResourceStore = class extends EventEmitter {
366
+ constructor(data, options = {
367
+ ns: ["translation"],
368
+ defaultNS: "translation"
369
+ }) {
370
+ super();
371
+ this.data = data || {};
372
+ this.options = options;
373
+ if (this.options.keySeparator === void 0) {
374
+ this.options.keySeparator = ".";
375
+ }
376
+ if (this.options.ignoreJSONStructure === void 0) {
377
+ this.options.ignoreJSONStructure = true;
378
+ }
379
+ }
380
+ addNamespaces(ns) {
381
+ if (this.options.ns.indexOf(ns) < 0) {
382
+ this.options.ns.push(ns);
383
+ }
384
+ }
385
+ removeNamespaces(ns) {
386
+ const index = this.options.ns.indexOf(ns);
387
+ if (index > -1) {
388
+ this.options.ns.splice(index, 1);
389
+ }
390
+ }
391
+ getResource(lng, ns, key, options = {}) {
392
+ const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
393
+ const ignoreJSONStructure = options.ignoreJSONStructure !== void 0 ? options.ignoreJSONStructure : this.options.ignoreJSONStructure;
394
+ let path;
395
+ if (lng.indexOf(".") > -1) {
396
+ path = lng.split(".");
397
+ } else {
398
+ path = [lng, ns];
399
+ if (key) {
400
+ if (Array.isArray(key)) {
401
+ path.push(...key);
402
+ } else if (isString(key) && keySeparator) {
403
+ path.push(...key.split(keySeparator));
404
+ } else {
405
+ path.push(key);
406
+ }
407
+ }
408
+ }
409
+ const result = getPath(this.data, path);
410
+ if (!result && !ns && !key && lng.indexOf(".") > -1) {
411
+ lng = path[0];
412
+ ns = path[1];
413
+ key = path.slice(2).join(".");
414
+ }
415
+ if (result || !ignoreJSONStructure || !isString(key))
416
+ return result;
417
+ return deepFind(this.data?.[lng]?.[ns], key, keySeparator);
418
+ }
419
+ addResource(lng, ns, key, value, options = {
420
+ silent: false
421
+ }) {
422
+ const keySeparator = options.keySeparator !== void 0 ? options.keySeparator : this.options.keySeparator;
423
+ let path = [lng, ns];
424
+ if (key)
425
+ path = path.concat(keySeparator ? key.split(keySeparator) : key);
426
+ if (lng.indexOf(".") > -1) {
427
+ path = lng.split(".");
428
+ value = ns;
429
+ ns = path[1];
430
+ }
431
+ this.addNamespaces(ns);
432
+ setPath(this.data, path, value);
433
+ if (!options.silent)
434
+ this.emit("added", lng, ns, key, value);
435
+ }
436
+ addResources(lng, ns, resources2, options = {
437
+ silent: false
438
+ }) {
439
+ for (const m in resources2) {
440
+ if (isString(resources2[m]) || Array.isArray(resources2[m]))
441
+ this.addResource(lng, ns, m, resources2[m], {
442
+ silent: true
443
+ });
444
+ }
445
+ if (!options.silent)
446
+ this.emit("added", lng, ns, resources2);
447
+ }
448
+ addResourceBundle(lng, ns, resources2, deep, overwrite, options = {
449
+ silent: false,
450
+ skipCopy: false
451
+ }) {
452
+ let path = [lng, ns];
453
+ if (lng.indexOf(".") > -1) {
454
+ path = lng.split(".");
455
+ deep = resources2;
456
+ resources2 = ns;
457
+ ns = path[1];
458
+ }
459
+ this.addNamespaces(ns);
460
+ let pack = getPath(this.data, path) || {};
461
+ if (!options.skipCopy)
462
+ resources2 = JSON.parse(JSON.stringify(resources2));
463
+ if (deep) {
464
+ deepExtend(pack, resources2, overwrite);
465
+ } else {
466
+ pack = {
467
+ ...pack,
468
+ ...resources2
469
+ };
470
+ }
471
+ setPath(this.data, path, pack);
472
+ if (!options.silent)
473
+ this.emit("added", lng, ns, resources2);
474
+ }
475
+ removeResourceBundle(lng, ns) {
476
+ if (this.hasResourceBundle(lng, ns)) {
477
+ delete this.data[lng][ns];
478
+ }
479
+ this.removeNamespaces(ns);
480
+ this.emit("removed", lng, ns);
481
+ }
482
+ hasResourceBundle(lng, ns) {
483
+ return this.getResource(lng, ns) !== void 0;
484
+ }
485
+ getResourceBundle(lng, ns) {
486
+ if (!ns)
487
+ ns = this.options.defaultNS;
488
+ return this.getResource(lng, ns);
489
+ }
490
+ getDataByLanguage(lng) {
491
+ return this.data[lng];
492
+ }
493
+ hasLanguageSomeTranslations(lng) {
494
+ const data = this.getDataByLanguage(lng);
495
+ const n = data && Object.keys(data) || [];
496
+ return !!n.find((v) => data[v] && Object.keys(data[v]).length > 0);
497
+ }
498
+ toJSON() {
499
+ return this.data;
500
+ }
501
+ };
502
+ var postProcessor = {
503
+ processors: {},
504
+ addPostProcessor(module2) {
505
+ this.processors[module2.name] = module2;
506
+ },
507
+ handle(processors, value, key, options, translator) {
508
+ processors.forEach((processor) => {
509
+ value = this.processors[processor]?.process(value, key, options, translator) ?? value;
510
+ });
511
+ return value;
512
+ }
513
+ };
514
+ var PATH_KEY = Symbol("i18next/PATH_KEY");
515
+ function createProxy() {
516
+ const state = [];
517
+ const handler = /* @__PURE__ */ Object.create(null);
518
+ let proxy;
519
+ handler.get = (target, key) => {
520
+ proxy?.revoke?.();
521
+ if (key === PATH_KEY)
522
+ return state;
523
+ state.push(key);
524
+ proxy = Proxy.revocable(target, handler);
525
+ return proxy.proxy;
526
+ };
527
+ return Proxy.revocable(/* @__PURE__ */ Object.create(null), handler).proxy;
528
+ }
529
+ function keysFromSelector(selector, opts) {
530
+ const {
531
+ [PATH_KEY]: path
532
+ } = selector(createProxy());
533
+ return path.join(opts?.keySeparator ?? ".");
534
+ }
535
+ var checkedLoadedFor = {};
536
+ var shouldHandleAsObject = (res) => !isString(res) && typeof res !== "boolean" && typeof res !== "number";
537
+ var Translator = class _Translator extends EventEmitter {
538
+ constructor(services, options = {}) {
539
+ super();
540
+ copy(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], services, this);
541
+ this.options = options;
542
+ if (this.options.keySeparator === void 0) {
543
+ this.options.keySeparator = ".";
544
+ }
545
+ this.logger = baseLogger.create("translator");
546
+ }
547
+ changeLanguage(lng) {
548
+ if (lng)
549
+ this.language = lng;
550
+ }
551
+ exists(key, o = {
552
+ interpolation: {}
553
+ }) {
554
+ const opt = {
555
+ ...o
556
+ };
557
+ if (key == null)
558
+ return false;
559
+ const resolved = this.resolve(key, opt);
560
+ if (resolved?.res === void 0)
561
+ return false;
562
+ const isObject2 = shouldHandleAsObject(resolved.res);
563
+ if (opt.returnObjects === false && isObject2) {
564
+ return false;
565
+ }
566
+ return true;
567
+ }
568
+ extractFromKey(key, opt) {
569
+ let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
570
+ if (nsSeparator === void 0)
571
+ nsSeparator = ":";
572
+ const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
573
+ let namespaces = opt.ns || this.options.defaultNS || [];
574
+ const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
575
+ const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !opt.keySeparator && !this.options.userDefinedNsSeparator && !opt.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
576
+ if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
577
+ const m = key.match(this.interpolator.nestingRegexp);
578
+ if (m && m.length > 0) {
579
+ return {
580
+ key,
581
+ namespaces: isString(namespaces) ? [namespaces] : namespaces
582
+ };
583
+ }
584
+ const parts = key.split(nsSeparator);
585
+ if (nsSeparator !== keySeparator || nsSeparator === keySeparator && this.options.ns.indexOf(parts[0]) > -1)
586
+ namespaces = parts.shift();
587
+ key = parts.join(keySeparator);
588
+ }
589
+ return {
590
+ key,
591
+ namespaces: isString(namespaces) ? [namespaces] : namespaces
592
+ };
593
+ }
594
+ translate(keys, o, lastKey) {
595
+ let opt = typeof o === "object" ? {
596
+ ...o
597
+ } : o;
598
+ if (typeof opt !== "object" && this.options.overloadTranslationOptionHandler) {
599
+ opt = this.options.overloadTranslationOptionHandler(arguments);
600
+ }
601
+ if (typeof opt === "object")
602
+ opt = {
603
+ ...opt
604
+ };
605
+ if (!opt)
606
+ opt = {};
607
+ if (keys == null)
608
+ return "";
609
+ if (typeof keys === "function")
610
+ keys = keysFromSelector(keys, {
611
+ ...this.options,
612
+ ...opt
613
+ });
614
+ if (!Array.isArray(keys))
615
+ keys = [String(keys)];
616
+ const returnDetails = opt.returnDetails !== void 0 ? opt.returnDetails : this.options.returnDetails;
617
+ const keySeparator = opt.keySeparator !== void 0 ? opt.keySeparator : this.options.keySeparator;
618
+ const {
619
+ key,
620
+ namespaces
621
+ } = this.extractFromKey(keys[keys.length - 1], opt);
622
+ const namespace = namespaces[namespaces.length - 1];
623
+ let nsSeparator = opt.nsSeparator !== void 0 ? opt.nsSeparator : this.options.nsSeparator;
624
+ if (nsSeparator === void 0)
625
+ nsSeparator = ":";
626
+ const lng = opt.lng || this.language;
627
+ const appendNamespaceToCIMode = opt.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
628
+ if (lng?.toLowerCase() === "cimode") {
629
+ if (appendNamespaceToCIMode) {
630
+ if (returnDetails) {
631
+ return {
632
+ res: `${namespace}${nsSeparator}${key}`,
633
+ usedKey: key,
634
+ exactUsedKey: key,
635
+ usedLng: lng,
636
+ usedNS: namespace,
637
+ usedParams: this.getUsedParamsDetails(opt)
638
+ };
639
+ }
640
+ return `${namespace}${nsSeparator}${key}`;
641
+ }
642
+ if (returnDetails) {
643
+ return {
644
+ res: key,
645
+ usedKey: key,
646
+ exactUsedKey: key,
647
+ usedLng: lng,
648
+ usedNS: namespace,
649
+ usedParams: this.getUsedParamsDetails(opt)
650
+ };
651
+ }
652
+ return key;
653
+ }
654
+ const resolved = this.resolve(keys, opt);
655
+ let res = resolved?.res;
656
+ const resUsedKey = resolved?.usedKey || key;
657
+ const resExactUsedKey = resolved?.exactUsedKey || key;
658
+ const noObject = ["[object Number]", "[object Function]", "[object RegExp]"];
659
+ const joinArrays = opt.joinArrays !== void 0 ? opt.joinArrays : this.options.joinArrays;
660
+ const handleAsObjectInI18nFormat = !this.i18nFormat || this.i18nFormat.handleAsObject;
661
+ const needsPluralHandling = opt.count !== void 0 && !isString(opt.count);
662
+ const hasDefaultValue = _Translator.hasDefaultValue(opt);
663
+ const defaultValueSuffix = needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, opt) : "";
664
+ const defaultValueSuffixOrdinalFallback = opt.ordinal && needsPluralHandling ? this.pluralResolver.getSuffix(lng, opt.count, {
665
+ ordinal: false
666
+ }) : "";
667
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
668
+ const defaultValue = needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] || opt[`defaultValue${defaultValueSuffix}`] || opt[`defaultValue${defaultValueSuffixOrdinalFallback}`] || opt.defaultValue;
669
+ let resForObjHndl = res;
670
+ if (handleAsObjectInI18nFormat && !res && hasDefaultValue) {
671
+ resForObjHndl = defaultValue;
672
+ }
673
+ const handleAsObject = shouldHandleAsObject(resForObjHndl);
674
+ const resType = Object.prototype.toString.apply(resForObjHndl);
675
+ if (handleAsObjectInI18nFormat && resForObjHndl && handleAsObject && noObject.indexOf(resType) < 0 && !(isString(joinArrays) && Array.isArray(resForObjHndl))) {
676
+ if (!opt.returnObjects && !this.options.returnObjects) {
677
+ if (!this.options.returnedObjectHandler) {
678
+ this.logger.warn("accessing an object - but returnObjects options is not enabled!");
679
+ }
680
+ const r = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(resUsedKey, resForObjHndl, {
681
+ ...opt,
682
+ ns: namespaces
683
+ }) : `key '${key} (${this.language})' returned an object instead of string.`;
684
+ if (returnDetails) {
685
+ resolved.res = r;
686
+ resolved.usedParams = this.getUsedParamsDetails(opt);
687
+ return resolved;
688
+ }
689
+ return r;
690
+ }
691
+ if (keySeparator) {
692
+ const resTypeIsArray = Array.isArray(resForObjHndl);
693
+ const copy2 = resTypeIsArray ? [] : {};
694
+ const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
695
+ for (const m in resForObjHndl) {
696
+ if (Object.prototype.hasOwnProperty.call(resForObjHndl, m)) {
697
+ const deepKey = `${newKeyToUse}${keySeparator}${m}`;
698
+ if (hasDefaultValue && !res) {
699
+ copy2[m] = this.translate(deepKey, {
700
+ ...opt,
701
+ defaultValue: shouldHandleAsObject(defaultValue) ? defaultValue[m] : void 0,
702
+ ...{
703
+ joinArrays: false,
704
+ ns: namespaces
705
+ }
706
+ });
707
+ } else {
708
+ copy2[m] = this.translate(deepKey, {
709
+ ...opt,
710
+ ...{
711
+ joinArrays: false,
712
+ ns: namespaces
713
+ }
714
+ });
715
+ }
716
+ if (copy2[m] === deepKey)
717
+ copy2[m] = resForObjHndl[m];
718
+ }
719
+ }
720
+ res = copy2;
721
+ }
722
+ } else if (handleAsObjectInI18nFormat && isString(joinArrays) && Array.isArray(res)) {
723
+ res = res.join(joinArrays);
724
+ if (res)
725
+ res = this.extendTranslation(res, keys, opt, lastKey);
726
+ } else {
727
+ let usedDefault = false;
728
+ let usedKey = false;
729
+ if (!this.isValidLookup(res) && hasDefaultValue) {
730
+ usedDefault = true;
731
+ res = defaultValue;
732
+ }
733
+ if (!this.isValidLookup(res)) {
734
+ usedKey = true;
735
+ res = key;
736
+ }
737
+ const missingKeyNoValueFallbackToKey = opt.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey;
738
+ const resForMissing = missingKeyNoValueFallbackToKey && usedKey ? void 0 : res;
739
+ const updateMissing = hasDefaultValue && defaultValue !== res && this.options.updateMissing;
740
+ if (usedKey || usedDefault || updateMissing) {
741
+ this.logger.log(updateMissing ? "updateKey" : "missingKey", lng, namespace, key, updateMissing ? defaultValue : res);
742
+ if (keySeparator) {
743
+ const fk = this.resolve(key, {
744
+ ...opt,
745
+ keySeparator: false
746
+ });
747
+ if (fk && fk.res)
748
+ 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.");
749
+ }
750
+ let lngs = [];
751
+ const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, opt.lng || this.language);
752
+ if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
753
+ for (let i = 0; i < fallbackLngs.length; i++) {
754
+ lngs.push(fallbackLngs[i]);
755
+ }
756
+ } else if (this.options.saveMissingTo === "all") {
757
+ lngs = this.languageUtils.toResolveHierarchy(opt.lng || this.language);
758
+ } else {
759
+ lngs.push(opt.lng || this.language);
760
+ }
761
+ const send = (l, k, specificDefaultValue) => {
762
+ const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
763
+ if (this.options.missingKeyHandler) {
764
+ this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, opt);
765
+ } else if (this.backendConnector?.saveMissing) {
766
+ this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, opt);
767
+ }
768
+ this.emit("missingKey", l, namespace, k, res);
769
+ };
770
+ if (this.options.saveMissing) {
771
+ if (this.options.saveMissingPlurals && needsPluralHandling) {
772
+ lngs.forEach((language) => {
773
+ const suffixes = this.pluralResolver.getSuffixes(language, opt);
774
+ if (needsZeroSuffixLookup && opt[`defaultValue${this.options.pluralSeparator}zero`] && suffixes.indexOf(`${this.options.pluralSeparator}zero`) < 0) {
775
+ suffixes.push(`${this.options.pluralSeparator}zero`);
776
+ }
777
+ suffixes.forEach((suffix) => {
778
+ send([language], key + suffix, opt[`defaultValue${suffix}`] || defaultValue);
779
+ });
780
+ });
781
+ } else {
782
+ send(lngs, key, defaultValue);
783
+ }
784
+ }
785
+ }
786
+ res = this.extendTranslation(res, keys, opt, resolved, lastKey);
787
+ if (usedKey && res === key && this.options.appendNamespaceToMissingKey) {
788
+ res = `${namespace}${nsSeparator}${key}`;
789
+ }
790
+ if ((usedKey || usedDefault) && this.options.parseMissingKeyHandler) {
791
+ res = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${namespace}${nsSeparator}${key}` : key, usedDefault ? res : void 0, opt);
792
+ }
793
+ }
794
+ if (returnDetails) {
795
+ resolved.res = res;
796
+ resolved.usedParams = this.getUsedParamsDetails(opt);
797
+ return resolved;
798
+ }
799
+ return res;
800
+ }
801
+ extendTranslation(res, key, opt, resolved, lastKey) {
802
+ if (this.i18nFormat?.parse) {
803
+ res = this.i18nFormat.parse(res, {
804
+ ...this.options.interpolation.defaultVariables,
805
+ ...opt
806
+ }, opt.lng || this.language || resolved.usedLng, resolved.usedNS, resolved.usedKey, {
807
+ resolved
808
+ });
809
+ } else if (!opt.skipInterpolation) {
810
+ if (opt.interpolation)
811
+ this.interpolator.init({
812
+ ...opt,
813
+ ...{
814
+ interpolation: {
815
+ ...this.options.interpolation,
816
+ ...opt.interpolation
817
+ }
818
+ }
819
+ });
820
+ const skipOnVariables = isString(res) && (opt?.interpolation?.skipOnVariables !== void 0 ? opt.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables);
821
+ let nestBef;
822
+ if (skipOnVariables) {
823
+ const nb = res.match(this.interpolator.nestingRegexp);
824
+ nestBef = nb && nb.length;
825
+ }
826
+ let data = opt.replace && !isString(opt.replace) ? opt.replace : opt;
827
+ if (this.options.interpolation.defaultVariables)
828
+ data = {
829
+ ...this.options.interpolation.defaultVariables,
830
+ ...data
831
+ };
832
+ res = this.interpolator.interpolate(res, data, opt.lng || this.language || resolved.usedLng, opt);
833
+ if (skipOnVariables) {
834
+ const na = res.match(this.interpolator.nestingRegexp);
835
+ const nestAft = na && na.length;
836
+ if (nestBef < nestAft)
837
+ opt.nest = false;
838
+ }
839
+ if (!opt.lng && resolved && resolved.res)
840
+ opt.lng = this.language || resolved.usedLng;
841
+ if (opt.nest !== false)
842
+ res = this.interpolator.nest(res, (...args) => {
843
+ if (lastKey?.[0] === args[0] && !opt.context) {
844
+ this.logger.warn(`It seems you are nesting recursively key: ${args[0]} in key: ${key[0]}`);
845
+ return null;
846
+ }
847
+ return this.translate(...args, key);
848
+ }, opt);
849
+ if (opt.interpolation)
850
+ this.interpolator.reset();
851
+ }
852
+ const postProcess = opt.postProcess || this.options.postProcess;
853
+ const postProcessorNames = isString(postProcess) ? [postProcess] : postProcess;
854
+ if (res != null && postProcessorNames?.length && opt.applyPostProcessor !== false) {
855
+ res = postProcessor.handle(postProcessorNames, res, key, this.options && this.options.postProcessPassResolved ? {
856
+ i18nResolved: {
857
+ ...resolved,
858
+ usedParams: this.getUsedParamsDetails(opt)
859
+ },
860
+ ...opt
861
+ } : opt, this);
862
+ }
863
+ return res;
864
+ }
865
+ resolve(keys, opt = {}) {
866
+ let found;
867
+ let usedKey;
868
+ let exactUsedKey;
869
+ let usedLng;
870
+ let usedNS;
871
+ if (isString(keys))
872
+ keys = [keys];
873
+ keys.forEach((k) => {
874
+ if (this.isValidLookup(found))
875
+ return;
876
+ const extracted = this.extractFromKey(k, opt);
877
+ const key = extracted.key;
878
+ usedKey = key;
879
+ let namespaces = extracted.namespaces;
880
+ if (this.options.fallbackNS)
881
+ namespaces = namespaces.concat(this.options.fallbackNS);
882
+ const needsPluralHandling = opt.count !== void 0 && !isString(opt.count);
883
+ const needsZeroSuffixLookup = needsPluralHandling && !opt.ordinal && opt.count === 0;
884
+ const needsContextHandling = opt.context !== void 0 && (isString(opt.context) || typeof opt.context === "number") && opt.context !== "";
885
+ const codes = opt.lngs ? opt.lngs : this.languageUtils.toResolveHierarchy(opt.lng || this.language, opt.fallbackLng);
886
+ namespaces.forEach((ns) => {
887
+ if (this.isValidLookup(found))
888
+ return;
889
+ usedNS = ns;
890
+ if (!checkedLoadedFor[`${codes[0]}-${ns}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(usedNS)) {
891
+ checkedLoadedFor[`${codes[0]}-${ns}`] = true;
892
+ this.logger.warn(`key "${usedKey}" for languages "${codes.join(", ")}" won't get resolved as namespace "${usedNS}" 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!!!");
893
+ }
894
+ codes.forEach((code) => {
895
+ if (this.isValidLookup(found))
896
+ return;
897
+ usedLng = code;
898
+ const finalKeys = [key];
899
+ if (this.i18nFormat?.addLookupKeys) {
900
+ this.i18nFormat.addLookupKeys(finalKeys, key, code, ns, opt);
901
+ } else {
902
+ let pluralSuffix;
903
+ if (needsPluralHandling)
904
+ pluralSuffix = this.pluralResolver.getSuffix(code, opt.count, opt);
905
+ const zeroSuffix = `${this.options.pluralSeparator}zero`;
906
+ const ordinalPrefix = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
907
+ if (needsPluralHandling) {
908
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
909
+ finalKeys.push(key + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
910
+ }
911
+ finalKeys.push(key + pluralSuffix);
912
+ if (needsZeroSuffixLookup) {
913
+ finalKeys.push(key + zeroSuffix);
914
+ }
915
+ }
916
+ if (needsContextHandling) {
917
+ const contextKey = `${key}${this.options.contextSeparator || "_"}${opt.context}`;
918
+ finalKeys.push(contextKey);
919
+ if (needsPluralHandling) {
920
+ if (opt.ordinal && pluralSuffix.indexOf(ordinalPrefix) === 0) {
921
+ finalKeys.push(contextKey + pluralSuffix.replace(ordinalPrefix, this.options.pluralSeparator));
922
+ }
923
+ finalKeys.push(contextKey + pluralSuffix);
924
+ if (needsZeroSuffixLookup) {
925
+ finalKeys.push(contextKey + zeroSuffix);
926
+ }
927
+ }
928
+ }
929
+ }
930
+ let possibleKey;
931
+ while (possibleKey = finalKeys.pop()) {
932
+ if (!this.isValidLookup(found)) {
933
+ exactUsedKey = possibleKey;
934
+ found = this.getResource(code, ns, possibleKey, opt);
935
+ }
936
+ }
937
+ });
938
+ });
939
+ });
940
+ return {
941
+ res: found,
942
+ usedKey,
943
+ exactUsedKey,
944
+ usedLng,
945
+ usedNS
946
+ };
947
+ }
948
+ isValidLookup(res) {
949
+ return res !== void 0 && !(!this.options.returnNull && res === null) && !(!this.options.returnEmptyString && res === "");
950
+ }
951
+ getResource(code, ns, key, options = {}) {
952
+ if (this.i18nFormat?.getResource)
953
+ return this.i18nFormat.getResource(code, ns, key, options);
954
+ return this.resourceStore.getResource(code, ns, key, options);
955
+ }
956
+ getUsedParamsDetails(options = {}) {
957
+ const optionsKeys = ["defaultValue", "ordinal", "context", "replace", "lng", "lngs", "fallbackLng", "ns", "keySeparator", "nsSeparator", "returnObjects", "returnDetails", "joinArrays", "postProcess", "interpolation"];
958
+ const useOptionsReplaceForData = options.replace && !isString(options.replace);
959
+ let data = useOptionsReplaceForData ? options.replace : options;
960
+ if (useOptionsReplaceForData && typeof options.count !== "undefined") {
961
+ data.count = options.count;
962
+ }
963
+ if (this.options.interpolation.defaultVariables) {
964
+ data = {
965
+ ...this.options.interpolation.defaultVariables,
966
+ ...data
967
+ };
968
+ }
969
+ if (!useOptionsReplaceForData) {
970
+ data = {
971
+ ...data
972
+ };
973
+ for (const key of optionsKeys) {
974
+ delete data[key];
975
+ }
976
+ }
977
+ return data;
978
+ }
979
+ static hasDefaultValue(options) {
980
+ const prefix = "defaultValue";
981
+ for (const option in options) {
982
+ if (Object.prototype.hasOwnProperty.call(options, option) && prefix === option.substring(0, prefix.length) && void 0 !== options[option]) {
983
+ return true;
984
+ }
985
+ }
986
+ return false;
987
+ }
988
+ };
989
+ var LanguageUtil = class {
990
+ constructor(options) {
991
+ this.options = options;
992
+ this.supportedLngs = this.options.supportedLngs || false;
993
+ this.logger = baseLogger.create("languageUtils");
994
+ }
995
+ getScriptPartFromCode(code) {
996
+ code = getCleanedCode(code);
997
+ if (!code || code.indexOf("-") < 0)
998
+ return null;
999
+ const p = code.split("-");
1000
+ if (p.length === 2)
1001
+ return null;
1002
+ p.pop();
1003
+ if (p[p.length - 1].toLowerCase() === "x")
1004
+ return null;
1005
+ return this.formatLanguageCode(p.join("-"));
1006
+ }
1007
+ getLanguagePartFromCode(code) {
1008
+ code = getCleanedCode(code);
1009
+ if (!code || code.indexOf("-") < 0)
1010
+ return code;
1011
+ const p = code.split("-");
1012
+ return this.formatLanguageCode(p[0]);
1013
+ }
1014
+ formatLanguageCode(code) {
1015
+ if (isString(code) && code.indexOf("-") > -1) {
1016
+ let formattedCode;
1017
+ try {
1018
+ formattedCode = Intl.getCanonicalLocales(code)[0];
1019
+ } catch (e2) {
1020
+ }
1021
+ if (formattedCode && this.options.lowerCaseLng) {
1022
+ formattedCode = formattedCode.toLowerCase();
1023
+ }
1024
+ if (formattedCode)
1025
+ return formattedCode;
1026
+ if (this.options.lowerCaseLng) {
1027
+ return code.toLowerCase();
1028
+ }
1029
+ return code;
1030
+ }
1031
+ return this.options.cleanCode || this.options.lowerCaseLng ? code.toLowerCase() : code;
1032
+ }
1033
+ isSupportedCode(code) {
1034
+ if (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) {
1035
+ code = this.getLanguagePartFromCode(code);
1036
+ }
1037
+ return !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(code) > -1;
1038
+ }
1039
+ getBestMatchFromCodes(codes) {
1040
+ if (!codes)
1041
+ return null;
1042
+ let found;
1043
+ codes.forEach((code) => {
1044
+ if (found)
1045
+ return;
1046
+ const cleanedLng = this.formatLanguageCode(code);
1047
+ if (!this.options.supportedLngs || this.isSupportedCode(cleanedLng))
1048
+ found = cleanedLng;
1049
+ });
1050
+ if (!found && this.options.supportedLngs) {
1051
+ codes.forEach((code) => {
1052
+ if (found)
1053
+ return;
1054
+ const lngScOnly = this.getScriptPartFromCode(code);
1055
+ if (this.isSupportedCode(lngScOnly))
1056
+ return found = lngScOnly;
1057
+ const lngOnly = this.getLanguagePartFromCode(code);
1058
+ if (this.isSupportedCode(lngOnly))
1059
+ return found = lngOnly;
1060
+ found = this.options.supportedLngs.find((supportedLng) => {
1061
+ if (supportedLng === lngOnly)
1062
+ return supportedLng;
1063
+ if (supportedLng.indexOf("-") < 0 && lngOnly.indexOf("-") < 0)
1064
+ return;
1065
+ if (supportedLng.indexOf("-") > 0 && lngOnly.indexOf("-") < 0 && supportedLng.substring(0, supportedLng.indexOf("-")) === lngOnly)
1066
+ return supportedLng;
1067
+ if (supportedLng.indexOf(lngOnly) === 0 && lngOnly.length > 1)
1068
+ return supportedLng;
1069
+ });
1070
+ });
1071
+ }
1072
+ if (!found)
1073
+ found = this.getFallbackCodes(this.options.fallbackLng)[0];
1074
+ return found;
1075
+ }
1076
+ getFallbackCodes(fallbacks, code) {
1077
+ if (!fallbacks)
1078
+ return [];
1079
+ if (typeof fallbacks === "function")
1080
+ fallbacks = fallbacks(code);
1081
+ if (isString(fallbacks))
1082
+ fallbacks = [fallbacks];
1083
+ if (Array.isArray(fallbacks))
1084
+ return fallbacks;
1085
+ if (!code)
1086
+ return fallbacks.default || [];
1087
+ let found = fallbacks[code];
1088
+ if (!found)
1089
+ found = fallbacks[this.getScriptPartFromCode(code)];
1090
+ if (!found)
1091
+ found = fallbacks[this.formatLanguageCode(code)];
1092
+ if (!found)
1093
+ found = fallbacks[this.getLanguagePartFromCode(code)];
1094
+ if (!found)
1095
+ found = fallbacks.default;
1096
+ return found || [];
1097
+ }
1098
+ toResolveHierarchy(code, fallbackCode) {
1099
+ const fallbackCodes = this.getFallbackCodes((fallbackCode === false ? [] : fallbackCode) || this.options.fallbackLng || [], code);
1100
+ const codes = [];
1101
+ const addCode = (c) => {
1102
+ if (!c)
1103
+ return;
1104
+ if (this.isSupportedCode(c)) {
1105
+ codes.push(c);
1106
+ } else {
1107
+ this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
1108
+ }
1109
+ };
1110
+ if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
1111
+ if (this.options.load !== "languageOnly")
1112
+ addCode(this.formatLanguageCode(code));
1113
+ if (this.options.load !== "languageOnly" && this.options.load !== "currentOnly")
1114
+ addCode(this.getScriptPartFromCode(code));
1115
+ if (this.options.load !== "currentOnly")
1116
+ addCode(this.getLanguagePartFromCode(code));
1117
+ } else if (isString(code)) {
1118
+ addCode(this.formatLanguageCode(code));
1119
+ }
1120
+ fallbackCodes.forEach((fc) => {
1121
+ if (codes.indexOf(fc) < 0)
1122
+ addCode(this.formatLanguageCode(fc));
1123
+ });
1124
+ return codes;
1125
+ }
1126
+ };
1127
+ var suffixesOrder = {
1128
+ zero: 0,
1129
+ one: 1,
1130
+ two: 2,
1131
+ few: 3,
1132
+ many: 4,
1133
+ other: 5
1134
+ };
1135
+ var dummyRule = {
1136
+ select: (count) => count === 1 ? "one" : "other",
1137
+ resolvedOptions: () => ({
1138
+ pluralCategories: ["one", "other"]
1139
+ })
1140
+ };
1141
+ var PluralResolver = class {
1142
+ constructor(languageUtils, options = {}) {
1143
+ this.languageUtils = languageUtils;
1144
+ this.options = options;
1145
+ this.logger = baseLogger.create("pluralResolver");
1146
+ this.pluralRulesCache = {};
1147
+ }
1148
+ clearCache() {
1149
+ this.pluralRulesCache = {};
1150
+ }
1151
+ getRule(code, options = {}) {
1152
+ const cleanedCode = getCleanedCode(code === "dev" ? "en" : code);
1153
+ const type = options.ordinal ? "ordinal" : "cardinal";
1154
+ const cacheKey = JSON.stringify({
1155
+ cleanedCode,
1156
+ type
1157
+ });
1158
+ if (cacheKey in this.pluralRulesCache) {
1159
+ return this.pluralRulesCache[cacheKey];
1160
+ }
1161
+ let rule;
1162
+ try {
1163
+ rule = new Intl.PluralRules(cleanedCode, {
1164
+ type
1165
+ });
1166
+ } catch (err) {
1167
+ if (!Intl) {
1168
+ this.logger.error("No Intl support, please use an Intl polyfill!");
1169
+ return dummyRule;
1170
+ }
1171
+ if (!code.match(/-|_/))
1172
+ return dummyRule;
1173
+ const lngPart = this.languageUtils.getLanguagePartFromCode(code);
1174
+ rule = this.getRule(lngPart, options);
1175
+ }
1176
+ this.pluralRulesCache[cacheKey] = rule;
1177
+ return rule;
1178
+ }
1179
+ needsPlural(code, options = {}) {
1180
+ let rule = this.getRule(code, options);
1181
+ if (!rule)
1182
+ rule = this.getRule("dev", options);
1183
+ return rule?.resolvedOptions().pluralCategories.length > 1;
1184
+ }
1185
+ getPluralFormsOfKey(code, key, options = {}) {
1186
+ return this.getSuffixes(code, options).map((suffix) => `${key}${suffix}`);
1187
+ }
1188
+ getSuffixes(code, options = {}) {
1189
+ let rule = this.getRule(code, options);
1190
+ if (!rule)
1191
+ rule = this.getRule("dev", options);
1192
+ if (!rule)
1193
+ return [];
1194
+ return rule.resolvedOptions().pluralCategories.sort((pluralCategory1, pluralCategory2) => suffixesOrder[pluralCategory1] - suffixesOrder[pluralCategory2]).map((pluralCategory) => `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${pluralCategory}`);
1195
+ }
1196
+ getSuffix(code, count, options = {}) {
1197
+ const rule = this.getRule(code, options);
1198
+ if (rule) {
1199
+ return `${this.options.prepend}${options.ordinal ? `ordinal${this.options.prepend}` : ""}${rule.select(count)}`;
1200
+ }
1201
+ this.logger.warn(`no plural rule found for: ${code}`);
1202
+ return this.getSuffix("dev", count, options);
1203
+ }
1204
+ };
1205
+ var deepFindWithDefaults = (data, defaultData, key, keySeparator = ".", ignoreJSONStructure = true) => {
1206
+ let path = getPathWithDefaults(data, defaultData, key);
1207
+ if (!path && ignoreJSONStructure && isString(key)) {
1208
+ path = deepFind(data, key, keySeparator);
1209
+ if (path === void 0)
1210
+ path = deepFind(defaultData, key, keySeparator);
1211
+ }
1212
+ return path;
1213
+ };
1214
+ var regexSafe = (val) => val.replace(/\$/g, "$$$$");
1215
+ var Interpolator = class {
1216
+ constructor(options = {}) {
1217
+ this.logger = baseLogger.create("interpolator");
1218
+ this.options = options;
1219
+ this.format = options?.interpolation?.format || ((value) => value);
1220
+ this.init(options);
1221
+ }
1222
+ init(options = {}) {
1223
+ if (!options.interpolation)
1224
+ options.interpolation = {
1225
+ escapeValue: true
1226
+ };
1227
+ const {
1228
+ escape: escape$1,
1229
+ escapeValue,
1230
+ useRawValueToEscape,
1231
+ prefix,
1232
+ prefixEscaped,
1233
+ suffix,
1234
+ suffixEscaped,
1235
+ formatSeparator,
1236
+ unescapeSuffix,
1237
+ unescapePrefix,
1238
+ nestingPrefix,
1239
+ nestingPrefixEscaped,
1240
+ nestingSuffix,
1241
+ nestingSuffixEscaped,
1242
+ nestingOptionsSeparator,
1243
+ maxReplaces,
1244
+ alwaysFormat
1245
+ } = options.interpolation;
1246
+ this.escape = escape$1 !== void 0 ? escape$1 : escape;
1247
+ this.escapeValue = escapeValue !== void 0 ? escapeValue : true;
1248
+ this.useRawValueToEscape = useRawValueToEscape !== void 0 ? useRawValueToEscape : false;
1249
+ this.prefix = prefix ? regexEscape(prefix) : prefixEscaped || "{{";
1250
+ this.suffix = suffix ? regexEscape(suffix) : suffixEscaped || "}}";
1251
+ this.formatSeparator = formatSeparator || ",";
1252
+ this.unescapePrefix = unescapeSuffix ? "" : unescapePrefix || "-";
1253
+ this.unescapeSuffix = this.unescapePrefix ? "" : unescapeSuffix || "";
1254
+ this.nestingPrefix = nestingPrefix ? regexEscape(nestingPrefix) : nestingPrefixEscaped || regexEscape("$t(");
1255
+ this.nestingSuffix = nestingSuffix ? regexEscape(nestingSuffix) : nestingSuffixEscaped || regexEscape(")");
1256
+ this.nestingOptionsSeparator = nestingOptionsSeparator || ",";
1257
+ this.maxReplaces = maxReplaces || 1e3;
1258
+ this.alwaysFormat = alwaysFormat !== void 0 ? alwaysFormat : false;
1259
+ this.resetRegExp();
1260
+ }
1261
+ reset() {
1262
+ if (this.options)
1263
+ this.init(this.options);
1264
+ }
1265
+ resetRegExp() {
1266
+ const getOrResetRegExp = (existingRegExp, pattern) => {
1267
+ if (existingRegExp?.source === pattern) {
1268
+ existingRegExp.lastIndex = 0;
1269
+ return existingRegExp;
1270
+ }
1271
+ return new RegExp(pattern, "g");
1272
+ };
1273
+ this.regexp = getOrResetRegExp(this.regexp, `${this.prefix}(.+?)${this.suffix}`);
1274
+ this.regexpUnescape = getOrResetRegExp(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`);
1275
+ this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
1276
+ }
1277
+ interpolate(str, data, lng, options) {
1278
+ let match;
1279
+ let value;
1280
+ let replaces;
1281
+ const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
1282
+ const handleFormat = (key) => {
1283
+ if (key.indexOf(this.formatSeparator) < 0) {
1284
+ const path = deepFindWithDefaults(data, defaultData, key, this.options.keySeparator, this.options.ignoreJSONStructure);
1285
+ return this.alwaysFormat ? this.format(path, void 0, lng, {
1286
+ ...options,
1287
+ ...data,
1288
+ interpolationkey: key
1289
+ }) : path;
1290
+ }
1291
+ const p = key.split(this.formatSeparator);
1292
+ const k = p.shift().trim();
1293
+ const f = p.join(this.formatSeparator).trim();
1294
+ return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
1295
+ ...options,
1296
+ ...data,
1297
+ interpolationkey: k
1298
+ });
1299
+ };
1300
+ this.resetRegExp();
1301
+ const missingInterpolationHandler = options?.missingInterpolationHandler || this.options.missingInterpolationHandler;
1302
+ const skipOnVariables = options?.interpolation?.skipOnVariables !== void 0 ? options.interpolation.skipOnVariables : this.options.interpolation.skipOnVariables;
1303
+ const todos = [{
1304
+ regex: this.regexpUnescape,
1305
+ safeValue: (val) => regexSafe(val)
1306
+ }, {
1307
+ regex: this.regexp,
1308
+ safeValue: (val) => this.escapeValue ? regexSafe(this.escape(val)) : regexSafe(val)
1309
+ }];
1310
+ todos.forEach((todo) => {
1311
+ replaces = 0;
1312
+ while (match = todo.regex.exec(str)) {
1313
+ const matchedVar = match[1].trim();
1314
+ value = handleFormat(matchedVar);
1315
+ if (value === void 0) {
1316
+ if (typeof missingInterpolationHandler === "function") {
1317
+ const temp = missingInterpolationHandler(str, match, options);
1318
+ value = isString(temp) ? temp : "";
1319
+ } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
1320
+ value = "";
1321
+ } else if (skipOnVariables) {
1322
+ value = match[0];
1323
+ continue;
1324
+ } else {
1325
+ this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
1326
+ value = "";
1327
+ }
1328
+ } else if (!isString(value) && !this.useRawValueToEscape) {
1329
+ value = makeString(value);
1330
+ }
1331
+ const safeValue = todo.safeValue(value);
1332
+ str = str.replace(match[0], safeValue);
1333
+ if (skipOnVariables) {
1334
+ todo.regex.lastIndex += value.length;
1335
+ todo.regex.lastIndex -= match[0].length;
1336
+ } else {
1337
+ todo.regex.lastIndex = 0;
1338
+ }
1339
+ replaces++;
1340
+ if (replaces >= this.maxReplaces) {
1341
+ break;
1342
+ }
1343
+ }
1344
+ });
1345
+ return str;
1346
+ }
1347
+ nest(str, fc, options = {}) {
1348
+ let match;
1349
+ let value;
1350
+ let clonedOptions;
1351
+ const handleHasOptions = (key, inheritedOptions) => {
1352
+ const sep = this.nestingOptionsSeparator;
1353
+ if (key.indexOf(sep) < 0)
1354
+ return key;
1355
+ const c = key.split(new RegExp(`${sep}[ ]*{`));
1356
+ let optionsString = `{${c[1]}`;
1357
+ key = c[0];
1358
+ optionsString = this.interpolate(optionsString, clonedOptions);
1359
+ const matchedSingleQuotes = optionsString.match(/'/g);
1360
+ const matchedDoubleQuotes = optionsString.match(/"/g);
1361
+ if ((matchedSingleQuotes?.length ?? 0) % 2 === 0 && !matchedDoubleQuotes || matchedDoubleQuotes.length % 2 !== 0) {
1362
+ optionsString = optionsString.replace(/'/g, '"');
1363
+ }
1364
+ try {
1365
+ clonedOptions = JSON.parse(optionsString);
1366
+ if (inheritedOptions)
1367
+ clonedOptions = {
1368
+ ...inheritedOptions,
1369
+ ...clonedOptions
1370
+ };
1371
+ } catch (e2) {
1372
+ this.logger.warn(`failed parsing options string in nesting for key ${key}`, e2);
1373
+ return `${key}${sep}${optionsString}`;
1374
+ }
1375
+ if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1)
1376
+ delete clonedOptions.defaultValue;
1377
+ return key;
1378
+ };
1379
+ while (match = this.nestingRegexp.exec(str)) {
1380
+ let formatters = [];
1381
+ clonedOptions = {
1382
+ ...options
1383
+ };
1384
+ clonedOptions = clonedOptions.replace && !isString(clonedOptions.replace) ? clonedOptions.replace : clonedOptions;
1385
+ clonedOptions.applyPostProcessor = false;
1386
+ delete clonedOptions.defaultValue;
1387
+ const keyEndIndex = /{.*}/.test(match[1]) ? match[1].lastIndexOf("}") + 1 : match[1].indexOf(this.formatSeparator);
1388
+ if (keyEndIndex !== -1) {
1389
+ formatters = match[1].slice(keyEndIndex).split(this.formatSeparator).map((elem) => elem.trim()).filter(Boolean);
1390
+ match[1] = match[1].slice(0, keyEndIndex);
1391
+ }
1392
+ value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
1393
+ if (value && match[0] === str && !isString(value))
1394
+ return value;
1395
+ if (!isString(value))
1396
+ value = makeString(value);
1397
+ if (!value) {
1398
+ this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
1399
+ value = "";
1400
+ }
1401
+ if (formatters.length) {
1402
+ value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
1403
+ ...options,
1404
+ interpolationkey: match[1].trim()
1405
+ }), value.trim());
1406
+ }
1407
+ str = str.replace(match[0], value);
1408
+ this.regexp.lastIndex = 0;
1409
+ }
1410
+ return str;
1411
+ }
1412
+ };
1413
+ var parseFormatStr = (formatStr) => {
1414
+ let formatName = formatStr.toLowerCase().trim();
1415
+ const formatOptions = {};
1416
+ if (formatStr.indexOf("(") > -1) {
1417
+ const p = formatStr.split("(");
1418
+ formatName = p[0].toLowerCase().trim();
1419
+ const optStr = p[1].substring(0, p[1].length - 1);
1420
+ if (formatName === "currency" && optStr.indexOf(":") < 0) {
1421
+ if (!formatOptions.currency)
1422
+ formatOptions.currency = optStr.trim();
1423
+ } else if (formatName === "relativetime" && optStr.indexOf(":") < 0) {
1424
+ if (!formatOptions.range)
1425
+ formatOptions.range = optStr.trim();
1426
+ } else {
1427
+ const opts = optStr.split(";");
1428
+ opts.forEach((opt) => {
1429
+ if (opt) {
1430
+ const [key, ...rest] = opt.split(":");
1431
+ const val = rest.join(":").trim().replace(/^'+|'+$/g, "");
1432
+ const trimmedKey = key.trim();
1433
+ if (!formatOptions[trimmedKey])
1434
+ formatOptions[trimmedKey] = val;
1435
+ if (val === "false")
1436
+ formatOptions[trimmedKey] = false;
1437
+ if (val === "true")
1438
+ formatOptions[trimmedKey] = true;
1439
+ if (!isNaN(val))
1440
+ formatOptions[trimmedKey] = parseInt(val, 10);
1441
+ }
1442
+ });
1443
+ }
1444
+ }
1445
+ return {
1446
+ formatName,
1447
+ formatOptions
1448
+ };
1449
+ };
1450
+ var createCachedFormatter = (fn) => {
1451
+ const cache = {};
1452
+ return (v, l, o) => {
1453
+ let optForCache = o;
1454
+ if (o && o.interpolationkey && o.formatParams && o.formatParams[o.interpolationkey] && o[o.interpolationkey]) {
1455
+ optForCache = {
1456
+ ...optForCache,
1457
+ [o.interpolationkey]: void 0
1458
+ };
1459
+ }
1460
+ const key = l + JSON.stringify(optForCache);
1461
+ let frm = cache[key];
1462
+ if (!frm) {
1463
+ frm = fn(getCleanedCode(l), o);
1464
+ cache[key] = frm;
1465
+ }
1466
+ return frm(v);
1467
+ };
1468
+ };
1469
+ var createNonCachedFormatter = (fn) => (v, l, o) => fn(getCleanedCode(l), o)(v);
1470
+ var Formatter = class {
1471
+ constructor(options = {}) {
1472
+ this.logger = baseLogger.create("formatter");
1473
+ this.options = options;
1474
+ this.init(options);
1475
+ }
1476
+ init(services, options = {
1477
+ interpolation: {}
1478
+ }) {
1479
+ this.formatSeparator = options.interpolation.formatSeparator || ",";
1480
+ const cf = options.cacheInBuiltFormats ? createCachedFormatter : createNonCachedFormatter;
1481
+ this.formats = {
1482
+ number: cf((lng, opt) => {
1483
+ const formatter = new Intl.NumberFormat(lng, {
1484
+ ...opt
1485
+ });
1486
+ return (val) => formatter.format(val);
1487
+ }),
1488
+ currency: cf((lng, opt) => {
1489
+ const formatter = new Intl.NumberFormat(lng, {
1490
+ ...opt,
1491
+ style: "currency"
1492
+ });
1493
+ return (val) => formatter.format(val);
1494
+ }),
1495
+ datetime: cf((lng, opt) => {
1496
+ const formatter = new Intl.DateTimeFormat(lng, {
1497
+ ...opt
1498
+ });
1499
+ return (val) => formatter.format(val);
1500
+ }),
1501
+ relativetime: cf((lng, opt) => {
1502
+ const formatter = new Intl.RelativeTimeFormat(lng, {
1503
+ ...opt
1504
+ });
1505
+ return (val) => formatter.format(val, opt.range || "day");
1506
+ }),
1507
+ list: cf((lng, opt) => {
1508
+ const formatter = new Intl.ListFormat(lng, {
1509
+ ...opt
1510
+ });
1511
+ return (val) => formatter.format(val);
1512
+ })
1513
+ };
1514
+ }
1515
+ add(name, fc) {
1516
+ this.formats[name.toLowerCase().trim()] = fc;
1517
+ }
1518
+ addCached(name, fc) {
1519
+ this.formats[name.toLowerCase().trim()] = createCachedFormatter(fc);
1520
+ }
1521
+ format(value, format, lng, options = {}) {
1522
+ const formats = format.split(this.formatSeparator);
1523
+ if (formats.length > 1 && formats[0].indexOf("(") > 1 && formats[0].indexOf(")") < 0 && formats.find((f) => f.indexOf(")") > -1)) {
1524
+ const lastIndex = formats.findIndex((f) => f.indexOf(")") > -1);
1525
+ formats[0] = [formats[0], ...formats.splice(1, lastIndex)].join(this.formatSeparator);
1526
+ }
1527
+ const result = formats.reduce((mem, f) => {
1528
+ const {
1529
+ formatName,
1530
+ formatOptions
1531
+ } = parseFormatStr(f);
1532
+ if (this.formats[formatName]) {
1533
+ let formatted = mem;
1534
+ try {
1535
+ const valOptions = options?.formatParams?.[options.interpolationkey] || {};
1536
+ const l = valOptions.locale || valOptions.lng || options.locale || options.lng || lng;
1537
+ formatted = this.formats[formatName](mem, l, {
1538
+ ...formatOptions,
1539
+ ...options,
1540
+ ...valOptions
1541
+ });
1542
+ } catch (error) {
1543
+ this.logger.warn(error);
1544
+ }
1545
+ return formatted;
1546
+ } else {
1547
+ this.logger.warn(`there was no format function for ${formatName}`);
1548
+ }
1549
+ return mem;
1550
+ }, value);
1551
+ return result;
1552
+ }
1553
+ };
1554
+ var removePending = (q, name) => {
1555
+ if (q.pending[name] !== void 0) {
1556
+ delete q.pending[name];
1557
+ q.pendingCount--;
1558
+ }
1559
+ };
1560
+ var Connector = class extends EventEmitter {
1561
+ constructor(backend, store, services, options = {}) {
1562
+ super();
1563
+ this.backend = backend;
1564
+ this.store = store;
1565
+ this.services = services;
1566
+ this.languageUtils = services.languageUtils;
1567
+ this.options = options;
1568
+ this.logger = baseLogger.create("backendConnector");
1569
+ this.waitingReads = [];
1570
+ this.maxParallelReads = options.maxParallelReads || 10;
1571
+ this.readingCalls = 0;
1572
+ this.maxRetries = options.maxRetries >= 0 ? options.maxRetries : 5;
1573
+ this.retryTimeout = options.retryTimeout >= 1 ? options.retryTimeout : 350;
1574
+ this.state = {};
1575
+ this.queue = [];
1576
+ this.backend?.init?.(services, options.backend, options);
1577
+ }
1578
+ queueLoad(languages, namespaces, options, callback) {
1579
+ const toLoad = {};
1580
+ const pending = {};
1581
+ const toLoadLanguages = {};
1582
+ const toLoadNamespaces = {};
1583
+ languages.forEach((lng) => {
1584
+ let hasAllNamespaces = true;
1585
+ namespaces.forEach((ns) => {
1586
+ const name = `${lng}|${ns}`;
1587
+ if (!options.reload && this.store.hasResourceBundle(lng, ns)) {
1588
+ this.state[name] = 2;
1589
+ } else if (this.state[name] < 0)
1590
+ ;
1591
+ else if (this.state[name] === 1) {
1592
+ if (pending[name] === void 0)
1593
+ pending[name] = true;
1594
+ } else {
1595
+ this.state[name] = 1;
1596
+ hasAllNamespaces = false;
1597
+ if (pending[name] === void 0)
1598
+ pending[name] = true;
1599
+ if (toLoad[name] === void 0)
1600
+ toLoad[name] = true;
1601
+ if (toLoadNamespaces[ns] === void 0)
1602
+ toLoadNamespaces[ns] = true;
1603
+ }
1604
+ });
1605
+ if (!hasAllNamespaces)
1606
+ toLoadLanguages[lng] = true;
1607
+ });
1608
+ if (Object.keys(toLoad).length || Object.keys(pending).length) {
1609
+ this.queue.push({
1610
+ pending,
1611
+ pendingCount: Object.keys(pending).length,
1612
+ loaded: {},
1613
+ errors: [],
1614
+ callback
1615
+ });
1616
+ }
1617
+ return {
1618
+ toLoad: Object.keys(toLoad),
1619
+ pending: Object.keys(pending),
1620
+ toLoadLanguages: Object.keys(toLoadLanguages),
1621
+ toLoadNamespaces: Object.keys(toLoadNamespaces)
1622
+ };
1623
+ }
1624
+ loaded(name, err, data) {
1625
+ const s = name.split("|");
1626
+ const lng = s[0];
1627
+ const ns = s[1];
1628
+ if (err)
1629
+ this.emit("failedLoading", lng, ns, err);
1630
+ if (!err && data) {
1631
+ this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
1632
+ skipCopy: true
1633
+ });
1634
+ }
1635
+ this.state[name] = err ? -1 : 2;
1636
+ if (err && data)
1637
+ this.state[name] = 0;
1638
+ const loaded = {};
1639
+ this.queue.forEach((q) => {
1640
+ pushPath(q.loaded, [lng], ns);
1641
+ removePending(q, name);
1642
+ if (err)
1643
+ q.errors.push(err);
1644
+ if (q.pendingCount === 0 && !q.done) {
1645
+ Object.keys(q.loaded).forEach((l) => {
1646
+ if (!loaded[l])
1647
+ loaded[l] = {};
1648
+ const loadedKeys = q.loaded[l];
1649
+ if (loadedKeys.length) {
1650
+ loadedKeys.forEach((n) => {
1651
+ if (loaded[l][n] === void 0)
1652
+ loaded[l][n] = true;
1653
+ });
1654
+ }
1655
+ });
1656
+ q.done = true;
1657
+ if (q.errors.length) {
1658
+ q.callback(q.errors);
1659
+ } else {
1660
+ q.callback();
1661
+ }
1662
+ }
1663
+ });
1664
+ this.emit("loaded", loaded);
1665
+ this.queue = this.queue.filter((q) => !q.done);
1666
+ }
1667
+ read(lng, ns, fcName, tried = 0, wait = this.retryTimeout, callback) {
1668
+ if (!lng.length)
1669
+ return callback(null, {});
1670
+ if (this.readingCalls >= this.maxParallelReads) {
1671
+ this.waitingReads.push({
1672
+ lng,
1673
+ ns,
1674
+ fcName,
1675
+ tried,
1676
+ wait,
1677
+ callback
1678
+ });
1679
+ return;
1680
+ }
1681
+ this.readingCalls++;
1682
+ const resolver = (err, data) => {
1683
+ this.readingCalls--;
1684
+ if (this.waitingReads.length > 0) {
1685
+ const next = this.waitingReads.shift();
1686
+ this.read(next.lng, next.ns, next.fcName, next.tried, next.wait, next.callback);
1687
+ }
1688
+ if (err && data && tried < this.maxRetries) {
1689
+ setTimeout(() => {
1690
+ this.read.call(this, lng, ns, fcName, tried + 1, wait * 2, callback);
1691
+ }, wait);
1692
+ return;
1693
+ }
1694
+ callback(err, data);
1695
+ };
1696
+ const fc = this.backend[fcName].bind(this.backend);
1697
+ if (fc.length === 2) {
1698
+ try {
1699
+ const r = fc(lng, ns);
1700
+ if (r && typeof r.then === "function") {
1701
+ r.then((data) => resolver(null, data)).catch(resolver);
1702
+ } else {
1703
+ resolver(null, r);
1704
+ }
1705
+ } catch (err) {
1706
+ resolver(err);
1707
+ }
1708
+ return;
1709
+ }
1710
+ return fc(lng, ns, resolver);
1711
+ }
1712
+ prepareLoading(languages, namespaces, options = {}, callback) {
1713
+ if (!this.backend) {
1714
+ this.logger.warn("No backend was added via i18next.use. Will not load resources.");
1715
+ return callback && callback();
1716
+ }
1717
+ if (isString(languages))
1718
+ languages = this.languageUtils.toResolveHierarchy(languages);
1719
+ if (isString(namespaces))
1720
+ namespaces = [namespaces];
1721
+ const toLoad = this.queueLoad(languages, namespaces, options, callback);
1722
+ if (!toLoad.toLoad.length) {
1723
+ if (!toLoad.pending.length)
1724
+ callback();
1725
+ return null;
1726
+ }
1727
+ toLoad.toLoad.forEach((name) => {
1728
+ this.loadOne(name);
1729
+ });
1730
+ }
1731
+ load(languages, namespaces, callback) {
1732
+ this.prepareLoading(languages, namespaces, {}, callback);
1733
+ }
1734
+ reload(languages, namespaces, callback) {
1735
+ this.prepareLoading(languages, namespaces, {
1736
+ reload: true
1737
+ }, callback);
1738
+ }
1739
+ loadOne(name, prefix = "") {
1740
+ const s = name.split("|");
1741
+ const lng = s[0];
1742
+ const ns = s[1];
1743
+ this.read(lng, ns, "read", void 0, void 0, (err, data) => {
1744
+ if (err)
1745
+ this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
1746
+ if (!err && data)
1747
+ this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
1748
+ this.loaded(name, err, data);
1749
+ });
1750
+ }
1751
+ saveMissing(languages, namespace, key, fallbackValue, isUpdate, options = {}, clb = () => {
1752
+ }) {
1753
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(namespace)) {
1754
+ this.logger.warn(`did not save key "${key}" as the namespace "${namespace}" 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!!!");
1755
+ return;
1756
+ }
1757
+ if (key === void 0 || key === null || key === "")
1758
+ return;
1759
+ if (this.backend?.create) {
1760
+ const opts = {
1761
+ ...options,
1762
+ isUpdate
1763
+ };
1764
+ const fc = this.backend.create.bind(this.backend);
1765
+ if (fc.length < 6) {
1766
+ try {
1767
+ let r;
1768
+ if (fc.length === 5) {
1769
+ r = fc(languages, namespace, key, fallbackValue, opts);
1770
+ } else {
1771
+ r = fc(languages, namespace, key, fallbackValue);
1772
+ }
1773
+ if (r && typeof r.then === "function") {
1774
+ r.then((data) => clb(null, data)).catch(clb);
1775
+ } else {
1776
+ clb(null, r);
1777
+ }
1778
+ } catch (err) {
1779
+ clb(err);
1780
+ }
1781
+ } else {
1782
+ fc(languages, namespace, key, fallbackValue, clb, opts);
1783
+ }
1784
+ }
1785
+ if (!languages || !languages[0])
1786
+ return;
1787
+ this.store.addResource(languages[0], namespace, key, fallbackValue);
1788
+ }
1789
+ };
1790
+ var get = () => ({
1791
+ debug: false,
1792
+ initAsync: true,
1793
+ ns: ["translation"],
1794
+ defaultNS: ["translation"],
1795
+ fallbackLng: ["dev"],
1796
+ fallbackNS: false,
1797
+ supportedLngs: false,
1798
+ nonExplicitSupportedLngs: false,
1799
+ load: "all",
1800
+ preload: false,
1801
+ simplifyPluralSuffix: true,
1802
+ keySeparator: ".",
1803
+ nsSeparator: ":",
1804
+ pluralSeparator: "_",
1805
+ contextSeparator: "_",
1806
+ partialBundledLanguages: false,
1807
+ saveMissing: false,
1808
+ updateMissing: false,
1809
+ saveMissingTo: "fallback",
1810
+ saveMissingPlurals: true,
1811
+ missingKeyHandler: false,
1812
+ missingInterpolationHandler: false,
1813
+ postProcess: false,
1814
+ postProcessPassResolved: false,
1815
+ returnNull: false,
1816
+ returnEmptyString: true,
1817
+ returnObjects: false,
1818
+ joinArrays: false,
1819
+ returnedObjectHandler: false,
1820
+ parseMissingKeyHandler: false,
1821
+ appendNamespaceToMissingKey: false,
1822
+ appendNamespaceToCIMode: false,
1823
+ overloadTranslationOptionHandler: (args) => {
1824
+ let ret = {};
1825
+ if (typeof args[1] === "object")
1826
+ ret = args[1];
1827
+ if (isString(args[1]))
1828
+ ret.defaultValue = args[1];
1829
+ if (isString(args[2]))
1830
+ ret.tDescription = args[2];
1831
+ if (typeof args[2] === "object" || typeof args[3] === "object") {
1832
+ const options = args[3] || args[2];
1833
+ Object.keys(options).forEach((key) => {
1834
+ ret[key] = options[key];
1835
+ });
1836
+ }
1837
+ return ret;
1838
+ },
1839
+ interpolation: {
1840
+ escapeValue: true,
1841
+ format: (value) => value,
1842
+ prefix: "{{",
1843
+ suffix: "}}",
1844
+ formatSeparator: ",",
1845
+ unescapePrefix: "-",
1846
+ nestingPrefix: "$t(",
1847
+ nestingSuffix: ")",
1848
+ nestingOptionsSeparator: ",",
1849
+ maxReplaces: 1e3,
1850
+ skipOnVariables: true
1851
+ },
1852
+ cacheInBuiltFormats: true
1853
+ });
1854
+ var transformOptions = (options) => {
1855
+ if (isString(options.ns))
1856
+ options.ns = [options.ns];
1857
+ if (isString(options.fallbackLng))
1858
+ options.fallbackLng = [options.fallbackLng];
1859
+ if (isString(options.fallbackNS))
1860
+ options.fallbackNS = [options.fallbackNS];
1861
+ if (options.supportedLngs?.indexOf?.("cimode") < 0) {
1862
+ options.supportedLngs = options.supportedLngs.concat(["cimode"]);
1863
+ }
1864
+ if (typeof options.initImmediate === "boolean")
1865
+ options.initAsync = options.initImmediate;
1866
+ return options;
1867
+ };
1868
+ var noop = () => {
1869
+ };
1870
+ var bindMemberFunctions = (inst) => {
1871
+ const mems = Object.getOwnPropertyNames(Object.getPrototypeOf(inst));
1872
+ mems.forEach((mem) => {
1873
+ if (typeof inst[mem] === "function") {
1874
+ inst[mem] = inst[mem].bind(inst);
1875
+ }
1876
+ });
1877
+ };
1878
+ var usesLocize = (inst) => {
1879
+ if (inst?.modules?.backend?.name?.indexOf("Locize") > 0)
1880
+ return true;
1881
+ if (inst?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0)
1882
+ return true;
1883
+ if (inst?.options?.backend?.backends) {
1884
+ if (inst.options.backend.backends.some((b) => b?.name.indexOf("Locize") > 0 || b?.constructor?.name.indexOf("Locize") > 0))
1885
+ return true;
1886
+ }
1887
+ return false;
1888
+ };
1889
+ var I18n = class _I18n extends EventEmitter {
1890
+ constructor(options = {}, callback) {
1891
+ super();
1892
+ this.options = transformOptions(options);
1893
+ this.services = {};
1894
+ this.logger = baseLogger;
1895
+ this.modules = {
1896
+ external: []
1897
+ };
1898
+ bindMemberFunctions(this);
1899
+ if (callback && !this.isInitialized && !options.isClone) {
1900
+ if (!this.options.initAsync) {
1901
+ this.init(options, callback);
1902
+ return this;
1903
+ }
1904
+ setTimeout(() => {
1905
+ this.init(options, callback);
1906
+ }, 0);
1907
+ }
1908
+ }
1909
+ init(options = {}, callback) {
1910
+ this.isInitializing = true;
1911
+ if (typeof options === "function") {
1912
+ callback = options;
1913
+ options = {};
1914
+ }
1915
+ if (options.defaultNS == null && options.ns) {
1916
+ if (isString(options.ns)) {
1917
+ options.defaultNS = options.ns;
1918
+ } else if (options.ns.indexOf("translation") < 0) {
1919
+ options.defaultNS = options.ns[0];
1920
+ }
1921
+ }
1922
+ const defOpts = get();
1923
+ this.options = {
1924
+ ...defOpts,
1925
+ ...this.options,
1926
+ ...transformOptions(options)
1927
+ };
1928
+ this.options.interpolation = {
1929
+ ...defOpts.interpolation,
1930
+ ...this.options.interpolation
1931
+ };
1932
+ if (options.keySeparator !== void 0) {
1933
+ this.options.userDefinedKeySeparator = options.keySeparator;
1934
+ }
1935
+ if (options.nsSeparator !== void 0) {
1936
+ this.options.userDefinedNsSeparator = options.nsSeparator;
1937
+ }
1938
+ if (typeof this.options.overloadTranslationOptionHandler !== "function") {
1939
+ this.options.overloadTranslationOptionHandler = defOpts.overloadTranslationOptionHandler;
1940
+ }
1941
+ if (this.options.showSupportNotice !== false && !usesLocize(this)) {
1942
+ if (typeof console !== "undefined" && typeof console.info !== "undefined")
1943
+ console.info("\u{1F310} i18next is maintained with support from locize.com \u2014 consider powering your project with managed localization (AI, CDN, integrations): https://locize.com \u{1F499}");
1944
+ }
1945
+ const createClassOnDemand = (ClassOrObject) => {
1946
+ if (!ClassOrObject)
1947
+ return null;
1948
+ if (typeof ClassOrObject === "function")
1949
+ return new ClassOrObject();
1950
+ return ClassOrObject;
1951
+ };
1952
+ if (!this.options.isClone) {
1953
+ if (this.modules.logger) {
1954
+ baseLogger.init(createClassOnDemand(this.modules.logger), this.options);
1955
+ } else {
1956
+ baseLogger.init(null, this.options);
1957
+ }
1958
+ let formatter;
1959
+ if (this.modules.formatter) {
1960
+ formatter = this.modules.formatter;
1961
+ } else {
1962
+ formatter = Formatter;
1963
+ }
1964
+ const lu = new LanguageUtil(this.options);
1965
+ this.store = new ResourceStore(this.options.resources, this.options);
1966
+ const s = this.services;
1967
+ s.logger = baseLogger;
1968
+ s.resourceStore = this.store;
1969
+ s.languageUtils = lu;
1970
+ s.pluralResolver = new PluralResolver(lu, {
1971
+ prepend: this.options.pluralSeparator,
1972
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1973
+ });
1974
+ const usingLegacyFormatFunction = this.options.interpolation.format && this.options.interpolation.format !== defOpts.interpolation.format;
1975
+ if (usingLegacyFormatFunction) {
1976
+ this.logger.deprecate(`init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting`);
1977
+ }
1978
+ if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
1979
+ s.formatter = createClassOnDemand(formatter);
1980
+ if (s.formatter.init)
1981
+ s.formatter.init(s, this.options);
1982
+ this.options.interpolation.format = s.formatter.format.bind(s.formatter);
1983
+ }
1984
+ s.interpolator = new Interpolator(this.options);
1985
+ s.utils = {
1986
+ hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
1987
+ };
1988
+ s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
1989
+ s.backendConnector.on("*", (event, ...args) => {
1990
+ this.emit(event, ...args);
1991
+ });
1992
+ if (this.modules.languageDetector) {
1993
+ s.languageDetector = createClassOnDemand(this.modules.languageDetector);
1994
+ if (s.languageDetector.init)
1995
+ s.languageDetector.init(s, this.options.detection, this.options);
1996
+ }
1997
+ if (this.modules.i18nFormat) {
1998
+ s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
1999
+ if (s.i18nFormat.init)
2000
+ s.i18nFormat.init(this);
2001
+ }
2002
+ this.translator = new Translator(this.services, this.options);
2003
+ this.translator.on("*", (event, ...args) => {
2004
+ this.emit(event, ...args);
2005
+ });
2006
+ this.modules.external.forEach((m) => {
2007
+ if (m.init)
2008
+ m.init(this);
2009
+ });
2010
+ }
2011
+ this.format = this.options.interpolation.format;
2012
+ if (!callback)
2013
+ callback = noop;
2014
+ if (this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
2015
+ const codes = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2016
+ if (codes.length > 0 && codes[0] !== "dev")
2017
+ this.options.lng = codes[0];
2018
+ }
2019
+ if (!this.services.languageDetector && !this.options.lng) {
2020
+ this.logger.warn("init: no languageDetector is used and no lng is defined");
2021
+ }
2022
+ const storeApi = ["getResource", "hasResourceBundle", "getResourceBundle", "getDataByLanguage"];
2023
+ storeApi.forEach((fcName) => {
2024
+ this[fcName] = (...args) => this.store[fcName](...args);
2025
+ });
2026
+ const storeApiChained = ["addResource", "addResources", "addResourceBundle", "removeResourceBundle"];
2027
+ storeApiChained.forEach((fcName) => {
2028
+ this[fcName] = (...args) => {
2029
+ this.store[fcName](...args);
2030
+ return this;
2031
+ };
2032
+ });
2033
+ const deferred = defer();
2034
+ const load = () => {
2035
+ const finish = (err, t2) => {
2036
+ this.isInitializing = false;
2037
+ if (this.isInitialized && !this.initializedStoreOnce)
2038
+ this.logger.warn("init: i18next is already initialized. You should call init just once!");
2039
+ this.isInitialized = true;
2040
+ if (!this.options.isClone)
2041
+ this.logger.log("initialized", this.options);
2042
+ this.emit("initialized", this.options);
2043
+ deferred.resolve(t2);
2044
+ callback(err, t2);
2045
+ };
2046
+ if (this.languages && !this.isInitialized)
2047
+ return finish(null, this.t.bind(this));
2048
+ this.changeLanguage(this.options.lng, finish);
2049
+ };
2050
+ if (this.options.resources || !this.options.initAsync) {
2051
+ load();
2052
+ } else {
2053
+ setTimeout(load, 0);
2054
+ }
2055
+ return deferred;
2056
+ }
2057
+ loadResources(language, callback = noop) {
2058
+ let usedCallback = callback;
2059
+ const usedLng = isString(language) ? language : this.language;
2060
+ if (typeof language === "function")
2061
+ usedCallback = language;
2062
+ if (!this.options.resources || this.options.partialBundledLanguages) {
2063
+ if (usedLng?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0))
2064
+ return usedCallback();
2065
+ const toLoad = [];
2066
+ const append = (lng) => {
2067
+ if (!lng)
2068
+ return;
2069
+ if (lng === "cimode")
2070
+ return;
2071
+ const lngs = this.services.languageUtils.toResolveHierarchy(lng);
2072
+ lngs.forEach((l) => {
2073
+ if (l === "cimode")
2074
+ return;
2075
+ if (toLoad.indexOf(l) < 0)
2076
+ toLoad.push(l);
2077
+ });
2078
+ };
2079
+ if (!usedLng) {
2080
+ const fallbacks = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
2081
+ fallbacks.forEach((l) => append(l));
2082
+ } else {
2083
+ append(usedLng);
2084
+ }
2085
+ this.options.preload?.forEach?.((l) => append(l));
2086
+ this.services.backendConnector.load(toLoad, this.options.ns, (e2) => {
2087
+ if (!e2 && !this.resolvedLanguage && this.language)
2088
+ this.setResolvedLanguage(this.language);
2089
+ usedCallback(e2);
2090
+ });
2091
+ } else {
2092
+ usedCallback(null);
2093
+ }
2094
+ }
2095
+ reloadResources(lngs, ns, callback) {
2096
+ const deferred = defer();
2097
+ if (typeof lngs === "function") {
2098
+ callback = lngs;
2099
+ lngs = void 0;
2100
+ }
2101
+ if (typeof ns === "function") {
2102
+ callback = ns;
2103
+ ns = void 0;
2104
+ }
2105
+ if (!lngs)
2106
+ lngs = this.languages;
2107
+ if (!ns)
2108
+ ns = this.options.ns;
2109
+ if (!callback)
2110
+ callback = noop;
2111
+ this.services.backendConnector.reload(lngs, ns, (err) => {
2112
+ deferred.resolve();
2113
+ callback(err);
2114
+ });
2115
+ return deferred;
2116
+ }
2117
+ use(module2) {
2118
+ if (!module2)
2119
+ throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
2120
+ if (!module2.type)
2121
+ throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
2122
+ if (module2.type === "backend") {
2123
+ this.modules.backend = module2;
2124
+ }
2125
+ if (module2.type === "logger" || module2.log && module2.warn && module2.error) {
2126
+ this.modules.logger = module2;
2127
+ }
2128
+ if (module2.type === "languageDetector") {
2129
+ this.modules.languageDetector = module2;
2130
+ }
2131
+ if (module2.type === "i18nFormat") {
2132
+ this.modules.i18nFormat = module2;
2133
+ }
2134
+ if (module2.type === "postProcessor") {
2135
+ postProcessor.addPostProcessor(module2);
2136
+ }
2137
+ if (module2.type === "formatter") {
2138
+ this.modules.formatter = module2;
2139
+ }
2140
+ if (module2.type === "3rdParty") {
2141
+ this.modules.external.push(module2);
2142
+ }
2143
+ return this;
2144
+ }
2145
+ setResolvedLanguage(l) {
2146
+ if (!l || !this.languages)
2147
+ return;
2148
+ if (["cimode", "dev"].indexOf(l) > -1)
2149
+ return;
2150
+ for (let li = 0; li < this.languages.length; li++) {
2151
+ const lngInLngs = this.languages[li];
2152
+ if (["cimode", "dev"].indexOf(lngInLngs) > -1)
2153
+ continue;
2154
+ if (this.store.hasLanguageSomeTranslations(lngInLngs)) {
2155
+ this.resolvedLanguage = lngInLngs;
2156
+ break;
2157
+ }
2158
+ }
2159
+ if (!this.resolvedLanguage && this.languages.indexOf(l) < 0 && this.store.hasLanguageSomeTranslations(l)) {
2160
+ this.resolvedLanguage = l;
2161
+ this.languages.unshift(l);
2162
+ }
2163
+ }
2164
+ changeLanguage(lng, callback) {
2165
+ this.isLanguageChangingTo = lng;
2166
+ const deferred = defer();
2167
+ this.emit("languageChanging", lng);
2168
+ const setLngProps = (l) => {
2169
+ this.language = l;
2170
+ this.languages = this.services.languageUtils.toResolveHierarchy(l);
2171
+ this.resolvedLanguage = void 0;
2172
+ this.setResolvedLanguage(l);
2173
+ };
2174
+ const done = (err, l) => {
2175
+ if (l) {
2176
+ if (this.isLanguageChangingTo === lng) {
2177
+ setLngProps(l);
2178
+ this.translator.changeLanguage(l);
2179
+ this.isLanguageChangingTo = void 0;
2180
+ this.emit("languageChanged", l);
2181
+ this.logger.log("languageChanged", l);
2182
+ }
2183
+ } else {
2184
+ this.isLanguageChangingTo = void 0;
2185
+ }
2186
+ deferred.resolve((...args) => this.t(...args));
2187
+ if (callback)
2188
+ callback(err, (...args) => this.t(...args));
2189
+ };
2190
+ const setLng = (lngs) => {
2191
+ if (!lng && !lngs && this.services.languageDetector)
2192
+ lngs = [];
2193
+ const fl = isString(lngs) ? lngs : lngs && lngs[0];
2194
+ const l = this.store.hasLanguageSomeTranslations(fl) ? fl : this.services.languageUtils.getBestMatchFromCodes(isString(lngs) ? [lngs] : lngs);
2195
+ if (l) {
2196
+ if (!this.language) {
2197
+ setLngProps(l);
2198
+ }
2199
+ if (!this.translator.language)
2200
+ this.translator.changeLanguage(l);
2201
+ this.services.languageDetector?.cacheUserLanguage?.(l);
2202
+ }
2203
+ this.loadResources(l, (err) => {
2204
+ done(err, l);
2205
+ });
2206
+ };
2207
+ if (!lng && this.services.languageDetector && !this.services.languageDetector.async) {
2208
+ setLng(this.services.languageDetector.detect());
2209
+ } else if (!lng && this.services.languageDetector && this.services.languageDetector.async) {
2210
+ if (this.services.languageDetector.detect.length === 0) {
2211
+ this.services.languageDetector.detect().then(setLng);
2212
+ } else {
2213
+ this.services.languageDetector.detect(setLng);
2214
+ }
2215
+ } else {
2216
+ setLng(lng);
2217
+ }
2218
+ return deferred;
2219
+ }
2220
+ getFixedT(lng, ns, keyPrefix) {
2221
+ const fixedT = (key, opts, ...rest) => {
2222
+ let o;
2223
+ if (typeof opts !== "object") {
2224
+ o = this.options.overloadTranslationOptionHandler([key, opts].concat(rest));
2225
+ } else {
2226
+ o = {
2227
+ ...opts
2228
+ };
2229
+ }
2230
+ o.lng = o.lng || fixedT.lng;
2231
+ o.lngs = o.lngs || fixedT.lngs;
2232
+ o.ns = o.ns || fixedT.ns;
2233
+ if (o.keyPrefix !== "")
2234
+ o.keyPrefix = o.keyPrefix || keyPrefix || fixedT.keyPrefix;
2235
+ const keySeparator = this.options.keySeparator || ".";
2236
+ let resultKey;
2237
+ if (o.keyPrefix && Array.isArray(key)) {
2238
+ resultKey = key.map((k) => {
2239
+ if (typeof k === "function")
2240
+ k = keysFromSelector(k, {
2241
+ ...this.options,
2242
+ ...opts
2243
+ });
2244
+ return `${o.keyPrefix}${keySeparator}${k}`;
2245
+ });
2246
+ } else {
2247
+ if (typeof key === "function")
2248
+ key = keysFromSelector(key, {
2249
+ ...this.options,
2250
+ ...opts
2251
+ });
2252
+ resultKey = o.keyPrefix ? `${o.keyPrefix}${keySeparator}${key}` : key;
2253
+ }
2254
+ return this.t(resultKey, o);
2255
+ };
2256
+ if (isString(lng)) {
2257
+ fixedT.lng = lng;
2258
+ } else {
2259
+ fixedT.lngs = lng;
2260
+ }
2261
+ fixedT.ns = ns;
2262
+ fixedT.keyPrefix = keyPrefix;
2263
+ return fixedT;
2264
+ }
2265
+ t(...args) {
2266
+ return this.translator?.translate(...args);
2267
+ }
2268
+ exists(...args) {
2269
+ return this.translator?.exists(...args);
2270
+ }
2271
+ setDefaultNamespace(ns) {
2272
+ this.options.defaultNS = ns;
2273
+ }
2274
+ hasLoadedNamespace(ns, options = {}) {
2275
+ if (!this.isInitialized) {
2276
+ this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages);
2277
+ return false;
2278
+ }
2279
+ if (!this.languages || !this.languages.length) {
2280
+ this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages);
2281
+ return false;
2282
+ }
2283
+ const lng = options.lng || this.resolvedLanguage || this.languages[0];
2284
+ const fallbackLng = this.options ? this.options.fallbackLng : false;
2285
+ const lastLng = this.languages[this.languages.length - 1];
2286
+ if (lng.toLowerCase() === "cimode")
2287
+ return true;
2288
+ const loadNotPending = (l, n) => {
2289
+ const loadState = this.services.backendConnector.state[`${l}|${n}`];
2290
+ return loadState === -1 || loadState === 0 || loadState === 2;
2291
+ };
2292
+ if (options.precheck) {
2293
+ const preResult = options.precheck(this, loadNotPending);
2294
+ if (preResult !== void 0)
2295
+ return preResult;
2296
+ }
2297
+ if (this.hasResourceBundle(lng, ns))
2298
+ return true;
2299
+ if (!this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages)
2300
+ return true;
2301
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
2302
+ return true;
2303
+ return false;
2304
+ }
2305
+ loadNamespaces(ns, callback) {
2306
+ const deferred = defer();
2307
+ if (!this.options.ns) {
2308
+ if (callback)
2309
+ callback();
2310
+ return Promise.resolve();
2311
+ }
2312
+ if (isString(ns))
2313
+ ns = [ns];
2314
+ ns.forEach((n) => {
2315
+ if (this.options.ns.indexOf(n) < 0)
2316
+ this.options.ns.push(n);
2317
+ });
2318
+ this.loadResources((err) => {
2319
+ deferred.resolve();
2320
+ if (callback)
2321
+ callback(err);
2322
+ });
2323
+ return deferred;
2324
+ }
2325
+ loadLanguages(lngs, callback) {
2326
+ const deferred = defer();
2327
+ if (isString(lngs))
2328
+ lngs = [lngs];
2329
+ const preloaded = this.options.preload || [];
2330
+ const newLngs = lngs.filter((lng) => preloaded.indexOf(lng) < 0 && this.services.languageUtils.isSupportedCode(lng));
2331
+ if (!newLngs.length) {
2332
+ if (callback)
2333
+ callback();
2334
+ return Promise.resolve();
2335
+ }
2336
+ this.options.preload = preloaded.concat(newLngs);
2337
+ this.loadResources((err) => {
2338
+ deferred.resolve();
2339
+ if (callback)
2340
+ callback(err);
2341
+ });
2342
+ return deferred;
2343
+ }
2344
+ dir(lng) {
2345
+ if (!lng)
2346
+ lng = this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language);
2347
+ if (!lng)
2348
+ return "rtl";
2349
+ try {
2350
+ const l = new Intl.Locale(lng);
2351
+ if (l && l.getTextInfo) {
2352
+ const ti = l.getTextInfo();
2353
+ if (ti && ti.direction)
2354
+ return ti.direction;
2355
+ }
2356
+ } catch (e2) {
2357
+ }
2358
+ const rtlLngs = ["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"];
2359
+ const languageUtils = this.services?.languageUtils || new LanguageUtil(get());
2360
+ if (lng.toLowerCase().indexOf("-latn") > 1)
2361
+ return "ltr";
2362
+ return rtlLngs.indexOf(languageUtils.getLanguagePartFromCode(lng)) > -1 || lng.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
2363
+ }
2364
+ static createInstance(options = {}, callback) {
2365
+ const instance2 = new _I18n(options, callback);
2366
+ instance2.createInstance = _I18n.createInstance;
2367
+ return instance2;
2368
+ }
2369
+ cloneInstance(options = {}, callback = noop) {
2370
+ const forkResourceStore = options.forkResourceStore;
2371
+ if (forkResourceStore)
2372
+ delete options.forkResourceStore;
2373
+ const mergedOptions = {
2374
+ ...this.options,
2375
+ ...options,
2376
+ ...{
2377
+ isClone: true
2378
+ }
2379
+ };
2380
+ const clone = new _I18n(mergedOptions);
2381
+ if (options.debug !== void 0 || options.prefix !== void 0) {
2382
+ clone.logger = clone.logger.clone(options);
2383
+ }
2384
+ const membersToCopy = ["store", "services", "language"];
2385
+ membersToCopy.forEach((m) => {
2386
+ clone[m] = this[m];
2387
+ });
2388
+ clone.services = {
2389
+ ...this.services
2390
+ };
2391
+ clone.services.utils = {
2392
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2393
+ };
2394
+ if (forkResourceStore) {
2395
+ const clonedData = Object.keys(this.store.data).reduce((prev, l) => {
2396
+ prev[l] = {
2397
+ ...this.store.data[l]
2398
+ };
2399
+ prev[l] = Object.keys(prev[l]).reduce((acc, n) => {
2400
+ acc[n] = {
2401
+ ...prev[l][n]
2402
+ };
2403
+ return acc;
2404
+ }, prev[l]);
2405
+ return prev;
2406
+ }, {});
2407
+ clone.store = new ResourceStore(clonedData, mergedOptions);
2408
+ clone.services.resourceStore = clone.store;
2409
+ }
2410
+ if (options.interpolation) {
2411
+ const defOpts = get();
2412
+ const mergedInterpolation = {
2413
+ ...defOpts.interpolation,
2414
+ ...this.options.interpolation,
2415
+ ...options.interpolation
2416
+ };
2417
+ const mergedForInterpolator = {
2418
+ ...mergedOptions,
2419
+ interpolation: mergedInterpolation
2420
+ };
2421
+ clone.services.interpolator = new Interpolator(mergedForInterpolator);
2422
+ }
2423
+ clone.translator = new Translator(clone.services, mergedOptions);
2424
+ clone.translator.on("*", (event, ...args) => {
2425
+ clone.emit(event, ...args);
2426
+ });
2427
+ clone.init(mergedOptions, callback);
2428
+ clone.translator.options = mergedOptions;
2429
+ clone.translator.backendConnector.services.utils = {
2430
+ hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
2431
+ };
2432
+ return clone;
2433
+ }
2434
+ toJSON() {
2435
+ return {
2436
+ options: this.options,
2437
+ store: this.store,
2438
+ language: this.language,
2439
+ languages: this.languages,
2440
+ resolvedLanguage: this.resolvedLanguage
2441
+ };
2442
+ }
2443
+ };
2444
+ var instance = I18n.createInstance();
2445
+ var createInstance = instance.createInstance;
2446
+ var dir = instance.dir;
2447
+ var init = instance.init;
2448
+ var loadResources = instance.loadResources;
2449
+ var reloadResources = instance.reloadResources;
2450
+ var use = instance.use;
2451
+ var changeLanguage = instance.changeLanguage;
2452
+ var getFixedT = instance.getFixedT;
2453
+ var t = instance.t;
2454
+ var exists = instance.exists;
2455
+ var setDefaultNamespace = instance.setDefaultNamespace;
2456
+ var hasLoadedNamespace = instance.hasLoadedNamespace;
2457
+ var loadNamespaces = instance.loadNamespaces;
2458
+ var loadLanguages = instance.loadLanguages;
2459
+
2460
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/Trans.js
2461
+ var import_react3 = require("react");
2462
+
2463
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/TransWithoutContext.js
2464
+ var import_react = require("react");
2465
+
2466
+ // node_modules/.pnpm/html-parse-stringify@3.0.1/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js
2467
+ var import_void_elements = __toESM(require_void_elements());
2468
+
2469
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/utils.js
2470
+ var warn = (i18n, code, msg, rest) => {
2471
+ const args = [msg, {
2472
+ code,
2473
+ ...rest || {}
2474
+ }];
2475
+ if (i18n?.services?.logger?.forward) {
2476
+ return i18n.services.logger.forward(args, "warn", "react-i18next::", true);
2477
+ }
2478
+ if (isString2(args[0]))
2479
+ args[0] = `react-i18next:: ${args[0]}`;
2480
+ if (i18n?.services?.logger?.warn) {
2481
+ i18n.services.logger.warn(...args);
2482
+ } else if (console?.warn) {
2483
+ console.warn(...args);
2484
+ }
2485
+ };
2486
+ var alreadyWarned = {};
2487
+ var warnOnce = (i18n, code, msg, rest) => {
2488
+ if (isString2(msg) && alreadyWarned[msg])
2489
+ return;
2490
+ if (isString2(msg))
2491
+ alreadyWarned[msg] = /* @__PURE__ */ new Date();
2492
+ warn(i18n, code, msg, rest);
2493
+ };
2494
+ var isString2 = (obj) => typeof obj === "string";
2495
+
2496
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/unescape.js
2497
+ var matchHtmlEntity = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g;
2498
+ var htmlEntities = {
2499
+ "&amp;": "&",
2500
+ "&#38;": "&",
2501
+ "&lt;": "<",
2502
+ "&#60;": "<",
2503
+ "&gt;": ">",
2504
+ "&#62;": ">",
2505
+ "&apos;": "'",
2506
+ "&#39;": "'",
2507
+ "&quot;": '"',
2508
+ "&#34;": '"',
2509
+ "&nbsp;": " ",
2510
+ "&#160;": " ",
2511
+ "&copy;": "\xA9",
2512
+ "&#169;": "\xA9",
2513
+ "&reg;": "\xAE",
2514
+ "&#174;": "\xAE",
2515
+ "&hellip;": "\u2026",
2516
+ "&#8230;": "\u2026",
2517
+ "&#x2F;": "/",
2518
+ "&#47;": "/"
2519
+ };
2520
+ var unescapeHtmlEntity = (m) => htmlEntities[m];
2521
+ var unescape = (text) => text.replace(matchHtmlEntity, unescapeHtmlEntity);
2522
+
2523
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/defaults.js
2524
+ var defaultOptions = {
2525
+ bindI18n: "languageChanged",
2526
+ bindI18nStore: "",
2527
+ transEmptyNodeValue: "",
2528
+ transSupportBasicHtmlNodes: true,
2529
+ transWrapTextNodes: "",
2530
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
2531
+ useSuspense: true,
2532
+ unescape,
2533
+ transDefaultProps: void 0
2534
+ };
2535
+ var setDefaults = (options = {}) => {
2536
+ defaultOptions = {
2537
+ ...defaultOptions,
2538
+ ...options
2539
+ };
2540
+ };
2541
+
2542
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/i18nInstance.js
2543
+ var i18nInstance;
2544
+ var setI18n = (instance2) => {
2545
+ i18nInstance = instance2;
2546
+ };
2547
+ var getI18n = () => i18nInstance;
2548
+
2549
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/context.js
2550
+ var import_react2 = require("react");
2551
+
2552
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/initReactI18next.js
2553
+ var initReactI18next = {
2554
+ type: "3rdParty",
2555
+ init(instance2) {
2556
+ setDefaults(instance2.options.react);
2557
+ setI18n(instance2);
2558
+ }
2559
+ };
2560
+
2561
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/context.js
2562
+ var I18nContext = (0, import_react2.createContext)();
2563
+
2564
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTrans.js
2565
+ var import_react6 = require("react");
2566
+
2567
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTransWithoutContext.js
2568
+ var import_react5 = __toESM(require("react"), 1);
2569
+
2570
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTransUtils/TranslationParserError.js
2571
+ var TranslationParserError = class _TranslationParserError extends Error {
2572
+ constructor(message, position, translationString) {
2573
+ super(message);
2574
+ this.name = "TranslationParserError";
2575
+ this.position = position;
2576
+ this.translationString = translationString;
2577
+ if (Error.captureStackTrace) {
2578
+ Error.captureStackTrace(this, _TranslationParserError);
2579
+ }
2580
+ }
2581
+ };
2582
+
2583
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTransUtils/htmlEntityDecoder.js
2584
+ var commonEntities = {
2585
+ "&nbsp;": "\xA0",
2586
+ "&amp;": "&",
2587
+ "&lt;": "<",
2588
+ "&gt;": ">",
2589
+ "&quot;": '"',
2590
+ "&apos;": "'",
2591
+ "&copy;": "\xA9",
2592
+ "&reg;": "\xAE",
2593
+ "&trade;": "\u2122",
2594
+ "&hellip;": "\u2026",
2595
+ "&ndash;": "\u2013",
2596
+ "&mdash;": "\u2014",
2597
+ "&lsquo;": "\u2018",
2598
+ "&rsquo;": "\u2019",
2599
+ "&sbquo;": "\u201A",
2600
+ "&ldquo;": "\u201C",
2601
+ "&rdquo;": "\u201D",
2602
+ "&bdquo;": "\u201E",
2603
+ "&dagger;": "\u2020",
2604
+ "&Dagger;": "\u2021",
2605
+ "&bull;": "\u2022",
2606
+ "&prime;": "\u2032",
2607
+ "&Prime;": "\u2033",
2608
+ "&lsaquo;": "\u2039",
2609
+ "&rsaquo;": "\u203A",
2610
+ "&sect;": "\xA7",
2611
+ "&para;": "\xB6",
2612
+ "&middot;": "\xB7",
2613
+ "&ensp;": "\u2002",
2614
+ "&emsp;": "\u2003",
2615
+ "&thinsp;": "\u2009",
2616
+ "&euro;": "\u20AC",
2617
+ "&pound;": "\xA3",
2618
+ "&yen;": "\xA5",
2619
+ "&cent;": "\xA2",
2620
+ "&curren;": "\xA4",
2621
+ "&times;": "\xD7",
2622
+ "&divide;": "\xF7",
2623
+ "&minus;": "\u2212",
2624
+ "&plusmn;": "\xB1",
2625
+ "&ne;": "\u2260",
2626
+ "&le;": "\u2264",
2627
+ "&ge;": "\u2265",
2628
+ "&asymp;": "\u2248",
2629
+ "&equiv;": "\u2261",
2630
+ "&infin;": "\u221E",
2631
+ "&int;": "\u222B",
2632
+ "&sum;": "\u2211",
2633
+ "&prod;": "\u220F",
2634
+ "&radic;": "\u221A",
2635
+ "&part;": "\u2202",
2636
+ "&permil;": "\u2030",
2637
+ "&deg;": "\xB0",
2638
+ "&micro;": "\xB5",
2639
+ "&larr;": "\u2190",
2640
+ "&uarr;": "\u2191",
2641
+ "&rarr;": "\u2192",
2642
+ "&darr;": "\u2193",
2643
+ "&harr;": "\u2194",
2644
+ "&crarr;": "\u21B5",
2645
+ "&lArr;": "\u21D0",
2646
+ "&uArr;": "\u21D1",
2647
+ "&rArr;": "\u21D2",
2648
+ "&dArr;": "\u21D3",
2649
+ "&hArr;": "\u21D4",
2650
+ "&alpha;": "\u03B1",
2651
+ "&beta;": "\u03B2",
2652
+ "&gamma;": "\u03B3",
2653
+ "&delta;": "\u03B4",
2654
+ "&epsilon;": "\u03B5",
2655
+ "&zeta;": "\u03B6",
2656
+ "&eta;": "\u03B7",
2657
+ "&theta;": "\u03B8",
2658
+ "&iota;": "\u03B9",
2659
+ "&kappa;": "\u03BA",
2660
+ "&lambda;": "\u03BB",
2661
+ "&mu;": "\u03BC",
2662
+ "&nu;": "\u03BD",
2663
+ "&xi;": "\u03BE",
2664
+ "&omicron;": "\u03BF",
2665
+ "&pi;": "\u03C0",
2666
+ "&rho;": "\u03C1",
2667
+ "&sigma;": "\u03C3",
2668
+ "&tau;": "\u03C4",
2669
+ "&upsilon;": "\u03C5",
2670
+ "&phi;": "\u03C6",
2671
+ "&chi;": "\u03C7",
2672
+ "&psi;": "\u03C8",
2673
+ "&omega;": "\u03C9",
2674
+ "&Alpha;": "\u0391",
2675
+ "&Beta;": "\u0392",
2676
+ "&Gamma;": "\u0393",
2677
+ "&Delta;": "\u0394",
2678
+ "&Epsilon;": "\u0395",
2679
+ "&Zeta;": "\u0396",
2680
+ "&Eta;": "\u0397",
2681
+ "&Theta;": "\u0398",
2682
+ "&Iota;": "\u0399",
2683
+ "&Kappa;": "\u039A",
2684
+ "&Lambda;": "\u039B",
2685
+ "&Mu;": "\u039C",
2686
+ "&Nu;": "\u039D",
2687
+ "&Xi;": "\u039E",
2688
+ "&Omicron;": "\u039F",
2689
+ "&Pi;": "\u03A0",
2690
+ "&Rho;": "\u03A1",
2691
+ "&Sigma;": "\u03A3",
2692
+ "&Tau;": "\u03A4",
2693
+ "&Upsilon;": "\u03A5",
2694
+ "&Phi;": "\u03A6",
2695
+ "&Chi;": "\u03A7",
2696
+ "&Psi;": "\u03A8",
2697
+ "&Omega;": "\u03A9",
2698
+ "&Agrave;": "\xC0",
2699
+ "&Aacute;": "\xC1",
2700
+ "&Acirc;": "\xC2",
2701
+ "&Atilde;": "\xC3",
2702
+ "&Auml;": "\xC4",
2703
+ "&Aring;": "\xC5",
2704
+ "&AElig;": "\xC6",
2705
+ "&Ccedil;": "\xC7",
2706
+ "&Egrave;": "\xC8",
2707
+ "&Eacute;": "\xC9",
2708
+ "&Ecirc;": "\xCA",
2709
+ "&Euml;": "\xCB",
2710
+ "&Igrave;": "\xCC",
2711
+ "&Iacute;": "\xCD",
2712
+ "&Icirc;": "\xCE",
2713
+ "&Iuml;": "\xCF",
2714
+ "&ETH;": "\xD0",
2715
+ "&Ntilde;": "\xD1",
2716
+ "&Ograve;": "\xD2",
2717
+ "&Oacute;": "\xD3",
2718
+ "&Ocirc;": "\xD4",
2719
+ "&Otilde;": "\xD5",
2720
+ "&Ouml;": "\xD6",
2721
+ "&Oslash;": "\xD8",
2722
+ "&Ugrave;": "\xD9",
2723
+ "&Uacute;": "\xDA",
2724
+ "&Ucirc;": "\xDB",
2725
+ "&Uuml;": "\xDC",
2726
+ "&Yacute;": "\xDD",
2727
+ "&THORN;": "\xDE",
2728
+ "&szlig;": "\xDF",
2729
+ "&agrave;": "\xE0",
2730
+ "&aacute;": "\xE1",
2731
+ "&acirc;": "\xE2",
2732
+ "&atilde;": "\xE3",
2733
+ "&auml;": "\xE4",
2734
+ "&aring;": "\xE5",
2735
+ "&aelig;": "\xE6",
2736
+ "&ccedil;": "\xE7",
2737
+ "&egrave;": "\xE8",
2738
+ "&eacute;": "\xE9",
2739
+ "&ecirc;": "\xEA",
2740
+ "&euml;": "\xEB",
2741
+ "&igrave;": "\xEC",
2742
+ "&iacute;": "\xED",
2743
+ "&icirc;": "\xEE",
2744
+ "&iuml;": "\xEF",
2745
+ "&eth;": "\xF0",
2746
+ "&ntilde;": "\xF1",
2747
+ "&ograve;": "\xF2",
2748
+ "&oacute;": "\xF3",
2749
+ "&ocirc;": "\xF4",
2750
+ "&otilde;": "\xF5",
2751
+ "&ouml;": "\xF6",
2752
+ "&oslash;": "\xF8",
2753
+ "&ugrave;": "\xF9",
2754
+ "&uacute;": "\xFA",
2755
+ "&ucirc;": "\xFB",
2756
+ "&uuml;": "\xFC",
2757
+ "&yacute;": "\xFD",
2758
+ "&thorn;": "\xFE",
2759
+ "&yuml;": "\xFF",
2760
+ "&iexcl;": "\xA1",
2761
+ "&iquest;": "\xBF",
2762
+ "&fnof;": "\u0192",
2763
+ "&circ;": "\u02C6",
2764
+ "&tilde;": "\u02DC",
2765
+ "&OElig;": "\u0152",
2766
+ "&oelig;": "\u0153",
2767
+ "&Scaron;": "\u0160",
2768
+ "&scaron;": "\u0161",
2769
+ "&Yuml;": "\u0178",
2770
+ "&ordf;": "\xAA",
2771
+ "&ordm;": "\xBA",
2772
+ "&macr;": "\xAF",
2773
+ "&acute;": "\xB4",
2774
+ "&cedil;": "\xB8",
2775
+ "&sup1;": "\xB9",
2776
+ "&sup2;": "\xB2",
2777
+ "&sup3;": "\xB3",
2778
+ "&frac14;": "\xBC",
2779
+ "&frac12;": "\xBD",
2780
+ "&frac34;": "\xBE",
2781
+ "&spades;": "\u2660",
2782
+ "&clubs;": "\u2663",
2783
+ "&hearts;": "\u2665",
2784
+ "&diams;": "\u2666",
2785
+ "&loz;": "\u25CA",
2786
+ "&oline;": "\u203E",
2787
+ "&frasl;": "\u2044",
2788
+ "&weierp;": "\u2118",
2789
+ "&image;": "\u2111",
2790
+ "&real;": "\u211C",
2791
+ "&alefsym;": "\u2135"
2792
+ };
2793
+ var entityPattern = new RegExp(Object.keys(commonEntities).map((entity) => entity.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|"), "g");
2794
+ var decodeHtmlEntities = (text) => text.replace(entityPattern, (match) => commonEntities[match]).replace(/&#(\d+);/g, (_, num) => String.fromCharCode(parseInt(num, 10))).replace(/&#x([0-9a-fA-F]+);/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)));
2795
+
2796
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTransUtils/tokenizer.js
2797
+ var tokenize = (translation) => {
2798
+ const tokens = [];
2799
+ let position = 0;
2800
+ let currentText = "";
2801
+ const flushText = () => {
2802
+ if (currentText) {
2803
+ tokens.push({
2804
+ type: "Text",
2805
+ value: currentText,
2806
+ position: position - currentText.length
2807
+ });
2808
+ currentText = "";
2809
+ }
2810
+ };
2811
+ while (position < translation.length) {
2812
+ const char = translation[position];
2813
+ if (char === "<") {
2814
+ const tagMatch = translation.slice(position).match(/^<(\d+)>/);
2815
+ if (tagMatch) {
2816
+ flushText();
2817
+ tokens.push({
2818
+ type: "TagOpen",
2819
+ value: tagMatch[0],
2820
+ position,
2821
+ tagNumber: parseInt(tagMatch[1], 10)
2822
+ });
2823
+ position += tagMatch[0].length;
2824
+ } else {
2825
+ const closeTagMatch = translation.slice(position).match(/^<\/(\d+)>/);
2826
+ if (closeTagMatch) {
2827
+ flushText();
2828
+ tokens.push({
2829
+ type: "TagClose",
2830
+ value: closeTagMatch[0],
2831
+ position,
2832
+ tagNumber: parseInt(closeTagMatch[1], 10)
2833
+ });
2834
+ position += closeTagMatch[0].length;
2835
+ } else {
2836
+ currentText += char;
2837
+ position += 1;
2838
+ }
2839
+ }
2840
+ } else {
2841
+ currentText += char;
2842
+ position += 1;
2843
+ }
2844
+ }
2845
+ flushText();
2846
+ return tokens;
2847
+ };
2848
+
2849
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTransUtils/renderTranslation.js
2850
+ var import_react4 = __toESM(require("react"), 1);
2851
+ var renderDeclarationNode = (declaration, children, childDeclarations) => {
2852
+ const {
2853
+ type,
2854
+ props = {}
2855
+ } = declaration;
2856
+ if (props.children && Array.isArray(props.children) && childDeclarations) {
2857
+ const {
2858
+ children: _childrenToRemove,
2859
+ ...propsWithoutChildren
2860
+ } = props;
2861
+ return import_react4.default.createElement(type, propsWithoutChildren, ...children);
2862
+ }
2863
+ if (children.length === 0) {
2864
+ return import_react4.default.createElement(type, props);
2865
+ }
2866
+ if (children.length === 1) {
2867
+ return import_react4.default.createElement(type, props, children[0]);
2868
+ }
2869
+ return import_react4.default.createElement(type, props, ...children);
2870
+ };
2871
+ var renderTranslation = (translation, declarations = []) => {
2872
+ if (!translation) {
2873
+ return [];
2874
+ }
2875
+ const tokens = tokenize(translation);
2876
+ const result = [];
2877
+ const stack = [];
2878
+ const literalTagNumbers = /* @__PURE__ */ new Set();
2879
+ const getCurrentDeclarations = () => {
2880
+ if (stack.length === 0) {
2881
+ return declarations;
2882
+ }
2883
+ const parentFrame = stack[stack.length - 1];
2884
+ if (parentFrame.declaration.props?.children && Array.isArray(parentFrame.declaration.props.children)) {
2885
+ return parentFrame.declaration.props.children;
2886
+ }
2887
+ return parentFrame.declarations;
2888
+ };
2889
+ tokens.forEach((token) => {
2890
+ switch (token.type) {
2891
+ case "Text":
2892
+ {
2893
+ const decoded = decodeHtmlEntities(token.value);
2894
+ const targetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
2895
+ targetArray.push(decoded);
2896
+ }
2897
+ break;
2898
+ case "TagOpen":
2899
+ {
2900
+ const {
2901
+ tagNumber
2902
+ } = token;
2903
+ const currentDeclarations = getCurrentDeclarations();
2904
+ const declaration = currentDeclarations[tagNumber];
2905
+ if (!declaration) {
2906
+ literalTagNumbers.add(tagNumber);
2907
+ const literalText = `<${tagNumber}>`;
2908
+ const targetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
2909
+ targetArray.push(literalText);
2910
+ break;
2911
+ }
2912
+ stack.push({
2913
+ tagNumber,
2914
+ children: [],
2915
+ position: token.position,
2916
+ declaration,
2917
+ declarations: currentDeclarations
2918
+ });
2919
+ }
2920
+ break;
2921
+ case "TagClose":
2922
+ {
2923
+ const {
2924
+ tagNumber
2925
+ } = token;
2926
+ if (literalTagNumbers.has(tagNumber)) {
2927
+ const literalText = `</${tagNumber}>`;
2928
+ const literalTargetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
2929
+ literalTargetArray.push(literalText);
2930
+ literalTagNumbers.delete(tagNumber);
2931
+ break;
2932
+ }
2933
+ if (stack.length === 0) {
2934
+ throw new TranslationParserError(`Unexpected closing tag </${tagNumber}> at position ${token.position}`, token.position, translation);
2935
+ }
2936
+ const frame = stack.pop();
2937
+ if (frame.tagNumber !== tagNumber) {
2938
+ throw new TranslationParserError(`Mismatched tags: expected </${frame.tagNumber}> but got </${tagNumber}> at position ${token.position}`, token.position, translation);
2939
+ }
2940
+ const element = renderDeclarationNode(frame.declaration, frame.children, frame.declarations);
2941
+ const elementTargetArray = stack.length > 0 ? stack[stack.length - 1].children : result;
2942
+ elementTargetArray.push(element);
2943
+ }
2944
+ break;
2945
+ }
2946
+ });
2947
+ if (stack.length > 0) {
2948
+ const unclosed = stack[stack.length - 1];
2949
+ throw new TranslationParserError(`Unclosed tag <${unclosed.tagNumber}> at position ${unclosed.position}`, unclosed.position, translation);
2950
+ }
2951
+ return result;
2952
+ };
2953
+
2954
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTransWithoutContext.js
2955
+ function IcuTransWithoutContext({
2956
+ i18nKey,
2957
+ defaultTranslation,
2958
+ content,
2959
+ ns,
2960
+ values = {},
2961
+ i18n: i18nFromProps,
2962
+ t: tFromProps
2963
+ }) {
2964
+ const i18n = i18nFromProps || getI18n();
2965
+ if (!i18n) {
2966
+ warnOnce(i18n, "NO_I18NEXT_INSTANCE", `IcuTrans: You need to pass in an i18next instance using i18nextReactModule`, {
2967
+ i18nKey
2968
+ });
2969
+ return import_react5.default.createElement(import_react5.default.Fragment, {}, defaultTranslation);
2970
+ }
2971
+ const t2 = tFromProps || i18n.t?.bind(i18n) || ((k) => k);
2972
+ let namespaces = ns || t2.ns || i18n.options?.defaultNS;
2973
+ namespaces = isString2(namespaces) ? [namespaces] : namespaces || ["translation"];
2974
+ let mergedValues = values;
2975
+ if (i18n.options?.interpolation?.defaultVariables) {
2976
+ mergedValues = values && Object.keys(values).length > 0 ? {
2977
+ ...values,
2978
+ ...i18n.options.interpolation.defaultVariables
2979
+ } : {
2980
+ ...i18n.options.interpolation.defaultVariables
2981
+ };
2982
+ }
2983
+ const translation = t2(i18nKey, {
2984
+ defaultValue: defaultTranslation,
2985
+ ...mergedValues,
2986
+ ns: namespaces
2987
+ });
2988
+ try {
2989
+ const rendered = renderTranslation(translation, content);
2990
+ return import_react5.default.createElement(import_react5.default.Fragment, {}, ...rendered);
2991
+ } catch (error) {
2992
+ warn(i18n, "ICU_TRANS_RENDER_ERROR", `IcuTrans component error for key "${i18nKey}": ${error.message}`, {
2993
+ i18nKey,
2994
+ error
2995
+ });
2996
+ return import_react5.default.createElement(import_react5.default.Fragment, {}, translation);
2997
+ }
2998
+ }
2999
+ IcuTransWithoutContext.displayName = "IcuTransWithoutContext";
3000
+
3001
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/IcuTrans.js
3002
+ function IcuTrans({
3003
+ i18nKey,
3004
+ defaultTranslation,
3005
+ content,
3006
+ ns,
3007
+ values = {},
3008
+ i18n: i18nFromProps,
3009
+ t: tFromProps
3010
+ }) {
3011
+ const {
3012
+ i18n: i18nFromContext,
3013
+ defaultNS: defaultNSFromContext
3014
+ } = (0, import_react6.useContext)(I18nContext) || {};
3015
+ const i18n = i18nFromProps || i18nFromContext || getI18n();
3016
+ const t2 = tFromProps || i18n?.t.bind(i18n);
3017
+ return IcuTransWithoutContext({
3018
+ i18nKey,
3019
+ defaultTranslation,
3020
+ content,
3021
+ ns: ns || t2?.ns || defaultNSFromContext || i18n?.options?.defaultNS,
3022
+ values,
3023
+ i18n,
3024
+ t: tFromProps
3025
+ });
3026
+ }
3027
+ IcuTrans.displayName = "IcuTrans";
3028
+
3029
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/useTranslation.js
3030
+ var import_react7 = require("react");
3031
+ var import_shim = require("use-sync-external-store/shim");
3032
+
3033
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/withTranslation.js
3034
+ var import_react8 = require("react");
3035
+
3036
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/I18nextProvider.js
3037
+ var import_react9 = require("react");
3038
+
3039
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/withSSR.js
3040
+ var import_react11 = require("react");
3041
+
3042
+ // node_modules/.pnpm/react-i18next@16.5.4_i18next@25.8.2_typescript@5.9.3__react-dom@19.2.4_react@19.2.4__react@19.2.4_typescript@5.9.3/node_modules/react-i18next/dist/es/useSSR.js
3043
+ var import_react10 = require("react");
3044
+
3045
+ // src/locales/pt/translation.json
3046
+ var translation_default = {
3047
+ title: "Configura\xE7\xE3o do Dispositivo",
3048
+ steps: {
3049
+ setup: "Configura\xE7\xE3o",
3050
+ ssh: "SSH",
3051
+ ports: "Portas",
3052
+ complete: "Completo"
3053
+ },
3054
+ step1: {
3055
+ title: "Identidade do Dispositivo e Seguran\xE7a",
3056
+ description: "Configure o nome do dispositivo e credenciais de acesso",
3057
+ deviceName: "Nome do Dispositivo",
3058
+ deviceNamePlaceholder: "ex.: XCODER 1",
3059
+ deviceNameHelp: "Escolha um nome memor\xE1vel para este dispositivo",
3060
+ devicePassword: "Senha do Dispositivo",
3061
+ devicePasswordPlaceholder: "Digite uma senha segura",
3062
+ reqLetter: "Letras",
3063
+ reqCapital: "Letras mai\xFAsculas",
3064
+ reqNumber: "N\xFAmeros",
3065
+ reqSpecial: "Caracteres especiais",
3066
+ reqMin: "8 a 32 caracteres"
3067
+ },
3068
+ step2: {
3069
+ title: "Habilitar acesso remoto",
3070
+ description: "Habilite o servi\xE7o de SSH para garantir acesso remoto ao dispositivo",
3071
+ serviceTitle: "Servi\xE7o de SSH",
3072
+ serviceDescription: "Este servi\xE7o permite que voc\xEA e a equipe de suporte acessem e gerenciem seu dispositivo remotamente e com seguran\xE7a por meio de uma conex\xE3o criptografada. Ele \xE9 usado para executar comandos, transferir arquivos e realizar tarefas de administra\xE7\xE3o de sistema de forma segura.",
3073
+ feature1: "Acesso remoto seguro",
3074
+ feature2: "Transfer\xEAncia segura de arquivos (SCP/SFTP)",
3075
+ feature3: "Execu\xE7\xE3o de comandos remotos",
3076
+ feature4: "Gerenciamento de porta e chave de autentica\xE7\xE3o",
3077
+ enableLabel: "Habilitar acesso remoto",
3078
+ enableHelp: "Ative este servi\xE7o para garantir ao suporte t\xE9cnico acesso remoto ao dispositivo"
3079
+ },
3080
+ step3: {
3081
+ title: "Configura\xE7\xE3o de portas",
3082
+ description: "Defina a faixa de portas para canais de recep\xE7\xE3o de v\xEDdeo",
3083
+ serviceTitle: "Portas de recep\xE7\xE3o de video",
3084
+ serviceDescription: "Este servi\xE7o tratar\xE1 o tr\xE1fego espec\xEDfico da aplica\xE7\xE3o na faixa de portas definida.",
3085
+ portRangeLabel: "Configura\xE7\xE3o de Faixa de Portas",
3086
+ startPort: "Porta Inicial",
3087
+ endPort: "Porta Final",
3088
+ portHelp: "Especifique a faixa de portas para seu Nano Receiver (1-65535)"
3089
+ },
3090
+ step4: {
3091
+ successTitle: "Configura\xE7\xE3o Conclu\xEDda com Sucesso",
3092
+ successMessage: "Todas as configura\xE7\xF5es foram registradas com sucesso!",
3093
+ supportTitle: "Informa\xE7\xF5es de Suporte T\xE9cnico",
3094
+ hotlineLabel: "Central de Atendimento:",
3095
+ emailLabel: "E-mail T\xE9cnico:",
3096
+ hoursLabel: "Hor\xE1rio de Atendimento:",
3097
+ hoursValue: "Dispon\xEDvel 24/7",
3098
+ reminderStrong: "Lembre-se:",
3099
+ reminderText: "Apenas o suporte t\xE9cnico poder\xE1 modificar essas configura\xE7\xF5es ap\xF3s a conclus\xE3o da instala\xE7\xE3o."
3100
+ },
3101
+ buttons: {
3102
+ back: "Voltar",
3103
+ continue: "Continuar",
3104
+ complete: "Concluir"
3105
+ },
3106
+ wizard: {
3107
+ draftSaved: "Rascunho salvo"
3108
+ },
3109
+ errors: {
3110
+ deviceNameRequired: "Por favor, digite um nome para o dispositivo",
3111
+ passwordInvalid: "Por favor, digite uma senha v\xE1lida",
3112
+ portsRequired: "Por favor, digite tanto a porta inicial quanto a final",
3113
+ startPortGreater: "A porta inicial n\xE3o pode ser maior que a porta final",
3114
+ portsOutOfRange: "As portas devem estar entre 1 e 65535",
3115
+ saveFailed: "Falha ao salvar configura\xE7\xE3o. Por favor, tente novamente."
3116
+ }
3117
+ };
3118
+
3119
+ // src/locales/en/translation.json
3120
+ var translation_default2 = {
3121
+ title: "Device Configuration",
3122
+ steps: {
3123
+ setup: "Setup",
3124
+ ssh: "SSH",
3125
+ ports: "Ports",
3126
+ complete: "Complete"
3127
+ },
3128
+ step1: {
3129
+ title: "Device Identity & Security",
3130
+ description: "Configure device name and access credentials",
3131
+ deviceName: "Device Name",
3132
+ deviceNamePlaceholder: "e.g., XCODER 1",
3133
+ deviceNameHelp: "Choose a memorable name for this device",
3134
+ devicePassword: "Device Password",
3135
+ devicePasswordPlaceholder: "Enter secure password",
3136
+ reqLetter: "Letters",
3137
+ reqCapital: "Capital Letters",
3138
+ reqNumber: "Numbers",
3139
+ reqSpecial: "Special Characters",
3140
+ reqMin: "Between 8 and 32 caracteres"
3141
+ },
3142
+ step2: {
3143
+ title: "Enable Remote Access",
3144
+ description: "Enable SSH service to ensure remote access to the device",
3145
+ serviceTitle: "SSH Service",
3146
+ serviceDescription: "This service allows you and the support team to access and manage your device remotely and securely through an encrypted connection. It is used to execute commands, transfer files and perform system administration tasks safely.",
3147
+ feature1: "Secure remote access",
3148
+ feature2: "Secure file transfer (SCP/SFTP)",
3149
+ feature3: "Remote command execution",
3150
+ feature4: "Port and authentication key management",
3151
+ enableLabel: "Enable remote access",
3152
+ enableHelp: "Enable this service to ensure technical support remote access to the device"
3153
+ },
3154
+ step3: {
3155
+ title: "Port Configuration",
3156
+ description: "Define port range for video reception channels",
3157
+ serviceTitle: "Video Reception Ports",
3158
+ serviceDescription: "This service will handle specific application traffic on the defined port range.",
3159
+ portRangeLabel: "Port Range Configuration",
3160
+ startPort: "Start Port",
3161
+ endPort: "End Port",
3162
+ portHelp: "Specify the port range for your Nano Receiver (1-65535)"
3163
+ },
3164
+ step4: {
3165
+ successTitle: "Setup Completed Successfully",
3166
+ successMessage: "All configurations have been successfully registered!",
3167
+ supportTitle: "Technical Support Information",
3168
+ hotlineLabel: "Support Hotline:",
3169
+ emailLabel: "Technical Email:",
3170
+ hoursLabel: "Support Hours:",
3171
+ hoursValue: "Available 24/7",
3172
+ reminderStrong: "Remember:",
3173
+ reminderText: "Only technical support can modify these configurations after installation completion."
3174
+ },
3175
+ buttons: {
3176
+ back: "Back",
3177
+ continue: "Continue",
3178
+ complete: "Complete"
3179
+ },
3180
+ wizard: {
3181
+ draftSaved: "Draft saved"
3182
+ },
3183
+ errors: {
3184
+ deviceNameRequired: "Please enter a device name",
3185
+ passwordInvalid: "Please enter a valid password",
3186
+ portsRequired: "Please enter both start and end ports",
3187
+ startPortGreater: "Start port cannot be greater than end port",
3188
+ portsOutOfRange: "Ports must be between 1 and 65535",
3189
+ saveFailed: "Failed to save configuration. Please try again."
3190
+ }
3191
+ };
3192
+
3193
+ // src/locales/es/translation.json
3194
+ var translation_default3 = {
3195
+ title: "Configuraci\xF3n del Dispositivo",
3196
+ steps: {
3197
+ setup: "Configuraci\xF3n",
3198
+ ssh: "SSH",
3199
+ ports: "Puertos",
3200
+ complete: "Completo"
3201
+ },
3202
+ step1: {
3203
+ title: "Identidad del Dispositivo y Seguridad",
3204
+ description: "Configure el nombre del dispositivo y las credenciales de acceso",
3205
+ deviceName: "Nombre del Dispositivo",
3206
+ deviceNamePlaceholder: "ej.: XCODER 1",
3207
+ deviceNameHelp: "Elija un nombre memorable para este dispositivo",
3208
+ devicePassword: "Contrase\xF1a del Dispositivo",
3209
+ devicePasswordPlaceholder: "Ingrese una contrase\xF1a segura",
3210
+ reqLetter: "Letras",
3211
+ reqCapital: "Letras may\xFAsculas",
3212
+ reqNumber: "N\xFAmeros",
3213
+ reqSpecial: "Caracteres especiales",
3214
+ reqMin: "8 a 32 caracteres"
3215
+ },
3216
+ step2: {
3217
+ title: "Habilitar acceso remoto",
3218
+ description: "Habilite el servicio SSH para garantizar el acceso remoto al dispositivo",
3219
+ serviceTitle: "Servicio SSH",
3220
+ serviceDescription: "Este servicio permite que usted y el equipo de soporte accedan y administren su dispositivo de forma remota y segura a trav\xE9s de una conexi\xF3n cifrada. Se utiliza para ejecutar comandos, transferir archivos y realizar tareas de administraci\xF3n del sistema de forma segura.",
3221
+ feature1: "Acceso remoto seguro",
3222
+ feature2: "Transferencia segura de archivos (SCP/SFTP)",
3223
+ feature3: "Ejecuci\xF3n de comandos remotos",
3224
+ feature4: "Gesti\xF3n de puertos y claves de autenticaci\xF3n",
3225
+ enableLabel: "Habilitar acceso remoto",
3226
+ enableHelp: "Active este servicio para garantizar el acceso remoto del soporte t\xE9cnico al dispositivo"
3227
+ },
3228
+ step3: {
3229
+ title: "Configuraci\xF3n de puertos",
3230
+ description: "Defina el rango de puertos para canales de recepci\xF3n de video",
3231
+ serviceTitle: "Puertos de recepci\xF3n de video",
3232
+ serviceDescription: "Este servicio manejar\xE1 el tr\xE1fico espec\xEDfico de la aplicaci\xF3n en el rango de puertos definido.",
3233
+ portRangeLabel: "Configuraci\xF3n de Rango de Puertos",
3234
+ startPort: "Puerto Inicial",
3235
+ endPort: "Puerto Final",
3236
+ portHelp: "Especifique el rango de puertos para su Nano Receiver (1-65535)"
3237
+ },
3238
+ step4: {
3239
+ successTitle: "Configuraci\xF3n Completada Exitosamente",
3240
+ successMessage: "\xA1Todas las configuraciones han sido registradas con \xE9xito!",
3241
+ supportTitle: "Informaci\xF3n de Soporte T\xE9cnico",
3242
+ hotlineLabel: "L\xEDnea de Soporte:",
3243
+ emailLabel: "Email T\xE9cnico:",
3244
+ hoursLabel: "Horario de Soporte:",
3245
+ hoursValue: "Disponible 24/7",
3246
+ reminderStrong: "Recuerde:",
3247
+ reminderText: "Solo el soporte t\xE9cnico puede modificar estas configuraciones despu\xE9s de completar la instalaci\xF3n."
3248
+ },
3249
+ buttons: {
3250
+ back: "Volver",
3251
+ continue: "Continuar",
3252
+ complete: "Completar"
3253
+ },
3254
+ wizard: {
3255
+ draftSaved: "Borrador guardado"
3256
+ },
3257
+ errors: {
3258
+ deviceNameRequired: "Por favor, ingrese un nombre para el dispositivo",
3259
+ passwordInvalid: "Por favor, ingrese una contrase\xF1a valida",
3260
+ portsRequired: "Por favor, ingrese tanto el puerto inicial como el final",
3261
+ startPortGreater: "El puerto inicial no puede ser mayor que el puerto final",
3262
+ portsOutOfRange: "Los puertos deben estar entre 1 y 65535",
3263
+ saveFailed: "Error al guardar la configuraci\xF3n. Por favor, int\xE9ntelo de nuevo."
3264
+ }
3265
+ };
3266
+
3267
+ // src/i18n.ts
3268
+ var resources = { pt: { translation: translation_default }, en: { translation: translation_default2 }, es: { translation: translation_default3 } };
3269
+ instance.use(initReactI18next).init({
3270
+ resources,
3271
+ fallbackLng: "en",
3272
+ lng: (navigator.language || "en").split("-")[0],
3273
+ interpolation: { escapeValue: false },
3274
+ keySeparator: ".",
3275
+ nsSeparator: false
3276
+ });
3277
+ var i18n_default = instance;