wrong-notebook 2026.11.4 → 2026.11.5-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (391) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +1 -0
  3. package/.next/build-manifest.json +3 -3
  4. package/.next/routes-manifest.json +6 -0
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/admin/page.js.nft.json +1 -1
  13. package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
  14. package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
  15. package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
  16. package/.next/server/app/api/admin/cnm-tags/route.js.nft.json +1 -1
  17. package/.next/server/app/api/admin/dashboard/route.js +6 -6
  18. package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
  19. package/.next/server/app/api/admin/debug-logs/export/route.js.nft.json +1 -1
  20. package/.next/server/app/api/admin/debug-logs/route.js.nft.json +1 -1
  21. package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
  22. package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
  23. package/.next/server/app/api/admin/users/[id]/detail/route.js +6 -6
  24. package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
  25. package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
  26. package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
  27. package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
  28. package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
  29. package/.next/server/app/api/analytics/route.js +2 -2
  30. package/.next/server/app/api/analytics/route.js.nft.json +1 -1
  31. package/.next/server/app/api/analyze/route.js +11 -11
  32. package/.next/server/app/api/analyze/route.js.nft.json +1 -1
  33. package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
  34. package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
  35. package/.next/server/app/api/error-items/[id]/figure/route.js +5 -5
  36. package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
  37. package/.next/server/app/api/error-items/[id]/fix-latex/route.js +2 -2
  38. package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
  39. package/.next/server/app/api/error-items/[id]/geogebra/route.js +7 -7
  40. package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
  41. package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
  42. package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
  43. package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
  44. package/.next/server/app/api/error-items/[id]/reanswer/route.js +7 -7
  45. package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
  46. package/.next/server/app/api/error-items/[id]/retag/route.js +1 -1
  47. package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
  48. package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
  49. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +12 -12
  50. package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
  51. package/.next/server/app/api/error-items/[id]/svg-animation/route.js +12 -12
  52. package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
  53. package/.next/server/app/api/error-items/answer-space/route.js.nft.json +1 -1
  54. package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
  55. package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
  56. package/.next/server/app/api/error-items/export-questions/route.js.nft.json +1 -1
  57. package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
  58. package/.next/server/app/api/error-items/route.js +8 -8
  59. package/.next/server/app/api/error-items/route.js.nft.json +1 -1
  60. package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
  61. package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
  62. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +9 -9
  63. package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
  64. package/.next/server/app/api/exams/[id]/results/route.js +2 -2
  65. package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
  66. package/.next/server/app/api/exams/[id]/retry/route.js +7 -7
  67. package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
  68. package/.next/server/app/api/exams/[id]/route.js +5 -5
  69. package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
  70. package/.next/server/app/api/exams/route.js +6 -6
  71. package/.next/server/app/api/exams/route.js.nft.json +1 -1
  72. package/.next/server/app/api/export/route.js.nft.json +1 -1
  73. package/.next/server/app/api/geogebra-analyze/route.js +2 -2
  74. package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
  75. package/.next/server/app/api/health/route.js.nft.json +1 -1
  76. package/.next/server/app/api/import/route.js +9 -9
  77. package/.next/server/app/api/import/route.js.nft.json +1 -1
  78. package/.next/server/app/api/import-batches/[id]/confirm-all/route.js +17 -17
  79. package/.next/server/app/api/import-batches/[id]/confirm-all/route.js.nft.json +1 -1
  80. package/.next/server/app/api/import-batches/[id]/fix-text/route.js +4 -4
  81. package/.next/server/app/api/import-batches/[id]/fix-text/route.js.nft.json +1 -1
  82. package/.next/server/app/api/import-batches/[id]/read/route.js +16 -16
  83. package/.next/server/app/api/import-batches/[id]/read/route.js.nft.json +1 -1
  84. package/.next/server/app/api/import-batches/[id]/retry/route.js +17 -17
  85. package/.next/server/app/api/import-batches/[id]/retry/route.js.nft.json +1 -1
  86. package/.next/server/app/api/import-batches/[id]/route.js +16 -16
  87. package/.next/server/app/api/import-batches/[id]/route.js.nft.json +1 -1
  88. package/.next/server/app/api/import-batches/[id]/start/route.js +16 -16
  89. package/.next/server/app/api/import-batches/[id]/start/route.js.nft.json +1 -1
  90. package/.next/server/app/api/import-batches/route.js +16 -16
  91. package/.next/server/app/api/import-batches/route.js.nft.json +1 -1
  92. package/.next/server/app/api/import-tasks/[id]/confirm/route.js +19 -19
  93. package/.next/server/app/api/import-tasks/[id]/confirm/route.js.nft.json +1 -1
  94. package/.next/server/app/api/import-tasks/[id]/read/route.js +19 -19
  95. package/.next/server/app/api/import-tasks/[id]/read/route.js.nft.json +1 -1
  96. package/.next/server/app/api/import-tasks/[id]/retry/route.js +19 -19
  97. package/.next/server/app/api/import-tasks/[id]/retry/route.js.nft.json +1 -1
  98. package/.next/server/app/api/import-tasks/[id]/route.js +19 -19
  99. package/.next/server/app/api/import-tasks/[id]/route.js.nft.json +1 -1
  100. package/.next/server/app/api/import-tasks/route.js +16 -16
  101. package/.next/server/app/api/import-tasks/route.js.nft.json +1 -1
  102. package/.next/server/app/api/initialize/route.js.nft.json +1 -1
  103. package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
  104. package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
  105. package/.next/server/app/api/minimax-code/login/route.js.nft.json +1 -1
  106. package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
  107. package/.next/server/app/api/notebooks/[id]/retag/route.js +1 -1
  108. package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
  109. package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
  110. package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
  111. package/.next/server/app/api/openclaw/batch-upload/route.js +5 -5
  112. package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
  113. package/.next/server/app/api/paper-groups/[id]/route.js.nft.json +1 -1
  114. package/.next/server/app/api/paper-groups/route.js.nft.json +1 -1
  115. package/.next/server/app/api/practice/generate/route.js +6 -6
  116. package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
  117. package/.next/server/app/api/practice/grade/route.js +5 -5
  118. package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
  119. package/.next/server/app/api/practice/record/[id]/route.js +5 -5
  120. package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
  121. package/.next/server/app/api/practice/record/route.js +4 -4
  122. package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
  123. package/.next/server/app/api/reanswer/route.js +3 -3
  124. package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
  125. package/.next/server/app/api/register/route.js.nft.json +1 -1
  126. package/.next/server/app/api/register/status/route.js.nft.json +1 -1
  127. package/.next/server/app/api/requests/[id]/route.js.nft.json +1 -1
  128. package/.next/server/app/api/review/due/route.js +3 -3
  129. package/.next/server/app/api/review/due/route.js.nft.json +1 -1
  130. package/.next/server/app/api/settings/route.js.nft.json +1 -1
  131. package/.next/server/app/api/setup/route.js.nft.json +1 -1
  132. package/.next/server/app/api/stats/activity/route.js.nft.json +1 -1
  133. package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
  134. package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
  135. package/.next/server/app/api/stats/repeated-mistakes/route.js +2 -2
  136. package/.next/server/app/api/stats/repeated-mistakes/route.js.nft.json +1 -1
  137. package/.next/server/app/api/stats/weak-tags/route.js +2 -2
  138. package/.next/server/app/api/stats/weak-tags/route.js.nft.json +1 -1
  139. package/.next/server/app/api/tags/route.js.nft.json +1 -1
  140. package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
  141. package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
  142. package/.next/server/app/api/tasks/route.js.nft.json +1 -1
  143. package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -1
  144. package/.next/server/app/api/tts/batch/route.js.nft.json +1 -1
  145. package/.next/server/app/api/tts/route.js.nft.json +1 -1
  146. package/.next/server/app/api/tts/status/route.js.nft.json +1 -1
  147. package/.next/server/app/api/user/ai-consent/route/app-paths-manifest.json +3 -0
  148. package/.next/server/app/api/user/ai-consent/route/build-manifest.json +12 -0
  149. package/.next/server/app/api/user/ai-consent/route/server-reference-manifest.json +4 -0
  150. package/.next/server/app/api/user/ai-consent/route.js +12 -0
  151. package/.next/server/app/api/user/ai-consent/route.js.map +5 -0
  152. package/.next/server/app/api/user/ai-consent/route.js.nft.json +1 -0
  153. package/.next/server/app/api/user/ai-consent/route_client-reference-manifest.js +3 -0
  154. package/.next/server/app/api/user/route.js +4 -4
  155. package/.next/server/app/api/user/route.js.nft.json +1 -1
  156. package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
  157. package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
  158. package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
  159. package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
  160. package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
  161. package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
  162. package/.next/server/app/exams/page.js.nft.json +1 -1
  163. package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
  164. package/.next/server/app/import-batches/[id]/page.js.nft.json +1 -1
  165. package/.next/server/app/import-batches/[id]/page_client-reference-manifest.js +1 -1
  166. package/.next/server/app/import-tasks/[id]/page.js.nft.json +1 -1
  167. package/.next/server/app/import-tasks/[id]/page_client-reference-manifest.js +1 -1
  168. package/.next/server/app/import-tasks/page.js.nft.json +1 -1
  169. package/.next/server/app/import-tasks/page_client-reference-manifest.js +1 -1
  170. package/.next/server/app/initialize/page.js.nft.json +1 -1
  171. package/.next/server/app/initialize/page_client-reference-manifest.js +1 -1
  172. package/.next/server/app/login/page.js.nft.json +1 -1
  173. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  174. package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
  175. package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
  176. package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
  177. package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
  178. package/.next/server/app/notebooks/page.js.nft.json +1 -1
  179. package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
  180. package/.next/server/app/page.js.nft.json +1 -1
  181. package/.next/server/app/page_client-reference-manifest.js +1 -1
  182. package/.next/server/app/practice/page.js.nft.json +1 -1
  183. package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
  184. package/.next/server/app/print-preview/page.js.nft.json +1 -1
  185. package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
  186. package/.next/server/app/register/page.js.nft.json +1 -1
  187. package/.next/server/app/register/page_client-reference-manifest.js +1 -1
  188. package/.next/server/app/review/page.js.nft.json +1 -1
  189. package/.next/server/app/review/page_client-reference-manifest.js +1 -1
  190. package/.next/server/app/setup/page.js.nft.json +1 -1
  191. package/.next/server/app/setup/page_client-reference-manifest.js +1 -1
  192. package/.next/server/app/stats/page.js.nft.json +1 -1
  193. package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
  194. package/.next/server/app/tags/page.js.nft.json +1 -1
  195. package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
  196. package/.next/server/app-paths-manifest.json +1 -0
  197. package/.next/server/chunks/[root-of-the-server]__0-d_vh1kcmw7g._.js +1 -1
  198. package/.next/server/chunks/{[root-of-the-server]__025dluj5es8w4._.js → [root-of-the-server]__0-zi_nkxp9dof._.js} +1 -1
  199. package/.next/server/chunks/{[root-of-the-server]__0l8sbsrfjhttk._.js → [root-of-the-server]__02kuxxv4mod1v._.js} +2 -2
  200. package/.next/server/chunks/{[root-of-the-server]__01jxyfokd6l4_._.js → [root-of-the-server]__032tjseth76z3._.js} +1 -1
  201. package/.next/server/chunks/{[root-of-the-server]__00w9qhjl8kvr4._.js → [root-of-the-server]__05wem-_dvlzug._.js} +1 -1
  202. package/.next/server/chunks/{[root-of-the-server]__00w_kxg7h-9_p._.js → [root-of-the-server]__06-v15r8ror-q._.js} +1 -1
  203. package/.next/server/chunks/[root-of-the-server]__06irm2njvcb2a._.js +3 -0
  204. package/.next/server/chunks/{[root-of-the-server]__13a3izu1xb4m4._.js → [root-of-the-server]__07twbtie04xx6._.js} +2 -2
  205. package/.next/server/chunks/{[root-of-the-server]__0-ii_w4q2w_78._.js → [root-of-the-server]__08wrx5aay9znc._.js} +2 -2
  206. package/.next/server/chunks/{[root-of-the-server]__1e7_e83zxstdw._.js → [root-of-the-server]__0_e69dt7jrpui._.js} +2 -2
  207. package/.next/server/chunks/[root-of-the-server]__0_icvdlc-nqy_._.js +3 -0
  208. package/.next/server/chunks/[root-of-the-server]__0aynxvfd9wp_r._.js +3 -0
  209. package/.next/server/chunks/[root-of-the-server]__0dv_e-7ip1wts._.js +3 -0
  210. package/.next/server/chunks/{[root-of-the-server]__02fu_lp66613e._.js → [root-of-the-server]__0eyqs-2hri164._.js} +2 -2
  211. package/.next/server/chunks/{[root-of-the-server]__14gc66h_h3i2i._.js → [root-of-the-server]__0f8kzoc_gaf8y._.js} +2 -2
  212. package/.next/server/chunks/{[root-of-the-server]__163ocf8u6v-xl._.js → [root-of-the-server]__0fembrq8pciz5._.js} +2 -2
  213. package/.next/server/chunks/{[root-of-the-server]__04yihz3dovm0z._.js → [root-of-the-server]__0g0van70ibkrj._.js} +2 -2
  214. package/.next/server/chunks/[root-of-the-server]__0g2s86ce159k0._.js +3 -0
  215. package/.next/server/chunks/{[root-of-the-server]__05a4j8yu5_bg1._.js → [root-of-the-server]__0gankrx12ee4n._.js} +2 -2
  216. package/.next/server/chunks/[root-of-the-server]__0hxujtysw2kwx._.js +3 -0
  217. package/.next/server/chunks/[root-of-the-server]__0ilrqq68_5wg5._.js +3 -0
  218. package/.next/server/chunks/[root-of-the-server]__0ky9-3kyba1lu._.js +3 -0
  219. package/.next/server/chunks/[root-of-the-server]__0lgbdth9-z6qg._.js +1 -1
  220. package/.next/server/chunks/[root-of-the-server]__0lwuci8tnhggb._.js +3 -0
  221. package/.next/server/chunks/[root-of-the-server]__0m4dmn-gj2fnm._.js +3 -0
  222. package/.next/server/chunks/[root-of-the-server]__0ntfbtwf-s7a6._.js +3 -0
  223. package/.next/server/chunks/[root-of-the-server]__0of02idkcau3l._.js +3 -0
  224. package/.next/server/chunks/{[root-of-the-server]__0svpy5s3x369z._.js → [root-of-the-server]__0ohg2cyilt44e._.js} +2 -2
  225. package/.next/server/chunks/[root-of-the-server]__0rsgnrk2qy8wo._.js +3 -0
  226. package/.next/server/chunks/[root-of-the-server]__0si2-m5an9zl7._.js +1 -1
  227. package/.next/server/chunks/[root-of-the-server]__0svdqovwfpro2._.js +1 -1
  228. package/.next/server/chunks/[root-of-the-server]__0v0tr1bn12xyu._.js +3 -0
  229. package/.next/server/chunks/[root-of-the-server]__0vazs1dmyut7b._.js +3 -0
  230. package/.next/server/chunks/{[root-of-the-server]__11wpfrrg965mf._.js → [root-of-the-server]__0w9x80vsjqsbt._.js} +2 -2
  231. package/.next/server/chunks/[root-of-the-server]__0x76w78-o6bfn._.js +3 -0
  232. package/.next/server/chunks/[root-of-the-server]__0xwm-4fhj8j--._.js +3 -0
  233. package/.next/server/chunks/{[root-of-the-server]__0rwoy4jm7s8o7._.js → [root-of-the-server]__13u9cd4f8_gva._.js} +2 -2
  234. package/.next/server/chunks/[root-of-the-server]__16j73gw0vaw81._.js +3 -0
  235. package/.next/server/chunks/[root-of-the-server]__17_lgezg_8k4-._.js +3 -0
  236. package/.next/server/chunks/[root-of-the-server]__17qr9lkc0h9ta._.js +3 -0
  237. package/.next/server/chunks/{[root-of-the-server]__1bw1tevy-ufwx._.js → [root-of-the-server]__18axi_zdc2uzr._.js} +2 -2
  238. package/.next/server/chunks/[root-of-the-server]__19larrqj6rokv._.js +3 -0
  239. package/.next/server/chunks/[root-of-the-server]__1cno0cu053una._.js +3 -0
  240. package/.next/server/chunks/[root-of-the-server]__1cowc49z-6tny._.js +3 -0
  241. package/.next/server/chunks/{[root-of-the-server]__001wdwos9fkgg._.js → [root-of-the-server]__1edbiu94nqqym._.js} +2 -2
  242. package/.next/server/chunks/[root-of-the-server]__1f-ve8idsq57l._.js +1 -1
  243. package/.next/server/chunks/[root-of-the-server]__1f_ztllkdhd1g._.js +3 -0
  244. package/.next/server/chunks/[root-of-the-server]__1g_f4opcfnwwl._.js +3 -0
  245. package/.next/server/chunks/[root-of-the-server]__1iysogl93kyqq._.js +3 -0
  246. package/.next/server/chunks/[root-of-the-server]__1ka1feeszq3gt._.js +3 -0
  247. package/.next/server/chunks/[root-of-the-server]__1ke-yb4v9knf4._.js +3 -0
  248. package/.next/server/chunks/[root-of-the-server]__1kp5acqtrdysf._.js +3 -0
  249. package/.next/server/chunks/[root-of-the-server]__1kxewr0hve3xs._.js +3 -0
  250. package/.next/server/chunks/[root-of-the-server]__1l47_6jece7bq._.js +3 -0
  251. package/.next/server/chunks/{[root-of-the-server]__1gc1jsjtvhvls._.js → [root-of-the-server]__1nb3q3vglx569._.js} +2 -2
  252. package/.next/server/chunks/[root-of-the-server]__1o42aqttqc3b8._.js +3 -0
  253. package/.next/server/chunks/[root-of-the-server]__1pw5kygb6kibs._.js +3 -0
  254. package/.next/server/chunks/[root-of-the-server]__1qy_fxhx5yu1t._.js +3 -0
  255. package/.next/server/chunks/[root-of-the-server]__1sokwptzp3b3m._.js +3 -0
  256. package/.next/server/chunks/{[root-of-the-server]__0cizcawcu31he._.js → [root-of-the-server]__1ve60byz8pq4j._.js} +2 -2
  257. package/.next/server/chunks/{[root-of-the-server]__0fhi9g3nqu6k3._.js → [root-of-the-server]__1vwlmzqz2r0yr._.js} +1 -1
  258. package/.next/server/chunks/{[root-of-the-server]__1pfhgjwnx_--j._.js → [root-of-the-server]__1w_yq12h-kxx0._.js} +2 -2
  259. package/.next/server/chunks/[root-of-the-server]__1x6r0_9_fqoy-._.js +3 -0
  260. package/.next/server/chunks/[root-of-the-server]__1xx-czpwd_ny7._.js +3 -0
  261. package/.next/server/chunks/[root-of-the-server]__1zkrlusy_cbtj._.js +3 -0
  262. package/.next/server/chunks/_011-ll5i30j2e._.js +1 -1
  263. package/.next/server/chunks/_03ovgh1-4xf3f._.js +1 -1
  264. package/.next/server/chunks/_05-ouasholjra._.js +1 -1
  265. package/.next/server/chunks/_06pseal2zu-71._.js +1 -1
  266. package/.next/server/chunks/_08i9pskmlafnp._.js +1 -1
  267. package/.next/server/chunks/_0ahfgpo6w1vyz._.js +3 -0
  268. package/.next/server/chunks/_0d66myj_8567o._.js +1 -1
  269. package/.next/server/chunks/_0h1rbua_hqkox._.js +1 -1
  270. package/.next/server/chunks/_0i58-g30ox5-8._.js +1 -1
  271. package/.next/server/chunks/_0mt2ctbvzfero._.js +1 -1
  272. package/.next/server/chunks/_0r8u30vd4lix4._.js +1 -1
  273. package/.next/server/chunks/_0tl0cy5j96d7h._.js +1 -1
  274. package/.next/server/chunks/_0zs7jfzzshbfq._.js +1 -1
  275. package/.next/server/chunks/_12i51zlq-xxrl._.js +1 -1
  276. package/.next/server/chunks/_18hm5aaxkr500._.js +1 -1
  277. package/.next/server/chunks/_1a1aqmie1d3u_._.js +1 -1
  278. package/.next/server/chunks/_1a1udq0c4_6ad._.js +1 -1
  279. package/.next/server/chunks/_1ad8i3ukisj99._.js +1 -1
  280. package/.next/server/chunks/_1b0269xt-c8f7._.js +1 -1
  281. package/.next/server/chunks/_1cydcmia78z15._.js +1 -1
  282. package/.next/server/chunks/_1hj7iit2u6xez._.js +1 -1
  283. package/.next/server/chunks/_1sp0xk1c5jx5r._.js +1 -1
  284. package/.next/server/chunks/_1zbkha-v5mkk0._.js +1 -1
  285. package/.next/server/chunks/_next-internal_server_app_api_user_ai-consent_route_actions_0g-jtv0cc92di.js +3 -0
  286. package/.next/server/chunks/src_lib_0dxltm34zaclb._.js +1 -1
  287. package/.next/server/chunks/src_lib_0g4wu08m-gibu._.js +1 -1
  288. package/.next/server/chunks/src_lib_0l0j89xrerf8m._.js +1 -1
  289. package/.next/server/chunks/src_lib_0n6nhl7_avcme._.js +1 -1
  290. package/.next/server/chunks/src_lib_0so-2topfosjo._.js +1 -1
  291. package/.next/server/chunks/src_lib_1_p9kz6i8to9n._.js +3 -0
  292. package/.next/server/chunks/src_lib_1t_-lm7x_gu08._.js +3 -0
  293. package/.next/server/chunks/src_lib_import_import-batches_ts_0nq3mn0v5uj28._.js +2 -2
  294. package/.next/server/chunks/src_lib_import_import-tasks_ts_01f-g_upv7llt._.js +1 -1
  295. package/.next/server/chunks/src_lib_mastery_ts_0ybi94uxn8ut6._.js +1 -1
  296. package/.next/server/chunks/src_lib_question_0uw17e6at-i_h._.js +1 -1
  297. package/.next/server/chunks/src_lib_question_question-analysis_ts_1-3x2cfxlr3fs._.js +1 -1
  298. package/.next/server/chunks/src_lib_question_question-deduplication_ts_0gumctesi3szc._.js +1 -1
  299. package/.next/server/chunks/ssr/{[root-of-the-server]__1epxx0lrejssz._.js → [root-of-the-server]__1qkpcqb6ewk9r._.js} +1 -1
  300. package/.next/server/chunks/ssr/_09y2uhjubswp4._.js +1 -1
  301. package/.next/server/chunks/ssr/_0_m51opjnip8x._.js +32 -0
  302. package/.next/server/chunks/ssr/_0cmd1ubdlo_by._.js +1 -1
  303. package/.next/server/chunks/ssr/{_05gdkgyyr0suj._.js → _0fp_p60hb9ex8._.js} +1 -1
  304. package/.next/server/chunks/ssr/_0lzeodofsq9pe._.js +1 -1
  305. package/.next/server/chunks/ssr/_0ozptnii2nxuw._.js +1 -1
  306. package/.next/server/chunks/ssr/{_01zv6gqnnj9oy._.js → _0qs44fqs7b5wd._.js} +1 -1
  307. package/.next/server/chunks/ssr/{node_modules_1yz9gg4275g30._.js → node_modules_0v4btraw_y7x2._.js} +1 -1
  308. package/.next/server/chunks/ssr/{node_modules_1-wb4967v48id._.js → node_modules_1cm5684hz1o51._.js} +1 -1
  309. package/.next/server/chunks/ssr/{node_modules_1we6ggthjslzt._.js → node_modules_1im5by828hg3r._.js} +1 -1
  310. package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_038nbq-p7grtd.js → node_modules_heic-to_dist_csp_heic-to_064ewwu8t3acv.js} +1 -1
  311. package/.next/server/chunks/ssr/{node_modules_heic-to_dist_csp_heic-to_1b61b0i6philz.js → node_modules_heic-to_dist_csp_heic-to_1xp1ys7qrz7uh.js} +1 -1
  312. package/.next/server/chunks/ssr/src_1rmus42s388dk._.js +1 -1
  313. package/.next/server/chunks/ssr/src_1seqsa8jiwu83._.js +1 -1
  314. package/.next/server/chunks/ssr/src_app_exams_[id]_print_page_tsx_1i-xvhk8ul1l1._.js +2 -2
  315. package/.next/server/chunks/ssr/src_app_print-preview_page_tsx_001yt-fzrj7tf._.js +1 -1
  316. package/.next/server/chunks/ssr/src_components_correction-editor_tsx_1p7z02t66tndx._.js +2 -2
  317. package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +12 -12
  318. package/.next/server/chunks/ssr/src_lib_api-client_ts_04r2_ex-gua5i._.js +1 -1
  319. package/.next/server/chunks/ssr/src_lib_i18n_en_ts_08zkpwnoqey5s._.js +1 -1
  320. package/.next/server/middleware-build-manifest.js +3 -3
  321. package/.next/server/pages/500.html +1 -1
  322. package/.next/static/chunks/{16h0nz5l970cx.js → 08pb1_yl7fhsw.js} +1 -1
  323. package/.next/static/chunks/{1-00icoq9w3_i.js → 0c3tf7izst9o8.js} +1 -1
  324. package/.next/static/chunks/{3ldaxwwj8i1r_.js → 0ddn90rrjkr7y.js} +3 -3
  325. package/.next/static/chunks/185736qwog1ar.js +1 -0
  326. package/.next/static/chunks/{0y9dgn85yuuy5.js → 1bcso9y60vl1j.js} +1 -1
  327. package/.next/static/chunks/1jsd1qdcjh3ht.js +198 -0
  328. package/.next/static/chunks/1nef598mkxf9g.js +1 -0
  329. package/.next/static/chunks/{2r3xwds8ivfso.js → 1ogj95u4nfqgm.js} +5 -5
  330. package/.next/static/chunks/2-m8at3d9m9fl.js +38 -0
  331. package/.next/static/chunks/21jkvmvb2mzaa.js +1 -0
  332. package/.next/static/chunks/32c19i38gl4zx.js +1 -0
  333. package/.next/static/chunks/34r6_zyo8ux86.js +1 -0
  334. package/.next/static/chunks/3_5fscrh8uxav.css +3 -0
  335. package/.next/static/chunks/{2gamhj4j8w-tp.js → 3lvul9moygg-1.js} +4 -4
  336. package/package.json +1 -1
  337. package/prisma/migrations/20261105000000_user_ai_data_consent/migration.sql +2 -0
  338. package/prisma/schema.prisma +1 -0
  339. package/prisma/seed.db +0 -0
  340. package/.next/server/chunks/[root-of-the-server]__07i32k2sv285o._.js +0 -3
  341. package/.next/server/chunks/[root-of-the-server]__0_le78e9b2yno._.js +0 -3
  342. package/.next/server/chunks/[root-of-the-server]__0b8rxaox_x2n1._.js +0 -3
  343. package/.next/server/chunks/[root-of-the-server]__0bvf731upd2_w._.js +0 -3
  344. package/.next/server/chunks/[root-of-the-server]__0eqjbieakyy2g._.js +0 -3
  345. package/.next/server/chunks/[root-of-the-server]__0gk6xz_lxrrer._.js +0 -3
  346. package/.next/server/chunks/[root-of-the-server]__0nin5p-dwlpf9._.js +0 -3
  347. package/.next/server/chunks/[root-of-the-server]__0nye-53zadylr._.js +0 -3
  348. package/.next/server/chunks/[root-of-the-server]__0o9oim91bxvxq._.js +0 -3
  349. package/.next/server/chunks/[root-of-the-server]__0pojh2d6n1kp6._.js +0 -3
  350. package/.next/server/chunks/[root-of-the-server]__0wea836zkhvlj._.js +0 -3
  351. package/.next/server/chunks/[root-of-the-server]__0wex3czgya39o._.js +0 -3
  352. package/.next/server/chunks/[root-of-the-server]__0yq7jm5ja3r6t._.js +0 -3
  353. package/.next/server/chunks/[root-of-the-server]__1-1ld657rjip5._.js +0 -3
  354. package/.next/server/chunks/[root-of-the-server]__11-fk0-4iuf_k._.js +0 -3
  355. package/.next/server/chunks/[root-of-the-server]__11x5u4zg5i2c6._.js +0 -3
  356. package/.next/server/chunks/[root-of-the-server]__12f6t_ozjtn42._.js +0 -3
  357. package/.next/server/chunks/[root-of-the-server]__13cos0n0yw_z6._.js +0 -3
  358. package/.next/server/chunks/[root-of-the-server]__15r55xy6cyrg3._.js +0 -3
  359. package/.next/server/chunks/[root-of-the-server]__16_meybuj-s5w._.js +0 -3
  360. package/.next/server/chunks/[root-of-the-server]__17659spbpgn__._.js +0 -3
  361. package/.next/server/chunks/[root-of-the-server]__1f0zocrmsd5p8._.js +0 -3
  362. package/.next/server/chunks/[root-of-the-server]__1fp6mylnljj_6._.js +0 -3
  363. package/.next/server/chunks/[root-of-the-server]__1gf_vv57qtjh0._.js +0 -3
  364. package/.next/server/chunks/[root-of-the-server]__1hn69stngi4kc._.js +0 -3
  365. package/.next/server/chunks/[root-of-the-server]__1ii155nyrptua._.js +0 -3
  366. package/.next/server/chunks/[root-of-the-server]__1kxecl8v-_px5._.js +0 -3
  367. package/.next/server/chunks/[root-of-the-server]__1l6v9x8xm11pl._.js +0 -3
  368. package/.next/server/chunks/[root-of-the-server]__1r5lj-ffov9r0._.js +0 -3
  369. package/.next/server/chunks/[root-of-the-server]__1uqnotrppylmw._.js +0 -3
  370. package/.next/server/chunks/[root-of-the-server]__1utvl-1o6mb8y._.js +0 -3
  371. package/.next/server/chunks/[root-of-the-server]__1vc89u7_xxhyf._.js +0 -3
  372. package/.next/server/chunks/[root-of-the-server]__1vorkvvfkrr39._.js +0 -3
  373. package/.next/server/chunks/[root-of-the-server]__1x_kq-6h3utmo._.js +0 -3
  374. package/.next/server/chunks/[root-of-the-server]__1x_yvd3pxoee7._.js +0 -3
  375. package/.next/server/chunks/[root-of-the-server]__1y9cx1kv17pl_._.js +0 -3
  376. package/.next/server/chunks/[root-of-the-server]__1z4-5hlzq34fw._.js +0 -3
  377. package/.next/server/chunks/[root-of-the-server]__20vfjg0kexwpn._.js +0 -3
  378. package/.next/server/chunks/src_lib_1-8qgpevmw3ew._.js +0 -3
  379. package/.next/server/chunks/src_lib_1w0niu4i8hnaq._.js +0 -3
  380. package/.next/server/chunks/ssr/_0haie2cnycj6w._.js +0 -32
  381. package/.next/static/chunks/15zro21ycjjle.js +0 -1
  382. package/.next/static/chunks/1vtq_er8xir3c.css +0 -3
  383. package/.next/static/chunks/28qmcol3c39_a.js +0 -198
  384. package/.next/static/chunks/3fj_icg91t5ar.js +0 -38
  385. package/.next/static/chunks/3fyp0ya1q-g_k.js +0 -1
  386. package/.next/static/chunks/3g93k83oklg4_.js +0 -1
  387. package/.next/static/chunks/3u-qpv02dkpmu.js +0 -1
  388. package/.next/static/chunks/3x0gnqbvstc69.js +0 -1
  389. /package/.next/static/{afzFj9VsDFOvE5lff98xs → oMYEAS-Ug2KhwHuve1br9}/_buildManifest.js +0 -0
  390. /package/.next/static/{afzFj9VsDFOvE5lff98xs → oMYEAS-Ug2KhwHuve1br9}/_clientMiddlewareManifest.js +0 -0
  391. /package/.next/static/{afzFj9VsDFOvE5lff98xs → oMYEAS-Ug2KhwHuve1br9}/_ssgManifest.js +0 -0
