@shzlx/ui-default 4.58.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (448) hide show
  1. package/README.md +5 -0
  2. package/api.ts +61 -0
  3. package/backendlib/builder.ts +182 -0
  4. package/backendlib/markdown-it-imsize.ts +235 -0
  5. package/backendlib/markdown-it-katex.ts +139 -0
  6. package/backendlib/markdown-it-media.ts +163 -0
  7. package/backendlib/markdown-it-xss.ts +200 -0
  8. package/backendlib/markdown.js +64 -0
  9. package/backendlib/misc.ts +54 -0
  10. package/backendlib/template.ts +279 -0
  11. package/breakpoints.json +5 -0
  12. package/components/DOMAttachedObject.ts +128 -0
  13. package/components/autocomplete/AssignSelectAutoComplete.tsx +22 -0
  14. package/components/autocomplete/CustomSelectAutoComplete.tsx +23 -0
  15. package/components/autocomplete/DomainSelectAutoComplete.tsx +18 -0
  16. package/components/autocomplete/FileSelectAutoComplete.tsx +26 -0
  17. package/components/autocomplete/LanguageSelectAutoComplete.tsx +24 -0
  18. package/components/autocomplete/ProblemSelectAutoComplete.tsx +18 -0
  19. package/components/autocomplete/UserSelectAutoComplete.tsx +23 -0
  20. package/components/autocomplete/components/AssignSelectAutoComplete.tsx +118 -0
  21. package/components/autocomplete/components/DomainSelectAutoComplete.tsx +53 -0
  22. package/components/autocomplete/components/FileSelectAutoComplete.tsx +50 -0
  23. package/components/autocomplete/components/LanguageSelectAutoComplete.tsx +48 -0
  24. package/components/autocomplete/components/ProblemSelectAutoComplete.tsx +54 -0
  25. package/components/autocomplete/components/UserSelectAutoComplete.tsx +54 -0
  26. package/components/autocomplete/domainselectautocomplete.page.styl +6 -0
  27. package/components/autocomplete/index.tsx +110 -0
  28. package/components/autocomplete/problemselectautocomplete.page.styl +6 -0
  29. package/components/autocomplete/userselectautocomplete.page.styl +6 -0
  30. package/components/browser-update.page.ts +27 -0
  31. package/components/calendar/calendar.page.styl +129 -0
  32. package/components/calendar/index.js +367 -0
  33. package/components/clipboard.page.ts +23 -0
  34. package/components/contest/contest.page.styl +119 -0
  35. package/components/contest/contest.page.ts +23 -0
  36. package/components/contest/contest_sidebar.page.styl +21 -0
  37. package/components/contest/problem-contest-bg.png +0 -0
  38. package/components/contest/problem-contest-bg@2x.png +0 -0
  39. package/components/customFont.page.tsx +90 -0
  40. package/components/datepicker/datepicker.page.tsx +94 -0
  41. package/components/dialog/DomDialog.ts +145 -0
  42. package/components/dialog/dialog.page.styl +40 -0
  43. package/components/dialog/index.tsx +285 -0
  44. package/components/discussion/CommentBox.js +103 -0
  45. package/components/discussion/collapsible.page.styl +40 -0
  46. package/components/discussion/collapsible.page.tsx +62 -0
  47. package/components/discussion/comments.page.styl +142 -0
  48. package/components/discussion/comments.page.tsx +192 -0
  49. package/components/discussion/discussion.page.styl +17 -0
  50. package/components/discussion/history.page.tsx +81 -0
  51. package/components/discussion/reaction.page.styl +30 -0
  52. package/components/discussion/reaction.page.tsx +103 -0
  53. package/components/drop/drop.page.styl +40 -0
  54. package/components/dropdown/Dropdown.js +50 -0
  55. package/components/dropdown/dropdown.page.styl +33 -0
  56. package/components/dropdown/dropdown.page.ts +8 -0
  57. package/components/editor/cmeditor.page.ts +23 -0
  58. package/components/editor/cmeditor.styl +10 -0
  59. package/components/editor/index.tsx +293 -0
  60. package/components/editor/mdeditor.ts +60 -0
  61. package/components/editor/textareaHandler.ts +29 -0
  62. package/components/footer/footer.page.styl +94 -0
  63. package/components/footer/footer.page.ts +26 -0
  64. package/components/form/button.page.default.styl +59 -0
  65. package/components/form/button.page.styl +36 -0
  66. package/components/form/checkbox.page.styl +89 -0
  67. package/components/form/form.page.styl +200 -0
  68. package/components/form/form.page.ts +20 -0
  69. package/components/form/multiSelectCheckbox.page.js +46 -0
  70. package/components/form/radiobox.page.styl +62 -0
  71. package/components/form/select.page.styl +29 -0
  72. package/components/form/textbox.page.styl +79 -0
  73. package/components/form/textbox.page.ts +21 -0
  74. package/components/form/var.inc.styl +14 -0
  75. package/components/header/header.page.styl +79 -0
  76. package/components/highlighter/code-example.js +111 -0
  77. package/components/highlighter/highlighter.page.styl +99 -0
  78. package/components/highlighter/highlighter.page.ts +72 -0
  79. package/components/highlighter/meta.js +15 -0
  80. package/components/highlighter/prismjs.js +122 -0
  81. package/components/hint.page.styl +9 -0
  82. package/components/hint.ts +19 -0
  83. package/components/hitokoto/index.page.js +21 -0
  84. package/components/hotkey/hotkey.page.js +83 -0
  85. package/components/katex/katex.page.js +26 -0
  86. package/components/katex/katex.page.styl +2 -0
  87. package/components/languageselect.tsx +94 -0
  88. package/components/loader/loader.page.styl +40 -0
  89. package/components/mantine.page.tsx +39 -0
  90. package/components/marker/Marker.js +192 -0
  91. package/components/marker/MarkerReactive.js +55 -0
  92. package/components/marker/marker.page.js +8 -0
  93. package/components/marker/marker.page.styl +57 -0
  94. package/components/media/media.page.js +46 -0
  95. package/components/menu/menu-heading.page.js +28 -0
  96. package/components/menu/menu.page.js +18 -0
  97. package/components/menu/menu.page.styl +68 -0
  98. package/components/message/index.page.ts +166 -0
  99. package/components/message/worker.ts +110 -0
  100. package/components/messagepad/DialogueListItem.page.styl +28 -0
  101. package/components/messagepad/DialogueListItemComponent.jsx +39 -0
  102. package/components/messagepad/Message.page.styl +64 -0
  103. package/components/messagepad/MessageComponent.jsx +33 -0
  104. package/components/messagepad/MessagePad.page.styl +99 -0
  105. package/components/messagepad/MessagePadDialogueContentContainer.jsx +104 -0
  106. package/components/messagepad/MessagePadDialogueListContainer.jsx +49 -0
  107. package/components/messagepad/MessagePadInputContainer.jsx +100 -0
  108. package/components/messagepad/index.jsx +49 -0
  109. package/components/messagepad/reducers/activeId.ts +36 -0
  110. package/components/messagepad/reducers/dialogues.js +53 -0
  111. package/components/messagepad/reducers/index.ts +14 -0
  112. package/components/messagepad/reducers/inputs.js +43 -0
  113. package/components/messagepad/reducers/isPosting.ts +49 -0
  114. package/components/monaco/index.ts +178 -0
  115. package/components/monaco/languages/markdown.ts +97 -0
  116. package/components/monaco/languages/typescript.ts +45 -0
  117. package/components/monaco/languages/yaml.ts +22 -0
  118. package/components/monaco/loader.ts +96 -0
  119. package/components/monaco/monaco.styl +30 -0
  120. package/components/monaco/nls.js +31 -0
  121. package/components/monaco/schema/problemconfig.ts +123 -0
  122. package/components/navigation/hamburgers.page.styl +87 -0
  123. package/components/navigation/nav-logo-small_dark.png +0 -0
  124. package/components/navigation/navigation.page.js +203 -0
  125. package/components/navigation/navigation.page.styl +211 -0
  126. package/components/notification/index.ts +105 -0
  127. package/components/notification/notification.page.js +14 -0
  128. package/components/notification/notification.page.styl +84 -0
  129. package/components/nprogress.page.styl +50 -0
  130. package/components/omnisearch/index.page.tsx +124 -0
  131. package/components/omnisearch/omnibar.page.styl +138 -0
  132. package/components/pager/pager.page.styl +57 -0
  133. package/components/preview/preview.page.ts +187 -0
  134. package/components/problem/create.page.js +12 -0
  135. package/components/problem/list.page.js +9 -0
  136. package/components/problem/rp.page.styl +4 -0
  137. package/components/problem/tag.page.styl +84 -0
  138. package/components/problemconfig/BasicForm.tsx +92 -0
  139. package/components/problemconfig/ProblemConfigEditor.tsx +170 -0
  140. package/components/problemconfig/ProblemConfigForm.tsx +140 -0
  141. package/components/problemconfig/ProblemConfigTree.tsx +163 -0
  142. package/components/problemconfig/ProblemType.tsx +165 -0
  143. package/components/problemconfig/index.tsx +91 -0
  144. package/components/problemconfig/reducer/config.ts +173 -0
  145. package/components/problemconfig/reducer/index.ts +11 -0
  146. package/components/problemconfig/reducer/testdata.ts +16 -0
  147. package/components/problemconfig/tree/AddTestcase.tsx +137 -0
  148. package/components/problemconfig/tree/SelectionManager.tsx +140 -0
  149. package/components/problemconfig/tree/SubtaskSettings.tsx +180 -0
  150. package/components/problemconfig/tree/Testcase.tsx +98 -0
  151. package/components/profile/backgrounds/1.jpg +0 -0
  152. package/components/profile/backgrounds/10.jpg +0 -0
  153. package/components/profile/backgrounds/11.jpg +0 -0
  154. package/components/profile/backgrounds/12.jpg +0 -0
  155. package/components/profile/backgrounds/13.jpg +0 -0
  156. package/components/profile/backgrounds/14.jpg +0 -0
  157. package/components/profile/backgrounds/15.jpg +0 -0
  158. package/components/profile/backgrounds/16.jpg +0 -0
  159. package/components/profile/backgrounds/17.jpg +0 -0
  160. package/components/profile/backgrounds/18.jpg +0 -0
  161. package/components/profile/backgrounds/19.jpg +0 -0
  162. package/components/profile/backgrounds/2.jpg +0 -0
  163. package/components/profile/backgrounds/20.jpg +0 -0
  164. package/components/profile/backgrounds/21.jpg +0 -0
  165. package/components/profile/backgrounds/3.jpg +0 -0
  166. package/components/profile/backgrounds/4.jpg +0 -0
  167. package/components/profile/backgrounds/5.jpg +0 -0
  168. package/components/profile/backgrounds/6.jpg +0 -0
  169. package/components/profile/backgrounds/7.jpg +0 -0
  170. package/components/profile/backgrounds/8.jpg +0 -0
  171. package/components/profile/backgrounds/9.jpg +0 -0
  172. package/components/profile/backgrounds/gen_thumbnails.sh +7 -0
  173. package/components/profile/backgrounds/thumbnail/1.jpg +0 -0
  174. package/components/profile/backgrounds/thumbnail/10.jpg +0 -0
  175. package/components/profile/backgrounds/thumbnail/11.jpg +0 -0
  176. package/components/profile/backgrounds/thumbnail/12.jpg +0 -0
  177. package/components/profile/backgrounds/thumbnail/13.jpg +0 -0
  178. package/components/profile/backgrounds/thumbnail/14.jpg +0 -0
  179. package/components/profile/backgrounds/thumbnail/15.jpg +0 -0
  180. package/components/profile/backgrounds/thumbnail/16.jpg +0 -0
  181. package/components/profile/backgrounds/thumbnail/17.jpg +0 -0
  182. package/components/profile/backgrounds/thumbnail/18.jpg +0 -0
  183. package/components/profile/backgrounds/thumbnail/19.jpg +0 -0
  184. package/components/profile/backgrounds/thumbnail/2.jpg +0 -0
  185. package/components/profile/backgrounds/thumbnail/20.jpg +0 -0
  186. package/components/profile/backgrounds/thumbnail/21.jpg +0 -0
  187. package/components/profile/backgrounds/thumbnail/3.jpg +0 -0
  188. package/components/profile/backgrounds/thumbnail/4.jpg +0 -0
  189. package/components/profile/backgrounds/thumbnail/5.jpg +0 -0
  190. package/components/profile/backgrounds/thumbnail/6.jpg +0 -0
  191. package/components/profile/backgrounds/thumbnail/7.jpg +0 -0
  192. package/components/profile/backgrounds/thumbnail/8.jpg +0 -0
  193. package/components/profile/backgrounds/thumbnail/9.jpg +0 -0
  194. package/components/profile/profile.page.styl +23 -0
  195. package/components/react/DomComponent.tsx +14 -0
  196. package/components/react/IconComponent.tsx +20 -0
  197. package/components/record/record.page.styl +26 -0
  198. package/components/rotator/index.js +75 -0
  199. package/components/rotator/rotator.page.styl +20 -0
  200. package/components/scratchpad/DataInput.page.styl +17 -0
  201. package/components/scratchpad/DataInputComponent.jsx +45 -0
  202. package/components/scratchpad/Editor.page.styl +13 -0
  203. package/components/scratchpad/Panel.page.styl +18 -0
  204. package/components/scratchpad/PanelButton.page.styl +15 -0
  205. package/components/scratchpad/PanelButtonComponent.jsx +19 -0
  206. package/components/scratchpad/PanelComponent.jsx +25 -0
  207. package/components/scratchpad/ScratchpadEditorContainer.tsx +137 -0
  208. package/components/scratchpad/ScratchpadPretestContainer.jsx +57 -0
  209. package/components/scratchpad/ScratchpadRecordsContainer.jsx +45 -0
  210. package/components/scratchpad/ScratchpadRecordsRowContainer.jsx +83 -0
  211. package/components/scratchpad/ScratchpadSettings.tsx +48 -0
  212. package/components/scratchpad/ScratchpadToolbarContainer.jsx +190 -0
  213. package/components/scratchpad/Tab.page.styl +24 -0
  214. package/components/scratchpad/Toolbar.page.styl +53 -0
  215. package/components/scratchpad/ToolbarComponent.jsx +85 -0
  216. package/components/scratchpad/index.tsx +132 -0
  217. package/components/scratchpad/reducers/editor.ts +24 -0
  218. package/components/scratchpad/reducers/index.ts +17 -0
  219. package/components/scratchpad/reducers/pretest.ts +34 -0
  220. package/components/scratchpad/reducers/records.ts +40 -0
  221. package/components/scratchpad/reducers/state.ts +10 -0
  222. package/components/scratchpad/reducers/ui.ts +152 -0
  223. package/components/scratchpad/scratchpad.page.styl +55 -0
  224. package/components/scratchpad/var.inc.styl +2 -0
  225. package/components/selectUser.tsx +16 -0
  226. package/components/signin/signInDialog.page.js +84 -0
  227. package/components/signin/signin_dialog.page.styl +57 -0
  228. package/components/smoothscroll/smoothscroll.page.js +44 -0
  229. package/components/socket/index.ts +68 -0
  230. package/components/star/star.page.styl +20 -0
  231. package/components/star/star.page.ts +58 -0
  232. package/components/sticky/sticky.page.js +66 -0
  233. package/components/tab/Tab.js +168 -0
  234. package/components/tab/tab.page.js +9 -0
  235. package/components/tab/tab.page.styl +105 -0
  236. package/components/tab/var.inc.styl +3 -0
  237. package/components/table/StyledTable.js +51 -0
  238. package/components/table/styledTable.page.js +8 -0
  239. package/components/table/table.page.styl +73 -0
  240. package/components/time/time.page.js +47 -0
  241. package/components/tooltip/Tooltip.js +49 -0
  242. package/components/tooltip/tooltip.page.js +29 -0
  243. package/components/tooltip/tooltip.page.styl +69 -0
  244. package/components/training/training.page.styl +25 -0
  245. package/components/upload.tsx +103 -0
  246. package/components/vote/vote.page.js +43 -0
  247. package/components/zipDownloader/index.ts +157 -0
  248. package/constant/domain.js +21 -0
  249. package/constant/message.js +5 -0
  250. package/constant/record.js +52 -0
  251. package/context.ts +11 -0
  252. package/entry.js +72 -0
  253. package/hydro.ts +112 -0
  254. package/index.ts +226 -0
  255. package/lazyload.ts +69 -0
  256. package/locales/en.yaml +71 -0
  257. package/locales/ko.yaml +823 -0
  258. package/locales/zh.yaml +1137 -0
  259. package/locales/zh_TW.yaml +1133 -0
  260. package/misc/Page.ts +49 -0
  261. package/misc/PageLoader.js +31 -0
  262. package/misc/float.styl +14 -0
  263. package/misc/grid.styl +1048 -0
  264. package/misc/immersive-background.jpg +0 -0
  265. package/misc/immersive-background@2x.jpg +0 -0
  266. package/misc/immersive.styl +23 -0
  267. package/misc/nothing.styl +13 -0
  268. package/misc/puzzled_twd2.svg +1 -0
  269. package/misc/section.styl +105 -0
  270. package/misc/slideout.styl +46 -0
  271. package/misc/structure.styl +158 -0
  272. package/misc/textalign.styl +11 -0
  273. package/misc/typography.styl +485 -0
  274. package/package.json +148 -0
  275. package/polyfill.ts +90 -0
  276. package/postcss.config.js +15 -0
  277. package/sentry.ts +26 -0
  278. package/service-worker.ts +265 -0
  279. package/setting.yaml +98 -0
  280. package/templates/about.html +14 -0
  281. package/templates/bsod.html +35 -0
  282. package/templates/components/comments_discussion.html +165 -0
  283. package/templates/components/comments_solution.html +171 -0
  284. package/templates/components/contest.html +12 -0
  285. package/templates/components/form.html +214 -0
  286. package/templates/components/home.html +20 -0
  287. package/templates/components/homework.html +8 -0
  288. package/templates/components/md_hint.html +39 -0
  289. package/templates/components/noscript_note.html +15 -0
  290. package/templates/components/nothing.html +6 -0
  291. package/templates/components/paginator.html +25 -0
  292. package/templates/components/problem.html +33 -0
  293. package/templates/components/record.html +21 -0
  294. package/templates/components/sidemenu.html +11 -0
  295. package/templates/components/user.html +49 -0
  296. package/templates/contest_balloon.html +48 -0
  297. package/templates/contest_clarification.html +103 -0
  298. package/templates/contest_detail.html +56 -0
  299. package/templates/contest_edit.html +259 -0
  300. package/templates/contest_main.html +146 -0
  301. package/templates/contest_manage.html +80 -0
  302. package/templates/contest_print.html +27 -0
  303. package/templates/contest_problemlist.html +231 -0
  304. package/templates/contest_scoreboard.html +46 -0
  305. package/templates/contest_scoreboard_download_html.html +71 -0
  306. package/templates/contest_user.html +47 -0
  307. package/templates/discussion_create.html +28 -0
  308. package/templates/discussion_detail.html +149 -0
  309. package/templates/discussion_edit.html +30 -0
  310. package/templates/discussion_main_or_node.html +47 -0
  311. package/templates/domain_base.html +26 -0
  312. package/templates/domain_create.html +55 -0
  313. package/templates/domain_dashboard.html +45 -0
  314. package/templates/domain_edit.html +6 -0
  315. package/templates/domain_group.html +51 -0
  316. package/templates/domain_join.html +47 -0
  317. package/templates/domain_join_applications.html +67 -0
  318. package/templates/domain_permission.html +66 -0
  319. package/templates/domain_role.html +71 -0
  320. package/templates/domain_user.html +86 -0
  321. package/templates/domain_user_raw.html +5 -0
  322. package/templates/error.html +25 -0
  323. package/templates/home_domain.html +64 -0
  324. package/templates/home_files.html +16 -0
  325. package/templates/home_messages.html +9 -0
  326. package/templates/home_security.html +224 -0
  327. package/templates/home_settings.html +21 -0
  328. package/templates/homework_detail.html +82 -0
  329. package/templates/homework_edit.html +138 -0
  330. package/templates/homework_files.html +24 -0
  331. package/templates/homework_main.html +76 -0
  332. package/templates/layout/basic.html +27 -0
  333. package/templates/layout/home_base.html +13 -0
  334. package/templates/layout/html5.html +74 -0
  335. package/templates/layout/immersive.html +22 -0
  336. package/templates/layout/mail.html +31 -0
  337. package/templates/layout/simple.html +4 -0
  338. package/templates/layout/wiki_base.html +16 -0
  339. package/templates/main.html +22 -0
  340. package/templates/manage_base.html +24 -0
  341. package/templates/manage_config.html +6 -0
  342. package/templates/manage_dashboard.html +27 -0
  343. package/templates/manage_script.html +56 -0
  344. package/templates/manage_setting.html +6 -0
  345. package/templates/manage_user_import.html +23 -0
  346. package/templates/manage_user_priv.html +76 -0
  347. package/templates/partials/category.html +19 -0
  348. package/templates/partials/contest.html +3 -0
  349. package/templates/partials/contest_balloon.html +37 -0
  350. package/templates/partials/contest_sidebar.html +150 -0
  351. package/templates/partials/contest_sidebar_management.html +56 -0
  352. package/templates/partials/contest_user.html +19 -0
  353. package/templates/partials/discussion_edit_form.html +45 -0
  354. package/templates/partials/discussion_list.html +50 -0
  355. package/templates/partials/discussion_nodes_widget.html +17 -0
  356. package/templates/partials/files.html +49 -0
  357. package/templates/partials/footer.html +108 -0
  358. package/templates/partials/hamburger.html +7 -0
  359. package/templates/partials/header_mobile.html +12 -0
  360. package/templates/partials/homepage/bulletin.html +7 -0
  361. package/templates/partials/homepage/contest.html +48 -0
  362. package/templates/partials/homepage/discussion.html +13 -0
  363. package/templates/partials/homepage/discussion_nodes.html +4 -0
  364. package/templates/partials/homepage/error.html +5 -0
  365. package/templates/partials/homepage/hitokoto.html +6 -0
  366. package/templates/partials/homepage/homework.html +45 -0
  367. package/templates/partials/homepage/problem_search.html +13 -0
  368. package/templates/partials/homepage/ranking.html +39 -0
  369. package/templates/partials/homepage/recent_problems.html +17 -0
  370. package/templates/partials/homepage/starred_problems.html +15 -0
  371. package/templates/partials/homepage/suggestion.html +34 -0
  372. package/templates/partials/homepage/training.html +50 -0
  373. package/templates/partials/homework.html +3 -0
  374. package/templates/partials/homework_default_penalty_rules.yaml +6 -0
  375. package/templates/partials/homework_sidebar.html +93 -0
  376. package/templates/partials/login_dialog.html +56 -0
  377. package/templates/partials/manage_user_priv.html +78 -0
  378. package/templates/partials/nav.html +138 -0
  379. package/templates/partials/problem-sidebar-information.html +25 -0
  380. package/templates/partials/problem.html +2 -0
  381. package/templates/partials/problem_category_dialog.html +43 -0
  382. package/templates/partials/problem_default.md +26 -0
  383. package/templates/partials/problem_description.html +33 -0
  384. package/templates/partials/problem_files.html +63 -0
  385. package/templates/partials/problem_list.html +68 -0
  386. package/templates/partials/problem_lucky.html +10 -0
  387. package/templates/partials/problem_sidebar.html +14 -0
  388. package/templates/partials/problem_sidebar_contest.html +43 -0
  389. package/templates/partials/problem_sidebar_homework.html +42 -0
  390. package/templates/partials/problem_sidebar_normal.html +152 -0
  391. package/templates/partials/problem_stat.html +3 -0
  392. package/templates/partials/scoreboard.html +79 -0
  393. package/templates/partials/setting.html +92 -0
  394. package/templates/partials/training_default.json +14 -0
  395. package/templates/partials/training_detail.html +153 -0
  396. package/templates/partials/user.html +2 -0
  397. package/templates/partials/user_detail/activity.html +18 -0
  398. package/templates/partials/user_detail/solution.html +29 -0
  399. package/templates/problem_config.html +39 -0
  400. package/templates/problem_detail.html +150 -0
  401. package/templates/problem_edit.html +111 -0
  402. package/templates/problem_files.html +91 -0
  403. package/templates/problem_hack.html +41 -0
  404. package/templates/problem_import.html +58 -0
  405. package/templates/problem_main.html +100 -0
  406. package/templates/problem_solution.html +55 -0
  407. package/templates/problem_statistics.html +96 -0
  408. package/templates/problem_submit.html +40 -0
  409. package/templates/ranking.html +81 -0
  410. package/templates/record_detail.html +134 -0
  411. package/templates/record_detail_status.html +93 -0
  412. package/templates/record_detail_summary.html +19 -0
  413. package/templates/record_main.html +142 -0
  414. package/templates/record_main_tr.html +35 -0
  415. package/templates/status.html +75 -0
  416. package/templates/training_detail.html +120 -0
  417. package/templates/training_edit.html +68 -0
  418. package/templates/training_files.html +64 -0
  419. package/templates/training_main.html +107 -0
  420. package/templates/user_changemail_mail.html +6 -0
  421. package/templates/user_changemail_mail_sent.html +9 -0
  422. package/templates/user_delete_pending.html +10 -0
  423. package/templates/user_detail.html +181 -0
  424. package/templates/user_login.html +46 -0
  425. package/templates/user_logout.html +13 -0
  426. package/templates/user_lostpass.html +27 -0
  427. package/templates/user_lostpass_mail.html +6 -0
  428. package/templates/user_lostpass_mail_sent.html +9 -0
  429. package/templates/user_lostpass_with_code.html +29 -0
  430. package/templates/user_register.html +22 -0
  431. package/templates/user_register_mail.html +6 -0
  432. package/templates/user_register_mail_sent.html +9 -0
  433. package/templates/user_register_with_code.html +35 -0
  434. package/templates/user_sudo.html +54 -0
  435. package/templates/user_sudo_redirect.html +18 -0
  436. package/templates/wiki_help.html +189 -0
  437. package/theme/bp6-compat.css +48 -0
  438. package/theme/dark.styl +397 -0
  439. package/theme/default.js +33 -0
  440. package/typed.d.ts +20 -0
  441. package/utils/base.ts +209 -0
  442. package/utils/base64.js +104 -0
  443. package/utils/db.ts +32 -0
  444. package/utils/index.ts +73 -0
  445. package/utils/loadReactRedux.ts +32 -0
  446. package/utils/mediaQuery.ts +13 -0
  447. package/utils/pjax.js +148 -0
  448. package/utils/slide.ts +57 -0
