wrong-notebook 2026.10.30-3 → 2026.10.30

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/_1j8kqz21_i728._.js +1 -1
  187. package/.next/server/chunks/_1m-yyz-pl9-03._.js +1 -1
  188. package/.next/server/chunks/_next-internal_server_app_api_tts_batch_route_actions_1jmuawkcgxmae.js +3 -0
  189. package/.next/server/chunks/_next-internal_server_app_api_tts_status_route_actions_1udk0hbf96zdl.js +3 -0
  190. package/.next/server/chunks/src_lib_1csf8_0vpeenu._.js +3 -0
  191. package/.next/server/chunks/src_lib_1mno8g5cqmaet._.js +1 -1
  192. package/.next/server/chunks/src_lib_1p0k3ud1vrwmg._.js +3 -0
  193. package/.next/server/chunks/src_lib_1qy5aajgog9r2._.js +1 -1
  194. package/.next/server/chunks/src_lib_auth-utils_ts_20i7biv4dj8pm._.js +1 -1
  195. package/.next/server/chunks/src_lib_minimax-code_checkin_ts_1j1mpuxc1vgoz._.js +1 -1
  196. package/.next/server/chunks/src_lib_tts_19zri-v8-l_4u._.js +6 -6
  197. package/.next/server/chunks/ssr/[root-of-the-server]__0x_ihemma9171._.js +3 -0
  198. package/.next/server/chunks/ssr/_00np6xqvkg6u-._.js +1 -1
  199. package/.next/server/chunks/ssr/_08fq-uch-l1g6._.js +1 -1
  200. package/.next/server/chunks/ssr/_0n_xmfdlu07f9._.js +3 -0
  201. package/.next/server/chunks/ssr/_0xyykn-ar3ujn._.js +3 -0
  202. package/.next/server/chunks/ssr/_17edi6l2a0p76._.js +1 -1
  203. package/.next/server/chunks/ssr/_20-x85_onge5x._.js +3 -0
  204. package/.next/server/chunks/ssr/node_modules_lucide-react_dist_esm_icons_play_0upz8-7p5gttr.js +4 -0
  205. package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
  206. package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
  207. package/.next/server/chunks/ssr/src_app_exams_[id]_page_tsx_0xcjflkgkwzgd._.js +1 -1
  208. package/.next/server/chunks/ssr/src_app_exams_[id]_print_page_tsx_1i-xvhk8ul1l1._.js +1 -1
  209. package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
  210. package/.next/server/chunks/ssr/src_components_difficulty-stars_tsx_1af9qqfurq7_t._.js +1 -1
  211. package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +1 -1
  212. package/.next/server/middleware-build-manifest.js +3 -3
  213. package/.next/server/middleware-manifest.json +5 -5
  214. package/.next/server/pages/500.html +1 -1
  215. package/.next/server/preview-props.json +3 -3
  216. package/.next/server/server-reference-manifest.js +1 -1
  217. package/.next/server/server-reference-manifest.json +1 -1
  218. package/.next/static/chunks/00n2-r3ac3dh5.js +2 -0
  219. package/.next/static/chunks/{0ebem2w42rgm6.js → 00o1s_nir_tbc.js} +7 -7
  220. package/.next/static/chunks/0kh-fx3tssh5w.js +1 -0
  221. package/.next/static/chunks/0p2fh98qaki45.js +1 -0
  222. package/.next/static/chunks/{314x1g250-zss.js → 1c46asvnosb8-.js} +1 -1
  223. package/.next/static/chunks/1cdwoh8b2ub-t.js +1 -0
  224. package/.next/static/chunks/1epmdj8kqwbz4.js +1 -0
  225. package/.next/static/chunks/1r7yfcltcmwkh.js +1 -0
  226. package/.next/static/chunks/24gum0cmhhv7z.js +1 -0
  227. package/.next/static/chunks/26qq8907b9j3d.js +1 -0
  228. package/.next/static/chunks/2cf27aonkij9_.css +3 -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/2r4ddp7izc9sh.js +1 -0
  232. package/.next/static/chunks/2uobd1ff4vknn.js +33 -0
  233. package/.next/static/chunks/341etzsqr_b1v.js +6 -0
  234. package/package.json +1 -1
  235. package/prisma/seed.db +0 -0
  236. package/.next/server/chunks/[root-of-the-server]__0ergl3gmxvrz3._.js +0 -3
  237. package/.next/server/chunks/[root-of-the-server]__0lqng_pqv30ts._.js +0 -3
  238. package/.next/server/chunks/[root-of-the-server]__0ozf21hrh_433._.js +0 -3
  239. package/.next/server/chunks/[root-of-the-server]__0s0eusp3mojnx._.js +0 -3
  240. package/.next/server/chunks/[root-of-the-server]__0wm4req5e6m88._.js +0 -3
  241. package/.next/server/chunks/[root-of-the-server]__114quo-_-qi9w._.js +0 -3
  242. package/.next/server/chunks/[root-of-the-server]__16-d6bl8bbqvy._.js +0 -3
  243. package/.next/server/chunks/[root-of-the-server]__1_04f-bpuf75t._.js +0 -3
  244. package/.next/server/chunks/[root-of-the-server]__1_hpgx5rlxpya._.js +0 -3
  245. package/.next/server/chunks/[root-of-the-server]__1mj__r5f_o6lo._.js +0 -3
  246. package/.next/server/chunks/[root-of-the-server]__20m7u7lg4e5q8._.js +0 -3
  247. package/.next/server/chunks/ssr/[root-of-the-server]__1w4rew5br9_b8._.js +0 -3
  248. package/.next/server/chunks/ssr/_04ziy8_ak_olr._.js +0 -3
  249. package/.next/server/chunks/ssr/_09gyxodn5bpsw._.js +0 -4
  250. package/.next/server/chunks/ssr/_0oksf3a6pbj88._.js +0 -3
  251. package/.next/static/chunks/0-_s_oel8jb5s.js +0 -1
  252. package/.next/static/chunks/0dizg7xu7sle2.js +0 -1
  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_ → 4KSCavDaw8kyhSyGiE86P}/_buildManifest.js +0 -0
  264. /package/.next/static/{x6fwUxfhT4hZ2tYr6cKl_ → 4KSCavDaw8kyhSyGiE86P}/_clientMiddlewareManifest.js +0 -0
  265. /package/.next/static/{x6fwUxfhT4hZ2tYr6cKl_ → 4KSCavDaw8kyhSyGiE86P}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
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(n.common.listSeparator);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,errorItemId:s}){let{t:r,language:n}=(0,h.b)(),i=(0,a.useRef)(null),l=(0,a.useRef)(null),c=(0,a.useRef)(null),[o,u]=(0,a.useState)(!1),[d,m]=(0,a.useState)(0),[g,x]=(0,a.useState)(!1),[p,v]=(0,a.useState)(!1),j=g||p,y=(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]),b=(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]),w=(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]),N=(0,a.useMemo)(()=>eR(e),[e]),[k,A]=(0,a.useState)(null),S=N??k,C=(0,a.useCallback)(()=>{let e=l.current?.contentDocument;return"function"==typeof e?.getAnimations?e.getAnimations():[]},[]),I=function({segments:e,language:t,errorItemId:s,holdAnimation:r}){let[n,i]=(0,a.useState)(!1),[l,c]=(0,a.useState)("browser"),[o,u]=(0,a.useState)(!1),[d,m]=(0,a.useState)(1),[g,f]=(0,a.useState)(!1),[h,x]=(0,a.useState)(!1),p=(0,a.useRef)(void 0),v=(0,a.useRef)(-1),j=(0,a.useRef)(!1),y=(0,a.useRef)(null),b=(0,a.useRef)(0),w=(0,a.useRef)(null),N=(0,a.useRef)(null),k=(0,a.useRef)(!1),A=(0,a.useRef)("browser"),S=(0,a.useRef)(!1),C=(0,a.useRef)(!1),I=(0,a.useRef)(1),L=(0,a.useRef)(r);(0,a.useEffect)(()=>{L.current=r},[r]),(0,a.useEffect)(()=>{C.current="1"===eH(e_),u(C.current);let e=Number(eH(eP));eV.includes(e)&&(I.current=e,m(e))},[]),(0,a.useEffect)(()=>{let e=!0;return(0,eq.v)().then(t=>{e&&(A.current=t,c(t))}),()=>{e=!1}},[]),(0,a.useEffect)(()=>{let e=eW();if(!e)return;let a=()=>{let a,s,r,n=e.getVoices();a=eB[t],s=n.filter(e=>a.some(t=>e.lang.toLowerCase().startsWith(t))),r="zh"===t?/^(zh|cmn)[-_](cn|hans)/i:/^en[-_]us/i,p.current=s.find(e=>r.test(e.lang)&&e.localService)??s.find(e=>r.test(e.lang))??s[0],i(0===n.length||!!p.current)};return a(),e.addEventListener?.("voiceschanged",a),()=>e.removeEventListener?.("voiceschanged",a)},[t]);let E=(0,a.useCallback)(()=>{k.current&&(k.current=!1,null===y.current&&(x(!1),L.current(!1)))},[]),T=(0,a.useCallback)(a=>{let s,r=e?.[a];if(!r)return;let n=b.current,i={},l=()=>n===b.current&&w.current===i,c=e=>{clearTimeout(s),s=setTimeout(o,e)};function o(){clearTimeout(s),l()&&(w.current=null,N.current=null,j.current=!1,f(!1),E(),null!==y.current&&(y.current=null,x(!1),L.current(!1)))}let u=!1,d=()=>{if(!l()||u)return;u=!0,E();let e=eW();if(!e)return void o();let a=new SpeechSynthesisUtterance(r.text);a.lang=p.current?.lang??("en"===t?"en-US":"zh-CN"),p.current&&(a.voice=p.current),a.rate=I.current,a.onend=o,a.onerror=o,a.onstart=()=>c(eK(r.text,a.rate)),c(2500),N.current=a,e.speak(a)};if(w.current=i,j.current=!0,f(!0),"cloud"!==A.current)return void d();let m=e?.[a+1];m&&(0,eq.U)(m.text,t).catch(()=>void 0);let g=setTimeout(()=>{l()&&null===y.current&&(k.current=!0,x(!0),L.current(!0))},300);(0,eq.U)(r.text,t).then(e=>{let t=(0,eq.l)();if(!l())return;if(!t){clearTimeout(g),d();return}let a=e=>()=>{l()&&!u&&e()};t.onplaying=a(()=>{clearTimeout(g),E(),c(eK(r.text,t.playbackRate))}),t.onended=a(o),t.onerror=a(d),t.src=e,t.playbackRate=I.current,c(8e3),t.play().catch(a(()=>{clearTimeout(g),d()}))},()=>{clearTimeout(g),d()})},[e,t,E]),F=(0,a.useCallback)(t=>{b.current++,w.current=null,N.current=null,j.current=!1,f(!1),(null!==y.current||k.current)&&(y.current=null,k.current=!1,x(!1),L.current(!1)),v.current=e?eQ(e,t)-1:-1,eW()?.cancel(),"cloud"===A.current&&(0,eq.l)()?.pause()},[e]),M=(0,a.useCallback)(t=>{if(!C.current||!e?.length||null!==y.current)return;if(j.current){let a=v.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;y.current=a,x(!0),L.current(!0);return}let a=eQ(e,t);a<=v.current||(v.current=a,T(a))},[e,T]),R=(0,a.useCallback)(()=>{C.current&&(eX(),"cloud"===A.current&&(0,eq.p)())},[]),z=(0,a.useCallback)((e,t)=>{S.current=!0,F(t),C.current=e,u(e),eG(e_,e?"1":"0"),R()},[F,R]),$=(0,a.useCallback)(()=>{let e=eV[(eV.indexOf(I.current)+1)%eV.length];if(I.current=e,m(e),"cloud"===A.current){let t=(0,eq.l)();t&&(t.playbackRate=e)}eG(eP,String(e))},[]);return(0,a.useEffect)(()=>{let e="cloud"===l&&!(0,eq.h)();if(!o||(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})}},[o,l]),(0,a.useEffect)(()=>{o&&"cloud"===l&&e?.length&&(0,eq.w)(e.map(e=>e.text),t,s).catch(()=>void 0)},[o,l,e,t,s]),(0,a.useEffect)(()=>{if("cloud"!==l||!e?.length||C.current)return;let a=!0;return(0,eq.z)(e.map(e=>e.text),t).then(e=>{a&&e&&!C.current&&!S.current&&(C.current=!0,u(!0))}),()=>{a=!1}},[l,e,t]),(0,a.useEffect)(()=>()=>{b.current++,eW()?.cancel(),"cloud"===A.current&&(0,eq.l)()?.pause()},[e]),{supported:n||"cloud"===l,enabled:o,rate:d,speaking:g,holding:h,setEnabled:z,cycleRate:$,update:M,stop:F,prime:R}}({segments:S,language:n,errorItemId:s,holdAnimation:(0,a.useCallback)(e=>{e?c.current?.pauseAnimations():c.current?.unpauseAnimations(),C().forEach(t=>e?t.pause():t.play())},[C])}),L=I.enabled&&(I.holding||!o&&I.speaking),{stop:E,update:T,prime:F}=I,M=(0,a.useCallback)(()=>{c.current?.pauseAnimations(),C().forEach(e=>e.pause()),u(!1)},[C]),R=(0,a.useCallback)(()=>{E(c.current?.getCurrentTime()??0),M()},[M,E]),z=(0,a.useCallback)(e=>{c.current?.setCurrentTime(e),C().forEach(t=>{t.currentTime=1e3*e}),m(e),E(e)},[C,E]),$=(0,a.useCallback)(()=>{let e=c.current;e&&(y>0&&e.getCurrentTime()>=y&&z(0),e.unpauseAnimations(),C().forEach(e=>e.play()),u(!0),F())},[C,y,z,F]),O=async()=>{if(p)return void v(!1);if(document.fullscreenElement)return void await document.exitFullscreen().catch(()=>void 0);let e=i.current;if(e&&"function"==typeof e.requestFullscreen)try{await e.requestFullscreen();return}catch{}v(!0)};return(0,a.useEffect)(()=>{let e=()=>x(document.fullscreenElement===i.current);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,a.useEffect)(()=>{if(!p)return;let e=e=>{"Escape"===e.key&&v(!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)}},[p]),(0,a.useEffect)(()=>{if(!o)return;let e=0,t=()=>{let a=c.current?.getCurrentTime()??0;if(T(a),y>0&&a>=y){c.current?.setCurrentTime(y),M(),m(y);return}m(a),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[o,y,M,T]),(0,t.jsxs)("div",{ref:i,className:(0,eL.f)("space-y-2",j&&"flex flex-col items-center justify-center bg-black p-4",p&&"fixed inset-0 z-50"),children:[(0,t.jsx)("iframe",{ref:l,srcDoc:w,sandbox:"allow-same-origin",title:r.svgAnimation.alt,onLoad:()=>{c.current=l.current?.contentDocument?.querySelector("svg")??null,A(c.current?eD(c.current):null),E(0),m(0),u(!!c.current)},className:(0,eL.f)("mx-auto block rounded border bg-white transition-shadow",!j&&"w-full max-w-3xl",L&&"border-primary ring-2 ring-primary/40"),style:j?{aspectRatio:b,width:`min(100%, calc((100dvh - 96px) * ${b}))`}:{aspectRatio:b}}),(0,t.jsxs)("div",{className:(0,eL.f)("mx-auto flex w-full items-center gap-2",j?"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:o?R:$,"aria-label":o?r.svgAnimation.pause:r.svgAnimation.play,title:o?r.svgAnimation.pause:r.svgAnimation.play,children:o?(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",j&&"text-white hover:bg-white/20 hover:text-white"),onClick:()=>{z(0),$()},"aria-label":r.svgAnimation.replay,title:r.svgAnimation.replay,children:(0,t.jsx)(eS.f,{className:"h-4 w-4"})}),y>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{type:"range",min:0,max:y,step:.1,value:Math.min(d,y),onChange:e=>z(Number(e.target.value)),"aria-label":r.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",j?"text-white/80":"text-muted-foreground"),children:[eY(d)," / ",eY(y)]})]}),(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[!!S?.length&&(0,t.jsx)(eE,{supported:I.supported,enabled:I.enabled,rate:I.rate,fullscreen:j,onToggle:()=>I.setEnabled(!I.enabled,c.current?.getCurrentTime()??0),onCycleRate:I.cycleRate}),(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)("h-8 w-8 shrink-0 p-0",j&&"text-white hover:bg-white/20 hover:text-white"),onClick:O,"aria-label":j?r.svgAnimation.exitFullscreen:r.svgAnimation.fullscreen,title:j?r.svgAnimation.exitFullscreen:r.svgAnimation.fullscreen,children:j?(0,t.jsx)(eN,{className:"h-4 w-4"}):(0,t.jsx)(ew,{className:"h-4 w-4"})})]})]})]})}function e0({svg:e,errorItemId:s,disabled:r,onBusyChange:n}){let{t:i,language:l}=(0,h.b)(),[c,o]=(0,a.useState)(!1),[u,d]=(0,a.useState)(!1),g=(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&&o("cloud"===t)}),()=>{e=!1}},[]),!c||!g?.length)return null;let x=async()=>{d(!0),n(!0);try{await (0,eq.H)(g.map(e=>e.text),l,s),E.c.success(i.svgAnimation.voiceRegenerateDone)}catch(s){let e=(0,p.d)(s)||"";v.f.error("[SvgAnimation]","Failed to regenerate cloud voice",{code:e,error:(0,p.Z)(s)});let t=(0,p.L)(s),a="TTS_DISABLED"===e?i.svgAnimation.voiceRegenerateDisabled:i.svgAnimation.voiceRegenerateFailed;E.c.error(t?`${a} (${t})`:a)}finally{d(!1),n(!1)}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:x,disabled:r||u,title:i.svgAnimation.voiceRegenerateHint,children:[u?(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:u?i.svgAnimation.voiceRegenerating:i.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,errorItemId:e,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,errorItemId:e})})]})}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)}]);
@@ -0,0 +1 @@
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)},463059,e=>{let t=(0,e.i(475254).f)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["f",0,t],463059)},503116,e=>{let t=(0,e.i(475254).f)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["f",0,t],503116)},118924,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(522016),n=e.i(551804),i=e.i(16715),s=e.i(666696),l=e.i(519455),c=e.i(912505),o=e.i(393842),d=e.i(658512),u=e.i(111110),f=e.i(215519),m=e.i(41931),x=e.i(469817),p=e.i(306831),g=e.i(201276),h=e.i(35209);let b=[1,2,4,7,15,30];e.s(["default",0,function(){let{t:e}=(0,u.b)(),{timeZone:v}=(0,f.M)();(0,h.f)(e.review.title);let[w,j]=(0,r.useState)(null),[y,k]=(0,r.useState)(1),N=(0,r.useCallback)(async e=>{try{j(await m.f.get(`/api/review/due?page=${e}&pageSize=${x.$}`))}catch(e){g.f.error("[Review]","Failed to fetch due reviews",{error:e})}},[]);(0,r.useEffect)(()=>{N(y)},[y,N]);let C=(0,p.d)(new Date,v).start;return(0,t.jsxs)("main",{className:"mx-auto max-w-6xl space-y-6 px-4 py-6 md:px-8 md:py-8",children:[(0,t.jsx)(o.f,{title:e.review.title,description:e.review.desc,actions:w&&w.total>0&&(0,t.jsx)("span",{className:"rounded-full bg-primary/10 px-3 py-1 text-sm font-medium text-primary",children:e.review.dueCount.replace("{count}",String(w.total))})}),!w&&(0,t.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6},(e,r)=>(0,t.jsx)("div",{className:"h-52 animate-pulse rounded-2xl bg-muted"},r))}),w&&0===w.total&&(0,t.jsx)(c.f,{icon:n.f,title:e.review.empty,description:e.review.emptyHint}),w&&w.items.length>0&&(0,t.jsx)("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:w.items.map(r=>{let n;return(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)("div",{className:"flex-1",children:(0,t.jsx)(s.f,{item:r,selectMode:!1,selected:!1,onToggleSelect:()=>{},selectedTag:null,onTagClick:()=>{}})}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2 px-1 text-xs text-muted-foreground",children:[(0,t.jsxs)("span",{children:[(n=(0,p.r)(r.nextReviewAt,"MM/dd",v),new Date(r.nextReviewAt)<C?e.review.overdue.replace("{date}",n):e.review.dueOn.replace("{date}",n))," · ",e.review.round.replace("{round}",String(r.reviewStage+1)).replace("{total}",String(b.length))]}),(0,t.jsx)(a.default,{href:`/practice?id=${r.id}`,children:(0,t.jsxs)(l.f,{variant:"outline",size:"sm",className:"h-8",children:[(0,t.jsx)(i.f,{className:"mr-1.5 h-3.5 w-3.5"}),e.review.practice]})})]})]},r.id)})}),w&&(0,t.jsx)(d.f,{page:y,totalPages:w.totalPages,total:w.total,pageSize:w.pageSize,onPageChange:k})]})}],118924)},469937,62825,e=>{var t=e.i(843476);let r=(0,e.i(475254).f)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var a=e.i(111110),n=e.i(975157);let i=[1,2,3,4,5];function s(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:s,disabled:l,size:c="sm",showUnrated:o=!0,className:d}){let{t:u}=(0,a.b)(),f=e??0,m="sm"===c?"h-3.5 w-3.5":"h-5 w-5",x=f?u.difficulty.starsLabel.replace("{n}",String(f)):u.difficulty.unrated;return s?(0,t.jsxs)("span",{className:(0,n.f)("inline-flex items-center gap-0.5",d),role:"group","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:u.difficulty.clearHint,children:[i.map(e=>(0,t.jsx)("button",{type:"button",disabled:l,onClick:()=>s(e===f?null:e),"aria-label":u.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=f,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(r,{className:(0,n.f)(m,e<=f?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!f&&o&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:u.difficulty.unrated})]}):f?(0,t.jsx)("span",{className:(0,n.f)("inline-flex items-center",d),role:"img","aria-label":`${u.difficulty.label}${u.common.colon}${x}`,title:x,children:i.map(e=>(0,t.jsx)(r,{className:(0,n.f)(m,e<=f?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):o?(0,t.jsx)("span",{className:(0,n.f)("text-xs text-muted-foreground",d),children:u.difficulty.unrated}):null}],469937),e.s(["i",0,function(e,t="zh"){return("en"===t?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[s(e)]},"h",0,s,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":s(e)}],62825)},846968,e=>{var t=e.i(843476),r=e.i(269638),a=e.i(503116),n=e.i(16715),i=e.i(487486),s=e.i(111110);let l={new:{className:"bg-warning/15 text-amber-700 dark:text-warning",icon:a.f},reviewing:{className:"bg-primary/10 text-primary",icon:n.f},mastered:{className:"bg-success/15 text-success",icon:r.f}};e.s(["o",0,{new:"border-l-warning/70",reviewing:"border-l-primary/60",mastered:"border-l-success/70"},"x",0,function({status:e,className:r=""}){let{t:a}=(0,s.b)(),{className:n,icon:c}=l[e],o="mastered"===e?a.notebook.mastered:"reviewing"===e?a.notebook.reviewing:a.notebook.review;return(0,t.jsx)(i.f,{variant:"secondary",className:`${n} ${r}`,children:(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(c,{className:"h-3 w-3"})," ",o]})})}])},590546,e=>{var t=e.i(843476),r=e.i(618566),a=e.i(519455),n=e.i(871689);e.s(["f",0,function({fallbackUrl:e,className:i}){let s=(0,r.useRouter)();return(0,t.jsx)(a.f,{variant:"ghost",size:"icon",onClick:()=>{s.push(e)},className:i,children:(0,t.jsx)(n.f,{className:"h-5 w-5"})})}])},515288,e=>{var t=e.i(843476),r=e.i(975157);e.s(["N",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,r.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,r.f)("px-6",e),...a})},"u",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,r.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,r.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,r.f)("leading-none font-semibold",e),...a})}])},257428,e=>{var t=e.i(843476),r=e.i(271645),a=e.i(820783),n=e.i(30030),i=e.i(981140),s=e.i(369340),l=e.i(635804),c=e.i(296626),o=e.i(248425),d=Object.defineProperty,u=(e,t)=>d(e,"name",{value:t,configurable:!0}),f="Checkbox",[m,x]=(0,n.f)(f),[p,g]=m(f);function h(e){let{__scopeCheckbox:a,checked:n,children:i,defaultChecked:l,disabled:c,form:o,name:d,onCheckedChange:u,required:m,value:x="on",internal_do_not_use_render:g}=e,[h,b]=(0,s.f)({prop:n,defaultProp:l??!1,onChange:u,caller:f}),[v,w]=r.useState(null),[j,N]=r.useState(null),[C,S]=r.useState(null),R=!v||!!o||!!v.closest("form"),P={checked:h,disabled:c,setChecked:b,control:v,setControl:w,name:d,form:o,value:x,userClick:C,onUserClick:S,required:m,defaultChecked:!k(l)&&l,isFormControl:R,bubbleInput:j,setBubbleInput:N};return(0,t.jsx)(p,{scope:a,...P,children:y(g)?g(P):i})}u(h,"CheckboxProvider");var b=r.forwardRef(u(function({__scopeCheckbox:e,onKeyDown:n,onClick:s,...l},c){let{control:d,value:f,disabled:m,checked:x,required:p,setControl:h,setChecked:b,onUserClick:v,isFormControl:w,bubbleInput:j}=g("CheckboxTrigger",e),y=(0,a.f)(c,h),C=r.useRef(x);return r.useEffect(()=>{let e=d?.form;if(e){let t=u(()=>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":k(x)?"mixed":x,"aria-required":p,"data-state":N(x),"data-disabled":m?"":void 0,disabled:m,value:f,...l,ref:y,onKeyDown:(0,i.f)(n,e=>{"Enter"===e.key&&e.preventDefault()}),onClick:(0,i.f)(s,e=>{let t=e.isPropagationStopped();v({requestedChecked:!!k(x)||!x,hasConsumerStoppedPropagation:t}),b(e=>!!k(e)||!e),j&&w&&!t&&e.stopPropagation()})})},"CheckboxTrigger")),v=r.forwardRef(u(function(e,r){let{__scopeCheckbox:a,name:n,checked:i,defaultChecked:s,required:l,disabled:c,value:o,onCheckedChange:d,form:u,...f}=e;return(0,t.jsx)(h,{__scopeCheckbox:a,checked:i,defaultChecked:s,disabled:c,required:l,onCheckedChange:d,name:n,form:u,value:o,internal_do_not_use_render:({isFormControl:e})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b,{...f,ref:r,__scopeCheckbox:a}),e&&(0,t.jsx)(j,{__scopeCheckbox:a})]})})},"Checkbox")),w=r.forwardRef(u(function(e,r){let{__scopeCheckbox:a,forceMount:n,...i}=e,s=g("CheckboxIndicator",a);return(0,t.jsx)(c.f,{present:n||k(s.checked)||!0===s.checked,children:(0,t.jsx)(o.V.span,{"data-state":N(s.checked),"data-disabled":s.disabled?"":void 0,...i,ref:r,style:{pointerEvents:"none",...e.style}})})},"CheckboxIndicator")),j=r.forwardRef(u(function({__scopeCheckbox:e,onClick:n,...s},c){let{control:d,userClick:u,checked:f,defaultChecked:m,required:x,disabled:p,name:h,value:b,form:v,bubbleInput:w,setBubbleInput:j}=g("CheckboxBubbleInput",e),y=(0,a.f)(c,j),N=(0,l.f)(d),C=r.useRef(!1),S=r.useRef(f),R=r.useRef(u),P=r.useRef(null);r.useEffect(()=>{if(!w)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let t=S.current!==f;S.current=f;let r=null!==u&&u!==R.current;if(R.current=u,r)P.current=t?null:u,t&&(w.indeterminate=k(f),e.call(w,!k(f)&&f)),w.dispatchEvent(new Event("click",{bubbles:!u.hasConsumerStoppedPropagation}));else if(t){let t=P.current;P.current=null;let r=t?.requestedChecked===f;C.current=!0,w.indeterminate=k(f),e.call(w,!k(f)&&f),w.dispatchEvent(new Event("click",{bubbles:!(r&&t.hasConsumerStoppedPropagation)})),C.current=!1}},[w,f,u]);let E=r.useRef(!k(f)&&f);return(0,t.jsx)(o.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:m??E.current,required:x,disabled:p,name:h,value:b,form:v,...s,tabIndex:-1,ref:y,onClick:(0,i.f)(n,e=>{C.current&&e.stopPropagation()}),style:{...s.style,...N,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"CheckboxBubbleInput"));function y(e){return"function"==typeof e}function k(e){return"indeterminate"===e}function N(e){return k(e)?"indeterminate":e?"checked":"unchecked"}u(y,"isFunction"),u(k,"isIndeterminate"),u(N,"getState");var C=e.i(643531),S=e.i(975157);let R=r.forwardRef(({className:e,...r},a)=>(0,t.jsx)(v,{ref:a,className:(0,S.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),...r,children:(0,t.jsx)(w,{className:(0,S.f)("flex items-center justify-center text-current"),children:(0,t.jsx)(C.f,{className:"h-4 w-4"})})}));R.displayName=v.displayName,e.s(["f",0,R],257428)},912505,e=>{var t=e.i(843476),r=e.i(975157);e.s(["f",0,function({icon:e,title:a,description:n,action:i,className:s}){return(0,t.jsxs)("div",{className:(0,r.f)("flex flex-col items-center justify-center rounded-2xl border border-dashed bg-card/50 px-6 py-14 text-center",s),children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-accent-foreground",children:(0,t.jsx)(e,{className:"h-7 w-7"})}),(0,t.jsx)("p",{className:"font-medium",children:a}),n&&(0,t.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:n}),i&&(0,t.jsx)("div",{className:"mt-5",children:i})]})}])},393842,e=>{var t=e.i(843476),r=e.i(590546),a=e.i(975157);e.s(["f",0,function({title:e,description:n,backHref:i,actions:s,titleAddon:l,className:c}){return(0,t.jsxs)("div",{className:(0,a.f)("flex items-start gap-3",c),children:[i&&(0,t.jsx)(r.f,{fallbackUrl:i,className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("h1",{className:"truncate text-2xl font-bold tracking-tight sm:text-3xl",children:e}),l]}),n&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:n})]}),s&&(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:s})]})}])},469817,e=>{e.s(["$",0,18,"u",0,5,"A",0,200])},990745,e=>{e.s(["f",0,function(e){if(e.tags&&e.tags.length>0)return e.tags.map(e=>e.name);if(!e.knowledgePoints)return[];try{let t=JSON.parse(e.knowledgePoints);return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch{return[]}}])},35209,e=>{var t=e.i(271645),r=e.i(111110);e.s(["f",0,function(...e){let{t:a}=(0,r.b)(),n=[a.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=n},[n])}])}])})();
@@ -0,0 +1 @@
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?`${x.common.colon}${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])}])}])})();
@@ -0,0 +1 @@
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)},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)},813572,e=>{var t=e.i(843476),a=e.i(271645),s=e.i(618566),i=e.i(968553),n=e.i(283086),r=e.i(747819),l=e.i(178119),o=e.i(12130),c=e.i(430634),d=e.i(717448),u=e.i(798469),m=e.i(393842),f=e.i(956738),p=e.i(185592),x=e.i(111110),g=e.i(41931),h=e.i(201276),b=e.i(35209),v=e.i(267275);e.s(["default",0,function(){let e=(0,s.useParams)(),y=(0,s.useRouter)(),j=e.id,{t:k}=(0,x.b)(),[w,N]=(0,a.useState)(null);(0,b.f)(k.notebooks.title,w?.name,k.pageTitle.addError);let[C,S]=(0,a.useState)("image"),I=(0,v.f)({logPrefix:"[AddErrorItem]",analyzeSubjectId:j,importSubjectId:j,textNotebook:{id:j,name:w?.name||""},fixedSubjectId:j});return((0,a.useEffect)(()=>{g.f.get(`/api/notebooks/${j}`).then(e=>N(e)).catch(e=>{h.f.error("[AddErrorItem]","Failed to fetch notebook",{error:e}),y.push("/notebooks")})},[j,y]),w)?(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsx)(f.f,{status:I.analysisStep}),(0,t.jsxs)("div",{className:`mx-auto space-y-6 px-4 py-6 md:px-8 md:py-8 ${"review"===I.step?"max-w-6xl":"max-w-4xl"}`,children:[(0,t.jsx)(m.f,{backHref:`/notebooks/${j}`,title:k.app.addError,description:w.name}),"upload"===I.step&&(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(p.f,{options:[{value:"image",icon:i.f,label:k.app?.uploadImage||"Take Photo"},{value:"text",icon:n.f,label:k.app?.manualInput||"Manual Input"}],value:C,onChange:S}),I.lastImported&&(0,t.jsx)(c.f,{imported:I.lastImported,onDismiss:I.dismissImported}),I.batchBlobs?(0,t.jsx)(r.f,{blobs:I.batchBlobs,subjectId:j,timeout:I.aiTimeout,onClose:I.closeBatch}):"image"===C?(0,t.jsx)(u.f,{onImageSelect:I.selectImage,isAnalyzing:I.isBusy}):(0,t.jsx)(d.f,{onSubmit:I.submitText,isAnalyzing:I.isBusy,defaultNotebookName:w.name})]}),"review"===I.step&&I.parsedData&&(0,t.jsx)(l.f,{initialData:I.parsedData,imagePreview:I.currentImage,onSave:I.saveReviewed,onCancel:I.cancelReview,initialSubjectId:j,aiTimeout:I.aiTimeout})]}),(0,t.jsx)(o.f,{imageSrc:I.croppingImage||"",open:I.isCropperOpen,onClose:I.closeCropper,onCropComplete:I.cropComplete,onMultiCropComplete:I.startBatch})]}):(0,t.jsx)("div",{className:"min-h-screen flex items-center justify-center",children:(0,t.jsx)("p",{className:"text-muted-foreground",children:k.common.loading})})}])},469937,62825,e=>{var t=e.i(843476);let a=(0,e.i(475254).f)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var s=e.i(111110),i=e.i(975157);let n=[1,2,3,4,5];function r(e){return"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}e.s(["f",0,function({value:e,onChange:r,disabled:l,size:o="sm",showUnrated:c=!0,className:d}){let{t:u}=(0,s.b)(),m=e??0,f="sm"===o?"h-3.5 w-3.5":"h-5 w-5",p=m?u.difficulty.starsLabel.replace("{n}",String(m)):u.difficulty.unrated;return r?(0,t.jsxs)("span",{className:(0,i.f)("inline-flex items-center gap-0.5",d),role:"group","aria-label":`${u.difficulty.label}${u.common.colon}${p}`,title:u.difficulty.clearHint,children:[n.map(e=>(0,t.jsx)("button",{type:"button",disabled:l,onClick:()=>r(e===m?null:e),"aria-label":u.difficulty.setStars.replace("{n}",String(e)),"aria-pressed":e<=m,className:"rounded p-0.5 hover:bg-muted disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:(0,t.jsx)(a,{className:(0,i.f)(f,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/40")})},e)),!m&&c&&(0,t.jsx)("span",{className:"ml-1 text-xs text-muted-foreground",children:u.difficulty.unrated})]}):m?(0,t.jsx)("span",{className:(0,i.f)("inline-flex items-center",d),role:"img","aria-label":`${u.difficulty.label}${u.common.colon}${p}`,title:p,children:n.map(e=>(0,t.jsx)(a,{className:(0,i.f)(f,e<=m?"fill-amber-400 text-amber-400":"text-muted-foreground/30"),"aria-hidden":!0},e))}):c?(0,t.jsx)("span",{className:(0,i.f)("text-xs text-muted-foreground",d),children:u.difficulty.unrated}):null}],469937),e.s(["i",0,function(e,t="zh"){return("en"===t?{not_attempted:"Not attempted",wrong_attempt:"Wrong attempt",unknown:"Unknown"}:{not_attempted:"不会做",wrong_attempt:"做错了",unknown:"未判断"})[r(e)]},"h",0,r,"x",0,function(e,t){return(t||"").trim()?"wrong_attempt":r(e)}],62825)},149704,e=>{var t=e.i(843476),a=e.i(111110),s=e.i(975157);e.s(["f",0,function({svg:e,className:i}){let{t:n}=(0,a.b)();return e?(0,t.jsx)("figure",{className:(0,s.f)("question-figure my-3",i),children:(0,t.jsx)("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:n.figure.alt,className:"mx-auto block h-auto max-w-full rounded border bg-white p-2",style:{maxHeight:360}})}):null}],149704)},574041,e=>{var t=e.i(843476),a=e.i(271645),s=e.i(37727),i=e.i(487486),n=e.i(793479),r=e.i(41931),l=e.i(201276);e.s(["f",0,function({value:e=[],onChange:o,placeholder:c="Enter tags...",className:d="",enterHint:u,subject:m,gradeStage:f}){let[p,x]=(0,a.useState)(""),[g,h]=(0,a.useState)([]),[b,v]=(0,a.useState)(!1),[y,j]=(0,a.useState)(0),k=(0,a.useRef)(null),w=(0,a.useRef)(null),N=(0,a.useCallback)(async t=>{try{let a=new URLSearchParams({q:t});m&&a.append("subject",m),f&&a.append("stage",f);let s=((await r.f.get(`/api/tags/suggestions?${a.toString()}`)).suggestions||[]).filter(t=>!e.includes(t));h(s.slice(0,20)),v(s.length>0),j(0)}catch(e){l.f.error("[TagInput]","Failed to fetch suggestions",{error:e})}},[m,f,e]);(0,a.useEffect)(()=>{p.trim()&&N(p)},[p,N]);let C=t=>{t.trim()&&!e.includes(t.trim())&&(o([...e,t.trim()]),x(""),h([]),v(!1),j(0))},S=t=>{o(e.filter(e=>e!==t))};return(0,a.useEffect)(()=>{let e=e=>{!w.current||w.current.contains(e.target)||k.current?.contains(e.target)||v(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,t.jsxs)("div",{className:`relative ${d}`,children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 p-2 border rounded-lg bg-background min-h-[42px]",children:[e.map(e=>(0,t.jsxs)(i.f,{variant:"secondary",className:"flex items-center gap-1 px-2 py-1",children:[e,(0,t.jsx)("button",{type:"button",onClick:()=>S(e),className:"hover:text-destructive ml-1",children:(0,t.jsx)(s.X,{className:"h-3 w-3"})})]},e)),(0,t.jsx)(n.f,{ref:k,type:"text",value:p,onChange:e=>{x(e.target.value),e.target.value.trim()||(h([]),v(!1))},onKeyDown:t=>{"Enter"===t.key?(t.preventDefault(),y>=0&&g[y]?C(g[y]):p.trim()&&C(p)):"ArrowDown"===t.key?(t.preventDefault(),j(e=>Math.min(e+1,g.length-1))):"ArrowUp"===t.key?(t.preventDefault(),j(e=>Math.max(e-1,0))):"Escape"===t.key?(v(!1),j(0)):"Backspace"===t.key&&!p&&e.length>0&&S(e[e.length-1])},onFocus:()=>{g.length>0&&v(!0)},placeholder:0===e.length?c:"",className:"flex-1 min-w-[120px] border-none focus-visible:ring-0 focus-visible:ring-offset-0 h-8 px-0"})]}),b&&g.length>0&&(0,t.jsx)("div",{ref:w,className:"absolute z-50 w-full mt-1 bg-popover border rounded-md shadow-md max-h-48 overflow-y-auto",children:g.map((e,a)=>(0,t.jsx)("div",{className:`px-3 py-2 cursor-pointer hover:bg-accent ${a===y?"bg-accent":""}`,onClick:()=>C(e),onMouseEnter:()=>j(a),children:e},e))}),p&&!b&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-1",children:u?`${u} "${p}"`:`Press Enter to create "${p}"`})]})}])},590546,e=>{var t=e.i(843476),a=e.i(618566),s=e.i(519455),i=e.i(871689);e.s(["f",0,function({fallbackUrl:e,className:n}){let r=(0,a.useRouter)();return(0,t.jsx)(s.f,{variant:"ghost",size:"icon",onClick:()=>{r.push(e)},className:n,children:(0,t.jsx)(i.f,{className:"h-5 w-5"})})}])},515288,e=>{var t=e.i(843476),a=e.i(975157);e.s(["N",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,a.f)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...s})},"O",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,a.f)("px-6",e),...s})},"u",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,a.f)("text-muted-foreground text-sm",e),...s})},"Y",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,a.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),...s})},"v",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,a.f)("leading-none font-semibold",e),...s})}])},393842,e=>{var t=e.i(843476),a=e.i(590546),s=e.i(975157);e.s(["f",0,function({title:e,description:i,backHref:n,actions:r,titleAddon:l,className:o}){return(0,t.jsxs)("div",{className:(0,s.f)("flex items-start gap-3",o),children:[n&&(0,t.jsx)(a.f,{fallbackUrl:n,className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("h1",{className:"truncate text-2xl font-bold tracking-tight sm:text-3xl",children:e}),l]}),i&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground sm:text-base",children:i})]}),r&&(0,t.jsx)("div",{className:"flex shrink-0 items-center gap-2",children:r})]})}])},952122,e=>{e.i(306831),e.s(["f",0,function(e){if(!e)return null;let t=e.toLowerCase();return t.includes("math")||t.includes("数学")?"math":t.includes("physics")||t.includes("物理")?"physics":t.includes("chemistry")||t.includes("化学")?"chemistry":t.includes("biology")||t.includes("生物")?"biology":t.includes("english")||t.includes("英语")?"english":t.includes("chinese")||t.includes("语文")?"chinese":t.includes("history")||t.includes("历史")?"history":t.includes("geography")||t.includes("地理")?"geography":t.includes("politics")||t.includes("政治")?"politics":null}])},35209,e=>{var t=e.i(271645),a=e.i(111110);e.s(["f",0,function(...e){let{t:s}=(0,a.b)(),i=[s.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=i},[i])}])}])})();
@@ -0,0 +1 @@
1
+ (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,778917,e=>{let s=(0,e.i(475254).f)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["f",0,s],778917)},292270,699375,e=>{let s=(0,e.i(475254).f)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["f",0,s],292270);var i=e.i(843476),t=e.i(271645),n=e.i(981140),a=e.i(820783),r=e.i(30030),l=e.i(369340),o=e.i(635804),c=e.i(248425),d=Object.defineProperty,m=(e,s)=>d(e,"name",{value:s,configurable:!0}),p="Switch",[u,h]=(0,r.f)(p),[x,f]=u(p);function g(e){let{__scopeSwitch:s,checked:n,children:a,defaultChecked:r,disabled:o,form:c,name:d,onCheckedChange:m,required:u,value:h="on",internal_do_not_use_render:f}=e,[g,v]=(0,l.f)({prop:n,defaultProp:r??!1,onChange:m,caller:p}),[j,y]=t.useState(null),[b,k]=t.useState(null),[w,C]=t.useState(null),S=!j||!!c||!!j.closest("form"),U={checked:g,setChecked:v,disabled:o,control:j,setControl:y,name:d,form:c,value:h,userClick:w,onUserClick:C,required:u,defaultChecked:r,isFormControl:S,bubbleInput:b,setBubbleInput:k};return(0,i.jsx)(x,{scope:s,...U,children:N(f)?f(U):a})}m(g,"SwitchProvider");var v=t.forwardRef(m(function({__scopeSwitch:e,onClick:s,...r},l){let{control:o,form:d,value:p,disabled:u,checked:h,required:x,setControl:g,setChecked:v,onUserClick:j,isFormControl:y,bubbleInput:b}=f("SwitchTrigger",e),N=(0,a.f)(l,g),w=t.useRef(h);return t.useEffect(()=>{let e=d?o?.ownerDocument.getElementById(d):o?.form;if(e instanceof HTMLFormElement){let s=m(()=>v(w.current),"reset");return e.addEventListener("reset",s),()=>e.removeEventListener("reset",s)}},[o,d,v]),(0,i.jsx)(c.V.button,{type:"button",role:"switch","aria-checked":h,"aria-required":x,"data-state":k(h),"data-disabled":u?"":void 0,disabled:u,value:p,...r,ref:N,onClick:(0,n.f)(s,e=>{let s=e.isPropagationStopped();j({requestedChecked:!h,hasConsumerStoppedPropagation:s}),v(e=>!e),b&&y&&!s&&e.stopPropagation()})})},"SwitchTrigger")),j=t.forwardRef(m(function(e,s){let{__scopeSwitch:t,name:n,checked:a,defaultChecked:r,required:l,disabled:o,value:c,onCheckedChange:d,form:m,...p}=e;return(0,i.jsx)(g,{__scopeSwitch:t,checked:a,defaultChecked:r,disabled:o,required:l,onCheckedChange:d,name:n,form:m,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(v,{...p,ref:s,__scopeSwitch:t}),e&&(0,i.jsx)(b,{__scopeSwitch:t})]})})},"Switch")),y=t.forwardRef(m(function(e,s){let{__scopeSwitch:t,...n}=e,a=f("SwitchThumb",t);return(0,i.jsx)(c.V.span,{"data-state":k(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:s})},"SwitchThumb")),b=t.forwardRef(m(function({__scopeSwitch:e,onClick:s,...r},l){let{control:d,userClick:m,checked:p,defaultChecked:u,required:h,disabled:x,name:g,value:v,form:j,bubbleInput:y,setBubbleInput:b}=f("SwitchBubbleInput",e),N=(0,a.f)(l,b),k=(0,o.f)(d),w=t.useRef(!1),C=t.useRef(p),S=t.useRef(m),U=t.useRef(null);t.useEffect(()=>{if(!y)return;let e=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(!e)return;let s=C.current!==p;C.current=p;let i=null!==m&&m!==S.current;if(S.current=m,i)U.current=s?null:m,s&&e.call(y,p),y.dispatchEvent(new Event("click",{bubbles:!m.hasConsumerStoppedPropagation}));else if(s){let s=U.current;U.current=null;let i=s?.requestedChecked===p;w.current=!0,e.call(y,p),y.dispatchEvent(new Event("click",{bubbles:!(i&&s.hasConsumerStoppedPropagation)})),w.current=!1}},[y,p,m]);let K=t.useRef(p);return(0,i.jsx)(c.V.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??K.current,required:h,disabled:x,name:g,value:v,form:j,...r,tabIndex:-1,ref:N,onClick:(0,n.f)(s,e=>{w.current&&e.stopPropagation()}),style:{...r.style,...k,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})},"SwitchBubbleInput"));function N(e){return"function"==typeof e}function k(e){return e?"checked":"unchecked"}m(N,"isFunction"),m(k,"getState");var w=e.i(975157);let C=t.forwardRef(({className:e,...s},t)=>(0,i.jsx)(j,{className:(0,w.f)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...s,ref:t,children:(0,i.jsx)(y,{className:(0,w.f)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));C.displayName=j.displayName,e.s(["f",0,C],699375)},713452,595468,753817,128093,e=>{var s=e.i(843476),i=e.i(271645),t=e.i(475254);let n=(0,t.f)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);e.s(["f",0,n],595468);var a=e.i(531278),r=e.i(373884);let l=(0,t.f)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);var o=e.i(519455),c=e.i(111110);function d({detail:e}){let{t:i}=(0,c.b)();return e?(0,s.jsxs)("p",{className:"mt-1 rounded bg-background/60 px-2 py-1 font-mono text-[11px] leading-relaxed text-red-700 break-all select-text",children:[(0,s.jsx)("span",{className:"font-sans text-muted-foreground",children:i.settings.ai.providerErrorDetail}),e]}):null}e.s(["f",0,d],753817);let m={minimax:{name:"MiniMax",nameEn:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn",docs:{cn:"https://platform.minimax.cn/docs/api-reference/api-overview",intl:"https://platform.minimax.io/docs/api-reference/api-overview",apiKey:"https://platform.minimax.cn/docs/guides/quickstart-preparation",models:"https://platform.minimax.cn/docs/guides/models-intro"}},glm:{name:"智谱 GLM",nameEn:"Zhipu GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn",docs:{cn:"https://docs.bigmodel.cn/cn/guide/start/quick-start",intl:"https://docs.z.ai/guides/overview/quick-start",apiKey:"https://docs.bigmodel.cn/cn/guide/start/quick-start",models:"https://docs.bigmodel.cn/cn/guide/start/model-overview"}},deepseek:{name:"DeepSeek",nameEn:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-v4-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com",docs:{cn:"https://api-docs.deepseek.com/zh-cn/",apiKey:"https://api-docs.deepseek.com/zh-cn/",models:"https://api-docs.deepseek.com/zh-cn/quick_start/pricing"}},kimi:{name:"Kimi",nameEn:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3.1-pro",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com",docs:{cn:"https://platform.moonshot.cn/docs/introduction",intl:"https://platform.moonshot.ai/docs/introduction",apiKey:"https://platform.moonshot.cn/docs/introduction",models:"https://platform.moonshot.cn/docs/pricing/chat"}},qwen:{name:"千问 Qwen",nameEn:"Qwen",baseUrl:"https://token-plan.cn-beijing.maas.aliyuncs.com/compatible-mode/v1",model:"qwen3.8-max",envPrefix:"QWEN",consoleUrl:"https://bailian.console.aliyun.com",docs:{cn:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",intl:"https://www.alibabacloud.com/help/en/model-studio/token-plan-personal-quick-start",apiKey:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",models:"https://help.aliyun.com/zh/model-studio/models"}},stepfun:{name:"阶跃星辰 StepFun",nameEn:"StepFun",baseUrl:"https://api.stepfun.com/step_plan/v1",model:"step-5-preview",envPrefix:"STEPFUN",consoleUrl:"https://platform.stepfun.com",docs:{cn:"https://platform.stepfun.com/docs/zh/guides/developer/openai",intl:"https://platform.stepfun.ai/docs/en/guides/developer/openai",apiKey:"https://platform.stepfun.com/docs/zh/guides/developer/openai",models:"https://platform.stepfun.com/docs/zh/guides/models/list"}},volcengine:{name:"火山引擎 豆包",nameEn:"Volcengine Doubao",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",model:"doubao-seed-2-1-lite-260915",envPrefix:"VOLCENGINE",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1330626",intl:"https://docs.byteplus.com/en/docs/ModelArk/1330626",apiKey:"https://www.volcengine.com/docs/82379/1541594",models:"https://www.volcengine.com/docs/82379/1330310"}},"volcengine-agent":{name:"火山引擎 Agent Plan",nameEn:"Volcengine Agent Plan",baseUrl:"https://ark.cn-beijing.volces.com/api/plan/v3",model:"ark-code-latest",envPrefix:"VOLCENGINE_AGENT",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",apiKey:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",models:"https://www.volcengine.com/docs/82379/2366394"}},"volcengine-coding":{name:"火山引擎 Coding Plan",nameEn:"Volcengine Coding Plan",baseUrl:"https://ark.cn-beijing.volces.com/api/coding/v3",model:"ark-code-latest",envPrefix:"VOLCENGINE_CODING",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1928261",apiKey:"https://www.volcengine.com/docs/82379/1928261",models:"https://www.volcengine.com/docs/82379/1928261"}},"volcengine-free":{name:"火山引擎(免费试用)",nameEn:"Volcengine (free trial)",baseUrl:"https://ark.cn-beijing.volces.com/api/v3",model:"doubao-seed-2-1-lite-260915",envPrefix:"VOLCENGINE_FREE",consoleUrl:"https://console.volcengine.com/ark",docs:{cn:"https://www.volcengine.com/docs/82379/1399514",apiKey:"https://www.volcengine.com/docs/82379/1541594",models:"https://www.volcengine.com/docs/82379/1330310"}}},p=Object.keys(m);function u(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(m,e)}e.s(["$",0,m,"U",0,p,"z",0,function(e,s){let i=m[e];return"zh"===s?i.name:i.nameEn},"j",0,u,"k",0,function(e,s){let i=m[e];return{apiKey:s?.apiKey||"",baseUrl:s?.baseUrl||i.baseUrl,model:s?.model||i.model}}],128093);var h=e.i(41931),x=e.i(303163),f=e.i(201276);e.s(["f",0,function({config:e,saving:t,saveButton:m}){let{t:p,language:g}=(0,c.b)(),[v,j]=(0,i.useState)(!1),[y,b]=(0,i.useState)(null),N=e=>p.settings?.ai?.errors?.[e]||e.replace("UNKNOWN:",""),k=async()=>{let s=function(e,s){let i=e.aiProvider;if("openai"===i){let t=e.openai?.instances?.find(s=>s.id===e.openai?.activeInstanceId);return t?.apiKey?{ok:!0,body:{provider:i,apiKey:t.apiKey,baseUrl:t.baseUrl,model:t.model,language:s}}:{ok:!1,error:"API_KEY_REQUIRED"}}if("azure"===i){let t=e.azure;return t?.apiKey&&t.endpoint&&t.deploymentName?{ok:!0,body:{provider:i,apiKey:t.apiKey,endpoint:t.endpoint,deploymentName:t.deploymentName,apiVersion:t.apiVersion,model:t.model,language:s}}:{ok:!1,error:"AZURE_CONFIG_INCOMPLETE"}}if("minimax-code"===i)return{ok:!0,body:{provider:i,model:e.minimaxCode?.model,language:s}};if("gemini"===i||"anthropic"===i||u(i)){let t=e[i];return t?.apiKey?{ok:!0,body:{provider:i,apiKey:t.apiKey,baseUrl:t.baseUrl,model:t.model,language:s}}:{ok:!1,error:"API_KEY_REQUIRED"}}return{ok:!1,error:"UNSUPPORTED_PROVIDER"}}(e,g);if(!s.ok){if("UNSUPPORTED_PROVIDER"===s.error)return;b({success:!1,textSupport:!1,visionSupport:!1,textError:"AZURE_CONFIG_INCOMPLETE"===s.error?p.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete":p.settings?.ai?.validationApiKeyRequired||"API Key is required"});return}j(!0),b(null);try{b(await h.f.post("/api/ai/test",s.body))}catch(e){f.f.error("[AiConnectionTest]","AI connection test failed",{error:e}),b({success:!1,textSupport:!1,visionSupport:!1,textError:(0,x.Z)(e)})}finally{j(!1)}};return(0,s.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(o.f,{type:"button",variant:"outline",onClick:k,disabled:v||t,className:"flex-1",children:[v?(0,s.jsx)(a.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(l,{className:"mr-2 h-4 w-4"}),v?p.settings?.ai?.testing||"Testing...":p.settings?.ai?.testConnection||"Test Connection"]}),m]}),y&&(0,s.jsxs)("div",{className:`p-3 rounded-md text-sm ${y.success?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"}`,children:[(0,s.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:y.success?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n,{className:"h-4 w-4 text-green-600"}),(0,s.jsx)("span",{className:"text-green-700",children:p.settings?.ai?.testSuccess||"Connection Successful"}),y.modelInfo&&(0,s.jsxs)("span",{className:"text-green-600 text-xs",children:["(",y.modelInfo,")"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(r.f,{className:"h-4 w-4 text-red-600"}),(0,s.jsx)("span",{className:"text-red-700",children:p.settings?.ai?.testFailed||"Connection Failed"})]})}),y.success&&(0,s.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[p.settings?.ai?.textSupport||"Text Generation",":"]}),(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",p.settings?.ai?.supported||"Supported"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[p.settings?.ai?.visionSupport||"Vision/Multimodal",":"]}),y.visionSupport?(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",p.settings?.ai?.supported||"Supported"]}):(0,s.jsxs)("span",{className:"text-amber-600",children:["✗ ",y.visionError?N(y.visionError):p.settings?.ai?.notSupported||"Not Supported"]})]}),!y.visionSupport&&(0,s.jsx)(d,{detail:y.visionErrorDetail}),(0,s.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:p.settings?.ai?.testNetworkNote})]}),!y.success&&y.textError&&(0,s.jsx)("p",{className:"text-red-600 text-xs mt-1",children:N(y.textError)}),!y.success&&(0,s.jsx)(d,{detail:y.textErrorDetail})]})]})}],713452)},10038,835467,e=>{var s=e.i(843476),i=e.i(531278),t=e.i(519455),n=e.i(110204),a=e.i(967489),r=e.i(713452),l=e.i(459649),o=e.i(118585),c=e.i(75977),d=e.i(778917),m=e.i(204997),p=e.i(292270),u=e.i(16715),h=e.i(487486),x=e.i(793479),f=e.i(551804),g=e.i(699375),v=e.i(111110),j=e.i(215519),y=e.i(306831);function b({checkin:e,autoCheckin:a,onAutoCheckinChange:r,busy:l,onCheckin:o}){let c,{t:d}=(0,v.b)(),{timeZone:m}=(0,j.M)(),p=d.settings?.ai?.minimaxCode,{today:u,last:x}=e,N=x&&"failed"!==x.status?x:null,k=!!(u?.checkedToday||N),w=String(N?.points??(u?u.points+u.bonusPoints:0)),C=String(N?.streakDays??u?.streakDays??0);return c=N?.trigger==="auto"&&"checked-in"===N.status?(p?.checkinAuto||"Checked in automatically today at {time} (+{points} credits, day {days} in a row)").replace("{time}",(0,y.r)(N.at,"HH:mm",m)).replace("{points}",w).replace("{days}",C):k?(p?.checkinDone||"Checked in today (+{points} credits, day {days} in a row)").replace("{points}",w).replace("{days}",C):x?.status==="failed"?(p?.checkinFailed||"Check-in failed: {error}").replace("{error}",x.error||""):e.autoCheckin?p?.checkinWillAuto||"Not checked in yet today. The app will check in automatically within the hour.":p?.checkinNotYet||"Not checked in yet today",(0,s.jsxs)("div",{className:"space-y-3 border-t pt-3",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[(0,s.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:p?.checkinToday||"Today's check-in"}),(0,s.jsxs)(h.f,{variant:k?"default":x?.status==="failed"?"destructive":"secondary",children:[(0,s.jsx)(f.f,{className:"mr-1 h-3 w-3"}),k?p?.checkinSuccess||"Checked in":p?.checkinNotYet||"Not yet"]})]}),!k&&(0,s.jsxs)(t.f,{size:"sm",variant:"outline",onClick:o,disabled:l,children:[l&&(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}),p?.checkinNow||"Check in now"]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground break-words",children:c}),(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)(n.f,{htmlFor:"minimax-code-auto-checkin",children:p?.autoCheckin||"Daily auto check-in"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:p?.autoCheckinHint})]}),(0,s.jsx)(g.f,{id:"minimax-code-auto-checkin",checked:a,onCheckedChange:r})]})]})}let N=["MiniMax-M3.1-Flash","MiniMax-M3","MiniMax-M2.7-highspeed","MiniMax-M2.7"];var k=e.i(271645),w=e.i(41931),C=e.i(303163),S=e.i(294114),U=e.i(201276);function K({value:e,onChange:a}){let{t:r}=(0,v.b)(),l=r.settings?.ai?.minimaxCode,{status:o,loading:c,pending:f,busy:g,refresh:j,login:y,logout:P,checkin:E}=function(){let{t:e}=(0,v.b)(),s=e.settings?.ai?.minimaxCode,[i,t]=(0,k.useState)(null),[n,a]=(0,k.useState)(!0),[r,l]=(0,k.useState)(null),[o,c]=(0,k.useState)(!1),d=(0,k.useRef)(null),m=(0,k.useCallback)(async()=>{a(!0);try{let e=await w.f.get("/api/minimax-code");t(e),e.pendingLogin&&l(e.pendingLogin)}catch(e){U.f.error("[MiniMaxCode]","Failed to load status",{error:e})}finally{a(!1)}},[]);(0,k.useEffect)(()=>{m()},[m]),(0,k.useEffect)(()=>{if(!r)return;let e=!1,i=async()=>{try{let t=await w.f.get("/api/minimax-code/login");if(e)return;if("pending"===t.status){d.current=setTimeout(i,r.intervalMs);return}l(null),"ok"===t.status?S.c.success(s?.loginSuccess||"Signed in"):"expired"===t.status?S.c.error(s?.loginExpired||"Authorization timed out"):"denied"===t.status&&S.c.error(s?.loginDenied||"Authorization declined"),m()}catch(i){if(e)return;l(null),S.c.error(`${s?.loginFailed||"Sign-in failed"}: ${(0,C.Z)(i)}`)}};return d.current=setTimeout(i,r.intervalMs),()=>{e=!0,d.current&&clearTimeout(d.current)}},[r,m,s]);let p=async()=>{c(!0);try{await w.f.delete("/api/minimax-code"),l(null),await m()}catch(e){S.c.error((0,C.Z)(e))}finally{c(!1)}},u=async()=>{c(!0);try{let e=await w.f.post("/api/minimax-code/checkin",{});"failed"===e.status?S.c.error((s?.checkinFailed||"Check-in failed: {error}").replace("{error}",e.error||"")):S.c.success(s?.checkinSuccess||"Checked in"),await m()}catch(e){S.c.error((0,C.Z)(e))}finally{c(!1)}};return{status:i,loading:n,pending:r,busy:o,refresh:m,login:async()=>{c(!0);try{let e=await w.f.post("/api/minimax-code/login",{});l(e),window.open(e.url,"_blank","noopener,noreferrer")}catch(e){S.c.error(`${s?.loginFailed||"Sign-in failed"}: ${(0,C.Z)(e)}`)}finally{c(!1)}},logout:p,checkin:u}}(),M=o?.login??"none",I=o?.account,z=o?.credits,A={none:l?.statusNone||"Not signed in",active:l?.statusActive||"Signed in",expired:l?.statusExpired||"Login expired"}[M];return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.intro}),(0,s.jsxs)("section",{className:"space-y-3 rounded-md border bg-background p-3","aria-label":l?.title||"MiniMax Code account",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)("h4",{className:"text-sm font-medium",children:l?.title||"MiniMax Code account"}),(0,s.jsx)(t.f,{variant:"ghost",size:"sm",onClick:()=>void j(),disabled:c,"aria-label":l?.refresh||"Refresh",children:(0,s.jsx)(u.f,{className:`h-4 w-4 ${c?"animate-spin":""}`})})]}),(0,s.jsxs)("dl",{className:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-sm",children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:l?.loginStatus||"Login status"}),(0,s.jsxs)("dd",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,s.jsx)(h.f,{variant:"active"===M?"default":"expired"===M?"destructive":"secondary",children:A}),I&&(0,s.jsx)("span",{className:"truncate text-muted-foreground",children:I.name||I.email||I.userId})]}),"active"===M&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("dt",{className:"text-muted-foreground",children:l?.credits||"Remaining credits"}),(0,s.jsx)("dd",{children:z?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"font-medium tabular-nums",children:z.total}),(0,s.jsx)("span",{className:"ml-2 text-xs text-muted-foreground",children:(l?.creditsDetail||"Free {free} · Purchased {purchased}").replace("{free}",String(z.free)).replace("{purchased}",String(z.purchased))})]}):(0,s.jsx)("span",{className:"text-muted-foreground",children:l?.creditsUnavailable||"Unavailable"})})]})]}),"active"===M&&o&&(0,s.jsx)(b,{checkin:o.checkin,autoCheckin:e?.autoCheckin!==!1,onAutoCheckinChange:s=>a({...e,autoCheckin:s}),busy:g,onCheckin:()=>void E()}),f?(0,s.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-sm",children:[(0,s.jsxs)("p",{className:"flex items-center gap-2",children:[(0,s.jsx)(i.f,{className:"h-4 w-4 animate-spin"}),l?.waiting]}),f.userCode&&(0,s.jsxs)("p",{children:[l?.userCode||"Verification code",": ",(0,s.jsx)("span",{className:"font-mono font-medium",children:f.userCode})]}),(0,s.jsxs)("a",{href:f.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[l?.openLink||"Open the authorization page"," ",(0,s.jsx)(d.f,{className:"h-3 w-3"})]})]}):(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsxs)(t.f,{size:"sm",onClick:()=>void y(),disabled:g,children:[g?(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(m.f,{className:"mr-2 h-4 w-4"}),"none"===M?l?.login||"Sign in with browser":l?.relogin||"Sign in again"]}),"none"!==M&&(0,s.jsxs)(t.f,{size:"sm",variant:"outline",onClick:()=>void P(),disabled:g,children:[(0,s.jsx)(p.f,{className:"mr-2 h-4 w-4"}),l?.logout||"Sign out"]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{htmlFor:"minimax-code-model",children:l?.model||"Model"}),(0,s.jsx)(x.f,{id:"minimax-code-model",list:"minimax-code-models",value:e?.model||"",onChange:s=>a({...e,model:s.target.value}),placeholder:"MiniMax-M3.1-Flash"}),(0,s.jsx)("datalist",{id:"minimax-code-models",children:N.map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.modelHint})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l?.risk})]})}var P=e.i(107233),E=e.i(727612),M=e.i(464034),I=e.i(434901),z=e.i(37038),A=e.i(62189);function R({value:e,onChange:i}){let{t:r}=(0,v.b)(),l=(0,A.f)("openai"),o=e?.instances||[],c=e?.activeInstanceId,d=o.find(e=>e.id===c),m=(s,t)=>{i({...e,instances:o.map(e=>e.id===c?{...e,[s]:t}:e)})},p=async()=>{if(!c||!await (0,S.u)(r.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0}))return;let e=o.filter(e=>e.id!==c);i({instances:e,activeInstanceId:e[0]?.id})};return(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)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.instances||"Instance"}),(0,s.jsxs)(t.f,{type:"button",variant:"outline",size:"sm",onClick:()=>{if(o.length>=10)return;let e={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let s=16*Math.random()|0;return("x"===e?s:3&s|8).toString(16)}),name:`Instance ${o.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};i({instances:[...o,e],activeInstanceId:e.id})},disabled:o.length>=10,className:"h-7 px-2 text-xs",children:[(0,s.jsx)(P.f,{className:"h-3 w-3 mr-1"}),r.settings?.ai?.addInstance||"Add"]})]}),o.length>0?(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(a.d,{value:c||"",onValueChange:s=>i({...e,activeInstanceId:s}),children:[(0,s.jsx)(a.P,{className:"flex-1",children:(0,s.jsx)(a.U,{placeholder:r.settings?.ai?.selectInstance||"Select Instance"})}),(0,s.jsx)(a.r,{children:o.map(e=>(0,s.jsx)(a.T,{value:e.id,children:e.name},e.id))})]}),o.length>1&&(0,s.jsx)(t.f,{type:"button",variant:"outline",size:"icon",onClick:p,className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,s.jsx)(E.f,{className:"h-4 w-4"})})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:r.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),o.length>=10&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:r.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),d&&(0,s.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(n.f,{children:[r.settings?.ai?.instanceName||"Instance Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(x.f,{value:d.name||"",onChange:e=>m("name",e.target.value),placeholder:"e.g. GLM-4V",className:d.name?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I.f,{label:(0,s.jsxs)(s.Fragment,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(z.f,{value:d.apiKey||"",onChange:e=>m("apiKey",e.target.value),placeholder:"sk-...",className:d.apiKey?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)(n.f,{children:["Base URL ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(x.f,{value:d.baseUrl||"",onChange:e=>m("baseUrl",e.target.value),placeholder:"https://api.openai.com/v1",className:d.baseUrl?.trim()?"":"border-destructive"})]}),(0,s.jsx)(M.f,{provider:"openai",apiKey:d.apiKey,baseUrl:d.baseUrl,currentModel:d.model,onModelChange:e=>m("model",e),docsHref:l?.models})]})]})}function T({provider:e}){let{t:i}=(0,v.b)(),t=i.settings.ai.providerDocs,n=(0,A.f)(e);if(!n)return null;let a=[n.cn&&{href:n.cn,label:n.intl?t.cn:t.official},n.intl&&{href:n.intl,label:n.cn?t.intl:t.official}].filter(e=>!!e);return(0,s.jsxs)("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:t.title}),a.map(e=>(0,s.jsxs)("a",{href:e.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 underline",children:[e.label,(0,s.jsx)(d.f,{className:"h-3 w-3"})]},e.href))]})}var q=e.i(128093);function F({provider:e,value:i,onChange:t}){let{t:a}=(0,v.b)(),r=q.$[e],l=(e,s)=>t({...i,[e]:s}),o={qwen:a.settings?.ai?.qwenBaseUrlHint,stepfun:a.settings?.ai?.stepfunBaseUrlHint,volcengine:a.settings?.ai?.volcengineBaseUrlHint,"volcengine-agent":a.settings?.ai?.volcengineAgentBaseUrlHint,"volcengine-coding":a.settings?.ai?.volcengineCodingBaseUrlHint};return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:["volcengine-free"===e&&(0,s.jsxs)("div",{className:"rounded-md border border-green-200 bg-green-50 p-3 text-xs text-green-800 dark:border-green-900 dark:bg-green-950/40 dark:text-green-300",children:[(0,s.jsx)("p",{className:"font-medium",children:a.settings.ai.volcengineFree.title}),(0,s.jsx)("p",{className:"mt-1",children:a.settings.ai.volcengineFree.body})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(I.f,{label:"API Key",href:r.docs.apiKey,linkText:a.settings.ai.docLinks.apiKey}),(0,s.jsx)(z.f,{value:i?.apiKey||"",onChange:e=>l("apiKey",e.target.value),placeholder:"sk-..."}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[a.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,s.jsx)("a",{href:r.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:r.consoleUrl})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(x.f,{value:i?.baseUrl||"",onChange:e=>l("baseUrl",e.target.value),placeholder:r.baseUrl}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:o[e]??a.settings?.ai?.vendorBaseUrlHint})]}),(0,s.jsx)(M.f,{provider:e,apiKey:i?.apiKey,baseUrl:i?.baseUrl,currentModel:i?.model||r.model,onModelChange:e=>l("model",e),docsHref:r.docs.models})]})}e.s(["f",0,function({config:e,setConfig:d,loading:m,saving:p,onSave:u}){let{t:h,language:x}=(0,v.b)();return m?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(i.f,{className:"h-6 w-6 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:"space-y-2",children:[(0,s.jsx)(n.f,{children:h.settings?.tabs?.ai||"AI Provider"}),(0,s.jsxs)(a.d,{value:e.aiProvider,onValueChange:e=>d(s=>({...s,aiProvider:e})),children:[(0,s.jsx)(a.P,{children:(0,s.jsx)(a.U,{})}),(0,s.jsxs)(a.r,{children:[(0,s.jsx)(a.T,{value:"minimax",children:(0,q.z)("minimax",x)}),(0,s.jsx)(a.T,{value:"minimax-code",children:"MiniMax Code OAuth"}),q.U.filter(e=>"minimax"!==e).map(e=>(0,s.jsx)(a.T,{value:e,children:(0,q.z)(e,x)},e)),(0,s.jsx)(a.T,{value:"anthropic",children:"Anthropic / Compatible"}),(0,s.jsx)(a.T,{value:"azure",children:"Azure OpenAI"}),(0,s.jsx)(a.T,{value:"openai",children:"OpenAI / Compatible"}),(0,s.jsx)(a.T,{value:"gemini",children:"Google Gemini"})]})]}),(0,s.jsx)(T,{provider:e.aiProvider})]}),"openai"===e.aiProvider&&(0,s.jsx)(R,{value:e.openai,onChange:e=>d(s=>({...s,openai:e}))}),"gemini"===e.aiProvider&&(0,s.jsx)(c.f,{value:e.gemini,onChange:e=>d(s=>({...s,gemini:e}))}),"minimax-code"===e.aiProvider&&(0,s.jsx)(K,{value:e.minimaxCode,onChange:e=>d(s=>({...s,minimaxCode:e}))}),"anthropic"===e.aiProvider&&(0,s.jsx)(l.f,{value:e.anthropic,onChange:e=>d(s=>({...s,anthropic:e}))}),(0,q.j)(e.aiProvider)&&(0,s.jsx)(F,{provider:e.aiProvider,value:e[e.aiProvider],onChange:e=>d(s=>({...s,[s.aiProvider]:e}))},e.aiProvider),"azure"===e.aiProvider&&(0,s.jsx)(o.f,{value:e.azure,onChange:e=>d(s=>({...s,azure:e}))}),(0,s.jsx)(r.f,{config:e,saving:p,saveButton:(0,s.jsxs)(t.f,{onClick:u,disabled:p,className:"flex-1",children:[p&&(0,s.jsx)(i.f,{className:"mr-2 h-4 w-4 animate-spin"}),h.settings?.ai?.save||"Save AI Settings"]})})]})}],10038),e.s(["f",0,function(e,s){if(!(0,y.L)(e.timeZone??y.J))return s.settings.general.invalidTimeZone;if("openai"===e.aiProvider)for(let i of e.openai?.instances||[]){if(!i.name?.trim())return s.settings?.ai?.validationNameRequired||"Instance name is required";if(!i.apiKey?.trim())return s.settings?.ai?.validationApiKeyRequired||"API Key is required";if(!i.baseUrl?.trim())return s.settings?.ai?.validationBaseUrlRequired||"Base URL is required";if(!i.model?.trim())return s.settings?.ai?.validationModelRequired||"Model name is required"}if("azure"===e.aiProvider){if(!e.azure?.endpoint?.trim())return s.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(!e.azure?.deploymentName?.trim())return s.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required";if(!e.azure?.apiKey?.trim())return s.settings?.ai?.validationApiKeyRequired||"API Key is required"}return null}],835467)},459649,464034,434901,62189,118585,75977,204997,e=>{var s=e.i(843476),i=e.i(793479),t=e.i(37038),n=e.i(110204),a=e.i(271645),r=e.i(519455),l=e.i(967489),o=e.i(778917),c=e.i(16715),d=e.i(531278),m=e.i(41931),p=e.i(111110),u=e.i(128093),h=e.i(201276);function x({provider:e,apiKey:t,baseUrl:f,currentModel:g,onModelChange:v,docsHref:j}){let{t:y}=(0,p.b)(),[b,N]=(0,a.useState)([]),[k,w]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),[U,K]=(0,a.useState)(g||""),[P,E]=(0,a.useState)(!1),[M,I]=(0,a.useState)(g);g!==M&&(I(g),K(g||""));let z=async()=>{if(!t)return void S(y.modelSelector?.enterApiKeyFirst||"Please enter API Key first");w(!0),S(null);try{let s=await m.f.post("/api/ai/models",{provider:e,apiKey:t,...f&&{baseUrl:f}});if("error"in s&&"string"==typeof s.error){S(s.error),E(!0),N([]);return}N(s.models),0===s.models.length&&(S(y.modelSelector?.noVisionModel||"No vision model found, please enter manually"),E(!0))}catch(s){h.f.error("[ModelSelector]","Failed to fetch models",{error:s});let e=s instanceof Error&&s.message||y.modelSelector?.fetchFailed||"Failed to fetch models";S(e+(y.modelSelector?.enterManually||", please enter manually")),E(!0)}finally{w(!1)}};return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.f,{className:"flex-1",children:y.modelSelector?.modelName||"Model Name"}),j&&(0,s.jsxs)("a",{href:j,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline",children:[y.settings.ai.docLinks.models,(0,s.jsx)(o.f,{className:"h-3 w-3"})]}),(0,s.jsx)(r.f,{type:"button",variant:"outline",size:"sm",onClick:z,disabled:k||!t,children:k?(0,s.jsx)(d.f,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(c.f,{className:"h-3 w-3"})})]}),C&&(0,s.jsx)("p",{className:"text-xs text-yellow-600",children:C}),P||0===b.length?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(i.f,{value:U,onChange:e=>{var s;K(s=e.target.value),v(s)},placeholder:(0,u.j)(e)?u.$[e].model:"openai"===e?"gpt-6.1-sol":"gemini-1.5-flash"}),b.length>0&&(0,s.jsx)(r.f,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>E(!1),children:y.modelSelector?.selectFromList||"Select from List"})]}):(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)(l.d,{value:g,onValueChange:e=>{"_custom"===e?E(!0):(E(!1),K(e),v(e))},children:[(0,s.jsx)(l.P,{children:(0,s.jsx)(l.U,{placeholder:y.modelSelector?.selectModel||"Select Model"})}),(0,s.jsxs)(l.r,{children:[b.map(e=>(0,s.jsxs)(l.T,{value:e.id,children:[e.name,e.owned_by&&` (${e.owned_by})`]},e.id)),(0,s.jsx)(l.T,{value:"_custom",children:y.modelSelector?.customInput||"Custom Input..."})]})]})})]})}function f({label:e,href:i,linkText:t}){return i?(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,s.jsx)(n.f,{children:e}),(0,s.jsxs)("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground underline",children:[t,(0,s.jsx)(o.f,{className:"h-3 w-3"})]})]}):(0,s.jsx)(n.f,{children:e})}e.s(["f",0,x],464034),e.s(["f",0,f],434901);let g={openai:{intl:"https://platform.openai.com/docs/api-reference",apiKey:"https://platform.openai.com/docs/quickstart",models:"https://platform.openai.com/docs/models"},anthropic:{intl:"https://docs.anthropic.com/en/api/overview",apiKey:"https://docs.anthropic.com/en/api/getting-started",models:"https://docs.anthropic.com/en/docs/about-claude/models/overview"},azure:{intl:"https://learn.microsoft.com/azure/ai-foundry/openai/reference",apiKey:"https://learn.microsoft.com/azure/ai-foundry/openai/how-to/create-resource",models:"https://learn.microsoft.com/azure/ai-foundry/openai/concepts/models"},gemini:{intl:"https://ai.google.dev/gemini-api/docs",apiKey:"https://ai.google.dev/gemini-api/docs/api-key",models:"https://ai.google.dev/gemini-api/docs/models"}};function v(e){return(0,u.j)(e)?u.$[e].docs:g[e]??null}e.s(["f",0,v],62189),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("anthropic"),o=(s,i)=>a({...e,[s]:i});return(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.jsx)(f,{label:"API Key",href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"sk-ant-..."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(i.f,{value:e?.baseUrl||"",onChange:e=>o("baseUrl",e.target.value),placeholder:"https://api.anthropic.com"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r.settings?.ai?.anthropicBaseUrlHint})]}),(0,s.jsx)(x,{provider:"anthropic",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>o("model",e),docsHref:l?.models})]})}],459649),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("azure"),o=(s,i)=>a({...e,[s]:i}),c=e=>e?.trim()?"":"border-destructive";return(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)(n.f,{children:[r.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(i.f,{value:e?.endpoint||"",onChange:e=>o("endpoint",e.target.value),placeholder:r.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:c(e?.endpoint)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:(0,s.jsxs)(s.Fragment,{children:[r.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.models,linkText:r.settings.ai.docLinks.models}),(0,s.jsx)(i.f,{value:e?.deploymentName||"",onChange:e=>o("deploymentName",e.target.value),placeholder:r.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:c(e?.deploymentName)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(f,{label:(0,s.jsxs)(s.Fragment,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:c(e?.apiKey)})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.azureApiVersion||"API Version"}),(0,s.jsx)(i.f,{value:e?.apiVersion||"",onChange:e=>o("apiVersion",e.target.value),placeholder:r.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:r.settings?.ai?.azureModel||"Model Display Name"}),(0,s.jsx)(i.f,{value:e?.model||"",onChange:e=>o("model",e.target.value),placeholder:"gpt-4o"})]})]})}],118585),e.s(["f",0,function({value:e,onChange:a}){let{t:r}=(0,p.b)(),l=v("gemini"),o=(s,i)=>a({...e,[s]:i});return(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.jsx)(f,{label:"API Key",href:l?.apiKey,linkText:r.settings.ai.docLinks.apiKey}),(0,s.jsx)(t.f,{value:e?.apiKey||"",onChange:e=>o("apiKey",e.target.value),placeholder:"AIza..."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(n.f,{children:"Base URL (Optional)"}),(0,s.jsx)(i.f,{value:e?.baseUrl||"",onChange:e=>o("baseUrl",e.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,s.jsx)(x,{provider:"gemini",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>o("model",e),docsHref:l?.models})]})}],75977);let j=(0,e.i(475254).f)("log-in",[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]]);e.s(["f",0,j],204997)},37038,e=>{var s=e.i(843476),i=e.i(271645),t=e.i(286536),n=e.i(77705),a=e.i(519455),r=e.i(793479),l=e.i(111110),o=e.i(975157);e.s(["f",0,function({className:e,...c}){let{t:d}=(0,l.b)(),[m,p]=(0,i.useState)(!1);return(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(r.f,{type:m?"text":"password",className:(0,o.f)("pr-10",e),...c}),(0,s.jsx)(a.f,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>p(!m),"aria-label":m?d.common.hidePassword:d.common.showPassword,tabIndex:-1,children:m?(0,s.jsx)(n.f,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(t.f,{className:"h-4 w-4 text-muted-foreground"})})]})}])}])})();