@@ -1,20 +1,20 @@
1
- module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(550194),e=a.i(875003),f=a.i(291938),g=a.i(960927),h=a.i(630534);let i=["system","light","dark"],j="system",k="app-theme";function l(a){return"string"==typeof a&&i.includes(a)}let m=(0,c.createContext)({preference:j,theme:"light",setPreference:()=>void 0}),n="(prefers-color-scheme: dark)",o=new Set;function p(a){return o.add(a),window.addEventListener("storage",a),()=>{o.delete(a),window.removeEventListener("storage",a)}}function q(){try{let a=localStorage.getItem(k);return l(a)?a:j}catch{return j}}function r(a){try{localStorage.setItem(k,a)}catch{}o.forEach(a=>a())}function s(a){let b=window.matchMedia(n);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}let t=()=>window.matchMedia(n).matches;function u({children:a}){let{data:d,status:i}=(0,e.useSession)(),k="authenticated"===i,n=d?.user?.email,o=(0,c.useSyncExternalStore)(p,q,()=>j),v=(0,c.useSyncExternalStore)(s,t,()=>!1),w="system"===o?v?"dark":"light":o;(0,c.useEffect)(()=>{let a=document.documentElement,b=b=>{a.classList.toggle("dark","dark"===b),a.style.colorScheme=b};b(w);let c=()=>b("light"),d=()=>b(w);return window.addEventListener("beforeprint",c),window.addEventListener("afterprint",d),()=>{window.removeEventListener("beforeprint",c),window.removeEventListener("afterprint",d)}},[w]),(0,c.useEffect)(()=>{if(!k||!n)return;let a=!1;return f.k.get("/api/user").then(b=>{!a&&l(b.themePreference)&&b.themePreference!==q()&&r(b.themePreference)}).catch(a=>{h.V.warn("[Theme]","Failed to load theme preference",{error:(0,g.Z)(a)})}),()=>{a=!0}},[k,n]);let x=(0,c.useCallback)(a=>{r(a),k&&f.k.patch("/api/user",{themePreference:a}).catch(a=>{h.V.warn("[Theme]","Failed to save theme preference",{error:(0,g.Z)(a)})})},[k]),y=(0,c.useMemo)(()=>({preference:o,theme:w,setPreference:x}),[o,w,x]);return(0,b.jsx)(m.Provider,{value:y,children:a})}var v=a.i(529759),w=a.i(16644),x=a.i(238246),y=a.i(50944),z=a.i(557230),A=a.i(164831);let B={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};B.node;let C=(0,A.f)(B);var D=a.i(875160),E=a.i(780767),F=a.i(710302),G=a.i(682338),H=a.i(368114);function I({className:a}){let{t:e}=(0,d.b)(),{data:f}=(0,G.b)(),g=(0,c.useRef)(null);if((0,c.useEffect)(()=>{if(!f)return;let a=new Set([...f.tasks.filter(a=>"analyzing"===a.status||"saving"===a.status).map(a=>a.id),...(f.batches??[]).filter(a=>"splitting"===a.phase||"processing"===a.phase).map(a=>`batch:${a.id}`)]),b=new Set([...f.tasks.filter(a=>a.unread).map(a=>a.id),...(f.batches??[]).filter(a=>a.unread).map(a=>`batch:${a.id}`)]),c=g.current;c&&[...c].some(c=>!a.has(c)&&b.has(c))&&F.c.info(e.importTasks.finishedToast),g.current=a},[f,e.importTasks.finishedToast]),!f||0===f.tasks.length&&!f.batches?.length)return null;let{activeCount:h,unreadCount:i}=f,j=h>0?e.importTasks.entryActive.replace("{count}",String(h)):e.importTasks.entry;return(0,b.jsxs)(x.default,{href:"/import-tasks",className:(0,H.f)("relative flex h-9 items-center gap-1.5 rounded-full border px-3 text-sm font-medium transition-colors hover:bg-muted",i>0?"border-primary/50 text-primary":"text-muted-foreground",a),"data-testid":"import-tasks-entry","aria-label":i>0?`${j} \xb7 ${e.importTasks.entryUnread.replace("{count}",String(i))}`:j,children:[h>0?(0,b.jsx)(D.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(E.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"whitespace-nowrap",children:j}),i>0&&(0,b.jsx)("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-xs text-white","data-testid":"import-tasks-unread",children:i})]})}var J=a.i(390702),K=a.i(283248);let L={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};L.node;let M=(0,A.f)(L),N={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};N.node;let O=(0,A.f)(N);var P=a.i(357204);let Q={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};Q.node;let R=(0,A.f)(Q),S={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};S.node;let T=(0,A.f)(S);var U=a.i(344451),V=a.i(930363),W=a.i(699570),X=a.i(814574),Y=a.i(875083),Z=a.i(986705),$=a.i(786304),_=a.i(563658),aa=a.i(866718),ab=a.i(870430);let ac=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,H.f)("w-full caption-bottom text-sm",a),...c})}));ac.displayName="Table";let ad=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,H.f)("[&_tr]:border-b",a),...c}));ad.displayName="TableHeader";let ae=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,H.f)("[&_tr:last-child]:border-0",a),...c}));ae.displayName="TableBody",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,H.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c}))).displayName="TableFooter";let af=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,H.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));af.displayName="TableRow";let ag=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,H.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));ag.displayName="TableHead";let ah=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,H.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));ah.displayName="TableCell",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,H.f)("mt-4 text-sm text-muted-foreground",a),...c}))).displayName="TableCaption";var ai=a.i(951675);let aj={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};aj.node;let ak=(0,A.f)(aj);var al=a.i(79362);function am(){var a;let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(String(5)),[j,k]=(0,c.useState)(!1),l=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");i(String(a.aiConcurrencyLimit??5))}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{l()},[l]);let m=Number(g),n=""!==g.trim()&&"number"==typeof(a=m)&&Number.isInteger(a)&&a>=1&&a<=100,o=async()=>{if(n){k(!0);try{await f.k.post("/api/settings",{aiConcurrencyLimit:m}),F.c.success(e.admin.aiConcurrencyLimitSaved)}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to update AI concurrency limit",{error:a}),F.c.error(e.common.error)}finally{k(!1)}}};return(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(ab.f,{htmlFor:"ai-concurrency-limit",className:"text-base",children:e.admin.aiConcurrencyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e.admin.aiConcurrencyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(aa.f,{id:"ai-concurrency-limit",type:"number",min:1,max:100,step:1,inputMode:"numeric",value:g,onChange:a=>i(a.target.value),"aria-invalid":!n,className:"w-24"}),(0,b.jsxs)(W.f,{size:"sm",onClick:o,disabled:j||!n,children:[j&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.common.save]})]})]})}function an(){let{timeZone:a}=(0,v.M)(),{data:i}=(0,e.useSession)(),{t:j}=(0,d.b)(),[k,l]=(0,c.useState)([]),[m,n]=(0,c.useState)(!0),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)("0"),[u,w]=(0,c.useState)(!1),x=(0,c.useCallback)(async()=>{n(!0);try{let a=await f.k.get("/api/admin/users");l(a)}catch(a){h.V.error("[UserManagement]","Failed to fetch users",{error:a})}finally{n(!1)}},[]),y=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");p(!0===a.allowRegistration),t(String(a.aiDailyLimit??0))}catch(a){h.V.error("[UserManagement]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{x(),y()},[x,y]);let z=async a=>{r(!0);try{await f.k.post("/api/settings",{allowRegistration:a}),p(a)}catch(a){h.V.error("[UserManagement]","Failed to update registration setting",{error:a}),F.c.error(j.common.error)}finally{r(!1)}},A=Number(s),B=""!==s.trim()&&Number.isInteger(A)&&A>=0,C=async()=>{if(B){w(!0);try{await f.k.post("/api/settings",{aiDailyLimit:A}),F.c.success(j.admin.aiDailyLimitSaved)}catch(a){h.V.error("[UserManagement]","Failed to update AI daily limit",{error:a}),F.c.error(j.common.error)}finally{w(!1)}}},E=async a=>{let b=a.isActive?j.admin.confirmDisable:j.admin.confirmEnable;if(await (0,F.u)(b))try{await f.k.patch(`/api/admin/users/${a.id}`,{isActive:!a.isActive}),x()}catch(a){h.V.error("[UserManagement]","Failed to update user status",{error:a}),F.c.error(j.common.error)}},G=async a=>{if(await (0,F.u)(j.admin.confirmDelete,{destructive:!0}))try{await f.k.delete(`/api/admin/users/${a.id}`),x()}catch(b){h.V.error("[UserManagement]","Failed to delete user",{error:b});let a=(0,g.d)(b)||j.common.error;F.c.error(a)}};return m?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(D.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(ab.f,{className:"text-base",children:j.admin?.allowRegistration||"Allow New Registrations"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[q&&(0,b.jsx)(D.f,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)(_.f,{checked:o,onCheckedChange:z,disabled:q})]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(ab.f,{htmlFor:"ai-daily-limit",className:"text-base",children:j.admin.aiDailyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin.aiDailyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(aa.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:s,onChange:a=>t(a.target.value),"aria-invalid":!B,className:"w-24"}),(0,b.jsxs)(W.f,{size:"sm",onClick:C,disabled:u||!B,children:[u&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),j.common.save]})]})]}),(0,b.jsx)(am,{}),(0,b.jsx)("div",{className:"sm:hidden space-y-3",children:k.map(c=>(0,b.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between items-start",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)($.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})]}),(0,b.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,b.jsxs)("div",{className:"text-muted-foreground",children:[j.admin.errors,": ",c._count.errorItems," | ",j.admin.practiceCount,": ",c._count.practiceRecords," | ",j.admin.aiUsageToday,": ",c.aiUsageToday]}),(0,b.jsx)($.f,{variant:c.isActive?"default":"destructive",className:"text-xs",children:c.isActive?j.admin.active:j.admin.disabled})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,Z.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:()=>E(c),disabled:c.id===i?.user?.id,children:c.isActive?(0,b.jsx)(ak,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(al.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,children:(0,b.jsx)(ai.f,{className:"h-4 w-4 text-destructive"})})]})]})]},c.id))}),(0,b.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,b.jsxs)(ac,{children:[(0,b.jsx)(ad,{children:(0,b.jsxs)(af,{children:[(0,b.jsx)(ag,{children:j.admin.nameEmail}),(0,b.jsx)(ag,{children:j.admin.role}),(0,b.jsx)(ag,{children:j.admin.stats}),(0,b.jsx)(ag,{children:j.admin.createdAt}),(0,b.jsx)(ag,{children:j.admin.status}),(0,b.jsx)(ag,{className:"text-right",children:j.admin.actions})]})}),(0,b.jsx)(ae,{children:k.map(c=>(0,b.jsxs)(af,{children:[(0,b.jsxs)(ah,{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(ah,{children:(0,b.jsx)($.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})}),(0,b.jsxs)(ah,{children:[(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.errors,": ",c._count.errorItems]}),(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.practiceCount,": ",c._count.practiceRecords]}),(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.aiUsageToday,": ",c.aiUsageToday]})]}),(0,b.jsx)(ah,{children:(0,Z.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsx)(ah,{children:(0,b.jsx)($.f,{variant:c.isActive?"default":"destructive",children:c.isActive?j.admin.active:j.admin.disabled})}),(0,b.jsxs)(ah,{className:"text-right space-x-2",children:[(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:()=>E(c),disabled:c.id===i?.user?.id,title:c.isActive?j.admin.disable:j.admin.enable,children:c.isActive?(0,b.jsx)(ak,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(al.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,title:j.admin.delete,children:(0,b.jsx)(ai.f,{className:"h-4 w-4 text-destructive"})})]})]},c.id))})]})})]})}var ao=a.i(168370);let ap={name:"scroll-text",size:24,node:[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]};ap.node;let aq=(0,A.f)(ap);function ar(a){return(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a,children:[(0,b.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),(0,b.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}let as={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};as.node;let at=(0,A.f)(as);var au=a.i(540553);let av=()=>()=>void 0;function aw(){let{t:a}=(0,d.b)(),e=(0,c.useSyncExternalStore)(av,au.f,()=>null);return e?e.isStandalone?.()?(0,b.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:a.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"break-all",children:[a.settings?.about?.androidServer||"Server",": ",e.getServerUrl()]}),(0,b.jsxs)(W.f,{variant:"outline",className:"gap-2",onClick:()=>e.changeServer(),children:[(0,b.jsx)(at,{className:"h-4 w-4"}),a.settings?.about?.changeServer||"Change server"]})]}):null}var ax=a.i(424235);function ay(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)("");(0,c.useEffect)(()=>{fetch("/api/version").then(a=>a.json()).then(a=>f(a.version)).catch(()=>{})},[]);let g=[{href:ax.f,icon:ar,label:a.settings?.about?.github||"GitHub Repository"},{href:`${ax.f}/releases`,icon:aq,label:a.settings?.about?.releaseNotes||"Release Notes"},{href:`${ax.f}/issues`,icon:R,label:a.settings?.about?.feedback||"Feedback"}];return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("h3",{className:"text-2xl font-bold",children:a.app?.title||"Smart Error Notebook"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:a.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,b.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,b.jsx)(O,{className:"h-4 w-4"}),(0,b.jsxs)("span",{children:[a.settings?.about?.version||"Version",": v",e||"unknown"]})]}),(0,b.jsx)(aw,{}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:g.map(({href:a,icon:c,label:d})=>(0,b.jsx)(W.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,b.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(c,{className:"h-4 w-4"}),d,(0,b.jsx)(ao.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:a.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var az=a.i(152679),aA=a.i(580701),aB=a.i(348966);let aC={name:"",email:"",educationStage:"",enrollmentYear:"",currentGrade:"",currentSemester:"",password:""};function aD(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)(aC),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),p=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/user"),b=a.fixedGradeSemester?(0,aB.p)(a.fixedGradeSemester):null;i({name:a.name||"",email:a.email||"",educationStage:a.educationStage||"",enrollmentYear:a.enrollmentYear||"",currentGrade:b?.grade||"",currentSemester:b?.semester||"",password:""})}catch(a){h.V.error("[AccountSettings]","Failed to fetch profile",{error:a})}finally{m(!1)}},[]);(0,c.useEffect)(()=>{p()},[p]);let q=async()=>{if(e.password&&e.password!==j)return void F.c.error(a.settings?.messages?.passwordMismatch||"Passwords do not match");o(!0);try{let b={name:e.name,email:e.email,educationStage:e.educationStage};e.enrollmentYear&&(b.enrollmentYear=parseInt(e.enrollmentYear.toString())),e.password&&(b.password=e.password),e.currentGrade&&e.currentSemester?b.fixedGradeSemester=`${e.currentGrade}${e.currentSemester}`:e.currentGrade||(b.fixedGradeSemester=null),await f.k.patch("/api/user",b),F.c.success(a.settings?.messages?.profileUpdated||"Profile updated"),i(a=>({...a,password:""})),k(""),window.location.reload()}catch(b){h.V.error("[AccountSettings]","Failed to update profile",{error:(0,g.d)(b)??(0,g.Z)(b)}),F.c.error((0,g.d)(b)||a.settings?.messages?.updateFailed||"Update failed")}finally{o(!1)}};return l?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(D.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.auth?.name||"Name"}),(0,b.jsx)(aa.f,{value:e.name||"",onChange:a=>i({...e,name:a.target.value})})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.auth?.email||"Email"}),(0,b.jsx)(aa.f,{value:e.email||"",onChange:a=>i({...e,email:a.target.value}),type:"email"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.auth?.educationStage||"Education Stage"}),(0,b.jsxs)(aA.d,{value:e.educationStage||"",onValueChange:a=>i({...e,educationStage:a,currentGrade:(0,aB.c)(a).includes(e.currentGrade)?e.currentGrade:"",currentSemester:(0,aB.c)(a).includes(e.currentGrade)?e.currentSemester:""}),children:[(0,b.jsx)(aA.P,{children:(0,b.jsx)(aA.U,{placeholder:a.auth?.selectStage||"Select Stage"})}),(0,b.jsxs)(aA.r,{children:[(0,b.jsx)(aA.T,{value:"primary",children:a.auth?.primary||"Primary School"}),(0,b.jsx)(aA.T,{value:"junior_high",children:a.auth?.juniorHigh||"Junior High"}),(0,b.jsx)(aA.T,{value:"senior_high",children:a.auth?.seniorHigh||"Senior High"}),(0,b.jsx)(aA.T,{value:"university",children:a.auth?.university||"University"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.auth?.enrollmentYear||"Enrollment Year"}),(0,b.jsx)(aa.f,{type:"number",value:e.enrollmentYear||"",onChange:a=>i({...e,enrollmentYear:a.target.value}),placeholder:"YYYY"})]})]}),e.educationStage&&(0,aB.c)(e.educationStage).length>0&&(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.settings?.account?.currentGrade||"Current Grade & Semester"}),(0,b.jsxs)(aA.d,{value:e.currentGrade||"",onValueChange:a=>i({...e,currentGrade:a,currentSemester:a?e.currentSemester||"上":""}),children:[(0,b.jsx)(aA.P,{children:(0,b.jsx)(aA.U,{placeholder:a.settings?.account?.selectGrade||"Select Grade"})}),(0,b.jsx)(aA.r,{children:(0,aB.c)(e.educationStage).map(a=>(0,b.jsx)(aA.T,{value:a,children:a},a))})]})]}),e.currentGrade&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.settings?.account?.selectSemester||"Select Semester"}),(0,b.jsxs)(aA.d,{value:e.currentSemester||"",onValueChange:a=>i({...e,currentSemester:a}),children:[(0,b.jsx)(aA.P,{children:(0,b.jsx)(aA.U,{placeholder:a.settings?.account?.selectSemester||"Select Semester"})}),(0,b.jsxs)(aA.r,{children:[(0,b.jsx)(aA.T,{value:"上",children:a.settings?.account?.firstSemester||"1st Semester"}),(0,b.jsx)(aA.T,{value:"下",children:a.settings?.account?.secondSemester||"2nd Semester"})]})]})]})]}),e.currentGrade&&e.currentSemester&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground -mt-2",children:a.settings?.account?.gradeAppliedHint||"New questions will default to this grade. You can also configure AI grade recognition in General Settings."}),(0,b.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,b.jsx)(az.f,{value:e.password,onChange:a=>i({...e,password:a.target.value}),placeholder:"******",minLength:6})]}),e.password&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:a.auth?.confirmPassword||"Confirm Password"}),(0,b.jsx)(az.f,{value:j,onChange:a=>k(a.target.value),placeholder:"******",minLength:6})]})]}),(0,b.jsxs)(W.f,{onClick:q,disabled:n,className:"w-full",children:[n&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.settings?.account?.update||"Update Profile"]})]})}var aE=a.i(151304),aF=a.i(118688),aG=a.i(201661),aH=a.i(246059),aI=a.i(998868),aJ=a.i(332485),aK=a.i(861954);let aL="https://github.com/xiaoyang111222/cn-math-taxonomy",aM="https://raw.githubusercontent.com/xiaoyang111222/cn-math-taxonomy/HEAD/data/topics.json",aN=aH.z.object({id:aI.z.string().optional(),name:aI.z.string().trim().min(1),subject:aI.z.string().nullish(),grade:aJ.z.number().int(),semester:aI.z.string().nullish(),chapter:aI.z.string().nullish()}).passthrough();aK.z.array(aN).min(1);let aO="/api/admin/cnm-tags";function aP(){let{t:a}=(0,d.b)(),e=a.admin.cnmTags,[g,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null),m=(0,c.useCallback)(async()=>{try{i(await f.k.get(aO))}catch(a){h.V.warn("[CnmTagImportSettings]","Failed to load status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]);let n=async a=>{if(a){k(!0);try{let b;try{b=JSON.parse(await a.text())}catch{F.c.error(e.invalidFile);return}let c=await f.k.post(aO,{topics:b},{timeout:3e5});i(c.status),F.c.success(e.imported.replace("{created}",String(c.result.created)).replace("{skipped}",String(c.result.skipped)))}catch(b){h.V.error("[CnmTagImportSettings]","Import failed",{error:b});let a=b instanceof f.a&&400===b.status;F.c.error(a?e.invalidFile:e.failed)}finally{k(!1),l.current&&(l.current.value="")}}},o=g?.knowledgePoints??0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(aF.f,{className:"h-4 w-4"}),e.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.desc})]}),(0,b.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-xs text-muted-foreground",children:[(0,b.jsx)("p",{children:e.downloadHint}),(0,b.jsx)("a",{href:aM,target:"_blank",rel:"noopener noreferrer",className:"block break-all text-primary underline",children:aM}),(0,b.jsxs)("p",{children:[e.sourceLabel," ",(0,b.jsx)("a",{href:aL,target:"_blank",rel:"noopener noreferrer",className:"break-all text-primary underline",children:aL})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g?o>0?e.status.replace("{count}",String(o)):e.notImported:""}),(0,b.jsx)("input",{ref:l,type:"file",accept:".json,application/json",className:"hidden",onChange:a=>n(a.target.files?.[0]),disabled:j}),(0,b.jsxs)(W.f,{variant:"outline",size:"sm",className:"w-full sm:w-auto",onClick:()=>l.current?.click(),disabled:j,children:[j?(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aG.f,{className:"mr-2 h-4 w-4"}),j?e.importing:e.select]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.note})]})}var aQ=a.i(519783);let aR={info:{card:"border-blue-200 dark:border-blue-900 bg-blue-50 dark:bg-blue-950/40",title:"text-blue-900 dark:text-blue-200 font-bold",desc:"text-blue-800 dark:text-blue-200 font-medium",button:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800"},danger:{card:"border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-950/40",title:"text-red-700 dark:text-red-300 font-medium",desc:"text-red-600 dark:text-red-400",button:""},critical:{card:"border-red-600/50 bg-red-100/50 dark:bg-red-900/40",title:"text-red-900 dark:text-red-200 font-bold",desc:"text-red-800 dark:text-red-200 font-medium",button:"bg-red-700 hover:bg-red-800"}};function aS({title:a,description:c,tone:d,busy:e,icon:f,onClick:g}){let h=aR[d];return(0,b.jsxs)("div",{className:`p-4 border rounded-lg ${h.card}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("span",{className:`text-sm flex items-center gap-2 ${h.title}`,children:a}),(0,b.jsx)(W.f,{variant:"info"===d?"outline":"destructive",size:"sm",onClick:g,disabled:e,className:h.button,children:e?(0,b.jsx)(D.f,{className:"h-4 w-4 animate-spin"}):f})]}),(0,b.jsx)("p",{className:`text-xs mt-2 ${h.desc}`,children:c})]})}function aT({isAdmin:a}){let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(null),j=async(a,b,c,d)=>{i(a);try{F.c.success(await b()),d&&window.location.reload()}catch(b){h.V.error("[DangerZoneSettings]",`${a} failed`,{error:b}),F.c.error(c)}finally{i(null)}},k=e.settings?.clearSuccess||"Success",l=e.settings?.clearError||"Failed",m=async()=>{await (0,F.u)(e.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await j("migrateTags",async()=>{let a=await f.k.post("/api/admin/migrate-tags",{});return`${k}: ${a.count||0} tags migrated.`},e.settings?.clearError||"Failed to migrate tags",!1)},n=async()=>{await (0,F.u)(e.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearPractice",async()=>(await f.k.delete("/api/stats/practice/clear"),k),l,!0)},o=async()=>{await (0,F.u)(e.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearErrors",async()=>(await f.k.delete("/api/error-items/clear"),k),l,!0)},p=async()=>{if(!await (0,F.u)(e.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let a=prompt(e.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==a){null!==a&&F.c.error(e.common?.error||"Confirmation failed");return}await j("systemReset",async()=>(await f.k.post("/api/admin/system-reset",{}),e.settings?.clearSuccess||"Success - System Reset Complete"),e.settings?.clearError||"Failed to reset system",!0)};return(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsx)(aS,{tone:"info",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(aQ.f,{className:"h-4 w-4"}),e.settings?.migrateTags||"Migrate Tags"]}),description:e.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===g,icon:(0,b.jsx)(aQ.f,{className:"h-4 w-4"}),onClick:m}),(0,b.jsx)(aS,{tone:"danger",title:e.settings?.clearData||"Clear Practice Data",description:e.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===g,icon:(0,b.jsx)(ai.f,{className:"h-4 w-4"}),onClick:n}),(0,b.jsx)(aS,{tone:"danger",title:e.settings?.clearErrorData||"Clear Error Data",description:e.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===g,icon:(0,b.jsx)(ai.f,{className:"h-4 w-4"}),onClick:o}),a&&(0,b.jsx)(aS,{tone:"critical",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(J.f,{className:"h-4 w-4"}),e.settings?.systemReset||"System Initialization"]}),description:e.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===g,icon:(0,b.jsx)(ai.f,{className:"h-4 w-4"}),onClick:p})]})}var aU=a.i(613412),aV=a.i(536670),aW=a.i(64332);async function aX(a,b){let c=await fetch(a);if(!c.ok)throw Error((await c.json().catch(()=>({}))).message||"Download failed");let d=await c.blob(),e=window.URL.createObjectURL(d),f=document.createElement("a");f.href=e;let g=c.headers.get("Content-Disposition")?.match(/filename="(.+)"/);f.download=g?g[1]:b,document.body.appendChild(f),f.click(),document.body.removeChild(f),window.URL.revokeObjectURL(e)}function aY({isAdmin:a,userId:e}){let{t:g}=(0,d.b)(),[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(null),o=`user:${e}:data-import`,{running:p,refresh:q}=(0,aW.f)(o),r=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(p){r.current=!0;return}r.current&&(r.current=!1,window.location.reload())},[p]);let s=async a=>{if(!a||await (0,F.u)(g.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){j(!0);try{await aX(a?"/api/export?all=true":"/api/export",a?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),F.c.success(g.settings?.exportSuccess||"Export successful")}catch(b){h.V.error("[DataBackupSettings]",a?"Export all failed":"Export failed",{error:b}),F.c.error(g.settings?.exportFailed||"Export failed")}finally{j(!1)}}},t=async a=>{if(!m)return;let b=a?g.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":g.settings?.importConfirm||"Are you sure you want to import?";if(await (0,F.u)(b)){l(!0);try{let b=JSON.parse(await m.text()),{stats:c}=await f.k.post(a?"/api/import?all=true":"/api/import",b);F.c.success((g.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers and {voices} cloud voice clips.").replace("{subjects}",String(c.subjectsCreated)).replace("{tags}",String(c.tagsCreated)).replace("{items}",String(c.errorItemsCreated)).replace("{schedules}",String(c.reviewSchedulesCreated)).replace("{records}",String(c.practiceRecordsCreated)).replace("{papers}",String(c.examPapersCreated??0)).replace("{voices}",String(c.ttsSpeechesImported??0)).replace("{duplicates}",String(c.duplicateErrorItems??0))),n(null),window.location.reload()}catch(b){b instanceof f.a&&409===b.status&&b.data?.code==="TASK_ALREADY_RUNNING"?(F.c.info(g.errors.TASK_ALREADY_RUNNING),await q()):(h.V.error("[DataBackupSettings]",a?"Import all failed":"Import failed",{error:b}),F.c.error(g.settings?.importFailed||"Import failed"))}finally{l(!1)}}},u=(a,c)=>a?(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}):c,v=k||!!p;return(0,b.jsxs)("div",{className:"p-4 border border-blue-200 dark:border-blue-900 rounded-lg bg-blue-50 dark:bg-blue-950/40",children:[(0,b.jsx)("h4",{className:"text-sm font-bold text-blue-900 dark:text-blue-200 mb-3",children:g.settings?.dataManagement||"Data Management"}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:g.settings?.exportData||"Export Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>s(!1),disabled:i,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[u(i,(0,b.jsx)(aV.f,{className:"mr-2 h-4 w-4"})),g.settings?.exportData||"Export"]}),a&&(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>s(!0),disabled:i,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[u(i,(0,b.jsx)(aV.f,{className:"mr-2 h-4 w-4"})),g.settings?.exportAllData||"Export All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:g.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:g.settings?.importData||"Import Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"file",accept:".json",onChange:a=>n(a.target.files?.[0]??m),className:"hidden",id:"import-file-input",disabled:v}),(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:v,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[u(v,(0,b.jsx)(aG.f,{className:"mr-2 h-4 w-4"})),m?.name||g.settings?.selectFile||"Select File"]}),m&&(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>t(!1),disabled:v,className:"bg-green-100 dark:bg-green-900/40 hover:bg-green-200 dark:hover:bg-green-900/60 text-green-900 dark:text-green-200 border-green-300 dark:border-green-800",children:[u(v,(0,b.jsx)(aU.f,{className:"mr-2 h-4 w-4"})),g.settings?.importData||"Import"]}),m&&a&&(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>t(!0),disabled:v,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[u(v,(0,b.jsx)(aU.f,{className:"mr-2 h-4 w-4"})),g.settings?.importAllData||"Import All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:g.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}let aZ={name:"bug",size:24,node:[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]};aZ.node;let a$=(0,A.f)(aZ),a_="/api/admin/debug-logs";function a0(){let{t:a}=(0,d.b)(),{timeZone:e}=(0,v.M)(),g=a.admin.debugLog,[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!1),m=(0,c.useCallback)(async()=>{try{j(await f.k.get(a_))}catch(a){h.V.warn("[DebugLogSettings]","Failed to load debug status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]),(0,c.useEffect)(()=>{if(!i?.enabled)return;let a=setInterval(m,5e3);return()=>clearInterval(a)},[i?.enabled,m]);let n=async(a,b)=>{l(!0);try{await a(),F.c.success(b)}catch(a){h.V.error("[DebugLogSettings]","Debug log action failed",{error:a}),F.c.error(g.failed)}finally{l(!1)}},o=a=>a?(0,Z.r)(a,"yyyy-MM-dd HH:mm",e):"",p=i?.enabled?g.enabledHint.replace("{since}",o(i.enabledAt)).replace("{until}",o(i.expiresAt)):g.disabledHint,q=(i?.entryCount??0)>0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)(ab.f,{htmlFor:"debug-mode-switch",className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(a$,{className:"h-4 w-4"}),g.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.desc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:g.enable}),(0,b.jsx)(_.f,{id:"debug-mode-switch",checked:!!i?.enabled,onCheckedChange:a=>n(async()=>{j(await f.k.post(a_,{enabled:a}))},a?g.enabled:g.disabled),disabled:k||!i})]})]}),(0,b.jsxs)("p",{className:`text-xs ${i?.enabled?"text-orange-600":"text-muted-foreground"}`,children:[p,i&&(0,b.jsxs)(b.Fragment,{children:[" ",g.entries.replace("{count}",String(i.entryCount)),i.droppedCount>0&&g.dropped.replace("{count}",String(i.droppedCount))]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{await aX(`${a_}/export`,"wrong-notebook-debug.json"),await m()},g.exported),disabled:k||!q,className:"sm:flex-1",children:[k?(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aV.f,{className:"mr-2 h-4 w-4"}),g.export]}),(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{j(await f.k.delete(a_))},g.cleared),disabled:k||!q,children:[(0,b.jsx)(ai.f,{className:"mr-2 h-4 w-4"}),g.clear]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.privacyNote})]})}var a1=a.i(225949);function a2({field:a,label:e,description:g}){let{t:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=`preference-${a}`;(0,c.useEffect)(()=>{f.k.get("/api/user").then(b=>k(!!b[a])).catch(()=>void 0).finally(()=>m(!0))},[a]);let s=async b=>{k(b),o(!0);try{await f.k.patch("/api/user",{[a]:b}),q(i.importFlow.preferenceSaved)}catch(c){k(!b),q(i.importFlow.preferenceSaveFailed),h.V.error("[Settings]","Failed to save user preference",{field:a,error:c instanceof Error?c.message:String(c)})}finally{o(!1)}};return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(ab.f,{htmlFor:r,children:e}),(0,b.jsx)(_.f,{id:r,checked:j,onCheckedChange:s,disabled:!l||n})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:p})]})}function a3(){let{t:a}=(0,d.b)();return(0,b.jsx)(a2,{field:"enableGeogebra",label:a.importFlow.enableGeogebra,description:a.importFlow.enableGeogebraDesc})}function a4(){let{t:a}=(0,d.b)();return(0,b.jsx)(a2,{field:"confirmBeforeImport",label:a.importFlow.confirmBeforeImport,description:a.importFlow.confirmBeforeImportDesc})}var a5=a.i(249479);function a6(){let{t:a}=(0,d.b)(),[e,g]=(0,c.useState)(String(a5.z)),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(null),q=Number(e),r=""!==e.trim()&&Number.isInteger(q)&&q>=a5.P&&q<=a5.o,s=(0,c.useCallback)(async()=>{l(!0),p(null);try{let a=(await f.k.get("/api/user")).masteryThreshold??a5.z;g(String(a)),j(a)}catch(b){p(a.mastery.thresholdLoadFailed),h.V.error("[Settings]","加载已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{l(!1)}},[a.mastery.thresholdLoadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{if(r&&null!==i){n(!0),p(null);try{let b=(await f.k.patch("/api/user",{masteryThreshold:q})).masteryThreshold??q;j(b),g(String(b)),p(a.importFlow.preferenceSaved)}catch(b){p(a.importFlow.preferenceSaveFailed),h.V.error("[Settings]","保存已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{n(!1)}}};return(0,b.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,b.jsx)(ab.f,{htmlFor:"mastery-threshold",children:a.mastery.thresholdLabel}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(aa.f,{id:"mastery-threshold",type:"number",min:a5.P,max:a5.o,step:1,value:e,onChange:a=>{g(a.target.value),p(null)},disabled:k||m||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,b.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,b.jsxs)(W.f,{type:"button",size:"sm",variant:"outline",onClick:t,disabled:k||m||null===i||!r||q===i,children:[(k||m)&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.importFlow.saveThreshold]}),!k&&null===i&&(0,b.jsx)(W.f,{type:"button",size:"sm",variant:"outline",onClick:s,children:a.importFlow.retryLoad})]}),(0,b.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:a.mastery.thresholdDescription}),null!==i&&!r&&(0,b.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:a.mastery.thresholdInvalid}),o&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:o})]})}var a7=a.i(393045);function a8(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)({gradeRecognitionMode:"fixed",fixedGradeSemester:null}),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=(0,c.useRef)(0),s=(0,c.useCallback)(async()=>{let b=++r.current;m(!0),q(null);try{let a=await f.k.get("/api/user");if(b!==r.current)return;let c={gradeRecognitionMode:a.gradeRecognitionMode??"fixed",fixedGradeSemester:a.fixedGradeSemester??null};i(c),k(c)}catch(c){if(b!==r.current)return;q(a.questionGrade.loadFailed),h.V.error("[QuestionGradeSetting]","加载录入年级规则失败",{error:(0,g.Z)(c)})}finally{b===r.current&&m(!1)}},[a.questionGrade.loadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{o(!0),q(null);try{let b=await f.k.patch("/api/user",e),c={gradeRecognitionMode:b.gradeRecognitionMode??e.gradeRecognitionMode,fixedGradeSemester:b.fixedGradeSemester??null};i(c),k(c),q(a.importFlow.preferenceSaved)}catch(b){q(a.importFlow.preferenceSaveFailed),h.V.error("[QuestionGradeSetting]","保存录入年级规则失败",{error:(0,g.Z)(b)})}finally{o(!1)}},u=l||n||null===j,v=j?.gradeRecognitionMode===e.gradeRecognitionMode&&j?.fixedGradeSemester===e.fixedGradeSemester;return(0,b.jsxs)("div",{className:"space-y-3 border-t pt-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{htmlFor:"question-grade-mode",children:a.questionGrade.label}),(0,b.jsxs)("select",{id:"question-grade-mode",value:e.gradeRecognitionMode,disabled:u,onChange:a=>{i({...e,gradeRecognitionMode:a.target.value}),q(null)},className:"h-10 w-full rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",children:[(0,b.jsx)("option",{value:"fixed",children:a.questionGrade.fixed}),(0,b.jsx)("option",{value:"ai",children:a.questionGrade.ai})]})]}),"fixed"===e.gradeRecognitionMode&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{htmlFor:"question-fixed-grade",children:a.editor.gradeSemester}),(0,b.jsx)(a7.f,{id:"question-fixed-grade",value:e.fixedGradeSemester??"",disabled:u,onChange:a=>{i({...e,fixedGradeSemester:a||null}),q(null)}})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"fixed"===e.gradeRecognitionMode?a.questionGrade.fixedDescription:a.questionGrade.aiDescription}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.questionGrade.description}),(0,b.jsxs)(W.f,{type:"button",variant:"outline",size:"sm",disabled:u||v,onClick:t,children:[(l||n)&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.questionGrade.save]}),!l&&null===j&&(0,b.jsx)(W.f,{type:"button",variant:"outline",size:"sm",onClick:s,children:a.importFlow.retryLoad}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:p})]})}function a9(){let{t:a}=(0,d.b)();return(0,b.jsx)(a2,{field:"enableSvgAnimation",label:a.importFlow.enableSvgAnimation,description:a.importFlow.enableSvgAnimationDesc})}function ba({value:a,onChange:c,disabled:e}){let{t:f}=(0,d.b)();return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(ab.f,{htmlFor:"app-time-zone",children:f.settings.general.timeZoneLabel}),(0,b.jsx)(aa.f,{id:"app-time-zone",value:a,onChange:a=>c(a.target.value),disabled:e,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,b.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings.general.timeZoneDesc})]})}function bb({config:a,setConfig:c,isAdmin:e,disabled:f}){let{t:g,language:h,setLanguage:i}=(0,d.b)(),{timeZone:j}=(0,v.M)(),k=a=>c(b=>({...b,timeouts:{...b.timeouts,analyze:1e3*a}}));return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:g.settings?.language||"Language"}),(0,b.jsxs)(aA.d,{value:h,onValueChange:a=>i(a),children:[(0,b.jsx)(aA.P,{children:(0,b.jsx)(aA.U,{})}),(0,b.jsxs)(aA.r,{children:[(0,b.jsx)(aA.T,{value:"zh",children:"中文 (Chinese)"}),(0,b.jsx)(aA.T,{value:"en",children:"English"})]})]})]}),(0,b.jsx)(ba,{value:a.timeZone??j,onChange:a=>c(b=>({...b,timeZone:a})),disabled:!e||f}),e&&(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(ab.f,{children:g.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,b.jsx)(aa.f,{type:"number",value:a.timeouts?.analyze?a.timeouts.analyze/1e3:"",onChange:a=>{let b=""===a.target.value?0:parseInt(a.target.value);k(isNaN(b)?0:b)},onBlur:()=>{let b=(a.timeouts?.analyze||0)/1e3,c=Math.min(600,Math.max(120,b));c!==b&&k(c)},min:120,max:600}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,b.jsx)(a4,{}),(0,b.jsx)(a8,{}),(0,b.jsx)(a9,{}),(0,b.jsx)(a3,{}),(0,b.jsx)(a1.f,{}),(0,b.jsx)(a6,{})]})}var bc=a.i(483138),bd=a.i(403512),be=a.i(591119),bf=a.i(481132);function bg(){let{t:a}=(0,d.b)(),{groups:e,loading:g,refetch:i}=(0,bf.f)(),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!1),n=async()=>{let b=j.trim();if(b){m(!0);try{await f.k.post("/api/paper-groups",{name:b}),k(""),F.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to add group",{error:b}),F.c.error(a.common?.messages?.saveFailed||"Failed to save")}finally{m(!1)}}},o=async(b,c)=>{let d=window.prompt(a.settings?.paperGroups?.renamePrompt||"Rename group",c);if(d&&d.trim()!==c)try{await f.k.patch(`/api/paper-groups/${b}`,{name:d.trim()}),F.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to rename group",{error:b}),F.c.error(a.common?.messages?.saveFailed||"Failed to save")}},p=async(b,c)=>{try{await f.k.patch(`/api/paper-groups/${b}`,{isActive:!c}),F.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to toggle group",{error:b}),F.c.error(a.common?.messages?.saveFailed||"Failed to save")}},q=async(b,c,d)=>{if(d>0){let e=(a.settings?.paperGroups?.deleteConfirmWithItems||'Group "{name}" has {count} questions. Deleting will clear their group assignment. Continue?').replace("{name}",c).replace("{count}",String(d));if(!await (0,F.u)(e,{destructive:!0}))return;try{await f.k.delete(`/api/paper-groups/${b}?clear=true`),F.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),F.c.error(a.common?.messages?.deleteFailed||"Delete failed")}return}let e=(a.settings?.paperGroups?.deleteConfirm||'Delete group "{name}"?').replace("{name}",c);if(await (0,F.u)(e,{destructive:!0}))try{await f.k.delete(`/api/paper-groups/${b}`),F.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),F.c.error(a.common?.messages?.deleteFailed||"Delete failed")}};return g?(0,b.jsx)(be.N,{children:(0,b.jsx)(be.O,{className:"py-12 flex items-center justify-center",children:(0,b.jsx)(D.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):(0,b.jsxs)(be.N,{children:[(0,b.jsxs)(be.Y,{children:[(0,b.jsxs)(be.v,{className:"flex items-center gap-2 text-lg",children:[(0,b.jsx)(bc.f,{className:"h-5 w-5"}),a.settings?.paperGroups?.title||"Paper Groups"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a.settings?.paperGroups?.desc||"Customize paper groups like Unit Test, Midterm, Final. Default groups A/B/Other can be renamed but not deleted."})]}),(0,b.jsxs)(be.O,{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(aa.f,{value:j,onChange:a=>k(a.target.value),placeholder:a.settings?.paperGroups?.addPlaceholder||"e.g. Unit Test",onKeyDown:a=>{"Enter"===a.key&&n()}}),(0,b.jsxs)(W.f,{onClick:n,disabled:l||!j.trim(),children:[l?(0,b.jsx)(D.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(bd.f,{className:"h-4 w-4 mr-1"}),a.common?.add||"Add"]})]}),(0,b.jsx)("div",{className:"space-y-2",children:e.map(c=>(0,b.jsxs)("div",{className:`flex items-center justify-between rounded-lg border p-3 ${!c.isActive?"opacity-50":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"font-medium",children:c.name}),c.key&&(0,b.jsx)($.f,{variant:"secondary",className:"text-xs",children:a.settings?.paperGroups?.systemBadge||"Default"}),!c.isActive&&(0,b.jsx)($.f,{variant:"outline",className:"text-xs",children:a.common?.inactive||"Inactive"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:()=>o(c.id,c.name),children:a.common?.rename||"Rename"}),(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:()=>p(c.id,c.isActive),children:c.isActive?a.common?.deactivate||"Deactivate":a.common?.activate||"Activate"}),!c.key&&(0,b.jsx)(W.f,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>q(c.id,c.name,c._count?.errorItems||0),children:(0,b.jsx)(ai.f,{className:"h-4 w-4"})})]})]},c.id))})]})]})}var bh=a.i(429246);let bi="[REDACTED]",bj=/api[-_]?key|password|passwd|secret|authorization|cookie|credential|private[-_]?key|^(access|refresh|id|auth|api|bearer|session|csrf|setup)?[-_]?token$/i,bk=Symbol.for("wrong-notebook.debug-log");function bl(){let a=globalThis,b=a[bk];return b||(b={enabledAt:null,entries:[],totalSize:0,dropped:0},a[bk]=b),b}function bm(a){let b=a.replace(/data:([\w.+-]+\/[\w.+-]+);base64,[A-Za-z0-9+/=]+/g,(a,b)=>`[data:${b}, ${a.length} chars]`).replace(/(Bearer\s+)[\w\-.~+/]+=*/gi,`$1${bi}`).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,bi).replace(/([?&](?:key|api_key|apikey|token|access_token)=)[^&\s"']+/gi,`$1${bi}`);return b.length>1e4&&(b=`${b.slice(0,1e4)}…[truncated ${b.length-1e4} chars]`),b}function bn(a,b,c,d=new Date){if(function(a=Date.now()){let b=bl();return null!==b.enabledAt&&(!(a-b.enabledAt>=864e5)||(b.enabledAt=null,!1))}(d.getTime()))try{let e={...function a(b,c=0,d=new WeakSet){if(null==b)return b;if("string"==typeof b)return bm(b);if("number"==typeof b||"boolean"==typeof b)return b;if("bigint"==typeof b)return b.toString();if("function"==typeof b||"symbol"==typeof b)return String(b);if(b instanceof Date)return b.toISOString();if(b instanceof Error){let e={name:b.name,message:bm(b.message)};return b.stack&&(e.stack=bm(b.stack)),void 0!==b.code&&(e.code=a(b.code,c+1,d)),void 0!==b.status&&(e.status=a(b.status,c+1,d)),void 0!==b.cause&&c<8&&(e.cause=a(b.cause,c+1,d)),e}if("object"!=typeof b)return String(b);if(d.has(b))return"[Circular]";if(c>=8)return"[Object]";if(d.add(b),Array.isArray(b)){let e=b.slice(0,100).map(b=>a(b,c+1,d));return b.length>100&&e.push(`…[${b.length-100} more items]`),e}return ArrayBuffer.isView(b)||b instanceof ArrayBuffer?`[Binary ${b.byteLength} bytes]`:Object.fromEntries(Object.entries(b).map(([b,e])=>[b,bj.test(b)&&null!=e&&""!==e?bi:a(e,c+1,d)]))}(b),time:d.toISOString(),level:a,msg:bm(c)},f=JSON.stringify(e).length,g=bl();for(g.entries.push({entry:e,size:f}),g.totalSize+=f;g.entries.length>5e3||g.totalSize>0x1400000&&g.entries.length>1;){let a=g.entries.shift();if(!a)break;g.totalSize-=a.size,g.dropped+=1}}catch{}}let bo={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function bp(a,b={}){let c,d=bo[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==bo[c]?bo[c]:bo.info;return(c,f)=>{let g,h,i=new Date;if("string"==typeof c?(g={},h=c):(g=c,h=f||""),bn(a,{...b,...g},h,i),!(d<e)){let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}(function a(b={}){return b.module,{trace:bp("trace",b),debug:bp("debug",b),info:bp("info",b),warn:bp("warn",b),error:bp("error",b),fatal:bp("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{bn("info",{...b,..."string"==typeof c?{content:c}:c},a);{let d="string"==typeof c?{content:c}:c||{};console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,...d,msg:a}));return}},divider:(a="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let bq=`填写题目类型,只能是以下 key 之一:single_choice(单选题)、multiple_choice(多选题)、true_false(判断题)、fill_blank(填空题)、calculation(计算题)、solution(解答题)、reading(阅读理解)、cloze(完形填空)、writing(写作)、other(其他)。
2
- 若题型不明确,填 other。`,br=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
1
+ module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(550194),e=a.i(875003),f=a.i(291938),g=a.i(960927),h=a.i(630534);let i=["system","light","dark"],j="system",k="app-theme";function l(a){return"string"==typeof a&&i.includes(a)}let m=(0,c.createContext)({preference:j,theme:"light",setPreference:()=>void 0}),n="(prefers-color-scheme: dark)",o=new Set;function p(a){return o.add(a),window.addEventListener("storage",a),()=>{o.delete(a),window.removeEventListener("storage",a)}}function q(){try{let a=localStorage.getItem(k);return l(a)?a:j}catch{return j}}function r(a){try{localStorage.setItem(k,a)}catch{}o.forEach(a=>a())}function s(a){let b=window.matchMedia(n);return b.addEventListener("change",a),()=>b.removeEventListener("change",a)}let t=()=>window.matchMedia(n).matches;function u({children:a}){let{data:d,status:i}=(0,e.useSession)(),k="authenticated"===i,n=d?.user?.email,o=(0,c.useSyncExternalStore)(p,q,()=>j),v=(0,c.useSyncExternalStore)(s,t,()=>!1),w="system"===o?v?"dark":"light":o;(0,c.useEffect)(()=>{let a=document.documentElement,b=b=>{a.classList.toggle("dark","dark"===b),a.style.colorScheme=b};b(w);let c=()=>b("light"),d=()=>b(w);return window.addEventListener("beforeprint",c),window.addEventListener("afterprint",d),()=>{window.removeEventListener("beforeprint",c),window.removeEventListener("afterprint",d)}},[w]),(0,c.useEffect)(()=>{if(!k||!n)return;let a=!1;return f.k.get("/api/user").then(b=>{!a&&l(b.themePreference)&&b.themePreference!==q()&&r(b.themePreference)}).catch(a=>{h.V.warn("[Theme]","Failed to load theme preference",{error:(0,g.Z)(a)})}),()=>{a=!0}},[k,n]);let x=(0,c.useCallback)(a=>{r(a),k&&f.k.patch("/api/user",{themePreference:a}).catch(a=>{h.V.warn("[Theme]","Failed to save theme preference",{error:(0,g.Z)(a)})})},[k]),y=(0,c.useMemo)(()=>({preference:o,theme:w,setPreference:x}),[o,w,x]);return(0,b.jsx)(m.Provider,{value:y,children:a})}var v=a.i(529759),w=a.i(50944),x=a.i(875160),y=a.i(699570),z=a.i(814574),A=a.i(510606),B=a.i(283248),C=a.i(118688),D=a.i(895605),E=a.i(483138),F=a.i(164831);let G={name:"circle-plus",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],aliases:["plus-circle"]};G.node;let H=(0,F.f)(G),I=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],J=[{key:"home",href:"/",icon:H,match:a=>"/"===a},{key:"notebooks",href:"/notebooks",icon:C.f,match:a=>a.startsWith("/notebooks")||a.startsWith("/error-items")||a.startsWith("/practice")},{key:"review",href:"/review",icon:D.f,match:a=>a.startsWith("/review")},{key:"stats",href:"/stats",icon:B.f,match:a=>a.startsWith("/stats")||a.startsWith("/tags")},{key:"exams",href:"/exams",icon:E.f,match:a=>a.startsWith("/exams")}];function K(a){return I.some(b=>b.test(a))}var L=a.i(710302);let M="ai-consent-dismissed:";function N(){let{t:a,language:g}=(0,d.b)(),i=a.aiConsent,{data:j,status:k}=(0,e.useSession)(),l=(0,w.usePathname)()||"/",m="authenticated"===k?j?.user?.email??null:null,[n,o]=(0,c.useState)(null),[p,q]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1);(0,c.useEffect)(()=>(0,A.y)(a=>o(b=>b??a)),[]);let t=K(l);(0,c.useEffect)(()=>{if(!m||t||function(a){try{return"1"===sessionStorage.getItem(a)}catch{return!1}}(M+m))return;let a=!1;return f.k.get("/api/user").then(b=>{a||!b||b.aiDataConsentAt||o(a=>a??"prompt")}).catch(a=>h.V.error("[AiConsentDialog]","load consent failed",{error:a})),()=>{a=!0}},[m,t]);let u=null!==n&&!!m;(0,c.useEffect)(()=>{if(!u)return;let a=!1;return f.k.get("/api/settings").then(b=>{a||q(b?.aiProvider??null)}).catch(()=>void 0),()=>{a=!0}},[u]);let v=()=>{o(null),s(!1)},B=async()=>{s(!0);try{await f.k.post("/api/user/ai-consent",{}),L.c.success("blocked"===n?i.agreedRetry:i.agreed),v()}catch(a){h.V.error("[AiConsentDialog]","save consent failed",{error:a}),L.c.error(i.failed),s(!1)}},C=()=>{m&&function(a){try{sessionStorage.setItem(a,"1")}catch{}}(M+m),L.c.info(i.declined),v()},D=(0,A.K)(p,g);return(0,b.jsx)(z.N,{open:u,onOpenChange:a=>{a||r||C()},children:(0,b.jsxs)(z.d,{className:"sm:max-w-lg",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:i.title}),(0,b.jsx)(z.C,{children:"blocked"===n?i.blocked:i.intro})]}),(0,b.jsxs)("div",{className:"space-y-3 text-sm",children:["blocked"===n&&(0,b.jsx)("p",{children:i.intro}),(0,b.jsx)("ul",{className:"list-disc space-y-1 pl-5",children:i.items.map(a=>(0,b.jsx)("li",{children:a},a))}),(0,b.jsx)("p",{children:D?i.providerKnown.replace("{provider}",D):i.providerUnknown}),(0,b.jsxs)("p",{children:[i.policy,"en"===g?" ":"",(0,b.jsx)("a",{className:"underline underline-offset-2",href:(0,A.L)(g),target:"_blank",rel:"noopener noreferrer",children:i.policyLink}),"en"===g?".":"。"]}),(0,b.jsx)("p",{className:"text-muted-foreground",children:i.declineNote})]}),(0,b.jsxs)(z.c,{className:"gap-2",children:[(0,b.jsx)(y.f,{type:"button",variant:"outline",onClick:C,disabled:r,children:i.decline}),(0,b.jsxs)(y.f,{type:"button",onClick:B,disabled:r,children:[r&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),i.agree]})]})]})})}var O=a.i(16644),P=a.i(238246),Q=a.i(557230);let R={name:"shield",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]};R.node;let S=(0,F.f)(R);var T=a.i(780767),U=a.i(682338),V=a.i(368114);function W({className:a}){let{t:e}=(0,d.b)(),{data:f}=(0,U.b)(),g=(0,c.useRef)(null);if((0,c.useEffect)(()=>{if(!f)return;let a=new Set([...f.tasks.filter(a=>"analyzing"===a.status||"saving"===a.status).map(a=>a.id),...(f.batches??[]).filter(a=>"splitting"===a.phase||"processing"===a.phase).map(a=>`batch:${a.id}`)]),b=new Set([...f.tasks.filter(a=>a.unread).map(a=>a.id),...(f.batches??[]).filter(a=>a.unread).map(a=>`batch:${a.id}`)]),c=g.current;c&&[...c].some(c=>!a.has(c)&&b.has(c))&&L.c.info(e.importTasks.finishedToast),g.current=a},[f,e.importTasks.finishedToast]),!f||0===f.tasks.length&&!f.batches?.length)return null;let{activeCount:h,unreadCount:i}=f,j=h>0?e.importTasks.entryActive.replace("{count}",String(h)):e.importTasks.entry;return(0,b.jsxs)(P.default,{href:"/import-tasks",className:(0,V.f)("relative flex h-9 items-center gap-1.5 rounded-full border px-3 text-sm font-medium transition-colors hover:bg-muted",i>0?"border-primary/50 text-primary":"text-muted-foreground",a),"data-testid":"import-tasks-entry","aria-label":i>0?`${j} \xb7 ${e.importTasks.entryUnread.replace("{count}",String(i))}`:j,children:[h>0?(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(T.f,{className:"h-4 w-4"}),(0,b.jsx)("span",{className:"whitespace-nowrap",children:j}),i>0&&(0,b.jsx)("span",{className:"flex h-5 min-w-5 items-center justify-center rounded-full bg-destructive px-1 text-xs text-white","data-testid":"import-tasks-unread",children:i})]})}var X=a.i(390702);let Y={name:"bot",size:24,node:[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]};Y.node;let Z=(0,F.f)(Y),$={name:"info",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]};$.node;let _=(0,F.f)($);var aa=a.i(357204);let ab={name:"message-square-text",size:24,node:[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]};ab.node;let ac=(0,F.f)(ab),ad={name:"settings",size:24,node:[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]};ad.node;let ae=(0,F.f)(ad);var af=a.i(344451),ag=a.i(930363),ah=a.i(875083),ai=a.i(986705),aj=a.i(786304),ak=a.i(563658),al=a.i(866718),am=a.i(870430);let an=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("div",{className:"relative w-full overflow-auto",children:(0,b.jsx)("table",{ref:d,className:(0,V.f)("w-full caption-bottom text-sm",a),...c})}));an.displayName="Table";let ao=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("thead",{ref:d,className:(0,V.f)("[&_tr]:border-b",a),...c}));ao.displayName="TableHeader";let ap=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tbody",{ref:d,className:(0,V.f)("[&_tr:last-child]:border-0",a),...c}));ap.displayName="TableBody",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tfoot",{ref:d,className:(0,V.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",a),...c}))).displayName="TableFooter";let aq=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("tr",{ref:d,className:(0,V.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",a),...c}));aq.displayName="TableRow";let ar=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("th",{ref:d,className:(0,V.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",a),...c}));ar.displayName="TableHead";let as=c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("td",{ref:d,className:(0,V.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",a),...c}));as.displayName="TableCell",(c.forwardRef(({className:a,...c},d)=>(0,b.jsx)("caption",{ref:d,className:(0,V.f)("mt-4 text-sm text-muted-foreground",a),...c}))).displayName="TableCaption";var at=a.i(951675);let au={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};au.node;let av=(0,F.f)(au);var aw=a.i(79362);function ax(){var a;let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(String(5)),[j,k]=(0,c.useState)(!1),l=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");i(String(a.aiConcurrencyLimit??5))}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{l()},[l]);let m=Number(g),n=""!==g.trim()&&"number"==typeof(a=m)&&Number.isInteger(a)&&a>=1&&a<=100,o=async()=>{if(n){k(!0);try{await f.k.post("/api/settings",{aiConcurrencyLimit:m}),L.c.success(e.admin.aiConcurrencyLimitSaved)}catch(a){h.V.error("[AiConcurrencyLimitSetting]","Failed to update AI concurrency limit",{error:a}),L.c.error(e.common.error)}finally{k(!1)}}};return(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(am.f,{htmlFor:"ai-concurrency-limit",className:"text-base",children:e.admin.aiConcurrencyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:e.admin.aiConcurrencyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(al.f,{id:"ai-concurrency-limit",type:"number",min:1,max:100,step:1,inputMode:"numeric",value:g,onChange:a=>i(a.target.value),"aria-invalid":!n,className:"w-24"}),(0,b.jsxs)(y.f,{size:"sm",onClick:o,disabled:j||!n,children:[j&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.common.save]})]})]})}function ay(){let{timeZone:a}=(0,v.M)(),{data:i}=(0,e.useSession)(),{t:j}=(0,d.b)(),[k,l]=(0,c.useState)([]),[m,n]=(0,c.useState)(!0),[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(!1),[s,t]=(0,c.useState)("0"),[u,w]=(0,c.useState)(!1),z=(0,c.useCallback)(async()=>{n(!0);try{let a=await f.k.get("/api/admin/users");l(a)}catch(a){h.V.error("[UserManagement]","Failed to fetch users",{error:a})}finally{n(!1)}},[]),A=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/settings");p(!0===a.allowRegistration),t(String(a.aiDailyLimit??0))}catch(a){h.V.error("[UserManagement]","Failed to fetch config",{error:a})}},[]);(0,c.useEffect)(()=>{z(),A()},[z,A]);let B=async a=>{r(!0);try{await f.k.post("/api/settings",{allowRegistration:a}),p(a)}catch(a){h.V.error("[UserManagement]","Failed to update registration setting",{error:a}),L.c.error(j.common.error)}finally{r(!1)}},C=Number(s),D=""!==s.trim()&&Number.isInteger(C)&&C>=0,E=async()=>{if(D){w(!0);try{await f.k.post("/api/settings",{aiDailyLimit:C}),L.c.success(j.admin.aiDailyLimitSaved)}catch(a){h.V.error("[UserManagement]","Failed to update AI daily limit",{error:a}),L.c.error(j.common.error)}finally{w(!1)}}},F=async a=>{let b=a.isActive?j.admin.confirmDisable:j.admin.confirmEnable;if(await (0,L.u)(b))try{await f.k.patch(`/api/admin/users/${a.id}`,{isActive:!a.isActive}),z()}catch(a){h.V.error("[UserManagement]","Failed to update user status",{error:a}),L.c.error(j.common.error)}},G=async a=>{if(await (0,L.u)(j.admin.confirmDelete,{destructive:!0}))try{await f.k.delete(`/api/admin/users/${a.id}`),z()}catch(b){h.V.error("[UserManagement]","Failed to delete user",{error:b});let a=(0,g.d)(b)||j.common.error;L.c.error(a)}};return m?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(x.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(am.f,{className:"text-base",children:j.admin?.allowRegistration||"Allow New Registrations"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[q&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),(0,b.jsx)(ak.f,{checked:o,onCheckedChange:B,disabled:q})]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)(am.f,{htmlFor:"ai-daily-limit",className:"text-base",children:j.admin.aiDailyLimit}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:j.admin.aiDailyLimitDesc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(al.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:s,onChange:a=>t(a.target.value),"aria-invalid":!D,className:"w-24"}),(0,b.jsxs)(y.f,{size:"sm",onClick:E,disabled:u||!D,children:[u&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),j.common.save]})]})]}),(0,b.jsx)(ax,{}),(0,b.jsx)("div",{className:"sm:hidden space-y-3",children:k.map(c=>(0,b.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between items-start",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(aj.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})]}),(0,b.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,b.jsxs)("div",{className:"text-muted-foreground",children:[j.admin.errors,": ",c._count.errorItems," | ",j.admin.practiceCount,": ",c._count.practiceRecords," | ",j.admin.aiUsageToday,": ",c.aiUsageToday]}),(0,b.jsx)(aj.f,{variant:c.isActive?"default":"destructive",className:"text-xs",children:c.isActive?j.admin.active:j.admin.disabled})]}),(0,b.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,b.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,ai.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===i?.user?.id,children:c.isActive?(0,b.jsx)(av,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aw.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,children:(0,b.jsx)(at.f,{className:"h-4 w-4 text-destructive"})})]})]})]},c.id))}),(0,b.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,b.jsxs)(an,{children:[(0,b.jsx)(ao,{children:(0,b.jsxs)(aq,{children:[(0,b.jsx)(ar,{children:j.admin.nameEmail}),(0,b.jsx)(ar,{children:j.admin.role}),(0,b.jsx)(ar,{children:j.admin.stats}),(0,b.jsx)(ar,{children:j.admin.createdAt}),(0,b.jsx)(ar,{children:j.admin.status}),(0,b.jsx)(ar,{className:"text-right",children:j.admin.actions})]})}),(0,b.jsx)(ap,{children:k.map(c=>(0,b.jsxs)(aq,{children:[(0,b.jsxs)(as,{children:[(0,b.jsx)("div",{className:"font-medium",children:c.name||"N/A"}),(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:c.email})]}),(0,b.jsx)(as,{children:(0,b.jsx)(aj.f,{variant:"admin"===c.role?"default":"secondary",children:"admin"===c.role?j.admin.admin:j.admin.user})}),(0,b.jsxs)(as,{children:[(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.errors,": ",c._count.errorItems]}),(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.practiceCount,": ",c._count.practiceRecords]}),(0,b.jsxs)("div",{className:"text-sm",children:[j.admin.aiUsageToday,": ",c.aiUsageToday]})]}),(0,b.jsx)(as,{children:(0,ai.r)(c.createdAt,"yyyy-MM-dd",a)}),(0,b.jsx)(as,{children:(0,b.jsx)(aj.f,{variant:c.isActive?"default":"destructive",children:c.isActive?j.admin.active:j.admin.disabled})}),(0,b.jsxs)(as,{className:"text-right space-x-2",children:[(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>F(c),disabled:c.id===i?.user?.id,title:c.isActive?j.admin.disable:j.admin.enable,children:c.isActive?(0,b.jsx)(av,{className:"h-4 w-4 text-orange-500"}):(0,b.jsx)(aw.f,{className:"h-4 w-4 text-green-500"})}),(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>G(c),disabled:c.id===i?.user?.id,title:j.admin.delete,children:(0,b.jsx)(at.f,{className:"h-4 w-4 text-destructive"})})]})]},c.id))})]})})]})}var az=a.i(168370);let aA={name:"scroll-text",size:24,node:[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]};aA.node;let aB=(0,F.f)(aA);function aC(a){return(0,b.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...a,children:[(0,b.jsx)("path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4"}),(0,b.jsx)("path",{d:"M9 18c-4.51 2-5-2-7-2"})]})}let aD={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};aD.node;let aE=(0,F.f)(aD);var aF=a.i(540553);let aG=()=>()=>void 0;function aH(){let{t:a}=(0,d.b)(),e=(0,c.useSyncExternalStore)(aG,aF.f,()=>null);return e?e.isStandalone?.()?(0,b.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:a.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,b.jsxs)("span",{className:"break-all",children:[a.settings?.about?.androidServer||"Server",": ",e.getServerUrl()]}),(0,b.jsxs)(y.f,{variant:"outline",className:"gap-2",onClick:()=>e.changeServer(),children:[(0,b.jsx)(aE,{className:"h-4 w-4"}),a.settings?.about?.changeServer||"Change server"]})]}):null}var aI=a.i(424235);function aJ(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)("");(0,c.useEffect)(()=>{fetch("/api/version").then(a=>a.json()).then(a=>f(a.version)).catch(()=>{})},[]);let g=[{href:aI.f,icon:aC,label:a.settings?.about?.github||"GitHub Repository"},{href:`${aI.f}/releases`,icon:aB,label:a.settings?.about?.releaseNotes||"Release Notes"},{href:`${aI.f}/issues`,icon:ac,label:a.settings?.about?.feedback||"Feedback"}];return(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("h3",{className:"text-2xl font-bold",children:a.app?.title||"Smart Error Notebook"}),(0,b.jsx)("p",{className:"text-muted-foreground",children:a.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,b.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,b.jsx)(_,{className:"h-4 w-4"}),(0,b.jsxs)("span",{children:[a.settings?.about?.version||"Version",": v",e||"unknown"]})]}),(0,b.jsx)(aH,{}),(0,b.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:g.map(({href:a,icon:c,label:d})=>(0,b.jsx)(y.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,b.jsxs)("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[(0,b.jsx)(c,{className:"h-4 w-4"}),d,(0,b.jsx)(az.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:a.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var aK=a.i(152679),aL=a.i(580701),aM=a.i(348966);let aN={name:"",email:"",educationStage:"",enrollmentYear:"",currentGrade:"",currentSemester:"",password:""};function aO(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)(aN),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),p=(0,c.useCallback)(async()=>{try{let a=await f.k.get("/api/user"),b=a.fixedGradeSemester?(0,aM.p)(a.fixedGradeSemester):null;i({name:a.name||"",email:a.email||"",educationStage:a.educationStage||"",enrollmentYear:a.enrollmentYear||"",currentGrade:b?.grade||"",currentSemester:b?.semester||"",password:""})}catch(a){h.V.error("[AccountSettings]","Failed to fetch profile",{error:a})}finally{m(!1)}},[]);(0,c.useEffect)(()=>{p()},[p]);let q=async()=>{if(e.password&&e.password!==j)return void L.c.error(a.settings?.messages?.passwordMismatch||"Passwords do not match");o(!0);try{let b={name:e.name,email:e.email,educationStage:e.educationStage};e.enrollmentYear&&(b.enrollmentYear=parseInt(e.enrollmentYear.toString())),e.password&&(b.password=e.password),e.currentGrade&&e.currentSemester?b.fixedGradeSemester=`${e.currentGrade}${e.currentSemester}`:e.currentGrade||(b.fixedGradeSemester=null),await f.k.patch("/api/user",b),L.c.success(a.settings?.messages?.profileUpdated||"Profile updated"),i(a=>({...a,password:""})),k(""),window.location.reload()}catch(b){h.V.error("[AccountSettings]","Failed to update profile",{error:(0,g.d)(b)??(0,g.Z)(b)}),L.c.error((0,g.d)(b)||a.settings?.messages?.updateFailed||"Update failed")}finally{o(!1)}};return l?(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(x.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.auth?.name||"Name"}),(0,b.jsx)(al.f,{value:e.name||"",onChange:a=>i({...e,name:a.target.value})})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.auth?.email||"Email"}),(0,b.jsx)(al.f,{value:e.email||"",onChange:a=>i({...e,email:a.target.value}),type:"email"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.auth?.educationStage||"Education Stage"}),(0,b.jsxs)(aL.d,{value:e.educationStage||"",onValueChange:a=>i({...e,educationStage:a,currentGrade:(0,aM.c)(a).includes(e.currentGrade)?e.currentGrade:"",currentSemester:(0,aM.c)(a).includes(e.currentGrade)?e.currentSemester:""}),children:[(0,b.jsx)(aL.P,{children:(0,b.jsx)(aL.U,{placeholder:a.auth?.selectStage||"Select Stage"})}),(0,b.jsxs)(aL.r,{children:[(0,b.jsx)(aL.T,{value:"primary",children:a.auth?.primary||"Primary School"}),(0,b.jsx)(aL.T,{value:"junior_high",children:a.auth?.juniorHigh||"Junior High"}),(0,b.jsx)(aL.T,{value:"senior_high",children:a.auth?.seniorHigh||"Senior High"}),(0,b.jsx)(aL.T,{value:"university",children:a.auth?.university||"University"})]})]})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.auth?.enrollmentYear||"Enrollment Year"}),(0,b.jsx)(al.f,{type:"number",value:e.enrollmentYear||"",onChange:a=>i({...e,enrollmentYear:a.target.value}),placeholder:"YYYY"})]})]}),e.educationStage&&(0,aM.c)(e.educationStage).length>0&&(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.settings?.account?.currentGrade||"Current Grade & Semester"}),(0,b.jsxs)(aL.d,{value:e.currentGrade||"",onValueChange:a=>i({...e,currentGrade:a,currentSemester:a?e.currentSemester||"上":""}),children:[(0,b.jsx)(aL.P,{children:(0,b.jsx)(aL.U,{placeholder:a.settings?.account?.selectGrade||"Select Grade"})}),(0,b.jsx)(aL.r,{children:(0,aM.c)(e.educationStage).map(a=>(0,b.jsx)(aL.T,{value:a,children:a},a))})]})]}),e.currentGrade&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.settings?.account?.selectSemester||"Select Semester"}),(0,b.jsxs)(aL.d,{value:e.currentSemester||"",onValueChange:a=>i({...e,currentSemester:a}),children:[(0,b.jsx)(aL.P,{children:(0,b.jsx)(aL.U,{placeholder:a.settings?.account?.selectSemester||"Select Semester"})}),(0,b.jsxs)(aL.r,{children:[(0,b.jsx)(aL.T,{value:"上",children:a.settings?.account?.firstSemester||"1st Semester"}),(0,b.jsx)(aL.T,{value:"下",children:a.settings?.account?.secondSemester||"2nd Semester"})]})]})]})]}),e.currentGrade&&e.currentSemester&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground -mt-2",children:a.settings?.account?.gradeAppliedHint||"New questions will default to this grade. You can also configure AI grade recognition in General Settings."}),(0,b.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,b.jsx)(aK.f,{value:e.password,onChange:a=>i({...e,password:a.target.value}),placeholder:"******",minLength:6})]}),e.password&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:a.auth?.confirmPassword||"Confirm Password"}),(0,b.jsx)(aK.f,{value:j,onChange:a=>k(a.target.value),placeholder:"******",minLength:6})]})]}),(0,b.jsxs)(y.f,{onClick:q,disabled:n,className:"w-full",children:[n&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.settings?.account?.update||"Update Profile"]})]})}var aP=a.i(151304),aQ=a.i(201661),aR=a.i(246059),aS=a.i(998868),aT=a.i(332485),aU=a.i(861954);let aV="https://github.com/xiaoyang111222/cn-math-taxonomy",aW="https://raw.githubusercontent.com/xiaoyang111222/cn-math-taxonomy/HEAD/data/topics.json",aX=aR.z.object({id:aS.z.string().optional(),name:aS.z.string().trim().min(1),subject:aS.z.string().nullish(),grade:aT.z.number().int(),semester:aS.z.string().nullish(),chapter:aS.z.string().nullish()}).passthrough();aU.z.array(aX).min(1);let aY="/api/admin/cnm-tags";function aZ(){let{t:a}=(0,d.b)(),e=a.admin.cnmTags,[g,i]=(0,c.useState)(null),[j,k]=(0,c.useState)(!1),l=(0,c.useRef)(null),m=(0,c.useCallback)(async()=>{try{i(await f.k.get(aY))}catch(a){h.V.warn("[CnmTagImportSettings]","Failed to load status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]);let n=async a=>{if(a){k(!0);try{let b;try{b=JSON.parse(await a.text())}catch{L.c.error(e.invalidFile);return}let c=await f.k.post(aY,{topics:b},{timeout:3e5});i(c.status),L.c.success(e.imported.replace("{created}",String(c.result.created)).replace("{skipped}",String(c.result.skipped)))}catch(b){h.V.error("[CnmTagImportSettings]","Import failed",{error:b});let a=b instanceof f.a&&400===b.status;L.c.error(a?e.invalidFile:e.failed)}finally{k(!1),l.current&&(l.current.value="")}}},o=g?.knowledgePoints??0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)("p",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(C.f,{className:"h-4 w-4"}),e.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.desc})]}),(0,b.jsxs)("div",{className:"space-y-1 rounded-md bg-muted/50 p-3 text-xs text-muted-foreground",children:[(0,b.jsx)("p",{children:e.downloadHint}),(0,b.jsx)("a",{href:aW,target:"_blank",rel:"noopener noreferrer",className:"block break-all text-primary underline",children:aW}),(0,b.jsxs)("p",{children:[e.sourceLabel," ",(0,b.jsx)("a",{href:aV,target:"_blank",rel:"noopener noreferrer",className:"break-all text-primary underline",children:aV})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g?o>0?e.status.replace("{count}",String(o)):e.notImported:""}),(0,b.jsx)("input",{ref:l,type:"file",accept:".json,application/json",className:"hidden",onChange:a=>n(a.target.files?.[0]),disabled:j}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",className:"w-full sm:w-auto",onClick:()=>l.current?.click(),disabled:j,children:[j?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(aQ.f,{className:"mr-2 h-4 w-4"}),j?e.importing:e.select]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:e.note})]})}var a$=a.i(519783);let a_={info:{card:"border-blue-200 dark:border-blue-900 bg-blue-50 dark:bg-blue-950/40",title:"text-blue-900 dark:text-blue-200 font-bold",desc:"text-blue-800 dark:text-blue-200 font-medium",button:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800"},danger:{card:"border-red-200 dark:border-red-900 bg-red-50 dark:bg-red-950/40",title:"text-red-700 dark:text-red-300 font-medium",desc:"text-red-600 dark:text-red-400",button:""},critical:{card:"border-red-600/50 bg-red-100/50 dark:bg-red-900/40",title:"text-red-900 dark:text-red-200 font-bold",desc:"text-red-800 dark:text-red-200 font-medium",button:"bg-red-700 hover:bg-red-800"}};function a0({title:a,description:c,tone:d,busy:e,icon:f,onClick:g}){let h=a_[d];return(0,b.jsxs)("div",{className:`p-4 border rounded-lg ${h.card}`,children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("span",{className:`text-sm flex items-center gap-2 ${h.title}`,children:a}),(0,b.jsx)(y.f,{variant:"info"===d?"outline":"destructive",size:"sm",onClick:g,disabled:e,className:h.button,children:e?(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}):f})]}),(0,b.jsx)("p",{className:`text-xs mt-2 ${h.desc}`,children:c})]})}function a1({isAdmin:a}){let{t:e}=(0,d.b)(),[g,i]=(0,c.useState)(null),j=async(a,b,c,d)=>{i(a);try{L.c.success(await b()),d&&window.location.reload()}catch(b){h.V.error("[DangerZoneSettings]",`${a} failed`,{error:b}),L.c.error(c)}finally{i(null)}},k=e.settings?.clearSuccess||"Success",l=e.settings?.clearError||"Failed",m=async()=>{await (0,L.u)(e.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await j("migrateTags",async()=>{let a=await f.k.post("/api/admin/migrate-tags",{});return`${k}: ${a.count||0} tags migrated.`},e.settings?.clearError||"Failed to migrate tags",!1)},n=async()=>{await (0,L.u)(e.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearPractice",async()=>(await f.k.delete("/api/stats/practice/clear"),k),l,!0)},o=async()=>{await (0,L.u)(e.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await j("clearErrors",async()=>(await f.k.delete("/api/error-items/clear"),k),l,!0)},p=async()=>{if(!await (0,L.u)(e.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let a=prompt(e.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==a){null!==a&&L.c.error(e.common?.error||"Confirmation failed");return}await j("systemReset",async()=>(await f.k.post("/api/admin/system-reset",{}),e.settings?.clearSuccess||"Success - System Reset Complete"),e.settings?.clearError||"Failed to reset system",!0)};return(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsx)(a0,{tone:"info",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(a$.f,{className:"h-4 w-4"}),e.settings?.migrateTags||"Migrate Tags"]}),description:e.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===g,icon:(0,b.jsx)(a$.f,{className:"h-4 w-4"}),onClick:m}),(0,b.jsx)(a0,{tone:"danger",title:e.settings?.clearData||"Clear Practice Data",description:e.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===g,icon:(0,b.jsx)(at.f,{className:"h-4 w-4"}),onClick:n}),(0,b.jsx)(a0,{tone:"danger",title:e.settings?.clearErrorData||"Clear Error Data",description:e.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===g,icon:(0,b.jsx)(at.f,{className:"h-4 w-4"}),onClick:o}),a&&(0,b.jsx)(a0,{tone:"critical",title:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(X.f,{className:"h-4 w-4"}),e.settings?.systemReset||"System Initialization"]}),description:e.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===g,icon:(0,b.jsx)(at.f,{className:"h-4 w-4"}),onClick:p})]})}let a2={name:"user-x",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]};a2.node;let a3=(0,F.f)(a2);function a4({isAdmin:a}){let{t:g}=(0,d.b)(),i=g.settings.deleteAccount,[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(!1),p=a=>{!n&&(k(a),a||m(""))},q=async a=>{if(a.preventDefault(),l){o(!0);try{await f.k.delete("/api/user",{body:JSON.stringify({password:l})}),L.c.success(i.success),await (0,e.signOut)({callbackUrl:"/login"})}catch(b){let a=b instanceof f.a&&400===b.status;a||h.V.error("[DeleteAccountSettings]","delete account failed",{error:b}),L.c.error(a?i.wrongPassword:i.failed),o(!1)}}};return(0,b.jsxs)("div",{className:"p-4 border rounded-lg border-red-600/50 bg-red-100/50 dark:bg-red-900/40",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("span",{className:"text-sm flex items-center gap-2 text-red-900 dark:text-red-200 font-bold",children:[(0,b.jsx)(a3,{className:"h-4 w-4"}),i.title]}),(0,b.jsx)(y.f,{variant:"destructive",size:"sm",className:"bg-red-700 hover:bg-red-800",disabled:a,onClick:()=>k(!0),"aria-label":i.title,children:(0,b.jsx)(a3,{className:"h-4 w-4"})})]}),(0,b.jsx)("p",{className:"text-xs mt-2 text-red-800 dark:text-red-200 font-medium",children:a?i.adminDisabled:i.desc}),(0,b.jsx)(z.N,{open:j,onOpenChange:p,children:(0,b.jsx)(z.d,{className:"sm:max-w-md",children:(0,b.jsxs)("form",{onSubmit:q,className:"space-y-4",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:i.confirmTitle}),(0,b.jsx)(z.C,{children:i.confirmDesc})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{htmlFor:"delete-account-password",children:i.passwordLabel}),(0,b.jsx)(aK.f,{id:"delete-account-password",autoComplete:"current-password",value:l,onChange:a=>m(a.target.value),disabled:n})]}),(0,b.jsxs)(z.c,{className:"gap-2",children:[(0,b.jsx)(y.f,{type:"button",variant:"outline",onClick:()=>p(!1),disabled:n,children:i.cancel}),(0,b.jsxs)(y.f,{type:"submit",variant:"destructive",disabled:!l||n,children:[n&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),i.confirm]})]})]})})})]})}let a5={name:"shield-check",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]};a5.node;let a6=(0,F.f)(a5);function a7(){let{t:a,language:e}=(0,d.b)(),g=a.aiConsent,[i,j]=(0,c.useState)(void 0),[k,l]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let a=!1;return f.k.get("/api/user").then(b=>{a||j(b?.aiDataConsentAt??null)}).catch(a=>h.V.error("[AiConsentSetting]","load consent failed",{error:a})),()=>{a=!0}},[]);let m=async a=>{if(a||await (0,L.u)(g.revokeConfirm,{destructive:!0})){l(!0);try{let b=a?await f.k.post("/api/user/ai-consent",{}):await f.k.delete("/api/user/ai-consent");j(b.aiDataConsentAt),L.c.success(a?g.agreed:g.revoked)}catch(a){h.V.error("[AiConsentSetting]","update consent failed",{error:a}),L.c.error(g.failed)}finally{l(!1)}}};if(void 0===i)return null;let n=null!==i,o=n?new Date(i).toLocaleDateString("en"===e?"en-US":"zh-CN"):"";return(0,b.jsxs)("div",{className:"space-y-2 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("span",{className:"flex items-center gap-2 text-sm font-medium",children:[(0,b.jsx)(a6,{className:"h-4 w-4"}),g.settingTitle]}),(0,b.jsxs)(y.f,{type:"button",size:"sm",variant:n?"outline":"default",onClick:()=>m(!n),disabled:k,children:[k&&(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}),n?g.revoke:g.grant]})]}),(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:[n?g.settingGranted.replace("{date}",o):g.settingNotGranted," ",(0,b.jsx)("a",{className:"underline underline-offset-2",href:(0,A.L)(e),target:"_blank",rel:"noopener noreferrer",children:g.policyLink})]})]})}var a8=a.i(613412),a9=a.i(536670),ba=a.i(64332);async function bb(a,b){let c=await fetch(a);if(!c.ok)throw Error((await c.json().catch(()=>({}))).message||"Download failed");let d=await c.blob(),e=window.URL.createObjectURL(d),f=document.createElement("a");f.href=e;let g=c.headers.get("Content-Disposition")?.match(/filename="(.+)"/);f.download=g?g[1]:b,document.body.appendChild(f),f.click(),document.body.removeChild(f),window.URL.revokeObjectURL(e)}function bc({isAdmin:a,userId:e}){let{t:g}=(0,d.b)(),[i,j]=(0,c.useState)(!1),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(null),o=`user:${e}:data-import`,{running:p,refresh:q}=(0,ba.f)(o),r=(0,c.useRef)(!1);(0,c.useEffect)(()=>{if(p){r.current=!0;return}r.current&&(r.current=!1,window.location.reload())},[p]);let s=async a=>{if(!a||await (0,L.u)(g.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){j(!0);try{await bb(a?"/api/export?all=true":"/api/export",a?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),L.c.success(g.settings?.exportSuccess||"Export successful")}catch(b){h.V.error("[DataBackupSettings]",a?"Export all failed":"Export failed",{error:b}),L.c.error(g.settings?.exportFailed||"Export failed")}finally{j(!1)}}},t=async a=>{if(!m)return;let b=a?g.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":g.settings?.importConfirm||"Are you sure you want to import?";if(await (0,L.u)(b)){l(!0);try{let b=JSON.parse(await m.text()),{stats:c}=await f.k.post(a?"/api/import?all=true":"/api/import",b);L.c.success((g.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers and {voices} cloud voice clips.").replace("{subjects}",String(c.subjectsCreated)).replace("{tags}",String(c.tagsCreated)).replace("{items}",String(c.errorItemsCreated)).replace("{schedules}",String(c.reviewSchedulesCreated)).replace("{records}",String(c.practiceRecordsCreated)).replace("{papers}",String(c.examPapersCreated??0)).replace("{voices}",String(c.ttsSpeechesImported??0)).replace("{duplicates}",String(c.duplicateErrorItems??0))),n(null),window.location.reload()}catch(b){b instanceof f.a&&409===b.status&&b.data?.code==="TASK_ALREADY_RUNNING"?(L.c.info(g.errors.TASK_ALREADY_RUNNING),await q()):(h.V.error("[DataBackupSettings]",a?"Import all failed":"Import failed",{error:b}),L.c.error(g.settings?.importFailed||"Import failed"))}finally{l(!1)}}},u=(a,c)=>a?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):c,v=k||!!p;return(0,b.jsxs)("div",{className:"p-4 border border-blue-200 dark:border-blue-900 rounded-lg bg-blue-50 dark:bg-blue-950/40",children:[(0,b.jsx)("h4",{className:"text-sm font-bold text-blue-900 dark:text-blue-200 mb-3",children:g.settings?.dataManagement||"Data Management"}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:g.settings?.exportData||"Export Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>s(!1),disabled:i,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[u(i,(0,b.jsx)(a9.f,{className:"mr-2 h-4 w-4"})),g.settings?.exportData||"Export"]}),a&&(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>s(!0),disabled:i,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[u(i,(0,b.jsx)(a9.f,{className:"mr-2 h-4 w-4"})),g.settings?.exportAllData||"Export All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:g.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,b.jsx)("span",{className:"text-sm text-blue-800 dark:text-blue-200 font-medium",children:g.settings?.importData||"Import Data"}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"file",accept:".json",onChange:a=>n(a.target.files?.[0]??m),className:"hidden",id:"import-file-input",disabled:v}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:v,className:"bg-blue-100 dark:bg-blue-900/40 hover:bg-blue-200 dark:hover:bg-blue-900/60 text-blue-900 dark:text-blue-200 border-blue-300 dark:border-blue-800",children:[u(v,(0,b.jsx)(aQ.f,{className:"mr-2 h-4 w-4"})),m?.name||g.settings?.selectFile||"Select File"]}),m&&(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>t(!1),disabled:v,className:"bg-green-100 dark:bg-green-900/40 hover:bg-green-200 dark:hover:bg-green-900/60 text-green-900 dark:text-green-200 border-green-300 dark:border-green-800",children:[u(v,(0,b.jsx)(a8.f,{className:"mr-2 h-4 w-4"})),g.settings?.importData||"Import"]}),m&&a&&(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>t(!0),disabled:v,className:"bg-orange-100 dark:bg-orange-900/40 hover:bg-orange-200 dark:hover:bg-orange-900/60 text-orange-900 dark:text-orange-200 border-orange-300 dark:border-orange-800",children:[u(v,(0,b.jsx)(a8.f,{className:"mr-2 h-4 w-4"})),g.settings?.importAllData||"Import All"]})]})]}),(0,b.jsx)("p",{className:"text-xs text-blue-700 dark:text-blue-300",children:g.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}let bd={name:"bug",size:24,node:[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]]};bd.node;let be=(0,F.f)(bd),bf="/api/admin/debug-logs";function bg(){let{t:a}=(0,d.b)(),{timeZone:e}=(0,v.M)(),g=a.admin.debugLog,[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!1),m=(0,c.useCallback)(async()=>{try{j(await f.k.get(bf))}catch(a){h.V.warn("[DebugLogSettings]","Failed to load debug status",{error:a})}},[]);(0,c.useEffect)(()=>{m()},[m]),(0,c.useEffect)(()=>{if(!i?.enabled)return;let a=setInterval(m,5e3);return()=>clearInterval(a)},[i?.enabled,m]);let n=async(a,b)=>{l(!0);try{await a(),L.c.success(b)}catch(a){h.V.error("[DebugLogSettings]","Debug log action failed",{error:a}),L.c.error(g.failed)}finally{l(!1)}},o=a=>a?(0,ai.r)(a,"yyyy-MM-dd HH:mm",e):"",p=i?.enabled?g.enabledHint.replace("{since}",o(i.enabledAt)).replace("{until}",o(i.expiresAt)):g.disabledHint,q=(i?.entryCount??0)>0;return(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border p-4",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsxs)(am.f,{htmlFor:"debug-mode-switch",className:"flex items-center gap-2 font-medium",children:[(0,b.jsx)(be,{className:"h-4 w-4"}),g.title]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.desc})]}),(0,b.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:g.enable}),(0,b.jsx)(ak.f,{id:"debug-mode-switch",checked:!!i?.enabled,onCheckedChange:a=>n(async()=>{j(await f.k.post(bf,{enabled:a}))},a?g.enabled:g.disabled),disabled:k||!i})]})]}),(0,b.jsxs)("p",{className:`text-xs ${i?.enabled?"text-orange-600":"text-muted-foreground"}`,children:[p,i&&(0,b.jsxs)(b.Fragment,{children:[" ",g.entries.replace("{count}",String(i.entryCount)),i.droppedCount>0&&g.dropped.replace("{count}",String(i.droppedCount))]})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{await bb(`${bf}/export`,"wrong-notebook-debug.json"),await m()},g.exported),disabled:k||!q,className:"sm:flex-1",children:[k?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(a9.f,{className:"mr-2 h-4 w-4"}),g.export]}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>n(async()=>{j(await f.k.delete(bf))},g.cleared),disabled:k||!q,children:[(0,b.jsx)(at.f,{className:"mr-2 h-4 w-4"}),g.clear]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.privacyNote})]})}var bh=a.i(225949);function bi({field:a,label:e,description:g}){let{t:i}=(0,d.b)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(!1),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=`preference-${a}`;(0,c.useEffect)(()=>{f.k.get("/api/user").then(b=>k(!!b[a])).catch(()=>void 0).finally(()=>m(!0))},[a]);let s=async b=>{k(b),o(!0);try{await f.k.patch("/api/user",{[a]:b}),q(i.importFlow.preferenceSaved)}catch(c){k(!b),q(i.importFlow.preferenceSaveFailed),h.V.error("[Settings]","Failed to save user preference",{field:a,error:c instanceof Error?c.message:String(c)})}finally{o(!1)}};return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,b.jsx)(am.f,{htmlFor:r,children:e}),(0,b.jsx)(ak.f,{id:r,checked:j,onCheckedChange:s,disabled:!l||n})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:p})]})}function bj(){let{t:a}=(0,d.b)();return(0,b.jsx)(bi,{field:"enableGeogebra",label:a.importFlow.enableGeogebra,description:a.importFlow.enableGeogebraDesc})}function bk(){let{t:a}=(0,d.b)();return(0,b.jsx)(bi,{field:"confirmBeforeImport",label:a.importFlow.confirmBeforeImport,description:a.importFlow.confirmBeforeImportDesc})}var bl=a.i(249479);function bm(){let{t:a}=(0,d.b)(),[e,g]=(0,c.useState)(String(bl.z)),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(null),q=Number(e),r=""!==e.trim()&&Number.isInteger(q)&&q>=bl.P&&q<=bl.o,s=(0,c.useCallback)(async()=>{l(!0),p(null);try{let a=(await f.k.get("/api/user")).masteryThreshold??bl.z;g(String(a)),j(a)}catch(b){p(a.mastery.thresholdLoadFailed),h.V.error("[Settings]","加载已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{l(!1)}},[a.mastery.thresholdLoadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{if(r&&null!==i){n(!0),p(null);try{let b=(await f.k.patch("/api/user",{masteryThreshold:q})).masteryThreshold??q;j(b),g(String(b)),p(a.importFlow.preferenceSaved)}catch(b){p(a.importFlow.preferenceSaveFailed),h.V.error("[Settings]","保存已掌握阈值失败",{error:b instanceof Error?b.message:String(b)})}finally{n(!1)}}};return(0,b.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,b.jsx)(am.f,{htmlFor:"mastery-threshold",children:a.mastery.thresholdLabel}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)(al.f,{id:"mastery-threshold",type:"number",min:bl.P,max:bl.o,step:1,value:e,onChange:a=>{g(a.target.value),p(null)},disabled:k||m||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,b.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,b.jsxs)(y.f,{type:"button",size:"sm",variant:"outline",onClick:t,disabled:k||m||null===i||!r||q===i,children:[(k||m)&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.importFlow.saveThreshold]}),!k&&null===i&&(0,b.jsx)(y.f,{type:"button",size:"sm",variant:"outline",onClick:s,children:a.importFlow.retryLoad})]}),(0,b.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:a.mastery.thresholdDescription}),null!==i&&!r&&(0,b.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:a.mastery.thresholdInvalid}),o&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:o})]})}var bn=a.i(393045);function bo(){let{t:a}=(0,d.b)(),[e,i]=(0,c.useState)({gradeRecognitionMode:"fixed",fixedGradeSemester:null}),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(!0),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),r=(0,c.useRef)(0),s=(0,c.useCallback)(async()=>{let b=++r.current;m(!0),q(null);try{let a=await f.k.get("/api/user");if(b!==r.current)return;let c={gradeRecognitionMode:a.gradeRecognitionMode??"fixed",fixedGradeSemester:a.fixedGradeSemester??null};i(c),k(c)}catch(c){if(b!==r.current)return;q(a.questionGrade.loadFailed),h.V.error("[QuestionGradeSetting]","加载录入年级规则失败",{error:(0,g.Z)(c)})}finally{b===r.current&&m(!1)}},[a.questionGrade.loadFailed]);(0,c.useEffect)(()=>{s()},[s]);let t=async()=>{o(!0),q(null);try{let b=await f.k.patch("/api/user",e),c={gradeRecognitionMode:b.gradeRecognitionMode??e.gradeRecognitionMode,fixedGradeSemester:b.fixedGradeSemester??null};i(c),k(c),q(a.importFlow.preferenceSaved)}catch(b){q(a.importFlow.preferenceSaveFailed),h.V.error("[QuestionGradeSetting]","保存录入年级规则失败",{error:(0,g.Z)(b)})}finally{o(!1)}},u=l||n||null===j,v=j?.gradeRecognitionMode===e.gradeRecognitionMode&&j?.fixedGradeSemester===e.fixedGradeSemester;return(0,b.jsxs)("div",{className:"space-y-3 border-t pt-4",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{htmlFor:"question-grade-mode",children:a.questionGrade.label}),(0,b.jsxs)("select",{id:"question-grade-mode",value:e.gradeRecognitionMode,disabled:u,onChange:a=>{i({...e,gradeRecognitionMode:a.target.value}),q(null)},className:"h-10 w-full rounded-md border border-input bg-background px-3 text-sm disabled:opacity-50",children:[(0,b.jsx)("option",{value:"fixed",children:a.questionGrade.fixed}),(0,b.jsx)("option",{value:"ai",children:a.questionGrade.ai})]})]}),"fixed"===e.gradeRecognitionMode&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{htmlFor:"question-fixed-grade",children:a.editor.gradeSemester}),(0,b.jsx)(bn.f,{id:"question-fixed-grade",value:e.fixedGradeSemester??"",disabled:u,onChange:a=>{i({...e,fixedGradeSemester:a||null}),q(null)}})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"fixed"===e.gradeRecognitionMode?a.questionGrade.fixedDescription:a.questionGrade.aiDescription}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.questionGrade.description}),(0,b.jsxs)(y.f,{type:"button",variant:"outline",size:"sm",disabled:u||v,onClick:t,children:[(l||n)&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a.questionGrade.save]}),!l&&null===j&&(0,b.jsx)(y.f,{type:"button",variant:"outline",size:"sm",onClick:s,children:a.importFlow.retryLoad}),p&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:p})]})}function bp(){let{t:a}=(0,d.b)();return(0,b.jsx)(bi,{field:"enableSvgAnimation",label:a.importFlow.enableSvgAnimation,description:a.importFlow.enableSvgAnimationDesc})}function bq({value:a,onChange:c,disabled:e}){let{t:f}=(0,d.b)();return(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(am.f,{htmlFor:"app-time-zone",children:f.settings.general.timeZoneLabel}),(0,b.jsx)(al.f,{id:"app-time-zone",value:a,onChange:a=>c(a.target.value),disabled:e,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,b.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:f.settings.general.timeZoneDesc})]})}function br({config:a,setConfig:c,isAdmin:e,disabled:f}){let{t:g,language:h,setLanguage:i}=(0,d.b)(),{timeZone:j}=(0,v.M)(),k=a=>c(b=>({...b,timeouts:{...b.timeouts,analyze:1e3*a}}));return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:g.settings?.language||"Language"}),(0,b.jsxs)(aL.d,{value:h,onValueChange:a=>i(a),children:[(0,b.jsx)(aL.P,{children:(0,b.jsx)(aL.U,{})}),(0,b.jsxs)(aL.r,{children:[(0,b.jsx)(aL.T,{value:"zh",children:"中文 (Chinese)"}),(0,b.jsx)(aL.T,{value:"en",children:"English"})]})]})]}),(0,b.jsx)(bq,{value:a.timeZone??j,onChange:a=>c(b=>({...b,timeZone:a})),disabled:!e||f}),e&&(0,b.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,b.jsx)(am.f,{children:g.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,b.jsx)(al.f,{type:"number",value:a.timeouts?.analyze?a.timeouts.analyze/1e3:"",onChange:a=>{let b=""===a.target.value?0:parseInt(a.target.value);k(isNaN(b)?0:b)},onBlur:()=>{let b=(a.timeouts?.analyze||0)/1e3,c=Math.min(600,Math.max(120,b));c!==b&&k(c)},min:120,max:600}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:g.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,b.jsx)(bk,{}),(0,b.jsx)(bo,{}),(0,b.jsx)(bp,{}),(0,b.jsx)(bj,{}),(0,b.jsx)(bh.f,{}),(0,b.jsx)(bm,{})]})}var bs=a.i(403512),bt=a.i(591119),bu=a.i(481132);function bv(){let{t:a}=(0,d.b)(),{groups:e,loading:g,refetch:i}=(0,bu.f)(),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(!1),n=async()=>{let b=j.trim();if(b){m(!0);try{await f.k.post("/api/paper-groups",{name:b}),k(""),L.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to add group",{error:b}),L.c.error(a.common?.messages?.saveFailed||"Failed to save")}finally{m(!1)}}},o=async(b,c)=>{let d=window.prompt(a.settings?.paperGroups?.renamePrompt||"Rename group",c);if(d&&d.trim()!==c)try{await f.k.patch(`/api/paper-groups/${b}`,{name:d.trim()}),L.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to rename group",{error:b}),L.c.error(a.common?.messages?.saveFailed||"Failed to save")}},p=async(b,c)=>{try{await f.k.patch(`/api/paper-groups/${b}`,{isActive:!c}),L.c.success(a.common?.messages?.saveSuccess||"Saved"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to toggle group",{error:b}),L.c.error(a.common?.messages?.saveFailed||"Failed to save")}},q=async(b,c,d)=>{if(d>0){let e=(a.settings?.paperGroups?.deleteConfirmWithItems||'Group "{name}" has {count} questions. Deleting will clear their group assignment. Continue?').replace("{name}",c).replace("{count}",String(d));if(!await (0,L.u)(e,{destructive:!0}))return;try{await f.k.delete(`/api/paper-groups/${b}?clear=true`),L.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),L.c.error(a.common?.messages?.deleteFailed||"Delete failed")}return}let e=(a.settings?.paperGroups?.deleteConfirm||'Delete group "{name}"?').replace("{name}",c);if(await (0,L.u)(e,{destructive:!0}))try{await f.k.delete(`/api/paper-groups/${b}`),L.c.success(a.common?.messages?.deleteSuccess||"Deleted"),i()}catch(b){h.V.error("[PaperGroupSettings]","Failed to delete group",{error:b}),L.c.error(a.common?.messages?.deleteFailed||"Delete failed")}};return g?(0,b.jsx)(bt.N,{children:(0,b.jsx)(bt.O,{className:"py-12 flex items-center justify-center",children:(0,b.jsx)(x.f,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):(0,b.jsxs)(bt.N,{children:[(0,b.jsxs)(bt.Y,{children:[(0,b.jsxs)(bt.v,{className:"flex items-center gap-2 text-lg",children:[(0,b.jsx)(E.f,{className:"h-5 w-5"}),a.settings?.paperGroups?.title||"Paper Groups"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:a.settings?.paperGroups?.desc||"Customize paper groups like Unit Test, Midterm, Final. Default groups A/B/Other can be renamed but not deleted."})]}),(0,b.jsxs)(bt.O,{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsx)(al.f,{value:j,onChange:a=>k(a.target.value),placeholder:a.settings?.paperGroups?.addPlaceholder||"e.g. Unit Test",onKeyDown:a=>{"Enter"===a.key&&n()}}),(0,b.jsxs)(y.f,{onClick:n,disabled:l||!j.trim(),children:[l?(0,b.jsx)(x.f,{className:"h-4 w-4 animate-spin"}):(0,b.jsx)(bs.f,{className:"h-4 w-4 mr-1"}),a.common?.add||"Add"]})]}),(0,b.jsx)("div",{className:"space-y-2",children:e.map(c=>(0,b.jsxs)("div",{className:`flex items-center justify-between rounded-lg border p-3 ${!c.isActive?"opacity-50":""}`,children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("span",{className:"font-medium",children:c.name}),c.key&&(0,b.jsx)(aj.f,{variant:"secondary",className:"text-xs",children:a.settings?.paperGroups?.systemBadge||"Default"}),!c.isActive&&(0,b.jsx)(aj.f,{variant:"outline",className:"text-xs",children:a.common?.inactive||"Inactive"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>o(c.id,c.name),children:a.common?.rename||"Rename"}),(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:()=>p(c.id,c.isActive),children:c.isActive?a.common?.deactivate||"Deactivate":a.common?.activate||"Activate"}),!c.key&&(0,b.jsx)(y.f,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>q(c.id,c.name,c._count?.errorItems||0),children:(0,b.jsx)(at.f,{className:"h-4 w-4"})})]})]},c.id))})]})]})}var bw=a.i(429246);let bx="[REDACTED]",by=/api[-_]?key|password|passwd|secret|authorization|cookie|credential|private[-_]?key|^(access|refresh|id|auth|api|bearer|session|csrf|setup)?[-_]?token$/i,bz=Symbol.for("wrong-notebook.debug-log");function bA(){let a=globalThis,b=a[bz];return b||(b={enabledAt:null,entries:[],totalSize:0,dropped:0},a[bz]=b),b}function bB(a){let b=a.replace(/data:([\w.+-]+\/[\w.+-]+);base64,[A-Za-z0-9+/=]+/g,(a,b)=>`[data:${b}, ${a.length} chars]`).replace(/(Bearer\s+)[\w\-.~+/]+=*/gi,`$1${bx}`).replace(/\bsk-[A-Za-z0-9_-]{8,}/g,bx).replace(/([?&](?:key|api_key|apikey|token|access_token)=)[^&\s"']+/gi,`$1${bx}`);return b.length>1e4&&(b=`${b.slice(0,1e4)}…[truncated ${b.length-1e4} chars]`),b}function bC(a,b,c,d=new Date){if(function(a=Date.now()){let b=bA();return null!==b.enabledAt&&(!(a-b.enabledAt>=864e5)||(b.enabledAt=null,!1))}(d.getTime()))try{let e={...function a(b,c=0,d=new WeakSet){if(null==b)return b;if("string"==typeof b)return bB(b);if("number"==typeof b||"boolean"==typeof b)return b;if("bigint"==typeof b)return b.toString();if("function"==typeof b||"symbol"==typeof b)return String(b);if(b instanceof Date)return b.toISOString();if(b instanceof Error){let e={name:b.name,message:bB(b.message)};return b.stack&&(e.stack=bB(b.stack)),void 0!==b.code&&(e.code=a(b.code,c+1,d)),void 0!==b.status&&(e.status=a(b.status,c+1,d)),void 0!==b.cause&&c<8&&(e.cause=a(b.cause,c+1,d)),e}if("object"!=typeof b)return String(b);if(d.has(b))return"[Circular]";if(c>=8)return"[Object]";if(d.add(b),Array.isArray(b)){let e=b.slice(0,100).map(b=>a(b,c+1,d));return b.length>100&&e.push(`…[${b.length-100} more items]`),e}return ArrayBuffer.isView(b)||b instanceof ArrayBuffer?`[Binary ${b.byteLength} bytes]`:Object.fromEntries(Object.entries(b).map(([b,e])=>[b,by.test(b)&&null!=e&&""!==e?bx:a(e,c+1,d)]))}(b),time:d.toISOString(),level:a,msg:bB(c)},f=JSON.stringify(e).length,g=bA();for(g.entries.push({entry:e,size:f}),g.totalSize+=f;g.entries.length>5e3||g.totalSize>0x1400000&&g.entries.length>1;){let a=g.entries.shift();if(!a)break;g.totalSize-=a.size,g.dropped+=1}}catch{}}let bD={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function bE(a,b={}){let c,d=bD[a],e=(c=process.env.LOG_LEVEL?.toLowerCase())&&void 0!==bD[c]?bD[c]:bD.info;return(c,f)=>{let g,h,i=new Date;if("string"==typeof c?(g={},h=c):(g=c,h=f||""),bC(a,{...b,...g},h,i),!(d<e)){let c=JSON.stringify({level:a,time:i.toISOString(),...b,...g,msg:h});switch(a){case"error":case"fatal":console.error(c);break;case"warn":console.warn(c);break;default:console.log(c)}}}}(function a(b={}){return b.module,{trace:bE("trace",b),debug:bE("debug",b),info:bE("info",b),warn:bE("warn",b),error:bE("error",b),fatal:bE("fatal",b),child:c=>a({...b,...c}),box:(a,c,d="📋")=>{bC("info",{...b,..."string"==typeof c?{content:c}:c},a);{let d="string"==typeof c?{content:c}:c||{};console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...b,title:a,...d,msg:a}));return}},divider:(a="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let bF=`填写题目类型,只能是以下 key 之一:single_choice(单选题)、multiple_choice(多选题)、true_false(判断题)、fill_blank(填空题)、calculation(计算题)、solution(解答题)、reading(阅读理解)、cloze(完形填空)、writing(写作)、other(其他)。
2
+ 若题型不明确,填 other。`,bG=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
3
3
  - 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
4
4
  - 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
5
5
  - 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
6
6
  - 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
7
7
  - 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
8
- 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,bs=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
8
+ 非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,bH=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
9
9
  - 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
10
10
  - 按原图比例和相对位置绘制,保留原题印刷标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18);必须过滤掉人在图上手写的草稿、演算、思考批注、圈画和涂改痕迹。
11
11
  - 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
12
- - 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,bt=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
12
+ - 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,bI=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
13
13
  - 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
14
14
  - 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
15
15
  - 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
16
16
  - 公式中的中文写在 \text{...} 里,或放到公式外;百分号写成 \%,美元符号写成 \$。
17
- - 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,bu=`【角色与核心任务 (ROLE AND CORE TASK)】
17
+ - 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,bJ=`【角色与核心任务 (ROLE AND CORE TASK)】
18
18
  你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
19
19
 
20
20
  {{language_instruction}}
@@ -42,7 +42,7 @@ module.exports=[418175,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(55
42
42
 
43
43
  <figure_svg>
44
44
  如果 has_figure 为 true,用 SVG 重新绘制题目配图:
45
- ${bs}
45
+ ${bH}
46
46
  如果 has_figure 为 false,请留空。
47
47
  </figure_svg>
48
48
 
@@ -56,11 +56,11 @@ ${bs}
56
56
 
57
57
  <difficulty_stars>
58
58
  只填写 1 到 5 之间的一个整数,表示题目难度星级。
59
- ${br}
59
+ ${bG}
60
60
  </difficulty_stars>
61
61
 
62
62
  <question_type>
63
- ${bq}
63
+ ${bF}
64
64
  </question_type>
65
65
 
66
66
  <mistake_analysis>
@@ -137,10 +137,10 @@ ${bq}
137
137
  3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
138
138
  4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
139
139
  5. **LaTeX 规范**:
140
- ${bt}
140
+ ${bI}
141
141
 
142
142
  {{grade_instruction}}
143
- {{provider_hints}}`,bv=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
143
+ {{provider_hints}}`,bK=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
144
144
  ### 角色定义
145
145
  1. **学科全能专家**
146
146
  - 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
@@ -192,9 +192,9 @@ ${bt}
192
192
  ###关键格式与内容约束 (CRITICAL RULES) !!!
193
193
  1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
194
194
  2. **LaTeX 规范**:
195
- ${bt}
195
+ ${bI}
196
196
 
197
197
  {{grade_instruction}}
198
- {{provider_hints}}`;var bw=a.i(62832);bw.I.join("、"),bw.r.join("、");var bx=a.i(533838);function by({name:a,description:c}){return(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,b.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${a}}}`}),(0,b.jsx)("span",{className:"text-muted-foreground",children:c})]})}function bz(){let{t:a}=(0,d.b)();return(0,b.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-900 rounded-md p-3 flex items-start gap-3 text-amber-900 dark:text-amber-200 text-sm mb-4",children:[(0,b.jsx)(J.f,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"font-medium",children:a.settings?.prompts?.caution||"Modify with Caution"}),(0,b.jsx)("p",{className:"text-amber-800/90 dark:text-amber-200 text-xs",children:a.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function bA({config:a,onUpdate:c}){let{t:e}=(0,d.b)(),f=a.prompts?.analyze||bu,g=a.prompts?.similar||bv,h=async a=>{await (0,F.u)(e.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&c(a,"analyze"===a?bu:bv)},i=(a,b)=>{c(a,b)};return(0,b.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,b.jsxs)(Y.i,{defaultValue:"analyze",className:"w-full",children:[(0,b.jsxs)(Y.U,{className:"grid w-full grid-cols-2",children:[(0,b.jsx)(Y.k,{value:"analyze",children:e.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,b.jsx)(Y.k,{value:"similar",children:e.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,b.jsx)(Y.S,{value:"analyze",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(ab.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>h("analyze"),children:[(0,b.jsx)(bx.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bz,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(O,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(by,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,b.jsx)(by,{name:"knowledge_points_list",description:e.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,b.jsx)(by,{name:"provider_hints",description:e.settings?.prompts?.vars?.providerHints||"Provider compatibility hints that follow the application output contract."})]})]}),(0,b.jsx)(bh.f,{value:f,onChange:a=>i("analyze",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bu})]})}),(0,b.jsx)(Y.S,{value:"similar",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(ab.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,b.jsxs)(W.f,{variant:"outline",size:"sm",onClick:()=>h("similar"),children:[(0,b.jsx)(bx.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bz,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(O,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(by,{name:"difficulty_level",description:e.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,b.jsx)(by,{name:"difficulty_instruction",description:e.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,b.jsx)(by,{name:"original_question",description:e.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,b.jsx)(by,{name:"knowledge_points",description:e.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,b.jsx)(by,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,b.jsx)(bh.f,{value:g,onChange:a=>i("similar",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bv})]})})]})})}var bB=a.i(738835),bC=a.i(676330),bD=a.i(206194),bE=a.i(190622),bF=a.i(975484);let bG=["browser","minimax","qwen","glm","stepfun","volcengine","volcengine-agent","openai"];bG.filter(a=>"browser"!==a);let bH={minimax:{model:"speech-2.8-hd",voice:"male-qn-jingying"},qwen:{model:"qwen-audio-3.0-tts-plus",voice:"longanlufeng"},glm:{model:"glm-tts",voice:"xiaochen"},stepfun:{model:"stepaudio-2.5-tts",voice:"qingniandaxuesheng"},volcengine:{model:"seed-tts-2.0",voice:"zh_male_yangguangqingnian_uranus_bigtts"},"volcengine-agent":{model:"seed-tts-2.0",voice:"zh_male_yangguangqingnian_uranus_bigtts"},openai:{model:"gpt-4o-mini-tts",voice:"cedar"}},bI={minimax:{apiKey:"https://platform.minimax.cn/docs/guides/quickstart-preparation",model:"https://platform.minimax.cn/docs/api-reference/speech-t2a-http",voice:"https://platform.minimax.cn/docs/faq/system-voice-id",endpoint:"https://platform.minimax.cn/docs/api-reference/speech-t2a-http"},qwen:{apiKey:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",model:"https://help.aliyun.com/zh/model-studio/non-realtime-tts-user-guide",voice:"https://help.aliyun.com/zh/model-studio/qwen-audio-tts-voice-list",endpoint:"https://help.aliyun.com/zh/model-studio/non-realtime-tts-user-guide"},glm:{apiKey:"https://docs.bigmodel.cn/cn/guide/start/quick-start",model:"https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3",voice:"https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3",endpoint:"https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3"},stepfun:{apiKey:"https://platform.stepfun.com/docs/zh/step-plan/integrations/audio-api",model:"https://platform.stepfun.com/docs/zh/api-reference/audio/create-audio",voice:"https://platform.stepfun.com/docs/zh/guides/developer/tts",endpoint:"https://platform.stepfun.com/docs/zh/api-reference/audio/create-audio"},volcengine:{apiKey:"https://www.volcengine.com/docs/6561/196768",model:"https://www.volcengine.com/docs/6561/1598757",voice:"https://www.volcengine.com/docs/6561/1257544",endpoint:"https://www.volcengine.com/docs/6561/1598757"},openai:{apiKey:"https://platform.openai.com/docs/quickstart",model:"https://developers.openai.com/api/docs/guides/text-to-speech",voice:"https://developers.openai.com/api/docs/guides/text-to-speech",endpoint:"https://developers.openai.com/api/docs/guides/text-to-speech"},"volcengine-agent":{apiKey:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",model:"https://docs.volcengine.com/docs/ark/agent-plan-personal-voice-model?lang=zh",voice:"https://www.volcengine.com/docs/6561/1257544",endpoint:"https://docs.volcengine.com/docs/ark/agent-plan-personal-voice-model?lang=zh"}},bJ={volcengine:"https://docs.volcengine.com/docs/ark/free-inference-quota?lang=zh"};function bK({config:a,setConfig:e,saving:i,onSave:j}){var k;let{t:l,language:m}=(0,d.b)(),n=l.settings.tts,[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(null),s=a.tts?.mode??"browser",t="browser"!==s&&"string"==typeof(k=s)&&bG.includes(k)?s:null,u=t?a.tts?.[t]:void 0,v=(a,b)=>{t&&e(c=>({...c,tts:{...c.tts,[t]:{...c.tts?.[t],[a]:b}}}))},w=!!t&&("volcengine"===t||"openai"===t),x=t?function(a,b){if("openai"===b){let b=a.openai?.instances?.find(b=>b.id===a.openai?.activeInstanceId);return b?{apiKey:b.apiKey,baseUrl:b.baseUrl}:void 0}return a[b]}(a,t):void 0,y=w?u?.apiKey:x?.apiKey,z=async()=>{(0,bF.p)(),p(!0),r(null);try{await j();let{id:a,version:b}=await f.k.post("/api/tts",{text:n.previewText,language:m},{timeout:12e4,recoverable:!0}),c=(0,bF.l)();if(!c)return;c.src=`/api/tts/${a}?v=${b}`,c.playbackRate=1,await c.play()}catch(b){h.V.error("[TtsSettings]","Preview failed",{error:b});let a=(0,g.d)(b);F.c.error("TTS_NOT_CONFIGURED"===a?n.notConfigured:"TTS_PROVIDER_ERROR"===a?n.providerError:n.previewFailed),r((0,g.L)(b)??null)}finally{p(!1)}};return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(ab.f,{children:n.title}),(0,b.jsxs)(aA.d,{value:s,onValueChange:a=>e(b=>({...b,tts:{...b.tts,mode:a}})),children:[(0,b.jsx)(aA.P,{children:(0,b.jsx)(aA.U,{})}),(0,b.jsx)(aA.r,{children:bG.map(a=>(0,b.jsx)(aA.T,{value:a,children:n.modes[a]},a))})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:t?n.cloudHint:n.browserHint})]}),t&&(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[bJ[t]&&(0,b.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:[n.freeTrial," ",(0,b.jsx)("a",{href:bJ[t],target:"_blank",rel:"noopener noreferrer",className:"underline",children:n.freeTrialLink})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bC.f,{label:"openai"===t?"OpenAI API Key":w?n.speechApiKey:`${(0,bE.z)(t,m)} API Key`,href:bI[t].apiKey,linkText:l.settings.ai.docLinks.apiKey}),(0,b.jsx)(az.f,{value:y||"",onChange:a=>{var b;return b=a.target.value,void(t&&(w?v("apiKey",b):e(a=>({...a,[t]:{...a[t],apiKey:b}}))))},placeholder:"qwen"===t?"sk-sp-...":w?"":"sk-..."}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n.apiKeyHint[t]})]}),(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bC.f,{label:n.model,href:bI[t].model,linkText:n.docs}),(0,b.jsx)(aa.f,{value:u?.model||"",onChange:a=>v("model",a.target.value),placeholder:bH[t].model})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bC.f,{label:n.voice,href:bI[t].voice,linkText:n.voiceList}),(0,b.jsx)(aa.f,{value:u?.voice||"",onChange:a=>v("voice",a.target.value),placeholder:bH[t].voice})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n.voiceHint[t]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bC.f,{label:n.endpoint,href:bI[t].endpoint,linkText:n.docs}),(0,b.jsx)(aa.f,{value:u?.endpoint||"",onChange:a=>v("endpoint",a.target.value),placeholder:function(a,b){if("volcengine"===a)return"https://openspeech.bytedance.com/api/v3/tts/unidirectional";if("volcengine-agent"===a)return"https://openspeech.bytedance.com/api/v3/plan/tts/unidirectional";if("openai"===a)return`${(b?.baseUrl||"https://api.openai.com/v1").replace(/\/+$/,"")}/audio/speech`;let{baseUrl:c}=(0,bE.k)(a,b);if("minimax"===a)return`${c.replace(/\/+$/,"")}/t2a_v2`;if("glm"===a||"stepfun"===a)return`${c.replace(/\/+$/,"")}/audio/speech`;try{return`${new URL(c).origin}/api/v1/services/audio/tts/SpeechSynthesizer`}catch{return""}}(t,x)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n.endpointHint})]})]},t),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[t&&(0,b.jsxs)(W.f,{variant:"outline",onClick:z,disabled:i||o,className:"sm:w-auto",children:[o?(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(bB.f,{className:"mr-2 h-4 w-4"}),n.preview]}),(0,b.jsxs)(W.f,{onClick:()=>void j(),disabled:i||o,className:"flex-1",children:[i&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.save]})]}),t&&q&&(0,b.jsx)("div",{className:"rounded-md border border-red-200 bg-red-50 p-2 dark:border-red-900 dark:bg-red-950/40",children:(0,b.jsx)(bD.f,{detail:q})})]})}var bL=a.i(439830);function bM({value:a,icon:c,label:d}){return(0,b.jsxs)(Y.k,{value:a,className:"px-2 sm:px-3",children:[c,(0,b.jsx)("span",{className:"hidden sm:inline",children:d})]})}function bN(){let{setTimeZone:a}=(0,v.M)(),{data:g}=(0,e.useSession)(),i=g?.user?.role==="admin",j=g?.user?.id??"",{t:k}=(0,d.b)(),l=(0,y.useRouter)(),[m,n]=(0,c.useState)(!1),o=(0,c.useRef)(null),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)({aiProvider:"minimax"}),w=(0,c.useCallback)(async()=>{s(!0);try{u(await f.k.get("/api/settings"))}catch(a){h.V.error("[SettingsDialog]","Failed to fetch settings",{error:a})}finally{s(!1)}},[]);(0,c.useEffect)(()=>{m&&w()},[m,w]);let x=async()=>{let b=(0,bL.f)(t,k);if(b)return void F.c.error(b);q(!0);try{let b=await f.k.post("/api/settings",t);u(b),a(b.timeZone||Z.J),F.c.success(k.settings?.messages?.saved||"Settings saved"),o.current?.scrollTo({top:0,behavior:"smooth"})}catch(a){h.V.error("[SettingsDialog]","Failed to save settings",{error:a}),F.c.error(k.settings?.messages?.saveFailed||"Failed to save")}finally{q(!1)}},z=a=>(0,b.jsxs)(W.f,{onClick:x,disabled:p,className:"w-full",children:[p&&(0,b.jsx)(D.f,{className:"mr-2 h-4 w-4 animate-spin"}),a]});return(0,b.jsxs)(X.N,{open:m,onOpenChange:n,children:[(0,b.jsx)(X.a,{asChild:!0,children:(0,b.jsxs)(W.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(T,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:k.settings?.title||"Settings"})]})}),(0,b.jsxs)(X.d,{ref:o,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(X.s,{children:[(0,b.jsx)(X.F,{children:k.settings?.title||"Settings"}),(0,b.jsx)(X.C,{children:k.settings?.desc||"Manage your preferences and data."})]}),(0,b.jsxs)(Y.i,{defaultValue:"general",className:"w-full",children:[(0,b.jsxs)(Y.U,{className:`grid w-full grid-cols-4 ${i?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,b.jsx)(bM,{value:"general",icon:(0,b.jsx)(P.f,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.general||"General"}),(0,b.jsx)(bM,{value:"account",icon:(0,b.jsx)(U.f,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.account||"Account"}),i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(bM,{value:"ai",icon:(0,b.jsx)(M,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.ai||"AI Provider"}),(0,b.jsx)(bM,{value:"prompts",icon:(0,b.jsx)(R,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.prompts||"Prompts"}),(0,b.jsx)(bM,{value:"admin",icon:(0,b.jsx)(C,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.admin||"User Management"})]}),(0,b.jsx)(bM,{value:"danger",icon:(0,b.jsx)(J.f,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.danger||"Danger"}),(0,b.jsx)(bM,{value:"about",icon:(0,b.jsx)(O,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.about||"About"})]}),(0,b.jsxs)(Y.S,{value:"general",className:"space-y-4 py-4",children:[(0,b.jsx)(bb,{config:t,setConfig:u,isAdmin:i,disabled:r||p}),(0,b.jsx)(bg,{}),i&&z(k.settings?.save||"Save Settings")]}),(0,b.jsx)(Y.S,{value:"account",className:"space-y-4 py-4",children:(0,b.jsx)(aD,{})}),(0,b.jsxs)(Y.S,{value:"ai",className:"space-y-4 py-4",children:[(0,b.jsx)(aE.f,{config:t,setConfig:u,loading:r,saving:p,onSave:x}),!r&&(0,b.jsx)(bK,{config:t,setConfig:u,saving:p,onSave:x})]}),(0,b.jsxs)(Y.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,b.jsx)(bA,{config:t,onUpdate:(a,b)=>u(c=>({...c,prompts:{...c.prompts,[a]:b}}))}),z(k.settings?.prompts?.save||"Save Prompt Settings")]}),i&&(0,b.jsxs)(Y.S,{value:"admin",className:"space-y-4 py-4",children:[(0,b.jsxs)(W.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{n(!1),l.push("/admin")},children:[(0,b.jsx)(K.f,{className:"h-4 w-4"}),k.admin?.dashboard?.title||"Admin Dashboard"]}),(0,b.jsxs)(W.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{n(!1),l.push("/setup")},children:[(0,b.jsx)(V.f,{className:"h-4 w-4"}),k.setup.rerun]}),(0,b.jsx)(a0,{}),(0,b.jsx)(aP,{}),(0,b.jsx)("div",{className:"border-t pt-4",children:(0,b.jsx)(an,{})})]}),(0,b.jsx)(Y.S,{value:"danger",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(aY,{isAdmin:i,userId:j}),(0,b.jsx)(aT,{isAdmin:i})]})}),(0,b.jsx)(Y.S,{value:"about",className:"space-y-4 py-4",children:(0,b.jsx)(ay,{})})]})]})]})}var bO=a.i(505004);let bP={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};bP.node;let bQ=(0,A.f)(bP),bR={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};bR.node;let bS=(0,A.f)(bR);var bT=a.i(335732);let bU={system:bO.f,light:bS,dark:bQ};function bV(){let{t:a}=(0,d.b)(),{preference:e,setPreference:f}=(0,c.useContext)(m),g=bU[e],h=`${a.theme.toggle}: ${a.theme[e]}`;return(0,b.jsxs)(bT.G,{children:[(0,b.jsx)(bT.X,{asChild:!0,children:(0,b.jsx)(W.f,{variant:"ghost",size:"icon",className:"rounded-full",title:h,"aria-label":h,children:(0,b.jsx)(g,{className:"h-5 w-5"})})}),(0,b.jsx)(bT.L,{align:"end",children:(0,b.jsx)(bT.O,{value:e,onValueChange:a=>{l(a)&&f(a)},children:i.map(c=>{let d=bU[c];return(0,b.jsxs)(bT.T,{value:c,className:"gap-2",children:[(0,b.jsx)(d,{className:"h-4 w-4"}),a.theme[c]]},c)})})})]})}var bW=a.i(895605);let bX={name:"circle-plus",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],aliases:["plus-circle"]};bX.node;let bY=(0,A.f)(bX),bZ=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],b$=[{key:"home",href:"/",icon:bY,match:a=>"/"===a},{key:"notebooks",href:"/notebooks",icon:aF.f,match:a=>a.startsWith("/notebooks")||a.startsWith("/error-items")||a.startsWith("/practice")},{key:"review",href:"/review",icon:bW.f,match:a=>a.startsWith("/review")},{key:"stats",href:"/stats",icon:K.f,match:a=>a.startsWith("/stats")||a.startsWith("/tags")},{key:"exams",href:"/exams",icon:bc.f,match:a=>a.startsWith("/exams")}];function b_({children:a}){var g;let i,j,k=(0,y.usePathname)()||"/",{t:l}=(0,d.b)(),{data:m,status:n}=(0,e.useSession)(),o=m?.user?.role==="admin",p=bZ.some(a=>a.test(k));if(g=o&&!p,i=(0,y.useRouter)(),j=(0,c.useRef)(!1),(0,c.useEffect)(()=>{g&&!j.current&&(j.current=!0,f.k.get("/api/setup").then(a=>{a.needsSetup&&i.replace("/setup")}).catch(a=>h.V.warn("[Setup]","Failed to check setup status",{error:a})))},[g,i]),p||"unauthenticated"===n)return(0,b.jsx)(b.Fragment,{children:a});let q=m?.user?.name||m?.user?.email||"";return(0,b.jsxs)("div",{className:"min-h-screen",children:[(0,b.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,b.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,b.jsxs)(x.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(w.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,b.jsx)("span",{className:"hidden text-base font-semibold tracking-tight sm:inline",children:l.pageTitle.base})]}),(0,b.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:b$.map(a=>{let c=a.match(k),d=a.icon;return(0,b.jsxs)(x.default,{href:a.href,className:(0,H.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)(d,{className:"h-4 w-4"}),l.nav[a.key]]},a.key)})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[q&&(0,b.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,b.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:q.slice(0,1).toUpperCase()}),(0,b.jsx)("span",{className:"truncate",children:q})]}),o&&(0,b.jsx)(x.default,{href:"/admin",title:l.nav.admin,children:(0,b.jsxs)(W.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(C,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:l.nav.admin})]})}),(0,b.jsx)(I,{className:"mr-1"}),(0,b.jsx)(bV,{}),(0,b.jsx)(bN,{}),(0,b.jsx)(W.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,e.signOut)({callbackUrl:"/login"}),title:l.app.logout,children:(0,b.jsx)(z.f,{className:"h-5 w-5"})})]})]})}),(0,b.jsx)("div",{className:"pb-20 md:pb-0",children:a}),(0,b.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,b.jsx)("div",{className:"grid h-16",style:{gridTemplateColumns:`repeat(${b$.length}, minmax(0, 1fr))`},children:b$.map(a=>{let c=a.match(k),d=a.icon;return(0,b.jsxs)(x.default,{href:a.href,className:(0,H.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",c?"text-primary":"text-muted-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)("span",{className:(0,H.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",c&&"bg-accent"),children:(0,b.jsx)(d,{className:"h-5 w-5"})}),l.nav[a.key]]},a.key)})})})]})}let b0={name:"list-todo",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]};b0.node;let b1=(0,A.f)(b0);var b2=a.i(211134),b3=a.i(374161);let b4=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function b5(){let{t:a}=(0,d.b)(),{timeZone:g}=(0,v.M)(),{status:h}=(0,e.useSession)(),i=(0,y.usePathname)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(()=>b3.f.getSnapshot()),[n,o]=(0,c.useState)(()=>Date.now()),p="authenticated"!==h||b4.some(a=>a.test(i||""));if((0,c.useEffect)(()=>{if(!p)return b3.f.subscribe(a=>{m(a),o(Date.now())})},[p]),p)return null;let q=l.filter(a=>"running"===a.status).length,r=l.some(a=>"running"!==a.status),s=async()=>{try{await f.k.delete("/api/tasks"),await b3.f.refresh()}catch{}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(W.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>k(!0),"aria-label":a.backgroundTasks.title,title:a.backgroundTasks.title,children:[q>0?(0,b.jsx)(D.f,{className:"h-5 w-5 animate-spin"}):(0,b.jsx)(b1,{className:"h-5 w-5"}),q>0&&(0,b.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:q})]}),(0,b.jsx)(X.N,{open:j,onOpenChange:k,children:(0,b.jsxs)(X.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,b.jsxs)(X.s,{children:[(0,b.jsx)(X.F,{children:a.backgroundTasks.title}),(0,b.jsx)(X.C,{children:a.backgroundTasks.description})]}),0===l.length?(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a.backgroundTasks.empty}):(0,b.jsx)("ul",{className:"space-y-2",children:l.map(c=>{var d,e;let f;return(0,b.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:["running"===c.status&&(0,b.jsx)(D.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===c.status&&(0,b.jsx)(aU.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===c.status&&(0,b.jsx)(b2.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,b.jsxs)("div",{className:"font-medium",children:[a.backgroundTasks.kinds[c.kind],(0,b.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",a.backgroundTasks.status[c.status]]})]}),c.subject&&(0,b.jsx)("div",{className:"break-words text-muted-foreground",children:c.subject}),c.progress&&c.progress.total>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,b.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(c.progress.done/c.progress.total*100)}%`}})}),(0,b.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.backgroundTasks.progress.replace("{done}",String(c.progress.done)).replace("{total}",String(c.progress.total)),c.progress.failed>0&&` \xb7 ${a.backgroundTasks.failedCount.replace("{count}",String(c.progress.failed))}`]})]}),c.error&&(0,b.jsx)("div",{className:"text-xs text-destructive",children:(b=>{if(!b)return null;let c=a.backgroundTasks.errors[b]??a.errors[b];return"string"==typeof c?c:b})(c.error)}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:a.backgroundTasks.startedAt.replace("{time}",(0,Z.r)(c.startedAt,"HH:mm:ss",g))}),(0,b.jsx)("span",{children:a.backgroundTasks.elapsed.replace("{time}",(d=c.startedAt,e=c.finishedAt,f=Math.max(0,Math.round(((e?Date.parse(e):n)-Date.parse(d))/1e3)),`${Math.floor(f/60)}:${String(f%60).padStart(2,"0")}`))}),c.link&&(0,b.jsx)(x.default,{href:c.link,className:"text-primary hover:underline",onClick:()=>k(!1),children:a.backgroundTasks.view})]})]})]})},c.id)})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.backgroundTasks.retentionHint}),r&&(0,b.jsx)(W.f,{variant:"ghost",size:"sm",onClick:s,children:a.backgroundTasks.clearFinished})]})]})})]})}var b6=a.i(474215);let b7={success:{icon:aU.f,className:"text-success"},error:{icon:b2.f,className:"text-destructive"},warning:{icon:J.f,className:"text-warning"},info:{icon:O,className:"text-primary"}};function b8(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)([]),[g,h]=(0,c.useState)(null);return(0,c.useEffect)(()=>(0,F.M)(a=>{f(a.toasts),h(a.confirm)}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:e.map(c=>{let{icon:d,className:e}=b7[c.type];return(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,b.jsx)(d,{className:(0,H.f)("mt-0.5 h-4 w-4 shrink-0",e)}),(0,b.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:c.message}),(0,b.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,F.p)(c.id),"aria-label":a.common.close,children:(0,b.jsx)(b6.X,{className:"h-3.5 w-3.5"})})]},c.id)})}),(0,b.jsx)(X.N,{open:!!g,onOpenChange:a=>{a||g?.resolve(!1)},children:(0,b.jsxs)(X.d,{className:"sm:max-w-md",children:[(0,b.jsxs)(X.s,{children:[(0,b.jsxs)(X.F,{className:"flex items-center gap-2",children:[g?.destructive&&(0,b.jsx)(J.f,{className:"h-5 w-5 text-destructive"}),g?.title||a.common.confirmTitle]}),(0,b.jsx)(X.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:g?.message})]}),(0,b.jsxs)(X.c,{className:"gap-2",children:[(0,b.jsx)(W.f,{variant:"outline",onClick:()=>g?.resolve(!1),children:g?.cancelText||a.common.cancel}),(0,b.jsx)(W.f,{variant:g?.destructive?"destructive":"default",onClick:()=>g?.resolve(!0),autoFocus:!0,children:g?.confirmText||a.common.confirm})]})]})})]})}function b9(){return(0,c.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(a=>{h.V.warn("[PWA]","Service worker registration failed",{error:String(a)})})},[]),null}a.s(["Providers",0,function({children:a,timeZone:f}){return(0,c.useEffect)(()=>(0,h.m)(),[]),(0,b.jsx)(e.SessionProvider,{children:(0,b.jsx)(u,{children:(0,b.jsx)(d.w,{children:(0,b.jsxs)(v.n,{initialTimeZone:f,children:[(0,b.jsx)(b_,{children:a}),(0,b.jsx)(b5,{}),(0,b.jsx)(b8,{}),(0,b.jsx)(b9,{})]})})})})}],418175)}];
198
+ {{provider_hints}}`;var bL=a.i(62832);bL.I.join("、"),bL.r.join("、");var bM=a.i(533838);function bN({name:a,description:c}){return(0,b.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,b.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${a}}}`}),(0,b.jsx)("span",{className:"text-muted-foreground",children:c})]})}function bO(){let{t:a}=(0,d.b)();return(0,b.jsxs)("div",{className:"bg-amber-50 dark:bg-amber-950/40 border border-amber-200 dark:border-amber-900 rounded-md p-3 flex items-start gap-3 text-amber-900 dark:text-amber-200 text-sm mb-4",children:[(0,b.jsx)(X.f,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("p",{className:"font-medium",children:a.settings?.prompts?.caution||"Modify with Caution"}),(0,b.jsx)("p",{className:"text-amber-800/90 dark:text-amber-200 text-xs",children:a.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function bP({config:a,onUpdate:c}){let{t:e}=(0,d.b)(),f=a.prompts?.analyze||bJ,g=a.prompts?.similar||bK,h=async a=>{await (0,L.u)(e.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&c(a,"analyze"===a?bJ:bK)},i=(a,b)=>{c(a,b)};return(0,b.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,b.jsxs)(ah.i,{defaultValue:"analyze",className:"w-full",children:[(0,b.jsxs)(ah.U,{className:"grid w-full grid-cols-2",children:[(0,b.jsx)(ah.k,{value:"analyze",children:e.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,b.jsx)(ah.k,{value:"similar",children:e.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,b.jsx)(ah.S,{value:"analyze",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(am.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>h("analyze"),children:[(0,b.jsx)(bM.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bO,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(_,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(bN,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,b.jsx)(bN,{name:"knowledge_points_list",description:e.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,b.jsx)(bN,{name:"provider_hints",description:e.settings?.prompts?.vars?.providerHints||"Provider compatibility hints that follow the application output contract."})]})]}),(0,b.jsx)(bw.f,{value:f,onChange:a=>i("analyze",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bJ})]})}),(0,b.jsx)(ah.S,{value:"similar",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex justify-between items-center",children:[(0,b.jsx)(am.f,{className:"text-base font-semibold",children:e.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,b.jsxs)(y.f,{variant:"outline",size:"sm",onClick:()=>h("similar"),children:[(0,b.jsx)(bM.f,{className:"w-4 h-4 mr-2"}),e.settings?.prompts?.reset||"Reset Default"]})]}),(0,b.jsx)(bO,{}),(0,b.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,b.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,b.jsx)(_,{className:"h-3.5 w-3.5"}),e.settings?.prompts?.variables||"Available Variables"]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(bN,{name:"difficulty_level",description:e.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,b.jsx)(bN,{name:"difficulty_instruction",description:e.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,b.jsx)(bN,{name:"original_question",description:e.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,b.jsx)(bN,{name:"knowledge_points",description:e.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,b.jsx)(bN,{name:"language_instruction",description:e.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,b.jsx)(bw.f,{value:g,onChange:a=>i("similar",a.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:bK})]})})]})})}var bQ=a.i(738835),bR=a.i(676330),bS=a.i(206194),bT=a.i(190622),bU=a.i(975484);let bV=["browser","minimax","qwen","glm","stepfun","volcengine","volcengine-agent","openai"];bV.filter(a=>"browser"!==a);let bW={minimax:{model:"speech-2.8-hd",voice:"male-qn-jingying"},qwen:{model:"qwen-audio-3.0-tts-plus",voice:"longanlufeng"},glm:{model:"glm-tts",voice:"xiaochen"},stepfun:{model:"stepaudio-2.5-tts",voice:"qingniandaxuesheng"},volcengine:{model:"seed-tts-2.0",voice:"zh_male_yangguangqingnian_uranus_bigtts"},"volcengine-agent":{model:"seed-tts-2.0",voice:"zh_male_yangguangqingnian_uranus_bigtts"},openai:{model:"gpt-4o-mini-tts",voice:"cedar"}},bX={minimax:{apiKey:"https://platform.minimax.cn/docs/guides/quickstart-preparation",model:"https://platform.minimax.cn/docs/api-reference/speech-t2a-http",voice:"https://platform.minimax.cn/docs/faq/system-voice-id",endpoint:"https://platform.minimax.cn/docs/api-reference/speech-t2a-http"},qwen:{apiKey:"https://help.aliyun.com/zh/model-studio/token-plan-personal-quick-start",model:"https://help.aliyun.com/zh/model-studio/non-realtime-tts-user-guide",voice:"https://help.aliyun.com/zh/model-studio/qwen-audio-tts-voice-list",endpoint:"https://help.aliyun.com/zh/model-studio/non-realtime-tts-user-guide"},glm:{apiKey:"https://docs.bigmodel.cn/cn/guide/start/quick-start",model:"https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3",voice:"https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3",endpoint:"https://docs.bigmodel.cn/api-reference/%E6%A8%A1%E5%9E%8B-api/%E6%96%87%E6%9C%AC%E8%BD%AC%E8%AF%AD%E9%9F%B3"},stepfun:{apiKey:"https://platform.stepfun.com/docs/zh/step-plan/integrations/audio-api",model:"https://platform.stepfun.com/docs/zh/api-reference/audio/create-audio",voice:"https://platform.stepfun.com/docs/zh/guides/developer/tts",endpoint:"https://platform.stepfun.com/docs/zh/api-reference/audio/create-audio"},volcengine:{apiKey:"https://www.volcengine.com/docs/6561/196768",model:"https://www.volcengine.com/docs/6561/1598757",voice:"https://www.volcengine.com/docs/6561/1257544",endpoint:"https://www.volcengine.com/docs/6561/1598757"},openai:{apiKey:"https://platform.openai.com/docs/quickstart",model:"https://developers.openai.com/api/docs/guides/text-to-speech",voice:"https://developers.openai.com/api/docs/guides/text-to-speech",endpoint:"https://developers.openai.com/api/docs/guides/text-to-speech"},"volcengine-agent":{apiKey:"https://ark.volcengine.com/region:cn-beijing/docs/82379/2160841?lang=zh",model:"https://docs.volcengine.com/docs/ark/agent-plan-personal-voice-model?lang=zh",voice:"https://www.volcengine.com/docs/6561/1257544",endpoint:"https://docs.volcengine.com/docs/ark/agent-plan-personal-voice-model?lang=zh"}},bY={volcengine:"https://docs.volcengine.com/docs/ark/free-inference-quota?lang=zh"};function bZ({config:a,setConfig:e,saving:i,onSave:j}){var k;let{t:l,language:m}=(0,d.b)(),n=l.settings.tts,[o,p]=(0,c.useState)(!1),[q,r]=(0,c.useState)(null),s=a.tts?.mode??"browser",t="browser"!==s&&"string"==typeof(k=s)&&bV.includes(k)?s:null,u=t?a.tts?.[t]:void 0,v=(a,b)=>{t&&e(c=>({...c,tts:{...c.tts,[t]:{...c.tts?.[t],[a]:b}}}))},w=!!t&&("volcengine"===t||"openai"===t),z=t?function(a,b){if("openai"===b){let b=a.openai?.instances?.find(b=>b.id===a.openai?.activeInstanceId);return b?{apiKey:b.apiKey,baseUrl:b.baseUrl}:void 0}return a[b]}(a,t):void 0,A=w?u?.apiKey:z?.apiKey,B=async()=>{(0,bU.p)(),p(!0),r(null);try{await j();let{id:a,version:b}=await f.k.post("/api/tts",{text:n.previewText,language:m},{timeout:12e4,recoverable:!0}),c=(0,bU.l)();if(!c)return;c.src=`/api/tts/${a}?v=${b}`,c.playbackRate=1,await c.play()}catch(b){h.V.error("[TtsSettings]","Preview failed",{error:b});let a=(0,g.d)(b);L.c.error("TTS_NOT_CONFIGURED"===a?n.notConfigured:"TTS_PROVIDER_ERROR"===a?n.providerError:n.previewFailed),r((0,g.L)(b)??null)}finally{p(!1)}};return(0,b.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(am.f,{children:n.title}),(0,b.jsxs)(aL.d,{value:s,onValueChange:a=>e(b=>({...b,tts:{...b.tts,mode:a}})),children:[(0,b.jsx)(aL.P,{children:(0,b.jsx)(aL.U,{})}),(0,b.jsx)(aL.r,{children:bV.map(a=>(0,b.jsx)(aL.T,{value:a,children:n.modes[a]},a))})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:t?n.cloudHint:n.browserHint})]}),t&&(0,b.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[bY[t]&&(0,b.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:[n.freeTrial," ",(0,b.jsx)("a",{href:bY[t],target:"_blank",rel:"noopener noreferrer",className:"underline",children:n.freeTrialLink})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bR.f,{label:"openai"===t?"OpenAI API Key":w?n.speechApiKey:`${(0,bT.z)(t,m)} API Key`,href:bX[t].apiKey,linkText:l.settings.ai.docLinks.apiKey}),(0,b.jsx)(aK.f,{value:A||"",onChange:a=>{var b;return b=a.target.value,void(t&&(w?v("apiKey",b):e(a=>({...a,[t]:{...a[t],apiKey:b}}))))},placeholder:"qwen"===t?"sk-sp-...":w?"":"sk-..."}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n.apiKeyHint[t]})]}),(0,b.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bR.f,{label:n.model,href:bX[t].model,linkText:n.docs}),(0,b.jsx)(al.f,{value:u?.model||"",onChange:a=>v("model",a.target.value),placeholder:bW[t].model})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bR.f,{label:n.voice,href:bX[t].voice,linkText:n.voiceList}),(0,b.jsx)(al.f,{value:u?.voice||"",onChange:a=>v("voice",a.target.value),placeholder:bW[t].voice})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n.voiceHint[t]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(bR.f,{label:n.endpoint,href:bX[t].endpoint,linkText:n.docs}),(0,b.jsx)(al.f,{value:u?.endpoint||"",onChange:a=>v("endpoint",a.target.value),placeholder:function(a,b){if("volcengine"===a)return"https://openspeech.bytedance.com/api/v3/tts/unidirectional";if("volcengine-agent"===a)return"https://openspeech.bytedance.com/api/v3/plan/tts/unidirectional";if("openai"===a)return`${(b?.baseUrl||"https://api.openai.com/v1").replace(/\/+$/,"")}/audio/speech`;let{baseUrl:c}=(0,bT.k)(a,b);if("minimax"===a)return`${c.replace(/\/+$/,"")}/t2a_v2`;if("glm"===a||"stepfun"===a)return`${c.replace(/\/+$/,"")}/audio/speech`;try{return`${new URL(c).origin}/api/v1/services/audio/tts/SpeechSynthesizer`}catch{return""}}(t,z)}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:n.endpointHint})]})]},t),(0,b.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[t&&(0,b.jsxs)(y.f,{variant:"outline",onClick:B,disabled:i||o,className:"sm:w-auto",children:[o?(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,b.jsx)(bQ.f,{className:"mr-2 h-4 w-4"}),n.preview]}),(0,b.jsxs)(y.f,{onClick:()=>void j(),disabled:i||o,className:"flex-1",children:[i&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.save]})]}),t&&q&&(0,b.jsx)("div",{className:"rounded-md border border-red-200 bg-red-50 p-2 dark:border-red-900 dark:bg-red-950/40",children:(0,b.jsx)(bS.f,{detail:q})})]})}var b$=a.i(439830);function b_({value:a,icon:c,label:d}){return(0,b.jsxs)(ah.k,{value:a,className:"px-2 sm:px-3",children:[c,(0,b.jsx)("span",{className:"hidden sm:inline",children:d})]})}function b0(){let{setTimeZone:a}=(0,v.M)(),{data:g}=(0,e.useSession)(),i=g?.user?.role==="admin",j=g?.user?.id??"",{t:k}=(0,d.b)(),l=(0,w.useRouter)(),[m,n]=(0,c.useState)(!1),o=(0,c.useRef)(null),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)({aiProvider:"minimax"}),A=(0,c.useCallback)(async()=>{s(!0);try{u(await f.k.get("/api/settings"))}catch(a){h.V.error("[SettingsDialog]","Failed to fetch settings",{error:a})}finally{s(!1)}},[]);(0,c.useEffect)(()=>{m&&A()},[m,A]);let C=async()=>{let b=(0,b$.f)(t,k);if(b)return void L.c.error(b);q(!0);try{let b=await f.k.post("/api/settings",t);u(b),a(b.timeZone||ai.J),L.c.success(k.settings?.messages?.saved||"Settings saved"),o.current?.scrollTo({top:0,behavior:"smooth"})}catch(a){h.V.error("[SettingsDialog]","Failed to save settings",{error:a}),L.c.error(k.settings?.messages?.saveFailed||"Failed to save")}finally{q(!1)}},D=a=>(0,b.jsxs)(y.f,{onClick:C,disabled:p,className:"w-full",children:[p&&(0,b.jsx)(x.f,{className:"mr-2 h-4 w-4 animate-spin"}),a]});return(0,b.jsxs)(z.N,{open:m,onOpenChange:n,children:[(0,b.jsx)(z.a,{asChild:!0,children:(0,b.jsxs)(y.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(ae,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:k.settings?.title||"Settings"})]})}),(0,b.jsxs)(z.d,{ref:o,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:k.settings?.title||"Settings"}),(0,b.jsx)(z.C,{children:k.settings?.desc||"Manage your preferences and data."})]}),(0,b.jsxs)(ah.i,{defaultValue:"general",className:"w-full",children:[(0,b.jsxs)(ah.U,{className:`grid w-full grid-cols-4 ${i?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,b.jsx)(b_,{value:"general",icon:(0,b.jsx)(aa.f,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.general||"General"}),(0,b.jsx)(b_,{value:"account",icon:(0,b.jsx)(af.f,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.account||"Account"}),i&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(b_,{value:"ai",icon:(0,b.jsx)(Z,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.ai||"AI Provider"}),(0,b.jsx)(b_,{value:"prompts",icon:(0,b.jsx)(ac,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.prompts||"Prompts"}),(0,b.jsx)(b_,{value:"admin",icon:(0,b.jsx)(S,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.admin||"User Management"})]}),(0,b.jsx)(b_,{value:"danger",icon:(0,b.jsx)(X.f,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.danger||"Danger"}),(0,b.jsx)(b_,{value:"about",icon:(0,b.jsx)(_,{className:"h-4 w-4 sm:mr-2"}),label:k.settings?.tabs?.about||"About"})]}),(0,b.jsxs)(ah.S,{value:"general",className:"space-y-4 py-4",children:[(0,b.jsx)(br,{config:t,setConfig:u,isAdmin:i,disabled:r||p}),(0,b.jsx)(bv,{}),i&&D(k.settings?.save||"Save Settings")]}),(0,b.jsxs)(ah.S,{value:"account",className:"space-y-4 py-4",children:[(0,b.jsx)(aO,{}),(0,b.jsx)(a7,{})]}),(0,b.jsxs)(ah.S,{value:"ai",className:"space-y-4 py-4",children:[(0,b.jsx)(aP.f,{config:t,setConfig:u,loading:r,saving:p,onSave:C}),!r&&(0,b.jsx)(bZ,{config:t,setConfig:u,saving:p,onSave:C})]}),(0,b.jsxs)(ah.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,b.jsx)(bP,{config:t,onUpdate:(a,b)=>u(c=>({...c,prompts:{...c.prompts,[a]:b}}))}),D(k.settings?.prompts?.save||"Save Prompt Settings")]}),i&&(0,b.jsxs)(ah.S,{value:"admin",className:"space-y-4 py-4",children:[(0,b.jsxs)(y.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{n(!1),l.push("/admin")},children:[(0,b.jsx)(B.f,{className:"h-4 w-4"}),k.admin?.dashboard?.title||"Admin Dashboard"]}),(0,b.jsxs)(y.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{n(!1),l.push("/setup")},children:[(0,b.jsx)(ag.f,{className:"h-4 w-4"}),k.setup.rerun]}),(0,b.jsx)(bg,{}),(0,b.jsx)(aZ,{}),(0,b.jsx)("div",{className:"border-t pt-4",children:(0,b.jsx)(ay,{})})]}),(0,b.jsx)(ah.S,{value:"danger",className:"space-y-4 py-4",children:(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)(bc,{isAdmin:i,userId:j}),(0,b.jsx)(a1,{isAdmin:i}),(0,b.jsx)(a4,{isAdmin:i})]})}),(0,b.jsx)(ah.S,{value:"about",className:"space-y-4 py-4",children:(0,b.jsx)(aJ,{})})]})]})]})}var b1=a.i(505004);let b2={name:"moon",size:24,node:[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]};b2.node;let b3=(0,F.f)(b2),b4={name:"sun",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]};b4.node;let b5=(0,F.f)(b4);var b6=a.i(335732);let b7={system:b1.f,light:b5,dark:b3};function b8(){let{t:a}=(0,d.b)(),{preference:e,setPreference:f}=(0,c.useContext)(m),g=b7[e],h=`${a.theme.toggle}: ${a.theme[e]}`;return(0,b.jsxs)(b6.G,{children:[(0,b.jsx)(b6.X,{asChild:!0,children:(0,b.jsx)(y.f,{variant:"ghost",size:"icon",className:"rounded-full",title:h,"aria-label":h,children:(0,b.jsx)(g,{className:"h-5 w-5"})})}),(0,b.jsx)(b6.L,{align:"end",children:(0,b.jsx)(b6.O,{value:e,onValueChange:a=>{l(a)&&f(a)},children:i.map(c=>{let d=b7[c];return(0,b.jsxs)(b6.T,{value:c,className:"gap-2",children:[(0,b.jsx)(d,{className:"h-4 w-4"}),a.theme[c]]},c)})})})]})}function b9({children:a}){var g;let i,j,k=(0,w.usePathname)()||"/",{t:l}=(0,d.b)(),{data:m,status:n}=(0,e.useSession)(),o=m?.user?.role==="admin",p=K(k);if(g=o&&!p,i=(0,w.useRouter)(),j=(0,c.useRef)(!1),(0,c.useEffect)(()=>{g&&!j.current&&(j.current=!0,f.k.get("/api/setup").then(a=>{a.needsSetup&&i.replace("/setup")}).catch(a=>h.V.warn("[Setup]","Failed to check setup status",{error:a})))},[g,i]),p||"unauthenticated"===n)return(0,b.jsx)(b.Fragment,{children:a});let q=m?.user?.name||m?.user?.email||"";return(0,b.jsxs)("div",{className:"min-h-screen",children:[(0,b.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,b.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,b.jsxs)(P.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,b.jsx)(O.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,b.jsx)("span",{className:"hidden text-base font-semibold tracking-tight sm:inline",children:l.pageTitle.base})]}),(0,b.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:J.map(a=>{let c=a.match(k),d=a.icon;return(0,b.jsxs)(P.default,{href:a.href,className:(0,V.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)(d,{className:"h-4 w-4"}),l.nav[a.key]]},a.key)})}),(0,b.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[q&&(0,b.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,b.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:q.slice(0,1).toUpperCase()}),(0,b.jsx)("span",{className:"truncate",children:q})]}),o&&(0,b.jsx)(P.default,{href:"/admin",title:l.nav.admin,children:(0,b.jsxs)(y.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,b.jsx)(S,{className:"h-5 w-5"}),(0,b.jsx)("span",{className:"sr-only",children:l.nav.admin})]})}),(0,b.jsx)(W,{className:"mr-1"}),(0,b.jsx)(b8,{}),(0,b.jsx)(b0,{}),(0,b.jsx)(y.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,e.signOut)({callbackUrl:"/login"}),title:l.app.logout,children:(0,b.jsx)(Q.f,{className:"h-5 w-5"})})]})]})}),(0,b.jsx)("div",{className:"pb-20 md:pb-0",children:a}),(0,b.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,b.jsx)("div",{className:"grid h-16",style:{gridTemplateColumns:`repeat(${J.length}, minmax(0, 1fr))`},children:J.map(a=>{let c=a.match(k),d=a.icon;return(0,b.jsxs)(P.default,{href:a.href,className:(0,V.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",c?"text-primary":"text-muted-foreground"),"aria-current":c?"page":void 0,children:[(0,b.jsx)("span",{className:(0,V.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",c&&"bg-accent"),children:(0,b.jsx)(d,{className:"h-5 w-5"})}),l.nav[a.key]]},a.key)})})})]})}let ca={name:"list-todo",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]};ca.node;let cb=(0,F.f)(ca);var cc=a.i(211134),cd=a.i(374161);let ce=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function cf(){let{t:a}=(0,d.b)(),{timeZone:g}=(0,v.M)(),{status:h}=(0,e.useSession)(),i=(0,w.usePathname)(),[j,k]=(0,c.useState)(!1),[l,m]=(0,c.useState)(()=>cd.f.getSnapshot()),[n,o]=(0,c.useState)(()=>Date.now()),p="authenticated"!==h||ce.some(a=>a.test(i||""));if((0,c.useEffect)(()=>{if(!p)return cd.f.subscribe(a=>{m(a),o(Date.now())})},[p]),p)return null;let q=l.filter(a=>"running"===a.status).length,r=l.some(a=>"running"!==a.status),s=async()=>{try{await f.k.delete("/api/tasks"),await cd.f.refresh()}catch{}};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(y.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>k(!0),"aria-label":a.backgroundTasks.title,title:a.backgroundTasks.title,children:[q>0?(0,b.jsx)(x.f,{className:"h-5 w-5 animate-spin"}):(0,b.jsx)(cb,{className:"h-5 w-5"}),q>0&&(0,b.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:q})]}),(0,b.jsx)(z.N,{open:j,onOpenChange:k,children:(0,b.jsxs)(z.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsx)(z.F,{children:a.backgroundTasks.title}),(0,b.jsx)(z.C,{children:a.backgroundTasks.description})]}),0===l.length?(0,b.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:a.backgroundTasks.empty}):(0,b.jsx)("ul",{className:"space-y-2",children:l.map(c=>{var d,e;let f;return(0,b.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:["running"===c.status&&(0,b.jsx)(x.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===c.status&&(0,b.jsx)(a8.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===c.status&&(0,b.jsx)(cc.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,b.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,b.jsxs)("div",{className:"font-medium",children:[a.backgroundTasks.kinds[c.kind],(0,b.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",a.backgroundTasks.status[c.status]]})]}),c.subject&&(0,b.jsx)("div",{className:"break-words text-muted-foreground",children:c.subject}),c.progress&&c.progress.total>0&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,b.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(c.progress.done/c.progress.total*100)}%`}})}),(0,b.jsxs)("div",{className:"text-xs text-muted-foreground",children:[a.backgroundTasks.progress.replace("{done}",String(c.progress.done)).replace("{total}",String(c.progress.total)),c.progress.failed>0&&` \xb7 ${a.backgroundTasks.failedCount.replace("{count}",String(c.progress.failed))}`]})]}),c.error&&(0,b.jsx)("div",{className:"text-xs text-destructive",children:(b=>{if(!b)return null;let c=a.backgroundTasks.errors[b]??a.errors[b];return"string"==typeof c?c:b})(c.error)}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,b.jsx)("span",{children:a.backgroundTasks.startedAt.replace("{time}",(0,ai.r)(c.startedAt,"HH:mm:ss",g))}),(0,b.jsx)("span",{children:a.backgroundTasks.elapsed.replace("{time}",(d=c.startedAt,e=c.finishedAt,f=Math.max(0,Math.round(((e?Date.parse(e):n)-Date.parse(d))/1e3)),`${Math.floor(f/60)}:${String(f%60).padStart(2,"0")}`))}),c.link&&(0,b.jsx)(P.default,{href:c.link,className:"text-primary hover:underline",onClick:()=>k(!1),children:a.backgroundTasks.view})]})]})]})},c.id)})}),(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:a.backgroundTasks.retentionHint}),r&&(0,b.jsx)(y.f,{variant:"ghost",size:"sm",onClick:s,children:a.backgroundTasks.clearFinished})]})]})})]})}var cg=a.i(474215);let ch={success:{icon:a8.f,className:"text-success"},error:{icon:cc.f,className:"text-destructive"},warning:{icon:X.f,className:"text-warning"},info:{icon:_,className:"text-primary"}};function ci(){let{t:a}=(0,d.b)(),[e,f]=(0,c.useState)([]),[g,h]=(0,c.useState)(null);return(0,c.useEffect)(()=>(0,L.M)(a=>{f(a.toasts),h(a.confirm)}),[]),(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:e.map(c=>{let{icon:d,className:e}=ch[c.type];return(0,b.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,b.jsx)(d,{className:(0,V.f)("mt-0.5 h-4 w-4 shrink-0",e)}),(0,b.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:c.message}),(0,b.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,L.p)(c.id),"aria-label":a.common.close,children:(0,b.jsx)(cg.X,{className:"h-3.5 w-3.5"})})]},c.id)})}),(0,b.jsx)(z.N,{open:!!g,onOpenChange:a=>{a||g?.resolve(!1)},children:(0,b.jsxs)(z.d,{className:"sm:max-w-md",children:[(0,b.jsxs)(z.s,{children:[(0,b.jsxs)(z.F,{className:"flex items-center gap-2",children:[g?.destructive&&(0,b.jsx)(X.f,{className:"h-5 w-5 text-destructive"}),g?.title||a.common.confirmTitle]}),(0,b.jsx)(z.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:g?.message})]}),(0,b.jsxs)(z.c,{className:"gap-2",children:[(0,b.jsx)(y.f,{variant:"outline",onClick:()=>g?.resolve(!1),children:g?.cancelText||a.common.cancel}),(0,b.jsx)(y.f,{variant:g?.destructive?"destructive":"default",onClick:()=>g?.resolve(!0),autoFocus:!0,children:g?.confirmText||a.common.confirm})]})]})})]})}function cj(){return(0,c.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(a=>{h.V.warn("[PWA]","Service worker registration failed",{error:String(a)})})},[]),null}a.s(["Providers",0,function({children:a,timeZone:f}){return(0,c.useEffect)(()=>(0,h.m)(),[]),(0,b.jsx)(e.SessionProvider,{children:(0,b.jsx)(u,{children:(0,b.jsx)(d.w,{children:(0,b.jsxs)(v.n,{initialTimeZone:f,children:[(0,b.jsx)(b9,{children:a}),(0,b.jsx)(cf,{}),(0,b.jsx)(N,{}),(0,b.jsx)(ci,{}),(0,b.jsx)(cj,{})]})})})})}],418175)}];
199
199
 
200
200
  //# sourceMappingURL=src_components_providers_tsx_09kw-mv3nb6xs._.js.map