analytica-frontend-lib 1.0.82 → 1.0.83

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 (40) hide show
  1. package/dist/Accordation/index.js +2 -2
  2. package/dist/Accordation/index.js.map +1 -1
  3. package/dist/Accordation/index.mjs +2 -2
  4. package/dist/Accordation/index.mjs.map +1 -1
  5. package/dist/AlertDialog/index.js +1 -1
  6. package/dist/AlertDialog/index.js.map +1 -1
  7. package/dist/AlertDialog/index.mjs +1 -1
  8. package/dist/AlertDialog/index.mjs.map +1 -1
  9. package/dist/Card/index.js +2 -2
  10. package/dist/Card/index.js.map +1 -1
  11. package/dist/Card/index.mjs +2 -2
  12. package/dist/Card/index.mjs.map +1 -1
  13. package/dist/Modal/index.js +1 -1
  14. package/dist/Modal/index.js.map +1 -1
  15. package/dist/Modal/index.mjs +1 -1
  16. package/dist/Modal/index.mjs.map +1 -1
  17. package/dist/Quiz/index.d.mts +29 -0
  18. package/dist/Quiz/index.d.ts +29 -0
  19. package/dist/Quiz/index.js +3662 -0
  20. package/dist/Quiz/index.js.map +1 -0
  21. package/dist/Quiz/index.mjs +3673 -0
  22. package/dist/Quiz/index.mjs.map +1 -0
  23. package/dist/Quiz/useQuizStore/index.d.mts +108 -0
  24. package/dist/Quiz/useQuizStore/index.d.ts +108 -0
  25. package/dist/Quiz/useQuizStore/index.js +274 -0
  26. package/dist/Quiz/useQuizStore/index.js.map +1 -0
  27. package/dist/Quiz/useQuizStore/index.mjs +249 -0
  28. package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
  29. package/dist/index.css +53 -0
  30. package/dist/index.css.map +1 -1
  31. package/dist/index.d.mts +2 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.js +659 -4
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +657 -4
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/simulated-result-QN5HCUY5.png +0 -0
  38. package/dist/styles.css +53 -0
  39. package/dist/styles.css.map +1 -1
  40. package/package.json +2 -1
