@viasoftbr/shared-ui 0.0.1

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