wrong-notebook 2026.10.30-3 → 2026.10.30-4

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 (265) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +2 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/routes-manifest.json +12 -0
  6. package/.next/server/app/_global-error.html +1 -1
  7. package/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  12. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  13. package/.next/server/app/admin/page.js.nft.json +1 -1
  14. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
  16. package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
  17. package/.next/server/app/api/admin/dashboard/route.js +9 -9
  18. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  19. package/.next/server/app/api/admin/users/[id]/detail/route.js +9 -9
  20. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  21. package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
  22. package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  23. package/.next/server/app/api/ai/models/route.js +9 -9
  24. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  25. package/.next/server/app/api/ai/test/route.js +11 -11
  26. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  27. package/.next/server/app/api/analytics/route.js +10 -10
  28. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  29. package/.next/server/app/api/analyze/route.js +11 -11
  30. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  31. package/.next/server/app/api/error-items/[id]/figure/route.js +9 -9
  32. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  33. package/.next/server/app/api/error-items/[id]/fix-latex/route.js +10 -10
  34. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  35. package/.next/server/app/api/error-items/[id]/geogebra/route.js +11 -11
  36. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  37. package/.next/server/app/api/error-items/[id]/reanswer/route.js +9 -9
  38. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  39. package/.next/server/app/api/error-items/[id]/retag/route.js +12 -12
  40. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  41. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +9 -9
  42. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
  43. package/.next/server/app/api/error-items/[id]/svg-animation/route.js +9 -9
  44. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  45. package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
  46. package/.next/server/app/api/error-items/route.js +9 -9
  47. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  48. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +11 -11
  49. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  50. package/.next/server/app/api/exams/[id]/results/route.js +9 -9
  51. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  52. package/.next/server/app/api/exams/[id]/retry/route.js +7 -7
  53. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  54. package/.next/server/app/api/exams/[id]/route.js +7 -7
  55. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  56. package/.next/server/app/api/exams/route.js +12 -12
  57. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  58. package/.next/server/app/api/export/route.js.nft.json +1 -1
  59. package/.next/server/app/api/geogebra-analyze/route.js +11 -11
  60. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  61. package/.next/server/app/api/import/route.js +9 -9
  62. package/.next/server/app/api/import/route.js.nft.json +1 -1
  63. package/.next/server/app/api/minimax-code/checkin/route.js +2 -2
  64. package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
  65. package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
  66. package/.next/server/app/api/minimax-code/route.js +2 -2
  67. package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
  68. package/.next/server/app/api/notebooks/[id]/retag/route.js +7 -7
  69. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  70. package/.next/server/app/api/openclaw/batch-upload/route.js +7 -7
  71. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  72. package/.next/server/app/api/practice/generate/route.js +10 -10
  73. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  74. package/.next/server/app/api/practice/grade/route.js +9 -9
  75. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  76. package/.next/server/app/api/practice/record/[id]/route.js +10 -10
  77. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  78. package/.next/server/app/api/practice/record/route.js +9 -9
  79. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  80. package/.next/server/app/api/reanswer/route.js +8 -8
  81. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  82. package/.next/server/app/api/register/route.js +2 -2
  83. package/.next/server/app/api/register/route.js.nft.json +1 -1
  84. package/.next/server/app/api/register/status/route.js +2 -2
  85. package/.next/server/app/api/register/status/route.js.nft.json +1 -1
  86. package/.next/server/app/api/review/due/route.js +8 -8
  87. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  88. package/.next/server/app/api/settings/route.js +4 -4
  89. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  90. package/.next/server/app/api/setup/route.js +1 -1
  91. package/.next/server/app/api/setup/route.js.nft.json +1 -1
  92. package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
  93. package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
  94. package/.next/server/app/api/tts/batch/route/app-paths-manifest.json +3 -0
  95. package/.next/server/app/api/tts/batch/route/build-manifest.json +12 -0
  96. package/.next/server/app/api/tts/batch/route/server-reference-manifest.json +4 -0
  97. package/.next/server/app/api/tts/batch/route.js +17 -0
  98. package/.next/server/app/api/tts/batch/route.js.map +5 -0
  99. package/.next/server/app/api/tts/batch/route.js.nft.json +1 -0
  100. package/.next/server/app/api/tts/batch/route_client-reference-manifest.js +3 -0
  101. package/.next/server/app/api/tts/route.js +8 -7
  102. package/.next/server/app/api/tts/route.js.nft.json +1 -1
  103. package/.next/server/app/api/tts/status/route/app-paths-manifest.json +3 -0
  104. package/.next/server/app/api/tts/status/route/build-manifest.json +12 -0
  105. package/.next/server/app/api/tts/status/route/server-reference-manifest.json +4 -0
  106. package/.next/server/app/api/tts/status/route.js +16 -0
  107. package/.next/server/app/api/tts/status/route.js.map +5 -0
  108. package/.next/server/app/api/tts/status/route.js.nft.json +1 -0
  109. package/.next/server/app/api/tts/status/route_client-reference-manifest.js +3 -0
  110. package/.next/server/app/api/user/route.js +11 -11
  111. package/.next/server/app/api/user/route.js.nft.json +1 -1
  112. package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
  113. package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
  114. package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
  115. package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
  116. package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
  117. package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
  118. package/.next/server/app/exams/page.js.nft.json +1 -1
  119. package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
  120. package/.next/server/app/login/page.js.nft.json +1 -1
  121. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  122. package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
  123. package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
  124. package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
  125. package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
  126. package/.next/server/app/notebooks/page.js.nft.json +1 -1
  127. package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
  128. package/.next/server/app/page.js.nft.json +1 -1
  129. package/.next/server/app/page_client-reference-manifest.js +1 -1
  130. package/.next/server/app/practice/page.js.nft.json +1 -1
  131. package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
  132. package/.next/server/app/print-preview/page.js.nft.json +1 -1
  133. package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
  134. package/.next/server/app/register/page.js.nft.json +1 -1
  135. package/.next/server/app/register/page_client-reference-manifest.js +1 -1
  136. package/.next/server/app/review/page.js.nft.json +1 -1
  137. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  138. package/.next/server/app/setup/page.js.nft.json +1 -1
  139. package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  140. package/.next/server/app/stats/page.js.nft.json +1 -1
  141. package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/tags/page.js.nft.json +1 -1
  143. package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
  144. package/.next/server/app-paths-manifest.json +2 -0
  145. package/.next/server/chunks/[root-of-the-server]__003ii50e63ws5._.js +1 -1
  146. package/.next/server/chunks/[root-of-the-server]__02bjw2uriv5fd._.js +3 -0
  147. package/.next/server/chunks/[root-of-the-server]__03ru8t856rgvl._.js +3 -0
  148. package/.next/server/chunks/[root-of-the-server]__06j_-j4ftb5db._.js +3 -0
  149. package/.next/server/chunks/[root-of-the-server]__0duevucfb62_h._.js +3 -0
  150. package/.next/server/chunks/[root-of-the-server]__0gvvuk0avtpy9._.js +3 -3
  151. package/.next/server/chunks/[root-of-the-server]__0iq2agc-dlcyc._.js +3 -0
  152. package/.next/server/chunks/{[root-of-the-server]__0a-iuqynn3h9d._.js → [root-of-the-server]__0lgsw0kfw-jqc._.js} +1 -1
  153. package/.next/server/chunks/[root-of-the-server]__0orbb3gvf9h5l._.js +1 -1
  154. package/.next/server/chunks/[root-of-the-server]__0rt84iswe-353._.js +3 -3
  155. package/.next/server/chunks/[root-of-the-server]__0uvuljzm78r8b._.js +3 -0
  156. package/.next/server/chunks/[root-of-the-server]__1-jk6umz3qs6r._.js +3 -0
  157. package/.next/server/chunks/[root-of-the-server]__10ffg2l-u0zof._.js +3 -0
  158. package/.next/server/chunks/[root-of-the-server]__1_fxjdqa7fwwc._.js +3 -0
  159. package/.next/server/chunks/[root-of-the-server]__1g038brpx-jta._.js +3 -0
  160. package/.next/server/chunks/[root-of-the-server]__1gx-b_vxyk--4._.js +1 -1
  161. package/.next/server/chunks/[root-of-the-server]__1ixfwffo1gqy1._.js +3 -0
  162. package/.next/server/chunks/[root-of-the-server]__1jcp2-lix6if6._.js +3 -0
  163. package/.next/server/chunks/[root-of-the-server]__1kff0rbt3ym95._.js +3 -0
  164. package/.next/server/chunks/[root-of-the-server]__1n2uvss8wfueo._.js +3 -0
  165. package/.next/server/chunks/[root-of-the-server]__1nsrbw9jntgo8._.js +1 -1
  166. package/.next/server/chunks/[root-of-the-server]__1onv3pfwsqytl._.js +3 -0
  167. package/.next/server/chunks/[root-of-the-server]__1q9pzdlt18lp0._.js +1 -1
  168. package/.next/server/chunks/[root-of-the-server]__1uz66pjshld-e._.js +3 -0
  169. package/.next/server/chunks/_076-jjzrfdsdk._.js +1 -1
  170. package/.next/server/chunks/_09o9zamz75n5d._.js +1 -1
  171. package/.next/server/chunks/{_0t4hmii1np2ho._.js → _0a7_sds_l6vgw._.js} +3 -3
  172. package/.next/server/chunks/{_1oy0tspjrakxd._.js → _0b7ljlcl6h_ro._.js} +3 -3
  173. package/.next/server/chunks/_0gxi3zrkhyvx_._.js +1 -1
  174. package/.next/server/chunks/_0hk9z9rqga4x-._.js +3 -0
  175. package/.next/server/chunks/_0lob14xk0ko5z._.js +1 -1
  176. package/.next/server/chunks/_0p-sas2zxy3iv._.js +3 -0
  177. package/.next/server/chunks/_0z0zrluul2idw._.js +1 -1
  178. package/.next/server/chunks/_11_p1ahjjply_._.js +1 -1
  179. package/.next/server/chunks/_13ffmxv8qrwi0._.js +1 -1
  180. package/.next/server/chunks/_16jdov0rxh99d._.js +1 -1
  181. package/.next/server/chunks/_1a1udq0c4_6ad._.js +1 -1
  182. package/.next/server/chunks/_1ahi8466v1b3l._.js +1 -1
  183. package/.next/server/chunks/_1b7qjlv0nxovi._.js +1 -1
  184. package/.next/server/chunks/_1e8w9uuebtrcb._.js +1 -1
  185. package/.next/server/chunks/_1hp9mnz19v199._.js +1 -1
  186. package/.next/server/chunks/_1m-yyz-pl9-03._.js +1 -1
  187. package/.next/server/chunks/_next-internal_server_app_api_tts_batch_route_actions_1jmuawkcgxmae.js +3 -0
  188. package/.next/server/chunks/_next-internal_server_app_api_tts_status_route_actions_1udk0hbf96zdl.js +3 -0
  189. package/.next/server/chunks/src_lib_1csf8_0vpeenu._.js +3 -0
  190. package/.next/server/chunks/src_lib_1mno8g5cqmaet._.js +1 -1
  191. package/.next/server/chunks/src_lib_1p0k3ud1vrwmg._.js +3 -0
  192. package/.next/server/chunks/src_lib_1qy5aajgog9r2._.js +1 -1
  193. package/.next/server/chunks/src_lib_auth-utils_ts_20i7biv4dj8pm._.js +1 -1
  194. package/.next/server/chunks/src_lib_minimax-code_checkin_ts_1j1mpuxc1vgoz._.js +1 -1
  195. package/.next/server/chunks/src_lib_tts_19zri-v8-l_4u._.js +6 -6
  196. package/.next/server/chunks/ssr/[root-of-the-server]__0x_ihemma9171._.js +3 -0
  197. package/.next/server/chunks/ssr/_00np6xqvkg6u-._.js +1 -1
  198. package/.next/server/chunks/ssr/_08fq-uch-l1g6._.js +1 -1
  199. package/.next/server/chunks/ssr/_0n_xmfdlu07f9._.js +3 -0
  200. package/.next/server/chunks/ssr/_0xyykn-ar3ujn._.js +3 -0
  201. package/.next/server/chunks/ssr/_17edi6l2a0p76._.js +1 -1
  202. package/.next/server/chunks/ssr/_20-x85_onge5x._.js +3 -0
  203. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_play_0upz8-7p5gttr.js +4 -0
  204. package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
  205. package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
  206. package/.next/server/chunks/ssr/src_app_exams_[id]_page_tsx_0xcjflkgkwzgd._.js +1 -1
  207. package/.next/server/chunks/ssr/src_app_exams_[id]_print_page_tsx_1i-xvhk8ul1l1._.js +1 -1
  208. package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
  209. package/.next/server/chunks/ssr/src_components_difficulty-stars_tsx_1af9qqfurq7_t._.js +1 -1
  210. package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +1 -1
  211. package/.next/server/middleware-build-manifest.js +3 -3
  212. package/.next/server/middleware-manifest.json +5 -5
  213. package/.next/server/pages/500.html +1 -1
  214. package/.next/server/preview-props.json +3 -3
  215. package/.next/server/server-reference-manifest.js +1 -1
  216. package/.next/server/server-reference-manifest.json +1 -1
  217. package/.next/static/chunks/00n2-r3ac3dh5.js +2 -0
  218. package/.next/static/chunks/0kh-fx3tssh5w.js +1 -0
  219. package/.next/static/chunks/0p2fh98qaki45.js +1 -0
  220. package/.next/static/chunks/{314x1g250-zss.js → 1c46asvnosb8-.js} +1 -1
  221. package/.next/static/chunks/1cdwoh8b2ub-t.js +1 -0
  222. package/.next/static/chunks/1epmdj8kqwbz4.js +1 -0
  223. package/.next/static/chunks/1l46v858ieavc.js +1 -0
  224. package/.next/static/chunks/1r7yfcltcmwkh.js +1 -0
  225. package/.next/static/chunks/24gum0cmhhv7z.js +1 -0
  226. package/.next/static/chunks/26qq8907b9j3d.js +1 -0
  227. package/.next/static/chunks/2cf27aonkij9_.css +3 -0
  228. package/.next/static/chunks/2ctc1xbp8lz8e.js +191 -0
  229. package/.next/static/chunks/{2rgflf9-3s4ud.js → 2fr8ktozrvacg.js} +1 -1
  230. package/.next/static/chunks/{0oe2-jjx_8ol-.js → 2mawf08h1jfc8.js} +1 -1
  231. package/.next/static/chunks/2uobd1ff4vknn.js +33 -0
  232. package/.next/static/chunks/341etzsqr_b1v.js +6 -0
  233. package/package.json +1 -1
  234. package/prisma/seed.db +0 -0
  235. package/.next/server/chunks/[root-of-the-server]__0ergl3gmxvrz3._.js +0 -3
  236. package/.next/server/chunks/[root-of-the-server]__0lqng_pqv30ts._.js +0 -3
  237. package/.next/server/chunks/[root-of-the-server]__0ozf21hrh_433._.js +0 -3
  238. package/.next/server/chunks/[root-of-the-server]__0s0eusp3mojnx._.js +0 -3
  239. package/.next/server/chunks/[root-of-the-server]__0wm4req5e6m88._.js +0 -3
  240. package/.next/server/chunks/[root-of-the-server]__114quo-_-qi9w._.js +0 -3
  241. package/.next/server/chunks/[root-of-the-server]__16-d6bl8bbqvy._.js +0 -3
  242. package/.next/server/chunks/[root-of-the-server]__1_04f-bpuf75t._.js +0 -3
  243. package/.next/server/chunks/[root-of-the-server]__1_hpgx5rlxpya._.js +0 -3
  244. package/.next/server/chunks/[root-of-the-server]__1mj__r5f_o6lo._.js +0 -3
  245. package/.next/server/chunks/[root-of-the-server]__20m7u7lg4e5q8._.js +0 -3
  246. package/.next/server/chunks/ssr/[root-of-the-server]__1w4rew5br9_b8._.js +0 -3
  247. package/.next/server/chunks/ssr/_04ziy8_ak_olr._.js +0 -3
  248. package/.next/server/chunks/ssr/_09gyxodn5bpsw._.js +0 -4
  249. package/.next/server/chunks/ssr/_0oksf3a6pbj88._.js +0 -3
  250. package/.next/static/chunks/0-_s_oel8jb5s.js +0 -1
  251. package/.next/static/chunks/0dizg7xu7sle2.js +0 -1
  252. package/.next/static/chunks/0ebem2w42rgm6.js +0 -191
  253. package/.next/static/chunks/0h8aoqx7182md.js +0 -1
  254. package/.next/static/chunks/0pvlg-25ddo6e.js +0 -33
  255. package/.next/static/chunks/188s0rumoz5yj.js +0 -1
  256. package/.next/static/chunks/1c_3by-e4c6ix.js +0 -2
  257. package/.next/static/chunks/1qa6rlj01hnl5.js +0 -1
  258. package/.next/static/chunks/2q9n-d4_9bhp2.js +0 -1
  259. package/.next/static/chunks/2x1y8v15sfol3.css +0 -3
  260. package/.next/static/chunks/37jrjuqt8f_ee.js +0 -1
  261. package/.next/static/chunks/3oygizhwo77gr.js +0 -6
  262. package/.next/static/chunks/3zt-rwod7li6h.js +0 -1
  263. /package/.next/static/{x6fwUxfhT4hZ2tYr6cKl_ → X3NzguYsDSEVWQKJ6r_e7}/_buildManifest.js +0 -0
  264. /package/.next/static/{x6fwUxfhT4hZ2tYr6cKl_ → X3NzguYsDSEVWQKJ6r_e7}/_clientMiddlewareManifest.js +0 -0
  265. /package/.next/static/{x6fwUxfhT4hZ2tYr6cKl_ → X3NzguYsDSEVWQKJ6r_e7}/_ssgManifest.js +0 -0
