analytica-frontend-lib 1.0.82 → 1.0.84

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 +52 -0
  18. package/dist/Quiz/index.d.ts +52 -0
  19. package/dist/Quiz/index.js +4185 -0
  20. package/dist/Quiz/index.js.map +1 -0
  21. package/dist/Quiz/index.mjs +4191 -0
  22. package/dist/Quiz/index.mjs.map +1 -0
  23. package/dist/Quiz/useQuizStore/index.d.mts +140 -0
  24. package/dist/Quiz/useQuizStore/index.d.ts +140 -0
  25. package/dist/Quiz/useQuizStore/index.js +395 -0
  26. package/dist/Quiz/useQuizStore/index.js.map +1 -0
  27. package/dist/Quiz/useQuizStore/index.mjs +367 -0
  28. package/dist/Quiz/useQuizStore/index.mjs.map +1 -0
  29. package/dist/index.css +59 -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 +1008 -4
  34. package/dist/index.js.map +1 -1
  35. package/dist/index.mjs +1003 -4
  36. package/dist/index.mjs.map +1 -1
  37. package/dist/simulated-result-QN5HCUY5.png +0 -0
  38. package/dist/styles.css +59 -0
  39. package/dist/styles.css.map +1 -1
  40. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -65,6 +65,17 @@ __export(src_exports, {
65
65
  ProgressCircle: () => ProgressCircle_default,
66
66
  ProtectedRoute: () => ProtectedRoute,
67
67
  PublicRoute: () => PublicRoute,
68
+ Quiz: () => Quiz,
69
+ QuizAlternative: () => QuizAlternative,
70
+ QuizContent: () => QuizContent,
71
+ QuizFooter: () => QuizFooter,
72
+ QuizHeader: () => QuizHeader,
73
+ QuizListResultByMateria: () => QuizListResultByMateria,
74
+ QuizQuestionList: () => QuizQuestionList,
75
+ QuizResultHeaderTitle: () => QuizResultHeaderTitle,
76
+ QuizResultPerformance: () => QuizResultPerformance,
77
+ QuizResultTitle: () => QuizResultTitle,
78
+ QuizTitle: () => QuizTitle,
68
79
  Radio: () => Radio_default,
69
80
  RadioGroup: () => RadioGroup,
70
81
  RadioGroupItem: () => RadioGroupItem,
@@ -93,6 +104,7 @@ __export(src_exports, {
93
104
  useApiConfig: () => useApiConfig,
94
105
  useAuth: () => useAuth,
95
106
  useAuthGuard: () => useAuthGuard,
107
+ useQuizStore: () => useQuizStore,
96
108
  useRouteAuth: () => useRouteAuth,
97
109
  useToastStore: () => ToastStore_default,
98
110
  useUrlAuthentication: () => useUrlAuthentication,
@@ -3145,7 +3157,7 @@ var Modal = ({
3145
3157
  };
3146
3158
  if (!isOpen) return null;
3147
3159
  const sizeClasses = SIZE_CLASSES10[size];
3148
- const baseClasses = "bg-background rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
3160
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
3149
3161
  const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
3150
3162
  const modalClasses = `${baseClasses} ${sizeClasses} ${dialogResetClasses} ${className}`;
3151
3163
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -3684,8 +3696,8 @@ var CardStatus = (0, import_react11.forwardRef)(
3684
3696
  ...props,
3685
3697
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
3686
3698
  /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm font-bold text-text-950 truncate flex-1 min-w-0", children: header }),
3687
- status && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
3688
- /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3699
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
3700
+ status && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3689
3701
  Badge_default,
3690
3702
  {
3691
3703
  action: status == "correct" ? "success" : "error",
@@ -4716,7 +4728,7 @@ var AlertDialog = (0, import_react14.forwardRef)(
4716
4728
  "h2",
4717
4729
  {
4718
4730
  id: "alert-dialog-title",
4719
- className: "pb-3 text-xl font-semibold",
4731
+ className: "pb-3 text-xl font-semibold text-text-950",
4720
4732
  children: title
4721
4733
  }
4722
4734
  ),
@@ -6267,6 +6279,986 @@ function useApiConfig(api) {
6267
6279
  [api]
6268
6280
  );
6269
6281
  }
6282
+
6283
+ // src/components/Quiz/Quiz.tsx
6284
+ var import_phosphor_react16 = require("phosphor-react");
6285
+ var import_react22 = require("react");
6286
+
6287
+ // src/components/Quiz/useQuizStore.ts
6288
+ var import_zustand6 = require("zustand");
6289
+ var import_middleware = require("zustand/middleware");
6290
+ var useQuizStore = (0, import_zustand6.create)()(
6291
+ (0, import_middleware.devtools)(
6292
+ (set, get) => {
6293
+ let timerInterval = null;
6294
+ const startTimer = () => {
6295
+ if (get().isFinished) {
6296
+ return;
6297
+ }
6298
+ if (timerInterval) {
6299
+ clearInterval(timerInterval);
6300
+ }
6301
+ timerInterval = setInterval(() => {
6302
+ const { timeElapsed } = get();
6303
+ set({ timeElapsed: timeElapsed + 1 });
6304
+ }, 1e3);
6305
+ };
6306
+ const stopTimer = () => {
6307
+ if (timerInterval) {
6308
+ clearInterval(timerInterval);
6309
+ timerInterval = null;
6310
+ }
6311
+ };
6312
+ return {
6313
+ // Initial State
6314
+ currentQuestionIndex: 0,
6315
+ selectedAnswers: {},
6316
+ userAnswers: [],
6317
+ timeElapsed: 0,
6318
+ isStarted: false,
6319
+ isFinished: false,
6320
+ userId: "",
6321
+ // Setters
6322
+ setBySimulated: (simulado) => set({ bySimulated: simulado }),
6323
+ setByActivity: (atividade) => set({ byActivity: atividade }),
6324
+ setByQuestionary: (aula) => set({ byQuestionary: aula }),
6325
+ setUserId: (userId) => set({ userId }),
6326
+ getUserId: () => get().userId,
6327
+ // Navigation
6328
+ goToNextQuestion: () => {
6329
+ const { currentQuestionIndex, getTotalQuestions } = get();
6330
+ const totalQuestions = getTotalQuestions();
6331
+ if (currentQuestionIndex < totalQuestions - 1) {
6332
+ set({ currentQuestionIndex: currentQuestionIndex + 1 });
6333
+ }
6334
+ },
6335
+ goToPreviousQuestion: () => {
6336
+ const { currentQuestionIndex } = get();
6337
+ if (currentQuestionIndex > 0) {
6338
+ set({ currentQuestionIndex: currentQuestionIndex - 1 });
6339
+ }
6340
+ },
6341
+ goToQuestion: (index) => {
6342
+ const { getTotalQuestions } = get();
6343
+ const totalQuestions = getTotalQuestions();
6344
+ if (index >= 0 && index < totalQuestions) {
6345
+ set({ currentQuestionIndex: index });
6346
+ }
6347
+ },
6348
+ getActiveQuiz: () => {
6349
+ const { bySimulated, byActivity, byQuestionary } = get();
6350
+ if (bySimulated)
6351
+ return { quiz: bySimulated, type: "bySimulated" };
6352
+ if (byActivity)
6353
+ return { quiz: byActivity, type: "byActivity" };
6354
+ if (byQuestionary)
6355
+ return { quiz: byQuestionary, type: "byQuestionary" };
6356
+ return null;
6357
+ },
6358
+ selectAnswer: (questionId, answerId) => {
6359
+ const { getActiveQuiz, userAnswers } = get();
6360
+ const activeQuiz = getActiveQuiz();
6361
+ if (!activeQuiz) return;
6362
+ const updatedQuestions = activeQuiz.quiz.questions.map(
6363
+ (question) => question.id === questionId ? { ...question, answerKey: answerId } : question
6364
+ );
6365
+ const updatedQuiz = {
6366
+ ...activeQuiz.quiz,
6367
+ questions: updatedQuestions
6368
+ };
6369
+ const activityId = activeQuiz.quiz.id;
6370
+ const userId = get().getUserId();
6371
+ if (!userId) {
6372
+ console.warn("selectAnswer called before userId is set");
6373
+ return;
6374
+ }
6375
+ const existingAnswerIndex = userAnswers.findIndex(
6376
+ (answer) => answer.questionId === questionId
6377
+ );
6378
+ const newUserAnswer = {
6379
+ questionId,
6380
+ activityId,
6381
+ userId,
6382
+ answer: answerId,
6383
+ optionId: answerId
6384
+ };
6385
+ let updatedUserAnswers;
6386
+ if (existingAnswerIndex !== -1) {
6387
+ updatedUserAnswers = [...userAnswers];
6388
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
6389
+ } else {
6390
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
6391
+ }
6392
+ set({
6393
+ [activeQuiz.type]: updatedQuiz,
6394
+ userAnswers: updatedUserAnswers
6395
+ });
6396
+ },
6397
+ skipQuestion: () => {
6398
+ const { getCurrentQuestion, userAnswers, getActiveQuiz } = get();
6399
+ const currentQuestion = getCurrentQuestion();
6400
+ const activeQuiz = getActiveQuiz();
6401
+ if (!activeQuiz) return;
6402
+ if (currentQuestion) {
6403
+ const activityId = activeQuiz.quiz.id;
6404
+ const userId = get().getUserId();
6405
+ const existingAnswerIndex = userAnswers.findIndex(
6406
+ (answer) => answer.questionId === currentQuestion.id
6407
+ );
6408
+ const newUserAnswer = {
6409
+ questionId: currentQuestion.id,
6410
+ activityId,
6411
+ userId,
6412
+ answer: null,
6413
+ optionId: null
6414
+ };
6415
+ let updatedUserAnswers;
6416
+ if (existingAnswerIndex !== -1) {
6417
+ updatedUserAnswers = [...userAnswers];
6418
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
6419
+ } else {
6420
+ updatedUserAnswers = [...userAnswers, newUserAnswer];
6421
+ }
6422
+ set({
6423
+ userAnswers: updatedUserAnswers
6424
+ });
6425
+ }
6426
+ },
6427
+ addUserAnswer: (questionId, answerId) => {
6428
+ const { getActiveQuiz, userAnswers } = get();
6429
+ const activeQuiz = getActiveQuiz();
6430
+ if (!activeQuiz) return;
6431
+ const activityId = activeQuiz.quiz.id;
6432
+ const userId = get().getUserId();
6433
+ const existingAnswerIndex = userAnswers.findIndex(
6434
+ (answer) => answer.questionId === questionId
6435
+ );
6436
+ const newUserAnswer = {
6437
+ questionId,
6438
+ activityId,
6439
+ userId,
6440
+ answer: answerId || null,
6441
+ optionId: answerId || null
6442
+ };
6443
+ if (existingAnswerIndex !== -1) {
6444
+ const updatedUserAnswers = [...userAnswers];
6445
+ updatedUserAnswers[existingAnswerIndex] = newUserAnswer;
6446
+ set({ userAnswers: updatedUserAnswers });
6447
+ } else {
6448
+ set({ userAnswers: [...userAnswers, newUserAnswer] });
6449
+ }
6450
+ },
6451
+ startQuiz: () => {
6452
+ set({ isStarted: true, timeElapsed: 0 });
6453
+ startTimer();
6454
+ },
6455
+ finishQuiz: () => {
6456
+ set({ isFinished: true });
6457
+ stopTimer();
6458
+ },
6459
+ resetQuiz: () => {
6460
+ stopTimer();
6461
+ set({
6462
+ currentQuestionIndex: 0,
6463
+ selectedAnswers: {},
6464
+ userAnswers: [],
6465
+ timeElapsed: 0,
6466
+ isStarted: false,
6467
+ isFinished: false,
6468
+ userId: ""
6469
+ });
6470
+ },
6471
+ // Timer
6472
+ updateTime: (time) => set({ timeElapsed: time }),
6473
+ startTimer,
6474
+ stopTimer,
6475
+ // Getters
6476
+ getCurrentQuestion: () => {
6477
+ const { currentQuestionIndex, getActiveQuiz } = get();
6478
+ const activeQuiz = getActiveQuiz();
6479
+ if (!activeQuiz) {
6480
+ return null;
6481
+ }
6482
+ return activeQuiz.quiz.questions[currentQuestionIndex];
6483
+ },
6484
+ getTotalQuestions: () => {
6485
+ const { getActiveQuiz } = get();
6486
+ const activeQuiz = getActiveQuiz();
6487
+ return activeQuiz?.quiz?.questions?.length || 0;
6488
+ },
6489
+ getAnsweredQuestions: () => {
6490
+ const { userAnswers } = get();
6491
+ return userAnswers.filter((answer) => answer.answer !== null).length;
6492
+ },
6493
+ getUnansweredQuestions: () => {
6494
+ const { getActiveQuiz, userAnswers } = get();
6495
+ const activeQuiz = getActiveQuiz();
6496
+ if (!activeQuiz) return [];
6497
+ const unansweredQuestions = [];
6498
+ activeQuiz.quiz.questions.forEach((question, index) => {
6499
+ const userAnswer = userAnswers.find(
6500
+ (answer) => answer.questionId === question.id
6501
+ );
6502
+ const isAnswered = userAnswer && userAnswer.answer !== null;
6503
+ const isSkipped = userAnswer && userAnswer.answer === null;
6504
+ if (!isAnswered && !isSkipped) {
6505
+ unansweredQuestions.push(index + 1);
6506
+ }
6507
+ });
6508
+ return unansweredQuestions;
6509
+ },
6510
+ getSkippedQuestions: () => {
6511
+ const { userAnswers } = get();
6512
+ return userAnswers.filter((answer) => answer.answer === null).length;
6513
+ },
6514
+ getProgress: () => {
6515
+ const { getTotalQuestions, getAnsweredQuestions } = get();
6516
+ const total = getTotalQuestions();
6517
+ const answered = getAnsweredQuestions();
6518
+ return total > 0 ? answered / total * 100 : 0;
6519
+ },
6520
+ isQuestionAnswered: (questionId) => {
6521
+ const { userAnswers } = get();
6522
+ const userAnswer = userAnswers.find(
6523
+ (answer) => answer.questionId === questionId
6524
+ );
6525
+ return userAnswer ? userAnswer.answer !== null : false;
6526
+ },
6527
+ isQuestionSkipped: (questionId) => {
6528
+ const { userAnswers } = get();
6529
+ const userAnswer = userAnswers.find(
6530
+ (answer) => answer.questionId === questionId
6531
+ );
6532
+ return userAnswer ? userAnswer.answer === null : false;
6533
+ },
6534
+ getCurrentAnswer: () => {
6535
+ const { getCurrentQuestion, userAnswers } = get();
6536
+ const currentQuestion = getCurrentQuestion();
6537
+ if (!currentQuestion) return void 0;
6538
+ const userAnswer = userAnswers.find(
6539
+ (answer) => answer.questionId === currentQuestion.id
6540
+ );
6541
+ return userAnswer?.answer;
6542
+ },
6543
+ getQuizTitle: () => {
6544
+ const { getActiveQuiz } = get();
6545
+ const activeQuiz = getActiveQuiz();
6546
+ return activeQuiz?.quiz?.title || "Quiz";
6547
+ },
6548
+ formatTime: (seconds) => {
6549
+ const minutes = Math.floor(seconds / 60);
6550
+ const remainingSeconds = seconds % 60;
6551
+ return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
6552
+ },
6553
+ getUserAnswers: () => {
6554
+ const { getActiveQuiz, userAnswers } = get();
6555
+ const activeQuiz = getActiveQuiz();
6556
+ if (!activeQuiz) return [];
6557
+ return activeQuiz.quiz.questions.map((question) => {
6558
+ const userAnswer = userAnswers.find(
6559
+ (answer) => answer.questionId === question.id
6560
+ );
6561
+ return {
6562
+ ...question,
6563
+ isSkipped: userAnswer ? userAnswer.answer === null : false
6564
+ };
6565
+ });
6566
+ },
6567
+ getUnansweredQuestionsFromUserAnswers: () => {
6568
+ const { getActiveQuiz, userAnswers } = get();
6569
+ const activeQuiz = getActiveQuiz();
6570
+ if (!activeQuiz) return [];
6571
+ const unansweredQuestions = [];
6572
+ activeQuiz.quiz.questions.forEach((question, index) => {
6573
+ const userAnswer = userAnswers.find(
6574
+ (answer) => answer.questionId === question.id
6575
+ );
6576
+ const hasAnswer = userAnswer && userAnswer.answer !== null;
6577
+ const isSkipped = userAnswer && userAnswer.answer === null;
6578
+ if (!hasAnswer || isSkipped) {
6579
+ unansweredQuestions.push(index + 1);
6580
+ }
6581
+ });
6582
+ return unansweredQuestions;
6583
+ },
6584
+ getQuestionsGroupedBySubject: () => {
6585
+ const { getActiveQuiz } = get();
6586
+ const activeQuiz = getActiveQuiz();
6587
+ if (!activeQuiz) return {};
6588
+ const groupedQuestions = {};
6589
+ activeQuiz.quiz.questions.forEach((question) => {
6590
+ const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
6591
+ if (!groupedQuestions[subjectId]) {
6592
+ groupedQuestions[subjectId] = [];
6593
+ }
6594
+ groupedQuestions[subjectId].push(question);
6595
+ });
6596
+ return groupedQuestions;
6597
+ },
6598
+ // New methods for userAnswers
6599
+ getUserAnswerByQuestionId: (questionId) => {
6600
+ const { userAnswers } = get();
6601
+ return userAnswers.find((answer) => answer.questionId === questionId) || null;
6602
+ },
6603
+ isQuestionAnsweredByUserAnswers: (questionId) => {
6604
+ const { userAnswers } = get();
6605
+ const answer = userAnswers.find(
6606
+ (answer2) => answer2.questionId === questionId
6607
+ );
6608
+ return answer ? answer.answer !== null : false;
6609
+ },
6610
+ getQuestionStatusFromUserAnswers: (questionId) => {
6611
+ const { userAnswers } = get();
6612
+ const answer = userAnswers.find(
6613
+ (answer2) => answer2.questionId === questionId
6614
+ );
6615
+ if (!answer) return "unanswered";
6616
+ if (answer.answer === null) return "skipped";
6617
+ return "answered";
6618
+ },
6619
+ getUserAnswersForActivity: () => {
6620
+ const { userAnswers } = get();
6621
+ return userAnswers;
6622
+ }
6623
+ };
6624
+ },
6625
+ {
6626
+ name: "quiz-store"
6627
+ }
6628
+ )
6629
+ );
6630
+
6631
+ // src/assets/img/simulated-result.png
6632
+ var simulated_result_default = "./simulated-result-QN5HCUY5.png";
6633
+
6634
+ // src/components/Quiz/Quiz.tsx
6635
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6636
+ var Quiz = (0, import_react22.forwardRef)(({ children, className, ...props }, ref) => {
6637
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6638
+ "div",
6639
+ {
6640
+ ref,
6641
+ className: `w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6 ${className}`,
6642
+ ...props,
6643
+ children
6644
+ }
6645
+ );
6646
+ });
6647
+ var QuizHeaderResult = (0, import_react22.forwardRef)(
6648
+ ({ className, ...props }, ref) => {
6649
+ const { getCurrentQuestion, getCurrentAnswer } = useQuizStore();
6650
+ const currentQuestion = getCurrentQuestion();
6651
+ const userAnswer = getCurrentAnswer();
6652
+ const isCorrect = userAnswer === currentQuestion?.correctOptionId;
6653
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6654
+ "div",
6655
+ {
6656
+ ref,
6657
+ className: `flex flex-row items-center gap-10 p-3.5 rounded-xl ${isCorrect ? "bg-success-background" : "bg-error-background"} ${className}`,
6658
+ ...props,
6659
+ children: [
6660
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Resultado" }),
6661
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-700 text-md", children: isCorrect ? "\u{1F389} Parab\xE9ns!!" : "N\xE3o foi dessa vez..." })
6662
+ ]
6663
+ }
6664
+ );
6665
+ }
6666
+ );
6667
+ var QuizTitle = (0, import_react22.forwardRef)(
6668
+ ({ className, ...props }, ref) => {
6669
+ const {
6670
+ currentQuestionIndex,
6671
+ getTotalQuestions,
6672
+ getQuizTitle,
6673
+ timeElapsed,
6674
+ formatTime,
6675
+ isStarted
6676
+ } = useQuizStore();
6677
+ const totalQuestions = getTotalQuestions();
6678
+ const quizTitle = getQuizTitle();
6679
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6680
+ "div",
6681
+ {
6682
+ ref,
6683
+ className: `flex flex-row justify-center items-center relative p-2 ${className}`,
6684
+ ...props,
6685
+ children: [
6686
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
6687
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
6688
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
6689
+ ] }),
6690
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "absolute right-2", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Badge_default, { variant: "outlined", action: "info", iconLeft: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.Clock, {}), children: isStarted ? formatTime(timeElapsed) : "00:00" }) })
6691
+ ]
6692
+ }
6693
+ );
6694
+ }
6695
+ );
6696
+ var QuizHeader = () => {
6697
+ const { getCurrentQuestion } = useQuizStore();
6698
+ const currentQuestion = getCurrentQuestion();
6699
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6700
+ HeaderAlternative,
6701
+ {
6702
+ title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
6703
+ subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topicId ?? "",
6704
+ content: currentQuestion?.questionText ?? ""
6705
+ }
6706
+ );
6707
+ };
6708
+ var QuizContent = (0, import_react22.forwardRef)(({ type = "Alternativas", children, className, ...props }, ref) => {
6709
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6710
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "px-4 pb-2 pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "font-bold text-lg text-text-950", children: type }) }),
6711
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6712
+ "div",
6713
+ {
6714
+ ref,
6715
+ className: `rounded-t-xl px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
6716
+ ...props,
6717
+ children
6718
+ }
6719
+ )
6720
+ ] });
6721
+ });
6722
+ var QuizAlternative = ({ variant = "default" }) => {
6723
+ const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
6724
+ const currentQuestion = getCurrentQuestion();
6725
+ const currentAnswer = getCurrentAnswer();
6726
+ const alternatives = currentQuestion?.options?.map((option) => {
6727
+ let status = "neutral" /* NEUTRAL */;
6728
+ if (variant === "result") {
6729
+ if (option.id === currentQuestion.correctOptionId) {
6730
+ status = "correct" /* CORRECT */;
6731
+ } else if (currentAnswer === option.id && option.id !== currentQuestion.correctOptionId) {
6732
+ status = "incorrect" /* INCORRECT */;
6733
+ }
6734
+ }
6735
+ return {
6736
+ label: option.option,
6737
+ value: option.id,
6738
+ status
6739
+ };
6740
+ });
6741
+ if (!alternatives)
6742
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { children: "N\xE3o h\xE1 Alternativas" }) });
6743
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6744
+ AlternativesList,
6745
+ {
6746
+ mode: variant === "default" ? "interactive" : "readonly",
6747
+ name: `question-${currentQuestion?.id || "1"}`,
6748
+ layout: "compact",
6749
+ alternatives,
6750
+ value: currentAnswer,
6751
+ selectedValue: currentAnswer,
6752
+ onValueChange: (value) => {
6753
+ if (currentQuestion) {
6754
+ selectAnswer(currentQuestion.id, value);
6755
+ }
6756
+ }
6757
+ },
6758
+ `question-${currentQuestion?.id || "1"}`
6759
+ ) });
6760
+ };
6761
+ var QuizQuestionList = ({
6762
+ filterType = "all",
6763
+ onQuestionClick
6764
+ } = {}) => {
6765
+ const {
6766
+ getQuestionsGroupedBySubject,
6767
+ goToQuestion,
6768
+ getQuestionStatusFromUserAnswers
6769
+ } = useQuizStore();
6770
+ const groupedQuestions = getQuestionsGroupedBySubject();
6771
+ const getQuestionStatus = (questionId) => {
6772
+ return getQuestionStatusFromUserAnswers(questionId);
6773
+ };
6774
+ const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
6775
+ (acc, [subjectId, questions]) => {
6776
+ const filteredQuestions = questions.filter((question) => {
6777
+ const status = getQuestionStatus(question.id);
6778
+ switch (filterType) {
6779
+ case "answered":
6780
+ return status === "answered";
6781
+ case "unanswered":
6782
+ return status === "unanswered";
6783
+ default:
6784
+ return true;
6785
+ }
6786
+ });
6787
+ if (filteredQuestions.length > 0) {
6788
+ acc[subjectId] = filteredQuestions;
6789
+ }
6790
+ return acc;
6791
+ },
6792
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6793
+ {}
6794
+ );
6795
+ const getQuestionIndex = (questionId) => {
6796
+ const { bySimulated, byActivity, byQuestionary } = useQuizStore.getState();
6797
+ const quiz = bySimulated ?? byActivity ?? byQuestionary;
6798
+ if (!quiz) return 0;
6799
+ const index = quiz.questions.findIndex((q) => q.id === questionId);
6800
+ return index + 1;
6801
+ };
6802
+ const getStatusLabel = (status) => {
6803
+ switch (status) {
6804
+ case "answered":
6805
+ return "Respondida";
6806
+ case "skipped":
6807
+ return "N\xE3o respondida";
6808
+ default:
6809
+ return "Em branco";
6810
+ }
6811
+ };
6812
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
6813
+ ([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "flex flex-col gap-2", children: [
6814
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
6815
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "bg-primary-500 p-1 rounded-sm flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.BookOpen, { size: 17, className: "text-white" }) }),
6816
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
6817
+ ] }),
6818
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
6819
+ const status = getQuestionStatus(question.id);
6820
+ const questionNumber = getQuestionIndex(question.id);
6821
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6822
+ CardStatus,
6823
+ {
6824
+ header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
6825
+ label: getStatusLabel(status),
6826
+ onClick: () => {
6827
+ goToQuestion(questionNumber - 1);
6828
+ onQuestionClick?.();
6829
+ }
6830
+ },
6831
+ question.id
6832
+ );
6833
+ }) })
6834
+ ] }, subjectId)
6835
+ ) });
6836
+ };
6837
+ var QuizFooter = (0, import_react22.forwardRef)(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
6838
+ const {
6839
+ currentQuestionIndex,
6840
+ getUserAnswers,
6841
+ getTotalQuestions,
6842
+ goToNextQuestion,
6843
+ goToPreviousQuestion,
6844
+ getUnansweredQuestionsFromUserAnswers,
6845
+ getCurrentAnswer,
6846
+ skipQuestion,
6847
+ getCurrentQuestion,
6848
+ getQuestionStatusFromUserAnswers
6849
+ } = useQuizStore();
6850
+ const totalQuestions = getTotalQuestions();
6851
+ const isFirstQuestion = currentQuestionIndex === 0;
6852
+ const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
6853
+ const currentAnswer = getCurrentAnswer();
6854
+ const currentQuestion = getCurrentQuestion();
6855
+ const isCurrentQuestionSkipped = currentQuestion ? getQuestionStatusFromUserAnswers(currentQuestion.id) === "skipped" : false;
6856
+ const [alertDialogOpen, setAlertDialogOpen] = (0, import_react22.useState)(false);
6857
+ const [modalResultOpen, setModalResultOpen] = (0, import_react22.useState)(false);
6858
+ const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react22.useState)(false);
6859
+ const [filterType, setFilterType] = (0, import_react22.useState)("all");
6860
+ const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
6861
+ const userAnswers = getUserAnswers();
6862
+ const allQuestions = getTotalQuestions();
6863
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6864
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6865
+ "footer",
6866
+ {
6867
+ ref,
6868
+ className: `w-full px-2 bg-background lg:max-w-[1000px] not-lg:max-w-[calc(100vw-32px)] border-t border-border-50 fixed bottom-0 min-h-[80px] flex flex-row justify-between items-center ${className}`,
6869
+ ...props,
6870
+ children: [
6871
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
6872
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6873
+ IconButton_default,
6874
+ {
6875
+ icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.SquaresFour, { size: 24, className: "text-text-950" }),
6876
+ size: "md",
6877
+ onClick: () => setModalNavigateOpen(true)
6878
+ }
6879
+ ),
6880
+ isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6881
+ Button_default,
6882
+ {
6883
+ variant: "outline",
6884
+ size: "small",
6885
+ onClick: () => {
6886
+ skipQuestion();
6887
+ goToNextQuestion();
6888
+ },
6889
+ children: "Pular"
6890
+ }
6891
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6892
+ Button_default,
6893
+ {
6894
+ size: "medium",
6895
+ variant: "link",
6896
+ action: "primary",
6897
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.CaretLeft, { size: 18 }),
6898
+ onClick: () => {
6899
+ goToPreviousQuestion();
6900
+ },
6901
+ children: "Voltar"
6902
+ }
6903
+ )
6904
+ ] }),
6905
+ !isFirstQuestion && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6906
+ Button_default,
6907
+ {
6908
+ size: "small",
6909
+ variant: "outline",
6910
+ action: "primary",
6911
+ onClick: () => {
6912
+ skipQuestion();
6913
+ goToNextQuestion();
6914
+ },
6915
+ children: "Pular"
6916
+ }
6917
+ ),
6918
+ isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6919
+ Button_default,
6920
+ {
6921
+ size: "medium",
6922
+ variant: "solid",
6923
+ action: "primary",
6924
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
6925
+ onClick: () => {
6926
+ if (unansweredQuestions.length > 0) {
6927
+ setAlertDialogOpen(true);
6928
+ } else {
6929
+ setModalResultOpen(true);
6930
+ }
6931
+ },
6932
+ children: "Finalizar"
6933
+ }
6934
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6935
+ Button_default,
6936
+ {
6937
+ size: "medium",
6938
+ variant: "link",
6939
+ action: "primary",
6940
+ iconRight: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.CaretRight, { size: 18 }),
6941
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
6942
+ onClick: () => {
6943
+ goToNextQuestion();
6944
+ },
6945
+ children: "Avan\xE7ar"
6946
+ }
6947
+ )
6948
+ ]
6949
+ }
6950
+ ),
6951
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6952
+ AlertDialog,
6953
+ {
6954
+ isOpen: alertDialogOpen,
6955
+ onChangeOpen: setAlertDialogOpen,
6956
+ title: "Finalizar simulado?",
6957
+ description: unansweredQuestions.length > 0 ? `Voc\xEA deixou as quest\xF5es ${unansweredQuestions.join(", ")} sem resposta. Finalizar agora pode impactar seu desempenho.` : "Tem certeza que deseja finalizar o simulado?",
6958
+ cancelButtonLabel: "Voltar e revisar",
6959
+ submitButtonLabel: "Finalizar Mesmo Assim",
6960
+ onSubmit: () => {
6961
+ setModalResultOpen(true);
6962
+ }
6963
+ }
6964
+ ),
6965
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6966
+ Modal_default,
6967
+ {
6968
+ isOpen: modalResultOpen,
6969
+ onClose: () => setModalResultOpen(false),
6970
+ title: "",
6971
+ closeOnBackdropClick: false,
6972
+ closeOnEscape: false,
6973
+ hideCloseButton: true,
6974
+ size: "md",
6975
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
6976
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6977
+ "img",
6978
+ {
6979
+ src: simulated_result_default,
6980
+ alt: "Simulated Result",
6981
+ className: "w-[282px] h-auto object-cover"
6982
+ }
6983
+ ),
6984
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
6985
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
6986
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-text-500 font-sm", children: [
6987
+ "Voc\xEA acertou",
6988
+ " ",
6989
+ userAnswers.filter(
6990
+ (answer) => answer.answerKey === answer.correctOptionId
6991
+ ).length,
6992
+ " ",
6993
+ "de ",
6994
+ allQuestions,
6995
+ " quest\xF5es."
6996
+ ] })
6997
+ ] }),
6998
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
6999
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7000
+ Button_default,
7001
+ {
7002
+ variant: "outline",
7003
+ className: "w-full",
7004
+ size: "small",
7005
+ onClick: onGoToSimulated,
7006
+ children: "Ir para simulados"
7007
+ }
7008
+ ),
7009
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
7010
+ ] })
7011
+ ] })
7012
+ }
7013
+ ),
7014
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7015
+ Modal_default,
7016
+ {
7017
+ isOpen: modalNavigateOpen,
7018
+ onClose: () => setModalNavigateOpen(false),
7019
+ title: "Quest\xF5es",
7020
+ size: "lg",
7021
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
7022
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-row justify-between items-center py-6 pt-6 pb-4 border-b border-border-200", children: [
7023
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
7024
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(Select_default, { value: filterType, onValueChange: setFilterType, children: [
7025
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectTrigger, { variant: "rounded", className: "max-w-[266px]", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectValue, { placeholder: "Selecione uma op\xE7\xE3o" }) }),
7026
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SelectContent, { children: [
7027
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectItem, { value: "all", children: "Todas" }),
7028
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
7029
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
7030
+ ] })
7031
+ ] }) })
7032
+ ] }),
7033
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-col gap-2 not-lg:h-[calc(100vh-200px)] lg:max-h-[687px] overflow-y-auto", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7034
+ QuizQuestionList,
7035
+ {
7036
+ filterType,
7037
+ onQuestionClick: () => setModalNavigateOpen(false)
7038
+ }
7039
+ ) })
7040
+ ] })
7041
+ }
7042
+ )
7043
+ ] });
7044
+ });
7045
+ var QuizResultHeaderTitle = (0, import_react22.forwardRef)(({ className, ...props }, ref) => {
7046
+ const { bySimulated } = useQuizStore();
7047
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7048
+ "div",
7049
+ {
7050
+ ref,
7051
+ className: `flex flex-row pt-4 justify-between ${className}`,
7052
+ ...props,
7053
+ children: [
7054
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: "Resultado" }),
7055
+ bySimulated && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Badge_default, { variant: "solid", action: "info", children: bySimulated.category })
7056
+ ]
7057
+ }
7058
+ );
7059
+ });
7060
+ var QuizResultTitle = (0, import_react22.forwardRef)(({ className, ...props }, ref) => {
7061
+ const { getQuizTitle } = useQuizStore();
7062
+ const quizTitle = getQuizTitle();
7063
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7064
+ "p",
7065
+ {
7066
+ className: `pt-6 pb-4 text-text-950 font-bold text-lg ${className}`,
7067
+ ref,
7068
+ ...props,
7069
+ children: quizTitle
7070
+ }
7071
+ );
7072
+ });
7073
+ var QuizResultPerformance = (0, import_react22.forwardRef)(
7074
+ ({ ...props }, ref) => {
7075
+ const {
7076
+ getTotalQuestions,
7077
+ timeElapsed,
7078
+ formatTime,
7079
+ bySimulated,
7080
+ byActivity,
7081
+ byQuestionary
7082
+ } = useQuizStore();
7083
+ const totalQuestions = getTotalQuestions();
7084
+ const quiz = bySimulated || byActivity || byQuestionary;
7085
+ let correctAnswers = 0;
7086
+ let correctEasyAnswers = 0;
7087
+ let correctMediumAnswers = 0;
7088
+ let correctDifficultAnswers = 0;
7089
+ let totalEasyQuestions = 0;
7090
+ let totalMediumQuestions = 0;
7091
+ let totalDifficultQuestions = 0;
7092
+ if (quiz) {
7093
+ quiz.questions.forEach((question) => {
7094
+ const userAnswer = question.answerKey;
7095
+ const isCorrect = userAnswer && userAnswer === question.correctOptionId;
7096
+ if (isCorrect) {
7097
+ correctAnswers++;
7098
+ }
7099
+ if (question.difficulty === "FACIL" /* FACIL */) {
7100
+ totalEasyQuestions++;
7101
+ if (isCorrect) {
7102
+ correctEasyAnswers++;
7103
+ }
7104
+ } else if (question.difficulty === "MEDIO" /* MEDIO */) {
7105
+ totalMediumQuestions++;
7106
+ if (isCorrect) {
7107
+ correctMediumAnswers++;
7108
+ }
7109
+ } else if (question.difficulty === "DIFICIL" /* DIFICIL */) {
7110
+ totalDifficultQuestions++;
7111
+ if (isCorrect) {
7112
+ correctDifficultAnswers++;
7113
+ }
7114
+ }
7115
+ });
7116
+ }
7117
+ const percentage = totalQuestions > 0 ? Math.round(correctAnswers / totalQuestions * 100) : 0;
7118
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
7119
+ "div",
7120
+ {
7121
+ className: "flex flex-row gap-6 p-6 rounded-xl bg-background justify-between",
7122
+ ref,
7123
+ ...props,
7124
+ children: [
7125
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative", children: [
7126
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7127
+ ProgressCircle_default,
7128
+ {
7129
+ size: "medium",
7130
+ variant: "green",
7131
+ value: percentage,
7132
+ showPercentage: false,
7133
+ label: ""
7134
+ }
7135
+ ),
7136
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: [
7137
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center gap-1 mb-1", children: [
7138
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.Clock, { size: 12, weight: "regular", className: "text-text-800" }),
7139
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "text-2xs font-medium text-text-800", children: formatTime(timeElapsed) })
7140
+ ] }),
7141
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "text-2xl font-medium text-text-800 leading-7", children: [
7142
+ correctAnswers,
7143
+ " de ",
7144
+ totalQuestions
7145
+ ] }),
7146
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "text-2xs font-medium text-text-600 mt-1", children: "Corretas" })
7147
+ ] })
7148
+ ] }),
7149
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-4 w-full", children: [
7150
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7151
+ ProgressBar_default,
7152
+ {
7153
+ className: "w-full",
7154
+ layout: "stacked",
7155
+ variant: "green",
7156
+ value: correctEasyAnswers,
7157
+ max: totalEasyQuestions,
7158
+ label: "F\xE1ceis",
7159
+ showHitCount: true,
7160
+ labelClassName: "text-base font-medium text-text-800 leading-none",
7161
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
7162
+ }
7163
+ ),
7164
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7165
+ ProgressBar_default,
7166
+ {
7167
+ className: "w-full",
7168
+ layout: "stacked",
7169
+ variant: "green",
7170
+ value: correctMediumAnswers,
7171
+ max: totalMediumQuestions,
7172
+ label: "M\xE9dias",
7173
+ showHitCount: true,
7174
+ labelClassName: "text-base font-medium text-text-800 leading-none",
7175
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
7176
+ }
7177
+ ),
7178
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7179
+ ProgressBar_default,
7180
+ {
7181
+ className: "w-full",
7182
+ layout: "stacked",
7183
+ variant: "green",
7184
+ value: correctDifficultAnswers,
7185
+ max: totalDifficultQuestions,
7186
+ label: "Dif\xEDceis",
7187
+ showHitCount: true,
7188
+ labelClassName: "text-base font-medium text-text-800 leading-none",
7189
+ percentageClassName: "text-xs font-medium leading-[14px] text-right"
7190
+ }
7191
+ )
7192
+ ] })
7193
+ ]
7194
+ }
7195
+ );
7196
+ }
7197
+ );
7198
+ var QuizListResult = (0, import_react22.forwardRef)(({ className, onSubjectClick, ...props }, ref) => {
7199
+ const { getQuestionsGroupedBySubject, isQuestionAnswered } = useQuizStore();
7200
+ const groupedQuestions = getQuestionsGroupedBySubject();
7201
+ const subjectsStats = Object.entries(groupedQuestions).map(
7202
+ ([subjectId, questions]) => {
7203
+ let correct = 0;
7204
+ let incorrect = 0;
7205
+ questions.forEach((question) => {
7206
+ if (isQuestionAnswered(question.id)) {
7207
+ const userAnswer = question.answerKey;
7208
+ if (userAnswer === question.correctOptionId) {
7209
+ correct++;
7210
+ } else {
7211
+ incorrect++;
7212
+ }
7213
+ }
7214
+ });
7215
+ return {
7216
+ subject: subjectId,
7217
+ correct,
7218
+ incorrect,
7219
+ total: questions.length
7220
+ };
7221
+ }
7222
+ );
7223
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { ref, className, ...props, children: [
7224
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Mat\xE9rias" }),
7225
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { className: "flex flex-col gap-2", children: subjectsStats.map((subject) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7226
+ CardResults,
7227
+ {
7228
+ onClick: () => onSubjectClick?.(subject.subject),
7229
+ className: "max-w-full",
7230
+ header: subject.subject,
7231
+ correct_answers: subject.correct,
7232
+ incorrect_answers: subject.incorrect,
7233
+ icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.Book, { size: 20 }),
7234
+ direction: "row"
7235
+ }
7236
+ ) }, subject.subject)) })
7237
+ ] });
7238
+ });
7239
+ var QuizListResultByMateria = ({
7240
+ subject,
7241
+ onQuestionClick
7242
+ }) => {
7243
+ const { getQuestionsGroupedBySubject } = useQuizStore();
7244
+ const groupedQuestions = getQuestionsGroupedBySubject();
7245
+ const answeredQuestions = groupedQuestions[subject] || [];
7246
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6", children: [
7247
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "flex flex-row pt-4 justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-2xl", children: subject }) }),
7248
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "flex flex-col ", children: [
7249
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "pt-6 pb-4 text-text-950 font-bold text-lg", children: "Resultado das quest\xF5es" }),
7250
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { className: "flex flex-col gap-2 pt-4", children: answeredQuestions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
7251
+ CardStatus,
7252
+ {
7253
+ className: "max-w-full",
7254
+ header: `Quest\xE3o ${question.id}`,
7255
+ status: question.answerKey === question.correctOptionId ? "correct" : "incorrect",
7256
+ onClick: () => onQuestionClick?.(question)
7257
+ }
7258
+ ) }, question.id)) })
7259
+ ] })
7260
+ ] });
7261
+ };
6270
7262
  // Annotate the CommonJS export names for ESM import in node:
6271
7263
  0 && (module.exports = {
6272
7264
  Alert,
@@ -6314,6 +7306,17 @@ function useApiConfig(api) {
6314
7306
  ProgressCircle,
6315
7307
  ProtectedRoute,
6316
7308
  PublicRoute,
7309
+ Quiz,
7310
+ QuizAlternative,
7311
+ QuizContent,
7312
+ QuizFooter,
7313
+ QuizHeader,
7314
+ QuizListResultByMateria,
7315
+ QuizQuestionList,
7316
+ QuizResultHeaderTitle,
7317
+ QuizResultPerformance,
7318
+ QuizResultTitle,
7319
+ QuizTitle,
6317
7320
  Radio,
6318
7321
  RadioGroup,
6319
7322
  RadioGroupItem,
@@ -6342,6 +7345,7 @@ function useApiConfig(api) {
6342
7345
  useApiConfig,
6343
7346
  useAuth,
6344
7347
  useAuthGuard,
7348
+ useQuizStore,
6345
7349
  useRouteAuth,
6346
7350
  useToastStore,
6347
7351
  useUrlAuthentication,