analytica-frontend-lib 1.2.24 → 1.2.25

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 (131) hide show
  1. package/dist/Accordation/index.js.map +1 -1
  2. package/dist/Accordation/index.mjs.map +1 -1
  3. package/dist/ActivityFilters/index.css +19181 -0
  4. package/dist/ActivityFilters/index.css.map +1 -0
  5. package/dist/ActivityFilters/index.d.mts +5 -0
  6. package/dist/ActivityFilters/index.d.ts +5 -0
  7. package/dist/ActivityFilters/index.js +4902 -0
  8. package/dist/ActivityFilters/index.js.map +1 -0
  9. package/dist/ActivityFilters/index.mjs +4917 -0
  10. package/dist/ActivityFilters/index.mjs.map +1 -0
  11. package/dist/ActivityFilters-Cs3TpGAY.d.ts +97 -0
  12. package/dist/ActivityFilters-CsX8y41f.d.mts +97 -0
  13. package/dist/Alert/index.js.map +1 -1
  14. package/dist/Alert/index.mjs.map +1 -1
  15. package/dist/AlertDialog/index.js.map +1 -1
  16. package/dist/AlertDialog/index.mjs.map +1 -1
  17. package/dist/AlertManager/index.css +15 -0
  18. package/dist/AlertManager/index.css.map +1 -1
  19. package/dist/AlertManager/index.js.map +1 -1
  20. package/dist/AlertManager/index.mjs.map +1 -1
  21. package/dist/AlertManagerView/index.js.map +1 -1
  22. package/dist/AlertManagerView/index.mjs.map +1 -1
  23. package/dist/Alternative/index.js.map +1 -1
  24. package/dist/Alternative/index.mjs.map +1 -1
  25. package/dist/Badge/index.js.map +1 -1
  26. package/dist/Badge/index.mjs.map +1 -1
  27. package/dist/BreadcrumbMenu/index.js.map +1 -1
  28. package/dist/BreadcrumbMenu/index.mjs.map +1 -1
  29. package/dist/Button/index.js.map +1 -1
  30. package/dist/Button/index.mjs.map +1 -1
  31. package/dist/Calendar/index.js.map +1 -1
  32. package/dist/Calendar/index.mjs.map +1 -1
  33. package/dist/Card/index.js.map +1 -1
  34. package/dist/Card/index.mjs.map +1 -1
  35. package/dist/CheckBox/index.d.mts +1 -1
  36. package/dist/CheckBox/index.d.ts +1 -1
  37. package/dist/CheckBox/index.js.map +1 -1
  38. package/dist/CheckBox/index.mjs.map +1 -1
  39. package/dist/Chips/index.js.map +1 -1
  40. package/dist/Chips/index.mjs.map +1 -1
  41. package/dist/Divider/index.js.map +1 -1
  42. package/dist/Divider/index.mjs.map +1 -1
  43. package/dist/DownloadButton/index.js.map +1 -1
  44. package/dist/DownloadButton/index.mjs.map +1 -1
  45. package/dist/DropdownMenu/index.js.map +1 -1
  46. package/dist/DropdownMenu/index.mjs.map +1 -1
  47. package/dist/EmptyState/index.js.map +1 -1
  48. package/dist/EmptyState/index.mjs.map +1 -1
  49. package/dist/IconButton/index.js.map +1 -1
  50. package/dist/IconButton/index.mjs.map +1 -1
  51. package/dist/IconRoundedButton/index.js.map +1 -1
  52. package/dist/IconRoundedButton/index.mjs.map +1 -1
  53. package/dist/LatexRenderer/index.js.map +1 -1
  54. package/dist/LatexRenderer/index.mjs.map +1 -1
  55. package/dist/Menu/index.js.map +1 -1
  56. package/dist/Menu/index.mjs.map +1 -1
  57. package/dist/Modal/index.js.map +1 -1
  58. package/dist/Modal/index.mjs.map +1 -1
  59. package/dist/MultipleChoice/index.js.map +1 -1
  60. package/dist/MultipleChoice/index.mjs.map +1 -1
  61. package/dist/NavButton/index.js.map +1 -1
  62. package/dist/NavButton/index.mjs.map +1 -1
  63. package/dist/NoSearchResult/index.js.map +1 -1
  64. package/dist/NoSearchResult/index.mjs.map +1 -1
  65. package/dist/NotFound/index.js.map +1 -1
  66. package/dist/NotFound/index.mjs.map +1 -1
  67. package/dist/NotificationCard/index.js.map +1 -1
  68. package/dist/NotificationCard/index.mjs.map +1 -1
  69. package/dist/ProgressBar/index.js.map +1 -1
  70. package/dist/ProgressBar/index.mjs.map +1 -1
  71. package/dist/ProgressCircle/index.js.map +1 -1
  72. package/dist/ProgressCircle/index.mjs.map +1 -1
  73. package/dist/Quiz/index.js.map +1 -1
  74. package/dist/Quiz/index.mjs.map +1 -1
  75. package/dist/Radio/index.d.mts +2 -2
  76. package/dist/Radio/index.d.ts +2 -2
  77. package/dist/Radio/index.js.map +1 -1
  78. package/dist/Radio/index.mjs.map +1 -1
  79. package/dist/Search/index.d.mts +1 -1
  80. package/dist/Search/index.d.ts +1 -1
  81. package/dist/Search/index.js.map +1 -1
  82. package/dist/Search/index.mjs.map +1 -1
  83. package/dist/Select/index.js.map +1 -1
  84. package/dist/Select/index.mjs.map +1 -1
  85. package/dist/SelectionButton/index.js.map +1 -1
  86. package/dist/SelectionButton/index.mjs.map +1 -1
  87. package/dist/Skeleton/index.js.map +1 -1
  88. package/dist/Skeleton/index.mjs.map +1 -1
  89. package/dist/StatisticsCard/index.js.map +1 -1
  90. package/dist/StatisticsCard/index.mjs.map +1 -1
  91. package/dist/Stepper/index.js.map +1 -1
  92. package/dist/Stepper/index.mjs.map +1 -1
  93. package/dist/Table/TablePagination/index.js.map +1 -1
  94. package/dist/Table/TablePagination/index.mjs.map +1 -1
  95. package/dist/Table/index.js.map +1 -1
  96. package/dist/Table/index.mjs.map +1 -1
  97. package/dist/TableProvider/index.css +15 -0
  98. package/dist/TableProvider/index.css.map +1 -1
  99. package/dist/TableProvider/index.js.map +1 -1
  100. package/dist/TableProvider/index.mjs.map +1 -1
  101. package/dist/Text/index.js.map +1 -1
  102. package/dist/Text/index.mjs.map +1 -1
  103. package/dist/TextArea/index.js.map +1 -1
  104. package/dist/TextArea/index.mjs.map +1 -1
  105. package/dist/ThemeToggle/index.js.map +1 -1
  106. package/dist/ThemeToggle/index.mjs.map +1 -1
  107. package/dist/Toast/Toaster/index.js.map +1 -1
  108. package/dist/Toast/Toaster/index.mjs.map +1 -1
  109. package/dist/Toast/index.js.map +1 -1
  110. package/dist/Toast/index.mjs.map +1 -1
  111. package/dist/VideoPlayer/index.js.map +1 -1
  112. package/dist/VideoPlayer/index.mjs.map +1 -1
  113. package/dist/Whiteboard/index.js.map +1 -1
  114. package/dist/Whiteboard/index.mjs.map +1 -1
  115. package/dist/index.css +15 -0
  116. package/dist/index.css.map +1 -1
  117. package/dist/index.d.mts +11 -5
  118. package/dist/index.d.ts +11 -5
  119. package/dist/index.js +5860 -5475
  120. package/dist/index.js.map +1 -1
  121. package/dist/index.mjs +5883 -5504
  122. package/dist/index.mjs.map +1 -1
  123. package/dist/styles.css +15 -0
  124. package/dist/styles.css.map +1 -1
  125. package/dist/utils/index.d.mts +25 -1
  126. package/dist/utils/index.d.ts +25 -1
  127. package/dist/utils/index.js +24 -2
  128. package/dist/utils/index.js.map +1 -1
  129. package/dist/utils/index.mjs +20 -1
  130. package/dist/utils/index.mjs.map +1 -1
  131. package/package.json +2 -1
