analytica-frontend-lib 1.2.38 → 1.2.44

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 (96) hide show
  1. package/dist/Accordation/index.d.ts +4 -0
  2. package/dist/Accordation/index.d.ts.map +1 -1
  3. package/dist/Accordation/index.js +5 -2
  4. package/dist/Accordation/index.js.map +1 -1
  5. package/dist/Accordation/index.mjs +5 -2
  6. package/dist/Accordation/index.mjs.map +1 -1
  7. package/dist/ActivityCardQuestionBanks/index.css +24 -10
  8. package/dist/ActivityCardQuestionBanks/index.css.map +1 -1
  9. package/dist/ActivityCardQuestionBanks/index.d.ts.map +1 -1
  10. package/dist/ActivityCardQuestionBanks/index.js +8 -6
  11. package/dist/ActivityCardQuestionBanks/index.js.map +1 -1
  12. package/dist/ActivityCardQuestionBanks/index.mjs +8 -6
  13. package/dist/ActivityCardQuestionBanks/index.mjs.map +1 -1
  14. package/dist/ActivityCardQuestionPreview/index.css +19307 -0
  15. package/dist/ActivityCardQuestionPreview/index.css.map +1 -0
  16. package/dist/ActivityCardQuestionPreview/index.d.ts +29 -0
  17. package/dist/ActivityCardQuestionPreview/index.d.ts.map +1 -0
  18. package/dist/ActivityCardQuestionPreview/index.js +3684 -0
  19. package/dist/ActivityCardQuestionPreview/index.js.map +1 -0
  20. package/dist/ActivityCardQuestionPreview/index.mjs +3692 -0
  21. package/dist/ActivityCardQuestionPreview/index.mjs.map +1 -0
  22. package/dist/ActivityDetails/index.css +24 -10
  23. package/dist/ActivityDetails/index.css.map +1 -1
  24. package/dist/ActivityDetails/index.js +83 -31
  25. package/dist/ActivityDetails/index.js.map +1 -1
  26. package/dist/ActivityDetails/index.mjs +84 -31
  27. package/dist/ActivityDetails/index.mjs.map +1 -1
  28. package/dist/ActivityFilters/index.css +24 -10
  29. package/dist/ActivityFilters/index.css.map +1 -1
  30. package/dist/ActivityFilters/index.js +83 -31
  31. package/dist/ActivityFilters/index.js.map +1 -1
  32. package/dist/ActivityFilters/index.mjs +84 -31
  33. package/dist/ActivityFilters/index.mjs.map +1 -1
  34. package/dist/ActivityPreview/index.css +19307 -0
  35. package/dist/ActivityPreview/index.css.map +1 -0
  36. package/dist/ActivityPreview/index.d.ts +34 -0
  37. package/dist/ActivityPreview/index.d.ts.map +1 -0
  38. package/dist/ActivityPreview/index.js +4458 -0
  39. package/dist/ActivityPreview/index.js.map +1 -0
  40. package/dist/ActivityPreview/index.mjs +4468 -0
  41. package/dist/ActivityPreview/index.mjs.map +1 -0
  42. package/dist/AlertManager/index.css +24 -10
  43. package/dist/AlertManager/index.css.map +1 -1
  44. package/dist/AlertManager/index.js +500 -389
  45. package/dist/AlertManager/index.js.map +1 -1
  46. package/dist/AlertManager/index.mjs +466 -354
  47. package/dist/AlertManager/index.mjs.map +1 -1
  48. package/dist/CorrectActivityModal/index.js +5 -2
  49. package/dist/CorrectActivityModal/index.js.map +1 -1
  50. package/dist/CorrectActivityModal/index.mjs +5 -2
  51. package/dist/CorrectActivityModal/index.mjs.map +1 -1
  52. package/dist/DropdownMenu/index.d.ts +7 -8
  53. package/dist/DropdownMenu/index.d.ts.map +1 -1
  54. package/dist/DropdownMenu/index.js +78 -29
  55. package/dist/DropdownMenu/index.js.map +1 -1
  56. package/dist/DropdownMenu/index.mjs +79 -29
  57. package/dist/DropdownMenu/index.mjs.map +1 -1
  58. package/dist/NotificationCard/index.js +78 -29
  59. package/dist/NotificationCard/index.js.map +1 -1
  60. package/dist/NotificationCard/index.mjs +79 -29
  61. package/dist/NotificationCard/index.mjs.map +1 -1
  62. package/dist/Search/index.js +78 -29
  63. package/dist/Search/index.js.map +1 -1
  64. package/dist/Search/index.mjs +79 -29
  65. package/dist/Search/index.mjs.map +1 -1
  66. package/dist/SendActivityModal/index.css +19307 -0
  67. package/dist/SendActivityModal/index.css.map +1 -0
  68. package/dist/SendActivityModal/index.d.ts +5 -0
  69. package/dist/SendActivityModal/index.d.ts.map +1 -0
  70. package/dist/SendActivityModal/index.js +6471 -0
  71. package/dist/SendActivityModal/index.js.map +1 -0
  72. package/dist/SendActivityModal/index.mjs +6493 -0
  73. package/dist/SendActivityModal/index.mjs.map +1 -0
  74. package/dist/TableProvider/index.css +24 -10
  75. package/dist/TableProvider/index.css.map +1 -1
  76. package/dist/TableProvider/index.js +83 -31
  77. package/dist/TableProvider/index.js.map +1 -1
  78. package/dist/TableProvider/index.mjs +84 -31
  79. package/dist/TableProvider/index.mjs.map +1 -1
  80. package/dist/index.css +24 -10
  81. package/dist/index.css.map +1 -1
  82. package/dist/index.d.ts +16 -3
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +3183 -1502
  85. package/dist/index.js.map +1 -1
  86. package/dist/index.mjs +2963 -1294
  87. package/dist/index.mjs.map +1 -1
  88. package/dist/styles.css +24 -10
  89. package/dist/styles.css.map +1 -1
  90. package/dist/types/activityDetails.d.ts +10 -0
  91. package/dist/types/activityDetails.d.ts.map +1 -1
  92. package/dist/types/questions.d.ts +100 -1
  93. package/dist/types/questions.d.ts.map +1 -1
  94. package/dist/utils/questionRenderer.d.ts +5 -0
  95. package/dist/utils/questionRenderer.d.ts.map +1 -0
  96. package/package.json +7 -1
