@digabi/exam-engine-core 23.0.0 → 23.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
- package/dist/components/exam/ExamineExam.d.ts +5 -0
- package/dist/components/exam/ExamineExam.d.ts.map +1 -0
- package/dist/components/exam/ExamineExam.js +20 -0
- package/dist/components/exam/ExamineExam.js.map +1 -0
- package/dist/main-bundle.js +2 -4
- package/dist/src/components/AnswerToolbar.d.ts +18 -0
- package/dist/src/components/AnswerToolbar.d.ts.map +1 -0
- package/dist/src/components/AnswerToolbar.js +36 -0
- package/dist/src/components/AnswerToolbar.js.map +1 -0
- package/dist/src/components/AnsweringInstructions.d.ts +12 -0
- package/dist/src/components/AnsweringInstructions.d.ts.map +1 -0
- package/dist/src/components/AnsweringInstructions.js +24 -0
- package/dist/src/components/AnsweringInstructions.js.map +1 -0
- package/dist/src/components/DocumentTitle.d.ts +5 -0
- package/dist/src/components/DocumentTitle.d.ts.map +1 -0
- package/dist/src/components/DocumentTitle.js +13 -0
- package/dist/src/components/DocumentTitle.js.map +1 -0
- package/dist/src/components/NotificationIcon.d.ts +4 -0
- package/dist/src/components/NotificationIcon.d.ts.map +1 -0
- package/dist/src/components/NotificationIcon.js +6 -0
- package/dist/src/components/NotificationIcon.js.map +1 -0
- package/dist/src/components/RenderChildNodes.d.ts +5 -0
- package/dist/src/components/RenderChildNodes.d.ts.map +1 -0
- package/dist/src/components/RenderChildNodes.js +7 -0
- package/dist/src/components/RenderChildNodes.js.map +1 -0
- package/dist/src/components/RenderExamElements.d.ts +6 -0
- package/dist/src/components/RenderExamElements.d.ts.map +1 -0
- package/dist/src/components/RenderExamElements.js +6 -0
- package/dist/src/components/RenderExamElements.js.map +1 -0
- package/dist/src/components/RenderIf.d.ts +4 -0
- package/dist/src/components/RenderIf.d.ts.map +1 -0
- package/dist/src/components/RenderIf.js +8 -0
- package/dist/src/components/RenderIf.js.map +1 -0
- package/dist/src/components/ScreenReaderOnly.d.ts +5 -0
- package/dist/src/components/ScreenReaderOnly.d.ts.map +1 -0
- package/dist/src/components/ScreenReaderOnly.js +3 -0
- package/dist/src/components/ScreenReaderOnly.js.map +1 -0
- package/dist/src/components/SectionElement.d.ts +4 -0
- package/dist/src/components/SectionElement.d.ts.map +1 -0
- package/dist/src/components/SectionElement.js +8 -0
- package/dist/src/components/SectionElement.js.map +1 -0
- package/dist/src/components/attachments/Attachment.d.ts +4 -0
- package/dist/src/components/attachments/Attachment.d.ts.map +1 -0
- package/dist/src/components/attachments/Attachment.js +8 -0
- package/dist/src/components/attachments/Attachment.js.map +1 -0
- package/dist/src/components/attachments/AttachmentTitle.d.ts +6 -0
- package/dist/src/components/attachments/AttachmentTitle.d.ts.map +1 -0
- package/dist/src/components/attachments/AttachmentTitle.js +12 -0
- package/dist/src/components/attachments/AttachmentTitle.js.map +1 -0
- package/dist/src/components/attachments/Attachments.d.ts +5 -0
- package/dist/src/components/attachments/Attachments.d.ts.map +1 -0
- package/dist/src/components/attachments/Attachments.js +55 -0
- package/dist/src/components/attachments/Attachments.js.map +1 -0
- package/dist/src/components/attachments/ExternalMaterial.d.ts +9 -0
- package/dist/src/components/attachments/ExternalMaterial.d.ts.map +1 -0
- package/dist/src/components/attachments/ExternalMaterial.js +46 -0
- package/dist/src/components/attachments/ExternalMaterial.js.map +1 -0
- package/dist/src/components/attachments/Question.d.ts +4 -0
- package/dist/src/components/attachments/Question.d.ts.map +1 -0
- package/dist/src/components/attachments/Question.js +16 -0
- package/dist/src/components/attachments/Question.js.map +1 -0
- package/dist/src/components/attachments/QuestionTitle.d.ts +6 -0
- package/dist/src/components/attachments/QuestionTitle.d.ts.map +1 -0
- package/dist/src/components/attachments/QuestionTitle.js +15 -0
- package/dist/src/components/attachments/QuestionTitle.js.map +1 -0
- package/dist/src/components/context/AnnotationProvider.d.ts +16 -0
- package/dist/src/components/context/AnnotationProvider.d.ts.map +1 -0
- package/dist/src/components/context/AnnotationProvider.js +35 -0
- package/dist/src/components/context/AnnotationProvider.js.map +1 -0
- package/dist/src/components/context/AttachmentContext.d.ts +13 -0
- package/dist/src/components/context/AttachmentContext.d.ts.map +1 -0
- package/dist/src/components/context/AttachmentContext.js +12 -0
- package/dist/src/components/context/AttachmentContext.js.map +1 -0
- package/dist/src/components/context/CommonExamContext.d.ts +22 -0
- package/dist/src/components/context/CommonExamContext.d.ts.map +1 -0
- package/dist/src/components/context/CommonExamContext.js +28 -0
- package/dist/src/components/context/CommonExamContext.js.map +1 -0
- package/dist/src/components/context/ExamContext.d.ts +9 -0
- package/dist/src/components/context/ExamContext.d.ts.map +1 -0
- package/dist/src/components/context/ExamContext.js +11 -0
- package/dist/src/components/context/ExamContext.js.map +1 -0
- package/dist/src/components/context/IsInSidebarContext.d.ts +6 -0
- package/dist/src/components/context/IsInSidebarContext.d.ts.map +1 -0
- package/dist/src/components/context/IsInSidebarContext.js +3 -0
- package/dist/src/components/context/IsInSidebarContext.js.map +1 -0
- package/dist/src/components/context/QuestionContext.d.ts +14 -0
- package/dist/src/components/context/QuestionContext.d.ts.map +1 -0
- package/dist/src/components/context/QuestionContext.js +27 -0
- package/dist/src/components/context/QuestionContext.js.map +1 -0
- package/dist/src/components/context/ResultsContext.d.ts +17 -0
- package/dist/src/components/context/ResultsContext.d.ts.map +1 -0
- package/dist/src/components/context/ResultsContext.js +69 -0
- package/dist/src/components/context/ResultsContext.js.map +1 -0
- package/dist/src/components/context/SectionContext.d.ts +12 -0
- package/dist/src/components/context/SectionContext.d.ts.map +1 -0
- package/dist/src/components/context/SectionContext.js +21 -0
- package/dist/src/components/context/SectionContext.js.map +1 -0
- package/dist/src/components/context/TOCContext.d.ts +7 -0
- package/dist/src/components/context/TOCContext.d.ts.map +1 -0
- package/dist/src/components/context/TOCContext.js +3 -0
- package/dist/src/components/context/TOCContext.js.map +1 -0
- package/dist/src/components/context/withContext.d.ts +3 -0
- package/dist/src/components/context/withContext.d.ts.map +1 -0
- package/dist/src/components/context/withContext.js +12 -0
- package/dist/src/components/context/withContext.js.map +1 -0
- package/dist/src/components/exam/Attachment.d.ts +4 -0
- package/dist/src/components/exam/Attachment.d.ts.map +1 -0
- package/dist/src/components/exam/Attachment.js +8 -0
- package/dist/src/components/exam/Attachment.js.map +1 -0
- package/dist/src/components/exam/ChoiceAnswer.d.ts +5 -0
- package/dist/src/components/exam/ChoiceAnswer.d.ts.map +1 -0
- package/dist/src/components/exam/ChoiceAnswer.js +53 -0
- package/dist/src/components/exam/ChoiceAnswer.js.map +1 -0
- package/dist/src/components/exam/DropdownAnswer.d.ts +5 -0
- package/dist/src/components/exam/DropdownAnswer.d.ts.map +1 -0
- package/dist/src/components/exam/DropdownAnswer.js +101 -0
- package/dist/src/components/exam/DropdownAnswer.js.map +1 -0
- package/dist/src/components/exam/Exam.d.ts +48 -0
- package/dist/src/components/exam/Exam.d.ts.map +1 -0
- package/dist/src/components/exam/Exam.js +195 -0
- package/dist/src/components/exam/Exam.js.map +1 -0
- package/dist/src/components/exam/ExamFooter.d.ts +6 -0
- package/dist/src/components/exam/ExamFooter.d.ts.map +1 -0
- package/dist/src/components/exam/ExamFooter.js +6 -0
- package/dist/src/components/exam/ExamFooter.js.map +1 -0
- package/dist/src/components/exam/ExamInstruction.d.ts +6 -0
- package/dist/src/components/exam/ExamInstruction.d.ts.map +1 -0
- package/dist/src/components/exam/ExamInstruction.js +6 -0
- package/dist/src/components/exam/ExamInstruction.js.map +1 -0
- package/dist/src/components/exam/ExternalMaterial.d.ts +10 -0
- package/dist/src/components/exam/ExternalMaterial.d.ts.map +1 -0
- package/dist/src/components/exam/ExternalMaterial.js +33 -0
- package/dist/src/components/exam/ExternalMaterial.js.map +1 -0
- package/dist/src/components/exam/GoToExamineAnswersButton.d.ts +5 -0
- package/dist/src/components/exam/GoToExamineAnswersButton.d.ts.map +1 -0
- package/dist/src/components/exam/GoToExamineAnswersButton.js +18 -0
- package/dist/src/components/exam/GoToExamineAnswersButton.js.map +1 -0
- package/dist/src/components/exam/Hints.d.ts +5 -0
- package/dist/src/components/exam/Hints.d.ts.map +1 -0
- package/dist/src/components/exam/Hints.js +31 -0
- package/dist/src/components/exam/Hints.js.map +1 -0
- package/dist/src/components/exam/Question.d.ts +8 -0
- package/dist/src/components/exam/Question.d.ts.map +1 -0
- package/dist/src/components/exam/Question.js +75 -0
- package/dist/src/components/exam/Question.js.map +1 -0
- package/dist/src/components/exam/QuestionInstruction.d.ts +6 -0
- package/dist/src/components/exam/QuestionInstruction.d.ts.map +1 -0
- package/dist/src/components/exam/QuestionInstruction.js +8 -0
- package/dist/src/components/exam/QuestionInstruction.js.map +1 -0
- package/dist/src/components/exam/QuestionTitle.d.ts +5 -0
- package/dist/src/components/exam/QuestionTitle.d.ts.map +1 -0
- package/dist/src/components/exam/QuestionTitle.js +26 -0
- package/dist/src/components/exam/QuestionTitle.js.map +1 -0
- package/dist/src/components/exam/RichTextAnswer.d.ts +41 -0
- package/dist/src/components/exam/RichTextAnswer.d.ts.map +1 -0
- package/dist/src/components/exam/RichTextAnswer.js +79 -0
- package/dist/src/components/exam/RichTextAnswer.js.map +1 -0
- package/dist/src/components/exam/Section.d.ts +4 -0
- package/dist/src/components/exam/Section.d.ts.map +1 -0
- package/dist/src/components/exam/Section.js +49 -0
- package/dist/src/components/exam/Section.js.map +1 -0
- package/dist/src/components/exam/SectionInstruction.d.ts +6 -0
- package/dist/src/components/exam/SectionInstruction.d.ts.map +1 -0
- package/dist/src/components/exam/SectionInstruction.js +6 -0
- package/dist/src/components/exam/SectionInstruction.js.map +1 -0
- package/dist/src/components/exam/SectionTitle.d.ts +6 -0
- package/dist/src/components/exam/SectionTitle.d.ts.map +1 -0
- package/dist/src/components/exam/SectionTitle.js +30 -0
- package/dist/src/components/exam/SectionTitle.js.map +1 -0
- package/dist/src/components/exam/StudentNameHeader.d.ts +8 -0
- package/dist/src/components/exam/StudentNameHeader.d.ts.map +1 -0
- package/dist/src/components/exam/StudentNameHeader.js +3 -0
- package/dist/src/components/exam/StudentNameHeader.js.map +1 -0
- package/dist/src/components/exam/TextAnswer.d.ts +6 -0
- package/dist/src/components/exam/TextAnswer.d.ts.map +1 -0
- package/dist/src/components/exam/TextAnswer.js +20 -0
- package/dist/src/components/exam/TextAnswer.js.map +1 -0
- package/dist/src/components/exam/UndoHistoryEntry.d.ts +19 -0
- package/dist/src/components/exam/UndoHistoryEntry.d.ts.map +1 -0
- package/dist/src/components/exam/UndoHistoryEntry.js +39 -0
- package/dist/src/components/exam/UndoHistoryEntry.js.map +1 -0
- package/dist/src/components/exam/UndoView.d.ts +35 -0
- package/dist/src/components/exam/UndoView.d.ts.map +1 -0
- package/dist/src/components/exam/UndoView.js +162 -0
- package/dist/src/components/exam/UndoView.js.map +1 -0
- package/dist/src/components/exam/internal/ErrorIndicator.d.ts +9 -0
- package/dist/src/components/exam/internal/ErrorIndicator.d.ts.map +1 -0
- package/dist/src/components/exam/internal/ErrorIndicator.js +63 -0
- package/dist/src/components/exam/internal/ErrorIndicator.js.map +1 -0
- package/dist/src/components/exam/internal/ProgressBar.d.ts +8 -0
- package/dist/src/components/exam/internal/ProgressBar.d.ts.map +1 -0
- package/dist/src/components/exam/internal/ProgressBar.js +19 -0
- package/dist/src/components/exam/internal/ProgressBar.js.map +1 -0
- package/dist/src/components/exam/internal/SaveIndicator.d.ts +5 -0
- package/dist/src/components/exam/internal/SaveIndicator.d.ts.map +1 -0
- package/dist/src/components/exam/internal/SaveIndicator.js +16 -0
- package/dist/src/components/exam/internal/SaveIndicator.js.map +1 -0
- package/dist/src/components/exam/internal/TextAnswerInput.d.ts +6 -0
- package/dist/src/components/exam/internal/TextAnswerInput.d.ts.map +1 -0
- package/dist/src/components/exam/internal/TextAnswerInput.js +128 -0
- package/dist/src/components/exam/internal/TextAnswerInput.js.map +1 -0
- package/dist/src/components/grading/AnswerCharacterCounter.d.ts +6 -0
- package/dist/src/components/grading/AnswerCharacterCounter.d.ts.map +1 -0
- package/dist/src/components/grading/AnswerCharacterCounter.js +21 -0
- package/dist/src/components/grading/AnswerCharacterCounter.js.map +1 -0
- package/dist/src/components/grading/GradingAnswer.d.ts +24 -0
- package/dist/src/components/grading/GradingAnswer.d.ts.map +1 -0
- package/dist/src/components/grading/GradingAnswer.js +306 -0
- package/dist/src/components/grading/GradingAnswer.js.map +1 -0
- package/dist/src/components/grading/GradingAnswerAnnotationList.d.ts +9 -0
- package/dist/src/components/grading/GradingAnswerAnnotationList.d.ts.map +1 -0
- package/dist/src/components/grading/GradingAnswerAnnotationList.js +19 -0
- package/dist/src/components/grading/GradingAnswerAnnotationList.js.map +1 -0
- package/dist/src/components/grading/editAnnotations.d.ts +29 -0
- package/dist/src/components/grading/editAnnotations.d.ts.map +1 -0
- package/dist/src/components/grading/editAnnotations.js +190 -0
- package/dist/src/components/grading/editAnnotations.js.map +1 -0
- package/dist/src/components/grading/examAnnotationUtils.d.ts +3 -0
- package/dist/src/components/grading/examAnnotationUtils.d.ts.map +1 -0
- package/dist/src/components/grading/examAnnotationUtils.js +44 -0
- package/dist/src/components/grading/examAnnotationUtils.js.map +1 -0
- package/dist/src/components/grading/largeImageDetector.d.ts +3 -0
- package/dist/src/components/grading/largeImageDetector.d.ts.map +1 -0
- package/dist/src/components/grading/largeImageDetector.js +45 -0
- package/dist/src/components/grading/largeImageDetector.js.map +1 -0
- package/dist/src/components/grading-instructions/AnswerGradingInstruction.d.ts +5 -0
- package/dist/src/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/AnswerGradingInstruction.js +4 -0
- package/dist/src/components/grading-instructions/AnswerGradingInstruction.js.map +1 -0
- package/dist/src/components/grading-instructions/AutogradedAnswer.d.ts +5 -0
- package/dist/src/components/grading-instructions/AutogradedAnswer.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/AutogradedAnswer.js +34 -0
- package/dist/src/components/grading-instructions/AutogradedAnswer.js.map +1 -0
- package/dist/src/components/grading-instructions/AutogradedAnswerOption.d.ts +5 -0
- package/dist/src/components/grading-instructions/AutogradedAnswerOption.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/AutogradedAnswerOption.js +17 -0
- package/dist/src/components/grading-instructions/AutogradedAnswerOption.js.map +1 -0
- package/dist/src/components/grading-instructions/ExamGradingInstruction.d.ts +5 -0
- package/dist/src/components/grading-instructions/ExamGradingInstruction.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/ExamGradingInstruction.js +4 -0
- package/dist/src/components/grading-instructions/ExamGradingInstruction.js.map +1 -0
- package/dist/src/components/grading-instructions/GradingInstructions.d.ts +6 -0
- package/dist/src/components/grading-instructions/GradingInstructions.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/GradingInstructions.js +109 -0
- package/dist/src/components/grading-instructions/GradingInstructions.js.map +1 -0
- package/dist/src/components/grading-instructions/Question.d.ts +4 -0
- package/dist/src/components/grading-instructions/Question.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/Question.js +14 -0
- package/dist/src/components/grading-instructions/Question.js.map +1 -0
- package/dist/src/components/grading-instructions/QuestionTitle.d.ts +5 -0
- package/dist/src/components/grading-instructions/QuestionTitle.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/QuestionTitle.js +19 -0
- package/dist/src/components/grading-instructions/QuestionTitle.js.map +1 -0
- package/dist/src/components/grading-instructions/Recording.d.ts +5 -0
- package/dist/src/components/grading-instructions/Recording.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/Recording.js +19 -0
- package/dist/src/components/grading-instructions/Recording.js.map +1 -0
- package/dist/src/components/grading-instructions/Section.d.ts +4 -0
- package/dist/src/components/grading-instructions/Section.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/Section.js +10 -0
- package/dist/src/components/grading-instructions/Section.js.map +1 -0
- package/dist/src/components/grading-instructions/SectionTitle.d.ts +5 -0
- package/dist/src/components/grading-instructions/SectionTitle.d.ts.map +1 -0
- package/dist/src/components/grading-instructions/SectionTitle.js +16 -0
- package/dist/src/components/grading-instructions/SectionTitle.js.map +1 -0
- package/dist/src/components/results/ChoiceAnswer.d.ts +6 -0
- package/dist/src/components/results/ChoiceAnswer.d.ts.map +1 -0
- package/dist/src/components/results/ChoiceAnswer.js +57 -0
- package/dist/src/components/results/ChoiceAnswer.js.map +1 -0
- package/dist/src/components/results/DropdownAnswer.d.ts +6 -0
- package/dist/src/components/results/DropdownAnswer.d.ts.map +1 -0
- package/dist/src/components/results/DropdownAnswer.js +43 -0
- package/dist/src/components/results/DropdownAnswer.js.map +1 -0
- package/dist/src/components/results/EndExamSession.d.ts +8 -0
- package/dist/src/components/results/EndExamSession.d.ts.map +1 -0
- package/dist/src/components/results/EndExamSession.js +20 -0
- package/dist/src/components/results/EndExamSession.js.map +1 -0
- package/dist/src/components/results/MultiLineAnswer.d.ts +8 -0
- package/dist/src/components/results/MultiLineAnswer.d.ts.map +1 -0
- package/dist/src/components/results/MultiLineAnswer.js +22 -0
- package/dist/src/components/results/MultiLineAnswer.js.map +1 -0
- package/dist/src/components/results/Question.d.ts +4 -0
- package/dist/src/components/results/Question.d.ts.map +1 -0
- package/dist/src/components/results/Question.js +31 -0
- package/dist/src/components/results/Question.js.map +1 -0
- package/dist/src/components/results/QuestionTitle.d.ts +6 -0
- package/dist/src/components/results/QuestionTitle.d.ts.map +1 -0
- package/dist/src/components/results/QuestionTitle.js +26 -0
- package/dist/src/components/results/QuestionTitle.js.map +1 -0
- package/dist/src/components/results/Results.d.ts +19 -0
- package/dist/src/components/results/Results.d.ts.map +1 -0
- package/dist/src/components/results/Results.js +136 -0
- package/dist/src/components/results/Results.js.map +1 -0
- package/dist/src/components/results/ScoredTextAnswer.d.ts +6 -0
- package/dist/src/components/results/ScoredTextAnswer.d.ts.map +1 -0
- package/dist/src/components/results/ScoredTextAnswer.js +22 -0
- package/dist/src/components/results/ScoredTextAnswer.js.map +1 -0
- package/dist/src/components/results/Section.d.ts +4 -0
- package/dist/src/components/results/Section.d.ts.map +1 -0
- package/dist/src/components/results/Section.js +11 -0
- package/dist/src/components/results/Section.js.map +1 -0
- package/dist/src/components/results/SingleLineAnswer.d.ts +12 -0
- package/dist/src/components/results/SingleLineAnswer.d.ts.map +1 -0
- package/dist/src/components/results/SingleLineAnswer.js +26 -0
- package/dist/src/components/results/SingleLineAnswer.js.map +1 -0
- package/dist/src/components/results/TextAnswer.d.ts +7 -0
- package/dist/src/components/results/TextAnswer.d.ts.map +1 -0
- package/dist/src/components/results/TextAnswer.js +48 -0
- package/dist/src/components/results/TextAnswer.js.map +1 -0
- package/dist/src/components/results/internal/AnnotationList.d.ts +5 -0
- package/dist/src/components/results/internal/AnnotationList.d.ts.map +1 -0
- package/dist/src/components/results/internal/AnnotationList.js +32 -0
- package/dist/src/components/results/internal/AnnotationList.js.map +1 -0
- package/dist/src/components/results/internal/QuestionAutoScore.d.ts +11 -0
- package/dist/src/components/results/internal/QuestionAutoScore.d.ts.map +1 -0
- package/dist/src/components/results/internal/QuestionAutoScore.js +17 -0
- package/dist/src/components/results/internal/QuestionAutoScore.js.map +1 -0
- package/dist/src/components/results/internal/QuestionManualScore.d.ts +13 -0
- package/dist/src/components/results/internal/QuestionManualScore.d.ts.map +1 -0
- package/dist/src/components/results/internal/QuestionManualScore.js +66 -0
- package/dist/src/components/results/internal/QuestionManualScore.js.map +1 -0
- package/dist/src/components/results/internal/QuestionScoresContainer.d.ts +11 -0
- package/dist/src/components/results/internal/QuestionScoresContainer.d.ts.map +1 -0
- package/dist/src/components/results/internal/QuestionScoresContainer.js +27 -0
- package/dist/src/components/results/internal/QuestionScoresContainer.js.map +1 -0
- package/dist/src/components/results/isExamineExamPageHook.d.ts +2 -0
- package/dist/src/components/results/isExamineExamPageHook.d.ts.map +1 -0
- package/dist/src/components/results/isExamineExamPageHook.js +7 -0
- package/dist/src/components/results/isExamineExamPageHook.js.map +1 -0
- package/dist/src/components/shared/AnnotatableText.d.ts +5 -0
- package/dist/src/components/shared/AnnotatableText.d.ts.map +1 -0
- package/dist/src/components/shared/AnnotatableText.js +73 -0
- package/dist/src/components/shared/AnnotatableText.js.map +1 -0
- package/dist/src/components/shared/AnnotationLists.d.ts +13 -0
- package/dist/src/components/shared/AnnotationLists.d.ts.map +1 -0
- package/dist/src/components/shared/AnnotationLists.js +17 -0
- package/dist/src/components/shared/AnnotationLists.js.map +1 -0
- package/dist/src/components/shared/AnnotationPopup.d.ts +3 -0
- package/dist/src/components/shared/AnnotationPopup.d.ts.map +1 -0
- package/dist/src/components/shared/AnnotationPopup.js +74 -0
- package/dist/src/components/shared/AnnotationPopup.js.map +1 -0
- package/dist/src/components/shared/AnswerIndicator.d.ts +12 -0
- package/dist/src/components/shared/AnswerIndicator.d.ts.map +1 -0
- package/dist/src/components/shared/AnswerIndicator.js +27 -0
- package/dist/src/components/shared/AnswerIndicator.js.map +1 -0
- package/dist/src/components/shared/AnswerLengthInfo.d.ts +7 -0
- package/dist/src/components/shared/AnswerLengthInfo.d.ts.map +1 -0
- package/dist/src/components/shared/AnswerLengthInfo.js +11 -0
- package/dist/src/components/shared/AnswerLengthInfo.js.map +1 -0
- package/dist/src/components/shared/AttachmentLink.d.ts +5 -0
- package/dist/src/components/shared/AttachmentLink.d.ts.map +1 -0
- package/dist/src/components/shared/AttachmentLink.js +28 -0
- package/dist/src/components/shared/AttachmentLink.js.map +1 -0
- package/dist/src/components/shared/AttachmentLinks.d.ts +5 -0
- package/dist/src/components/shared/AttachmentLinks.d.ts.map +1 -0
- package/dist/src/components/shared/AttachmentLinks.js +58 -0
- package/dist/src/components/shared/AttachmentLinks.js.map +1 -0
- package/dist/src/components/shared/Audio.d.ts +6 -0
- package/dist/src/components/shared/Audio.d.ts.map +1 -0
- package/dist/src/components/shared/Audio.js +31 -0
- package/dist/src/components/shared/Audio.js.map +1 -0
- package/dist/src/components/shared/AudioGroup.d.ts +6 -0
- package/dist/src/components/shared/AudioGroup.d.ts.map +1 -0
- package/dist/src/components/shared/AudioGroup.js +9 -0
- package/dist/src/components/shared/AudioGroup.js.map +1 -0
- package/dist/src/components/shared/AudioTest.d.ts +6 -0
- package/dist/src/components/shared/AudioTest.d.ts.map +1 -0
- package/dist/src/components/shared/AudioTest.js +34 -0
- package/dist/src/components/shared/AudioTest.js.map +1 -0
- package/dist/src/components/shared/ExamTranslation.d.ts +6 -0
- package/dist/src/components/shared/ExamTranslation.d.ts.map +1 -0
- package/dist/src/components/shared/ExamTranslation.js +9 -0
- package/dist/src/components/shared/ExamTranslation.js.map +1 -0
- package/dist/src/components/shared/File.d.ts +6 -0
- package/dist/src/components/shared/File.d.ts.map +1 -0
- package/dist/src/components/shared/File.js +15 -0
- package/dist/src/components/shared/File.js.map +1 -0
- package/dist/src/components/shared/Footer.d.ts +5 -0
- package/dist/src/components/shared/Footer.d.ts.map +1 -0
- package/dist/src/components/shared/Footer.js +3 -0
- package/dist/src/components/shared/Footer.js.map +1 -0
- package/dist/src/components/shared/Formula.d.ts +6 -0
- package/dist/src/components/shared/Formula.d.ts.map +1 -0
- package/dist/src/components/shared/Formula.js +13 -0
- package/dist/src/components/shared/Formula.js.map +1 -0
- package/dist/src/components/shared/Image.d.ts +6 -0
- package/dist/src/components/shared/Image.d.ts.map +1 -0
- package/dist/src/components/shared/Image.js +30 -0
- package/dist/src/components/shared/Image.js.map +1 -0
- package/dist/src/components/shared/ImageOverlay.d.ts +6 -0
- package/dist/src/components/shared/ImageOverlay.d.ts.map +1 -0
- package/dist/src/components/shared/ImageOverlay.js +43 -0
- package/dist/src/components/shared/ImageOverlay.js.map +1 -0
- package/dist/src/components/shared/QuestionNumber.d.ts +4 -0
- package/dist/src/components/shared/QuestionNumber.d.ts.map +1 -0
- package/dist/src/components/shared/QuestionNumber.js +12 -0
- package/dist/src/components/shared/QuestionNumber.js.map +1 -0
- package/dist/src/components/shared/Reference.d.ts +6 -0
- package/dist/src/components/shared/Reference.d.ts.map +1 -0
- package/dist/src/components/shared/Reference.js +72 -0
- package/dist/src/components/shared/Reference.js.map +1 -0
- package/dist/src/components/shared/References.d.ts +6 -0
- package/dist/src/components/shared/References.d.ts.map +1 -0
- package/dist/src/components/shared/References.js +26 -0
- package/dist/src/components/shared/References.js.map +1 -0
- package/dist/src/components/shared/Score.d.ts +8 -0
- package/dist/src/components/shared/Score.d.ts.map +1 -0
- package/dist/src/components/shared/Score.js +13 -0
- package/dist/src/components/shared/Score.js.map +1 -0
- package/dist/src/components/shared/TOCQuestion.d.ts +4 -0
- package/dist/src/components/shared/TOCQuestion.d.ts.map +1 -0
- package/dist/src/components/shared/TOCQuestion.js +77 -0
- package/dist/src/components/shared/TOCQuestion.js.map +1 -0
- package/dist/src/components/shared/TOCSection.d.ts +7 -0
- package/dist/src/components/shared/TOCSection.d.ts.map +1 -0
- package/dist/src/components/shared/TOCSection.js +15 -0
- package/dist/src/components/shared/TOCSection.js.map +1 -0
- package/dist/src/components/shared/TOCSectionTitle.d.ts +4 -0
- package/dist/src/components/shared/TOCSectionTitle.d.ts.map +1 -0
- package/dist/src/components/shared/TOCSectionTitle.js +34 -0
- package/dist/src/components/shared/TOCSectionTitle.js.map +1 -0
- package/dist/src/components/shared/TableOfContents.d.ts +8 -0
- package/dist/src/components/shared/TableOfContents.d.ts.map +1 -0
- package/dist/src/components/shared/TableOfContents.js +61 -0
- package/dist/src/components/shared/TableOfContents.js.map +1 -0
- package/dist/src/components/shared/VersionNumber.d.ts +3 -0
- package/dist/src/components/shared/VersionNumber.d.ts.map +1 -0
- package/dist/src/components/shared/VersionNumber.js +10 -0
- package/dist/src/components/shared/VersionNumber.js.map +1 -0
- package/dist/src/components/shared/Video.d.ts +6 -0
- package/dist/src/components/shared/Video.d.ts.map +1 -0
- package/dist/src/components/shared/Video.js +22 -0
- package/dist/src/components/shared/Video.js.map +1 -0
- package/dist/src/components/shared/internal/AttachmentLinkAnchor.d.ts +8 -0
- package/dist/src/components/shared/internal/AttachmentLinkAnchor.d.ts.map +1 -0
- package/dist/src/components/shared/internal/AttachmentLinkAnchor.js +4 -0
- package/dist/src/components/shared/internal/AttachmentLinkAnchor.js.map +1 -0
- package/dist/src/components/shared/internal/AudioPlaybackError.d.ts +8 -0
- package/dist/src/components/shared/internal/AudioPlaybackError.d.ts.map +1 -0
- package/dist/src/components/shared/internal/AudioPlaybackError.js +17 -0
- package/dist/src/components/shared/internal/AudioPlaybackError.js.map +1 -0
- package/dist/src/components/shared/internal/ResponsiveMediaContainer.d.ts +18 -0
- package/dist/src/components/shared/internal/ResponsiveMediaContainer.d.ts.map +1 -0
- package/dist/src/components/shared/internal/ResponsiveMediaContainer.js +21 -0
- package/dist/src/components/shared/internal/ResponsiveMediaContainer.js.map +1 -0
- package/dist/src/components/shared/internal/RestrictedAudioPlayer.d.ts +12 -0
- package/dist/src/components/shared/internal/RestrictedAudioPlayer.d.ts.map +1 -0
- package/dist/src/components/shared/internal/RestrictedAudioPlayer.js +46 -0
- package/dist/src/components/shared/internal/RestrictedAudioPlayer.js.map +1 -0
- package/dist/src/components/surround.d.ts +8 -0
- package/dist/src/components/surround.d.ts.map +1 -0
- package/dist/src/components/surround.js +19 -0
- package/dist/src/components/surround.js.map +1 -0
- package/dist/src/createRenderChildNodes.d.ts +17 -0
- package/dist/src/createRenderChildNodes.d.ts.map +1 -0
- package/dist/src/createRenderChildNodes.js +64 -0
- package/dist/src/createRenderChildNodes.js.map +1 -0
- package/dist/src/dom-utils.d.ts +20 -0
- package/dist/src/dom-utils.d.ts.map +1 -0
- package/dist/src/dom-utils.js +164 -0
- package/dist/src/dom-utils.js.map +1 -0
- package/dist/src/fonts.d.ts +5 -0
- package/dist/src/fonts.d.ts.map +1 -0
- package/dist/src/fonts.js +16 -0
- package/dist/src/fonts.js.map +1 -0
- package/dist/src/formatting.d.ts +2 -0
- package/dist/src/formatting.d.ts.map +1 -0
- package/dist/src/formatting.js +4 -0
- package/dist/src/formatting.js.map +1 -0
- package/dist/src/getDisplayName.d.ts +4 -0
- package/dist/src/getDisplayName.d.ts.map +1 -0
- package/dist/src/getDisplayName.js +5 -0
- package/dist/src/getDisplayName.js.map +1 -0
- package/dist/src/i18n/A_E.d.ts +3 -0
- package/dist/src/i18n/A_E.d.ts.map +1 -0
- package/dist/src/i18n/A_E.js +8 -0
- package/dist/src/i18n/A_E.js.map +1 -0
- package/dist/src/i18n/BA.d.ts +3 -0
- package/dist/src/i18n/BA.d.ts.map +1 -0
- package/dist/src/i18n/BA.js +11 -0
- package/dist/src/i18n/BA.js.map +1 -0
- package/dist/src/i18n/CA.d.ts +3 -0
- package/dist/src/i18n/CA.d.ts.map +1 -0
- package/dist/src/i18n/CA.js +11 -0
- package/dist/src/i18n/CA.js.map +1 -0
- package/dist/src/i18n/EA.d.ts +3 -0
- package/dist/src/i18n/EA.d.ts.map +1 -0
- package/dist/src/i18n/EA.js +16 -0
- package/dist/src/i18n/EA.js.map +1 -0
- package/dist/src/i18n/FA.d.ts +3 -0
- package/dist/src/i18n/FA.d.ts.map +1 -0
- package/dist/src/i18n/FA.js +17 -0
- package/dist/src/i18n/FA.js.map +1 -0
- package/dist/src/i18n/GC.d.ts +3 -0
- package/dist/src/i18n/GC.d.ts.map +1 -0
- package/dist/src/i18n/GC.js +16 -0
- package/dist/src/i18n/GC.js.map +1 -0
- package/dist/src/i18n/I.d.ts +3 -0
- package/dist/src/i18n/I.d.ts.map +1 -0
- package/dist/src/i18n/I.js +21 -0
- package/dist/src/i18n/I.js.map +1 -0
- package/dist/src/i18n/M.d.ts +3 -0
- package/dist/src/i18n/M.d.ts.map +1 -0
- package/dist/src/i18n/M.js +4 -0
- package/dist/src/i18n/M.js.map +1 -0
- package/dist/src/i18n/O_E.d.ts +3 -0
- package/dist/src/i18n/O_E.d.ts.map +1 -0
- package/dist/src/i18n/O_E.js +7 -0
- package/dist/src/i18n/O_E.js.map +1 -0
- package/dist/src/i18n/PA.d.ts +3 -0
- package/dist/src/i18n/PA.d.ts.map +1 -0
- package/dist/src/i18n/PA.js +16 -0
- package/dist/src/i18n/PA.js.map +1 -0
- package/dist/src/i18n/SA.d.ts +3 -0
- package/dist/src/i18n/SA.d.ts.map +1 -0
- package/dist/src/i18n/SA.js +16 -0
- package/dist/src/i18n/SA.js.map +1 -0
- package/dist/src/i18n/TC.d.ts +3 -0
- package/dist/src/i18n/TC.d.ts.map +1 -0
- package/dist/src/i18n/TC.js +16 -0
- package/dist/src/i18n/TC.js.map +1 -0
- package/dist/src/i18n/VA.d.ts +3 -0
- package/dist/src/i18n/VA.d.ts.map +1 -0
- package/dist/src/i18n/VA.js +16 -0
- package/dist/src/i18n/VA.js.map +1 -0
- package/dist/src/i18n/Z.d.ts +3 -0
- package/dist/src/i18n/Z.d.ts.map +1 -0
- package/dist/src/i18n/Z.js +22 -0
- package/dist/src/i18n/Z.js.map +1 -0
- package/dist/src/i18n/fi-FI.d.ts +192 -0
- package/dist/src/i18n/fi-FI.d.ts.map +1 -0
- package/dist/src/i18n/fi-FI.js +182 -0
- package/dist/src/i18n/fi-FI.js.map +1 -0
- package/dist/src/i18n/index.d.ts +20 -0
- package/dist/src/i18n/index.d.ts.map +1 -0
- package/dist/src/i18n/index.js +128 -0
- package/dist/src/i18n/index.js.map +1 -0
- package/dist/src/i18n/sv-FI.d.ts +3 -0
- package/dist/src/i18n/sv-FI.d.ts.map +1 -0
- package/dist/src/i18n/sv-FI.js +181 -0
- package/dist/src/i18n/sv-FI.js.map +1 -0
- package/dist/src/ids.d.ts +14 -0
- package/dist/src/ids.d.ts.map +1 -0
- package/dist/src/ids.js +28 -0
- package/dist/src/ids.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +12 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/parser/parseExam.d.ts +2 -0
- package/dist/src/parser/parseExam.d.ts.map +1 -0
- package/dist/src/parser/parseExam.js +54 -0
- package/dist/src/parser/parseExam.js.map +1 -0
- package/dist/src/parser/parseExamStructure.d.ts +58 -0
- package/dist/src/parser/parseExamStructure.d.ts.map +1 -0
- package/dist/src/parser/parseExamStructure.js +40 -0
- package/dist/src/parser/parseExamStructure.js.map +1 -0
- package/dist/src/renderAnnotations.d.ts +7 -0
- package/dist/src/renderAnnotations.d.ts.map +1 -0
- package/dist/src/renderAnnotations.js +193 -0
- package/dist/src/renderAnnotations.js.map +1 -0
- package/dist/src/scrollToHash.d.ts +2 -0
- package/dist/src/scrollToHash.d.ts.map +1 -0
- package/dist/src/scrollToHash.js +24 -0
- package/dist/src/scrollToHash.js.map +1 -0
- package/dist/src/shortDisplayNumber.d.ts +2 -0
- package/dist/src/shortDisplayNumber.d.ts.map +1 -0
- package/dist/src/shortDisplayNumber.js +5 -0
- package/dist/src/shortDisplayNumber.js.map +1 -0
- package/dist/src/store/answers/actions.d.ts +33 -0
- package/dist/src/store/answers/actions.d.ts.map +1 -0
- package/dist/src/store/answers/actions.js +9 -0
- package/dist/src/store/answers/actions.js.map +1 -0
- package/dist/src/store/answers/reducer.d.ts +39 -0
- package/dist/src/store/answers/reducer.d.ts.map +1 -0
- package/dist/src/store/answers/reducer.js +55 -0
- package/dist/src/store/answers/reducer.js.map +1 -0
- package/dist/src/store/answers/sagas.d.ts +8 -0
- package/dist/src/store/answers/sagas.d.ts.map +1 -0
- package/dist/src/store/answers/sagas.js +60 -0
- package/dist/src/store/answers/sagas.js.map +1 -0
- package/dist/src/store/audio/actions.d.ts +29 -0
- package/dist/src/store/audio/actions.d.ts.map +1 -0
- package/dist/src/store/audio/actions.js +9 -0
- package/dist/src/store/audio/actions.js.map +1 -0
- package/dist/src/store/audio/reducer.d.ts +27 -0
- package/dist/src/store/audio/reducer.d.ts.map +1 -0
- package/dist/src/store/audio/reducer.js +55 -0
- package/dist/src/store/audio/reducer.js.map +1 -0
- package/dist/src/store/audio/sagas.d.ts +3 -0
- package/dist/src/store/audio/sagas.d.ts.map +1 -0
- package/dist/src/store/audio/sagas.js +68 -0
- package/dist/src/store/audio/sagas.js.map +1 -0
- package/dist/src/store/cas/actions.d.ts +19 -0
- package/dist/src/store/cas/actions.d.ts.map +1 -0
- package/dist/src/store/cas/actions.js +9 -0
- package/dist/src/store/cas/actions.js.map +1 -0
- package/dist/src/store/cas/reducer.d.ts +14 -0
- package/dist/src/store/cas/reducer.d.ts.map +1 -0
- package/dist/src/store/cas/reducer.js +24 -0
- package/dist/src/store/cas/reducer.js.map +1 -0
- package/dist/src/store/cas/sagas.d.ts +18 -0
- package/dist/src/store/cas/sagas.d.ts.map +1 -0
- package/dist/src/store/cas/sagas.js +36 -0
- package/dist/src/store/cas/sagas.js.map +1 -0
- package/dist/src/store/countdown.d.ts +4 -0
- package/dist/src/store/countdown.d.ts.map +1 -0
- package/dist/src/store/countdown.js +33 -0
- package/dist/src/store/countdown.js.map +1 -0
- package/dist/src/store/index.d.ts +78 -0
- package/dist/src/store/index.d.ts.map +1 -0
- package/dist/src/store/index.js +53 -0
- package/dist/src/store/index.js.map +1 -0
- package/dist/src/store/selectors.d.ts +9 -0
- package/dist/src/store/selectors.d.ts.map +1 -0
- package/dist/src/store/selectors.js +35 -0
- package/dist/src/store/selectors.js.map +1 -0
- package/dist/src/types/ExamAnswer.d.ts +22 -0
- package/dist/src/types/ExamAnswer.d.ts.map +1 -0
- package/dist/src/types/ExamAnswer.js +2 -0
- package/dist/src/types/ExamAnswer.js.map +1 -0
- package/dist/src/types/ExamServerAPI.d.ts +78 -0
- package/dist/src/types/ExamServerAPI.d.ts.map +1 -0
- package/dist/src/types/ExamServerAPI.js +2 -0
- package/dist/src/types/ExamServerAPI.js.map +1 -0
- package/dist/src/types/GradingStructure.d.ts +40 -0
- package/dist/src/types/GradingStructure.d.ts.map +1 -0
- package/dist/src/types/GradingStructure.js +2 -0
- package/dist/src/types/GradingStructure.js.map +1 -0
- package/dist/src/types/Score.d.ts +92 -0
- package/dist/src/types/Score.d.ts.map +1 -0
- package/dist/src/types/Score.js +2 -0
- package/dist/src/types/Score.js.map +1 -0
- package/dist/src/url.d.ts +7 -0
- package/dist/src/url.d.ts.map +1 -0
- package/dist/src/url.js +12 -0
- package/dist/src/url.js.map +1 -0
- package/dist/src/useCached.d.ts +3 -0
- package/dist/src/useCached.d.ts.map +1 -0
- package/dist/src/useCached.js +6 -0
- package/dist/src/useCached.js.map +1 -0
- package/dist/src/utils.d.ts +15 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/utils.js +35 -0
- package/dist/src/utils.js.map +1 -0
- package/dist/src/validateAnswers.d.ts +16 -0
- package/dist/src/validateAnswers.d.ts.map +1 -0
- package/dist/src/validateAnswers.js +89 -0
- package/dist/src/validateAnswers.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +3 -3
@@ -0,0 +1,12 @@
|
|
1
|
+
import '../src/css/main.less';
|
2
|
+
import Attachments from './components/attachments/Attachments';
|
3
|
+
import Exam from './components/exam/Exam';
|
4
|
+
import GradingInstructions from './components/grading-instructions/GradingInstructions';
|
5
|
+
import Results from './components/results/Results';
|
6
|
+
import parseExam from './parser/parseExam';
|
7
|
+
export { Attachments, Exam, GradingInstructions, Results, parseExam };
|
8
|
+
export * from './types/ExamAnswer';
|
9
|
+
export * from './types/ExamServerAPI';
|
10
|
+
export * from './types/GradingStructure';
|
11
|
+
export * from './types/Score';
|
12
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAA;AAC7B,OAAO,WAAW,MAAM,sCAAsC,CAAA;AAC9D,OAAO,IAAI,MAAM,wBAAwB,CAAA;AACzC,OAAO,mBAAmB,MAAM,uDAAuD,CAAA;AACvF,OAAO,OAAO,MAAM,8BAA8B,CAAA;AAClD,OAAO,SAAS,MAAM,oBAAoB,CAAA;AAE1C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,SAAS,EAAE,CAAA;AAErE,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,eAAe,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseExam.d.ts","sourceRoot":"","sources":["../../../src/parser/parseExam.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,sBAAsB,UAAQ,GAAG,WAAW,CAkB9F"}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import * as _ from 'lodash-es';
|
2
|
+
import { findChildElement, getAttribute, queryAll } from '../dom-utils';
|
3
|
+
export default function parseExam(examXml, deterministicRendering = false) {
|
4
|
+
const doc = new DOMParser().parseFromString(examXml, 'application/xml');
|
5
|
+
if (!deterministicRendering) {
|
6
|
+
queryAll(doc.documentElement, ['choice-answer', 'dropdown-answer'])
|
7
|
+
.filter(e => getAttribute(e, 'ordering') !== 'fixed')
|
8
|
+
.forEach(randomizeOptions);
|
9
|
+
}
|
10
|
+
// The reference parts (e.g. author, title and so on) are displayed as inline
|
11
|
+
// elements. We also want to add separators between them. To avoid
|
12
|
+
// whitespace between an reference part and the separator, (e.g. `<span> foo
|
13
|
+
// </span>separator<span> bar </span>` is rendered as `foo separator bar` on
|
14
|
+
// the screen) trim the excess whitespace from the reference parts here.
|
15
|
+
queryAll(doc.documentElement, 'reference').forEach(reference => {
|
16
|
+
queryAll(reference, () => true, false).forEach(trimWhitespace);
|
17
|
+
});
|
18
|
+
return doc;
|
19
|
+
}
|
20
|
+
function randomizeOptions(elem) {
|
21
|
+
for (let i = elem.children.length; i > 0; i--) {
|
22
|
+
const j = Math.floor(Math.random() * i);
|
23
|
+
elem.appendChild(elem.children[j]);
|
24
|
+
}
|
25
|
+
// A no-answer option should always be the last
|
26
|
+
const noAnswerOption = findChildElement(elem, option => getAttribute(option, 'type') === 'no-answer');
|
27
|
+
if (noAnswerOption)
|
28
|
+
elem.appendChild(noAnswerOption);
|
29
|
+
}
|
30
|
+
function trimWhitespace(element) {
|
31
|
+
const nonWhitespaceNode = (node) => /\S/.test(node.textContent);
|
32
|
+
const getTextNodes = () => {
|
33
|
+
const result = [];
|
34
|
+
const treeWalker = document.createTreeWalker(element, NodeFilter.SHOW_TEXT);
|
35
|
+
while (treeWalker.nextNode()) {
|
36
|
+
result.push(treeWalker.currentNode);
|
37
|
+
}
|
38
|
+
return result;
|
39
|
+
};
|
40
|
+
const textNodes = getTextNodes();
|
41
|
+
const firstNonWhitespaceTextNode = _.findIndex(textNodes, nonWhitespaceNode);
|
42
|
+
const lastNonWhitespaceTextNode = _.findLastIndex(textNodes, nonWhitespaceNode);
|
43
|
+
// Remove leading whitespace from the start
|
44
|
+
if (firstNonWhitespaceTextNode !== -1) {
|
45
|
+
textNodes.slice(0, firstNonWhitespaceTextNode).forEach(node => node.remove());
|
46
|
+
textNodes[firstNonWhitespaceTextNode].textContent = _.trimStart(textNodes[firstNonWhitespaceTextNode].textContent);
|
47
|
+
}
|
48
|
+
// ...and trailing whitespace from the end.
|
49
|
+
if (lastNonWhitespaceTextNode !== -1) {
|
50
|
+
textNodes.slice(lastNonWhitespaceTextNode + 1).forEach(node => node.remove());
|
51
|
+
textNodes[lastNonWhitespaceTextNode].textContent = _.trimEnd(textNodes[lastNonWhitespaceTextNode].textContent);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
//# sourceMappingURL=parseExam.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseExam.js","sourceRoot":"","sources":["../../../src/parser/parseExam.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAEvE,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,OAAe,EAAE,sBAAsB,GAAG,KAAK;IAC/E,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAA;IACvE,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC5B,QAAQ,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,eAAe,EAAE,iBAAiB,CAAC,CAAC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ement {
|
2
|
+
name: string;
|
3
|
+
childNodes: ExamElement[];
|
4
|
+
}
|
5
|
+
export interface RootElement extends BaseElement {
|
6
|
+
name: 'exam';
|
7
|
+
attributes: {
|
8
|
+
maxAnswers?: number;
|
9
|
+
};
|
10
|
+
}
|
11
|
+
export interface SectionElement extends BaseElement {
|
12
|
+
name: 'section';
|
13
|
+
attributes: {
|
14
|
+
displayNumber: string;
|
15
|
+
maxAnswers?: number;
|
16
|
+
minAnswers?: number;
|
17
|
+
};
|
18
|
+
}
|
19
|
+
export interface QuestionElement extends BaseElement {
|
20
|
+
name: 'question';
|
21
|
+
attributes: {
|
22
|
+
displayNumber: string;
|
23
|
+
maxAnswers?: number;
|
24
|
+
};
|
25
|
+
}
|
26
|
+
export interface TextAnswerElement extends BaseElement {
|
27
|
+
name: 'text-answer';
|
28
|
+
attributes: {
|
29
|
+
displayNumber: string;
|
30
|
+
questionId: number;
|
31
|
+
maxLength?: number;
|
32
|
+
};
|
33
|
+
}
|
34
|
+
export interface ScoredTextAnswerElement extends BaseElement {
|
35
|
+
name: 'scored-text-answer';
|
36
|
+
attributes: {
|
37
|
+
displayNumber: string;
|
38
|
+
questionId: number;
|
39
|
+
};
|
40
|
+
}
|
41
|
+
export interface ChoiceAnswerElement extends BaseElement {
|
42
|
+
name: 'choice-answer';
|
43
|
+
attributes: {
|
44
|
+
displayNumber: string;
|
45
|
+
questionId: number;
|
46
|
+
};
|
47
|
+
}
|
48
|
+
export interface DropdownAnswerElement extends BaseElement {
|
49
|
+
name: 'dropdown-answer';
|
50
|
+
attributes: {
|
51
|
+
displayNumber: string;
|
52
|
+
questionId: number;
|
53
|
+
};
|
54
|
+
}
|
55
|
+
export type ExamElement = RootElement | SectionElement | QuestionElement | AnswerElement;
|
56
|
+
export type AnswerElement = TextAnswerElement | ScoredTextAnswerElement | ChoiceAnswerElement | DropdownAnswerElement;
|
57
|
+
export declare function parseExamStructure(doc: XMLDocument): RootElement;
|
58
|
+
//# sourceMappingURL=parseExamStructure.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseExamStructure.d.ts","sourceRoot":"","sources":["../../../src/parser/parseExamStructure.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,WAAW,EAAE,CAAA;CAC1B;AAED,MAAM,WAAW,WAAY,SAAQ,WAAW;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE;QACV,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,IAAI,EAAE,SAAS,CAAA;IACf,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;QACnB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,eAAgB,SAAQ,WAAW;IAClD,IAAI,EAAE,UAAU,CAAA;IAChB,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,CAAA;CACF;AAED,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,IAAI,EAAE,aAAa,CAAA;IACnB,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,IAAI,EAAE,oBAAoB,CAAA;IAC1B,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,IAAI,EAAE,eAAe,CAAA;IACrB,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,IAAI,EAAE,iBAAiB,CAAA;IACvB,UAAU,EAAE;QACV,aAAa,EAAE,MAAM,CAAA;QACrB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAA;AAExF,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,uBAAuB,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAErH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW,CAIhE"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { getAttribute, getNumericAttribute, queryAll } from '../dom-utils';
|
2
|
+
export function parseExamStructure(doc) {
|
3
|
+
const root = doc.documentElement;
|
4
|
+
const sections = queryAll(root, 'section', false).map(parseSection);
|
5
|
+
return parseElement(root, sections, { maxAnswers: getNumericAttribute(root, 'max-answers') });
|
6
|
+
}
|
7
|
+
function parseSection(section) {
|
8
|
+
const questions = queryAll(section, 'question', false).map(parseQuestion);
|
9
|
+
return parseElement(section, questions, {
|
10
|
+
displayNumber: getAttribute(section, 'display-number'),
|
11
|
+
minAnswers: getNumericAttribute(section, 'min-answers'),
|
12
|
+
maxAnswers: getNumericAttribute(section, 'max-answers')
|
13
|
+
});
|
14
|
+
}
|
15
|
+
function parseQuestion(question) {
|
16
|
+
const childQuestions = queryAll(question, 'question', false);
|
17
|
+
const childElements = childQuestions.length
|
18
|
+
? childQuestions.map(parseQuestion)
|
19
|
+
: queryAll(question, ['text-answer', 'scored-text-answer', 'choice-answer', 'dropdown-answer'], false).map(parseAnswer);
|
20
|
+
return parseElement(question, childElements, {
|
21
|
+
displayNumber: getAttribute(question, 'display-number'),
|
22
|
+
maxAnswers: getNumericAttribute(question, 'max-answers')
|
23
|
+
});
|
24
|
+
}
|
25
|
+
function parseAnswer(answer) {
|
26
|
+
const attributes = {
|
27
|
+
displayNumber: getAttribute(answer, 'display-number'),
|
28
|
+
questionId: getNumericAttribute(answer, 'question-id'),
|
29
|
+
maxLength: getNumericAttribute(answer, 'max-length')
|
30
|
+
};
|
31
|
+
return parseElement(answer, [], attributes);
|
32
|
+
}
|
33
|
+
function parseElement(element, childNodes, attributes) {
|
34
|
+
return {
|
35
|
+
name: element.localName,
|
36
|
+
attributes,
|
37
|
+
childNodes
|
38
|
+
};
|
39
|
+
}
|
40
|
+
//# sourceMappingURL=parseExamStructure.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"parseExamStructure.js","sourceRoot":"","sources":["../../../src/parser/parseExamStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAoE1E,MAAM,UAAU,kBAAkB,CAAC,GAAgB;IACjD,MAAM,IAAI,GAAG,GAAG,CAAC,eAAe,CAAA;IAChC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,CAAA;IACnE,OAAO,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,UAAU,EAAE,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,EAAE,CAAC,CAAA;AAC/F,CAAC;AAED,SAAS,YAAY,CAAC,OAAgB;IACpC,MAAM,SAAS,GAAG,QAAQ,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACzE,OAAO,YAAY,CAAiB,OAAO,EAAE,SAAS,EAAE;QACtD,aAAa,EAAE,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAE;QACvD,UAAU,EAAE,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC;QACvD,UAAU,EAAE,mBAAmB,CAAC,OAAO,EAAE,aAAa,CAAC;KACxD,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,QAAiB;IACtC,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,CAAA;IAC5D,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM;QACzC,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC;QACnC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE,oBAAoB,EAAE,eAAe,EAAE,iBAAiB,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CACtG,WAAW,CACZ,CAAA;IACL,OAAO,YAAY,CAAkB,QAAQ,EAAE,aAAa,EAAE;QAC5D,aAAa,EAAE,YAAY,CAAC,QAAQ,EAAE,gBAAgB,CAAE;QACxD,UAAU,EAAE,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC;KACzD,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,MAAe;IAClC,MAAM,UAAU,GAAG;QACjB,aAAa,EAAE,YAAY,CAAC,MAAM,EAAE,gBAAgB,CAAE;QACtD,UAAU,EAAE,mBAAmB,CAAC,MAAM,EAAE,aAAa,CAAE;QACvD,SAAS,EAAE,mBAAmB,CAAC,MAAM,EAAE,YAAY,CAAC;KACrD,CAAA;IACD,OAAO,YAAY,CAAC,MAAM,EAAE,EAAE,EAAE,UAAU,CAAC,CAAA;AAC7C,CAAC;AAED,SAAS,YAAY,CACnB,OAAgB,EAChB,UAAyB,EACzB,UAA2B;IAE3B,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,SAAS;QACvB,UAAU;QACV,UAAU;KACN,CAAA;AACR,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Annotation, ImageAnnotation, LineAnnotation, RectAnnotation } from './types/Score';
|
2
|
+
export declare function renderAnnotations(element: HTMLElement, pregradingAnnotations: Annotation[], censoringAnnotations: Annotation[], showTitle?: boolean): void;
|
3
|
+
export declare function updateImageAnnotationMarkSize(mark: HTMLElement, annotation: LineAnnotation | RectAnnotation): void;
|
4
|
+
export declare function wrapAllImages(answerElement: HTMLElement): void;
|
5
|
+
export declare function renderImageAnnotation(answerElement: HTMLElement, annotation: ImageAnnotation, type: 'pregrading' | 'censoring', listIndex: number, index: number | undefined, showTitle: boolean): HTMLElement;
|
6
|
+
export declare function renderImageAnnotationByImage(image: HTMLImageElement, title: string, annotation: ImageAnnotation, type: 'pregrading' | 'censoring', listIndex: number, index?: number): HTMLElement;
|
7
|
+
//# sourceMappingURL=renderAnnotations.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderAnnotations.d.ts","sourceRoot":"","sources":["../../src/renderAnnotations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAkB,MAAM,eAAe,CAAA;AAM3G,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,WAAW,EACpB,qBAAqB,EAAE,UAAU,EAAE,EACnC,oBAAoB,EAAE,UAAU,EAAE,EAClC,SAAS,UAAO,GACf,IAAI,CAiBN;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,GAAG,cAAc,GAAG,IAAI,CAclH;AAgBD,wBAAgB,aAAa,CAAC,aAAa,EAAE,WAAW,QAEvD;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,WAAW,EAC1B,UAAU,EAAE,eAAe,EAC3B,IAAI,EAAE,YAAY,GAAG,WAAW,EAChC,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,SAAS,EAAE,OAAO,GACjB,WAAW,CAKb;AACD,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,eAAe,EAC3B,IAAI,EAAE,YAAY,GAAG,WAAW,EAChC,SAAS,EAAE,MAAM,EACjB,KAAK,CAAC,EAAE,MAAM,GACb,WAAW,CA6Bb"}
|
@@ -0,0 +1,193 @@
|
|
1
|
+
import { createElement } from './dom-utils';
|
2
|
+
import classNames from 'classnames';
|
3
|
+
const messageLengthThreshold = 5;
|
4
|
+
export function renderAnnotations(element, pregradingAnnotations, censoringAnnotations, showTitle = true) {
|
5
|
+
const annotations = [...pregradingAnnotations, ...censoringAnnotations];
|
6
|
+
const annotationsWithMessages = annotations.filter(a => a.message);
|
7
|
+
for (const [i, annotation] of annotations.entries()) {
|
8
|
+
const type = pregradingAnnotations.includes(annotation) ? 'pregrading' : 'censoring';
|
9
|
+
const index = annotationsWithMessages.indexOf(annotation) + 1 || undefined;
|
10
|
+
const listIndex = type === 'pregrading' ? i : i - pregradingAnnotations.length;
|
11
|
+
switch (annotation.type) {
|
12
|
+
case 'line':
|
13
|
+
case 'rect':
|
14
|
+
renderImageAnnotation(element, annotation, type, listIndex, index, showTitle);
|
15
|
+
break;
|
16
|
+
default:
|
17
|
+
renderTextAnnotation(element, annotation, type, listIndex, index, showTitle);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
export function updateImageAnnotationMarkSize(mark, annotation) {
|
22
|
+
const style = mark.style;
|
23
|
+
const pct = (n) => `${n * 100}%`;
|
24
|
+
if (annotation.type === 'rect') {
|
25
|
+
style.left = pct(annotation.x);
|
26
|
+
style.top = pct(annotation.y);
|
27
|
+
style.right = pct(1 - (annotation.x + annotation.width));
|
28
|
+
style.bottom = pct(1 - (annotation.y + annotation.height));
|
29
|
+
}
|
30
|
+
else {
|
31
|
+
style.left = pct(annotation.x1);
|
32
|
+
style.top = pct(annotation.y1);
|
33
|
+
style.right = pct(1 - annotation.x2);
|
34
|
+
style.bottom = pct(1 - annotation.y2);
|
35
|
+
}
|
36
|
+
}
|
37
|
+
function getWrapper(image) {
|
38
|
+
const parent = image.parentElement;
|
39
|
+
if (parent instanceof HTMLSpanElement) {
|
40
|
+
return parent;
|
41
|
+
}
|
42
|
+
const wrapper = createElement('span', { className: 'e-annotation-wrapper' });
|
43
|
+
parent.insertBefore(wrapper, image);
|
44
|
+
wrapper.appendChild(image);
|
45
|
+
return wrapper;
|
46
|
+
}
|
47
|
+
export function wrapAllImages(answerElement) {
|
48
|
+
answerElement.querySelectorAll('img').forEach(getWrapper);
|
49
|
+
}
|
50
|
+
export function renderImageAnnotation(answerElement, annotation, type, listIndex, index, showTitle) {
|
51
|
+
const { attachmentIndex } = annotation;
|
52
|
+
const image = answerElement.querySelectorAll('img')[attachmentIndex];
|
53
|
+
const title = showTitle ? annotation.message : '';
|
54
|
+
return renderImageAnnotationByImage(image, title, annotation, type, listIndex, index);
|
55
|
+
}
|
56
|
+
export function renderImageAnnotationByImage(image, title, annotation, type, listIndex, index) {
|
57
|
+
const wrapper = getWrapper(image);
|
58
|
+
const shape = mkShape();
|
59
|
+
wrapper.appendChild(shape);
|
60
|
+
function mkShape() {
|
61
|
+
const mark = createElement('mark', {
|
62
|
+
...{
|
63
|
+
className: classNames('e-annotation e-annotation--shape', {
|
64
|
+
'e-annotation--pregrading': type === 'pregrading',
|
65
|
+
'e-annotation--censoring': type === 'censoring'
|
66
|
+
}),
|
67
|
+
title,
|
68
|
+
'data-list-index': String(listIndex),
|
69
|
+
'data-type': type
|
70
|
+
},
|
71
|
+
...(index && { 'data-index': String(index) }),
|
72
|
+
...(annotation.message && { 'data-message': annotation.message })
|
73
|
+
});
|
74
|
+
updateImageAnnotationMarkSize(mark, annotation);
|
75
|
+
if (index) {
|
76
|
+
mark.appendChild(createSup(index, 'shape', annotation.message));
|
77
|
+
}
|
78
|
+
return mark;
|
79
|
+
}
|
80
|
+
return shape;
|
81
|
+
}
|
82
|
+
function renderTextAnnotation(rootElement, annotation, type, listIndex, index, showTitle) {
|
83
|
+
const { startIndex, length: annotationLength } = annotation;
|
84
|
+
return go(rootElement.childNodes[0], 0, annotationLength);
|
85
|
+
function go(
|
86
|
+
/* The current node in the answer HTML. */
|
87
|
+
node,
|
88
|
+
/** The current index corresponding to the node. */
|
89
|
+
currentIndex,
|
90
|
+
/* The remaining number of characters from the annotation to render. */
|
91
|
+
remaining) {
|
92
|
+
var _a;
|
93
|
+
if (!isMark(node) && !isSup(node) && !isBr(node) && currentIndex >= startIndex) {
|
94
|
+
// We found the correct spot to start an annotation. So let's create a mark element.
|
95
|
+
const mark = mkMark();
|
96
|
+
// Insert it before the node.
|
97
|
+
(_a = node.parentElement) === null || _a === void 0 ? void 0 : _a.insertBefore(mark, node);
|
98
|
+
// Move the node and its next siblings inside the mark until the mark
|
99
|
+
// contains the required amount of content or we run out of sibling nodes.
|
100
|
+
// If the node is a Text node and it is too long for the annotation, we
|
101
|
+
// split it in two and move the first part inside the mark, leaving the
|
102
|
+
// rest in place.
|
103
|
+
const stillRemaining = move(mark, node, remaining);
|
104
|
+
// If we have run out of sibling nodes but still have characters to mark,
|
105
|
+
// create another mark at the next text node. This means that marks have
|
106
|
+
// been nested.
|
107
|
+
if (stillRemaining > 0) {
|
108
|
+
go(nextSibling(mark), currentIndex + annotationLength - stillRemaining, stillRemaining);
|
109
|
+
}
|
110
|
+
// We know that we're at the last mark of this annotation.
|
111
|
+
// Render the superscript index after it, if necessary.
|
112
|
+
else if (index) {
|
113
|
+
mark.appendChild(createSup(index, 'text', annotation.message));
|
114
|
+
}
|
115
|
+
}
|
116
|
+
else {
|
117
|
+
if (node instanceof Text && currentIndex + length(node) > startIndex) {
|
118
|
+
// The annotation should start in the middle of this text node. We need to split it in two.
|
119
|
+
node.splitText(startIndex - currentIndex);
|
120
|
+
}
|
121
|
+
go(next(node), currentIndex + length(node), remaining);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
function isBr(node) {
|
125
|
+
return node.nodeName === 'BR';
|
126
|
+
}
|
127
|
+
function isMark(node) {
|
128
|
+
return node.nodeName === 'MARK';
|
129
|
+
}
|
130
|
+
function isSup(node) {
|
131
|
+
return node.nodeName === 'SUP';
|
132
|
+
}
|
133
|
+
function isImage(node) {
|
134
|
+
// If we've already added an image annotation to the image, it will be wrapped
|
135
|
+
// in a <span> element.
|
136
|
+
return node.nodeName === 'IMG' || node.nodeName === 'SPAN';
|
137
|
+
}
|
138
|
+
function next(node) {
|
139
|
+
return isMark(node) ? node.childNodes[0] : nextSibling(node);
|
140
|
+
}
|
141
|
+
function nextSibling(node) {
|
142
|
+
const sibling = node.nextSibling;
|
143
|
+
if (sibling) {
|
144
|
+
return sibling;
|
145
|
+
}
|
146
|
+
const parent = node.parentElement;
|
147
|
+
// If we encounter the root element, we've run out of text to annotate. This
|
148
|
+
// could be a bug in the annotation code or perhaps the annotations are invalid.
|
149
|
+
// To err on the side of caution, throw an exception in this case.
|
150
|
+
if (parent === null || parent === rootElement) {
|
151
|
+
throw new Error('Bug: the answer seems to be too short for the current set of annotations.');
|
152
|
+
}
|
153
|
+
return nextSibling(parent);
|
154
|
+
}
|
155
|
+
function length(node) {
|
156
|
+
return node instanceof Text ? node.length : isImage(node) ? 1 : 0;
|
157
|
+
}
|
158
|
+
function mkMark() {
|
159
|
+
return createElement('mark', {
|
160
|
+
...{
|
161
|
+
className: classNames('e-annotation', {
|
162
|
+
'e-annotation--pregrading': type === 'pregrading',
|
163
|
+
'e-annotation--censoring': type === 'censoring'
|
164
|
+
}),
|
165
|
+
title: showTitle ? annotation.message : '',
|
166
|
+
'data-list-index': String(listIndex),
|
167
|
+
'data-type': type
|
168
|
+
},
|
169
|
+
...(index && { 'data-index': String(index) }),
|
170
|
+
...(annotation.message && { 'data-message': annotation.message })
|
171
|
+
});
|
172
|
+
}
|
173
|
+
function move(mark, node, remaining) {
|
174
|
+
if (!node || isMark(node) || remaining === 0) {
|
175
|
+
return remaining;
|
176
|
+
}
|
177
|
+
// Split text nodes if they are too long.
|
178
|
+
if (node instanceof Text && length(node) > 0 && length(node) > remaining) {
|
179
|
+
node.splitText(remaining);
|
180
|
+
}
|
181
|
+
const nextSibling = node.nextSibling;
|
182
|
+
mark.appendChild(node);
|
183
|
+
return move(mark, nextSibling, remaining - length(node));
|
184
|
+
}
|
185
|
+
}
|
186
|
+
function createSup(index, type, message) {
|
187
|
+
return createElement('sup', {
|
188
|
+
className: `e-annotation__index e-annotation__index--${type}`,
|
189
|
+
'data-content': message.length > messageLengthThreshold ? `${index})` : message,
|
190
|
+
'data-message': message
|
191
|
+
});
|
192
|
+
}
|
193
|
+
//# sourceMappingURL=renderAnnotations.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"renderAnnotations.js","sourceRoot":"","sources":["../../src/renderAnnotations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEhC,MAAM,UAAU,iBAAiB,CAC/B,OAAoB,EACpB,qBAAmC,EACnC,oBAAkC,EAClC,SAAS,GAAG,IAAI;IAEhB,MAAM,WAAW,GAAG,CAAC,GAAG,qBAAqB,EAAE,GAAG,oBAAoB,CAAC,CAAA;IACvE,MAAM,uBAAuB,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAElE,KAAK,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC;QACpD,MAAM,IAAI,GAAG,qBAAqB,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAA;QACpF,MAAM,KAAK,GAAG,uBAAuB,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,SAAS,CAAA;QAC1E,MAAM,SAAS,GAAG,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,qBAAqB,CAAC,MAAM,CAAA;QAC9E,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;YACxB,KAAK,MAAM,CA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,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO;QAC/E,cAAc,EAAE,OAAO;KACxB,CAAC,CAAA;AACJ,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scrollToHash.d.ts","sourceRoot":"","sources":["../../src/scrollToHash.ts"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,IAAI,MAAM,IAAI,CAYzC"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
export function scrollToHash() {
|
2
|
+
const maybeId = decodeURIComponent(window.location.hash).slice(1);
|
3
|
+
if (maybeId) {
|
4
|
+
const maybeElement = document.getElementById(maybeId);
|
5
|
+
if (maybeElement) {
|
6
|
+
focusElement(maybeElement);
|
7
|
+
}
|
8
|
+
}
|
9
|
+
window.addEventListener('hashchange', scrollToHash);
|
10
|
+
return () => window.removeEventListener('hashchange', scrollToHash);
|
11
|
+
}
|
12
|
+
function focusElement(element) {
|
13
|
+
// Make the element temporarily focusable for screen readers.
|
14
|
+
element.setAttribute('tabindex', '-1');
|
15
|
+
// We don't want to show an outline for our sighted users.
|
16
|
+
element.style.outline = 'none';
|
17
|
+
element.addEventListener('blur', () => {
|
18
|
+
element.removeAttribute('tabindex');
|
19
|
+
element.style.outline = '';
|
20
|
+
}, { once: true });
|
21
|
+
element.focus();
|
22
|
+
element.scrollIntoView();
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=scrollToHash.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scrollToHash.js","sourceRoot":"","sources":["../../src/scrollToHash.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,YAAY;IAC1B,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAEjE,IAAI,OAAO,EAAE,CAAC;QACZ,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAA;QACrD,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,CAAC,YAAY,CAAC,CAAA;QAC5B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;IACnD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,YAAY,CAAC,OAAoB;IACxC,6DAA6D;IAC7D,OAAO,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;IACtC,0DAA0D;IAC1D,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,MAAM,CAAA;IAE9B,OAAO,CAAC,gBAAgB,CACtB,MAAM,EACN,GAAG,EAAE;QACH,OAAO,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;QACnC,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAA;IAC5B,CAAC,EACD,EAAE,IAAI,EAAE,IAAI,EAAE,CACf,CAAA;IAED,OAAO,CAAC,KAAK,EAAE,CAAA;IACf,OAAO,CAAC,cAAc,EAAE,CAAA;AAC1B,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shortDisplayNumber.d.ts","sourceRoot":"","sources":["../../src/shortDisplayNumber.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE9D"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shortDisplayNumber.js","sourceRoot":"","sources":["../../src/shortDisplayNumber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAE9B,MAAM,UAAU,kBAAkB,CAAC,WAAmB;IACpD,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAE,GAAG,CAAA;AAC9C,CAAC"}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { ExamAnswer, QuestionId } from '../..';
|
2
|
+
export declare const saveAnswer: (answer: ExamAnswer) => {
|
3
|
+
type: "SAVE_ANSWER";
|
4
|
+
payload: ExamAnswer;
|
5
|
+
};
|
6
|
+
export declare const saveAnswerSucceeded: (answer: ExamAnswer) => {
|
7
|
+
type: "SAVE_ANSWER_SUCCEEDED";
|
8
|
+
payload: ExamAnswer;
|
9
|
+
};
|
10
|
+
export declare const saveAnswerFailed: (answer: ExamAnswer, error: unknown) => {
|
11
|
+
type: "SAVE_ANSWER_FAILED";
|
12
|
+
payload: {
|
13
|
+
answer: ExamAnswer;
|
14
|
+
error: unknown;
|
15
|
+
};
|
16
|
+
error: boolean;
|
17
|
+
};
|
18
|
+
export declare const selectAnswerVersion: (questionId: QuestionId, questionText: string) => {
|
19
|
+
type: "SELECT_ANSWER_VERSION";
|
20
|
+
payload: {
|
21
|
+
questionId: number;
|
22
|
+
questionText: string;
|
23
|
+
};
|
24
|
+
};
|
25
|
+
export declare const answerFocused: (questionId: QuestionId) => {
|
26
|
+
type: "ANSWER_FOCUSED";
|
27
|
+
payload: number;
|
28
|
+
};
|
29
|
+
export declare const answerBlurred: (questionId: QuestionId) => {
|
30
|
+
type: "ANSWER_BLURRED";
|
31
|
+
payload: number;
|
32
|
+
};
|
33
|
+
//# sourceMappingURL=actions.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/store/answers/actions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAE9C,eAAO,MAAM,UAAU,WAAY,UAAU;;;CAAkC,CAAA;AAE/E,eAAO,MAAM,mBAAmB,WAAY,UAAU;;;CAA4C,CAAA;AAElG,eAAO,MAAM,gBAAgB,WAAY,UAAU,SAAS,OAAO;;;;;;;CACD,CAAA;AAElE,eAAO,MAAM,mBAAmB,eAAgB,UAAU,gBAAgB,MAAM;;;;;;CACjB,CAAA;AAE/D,eAAO,MAAM,aAAa,eAAgB,UAAU;;;CAAyC,CAAA;AAE7F,eAAO,MAAM,aAAa,eAAgB,UAAU;;;CAAyC,CAAA"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
2
|
+
import { action } from 'typesafe-actions';
|
3
|
+
export const saveAnswer = (answer) => action('SAVE_ANSWER', answer);
|
4
|
+
export const saveAnswerSucceeded = (answer) => action('SAVE_ANSWER_SUCCEEDED', answer);
|
5
|
+
export const saveAnswerFailed = (answer, error) => action('SAVE_ANSWER_FAILED', { answer, error }, undefined, true);
|
6
|
+
export const selectAnswerVersion = (questionId, questionText) => action('SELECT_ANSWER_VERSION', { questionId, questionText });
|
7
|
+
export const answerFocused = (questionId) => action('ANSWER_FOCUSED', questionId);
|
8
|
+
export const answerBlurred = (questionId) => action('ANSWER_BLURRED', questionId);
|
9
|
+
//# sourceMappingURL=actions.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../../../../src/store/answers/actions.ts"],"names":[],"mappings":"AAAA,sEAAsE;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAGzC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;AAE/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAA;AAElG,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAkB,EAAE,KAAc,EAAE,EAAE,CACrE,MAAM,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;AAElE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,UAAsB,EAAE,YAAoB,EAAE,EAAE,CAClF,MAAM,CAAC,uBAAuB,EAAE,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,CAAA;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAsB,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;AAE7F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAsB,EAAE,EAAE,CAAC,MAAM,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA"}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { ActionType } from 'typesafe-actions';
|
2
|
+
import * as actions from './actions';
|
3
|
+
import { ExamAnswer, QuestionId } from '../..';
|
4
|
+
import { ValidationError } from '../../validateAnswers';
|
5
|
+
import { RootElement } from '../../parser/parseExamStructure';
|
6
|
+
type AnswersAction = ActionType<typeof actions>;
|
7
|
+
export interface AnswersState {
|
8
|
+
answersById: Record<QuestionId, ExamAnswer>;
|
9
|
+
/** The (text) answer that is focused right now. Used for e.g. highlighting the correct hint in scored text answers. */
|
10
|
+
focusedQuestionId: QuestionId | null;
|
11
|
+
/**
|
12
|
+
* The set of answers that (to the best of our knowledge) have been
|
13
|
+
* successfully saved to the server. That is, the questions that we
|
14
|
+
* show the "Tallennettu" indicator for.
|
15
|
+
*/
|
16
|
+
savedQuestionIds: Set<QuestionId>;
|
17
|
+
/**
|
18
|
+
* The set of questions that have been saved to the server at some point. Or
|
19
|
+
* in short, the set of questions that we show the answer history link for.
|
20
|
+
*/
|
21
|
+
serverQuestionIds: Set<QuestionId>;
|
22
|
+
/**
|
23
|
+
* Whether or not the Exam API has implemented the optional answer history
|
24
|
+
* feature. For now, only the real ktp has implemented it. it.
|
25
|
+
*/
|
26
|
+
supportsAnswerHistory: boolean;
|
27
|
+
/**
|
28
|
+
* The simplified structure of the exam (only sections, questions and answers)
|
29
|
+
* that we use for validation purposes.
|
30
|
+
*/
|
31
|
+
examStructure: RootElement;
|
32
|
+
/**
|
33
|
+
* An array of warning messages about answers that the user has input.
|
34
|
+
*/
|
35
|
+
validationErrors: ValidationError[];
|
36
|
+
}
|
37
|
+
export default function answersReducer(state: AnswersState | undefined, action: AnswersAction): AnswersState;
|
38
|
+
export {};
|
39
|
+
//# sourceMappingURL=reducer.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/store/answers/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,KAAK,OAAO,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAmB,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAA;AAE7D,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAA;AAE/C,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAC3C,uHAAuH;IACvH,iBAAiB,EAAE,UAAU,GAAG,IAAI,CAAA;IACpC;;;;OAIG;IACH,gBAAgB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAA;IACjC;;;OAGG;IACH,iBAAiB,EAAE,GAAG,CAAC,UAAU,CAAC,CAAA;IAClC;;;OAGG;IACH,qBAAqB,EAAE,OAAO,CAAA;IAC9B;;;OAGG;IACH,aAAa,EAAE,WAAW,CAAA;IAC1B;;OAEG;IACH,gBAAgB,EAAE,eAAe,EAAE,CAAA;CACpC;AAgBD,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,YAAY,YAAe,EAAE,MAAM,EAAE,aAAa,GAAG,YAAY,CA6B9G"}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import { validateAnswers } from '../../validateAnswers';
|
2
|
+
const initialState = {
|
3
|
+
answersById: {},
|
4
|
+
examStructure: {
|
5
|
+
name: 'exam',
|
6
|
+
attributes: {},
|
7
|
+
childNodes: []
|
8
|
+
},
|
9
|
+
focusedQuestionId: null,
|
10
|
+
supportsAnswerHistory: false,
|
11
|
+
serverQuestionIds: new Set(),
|
12
|
+
savedQuestionIds: new Set(),
|
13
|
+
validationErrors: []
|
14
|
+
};
|
15
|
+
export default function answersReducer(state = initialState, action) {
|
16
|
+
switch (action.type) {
|
17
|
+
case 'SAVE_ANSWER': {
|
18
|
+
const { questionId } = action.payload;
|
19
|
+
const synchronizedQuestionIds = setDelete(state.savedQuestionIds, questionId);
|
20
|
+
const answersById = { ...state.answersById, [questionId]: action.payload };
|
21
|
+
return { ...state, savedQuestionIds: synchronizedQuestionIds, answersById };
|
22
|
+
}
|
23
|
+
case 'SAVE_ANSWER_FAILED': {
|
24
|
+
return state;
|
25
|
+
}
|
26
|
+
case 'SAVE_ANSWER_SUCCEEDED': {
|
27
|
+
const { questionId } = action.payload;
|
28
|
+
const savedQuestionIds = setAdd(state.savedQuestionIds, questionId);
|
29
|
+
const serverQuestionIds = setAdd(state.serverQuestionIds, questionId);
|
30
|
+
const validationErrors = validateAnswers(state.examStructure, state.answersById);
|
31
|
+
return { ...state, serverQuestionIds, savedQuestionIds, validationErrors };
|
32
|
+
}
|
33
|
+
case 'ANSWER_FOCUSED': {
|
34
|
+
const questionId = action.payload;
|
35
|
+
return { ...state, focusedQuestionId: questionId };
|
36
|
+
}
|
37
|
+
case 'ANSWER_BLURRED': {
|
38
|
+
const questionId = action.payload;
|
39
|
+
return { ...state, focusedQuestionId: state.focusedQuestionId === questionId ? null : state.focusedQuestionId };
|
40
|
+
}
|
41
|
+
default:
|
42
|
+
return state;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
function setAdd(set, value) {
|
46
|
+
const copy = new Set(set);
|
47
|
+
copy.add(value);
|
48
|
+
return copy;
|
49
|
+
}
|
50
|
+
function setDelete(set, value) {
|
51
|
+
const copy = new Set(set);
|
52
|
+
copy.delete(value);
|
53
|
+
return copy;
|
54
|
+
}
|
55
|
+
//# sourceMappingURL=reducer.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"reducer.js","sourceRoot":"","sources":["../../../../src/store/answers/reducer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAmB,MAAM,uBAAuB,CAAA;AAoCxE,MAAM,YAAY,GAAiB;IACjC,WAAW,EAAE,EAAE;IACf,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,EAAE;QACd,UAAU,EAAE,EAAE;KACf;IACD,iBAAiB,EAAE,IAAI;IACvB,qBAAqB,EAAE,KAAK;IAC5B,iBAAiB,EAAE,IAAI,GAAG,EAAE;IAC5B,gBAAgB,EAAE,IAAI,GAAG,EAAE;IAC3B,gBAAgB,EAAE,EAAE;CACrB,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAsB,YAAY,EAAE,MAAqB;IAC9F,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,aAAa,CAAC,CAAC,CAAC;YACnB,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,OAAO,CAAA;YACrC,MAAM,uBAAuB,GAAG,SAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,UAAU,CAAC,CAAA;YAC7E,MAAM,WAAW,GAAG,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAA;YAC1E,OAAO,EAAE,GAAG,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,WAAW,EAAE,CAAA;QAC7E,CAAC;QACD,KAAK,oBAAoB,CAAC,CAAC,CAAC;YAC1B,OAAO,KAAK,CAAA;QACd,CAAC;QACD,KAAK,uBAAuB,CAAC,CAAC,CAAC;YAC7B,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,OAAO,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