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
package/dist/index.js CHANGED
@@ -65,6 +65,13 @@ __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
+ QuizQuestionList: () => QuizQuestionList,
74
+ QuizTitle: () => QuizTitle,
68
75
  Radio: () => Radio_default,
69
76
  RadioGroup: () => RadioGroup,
70
77
  RadioGroupItem: () => RadioGroupItem,
@@ -93,6 +100,7 @@ __export(src_exports, {
93
100
  useApiConfig: () => useApiConfig,
94
101
  useAuth: () => useAuth,
95
102
  useAuthGuard: () => useAuthGuard,
103
+ useQuizStore: () => useQuizStore,
96
104
  useRouteAuth: () => useRouteAuth,
97
105
  useToastStore: () => ToastStore_default,
98
106
  useUrlAuthentication: () => useUrlAuthentication,
@@ -3145,7 +3153,7 @@ var Modal = ({
3145
3153
  };
3146
3154
  if (!isOpen) return null;
3147
3155
  const sizeClasses = SIZE_CLASSES10[size];
3148
- const baseClasses = "bg-background rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
3156
+ const baseClasses = "bg-secondary-50 rounded-3xl shadow-hard-shadow-2 border border-border-100 w-full mx-4";
3149
3157
  const dialogResetClasses = "p-0 m-0 border-none outline-none max-h-none static";
3150
3158
  const modalClasses = `${baseClasses} ${sizeClasses} ${dialogResetClasses} ${className}`;
3151
3159
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
@@ -3684,8 +3692,8 @@ var CardStatus = (0, import_react11.forwardRef)(
3684
3692
  ...props,
3685
3693
  children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex justify-between w-full h-full flex-row items-center gap-2", children: [
3686
3694
  /* @__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)(
3695
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: "flex flex-row gap-1 items-center flex-shrink-0", children: [
3696
+ status && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3689
3697
  Badge_default,
3690
3698
  {
3691
3699
  action: status == "correct" ? "success" : "error",
@@ -4716,7 +4724,7 @@ var AlertDialog = (0, import_react14.forwardRef)(
4716
4724
  "h2",
4717
4725
  {
4718
4726
  id: "alert-dialog-title",
4719
- className: "pb-3 text-xl font-semibold",
4727
+ className: "pb-3 text-xl font-semibold text-text-950",
4720
4728
  children: title
4721
4729
  }
4722
4730
  ),
@@ -6267,6 +6275,645 @@ function useApiConfig(api) {
6267
6275
  [api]
6268
6276
  );
6269
6277
  }
6278
+
6279
+ // src/components/Quiz/Quiz.tsx
6280
+ var import_phosphor_react16 = require("phosphor-react");
6281
+ var import_react22 = require("react");
6282
+
6283
+ // src/components/Quiz/useQuizStore.ts
6284
+ var import_zustand6 = require("zustand");
6285
+ var import_middleware = require("zustand/middleware");
6286
+ var useQuizStore = (0, import_zustand6.create)()(
6287
+ (0, import_middleware.devtools)(
6288
+ (set, get) => {
6289
+ let timerInterval = null;
6290
+ const startTimer = () => {
6291
+ if (timerInterval) {
6292
+ clearInterval(timerInterval);
6293
+ }
6294
+ timerInterval = setInterval(() => {
6295
+ const { timeElapsed } = get();
6296
+ set({ timeElapsed: timeElapsed + 1 });
6297
+ }, 1e3);
6298
+ };
6299
+ const stopTimer = () => {
6300
+ if (timerInterval) {
6301
+ clearInterval(timerInterval);
6302
+ timerInterval = null;
6303
+ }
6304
+ };
6305
+ return {
6306
+ // Initial State
6307
+ currentQuestionIndex: 0,
6308
+ selectedAnswers: {},
6309
+ skippedQuestions: [],
6310
+ userAnswers: [],
6311
+ timeElapsed: 0,
6312
+ isStarted: false,
6313
+ isFinished: false,
6314
+ // Setters
6315
+ setBySimulado: (simulado) => set({ bySimulado: simulado }),
6316
+ setByAtividade: (atividade) => set({ byAtividade: atividade }),
6317
+ setByAula: (aula) => set({ byAula: aula }),
6318
+ // Navigation
6319
+ goToNextQuestion: () => {
6320
+ const { currentQuestionIndex, getTotalQuestions } = get();
6321
+ const totalQuestions = getTotalQuestions();
6322
+ if (currentQuestionIndex < totalQuestions - 1) {
6323
+ set({ currentQuestionIndex: currentQuestionIndex + 1 });
6324
+ }
6325
+ },
6326
+ goToPreviousQuestion: () => {
6327
+ const { currentQuestionIndex } = get();
6328
+ if (currentQuestionIndex > 0) {
6329
+ set({ currentQuestionIndex: currentQuestionIndex - 1 });
6330
+ }
6331
+ },
6332
+ goToQuestion: (index) => {
6333
+ const { getTotalQuestions } = get();
6334
+ const totalQuestions = getTotalQuestions();
6335
+ if (index >= 0 && index < totalQuestions) {
6336
+ set({ currentQuestionIndex: index });
6337
+ }
6338
+ },
6339
+ // Quiz Actions
6340
+ selectAnswer: (questionId, answerId) => {
6341
+ const { selectedAnswers, skippedQuestions, addUserAnswer } = get();
6342
+ const newSkippedQuestions = skippedQuestions.filter(
6343
+ (id) => id !== questionId
6344
+ );
6345
+ set({
6346
+ selectedAnswers: {
6347
+ ...selectedAnswers,
6348
+ [questionId]: answerId
6349
+ },
6350
+ skippedQuestions: newSkippedQuestions
6351
+ });
6352
+ addUserAnswer(questionId, answerId);
6353
+ },
6354
+ skipQuestion: () => {
6355
+ const { getCurrentQuestion, skippedQuestions, addUserAnswer } = get();
6356
+ const currentQuestion = getCurrentQuestion();
6357
+ if (currentQuestion) {
6358
+ set({
6359
+ skippedQuestions: [...skippedQuestions, currentQuestion.id]
6360
+ });
6361
+ addUserAnswer(currentQuestion.id);
6362
+ }
6363
+ },
6364
+ addUserAnswer: (questionId, answerId) => {
6365
+ const { userAnswers, bySimulado, byAtividade, byAula } = get();
6366
+ const quiz = bySimulado || byAtividade || byAula;
6367
+ const question = quiz?.questions.find((q) => q.id === questionId);
6368
+ if (!question) return;
6369
+ const existingAnswerIndex = userAnswers.findIndex(
6370
+ (answer) => answer.id === questionId
6371
+ );
6372
+ if (existingAnswerIndex !== -1) {
6373
+ const updatedAnswers = [...userAnswers];
6374
+ updatedAnswers[existingAnswerIndex] = {
6375
+ ...question,
6376
+ answerKey: answerId || "",
6377
+ isSkipped: !answerId
6378
+ };
6379
+ set({ userAnswers: updatedAnswers });
6380
+ } else {
6381
+ set({
6382
+ userAnswers: [
6383
+ ...userAnswers,
6384
+ {
6385
+ ...question,
6386
+ answerKey: answerId || "",
6387
+ isSkipped: !answerId
6388
+ }
6389
+ ]
6390
+ });
6391
+ }
6392
+ },
6393
+ startQuiz: () => {
6394
+ set({ isStarted: true, timeElapsed: 0 });
6395
+ startTimer();
6396
+ },
6397
+ finishQuiz: () => {
6398
+ set({ isFinished: true });
6399
+ stopTimer();
6400
+ },
6401
+ resetQuiz: () => {
6402
+ stopTimer();
6403
+ set({
6404
+ currentQuestionIndex: 0,
6405
+ selectedAnswers: {},
6406
+ skippedQuestions: [],
6407
+ userAnswers: [],
6408
+ timeElapsed: 0,
6409
+ isStarted: false,
6410
+ isFinished: false
6411
+ });
6412
+ },
6413
+ // Timer
6414
+ updateTime: (time) => set({ timeElapsed: time }),
6415
+ startTimer,
6416
+ stopTimer,
6417
+ // Getters
6418
+ getCurrentQuestion: () => {
6419
+ const { bySimulado, byAtividade, byAula, currentQuestionIndex } = get();
6420
+ const quiz = bySimulado || byAtividade || byAula;
6421
+ if (!quiz) {
6422
+ return null;
6423
+ }
6424
+ return quiz.questions[currentQuestionIndex];
6425
+ },
6426
+ getTotalQuestions: () => {
6427
+ const { bySimulado, byAtividade, byAula } = get();
6428
+ const quiz = bySimulado || byAtividade || byAula;
6429
+ return quiz?.questions?.length || 0;
6430
+ },
6431
+ getAnsweredQuestions: () => {
6432
+ const { selectedAnswers } = get();
6433
+ return Object.keys(selectedAnswers).length;
6434
+ },
6435
+ getUnansweredQuestions: () => {
6436
+ const {
6437
+ bySimulado,
6438
+ byAtividade,
6439
+ byAula,
6440
+ selectedAnswers,
6441
+ skippedQuestions
6442
+ } = get();
6443
+ const quiz = bySimulado || byAtividade || byAula;
6444
+ if (!quiz) return [];
6445
+ const unansweredQuestions = [];
6446
+ quiz.questions.forEach((question, index) => {
6447
+ const isAnswered = question.id in selectedAnswers;
6448
+ const isSkipped = skippedQuestions.includes(question.id);
6449
+ if (!isAnswered && !isSkipped) {
6450
+ unansweredQuestions.push(index + 1);
6451
+ }
6452
+ });
6453
+ return unansweredQuestions;
6454
+ },
6455
+ getSkippedQuestions: () => {
6456
+ const { skippedQuestions } = get();
6457
+ return skippedQuestions.length;
6458
+ },
6459
+ getProgress: () => {
6460
+ const { getTotalQuestions, getAnsweredQuestions } = get();
6461
+ const total = getTotalQuestions();
6462
+ const answered = getAnsweredQuestions();
6463
+ return total > 0 ? answered / total * 100 : 0;
6464
+ },
6465
+ isQuestionAnswered: (questionId) => {
6466
+ const { selectedAnswers } = get();
6467
+ return questionId in selectedAnswers;
6468
+ },
6469
+ isQuestionSkipped: (questionId) => {
6470
+ const { skippedQuestions } = get();
6471
+ return skippedQuestions.includes(questionId);
6472
+ },
6473
+ getCurrentAnswer: () => {
6474
+ const { getCurrentQuestion, selectedAnswers } = get();
6475
+ const currentQuestion = getCurrentQuestion();
6476
+ return selectedAnswers[currentQuestion?.id || ""];
6477
+ },
6478
+ getQuizTitle: () => {
6479
+ const { bySimulado, byAtividade, byAula } = get();
6480
+ const quiz = bySimulado || byAtividade || byAula;
6481
+ return quiz?.title || "Quiz";
6482
+ },
6483
+ formatTime: (seconds) => {
6484
+ const minutes = Math.floor(seconds / 60);
6485
+ const remainingSeconds = seconds % 60;
6486
+ return `${minutes.toString().padStart(2, "0")}:${remainingSeconds.toString().padStart(2, "0")}`;
6487
+ },
6488
+ getUserAnswers: () => {
6489
+ const { userAnswers } = get();
6490
+ return userAnswers;
6491
+ },
6492
+ getUnansweredQuestionsFromUserAnswers: () => {
6493
+ const { bySimulado, byAtividade, byAula, userAnswers } = get();
6494
+ const quiz = bySimulado || byAtividade || byAula;
6495
+ if (!quiz) return [];
6496
+ const unansweredQuestions = [];
6497
+ quiz.questions.forEach((question, index) => {
6498
+ const userAnswer = userAnswers.find(
6499
+ (answer) => answer.id === question.id
6500
+ );
6501
+ if (!userAnswer || userAnswer.isSkipped) {
6502
+ unansweredQuestions.push(index + 1);
6503
+ }
6504
+ });
6505
+ return unansweredQuestions;
6506
+ },
6507
+ getQuestionsGroupedBySubject: () => {
6508
+ const { bySimulado, byAtividade, byAula } = get();
6509
+ const quiz = bySimulado || byAtividade || byAula;
6510
+ if (!quiz) return {};
6511
+ const groupedQuestions = {};
6512
+ quiz.questions.forEach((question) => {
6513
+ const subjectId = question.knowledgeMatrix?.[0]?.subjectId || "Sem mat\xE9ria";
6514
+ if (!groupedQuestions[subjectId]) {
6515
+ groupedQuestions[subjectId] = [];
6516
+ }
6517
+ groupedQuestions[subjectId].push(question);
6518
+ });
6519
+ return groupedQuestions;
6520
+ }
6521
+ };
6522
+ },
6523
+ {
6524
+ name: "quiz-store"
6525
+ }
6526
+ )
6527
+ );
6528
+
6529
+ // src/assets/img/simulated-result.png
6530
+ var simulated_result_default = "./simulated-result-QN5HCUY5.png";
6531
+
6532
+ // src/components/Quiz/Quiz.tsx
6533
+ var import_jsx_runtime33 = require("react/jsx-runtime");
6534
+ var Quiz = (0, import_react22.forwardRef)(({ children, className, ...props }, ref) => {
6535
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6536
+ "div",
6537
+ {
6538
+ ref,
6539
+ className: `w-full max-w-[1000px] flex flex-col mx-auto h-full relative not-lg:px-6 ${className}`,
6540
+ ...props,
6541
+ children
6542
+ }
6543
+ );
6544
+ });
6545
+ var QuizTitle = (0, import_react22.forwardRef)(
6546
+ ({ className, ...props }, ref) => {
6547
+ const {
6548
+ currentQuestionIndex,
6549
+ getTotalQuestions,
6550
+ getQuizTitle,
6551
+ timeElapsed,
6552
+ formatTime,
6553
+ isStarted
6554
+ } = useQuizStore();
6555
+ const totalQuestions = getTotalQuestions();
6556
+ const quizTitle = getQuizTitle();
6557
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6558
+ "div",
6559
+ {
6560
+ ref,
6561
+ className: `flex flex-row justify-center items-center relative p-2 ${className}`,
6562
+ ...props,
6563
+ children: [
6564
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "flex flex-col gap-2 text-center", children: [
6565
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-md", children: quizTitle }),
6566
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-600 text-xs", children: totalQuestions > 0 ? `${currentQuestionIndex + 1} de ${totalQuestions}` : "0 de 0" })
6567
+ ] }),
6568
+ /* @__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" }) })
6569
+ ]
6570
+ }
6571
+ );
6572
+ }
6573
+ );
6574
+ var QuizHeader = () => {
6575
+ const { getCurrentQuestion } = useQuizStore();
6576
+ const currentQuestion = getCurrentQuestion();
6577
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6578
+ HeaderAlternative,
6579
+ {
6580
+ title: currentQuestion ? `Quest\xE3o ${currentQuestion.id}` : "Quest\xE3o",
6581
+ subTitle: currentQuestion?.knowledgeMatrix?.[0]?.topicId ?? "",
6582
+ content: currentQuestion?.questionText ?? ""
6583
+ }
6584
+ );
6585
+ };
6586
+ var QuizContent = (0, import_react22.forwardRef)(({ type = "Alternativas", children, className, ...props }, ref) => {
6587
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6588
+ /* @__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 }) }),
6589
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6590
+ "div",
6591
+ {
6592
+ ref,
6593
+ className: `rounded-t-xl bg-background px-4 pt-4 pb-[80px] h-full flex flex-col gap-4 mb-auto ${className}`,
6594
+ ...props,
6595
+ children
6596
+ }
6597
+ )
6598
+ ] });
6599
+ });
6600
+ var QuizAlternative = () => {
6601
+ const { getCurrentQuestion, selectAnswer, getCurrentAnswer } = useQuizStore();
6602
+ const currentQuestion = getCurrentQuestion();
6603
+ const currentAnswer = getCurrentAnswer();
6604
+ const alternatives = currentQuestion?.options?.map((option) => ({
6605
+ label: option.option,
6606
+ value: option.id
6607
+ }));
6608
+ if (!alternatives)
6609
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { children: "N\xE3o h\xE1 Alternativas" }) });
6610
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-4", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6611
+ AlternativesList,
6612
+ {
6613
+ name: `question-${currentQuestion?.id || "1"}`,
6614
+ layout: "default",
6615
+ alternatives,
6616
+ value: currentAnswer,
6617
+ onValueChange: (value) => {
6618
+ if (currentQuestion) {
6619
+ selectAnswer(currentQuestion.id, value);
6620
+ }
6621
+ }
6622
+ },
6623
+ `question-${currentQuestion?.id || "1"}`
6624
+ ) });
6625
+ };
6626
+ var QuizQuestionList = ({
6627
+ filterType = "all",
6628
+ onQuestionClick
6629
+ } = {}) => {
6630
+ const {
6631
+ getQuestionsGroupedBySubject,
6632
+ goToQuestion,
6633
+ isQuestionAnswered,
6634
+ isQuestionSkipped
6635
+ } = useQuizStore();
6636
+ const groupedQuestions = getQuestionsGroupedBySubject();
6637
+ const getQuestionStatus = (questionId) => {
6638
+ if (isQuestionSkipped(questionId)) {
6639
+ return "skipped";
6640
+ }
6641
+ if (isQuestionAnswered(questionId)) {
6642
+ return "answered";
6643
+ }
6644
+ return "unanswered";
6645
+ };
6646
+ const filteredGroupedQuestions = Object.entries(groupedQuestions).reduce(
6647
+ (acc, [subjectId, questions]) => {
6648
+ const filteredQuestions = questions.filter((question) => {
6649
+ const status = getQuestionStatus(question.id);
6650
+ switch (filterType) {
6651
+ case "answered":
6652
+ return status === "answered";
6653
+ case "unanswered":
6654
+ return status === "unanswered";
6655
+ default:
6656
+ return true;
6657
+ }
6658
+ });
6659
+ if (filteredQuestions.length > 0) {
6660
+ acc[subjectId] = filteredQuestions;
6661
+ }
6662
+ return acc;
6663
+ },
6664
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6665
+ {}
6666
+ );
6667
+ const getQuestionIndex = (questionId) => {
6668
+ const { bySimulado, byAtividade, byAula } = useQuizStore.getState();
6669
+ const quiz = bySimulado ?? byAtividade ?? byAula;
6670
+ if (!quiz) return 0;
6671
+ const index = quiz.questions.findIndex((q) => q.id === questionId);
6672
+ return index + 1;
6673
+ };
6674
+ const getStatusLabel = (status) => {
6675
+ switch (status) {
6676
+ case "answered":
6677
+ return "Respondida";
6678
+ case "skipped":
6679
+ return "Pulada";
6680
+ default:
6681
+ return "Em branco";
6682
+ }
6683
+ };
6684
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "space-y-6 px-4", children: Object.entries(filteredGroupedQuestions).map(
6685
+ ([subjectId, questions]) => /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("section", { className: "flex flex-col gap-2", children: [
6686
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "pt-6 pb-4 flex flex-row gap-2", children: [
6687
+ /* @__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" }) }),
6688
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-800 font-bold text-lg", children: subjectId })
6689
+ ] }),
6690
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("ul", { className: "flex flex-col gap-2", children: questions.map((question) => {
6691
+ const status = getQuestionStatus(question.id);
6692
+ const questionNumber = getQuestionIndex(question.id);
6693
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6694
+ CardStatus,
6695
+ {
6696
+ header: `Quest\xE3o ${questionNumber.toString().padStart(2, "0")}`,
6697
+ label: getStatusLabel(status),
6698
+ onClick: () => {
6699
+ goToQuestion(questionNumber - 1);
6700
+ onQuestionClick?.();
6701
+ }
6702
+ },
6703
+ question.id
6704
+ );
6705
+ }) })
6706
+ ] }, subjectId)
6707
+ ) });
6708
+ };
6709
+ var QuizFooter = (0, import_react22.forwardRef)(({ className, onGoToSimulated, onDetailResult, ...props }, ref) => {
6710
+ const {
6711
+ currentQuestionIndex,
6712
+ getUserAnswers,
6713
+ getTotalQuestions,
6714
+ goToNextQuestion,
6715
+ goToPreviousQuestion,
6716
+ getUnansweredQuestionsFromUserAnswers,
6717
+ getCurrentAnswer,
6718
+ skipQuestion,
6719
+ getCurrentQuestion,
6720
+ isQuestionSkipped
6721
+ } = useQuizStore();
6722
+ const totalQuestions = getTotalQuestions();
6723
+ const isFirstQuestion = currentQuestionIndex === 0;
6724
+ const isLastQuestion = currentQuestionIndex === totalQuestions - 1;
6725
+ const currentAnswer = getCurrentAnswer();
6726
+ const currentQuestion = getCurrentQuestion();
6727
+ const isCurrentQuestionSkipped = currentQuestion ? isQuestionSkipped(currentQuestion.id) : false;
6728
+ const [alertDialogOpen, setAlertDialogOpen] = (0, import_react22.useState)(false);
6729
+ const [modalResultOpen, setModalResultOpen] = (0, import_react22.useState)(false);
6730
+ const [modalNavigateOpen, setModalNavigateOpen] = (0, import_react22.useState)(false);
6731
+ const [filterType, setFilterType] = (0, import_react22.useState)("all");
6732
+ const unansweredQuestions = getUnansweredQuestionsFromUserAnswers();
6733
+ const userAnswers = getUserAnswers();
6734
+ const allQuestions = getTotalQuestions();
6735
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
6736
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
6737
+ "footer",
6738
+ {
6739
+ ref,
6740
+ 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}`,
6741
+ ...props,
6742
+ children: [
6743
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-row items-center gap-1", children: [
6744
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6745
+ IconButton_default,
6746
+ {
6747
+ icon: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.SquaresFour, { size: 24, className: "text-text-950" }),
6748
+ size: "md",
6749
+ onClick: () => setModalNavigateOpen(true)
6750
+ }
6751
+ ),
6752
+ isFirstQuestion ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6753
+ Button_default,
6754
+ {
6755
+ variant: "outline",
6756
+ size: "small",
6757
+ onClick: () => {
6758
+ skipQuestion();
6759
+ goToNextQuestion();
6760
+ },
6761
+ children: "Pular"
6762
+ }
6763
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6764
+ Button_default,
6765
+ {
6766
+ size: "medium",
6767
+ variant: "link",
6768
+ action: "primary",
6769
+ iconLeft: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.CaretLeft, { size: 18 }),
6770
+ onClick: () => {
6771
+ goToPreviousQuestion();
6772
+ },
6773
+ children: "Voltar"
6774
+ }
6775
+ )
6776
+ ] }),
6777
+ !isFirstQuestion && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6778
+ Button_default,
6779
+ {
6780
+ size: "small",
6781
+ variant: "outline",
6782
+ action: "primary",
6783
+ onClick: () => {
6784
+ skipQuestion();
6785
+ goToNextQuestion();
6786
+ },
6787
+ children: "Pular"
6788
+ }
6789
+ ),
6790
+ isLastQuestion ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6791
+ Button_default,
6792
+ {
6793
+ size: "medium",
6794
+ variant: "solid",
6795
+ action: "primary",
6796
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
6797
+ onClick: () => {
6798
+ if (unansweredQuestions.length > 0) {
6799
+ setAlertDialogOpen(true);
6800
+ } else {
6801
+ setModalResultOpen(true);
6802
+ }
6803
+ },
6804
+ children: "Finalizar"
6805
+ }
6806
+ ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6807
+ Button_default,
6808
+ {
6809
+ size: "medium",
6810
+ variant: "link",
6811
+ action: "primary",
6812
+ iconRight: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_phosphor_react16.CaretRight, { size: 18 }),
6813
+ disabled: !currentAnswer && !isCurrentQuestionSkipped,
6814
+ onClick: () => {
6815
+ goToNextQuestion();
6816
+ },
6817
+ children: "Avan\xE7ar"
6818
+ }
6819
+ )
6820
+ ]
6821
+ }
6822
+ ),
6823
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6824
+ AlertDialog,
6825
+ {
6826
+ isOpen: alertDialogOpen,
6827
+ onChangeOpen: setAlertDialogOpen,
6828
+ title: "Finalizar simulado?",
6829
+ 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?",
6830
+ cancelButtonLabel: "Voltar e revisar",
6831
+ submitButtonLabel: "Finalizar Mesmo Assim",
6832
+ onSubmit: () => {
6833
+ setModalResultOpen(true);
6834
+ }
6835
+ }
6836
+ ),
6837
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6838
+ Modal_default,
6839
+ {
6840
+ isOpen: modalResultOpen,
6841
+ onClose: () => setModalResultOpen(false),
6842
+ title: "",
6843
+ closeOnBackdropClick: false,
6844
+ closeOnEscape: false,
6845
+ hideCloseButton: true,
6846
+ size: "md",
6847
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col w-full h-full items-center justify-center gap-4", children: [
6848
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6849
+ "img",
6850
+ {
6851
+ src: simulated_result_default,
6852
+ alt: "Simulated Result",
6853
+ className: "w-[282px] h-auto object-cover"
6854
+ }
6855
+ ),
6856
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col gap-2 text-center", children: [
6857
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("h2", { className: "text-text-950 font-bold text-lg", children: "Voc\xEA concluiu o simulado!" }),
6858
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("p", { className: "text-text-500 font-sm", children: [
6859
+ "Voc\xEA acertou",
6860
+ " ",
6861
+ userAnswers.filter(
6862
+ (answer) => answer.answerKey === answer.correctOptionId
6863
+ ).length,
6864
+ " ",
6865
+ "de ",
6866
+ allQuestions,
6867
+ " quest\xF5es."
6868
+ ] })
6869
+ ] }),
6870
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "px-6 flex flex-row items-center gap-2 w-full", children: [
6871
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6872
+ Button_default,
6873
+ {
6874
+ variant: "outline",
6875
+ className: "w-full",
6876
+ size: "small",
6877
+ onClick: onGoToSimulated,
6878
+ children: "Ir para simulados"
6879
+ }
6880
+ ),
6881
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Button_default, { className: "w-full", onClick: onDetailResult, children: "Detalhar resultado" })
6882
+ ] })
6883
+ ] })
6884
+ }
6885
+ ),
6886
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
6887
+ Modal_default,
6888
+ {
6889
+ isOpen: modalNavigateOpen,
6890
+ onClose: () => setModalNavigateOpen(false),
6891
+ title: "Quest\xF5es",
6892
+ size: "lg",
6893
+ children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex flex-col w-full h-full", children: [
6894
+ /* @__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: [
6895
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("p", { className: "text-text-950 font-bold text-lg", children: "Filtrar por" }),
6896
+ /* @__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: [
6897
+ /* @__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" }) }),
6898
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(SelectContent, { children: [
6899
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectItem, { value: "all", children: "Todas" }),
6900
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectItem, { value: "unanswered", children: "Em branco" }),
6901
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(SelectItem, { value: "answered", children: "Respondidas" })
6902
+ ] })
6903
+ ] }) })
6904
+ ] }),
6905
+ /* @__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)(
6906
+ QuizQuestionList,
6907
+ {
6908
+ filterType,
6909
+ onQuestionClick: () => setModalNavigateOpen(false)
6910
+ }
6911
+ ) })
6912
+ ] })
6913
+ }
6914
+ )
6915
+ ] });
6916
+ });
6270
6917
  // Annotate the CommonJS export names for ESM import in node:
6271
6918
  0 && (module.exports = {
6272
6919
  Alert,
@@ -6314,6 +6961,13 @@ function useApiConfig(api) {
6314
6961
  ProgressCircle,
6315
6962
  ProtectedRoute,
6316
6963
  PublicRoute,
6964
+ Quiz,
6965
+ QuizAlternative,
6966
+ QuizContent,
6967
+ QuizFooter,
6968
+ QuizHeader,
6969
+ QuizQuestionList,
6970
+ QuizTitle,
6317
6971
  Radio,
6318
6972
  RadioGroup,
6319
6973
  RadioGroupItem,
@@ -6342,6 +6996,7 @@ function useApiConfig(api) {
6342
6996
  useApiConfig,
6343
6997
  useAuth,
6344
6998
  useAuthGuard,
6999
+ useQuizStore,
6345
7000
  useRouteAuth,
6346
7001
  useToastStore,
6347
7002
  useUrlAuthentication,