@@ -0,0 +1,170 @@
1
+ import type { ProblemConfigFile, TestCaseConfig } from 'hydrooj/src/interface';
2
+ import { diffLines } from 'diff';
3
+ import $ from 'jquery';
4
+ import yaml from 'js-yaml';
5
+ import { isEqual } from 'lodash';
6
+ import type { editor } from 'monaco-editor';
7
+ import React from 'react';
8
+ import { connect } from 'react-redux';
9
+ import Editor from 'vj/components/editor';
10
+ import { load } from 'vj/components/monaco/loader';
11
+
12
+ const mapStateToProps = (state) => ({
13
+ config: state.config,
14
+ });
15
+ const mapDispatchToProps = (dispatch) => ({
16
+ handleUpdateCode: (code) => {
17
+ dispatch({
18
+ type: 'CONFIG_CODE_UPDATE',
19
+ payload: code,
20
+ });
21
+ },
22
+ });
23
+
24
+ interface Props {
25
+ config: any;
26
+ handleUpdateCode: (val: string) => void;
27
+ }
28
+
29
+ const configKey = [
30
+ 'type', 'subType', 'target', 'score', 'time',
31
+ 'memory', 'filename', 'checker_type', 'checker', 'interactor',
32
+ 'manager', 'num_processes', 'multi_pass', 'validator', 'user_extra_files',
33
+ 'judge_extra_files', 'detail', 'outputs', 'redirect', 'cases',
34
+ 'subtasks', 'langs', 'key', 'time_limit_rate', 'memory_limit_rate',
35
+ ];
36
+
37
+ const subtasksKey = [
38
+ 'time', 'memory', 'score', 'if', 'id',
39
+ 'type', 'cases',
40
+ ];
41
+
42
+ const casesKey = ['time', 'memory', 'input', 'output'];
43
+
44
+ export function configYamlFormat(config: ProblemConfigFile) {
45
+ const formatConfig: ProblemConfigFile = {};
46
+ configKey.forEach((key) => {
47
+ if (config[key] !== undefined) {
48
+ if (key === 'subType' && ['single', 'multi'].includes(config[key]) && config.type !== 'submit_answer') return;
49
+ if (key === 'checker_type' && config.type !== 'default') return;
50
+ if (key === 'checker'
51
+ && (['default', 'strict'].includes(formatConfig.checker_type) || !formatConfig.checker_type)) return;
52
+ if (key === 'interactor' && config.type !== 'interactive') return;
53
+ if (key === 'multi_pass' && (!Number.isInteger(config.multi_pass) || config.multi_pass <= 1 || config.multi_pass > 20)) return;
54
+ if (key === 'subtasks') {
55
+ formatConfig[key] = [];
56
+ config[key].forEach((subtask) => {
57
+ const formatSubtask: object = {};
58
+ subtasksKey.forEach((subtaskKey) => {
59
+ if (subtask && subtask[subtaskKey] !== undefined) {
60
+ formatSubtask[subtaskKey] = subtask[subtaskKey];
61
+ }
62
+ });
63
+ formatConfig[key].push(formatSubtask);
64
+ });
65
+ } else if (key === 'cases') {
66
+ formatConfig[key] = [];
67
+ config[key].forEach((caseItem) => {
68
+ const formatCase: TestCaseConfig = {
69
+ time: '1000ms', memory: '256MB', input: '', output: '',
70
+ };
71
+ casesKey.forEach((caseKey) => {
72
+ if (caseItem[caseKey] !== undefined) formatCase[caseKey] = caseItem[caseKey];
73
+ else delete formatCase[caseKey];
74
+ });
75
+ formatConfig[key].push(formatCase);
76
+ });
77
+ } else formatConfig[key] = config[key];
78
+ }
79
+ });
80
+ if (formatConfig.type === 'objective') {
81
+ Object.keys(formatConfig).filter((i) => !['type', 'answers'].includes(i)).forEach((i) => delete formatConfig[i]);
82
+ formatConfig.answers = config.answers || {};
83
+ }
84
+ Object.keys(formatConfig).filter((i) => i.startsWith('__')).forEach((i) => delete formatConfig[i]);
85
+ return formatConfig;
86
+ }
87
+
88
+ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor extends React.PureComponent<Props> {
89
+ disposable = [];
90
+ containerElement: HTMLElement;
91
+ __preventUpdate = false;
92
+ __preventFormat = false;
93
+
94
+ editor: editor.IStandaloneCodeEditor;
95
+ model: editor.ITextModel;
96
+ vjEditor: Editor;
97
+
98
+ async componentDidMount() {
99
+ const { monaco } = await load(['yaml']);
100
+ const uri = monaco.Uri.parse('hydro://problem/file/config.yaml');
101
+ this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config), { noArrayIndent: true }), 'yaml', uri);
102
+ this.vjEditor = Editor.getOrConstruct($(this.containerElement), {
103
+ language: 'yaml',
104
+ model: this.model,
105
+ lineNumbers: 'off',
106
+ onChange: (value: string) => {
107
+ this.__preventUpdate = true;
108
+ if (!this.__preventFormat) this.props.handleUpdateCode(value);
109
+ this.__preventUpdate = false;
110
+ },
111
+ }) as Editor;
112
+ this.editor = this.vjEditor.editor;
113
+ }
114
+
115
+ componentDidUpdate(prevProps) {
116
+ if (this.__preventUpdate || !this.model || !this.props.config.__valid) return;
117
+ if (yaml.dump(prevProps.config, { noArrayIndent: true }) === yaml.dump(this.props.config, { noArrayIndent: true })) return;
118
+ const curValue = this.model.getValue();
119
+ const pending = configYamlFormat(this.props.config);
120
+ try {
121
+ const curConfig = yaml.load(curValue);
122
+ if (isEqual(curConfig, pending)) return;
123
+ } catch { }
124
+ this.__preventFormat = true;
125
+ const diff = diffLines(curValue, yaml.dump(pending, { noArrayIndent: true }));
126
+ const ops = [];
127
+ let cursor = 1;
128
+ for (const line of diff) {
129
+ if (line.added) {
130
+ let range = this.model.getFullModelRange();
131
+ range = range.setStartPosition(cursor, 0);
132
+ range = range.setEndPosition(cursor, 0);
133
+ ops.push({ range, text: line.value });
134
+ } else if (line.removed) {
135
+ let range = this.model.getFullModelRange();
136
+ range = range.setStartPosition(cursor, 0);
137
+ cursor += line.count;
138
+ range = range.setEndPosition(cursor, 0);
139
+ ops.push({ range, text: '' });
140
+ } else cursor += line.count;
141
+ }
142
+ this.model.pushEditOperations([], ops, undefined);
143
+ this.__preventFormat = false;
144
+ }
145
+
146
+ componentWillUnmount() {
147
+ if (this.vjEditor) this.vjEditor.destroy();
148
+ if (this.model) this.model.dispose();
149
+ if (this.editor) this.editor.dispose();
150
+ this.disposable.map((i) => i.dispose());
151
+ }
152
+
153
+ assignRef = (component) => {
154
+ this.containerElement = component;
155
+ };
156
+
157
+ render() {
158
+ return (
159
+ <div
160
+ ref={this.assignRef}
161
+ style={{
162
+ minHeight: '500px',
163
+ height: '100%',
164
+ width: '100%',
165
+ }}
166
+ className="ConfigMonacoEditor"
167
+ />
168
+ );
169
+ }
170
+ });
@@ -0,0 +1,140 @@
1
+ import { Card, Switch, Text, TextInput } from '@mantine/core';
2
+ import { isEqual } from 'lodash';
3
+ import React, { useState } from 'react';
4
+ import { useDispatch, useSelector } from 'react-redux';
5
+ import { i18n } from 'vj/utils';
6
+ import FileSelectAutoComplete from '../autocomplete/components/FileSelectAutoComplete';
7
+ import LanguageSelectAutoComplete from '../autocomplete/components/LanguageSelectAutoComplete';
8
+ import { FormItem } from './BasicForm';
9
+ import ProblemType from './ProblemType';
10
+ import type { RootState } from './reducer/index';
11
+
12
+ function FileIOConfig() {
13
+ const filename = useSelector((state: RootState) => state.config.filename);
14
+ const dispatch = useDispatch();
15
+ return (
16
+ <FormItem columns={6} label="FileIOConfig" disableLabel>
17
+ <Card withBorder style={{ padding: 10, overflow: 'visible' }}>
18
+ <div className="row">
19
+ <FormItem columns={12} label="FileIO">
20
+ <TextInput
21
+ rightSection={<Text size="sm">.in/.out</Text>}
22
+ rightSectionWidth={100}
23
+ rightSectionPointerEvents="none"
24
+ value={filename || ''}
25
+ onChange={(ev) => {
26
+ dispatch({ type: 'problemconfig/updateFileIO', filename: ev.currentTarget.value });
27
+ }}
28
+ style={{ width: '100%' }}
29
+ />
30
+ </FormItem>
31
+ </div>
32
+ </Card>
33
+ </FormItem>
34
+ );
35
+ }
36
+
37
+ function MultiPassConfig() {
38
+ const multiPass = useSelector((state: RootState) => state.config.multi_pass);
39
+ const dispatch = useDispatch();
40
+ const [enabled, setEnabled] = useState(multiPass > 1);
41
+ return (
42
+ <FormItem columns={6} label="Multi-pass" disableLabel>
43
+ <Card withBorder style={{ padding: 10, overflow: 'visible' }}>
44
+ <div className="row">
45
+ <FormItem columns={6} label="Multi Pass">
46
+ <Switch
47
+ styles={{ body: { display: 'flex', height: '36px', alignItems: 'center' } }}
48
+ checked={enabled}
49
+ label={i18n('Enabled')}
50
+ onChange={() => {
51
+ setEnabled(!enabled);
52
+ dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'multi_pass', value: enabled ? 0 : 2 });
53
+ }}
54
+ />
55
+ </FormItem>
56
+ {enabled && (
57
+ <FormItem columns={6} label={i18n('Max Passes')}>
58
+ <TextInput
59
+ type="number"
60
+ min={2}
61
+ max={10}
62
+ value={multiPass}
63
+ onChange={(ev) => dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'multi_pass', value: +ev.currentTarget.value })}
64
+ />
65
+ </FormItem>
66
+ )}
67
+ </div>
68
+ </Card>
69
+ </FormItem>
70
+ );
71
+ }
72
+
73
+ function ExtraFilesConfig() {
74
+ const Files = useSelector((state: RootState) => state.testdata);
75
+ const userExtraFiles = useSelector((state: RootState) => state.config.user_extra_files || [], isEqual);
76
+ const judgeExtraFiles = useSelector((state: RootState) => state.config.judge_extra_files || [], isEqual);
77
+ const dispatch = useDispatch();
78
+ return (
79
+ <FormItem columns={12} label="ExtraFilesConfig" disableLabel>
80
+ <Card withBorder style={{ padding: 10, overflow: 'visible' }}>
81
+ <div className="row">
82
+ <FormItem columns={12} label={i18n('user_extra_files')}>
83
+ <FileSelectAutoComplete
84
+ data={Files}
85
+ selectedKeys={userExtraFiles}
86
+ onChange={(val) => dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'user_extra_files', value: val.split(',') })}
87
+ multi
88
+ />
89
+ </FormItem>
90
+ <FormItem columns={12} label={i18n('judge_extra_files')}>
91
+ <FileSelectAutoComplete
92
+ data={Files}
93
+ selectedKeys={judgeExtraFiles}
94
+ onChange={(val) => dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'judge_extra_files', value: val.split(',') })}
95
+ multi
96
+ />
97
+ </FormItem>
98
+ </div>
99
+ </Card>
100
+ </FormItem>
101
+ );
102
+ }
103
+
104
+ function LangConfig() {
105
+ const langs = useSelector((state: RootState) => state.config.langs) || [];
106
+ const dispatch = useDispatch();
107
+ return (
108
+ <FormItem columns={12} label="langs" disableLabel>
109
+ <Card withBorder style={{ padding: 10, overflow: 'visible' }}>
110
+ <div className="row">
111
+ <FormItem columns={12} label="langs">
112
+ <LanguageSelectAutoComplete
113
+ placeholder={!langs.length ? i18n('Unlimited') : i18n('Code language')}
114
+ selectedKeys={langs}
115
+ onChange={(value) => dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'langs', value: value.split(',') })}
116
+ multi
117
+ />
118
+ </FormItem>
119
+ </div>
120
+ </Card>
121
+ </FormItem>
122
+ );
123
+ }
124
+
125
+ export default function ProblemConfigForm() {
126
+ const Type = useSelector((state: RootState) => state.config.type);
127
+ return (
128
+ <div className="row problem-config-form">
129
+ <ProblemType />
130
+ {Type === 'default' && <FileIOConfig />}
131
+ {['default', 'interactive'].includes(Type) && <MultiPassConfig />}
132
+ {!['submit_answer', 'objective'].includes(Type) && (
133
+ <>
134
+ <ExtraFilesConfig />
135
+ <LangConfig />
136
+ </>
137
+ )}
138
+ </div>
139
+ );
140
+ }
@@ -0,0 +1,163 @@
1
+ import { normalizeSubtasks, readSubtasksFromFiles } from '@hydrooj/common';
2
+ import { TestCaseConfig } from 'hydrooj';
3
+ import { Button, Text, Tree } from '@mantine/core';
4
+ import { isEqual } from 'lodash';
5
+ import React from 'react';
6
+ import { DndProvider, useDrop } from 'react-dnd';
7
+ import { HTML5Backend } from 'react-dnd-html5-backend';
8
+ import { useDispatch, useSelector, useStore } from 'react-redux';
9
+ import { confirm } from 'vj/components/dialog/index';
10
+ import { i18n } from 'vj/utils';
11
+ import { RootState } from './reducer';
12
+ import { AddTestcase } from './tree/AddTestcase';
13
+ import { SelectionManager } from './tree/SelectionManager';
14
+ import { GlobalSettings, SubtaskSettings } from './tree/SubtaskSettings';
15
+
16
+ interface TestcasesDndItem {
17
+ cases: TestCaseConfig[];
18
+ subtaskId: number;
19
+ }
20
+
21
+ export function SubtaskNode(props: { subtaskId: number }) {
22
+ const { subtaskId } = props;
23
+ const subtaskIds = useSelector((s: RootState) => Object.values(s.config?.subtasks || []).map((i) => i.id), isEqual);
24
+ const cases = useSelector((state: RootState) => (subtaskId === -1
25
+ ? state.config.__cases
26
+ : state.config.subtasks.find((i) => i.id === subtaskId).cases || []));
27
+ const time = useSelector((s: RootState) => s.config?.time);
28
+ const memory = useSelector((s: RootState) => s.config?.memory);
29
+ const dispatch = useDispatch();
30
+ const [expand, setExpand] = React.useState(true);
31
+ const [, drop] = useDrop<TestcasesDndItem>(() => ({
32
+ accept: 'cases',
33
+ canDrop(item) {
34
+ return item.subtaskId !== subtaskId;
35
+ },
36
+ drop(item) {
37
+ dispatch({
38
+ type: 'problemconfig/moveTestcases',
39
+ payload: {
40
+ target: subtaskId,
41
+ source: item.subtaskId,
42
+ cases: item.cases,
43
+ },
44
+ });
45
+ },
46
+ }));
47
+
48
+ function deleteSubtask() {
49
+ dispatch({
50
+ type: 'problemconfig/deleteSubtask',
51
+ id: subtaskId,
52
+ });
53
+ }
54
+
55
+ return (
56
+ <div style={{ marginBottom: 8 }}>
57
+ {subtaskId !== -1 && (
58
+ <div style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }} onClick={() => setExpand((e) => !e)}>
59
+ <Text fw={600} style={{ marginRight: 8 }}>
60
+ {expand ? <i className="icon icon-expand_more" /> : <i className="icon icon-expand_less" />}
61
+ </Text>
62
+ <Text>{i18n('Subtask {0}', subtaskId)}</Text>
63
+ <Button
64
+ variant="subtle"
65
+ size="sm"
66
+ color="black"
67
+ style={{ marginLeft: 'auto' }}
68
+ onClick={(ev) => {
69
+ ev.stopPropagation();
70
+ confirm(i18n('Are you sure you want to delete this subtask?')).then((yes) => {
71
+ if (yes) deleteSubtask();
72
+ });
73
+ }}
74
+ >
75
+ <i className="icon icon-delete" />
76
+ </Button>
77
+ </div>
78
+ )}
79
+ <div ref={drop as any}>
80
+ {subtaskId !== -1 && expand && (
81
+ <SubtaskSettings subtaskId={subtaskId} subtaskIds={subtaskIds} time={time} memory={memory} />
82
+ )}
83
+ {expand
84
+ ? <SelectionManager subtaskId={subtaskId} subtaskIds={subtaskIds} />
85
+ : <div style={{ paddingLeft: 22 }}>
86
+ <Text>{cases.length} testcases.</Text>
87
+ </div>}
88
+ {!cases.length && (
89
+ <div style={{ paddingLeft: 22 }}>
90
+ <Text c="dimmed">{subtaskId === -1
91
+ ? i18n('No testcase here')
92
+ : i18n('Drag and drop testcases here:')}</Text>
93
+ </div>
94
+ )}
95
+ </div>
96
+ </div>
97
+ );
98
+ }
99
+
100
+ export function SubtaskConfigTree() {
101
+ const ids = useSelector((s: RootState) => Object.values(s.config?.subtasks || []).map((i) => i.id), isEqual);
102
+ const dispatch = useDispatch();
103
+ const store = useStore<RootState>();
104
+ const autoConfigure = React.useCallback(() => {
105
+ const state = store.getState();
106
+ const subtasks = readSubtasksFromFiles(state.testdata.map((t) => t.name), state.config);
107
+ const cases = subtasks.reduce((a, b) => a.concat(b.cases), []);
108
+ dispatch({
109
+ type: 'CONFIG_AUTOCASES_UPDATE',
110
+ subtasks: normalizeSubtasks(subtasks, (i) => i, state.config.time, state.config.memory, true),
111
+ });
112
+ dispatch({
113
+ type: 'problemconfig/delTestcases',
114
+ cases,
115
+ });
116
+ }, [dispatch, store]);
117
+ const rootNodes = React.useMemo<any[]>(() => [
118
+ { id: 'auto', label: i18n('Auto configure'), type: 'action' as const },
119
+ { id: 'global', label: i18n('Global settings'), type: 'global' as const },
120
+ ...ids.map((id) => ({ id: `sub-${id}`, label: i18n('Subtask {0}', id), type: 'subtask' as const, subtaskId: id })),
121
+ { id: 'add', label: i18n('Add new subtask'), type: 'add' as const },
122
+ ], [ids]);
123
+
124
+ return (
125
+ <Tree
126
+ data={rootNodes}
127
+ levelOffset={12}
128
+ renderNode={({ node }) => {
129
+ const n: any = node;
130
+ if (n.type === 'action') {
131
+ return <div style={{ padding: '6px 0' }} onClick={autoConfigure}>
132
+ <Text><i className="icon icon-settings" /> {i18n('Auto configure')}</Text>
133
+ </div>;
134
+ }
135
+ if (n.type === 'global') return <GlobalSettings />;
136
+ if (n.type === 'add') {
137
+ return <div style={{ padding: '6px 0' }} onClick={() => dispatch({ type: 'problemconfig/addSubtask' })}>
138
+ <Text><i className="icon icon-add" /> {i18n('Add new subtask')}</Text>
139
+ </div>;
140
+ }
141
+ return <SubtaskNode subtaskId={n.subtaskId} />;
142
+ }}
143
+ />
144
+ );
145
+ }
146
+
147
+ export function ProblemConfigTree() {
148
+ return (
149
+ <DndProvider backend={HTML5Backend} context={window}>
150
+ <div className="row">
151
+ <div className="medium-6 columns">
152
+ <SubtaskConfigTree />
153
+ </div>
154
+ <div className="medium-6 columns">
155
+ <div>
156
+ <AddTestcase />
157
+ <SubtaskNode subtaskId={-1} />
158
+ </div>
159
+ </div>
160
+ </div>
161
+ </DndProvider>
162
+ );
163
+ }
@@ -0,0 +1,165 @@
1
+ import { Card, SegmentedControl, Switch } from '@mantine/core';
2
+ import React, { useEffect } from 'react';
3
+ import { useDispatch, useSelector } from 'react-redux';
4
+ import { i18n } from 'vj/utils';
5
+ import { testlibCheckers } from '../monaco/schema/problemconfig';
6
+ import { FormItem, ManagedSelect, SingleFileSelect } from './BasicForm';
7
+ import type { RootState } from './reducer/index';
8
+
9
+ export default function ProblemType() {
10
+ const Type = useSelector((state: RootState) => state.config.type);
11
+ const checkerType = useSelector((state: RootState) => state.config.checker_type);
12
+ const filename = useSelector((state: RootState) => state.config.filename);
13
+ const numProcesses = useSelector((state: RootState) => state.config.num_processes);
14
+ const subType = useSelector((state: RootState) => state.config.subType);
15
+ const checker = useSelector((state: RootState) => state.config.checker);
16
+ const [category, setCategory] = React.useState('');
17
+ const dispatch = useDispatch();
18
+ const dispatcher = (base) => (value) => dispatch({ ...base, value });
19
+ useEffect(() => {
20
+ if (category || !checker) return;
21
+ const name = typeof checker === 'string' ? checker : checker.file;
22
+ if (name.includes('.')) setCategory('custom');
23
+ else setCategory('preset');
24
+ }, [checker]);
25
+ return (
26
+ <FormItem columns={12} label="" disableLabel>
27
+ <Card withBorder style={{ padding: 10, overflow: 'visible' }}>
28
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 3 }}>
29
+ <div>{i18n('Problem Type')}</div>
30
+ <SegmentedControl
31
+ value={Type}
32
+ onChange={dispatcher({ type: 'CONFIG_FORM_UPDATE', key: 'type' })}
33
+ data={[
34
+ { label: i18n('problem_type.default'), value: 'default' },
35
+ { label: i18n('problem_type.interactive'), value: 'interactive' },
36
+ { label: i18n('problem_type.communication'), value: 'communication' },
37
+ { label: i18n('problem_type.submit_answer'), value: 'submit_answer' },
38
+ { label: i18n('problem_type.objective'), value: 'objective' },
39
+ ]}
40
+ />
41
+ </div>
42
+
43
+ {['default', 'submit_answer'].includes(Type) && (
44
+ <>
45
+ <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: 3 }}>
46
+ <div>{i18n('CheckerType')}</div>
47
+ <SegmentedControl
48
+ value={(['strict', 'default'].includes(checkerType) || !checkerType)
49
+ ? 'default' : (checkerType !== 'testlib' ? 'other' : 'testlib')}
50
+ onChange={(value) => {
51
+ dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'checker_type', value });
52
+ if (value === 'testlib' && !category) setCategory('custom');
53
+ }}
54
+ data={[
55
+ { label: i18n('default'), value: 'default' },
56
+ { label: 'testlib', value: 'testlib' },
57
+ { label: 'other', value: 'other' },
58
+ ]}
59
+ />
60
+ </div>
61
+
62
+ {((['strict', 'default'].includes(checkerType) || !checkerType)) && (
63
+ <Switch
64
+ styles={{ body: { display: 'flex' } }}
65
+ checked={checkerType !== 'strict'}
66
+ label={i18n('Ignore trailing space and enter.')}
67
+ onChange={() => {
68
+ dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'checker_type', value: checkerType === 'strict' ? 'default' : 'strict' });
69
+ }}
70
+ />
71
+ )}
72
+
73
+ {(!['strict', 'default'].includes(checkerType) && checkerType && checkerType === 'testlib') && (
74
+ <div className="row">
75
+ <FormItem columns={4} label="Type">
76
+ <select
77
+ value={category}
78
+ onChange={(ev) => {
79
+ setCategory(ev.currentTarget.value);
80
+ dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'checker', value: ev.currentTarget.value === 'preset' ? 'acmp' : null });
81
+ }}
82
+ className="select"
83
+ >
84
+ <option value="preset">{i18n('Preset')}</option>
85
+ <option value="custom">{i18n('Custom')}</option>
86
+ </select>
87
+ </FormItem>
88
+ {category === 'preset'
89
+ ? <FormItem columns={8} label="Checker">
90
+ <select
91
+ value={typeof checker === 'string' ? checker : checker.file}
92
+ onChange={(ev) => dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'checker', value: ev.currentTarget.value })}
93
+ className="select"
94
+ >
95
+ {testlibCheckers.map((c) => (
96
+ <option key={c} value={c}>{c}</option>
97
+ ))}
98
+ </select>
99
+ </FormItem>
100
+ : <SingleFileSelect formKey="checker" label="Checker" withLang />}
101
+ </div>
102
+ )}
103
+
104
+ {(!['strict', 'default'].includes(checkerType) && checkerType && checkerType !== 'testlib') && (
105
+ <div className="row">
106
+ <FormItem columns={4} label="Interface">
107
+ <ManagedSelect options={['syzoj', 'hustoj', 'qduoj', 'lemon', 'kattis']} formKey="checker_type" />
108
+ </FormItem>
109
+ <SingleFileSelect formKey="checker" label="Checker" withLang />
110
+ </div>
111
+ )}
112
+ </>
113
+ )}
114
+
115
+ {Type === 'interactive' && (
116
+ <div className="row">
117
+ <SingleFileSelect formKey="interactor" label="Interactor" withLang />
118
+ </div>
119
+ )}
120
+
121
+ {Type === 'communication' && (
122
+ <div className="row">
123
+ <SingleFileSelect formKey="manager" label="Manager" withLang />
124
+ <FormItem columns={4} label="Number of Processes">
125
+ <input
126
+ defaultValue={numProcesses || 2}
127
+ placeholder="2"
128
+ onChange={(ev) => dispatch(({ type: 'CONFIG_FORM_UPDATE', key: 'num_processes', value: +ev.currentTarget.value }))}
129
+ className="textbox"
130
+ />
131
+ </FormItem>
132
+ </div>
133
+ )}
134
+
135
+ {Type === 'submit_answer' && (
136
+ <div className="row">
137
+ <FormItem columns={6} label="Config" disableLabel>
138
+ <Switch
139
+ checked={subType === 'multi'}
140
+ styles={{ body: { display: 'flex' } }}
141
+ label={i18n('Multi-file')}
142
+ onChange={() => {
143
+ dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'subType', value: subType === 'multi' ? 'single' : 'multi' });
144
+ }}
145
+ />
146
+ </FormItem>
147
+ <FormItem columns={6} label="Filename">
148
+ <input
149
+ defaultValue={filename || '#.txt'}
150
+ placeholder="#.txt"
151
+ disabled={subType !== 'multi'}
152
+ onChange={(ev) => dispatch(({ type: 'CONFIG_FORM_UPDATE', key: 'filename', value: ev.currentTarget.value }))}
153
+ className="textbox"
154
+ />
155
+ </FormItem>
156
+ </div>
157
+ )}
158
+
159
+ {Type === 'objective' && (
160
+ <p>{i18n('Unsupported configure this type of problem. Please refer to the documentation.')}</p>
161
+ )}
162
+ </Card>
163
+ </FormItem>
164
+ );
165
+ }