@pie-element/match 12.1.2-next.18 → 12.1.2-next.19

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.
@@ -0,0 +1,2092 @@
1
+ import { o as e } from "../browser-jJGxjKdp.js";
2
+ import { Nt as t, O as n, a as r, d as i, dt as a, f as o, ft as s, ht as c, k as l, n as u, p as d, pt as f, r as p, t as m, u as h, x as g } from "../Typography-DNHIlMzM.js";
3
+ import _, { useRef as v } from "react";
4
+ import { createRoot as y } from "react-dom/client";
5
+ import { jsx as b, jsxs as x } from "react/jsx-runtime";
6
+ //#region ../../lib-react/correct-answer-toggle/dist/expander.js
7
+ var S = /* @__PURE__ */ e(t(), 1), C = "height ease-in 300ms, opacity ease-in 300ms", w = c("div")(() => ({
8
+ position: "relative",
9
+ height: 0,
10
+ overflow: "hidden",
11
+ display: "flex",
12
+ visibility: "hidden",
13
+ width: 0,
14
+ "&.enter": {
15
+ transition: C,
16
+ opacity: 1,
17
+ height: "auto",
18
+ width: "auto",
19
+ visibility: "visible",
20
+ minHeight: "25px"
21
+ },
22
+ "&.enter-done": {
23
+ height: "auto",
24
+ visibility: "visible",
25
+ width: "auto",
26
+ minHeight: "25px"
27
+ },
28
+ "&.exit": {
29
+ transition: C,
30
+ opacity: 0,
31
+ height: 0,
32
+ visibility: "visible",
33
+ width: 0
34
+ },
35
+ "&.exit-done": {
36
+ opacity: 0,
37
+ visibility: "hidden",
38
+ height: 0,
39
+ width: 0
40
+ }
41
+ })), T = (e) => {
42
+ let { show: t, children: n, className: r } = e, i = v(null);
43
+ return /* @__PURE__ */ b(f, {
44
+ nodeRef: i,
45
+ in: t,
46
+ appear: !0,
47
+ mountOnEnter: !1,
48
+ timeout: 300,
49
+ classNames: {
50
+ enter: "enter",
51
+ enterDone: "enter-done",
52
+ exit: "exit",
53
+ exitDone: "exit-done"
54
+ },
55
+ children: /* @__PURE__ */ b(w, {
56
+ ref: i,
57
+ className: r,
58
+ children: n
59
+ })
60
+ });
61
+ };
62
+ T.propTypes = {
63
+ show: S.default.bool.isRequired,
64
+ className: S.default.string,
65
+ children: S.default.oneOfType([S.default.arrayOf(S.default.node), S.default.node]).isRequired
66
+ };
67
+ //#endregion
68
+ //#region ../../lib-react/icons/dist/correct-response-icon.js
69
+ var E = ({ bgFill: e, fgFill: t }) => /* @__PURE__ */ x("svg", {
70
+ preserveAspectRatio: "xMinYMin meet",
71
+ version: "1.1",
72
+ viewBox: "-283 359 34 35",
73
+ style: { enableBackground: "new -283 359 34 35" },
74
+ children: [
75
+ /* @__PURE__ */ b("circle", {
76
+ cx: "-266",
77
+ cy: "375.9",
78
+ r: "14",
79
+ fill: e
80
+ }),
81
+ /* @__PURE__ */ b("path", {
82
+ d: "M-280.5,375.9c0-8,6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5s-6.5,14.5-14.5,14.5S-280.5,383.9-280.5,375.9z\n M-279.5,375.9c0,7.4,6.1,13.5,13.5,13.5c7.4,0,13.5-6.1,13.5-13.5s-6.1-13.5-13.5-13.5C-273.4,362.4-279.5,368.5-279.5,375.9z",
83
+ fill: e
84
+ }),
85
+ /* @__PURE__ */ b("polygon", {
86
+ points: "-265.4,383.1 -258.6,377.2 -261.2,374.2 -264.3,376.9 -268.9,368.7 -272.4,370.6",
87
+ fill: t
88
+ })
89
+ ]
90
+ });
91
+ E.propTypes = {
92
+ bgFill: S.default.string.isRequired,
93
+ fgFill: S.default.string.isRequired
94
+ };
95
+ var D = ({ bgFill: e, fgFill: t, borderFill: n }) => /* @__PURE__ */ x("svg", {
96
+ preserveAspectRatio: "xMinYMin meet",
97
+ version: "1.1",
98
+ viewBox: "-129.5 127 34 35",
99
+ style: { enableBackground: "new -129.5 127 34 35" },
100
+ children: [
101
+ /* @__PURE__ */ b("path", {
102
+ style: {
103
+ fill: "#D0CAC5",
104
+ stroke: "#E6E3E0",
105
+ strokeWidth: .75,
106
+ strokeMiterlimit: 10
107
+ },
108
+ d: "M-112.9,160.4c-8.5,0-15.5-6.9-15.5-15.5c0-8.5,6.9-15.5,15.5-15.5s15.5,6.9,15.5,15.5\n C-97.4,153.5-104.3,160.4-112.9,160.4z"
109
+ }),
110
+ /* @__PURE__ */ b("path", {
111
+ style: {
112
+ fill: "#B3ABA4",
113
+ stroke: "#CDC7C2",
114
+ strokeWidth: .5,
115
+ strokeMiterlimit: 10
116
+ },
117
+ d: "M-113.2,159c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-105.2,159-113.2,159z"
118
+ }),
119
+ /* @__PURE__ */ b("circle", {
120
+ cx: "-114.2",
121
+ cy: "143.5",
122
+ r: "14",
123
+ fill: e
124
+ }),
125
+ /* @__PURE__ */ b("path", {
126
+ d: "M-114.2,158c-8,0-14.5-6.5-14.5-14.5s6.5-14.5,14.5-14.5s14.5,6.5,14.5,14.5S-106.2,158-114.2,158z\n M-114.2,130c-7.4,0-13.5,6.1-13.5,13.5s6.1,13.5,13.5,13.5s13.5-6.1,13.5-13.5S-106.8,130-114.2,130z",
127
+ fill: n
128
+ }),
129
+ /* @__PURE__ */ b("polygon", {
130
+ points: "-114.8,150.7 -121.6,144.8 -119,141.8 -115.9,144.5 -111.3,136.3 -107.8,138.2",
131
+ fill: t
132
+ })
133
+ ]
134
+ });
135
+ D.propTypes = {
136
+ bgFill: S.default.string.isRequired,
137
+ fgFill: S.default.string.isRequired,
138
+ borderFill: S.default.string.isRequired
139
+ };
140
+ var ee = c("div")(({ size: e }) => ({
141
+ width: e || "25px",
142
+ height: e || "25px"
143
+ })), O = ({ open: e, size: t }) => /* @__PURE__ */ b(ee, {
144
+ size: t,
145
+ children: e ? /* @__PURE__ */ b(E, {
146
+ bgFill: "#bce2ff",
147
+ fgFill: "#1a9cff"
148
+ }) : /* @__PURE__ */ b(D, {
149
+ bgFill: "white",
150
+ fgFill: "#1a9cff",
151
+ borderFill: "#bce2ff"
152
+ })
153
+ });
154
+ O.propTypes = {
155
+ open: S.default.bool,
156
+ size: S.default.string
157
+ }, O.defaultProps = { open: !1 };
158
+ //#endregion
159
+ //#region ../../shared/translator/dist/en.js
160
+ var te = {
161
+ translation: {
162
+ categorize: {
163
+ limitMaxChoicesPerCategory: "You've reached the limit of {{maxChoicesPerCategory}} responses per area. To add another response, one must first be removed.",
164
+ maxChoicesPerCategoryRestriction: "To change this value to {{maxChoicesPerCategory}}, each category must have {{maxChoicesPerCategory}} or fewer answer choice[s]."
165
+ },
166
+ ebsr: { part: "Part {{index}}" },
167
+ numberLine: {
168
+ addElementLimit_one: "You can only add {{count}} element",
169
+ addElementLimit_other: "You can only add {{count}} elements",
170
+ clearAll: "Clear all"
171
+ },
172
+ imageClozeAssociation: {
173
+ reachedLimit_one: "You’ve reached the limit of {{count}} response per area. To add another response, one must first be removed.",
174
+ reachedLimit_other: "Full"
175
+ },
176
+ drawingResponse: {
177
+ fillColor: "Fill color",
178
+ outlineColor: "Outline color",
179
+ noFill: "No fill",
180
+ lightblue: "Light blue",
181
+ lightyellow: "Light yellow",
182
+ red: "Red",
183
+ orange: "Orange",
184
+ yellow: "Yellow",
185
+ violet: "Violet",
186
+ blue: "Blue",
187
+ green: "Green",
188
+ white: "White",
189
+ black: "Black",
190
+ onDoubleClick: "Double click to edit this text. Press Enter to submit."
191
+ },
192
+ charting: {
193
+ addCategory: "Add category",
194
+ actions: "Actions",
195
+ add: "Add",
196
+ delete: "Delete",
197
+ newLabel: "New label",
198
+ reachedLimit_other: "There can't be more than {{count}} categories.",
199
+ keyLegend: {
200
+ incorrectAnswer: "Student incorrect answer",
201
+ correctAnswer: "Student correct answer",
202
+ correctKeyAnswer: "Answer key correct"
203
+ }
204
+ },
205
+ graphing: {
206
+ point: "Point",
207
+ circle: "Circle",
208
+ line: "Line",
209
+ parabola: "Parabola",
210
+ absolute: "Absolute Value",
211
+ exponential: "Exponential",
212
+ polygon: "Polygon",
213
+ ray: "Ray",
214
+ segment: "Segment",
215
+ sine: "Sine",
216
+ vector: "Vector",
217
+ label: "Label",
218
+ redo: "Redo",
219
+ reset: "Reset"
220
+ },
221
+ 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." },
222
+ mcPopulatedBlank: {
223
+ answerChoices: "Answer choices",
224
+ blankLabel: "blank",
225
+ emptyBlank: "(blank)",
226
+ blankPreSelectionHint: "The answer you choose will appear on the blank line above.",
227
+ correctAnswerSelected: "Correct answer selected",
228
+ incorrectAnswerSelected: "Incorrect answer selected",
229
+ selectedAnswerImage: "Selected answer image",
230
+ choiceImage: "Choice {{id}}",
231
+ clickToEnableAutoplay: "Click to enable audio autoplay",
232
+ audioResourceUnavailable: "Audio is enabled but no playable audio URL is configured.",
233
+ listen: "Listen",
234
+ listenSilentAlt: "Repeat instructions",
235
+ listenPlayingAlt: "Instructions are playing",
236
+ printAudio: "Audio:",
237
+ printTranscript: "Transcript:"
238
+ },
239
+ multipleChoice: {
240
+ minSelections: "Select at least {{minSelections}}.",
241
+ maxSelections_one: "Only {{maxSelections}} answer is allowed.",
242
+ maxSelections_other: "Only {{maxSelections}} answers are allowed.",
243
+ minmaxSelections_equal: "Select {{minSelections}}.",
244
+ minmaxSelections_range: "Select between {{minSelections}} and {{maxSelections}}."
245
+ },
246
+ selectText: {
247
+ correctAnswerSelected: "Correct",
248
+ correctAnswerNotSelected: "Correct Answer Not Selected",
249
+ incorrectSelection: "Incorrect Selection",
250
+ key: "Key"
251
+ },
252
+ simpleCloze: {
253
+ correctAnswerShown: "Correct answer",
254
+ correct: "Correct",
255
+ incorrect: "Incorrect",
256
+ unanswered: "No answer",
257
+ placeholder: "Enter your answer...",
258
+ answerInput: "Your answer",
259
+ printCorrectAnswer: "Correct answer:",
260
+ printAnswerBlank: "Answer blank"
261
+ },
262
+ vennClassification: {
263
+ tray: "Tiles to classify",
264
+ unknownTarget: "unknown",
265
+ cancelled: "Cancelled",
266
+ returnedToTray: "{{name}} returned to tray",
267
+ placedIn: "{{name}} placed in {{target}}",
268
+ pickedUp: "Picked up {{name}}",
269
+ pickedUpWithKeyboard: "Picked up {{name}}, drop target: {{target}}. Use arrow keys to choose a drop target, Enter to drop, Escape to cancel.",
270
+ dropTarget: "Drop target: {{target}}",
271
+ unsupportedCircles_one: "This diagram cannot be shown: it has {{count}} circle, and only {{supported}} are supported.",
272
+ unsupportedCircles_other: "This diagram cannot be shown: it has {{count}} circles, and only {{supported}} are supported.",
273
+ setNumber: "Set {{number}}",
274
+ regionOnly: "{{set}} only",
275
+ regionNeither: "Neither {{first}} nor {{second}}",
276
+ regionNoneOf: "None of {{sets}}",
277
+ regionAndSeparator: " and ",
278
+ tileFallbackName: "Tile",
279
+ tileNotPlaced: "not placed",
280
+ tileInRegion: "in {{region}}",
281
+ tileCorrect: "correct",
282
+ tileIncorrect: "incorrect"
283
+ }
284
+ },
285
+ common: {
286
+ undo: "Undo",
287
+ clearAll: "Clear all",
288
+ correct: "Correct",
289
+ incorrect: "Incorrect",
290
+ showCorrectAnswer: "Show correct answer",
291
+ hideCorrectAnswer: "Hide correct answer",
292
+ showTeacherInstructions: "Show Teacher Instructions",
293
+ hideTeacherInstructions: "Hide Teacher Instructions",
294
+ 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.",
295
+ warning: "Warning",
296
+ showNote: "Show Note",
297
+ hideNote: "Hide Note",
298
+ cancel: "Cancel"
299
+ }
300
+ }, ne = {
301
+ translation: {
302
+ categorize: {
303
+ limitMaxChoicesPerCategory: "Has alcanzado el límite de {{maxChoicesPerCategory}} respuestas por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
304
+ maxChoicesPerCategoryRestriction: "Para cambiar este valor a {{maxChoicesPerCategory}}, cada categoría debe tener {{maxChoicesPerCategory}} o menos opciones de respuesta"
305
+ },
306
+ ebsr: { part: "Parte {{index}}" },
307
+ numberLine: {
308
+ addElementLimit_one: "Solo puedes agregar {{count}} elemento",
309
+ addElementLimit_other: "Solo puedes agregar {{count}} elementos",
310
+ clearAll: "Borrar todo"
311
+ },
312
+ imageClozeAssociation: {
313
+ reachedLimit_one: "Has alcanzado el límite de {{count}} respuesta por área. Para agregar otra respuesta, primero se debe eliminar una respuesta.",
314
+ reachedLimit_other: "Lleno"
315
+ },
316
+ drawingResponse: {
317
+ fillColor: "Color de relleno",
318
+ outlineColor: "Color del contorno",
319
+ noFill: "Sin relleno",
320
+ lightblue: "Azul claro",
321
+ lightyellow: "Amarillo claro",
322
+ red: "Rojo",
323
+ orange: "Naranja",
324
+ yellow: "Amarillo",
325
+ violet: "Violeta",
326
+ blue: "Azul",
327
+ green: "Verde",
328
+ white: "Blanco",
329
+ black: "Negro",
330
+ onDoubleClick: "Haz doble clic para revisar este texto. Presiona el botón de ingreso para enviar"
331
+ },
332
+ charting: {
333
+ addCategory: "Añadir categoría",
334
+ actions: "Acciones",
335
+ add: "Añadir",
336
+ delete: "Eliminar",
337
+ newLabel: "Nueva etiqueta",
338
+ reachedLimit_other: "No puede haber más de {{count}} categorías.",
339
+ keyLegend: {
340
+ incorrectAnswer: "Respuesta incorrecta del estudiante",
341
+ correctAnswer: "Respuesta correcta del estudiante",
342
+ correctKeyAnswer: "Clave de respuesta correcta"
343
+ }
344
+ },
345
+ graphing: {
346
+ point: "Punto",
347
+ circle: "Circulo",
348
+ line: "Línea",
349
+ parabola: "Parábola",
350
+ absolute: "Valor absoluto",
351
+ exponential: "Exponencial",
352
+ polygon: "Polígono",
353
+ ray: "Semirrecta",
354
+ segment: "Segmento ",
355
+ sine: "Seno",
356
+ vector: "Vector",
357
+ label: "Etiqueta",
358
+ redo: "Rehacer",
359
+ reset: "Reiniciar"
360
+ },
361
+ 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." },
362
+ mcPopulatedBlank: {
363
+ answerChoices: "Opciones de respuesta",
364
+ blankLabel: "espacio en blanco",
365
+ emptyBlank: "(en blanco)",
366
+ blankPreSelectionHint: "La respuesta que elijas aparecerá en la línea en blanco de arriba.",
367
+ correctAnswerSelected: "Respuesta correcta seleccionada",
368
+ incorrectAnswerSelected: "Respuesta incorrecta seleccionada",
369
+ selectedAnswerImage: "Imagen de la respuesta seleccionada",
370
+ choiceImage: "Opción {{id}}",
371
+ clickToEnableAutoplay: "Haz clic para activar la reproducción automática del audio",
372
+ audioResourceUnavailable: "El audio está activado, pero no hay una URL de audio reproducible configurada.",
373
+ listen: "Escuchar",
374
+ listenSilentAlt: "Escuchar. Repetir las instrucciones.",
375
+ listenPlayingAlt: "Escuchar. Estas son las instrucciones.",
376
+ printAudio: "Audio:",
377
+ printTranscript: "Transcripción:"
378
+ },
379
+ multipleChoice: {
380
+ minSelections: "Seleccione al menos {{minSelections}}.",
381
+ maxSelections_one: "Sólo se permite {{maxSelections}} respuesta.",
382
+ maxSelections_other: "Sólo se permiten {{maxSelections}} respuestas.",
383
+ minmaxSelections_equal: "Seleccione {{minSelections}}.",
384
+ minmaxSelections_range: "Seleccione entre {{minSelections}} y {{maxSelections}}."
385
+ },
386
+ selectText: {
387
+ correctAnswerSelected: "Respuesta Correcta",
388
+ correctAnswerNotSelected: "Respuesta Correcta No Seleccionada",
389
+ incorrectSelection: "Selección Incorrecta",
390
+ key: "Clave"
391
+ },
392
+ simpleCloze: {
393
+ correctAnswerShown: "Respuesta correcta",
394
+ correct: "Correcto",
395
+ incorrect: "Incorrecto",
396
+ unanswered: "Sin respuesta",
397
+ placeholder: "Escribe tu respuesta...",
398
+ answerInput: "Tu respuesta",
399
+ printCorrectAnswer: "Respuesta correcta:",
400
+ printAnswerBlank: "Espacio para la respuesta"
401
+ },
402
+ vennClassification: {
403
+ tray: "Fichas para clasificar",
404
+ unknownTarget: "desconocido",
405
+ cancelled: "Cancelado",
406
+ returnedToTray: "Se devolvió {{name}} a la bandeja",
407
+ placedIn: "Se colocó {{name}} en {{target}}",
408
+ pickedUp: "Se tomó {{name}}",
409
+ pickedUpWithKeyboard: "Se tomó {{name}}, destino: {{target}}. Usa las flechas para elegir un destino, Enter para soltar y Escape para cancelar.",
410
+ dropTarget: "Destino: {{target}}",
411
+ unsupportedCircles_one: "No se puede mostrar este diagrama: tiene {{count}} círculo, y solo se admiten {{supported}}.",
412
+ unsupportedCircles_other: "No se puede mostrar este diagrama: tiene {{count}} círculos, y solo se admiten {{supported}}.",
413
+ setNumber: "Conjunto {{number}}",
414
+ regionOnly: "Solo {{set}}",
415
+ regionNeither: "Ni {{first}} ni {{second}}",
416
+ regionNoneOf: "Ninguno de {{sets}}",
417
+ regionAndSeparator: " y ",
418
+ tileFallbackName: "Ficha",
419
+ tileNotPlaced: "sin colocar",
420
+ tileInRegion: "en {{region}}",
421
+ tileCorrect: "correcta",
422
+ tileIncorrect: "incorrecta"
423
+ }
424
+ },
425
+ common: {
426
+ undo: "Deshacer",
427
+ clearAll: "Borrar todo",
428
+ correct: "Correcto",
429
+ incorrect: "Incorrecto",
430
+ showCorrectAnswer: "Mostrar respuesta correcta",
431
+ hideCorrectAnswer: "Ocultar respuesta correcta",
432
+ showTeacherInstructions: "Mostrar instrucciones para el maestro",
433
+ hideTeacherInstructions: "Ocultar instrucciones para el maestro",
434
+ 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.",
435
+ warning: "Advertencia",
436
+ showNote: "Mostrar Nota",
437
+ hideNote: "Ocultar Nota",
438
+ cancel: "Cancelar"
439
+ }
440
+ }, k = (e) => typeof e == "string", A = () => {
441
+ let e, t, n = new Promise((n, r) => {
442
+ e = n, t = r;
443
+ });
444
+ return n.resolve = e, n.reject = t, n;
445
+ }, re = (e) => e == null ? "" : "" + e, ie = (e, t, n) => {
446
+ e.forEach((e) => {
447
+ t[e] && (n[e] = t[e]);
448
+ });
449
+ }, ae = /###/g, oe = (e) => e && e.indexOf("###") > -1 ? e.replace(ae, ".") : e, se = (e) => !e || k(e), j = (e, t, n) => {
450
+ let r = k(t) ? t.split(".") : t, i = 0;
451
+ for (; i < r.length - 1;) {
452
+ if (se(e)) return {};
453
+ let t = oe(r[i]);
454
+ !e[t] && n && (e[t] = new n()), e = Object.prototype.hasOwnProperty.call(e, t) ? e[t] : {}, ++i;
455
+ }
456
+ return se(e) ? {} : {
457
+ obj: e,
458
+ k: oe(r[i])
459
+ };
460
+ }, ce = (e, t, n) => {
461
+ let { obj: r, k: i } = j(e, t, Object);
462
+ if (r !== void 0 || t.length === 1) {
463
+ r[i] = n;
464
+ return;
465
+ }
466
+ let a = t[t.length - 1], o = t.slice(0, t.length - 1), s = j(e, o, Object);
467
+ for (; s.obj === void 0 && o.length;) a = `${o[o.length - 1]}.${a}`, o = o.slice(0, o.length - 1), s = j(e, o, Object), s?.obj && s.obj[`${s.k}.${a}`] !== void 0 && (s.obj = void 0);
468
+ s.obj[`${s.k}.${a}`] = n;
469
+ }, le = (e, t, n, r) => {
470
+ let { obj: i, k: a } = j(e, t, Object);
471
+ i[a] = i[a] || [], i[a].push(n);
472
+ }, M = (e, t) => {
473
+ let { obj: n, k: r } = j(e, t);
474
+ if (n && Object.prototype.hasOwnProperty.call(n, r)) return n[r];
475
+ }, ue = (e, t, n) => {
476
+ let r = M(e, n);
477
+ return r === void 0 ? M(t, n) : r;
478
+ }, de = (e, t, n) => {
479
+ for (let r in t) r !== "__proto__" && r !== "constructor" && (r in e ? k(e[r]) || e[r] instanceof String || k(t[r]) || t[r] instanceof String ? n && (e[r] = t[r]) : de(e[r], t[r], n) : e[r] = t[r]);
480
+ return e;
481
+ }, N = (e) => e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), fe = {
482
+ "&": "&amp;",
483
+ "<": "&lt;",
484
+ ">": "&gt;",
485
+ "\"": "&quot;",
486
+ "'": "&#39;",
487
+ "/": "&#x2F;"
488
+ }, pe = (e) => k(e) ? e.replace(/[&<>"'\/]/g, (e) => fe[e]) : e, me = class {
489
+ constructor(e) {
490
+ this.capacity = e, this.regExpMap = /* @__PURE__ */ new Map(), this.regExpQueue = [];
491
+ }
492
+ getRegExp(e) {
493
+ let t = this.regExpMap.get(e);
494
+ if (t !== void 0) return t;
495
+ let n = new RegExp(e);
496
+ return this.regExpQueue.length === this.capacity && this.regExpMap.delete(this.regExpQueue.shift()), this.regExpMap.set(e, n), this.regExpQueue.push(e), n;
497
+ }
498
+ }, he = [
499
+ " ",
500
+ ",",
501
+ "?",
502
+ "!",
503
+ ";"
504
+ ], ge = new me(20), _e = (e, t, n) => {
505
+ t ||= "", n ||= "";
506
+ let r = he.filter((e) => t.indexOf(e) < 0 && n.indexOf(e) < 0);
507
+ if (r.length === 0) return !0;
508
+ let i = ge.getRegExp(`(${r.map((e) => e === "?" ? "\\?" : e).join("|")})`), a = !i.test(e);
509
+ if (!a) {
510
+ let t = e.indexOf(n);
511
+ t > 0 && !i.test(e.substring(0, t)) && (a = !0);
512
+ }
513
+ return a;
514
+ }, P = (e, t, n = ".") => {
515
+ if (!e) return;
516
+ if (e[t]) return Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0;
517
+ let r = t.split(n), i = e;
518
+ for (let e = 0; e < r.length;) {
519
+ if (!i || typeof i != "object") return;
520
+ let t, a = "";
521
+ for (let o = e; o < r.length; ++o) if (o !== e && (a += n), a += r[o], t = i[a], t !== void 0) {
522
+ if ([
523
+ "string",
524
+ "number",
525
+ "boolean"
526
+ ].indexOf(typeof t) > -1 && o < r.length - 1) continue;
527
+ e += o - e + 1;
528
+ break;
529
+ }
530
+ i = t;
531
+ }
532
+ return i;
533
+ }, F = (e) => e?.replace(/_/g, "-"), ve = {
534
+ type: "logger",
535
+ log(e) {
536
+ this.output("log", e);
537
+ },
538
+ warn(e) {
539
+ this.output("warn", e);
540
+ },
541
+ error(e) {
542
+ this.output("error", e);
543
+ },
544
+ output(e, t) {
545
+ console?.[e]?.apply?.(console, t);
546
+ }
547
+ }, I = new class e {
548
+ constructor(e, t = {}) {
549
+ this.init(e, t);
550
+ }
551
+ init(e, t = {}) {
552
+ this.prefix = t.prefix || "i18next:", this.logger = e || ve, this.options = t, this.debug = t.debug;
553
+ }
554
+ log(...e) {
555
+ return this.forward(e, "log", "", !0);
556
+ }
557
+ warn(...e) {
558
+ return this.forward(e, "warn", "", !0);
559
+ }
560
+ error(...e) {
561
+ return this.forward(e, "error", "");
562
+ }
563
+ deprecate(...e) {
564
+ return this.forward(e, "warn", "WARNING DEPRECATED: ", !0);
565
+ }
566
+ forward(e, t, n, r) {
567
+ return r && !this.debug ? null : (k(e[0]) && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[t](e));
568
+ }
569
+ create(t) {
570
+ return new e(this.logger, {
571
+ prefix: `${this.prefix}:${t}:`,
572
+ ...this.options
573
+ });
574
+ }
575
+ clone(t) {
576
+ return t ||= this.options, t.prefix = t.prefix || this.prefix, new e(this.logger, t);
577
+ }
578
+ }(), L = class {
579
+ constructor() {
580
+ this.observers = {};
581
+ }
582
+ on(e, t) {
583
+ return e.split(" ").forEach((e) => {
584
+ this.observers[e] || (this.observers[e] = /* @__PURE__ */ new Map());
585
+ let n = this.observers[e].get(t) || 0;
586
+ this.observers[e].set(t, n + 1);
587
+ }), this;
588
+ }
589
+ off(e, t) {
590
+ if (this.observers[e]) {
591
+ if (!t) {
592
+ delete this.observers[e];
593
+ return;
594
+ }
595
+ this.observers[e].delete(t);
596
+ }
597
+ }
598
+ emit(e, ...t) {
599
+ this.observers[e] && Array.from(this.observers[e].entries()).forEach(([e, n]) => {
600
+ for (let r = 0; r < n; r++) e(...t);
601
+ }), this.observers["*"] && Array.from(this.observers["*"].entries()).forEach(([n, r]) => {
602
+ for (let i = 0; i < r; i++) n.apply(n, [e, ...t]);
603
+ });
604
+ }
605
+ }, ye = class extends L {
606
+ constructor(e, t = {
607
+ ns: ["translation"],
608
+ defaultNS: "translation"
609
+ }) {
610
+ super(), this.data = e || {}, this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.options.ignoreJSONStructure === void 0 && (this.options.ignoreJSONStructure = !0);
611
+ }
612
+ addNamespaces(e) {
613
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
614
+ }
615
+ removeNamespaces(e) {
616
+ let t = this.options.ns.indexOf(e);
617
+ t > -1 && this.options.ns.splice(t, 1);
618
+ }
619
+ getResource(e, t, n, r = {}) {
620
+ let i = r.keySeparator === void 0 ? this.options.keySeparator : r.keySeparator, a = r.ignoreJSONStructure === void 0 ? this.options.ignoreJSONStructure : r.ignoreJSONStructure, o;
621
+ e.indexOf(".") > -1 ? o = e.split(".") : (o = [e, t], n && (Array.isArray(n) ? o.push(...n) : k(n) && i ? o.push(...n.split(i)) : o.push(n)));
622
+ let s = M(this.data, o);
623
+ return !s && !t && !n && e.indexOf(".") > -1 && (e = o[0], t = o[1], n = o.slice(2).join(".")), s || !a || !k(n) ? s : P(this.data?.[e]?.[t], n, i);
624
+ }
625
+ addResource(e, t, n, r, i = { silent: !1 }) {
626
+ let a = i.keySeparator === void 0 ? this.options.keySeparator : i.keySeparator, o = [e, t];
627
+ n && (o = o.concat(a ? n.split(a) : n)), e.indexOf(".") > -1 && (o = e.split("."), r = t, t = o[1]), this.addNamespaces(t), ce(this.data, o, r), i.silent || this.emit("added", e, t, n, r);
628
+ }
629
+ addResources(e, t, n, r = { silent: !1 }) {
630
+ for (let r in n) (k(n[r]) || Array.isArray(n[r])) && this.addResource(e, t, r, n[r], { silent: !0 });
631
+ r.silent || this.emit("added", e, t, n);
632
+ }
633
+ addResourceBundle(e, t, n, r, i, a = {
634
+ silent: !1,
635
+ skipCopy: !1
636
+ }) {
637
+ let o = [e, t];
638
+ e.indexOf(".") > -1 && (o = e.split("."), r = n, n = t, t = o[1]), this.addNamespaces(t);
639
+ let s = M(this.data, o) || {};
640
+ a.skipCopy || (n = JSON.parse(JSON.stringify(n))), r ? de(s, n, i) : s = {
641
+ ...s,
642
+ ...n
643
+ }, ce(this.data, o, s), a.silent || this.emit("added", e, t, n);
644
+ }
645
+ removeResourceBundle(e, t) {
646
+ this.hasResourceBundle(e, t) && delete this.data[e][t], this.removeNamespaces(t), this.emit("removed", e, t);
647
+ }
648
+ hasResourceBundle(e, t) {
649
+ return this.getResource(e, t) !== void 0;
650
+ }
651
+ getResourceBundle(e, t) {
652
+ return t ||= this.options.defaultNS, this.getResource(e, t);
653
+ }
654
+ getDataByLanguage(e) {
655
+ return this.data[e];
656
+ }
657
+ hasLanguageSomeTranslations(e) {
658
+ let t = this.getDataByLanguage(e);
659
+ return !!(t && Object.keys(t) || []).find((e) => t[e] && Object.keys(t[e]).length > 0);
660
+ }
661
+ toJSON() {
662
+ return this.data;
663
+ }
664
+ }, be = {
665
+ processors: {},
666
+ addPostProcessor(e) {
667
+ this.processors[e.name] = e;
668
+ },
669
+ handle(e, t, n, r, i) {
670
+ return e.forEach((e) => {
671
+ t = this.processors[e]?.process(t, n, r, i) ?? t;
672
+ }), t;
673
+ }
674
+ }, xe = Symbol("i18next/PATH_KEY");
675
+ function Se() {
676
+ let e = [], t = Object.create(null), n;
677
+ return t.get = (r, i) => (n?.revoke?.(), i === xe ? e : (e.push(i), n = Proxy.revocable(r, t), n.proxy)), Proxy.revocable(Object.create(null), t).proxy;
678
+ }
679
+ function R(e, t) {
680
+ let { [xe]: n } = e(Se()), r = t?.keySeparator ?? ".", i = t?.nsSeparator ?? ":";
681
+ if (n.length > 1 && i) {
682
+ let e = t?.ns, a = Array.isArray(e) ? e : null;
683
+ if (a && a.length > 1 && a.slice(1).includes(n[0])) return `${n[0]}${i}${n.slice(1).join(r)}`;
684
+ }
685
+ return n.join(r);
686
+ }
687
+ var Ce = {}, z = (e) => !k(e) && typeof e != "boolean" && typeof e != "number", B = class e extends L {
688
+ constructor(e, t = {}) {
689
+ super(), ie([
690
+ "resourceStore",
691
+ "languageUtils",
692
+ "pluralResolver",
693
+ "interpolator",
694
+ "backendConnector",
695
+ "i18nFormat",
696
+ "utils"
697
+ ], e, this), this.options = t, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = I.create("translator");
698
+ }
699
+ changeLanguage(e) {
700
+ e && (this.language = e);
701
+ }
702
+ exists(e, t = { interpolation: {} }) {
703
+ let n = { ...t };
704
+ if (e == null) return !1;
705
+ let r = this.resolve(e, n);
706
+ if (r?.res === void 0) return !1;
707
+ let i = z(r.res);
708
+ return !(n.returnObjects === !1 && i);
709
+ }
710
+ extractFromKey(e, t) {
711
+ let n = t.nsSeparator === void 0 ? this.options.nsSeparator : t.nsSeparator;
712
+ n === void 0 && (n = ":");
713
+ 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 && !_e(e, n, r);
714
+ if (a && !o) {
715
+ let t = e.match(this.interpolator.nestingRegexp);
716
+ if (t && t.length > 0) return {
717
+ key: e,
718
+ namespaces: k(i) ? [i] : i
719
+ };
720
+ let a = e.split(n);
721
+ (n !== r || n === r && this.options.ns.indexOf(a[0]) > -1) && (i = a.shift()), e = a.join(r);
722
+ }
723
+ return {
724
+ key: e,
725
+ namespaces: k(i) ? [i] : i
726
+ };
727
+ }
728
+ translate(t, n, r) {
729
+ let i = typeof n == "object" ? { ...n } : n;
730
+ if (typeof i != "object" && this.options.overloadTranslationOptionHandler && (i = this.options.overloadTranslationOptionHandler(arguments)), typeof i == "object" && (i = { ...i }), i ||= {}, t == null) return "";
731
+ typeof t == "function" && (t = R(t, {
732
+ ...this.options,
733
+ ...i
734
+ })), Array.isArray(t) || (t = [String(t)]), t = t.map((e) => typeof e == "function" ? R(e, {
735
+ ...this.options,
736
+ ...i
737
+ }) : String(e));
738
+ 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], u = i.nsSeparator === void 0 ? this.options.nsSeparator : i.nsSeparator;
739
+ u === void 0 && (u = ":");
740
+ let d = i.lng || this.language, f = i.appendNamespaceToCIMode || this.options.appendNamespaceToCIMode;
741
+ if (d?.toLowerCase() === "cimode") return f ? a ? {
742
+ res: `${l}${u}${s}`,
743
+ usedKey: s,
744
+ exactUsedKey: s,
745
+ usedLng: d,
746
+ usedNS: l,
747
+ usedParams: this.getUsedParamsDetails(i)
748
+ } : `${l}${u}${s}` : a ? {
749
+ res: s,
750
+ usedKey: s,
751
+ exactUsedKey: s,
752
+ usedLng: d,
753
+ usedNS: l,
754
+ usedParams: this.getUsedParamsDetails(i)
755
+ } : s;
756
+ let p = this.resolve(t, i), m = p?.res, h = p?.usedKey || s, g = p?.exactUsedKey || s, _ = [
757
+ "[object Number]",
758
+ "[object Function]",
759
+ "[object RegExp]"
760
+ ], v = i.joinArrays === void 0 ? this.options.joinArrays : i.joinArrays, y = !this.i18nFormat || this.i18nFormat.handleAsObject, b = i.count !== void 0 && !k(i.count), x = e.hasDefaultValue(i), S = b ? this.pluralResolver.getSuffix(d, i.count, i) : "", C = i.ordinal && b ? this.pluralResolver.getSuffix(d, i.count, { ordinal: !1 }) : "", w = b && !i.ordinal && i.count === 0, T = w && i[`defaultValue${this.options.pluralSeparator}zero`] || i[`defaultValue${S}`] || i[`defaultValue${C}`] || i.defaultValue, E = m;
761
+ y && !m && x && (E = T);
762
+ let D = z(E), ee = Object.prototype.toString.apply(E);
763
+ if (y && E && D && _.indexOf(ee) < 0 && !(k(v) && Array.isArray(E))) {
764
+ if (!i.returnObjects && !this.options.returnObjects) {
765
+ this.options.returnedObjectHandler || this.logger.warn("accessing an object - but returnObjects options is not enabled!");
766
+ let e = this.options.returnedObjectHandler ? this.options.returnedObjectHandler(h, E, {
767
+ ...i,
768
+ ns: c
769
+ }) : `key '${s} (${this.language})' returned an object instead of string.`;
770
+ return a ? (p.res = e, p.usedParams = this.getUsedParamsDetails(i), p) : e;
771
+ }
772
+ if (o) {
773
+ let e = Array.isArray(E), t = e ? [] : {}, n = e ? g : h;
774
+ for (let e in E) if (Object.prototype.hasOwnProperty.call(E, e)) {
775
+ let r = `${n}${o}${e}`;
776
+ x && !m ? t[e] = this.translate(r, {
777
+ ...i,
778
+ defaultValue: z(T) ? T[e] : void 0,
779
+ joinArrays: !1,
780
+ ns: c
781
+ }) : t[e] = this.translate(r, {
782
+ ...i,
783
+ joinArrays: !1,
784
+ ns: c
785
+ }), t[e] === r && (t[e] = E[e]);
786
+ }
787
+ m = t;
788
+ }
789
+ } else if (y && k(v) && Array.isArray(m)) m = m.join(v), m &&= this.extendTranslation(m, t, i, r);
790
+ else {
791
+ let e = !1, n = !1;
792
+ !this.isValidLookup(m) && x && (e = !0, m = T), this.isValidLookup(m) || (n = !0, m = s);
793
+ let a = (i.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && n ? void 0 : m, c = x && T !== m && this.options.updateMissing;
794
+ if (n || e || c) {
795
+ if (this.logger.log(c ? "updateKey" : "missingKey", d, l, s, c ? T : m), o) {
796
+ let e = this.resolve(s, {
797
+ ...i,
798
+ keySeparator: !1
799
+ });
800
+ 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.");
801
+ }
802
+ let e = [], t = this.languageUtils.getFallbackCodes(this.options.fallbackLng, i.lng || this.language);
803
+ if (this.options.saveMissingTo === "fallback" && t && t[0]) for (let n = 0; n < t.length; n++) e.push(t[n]);
804
+ else this.options.saveMissingTo === "all" ? e = this.languageUtils.toResolveHierarchy(i.lng || this.language) : e.push(i.lng || this.language);
805
+ let n = (e, t, n) => {
806
+ let r = x && n !== m ? n : a;
807
+ 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, m);
808
+ };
809
+ this.options.saveMissing && (this.options.saveMissingPlurals && b ? e.forEach((e) => {
810
+ let t = this.pluralResolver.getSuffixes(e, i);
811
+ w && i[`defaultValue${this.options.pluralSeparator}zero`] && t.indexOf(`${this.options.pluralSeparator}zero`) < 0 && t.push(`${this.options.pluralSeparator}zero`), t.forEach((t) => {
812
+ n([e], s + t, i[`defaultValue${t}`] || T);
813
+ });
814
+ }) : n(e, s, T));
815
+ }
816
+ m = this.extendTranslation(m, t, i, p, r), n && m === s && this.options.appendNamespaceToMissingKey && (m = `${l}${u}${s}`), (n || e) && this.options.parseMissingKeyHandler && (m = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${l}${u}${s}` : s, e ? m : void 0, i));
817
+ }
818
+ return a ? (p.res = m, p.usedParams = this.getUsedParamsDetails(i), p) : m;
819
+ }
820
+ extendTranslation(e, t, n, r, i) {
821
+ if (this.i18nFormat?.parse) e = this.i18nFormat.parse(e, {
822
+ ...this.options.interpolation.defaultVariables,
823
+ ...n
824
+ }, n.lng || this.language || r.usedLng, r.usedNS, r.usedKey, { resolved: r });
825
+ else if (!n.skipInterpolation) {
826
+ n.interpolation && this.interpolator.init({
827
+ ...n,
828
+ interpolation: {
829
+ ...this.options.interpolation,
830
+ ...n.interpolation
831
+ }
832
+ });
833
+ let a = k(e) && (n?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : n.interpolation.skipOnVariables), o;
834
+ if (a) {
835
+ let t = e.match(this.interpolator.nestingRegexp);
836
+ o = t && t.length;
837
+ }
838
+ let s = n.replace && !k(n.replace) ? n.replace : n;
839
+ if (this.options.interpolation.defaultVariables && (s = {
840
+ ...this.options.interpolation.defaultVariables,
841
+ ...s
842
+ }), e = this.interpolator.interpolate(e, s, n.lng || this.language || r.usedLng, n), a) {
843
+ let t = e.match(this.interpolator.nestingRegexp), r = t && t.length;
844
+ o < r && (n.nest = !1);
845
+ }
846
+ !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();
847
+ }
848
+ let a = n.postProcess || this.options.postProcess, o = k(a) ? [a] : a;
849
+ return e != null && o?.length && n.applyPostProcessor !== !1 && (e = be.handle(o, e, t, this.options && this.options.postProcessPassResolved ? {
850
+ i18nResolved: {
851
+ ...r,
852
+ usedParams: this.getUsedParamsDetails(n)
853
+ },
854
+ ...n
855
+ } : n, this)), e;
856
+ }
857
+ resolve(e, t = {}) {
858
+ let n, r, i, a, o;
859
+ return k(e) && (e = [e]), Array.isArray(e) && (e = e.map((e) => typeof e == "function" ? R(e, {
860
+ ...this.options,
861
+ ...t
862
+ }) : e)), e.forEach((e) => {
863
+ if (this.isValidLookup(n)) return;
864
+ let s = this.extractFromKey(e, t), c = s.key;
865
+ r = c;
866
+ let l = s.namespaces;
867
+ this.options.fallbackNS && (l = l.concat(this.options.fallbackNS));
868
+ let u = t.count !== void 0 && !k(t.count), d = u && !t.ordinal && t.count === 0, f = t.context !== void 0 && (k(t.context) || typeof t.context == "number") && t.context !== "", p = t.lngs ? t.lngs : this.languageUtils.toResolveHierarchy(t.lng || this.language, t.fallbackLng);
869
+ l.forEach((e) => {
870
+ this.isValidLookup(n) || (o = e, !Ce[`${p[0]}-${e}`] && this.utils?.hasLoadedNamespace && !this.utils?.hasLoadedNamespace(o) && (Ce[`${p[0]}-${e}`] = !0, this.logger.warn(`key "${r}" for languages "${p.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!!!")), p.forEach((r) => {
871
+ if (this.isValidLookup(n)) return;
872
+ a = r;
873
+ let o = [c];
874
+ if (this.i18nFormat?.addLookupKeys) this.i18nFormat.addLookupKeys(o, c, r, e, t);
875
+ else {
876
+ let e;
877
+ u && (e = this.pluralResolver.getSuffix(r, t.count, t));
878
+ let n = `${this.options.pluralSeparator}zero`, i = `${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;
879
+ if (u && (t.ordinal && e.indexOf(i) === 0 && o.push(c + e.replace(i, this.options.pluralSeparator)), o.push(c + e), d && o.push(c + n)), f) {
880
+ let r = `${c}${this.options.contextSeparator || "_"}${t.context}`;
881
+ o.push(r), u && (t.ordinal && e.indexOf(i) === 0 && o.push(r + e.replace(i, this.options.pluralSeparator)), o.push(r + e), d && o.push(r + n));
882
+ }
883
+ }
884
+ let s;
885
+ for (; s = o.pop();) this.isValidLookup(n) || (i = s, n = this.getResource(r, e, s, t));
886
+ }));
887
+ });
888
+ }), {
889
+ res: n,
890
+ usedKey: r,
891
+ exactUsedKey: i,
892
+ usedLng: a,
893
+ usedNS: o
894
+ };
895
+ }
896
+ isValidLookup(e) {
897
+ return e !== void 0 && !(!this.options.returnNull && e === null) && !(!this.options.returnEmptyString && e === "");
898
+ }
899
+ getResource(e, t, n, r = {}) {
900
+ return this.i18nFormat?.getResource ? this.i18nFormat.getResource(e, t, n, r) : this.resourceStore.getResource(e, t, n, r);
901
+ }
902
+ getUsedParamsDetails(e = {}) {
903
+ let t = [
904
+ "defaultValue",
905
+ "ordinal",
906
+ "context",
907
+ "replace",
908
+ "lng",
909
+ "lngs",
910
+ "fallbackLng",
911
+ "ns",
912
+ "keySeparator",
913
+ "nsSeparator",
914
+ "returnObjects",
915
+ "returnDetails",
916
+ "joinArrays",
917
+ "postProcess",
918
+ "interpolation"
919
+ ], n = e.replace && !k(e.replace), r = n ? e.replace : e;
920
+ if (n && e.count !== void 0 && (r.count = e.count), this.options.interpolation.defaultVariables && (r = {
921
+ ...this.options.interpolation.defaultVariables,
922
+ ...r
923
+ }), !n) {
924
+ r = { ...r };
925
+ for (let e of t) delete r[e];
926
+ }
927
+ return r;
928
+ }
929
+ static hasDefaultValue(e) {
930
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t) && t.substring(0, 12) === "defaultValue" && e[t] !== void 0) return !0;
931
+ return !1;
932
+ }
933
+ }, we = class {
934
+ constructor(e) {
935
+ this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = I.create("languageUtils");
936
+ }
937
+ getScriptPartFromCode(e) {
938
+ if (e = F(e), !e || e.indexOf("-") < 0) return null;
939
+ let t = e.split("-");
940
+ return t.length === 2 || (t.pop(), t[t.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(t.join("-"));
941
+ }
942
+ getLanguagePartFromCode(e) {
943
+ if (e = F(e), !e || e.indexOf("-") < 0) return e;
944
+ let t = e.split("-");
945
+ return this.formatLanguageCode(t[0]);
946
+ }
947
+ formatLanguageCode(e) {
948
+ if (k(e) && e.indexOf("-") > -1) {
949
+ let t;
950
+ try {
951
+ t = Intl.getCanonicalLocales(e)[0];
952
+ } catch {}
953
+ return t && this.options.lowerCaseLng && (t = t.toLowerCase()), t || (this.options.lowerCaseLng ? e.toLowerCase() : e);
954
+ }
955
+ return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
956
+ }
957
+ isSupportedCode(e) {
958
+ return (this.options.load === "languageOnly" || this.options.nonExplicitSupportedLngs) && (e = this.getLanguagePartFromCode(e)), !this.supportedLngs || !this.supportedLngs.length || this.supportedLngs.indexOf(e) > -1;
959
+ }
960
+ getBestMatchFromCodes(e) {
961
+ if (!e) return null;
962
+ let t;
963
+ return e.forEach((e) => {
964
+ if (t) return;
965
+ let n = this.formatLanguageCode(e);
966
+ (!this.options.supportedLngs || this.isSupportedCode(n)) && (t = n);
967
+ }), !t && this.options.supportedLngs && e.forEach((e) => {
968
+ if (t) return;
969
+ let n = this.getScriptPartFromCode(e);
970
+ if (this.isSupportedCode(n)) return t = n;
971
+ let r = this.getLanguagePartFromCode(e);
972
+ if (this.isSupportedCode(r)) return t = r;
973
+ t = this.options.supportedLngs.find((e) => {
974
+ 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;
975
+ });
976
+ }), t ||= this.getFallbackCodes(this.options.fallbackLng)[0], t;
977
+ }
978
+ getFallbackCodes(e, t) {
979
+ if (!e) return [];
980
+ if (typeof e == "function" && (e = e(t)), k(e) && (e = [e]), Array.isArray(e)) return e;
981
+ if (!t) return e.default || [];
982
+ let n = e[t];
983
+ return n ||= e[this.getScriptPartFromCode(t)], n ||= e[this.formatLanguageCode(t)], n ||= e[this.getLanguagePartFromCode(t)], n ||= e.default, n || [];
984
+ }
985
+ toResolveHierarchy(e, t) {
986
+ let n = this.getFallbackCodes((t === !1 ? [] : t) || this.options.fallbackLng || [], e), r = [], i = (e) => {
987
+ e && (this.isSupportedCode(e) ? r.push(e) : this.logger.warn(`rejecting language code not found in supportedLngs: ${e}`));
988
+ };
989
+ return k(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))) : k(e) && i(this.formatLanguageCode(e)), n.forEach((e) => {
990
+ r.indexOf(e) < 0 && i(this.formatLanguageCode(e));
991
+ }), r;
992
+ }
993
+ }, Te = {
994
+ zero: 0,
995
+ one: 1,
996
+ two: 2,
997
+ few: 3,
998
+ many: 4,
999
+ other: 5
1000
+ }, Ee = {
1001
+ select: (e) => e === 1 ? "one" : "other",
1002
+ resolvedOptions: () => ({ pluralCategories: ["one", "other"] })
1003
+ }, De = class {
1004
+ constructor(e, t = {}) {
1005
+ this.languageUtils = e, this.options = t, this.logger = I.create("pluralResolver"), this.pluralRulesCache = {};
1006
+ }
1007
+ clearCache() {
1008
+ this.pluralRulesCache = {};
1009
+ }
1010
+ getRule(e, t = {}) {
1011
+ let n = F(e === "dev" ? "en" : e), r = t.ordinal ? "ordinal" : "cardinal", i = JSON.stringify({
1012
+ cleanedCode: n,
1013
+ type: r
1014
+ });
1015
+ if (i in this.pluralRulesCache) return this.pluralRulesCache[i];
1016
+ let a;
1017
+ try {
1018
+ a = new Intl.PluralRules(n, { type: r });
1019
+ } catch {
1020
+ if (typeof Intl > "u") return this.logger.error("No Intl support, please use an Intl polyfill!"), Ee;
1021
+ if (!e.match(/-|_/)) return Ee;
1022
+ let n = this.languageUtils.getLanguagePartFromCode(e);
1023
+ a = this.getRule(n, t);
1024
+ }
1025
+ return this.pluralRulesCache[i] = a, a;
1026
+ }
1027
+ needsPlural(e, t = {}) {
1028
+ let n = this.getRule(e, t);
1029
+ return n ||= this.getRule("dev", t), n?.resolvedOptions().pluralCategories.length > 1;
1030
+ }
1031
+ getPluralFormsOfKey(e, t, n = {}) {
1032
+ return this.getSuffixes(e, n).map((e) => `${t}${e}`);
1033
+ }
1034
+ getSuffixes(e, t = {}) {
1035
+ let n = this.getRule(e, t);
1036
+ return n ||= this.getRule("dev", t), n ? n.resolvedOptions().pluralCategories.sort((e, t) => Te[e] - Te[t]).map((e) => `${this.options.prepend}${t.ordinal ? `ordinal${this.options.prepend}` : ""}${e}`) : [];
1037
+ }
1038
+ getSuffix(e, t, n = {}) {
1039
+ let r = this.getRule(e, n);
1040
+ 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));
1041
+ }
1042
+ }, Oe = (e, t, n, r = ".", i = !0) => {
1043
+ let a = ue(e, t, n);
1044
+ return !a && i && k(n) && (a = P(e, n, r), a === void 0 && (a = P(t, n, r))), a;
1045
+ }, V = (e) => e.replace(/\$/g, "$$$$"), ke = class {
1046
+ constructor(e = {}) {
1047
+ this.logger = I.create("interpolator"), this.options = e, this.format = e?.interpolation?.format || ((e) => e), this.init(e);
1048
+ }
1049
+ init(e = {}) {
1050
+ e.interpolation ||= { escapeValue: !0 };
1051
+ 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;
1052
+ this.escape = t === void 0 ? pe : t, this.escapeValue = n === void 0 || n, this.useRawValueToEscape = r !== void 0 && r, this.prefix = i ? N(i) : a || "{{", this.suffix = o ? N(o) : s || "}}", this.formatSeparator = c || ",", this.unescapePrefix = l ? "" : u || "-", this.unescapeSuffix = this.unescapePrefix ? "" : l || "", this.nestingPrefix = d ? N(d) : f || N("$t("), this.nestingSuffix = p ? N(p) : m || N(")"), this.nestingOptionsSeparator = h || ",", this.maxReplaces = g || 1e3, this.alwaysFormat = _ !== void 0 && _, this.resetRegExp();
1053
+ }
1054
+ reset() {
1055
+ this.options && this.init(this.options);
1056
+ }
1057
+ resetRegExp() {
1058
+ let e = (e, t) => e?.source === t ? (e.lastIndex = 0, e) : new RegExp(t, "g");
1059
+ 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}`);
1060
+ }
1061
+ interpolate(e, t, n, r) {
1062
+ let i, a, o, s = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {}, c = (e) => {
1063
+ if (e.indexOf(this.formatSeparator) < 0) {
1064
+ let i = Oe(t, s, e, this.options.keySeparator, this.options.ignoreJSONStructure);
1065
+ return this.alwaysFormat ? this.format(i, void 0, n, {
1066
+ ...r,
1067
+ ...t,
1068
+ interpolationkey: e
1069
+ }) : i;
1070
+ }
1071
+ let i = e.split(this.formatSeparator), a = i.shift().trim(), o = i.join(this.formatSeparator).trim();
1072
+ return this.format(Oe(t, s, a, this.options.keySeparator, this.options.ignoreJSONStructure), o, n, {
1073
+ ...r,
1074
+ ...t,
1075
+ interpolationkey: a
1076
+ });
1077
+ };
1078
+ this.resetRegExp();
1079
+ let l = r?.missingInterpolationHandler || this.options.missingInterpolationHandler, u = r?.interpolation?.skipOnVariables === void 0 ? this.options.interpolation.skipOnVariables : r.interpolation.skipOnVariables;
1080
+ return [{
1081
+ regex: this.regexpUnescape,
1082
+ safeValue: (e) => V(e)
1083
+ }, {
1084
+ regex: this.regexp,
1085
+ safeValue: (e) => this.escapeValue ? V(this.escape(e)) : V(e)
1086
+ }].forEach((t) => {
1087
+ for (o = 0; i = t.regex.exec(e);) {
1088
+ let n = i[1].trim();
1089
+ if (a = c(n), a === void 0) if (typeof l == "function") {
1090
+ let t = l(e, i, r);
1091
+ a = k(t) ? t : "";
1092
+ } else if (r && Object.prototype.hasOwnProperty.call(r, n)) a = "";
1093
+ else if (u) {
1094
+ a = i[0];
1095
+ continue;
1096
+ } else this.logger.warn(`missed to pass in variable ${n} for interpolating ${e}`), a = "";
1097
+ else !k(a) && !this.useRawValueToEscape && (a = re(a));
1098
+ let s = t.safeValue(a);
1099
+ if (e = e.replace(i[0], s), u ? (t.regex.lastIndex += a.length, t.regex.lastIndex -= i[0].length) : t.regex.lastIndex = 0, o++, o >= this.maxReplaces) break;
1100
+ }
1101
+ }), e;
1102
+ }
1103
+ nest(e, t, n = {}) {
1104
+ let r, i, a, o = (e, t) => {
1105
+ let n = this.nestingOptionsSeparator;
1106
+ if (e.indexOf(n) < 0) return e;
1107
+ let r = e.split(RegExp(`${N(n)}[ ]*{`)), i = `{${r[1]}`;
1108
+ e = r[0], i = this.interpolate(i, a);
1109
+ let o = i.match(/'/g), s = i.match(/"/g);
1110
+ ((o?.length ?? 0) % 2 == 0 && !s || (s?.length ?? 0) % 2 != 0) && (i = i.replace(/'/g, "\""));
1111
+ try {
1112
+ a = JSON.parse(i), t && (a = {
1113
+ ...t,
1114
+ ...a
1115
+ });
1116
+ } catch (t) {
1117
+ return this.logger.warn(`failed parsing options string in nesting for key ${e}`, t), `${e}${n}${i}`;
1118
+ }
1119
+ return a.defaultValue && a.defaultValue.indexOf(this.prefix) > -1 && delete a.defaultValue, e;
1120
+ };
1121
+ for (; r = this.nestingRegexp.exec(e);) {
1122
+ let s = [];
1123
+ a = { ...n }, a = a.replace && !k(a.replace) ? a.replace : a, a.applyPostProcessor = !1, delete a.defaultValue;
1124
+ let c = /{.*}/.test(r[1]) ? r[1].lastIndexOf("}") + 1 : r[1].indexOf(this.formatSeparator);
1125
+ 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 && !k(i)) return i;
1126
+ k(i) || (i = re(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, {
1127
+ ...n,
1128
+ interpolationkey: r[1].trim()
1129
+ }), i.trim())), e = e.replace(r[0], i), this.regexp.lastIndex = 0;
1130
+ }
1131
+ return e;
1132
+ }
1133
+ }, Ae = (e) => {
1134
+ let t = e.toLowerCase().trim(), n = {};
1135
+ if (e.indexOf("(") > -1) {
1136
+ let r = e.split("(");
1137
+ t = r[0].toLowerCase().trim();
1138
+ let i = r[1].substring(0, r[1].length - 1);
1139
+ t === "currency" && i.indexOf(":") < 0 ? n.currency ||= i.trim() : t === "relativetime" && i.indexOf(":") < 0 ? n.range ||= i.trim() : i.split(";").forEach((e) => {
1140
+ if (e) {
1141
+ let [t, ...r] = e.split(":"), i = r.join(":").trim().replace(/^'+|'+$/g, ""), a = t.trim();
1142
+ n[a] || (n[a] = i), i === "false" && (n[a] = !1), i === "true" && (n[a] = !0), isNaN(i) || (n[a] = parseInt(i, 10));
1143
+ }
1144
+ });
1145
+ }
1146
+ return {
1147
+ formatName: t,
1148
+ formatOptions: n
1149
+ };
1150
+ }, je = (e) => {
1151
+ let t = {};
1152
+ return (n, r, i) => {
1153
+ let a = i;
1154
+ i && i.interpolationkey && i.formatParams && i.formatParams[i.interpolationkey] && i[i.interpolationkey] && (a = {
1155
+ ...a,
1156
+ [i.interpolationkey]: void 0
1157
+ });
1158
+ let o = r + JSON.stringify(a), s = t[o];
1159
+ return s || (s = e(F(r), i), t[o] = s), s(n);
1160
+ };
1161
+ }, Me = (e) => (t, n, r) => e(F(n), r)(t), Ne = class {
1162
+ constructor(e = {}) {
1163
+ this.logger = I.create("formatter"), this.options = e, this.init(e);
1164
+ }
1165
+ init(e, t = { interpolation: {} }) {
1166
+ this.formatSeparator = t.interpolation.formatSeparator || ",";
1167
+ let n = t.cacheInBuiltFormats ? je : Me;
1168
+ this.formats = {
1169
+ number: n((e, t) => {
1170
+ let n = new Intl.NumberFormat(e, { ...t });
1171
+ return (e) => n.format(e);
1172
+ }),
1173
+ currency: n((e, t) => {
1174
+ let n = new Intl.NumberFormat(e, {
1175
+ ...t,
1176
+ style: "currency"
1177
+ });
1178
+ return (e) => n.format(e);
1179
+ }),
1180
+ datetime: n((e, t) => {
1181
+ let n = new Intl.DateTimeFormat(e, { ...t });
1182
+ return (e) => n.format(e);
1183
+ }),
1184
+ relativetime: n((e, t) => {
1185
+ let n = new Intl.RelativeTimeFormat(e, { ...t });
1186
+ return (e) => n.format(e, t.range || "day");
1187
+ }),
1188
+ list: n((e, t) => {
1189
+ let n = new Intl.ListFormat(e, { ...t });
1190
+ return (e) => n.format(e);
1191
+ })
1192
+ };
1193
+ }
1194
+ add(e, t) {
1195
+ this.formats[e.toLowerCase().trim()] = t;
1196
+ }
1197
+ addCached(e, t) {
1198
+ this.formats[e.toLowerCase().trim()] = je(t);
1199
+ }
1200
+ format(e, t, n, r = {}) {
1201
+ let i = t.split(this.formatSeparator);
1202
+ if (i.length > 1 && i[0].indexOf("(") > 1 && i[0].indexOf(")") < 0 && i.find((e) => e.indexOf(")") > -1)) {
1203
+ let e = i.findIndex((e) => e.indexOf(")") > -1);
1204
+ i[0] = [i[0], ...i.splice(1, e)].join(this.formatSeparator);
1205
+ }
1206
+ return i.reduce((e, t) => {
1207
+ let { formatName: i, formatOptions: a } = Ae(t);
1208
+ if (this.formats[i]) {
1209
+ let t = e;
1210
+ try {
1211
+ let o = r?.formatParams?.[r.interpolationkey] || {}, s = o.locale || o.lng || r.locale || r.lng || n;
1212
+ t = this.formats[i](e, s, {
1213
+ ...a,
1214
+ ...r,
1215
+ ...o
1216
+ });
1217
+ } catch (e) {
1218
+ this.logger.warn(e);
1219
+ }
1220
+ return t;
1221
+ } else this.logger.warn(`there was no format function for ${i}`);
1222
+ return e;
1223
+ }, e);
1224
+ }
1225
+ }, Pe = (e, t) => {
1226
+ e.pending[t] !== void 0 && (delete e.pending[t], e.pendingCount--);
1227
+ }, Fe = class extends L {
1228
+ constructor(e, t, n, r = {}) {
1229
+ super(), this.backend = e, this.store = t, this.services = n, this.languageUtils = n.languageUtils, this.options = r, this.logger = I.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);
1230
+ }
1231
+ queueLoad(e, t, n, r) {
1232
+ let i = {}, a = {}, o = {}, s = {};
1233
+ return e.forEach((e) => {
1234
+ let r = !0;
1235
+ t.forEach((t) => {
1236
+ let o = `${e}|${t}`;
1237
+ !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)));
1238
+ }), r || (o[e] = !0);
1239
+ }), (Object.keys(i).length || Object.keys(a).length) && this.queue.push({
1240
+ pending: a,
1241
+ pendingCount: Object.keys(a).length,
1242
+ loaded: {},
1243
+ errors: [],
1244
+ callback: r
1245
+ }), {
1246
+ toLoad: Object.keys(i),
1247
+ pending: Object.keys(a),
1248
+ toLoadLanguages: Object.keys(o),
1249
+ toLoadNamespaces: Object.keys(s)
1250
+ };
1251
+ }
1252
+ loaded(e, t, n) {
1253
+ let r = e.split("|"), i = r[0], a = r[1];
1254
+ 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);
1255
+ let o = {};
1256
+ this.queue.forEach((n) => {
1257
+ le(n.loaded, [i], a), Pe(n, e), t && n.errors.push(t), n.pendingCount === 0 && !n.done && (Object.keys(n.loaded).forEach((e) => {
1258
+ o[e] || (o[e] = {});
1259
+ let t = n.loaded[e];
1260
+ t.length && t.forEach((t) => {
1261
+ o[e][t] === void 0 && (o[e][t] = !0);
1262
+ });
1263
+ }), n.done = !0, n.errors.length ? n.callback(n.errors) : n.callback());
1264
+ }), this.emit("loaded", o), this.queue = this.queue.filter((e) => !e.done);
1265
+ }
1266
+ read(e, t, n, r = 0, i = this.retryTimeout, a) {
1267
+ if (!e.length) return a(null, {});
1268
+ if (this.readingCalls >= this.maxParallelReads) {
1269
+ this.waitingReads.push({
1270
+ lng: e,
1271
+ ns: t,
1272
+ fcName: n,
1273
+ tried: r,
1274
+ wait: i,
1275
+ callback: a
1276
+ });
1277
+ return;
1278
+ }
1279
+ this.readingCalls++;
1280
+ let o = (o, s) => {
1281
+ if (this.readingCalls--, this.waitingReads.length > 0) {
1282
+ let e = this.waitingReads.shift();
1283
+ this.read(e.lng, e.ns, e.fcName, e.tried, e.wait, e.callback);
1284
+ }
1285
+ if (o && s && r < this.maxRetries) {
1286
+ setTimeout(() => {
1287
+ this.read.call(this, e, t, n, r + 1, i * 2, a);
1288
+ }, i);
1289
+ return;
1290
+ }
1291
+ a(o, s);
1292
+ }, s = this.backend[n].bind(this.backend);
1293
+ if (s.length === 2) {
1294
+ try {
1295
+ let n = s(e, t);
1296
+ n && typeof n.then == "function" ? n.then((e) => o(null, e)).catch(o) : o(null, n);
1297
+ } catch (e) {
1298
+ o(e);
1299
+ }
1300
+ return;
1301
+ }
1302
+ return s(e, t, o);
1303
+ }
1304
+ prepareLoading(e, t, n = {}, r) {
1305
+ if (!this.backend) return this.logger.warn("No backend was added via i18next.use. Will not load resources."), r && r();
1306
+ k(e) && (e = this.languageUtils.toResolveHierarchy(e)), k(t) && (t = [t]);
1307
+ let i = this.queueLoad(e, t, n, r);
1308
+ if (!i.toLoad.length) return i.pending.length || r(), null;
1309
+ i.toLoad.forEach((e) => {
1310
+ this.loadOne(e);
1311
+ });
1312
+ }
1313
+ load(e, t, n) {
1314
+ this.prepareLoading(e, t, {}, n);
1315
+ }
1316
+ reload(e, t, n) {
1317
+ this.prepareLoading(e, t, { reload: !0 }, n);
1318
+ }
1319
+ loadOne(e, t = "") {
1320
+ let n = e.split("|"), r = n[0], i = n[1];
1321
+ this.read(r, i, "read", void 0, void 0, (n, a) => {
1322
+ 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);
1323
+ });
1324
+ }
1325
+ saveMissing(e, t, n, r, i, a = {}, o = () => {}) {
1326
+ if (this.services?.utils?.hasLoadedNamespace && !this.services?.utils?.hasLoadedNamespace(t)) {
1327
+ 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!!!");
1328
+ return;
1329
+ }
1330
+ if (!(n == null || n === "")) {
1331
+ if (this.backend?.create) {
1332
+ let s = {
1333
+ ...a,
1334
+ isUpdate: i
1335
+ }, c = this.backend.create.bind(this.backend);
1336
+ if (c.length < 6) try {
1337
+ let i;
1338
+ 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);
1339
+ } catch (e) {
1340
+ o(e);
1341
+ }
1342
+ else c(e, t, n, r, o, s);
1343
+ }
1344
+ !e || !e[0] || this.store.addResource(e[0], t, n, r);
1345
+ }
1346
+ }
1347
+ }, H = () => ({
1348
+ debug: !1,
1349
+ initAsync: !0,
1350
+ ns: ["translation"],
1351
+ defaultNS: ["translation"],
1352
+ fallbackLng: ["dev"],
1353
+ fallbackNS: !1,
1354
+ supportedLngs: !1,
1355
+ nonExplicitSupportedLngs: !1,
1356
+ load: "all",
1357
+ preload: !1,
1358
+ simplifyPluralSuffix: !0,
1359
+ keySeparator: ".",
1360
+ nsSeparator: ":",
1361
+ pluralSeparator: "_",
1362
+ contextSeparator: "_",
1363
+ partialBundledLanguages: !1,
1364
+ saveMissing: !1,
1365
+ updateMissing: !1,
1366
+ saveMissingTo: "fallback",
1367
+ saveMissingPlurals: !0,
1368
+ missingKeyHandler: !1,
1369
+ missingInterpolationHandler: !1,
1370
+ postProcess: !1,
1371
+ postProcessPassResolved: !1,
1372
+ returnNull: !1,
1373
+ returnEmptyString: !0,
1374
+ returnObjects: !1,
1375
+ joinArrays: !1,
1376
+ returnedObjectHandler: !1,
1377
+ parseMissingKeyHandler: !1,
1378
+ appendNamespaceToMissingKey: !1,
1379
+ appendNamespaceToCIMode: !1,
1380
+ overloadTranslationOptionHandler: (e) => {
1381
+ let t = {};
1382
+ if (typeof e[1] == "object" && (t = e[1]), k(e[1]) && (t.defaultValue = e[1]), k(e[2]) && (t.tDescription = e[2]), typeof e[2] == "object" || typeof e[3] == "object") {
1383
+ let n = e[3] || e[2];
1384
+ Object.keys(n).forEach((e) => {
1385
+ t[e] = n[e];
1386
+ });
1387
+ }
1388
+ return t;
1389
+ },
1390
+ interpolation: {
1391
+ escapeValue: !0,
1392
+ format: (e) => e,
1393
+ prefix: "{{",
1394
+ suffix: "}}",
1395
+ formatSeparator: ",",
1396
+ unescapePrefix: "-",
1397
+ nestingPrefix: "$t(",
1398
+ nestingSuffix: ")",
1399
+ nestingOptionsSeparator: ",",
1400
+ maxReplaces: 1e3,
1401
+ skipOnVariables: !0
1402
+ },
1403
+ cacheInBuiltFormats: !0
1404
+ }), Ie = (e) => (k(e.ns) && (e.ns = [e.ns]), k(e.fallbackLng) && (e.fallbackLng = [e.fallbackLng]), k(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), U = () => {}, Le = (e) => {
1405
+ Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach((t) => {
1406
+ typeof e[t] == "function" && (e[t] = e[t].bind(e));
1407
+ });
1408
+ }, Re = "__i18next_supportNoticeShown", ze = () => !!(typeof globalThis < "u" && globalThis[Re] || typeof process < "u" && process.env && process.env.I18NEXT_NO_SUPPORT_NOTICE || typeof process < "u" && process.env), Be = () => {
1409
+ typeof globalThis < "u" && (globalThis[Re] = !0);
1410
+ }, Ve = (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)), W = class e extends L {
1411
+ constructor(e = {}, t) {
1412
+ if (super(), this.options = Ie(e), this.services = {}, this.logger = I, this.modules = { external: [] }, Le(this), t && !this.isInitialized && !e.isClone) {
1413
+ if (!this.options.initAsync) return this.init(e, t), this;
1414
+ setTimeout(() => {
1415
+ this.init(e, t);
1416
+ }, 0);
1417
+ }
1418
+ }
1419
+ init(e = {}, t) {
1420
+ this.isInitializing = !0, typeof e == "function" && (t = e, e = {}), e.defaultNS == null && e.ns && (k(e.ns) ? e.defaultNS = e.ns : e.ns.indexOf("translation") < 0 && (e.defaultNS = e.ns[0]));
1421
+ let n = H();
1422
+ this.options = {
1423
+ ...n,
1424
+ ...this.options,
1425
+ ...Ie(e)
1426
+ }, this.options.interpolation = {
1427
+ ...n.interpolation,
1428
+ ...this.options.interpolation
1429
+ }, 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 && !Ve(this) && !ze() && (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 💙"), Be());
1430
+ let r = (e) => e ? typeof e == "function" ? new e() : e : null;
1431
+ if (!this.options.isClone) {
1432
+ this.modules.logger ? I.init(r(this.modules.logger), this.options) : I.init(null, this.options);
1433
+ let e;
1434
+ e = this.modules.formatter ? this.modules.formatter : Ne;
1435
+ let t = new we(this.options);
1436
+ this.store = new ye(this.options.resources, this.options);
1437
+ let i = this.services;
1438
+ i.logger = I, i.resourceStore = this.store, i.languageUtils = t, i.pluralResolver = new De(t, {
1439
+ prepend: this.options.pluralSeparator,
1440
+ simplifyPluralSuffix: this.options.simplifyPluralSuffix
1441
+ }), 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 ke(this.options), i.utils = { hasLoadedNamespace: this.hasLoadedNamespace.bind(this) }, i.backendConnector = new Fe(r(this.modules.backend), i.resourceStore, i, this.options), i.backendConnector.on("*", (e, ...t) => {
1442
+ this.emit(e, ...t);
1443
+ }), 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) => {
1444
+ this.emit(e, ...t);
1445
+ }), this.modules.external.forEach((e) => {
1446
+ e.init && e.init(this);
1447
+ });
1448
+ }
1449
+ if (this.format = this.options.interpolation.format, t ||= U, this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
1450
+ let e = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
1451
+ e.length > 0 && e[0] !== "dev" && (this.options.lng = e[0]);
1452
+ }
1453
+ !this.services.languageDetector && !this.options.lng && this.logger.warn("init: no languageDetector is used and no lng is defined"), [
1454
+ "getResource",
1455
+ "hasResourceBundle",
1456
+ "getResourceBundle",
1457
+ "getDataByLanguage"
1458
+ ].forEach((e) => {
1459
+ this[e] = (...t) => this.store[e](...t);
1460
+ }), [
1461
+ "addResource",
1462
+ "addResources",
1463
+ "addResourceBundle",
1464
+ "removeResourceBundle"
1465
+ ].forEach((e) => {
1466
+ this[e] = (...t) => (this.store[e](...t), this);
1467
+ });
1468
+ let i = A(), a = () => {
1469
+ let e = (e, n) => {
1470
+ 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);
1471
+ };
1472
+ if (this.languages && !this.isInitialized) return e(null, this.t.bind(this));
1473
+ this.changeLanguage(this.options.lng, e);
1474
+ };
1475
+ return this.options.resources || !this.options.initAsync ? a() : setTimeout(a, 0), i;
1476
+ }
1477
+ loadResources(e, t = U) {
1478
+ let n = t, r = k(e) ? e : this.language;
1479
+ if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
1480
+ if (r?.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0)) return n();
1481
+ let e = [], t = (t) => {
1482
+ t && t !== "cimode" && this.services.languageUtils.toResolveHierarchy(t).forEach((t) => {
1483
+ t !== "cimode" && e.indexOf(t) < 0 && e.push(t);
1484
+ });
1485
+ };
1486
+ 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) => {
1487
+ !e && !this.resolvedLanguage && this.language && this.setResolvedLanguage(this.language), n(e);
1488
+ });
1489
+ } else n(null);
1490
+ }
1491
+ reloadResources(e, t, n) {
1492
+ let r = A();
1493
+ 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 ||= U, this.services.backendConnector.reload(e, t, (e) => {
1494
+ r.resolve(), n(e);
1495
+ }), r;
1496
+ }
1497
+ use(e) {
1498
+ if (!e) throw Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
1499
+ if (!e.type) throw Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
1500
+ 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" && be.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
1501
+ }
1502
+ setResolvedLanguage(e) {
1503
+ if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1)) {
1504
+ for (let e = 0; e < this.languages.length; e++) {
1505
+ let t = this.languages[e];
1506
+ if (!(["cimode", "dev"].indexOf(t) > -1) && this.store.hasLanguageSomeTranslations(t)) {
1507
+ this.resolvedLanguage = t;
1508
+ break;
1509
+ }
1510
+ }
1511
+ !this.resolvedLanguage && this.languages.indexOf(e) < 0 && this.store.hasLanguageSomeTranslations(e) && (this.resolvedLanguage = e, this.languages.unshift(e));
1512
+ }
1513
+ }
1514
+ changeLanguage(e, t) {
1515
+ this.isLanguageChangingTo = e;
1516
+ let n = A();
1517
+ this.emit("languageChanging", e);
1518
+ let r = (e) => {
1519
+ this.language = e, this.languages = this.services.languageUtils.toResolveHierarchy(e), this.resolvedLanguage = void 0, this.setResolvedLanguage(e);
1520
+ }, i = (i, a) => {
1521
+ 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));
1522
+ }, a = (t) => {
1523
+ !e && !t && this.services.languageDetector && (t = []);
1524
+ let n = k(t) ? t : t && t[0], a = this.store.hasLanguageSomeTranslations(n) ? n : this.services.languageUtils.getBestMatchFromCodes(k(t) ? [t] : t);
1525
+ a && (this.language || r(a), this.translator.language || this.translator.changeLanguage(a), this.services.languageDetector?.cacheUserLanguage?.(a)), this.loadResources(a, (e) => {
1526
+ i(e, a);
1527
+ });
1528
+ };
1529
+ 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;
1530
+ }
1531
+ getFixedT(e, t, n) {
1532
+ let r = (e, t, ...i) => {
1533
+ let a;
1534
+ 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);
1535
+ let o = {
1536
+ ...this.options,
1537
+ ...a
1538
+ };
1539
+ typeof a.keyPrefix == "function" && (a.keyPrefix = R(a.keyPrefix, o));
1540
+ let s = this.options.keySeparator || ".", c;
1541
+ return a.keyPrefix && Array.isArray(e) ? c = e.map((e) => (typeof e == "function" && (e = R(e, o)), `${a.keyPrefix}${s}${e}`)) : (typeof e == "function" && (e = R(e, o)), c = a.keyPrefix ? `${a.keyPrefix}${s}${e}` : e), this.t(c, a);
1542
+ };
1543
+ return k(e) ? r.lng = e : r.lngs = e, r.ns = t, r.keyPrefix = n, r;
1544
+ }
1545
+ t(...e) {
1546
+ return this.translator?.translate(...e);
1547
+ }
1548
+ exists(...e) {
1549
+ return this.translator?.exists(...e);
1550
+ }
1551
+ setDefaultNamespace(e) {
1552
+ this.options.defaultNS = e;
1553
+ }
1554
+ hasLoadedNamespace(e, t = {}) {
1555
+ if (!this.isInitialized) return this.logger.warn("hasLoadedNamespace: i18next was not initialized", this.languages), !1;
1556
+ if (!this.languages || !this.languages.length) return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty", this.languages), !1;
1557
+ let n = t.lng || this.resolvedLanguage || this.languages[0], r = this.options ? this.options.fallbackLng : !1, i = this.languages[this.languages.length - 1];
1558
+ if (n.toLowerCase() === "cimode") return !0;
1559
+ let a = (e, t) => {
1560
+ let n = this.services.backendConnector.state[`${e}|${t}`];
1561
+ return n === -1 || n === 0 || n === 2;
1562
+ };
1563
+ if (t.precheck) {
1564
+ let e = t.precheck(this, a);
1565
+ if (e !== void 0) return e;
1566
+ }
1567
+ return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || a(n, e) && (!r || a(i, e)));
1568
+ }
1569
+ loadNamespaces(e, t) {
1570
+ let n = A();
1571
+ return this.options.ns ? (k(e) && (e = [e]), e.forEach((e) => {
1572
+ this.options.ns.indexOf(e) < 0 && this.options.ns.push(e);
1573
+ }), this.loadResources((e) => {
1574
+ n.resolve(), t && t(e);
1575
+ }), n) : (t && t(), Promise.resolve());
1576
+ }
1577
+ loadLanguages(e, t) {
1578
+ let n = A();
1579
+ k(e) && (e = [e]);
1580
+ let r = this.options.preload || [], i = e.filter((e) => r.indexOf(e) < 0 && this.services.languageUtils.isSupportedCode(e));
1581
+ return i.length ? (this.options.preload = r.concat(i), this.loadResources((e) => {
1582
+ n.resolve(), t && t(e);
1583
+ }), n) : (t && t(), Promise.resolve());
1584
+ }
1585
+ dir(e) {
1586
+ if (e ||= this.resolvedLanguage || (this.languages?.length > 0 ? this.languages[0] : this.language), !e) return "rtl";
1587
+ try {
1588
+ let t = new Intl.Locale(e);
1589
+ if (t && t.getTextInfo) {
1590
+ let e = t.getTextInfo();
1591
+ if (e && e.direction) return e.direction;
1592
+ }
1593
+ } catch {}
1594
+ 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 we(H());
1595
+ return e.toLowerCase().indexOf("-latn") > 1 ? "ltr" : t.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
1596
+ }
1597
+ static createInstance(t = {}, n) {
1598
+ let r = new e(t, n);
1599
+ return r.createInstance = e.createInstance, r;
1600
+ }
1601
+ cloneInstance(t = {}, n = U) {
1602
+ let r = t.forkResourceStore;
1603
+ r && delete t.forkResourceStore;
1604
+ let i = {
1605
+ ...this.options,
1606
+ ...t,
1607
+ isClone: !0
1608
+ }, a = new e(i);
1609
+ if ((t.debug !== void 0 || t.prefix !== void 0) && (a.logger = a.logger.clone(t)), [
1610
+ "store",
1611
+ "services",
1612
+ "language"
1613
+ ].forEach((e) => {
1614
+ a[e] = this[e];
1615
+ }), a.services = { ...this.services }, a.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, r && (a.store = new ye(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) {
1616
+ let e = {
1617
+ ...H().interpolation,
1618
+ ...this.options.interpolation,
1619
+ ...t.interpolation
1620
+ }, n = {
1621
+ ...i,
1622
+ interpolation: e
1623
+ };
1624
+ a.services.interpolator = new ke(n);
1625
+ }
1626
+ return a.translator = new B(a.services, i), a.translator.on("*", (e, ...t) => {
1627
+ a.emit(e, ...t);
1628
+ }), a.init(i, n), a.translator.options = i, a.translator.backendConnector.services.utils = { hasLoadedNamespace: a.hasLoadedNamespace.bind(a) }, a;
1629
+ }
1630
+ toJSON() {
1631
+ return {
1632
+ options: this.options,
1633
+ store: this.store,
1634
+ language: this.language,
1635
+ languages: this.languages,
1636
+ resolvedLanguage: this.resolvedLanguage
1637
+ };
1638
+ }
1639
+ }.createInstance();
1640
+ //#endregion
1641
+ //#region ../../shared/translator/dist/index.js
1642
+ W.createInstance, W.dir, W.init, W.loadResources, W.reloadResources, W.use, W.changeLanguage, W.getFixedT, W.t, W.exists, W.setDefaultNamespace, W.hasLoadedNamespace, W.loadNamespaces, W.loadLanguages, W.init({
1643
+ fallbackLng: "en",
1644
+ lng: "en",
1645
+ showSupportNotice: !1,
1646
+ resources: {
1647
+ en: te,
1648
+ es: ne
1649
+ }
1650
+ });
1651
+ var He = {
1652
+ translator: {
1653
+ ...W,
1654
+ t: (e, t) => {
1655
+ let { lng: n } = t;
1656
+ switch (n) {
1657
+ case "en_US":
1658
+ case "en-US":
1659
+ t.lng = "en";
1660
+ break;
1661
+ case "es_ES":
1662
+ case "es-ES":
1663
+ case "es_MX":
1664
+ case "es-MX":
1665
+ t.lng = "es";
1666
+ break;
1667
+ default: break;
1668
+ }
1669
+ return W.t(e, {
1670
+ lng: n,
1671
+ ...t
1672
+ });
1673
+ }
1674
+ },
1675
+ languageOptions: [{
1676
+ value: "en_US",
1677
+ label: "English (US)"
1678
+ }, {
1679
+ value: "es_ES",
1680
+ label: "Spanish"
1681
+ }]
1682
+ };
1683
+ //#endregion
1684
+ //#region ../../lib-react/correct-answer-toggle/dist/index.js
1685
+ function G(e) {
1686
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
1687
+ }
1688
+ function Ue(e, t) {
1689
+ return !e || G(e) ? e : G(e.default) ? e.default : t && G(e[t]) ? e[t] : t && G(e[t]?.default) ? e[t].default : e;
1690
+ }
1691
+ var We = Ue(o, "Readable") || Ue(Ke.Readable, "Readable"), Ge = r, K = Ge.default, Ke = K && typeof K == "object" ? K : Ge, { translator: q } = He, qe = {
1692
+ WebkitTouchCallout: "none",
1693
+ WebkitUserSelect: "none",
1694
+ KhtmlUserSelect: "none",
1695
+ MozUserSelect: "none",
1696
+ msUserSelect: "none",
1697
+ userSelect: "none"
1698
+ }, Je = c("div")(() => ({
1699
+ width: "100%",
1700
+ cursor: "pointer"
1701
+ })), Ye = c("div")(() => ({
1702
+ margin: "0 auto",
1703
+ textAlign: "center",
1704
+ display: "flex"
1705
+ })), Xe = c("div")(() => ({
1706
+ width: "fit-content",
1707
+ minWidth: "140px",
1708
+ alignSelf: "center",
1709
+ verticalAlign: "middle",
1710
+ color: `var(--correct-answer-toggle-label-color, ${s.text()})`,
1711
+ fontWeight: "normal",
1712
+ ...qe
1713
+ })), Ze = c("div")(() => ({
1714
+ position: "absolute",
1715
+ width: "25px",
1716
+ "&.enter": { opacity: "0" },
1717
+ "&.enter-active": {
1718
+ opacity: "1",
1719
+ transition: "opacity 0.3s ease-in"
1720
+ },
1721
+ "&.exit": { opacity: "1" },
1722
+ "&.exit-active": {
1723
+ opacity: "0",
1724
+ transition: "opacity 0.3s ease-in"
1725
+ }
1726
+ })), Qe = c("div")(() => ({
1727
+ width: "25px",
1728
+ marginRight: "5px",
1729
+ display: "flex",
1730
+ alignItems: "center"
1731
+ })), $e = class e extends _.Component {
1732
+ static propTypes = {
1733
+ onToggle: S.default.func,
1734
+ toggled: S.default.bool,
1735
+ show: S.default.bool,
1736
+ hideMessage: S.default.string,
1737
+ showMessage: S.default.string,
1738
+ className: S.default.string,
1739
+ language: S.default.string
1740
+ };
1741
+ static defaultProps = {
1742
+ showMessage: "Show correct answer",
1743
+ hideMessage: "Hide correct answer",
1744
+ show: !1,
1745
+ toggled: !1
1746
+ };
1747
+ constructor(t) {
1748
+ super(t), this.state = { show: t.show }, this.openIconRef = _.createRef(), this.closedIconRef = _.createRef(), e.defaultProps = {
1749
+ ...e.defaultProps,
1750
+ showMessage: q.t("common:showCorrectAnswer", { lng: t.language }),
1751
+ hideMessage: q.t("common:hideCorrectAnswer", { lng: t.language })
1752
+ };
1753
+ }
1754
+ onClick() {
1755
+ this.props.onToggle(!this.props.toggled);
1756
+ }
1757
+ onTouch(e) {
1758
+ e.preventDefault(), this.props.onToggle(!this.props.toggled);
1759
+ }
1760
+ UNSAFE_componentWillReceiveProps(t) {
1761
+ this.setState({ show: t.show }), t.language !== this.props?.language && (e.defaultProps = {
1762
+ ...e.defaultProps,
1763
+ showMessage: q.t("common:showCorrectAnswer", { lng: t.language }),
1764
+ hideMessage: q.t("common:hideCorrectAnswer", { lng: t.language })
1765
+ });
1766
+ }
1767
+ render() {
1768
+ let { className: e, toggled: t, hideMessage: n, showMessage: r } = this.props;
1769
+ return /* @__PURE__ */ b(Je, {
1770
+ className: e,
1771
+ children: /* @__PURE__ */ b(T, {
1772
+ show: this.state.show,
1773
+ children: /* @__PURE__ */ x(Ye, {
1774
+ onClick: this.onClick.bind(this),
1775
+ onTouchEnd: this.onTouch.bind(this),
1776
+ children: [/* @__PURE__ */ x(Qe, { children: [/* @__PURE__ */ b(f, {
1777
+ nodeRef: this.openIconRef,
1778
+ timeout: 400,
1779
+ in: t,
1780
+ exit: !t,
1781
+ classNames: {
1782
+ enter: "enter",
1783
+ enterActive: "enter-active",
1784
+ exit: "exit",
1785
+ exitActive: "exit-active"
1786
+ },
1787
+ children: /* @__PURE__ */ b(Ze, {
1788
+ ref: this.openIconRef,
1789
+ children: /* @__PURE__ */ b(O, { open: t }, "correct-open")
1790
+ })
1791
+ }), /* @__PURE__ */ b(f, {
1792
+ nodeRef: this.closedIconRef,
1793
+ timeout: 5e3,
1794
+ in: !t,
1795
+ exit: t,
1796
+ classNames: {
1797
+ enter: "enter",
1798
+ enterActive: "enter-active",
1799
+ exit: "exit",
1800
+ exitActive: "exit-active"
1801
+ },
1802
+ children: /* @__PURE__ */ b(Ze, {
1803
+ ref: this.closedIconRef,
1804
+ children: /* @__PURE__ */ b(O, { open: t }, "correct-closed")
1805
+ })
1806
+ })] }), /* @__PURE__ */ b(We, {
1807
+ false: !0,
1808
+ children: /* @__PURE__ */ b(Xe, {
1809
+ "aria-hidden": !this.state.show,
1810
+ children: t ? n : r
1811
+ })
1812
+ })]
1813
+ })
1814
+ })
1815
+ });
1816
+ }
1817
+ }, et = c("div")(({ theme: e }) => ({
1818
+ marginLeft: "auto",
1819
+ marginRight: "auto",
1820
+ marginTop: e.spacing(1),
1821
+ marginBottom: e.spacing(1)
1822
+ })), tt = c("td")({ padding: "5px 0" }), nt = c(m)(({ theme: e }) => ({ margin: e.spacing(2) })), rt = c("th")({ padding: 0 }), J = c("div")(({ theme: e, isQuestionText: t }) => ({
1823
+ padding: e.spacing(1.5),
1824
+ textAlign: t ? "left" : "center"
1825
+ })), it = c("tr")({
1826
+ border: 0,
1827
+ borderTop: `2.5px solid ${s.primaryLight()}`,
1828
+ width: "100%"
1829
+ }), at = c("table")({
1830
+ color: s.text(),
1831
+ backgroundColor: s.background(),
1832
+ borderCollapse: "collapse",
1833
+ borderSpacing: 0,
1834
+ marginBottom: 0
1835
+ }), ot = class extends _.Component {
1836
+ static propTypes = {
1837
+ correctAnswers: S.default.object,
1838
+ view: S.default.bool.isRequired,
1839
+ showCorrect: S.default.bool.isRequired,
1840
+ disabled: S.default.bool.isRequired,
1841
+ onAnswerChange: S.default.func.isRequired,
1842
+ choiceMode: S.default.string.isRequired,
1843
+ rows: S.default.array.isRequired,
1844
+ headers: S.default.array.isRequired,
1845
+ answers: S.default.object.isRequired
1846
+ };
1847
+ onRowValueChange = (e, t) => (n) => {
1848
+ let { onAnswerChange: r, choiceMode: i, answers: a } = this.props, o = { ...a };
1849
+ if (i === "radio") for (let t = 0; t < o[e].length; t++) o[e][t] = !1;
1850
+ o[e][t] = n.target.checked, r(o);
1851
+ };
1852
+ answerIsCorrect = (e, t, n) => {
1853
+ let { correctAnswers: r } = this.props;
1854
+ return r[e][n] === t && t === !0;
1855
+ };
1856
+ answerIsIncorrect = (e, t, n) => {
1857
+ let { correctAnswers: r } = this.props;
1858
+ return r[e][n] === !0 && t === !1 || r[e][n] === !1 && t === !0;
1859
+ };
1860
+ controlColor = (e, t, n) => {
1861
+ let { showCorrect: r, disabled: i, view: a } = this.props, o = i && !a;
1862
+ return r && t === !0 || o && this.answerIsCorrect(e, t, n) ? s.correct() : o && this.answerIsIncorrect(e, t, n) ? s.incorrect() : t === !0 && !o ? s.primary() : i ? s.disabled() : s.text();
1863
+ };
1864
+ render() {
1865
+ let { headers: e, rows: t, choiceMode: n, answers: r, disabled: i } = this.props, a = n === "radio" ? p : u;
1866
+ return !t || t.length === 0 ? /* @__PURE__ */ b(et, { children: /* @__PURE__ */ b(nt, {
1867
+ component: "div",
1868
+ children: "There are currently no questions to show."
1869
+ }) }) : /* @__PURE__ */ b(et, { children: /* @__PURE__ */ x(at, { children: [
1870
+ /* @__PURE__ */ b("colgroup", { children: (e || []).map((e, t) => /* @__PURE__ */ b("col", {}, `col-${t}`)) }),
1871
+ /* @__PURE__ */ b("thead", { children: /* @__PURE__ */ b("tr", { children: (e || []).map((e, t) => /* @__PURE__ */ b(rt, {
1872
+ "data-colno": `${t}`,
1873
+ scope: "row",
1874
+ children: /* @__PURE__ */ b(J, {
1875
+ isQuestionText: t === 0,
1876
+ dangerouslySetInnerHTML: { __html: e }
1877
+ })
1878
+ }, `th-${t}`)) }) }),
1879
+ (t || []).map((e, t) => /* @__PURE__ */ b("tbody", {
1880
+ role: "group",
1881
+ children: /* @__PURE__ */ x(it, { children: [/* @__PURE__ */ b("td", {
1882
+ "data-colno": "0",
1883
+ children: /* @__PURE__ */ b(J, {
1884
+ isQuestionText: !0,
1885
+ dangerouslySetInnerHTML: { __html: e.title }
1886
+ })
1887
+ }, `td-title-${t}`), (r[e.id] || []).map((n, r) => {
1888
+ let o = this.controlColor(e.id, n, r);
1889
+ return /* @__PURE__ */ b(tt, {
1890
+ "data-colno": `${r + 1}`,
1891
+ children: /* @__PURE__ */ b(J, { children: /* @__PURE__ */ b(a, {
1892
+ sx: {
1893
+ padding: "6px",
1894
+ color: o,
1895
+ "&&.Mui-checked": { color: o },
1896
+ "&&.Mui-disabled": { color: o },
1897
+ cursor: i ? "not-allowed" : "pointer",
1898
+ pointerEvents: i ? "initial" : "auto",
1899
+ opacity: i ? .7 : 1,
1900
+ "& input": { width: "100% !important" },
1901
+ "&&:hover:not(.Mui-disabled)": { color: s.primaryLight() }
1902
+ },
1903
+ disabled: i,
1904
+ onChange: this.onRowValueChange(e.id, r),
1905
+ checked: n === !0
1906
+ }) })
1907
+ }, `td-${t}-${r}`);
1908
+ })] })
1909
+ }, `row-${t}`))
1910
+ ] }) });
1911
+ }
1912
+ };
1913
+ //#endregion
1914
+ //#region src/delivery/main.tsx
1915
+ function Y(e) {
1916
+ return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
1917
+ }
1918
+ function X(e, t) {
1919
+ return !e || Y(e) ? e : Y(e.default) ? e.default : t && Y(e[t]) ? e[t] : t && Y(e[t]?.default) ? e[t].default : e;
1920
+ }
1921
+ var st = X(g, "UiLayout") || X($.UiLayout, "UiLayout"), Z = X(d, "PreviewPrompt") || X($.PreviewPrompt, "PreviewPrompt"), ct = X(a, "Feedback") || X($.Feedback, "Feedback"), lt = X(n, "Collapsible") || X($.Collapsible, "Collapsible"), ut = r, Q = ut.default, $ = Q && typeof Q == "object" ? Q : ut, dt = c("div")({ verticalAlign: "middle" }), ft = c(lt)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), pt = class extends _.Component {
1922
+ static propTypes = {
1923
+ session: S.default.object.isRequired,
1924
+ onSessionChange: S.default.func,
1925
+ model: S.default.object.isRequired
1926
+ };
1927
+ constructor(e) {
1928
+ super(e), this.state = {
1929
+ session: {
1930
+ ...e.session,
1931
+ answers: e.session && e.session.answers || this.generateAnswers(e.model)
1932
+ },
1933
+ showCorrect: !1
1934
+ }, this.callOnSessionChange();
1935
+ }
1936
+ generateAnswers = (e) => {
1937
+ let t = {};
1938
+ return e.rows?.forEach((n) => {
1939
+ t[n.id] = Array(e.layout - 1).fill(!1);
1940
+ }), t;
1941
+ };
1942
+ isAnswerRegenerationRequired = (e) => {
1943
+ let { model: { choiceMode: t, layout: n, rows: r } = {} } = this.props, { session: { answers: i } = {} } = e, a = !1;
1944
+ return t !== e.model.choiceMode && (a = !0), n !== e.model.layout && (a = !0), (r.length !== e.model.rows.length || i && e.model.rows.length !== Object.keys(i).length) && (a = !0), a || !i;
1945
+ };
1946
+ UNSAFE_componentWillReceiveProps(e) {
1947
+ let t = this.isAnswerRegenerationRequired(e);
1948
+ this.setState((n) => ({
1949
+ session: {
1950
+ ...e.session,
1951
+ answers: t ? this.generateAnswers(e.model) : e.session.answers
1952
+ },
1953
+ showCorrect: this.props.model.disabled && !e.model.disabled && n.showCorrect ? !1 : n.showCorrect
1954
+ }), () => {
1955
+ t && this.callOnSessionChange();
1956
+ });
1957
+ }
1958
+ callOnSessionChange = () => {
1959
+ let { onSessionChange: e } = this.props;
1960
+ e && e(this.state.session);
1961
+ };
1962
+ toggleShowCorrect = (e) => {
1963
+ this.setState({ showCorrect: e });
1964
+ };
1965
+ onAnswerChange = (e) => {
1966
+ this.setState((t) => ({ session: {
1967
+ ...t.session,
1968
+ answers: e
1969
+ } }), this.callOnSessionChange);
1970
+ };
1971
+ render() {
1972
+ let { model: e } = this.props, { showCorrect: t, session: n } = this.state, { correctness: r = {}, extraCSSRules: a, language: o } = e, s = r.correctness && r.correctness !== "correct", c = e.rationale && (i(e.rationale) || h(e.rationale));
1973
+ return /* @__PURE__ */ x(st, {
1974
+ extraCSSRules: a,
1975
+ children: [
1976
+ e.teacherInstructions && (i(e.teacherInstructions) || h(e.teacherInstructions)) && /* @__PURE__ */ b(ft, {
1977
+ labels: {
1978
+ hidden: "Show Teacher Instructions",
1979
+ visible: "Hide Teacher Instructions"
1980
+ },
1981
+ children: /* @__PURE__ */ b(Z, { prompt: e.teacherInstructions })
1982
+ }),
1983
+ e.prompt && /* @__PURE__ */ b(dt, { children: /* @__PURE__ */ b(Z, { prompt: e.prompt }) }),
1984
+ /* @__PURE__ */ b($e, {
1985
+ language: o,
1986
+ show: s,
1987
+ toggled: t,
1988
+ onToggle: this.toggleShowCorrect
1989
+ }),
1990
+ /* @__PURE__ */ b(ot, {
1991
+ showCorrect: t,
1992
+ correctAnswers: e.correctResponse,
1993
+ disabled: e.disabled,
1994
+ view: e.view,
1995
+ onAnswerChange: this.onAnswerChange,
1996
+ choiceMode: e.choiceMode,
1997
+ answers: t ? e.correctResponse || {} : n.answers,
1998
+ headers: e.headers,
1999
+ rows: e.rows
2000
+ }),
2001
+ c && /* @__PURE__ */ b(lt, {
2002
+ labels: {
2003
+ hidden: "Show Rationale",
2004
+ visible: "Hide Rationale"
2005
+ },
2006
+ children: /* @__PURE__ */ b(Z, { prompt: e.rationale })
2007
+ }),
2008
+ e.feedback && /* @__PURE__ */ b(ct, {
2009
+ correctness: r.correctness,
2010
+ feedback: e.feedback
2011
+ })
2012
+ ]
2013
+ });
2014
+ }
2015
+ };
2016
+ (class e extends CustomEvent {
2017
+ static {
2018
+ this.TYPE = "model-set";
2019
+ }
2020
+ constructor(t, n, r) {
2021
+ super(e.TYPE, {
2022
+ bubbles: !0,
2023
+ composed: !0,
2024
+ detail: {
2025
+ complete: n,
2026
+ component: t,
2027
+ hasModel: r
2028
+ }
2029
+ }), this.component = t, this.complete = n;
2030
+ }
2031
+ });
2032
+ var mt = class e extends CustomEvent {
2033
+ static {
2034
+ this.TYPE = "session-changed";
2035
+ }
2036
+ constructor(t, n) {
2037
+ super(e.TYPE, {
2038
+ bubbles: !0,
2039
+ composed: !0,
2040
+ detail: {
2041
+ complete: n,
2042
+ component: t
2043
+ }
2044
+ }), this.component = t, this.complete = n;
2045
+ }
2046
+ }, ht = (e, t) => (t?.rows?.map((e) => e.id) || []).reduce((t, n) => {
2047
+ if (!t) return !1;
2048
+ let r = e.answers && e.answers[n];
2049
+ return Array.isArray(r) && r.includes(!0) && t;
2050
+ }, !0), gt = class extends HTMLElement {
2051
+ constructor() {
2052
+ super(), this._root = null;
2053
+ }
2054
+ set model(e) {
2055
+ this._model = {
2056
+ ...e,
2057
+ ...e?.config || {}
2058
+ }, this._render();
2059
+ }
2060
+ set session(e) {
2061
+ this._session = e, this._render();
2062
+ }
2063
+ get session() {
2064
+ return this._session;
2065
+ }
2066
+ sessionChanged(e) {
2067
+ this._session.answers = e.answers;
2068
+ let t = ht(this._session, this._model);
2069
+ this.dispatchEvent(new mt(this.tagName.toLowerCase(), t)), this._render();
2070
+ }
2071
+ connectedCallback() {
2072
+ this._render();
2073
+ }
2074
+ _render() {
2075
+ if (!this._model || !this._session) return;
2076
+ let e = _.createElement(pt, {
2077
+ model: this._model,
2078
+ session: this._session,
2079
+ onSessionChange: this.sessionChanged.bind(this)
2080
+ });
2081
+ this._root ||= y(this), this._root.render(e), queueMicrotask(() => {
2082
+ l(this);
2083
+ });
2084
+ }
2085
+ disconnectedCallback() {
2086
+ this._root &&= (this._root.unmount(), null);
2087
+ }
2088
+ };
2089
+ //#endregion
2090
+ export { pt as Component, gt as default, ht as isComplete };
2091
+
2092
+ //# sourceMappingURL=index.js.map