@pie-element/simple-cloze 0.1.4-next.5 → 0.1.4-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/author.js +2 -0
  2. package/dist/author/index.d.ts +6 -0
  3. package/dist/author/index.js +12147 -21505
  4. package/dist/author/index.js.map +1 -1
  5. package/dist/browser/author/index.js +9202 -16240
  6. package/dist/browser/author/index.js.map +1 -1
  7. package/dist/browser/{client-Dt8SOe5Z.js → client-BSTc3boO.js} +650 -755
  8. package/dist/browser/client-BSTc3boO.js.map +1 -0
  9. package/dist/browser/controller/index.js +42 -32
  10. package/dist/browser/controller/index.js.map +1 -1
  11. package/dist/browser/delivery/index.js +129 -136
  12. package/dist/browser/delivery/index.js.map +1 -1
  13. package/dist/browser/dist-CYpSKy-4.js +80 -0
  14. package/dist/browser/dist-CYpSKy-4.js.map +1 -0
  15. package/dist/browser/i18n-DJMxdTMU.js +1612 -0
  16. package/dist/browser/i18n-DJMxdTMU.js.map +1 -0
  17. package/dist/browser/plain-text-iaQZhkGe.js +53 -0
  18. package/dist/browser/plain-text-iaQZhkGe.js.map +1 -0
  19. package/dist/browser/print/index.js +64 -21
  20. package/dist/browser/print/index.js.map +1 -1
  21. package/dist/controller/defaults.d.ts +1 -0
  22. package/dist/controller/index.d.ts +51 -8
  23. package/dist/controller/index.js +121 -29
  24. package/dist/controller/index.js.map +1 -1
  25. package/dist/controller/plain-text.d.ts +11 -0
  26. package/dist/delivery/index.d.ts +9 -4
  27. package/dist/delivery/index.js +2826 -267
  28. package/dist/delivery/index.js.map +1 -1
  29. package/dist/i18n.d.ts +7 -0
  30. package/dist/index.iife.js +9 -3
  31. package/dist/index.js +2826 -267
  32. package/dist/index.js.map +1 -1
  33. package/dist/print/index.d.ts +7 -0
  34. package/dist/print/index.js +2775 -28
  35. package/dist/print/index.js.map +1 -1
  36. package/module/print.js +2383 -600
  37. package/module/print.js.map +1 -1
  38. package/package.json +2 -1
  39. package/dist/browser/client-Dt8SOe5Z.js.map +0 -1
