@digabi/exam-engine-core 22.3.1-alpha.2 → 23.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (660) hide show
  1. package/dist/__tests__/playwright/SectionElement.test.d.ts +2 -0
  2. package/dist/__tests__/playwright/SectionElement.test.d.ts.map +1 -0
  3. package/dist/__tests__/playwright/SectionElement.test.js +20 -0
  4. package/dist/__tests__/playwright/SectionElement.test.js.map +1 -0
  5. package/dist/__tests__/playwright/template/index.d.ts +2 -0
  6. package/dist/__tests__/playwright/template/index.d.ts.map +1 -0
  7. package/dist/__tests__/playwright/template/index.js +4 -0
  8. package/dist/__tests__/playwright/template/index.js.map +1 -0
  9. package/dist/__tests__/tsconfig.tsbuildinfo +1 -1
  10. package/dist/components/exam/ExamineExam.d.ts +5 -0
  11. package/dist/components/exam/ExamineExam.d.ts.map +1 -0
  12. package/dist/components/exam/ExamineExam.js +20 -0
  13. package/dist/components/exam/ExamineExam.js.map +1 -0
  14. package/dist/main-bundle.js +2 -4
  15. package/dist/src/components/AnswerToolbar.d.ts +18 -0
  16. package/dist/src/components/AnswerToolbar.d.ts.map +1 -0
  17. package/dist/src/components/AnswerToolbar.js +36 -0
  18. package/dist/src/components/AnswerToolbar.js.map +1 -0
  19. package/dist/src/components/AnsweringInstructions.d.ts +12 -0
  20. package/dist/src/components/AnsweringInstructions.d.ts.map +1 -0
  21. package/dist/src/components/AnsweringInstructions.js +24 -0
  22. package/dist/src/components/AnsweringInstructions.js.map +1 -0
  23. package/dist/src/components/DocumentTitle.d.ts +5 -0
  24. package/dist/src/components/DocumentTitle.d.ts.map +1 -0
  25. package/dist/src/components/DocumentTitle.js +13 -0
  26. package/dist/src/components/DocumentTitle.js.map +1 -0
  27. package/dist/src/components/NotificationIcon.d.ts +4 -0
  28. package/dist/src/components/NotificationIcon.d.ts.map +1 -0
  29. package/dist/src/components/NotificationIcon.js +6 -0
  30. package/dist/src/components/NotificationIcon.js.map +1 -0
  31. package/dist/src/components/RenderChildNodes.d.ts +5 -0
  32. package/dist/src/components/RenderChildNodes.d.ts.map +1 -0
  33. package/dist/src/components/RenderChildNodes.js +7 -0
  34. package/dist/src/components/RenderChildNodes.js.map +1 -0
  35. package/dist/src/components/RenderExamElements.d.ts +6 -0
  36. package/dist/src/components/RenderExamElements.d.ts.map +1 -0
  37. package/dist/src/components/RenderExamElements.js +6 -0
  38. package/dist/src/components/RenderExamElements.js.map +1 -0
  39. package/dist/src/components/RenderIf.d.ts +4 -0
  40. package/dist/src/components/RenderIf.d.ts.map +1 -0
  41. package/dist/src/components/RenderIf.js +8 -0
  42. package/dist/src/components/RenderIf.js.map +1 -0
  43. package/dist/src/components/ScreenReaderOnly.d.ts +5 -0
  44. package/dist/src/components/ScreenReaderOnly.d.ts.map +1 -0
  45. package/dist/src/components/ScreenReaderOnly.js +3 -0
  46. package/dist/src/components/ScreenReaderOnly.js.map +1 -0
  47. package/dist/src/components/SectionElement.d.ts +4 -0
  48. package/dist/src/components/SectionElement.d.ts.map +1 -0
  49. package/dist/src/components/SectionElement.js +8 -0
  50. package/dist/src/components/SectionElement.js.map +1 -0
  51. package/dist/src/components/attachments/Attachment.d.ts +4 -0
  52. package/dist/src/components/attachments/Attachment.d.ts.map +1 -0
  53. package/dist/src/components/attachments/Attachment.js +8 -0
  54. package/dist/src/components/attachments/Attachment.js.map +1 -0
  55. package/dist/src/components/attachments/AttachmentTitle.d.ts +6 -0
  56. package/dist/src/components/attachments/AttachmentTitle.d.ts.map +1 -0
  57. package/dist/src/components/attachments/AttachmentTitle.js +12 -0
  58. package/dist/src/components/attachments/AttachmentTitle.js.map +1 -0
  59. package/dist/src/components/attachments/Attachments.d.ts +5 -0
  60. package/dist/src/components/attachments/Attachments.d.ts.map +1 -0
  61. package/dist/src/components/attachments/Attachments.js +55 -0
  62. package/dist/src/components/attachments/Attachments.js.map +1 -0
  63. package/dist/src/components/attachments/ExternalMaterial.d.ts +9 -0
  64. package/dist/src/components/attachments/ExternalMaterial.d.ts.map +1 -0
  65. package/dist/src/components/attachments/ExternalMaterial.js +46 -0
  66. package/dist/src/components/attachments/ExternalMaterial.js.map +1 -0
  67. package/dist/src/components/attachments/Question.d.ts +4 -0
  68. package/dist/src/components/attachments/Question.d.ts.map +1 -0
  69. package/dist/src/components/attachments/Question.js +16 -0
  70. package/dist/src/components/attachments/Question.js.map +1 -0
  71. package/dist/src/components/attachments/QuestionTitle.d.ts +6 -0
  72. package/dist/src/components/attachments/QuestionTitle.d.ts.map +1 -0
  73. package/dist/src/components/attachments/QuestionTitle.js +15 -0
  74. package/dist/src/components/attachments/QuestionTitle.js.map +1 -0
  75. package/dist/src/components/context/AnnotationProvider.d.ts +16 -0
  76. package/dist/src/components/context/AnnotationProvider.d.ts.map +1 -0
  77. package/dist/src/components/context/AnnotationProvider.js +35 -0
  78. package/dist/src/components/context/AnnotationProvider.js.map +1 -0
  79. package/dist/src/components/context/AttachmentContext.d.ts +13 -0
  80. package/dist/src/components/context/AttachmentContext.d.ts.map +1 -0
  81. package/dist/src/components/context/AttachmentContext.js +12 -0
  82. package/dist/src/components/context/AttachmentContext.js.map +1 -0
  83. package/dist/src/components/context/CommonExamContext.d.ts +22 -0
  84. package/dist/src/components/context/CommonExamContext.d.ts.map +1 -0
  85. package/dist/src/components/context/CommonExamContext.js +28 -0
  86. package/dist/src/components/context/CommonExamContext.js.map +1 -0
  87. package/dist/src/components/context/ExamContext.d.ts +9 -0
  88. package/dist/src/components/context/ExamContext.d.ts.map +1 -0
  89. package/dist/src/components/context/ExamContext.js +11 -0
  90. package/dist/src/components/context/ExamContext.js.map +1 -0
  91. package/dist/src/components/context/IsInSidebarContext.d.ts +6 -0
  92. package/dist/src/components/context/IsInSidebarContext.d.ts.map +1 -0
  93. package/dist/src/components/context/IsInSidebarContext.js +3 -0
  94. package/dist/src/components/context/IsInSidebarContext.js.map +1 -0
  95. package/dist/src/components/context/QuestionContext.d.ts +14 -0
  96. package/dist/src/components/context/QuestionContext.d.ts.map +1 -0
  97. package/dist/src/components/context/QuestionContext.js +27 -0
  98. package/dist/src/components/context/QuestionContext.js.map +1 -0
  99. package/dist/src/components/context/ResultsContext.d.ts +17 -0
  100. package/dist/src/components/context/ResultsContext.d.ts.map +1 -0
  101. package/dist/src/components/context/ResultsContext.js +69 -0
  102. package/dist/src/components/context/ResultsContext.js.map +1 -0
  103. package/dist/src/components/context/SectionContext.d.ts +12 -0
  104. package/dist/src/components/context/SectionContext.d.ts.map +1 -0
  105. package/dist/src/components/context/SectionContext.js +21 -0
  106. package/dist/src/components/context/SectionContext.js.map +1 -0
  107. package/dist/src/components/context/TOCContext.d.ts +7 -0
  108. package/dist/src/components/context/TOCContext.d.ts.map +1 -0
  109. package/dist/src/components/context/TOCContext.js +3 -0
  110. package/dist/src/components/context/TOCContext.js.map +1 -0
  111. package/dist/src/components/context/withContext.d.ts +3 -0
  112. package/dist/src/components/context/withContext.d.ts.map +1 -0
  113. package/dist/src/components/context/withContext.js +12 -0
  114. package/dist/src/components/context/withContext.js.map +1 -0
  115. package/dist/src/components/exam/Attachment.d.ts +4 -0
  116. package/dist/src/components/exam/Attachment.d.ts.map +1 -0
  117. package/dist/src/components/exam/Attachment.js +8 -0
  118. package/dist/src/components/exam/Attachment.js.map +1 -0
  119. package/dist/src/components/exam/ChoiceAnswer.d.ts +5 -0
  120. package/dist/src/components/exam/ChoiceAnswer.d.ts.map +1 -0
  121. package/dist/src/components/exam/ChoiceAnswer.js +53 -0
  122. package/dist/src/components/exam/ChoiceAnswer.js.map +1 -0
  123. package/dist/src/components/exam/DropdownAnswer.d.ts +5 -0
  124. package/dist/src/components/exam/DropdownAnswer.d.ts.map +1 -0
  125. package/dist/src/components/exam/DropdownAnswer.js +101 -0
  126. package/dist/src/components/exam/DropdownAnswer.js.map +1 -0
  127. package/dist/src/components/exam/Exam.d.ts +48 -0
  128. package/dist/src/components/exam/Exam.d.ts.map +1 -0
  129. package/dist/src/components/exam/Exam.js +195 -0
  130. package/dist/src/components/exam/Exam.js.map +1 -0
  131. package/dist/src/components/exam/ExamFooter.d.ts +6 -0
  132. package/dist/src/components/exam/ExamFooter.d.ts.map +1 -0
  133. package/dist/src/components/exam/ExamFooter.js +6 -0
  134. package/dist/src/components/exam/ExamFooter.js.map +1 -0
  135. package/dist/src/components/exam/ExamInstruction.d.ts +6 -0
  136. package/dist/src/components/exam/ExamInstruction.d.ts.map +1 -0
  137. package/dist/src/components/exam/ExamInstruction.js +6 -0
  138. package/dist/src/components/exam/ExamInstruction.js.map +1 -0
  139. package/dist/src/components/exam/ExternalMaterial.d.ts +10 -0
  140. package/dist/src/components/exam/ExternalMaterial.d.ts.map +1 -0
  141. package/dist/src/components/exam/ExternalMaterial.js +33 -0
  142. package/dist/src/components/exam/ExternalMaterial.js.map +1 -0
  143. package/dist/src/components/exam/GoToExamineAnswersButton.d.ts +5 -0
  144. package/dist/src/components/exam/GoToExamineAnswersButton.d.ts.map +1 -0
  145. package/dist/src/components/exam/GoToExamineAnswersButton.js +18 -0
  146. package/dist/src/components/exam/GoToExamineAnswersButton.js.map +1 -0
  147. package/dist/src/components/exam/Hints.d.ts +5 -0
  148. package/dist/src/components/exam/Hints.d.ts.map +1 -0
  149. package/dist/src/components/exam/Hints.js +31 -0
  150. package/dist/src/components/exam/Hints.js.map +1 -0
  151. package/dist/src/components/exam/Question.d.ts +8 -0
  152. package/dist/src/components/exam/Question.d.ts.map +1 -0
  153. package/dist/src/components/exam/Question.js +75 -0
  154. package/dist/src/components/exam/Question.js.map +1 -0
  155. package/dist/src/components/exam/QuestionInstruction.d.ts +6 -0
  156. package/dist/src/components/exam/QuestionInstruction.d.ts.map +1 -0
  157. package/dist/src/components/exam/QuestionInstruction.js +8 -0
  158. package/dist/src/components/exam/QuestionInstruction.js.map +1 -0
  159. package/dist/src/components/exam/QuestionTitle.d.ts +5 -0
  160. package/dist/src/components/exam/QuestionTitle.d.ts.map +1 -0
  161. package/dist/src/components/exam/QuestionTitle.js +26 -0
  162. package/dist/src/components/exam/QuestionTitle.js.map +1 -0
  163. package/dist/src/components/exam/RichTextAnswer.d.ts +41 -0
  164. package/dist/src/components/exam/RichTextAnswer.d.ts.map +1 -0
  165. package/dist/src/components/exam/RichTextAnswer.js +79 -0
  166. package/dist/src/components/exam/RichTextAnswer.js.map +1 -0
  167. package/dist/src/components/exam/Section.d.ts +4 -0
  168. package/dist/src/components/exam/Section.d.ts.map +1 -0
  169. package/dist/src/components/exam/Section.js +49 -0
  170. package/dist/src/components/exam/Section.js.map +1 -0
  171. package/dist/src/components/exam/SectionInstruction.d.ts +6 -0
  172. package/dist/src/components/exam/SectionInstruction.d.ts.map +1 -0
  173. package/dist/src/components/exam/SectionInstruction.js +6 -0
  174. package/dist/src/components/exam/SectionInstruction.js.map +1 -0
  175. package/dist/src/components/exam/SectionTitle.d.ts +6 -0
  176. package/dist/src/components/exam/SectionTitle.d.ts.map +1 -0
  177. package/dist/src/components/exam/SectionTitle.js +30 -0
  178. package/dist/src/components/exam/SectionTitle.js.map +1 -0
  179. package/dist/src/components/exam/StudentNameHeader.d.ts +8 -0
  180. package/dist/src/components/exam/StudentNameHeader.d.ts.map +1 -0
  181. package/dist/src/components/exam/StudentNameHeader.js +3 -0
  182. package/dist/src/components/exam/StudentNameHeader.js.map +1 -0
  183. package/dist/src/components/exam/TextAnswer.d.ts +6 -0
  184. package/dist/src/components/exam/TextAnswer.d.ts.map +1 -0
  185. package/dist/src/components/exam/TextAnswer.js +20 -0
  186. package/dist/src/components/exam/TextAnswer.js.map +1 -0
  187. package/dist/src/components/exam/UndoHistoryEntry.d.ts +19 -0
  188. package/dist/src/components/exam/UndoHistoryEntry.d.ts.map +1 -0
  189. package/dist/src/components/exam/UndoHistoryEntry.js +39 -0
  190. package/dist/src/components/exam/UndoHistoryEntry.js.map +1 -0
  191. package/dist/src/components/exam/UndoView.d.ts +35 -0
  192. package/dist/src/components/exam/UndoView.d.ts.map +1 -0
  193. package/dist/src/components/exam/UndoView.js +162 -0
  194. package/dist/src/components/exam/UndoView.js.map +1 -0
  195. package/dist/src/components/exam/internal/ErrorIndicator.d.ts +9 -0
  196. package/dist/src/components/exam/internal/ErrorIndicator.d.ts.map +1 -0
  197. package/dist/src/components/exam/internal/ErrorIndicator.js +63 -0
  198. package/dist/src/components/exam/internal/ErrorIndicator.js.map +1 -0
  199. package/dist/src/components/exam/internal/ProgressBar.d.ts +8 -0
  200. package/dist/src/components/exam/internal/ProgressBar.d.ts.map +1 -0
  201. package/dist/src/components/exam/internal/ProgressBar.js +19 -0
  202. package/dist/src/components/exam/internal/ProgressBar.js.map +1 -0
  203. package/dist/src/components/exam/internal/SaveIndicator.d.ts +5 -0
  204. package/dist/src/components/exam/internal/SaveIndicator.d.ts.map +1 -0
  205. package/dist/src/components/exam/internal/SaveIndicator.js +16 -0
  206. package/dist/src/components/exam/internal/SaveIndicator.js.map +1 -0
  207. package/dist/src/components/exam/internal/TextAnswerInput.d.ts +6 -0
  208. package/dist/src/components/exam/internal/TextAnswerInput.d.ts.map +1 -0
  209. package/dist/src/components/exam/internal/TextAnswerInput.js +128 -0
  210. package/dist/src/components/exam/internal/TextAnswerInput.js.map +1 -0
  211. package/dist/src/components/grading/AnswerCharacterCounter.d.ts +6 -0
  212. package/dist/src/components/grading/AnswerCharacterCounter.d.ts.map +1 -0
  213. package/dist/src/components/grading/AnswerCharacterCounter.js +21 -0
  214. package/dist/src/components/grading/AnswerCharacterCounter.js.map +1 -0
  215. package/dist/src/components/grading/GradingAnswer.d.ts +24 -0
  216. package/dist/src/components/grading/GradingAnswer.d.ts.map +1 -0
  217. package/dist/src/components/grading/GradingAnswer.js +306 -0
  218. package/dist/src/components/grading/GradingAnswer.js.map +1 -0
  219. package/dist/src/components/grading/GradingAnswerAnnotationList.d.ts +9 -0
  220. package/dist/src/components/grading/GradingAnswerAnnotationList.d.ts.map +1 -0
  221. package/dist/src/components/grading/GradingAnswerAnnotationList.js +19 -0
  222. package/dist/src/components/grading/GradingAnswerAnnotationList.js.map +1 -0
  223. package/dist/src/components/grading/editAnnotations.d.ts +29 -0
  224. package/dist/src/components/grading/editAnnotations.d.ts.map +1 -0
  225. package/dist/src/components/grading/editAnnotations.js +190 -0
  226. package/dist/src/components/grading/editAnnotations.js.map +1 -0
  227. package/dist/src/components/grading/examAnnotationUtils.d.ts +3 -0
  228. package/dist/src/components/grading/examAnnotationUtils.d.ts.map +1 -0
  229. package/dist/src/components/grading/examAnnotationUtils.js +44 -0
  230. package/dist/src/components/grading/examAnnotationUtils.js.map +1 -0
  231. package/dist/src/components/grading/largeImageDetector.d.ts +3 -0
  232. package/dist/src/components/grading/largeImageDetector.d.ts.map +1 -0
  233. package/dist/src/components/grading/largeImageDetector.js +45 -0
  234. package/dist/src/components/grading/largeImageDetector.js.map +1 -0
  235. package/dist/src/components/grading-instructions/AnswerGradingInstruction.d.ts +5 -0
  236. package/dist/src/components/grading-instructions/AnswerGradingInstruction.d.ts.map +1 -0
  237. package/dist/src/components/grading-instructions/AnswerGradingInstruction.js +4 -0
  238. package/dist/src/components/grading-instructions/AnswerGradingInstruction.js.map +1 -0
  239. package/dist/src/components/grading-instructions/AutogradedAnswer.d.ts +5 -0
  240. package/dist/src/components/grading-instructions/AutogradedAnswer.d.ts.map +1 -0
  241. package/dist/src/components/grading-instructions/AutogradedAnswer.js +34 -0
  242. package/dist/src/components/grading-instructions/AutogradedAnswer.js.map +1 -0
  243. package/dist/src/components/grading-instructions/AutogradedAnswerOption.d.ts +5 -0
  244. package/dist/src/components/grading-instructions/AutogradedAnswerOption.d.ts.map +1 -0
  245. package/dist/src/components/grading-instructions/AutogradedAnswerOption.js +17 -0
  246. package/dist/src/components/grading-instructions/AutogradedAnswerOption.js.map +1 -0
  247. package/dist/src/components/grading-instructions/ExamGradingInstruction.d.ts +5 -0
  248. package/dist/src/components/grading-instructions/ExamGradingInstruction.d.ts.map +1 -0
  249. package/dist/src/components/grading-instructions/ExamGradingInstruction.js +4 -0
  250. package/dist/src/components/grading-instructions/ExamGradingInstruction.js.map +1 -0
  251. package/dist/src/components/grading-instructions/GradingInstructions.d.ts +6 -0
  252. package/dist/src/components/grading-instructions/GradingInstructions.d.ts.map +1 -0
  253. package/dist/src/components/grading-instructions/GradingInstructions.js +109 -0
  254. package/dist/src/components/grading-instructions/GradingInstructions.js.map +1 -0
  255. package/dist/src/components/grading-instructions/Question.d.ts +4 -0
  256. package/dist/src/components/grading-instructions/Question.d.ts.map +1 -0
  257. package/dist/src/components/grading-instructions/Question.js +14 -0
  258. package/dist/src/components/grading-instructions/Question.js.map +1 -0
  259. package/dist/src/components/grading-instructions/QuestionTitle.d.ts +5 -0
  260. package/dist/src/components/grading-instructions/QuestionTitle.d.ts.map +1 -0
  261. package/dist/src/components/grading-instructions/QuestionTitle.js +19 -0
  262. package/dist/src/components/grading-instructions/QuestionTitle.js.map +1 -0
  263. package/dist/src/components/grading-instructions/Recording.d.ts +5 -0
  264. package/dist/src/components/grading-instructions/Recording.d.ts.map +1 -0
  265. package/dist/src/components/grading-instructions/Recording.js +19 -0
  266. package/dist/src/components/grading-instructions/Recording.js.map +1 -0
  267. package/dist/src/components/grading-instructions/Section.d.ts +4 -0
  268. package/dist/src/components/grading-instructions/Section.d.ts.map +1 -0
  269. package/dist/src/components/grading-instructions/Section.js +10 -0
  270. package/dist/src/components/grading-instructions/Section.js.map +1 -0
  271. package/dist/src/components/grading-instructions/SectionTitle.d.ts +5 -0
  272. package/dist/src/components/grading-instructions/SectionTitle.d.ts.map +1 -0
  273. package/dist/src/components/grading-instructions/SectionTitle.js +16 -0
  274. package/dist/src/components/grading-instructions/SectionTitle.js.map +1 -0
  275. package/dist/src/components/results/ChoiceAnswer.d.ts +6 -0
  276. package/dist/src/components/results/ChoiceAnswer.d.ts.map +1 -0
  277. package/dist/src/components/results/ChoiceAnswer.js +57 -0
  278. package/dist/src/components/results/ChoiceAnswer.js.map +1 -0
  279. package/dist/src/components/results/DropdownAnswer.d.ts +6 -0
  280. package/dist/src/components/results/DropdownAnswer.d.ts.map +1 -0
  281. package/dist/src/components/results/DropdownAnswer.js +43 -0
  282. package/dist/src/components/results/DropdownAnswer.js.map +1 -0
  283. package/dist/src/components/results/EndExamSession.d.ts +8 -0
  284. package/dist/src/components/results/EndExamSession.d.ts.map +1 -0
  285. package/dist/src/components/results/EndExamSession.js +20 -0
  286. package/dist/src/components/results/EndExamSession.js.map +1 -0
  287. package/dist/src/components/results/MultiLineAnswer.d.ts +8 -0
  288. package/dist/src/components/results/MultiLineAnswer.d.ts.map +1 -0
  289. package/dist/src/components/results/MultiLineAnswer.js +22 -0
  290. package/dist/src/components/results/MultiLineAnswer.js.map +1 -0
  291. package/dist/src/components/results/Question.d.ts +4 -0
  292. package/dist/src/components/results/Question.d.ts.map +1 -0
  293. package/dist/src/components/results/Question.js +31 -0
  294. package/dist/src/components/results/Question.js.map +1 -0
  295. package/dist/src/components/results/QuestionTitle.d.ts +6 -0
  296. package/dist/src/components/results/QuestionTitle.d.ts.map +1 -0
  297. package/dist/src/components/results/QuestionTitle.js +26 -0
  298. package/dist/src/components/results/QuestionTitle.js.map +1 -0
  299. package/dist/src/components/results/Results.d.ts +19 -0
  300. package/dist/src/components/results/Results.d.ts.map +1 -0
  301. package/dist/src/components/results/Results.js +136 -0
  302. package/dist/src/components/results/Results.js.map +1 -0
  303. package/dist/src/components/results/ScoredTextAnswer.d.ts +6 -0
  304. package/dist/src/components/results/ScoredTextAnswer.d.ts.map +1 -0
  305. package/dist/src/components/results/ScoredTextAnswer.js +22 -0
  306. package/dist/src/components/results/ScoredTextAnswer.js.map +1 -0
  307. package/dist/src/components/results/Section.d.ts +4 -0
  308. package/dist/src/components/results/Section.d.ts.map +1 -0
  309. package/dist/src/components/results/Section.js +11 -0
  310. package/dist/src/components/results/Section.js.map +1 -0
  311. package/dist/src/components/results/SingleLineAnswer.d.ts +12 -0
  312. package/dist/src/components/results/SingleLineAnswer.d.ts.map +1 -0
  313. package/dist/src/components/results/SingleLineAnswer.js +26 -0
  314. package/dist/src/components/results/SingleLineAnswer.js.map +1 -0
  315. package/dist/src/components/results/TextAnswer.d.ts +7 -0
  316. package/dist/src/components/results/TextAnswer.d.ts.map +1 -0
  317. package/dist/src/components/results/TextAnswer.js +48 -0
  318. package/dist/src/components/results/TextAnswer.js.map +1 -0
  319. package/dist/src/components/results/internal/AnnotationList.d.ts +5 -0
  320. package/dist/src/components/results/internal/AnnotationList.d.ts.map +1 -0
  321. package/dist/src/components/results/internal/AnnotationList.js +32 -0
  322. package/dist/src/components/results/internal/AnnotationList.js.map +1 -0
  323. package/dist/src/components/results/internal/QuestionAutoScore.d.ts +11 -0
  324. package/dist/src/components/results/internal/QuestionAutoScore.d.ts.map +1 -0
  325. package/dist/src/components/results/internal/QuestionAutoScore.js +17 -0
  326. package/dist/src/components/results/internal/QuestionAutoScore.js.map +1 -0
  327. package/dist/src/components/results/internal/QuestionManualScore.d.ts +13 -0
  328. package/dist/src/components/results/internal/QuestionManualScore.d.ts.map +1 -0
  329. package/dist/src/components/results/internal/QuestionManualScore.js +66 -0
  330. package/dist/src/components/results/internal/QuestionManualScore.js.map +1 -0
  331. package/dist/src/components/results/internal/QuestionScoresContainer.d.ts +11 -0
  332. package/dist/src/components/results/internal/QuestionScoresContainer.d.ts.map +1 -0
  333. package/dist/src/components/results/internal/QuestionScoresContainer.js +27 -0
  334. package/dist/src/components/results/internal/QuestionScoresContainer.js.map +1 -0
  335. package/dist/src/components/results/isExamineExamPageHook.d.ts +2 -0
  336. package/dist/src/components/results/isExamineExamPageHook.d.ts.map +1 -0
  337. package/dist/src/components/results/isExamineExamPageHook.js +7 -0
  338. package/dist/src/components/results/isExamineExamPageHook.js.map +1 -0
  339. package/dist/src/components/shared/AnnotatableText.d.ts +5 -0
  340. package/dist/src/components/shared/AnnotatableText.d.ts.map +1 -0
  341. package/dist/src/components/shared/AnnotatableText.js +73 -0
  342. package/dist/src/components/shared/AnnotatableText.js.map +1 -0
  343. package/dist/src/components/shared/AnnotationLists.d.ts +13 -0
  344. package/dist/src/components/shared/AnnotationLists.d.ts.map +1 -0
  345. package/dist/src/components/shared/AnnotationLists.js +17 -0
  346. package/dist/src/components/shared/AnnotationLists.js.map +1 -0
  347. package/dist/src/components/shared/AnnotationPopup.d.ts +3 -0
  348. package/dist/src/components/shared/AnnotationPopup.d.ts.map +1 -0
  349. package/dist/src/components/shared/AnnotationPopup.js +74 -0
  350. package/dist/src/components/shared/AnnotationPopup.js.map +1 -0
  351. package/dist/src/components/shared/AnswerIndicator.d.ts +12 -0
  352. package/dist/src/components/shared/AnswerIndicator.d.ts.map +1 -0
  353. package/dist/src/components/shared/AnswerIndicator.js +27 -0
  354. package/dist/src/components/shared/AnswerIndicator.js.map +1 -0
  355. package/dist/src/components/shared/AnswerLengthInfo.d.ts +7 -0
  356. package/dist/src/components/shared/AnswerLengthInfo.d.ts.map +1 -0
  357. package/dist/src/components/shared/AnswerLengthInfo.js +11 -0
  358. package/dist/src/components/shared/AnswerLengthInfo.js.map +1 -0
  359. package/dist/src/components/shared/AttachmentLink.d.ts +5 -0
  360. package/dist/src/components/shared/AttachmentLink.d.ts.map +1 -0
  361. package/dist/src/components/shared/AttachmentLink.js +28 -0
  362. package/dist/src/components/shared/AttachmentLink.js.map +1 -0
  363. package/dist/src/components/shared/AttachmentLinks.d.ts +5 -0
  364. package/dist/src/components/shared/AttachmentLinks.d.ts.map +1 -0
  365. package/dist/src/components/shared/AttachmentLinks.js +58 -0
  366. package/dist/src/components/shared/AttachmentLinks.js.map +1 -0
  367. package/dist/src/components/shared/Audio.d.ts +6 -0
  368. package/dist/src/components/shared/Audio.d.ts.map +1 -0
  369. package/dist/src/components/shared/Audio.js +31 -0
  370. package/dist/src/components/shared/Audio.js.map +1 -0
  371. package/dist/src/components/shared/AudioGroup.d.ts +6 -0
  372. package/dist/src/components/shared/AudioGroup.d.ts.map +1 -0
  373. package/dist/src/components/shared/AudioGroup.js +9 -0
  374. package/dist/src/components/shared/AudioGroup.js.map +1 -0
  375. package/dist/src/components/shared/AudioTest.d.ts +6 -0
  376. package/dist/src/components/shared/AudioTest.d.ts.map +1 -0
  377. package/dist/src/components/shared/AudioTest.js +34 -0
  378. package/dist/src/components/shared/AudioTest.js.map +1 -0
  379. package/dist/src/components/shared/ExamTranslation.d.ts +6 -0
  380. package/dist/src/components/shared/ExamTranslation.d.ts.map +1 -0
  381. package/dist/src/components/shared/ExamTranslation.js +9 -0
  382. package/dist/src/components/shared/ExamTranslation.js.map +1 -0
  383. package/dist/src/components/shared/File.d.ts +6 -0
  384. package/dist/src/components/shared/File.d.ts.map +1 -0
  385. package/dist/src/components/shared/File.js +15 -0
  386. package/dist/src/components/shared/File.js.map +1 -0
  387. package/dist/src/components/shared/Footer.d.ts +5 -0
  388. package/dist/src/components/shared/Footer.d.ts.map +1 -0
  389. package/dist/src/components/shared/Footer.js +3 -0
  390. package/dist/src/components/shared/Footer.js.map +1 -0
  391. package/dist/src/components/shared/Formula.d.ts +6 -0
  392. package/dist/src/components/shared/Formula.d.ts.map +1 -0
  393. package/dist/src/components/shared/Formula.js +13 -0
  394. package/dist/src/components/shared/Formula.js.map +1 -0
  395. package/dist/src/components/shared/Image.d.ts +6 -0
  396. package/dist/src/components/shared/Image.d.ts.map +1 -0
  397. package/dist/src/components/shared/Image.js +30 -0
  398. package/dist/src/components/shared/Image.js.map +1 -0
  399. package/dist/src/components/shared/ImageOverlay.d.ts +6 -0
  400. package/dist/src/components/shared/ImageOverlay.d.ts.map +1 -0
  401. package/dist/src/components/shared/ImageOverlay.js +43 -0
  402. package/dist/src/components/shared/ImageOverlay.js.map +1 -0
  403. package/dist/src/components/shared/QuestionNumber.d.ts +4 -0
  404. package/dist/src/components/shared/QuestionNumber.d.ts.map +1 -0
  405. package/dist/src/components/shared/QuestionNumber.js +12 -0
  406. package/dist/src/components/shared/QuestionNumber.js.map +1 -0
  407. package/dist/src/components/shared/Reference.d.ts +6 -0
  408. package/dist/src/components/shared/Reference.d.ts.map +1 -0
  409. package/dist/src/components/shared/Reference.js +72 -0
  410. package/dist/src/components/shared/Reference.js.map +1 -0
  411. package/dist/src/components/shared/References.d.ts +6 -0
  412. package/dist/src/components/shared/References.d.ts.map +1 -0
  413. package/dist/src/components/shared/References.js +26 -0
  414. package/dist/src/components/shared/References.js.map +1 -0
  415. package/dist/src/components/shared/Score.d.ts +8 -0
  416. package/dist/src/components/shared/Score.d.ts.map +1 -0
  417. package/dist/src/components/shared/Score.js +13 -0
  418. package/dist/src/components/shared/Score.js.map +1 -0
  419. package/dist/src/components/shared/TOCQuestion.d.ts +4 -0
  420. package/dist/src/components/shared/TOCQuestion.d.ts.map +1 -0
  421. package/dist/src/components/shared/TOCQuestion.js +77 -0
  422. package/dist/src/components/shared/TOCQuestion.js.map +1 -0
  423. package/dist/src/components/shared/TOCSection.d.ts +7 -0
  424. package/dist/src/components/shared/TOCSection.d.ts.map +1 -0
  425. package/dist/src/components/shared/TOCSection.js +15 -0
  426. package/dist/src/components/shared/TOCSection.js.map +1 -0
  427. package/dist/src/components/shared/TOCSectionTitle.d.ts +4 -0
  428. package/dist/src/components/shared/TOCSectionTitle.d.ts.map +1 -0
  429. package/dist/src/components/shared/TOCSectionTitle.js +34 -0
  430. package/dist/src/components/shared/TOCSectionTitle.js.map +1 -0
  431. package/dist/src/components/shared/TableOfContents.d.ts +8 -0
  432. package/dist/src/components/shared/TableOfContents.d.ts.map +1 -0
  433. package/dist/src/components/shared/TableOfContents.js +61 -0
  434. package/dist/src/components/shared/TableOfContents.js.map +1 -0
  435. package/dist/src/components/shared/VersionNumber.d.ts +3 -0
  436. package/dist/src/components/shared/VersionNumber.d.ts.map +1 -0
  437. package/dist/src/components/shared/VersionNumber.js +10 -0
  438. package/dist/src/components/shared/VersionNumber.js.map +1 -0
  439. package/dist/src/components/shared/Video.d.ts +6 -0
  440. package/dist/src/components/shared/Video.d.ts.map +1 -0
  441. package/dist/src/components/shared/Video.js +22 -0
  442. package/dist/src/components/shared/Video.js.map +1 -0
  443. package/dist/src/components/shared/internal/AttachmentLinkAnchor.d.ts +8 -0
  444. package/dist/src/components/shared/internal/AttachmentLinkAnchor.d.ts.map +1 -0
  445. package/dist/src/components/shared/internal/AttachmentLinkAnchor.js +4 -0
  446. package/dist/src/components/shared/internal/AttachmentLinkAnchor.js.map +1 -0
  447. package/dist/src/components/shared/internal/AudioPlaybackError.d.ts +8 -0
  448. package/dist/src/components/shared/internal/AudioPlaybackError.d.ts.map +1 -0
  449. package/dist/src/components/shared/internal/AudioPlaybackError.js +17 -0
  450. package/dist/src/components/shared/internal/AudioPlaybackError.js.map +1 -0
  451. package/dist/src/components/shared/internal/ResponsiveMediaContainer.d.ts +18 -0
  452. package/dist/src/components/shared/internal/ResponsiveMediaContainer.d.ts.map +1 -0
  453. package/dist/src/components/shared/internal/ResponsiveMediaContainer.js +21 -0
  454. package/dist/src/components/shared/internal/ResponsiveMediaContainer.js.map +1 -0
  455. package/dist/src/components/shared/internal/RestrictedAudioPlayer.d.ts +12 -0
  456. package/dist/src/components/shared/internal/RestrictedAudioPlayer.d.ts.map +1 -0
  457. package/dist/src/components/shared/internal/RestrictedAudioPlayer.js +46 -0
  458. package/dist/src/components/shared/internal/RestrictedAudioPlayer.js.map +1 -0
  459. package/dist/src/components/surround.d.ts +8 -0
  460. package/dist/src/components/surround.d.ts.map +1 -0
  461. package/dist/src/components/surround.js +19 -0
  462. package/dist/src/components/surround.js.map +1 -0
  463. package/dist/src/createRenderChildNodes.d.ts +17 -0
  464. package/dist/src/createRenderChildNodes.d.ts.map +1 -0
  465. package/dist/src/createRenderChildNodes.js +64 -0
  466. package/dist/src/createRenderChildNodes.js.map +1 -0
  467. package/dist/src/dom-utils.d.ts +20 -0
  468. package/dist/src/dom-utils.d.ts.map +1 -0
  469. package/dist/src/dom-utils.js +164 -0
  470. package/dist/src/dom-utils.js.map +1 -0
  471. package/dist/src/fonts.d.ts +5 -0
  472. package/dist/src/fonts.d.ts.map +1 -0
  473. package/dist/src/fonts.js +16 -0
  474. package/dist/src/fonts.js.map +1 -0
  475. package/dist/src/formatting.d.ts +2 -0
  476. package/dist/src/formatting.d.ts.map +1 -0
  477. package/dist/src/formatting.js +4 -0
  478. package/dist/src/formatting.js.map +1 -0
  479. package/dist/src/getDisplayName.d.ts +4 -0
  480. package/dist/src/getDisplayName.d.ts.map +1 -0
  481. package/dist/src/getDisplayName.js +5 -0
  482. package/dist/src/getDisplayName.js.map +1 -0
  483. package/dist/src/i18n/A_E.d.ts +3 -0
  484. package/dist/src/i18n/A_E.d.ts.map +1 -0
  485. package/dist/src/i18n/A_E.js +8 -0
  486. package/dist/src/i18n/A_E.js.map +1 -0
  487. package/dist/src/i18n/BA.d.ts +3 -0
  488. package/dist/src/i18n/BA.d.ts.map +1 -0
  489. package/dist/src/i18n/BA.js +11 -0
  490. package/dist/src/i18n/BA.js.map +1 -0
  491. package/dist/src/i18n/CA.d.ts +3 -0
  492. package/dist/src/i18n/CA.d.ts.map +1 -0
  493. package/dist/src/i18n/CA.js +11 -0
  494. package/dist/src/i18n/CA.js.map +1 -0
  495. package/dist/src/i18n/EA.d.ts +3 -0
  496. package/dist/src/i18n/EA.d.ts.map +1 -0
  497. package/dist/src/i18n/EA.js +16 -0
  498. package/dist/src/i18n/EA.js.map +1 -0
  499. package/dist/src/i18n/FA.d.ts +3 -0
  500. package/dist/src/i18n/FA.d.ts.map +1 -0
  501. package/dist/src/i18n/FA.js +17 -0
  502. package/dist/src/i18n/FA.js.map +1 -0
  503. package/dist/src/i18n/GC.d.ts +3 -0
  504. package/dist/src/i18n/GC.d.ts.map +1 -0
  505. package/dist/src/i18n/GC.js +16 -0
  506. package/dist/src/i18n/GC.js.map +1 -0
  507. package/dist/src/i18n/I.d.ts +3 -0
  508. package/dist/src/i18n/I.d.ts.map +1 -0
  509. package/dist/src/i18n/I.js +21 -0
  510. package/dist/src/i18n/I.js.map +1 -0
  511. package/dist/src/i18n/M.d.ts +3 -0
  512. package/dist/src/i18n/M.d.ts.map +1 -0
  513. package/dist/src/i18n/M.js +4 -0
  514. package/dist/src/i18n/M.js.map +1 -0
  515. package/dist/src/i18n/O_E.d.ts +3 -0
  516. package/dist/src/i18n/O_E.d.ts.map +1 -0
  517. package/dist/src/i18n/O_E.js +7 -0
  518. package/dist/src/i18n/O_E.js.map +1 -0
  519. package/dist/src/i18n/PA.d.ts +3 -0
  520. package/dist/src/i18n/PA.d.ts.map +1 -0
  521. package/dist/src/i18n/PA.js +16 -0
  522. package/dist/src/i18n/PA.js.map +1 -0
  523. package/dist/src/i18n/SA.d.ts +3 -0
  524. package/dist/src/i18n/SA.d.ts.map +1 -0
  525. package/dist/src/i18n/SA.js +16 -0
  526. package/dist/src/i18n/SA.js.map +1 -0
  527. package/dist/src/i18n/TC.d.ts +3 -0
  528. package/dist/src/i18n/TC.d.ts.map +1 -0
  529. package/dist/src/i18n/TC.js +16 -0
  530. package/dist/src/i18n/TC.js.map +1 -0
  531. package/dist/src/i18n/VA.d.ts +3 -0
  532. package/dist/src/i18n/VA.d.ts.map +1 -0
  533. package/dist/src/i18n/VA.js +16 -0
  534. package/dist/src/i18n/VA.js.map +1 -0
  535. package/dist/src/i18n/Z.d.ts +3 -0
  536. package/dist/src/i18n/Z.d.ts.map +1 -0
  537. package/dist/src/i18n/Z.js +22 -0
  538. package/dist/src/i18n/Z.js.map +1 -0
  539. package/dist/src/i18n/fi-FI.d.ts +192 -0
  540. package/dist/src/i18n/fi-FI.d.ts.map +1 -0
  541. package/dist/src/i18n/fi-FI.js +182 -0
  542. package/dist/src/i18n/fi-FI.js.map +1 -0
  543. package/dist/src/i18n/index.d.ts +20 -0
  544. package/dist/src/i18n/index.d.ts.map +1 -0
  545. package/dist/src/i18n/index.js +128 -0
  546. package/dist/src/i18n/index.js.map +1 -0
  547. package/dist/src/i18n/sv-FI.d.ts +3 -0
  548. package/dist/src/i18n/sv-FI.d.ts.map +1 -0
  549. package/dist/src/i18n/sv-FI.js +181 -0
  550. package/dist/src/i18n/sv-FI.js.map +1 -0
  551. package/dist/src/ids.d.ts +14 -0
  552. package/dist/src/ids.d.ts.map +1 -0
  553. package/dist/src/ids.js +28 -0
  554. package/dist/src/ids.js.map +1 -0
  555. package/dist/src/index.d.ts +19 -0
  556. package/dist/src/index.d.ts.map +1 -0
  557. package/dist/src/index.js +12 -0
  558. package/dist/src/index.js.map +1 -0
  559. package/dist/src/parser/parseExam.d.ts +2 -0
  560. package/dist/src/parser/parseExam.d.ts.map +1 -0
  561. package/dist/src/parser/parseExam.js +54 -0
  562. package/dist/src/parser/parseExam.js.map +1 -0
  563. package/dist/src/parser/parseExamStructure.d.ts +58 -0
  564. package/dist/src/parser/parseExamStructure.d.ts.map +1 -0
  565. package/dist/src/parser/parseExamStructure.js +40 -0
  566. package/dist/src/parser/parseExamStructure.js.map +1 -0
  567. package/dist/src/renderAnnotations.d.ts +7 -0
  568. package/dist/src/renderAnnotations.d.ts.map +1 -0
  569. package/dist/src/renderAnnotations.js +193 -0
  570. package/dist/src/renderAnnotations.js.map +1 -0
  571. package/dist/src/scrollToHash.d.ts +2 -0
  572. package/dist/src/scrollToHash.d.ts.map +1 -0
  573. package/dist/src/scrollToHash.js +24 -0
  574. package/dist/src/scrollToHash.js.map +1 -0
  575. package/dist/src/shortDisplayNumber.d.ts +2 -0
  576. package/dist/src/shortDisplayNumber.d.ts.map +1 -0
  577. package/dist/src/shortDisplayNumber.js +5 -0
  578. package/dist/src/shortDisplayNumber.js.map +1 -0
  579. package/dist/src/store/answers/actions.d.ts +33 -0
  580. package/dist/src/store/answers/actions.d.ts.map +1 -0
  581. package/dist/src/store/answers/actions.js +9 -0
  582. package/dist/src/store/answers/actions.js.map +1 -0
  583. package/dist/src/store/answers/reducer.d.ts +39 -0
  584. package/dist/src/store/answers/reducer.d.ts.map +1 -0
  585. package/dist/src/store/answers/reducer.js +55 -0
  586. package/dist/src/store/answers/reducer.js.map +1 -0
  587. package/dist/src/store/answers/sagas.d.ts +8 -0
  588. package/dist/src/store/answers/sagas.d.ts.map +1 -0
  589. package/dist/src/store/answers/sagas.js +60 -0
  590. package/dist/src/store/answers/sagas.js.map +1 -0
  591. package/dist/src/store/audio/actions.d.ts +29 -0
  592. package/dist/src/store/audio/actions.d.ts.map +1 -0
  593. package/dist/src/store/audio/actions.js +9 -0
  594. package/dist/src/store/audio/actions.js.map +1 -0
  595. package/dist/src/store/audio/reducer.d.ts +27 -0
  596. package/dist/src/store/audio/reducer.d.ts.map +1 -0
  597. package/dist/src/store/audio/reducer.js +55 -0
  598. package/dist/src/store/audio/reducer.js.map +1 -0
  599. package/dist/src/store/audio/sagas.d.ts +3 -0
  600. package/dist/src/store/audio/sagas.d.ts.map +1 -0
  601. package/dist/src/store/audio/sagas.js +68 -0
  602. package/dist/src/store/audio/sagas.js.map +1 -0
  603. package/dist/src/store/cas/actions.d.ts +19 -0
  604. package/dist/src/store/cas/actions.d.ts.map +1 -0
  605. package/dist/src/store/cas/actions.js +9 -0
  606. package/dist/src/store/cas/actions.js.map +1 -0
  607. package/dist/src/store/cas/reducer.d.ts +14 -0
  608. package/dist/src/store/cas/reducer.d.ts.map +1 -0
  609. package/dist/src/store/cas/reducer.js +24 -0
  610. package/dist/src/store/cas/reducer.js.map +1 -0
  611. package/dist/src/store/cas/sagas.d.ts +18 -0
  612. package/dist/src/store/cas/sagas.d.ts.map +1 -0
  613. package/dist/src/store/cas/sagas.js +36 -0
  614. package/dist/src/store/cas/sagas.js.map +1 -0
  615. package/dist/src/store/countdown.d.ts +4 -0
  616. package/dist/src/store/countdown.d.ts.map +1 -0
  617. package/dist/src/store/countdown.js +33 -0
  618. package/dist/src/store/countdown.js.map +1 -0
  619. package/dist/src/store/index.d.ts +78 -0
  620. package/dist/src/store/index.d.ts.map +1 -0
  621. package/dist/src/store/index.js +53 -0
  622. package/dist/src/store/index.js.map +1 -0
  623. package/dist/src/store/selectors.d.ts +9 -0
  624. package/dist/src/store/selectors.d.ts.map +1 -0
  625. package/dist/src/store/selectors.js +35 -0
  626. package/dist/src/store/selectors.js.map +1 -0
  627. package/dist/src/types/ExamAnswer.d.ts +22 -0
  628. package/dist/src/types/ExamAnswer.d.ts.map +1 -0
  629. package/dist/src/types/ExamAnswer.js +2 -0
  630. package/dist/src/types/ExamAnswer.js.map +1 -0
  631. package/dist/src/types/ExamServerAPI.d.ts +78 -0
  632. package/dist/src/types/ExamServerAPI.d.ts.map +1 -0
  633. package/dist/src/types/ExamServerAPI.js +2 -0
  634. package/dist/src/types/ExamServerAPI.js.map +1 -0
  635. package/dist/src/types/GradingStructure.d.ts +40 -0
  636. package/dist/src/types/GradingStructure.d.ts.map +1 -0
  637. package/dist/src/types/GradingStructure.js +2 -0
  638. package/dist/src/types/GradingStructure.js.map +1 -0
  639. package/dist/src/types/Score.d.ts +92 -0
  640. package/dist/src/types/Score.d.ts.map +1 -0
  641. package/dist/src/types/Score.js +2 -0
  642. package/dist/src/types/Score.js.map +1 -0
  643. package/dist/src/url.d.ts +7 -0
  644. package/dist/src/url.d.ts.map +1 -0
  645. package/dist/src/url.js +12 -0
  646. package/dist/src/url.js.map +1 -0
  647. package/dist/src/useCached.d.ts +3 -0
  648. package/dist/src/useCached.d.ts.map +1 -0
  649. package/dist/src/useCached.js +6 -0
  650. package/dist/src/useCached.js.map +1 -0
  651. package/dist/src/utils.d.ts +15 -0
  652. package/dist/src/utils.d.ts.map +1 -0
  653. package/dist/src/utils.js +35 -0
  654. package/dist/src/utils.js.map +1 -0
  655. package/dist/src/validateAnswers.d.ts +16 -0
  656. package/dist/src/validateAnswers.d.ts.map +1 -0
  657. package/dist/src/validateAnswers.js +89 -0
  658. package/dist/src/validateAnswers.js.map +1 -0
  659. package/dist/tsconfig.tsbuildinfo +1 -0
  660. package/package.json +4 -3