@@ -0,0 +1,108 @@
1
+ import * as zustand from 'zustand';
2
+
3
+ interface Question {
4
+ id: string;
5
+ questionText: string;
6
+ correctOptionId: string;
7
+ description: string;
8
+ type: 'ALTERNATIVA' | 'DISSERTATIVA' | 'MULTIPLA_CHOICE';
9
+ status: 'APROVADO' | 'REPROVADO';
10
+ difficulty: 'FACIL' | 'MEDIO' | 'DIFICIL';
11
+ examBoard: string | null;
12
+ examYear: string | null;
13
+ answerKey: string | null;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ knowledgeMatrix: {
17
+ areaKnowledgeId: string;
18
+ subjectId: string;
19
+ topicId: string;
20
+ subtopicId: string;
21
+ contentId: string;
22
+ }[];
23
+ options: {
24
+ id: string;
25
+ option: string;
26
+ }[];
27
+ createdBy: string;
28
+ }
29
+ interface Simulado {
30
+ id: string;
31
+ title: string;
32
+ questions: Question[];
33
+ }
34
+ interface Atividade {
35
+ id: string;
36
+ title: string;
37
+ questions: Question[];
38
+ }
39
+ interface Aula {
40
+ id: string;
41
+ title: string;
42
+ questions: Question[];
43
+ }
44
+ interface UserAnswer extends Question {
45
+ isSkipped: boolean;
46
+ }
47
+ interface QuizState {
48
+ bySimulado?: Simulado;
49
+ byAtividade?: Atividade;
50
+ byAula?: Aula;
51
+ currentQuestionIndex: number;
52
+ selectedAnswers: Record<string, string>;
53
+ skippedQuestions: string[];
54
+ userAnswers: UserAnswer[];
55
+ timeElapsed: number;
56
+ isStarted: boolean;
57
+ isFinished: boolean;
58
+ setBySimulado: (simulado: Simulado) => void;
59
+ setByAtividade: (atividade: Atividade) => void;
60
+ setByAula: (aula: Aula) => void;
61
+ goToNextQuestion: () => void;
62
+ goToPreviousQuestion: () => void;
63
+ goToQuestion: (index: number) => void;
64
+ selectAnswer: (questionId: string, answerId: string) => void;
65
+ skipQuestion: () => void;
66
+ addUserAnswer: (questionId: string, answerId?: string) => void;
67
+ startQuiz: () => void;
68
+ finishQuiz: () => void;
69
+ resetQuiz: () => void;
70
+ updateTime: (time: number) => void;
71
+ startTimer: () => void;
72
+ stopTimer: () => void;
73
+ getCurrentQuestion: () => Question | null;
74
+ getTotalQuestions: () => number;
75
+ getAnsweredQuestions: () => number;
76
+ getUnansweredQuestions: () => number[];
77
+ getSkippedQuestions: () => number;
78
+ getProgress: () => number;
79
+ isQuestionAnswered: (questionId: string) => boolean;
80
+ isQuestionSkipped: (questionId: string) => boolean;
81
+ getCurrentAnswer: () => string | undefined;
82
+ getQuizTitle: () => string;
83
+ formatTime: (seconds: number) => string;
84
+ getUserAnswers: () => UserAnswer[];
85
+ getUnansweredQuestionsFromUserAnswers: () => number[];
86
+ getQuestionsGroupedBySubject: () => {
87
+ [key: string]: Question[];
88
+ };
89
+ }
90
+ declare const useQuizStore: zustand.UseBoundStore<Omit<zustand.StoreApi<QuizState>, "setState" | "devtools"> & {
91
+ setState(partial: QuizState | Partial<QuizState> | ((state: QuizState) => QuizState | Partial<QuizState>), replace?: false | undefined, action?: (string | {
92
+ [x: string]: unknown;
93
+ [x: number]: unknown;
94
+ [x: symbol]: unknown;
95
+ type: string;
96
+ }) | undefined): void;
97
+ setState(state: QuizState | ((state: QuizState) => QuizState), replace: true, action?: (string | {
98
+ [x: string]: unknown;
99
+ [x: number]: unknown;
100
+ [x: symbol]: unknown;
101
+ type: string;
102
+ }) | undefined): void;
103
+ devtools: {
104
+ cleanup: () => void;
105
+ };
106
+ }>;
107
+
108
+ export { useQuizStore };
@@ -0,0 +1,108 @@
1
+ import * as zustand from 'zustand';
2
+
3
+ interface Question {
4
+ id: string;
5
+ questionText: string;
6
+ correctOptionId: string;
7
+ description: string;
8
+ type: 'ALTERNATIVA' | 'DISSERTATIVA' | 'MULTIPLA_CHOICE';
9
+ status: 'APROVADO' | 'REPROVADO';
10
+ difficulty: 'FACIL' | 'MEDIO' | 'DIFICIL';
11
+ examBoard: string | null;
12
+ examYear: string | null;
13
+ answerKey: string | null;
14
+ createdAt: string;
15
+ updatedAt: string;
16
+ knowledgeMatrix: {
17
+ areaKnowledgeId: string;
18
+ subjectId: string;
19
+ topicId: string;
20
+ subtopicId: string;
21
+ contentId: string;
22
+ }[];
23
+ options: {
24
+ id: string;
25
+ option: string;
26
+ }[];
27
+ createdBy: string;
28
+ }
29
+ interface Simulado {
30
+ id: string;
31
+ title: string;
32
+ questions: Question[];
33
+ }
34
+ interface Atividade {
35
+ id: string;
36
+ title: string;
37
+ questions: Question[];
38
+ }
39
+ interface Aula {
40
+ id: string;
41
+ title: string;
42
+ questions: Question[];
43
+ }
44
+ interface UserAnswer extends Question {
45
+ isSkipped: boolean;
46
+ }
47
+ interface QuizState {
48
+ bySimulado?: Simulado;
49
+ byAtividade?: Atividade;
50
+ byAula?: Aula;
51
+ currentQuestionIndex: number;
52
+ selectedAnswers: Record<string, string>;
53
+ skippedQuestions: string[];
54
+ userAnswers: UserAnswer[];
55
+ timeElapsed: number;
56
+ isStarted: boolean;
57
+ isFinished: boolean;
58
+ setBySimulado: (simulado: Simulado) => void;
59
+ setByAtividade: (atividade: Atividade) => void;
60
+ setByAula: (aula: Aula) => void;
61
+ goToNextQuestion: () => void;
62
+ goToPreviousQuestion: () => void;
63
+ goToQuestion: (index: number) => void;
64
+ selectAnswer: (questionId: string, answerId: string) => void;
65
+ skipQuestion: () => void;
66
+ addUserAnswer: (questionId: string, answerId?: string) => void;
67
+ startQuiz: () => void;
68
+ finishQuiz: () => void;
69
+ resetQuiz: () => void;
70
+ updateTime: (time: number) => void;
71
+ startTimer: () => void;
72
+ stopTimer: () => void;
73
+ getCurrentQuestion: () => Question | null;
74
+ getTotalQuestions: () => number;
75
+ getAnsweredQuestions: () => number;
76
+ getUnansweredQuestions: () => number[];
77
+ getSkippedQuestions: () => number;
78
+ getProgress: () => number;
79
+ isQuestionAnswered: (questionId: string) => boolean;
80
+ isQuestionSkipped: (questionId: string) => boolean;
81
+ getCurrentAnswer: () => string | undefined;
82
+ getQuizTitle: () => string;
83
+ formatTime: (seconds: number) => string;
84
+ getUserAnswers: () => UserAnswer[];
85
+ getUnansweredQuestionsFromUserAnswers: () => number[];
86
+ getQuestionsGroupedBySubject: () => {
87
+ [key: string]: Question[];
88
+ };
89
+ }
90
+ declare const useQuizStore: zustand.UseBoundStore<Omit<zustand.StoreApi<QuizState>, "setState" | "devtools"> & {
91
+ setState(partial: QuizState | Partial<QuizState> | ((state: QuizState) => QuizState | Partial<QuizState>), replace?: false | undefined, action?: (string | {
92
+ [x: string]: unknown;
93
+ [x: number]: unknown;
94
+ [x: symbol]: unknown;
95
+ type: string;
96
+ }) | undefined): void;
97
+ setState(state: QuizState | ((state: QuizState) => QuizState), replace: true, action?: (string | {
98
+ [x: string]: unknown;
99
+ [x: number]: unknown;
100
+ [x: symbol]: unknown;
101
+ type: string;
102
+ }) | undefined): void;
103
+ devtools: {
104
+ cleanup: () => void;
105
+ };
106
+ }>;
107
+
108
+ export { useQuizStore };
@@ -0,0 +1,274 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/components/Quiz/useQuizStore.ts
21
+ var useQuizStore_exports = {};
22
+ __export(useQuizStore_exports, {
23
+ useQuizStore: () => useQuizStore
24
+ });
25
+ module.exports = __toCommonJS(useQuizStore_exports);
26
+ var import_zustand = require("zustand");
27
+ var import_middleware = require("zustand/middleware");
28
+ var useQuizStore = (0, import_zustand.create)()(
29
+ (0, import_middleware.devtools)(
30
+ (set, get) => {
31
+ let timerInterval = null;
32
+ const startTimer = () => {
33
+ if (timerInterval) {
34
+ clearInterval(timerInterval);
35
+ }
36
+ timerInterval = setInterval(() => {
37
+ const { timeElapsed } = get();
38
+ set({ timeElapsed: timeElapsed + 1 });
39
+ }, 1e3);
40
+ };
41
+ const stopTimer = () => {
42
+ if (timerInterval) {
43
+ clearInterval(timerInterval);
44
+ timerInterval = null;
45
+ }
46
+ };
47
+ return {
48
+ // Initial State
49
+ currentQuestionIndex: 0,
50
+ selectedAnswers: {},
51
+ skippedQuestions: [],
52
+ userAnswers: [],
53
+ timeElapsed: 0,
54
+ isStarted: false,
55
+ isFinished: false,
56
+ // Setters
57
+ setBySimulado: (simulado) => set({ bySimulado: simulado }),
58
+ setByAtividade: (atividade) => set({ byAtividade: atividade }),
59
+ setByAula: (aula) => set({ byAula: aula }),
60
+ // Navigation
61
+ goToNextQuestion: () => {
62
+ const { currentQuestionIndex, getTotalQuestions } = get();
63
+ const totalQuestions = getTotalQuestions();
64
+ if (currentQuestionIndex < totalQuestions - 1) {
65
+ set({ currentQuestionIndex: currentQuestionIndex + 1 });
66
+ }
67
+ },
68
+ goToPreviousQuestion: () => {
69
+ const { currentQuestionIndex } = get();
70
+ if (currentQuestionIndex > 0) {
71
+ set({ currentQuestionIndex: currentQuestionIndex - 1 });
72
+ }
73
+ },
74
+ goToQuestion: (index) => {
75
+ const { getTotalQuestions } = get();
76
+ const totalQuestions = getTotalQuestions();
77
+ if (index >= 0 && index < totalQuestions) {
78
+ set({ currentQuestionIndex: index });
79
+ }
80
+ },
81
+ // Quiz Actions
82
+ selectAnswer: (questionId, answerId) => {
83
+ const { selectedAnswers, skippedQuestions, addUserAnswer } = get();
84
+ const newSkippedQuestions = skippedQuestions.filter(
85
+ (id) => id !== questionId
86
+ );
87
+ set({
88
+ selectedAnswers: {
89
+ ...selectedAnswers,
90
+ [questionId]: answerId
91
+ },
92
+ skippedQuestions: newSkippedQuestions
93
+ });
94
+ addUserAnswer(questionId, answerId);
95
+ },
96
+ skipQuestion: () => {
97
+ const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();
98
+ const currentQuestion = getCurrentQuestion();
99
+ if (currentQuestion) {
100
+ set({
101
+ skippedQuestions: [...skippedQuestions, currentQuestion.id]
102
+ });
103
+ addUserAnswer(currentQuestion.id);
104
+ }
105
+ },
106
+ addUserAnswer: (questionId, answerId) => {
107
+ const { userAnswers, bySimulado, byAtividade, byAula } = get();
108
+ const quiz = bySimulado || byAtividade || byAula;
109
+ const question = quiz?.questions.find((q) => q.id === questionId);
110
+ if (!question) return;
111
+ const existingAnswerIndex = userAnswers.findIndex(
112
+ (answer) => answer.id === questionId
113
+ );
114
+ if (existingAnswerIndex !== -1) {
115
+ const updatedAnswers = [...userAnswers];
116
+ updatedAnswers[existingAnswerIndex] = {
117
+ ...question,
118
+ answerKey: answerId || "",
119
+ isSkipped: !answerId
120
+ };
121
+ set({ userAnswers: updatedAnswers });
122
+ } else {
123
+ set({
124
+ userAnswers: [
125
+ ...userAnswers,
126
+ {
127
+ ...question,
128
+ answerKey: answerId || "",
129
+ isSkipped: !answerId
130
+ }
131
+ ]
132
+ });
133
+ }
134
+ },
135
+ startQuiz: () => {
136
+ set({ isStarted: true, timeElapsed: 0 });
137
+ startTimer();
138
+ },
139
+ finishQuiz: () => {
140
+ set({ isFinished: true });
141
+ stopTimer();
142
+ },
143
+ resetQuiz: () => {
144
+ stopTimer();
145
+ set({
146
+ currentQuestionIndex: 0,
147
+ selectedAnswers: {},
148
+ skippedQuestions: [],
149
+ userAnswers: [],
150
+ timeElapsed: 0,
151
+ isStarted: false,
152
+ isFinished: false
153
+ });
154
+ },
155
+ // Timer
156
+ updateTime: (time) => set({ timeElapsed: time }),
157
+ startTimer,
158
+ stopTimer,
159
+ // Getters
160
+ getCurrentQuestion: () => {
161
+ const { bySimulado, byAtividade, byAula, currentQuestionIndex } = get();
162
+ const quiz = bySimulado || byAtividade || byAula;
163
+ if (!quiz) {
164
+ return null;
165
+ }
166
+ return quiz.questions[currentQuestionIndex];
167
+ },
168
+ getTotalQuestions: () => {
169
+ const { bySimulado, byAtividade, byAula } = get();
170
+ const quiz = bySimulado || byAtividade || byAula;
171
+ return quiz?.questions?.length || 0;
172
+ },
173
+ getAnsweredQuestions: () => {
174
+ const { selectedAnswers } = get();
175
+ return Object.keys(selectedAnswers).length;
176
+ },
177
+ getUnansweredQuestions: () => {
178
+ const {
179
+ bySimulado,
180
+ byAtividade,
181
+ byAula,
182
+ selectedAnswers,
183
+ skippedQuestions
184
+ } = get();
185
+ const quiz = bySimulado || byAtividade || byAula;
186
+ if (!quiz) return [];
187
+ const unansweredQuestions = [];
188
+ quiz.questions.forEach((question, index) => {
189
+ const isAnswered = question.id in selectedAnswers;
190
+ const isSkipped = skippedQuestions.includes(question.id);
191
+ if (!isAnswered && !isSkipped) {
192
+ unansweredQuestions.push(index + 1);
193
+ }
194
+ });
195
+ return unansweredQuestions;
196
+ },
197
+ getSkippedQuestions: () => {
198
+ const { skippedQuestions } = get();
199
+ return skippedQuestions.length;
200
+ },
201
+ getProgress: () => {
202
+ const { getTotalQuestions, getAnsweredQuestions } = get();
203
+ const total = getTotalQuestions();
204
+ const answered = getAnsweredQuestions();
205
+ return total > 0 ? answered / total * 100 : 0;
206
+ },
207
+ isQuestionAnswered: (questionId) => {
208
+ const { selectedAnswers } = get();
209
+ return questionId in selectedAnswers;
210
+ },
211
+ isQuestionSkipped: (questionId) => {
212
+ const { skippedQuestions } = get();
213
+ return skippedQuestions.includes(questionId);
214
+ },
215
+ getCurrentAnswer: () => {
216
+ const { getCurrentQuestion, selectedAnswers } = get();
217
+ const currentQuestion = getCurrentQuestion();
218
+ return selectedAnswers[currentQuestion?.id || ""];
219
+ },
220
+ getQuizTitle: () => {
221
+ const { bySimulado, byAtividade, byAula } = get();
222
+ const quiz = bySimulado || byAtividade || byAula;
223
+ return quiz?.title || "Quiz";
224
+ },
225
+ formatTime: (seconds) => {
226
+ const minutes = Math.floor(seconds / 60);
227
+ const remainingSeconds = seconds % 60;
228
+ return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
229
+ },
230
+ getUserAnswers: () => {
231
+ const { userAnswers } = get();
232
+ return userAnswers;
233
+ },
234
+ getUnansweredQuestionsFromUserAnswers: () => {
235
+ const { bySimulado, byAtividade, byAula, userAnswers } = get();
236
+ const quiz = bySimulado || byAtividade || byAula;
237
+ if (!quiz) return [];
238
+ const unansweredQuestions = [];
239
+ quiz.questions.forEach((question, index) => {
240
+ const userAnswer = userAnswers.find(
241
+ (answer) => answer.id === question.id
242
+ );
243
+ if (!userAnswer || userAnswer.isSkipped) {
244
+ unansweredQuestions.push(index + 1);
245
+ }
246
+ });
247
+ return unansweredQuestions;
248
+ },
249
+ getQuestionsGroupedBySubject: () => {
250
+ const { bySimulado, byAtividade, byAula } = get();
251
+ const quiz = bySimulado || byAtividade || byAula;
252
+ if (!quiz) return {};
253
+ const groupedQuestions = {};
254
+ quiz.questions.forEach((question) => {
255
+ const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
256
+ if (!groupedQuestions[subjectId]) {
257
+ groupedQuestions[subjectId] = [];
258
+ }
259
+ groupedQuestions[subjectId].push(question);
260
+ });
261
+ return groupedQuestions;
262
+ }
263
+ };
264
+ },
265
+ {
266
+ name: "quiz-store"
267
+ }
268
+ )
269
+ );
270
+ // Annotate the CommonJS export names for ESM import in node:
271
+ 0 && (module.exports = {
272
+ useQuizStore
273
+ });
274
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/Quiz/useQuizStore.ts"],"sourcesContent":["import { create } from 'zustand';\nimport { devtools } from 'zustand/middleware';\n\ninterface Question {\n id: string;\n questionText: string;\n correctOptionId: string;\n description: string;\n type: 'ALTERNATIVA' | 'DISSERTATIVA' | 'MULTIPLA_CHOICE';\n status: 'APROVADO' | 'REPROVADO';\n difficulty: 'FACIL' | 'MEDIO' | 'DIFICIL';\n examBoard: string | null;\n examYear: string | null;\n answerKey: string | null;\n createdAt: string;\n updatedAt: string;\n knowledgeMatrix: {\n areaKnowledgeId: string;\n subjectId: string;\n topicId: string;\n subtopicId: string;\n contentId: string;\n }[];\n options: {\n id: string;\n option: string;\n }[];\n createdBy: string;\n}\n\ninterface Simulado {\n id: string;\n title: string;\n questions: Question[];\n}\n\ninterface Atividade {\n id: string;\n title: string;\n questions: Question[];\n}\n\ninterface Aula {\n id: string;\n title: string;\n questions: Question[];\n}\n\ninterface UserAnswer extends Question {\n isSkipped: boolean;\n}\n\ninterface QuizState {\n // Data\n bySimulado?: Simulado;\n byAtividade?: Atividade;\n byAula?: Aula;\n\n // UI State\n currentQuestionIndex: number;\n selectedAnswers: Record<string, string>;\n skippedQuestions: string[];\n userAnswers: UserAnswer[];\n timeElapsed: number;\n isStarted: boolean;\n isFinished: boolean;\n\n // Actions\n setBySimulado: (simulado: Simulado) => void;\n setByAtividade: (atividade: Atividade) => void;\n setByAula: (aula: Aula) => void;\n\n // Quiz Navigation\n goToNextQuestion: () => void;\n goToPreviousQuestion: () => void;\n goToQuestion: (index: number) => void;\n\n // Quiz Actions\n selectAnswer: (questionId: string, answerId: string) => void;\n skipQuestion: () => void;\n addUserAnswer: (questionId: string, answerId?: string) => void;\n startQuiz: () => void;\n finishQuiz: () => void;\n resetQuiz: () => void;\n\n // Timer\n updateTime: (time: number) => void;\n startTimer: () => void;\n stopTimer: () => void;\n\n // Getters\n getCurrentQuestion: () => Question | null;\n getTotalQuestions: () => number;\n getAnsweredQuestions: () => number;\n getUnansweredQuestions: () => number[];\n getSkippedQuestions: () => number;\n getProgress: () => number;\n isQuestionAnswered: (questionId: string) => boolean;\n isQuestionSkipped: (questionId: string) => boolean;\n getCurrentAnswer: () => string | undefined;\n getQuizTitle: () => string;\n formatTime: (seconds: number) => string;\n getUserAnswers: () => UserAnswer[];\n getUnansweredQuestionsFromUserAnswers: () => number[];\n getQuestionsGroupedBySubject: () => { [key: string]: Question[] };\n}\n\nexport const useQuizStore = create<QuizState>()(\n devtools(\n (set, get) => {\n let timerInterval: ReturnType<typeof setInterval> | null = null;\n\n const startTimer = () => {\n if (timerInterval) {\n clearInterval(timerInterval);\n }\n\n timerInterval = setInterval(() => {\n const { timeElapsed } = get();\n set({ timeElapsed: timeElapsed + 1 });\n }, 1000);\n };\n\n const stopTimer = () => {\n if (timerInterval) {\n clearInterval(timerInterval);\n timerInterval = null;\n }\n };\n\n return {\n // Initial State\n currentQuestionIndex: 0,\n selectedAnswers: {},\n skippedQuestions: [],\n userAnswers: [],\n timeElapsed: 0,\n isStarted: false,\n isFinished: false,\n\n // Setters\n setBySimulado: (simulado) => set({ bySimulado: simulado }),\n setByAtividade: (atividade) => set({ byAtividade: atividade }),\n setByAula: (aula) => set({ byAula: aula }),\n\n // Navigation\n goToNextQuestion: () => {\n const { currentQuestionIndex, getTotalQuestions } = get();\n const totalQuestions = getTotalQuestions();\n\n if (currentQuestionIndex < totalQuestions - 1) {\n set({ currentQuestionIndex: currentQuestionIndex + 1 });\n }\n },\n\n goToPreviousQuestion: () => {\n const { currentQuestionIndex } = get();\n\n if (currentQuestionIndex > 0) {\n set({ currentQuestionIndex: currentQuestionIndex - 1 });\n }\n },\n\n goToQuestion: (index) => {\n const { getTotalQuestions } = get();\n const totalQuestions = getTotalQuestions();\n\n if (index >= 0 && index < totalQuestions) {\n set({ currentQuestionIndex: index });\n }\n },\n\n // Quiz Actions\n selectAnswer: (questionId, answerId) => {\n const { selectedAnswers, skippedQuestions, addUserAnswer } = get();\n // Remove from skipped questions if it was skipped\n const newSkippedQuestions = skippedQuestions.filter(\n (id) => id !== questionId\n );\n set({\n selectedAnswers: {\n ...selectedAnswers,\n [questionId]: answerId,\n },\n skippedQuestions: newSkippedQuestions,\n });\n // Add to user answers\n addUserAnswer(questionId, answerId);\n },\n\n skipQuestion: () => {\n const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();\n const currentQuestion = getCurrentQuestion();\n\n if (currentQuestion) {\n set({\n skippedQuestions: [...skippedQuestions, currentQuestion.id],\n });\n // Add to user answers as skipped\n addUserAnswer(currentQuestion.id);\n }\n },\n\n addUserAnswer: (questionId, answerId) => {\n const { userAnswers, bySimulado, byAtividade, byAula } = get();\n const quiz = bySimulado || byAtividade || byAula;\n const question = quiz?.questions.find((q) => q.id === questionId);\n\n if (!question) return;\n\n const existingAnswerIndex = userAnswers.findIndex(\n (answer) => answer.id === questionId\n );\n\n if (existingAnswerIndex !== -1) {\n // Update existing answer\n const updatedAnswers = [...userAnswers];\n updatedAnswers[existingAnswerIndex] = {\n ...question,\n answerKey: answerId || '',\n isSkipped: !answerId,\n };\n set({ userAnswers: updatedAnswers });\n } else {\n // Add new answer\n set({\n userAnswers: [\n ...userAnswers,\n {\n ...question,\n answerKey: answerId || '',\n isSkipped: !answerId,\n },\n ],\n });\n }\n },\n\n startQuiz: () => {\n set({ isStarted: true, timeElapsed: 0 });\n startTimer();\n },\n\n finishQuiz: () => {\n set({ isFinished: true });\n stopTimer();\n },\n\n resetQuiz: () => {\n stopTimer();\n set({\n currentQuestionIndex: 0,\n selectedAnswers: {},\n skippedQuestions: [],\n userAnswers: [],\n timeElapsed: 0,\n isStarted: false,\n isFinished: false,\n });\n },\n\n // Timer\n updateTime: (time) => set({ timeElapsed: time }),\n startTimer,\n stopTimer,\n\n // Getters\n getCurrentQuestion: () => {\n const { bySimulado, byAtividade, byAula, currentQuestionIndex } =\n get();\n const quiz = bySimulado || byAtividade || byAula;\n\n if (!quiz) {\n return null;\n }\n\n return quiz.questions[currentQuestionIndex];\n },\n\n getTotalQuestions: () => {\n const { bySimulado, byAtividade, byAula } = get();\n const quiz = bySimulado || byAtividade || byAula;\n\n return quiz?.questions?.length || 0;\n },\n\n getAnsweredQuestions: () => {\n const { selectedAnswers } = get();\n return Object.keys(selectedAnswers).length;\n },\n\n getUnansweredQuestions: () => {\n const {\n bySimulado,\n byAtividade,\n byAula,\n selectedAnswers,\n skippedQuestions,\n } = get();\n const quiz = bySimulado || byAtividade || byAula;\n if (!quiz) return [];\n\n const unansweredQuestions: number[] = [];\n\n quiz.questions.forEach((question, index) => {\n const isAnswered = question.id in selectedAnswers;\n const isSkipped = skippedQuestions.includes(question.id);\n\n if (!isAnswered && !isSkipped) {\n unansweredQuestions.push(index + 1); // index + 1 para mostrar número da questão\n }\n });\n return unansweredQuestions;\n },\n\n getSkippedQuestions: () => {\n const { skippedQuestions } = get();\n return skippedQuestions.length;\n },\n\n getProgress: () => {\n const { getTotalQuestions, getAnsweredQuestions } = get();\n const total = getTotalQuestions();\n const answered = getAnsweredQuestions();\n\n return total > 0 ? (answered / total) * 100 : 0;\n },\n\n isQuestionAnswered: (questionId) => {\n const { selectedAnswers } = get();\n return questionId in selectedAnswers;\n },\n\n isQuestionSkipped: (questionId) => {\n const { skippedQuestions } = get();\n return skippedQuestions.includes(questionId);\n },\n\n getCurrentAnswer: () => {\n const { getCurrentQuestion, selectedAnswers } = get();\n const currentQuestion = getCurrentQuestion();\n\n return selectedAnswers[currentQuestion?.id || ''];\n },\n\n getQuizTitle: () => {\n const { bySimulado, byAtividade, byAula } = get();\n const quiz = bySimulado || byAtividade || byAula;\n\n return quiz?.title || 'Quiz';\n },\n\n formatTime: (seconds: number) => {\n const minutes = Math.floor(seconds / 60);\n const remainingSeconds = seconds % 60;\n return `${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;\n },\n\n getUserAnswers: () => {\n const { userAnswers } = get();\n return userAnswers;\n },\n\n getUnansweredQuestionsFromUserAnswers: () => {\n const { bySimulado, byAtividade, byAula, userAnswers } = get();\n const quiz = bySimulado || byAtividade || byAula;\n if (!quiz) return [];\n\n const unansweredQuestions: number[] = [];\n\n quiz.questions.forEach((question, index) => {\n const userAnswer = userAnswers.find(\n (answer) => answer.id === question.id\n );\n\n // Se não há resposta do usuário OU se a questão foi pulada (isSkipped = true)\n if (!userAnswer || userAnswer.isSkipped) {\n unansweredQuestions.push(index + 1); // index + 1 para mostrar número da questão\n }\n });\n\n return unansweredQuestions;\n },\n\n getQuestionsGroupedBySubject: () => {\n const { bySimulado, byAtividade, byAula } = get();\n const quiz = bySimulado || byAtividade || byAula;\n if (!quiz) return {};\n\n const groupedQuestions: { [key: string]: Question[] } = {};\n\n quiz.questions.forEach((question) => {\n const subjectId =\n question.knowledgeMatrix?.[0]?.subjectId || 'Sem matéria';\n\n if (!groupedQuestions[subjectId]) {\n groupedQuestions[subjectId] = [];\n }\n\n groupedQuestions[subjectId].push(question);\n });\n\n return groupedQuestions;\n },\n };\n },\n {\n name: 'quiz-store',\n }\n )\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAuB;AACvB,wBAAyB;AA0GlB,IAAM,mBAAe,uBAAkB;AAAA,MAC5C;AAAA,IACE,CAAC,KAAK,QAAQ;AACZ,UAAI,gBAAuD;AAE3D,YAAM,aAAa,MAAM;AACvB,YAAI,eAAe;AACjB,wBAAc,aAAa;AAAA,QAC7B;AAEA,wBAAgB,YAAY,MAAM;AAChC,gBAAM,EAAE,YAAY,IAAI,IAAI;AAC5B,cAAI,EAAE,aAAa,cAAc,EAAE,CAAC;AAAA,QACtC,GAAG,GAAI;AAAA,MACT;AAEA,YAAM,YAAY,MAAM;AACtB,YAAI,eAAe;AACjB,wBAAc,aAAa;AAC3B,0BAAgB;AAAA,QAClB;AAAA,MACF;AAEA,aAAO;AAAA;AAAA,QAEL,sBAAsB;AAAA,QACtB,iBAAiB,CAAC;AAAA,QAClB,kBAAkB,CAAC;AAAA,QACnB,aAAa,CAAC;AAAA,QACd,aAAa;AAAA,QACb,WAAW;AAAA,QACX,YAAY;AAAA;AAAA,QAGZ,eAAe,CAAC,aAAa,IAAI,EAAE,YAAY,SAAS,CAAC;AAAA,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