wrong-notebook 2026.10.22 → 2026.10.23
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.
- package/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +0 -1
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +0 -8
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/page.js.nft.json +1 -1
- package/.next/server/app/admin/page_client-reference-manifest.js +1 -1
- package/.next/server/app/admin/user/[id]/page.js.nft.json +1 -1
- package/.next/server/app/admin/user/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/admin/dashboard/route.js +8 -2
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/migrate-tags/route.js +1 -1
- package/.next/server/app/api/admin/migrate-tags/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/system-reset/route.js +2 -2
- package/.next/server/app/api/admin/system-reset/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js +9 -2
- package/.next/server/app/api/admin/users/[id]/detail/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/route.js +1 -1
- package/.next/server/app/api/admin/users/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/route.js +1 -1
- package/.next/server/app/api/admin/users/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/models/route.js +5 -5
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +6 -6
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +3 -3
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +7 -7
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/auth/[...nextauth]/route.js +1 -1
- package/.next/server/app/api/auth/[...nextauth]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/delete/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js +6 -6
- package/.next/server/app/api/error-items/[id]/figure/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js +7 -7
- package/.next/server/app/api/error-items/[id]/fix-latex/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/geogebra/route.js +7 -7
- package/.next/server/app/api/error-items/[id]/geogebra/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/image/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/image/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/notes/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/notes/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/practice-records/route.js +2 -2
- package/.next/server/app/api/error-items/[id]/practice-records/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js +8 -8
- package/.next/server/app/api/error-items/[id]/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/retag/route.js +6 -6
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/route.js +1 -1
- package/.next/server/app/api/error-items/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js +8 -8
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/batch-delete/route.js +2 -2
- package/.next/server/app/api/error-items/batch-delete/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/clear/route.js +2 -2
- package/.next/server/app/api/error-items/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js +4 -4
- package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js +8 -8
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/short/[shortId]/route.js +1 -1
- package/.next/server/app/api/error-items/short/[shortId]/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/similarity/route.js +2 -2
- package/.next/server/app/api/error-items/similarity/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js +7 -7
- package/.next/server/app/api/exams/[id]/questions/[questionId]/regenerate/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/results/route.js +6 -6
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +7 -7
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +7 -7
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +7 -7
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js +2 -2
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +5 -5
- package/.next/server/app/api/geogebra-analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/health/route.js.nft.json +1 -1
- package/.next/server/app/api/import/route.js +7 -7
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/logs/frontend/route.js +2 -2
- package/.next/server/app/api/logs/frontend/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js +3 -3
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/route.js +2 -2
- package/.next/server/app/api/notebooks/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/route.js +1 -1
- package/.next/server/app/api/notebooks/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +7 -7
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +5 -5
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +5 -5
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +7 -7
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js +7 -7
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/register/route.js.nft.json +1 -1
- package/.next/server/app/api/register/status/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js +3 -3
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/clear/route.js +2 -2
- package/.next/server/app/api/stats/practice/clear/route.js.nft.json +1 -1
- package/.next/server/app/api/stats/practice/route.js +1 -1
- package/.next/server/app/api/stats/practice/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/route.js +2 -2
- package/.next/server/app/api/tags/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/stats/route.js +2 -2
- package/.next/server/app/api/tags/stats/route.js.nft.json +1 -1
- package/.next/server/app/api/tags/suggestions/route.js +1 -1
- package/.next/server/app/api/tags/suggestions/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/route.js +2 -2
- package/.next/server/app/api/tasks/route.js.nft.json +1 -1
- package/.next/server/app/api/user/route.js +2 -2
- package/.next/server/app/api/user/route.js.nft.json +1 -1
- package/.next/server/app/api/version/route.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page.js.nft.json +1 -1
- package/.next/server/app/error-items/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/[id]/print/page.js.nft.json +1 -1
- package/.next/server/app/exams/[id]/print/page_client-reference-manifest.js +1 -1
- package/.next/server/app/exams/page.js.nft.json +1 -1
- package/.next/server/app/exams/page_client-reference-manifest.js +1 -1
- package/.next/server/app/latex-test/page.js.nft.json +1 -1
- package/.next/server/app/latex-test/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/.next/server/app/manifest.webmanifest.body +1 -1
- package/.next/server/app/notebooks/[id]/add/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/add/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/[id]/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/notebooks/page.js.nft.json +1 -1
- package/.next/server/app/notebooks/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/practice/page.js.nft.json +1 -1
- package/.next/server/app/practice/page_client-reference-manifest.js +1 -1
- package/.next/server/app/print-preview/page.js.nft.json +1 -1
- package/.next/server/app/print-preview/page_client-reference-manifest.js +1 -1
- package/.next/server/app/register/page.js.nft.json +1 -1
- package/.next/server/app/register/page_client-reference-manifest.js +1 -1
- package/.next/server/app/stats/page.js.nft.json +1 -1
- package/.next/server/app/stats/page_client-reference-manifest.js +1 -1
- package/.next/server/app/tags/page.js.nft.json +1 -1
- package/.next/server/app/tags/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +0 -1
- package/.next/server/chunks/{[externals]__1735khz._.js → [externals]__0jzwjtl._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0be5c5r._.js → [root-of-the-server]__0-2l_pu._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__02j1w81._.js → [root-of-the-server]__00moo9h._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__03nfvnm._.js → [root-of-the-server]__012xcq-._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__01bzczj._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0bqawi0._.js → [root-of-the-server]__02pqrw_._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0nqbham._.js → [root-of-the-server]__033ri9p._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__04pjde6._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1u-1vx4._.js → [root-of-the-server]__064krqp._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__07iraov._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__16begv4._.js → [root-of-the-server]__07q7nsp._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0jaawra._.js → [root-of-the-server]__0_unb90._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0gp88gz._.js → [root-of-the-server]__0a1zwxf._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0k-nf6a._.js → [root-of-the-server]__0aefi10._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0cfjgye._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1hpwwxw._.js → [root-of-the-server]__0d-37yj._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0d2kpnm._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0k-p1pj._.js → [root-of-the-server]__0dqgi36._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0mqorxb._.js → [root-of-the-server]__0dz5c04._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0vhjihq._.js → [root-of-the-server]__0e_u82_._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0obb4y-._.js → [root-of-the-server]__0f3jyg0._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1413v0e._.js → [root-of-the-server]__0gwwa9b._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0lrdm1u._.js → [root-of-the-server]__0hars8c._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1h09r50._.js → [root-of-the-server]__0iozebm._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0k-5uu2._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1csfdxc._.js → [root-of-the-server]__0k3mm05._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0l-xu_t._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0inxsnu._.js → [root-of-the-server]__0lggrcf._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0m0eall._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__06_nln5._.js → [root-of-the-server]__0m37xyb._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0m8p-6f._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1m4-ab6._.js → [root-of-the-server]__0pa47kn._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0r42_o7._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0rgjh3q._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0scij0p._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sixhu9._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sj18kk._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sp4_zo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0t2o8v-._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__18zrkky._.js → [root-of-the-server]__0w58v6b._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0wp40ty._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0lro5a7._.js → [root-of-the-server]__0wsj4a_._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0u58zap._.js → [root-of-the-server]__0wvvsah._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1v6nwhq._.js → [root-of-the-server]__0xg5h56._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0zpazf3._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__06h5afw._.js → [root-of-the-server]__10hs-qn._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1j6mx-v._.js → [root-of-the-server]__119xork._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__11_-ncy._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__11jhplo._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__122xu-0._.js +5 -5
- package/.next/server/chunks/{[root-of-the-server]__0fnyu4s._.js → [root-of-the-server]__15y1l96._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1pplzr1._.js → [root-of-the-server]__16hnc6-._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__17i9sje._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1aaux7e._.js → [root-of-the-server]__19_wn9u._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1cn6rlb._.js → [root-of-the-server]__1_hp3ol._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1_ogacf._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1nwf3ua._.js → [root-of-the-server]__1a4-26x._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1b6i9mu._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1b_y2wk._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1lct0vi._.js → [root-of-the-server]__1bl7t8i._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1kqv61m._.js → [root-of-the-server]__1c0vatt._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1c7a0rs._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1chx4lo._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1sdtn83._.js → [root-of-the-server]__1cngnud._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__19vj8qy._.js → [root-of-the-server]__1d82zkk._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1ezju_2._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1fc23i5._.js +122 -0
- package/.next/server/chunks/[root-of-the-server]__1flnfu4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1gya7jq._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1hng_h2._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1rsn804._.js → [root-of-the-server]__1i40psm._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1ijkds_._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1j4v2e3._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1kpo44g._.js +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1oup682._.js → [root-of-the-server]__1lbcdia._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1g1wi9i._.js → [root-of-the-server]__1m86czr._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__05s4wut._.js → [root-of-the-server]__1mnpqkx._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1cceu4b._.js → [root-of-the-server]__1n4b6nb._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0bsw5c9._.js → [root-of-the-server]__1nmrlew._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1o34kp3._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0c59gc3._.js → [root-of-the-server]__1q7yl7l._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1gmc_uw._.js → [root-of-the-server]__1qv60vg._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__1mkpya8._.js → [root-of-the-server]__1ry8uat._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1ezwxao._.js → [root-of-the-server]__1s2rww3._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__1svvf40._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1tk0-4v._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1v-71me._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1vw740y._.js +5 -5
- package/.next/server/chunks/[root-of-the-server]__1x_ud_-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1yt_xxr._.js +3 -0
- package/.next/server/chunks/_008zx49._.js +1 -1
- package/.next/server/chunks/_011-ll5._.js +1 -1
- package/.next/server/chunks/_0gxi3zr._.js +1 -1
- package/.next/server/chunks/_0lz3t4l._.js +12 -12
- package/.next/server/chunks/{_1e1h1f1._.js → _0n36ev0._.js} +1 -1
- package/.next/server/chunks/_0oc8oe4._.js +3 -0
- package/.next/server/chunks/_0rjzgi0._.js +3 -0
- package/.next/server/chunks/_10y361h._.js +3 -0
- package/.next/server/chunks/_14tz_k9._.js +1 -1
- package/.next/server/chunks/{_0c5hvv3._.js → _15neond._.js} +3 -3
- package/.next/server/chunks/_16jdov0._.js +1 -1
- package/.next/server/chunks/_1_ns7o3._.js +1 -1
- package/.next/server/chunks/_1a1aqmi._.js +1 -1
- package/.next/server/chunks/_1b7qjlv._.js +1 -1
- package/.next/server/chunks/_1m-yyz-._.js +1 -1
- package/.next/server/chunks/_1n1xsqj._.js +3 -0
- package/.next/server/chunks/_1z_ujac._.js +1 -1
- package/.next/server/chunks/{_0frix22._.js → _2194yr7._.js} +3 -3
- package/.next/server/chunks/src_0tzpy5j._.js +1 -1
- package/.next/server/chunks/src_lib_ai_prompts_ts_0z36zms._.js +12 -11
- package/.next/server/chunks/ssr/[root-of-the-server]__00gewu3._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__03psbtz._.js +3 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__0hzktoi._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0skyo1a._.js +3 -0
- package/.next/server/chunks/ssr/_07ls0n_._.js +1 -1
- package/.next/server/chunks/ssr/_0sf1gd9._.js +1 -1
- package/.next/server/chunks/ssr/_11ut-6_._.js +3 -0
- package/.next/server/chunks/ssr/{_12c20v5._.js → _1aot_70._.js} +1 -1
- package/.next/server/chunks/ssr/src_1gayunq._.js +1 -1
- package/.next/server/chunks/ssr/src_1o363ao._.js +1 -1
- package/.next/server/chunks/ssr/src_app_admin_page_tsx_0ublbd0._.js +1 -1
- package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdm._.js +1 -1
- package/.next/server/chunks/ssr/src_app_notebooks_[id]_page_tsx_08njm-5._.js +1 -1
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv._.js +1 -1
- package/.next/server/edge/chunks/node_modules_0g4gi6f._.js +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/middleware-manifest.json +7 -7
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/{w6W6dMBYlP4wbCdeRcVhA → Y0pwgmRdVAifh_zukihNt}/_clientMiddlewareManifest.js +2 -2
- package/.next/static/chunks/03gmdewlo3s6u.js +1 -0
- package/.next/static/chunks/06q8lm6y95ac4.css +1 -0
- package/.next/static/chunks/0ij2dqb0qj5ry.js +1 -0
- package/.next/static/chunks/{2rmhba08h4qqo.js → 0pwdmc9gw8ben.js} +1 -1
- package/.next/static/chunks/{35cov9g4cgt-v.js → 1c92up8k2x0z4.js} +1 -1
- package/.next/static/chunks/24dymggis4suf.css +3 -0
- package/.next/static/chunks/24jbwfpgmio7x.js +1 -0
- package/.next/static/chunks/27fr34_1v7xyh.js +1 -0
- package/.next/static/chunks/2eu_bls12m1wj.js +1 -0
- package/.next/static/chunks/{2yl8a-gxngbuq.js → 2x8e_fbze06sd.js} +1 -1
- package/.next/static/chunks/2z1_5umv36es6.js +191 -0
- package/.next/static/chunks/3m4c1r8_2ga_1.js +1 -0
- package/.next/static/chunks/{2s07soqug65hc.js → 3whzkc6d8oefw.js} +1 -1
- package/LICENSE +22 -0
- package/launcher.js +22 -6
- package/package.json +3 -2
- package/prisma/migrations/20261022000141_add_svg_animation_en/migration.sql +2 -0
- package/prisma/schema.prisma +2 -1
- package/prisma/seed.db +0 -0
- package/public/icons/apple-touch-icon.png +0 -0
- package/public/icons/icon-192.png +0 -0
- package/public/icons/icon-512.png +0 -0
- package/public/icons/icon-maskable-512.png +0 -0
- package/public/offline.html +61 -0
- package/public/sw.js +84 -0
- package/.next/server/app/api/error-items/[id]/mastery/route/app-paths-manifest.json +0 -3
- package/.next/server/app/api/error-items/[id]/mastery/route/build-manifest.json +0 -12
- package/.next/server/app/api/error-items/[id]/mastery/route/server-reference-manifest.json +0 -4
- package/.next/server/app/api/error-items/[id]/mastery/route.js +0 -8
- package/.next/server/app/api/error-items/[id]/mastery/route.js.map +0 -5
- package/.next/server/app/api/error-items/[id]/mastery/route.js.nft.json +0 -1
- package/.next/server/app/api/error-items/[id]/mastery/route_client-reference-manifest.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__04tyyvs._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0cmxmwt._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0d5dpu4._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0d9ijed._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0e22a4y._.js +0 -122
- package/.next/server/chunks/[root-of-the-server]__0j5231l._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0mfjf2y._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0no6umu._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0o9gtvd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0p3u6_q._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0rmrkd_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0tdibjz._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0vz88er._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0wf9znr._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0yc8r2x._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0zv7jom._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11_1z7m._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11n87go._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11p4ahb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__131taws._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__13ebiit._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__14dnbrn._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__14jqm9_._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__152lbaw._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__17duis5._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__17q3k-v._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__184u6de._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__18atlj8._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__18c7l6u._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1jdi-1f._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ju8z29._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1loecue._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1p8hw44._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__20465pr._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__207mxv8._.js +0 -3
- package/.next/server/chunks/_0_o8yhv._.js +0 -3
- package/.next/server/chunks/_0rdo0a4._.js +0 -3
- package/.next/server/chunks/_167vv93._.js +0 -3
- package/.next/server/chunks/_1flar98._.js +0 -3
- package/.next/server/chunks/_next-internal_server_app_api_error-items_[id]_mastery_route_actions_1l5uan6.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0b8kewv._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0icjezr._.js +0 -3
- package/.next/server/chunks/ssr/_1gu1rou._.js +0 -3
- package/.next/static/chunks/00pn0o7lymln6.js +0 -1
- package/.next/static/chunks/02521degnqmf0.js +0 -1
- package/.next/static/chunks/130ch9mnvb6mp.css +0 -3
- package/.next/static/chunks/17wdtw8hml2n6.js +0 -191
- package/.next/static/chunks/2a0kgntckcbvf.js +0 -1
- package/.next/static/chunks/2h-exsnhkfnb8.js +0 -1
- package/.next/static/chunks/2wnnnmbh85mq_.js +0 -1
- package/.next/static/chunks/3c4-ozf1dxam2.css +0 -1
- package/.next/static/chunks/3hz1l3qoxv84t.js +0 -1
- /package/.next/static/{w6W6dMBYlP4wbCdeRcVhA → Y0pwgmRdVAifh_zukihNt}/_buildManifest.js +0 -0
- /package/.next/static/{w6W6dMBYlP4wbCdeRcVhA → Y0pwgmRdVAifh_zukihNt}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(18050),t=e.i(11110),a=e.i(17255),r=e.i(15519),i=e.i(57688),n=e.i(22016),l=e.i(18566),o=e.i(17923),c=e.i(10980),d=e.i(78583),m=e.i(75254);let u=(0,m.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),p=(0,m.default)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),x=(0,m.default)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]),h=(0,m.default)("tags",[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]]);var g=e.i(71645),f=e.i(19455),j=e.i(76639),v=e.i(93479),y=e.i(10204),b=e.i(67489),N=e.i(77572);let w=(0,m.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var k=e.i(27612),S=e.i(31278);let C=(0,m.default)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var I=e.i(86536),T=e.i(77705),L=e.i(63639),E=e.i(84614);let z=(0,m.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var A=e.i(16715),D=e.i(7233);let M=(0,m.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]),R=(0,m.default)("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var P=e.i(73884),_=e.i(40160);let U=(0,m.default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);var K=e.i(30691),B=e.i(87486),F=e.i(81140),O=e.i(20783),$=e.i(30030),q=e.i(69340),V=e.i(99682),H=e.i(35804);e.i(74080);var W=Symbol("radix.slottable");function X(e){return g.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===W}var Y=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var a,r;let i,n,l,o=(r=a=`Primitive.${t}`,(i=g.forwardRef((e,s)=>{let{children:t,...a}=e;if(g.isValidElement(t)){var r;let e,i,n=(r=t,(i=(e=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.ref:(i=(e=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?r.props.ref:r.props.ref||r.ref),l=function(e,s){let t={...s};for(let a in s){let r=e[a],i=s[a];/^on[A-Z]/.test(a)?r&&i?t[a]=(...e)=>{let s=i(...e);return r(...e),s}:r&&(t[a]=r):"style"===a?t[a]={...r,...i}:"className"===a&&(t[a]=[r,i].filter(Boolean).join(" "))}return{...e,...t}}(a,t.props);return t.type!==g.Fragment&&(l.ref=s?(0,O.composeRefs)(s,n):n),g.cloneElement(t,l)}return g.Children.count(t)>1?g.Children.only(null):null})).displayName=`${r}.SlotClone`,n=i,(l=g.forwardRef((e,t)=>{let{children:a,...r}=e,i=g.Children.toArray(a),l=i.find(X);if(l){let e=l.props.children,a=i.map(s=>s!==l?s:g.Children.count(e)>1?g.Children.only(null):g.isValidElement(e)?e.props.children:null);return(0,s.jsx)(n,{...r,ref:t,children:g.isValidElement(e)?g.cloneElement(e,void 0,a):null})}return(0,s.jsx)(n,{...r,ref:t,children:a})})).displayName=`${a}.Slot`,l),c=g.forwardRef((e,a)=>{let{asChild:r,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,s.jsx)(r?o:t,{...i,ref:a})});return c.displayName=`Primitive.${t}`,{...e,[t]:c}},{}),Z="Switch",[G,J]=(0,$.createContextScope)(Z),[Q,ee]=G(Z),es=g.forwardRef((e,t)=>{let{__scopeSwitch:a,name:r,checked:i,defaultChecked:n,required:l,disabled:o,value:c="on",onCheckedChange:d,form:m,...u}=e,[p,x]=g.useState(null),h=(0,O.useComposedRefs)(t,e=>x(e)),f=g.useRef(!1),j=!p||m||!!p.closest("form"),[v,y]=(0,q.useControllableState)({prop:i,defaultProp:n??!1,onChange:d,caller:Z});return(0,s.jsxs)(Q,{scope:a,checked:v,disabled:o,children:[(0,s.jsx)(Y.button,{type:"button",role:"switch","aria-checked":v,"aria-required":l,"data-state":ei(v),"data-disabled":o?"":void 0,disabled:o,value:c,...u,ref:h,onClick:(0,F.composeEventHandlers)(e.onClick,e=>{y(e=>!e),j&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})}),j&&(0,s.jsx)(er,{control:p,bubbles:!f.current,name:r,value:c,checked:v,required:l,disabled:o,form:m,style:{transform:"translateX(-100%)"}})]})});es.displayName=Z;var et="SwitchThumb",ea=g.forwardRef((e,t)=>{let{__scopeSwitch:a,...r}=e,i=ee(et,a);return(0,s.jsx)(Y.span,{"data-state":ei(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});ea.displayName=et;var er=g.forwardRef(({__scopeSwitch:e,control:t,checked:a,bubbles:r=!0,...i},n)=>{let l=g.useRef(null),o=(0,O.useComposedRefs)(l,n),c=(0,V.usePrevious)(a),d=(0,H.useSize)(t);return g.useEffect(()=>{let e=l.current;if(!e)return;let s=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"checked").set;if(c!==a&&s){let t=new Event("click",{bubbles:r});s.call(e,a),e.dispatchEvent(t)}},[c,a,r]),(0,s.jsx)("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...i,tabIndex:-1,ref:o,style:{...i.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});function ei(e){return e?"checked":"unchecked"}er.displayName="SwitchBubbleInput";var en=e.i(75157);let el=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)(es,{className:(0,en.cn)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:a,children:(0,s.jsx)(ea,{className:(0,en.cn)("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));el.displayName=es.displayName;let eo=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,en.cn)("w-full caption-bottom text-sm",e),...t})}));eo.displayName="Table";let ec=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,en.cn)("[&_tr]:border-b",e),...t}));ec.displayName="TableHeader";let ed=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,en.cn)("[&_tr:last-child]:border-0",e),...t}));ed.displayName="TableBody",g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,en.cn)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t})).displayName="TableFooter";let em=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,en.cn)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));em.displayName="TableRow";let eu=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,en.cn)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));eu.displayName="TableHead";let ep=g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,en.cn)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));ep.displayName="TableCell",g.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,en.cn)("mt-4 text-sm text-muted-foreground",e),...t})).displayName="TableCaption";let ex=(0,m.default)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var eh=e.i(69638),eg=e.i(41931),ef=e.i(94114);function ej(){let{timeZone:e}=(0,r.useTimeZone)(),{data:i}=(0,a.useSession)(),{t:n,language:l}=(0,t.useLanguage)(),[o,c]=(0,g.useState)([]),[d,m]=(0,g.useState)(!0),[u,p]=(0,g.useState)(!0),[x,h]=(0,g.useState)(!1);(0,g.useEffect)(()=>{b(),j()},[]);let j=async()=>{try{let e=await eg.apiClient.get("/api/settings");p(!1!==e.allowRegistration)}catch(e){console.error("Failed to fetch config",e)}},v=async e=>{h(!0);try{await eg.apiClient.post("/api/settings",{allowRegistration:e}),p(e)}catch(e){console.error("Failed to update registration setting",e),ef.toast.error(n.common.error)}finally{h(!1)}},b=async()=>{m(!0);try{let e=await eg.apiClient.get("/api/admin/users");c(e)}catch(e){console.error("Failed to fetch users",e)}finally{m(!1)}},N=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,ef.confirmDialog)(s))try{await eg.apiClient.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),b()}catch(e){console.error("Failed to update user status",e),ef.toast.error(n.common.error)}},w=async e=>{if(await (0,ef.confirmDialog)(n.admin.confirmDelete,{destructive:!0}))try{await eg.apiClient.delete(`/api/admin/users/${e.id}`),b()}catch(s){console.error("Failed to delete user",s);let e=s.data?.message||n.common.error;ef.toast.error(e)}};return d?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(S.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(y.Label,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(el,{checked:u,onCheckedChange:v,disabled:x})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:o.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(B.Badge,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsx)(B.Badge,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,K.formatDateTime)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>N(t),disabled:t.id===(i?.user).id,children:t.isActive?(0,s.jsx)(ex,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(eh.CheckCircle,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>w(t),disabled:t.id===(i?.user).id,children:(0,s.jsx)(k.Trash2,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(eo,{children:[(0,s.jsx)(ec,{children:(0,s.jsxs)(em,{children:[(0,s.jsx)(eu,{children:n.admin.nameEmail}),(0,s.jsx)(eu,{children:n.admin.role}),(0,s.jsx)(eu,{children:n.admin.stats}),(0,s.jsx)(eu,{children:n.admin.createdAt}),(0,s.jsx)(eu,{children:n.admin.status}),(0,s.jsx)(eu,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(ed,{children:o.map(t=>(0,s.jsxs)(em,{children:[(0,s.jsxs)(ep,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(ep,{children:(0,s.jsx)(B.Badge,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(ep,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]})]}),(0,s.jsx)(ep,{children:(0,K.formatDateTime)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(ep,{children:(0,s.jsx)(B.Badge,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(ep,{className:"text-right space-x-2",children:[(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>N(t),disabled:t.id===(i?.user).id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(ex,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(eh.CheckCircle,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:()=>w(t),disabled:t.id===(i?.user).id,title:n.admin.delete,children:(0,s.jsx)(k.Trash2,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var ev=e.i(1276);let ey={minimax:{name:"MiniMax",baseUrl:"https://api.minimax.cn/v1",model:"MiniMax-M3.1-Flash",envPrefix:"MINIMAX",consoleUrl:"https://platform.minimax.cn"},glm:{name:"智谱 GLM",baseUrl:"https://open.bigmodel.cn/api/paas/v4",model:"glm-5.3-flash",envPrefix:"GLM",consoleUrl:"https://open.bigmodel.cn"},deepseek:{name:"DeepSeek",baseUrl:"https://api.deepseek.com",model:"deepseek-flash",envPrefix:"DEEPSEEK",consoleUrl:"https://platform.deepseek.com"},kimi:{name:"Kimi",baseUrl:"https://api.moonshot.cn/v1",model:"kimi-k3",envPrefix:"KIMI",consoleUrl:"https://platform.kimi.com"}},eb=Object.keys(ey);function eN(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(ey,e)}function ew({provider:e,apiKey:a,baseUrl:r,currentModel:i,onModelChange:n}){let{t:l}=(0,t.useLanguage)(),[o,c]=(0,g.useState)([]),[d,m]=(0,g.useState)(!1),[u,p]=(0,g.useState)(null),[x,h]=(0,g.useState)(i||""),[j,N]=(0,g.useState)(!1);(0,g.useEffect)(()=>{h(i||"")},[i]);let w=async()=>{if(!a)return void p(l.modelSelector?.enterApiKeyFirst||"Please enter API Key first");m(!0),p(null);try{let s=await eg.apiClient.post("/api/ai/models",{provider:e,apiKey:a,...r&&{baseUrl:r}});if("error"in s&&"string"==typeof s.error){p(s.error),N(!0),c([]);return}c(s.models),0===s.models.length&&(p(l.modelSelector?.noVisionModel||"No vision model found, please enter manually"),N(!0))}catch(e){console.error("Failed to fetch models:",e),p((e?.message||l.modelSelector?.fetchFailed||"Failed to fetch models")+(l.modelSelector?.enterManually||", please enter manually")),N(!0)}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(y.Label,{className:"flex-1",children:l.modelSelector?.modelName||"Model Name"}),(0,s.jsx)(f.Button,{type:"button",variant:"outline",size:"sm",onClick:w,disabled:d||!a,children:d?(0,s.jsx)(S.Loader2,{className:"h-3 w-3 animate-spin"}):(0,s.jsx)(A.RefreshCw,{className:"h-3 w-3"})})]}),u&&(0,s.jsx)("p",{className:"text-xs text-yellow-600",children:u}),j||0===o.length?(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(v.Input,{value:x,onChange:e=>{var s;h(s=e.target.value),n(s)},placeholder:eN(e)?ey[e].model:"openai"===e?"gpt-6.1-sol":"gemini-1.5-flash"}),o.length>0&&(0,s.jsx)(f.Button,{type:"button",variant:"link",size:"sm",className:"h-auto p-0 text-xs",onClick:()=>N(!1),children:l.modelSelector?.selectFromList||"Select from List"})]}):(0,s.jsx)("div",{className:"space-y-2",children:(0,s.jsxs)(b.Select,{value:i,onValueChange:e=>{"_custom"===e?N(!0):(N(!1),h(e),n(e))},children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{placeholder:l.modelSelector?.selectModel||"Select Model"})}),(0,s.jsxs)(b.SelectContent,{children:[o.map(e=>(0,s.jsxs)(b.SelectItem,{value:e.id,children:[e.name,e.owned_by&&` (${e.owned_by})`]},e.id)),(0,s.jsx)(b.SelectItem,{value:"_custom",children:l.modelSelector?.customInput||"Custom Input..."})]})]})})]})}var ek=e.i(24687);let eS=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
|
|
2
|
+
- 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
|
|
3
|
+
- 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
|
|
4
|
+
- 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
|
|
5
|
+
- 4 星:较难奥数题,需要构造、分类讨论、转化或多种方法综合(相当于拓展篇末题、超越篇前几题)。
|
|
6
|
+
- 5 星:竞赛压轴题,集训队水平,思路巧妙、步骤长(相当于超越篇难题)。
|
|
7
|
+
非数学学科按同样的 1~5 级划分:1 星为基础识记,3 星为综合应用,5 星为竞赛或压轴难度。`,eC=`- 输出一个完整的 <svg> 元素,包含 xmlns="http://www.w3.org/2000/svg" 和 viewBox(建议宽 400~600),不要用 Markdown 代码块包裹。
|
|
8
|
+
- 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
|
|
9
|
+
- 按原图比例和相对位置绘制,保留所有标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18)。
|
|
10
|
+
- 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
|
|
11
|
+
- 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,eI=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
|
|
12
|
+
- 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
|
|
13
|
+
- 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
|
|
14
|
+
- 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
|
|
15
|
+
- 公式中的中文写在 \text{...} 里,或放到公式外;百分号写成 \%,美元符号写成 \$。
|
|
16
|
+
- 反斜杠只写一个(\frac),不要写成 \\frac;换行符 \\ 只能用在 cases、aligned 等环境里。`,eT=`【角色与核心任务 (ROLE AND CORE TASK)】
|
|
17
|
+
你是一位世界顶尖的、经验丰富的、专业的跨学科考试分析专家(Interdisciplinary Exam Analysis Expert)。你的核心任务是极致准确地分析用户提供的考试题目图片,全面理解所有文本、图表和隐含约束,并提供一个完整、高度结构化且专业的解决方案。
|
|
18
|
+
|
|
19
|
+
{{language_instruction}}
|
|
20
|
+
|
|
21
|
+
【核心输出要求 (OUTPUT REQUIREMENTS)】
|
|
22
|
+
你的响应输出**必须严格遵循以下自定义标签格式**。**严禁**使用 JSON 或 Markdown 代码块。**严禁**对 LaTeX 公式中的反斜杠进行二次转义(如 "\\frac" 是错误的,必须是 "\frac")。
|
|
23
|
+
|
|
24
|
+
请严格按照以下结构输出内容:
|
|
25
|
+
|
|
26
|
+
<subject>
|
|
27
|
+
在此处填写学科,必须是以下之一:"数学", "物理", "化学", "生物", "英语", "语文", "历史", "地理", "政治", "其他"。
|
|
28
|
+
</subject>
|
|
29
|
+
|
|
30
|
+
<knowledge_points>
|
|
31
|
+
在此处填写知识点,使用逗号分隔,例如:知识点1, 知识点2, 知识点3
|
|
32
|
+
</knowledge_points>
|
|
33
|
+
|
|
34
|
+
<requires_image>
|
|
35
|
+
判断这道题是否需要依赖图片才能正确解答。如果题目包含几何图形、函数图像、实验装置图、电路图等必须看图才能理解的内容,填写 true;如果只需要文字描述即可理解(如英语题、纯文字数学题),填写 false。
|
|
36
|
+
</requires_image>
|
|
37
|
+
|
|
38
|
+
<has_figure>
|
|
39
|
+
判断题目本身是否带有配图(几何图形、函数图像、示意图、统计图、实验装置图、电路图等;不含学生的作答痕迹和纯文字表格)。有配图填 true,否则填 false。
|
|
40
|
+
</has_figure>
|
|
41
|
+
|
|
42
|
+
<figure_svg>
|
|
43
|
+
如果 has_figure 为 true,用 SVG 重新绘制题目配图:
|
|
44
|
+
${eC}
|
|
45
|
+
如果 has_figure 为 false,请留空。
|
|
46
|
+
</figure_svg>
|
|
47
|
+
|
|
48
|
+
<wrong_answer_text>
|
|
49
|
+
如果图片中包含学生已经写出的错误解答、错误步骤、草稿或错误答案,请尽量按原样摘录;如果没有看到学生错误解答,请留空。
|
|
50
|
+
</wrong_answer_text>
|
|
51
|
+
|
|
52
|
+
<mistake_status>
|
|
53
|
+
填写以下值之一:wrong_attempt(图片中有错误解答或错误步骤)、not_attempted(没有错误解答,像是完全不会做或未作答)、unknown(无法判断)。
|
|
54
|
+
</mistake_status>
|
|
55
|
+
|
|
56
|
+
<difficulty_stars>
|
|
57
|
+
只填写 1 到 5 之间的一个整数,表示题目难度星级。
|
|
58
|
+
${eS}
|
|
59
|
+
</difficulty_stars>
|
|
60
|
+
|
|
61
|
+
<mistake_analysis>
|
|
62
|
+
如果图片中包含错误解答,请分析错误可能发生在哪一步、为什么错、导致了什么后果;如果没有错误解答,请留空。
|
|
63
|
+
</mistake_analysis>
|
|
64
|
+
|
|
65
|
+
<question_text>
|
|
66
|
+
在此处填写题目的完整文本。使用 Markdown 格式。所有数学公式使用 LaTeX 符号(行内 $...$,块级 $$...$$)。
|
|
67
|
+
|
|
68
|
+
【题干转录规则】
|
|
69
|
+
1. **逐字照录**:按图片原文转录题干(含题号、分值和标点),不要改写、概括、增删字词或调整语序;看不清的字用 [?] 标注。
|
|
70
|
+
2. **填空统一**:所有填空处统一写作 ____(4 个下划线),不论原图横线长短。
|
|
71
|
+
3. **图形描述**:如果题目依赖图形,在题干原文之后空一行,单独写**一段**以「图示:」开头的图形描述;只能使用「图示:」这一种写法(不要写「图示信息」「图示说明」等),描述中不要重复题干已有的文字。题目不依赖图形时不要写图示段落。
|
|
72
|
+
|
|
73
|
+
【表格处理规则】
|
|
74
|
+
如果图片中包含表格,必须完整转录表格内容,遵循以下原则:
|
|
75
|
+
|
|
76
|
+
1. **标准表格**:使用 Markdown 表格语法
|
|
77
|
+
| 列标题1 | 列标题2 | 列标题3 |
|
|
78
|
+
|---------|---------|---------|
|
|
79
|
+
| 数据1 | 数据2 | 数据3 |
|
|
80
|
+
|
|
81
|
+
2. **复杂表格**(合并单元格/多级表头/不规则布局):
|
|
82
|
+
- 优先尝试用 Markdown 表格近似表示
|
|
83
|
+
- 如果 Markdown 无法准确表达,在表格前用文字说明结构,然后用简化的 Markdown 表格 + 注释
|
|
84
|
+
- 示例:
|
|
85
|
+
> 注:第1行为主标题,横跨3列;第2-3行为数据行
|
|
86
|
+
|
|
87
|
+
| 项目 | 数值A | 数值B |
|
|
88
|
+
|------|-------|-------|
|
|
89
|
+
| 测试1 | 10 | 20 |
|
|
90
|
+
| 测试2 | 15 | 25 |
|
|
91
|
+
|
|
92
|
+
3. **表格完整性要求**:
|
|
93
|
+
- 必须转录所有单元格内容(包括空单元格用 - 或空格表示)
|
|
94
|
+
- 保留表格标题、单位、注释
|
|
95
|
+
- 保留数据的对齐关系和分组信息
|
|
96
|
+
- 表格中的数学公式使用 LaTeX 语法
|
|
97
|
+
|
|
98
|
+
4. **表格上下文**:
|
|
99
|
+
- 如果表格有标题或编号(如"表1"),保留在表格前
|
|
100
|
+
- 如果表格后有注释或说明,保留在表格后
|
|
101
|
+
- 保持表格在题目中的位置关系
|
|
102
|
+
|
|
103
|
+
5. **特殊情况处理**:
|
|
104
|
+
- 图表混合:如果表格旁边有图形,用文字说明位置关系
|
|
105
|
+
- 手写表格:尽力识别手写内容,不确定的用 [?] 标注
|
|
106
|
+
- 模糊表格:如果表格不清晰,在表格前注明"(表格内容可能不完整)"
|
|
107
|
+
</question_text>
|
|
108
|
+
|
|
109
|
+
<answer_text>
|
|
110
|
+
在此处填写正确答案。使用 Markdown 和 LaTeX 符号。如果答案包含表格,遵循上述【表格处理规则】。
|
|
111
|
+
</answer_text>
|
|
112
|
+
|
|
113
|
+
<analysis>
|
|
114
|
+
在此处填写详细的步骤解析。
|
|
115
|
+
* 必须使用简体中文。
|
|
116
|
+
* **直接使用标准的 LaTeX 符号**(如 $\frac{1}{2}$),**不要**进行 JSON 转义(不要写成 \\frac)。
|
|
117
|
+
* 如果解析过程需要表格(如列表对比、分步计算表),遵循上述【表格处理规则】。
|
|
118
|
+
</analysis>
|
|
119
|
+
|
|
120
|
+
【知识点标签列表(KNOWLEDGE POINT LIST)】
|
|
121
|
+
{{knowledge_points_list}}
|
|
122
|
+
|
|
123
|
+
【标签使用规则 (TAG RULES)】
|
|
124
|
+
- 标签必须与题目实际考查的知识点精准匹配。
|
|
125
|
+
- 每题最多 5 个标签。
|
|
126
|
+
|
|
127
|
+
【!!! 关键格式与内容约束 (CRITICAL RULES) !!!】
|
|
128
|
+
1. **格式严格**:必须严格包含上述 12 个 XML 标签,除此之外不要输出任何其他“开场白”或“结束语”。
|
|
129
|
+
2. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
|
|
130
|
+
3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
|
|
131
|
+
4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
|
|
132
|
+
5. **LaTeX 规范**:
|
|
133
|
+
${eI}
|
|
134
|
+
|
|
135
|
+
{{grade_instruction}}
|
|
136
|
+
{{provider_hints}}`,eL=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
|
|
137
|
+
### 角色定义
|
|
138
|
+
1. **学科全能专家**
|
|
139
|
+
- 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
|
|
140
|
+
- 熟悉各年级课程标准与知识点分布
|
|
141
|
+
- 能准确识别题目考察的核心能力点(计算/推理/分析/应用/创新)
|
|
142
|
+
2. **题目变异大师**
|
|
143
|
+
- 掌握12种变式技法:条件替换/情境迁移/问题转化/数据重构/图形变形/角色反转/跨学科融合/难度阶梯/开放拓展/陷阱设计/逆向思维/生活应用
|
|
144
|
+
- 确保变式题目保持原题核心考点,改变题目表现形式
|
|
145
|
+
3. **学情分析师**
|
|
146
|
+
- 预判学生易错点(认知盲区/概念混淆/计算失误/审题偏差)
|
|
147
|
+
- 在变式题目中针对性强化易错点训练
|
|
148
|
+
### 执行流程
|
|
149
|
+
1. **接收任务**
|
|
150
|
+
原题: "{{original_question}}"
|
|
151
|
+
{{language_instruction}}
|
|
152
|
+
DIFFICULTY LEVEL: {{difficulty_level}}
|
|
153
|
+
{{difficulty_instruction}}
|
|
154
|
+
Knowledge Points: {{knowledge_points}}
|
|
155
|
+
2. **解构分析**
|
|
156
|
+
- 提取核心考点与能力要求
|
|
157
|
+
- 分析题目陷阱与解题路径
|
|
158
|
+
3. **质量管控**
|
|
159
|
+
- 确保每道题:
|
|
160
|
+
✓ 覆盖相同核心知识点
|
|
161
|
+
✓ 保持解题逻辑一致性
|
|
162
|
+
✓ 答案唯一且可验证
|
|
163
|
+
✓ 无知识性错误
|
|
164
|
+
### 输出规范
|
|
165
|
+
你的响应输出**必须严格遵循以下自定义标签格式**。**严禁**使用 JSON 或 Markdown 代码块。**严禁**返回 \`\`\`json ... \`\`\`。
|
|
166
|
+
|
|
167
|
+
请严格按照以下结构输出内容(不要包含任何其他文字):
|
|
168
|
+
|
|
169
|
+
<question_text>
|
|
170
|
+
在此处填写新生成的填空题或解答题。不要包含题号、分值或选择题选项。
|
|
171
|
+
</question_text>
|
|
172
|
+
|
|
173
|
+
<answer_text>
|
|
174
|
+
在此处填写新题目的正确答案。
|
|
175
|
+
</answer_text>
|
|
176
|
+
|
|
177
|
+
<analysis>
|
|
178
|
+
在此处填写新题目的详细解析。
|
|
179
|
+
* 必须使用简体中文。
|
|
180
|
+
* **直接使用标准的 LaTeX 符号**(如 $\frac{1}{2}$),**不要**进行 JSON 转义。
|
|
181
|
+
</analysis>
|
|
182
|
+
|
|
183
|
+
{{figure_instruction}}
|
|
184
|
+
|
|
185
|
+
###关键格式与内容约束 (CRITICAL RULES) !!!
|
|
186
|
+
1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
|
|
187
|
+
2. **LaTeX 规范**:
|
|
188
|
+
${eI}
|
|
189
|
+
|
|
190
|
+
{{grade_instruction}}
|
|
191
|
+
{{provider_hints}}`;var eE=e.i(67240);let ez=(0,m.default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);function eA({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function eD({config:e,onUpdate:a}){let{language:r,t:i}=(0,t.useLanguage)(),[n,l]=(0,g.useState)(""),[o,c]=(0,g.useState)("");(0,g.useEffect)(()=>{l(e.prompts?.analyze||eT),c(e.prompts?.similar||eL)},[e.prompts]);let d=async e=>{if(!await (0,ef.confirmDialog)(i.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0}))return;let s="analyze"===e?eT:eL;"analyze"===e?(l(s),a("analyze",s)):(c(s),a("similar",s))},m=(e,s)=>{"analyze"===e?(l(s),a("analyze",s)):(c(s),a("similar",s))},u=()=>(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,s.jsx)(C,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:i.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:i.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."})]})]});return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(N.Tabs,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(N.TabsList,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(N.TabsTrigger,{value:"analyze",children:i.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(N.TabsTrigger,{value:"similar",children:i.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(N.TabsContent,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(y.Label,{className:"text-base font-semibold",children:i.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>d("analyze"),children:[(0,s.jsx)(eE.RotateCcw,{className:"w-4 h-4 mr-2"}),i.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(u,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(ez,{className:"h-3.5 w-3.5"}),i.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eA,{name:"language_instruction",description:i.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eA,{name:"knowledge_points_list",description:i.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eA,{name:"provider_hints",description:i.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(ek.Textarea,{value:n,onChange:e=>m("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eT})]})}),(0,s.jsx)(N.TabsContent,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(y.Label,{className:"text-base font-semibold",children:i.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>d("similar"),children:[(0,s.jsx)(eE.RotateCcw,{className:"w-4 h-4 mr-2"}),i.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(u,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(ez,{className:"h-3.5 w-3.5"}),i.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eA,{name:"difficulty_level",description:i.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eA,{name:"difficulty_instruction",description:i.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eA,{name:"original_question",description:i.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eA,{name:"knowledge_points",description:i.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eA,{name:"language_instruction",description:i.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(ek.Textarea,{value:o,onChange:e=>m("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eL})]})})]})})}function eM({field:e,label:a,description:r}){let{t:i}=(0,t.useLanguage)(),[n,l]=(0,g.useState)(!1),[o,c]=(0,g.useState)(!1),[d,m]=(0,g.useState)(!1),[u,p]=(0,g.useState)(null),x=`preference-${e}`;(0,g.useEffect)(()=>{eg.apiClient.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>c(!0))},[e]);let h=async s=>{l(s),m(!0);try{await eg.apiClient.patch("/api/user",{[e]:s}),p(i.importFlow.preferenceSaved)}catch(t){l(!s),p(i.importFlow.preferenceSaveFailed),ev.frontendLogger.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(y.Label,{htmlFor:x,children:a}),(0,s.jsx)(el,{id:x,checked:n,onCheckedChange:h,disabled:!o||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function eR(){let{t:e}=(0,t.useLanguage)();return(0,s.jsx)(eM,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}function eP(){let{t:e}=(0,t.useLanguage)();return(0,s.jsx)(eM,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function e_(){let{t:e}=(0,t.useLanguage)();return(0,s.jsx)(eM,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eU({value:e,onChange:a}){let{t:r}=(0,t.useLanguage)(),[i,n]=(0,g.useState)(!1),l=(s,t)=>a({...e,[s]:t});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"API Key"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:i?"text":"password",value:e?.apiKey||"",onChange:e=>l("apiKey",e.target.value),placeholder:"sk-ant-...",className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>n(!i),"aria-label":i?"Hide API Key":"Show API Key",children:i?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"Base URL (Optional)"}),(0,s.jsx)(v.Input,{value:e?.baseUrl||"",onChange:e=>l("baseUrl",e.target.value),placeholder:"https://api.anthropic.com"}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r.settings?.ai?.anthropicBaseUrlHint})]}),(0,s.jsx)(ew,{provider:"anthropic",apiKey:e?.apiKey,baseUrl:e?.baseUrl,currentModel:e?.model,onModelChange:e=>l("model",e)})]})}function eK({provider:e,value:a,onChange:r}){let{t:i}=(0,t.useLanguage)(),[n,l]=(0,g.useState)(!1),o=ey[e],c=(e,s)=>r({...a,[e]:s});return(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"API Key"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:n?"text":"password",value:a?.apiKey||"",onChange:e=>c("apiKey",e.target.value),placeholder:"sk-...",className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>l(!n),"aria-label":n?"Hide API Key":"Show API Key",children:n?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]}),(0,s.jsxs)("p",{className:"text-xs text-muted-foreground",children:[i.settings?.ai?.vendorApiKeyHint||"Get an API key from the console:"," ",(0,s.jsx)("a",{href:o.consoleUrl,target:"_blank",rel:"noopener noreferrer",className:"underline break-all",children:o.consoleUrl})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"Base URL (Optional)"}),(0,s.jsx)(v.Input,{value:a?.baseUrl||"",onChange:e=>c("baseUrl",e.target.value),placeholder:o.baseUrl}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings?.ai?.vendorBaseUrlHint})]}),(0,s.jsx)(ew,{provider:e,apiKey:a?.apiKey,baseUrl:a?.baseUrl,currentModel:a?.model||o.model,onModelChange:e=>c("model",e)})]})}var eB=e.i(7364);function eF({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.useLanguage)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(y.Label,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(v.Input,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}let eO=(0,m.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function e$(){return window.WrongNotebookAndroid??null}let eq=()=>()=>void 0;function eV(){let{t:e}=(0,t.useLanguage)(),a=(0,g.useSyncExternalStore)(eq,e$,()=>null);return a?a.isStandalone?.()?(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:e.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"break-all",children:[e.settings?.about?.androidServer||"Server",": ",a.getServerUrl()]}),(0,s.jsxs)(f.Button,{variant:"outline",className:"gap-2",onClick:()=>a.changeServer(),children:[(0,s.jsx)(eO,{className:"h-4 w-4"}),e.settings?.about?.changeServer||"Change server"]})]}):null}let eH="https://github.com/margrop/wrong-notebook",eW=(0,m.default)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),eX=(0,m.default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),eY=(0,m.default)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),eZ=(0,m.default)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);function eG(){let{timeZone:e,setTimeZone:i}=(0,r.useTimeZone)(),{data:n}=(0,a.useSession)(),c=n?.user?.role==="admin",{t:d,language:m,setLanguage:u}=(0,t.useLanguage)(),[p,h]=(0,g.useState)(!1),B=(0,g.useRef)(null),[F,O]=(0,g.useState)(!1),[$,q]=(0,g.useState)(!1),[V,H]=(0,g.useState)(!1),[W,X]=(0,g.useState)(!1),[Y,Z]=(0,g.useState)(!1),[G,J]=(0,g.useState)(!1),[Q,ee]=(0,g.useState)(""),[es,et]=(0,g.useState)(!1),[ea,er]=(0,g.useState)({aiProvider:"minimax"}),[ei,en]=(0,g.useState)(void 0),[el,eo]=(0,g.useState)(!1),[ec,ed]=(0,g.useState)(null),[em,eu]=(0,g.useState)({name:"",email:"",educationStage:"",enrollmentYear:"",password:""}),[ep,ex]=(0,g.useState)(""),[eh,ek]=(0,g.useState)(!1),[eS,eC]=(0,g.useState)(!1),[eI,eT]=(0,g.useState)(!1),[eL,eE]=(0,g.useState)(!1),[eA,eM]=(0,g.useState)(!1),[eO,e$]=(0,g.useState)(!1),[eq,eG]=(0,g.useState)(null),[eJ,eQ]=(0,g.useState)(""),e0=(0,l.useRouter)();(0,g.useEffect)(()=>{p&&(e1(),e2()),fetch("/api/version").then(e=>e.json()).then(e=>ee(e.version)).catch(()=>{})},[p]);let e1=async()=>{J(!0);try{let e=await eg.apiClient.get("/api/settings");er(e)}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to fetch settings",{error:e instanceof Error?e.message:String(e)})}finally{J(!1)}},e2=async()=>{ek(!0);try{let e=await eg.apiClient.get("/api/user");eu({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to fetch profile",{error:e instanceof Error?e.message:String(e)})}finally{ek(!1)}},e4=async()=>{if(!(0,K.isValidTimeZone)(ea.timeZone??K.DEFAULT_TIME_ZONE))return void ef.toast.error(d.settings.general.invalidTimeZone);let e=(()=>{if("openai"!==ea.aiProvider)return null;for(let e of ea.openai?.instances||[]){if(!e.name?.trim())return d.settings?.ai?.validationNameRequired||"实例名称不能为空";if(!e.apiKey?.trim())return d.settings?.ai?.validationApiKeyRequired||"API Key 不能为空";if(!e.baseUrl?.trim())return d.settings?.ai?.validationBaseUrlRequired||"Base URL 不能为空";if(!e.model?.trim())return d.settings?.ai?.validationModelRequired||"模型名称不能为空"}return null})();if(e)return void ef.toast.error(e);let s="azure"!==ea.aiProvider?null:ea.azure?.endpoint?.trim()?ea.azure?.deploymentName?.trim()?ea.azure?.apiKey?.trim()?null:d.settings?.ai?.validationApiKeyRequired||"API Key is required":d.settings?.ai?.validationAzureDeploymentRequired||"Deployment Name is required":d.settings?.ai?.validationAzureEndpointRequired||"Azure Endpoint is required";if(s)return void ef.toast.error(s);Z(!0);try{let e=await eg.apiClient.post("/api/settings",ea);er(e),i(e.timeZone||K.DEFAULT_TIME_ZONE),ef.toast.success(d.settings?.messages?.saved||"Settings saved"),B.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to save settings",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.messages?.saveFailed||"Failed to save")}finally{Z(!1)}},e3=async()=>{eC(!0);try{if(em.password&&em.password!==ep){ef.toast.error(d.settings?.messages?.passwordMismatch||"Passwords do not match"),eC(!1);return}let e={name:em.name,email:em.email,educationStage:em.educationStage};em.enrollmentYear&&(e.enrollmentYear=parseInt(em.enrollmentYear.toString())),em.password&&(e.password=em.password),await eg.apiClient.patch("/api/user",e),ef.toast.success(d.settings?.messages?.profileUpdated||"Profile updated"),eu(e=>({...e,password:""})),ex(""),eT(!1),eE(!1),window.location.reload()}catch(s){ev.frontendLogger.error("[SettingsDialog]","Failed to update profile",{error:s?.data?.message||s?.message||String(s)});let e=s.data?.message||d.settings?.messages?.updateFailed||"Update failed";ef.toast.error(e)}finally{eC(!1)}},e5=async()=>{if(await (0,ef.confirmDialog)(d.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})){O(!0);try{await eg.apiClient.delete("/api/stats/practice/clear"),ef.toast.success(d.settings?.clearSuccess||"Success"),h(!1),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to clear practice data",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed")}finally{O(!1)}}},e6=async()=>{if(await (0,ef.confirmDialog)(d.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})){q(!0);try{await eg.apiClient.delete("/api/error-items/clear"),ef.toast.success(d.settings?.clearSuccess||"Success"),h(!1),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","Failed to clear error data",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed")}finally{q(!1)}}},e8=async()=>{if(!await (0,ef.confirmDialog)(d.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(d.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&ef.toast.error(d.common?.error||"Confirmation failed");return}H(!0);try{await eg.apiClient.post("/api/admin/system-reset",{}),ef.toast.success(d.settings?.clearSuccess||"Success - System Reset Complete"),h(!1),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","System reset failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed to reset system")}finally{H(!1)}},e7=async()=>{eM(!0);try{let e=await fetch("/api/export");if(!e.ok)throw Error("Export failed");let s=await e.blob(),t=window.URL.createObjectURL(s),a=document.createElement("a");a.href=t;let r=e.headers.get("Content-Disposition"),i=r?.match(/filename="(.+)"/);a.download=i?i[1]:"wrong-notebook-export.json",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(t),ef.toast.success(d.settings?.exportSuccess||"Export successful")}catch(e){ev.frontendLogger.error("[SettingsDialog]","Export failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.exportFailed||"Export failed")}finally{eM(!1)}},e9=async()=>{if(await (0,ef.confirmDialog)(d.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){eM(!0);try{let e=await fetch("/api/export?all=true");if(!e.ok){let s=await e.json();throw Error(s.message||"Export failed")}let s=await e.blob(),t=window.URL.createObjectURL(s),a=document.createElement("a");a.href=t;let r=e.headers.get("Content-Disposition"),i=r?.match(/filename="(.+)"/);a.download=i?i[1]:"wrong-notebook-export-all.json",document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(t),ef.toast.success(d.settings?.exportSuccess||"Export successful")}catch(e){ev.frontendLogger.error("[SettingsDialog]","Export all failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.exportFailed||"Export failed")}finally{eM(!1)}}},se=async()=>{if(eq&&await (0,ef.confirmDialog)(d.settings?.importConfirm||"Are you sure you want to import?")){e$(!0);try{let e=await eq.text(),s=JSON.parse(e),t=(await eg.apiClient.post("/api/import",s)).stats;ef.toast.success((d.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{duplicates}",String(t.duplicateErrorItems??0))),eG(null),eQ(""),window.location.reload()}catch(e){ev.frontendLogger.error("[SettingsDialog]","Import failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.importFailed||"Import failed")}finally{e$(!1)}}},ss=async()=>{if(eq&&await (0,ef.confirmDialog)(d.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.")){e$(!0);try{let e=await eq.text(),s=JSON.parse(e),t=await fetch("/api/import?all=true",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),a=await t.json();if(a.success){let e=a.stats;ef.toast.success((d.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records.").replace("{subjects}",String(e.subjectsCreated)).replace("{tags}",String(e.tagsCreated)).replace("{items}",String(e.errorItemsCreated)).replace("{schedules}",String(e.reviewSchedulesCreated)).replace("{records}",String(e.practiceRecordsCreated)).replace("{duplicates}",String(e.duplicateErrorItems??0))),eG(null),eQ(""),window.location.reload()}else throw Error(a.message||"Import failed")}catch(e){ev.frontendLogger.error("[SettingsDialog]","Import all failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.importFailed||"Import failed")}finally{e$(!1)}}},st=async()=>{if(await (0,ef.confirmDialog)(d.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})){X(!0);try{let e=await eg.apiClient.post("/api/admin/migrate-tags",{});ef.toast.success(`${d.settings?.clearSuccess||"Success"}: ${e.count||0} tags migrated.`)}catch(e){ev.frontendLogger.error("[SettingsDialog]","Tag migration failed",{error:e instanceof Error?e.message:String(e)}),ef.toast.error(d.settings?.clearError||"Failed to migrate tags")}finally{X(!1)}}},sa=(e,s,t)=>{"gemini"===e&&er(e=>({...e,gemini:{...e.gemini,[s]:t}}))},sr=()=>{let e=ea.openai?.instances||[],s=ei||ea.openai?.activeInstanceId;return e.find(e=>e.id===s)},si=(e,s)=>{let t=ea.openai?.instances||[],a=ei||ea.openai?.activeInstanceId,r=t.map(t=>t.id===a?{...t,[e]:s}:t);er(e=>({...e,openai:{...e.openai,instances:r}}))};(0,g.useEffect)(()=>{ea.openai?.activeInstanceId&&!ei&&en(ea.openai.activeInstanceId)},[ea.openai?.activeInstanceId,ei]);let sn=async()=>{eo(!0),ed(null);try{let e;if("openai"===ea.aiProvider){let s=sr();if(!s?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:"openai",apiKey:s.apiKey,baseUrl:s.baseUrl,model:s.model,language:m}}else if("gemini"===ea.aiProvider){if(!ea.gemini?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:"gemini",apiKey:ea.gemini.apiKey,baseUrl:ea.gemini.baseUrl,model:ea.gemini.model,language:m}}else if("anthropic"===ea.aiProvider){if(!ea.anthropic?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:"anthropic",apiKey:ea.anthropic.apiKey,baseUrl:ea.anthropic.baseUrl,model:ea.anthropic.model,language:m}}else if(eN(ea.aiProvider)){let s=ea[ea.aiProvider];if(!s?.apiKey){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationApiKeyRequired||"API Key is required"}),eo(!1);return}e={provider:ea.aiProvider,apiKey:s.apiKey,baseUrl:s.baseUrl,model:s.model,language:m}}else{if("azure"!==ea.aiProvider)return void eo(!1);if(!ea.azure?.apiKey||!ea.azure?.endpoint||!ea.azure?.deploymentName){ed({success:!1,textSupport:!1,visionSupport:!1,textError:d.settings?.ai?.validationAzureEndpointRequired||"Azure config is incomplete"}),eo(!1);return}e={provider:"azure",apiKey:ea.azure.apiKey,endpoint:ea.azure.endpoint,deploymentName:ea.azure.deploymentName,apiVersion:ea.azure.apiVersion,model:ea.azure.model,language:m}}let s=await eg.apiClient.post("/api/ai/test",e);ed(s)}catch(e){ev.frontendLogger.error("[SettingsDialog]","AI connection test failed",{error:e instanceof Error?e.message:String(e)}),ed({success:!1,textSupport:!1,visionSupport:!1,textError:e instanceof Error?e.message:String(e)})}finally{eo(!1)}};return(0,s.jsxs)(j.Dialog,{open:p,onOpenChange:h,children:[(0,s.jsx)(j.DialogTrigger,{asChild:!0,children:(0,s.jsxs)(f.Button,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(w,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:d.settings?.title||"Settings"})]})}),(0,s.jsxs)(j.DialogContent,{ref:B,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsx)(j.DialogTitle,{children:d.settings?.title||"Settings"}),(0,s.jsx)(j.DialogDescription,{children:d.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(N.Tabs,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(N.TabsList,{className:`grid w-full grid-cols-4 ${n?.user?.role==="admin"?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsxs)(N.TabsTrigger,{value:"general",className:"px-2 sm:px-3",children:[(0,s.jsx)(L.Languages,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.general||"General"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"account",className:"px-2 sm:px-3",children:[(0,s.jsx)(E.User,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.account||"Account"})]}),n?.user?.role==="admin"&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(N.TabsTrigger,{value:"ai",className:"px-2 sm:px-3",children:[(0,s.jsx)(z,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.ai||"AI Provider"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"prompts",className:"px-2 sm:px-3",children:[(0,s.jsx)(eW,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.prompts||"Prompts"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"admin",className:"px-2 sm:px-3",children:[(0,s.jsx)(x,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.admin||"User Management"})]})]}),(0,s.jsxs)(N.TabsTrigger,{value:"danger",className:"px-2 sm:px-3",children:[(0,s.jsx)(C,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.danger||"Danger"})]}),(0,s.jsxs)(N.TabsTrigger,{value:"about",className:"px-2 sm:px-3",children:[(0,s.jsx)(ez,{className:"h-4 w-4 sm:mr-2"}),(0,s.jsx)("span",{className:"hidden sm:inline",children:d.settings?.tabs?.about||"About"})]})]}),(0,s.jsxs)(N.TabsContent,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.language||"Language"}),(0,s.jsxs)(b.Select,{value:m,onValueChange:e=>u(e),children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{})}),(0,s.jsxs)(b.SelectContent,{children:[(0,s.jsx)(b.SelectItem,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(b.SelectItem,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eF,{value:ea.timeZone??e,onChange:e=>er(s=>({...s,timeZone:e})),disabled:!c||G||Y}),c&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(y.Label,{children:d.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(v.Input,{type:"number",value:ea.timeouts?.analyze?ea.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);er(e=>({...e,timeouts:{...e.timeouts,analyze:isNaN(s)?0:1e3*s}}))},onBlur:()=>{let e=(ea.timeouts?.analyze||0)/1e3,s=e;s<120&&(s=120),s>600&&(s=600),s!==e&&er(e=>({...e,timeouts:{...e.timeouts,analyze:1e3*s}}))},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:d.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(eR,{}),(0,s.jsx)(e_,{}),(0,s.jsx)(eP,{}),(0,s.jsx)(eB.DuplicateThresholdSetting,{})]}),c&&(0,s.jsxs)(f.Button,{onClick:e4,disabled:Y,className:"w-full",children:[Y&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.save||"Save Settings"]})]}),(0,s.jsx)(N.TabsContent,{value:"account",className:"space-y-4 py-4",children:eh?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(S.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.name||"Name"}),(0,s.jsx)(v.Input,{value:em.name||"",onChange:e=>eu({...em,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.email||"Email"}),(0,s.jsx)(v.Input,{value:em.email||"",onChange:e=>eu({...em,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(b.Select,{value:em.educationStage||"",onValueChange:e=>eu({...em,educationStage:e}),children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{placeholder:d.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(b.SelectContent,{children:[(0,s.jsx)(b.SelectItem,{value:"primary",children:d.auth?.primary||"Primary School"}),(0,s.jsx)(b.SelectItem,{value:"junior_high",children:d.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(b.SelectItem,{value:"senior_high",children:d.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(b.SelectItem,{value:"university",children:d.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(v.Input,{type:"number",value:em.enrollmentYear||"",onChange:e=>eu({...em,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:eI?"text":"password",value:em.password,onChange:e=>eu({...em,password:e.target.value}),placeholder:"******",minLength:6,className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>eT(!eI),tabIndex:-1,children:eI?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),em.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.auth?.confirmPassword||"Confirm Password"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:eL?"text":"password",value:ep,onChange:e=>ex(e.target.value),placeholder:"******",minLength:6,className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>eE(!eL),tabIndex:-1,children:eL?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]})]}),(0,s.jsxs)(f.Button,{onClick:e3,disabled:eS,className:"w-full",children:[eS&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.account?.update||"Update Profile"]})]})}),(0,s.jsx)(N.TabsContent,{value:"ai",className:"space-y-4 py-4",children:G?(0,s.jsx)("div",{className:"flex justify-center py-4",children:(0,s.jsx)(S.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.tabs?.ai||"AI Provider"}),(0,s.jsxs)(b.Select,{value:ea.aiProvider,onValueChange:e=>er(s=>({...s,aiProvider:e})),children:[(0,s.jsx)(b.SelectTrigger,{children:(0,s.jsx)(b.SelectValue,{})}),(0,s.jsxs)(b.SelectContent,{children:[eb.map(e=>(0,s.jsx)(b.SelectItem,{value:e,children:ey[e].name},e)),(0,s.jsx)(b.SelectItem,{value:"anthropic",children:"Anthropic / Compatible"}),(0,s.jsx)(b.SelectItem,{value:"azure",children:"Azure OpenAI"}),(0,s.jsx)(b.SelectItem,{value:"openai",children:"OpenAI / Compatible"}),(0,s.jsx)(b.SelectItem,{value:"gemini",children:"Google Gemini"})]})]})]}),"openai"===ea.aiProvider&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(y.Label,{children:d.settings?.ai?.instances||"Instance"}),(0,s.jsxs)(f.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>{let e=ea.openai?.instances||[];if(e.length>=10)return;let s={id:"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let s=16*Math.random()|0;return("x"===e?s:3&s|8).toString(16)}),name:`Instance ${e.length+1}`,apiKey:"",baseUrl:"https://api.openai.com/v1",model:"gpt-6.1-sol"};er(e=>({...e,openai:{instances:[...e.openai?.instances||[],s],activeInstanceId:s.id}})),en(s.id)},disabled:(ea.openai?.instances?.length||0)>=10,className:"h-7 px-2 text-xs",children:[(0,s.jsx)(D.Plus,{className:"h-3 w-3 mr-1"}),d.settings?.ai?.addInstance||"Add"]})]}),(ea.openai?.instances?.length||0)>0?(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(b.Select,{value:ei||ea.openai?.activeInstanceId||"",onValueChange:e=>{en(e),er(s=>({...s,openai:{...s.openai,activeInstanceId:e}}))},children:[(0,s.jsx)(b.SelectTrigger,{className:"flex-1",children:(0,s.jsx)(b.SelectValue,{placeholder:d.settings?.ai?.selectInstance||"Select Instance"})}),(0,s.jsx)(b.SelectContent,{children:(ea.openai?.instances||[]).map(e=>(0,s.jsx)(b.SelectItem,{value:e.id,children:e.name},e.id))})]}),(ea.openai?.instances?.length||0)>1&&(0,s.jsx)(f.Button,{type:"button",variant:"outline",size:"icon",onClick:async()=>{let e,s,t=ei||ea.openai?.activeInstanceId;t&&await (0,ef.confirmDialog)(d.settings?.ai?.confirmDelete||"Delete this instance?",{destructive:!0})&&(s=(e=(ea.openai?.instances||[]).filter(e=>e.id!==t)).length>0?e[0].id:void 0,er(t=>({...t,openai:{instances:e,activeInstanceId:s}})),en(s))},className:"h-10 w-10 text-destructive hover:text-destructive",children:(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:d.settings?.ai?.noInstances||"No instances configured. Click 'Add' to create one."}),(ea.openai?.instances?.length||0)>=10&&(0,s.jsx)("p",{className:"text-xs text-amber-600",children:d.settings?.ai?.maxInstancesReached||"Maximum instances reached (10)"})]}),sr()&&(0,s.jsxs)("div",{className:"space-y-3 p-3 border rounded-md bg-background",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:[d.settings?.ai?.instanceName||"Instance Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:sr()?.name||"",onChange:e=>si("name",e.target.value),placeholder:"e.g. 智谱 GLM-4V",className:sr()?.name?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:es?"text":"password",value:sr()?.apiKey||"",onChange:e=>si("apiKey",e.target.value),placeholder:"sk-...",className:`pr-10 ${!sr()?.apiKey?.trim()?"border-destructive":""}`}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>et(!es),children:es?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)(y.Label,{children:["Base URL ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:sr()?.baseUrl||"",onChange:e=>si("baseUrl",e.target.value),placeholder:"https://api.openai.com/v1",className:sr()?.baseUrl?.trim()?"":"border-destructive"})]}),(0,s.jsx)(ew,{provider:"openai",apiKey:sr()?.apiKey,baseUrl:sr()?.baseUrl,currentModel:sr()?.model,onModelChange:e=>si("model",e)})]})]}),"gemini"===ea.aiProvider&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"API Key"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:es?"text":"password",value:ea.gemini?.apiKey||"",onChange:e=>sa("gemini","apiKey",e.target.value),placeholder:"AIza...",className:"pr-10"}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>et(!es),children:es?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:"Base URL (Optional)"}),(0,s.jsx)(v.Input,{value:ea.gemini?.baseUrl||"",onChange:e=>sa("gemini","baseUrl",e.target.value),placeholder:"https://generativelanguage.googleapis.com"})]}),(0,s.jsx)(ew,{provider:"gemini",apiKey:ea.gemini?.apiKey,baseUrl:ea.gemini?.baseUrl,currentModel:ea.gemini?.model,onModelChange:e=>sa("gemini","model",e)})]}),"anthropic"===ea.aiProvider&&(0,s.jsx)(eU,{value:ea.anthropic,onChange:e=>er(s=>({...s,anthropic:e}))}),eN(ea.aiProvider)&&(0,s.jsx)(eK,{provider:ea.aiProvider,value:ea[ea.aiProvider],onChange:e=>er(s=>({...s,[s.aiProvider]:e}))},ea.aiProvider),"azure"===ea.aiProvider&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:[d.settings?.ai?.azureEndpoint||"Azure Endpoint"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:ea.azure?.endpoint||"",onChange:e=>er(s=>({...s,azure:{...s.azure,endpoint:e.target.value}})),placeholder:d.settings?.ai?.azureEndpointPlaceholder||"https://your-resource.openai.azure.com",className:ea.azure?.endpoint?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:[d.settings?.ai?.azureDeployment||"Deployment Name"," ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsx)(v.Input,{value:ea.azure?.deploymentName||"",onChange:e=>er(s=>({...s,azure:{...s.azure,deploymentName:e.target.value}})),placeholder:d.settings?.ai?.azureDeploymentPlaceholder||"gpt-4o-deployment",className:ea.azure?.deploymentName?.trim()?"":"border-destructive"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(y.Label,{children:["API Key ",(0,s.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(v.Input,{type:es?"text":"password",value:ea.azure?.apiKey||"",onChange:e=>er(s=>({...s,azure:{...s.azure,apiKey:e.target.value}})),placeholder:"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",className:`pr-10 ${!ea.azure?.apiKey?.trim()?"border-destructive":""}`}),(0,s.jsx)(f.Button,{type:"button",variant:"ghost",size:"icon",className:"absolute right-0 top-0 h-full px-3 py-2 hover:bg-transparent",onClick:()=>et(!es),children:es?(0,s.jsx)(T.EyeOff,{className:"h-4 w-4 text-muted-foreground"}):(0,s.jsx)(I.Eye,{className:"h-4 w-4 text-muted-foreground"})})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.ai?.azureApiVersion||"API Version"}),(0,s.jsx)(v.Input,{value:ea.azure?.apiVersion||"",onChange:e=>er(s=>({...s,azure:{...s.azure,apiVersion:e.target.value}})),placeholder:d.settings?.ai?.azureApiVersionPlaceholder||"2024-02-15-preview"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(y.Label,{children:d.settings?.ai?.azureModel||"Model Display Name"}),(0,s.jsx)(v.Input,{value:ea.azure?.model||"",onChange:e=>er(s=>({...s,azure:{...s.azure,model:e.target.value}})),placeholder:"gpt-4o"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-3 border-t",children:[(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsxs)(f.Button,{type:"button",variant:"outline",onClick:sn,disabled:el||Y,className:"flex-1",children:[el?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(M,{className:"mr-2 h-4 w-4"}),el?d.settings?.ai?.testing||"测试中...":d.settings?.ai?.testConnection||"测试连接"]}),(0,s.jsxs)(f.Button,{onClick:e4,disabled:Y||el,className:"flex-1",children:[Y&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.ai?.save||"Save AI Settings"]})]}),ec&&(0,s.jsxs)("div",{className:`p-3 rounded-md text-sm ${ec.success?"bg-green-50 border border-green-200":"bg-red-50 border border-red-200"}`,children:[(0,s.jsx)("div",{className:"flex items-center gap-2 font-medium mb-2",children:ec.success?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(R,{className:"h-4 w-4 text-green-600"}),(0,s.jsx)("span",{className:"text-green-700",children:d.settings?.ai?.testSuccess||"连接成功"}),ec.modelInfo&&(0,s.jsxs)("span",{className:"text-green-600 text-xs",children:["(",ec.modelInfo,")"]})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(P.XCircle,{className:"h-4 w-4 text-red-600"}),(0,s.jsx)("span",{className:"text-red-700",children:d.settings?.ai?.testFailed||"连接失败"})]})}),ec.success&&(0,s.jsxs)("div",{className:"space-y-1 text-xs",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[d.settings?.ai?.textSupport||"文本生成",":"]}),(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",d.settings?.ai?.supported||"支持"]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)("span",{className:"text-muted-foreground",children:[d.settings?.ai?.visionSupport||"图像识别/多模态",":"]}),ec.visionSupport?(0,s.jsxs)("span",{className:"text-green-600",children:["✓ ",d.settings?.ai?.supported||"支持"]}):(0,s.jsxs)("span",{className:"text-amber-600",children:["✗ ",ec.visionError?d.settings?.ai?.errors?.[ec.visionError]||ec.visionError.replace("UNKNOWN:",""):d.settings?.ai?.notSupported||"不支持"]})]}),(0,s.jsx)("p",{className:"text-muted-foreground/60 text-[10px] pl-1",children:"* 由于网络问题,可能测试结果不准确"})]}),!ec.success&&ec.textError&&(0,s.jsx)("p",{className:"text-red-600 text-xs mt-1",children:d.settings?.ai?.errors?.[ec.textError]||ec.textError.replace("UNKNOWN:","")})]})]})]})}),(0,s.jsxs)(N.TabsContent,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eD,{config:ea,onUpdate:(e,s)=>{er(t=>({...t,prompts:{...t.prompts,[e]:s}}))}}),(0,s.jsxs)(f.Button,{onClick:e4,disabled:Y,className:"w-full",children:[Y&&(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),d.settings?.prompts?.save||"Save Prompt Settings"]})]}),n?.user?.role==="admin"&&(0,s.jsxs)(N.TabsContent,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(f.Button,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{h(!1),e0.push("/admin")},children:[(0,s.jsx)(o.BarChart3,{className:"h-4 w-4"}),d.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(ej,{})})]}),(0,s.jsx)(N.TabsContent,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:d.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:e7,disabled:eA,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[eA?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(_.Download,{className:"mr-2 h-4 w-4"}),d.settings?.exportData||"Export"]}),n?.user?.role==="admin"&&(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:e9,disabled:eA,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[eA?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(_.Download,{className:"mr-2 h-4 w-4"}),d.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:d.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>{let s=e.target.files?.[0];s&&(eG(s),eQ(s.name))},className:"hidden",id:"import-file-input",disabled:eO}),(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:eO,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[eO?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(U,{className:"mr-2 h-4 w-4"}),eJ||d.settings?.selectFile||"Select File"]}),eq&&(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:se,disabled:eO,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[eO?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(R,{className:"mr-2 h-4 w-4"}),d.settings?.importData||"Import"]}),eq&&n?.user?.role==="admin"&&(0,s.jsxs)(f.Button,{variant:"outline",size:"sm",onClick:ss,disabled:eO,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[eO?(0,s.jsx)(S.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(R,{className:"mr-2 h-4 w-4"}),d.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:d.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]}),n?.user?.role==="admin"&&(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsxs)("span",{className:"text-sm text-blue-900 font-bold flex items-center gap-2",children:[(0,s.jsx)(A.RefreshCw,{className:"h-4 w-4"}),d.settings?.migrateTags||"Migrate Tags"]})}),(0,s.jsx)(f.Button,{variant:"outline",size:"sm",onClick:st,disabled:W,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:W?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(A.RefreshCw,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-blue-800 mt-2 font-medium",children:d.settings?.migrateTagsDesc||"Re-populates standard tags from file"})]}),(0,s.jsxs)("div",{className:"p-4 border border-red-200 rounded-lg bg-red-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-red-700 font-medium",children:d.settings?.clearData||"Clear Practice Data"}),(0,s.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:e5,disabled:F,children:F?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-red-600 mt-2",children:d.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible."})]}),(0,s.jsxs)("div",{className:"p-4 border border-red-200 rounded-lg bg-red-50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-sm text-red-700 font-medium",children:d.settings?.clearErrorData||"Clear Error Data"}),(0,s.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:e6,disabled:$,children:$?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-red-600 mt-2",children:d.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible."})]}),n?.user?.role==="admin"&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"p-4 border border-red-600/50 rounded-lg bg-red-100/50",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("div",{className:"flex flex-col",children:(0,s.jsxs)("span",{className:"text-sm text-red-900 font-bold flex items-center gap-2",children:[(0,s.jsx)(C,{className:"h-4 w-4"}),d.settings?.systemReset||"System Initialization"]})}),(0,s.jsx)(f.Button,{variant:"destructive",size:"sm",onClick:e8,disabled:V,className:"bg-red-700 hover:bg-red-800",children:V?(0,s.jsx)(S.Loader2,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(k.Trash2,{className:"h-4 w-4"})})]}),(0,s.jsx)("p",{className:"text-xs text-red-800 mt-2 font-medium",children:d.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data."})]})})]})}),(0,s.jsx)(N.TabsContent,{value:"about",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:d.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:d.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,s.jsx)(ez,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[d.settings?.about?.version||"Version",": v",Q||"unknown"]})]}),(0,s.jsx)(eV,{}),(0,s.jsxs)("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:[(0,s.jsx)(f.Button,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:eH,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(eY,{className:"h-4 w-4"}),d.settings?.about?.github||"GitHub Repository",(0,s.jsx)(eX,{className:"h-3 w-3 ml-1 opacity-50"})]})}),(0,s.jsx)(f.Button,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:`${eH}/releases`,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(eZ,{className:"h-4 w-4"}),d.settings?.about?.releaseNotes||"Release Notes",(0,s.jsx)(eX,{className:"h-3 w-3 ml-1 opacity-50"})]})}),(0,s.jsx)(f.Button,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:`${eH}/issues`,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(eW,{className:"h-4 w-4"}),d.settings?.about?.feedback||"Feedback",(0,s.jsx)(eX,{className:"h-3 w-3 ml-1 opacity-50"})]})})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:d.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})})]})]})]})}let eJ=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eQ=[{key:"home",href:"/",icon:p,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:c.BookOpen,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"tags",href:"/tags",icon:h,match:e=>e.startsWith("/tags")},{key:"stats",href:"/stats",icon:o.BarChart3,match:e=>e.startsWith("/stats")},{key:"exams",href:"/exams",icon:d.FileText,match:e=>e.startsWith("/exams")}];function e0({children:e}){let r=(0,l.usePathname)()||"/",{t:o}=(0,t.useLanguage)(),{data:c,status:d}=(0,a.useSession)();if(eJ.some(e=>e.test(r))||"unauthenticated"===d)return(0,s.jsx)(s.Fragment,{children:e});let m=c?.user?.role==="admin",p=c?.user?.name||c?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,s.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:o.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eQ.map(e=>{let t=e.match(r),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,en.cn)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),o.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[p&&(0,s.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,s.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:p.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:p})]}),m&&(0,s.jsx)(n.default,{href:"/admin",title:o.nav.admin,children:(0,s.jsxs)(f.Button,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(x,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.nav.admin})]})}),(0,s.jsx)(eG,{}),(0,s.jsx)(f.Button,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:o.app.logout,children:(0,s.jsx)(u,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eQ.map(e=>{let t=e.match(r),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,en.cn)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,en.cn)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),o.nav[e.key]]},e.key)})})})]})}let e1=(0,m.default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]),e2=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function e4(){let{t:e}=(0,t.useLanguage)(),{timeZone:i}=(0,r.useTimeZone)(),{status:o}=(0,a.useSession)(),c=(0,l.usePathname)(),[d,m]=(0,g.useState)(!1),[u,p]=(0,g.useState)([]),[x,h]=(0,g.useState)(()=>Date.now()),v="authenticated"!==o||e2.some(e=>e.test(c||"")),y=(0,g.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await eg.apiClient.get("/api/tasks");p(e.tasks),h(Date.now())}catch{}},[]);if((0,g.useEffect)(()=>{if(v)return;let e=setTimeout(y,0),s=setInterval(y,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[v,d,y]),v)return null;let b=u.filter(e=>"running"===e.status).length,N=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await eg.apiClient.delete("/api/tasks");p(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(f.Button,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[b>0?(0,s.jsx)(S.Loader2,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(e1,{className:"h-5 w-5"}),b>0&&(0,s.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:b})]}),(0,s.jsx)(j.Dialog,{open:d,onOpenChange:m,children:(0,s.jsxs)(j.DialogContent,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsx)(j.DialogTitle,{children:e.backgroundTasks.title}),(0,s.jsx)(j.DialogDescription,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(S.Loader2,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(R,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(P.XCircle,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,K.formatDateTime)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):x)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),N&&(0,s.jsx)(f.Button,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var e3=e.i(37727);let e5={success:{icon:R,className:"text-success"},error:{icon:P.XCircle,className:"text-destructive"},warning:{icon:C,className:"text-warning"},info:{icon:ez,className:"text-primary"}};function e6(){let{t:e}=(0,t.useLanguage)(),[a,r]=(0,g.useState)([]),[i,n]=(0,g.useState)(null);return(0,g.useEffect)(()=>(0,ef.subscribeFeedback)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:a.map(t=>{let{icon:a,className:r}=e5[t.type];return(0,s.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,s.jsx)(a,{className:(0,en.cn)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,ef.dismissToast)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(e3.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(j.Dialog,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(j.DialogContent,{className:"sm:max-w-md",children:[(0,s.jsxs)(j.DialogHeader,{children:[(0,s.jsxs)(j.DialogTitle,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(C,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(j.DialogDescription,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(j.DialogFooter,{className:"gap-2",children:[(0,s.jsx)(f.Button,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(f.Button,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}function e8(){return(0,g.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(e=>{ev.frontendLogger.warn("[PWA]","Service worker registration failed",{error:String(e)})})},[]),null}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.LanguageProvider,{children:(0,s.jsxs)(r.TimeZoneProvider,{initialTimeZone:i,children:[(0,s.jsx)(e0,{children:e}),(0,s.jsx)(e4,{}),(0,s.jsx)(e6,{}),(0,s.jsx)(e8,{})]})})})}],1661)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],71689)},3116,e=>{"use strict";let t=(0,e.i(75254).default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["Clock",0,t],3116)},56909,e=>{"use strict";let t=(0,e.i(75254).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],56909)},8821,e=>{"use strict";let t=(0,e.i(75254).default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);e.s(["default",0,t])},91686,68983,e=>{"use strict";var t=e.i(18050),a=e.i(71645),s=e.i(22016),r=e.i(15519),i=e.i(30691),n=e.i(64659),l=e.i(55900),d=e.i(31278),c=e.i(7233),o=e.i(83086),m=e.i(27612),u=e.i(87486),x=e.i(19455),h=e.i(15288),g=e.i(11445),p=e.i(56909),f=e.i(93479),y=e.i(93733),b=e.i(11110),j=e.i(41931);function v({errorItemId:e,onSaved:s,onCancel:n}){let{t:l}=(0,b.useLanguage)(),{timeZone:c}=(0,r.useTimeZone)(),o=(0,i.formatDateTime)(new Date,"yyyy-MM-dd",c),[m,u]=(0,a.useState)(null),[h,g]=(0,a.useState)(o),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),T=async()=>{if(m&&h){w(!0),C(null);try{await j.apiClient.post("/api/practice/record",{errorItemId:e,result:m,source:"manual",takenAt:(0,i.answeredDateToISOString)(h,c)}),s()}catch{C(l.mastery.resultSaveFailed)}finally{w(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3 rounded-md border bg-muted/30 p-3",children:[(0,t.jsx)(y.PracticeResultPicker,{value:m,onChange:u,disabled:N}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:`practice-date-${e}`,className:"text-sm font-medium",children:l.mastery.recordDate}),(0,t.jsx)(f.Input,{id:`practice-date-${e}`,type:"date",value:h,max:o,onChange:e=>g(e.target.value),className:"sm:w-48"}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:n,disabled:N,className:"flex-1 sm:flex-none",children:l.exam.cancel}),(0,t.jsxs)(x.Button,{size:"sm",onClick:T,disabled:N||!m||!h,className:"flex-1 sm:flex-none",children:[N?(0,t.jsx)(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(p.Save,{className:"mr-2 h-4 w-4"}),l.mastery.saveResult]})]})]}),k&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:k})]})}var N=e.i(49704),w=e.i(94114);let k={correct:"bg-green-100 text-green-700 border-green-200",wrong:"bg-red-100 text-red-700 border-red-200",not_attempted:"bg-amber-100 text-amber-700 border-amber-200"};e.s(["MasteryPanel",0,function({errorItemId:e,onMasteryStatusChange:p}){let{timeZone:f}=(0,r.useTimeZone)(),{t:y}=(0,b.useLanguage)(),[C,T]=(0,a.useState)(null),[S,M]=(0,a.useState)(null),[R,A]=(0,a.useState)(0),[L,$]=(0,a.useState)(!1),B=(0,a.useCallback)(()=>{j.apiClient.get(`/api/error-items/${e}/practice-records`).then(e=>{T(e),p?.(e.masteryStatus)}).catch(()=>void 0)},[e,p]);(0,a.useEffect)(B,[B]);let D=()=>{A(0),B()},E=async e=>{if(await (0,w.confirmDialog)(y.mastery.deleteRecordConfirm,{destructive:!0}))try{await j.apiClient.delete(`/api/practice/record/${e}`),D()}catch{w.toast.error(y.mastery.deleteRecordFailed)}},H=C?.records[0],P=!!H&&(!C?.masteryEvaluatedAt||new Date(H.createdAt)>new Date(C.masteryEvaluatedAt));if((0,a.useEffect)(()=>{if(!P||R>=20)return;let e=setTimeout(()=>{A(e=>e+1),B()},4e3);return()=>clearTimeout(e)},[P,R,B]),!C)return null;let I=C.masteryProbability,U=null===I?null:Math.round(100*I),_=null===U?"":null!==I&&I>=.5?"bg-green-500":U>=30?"bg-amber-500":"bg-red-500",q=y.practice.difficulty;return(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(h.CardHeader,{children:(0,t.jsxs)(h.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,t.jsx)(o.Sparkles,{className:"h-4 w-4 text-primary"}),y.mastery.probability]})}),(0,t.jsxs)(h.CardContent,{className:"space-y-4",children:[null===U?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:P?y.mastery.pending:y.mastery.notEvaluated}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-3xl font-bold",children:[U,"%"]}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[P&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin"}),(0,t.jsx)(u.Badge,{variant:"outline",children:"ai"===C.masterySource?y.mastery.aiEvaluated:y.mastery.estimated})]})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded-full bg-muted overflow-hidden",children:(0,t.jsx)("div",{className:`h-full ${_} transition-all`,style:{width:`${U}%`}})}),C.masteryReason&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C.masteryReason}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:y.mastery.thresholdHint})]}),(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold",children:y.mastery.history}),!L&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>$(!0),children:[(0,t.jsx)(c.Plus,{className:"mr-1 h-4 w-4"}),y.mastery.addRecord]})]}),L&&(0,t.jsx)(v,{errorItemId:e,onCancel:()=>$(!1),onSaved:()=>{$(!1),D()}}),0===C.records.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:y.mastery.noHistory}):(0,t.jsx)("ul",{className:"divide-y rounded-md border",children:C.records.map(e=>(0,t.jsxs)("li",{className:"p-3 text-sm space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",onClick:()=>M(S===e.id?null:e.id),children:[(0,t.jsx)("span",{className:"text-muted-foreground tabular-nums",children:(0,i.formatDateTime)(e.createdAt,"yyyy-MM-dd HH:mm",f)}),(0,t.jsx)(u.Badge,{variant:"outline",className:k[e.result]||"",children:y.mastery.results[e.result]||e.result}),e.difficulty&&(0,t.jsx)(u.Badge,{variant:"secondary",children:q[e.difficulty]||e.difficulty}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.exam?`${y.mastery.sources.exam} \xb7 ${e.exam.title}`:y.mastery.sources[e.source]||y.mastery.sources.practice}),e.questionText&&(0,t.jsx)("span",{className:"ml-auto text-muted-foreground",children:S===e.id?(0,t.jsx)(l.ChevronUp,{className:"h-4 w-4"}):(0,t.jsx)(n.ChevronDown,{className:"h-4 w-4"})})]}),(0,t.jsx)("button",{type:"button","aria-label":y.mastery.deleteRecord,title:y.mastery.deleteRecord,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-red-50 hover:text-red-600",onClick:()=>E(e.id),children:(0,t.jsx)(m.Trash2,{className:"h-4 w-4"})})]}),S===e.id&&e.questionText&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[(0,t.jsx)(g.MarkdownRenderer,{content:e.questionText}),(0,t.jsx)(N.QuestionFigure,{svg:e.figureSvg}),e.wrongAnswerText&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.wrongAnswerText}),(0,t.jsx)(g.MarkdownRenderer,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.mistakeAnalysis}),(0,t.jsx)(g.MarkdownRenderer,{content:e.mistakeAnalysis})]}),e.originalImageUrl&&(0,t.jsx)("img",{src:e.originalImageUrl,alt:y.editor.wrongAnswerText,className:"max-h-96 max-w-full rounded object-contain"}),e.answerText&&(0,t.jsx)("div",{className:"border-t pt-2",children:(0,t.jsx)(g.MarkdownRenderer,{content:e.answerText,className:"font-semibold"})}),e.exam&&(0,t.jsx)(s.default,{href:`/exams/${e.exam.paperId}`,className:"text-xs text-primary hover:underline",children:e.exam.title})]})]},e.id))})]})]})]})},"RESULT_BADGE_CLASS",0,k],91686);var C=e.i(8821);e.s(["WandSparkles",()=>C.default],68983)},46968,e=>{"use strict";var t=e.i(18050),a=e.i(69638),s=e.i(3116),r=e.i(16715),i=e.i(87486),n=e.i(11110);let l={new:{className:"bg-warning/15 text-amber-700 dark:text-warning",icon:s.Clock},reviewing:{className:"bg-primary/10 text-primary",icon:r.RefreshCw},mastered:{className:"bg-success/15 text-success",icon:a.CheckCircle}};e.s(["MASTERY_STATUS_BORDER",0,{new:"border-l-warning/70",reviewing:"border-l-primary/60",mastered:"border-l-success/70"},"MasteryStatusBadge",0,function({status:e,className:a=""}){let{t:s}=(0,n.useLanguage)(),{className:r,icon:d}=l[e],c="mastered"===e?s.notebook.mastered:"reviewing"===e?s.notebook.reviewing:s.notebook.review;return(0,t.jsx)(i.Badge,{variant:"secondary",className:`${r} ${a}`,children:(0,t.jsxs)("span",{className:"flex items-center gap-1",children:[(0,t.jsx)(d,{className:"h-3 w-3"})," ",c]})})}])},93733,e=>{"use strict";var t=e.i(18050),a=e.i(69638);let s=(0,e.i(75254).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var r=e.i(73884),i=e.i(11110);let n=[{value:"correct",icon:a.CheckCircle,active:"border-green-600 bg-green-50 text-green-700"},{value:"wrong",icon:r.XCircle,active:"border-red-600 bg-red-50 text-red-700"},{value:"not_attempted",icon:s,active:"border-amber-600 bg-amber-50 text-amber-700"}];e.s(["PracticeResultPicker",0,function({value:e,onChange:a,disabled:s,size:r="md"}){let{t:l}=(0,i.useLanguage)(),d="sm"===r?"px-2 py-1 text-xs":"px-3 py-2 text-sm";return(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup",children:n.map(({value:i,icon:n,active:c})=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":e===i,disabled:s,onClick:()=>a(i),className:`flex items-center justify-center gap-1 rounded-md border font-medium transition-colors disabled:opacity-60 ${d} ${e===i?c:"border-input hover:bg-muted"}`,children:[(0,t.jsx)(n,{className:"sm"===r?"h-3 w-3":"h-4 w-4"}),l.mastery.results[i]]},i))})}],93733)},49704,e=>{"use strict";var t=e.i(18050),a=e.i(11110),s=e.i(75157);e.s(["QuestionFigure",0,function({svg:e,className:r}){let{t:i}=(0,a.useLanguage)();return e?(0,t.jsx)("figure",{className:(0,s.cn)("question-figure my-3",r),children:(0,t.jsx)("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:i.figure.alt,className:"mx-auto block h-auto max-w-full rounded border bg-white p-2",style:{maxHeight:360}})}):null}],49704)},15288,e=>{"use strict";var t=e.i(18050),a=e.i(75157);e.s(["Card",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,a.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...s})},"CardContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,a.cn)("px-6",e),...s})},"CardDescription",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,a.cn)("text-muted-foreground text-sm",e),...s})},"CardHeader",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,a.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...s})},"CardTitle",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,a.cn)("leading-none font-semibold",e),...s})}])},12505,e=>{"use strict";var t=e.i(18050),a=e.i(75157);e.s(["EmptyState",0,function({icon:e,title:s,description:r,action:i,className:n}){return(0,t.jsxs)("div",{className:(0,a.cn)("flex flex-col items-center justify-center rounded-2xl border border-dashed bg-card/50 px-6 py-14 text-center",n),children:[(0,t.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-accent text-accent-foreground",children:(0,t.jsx)(e,{className:"h-7 w-7"})}),(0,t.jsx)("p",{className:"font-medium",children:s}),r&&(0,t.jsx)("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:r}),i&&(0,t.jsx)("div",{className:"mt-5",children:i})]})}])},86963,e=>{"use strict";var t=e.i(18050),a=e.i(31278);e.s(["PageLoading",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(a.Loader2,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},35209,e=>{"use strict";var t=e.i(71645),a=e.i(11110);e.s(["usePageTitle",0,function(...e){let{t:s}=(0,a.useLanguage)(),r=[s.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=r},[r])}])}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],71689)},3281,e=>{"use strict";let t=(0,e.i(75254).default)("printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);e.s(["Printer",0,t],3281)},56909,e=>{"use strict";let t=(0,e.i(75254).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],56909)},83086,e=>{"use strict";let t=(0,e.i(75254).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",0,t],83086)},8821,e=>{"use strict";let t=(0,e.i(75254).default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);e.s(["default",0,t])},65602,e=>{"use strict";var t=e.i(18050),a=e.i(71645),s=e.i(22016),r=e.i(18566),i=e.i(15519),n=e.i(30691);let l=(0,e.i(75254).default)("clipboard-check",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);var d=e.i(31278),c=e.i(3281),o=e.i(67240),m=e.i(56909),u=e.i(27612),x=e.i(19455),h=e.i(93479),p=e.i(90546),g=e.i(86963),f=e.i(64659),y=e.i(55900),j=e.i(37727),b=e.i(87486),v=e.i(15288),N=e.i(11445),w=e.i(91686),k=e.i(93733),C=e.i(49704),S=e.i(16715),T=e.i(68983),R=e.i(11110),M=e.i(41931),q=e.i(1276),L=e.i(94114);function A({paperId:e,question:s,onDone:r}){let{t:i,language:n}=(0,R.useLanguage)(),[l,c]=(0,a.useState)(null),o=0===s.attempts.length&&!!s.errorItemId&&"pending"!==s.status,m="ready"===s.status&&!!s.questionText?.trim();if(!o&&!m)return null;let u=async t=>{let a="question"===t?i.exam.regenerateQuestionConfirm:i.exam.regenerateAnswerConfirm;if(await (0,L.confirmDialog)(a)){c(t);try{let a=await M.apiClient.post(`/api/exams/${e}/questions/${s.id}/regenerate`,{mode:t,language:n},{timeout:6e5});r(a)}catch(s){let e=s?.data?.message||"",a=i.errors[e];q.frontendLogger.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:t,code:e}),L.toast.error("HAS_RESULTS"===e?i.exam.regenerateHasResults:"string"==typeof a?a:i.exam.regenerateFailed)}finally{c(null)}}};return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[o&&(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",onClick:()=>u("question"),disabled:null!==l,children:["question"===l?(0,t.jsx)(d.Loader2,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(S.RefreshCw,{className:"mr-1 h-4 w-4"}),"question"===l?i.exam.regenerating:i.exam.regenerateQuestion]}),m&&(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",onClick:()=>u("answer"),disabled:null!==l,children:["answer"===l?(0,t.jsx)(d.Loader2,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(T.WandSparkles,{className:"mr-1 h-4 w-4"}),"answer"===l?i.exam.regenerating:i.exam.regenerateAnswer]})]})}function D({paperId:e,question:r,editingResult:l,onResultChange:c,onDeleteAttempt:o,onRegenerated:m}){let{t:u}=(0,R.useLanguage)(),{timeZone:x}=(0,i.useTimeZone)(),[h,p]=(0,a.useState)(!1),g=void 0!==l,S=(()=>{if(!r.error)return"";if("SOURCE_DELETED"===r.error)return u.exam.sourceDeleted;let e=r.error.split(":")[0].trim(),t=u.errors[e];return"string"==typeof t?t:r.error})();return(0,t.jsx)(v.Card,{children:(0,t.jsxs)(v.CardContent,{className:"space-y-3 pt-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[r.order,"."]}),r.errorItemId?(0,t.jsxs)(s.default,{href:`/error-items/${r.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[u.exam.source," ",r.sourceShortId]}):(0,t.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[r.sourceShortId," · ",u.exam.sourceDeleted]}),r.notebookName&&(0,t.jsx)(b.Badge,{variant:"secondary",children:r.notebookName})]}),r.attempts.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:r.attempts.map((e,a)=>(0,t.jsxs)(b.Badge,{variant:"outline",className:`gap-1 font-normal ${w.RESULT_BADGE_CLASS[e.result]||""}`,children:[(0,t.jsx)("span",{children:u.exam.attemptLabel.replace("{n}",String(a+1))}),(0,t.jsx)("span",{className:"tabular-nums",children:(0,n.formatDateTime)(e.createdAt,"MM-dd",x)}),(0,t.jsx)("span",{className:"font-semibold",children:u.mastery.results[e.result]}),g&&o&&(0,t.jsx)("button",{type:"button","aria-label":u.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>o(e.id),children:(0,t.jsx)(j.X,{className:"h-3 w-3"})})]},e.id))}),"pending"===r.status&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.Loader2,{className:"h-4 w-4 animate-spin"}),u.exam.questionPending]}),"failed"===r.status&&(0,t.jsxs)("p",{className:"text-sm text-destructive",children:[u.exam.questionFailed,S?`:${S}`:""]}),"ready"===r.status&&r.questionText&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.MarkdownRenderer,{content:r.questionText}),(0,t.jsx)(C.QuestionFigure,{svg:r.figureSvg}),(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>p(!h),children:[h?(0,t.jsx)(y.ChevronUp,{className:"h-3 w-3"}):(0,t.jsx)(f.ChevronDown,{className:"h-3 w-3"}),u.exam.showAnswer]}),h&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[r.answerText&&(0,t.jsx)(N.MarkdownRenderer,{content:r.answerText,className:"font-semibold"}),r.analysis&&(0,t.jsx)(N.MarkdownRenderer,{content:r.analysis})]})]}),!g&&m&&(0,t.jsx)(A,{paperId:e,question:r,onDone:m}),g&&"ready"===r.status&&r.errorItemId&&c&&(0,t.jsx)(k.PracticeResultPicker,{value:l,onChange:c,size:"sm"})]})})}var B=e.i(63661),I=e.i(35209);e.s(["default",0,function(){let{timeZone:e}=(0,i.useTimeZone)(),f=(0,r.useParams)(),y=(0,r.useRouter)(),{t:j,language:b}=(0,R.useLanguage)(),v=f.id,[N,w]=(0,a.useState)(null);(0,I.usePageTitle)(j.exam.title,N?.title);let[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),[q,A]=(0,a.useState)((0,n.formatDateTime)(new Date,"yyyy-MM-dd",e)),[$,E]=(0,a.useState)(!1),[H,P]=(0,a.useState)(null),z=(0,a.useCallback)(async()=>{try{w(await M.apiClient.get(`/api/exams/${v}`))}catch{C(!0)}},[v]);if((0,a.useEffect)(()=>{z()},[z]),(0,a.useEffect)(()=>{if(N?.status!=="generating")return;let e=setTimeout(z,3e3);return()=>clearTimeout(e)},[N,z]),k)return(0,t.jsx)("div",{className:"p-8 text-center",children:j.exam.notFound});if(!N)return(0,t.jsx)(g.PageLoading,{label:j.common.loading});let F=N.questions.filter(e=>"ready"===e.status).length,U=N.questions.some(e=>"failed"===e.status),_=N.questions.filter(e=>"ready"===e.status&&e.errorItemId),O=S?_.filter(e=>S[e.id]).length:0,Q=async()=>{if(S&&0!==O){E(!0),P(null);try{await M.apiClient.post(`/api/exams/${N.id}/results`,{takenAt:(0,n.answeredDateToISOString)(q,e),results:_.filter(e=>S[e.id]).map(e=>({questionId:e.id,result:S[e.id]}))}),T(null),P(j.exam.resultsSaved),await z()}catch{P(j.exam.resultsSaveFailed)}finally{E(!1)}}},V=async e=>{if(await (0,L.confirmDialog)(j.mastery.deleteRecordConfirm,{destructive:!0}))try{await M.apiClient.delete(`/api/practice/record/${e}`),await z()}catch{P(j.mastery.deleteRecordFailed)}},Z=async()=>{await M.apiClient.post(`/api/exams/${N.id}/retry`,{language:b}),await z()},G=async()=>{await (0,L.confirmDialog)(j.exam.deleteConfirm,{destructive:!0})&&(await M.apiClient.delete(`/api/exams/${N.id}`),y.push("/exams"))};return(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(p.BackButton,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:N.title}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(B.ExamStatusBadge,{status:N.status}),(0,t.jsx)("span",{children:j.exam.progress.replace("{ready}",String(F)).replace("{total}",String(N.questions.length))}),(0,t.jsx)("span",{children:(0,n.formatDateTime)(N.createdAt,"yyyy-MM-dd HH:mm",e)})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(s.default,{href:`/exams/${N.id}/print`,children:(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",disabled:0===F,children:[(0,t.jsx)(c.Printer,{className:"mr-2 h-4 w-4"}),j.exam.print]})}),!S&&_.length>0&&(0,t.jsxs)(x.Button,{size:"sm",onClick:()=>{P(null),T({}),A((0,n.formatDateTime)(new Date,"yyyy-MM-dd",e))},children:[(0,t.jsx)(l,{className:"mr-2 h-4 w-4"}),j.exam.recordResults]}),U&&"generating"!==N.status&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:Z,children:[(0,t.jsx)(o.RotateCcw,{className:"mr-2 h-4 w-4"}),j.exam.retryFailed]}),(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",onClick:G,className:"text-red-600 hover:text-red-700 hover:bg-red-50 sm:ml-auto",children:[(0,t.jsx)(u.Trash2,{className:"mr-2 h-4 w-4"}),j.exam.delete]})]}),N.questions.length<N.requestedCount&&(0,t.jsx)("p",{className:"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800",children:j.exam.fewerThanRequested.replaceAll("{actual}",String(N.questions.length))}),H&&(0,t.jsx)("p",{className:"rounded-md border p-3 text-sm",children:H}),S&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:j.exam.takenAt}),(0,t.jsx)(h.Input,{id:"exam-taken-at",type:"date",value:q,onChange:e=>A(e.target.value),className:"sm:w-48"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:j.exam.recordHint})]}),(0,t.jsx)("div",{className:"space-y-3",children:N.questions.map(e=>(0,t.jsx)(D,{paperId:N.id,question:e,editingResult:S?S[e.id]??null:void 0,onResultChange:t=>T(a=>a?{...a,[e.id]:t}:a),onDeleteAttempt:V,onRegenerated:z},e.id))}),S&&(0,t.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===O&&(0,t.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:j.exam.noResultSelected}),(0,t.jsx)(x.Button,{variant:"outline",onClick:()=>T(null),disabled:$,children:j.exam.cancel}),(0,t.jsxs)(x.Button,{onClick:Q,disabled:$||!q||0===O,children:[$?(0,t.jsx)(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(m.Save,{className:"mr-2 h-4 w-4"}),j.exam.saveResults]})]})})]})})}],65602)},63661,e=>{"use strict";var t=e.i(18050),a=e.i(87486),s=e.i(11110);let r={generating:"bg-blue-100 text-blue-700 border-blue-200",ready:"bg-green-100 text-green-700 border-green-200",partial:"bg-amber-100 text-amber-700 border-amber-200",failed:"bg-red-100 text-red-700 border-red-200"};e.s(["ExamStatusBadge",0,function({status:e}){let{t:i}=(0,s.useLanguage)();return(0,t.jsx)(a.Badge,{variant:"outline",className:r[e],children:i.exam.status[e]})}])},91686,68983,e=>{"use strict";var t=e.i(18050),a=e.i(71645),s=e.i(22016),r=e.i(15519),i=e.i(30691),n=e.i(64659),l=e.i(55900),d=e.i(31278),c=e.i(7233),o=e.i(83086),m=e.i(27612),u=e.i(87486),x=e.i(19455),h=e.i(15288),p=e.i(11445),g=e.i(56909),f=e.i(93479),y=e.i(93733),j=e.i(11110),b=e.i(41931);function v({errorItemId:e,onSaved:s,onCancel:n}){let{t:l}=(0,j.useLanguage)(),{timeZone:c}=(0,r.useTimeZone)(),o=(0,i.formatDateTime)(new Date,"yyyy-MM-dd",c),[m,u]=(0,a.useState)(null),[h,p]=(0,a.useState)(o),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),S=async()=>{if(m&&h){w(!0),C(null);try{await b.apiClient.post("/api/practice/record",{errorItemId:e,result:m,source:"manual",takenAt:(0,i.answeredDateToISOString)(h,c)}),s()}catch{C(l.mastery.resultSaveFailed)}finally{w(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3 rounded-md border bg-muted/30 p-3",children:[(0,t.jsx)(y.PracticeResultPicker,{value:m,onChange:u,disabled:N}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:`practice-date-${e}`,className:"text-sm font-medium",children:l.mastery.recordDate}),(0,t.jsx)(f.Input,{id:`practice-date-${e}`,type:"date",value:h,max:o,onChange:e=>p(e.target.value),className:"sm:w-48"}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:n,disabled:N,className:"flex-1 sm:flex-none",children:l.exam.cancel}),(0,t.jsxs)(x.Button,{size:"sm",onClick:S,disabled:N||!m||!h,className:"flex-1 sm:flex-none",children:[N?(0,t.jsx)(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(g.Save,{className:"mr-2 h-4 w-4"}),l.mastery.saveResult]})]})]}),k&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:k})]})}var N=e.i(49704),w=e.i(94114);let k={correct:"bg-green-100 text-green-700 border-green-200",wrong:"bg-red-100 text-red-700 border-red-200",not_attempted:"bg-amber-100 text-amber-700 border-amber-200"};e.s(["MasteryPanel",0,function({errorItemId:e,onMasteryLevelChange:g}){let{timeZone:f}=(0,r.useTimeZone)(),{t:y}=(0,j.useLanguage)(),[C,S]=(0,a.useState)(null),[T,R]=(0,a.useState)(null),[M,q]=(0,a.useState)(0),[L,A]=(0,a.useState)(!1),D=(0,a.useCallback)(()=>{b.apiClient.get(`/api/error-items/${e}/practice-records`).then(e=>{S(e),g?.(e.masteryLevel)}).catch(()=>void 0)},[e,g]);(0,a.useEffect)(D,[D]);let B=()=>{q(0),D()},I=async e=>{if(await (0,w.confirmDialog)(y.mastery.deleteRecordConfirm,{destructive:!0}))try{await b.apiClient.delete(`/api/practice/record/${e}`),B()}catch{w.toast.error(y.mastery.deleteRecordFailed)}},$=C?.records[0],E=!!$&&(!C?.masteryEvaluatedAt||new Date($.createdAt)>new Date(C.masteryEvaluatedAt));if((0,a.useEffect)(()=>{if(!E||M>=20)return;let e=setTimeout(()=>{q(e=>e+1),D()},4e3);return()=>clearTimeout(e)},[E,M,D]),!C)return null;let H=C.masteryProbability,P=null===H?null:Math.round(100*H),z=null===P?"":P>=80?"bg-green-500":P>=50?"bg-amber-500":"bg-red-500",F=y.practice.difficulty;return(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(h.CardHeader,{children:(0,t.jsxs)(h.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,t.jsx)(o.Sparkles,{className:"h-4 w-4 text-primary"}),y.mastery.probability]})}),(0,t.jsxs)(h.CardContent,{className:"space-y-4",children:[null===P?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:E?y.mastery.pending:y.mastery.notEvaluated}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-3xl font-bold",children:[P,"%"]}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[E&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin"}),(0,t.jsx)(u.Badge,{variant:"outline",children:"ai"===C.masterySource?y.mastery.aiEvaluated:y.mastery.estimated})]})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded-full bg-muted overflow-hidden",children:(0,t.jsx)("div",{className:`h-full ${z} transition-all`,style:{width:`${P}%`}})}),C.masteryReason&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C.masteryReason}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:y.mastery.thresholdHint})]}),(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold",children:y.mastery.history}),!L&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>A(!0),children:[(0,t.jsx)(c.Plus,{className:"mr-1 h-4 w-4"}),y.mastery.addRecord]})]}),L&&(0,t.jsx)(v,{errorItemId:e,onCancel:()=>A(!1),onSaved:()=>{A(!1),B()}}),0===C.records.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:y.mastery.noHistory}):(0,t.jsx)("ul",{className:"divide-y rounded-md border",children:C.records.map(e=>(0,t.jsxs)("li",{className:"p-3 text-sm space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",onClick:()=>R(T===e.id?null:e.id),children:[(0,t.jsx)("span",{className:"text-muted-foreground tabular-nums",children:(0,i.formatDateTime)(e.createdAt,"yyyy-MM-dd HH:mm",f)}),(0,t.jsx)(u.Badge,{variant:"outline",className:k[e.result]||"",children:y.mastery.results[e.result]||e.result}),e.difficulty&&(0,t.jsx)(u.Badge,{variant:"secondary",children:F[e.difficulty]||e.difficulty}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.exam?`${y.mastery.sources.exam} \xb7 ${e.exam.title}`:y.mastery.sources[e.source]||y.mastery.sources.practice}),e.questionText&&(0,t.jsx)("span",{className:"ml-auto text-muted-foreground",children:T===e.id?(0,t.jsx)(l.ChevronUp,{className:"h-4 w-4"}):(0,t.jsx)(n.ChevronDown,{className:"h-4 w-4"})})]}),(0,t.jsx)("button",{type:"button","aria-label":y.mastery.deleteRecord,title:y.mastery.deleteRecord,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-red-50 hover:text-red-600",onClick:()=>I(e.id),children:(0,t.jsx)(m.Trash2,{className:"h-4 w-4"})})]}),T===e.id&&e.questionText&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[(0,t.jsx)(p.MarkdownRenderer,{content:e.questionText}),(0,t.jsx)(N.QuestionFigure,{svg:e.figureSvg}),e.wrongAnswerText&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.wrongAnswerText}),(0,t.jsx)(p.MarkdownRenderer,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.mistakeAnalysis}),(0,t.jsx)(p.MarkdownRenderer,{content:e.mistakeAnalysis})]}),e.originalImageUrl&&(0,t.jsx)("img",{src:e.originalImageUrl,alt:y.editor.wrongAnswerText,className:"max-h-96 max-w-full rounded object-contain"}),e.answerText&&(0,t.jsx)("div",{className:"border-t pt-2",children:(0,t.jsx)(p.MarkdownRenderer,{content:e.answerText,className:"font-semibold"})}),e.exam&&(0,t.jsx)(s.default,{href:`/exams/${e.exam.paperId}`,className:"text-xs text-primary hover:underline",children:e.exam.title})]})]},e.id))})]})]})]})},"RESULT_BADGE_CLASS",0,k],91686);var C=e.i(8821);e.s(["WandSparkles",()=>C.default],68983)},93733,e=>{"use strict";var t=e.i(18050),a=e.i(69638);let s=(0,e.i(75254).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var r=e.i(73884),i=e.i(11110);let n=[{value:"correct",icon:a.CheckCircle,active:"border-green-600 bg-green-50 text-green-700"},{value:"wrong",icon:r.XCircle,active:"border-red-600 bg-red-50 text-red-700"},{value:"not_attempted",icon:s,active:"border-amber-600 bg-amber-50 text-amber-700"}];e.s(["PracticeResultPicker",0,function({value:e,onChange:a,disabled:s,size:r="md"}){let{t:l}=(0,i.useLanguage)(),d="sm"===r?"px-2 py-1 text-xs":"px-3 py-2 text-sm";return(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup",children:n.map(({value:i,icon:n,active:c})=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":e===i,disabled:s,onClick:()=>a(i),className:`flex items-center justify-center gap-1 rounded-md border font-medium transition-colors disabled:opacity-60 ${d} ${e===i?c:"border-input hover:bg-muted"}`,children:[(0,t.jsx)(n,{className:"sm"===r?"h-3 w-3":"h-4 w-4"}),l.mastery.results[i]]},i))})}],93733)},49704,e=>{"use strict";var t=e.i(18050),a=e.i(11110),s=e.i(75157);e.s(["QuestionFigure",0,function({svg:e,className:r}){let{t:i}=(0,a.useLanguage)();return e?(0,t.jsx)("figure",{className:(0,s.cn)("question-figure my-3",r),children:(0,t.jsx)("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:i.figure.alt,className:"mx-auto block h-auto max-w-full rounded border bg-white p-2",style:{maxHeight:360}})}):null}],49704)},90546,e=>{"use strict";var t=e.i(18050),a=e.i(18566),s=e.i(19455),r=e.i(71689);e.s(["BackButton",0,function({fallbackUrl:e,className:i}){let n=(0,a.useRouter)();return(0,t.jsx)(s.Button,{variant:"ghost",size:"icon",onClick:()=>{n.push(e)},className:i,children:(0,t.jsx)(r.ArrowLeft,{className:"h-5 w-5"})})}])},15288,e=>{"use strict";var t=e.i(18050),a=e.i(75157);e.s(["Card",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,a.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...s})},"CardContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,a.cn)("px-6",e),...s})},"CardDescription",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,a.cn)("text-muted-foreground text-sm",e),...s})},"CardHeader",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,a.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...s})},"CardTitle",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,a.cn)("leading-none font-semibold",e),...s})}])},86963,e=>{"use strict";var t=e.i(18050),a=e.i(31278);e.s(["PageLoading",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(a.Loader2,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},35209,e=>{"use strict";var t=e.i(71645),a=e.i(11110);e.s(["usePageTitle",0,function(...e){let{t:s}=(0,a.useLanguage)(),r=[s.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=r},[r])}])}]);
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,71689,e=>{"use strict";let t=(0,e.i(75254).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],71689)},3281,e=>{"use strict";let t=(0,e.i(75254).default)("printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);e.s(["Printer",0,t],3281)},56909,e=>{"use strict";let t=(0,e.i(75254).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],56909)},83086,e=>{"use strict";let t=(0,e.i(75254).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",0,t],83086)},8821,e=>{"use strict";let t=(0,e.i(75254).default)("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);e.s(["default",0,t])},65602,e=>{"use strict";var t=e.i(18050),a=e.i(71645),s=e.i(22016),r=e.i(18566),i=e.i(15519),n=e.i(30691);let l=(0,e.i(75254).default)("clipboard-check",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);var d=e.i(31278),c=e.i(3281),o=e.i(67240),m=e.i(56909),u=e.i(27612),x=e.i(19455),h=e.i(93479),p=e.i(90546),g=e.i(86963),f=e.i(64659),y=e.i(55900),j=e.i(37727),b=e.i(87486),v=e.i(15288),N=e.i(11445),w=e.i(91686),k=e.i(93733),C=e.i(49704),S=e.i(16715),T=e.i(68983),R=e.i(11110),M=e.i(41931),q=e.i(1276),A=e.i(94114);function L({paperId:e,question:s,onDone:r}){let{t:i,language:n}=(0,R.useLanguage)(),[l,c]=(0,a.useState)(null),o=0===s.attempts.length&&!!s.errorItemId&&"pending"!==s.status,m="ready"===s.status&&!!s.questionText?.trim();if(!o&&!m)return null;let u=async t=>{let a="question"===t?i.exam.regenerateQuestionConfirm:i.exam.regenerateAnswerConfirm;if(await (0,A.confirmDialog)(a)){c(t);try{let a=await M.apiClient.post(`/api/exams/${e}/questions/${s.id}/regenerate`,{mode:t,language:n},{timeout:6e5});r(a)}catch(s){let e=s?.data?.message||"",a=i.errors[e];q.frontendLogger.error("[ExamRegenerate]","Failed to regenerate exam question",{mode:t,code:e}),A.toast.error("HAS_RESULTS"===e?i.exam.regenerateHasResults:"string"==typeof a?a:i.exam.regenerateFailed)}finally{c(null)}}};return(0,t.jsxs)("div",{className:"flex flex-wrap gap-1",children:[o&&(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",onClick:()=>u("question"),disabled:null!==l,children:["question"===l?(0,t.jsx)(d.Loader2,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(S.RefreshCw,{className:"mr-1 h-4 w-4"}),"question"===l?i.exam.regenerating:i.exam.regenerateQuestion]}),m&&(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",onClick:()=>u("answer"),disabled:null!==l,children:["answer"===l?(0,t.jsx)(d.Loader2,{className:"mr-1 h-4 w-4 animate-spin"}):(0,t.jsx)(T.WandSparkles,{className:"mr-1 h-4 w-4"}),"answer"===l?i.exam.regenerating:i.exam.regenerateAnswer]})]})}function D({paperId:e,question:r,editingResult:l,onResultChange:c,onDeleteAttempt:o,onRegenerated:m}){let{t:u}=(0,R.useLanguage)(),{timeZone:x}=(0,i.useTimeZone)(),[h,p]=(0,a.useState)(!1),g=void 0!==l,S=(()=>{if(!r.error)return"";if("SOURCE_DELETED"===r.error)return u.exam.sourceDeleted;let e=r.error.split(":")[0].trim(),t=u.errors[e];return"string"==typeof t?t:r.error})();return(0,t.jsx)(v.Card,{children:(0,t.jsxs)(v.CardContent,{className:"space-y-3 pt-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-semibold",children:[r.order,"."]}),r.errorItemId?(0,t.jsxs)(s.default,{href:`/error-items/${r.errorItemId}`,className:"font-mono text-xs text-primary hover:underline",children:[u.exam.source," ",r.sourceShortId]}):(0,t.jsxs)("span",{className:"font-mono text-xs text-muted-foreground",children:[r.sourceShortId," · ",u.exam.sourceDeleted]}),r.notebookName&&(0,t.jsx)(b.Badge,{variant:"secondary",children:r.notebookName})]}),r.attempts.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:r.attempts.map((e,a)=>(0,t.jsxs)(b.Badge,{variant:"outline",className:`gap-1 font-normal ${w.RESULT_BADGE_CLASS[e.result]||""}`,children:[(0,t.jsx)("span",{children:u.exam.attemptLabel.replace("{n}",String(a+1))}),(0,t.jsx)("span",{className:"tabular-nums",children:(0,n.formatDateTime)(e.createdAt,"MM-dd",x)}),(0,t.jsx)("span",{className:"font-semibold",children:u.mastery.results[e.result]}),g&&o&&(0,t.jsx)("button",{type:"button","aria-label":u.mastery.deleteRecord,className:"-mr-1 rounded hover:bg-black/10",onClick:()=>o(e.id),children:(0,t.jsx)(j.X,{className:"h-3 w-3"})})]},e.id))}),"pending"===r.status&&(0,t.jsxs)("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.Loader2,{className:"h-4 w-4 animate-spin"}),u.exam.questionPending]}),"failed"===r.status&&(0,t.jsxs)("p",{className:"text-sm text-destructive",children:[u.exam.questionFailed,S?`:${S}`:""]}),"ready"===r.status&&r.questionText&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.MarkdownRenderer,{content:r.questionText}),(0,t.jsx)(C.QuestionFigure,{svg:r.figureSvg}),(0,t.jsxs)("button",{type:"button",className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",onClick:()=>p(!h),children:[h?(0,t.jsx)(y.ChevronUp,{className:"h-3 w-3"}):(0,t.jsx)(f.ChevronDown,{className:"h-3 w-3"}),u.exam.showAnswer]}),h&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[r.answerText&&(0,t.jsx)(N.MarkdownRenderer,{content:r.answerText,className:"font-semibold"}),r.analysis&&(0,t.jsx)(N.MarkdownRenderer,{content:r.analysis})]})]}),!g&&m&&(0,t.jsx)(L,{paperId:e,question:r,onDone:m}),g&&"ready"===r.status&&r.errorItemId&&c&&(0,t.jsx)(k.PracticeResultPicker,{value:l,onChange:c,size:"sm"})]})})}var B=e.i(63661),I=e.i(35209);e.s(["default",0,function(){let{timeZone:e}=(0,i.useTimeZone)(),f=(0,r.useParams)(),y=(0,r.useRouter)(),{t:j,language:b}=(0,R.useLanguage)(),v=f.id,[N,w]=(0,a.useState)(null);(0,I.usePageTitle)(j.exam.title,N?.title);let[k,C]=(0,a.useState)(!1),[S,T]=(0,a.useState)(null),[q,L]=(0,a.useState)((0,n.formatDateTime)(new Date,"yyyy-MM-dd",e)),[$,E]=(0,a.useState)(!1),[H,P]=(0,a.useState)(null),z=(0,a.useCallback)(async()=>{try{w(await M.apiClient.get(`/api/exams/${v}`))}catch{C(!0)}},[v]);if((0,a.useEffect)(()=>{z()},[z]),(0,a.useEffect)(()=>{if(N?.status!=="generating")return;let e=setTimeout(z,3e3);return()=>clearTimeout(e)},[N,z]),k)return(0,t.jsx)("div",{className:"p-8 text-center",children:j.exam.notFound});if(!N)return(0,t.jsx)(g.PageLoading,{label:j.common.loading});let F=N.questions.filter(e=>"ready"===e.status).length,U=N.questions.some(e=>"failed"===e.status),_=N.questions.filter(e=>"ready"===e.status&&e.errorItemId),O=S?_.filter(e=>S[e.id]).length:0,Q=async()=>{if(S&&0!==O){E(!0),P(null);try{await M.apiClient.post(`/api/exams/${N.id}/results`,{takenAt:(0,n.answeredDateToISOString)(q,e),results:_.filter(e=>S[e.id]).map(e=>({questionId:e.id,result:S[e.id]}))}),T(null),P(j.exam.resultsSaved),await z()}catch{P(j.exam.resultsSaveFailed)}finally{E(!1)}}},V=async e=>{if(await (0,A.confirmDialog)(j.mastery.deleteRecordConfirm,{destructive:!0}))try{await M.apiClient.delete(`/api/practice/record/${e}`),await z()}catch{P(j.mastery.deleteRecordFailed)}},Z=async()=>{await M.apiClient.post(`/api/exams/${N.id}/retry`,{language:b}),await z()},G=async()=>{await (0,A.confirmDialog)(j.exam.deleteConfirm,{destructive:!0})&&(await M.apiClient.delete(`/api/exams/${N.id}`),y.push("/exams"))};return(0,t.jsx)("main",{className:"mx-auto min-h-screen max-w-6xl px-4 py-6 md:px-8 md:py-8",children:(0,t.jsxs)("div",{className:"space-y-6 pb-24",children:[(0,t.jsxs)("div",{className:"flex items-start gap-3",children:[(0,t.jsx)(p.BackButton,{fallbackUrl:"/exams",className:"-ml-2 shrink-0"}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 space-y-2",children:[(0,t.jsx)("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight break-words",children:N.title}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(B.ExamStatusBadge,{status:N.status}),(0,t.jsx)("span",{children:j.exam.progress.replace("{ready}",String(F)).replace("{total}",String(N.questions.length))}),(0,t.jsx)("span",{children:(0,n.formatDateTime)(N.createdAt,"yyyy-MM-dd HH:mm",e)})]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(s.default,{href:`/exams/${N.id}/print`,children:(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",disabled:0===F,children:[(0,t.jsx)(c.Printer,{className:"mr-2 h-4 w-4"}),j.exam.print]})}),!S&&_.length>0&&(0,t.jsxs)(x.Button,{size:"sm",onClick:()=>{P(null),T({}),L((0,n.formatDateTime)(new Date,"yyyy-MM-dd",e))},children:[(0,t.jsx)(l,{className:"mr-2 h-4 w-4"}),j.exam.recordResults]}),U&&"generating"!==N.status&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:Z,children:[(0,t.jsx)(o.RotateCcw,{className:"mr-2 h-4 w-4"}),j.exam.retryFailed]}),(0,t.jsxs)(x.Button,{variant:"ghost",size:"sm",onClick:G,className:"text-red-600 hover:text-red-700 hover:bg-red-50 sm:ml-auto",children:[(0,t.jsx)(u.Trash2,{className:"mr-2 h-4 w-4"}),j.exam.delete]})]}),N.questions.length<N.requestedCount&&(0,t.jsx)("p",{className:"rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-800",children:j.exam.fewerThanRequested.replaceAll("{actual}",String(N.questions.length))}),H&&(0,t.jsx)("p",{className:"rounded-md border p-3 text-sm",children:H}),S&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md border bg-muted/30 p-3",children:[(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:"exam-taken-at",className:"text-sm font-medium",children:j.exam.takenAt}),(0,t.jsx)(h.Input,{id:"exam-taken-at",type:"date",value:q,onChange:e=>L(e.target.value),className:"sm:w-48"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:j.exam.recordHint})]}),(0,t.jsx)("div",{className:"space-y-3",children:N.questions.map(e=>(0,t.jsx)(D,{paperId:N.id,question:e,editingResult:S?S[e.id]??null:void 0,onResultChange:t=>T(a=>a?{...a,[e.id]:t}:a),onDeleteAttempt:V,onRegenerated:z},e.id))}),S&&(0,t.jsx)("div",{className:"fixed inset-x-0 bottom-16 z-30 border-t bg-background/95 p-3 backdrop-blur md:bottom-0",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto flex items-center justify-end gap-2",children:[0===O&&(0,t.jsx)("span",{className:"mr-auto text-xs text-muted-foreground",children:j.exam.noResultSelected}),(0,t.jsx)(x.Button,{variant:"outline",onClick:()=>T(null),disabled:$,children:j.exam.cancel}),(0,t.jsxs)(x.Button,{onClick:Q,disabled:$||!q||0===O,children:[$?(0,t.jsx)(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(m.Save,{className:"mr-2 h-4 w-4"}),j.exam.saveResults]})]})})]})})}],65602)},63661,e=>{"use strict";var t=e.i(18050),a=e.i(87486),s=e.i(11110);let r={generating:"bg-blue-100 text-blue-700 border-blue-200",ready:"bg-green-100 text-green-700 border-green-200",partial:"bg-amber-100 text-amber-700 border-amber-200",failed:"bg-red-100 text-red-700 border-red-200"};e.s(["ExamStatusBadge",0,function({status:e}){let{t:i}=(0,s.useLanguage)();return(0,t.jsx)(a.Badge,{variant:"outline",className:r[e],children:i.exam.status[e]})}])},91686,68983,e=>{"use strict";var t=e.i(18050),a=e.i(71645),s=e.i(22016),r=e.i(15519),i=e.i(30691),n=e.i(64659),l=e.i(55900),d=e.i(31278),c=e.i(7233),o=e.i(83086),m=e.i(27612),u=e.i(87486),x=e.i(19455),h=e.i(15288),p=e.i(11445),g=e.i(56909),f=e.i(93479),y=e.i(93733),j=e.i(11110),b=e.i(41931);function v({errorItemId:e,onSaved:s,onCancel:n}){let{t:l}=(0,j.useLanguage)(),{timeZone:c}=(0,r.useTimeZone)(),o=(0,i.formatDateTime)(new Date,"yyyy-MM-dd",c),[m,u]=(0,a.useState)(null),[h,p]=(0,a.useState)(o),[N,w]=(0,a.useState)(!1),[k,C]=(0,a.useState)(null),S=async()=>{if(m&&h){w(!0),C(null);try{await b.apiClient.post("/api/practice/record",{errorItemId:e,result:m,source:"manual",takenAt:(0,i.answeredDateToISOString)(h,c)}),s()}catch{C(l.mastery.resultSaveFailed)}finally{w(!1)}}};return(0,t.jsxs)("div",{className:"space-y-3 rounded-md border bg-muted/30 p-3",children:[(0,t.jsx)(y.PracticeResultPicker,{value:m,onChange:u,disabled:N}),(0,t.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2",children:[(0,t.jsx)("label",{htmlFor:`practice-date-${e}`,className:"text-sm font-medium",children:l.mastery.recordDate}),(0,t.jsx)(f.Input,{id:`practice-date-${e}`,type:"date",value:h,max:o,onChange:e=>p(e.target.value),className:"sm:w-48"}),(0,t.jsxs)("div",{className:"flex gap-2 sm:ml-auto",children:[(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:n,disabled:N,className:"flex-1 sm:flex-none",children:l.exam.cancel}),(0,t.jsxs)(x.Button,{size:"sm",onClick:S,disabled:N||!m||!h,className:"flex-1 sm:flex-none",children:[N?(0,t.jsx)(d.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(g.Save,{className:"mr-2 h-4 w-4"}),l.mastery.saveResult]})]})]}),k&&(0,t.jsx)("p",{className:"text-sm text-destructive",children:k})]})}var N=e.i(49704),w=e.i(94114);let k={correct:"bg-green-100 text-green-700 border-green-200",wrong:"bg-red-100 text-red-700 border-red-200",not_attempted:"bg-amber-100 text-amber-700 border-amber-200"};e.s(["MasteryPanel",0,function({errorItemId:e,onMasteryStatusChange:g}){let{timeZone:f}=(0,r.useTimeZone)(),{t:y}=(0,j.useLanguage)(),[C,S]=(0,a.useState)(null),[T,R]=(0,a.useState)(null),[M,q]=(0,a.useState)(0),[A,L]=(0,a.useState)(!1),D=(0,a.useCallback)(()=>{b.apiClient.get(`/api/error-items/${e}/practice-records`).then(e=>{S(e),g?.(e.masteryStatus)}).catch(()=>void 0)},[e,g]);(0,a.useEffect)(D,[D]);let B=()=>{q(0),D()},I=async e=>{if(await (0,w.confirmDialog)(y.mastery.deleteRecordConfirm,{destructive:!0}))try{await b.apiClient.delete(`/api/practice/record/${e}`),B()}catch{w.toast.error(y.mastery.deleteRecordFailed)}},$=C?.records[0],E=!!$&&(!C?.masteryEvaluatedAt||new Date($.createdAt)>new Date(C.masteryEvaluatedAt));if((0,a.useEffect)(()=>{if(!E||M>=20)return;let e=setTimeout(()=>{q(e=>e+1),D()},4e3);return()=>clearTimeout(e)},[E,M,D]),!C)return null;let H=C.masteryProbability,P=null===H?null:Math.round(100*H),z=null===P?"":null!==H&&H>=.5?"bg-green-500":P>=30?"bg-amber-500":"bg-red-500",F=y.practice.difficulty;return(0,t.jsxs)(h.Card,{children:[(0,t.jsx)(h.CardHeader,{children:(0,t.jsxs)(h.CardTitle,{className:"flex items-center gap-2 text-base",children:[(0,t.jsx)(o.Sparkles,{className:"h-4 w-4 text-primary"}),y.mastery.probability]})}),(0,t.jsxs)(h.CardContent,{className:"space-y-4",children:[null===P?(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:E?y.mastery.pending:y.mastery.notEvaluated}):(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,t.jsxs)("span",{className:"text-3xl font-bold",children:[P,"%"]}),(0,t.jsxs)("span",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[E&&(0,t.jsx)(d.Loader2,{className:"h-3 w-3 animate-spin"}),(0,t.jsx)(u.Badge,{variant:"outline",children:"ai"===C.masterySource?y.mastery.aiEvaluated:y.mastery.estimated})]})]}),(0,t.jsx)("div",{className:"h-2 w-full rounded-full bg-muted overflow-hidden",children:(0,t.jsx)("div",{className:`h-full ${z} transition-all`,style:{width:`${P}%`}})}),C.masteryReason&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:C.masteryReason}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:y.mastery.thresholdHint})]}),(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-semibold",children:y.mastery.history}),!A&&(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>L(!0),children:[(0,t.jsx)(c.Plus,{className:"mr-1 h-4 w-4"}),y.mastery.addRecord]})]}),A&&(0,t.jsx)(v,{errorItemId:e,onCancel:()=>L(!1),onSaved:()=>{L(!1),B()}}),0===C.records.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:y.mastery.noHistory}):(0,t.jsx)("ul",{className:"divide-y rounded-md border",children:C.records.map(e=>(0,t.jsxs)("li",{className:"p-3 text-sm space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-start gap-2",children:[(0,t.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 flex-wrap items-center gap-2 text-left",onClick:()=>R(T===e.id?null:e.id),children:[(0,t.jsx)("span",{className:"text-muted-foreground tabular-nums",children:(0,i.formatDateTime)(e.createdAt,"yyyy-MM-dd HH:mm",f)}),(0,t.jsx)(u.Badge,{variant:"outline",className:k[e.result]||"",children:y.mastery.results[e.result]||e.result}),e.difficulty&&(0,t.jsx)(u.Badge,{variant:"secondary",children:F[e.difficulty]||e.difficulty}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:e.exam?`${y.mastery.sources.exam} \xb7 ${e.exam.title}`:y.mastery.sources[e.source]||y.mastery.sources.practice}),e.questionText&&(0,t.jsx)("span",{className:"ml-auto text-muted-foreground",children:T===e.id?(0,t.jsx)(l.ChevronUp,{className:"h-4 w-4"}):(0,t.jsx)(n.ChevronDown,{className:"h-4 w-4"})})]}),(0,t.jsx)("button",{type:"button","aria-label":y.mastery.deleteRecord,title:y.mastery.deleteRecord,className:"shrink-0 rounded p-1 text-muted-foreground hover:bg-red-50 hover:text-red-600",onClick:()=>I(e.id),children:(0,t.jsx)(m.Trash2,{className:"h-4 w-4"})})]}),T===e.id&&e.questionText&&(0,t.jsxs)("div",{className:"space-y-2 rounded-md bg-muted/40 p-3",children:[(0,t.jsx)(p.MarkdownRenderer,{content:e.questionText}),(0,t.jsx)(N.QuestionFigure,{svg:e.figureSvg}),e.wrongAnswerText&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.wrongAnswerText}),(0,t.jsx)(p.MarkdownRenderer,{content:e.wrongAnswerText})]}),e.mistakeAnalysis&&(0,t.jsxs)("div",{className:"border-t pt-2",children:[(0,t.jsx)("p",{className:"mb-1 font-medium",children:y.editor.mistakeAnalysis}),(0,t.jsx)(p.MarkdownRenderer,{content:e.mistakeAnalysis})]}),e.originalImageUrl&&(0,t.jsx)("img",{src:e.originalImageUrl,alt:y.editor.wrongAnswerText,className:"max-h-96 max-w-full rounded object-contain"}),e.answerText&&(0,t.jsx)("div",{className:"border-t pt-2",children:(0,t.jsx)(p.MarkdownRenderer,{content:e.answerText,className:"font-semibold"})}),e.exam&&(0,t.jsx)(s.default,{href:`/exams/${e.exam.paperId}`,className:"text-xs text-primary hover:underline",children:e.exam.title})]})]},e.id))})]})]})]})},"RESULT_BADGE_CLASS",0,k],91686);var C=e.i(8821);e.s(["WandSparkles",()=>C.default],68983)},93733,e=>{"use strict";var t=e.i(18050),a=e.i(69638);let s=(0,e.i(75254).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var r=e.i(73884),i=e.i(11110);let n=[{value:"correct",icon:a.CheckCircle,active:"border-green-600 bg-green-50 text-green-700"},{value:"wrong",icon:r.XCircle,active:"border-red-600 bg-red-50 text-red-700"},{value:"not_attempted",icon:s,active:"border-amber-600 bg-amber-50 text-amber-700"}];e.s(["PracticeResultPicker",0,function({value:e,onChange:a,disabled:s,size:r="md"}){let{t:l}=(0,i.useLanguage)(),d="sm"===r?"px-2 py-1 text-xs":"px-3 py-2 text-sm";return(0,t.jsx)("div",{className:"grid grid-cols-3 gap-2",role:"radiogroup",children:n.map(({value:i,icon:n,active:c})=>(0,t.jsxs)("button",{type:"button",role:"radio","aria-checked":e===i,disabled:s,onClick:()=>a(i),className:`flex items-center justify-center gap-1 rounded-md border font-medium transition-colors disabled:opacity-60 ${d} ${e===i?c:"border-input hover:bg-muted"}`,children:[(0,t.jsx)(n,{className:"sm"===r?"h-3 w-3":"h-4 w-4"}),l.mastery.results[i]]},i))})}],93733)},49704,e=>{"use strict";var t=e.i(18050),a=e.i(11110),s=e.i(75157);e.s(["QuestionFigure",0,function({svg:e,className:r}){let{t:i}=(0,a.useLanguage)();return e?(0,t.jsx)("figure",{className:(0,s.cn)("question-figure my-3",r),children:(0,t.jsx)("img",{src:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`,alt:i.figure.alt,className:"mx-auto block h-auto max-w-full rounded border bg-white p-2",style:{maxHeight:360}})}):null}],49704)},90546,e=>{"use strict";var t=e.i(18050),a=e.i(18566),s=e.i(19455),r=e.i(71689);e.s(["BackButton",0,function({fallbackUrl:e,className:i}){let n=(0,a.useRouter)();return(0,t.jsx)(s.Button,{variant:"ghost",size:"icon",onClick:()=>{n.push(e)},className:i,children:(0,t.jsx)(r.ArrowLeft,{className:"h-5 w-5"})})}])},15288,e=>{"use strict";var t=e.i(18050),a=e.i(75157);e.s(["Card",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card",className:(0,a.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...s})},"CardContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-content",className:(0,a.cn)("px-6",e),...s})},"CardDescription",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-description",className:(0,a.cn)("text-muted-foreground text-sm",e),...s})},"CardHeader",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-header",className:(0,a.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...s})},"CardTitle",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"card-title",className:(0,a.cn)("leading-none font-semibold",e),...s})}])},86963,e=>{"use strict";var t=e.i(18050),a=e.i(31278);e.s(["PageLoading",0,function({label:e}){return(0,t.jsxs)("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-3 text-muted-foreground",children:[(0,t.jsx)(a.Loader2,{className:"h-7 w-7 animate-spin text-primary"}),e&&(0,t.jsx)("p",{className:"text-sm",children:e})]})}])},35209,e=>{"use strict";var t=e.i(71645),a=e.i(11110);e.s(["usePageTitle",0,function(...e){let{t:s}=(0,a.useLanguage)(),r=[s.pageTitle.base,...e.map(e=>"string"==typeof e?e.trim():"").filter(e=>e.length>0)].join("-");(0,t.useEffect)(()=>{document.title=r},[r])}])}]);
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 wttwins
|
|
4
|
+
Copyright (c) 2026 margrop
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|