@@ -1,191 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(843476),t=e.i(111110),a=e.i(217255),r=e.i(215519),i=e.i(325164),n=e.i(522016),l=e.i(618566),c=e.i(217923),o=e.i(810980),d=e.i(551804),m=e.i(178583),u=e.i(292270),x=e.i(475254);let h=(0,x.f)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),p=(0,x.f)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var f=e.i(271645);let g=(0,x.f)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),j=(0,x.f)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),v=(0,x.f)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var y=e.i(763639),b=e.i(531278);let w=(0,x.f)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),N=(0,x.f)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var k=e.i(284614),S=e.i(733060),C=e.i(519455),T=e.i(776639),A=e.i(677572),_=e.i(306831),E=e.i(487486),M=e.i(699375),D=e.i(793479),R=e.i(110204),F=e.i(975157);let z=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,F.f)("w-full caption-bottom text-sm",e),...t})}));z.displayName="Table";let I=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,F.f)("[&_tr]:border-b",e),...t}));I.displayName="TableHeader";let L=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,F.f)("[&_tr:last-child]:border-0",e),...t}));L.displayName="TableBody",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,F.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}))).displayName="TableFooter";let $=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,F.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));$.displayName="TableRow";let U=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,F.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));U.displayName="TableHead";let P=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,F.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));P.displayName="TableCell",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,F.f)("mt-4 text-sm text-muted-foreground",e),...t}))).displayName="TableCaption";var O=e.i(727612);let q=(0,x.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var H=e.i(269638),V=e.i(41931),Y=e.i(294114),W=e.i(201276),B=e.i(303163);function J(){let{timeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),{t:n}=(0,t.b)(),[l,c]=(0,f.useState)([]),[o,d]=(0,f.useState)(!0),[m,u]=(0,f.useState)(!1),[x,h]=(0,f.useState)(!1),[p,g]=(0,f.useState)("0"),[j,v]=(0,f.useState)(!1),y=(0,f.useCallback)(async()=>{d(!0);try{let e=await V.f.get("/api/admin/users");c(e)}catch(e){W.f.error("[UserManagement]","Failed to fetch users",{error:e})}finally{d(!1)}},[]),w=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/settings");u(!0===e.allowRegistration),g(String(e.aiDailyLimit??0))}catch(e){W.f.error("[UserManagement]","Failed to fetch config",{error:e})}},[]);(0,f.useEffect)(()=>{y(),w()},[y,w]);let N=async e=>{h(!0);try{await V.f.post("/api/settings",{allowRegistration:e}),u(e)}catch(e){W.f.error("[UserManagement]","Failed to update registration setting",{error:e}),Y.c.error(n.common.error)}finally{h(!1)}},k=Number(p),S=""!==p.trim()&&Number.isInteger(k)&&k>=0,T=async()=>{if(S){v(!0);try{await V.f.post("/api/settings",{aiDailyLimit:k}),Y.c.success(n.admin.aiDailyLimitSaved)}catch(e){W.f.error("[UserManagement]","Failed to update AI daily limit",{error:e}),Y.c.error(n.common.error)}finally{v(!1)}}},A=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,Y.u)(s))try{await V.f.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),y()}catch(e){W.f.error("[UserManagement]","Failed to update user status",{error:e}),Y.c.error(n.common.error)}},F=async e=>{if(await (0,Y.u)(n.admin.confirmDelete,{destructive:!0}))try{await V.f.delete(`/api/admin/users/${e.id}`),y()}catch(s){W.f.error("[UserManagement]","Failed to delete user",{error:s});let e=(0,B.d)(s)||n.common.error;Y.c.error(e)}};return o?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(b.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(R.f,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(b.f,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(M.f,{checked:m,onCheckedChange:N,disabled:x})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(R.f,{htmlFor:"ai-daily-limit",className:"text-base",children:n.admin.aiDailyLimit}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin.aiDailyLimitDesc})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(D.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:e=>g(e.target.value),"aria-invalid":!S,className:"w-24"}),(0,s.jsxs)(C.f,{size:"sm",onClick:T,disabled:j||!S,children:[j&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.common.save]})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:l.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(E.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords," | ",n.admin.aiUsageToday,": ",t.aiUsageToday]}),(0,s.jsx)(E.f,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,_.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(z,{children:[(0,s.jsx)(I,{children:(0,s.jsxs)($,{children:[(0,s.jsx)(U,{children:n.admin.nameEmail}),(0,s.jsx)(U,{children:n.admin.role}),(0,s.jsx)(U,{children:n.admin.stats}),(0,s.jsx)(U,{children:n.admin.createdAt}),(0,s.jsx)(U,{children:n.admin.status}),(0,s.jsx)(U,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(L,{children:l.map(t=>(0,s.jsxs)($,{children:[(0,s.jsxs)(P,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(P,{children:(0,s.jsx)(E.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(P,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.aiUsageToday,": ",t.aiUsageToday]})]}),(0,s.jsx)(P,{children:(0,_.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(P,{children:(0,s.jsx)(E.f,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(P,{className:"text-right space-x-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,title:n.admin.delete,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var K=e.i(778917);let X=(0,x.f)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),G=(0,x.f)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Z=(0,x.f)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Q(){return window.WrongNotebookAndroid??null}let ee=()=>()=>void 0;function es(){let{t:e}=(0,t.b)(),a=(0,f.useSyncExternalStore)(ee,Q,()=>null);return a?a.isStandalone?.()?(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:e.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"break-all",children:[e.settings?.about?.androidServer||"Server",": ",a.getServerUrl()]}),(0,s.jsxs)(C.f,{variant:"outline",className:"gap-2",onClick:()=>a.changeServer(),children:[(0,s.jsx)(Z,{className:"h-4 w-4"}),e.settings?.about?.changeServer||"Change server"]})]}):null}let et="https://github.com/margrop/wrong-notebook";function ea(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)("");(0,f.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>r(e.version)).catch(()=>{})},[]);let i=[{href:et,icon:X,label:e.settings?.about?.github||"GitHub Repository"},{href:`${et}/releases`,icon:G,label:e.settings?.about?.releaseNotes||"Release Notes"},{href:`${et}/issues`,icon:w,label:e.settings?.about?.feedback||"Feedback"}];return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:e.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:e.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,s.jsx)(v,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[e.settings?.about?.version||"Version",": v",a||"unknown"]})]}),(0,s.jsx)(es,{}),(0,s.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:i.map(({href:e,icon:t,label:a})=>(0,s.jsx)(C.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(t,{className:"h-4 w-4"}),a,(0,s.jsx)(K.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:e.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var er=e.i(37038),ei=e.i(967489);let en={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function el(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(en),[i,n]=(0,f.useState)(""),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),m=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/user");r({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){W.f.error("[AccountSettings]","Failed to fetch profile",{error:e})}finally{c(!1)}},[]);(0,f.useEffect)(()=>{m()},[m]);let u=async()=>{if(a.password&&a.password!==i)return void Y.c.error(e.settings?.messages?.passwordMismatch||"Passwords do not match");d(!0);try{let s={name:a.name,email:a.email,educationStage:a.educationStage};a.enrollmentYear&&(s.enrollmentYear=parseInt(a.enrollmentYear.toString())),a.password&&(s.password=a.password),await V.f.patch("/api/user",s),Y.c.success(e.settings?.messages?.profileUpdated||"Profile updated"),r(e=>({...e,password:""})),n(""),window.location.reload()}catch(s){W.f.error("[AccountSettings]","Failed to update profile",{error:(0,B.d)(s)??(0,B.Z)(s)}),Y.c.error((0,B.d)(s)||e.settings?.messages?.updateFailed||"Update failed")}finally{d(!1)}};return l?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(b.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.name||"Name"}),(0,s.jsx)(D.f,{value:a.name||"",onChange:e=>r({...a,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.email||"Email"}),(0,s.jsx)(D.f,{value:a.email||"",onChange:e=>r({...a,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(ei.d,{value:a.educationStage||"",onValueChange:e=>r({...a,educationStage:e}),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{placeholder:e.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"primary",children:e.auth?.primary||"Primary School"}),(0,s.jsx)(ei.T,{value:"junior_high",children:e.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(ei.T,{value:"senior_high",children:e.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(ei.T,{value:"university",children:e.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(D.f,{type:"number",value:a.enrollmentYear||"",onChange:e=>r({...a,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsx)(er.f,{value:a.password,onChange:e=>r({...a,password:e.target.value}),placeholder:"******",minLength:6})]}),a.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.confirmPassword||"Confirm Password"}),(0,s.jsx)(er.f,{value:i,onChange:e=>n(e.target.value),placeholder:"******",minLength:6})]})]}),(0,s.jsxs)(C.f,{onClick:u,disabled:o,className:"w-full",children:[o&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.settings?.account?.update||"Update Profile"]})]})}var ec=e.i(10038),eo=e.i(16715);let ed={info:{card:"border-blue-200 bg-blue-50",title:"text-blue-900 font-bold",desc:"text-blue-800 font-medium",button:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300"},danger:{card:"border-red-200 bg-red-50",title:"text-red-700 font-medium",desc:"text-red-600",button:""},critical:{card:"border-red-600/50 bg-red-100/50",title:"text-red-900 font-bold",desc:"text-red-800 font-medium",button:"bg-red-700 hover:bg-red-800"}};function em({title:e,description:t,tone:a,busy:r,icon:i,onClick:n}){let l=ed[a];return(0,s.jsxs)("div",{className:`p-4 border rounded-lg ${l.card}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:`text-sm flex items-center gap-2 ${l.title}`,children:e}),(0,s.jsx)(C.f,{variant:"info"===a?"outline":"destructive",size:"sm",onClick:n,disabled:r,className:l.button,children:r?(0,s.jsx)(b.f,{className:"h-4 w-4 animate-spin"}):i})]}),(0,s.jsx)("p",{className:`text-xs mt-2 ${l.desc}`,children:t})]})}function eu({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(null),n=async(e,s,t,a)=>{i(e);try{Y.c.success(await s()),a&&window.location.reload()}catch(s){W.f.error("[DangerZoneSettings]",`${e} failed`,{error:s}),Y.c.error(t)}finally{i(null)}},l=a.settings?.clearSuccess||"Success",c=a.settings?.clearError||"Failed",o=async()=>{await (0,Y.u)(a.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await n("migrateTags",async()=>{let e=await V.f.post("/api/admin/migrate-tags",{});return`${l}: ${e.count||0} tags migrated.`},a.settings?.clearError||"Failed to migrate tags",!1)},d=async()=>{await (0,Y.u)(a.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearPractice",async()=>(await V.f.delete("/api/stats/practice/clear"),l),c,!0)},m=async()=>{await (0,Y.u)(a.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearErrors",async()=>(await V.f.delete("/api/error-items/clear"),l),c,!0)},u=async()=>{if(!await (0,Y.u)(a.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(a.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&Y.c.error(a.common?.error||"Confirmation failed");return}await n("systemReset",async()=>(await V.f.post("/api/admin/system-reset",{}),a.settings?.clearSuccess||"Success - System Reset Complete"),a.settings?.clearError||"Failed to reset system",!0)};return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)(em,{tone:"info",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eo.f,{className:"h-4 w-4"}),a.settings?.migrateTags||"Migrate Tags"]}),description:a.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===r,icon:(0,s.jsx)(eo.f,{className:"h-4 w-4"}),onClick:o}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearData||"Clear Practice Data",description:a.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:d}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearErrorData||"Clear Error Data",description:a.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:m}),e&&(0,s.jsx)(em,{tone:"critical",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g,{className:"h-4 w-4"}),a.settings?.systemReset||"System Initialization"]}),description:a.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:u})]})}var ex=e.i(595468),eh=e.i(440160);let ep=(0,x.f)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);async function ef(e,s){let t=await fetch(e);if(!t.ok)throw Error((await t.json().catch(()=>({}))).message||"Export failed");let a=await t.blob(),r=window.URL.createObjectURL(a),i=document.createElement("a");i.href=r;let n=t.headers.get("Content-Disposition")?.match(/filename="(.+)"/);i.download=n?n[1]:s,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function eg({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(!1),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(null),d=async e=>{if(!e||await (0,Y.u)(a.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){i(!0);try{await ef(e?"/api/export?all=true":"/api/export",e?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),Y.c.success(a.settings?.exportSuccess||"Export successful")}catch(s){W.f.error("[DataBackupSettings]",e?"Export all failed":"Export failed",{error:s}),Y.c.error(a.settings?.exportFailed||"Export failed")}finally{i(!1)}}},m=async e=>{if(!c)return;let s=e?a.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":a.settings?.importConfirm||"Are you sure you want to import?";if(await (0,Y.u)(s)){l(!0);try{let s=JSON.parse(await c.text()),{stats:t}=await V.f.post(e?"/api/import?all=true":"/api/import",s);Y.c.success((a.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers and {voices} cloud voice clips.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{papers}",String(t.examPapersCreated??0)).replace("{voices}",String(t.ttsSpeechesImported??0)).replace("{duplicates}",String(t.duplicateErrorItems??0))),o(null),window.location.reload()}catch(s){W.f.error("[DataBackupSettings]",e?"Import all failed":"Import failed",{error:s}),Y.c.error(a.settings?.importFailed||"Import failed")}finally{l(!1)}}},u=(e,t)=>e?(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}):t;return(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:a.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!1),disabled:r,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportData||"Export"]}),e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:r,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>o(e.target.files?.[0]??c),className:"hidden",id:"import-file-input",disabled:n}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:n,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(n,(0,s.jsx)(ep,{className:"mr-2 h-4 w-4"})),c?.name||a.settings?.selectFile||"Select File"]}),c&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!1),disabled:n,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importData||"Import"]}),c&&e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:n,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var ej=e.i(307364);function ev({field:e,label:a,description:r}){let{t:i}=(0,t.b)(),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(!1),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)(null),h=`preference-${e}`;(0,f.useEffect)(()=>{V.f.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>o(!0))},[e]);let p=async s=>{l(s),m(!0);try{await V.f.patch("/api/user",{[e]:s}),x(i.importFlow.preferenceSaved)}catch(t){l(!s),x(i.importFlow.preferenceSaveFailed),W.f.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(R.f,{htmlFor:h,children:a}),(0,s.jsx)(M.f,{id:h,checked:n,onCheckedChange:p,disabled:!c||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function ey(){let{t:e}=(0,t.b)();return(0,s.jsx)(ev,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function eb(){let{t:e}=(0,t.b)();return(0,s.jsx)(ev,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}var ew=e.i(905110);function eN(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(String(ew.z)),[i,n]=(0,f.useState)(null),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),[m,u]=(0,f.useState)(null),x=Number(a),h=""!==a.trim()&&Number.isInteger(x)&&x>=ew.P&&x<=ew.o,p=(0,f.useCallback)(async()=>{c(!0),u(null);try{let e=(await V.f.get("/api/user")).masteryThreshold??ew.z;r(String(e)),n(e)}catch(s){u(e.mastery.thresholdLoadFailed),W.f.error("[Settings]","加载已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{c(!1)}},[e.mastery.thresholdLoadFailed]);(0,f.useEffect)(()=>{p()},[p]);let g=async()=>{if(h&&null!==i){d(!0),u(null);try{let s=(await V.f.patch("/api/user",{masteryThreshold:x})).masteryThreshold??x;n(s),r(String(s)),u(e.importFlow.preferenceSaved)}catch(s){u(e.importFlow.preferenceSaveFailed),W.f.error("[Settings]","保存已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{d(!1)}}};return(0,s.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,s.jsx)(R.f,{htmlFor:"mastery-threshold",children:e.mastery.thresholdLabel}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(D.f,{id:"mastery-threshold",type:"number",min:ew.P,max:ew.o,step:1,value:a,onChange:e=>{r(e.target.value),u(null)},disabled:l||o||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,s.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,s.jsxs)(C.f,{type:"button",size:"sm",variant:"outline",onClick:g,disabled:l||o||null===i||!h||x===i,children:[(l||o)&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.importFlow.saveThreshold]}),!l&&null===i&&(0,s.jsx)(C.f,{type:"button",size:"sm",variant:"outline",onClick:p,children:e.importFlow.retryLoad})]}),(0,s.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:e.mastery.thresholdDescription}),null!==i&&!h&&(0,s.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:e.mastery.thresholdInvalid}),m&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:m})]})}function ek(){let{t:e}=(0,t.b)();return(0,s.jsx)(ev,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eS({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.b)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(R.f,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(D.f,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}function eC({config:e,setConfig:a,isAdmin:i,disabled:n}){let{t:l,language:c,setLanguage:o}=(0,t.b)(),{timeZone:d}=(0,r.M)(),m=e=>a(s=>({...s,timeouts:{...s.timeouts,analyze:1e3*e}}));return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:l.settings?.language||"Language"}),(0,s.jsxs)(ei.d,{value:c,onValueChange:e=>o(e),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(ei.T,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eS,{value:e.timeZone??d,onChange:e=>a(s=>({...s,timeZone:e})),disabled:!i||n}),i&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(R.f,{children:l.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(D.f,{type:"number",value:e.timeouts?.analyze?e.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);m(isNaN(s)?0:s)},onBlur:()=>{let s=(e.timeouts?.analyze||0)/1e3,t=Math.min(600,Math.max(120,s));t!==s&&m(t)},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(eb,{}),(0,s.jsx)(ek,{}),(0,s.jsx)(ey,{}),(0,s.jsx)(ej.f,{}),(0,s.jsx)(eN,{})]})}var eT=e.i(624687),eA=e.i(247167);let e_={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function eE(e,s={}){let t,a=e_[e],r=(t=eA.default.env.LOG_LEVEL?.toLowerCase())&&void 0!==e_[t]?e_[t]:e_.info;return(t,i)=>{let n,l;if(a<r)return;let c=new Date;"string"==typeof t?(n={},l=t):(n=t,l=i||"");{let t=JSON.stringify({level:e,time:c.toISOString(),...s,...n,msg:l});switch(e){case"error":case"fatal":console.error(t);break;case"warn":console.warn(t);break;default:console.log(t)}}}}(function e(s={}){return s.module,{trace:eE("trace",s),debug:eE("debug",s),info:eE("info",s),warn:eE("warn",s),error:eE("error",s),fatal:eE("fatal",s),child:t=>e({...s,...t}),box:(e,t,a="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...s,title:e,..."string"==typeof t?{content:t}:t||{},msg:e}))},divider:(e="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let eM=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
2
- - 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
3
- - 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
4
- - 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
5
- - 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
6
- - 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
7
- 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,eD=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
8
- - 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
9
- - 按原图比例和相对位置绘制,保留所有标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18)。
10
- - 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
11
- - 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,eR=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
12
- - 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
13
- - 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
14
- - 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
15
- - 公式中的中文写在 \text{...} 里,或放到公式外;百分号写成 \%,美元符号写成 \$。
16
- - 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,eF=`【角色与核心任务 (ROLE AND CORE TASK)】
17
- 你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
18
-
19
- {{language_instruction}}
20
-
21
- 【核心输出要求 (OUTPUT REQUIREMENTS)】
22
- 你的响应输出**必须严格遵循以下自定义标签格式**。**严禁**使用 JSON 或 Markdown 代码块。**严禁**对 LaTeX 公式中的反斜杠进行二次转义(如 "\\frac" 是错误的,必须是 "\frac")。
23
-
24
- 请严格按照以下结构输出内容:
25
-
26
- <subject>
27
- 在此处填写学科,必须是以下之一:"数学", "物理", "化学", "生物", "英语", "语文", "历史", "地理", "政治", "其他"。
28
- </subject>
29
-
30
- <knowledge_points>
31
- 在此处填写知识点,使用逗号分隔,例如:知识点1, 知识点2, 知识点3
32
- </knowledge_points>
33
-
34
- <requires_image>
35
- 判断这道题是否需要依赖图片才能正确解答。如果题目包含几何图形、函数图像、实验装置图、电路图等必须看图才能理解的内容,填写 true;如果只需要文字描述即可理解(如英语题、纯文字数学题),填写 false。
36
- </requires_image>
37
-
38
- <has_figure>
39
- 判断题目本身是否带有配图(几何图形、函数图像、示意图、统计图、实验装置图、电路图等;不含学生的作答痕迹和纯文字表格)。有配图填 true,否则填 false。
40
- </has_figure>
41
-
42
- <figure_svg>
43
- 如果 has_figure 为 true,用 SVG 重新绘制题目配图:
44
- ${eD}
45
- 如果 has_figure 为 false,请留空。
46
- </figure_svg>
47
-
48
- <wrong_answer_text>
49
- 如果图片中包含学生已经写出的错误解答、错误步骤、草稿或错误答案,请尽量按原样摘录;如果没有看到学生错误解答,请留空。
50
- </wrong_answer_text>
51
-
52
- <mistake_status>
53
- 填写以下值之一:wrong_attempt(图片中有错误解答或错误步骤)、not_attempted(没有错误解答,像是完全不会做或未作答)、unknown(无法判断)。
54
- </mistake_status>
55
-
56
- <difficulty_stars>
57
- 只填写 1 到 5 之间的一个整数,表示题目难度星级。
58
- ${eM}
59
- </difficulty_stars>
60
-
61
- <mistake_analysis>
62
- 如果图片中包含错误解答,请分析错误可能发生在哪一步、为什么错、导致了什么后果;如果没有错误解答,请留空。
63
- </mistake_analysis>
64
-
65
- <question_text>
66
- 在此处填写题目的完整文本。使用 Markdown 格式。所有数学公式使用 LaTeX 符号(行内 $...$,块级 $$...$$)。
67
-
68
- 【题干转录规则】
69
- 1. **逐字照录**:按图片原文转录题干(含题号、分值和标点),不要改写、概括、增删字词或调整语序;看不清的字用 [?] 标注。
70
- 2. **填空统一**:所有填空处统一写作 ____(4 个下划线),不论原图横线长短。
71
- 3. **图形描述**:如果题目依赖图形,在题干原文之后空一行,单独写**一段**以「图示:」开头的图形描述;只能使用「图示:」这一种写法(不要写「图示信息」「图示说明」等),描述中不要重复题干已有的文字。题目不依赖图形时不要写图示段落。
72
-
73
- 【表格处理规则】
74
- 如果图片中包含表格,必须完整转录表格内容,遵循以下原则:
75
-
76
- 1. **标准表格**:使用 Markdown 表格语法
77
- | 列标题1 | 列标题2 | 列标题3 |
78
- |---------|---------|---------|
79
- | 数据1 | 数据2 | 数据3 |
80
-
81
- 2. **复杂表格**(合并单元格/多级表头/不规则布局):
82
- - 优先尝试用 Markdown 表格近似表示
83
- - 如果 Markdown 无法准确表达,在表格前用文字说明结构,然后用简化的 Markdown 表格 + 注释
84
- - 示例:
85
- > 注:第1行为主标题,横跨3列;第2-3行为数据行
86
-
87
- | 项目 | 数值A | 数值B |
88
- |------|-------|-------|
89
- | 测试1 | 10 | 20 |
90
- | 测试2 | 15 | 25 |
91
-
92
- 3. **表格完整性要求**:
93
- - 必须转录所有单元格内容(包括空单元格用 - 或空格表示)
94
- - 保留表格标题、单位、注释
95
- - 保留数据的对齐关系和分组信息
96
- - 表格中的数学公式使用 LaTeX 语法
97
-
98
- 4. **表格上下文**:
99
- - 如果表格有标题或编号(如"表1"),保留在表格前
100
- - 如果表格后有注释或说明,保留在表格后
101
- - 保持表格在题目中的位置关系
102
-
103
- 5. **特殊情况处理**:
104
- - 图表混合:如果表格旁边有图形,用文字说明位置关系
105
- - 手写表格:尽力识别手写内容,不确定的用 [?] 标注
106
- - 模糊表格:如果表格不清晰,在表格前注明"(表格内容可能不完整)"
107
- </question_text>
108
-
109
- <answer_text>
110
- 在此处填写正确答案。使用 Markdown 和 LaTeX 符号。如果答案包含表格,遵循上述【表格处理规则】。
111
- </answer_text>
112
-
113
- <analysis>
114
- 在此处填写详细的步骤解析。
115
- * 必须使用简体中文。
116
- * **直接使用标准的 LaTeX 符号**(如 $\frac{1}{2}$),**不要**进行 JSON 转义(不要写成 \\frac)。
117
- * 如果解析过程需要表格(如列表对比、分步计算表),遵循上述【表格处理规则】。
118
- </analysis>
119
-
120
- 【知识点标签列表(KNOWLEDGE POINT LIST)】
121
- {{knowledge_points_list}}
122
-
123
- 【标签使用规则 (TAG RULES)】
124
- - 标签必须与题目实际考查的知识点精准匹配。
125
- - 每题最多 5 个标签。
126
-
127
- 【!!! 关键格式与内容约束 (CRITICAL RULES) !!!】
128
- 1. **格式严格**:必须严格包含上述 12 个 XML 标签,除此之外不要输出任何其他“开场白”或“结束语”。
129
- 2. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
130
- 3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
131
- 4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
132
- 5. **LaTeX 规范**:
133
- ${eR}
134
-
135
- {{grade_instruction}}
136
- {{provider_hints}}`,ez=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
137
- ### 角色定义
138
- 1. **学科全能专家**
139
- - 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
140
- - 熟悉各年级课程标准与知识点分布
141
- - 能准确识别题目考察的核心能力点(计算/推理/分析/应用/创新)
142
- 2. **题目变异大师**
143
- - 掌握12种变式技法:条件替换/情境迁移/问题转化/数据重构/图形变形/角色反转/跨学科融合/难度阶梯/开放拓展/陷阱设计/逆向思维/生活应用
144
- - 确保变式题目保持原题核心考点,改变题目表现形式
145
- 3. **学情分析师**
146
- - 预判学生易错点(认知盲区/概念混淆/计算失误/审题偏差)
147
- - 在变式题目中针对性强化易错点训练
148
- ### 执行流程
149
- 1. **接收任务**
150
- 原题: "{{original_question}}"
151
- {{language_instruction}}
152
- DIFFICULTY LEVEL: {{difficulty_level}}
153
- {{difficulty_instruction}}
154
- Knowledge Points: {{knowledge_points}}
155
- 2. **解构分析**
156
- - 提取核心考点与能力要求
157
- - 分析题目陷阱与解题路径
158
- 3. **质量管控**
159
- - 确保每道题:
160
- ✓ 覆盖相同核心知识点
161
- ✓ 保持解题逻辑一致性
162
- ✓ 答案唯一且可验证
163
- ✓ 无知识性错误
164
- ### 输出规范
165
- 你的响应输出**必须严格遵循以下自定义标签格式**。**严禁**使用 JSON 或 Markdown 代码块。**严禁**返回 \`\`\`json ... \`\`\`。
166
-
167
- 请严格按照以下结构输出内容(不要包含任何其他文字):
168
-
169
- <question_text>
170
- 在此处填写新生成的填空题或解答题。不要包含题号、分值或选择题选项。
171
- </question_text>
172
-
173
- <answer_text>
174
- 在此处填写新题目的正确答案。
175
- </answer_text>
176
-
177
- <analysis>
178
- 在此处填写新题目的详细解析。
179
- * 必须使用简体中文。
180
- * **直接使用标准的 LaTeX 符号**(如 $\frac{1}{2}$),**不要**进行 JSON 转义。
181
- </analysis>
182
-
183
- {{figure_instruction}}
184
-
185
- ###关键格式与内容约束 (CRITICAL RULES) !!!
186
- 1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
187
- 2. **LaTeX 规范**:
188
- ${eR}
189
-
190
- {{grade_instruction}}
191
- {{provider_hints}}`;var eI=e.i(367240);function eL({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function e$(){let{t:e}=(0,t.b)();return(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,s.jsx)(g,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:e.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:e.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function eU({config:e,onUpdate:a}){let{t:r}=(0,t.b)(),i=e.prompts?.analyze||eF,n=e.prompts?.similar||ez,l=async e=>{await (0,Y.u)(r.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&a(e,"analyze"===e?eF:ez)},c=(e,s)=>{a(e,s)};return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(A.i,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(A.U,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(A.k,{value:"analyze",children:r.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(A.k,{value:"similar",children:r.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(A.S,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(R.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("analyze"),children:[(0,s.jsx)(eI.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(v,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eL,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eL,{name:"knowledge_points_list",description:r.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eL,{name:"provider_hints",description:r.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(eT.f,{value:i,onChange:e=>c("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eF})]})}),(0,s.jsx)(A.S,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(R.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("similar"),children:[(0,s.jsx)(eI.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(v,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eL,{name:"difficulty_level",description:r.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eL,{name:"difficulty_instruction",description:r.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eL,{name:"original_question",description:r.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eL,{name:"knowledge_points",description:r.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eL,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(eT.f,{value:n,onChange:e=>c("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:ez})]})})]})})}var eP=e.i(431343),eO=e.i(128093),eq=e.i(79058);let eH=["browser","minimax","qwen"],eV={minimax:{model:"speech-2.8-hd",voice:"male-qn-jingying"},qwen:{model:"qwen-audio-3.0-tts-plus",voice:"longanlufeng"}};function eY({config:e,setConfig:a,saving:r,onSave:i}){let{t:n,language:l}=(0,t.b)(),c=n.settings.tts,[o,d]=(0,f.useState)(!1),m=e.tts?.mode??"browser",u="minimax"===m||"qwen"===m?m:null,x=u?e.tts?.[u]:void 0,h=(e,s)=>{u&&a(t=>({...t,tts:{...t.tts,[u]:{...t.tts?.[u],[e]:s}}}))},p=async()=>{(0,eq.p)(),d(!0);try{await i();let{id:e}=await V.f.post("/api/tts",{text:c.previewText,language:l},{timeout:12e4,recoverable:!0}),s=(0,eq.l)();if(!s)return;s.src=`/api/tts/${e}`,s.playbackRate=1,await s.play()}catch(s){W.f.error("[TtsSettings]","Preview failed",{error:s});let e=(0,B.d)(s);Y.c.error("TTS_NOT_CONFIGURED"===e?c.notConfigured:"TTS_PROVIDER_ERROR"===e?c.providerError:c.previewFailed)}finally{d(!1)}};return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.title}),(0,s.jsxs)(ei.d,{value:m,onValueChange:e=>a(s=>({...s,tts:{...s.tts,mode:e}})),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsx)(ei.r,{children:eH.map(e=>(0,s.jsx)(ei.T,{value:e,children:c.modes[e]},e))})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u?c.cloudHint:c.browserHint})]}),u&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(R.f,{children:[eO.$[u].name," API Key"]}),(0,s.jsx)(er.f,{value:e[u]?.apiKey||"",onChange:e=>{var s;return s=e.target.value,void(u&&a(e=>({...e,[u]:{...e[u],apiKey:s}})))},placeholder:"qwen"===u?"sk-sp-...":"sk-..."}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:c.apiKeyHint[u]})]}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.model}),(0,s.jsx)(D.f,{value:x?.model||"",onChange:e=>h("model",e.target.value),placeholder:eV[u].model})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.voice}),(0,s.jsx)(D.f,{value:x?.voice||"",onChange:e=>h("voice",e.target.value),placeholder:eV[u].voice})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:c.voiceHint[u]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.endpoint}),(0,s.jsx)(D.f,{value:x?.endpoint||"",onChange:e=>h("endpoint",e.target.value),placeholder:function(e,s){let{baseUrl:t}=(0,eO.k)(e,s);if("minimax"===e)return`${t.replace(/\/+$/,"")}/t2a_v2`;try{return`${new URL(t).origin}/api/v1/services/audio/tts/SpeechSynthesizer`}catch{return""}}(u,e[u])}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:c.endpointHint})]})]},u),(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[u&&(0,s.jsxs)(C.f,{variant:"outline",onClick:p,disabled:r||o,className:"sm:w-auto",children:[o?(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(eP.f,{className:"mr-2 h-4 w-4"}),c.preview]}),(0,s.jsxs)(C.f,{onClick:()=>void i(),disabled:r||o,className:"flex-1",children:[r&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),c.save]})]})]})}var eW=e.i(835467);function eB({value:e,icon:t,label:a}){return(0,s.jsxs)(A.k,{value:e,className:"px-2 sm:px-3",children:[t,(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]})}function eJ(){let{setTimeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),n=i?.user?.role==="admin",{t:o}=(0,t.b)(),d=(0,l.useRouter)(),[m,u]=(0,f.useState)(!1),x=(0,f.useRef)(null),[h,E]=(0,f.useState)(!1),[M,D]=(0,f.useState)(!1),[R,F]=(0,f.useState)({aiProvider:"minimax"}),z=(0,f.useCallback)(async()=>{D(!0);try{F(await V.f.get("/api/settings"))}catch(e){W.f.error("[SettingsDialog]","Failed to fetch settings",{error:e})}finally{D(!1)}},[]);(0,f.useEffect)(()=>{m&&z()},[m,z]);let I=async()=>{let s=(0,eW.f)(R,o);if(s)return void Y.c.error(s);E(!0);try{let s=await V.f.post("/api/settings",R);F(s),e(s.timeZone||_.J),Y.c.success(o.settings?.messages?.saved||"Settings saved"),x.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){W.f.error("[SettingsDialog]","Failed to save settings",{error:e}),Y.c.error(o.settings?.messages?.saveFailed||"Failed to save")}finally{E(!1)}},L=e=>(0,s.jsxs)(C.f,{onClick:I,disabled:h,className:"w-full",children:[h&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),e]});return(0,s.jsxs)(T.N,{open:m,onOpenChange:u,children:[(0,s.jsx)(T.a,{asChild:!0,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(N,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.settings?.title||"Settings"})]})}),(0,s.jsxs)(T.d,{ref:x,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:o.settings?.title||"Settings"}),(0,s.jsx)(T.C,{children:o.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(A.i,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(A.U,{className:`grid w-full grid-cols-4 ${n?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsx)(eB,{value:"general",icon:(0,s.jsx)(y.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.general||"General"}),(0,s.jsx)(eB,{value:"account",icon:(0,s.jsx)(k.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.account||"Account"}),n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eB,{value:"ai",icon:(0,s.jsx)(j,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.ai||"AI Provider"}),(0,s.jsx)(eB,{value:"prompts",icon:(0,s.jsx)(w,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.prompts||"Prompts"}),(0,s.jsx)(eB,{value:"admin",icon:(0,s.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.admin||"User Management"})]}),(0,s.jsx)(eB,{value:"danger",icon:(0,s.jsx)(g,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.danger||"Danger"}),(0,s.jsx)(eB,{value:"about",icon:(0,s.jsx)(v,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.about||"About"})]}),(0,s.jsxs)(A.S,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsx)(eC,{config:R,setConfig:F,isAdmin:n,disabled:M||h}),n&&L(o.settings?.save||"Save Settings")]}),(0,s.jsx)(A.S,{value:"account",className:"space-y-4 py-4",children:(0,s.jsx)(el,{})}),(0,s.jsxs)(A.S,{value:"ai",className:"space-y-4 py-4",children:[(0,s.jsx)(ec.f,{config:R,setConfig:F,loading:M,saving:h,onSave:I}),!M&&(0,s.jsx)(eY,{config:R,setConfig:F,saving:h,onSave:I})]}),(0,s.jsxs)(A.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eU,{config:R,onUpdate:(e,s)=>F(t=>({...t,prompts:{...t.prompts,[e]:s}}))}),L(o.settings?.prompts?.save||"Save Prompt Settings")]}),n&&(0,s.jsxs)(A.S,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/admin")},children:[(0,s.jsx)(c.f,{className:"h-4 w-4"}),o.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/setup")},children:[(0,s.jsx)(S.f,{className:"h-4 w-4"}),o.setup.rerun]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(J,{})})]}),(0,s.jsx)(A.S,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eg,{isAdmin:n}),(0,s.jsx)(eu,{isAdmin:n})]})}),(0,s.jsx)(A.S,{value:"about",className:"space-y-4 py-4",children:(0,s.jsx)(ea,{})})]})]})]})}let eK=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eX=[{key:"home",href:"/",icon:h,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:o.f,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"review",href:"/review",icon:d.f,match:e=>e.startsWith("/review")},{key:"stats",href:"/stats",icon:c.f,match:e=>e.startsWith("/stats")||e.startsWith("/tags")},{key:"exams",href:"/exams",icon:m.f,match:e=>e.startsWith("/exams")}];function eG({children:e}){var r;let c,o,d=(0,l.usePathname)()||"/",{t:m}=(0,t.b)(),{data:x,status:h}=(0,a.useSession)(),g=x?.user?.role==="admin",j=eK.some(e=>e.test(d));if(r=g&&!j,c=(0,l.useRouter)(),o=(0,f.useRef)(!1),(0,f.useEffect)(()=>{r&&!o.current&&(o.current=!0,V.f.get("/api/setup").then(e=>{e.needsSetup&&c.replace("/setup")}).catch(e=>W.f.warn("[Setup]","Failed to check setup status",{error:e})))},[r,c]),j||"unauthenticated"===h)return(0,s.jsx)(s.Fragment,{children:e});let v=x?.user?.name||x?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,s.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:m.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eX.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),m.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[v&&(0,s.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,s.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:v.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:v})]}),g&&(0,s.jsx)(n.default,{href:"/admin",title:m.nav.admin,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(p,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:m.nav.admin})]})}),(0,s.jsx)(eJ,{}),(0,s.jsx)(C.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:m.app.logout,children:(0,s.jsx)(u.f,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eX.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,F.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),m.nav[e.key]]},e.key)})})})]})}let eZ=(0,x.f)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var eQ=e.i(373884);let e0=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function e1(){let{t:e}=(0,t.b)(),{timeZone:i}=(0,r.M)(),{status:c}=(0,a.useSession)(),o=(0,l.usePathname)(),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)([]),[h,p]=(0,f.useState)(()=>Date.now()),g="authenticated"!==c||e0.some(e=>e.test(o||"")),j=(0,f.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await V.f.get("/api/tasks");x(e.tasks),p(Date.now())}catch{}},[]);if((0,f.useEffect)(()=>{if(g)return;let e=setTimeout(j,0),s=setInterval(j,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[g,d,j]),g)return null;let v=u.filter(e=>"running"===e.status).length,y=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await V.f.delete("/api/tasks");x(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(C.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[v>0?(0,s.jsx)(b.f,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(eZ,{className:"h-5 w-5"}),v>0&&(0,s.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:v})]}),(0,s.jsx)(T.N,{open:d,onOpenChange:m,children:(0,s.jsxs)(T.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:e.backgroundTasks.title}),(0,s.jsx)(T.C,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(b.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(ex.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(eQ.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,_.r)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):h)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),y&&(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var e2=e.i(37727);let e4={success:{icon:ex.f,className:"text-success"},error:{icon:eQ.f,className:"text-destructive"},warning:{icon:g,className:"text-warning"},info:{icon:v,className:"text-primary"}};function e3(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)([]),[i,n]=(0,f.useState)(null);return(0,f.useEffect)(()=>(0,Y.M)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:a.map(t=>{let{icon:a,className:r}=e4[t.type];return(0,s.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,s.jsx)(a,{className:(0,F.f)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,Y.p)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(e2.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(T.N,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(T.d,{className:"sm:max-w-md",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsxs)(T.F,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(g,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(T.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(T.c,{className:"gap-2",children:[(0,s.jsx)(C.f,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(C.f,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}function e5(){return(0,f.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(e=>{W.f.warn("[PWA]","Service worker registration failed",{error:String(e)})})},[]),null}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.w,{children:(0,s.jsxs)(r.n,{initialTimeZone:i,children:[(0,s.jsx)(eG,{children:e}),(0,s.jsx)(e1,{}),(0,s.jsx)(e3,{}),(0,s.jsx)(e5,{})]})})})}],1661)}]);
@@ -1 +0,0 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,871689,e=>{let t=(0,e.i(475254).f)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["f",0,t],871689)},303281,e=>{let t=(0,e.i(475254).f)("printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);e.s(["f",0,t],303281)},356909,e=>{let t=(0,e.i(475254).f)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["f",0,t],356909)},283086,e=>{let t=(0,e.i(475254).f)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["f",0,t],283086)},591124,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(522016),r=e.i(618566),i=e.i(215519),l=e.i(306831);let n=(0,e.i(475254).f)("clipboard-check",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);var d=e.i(531278),c=e.i(303281),m=e.i(367240),o=e.i(356909),x=e.i(727612),u=e.i(519455),f=e.i(793479),h=e.i(590546),p=e.i(86963),g=e.i(664659),y=e.i(655900),j=e.i(37727),b=e.i(487486),v=e.i(515288),N=e.i(511445),w=e.i(991686),k=e.i(393733),S=e.i(149704),C=e.i(16715),q=e.i(868983),M=e.i(111110),T=e.i(41931),R=e.i(201276),$=e.i(294114);function A({paperId:e,question:a,onDone:r}){let{t:i,language:l}=(0,M.b)(),[n,c]=(0,s.useState)(null),m=0===a.attempts.length&&!!a.errorItemId&&"pending"!==a.status,o="ready"===a.status&&!!a.questionText?.trim();if(!m&&!o)return null;let x=async t=>{let s="question"===t?i.exam.regenerateQuestionConfirm:i.exam.regenerateAnswerConfirm;if(await (0,$.u)(s)){c(t);try{let s=await T.f.post(`/api/exams/${e}/questions/${a.id}/regenerate`,{mode:t,language:l},{timeout:6e5,recoverable:!0});r(s)}catch(a){let e=a?.data?.message||"",s=i.errors[e];R.f.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:t,code:e}),$.c.error("HAS_RESULTS"===e?i.exam.regenerateHasResults:"string"==typeof s?s:i.exam.regenerateFailed)}finally{c(null)}}};return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[m&&(0,t.jsxs)(u.f,{variant:"ghost",size:"sm",onClick:()=>x("question"),disabled:null!==n,children:["question"===n?(0,t.jsx)(d.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(C.f,{className:"mr-1 h-4 w-4"}),"question"===n?i.exam.regenerating:i.exam.regenerateQuestion]}),o&&(0,t.jsxs)(u.f,{variant:"ghost",size:"sm",onClick:()=>x("answer"),disabled:null!==n,children:["answer"===n?(0,t.jsx)(d.f,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(q.f,{className:"mr-1 h-4 w-4"}),"answer"===n?i.exam.regenerating:i.exam.regenerateAnswer]})]})}function I({paperId:e,question:r,editingResult:n,onResultChange:c,onDeleteAttempt:m,onRegenerated:o}){let{t:x}=(0,M.b)(),{timeZone:u}=(0,i.M)(),[f,h]=(0,s.useState)(!1),p=void 0!==n,C=(()=>{if(!r.error)return"";if("SOURCE_DELETED"===r.error)return x.exam.sourceDeleted;let e=r.error.split(":")[0].trim(),t=x.errors[e];return"string"==typeof t?t:r.error})();return(0,t.jsx)(v.N,{children:(0,t.jsxs)(v.O,{className:"space-y-3 pt-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[r.order,"."]}),r.errorItemId?(0,t.jsxs)(a.default,{href:`/error-items/${r.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[x.exam.source," ",r.sourceShortId]}):(0,t.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[r.sourceShortId," · ",x.exam.sourceDeleted]}),r.notebookName&&(0,t.jsx)(b.f,{variant:"secondary",children:r.notebookName})]}),r.attempts.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:r.attempts.map((e,s)=>(0,t.jsxs)(b.f,{variant:"outline",className:`gap-1 font-normal ${w.x[e.result]||""}`,children:[(0,t.jsx)("span",{children:x.exam.attemptLabel.replace("{n}",String(s+1))}),(0,t.jsx)("span",{className:"tabular-nums",children:(0,l.r)(e.createdAt,"MM-dd",u)}),(0,t.jsx)("span",{className:"font-semibold",children:x.mastery.results[e.result]}),p&&m&&(0,t.jsx)("button",{type:"button","aria-label":x.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>m(e.id),children:(0,t.jsx)(j.X,{className:"h-3 w-3"})})]},e.id))}),"pending"===r.status&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.f,{className:"h-4 w-4 animate-spin"}),x.exam.questionPending]}),"failed"===r.status&&(0,t.jsxs)("p",{className:"text-sm text-destructive",children:[x.exam.questionFailed,C?`:${C}`:""]}),"ready"===r.status&&r.questionText&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.f,{content:r.questionText}),(0,t.jsx)(S.f,{svg:r.figureSvg}),(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>h(!f),children:[f?(0,t.jsx)(y.f,{className:"h-3 w-3"}):(0,t.jsx)(g.f,{className:"h-3 w-3"}),x.exam.showAnswer]}),f&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[r.answerText&&(0,t.jsx)(N.f,{content:r.answerText,className:"font-semibold"}),r.analysis&&(0,t.jsx)(N.f,{content:r.analysis})]})]}),!p&&o&&(0,t.jsx)(A,{paperId:e,question:r,onDone:o}),p&&"ready"===r.status&&r.errorItemId&&c&&(0,t.jsx)(k.f,{value:n,onChange:c,size:"sm"})]})})}var z=e.i(663661),E=e.i(35209);e.s(["default",0,function(){let{timeZone:e}=(0,i.M)(),g=(0,r.useParams)(),y=(0,r.useRouter)(),{t:j,language:b}=(0,M.b)(),v=g.id,[N,w]=(0,s.useState)(null);(0,E.f)(j.exam.title,N?.title);let[k,S]=(0,s.useState)(!1),[C,q]=(0,s.useState)(null),[R,A]=(0,s.useState)((0,l.r)(new Date,"yyyy-MM-dd",e)),[H,D]=(0,s.useState)(!1),[F,U]=(0,s.useState)(null),O=(0,s.useCallback)(async()=>{try{w(await T.f.get(`/api/exams/${v}`))}catch{S(!0)}},[v]);if((0,s.useEffect)(()=>{O()},[O]),(0,s.useEffect)(()=>{if(N?.status!=="generating")return;let e=setTimeout(O,3e3);return()=>clearTimeout(e)},[N,O]),k)return(0,t.jsx)("div",{className:"p-8 text-center",children:j.exam.notFound});if(!N)return(0,t.jsx)(p.f,{label:j.common.loading});let _=N.questions.filter(e=>"ready"===e.status).length,P=N.questions.some(e=>e.attempts.length>0),V=N.questions.some(e=>"failed"===e.status),K=N.questions.filter(e=>"ready"===e.status&&e.errorItemId),L=C?K.filter(e=>C[e.id]).length:0,B=async()=>{if(C&&0!==L){D(!0),U(null);try{await T.f.post(`/api/exams/${N.id}/results`,{takenAt:(0,l.$)(R,e),results:K.filter(e=>C[e.id]).map(e=>({questionId:e.id,result:C[e.id]}))}),q(null),U(j.exam.resultsSaved),await O()}catch{U(j.exam.resultsSaveFailed)}finally{D(!1)}}},Q=async e=>{if(await (0,$.u)(j.mastery.deleteRecordConfirm,{destructive:!0}))try{await T.f.delete(`/api/practice/record/${e}`),await O()}catch{U(j.mastery.deleteRecordFailed)}},Y=async()=>{await T.f.post(`/api/exams/${N.id}/retry`,{language:b}),await O()},X=async()=>{await (0,$.u)(j.exam.deleteConfirm,{destructive:!0})&&(await T.f.delete(`/api/exams/${N.id}`),y.push("/exams"))};return(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(h.f,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:N.title}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(z.f,{status:N.status,recorded:P}),(0,t.jsx)("span",{children:j.exam.progress.replace("{ready}",String(_)).replace("{total}",String(N.questions.length))}),(0,t.jsx)("span",{children:(0,l.r)(N.createdAt,"yyyy-MM-dd HH:mm",e)})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(a.default,{href:`/exams/${N.id}/print`,children:(0,t.jsxs)(u.f,{variant:"outline",size:"sm",disabled:0===_,children:[(0,t.jsx)(c.f,{className:"mr-2 h-4 w-4"}),j.exam.print]})}),!C&&K.length>0&&(0,t.jsxs)(u.f,{size:"sm",onClick:()=>{U(null),q({}),A((0,l.r)(new Date,"yyyy-MM-dd",e))},children:[(0,t.jsx)(n,{className:"mr-2 h-4 w-4"}),j.exam.recordResults]}),V&&"generating"!==N.status&&(0,t.jsxs)(u.f,{variant:"outline",size:"sm",onClick:Y,children:[(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4"}),j.exam.retryFailed]}),(0,t.jsxs)(u.f,{variant:"ghost",size:"sm",onClick:X,className:"text-red-600 hover:text-red-700 hover:bg-red-50 sm:ml-auto",children:[(0,t.jsx)(x.f,{className:"mr-2 h-4 w-4"}),j.exam.delete]})]}),N.questions.length<N.requestedCount&&(0,t.jsx)("p",{className:"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800",children:j.exam.fewerThanRequested.replaceAll("{actual}",String(N.questions.length))}),F&&(0,t.jsx)("p",{className:"rounded-md border p-3 text-sm",children:F}),C&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:j.exam.takenAt}),(0,t.jsx)(f.f,{id:"exam-taken-at",type:"date",value:R,onChange:e=>A(e.target.value),className:"sm:w-48"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:j.exam.recordHint})]}),(0,t.jsx)("div",{className:"space-y-3",children:N.questions.map(e=>(0,t.jsx)(I,{paperId:N.id,question:e,editingResult:C?C[e.id]??null:void 0,onResultChange:t=>q(s=>s?{...s,[e.id]:t}:s),onDeleteAttempt:Q,onRegenerated:O},e.id))}),C&&(0,t.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===L&&(0,t.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:j.exam.noResultSelected}),(0,t.jsx)(u.f,{variant:"outline",onClick:()=>q(null),disabled:H,children:j.exam.cancel}),(0,t.jsxs)(u.f,{onClick:B,disabled:H||!R||0===L,children:[H?(0,t.jsx)(d.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(o.f,{className:"mr-2 h-4 w-4"}),j.exam.saveResults]})]})})]})})}],591124)},663661,e=>{var t=e.i(843476),s=e.i(487486),a=e.i(111110);let r={generating:"bg-blue-100 text-blue-700 border-blue-200",ready:"bg-indigo-100 text-indigo-700 border-indigo-200",partial:"bg-amber-100 text-amber-700 border-amber-200",failed:"bg-red-100 text-red-700 border-red-200",completed:"bg-green-100 text-green-700 border-green-200"};e.s(["f",0,function({status:e,recorded:i}){let{t:l}=(0,a.b)(),n=i&&("ready"===e||"partial"===e)?"completed":e;return(0,t.jsx)(s.f,{variant:"outline",className:r[n],children:l.exam.status[n]})}])},991686,868983,e=>{var t=e.i(843476),s=e.i(271645),a=e.i(522016),r=e.i(215519),i=e.i(306831),l=e.i(664659),n=e.i(655900),d=e.i(531278),c=e.i(107233),m=e.i(283086),o=e.i(727612),x=e.i(487486),u=e.i(519455),f=e.i(515288),h=e.i(511445),p=e.i(356909),g=e.i(793479),y=e.i(393733),j=e.i(111110),b=e.i(41931);function v({errorItemId:e,onSaved:a,onCancel:l}){let{t:n}=(0,j.b)(),{timeZone:c}=(0,r.M)(),m=(0,i.r)(new Date,"yyyy-MM-dd",c),[o,x]=(0,s.useState)(null),[f,h]=(0,s.useState)(m),[N,w]=(0,s.useState)(!1),[k,S]=(0,s.useState)(null),C=async()=>{if(o&&f){w(!0),S(null);try{await b.f.post("/api/practice/record",{errorItemId:e,result:o,source:"manual",takenAt:(0,i.$)(f,c)}),a()}catch{S(n.mastery.resultSaveFailed)}finally{w(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3 rounded-md border bg-muted/30 p-3",children:[(0,t.jsx)(y.f,{value:o,onChange:x,disabled:N}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:`practice-date-${e}`,className:"text-sm font-medium",children:n.mastery.recordDate}),(0,t.jsx)(g.f,{id:`practice-date-${e}`,type:"date",value:f,max:m,onChange:e=>h(e.target.value),className:"sm:w-48"}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsx)(u.f,{variant:"outline",size:"sm",onClick:l,disabled:N,className:"flex-1 sm:flex-none",children:n.exam.cancel}),(0,t.jsxs)(u.f,{size:"sm",onClick:C,disabled:N||!o||!f,className:"flex-1 sm:flex-none",children:[N?(0,t.jsx)(d.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(p.f,{className:"mr-2 h-4 w-4"}),n.mastery.saveResult]})]})]}),k&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:k})]})}var N=e.i(149704),w=e.i(294114),k=e.i(905110);let S={correct:"bg-green-100 text-green-700 border-green-200",wrong:"bg-red-100 text-red-700 border-red-200",not_attempted:"bg-amber-100 text-amber-700 border-amber-200"};e.s(["K",0,function({errorItemId:e,onMasteryStatusChange:p}){let{timeZone:g}=(0,r.M)(),{t:y}=(0,j.b)(),[C,q]=(0,s.useState)(null),[M,T]=(0,s.useState)(null),[R,$]=(0,s.useState)(0),[A,I]=(0,s.useState)(!1),z=(0,s.useCallback)(()=>{b.f.get(`/api/error-items/${e}/practice-records`).then(e=>{q(e),p?.(e.masteryStatus)}).catch(()=>void 0)},[e,p]);(0,s.useEffect)(z,[z]);let E=()=>{$(0),z()},H=async e=>{if(await (0,w.u)(y.mastery.deleteRecordConfirm,{destructive:!0}))try{await b.f.delete(`/api/practice/record/${e}`),E()}catch{w.c.error(y.mastery.deleteRecordFailed)}},D=C?.records[0],F=!!D&&(!C?.masteryEvaluatedAt||new Date(D.createdAt)>new Date(C.masteryEvaluatedAt));if((0,s.useEffect)(()=>{if(!F||R>=20)return;let e=setTimeout(()=>{$(e=>e+1),z()},4e3);return()=>clearTimeout(e)},[F,R,z]),!C)return null;let U=C.masteryProbability,O=null===U?null:Math.round(100*U),_=null===O?"":(0,k.m)(U,C.masteryThreshold)?"bg-green-500":O>=30?"bg-amber-500":"bg-red-500",P=y.practice.difficulty;return(0,t.jsxs)(f.N,{children:[(0,t.jsx)(f.Y,{children:(0,t.jsxs)(f.v,{className:"flex items-center gap-2 text-base",children:[(0,t.jsx)(m.f,{className:"h-4 w-4 text-primary"}),y.mastery.probability]})}),(0,t.jsxs)(f.O,{className:"space-y-4",children:[null===O?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:F?y.mastery.pending:y.mastery.notEvaluated}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-3xl font-bold",children:[O,"%"]}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[F&&(0,t.jsx)(d.f,{className:"h-3 w-3 animate-spin"}),(0,t.jsx)(x.f,{variant:"outline",children:"ai"===C.masterySource?y.mastery.aiEvaluated:y.mastery.estimated})]})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded-full bg-muted overflow-hidden",children:(0,t.jsx)("div",{className:`h-full ${_} transition-all`,style:{width:`${O}%`}})}),C.masteryReason&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C.masteryReason}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:y.mastery.thresholdHint.replace("{threshold}",String(C.masteryThreshold))})]}),(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold",children:y.mastery.history}),!A&&(0,t.jsxs)(u.f,{variant:"outline",size:"sm",onClick:()=>I(!0),children:[(0,t.jsx)(c.f,{className:"mr-1 h-4 w-4"}),y.mastery.addRecord]})]}),A&&(0,t.jsx)(v,{errorItemId:e,onCancel:()=>I(!1),onSaved:()=>{I(!1),E()}}),0===C.records.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:y.mastery.noHistory}):(0,t.jsx)("ul",{className:"divide-y rounded-md border",children:C.records.map(e=>(0,t.jsxs)("li",{className:"p-3 text-sm space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",onClick:()=>T(M===e.id?null:e.id),children:[(0,t.jsx)("span",{className:"text-muted-foreground tabular-nums",children:(0,i.r)(e.createdAt,"yyyy-MM-dd HH:mm",g)}),(0,t.jsx)(x.f,{variant:"outline",className:S[e.result]||"",children:y.mastery.results[e.result]||e.result}),e.difficulty&&(0,t.jsx)(x.f,{variant:"secondary",children:P[e.difficulty]||e.difficulty}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.exam?`${y.mastery.sources.exam} \xb7 ${e.exam.title}`:y.mastery.sources[e.source]||y.mastery.sources.practice}),e.questionText&&(0,t.jsx)("span",{className:"ml-auto text-muted-foreground",children:M===e.id?(0,t.jsx)(n.f,{className:"h-4 w-4"}):(0,t.jsx)(l.f,{className:"h-4 w-4"})})]}),(0,t.jsx)("button",{type:"button","aria-label":y.mastery.deleteRecord,title:y.mastery.deleteRecord,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-red-50 hover:text-red-600",onClick:()=>H(e.id),children:(0,t.jsx)(o.f,{className:"h-4 w-4"})})]}),M===e.id&&e.questionText&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[(0,t.jsx)(h.f,{content:e.questionText}),(0,t.jsx)(N.f,{svg:e.figureSvg}),e.wrongAnswerText&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.wrongAnswerText}),(0,t.jsx)(h.f,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.mistakeAnalysis}),(0,t.jsx)(h.f,{content:e.mistakeAnalysis})]}),e.originalImageUrl&&(0,t.jsx)("img",{src:e.originalImageUrl,alt:y.editor.wrongAnswerText,className:"max-h-96 max-w-full rounded object-contain"}),e.answerText&&(0,t.jsx)("div",{className:"border-t pt-2",children:(0,t.jsx)(h.f,{content:e.answerText,className:"font-semibold"})}),e.exam&&(0,t.jsx)(a.default,{href:`/exams/${e.exam.paperId}`,className:"text-xs text-primary hover:underline",children:e.exam.title})]})]},e.id))})]})]})]})},"x",0,S],991686);var C=e.i(908821);e.s(["f",()=>C.f],868983)},393733,e=>{var t=e.i(843476),s=e.i(269638);let a=(0,e.i(475254).f)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var r=e.i(373884),i=e.i(111110);let l=[{value:"correct",icon:s.f,active:"border-green-600 bg-green-50 text-green-700"},{value:"wrong",icon:r.f,active:"border-red-600 bg-red-50 text-red-700"},{value:"not_attempted",icon:a,active:"border-amber-600 bg-amber-50 text-amber-700"}];e.s(["f",0,function({value:e,onChange:s,disabled:a,size:r="md"}){let{t:n}=(0,i.b)(),d="sm"===r?"px-2 py-1 text-xs":"px-3 py-2 text-sm";return(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup",children:l.map(({value:i,icon:l,active:c})=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":e===i,disabled:a,onClick:()=>s(i),className:`flex items-center justify-center gap-1 rounded-md border font-medium transition-colors disabled:opacity-60 ${d} ${e===i?c:"border-input hover:bg-muted"}`,children:[(0,t.jsx)(l,{className:"sm"===r?"h-3 w-3":"h-4 w-4"}),n.mastery.results[i]]},i))})}],393733)},149704,e=>{var t=e.i(843476),s=e.i(111110),a=e.i(975157);e.s(["f",0,function({svg:e,className:r}){let{t:i}=(0,s.b)();return e?(0,t.jsx)("figure",{className:(0,a.f)("question-figure my-3",r),children:(0,t.jsx)("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:i.figure.alt,className:"mx-auto block h-auto max-w-full rounded border bg-white p-2",style:{maxHeight:360}})}):null}],149704)},590546,e=>{var t=e.i(843476),s=e.i(618566),a=e.i(519455),r=e.i(871689);e.s(["f",0,function({fallbackUrl:e,className:i}){let l=(0,s.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{l.push(e)},className:i,children:(0,t.jsx)(r.f,{className:"h-5 w-5"})})}])},515288,e=>{var t=e.i(843476),s=e.i(975157);e.s(["N",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,s.f)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...a})},"O",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,s.f)("px-6",e),...a})},"u",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,s.f)("text-muted-foreground text-sm",e),...a})},"Y",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,s.f)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...a})},"v",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,s.f)("leading-none font-semibold",e),...a})}])},86963,e=>{var t=e.i(843476),s=e.i(531278);e.s(["f",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(s.f,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},35209,e=>{var t=e.i(271645),s=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,s.b)(),r=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=r},[r])}])}])})();
@@ -1,33 +0,0 @@
1
- (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,871689,e=>{let t=(0,e.i(475254).f)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["f",0,t],871689)},303281,e=>{let t=(0,e.i(475254).f)("printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);e.s(["f",0,t],303281)},580685,e=>{var t=e.i(843476),a=e.i(271645),n=e.i(618566),s=e.i(440160),i=e.i(303281),r=e.i(519455),l=e.i(257428),c=e.i(590546),o=e.i(511445),d=e.i(149704),m=e.i(111110),x=e.i(35209),u=e.i(41931);let h=`
2
- .exam-sheet { max-width: 210mm; margin: 0 auto; padding: 16px; color: #111; background: #fff; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; line-height: 1.6; }
3
- .exam-sheet h1 { text-align: center; font-size: 22px; margin: 0 0 8px; }
4
- .exam-sheet .exam-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 32px; font-size: 14px; margin-bottom: 20px; }
5
- .exam-sheet .exam-meta span { min-width: 120px; }
6
- .exam-sheet .exam-question { break-inside: avoid; page-break-inside: avoid; padding: 12px 0; border-bottom: 1px dashed #ccc; }
7
- .exam-sheet .exam-question-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
8
- .exam-sheet .exam-source { font-family: ui-monospace, Menlo, monospace; font-weight: 400; font-size: 12px; color: #666; white-space: nowrap; }
9
- .exam-sheet .exam-answer-space { min-height: 120px; }
10
- .exam-sheet .exam-answer-key { break-before: page; page-break-before: always; padding-top: 8px; }
11
- .exam-sheet .exam-answer-key h2 { text-align: center; font-size: 18px; margin: 0 0 12px; }
12
- .exam-sheet .exam-label { font-weight: 600; color: #444; }
13
- .exam-sheet .markdown-content p { margin: 4px 0; }
14
- .exam-sheet .markdown-content img { max-width: 100%; }
15
- .exam-sheet .question-figure { margin: 8px 0; break-inside: avoid; page-break-inside: avoid; }
16
- .exam-sheet .question-figure img { display: block; margin: 0 auto; max-width: 100%; max-height: 360px; background: #fff; }
17
- .exam-sheet .markdown-content table { border-collapse: collapse; }
18
- .exam-sheet .markdown-content td, .exam-sheet .markdown-content th { border: 1px solid #999; padding: 2px 6px; }
19
- @media print { .exam-sheet { padding: 0; max-width: none; } @page { size: A4; margin: 15mm; } }
20
- `;function f(e){return e.replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[e])}e.s(["default",0,function(){let e=(0,n.useParams)(),{t:p,language:g}=(0,m.b)(),[b,k]=(0,a.useState)(null);(0,x.f)(p.exam.title,b?.title,p.pageTitle.examPrint);let[j,w]=(0,a.useState)(!0),y=(0,a.useRef)(null);if((0,a.useEffect)(()=>{u.f.get(`/api/exams/${e.id}`).then(k).catch(()=>k(null))},[e.id]),!b)return(0,t.jsx)("div",{className:"p-8 text-center",children:p.common.loading});let v=b.questions.filter(e=>"ready"===e.status&&e.questionText);return(0,t.jsxs)("main",{className:"min-h-screen bg-white",children:[(0,t.jsx)("style",{children:h}),(0,t.jsx)("div",{className:"print:hidden sticky top-0 z-10 border-b bg-background p-3 shadow-sm",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto flex flex-wrap items-center gap-3",children:[(0,t.jsx)(c.f,{fallbackUrl:`/exams/${b.id}`}),(0,t.jsx)("span",{className:"font-semibold",children:p.exam.printTitle}),(0,t.jsxs)("label",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)(l.f,{checked:j,onCheckedChange:e=>w(!0===e)}),p.exam.includeAnswers]}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsxs)(r.f,{variant:"outline",size:"sm",onClick:()=>{var e;if(!y.current)return;let t=function(e,t,a="zh-CN"){return`<!doctype html>
21
- <html lang="${f(a)}">
22
- <head>
23
- <meta charset="utf-8">
24
- <meta name="viewport" content="width=device-width, initial-scale=1">
25
- <title>${f(e)}</title>
26
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.19.1/dist/katex.min.css">
27
- <style>body { margin: 0; background: #fff; }${h}</style>
28
- </head>
29
- <body>
30
- ${t}
31
- </body>
32
- </html>
33
- `}(b.title,y.current.outerHTML,"en"===g?"en":"zh-CN"),a=URL.createObjectURL(new Blob([t],{type:"text/html;charset=utf-8"})),n=document.createElement("a");n.href=a,e=b.title,n.download=`${e.replace(/[\\/:*?"<>|\s]+/g,"_").slice(0,80)||"exam"}.html`,n.click(),URL.revokeObjectURL(a)},children:[(0,t.jsx)(s.f,{className:"mr-2 h-4 w-4"}),p.exam.downloadHtml]}),(0,t.jsxs)(r.f,{size:"sm",onClick:()=>window.print(),children:[(0,t.jsx)(i.f,{className:"mr-2 h-4 w-4"}),p.exam.printNow]})]}),v.length<b.questions.length&&(0,t.jsx)("p",{className:"w-full text-xs text-muted-foreground",children:p.exam.notReadyHint})]})}),(0,t.jsxs)("div",{ref:y,className:"exam-sheet",children:[(0,t.jsx)("h1",{children:b.title}),(0,t.jsxs)("div",{className:"exam-meta",children:[(0,t.jsxs)("span",{children:[p.exam.nameLine,":________"]}),(0,t.jsxs)("span",{children:[p.exam.dateLine,":________"]}),(0,t.jsxs)("span",{children:[p.exam.scoreLine,":________"]})]}),v.map((e,a)=>(0,t.jsxs)("section",{className:"exam-question",children:[(0,t.jsxs)("div",{className:"exam-question-head",children:[(0,t.jsxs)("span",{children:[a+1,"."]}),(0,t.jsxs)("span",{className:"exam-source",children:[p.exam.sourceLabel,": ",e.sourceShortId]})]}),(0,t.jsx)(o.f,{content:e.questionText}),(0,t.jsx)(d.f,{svg:e.figureSvg}),(0,t.jsx)("div",{className:"exam-answer-space"})]},e.id)),j&&(0,t.jsxs)("section",{className:"exam-answer-key",children:[(0,t.jsx)("h2",{children:p.exam.answerKey}),v.map((e,a)=>(0,t.jsxs)("div",{className:"exam-question",children:[(0,t.jsxs)("div",{className:"exam-question-head",children:[(0,t.jsxs)("span",{children:[a+1,"."]}),(0,t.jsxs)("span",{className:"exam-source",children:[p.exam.sourceLabel,": ",e.sourceShortId]})]}),e.answerText&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"exam-label",children:[p.exam.answerLabel,":"]}),(0,t.jsx)(o.f,{content:e.answerText})]}),e.analysis&&(0,t.jsxs)("div",{children:[(0,t.jsxs)("span",{className:"exam-label",children:[p.exam.analysisLabel,":"]}),(0,t.jsx)(o.f,{content:e.analysis})]})]},e.id))]})]})]})}],580685)},149704,e=>{var t=e.i(843476),a=e.i(111110),n=e.i(975157);e.s(["f",0,function({svg:e,className:s}){let{t:i}=(0,a.b)();return e?(0,t.jsx)("figure",{className:(0,n.f)("question-figure my-3",s),children:(0,t.jsx)("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:i.figure.alt,className:"mx-auto block h-auto max-w-full rounded border bg-white p-2",style:{maxHeight:360}})}):null}],149704)},590546,e=>{var t=e.i(843476),a=e.i(618566),n=e.i(519455),s=e.i(871689);e.s(["f",0,function({fallbackUrl:e,className:i}){let r=(0,a.useRouter)();return(0,t.jsx)(n.f,{variant:"ghost",size:"icon",onClick:()=>{r.push(e)},className:i,children:(0,t.jsx)(s.f,{className:"h-5 w-5"})})}])},257428,e=>{var t=e.i(843476),a=e.i(271645),n=e.i(820783),s=e.i(30030),i=e.i(981140),r=e.i(369340),l=e.i(635804),c=e.i(296626),o=e.i(248425),d=Object.defineProperty,m=(e,t)=>d(e,"name",{value:t,configurable:!0}),x="Checkbox",[u,h]=(0,s.f)(x),[f,p]=u(x);function g(e){let{__scopeCheckbox:n,checked:s,children:i,defaultChecked:l,disabled:c,form:o,name:d,onCheckedChange:m,required:u,value:h="on",internal_do_not_use_render:p}=e,[g,b]=(0,r.f)({prop:s,defaultProp:l??!1,onChange:m,caller:x}),[k,j]=a.useState(null),[w,N]=a.useState(null),[C,_]=a.useState(null),R=!k||!!o||!!k.closest("form"),q={checked:g,disabled:c,setChecked:b,control:k,setControl:j,name:d,form:o,value:h,userClick:C,onUserClick:_,required:u,defaultChecked:!v(l)&&l,isFormControl:R,bubbleInput:w,setBubbleInput:N};return(0,t.jsx)(f,{scope:n,...q,children:y(p)?p(q):i})}m(g,"CheckboxProvider");var b=a.forwardRef(m(function({__scopeCheckbox:e,onKeyDown:s,onClick:r,...l},c){let{control:d,value:x,disabled:u,checked:h,required:f,setControl:g,setChecked:b,onUserClick:k,isFormControl:j,bubbleInput:w}=p("CheckboxTrigger",e),y=(0,n.f)(c,g),C=a.useRef(h);return a.useEffect(()=>{let e=d?.form;if(e){let t=m(()=>b(C.current),"reset");return e.addEventListener("reset",t),()=>e.removeEventListener("reset",t)}},[d,b]),(0,t.jsx)(o.V.button,{type:"button",role:"checkbox","aria-checked":v(h)?"mixed":h,"aria-required":f,"data-state":N(h),"data-disabled":u?"":void 0,disabled:u,value:x,...l,ref:y,onKeyDown:(0,i.f)(s,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,i.f)(r,e=>{let t=e.isPropagationStopped();k({requestedChecked:!!v(h)||!h,hasConsumerStoppedPropagation:t}),b(e=>!!v(e)||!e),w&&j&&!t&&e.stopPropagation()})})},"CheckboxTrigger")),k=a.forwardRef(m(function(e,a){let{__scopeCheckbox:n,name:s,checked:i,defaultChecked:r,required:l,disabled:c,value:o,onCheckedChange:d,form:m,...x}=e;return(0,t.jsx)(g,{__scopeCheckbox:n,checked:i,defaultChecked:r,disabled:c,required:l,onCheckedChange:d,name:s,form:m,value:o,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{...x,ref:a,__scopeCheckbox:n}),e&&(0,t.jsx)(w,{__scopeCheckbox:n})]})})},"Checkbox")),j=a.forwardRef(m(function(e,a){let{__scopeCheckbox:n,forceMount:s,...i}=e,r=p("CheckboxIndicator",n);return(0,t.jsx)(c.f,{present:s||v(r.checked)||!0===r.checked,children:(0,t.jsx)(o.V.span,{"data-state":N(r.checked),"data-disabled":r.disabled?"":void 0,...i,ref:a,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),w=a.forwardRef(m(function({__scopeCheckbox:e,onClick:s,...r},c){let{control:d,userClick:m,checked:x,defaultChecked:u,required:h,disabled:f,name:g,value:b,form:k,bubbleInput:j,setBubbleInput:w}=p("CheckboxBubbleInput",e),y=(0,n.f)(c,w),N=(0,l.f)(d),C=a.useRef(!1),_=a.useRef(x),R=a.useRef(m),q=a.useRef(null);a.useEffect(()=>{if(!j)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let t=_.current!==x;_.current=x;let a=null!==m&&m!==R.current;if(R.current=m,a)q.current=t?null:m,t&&(j.indeterminate=v(x),e.call(j,!v(x)&&x)),j.dispatchEvent(new Event("click",{bubbles:!m.hasConsumerStoppedPropagation}));else if(t){let t=q.current;q.current=null;let a=t?.requestedChecked===x;C.current=!0,j.indeterminate=v(x),e.call(j,!v(x)&&x),j.dispatchEvent(new Event("click",{bubbles:!(a&&t.hasConsumerStoppedPropagation)})),C.current=!1}},[j,x,m]);let E=a.useRef(!v(x)&&x);return(0,t.jsx)(o.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??E.current,required:h,disabled:f,name:g,value:b,form:k,...r,tabIndex:-1,ref:y,onClick:(0,i.f)(s,e=>{C.current&&e.stopPropagation()}),style:{...r.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function y(e){return"function"==typeof e}function v(e){return"indeterminate"===e}function N(e){return v(e)?"indeterminate":e?"checked":"unchecked"}m(y,"isFunction"),m(v,"isIndeterminate"),m(N,"getState");var C=e.i(643531),_=e.i(975157);let R=a.forwardRef(({className:e,...a},n)=>(0,t.jsx)(k,{ref:n,className:(0,_.f)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...a,children:(0,t.jsx)(j,{className:(0,_.f)("flex items-center justify-center text-current"),children:(0,t.jsx)(C.f,{className:"h-4 w-4"})})}));R.displayName=k.displayName,e.s(["f",0,R],257428)},35209,e=>{var t=e.i(271645),a=e.i(111110);e.s(["f",0,function(...e){let{t:n}=(0,a.b)(),s=[n.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=s},[s])}])}])})();
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,204573,e=>{"use strict";var t=e.i(843476),a=e.i(271645),s=e.i(522016),r=e.i(618566),n=e.i(871689),i=e.i(475254);let l=(0,i.f)("file-question-mark",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);var c=e.i(16715),o=e.i(727612),u=e.i(469937),d=e.i(72664),m=e.i(531278),g=e.i(3198),f=e.i(519455),h=e.i(111110),x=e.i(41931),p=e.i(303163),v=e.i(201276);function j({errorItemId:e,commands:s,onUpdate:r}){let{t:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),[c,o]=(0,a.useState)(null),u=async()=>{l(!0),o(null);try{let t=await x.f.post(`/api/error-items/${e}/geogebra`,{},{recoverable:!0});t.suitable&&t.commands.length>0?r({geogebraCommands:JSON.stringify(t.commands)}):o(t.description||n.geogebra.notSuitable)}catch(t){v.f.error("[ErrorDetail]","GeoGebra analysis failed",{error:t});let e=(0,p.d)(t)||(0,p.Z)(t);e.includes("AI_AUTH_ERROR")?o(n.geogebra.authFailed):e.includes("AI_CONNECTION")?o(n.geogebra.connectionFailed):o(n.geogebra.analyzeFailed)}finally{l(!1)}},y=async t=>{await x.f.put(`/api/error-items/${e}`,{geogebraCommands:t}),r({geogebraCommands:t})},b=async()=>{await x.f.delete(`/api/error-items/${e}/geogebra`),r({geogebraCommands:null})};return s?(0,t.jsx)(g.f,{commands:s,height:700,showToolBar:!0,showAlgebraInput:!1,showMenuBar:!1,onRegenerate:u,onSaveCommands:y,onDelete:b}):(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:n.geogebra.title})]}),(0,t.jsx)(f.f,{variant:"outline",size:"sm",onClick:u,disabled:i,children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.f,{className:"mr-2 h-4 w-4"}),n.geogebra.generate]})})]}),c&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:c}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:n.geogebra.hint})]})}function y({src:e,onClose:a}){let{t:s}=(0,h.b)();return e?(0,t.jsx)("div",{className:"fixed inset-0 z-50 bg-black/90 flex items-center justify-center p-4",onClick:a,children:(0,t.jsxs)("div",{className:"relative max-w-7xl max-h-full",children:[(0,t.jsx)("button",{className:"absolute -top-12 right-0 text-white hover:text-gray-300 text-lg font-semibold bg-black/50 px-4 py-2 rounded",onClick:a,children:s.detail?.close||"✕ Close"}),(0,t.jsx)("img",{src:e,alt:"Full size",className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:e=>e.stopPropagation()}),(0,t.jsx)("p",{className:"text-center text-white/70 text-sm mt-4",children:s.detail?.clickOutside||"Click outside to close"})]})}):null}var b=e.i(141176),w=e.i(511445),N=e.i(515288);let k=(0,i.f)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var A=e.i(356909),S=e.i(37727);function C({onClick:e,label:a}){let{t:s}=(0,h.b)();return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:e,children:[(0,t.jsx)(k,{className:"h-4 w-4 mr-1"}),a||s.common?.edit||"Edit"]})}function I({onSave:e,onCancel:a,children:s}){let{t:r}=(0,h.b)();return(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(f.f,{size:"sm",onClick:e,children:[(0,t.jsx)(A.f,{className:"h-4 w-4 mr-1"}),r.common?.save||"Save"]}),(0,t.jsxs)(f.f,{size:"sm",variant:"outline",onClick:a,children:[(0,t.jsx)(S.X,{className:"h-4 w-4 mr-1"}),r.common?.cancel||"Cancel"]}),s]})}function L({title:e,actions:a}){return(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[e,a]})}var E=e.i(294114);function T({read:e,save:t,logLabel:s,successMessage:r,failureMessage:n}){let{t:i}=(0,h.b)(),[l,c]=(0,a.useState)(!1),[o,u]=(0,a.useState)(e),d=async()=>{try{await t(o),c(!1),E.c.success(r||i.common?.messages?.saveSuccess||"Saved successfully")}catch(e){v.f.error("[ErrorDetail]",`Failed to save ${s}`,{error:e}),E.c.error(n||i.common?.messages?.saveFailed||"Save failed")}};return{editing:l,value:o,setValue:u,start:()=>{u(e()),c(!0)},cancel:()=>c(!1),submit:d}}function F({title:e,value:a,onSave:s,logLabel:r,rows:n,placeholder:i,editorLabel:l,emptyText:c,cardClassName:o,titleClassName:u,contentClassName:d,headerActions:m,children:g}){let f=T({read:()=>a||"",save:s,logLabel:r}),h=(0,t.jsx)(b.f,{value:f.value,onChange:f.setValue,placeholder:i,rows:n,className:"w-full font-mono text-sm"});return(0,t.jsxs)(N.N,{className:o,children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{className:u,children:e}),actions:!f.editing&&(0,t.jsxs)("div",{className:"flex flex-wrap justify-end",children:[m,(0,t.jsx)(C,{onClick:f.start})]})})}),(0,t.jsxs)(N.O,{className:"space-y-4",children:[f.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[l?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:l}),h]}):h,(0,t.jsx)(I,{onSave:f.submit,onCancel:f.cancel})]}):!a&&c?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:c}):(0,t.jsx)(w.f,{content:a,className:d}),g]})]})}var M=e.i(624687);function R({item:e,onUpdate:a}){let{t:s}=(0,h.b)(),r=T({read:()=>e.userNotes||"",save:async t=>{await x.f.patch(`/api/error-items/${e.id}/notes`,{userNotes:t}),a({userNotes:t})},logLabel:"notes",successMessage:s.common?.messages?.noteSaveSuccess||"Notes saved successfully"});return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{children:s.detail.yourNotes}),actions:!r.editing&&(0,t.jsx)(C,{onClick:r.start,label:s.detail.editNotes})})}),(0,t.jsx)(N.O,{children:r.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(M.f,{value:r.value,onChange:e=>r.setValue(e.target.value),placeholder:s.detail.notesPlaceholder||"Enter your notes...",rows:5,className:"w-full"}),(0,t.jsx)(I,{onSave:r.submit,onCancel:r.cancel})]}):(0,t.jsx)("div",{className:"whitespace-pre-wrap",children:e.userNotes?(0,t.jsx)("p",{className:"text-foreground",children:e.userNotes}):(0,t.jsx)("p",{className:"text-muted-foreground italic",children:s.detail.noNotes})})})]})}var z=e.i(149704);let $=(0,i.f)("shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);function O({errorItemId:e,onDone:s}){let{t:r}=(0,h.b)(),[n,i]=(0,a.useState)(!1),l=async()=>{i(!0);try{let t=await x.f.post(`/api/error-items/${e}/figure`,{},{recoverable:!0});s(t),t.figureSvg||E.c.warning(r.figure.noFigure)}catch(a){let e=a?.data?.message||"",t=r.errors[e];v.f.error("[RegenerateFigure]","Failed to regenerate figure",{code:e}),E.c.error("NO_ORIGINAL_IMAGE"===e?r.figure.noImage:"string"==typeof t?t:r.figure.failed)}finally{i(!1)}};return(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:l,disabled:n,className:"flex items-center gap-2",children:[n?(0,t.jsx)(m.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)($,{className:"h-4 w-4"}),n?r.figure.regenerating:r.figure.regenerate]})}let U=(0,i.f)("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);var D=e.i(12130),q=e.i(28928);function V({errorItemId:e,hasImage:s,onDone:r}){let{t:n}=(0,h.b)(),i=(0,a.useRef)(null),[l,c]=(0,a.useState)(!1),[o,u]=(0,a.useState)(null);(0,a.useEffect)(()=>()=>{o&&URL.revokeObjectURL(o)},[o]);let d=async()=>{(!s||await (0,E.u)(n.replaceImage.confirm))&&i.current?.click()},g=async t=>{u(null),c(!0);try{let a=new File([t],"question-image.jpg",{type:t.type||"image/jpeg"}),s=await (0,q.f)(a),i=await x.f.put(`/api/error-items/${e}/image`,{imageDataUrl:s});r(i.originalImageUrl),E.c.success(n.replaceImage.done)}catch(t){let e=t?.data?.message||"";v.f.error("[ReplaceImage]","Failed to replace original image",{code:e}),E.c.error("INVALID_IMAGE"===e?n.replaceImage.invalid:n.replaceImage.failed)}finally{c(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:i,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",className:"hidden",onChange:e=>{(e=>{if(e){if(!e.type.startsWith("image/"))return E.c.error(n.replaceImage.invalid);u(URL.createObjectURL(e))}})(e.target.files?.[0]),e.target.value=""}}),o&&(0,t.jsx)(D.f,{imageSrc:o,open:!0,onClose:()=>u(null),onCropComplete:g}),(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:d,disabled:l,className:"flex items-center gap-2",children:[l?(0,t.jsx)(m.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(U,{className:"h-4 w-4"}),l?n.replaceImage.uploading:s?n.replaceImage.replace:n.replaceImage.add]})]})}var _=e.i(438465),P=e.i(793479),H=e.i(967489),G=e.i(943710);function B({item:e,onChanged:a}){let{t:s}=(0,h.b)(),r=s.common?.notSet||"Not set",n=T({read:()=>({subjectId:e.subjectId||null,gradeSemester:e.gradeSemester||"",paperLevel:e.paperLevel||(0,G.f)(e.difficultyStars)||"a"}),save:async t=>{await x.f.put(`/api/error-items/${e.id}`,{...t,subjectId:t.subjectId||null}),await a()},logLabel:"metadata",successMessage:s.common?.messages?.metaUpdateSuccess||"Metadata updated successfully!",failureMessage:s.common?.messages?.updateFailed||"Update failed"}),i=e=>n.setValue({...n.value,...e});return(0,t.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,t.jsx)(L,{title:(0,t.jsx)("h4",{className:"text-sm font-semibold",children:s.detail?.questionInfo||"Question Info"}),actions:!n.editing&&(0,t.jsx)(C,{onClick:n.start})}),n.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:s.notebooks?.title||"Notebook"}),(0,t.jsx)(_.f,{value:n.value.subjectId||void 0,onChange:e=>i({subjectId:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:s.filter.grade}),(0,t.jsx)(P.f,{value:n.value.gradeSemester,onChange:e=>i({gradeSemester:e.target.value}),placeholder:s.notebook?.gradeSemesterPlaceholder||"e.g. Grade 7, Semester 1"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:s.filter.paperLevel}),(0,t.jsxs)(H.d,{value:n.value.paperLevel,onValueChange:e=>i({paperLevel:e}),children:[(0,t.jsx)(H.P,{children:(0,t.jsx)(H.U,{})}),(0,t.jsxs)(H.r,{children:[(0,t.jsx)(H.T,{value:"a",children:s.editor.paperLevels?.a||"Paper A"}),(0,t.jsx)(H.T,{value:"b",children:s.editor.paperLevels?.b||"Paper B"}),(0,t.jsx)(H.T,{value:"other",children:s.editor.paperLevels?.other||"Other"})]})]})]}),(0,t.jsx)(I,{onSave:n.submit,onCancel:n.cancel})]}):(0,t.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[s.notebooks?.title||"Notebook",":"]}),(0,t.jsx)("span",{className:"font-medium",children:e.subject?.name||r})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[s.filter.grade,":"]}),(0,t.jsx)("span",{className:"font-medium",children:e.gradeSemester||r})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[s.filter.paperLevel,":"]}),(0,t.jsx)("span",{className:"font-medium",children:e.paperLevel?s.editor.paperLevels?.[e.paperLevel]||e.paperLevel:r})]})]})]})}var W=e.i(487486),Z=e.i(283086);function X({errorItemId:e,onDone:s,onSuggested:r}){let{t:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),c=async()=>{l(!0);try{if(r){let t=await x.f.post(`/api/error-items/${e}/retag`,{preview:!0},{recoverable:!0});r(t.tags)}else await x.f.post(`/api/error-items/${e}/retag`,{},{recoverable:!0}),s?.()}catch(a){let e=a?.data?.message||"",t=n.errors[e];v.f.error("[RetagItem]","Failed to regenerate tags",{code:e}),E.c.error("NO_TAGS_SELECTED"===e?n.retag.noTags:"string"==typeof t?t:n.retag.itemFailed)}finally{l(!1)}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:c,disabled:i,children:[i?(0,t.jsx)(m.f,{className:"h-4 w-4 mr-1 animate-spin"}):(0,t.jsx)(Z.f,{className:"h-4 w-4 mr-1"}),r?i?n.retag.suggestRunning:n.retag.suggestButton:i?n.retag.itemRunning:n.retag.itemButton]})}var K=e.i(574041),Q=e.i(952122),Y=e.i(990745);function J({item:e,educationStage:a,onChanged:s}){let{t:r}=(0,h.b)(),n=(0,Y.f)(e),i=T({read:()=>(0,Y.f)(e),save:async t=>{await x.f.put(`/api/error-items/${e.id}`,{knowledgePoints:t}),await s()},logLabel:"tags",successMessage:r.common?.messages?.tagUpdateSuccess||"Tags updated successfully!",failureMessage:r.common?.messages?.updateFailed||"Update failed"});return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(L,{title:(0,t.jsx)("h4",{className:"text-sm font-semibold",children:r.editor?.tags||"Knowledge Tags"}),actions:!i.editing&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(X,{errorItemId:e.id,onDone:s}),(0,t.jsx)(C,{onClick:i.start})]})}),i.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(K.f,{value:i.value,onChange:i.setValue,placeholder:r.editor?.tagsPlaceholder||"Enter or select knowledge tags...",subject:(0,Q.f)(e.subject?.name||null)||void 0,gradeStage:a}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r.editor?.tagsHint||"Select from standard or custom tags"}),(0,t.jsx)(I,{onSave:i.submit,onCancel:i.cancel,children:(0,t.jsx)(X,{errorItemId:e.id,onSuggested:i.setValue})})]}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,t.jsx)(W.f,{variant:"secondary",children:e},e))})]})}var ee=e.i(77705);let et=(0,i.f)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);function ea({src:e,alt:a,showLabel:s,hideLabel:r,visible:n,onVisibleChange:i,onEnlarge:l,variant:c="ghost",actions:o}){let{t:u}=(0,h.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[e&&(0,t.jsx)(f.f,{variant:c,size:"sm",onClick:()=>i(!n),className:`flex items-center gap-2 ${"ghost"===c?"text-muted-foreground":""}`,children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee.f,{className:"h-4 w-4"}),r]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(et,{className:"h-4 w-4"}),s]})}),o]}),e&&n&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("img",{src:e,alt:a,className:"w-full rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>l(e)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 text-center",children:u.detail?.clickToEnlarge||"Click to enlarge"})]})]})}function es({item:e,educationStage:s,saveFields:r,onUpdate:n,reload:i,onEnlarge:l}){let{t:c}=(0,h.b)(),[o,u]=(0,a.useState)(!1),d=T({read:()=>e.questionText,save:e=>r({questionText:e}),logLabel:"question"});return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{children:c.detail.question}),actions:!d.editing&&(0,t.jsx)(C,{onClick:d.start})})}),(0,t.jsxs)(N.O,{className:"space-y-4",children:[d.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(b.f,{value:d.value,onChange:d.setValue,placeholder:"Enter question text...",rows:8,className:"w-full font-mono text-sm"}),(0,t.jsx)(I,{onSave:d.submit,onCancel:d.cancel})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.f,{content:e.questionText}),(0,t.jsx)(z.f,{svg:e.figureSvg})]}),(0,t.jsx)(J,{item:e,educationStage:s,onChanged:i}),(0,t.jsx)(B,{item:e,onChanged:i}),(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)(ea,{src:e.originalImageUrl,alt:c.detail.originalProblem||"Original Problem",showLabel:c.replaceImage?.view||"View original image",hideLabel:c.replaceImage?.hide||"Hide original image",variant:"outline",visible:o,onVisibleChange:u,onEnlarge:l,actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{errorItemId:e.id,hasImage:!!e.originalImageUrl,onDone:e=>{n({originalImageUrl:e}),u(!0)}}),e.originalImageUrl&&(0,t.jsx)(O,{errorItemId:e.id,onDone:n})]})})})]})]})}var er=e.i(62825);function en({item:e,saveFields:s,onEnlarge:r}){let{t:n,language:i}=(0,h.b)(),[l,c]=(0,a.useState)(!1),o=T({read:()=>({text:e.wrongAnswerText||"",status:e.mistakeStatus||"unknown"}),save:({text:e,status:t})=>s({wrongAnswerText:e,mistakeStatus:(0,er.x)(t,e)}),logLabel:"wrong answer"});return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{children:n.editor?.wrongAnswerText||"Wrong Answer / Work"}),actions:!o.editing&&(0,t.jsx)(C,{onClick:o.start})})}),(0,t.jsx)(N.O,{className:"space-y-4",children:o.editing?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:n.editor?.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(H.d,{value:o.value.status,onValueChange:e=>o.setValue({...o.value,status:e}),children:[(0,t.jsx)(H.P,{children:(0,t.jsx)(H.U,{})}),(0,t.jsxs)(H.r,{children:[(0,t.jsx)(H.T,{value:"not_attempted",children:n.editor?.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(H.T,{value:"wrong_attempt",children:n.editor?.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(H.T,{value:"unknown",children:n.editor?.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:n.editor?.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(b.f,{value:o.value.text,onChange:e=>o.setValue({text:e,status:e.trim()?"wrong_attempt":o.value.status}),rows:5,className:"w-full font-mono text-sm"})]}),(0,t.jsx)(I,{onSave:o.submit,onCancel:o.cancel})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(W.f,{variant:"secondary",children:(0,er.i)(e.mistakeStatus,i)}),e.wrongAnswerText?(0,t.jsx)(w.f,{content:e.wrongAnswerText}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:n.detail?.noMistakeAnalysis||"No mistake analysis yet."}),e.wrongAnswerImageUrl&&(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)(ea,{src:e.wrongAnswerImageUrl,alt:n.detail.wrongAnswerImageAlt,showLabel:n.detail.viewImage,hideLabel:n.detail.hideImage,visible:l,onVisibleChange:c,onEnlarge:r})})]})})]})}let ei=(0,i.f)("square-function",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);var el=e.i(716400),ec=e.i(369939);let eo=new Set(["ne","neq","nabla","nu","not","notin","ni","nexists","ngeq","nleq","nmid","nparallel","nsubseteq"]);function eu(e){return e.length>80?`${e.slice(0,80)}…`:e}let ed=["questionText","answerText","analysis","wrongAnswerText","mistakeAnalysis"];function em({errorItemId:e,fields:s,onDone:r}){let{t:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),c=(0,a.useMemo)(()=>Object.values(function(e){let t={};for(let a of ed){let s=function(e){if(!e?.trim())return[];let{masked:t,segments:a}=(0,ec.F)(e),s=[];for(let e of a)try{el.f.renderToString(e.tex,{displayMode:e.displayMode,throwOnError:!0,strict:"ignore"})}catch(a){let t=a instanceof Error?a.message.replace(/^KaTeX parse error:\s*/,""):String(a);s.push({snippet:eu(e.source),message:t})}let r=t.replace(/@@MATH\d+@@/g," "),n=r.replace(/\\\$/g,"").match(/\$/g);n&&s.push({snippet:"$",message:`有 ${n.length} 个未配对的 $ 定界符`});let i=r.match(/\\[()[\]]/g);i&&s.push({snippet:i.join(" "),message:"有未配对的 \\( \\) 或 \\[ \\] 定界符"});let l=[...new Set(r.match(/\\[a-zA-Z]{2,}/g)||[])].filter(e=>!e.startsWith("\\n")||eo.has(e.slice(1)));return l.length>0&&s.push({snippet:eu(l.join(" ")),message:"LaTeX 命令没有放在 $…$ 中,会原样显示"}),s}(e[a]);s.length>0&&(t[a]=s)}return t}(s)).reduce((e,t)=>e+(t?.length??0),0),[s]),o=async()=>{l(!0);try{let t=await x.f.post(`/api/error-items/${e}/fix-latex`,{},{timeout:3e5,recoverable:!0});r(t.updated);let a=t.fixedFields.map(e=>n.fixLatex.fields[e]).join("、");E.c.info(0===t.issuesBefore?n.fixLatex.noIssues:0===t.fixedFields.length?n.fixLatex.notFixed:0===t.issuesAfter?n.fixLatex.fixedAll.replace("{fields}",a):n.fixLatex.fixedPartly.replace("{fields}",a).replace("{count}",String(t.issuesAfter)))}catch(a){let e=a?.data?.message||"",t=n.errors[e];v.f.error("[FixLatex]","Failed to fix LaTeX",{code:e}),E.c.error("string"==typeof t?t:n.fixLatex.failed)}finally{l(!1)}};return 0!==c||i?(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:o,disabled:i,className:"border-amber-500 text-amber-700 dark:text-amber-400",title:n.fixLatex.issuesFound.replace("{count}",String(c)),children:[i?(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(ei,{className:"mr-2 h-4 w-4"}),i?n.fixLatex.running:n.fixLatex.button,!i&&c>0&&(0,t.jsxs)("span",{className:"ml-1",children:["(",c,")"]})]}):null}var eg=e.i(991686),ef=e.i(846968),eh=e.i(868983);function ex({errorItemId:e,onDone:s}){let{t:r,language:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),c=async()=>{if(await (0,E.u)(r.reanswerItem.confirm)){l(!0);try{let t=await x.f.post(`/api/error-items/${e}/reanswer`,{language:n},{timeout:6e5,recoverable:!0});s(t)}catch(a){let e=a?.data?.message||"",t=r.errors[e];v.f.error("[RegenerateAnswer]","Failed to regenerate answer",{code:e}),E.c.error("NO_QUESTION_TEXT"===e?r.reanswerItem.noQuestionText:"string"==typeof t?t:r.reanswerItem.failed)}finally{l(!1)}}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:c,disabled:i,children:[i?(0,t.jsx)(m.f,{className:"h-4 w-4 mr-1 animate-spin"}):(0,t.jsx)(eh.f,{className:"h-4 w-4 mr-1"}),i?r.reanswerItem.running:r.reanswerItem.button]})}var ep=e.i(643531);let ev=(0,i.f)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function ej({shortId:e,className:s=""}){let{t:r}=(0,h.b)(),[n,i]=(0,a.useState)(!1);if(!e)return null;let l=async t=>{t.preventDefault(),t.stopPropagation();try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{window.prompt(r.shortId.copy,e)}};return(0,t.jsxs)("button",{type:"button",onClick:l,title:n?r.shortId.copied:r.shortId.copy,className:`inline-flex items-center gap-1 rounded-md border bg-muted/50 px-2 py-0.5 font-mono text-xs text-muted-foreground hover:text-foreground transition-colors ${s}`,children:[(0,t.jsx)("span",{children:r.shortId.label}),(0,t.jsx)("span",{className:"font-semibold text-foreground",children:e}),n?(0,t.jsx)(ep.f,{className:"h-3 w-3 text-green-600"}):(0,t.jsx)(ev,{className:"h-3 w-3"})]})}let ey=(0,i.f)("audio-lines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]),eb=(0,i.f)("clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]),ew=(0,i.f)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),eN=(0,i.f)("minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),ek=(0,i.f)("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);var eA=e.i(431343),eS=e.i(367240);let eC=(0,i.f)("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),eI=(0,i.f)("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);var eL=e.i(975157);function eE({supported:e,enabled:a,rate:s,fullscreen:r,onToggle:n,onCycleRate:i}){let{t:l}=(0,h.b)(),c=(0,eL.f)("h-8 shrink-0",r&&"text-white hover:bg-white/20 hover:text-white"),o=e?a?l.svgAnimation.voiceOff:l.svgAnimation.voiceOn:l.svgAnimation.voiceUnsupported;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{title:o,className:"shrink-0",children:(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)(c,"w-8 p-0",a&&e&&!r&&"text-primary"),onClick:n,disabled:!e,"aria-label":o,"aria-pressed":a&&e,children:a&&e?(0,t.jsx)(eC,{className:"h-4 w-4"}):(0,t.jsx)(eI,{className:"h-4 w-4"})})}),a&&e&&(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)(c,"px-1.5 text-xs tabular-nums"),onClick:i,"aria-label":l.svgAnimation.voiceRate,title:l.svgAnimation.voiceRate,children:[s,"×"]})]})}let eT=/<metadata\b[^>]*\bid\s*=\s*["']narration["'][^>]*>([\s\S]*?)<\/metadata\s*>/gi,eF={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function eM(e){let t=e;if("string"==typeof t){let e=t.indexOf("["),a=t.lastIndexOf("]");if(-1===e||a<e)return null;try{t=JSON.parse(t.slice(e,a+1))}catch{return null}}if(!Array.isArray(t))return null;let a=[];for(let e of t){if(!e||"object"!=typeof e)continue;let{begin:t,text:s}=e,r="number"==typeof t?t:"string"==typeof t?eO(t):null;if(null===r||!Number.isFinite(r)||r<0||"string"!=typeof s)continue;let n=s.replace(/\s+/g," ").trim();n&&a.push({begin:Math.round(100*r)/100,text:n})}a.sort((e,t)=>e.begin-t.begin);let s=[];for(let e of a){let t=s[s.length-1];t&&t.begin===e.begin?t.text=`${t.text} ${e.text}`:s.push({...e})}let r=s.slice(0,20).map(e=>({...e,text:e.text.slice(0,300)}));return r.length>0?r:null}function eR(e){for(let t of e.matchAll(eT)){let e=eM(t[1].replace(/&(#x[0-9a-f]+|#\d+|lt|gt|amp|quot|apos);/gi,(e,t)=>{if("#"!==t[0])return eF[t.toLowerCase()];let a="x"===t[1]||"X"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1));return Number.isFinite(a)&&a<=1114111?String.fromCodePoint(a):e}));if(e)return e}return null}let ez=/<(?:animate|animateTransform|animateMotion|set)\b[^>]*>/gi;function e$(e,t){let a=e.match(RegExp(`\\s${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i"));return a?(a[2]??a[3]??"").trim():null}function eO(e){if(!e)return null;let t=e.trim(),a=t.match(/^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?)$/);if(a)return 3600*Number(a[1]??0)+60*Number(a[2])+Number(a[3]);let s=t.match(/^(\d+(?:\.\d+)?)(h|min|s|ms)?$/);if(!s)return null;let r={h:3600,min:60,s:1,ms:.001}[s[2]??"s"]??1;return Number(s[1])*r}let eU=new Set(["opacity","visibility","display","fill-opacity"]);function eD(e){let t=e.getAttribute("viewBox")?.split(/[\s,]+/).map(Number),a=t?.length===4&&t[3]>0?t[1]+t[3]:parseFloat(e.getAttribute("height")??"");if(!(a>0))return null;let s=t?.length===4?t[1]+.78*t[3]:.78*a,r=[];for(let t of Array.from(e.querySelectorAll("text"))){if(t.closest("defs, metadata"))continue;let a=parseFloat(t.getAttribute("y")??t.querySelector("tspan[y]")?.getAttribute("y")??"");if(!(a>=s))continue;let n=Array.from(t.querySelectorAll("tspan")),i=(n.length>0?n.map(e=>e.textContent??"").join(" "):t.textContent??"").replace(/\s+/g," ").trim(),l=function(e,t){for(let a=e;a&&a!==t;a=a.parentElement)for(let e of Array.from(a.children)){let t=e.localName;if("set"!==t&&"animate"!==t)continue;let a=e.getAttribute("attributeName")??"";if(eU.has(a)&&!function(e,t){if(null===t)return!1;let a=t.trim();return"visibility"===e?"hidden"===a:"display"===e?"none"===a:0===Number(a)}(a,e.getAttribute("to")??e.getAttribute("values")?.split(";").pop()??null))return eO((e.getAttribute("begin")??"0").split(";")[0])}return 0}(t,e);i&&null!==l&&r.push({begin:l,y:a,text:i})}return r.sort((e,t)=>e.begin-t.begin||e.y-t.y),eM(r.map(({begin:e,text:t})=>({begin:e,text:t})))}var eq=e.i(79058);let eV=[1,1.25,1.5,.75],e_="svg-narration-enabled",eP="svg-narration-rate";function eH(e){try{return localStorage.getItem(e)}catch{return null}}function eG(e,t){try{localStorage.setItem(e,t)}catch{}}let eB={zh:["zh","cmn"],en:["en"]};function eW(){return"speechSynthesis"in window&&"u">typeof SpeechSynthesisUtterance?window.speechSynthesis:null}let eZ=!1;function eX(){let e=eW();if(!e||eZ)return;eZ=!0;let t=new SpeechSynthesisUtterance(" ");t.volume=0,e.speak(t)}function eK(e,t){return Math.max(8e3,400*e.length/t+5e3)}function eQ(e,t){let a=-1;for(let s=0;s<e.length&&e[s].begin<=t+.05;s++)a=s;return a}function eY(e){let t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function eJ({svg:e}){let{t:s,language:r}=(0,h.b)(),n=(0,a.useRef)(null),i=(0,a.useRef)(null),l=(0,a.useRef)(null),[c,o]=(0,a.useState)(!1),[u,d]=(0,a.useState)(0),[m,g]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),v=m||x,j=(0,a.useMemo)(()=>(function(e){let t=0;for(let a of e.match(ez)||[]){let e=e$(a,"begin"),s=null===e?0:eO(e.split(";")[0]);if(null===s)continue;let r=e$(a,"repeatCount");if("indefinite"!==r&&"indefinite"!==e$(a,"repeatDur"))t=Math.max(t,s+(eO(e$(a,"dur"))??0)*(r&&Number.isFinite(Number(r))?Number(r):1))}return t})(e),[e]),y=(0,a.useMemo)(()=>(function(e){let t=e.match(/<svg\b[^>]*>/i)?.[0]??"",a=e$(t,"viewBox")?.split(/[\s,]+/).map(Number);if(a?.length===4&&a[2]>0&&a[3]>0)return a[2]/a[3];let s=parseFloat(e$(t,"width")??""),r=parseFloat(e$(t,"height")??"");return s>0&&r>0?s/r:1.6})(e),[e]),b=(0,a.useMemo)(()=>`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:"><style>html,body{margin:0;height:100%;background:#fff;overflow:hidden}svg{display:block;width:100%;height:100%}</style></head><body>${e}</body></html>`,[e]),w=(0,a.useMemo)(()=>eR(e),[e]),[N,k]=(0,a.useState)(null),A=w??N,S=(0,a.useCallback)(()=>{let e=i.current?.contentDocument;return"function"==typeof e?.getAnimations?e.getAnimations():[]},[]),C=function({segments:e,language:t,holdAnimation:s}){let[r,n]=(0,a.useState)(!1),[i,l]=(0,a.useState)("browser"),[c,o]=(0,a.useState)(!1),[u,d]=(0,a.useState)(1),[m,g]=(0,a.useState)(!1),[f,h]=(0,a.useState)(!1),x=(0,a.useRef)(void 0),p=(0,a.useRef)(-1),v=(0,a.useRef)(!1),j=(0,a.useRef)(null),y=(0,a.useRef)(0),b=(0,a.useRef)(null),w=(0,a.useRef)(null),N=(0,a.useRef)(!1),k=(0,a.useRef)("browser"),A=(0,a.useRef)(!1),S=(0,a.useRef)(1),C=(0,a.useRef)(s);(0,a.useEffect)(()=>{C.current=s},[s]),(0,a.useEffect)(()=>{A.current="1"===eH(e_),o(A.current);let e=Number(eH(eP));eV.includes(e)&&(S.current=e,d(e))},[]),(0,a.useEffect)(()=>{let e=!0;return(0,eq.v)().then(t=>{e&&(k.current=t,l(t))}),()=>{e=!1}},[]),(0,a.useEffect)(()=>{let e=eW();if(!e)return;let a=()=>{let a,s,r,i=e.getVoices();a=eB[t],s=i.filter(e=>a.some(t=>e.lang.toLowerCase().startsWith(t))),r="zh"===t?/^(zh|cmn)[-_](cn|hans)/i:/^en[-_]us/i,x.current=s.find(e=>r.test(e.lang)&&e.localService)??s.find(e=>r.test(e.lang))??s[0],n(0===i.length||!!x.current)};return a(),e.addEventListener?.("voiceschanged",a),()=>e.removeEventListener?.("voiceschanged",a)},[t]);let I=(0,a.useCallback)(()=>{N.current&&(N.current=!1,null===j.current&&(h(!1),C.current(!1)))},[]),L=(0,a.useCallback)(a=>{let s,r=e?.[a];if(!r)return;let n=y.current,i={},l=()=>n===y.current&&b.current===i,c=e=>{clearTimeout(s),s=setTimeout(o,e)};function o(){clearTimeout(s),l()&&(b.current=null,w.current=null,v.current=!1,g(!1),I(),null!==j.current&&(j.current=null,h(!1),C.current(!1)))}let u=!1,d=()=>{if(!l()||u)return;u=!0,I();let e=eW();if(!e)return void o();let a=new SpeechSynthesisUtterance(r.text);a.lang=x.current?.lang??("en"===t?"en-US":"zh-CN"),x.current&&(a.voice=x.current),a.rate=S.current,a.onend=o,a.onerror=o,a.onstart=()=>c(eK(r.text,a.rate)),c(2500),w.current=a,e.speak(a)};if(b.current=i,v.current=!0,g(!0),"cloud"!==k.current)return void d();let m=e?.[a+1];m&&(0,eq.U)(m.text,t).catch(()=>void 0);let f=setTimeout(()=>{l()&&null===j.current&&(N.current=!0,h(!0),C.current(!0))},300);(0,eq.U)(r.text,t).then(e=>{let t=(0,eq.l)();if(!l())return;if(!t){clearTimeout(f),d();return}let a=e=>()=>{l()&&!u&&e()};t.onplaying=a(()=>{clearTimeout(f),I(),c(eK(r.text,t.playbackRate))}),t.onended=a(o),t.onerror=a(d),t.src=e,t.playbackRate=S.current,c(8e3),t.play().catch(a(()=>{clearTimeout(f),d()}))},()=>{clearTimeout(f),d()})},[e,t,I]),E=(0,a.useCallback)(t=>{y.current++,b.current=null,w.current=null,v.current=!1,g(!1),(null!==j.current||N.current)&&(j.current=null,N.current=!1,h(!1),C.current(!1)),p.current=e?eQ(e,t)-1:-1,eW()?.cancel(),"cloud"===k.current&&(0,eq.l)()?.pause()},[e]),T=(0,a.useCallback)(t=>{if(!A.current||!e?.length||null!==j.current)return;if(v.current){let a=p.current+1;if(a>=e.length)return;let s=a>0?e[a].begin-e[a-1].begin:e[a].begin;if(t<e[a].begin-Math.min(.8,s/2))return;j.current=a,h(!0),C.current(!0);return}let a=eQ(e,t);a<=p.current||(p.current=a,L(a))},[e,L]),F=(0,a.useCallback)(()=>{A.current&&(eX(),"cloud"===k.current&&(0,eq.p)())},[]),M=(0,a.useCallback)((e,t)=>{E(t),A.current=e,o(e),eG(e_,e?"1":"0"),F()},[E,F]),R=(0,a.useCallback)(()=>{let e=eV[(eV.indexOf(S.current)+1)%eV.length];if(S.current=e,d(e),"cloud"===k.current){let t=(0,eq.l)();t&&(t.playbackRate=e)}eG(eP,String(e))},[]);return(0,a.useEffect)(()=>{let e="cloud"===i&&!(0,eq.h)();if(!c||(eZ||!eW())&&!e)return;let t=()=>{eX(),e&&(0,eq.p)()};return document.addEventListener("click",t,{capture:!0,once:!0}),document.addEventListener("touchend",t,{capture:!0,once:!0}),()=>{document.removeEventListener("click",t,{capture:!0}),document.removeEventListener("touchend",t,{capture:!0})}},[c,i]),(0,a.useEffect)(()=>{c&&"cloud"===i&&e?.length&&e.slice(0,2).forEach(e=>(0,eq.U)(e.text,t).catch(()=>void 0))},[c,i,e,t]),(0,a.useEffect)(()=>()=>{y.current++,eW()?.cancel(),"cloud"===k.current&&(0,eq.l)()?.pause()},[e]),{supported:r||"cloud"===i,enabled:c,rate:u,speaking:m,holding:f,setEnabled:M,cycleRate:R,update:T,stop:E,prime:F}}({segments:A,language:r,holdAnimation:(0,a.useCallback)(e=>{e?l.current?.pauseAnimations():l.current?.unpauseAnimations(),S().forEach(t=>e?t.pause():t.play())},[S])}),I=C.enabled&&(C.holding||!c&&C.speaking),{stop:L,update:E,prime:T}=C,F=(0,a.useCallback)(()=>{l.current?.pauseAnimations(),S().forEach(e=>e.pause()),o(!1)},[S]),M=(0,a.useCallback)(()=>{L(l.current?.getCurrentTime()??0),F()},[F,L]),R=(0,a.useCallback)(e=>{l.current?.setCurrentTime(e),S().forEach(t=>{t.currentTime=1e3*e}),d(e),L(e)},[S,L]),z=(0,a.useCallback)(()=>{let e=l.current;e&&(j>0&&e.getCurrentTime()>=j&&R(0),e.unpauseAnimations(),S().forEach(e=>e.play()),o(!0),T())},[S,j,R,T]),$=async()=>{if(x)return void p(!1);if(document.fullscreenElement)return void await document.exitFullscreen().catch(()=>void 0);let e=n.current;if(e&&"function"==typeof e.requestFullscreen)try{await e.requestFullscreen();return}catch{}p(!0)};return(0,a.useEffect)(()=>{let e=()=>g(document.fullscreenElement===n.current);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,a.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&p(!1)},t=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",e),()=>{document.body.style.overflow=t,document.removeEventListener("keydown",e)}},[x]),(0,a.useEffect)(()=>{if(!c)return;let e=0,t=()=>{let a=l.current?.getCurrentTime()??0;if(E(a),j>0&&a>=j){l.current?.setCurrentTime(j),F(),d(j);return}d(a),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[c,j,F,E]),(0,t.jsxs)("div",{ref:n,className:(0,eL.f)("space-y-2",v&&"flex flex-col items-center justify-center bg-black p-4",x&&"fixed inset-0 z-50"),children:[(0,t.jsx)("iframe",{ref:i,srcDoc:b,sandbox:"allow-same-origin",title:s.svgAnimation.alt,onLoad:()=>{l.current=i.current?.contentDocument?.querySelector("svg")??null,k(l.current?eD(l.current):null),L(0),d(0),o(!!l.current)},className:(0,eL.f)("mx-auto block rounded border bg-white transition-shadow",!v&&"w-full max-w-3xl",I&&"border-primary ring-2 ring-primary/40"),style:v?{aspectRatio:y,width:`min(100%, calc((100dvh - 96px) * ${y}))`}:{aspectRatio:y}}),(0,t.jsxs)("div",{className:(0,eL.f)("mx-auto flex w-full items-center gap-2",v?"max-w-5xl text-white":"max-w-3xl"),children:[(0,t.jsx)(f.f,{variant:"outline",size:"sm",className:"h-8 w-8 shrink-0 p-0 text-foreground",onClick:c?M:z,"aria-label":c?s.svgAnimation.pause:s.svgAnimation.play,title:c?s.svgAnimation.pause:s.svgAnimation.play,children:c?(0,t.jsx)(ek,{className:"h-4 w-4"}):(0,t.jsx)(eA.f,{className:"h-4 w-4"})}),(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)("h-8 w-8 shrink-0 p-0",v&&"text-white hover:bg-white/20 hover:text-white"),onClick:()=>{R(0),z()},"aria-label":s.svgAnimation.replay,title:s.svgAnimation.replay,children:(0,t.jsx)(eS.f,{className:"h-4 w-4"})}),j>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{type:"range",min:0,max:j,step:.1,value:Math.min(u,j),onChange:e=>R(Number(e.target.value)),"aria-label":s.svgAnimation.progress,className:"h-2 min-w-0 flex-1 cursor-pointer accent-primary"}),(0,t.jsxs)("span",{className:(0,eL.f)("shrink-0 text-xs tabular-nums",v?"text-white/80":"text-muted-foreground"),children:[eY(u)," / ",eY(j)]})]}),(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[!!A?.length&&(0,t.jsx)(eE,{supported:C.supported,enabled:C.enabled,rate:C.rate,fullscreen:v,onToggle:()=>C.setEnabled(!C.enabled,l.current?.getCurrentTime()??0),onCycleRate:C.cycleRate}),(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)("h-8 w-8 shrink-0 p-0",v&&"text-white hover:bg-white/20 hover:text-white"),onClick:$,"aria-label":v?s.svgAnimation.exitFullscreen:s.svgAnimation.fullscreen,title:v?s.svgAnimation.exitFullscreen:s.svgAnimation.fullscreen,children:v?(0,t.jsx)(eN,{className:"h-4 w-4"}):(0,t.jsx)(ew,{className:"h-4 w-4"})})]})]})]})}function e0({svg:e,disabled:s,onBusyChange:r}){let{t:n,language:i}=(0,h.b)(),[l,c]=(0,a.useState)(!1),[o,u]=(0,a.useState)(null),d=(0,a.useMemo)(()=>(function(e){let t=eR(e);if(t)return t;try{let t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;return"svg"===t.nodeName?eD(t):null}catch{return null}})(e),[e]);if((0,a.useEffect)(()=>{let e=!0;return(0,eq.v)().then(t=>{e&&c("cloud"===t)}),()=>{e=!1}},[]),!l||!d?.length)return null;let g=async()=>{u(0),r(!0);try{await (0,eq.H)(d.map(e=>e.text),i,u),E.c.success(n.svgAnimation.voiceRegenerateDone)}catch(t){let e=(0,p.d)(t)||"";v.f.error("[SvgAnimation]","Failed to regenerate cloud voice",{code:e,error:(0,p.Z)(t)}),E.c.error("TTS_DISABLED"===e?n.svgAnimation.voiceRegenerateDisabled:n.svgAnimation.voiceRegenerateFailed)}finally{u(null),r(!1)}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:g,disabled:s||null!==o,title:n.svgAnimation.voiceRegenerateHint,children:[null!==o?(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(eS.f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:null!==o?n.svgAnimation.voiceRegenerating.replace("{done}",String(o)).replace("{total}",String(d.length)):n.svgAnimation.voiceRegenerate})]})}function e1({errorItemId:e,svgAnimation:s,hasOtherLanguage:r,onChange:n}){let{t:i,language:l}=(0,h.b)(),[u,d]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),[w,N]=(0,a.useState)(!1),[k,A]=(0,a.useState)(null),S=(0,a.useMemo)(()=>!!s&&!!eR(s),[s]),C=(e,t)=>{let a=i.errors[e];return"string"==typeof a?a:t},I=async()=>{d(!0),A(null);try{let t=await x.f.post(`/api/error-items/${e}/svg-animation`,{language:l},{timeout:6e5,recoverable:!0});n(l,t.svgAnimation)}catch(t){let e=(0,p.d)(t)||"";v.f.error("[SvgAnimation]","Failed to generate SVG animation",{code:e,error:(0,p.Z)(t)}),A("NO_QUESTION_TEXT"===e?i.svgAnimation.noQuestionText:"NO_VALID_ANIMATION"===e?i.svgAnimation.invalid:C(e,i.svgAnimation.failed))}finally{d(!1)}},L=async()=>{b(!0),A(null);try{let t=await x.f.post(`/api/error-items/${e}/svg-animation/narration`,{language:l},{timeout:3e5,recoverable:!0});n(l,t.svgAnimation),E.c.success(i.svgAnimation.narrationDone)}catch(t){let e=(0,p.d)(t)||"";v.f.error("[SvgAnimation]","Failed to generate SVG narration",{code:e,error:(0,p.Z)(t)}),A("NO_VALID_NARRATION"===e?i.svgAnimation.narrationInvalid:C(e,i.svgAnimation.narrationFailed))}finally{b(!1)}},T=async()=>{if(await (0,E.u)(i.svgAnimation.confirmDelete,{destructive:!0})){j(!0);try{await x.f.delete(`/api/error-items/${e}/svg-animation?language=${l}`),n(l,null),A(null)}catch(e){v.f.error("[SvgAnimation]","Failed to delete SVG animation",{error:e instanceof Error?e.message:String(e)}),E.c.error(i.svgAnimation.deleteFailed)}finally{j(!1)}}};if(!s)return(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(eb,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:i.svgAnimation.title})]}),(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:I,disabled:u,children:[u?(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(eb,{className:"mr-2 h-4 w-4"}),u?i.svgAnimation.generating:i.svgAnimation.generate]})]}),k&&(0,t.jsx)("p",{className:"text-xs text-destructive mt-2",children:k}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:r?i.svgAnimation.otherLanguageAvailable:i.svgAnimation.hint})]});let F=u||g||y||w;return(0,t.jsxs)("div",{className:"rounded-lg border bg-card",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 border-b bg-muted/30",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i.svgAnimation.title}),F&&(0,t.jsx)(m.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:L,disabled:F,title:i.svgAnimation.narrationHint,children:[y?(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(ey,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:y?i.svgAnimation.narrationGenerating:S?i.svgAnimation.narrationRegenerate:i.svgAnimation.narrationGenerate})]}),(0,t.jsx)(e0,{svg:s,disabled:F,onBusyChange:N}),(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:I,disabled:F,children:[u?(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(c.f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u?i.svgAnimation.generating:i.svgAnimation.regenerate})]}),(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:T,disabled:F,children:[(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:i.svgAnimation.delete})]})]})]}),k&&(0,t.jsx)("p",{className:"px-3 pt-2 text-xs text-destructive",children:k}),(0,t.jsx)("div",{className:"p-2 sm:p-3",children:(0,t.jsx)(eJ,{svg:s})})]})}var e2=e.i(912505),e3=e.i(86963),e4=e.i(35209);e.s(["default",0,function(){let e=(0,r.useParams)(),i=(0,r.useRouter)(),{t:d,language:m}=(0,h.b)(),[g,p]=(0,a.useState)(null);(0,e4.f)(d.detail.title,g?.subject?.name,g?.shortId);let[b,w]=(0,a.useState)(!0),[N,k]=(0,a.useState)(null),[A,S]=(0,a.useState)(!1),[C,I]=(0,a.useState)(void 0),[L,T]=(0,a.useState)(!1),[M,z]=(0,a.useState)(!0),[$,O]=(0,a.useState)(null),[U,D]=(0,a.useState)(!1),q=(0,a.useCallback)(async e=>{try{let t=await x.f.get(`/api/error-items/${e}`);p(t)}catch(e){v.f.error("[ErrorDetail]","Failed to fetch error item",{error:e}),E.c.error(d.common?.messages?.loadFailed||"Failed to load item"),i.push("/notebooks")}finally{w(!1)}},[i,d]);(0,a.useEffect)(()=>{x.f.get("/api/user").then(e=>{e&&e.educationStage&&I(e.educationStage),T(!!e?.enableGeogebra),z(e?.enableSvgAnimation!==!1)}).catch(e=>v.f.error("[ErrorDetail]","Failed to fetch user info",{error:e})),e.id&&q(e.id)},[e.id,q]);let V=(0,a.useCallback)(e=>{p(t=>t&&{...t,...e})},[]),_=async e=>{g&&(await x.f.put(`/api/error-items/${g.id}`,e),V(e))},P=async()=>{g&&await q(g.id)},H=async e=>{if(!g)return;let t=g.difficultyStars??null;V({difficultyStars:e}),D(!0);try{let t=await x.f.put(`/api/error-items/${g.id}`,{difficultyStars:e});V({paperLevel:t.paperLevel})}catch(e){V({difficultyStars:t}),v.f.error("[ErrorDetail]","Failed to save difficulty",{error:e}),E.c.error(d.difficulty.saveFailed)}finally{D(!1)}},G=(0,a.useCallback)((e,t)=>{V({["en"===e?"svgAnimationEn":"svgAnimation"]:t})},[V]),B=async()=>{if(g&&await (0,E.u)(d.common?.messages?.confirmDelete||"Are you sure you want to delete this error item?",{destructive:!0}))try{await x.f.delete(`/api/error-items/${g.id}/delete`),E.c.success(d.common?.messages?.deleteSuccess||"Deleted successfully"),i.push(g.subjectId?`/notebooks/${g.subjectId}`:"/notebooks")}catch(e){v.f.error("[ErrorDetail]","Failed to delete error item",{error:e}),E.c.error(d.common?.messages?.deleteFailed||"Delete failed")}};return b?(0,t.jsx)(e3.f,{label:d.common.loading}):g?(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6 px-4 py-6 md:px-8 md:py-8",children:[(0,t.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)(s.default,{href:g.subjectId?`/notebooks/${g.subjectId}`:"/notebooks",children:(0,t.jsx)(f.f,{variant:"ghost",size:"icon",className:"-ml-2",children:(0,t.jsx)(n.f,{className:"h-5 w-5"})})}),(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:d.detail.title}),(0,t.jsx)(ej,{shortId:g.shortId}),(0,t.jsx)(u.f,{size:"md",value:g.difficultyStars,onChange:H,disabled:U})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(em,{errorItemId:g.id,fields:g,onDone:V}),(0,t.jsx)(s.default,{href:`/practice?id=${g.id}`,children:(0,t.jsxs)(f.f,{variant:"outline",size:"sm",children:[(0,t.jsx)(c.f,{className:"mr-2 h-4 w-4"}),d.detail.practice]})}),$&&(0,t.jsx)(ef.x,{status:$,className:"h-8 self-center px-3"}),(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:B,className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:[(0,t.jsx)(o.f,{className:"mr-2 h-4 w-4"}),d.detail.delete||"Delete"]})]})]}),(0,t.jsx)(es,{item:g,educationStage:C,saveFields:_,onUpdate:V,reload:P,onEnlarge:k}),(0,t.jsx)(eg.K,{errorItemId:g.id,onMasteryStatusChange:O}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsx)(F,{title:d.detail.correctAnswer,value:g.answerText,onSave:e=>_({answerText:e}),logLabel:"answer",rows:5,placeholder:"Enter answer...",cardClassName:"border-primary/20",titleClassName:"text-primary",contentClassName:"font-semibold",headerActions:(0,t.jsx)(ex,{errorItemId:g.id,onDone:e=>V({answerText:e.answerText??"",analysis:e.analysis??""})}),children:g.referenceImageUrl&&(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)(ea,{src:g.referenceImageUrl,alt:d.detail.referenceImageAlt,showLabel:d.detail.viewImage,hideLabel:d.detail.hideImage,visible:A,onVisibleChange:S,onEnlarge:k})})}),(0,t.jsx)(en,{item:g,saveFields:_,onEnlarge:k})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsx)(F,{title:d.detail.analysis,value:g.analysis,onSave:e=>_({analysis:e}),logLabel:"analysis",rows:12,placeholder:"Enter analysis..."}),(0,t.jsx)(F,{title:d.detail?.mistakeAnalysis||"Mistake Analysis",value:g.mistakeAnalysis,onSave:e=>_({mistakeAnalysis:e}),logLabel:"mistake analysis",rows:8,editorLabel:d.editor?.mistakeAnalysis||"Mistake Cause Analysis",emptyText:d.detail?.noMistakeAnalysis||"No mistake analysis yet."})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[M&&(0,t.jsx)(e1,{errorItemId:g.id,svgAnimation:"en"===m?g.svgAnimationEn:g.svgAnimation,hasOtherLanguage:!!("en"===m?g.svgAnimation:g.svgAnimationEn),onChange:G},m),L&&(0,t.jsx)(j,{errorItemId:g.id,commands:g.geogebraCommands,onUpdate:V}),(0,t.jsx)(R,{item:g,onUpdate:V})]})]}),(0,t.jsx)(y,{src:N,onClose:()=>k(null)})]}):(0,t.jsx)(e2.f,{icon:l,title:d.detail.notFound||"Item not found",className:"m-4 md:m-8"})}],204573)}]);