@@ -0,0 +1,4917 @@
1
+ // src/components/ActivityFilters/ActivityFilters.tsx
2
+ import { useState as useState9, useEffect as useEffect10, useMemo as useMemo2, useCallback } from "react";
3
+
4
+ // src/utils/utils.ts
5
+ import { clsx } from "clsx";
6
+ import { twMerge } from "tailwind-merge";
7
+
8
+ // src/utils/activityFilters.ts
9
+ function getSelectedIdsFromCategories(categories, keys) {
10
+ const result = {};
11
+ for (const [outputKey, categoryKey] of Object.entries(keys)) {
12
+ const category = categories.find((c) => c.key === categoryKey);
13
+ result[outputKey] = category?.selectedIds || [];
14
+ }
15
+ return result;
16
+ }
17
+ function toggleArrayItem(array, item) {
18
+ return array.includes(item) ? array.filter((i) => i !== item) : [...array, item];
19
+ }
20
+ function toggleSingleValue(currentValue, newValue) {
21
+ return currentValue === newValue ? null : newValue;
22
+ }
23
+
24
+ // src/utils/utils.ts
25
+ function cn(...inputs) {
26
+ return twMerge(clsx(inputs));
27
+ }
28
+ function getSubjectColorWithOpacity(hexColor, isDark) {
29
+ if (!hexColor) return void 0;
30
+ let color = hexColor.replace(/^#/, "").toLowerCase();
31
+ if (isDark) {
32
+ if (color.length === 8) {
33
+ color = color.slice(0, 6);
34
+ }
35
+ return `#${color}`;
36
+ } else {
37
+ let resultColor;
38
+ if (color.length === 6) {
39
+ resultColor = `#${color}4d`;
40
+ } else if (color.length === 8) {
41
+ resultColor = `#${color}`;
42
+ } else {
43
+ resultColor = `#${color}`;
44
+ }
45
+ return resultColor;
46
+ }
47
+ }
48
+
49
+ // src/components/Text/Text.tsx
50
+ import { jsx } from "react/jsx-runtime";
51
+ var Text = ({
52
+ children,
53
+ size = "md",
54
+ weight = "normal",
55
+ color = "text-text-950",
56
+ as,
57
+ className = "",
58
+ ...props
59
+ }) => {
60
+ let sizeClasses = "";
61
+ let weightClasses = "";
62
+ const sizeClassMap = {
63
+ "2xs": "text-2xs",
64
+ xs: "text-xs",
65
+ sm: "text-sm",
66
+ md: "text-md",
67
+ lg: "text-lg",
68
+ xl: "text-xl",
69
+ "2xl": "text-2xl",
70
+ "3xl": "text-3xl",
71
+ "4xl": "text-4xl",
72
+ "5xl": "text-5xl",
73
+ "6xl": "text-6xl"
74
+ };
75
+ sizeClasses = sizeClassMap[size] ?? sizeClassMap.md;
76
+ const weightClassMap = {
77
+ hairline: "font-hairline",
78
+ light: "font-light",
79
+ normal: "font-normal",
80
+ medium: "font-medium",
81
+ semibold: "font-semibold",
82
+ bold: "font-bold",
83
+ extrabold: "font-extrabold",
84
+ black: "font-black"
85
+ };
86
+ weightClasses = weightClassMap[weight] ?? weightClassMap.normal;
87
+ const baseClasses = "font-primary";
88
+ const Component = as ?? "p";
89
+ return /* @__PURE__ */ jsx(
90
+ Component,
91
+ {
92
+ className: cn(baseClasses, sizeClasses, weightClasses, color, className),
93
+ ...props,
94
+ children
95
+ }
96
+ );
97
+ };
98
+ var Text_default = Text;
99
+
100
+ // src/components/Button/Button.tsx
101
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
102
+ var VARIANT_ACTION_CLASSES = {
103
+ solid: {
104
+ 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",
105
+ 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",
106
+ 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"
107
+ },
108
+ outline: {
109
+ 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",
110
+ 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",
111
+ 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"
112
+ },
113
+ link: {
114
+ 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",
115
+ 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",
116
+ 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"
117
+ }
118
+ };
119
+ var SIZE_CLASSES = {
120
+ "extra-small": "text-xs px-3.5 py-2",
121
+ small: "text-sm px-4 py-2.5",
122
+ medium: "text-md px-5 py-2.5",
123
+ large: "text-lg px-6 py-3",
124
+ "extra-large": "text-lg px-7 py-3.5"
125
+ };
126
+ var Button = ({
127
+ children,
128
+ iconLeft,
129
+ iconRight,
130
+ size = "medium",
131
+ variant = "solid",
132
+ action = "primary",
133
+ className = "",
134
+ disabled,
135
+ type = "button",
136
+ ...props
137
+ }) => {
138
+ const sizeClasses = SIZE_CLASSES[size];
139
+ const variantClasses = VARIANT_ACTION_CLASSES[variant][action];
140
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-medium";
141
+ return /* @__PURE__ */ jsxs(
142
+ "button",
143
+ {
144
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
145
+ disabled,
146
+ type,
147
+ ...props,
148
+ children: [
149
+ iconLeft && /* @__PURE__ */ jsx2("span", { className: "mr-2 flex items-center", children: iconLeft }),
150
+ children,
151
+ iconRight && /* @__PURE__ */ jsx2("span", { className: "ml-2 flex items-center", children: iconRight })
152
+ ]
153
+ }
154
+ );
155
+ };
156
+ var Button_default = Button;
157
+
158
+ // src/components/Badge/Badge.tsx
159
+ import { Bell } from "phosphor-react";
160
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
161
+ var VARIANT_ACTION_CLASSES2 = {
162
+ solid: {
163
+ error: "bg-error-background text-error-700 focus-visible:outline-none",
164
+ warning: "bg-warning text-warning-800 focus-visible:outline-none",
165
+ success: "bg-success text-success-800 focus-visible:outline-none",
166
+ info: "bg-info text-info-800 focus-visible:outline-none",
167
+ muted: "bg-background-muted text-background-800 focus-visible:outline-none"
168
+ },
169
+ outlined: {
170
+ error: "bg-error text-error-700 border border-error-300 focus-visible:outline-none",
171
+ warning: "bg-warning text-warning-800 border border-warning-300 focus-visible:outline-none",
172
+ success: "bg-success text-success-800 border border-success-300 focus-visible:outline-none",
173
+ info: "bg-info text-info-800 border border-info-300 focus-visible:outline-none",
174
+ muted: "bg-background-muted text-background-800 border border-border-300 focus-visible:outline-none"
175
+ },
176
+ exams: {
177
+ exam1: "bg-exam-1 text-info-700 focus-visible:outline-none",
178
+ exam2: "bg-exam-2 text-typography-1 focus-visible:outline-none",
179
+ exam3: "bg-exam-3 text-typography-2 focus-visible:outline-none",
180
+ exam4: "bg-exam-4 text-success-700 focus-visible:outline-none"
181
+ },
182
+ examsOutlined: {
183
+ exam1: "bg-exam-1 text-info-700 border border-info-700 focus-visible:outline-none",
184
+ exam2: "bg-exam-2 text-typography-1 border border-typography-1 focus-visible:outline-none",
185
+ exam3: "bg-exam-3 text-typography-2 border border-typography-2 focus-visible:outline-none",
186
+ exam4: "bg-exam-4 text-success-700 border border-success-700 focus-visible:outline-none"
187
+ },
188
+ resultStatus: {
189
+ negative: "bg-error text-error-800 focus-visible:outline-none",
190
+ positive: "bg-success text-success-800 focus-visible:outline-none"
191
+ },
192
+ notification: "text-primary"
193
+ };
194
+ var SIZE_CLASSES2 = {
195
+ small: "text-2xs px-2 py-1",
196
+ medium: "text-xs px-2 py-1",
197
+ large: "text-sm px-2 py-1"
198
+ };
199
+ var SIZE_CLASSES_ICON = {
200
+ small: "size-3",
201
+ medium: "size-3.5",
202
+ large: "size-4"
203
+ };
204
+ var Badge = ({
205
+ children,
206
+ iconLeft,
207
+ iconRight,
208
+ size = "medium",
209
+ variant = "solid",
210
+ action = "error",
211
+ className = "",
212
+ notificationActive = false,
213
+ ...props
214
+ }) => {
215
+ const sizeClasses = SIZE_CLASSES2[size];
216
+ const sizeClassesIcon = SIZE_CLASSES_ICON[size];
217
+ const variantActionMap = VARIANT_ACTION_CLASSES2[variant] || {};
218
+ const variantClasses = typeof variantActionMap === "string" ? variantActionMap : variantActionMap[action] ?? variantActionMap.muted ?? "";
219
+ const baseClasses = "inline-flex items-center justify-center rounded-xs font-normal gap-1 relative";
220
+ const baseClassesIcon = "flex items-center";
221
+ if (variant === "notification") {
222
+ return /* @__PURE__ */ jsxs2(
223
+ "div",
224
+ {
225
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
226
+ ...props,
227
+ children: [
228
+ /* @__PURE__ */ jsx3(Bell, { size: 24, className: "text-current", "aria-hidden": "true" }),
229
+ notificationActive && /* @__PURE__ */ jsx3(
230
+ "span",
231
+ {
232
+ "data-testid": "notification-dot",
233
+ className: "absolute top-[5px] right-[10px] block h-2 w-2 rounded-full bg-indicator-error ring-2 ring-white"
234
+ }
235
+ )
236
+ ]
237
+ }
238
+ );
239
+ }
240
+ return /* @__PURE__ */ jsxs2(
241
+ "div",
242
+ {
243
+ className: cn(baseClasses, variantClasses, sizeClasses, className),
244
+ ...props,
245
+ children: [
246
+ iconLeft && /* @__PURE__ */ jsx3("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconLeft }),
247
+ children,
248
+ iconRight && /* @__PURE__ */ jsx3("span", { className: cn(baseClassesIcon, sizeClassesIcon), children: iconRight })
249
+ ]
250
+ }
251
+ );
252
+ };
253
+ var Badge_default = Badge;
254
+
255
+ // src/components/SelectionButton/SelectionButton.tsx
256
+ import { forwardRef } from "react";
257
+ import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
258
+ var SelectionButton = forwardRef(
259
+ ({ icon, label, selected = false, className = "", disabled, ...props }, ref) => {
260
+ const baseClasses = [
261
+ "inline-flex",
262
+ "items-center",
263
+ "justify-start",
264
+ "gap-2",
265
+ "p-4",
266
+ "rounded-xl",
267
+ "cursor-pointer",
268
+ "border",
269
+ "border-border-50",
270
+ "bg-background",
271
+ "text-sm",
272
+ "text-text-700",
273
+ "font-bold",
274
+ "shadow-soft-shadow-1",
275
+ "hover:bg-background-100",
276
+ "focus-visible:outline-none",
277
+ "focus-visible:ring-2",
278
+ "focus-visible:ring-indicator-info",
279
+ "focus-visible:ring-offset-0",
280
+ "focus-visible:shadow-none",
281
+ "active:ring-2",
282
+ "active:ring-primary-950",
283
+ "active:ring-offset-0",
284
+ "active:shadow-none",
285
+ "disabled:opacity-50",
286
+ "disabled:cursor-not-allowed"
287
+ ];
288
+ const stateClasses = selected ? ["ring-primary-950", "ring-2", "ring-offset-0", "shadow-none"] : [];
289
+ const allClasses = [...baseClasses, ...stateClasses].join(" ");
290
+ return /* @__PURE__ */ jsxs3(
291
+ "button",
292
+ {
293
+ ref,
294
+ type: "button",
295
+ className: cn(allClasses, className),
296
+ disabled,
297
+ "aria-pressed": selected,
298
+ ...props,
299
+ children: [
300
+ /* @__PURE__ */ jsx4("span", { className: "flex items-center justify-center w-6 h-6", children: icon }),
301
+ /* @__PURE__ */ jsx4("span", { children: label })
302
+ ]
303
+ }
304
+ );
305
+ }
306
+ );
307
+ SelectionButton.displayName = "SelectionButton";
308
+ var SelectionButton_default = SelectionButton;
309
+
310
+ // src/components/CheckBox/CheckBox.tsx
311
+ import {
312
+ forwardRef as forwardRef2,
313
+ useState,
314
+ useId
315
+ } from "react";
316
+ import { Check, Minus } from "phosphor-react";
317
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
318
+ var SIZE_CLASSES3 = {
319
+ small: {
320
+ checkbox: "w-4 h-4",
321
+ // 16px x 16px
322
+ textSize: "sm",
323
+ spacing: "gap-1.5",
324
+ // 6px
325
+ borderWidth: "border-2",
326
+ iconSize: 14,
327
+ // pixels for Phosphor icons
328
+ labelHeight: "h-[21px]"
329
+ },
330
+ medium: {
331
+ checkbox: "w-5 h-5",
332
+ // 20px x 20px
333
+ textSize: "md",
334
+ spacing: "gap-2",
335
+ // 8px
336
+ borderWidth: "border-2",
337
+ iconSize: 16,
338
+ // pixels for Phosphor icons
339
+ labelHeight: "h-6"
340
+ },
341
+ large: {
342
+ checkbox: "w-6 h-6",
343
+ // 24px x 24px
344
+ textSize: "lg",
345
+ spacing: "gap-2",
346
+ // 8px
347
+ borderWidth: "border-[3px]",
348
+ // 3px border
349
+ iconSize: 20,
350
+ // pixels for Phosphor icons
351
+ labelHeight: "h-[27px]"
352
+ }
353
+ };
354
+ var BASE_CHECKBOX_CLASSES = "rounded border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
355
+ var STATE_CLASSES = {
356
+ default: {
357
+ unchecked: "border-border-400 bg-background hover:border-border-500",
358
+ checked: "border-primary-950 bg-primary-950 text-text hover:border-primary-800 hover:bg-primary-800"
359
+ },
360
+ hovered: {
361
+ unchecked: "border-border-500 bg-background",
362
+ checked: "border-primary-800 bg-primary-800 text-text"
363
+ },
364
+ focused: {
365
+ unchecked: "border-indicator-info bg-background ring-2 ring-indicator-info/20",
366
+ checked: "border-indicator-info bg-primary-950 text-text ring-2 ring-indicator-info/20"
367
+ },
368
+ invalid: {
369
+ unchecked: "border-error-700 bg-background hover:border-error-600",
370
+ checked: "border-error-700 bg-primary-950 text-text"
371
+ },
372
+ disabled: {
373
+ unchecked: "border-border-400 bg-background cursor-not-allowed opacity-40",
374
+ checked: "border-primary-600 bg-primary-600 text-text cursor-not-allowed opacity-40"
375
+ }
376
+ };
377
+ var CheckBox = forwardRef2(
378
+ ({
379
+ label,
380
+ size = "medium",
381
+ state = "default",
382
+ indeterminate = false,
383
+ errorMessage,
384
+ helperText,
385
+ className = "",
386
+ labelClassName = "",
387
+ checked: checkedProp,
388
+ disabled,
389
+ id,
390
+ onChange,
391
+ ...props
392
+ }, ref) => {
393
+ const generatedId = useId();
394
+ const inputId = id ?? `checkbox-${generatedId}`;
395
+ const [internalChecked, setInternalChecked] = useState(false);
396
+ const isControlled = checkedProp !== void 0;
397
+ const checked = isControlled ? checkedProp : internalChecked;
398
+ const handleChange = (event) => {
399
+ if (!isControlled) {
400
+ setInternalChecked(event.target.checked);
401
+ }
402
+ onChange?.(event);
403
+ };
404
+ const currentState = disabled ? "disabled" : state;
405
+ const sizeClasses = SIZE_CLASSES3[size];
406
+ const checkVariant = checked || indeterminate ? "checked" : "unchecked";
407
+ const stylingClasses = STATE_CLASSES[currentState][checkVariant];
408
+ const borderWidthClass = state === "focused" || state === "hovered" && size === "large" ? "border-[3px]" : sizeClasses.borderWidth;
409
+ const checkboxClasses = cn(
410
+ BASE_CHECKBOX_CLASSES,
411
+ sizeClasses.checkbox,
412
+ borderWidthClass,
413
+ stylingClasses,
414
+ className
415
+ );
416
+ const renderIcon = () => {
417
+ if (indeterminate) {
418
+ return /* @__PURE__ */ jsx5(
419
+ Minus,
420
+ {
421
+ size: sizeClasses.iconSize,
422
+ weight: "bold",
423
+ color: "currentColor"
424
+ }
425
+ );
426
+ }
427
+ if (checked) {
428
+ return /* @__PURE__ */ jsx5(
429
+ Check,
430
+ {
431
+ size: sizeClasses.iconSize,
432
+ weight: "bold",
433
+ color: "currentColor"
434
+ }
435
+ );
436
+ }
437
+ return null;
438
+ };
439
+ return /* @__PURE__ */ jsxs4("div", { className: "flex flex-col", children: [
440
+ /* @__PURE__ */ jsxs4(
441
+ "div",
442
+ {
443
+ className: cn(
444
+ "flex flex-row items-center",
445
+ sizeClasses.spacing,
446
+ disabled ? "opacity-40" : ""
447
+ ),
448
+ children: [
449
+ /* @__PURE__ */ jsx5(
450
+ "input",
451
+ {
452
+ ref,
453
+ type: "checkbox",
454
+ id: inputId,
455
+ checked,
456
+ disabled,
457
+ onChange: handleChange,
458
+ className: "sr-only",
459
+ ...props
460
+ }
461
+ ),
462
+ /* @__PURE__ */ jsx5("label", { htmlFor: inputId, className: checkboxClasses, children: renderIcon() }),
463
+ label && /* @__PURE__ */ jsx5(
464
+ "div",
465
+ {
466
+ className: cn(
467
+ "flex flex-row items-center",
468
+ sizeClasses.labelHeight
469
+ ),
470
+ children: /* @__PURE__ */ jsx5(
471
+ Text_default,
472
+ {
473
+ as: "label",
474
+ htmlFor: inputId,
475
+ size: sizeClasses.textSize,
476
+ weight: "normal",
477
+ className: cn(
478
+ "cursor-pointer select-none leading-[150%] flex items-center font-roboto",
479
+ labelClassName
480
+ ),
481
+ children: label
482
+ }
483
+ )
484
+ }
485
+ )
486
+ ]
487
+ }
488
+ ),
489
+ errorMessage && /* @__PURE__ */ jsx5(
490
+ Text_default,
491
+ {
492
+ size: "sm",
493
+ weight: "normal",
494
+ className: "mt-1.5",
495
+ color: "text-error-600",
496
+ children: errorMessage
497
+ }
498
+ ),
499
+ helperText && !errorMessage && /* @__PURE__ */ jsx5(
500
+ Text_default,
501
+ {
502
+ size: "sm",
503
+ weight: "normal",
504
+ className: "mt-1.5",
505
+ color: "text-text-500",
506
+ children: helperText
507
+ }
508
+ )
509
+ ] });
510
+ }
511
+ );
512
+ CheckBox.displayName = "CheckBox";
513
+ var CheckBox_default = CheckBox;
514
+
515
+ // src/components/CheckBoxGroup/CheckBoxGroup.tsx
516
+ import { useEffect, useMemo, useRef, useState as useState2 } from "react";
517
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
518
+ var CheckboxGroup = ({
519
+ categories,
520
+ onCategoriesChange
521
+ }) => {
522
+ const [openAccordion, setOpenAccordion] = useState2("");
523
+ const autoSelectionAppliedRef = useRef(false);
524
+ const onCategoriesChangeRef = useRef(onCategoriesChange);
525
+ const previousCategoriesRef = useRef(categories);
526
+ useEffect(() => {
527
+ onCategoriesChangeRef.current = onCategoriesChange;
528
+ }, [onCategoriesChange]);
529
+ const areSelectedIdsEqual = (ids1, ids2) => {
530
+ if (ids1 === ids2) return true;
531
+ if (!ids1 || !ids2) return ids1 === ids2;
532
+ if (ids1.length !== ids2.length) return false;
533
+ for (let i = 0; i < ids1.length; i++) {
534
+ if (ids1[i] !== ids2[i]) return false;
535
+ }
536
+ return true;
537
+ };
538
+ const categoriesWithAutoSelection = useMemo(() => {
539
+ return categories.map((category) => {
540
+ if (category.itens?.length === 1 && (!category.selectedIds || category.selectedIds.length === 0)) {
541
+ return {
542
+ ...category,
543
+ selectedIds: [category.itens[0].id]
544
+ };
545
+ }
546
+ return category;
547
+ });
548
+ }, [categories]);
549
+ useEffect(() => {
550
+ const categoriesChanged = categories !== previousCategoriesRef.current;
551
+ if (!categoriesChanged && autoSelectionAppliedRef.current) {
552
+ return;
553
+ }
554
+ previousCategoriesRef.current = categories;
555
+ const hasAutoSelectionChanges = categoriesWithAutoSelection.some(
556
+ (cat, index) => {
557
+ const originalCat = categories[index];
558
+ return !areSelectedIdsEqual(cat.selectedIds, originalCat.selectedIds);
559
+ }
560
+ );
561
+ if (hasAutoSelectionChanges) {
562
+ autoSelectionAppliedRef.current = true;
563
+ onCategoriesChangeRef.current(categoriesWithAutoSelection);
564
+ } else if (categoriesChanged) {
565
+ autoSelectionAppliedRef.current = false;
566
+ }
567
+ }, [categoriesWithAutoSelection, categories]);
568
+ const isCheckBoxIsSelected = (categoryKey, itemId) => {
569
+ const category = categories.find((c) => c.key === categoryKey);
570
+ if (!category) return false;
571
+ return category.selectedIds?.includes(itemId) || false;
572
+ };
573
+ const isMinimalOneCheckBoxIsSelected = (categoryKey) => {
574
+ const category = categories.find((c) => c.key === categoryKey);
575
+ if (!category) return false;
576
+ const formattedItems = getFormattedItems(categoryKey);
577
+ const filteredItems = formattedItems.flatMap((group) => group.itens || []);
578
+ const filteredItemIds = filteredItems.map((item) => item.id);
579
+ return filteredItemIds.some(
580
+ (itemId) => category.selectedIds?.includes(itemId)
581
+ );
582
+ };
583
+ const createCombinations = (acc, currentArray) => {
584
+ const combinations = [];
585
+ for (const existingCombo of acc) {
586
+ for (const item of currentArray) {
587
+ combinations.push([...existingCombo, item]);
588
+ }
589
+ }
590
+ return combinations;
591
+ };
592
+ const cartesian = (arr) => {
593
+ return arr.reduce(createCombinations, [[]]);
594
+ };
595
+ const getSelectedIdsForFilters = (filters) => {
596
+ return filters.map((f) => {
597
+ const parentCat = categories.find((c) => c.key === f.key);
598
+ if (!parentCat?.selectedIds?.length) {
599
+ return [];
600
+ }
601
+ return parentCat.selectedIds;
602
+ });
603
+ };
604
+ const generateSingleFilterLabel = (filter, comboId) => {
605
+ const cat = categories.find((c) => c.key === filter.key);
606
+ return cat?.itens?.find((i) => i.id === comboId)?.name || comboId;
607
+ };
608
+ const generateMultipleFiltersLabel = (filters, comboIds) => {
609
+ const firstCat = categories.find((c) => c.key === filters[0].key);
610
+ const firstVal = firstCat?.itens?.find((i) => i.id === comboIds[0])?.name || comboIds[0];
611
+ const labelParts = [firstVal];
612
+ for (let idx = 1; idx < filters.length; idx++) {
613
+ const f = filters[idx];
614
+ const cat = categories.find((c) => c.key === f.key);
615
+ const val = cat?.itens?.find((i) => i.id === comboIds[idx])?.name || comboIds[idx];
616
+ labelParts.push(`(${val})`);
617
+ }
618
+ return labelParts.join(" ");
619
+ };
620
+ const processCombination = (comboIds, filters, category, groupedMap) => {
621
+ const filteredItems = (category?.itens || []).filter(
622
+ (item) => filters.every((f, idx) => item[f.internalField] === comboIds[idx])
623
+ );
624
+ if (filteredItems.length === 0) return;
625
+ let groupLabel = void 0;
626
+ if (filters.length === 1) {
627
+ groupLabel = generateSingleFilterLabel(filters[0], comboIds[0]);
628
+ } else if (filters.length > 1) {
629
+ groupLabel = generateMultipleFiltersLabel(filters, comboIds);
630
+ }
631
+ const key = groupLabel || "";
632
+ if (!groupedMap[key]) {
633
+ groupedMap[key] = groupLabel ? { groupLabel, itens: [] } : { itens: [] };
634
+ }
635
+ groupedMap[key].itens.push(...filteredItems);
636
+ };
637
+ const calculateFormattedItems = (categoryKey) => {
638
+ const category = categories.find((c) => c.key === categoryKey);
639
+ if (!category?.dependsOn || category.dependsOn.length === 0) {
640
+ return [{ itens: category?.itens || [] }];
641
+ }
642
+ const isEnabled = category.dependsOn.every((depKey) => {
643
+ const depCat = categories.find((c) => c.key === depKey);
644
+ return depCat?.selectedIds && depCat.selectedIds.length > 0;
645
+ });
646
+ if (!isEnabled) {
647
+ return [{ itens: [] }];
648
+ }
649
+ const filters = category.filteredBy || [];
650
+ if (filters.length === 0) {
651
+ return [{ itens: category?.itens || [] }];
652
+ }
653
+ const selectedIdsArr = getSelectedIdsForFilters(filters);
654
+ if (selectedIdsArr.some((arr) => arr.length === 0)) {
655
+ return [{ itens: [] }];
656
+ }
657
+ const combinations = cartesian(selectedIdsArr);
658
+ const groupedMap = {};
659
+ for (const comboIds of combinations) {
660
+ processCombination(comboIds, filters, category, groupedMap);
661
+ }
662
+ const groupedItems = Object.values(groupedMap).filter(
663
+ (g) => g.itens.length
664
+ );
665
+ return groupedItems.length ? groupedItems : [{ itens: [] }];
666
+ };
667
+ const formattedItemsMap = useMemo(() => {
668
+ const formattedItemsMap2 = {};
669
+ for (const category of categories) {
670
+ const formattedItems = calculateFormattedItems(category.key);
671
+ formattedItemsMap2[category.key] = formattedItems;
672
+ }
673
+ return formattedItemsMap2;
674
+ }, [categories]);
675
+ const getFormattedItems = (categoryKey) => {
676
+ return formattedItemsMap[categoryKey] || [{ itens: [] }];
677
+ };
678
+ const getDependentCategories = (categoryKey) => {
679
+ return categories.filter((cat) => cat.dependsOn?.includes(categoryKey)).map((cat) => cat.key);
680
+ };
681
+ const findItemsToRemove = (depCategory, relevantFilter, deselectedItemId) => {
682
+ return depCategory.itens?.filter(
683
+ (item) => item[relevantFilter.internalField] === deselectedItemId
684
+ ).map((item) => item.id) || [];
685
+ };
686
+ const processDependentCategory = (depCategoryKey, categoryKey, deselectedItemId, itemsToDeselect) => {
687
+ const depCategory = categories.find((c) => c.key === depCategoryKey);
688
+ if (!depCategory?.filteredBy) return;
689
+ const relevantFilter = depCategory.filteredBy.find(
690
+ (f) => f.key === categoryKey
691
+ );
692
+ if (!relevantFilter) return;
693
+ const itemsToRemove = findItemsToRemove(
694
+ depCategory,
695
+ relevantFilter,
696
+ deselectedItemId
697
+ );
698
+ if (itemsToRemove.length > 0) {
699
+ itemsToDeselect[depCategoryKey] = itemsToRemove;
700
+ }
701
+ };
702
+ const getItemsToDeselect = (categoryKey, deselectedItemId) => {
703
+ const deselectedItem = categories.find((c) => c.key === categoryKey)?.itens?.find((item) => item.id === deselectedItemId);
704
+ if (!deselectedItem) return {};
705
+ const itemsToDeselect = {};
706
+ const dependentCategories = getDependentCategories(categoryKey);
707
+ for (const depCategoryKey of dependentCategories) {
708
+ processDependentCategory(
709
+ depCategoryKey,
710
+ categoryKey,
711
+ deselectedItemId,
712
+ itemsToDeselect
713
+ );
714
+ }
715
+ return itemsToDeselect;
716
+ };
717
+ const updateCategorySelectedIds = (updatedCategories, depCategoryIndex, depCategory, itemIds) => {
718
+ const newSelectedIds = depCategory.selectedIds?.filter((id) => !itemIds.includes(id)) || [];
719
+ updatedCategories[depCategoryIndex] = {
720
+ ...depCategory,
721
+ selectedIds: newSelectedIds
722
+ };
723
+ return updatedCategories;
724
+ };
725
+ const applyRecursiveCascade = (depCategoryKey, itemIds, updatedCategories) => {
726
+ let result = updatedCategories;
727
+ for (const itemId of itemIds) {
728
+ result = applyCascadeDeselection(depCategoryKey, itemId, result);
729
+ }
730
+ return result;
731
+ };
732
+ const applyCascadeDeselection = (categoryKey, deselectedItemId, currentCategories) => {
733
+ const itemsToDeselect = getItemsToDeselect(categoryKey, deselectedItemId);
734
+ let updatedCategories = [...currentCategories];
735
+ for (const [depCategoryKey, itemIds] of Object.entries(itemsToDeselect)) {
736
+ const depCategoryIndex = updatedCategories.findIndex(
737
+ (c) => c.key === depCategoryKey
738
+ );
739
+ if (depCategoryIndex !== -1) {
740
+ const depCategory = updatedCategories[depCategoryIndex];
741
+ updatedCategories = updateCategorySelectedIds(
742
+ updatedCategories,
743
+ depCategoryIndex,
744
+ depCategory,
745
+ itemIds
746
+ );
747
+ updatedCategories = applyRecursiveCascade(
748
+ depCategoryKey,
749
+ itemIds,
750
+ updatedCategories
751
+ );
752
+ }
753
+ }
754
+ return updatedCategories;
755
+ };
756
+ const toggleAllInCategory = (categoryKey) => {
757
+ const category = categories.find((c) => c.key === categoryKey);
758
+ if (!category) return;
759
+ const formattedItems = getFormattedItems(categoryKey);
760
+ const filteredItems = formattedItems.flatMap((group) => group.itens || []);
761
+ const filteredItemIds = filteredItems.map((item) => item.id);
762
+ const selectedFilteredCount = filteredItemIds.filter(
763
+ (itemId) => category.selectedIds?.includes(itemId)
764
+ ).length;
765
+ const allFilteredSelected = selectedFilteredCount === filteredItemIds.length;
766
+ const newSelection = allFilteredSelected ? category.selectedIds?.filter((id) => !filteredItemIds.includes(id)) || [] : [
767
+ ...category.selectedIds || [],
768
+ ...filteredItemIds.filter(
769
+ (id) => !category.selectedIds?.includes(id)
770
+ )
771
+ ];
772
+ let updatedCategories = categories.map(
773
+ (c) => c.key === categoryKey ? { ...c, selectedIds: newSelection } : c
774
+ );
775
+ if (allFilteredSelected) {
776
+ for (const itemId of filteredItemIds) {
777
+ updatedCategories = applyCascadeDeselection(
778
+ categoryKey,
779
+ itemId,
780
+ updatedCategories
781
+ );
782
+ }
783
+ }
784
+ onCategoriesChange(updatedCategories);
785
+ };
786
+ const toggleItem = (categoryKey, itemId) => {
787
+ const category = categories.find((c) => c.key === categoryKey);
788
+ if (!category) return;
789
+ const isCurrentlySelected = category.selectedIds?.includes(itemId);
790
+ const newSelection = isCurrentlySelected ? category.selectedIds?.filter((id) => id !== itemId) : [...category.selectedIds || [], itemId];
791
+ let updatedCategories = categories.map(
792
+ (c) => c.key === categoryKey ? { ...c, selectedIds: newSelection } : c
793
+ );
794
+ if (isCurrentlySelected) {
795
+ updatedCategories = applyCascadeDeselection(
796
+ categoryKey,
797
+ itemId,
798
+ updatedCategories
799
+ );
800
+ }
801
+ onCategoriesChange(updatedCategories);
802
+ };
803
+ const renderCheckboxItem = (item, categoryKey) => {
804
+ const uniqueId = `${categoryKey}-${item.id}`;
805
+ return /* @__PURE__ */ jsxs5(
806
+ "div",
807
+ {
808
+ className: "flex items-center gap-3 px-2",
809
+ role: "presentation",
810
+ onClick: (e) => e.stopPropagation(),
811
+ onMouseDown: (e) => e.stopPropagation(),
812
+ onMouseUp: (e) => e.stopPropagation(),
813
+ onKeyDown: (e) => e.stopPropagation(),
814
+ children: [
815
+ /* @__PURE__ */ jsx6(
816
+ CheckBox_default,
817
+ {
818
+ id: uniqueId,
819
+ checked: isCheckBoxIsSelected(categoryKey, item.id),
820
+ onChange: () => toggleItem(categoryKey, item.id)
821
+ }
822
+ ),
823
+ /* @__PURE__ */ jsx6(
824
+ "label",
825
+ {
826
+ htmlFor: uniqueId,
827
+ className: "text-sm text-text-950 cursor-pointer select-none",
828
+ children: item.name
829
+ }
830
+ )
831
+ ]
832
+ },
833
+ item.id
834
+ );
835
+ };
836
+ const renderFormattedGroup = (formattedGroup, idx, categoryKey) => /* @__PURE__ */ jsxs5(
837
+ "div",
838
+ {
839
+ className: "flex flex-col gap-3",
840
+ children: [
841
+ "groupLabel" in formattedGroup && formattedGroup.groupLabel && /* @__PURE__ */ jsx6(Text_default, { size: "sm", className: "mt-2", weight: "semibold", children: formattedGroup.groupLabel }),
842
+ formattedGroup.itens?.map(
843
+ (item) => renderCheckboxItem(item, categoryKey)
844
+ )
845
+ ]
846
+ },
847
+ formattedGroup.groupLabel || `group-${idx}`
848
+ );
849
+ const renderAccordionTrigger = (category, isEnabled) => /* @__PURE__ */ jsxs5("div", { className: "flex items-center justify-between w-full p-2", children: [
850
+ /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-3", children: [
851
+ /* @__PURE__ */ jsx6(
852
+ CheckBox_default,
853
+ {
854
+ checked: isMinimalOneCheckBoxIsSelected(category.key),
855
+ disabled: !isEnabled,
856
+ indeterminate: isMinimalOneCheckBoxIsSelected(category.key),
857
+ onChange: () => toggleAllInCategory(category.key)
858
+ }
859
+ ),
860
+ /* @__PURE__ */ jsx6(
861
+ Text_default,
862
+ {
863
+ size: "sm",
864
+ weight: "medium",
865
+ className: cn("text-text-800", !isEnabled && "opacity-40"),
866
+ children: category.label
867
+ }
868
+ )
869
+ ] }),
870
+ (openAccordion === category.key || isEnabled) && /* @__PURE__ */ jsx6(Badge_default, { variant: "solid", action: "info", children: (() => {
871
+ const visibleIds = getFormattedItems(category.key).flatMap((group) => group.itens || []).map((i) => i.id);
872
+ const selectedVisibleCount = visibleIds.filter(
873
+ (id) => category.selectedIds?.includes(id)
874
+ ).length;
875
+ const totalVisible = visibleIds.length;
876
+ return `${selectedVisibleCount} de ${totalVisible} ${selectedVisibleCount === 1 ? "selecionado" : "selecionados"}`;
877
+ })() })
878
+ ] });
879
+ const renderCategoryAccordion = (category) => {
880
+ const isEnabled = !category.dependsOn || category.dependsOn.every((depKey) => {
881
+ const depCat = categories.find((c) => c.key === depKey);
882
+ return depCat?.selectedIds && depCat.selectedIds.length > 0;
883
+ });
884
+ const hasOnlyOneItem = category.itens?.length === 1;
885
+ if (hasOnlyOneItem) {
886
+ return null;
887
+ }
888
+ const formattedItems = getFormattedItems(category.key);
889
+ const hasNoItems = formattedItems.every(
890
+ (group) => !group.itens || group.itens.length === 0
891
+ );
892
+ return /* @__PURE__ */ jsxs5("div", { children: [
893
+ /* @__PURE__ */ jsx6(
894
+ CardAccordation,
895
+ {
896
+ value: category.key,
897
+ disabled: !isEnabled,
898
+ className: cn(
899
+ "bg-transparent border-0",
900
+ openAccordion === category.key && "bg-background-50 border-none"
901
+ ),
902
+ trigger: renderAccordionTrigger(category, isEnabled),
903
+ children: /* @__PURE__ */ jsx6("div", { className: "flex flex-col gap-3 pt-2", children: hasNoItems && isEnabled ? /* @__PURE__ */ jsx6("div", { className: "px-2 py-4", children: /* @__PURE__ */ jsx6(Text_default, { size: "sm", className: "text-text-500 text-center", children: "Sem dados" }) }) : formattedItems.map(
904
+ (formattedGroup, idx) => renderFormattedGroup(formattedGroup, idx, category.key)
905
+ ) })
906
+ }
907
+ ),
908
+ openAccordion !== category.key && /* @__PURE__ */ jsx6(Divider_default, {})
909
+ ] }, category.key);
910
+ };
911
+ useEffect(() => {
912
+ if (!openAccordion) return;
913
+ const category = categories.find((c) => c.key === openAccordion);
914
+ if (!category) return;
915
+ const isEnabled = !category.dependsOn || category.dependsOn.every((depKey) => {
916
+ const depCat = categories.find((c) => c.key === depKey);
917
+ return depCat?.selectedIds && depCat.selectedIds.length > 0;
918
+ });
919
+ if (!isEnabled) {
920
+ setTimeout(() => {
921
+ setOpenAccordion("");
922
+ }, 0);
923
+ }
924
+ }, [categories, openAccordion]);
925
+ return /* @__PURE__ */ jsx6(
926
+ AccordionGroup,
927
+ {
928
+ type: "single",
929
+ collapsible: true,
930
+ value: openAccordion,
931
+ onValueChange: (value) => {
932
+ if (typeof value === "string") {
933
+ if (value) {
934
+ const category = categories.find((c) => c.key === value);
935
+ const isEnabled = !category?.dependsOn || category.dependsOn.every((depKey) => {
936
+ const depCat = categories.find((c) => c.key === depKey);
937
+ return depCat?.selectedIds && depCat.selectedIds.length > 0;
938
+ });
939
+ if (!isEnabled) {
940
+ return;
941
+ }
942
+ }
943
+ setOpenAccordion(value);
944
+ }
945
+ },
946
+ children: categories.map(renderCategoryAccordion)
947
+ }
948
+ );
949
+ };
950
+
951
+ // src/components/Modal/Modal.tsx
952
+ import { useEffect as useEffect2, useId as useId2 } from "react";
953
+ import { X } from "phosphor-react";
954
+
955
+ // src/components/Modal/utils/videoUtils.ts
956
+ var isYouTubeUrl = (url) => {
957
+ const youtubeRegex = /^(https?:\/\/)?((www|m|music)\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/.+/i;
958
+ return youtubeRegex.test(url);
959
+ };
960
+ var isValidYouTubeHost = (host) => {
961
+ if (host === "youtu.be") return "youtu.be";
962
+ const isValidYouTubeCom = host === "youtube.com" || host.endsWith(".youtube.com") && /^(www|m|music)\.youtube\.com$/.test(host);
963
+ if (isValidYouTubeCom) return "youtube";
964
+ const isValidNoCookie = host === "youtube-nocookie.com" || host.endsWith(".youtube-nocookie.com") && /^(www|m|music)\.youtube-nocookie\.com$/.test(host);
965
+ if (isValidNoCookie) return "nocookie";
966
+ return null;
967
+ };
968
+ var extractYoutuBeId = (pathname) => {
969
+ const firstSeg = pathname.split("/").filter(Boolean)[0];
970
+ return firstSeg || null;
971
+ };
972
+ var extractYouTubeId = (pathname, searchParams) => {
973
+ const parts = pathname.split("/").filter(Boolean);
974
+ const [first, second] = parts;
975
+ if (first === "embed" && second) return second;
976
+ if (first === "shorts" && second) return second;
977
+ if (first === "live" && second) return second;
978
+ const v = searchParams.get("v");
979
+ if (v) return v;
980
+ return null;
981
+ };
982
+ var getYouTubeVideoId = (url) => {
983
+ try {
984
+ const u = new URL(url);
985
+ const hostType = isValidYouTubeHost(u.hostname.toLowerCase());
986
+ if (!hostType) return null;
987
+ if (hostType === "youtu.be") {
988
+ return extractYoutuBeId(u.pathname);
989
+ }
990
+ return extractYouTubeId(u.pathname, u.searchParams);
991
+ } catch {
992
+ return null;
993
+ }
994
+ };
995
+ var getYouTubeEmbedUrl = (videoId) => {
996
+ return `https://www.youtube-nocookie.com/embed/${videoId}?autoplay=0&rel=0&modestbranding=1`;
997
+ };
998
+
999
+ // src/components/Modal/Modal.tsx
1000
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1001
+ var SIZE_CLASSES4 = {
1002
+ xs: "max-w-[360px]",
1003
+ sm: "max-w-[420px]",
1004
+ md: "max-w-[510px]",
1005
+ lg: "max-w-[640px]",
1006
+ xl: "max-w-[970px]"
1007
+ };
1008
+ var Modal = ({
1009
+ isOpen,
1010
+ onClose,
1011
+ title,
1012
+ children,
1013
+ size = "md",
1014
+ className = "",
1015
+ closeOnEscape = true,
1016
+ footer,
1017
+ hideCloseButton = false,
1018
+ variant = "default",
1019
+ description,
1020
+ image,
1021
+ imageAlt,
1022
+ actionLink,
1023
+ actionLabel,
1024
+ contentClassName = ""
1025
+ }) => {
1026
+ const titleId = useId2();
1027
+ useEffect2(() => {
1028
+ if (!isOpen || !closeOnEscape) return;
1029
+ const handleEscape = (event) => {
1030
+ if (event.key === "Escape") {
1031
+ onClose();
1032
+ }
1033
+ };
1034
+ document.addEventListener("keydown", handleEscape);
1035
+ return () => document.removeEventListener("keydown", handleEscape);
1036
+ }, [isOpen, closeOnEscape, onClose]);
1037
+ useEffect2(() => {
1038
+ if (!isOpen) return;
1039
+ const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
1040
+ const originalOverflow = document.body.style.overflow;
1041
+ const originalPaddingRight = document.body.style.paddingRight;
1042
+ document.body.style.overflow = "hidden";
1043
+ if (scrollbarWidth > 0) {
1044
+ document.body.style.paddingRight = `${scrollbarWidth}px`;
1045
+ const overlay = document.createElement("div");
1046
+ overlay.id = "modal-scrollbar-overlay";
1047
+ overlay.style.cssText = `
1048
+ position: fixed;
1049
+ top: 0;
1050
+ right: 0;
1051
+ width: ${scrollbarWidth}px;
1052
+ height: 100vh;
1053
+ background-color: rgb(0 0 0 / 0.6);
1054
+ z-index: 40;
1055
+ pointer-events: none;
1056
+ `;
1057
+ document.body.appendChild(overlay);
1058
+ }
1059
+ return () => {
1060
+ document.body.style.overflow = originalOverflow;
1061
+ document.body.style.paddingRight = originalPaddingRight;
1062
+ const overlay = document.getElementById("modal-scrollbar-overlay");
1063
+ if (overlay) {
1064
+ overlay.remove();
1065
+ }
1066
+ };
1067
+ }, [isOpen]);
1068
+ if (!isOpen) return null;
1069
+ const sizeClasses = SIZE_CLASSES4[size];
1070
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
1071
+ const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
1072
+ const modalClasses = cn(
1073
+ baseClasses,
1074
+ sizeClasses,
1075
+ dialogResetClasses,
1076
+ className
1077
+ );
1078
+ const normalizeUrl = (href) => /^https?:\/\//i.test(href) ? href : `https://${href}`;
1079
+ const handleActionClick = () => {
1080
+ if (actionLink) {
1081
+ window.open(normalizeUrl(actionLink), "_blank", "noopener,noreferrer");
1082
+ }
1083
+ };
1084
+ if (variant === "activity") {
1085
+ return /* @__PURE__ */ jsx7("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ jsxs6(
1086
+ "dialog",
1087
+ {
1088
+ className: modalClasses,
1089
+ "aria-labelledby": titleId,
1090
+ "aria-modal": "true",
1091
+ open: true,
1092
+ children: [
1093
+ /* @__PURE__ */ jsx7("div", { className: "flex justify-end p-6 pb-0", children: !hideCloseButton && /* @__PURE__ */ jsx7(
1094
+ "button",
1095
+ {
1096
+ onClick: onClose,
1097
+ className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
1098
+ "aria-label": "Fechar modal",
1099
+ children: /* @__PURE__ */ jsx7(X, { size: 18 })
1100
+ }
1101
+ ) }),
1102
+ /* @__PURE__ */ jsxs6("div", { className: "flex flex-col items-center px-6 pb-6 gap-5", children: [
1103
+ image && /* @__PURE__ */ jsx7("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx7(
1104
+ "img",
1105
+ {
1106
+ src: image,
1107
+ alt: imageAlt ?? "",
1108
+ className: "w-[122px] h-[122px] object-contain"
1109
+ }
1110
+ ) }),
1111
+ /* @__PURE__ */ jsx7(
1112
+ "h2",
1113
+ {
1114
+ id: titleId,
1115
+ className: "text-lg font-semibold text-text-950 text-center",
1116
+ children: title
1117
+ }
1118
+ ),
1119
+ description && /* @__PURE__ */ jsx7("p", { className: "text-sm font-normal text-text-400 text-center max-w-md leading-[21px]", children: description }),
1120
+ actionLink && /* @__PURE__ */ jsxs6("div", { className: "w-full", children: [
1121
+ (() => {
1122
+ const normalized = normalizeUrl(actionLink);
1123
+ const isYT = isYouTubeUrl(normalized);
1124
+ if (!isYT) return null;
1125
+ const id = getYouTubeVideoId(normalized);
1126
+ if (!id) {
1127
+ return /* @__PURE__ */ jsx7(
1128
+ Button_default,
1129
+ {
1130
+ variant: "solid",
1131
+ action: "primary",
1132
+ size: "large",
1133
+ className: "w-full",
1134
+ onClick: handleActionClick,
1135
+ children: actionLabel || "Iniciar Atividade"
1136
+ }
1137
+ );
1138
+ }
1139
+ return /* @__PURE__ */ jsx7(
1140
+ "iframe",
1141
+ {
1142
+ src: getYouTubeEmbedUrl(id),
1143
+ className: "w-full aspect-video rounded-lg",
1144
+ allowFullScreen: true,
1145
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
1146
+ title: "V\xEDdeo YouTube"
1147
+ }
1148
+ );
1149
+ })(),
1150
+ !isYouTubeUrl(normalizeUrl(actionLink)) && /* @__PURE__ */ jsx7(
1151
+ Button_default,
1152
+ {
1153
+ variant: "solid",
1154
+ action: "primary",
1155
+ size: "large",
1156
+ className: "w-full",
1157
+ onClick: handleActionClick,
1158
+ children: actionLabel || "Iniciar Atividade"
1159
+ }
1160
+ )
1161
+ ] })
1162
+ ] })
1163
+ ]
1164
+ }
1165
+ ) });
1166
+ }
1167
+ return /* @__PURE__ */ jsx7("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-xs border-none p-0 m-0 w-full cursor-default", children: /* @__PURE__ */ jsxs6(
1168
+ "dialog",
1169
+ {
1170
+ className: modalClasses,
1171
+ "aria-labelledby": titleId,
1172
+ "aria-modal": "true",
1173
+ open: true,
1174
+ children: [
1175
+ /* @__PURE__ */ jsxs6("div", { className: "flex items-center justify-between px-6 py-6", children: [
1176
+ /* @__PURE__ */ jsx7("h2", { id: titleId, className: "text-lg font-semibold text-text-950", children: title }),
1177
+ !hideCloseButton && /* @__PURE__ */ jsx7(
1178
+ "button",
1179
+ {
1180
+ onClick: onClose,
1181
+ className: "p-1 text-text-500 hover:text-text-700 hover:bg-background-50 rounded-md transition-colors focus:outline-none focus:ring-2 focus:ring-indicator-info focus:ring-offset-2",
1182
+ "aria-label": "Fechar modal",
1183
+ children: /* @__PURE__ */ jsx7(X, { size: 18 })
1184
+ }
1185
+ )
1186
+ ] }),
1187
+ children && /* @__PURE__ */ jsx7("div", { className: cn("px-6 pb-6", contentClassName), children: /* @__PURE__ */ jsx7("div", { className: "text-text-500 font-normal text-sm leading-6", children }) }),
1188
+ footer && /* @__PURE__ */ jsx7("div", { className: "flex justify-end gap-3 px-6 pb-6", children: footer })
1189
+ ]
1190
+ }
1191
+ ) });
1192
+ };
1193
+ var Modal_default = Modal;
1194
+
1195
+ // src/components/Divider/Divider.tsx
1196
+ import { jsx as jsx8 } from "react/jsx-runtime";
1197
+ var Divider = ({
1198
+ orientation = "horizontal",
1199
+ className = "",
1200
+ ...props
1201
+ }) => {
1202
+ const baseClasses = "bg-border-200 border-0";
1203
+ const orientationClasses = {
1204
+ horizontal: "w-full h-px",
1205
+ vertical: "h-full w-px"
1206
+ };
1207
+ return /* @__PURE__ */ jsx8(
1208
+ "hr",
1209
+ {
1210
+ className: cn(baseClasses, orientationClasses[orientation], className),
1211
+ "aria-orientation": orientation,
1212
+ ...props
1213
+ }
1214
+ );
1215
+ };
1216
+ var Divider_default = Divider;
1217
+
1218
+ // src/components/Radio/Radio.tsx
1219
+ import {
1220
+ forwardRef as forwardRef3,
1221
+ useState as useState3,
1222
+ useId as useId3,
1223
+ useEffect as useEffect3,
1224
+ useRef as useRef2,
1225
+ Children,
1226
+ cloneElement,
1227
+ isValidElement
1228
+ } from "react";
1229
+ import { create, useStore } from "zustand";
1230
+ import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
1231
+ var SIZE_CLASSES5 = {
1232
+ small: {
1233
+ radio: "w-5 h-5",
1234
+ textSize: "sm",
1235
+ spacing: "gap-1.5",
1236
+ borderWidth: "border-2",
1237
+ dotSize: "w-2.5 h-2.5",
1238
+ labelHeight: "h-5"
1239
+ },
1240
+ medium: {
1241
+ radio: "w-6 h-6",
1242
+ textSize: "md",
1243
+ spacing: "gap-2",
1244
+ borderWidth: "border-2",
1245
+ dotSize: "w-3 h-3",
1246
+ labelHeight: "h-6"
1247
+ },
1248
+ large: {
1249
+ radio: "w-7 h-7",
1250
+ textSize: "lg",
1251
+ spacing: "gap-2",
1252
+ borderWidth: "border-2",
1253
+ dotSize: "w-3.5 h-3.5",
1254
+ labelHeight: "h-7"
1255
+ },
1256
+ extraLarge: {
1257
+ radio: "w-8 h-8",
1258
+ textSize: "xl",
1259
+ spacing: "gap-3",
1260
+ borderWidth: "border-2",
1261
+ dotSize: "w-4 h-4",
1262
+ labelHeight: "h-8"
1263
+ }
1264
+ };
1265
+ var BASE_RADIO_CLASSES = "rounded-full border cursor-pointer transition-all duration-200 flex items-center justify-center focus:outline-none";
1266
+ var STATE_CLASSES2 = {
1267
+ default: {
1268
+ unchecked: "border-border-400 bg-background hover:border-border-500",
1269
+ checked: "border-primary-950 bg-background hover:border-primary-800"
1270
+ },
1271
+ hovered: {
1272
+ unchecked: "border-border-500 bg-background",
1273
+ checked: "border-info-700 bg-background"
1274
+ },
1275
+ focused: {
1276
+ unchecked: "border-border-400 bg-background",
1277
+ checked: "border-primary-950 bg-background"
1278
+ },
1279
+ invalid: {
1280
+ unchecked: "border-border-400 bg-background",
1281
+ checked: "border-primary-950 bg-background"
1282
+ },
1283
+ disabled: {
1284
+ unchecked: "border-border-400 bg-background cursor-not-allowed",
1285
+ checked: "border-primary-950 bg-background cursor-not-allowed"
1286
+ }
1287
+ };
1288
+ var DOT_CLASSES = {
1289
+ default: "bg-primary-950",
1290
+ hovered: "bg-info-700",
1291
+ focused: "bg-primary-950",
1292
+ invalid: "bg-primary-950",
1293
+ disabled: "bg-primary-950"
1294
+ };
1295
+ var Radio = forwardRef3(
1296
+ ({
1297
+ label,
1298
+ size = "medium",
1299
+ state = "default",
1300
+ errorMessage,
1301
+ helperText,
1302
+ className = "",
1303
+ labelClassName = "",
1304
+ checked: checkedProp,
1305
+ defaultChecked = false,
1306
+ disabled,
1307
+ id,
1308
+ name,
1309
+ value,
1310
+ onChange,
1311
+ ...props
1312
+ }, ref) => {
1313
+ const generatedId = useId3();
1314
+ const inputId = id ?? `radio-${generatedId}`;
1315
+ const inputRef = useRef2(null);
1316
+ const [internalChecked, setInternalChecked] = useState3(defaultChecked);
1317
+ const isControlled = checkedProp !== void 0;
1318
+ const checked = isControlled ? checkedProp : internalChecked;
1319
+ const handleChange = (event) => {
1320
+ const newChecked = event.target.checked;
1321
+ if (!isControlled) {
1322
+ setInternalChecked(newChecked);
1323
+ }
1324
+ if (event.target) {
1325
+ event.target.blur();
1326
+ }
1327
+ onChange?.(event);
1328
+ };
1329
+ const currentState = disabled ? "disabled" : state;
1330
+ const sizeClasses = SIZE_CLASSES5[size];
1331
+ const actualRadioSize = sizeClasses.radio;
1332
+ const actualDotSize = sizeClasses.dotSize;
1333
+ const radioVariant = checked ? "checked" : "unchecked";
1334
+ const stylingClasses = STATE_CLASSES2[currentState][radioVariant];
1335
+ const getBorderWidth = () => {
1336
+ if (currentState === "focused") {
1337
+ return "border-2";
1338
+ }
1339
+ return sizeClasses.borderWidth;
1340
+ };
1341
+ const borderWidthClass = getBorderWidth();
1342
+ const radioClasses = cn(
1343
+ BASE_RADIO_CLASSES,
1344
+ actualRadioSize,
1345
+ borderWidthClass,
1346
+ stylingClasses,
1347
+ className
1348
+ );
1349
+ const dotClasses = cn(
1350
+ actualDotSize,
1351
+ "rounded-full",
1352
+ DOT_CLASSES[currentState],
1353
+ "transition-all duration-200"
1354
+ );
1355
+ const isWrapperNeeded = currentState === "focused" || currentState === "invalid";
1356
+ const wrapperBorderColor = currentState === "focused" ? "border-indicator-info" : "border-indicator-error";
1357
+ const getTextColor = () => {
1358
+ if (currentState === "disabled") {
1359
+ return checked ? "text-text-900" : "text-text-600";
1360
+ }
1361
+ if (currentState === "focused") {
1362
+ return "text-text-900";
1363
+ }
1364
+ return checked ? "text-text-900" : "text-text-600";
1365
+ };
1366
+ const getCursorClass = () => {
1367
+ return currentState === "disabled" ? "cursor-not-allowed" : "cursor-pointer";
1368
+ };
1369
+ return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col", children: [
1370
+ /* @__PURE__ */ jsxs7(
1371
+ "div",
1372
+ {
1373
+ className: cn(
1374
+ "flex flex-row items-center",
1375
+ isWrapperNeeded ? cn("p-1 border-2", wrapperBorderColor, "rounded-lg gap-1.5") : sizeClasses.spacing,
1376
+ disabled ? "opacity-40" : ""
1377
+ ),
1378
+ children: [
1379
+ /* @__PURE__ */ jsx9(
1380
+ "input",
1381
+ {
1382
+ ref: (node) => {
1383
+ inputRef.current = node;
1384
+ if (typeof ref === "function") ref(node);
1385
+ else if (ref) ref.current = node;
1386
+ },
1387
+ type: "radio",
1388
+ id: inputId,
1389
+ checked,
1390
+ disabled,
1391
+ name,
1392
+ value,
1393
+ onChange: handleChange,
1394
+ className: "sr-only",
1395
+ style: {
1396
+ position: "absolute",
1397
+ left: "-9999px",
1398
+ visibility: "hidden"
1399
+ },
1400
+ ...props
1401
+ }
1402
+ ),
1403
+ /* @__PURE__ */ jsx9(
1404
+ "button",
1405
+ {
1406
+ type: "button",
1407
+ className: radioClasses,
1408
+ disabled,
1409
+ "aria-pressed": checked,
1410
+ onClick: (e) => {
1411
+ e.preventDefault();
1412
+ if (!disabled) {
1413
+ if (inputRef.current) {
1414
+ inputRef.current.click();
1415
+ inputRef.current.blur();
1416
+ }
1417
+ }
1418
+ },
1419
+ onKeyDown: (e) => {
1420
+ if ((e.key === "Enter" || e.key === " ") && !disabled) {
1421
+ e.preventDefault();
1422
+ if (inputRef.current) {
1423
+ inputRef.current.click();
1424
+ inputRef.current.blur();
1425
+ }
1426
+ }
1427
+ },
1428
+ children: checked && /* @__PURE__ */ jsx9("div", { className: dotClasses })
1429
+ }
1430
+ ),
1431
+ label && /* @__PURE__ */ jsx9(
1432
+ "div",
1433
+ {
1434
+ className: cn(
1435
+ "flex flex-row items-center",
1436
+ sizeClasses.labelHeight,
1437
+ "flex-1 min-w-0"
1438
+ ),
1439
+ children: /* @__PURE__ */ jsx9(
1440
+ Text_default,
1441
+ {
1442
+ as: "label",
1443
+ htmlFor: inputId,
1444
+ size: sizeClasses.textSize,
1445
+ weight: "normal",
1446
+ className: cn(
1447
+ getCursorClass(),
1448
+ "select-none leading-normal flex items-center font-roboto truncate",
1449
+ labelClassName
1450
+ ),
1451
+ color: getTextColor(),
1452
+ children: label
1453
+ }
1454
+ )
1455
+ }
1456
+ )
1457
+ ]
1458
+ }
1459
+ ),
1460
+ errorMessage && /* @__PURE__ */ jsx9(
1461
+ Text_default,
1462
+ {
1463
+ size: "sm",
1464
+ weight: "normal",
1465
+ className: "mt-1.5 truncate",
1466
+ color: "text-error-600",
1467
+ children: errorMessage
1468
+ }
1469
+ ),
1470
+ helperText && !errorMessage && /* @__PURE__ */ jsx9(
1471
+ Text_default,
1472
+ {
1473
+ size: "sm",
1474
+ weight: "normal",
1475
+ className: "mt-1.5 truncate",
1476
+ color: "text-text-500",
1477
+ children: helperText
1478
+ }
1479
+ )
1480
+ ] });
1481
+ }
1482
+ );
1483
+ Radio.displayName = "Radio";
1484
+ var createRadioGroupStore = (name, defaultValue, disabled, onValueChange) => create((set, get) => ({
1485
+ value: defaultValue,
1486
+ setValue: (value) => {
1487
+ if (!get().disabled) {
1488
+ set({ value });
1489
+ get().onValueChange?.(value);
1490
+ }
1491
+ },
1492
+ onValueChange,
1493
+ disabled,
1494
+ name
1495
+ }));
1496
+ var useRadioGroupStore = (externalStore) => {
1497
+ if (!externalStore) {
1498
+ throw new Error("RadioGroupItem must be used within a RadioGroup");
1499
+ }
1500
+ return externalStore;
1501
+ };
1502
+ var injectStore = (children, store) => Children.map(children, (child) => {
1503
+ if (!isValidElement(child)) return child;
1504
+ const typedChild = child;
1505
+ const shouldInject = typedChild.type === RadioGroupItem;
1506
+ return cloneElement(typedChild, {
1507
+ ...shouldInject ? { store } : {},
1508
+ ...typedChild.props.children ? { children: injectStore(typedChild.props.children, store) } : {}
1509
+ });
1510
+ });
1511
+ var RadioGroup = forwardRef3(
1512
+ ({
1513
+ value: propValue,
1514
+ defaultValue = "",
1515
+ onValueChange,
1516
+ name: propName,
1517
+ disabled = false,
1518
+ className = "",
1519
+ children,
1520
+ ...props
1521
+ }, ref) => {
1522
+ const generatedId = useId3();
1523
+ const name = propName || `radio-group-${generatedId}`;
1524
+ const storeRef = useRef2(null);
1525
+ storeRef.current ??= createRadioGroupStore(
1526
+ name,
1527
+ defaultValue,
1528
+ disabled,
1529
+ onValueChange
1530
+ );
1531
+ const store = storeRef.current;
1532
+ const { setValue } = useStore(store, (s) => s);
1533
+ useEffect3(() => {
1534
+ const currentValue = store.getState().value;
1535
+ if (currentValue && onValueChange) {
1536
+ onValueChange(currentValue);
1537
+ }
1538
+ }, []);
1539
+ useEffect3(() => {
1540
+ if (propValue !== void 0) {
1541
+ setValue(propValue);
1542
+ }
1543
+ }, [propValue, setValue]);
1544
+ useEffect3(() => {
1545
+ store.setState({ disabled });
1546
+ }, [disabled, store]);
1547
+ return /* @__PURE__ */ jsx9(
1548
+ "div",
1549
+ {
1550
+ ref,
1551
+ className,
1552
+ role: "radiogroup",
1553
+ "aria-label": name,
1554
+ ...props,
1555
+ children: injectStore(children, store)
1556
+ }
1557
+ );
1558
+ }
1559
+ );
1560
+ RadioGroup.displayName = "RadioGroup";
1561
+ var RadioGroupItem = forwardRef3(
1562
+ ({
1563
+ value,
1564
+ store: externalStore,
1565
+ disabled: itemDisabled,
1566
+ size = "medium",
1567
+ state = "default",
1568
+ className = "",
1569
+ id,
1570
+ ...props
1571
+ }, ref) => {
1572
+ const store = useRadioGroupStore(externalStore);
1573
+ const {
1574
+ value: groupValue,
1575
+ setValue,
1576
+ disabled: groupDisabled,
1577
+ name
1578
+ } = useStore(store);
1579
+ const generatedId = useId3();
1580
+ const inputId = id ?? `radio-item-${generatedId}`;
1581
+ const isChecked = groupValue === value;
1582
+ const isDisabled = groupDisabled || itemDisabled;
1583
+ const currentState = isDisabled ? "disabled" : state;
1584
+ return /* @__PURE__ */ jsx9(
1585
+ Radio,
1586
+ {
1587
+ ref,
1588
+ id: inputId,
1589
+ name,
1590
+ value,
1591
+ checked: isChecked,
1592
+ disabled: isDisabled,
1593
+ size,
1594
+ state: currentState,
1595
+ className,
1596
+ onChange: (e) => {
1597
+ if (e.target.checked && !isDisabled) {
1598
+ setValue(value);
1599
+ }
1600
+ },
1601
+ ...props
1602
+ }
1603
+ );
1604
+ }
1605
+ );
1606
+ RadioGroupItem.displayName = "RadioGroupItem";
1607
+ var Radio_default = Radio;
1608
+
1609
+ // src/components/DropdownMenu/DropdownMenu.tsx
1610
+ import { CaretRight, SignOut, User } from "phosphor-react";
1611
+ import {
1612
+ forwardRef as forwardRef4,
1613
+ useEffect as useEffect6,
1614
+ useRef as useRef3,
1615
+ isValidElement as isValidElement2,
1616
+ Children as Children2,
1617
+ cloneElement as cloneElement2,
1618
+ useState as useState5
1619
+ } from "react";
1620
+ import { create as create3, useStore as useStore2 } from "zustand";
1621
+
1622
+ // src/components/ThemeToggle/ThemeToggle.tsx
1623
+ import { Moon, Sun } from "phosphor-react";
1624
+ import { useState as useState4, useEffect as useEffect5 } from "react";
1625
+
1626
+ // src/hooks/useTheme.ts
1627
+ import { useEffect as useEffect4 } from "react";
1628
+
1629
+ // src/store/themeStore.ts
1630
+ import { create as create2 } from "zustand";
1631
+ import { devtools, persist } from "zustand/middleware";
1632
+ var applyThemeToDOM = (mode) => {
1633
+ const htmlElement = document.documentElement;
1634
+ const originalTheme = htmlElement.getAttribute("data-original-theme");
1635
+ if (mode === "dark") {
1636
+ htmlElement.setAttribute("data-theme", "dark");
1637
+ return true;
1638
+ } else if (mode === "light") {
1639
+ if (originalTheme) {
1640
+ htmlElement.setAttribute("data-theme", originalTheme);
1641
+ }
1642
+ return false;
1643
+ } else if (mode === "system") {
1644
+ const isSystemDark = window.matchMedia(
1645
+ "(prefers-color-scheme: dark)"
1646
+ ).matches;
1647
+ if (isSystemDark) {
1648
+ htmlElement.setAttribute("data-theme", "dark");
1649
+ return true;
1650
+ } else if (originalTheme) {
1651
+ htmlElement.setAttribute("data-theme", originalTheme);
1652
+ return false;
1653
+ }
1654
+ }
1655
+ return false;
1656
+ };
1657
+ var saveOriginalTheme = () => {
1658
+ const htmlElement = document.documentElement;
1659
+ const currentTheme = htmlElement.getAttribute("data-theme");
1660
+ if (currentTheme && !htmlElement.getAttribute("data-original-theme")) {
1661
+ htmlElement.setAttribute("data-original-theme", currentTheme);
1662
+ }
1663
+ };
1664
+ var useThemeStore = create2()(
1665
+ devtools(
1666
+ persist(
1667
+ (set, get) => ({
1668
+ // Initial state
1669
+ themeMode: "system",
1670
+ isDark: false,
1671
+ // Actions
1672
+ applyTheme: (mode) => {
1673
+ const isDark = applyThemeToDOM(mode);
1674
+ set({ isDark });
1675
+ },
1676
+ toggleTheme: () => {
1677
+ const { themeMode, applyTheme } = get();
1678
+ let newMode;
1679
+ if (themeMode === "light") {
1680
+ newMode = "dark";
1681
+ } else if (themeMode === "dark") {
1682
+ newMode = "light";
1683
+ } else {
1684
+ newMode = "dark";
1685
+ }
1686
+ set({ themeMode: newMode });
1687
+ applyTheme(newMode);
1688
+ },
1689
+ setTheme: (mode) => {
1690
+ const { applyTheme } = get();
1691
+ set({ themeMode: mode });
1692
+ applyTheme(mode);
1693
+ },
1694
+ initializeTheme: () => {
1695
+ const { themeMode, applyTheme } = get();
1696
+ saveOriginalTheme();
1697
+ applyTheme(themeMode);
1698
+ },
1699
+ handleSystemThemeChange: () => {
1700
+ const { themeMode, applyTheme } = get();
1701
+ if (themeMode === "system") {
1702
+ applyTheme("system");
1703
+ }
1704
+ }
1705
+ }),
1706
+ {
1707
+ name: "theme-store",
1708
+ // Nome da chave no localStorage
1709
+ partialize: (state) => ({
1710
+ themeMode: state.themeMode
1711
+ })
1712
+ // Só persiste o themeMode, não o isDark
1713
+ }
1714
+ ),
1715
+ {
1716
+ name: "theme-store"
1717
+ }
1718
+ )
1719
+ );
1720
+
1721
+ // src/hooks/useTheme.ts
1722
+ var useTheme = () => {
1723
+ const {
1724
+ themeMode,
1725
+ isDark,
1726
+ toggleTheme,
1727
+ setTheme,
1728
+ initializeTheme,
1729
+ handleSystemThemeChange
1730
+ } = useThemeStore();
1731
+ useEffect4(() => {
1732
+ initializeTheme();
1733
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
1734
+ mediaQuery.addEventListener("change", handleSystemThemeChange);
1735
+ return () => {
1736
+ mediaQuery.removeEventListener("change", handleSystemThemeChange);
1737
+ };
1738
+ }, [initializeTheme, handleSystemThemeChange]);
1739
+ return {
1740
+ themeMode,
1741
+ isDark,
1742
+ toggleTheme,
1743
+ setTheme
1744
+ };
1745
+ };
1746
+
1747
+ // src/components/ThemeToggle/ThemeToggle.tsx
1748
+ import { jsx as jsx10 } from "react/jsx-runtime";
1749
+ var ThemeToggle = ({
1750
+ variant = "default",
1751
+ onToggle
1752
+ }) => {
1753
+ const { themeMode, setTheme } = useTheme();
1754
+ const [tempTheme, setTempTheme] = useState4(themeMode);
1755
+ useEffect5(() => {
1756
+ setTempTheme(themeMode);
1757
+ }, [themeMode]);
1758
+ const problemTypes = [
1759
+ {
1760
+ id: "light",
1761
+ title: "Claro",
1762
+ icon: /* @__PURE__ */ jsx10(Sun, { size: 24 })
1763
+ },
1764
+ {
1765
+ id: "dark",
1766
+ title: "Escuro",
1767
+ icon: /* @__PURE__ */ jsx10(Moon, { size: 24 })
1768
+ },
1769
+ {
1770
+ id: "system",
1771
+ title: "Sistema",
1772
+ icon: /* @__PURE__ */ jsx10(
1773
+ "svg",
1774
+ {
1775
+ width: "25",
1776
+ height: "25",
1777
+ viewBox: "0 0 25 25",
1778
+ fill: "none",
1779
+ xmlns: "http://www.w3.org/2000/svg",
1780
+ children: /* @__PURE__ */ jsx10(
1781
+ "path",
1782
+ {
1783
+ d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
1784
+ fill: "#525252"
1785
+ }
1786
+ )
1787
+ }
1788
+ )
1789
+ }
1790
+ ];
1791
+ const handleThemeSelect = (selectedTheme) => {
1792
+ if (variant === "with-save") {
1793
+ setTempTheme(selectedTheme);
1794
+ } else {
1795
+ setTheme(selectedTheme);
1796
+ }
1797
+ if (onToggle) {
1798
+ onToggle(selectedTheme);
1799
+ }
1800
+ };
1801
+ const currentTheme = variant === "with-save" ? tempTheme : themeMode;
1802
+ return /* @__PURE__ */ jsx10("div", { className: "flex flex-row gap-2 sm:gap-4 py-2", children: problemTypes.map((type) => /* @__PURE__ */ jsx10(
1803
+ SelectionButton_default,
1804
+ {
1805
+ icon: type.icon,
1806
+ label: type.title,
1807
+ selected: currentTheme === type.id,
1808
+ onClick: () => handleThemeSelect(type.id),
1809
+ className: "w-full p-2 sm:p-4"
1810
+ },
1811
+ type.id
1812
+ )) });
1813
+ };
1814
+
1815
+ // src/components/DropdownMenu/DropdownMenu.tsx
1816
+ import { Fragment, jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
1817
+ function createDropdownStore() {
1818
+ return create3((set) => ({
1819
+ open: false,
1820
+ setOpen: (open) => set({ open })
1821
+ }));
1822
+ }
1823
+ var useDropdownStore = (externalStore) => {
1824
+ if (!externalStore) {
1825
+ throw new Error(
1826
+ "Component must be used within a DropdownMenu (store is missing)"
1827
+ );
1828
+ }
1829
+ return externalStore;
1830
+ };
1831
+ var injectStore2 = (children, store) => {
1832
+ return Children2.map(children, (child) => {
1833
+ if (isValidElement2(child)) {
1834
+ const typedChild = child;
1835
+ const displayName = typedChild.type.displayName;
1836
+ const allowed = [
1837
+ "DropdownMenuTrigger",
1838
+ "DropdownContent",
1839
+ "DropdownMenuContent",
1840
+ "DropdownMenuSeparator",
1841
+ "DropdownMenuItem",
1842
+ "MenuLabel",
1843
+ "ProfileMenuTrigger",
1844
+ "ProfileMenuHeader",
1845
+ "ProfileMenuFooter",
1846
+ "ProfileToggleTheme"
1847
+ ];
1848
+ let newProps = {};
1849
+ if (allowed.includes(displayName)) {
1850
+ newProps.store = store;
1851
+ }
1852
+ if (typedChild.props.children) {
1853
+ newProps.children = injectStore2(typedChild.props.children, store);
1854
+ }
1855
+ return cloneElement2(typedChild, newProps);
1856
+ }
1857
+ return child;
1858
+ });
1859
+ };
1860
+ var DropdownMenu = ({
1861
+ children,
1862
+ open: propOpen,
1863
+ onOpenChange
1864
+ }) => {
1865
+ const storeRef = useRef3(null);
1866
+ storeRef.current ??= createDropdownStore();
1867
+ const store = storeRef.current;
1868
+ const { open, setOpen: storeSetOpen } = useStore2(store, (s) => s);
1869
+ const setOpen = (newOpen) => {
1870
+ storeSetOpen(newOpen);
1871
+ };
1872
+ const menuRef = useRef3(null);
1873
+ const handleArrowDownOrArrowUp = (event) => {
1874
+ const menuContent = menuRef.current?.querySelector('[role="menu"]');
1875
+ if (menuContent) {
1876
+ event.preventDefault();
1877
+ const items = Array.from(
1878
+ menuContent.querySelectorAll(
1879
+ '[role="menuitem"]:not([aria-disabled="true"])'
1880
+ )
1881
+ ).filter((el) => el instanceof HTMLElement);
1882
+ if (items.length === 0) return;
1883
+ const focusedItem = document.activeElement;
1884
+ const currentIndex = items.findIndex((item) => item === focusedItem);
1885
+ let nextIndex;
1886
+ if (event.key === "ArrowDown") {
1887
+ nextIndex = currentIndex === -1 ? 0 : (currentIndex + 1) % items.length;
1888
+ } else {
1889
+ nextIndex = currentIndex === -1 ? items.length - 1 : (currentIndex - 1 + items.length) % items.length;
1890
+ }
1891
+ items[nextIndex]?.focus();
1892
+ }
1893
+ };
1894
+ const handleDownkey = (event) => {
1895
+ if (event.key === "Escape") {
1896
+ setOpen(false);
1897
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
1898
+ handleArrowDownOrArrowUp(event);
1899
+ }
1900
+ };
1901
+ const handleClickOutside = (event) => {
1902
+ if (menuRef.current && !menuRef.current.contains(event.target)) {
1903
+ setOpen(false);
1904
+ }
1905
+ };
1906
+ useEffect6(() => {
1907
+ if (open) {
1908
+ document.addEventListener("pointerdown", handleClickOutside);
1909
+ document.addEventListener("keydown", handleDownkey);
1910
+ }
1911
+ return () => {
1912
+ document.removeEventListener("pointerdown", handleClickOutside);
1913
+ document.removeEventListener("keydown", handleDownkey);
1914
+ };
1915
+ }, [open]);
1916
+ useEffect6(() => {
1917
+ onOpenChange?.(open);
1918
+ }, [open, onOpenChange]);
1919
+ useEffect6(() => {
1920
+ if (propOpen !== void 0) {
1921
+ setOpen(propOpen);
1922
+ }
1923
+ }, [propOpen]);
1924
+ return /* @__PURE__ */ jsx11("div", { className: "relative", ref: menuRef, children: injectStore2(children, store) });
1925
+ };
1926
+ var DropdownMenuTrigger = ({
1927
+ className,
1928
+ children,
1929
+ onClick,
1930
+ store: externalStore,
1931
+ ...props
1932
+ }) => {
1933
+ const store = useDropdownStore(externalStore);
1934
+ const open = useStore2(store, (s) => s.open);
1935
+ const toggleOpen = () => store.setState({ open: !open });
1936
+ return /* @__PURE__ */ jsx11(
1937
+ "div",
1938
+ {
1939
+ onClick: (e) => {
1940
+ e.stopPropagation();
1941
+ toggleOpen();
1942
+ if (onClick) onClick(e);
1943
+ },
1944
+ role: "button",
1945
+ onKeyDown: (e) => {
1946
+ if (e.key === "Enter" || e.key === " ") {
1947
+ e.preventDefault();
1948
+ toggleOpen();
1949
+ if (onClick) onClick(e);
1950
+ }
1951
+ },
1952
+ tabIndex: 0,
1953
+ "aria-expanded": open,
1954
+ className: cn(className),
1955
+ ...props,
1956
+ children
1957
+ }
1958
+ );
1959
+ };
1960
+ DropdownMenuTrigger.displayName = "DropdownMenuTrigger";
1961
+ var ITEM_SIZE_CLASSES = {
1962
+ small: "text-sm",
1963
+ medium: "text-md"
1964
+ };
1965
+ var SIDE_CLASSES = {
1966
+ top: "bottom-full",
1967
+ right: "top-full",
1968
+ bottom: "top-full",
1969
+ left: "top-full"
1970
+ };
1971
+ var ALIGN_CLASSES = {
1972
+ start: "left-0",
1973
+ center: "left-1/2 -translate-x-1/2",
1974
+ end: "right-0"
1975
+ };
1976
+ var MENUCONTENT_VARIANT_CLASSES = {
1977
+ menu: "p-1",
1978
+ profile: "p-6"
1979
+ };
1980
+ var MenuLabel = forwardRef4(({ className, inset, store: _store, ...props }, ref) => {
1981
+ return /* @__PURE__ */ jsx11(
1982
+ "div",
1983
+ {
1984
+ ref,
1985
+ className: cn("text-sm w-full", inset ? "pl-8" : "", className),
1986
+ ...props
1987
+ }
1988
+ );
1989
+ });
1990
+ MenuLabel.displayName = "MenuLabel";
1991
+ var DropdownMenuContent = forwardRef4(
1992
+ ({
1993
+ className,
1994
+ align = "start",
1995
+ side = "bottom",
1996
+ variant = "menu",
1997
+ sideOffset = 4,
1998
+ children,
1999
+ store: externalStore,
2000
+ ...props
2001
+ }, ref) => {
2002
+ const store = useDropdownStore(externalStore);
2003
+ const open = useStore2(store, (s) => s.open);
2004
+ const [isVisible, setIsVisible] = useState5(open);
2005
+ useEffect6(() => {
2006
+ if (open) {
2007
+ setIsVisible(true);
2008
+ } else {
2009
+ const timer = setTimeout(() => setIsVisible(false), 200);
2010
+ return () => clearTimeout(timer);
2011
+ }
2012
+ }, [open]);
2013
+ if (!isVisible) return null;
2014
+ const getPositionClasses = () => {
2015
+ const vertical = SIDE_CLASSES[side];
2016
+ const horizontal = ALIGN_CLASSES[align];
2017
+ return `absolute ${vertical} ${horizontal}`;
2018
+ };
2019
+ const variantClasses = MENUCONTENT_VARIANT_CLASSES[variant];
2020
+ return /* @__PURE__ */ jsx11(
2021
+ "div",
2022
+ {
2023
+ ref,
2024
+ role: "menu",
2025
+ className: `
2026
+ bg-background z-50 min-w-[210px] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md border-border-100
2027
+ ${open ? "animate-in fade-in-0 zoom-in-95" : "animate-out fade-out-0 zoom-out-95"}
2028
+ ${getPositionClasses()}
2029
+ ${variantClasses}
2030
+ ${className}
2031
+ `,
2032
+ style: {
2033
+ marginTop: side === "bottom" ? sideOffset : void 0,
2034
+ marginBottom: side === "top" ? sideOffset : void 0,
2035
+ marginLeft: side === "right" ? sideOffset : void 0,
2036
+ marginRight: side === "left" ? sideOffset : void 0
2037
+ },
2038
+ ...props,
2039
+ children
2040
+ }
2041
+ );
2042
+ }
2043
+ );
2044
+ DropdownMenuContent.displayName = "DropdownMenuContent";
2045
+ var DropdownMenuItem = forwardRef4(
2046
+ ({
2047
+ className,
2048
+ size = "small",
2049
+ children,
2050
+ iconRight,
2051
+ iconLeft,
2052
+ disabled = false,
2053
+ onClick,
2054
+ variant = "menu",
2055
+ store: externalStore,
2056
+ preventClose = false,
2057
+ ...props
2058
+ }, ref) => {
2059
+ const store = useDropdownStore(externalStore);
2060
+ const setOpen = useStore2(store, (s) => s.setOpen);
2061
+ const sizeClasses = ITEM_SIZE_CLASSES[size];
2062
+ const handleClick = (e) => {
2063
+ if (disabled) {
2064
+ e.preventDefault();
2065
+ e.stopPropagation();
2066
+ return;
2067
+ }
2068
+ if (e.type === "click") {
2069
+ onClick?.(e);
2070
+ } else if (e.type === "keydown") {
2071
+ if (e.key === "Enter" || e.key === " ") {
2072
+ onClick?.(e);
2073
+ }
2074
+ props.onKeyDown?.(e);
2075
+ }
2076
+ if (!preventClose) {
2077
+ setOpen(false);
2078
+ }
2079
+ };
2080
+ const getVariantClasses = () => {
2081
+ if (variant === "profile") {
2082
+ return "relative flex flex-row justify-between select-none items-center gap-2 rounded-sm p-4 text-sm outline-none transition-colors [&>svg]:size-6 [&>svg]:shrink-0";
2083
+ }
2084
+ return "relative flex select-none items-center gap-2 rounded-sm p-3 text-sm outline-none transition-colors [&>svg]:size-4 [&>svg]:shrink-0";
2085
+ };
2086
+ const getVariantProps = () => {
2087
+ return variant === "profile" ? { "data-variant": "profile" } : {};
2088
+ };
2089
+ return /* @__PURE__ */ jsxs8(
2090
+ "div",
2091
+ {
2092
+ ref,
2093
+ role: "menuitem",
2094
+ ...getVariantProps(),
2095
+ "aria-disabled": disabled,
2096
+ className: `
2097
+ focus-visible:bg-background-50
2098
+ ${getVariantClasses()}
2099
+ ${sizeClasses}
2100
+ ${className}
2101
+ ${disabled ? "cursor-not-allowed text-text-400" : "cursor-pointer hover:bg-background-50 text-text-700 focus:bg-accent focus:text-accent-foreground hover:bg-accent hover:text-accent-foreground"}
2102
+ `,
2103
+ onClick: handleClick,
2104
+ onKeyDown: (e) => {
2105
+ if (e.key === "Enter" || e.key === " ") {
2106
+ e.preventDefault();
2107
+ e.stopPropagation();
2108
+ handleClick(e);
2109
+ }
2110
+ },
2111
+ tabIndex: disabled ? -1 : 0,
2112
+ ...props,
2113
+ children: [
2114
+ iconLeft,
2115
+ /* @__PURE__ */ jsx11("div", { className: "w-full", children }),
2116
+ iconRight
2117
+ ]
2118
+ }
2119
+ );
2120
+ }
2121
+ );
2122
+ DropdownMenuItem.displayName = "DropdownMenuItem";
2123
+ var DropdownMenuSeparator = forwardRef4(({ className, store: _store, ...props }, ref) => /* @__PURE__ */ jsx11(
2124
+ "div",
2125
+ {
2126
+ ref,
2127
+ className: cn("my-1 h-px bg-border-200", className),
2128
+ ...props
2129
+ }
2130
+ ));
2131
+ DropdownMenuSeparator.displayName = "DropdownMenuSeparator";
2132
+ var ProfileMenuTrigger = forwardRef4(({ className, onClick, store: externalStore, ...props }, ref) => {
2133
+ const store = useDropdownStore(externalStore);
2134
+ const open = useStore2(store, (s) => s.open);
2135
+ const toggleOpen = () => store.setState({ open: !open });
2136
+ return /* @__PURE__ */ jsx11(
2137
+ "button",
2138
+ {
2139
+ ref,
2140
+ className: cn(
2141
+ "rounded-lg size-10 bg-primary-50 flex items-center justify-center cursor-pointer",
2142
+ className
2143
+ ),
2144
+ onClick: (e) => {
2145
+ e.stopPropagation();
2146
+ toggleOpen();
2147
+ onClick?.(e);
2148
+ },
2149
+ "aria-expanded": open,
2150
+ ...props,
2151
+ children: /* @__PURE__ */ jsx11("span", { className: "size-6 rounded-full bg-primary-100 flex items-center justify-center", children: /* @__PURE__ */ jsx11(User, { className: "text-primary-950", size: 18 }) })
2152
+ }
2153
+ );
2154
+ });
2155
+ ProfileMenuTrigger.displayName = "ProfileMenuTrigger";
2156
+ var ProfileMenuHeader = forwardRef4(({ className, name, email, photoUrl, store: _store, ...props }, ref) => {
2157
+ return /* @__PURE__ */ jsxs8(
2158
+ "div",
2159
+ {
2160
+ ref,
2161
+ "data-component": "ProfileMenuHeader",
2162
+ className: cn(
2163
+ "flex flex-row gap-4 items-center min-w-[280px]",
2164
+ className
2165
+ ),
2166
+ ...props,
2167
+ children: [
2168
+ /* @__PURE__ */ jsx11("span", { className: "w-16 h-16 bg-primary-100 rounded-full flex items-center justify-center overflow-hidden flex-shrink-0", children: photoUrl ? /* @__PURE__ */ jsx11(
2169
+ "img",
2170
+ {
2171
+ src: photoUrl,
2172
+ alt: "Foto de perfil",
2173
+ className: "w-full h-full object-cover"
2174
+ }
2175
+ ) : /* @__PURE__ */ jsx11(User, { size: 34, className: "text-primary-800" }) }),
2176
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col min-w-0", children: [
2177
+ /* @__PURE__ */ jsx11(
2178
+ Text_default,
2179
+ {
2180
+ size: "xl",
2181
+ weight: "bold",
2182
+ color: "text-text-950",
2183
+ className: "truncate",
2184
+ children: name
2185
+ }
2186
+ ),
2187
+ /* @__PURE__ */ jsx11(Text_default, { size: "md", color: "text-text-600", className: "truncate", children: email })
2188
+ ] })
2189
+ ]
2190
+ }
2191
+ );
2192
+ });
2193
+ ProfileMenuHeader.displayName = "ProfileMenuHeader";
2194
+ var ProfileMenuInfo = forwardRef4(
2195
+ ({
2196
+ className,
2197
+ schoolName,
2198
+ classYearName,
2199
+ schoolYearName,
2200
+ store: _store,
2201
+ ...props
2202
+ }, ref) => {
2203
+ return /* @__PURE__ */ jsxs8(
2204
+ "div",
2205
+ {
2206
+ ref,
2207
+ "data-component": "ProfileMenuInfo",
2208
+ className: cn("flex flex-row gap-4 items-center", className),
2209
+ ...props,
2210
+ children: [
2211
+ /* @__PURE__ */ jsx11("span", { className: "w-16 h-16" }),
2212
+ /* @__PURE__ */ jsxs8("div", { className: "flex flex-col ", children: [
2213
+ /* @__PURE__ */ jsx11(Text_default, { size: "md", color: "text-text-600", children: schoolName }),
2214
+ /* @__PURE__ */ jsxs8("span", { className: "flex flex-row items-center gap-2", children: [
2215
+ /* @__PURE__ */ jsx11(Text_default, { size: "md", color: "text-text-600", children: classYearName }),
2216
+ /* @__PURE__ */ jsx11("p", { className: "text-text-600 text-xs align-middle", children: "\u25CF" }),
2217
+ /* @__PURE__ */ jsx11(Text_default, { size: "md", color: "text-text-600", children: schoolYearName })
2218
+ ] })
2219
+ ] })
2220
+ ]
2221
+ }
2222
+ );
2223
+ }
2224
+ );
2225
+ ProfileMenuInfo.displayName = "ProfileMenuInfo";
2226
+ var ProfileToggleTheme = ({
2227
+ store: externalStore,
2228
+ ...props
2229
+ }) => {
2230
+ const { themeMode, setTheme } = useTheme();
2231
+ const [modalThemeToggle, setModalThemeToggle] = useState5(false);
2232
+ const [selectedTheme, setSelectedTheme] = useState5(themeMode);
2233
+ const internalStoreRef = useRef3(null);
2234
+ internalStoreRef.current ??= createDropdownStore();
2235
+ const store = externalStore ?? internalStoreRef.current;
2236
+ const setOpen = useStore2(store, (s) => s.setOpen);
2237
+ const handleClick = (e) => {
2238
+ e.preventDefault();
2239
+ e.stopPropagation();
2240
+ setModalThemeToggle(true);
2241
+ };
2242
+ const handleSave = () => {
2243
+ setTheme(selectedTheme);
2244
+ setModalThemeToggle(false);
2245
+ setOpen(false);
2246
+ };
2247
+ const handleCancel = () => {
2248
+ setSelectedTheme(themeMode);
2249
+ setModalThemeToggle(false);
2250
+ setOpen(false);
2251
+ };
2252
+ return /* @__PURE__ */ jsxs8(Fragment, { children: [
2253
+ /* @__PURE__ */ jsx11(
2254
+ DropdownMenuItem,
2255
+ {
2256
+ variant: "profile",
2257
+ preventClose: true,
2258
+ store,
2259
+ iconLeft: /* @__PURE__ */ jsx11(
2260
+ "svg",
2261
+ {
2262
+ width: "24",
2263
+ height: "24",
2264
+ viewBox: "0 0 25 25",
2265
+ fill: "none",
2266
+ xmlns: "http://www.w3.org/2000/svg",
2267
+ children: /* @__PURE__ */ jsx11(
2268
+ "path",
2269
+ {
2270
+ d: "M12.5 2.75C15.085 2.75276 17.5637 3.78054 19.3916 5.6084C21.2195 7.43628 22.2473 9.915 22.25 12.5C22.25 14.4284 21.6778 16.3136 20.6064 17.917C19.5352 19.5201 18.0128 20.7699 16.2314 21.5078C14.4499 22.2458 12.489 22.4387 10.5977 22.0625C8.70642 21.6863 6.96899 20.758 5.60547 19.3945C4.24197 18.031 3.31374 16.2936 2.9375 14.4023C2.56129 12.511 2.75423 10.5501 3.49219 8.76855C4.23012 6.98718 5.47982 5.46483 7.08301 4.39355C8.68639 3.32221 10.5716 2.75 12.5 2.75ZM11.75 4.28516C9.70145 4.47452 7.7973 5.42115 6.41016 6.94043C5.02299 8.4599 4.25247 10.4426 4.25 12.5C4.25247 14.5574 5.02299 16.5401 6.41016 18.0596C7.7973 19.5789 9.70145 20.5255 11.75 20.7148V4.28516Z",
2271
+ fill: "currentColor"
2272
+ }
2273
+ )
2274
+ }
2275
+ ),
2276
+ iconRight: /* @__PURE__ */ jsx11(CaretRight, {}),
2277
+ onClick: handleClick,
2278
+ onKeyDown: (e) => {
2279
+ if (e.key === "Enter" || e.key === " ") {
2280
+ e.preventDefault();
2281
+ e.stopPropagation();
2282
+ setModalThemeToggle(true);
2283
+ }
2284
+ },
2285
+ ...props,
2286
+ children: /* @__PURE__ */ jsx11(Text_default, { size: "md", color: "text-text-700", children: "Apar\xEAncia" })
2287
+ }
2288
+ ),
2289
+ /* @__PURE__ */ jsx11(
2290
+ Modal_default,
2291
+ {
2292
+ isOpen: modalThemeToggle,
2293
+ onClose: handleCancel,
2294
+ title: "Apar\xEAncia",
2295
+ size: "md",
2296
+ footer: /* @__PURE__ */ jsxs8("div", { className: "flex gap-3", children: [
2297
+ /* @__PURE__ */ jsx11(Button_default, { variant: "outline", onClick: handleCancel, children: "Cancelar" }),
2298
+ /* @__PURE__ */ jsx11(Button_default, { variant: "solid", onClick: handleSave, children: "Salvar" })
2299
+ ] }),
2300
+ children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col", children: [
2301
+ /* @__PURE__ */ jsx11("p", { className: "text-sm text-text-500", children: "Escolha o tema:" }),
2302
+ /* @__PURE__ */ jsx11(ThemeToggle, { variant: "with-save", onToggle: setSelectedTheme })
2303
+ ] })
2304
+ }
2305
+ )
2306
+ ] });
2307
+ };
2308
+ ProfileToggleTheme.displayName = "ProfileToggleTheme";
2309
+ var ProfileMenuSection = forwardRef4(({ className, children, store: _store, ...props }, ref) => {
2310
+ return /* @__PURE__ */ jsx11("div", { ref, className: cn("flex flex-col p-2", className), ...props, children });
2311
+ });
2312
+ ProfileMenuSection.displayName = "ProfileMenuSection";
2313
+ var ProfileMenuFooter = ({
2314
+ className,
2315
+ disabled = false,
2316
+ onClick,
2317
+ store: externalStore,
2318
+ ...props
2319
+ }) => {
2320
+ const store = useDropdownStore(externalStore);
2321
+ const setOpen = useStore2(store, (s) => s.setOpen);
2322
+ return /* @__PURE__ */ jsxs8(
2323
+ Button_default,
2324
+ {
2325
+ variant: "outline",
2326
+ className: cn("w-full", className),
2327
+ disabled,
2328
+ onClick: (e) => {
2329
+ setOpen(false);
2330
+ onClick?.(e);
2331
+ },
2332
+ ...props,
2333
+ children: [
2334
+ /* @__PURE__ */ jsx11("span", { className: "mr-2 flex items-center", children: /* @__PURE__ */ jsx11(SignOut, { className: "text-inherit" }) }),
2335
+ /* @__PURE__ */ jsx11(Text_default, { color: "inherit", children: "Sair" })
2336
+ ]
2337
+ }
2338
+ );
2339
+ };
2340
+ ProfileMenuFooter.displayName = "ProfileMenuFooter";
2341
+ var DropdownMenu_default = DropdownMenu;
2342
+
2343
+ // src/components/Chips/Chips.tsx
2344
+ import { Check as Check2 } from "phosphor-react";
2345
+ import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
2346
+ var STATE_CLASSES3 = {
2347
+ default: "bg-background text-text-950 border border-border-100 hover:bg-secondary-50 hover:border-border-300",
2348
+ selected: "bg-info-background text-primary-950 border-2 border-primary-950 hover:bg-secondary-50 focus-visible:border-0"
2349
+ };
2350
+ var Chips = ({
2351
+ children,
2352
+ selected = false,
2353
+ className = "",
2354
+ disabled,
2355
+ type = "button",
2356
+ ...props
2357
+ }) => {
2358
+ const stateClasses = selected ? STATE_CLASSES3.selected : STATE_CLASSES3.default;
2359
+ const baseClasses = "inline-flex items-center justify-center rounded-full cursor-pointer font-normal text-sm px-4 py-2 gap-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-0 focus-visible:ring-primary-600 disabled:opacity-40 disabled:cursor-not-allowed";
2360
+ return /* @__PURE__ */ jsxs9(
2361
+ "button",
2362
+ {
2363
+ className: cn(baseClasses, stateClasses, className),
2364
+ disabled,
2365
+ type,
2366
+ ...props,
2367
+ children: [
2368
+ selected && /* @__PURE__ */ jsx12("span", { className: `flex items-center`, children: /* @__PURE__ */ jsx12(Check2, { weight: "bold", size: 16 }) }),
2369
+ /* @__PURE__ */ jsx12("span", { className: "flex-1", children })
2370
+ ]
2371
+ }
2372
+ );
2373
+ };
2374
+ var Chips_default = Chips;
2375
+
2376
+ // src/components/ProgressBar/ProgressBar.tsx
2377
+ import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
2378
+ var SIZE_CLASSES6 = {
2379
+ small: {
2380
+ container: "h-1",
2381
+ // 4px height (h-1 = 4px in Tailwind)
2382
+ bar: "h-1",
2383
+ // 4px height for the fill bar
2384
+ spacing: "gap-2",
2385
+ // 8px gap between label and progress bar
2386
+ layout: "flex-col",
2387
+ // vertical layout for small
2388
+ borderRadius: "rounded-full"
2389
+ // 9999px border radius
2390
+ },
2391
+ medium: {
2392
+ container: "h-2",
2393
+ // 8px height (h-2 = 8px in Tailwind)
2394
+ bar: "h-2",
2395
+ // 8px height for the fill bar
2396
+ spacing: "gap-2",
2397
+ // 8px gap between progress bar and label
2398
+ layout: "flex-row items-center",
2399
+ // horizontal layout for medium
2400
+ borderRadius: "rounded-lg"
2401
+ // 8px border radius
2402
+ }
2403
+ };
2404
+ var VARIANT_CLASSES = {
2405
+ blue: {
2406
+ background: "bg-background-300",
2407
+ // Background track color (#D5D4D4)
2408
+ fill: "bg-primary-700"
2409
+ // Blue for activity progress (#2271C4)
2410
+ },
2411
+ green: {
2412
+ background: "bg-background-300",
2413
+ // Background track color (#D5D4D4)
2414
+ fill: "bg-success-200"
2415
+ // Green for performance (#84D3A2)
2416
+ }
2417
+ };
2418
+ var calculateProgressValues = (value, max) => {
2419
+ const safeValue = isNaN(value) ? 0 : value;
2420
+ const clampedValue = Math.max(0, Math.min(safeValue, max));
2421
+ const percentage = max === 0 ? 0 : clampedValue / max * 100;
2422
+ return { clampedValue, percentage };
2423
+ };
2424
+ var shouldShowHeader = (label, showPercentage, showHitCount) => {
2425
+ return !!(label || showPercentage || showHitCount);
2426
+ };
2427
+ var getDisplayPriority = (showHitCount, showPercentage, label, clampedValue, max, percentage) => {
2428
+ if (showHitCount) {
2429
+ return {
2430
+ type: "hitCount",
2431
+ content: `${Math.round(clampedValue)} de ${max}`,
2432
+ hasMetrics: true
2433
+ };
2434
+ }
2435
+ if (showPercentage) {
2436
+ return {
2437
+ type: "percentage",
2438
+ content: `${Math.round(percentage)}%`,
2439
+ hasMetrics: true
2440
+ };
2441
+ }
2442
+ return {
2443
+ type: "label",
2444
+ content: label,
2445
+ hasMetrics: false
2446
+ };
2447
+ };
2448
+ var getCompactLayoutConfig = ({
2449
+ showPercentage,
2450
+ showHitCount,
2451
+ percentage,
2452
+ clampedValue,
2453
+ max,
2454
+ label,
2455
+ percentageClassName,
2456
+ labelClassName
2457
+ }) => {
2458
+ const displayPriority = getDisplayPriority(
2459
+ showHitCount,
2460
+ showPercentage,
2461
+ label,
2462
+ clampedValue,
2463
+ max,
2464
+ percentage
2465
+ );
2466
+ return {
2467
+ color: displayPriority.hasMetrics ? "text-primary-600" : "text-primary-700",
2468
+ className: displayPriority.hasMetrics ? percentageClassName : labelClassName,
2469
+ content: displayPriority.content
2470
+ };
2471
+ };
2472
+ var getDefaultLayoutDisplayConfig = (size, label, showPercentage) => ({
2473
+ showHeader: size === "small" && !!(label || showPercentage),
2474
+ showPercentage: size === "medium" && showPercentage,
2475
+ showLabel: size === "medium" && !!label && !showPercentage
2476
+ // Only show label when percentage is not shown
2477
+ });
2478
+ var renderStackedHitCountDisplay = (showHitCount, showPercentage, clampedValue, max, percentage, percentageClassName) => {
2479
+ if (!showHitCount && !showPercentage) return null;
2480
+ const displayPriority = getDisplayPriority(
2481
+ showHitCount,
2482
+ showPercentage,
2483
+ null,
2484
+ // label is not relevant for stacked layout metrics display
2485
+ clampedValue,
2486
+ max,
2487
+ percentage
2488
+ );
2489
+ return /* @__PURE__ */ jsx13(
2490
+ "div",
2491
+ {
2492
+ className: cn(
2493
+ "text-xs font-medium leading-[14px] text-right",
2494
+ percentageClassName
2495
+ ),
2496
+ children: displayPriority.type === "hitCount" ? /* @__PURE__ */ jsxs10(Fragment2, { children: [
2497
+ /* @__PURE__ */ jsx13("span", { className: "text-success-200", children: Math.round(clampedValue) }),
2498
+ /* @__PURE__ */ jsxs10("span", { className: "text-text-600", children: [
2499
+ " de ",
2500
+ max
2501
+ ] })
2502
+ ] }) : /* @__PURE__ */ jsxs10(Text_default, { size: "xs", weight: "medium", className: "text-success-200", children: [
2503
+ Math.round(percentage),
2504
+ "%"
2505
+ ] })
2506
+ }
2507
+ );
2508
+ };
2509
+ var ProgressBarBase = ({
2510
+ clampedValue,
2511
+ max,
2512
+ percentage,
2513
+ label,
2514
+ variantClasses,
2515
+ containerClassName,
2516
+ fillClassName
2517
+ }) => /* @__PURE__ */ jsxs10(
2518
+ "div",
2519
+ {
2520
+ className: cn(
2521
+ containerClassName,
2522
+ variantClasses.background,
2523
+ "overflow-hidden relative"
2524
+ ),
2525
+ children: [
2526
+ /* @__PURE__ */ jsx13(
2527
+ "progress",
2528
+ {
2529
+ value: clampedValue,
2530
+ max,
2531
+ "aria-label": typeof label === "string" ? `${label}: ${Math.round(percentage)}% complete` : `Progress: ${Math.round(percentage)}% of ${max}`,
2532
+ className: "absolute inset-0 w-full h-full opacity-0"
2533
+ }
2534
+ ),
2535
+ /* @__PURE__ */ jsx13(
2536
+ "div",
2537
+ {
2538
+ className: cn(
2539
+ fillClassName,
2540
+ variantClasses.fill,
2541
+ "transition-all duration-300 ease-out"
2542
+ ),
2543
+ style: { width: `${percentage}%` }
2544
+ }
2545
+ )
2546
+ ]
2547
+ }
2548
+ );
2549
+ var StackedLayout = ({
2550
+ className,
2551
+ label,
2552
+ showPercentage,
2553
+ showHitCount,
2554
+ labelClassName,
2555
+ percentageClassName,
2556
+ clampedValue,
2557
+ max,
2558
+ percentage,
2559
+ variantClasses,
2560
+ dimensions
2561
+ }) => /* @__PURE__ */ jsxs10(
2562
+ "div",
2563
+ {
2564
+ className: cn(
2565
+ "flex flex-col items-start gap-2",
2566
+ dimensions.width,
2567
+ dimensions.height,
2568
+ className
2569
+ ),
2570
+ children: [
2571
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsxs10("div", { className: "flex flex-row justify-between items-center w-full h-[19px]", children: [
2572
+ label && /* @__PURE__ */ jsx13(
2573
+ Text_default,
2574
+ {
2575
+ as: "div",
2576
+ size: "md",
2577
+ weight: "medium",
2578
+ className: cn("text-text-600 leading-[19px]", labelClassName),
2579
+ children: label
2580
+ }
2581
+ ),
2582
+ renderStackedHitCountDisplay(
2583
+ showHitCount,
2584
+ showPercentage,
2585
+ clampedValue,
2586
+ max,
2587
+ percentage,
2588
+ percentageClassName
2589
+ )
2590
+ ] }),
2591
+ /* @__PURE__ */ jsx13(
2592
+ ProgressBarBase,
2593
+ {
2594
+ clampedValue,
2595
+ max,
2596
+ percentage,
2597
+ label,
2598
+ variantClasses,
2599
+ containerClassName: "w-full h-2 rounded-lg",
2600
+ fillClassName: "h-2 rounded-lg shadow-hard-shadow-3"
2601
+ }
2602
+ )
2603
+ ]
2604
+ }
2605
+ );
2606
+ var CompactLayout = ({
2607
+ className,
2608
+ label,
2609
+ showPercentage,
2610
+ showHitCount,
2611
+ labelClassName,
2612
+ percentageClassName,
2613
+ clampedValue,
2614
+ max,
2615
+ percentage,
2616
+ variantClasses,
2617
+ dimensions
2618
+ }) => {
2619
+ const {
2620
+ color,
2621
+ className: compactClassName,
2622
+ content
2623
+ } = getCompactLayoutConfig({
2624
+ showPercentage,
2625
+ showHitCount,
2626
+ percentage,
2627
+ clampedValue,
2628
+ max,
2629
+ label,
2630
+ percentageClassName,
2631
+ labelClassName
2632
+ });
2633
+ return /* @__PURE__ */ jsxs10(
2634
+ "div",
2635
+ {
2636
+ className: cn(
2637
+ "flex flex-col items-start gap-1",
2638
+ dimensions.width,
2639
+ dimensions.height,
2640
+ className
2641
+ ),
2642
+ children: [
2643
+ shouldShowHeader(label, showPercentage, showHitCount) && /* @__PURE__ */ jsx13(
2644
+ Text_default,
2645
+ {
2646
+ as: "div",
2647
+ size: "sm",
2648
+ weight: "medium",
2649
+ color,
2650
+ className: cn("leading-4 w-full", compactClassName),
2651
+ children: content
2652
+ }
2653
+ ),
2654
+ /* @__PURE__ */ jsx13(
2655
+ ProgressBarBase,
2656
+ {
2657
+ clampedValue,
2658
+ max,
2659
+ percentage,
2660
+ label,
2661
+ variantClasses,
2662
+ containerClassName: "w-full h-1 rounded-full",
2663
+ fillClassName: "h-1 rounded-full"
2664
+ }
2665
+ )
2666
+ ]
2667
+ }
2668
+ );
2669
+ };
2670
+ var DefaultLayout = ({
2671
+ className,
2672
+ size,
2673
+ sizeClasses,
2674
+ variantClasses,
2675
+ label,
2676
+ showPercentage,
2677
+ labelClassName,
2678
+ percentageClassName,
2679
+ clampedValue,
2680
+ max,
2681
+ percentage
2682
+ }) => {
2683
+ const gapClass = size === "medium" ? "gap-2" : sizeClasses.spacing;
2684
+ const progressBarClass = size === "medium" ? "flex-grow" : "w-full";
2685
+ const displayConfig = getDefaultLayoutDisplayConfig(
2686
+ size,
2687
+ label,
2688
+ showPercentage
2689
+ );
2690
+ return /* @__PURE__ */ jsxs10("div", { className: cn("flex", sizeClasses.layout, gapClass, className), children: [
2691
+ displayConfig.showHeader && /* @__PURE__ */ jsxs10("div", { className: "flex flex-row items-center justify-between w-full", children: [
2692
+ label && /* @__PURE__ */ jsx13(
2693
+ Text_default,
2694
+ {
2695
+ as: "div",
2696
+ size: "xs",
2697
+ weight: "medium",
2698
+ className: cn(
2699
+ "text-text-950 leading-none tracking-normal text-center",
2700
+ labelClassName
2701
+ ),
2702
+ children: label
2703
+ }
2704
+ ),
2705
+ showPercentage && /* @__PURE__ */ jsxs10(
2706
+ Text_default,
2707
+ {
2708
+ size: "xs",
2709
+ weight: "medium",
2710
+ className: cn(
2711
+ "text-text-950 leading-none tracking-normal text-center",
2712
+ percentageClassName
2713
+ ),
2714
+ children: [
2715
+ Math.round(percentage),
2716
+ "%"
2717
+ ]
2718
+ }
2719
+ )
2720
+ ] }),
2721
+ /* @__PURE__ */ jsx13(
2722
+ ProgressBarBase,
2723
+ {
2724
+ clampedValue,
2725
+ max,
2726
+ percentage,
2727
+ label,
2728
+ variantClasses,
2729
+ containerClassName: cn(
2730
+ progressBarClass,
2731
+ sizeClasses.container,
2732
+ sizeClasses.borderRadius
2733
+ ),
2734
+ fillClassName: cn(
2735
+ sizeClasses.bar,
2736
+ sizeClasses.borderRadius,
2737
+ "shadow-hard-shadow-3"
2738
+ )
2739
+ }
2740
+ ),
2741
+ displayConfig.showPercentage && /* @__PURE__ */ jsxs10(
2742
+ Text_default,
2743
+ {
2744
+ size: "xs",
2745
+ weight: "medium",
2746
+ className: cn(
2747
+ "text-text-950 leading-none tracking-normal text-center flex-none",
2748
+ percentageClassName
2749
+ ),
2750
+ children: [
2751
+ Math.round(percentage),
2752
+ "%"
2753
+ ]
2754
+ }
2755
+ ),
2756
+ displayConfig.showLabel && /* @__PURE__ */ jsx13(
2757
+ Text_default,
2758
+ {
2759
+ as: "div",
2760
+ size: "xs",
2761
+ weight: "medium",
2762
+ className: cn(
2763
+ "text-text-950 leading-none tracking-normal text-center flex-none",
2764
+ labelClassName
2765
+ ),
2766
+ children: label
2767
+ }
2768
+ )
2769
+ ] });
2770
+ };
2771
+ var ProgressBar = ({
2772
+ value,
2773
+ max = 100,
2774
+ size = "medium",
2775
+ variant = "blue",
2776
+ layout = "default",
2777
+ label,
2778
+ showPercentage = false,
2779
+ showHitCount = false,
2780
+ className = "",
2781
+ labelClassName = "",
2782
+ percentageClassName = "",
2783
+ stackedWidth,
2784
+ stackedHeight,
2785
+ compactWidth,
2786
+ compactHeight
2787
+ }) => {
2788
+ const { clampedValue, percentage } = calculateProgressValues(value, max);
2789
+ const sizeClasses = SIZE_CLASSES6[size];
2790
+ const variantClasses = VARIANT_CLASSES[variant];
2791
+ if (layout === "stacked") {
2792
+ return /* @__PURE__ */ jsx13(
2793
+ StackedLayout,
2794
+ {
2795
+ className,
2796
+ label,
2797
+ showPercentage,
2798
+ showHitCount,
2799
+ labelClassName,
2800
+ percentageClassName,
2801
+ clampedValue,
2802
+ max,
2803
+ percentage,
2804
+ variantClasses,
2805
+ dimensions: {
2806
+ width: stackedWidth ?? "w-[380px]",
2807
+ height: stackedHeight ?? "h-[35px]"
2808
+ }
2809
+ }
2810
+ );
2811
+ }
2812
+ if (layout === "compact") {
2813
+ return /* @__PURE__ */ jsx13(
2814
+ CompactLayout,
2815
+ {
2816
+ className,
2817
+ label,
2818
+ showPercentage,
2819
+ showHitCount,
2820
+ labelClassName,
2821
+ percentageClassName,
2822
+ clampedValue,
2823
+ max,
2824
+ percentage,
2825
+ variantClasses,
2826
+ dimensions: {
2827
+ width: compactWidth ?? "w-[131px]",
2828
+ height: compactHeight ?? "h-[24px]"
2829
+ }
2830
+ }
2831
+ );
2832
+ }
2833
+ return /* @__PURE__ */ jsx13(
2834
+ DefaultLayout,
2835
+ {
2836
+ className,
2837
+ size,
2838
+ sizeClasses,
2839
+ variantClasses,
2840
+ label,
2841
+ showPercentage,
2842
+ labelClassName,
2843
+ percentageClassName,
2844
+ clampedValue,
2845
+ max,
2846
+ percentage
2847
+ }
2848
+ );
2849
+ };
2850
+ var ProgressBar_default = ProgressBar;
2851
+
2852
+ // src/assets/icons/subjects/ChatEN.tsx
2853
+ import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
2854
+ var ChatEN = ({ size, color }) => /* @__PURE__ */ jsxs11(
2855
+ "svg",
2856
+ {
2857
+ width: size,
2858
+ height: size,
2859
+ viewBox: "0 0 32 32",
2860
+ fill: "none",
2861
+ xmlns: "http://www.w3.org/2000/svg",
2862
+ children: [
2863
+ /* @__PURE__ */ jsx14(
2864
+ "path",
2865
+ {
2866
+ 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",
2867
+ fill: color
2868
+ }
2869
+ ),
2870
+ /* @__PURE__ */ jsx14(
2871
+ "path",
2872
+ {
2873
+ d: "M22.5488 12V20.5312H21.0781L17.252 14.4199V20.5312H15.7812V12H17.252L21.0898 18.123V12H22.5488Z",
2874
+ fill: color
2875
+ }
2876
+ ),
2877
+ /* @__PURE__ */ jsx14(
2878
+ "path",
2879
+ {
2880
+ 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",
2881
+ fill: color
2882
+ }
2883
+ )
2884
+ ]
2885
+ }
2886
+ );
2887
+
2888
+ // src/assets/icons/subjects/ChatES.tsx
2889
+ import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
2890
+ var ChatES = ({ size, color }) => /* @__PURE__ */ jsxs12(
2891
+ "svg",
2892
+ {
2893
+ width: size,
2894
+ height: size,
2895
+ viewBox: "0 0 32 32",
2896
+ fill: "none",
2897
+ xmlns: "http://www.w3.org/2000/svg",
2898
+ children: [
2899
+ /* @__PURE__ */ jsx15(
2900
+ "path",
2901
+ {
2902
+ 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",
2903
+ fill: color
2904
+ }
2905
+ ),
2906
+ /* @__PURE__ */ jsx15(
2907
+ "path",
2908
+ {
2909
+ 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",
2910
+ fill: color
2911
+ }
2912
+ ),
2913
+ /* @__PURE__ */ jsx15(
2914
+ "path",
2915
+ {
2916
+ 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",
2917
+ fill: color
2918
+ }
2919
+ )
2920
+ ]
2921
+ }
2922
+ );
2923
+
2924
+ // src/assets/icons/subjects/ChatPT.tsx
2925
+ import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
2926
+ var ChatPT = ({ size, color }) => /* @__PURE__ */ jsxs13(
2927
+ "svg",
2928
+ {
2929
+ width: size,
2930
+ height: size,
2931
+ viewBox: "0 0 32 32",
2932
+ fill: "none",
2933
+ xmlns: "http://www.w3.org/2000/svg",
2934
+ children: [
2935
+ /* @__PURE__ */ jsx16(
2936
+ "path",
2937
+ {
2938
+ 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",
2939
+ fill: color
2940
+ }
2941
+ ),
2942
+ /* @__PURE__ */ jsx16(
2943
+ "path",
2944
+ {
2945
+ d: "M21.1758 12V20.5312H19.7168V12H21.1758ZM23.8535 12V13.1719H17.0625V12H23.8535Z",
2946
+ fill: color
2947
+ }
2948
+ ),
2949
+ /* @__PURE__ */ jsx16(
2950
+ "path",
2951
+ {
2952
+ 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",
2953
+ fill: color
2954
+ }
2955
+ )
2956
+ ]
2957
+ }
2958
+ );
2959
+
2960
+ // src/types/questionTypes.ts
2961
+ var questionTypeLabels = {
2962
+ ["ALTERNATIVA" /* ALTERNATIVA */]: "Alternativa",
2963
+ ["VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */]: "Verdadeiro ou Falso",
2964
+ ["DISSERTATIVA" /* DISSERTATIVA */]: "Discursiva",
2965
+ ["IMAGEM" /* IMAGEM */]: "Imagem",
2966
+ ["MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */]: "M\xFAltipla Escolha",
2967
+ ["LIGAR_PONTOS" /* LIGAR_PONTOS */]: "Ligar Pontos",
2968
+ ["PREENCHER" /* PREENCHER */]: "Preencher Lacunas"
2969
+ };
2970
+
2971
+ // src/components/Card/Card.tsx
2972
+ import {
2973
+ forwardRef as forwardRef5,
2974
+ Fragment as Fragment3,
2975
+ useState as useState6,
2976
+ useRef as useRef4,
2977
+ useEffect as useEffect7
2978
+ } from "react";
2979
+ import {
2980
+ CaretRight as CaretRight2,
2981
+ ChatCircleText,
2982
+ CheckCircle,
2983
+ Clock,
2984
+ DotsThreeVertical,
2985
+ Play,
2986
+ SpeakerHigh,
2987
+ SpeakerLow,
2988
+ SpeakerSimpleX,
2989
+ XCircle
2990
+ } from "phosphor-react";
2991
+
2992
+ // src/components/IconRender/IconRender.tsx
2993
+ import { cloneElement as cloneElement3 } from "react";
2994
+ import * as PhosphorIcons from "phosphor-react";
2995
+ import { jsx as jsx17 } from "react/jsx-runtime";
2996
+ var IconRender = ({
2997
+ iconName,
2998
+ color = "#000000",
2999
+ size = 24,
3000
+ weight = "regular"
3001
+ }) => {
3002
+ if (typeof iconName === "string") {
3003
+ switch (iconName) {
3004
+ case "Chat_PT":
3005
+ return /* @__PURE__ */ jsx17(ChatPT, { size, color });
3006
+ case "Chat_EN":
3007
+ return /* @__PURE__ */ jsx17(ChatEN, { size, color });
3008
+ case "Chat_ES":
3009
+ return /* @__PURE__ */ jsx17(ChatES, { size, color });
3010
+ default: {
3011
+ const IconComponent = PhosphorIcons[iconName] || PhosphorIcons.Question;
3012
+ return /* @__PURE__ */ jsx17(IconComponent, { size, color, weight });
3013
+ }
3014
+ }
3015
+ } else {
3016
+ return cloneElement3(iconName, {
3017
+ size,
3018
+ color: "currentColor"
3019
+ });
3020
+ }
3021
+ };
3022
+ var IconRender_default = IconRender;
3023
+
3024
+ // src/components/Card/Card.tsx
3025
+ import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
3026
+ var CARD_BASE_CLASSES = {
3027
+ default: "w-full bg-background border border-border-50 rounded-xl",
3028
+ compact: "w-full bg-background border border-border-50 rounded-lg",
3029
+ minimal: "w-full bg-background border border-border-100 rounded-md"
3030
+ };
3031
+ var CARD_PADDING_CLASSES = {
3032
+ none: "",
3033
+ small: "p-2",
3034
+ medium: "p-4",
3035
+ large: "p-6"
3036
+ };
3037
+ var CARD_MIN_HEIGHT_CLASSES = {
3038
+ none: "",
3039
+ small: "min-h-16",
3040
+ medium: "min-h-20",
3041
+ large: "min-h-24"
3042
+ };
3043
+ var CARD_LAYOUT_CLASSES = {
3044
+ horizontal: "flex flex-row",
3045
+ vertical: "flex flex-col"
3046
+ };
3047
+ var CARD_CURSOR_CLASSES = {
3048
+ default: "",
3049
+ pointer: "cursor-pointer"
3050
+ };
3051
+ var CardBase = forwardRef5(
3052
+ ({
3053
+ children,
3054
+ variant = "default",
3055
+ layout = "horizontal",
3056
+ padding = "medium",
3057
+ minHeight = "medium",
3058
+ cursor = "default",
3059
+ className = "",
3060
+ ...props
3061
+ }, ref) => {
3062
+ const baseClasses = CARD_BASE_CLASSES[variant];
3063
+ const paddingClasses = CARD_PADDING_CLASSES[padding];
3064
+ const minHeightClasses = CARD_MIN_HEIGHT_CLASSES[minHeight];
3065
+ const layoutClasses = CARD_LAYOUT_CLASSES[layout];
3066
+ const cursorClasses = CARD_CURSOR_CLASSES[cursor];
3067
+ return /* @__PURE__ */ jsx18(
3068
+ "div",
3069
+ {
3070
+ ref,
3071
+ className: cn(
3072
+ baseClasses,
3073
+ paddingClasses,
3074
+ minHeightClasses,
3075
+ layoutClasses,
3076
+ cursorClasses,
3077
+ className
3078
+ ),
3079
+ ...props,
3080
+ children
3081
+ }
3082
+ );
3083
+ }
3084
+ );
3085
+ var ACTION_CARD_CLASSES = {
3086
+ warning: "bg-warning-background",
3087
+ success: "bg-success-200",
3088
+ error: "bg-error-100",
3089
+ info: "bg-info-background"
3090
+ };
3091
+ var ACTION_ICON_CLASSES = {
3092
+ warning: "bg-warning-300 text-text",
3093
+ success: "bg-indicator-positive text-text-950",
3094
+ error: "bg-indicator-negative text-text",
3095
+ info: "bg-info-500 text-text"
3096
+ };
3097
+ var ACTION_SUBTITLE_CLASSES = {
3098
+ warning: "text-warning-600",
3099
+ success: "text-success-700",
3100
+ error: "text-error-700",
3101
+ info: "text-info-700"
3102
+ };
3103
+ var ACTION_HEADER_CLASSES = {
3104
+ warning: "text-warning-300",
3105
+ success: "text-success-300",
3106
+ error: "text-error-300",
3107
+ info: "text-info-300"
3108
+ };
3109
+ var CardActivitiesResults = forwardRef5(
3110
+ ({
3111
+ icon,
3112
+ title,
3113
+ subTitle,
3114
+ header,
3115
+ extended = false,
3116
+ action = "success",
3117
+ description,
3118
+ className,
3119
+ ...props
3120
+ }, ref) => {
3121
+ const actionCardClasses = ACTION_CARD_CLASSES[action];
3122
+ const actionIconClasses = ACTION_ICON_CLASSES[action];
3123
+ const actionSubTitleClasses = ACTION_SUBTITLE_CLASSES[action];
3124
+ const actionHeaderClasses = ACTION_HEADER_CLASSES[action];
3125
+ return /* @__PURE__ */ jsxs14(
3126
+ "div",
3127
+ {
3128
+ ref,
3129
+ className: cn(
3130
+ "w-full flex flex-col border border-border-50 bg-background rounded-xl",
3131
+ className
3132
+ ),
3133
+ ...props,
3134
+ children: [
3135
+ /* @__PURE__ */ jsxs14(
3136
+ "div",
3137
+ {
3138
+ className: cn(
3139
+ "flex flex-col gap-1 items-center justify-center p-4",
3140
+ actionCardClasses,
3141
+ extended ? "rounded-t-xl" : "rounded-xl"
3142
+ ),
3143
+ children: [
3144
+ /* @__PURE__ */ jsx18(
3145
+ "span",
3146
+ {
3147
+ className: cn(
3148
+ "size-7.5 rounded-full flex items-center justify-center",
3149
+ actionIconClasses
3150
+ ),
3151
+ children: icon
3152
+ }
3153
+ ),
3154
+ /* @__PURE__ */ jsx18(
3155
+ Text_default,
3156
+ {
3157
+ size: "2xs",
3158
+ weight: "medium",
3159
+ className: "text-text-800 uppercase truncate",
3160
+ children: title
3161
+ }
3162
+ ),
3163
+ /* @__PURE__ */ jsx18(
3164
+ "p",
3165
+ {
3166
+ className: cn("text-lg font-bold truncate", actionSubTitleClasses),
3167
+ children: subTitle
3168
+ }
3169
+ )
3170
+ ]
3171
+ }
3172
+ ),
3173
+ extended && /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center gap-2.5 pb-9.5 pt-2.5", children: [
3174
+ /* @__PURE__ */ jsx18(
3175
+ "p",
3176
+ {
3177
+ className: cn(
3178
+ "text-2xs font-medium uppercase truncate",
3179
+ actionHeaderClasses
3180
+ ),
3181
+ children: header
3182
+ }
3183
+ ),
3184
+ /* @__PURE__ */ jsx18(Badge_default, { size: "large", action: "info", children: description })
3185
+ ] })
3186
+ ]
3187
+ }
3188
+ );
3189
+ }
3190
+ );
3191
+ var CardQuestions = forwardRef5(
3192
+ ({
3193
+ header,
3194
+ state = "undone",
3195
+ className,
3196
+ onClickButton,
3197
+ valueButton,
3198
+ ...props
3199
+ }, ref) => {
3200
+ const isDone = state === "done";
3201
+ const stateLabel = isDone ? "Realizado" : "N\xE3o Realizado";
3202
+ const buttonLabel = isDone ? "Ver Resultado" : "Responder";
3203
+ return /* @__PURE__ */ jsxs14(
3204
+ CardBase,
3205
+ {
3206
+ ref,
3207
+ layout: "horizontal",
3208
+ padding: "medium",
3209
+ minHeight: "medium",
3210
+ className: cn("justify-between gap-4", className),
3211
+ ...props,
3212
+ children: [
3213
+ /* @__PURE__ */ jsxs14("section", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
3214
+ /* @__PURE__ */ jsx18("p", { className: "font-bold text-xs text-text-950 truncate", children: header }),
3215
+ /* @__PURE__ */ jsx18("div", { className: "flex flex-row gap-6 items-center", children: /* @__PURE__ */ jsx18(
3216
+ Badge_default,
3217
+ {
3218
+ size: "medium",
3219
+ variant: "solid",
3220
+ action: isDone ? "success" : "error",
3221
+ children: stateLabel
3222
+ }
3223
+ ) })
3224
+ ] }),
3225
+ /* @__PURE__ */ jsx18("span", { className: "flex-shrink-0", children: /* @__PURE__ */ jsx18(
3226
+ Button_default,
3227
+ {
3228
+ size: "extra-small",
3229
+ onClick: () => onClickButton?.(valueButton),
3230
+ className: "min-w-fit",
3231
+ children: buttonLabel
3232
+ }
3233
+ ) })
3234
+ ]
3235
+ }
3236
+ );
3237
+ }
3238
+ );
3239
+ var CardProgress = forwardRef5(
3240
+ ({
3241
+ header,
3242
+ subhead,
3243
+ initialDate,
3244
+ endDate,
3245
+ progress = 0,
3246
+ direction = "horizontal",
3247
+ icon,
3248
+ color = "#B7DFFF",
3249
+ progressVariant = "blue",
3250
+ showDates = true,
3251
+ className,
3252
+ ...props
3253
+ }, ref) => {
3254
+ const isHorizontal = direction === "horizontal";
3255
+ const contentComponent = {
3256
+ horizontal: /* @__PURE__ */ jsxs14(Fragment4, { children: [
3257
+ showDates && /* @__PURE__ */ jsxs14("div", { className: "flex flex-row gap-6 items-center", children: [
3258
+ initialDate && /* @__PURE__ */ jsxs14("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
3259
+ /* @__PURE__ */ jsx18("p", { className: "text-text-800 font-semibold", children: "In\xEDcio" }),
3260
+ /* @__PURE__ */ jsx18("p", { className: "text-text-600", children: initialDate })
3261
+ ] }),
3262
+ endDate && /* @__PURE__ */ jsxs14("span", { className: "flex flex-row gap-1 items-center text-2xs", children: [
3263
+ /* @__PURE__ */ jsx18("p", { className: "text-text-800 font-semibold", children: "Fim" }),
3264
+ /* @__PURE__ */ jsx18("p", { className: "text-text-600", children: endDate })
3265
+ ] })
3266
+ ] }),
3267
+ /* @__PURE__ */ jsxs14("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
3268
+ /* @__PURE__ */ jsx18(
3269
+ ProgressBar_default,
3270
+ {
3271
+ size: "small",
3272
+ value: progress,
3273
+ variant: progressVariant,
3274
+ "data-testid": "progress-bar"
3275
+ }
3276
+ ),
3277
+ /* @__PURE__ */ jsxs14(
3278
+ Text_default,
3279
+ {
3280
+ size: "xs",
3281
+ weight: "medium",
3282
+ className: cn(
3283
+ "text-text-950 leading-none tracking-normal text-center flex-none"
3284
+ ),
3285
+ children: [
3286
+ Math.round(progress),
3287
+ "%"
3288
+ ]
3289
+ }
3290
+ )
3291
+ ] })
3292
+ ] }),
3293
+ vertical: /* @__PURE__ */ jsx18("p", { className: "text-sm text-text-800", children: subhead })
3294
+ };
3295
+ return /* @__PURE__ */ jsxs14(
3296
+ CardBase,
3297
+ {
3298
+ ref,
3299
+ layout: isHorizontal ? "horizontal" : "vertical",
3300
+ padding: "none",
3301
+ minHeight: "medium",
3302
+ cursor: "pointer",
3303
+ className: cn(isHorizontal ? "h-20" : "", className),
3304
+ ...props,
3305
+ children: [
3306
+ /* @__PURE__ */ jsx18(
3307
+ "div",
3308
+ {
3309
+ className: cn(
3310
+ "flex justify-center items-center [&>svg]:size-6 text-text-950",
3311
+ isHorizontal ? "min-w-[80px] min-h-[80px] rounded-l-xl" : "min-h-[50px] w-full rounded-t-xl",
3312
+ !color.startsWith("#") ? `${color}` : ""
3313
+ ),
3314
+ style: color.startsWith("#") ? { backgroundColor: color } : void 0,
3315
+ "data-testid": "icon-container",
3316
+ children: icon
3317
+ }
3318
+ ),
3319
+ /* @__PURE__ */ jsxs14(
3320
+ "div",
3321
+ {
3322
+ className: cn(
3323
+ "p-4 flex flex-col justify-between w-full h-full",
3324
+ !isHorizontal && "gap-4"
3325
+ ),
3326
+ children: [
3327
+ /* @__PURE__ */ jsx18(Text_default, { size: "sm", weight: "bold", className: "text-text-950 truncate", children: header }),
3328
+ contentComponent[direction]
3329
+ ]
3330
+ }
3331
+ )
3332
+ ]
3333
+ }
3334
+ );
3335
+ }
3336
+ );
3337
+ var CardTopic = forwardRef5(
3338
+ ({
3339
+ header,
3340
+ subHead,
3341
+ progress,
3342
+ showPercentage = false,
3343
+ progressVariant = "blue",
3344
+ className = "",
3345
+ ...props
3346
+ }, ref) => {
3347
+ return /* @__PURE__ */ jsxs14(
3348
+ CardBase,
3349
+ {
3350
+ ref,
3351
+ layout: "vertical",
3352
+ padding: "small",
3353
+ minHeight: "medium",
3354
+ cursor: "pointer",
3355
+ className: cn("justify-center gap-2 py-2 px-4", className),
3356
+ ...props,
3357
+ children: [
3358
+ subHead && /* @__PURE__ */ jsx18("span", { className: "text-text-600 text-2xs flex flex-row gap-1", children: subHead.map((text, index) => /* @__PURE__ */ jsxs14(Fragment3, { children: [
3359
+ /* @__PURE__ */ jsx18("p", { children: text }),
3360
+ index < subHead.length - 1 && /* @__PURE__ */ jsx18("p", { children: "\u2022" })
3361
+ ] }, `${text} - ${index}`)) }),
3362
+ /* @__PURE__ */ jsx18("p", { className: "text-sm text-text-950 font-bold truncate", children: header }),
3363
+ /* @__PURE__ */ jsxs14("span", { className: "grid grid-cols-[1fr_auto] items-center gap-2", children: [
3364
+ /* @__PURE__ */ jsx18(
3365
+ ProgressBar_default,
3366
+ {
3367
+ size: "small",
3368
+ value: progress,
3369
+ variant: progressVariant,
3370
+ "data-testid": "progress-bar"
3371
+ }
3372
+ ),
3373
+ showPercentage && /* @__PURE__ */ jsxs14(
3374
+ Text_default,
3375
+ {
3376
+ size: "xs",
3377
+ weight: "medium",
3378
+ className: cn(
3379
+ "text-text-950 leading-none tracking-normal text-center flex-none"
3380
+ ),
3381
+ children: [
3382
+ Math.round(progress),
3383
+ "%"
3384
+ ]
3385
+ }
3386
+ )
3387
+ ] })
3388
+ ]
3389
+ }
3390
+ );
3391
+ }
3392
+ );
3393
+ var CardPerformance = forwardRef5(
3394
+ ({
3395
+ header,
3396
+ progress,
3397
+ description = "Sem dados ainda! Voc\xEA ainda n\xE3o fez um question\xE1rio neste assunto.",
3398
+ actionVariant = "button",
3399
+ progressVariant = "blue",
3400
+ labelProgress = "",
3401
+ className = "",
3402
+ onClickButton,
3403
+ valueButton,
3404
+ ...props
3405
+ }, ref) => {
3406
+ const hasProgress = progress !== void 0;
3407
+ return /* @__PURE__ */ jsxs14(
3408
+ CardBase,
3409
+ {
3410
+ ref,
3411
+ layout: "horizontal",
3412
+ padding: "medium",
3413
+ minHeight: "none",
3414
+ className: cn(
3415
+ actionVariant == "caret" ? "cursor-pointer" : "",
3416
+ className
3417
+ ),
3418
+ onClick: () => actionVariant == "caret" && onClickButton?.(valueButton),
3419
+ ...props,
3420
+ children: [
3421
+ /* @__PURE__ */ jsxs14("div", { className: "w-full flex flex-col justify-between gap-2", children: [
3422
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row justify-between items-center gap-2", children: [
3423
+ /* @__PURE__ */ jsx18("p", { className: "text-lg font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
3424
+ actionVariant === "button" && /* @__PURE__ */ jsx18(
3425
+ Button_default,
3426
+ {
3427
+ variant: "outline",
3428
+ size: "extra-small",
3429
+ onClick: () => onClickButton?.(valueButton),
3430
+ className: "min-w-fit flex-shrink-0",
3431
+ children: "Ver Aula"
3432
+ }
3433
+ )
3434
+ ] }),
3435
+ /* @__PURE__ */ jsx18("div", { className: "w-full", children: hasProgress ? /* @__PURE__ */ jsx18(
3436
+ ProgressBar_default,
3437
+ {
3438
+ value: progress,
3439
+ label: `${progress}% ${labelProgress}`,
3440
+ variant: progressVariant
3441
+ }
3442
+ ) : /* @__PURE__ */ jsx18("p", { className: "text-xs text-text-600 truncate", children: description }) })
3443
+ ] }),
3444
+ actionVariant == "caret" && /* @__PURE__ */ jsx18(
3445
+ CaretRight2,
3446
+ {
3447
+ className: "size-4.5 text-text-800 cursor-pointer",
3448
+ "data-testid": "caret-icon"
3449
+ }
3450
+ )
3451
+ ]
3452
+ }
3453
+ );
3454
+ }
3455
+ );
3456
+ var CardResults = forwardRef5(
3457
+ ({
3458
+ header,
3459
+ correct_answers,
3460
+ incorrect_answers,
3461
+ icon,
3462
+ direction = "col",
3463
+ color = "#B7DFFF",
3464
+ className,
3465
+ ...props
3466
+ }, ref) => {
3467
+ const isRow = direction == "row";
3468
+ return /* @__PURE__ */ jsxs14(
3469
+ CardBase,
3470
+ {
3471
+ ref,
3472
+ layout: "horizontal",
3473
+ padding: "none",
3474
+ minHeight: "medium",
3475
+ className: cn("items-stretch cursor-pointer pr-4", className),
3476
+ ...props,
3477
+ children: [
3478
+ /* @__PURE__ */ jsx18(
3479
+ "div",
3480
+ {
3481
+ className: cn(
3482
+ "flex justify-center items-center [&>svg]:size-8 text-text-950 min-w-20 max-w-20 min-h-full rounded-l-xl"
3483
+ ),
3484
+ style: {
3485
+ backgroundColor: color
3486
+ },
3487
+ children: /* @__PURE__ */ jsx18(IconRender_default, { iconName: icon, color: "currentColor", size: 20 })
3488
+ }
3489
+ ),
3490
+ /* @__PURE__ */ jsxs14("div", { className: "w-full flex flex-row justify-between items-center", children: [
3491
+ /* @__PURE__ */ jsxs14(
3492
+ "div",
3493
+ {
3494
+ className: cn(
3495
+ "p-4 flex flex-wrap justify-between w-full h-full",
3496
+ isRow ? "flex-row items-center gap-2" : "flex-col"
3497
+ ),
3498
+ children: [
3499
+ /* @__PURE__ */ jsx18("p", { className: "text-sm font-bold text-text-950 flex-1", children: header }),
3500
+ /* @__PURE__ */ jsxs14("span", { className: "flex flex-wrap flex-row gap-1 items-center", children: [
3501
+ /* @__PURE__ */ jsxs14(
3502
+ Badge_default,
3503
+ {
3504
+ action: "success",
3505
+ variant: "solid",
3506
+ size: "large",
3507
+ iconLeft: /* @__PURE__ */ jsx18(CheckCircle, {}),
3508
+ children: [
3509
+ correct_answers,
3510
+ " Corretas"
3511
+ ]
3512
+ }
3513
+ ),
3514
+ /* @__PURE__ */ jsxs14(
3515
+ Badge_default,
3516
+ {
3517
+ action: "error",
3518
+ variant: "solid",
3519
+ size: "large",
3520
+ iconLeft: /* @__PURE__ */ jsx18(XCircle, {}),
3521
+ children: [
3522
+ incorrect_answers,
3523
+ " Incorretas"
3524
+ ]
3525
+ }
3526
+ )
3527
+ ] })
3528
+ ]
3529
+ }
3530
+ ),
3531
+ /* @__PURE__ */ jsx18(CaretRight2, { className: "min-w-6 min-h-6 text-text-800" })
3532
+ ] })
3533
+ ]
3534
+ }
3535
+ );
3536
+ }
3537
+ );
3538
+ var CardStatus = forwardRef5(
3539
+ ({ header, className, status, label, ...props }, ref) => {
3540
+ const getLabelBadge = (status2) => {
3541
+ switch (status2) {
3542
+ case "correct":
3543
+ return "Correta";
3544
+ case "incorrect":
3545
+ return "Incorreta";
3546
+ case "unanswered":
3547
+ return "Em branco";
3548
+ case "pending":
3549
+ return "Avalia\xE7\xE3o pendente";
3550
+ default:
3551
+ return "Em branco";
3552
+ }
3553
+ };
3554
+ const getIconBadge = (status2) => {
3555
+ switch (status2) {
3556
+ case "correct":
3557
+ return /* @__PURE__ */ jsx18(CheckCircle, {});
3558
+ case "incorrect":
3559
+ return /* @__PURE__ */ jsx18(XCircle, {});
3560
+ case "pending":
3561
+ return /* @__PURE__ */ jsx18(Clock, {});
3562
+ default:
3563
+ return /* @__PURE__ */ jsx18(XCircle, {});
3564
+ }
3565
+ };
3566
+ const getActionBadge = (status2) => {
3567
+ switch (status2) {
3568
+ case "correct":
3569
+ return "success";
3570
+ case "incorrect":
3571
+ return "error";
3572
+ case "pending":
3573
+ return "info";
3574
+ default:
3575
+ return "info";
3576
+ }
3577
+ };
3578
+ return /* @__PURE__ */ jsx18(
3579
+ CardBase,
3580
+ {
3581
+ ref,
3582
+ layout: "horizontal",
3583
+ padding: "medium",
3584
+ minHeight: "medium",
3585
+ className: cn("items-center cursor-pointer", className),
3586
+ ...props,
3587
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
3588
+ /* @__PURE__ */ jsx18("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
3589
+ /* @__PURE__ */ jsxs14("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
3590
+ status && /* @__PURE__ */ jsx18(
3591
+ Badge_default,
3592
+ {
3593
+ action: getActionBadge(status),
3594
+ variant: "solid",
3595
+ size: "medium",
3596
+ iconLeft: getIconBadge(status),
3597
+ children: getLabelBadge(status)
3598
+ }
3599
+ ),
3600
+ label && /* @__PURE__ */ jsx18("p", { className: "text-sm text-text-800", children: label })
3601
+ ] }),
3602
+ /* @__PURE__ */ jsx18(CaretRight2, { className: "min-w-6 min-h-6 text-text-800 cursor-pointer flex-shrink-0 ml-2" })
3603
+ ] })
3604
+ }
3605
+ );
3606
+ }
3607
+ );
3608
+ var CardSettings = forwardRef5(
3609
+ ({ header, className, icon, ...props }, ref) => {
3610
+ return /* @__PURE__ */ jsxs14(
3611
+ CardBase,
3612
+ {
3613
+ ref,
3614
+ layout: "horizontal",
3615
+ padding: "small",
3616
+ minHeight: "none",
3617
+ className: cn(
3618
+ "border-none items-center gap-2 text-text-700",
3619
+ className
3620
+ ),
3621
+ ...props,
3622
+ children: [
3623
+ /* @__PURE__ */ jsx18("span", { className: "[&>svg]:size-6", children: icon }),
3624
+ /* @__PURE__ */ jsx18("p", { className: "w-full text-sm truncate", children: header }),
3625
+ /* @__PURE__ */ jsx18(CaretRight2, { size: 24, className: "cursor-pointer" })
3626
+ ]
3627
+ }
3628
+ );
3629
+ }
3630
+ );
3631
+ var CardSupport = forwardRef5(
3632
+ ({ header, className, direction = "col", children, ...props }, ref) => {
3633
+ return /* @__PURE__ */ jsxs14(
3634
+ CardBase,
3635
+ {
3636
+ ref,
3637
+ layout: "horizontal",
3638
+ padding: "medium",
3639
+ minHeight: "none",
3640
+ className: cn(
3641
+ "border-none items-center gap-2 text-text-700",
3642
+ className
3643
+ ),
3644
+ ...props,
3645
+ children: [
3646
+ /* @__PURE__ */ jsxs14(
3647
+ "div",
3648
+ {
3649
+ className: cn(
3650
+ "w-full flex",
3651
+ direction == "col" ? "flex-col" : "flex-row items-center"
3652
+ ),
3653
+ children: [
3654
+ /* @__PURE__ */ jsx18("span", { className: "w-full min-w-0", children: /* @__PURE__ */ jsx18("p", { className: "text-sm text-text-950 font-bold truncate", children: header }) }),
3655
+ /* @__PURE__ */ jsx18("span", { className: "flex flex-row gap-1", children })
3656
+ ]
3657
+ }
3658
+ ),
3659
+ /* @__PURE__ */ jsx18(CaretRight2, { className: "text-text-800 cursor-pointer", size: 24 })
3660
+ ]
3661
+ }
3662
+ );
3663
+ }
3664
+ );
3665
+ var CardForum = forwardRef5(
3666
+ ({
3667
+ title,
3668
+ content,
3669
+ comments,
3670
+ onClickComments,
3671
+ valueComments,
3672
+ onClickProfile,
3673
+ valueProfile,
3674
+ className = "",
3675
+ date,
3676
+ hour,
3677
+ ...props
3678
+ }, ref) => {
3679
+ return /* @__PURE__ */ jsxs14(
3680
+ CardBase,
3681
+ {
3682
+ ref,
3683
+ layout: "horizontal",
3684
+ padding: "medium",
3685
+ minHeight: "none",
3686
+ variant: "minimal",
3687
+ className: cn("w-auto h-auto gap-3", className),
3688
+ ...props,
3689
+ children: [
3690
+ /* @__PURE__ */ jsx18(
3691
+ "button",
3692
+ {
3693
+ type: "button",
3694
+ "aria-label": "Ver perfil",
3695
+ onClick: () => onClickProfile?.(valueProfile),
3696
+ className: "min-w-8 h-8 rounded-full bg-background-950"
3697
+ }
3698
+ ),
3699
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2 flex-1 min-w-0", children: [
3700
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row gap-1 items-center flex-wrap", children: [
3701
+ /* @__PURE__ */ jsx18("p", { className: "text-xs font-semibold text-primary-700 truncate", children: title }),
3702
+ /* @__PURE__ */ jsxs14("p", { className: "text-xs text-text-600", children: [
3703
+ "\u2022 ",
3704
+ date,
3705
+ " \u2022 ",
3706
+ hour
3707
+ ] })
3708
+ ] }),
3709
+ /* @__PURE__ */ jsx18("p", { className: "text-text-950 text-sm line-clamp-2 truncate", children: content }),
3710
+ /* @__PURE__ */ jsxs14(
3711
+ "button",
3712
+ {
3713
+ type: "button",
3714
+ "aria-label": "Ver coment\xE1rios",
3715
+ onClick: () => onClickComments?.(valueComments),
3716
+ className: "text-text-600 flex flex-row gap-2 items-center",
3717
+ children: [
3718
+ /* @__PURE__ */ jsx18(ChatCircleText, { "aria-hidden": "true", size: 16 }),
3719
+ /* @__PURE__ */ jsxs14("p", { className: "text-xs", children: [
3720
+ comments,
3721
+ " respostas"
3722
+ ] })
3723
+ ]
3724
+ }
3725
+ )
3726
+ ] })
3727
+ ]
3728
+ }
3729
+ );
3730
+ }
3731
+ );
3732
+ var CardAudio = forwardRef5(
3733
+ ({
3734
+ src,
3735
+ title,
3736
+ onPlay,
3737
+ onPause,
3738
+ onEnded,
3739
+ onAudioTimeUpdate,
3740
+ loop = false,
3741
+ preload = "metadata",
3742
+ tracks,
3743
+ className,
3744
+ ...props
3745
+ }, ref) => {
3746
+ const [isPlaying, setIsPlaying] = useState6(false);
3747
+ const [currentTime, setCurrentTime] = useState6(0);
3748
+ const [duration, setDuration] = useState6(0);
3749
+ const [volume, setVolume] = useState6(1);
3750
+ const [showVolumeControl, setShowVolumeControl] = useState6(false);
3751
+ const [showSpeedMenu, setShowSpeedMenu] = useState6(false);
3752
+ const [playbackRate, setPlaybackRate] = useState6(1);
3753
+ const audioRef = useRef4(null);
3754
+ const volumeControlRef = useRef4(null);
3755
+ const speedMenuRef = useRef4(null);
3756
+ const formatTime = (time) => {
3757
+ const minutes = Math.floor(time / 60);
3758
+ const seconds = Math.floor(time % 60);
3759
+ return `${minutes}:${seconds.toString().padStart(2, "0")}`;
3760
+ };
3761
+ const handlePlayPause = () => {
3762
+ if (isPlaying) {
3763
+ audioRef.current?.pause();
3764
+ setIsPlaying(false);
3765
+ onPause?.();
3766
+ } else {
3767
+ audioRef.current?.play();
3768
+ setIsPlaying(true);
3769
+ onPlay?.();
3770
+ }
3771
+ };
3772
+ const handleTimeUpdate = () => {
3773
+ const current = audioRef.current?.currentTime ?? 0;
3774
+ const total = audioRef.current?.duration ?? 0;
3775
+ setCurrentTime(current);
3776
+ setDuration(total);
3777
+ onAudioTimeUpdate?.(current, total);
3778
+ };
3779
+ const handleLoadedMetadata = () => {
3780
+ setDuration(audioRef.current?.duration ?? 0);
3781
+ };
3782
+ const handleEnded = () => {
3783
+ setIsPlaying(false);
3784
+ setCurrentTime(0);
3785
+ onEnded?.();
3786
+ };
3787
+ const handleProgressClick = (e) => {
3788
+ const rect = e.currentTarget.getBoundingClientRect();
3789
+ const clickX = e.clientX - rect.left;
3790
+ const width = rect.width;
3791
+ const percentage = clickX / width;
3792
+ const newTime = percentage * duration;
3793
+ if (audioRef.current) {
3794
+ audioRef.current.currentTime = newTime;
3795
+ }
3796
+ setCurrentTime(newTime);
3797
+ };
3798
+ const handleVolumeChange = (e) => {
3799
+ const newVolume = parseFloat(e.target.value);
3800
+ setVolume(newVolume);
3801
+ if (audioRef.current) {
3802
+ audioRef.current.volume = newVolume;
3803
+ }
3804
+ };
3805
+ const toggleVolumeControl = () => {
3806
+ setShowVolumeControl(!showVolumeControl);
3807
+ setShowSpeedMenu(false);
3808
+ };
3809
+ const toggleSpeedMenu = () => {
3810
+ setShowSpeedMenu(!showSpeedMenu);
3811
+ setShowVolumeControl(false);
3812
+ };
3813
+ const handleSpeedChange = (speed) => {
3814
+ setPlaybackRate(speed);
3815
+ if (audioRef.current) {
3816
+ audioRef.current.playbackRate = speed;
3817
+ }
3818
+ setShowSpeedMenu(false);
3819
+ };
3820
+ const getVolumeIcon = () => {
3821
+ if (volume === 0) {
3822
+ return /* @__PURE__ */ jsx18(SpeakerSimpleX, { size: 24 });
3823
+ }
3824
+ if (volume < 0.5) {
3825
+ return /* @__PURE__ */ jsx18(SpeakerLow, { size: 24 });
3826
+ }
3827
+ return /* @__PURE__ */ jsx18(SpeakerHigh, { size: 24 });
3828
+ };
3829
+ useEffect7(() => {
3830
+ const handleClickOutside = (event) => {
3831
+ if (volumeControlRef.current && !volumeControlRef.current.contains(event.target)) {
3832
+ setShowVolumeControl(false);
3833
+ }
3834
+ if (speedMenuRef.current && !speedMenuRef.current.contains(event.target)) {
3835
+ setShowSpeedMenu(false);
3836
+ }
3837
+ };
3838
+ document.addEventListener("mousedown", handleClickOutside);
3839
+ return () => {
3840
+ document.removeEventListener("mousedown", handleClickOutside);
3841
+ };
3842
+ }, []);
3843
+ return /* @__PURE__ */ jsxs14(
3844
+ CardBase,
3845
+ {
3846
+ ref,
3847
+ layout: "horizontal",
3848
+ padding: "medium",
3849
+ minHeight: "none",
3850
+ className: cn(
3851
+ "flex flex-row w-auto h-14 items-center gap-2",
3852
+ className
3853
+ ),
3854
+ ...props,
3855
+ children: [
3856
+ /* @__PURE__ */ jsx18(
3857
+ "audio",
3858
+ {
3859
+ ref: audioRef,
3860
+ src,
3861
+ loop,
3862
+ preload,
3863
+ onTimeUpdate: handleTimeUpdate,
3864
+ onLoadedMetadata: handleLoadedMetadata,
3865
+ onEnded: handleEnded,
3866
+ "data-testid": "audio-element",
3867
+ "aria-label": title,
3868
+ children: tracks ? tracks.map((track) => /* @__PURE__ */ jsx18(
3869
+ "track",
3870
+ {
3871
+ kind: track.kind,
3872
+ src: track.src,
3873
+ srcLang: track.srcLang,
3874
+ label: track.label,
3875
+ default: track.default
3876
+ },
3877
+ track.src
3878
+ )) : /* @__PURE__ */ jsx18(
3879
+ "track",
3880
+ {
3881
+ kind: "captions",
3882
+ src: "data:text/vtt;base64,",
3883
+ srcLang: "pt",
3884
+ label: "Sem legendas dispon\xEDveis"
3885
+ }
3886
+ )
3887
+ }
3888
+ ),
3889
+ /* @__PURE__ */ jsx18(
3890
+ "button",
3891
+ {
3892
+ type: "button",
3893
+ onClick: handlePlayPause,
3894
+ disabled: !src,
3895
+ className: "cursor-pointer text-text-950 hover:text-primary-600 disabled:text-text-400 disabled:cursor-not-allowed",
3896
+ "aria-label": isPlaying ? "Pausar" : "Reproduzir",
3897
+ children: isPlaying ? /* @__PURE__ */ jsx18("div", { className: "w-6 h-6 flex items-center justify-center", children: /* @__PURE__ */ jsxs14("div", { className: "flex gap-0.5", children: [
3898
+ /* @__PURE__ */ jsx18("div", { className: "w-1 h-4 bg-current rounded-sm" }),
3899
+ /* @__PURE__ */ jsx18("div", { className: "w-1 h-4 bg-current rounded-sm" })
3900
+ ] }) }) : /* @__PURE__ */ jsx18(Play, { size: 24 })
3901
+ }
3902
+ ),
3903
+ /* @__PURE__ */ jsx18("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(currentTime) }),
3904
+ /* @__PURE__ */ jsx18("div", { className: "flex-1 relative", "data-testid": "progress-bar", children: /* @__PURE__ */ jsx18(
3905
+ "button",
3906
+ {
3907
+ type: "button",
3908
+ className: "w-full h-2 bg-border-100 rounded-full cursor-pointer",
3909
+ onClick: handleProgressClick,
3910
+ onKeyDown: (e) => {
3911
+ if (e.key === "Enter" || e.key === " ") {
3912
+ e.preventDefault();
3913
+ handleProgressClick(
3914
+ e
3915
+ );
3916
+ }
3917
+ },
3918
+ "aria-label": "Barra de progresso do \xE1udio",
3919
+ children: /* @__PURE__ */ jsx18(
3920
+ "div",
3921
+ {
3922
+ className: "h-full bg-primary-600 rounded-full transition-all duration-100",
3923
+ style: {
3924
+ width: duration > 0 ? `${currentTime / duration * 100}%` : "0%"
3925
+ }
3926
+ }
3927
+ )
3928
+ }
3929
+ ) }),
3930
+ /* @__PURE__ */ jsx18("p", { className: "text-text-800 text-md font-medium min-w-[2.5rem]", children: formatTime(duration) }),
3931
+ /* @__PURE__ */ jsxs14("div", { className: "relative h-6", ref: volumeControlRef, children: [
3932
+ /* @__PURE__ */ jsx18(
3933
+ "button",
3934
+ {
3935
+ type: "button",
3936
+ onClick: toggleVolumeControl,
3937
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
3938
+ "aria-label": "Controle de volume",
3939
+ children: /* @__PURE__ */ jsx18("div", { className: "w-6 h-6 flex items-center justify-center", children: getVolumeIcon() })
3940
+ }
3941
+ ),
3942
+ showVolumeControl && /* @__PURE__ */ jsx18(
3943
+ "button",
3944
+ {
3945
+ type: "button",
3946
+ 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",
3947
+ onKeyDown: (e) => {
3948
+ if (e.key === "Escape") {
3949
+ setShowVolumeControl(false);
3950
+ }
3951
+ },
3952
+ children: /* @__PURE__ */ jsx18(
3953
+ "input",
3954
+ {
3955
+ type: "range",
3956
+ min: "0",
3957
+ max: "1",
3958
+ step: "0.1",
3959
+ value: volume,
3960
+ onChange: handleVolumeChange,
3961
+ onKeyDown: (e) => {
3962
+ if (e.key === "ArrowUp" || e.key === "ArrowRight") {
3963
+ e.preventDefault();
3964
+ const newVolume = Math.min(
3965
+ 1,
3966
+ Math.round((volume + 0.1) * 10) / 10
3967
+ );
3968
+ setVolume(newVolume);
3969
+ if (audioRef.current) audioRef.current.volume = newVolume;
3970
+ } else if (e.key === "ArrowDown" || e.key === "ArrowLeft") {
3971
+ e.preventDefault();
3972
+ const newVolume = Math.max(
3973
+ 0,
3974
+ Math.round((volume - 0.1) * 10) / 10
3975
+ );
3976
+ setVolume(newVolume);
3977
+ if (audioRef.current) audioRef.current.volume = newVolume;
3978
+ }
3979
+ },
3980
+ className: "w-20 h-2 bg-border-100 rounded-lg appearance-none cursor-pointer",
3981
+ style: {
3982
+ background: `linear-gradient(to right, #3b82f6 0%, #3b82f6 ${volume * 100}%, #e5e7eb ${volume * 100}%, #e5e7eb 100%)`
3983
+ },
3984
+ "aria-label": "Volume",
3985
+ "aria-valuenow": Math.round(volume * 100),
3986
+ "aria-valuemin": 0,
3987
+ "aria-valuemax": 100
3988
+ }
3989
+ )
3990
+ }
3991
+ )
3992
+ ] }),
3993
+ /* @__PURE__ */ jsxs14("div", { className: "relative h-6", ref: speedMenuRef, children: [
3994
+ /* @__PURE__ */ jsx18(
3995
+ "button",
3996
+ {
3997
+ type: "button",
3998
+ onClick: toggleSpeedMenu,
3999
+ className: "cursor-pointer text-text-950 hover:text-primary-600",
4000
+ "aria-label": "Op\xE7\xF5es de velocidade",
4001
+ children: /* @__PURE__ */ jsx18(DotsThreeVertical, { size: 24 })
4002
+ }
4003
+ ),
4004
+ showSpeedMenu && /* @__PURE__ */ jsx18("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__ */ jsx18("div", { className: "flex flex-col gap-1", children: [
4005
+ { speed: 1, label: "1x" },
4006
+ { speed: 1.5, label: "1.5x" },
4007
+ { speed: 2, label: "2x" }
4008
+ ].map(({ speed, label }) => /* @__PURE__ */ jsx18(
4009
+ "button",
4010
+ {
4011
+ type: "button",
4012
+ onClick: () => handleSpeedChange(speed),
4013
+ className: cn(
4014
+ "px-3 py-1 text-sm text-left rounded hover:bg-border-50 transition-colors",
4015
+ playbackRate === speed ? "bg-primary-950 text-secondary-100 font-medium" : "text-text-950"
4016
+ ),
4017
+ children: label
4018
+ },
4019
+ speed
4020
+ )) }) })
4021
+ ] })
4022
+ ]
4023
+ }
4024
+ );
4025
+ }
4026
+ );
4027
+ var SIMULADO_BACKGROUND_CLASSES = {
4028
+ enem: "bg-exam-1",
4029
+ prova: "bg-exam-2",
4030
+ simuladao: "bg-exam-3",
4031
+ vestibular: "bg-exam-4"
4032
+ };
4033
+ var CardSimulado = forwardRef5(
4034
+ ({ title, duration, info, backgroundColor, className, ...props }, ref) => {
4035
+ const backgroundClass = SIMULADO_BACKGROUND_CLASSES[backgroundColor];
4036
+ return /* @__PURE__ */ jsx18(
4037
+ CardBase,
4038
+ {
4039
+ ref,
4040
+ layout: "horizontal",
4041
+ padding: "medium",
4042
+ minHeight: "none",
4043
+ cursor: "pointer",
4044
+ className: cn(
4045
+ `${backgroundClass} hover:shadow-soft-shadow-2 transition-shadow duration-200`,
4046
+ className
4047
+ ),
4048
+ ...props,
4049
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex justify-between items-center w-full gap-4", children: [
4050
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-1 flex-1 min-w-0", children: [
4051
+ /* @__PURE__ */ jsx18(Text_default, { size: "lg", weight: "bold", className: "text-text-950 truncate", children: title }),
4052
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-4 text-text-700", children: [
4053
+ duration && /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-1", children: [
4054
+ /* @__PURE__ */ jsx18(Clock, { size: 16, className: "flex-shrink-0" }),
4055
+ /* @__PURE__ */ jsx18(Text_default, { size: "sm", children: duration })
4056
+ ] }),
4057
+ /* @__PURE__ */ jsx18(Text_default, { size: "sm", className: "truncate", children: info })
4058
+ ] })
4059
+ ] }),
4060
+ /* @__PURE__ */ jsx18(
4061
+ CaretRight2,
4062
+ {
4063
+ size: 24,
4064
+ className: "text-text-800 flex-shrink-0",
4065
+ "data-testid": "caret-icon"
4066
+ }
4067
+ )
4068
+ ] })
4069
+ }
4070
+ );
4071
+ }
4072
+ );
4073
+ var CardTest = forwardRef5(
4074
+ ({
4075
+ title,
4076
+ duration,
4077
+ questionsCount,
4078
+ additionalInfo,
4079
+ selected = false,
4080
+ onSelect,
4081
+ className = "",
4082
+ ...props
4083
+ }, ref) => {
4084
+ const handleClick = () => {
4085
+ if (onSelect) {
4086
+ onSelect(!selected);
4087
+ }
4088
+ };
4089
+ const handleKeyDown = (event) => {
4090
+ if ((event.key === "Enter" || event.key === " ") && onSelect) {
4091
+ event.preventDefault();
4092
+ onSelect(!selected);
4093
+ }
4094
+ };
4095
+ const isSelectable = !!onSelect;
4096
+ const getQuestionsText = (count) => {
4097
+ const singular = count === 1 ? "quest\xE3o" : "quest\xF5es";
4098
+ return `${count} ${singular}`;
4099
+ };
4100
+ const displayInfo = questionsCount ? getQuestionsText(questionsCount) : additionalInfo || "";
4101
+ 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";
4102
+ const interactiveClasses = isSelectable ? "cursor-pointer focus:outline-none focus:ring-2 focus:ring-primary-950 focus:ring-offset-2" : "";
4103
+ const selectedClasses = selected ? "ring-2 ring-primary-950 ring-offset-2" : "";
4104
+ if (isSelectable) {
4105
+ return /* @__PURE__ */ jsx18(
4106
+ "button",
4107
+ {
4108
+ ref,
4109
+ type: "button",
4110
+ className: cn(
4111
+ `${baseClasses} ${interactiveClasses} ${selectedClasses} ${className}`.trim()
4112
+ ),
4113
+ onClick: handleClick,
4114
+ onKeyDown: handleKeyDown,
4115
+ "aria-pressed": selected,
4116
+ ...props,
4117
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
4118
+ /* @__PURE__ */ jsx18(
4119
+ Text_default,
4120
+ {
4121
+ size: "md",
4122
+ weight: "bold",
4123
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
4124
+ children: title
4125
+ }
4126
+ ),
4127
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
4128
+ duration && /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
4129
+ /* @__PURE__ */ jsx18(Clock, { size: 16, className: "text-text-700" }),
4130
+ /* @__PURE__ */ jsx18(
4131
+ Text_default,
4132
+ {
4133
+ size: "sm",
4134
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
4135
+ children: duration
4136
+ }
4137
+ )
4138
+ ] }),
4139
+ /* @__PURE__ */ jsx18(
4140
+ Text_default,
4141
+ {
4142
+ size: "sm",
4143
+ className: "text-text-700 leading-[21px] flex-grow truncate",
4144
+ children: displayInfo
4145
+ }
4146
+ )
4147
+ ] })
4148
+ ] })
4149
+ }
4150
+ );
4151
+ }
4152
+ return /* @__PURE__ */ jsx18(
4153
+ "div",
4154
+ {
4155
+ ref,
4156
+ className: cn(`${baseClasses} ${className}`.trim()),
4157
+ ...props,
4158
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col justify-between gap-[27px] flex-grow min-h-[67px] w-full min-w-0", children: [
4159
+ /* @__PURE__ */ jsx18(
4160
+ Text_default,
4161
+ {
4162
+ size: "md",
4163
+ weight: "bold",
4164
+ className: "text-text-950 tracking-[0.2px] leading-[19px] truncate",
4165
+ children: title
4166
+ }
4167
+ ),
4168
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-row justify-start items-end gap-4 w-full", children: [
4169
+ duration && /* @__PURE__ */ jsxs14("div", { className: "flex flex-row items-center gap-1 flex-shrink-0", children: [
4170
+ /* @__PURE__ */ jsx18(Clock, { size: 16, className: "text-text-700" }),
4171
+ /* @__PURE__ */ jsx18(
4172
+ Text_default,
4173
+ {
4174
+ size: "sm",
4175
+ className: "text-text-700 leading-[21px] whitespace-nowrap",
4176
+ children: duration
4177
+ }
4178
+ )
4179
+ ] }),
4180
+ /* @__PURE__ */ jsx18(
4181
+ Text_default,
4182
+ {
4183
+ size: "sm",
4184
+ className: "text-text-700 leading-[21px] flex-grow truncate min-w-0",
4185
+ children: displayInfo
4186
+ }
4187
+ )
4188
+ ] })
4189
+ ] })
4190
+ }
4191
+ );
4192
+ }
4193
+ );
4194
+ var SIMULATION_TYPE_STYLES = {
4195
+ enem: {
4196
+ background: "bg-exam-1",
4197
+ badge: "exam1",
4198
+ text: "Enem"
4199
+ },
4200
+ prova: {
4201
+ background: "bg-exam-2",
4202
+ badge: "exam2",
4203
+ text: "Prova"
4204
+ },
4205
+ simulado: {
4206
+ background: "bg-exam-3",
4207
+ badge: "exam3",
4208
+ text: "Simulad\xE3o"
4209
+ },
4210
+ vestibular: {
4211
+ background: "bg-exam-4",
4212
+ badge: "exam4",
4213
+ text: "Vestibular"
4214
+ }
4215
+ };
4216
+ var CardSimulationHistory = forwardRef5(({ data, onSimulationClick, className, ...props }, ref) => {
4217
+ return /* @__PURE__ */ jsx18(
4218
+ "div",
4219
+ {
4220
+ ref,
4221
+ className: cn("w-full max-w-[992px] h-auto", className),
4222
+ ...props,
4223
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-0", children: [
4224
+ data.map((section, sectionIndex) => /* @__PURE__ */ jsx18("div", { className: "flex flex-col", children: /* @__PURE__ */ jsxs14(
4225
+ "div",
4226
+ {
4227
+ className: cn(
4228
+ "flex flex-row justify-center items-start px-4 py-6 gap-2 w-full bg-background",
4229
+ sectionIndex === 0 ? "rounded-t-3xl" : ""
4230
+ ),
4231
+ children: [
4232
+ /* @__PURE__ */ jsx18(
4233
+ Text_default,
4234
+ {
4235
+ size: "xs",
4236
+ weight: "bold",
4237
+ className: "text-text-800 w-11 flex-shrink-0",
4238
+ children: section.date
4239
+ }
4240
+ ),
4241
+ /* @__PURE__ */ jsx18("div", { className: "flex flex-col gap-2 flex-1", children: section.simulations.map((simulation) => {
4242
+ const typeStyles = SIMULATION_TYPE_STYLES[simulation.type];
4243
+ return /* @__PURE__ */ jsx18(
4244
+ CardBase,
4245
+ {
4246
+ layout: "horizontal",
4247
+ padding: "medium",
4248
+ minHeight: "none",
4249
+ cursor: "pointer",
4250
+ className: cn(
4251
+ `${typeStyles.background} rounded-xl hover:shadow-soft-shadow-2
4252
+ transition-shadow duration-200 h-auto min-h-[61px]`
4253
+ ),
4254
+ onClick: () => onSimulationClick?.(simulation),
4255
+ children: /* @__PURE__ */ jsxs14("div", { className: "flex justify-between items-center w-full gap-2", children: [
4256
+ /* @__PURE__ */ jsxs14("div", { className: "flex flex-wrap flex-col justify-between sm:flex-row gap-2 flex-1 min-w-0", children: [
4257
+ /* @__PURE__ */ jsx18(
4258
+ Text_default,
4259
+ {
4260
+ size: "lg",
4261
+ weight: "bold",
4262
+ className: "text-text-950 truncate",
4263
+ children: simulation.title
4264
+ }
4265
+ ),
4266
+ /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
4267
+ /* @__PURE__ */ jsx18(
4268
+ Badge_default,
4269
+ {
4270
+ variant: "examsOutlined",
4271
+ action: typeStyles.badge,
4272
+ size: "medium",
4273
+ children: typeStyles.text
4274
+ }
4275
+ ),
4276
+ /* @__PURE__ */ jsx18(Text_default, { size: "sm", className: "text-text-800 truncate", children: simulation.info })
4277
+ ] })
4278
+ ] }),
4279
+ /* @__PURE__ */ jsx18(
4280
+ CaretRight2,
4281
+ {
4282
+ size: 24,
4283
+ className: "text-text-800 flex-shrink-0",
4284
+ "data-testid": "caret-icon"
4285
+ }
4286
+ )
4287
+ ] })
4288
+ },
4289
+ simulation.id
4290
+ );
4291
+ }) })
4292
+ ]
4293
+ }
4294
+ ) }, section.date)),
4295
+ data.length > 0 && /* @__PURE__ */ jsx18("div", { className: "w-full h-6 bg-background rounded-b-3xl" })
4296
+ ] })
4297
+ }
4298
+ );
4299
+ });
4300
+
4301
+ // src/components/Accordation/Accordation.tsx
4302
+ import {
4303
+ forwardRef as forwardRef6,
4304
+ useId as useId4,
4305
+ useState as useState7,
4306
+ useEffect as useEffect8
4307
+ } from "react";
4308
+ import { CaretRight as CaretRight3 } from "phosphor-react";
4309
+ import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
4310
+ var CardAccordation = forwardRef6(
4311
+ ({
4312
+ trigger,
4313
+ children,
4314
+ className,
4315
+ defaultExpanded = false,
4316
+ expanded: controlledExpanded,
4317
+ onToggleExpanded,
4318
+ value,
4319
+ disabled = false,
4320
+ ...props
4321
+ }, ref) => {
4322
+ const [internalExpanded, setInternalExpanded] = useState7(defaultExpanded);
4323
+ const generatedId = useId4();
4324
+ const contentId = value ? `accordion-content-${value}` : generatedId;
4325
+ const headerId = value ? `accordion-header-${value}` : `${generatedId}-header`;
4326
+ const isControlled = controlledExpanded !== void 0;
4327
+ const isExpanded = isControlled ? controlledExpanded : internalExpanded;
4328
+ useEffect8(() => {
4329
+ if (isControlled) {
4330
+ setInternalExpanded(controlledExpanded);
4331
+ }
4332
+ }, [isControlled, controlledExpanded]);
4333
+ const handleToggle = () => {
4334
+ if (disabled) return;
4335
+ const newExpanded = !isExpanded;
4336
+ if (!isControlled) {
4337
+ setInternalExpanded(newExpanded);
4338
+ }
4339
+ onToggleExpanded?.(newExpanded);
4340
+ };
4341
+ const handleKeyDown = (event) => {
4342
+ if (disabled) return;
4343
+ if (event.key === "Enter" || event.key === " ") {
4344
+ event.preventDefault();
4345
+ handleToggle();
4346
+ }
4347
+ };
4348
+ return /* @__PURE__ */ jsxs15(
4349
+ CardBase,
4350
+ {
4351
+ ref,
4352
+ layout: "vertical",
4353
+ padding: "none",
4354
+ minHeight: "none",
4355
+ className: cn("overflow-hidden", className),
4356
+ ...props,
4357
+ children: [
4358
+ /* @__PURE__ */ jsxs15(
4359
+ "button",
4360
+ {
4361
+ id: headerId,
4362
+ type: "button",
4363
+ onClick: handleToggle,
4364
+ onKeyDown: handleKeyDown,
4365
+ disabled,
4366
+ className: cn(
4367
+ "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",
4368
+ disabled && "cursor-not-allowed text-text-400"
4369
+ ),
4370
+ "aria-expanded": isExpanded,
4371
+ "aria-controls": contentId,
4372
+ "aria-disabled": disabled,
4373
+ "data-value": value,
4374
+ children: [
4375
+ trigger,
4376
+ /* @__PURE__ */ jsx19(
4377
+ CaretRight3,
4378
+ {
4379
+ size: 20,
4380
+ className: cn(
4381
+ "transition-transform duration-200 flex-shrink-0",
4382
+ disabled ? "text-gray-400" : "text-text-700",
4383
+ isExpanded ? "rotate-90" : "rotate-0"
4384
+ ),
4385
+ "data-testid": "accordion-caret"
4386
+ }
4387
+ )
4388
+ ]
4389
+ }
4390
+ ),
4391
+ /* @__PURE__ */ jsx19(
4392
+ "section",
4393
+ {
4394
+ id: contentId,
4395
+ "aria-labelledby": headerId,
4396
+ "aria-hidden": !isExpanded,
4397
+ className: cn(
4398
+ "transition-all duration-300 ease-in-out overflow-hidden",
4399
+ isExpanded ? "max-h-screen opacity-100" : "max-h-0 opacity-0"
4400
+ ),
4401
+ "data-testid": "accordion-content",
4402
+ "data-value": value,
4403
+ children: /* @__PURE__ */ jsx19("div", { className: "p-4 pt-0", children })
4404
+ }
4405
+ )
4406
+ ]
4407
+ }
4408
+ );
4409
+ }
4410
+ );
4411
+ CardAccordation.displayName = "CardAccordation";
4412
+
4413
+ // src/components/Accordation/AccordionGroup.tsx
4414
+ import {
4415
+ Children as Children3,
4416
+ cloneElement as cloneElement4,
4417
+ forwardRef as forwardRef7,
4418
+ isValidElement as isValidElement3,
4419
+ useEffect as useEffect9,
4420
+ useRef as useRef5,
4421
+ useState as useState8
4422
+ } from "react";
4423
+ import { create as create4 } from "zustand";
4424
+ import { jsx as jsx20 } from "react/jsx-runtime";
4425
+ function createAccordionGroupStore(type, initialValue, collapsible) {
4426
+ return create4((set, get) => ({
4427
+ type,
4428
+ value: initialValue,
4429
+ collapsible,
4430
+ setValue: (value) => set({ value }),
4431
+ isItemExpanded: (itemValue) => {
4432
+ const state = get();
4433
+ if (state.type === "single") {
4434
+ return state.value === itemValue;
4435
+ } else {
4436
+ return Array.isArray(state.value) && state.value.includes(itemValue);
4437
+ }
4438
+ }
4439
+ }));
4440
+ }
4441
+ var injectStore3 = (children, store, indexRef, onItemToggle) => {
4442
+ return Children3.map(children, (child) => {
4443
+ if (!isValidElement3(child)) {
4444
+ return child;
4445
+ }
4446
+ const typedChild = child;
4447
+ const displayName = typedChild.type?.displayName;
4448
+ let newProps = {};
4449
+ if (displayName === "CardAccordation") {
4450
+ const itemValue = typedChild.props.value || `accordion-item-${indexRef.current++}`;
4451
+ const storeState = store.getState();
4452
+ const expanded = storeState.isItemExpanded(itemValue);
4453
+ newProps.value = itemValue;
4454
+ newProps.expanded = expanded;
4455
+ newProps.onToggleExpanded = (isExpanded) => {
4456
+ onItemToggle(itemValue, isExpanded);
4457
+ typedChild.props.onToggleExpanded?.(isExpanded);
4458
+ };
4459
+ }
4460
+ if (typedChild.props.children) {
4461
+ const processedChildren = injectStore3(
4462
+ typedChild.props.children,
4463
+ store,
4464
+ indexRef,
4465
+ onItemToggle
4466
+ );
4467
+ if (displayName === "CardAccordation") {
4468
+ newProps.children = processedChildren;
4469
+ } else if (processedChildren !== typedChild.props.children) {
4470
+ return cloneElement4(typedChild, { children: processedChildren });
4471
+ }
4472
+ }
4473
+ if (Object.keys(newProps).length > 0) {
4474
+ return cloneElement4(typedChild, newProps);
4475
+ }
4476
+ return child;
4477
+ });
4478
+ };
4479
+ var AccordionGroup = forwardRef7(
4480
+ ({
4481
+ type = "single",
4482
+ defaultValue,
4483
+ value: controlledValue,
4484
+ onValueChange,
4485
+ collapsible = true,
4486
+ children,
4487
+ className,
4488
+ ...props
4489
+ }, ref) => {
4490
+ const [internalValue, setInternalValue] = useState8(
4491
+ defaultValue || (type === "single" ? "" : [])
4492
+ );
4493
+ const isControlled = controlledValue !== void 0;
4494
+ const currentValue = isControlled ? controlledValue : internalValue;
4495
+ const storeRef = useRef5(null);
4496
+ if (storeRef.current) {
4497
+ storeRef.current.setState((prev) => {
4498
+ const nextState = {};
4499
+ if (prev.type !== type) {
4500
+ nextState.type = type;
4501
+ }
4502
+ if (prev.collapsible !== collapsible) {
4503
+ nextState.collapsible = collapsible;
4504
+ }
4505
+ return nextState;
4506
+ });
4507
+ } else {
4508
+ storeRef.current = createAccordionGroupStore(
4509
+ type,
4510
+ currentValue,
4511
+ collapsible
4512
+ );
4513
+ }
4514
+ const store = storeRef.current;
4515
+ useEffect9(() => {
4516
+ store.setState({ value: currentValue });
4517
+ }, [currentValue, store]);
4518
+ useEffect9(() => {
4519
+ if (!isControlled) {
4520
+ setInternalValue((prev) => {
4521
+ if (type === "single") {
4522
+ if (Array.isArray(prev)) {
4523
+ return prev[0] ?? "";
4524
+ }
4525
+ return typeof prev === "string" ? prev : "";
4526
+ }
4527
+ if (Array.isArray(prev)) {
4528
+ return prev;
4529
+ }
4530
+ return prev ? [prev] : [];
4531
+ });
4532
+ }
4533
+ }, [isControlled, type]);
4534
+ const handleItemToggle = (itemValue, isExpanded) => {
4535
+ const storeState = store.getState();
4536
+ let newValue;
4537
+ if (type === "single") {
4538
+ if (isExpanded) {
4539
+ newValue = itemValue;
4540
+ } else {
4541
+ newValue = collapsible ? "" : storeState.value;
4542
+ }
4543
+ } else {
4544
+ const currentArray = Array.isArray(storeState.value) ? storeState.value : [];
4545
+ if (isExpanded) {
4546
+ newValue = [...currentArray, itemValue];
4547
+ } else {
4548
+ newValue = currentArray.filter((v) => v !== itemValue);
4549
+ }
4550
+ }
4551
+ if (!isControlled) {
4552
+ setInternalValue(newValue);
4553
+ }
4554
+ store.setState({ value: newValue });
4555
+ onValueChange?.(newValue);
4556
+ };
4557
+ const indexRef = { current: 0 };
4558
+ const enhancedChildren = injectStore3(
4559
+ children,
4560
+ store,
4561
+ indexRef,
4562
+ handleItemToggle
4563
+ );
4564
+ return /* @__PURE__ */ jsx20("div", { ref, className, ...props, children: enhancedChildren });
4565
+ }
4566
+ );
4567
+ AccordionGroup.displayName = "AccordionGroup";
4568
+
4569
+ // src/components/ActivityFilters/ActivityFilters.tsx
4570
+ import { jsx as jsx21, jsxs as jsxs16 } from "react/jsx-runtime";
4571
+ var questionTypes = [
4572
+ "ALTERNATIVA" /* ALTERNATIVA */,
4573
+ "VERDADEIRO_FALSO" /* VERDADEIRO_FALSO */,
4574
+ "DISSERTATIVA" /* DISSERTATIVA */,
4575
+ "IMAGEM" /* IMAGEM */,
4576
+ "MULTIPLA_ESCOLHA" /* MULTIPLA_ESCOLHA */,
4577
+ "LIGAR_PONTOS" /* LIGAR_PONTOS */,
4578
+ "PREENCHER" /* PREENCHER */
4579
+ ];
4580
+ var QuestionTypeFilter = ({
4581
+ selectedTypes,
4582
+ onToggleType
4583
+ }) => {
4584
+ return /* @__PURE__ */ jsxs16("div", { children: [
4585
+ /* @__PURE__ */ jsx21(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tipo de quest\xE3o" }),
4586
+ /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-2 gap-2", children: questionTypes.map((questionType) => /* @__PURE__ */ jsx21(
4587
+ Chips_default,
4588
+ {
4589
+ selected: selectedTypes.includes(questionType),
4590
+ onClick: () => onToggleType(questionType),
4591
+ children: questionTypeLabels[questionType]
4592
+ },
4593
+ questionType
4594
+ )) })
4595
+ ] });
4596
+ };
4597
+ var BanksFilter = ({
4598
+ banks,
4599
+ selectedBanks,
4600
+ onToggleBank,
4601
+ loading = false,
4602
+ error = null
4603
+ }) => {
4604
+ if (loading) {
4605
+ return /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600", children: "Carregando bancas..." });
4606
+ }
4607
+ if (error) {
4608
+ return /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600", children: error });
4609
+ }
4610
+ if (banks.length === 0) {
4611
+ return /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600", children: "Nenhuma banca encontrada" });
4612
+ }
4613
+ return /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-2 gap-2", children: banks.map((bank) => /* @__PURE__ */ jsx21(
4614
+ Chips_default,
4615
+ {
4616
+ selected: selectedBanks.includes(bank.examInstitution),
4617
+ onClick: () => onToggleBank(bank.examInstitution),
4618
+ children: bank.examInstitution
4619
+ },
4620
+ bank.examInstitution
4621
+ )) });
4622
+ };
4623
+ var SubjectsFilter = ({
4624
+ knowledgeAreas,
4625
+ selectedSubject,
4626
+ onSubjectChange,
4627
+ loading = false,
4628
+ error = null
4629
+ }) => {
4630
+ const { isDark } = useTheme();
4631
+ if (loading) {
4632
+ return /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600", children: "Carregando mat\xE9rias..." });
4633
+ }
4634
+ if (error) {
4635
+ return /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600", children: error });
4636
+ }
4637
+ return /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-3 gap-3", children: knowledgeAreas.map((area) => /* @__PURE__ */ jsx21(
4638
+ Radio_default,
4639
+ {
4640
+ value: area.id,
4641
+ checked: selectedSubject === area.id,
4642
+ onChange: () => onSubjectChange(area.id),
4643
+ label: /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 w-full min-w-0", children: [
4644
+ /* @__PURE__ */ jsx21(
4645
+ "span",
4646
+ {
4647
+ className: "size-4 rounded-sm flex items-center justify-center shrink-0 text-text-950",
4648
+ style: {
4649
+ backgroundColor: getSubjectColorWithOpacity(
4650
+ area.color,
4651
+ isDark
4652
+ )
4653
+ },
4654
+ children: /* @__PURE__ */ jsx21(
4655
+ IconRender_default,
4656
+ {
4657
+ iconName: area.icon || "BookOpen",
4658
+ size: 14,
4659
+ color: "currentColor"
4660
+ }
4661
+ )
4662
+ }
4663
+ ),
4664
+ /* @__PURE__ */ jsx21("span", { className: "truncate flex-1", children: area.name })
4665
+ ] })
4666
+ },
4667
+ area.id
4668
+ )) });
4669
+ };
4670
+ var KnowledgeSummary = ({
4671
+ knowledgeStructure,
4672
+ selectedKnowledgeSummary
4673
+ }) => {
4674
+ return /* @__PURE__ */ jsxs16("div", { className: "mt-4 p-3 bg-background-50 rounded-lg border border-border-200", children: [
4675
+ /* @__PURE__ */ jsx21(Text_default, { size: "sm", weight: "bold", className: "mb-2 block", children: "Resumo da sele\xE7\xE3o" }),
4676
+ /* @__PURE__ */ jsxs16("div", { className: "flex flex-col gap-2", children: [
4677
+ knowledgeStructure.topics.length === 1 && /* @__PURE__ */ jsxs16("div", { children: [
4678
+ /* @__PURE__ */ jsx21(Text_default, { size: "xs", weight: "medium", className: "text-text-600", children: "Tema:" }),
4679
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1 mt-1", children: selectedKnowledgeSummary.topics.map((topic) => /* @__PURE__ */ jsx21(Chips_default, { selected: true, children: topic }, topic)) })
4680
+ ] }),
4681
+ knowledgeStructure.subtopics.length === 1 && /* @__PURE__ */ jsxs16("div", { children: [
4682
+ /* @__PURE__ */ jsx21(Text_default, { size: "xs", weight: "medium", className: "text-text-600", children: "Subtema:" }),
4683
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1 mt-1", children: selectedKnowledgeSummary.subtopics.map((subtopic) => /* @__PURE__ */ jsx21(Chips_default, { selected: true, children: subtopic }, subtopic)) })
4684
+ ] }),
4685
+ knowledgeStructure.contents.length === 1 && /* @__PURE__ */ jsxs16("div", { children: [
4686
+ /* @__PURE__ */ jsx21(Text_default, { size: "xs", weight: "medium", className: "text-text-600", children: "Assunto:" }),
4687
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-wrap gap-1 mt-1", children: selectedKnowledgeSummary.contents.map((content) => /* @__PURE__ */ jsx21(Chips_default, { selected: true, children: content }, content)) })
4688
+ ] })
4689
+ ] })
4690
+ ] });
4691
+ };
4692
+ var KnowledgeStructureFilter = ({
4693
+ knowledgeStructure,
4694
+ knowledgeCategories,
4695
+ handleCategoriesChange,
4696
+ selectedKnowledgeSummary = {
4697
+ topics: [],
4698
+ subtopics: [],
4699
+ contents: []
4700
+ },
4701
+ enableSummary = false
4702
+ }) => {
4703
+ return /* @__PURE__ */ jsxs16("div", { className: "mt-4", children: [
4704
+ /* @__PURE__ */ jsx21(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Tema, Subtema e Assunto" }),
4705
+ knowledgeStructure.loading && /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600 mb-3", children: "Carregando estrutura de conhecimento..." }),
4706
+ knowledgeStructure.error && /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "mb-3 text-error-500", children: knowledgeStructure.error }),
4707
+ knowledgeCategories.length > 0 && handleCategoriesChange && /* @__PURE__ */ jsx21(
4708
+ CheckboxGroup,
4709
+ {
4710
+ categories: knowledgeCategories,
4711
+ onCategoriesChange: handleCategoriesChange
4712
+ }
4713
+ ),
4714
+ !knowledgeStructure.loading && knowledgeCategories.length === 0 && knowledgeStructure.topics.length === 0 && /* @__PURE__ */ jsx21(Text_default, { size: "sm", className: "text-text-600", children: "Nenhum tema dispon\xEDvel para as mat\xE9rias selecionadas" }),
4715
+ enableSummary && /* @__PURE__ */ jsx21(
4716
+ KnowledgeSummary,
4717
+ {
4718
+ knowledgeStructure,
4719
+ selectedKnowledgeSummary
4720
+ }
4721
+ )
4722
+ ] });
4723
+ };
4724
+ var FilterActions = ({
4725
+ onClearFilters,
4726
+ onApplyFilters
4727
+ }) => {
4728
+ if (!onClearFilters && !onApplyFilters) {
4729
+ return null;
4730
+ }
4731
+ return /* @__PURE__ */ jsxs16("div", { className: "grid grid-cols-2 gap-2 justify-end mt-4 px-4 pt-4 border-t border-border-200", children: [
4732
+ onClearFilters && /* @__PURE__ */ jsx21(Button_default, { variant: "link", onClick: onClearFilters, size: "small", children: "Limpar filtros" }),
4733
+ onApplyFilters && /* @__PURE__ */ jsx21(Button_default, { variant: "outline", onClick: onApplyFilters, size: "small", children: "Filtrar" })
4734
+ ] });
4735
+ };
4736
+ var ActivityFilters = ({
4737
+ onFiltersChange,
4738
+ variant = "default",
4739
+ // Data
4740
+ banks = [],
4741
+ knowledgeAreas = [],
4742
+ knowledgeStructure = {
4743
+ topics: [],
4744
+ subtopics: [],
4745
+ contents: [],
4746
+ loading: false,
4747
+ error: null
4748
+ },
4749
+ knowledgeCategories = [],
4750
+ // Loading states
4751
+ loadingBanks = false,
4752
+ loadingKnowledge: _loadingKnowledge = false,
4753
+ loadingSubjects = false,
4754
+ // Errors
4755
+ banksError = null,
4756
+ subjectsError = null,
4757
+ // Load functions
4758
+ loadBanks,
4759
+ loadKnowledge,
4760
+ loadTopics,
4761
+ loadSubtopics: _loadSubtopics,
4762
+ loadContents: _loadContents,
4763
+ // Handlers
4764
+ handleCategoriesChange,
4765
+ selectedKnowledgeSummary = {
4766
+ topics: [],
4767
+ subtopics: [],
4768
+ contents: []
4769
+ },
4770
+ enableSummary = false,
4771
+ // Action buttons
4772
+ onClearFilters,
4773
+ onApplyFilters
4774
+ }) => {
4775
+ const [selectedQuestionTypes, setSelectedQuestionTypes] = useState9([]);
4776
+ const [selectedBanks, setSelectedBanks] = useState9([]);
4777
+ const [selectedSubject, setSelectedSubject] = useState9(null);
4778
+ const selectedSubjects = useMemo2(
4779
+ () => selectedSubject ? [selectedSubject] : [],
4780
+ [selectedSubject]
4781
+ );
4782
+ const toggleQuestionType = (questionType) => {
4783
+ setSelectedQuestionTypes((prev) => toggleArrayItem(prev, questionType));
4784
+ };
4785
+ const toggleBank = (bankName) => {
4786
+ setSelectedBanks((prev) => toggleArrayItem(prev, bankName));
4787
+ };
4788
+ const handleSubjectChange = (subjectId) => {
4789
+ setSelectedSubject(toggleSingleValue(selectedSubject, subjectId));
4790
+ };
4791
+ useEffect10(() => {
4792
+ if (loadBanks) {
4793
+ loadBanks();
4794
+ }
4795
+ if (loadKnowledge) {
4796
+ loadKnowledge();
4797
+ }
4798
+ }, [loadBanks, loadKnowledge]);
4799
+ useEffect10(() => {
4800
+ if (selectedSubject && loadTopics) {
4801
+ loadTopics([selectedSubject]);
4802
+ }
4803
+ }, [selectedSubject, loadTopics]);
4804
+ const getSelectedKnowledgeIds = useCallback(() => {
4805
+ return getSelectedIdsFromCategories(knowledgeCategories, {
4806
+ topicIds: "tema",
4807
+ subtopicIds: "subtema",
4808
+ contentIds: "assunto"
4809
+ });
4810
+ }, [knowledgeCategories]);
4811
+ useEffect10(() => {
4812
+ const knowledgeIds = getSelectedKnowledgeIds();
4813
+ const filters = {
4814
+ types: selectedQuestionTypes,
4815
+ bankIds: selectedBanks,
4816
+ knowledgeIds: selectedSubjects,
4817
+ topicIds: knowledgeIds.topicIds,
4818
+ subtopicIds: knowledgeIds.subtopicIds,
4819
+ contentIds: knowledgeIds.contentIds
4820
+ };
4821
+ onFiltersChange(filters);
4822
+ }, [
4823
+ selectedQuestionTypes,
4824
+ selectedBanks,
4825
+ selectedSubjects,
4826
+ knowledgeCategories,
4827
+ getSelectedKnowledgeIds,
4828
+ onFiltersChange
4829
+ ]);
4830
+ const containerClassName = variant === "popover" ? "w-full bg-background" : "w-[400px] flex-shrink-0 p-4 bg-background";
4831
+ const contentClassName = variant === "popover" ? "p-4" : "";
4832
+ return /* @__PURE__ */ jsxs16("div", { className: containerClassName, children: [
4833
+ variant === "default" && /* @__PURE__ */ jsx21("section", { className: "flex flex-row items-center gap-2 text-text-950 mb-4", children: /* @__PURE__ */ jsx21(Text_default, { size: "lg", weight: "bold", children: "Filtro de quest\xF5es" }) }),
4834
+ /* @__PURE__ */ jsx21("div", { className: contentClassName, children: /* @__PURE__ */ jsxs16("section", { className: "flex flex-col gap-4", children: [
4835
+ /* @__PURE__ */ jsx21(
4836
+ QuestionTypeFilter,
4837
+ {
4838
+ selectedTypes: selectedQuestionTypes,
4839
+ onToggleType: toggleQuestionType
4840
+ }
4841
+ ),
4842
+ /* @__PURE__ */ jsxs16("div", { children: [
4843
+ /* @__PURE__ */ jsx21(Text_default, { size: "sm", weight: "bold", className: "mb-3 block", children: "Banca de vestibular" }),
4844
+ /* @__PURE__ */ jsx21(
4845
+ BanksFilter,
4846
+ {
4847
+ banks,
4848
+ selectedBanks,
4849
+ onToggleBank: toggleBank,
4850
+ loading: loadingBanks,
4851
+ error: banksError
4852
+ }
4853
+ )
4854
+ ] }),
4855
+ /* @__PURE__ */ jsxs16("div", { children: [
4856
+ /* @__PURE__ */ jsx21("div", { className: "flex flex-row justify-between items-center mb-3", children: /* @__PURE__ */ jsx21(Text_default, { size: "sm", weight: "bold", children: "Mat\xE9ria" }) }),
4857
+ /* @__PURE__ */ jsx21(
4858
+ SubjectsFilter,
4859
+ {
4860
+ knowledgeAreas,
4861
+ selectedSubject,
4862
+ onSubjectChange: handleSubjectChange,
4863
+ loading: loadingSubjects,
4864
+ error: subjectsError
4865
+ }
4866
+ )
4867
+ ] }),
4868
+ selectedSubject && /* @__PURE__ */ jsx21(
4869
+ KnowledgeStructureFilter,
4870
+ {
4871
+ knowledgeStructure,
4872
+ knowledgeCategories,
4873
+ handleCategoriesChange,
4874
+ selectedKnowledgeSummary,
4875
+ enableSummary
4876
+ }
4877
+ ),
4878
+ /* @__PURE__ */ jsx21(
4879
+ FilterActions,
4880
+ {
4881
+ onClearFilters,
4882
+ onApplyFilters
4883
+ }
4884
+ )
4885
+ ] }) })
4886
+ ] });
4887
+ };
4888
+ var ActivityFiltersPopover = ({
4889
+ onFiltersChange,
4890
+ triggerLabel = "Filtro de quest\xF5es",
4891
+ ...activityFiltersProps
4892
+ }) => {
4893
+ const [open, setOpen] = useState9(false);
4894
+ return /* @__PURE__ */ jsxs16(DropdownMenu_default, { open, onOpenChange: setOpen, children: [
4895
+ /* @__PURE__ */ jsx21(DropdownMenuTrigger, { children: /* @__PURE__ */ jsx21(Button_default, { variant: "outline", children: triggerLabel }) }),
4896
+ /* @__PURE__ */ jsx21(
4897
+ DropdownMenuContent,
4898
+ {
4899
+ className: "w-[90vw] max-w-[400px] max-h-[calc(100vh-8rem)] overflow-y-auto p-0",
4900
+ align: "start",
4901
+ children: /* @__PURE__ */ jsx21(
4902
+ ActivityFilters,
4903
+ {
4904
+ onFiltersChange,
4905
+ variant: "popover",
4906
+ ...activityFiltersProps
4907
+ }
4908
+ )
4909
+ }
4910
+ )
4911
+ ] });
4912
+ };
4913
+ export {
4914
+ ActivityFilters,
4915
+ ActivityFiltersPopover
4916
+ };
4917
+ //# sourceMappingURL=index.mjs.map