@@ -0,0 +1,1612 @@
1
+ //#region ../../shared/math-rendering-mathjax/dist/index.js
2
+ var e = null;
3
+ function t(t) {
4
+ return typeof window > "u" || window.MathJax?.typesetPromise ? Promise.resolve() : e || (e = new Promise((e, n) => {
5
+ let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = t, s = {
6
+ loader: { load: i ? ["a11y/assistive-mml"] : [] },
7
+ tex: {
8
+ packages: [
9
+ "base",
10
+ "ams",
11
+ "autoload"
12
+ ],
13
+ macros: {
14
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
15
+ overarc: "\\overparen",
16
+ napprox: "\\not\\approx",
17
+ longdiv: "\\enclose{longdiv}"
18
+ }
19
+ },
20
+ options: {
21
+ enableMenu: i,
22
+ enableExplorer: i,
23
+ enableAssistiveMml: i
24
+ },
25
+ startup: {
26
+ ready: () => {
27
+ window.MathJax?.startup.defaultReady && (window.MathJax.startup.defaultReady(), e());
28
+ },
29
+ defaultReady: () => {}
30
+ }
31
+ };
32
+ r && s.tex && (s.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], s.tex.processEscapes = !0), a || (s.chtml = { fontURL: "" }), window.MathJax = s;
33
+ let c = document.createElement("script");
34
+ c.src = o || "https://cdn.jsdelivr.net/npm/mathjax@4/tex-chtml.js", c.async = !0, c.onload = () => {
35
+ setTimeout(e, 100);
36
+ }, c.onerror = () => {
37
+ n(/* @__PURE__ */ Error("Failed to load MathJax"));
38
+ }, document.head.appendChild(c);
39
+ }), e);
40
+ }
41
+ function n() {
42
+ let e = window.MathJax?.startup?.document;
43
+ if (typeof e?.assistiveMml == "function") try {
44
+ e.assistiveMml().updateDocument?.();
45
+ } catch (e) {
46
+ console.warn("[mathjax-renderer] Failed to attach assistive MathML:", e);
47
+ }
48
+ }
49
+ function r(e = {}) {
50
+ return async (r) => {
51
+ if (await t(e), !window.MathJax?.typesetPromise) {
52
+ console.warn("[mathjax-renderer] MathJax not loaded or missing typesetPromise.");
53
+ return;
54
+ }
55
+ await window.MathJax.typesetPromise([r]), n();
56
+ };
57
+ }
58
+ var i = null;
59
+ function a() {
60
+ return i ||= r({
61
+ accessibility: !0,
62
+ useSingleDollar: !0
63
+ }), i;
64
+ }
65
+ function o() {
66
+ if (typeof window > "u") return null;
67
+ let e = window["@pie-lib/math-rendering"];
68
+ return typeof e?.renderMath == "function" ? e : null;
69
+ }
70
+ var s = async (e) => {
71
+ if (typeof window > "u") return;
72
+ let t = typeof e == "string", n;
73
+ t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
74
+ let r = o();
75
+ return r ? await r.renderMath?.(n) : await a()(n), t ? n.innerHTML : void 0;
76
+ }, c = {
77
+ translation: {
78
+ categorize: {
79
+ limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
80
+ maxChoicesPerCategoryRestriction: "To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."
81
+ },
82
+ ebsr: { part: "Part {{index}}" },
83
+ numberLine: {
84
+ addElementLimit_one: "You can only add {{count}} element",
85
+ addElementLimit_other: "You can only add {{count}} elements",
86
+ clearAll: "Clear all"
87
+ },
88
+ imageClozeAssociation: {
89
+ reachedLimit_one: "You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",
90
+ reachedLimit_other: "Full"
91
+ },
92
+ drawingResponse: {
93
+ fillColor: "Fill color",
94
+ outlineColor: "Outline color",
95
+ noFill: "No fill",
96
+ lightblue: "Light blue",
97
+ lightyellow: "Light yellow",
98
+ red: "Red",
99
+ orange: "Orange",
100
+ yellow: "Yellow",
101
+ violet: "Violet",
102
+ blue: "Blue",
103
+ green: "Green",
104
+ white: "White",
105
+ black: "Black",
106
+ onDoubleClick: "Double click to edit this text. Press Enter to submit."
107
+ },
108
+ charting: {
109
+ addCategory: "Add category",
110
+ actions: "Actions",
111
+ add: "Add",
112
+ delete: "Delete",
113
+ newLabel: "New label",
114
+ reachedLimit_other: "There can't be more than {{count}} categories.",
115
+ keyLegend: {
116
+ incorrectAnswer: "Student incorrect answer",
117
+ correctAnswer: "Student correct answer",
118
+ correctKeyAnswer: "Answer key correct"
119
+ }
120
+ },
121
+ graphing: {
122
+ point: "Point",
123
+ circle: "Circle",
124
+ line: "Line",
125
+ parabola: "Parabola",
126
+ absolute: "Absolute Value",
127
+ exponential: "Exponential",
128
+ polygon: "Polygon",
129
+ ray: "Ray",
130
+ segment: "Segment",
131
+ sine: "Sine",
132
+ vector: "Vector",
133
+ label: "Label",
134
+ redo: "Redo",
135
+ reset: "Reset"
136
+ },
137
+ mathInline: { primaryCorrectWithAlternates: "Note: The answer shown above is the primary correct answer specified by the author for this item, but other answers may also be recognized as correct." },
138
+ mcPopulatedBlank: {
139
+ answerChoices: "Answer choices",
140
+ blankLabel: "blank",
141
+ emptyBlank: "(blank)",
142
+ blankPreSelectionHint: "The answer you choose will appear on the blank line above.",
143
+ correctAnswerSelected: "Correct answer selected",
144
+ incorrectAnswerSelected: "Incorrect answer selected",
145
+ selectedAnswerImage: "Selected answer image",
146
+ choiceImage: "Choice {{id}}",
147
+ clickToEnableAutoplay: "Click to enable audio autoplay",
148
+ audioResourceUnavailable: "Audio is enabled but no playable audio URL is configured.",
149
+ listen: "Listen",
150
+ listenSilentAlt: "Repeat instructions",
151
+ listenPlayingAlt: "Instructions are playing",
152
+ printAudio: "Audio:",
153
+ printTranscript: "Transcript:",
154
+ printKey: "(key)"
155
+ },
156
+ multipleChoice: {
157
+ minSelections: "Select at least {{minSelections}}.",
158
+ maxSelections_one: "Only {{maxSelections}} answer is allowed.",
159
+ maxSelections_other: "Only {{maxSelections}} answers are allowed.",
160
+ minmaxSelections_equal: "Select {{minSelections}}.",
161
+ minmaxSelections_range: "Select between {{minSelections}} and {{maxSelections}}."
162
+ },
163
+ selectText: {
164
+ correctAnswerSelected: "Correct",
165
+ correctAnswerNotSelected: "Correct Answer Not Selected",
166
+ incorrectSelection: "Incorrect Selection",
167
+ key: "Key"
168
+ },
169
+ simpleCloze: {
170
+ correctAnswerShown: "Correct answer",
171
+ correct: "Correct",
172
+ incorrect: "Incorrect",
173
+ unanswered: "No answer",
174
+ placeholder: "Enter your answer...",
175
+ answerInput: "Your answer",
176
+ printCorrectAnswer: "Correct answer:",
177
+ printAnswerBlank: "Answer blank"
178
+ },
179
+ vennClassification: {
180
+ tray: "Tiles to classify",
181
+ unknownTarget: "unknown",
182
+ cancelled: "Cancelled",
183
+ returnedToTray: "{{name}} returned to tray",
184
+ placedIn: "{{name}} placed in {{target}}",
185
+ pickedUp: "Picked up {{name}}",
186
+ pickedUpWithKeyboard: "Picked up {{name}}, drop target: {{target}}. Use arrow keys to choose a drop target, Enter to drop, Escape to cancel.",
187
+ dropTarget: "Drop target: {{target}}",
188
+ unsupportedCircles_one: "This diagram cannot be shown: it has {{count}} circle, and only {{supported}} are supported.",
189
+ unsupportedCircles_other: "This diagram cannot be shown: it has {{count}} circles, and only {{supported}} are supported.",
190
+ setNumber: "Set {{number}}",
191
+ regionOnly: "{{set}} only",
192
+ regionNeither: "Neither {{first}} nor {{second}}",
193
+ regionNoneOf: "None of {{sets}}",
194
+ regionAndSeparator: " and ",
195
+ tileFallbackName: "Tile",
196
+ tileNotPlaced: "not placed",
197
+ tileInRegion: "in {{region}}",
198
+ tileCorrect: "correct",
199
+ tileIncorrect: "incorrect"
200
+ }
201
+ },
202
+ common: {
203
+ undo: "Undo",
204
+ clearAll: "Clear all",
205
+ correct: "Correct",
206
+ incorrect: "Incorrect",
207
+ showCorrectAnswer: "Show correct answer",
208
+ hideCorrectAnswer: "Hide correct answer",
209
+ showTeacherInstructions: "Show Teacher Instructions",
210
+ hideTeacherInstructions: "Hide Teacher Instructions",
211
+ commonCorrectAnswerWithAlternates: "Note: The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.",
212
+ warning: "Warning",
213
+ showNote: "Show Note",
214
+ hideNote: "Hide Note",
215
+ cancel: "Cancel"
216
+ }
217
+ }, l = {
218
+ translation: {
219
+ categorize: {
220
+ limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
221
+ maxChoicesPerCategoryRestriction: "Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"
222
+ },
223
+ ebsr: { part: "Parte {{index}}" },
224
+ numberLine: {
225
+ addElementLimit_one: "Solo puedes agregar {{count}} elemento",
226
+ addElementLimit_other: "Solo puedes agregar {{count}} elementos",
227
+ clearAll: "Borrar todo"
228
+ },
229
+ imageClozeAssociation: {
230
+ reachedLimit_one: "Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
231
+ reachedLimit_other: "Lleno"
232
+ },
233
+ drawingResponse: {
234
+ fillColor: "Color de relleno",
235
+ outlineColor: "Color del contorno",
236
+ noFill: "Sin relleno",
237
+ lightblue: "Azul claro",
238
+ lightyellow: "Amarillo claro",
239
+ red: "Rojo",
240
+ orange: "Naranja",
241
+ yellow: "Amarillo",
242
+ violet: "Violeta",
243
+ blue: "Azul",
244
+ green: "Verde",
245
+ white: "Blanco",
246
+ black: "Negro",
247
+ onDoubleClick: "Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"
248
+ },
249
+ charting: {
250
+ addCategory: "Añadir categoría",
251
+ actions: "Acciones",
252
+ add: "Añadir",
253
+ delete: "Eliminar",
254
+ newLabel: "Nueva etiqueta",
255
+ reachedLimit_other: "No puede haber más de {{count}} categorías.",
256
+ keyLegend: {
257
+ incorrectAnswer: "Respuesta incorrecta del estudiante",
258
+ correctAnswer: "Respuesta correcta del estudiante",
259
+ correctKeyAnswer: "Clave de respuesta correcta"
260
+ }
261
+ },
262
+ graphing: {
263
+ point: "Punto",
264
+ circle: "Circulo",
265
+ line: "Línea",
266
+ parabola: "Parábola",
267
+ absolute: "Valor absoluto",
268
+ exponential: "Exponencial",
269
+ polygon: "Polígono",
270
+ ray: "Semirrecta",
271
+ segment: "Segmento ",
272
+ sine: "Seno",
273
+ vector: "Vector",
274
+ label: "Etiqueta",
275
+ redo: "Rehacer",
276
+ reset: "Reiniciar"
277
+ },
278
+ mathInline: { primaryCorrectWithAlternates: "Nota: La respuesta que se muestra arriba es la respuesta correcta principal especificada por el autor para esta pregunta, pero también se pueden reconocer otras respuestas como correctas." },
279
+ mcPopulatedBlank: {
280
+ answerChoices: "Opciones de respuesta",
281
+ blankLabel: "espacio en blanco",
282
+ emptyBlank: "(en blanco)",
283
+ blankPreSelectionHint: "La respuesta que elijas aparecerá en la línea en blanco de arriba.",
284
+ correctAnswerSelected: "Respuesta correcta seleccionada",
285
+ incorrectAnswerSelected: "Respuesta incorrecta seleccionada",
286
+ selectedAnswerImage: "Imagen de la respuesta seleccionada",
287
+ choiceImage: "Opción {{id}}",
288
+ clickToEnableAutoplay: "Haz clic para activar la reproducción automática del audio",
289
+ audioResourceUnavailable: "El audio está activado, pero no hay una URL de audio reproducible configurada.",
290
+ listen: "Escuchar",
291
+ listenSilentAlt: "Escuchar. Repetir las instrucciones.",
292
+ listenPlayingAlt: "Escuchar. Estas son las instrucciones.",
293
+ printAudio: "Audio:",
294
+ printTranscript: "Transcripción:",
295
+ printKey: "(clave)"
296
+ },
297
+ multipleChoice: {
298
+ minSelections: "Seleccione al menos {{minSelections}}.",
299
+ maxSelections_one: "Sólo se permite {{maxSelections}} respuesta.",
300
+ maxSelections_other: "Sólo se permiten {{maxSelections}} respuestas.",
301
+ minmaxSelections_equal: "Seleccione {{minSelections}}.",
302
+ minmaxSelections_range: "Seleccione entre {{minSelections}} y {{maxSelections}}."
303
+ },
304
+ selectText: {
305
+ correctAnswerSelected: "Respuesta Correcta",
306
+ correctAnswerNotSelected: "Respuesta Correcta No Seleccionada",
307
+ incorrectSelection: "Selección Incorrecta",
308
+ key: "Clave"
309
+ },
310
+ simpleCloze: {
311
+ correctAnswerShown: "Respuesta correcta",
312
+ correct: "Correcto",
313
+ incorrect: "Incorrecto",
314
+ unanswered: "Sin respuesta",
315
+ placeholder: "Escribe tu respuesta...",
316
+ answerInput: "Tu respuesta",
317
+ printCorrectAnswer: "Respuesta correcta:",
318
+ printAnswerBlank: "Espacio para la respuesta"
319
+ },
320
+ vennClassification: {
321
+ tray: "Fichas para clasificar",
322
+ unknownTarget: "desconocido",
323
+ cancelled: "Cancelado",
324
+ returnedToTray: "Se devolvió {{name}} a la bandeja",
325
+ placedIn: "Se colocó {{name}} en {{target}}",
326
+ pickedUp: "Se tomó {{name}}",
327
+ pickedUpWithKeyboard: "Se tomó {{name}}, destino: {{target}}. Usa las flechas para elegir un destino, Enter para soltar y Escape para cancelar.",
328
+ dropTarget: "Destino: {{target}}",
329
+ unsupportedCircles_one: "No se puede mostrar este diagrama: tiene {{count}} círculo, y solo se admiten {{supported}}.",
330
+ unsupportedCircles_other: "No se puede mostrar este diagrama: tiene {{count}} círculos, y solo se admiten {{supported}}.",
331
+ setNumber: "Conjunto {{number}}",
332
+ regionOnly: "Solo {{set}}",
333
+ regionNeither: "Ni {{first}} ni {{second}}",
334
+ regionNoneOf: "Ninguno de {{sets}}",
335
+ regionAndSeparator: " y ",
336
+ tileFallbackName: "Ficha",
337
+ tileNotPlaced: "sin colocar",
338
+ tileInRegion: "en {{region}}",
339
+ tileCorrect: "correcta",
340
+ tileIncorrect: "incorrecta"
341
+ }
342
+ },
343
+ common: {
344
+ undo: "Deshacer",
345
+ clearAll: "Borrar todo",
346
+ correct: "Correcto",
347
+ incorrect: "Incorrecto",
348
+ showCorrectAnswer: "Mostrar respuesta correcta",
349
+ hideCorrectAnswer: "Ocultar respuesta correcta",
350
+ showTeacherInstructions: "Mostrar instrucciones para el maestro",
351
+ hideTeacherInstructions: "Ocultar instrucciones para el maestro",
352
+ commonCorrectAnswerWithAlternates: "Nota: La respuesta que se muestra arriba es la respuesta correcta más común para esta pregunta. También se definen una o más respuestas correctas adicionales, y también se reconocerán como correctas.",
353
+ warning: "Advertencia",
354
+ showNote: "Mostrar Nota",
355
+ hideNote: "Ocultar Nota",
356
+ cancel: "Cancelar"
357
+ }
358
+ }, u = (e) => typeof e == "string", d = () => {
359
+ let e, t, n = new Promise((n, r) => {
360
+ e = n, t = r;
361
+ });
362
+ return n.resolve = e, n.reject = t, n;
363
+ }, f = (e) => e == null ? "" : "" + e, p = (e, t, n) => {
364
+ e.forEach((e) => {
365
+ t[e] && (n[e] = t[e]);
366
+ });
367
+ }, m = /###/g, h = (e) => e && e.indexOf("###") > -1 ? e.replace(m, ".") : e, g = (e) => !e || u(e), _ = (e, t, n) => {
368
+ let r = u(t) ? t.split(".") : t, i = 0;
369
+ for (; i < r.length - 1;) {
370
+ if (g(e)) return {};
371
+ let t = h(r[i]);
372
+ !e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
373
+ }
374
+ return g(e) ? {} : {
375
+ obj: e,
376
+ k: h(r[i])
377
+ };
378
+ }, v = (e, t, n) => {
379
+ let { obj: r, k: i } = _(e, t, Object);
380
+ if (r !== void 0 || t.length === 1) {
381
+ r[i] = n;
382
+ return;
383
+ }
384
+ let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = _(e, o, Object);
385
+ for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = _(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
386
+ s.obj[`${s.k}.${a}`] = n;
387
+ }, y = (e, t, n, r) => {
388
+ let { obj: i, k: a } = _(e, t, Object);
389
+ i[a] = i[a] || [], i[a].push(n);
390
+ }, b = (e, t) => {
391
+ let { obj: n, k: r } = _(e, t);
392
+ if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
393
+ }, x = (e, t, n) => {
394
+ let r = b(e, n);
395
+ return r === void 0 ? b(t, n) : r;
396
+ }, S = (e, t, n) => {
397
+ for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? u(e[r]) || e[r] instanceof String || u(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : S(e[r], t[r], n) : e[r] = t[r]);
398
+ return e;
399
+ }, C = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), w = {
400
+ "&": "&amp;",
401
+ "<": "&lt;",
402
+ ">": "&gt;",
403
+ "\"": "&quot;",
404
+ "'": "&#39;",
405
+ "/": "&#x2F;"
406
+ }, T = (e) => u(e) ? e.replace(/[&<>"'\/]/g, (e) => w[e]) : e, E = class {
407
+ constructor(e) {
408
+ this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
409
+ }
410
+ getRegExp(e) {
411
+ let t = this.regExpMap.get(e);
412
+ if (t !== void 0) return t;
413
+ let n = new RegExp(e);
414
+ return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
415
+ }
416
+ }, D = [
417
+ " ",
418
+ ",",
419
+ "?",
420
+ "!",
421
+ ";"
422
+ ], O = new E(20), k = (e, t, n) => {
423
+ t ||= "", n ||= "";
424
+ let r = D.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
425
+ if (r.length === 0) return !0;
426
+ let i = O.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
427
+ if (!a) {
428
+ let t = e.indexOf(n);
429
+ t > 0 && !i.test(e.substring(0, t)) && (a = !0);
430
+ }
431
+ return a;
432
+ }, A = (e, t, n = ".") => {
433
+ if (!e) return;
434
+ if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
435
+ let r = t.split(n), i = e;
436
+ for (let e = 0; e < r.length;) {
437
+ if (!i || typeof i != "object") return;
438
+ let t, a = "";
439
+ for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
440
+ if ([
441
+ "string",
442
+ "number",
443
+ "boolean"
444
+ ].indexOf(typeof t) > -1 && o < r.length - 1) continue;
445
+ e += o - e + 1;
446
+ break;
447
+ }
448
+ i = t;
449
+ }
450
+ return i;
451
+ }, j = (e) => e?.replace(/_/g, "-"), ee = {
452
+ type: "logger",
453
+ log(e) {
454
+ this.output("log", e);
455
+ },
456
+ warn(e) {
457
+ this.output("warn", e);
458
+ },
459
+ error(e) {
460
+ this.output("error", e);
461
+ },
462
+ output(e, t) {
463
+ console?.[e]?.apply?.(console, t);
464
+ }
465
+ }, M = new class e {
466
+ constructor(e, t = {}) {
467
+ this.init(e, t);
468
+ }
469
+ init(e, t = {}) {
470
+ this.prefix = t.prefix || "i18next:", this.logger = e || ee, this.options = t, this.debug = t.debug;
471
+ }
472
+ log(...e) {
473
+ return this.forward(e, "log", "", !0);
474
+ }
475
+ warn(...e) {
476
+ return this.forward(e, "warn", "", !0);
477
+ }
478
+ error(...e) {
479
+ return this.forward(e, "error", "");
480
+ }
481
+ deprecate(...e) {
482
+ return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
483
+ }
484
+ forward(e, t, n, r) {
485
+ return r && !this.debug ? null : (u(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
486
+ }
487
+ create(t) {
488
+ return new e(this.logger, {
489
+ prefix: `${this.prefix}:${t}:`,
490
+ ...this.options
491
+ });
492
+ }
493
+ clone(t) {
494
+ return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
495
+ }
496
+ }(), N = class {
497
+ constructor() {
498
+ this.observers = {};
499
+ }
500
+ on(e, t) {
501
+ return e.split(" ").forEach((e) => {
502
+ this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
503
+ let n = this.observers[e].get(t) || 0;
504
+ this.observers[e].set(t, n + 1);
505
+ }), this;
506
+ }
507
+ off(e, t) {
508
+ if (this.observers[e]) {
509
+ if (!t) {
510
+ delete this.observers[e];
511
+ return;
512
+ }
513
+ this.observers[e].delete(t);
514
+ }
515
+ }
516
+ emit(e, ...t) {
517
+ this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
518
+ for (let r = 0; r < n; r++) e(...t);
519
+ }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
520
+ for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
521
+ });
522
+ }
523
+ }, P = class extends N {
524
+ constructor(e, t = {
525
+ ns: ["translation"],
526
+ defaultNS: "translation"
527
+ }) {
528
+ super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
529
+ }
530
+ addNamespaces(e) {
531
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
532
+ }
533
+ removeNamespaces(e) {
534
+ let t = this.options.ns.indexOf(e);
535
+ t > -1 && this.options.ns.splice(t, 1);
536
+ }
537
+ getResource(e, t, n, r = {}) {
538
+ let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
539
+ e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : u(n) && i ? o.push(...n.split(i)) : o.push(n)));
540
+ let s = b(this.data, o);
541
+ return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !u(n) ? s : A(this.data?.[e]?.[t], n, i);
542
+ }
543
+ addResource(e, t, n, r, i = { silent: !1 }) {
544
+ let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
545
+ n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), v(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
546
+ }
547
+ addResources(e, t, n, r = { silent: !1 }) {
548
+ for (let r in n) (u(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
549
+ r.silent || this.emit("added", e, t, n);
550
+ }
551
+ addResourceBundle(e, t, n, r, i, a = {
552
+ silent: !1,
553
+ skipCopy: !1
554
+ }) {
555
+ let o = [e, t];
556
+ e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
557
+ let s = b(this.data, o) || {};
558
+ a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? S(s, n, i) : s = {
559
+ ...s,
560
+ ...n
561
+ }, v(this.data, o, s), a.silent || this.emit("added", e, t, n);
562
+ }
563
+ removeResourceBundle(e, t) {
564
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
565
+ }
566
+ hasResourceBundle(e, t) {
567
+ return this.getResource(e, t) !== void 0;
568
+ }
569
+ getResourceBundle(e, t) {
570
+ return t ||= this.options.defaultNS, this.getResource(e, t);
571
+ }
572
+ getDataByLanguage(e) {
573
+ return this.data[e];
574
+ }
575
+ hasLanguageSomeTranslations(e) {
576
+ let t = this.getDataByLanguage(e);
577
+ return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
578
+ }
579
+ toJSON() {
580
+ return this.data;
581
+ }
582
+ }, F = {
583
+ processors: {},
584
+ addPostProcessor(e) {
585
+ this.processors[e.name] = e;
586
+ },
587
+ handle(e, t, n, r, i) {
588
+ return e.forEach((e) => {
589
+ t = this.processors[e]?.process(t, n, r, i) ?? t;
590
+ }), t;
591
+ }
592
+ }, I = Symbol("i18next/PATH_KEY");
593
+ function te() {
594
+ let e = [], t = Object.create(null), n;
595
+ return t.get = (r, i) => (n?.revoke?.(), i === I ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
596
+ }
597
+ function L(e, t) {
598
+ let { [I]: n } = e(te()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
599
+ if (n.length > 1 && i) {
600
+ let e = t?.ns, a = Array.isArray(e) ? e : null;
601
+ if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
602
+ }
603
+ return n.join(r);
604
+ }
605
+ var R = {}, z = (e) => !u(e) && typeof e != "boolean" && typeof e != "number", B = class e extends N {
606
+ constructor(e, t = {}) {
607
+ super(), p([
608
+ "resourceStore",
609
+ "languageUtils",
610
+ "pluralResolver",
611
+ "interpolator",
612
+ "backendConnector",
613
+ "i18nFormat",
614
+ "utils"
615
+ ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = M.create("translator");
616
+ }
617
+ changeLanguage(e) {
618
+ e && (this.language = e);
619
+ }
620
+ exists(e, t = { interpolation: {} }) {
621
+ let n = { ...t };
622
+ if (e == null) return !1;
623
+ let r = this.resolve(e, n);
624
+ if (r?.res === void 0) return !1;
625
+ let i = z(r.res);
626
+ return !(n.returnObjects === !1 && i);
627
+ }
628
+ extractFromKey(e, t) {
629
+ let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
630
+ n === void 0 && (n = ":");
631
+ let r = t.keySeparator === void 0 ? this.options.keySeparator : t.keySeparator, i = t.ns || this.options.defaultNS || [], a = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !t.keySeparator && !this.options.userDefinedNsSeparator && !t.nsSeparator && !k(e, n, r);
632
+ if (a && !o) {
633
+ let t = e.match(this.interpolator.nestingRegexp);
634
+ if (t && t.length > 0) return {
635
+ key: e,
636
+ namespaces: u(i) ? [i] : i
637
+ };
638
+ let a = e.split(n);
639
+ (n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
640
+ }
641
+ return {
642
+ key: e,
643
+ namespaces: u(i) ? [i] : i
644
+ };
645
+ }
646
+ translate(t, n, r) {
647
+ let i = typeof n == "object" ? { ...n } : n;
648
+ if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
649
+ typeof t == "function" && (t = L(t, {
650
+ ...this.options,
651
+ ...i
652
+ })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? L(e, {
653
+ ...this.options,
654
+ ...i
655
+ }) : String(e));
656
+ let a = i.returnDetails === void 0 ? this.options.returnDetails : i.returnDetails, o = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, { key: s, namespaces: c } = this.extractFromKey(t[t.length - 1], i), l = c[c.length - 1], d = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
657
+ d === void 0 && (d = ":");
658
+ let f = i.lng || this.language, p = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
659
+ if (f?.toLowerCase() === "cimode") return p ? a ? {
660
+ res: `${l}${d}${s}`,
661
+ usedKey: s,
662
+ exactUsedKey: s,
663
+ usedLng: f,
664
+ usedNS: l,
665
+ usedParams: this.getUsedParamsDetails(i)
666
+ } : `${l}${d}${s}` : a ? {
667
+ res: s,
668
+ usedKey: s,
669
+ exactUsedKey: s,
670
+ usedLng: f,
671
+ usedNS: l,
672
+ usedParams: this.getUsedParamsDetails(i)
673
+ } : s;
674
+ let m = this.resolve(t, i), h = m?.res, g = m?.usedKey || s, _ = m?.exactUsedKey || s, v = [
675
+ "[object Number]",
676
+ "[object Function]",
677
+ "[object RegExp]"
678
+ ], y = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, b = !this.i18nFormat || this.i18nFormat.handleAsObject, x = i.count !== void 0 && !u(i.count), S = e.hasDefaultValue(i), C = x ? this.pluralResolver.getSuffix(f, i.count, i) : "", w = i.ordinal && x ? this.pluralResolver.getSuffix(f, i.count, { ordinal: !1 }) : "", T = x && !i.ordinal && i.count === 0, E = T && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${C}`] || i[`defaultValue${w}`] || i.defaultValue, D = h;
679
+ b && !h && S && (D = E);
680
+ let O = z(D), k = Object.prototype.toString.apply(D);
681
+ if (b && D && O && v.indexOf(k) < 0 && !(u(y) && Array.isArray(D))) {
682
+ if (!i.returnObjects && !this.options.returnObjects) {
683
+ this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
684
+ let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(g, D, {
685
+ ...i,
686
+ ns: c
687
+ }) : `key '${s} (${this.language})' returned an object instead of string.`;
688
+ return a ? (m.res = e, m.usedParams = this.getUsedParamsDetails(i), m) : e;
689
+ }
690
+ if (o) {
691
+ let e = Array.isArray(D), t = e ? [] : {}, n = e ? _ : g;
692
+ for (let e in D) if (Object.prototype.hasOwnProperty.call(D, e)) {
693
+ let r = `${n}${o}${e}`;
694
+ S && !h ? t[e] = this.translate(r, {
695
+ ...i,
696
+ defaultValue: z(E) ? E[e] : void 0,
697
+ joinArrays: !1,
698
+ ns: c
699
+ }) : t[e] = this.translate(r, {
700
+ ...i,
701
+ joinArrays: !1,
702
+ ns: c
703
+ }), t[e] === r && (t[e] = D[e]);
704
+ }
705
+ h = t;
706
+ }
707
+ } else if (b && u(y) && Array.isArray(h)) h = h.join(y), h &&= this.extendTranslation(h, t, i, r);
708
+ else {
709
+ let e = !1, n = !1;
710
+ !this.isValidLookup(h) && S && (e = !0, h = E), this.isValidLookup(h) || (n = !0, h = s);
711
+ let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : h, c = S && E !== h && this.options.updateMissing;
712
+ if (n || e || c) {
713
+ if (this.logger.log(c ? "updateKey" : "missingKey", f, l, s, c ? E : h), o) {
714
+ let e = this.resolve(s, {
715
+ ...i,
716
+ keySeparator: !1
717
+ });
718
+ e && e.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
719
+ }
720
+ let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
721
+ if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
722
+ else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
723
+ let n = (e, t, n) => {
724
+ let r = S && n !== h ? n : a;
725
+ this.options.missingKeyHandler ? this.options.missingKeyHandler(e, l, t, r, c, i) : this.backendConnector?.saveMissing && this.backendConnector.saveMissing(e, l, t, r, c, i), this.emit("missingKey", e, l, t, h);
726
+ };
727
+ this.options.saveMissing && (this.options.saveMissingPlurals && x ? e.forEach((e) => {
728
+ let t = this.pluralResolver.getSuffixes(e, i);
729
+ T && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
730
+ n([e], s + t, i[`defaultValue${t}`] || E);
731
+ });
732
+ }) : n(e, s, E));
733
+ }
734
+ h = this.extendTranslation(h, t, i, m, r), n && h === s && this.options.appendNamespaceToMissingKey && (h = `${l}${d}${s}`), (n || e) && this.options.parseMissingKeyHandler && (h = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${d}${s}` : s, e ? h : void 0, i));
735
+ }
736
+ return a ? (m.res = h, m.usedParams = this.getUsedParamsDetails(i), m) : h;
737
+ }
738
+ extendTranslation(e, t, n, r, i) {
739
+ if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
740
+ ...this.options.interpolation.defaultVariables,
741
+ ...n
742
+ }, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
743
+ else if (!n.skipInterpolation) {
744
+ n.interpolation && this.interpolator.init({
745
+ ...n,
746
+ interpolation: {
747
+ ...this.options.interpolation,
748
+ ...n.interpolation
749
+ }
750
+ });
751
+ let a = u(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
752
+ if (a) {
753
+ let t = e.match(this.interpolator.nestingRegexp);
754
+ o = t && t.length;
755
+ }
756
+ let s = n.replace && !u(n.replace) ? n.replace : n;
757
+ if (this.options.interpolation.defaultVariables && (s = {
758
+ ...this.options.interpolation.defaultVariables,
759
+ ...s
760
+ }), e = this.interpolator.interpolate(e, s, n.lng || this.language || r.usedLng, n), a) {
761
+ let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
762
+ o < r && (n.nest = !1);
763
+ }
764
+ !n.lng && r && r.res && (n.lng = this.language || r.usedLng), n.nest !== !1 && (e = this.interpolator.nest(e, (...e) => i?.[0] === e[0] && !n.context ? (this.logger.warn(`It seems you are nesting recursively key: ${e[0]} in key: ${t[0]}`), null) : this.translate(...e, t), n)), n.interpolation && this.interpolator.reset();
765
+ }
766
+ let a = n.postProcess || this.options.postProcess, o = u(a) ? [a] : a;
767
+ return e != null && o?.length && n.applyPostProcessor !== !1 && (e = F.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
768
+ i18nResolved: {
769
+ ...r,
770
+ usedParams: this.getUsedParamsDetails(n)
771
+ },
772
+ ...n
773
+ } : n, this)), e;
774
+ }
775
+ resolve(e, t = {}) {
776
+ let n, r, i, a, o;
777
+ return u(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? L(e, {
778
+ ...this.options,
779
+ ...t
780
+ }) : e)), e.forEach((e) => {
781
+ if (this.isValidLookup(n)) return;
782
+ let s = this.extractFromKey(e, t), c = s.key;
783
+ r = c;
784
+ let l = s.namespaces;
785
+ this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
786
+ let d = t.count !== void 0 && !u(t.count), f = d && !t.ordinal && t.count === 0, p = t.context !== void 0 && (u(t.context) || typeof t.context == "number") && t.context !== "", m = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
787
+ l.forEach((e) => {
788
+ this.isValidLookup(n) || (o = e, !R[`${m[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (R[`${m[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${m.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), m.forEach((r) => {
789
+ if (this.isValidLookup(n)) return;
790
+ a = r;
791
+ let o = [c];
792
+ if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
793
+ else {
794
+ let e;
795
+ d && (e = this.pluralResolver.getSuffix(r, t.count, t));
796
+ let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
797
+ if (d && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), f && o.push(c + n)), p) {
798
+ let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
799
+ o.push(r), d && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), f && o.push(r + n));
800
+ }
801
+ }
802
+ let s;
803
+ for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
804
+ }));
805
+ });
806
+ }), {
807
+ res: n,
808
+ usedKey: r,
809
+ exactUsedKey: i,
810
+ usedLng: a,
811
+ usedNS: o
812
+ };
813
+ }
814
+ isValidLookup(e) {
815
+ return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
816
+ }
817
+ getResource(e, t, n, r = {}) {
818
+ return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
819
+ }
820
+ getUsedParamsDetails(e = {}) {
821
+ let t = [
822
+ "defaultValue",
823
+ "ordinal",
824
+ "context",
825
+ "replace",
826
+ "lng",
827
+ "lngs",
828
+ "fallbackLng",
829
+ "ns",
830
+ "keySeparator",
831
+ "nsSeparator",
832
+ "returnObjects",
833
+ "returnDetails",
834
+ "joinArrays",
835
+ "postProcess",
836
+ "interpolation"
837
+ ], n = e.replace && !u(e.replace), r = n ? e.replace : e;
838
+ if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
839
+ ...this.options.interpolation.defaultVariables,
840
+ ...r
841
+ }), !n) {
842
+ r = { ...r };
843
+ for (let e of t) delete r[e];
844
+ }
845
+ return r;
846
+ }
847
+ static hasDefaultValue(e) {
848
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
849
+ return !1;
850
+ }
851
+ }, V = class {
852
+ constructor(e) {
853
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = M.create("languageUtils");
854
+ }
855
+ getScriptPartFromCode(e) {
856
+ if (e = j(e), !e || e.indexOf("-") < 0) return null;
857
+ let t = e.split("-");
858
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
859
+ }
860
+ getLanguagePartFromCode(e) {
861
+ if (e = j(e), !e || e.indexOf("-") < 0) return e;
862
+ let t = e.split("-");
863
+ return this.formatLanguageCode(t[0]);
864
+ }
865
+ formatLanguageCode(e) {
866
+ if (u(e) && e.indexOf("-") > -1) {
867
+ let t;
868
+ try {
869
+ t = Intl.getCanonicalLocales(e)[0];
870
+ } catch {}
871
+ return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
872
+ }
873
+ return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
874
+ }
875
+ isSupportedCode(e) {
876
+ return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
877
+ }
878
+ getBestMatchFromCodes(e) {
879
+ if (!e) return null;
880
+ let t;
881
+ return e.forEach((e) => {
882
+ if (t) return;
883
+ let n = this.formatLanguageCode(e);
884
+ (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
885
+ }), !t && this.options.supportedLngs && e.forEach((e) => {
886
+ if (t) return;
887
+ let n = this.getScriptPartFromCode(e);
888
+ if (this.isSupportedCode(n)) return t = n;
889
+ let r = this.getLanguagePartFromCode(e);
890
+ if (this.isSupportedCode(r)) return t = r;
891
+ t = this.options.supportedLngs.find((e) => {
892
+ if (e === r || !(e.indexOf("-") < 0 && r.indexOf("-") < 0) && (e.indexOf("-") > 0 && r.indexOf("-") < 0 && e.substring(0, e.indexOf("-")) === r || e.indexOf(r) === 0 && r.length > 1)) return e;
893
+ });
894
+ }), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
895
+ }
896
+ getFallbackCodes(e, t) {
897
+ if (!e) return [];
898
+ if (typeof e == "function" && (e = e(t)), u(e) && (e = [e]), Array.isArray(e)) return e;
899
+ if (!t) return e.default || [];
900
+ let n = e[t];
901
+ return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
902
+ }
903
+ toResolveHierarchy(e, t) {
904
+ let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
905
+ e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
906
+ };
907
+ return u(e) && (e.indexOf("-") > -1 || e.indexOf("_") > -1) ? (this.options.load !== "languageOnly" && i(this.formatLanguageCode(e)), this.options.load !== "languageOnly" && this.options.load !== "currentOnly" && i(this.getScriptPartFromCode(e)), this.options.load !== "currentOnly" && i(this.getLanguagePartFromCode(e))) : u(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
908
+ r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
909
+ }), r;
910
+ }
911
+ }, H = {
912
+ zero: 0,
913
+ one: 1,
914
+ two: 2,
915
+ few: 3,
916
+ many: 4,
917
+ other: 5
918
+ }, U = {
919
+ select: (e) => e === 1 ? "one" : "other",
920
+ resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
921
+ }, ne = class {
922
+ constructor(e, t = {}) {
923
+ this.languageUtils = e, this.options = t, this.logger = M.create("pluralResolver"), this.pluralRulesCache = {};
924
+ }
925
+ clearCache() {
926
+ this.pluralRulesCache = {};
927
+ }
928
+ getRule(e, t = {}) {
929
+ let n = j(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
930
+ cleanedCode: n,
931
+ type: r
932
+ });
933
+ if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
934
+ let a;
935
+ try {
936
+ a = new Intl.PluralRules(n, { type: r });
937
+ } catch {
938
+ if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), U;
939
+ if (!e.match(/-|_/)) return U;
940
+ let n = this.languageUtils.getLanguagePartFromCode(e);
941
+ a = this.getRule(n, t);
942
+ }
943
+ return this.pluralRulesCache[i] = a, a;
944
+ }
945
+ needsPlural(e, t = {}) {
946
+ let n = this.getRule(e, t);
947
+ return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
948
+ }
949
+ getPluralFormsOfKey(e, t, n = {}) {
950
+ return this.getSuffixes(e, n).map((e) => `${t}${e}`);
951
+ }
952
+ getSuffixes(e, t = {}) {
953
+ let n = this.getRule(e, t);
954
+ return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => H[e] - H[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
955
+ }
956
+ getSuffix(e, t, n = {}) {
957
+ let r = this.getRule(e, n);
958
+ return r ? `${this.options.prepend}${n.ordinal ? `ordinal${this.options.prepend}` : ""}${r.select(t)}` : (this.logger.warn(`no plural rule found for: ${e}`), this.getSuffix("dev", t, n));
959
+ }
960
+ }, W = (e, t, n, r = ".", i = !0) => {
961
+ let a = x(e, t, n);
962
+ return !a && i && u(n) && (a = A(e, n, r), a === void 0 && (a = A(t, n, r))), a;
963
+ }, G = (e) => e.replace(/\$/g, "$$$$"), K = class {
964
+ constructor(e = {}) {
965
+ this.logger = M.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
966
+ }
967
+ init(e = {}) {
968
+ e.interpolation ||= { escapeValue: !0 };
969
+ let { escape: t, escapeValue: n, useRawValueToEscape: r, prefix: i, prefixEscaped: a, suffix: o, suffixEscaped: s, formatSeparator: c, unescapeSuffix: l, unescapePrefix: u, nestingPrefix: d, nestingPrefixEscaped: f, nestingSuffix: p, nestingSuffixEscaped: m, nestingOptionsSeparator: h, maxReplaces: g, alwaysFormat: _ } = e.interpolation;
970
+ this.escape = t === void 0 ? T : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? C(i) : a || "{{", this.suffix = o ? C(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? C(d) : f || C("$t("), this.nestingSuffix = p ? C(p) : m || C(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
971
+ }
972
+ reset() {
973
+ this.options && this.init(this.options);
974
+ }
975
+ resetRegExp() {
976
+ let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
977
+ this.regexp = e(this.regexp, `${this.prefix}(.+?)${this.suffix}`), this.regexpUnescape = e(this.regexpUnescape, `${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`), this.nestingRegexp = e(this.nestingRegexp, `${this.nestingPrefix}((?:[^()"']+|"[^"]*"|'[^']*'|\\((?:[^()]|"[^"]*"|'[^']*')*\\))*?)${this.nestingSuffix}`);
978
+ }
979
+ interpolate(e, t, n, r) {
980
+ let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
981
+ if (e.indexOf(this.formatSeparator) < 0) {
982
+ let i = W(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
983
+ return this.alwaysFormat ? this.format(i, void 0, n, {
984
+ ...r,
985
+ ...t,
986
+ interpolationkey: e
987
+ }) : i;
988
+ }
989
+ let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
990
+ return this.format(W(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
991
+ ...r,
992
+ ...t,
993
+ interpolationkey: a
994
+ });
995
+ };
996
+ this.resetRegExp();
997
+ let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, d = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
998
+ return [{
999
+ regex: this.regexpUnescape,
1000
+ safeValue: (e) => G(e)
1001
+ }, {
1002
+ regex: this.regexp,
1003
+ safeValue: (e) => this.escapeValue ? G(this.escape(e)) : G(e)
1004
+ }].forEach((t) => {
1005
+ for (o = 0; i = t.regex.exec(e);) {
1006
+ let n = i[1].trim();
1007
+ if (a = c(n), a === void 0) if (typeof l == "function") {
1008
+ let t = l(e, i, r);
1009
+ a = u(t) ? t : "";
1010
+ } else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
1011
+ else if (d) {
1012
+ a = i[0];
1013
+ continue;
1014
+ } else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
1015
+ else !u(a) && !this.useRawValueToEscape && (a = f(a));
1016
+ let s = t.safeValue(a);
1017
+ if (e = e.replace(i[0], s), d ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
1018
+ }
1019
+ }), e;
1020
+ }
1021
+ nest(e, t, n = {}) {
1022
+ let r, i, a, o = (e, t) => {
1023
+ let n = this.nestingOptionsSeparator;
1024
+ if (e.indexOf(n) < 0) return e;
1025
+ let r = e.split(RegExp(`${C(n)}[ ]*{`)), i = `{${r[1]}`;
1026
+ e = r[0], i = this.interpolate(i, a);
1027
+ let o = i.match(/'/g), s = i.match(/"/g);
1028
+ ((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
1029
+ try {
1030
+ a = JSON.parse(i), t && (a = {
1031
+ ...t,
1032
+ ...a
1033
+ });
1034
+ } catch (t) {
1035
+ return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
1036
+ }
1037
+ return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
1038
+ };
1039
+ for (; r = this.nestingRegexp.exec(e);) {
1040
+ let s = [];
1041
+ a = { ...n }, a = a.replace && !u(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
1042
+ let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
1043
+ if (c !== -1 && (s = r[1].slice(c).split(this.formatSeparator).map((e) => e.trim()).filter(Boolean), r[1] = r[1].slice(0, c)), i = t(o.call(this, r[1].trim(), a), a), i && r[0] === e && !u(i)) return i;
1044
+ u(i) || (i = f(i)), i ||= (this.logger.warn(`missed to resolve ${r[1]} for nesting ${e}`), ""), s.length && (i = s.reduce((e, t) => this.format(e, t, n.lng, {
1045
+ ...n,
1046
+ interpolationkey: r[1].trim()
1047
+ }), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
1048
+ }
1049
+ return e;
1050
+ }
1051
+ }, re = (e) => {
1052
+ let t = e.toLowerCase().trim(), n = {};
1053
+ if (e.indexOf("(") > -1) {
1054
+ let r = e.split("(");
1055
+ t = r[0].toLowerCase().trim();
1056
+ let i = r[1].substring(0, r[1].length - 1);
1057
+ t === "currency" && i.indexOf(":") < 0 ? n.currency ||= i.trim() : t === "relativetime" && i.indexOf(":") < 0 ? n.range ||= i.trim() : i.split(";").forEach((e) => {
1058
+ if (e) {
1059
+ let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
1060
+ n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
1061
+ }
1062
+ });
1063
+ }
1064
+ return {
1065
+ formatName: t,
1066
+ formatOptions: n
1067
+ };
1068
+ }, q = (e) => {
1069
+ let t = {};
1070
+ return (n, r, i) => {
1071
+ let a = i;
1072
+ i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
1073
+ ...a,
1074
+ [i.interpolationkey]: void 0
1075
+ });
1076
+ let o = r + JSON.stringify(a), s = t[o];
1077
+ return s || (s = e(j(r), i), t[o] = s), s(n);
1078
+ };
1079
+ }, ie = (e) => (t, n, r) => e(j(n), r)(t), ae = class {
1080
+ constructor(e = {}) {
1081
+ this.logger = M.create("formatter"), this.options = e, this.init(e);
1082
+ }
1083
+ init(e, t = { interpolation: {} }) {
1084
+ this.formatSeparator = t.interpolation.formatSeparator || ",";
1085
+ let n = t.cacheInBuiltFormats ? q : ie;
1086
+ this.formats = {
1087
+ number: n((e, t) => {
1088
+ let n = new Intl.NumberFormat(e, { ...t });
1089
+ return (e) => n.format(e);
1090
+ }),
1091
+ currency: n((e, t) => {
1092
+ let n = new Intl.NumberFormat(e, {
1093
+ ...t,
1094
+ style: "currency"
1095
+ });
1096
+ return (e) => n.format(e);
1097
+ }),
1098
+ datetime: n((e, t) => {
1099
+ let n = new Intl.DateTimeFormat(e, { ...t });
1100
+ return (e) => n.format(e);
1101
+ }),
1102
+ relativetime: n((e, t) => {
1103
+ let n = new Intl.RelativeTimeFormat(e, { ...t });
1104
+ return (e) => n.format(e, t.range || "day");
1105
+ }),
1106
+ list: n((e, t) => {
1107
+ let n = new Intl.ListFormat(e, { ...t });
1108
+ return (e) => n.format(e);
1109
+ })
1110
+ };
1111
+ }
1112
+ add(e, t) {
1113
+ this.formats[e.toLowerCase().trim()] = t;
1114
+ }
1115
+ addCached(e, t) {
1116
+ this.formats[e.toLowerCase().trim()] = q(t);
1117
+ }
1118
+ format(e, t, n, r = {}) {
1119
+ let i = t.split(this.formatSeparator);
1120
+ if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((e) => e.indexOf(")") > -1)) {
1121
+ let e = i.findIndex((e) => e.indexOf(")") > -1);
1122
+ i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
1123
+ }
1124
+ return i.reduce((e, t) => {
1125
+ let { formatName: i, formatOptions: a } = re(t);
1126
+ if (this.formats[i]) {
1127
+ let t = e;
1128
+ try {
1129
+ let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
1130
+ t = this.formats[i](e, s, {
1131
+ ...a,
1132
+ ...r,
1133
+ ...o
1134
+ });
1135
+ } catch (e) {
1136
+ this.logger.warn(e);
1137
+ }
1138
+ return t;
1139
+ } else this.logger.warn(`there was no format function for ${i}`);
1140
+ return e;
1141
+ }, e);
1142
+ }
1143
+ }, oe = (e, t) => {
1144
+ e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
1145
+ }, se = class extends N {
1146
+ constructor(e, t, n, r = {}) {
1147
+ super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = M.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = r.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = r.maxRetries >= 0 ? r.maxRetries : 5, this.retryTimeout = r.retryTimeout >= 1 ? r.retryTimeout : 350, this.state = {}, this.queue = [], this.backend?.init?.(n, r.backend, r);
1148
+ }
1149
+ queueLoad(e, t, n, r) {
1150
+ let i = {}, a = {}, o = {}, s = {};
1151
+ return e.forEach((e) => {
1152
+ let r = !0;
1153
+ t.forEach((t) => {
1154
+ let o = `${e}|${t}`;
1155
+ !n.reload && this.store.hasResourceBundle(e, t) ? this.state[o] = 2 : this.state[o] < 0 || (this.state[o] === 1 ? a[o] === void 0 && (a[o] = !0) : (this.state[o] = 1, r = !1, a[o] === void 0 && (a[o] = !0), i[o] === void 0 && (i[o] = !0), s[t] === void 0 && (s[t] = !0)));
1156
+ }), r || (o[e] = !0);
1157
+ }), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
1158
+ pending: a,
1159
+ pendingCount: Object.keys(a).length,
1160
+ loaded: {},
1161
+ errors: [],
1162
+ callback: r
1163
+ }), {
1164
+ toLoad: Object.keys(i),
1165
+ pending: Object.keys(a),
1166
+ toLoadLanguages: Object.keys(o),
1167
+ toLoadNamespaces: Object.keys(s)
1168
+ };
1169
+ }
1170
+ loaded(e, t, n) {
1171
+ let r = e.split("|"), i = r[0], a = r[1];
1172
+ t && this.emit("failedLoading", i, a, t), !t && n && this.store.addResourceBundle(i, a, n, void 0, void 0, { skipCopy: !0 }), this.state[e] = t ? -1 : 2, t && n && (this.state[e] = 0);
1173
+ let o = {};
1174
+ this.queue.forEach((n) => {
1175
+ y(n.loaded, [i], a), oe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
1176
+ o[e] || (o[e] = {});
1177
+ let t = n.loaded[e];
1178
+ t.length && t.forEach((t) => {
1179
+ o[e][t] === void 0 && (o[e][t] = !0);
1180
+ });
1181
+ }), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
1182
+ }), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
1183
+ }
1184
+ read(e, t, n, r = 0, i = this.retryTimeout, a) {
1185
+ if (!e.length) return a(null, {});
1186
+ if (this.readingCalls >= this.maxParallelReads) {
1187
+ this.waitingReads.push({
1188
+ lng: e,
1189
+ ns: t,
1190
+ fcName: n,
1191
+ tried: r,
1192
+ wait: i,
1193
+ callback: a
1194
+ });
1195
+ return;
1196
+ }
1197
+ this.readingCalls++;
1198
+ let o = (o, s) => {
1199
+ if (this.readingCalls--, this.waitingReads.length > 0) {
1200
+ let e = this.waitingReads.shift();
1201
+ this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
1202
+ }
1203
+ if (o && s && r < this.maxRetries) {
1204
+ setTimeout(() => {
1205
+ this.read.call(this, e, t, n, r + 1, i * 2, a);
1206
+ }, i);
1207
+ return;
1208
+ }
1209
+ a(o, s);
1210
+ }, s = this.backend[n].bind(this.backend);
1211
+ if (s.length === 2) {
1212
+ try {
1213
+ let n = s(e, t);
1214
+ n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
1215
+ } catch (e) {
1216
+ o(e);
1217
+ }
1218
+ return;
1219
+ }
1220
+ return s(e, t, o);
1221
+ }
1222
+ prepareLoading(e, t, n = {}, r) {
1223
+ if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
1224
+ u(e) && (e = this.languageUtils.toResolveHierarchy(e)), u(t) && (t = [t]);
1225
+ let i = this.queueLoad(e, t, n, r);
1226
+ if (!i.toLoad.length) return i.pending.length || r(), null;
1227
+ i.toLoad.forEach((e) => {
1228
+ this.loadOne(e);
1229
+ });
1230
+ }
1231
+ load(e, t, n) {
1232
+ this.prepareLoading(e, t, {}, n);
1233
+ }
1234
+ reload(e, t, n) {
1235
+ this.prepareLoading(e, t, { reload: !0 }, n);
1236
+ }
1237
+ loadOne(e, t = "") {
1238
+ let n = e.split("|"), r = n[0], i = n[1];
1239
+ this.read(r, i, "read", void 0, void 0, (n, a) => {
1240
+ n && this.logger.warn(`${t}loading namespace ${i} for language ${r} failed`, n), !n && a && this.logger.log(`${t}loaded namespace ${i} for language ${r}`, a), this.loaded(e, n, a);
1241
+ });
1242
+ }
1243
+ saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
1244
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
1245
+ this.logger.warn(`did not save key "${n}" as the namespace "${t}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");
1246
+ return;
1247
+ }
1248
+ if (!(n == null || n === "")) {
1249
+ if (this.backend?.create) {
1250
+ let s = {
1251
+ ...a,
1252
+ isUpdate: i
1253
+ }, c = this.backend.create.bind(this.backend);
1254
+ if (c.length < 6) try {
1255
+ let i;
1256
+ i = c.length === 5 ? c(e, t, n, r, s) : c(e, t, n, r), i && typeof i.then == "function" ? i.then((e) => o(null, e)).catch(o) : o(null, i);
1257
+ } catch (e) {
1258
+ o(e);
1259
+ }
1260
+ else c(e, t, n, r, o, s);
1261
+ }
1262
+ !e || !e[0] || this.store.addResource(e[0], t, n, r);
1263
+ }
1264
+ }
1265
+ }, J = () => ({
1266
+ debug: !1,
1267
+ initAsync: !0,
1268
+ ns: ["translation"],
1269
+ defaultNS: ["translation"],
1270
+ fallbackLng: ["dev"],
1271
+ fallbackNS: !1,
1272
+ supportedLngs: !1,
1273
+ nonExplicitSupportedLngs: !1,
1274
+ load: "all",
1275
+ preload: !1,
1276
+ simplifyPluralSuffix: !0,
1277
+ keySeparator: ".",
1278
+ nsSeparator: ":",
1279
+ pluralSeparator: "_",
1280
+ contextSeparator: "_",
1281
+ partialBundledLanguages: !1,
1282
+ saveMissing: !1,
1283
+ updateMissing: !1,
1284
+ saveMissingTo: "fallback",
1285
+ saveMissingPlurals: !0,
1286
+ missingKeyHandler: !1,
1287
+ missingInterpolationHandler: !1,
1288
+ postProcess: !1,
1289
+ postProcessPassResolved: !1,
1290
+ returnNull: !1,
1291
+ returnEmptyString: !0,
1292
+ returnObjects: !1,
1293
+ joinArrays: !1,
1294
+ returnedObjectHandler: !1,
1295
+ parseMissingKeyHandler: !1,
1296
+ appendNamespaceToMissingKey: !1,
1297
+ appendNamespaceToCIMode: !1,
1298
+ overloadTranslationOptionHandler: (e) => {
1299
+ let t = {};
1300
+ if (typeof e[1] == "object" && (t = e[1]), u(e[1]) && (t.defaultValue = e[1]), u(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1301
+ let n = e[3] || e[2];
1302
+ Object.keys(n).forEach((e) => {
1303
+ t[e] = n[e];
1304
+ });
1305
+ }
1306
+ return t;
1307
+ },
1308
+ interpolation: {
1309
+ escapeValue: !0,
1310
+ format: (e) => e,
1311
+ prefix: "{{",
1312
+ suffix: "}}",
1313
+ formatSeparator: ",",
1314
+ unescapePrefix: "-",
1315
+ nestingPrefix: "$t(",
1316
+ nestingSuffix: ")",
1317
+ nestingOptionsSeparator: ",",
1318
+ maxReplaces: 1e3,
1319
+ skipOnVariables: !0
1320
+ },
1321
+ cacheInBuiltFormats: !0
1322
+ }), Y = (e) => (u(e.ns) && (e.ns = [e.ns]), u(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), u(e.fallbackNS) && (e.fallbackNS = [e.fallbackNS]), e.supportedLngs?.indexOf?.("cimode") < 0 && (e.supportedLngs = e.supportedLngs.concat(["cimode"])), typeof e.initImmediate == "boolean" && (e.initAsync = e.initImmediate), e), X = () => {}, ce = (e) => {
1323
+ Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
1324
+ typeof e[t] == "function" && (e[t] = e[t].bind(e));
1325
+ });
1326
+ }, Z = "__i18next_supportNoticeShown", le = () => !!(typeof globalThis < "u" && globalThis[Z] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), ue = () => {
1327
+ typeof globalThis < "u" && (globalThis[Z] = !0);
1328
+ }, de = (e) => !!(e?.modules?.backend?.name?.indexOf("Locize") > 0 || e?.modules?.backend?.constructor?.name?.indexOf("Locize") > 0 || e?.options?.backend?.backends && e.options.backend.backends.some((e) => e?.name?.indexOf("Locize") > 0 || e?.constructor?.name?.indexOf("Locize") > 0) || e?.options?.backend?.projectId || e?.options?.backend?.backendOptions && e.options.backend.backendOptions.some((e) => e?.projectId)), Q = class e extends N {
1329
+ constructor(e = {}, t) {
1330
+ if (super(), this.options = Y(e), this.services = {}, this.logger = M, this.modules = { external: [] }, ce(this), t && !this.isInitialized && !e.isClone) {
1331
+ if (!this.options.initAsync) return this.init(e, t), this;
1332
+ setTimeout(() => {
1333
+ this.init(e, t);
1334
+ }, 0);
1335
+ }
1336
+ }
1337
+ init(e = {}, t) {
1338
+ this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (u(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1339
+ let n = J();
1340
+ this.options = {
1341
+ ...n,
1342
+ ...this.options,
1343
+ ...Y(e)
1344
+ }, this.options.interpolation = {
1345
+ ...n.interpolation,
1346
+ ...this.options.interpolation
1347
+ }, e.keySeparator !== void 0 && (this.options.userDefinedKeySeparator = e.keySeparator), e.nsSeparator !== void 0 && (this.options.userDefinedNsSeparator = e.nsSeparator), typeof this.options.overloadTranslationOptionHandler != "function" && (this.options.overloadTranslationOptionHandler = n.overloadTranslationOptionHandler), this.options.showSupportNotice !== !1 && !de(this) && !le() && (typeof console < "u" && console.info !== void 0 && console.info("🌐 i18next is made possible by our own product, Locize — consider powering your project with managed localization (AI, CDN, integrations): https://locize.com 💙"), ue());
1348
+ let r = (e) => e ? typeof e == "function" ? new e() : e : null;
1349
+ if (!this.options.isClone) {
1350
+ this.modules.logger ? M.init(r(this.modules.logger), this.options) : M.init(null, this.options);
1351
+ let e;
1352
+ e = this.modules.formatter ? this.modules.formatter : ae;
1353
+ let t = new V(this.options);
1354
+ this.store = new P(this.options.resources, this.options);
1355
+ let i = this.services;
1356
+ i.logger = M, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new ne(t, {
1357
+ prepend: this.options.pluralSeparator,
1358
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1359
+ }), this.options.interpolation.format && this.options.interpolation.format !== n.interpolation.format && this.logger.deprecate("init: you are still using the legacy format function, please use the new approach: https://www.i18next.com/translation-function/formatting"), e && (!this.options.interpolation.format || this.options.interpolation.format === n.interpolation.format) && (i.formatter = r(e), i.formatter.init && i.formatter.init(i, this.options), this.options.interpolation.format = i.formatter.format.bind(i.formatter)), i.interpolator = new K(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new se(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
1360
+ this.emit(e, ...t);
1361
+ }), this.modules.languageDetector && (i.languageDetector = r(this.modules.languageDetector), i.languageDetector.init && i.languageDetector.init(i, this.options.detection, this.options)), this.modules.i18nFormat && (i.i18nFormat = r(this.modules.i18nFormat), i.i18nFormat.init && i.i18nFormat.init(this)), this.translator = new B(this.services, this.options), this.translator.on("*", (e, ...t) => {
1362
+ this.emit(e, ...t);
1363
+ }), this.modules.external.forEach((e) => {
1364
+ e.init && e.init(this);
1365
+ });
1366
+ }
1367
+ if (this.format = this.options.interpolation.format, t ||= X, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1368
+ let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1369
+ e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
1370
+ }
1371
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
1372
+ "getResource",
1373
+ "hasResourceBundle",
1374
+ "getResourceBundle",
1375
+ "getDataByLanguage"
1376
+ ].forEach((e) => {
1377
+ this[e] = (...t) => this.store[e](...t);
1378
+ }), [
1379
+ "addResource",
1380
+ "addResources",
1381
+ "addResourceBundle",
1382
+ "removeResourceBundle"
1383
+ ].forEach((e) => {
1384
+ this[e] = (...t) => (this.store[e](...t), this);
1385
+ });
1386
+ let i = d(), a = () => {
1387
+ let e = (e, n) => {
1388
+ this.isInitializing = !1, this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), i.resolve(n), t(e, n);
1389
+ };
1390
+ if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
1391
+ this.changeLanguage(this.options.lng, e);
1392
+ };
1393
+ return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
1394
+ }
1395
+ loadResources(e, t = X) {
1396
+ let n = t, r = u(e) ? e : this.language;
1397
+ if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1398
+ if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
1399
+ let e = [], t = (t) => {
1400
+ t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
1401
+ t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
1402
+ });
1403
+ };
1404
+ r ? t(r) : this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach((e) => t(e)), this.options.preload?.forEach?.((e) => t(e)), this.services.backendConnector.load(e, this.options.ns, (e) => {
1405
+ !e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
1406
+ });
1407
+ } else n(null);
1408
+ }
1409
+ reloadResources(e, t, n) {
1410
+ let r = d();
1411
+ return typeof e == "function" && (n = e, e = void 0), typeof t == "function" && (n = t, t = void 0), e ||= this.languages, t ||= this.options.ns, n ||= X, this.services.backendConnector.reload(e, t, (e) => {
1412
+ r.resolve(), n(e);
1413
+ }), r;
1414
+ }
1415
+ use(e) {
1416
+ if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1417
+ if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1418
+ return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && F.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1419
+ }
1420
+ setResolvedLanguage(e) {
1421
+ if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1422
+ for (let e = 0; e < this.languages.length; e++) {
1423
+ let t = this.languages[e];
1424
+ if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
1425
+ this.resolvedLanguage = t;
1426
+ break;
1427
+ }
1428
+ }
1429
+ !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1430
+ }
1431
+ }
1432
+ changeLanguage(e, t) {
1433
+ this.isLanguageChangingTo = e;
1434
+ let n = d();
1435
+ this.emit("languageChanging", e);
1436
+ let r = (e) => {
1437
+ this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
1438
+ }, i = (i, a) => {
1439
+ a ? this.isLanguageChangingTo === e && (r(a), this.translator.changeLanguage(a), this.isLanguageChangingTo = void 0, this.emit("languageChanged", a), this.logger.log("languageChanged", a)) : this.isLanguageChangingTo = void 0, n.resolve((...e) => this.t(...e)), t && t(i, (...e) => this.t(...e));
1440
+ }, a = (t) => {
1441
+ !e && !t && this.services.languageDetector && (t = []);
1442
+ let n = u(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(u(t) ? [t] : t);
1443
+ a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
1444
+ i(e, a);
1445
+ });
1446
+ };
1447
+ return !e && this.services.languageDetector && !this.services.languageDetector.async ? a(this.services.languageDetector.detect()) : !e && this.services.languageDetector && this.services.languageDetector.async ? this.services.languageDetector.detect.length === 0 ? this.services.languageDetector.detect().then(a) : this.services.languageDetector.detect(a) : a(e), n;
1448
+ }
1449
+ getFixedT(e, t, n) {
1450
+ let r = (e, t, ...i) => {
1451
+ let a;
1452
+ a = typeof t == "object" ? { ...t } : this.options.overloadTranslationOptionHandler([e, t].concat(i)), a.lng = a.lng || r.lng, a.lngs = a.lngs || r.lngs, a.ns = a.ns || r.ns, a.keyPrefix !== "" && (a.keyPrefix = a.keyPrefix || n || r.keyPrefix);
1453
+ let o = {
1454
+ ...this.options,
1455
+ ...a
1456
+ };
1457
+ typeof a.keyPrefix == "function" && (a.keyPrefix = L(a.keyPrefix, o));
1458
+ let s = this.options.keySeparator || ".", c;
1459
+ return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = L(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = L(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
1460
+ };
1461
+ return u(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
1462
+ }
1463
+ t(...e) {
1464
+ return this.translator?.translate(...e);
1465
+ }
1466
+ exists(...e) {
1467
+ return this.translator?.exists(...e);
1468
+ }
1469
+ setDefaultNamespace(e) {
1470
+ this.options.defaultNS = e;
1471
+ }
1472
+ hasLoadedNamespace(e, t = {}) {
1473
+ if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1474
+ if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1475
+ let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
1476
+ if (n.toLowerCase() === "cimode") return !0;
1477
+ let a = (e, t) => {
1478
+ let n = this.services.backendConnector.state[`${e}|${t}`];
1479
+ return n === -1 || n === 0 || n === 2;
1480
+ };
1481
+ if (t.precheck) {
1482
+ let e = t.precheck(this, a);
1483
+ if (e !== void 0) return e;
1484
+ }
1485
+ return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
1486
+ }
1487
+ loadNamespaces(e, t) {
1488
+ let n = d();
1489
+ return this.options.ns ? (u(e) && (e = [e]), e.forEach((e) => {
1490
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
1491
+ }), this.loadResources((e) => {
1492
+ n.resolve(), t && t(e);
1493
+ }), n) : (t && t(), Promise.resolve());
1494
+ }
1495
+ loadLanguages(e, t) {
1496
+ let n = d();
1497
+ u(e) && (e = [e]);
1498
+ let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
1499
+ return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
1500
+ n.resolve(), t && t(e);
1501
+ }), n) : (t && t(), Promise.resolve());
1502
+ }
1503
+ dir(e) {
1504
+ if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
1505
+ try {
1506
+ let t = new Intl.Locale(e);
1507
+ if (t && t.getTextInfo) {
1508
+ let e = t.getTextInfo();
1509
+ if (e && e.direction) return e.direction;
1510
+ }
1511
+ } catch {}
1512
+ let t = /* @__PURE__ */ "ar.shu.sqr.ssh.xaa.yhd.yud.aao.abh.abv.acm.acq.acw.acx.acy.adf.ads.aeb.aec.afb.ajp.apc.apd.arb.arq.ars.ary.arz.auz.avl.ayh.ayl.ayn.ayp.bbz.pga.he.iw.ps.pbt.pbu.pst.prp.prd.ug.ur.ydd.yds.yih.ji.yi.hbo.men.xmn.fa.jpr.peo.pes.prs.dv.sam.ckb".split("."), n = this.services?.languageUtils || new V(J());
1513
+ return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1514
+ }
1515
+ static createInstance(t = {}, n) {
1516
+ let r = new e(t, n);
1517
+ return r.createInstance = e.createInstance, r;
1518
+ }
1519
+ cloneInstance(t = {}, n = X) {
1520
+ let r = t.forkResourceStore;
1521
+ r && delete t.forkResourceStore;
1522
+ let i = {
1523
+ ...this.options,
1524
+ ...t,
1525
+ isClone: !0
1526
+ }, a = new e(i);
1527
+ if ((t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
1528
+ "store",
1529
+ "services",
1530
+ "language"
1531
+ ].forEach((e) => {
1532
+ a[e] = this[e];
1533
+ }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new P(Object.keys(this.store.data).reduce((e, t) => (e[t] = { ...this.store.data[t] }, e[t] = Object.keys(e[t]).reduce((n, r) => (n[r] = { ...e[t][r] }, n), e[t]), e), {}), i), a.services.resourceStore = a.store), t.interpolation) {
1534
+ let e = {
1535
+ ...J().interpolation,
1536
+ ...this.options.interpolation,
1537
+ ...t.interpolation
1538
+ }, n = {
1539
+ ...i,
1540
+ interpolation: e
1541
+ };
1542
+ a.services.interpolator = new K(n);
1543
+ }
1544
+ return a.translator = new B(a.services, i), a.translator.on("*", (e, ...t) => {
1545
+ a.emit(e, ...t);
1546
+ }), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
1547
+ }
1548
+ toJSON() {
1549
+ return {
1550
+ options: this.options,
1551
+ store: this.store,
1552
+ language: this.language,
1553
+ languages: this.languages,
1554
+ resolvedLanguage: this.resolvedLanguage
1555
+ };
1556
+ }
1557
+ }.createInstance();
1558
+ //#endregion
1559
+ //#region ../../shared/translator/dist/index.js
1560
+ Q.createInstance, Q.dir, Q.init, Q.loadResources, Q.reloadResources, Q.use, Q.changeLanguage, Q.getFixedT, Q.t, Q.exists, Q.setDefaultNamespace, Q.hasLoadedNamespace, Q.loadNamespaces, Q.loadLanguages, Q.init({
1561
+ fallbackLng: "en",
1562
+ lng: "en",
1563
+ showSupportNotice: !1,
1564
+ resources: {
1565
+ en: c,
1566
+ es: l
1567
+ }
1568
+ });
1569
+ //#endregion
1570
+ //#region src/i18n.ts
1571
+ var { translator: $ } = {
1572
+ translator: {
1573
+ ...Q,
1574
+ t: (e, t) => {
1575
+ let { lng: n } = t;
1576
+ switch (n) {
1577
+ case "en_US":
1578
+ case "en-US":
1579
+ t.lng = "en";
1580
+ break;
1581
+ case "es_ES":
1582
+ case "es-ES":
1583
+ case "es_MX":
1584
+ case "es-MX":
1585
+ t.lng = "es";
1586
+ break;
1587
+ default: break;
1588
+ }
1589
+ return Q.t(e, {
1590
+ lng: n,
1591
+ ...t
1592
+ });
1593
+ }
1594
+ },
1595
+ languageOptions: [{
1596
+ value: "en_US",
1597
+ label: "English (US)"
1598
+ }, {
1599
+ value: "es_ES",
1600
+ label: "Spanish"
1601
+ }]
1602
+ };
1603
+ function fe(e, t) {
1604
+ return $.t(`translation:simpleCloze:${e}`, { lng: t });
1605
+ }
1606
+ function pe(e, t) {
1607
+ return $.t(`common:${e}`, { lng: t });
1608
+ }
1609
+ //#endregion
1610
+ export { pe as n, s as r, fe as t };
1611
+
1612
+ //# sourceMappingURL=i18n-DJMxdTMU.js.map