@@ -0,0 +1,4468 @@
1
+ // src/components/ActivityPreview/ActivityPreview.tsx
2
+ import { useEffect as useEffect6, useMemo as useMemo2, useRef as useRef5, useState as useState8 } from "react";
3
+ import { File, DownloadSimple } from "phosphor-react";
4
+
5
+ // src/utils/utils.ts
6
+ import { clsx } from "clsx";
7
+ import { twMerge } from "tailwind-merge";
8
+ function cn(...inputs) {
9
+ return twMerge(clsx(inputs));
10
+ }
11
+ function getSubjectColorWithOpacity(hexColor, isDark) {
12
+ if (!hexColor) return void 0;
13
+ let color = hexColor.replace(/^#/, "").toLowerCase();
14
+ if (isDark) {
15
+ if (color.length === 8) {
16
+ color = color.slice(0, 6);
17
+ }
18
+ return `#${color}`;
19
+ } else {
20
+ let resultColor;
21
+ if (color.length === 6) {
22
+ resultColor = `#${color}4d`;
23
+ } else if (color.length === 8) {
24
+ resultColor = `#${color}`;
25
+ } else {
26
+ resultColor = `#${color}`;
27
+ }
28
+ return resultColor;
29
+ }
30
+ }
31
+
32
+ // src/components/Text/Text.tsx
33
+ import { jsx } from "react/jsx-runtime";
34
+ var Text = ({
35
+ children,
36
+ size = "md",
37
+ weight = "normal",
38
+ color = "text-text-950",
39
+ as,
40
+ className = "",
41
+ ...props
42
+ }) => {
43
+ let sizeClasses = "";
44
+ let weightClasses = "";
45
+ const sizeClassMap = {
46
+ "2xs": "text-2xs",
47
+ xs: "text-xs",
48
+ sm: "text-sm",
49
+ md: "text-md",
50
+ lg: "text-lg",
51
+ xl: "text-xl",
52
+ "2xl": "text-2xl",
53
+ "3xl": "text-3xl",
54
+ "4xl": "text-4xl",
55
+ "5xl": "text-5xl",
56
+ "6xl": "text-6xl"
57
+ };
58
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
59
+ const weightClassMap = {
60
+ hairline: "font-hairline",
61
+ light: "font-light",
62
+ normal: "font-normal",
63
+ medium: "font-medium",
64
+ semibold: "font-semibold",
65
+ bold: "font-bold",
66
+ extrabold: "font-extrabold",
67
+ black: "font-black"
68
+ };
69
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
70
+ const baseClasses = "font-primary";
71
+ const Component = as ?? "p";
72
+ return /* @__PURE__ */ jsx(
73
+ Component,
74
+ {
75
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
76
+ ...props,
77
+ children
78
+ }
79
+ );
80
+ };
81
+ var Text_default = Text;
82
+
83
+ // src/components/Button/Button.tsx
84
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
85
+ var VARIANT_ACTION_CLASSES = {
86
+ solid: {
87
+ primary: "bg-primary-950 text-text border border-primary-950 hover:bg-primary-800 hover:border-primary-800 focus-visible:outline-none focus-visible:bg-primary-950 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-primary-700 active:border-primary-700 disabled:bg-primary-500 disabled:border-primary-500 disabled:opacity-40 disabled:cursor-not-allowed",
88
+ positive: "bg-success-500 text-text border border-success-500 hover:bg-success-600 hover:border-success-600 focus-visible:outline-none focus-visible:bg-success-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-success-700 active:border-success-700 disabled:bg-success-500 disabled:border-success-500 disabled:opacity-40 disabled:cursor-not-allowed",
89
+ negative: "bg-error-500 text-text border border-error-500 hover:bg-error-600 hover:border-error-600 focus-visible:outline-none focus-visible:bg-error-500 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:bg-error-700 active:border-error-700 disabled:bg-error-500 disabled:border-error-500 disabled:opacity-40 disabled:cursor-not-allowed"
90
+ },
91
+ outline: {
92
+ primary: "bg-transparent text-primary-950 border border-primary-950 hover:bg-background-50 hover:text-primary-400 hover:border-primary-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 active:border-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
93
+ positive: "bg-transparent text-success-500 border border-success-300 hover:bg-background-50 hover:text-success-400 hover:border-success-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 active:border-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
94
+ negative: "bg-transparent text-error-500 border border-error-300 hover:bg-background-50 hover:text-error-400 hover:border-error-400 focus-visible:border-0 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 active:border-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
95
+ },
96
+ link: {
97
+ primary: "bg-transparent text-primary-950 hover:text-primary-400 focus-visible:outline-none focus-visible:text-primary-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-primary-700 disabled:opacity-40 disabled:cursor-not-allowed",
98
+ positive: "bg-transparent text-success-500 hover:text-success-400 focus-visible:outline-none focus-visible:text-success-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-success-700 disabled:opacity-40 disabled:cursor-not-allowed",
99
+ negative: "bg-transparent text-error-500 hover:text-error-400 focus-visible:outline-none focus-visible:text-error-600 focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-indicator-info active:text-error-700 disabled:opacity-40 disabled:cursor-not-allowed"
100
+ }
101
+ };
102
+ var SIZE_CLASSES = {
103
+ "extra-small": "text-xs px-3.5 py-2",
104
+ small: "text-sm px-4 py-2.5",
105
+ medium: "text-md px-5 py-2.5",
106
+ large: "text-lg px-6 py-3",
107
+ "extra-large": "text-lg px-7 py-3.5"
108
+ };
109
+ var Button = ({
110
+ children,
111
+ iconLeft,
112
+ iconRight,
113
+ size = "medium",
114
+ variant = "solid",
115
+ action = "primary",
116
+ className = "",
117
+ disabled,
118
+ type = "button",
119
+ ...props
120
+ }) => {
121
+ const sizeClasses = SIZE_CLASSES[size];
122
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
123
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
124
+ return /* @__PURE__ */ jsxs(
125
+ "button",
126
+ {
127
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
128
+ disabled,
129
+ type,
130
+ ...props,
131
+ children: [
132
+ iconLeft && /* @__PURE__ */ jsx2("span", { className: "mr-2 flex items-center", children: iconLeft }),
133
+ children,
134
+ iconRight && /* @__PURE__ */ jsx2("span", { className: "ml-2 flex items-center", children: iconRight })
135
+ ]
136
+ }
137
+ );
138
+ };
139
+ var Button_default = Button;
140
+
141
+ // src/components/Badge/Badge.tsx
142
+ import { Bell } from "phosphor-react";
143
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
144
+ var VARIANT_ACTION_CLASSES2 = {
145
+ solid: {
146
+ error: "bg-error-background text-error-700 focus-visible:outline-none",
147
+ warning: "bg-warning text-warning-800 focus-visible:outline-none",
148
+ success: "bg-success text-success-800 focus-visible:outline-none",
149
+ info: "bg-info text-info-800 focus-visible:outline-none",
150
+ muted: "bg-background-muted text-background-800 focus-visible:outline-none"
151
+ },
152
+ outlined: {
153
+ error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
154
+ warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
155
+ success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
156
+ info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
157
+ muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
158
+ },
159
+ exams: {
160
+ exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
161
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
162
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
163
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
164
+ },
165
+ examsOutlined: {
166
+ exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
167
+ exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
168
+ exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
169
+ exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
170
+ },
171
+ resultStatus: {
172
+ negative: "bg-error text-error-800 focus-visible:outline-none",
173
+ positive: "bg-success text-success-800 focus-visible:outline-none"
174
+ },
175
+ notification: "text-primary"
176
+ };
177
+ var SIZE_CLASSES2 = {
178
+ small: "text-2xs px-2 py-1",
179
+ medium: "text-xs px-2 py-1",
180
+ large: "text-sm px-2 py-1"
181
+ };
182
+ var SIZE_CLASSES_ICON = {
183
+ small: "size-3",
184
+ medium: "size-3.5",
185
+ large: "size-4"
186
+ };
187
+ var Badge = ({
188
+ children,
189
+ iconLeft,
190
+ iconRight,
191
+ size = "medium",
192
+ variant = "solid",
193
+ action = "error",
194
+ className = "",
195
+ notificationActive = false,
196
+ ...props
197
+ }) => {
198
+ const sizeClasses = SIZE_CLASSES2[size];
199
+ const sizeClassesIcon = SIZE_CLASSES_ICON[size];
200
+ const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
201
+ const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
202
+ const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
203
+ const baseClassesIcon = "flex items-center";
204
+ if (variant === "notification") {
205
+ return /* @__PURE__ */ jsxs2(
206
+ "div",
207
+ {
208
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
209
+ ...props,
210
+ children: [
211
+ /* @__PURE__ */ jsx3(Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
212
+ notificationActive && /* @__PURE__ */ jsx3(
213
+ "span",
214
+ {
215
+ "data-testid": "notification-dot",
216
+ className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
217
+ }
218
+ )
219
+ ]
220
+ }
221
+ );
222
+ }
223
+ return /* @__PURE__ */ jsxs2(
224
+ "div",
225
+ {
226
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
227
+ ...props,
228
+ children: [
229
+ iconLeft && /* @__PURE__ */ jsx3("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
230
+ children,
231
+ iconRight && /* @__PURE__ */ jsx3("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
232
+ ]
233
+ }
234
+ );
235
+ };
236
+ var Badge_default = Badge;
237
+
238
+ // src/components/LatexRenderer/LatexRenderer.tsx
239
+ import "katex/dist/katex.min.css";
240
+ import { InlineMath, BlockMath } from "react-katex";
241
+ import DOMPurify from "dompurify";
242
+ import parse, {
243
+ Element
244
+ } from "html-react-parser";
245
+ import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
246
+ var sanitizeHtml = (value) => {
247
+ return DOMPurify.sanitize(value, {
248
+ ADD_ATTR: ["data-latex", "data-display-mode", "data-math", "data-math-id"]
249
+ });
250
+ };
251
+ var decodeHtmlEntities = (str) => {
252
+ const textarea = document.createElement("textarea");
253
+ textarea.innerHTML = str;
254
+ return textarea.value;
255
+ };
256
+ var cleanLatex = (str) => {
257
+ return str.replaceAll(/[\u200B-\u200D\uFEFF]/g, "").trim();
258
+ };
259
+ var createMathReplacer = (mathParts, errorRenderer) => {
260
+ return (domNode) => {
261
+ if (domNode instanceof Element && domNode.name === "span" && domNode.attribs["data-math-id"]) {
262
+ const mathId = Number.parseInt(domNode.attribs["data-math-id"], 10);
263
+ const mathPart = mathParts[mathId];
264
+ if (!mathPart) return domNode;
265
+ if (mathPart.type === "inline") {
266
+ return /* @__PURE__ */ jsx4(
267
+ InlineMath,
268
+ {
269
+ math: mathPart.latex,
270
+ renderError: () => errorRenderer(mathPart.latex)
271
+ },
272
+ `math-${mathId}`
273
+ );
274
+ } else {
275
+ return /* @__PURE__ */ jsx4("div", { className: "my-2.5 text-center", children: /* @__PURE__ */ jsx4(
276
+ BlockMath,
277
+ {
278
+ math: mathPart.latex,
279
+ renderError: () => errorRenderer(mathPart.latex)
280
+ }
281
+ ) }, `math-${mathId}`);
282
+ }
283
+ }
284
+ return domNode;
285
+ };
286
+ };
287
+ var LatexRenderer = ({
288
+ content,
289
+ className,
290
+ style,
291
+ onError
292
+ }) => {
293
+ const renderContentWithMath = (htmlContent) => {
294
+ if (!htmlContent) return null;
295
+ let processedContent = htmlContent;
296
+ const mathParts = [];
297
+ const mathFormulaPattern = /<span[^>]*class="math-formula"[^>]*data-latex="([^"]*)"[^>]*>[\s\S]*?<\/span>/g;
298
+ processedContent = processedContent.replaceAll(
299
+ mathFormulaPattern,
300
+ (match, latex) => {
301
+ const isDisplayMode = match.includes('data-display-mode="true"');
302
+ const id = mathParts.length;
303
+ mathParts.push({
304
+ id,
305
+ type: isDisplayMode ? "block" : "inline",
306
+ latex: cleanLatex(decodeHtmlEntities(latex))
307
+ });
308
+ return `<span data-math-id="${id}"></span>`;
309
+ }
310
+ );
311
+ const wrappedMathPattern = /<span[^>]*class="math-expression"[^>]*data-math="([^"]*)"[^>]*>.*?<\/span>/g;
312
+ processedContent = processedContent.replaceAll(
313
+ wrappedMathPattern,
314
+ (match, latex) => {
315
+ const id = mathParts.length;
316
+ mathParts.push({
317
+ id,
318
+ type: "inline",
319
+ latex: cleanLatex(decodeHtmlEntities(latex))
320
+ });
321
+ return `<span data-math-id="${id}"></span>`;
322
+ }
323
+ );
324
+ const doubleDollarPattern = /(?<!\\)\$\$([\s\S]+?)\$\$/g;
325
+ processedContent = processedContent.replaceAll(
326
+ doubleDollarPattern,
327
+ (match, latex) => {
328
+ const id = mathParts.length;
329
+ mathParts.push({
330
+ id,
331
+ type: "block",
332
+ latex: cleanLatex(latex)
333
+ });
334
+ return `<span data-math-id="${id}"></span>`;
335
+ }
336
+ );
337
+ const singleDollarPattern = /(?<!\\)\$([\s\S]+?)\$/g;
338
+ processedContent = processedContent.replaceAll(
339
+ singleDollarPattern,
340
+ (match, latex) => {
341
+ const id = mathParts.length;
342
+ mathParts.push({
343
+ id,
344
+ type: "inline",
345
+ latex: cleanLatex(latex)
346
+ });
347
+ return `<span data-math-id="${id}"></span>`;
348
+ }
349
+ );
350
+ const latexTagPattern = /(?:<latex>|&lt;latex&gt;)([\s\S]*?)(?:<\/latex>|&lt;\/latex&gt;)/g;
351
+ processedContent = processedContent.replaceAll(
352
+ latexTagPattern,
353
+ (match, latex) => {
354
+ const id = mathParts.length;
355
+ mathParts.push({
356
+ id,
357
+ type: "inline",
358
+ latex: cleanLatex(latex)
359
+ });
360
+ return `<span data-math-id="${id}"></span>`;
361
+ }
362
+ );
363
+ const latexEnvPattern = /\\begin\{([^}]+)\}([\s\S]*?)\\end\{\1\}/g;
364
+ processedContent = processedContent.replaceAll(latexEnvPattern, (match) => {
365
+ const id = mathParts.length;
366
+ mathParts.push({
367
+ id,
368
+ type: "block",
369
+ latex: cleanLatex(match)
370
+ });
371
+ return `<span data-math-id="${id}"></span>`;
372
+ });
373
+ const sanitizedContent = sanitizeHtml(processedContent);
374
+ const defaultErrorRenderer = (latex) => /* @__PURE__ */ jsxs3("span", { className: "text-red-600", children: [
375
+ "Math Error: ",
376
+ latex
377
+ ] });
378
+ const errorRenderer = onError || defaultErrorRenderer;
379
+ const options = {
380
+ replace: createMathReplacer(mathParts, errorRenderer)
381
+ };
382
+ return /* @__PURE__ */ jsx4(Fragment, { children: parse(sanitizedContent, options) });
383
+ };
384
+ return /* @__PURE__ */ jsx4(
385
+ "div",
386
+ {
387
+ className: cn("whitespace-pre-wrap leading-relaxed", className),
388
+ style,
389
+ children: renderContentWithMath(content)
390
+ }
391
+ );
392
+ };
393
+ var LatexRenderer_default = LatexRenderer;
394
+
395
+ // src/components/CheckBox/CheckBox.tsx
396
+ import {
397
+ forwardRef,
398
+ useState,
399
+ useId
400
+ } from "react";
401
+ import { Check, Minus } from "phosphor-react";
402
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
403
+ var SIZE_CLASSES3 = {
404
+ small: {
405
+ checkbox: "w-4 h-4",
406
+ // 16px x 16px
407
+ textSize: "sm",
408
+ spacing: "gap-1.5",
409
+ // 6px
410
+ borderWidth: "border-2",
411
+ iconSize: 14,
412
+ // pixels for Phosphor icons
413
+ labelHeight: "h-[21px]"
414
+ },
415
+ medium: {
416
+ checkbox: "w-5 h-5",
417
+ // 20px x 20px
418
+ textSize: "md",
419
+ spacing: "gap-2",
420
+ // 8px
421
+ borderWidth: "border-2",
422
+ iconSize: 16,
423
+ // pixels for Phosphor icons
424
+ labelHeight: "h-6"
425
+ },
426
+ large: {
427
+ checkbox: "w-6 h-6",
428
+ // 24px x 24px
429
+ textSize: "lg",
430
+ spacing: "gap-2",
431
+ // 8px
432
+ borderWidth: "border-[3px]",
433
+ // 3px border
434
+ iconSize: 20,
435
+ // pixels for Phosphor icons
436
+ labelHeight: "h-[27px]"
437
+ }
438
+ };
439
+ var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
440
+ var STATE_CLASSES = {
441
+ default: {
442
+ unchecked: "border-border-400 bg-background hover:border-border-500",
443
+ checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
444
+ },
445
+ hovered: {
446
+ unchecked: "border-border-500 bg-background",
447
+ checked: "border-primary-800 bg-primary-800 text-text"
448
+ },
449
+ focused: {
450
+ unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
451
+ checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
452
+ },
453
+ invalid: {
454
+ unchecked: "border-error-700 bg-background hover:border-error-600",
455
+ checked: "border-error-700 bg-primary-950 text-text"
456
+ },
457
+ disabled: {
458
+ unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
459
+ checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
460
+ }
461
+ };
462
+ var CheckBox = forwardRef(
463
+ ({
464
+ label,
465
+ size = "medium",
466
+ state = "default",
467
+ indeterminate = false,
468
+ errorMessage,
469
+ helperText,
470
+ className = "",
471
+ labelClassName = "",
472
+ checked: checkedProp,
473
+ disabled,
474
+ id,
475
+ onChange,
476
+ ...props
477
+ }, ref) => {
478
+ const generatedId = useId();
479
+ const inputId = id ?? `checkbox-${generatedId}`;
480
+ const [internalChecked, setInternalChecked] = useState(false);
481
+ const isControlled = checkedProp !== void 0;
482
+ const checked = isControlled ? checkedProp : internalChecked;
483
+ const handleChange = (event) => {
484
+ if (!isControlled) {
485
+ setInternalChecked(event.target.checked);
486
+ }
487
+ onChange?.(event);
488
+ };
489
+ const currentState = disabled ? "disabled" : state;
490
+ const sizeClasses = SIZE_CLASSES3[size];
491
+ const checkVariant = checked || indeterminate ? "checked" : "unchecked";
492
+ const stylingClasses = STATE_CLASSES[currentState][checkVariant];
493
+ const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
494
+ const checkboxClasses = cn(
495
+ BASE_CHECKBOX_CLASSES,
496
+ sizeClasses.checkbox,
497
+ borderWidthClass,
498
+ stylingClasses,
499
+ className
500
+ );
501
+ const renderIcon = () => {
502
+ if (indeterminate) {
503
+ return /* @__PURE__ */ jsx5(
504
+ Minus,
505
+ {
506
+ size: sizeClasses.iconSize,
507
+ weight: "bold",
508
+ color: "currentColor"
509
+ }
510
+ );
511
+ }
512
+ if (checked) {
513
+ return /* @__PURE__ */ jsx5(
514
+ Check,
515
+ {
516
+ size: sizeClasses.iconSize,
517
+ weight: "bold",
518
+ color: "currentColor"
519
+ }
520
+ );
521
+ }
522
+ return null;
523
+ };
524
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
525
+ /* @__PURE__ */ jsxs4(
526
+ "div",
527
+ {
528
+ className: cn(
529
+ "flex flex-row items-center",
530
+ sizeClasses.spacing,
531
+ disabled ? "opacity-40" : ""
532
+ ),
533
+ children: [
534
+ /* @__PURE__ */ jsx5(
535
+ "input",
536
+ {
537
+ ref,
538
+ type: "checkbox",
539
+ id: inputId,
540
+ checked,
541
+ disabled,
542
+ onChange: handleChange,
543
+ className: "sr-only",
544
+ ...props
545
+ }
546
+ ),
547
+ /* @__PURE__ */ jsx5("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
548
+ label && /* @__PURE__ */ jsx5(
549
+ "div",
550
+ {
551
+ className: cn(
552
+ "flex flex-row items-center",
553
+ sizeClasses.labelHeight
554
+ ),
555
+ children: /* @__PURE__ */ jsx5(
556
+ Text_default,
557
+ {
558
+ as: "label",
559
+ htmlFor: inputId,
560
+ size: sizeClasses.textSize,
561
+ weight: "normal",
562
+ className: cn(
563
+ "cursor-pointer select-none leading-[150%] flex items-center font-roboto",
564
+ labelClassName
565
+ ),
566
+ children: label
567
+ }
568
+ )
569
+ }
570
+ )
571
+ ]
572
+ }
573
+ ),
574
+ errorMessage && /* @__PURE__ */ jsx5(
575
+ Text_default,
576
+ {
577
+ size: "sm",
578
+ weight: "normal",
579
+ className: "mt-1.5",
580
+ color: "text-error-600",
581
+ children: errorMessage
582
+ }
583
+ ),
584
+ helperText && !errorMessage && /* @__PURE__ */ jsx5(
585
+ Text_default,
586
+ {
587
+ size: "sm",
588
+ weight: "normal",
589
+ className: "mt-1.5",
590
+ color: "text-text-500",
591
+ children: helperText
592
+ }
593
+ )
594
+ ] });
595
+ }
596
+ );
597
+ CheckBox.displayName = "CheckBox";
598
+ var CheckBox_default = CheckBox;
599
+
600
+ // src/components/CheckBox/CheckboxList.tsx
601
+ import {
602
+ forwardRef as forwardRef2,
603
+ useId as useId2,
604
+ useEffect,
605
+ useRef,
606
+ Children,
607
+ cloneElement,
608
+ isValidElement
609
+ } from "react";
610
+ import { create, useStore } from "zustand";
611
+ import { jsx as jsx6 } from "react/jsx-runtime";
612
+ var createCheckboxListStore = (name, defaultValues, disabled, onValuesChange) => create((set, get) => ({
613
+ values: defaultValues,
614
+ setValues: (values) => {
615
+ if (!get().disabled) {
616
+ set({ values });
617
+ get().onValuesChange?.(values);
618
+ }
619
+ },
620
+ toggleValue: (value) => {
621
+ if (!get().disabled) {
622
+ const currentValues = get().values;
623
+ const newValues = currentValues.includes(value) ? currentValues.filter((v) => v !== value) : [...currentValues, value];
624
+ set({ values: newValues });
625
+ get().onValuesChange?.(newValues);
626
+ }
627
+ },
628
+ onValuesChange,
629
+ disabled,
630
+ name
631
+ }));
632
+ var useCheckboxListStore = (externalStore) => {
633
+ if (!externalStore) {
634
+ throw new Error("CheckboxListItem must be used within a CheckboxList");
635
+ }
636
+ return externalStore;
637
+ };
638
+ var injectStore = (children, store) => Children.map(children, (child) => {
639
+ if (!isValidElement(child)) return child;
640
+ const typedChild = child;
641
+ const shouldInject = typedChild.type === CheckboxListItem;
642
+ return cloneElement(typedChild, {
643
+ ...shouldInject ? { store } : {},
644
+ ...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
645
+ });
646
+ });
647
+ var CheckboxList = forwardRef2(
648
+ ({
649
+ values: propValues,
650
+ defaultValues = [],
651
+ onValuesChange,
652
+ name: propName,
653
+ disabled = false,
654
+ className = "",
655
+ children,
656
+ ...props
657
+ }, ref) => {
658
+ const generatedId = useId2();
659
+ const name = propName || `checkbox-list-${generatedId}`;
660
+ const storeRef = useRef(null);
661
+ storeRef.current ??= createCheckboxListStore(
662
+ name,
663
+ defaultValues,
664
+ disabled,
665
+ onValuesChange
666
+ );
667
+ const store = storeRef.current;
668
+ const { setValues } = useStore(store, (s) => s);
669
+ useEffect(() => {
670
+ const currentValues = store.getState().values;
671
+ if (currentValues.length > 0 && onValuesChange) {
672
+ onValuesChange(currentValues);
673
+ }
674
+ }, []);
675
+ useEffect(() => {
676
+ if (propValues !== void 0) {
677
+ setValues(propValues);
678
+ }
679
+ }, [propValues, setValues]);
680
+ useEffect(() => {
681
+ store.setState({ disabled });
682
+ }, [disabled, store]);
683
+ return /* @__PURE__ */ jsx6(
684
+ "div",
685
+ {
686
+ ref,
687
+ className: cn("flex flex-col gap-2 w-full", className),
688
+ "aria-label": name,
689
+ ...props,
690
+ children: injectStore(children, store)
691
+ }
692
+ );
693
+ }
694
+ );
695
+ CheckboxList.displayName = "CheckboxList";
696
+ var CheckboxListItem = forwardRef2(
697
+ ({
698
+ value,
699
+ store: externalStore,
700
+ disabled: itemDisabled,
701
+ size = "medium",
702
+ state = "default",
703
+ className = "",
704
+ id,
705
+ ...props
706
+ }, ref) => {
707
+ const store = useCheckboxListStore(externalStore);
708
+ const {
709
+ values: groupValues,
710
+ toggleValue,
711
+ disabled: groupDisabled,
712
+ name
713
+ } = useStore(store);
714
+ const generatedId = useId2();
715
+ const inputId = id ?? `checkbox-item-${generatedId}`;
716
+ const isChecked = groupValues.includes(value);
717
+ const isDisabled = groupDisabled || itemDisabled;
718
+ const currentState = isDisabled ? "disabled" : state;
719
+ return /* @__PURE__ */ jsx6(
720
+ CheckBox_default,
721
+ {
722
+ ref,
723
+ id: inputId,
724
+ name,
725
+ value,
726
+ checked: isChecked,
727
+ disabled: isDisabled,
728
+ size,
729
+ state: currentState,
730
+ className,
731
+ onChange: () => {
732
+ if (!isDisabled) {
733
+ toggleValue(value);
734
+ }
735
+ },
736
+ ...props
737
+ }
738
+ );
739
+ }
740
+ );
741
+ CheckboxListItem.displayName = "CheckboxListItem";
742
+ var CheckboxList_default = CheckboxList;
743
+
744
+ // src/components/Radio/Radio.tsx
745
+ import {
746
+ forwardRef as forwardRef3,
747
+ useState as useState2,
748
+ useId as useId3,
749
+ useEffect as useEffect2,
750
+ useRef as useRef2,
751
+ Children as Children2,
752
+ cloneElement as cloneElement2,
753
+ isValidElement as isValidElement2
754
+ } from "react";
755
+ import { create as create2, useStore as useStore2 } from "zustand";
756
+ import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
757
+ var SIZE_CLASSES4 = {
758
+ small: {
759
+ radio: "w-5 h-5",
760
+ textSize: "sm",
761
+ spacing: "gap-1.5",
762
+ borderWidth: "border-2",
763
+ dotSize: "w-2.5 h-2.5",
764
+ labelHeight: "h-5"
765
+ },
766
+ medium: {
767
+ radio: "w-6 h-6",
768
+ textSize: "md",
769
+ spacing: "gap-2",
770
+ borderWidth: "border-2",
771
+ dotSize: "w-3 h-3",
772
+ labelHeight: "h-6"
773
+ },
774
+ large: {
775
+ radio: "w-7 h-7",
776
+ textSize: "lg",
777
+ spacing: "gap-2",
778
+ borderWidth: "border-2",
779
+ dotSize: "w-3.5 h-3.5",
780
+ labelHeight: "h-7"
781
+ },
782
+ extraLarge: {
783
+ radio: "w-8 h-8",
784
+ textSize: "xl",
785
+ spacing: "gap-3",
786
+ borderWidth: "border-2",
787
+ dotSize: "w-4 h-4",
788
+ labelHeight: "h-8"
789
+ }
790
+ };
791
+ var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
792
+ var STATE_CLASSES2 = {
793
+ default: {
794
+ unchecked: "border-border-400 bg-background hover:border-border-500",
795
+ checked: "border-primary-950 bg-background hover:border-primary-800"
796
+ },
797
+ hovered: {
798
+ unchecked: "border-border-500 bg-background",
799
+ checked: "border-info-700 bg-background"
800
+ },
801
+ focused: {
802
+ unchecked: "border-border-400 bg-background",
803
+ checked: "border-primary-950 bg-background"
804
+ },
805
+ invalid: {
806
+ unchecked: "border-border-400 bg-background",
807
+ checked: "border-primary-950 bg-background"
808
+ },
809
+ disabled: {
810
+ unchecked: "border-border-400 bg-background cursor-not-allowed",
811
+ checked: "border-primary-950 bg-background cursor-not-allowed"
812
+ }
813
+ };
814
+ var DOT_CLASSES = {
815
+ default: "bg-primary-950",
816
+ hovered: "bg-info-700",
817
+ focused: "bg-primary-950",
818
+ invalid: "bg-primary-950",
819
+ disabled: "bg-primary-950"
820
+ };
821
+ var Radio = forwardRef3(
822
+ ({
823
+ label,
824
+ size = "medium",
825
+ state = "default",
826
+ errorMessage,
827
+ helperText,
828
+ className = "",
829
+ labelClassName = "",
830
+ checked: checkedProp,
831
+ defaultChecked = false,
832
+ disabled,
833
+ id,
834
+ name,
835
+ value,
836
+ onChange,
837
+ ...props
838
+ }, ref) => {
839
+ const generatedId = useId3();
840
+ const inputId = id ?? `radio-${generatedId}`;
841
+ const inputRef = useRef2(null);
842
+ const [internalChecked, setInternalChecked] = useState2(defaultChecked);
843
+ const isControlled = checkedProp !== void 0;
844
+ const checked = isControlled ? checkedProp : internalChecked;
845
+ const handleChange = (event) => {
846
+ const newChecked = event.target.checked;
847
+ if (!isControlled) {
848
+ setInternalChecked(newChecked);
849
+ }
850
+ if (event.target) {
851
+ event.target.blur();
852
+ }
853
+ onChange?.(event);
854
+ };
855
+ const currentState = disabled ? "disabled" : state;
856
+ const sizeClasses = SIZE_CLASSES4[size];
857
+ const actualRadioSize = sizeClasses.radio;
858
+ const actualDotSize = sizeClasses.dotSize;
859
+ const radioVariant = checked ? "checked" : "unchecked";
860
+ const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
861
+ const getBorderWidth = () => {
862
+ if (currentState === "focused") {
863
+ return "border-2";
864
+ }
865
+ return sizeClasses.borderWidth;
866
+ };
867
+ const borderWidthClass = getBorderWidth();
868
+ const radioClasses = cn(
869
+ BASE_RADIO_CLASSES,
870
+ actualRadioSize,
871
+ borderWidthClass,
872
+ stylingClasses,
873
+ className
874
+ );
875
+ const dotClasses = cn(
876
+ actualDotSize,
877
+ "rounded-full",
878
+ DOT_CLASSES[currentState],
879
+ "transition-all duration-200"
880
+ );
881
+ const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
882
+ const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
883
+ const getTextColor = () => {
884
+ if (currentState === "disabled") {
885
+ return checked ? "text-text-900" : "text-text-600";
886
+ }
887
+ if (currentState === "focused") {
888
+ return "text-text-900";
889
+ }
890
+ return checked ? "text-text-900" : "text-text-600";
891
+ };
892
+ const getCursorClass = () => {
893
+ return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
894
+ };
895
+ return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col", children: [
896
+ /* @__PURE__ */ jsxs5(
897
+ "div",
898
+ {
899
+ className: cn(
900
+ "flex flex-row items-center",
901
+ isWrapperNeeded ? cn("p-1 border-2", wrapperBorderColor, "rounded-lg gap-1.5") : sizeClasses.spacing,
902
+ disabled ? "opacity-40" : ""
903
+ ),
904
+ children: [
905
+ /* @__PURE__ */ jsx7(
906
+ "input",
907
+ {
908
+ ref: (node) => {
909
+ inputRef.current = node;
910
+ if (typeof ref === "function") ref(node);
911
+ else if (ref) ref.current = node;
912
+ },
913
+ type: "radio",
914
+ id: inputId,
915
+ checked,
916
+ disabled,
917
+ name,
918
+ value,
919
+ onChange: handleChange,
920
+ className: "sr-only",
921
+ style: {
922
+ position: "absolute",
923
+ left: "-9999px",
924
+ visibility: "hidden"
925
+ },
926
+ ...props
927
+ }
928
+ ),
929
+ /* @__PURE__ */ jsx7(
930
+ "button",
931
+ {
932
+ type: "button",
933
+ className: radioClasses,
934
+ disabled,
935
+ "aria-pressed": checked,
936
+ onClick: (e) => {
937
+ e.preventDefault();
938
+ if (!disabled) {
939
+ if (inputRef.current) {
940
+ inputRef.current.click();
941
+ inputRef.current.blur();
942
+ }
943
+ }
944
+ },
945
+ onKeyDown: (e) => {
946
+ if ((e.key === "Enter" || e.key === " ") && !disabled) {
947
+ e.preventDefault();
948
+ if (inputRef.current) {
949
+ inputRef.current.click();
950
+ inputRef.current.blur();
951
+ }
952
+ }
953
+ },
954
+ children: checked && /* @__PURE__ */ jsx7("div", { className: dotClasses })
955
+ }
956
+ ),
957
+ label && /* @__PURE__ */ jsx7(
958
+ "div",
959
+ {
960
+ className: cn(
961
+ "flex flex-row items-center",
962
+ sizeClasses.labelHeight,
963
+ "flex-1 min-w-0"
964
+ ),
965
+ children: /* @__PURE__ */ jsx7(
966
+ Text_default,
967
+ {
968
+ as: "label",
969
+ htmlFor: inputId,
970
+ size: sizeClasses.textSize,
971
+ weight: "normal",
972
+ className: cn(
973
+ getCursorClass(),
974
+ "select-none leading-normal flex items-center font-roboto truncate",
975
+ labelClassName
976
+ ),
977
+ color: getTextColor(),
978
+ children: label
979
+ }
980
+ )
981
+ }
982
+ )
983
+ ]
984
+ }
985
+ ),
986
+ errorMessage && /* @__PURE__ */ jsx7(
987
+ Text_default,
988
+ {
989
+ size: "sm",
990
+ weight: "normal",
991
+ className: "mt-1.5 truncate",
992
+ color: "text-error-600",
993
+ children: errorMessage
994
+ }
995
+ ),
996
+ helperText && !errorMessage && /* @__PURE__ */ jsx7(
997
+ Text_default,
998
+ {
999
+ size: "sm",
1000
+ weight: "normal",
1001
+ className: "mt-1.5 truncate",
1002
+ color: "text-text-500",
1003
+ children: helperText
1004
+ }
1005
+ )
1006
+ ] });
1007
+ }
1008
+ );
1009
+ Radio.displayName = "Radio";
1010
+ var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => create2((set, get) => ({
1011
+ value: defaultValue,
1012
+ setValue: (value) => {
1013
+ if (!get().disabled) {
1014
+ set({ value });
1015
+ get().onValueChange?.(value);
1016
+ }
1017
+ },
1018
+ onValueChange,
1019
+ disabled,
1020
+ name
1021
+ }));
1022
+ var useRadioGroupStore = (externalStore) => {
1023
+ if (!externalStore) {
1024
+ throw new Error("RadioGroupItem must be used within a RadioGroup");
1025
+ }
1026
+ return externalStore;
1027
+ };
1028
+ var injectStore2 = (children, store) => Children2.map(children, (child) => {
1029
+ if (!isValidElement2(child)) return child;
1030
+ const typedChild = child;
1031
+ const shouldInject = typedChild.type === RadioGroupItem;
1032
+ return cloneElement2(typedChild, {
1033
+ ...shouldInject ? { store } : {},
1034
+ ...typedChild.props.children ? { children: injectStore2(typedChild.props.children, store) } : {}
1035
+ });
1036
+ });
1037
+ var RadioGroup = forwardRef3(
1038
+ ({
1039
+ value: propValue,
1040
+ defaultValue = "",
1041
+ onValueChange,
1042
+ name: propName,
1043
+ disabled = false,
1044
+ className = "",
1045
+ children,
1046
+ ...props
1047
+ }, ref) => {
1048
+ const generatedId = useId3();
1049
+ const name = propName || `radio-group-${generatedId}`;
1050
+ const storeRef = useRef2(null);
1051
+ storeRef.current ??= createRadioGroupStore(
1052
+ name,
1053
+ defaultValue,
1054
+ disabled,
1055
+ onValueChange
1056
+ );
1057
+ const store = storeRef.current;
1058
+ const { setValue } = useStore2(store, (s) => s);
1059
+ useEffect2(() => {
1060
+ const currentValue = store.getState().value;
1061
+ if (currentValue && onValueChange) {
1062
+ onValueChange(currentValue);
1063
+ }
1064
+ }, []);
1065
+ useEffect2(() => {
1066
+ if (propValue !== void 0) {
1067
+ setValue(propValue);
1068
+ }
1069
+ }, [propValue, setValue]);
1070
+ useEffect2(() => {
1071
+ store.setState({ disabled });
1072
+ }, [disabled, store]);
1073
+ return /* @__PURE__ */ jsx7(
1074
+ "div",
1075
+ {
1076
+ ref,
1077
+ className,
1078
+ role: "radiogroup",
1079
+ "aria-label": name,
1080
+ ...props,
1081
+ children: injectStore2(children, store)
1082
+ }
1083
+ );
1084
+ }
1085
+ );
1086
+ RadioGroup.displayName = "RadioGroup";
1087
+ var RadioGroupItem = forwardRef3(
1088
+ ({
1089
+ value,
1090
+ store: externalStore,
1091
+ disabled: itemDisabled,
1092
+ size = "medium",
1093
+ state = "default",
1094
+ className = "",
1095
+ id,
1096
+ ...props
1097
+ }, ref) => {
1098
+ const store = useRadioGroupStore(externalStore);
1099
+ const {
1100
+ value: groupValue,
1101
+ setValue,
1102
+ disabled: groupDisabled,
1103
+ name
1104
+ } = useStore2(store);
1105
+ const generatedId = useId3();
1106
+ const inputId = id ?? `radio-item-${generatedId}`;
1107
+ const isChecked = groupValue === value;
1108
+ const isDisabled = groupDisabled || itemDisabled;
1109
+ const currentState = isDisabled ? "disabled" : state;
1110
+ return /* @__PURE__ */ jsx7(
1111
+ Radio,
1112
+ {
1113
+ ref,
1114
+ id: inputId,
1115
+ name,
1116
+ value,
1117
+ checked: isChecked,
1118
+ disabled: isDisabled,
1119
+ size,
1120
+ state: currentState,
1121
+ className,
1122
+ onChange: (e) => {
1123
+ if (e.target.checked && !isDisabled) {
1124
+ setValue(value);
1125
+ }
1126
+ },
1127
+ ...props
1128
+ }
1129
+ );
1130
+ }
1131
+ );
1132
+ RadioGroupItem.displayName = "RadioGroupItem";
1133
+
1134
+ // src/components/ProgressBar/ProgressBar.tsx
1135
+ import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
1136
+ var SIZE_CLASSES5 = {
1137
+ small: {
1138
+ container: "h-1",
1139
+ // 4px height (h-1 = 4px in Tailwind)
1140
+ bar: "h-1",
1141
+ // 4px height for the fill bar
1142
+ spacing: "gap-2",
1143
+ // 8px gap between label and progress bar
1144
+ layout: "flex-col",
1145
+ // vertical layout for small
1146
+ borderRadius: "rounded-full"
1147
+ // 9999px border radius
1148
+ },
1149
+ medium: {
1150
+ container: "h-2",
1151
+ // 8px height (h-2 = 8px in Tailwind)
1152
+ bar: "h-2",
1153
+ // 8px height for the fill bar
1154
+ spacing: "gap-2",
1155
+ // 8px gap between progress bar and label
1156
+ layout: "flex-row items-center",
1157
+ // horizontal layout for medium
1158
+ borderRadius: "rounded-lg"
1159
+ // 8px border radius
1160
+ }
1161
+ };
1162
+ var VARIANT_CLASSES = {
1163
+ blue: {
1164
+ background: "bg-background-300",
1165
+ // Background track color (#D5D4D4)
1166
+ fill: "bg-primary-700"
1167
+ // Blue for activity progress (#2271C4)
1168
+ },
1169
+ green: {
1170
+ background: "bg-background-300",
1171
+ // Background track color (#D5D4D4)
1172
+ fill: "bg-success-200"
1173
+ // Green for performance (#84D3A2)
1174
+ }
1175
+ };
1176
+ var calculateProgressValues = (value, max) => {
1177
+ const safeValue = isNaN(value) ? 0 : value;
1178
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
1179
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
1180
+ return { clampedValue, percentage };
1181
+ };
1182
+ var shouldShowHeader = (label, showPercentage, showHitCount) => {
1183
+ return !!(label || showPercentage || showHitCount);
1184
+ };
1185
+ var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
1186
+ if (showHitCount) {
1187
+ return {
1188
+ type: "hitCount",
1189
+ content: `${Math.round(clampedValue)} de ${max}`,
1190
+ hasMetrics: true
1191
+ };
1192
+ }
1193
+ if (showPercentage) {
1194
+ return {
1195
+ type: "percentage",
1196
+ content: `${Math.round(percentage)}%`,
1197
+ hasMetrics: true
1198
+ };
1199
+ }
1200
+ return {
1201
+ type: "label",
1202
+ content: label,
1203
+ hasMetrics: false
1204
+ };
1205
+ };
1206
+ var getCompactLayoutConfig = ({
1207
+ showPercentage,
1208
+ showHitCount,
1209
+ percentage,
1210
+ clampedValue,
1211
+ max,
1212
+ label,
1213
+ percentageClassName,
1214
+ labelClassName
1215
+ }) => {
1216
+ const displayPriority = getDisplayPriority(
1217
+ showHitCount,
1218
+ showPercentage,
1219
+ label,
1220
+ clampedValue,
1221
+ max,
1222
+ percentage
1223
+ );
1224
+ return {
1225
+ color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
1226
+ className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
1227
+ content: displayPriority.content
1228
+ };
1229
+ };
1230
+ var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
1231
+ showHeader: size === "small" && !!(label || showPercentage),
1232
+ showPercentage: size === "medium" && showPercentage,
1233
+ showLabel: size === "medium" && !!label && !showPercentage
1234
+ // Only show label when percentage is not shown
1235
+ });
1236
+ var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
1237
+ if (!showHitCount && !showPercentage) return null;
1238
+ const displayPriority = getDisplayPriority(
1239
+ showHitCount,
1240
+ showPercentage,
1241
+ null,
1242
+ // label is not relevant for stacked layout metrics display
1243
+ clampedValue,
1244
+ max,
1245
+ percentage
1246
+ );
1247
+ return /* @__PURE__ */ jsx8(
1248
+ "div",
1249
+ {
1250
+ className: cn(
1251
+ "text-xs font-medium leading-[14px] text-right",
1252
+ percentageClassName
1253
+ ),
1254
+ children: displayPriority.type === "hitCount" ? /* @__PURE__ */ jsxs6(Fragment2, { children: [
1255
+ /* @__PURE__ */ jsx8("span", { className: "text-success-200", children: Math.round(clampedValue) }),
1256
+ /* @__PURE__ */ jsxs6("span", { className: "text-text-600", children: [
1257
+ " de ",
1258
+ max
1259
+ ] })
1260
+ ] }) : /* @__PURE__ */ jsxs6(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
1261
+ Math.round(percentage),
1262
+ "%"
1263
+ ] })
1264
+ }
1265
+ );
1266
+ };
1267
+ var ProgressBarBase = ({
1268
+ clampedValue,
1269
+ max,
1270
+ percentage,
1271
+ label,
1272
+ variantClasses,
1273
+ containerClassName,
1274
+ fillClassName
1275
+ }) => /* @__PURE__ */ jsxs6(
1276
+ "div",
1277
+ {
1278
+ className: cn(
1279
+ containerClassName,
1280
+ variantClasses.background,
1281
+ "overflow-hidden relative"
1282
+ ),
1283
+ children: [
1284
+ /* @__PURE__ */ jsx8(
1285
+ "progress",
1286
+ {
1287
+ value: clampedValue,
1288
+ max,
1289
+ "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
1290
+ className: "absolute inset-0 w-full h-full opacity-0"
1291
+ }
1292
+ ),
1293
+ /* @__PURE__ */ jsx8(
1294
+ "div",
1295
+ {
1296
+ className: cn(
1297
+ fillClassName,
1298
+ variantClasses.fill,
1299
+ "transition-all duration-300 ease-out"
1300
+ ),
1301
+ style: { width: `${percentage}%` }
1302
+ }
1303
+ )
1304
+ ]
1305
+ }
1306
+ );
1307
+ var StackedLayout = ({
1308
+ className,
1309
+ label,
1310
+ showPercentage,
1311
+ showHitCount,
1312
+ labelClassName,
1313
+ percentageClassName,
1314
+ clampedValue,
1315
+ max,
1316
+ percentage,
1317
+ variantClasses,
1318
+ dimensions
1319
+ }) => /* @__PURE__ */ jsxs6(
1320
+ "div",
1321
+ {
1322
+ className: cn(
1323
+ "flex flex-col items-start gap-2",
1324
+ dimensions.width,
1325
+ dimensions.height,
1326
+ className
1327
+ ),
1328
+ children: [
1329
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsxs6("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
1330
+ label && /* @__PURE__ */ jsx8(
1331
+ Text_default,
1332
+ {
1333
+ as: "div",
1334
+ size: "md",
1335
+ weight: "medium",
1336
+ className: cn("text-text-600 leading-[19px]", labelClassName),
1337
+ children: label
1338
+ }
1339
+ ),
1340
+ renderStackedHitCountDisplay(
1341
+ showHitCount,
1342
+ showPercentage,
1343
+ clampedValue,
1344
+ max,
1345
+ percentage,
1346
+ percentageClassName
1347
+ )
1348
+ ] }),
1349
+ /* @__PURE__ */ jsx8(
1350
+ ProgressBarBase,
1351
+ {
1352
+ clampedValue,
1353
+ max,
1354
+ percentage,
1355
+ label,
1356
+ variantClasses,
1357
+ containerClassName: "w-full h-2 rounded-lg",
1358
+ fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
1359
+ }
1360
+ )
1361
+ ]
1362
+ }
1363
+ );
1364
+ var CompactLayout = ({
1365
+ className,
1366
+ label,
1367
+ showPercentage,
1368
+ showHitCount,
1369
+ labelClassName,
1370
+ percentageClassName,
1371
+ clampedValue,
1372
+ max,
1373
+ percentage,
1374
+ variantClasses,
1375
+ dimensions
1376
+ }) => {
1377
+ const {
1378
+ color,
1379
+ className: compactClassName,
1380
+ content
1381
+ } = getCompactLayoutConfig({
1382
+ showPercentage,
1383
+ showHitCount,
1384
+ percentage,
1385
+ clampedValue,
1386
+ max,
1387
+ label,
1388
+ percentageClassName,
1389
+ labelClassName
1390
+ });
1391
+ return /* @__PURE__ */ jsxs6(
1392
+ "div",
1393
+ {
1394
+ className: cn(
1395
+ "flex flex-col items-start gap-1",
1396
+ dimensions.width,
1397
+ dimensions.height,
1398
+ className
1399
+ ),
1400
+ children: [
1401
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsx8(
1402
+ Text_default,
1403
+ {
1404
+ as: "div",
1405
+ size: "sm",
1406
+ weight: "medium",
1407
+ color,
1408
+ className: cn("leading-4 w-full", compactClassName),
1409
+ children: content
1410
+ }
1411
+ ),
1412
+ /* @__PURE__ */ jsx8(
1413
+ ProgressBarBase,
1414
+ {
1415
+ clampedValue,
1416
+ max,
1417
+ percentage,
1418
+ label,
1419
+ variantClasses,
1420
+ containerClassName: "w-full h-1 rounded-full",
1421
+ fillClassName: "h-1 rounded-full"
1422
+ }
1423
+ )
1424
+ ]
1425
+ }
1426
+ );
1427
+ };
1428
+ var DefaultLayout = ({
1429
+ className,
1430
+ size,
1431
+ sizeClasses,
1432
+ variantClasses,
1433
+ label,
1434
+ showPercentage,
1435
+ labelClassName,
1436
+ percentageClassName,
1437
+ clampedValue,
1438
+ max,
1439
+ percentage
1440
+ }) => {
1441
+ const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
1442
+ const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
1443
+ const displayConfig = getDefaultLayoutDisplayConfig(
1444
+ size,
1445
+ label,
1446
+ showPercentage
1447
+ );
1448
+ return /* @__PURE__ */ jsxs6("div", { className: cn("flex", sizeClasses.layout, gapClass, className), children: [
1449
+ displayConfig.showHeader && /* @__PURE__ */ jsxs6("div", { className: "flex flex-row items-center justify-between w-full", children: [
1450
+ label && /* @__PURE__ */ jsx8(
1451
+ Text_default,
1452
+ {
1453
+ as: "div",
1454
+ size: "xs",
1455
+ weight: "medium",
1456
+ className: cn(
1457
+ "text-text-950 leading-none tracking-normal text-center",
1458
+ labelClassName
1459
+ ),
1460
+ children: label
1461
+ }
1462
+ ),
1463
+ showPercentage && /* @__PURE__ */ jsxs6(
1464
+ Text_default,
1465
+ {
1466
+ size: "xs",
1467
+ weight: "medium",
1468
+ className: cn(
1469
+ "text-text-950 leading-none tracking-normal text-center",
1470
+ percentageClassName
1471
+ ),
1472
+ children: [
1473
+ Math.round(percentage),
1474
+ "%"
1475
+ ]
1476
+ }
1477
+ )
1478
+ ] }),
1479
+ /* @__PURE__ */ jsx8(
1480
+ ProgressBarBase,
1481
+ {
1482
+ clampedValue,
1483
+ max,
1484
+ percentage,
1485
+ label,
1486
+ variantClasses,
1487
+ containerClassName: cn(
1488
+ progressBarClass,
1489
+ sizeClasses.container,
1490
+ sizeClasses.borderRadius
1491
+ ),
1492
+ fillClassName: cn(
1493
+ sizeClasses.bar,
1494
+ sizeClasses.borderRadius,
1495
+ "shadow-hard-shadow-3"
1496
+ )
1497
+ }
1498
+ ),
1499
+ displayConfig.showPercentage && /* @__PURE__ */ jsxs6(
1500
+ Text_default,
1501
+ {
1502
+ size: "xs",
1503
+ weight: "medium",
1504
+ className: cn(
1505
+ "text-text-950 leading-none tracking-normal text-center flex-none",
1506
+ percentageClassName
1507
+ ),
1508
+ children: [
1509
+ Math.round(percentage),
1510
+ "%"
1511
+ ]
1512
+ }
1513
+ ),
1514
+ displayConfig.showLabel && /* @__PURE__ */ jsx8(
1515
+ Text_default,
1516
+ {
1517
+ as: "div",
1518
+ size: "xs",
1519
+ weight: "medium",
1520
+ className: cn(
1521
+ "text-text-950 leading-none tracking-normal text-center flex-none",
1522
+ labelClassName
1523
+ ),
1524
+ children: label
1525
+ }
1526
+ )
1527
+ ] });
1528
+ };
1529
+ var ProgressBar = ({
1530
+ value,
1531
+ max = 100,
1532
+ size = "medium",
1533
+ variant = "blue",
1534
+ layout = "default",
1535
+ label,
1536
+ showPercentage = false,
1537
+ showHitCount = false,
1538
+ className = "",
1539
+ labelClassName = "",
1540
+ percentageClassName = "",
1541
+ stackedWidth,
1542
+ stackedHeight,
1543
+ compactWidth,
1544
+ compactHeight
1545
+ }) => {
1546
+ const { clampedValue, percentage } = calculateProgressValues(value, max);
1547
+ const sizeClasses = SIZE_CLASSES5[size];
1548
+ const variantClasses = VARIANT_CLASSES[variant];
1549
+ if (layout === "stacked") {
1550
+ return /* @__PURE__ */ jsx8(
1551
+ StackedLayout,
1552
+ {
1553
+ className,
1554
+ label,
1555
+ showPercentage,
1556
+ showHitCount,
1557
+ labelClassName,
1558
+ percentageClassName,
1559
+ clampedValue,
1560
+ max,
1561
+ percentage,
1562
+ variantClasses,
1563
+ dimensions: {
1564
+ width: stackedWidth ?? "w-[380px]",
1565
+ height: stackedHeight ?? "h-[35px]"
1566
+ }
1567
+ }
1568
+ );
1569
+ }
1570
+ if (layout === "compact") {
1571
+ return /* @__PURE__ */ jsx8(
1572
+ CompactLayout,
1573
+ {
1574
+ className,
1575
+ label,
1576
+ showPercentage,
1577
+ showHitCount,
1578
+ labelClassName,
1579
+ percentageClassName,
1580
+ clampedValue,
1581
+ max,
1582
+ percentage,
1583
+ variantClasses,
1584
+ dimensions: {
1585
+ width: compactWidth ?? "w-[131px]",
1586
+ height: compactHeight ?? "h-[24px]"
1587
+ }
1588
+ }
1589
+ );
1590
+ }
1591
+ return /* @__PURE__ */ jsx8(
1592
+ DefaultLayout,
1593
+ {
1594
+ className,
1595
+ size,
1596
+ sizeClasses,
1597
+ variantClasses,
1598
+ label,
1599
+ showPercentage,
1600
+ labelClassName,
1601
+ percentageClassName,
1602
+ clampedValue,
1603
+ max,
1604
+ percentage
1605
+ }
1606
+ );
1607
+ };
1608
+ var ProgressBar_default = ProgressBar;
1609
+
1610
+ // src/components/Alternative/Alternative.tsx
1611
+ import { CheckCircle, XCircle } from "phosphor-react";
1612
+ import { forwardRef as forwardRef4, useId as useId4, useState as useState3 } from "react";
1613
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1614
+ var AlternativesList = ({
1615
+ alternatives,
1616
+ name,
1617
+ defaultValue,
1618
+ value,
1619
+ onValueChange,
1620
+ disabled = false,
1621
+ layout = "default",
1622
+ className = "",
1623
+ mode = "interactive",
1624
+ selectedValue
1625
+ }) => {
1626
+ const uniqueId = useId4();
1627
+ const groupName = name || `alternatives-${uniqueId}`;
1628
+ const [actualValue, setActualValue] = useState3(value);
1629
+ const isReadonly = mode === "readonly";
1630
+ const getStatusStyles = (status, isReadonly2) => {
1631
+ const hoverClass = isReadonly2 ? "" : "hover:bg-background-50";
1632
+ switch (status) {
1633
+ case "correct":
1634
+ return "bg-success-background border-success-300";
1635
+ case "incorrect":
1636
+ return "bg-error-background border-error-300";
1637
+ default:
1638
+ return `bg-background border-border-100 ${hoverClass}`;
1639
+ }
1640
+ };
1641
+ const getStatusBadge = (status) => {
1642
+ switch (status) {
1643
+ case "correct":
1644
+ return /* @__PURE__ */ jsx9(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ jsx9(CheckCircle, {}), children: "Resposta correta" });
1645
+ case "incorrect":
1646
+ return /* @__PURE__ */ jsx9(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ jsx9(XCircle, {}), children: "Resposta incorreta" });
1647
+ default:
1648
+ return null;
1649
+ }
1650
+ };
1651
+ const getLayoutClasses = () => {
1652
+ switch (layout) {
1653
+ case "compact":
1654
+ return "gap-2";
1655
+ case "detailed":
1656
+ return "gap-4";
1657
+ default:
1658
+ return "gap-3.5";
1659
+ }
1660
+ };
1661
+ const renderReadonlyAlternative = (alternative) => {
1662
+ const alternativeId = alternative.value;
1663
+ const isUserSelected = selectedValue === alternative.value;
1664
+ const isCorrectAnswer = alternative.status === "correct";
1665
+ let displayStatus = void 0;
1666
+ if (isUserSelected && !isCorrectAnswer) {
1667
+ displayStatus = "incorrect";
1668
+ } else if (isCorrectAnswer) {
1669
+ displayStatus = "correct";
1670
+ }
1671
+ const statusStyles = getStatusStyles(displayStatus, true);
1672
+ const statusBadge = getStatusBadge(displayStatus);
1673
+ const renderRadio = () => {
1674
+ const radioClasses = `w-6 h-6 rounded-full border-2 cursor-default transition-all duration-200 flex items-center justify-center ${isUserSelected ? "border-primary-950 bg-background" : "border-border-400 bg-background"}`;
1675
+ const dotClasses = "w-3 h-3 rounded-full bg-primary-950 transition-all duration-200";
1676
+ return /* @__PURE__ */ jsx9("div", { className: radioClasses, children: isUserSelected && /* @__PURE__ */ jsx9("div", { className: dotClasses }) });
1677
+ };
1678
+ if (layout === "detailed") {
1679
+ return /* @__PURE__ */ jsx9(
1680
+ "div",
1681
+ {
1682
+ className: cn(
1683
+ "border-2 rounded-lg p-4 w-full",
1684
+ statusStyles,
1685
+ alternative.disabled ? "opacity-50" : ""
1686
+ ),
1687
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-3", children: [
1688
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-3 flex-1", children: [
1689
+ /* @__PURE__ */ jsx9("div", { className: "mt-1", children: renderRadio() }),
1690
+ /* @__PURE__ */ jsxs7("div", { className: "flex-1", children: [
1691
+ /* @__PURE__ */ jsx9(
1692
+ "p",
1693
+ {
1694
+ className: cn(
1695
+ "block font-medium",
1696
+ selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
1697
+ ),
1698
+ children: alternative.label
1699
+ }
1700
+ ),
1701
+ alternative.description && /* @__PURE__ */ jsx9("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
1702
+ ] })
1703
+ ] }),
1704
+ statusBadge && /* @__PURE__ */ jsx9("div", { className: "flex-shrink-0", children: statusBadge })
1705
+ ] })
1706
+ },
1707
+ alternativeId
1708
+ );
1709
+ }
1710
+ return /* @__PURE__ */ jsxs7(
1711
+ "div",
1712
+ {
1713
+ className: cn(
1714
+ "flex flex-row justify-between items-start gap-2 p-2 rounded-lg w-full",
1715
+ statusStyles,
1716
+ alternative.disabled ? "opacity-50" : ""
1717
+ ),
1718
+ children: [
1719
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 flex-1", children: [
1720
+ renderRadio(),
1721
+ /* @__PURE__ */ jsx9(
1722
+ "span",
1723
+ {
1724
+ className: cn(
1725
+ "flex-1",
1726
+ selectedValue === alternative.value || statusBadge ? "text-text-950" : "text-text-600"
1727
+ ),
1728
+ children: alternative.label
1729
+ }
1730
+ )
1731
+ ] }),
1732
+ statusBadge && /* @__PURE__ */ jsx9("div", { className: "flex-shrink-0", children: statusBadge })
1733
+ ]
1734
+ },
1735
+ alternativeId
1736
+ );
1737
+ };
1738
+ if (isReadonly) {
1739
+ return /* @__PURE__ */ jsx9(
1740
+ "div",
1741
+ {
1742
+ className: cn("flex flex-col", getLayoutClasses(), "w-full", className),
1743
+ children: alternatives.map(
1744
+ (alternative) => renderReadonlyAlternative(alternative)
1745
+ )
1746
+ }
1747
+ );
1748
+ }
1749
+ return /* @__PURE__ */ jsx9(
1750
+ RadioGroup,
1751
+ {
1752
+ name: groupName,
1753
+ defaultValue,
1754
+ value,
1755
+ onValueChange: (value2) => {
1756
+ setActualValue(value2);
1757
+ onValueChange?.(value2);
1758
+ },
1759
+ disabled,
1760
+ className: cn("flex flex-col", getLayoutClasses(), className),
1761
+ children: alternatives.map((alternative, index) => {
1762
+ const alternativeId = alternative.value || `alt-${index}`;
1763
+ const statusStyles = getStatusStyles(alternative.status, false);
1764
+ const statusBadge = getStatusBadge(alternative.status);
1765
+ if (layout === "detailed") {
1766
+ return /* @__PURE__ */ jsx9(
1767
+ "div",
1768
+ {
1769
+ className: cn(
1770
+ "border-2 rounded-lg p-4 transition-all",
1771
+ statusStyles,
1772
+ alternative.disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer"
1773
+ ),
1774
+ children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-3", children: [
1775
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-3 flex-1", children: [
1776
+ /* @__PURE__ */ jsx9(
1777
+ RadioGroupItem,
1778
+ {
1779
+ value: alternative.value,
1780
+ id: alternativeId,
1781
+ disabled: alternative.disabled,
1782
+ className: "mt-1"
1783
+ }
1784
+ ),
1785
+ /* @__PURE__ */ jsxs7("div", { className: "flex-1", children: [
1786
+ /* @__PURE__ */ jsx9(
1787
+ "label",
1788
+ {
1789
+ htmlFor: alternativeId,
1790
+ className: cn(
1791
+ "block font-medium",
1792
+ actualValue === alternative.value ? "text-text-950" : "text-text-600",
1793
+ alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
1794
+ ),
1795
+ children: alternative.label
1796
+ }
1797
+ ),
1798
+ alternative.description && /* @__PURE__ */ jsx9("p", { className: "text-sm text-text-600 mt-1", children: alternative.description })
1799
+ ] })
1800
+ ] }),
1801
+ statusBadge && /* @__PURE__ */ jsx9("div", { className: "flex-shrink-0", children: statusBadge })
1802
+ ] })
1803
+ },
1804
+ alternativeId
1805
+ );
1806
+ }
1807
+ return /* @__PURE__ */ jsxs7(
1808
+ "div",
1809
+ {
1810
+ className: cn(
1811
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
1812
+ statusStyles,
1813
+ alternative.disabled ? "opacity-50 cursor-not-allowed" : ""
1814
+ ),
1815
+ children: [
1816
+ /* @__PURE__ */ jsxs7("div", { className: "flex items-center gap-2 flex-1", children: [
1817
+ /* @__PURE__ */ jsx9(
1818
+ RadioGroupItem,
1819
+ {
1820
+ value: alternative.value,
1821
+ id: alternativeId,
1822
+ disabled: alternative.disabled
1823
+ }
1824
+ ),
1825
+ /* @__PURE__ */ jsx9(
1826
+ "label",
1827
+ {
1828
+ htmlFor: alternativeId,
1829
+ className: cn(
1830
+ "flex-1",
1831
+ actualValue === alternative.value ? "text-text-950" : "text-text-600",
1832
+ alternative.disabled ? "cursor-not-allowed" : "cursor-pointer"
1833
+ ),
1834
+ children: alternative.label
1835
+ }
1836
+ )
1837
+ ] }),
1838
+ statusBadge && /* @__PURE__ */ jsx9("div", { className: "flex-shrink-0", children: statusBadge })
1839
+ ]
1840
+ },
1841
+ alternativeId
1842
+ );
1843
+ })
1844
+ }
1845
+ );
1846
+ };
1847
+ var HeaderAlternative = forwardRef4(
1848
+ ({ className, title, subTitle, content, ...props }, ref) => {
1849
+ return /* @__PURE__ */ jsxs7(
1850
+ "div",
1851
+ {
1852
+ ref,
1853
+ className: cn(
1854
+ "bg-background p-4 flex flex-col gap-4 rounded-xl",
1855
+ className
1856
+ ),
1857
+ ...props,
1858
+ children: [
1859
+ /* @__PURE__ */ jsxs7("span", { className: "flex flex-col", children: [
1860
+ /* @__PURE__ */ jsx9("p", { className: "text-text-950 font-bold text-lg", children: title }),
1861
+ /* @__PURE__ */ jsx9("p", { className: "text-text-700 text-sm ", children: subTitle })
1862
+ ] }),
1863
+ /* @__PURE__ */ jsx9("p", { className: "text-text-950 text-md", children: content })
1864
+ ]
1865
+ }
1866
+ );
1867
+ }
1868
+ );
1869
+
1870
+ // src/components/Accordation/Accordation.tsx
1871
+ import {
1872
+ forwardRef as forwardRef6,
1873
+ useId as useId5,
1874
+ useState as useState5,
1875
+ useEffect as useEffect4
1876
+ } from "react";
1877
+
1878
+ // src/components/Card/Card.tsx
1879
+ import {
1880
+ forwardRef as forwardRef5,
1881
+ Fragment as Fragment3,
1882
+ useState as useState4,
1883
+ useRef as useRef3,
1884
+ useEffect as useEffect3
1885
+ } from "react";
1886
+ import {
1887
+ CaretRight,
1888
+ ChatCircleText,
1889
+ CheckCircle as CheckCircle2,
1890
+ Clock,
1891
+ DotsThreeVertical,
1892
+ Play,
1893
+ SpeakerHigh,
1894
+ SpeakerLow,
1895
+ SpeakerSimpleX,
1896
+ XCircle as XCircle2
1897
+ } from "phosphor-react";
1898
+
1899
+ // src/components/IconRender/IconRender.tsx
1900
+ import { cloneElement as cloneElement3 } from "react";
1901
+ import * as PhosphorIcons from "phosphor-react";
1902
+
1903
+ // src/assets/icons/subjects/ChatPT.tsx
1904
+ import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
1905
+ var ChatPT = ({ size, color }) => /* @__PURE__ */ jsxs8(
1906
+ "svg",
1907
+ {
1908
+ width: size,
1909
+ height: size,
1910
+ viewBox: "0 0 32 32",
1911
+ fill: "none",
1912
+ xmlns: "http://www.w3.org/2000/svg",
1913
+ children: [
1914
+ /* @__PURE__ */ jsx10(
1915
+ "path",
1916
+ {
1917
+ d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
1918
+ fill: color
1919
+ }
1920
+ ),
1921
+ /* @__PURE__ */ jsx10(
1922
+ "path",
1923
+ {
1924
+ d: "M21.1758 12V20.5312H19.7168V12H21.1758ZM23.8535 12V13.1719H17.0625V12H23.8535Z",
1925
+ fill: color
1926
+ }
1927
+ ),
1928
+ /* @__PURE__ */ jsx10(
1929
+ "path",
1930
+ {
1931
+ d: "M13.2402 17.3496H11.0195V16.1836H13.2402C13.627 16.1836 13.9395 16.1211 14.1777 15.9961C14.416 15.8711 14.5898 15.6992 14.6992 15.4805C14.8125 15.2578 14.8691 15.0039 14.8691 14.7188C14.8691 14.4492 14.8125 14.1973 14.6992 13.9629C14.5898 13.7246 14.416 13.5332 14.1777 13.3887C13.9395 13.2441 13.627 13.1719 13.2402 13.1719H11.4707V20.5312H10V12H13.2402C13.9004 12 14.4609 12.1172 14.9219 12.3516C15.3867 12.582 15.7402 12.9023 15.9824 13.3125C16.2246 13.7188 16.3457 14.1836 16.3457 14.707C16.3457 15.2578 16.2246 15.7305 15.9824 16.125C15.7402 16.5195 15.3867 16.8223 14.9219 17.0332C14.4609 17.2441 13.9004 17.3496 13.2402 17.3496Z",
1932
+ fill: color
1933
+ }
1934
+ )
1935
+ ]
1936
+ }
1937
+ );
1938
+
1939
+ // src/assets/icons/subjects/ChatEN.tsx
1940
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
1941
+ var ChatEN = ({ size, color }) => /* @__PURE__ */ jsxs9(
1942
+ "svg",
1943
+ {
1944
+ width: size,
1945
+ height: size,
1946
+ viewBox: "0 0 32 32",
1947
+ fill: "none",
1948
+ xmlns: "http://www.w3.org/2000/svg",
1949
+ children: [
1950
+ /* @__PURE__ */ jsx11(
1951
+ "path",
1952
+ {
1953
+ d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
1954
+ fill: color
1955
+ }
1956
+ ),
1957
+ /* @__PURE__ */ jsx11(
1958
+ "path",
1959
+ {
1960
+ d: "M22.5488 12V20.5312H21.0781L17.252 14.4199V20.5312H15.7812V12H17.252L21.0898 18.123V12H22.5488Z",
1961
+ fill: color
1962
+ }
1963
+ ),
1964
+ /* @__PURE__ */ jsx11(
1965
+ "path",
1966
+ {
1967
+ d: "M14.584 19.3652V20.5312H10.0547V19.3652H14.584ZM10.4707 12V20.5312H9V12H10.4707ZM13.9922 15.5625V16.7109H10.0547V15.5625H13.9922ZM14.5547 12V13.1719H10.0547V12H14.5547Z",
1968
+ fill: color
1969
+ }
1970
+ )
1971
+ ]
1972
+ }
1973
+ );
1974
+
1975
+ // src/assets/icons/subjects/ChatES.tsx
1976
+ import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
1977
+ var ChatES = ({ size, color }) => /* @__PURE__ */ jsxs10(
1978
+ "svg",
1979
+ {
1980
+ width: size,
1981
+ height: size,
1982
+ viewBox: "0 0 32 32",
1983
+ fill: "none",
1984
+ xmlns: "http://www.w3.org/2000/svg",
1985
+ children: [
1986
+ /* @__PURE__ */ jsx12(
1987
+ "path",
1988
+ {
1989
+ d: "M27 6H5.00004C4.4696 6 3.9609 6.21071 3.58582 6.58579C3.21075 6.96086 3.00004 7.46957 3.00004 8V28C2.99773 28.3814 3.10562 28.7553 3.31074 29.0768C3.51585 29.3984 3.80947 29.6538 4.15629 29.8125C4.42057 29.9356 4.7085 29.9995 5.00004 30C5.46954 29.9989 5.92347 29.8315 6.28129 29.5275L6.29254 29.5187L10.375 26H27C27.5305 26 28.0392 25.7893 28.4142 25.4142C28.7893 25.0391 29 24.5304 29 24V8C29 7.46957 28.7893 6.96086 28.4142 6.58579C28.0392 6.21071 27.5305 6 27 6ZM27 24H10C9.75992 24.0001 9.52787 24.0866 9.34629 24.2437L5.00004 28V8H27V24Z",
1990
+ fill: color
1991
+ }
1992
+ ),
1993
+ /* @__PURE__ */ jsx12(
1994
+ "path",
1995
+ {
1996
+ d: "M21.1426 17.8027C21.1426 17.627 21.1152 17.4707 21.0605 17.334C21.0098 17.1973 20.918 17.0723 20.7852 16.959C20.6523 16.8457 20.4648 16.7363 20.2227 16.6309C19.9844 16.5215 19.6797 16.4102 19.3086 16.2969C18.9023 16.1719 18.5273 16.0332 18.1836 15.8809C17.8438 15.7246 17.5469 15.5449 17.293 15.3418C17.0391 15.1348 16.8418 14.8984 16.7012 14.6328C16.5605 14.3633 16.4902 14.0527 16.4902 13.7012C16.4902 13.3535 16.5625 13.0371 16.707 12.752C16.8555 12.4668 17.0645 12.2207 17.334 12.0137C17.6074 11.8027 17.9297 11.6406 18.3008 11.5273C18.6719 11.4102 19.082 11.3516 19.5312 11.3516C20.1641 11.3516 20.709 11.4688 21.166 11.7031C21.627 11.9375 21.9805 12.252 22.2266 12.6465C22.4766 13.041 22.6016 13.4766 22.6016 13.9531H21.1426C21.1426 13.6719 21.082 13.4238 20.9609 13.209C20.8438 12.9902 20.6641 12.8184 20.4219 12.6934C20.1836 12.5684 19.8809 12.5059 19.5137 12.5059C19.166 12.5059 18.877 12.5586 18.6465 12.6641C18.416 12.7695 18.2441 12.9121 18.1309 13.0918C18.0176 13.2715 17.9609 13.4746 17.9609 13.7012C17.9609 13.8613 17.998 14.0078 18.0723 14.1406C18.1465 14.2695 18.2598 14.3906 18.4121 14.5039C18.5645 14.6133 18.7559 14.7168 18.9863 14.8145C19.2168 14.9121 19.4883 15.0059 19.8008 15.0957C20.2734 15.2363 20.6855 15.3926 21.0371 15.5645C21.3887 15.7324 21.6816 15.9238 21.916 16.1387C22.1504 16.3535 22.3262 16.5977 22.4434 16.8711C22.5605 17.1406 22.6191 17.4473 22.6191 17.791C22.6191 18.1504 22.5469 18.4746 22.4023 18.7637C22.2578 19.0488 22.0508 19.293 21.7812 19.4961C21.5156 19.6953 21.1953 19.8496 20.8203 19.959C20.4492 20.0645 20.0352 20.1172 19.5781 20.1172C19.168 20.1172 18.7637 20.0625 18.3652 19.9531C17.9707 19.8438 17.6113 19.6777 17.2871 19.4551C16.9629 19.2285 16.7051 18.9473 16.5137 18.6113C16.3223 18.2715 16.2266 17.875 16.2266 17.4219H17.6973C17.6973 17.6992 17.7441 17.9355 17.8379 18.1309C17.9355 18.3262 18.0703 18.4863 18.2422 18.6113C18.4141 18.7324 18.6133 18.8223 18.8398 18.8809C19.0703 18.9395 19.3164 18.9688 19.5781 18.9688C19.9219 18.9688 20.209 18.9199 20.4395 18.8223C20.6738 18.7246 20.8496 18.5879 20.9668 18.4121C21.084 18.2363 21.1426 18.0332 21.1426 17.8027Z",
1997
+ fill: color
1998
+ }
1999
+ ),
2000
+ /* @__PURE__ */ jsx12(
2001
+ "path",
2002
+ {
2003
+ d: "M15.4512 18.834V20H10.9219V18.834H15.4512ZM11.3379 11.4688V20H9.86719V11.4688H11.3379ZM14.8594 15.0312V16.1797H10.9219V15.0312H14.8594ZM15.4219 11.4688V12.6406H10.9219V11.4688H15.4219Z",
2004
+ fill: color
2005
+ }
2006
+ )
2007
+ ]
2008
+ }
2009
+ );
2010
+
2011
+ // src/components/IconRender/IconRender.tsx
2012
+ import { jsx as jsx13 } from "react/jsx-runtime";
2013
+ var IconRender = ({
2014
+ iconName,
2015
+ color = "#000000",
2016
+ size = 24,
2017
+ weight = "regular"
2018
+ }) => {
2019
+ if (typeof iconName === "string") {
2020
+ switch (iconName) {
2021
+ case "Chat_PT":
2022
+ return /* @__PURE__ */ jsx13(ChatPT, { size, color });
2023
+ case "Chat_EN":
2024
+ return /* @__PURE__ */ jsx13(ChatEN, { size, color });
2025
+ case "Chat_ES":
2026
+ return /* @__PURE__ */ jsx13(ChatES, { size, color });
2027
+ default: {
2028
+ const IconComponent = PhosphorIcons[iconName] || PhosphorIcons.Question;
2029
+ return /* @__PURE__ */ jsx13(IconComponent, { size, color, weight });
2030
+ }
2031
+ }
2032
+ } else {
2033
+ return cloneElement3(iconName, {
2034
+ size,
2035
+ color: "currentColor"
2036
+ });
2037
+ }
2038
+ };
2039
+ var IconRender_default = IconRender;
2040
+
2041
+ // src/components/Card/Card.tsx
2042
+ import { Fragment as Fragment4, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2043
+ var CARD_BASE_CLASSES = {
2044
+ default: "w-full bg-background border border-border-50 rounded-xl",
2045
+ compact: "w-full bg-background border border-border-50 rounded-lg",
2046
+ minimal: "w-full bg-background border border-border-100 rounded-md"
2047
+ };
2048
+ var CARD_PADDING_CLASSES = {
2049
+ none: "",
2050
+ small: "p-2",
2051
+ medium: "p-4",
2052
+ large: "p-6"
2053
+ };
2054
+ var CARD_MIN_HEIGHT_CLASSES = {
2055
+ none: "",
2056
+ small: "min-h-16",
2057
+ medium: "min-h-20",
2058
+ large: "min-h-24"
2059
+ };
2060
+ var CARD_LAYOUT_CLASSES = {
2061
+ horizontal: "flex flex-row",
2062
+ vertical: "flex flex-col"
2063
+ };
2064
+ var CARD_CURSOR_CLASSES = {
2065
+ default: "",
2066
+ pointer: "cursor-pointer"
2067
+ };
2068
+ var CardBase = forwardRef5(
2069
+ ({
2070
+ children,
2071
+ variant = "default",
2072
+ layout = "horizontal",
2073
+ padding = "medium",
2074
+ minHeight = "medium",
2075
+ cursor = "default",
2076
+ className = "",
2077
+ ...props
2078
+ }, ref) => {
2079
+ const baseClasses = CARD_BASE_CLASSES[variant];
2080
+ const paddingClasses = CARD_PADDING_CLASSES[padding];
2081
+ const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
2082
+ const layoutClasses = CARD_LAYOUT_CLASSES[layout];
2083
+ const cursorClasses = CARD_CURSOR_CLASSES[cursor];
2084
+ return /* @__PURE__ */ jsx14(
2085
+ "div",
2086
+ {
2087
+ ref,
2088
+ className: cn(
2089
+ baseClasses,
2090
+ paddingClasses,
2091
+ minHeightClasses,
2092
+ layoutClasses,
2093
+ cursorClasses,
2094
+ className
2095
+ ),
2096
+ ...props,
2097
+ children
2098
+ }
2099
+ );
2100
+ }
2101
+ );
2102
+ var ACTION_CARD_CLASSES = {
2103
+ warning: "bg-warning-background",
2104
+ success: "bg-success-200",
2105
+ error: "bg-error-100",
2106
+ info: "bg-info-background"
2107
+ };
2108
+ var ACTION_ICON_CLASSES = {
2109
+ warning: "bg-warning-300 text-text",
2110
+ success: "bg-indicator-positive text-text-950",
2111
+ error: "bg-indicator-negative text-text",
2112
+ info: "bg-info-500 text-text"
2113
+ };
2114
+ var ACTION_SUBTITLE_CLASSES = {
2115
+ warning: "text-warning-600",
2116
+ success: "text-success-700",
2117
+ error: "text-error-700",
2118
+ info: "text-info-700"
2119
+ };
2120
+ var ACTION_HEADER_CLASSES = {
2121
+ warning: "text-warning-300",
2122
+ success: "text-success-300",
2123
+ error: "text-error-300",
2124
+ info: "text-info-300"
2125
+ };
2126
+ var CardActivitiesResults = forwardRef5(
2127
+ ({
2128
+ icon,
2129
+ title,
2130
+ subTitle,
2131
+ header,
2132
+ extended = false,
2133
+ action = "success",
2134
+ description,
2135
+ className,
2136
+ ...props
2137
+ }, ref) => {
2138
+ const actionCardClasses = ACTION_CARD_CLASSES[action];
2139
+ const actionIconClasses = ACTION_ICON_CLASSES[action];
2140
+ const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
2141
+ const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
2142
+ return /* @__PURE__ */ jsxs11(
2143
+ "div",
2144
+ {
2145
+ ref,
2146
+ className: cn(
2147
+ "w-full flex flex-col border border-border-50 bg-background rounded-xl",
2148
+ className
2149
+ ),
2150
+ ...props,
2151
+ children: [
2152
+ /* @__PURE__ */ jsxs11(
2153
+ "div",
2154
+ {
2155
+ className: cn(
2156
+ "flex flex-col gap-1 items-center justify-center p-4",
2157
+ actionCardClasses,
2158
+ extended ? "rounded-t-xl" : "rounded-xl"
2159
+ ),
2160
+ children: [
2161
+ /* @__PURE__ */ jsx14(
2162
+ "span",
2163
+ {
2164
+ className: cn(
2165
+ "size-7.5 rounded-full flex items-center justify-center",
2166
+ actionIconClasses
2167
+ ),
2168
+ children: icon
2169
+ }
2170
+ ),
2171
+ /* @__PURE__ */ jsx14(
2172
+ Text_default,
2173
+ {
2174
+ size: "2xs",
2175
+ weight: "medium",
2176
+ className: "text-text-800 uppercase truncate",
2177
+ children: title
2178
+ }
2179
+ ),
2180
+ /* @__PURE__ */ jsx14(
2181
+ "p",
2182
+ {
2183
+ className: cn("text-lg font-bold truncate", actionSubTitleClasses),
2184
+ children: subTitle
2185
+ }
2186
+ )
2187
+ ]
2188
+ }
2189
+ ),
2190
+ extended && /* @__PURE__ */ jsxs11("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
2191
+ /* @__PURE__ */ jsx14(
2192
+ "p",
2193
+ {
2194
+ className: cn(
2195
+ "text-2xs font-medium uppercase truncate",
2196
+ actionHeaderClasses
2197
+ ),
2198
+ children: header
2199
+ }
2200
+ ),
2201
+ /* @__PURE__ */ jsx14(Badge_default, { size: "large", action: "info", children: description })
2202
+ ] })
2203
+ ]
2204
+ }
2205
+ );
2206
+ }
2207
+ );
2208
+ var CardQuestions = forwardRef5(
2209
+ ({
2210
+ header,
2211
+ state = "undone",
2212
+ className,
2213
+ onClickButton,
2214
+ valueButton,
2215
+ ...props
2216
+ }, ref) => {
2217
+ const isDone = state === "done";
2218
+ const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
2219
+ const buttonLabel = isDone ? "Ver Resultado" : "Responder";
2220
+ return /* @__PURE__ */ jsxs11(
2221
+ CardBase,
2222
+ {
2223
+ ref,
2224
+ layout: "horizontal",
2225
+ padding: "medium",
2226
+ minHeight: "medium",
2227
+ className: cn("justify-between gap-4", className),
2228
+ ...props,
2229
+ children: [
2230
+ /* @__PURE__ */ jsxs11("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
2231
+ /* @__PURE__ */ jsx14("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
2232
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-row gap-6 items-center", children: /* @__PURE__ */ jsx14(
2233
+ Badge_default,
2234
+ {
2235
+ size: "medium",
2236
+ variant: "solid",
2237
+ action: isDone ? "success" : "error",
2238
+ children: stateLabel
2239
+ }
2240
+ ) })
2241
+ ] }),
2242
+ /* @__PURE__ */ jsx14("span", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx14(
2243
+ Button_default,
2244
+ {
2245
+ size: "extra-small",
2246
+ onClick: () => onClickButton?.(valueButton),
2247
+ className: "min-w-fit",
2248
+ children: buttonLabel
2249
+ }
2250
+ ) })
2251
+ ]
2252
+ }
2253
+ );
2254
+ }
2255
+ );
2256
+ var CardProgress = forwardRef5(
2257
+ ({
2258
+ header,
2259
+ subhead,
2260
+ initialDate,
2261
+ endDate,
2262
+ progress = 0,
2263
+ direction = "horizontal",
2264
+ icon,
2265
+ color = "#B7DFFF",
2266
+ progressVariant = "blue",
2267
+ showDates = true,
2268
+ className,
2269
+ ...props
2270
+ }, ref) => {
2271
+ const isHorizontal = direction === "horizontal";
2272
+ const contentComponent = {
2273
+ horizontal: /* @__PURE__ */ jsxs11(Fragment4, { children: [
2274
+ showDates && /* @__PURE__ */ jsxs11("div", { className: "flex flex-row gap-6 items-center", children: [
2275
+ initialDate && /* @__PURE__ */ jsxs11("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
2276
+ /* @__PURE__ */ jsx14("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
2277
+ /* @__PURE__ */ jsx14("p", { className: "text-text-600", children: initialDate })
2278
+ ] }),
2279
+ endDate && /* @__PURE__ */ jsxs11("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
2280
+ /* @__PURE__ */ jsx14("p", { className: "text-text-800 font-semibold", children: "Fim" }),
2281
+ /* @__PURE__ */ jsx14("p", { className: "text-text-600", children: endDate })
2282
+ ] })
2283
+ ] }),
2284
+ /* @__PURE__ */ jsxs11("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
2285
+ /* @__PURE__ */ jsx14(
2286
+ ProgressBar_default,
2287
+ {
2288
+ size: "small",
2289
+ value: progress,
2290
+ variant: progressVariant,
2291
+ "data-testid": "progress-bar"
2292
+ }
2293
+ ),
2294
+ /* @__PURE__ */ jsxs11(
2295
+ Text_default,
2296
+ {
2297
+ size: "xs",
2298
+ weight: "medium",
2299
+ className: cn(
2300
+ "text-text-950 leading-none tracking-normal text-center flex-none"
2301
+ ),
2302
+ children: [
2303
+ Math.round(progress),
2304
+ "%"
2305
+ ]
2306
+ }
2307
+ )
2308
+ ] })
2309
+ ] }),
2310
+ vertical: /* @__PURE__ */ jsx14("p", { className: "text-sm text-text-800", children: subhead })
2311
+ };
2312
+ return /* @__PURE__ */ jsxs11(
2313
+ CardBase,
2314
+ {
2315
+ ref,
2316
+ layout: isHorizontal ? "horizontal" : "vertical",
2317
+ padding: "none",
2318
+ minHeight: "medium",
2319
+ cursor: "pointer",
2320
+ className: cn(isHorizontal ? "h-20" : "", className),
2321
+ ...props,
2322
+ children: [
2323
+ /* @__PURE__ */ jsx14(
2324
+ "div",
2325
+ {
2326
+ className: cn(
2327
+ "flex justify-center items-center [&>svg]:size-6 text-text-950",
2328
+ isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl",
2329
+ !color.startsWith("#") ? `${color}` : ""
2330
+ ),
2331
+ style: color.startsWith("#") ? { backgroundColor: color } : void 0,
2332
+ "data-testid": "icon-container",
2333
+ children: icon
2334
+ }
2335
+ ),
2336
+ /* @__PURE__ */ jsxs11(
2337
+ "div",
2338
+ {
2339
+ className: cn(
2340
+ "p-4 flex flex-col justify-between w-full h-full",
2341
+ !isHorizontal && "gap-4"
2342
+ ),
2343
+ children: [
2344
+ /* @__PURE__ */ jsx14(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
2345
+ contentComponent[direction]
2346
+ ]
2347
+ }
2348
+ )
2349
+ ]
2350
+ }
2351
+ );
2352
+ }
2353
+ );
2354
+ var CardTopic = forwardRef5(
2355
+ ({
2356
+ header,
2357
+ subHead,
2358
+ progress,
2359
+ showPercentage = false,
2360
+ progressVariant = "blue",
2361
+ className = "",
2362
+ ...props
2363
+ }, ref) => {
2364
+ return /* @__PURE__ */ jsxs11(
2365
+ CardBase,
2366
+ {
2367
+ ref,
2368
+ layout: "vertical",
2369
+ padding: "small",
2370
+ minHeight: "medium",
2371
+ cursor: "pointer",
2372
+ className: cn("justify-center gap-2 py-2 px-4", className),
2373
+ ...props,
2374
+ children: [
2375
+ subHead && /* @__PURE__ */ jsx14("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ jsxs11(Fragment3, { children: [
2376
+ /* @__PURE__ */ jsx14("p", { children: text }),
2377
+ index < subHead.length - 1 && /* @__PURE__ */ jsx14("p", { children: "\u2022" })
2378
+ ] }, `${text} - ${index}`)) }),
2379
+ /* @__PURE__ */ jsx14("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
2380
+ /* @__PURE__ */ jsxs11("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
2381
+ /* @__PURE__ */ jsx14(
2382
+ ProgressBar_default,
2383
+ {
2384
+ size: "small",
2385
+ value: progress,
2386
+ variant: progressVariant,
2387
+ "data-testid": "progress-bar"
2388
+ }
2389
+ ),
2390
+ showPercentage && /* @__PURE__ */ jsxs11(
2391
+ Text_default,
2392
+ {
2393
+ size: "xs",
2394
+ weight: "medium",
2395
+ className: cn(
2396
+ "text-text-950 leading-none tracking-normal text-center flex-none"
2397
+ ),
2398
+ children: [
2399
+ Math.round(progress),
2400
+ "%"
2401
+ ]
2402
+ }
2403
+ )
2404
+ ] })
2405
+ ]
2406
+ }
2407
+ );
2408
+ }
2409
+ );
2410
+ var CardPerformance = forwardRef5(
2411
+ ({
2412
+ header,
2413
+ progress,
2414
+ description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
2415
+ actionVariant = "button",
2416
+ progressVariant = "blue",
2417
+ labelProgress = "",
2418
+ className = "",
2419
+ onClickButton,
2420
+ valueButton,
2421
+ ...props
2422
+ }, ref) => {
2423
+ const hasProgress = progress !== void 0;
2424
+ return /* @__PURE__ */ jsxs11(
2425
+ CardBase,
2426
+ {
2427
+ ref,
2428
+ layout: "horizontal",
2429
+ padding: "medium",
2430
+ minHeight: "none",
2431
+ className: cn(
2432
+ actionVariant == "caret" ? "cursor-pointer" : "",
2433
+ className
2434
+ ),
2435
+ onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
2436
+ ...props,
2437
+ children: [
2438
+ /* @__PURE__ */ jsxs11("div", { className: "w-full flex flex-col justify-between gap-2", children: [
2439
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-row justify-between items-center gap-2", children: [
2440
+ /* @__PURE__ */ jsx14("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2441
+ actionVariant === "button" && /* @__PURE__ */ jsx14(
2442
+ Button_default,
2443
+ {
2444
+ variant: "outline",
2445
+ size: "extra-small",
2446
+ onClick: () => onClickButton?.(valueButton),
2447
+ className: "min-w-fit flex-shrink-0",
2448
+ children: "Ver Aula"
2449
+ }
2450
+ )
2451
+ ] }),
2452
+ /* @__PURE__ */ jsx14("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ jsx14(
2453
+ ProgressBar_default,
2454
+ {
2455
+ value: progress,
2456
+ label: `${progress}% ${labelProgress}`,
2457
+ variant: progressVariant
2458
+ }
2459
+ ) : /* @__PURE__ */ jsx14("p", { className: "text-xs text-text-600 truncate", children: description }) })
2460
+ ] }),
2461
+ actionVariant == "caret" && /* @__PURE__ */ jsx14(
2462
+ CaretRight,
2463
+ {
2464
+ className: "size-4.5 text-text-800 cursor-pointer",
2465
+ "data-testid": "caret-icon"
2466
+ }
2467
+ )
2468
+ ]
2469
+ }
2470
+ );
2471
+ }
2472
+ );
2473
+ var CardResults = forwardRef5(
2474
+ ({
2475
+ header,
2476
+ correct_answers,
2477
+ incorrect_answers,
2478
+ icon,
2479
+ direction = "col",
2480
+ color = "#B7DFFF",
2481
+ className,
2482
+ ...props
2483
+ }, ref) => {
2484
+ const isRow = direction == "row";
2485
+ return /* @__PURE__ */ jsxs11(
2486
+ CardBase,
2487
+ {
2488
+ ref,
2489
+ layout: "horizontal",
2490
+ padding: "none",
2491
+ minHeight: "medium",
2492
+ className: cn("items-stretch cursor-pointer pr-4", className),
2493
+ ...props,
2494
+ children: [
2495
+ /* @__PURE__ */ jsx14(
2496
+ "div",
2497
+ {
2498
+ className: cn(
2499
+ "flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-full rounded-l-xl"
2500
+ ),
2501
+ style: {
2502
+ backgroundColor: color
2503
+ },
2504
+ children: /* @__PURE__ */ jsx14(IconRender_default, { iconName: icon, color: "currentColor", size: 20 })
2505
+ }
2506
+ ),
2507
+ /* @__PURE__ */ jsxs11("div", { className: "w-full flex flex-row justify-between items-center", children: [
2508
+ /* @__PURE__ */ jsxs11(
2509
+ "div",
2510
+ {
2511
+ className: cn(
2512
+ "p-4 flex flex-wrap justify-between w-full h-full",
2513
+ isRow ? "flex-row items-center gap-2" : "flex-col"
2514
+ ),
2515
+ children: [
2516
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-bold text-text-950 flex-1", children: header }),
2517
+ /* @__PURE__ */ jsxs11("span", { className: "flex flex-wrap flex-row gap-1 items-center", children: [
2518
+ /* @__PURE__ */ jsxs11(
2519
+ Badge_default,
2520
+ {
2521
+ action: "success",
2522
+ variant: "solid",
2523
+ size: "large",
2524
+ iconLeft: /* @__PURE__ */ jsx14(CheckCircle2, {}),
2525
+ children: [
2526
+ correct_answers,
2527
+ " Corretas"
2528
+ ]
2529
+ }
2530
+ ),
2531
+ /* @__PURE__ */ jsxs11(
2532
+ Badge_default,
2533
+ {
2534
+ action: "error",
2535
+ variant: "solid",
2536
+ size: "large",
2537
+ iconLeft: /* @__PURE__ */ jsx14(XCircle2, {}),
2538
+ children: [
2539
+ incorrect_answers,
2540
+ " Incorretas"
2541
+ ]
2542
+ }
2543
+ )
2544
+ ] })
2545
+ ]
2546
+ }
2547
+ ),
2548
+ /* @__PURE__ */ jsx14(CaretRight, { className: "min-w-6 min-h-6 text-text-800" })
2549
+ ] })
2550
+ ]
2551
+ }
2552
+ );
2553
+ }
2554
+ );
2555
+ var CardStatus = forwardRef5(
2556
+ ({ header, className, status, label, ...props }, ref) => {
2557
+ const getLabelBadge = (status2) => {
2558
+ switch (status2) {
2559
+ case "correct":
2560
+ return "Correta";
2561
+ case "incorrect":
2562
+ return "Incorreta";
2563
+ case "unanswered":
2564
+ return "Em branco";
2565
+ case "pending":
2566
+ return "Avalia\xE7\xE3o pendente";
2567
+ default:
2568
+ return "Em branco";
2569
+ }
2570
+ };
2571
+ const getIconBadge = (status2) => {
2572
+ switch (status2) {
2573
+ case "correct":
2574
+ return /* @__PURE__ */ jsx14(CheckCircle2, {});
2575
+ case "incorrect":
2576
+ return /* @__PURE__ */ jsx14(XCircle2, {});
2577
+ case "pending":
2578
+ return /* @__PURE__ */ jsx14(Clock, {});
2579
+ default:
2580
+ return /* @__PURE__ */ jsx14(XCircle2, {});
2581
+ }
2582
+ };
2583
+ const getActionBadge = (status2) => {
2584
+ switch (status2) {
2585
+ case "correct":
2586
+ return "success";
2587
+ case "incorrect":
2588
+ return "error";
2589
+ case "pending":
2590
+ return "info";
2591
+ default:
2592
+ return "info";
2593
+ }
2594
+ };
2595
+ return /* @__PURE__ */ jsx14(
2596
+ CardBase,
2597
+ {
2598
+ ref,
2599
+ layout: "horizontal",
2600
+ padding: "medium",
2601
+ minHeight: "medium",
2602
+ className: cn("items-center cursor-pointer", className),
2603
+ ...props,
2604
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
2605
+ /* @__PURE__ */ jsx14("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
2606
+ /* @__PURE__ */ jsxs11("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
2607
+ status && /* @__PURE__ */ jsx14(
2608
+ Badge_default,
2609
+ {
2610
+ action: getActionBadge(status),
2611
+ variant: "solid",
2612
+ size: "medium",
2613
+ iconLeft: getIconBadge(status),
2614
+ children: getLabelBadge(status)
2615
+ }
2616
+ ),
2617
+ label && /* @__PURE__ */ jsx14("p", { className: "text-sm text-text-800", children: label })
2618
+ ] }),
2619
+ /* @__PURE__ */ jsx14(CaretRight, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
2620
+ ] })
2621
+ }
2622
+ );
2623
+ }
2624
+ );
2625
+ var CardSettings = forwardRef5(
2626
+ ({ header, className, icon, ...props }, ref) => {
2627
+ return /* @__PURE__ */ jsxs11(
2628
+ CardBase,
2629
+ {
2630
+ ref,
2631
+ layout: "horizontal",
2632
+ padding: "small",
2633
+ minHeight: "none",
2634
+ className: cn(
2635
+ "border-none items-center gap-2 text-text-700",
2636
+ className
2637
+ ),
2638
+ ...props,
2639
+ children: [
2640
+ /* @__PURE__ */ jsx14("span", { className: "[&>svg]:size-6", children: icon }),
2641
+ /* @__PURE__ */ jsx14("p", { className: "w-full text-sm truncate", children: header }),
2642
+ /* @__PURE__ */ jsx14(CaretRight, { size: 24, className: "cursor-pointer" })
2643
+ ]
2644
+ }
2645
+ );
2646
+ }
2647
+ );
2648
+ var CardSupport = forwardRef5(
2649
+ ({ header, className, direction = "col", children, ...props }, ref) => {
2650
+ return /* @__PURE__ */ jsxs11(
2651
+ CardBase,
2652
+ {
2653
+ ref,
2654
+ layout: "horizontal",
2655
+ padding: "medium",
2656
+ minHeight: "none",
2657
+ className: cn(
2658
+ "border-none items-center gap-2 text-text-700",
2659
+ className
2660
+ ),
2661
+ ...props,
2662
+ children: [
2663
+ /* @__PURE__ */ jsxs11(
2664
+ "div",
2665
+ {
2666
+ className: cn(
2667
+ "w-full flex",
2668
+ direction == "col" ? "flex-col" : "flex-row items-center"
2669
+ ),
2670
+ children: [
2671
+ /* @__PURE__ */ jsx14("span", { className: "w-full min-w-0", children: /* @__PURE__ */ jsx14("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
2672
+ /* @__PURE__ */ jsx14("span", { className: "flex flex-row gap-1", children })
2673
+ ]
2674
+ }
2675
+ ),
2676
+ /* @__PURE__ */ jsx14(CaretRight, { className: "text-text-800 cursor-pointer", size: 24 })
2677
+ ]
2678
+ }
2679
+ );
2680
+ }
2681
+ );
2682
+ var CardForum = forwardRef5(
2683
+ ({
2684
+ title,
2685
+ content,
2686
+ comments,
2687
+ onClickComments,
2688
+ valueComments,
2689
+ onClickProfile,
2690
+ valueProfile,
2691
+ className = "",
2692
+ date,
2693
+ hour,
2694
+ ...props
2695
+ }, ref) => {
2696
+ return /* @__PURE__ */ jsxs11(
2697
+ CardBase,
2698
+ {
2699
+ ref,
2700
+ layout: "horizontal",
2701
+ padding: "medium",
2702
+ minHeight: "none",
2703
+ variant: "minimal",
2704
+ className: cn("w-auto h-auto gap-3", className),
2705
+ ...props,
2706
+ children: [
2707
+ /* @__PURE__ */ jsx14(
2708
+ "button",
2709
+ {
2710
+ type: "button",
2711
+ "aria-label": "Ver perfil",
2712
+ onClick: () => onClickProfile?.(valueProfile),
2713
+ className: "min-w-8 h-8 rounded-full bg-background-950"
2714
+ }
2715
+ ),
2716
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
2717
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
2718
+ /* @__PURE__ */ jsx14("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
2719
+ /* @__PURE__ */ jsxs11("p", { className: "text-xs text-text-600", children: [
2720
+ "\u2022 ",
2721
+ date,
2722
+ " \u2022 ",
2723
+ hour
2724
+ ] })
2725
+ ] }),
2726
+ /* @__PURE__ */ jsx14("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
2727
+ /* @__PURE__ */ jsxs11(
2728
+ "button",
2729
+ {
2730
+ type: "button",
2731
+ "aria-label": "Ver coment\xE1rios",
2732
+ onClick: () => onClickComments?.(valueComments),
2733
+ className: "text-text-600 flex flex-row gap-2 items-center",
2734
+ children: [
2735
+ /* @__PURE__ */ jsx14(ChatCircleText, { "aria-hidden": "true", size: 16 }),
2736
+ /* @__PURE__ */ jsxs11("p", { className: "text-xs", children: [
2737
+ comments,
2738
+ " respostas"
2739
+ ] })
2740
+ ]
2741
+ }
2742
+ )
2743
+ ] })
2744
+ ]
2745
+ }
2746
+ );
2747
+ }
2748
+ );
2749
+ var CardAudio = forwardRef5(
2750
+ ({
2751
+ src,
2752
+ title,
2753
+ onPlay,
2754
+ onPause,
2755
+ onEnded,
2756
+ onAudioTimeUpdate,
2757
+ loop = false,
2758
+ preload = "metadata",
2759
+ tracks,
2760
+ className,
2761
+ ...props
2762
+ }, ref) => {
2763
+ const [isPlaying, setIsPlaying] = useState4(false);
2764
+ const [currentTime, setCurrentTime] = useState4(0);
2765
+ const [duration, setDuration] = useState4(0);
2766
+ const [volume, setVolume] = useState4(1);
2767
+ const [showVolumeControl, setShowVolumeControl] = useState4(false);
2768
+ const [showSpeedMenu, setShowSpeedMenu] = useState4(false);
2769
+ const [playbackRate, setPlaybackRate] = useState4(1);
2770
+ const audioRef = useRef3(null);
2771
+ const volumeControlRef = useRef3(null);
2772
+ const speedMenuRef = useRef3(null);
2773
+ const formatTime = (time) => {
2774
+ const minutes = Math.floor(time / 60);
2775
+ const seconds = Math.floor(time % 60);
2776
+ return `${minutes}:${seconds.toString().padStart(2, "0")}`;
2777
+ };
2778
+ const handlePlayPause = () => {
2779
+ if (isPlaying) {
2780
+ audioRef.current?.pause();
2781
+ setIsPlaying(false);
2782
+ onPause?.();
2783
+ } else {
2784
+ audioRef.current?.play();
2785
+ setIsPlaying(true);
2786
+ onPlay?.();
2787
+ }
2788
+ };
2789
+ const handleTimeUpdate = () => {
2790
+ const current = audioRef.current?.currentTime ?? 0;
2791
+ const total = audioRef.current?.duration ?? 0;
2792
+ setCurrentTime(current);
2793
+ setDuration(total);
2794
+ onAudioTimeUpdate?.(current, total);
2795
+ };
2796
+ const handleLoadedMetadata = () => {
2797
+ setDuration(audioRef.current?.duration ?? 0);
2798
+ };
2799
+ const handleEnded = () => {
2800
+ setIsPlaying(false);
2801
+ setCurrentTime(0);
2802
+ onEnded?.();
2803
+ };
2804
+ const handleProgressClick = (e) => {
2805
+ const rect = e.currentTarget.getBoundingClientRect();
2806
+ const clickX = e.clientX - rect.left;
2807
+ const width = rect.width;
2808
+ const percentage = clickX / width;
2809
+ const newTime = percentage * duration;
2810
+ if (audioRef.current) {
2811
+ audioRef.current.currentTime = newTime;
2812
+ }
2813
+ setCurrentTime(newTime);
2814
+ };
2815
+ const handleVolumeChange = (e) => {
2816
+ const newVolume = parseFloat(e.target.value);
2817
+ setVolume(newVolume);
2818
+ if (audioRef.current) {
2819
+ audioRef.current.volume = newVolume;
2820
+ }
2821
+ };
2822
+ const toggleVolumeControl = () => {
2823
+ setShowVolumeControl(!showVolumeControl);
2824
+ setShowSpeedMenu(false);
2825
+ };
2826
+ const toggleSpeedMenu = () => {
2827
+ setShowSpeedMenu(!showSpeedMenu);
2828
+ setShowVolumeControl(false);
2829
+ };
2830
+ const handleSpeedChange = (speed) => {
2831
+ setPlaybackRate(speed);
2832
+ if (audioRef.current) {
2833
+ audioRef.current.playbackRate = speed;
2834
+ }
2835
+ setShowSpeedMenu(false);
2836
+ };
2837
+ const getVolumeIcon = () => {
2838
+ if (volume === 0) {
2839
+ return /* @__PURE__ */ jsx14(SpeakerSimpleX, { size: 24 });
2840
+ }
2841
+ if (volume < 0.5) {
2842
+ return /* @__PURE__ */ jsx14(SpeakerLow, { size: 24 });
2843
+ }
2844
+ return /* @__PURE__ */ jsx14(SpeakerHigh, { size: 24 });
2845
+ };
2846
+ useEffect3(() => {
2847
+ const handleClickOutside = (event) => {
2848
+ if (volumeControlRef.current && !volumeControlRef.current.contains(event.target)) {
2849
+ setShowVolumeControl(false);
2850
+ }
2851
+ if (speedMenuRef.current && !speedMenuRef.current.contains(event.target)) {
2852
+ setShowSpeedMenu(false);
2853
+ }
2854
+ };
2855
+ document.addEventListener("mousedown", handleClickOutside);
2856
+ return () => {
2857
+ document.removeEventListener("mousedown", handleClickOutside);
2858
+ };
2859
+ }, []);
2860
+ return /* @__PURE__ */ jsxs11(
2861
+ CardBase,
2862
+ {
2863
+ ref,
2864
+ layout: "horizontal",
2865
+ padding: "medium",
2866
+ minHeight: "none",
2867
+ className: cn(
2868
+ "flex flex-row w-auto h-14 items-center gap-2",
2869
+ className
2870
+ ),
2871
+ ...props,
2872
+ children: [
2873
+ /* @__PURE__ */ jsx14(
2874
+ "audio",
2875
+ {
2876
+ ref: audioRef,
2877
+ src,
2878
+ loop,
2879
+ preload,
2880
+ onTimeUpdate: handleTimeUpdate,
2881
+ onLoadedMetadata: handleLoadedMetadata,
2882
+ onEnded: handleEnded,
2883
+ "data-testid": "audio-element",
2884
+ "aria-label": title,
2885
+ children: tracks ? tracks.map((track) => /* @__PURE__ */ jsx14(
2886
+ "track",
2887
+ {
2888
+ kind: track.kind,
2889
+ src: track.src,
2890
+ srcLang: track.srcLang,
2891
+ label: track.label,
2892
+ default: track.default
2893
+ },
2894
+ track.src
2895
+ )) : /* @__PURE__ */ jsx14(
2896
+ "track",
2897
+ {
2898
+ kind: "captions",
2899
+ src: "data:text/vtt;base64,",
2900
+ srcLang: "pt",
2901
+ label: "Sem legendas dispon\xEDveis"
2902
+ }
2903
+ )
2904
+ }
2905
+ ),
2906
+ /* @__PURE__ */ jsx14(
2907
+ "button",
2908
+ {
2909
+ type: "button",
2910
+ onClick: handlePlayPause,
2911
+ disabled: !src,
2912
+ className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
2913
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
2914
+ children: isPlaying ? /* @__PURE__ */ jsx14("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsxs11("div", { className: "flex gap-0.5", children: [
2915
+ /* @__PURE__ */ jsx14("div", { className: "w-1 h-4 bg-current rounded-sm" }),
2916
+ /* @__PURE__ */ jsx14("div", { className: "w-1 h-4 bg-current rounded-sm" })
2917
+ ] }) }) : /* @__PURE__ */ jsx14(Play, { size: 24 })
2918
+ }
2919
+ ),
2920
+ /* @__PURE__ */ jsx14("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
2921
+ /* @__PURE__ */ jsx14("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ jsx14(
2922
+ "button",
2923
+ {
2924
+ type: "button",
2925
+ className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
2926
+ onClick: handleProgressClick,
2927
+ onKeyDown: (e) => {
2928
+ if (e.key === "Enter" || e.key === " ") {
2929
+ e.preventDefault();
2930
+ handleProgressClick(
2931
+ e
2932
+ );
2933
+ }
2934
+ },
2935
+ "aria-label": "Barra de progresso do \xE1udio",
2936
+ children: /* @__PURE__ */ jsx14(
2937
+ "div",
2938
+ {
2939
+ className: "h-full bg-primary-600 rounded-full transition-all duration-100",
2940
+ style: {
2941
+ width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
2942
+ }
2943
+ }
2944
+ )
2945
+ }
2946
+ ) }),
2947
+ /* @__PURE__ */ jsx14("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(duration) }),
2948
+ /* @__PURE__ */ jsxs11("div", { className: "relative h-6", ref: volumeControlRef, children: [
2949
+ /* @__PURE__ */ jsx14(
2950
+ "button",
2951
+ {
2952
+ type: "button",
2953
+ onClick: toggleVolumeControl,
2954
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
2955
+ "aria-label": "Controle de volume",
2956
+ children: /* @__PURE__ */ jsx14("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
2957
+ }
2958
+ ),
2959
+ showVolumeControl && /* @__PURE__ */ jsx14(
2960
+ "button",
2961
+ {
2962
+ type: "button",
2963
+ className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg focus:outline-none focus:ring-2 focus:ring-primary-500",
2964
+ onKeyDown: (e) => {
2965
+ if (e.key === "Escape") {
2966
+ setShowVolumeControl(false);
2967
+ }
2968
+ },
2969
+ children: /* @__PURE__ */ jsx14(
2970
+ "input",
2971
+ {
2972
+ type: "range",
2973
+ min: "0",
2974
+ max: "1",
2975
+ step: "0.1",
2976
+ value: volume,
2977
+ onChange: handleVolumeChange,
2978
+ onKeyDown: (e) => {
2979
+ if (e.key === "ArrowUp" || e.key === "ArrowRight") {
2980
+ e.preventDefault();
2981
+ const newVolume = Math.min(
2982
+ 1,
2983
+ Math.round((volume + 0.1) * 10) / 10
2984
+ );
2985
+ setVolume(newVolume);
2986
+ if (audioRef.current) audioRef.current.volume = newVolume;
2987
+ } else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
2988
+ e.preventDefault();
2989
+ const newVolume = Math.max(
2990
+ 0,
2991
+ Math.round((volume - 0.1) * 10) / 10
2992
+ );
2993
+ setVolume(newVolume);
2994
+ if (audioRef.current) audioRef.current.volume = newVolume;
2995
+ }
2996
+ },
2997
+ className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
2998
+ style: {
2999
+ background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
3000
+ },
3001
+ "aria-label": "Volume",
3002
+ "aria-valuenow": Math.round(volume * 100),
3003
+ "aria-valuemin": 0,
3004
+ "aria-valuemax": 100
3005
+ }
3006
+ )
3007
+ }
3008
+ )
3009
+ ] }),
3010
+ /* @__PURE__ */ jsxs11("div", { className: "relative h-6", ref: speedMenuRef, children: [
3011
+ /* @__PURE__ */ jsx14(
3012
+ "button",
3013
+ {
3014
+ type: "button",
3015
+ onClick: toggleSpeedMenu,
3016
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
3017
+ "aria-label": "Op\xE7\xF5es de velocidade",
3018
+ children: /* @__PURE__ */ jsx14(DotsThreeVertical, { size: 24 })
3019
+ }
3020
+ ),
3021
+ showSpeedMenu && /* @__PURE__ */ jsx14("div", { className: "absolute bottom-full right-0 mb-2 p-2 bg-background border border-border-100 rounded-lg shadow-lg min-w-24 z-10", children: /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-1", children: [
3022
+ { speed: 1, label: "1x" },
3023
+ { speed: 1.5, label: "1.5x" },
3024
+ { speed: 2, label: "2x" }
3025
+ ].map(({ speed, label }) => /* @__PURE__ */ jsx14(
3026
+ "button",
3027
+ {
3028
+ type: "button",
3029
+ onClick: () => handleSpeedChange(speed),
3030
+ className: cn(
3031
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
3032
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
3033
+ ),
3034
+ children: label
3035
+ },
3036
+ speed
3037
+ )) }) })
3038
+ ] })
3039
+ ]
3040
+ }
3041
+ );
3042
+ }
3043
+ );
3044
+ var SIMULADO_BACKGROUND_CLASSES = {
3045
+ enem: "bg-exam-1",
3046
+ prova: "bg-exam-2",
3047
+ simuladao: "bg-exam-3",
3048
+ vestibular: "bg-exam-4"
3049
+ };
3050
+ var CardSimulado = forwardRef5(
3051
+ ({ title, duration, info, backgroundColor, className, ...props }, ref) => {
3052
+ const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
3053
+ return /* @__PURE__ */ jsx14(
3054
+ CardBase,
3055
+ {
3056
+ ref,
3057
+ layout: "horizontal",
3058
+ padding: "medium",
3059
+ minHeight: "none",
3060
+ cursor: "pointer",
3061
+ className: cn(
3062
+ `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200`,
3063
+ className
3064
+ ),
3065
+ ...props,
3066
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex justify-between items-center w-full gap-4", children: [
3067
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
3068
+ /* @__PURE__ */ jsx14(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
3069
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4 text-text-700", children: [
3070
+ duration && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
3071
+ /* @__PURE__ */ jsx14(Clock, { size: 16, className: "flex-shrink-0" }),
3072
+ /* @__PURE__ */ jsx14(Text_default, { size: "sm", children: duration })
3073
+ ] }),
3074
+ /* @__PURE__ */ jsx14(Text_default, { size: "sm", className: "truncate", children: info })
3075
+ ] })
3076
+ ] }),
3077
+ /* @__PURE__ */ jsx14(
3078
+ CaretRight,
3079
+ {
3080
+ size: 24,
3081
+ className: "text-text-800 flex-shrink-0",
3082
+ "data-testid": "caret-icon"
3083
+ }
3084
+ )
3085
+ ] })
3086
+ }
3087
+ );
3088
+ }
3089
+ );
3090
+ var CardTest = forwardRef5(
3091
+ ({
3092
+ title,
3093
+ duration,
3094
+ questionsCount,
3095
+ additionalInfo,
3096
+ selected = false,
3097
+ onSelect,
3098
+ className = "",
3099
+ ...props
3100
+ }, ref) => {
3101
+ const handleClick = () => {
3102
+ if (onSelect) {
3103
+ onSelect(!selected);
3104
+ }
3105
+ };
3106
+ const handleKeyDown = (event) => {
3107
+ if ((event.key === "Enter" || event.key === " ") && onSelect) {
3108
+ event.preventDefault();
3109
+ onSelect(!selected);
3110
+ }
3111
+ };
3112
+ const isSelectable = !!onSelect;
3113
+ const getQuestionsText = (count) => {
3114
+ const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
3115
+ return `${count} ${singular}`;
3116
+ };
3117
+ const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
3118
+ const baseClasses = "flex flex-row items-center p-4 gap-2 w-full max-w-full bg-background shadow-soft-shadow-1 rounded-xl isolate border-0 text-left";
3119
+ const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
3120
+ const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
3121
+ if (isSelectable) {
3122
+ return /* @__PURE__ */ jsx14(
3123
+ "button",
3124
+ {
3125
+ ref,
3126
+ type: "button",
3127
+ className: cn(
3128
+ `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim()
3129
+ ),
3130
+ onClick: handleClick,
3131
+ onKeyDown: handleKeyDown,
3132
+ "aria-pressed": selected,
3133
+ ...props,
3134
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
3135
+ /* @__PURE__ */ jsx14(
3136
+ Text_default,
3137
+ {
3138
+ size: "md",
3139
+ weight: "bold",
3140
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
3141
+ children: title
3142
+ }
3143
+ ),
3144
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
3145
+ duration && /* @__PURE__ */ jsxs11("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
3146
+ /* @__PURE__ */ jsx14(Clock, { size: 16, className: "text-text-700" }),
3147
+ /* @__PURE__ */ jsx14(
3148
+ Text_default,
3149
+ {
3150
+ size: "sm",
3151
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
3152
+ children: duration
3153
+ }
3154
+ )
3155
+ ] }),
3156
+ /* @__PURE__ */ jsx14(
3157
+ Text_default,
3158
+ {
3159
+ size: "sm",
3160
+ className: "text-text-700 leading-[21px] flex-grow truncate",
3161
+ children: displayInfo
3162
+ }
3163
+ )
3164
+ ] })
3165
+ ] })
3166
+ }
3167
+ );
3168
+ }
3169
+ return /* @__PURE__ */ jsx14(
3170
+ "div",
3171
+ {
3172
+ ref,
3173
+ className: cn(`${baseClasses} ${className}`.trim()),
3174
+ ...props,
3175
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
3176
+ /* @__PURE__ */ jsx14(
3177
+ Text_default,
3178
+ {
3179
+ size: "md",
3180
+ weight: "bold",
3181
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
3182
+ children: title
3183
+ }
3184
+ ),
3185
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
3186
+ duration && /* @__PURE__ */ jsxs11("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
3187
+ /* @__PURE__ */ jsx14(Clock, { size: 16, className: "text-text-700" }),
3188
+ /* @__PURE__ */ jsx14(
3189
+ Text_default,
3190
+ {
3191
+ size: "sm",
3192
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
3193
+ children: duration
3194
+ }
3195
+ )
3196
+ ] }),
3197
+ /* @__PURE__ */ jsx14(
3198
+ Text_default,
3199
+ {
3200
+ size: "sm",
3201
+ className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
3202
+ children: displayInfo
3203
+ }
3204
+ )
3205
+ ] })
3206
+ ] })
3207
+ }
3208
+ );
3209
+ }
3210
+ );
3211
+ var SIMULATION_TYPE_STYLES = {
3212
+ enem: {
3213
+ background: "bg-exam-1",
3214
+ badge: "exam1",
3215
+ text: "Enem"
3216
+ },
3217
+ prova: {
3218
+ background: "bg-exam-2",
3219
+ badge: "exam2",
3220
+ text: "Prova"
3221
+ },
3222
+ simulado: {
3223
+ background: "bg-exam-3",
3224
+ badge: "exam3",
3225
+ text: "Simulad\xE3o"
3226
+ },
3227
+ vestibular: {
3228
+ background: "bg-exam-4",
3229
+ badge: "exam4",
3230
+ text: "Vestibular"
3231
+ }
3232
+ };
3233
+ var CardSimulationHistory = forwardRef5(({ data, onSimulationClick, className, ...props }, ref) => {
3234
+ return /* @__PURE__ */ jsx14(
3235
+ "div",
3236
+ {
3237
+ ref,
3238
+ className: cn("w-full max-w-[992px] h-auto", className),
3239
+ ...props,
3240
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex flex-col gap-0", children: [
3241
+ data.map((section, sectionIndex) => /* @__PURE__ */ jsx14("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxs11(
3242
+ "div",
3243
+ {
3244
+ className: cn(
3245
+ "flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-background",
3246
+ sectionIndex === 0 ? "rounded-t-3xl" : ""
3247
+ ),
3248
+ children: [
3249
+ /* @__PURE__ */ jsx14(
3250
+ Text_default,
3251
+ {
3252
+ size: "xs",
3253
+ weight: "bold",
3254
+ className: "text-text-800 w-11 flex-shrink-0",
3255
+ children: section.date
3256
+ }
3257
+ ),
3258
+ /* @__PURE__ */ jsx14("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
3259
+ const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
3260
+ return /* @__PURE__ */ jsx14(
3261
+ CardBase,
3262
+ {
3263
+ layout: "horizontal",
3264
+ padding: "medium",
3265
+ minHeight: "none",
3266
+ cursor: "pointer",
3267
+ className: cn(
3268
+ `${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2
3269
+ transition-shadow duration-200 h-auto min-h-[61px]`
3270
+ ),
3271
+ onClick: () => onSimulationClick?.(simulation),
3272
+ children: /* @__PURE__ */ jsxs11("div", { className: "flex justify-between items-center w-full gap-2", children: [
3273
+ /* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap flex-col justify-between sm:flex-row gap-2 flex-1 min-w-0", children: [
3274
+ /* @__PURE__ */ jsx14(
3275
+ Text_default,
3276
+ {
3277
+ size: "lg",
3278
+ weight: "bold",
3279
+ className: "text-text-950 truncate",
3280
+ children: simulation.title
3281
+ }
3282
+ ),
3283
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
3284
+ /* @__PURE__ */ jsx14(
3285
+ Badge_default,
3286
+ {
3287
+ variant: "examsOutlined",
3288
+ action: typeStyles.badge,
3289
+ size: "medium",
3290
+ children: typeStyles.text
3291
+ }
3292
+ ),
3293
+ /* @__PURE__ */ jsx14(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
3294
+ ] })
3295
+ ] }),
3296
+ /* @__PURE__ */ jsx14(
3297
+ CaretRight,
3298
+ {
3299
+ size: 24,
3300
+ className: "text-text-800 flex-shrink-0",
3301
+ "data-testid": "caret-icon"
3302
+ }
3303
+ )
3304
+ ] })
3305
+ },
3306
+ simulation.id
3307
+ );
3308
+ }) })
3309
+ ]
3310
+ }
3311
+ ) }, section.date)),
3312
+ data.length > 0 && /* @__PURE__ */ jsx14("div", { className: "w-full h-6 bg-background rounded-b-3xl" })
3313
+ ] })
3314
+ }
3315
+ );
3316
+ });
3317
+
3318
+ // src/components/Accordation/Accordation.tsx
3319
+ import { CaretRight as CaretRight2 } from "phosphor-react";
3320
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
3321
+ var CardAccordation = forwardRef6(
3322
+ ({
3323
+ trigger,
3324
+ children,
3325
+ className,
3326
+ defaultExpanded = false,
3327
+ expanded: controlledExpanded,
3328
+ onToggleExpanded,
3329
+ value,
3330
+ disabled = false,
3331
+ triggerClassName,
3332
+ contentClassName,
3333
+ ...props
3334
+ }, ref) => {
3335
+ const [internalExpanded, setInternalExpanded] = useState5(defaultExpanded);
3336
+ const generatedId = useId5();
3337
+ const contentId = value ? `accordion-content-${value}` : generatedId;
3338
+ const headerId = value ? `accordion-header-${value}` : `${generatedId}-header`;
3339
+ const isControlled = controlledExpanded !== void 0;
3340
+ const isExpanded = isControlled ? controlledExpanded : internalExpanded;
3341
+ useEffect4(() => {
3342
+ if (isControlled) {
3343
+ setInternalExpanded(controlledExpanded);
3344
+ }
3345
+ }, [isControlled, controlledExpanded]);
3346
+ const handleToggle = () => {
3347
+ if (disabled) return;
3348
+ const newExpanded = !isExpanded;
3349
+ if (!isControlled) {
3350
+ setInternalExpanded(newExpanded);
3351
+ }
3352
+ onToggleExpanded?.(newExpanded);
3353
+ };
3354
+ const handleKeyDown = (event) => {
3355
+ if (disabled) return;
3356
+ if (event.key === "Enter" || event.key === " ") {
3357
+ event.preventDefault();
3358
+ handleToggle();
3359
+ }
3360
+ };
3361
+ return /* @__PURE__ */ jsxs12(
3362
+ CardBase,
3363
+ {
3364
+ ref,
3365
+ layout: "vertical",
3366
+ padding: "none",
3367
+ minHeight: "none",
3368
+ className: cn("overflow-hidden", className),
3369
+ ...props,
3370
+ children: [
3371
+ /* @__PURE__ */ jsxs12(
3372
+ "button",
3373
+ {
3374
+ id: headerId,
3375
+ type: "button",
3376
+ onClick: handleToggle,
3377
+ onKeyDown: handleKeyDown,
3378
+ disabled,
3379
+ className: cn(
3380
+ "w-full cursor-pointer not-aria-expanded:rounded-xl aria-expanded:rounded-t-xl flex items-center justify-between gap-3 text-left transition-colors duration-200 focus:outline-none focus:border-2 focus:border-primary-950 focus:ring-inset px-2",
3381
+ disabled && "cursor-not-allowed text-text-400",
3382
+ triggerClassName
3383
+ ),
3384
+ "aria-expanded": isExpanded,
3385
+ "aria-controls": contentId,
3386
+ "aria-disabled": disabled,
3387
+ "data-value": value,
3388
+ children: [
3389
+ trigger,
3390
+ /* @__PURE__ */ jsx15(
3391
+ CaretRight2,
3392
+ {
3393
+ size: 20,
3394
+ className: cn(
3395
+ "transition-transform duration-200 flex-shrink-0",
3396
+ disabled ? "text-gray-400" : "text-text-700",
3397
+ isExpanded ? "rotate-90" : "rotate-0"
3398
+ ),
3399
+ "data-testid": "accordion-caret"
3400
+ }
3401
+ )
3402
+ ]
3403
+ }
3404
+ ),
3405
+ /* @__PURE__ */ jsx15(
3406
+ "section",
3407
+ {
3408
+ id: contentId,
3409
+ "aria-labelledby": headerId,
3410
+ "aria-hidden": !isExpanded,
3411
+ className: cn(
3412
+ "transition-all duration-300 ease-in-out overflow-hidden",
3413
+ isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"
3414
+ ),
3415
+ "data-testid": "accordion-content",
3416
+ "data-value": value,
3417
+ children: /* @__PURE__ */ jsx15("div", { className: cn("p-4 pt-0", contentClassName), children })
3418
+ }
3419
+ )
3420
+ ]
3421
+ }
3422
+ );
3423
+ }
3424
+ );
3425
+ CardAccordation.displayName = "CardAccordation";
3426
+
3427
+ // src/types/questionTypes.ts
3428
+ var questionTypeLabels = {
3429
+ ["ALTERNATIVA" /* ALTERNATIVA */]: "Alternativa",
3430
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: "Verdadeiro ou Falso",
3431
+ ["DISSERTATIVA" /* DISSERTATIVA */]: "Discursiva",
3432
+ ["IMAGEM" /* IMAGEM */]: "Imagem",
3433
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: "M\xFAltipla Escolha",
3434
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: "Ligar Pontos",
3435
+ ["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
3436
+ };
3437
+
3438
+ // src/components/MultipleChoice/MultipleChoice.tsx
3439
+ import { useEffect as useEffect5, useState as useState6 } from "react";
3440
+ import { CheckCircle as CheckCircle3, XCircle as XCircle3, Check as Check2 } from "phosphor-react";
3441
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
3442
+ var MultipleChoiceList = ({
3443
+ disabled = false,
3444
+ className = "",
3445
+ choices,
3446
+ name,
3447
+ selectedValues,
3448
+ onHandleSelectedValues,
3449
+ mode = "interactive"
3450
+ }) => {
3451
+ const [actualValue, setActualValue] = useState6(selectedValues);
3452
+ useEffect5(() => {
3453
+ setActualValue(selectedValues);
3454
+ }, [selectedValues]);
3455
+ const getStatusBadge = (status) => {
3456
+ switch (status) {
3457
+ case "correct":
3458
+ return /* @__PURE__ */ jsx16(Badge_default, { variant: "solid", action: "success", iconLeft: /* @__PURE__ */ jsx16(CheckCircle3, {}), children: "Resposta correta" });
3459
+ case "incorrect":
3460
+ return /* @__PURE__ */ jsx16(Badge_default, { variant: "solid", action: "error", iconLeft: /* @__PURE__ */ jsx16(XCircle3, {}), children: "Resposta incorreta" });
3461
+ default:
3462
+ return null;
3463
+ }
3464
+ };
3465
+ const getStatusStyles = (status) => {
3466
+ switch (status) {
3467
+ case "correct":
3468
+ return "bg-success-background border-success-300";
3469
+ case "incorrect":
3470
+ return "bg-error-background border-error-300";
3471
+ default:
3472
+ return `bg-background border-border-100`;
3473
+ }
3474
+ };
3475
+ const renderVisualCheckbox = (isSelected, isDisabled) => {
3476
+ const checkboxClasses = cn(
3477
+ "w-5 h-5 rounded border-2 cursor-default transition-all duration-200 flex items-center justify-center",
3478
+ isSelected ? "border-primary-950 bg-primary-950 text-text" : "border-border-400 bg-background",
3479
+ isDisabled && "opacity-40 cursor-not-allowed"
3480
+ );
3481
+ return /* @__PURE__ */ jsx16("div", { className: checkboxClasses, children: isSelected && /* @__PURE__ */ jsx16(Check2, { size: 16, weight: "bold" }) });
3482
+ };
3483
+ if (mode === "readonly") {
3484
+ return /* @__PURE__ */ jsx16("div", { className: cn("flex flex-col gap-2", className), children: choices.map((choice, i) => {
3485
+ const isSelected = actualValue?.includes(choice.value) || false;
3486
+ const statusStyles = getStatusStyles(choice.status);
3487
+ const statusBadge = getStatusBadge(choice.status);
3488
+ return /* @__PURE__ */ jsxs13(
3489
+ "div",
3490
+ {
3491
+ className: cn(
3492
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
3493
+ statusStyles,
3494
+ choice.disabled ? "opacity-50 cursor-not-allowed" : ""
3495
+ ),
3496
+ children: [
3497
+ /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 flex-1", children: [
3498
+ renderVisualCheckbox(isSelected, choice.disabled || disabled),
3499
+ /* @__PURE__ */ jsx16(
3500
+ "span",
3501
+ {
3502
+ className: cn(
3503
+ "flex-1",
3504
+ isSelected || choice.status && choice.status != "neutral" ? "text-text-950" : "text-text-600",
3505
+ choice.disabled || disabled ? "cursor-not-allowed" : "cursor-default"
3506
+ ),
3507
+ children: choice.label
3508
+ }
3509
+ )
3510
+ ] }),
3511
+ statusBadge && /* @__PURE__ */ jsx16("div", { className: "flex-shrink-0", children: statusBadge })
3512
+ ]
3513
+ },
3514
+ `readonly-${choice.value}-${i}`
3515
+ );
3516
+ }) });
3517
+ }
3518
+ return /* @__PURE__ */ jsx16(
3519
+ "div",
3520
+ {
3521
+ className: cn(
3522
+ "flex flex-row justify-between gap-2 items-start p-2 rounded-lg transition-all",
3523
+ disabled ? "opacity-50 cursor-not-allowed" : "",
3524
+ className
3525
+ ),
3526
+ children: /* @__PURE__ */ jsx16(
3527
+ CheckboxList_default,
3528
+ {
3529
+ name,
3530
+ values: actualValue,
3531
+ onValuesChange: (v) => {
3532
+ setActualValue(v);
3533
+ onHandleSelectedValues?.(v);
3534
+ },
3535
+ disabled,
3536
+ children: choices.map((choice, i) => /* @__PURE__ */ jsxs13(
3537
+ "div",
3538
+ {
3539
+ className: "flex flex-row gap-2 items-center",
3540
+ children: [
3541
+ /* @__PURE__ */ jsx16(
3542
+ CheckboxListItem,
3543
+ {
3544
+ value: choice.value,
3545
+ id: `interactive-${choice.value}-${i}`,
3546
+ disabled: choice.disabled || disabled
3547
+ }
3548
+ ),
3549
+ /* @__PURE__ */ jsx16(
3550
+ "label",
3551
+ {
3552
+ htmlFor: `interactive-${choice.value}-${i}`,
3553
+ className: cn(
3554
+ "flex-1",
3555
+ actualValue?.includes(choice.value) ? "text-text-950" : "text-text-600",
3556
+ choice.disabled || disabled ? "cursor-not-allowed" : "cursor-pointer"
3557
+ ),
3558
+ children: choice.label
3559
+ }
3560
+ )
3561
+ ]
3562
+ },
3563
+ `interactive-${choice.value}-${i}`
3564
+ ))
3565
+ }
3566
+ )
3567
+ }
3568
+ );
3569
+ };
3570
+
3571
+ // src/utils/questionRenderer.ts
3572
+ var renderFromMap = (renderers, questionType) => {
3573
+ if (!questionType) return null;
3574
+ const renderer = renderers[questionType];
3575
+ return renderer ? renderer() : null;
3576
+ };
3577
+
3578
+ // src/components/ActivityCardQuestionPreview/ActivityCardQuestionPreview.tsx
3579
+ import { useMemo, useState as useState7 } from "react";
3580
+ import { CheckCircle as CheckCircle4, XCircle as XCircle4 } from "phosphor-react";
3581
+ import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
3582
+ var QuestionHeader = ({
3583
+ badgeColor,
3584
+ iconName,
3585
+ subjectName,
3586
+ resolvedQuestionTypeLabel,
3587
+ position
3588
+ }) => /* @__PURE__ */ jsxs14("div", { className: "flex flex-row gap-2 text-text-650", children: [
3589
+ /* @__PURE__ */ jsxs14("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: [
3590
+ /* @__PURE__ */ jsx17(
3591
+ "span",
3592
+ {
3593
+ className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
3594
+ style: {
3595
+ backgroundColor: badgeColor
3596
+ },
3597
+ children: /* @__PURE__ */ jsx17(
3598
+ IconRender_default,
3599
+ {
3600
+ iconName: iconName ?? "Book",
3601
+ size: 14,
3602
+ color: "currentColor"
3603
+ }
3604
+ )
3605
+ }
3606
+ ),
3607
+ /* @__PURE__ */ jsx17(Text_default, { size: "sm", children: subjectName ?? "Assunto n\xE3o informado" })
3608
+ ] }),
3609
+ typeof position === "number" && /* @__PURE__ */ jsx17("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: /* @__PURE__ */ jsxs14(Text_default, { size: "sm", className: "text-text-700", children: [
3610
+ "#",
3611
+ position
3612
+ ] }) }),
3613
+ /* @__PURE__ */ jsx17("div", { className: "py-1 px-2 flex flex-row items-center gap-1", children: /* @__PURE__ */ jsx17(Text_default, { size: "sm", className: "", children: resolvedQuestionTypeLabel ?? "Tipo de quest\xE3o" }) })
3614
+ ] });
3615
+ var ActivityCardQuestionPreview = ({
3616
+ subjectName = "Assunto n\xE3o informado",
3617
+ subjectColor = "#000000",
3618
+ iconName = "Book",
3619
+ isDark = false,
3620
+ questionType,
3621
+ questionTypeLabel,
3622
+ enunciado = "Enunciado n\xE3o informado",
3623
+ question,
3624
+ defaultExpanded = false,
3625
+ value,
3626
+ className,
3627
+ children,
3628
+ position
3629
+ }) => {
3630
+ const badgeColor = getSubjectColorWithOpacity(subjectColor, isDark) ?? subjectColor;
3631
+ const [isExpanded, setIsExpanded] = useState7(defaultExpanded);
3632
+ const correctOptionIds = question?.correctOptionIds || [];
3633
+ const resolvedQuestionTypeLabel = questionType && questionTypeLabels[questionType] ? questionTypeLabels[questionType] : questionTypeLabel || "Tipo de quest\xE3o";
3634
+ const safeSubjectName = subjectName ?? "Assunto n\xE3o informado";
3635
+ const safeIconName = iconName ?? "Book";
3636
+ const safeResolvedLabel = resolvedQuestionTypeLabel ?? "Tipo de quest\xE3o";
3637
+ const alternatives = useMemo(() => {
3638
+ if (!question?.options || questionType !== "ALTERNATIVA" /* ALTERNATIVA */)
3639
+ return [];
3640
+ return question.options.map((option) => {
3641
+ const isCorrect = correctOptionIds.includes(option.id);
3642
+ return {
3643
+ value: option.id,
3644
+ label: option.option,
3645
+ status: isCorrect ? "correct" : void 0,
3646
+ disabled: !isCorrect
3647
+ };
3648
+ });
3649
+ }, [question, questionType, correctOptionIds]);
3650
+ const multipleChoices = useMemo(() => {
3651
+ if (!question?.options || questionType !== "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */)
3652
+ return [];
3653
+ return question.options.map((option) => {
3654
+ const isCorrect = correctOptionIds.includes(option.id);
3655
+ return {
3656
+ value: option.id,
3657
+ label: option.option,
3658
+ status: isCorrect ? "correct" : void 0,
3659
+ disabled: !isCorrect
3660
+ };
3661
+ });
3662
+ }, [question, questionType, correctOptionIds]);
3663
+ const renderAlternative = () => {
3664
+ if (alternatives.length === 0) return null;
3665
+ return /* @__PURE__ */ jsx17("div", { className: "mt-4", children: /* @__PURE__ */ jsx17(
3666
+ AlternativesList,
3667
+ {
3668
+ alternatives,
3669
+ mode: "readonly",
3670
+ layout: "compact",
3671
+ selectedValue: correctOptionIds[0],
3672
+ name: `preview-alternatives-${value ?? subjectName}`
3673
+ }
3674
+ ) });
3675
+ };
3676
+ const renderMultipleChoice = () => {
3677
+ if (multipleChoices.length === 0) return null;
3678
+ return /* @__PURE__ */ jsx17("div", { className: "mt-4", children: /* @__PURE__ */ jsx17(
3679
+ MultipleChoiceList,
3680
+ {
3681
+ choices: multipleChoices,
3682
+ mode: "readonly",
3683
+ selectedValues: correctOptionIds,
3684
+ name: `preview-multiple-${value ?? subjectName}`
3685
+ }
3686
+ ) });
3687
+ };
3688
+ const renderTrueOrFalse = () => {
3689
+ if (!question?.options || question.options.length === 0) return null;
3690
+ return /* @__PURE__ */ jsx17("div", { className: "mt-4", children: /* @__PURE__ */ jsx17("div", { className: "flex flex-col gap-3.5", children: question.options.map((option, index) => {
3691
+ const isCorrect = correctOptionIds.includes(option.id);
3692
+ const correctAnswer = isCorrect ? "Verdadeiro" : "Falso";
3693
+ return /* @__PURE__ */ jsx17("section", { className: "flex flex-col gap-2", children: /* @__PURE__ */ jsxs14(
3694
+ "div",
3695
+ {
3696
+ className: cn(
3697
+ "flex flex-row justify-between items-center gap-2 p-2 rounded-md border",
3698
+ isCorrect ? "bg-success-background border-success-300" : "bg-error-background border-error-300"
3699
+ ),
3700
+ children: [
3701
+ /* @__PURE__ */ jsx17(Text_default, { size: "sm", className: "text-text-900", children: String.fromCodePoint(97 + index).concat(") ").concat(option.option) }),
3702
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center gap-2 flex-shrink-0", children: [
3703
+ /* @__PURE__ */ jsxs14(Text_default, { size: "sm", className: "text-text-700", children: [
3704
+ "Resposta correta: ",
3705
+ correctAnswer
3706
+ ] }),
3707
+ /* @__PURE__ */ jsx17(
3708
+ Badge_default,
3709
+ {
3710
+ variant: "solid",
3711
+ action: isCorrect ? "success" : "error",
3712
+ iconLeft: isCorrect ? /* @__PURE__ */ jsx17(CheckCircle4, {}) : /* @__PURE__ */ jsx17(XCircle4, {}),
3713
+ children: isCorrect ? "Resposta correta" : "Resposta incorreta"
3714
+ }
3715
+ )
3716
+ ] })
3717
+ ]
3718
+ }
3719
+ ) }, option.id);
3720
+ }) }) });
3721
+ };
3722
+ const renderDissertative = () => {
3723
+ return /* @__PURE__ */ jsx17("div", { className: "mt-4 px-2 py-4", children: /* @__PURE__ */ jsx17(Text_default, { size: "sm", className: "text-text-600 italic", children: "Resposta do aluno" }) });
3724
+ };
3725
+ const renderConnectDots = () => null;
3726
+ const renderFill = () => null;
3727
+ const renderImage = () => null;
3728
+ const questionRenderers = {
3729
+ ["ALTERNATIVA" /* ALTERNATIVA */]: renderAlternative,
3730
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: renderMultipleChoice,
3731
+ ["DISSERTATIVA" /* DISSERTATIVA */]: renderDissertative,
3732
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: renderTrueOrFalse,
3733
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: renderConnectDots,
3734
+ ["PREENCHER" /* PREENCHER */]: renderFill,
3735
+ ["IMAGEM" /* IMAGEM */]: renderImage
3736
+ };
3737
+ return /* @__PURE__ */ jsxs14(
3738
+ "div",
3739
+ {
3740
+ className: "w-full",
3741
+ "data-position": position,
3742
+ role: "button",
3743
+ tabIndex: 0,
3744
+ "aria-expanded": isExpanded,
3745
+ onClick: () => {
3746
+ if (isExpanded) {
3747
+ setIsExpanded(false);
3748
+ }
3749
+ },
3750
+ onMouseDown: (event) => {
3751
+ const draggableAncestor = event.target.closest(
3752
+ '[data-draggable="true"]'
3753
+ );
3754
+ if (!draggableAncestor) {
3755
+ event.preventDefault();
3756
+ }
3757
+ },
3758
+ onKeyDown: (event) => {
3759
+ if (event.key === "Enter" || event.key === " ") {
3760
+ event.preventDefault();
3761
+ if (isExpanded) {
3762
+ setIsExpanded(false);
3763
+ }
3764
+ }
3765
+ },
3766
+ children: [
3767
+ /* @__PURE__ */ jsx17(
3768
+ "div",
3769
+ {
3770
+ "data-drag-preview": "true",
3771
+ className: "fixed -left-[9999px] -top-[9999px] pointer-events-none z-[9999] w-[440px]",
3772
+ children: /* @__PURE__ */ jsx17("div", { className: "w-full rounded-lg border border-border-200 bg-background", children: /* @__PURE__ */ jsxs14("div", { className: "w-full min-w-0 flex flex-col gap-2 py-2", children: [
3773
+ /* @__PURE__ */ jsx17(
3774
+ QuestionHeader,
3775
+ {
3776
+ badgeColor,
3777
+ iconName: safeIconName,
3778
+ subjectName: safeSubjectName,
3779
+ resolvedQuestionTypeLabel: safeResolvedLabel,
3780
+ position
3781
+ }
3782
+ ),
3783
+ /* @__PURE__ */ jsx17(
3784
+ Text_default,
3785
+ {
3786
+ size: "md",
3787
+ weight: "medium",
3788
+ className: "text-text-950 truncate px-3",
3789
+ children: enunciado
3790
+ }
3791
+ )
3792
+ ] }) })
3793
+ }
3794
+ ),
3795
+ /* @__PURE__ */ jsxs14(
3796
+ CardAccordation,
3797
+ {
3798
+ className: cn(
3799
+ "w-full rounded-lg border border-border-200 bg-background",
3800
+ className
3801
+ ),
3802
+ expanded: isExpanded,
3803
+ onToggleExpanded: setIsExpanded,
3804
+ defaultExpanded,
3805
+ value,
3806
+ trigger: /* @__PURE__ */ jsxs14("div", { className: "w-full min-w-0 flex flex-col gap-2 py-2", children: [
3807
+ /* @__PURE__ */ jsx17(
3808
+ QuestionHeader,
3809
+ {
3810
+ badgeColor,
3811
+ iconName: safeIconName,
3812
+ subjectName: safeSubjectName,
3813
+ resolvedQuestionTypeLabel: safeResolvedLabel,
3814
+ position
3815
+ }
3816
+ ),
3817
+ !isExpanded && /* @__PURE__ */ jsx17(
3818
+ Text_default,
3819
+ {
3820
+ size: "md",
3821
+ weight: "medium",
3822
+ className: "text-text-950 truncate px-3",
3823
+ children: enunciado
3824
+ }
3825
+ )
3826
+ ] }),
3827
+ children: [
3828
+ /* @__PURE__ */ jsx17(
3829
+ Text_default,
3830
+ {
3831
+ size: "md",
3832
+ weight: "medium",
3833
+ className: "text-text-950 break-words whitespace-pre-wrap",
3834
+ children: enunciado
3835
+ }
3836
+ ),
3837
+ renderFromMap(questionRenderers, questionType),
3838
+ children
3839
+ ]
3840
+ }
3841
+ )
3842
+ ]
3843
+ }
3844
+ );
3845
+ };
3846
+
3847
+ // src/components/QuestionsPdfGenerator/QuestionsPdfGenerator.tsx
3848
+ import { forwardRef as forwardRef7, useRef as useRef4, useCallback } from "react";
3849
+ import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
3850
+ var QuestionsPdfContent = forwardRef7(({ questions }, ref) => {
3851
+ const getLetterByIndex = (index) => {
3852
+ return String.fromCodePoint(97 + index);
3853
+ };
3854
+ const renderAlternative = (question) => {
3855
+ if (!question.question?.options || question.question.options.length === 0) {
3856
+ return null;
3857
+ }
3858
+ return /* @__PURE__ */ jsx18(
3859
+ "ol",
3860
+ {
3861
+ type: "a",
3862
+ style: {
3863
+ marginTop: "12px",
3864
+ marginBottom: "12px",
3865
+ paddingLeft: "24px"
3866
+ },
3867
+ children: question.question.options.map((option) => /* @__PURE__ */ jsx18(
3868
+ "li",
3869
+ {
3870
+ style: {
3871
+ marginBottom: "8px",
3872
+ lineHeight: "1.6"
3873
+ },
3874
+ children: /* @__PURE__ */ jsx18(LatexRenderer_default, { content: option.option })
3875
+ },
3876
+ option.id
3877
+ ))
3878
+ }
3879
+ );
3880
+ };
3881
+ const renderMultipleChoice = (question) => {
3882
+ if (!question.question?.options || question.question.options.length === 0) {
3883
+ return null;
3884
+ }
3885
+ return /* @__PURE__ */ jsx18(
3886
+ "div",
3887
+ {
3888
+ style: {
3889
+ marginTop: "12px",
3890
+ marginBottom: "12px"
3891
+ },
3892
+ children: question.question.options.map((option, index) => {
3893
+ const letter = getLetterByIndex(index);
3894
+ return /* @__PURE__ */ jsxs15(
3895
+ "div",
3896
+ {
3897
+ style: {
3898
+ marginBottom: "12px",
3899
+ display: "flex",
3900
+ alignItems: "flex-start",
3901
+ gap: "8px",
3902
+ lineHeight: "1.6"
3903
+ },
3904
+ children: [
3905
+ /* @__PURE__ */ jsx18(
3906
+ "span",
3907
+ {
3908
+ style: {
3909
+ marginTop: "2px",
3910
+ minWidth: "20px",
3911
+ fontSize: "16px"
3912
+ },
3913
+ children: "\u2610"
3914
+ }
3915
+ ),
3916
+ /* @__PURE__ */ jsxs15(
3917
+ "span",
3918
+ {
3919
+ style: {
3920
+ fontWeight: "bold",
3921
+ marginRight: "4px"
3922
+ },
3923
+ children: [
3924
+ letter,
3925
+ ")"
3926
+ ]
3927
+ }
3928
+ ),
3929
+ /* @__PURE__ */ jsx18("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsx18(LatexRenderer_default, { content: option.option }) })
3930
+ ]
3931
+ },
3932
+ option.id
3933
+ );
3934
+ })
3935
+ }
3936
+ );
3937
+ };
3938
+ const renderDissertative = () => {
3939
+ return /* @__PURE__ */ jsx18(
3940
+ "div",
3941
+ {
3942
+ style: {
3943
+ marginTop: "12px",
3944
+ marginBottom: "12px"
3945
+ },
3946
+ children: /* @__PURE__ */ jsxs15(
3947
+ "div",
3948
+ {
3949
+ style: {
3950
+ display: "flex",
3951
+ alignItems: "flex-start",
3952
+ gap: "8px"
3953
+ },
3954
+ children: [
3955
+ /* @__PURE__ */ jsx18(
3956
+ "span",
3957
+ {
3958
+ style: {
3959
+ fontWeight: "bold",
3960
+ marginTop: "2px"
3961
+ },
3962
+ children: "R:"
3963
+ }
3964
+ ),
3965
+ /* @__PURE__ */ jsx18(
3966
+ "div",
3967
+ {
3968
+ style: {
3969
+ minHeight: "150px",
3970
+ flex: 1
3971
+ }
3972
+ }
3973
+ )
3974
+ ]
3975
+ }
3976
+ )
3977
+ }
3978
+ );
3979
+ };
3980
+ const renderTrueOrFalse = (question) => {
3981
+ if (!question.question?.options || question.question.options.length === 0) {
3982
+ return null;
3983
+ }
3984
+ return /* @__PURE__ */ jsx18("div", { style: { marginTop: "12px", marginBottom: "12px" }, children: question.question.options.map((option, index) => /* @__PURE__ */ jsxs15(
3985
+ "div",
3986
+ {
3987
+ style: {
3988
+ marginBottom: "16px",
3989
+ display: "flex",
3990
+ alignItems: "flex-start",
3991
+ gap: "12px"
3992
+ },
3993
+ children: [
3994
+ /* @__PURE__ */ jsxs15(
3995
+ "span",
3996
+ {
3997
+ style: {
3998
+ fontWeight: "bold",
3999
+ minWidth: "20px"
4000
+ },
4001
+ children: [
4002
+ getLetterByIndex(index),
4003
+ ")"
4004
+ ]
4005
+ }
4006
+ ),
4007
+ /* @__PURE__ */ jsx18("div", { style: { flex: 1 }, children: /* @__PURE__ */ jsx18(LatexRenderer_default, { content: option.option }) }),
4008
+ /* @__PURE__ */ jsx18(
4009
+ "span",
4010
+ {
4011
+ style: {
4012
+ marginLeft: "8px",
4013
+ whiteSpace: "nowrap",
4014
+ fontSize: "14px"
4015
+ },
4016
+ children: "( ) V ( ) F"
4017
+ }
4018
+ )
4019
+ ]
4020
+ },
4021
+ option.id
4022
+ )) });
4023
+ };
4024
+ const renderQuestionTypeContent = (question) => {
4025
+ const renderMap = {
4026
+ ["ALTERNATIVA" /* ALTERNATIVA */]: renderAlternative,
4027
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: renderMultipleChoice,
4028
+ ["DISSERTATIVA" /* DISSERTATIVA */]: () => renderDissertative(),
4029
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: renderTrueOrFalse,
4030
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: () => null,
4031
+ ["PREENCHER" /* PREENCHER */]: () => null,
4032
+ ["IMAGEM" /* IMAGEM */]: () => null
4033
+ };
4034
+ if (!question.questionType) {
4035
+ return null;
4036
+ }
4037
+ const renderFunction = renderMap[question.questionType];
4038
+ return renderFunction ? renderFunction(question) : null;
4039
+ };
4040
+ const renderQuestionContent = (question, index) => {
4041
+ const questionNumber = index + 1;
4042
+ return /* @__PURE__ */ jsxs15(
4043
+ "div",
4044
+ {
4045
+ style: {
4046
+ marginBottom: "32px",
4047
+ pageBreakInside: "avoid"
4048
+ },
4049
+ children: [
4050
+ /* @__PURE__ */ jsxs15(
4051
+ "h3",
4052
+ {
4053
+ style: {
4054
+ fontSize: "16px",
4055
+ fontWeight: "bold",
4056
+ marginBottom: "12px",
4057
+ color: "#000"
4058
+ },
4059
+ children: [
4060
+ "Quest\xE3o ",
4061
+ questionNumber
4062
+ ]
4063
+ }
4064
+ ),
4065
+ question.enunciado && /* @__PURE__ */ jsx18(
4066
+ "div",
4067
+ {
4068
+ style: {
4069
+ marginBottom: "12px",
4070
+ lineHeight: "1.6",
4071
+ color: "#000"
4072
+ },
4073
+ children: /* @__PURE__ */ jsx18(LatexRenderer_default, { content: question.enunciado })
4074
+ }
4075
+ ),
4076
+ renderQuestionTypeContent(question)
4077
+ ]
4078
+ },
4079
+ question.id
4080
+ );
4081
+ };
4082
+ return /* @__PURE__ */ jsxs15(
4083
+ "div",
4084
+ {
4085
+ ref,
4086
+ className: "questions-pdf-container",
4087
+ style: {
4088
+ position: "fixed",
4089
+ left: 0,
4090
+ top: 0,
4091
+ width: "210mm",
4092
+ minHeight: "297mm",
4093
+ visibility: "hidden",
4094
+ pointerEvents: "none",
4095
+ zIndex: -1
4096
+ },
4097
+ children: [
4098
+ /* @__PURE__ */ jsx18("style", { children: `
4099
+ @media print {
4100
+ @page {
4101
+ margin: 20mm;
4102
+ size: A4;
4103
+ }
4104
+
4105
+ body {
4106
+ margin: 0;
4107
+ padding: 0;
4108
+ }
4109
+
4110
+ .questions-pdf-container {
4111
+ position: static !important;
4112
+ left: auto !important;
4113
+ top: auto !important;
4114
+ visibility: visible !important;
4115
+ pointer-events: auto !important;
4116
+ z-index: auto !important;
4117
+ padding: 0;
4118
+ margin: 0;
4119
+ font-family: Arial, sans-serif;
4120
+ font-size: 14px;
4121
+ line-height: 1.6;
4122
+ color: #000;
4123
+ width: auto;
4124
+ min-height: auto;
4125
+ }
4126
+
4127
+ .questions-pdf-container h3 {
4128
+ page-break-after: avoid;
4129
+ }
4130
+
4131
+ .questions-pdf-container > div {
4132
+ page-break-inside: avoid;
4133
+ }
4134
+ }
4135
+ ` }),
4136
+ /* @__PURE__ */ jsx18("div", { style: { padding: "20px" }, children: questions.map(
4137
+ (question, index) => renderQuestionContent(question, index)
4138
+ ) })
4139
+ ]
4140
+ }
4141
+ );
4142
+ });
4143
+ QuestionsPdfContent.displayName = "QuestionsPdfContent";
4144
+ var collectRelevantStyles = () => {
4145
+ const styles = [];
4146
+ const styleSheets = Array.from(document.styleSheets);
4147
+ styleSheets.forEach((styleSheet) => {
4148
+ try {
4149
+ const cssRules = styleSheet.cssRules || [];
4150
+ Array.from(cssRules).forEach((rule) => {
4151
+ const ruleText = rule.cssText;
4152
+ if (ruleText.includes("katex") || ruleText.includes("questions-pdf")) {
4153
+ styles.push(ruleText);
4154
+ }
4155
+ });
4156
+ } catch (error) {
4157
+ if (typeof console !== "undefined" && console.debug) {
4158
+ console.debug("Could not access stylesheet (likely CORS):", error);
4159
+ }
4160
+ }
4161
+ });
4162
+ return styles;
4163
+ };
4164
+ var generatePrintHTML = (contentHTML, styles) => {
4165
+ return `
4166
+ <!DOCTYPE html>
4167
+ <html>
4168
+ <head>
4169
+ <title>Quest\xF5es</title>
4170
+ <meta charset="utf-8">
4171
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.27/dist/katex.min.css">
4172
+ <style>
4173
+ @page {
4174
+ margin: 20mm;
4175
+ size: A4;
4176
+ }
4177
+
4178
+ * {
4179
+ box-sizing: border-box;
4180
+ }
4181
+
4182
+ body {
4183
+ margin: 0;
4184
+ padding: 0;
4185
+ font-family: Arial, sans-serif;
4186
+ font-size: 14px;
4187
+ line-height: 1.6;
4188
+ color: #000;
4189
+ }
4190
+
4191
+ .questions-pdf-container {
4192
+ position: static !important;
4193
+ visibility: visible !important;
4194
+ pointer-events: auto !important;
4195
+ z-index: auto !important;
4196
+ left: auto !important;
4197
+ top: auto !important;
4198
+ width: auto !important;
4199
+ min-height: auto !important;
4200
+ padding: 0;
4201
+ margin: 0;
4202
+ }
4203
+
4204
+ .questions-pdf-container h3 {
4205
+ page-break-after: avoid;
4206
+ font-size: 16px;
4207
+ font-weight: bold;
4208
+ margin-bottom: 12px;
4209
+ color: #000;
4210
+ }
4211
+
4212
+ .questions-pdf-container > div {
4213
+ page-break-inside: avoid;
4214
+ }
4215
+
4216
+ ol {
4217
+ margin-top: 12px;
4218
+ margin-bottom: 12px;
4219
+ padding-left: 24px;
4220
+ }
4221
+
4222
+ li {
4223
+ margin-bottom: 8px;
4224
+ line-height: 1.6;
4225
+ }
4226
+
4227
+ ${styles.join("\n")}
4228
+ </style>
4229
+ </head>
4230
+ <body>
4231
+ <div class="questions-pdf-container">
4232
+ ${contentHTML}
4233
+ </div>
4234
+ </body>
4235
+ </html>
4236
+ `;
4237
+ };
4238
+ var setupPrintWindowHandler = (printWindow) => {
4239
+ printWindow.onload = () => {
4240
+ const printAndCleanup = () => {
4241
+ try {
4242
+ printWindow.print();
4243
+ } finally {
4244
+ setTimeout(() => {
4245
+ if (printWindow && !printWindow.closed) {
4246
+ printWindow.close();
4247
+ }
4248
+ }, 1e3);
4249
+ }
4250
+ };
4251
+ const fonts = printWindow.document.fonts;
4252
+ if (fonts && "ready" in fonts) {
4253
+ fonts.ready.then(() => {
4254
+ setTimeout(printAndCleanup, 100);
4255
+ }).catch(() => {
4256
+ setTimeout(printAndCleanup, 500);
4257
+ });
4258
+ } else {
4259
+ setTimeout(printAndCleanup, 500);
4260
+ }
4261
+ };
4262
+ };
4263
+ var useQuestionsPdfPrint = (questions, onPrint, onPrintError) => {
4264
+ const contentRef = useRef4(null);
4265
+ const handlePrint = useCallback(() => {
4266
+ try {
4267
+ onPrint?.();
4268
+ if (!contentRef.current) {
4269
+ throw new Error("Elemento de PDF n\xE3o encontrado no DOM");
4270
+ }
4271
+ const printWindow = window.open("", "_blank");
4272
+ if (!printWindow) {
4273
+ throw new Error(
4274
+ "N\xE3o foi poss\xEDvel abrir a janela de impress\xE3o. Verifique se os pop-ups est\xE3o bloqueados."
4275
+ );
4276
+ }
4277
+ printWindow.opener = null;
4278
+ const contentHTML = contentRef.current.innerHTML;
4279
+ const styles = collectRelevantStyles();
4280
+ const htmlContent = generatePrintHTML(contentHTML, styles);
4281
+ const doc = printWindow.document;
4282
+ doc.open();
4283
+ doc.write(htmlContent);
4284
+ doc.close();
4285
+ setupPrintWindowHandler(printWindow);
4286
+ } catch (error) {
4287
+ const errorObj = error instanceof Error ? error : new Error(String(error));
4288
+ onPrintError?.(errorObj);
4289
+ console.error("Erro ao gerar PDF:", errorObj);
4290
+ }
4291
+ }, [onPrint, onPrintError]);
4292
+ return {
4293
+ contentRef,
4294
+ handlePrint
4295
+ };
4296
+ };
4297
+
4298
+ // src/components/ActivityPreview/ActivityPreview.tsx
4299
+ import { jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
4300
+ var ActivityPreview = ({
4301
+ title = "Pr\xE9via da atividade",
4302
+ questions = [],
4303
+ onDownloadPdf,
4304
+ onRemoveAll,
4305
+ className,
4306
+ onReorder,
4307
+ onPositionsChange,
4308
+ isDark = false
4309
+ }) => {
4310
+ const onPositionsChangeRef = useRef5(onPositionsChange);
4311
+ onPositionsChangeRef.current = onPositionsChange;
4312
+ const normalizeWithPositions = useMemo2(
4313
+ () => (items) => items.map((item, index) => ({
4314
+ ...item,
4315
+ position: index + 1
4316
+ })),
4317
+ []
4318
+ );
4319
+ const [orderedQuestions, setOrderedQuestions] = useState8(
4320
+ () => normalizeWithPositions(questions)
4321
+ );
4322
+ useEffect6(() => {
4323
+ const normalized = normalizeWithPositions(questions);
4324
+ setOrderedQuestions(normalized);
4325
+ onPositionsChangeRef.current?.(normalized);
4326
+ }, [questions, normalizeWithPositions]);
4327
+ const total = orderedQuestions.length;
4328
+ const totalLabel = total === 1 ? "1 quest\xE3o adicionada" : `${total} quest\xF5es adicionadas`;
4329
+ const { contentRef, handlePrint } = useQuestionsPdfPrint(
4330
+ orderedQuestions,
4331
+ onDownloadPdf
4332
+ );
4333
+ const handleDownloadPdf = () => {
4334
+ onDownloadPdf?.();
4335
+ setTimeout(() => {
4336
+ if (!contentRef.current) {
4337
+ console.error("Elemento de PDF n\xE3o encontrado no DOM");
4338
+ return;
4339
+ }
4340
+ if (typeof handlePrint === "function") {
4341
+ handlePrint();
4342
+ } else {
4343
+ console.error("handlePrint n\xE3o \xE9 uma fun\xE7\xE3o:", handlePrint);
4344
+ }
4345
+ }, 100);
4346
+ };
4347
+ const handleReorder = (fromId, toId) => {
4348
+ if (fromId === toId) return;
4349
+ const current = [...orderedQuestions];
4350
+ const fromIndex = current.findIndex((q) => q.id === fromId);
4351
+ const toIndex = current.findIndex((q) => q.id === toId);
4352
+ if (fromIndex === -1 || toIndex === -1) return;
4353
+ const [moved] = current.splice(fromIndex, 1);
4354
+ current.splice(toIndex, 0, moved);
4355
+ const normalized = normalizeWithPositions(current);
4356
+ setOrderedQuestions(normalized);
4357
+ onReorder?.(normalized);
4358
+ onPositionsChange?.(normalized);
4359
+ };
4360
+ return /* @__PURE__ */ jsxs16(
4361
+ "div",
4362
+ {
4363
+ className: cn(
4364
+ "w-[470px] flex-shrink-0 p-4 rounded-lg bg-background flex flex-col gap-4",
4365
+ className
4366
+ ),
4367
+ children: [
4368
+ /* @__PURE__ */ jsxs16("section", { className: "flex flex-row items-center gap-2 text-text-950", children: [
4369
+ /* @__PURE__ */ jsx19(File, { size: 24 }),
4370
+ /* @__PURE__ */ jsx19(Text_default, { size: "lg", weight: "bold", children: title })
4371
+ ] }),
4372
+ /* @__PURE__ */ jsxs16("section", { className: "flex flex-row justify-between items-center", children: [
4373
+ /* @__PURE__ */ jsx19(Text_default, { size: "sm", className: "text-text-800", children: totalLabel }),
4374
+ /* @__PURE__ */ jsx19(
4375
+ Button_default,
4376
+ {
4377
+ size: "small",
4378
+ variant: "outline",
4379
+ iconLeft: /* @__PURE__ */ jsx19(DownloadSimple, {}),
4380
+ onClick: handleDownloadPdf,
4381
+ children: "Baixar pdf"
4382
+ }
4383
+ )
4384
+ ] }),
4385
+ /* @__PURE__ */ jsx19("section", { className: "flex flex-col gap-3", children: orderedQuestions.map(
4386
+ ({
4387
+ id,
4388
+ subjectName = "Assunto n\xE3o informado",
4389
+ subjectColor = "#000000",
4390
+ iconName = "BookOpen",
4391
+ questionType,
4392
+ questionTypeLabel,
4393
+ enunciado,
4394
+ question,
4395
+ position
4396
+ }, index) => /* @__PURE__ */ jsx19(
4397
+ "div",
4398
+ {
4399
+ draggable: true,
4400
+ "data-draggable": "true",
4401
+ role: "button",
4402
+ tabIndex: 0,
4403
+ "aria-label": `Mover quest\xE3o ${enunciado ?? id}`,
4404
+ onDragStart: (e) => {
4405
+ e.dataTransfer.setData("text/plain", id);
4406
+ if (e.currentTarget instanceof HTMLElement) {
4407
+ const preview = e.currentTarget.querySelector(
4408
+ '[data-drag-preview="true"]'
4409
+ );
4410
+ if (preview) {
4411
+ e.dataTransfer.setDragImage(preview, 8, 8);
4412
+ } else {
4413
+ e.dataTransfer.setDragImage(e.currentTarget, 8, 8);
4414
+ }
4415
+ }
4416
+ },
4417
+ onDragOver: (e) => {
4418
+ e.preventDefault();
4419
+ },
4420
+ onDrop: (e) => {
4421
+ e.preventDefault();
4422
+ const fromId = e.dataTransfer.getData("text/plain");
4423
+ handleReorder(fromId, id);
4424
+ },
4425
+ onKeyDown: (e) => {
4426
+ if (e.key === "ArrowUp" && index > 0) {
4427
+ e.preventDefault();
4428
+ const targetId = orderedQuestions[index - 1].id;
4429
+ handleReorder(id, targetId);
4430
+ } else if (e.key === "ArrowDown" && index < orderedQuestions.length - 1) {
4431
+ e.preventDefault();
4432
+ const targetId = orderedQuestions[index + 1].id;
4433
+ handleReorder(id, targetId);
4434
+ } else if (e.key === "Enter" || e.key === " ") {
4435
+ e.preventDefault();
4436
+ }
4437
+ },
4438
+ className: "rounded-lg border border-border-200 bg-background",
4439
+ children: /* @__PURE__ */ jsx19(
4440
+ ActivityCardQuestionPreview,
4441
+ {
4442
+ subjectName,
4443
+ subjectColor,
4444
+ iconName,
4445
+ isDark,
4446
+ questionType,
4447
+ questionTypeLabel,
4448
+ enunciado,
4449
+ defaultExpanded: false,
4450
+ question,
4451
+ value: id,
4452
+ position
4453
+ }
4454
+ )
4455
+ },
4456
+ id
4457
+ )
4458
+ ) }),
4459
+ /* @__PURE__ */ jsx19(Button_default, { variant: "outline", onClick: onRemoveAll, children: "Remover tudo" }),
4460
+ /* @__PURE__ */ jsx19(QuestionsPdfContent, { ref: contentRef, questions: orderedQuestions })
4461
+ ]
4462
+ }
4463
+ );
4464
+ };
4465
+ export {
4466
+ ActivityPreview
4467
+ };
4468
+ //# sourceMappingURL=index.mjs.map