@@ -0,0 +1,53 @@
1
+ import * as _ from 'lodash-es';
2
+ import { applyMiddleware, combineReducers, compose, createStore } from 'redux';
3
+ import createSagaMiddleware from 'redux-saga';
4
+ import { fork } from 'redux-saga/effects';
5
+ import answersReducer from './answers/reducer';
6
+ import answersSaga from './answers/sagas';
7
+ import audioReducer from './audio/reducer';
8
+ import audioSaga from './audio/sagas';
9
+ import casReducer from './cas/reducer';
10
+ import casSaga from './cas/sagas';
11
+ import { validateAnswers } from '../validateAnswers';
12
+ const rootReducer = combineReducers({
13
+ answers: answersReducer,
14
+ audio: audioReducer,
15
+ cas: casReducer
16
+ });
17
+ function* rootSaga(examServerApi) {
18
+ yield fork(answersSaga, examServerApi);
19
+ yield fork(audioSaga, examServerApi);
20
+ yield fork(casSaga, examServerApi);
21
+ }
22
+ export function initializeExamStore(examStructure, casStatus, initialAnswers, restrictedAudioPlaybackStats, examServerApi) {
23
+ const initialQuestionIds = new Set(_.map(initialAnswers, 'questionId'));
24
+ const playbackTimes = _.mapValues(_.keyBy(restrictedAudioPlaybackStats, 'restrictedAudioId'), 'times');
25
+ const answersById = _.keyBy(initialAnswers, 'questionId');
26
+ const initialState = {
27
+ answers: {
28
+ answersById,
29
+ focusedQuestionId: null,
30
+ serverQuestionIds: initialQuestionIds,
31
+ supportsAnswerHistory: typeof examServerApi.selectAnswerVersion === 'function',
32
+ savedQuestionIds: initialQuestionIds,
33
+ examStructure,
34
+ validationErrors: validateAnswers(examStructure, answersById)
35
+ },
36
+ audio: {
37
+ errors: {},
38
+ nowPlaying: null,
39
+ playbackTimes
40
+ },
41
+ cas: { casStatus }
42
+ };
43
+ const sagaMiddleware = createSagaMiddleware();
44
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-unsafe-member-access
45
+ const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
46
+ const enhancers = composeEnhancers(applyMiddleware(sagaMiddleware));
47
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
48
+ // @ts-ignore
49
+ const store = createStore(rootReducer, initialState, enhancers);
50
+ sagaMiddleware.run(rootSaga, examServerApi);
51
+ return store;
52
+ }
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/store/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,WAAW,EAAS,MAAM,OAAO,CAAA;AACrF,OAAO,oBAAoB,MAAM,YAAY,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAA;AACzC,OAAO,cAAc,MAAM,mBAAmB,CAAA;AAC9C,OAAO,WAAW,MAAM,iBAAiB,CAAA;AACzC,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,SAAS,MAAM,eAAe,CAAA;AACrC,OAAO,UAAU,MAAM,eAAe,CAAA;AACtC,OAAO,OAAO,MAAM,aAAa,CAAA;AAGjC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,WAAW,GAAG,eAAe,CAAC;IAClC,OAAO,EAAE,cAAc;IACvB,KAAK,EAAE,YAAY;IACnB,GAAG,EAAE,UAAU;CAChB,CAAC,CAAA;AAEF,QAAQ,CAAC,CAAC,QAAQ,CAAC,aAA4B;IAC7C,MAAM,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAA;IACtC,MAAM,IAAI,CAAC,SAAS,EAAE,aAAa,CAAC,CAAA;IACpC,MAAM,IAAI,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;AACpC,CAAC;AAgBD,MAAM,UAAU,mBAAmB,CACjC,aAA0B,EAC1B,SAA2B,EAC3B,cAA4B,EAC5B,4BAA4D,EAC5D,aAA4B;IAE5B,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,cAAc,EAAE,YAAY,CAAC,CAAC,CAAA;IACvE,MAAM,aAAa,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,4BAA4B,EAAE,mBAAmB,CAAC,EAAE,OAAO,CAAC,CAAA;IACtG,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,cAAc,EAAE,YAAY,CAAC,CAAA;IACzD,MAAM,YAAY,GAAa;QAC7B,OAAO,EAAE;YACP,WAAW;YACX,iBAAiB,EAAE,IAAI;YACvB,iBAAiB,EAAE,kBAAkB;YACrC,qBAAqB,EAAE,OAAO,aAAa,CAAC,mBAAmB,KAAK,UAAU;YAC9E,gBAAgB,EAAE,kBAAkB;YACpC,aAAa;YACb,gBAAgB,EAAE,eAAe,CAAC,aAAa,EAAE,WAAW,CAAC;SAC9D;QACD,KAAK,EAAE;YACL,MAAM,EAAE,EAAE;YACV,UAAU,EAAE,IAAI;YAChB,aAAa;SACd;QACD,GAAG,EAAE,EAAE,SAAS,EAAE;KACnB,CAAA;IACD,MAAM,cAAc,GAAG,oBAAoB,EAAE,CAAA;IAC7C,8GAA8G;IAC9G,MAAM,gBAAgB,GAAK,MAAc,CAAC,oCAAuD,IAAI,OAAO,CAAA;IAC5G,MAAM,SAAS,GAAG,gBAAgB,CAAC,eAAe,CAAC,cAAc,CAAC,CAAC,CAAA;IACnE,6DAA6D;IAC7D,aAAa;IACb,MAAM,KAAK,GAAG,WAAW,CAAC,WAAW,EAAE,YAAY,EAAE,SAAS,CAAC,CAAA;IAC/D,cAAc,CAAC,GAAG,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAA;IAE3C,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { AppState } from '.';
2
+ import { AudioPlaybackError, RestrictedAudioId, SaveState } from '..';
3
+ export declare const getAudioState: (src: string, restrictedAudioId?: RestrictedAudioId) => (state: AppState) => "stopped" | "playing" | "other-playing";
4
+ export declare const getAudioPlaybackError: (src: string, restrictedAudioId?: RestrictedAudioId) => (state: AppState) => AudioPlaybackError | undefined;
5
+ export declare const getDurationRemaining: (src: string, restrictedAudioId?: RestrictedAudioId) => (state: AppState) => number | undefined;
6
+ export declare const getPlaybackTimes: (restrictedAudioId: RestrictedAudioId) => (state: AppState) => number;
7
+ export declare const getPlaybackTimesRemaining: (restrictedAudioId: RestrictedAudioId, times: number) => (state: AppState) => number;
8
+ export declare const getSaveState: (state: AppState) => SaveState;
9
+ //# sourceMappingURL=selectors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/store/selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAA;AAC5B,OAAO,EAAE,kBAAkB,EAA0B,iBAAiB,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;AAE7F,eAAO,MAAM,aAAa,QAClB,MAAM,sBAAsB,iBAAiB,aAC3C,QAAQ,KAAG,SAAS,GAAG,SAAS,GAAG,eAQ1C,CAAA;AAEH,eAAO,MAAM,qBAAqB,QAC1B,MAAM,sBAAsB,iBAAiB,aAC3C,QAAQ,KAAG,kBAAkB,GAAG,SACiC,CAAA;AAE3E,eAAO,MAAM,oBAAoB,QACzB,MAAM,sBAAsB,iBAAiB,aAC3C,QAAQ,KAAG,MAAM,GAAG,SACwF,CAAA;AAEtH,eAAO,MAAM,gBAAgB,sBACP,iBAAiB,aAC7B,QAAQ,KAAG,MACqC,CAAA;AAE1D,eAAO,MAAM,yBAAyB,sBAChB,iBAAiB,SAAS,MAAM,aAC5C,QAAQ,KAAG,MACiC,CAAA;AAEtD,eAAO,MAAM,YAAY,UAAW,QAAQ,KAAG,SAa9C,CAAA"}
@@ -0,0 +1,35 @@
1
+ import * as _ from 'lodash-es';
2
+ export const getAudioState = (src, restrictedAudioId) => (state) => {
3
+ const { nowPlaying } = state.audio;
4
+ return nowPlaying == null
5
+ ? 'stopped'
6
+ : nowPlaying.audio.restrictedAudioId === restrictedAudioId && nowPlaying.audio.src === src
7
+ ? 'playing'
8
+ : 'other-playing';
9
+ };
10
+ export const getAudioPlaybackError = (src, restrictedAudioId) => (state) => state.audio.errors[restrictedAudioId != null ? restrictedAudioId : src];
11
+ export const getDurationRemaining = (src, restrictedAudioId) => (state) => getAudioState(src, restrictedAudioId)(state) === 'playing' ? state.audio.nowPlaying.durationRemaining : undefined;
12
+ export const getPlaybackTimes = (restrictedAudioId) => (state) => _.get(state.audio.playbackTimes, restrictedAudioId, 0);
13
+ export const getPlaybackTimesRemaining = (restrictedAudioId, times) => (state) => times - getPlaybackTimes(restrictedAudioId)(state);
14
+ export const getSaveState = (state) => {
15
+ const { serverQuestionIds, savedQuestionIds, answersById } = state.answers;
16
+ if (serverQuestionIds.size === 0) {
17
+ return 'initial';
18
+ }
19
+ else if (serverQuestionIds.size !== savedQuestionIds.size ||
20
+ containsAnswerNotYetSavedInServer(serverQuestionIds, answersById)) {
21
+ return 'saving';
22
+ }
23
+ else {
24
+ return 'saved';
25
+ }
26
+ };
27
+ function containsAnswerNotYetSavedInServer(serverIds, answersById) {
28
+ for (const questionId in answersById) {
29
+ if (!serverIds.has(Number(questionId))) {
30
+ return true;
31
+ }
32
+ }
33
+ return false;
34
+ }
35
+ //# sourceMappingURL=selectors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../../src/store/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAI9B,MAAM,CAAC,MAAM,aAAa,GACxB,CAAC,GAAW,EAAE,iBAAqC,EAAE,EAAE,CACvD,CAAC,KAAe,EAA2C,EAAE;IAC3D,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,KAAK,CAAA;IAElC,OAAO,UAAU,IAAI,IAAI;QACvB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,iBAAiB,KAAK,iBAAiB,IAAI,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG;YACxF,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,eAAe,CAAA;AACvB,CAAC,CAAA;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAChC,CAAC,GAAW,EAAE,iBAAqC,EAAE,EAAE,CACvD,CAAC,KAAe,EAAkC,EAAE,CAClD,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,iBAAiB,IAAI,IAAI,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAC/B,CAAC,GAAW,EAAE,iBAAqC,EAAE,EAAE,CACvD,CAAC,KAAe,EAAsB,EAAE,CACtC,aAAa,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,UAAW,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAA;AAEtH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,CAAC,iBAAoC,EAAE,EAAE,CACzC,CAAC,KAAe,EAAU,EAAE,CAC1B,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAA;AAE1D,MAAM,CAAC,MAAM,yBAAyB,GACpC,CAAC,iBAAoC,EAAE,KAAa,EAAE,EAAE,CACxD,CAAC,KAAe,EAAU,EAAE,CAC1B,KAAK,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,CAAC,KAAK,CAAC,CAAA;AAEtD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAe,EAAa,EAAE;IACzD,MAAM,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC,OAAO,CAAA;IAE1E,IAAI,iBAAiB,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,SAAS,CAAA;IAClB,CAAC;SAAM,IACL,iBAAiB,CAAC,IAAI,KAAK,gBAAgB,CAAC,IAAI;QAChD,iCAAiC,CAAC,iBAAiB,EAAE,WAAW,CAAC,EACjE,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAA;IAChB,CAAC;AACH,CAAC,CAAA;AAED,SAAS,iCAAiC,CACxC,SAA0B,EAC1B,WAA2C;IAE3C,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC;YACvC,OAAO,IAAI,CAAA;QACb,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -0,0 +1,22 @@
1
+ export type QuestionId = number;
2
+ interface AnswerCommon {
3
+ questionId: QuestionId;
4
+ value: string;
5
+ /** This field is undefined in older exams that were packaged before this change. */
6
+ displayNumber?: string;
7
+ answerNonAnswer?: boolean;
8
+ }
9
+ export interface TextAnswer extends AnswerCommon {
10
+ type: 'text';
11
+ characterCount: number;
12
+ }
13
+ export interface RichTextAnswer extends AnswerCommon {
14
+ type: 'richText';
15
+ characterCount: number;
16
+ }
17
+ export interface ChoiceAnswer extends AnswerCommon {
18
+ type: 'choice';
19
+ }
20
+ export type ExamAnswer = TextAnswer | RichTextAnswer | ChoiceAnswer;
21
+ export {};
22
+ //# sourceMappingURL=ExamAnswer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamAnswer.d.ts","sourceRoot":"","sources":["../../../src/types/ExamAnswer.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAE/B,UAAU,YAAY;IACpB,UAAU,EAAE,UAAU,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;AAED,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,cAAe,SAAQ,YAAY;IAClD,IAAI,EAAE,UAAU,CAAA;IAChB,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,IAAI,EAAE,QAAQ,CAAA;CACf;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,cAAc,GAAG,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExamAnswer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamAnswer.js","sourceRoot":"","sources":["../../../src/types/ExamAnswer.ts"],"names":[],"mappings":""}
@@ -0,0 +1,78 @@
1
+ import { ExamAnswer, QuestionId } from './ExamAnswer';
2
+ export type SaveState = 'initial' | 'saving' | 'saved';
3
+ /**
4
+ * CAS status is a state machine with three states.
5
+ *
6
+ * ```
7
+ * +---------+ +--------+ +-------+
8
+ * |forbidden| <---> |allowing| ---> |allowed|
9
+ * +---------+ +--------+ +-------+
10
+ * ```
11
+ *
12
+ * When the user clicks the "Palauta A-osa" button, we start a 60s countdown
13
+ * and transition the state from `'forbidden'` to `'allowing'`. When the timer reaches
14
+ * zero, we transition the state from from `'allowing'` to `'allowed'`. Cancelling
15
+ * the countdown transitions the state back from `'allowing'` to `'forbidden'`.
16
+ */
17
+ export type CasStatus = InitialCasStatus | 'allowing';
18
+ export type InitialCasStatus = 'allowed' | 'forbidden';
19
+ export type RestrictedAudioId = number;
20
+ export type AudioPlaybackError =
21
+ /** The user has already accessed this restricted audio */
22
+ 'already-accessed'
23
+ /** There already is an audio file playing */
24
+ | 'already-playing'
25
+ /** Other error, e.g. a network issue */
26
+ | 'other-error';
27
+ export type AudioPlaybackResponse = 'ok' | AudioPlaybackError;
28
+ export interface RestrictedAudioPlaybackStats {
29
+ /** An unique identifier for each restricted audio element */
30
+ restrictedAudioId: RestrictedAudioId;
31
+ /** Number of times it has been listened to. */
32
+ times: number;
33
+ }
34
+ export interface ExamServerAPI {
35
+ /**
36
+ * Setting CAS status to allowed will lock the answers for each section where
37
+ * the use of CAS software is forbidden.
38
+ *
39
+ * All state transitions are not legal (for example, you may not disable CAS
40
+ * software after they have been allowed), so the function returns the CAS
41
+ * status that the server decided upon.
42
+ */
43
+ setCasStatus: (casStatus: CasStatus) => Promise<CasStatus>;
44
+ /** Retrieve the latest answer for each question */
45
+ getAnswers: () => Promise<ExamAnswer[]>;
46
+ /** Save a new answer to the server */
47
+ saveAnswer: (answer: ExamAnswer) => Promise<void>;
48
+ /**
49
+ * Play a non-restricted audio file. Right now, this is only used by the
50
+ * audio test. The Promise should be resolved with `'ok'` when playback starts
51
+ * or with an error response if an error occurs.
52
+ */
53
+ playAudio: (src: string) => Promise<AudioPlaybackResponse>;
54
+ /**
55
+ * Play a restricted audio file. The promise should be resolved with `'ok'`
56
+ * when the playback starts or with an error response if an error occurs.
57
+ *
58
+ * @param restrictedAudioId A number that uniquely identifies each restricted audio element.
59
+ * @param playbackTimes How many times this audio has been listened to already.
60
+ */
61
+ playRestrictedAudio: (src: string, restrictedAudioId: number, playbackTimes: number) => Promise<AudioPlaybackResponse>;
62
+ /**
63
+ * Get restricted audio file in a blob. The promise should be resolved with blob
64
+ * when the audio file has be loaded or rejected with an error response if an error occurs.
65
+ *
66
+ * @param restrictedAudioId A number that uniquely identifies each restricted audio element.
67
+ * @param playbackTimes How many times this audio has been listened to already.
68
+ */
69
+ getRestrictedAudio: (src: string, restrictedAudioId: number, playbackTimes: number) => Promise<Blob>;
70
+ /** Select another answer version from answer history. Return undefined to cancel. Optional feature. */
71
+ selectAnswerVersion?: (questionId: QuestionId, questionTitle: string) => Promise<ExamAnswer | undefined>;
72
+ /** Save screenshot to server. Should return the URL to the saved screenshot. */
73
+ saveScreenshot: (questionId: QuestionId, screenshot: Blob) => Promise<string>;
74
+ examineExam?: () => void;
75
+ /** Log client activity to server. Message format is free. Optional feature. */
76
+ logActivity?: (message: string) => void;
77
+ }
78
+ //# sourceMappingURL=ExamServerAPI.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamServerAPI.d.ts","sourceRoot":"","sources":["../../../src/types/ExamServerAPI.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAErD,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;AACtD;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,SAAS,GAAG,gBAAgB,GAAG,UAAU,CAAA;AACrD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,WAAW,CAAA;AACtD,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAA;AACtC,MAAM,MAAM,kBAAkB;AAC5B,0DAA0D;AACxD,kBAAkB;AACpB,6CAA6C;GAC3C,iBAAiB;AACnB,wCAAwC;GACtC,aAAa,CAAA;AACjB,MAAM,MAAM,qBAAqB,GAAG,IAAI,GAAG,kBAAkB,CAAA;AAE7D,MAAM,WAAW,4BAA4B;IAC3C,6DAA6D;IAC7D,iBAAiB,EAAE,iBAAiB,CAAA;IACpC,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;;;OAOG;IACH,YAAY,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,OAAO,CAAC,SAAS,CAAC,CAAA;IAC1D,mDAAmD;IACnD,UAAU,EAAE,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAA;IACvC,sCAAsC;IACtC,UAAU,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD;;;;OAIG;IACH,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAC1D;;;;;;OAMG;IACH,mBAAmB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,qBAAqB,CAAC,CAAA;IAEtH;;;;;;OAMG;IACH,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACpG,uGAAuG;IACvG,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IACxG,gFAAgF;IAChF,cAAc,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7E,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;IACxB,+EAA+E;IAC/E,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ExamServerAPI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ExamServerAPI.js","sourceRoot":"","sources":["../../../src/types/ExamServerAPI.ts"],"names":[],"mappings":""}
@@ -0,0 +1,40 @@
1
+ export interface GradingStructure {
2
+ questions: GradingStructureQuestion[];
3
+ }
4
+ export type GradingStructureQuestion = TextQuestion | ChoiceGroupQuestion;
5
+ export interface TextQuestion {
6
+ type: 'text';
7
+ id: number;
8
+ displayNumber: string;
9
+ maxScore: number;
10
+ maxLength?: number;
11
+ /**
12
+ * A tentative list of answers that will be accepted. Usually this is not the
13
+ * final list, since additional answers will be accepted during grading.
14
+ *
15
+ * If omitted, the question will be graded manually.
16
+ */
17
+ correctAnswers?: CorrectAnswer[];
18
+ }
19
+ export interface CorrectAnswer {
20
+ text: string;
21
+ score: number;
22
+ }
23
+ export interface ChoiceGroupQuestion {
24
+ type: 'choicegroup';
25
+ id: number;
26
+ displayNumber: string;
27
+ choices: ChoiceGroupChoice[];
28
+ }
29
+ export interface ChoiceGroupChoice {
30
+ id: number;
31
+ displayNumber: string;
32
+ type: 'choice';
33
+ options: ChoiceGroupOption[];
34
+ }
35
+ export interface ChoiceGroupOption {
36
+ id: number;
37
+ correct: boolean;
38
+ score: number;
39
+ }
40
+ //# sourceMappingURL=GradingStructure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GradingStructure.d.ts","sourceRoot":"","sources":["../../../src/types/GradingStructure.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,wBAAwB,EAAE,CAAA;CACtC;AAED,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,mBAAmB,CAAA;AAEzE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,aAAa,EAAE,CAAA;CACjC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,CAAA;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=GradingStructure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GradingStructure.js","sourceRoot":"","sources":["../../../src/types/GradingStructure.ts"],"names":[],"mappings":""}
@@ -0,0 +1,92 @@
1
+ import { QuestionId } from './ExamAnswer';
2
+ export type AnswerId = number;
3
+ export interface Score {
4
+ questionId: QuestionId;
5
+ answerId: AnswerId;
6
+ pregrading?: PregradingScore;
7
+ censoring?: CensoringScore;
8
+ inspection?: InspectionScore;
9
+ autograding?: AutogradedScore;
10
+ }
11
+ export interface AutogradedScore {
12
+ score: number;
13
+ }
14
+ export interface PregradingScore {
15
+ score?: number;
16
+ comment?: string;
17
+ annotations?: Annotation[];
18
+ }
19
+ export interface CensoringScore {
20
+ scores: Array<{
21
+ score: number;
22
+ shortCode: string;
23
+ }>;
24
+ annotations?: Annotation[];
25
+ nonAnswerDetails?: {
26
+ shortCode?: string;
27
+ };
28
+ comment?: string;
29
+ }
30
+ export interface InspectionScore {
31
+ score: number;
32
+ shortCodes: [string, string] | [string, string, string];
33
+ }
34
+ interface BaseAnnotation {
35
+ /** The message attached to the annotation */
36
+ message: string;
37
+ showPopup?: boolean;
38
+ markNumber?: string;
39
+ }
40
+ export interface TextAnnotation extends BaseAnnotation {
41
+ /** Legacy exams don't have this property, so it's marked as optional. */
42
+ type?: 'text';
43
+ /** A zero-indexed index of the character where the annotation starts at. Images are counted as 1 character. */
44
+ startIndex: number;
45
+ /** The length of the annotation in characters. Images are counted as 1 character. */
46
+ length: number;
47
+ }
48
+ export interface NewExamAnnotation extends TextAnnotation {
49
+ displayNumber: string;
50
+ annotationAnchor: string;
51
+ hidden: boolean;
52
+ selectedText: string;
53
+ }
54
+ export interface ExamAnnotation extends NewExamAnnotation {
55
+ annotationId: number;
56
+ }
57
+ interface ShapeAnnotation extends BaseAnnotation {
58
+ /** A 0-indexed number describing which <img /> in the answer the annotation is attached to. */
59
+ attachmentIndex: number;
60
+ }
61
+ export interface LineAnnotation extends ShapeAnnotation {
62
+ type: 'line';
63
+ /** Relative x-coordinate between 0 and 1. */
64
+ x1: number;
65
+ /** Relative y-coordinate between 0 and 1. */
66
+ y1: number;
67
+ /** Relative x-coordinate between 0 and 1. */
68
+ x2: number;
69
+ /** Relative y-coordinate between 0 and 1. */
70
+ y2: number;
71
+ }
72
+ export interface RectAnnotation extends ShapeAnnotation {
73
+ type: 'rect';
74
+ /** Relative x-coordinate between 0 and 1. */
75
+ x: number;
76
+ /** Relative y-coordinate between 0 and 1. */
77
+ y: number;
78
+ /** Relative width between 0 and 1. Note that `x + width` should be less or equal than 1. */
79
+ width: number;
80
+ /** Relative height between 0 and 1. Note that `y + height` should be less or equal than 1.*/
81
+ height: number;
82
+ }
83
+ /**
84
+ * Image annotations are annotations attached to a screenshot or a formula.
85
+ * They are described with relative `x` and `y`-coordinates, with `(0, 0)` being
86
+ * in the top left corner of the image and `(1, 1)` being in the bottom right
87
+ * corner of the image.
88
+ */
89
+ export type ImageAnnotation = LineAnnotation | RectAnnotation;
90
+ export type Annotation = TextAnnotation | ImageAnnotation;
91
+ export {};
92
+ //# sourceMappingURL=Score.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Score.d.ts","sourceRoot":"","sources":["../../../src/types/Score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAA;AAE7B,MAAM,WAAW,KAAK;IACpB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,SAAS,CAAC,EAAE,cAAc,CAAA;IAC1B,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACnD,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,gBAAgB,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACzC,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;CACxD;AAED,UAAU,cAAc;IACtB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,+GAA+G;IAC/G,UAAU,EAAE,MAAM,CAAA;IAClB,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACvD,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,YAAY,EAAE,MAAM,CAAA;CACrB;AACD,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,UAAU,eAAgB,SAAQ,cAAc;IAC9C,+FAA+F;IAC/F,eAAe,EAAE,MAAM,CAAA;CACxB;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;CACX;AAED,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,6CAA6C;IAC7C,CAAC,EAAE,MAAM,CAAA;IACT,6CAA6C;IAC7C,CAAC,EAAE,MAAM,CAAA;IACT,4FAA4F;IAC5F,KAAK,EAAE,MAAM,CAAA;IACb,6FAA6F;IAC7F,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,cAAc,CAAA;AAE7D,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Score.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Score.js","sourceRoot":"","sources":["../../../src/types/Score.ts"],"names":[],"mappings":""}
@@ -0,0 +1,7 @@
1
+ type URLOptions = Partial<Omit<URL, 'origin' | 'searchParams' | 'toJSON'>>;
2
+ /**
3
+ * A helper function for constructing relative URLs for links within the exam
4
+ */
5
+ export declare function url(path: string, options?: URLOptions): string;
6
+ export {};
7
+ //# sourceMappingURL=url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/url.ts"],"names":[],"mappings":"AAEA,KAAK,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,GAAG,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAA;AAE1E;;GAEG;AACH,wBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CAM9D"}
@@ -0,0 +1,12 @@
1
+ import * as _ from 'lodash-es';
2
+ /**
3
+ * A helper function for constructing relative URLs for links within the exam
4
+ */
5
+ export function url(path, options) {
6
+ const u = new URL(path, 'http://example.com'); // hostname doesn't matter but it is required for URL constructor
7
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
8
+ _.forEach(options, (v, k) => (u[k] = v));
9
+ const constructedPath = u.pathname + u.search + u.hash;
10
+ return path.startsWith('/') ? constructedPath : constructedPath.substr(1);
11
+ }
12
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,WAAW,CAAA;AAI9B;;GAEG;AACH,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,OAAoB;IACpD,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAA,CAAC,iEAAiE;IAC/G,sEAAsE;IACtE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAE,CAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IACjD,MAAM,eAAe,GAAG,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAA;IACtD,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;AAC3E,CAAC"}
@@ -0,0 +1,3 @@
1
+ /** Like `useMemo`, but guaranteed never to be reinitialized. Doesn't support dependencies. */
2
+ export declare function useCached<T>(fn: () => T): T;
3
+ //# sourceMappingURL=useCached.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCached.d.ts","sourceRoot":"","sources":["../../src/useCached.ts"],"names":[],"mappings":"AAEA,8FAA8F;AAC9F,wBAAgB,SAAS,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAE3C"}
@@ -0,0 +1,6 @@
1
+ import { useState } from 'react';
2
+ /** Like `useMemo`, but guaranteed never to be reinitialized. Doesn't support dependencies. */
3
+ export function useCached(fn) {
4
+ return useState(fn)[0];
5
+ }
6
+ //# sourceMappingURL=useCached.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCached.js","sourceRoot":"","sources":["../../src/useCached.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,8FAA8F;AAC9F,MAAM,UAAU,SAAS,CAAI,EAAW;IACtC,OAAO,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AACxB,CAAC"}
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ /**
3
+ * Maps an array, skipping the value if `fn` returns `undefined`.
4
+ *
5
+ * @example mapMaybe(array, fn) ≡ array.map(fn).filter(v => v !== undefined)
6
+ */
7
+ export declare function mapMaybe<T, U>(array: T[], fn: (value: T, index: number) => U | undefined): U[];
8
+ /**
9
+ * Insert a separator between each element of the array.
10
+ *
11
+ * @example intersperse(',', ['a', 'b', 'c']) ≡ ['a', ',', 'b', ',' 'c']
12
+ */
13
+ export declare function intersperse<T>(separator: T, array: T[]): T[];
14
+ export declare function isWhitespace(node: React.ReactNode): boolean;
15
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,CAAC,GAAG,SAAS,GAAG,CAAC,EAAE,CAW9F;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAW5D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,WAEjD"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Maps an array, skipping the value if `fn` returns `undefined`.
3
+ *
4
+ * @example mapMaybe(array, fn) ≡ array.map(fn).filter(v => v !== undefined)
5
+ */
6
+ export function mapMaybe(array, fn) {
7
+ const result = [];
8
+ for (let i = 0; i < array.length; i++) {
9
+ const value = fn(array[i], i);
10
+ if (value !== undefined) {
11
+ result.push(value);
12
+ }
13
+ }
14
+ return result;
15
+ }
16
+ /**
17
+ * Insert a separator between each element of the array.
18
+ *
19
+ * @example intersperse(',', ['a', 'b', 'c']) ≡ ['a', ',', 'b', ',' 'c']
20
+ */
21
+ export function intersperse(separator, array) {
22
+ if (array.length === 0)
23
+ return [];
24
+ const result = new Array(array.length * 2 - 1);
25
+ for (let i = 0; i < array.length - 1; i++) {
26
+ result[i * 2] = array[i];
27
+ result[i * 2 + 1] = separator;
28
+ }
29
+ result[result.length - 1] = array[array.length - 1];
30
+ return result;
31
+ }
32
+ export function isWhitespace(node) {
33
+ return typeof node === 'string' && node.trim().length === 0;
34
+ }
35
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAO,KAAU,EAAE,EAA8C;IACvF,MAAM,MAAM,GAAQ,EAAE,CAAA;IAEtB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;QAC7B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QACpB,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAI,SAAY,EAAE,KAAU;IACrD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACjC,MAAM,MAAM,GAAG,IAAI,KAAK,CAAI,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC,CAAA;IAEjD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC1C,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACxB,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,SAAS,CAAA;IAC/B,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACnD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAqB;IAChD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAA;AAC7D,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { RootElement } from './parser/parseExamStructure';
2
+ import { ExamAnswer, QuestionId } from './types/ExamAnswer';
3
+ import { AnsweringInstructionProps } from './components/AnsweringInstructions';
4
+ export type ValidationError = ExtraAnswer | AnswerTooLong;
5
+ export interface AnswerTooLong {
6
+ type: 'AnswerTooLong';
7
+ displayNumber: string;
8
+ characterCount: number;
9
+ elementType: 'exam' | 'section' | 'question';
10
+ }
11
+ export interface ExtraAnswer extends AnsweringInstructionProps {
12
+ type: 'ExtraAnswer';
13
+ displayNumber: string;
14
+ }
15
+ export declare function validateAnswers(examStructure: RootElement, answersById: Record<QuestionId, ExamAnswer>): ValidationError[];
16
+ //# sourceMappingURL=validateAnswers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateAnswers.d.ts","sourceRoot":"","sources":["../../src/validateAnswers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAE3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AAE9E,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,aAAa,CAAA;AAEzD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,eAAe,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,cAAc,EAAE,MAAM,CAAA;IACtB,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;CAC7C;AAED,MAAM,WAAW,WAAY,SAAQ,yBAAyB;IAC5D,IAAI,EAAE,aAAa,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;CACtB;AA2GD,wBAAgB,eAAe,CAC7B,aAAa,EAAE,WAAW,EAC1B,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,GAC1C,eAAe,EAAE,CAInB"}
@@ -0,0 +1,89 @@
1
+ import * as _ from 'lodash-es';
2
+ function reduceExam(examStructure, reducer, initialValue) {
3
+ function go(accumulator, element) {
4
+ return element.childNodes.reduce(go, reducer(accumulator, element));
5
+ }
6
+ return go(initialValue, examStructure);
7
+ }
8
+ function validateAnswerLength(examStructure, answersById) {
9
+ return reduceExam(examStructure, (errors, element) => {
10
+ if (element.name === 'text-answer' && element.attributes.maxLength != null) {
11
+ const maybeAnswer = answersById[element.attributes.questionId];
12
+ if ((maybeAnswer === null || maybeAnswer === void 0 ? void 0 : maybeAnswer.type) === 'richText' || (maybeAnswer === null || maybeAnswer === void 0 ? void 0 : maybeAnswer.type) === 'text') {
13
+ return maybeAnswer.characterCount > element.attributes.maxLength
14
+ ? [
15
+ ...errors,
16
+ {
17
+ type: 'AnswerTooLong',
18
+ displayNumber: element.attributes.displayNumber,
19
+ characterCount: maybeAnswer.characterCount,
20
+ elementType: 'question'
21
+ }
22
+ ]
23
+ : errors;
24
+ }
25
+ return errors;
26
+ }
27
+ else {
28
+ return errors;
29
+ }
30
+ }, []);
31
+ }
32
+ function validateExtraAnswers(examStructure, answersById) {
33
+ // A recursive function that that calculates the answer count at each level
34
+ // (answerCount) and carries around an array of extra answers
35
+ function go(element) {
36
+ var _a;
37
+ const displayNumber = element.name === 'exam' ? '' : element.attributes.displayNumber;
38
+ switch (element.name) {
39
+ case 'exam':
40
+ case 'section':
41
+ case 'question': {
42
+ const children = element.childNodes.map(go);
43
+ const childrenWithAnswers = children.filter(v => v.answerCount > 0);
44
+ const maxAnswers = (_a = element.attributes.maxAnswers) !== null && _a !== void 0 ? _a : Infinity;
45
+ // Currently, min-answers exists only at section level.
46
+ const minAnswers = element.name === 'section' ? element.attributes.minAnswers : undefined;
47
+ // At exam level, answer count is the sum of answer counts of each
48
+ // section. At section and question levels, answer count is the number
49
+ // of child questions that have _any_ answers.
50
+ const answerCount = element.name === 'exam'
51
+ ? childrenWithAnswers.reduce((acc, section) => acc + section.answerCount, 0)
52
+ : childrenWithAnswers.length;
53
+ const childExtraAnswers = _.flatMap(children, v => v.extraAnswers);
54
+ // If there are extra answers on the current level, we prepend them to
55
+ // the extra answers array, so it is ordered naturally in document
56
+ // order.
57
+ const extraAnswers = answerCount > maxAnswers
58
+ ? [
59
+ {
60
+ type: 'ExtraAnswer',
61
+ elementType: element.name,
62
+ displayNumber,
63
+ childQuestions: children.map(v => v.displayNumber),
64
+ maxAnswers,
65
+ minAnswers
66
+ },
67
+ ...childExtraAnswers
68
+ ]
69
+ : childExtraAnswers;
70
+ return { answerCount, displayNumber, extraAnswers };
71
+ }
72
+ case 'text-answer':
73
+ case 'scored-text-answer':
74
+ case 'choice-answer':
75
+ case 'dropdown-answer': {
76
+ const maybeAnswer = answersById[element.attributes.questionId];
77
+ // An answer whose value is '' is considered to be empty, so we ignore
78
+ // them.
79
+ const isValidAnswer = (maybeAnswer === null || maybeAnswer === void 0 ? void 0 : maybeAnswer.value.length) > 0;
80
+ return { answerCount: isValidAnswer ? 1 : 0, displayNumber, extraAnswers: [] };
81
+ }
82
+ }
83
+ }
84
+ return go(examStructure).extraAnswers;
85
+ }
86
+ export function validateAnswers(examStructure, answersById) {
87
+ return _.flatMap([validateAnswerLength, validateExtraAnswers], validationFn => validationFn(examStructure, answersById));
88
+ }
89
+ //# sourceMappingURL=validateAnswers.js.map