wrong-notebook 2026.10.30-2 → 2026.10.30-3
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 +2 -0
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/routes-manifest.json +14 -0
- 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 +14 -13
- package/.next/server/app/api/admin/dashboard/route.js.nft.json +1 -1
- package/.next/server/app/api/admin/users/[id]/detail/route.js +14 -13
- package/.next/server/app/api/admin/users/[id]/detail/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 +9 -8
- package/.next/server/app/api/ai/models/route.js.nft.json +1 -1
- package/.next/server/app/api/ai/test/route.js +10 -9
- package/.next/server/app/api/ai/test/route.js.nft.json +1 -1
- package/.next/server/app/api/analytics/route.js +14 -13
- package/.next/server/app/api/analytics/route.js.nft.json +1 -1
- package/.next/server/app/api/analyze/route.js +13 -12
- package/.next/server/app/api/analyze/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/figure/route.js +13 -12
- 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 +13 -12
- 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 +13 -12
- 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.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/reanswer/route.js +13 -12
- 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 +15 -14
- package/.next/server/app/api/error-items/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js +13 -12
- package/.next/server/app/api/error-items/[id]/svg-animation/narration/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js +13 -12
- package/.next/server/app/api/error-items/[id]/svg-animation/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/list/route.js +1 -1
- package/.next/server/app/api/error-items/list/route.js.nft.json +1 -1
- package/.next/server/app/api/error-items/route.js +14 -13
- package/.next/server/app/api/error-items/route.js.nft.json +1 -1
- 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 +13 -12
- 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 +15 -14
- package/.next/server/app/api/exams/[id]/results/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/retry/route.js +13 -12
- package/.next/server/app/api/exams/[id]/retry/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/[id]/route.js +14 -13
- package/.next/server/app/api/exams/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/exams/route.js +15 -14
- package/.next/server/app/api/exams/route.js.nft.json +1 -1
- package/.next/server/app/api/export/route.js +7 -5
- package/.next/server/app/api/export/route.js.nft.json +1 -1
- package/.next/server/app/api/geogebra-analyze/route.js +13 -12
- 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 +15 -13
- package/.next/server/app/api/import/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/checkin/route.js +1 -1
- package/.next/server/app/api/minimax-code/checkin/route.js.nft.json +1 -1
- package/.next/server/app/api/minimax-code/route.js +1 -1
- package/.next/server/app/api/minimax-code/route.js.nft.json +1 -1
- package/.next/server/app/api/notebooks/[id]/retag/route.js +14 -13
- package/.next/server/app/api/notebooks/[id]/retag/route.js.nft.json +1 -1
- package/.next/server/app/api/openclaw/batch-upload/route.js +14 -13
- package/.next/server/app/api/openclaw/batch-upload/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/generate/route.js +11 -10
- package/.next/server/app/api/practice/generate/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/grade/route.js +12 -11
- package/.next/server/app/api/practice/grade/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/[id]/route.js +15 -14
- package/.next/server/app/api/practice/record/[id]/route.js.nft.json +1 -1
- package/.next/server/app/api/practice/record/route.js +11 -10
- package/.next/server/app/api/practice/record/route.js.nft.json +1 -1
- package/.next/server/app/api/reanswer/route.js +12 -11
- package/.next/server/app/api/reanswer/route.js.nft.json +1 -1
- package/.next/server/app/api/register/route.js +1 -1
- package/.next/server/app/api/register/route.js.nft.json +1 -1
- package/.next/server/app/api/register/status/route.js +1 -1
- package/.next/server/app/api/register/status/route.js.nft.json +1 -1
- package/.next/server/app/api/review/due/route.js +14 -13
- package/.next/server/app/api/review/due/route.js.nft.json +1 -1
- package/.next/server/app/api/settings/route.js +5 -5
- package/.next/server/app/api/settings/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/route.js +1 -1
- package/.next/server/app/api/setup/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/tts/[id]/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/tts/[id]/route/build-manifest.json +12 -0
- package/.next/server/app/api/tts/[id]/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/tts/[id]/route.js +15 -0
- package/.next/server/app/api/tts/[id]/route.js.map +5 -0
- package/.next/server/app/api/tts/[id]/route.js.nft.json +1 -0
- package/.next/server/app/api/tts/[id]/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/tts/route/app-paths-manifest.json +3 -0
- package/.next/server/app/api/tts/route/build-manifest.json +12 -0
- package/.next/server/app/api/tts/route/server-reference-manifest.json +4 -0
- package/.next/server/app/api/tts/route.js +16 -0
- package/.next/server/app/api/tts/route.js.map +5 -0
- package/.next/server/app/api/tts/route.js.nft.json +1 -0
- package/.next/server/app/api/tts/route_client-reference-manifest.js +3 -0
- package/.next/server/app/api/user/route.js +12 -11
- 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/login/page.js.nft.json +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +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/review/page.js.nft.json +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/setup/page.js.nft.json +1 -1
- package/.next/server/app/setup/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 +2 -0
- package/.next/server/chunks/[externals]_fs_1d5jh8vp8y6zt._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1xhs0kkx6buw2._.js → [root-of-the-server]__0-b-yvjz48rkt._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0-t1auf1a8_or._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0q05h3d_kzdhv._.js → [root-of-the-server]__00tywaxi-8b1l._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__061x45fxd07dm._.js → [root-of-the-server]__024r-wywnoxyp._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__0uyibcf2mejgf._.js → [root-of-the-server]__02v0ig608r6y0._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0eu0cxcftsajx._.js → [root-of-the-server]__04q1m399dcul6._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0ih72ek59msql._.js → [root-of-the-server]__06xho6u8le3e7._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__01zmywofxv44d._.js → [root-of-the-server]__07h2t-yzug3sg._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__04r2yjj4knt9x._.js → [root-of-the-server]__07ku06p8ztq1g._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__02diwny9l07g2._.js → [root-of-the-server]__08d7_pq6_q2gg._.js} +1 -1
- package/.next/server/chunks/{[root-of-the-server]__072txw4y-7b6q._.js → [root-of-the-server]__08thdsjzsvn6f._.js} +1 -1
- package/.next/server/chunks/[root-of-the-server]__0a-iuqynn3h9d._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0aganwocduyac._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ergl3gmxvrz3._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0zb48en2m8yk0._.js → [root-of-the-server]__0gvvuk0avtpy9._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1-511qnr-fg_q._.js → [root-of-the-server]__0j6f-2sb1zvv-._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0juklkqip-kat._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0kwkbvjwb6ms2._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0lqng_pqv30ts._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0m257tbsmg_jc._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0mtgqo3_a6ft3._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1ec346yss6x_e._.js → [root-of-the-server]__0odzrih6i03_7._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0-_fe0i5gihj2._.js → [root-of-the-server]__0orbb3gvf9h5l._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0ozf21hrh_433._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0nl_kgnqabv4e._.js → [root-of-the-server]__0rnwilu01f1tc._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1gg8lq2q9gzg2._.js → [root-of-the-server]__0rt84iswe-353._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0s0eusp3mojnx._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0sg1yp-qgcx3j._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0ssa-hz8b3v1i._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0vn353txu1ok5._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1-t5hw-med-kv._.js → [root-of-the-server]__0w12wrduqkml_._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__0wm4req5e6m88._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0wmczeyrx2y7f._.js +1 -1
- package/.next/server/chunks/[root-of-the-server]__0xe-f_x7j4c7y._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0xicme9m81rzt._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0yx12uf2avp6d._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__0zq53ytq2jm_b._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__08fwru7fkvvl6._.js → [root-of-the-server]__10s5jgr6l7shg._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__114quo-_-qi9w._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__11n5u21llw3hz._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1222jdedtloy5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__13ybp1up1_pp_._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0aq32mo414sro._.js → [root-of-the-server]__14-k7ayd3a8_l._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0wbt3upu-nuk1._.js → [root-of-the-server]__14hy-qeyktudc._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__15v_gsaqeo7q-._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__16-d6bl8bbqvy._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__16h8j4mow34et._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__18vii2hl-fo31._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__190oggsfw-98b._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1_04f-bpuf75t._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1_hpgx5rlxpya._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0nei0h0dla9ks._.js → [root-of-the-server]__1ban_cu4u5ktr._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0-mtuz1y2hrt_._.js → [root-of-the-server]__1f8bfi9fgos0g._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1qb-t64xfqxeo._.js → [root-of-the-server]__1gx-b_vxyk--4._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__0byn0wv2ulvf1._.js → [root-of-the-server]__1h-b09z-j8jp8._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1h2nhu8op07o7._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__0tjdhrskz55su._.js → [root-of-the-server]__1h8y4ve4ddvy5._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__1dkb17rbhyexw._.js → [root-of-the-server]__1krabeg6sihbm._.js} +2 -2
- package/.next/server/chunks/{[root-of-the-server]__099_6fekx8t5u._.js → [root-of-the-server]__1mj__r5f_o6lo._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1mn88gcnj5c8i._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__19uj-sk5cp6hw._.js → [root-of-the-server]__1q9pzdlt18lp0._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__1sw3rkr-79ykm._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1thdx6loe3xd4._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1ukn55clu33ii._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1vbqkl7rn1dbm._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1wnku4diwmv6z._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1y7job8gfr7ww._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1yaxekogcfb41._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1yhu07loxowr5._.js +3 -0
- package/.next/server/chunks/[root-of-the-server]__1zp57dov6qagu._.js +3 -0
- package/.next/server/chunks/{[root-of-the-server]__1sat028hivrbm._.js → [root-of-the-server]__208t95lee6s99._.js} +2 -2
- package/.next/server/chunks/[root-of-the-server]__20m7u7lg4e5q8._.js +3 -0
- package/.next/server/chunks/{_0hkdm23o05kvp._.js → _0t4hmii1np2ho._.js} +3 -3
- package/.next/server/chunks/_11_p1ahjjply_._.js +3 -0
- package/.next/server/chunks/_12w5k19rc45j_._.js +1 -1
- package/.next/server/chunks/_1_ns7o3cqznv6._.js +1 -1
- package/.next/server/chunks/_1ahi8466v1b3l._.js +3 -0
- package/.next/server/chunks/_1j8kqz21_i728._.js +3 -0
- package/.next/server/chunks/{_0lsw6_-5hpp0x._.js → _1oy0tspjrakxd._.js} +3 -3
- package/.next/server/chunks/_next-internal_server_app_api_tts_[id]_route_actions_12l2oplt6y56y.js +3 -0
- package/.next/server/chunks/_next-internal_server_app_api_tts_route_actions_19kapfgudczow.js +3 -0
- package/.next/server/chunks/node_modules_zod_v4_classic_external_1h9u5hd8e7zk0.js +8 -8
- package/.next/server/chunks/src_lib_1mno8g5cqmaet._.js +3 -0
- package/.next/server/chunks/src_lib_1qy5aajgog9r2._.js +3 -0
- package/.next/server/chunks/{src_lib_0es8upktx5_5c._.js → src_lib_ai_prompts_ts_0z36zms4djibp._.js} +43 -43
- package/.next/server/chunks/src_lib_minimax-code_checkin_ts_1j1mpuxc1vgoz._.js +1 -1
- package/.next/server/chunks/src_lib_tts_19zri-v8-l_4u._.js +16 -0
- package/.next/server/chunks/ssr/[root-of-the-server]__1w4rew5br9_b8._.js +3 -0
- package/.next/server/chunks/ssr/_00np6xqvkg6u-._.js +1 -1
- package/.next/server/chunks/ssr/_04ziy8_ak_olr._.js +1 -1
- package/.next/server/chunks/ssr/_09gyxodn5bpsw._.js +4 -0
- package/.next/server/chunks/ssr/{_1mw-oovvzrn8_._.js → _1yaa5p1rk6i7c._.js} +1 -1
- package/.next/server/chunks/ssr/src_1gayunqs8u2e2._.js +1 -1
- package/.next/server/chunks/ssr/src_app_error-items_[id]_page_tsx_04xwwdmyh7_9q._.js +1 -1
- package/.next/server/chunks/ssr/src_components_providers_tsx_09kw-mv3nb6xs._.js +2 -2
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/0-_s_oel8jb5s.js +1 -0
- package/.next/static/chunks/0dizg7xu7sle2.js +1 -0
- package/.next/static/chunks/{1kx-lcqi4aref.js → 0ebem2w42rgm6.js} +7 -7
- package/.next/static/chunks/188s0rumoz5yj.js +1 -0
- package/.next/static/chunks/1c_3by-e4c6ix.js +2 -0
- package/package.json +1 -1
- package/prisma/seed.db +0 -0
- package/.next/server/chunks/[root-of-the-server]__00s2hc-f4f5gd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0auuq_0yerirb._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0c0x5d85vbcbv._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0c4jdg0ga4zfe._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0dqbew6anw2kd._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0e7_0-o90esy-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0i_w6t6qj_061._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0mmexlpsghj6s._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0n7bhn294-vlt._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0p-cdsmp78i6-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0qo744v4hy8lp._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0suoe7tm4396u._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0tflseuizxpen._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0ue14np4llg3a._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0uwpcliduox5r._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0uz7-ix0696nv._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0v93i_mmy7uws._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0wm4qw5cu0956._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__0zvdl3gsgb2ll._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__11l6a17qelkj9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__12iwnvw4r0gus._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__15fllrli2pdl7._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__15t37vaiu6w-o._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__18874ssgfq8hf._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1_8btngjew64q._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1euogp-jmbdbn._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1h2gs1l_ocut-._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1k750v6l878d9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ks5l0ekcojb6._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1lrmakvt35ktq._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1o82fhau9qctf._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ox-1hd5csbnf._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1pkcickey-b8h._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1ptillth3o9z9._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1q43lvwugn4yx._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1s7d_mp0a6lzl._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1sfc4ds1btvga._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1t11647vnxh3m._.js +0 -3
- package/.next/server/chunks/[root-of-the-server]__1yk2mvyhb_u32._.js +0 -3
- package/.next/server/chunks/_1pvqo-qnv-nqm._.js +0 -3
- package/.next/server/chunks/_1w_arlbn0o07b._.js +0 -11
- package/.next/server/chunks/src_lib_05svhzm9a162-._.js +0 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0x_ihemma9171._.js +0 -3
- package/.next/server/chunks/ssr/_1gjb-bqi25yci._.js +0 -3
- package/.next/static/chunks/0g5r7y3bbmc-b.js +0 -1
- package/.next/static/chunks/22inup6g2i-7n.js +0 -1
- package/.next/static/chunks/31masz5ywwx8m.js +0 -1
- package/.next/static/chunks/40a5neotpd0pu.js +0 -1
- /package/.next/static/{65W6wu_pTgcQldOtRe-13 → x6fwUxfhT4hZ2tYr6cKl_}/_buildManifest.js +0 -0
- /package/.next/static/{65W6wu_pTgcQldOtRe-13 → x6fwUxfhT4hZ2tYr6cKl_}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{65W6wu_pTgcQldOtRe-13 → x6fwUxfhT4hZ2tYr6cKl_}/_ssgManifest.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(843476),t=e.i(111110),a=e.i(217255),r=e.i(215519),i=e.i(325164),n=e.i(522016),l=e.i(618566),c=e.i(217923),o=e.i(810980),d=e.i(551804),m=e.i(178583),u=e.i(292270),x=e.i(475254);let h=(0,x.f)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),p=(0,x.f)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var f=e.i(271645);let g=(0,x.f)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),j=(0,x.f)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),b=(0,x.f)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var y=e.i(763639),v=e.i(531278);let w=(0,x.f)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),N=(0,x.f)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var k=e.i(284614),S=e.i(733060),C=e.i(519455),T=e.i(776639),A=e.i(677572),M=e.i(306831),_=e.i(487486),E=e.i(699375),D=e.i(793479),z=e.i(110204),F=e.i(975157);let L=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,F.f)("w-full caption-bottom text-sm",e),...t})}));L.displayName="Table";let R=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,F.f)("[&_tr]:border-b",e),...t}));R.displayName="TableHeader";let I=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,F.f)("[&_tr:last-child]:border-0",e),...t}));I.displayName="TableBody",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,F.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}))).displayName="TableFooter";let $=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,F.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));$.displayName="TableRow";let U=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,F.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));U.displayName="TableHead";let P=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,F.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));P.displayName="TableCell",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,F.f)("mt-4 text-sm text-muted-foreground",e),...t}))).displayName="TableCaption";var O=e.i(727612);let q=(0,x.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var H=e.i(269638),V=e.i(41931),Y=e.i(294114),W=e.i(201276),B=e.i(303163);function J(){let{timeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),{t:n}=(0,t.b)(),[l,c]=(0,f.useState)([]),[o,d]=(0,f.useState)(!0),[m,u]=(0,f.useState)(!1),[x,h]=(0,f.useState)(!1),[p,g]=(0,f.useState)("0"),[j,b]=(0,f.useState)(!1),y=(0,f.useCallback)(async()=>{d(!0);try{let e=await V.f.get("/api/admin/users");c(e)}catch(e){W.f.error("[UserManagement]","Failed to fetch users",{error:e})}finally{d(!1)}},[]),w=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/settings");u(!0===e.allowRegistration),g(String(e.aiDailyLimit??0))}catch(e){W.f.error("[UserManagement]","Failed to fetch config",{error:e})}},[]);(0,f.useEffect)(()=>{y(),w()},[y,w]);let N=async e=>{h(!0);try{await V.f.post("/api/settings",{allowRegistration:e}),u(e)}catch(e){W.f.error("[UserManagement]","Failed to update registration setting",{error:e}),Y.c.error(n.common.error)}finally{h(!1)}},k=Number(p),S=""!==p.trim()&&Number.isInteger(k)&&k>=0,T=async()=>{if(S){b(!0);try{await V.f.post("/api/settings",{aiDailyLimit:k}),Y.c.success(n.admin.aiDailyLimitSaved)}catch(e){W.f.error("[UserManagement]","Failed to update AI daily limit",{error:e}),Y.c.error(n.common.error)}finally{b(!1)}}},A=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,Y.u)(s))try{await V.f.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),y()}catch(e){W.f.error("[UserManagement]","Failed to update user status",{error:e}),Y.c.error(n.common.error)}},F=async e=>{if(await (0,Y.u)(n.admin.confirmDelete,{destructive:!0}))try{await V.f.delete(`/api/admin/users/${e.id}`),y()}catch(s){W.f.error("[UserManagement]","Failed to delete user",{error:s});let e=(0,B.d)(s)||n.common.error;Y.c.error(e)}};return o?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(v.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(z.f,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(v.f,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(E.f,{checked:m,onCheckedChange:N,disabled:x})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(z.f,{htmlFor:"ai-daily-limit",className:"text-base",children:n.admin.aiDailyLimit}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin.aiDailyLimitDesc})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(D.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:e=>g(e.target.value),"aria-invalid":!S,className:"w-24"}),(0,s.jsxs)(C.f,{size:"sm",onClick:T,disabled:j||!S,children:[j&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.common.save]})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:l.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(_.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords," | ",n.admin.aiUsageToday,": ",t.aiUsageToday]}),(0,s.jsx)(_.f,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,M.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(L,{children:[(0,s.jsx)(R,{children:(0,s.jsxs)($,{children:[(0,s.jsx)(U,{children:n.admin.nameEmail}),(0,s.jsx)(U,{children:n.admin.role}),(0,s.jsx)(U,{children:n.admin.stats}),(0,s.jsx)(U,{children:n.admin.createdAt}),(0,s.jsx)(U,{children:n.admin.status}),(0,s.jsx)(U,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(I,{children:l.map(t=>(0,s.jsxs)($,{children:[(0,s.jsxs)(P,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(P,{children:(0,s.jsx)(_.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(P,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.aiUsageToday,": ",t.aiUsageToday]})]}),(0,s.jsx)(P,{children:(0,M.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(P,{children:(0,s.jsx)(_.f,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(P,{className:"text-right space-x-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,title:n.admin.delete,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var X=e.i(778917);let G=(0,x.f)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),K=(0,x.f)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Z=(0,x.f)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Q(){return window.WrongNotebookAndroid??null}let ee=()=>()=>void 0;function es(){let{t:e}=(0,t.b)(),a=(0,f.useSyncExternalStore)(ee,Q,()=>null);return a?a.isStandalone?.()?(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:e.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"break-all",children:[e.settings?.about?.androidServer||"Server",": ",a.getServerUrl()]}),(0,s.jsxs)(C.f,{variant:"outline",className:"gap-2",onClick:()=>a.changeServer(),children:[(0,s.jsx)(Z,{className:"h-4 w-4"}),e.settings?.about?.changeServer||"Change server"]})]}):null}let et="https://github.com/margrop/wrong-notebook";function ea(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)("");(0,f.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>r(e.version)).catch(()=>{})},[]);let i=[{href:et,icon:G,label:e.settings?.about?.github||"GitHub Repository"},{href:`${et}/releases`,icon:K,label:e.settings?.about?.releaseNotes||"Release Notes"},{href:`${et}/issues`,icon:w,label:e.settings?.about?.feedback||"Feedback"}];return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:e.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:e.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,s.jsx)(b,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[e.settings?.about?.version||"Version",": v",a||"unknown"]})]}),(0,s.jsx)(es,{}),(0,s.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:i.map(({href:e,icon:t,label:a})=>(0,s.jsx)(C.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(t,{className:"h-4 w-4"}),a,(0,s.jsx)(X.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:e.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var er=e.i(37038),ei=e.i(967489);let en={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function el(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(en),[i,n]=(0,f.useState)(""),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),m=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/user");r({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){W.f.error("[AccountSettings]","Failed to fetch profile",{error:e})}finally{c(!1)}},[]);(0,f.useEffect)(()=>{m()},[m]);let u=async()=>{if(a.password&&a.password!==i)return void Y.c.error(e.settings?.messages?.passwordMismatch||"Passwords do not match");d(!0);try{let s={name:a.name,email:a.email,educationStage:a.educationStage};a.enrollmentYear&&(s.enrollmentYear=parseInt(a.enrollmentYear.toString())),a.password&&(s.password=a.password),await V.f.patch("/api/user",s),Y.c.success(e.settings?.messages?.profileUpdated||"Profile updated"),r(e=>({...e,password:""})),n(""),window.location.reload()}catch(s){W.f.error("[AccountSettings]","Failed to update profile",{error:(0,B.d)(s)??(0,B.Z)(s)}),Y.c.error((0,B.d)(s)||e.settings?.messages?.updateFailed||"Update failed")}finally{d(!1)}};return l?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(v.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.name||"Name"}),(0,s.jsx)(D.f,{value:a.name||"",onChange:e=>r({...a,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.email||"Email"}),(0,s.jsx)(D.f,{value:a.email||"",onChange:e=>r({...a,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(ei.d,{value:a.educationStage||"",onValueChange:e=>r({...a,educationStage:e}),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{placeholder:e.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"primary",children:e.auth?.primary||"Primary School"}),(0,s.jsx)(ei.T,{value:"junior_high",children:e.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(ei.T,{value:"senior_high",children:e.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(ei.T,{value:"university",children:e.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(D.f,{type:"number",value:a.enrollmentYear||"",onChange:e=>r({...a,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsx)(er.f,{value:a.password,onChange:e=>r({...a,password:e.target.value}),placeholder:"******",minLength:6})]}),a.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:e.auth?.confirmPassword||"Confirm Password"}),(0,s.jsx)(er.f,{value:i,onChange:e=>n(e.target.value),placeholder:"******",minLength:6})]})]}),(0,s.jsxs)(C.f,{onClick:u,disabled:o,className:"w-full",children:[o&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.settings?.account?.update||"Update Profile"]})]})}var ec=e.i(10038),eo=e.i(16715);let ed={info:{card:"border-blue-200 bg-blue-50",title:"text-blue-900 font-bold",desc:"text-blue-800 font-medium",button:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300"},danger:{card:"border-red-200 bg-red-50",title:"text-red-700 font-medium",desc:"text-red-600",button:""},critical:{card:"border-red-600/50 bg-red-100/50",title:"text-red-900 font-bold",desc:"text-red-800 font-medium",button:"bg-red-700 hover:bg-red-800"}};function em({title:e,description:t,tone:a,busy:r,icon:i,onClick:n}){let l=ed[a];return(0,s.jsxs)("div",{className:`p-4 border rounded-lg ${l.card}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:`text-sm flex items-center gap-2 ${l.title}`,children:e}),(0,s.jsx)(C.f,{variant:"info"===a?"outline":"destructive",size:"sm",onClick:n,disabled:r,className:l.button,children:r?(0,s.jsx)(v.f,{className:"h-4 w-4 animate-spin"}):i})]}),(0,s.jsx)("p",{className:`text-xs mt-2 ${l.desc}`,children:t})]})}function eu({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(null),n=async(e,s,t,a)=>{i(e);try{Y.c.success(await s()),a&&window.location.reload()}catch(s){W.f.error("[DangerZoneSettings]",`${e} failed`,{error:s}),Y.c.error(t)}finally{i(null)}},l=a.settings?.clearSuccess||"Success",c=a.settings?.clearError||"Failed",o=async()=>{await (0,Y.u)(a.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await n("migrateTags",async()=>{let e=await V.f.post("/api/admin/migrate-tags",{});return`${l}: ${e.count||0} tags migrated.`},a.settings?.clearError||"Failed to migrate tags",!1)},d=async()=>{await (0,Y.u)(a.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearPractice",async()=>(await V.f.delete("/api/stats/practice/clear"),l),c,!0)},m=async()=>{await (0,Y.u)(a.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearErrors",async()=>(await V.f.delete("/api/error-items/clear"),l),c,!0)},u=async()=>{if(!await (0,Y.u)(a.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(a.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&Y.c.error(a.common?.error||"Confirmation failed");return}await n("systemReset",async()=>(await V.f.post("/api/admin/system-reset",{}),a.settings?.clearSuccess||"Success - System Reset Complete"),a.settings?.clearError||"Failed to reset system",!0)};return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)(em,{tone:"info",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eo.f,{className:"h-4 w-4"}),a.settings?.migrateTags||"Migrate Tags"]}),description:a.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===r,icon:(0,s.jsx)(eo.f,{className:"h-4 w-4"}),onClick:o}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearData||"Clear Practice Data",description:a.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:d}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearErrorData||"Clear Error Data",description:a.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:m}),e&&(0,s.jsx)(em,{tone:"critical",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g,{className:"h-4 w-4"}),a.settings?.systemReset||"System Initialization"]}),description:a.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:u})]})}var ex=e.i(595468),eh=e.i(440160);let ep=(0,x.f)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);async function ef(e,s){let t=await fetch(e);if(!t.ok)throw Error((await t.json().catch(()=>({}))).message||"Export failed");let a=await t.blob(),r=window.URL.createObjectURL(a),i=document.createElement("a");i.href=r;let n=t.headers.get("Content-Disposition")?.match(/filename="(.+)"/);i.download=n?n[1]:s,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function eg({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(!1),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(null),d=async e=>{if(!e||await (0,Y.u)(a.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){i(!0);try{await ef(e?"/api/export?all=true":"/api/export",e?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),Y.c.success(a.settings?.exportSuccess||"Export successful")}catch(s){W.f.error("[DataBackupSettings]",e?"Export all failed":"Export failed",{error:s}),Y.c.error(a.settings?.exportFailed||"Export failed")}finally{i(!1)}}},m=async e=>{if(!c)return;let s=e?a.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":a.settings?.importConfirm||"Are you sure you want to import?";if(await (0,Y.u)(s)){l(!0);try{let s=JSON.parse(await c.text()),{stats:t}=await V.f.post(e?"/api/import?all=true":"/api/import",s);Y.c.success((a.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{papers}",String(t.examPapersCreated??0)).replace("{duplicates}",String(t.duplicateErrorItems??0))),o(null),window.location.reload()}catch(s){W.f.error("[DataBackupSettings]",e?"Import all failed":"Import failed",{error:s}),Y.c.error(a.settings?.importFailed||"Import failed")}finally{l(!1)}}},u=(e,t)=>e?(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}):t;return(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:a.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!1),disabled:r,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportData||"Export"]}),e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:r,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>o(e.target.files?.[0]??c),className:"hidden",id:"import-file-input",disabled:n}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:n,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(n,(0,s.jsx)(ep,{className:"mr-2 h-4 w-4"})),c?.name||a.settings?.selectFile||"Select File"]}),c&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!1),disabled:n,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importData||"Import"]}),c&&e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:n,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var ej=e.i(307364);function eb({field:e,label:a,description:r}){let{t:i}=(0,t.b)(),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(!1),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)(null),h=`preference-${e}`;(0,f.useEffect)(()=>{V.f.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>o(!0))},[e]);let p=async s=>{l(s),m(!0);try{await V.f.patch("/api/user",{[e]:s}),x(i.importFlow.preferenceSaved)}catch(t){l(!s),x(i.importFlow.preferenceSaveFailed),W.f.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(z.f,{htmlFor:h,children:a}),(0,s.jsx)(E.f,{id:h,checked:n,onCheckedChange:p,disabled:!c||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function ey(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function ev(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}var ew=e.i(905110);function eN(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(String(ew.z)),[i,n]=(0,f.useState)(null),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),[m,u]=(0,f.useState)(null),x=Number(a),h=""!==a.trim()&&Number.isInteger(x)&&x>=ew.P&&x<=ew.o,p=(0,f.useCallback)(async()=>{c(!0),u(null);try{let e=(await V.f.get("/api/user")).masteryThreshold??ew.z;r(String(e)),n(e)}catch(s){u(e.mastery.thresholdLoadFailed),W.f.error("[Settings]","加载已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{c(!1)}},[e.mastery.thresholdLoadFailed]);(0,f.useEffect)(()=>{p()},[p]);let g=async()=>{if(h&&null!==i){d(!0),u(null);try{let s=(await V.f.patch("/api/user",{masteryThreshold:x})).masteryThreshold??x;n(s),r(String(s)),u(e.importFlow.preferenceSaved)}catch(s){u(e.importFlow.preferenceSaveFailed),W.f.error("[Settings]","保存已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{d(!1)}}};return(0,s.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,s.jsx)(z.f,{htmlFor:"mastery-threshold",children:e.mastery.thresholdLabel}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(D.f,{id:"mastery-threshold",type:"number",min:ew.P,max:ew.o,step:1,value:a,onChange:e=>{r(e.target.value),u(null)},disabled:l||o||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,s.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,s.jsxs)(C.f,{type:"button",size:"sm",variant:"outline",onClick:g,disabled:l||o||null===i||!h||x===i,children:[(l||o)&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.importFlow.saveThreshold]}),!l&&null===i&&(0,s.jsx)(C.f,{type:"button",size:"sm",variant:"outline",onClick:p,children:e.importFlow.retryLoad})]}),(0,s.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:e.mastery.thresholdDescription}),null!==i&&!h&&(0,s.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:e.mastery.thresholdInvalid}),m&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:m})]})}function ek(){let{t:e}=(0,t.b)();return(0,s.jsx)(eb,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eS({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.b)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(z.f,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(D.f,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}function eC({config:e,setConfig:a,isAdmin:i,disabled:n}){let{t:l,language:c,setLanguage:o}=(0,t.b)(),{timeZone:d}=(0,r.M)(),m=e=>a(s=>({...s,timeouts:{...s.timeouts,analyze:1e3*e}}));return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(z.f,{children:l.settings?.language||"Language"}),(0,s.jsxs)(ei.d,{value:c,onValueChange:e=>o(e),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(ei.T,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eS,{value:e.timeZone??d,onChange:e=>a(s=>({...s,timeZone:e})),disabled:!i||n}),i&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(z.f,{children:l.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(D.f,{type:"number",value:e.timeouts?.analyze?e.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);m(isNaN(s)?0:s)},onBlur:()=>{let s=(e.timeouts?.analyze||0)/1e3,t=Math.min(600,Math.max(120,s));t!==s&&m(t)},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(ev,{}),(0,s.jsx)(ek,{}),(0,s.jsx)(ey,{}),(0,s.jsx)(ej.f,{}),(0,s.jsx)(eN,{})]})}var eT=e.i(624687),eA=e.i(247167);let eM={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function e_(e,s={}){let t,a=eM[e],r=(t=eA.default.env.LOG_LEVEL?.toLowerCase())&&void 0!==eM[t]?eM[t]:eM.info;return(t,i)=>{let n,l;if(a<r)return;let c=new Date;"string"==typeof t?(n={},l=t):(n=t,l=i||"");{let t=JSON.stringify({level:e,time:c.toISOString(),...s,...n,msg:l});switch(e){case"error":case"fatal":console.error(t);break;case"warn":console.warn(t);break;default:console.log(t)}}}}(function e(s={}){return s.module,{trace:e_("trace",s),debug:e_("debug",s),info:e_("info",s),warn:e_("warn",s),error:e_("error",s),fatal:e_("fatal",s),child:t=>e({...s,...t}),box:(e,t,a="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...s,title:e,..."string"==typeof t?{content:t}:t||{},msg:e}))},divider:(e="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let eE=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,1661,e=>{"use strict";var s=e.i(843476),t=e.i(111110),a=e.i(217255),r=e.i(215519),i=e.i(325164),n=e.i(522016),l=e.i(618566),c=e.i(217923),o=e.i(810980),d=e.i(551804),m=e.i(178583),u=e.i(292270),x=e.i(475254);let h=(0,x.f)("circle-plus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]),p=(0,x.f)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);var f=e.i(271645);let g=(0,x.f)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),j=(0,x.f)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]),v=(0,x.f)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var y=e.i(763639),b=e.i(531278);let w=(0,x.f)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),N=(0,x.f)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var k=e.i(284614),S=e.i(733060),C=e.i(519455),T=e.i(776639),A=e.i(677572),_=e.i(306831),E=e.i(487486),M=e.i(699375),D=e.i(793479),R=e.i(110204),F=e.i(975157);let z=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("div",{className:"relative w-full overflow-auto",children:(0,s.jsx)("table",{ref:a,className:(0,F.f)("w-full caption-bottom text-sm",e),...t})}));z.displayName="Table";let I=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("thead",{ref:a,className:(0,F.f)("[&_tr]:border-b",e),...t}));I.displayName="TableHeader";let L=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tbody",{ref:a,className:(0,F.f)("[&_tr:last-child]:border-0",e),...t}));L.displayName="TableBody",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tfoot",{ref:a,className:(0,F.f)("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}))).displayName="TableFooter";let $=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("tr",{ref:a,className:(0,F.f)("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));$.displayName="TableRow";let U=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("th",{ref:a,className:(0,F.f)("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));U.displayName="TableHead";let P=f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("td",{ref:a,className:(0,F.f)("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));P.displayName="TableCell",(f.forwardRef(({className:e,...t},a)=>(0,s.jsx)("caption",{ref:a,className:(0,F.f)("mt-4 text-sm text-muted-foreground",e),...t}))).displayName="TableCaption";var O=e.i(727612);let q=(0,x.f)("ban",[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);var H=e.i(269638),V=e.i(41931),Y=e.i(294114),W=e.i(201276),B=e.i(303163);function J(){let{timeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),{t:n}=(0,t.b)(),[l,c]=(0,f.useState)([]),[o,d]=(0,f.useState)(!0),[m,u]=(0,f.useState)(!1),[x,h]=(0,f.useState)(!1),[p,g]=(0,f.useState)("0"),[j,v]=(0,f.useState)(!1),y=(0,f.useCallback)(async()=>{d(!0);try{let e=await V.f.get("/api/admin/users");c(e)}catch(e){W.f.error("[UserManagement]","Failed to fetch users",{error:e})}finally{d(!1)}},[]),w=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/settings");u(!0===e.allowRegistration),g(String(e.aiDailyLimit??0))}catch(e){W.f.error("[UserManagement]","Failed to fetch config",{error:e})}},[]);(0,f.useEffect)(()=>{y(),w()},[y,w]);let N=async e=>{h(!0);try{await V.f.post("/api/settings",{allowRegistration:e}),u(e)}catch(e){W.f.error("[UserManagement]","Failed to update registration setting",{error:e}),Y.c.error(n.common.error)}finally{h(!1)}},k=Number(p),S=""!==p.trim()&&Number.isInteger(k)&&k>=0,T=async()=>{if(S){v(!0);try{await V.f.post("/api/settings",{aiDailyLimit:k}),Y.c.success(n.admin.aiDailyLimitSaved)}catch(e){W.f.error("[UserManagement]","Failed to update AI daily limit",{error:e}),Y.c.error(n.common.error)}finally{v(!1)}}},A=async e=>{let s=e.isActive?n.admin.confirmDisable:n.admin.confirmEnable;if(await (0,Y.u)(s))try{await V.f.patch(`/api/admin/users/${e.id}`,{isActive:!e.isActive}),y()}catch(e){W.f.error("[UserManagement]","Failed to update user status",{error:e}),Y.c.error(n.common.error)}},F=async e=>{if(await (0,Y.u)(n.admin.confirmDelete,{destructive:!0}))try{await V.f.delete(`/api/admin/users/${e.id}`),y()}catch(s){W.f.error("[UserManagement]","Failed to delete user",{error:s});let e=(0,B.d)(s)||n.common.error;Y.c.error(e)}};return o?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(b.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border rounded-lg bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(R.f,{className:"text-base",children:n.admin?.allowRegistration||"Allow New Registrations"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin?.allowRegistrationDesc||"When disabled, new users cannot register"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[x&&(0,s.jsx)(b.f,{className:"h-4 w-4 animate-spin"}),(0,s.jsx)(M.f,{checked:m,onCheckedChange:N,disabled:x})]})]}),(0,s.jsxs)("div",{className:"flex flex-col gap-3 p-4 border rounded-lg bg-muted/30 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("div",{className:"space-y-0.5",children:[(0,s.jsx)(R.f,{htmlFor:"ai-daily-limit",className:"text-base",children:n.admin.aiDailyLimit}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:n.admin.aiDailyLimitDesc})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(D.f,{id:"ai-daily-limit",type:"number",min:0,step:1,inputMode:"numeric",value:p,onChange:e=>g(e.target.value),"aria-invalid":!S,className:"w-24"}),(0,s.jsxs)(C.f,{size:"sm",onClick:T,disabled:j||!S,children:[j&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.common.save]})]})]}),(0,s.jsx)("div",{className:"sm:hidden space-y-3",children:l.map(t=>(0,s.jsxs)("div",{className:"border rounded-lg p-4 bg-card space-y-3",children:[(0,s.jsxs)("div",{className:"flex justify-between items-start",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(E.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})]}),(0,s.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,s.jsxs)("div",{className:"text-muted-foreground",children:[n.admin.errors,": ",t._count.errorItems," | ",n.admin.practiceCount,": ",t._count.practiceRecords," | ",n.admin.aiUsageToday,": ",t.aiUsageToday]}),(0,s.jsx)(E.f,{variant:t.isActive?"default":"destructive",className:"text-xs",children:t.isActive?n.admin.active:n.admin.disabled})]}),(0,s.jsxs)("div",{className:"flex justify-between items-center pt-2 border-t",children:[(0,s.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,_.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]})]},t.id))}),(0,s.jsx)("div",{className:"hidden sm:block border rounded-lg overflow-hidden",children:(0,s.jsxs)(z,{children:[(0,s.jsx)(I,{children:(0,s.jsxs)($,{children:[(0,s.jsx)(U,{children:n.admin.nameEmail}),(0,s.jsx)(U,{children:n.admin.role}),(0,s.jsx)(U,{children:n.admin.stats}),(0,s.jsx)(U,{children:n.admin.createdAt}),(0,s.jsx)(U,{children:n.admin.status}),(0,s.jsx)(U,{className:"text-right",children:n.admin.actions})]})}),(0,s.jsx)(L,{children:l.map(t=>(0,s.jsxs)($,{children:[(0,s.jsxs)(P,{children:[(0,s.jsx)("div",{className:"font-medium",children:t.name||"N/A"}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:t.email})]}),(0,s.jsx)(P,{children:(0,s.jsx)(E.f,{variant:"admin"===t.role?"default":"secondary",children:"admin"===t.role?n.admin.admin:n.admin.user})}),(0,s.jsxs)(P,{children:[(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.errors,": ",t._count.errorItems]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.practiceCount,": ",t._count.practiceRecords]}),(0,s.jsxs)("div",{className:"text-sm",children:[n.admin.aiUsageToday,": ",t.aiUsageToday]})]}),(0,s.jsx)(P,{children:(0,_.r)(t.createdAt,"yyyy-MM-dd",e)}),(0,s.jsx)(P,{children:(0,s.jsx)(E.f,{variant:t.isActive?"default":"destructive",children:t.isActive?n.admin.active:n.admin.disabled})}),(0,s.jsxs)(P,{className:"text-right space-x-2",children:[(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>A(t),disabled:t.id===i?.user?.id,title:t.isActive?n.admin.disable:n.admin.enable,children:t.isActive?(0,s.jsx)(q,{className:"h-4 w-4 text-orange-500"}):(0,s.jsx)(H.f,{className:"h-4 w-4 text-green-500"})}),(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:()=>F(t),disabled:t.id===i?.user?.id,title:n.admin.delete,children:(0,s.jsx)(O.f,{className:"h-4 w-4 text-destructive"})})]})]},t.id))})]})})]})}var K=e.i(778917);let X=(0,x.f)("github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]),G=(0,x.f)("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),Z=(0,x.f)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);function Q(){return window.WrongNotebookAndroid??null}let ee=()=>()=>void 0;function es(){let{t:e}=(0,t.b)(),a=(0,f.useSyncExternalStore)(ee,Q,()=>null);return a?a.isStandalone?.()?(0,s.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:e.settings?.about?.androidStandalone||"Running on this device. Data is stored only on this device."}):(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsxs)("span",{className:"break-all",children:[e.settings?.about?.androidServer||"Server",": ",a.getServerUrl()]}),(0,s.jsxs)(C.f,{variant:"outline",className:"gap-2",onClick:()=>a.changeServer(),children:[(0,s.jsx)(Z,{className:"h-4 w-4"}),e.settings?.about?.changeServer||"Change server"]})]}):null}let et="https://github.com/margrop/wrong-notebook";function ea(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)("");(0,f.useEffect)(()=>{fetch("/api/version").then(e=>e.json()).then(e=>r(e.version)).catch(()=>{})},[]);let i=[{href:et,icon:X,label:e.settings?.about?.github||"GitHub Repository"},{href:`${et}/releases`,icon:G,label:e.settings?.about?.releaseNotes||"Release Notes"},{href:`${et}/issues`,icon:w,label:e.settings?.about?.feedback||"Feedback"}];return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-6 py-8 text-center bg-muted/30 rounded-lg border",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("h3",{className:"text-2xl font-bold",children:e.app?.title||"Smart Error Notebook"}),(0,s.jsx)("p",{className:"text-muted-foreground",children:e.settings?.about?.desc||"AI-powered learning assistant"})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-2 text-sm text-muted-foreground border px-4 py-2 rounded-full bg-background",children:[(0,s.jsx)(v,{className:"h-4 w-4"}),(0,s.jsxs)("span",{children:[e.settings?.about?.version||"Version",": v",a||"unknown"]})]}),(0,s.jsx)(es,{}),(0,s.jsx)("div",{className:"flex flex-col sm:flex-row flex-wrap justify-center gap-4 w-full sm:w-auto px-4 sm:px-0",children:i.map(({href:e,icon:t,label:a})=>(0,s.jsx)(C.f,{variant:"outline",asChild:!0,className:"gap-2 w-full sm:w-auto",children:(0,s.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:[(0,s.jsx)(t,{className:"h-4 w-4"}),a,(0,s.jsx)(K.f,{className:"h-3 w-3 ml-1 opacity-50"})]})},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground mt-8",children:e.settings?.about?.copyright||"© 2026 margrop · Based on wttwins/wrong-notebook · MIT License"})]})}var er=e.i(37038),ei=e.i(967489);let en={name:"",email:"",educationStage:"",enrollmentYear:"",password:""};function el(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(en),[i,n]=(0,f.useState)(""),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),m=(0,f.useCallback)(async()=>{try{let e=await V.f.get("/api/user");r({name:e.name||"",email:e.email||"",educationStage:e.educationStage||"",enrollmentYear:e.enrollmentYear||"",password:""})}catch(e){W.f.error("[AccountSettings]","Failed to fetch profile",{error:e})}finally{c(!1)}},[]);(0,f.useEffect)(()=>{m()},[m]);let u=async()=>{if(a.password&&a.password!==i)return void Y.c.error(e.settings?.messages?.passwordMismatch||"Passwords do not match");d(!0);try{let s={name:a.name,email:a.email,educationStage:a.educationStage};a.enrollmentYear&&(s.enrollmentYear=parseInt(a.enrollmentYear.toString())),a.password&&(s.password=a.password),await V.f.patch("/api/user",s),Y.c.success(e.settings?.messages?.profileUpdated||"Profile updated"),r(e=>({...e,password:""})),n(""),window.location.reload()}catch(s){W.f.error("[AccountSettings]","Failed to update profile",{error:(0,B.d)(s)??(0,B.Z)(s)}),Y.c.error((0,B.d)(s)||e.settings?.messages?.updateFailed||"Update failed")}finally{d(!1)}};return l?(0,s.jsx)("div",{className:"flex justify-center py-8",children:(0,s.jsx)(b.f,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.name||"Name"}),(0,s.jsx)(D.f,{value:a.name||"",onChange:e=>r({...a,name:e.target.value})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.email||"Email"}),(0,s.jsx)(D.f,{value:a.email||"",onChange:e=>r({...a,email:e.target.value}),type:"email"})]})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.educationStage||"Education Stage"}),(0,s.jsxs)(ei.d,{value:a.educationStage||"",onValueChange:e=>r({...a,educationStage:e}),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{placeholder:e.auth?.selectStage||"Select Stage"})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"primary",children:e.auth?.primary||"Primary School"}),(0,s.jsx)(ei.T,{value:"junior_high",children:e.auth?.juniorHigh||"Junior High"}),(0,s.jsx)(ei.T,{value:"senior_high",children:e.auth?.seniorHigh||"Senior High"}),(0,s.jsx)(ei.T,{value:"university",children:e.auth?.university||"University"})]})]})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.enrollmentYear||"Enrollment Year"}),(0,s.jsx)(D.f,{type:"number",value:a.enrollmentYear||"",onChange:e=>r({...a,enrollmentYear:e.target.value}),placeholder:"YYYY"})]})]}),(0,s.jsxs)("div",{className:"space-y-3 pt-2 border-t",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.settings?.account?.changePassword||"Change Password (Leave empty to keep)"}),(0,s.jsx)(er.f,{value:a.password,onChange:e=>r({...a,password:e.target.value}),placeholder:"******",minLength:6})]}),a.password&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:e.auth?.confirmPassword||"Confirm Password"}),(0,s.jsx)(er.f,{value:i,onChange:e=>n(e.target.value),placeholder:"******",minLength:6})]})]}),(0,s.jsxs)(C.f,{onClick:u,disabled:o,className:"w-full",children:[o&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.settings?.account?.update||"Update Profile"]})]})}var ec=e.i(10038),eo=e.i(16715);let ed={info:{card:"border-blue-200 bg-blue-50",title:"text-blue-900 font-bold",desc:"text-blue-800 font-medium",button:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300"},danger:{card:"border-red-200 bg-red-50",title:"text-red-700 font-medium",desc:"text-red-600",button:""},critical:{card:"border-red-600/50 bg-red-100/50",title:"text-red-900 font-bold",desc:"text-red-800 font-medium",button:"bg-red-700 hover:bg-red-800"}};function em({title:e,description:t,tone:a,busy:r,icon:i,onClick:n}){let l=ed[a];return(0,s.jsxs)("div",{className:`p-4 border rounded-lg ${l.card}`,children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:`text-sm flex items-center gap-2 ${l.title}`,children:e}),(0,s.jsx)(C.f,{variant:"info"===a?"outline":"destructive",size:"sm",onClick:n,disabled:r,className:l.button,children:r?(0,s.jsx)(b.f,{className:"h-4 w-4 animate-spin"}):i})]}),(0,s.jsx)("p",{className:`text-xs mt-2 ${l.desc}`,children:t})]})}function eu({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(null),n=async(e,s,t,a)=>{i(e);try{Y.c.success(await s()),a&&window.location.reload()}catch(s){W.f.error("[DangerZoneSettings]",`${e} failed`,{error:s}),Y.c.error(t)}finally{i(null)}},l=a.settings?.clearSuccess||"Success",c=a.settings?.clearError||"Failed",o=async()=>{await (0,Y.u)(a.settings?.migrateTagsConfirm||"This will reset system tags. Confirm?",{destructive:!0})&&await n("migrateTags",async()=>{let e=await V.f.post("/api/admin/migrate-tags",{});return`${l}: ${e.count||0} tags migrated.`},a.settings?.clearError||"Failed to migrate tags",!1)},d=async()=>{await (0,Y.u)(a.settings?.clearDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearPractice",async()=>(await V.f.delete("/api/stats/practice/clear"),l),c,!0)},m=async()=>{await (0,Y.u)(a.settings?.clearErrorDataConfirm||"Are you sure?",{destructive:!0})&&await n("clearErrors",async()=>(await V.f.delete("/api/error-items/clear"),l),c,!0)},u=async()=>{if(!await (0,Y.u)(a.settings?.systemResetConfirm||"WARNING: Deleting ALL data. Undoing is impossible. Are you sure?",{destructive:!0}))return;let e=prompt(a.settings?.systemResetPrompt||"Type 'RESET' to confirm system initialization:","");if("RESET"!==e){null!==e&&Y.c.error(a.common?.error||"Confirmation failed");return}await n("systemReset",async()=>(await V.f.post("/api/admin/system-reset",{}),a.settings?.clearSuccess||"Success - System Reset Complete"),a.settings?.clearError||"Failed to reset system",!0)};return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)(em,{tone:"info",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eo.f,{className:"h-4 w-4"}),a.settings?.migrateTags||"Migrate Tags"]}),description:a.settings?.migrateTagsDesc||"Re-populates standard tags from file",busy:"migrateTags"===r,icon:(0,s.jsx)(eo.f,{className:"h-4 w-4"}),onClick:o}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearData||"Clear Practice Data",description:a.settings?.clearDataDesc||"This will permanently delete all practice history. Irreversible.",busy:"clearPractice"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:d}),(0,s.jsx)(em,{tone:"danger",title:a.settings?.clearErrorData||"Clear Error Data",description:a.settings?.clearErrorDataDesc||"This will permanently delete all error items. Irreversible.",busy:"clearErrors"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:m}),e&&(0,s.jsx)(em,{tone:"critical",title:(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(g,{className:"h-4 w-4"}),a.settings?.systemReset||"System Initialization"]}),description:a.settings?.systemResetDesc||"Resets the system to factory state. Deletes ALL data.",busy:"systemReset"===r,icon:(0,s.jsx)(O.f,{className:"h-4 w-4"}),onClick:u})]})}var ex=e.i(595468),eh=e.i(440160);let ep=(0,x.f)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);async function ef(e,s){let t=await fetch(e);if(!t.ok)throw Error((await t.json().catch(()=>({}))).message||"Export failed");let a=await t.blob(),r=window.URL.createObjectURL(a),i=document.createElement("a");i.href=r;let n=t.headers.get("Content-Disposition")?.match(/filename="(.+)"/);i.download=n?n[1]:s,document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(r)}function eg({isAdmin:e}){let{t:a}=(0,t.b)(),[r,i]=(0,f.useState)(!1),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(null),d=async e=>{if(!e||await (0,Y.u)(a.settings?.exportAllConfirm||"Export all users' data? This may take a while.")){i(!0);try{await ef(e?"/api/export?all=true":"/api/export",e?"wrong-notebook-export-all.json":"wrong-notebook-export.json"),Y.c.success(a.settings?.exportSuccess||"Export successful")}catch(s){W.f.error("[DataBackupSettings]",e?"Export all failed":"Export failed",{error:s}),Y.c.error(a.settings?.exportFailed||"Export failed")}finally{i(!1)}}},m=async e=>{if(!c)return;let s=e?a.settings?.importAllConfirm||"Import all users' data? This will restore data for all users from the export file.":a.settings?.importConfirm||"Are you sure you want to import?";if(await (0,Y.u)(s)){l(!0);try{let s=JSON.parse(await c.text()),{stats:t}=await V.f.post(e?"/api/import?all=true":"/api/import",s);Y.c.success((a.settings?.importResultDesc||"Imported {subjects} notebooks, {tags} tags, {items} error items, {schedules} review schedules, {records} practice records, {papers} exam papers and {voices} cloud voice clips.").replace("{subjects}",String(t.subjectsCreated)).replace("{tags}",String(t.tagsCreated)).replace("{items}",String(t.errorItemsCreated)).replace("{schedules}",String(t.reviewSchedulesCreated)).replace("{records}",String(t.practiceRecordsCreated)).replace("{papers}",String(t.examPapersCreated??0)).replace("{voices}",String(t.ttsSpeechesImported??0)).replace("{duplicates}",String(t.duplicateErrorItems??0))),o(null),window.location.reload()}catch(s){W.f.error("[DataBackupSettings]",e?"Import all failed":"Import failed",{error:s}),Y.c.error(a.settings?.importFailed||"Import failed")}finally{l(!1)}}},u=(e,t)=>e?(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}):t;return(0,s.jsxs)("div",{className:"p-4 border border-blue-200 rounded-lg bg-blue-50",children:[(0,s.jsx)("h4",{className:"text-sm font-bold text-blue-900 mb-3",children:a.settings?.dataManagement||"Data Management"}),(0,s.jsxs)("div",{className:"mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.exportData||"Export Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!1),disabled:r,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportData||"Export"]}),e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:r,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(r,(0,s.jsx)(eh.f,{className:"mr-2 h-4 w-4"})),a.settings?.exportAllData||"Export All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.exportDataDesc||"Export all data as JSON file."})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("span",{className:"text-sm text-blue-800 font-medium",children:a.settings?.importData||"Import Data"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("input",{type:"file",accept:".json",onChange:e=>o(e.target.files?.[0]??c),className:"hidden",id:"import-file-input",disabled:n}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>document.getElementById("import-file-input")?.click(),disabled:n,className:"bg-blue-100 hover:bg-blue-200 text-blue-900 border-blue-300",children:[u(n,(0,s.jsx)(ep,{className:"mr-2 h-4 w-4"})),c?.name||a.settings?.selectFile||"Select File"]}),c&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!1),disabled:n,className:"bg-green-100 hover:bg-green-200 text-green-900 border-green-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importData||"Import"]}),c&&e&&(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>m(!0),disabled:n,className:"bg-orange-100 hover:bg-orange-200 text-orange-900 border-orange-300",children:[u(n,(0,s.jsx)(ex.f,{className:"mr-2 h-4 w-4"})),a.settings?.importAllData||"Import All"]})]})]}),(0,s.jsx)("p",{className:"text-xs text-blue-700",children:a.settings?.importDataDesc||"Import data from JSON file. Existing data will be skipped."})]})]})}var ej=e.i(307364);function ev({field:e,label:a,description:r}){let{t:i}=(0,t.b)(),[n,l]=(0,f.useState)(!1),[c,o]=(0,f.useState)(!1),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)(null),h=`preference-${e}`;(0,f.useEffect)(()=>{V.f.get("/api/user").then(s=>l(!!s[e])).catch(()=>void 0).finally(()=>o(!0))},[e]);let p=async s=>{l(s),m(!0);try{await V.f.patch("/api/user",{[e]:s}),x(i.importFlow.preferenceSaved)}catch(t){l(!s),x(i.importFlow.preferenceSaveFailed),W.f.error("[Settings]","Failed to save user preference",{field:e,error:t instanceof Error?t.message:String(t)})}finally{m(!1)}};return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-4",children:[(0,s.jsx)(R.f,{htmlFor:h,children:a}),(0,s.jsx)(M.f,{id:h,checked:n,onCheckedChange:p,disabled:!c||d})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:r}),u&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u})]})}function ey(){let{t:e}=(0,t.b)();return(0,s.jsx)(ev,{field:"enableGeogebra",label:e.importFlow.enableGeogebra,description:e.importFlow.enableGeogebraDesc})}function eb(){let{t:e}=(0,t.b)();return(0,s.jsx)(ev,{field:"confirmBeforeImport",label:e.importFlow.confirmBeforeImport,description:e.importFlow.confirmBeforeImportDesc})}var ew=e.i(905110);function eN(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)(String(ew.z)),[i,n]=(0,f.useState)(null),[l,c]=(0,f.useState)(!0),[o,d]=(0,f.useState)(!1),[m,u]=(0,f.useState)(null),x=Number(a),h=""!==a.trim()&&Number.isInteger(x)&&x>=ew.P&&x<=ew.o,p=(0,f.useCallback)(async()=>{c(!0),u(null);try{let e=(await V.f.get("/api/user")).masteryThreshold??ew.z;r(String(e)),n(e)}catch(s){u(e.mastery.thresholdLoadFailed),W.f.error("[Settings]","加载已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{c(!1)}},[e.mastery.thresholdLoadFailed]);(0,f.useEffect)(()=>{p()},[p]);let g=async()=>{if(h&&null!==i){d(!0),u(null);try{let s=(await V.f.patch("/api/user",{masteryThreshold:x})).masteryThreshold??x;n(s),r(String(s)),u(e.importFlow.preferenceSaved)}catch(s){u(e.importFlow.preferenceSaveFailed),W.f.error("[Settings]","保存已掌握阈值失败",{error:s instanceof Error?s.message:String(s)})}finally{d(!1)}}};return(0,s.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,s.jsx)(R.f,{htmlFor:"mastery-threshold",children:e.mastery.thresholdLabel}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(D.f,{id:"mastery-threshold",type:"number",min:ew.P,max:ew.o,step:1,value:a,onChange:e=>{r(e.target.value),u(null)},disabled:l||o||null===i,className:"w-28","aria-describedby":"mastery-threshold-hint"}),(0,s.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,s.jsxs)(C.f,{type:"button",size:"sm",variant:"outline",onClick:g,disabled:l||o||null===i||!h||x===i,children:[(l||o)&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),e.importFlow.saveThreshold]}),!l&&null===i&&(0,s.jsx)(C.f,{type:"button",size:"sm",variant:"outline",onClick:p,children:e.importFlow.retryLoad})]}),(0,s.jsx)("p",{id:"mastery-threshold-hint",className:"text-xs text-muted-foreground",children:e.mastery.thresholdDescription}),null!==i&&!h&&(0,s.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:e.mastery.thresholdInvalid}),m&&(0,s.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:m})]})}function ek(){let{t:e}=(0,t.b)();return(0,s.jsx)(ev,{field:"enableSvgAnimation",label:e.importFlow.enableSvgAnimation,description:e.importFlow.enableSvgAnimationDesc})}function eS({value:e,onChange:a,disabled:r}){let{t:i}=(0,t.b)();return(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(R.f,{htmlFor:"app-time-zone",children:i.settings.general.timeZoneLabel}),(0,s.jsx)(D.f,{id:"app-time-zone",value:e,onChange:e=>a(e.target.value),disabled:r,list:"app-time-zones",placeholder:"Asia/Shanghai"}),(0,s.jsx)("datalist",{id:"app-time-zones",children:["Asia/Shanghai","Asia/Hong_Kong","Asia/Tokyo","Asia/Singapore","Europe/London","America/New_York","America/Los_Angeles","UTC"].map(e=>(0,s.jsx)("option",{value:e},e))}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:i.settings.general.timeZoneDesc})]})}function eC({config:e,setConfig:a,isAdmin:i,disabled:n}){let{t:l,language:c,setLanguage:o}=(0,t.b)(),{timeZone:d}=(0,r.M)(),m=e=>a(s=>({...s,timeouts:{...s.timeouts,analyze:1e3*e}}));return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:l.settings?.language||"Language"}),(0,s.jsxs)(ei.d,{value:c,onValueChange:e=>o(e),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsxs)(ei.r,{children:[(0,s.jsx)(ei.T,{value:"zh",children:"中文 (Chinese)"}),(0,s.jsx)(ei.T,{value:"en",children:"English"})]})]})]}),(0,s.jsx)(eS,{value:e.timeZone??d,onChange:e=>a(s=>({...s,timeZone:e})),disabled:!i||n}),i&&(0,s.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,s.jsx)(R.f,{children:l.settings?.general?.timeoutLabel||"AI Analysis Timeout (Seconds)"}),(0,s.jsx)(D.f,{type:"number",value:e.timeouts?.analyze?e.timeouts.analyze/1e3:"",onChange:e=>{let s=""===e.target.value?0:parseInt(e.target.value);m(isNaN(s)?0:s)},onBlur:()=>{let s=(e.timeouts?.analyze||0)/1e3,t=Math.min(600,Math.max(120,s));t!==s&&m(t)},min:120,max:600}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:l.settings?.general?.timeoutDesc||"Increase this value if you experience frequent timeouts during AI analysis."})]}),(0,s.jsx)(eb,{}),(0,s.jsx)(ek,{}),(0,s.jsx)(ey,{}),(0,s.jsx)(ej.f,{}),(0,s.jsx)(eN,{})]})}var eT=e.i(624687),eA=e.i(247167);let e_={trace:10,debug:20,info:30,warn:40,error:50,fatal:60};function eE(e,s={}){let t,a=e_[e],r=(t=eA.default.env.LOG_LEVEL?.toLowerCase())&&void 0!==e_[t]?e_[t]:e_.info;return(t,i)=>{let n,l;if(a<r)return;let c=new Date;"string"==typeof t?(n={},l=t):(n=t,l=i||"");{let t=JSON.stringify({level:e,time:c.toISOString(),...s,...n,msg:l});switch(e){case"error":case"fatal":console.error(t);break;case"warn":console.warn(t);break;default:console.log(t)}}}}(function e(s={}){return s.module,{trace:eE("trace",s),debug:eE("debug",s),info:eE("info",s),warn:eE("warn",s),error:eE("error",s),fatal:eE("fatal",s),child:t=>e({...s,...t}),box:(e,t,a="📋")=>{console.log(JSON.stringify({level:"info",time:new Date().toISOString(),...s,title:e,..."string"==typeof t?{content:t}:t||{},msg:e}))},divider:(e="-")=>{}}})({env:"production"}).child({module:"ai:prompts"});let eM=`请参考《高思学校竞赛数学导引》(每讲分兴趣篇、拓展篇、超越篇,题目左侧标 1~5 颗星)的星级标准,结合题目所在年级评定难度:
|
|
2
2
|
- 1 星:课本基础题,直接套用概念、公式或简单计算即可(相当于兴趣篇前几题)。
|
|
3
3
|
- 2 星:校内拔高题,需要两三步推理或简单综合(相当于兴趣篇后几题)。
|
|
4
4
|
- 3 星:常规奥数题,小升初、杯赛常见难度,需要掌握该专题的典型方法(相当于拓展篇)。
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
- 白色背景、黑色线条(stroke="#000",线宽 1.5~2),需要区分的区域可用浅灰填充;不要使用彩色装饰。
|
|
9
9
|
- 按原图比例和相对位置绘制,保留所有标注:顶点字母、数字、长度、角度、单位、箭头和虚线等,文字用 <text>(font-size 14~18)。
|
|
10
10
|
- 只使用基本图形元素:line、polyline、polygon、rect、circle、ellipse、path、text、g、defs、marker。
|
|
11
|
-
- 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,
|
|
11
|
+
- 严禁使用 <image>、<script>、<foreignObject>、外部链接、外部字体或事件属性。`,eR=String.raw`- 行内公式用 $...$,独立公式用 $$...$$;不要用 \(...\) 或 \[...\],每个 $ 必须成对出现。
|
|
12
12
|
- 所有 LaTeX 命令(如 \frac、\sqrt、\times、\angle)都必须写在 $...$ 内,公式外不能出现反斜杠命令。
|
|
13
13
|
- 只使用 KaTeX 支持的命令和环境:方程组用 \begin{cases}...\end{cases},多行推导用 \begin{aligned}...\end{aligned}(放在 $$...$$ 中),不要用 align、eqnarray、\newcommand、\usepackage、\label、\tag 等。
|
|
14
14
|
- 大括号 {} 必须成对,\left 与 \right 必须成对,\begin{...} 与 \end{...} 必须对应。
|
|
@@ -55,7 +55,7 @@ ${eD}
|
|
|
55
55
|
|
|
56
56
|
<difficulty_stars>
|
|
57
57
|
只填写 1 到 5 之间的一个整数,表示题目难度星级。
|
|
58
|
-
${
|
|
58
|
+
${eM}
|
|
59
59
|
</difficulty_stars>
|
|
60
60
|
|
|
61
61
|
<mistake_analysis>
|
|
@@ -130,10 +130,10 @@ ${eE}
|
|
|
130
130
|
3. **内容完整**:如果包含子问题,请在 question_text 中完整列出。
|
|
131
131
|
4. **禁止图片**:严禁包含任何图片链接或 markdown 图片语法。
|
|
132
132
|
5. **LaTeX 规范**:
|
|
133
|
-
${
|
|
133
|
+
${eR}
|
|
134
134
|
|
|
135
135
|
{{grade_instruction}}
|
|
136
|
-
{{provider_hints}}`,
|
|
136
|
+
{{provider_hints}}`,ez=`你是一位资深的K12教育题目生成专家,具备跨学科的题目创作能力。你的核心任务是**根据以下原题和知识点,举一反三生成高质量教学题目**,帮助学生巩固知识并拓展解题思路。
|
|
137
137
|
### 角色定义
|
|
138
138
|
1. **学科全能专家**
|
|
139
139
|
- 精通K12阶段所有学科(数学/语文/英语/物理/化学/生物/历史/地理/政治)
|
|
@@ -185,7 +185,7 @@ ${ez}
|
|
|
185
185
|
###关键格式与内容约束 (CRITICAL RULES) !!!
|
|
186
186
|
1. **纯文本**:内容作为纯文本处理,**不要转义反斜杠**。
|
|
187
187
|
2. **LaTeX 规范**:
|
|
188
|
-
${
|
|
188
|
+
${eR}
|
|
189
189
|
|
|
190
190
|
{{grade_instruction}}
|
|
191
|
-
{{provider_hints}}`;var eR=e.i(367240);function eI({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function e$(){let{t:e}=(0,t.b)();return(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,s.jsx)(g,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:e.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:e.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function eU({config:e,onUpdate:a}){let{t:r}=(0,t.b)(),i=e.prompts?.analyze||eF,n=e.prompts?.similar||eL,l=async e=>{await (0,Y.u)(r.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&a(e,"analyze"===e?eF:eL)},c=(e,s)=>{a(e,s)};return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(A.i,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(A.U,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(A.k,{value:"analyze",children:r.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(A.k,{value:"similar",children:r.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(A.S,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("analyze"),children:[(0,s.jsx)(eR.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eI,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eI,{name:"knowledge_points_list",description:r.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eI,{name:"provider_hints",description:r.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(eT.f,{value:i,onChange:e=>c("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eF})]})}),(0,s.jsx)(A.S,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(z.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("similar"),children:[(0,s.jsx)(eR.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eI,{name:"difficulty_level",description:r.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eI,{name:"difficulty_instruction",description:r.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eI,{name:"original_question",description:r.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eI,{name:"knowledge_points",description:r.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eI,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(eT.f,{value:n,onChange:e=>c("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eL})]})})]})})}var eP=e.i(835467);function eO({value:e,icon:t,label:a}){return(0,s.jsxs)(A.k,{value:e,className:"px-2 sm:px-3",children:[t,(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]})}function eq(){let{setTimeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),n=i?.user?.role==="admin",{t:o}=(0,t.b)(),d=(0,l.useRouter)(),[m,u]=(0,f.useState)(!1),x=(0,f.useRef)(null),[h,_]=(0,f.useState)(!1),[E,D]=(0,f.useState)(!1),[z,F]=(0,f.useState)({aiProvider:"minimax"}),L=(0,f.useCallback)(async()=>{D(!0);try{F(await V.f.get("/api/settings"))}catch(e){W.f.error("[SettingsDialog]","Failed to fetch settings",{error:e})}finally{D(!1)}},[]);(0,f.useEffect)(()=>{m&&L()},[m,L]);let R=async()=>{let s=(0,eP.f)(z,o);if(s)return void Y.c.error(s);_(!0);try{let s=await V.f.post("/api/settings",z);F(s),e(s.timeZone||M.J),Y.c.success(o.settings?.messages?.saved||"Settings saved"),x.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){W.f.error("[SettingsDialog]","Failed to save settings",{error:e}),Y.c.error(o.settings?.messages?.saveFailed||"Failed to save")}finally{_(!1)}},I=e=>(0,s.jsxs)(C.f,{onClick:R,disabled:h,className:"w-full",children:[h&&(0,s.jsx)(v.f,{className:"mr-2 h-4 w-4 animate-spin"}),e]});return(0,s.jsxs)(T.N,{open:m,onOpenChange:u,children:[(0,s.jsx)(T.a,{asChild:!0,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(N,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.settings?.title||"Settings"})]})}),(0,s.jsxs)(T.d,{ref:x,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:o.settings?.title||"Settings"}),(0,s.jsx)(T.C,{children:o.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(A.i,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(A.U,{className:`grid w-full grid-cols-4 ${n?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsx)(eO,{value:"general",icon:(0,s.jsx)(y.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.general||"General"}),(0,s.jsx)(eO,{value:"account",icon:(0,s.jsx)(k.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.account||"Account"}),n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eO,{value:"ai",icon:(0,s.jsx)(j,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.ai||"AI Provider"}),(0,s.jsx)(eO,{value:"prompts",icon:(0,s.jsx)(w,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.prompts||"Prompts"}),(0,s.jsx)(eO,{value:"admin",icon:(0,s.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.admin||"User Management"})]}),(0,s.jsx)(eO,{value:"danger",icon:(0,s.jsx)(g,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.danger||"Danger"}),(0,s.jsx)(eO,{value:"about",icon:(0,s.jsx)(b,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.about||"About"})]}),(0,s.jsxs)(A.S,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsx)(eC,{config:z,setConfig:F,isAdmin:n,disabled:E||h}),n&&I(o.settings?.save||"Save Settings")]}),(0,s.jsx)(A.S,{value:"account",className:"space-y-4 py-4",children:(0,s.jsx)(el,{})}),(0,s.jsx)(A.S,{value:"ai",className:"space-y-4 py-4",children:(0,s.jsx)(ec.f,{config:z,setConfig:F,loading:E,saving:h,onSave:R})}),(0,s.jsxs)(A.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eU,{config:z,onUpdate:(e,s)=>F(t=>({...t,prompts:{...t.prompts,[e]:s}}))}),I(o.settings?.prompts?.save||"Save Prompt Settings")]}),n&&(0,s.jsxs)(A.S,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/admin")},children:[(0,s.jsx)(c.f,{className:"h-4 w-4"}),o.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/setup")},children:[(0,s.jsx)(S.f,{className:"h-4 w-4"}),o.setup.rerun]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(J,{})})]}),(0,s.jsx)(A.S,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eg,{isAdmin:n}),(0,s.jsx)(eu,{isAdmin:n})]})}),(0,s.jsx)(A.S,{value:"about",className:"space-y-4 py-4",children:(0,s.jsx)(ea,{})})]})]})]})}let eH=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eV=[{key:"home",href:"/",icon:h,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:o.f,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"review",href:"/review",icon:d.f,match:e=>e.startsWith("/review")},{key:"stats",href:"/stats",icon:c.f,match:e=>e.startsWith("/stats")||e.startsWith("/tags")},{key:"exams",href:"/exams",icon:m.f,match:e=>e.startsWith("/exams")}];function eY({children:e}){var r;let c,o,d=(0,l.usePathname)()||"/",{t:m}=(0,t.b)(),{data:x,status:h}=(0,a.useSession)(),g=x?.user?.role==="admin",j=eH.some(e=>e.test(d));if(r=g&&!j,c=(0,l.useRouter)(),o=(0,f.useRef)(!1),(0,f.useEffect)(()=>{r&&!o.current&&(o.current=!0,V.f.get("/api/setup").then(e=>{e.needsSetup&&c.replace("/setup")}).catch(e=>W.f.warn("[Setup]","Failed to check setup status",{error:e})))},[r,c]),j||"unauthenticated"===h)return(0,s.jsx)(s.Fragment,{children:e});let b=x?.user?.name||x?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,s.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:m.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eV.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),m.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[b&&(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:b.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:b})]}),g&&(0,s.jsx)(n.default,{href:"/admin",title:m.nav.admin,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(p,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:m.nav.admin})]})}),(0,s.jsx)(eq,{}),(0,s.jsx)(C.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:m.app.logout,children:(0,s.jsx)(u.f,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eV.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,F.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),m.nav[e.key]]},e.key)})})})]})}let eW=(0,x.f)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var eB=e.i(373884);let eJ=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function eX(){let{t:e}=(0,t.b)(),{timeZone:i}=(0,r.M)(),{status:c}=(0,a.useSession)(),o=(0,l.usePathname)(),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)([]),[h,p]=(0,f.useState)(()=>Date.now()),g="authenticated"!==c||eJ.some(e=>e.test(o||"")),j=(0,f.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await V.f.get("/api/tasks");x(e.tasks),p(Date.now())}catch{}},[]);if((0,f.useEffect)(()=>{if(g)return;let e=setTimeout(j,0),s=setInterval(j,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[g,d,j]),g)return null;let b=u.filter(e=>"running"===e.status).length,y=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await V.f.delete("/api/tasks");x(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(C.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[b>0?(0,s.jsx)(v.f,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(eW,{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)(T.N,{open:d,onOpenChange:m,children:(0,s.jsxs)(T.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:e.backgroundTasks.title}),(0,s.jsx)(T.C,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(v.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(ex.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(eB.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,M.r)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):h)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),y&&(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var eG=e.i(37727);let eK={success:{icon:ex.f,className:"text-success"},error:{icon:eB.f,className:"text-destructive"},warning:{icon:g,className:"text-warning"},info:{icon:b,className:"text-primary"}};function eZ(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)([]),[i,n]=(0,f.useState)(null);return(0,f.useEffect)(()=>(0,Y.M)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:a.map(t=>{let{icon:a,className:r}=eK[t.type];return(0,s.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,s.jsx)(a,{className:(0,F.f)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,Y.p)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(eG.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(T.N,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(T.d,{className:"sm:max-w-md",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsxs)(T.F,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(g,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(T.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(T.c,{className:"gap-2",children:[(0,s.jsx)(C.f,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(C.f,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}function eQ(){return(0,f.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(e=>{W.f.warn("[PWA]","Service worker registration failed",{error:String(e)})})},[]),null}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.w,{children:(0,s.jsxs)(r.n,{initialTimeZone:i,children:[(0,s.jsx)(eY,{children:e}),(0,s.jsx)(eX,{}),(0,s.jsx)(eZ,{}),(0,s.jsx)(eQ,{})]})})})}],1661)}]);
|
|
191
|
+
{{provider_hints}}`;var eI=e.i(367240);function eL({name:e,description:t}){return(0,s.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-2 text-xs py-1",children:[(0,s.jsx)("code",{className:"bg-muted px-1.5 py-0.5 rounded font-mono text-primary shrink-0 w-fit",children:`{{${e}}}`}),(0,s.jsx)("span",{className:"text-muted-foreground",children:t})]})}function e$(){let{t:e}=(0,t.b)();return(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-3 text-amber-900 text-sm mb-4",children:[(0,s.jsx)(g,{className:"h-5 w-5 shrink-0 text-amber-600"}),(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("p",{className:"font-medium",children:e.settings?.prompts?.caution||"Modify with Caution"}),(0,s.jsx)("p",{className:"text-amber-800/90 text-xs",children:e.settings?.prompts?.warning||"Variables in {{brackets}} are used to inject dynamic content. Please preserve these variables, otherwise the AI providing may fail to get question context or return invalid formats."})]})]})}function eU({config:e,onUpdate:a}){let{t:r}=(0,t.b)(),i=e.prompts?.analyze||eF,n=e.prompts?.similar||ez,l=async e=>{await (0,Y.u)(r.settings?.prompts?.resetConfirm||"Are you sure you want to reset to default?",{destructive:!0})&&a(e,"analyze"===e?eF:ez)},c=(e,s)=>{a(e,s)};return(0,s.jsx)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:(0,s.jsxs)(A.i,{defaultValue:"analyze",className:"w-full",children:[(0,s.jsxs)(A.U,{className:"grid w-full grid-cols-2",children:[(0,s.jsx)(A.k,{value:"analyze",children:r.settings?.prompts?.analysisTab||"Analysis Prompt"}),(0,s.jsx)(A.k,{value:"similar",children:r.settings?.prompts?.similarTab||"Similar Question Prompt"})]}),(0,s.jsx)(A.S,{value:"analyze",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(R.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customAnalysis||"Custom Analysis Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("analyze"),children:[(0,s.jsx)(eI.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(v,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eL,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstruction||"Injects instructions based on target language (e.g., keep English questions in English but analysis in Chinese)."}),(0,s.jsx)(eL,{name:"knowledge_points_list",description:r.settings?.prompts?.vars?.knowledgePointsList||"Injects the standard list of knowledge point tags for the specific subject."}),(0,s.jsx)(eL,{name:"provider_hints",description:r.settings?.prompts?.vars?.providerHints||"System-injected hints (e.g., enforcing JSON format)."})]})]}),(0,s.jsx)(eT.f,{value:i,onChange:e=>c("analyze",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:eF})]})}),(0,s.jsx)(A.S,{value:"similar",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex justify-between items-center",children:[(0,s.jsx)(R.f,{className:"text-base font-semibold",children:r.settings?.prompts?.customSimilar||"Custom Similar Question Template"}),(0,s.jsxs)(C.f,{variant:"outline",size:"sm",onClick:()=>l("similar"),children:[(0,s.jsx)(eI.f,{className:"w-4 h-4 mr-2"}),r.settings?.prompts?.reset||"Reset Default"]})]}),(0,s.jsx)(e$,{}),(0,s.jsxs)("div",{className:"space-y-2 border rounded-md p-3 bg-background",children:[(0,s.jsxs)("h4",{className:"text-xs font-medium flex items-center gap-1.5 mb-2",children:[(0,s.jsx)(v,{className:"h-3.5 w-3.5"}),r.settings?.prompts?.variables||"Available Variables"]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)(eL,{name:"difficulty_level",description:r.settings?.prompts?.vars?.difficultyLevel||"Target difficulty level."}),(0,s.jsx)(eL,{name:"difficulty_instruction",description:r.settings?.prompts?.vars?.difficultyInstruction||"Specific writing instructions for the target difficulty."}),(0,s.jsx)(eL,{name:"original_question",description:r.settings?.prompts?.vars?.originalQuestion||"The full text of the original question."}),(0,s.jsx)(eL,{name:"knowledge_points",description:r.settings?.prompts?.vars?.knowledgePoints||"List of knowledge points to test."}),(0,s.jsx)(eL,{name:"language_instruction",description:r.settings?.prompts?.vars?.languageInstructionShort||"Language formatting instructions."})]})]}),(0,s.jsx)(eT.f,{value:n,onChange:e=>c("similar",e.target.value),className:"font-mono text-xs min-h-[400px]",placeholder:ez})]})})]})})}var eP=e.i(431343),eO=e.i(128093),eq=e.i(79058);let eH=["browser","minimax","qwen"],eV={minimax:{model:"speech-2.8-hd",voice:"male-qn-jingying"},qwen:{model:"qwen-audio-3.0-tts-plus",voice:"longanlufeng"}};function eY({config:e,setConfig:a,saving:r,onSave:i}){let{t:n,language:l}=(0,t.b)(),c=n.settings.tts,[o,d]=(0,f.useState)(!1),m=e.tts?.mode??"browser",u="minimax"===m||"qwen"===m?m:null,x=u?e.tts?.[u]:void 0,h=(e,s)=>{u&&a(t=>({...t,tts:{...t.tts,[u]:{...t.tts?.[u],[e]:s}}}))},p=async()=>{(0,eq.p)(),d(!0);try{await i();let{id:e}=await V.f.post("/api/tts",{text:c.previewText,language:l},{timeout:12e4,recoverable:!0}),s=(0,eq.l)();if(!s)return;s.src=`/api/tts/${e}`,s.playbackRate=1,await s.play()}catch(s){W.f.error("[TtsSettings]","Preview failed",{error:s});let e=(0,B.d)(s);Y.c.error("TTS_NOT_CONFIGURED"===e?c.notConfigured:"TTS_PROVIDER_ERROR"===e?c.providerError:c.previewFailed)}finally{d(!1)}};return(0,s.jsxs)("div",{className:"space-y-4 border rounded-lg p-4 bg-muted/30",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.title}),(0,s.jsxs)(ei.d,{value:m,onValueChange:e=>a(s=>({...s,tts:{...s.tts,mode:e}})),children:[(0,s.jsx)(ei.P,{children:(0,s.jsx)(ei.U,{})}),(0,s.jsx)(ei.r,{children:eH.map(e=>(0,s.jsx)(ei.T,{value:e,children:c.modes[e]},e))})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:u?c.cloudHint:c.browserHint})]}),u&&(0,s.jsxs)("div",{className:"space-y-3 animate-in fade-in slide-in-from-top-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)(R.f,{children:[eO.$[u].name," API Key"]}),(0,s.jsx)(er.f,{value:e[u]?.apiKey||"",onChange:e=>{var s;return s=e.target.value,void(u&&a(e=>({...e,[u]:{...e[u],apiKey:s}})))},placeholder:"qwen"===u?"sk-sp-...":"sk-..."}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:c.apiKeyHint[u]})]}),(0,s.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.model}),(0,s.jsx)(D.f,{value:x?.model||"",onChange:e=>h("model",e.target.value),placeholder:eV[u].model})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.voice}),(0,s.jsx)(D.f,{value:x?.voice||"",onChange:e=>h("voice",e.target.value),placeholder:eV[u].voice})]})]}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:c.voiceHint[u]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(R.f,{children:c.endpoint}),(0,s.jsx)(D.f,{value:x?.endpoint||"",onChange:e=>h("endpoint",e.target.value),placeholder:function(e,s){let{baseUrl:t}=(0,eO.k)(e,s);if("minimax"===e)return`${t.replace(/\/+$/,"")}/t2a_v2`;try{return`${new URL(t).origin}/api/v1/services/audio/tts/SpeechSynthesizer`}catch{return""}}(u,e[u])}),(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:c.endpointHint})]})]},u),(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row",children:[u&&(0,s.jsxs)(C.f,{variant:"outline",onClick:p,disabled:r||o,className:"sm:w-auto",children:[o?(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,s.jsx)(eP.f,{className:"mr-2 h-4 w-4"}),c.preview]}),(0,s.jsxs)(C.f,{onClick:()=>void i(),disabled:r||o,className:"flex-1",children:[r&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),c.save]})]})]})}var eW=e.i(835467);function eB({value:e,icon:t,label:a}){return(0,s.jsxs)(A.k,{value:e,className:"px-2 sm:px-3",children:[t,(0,s.jsx)("span",{className:"hidden sm:inline",children:a})]})}function eJ(){let{setTimeZone:e}=(0,r.M)(),{data:i}=(0,a.useSession)(),n=i?.user?.role==="admin",{t:o}=(0,t.b)(),d=(0,l.useRouter)(),[m,u]=(0,f.useState)(!1),x=(0,f.useRef)(null),[h,E]=(0,f.useState)(!1),[M,D]=(0,f.useState)(!1),[R,F]=(0,f.useState)({aiProvider:"minimax"}),z=(0,f.useCallback)(async()=>{D(!0);try{F(await V.f.get("/api/settings"))}catch(e){W.f.error("[SettingsDialog]","Failed to fetch settings",{error:e})}finally{D(!1)}},[]);(0,f.useEffect)(()=>{m&&z()},[m,z]);let I=async()=>{let s=(0,eW.f)(R,o);if(s)return void Y.c.error(s);E(!0);try{let s=await V.f.post("/api/settings",R);F(s),e(s.timeZone||_.J),Y.c.success(o.settings?.messages?.saved||"Settings saved"),x.current?.scrollTo({top:0,behavior:"smooth"})}catch(e){W.f.error("[SettingsDialog]","Failed to save settings",{error:e}),Y.c.error(o.settings?.messages?.saveFailed||"Failed to save")}finally{E(!1)}},L=e=>(0,s.jsxs)(C.f,{onClick:I,disabled:h,className:"w-full",children:[h&&(0,s.jsx)(b.f,{className:"mr-2 h-4 w-4 animate-spin"}),e]});return(0,s.jsxs)(T.N,{open:m,onOpenChange:u,children:[(0,s.jsx)(T.a,{asChild:!0,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(N,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:o.settings?.title||"Settings"})]})}),(0,s.jsxs)(T.d,{ref:x,className:"w-[calc(100vw-2rem)] sm:max-w-[900px] max-h-[85vh] overflow-y-auto",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:o.settings?.title||"Settings"}),(0,s.jsx)(T.C,{children:o.settings?.desc||"Manage your preferences and data."})]}),(0,s.jsxs)(A.i,{defaultValue:"general",className:"w-full",children:[(0,s.jsxs)(A.U,{className:`grid w-full grid-cols-4 ${n?"sm:grid-cols-7":"sm:grid-cols-4"} gap-1 h-auto`,children:[(0,s.jsx)(eB,{value:"general",icon:(0,s.jsx)(y.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.general||"General"}),(0,s.jsx)(eB,{value:"account",icon:(0,s.jsx)(k.f,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.account||"Account"}),n&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(eB,{value:"ai",icon:(0,s.jsx)(j,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.ai||"AI Provider"}),(0,s.jsx)(eB,{value:"prompts",icon:(0,s.jsx)(w,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.prompts||"Prompts"}),(0,s.jsx)(eB,{value:"admin",icon:(0,s.jsx)(p,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.admin||"User Management"})]}),(0,s.jsx)(eB,{value:"danger",icon:(0,s.jsx)(g,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.danger||"Danger"}),(0,s.jsx)(eB,{value:"about",icon:(0,s.jsx)(v,{className:"h-4 w-4 sm:mr-2"}),label:o.settings?.tabs?.about||"About"})]}),(0,s.jsxs)(A.S,{value:"general",className:"space-y-4 py-4",children:[(0,s.jsx)(eC,{config:R,setConfig:F,isAdmin:n,disabled:M||h}),n&&L(o.settings?.save||"Save Settings")]}),(0,s.jsx)(A.S,{value:"account",className:"space-y-4 py-4",children:(0,s.jsx)(el,{})}),(0,s.jsxs)(A.S,{value:"ai",className:"space-y-4 py-4",children:[(0,s.jsx)(ec.f,{config:R,setConfig:F,loading:M,saving:h,onSave:I}),!M&&(0,s.jsx)(eY,{config:R,setConfig:F,saving:h,onSave:I})]}),(0,s.jsxs)(A.S,{value:"prompts",className:"space-y-4 py-4",children:[(0,s.jsx)(eU,{config:R,onUpdate:(e,s)=>F(t=>({...t,prompts:{...t.prompts,[e]:s}}))}),L(o.settings?.prompts?.save||"Save Prompt Settings")]}),n&&(0,s.jsxs)(A.S,{value:"admin",className:"space-y-4 py-4",children:[(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/admin")},children:[(0,s.jsx)(c.f,{className:"h-4 w-4"}),o.admin?.dashboard?.title||"Admin Dashboard"]}),(0,s.jsxs)(C.f,{variant:"outline",className:"w-full justify-start gap-2",onClick:()=>{u(!1),d.push("/setup")},children:[(0,s.jsx)(S.f,{className:"h-4 w-4"}),o.setup.rerun]}),(0,s.jsx)("div",{className:"border-t pt-4",children:(0,s.jsx)(J,{})})]}),(0,s.jsx)(A.S,{value:"danger",className:"space-y-4 py-4",children:(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)(eg,{isAdmin:n}),(0,s.jsx)(eu,{isAdmin:n})]})}),(0,s.jsx)(A.S,{value:"about",className:"space-y-4 py-4",children:(0,s.jsx)(ea,{})})]})]})]})}let eK=[/^\/login/,/^\/register/,/^\/setup/,/^\/print-preview/,/^\/exams\/[^/]+\/print/],eX=[{key:"home",href:"/",icon:h,match:e=>"/"===e},{key:"notebooks",href:"/notebooks",icon:o.f,match:e=>e.startsWith("/notebooks")||e.startsWith("/error-items")||e.startsWith("/practice")},{key:"review",href:"/review",icon:d.f,match:e=>e.startsWith("/review")},{key:"stats",href:"/stats",icon:c.f,match:e=>e.startsWith("/stats")||e.startsWith("/tags")},{key:"exams",href:"/exams",icon:m.f,match:e=>e.startsWith("/exams")}];function eG({children:e}){var r;let c,o,d=(0,l.usePathname)()||"/",{t:m}=(0,t.b)(),{data:x,status:h}=(0,a.useSession)(),g=x?.user?.role==="admin",j=eK.some(e=>e.test(d));if(r=g&&!j,c=(0,l.useRouter)(),o=(0,f.useRef)(!1),(0,f.useEffect)(()=>{r&&!o.current&&(o.current=!0,V.f.get("/api/setup").then(e=>{e.needsSetup&&c.replace("/setup")}).catch(e=>W.f.warn("[Setup]","Failed to check setup status",{error:e})))},[r,c]),j||"unauthenticated"===h)return(0,s.jsx)(s.Fragment,{children:e});let v=x?.user?.name||x?.user?.email||"";return(0,s.jsxs)("div",{className:"min-h-screen",children:[(0,s.jsx)("header",{className:"sticky top-0 z-40 border-b bg-card/80 backdrop-blur-md supports-[backdrop-filter]:bg-card/70 print:hidden",children:(0,s.jsxs)("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 md:h-16 md:px-8",children:[(0,s.jsxs)(n.default,{href:"/",className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)(i.default,{src:"/icons/icon.png",alt:"",width:32,height:32,className:"rounded-lg",priority:!0,unoptimized:!0}),(0,s.jsx)("span",{className:"text-base font-semibold tracking-tight",children:m.pageTitle.base})]}),(0,s.jsx)("nav",{className:"ml-4 hidden items-center gap-1 md:flex",children:eX.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors",t?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)(a,{className:"h-4 w-4"}),m.nav[e.key]]},e.key)})}),(0,s.jsxs)("div",{className:"ml-auto flex items-center gap-1",children:[v&&(0,s.jsxs)("span",{className:"mr-2 hidden max-w-40 items-center gap-2 truncate text-sm text-muted-foreground lg:flex",children:[(0,s.jsx)("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:v.slice(0,1).toUpperCase()}),(0,s.jsx)("span",{className:"truncate",children:v})]}),g&&(0,s.jsx)(n.default,{href:"/admin",title:m.nav.admin,children:(0,s.jsxs)(C.f,{variant:"ghost",size:"icon",className:"rounded-full",children:[(0,s.jsx)(p,{className:"h-5 w-5"}),(0,s.jsx)("span",{className:"sr-only",children:m.nav.admin})]})}),(0,s.jsx)(eJ,{}),(0,s.jsx)(C.f,{variant:"ghost",size:"icon",className:"rounded-full text-muted-foreground hover:text-destructive",onClick:()=>(0,a.signOut)({callbackUrl:"/login"}),title:m.app.logout,children:(0,s.jsx)(u.f,{className:"h-5 w-5"})})]})]})}),(0,s.jsx)("div",{className:"pb-20 md:pb-0",children:e}),(0,s.jsx)("nav",{className:"pb-safe fixed inset-x-0 bottom-0 z-40 border-t bg-card/90 backdrop-blur-md md:hidden print:hidden",children:(0,s.jsx)("div",{className:"grid h-16 grid-cols-5",children:eX.map(e=>{let t=e.match(d),a=e.icon;return(0,s.jsxs)(n.default,{href:e.href,className:(0,F.f)("flex flex-col items-center justify-center gap-1 text-[11px] font-medium transition-colors",t?"text-primary":"text-muted-foreground"),"aria-current":t?"page":void 0,children:[(0,s.jsx)("span",{className:(0,F.f)("flex h-7 w-12 items-center justify-center rounded-full transition-colors",t&&"bg-accent"),children:(0,s.jsx)(a,{className:"h-5 w-5"})}),m.nav[e.key]]},e.key)})})})]})}let eZ=(0,x.f)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var eQ=e.i(373884);let e0=[/^\/login/,/^\/register/,/^\/print-preview/,/^\/exams\/[^/]+\/print/];function e1(){let{t:e}=(0,t.b)(),{timeZone:i}=(0,r.M)(),{status:c}=(0,a.useSession)(),o=(0,l.usePathname)(),[d,m]=(0,f.useState)(!1),[u,x]=(0,f.useState)([]),[h,p]=(0,f.useState)(()=>Date.now()),g="authenticated"!==c||e0.some(e=>e.test(o||"")),j=(0,f.useCallback)(async()=>{if("u"<typeof document||"hidden"!==document.visibilityState)try{let e=await V.f.get("/api/tasks");x(e.tasks),p(Date.now())}catch{}},[]);if((0,f.useEffect)(()=>{if(g)return;let e=setTimeout(j,0),s=setInterval(j,d?2e3:15e3);return()=>{clearTimeout(e),clearInterval(s)}},[g,d,j]),g)return null;let v=u.filter(e=>"running"===e.status).length,y=u.some(e=>"running"!==e.status),w=async()=>{try{let e=await V.f.delete("/api/tasks");x(e.tasks)}catch{}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(C.f,{variant:"outline",size:"icon",className:"fixed bottom-20 right-4 z-40 h-11 w-11 rounded-full shadow-lg md:bottom-6 md:right-6 print:hidden",onClick:()=>m(!0),"aria-label":e.backgroundTasks.title,title:e.backgroundTasks.title,children:[v>0?(0,s.jsx)(b.f,{className:"h-5 w-5 animate-spin"}):(0,s.jsx)(eZ,{className:"h-5 w-5"}),v>0&&(0,s.jsx)("span",{className:"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs text-primary-foreground",children:v})]}),(0,s.jsx)(T.N,{open:d,onOpenChange:m,children:(0,s.jsxs)(T.d,{className:"max-h-[85vh] overflow-y-auto sm:max-w-lg",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsx)(T.F,{children:e.backgroundTasks.title}),(0,s.jsx)(T.C,{children:e.backgroundTasks.description})]}),0===u.length?(0,s.jsx)("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e.backgroundTasks.empty}):(0,s.jsx)("ul",{className:"space-y-2",children:u.map(t=>{var a,r;let l;return(0,s.jsx)("li",{className:"rounded-md border p-3 text-sm",children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:["running"===t.status&&(0,s.jsx)(b.f,{className:"mt-0.5 h-4 w-4 shrink-0 animate-spin text-primary"}),"succeeded"===t.status&&(0,s.jsx)(ex.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-green-600"}),"failed"===t.status&&(0,s.jsx)(eQ.f,{className:"mt-0.5 h-4 w-4 shrink-0 text-destructive"}),(0,s.jsxs)("div",{className:"min-w-0 flex-1 space-y-1",children:[(0,s.jsxs)("div",{className:"font-medium",children:[e.backgroundTasks.kinds[t.kind],(0,s.jsxs)("span",{className:"font-normal text-muted-foreground",children:[" · ",e.backgroundTasks.status[t.status]]})]}),t.subject&&(0,s.jsx)("div",{className:"break-words text-muted-foreground",children:t.subject}),t.progress&&t.progress.total>0&&(0,s.jsxs)("div",{className:"space-y-1",children:[(0,s.jsx)("div",{className:"h-1.5 overflow-hidden rounded bg-muted",children:(0,s.jsx)("div",{className:"h-full bg-primary transition-all",style:{width:`${Math.round(t.progress.done/t.progress.total*100)}%`}})}),(0,s.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.backgroundTasks.progress.replace("{done}",String(t.progress.done)).replace("{total}",String(t.progress.total)),t.progress.failed>0&&` \xb7 ${e.backgroundTasks.failedCount.replace("{count}",String(t.progress.failed))}`]})]}),t.error&&(0,s.jsx)("div",{className:"text-xs text-destructive",children:(s=>{if(!s)return null;let t=e.backgroundTasks.errors[s]??e.errors[s];return"string"==typeof t?t:s})(t.error)}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 text-xs text-muted-foreground",children:[(0,s.jsx)("span",{children:e.backgroundTasks.startedAt.replace("{time}",(0,_.r)(t.startedAt,"HH:mm:ss",i))}),(0,s.jsx)("span",{children:e.backgroundTasks.elapsed.replace("{time}",(a=t.startedAt,r=t.finishedAt,l=Math.max(0,Math.round(((r?Date.parse(r):h)-Date.parse(a))/1e3)),`${Math.floor(l/60)}:${String(l%60).padStart(2,"0")}`))}),t.link&&(0,s.jsx)(n.default,{href:t.link,className:"text-primary hover:underline",onClick:()=>m(!1),children:e.backgroundTasks.view})]})]})]})},t.id)})}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 pt-1",children:[(0,s.jsx)("p",{className:"text-xs text-muted-foreground",children:e.backgroundTasks.retentionHint}),y&&(0,s.jsx)(C.f,{variant:"ghost",size:"sm",onClick:w,children:e.backgroundTasks.clearFinished})]})]})})]})}var e2=e.i(37727);let e4={success:{icon:ex.f,className:"text-success"},error:{icon:eQ.f,className:"text-destructive"},warning:{icon:g,className:"text-warning"},info:{icon:v,className:"text-primary"}};function e3(){let{t:e}=(0,t.b)(),[a,r]=(0,f.useState)([]),[i,n]=(0,f.useState)(null);return(0,f.useEffect)(()=>(0,Y.M)(e=>{r(e.toasts),n(e.confirm)}),[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"pointer-events-none fixed inset-x-0 top-3 z-[100] flex flex-col items-center gap-2 px-4 print:hidden",role:"status","aria-live":"polite",children:a.map(t=>{let{icon:a,className:r}=e4[t.type];return(0,s.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-sm items-start gap-3 rounded-xl border bg-card/95 px-4 py-3 text-sm shadow-lg backdrop-blur animate-in fade-in slide-in-from-top-2 duration-200",children:[(0,s.jsx)(a,{className:(0,F.f)("mt-0.5 h-4 w-4 shrink-0",r)}),(0,s.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-line break-words leading-relaxed",children:t.message}),(0,s.jsx)("button",{type:"button",className:"shrink-0 rounded p-0.5 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>(0,Y.p)(t.id),"aria-label":e.common.close,children:(0,s.jsx)(e2.X,{className:"h-3.5 w-3.5"})})]},t.id)})}),(0,s.jsx)(T.N,{open:!!i,onOpenChange:e=>{e||i?.resolve(!1)},children:(0,s.jsxs)(T.d,{className:"sm:max-w-md",children:[(0,s.jsxs)(T.s,{children:[(0,s.jsxs)(T.F,{className:"flex items-center gap-2",children:[i?.destructive&&(0,s.jsx)(g,{className:"h-5 w-5 text-destructive"}),i?.title||e.common.confirmTitle]}),(0,s.jsx)(T.C,{className:"whitespace-pre-line pt-1 text-left leading-relaxed",children:i?.message})]}),(0,s.jsxs)(T.c,{className:"gap-2",children:[(0,s.jsx)(C.f,{variant:"outline",onClick:()=>i?.resolve(!1),children:i?.cancelText||e.common.cancel}),(0,s.jsx)(C.f,{variant:i?.destructive?"destructive":"default",onClick:()=>i?.resolve(!0),autoFocus:!0,children:i?.confirmText||e.common.confirm})]})]})})]})}function e5(){return(0,f.useEffect)(()=>{"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js",{scope:"/"}).catch(e=>{W.f.warn("[PWA]","Service worker registration failed",{error:String(e)})})},[]),null}e.s(["Providers",0,function({children:e,timeZone:i}){return(0,s.jsx)(a.SessionProvider,{children:(0,s.jsx)(t.w,{children:(0,s.jsxs)(r.n,{initialTimeZone:i,children:[(0,s.jsx)(eG,{children:e}),(0,s.jsx)(e1,{}),(0,s.jsx)(e3,{}),(0,s.jsx)(e5,{})]})})})}],1661)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,204573,e=>{"use strict";var t=e.i(843476),a=e.i(271645),s=e.i(522016),r=e.i(618566),n=e.i(871689),i=e.i(475254);let l=(0,i.f)("file-question-mark",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);var c=e.i(16715),o=e.i(727612),u=e.i(469937),d=e.i(72664),m=e.i(531278),g=e.i(3198),f=e.i(519455),h=e.i(111110),x=e.i(41931),p=e.i(303163),v=e.i(201276);function j({errorItemId:e,commands:s,onUpdate:r}){let{t:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),[c,o]=(0,a.useState)(null),u=async()=>{l(!0),o(null);try{let t=await x.f.post(`/api/error-items/${e}/geogebra`,{},{recoverable:!0});t.suitable&&t.commands.length>0?r({geogebraCommands:JSON.stringify(t.commands)}):o(t.description||n.geogebra.notSuitable)}catch(t){v.f.error("[ErrorDetail]","GeoGebra analysis failed",{error:t});let e=(0,p.d)(t)||(0,p.Z)(t);e.includes("AI_AUTH_ERROR")?o(n.geogebra.authFailed):e.includes("AI_CONNECTION")?o(n.geogebra.connectionFailed):o(n.geogebra.analyzeFailed)}finally{l(!1)}},y=async t=>{await x.f.put(`/api/error-items/${e}`,{geogebraCommands:t}),r({geogebraCommands:t})},b=async()=>{await x.f.delete(`/api/error-items/${e}/geogebra`),r({geogebraCommands:null})};return s?(0,t.jsx)(g.f,{commands:s,height:700,showToolBar:!0,showAlgebraInput:!1,showMenuBar:!1,onRegenerate:u,onSaveCommands:y,onDelete:b}):(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(d.f,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:n.geogebra.title})]}),(0,t.jsx)(f.f,{variant:"outline",size:"sm",onClick:u,disabled:i,children:i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4 animate-spin"}),n.geogebra.analyzing]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(d.f,{className:"mr-2 h-4 w-4"}),n.geogebra.generate]})})]}),c&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:c}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:n.geogebra.hint})]})}function y({src:e,onClose:a}){let{t:s}=(0,h.b)();return e?(0,t.jsx)("div",{className:"fixed inset-0 z-50 bg-black/90 flex items-center justify-center p-4",onClick:a,children:(0,t.jsxs)("div",{className:"relative max-w-7xl max-h-full",children:[(0,t.jsx)("button",{className:"absolute -top-12 right-0 text-white hover:text-gray-300 text-lg font-semibold bg-black/50 px-4 py-2 rounded",onClick:a,children:s.detail?.close||"✕ Close"}),(0,t.jsx)("img",{src:e,alt:"Full size",className:"max-w-full max-h-[90vh] object-contain rounded-lg",onClick:e=>e.stopPropagation()}),(0,t.jsx)("p",{className:"text-center text-white/70 text-sm mt-4",children:s.detail?.clickOutside||"Click outside to close"})]})}):null}var b=e.i(141176),w=e.i(511445),N=e.i(515288);let k=(0,i.f)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);var A=e.i(356909),S=e.i(37727);function C({onClick:e,label:a}){let{t:s}=(0,h.b)();return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:e,children:[(0,t.jsx)(k,{className:"h-4 w-4 mr-1"}),a||s.common?.edit||"Edit"]})}function I({onSave:e,onCancel:a,children:s}){let{t:r}=(0,h.b)();return(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsxs)(f.f,{size:"sm",onClick:e,children:[(0,t.jsx)(A.f,{className:"h-4 w-4 mr-1"}),r.common?.save||"Save"]}),(0,t.jsxs)(f.f,{size:"sm",variant:"outline",onClick:a,children:[(0,t.jsx)(S.X,{className:"h-4 w-4 mr-1"}),r.common?.cancel||"Cancel"]}),s]})}function L({title:e,actions:a}){return(0,t.jsxs)("div",{className:"flex justify-between items-center",children:[e,a]})}var E=e.i(294114);function T({read:e,save:t,logLabel:s,successMessage:r,failureMessage:n}){let{t:i}=(0,h.b)(),[l,c]=(0,a.useState)(!1),[o,u]=(0,a.useState)(e),d=async()=>{try{await t(o),c(!1),E.c.success(r||i.common?.messages?.saveSuccess||"Saved successfully")}catch(e){v.f.error("[ErrorDetail]",`Failed to save ${s}`,{error:e}),E.c.error(n||i.common?.messages?.saveFailed||"Save failed")}};return{editing:l,value:o,setValue:u,start:()=>{u(e()),c(!0)},cancel:()=>c(!1),submit:d}}function F({title:e,value:a,onSave:s,logLabel:r,rows:n,placeholder:i,editorLabel:l,emptyText:c,cardClassName:o,titleClassName:u,contentClassName:d,headerActions:m,children:g}){let f=T({read:()=>a||"",save:s,logLabel:r}),h=(0,t.jsx)(b.f,{value:f.value,onChange:f.setValue,placeholder:i,rows:n,className:"w-full font-mono text-sm"});return(0,t.jsxs)(N.N,{className:o,children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{className:u,children:e}),actions:!f.editing&&(0,t.jsxs)("div",{className:"flex flex-wrap justify-end",children:[m,(0,t.jsx)(C,{onClick:f.start})]})})}),(0,t.jsxs)(N.O,{className:"space-y-4",children:[f.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[l?(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:l}),h]}):h,(0,t.jsx)(I,{onSave:f.submit,onCancel:f.cancel})]}):!a&&c?(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:c}):(0,t.jsx)(w.f,{content:a,className:d}),g]})]})}var M=e.i(624687);function R({item:e,onUpdate:a}){let{t:s}=(0,h.b)(),r=T({read:()=>e.userNotes||"",save:async t=>{await x.f.patch(`/api/error-items/${e.id}/notes`,{userNotes:t}),a({userNotes:t})},logLabel:"notes",successMessage:s.common?.messages?.noteSaveSuccess||"Notes saved successfully"});return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{children:s.detail.yourNotes}),actions:!r.editing&&(0,t.jsx)(C,{onClick:r.start,label:s.detail.editNotes})})}),(0,t.jsx)(N.O,{children:r.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(M.f,{value:r.value,onChange:e=>r.setValue(e.target.value),placeholder:s.detail.notesPlaceholder||"Enter your notes...",rows:5,className:"w-full"}),(0,t.jsx)(I,{onSave:r.submit,onCancel:r.cancel})]}):(0,t.jsx)("div",{className:"whitespace-pre-wrap",children:e.userNotes?(0,t.jsx)("p",{className:"text-foreground",children:e.userNotes}):(0,t.jsx)("p",{className:"text-muted-foreground italic",children:s.detail.noNotes})})})]})}var z=e.i(149704);let $=(0,i.f)("shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);function O({errorItemId:e,onDone:s}){let{t:r}=(0,h.b)(),[n,i]=(0,a.useState)(!1),l=async()=>{i(!0);try{let t=await x.f.post(`/api/error-items/${e}/figure`,{},{recoverable:!0});s(t),t.figureSvg||E.c.warning(r.figure.noFigure)}catch(a){let e=a?.data?.message||"",t=r.errors[e];v.f.error("[RegenerateFigure]","Failed to regenerate figure",{code:e}),E.c.error("NO_ORIGINAL_IMAGE"===e?r.figure.noImage:"string"==typeof t?t:r.figure.failed)}finally{i(!1)}};return(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:l,disabled:n,className:"flex items-center gap-2",children:[n?(0,t.jsx)(m.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)($,{className:"h-4 w-4"}),n?r.figure.regenerating:r.figure.regenerate]})}let U=(0,i.f)("image-plus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);var D=e.i(12130),q=e.i(28928);function V({errorItemId:e,hasImage:s,onDone:r}){let{t:n}=(0,h.b)(),i=(0,a.useRef)(null),[l,c]=(0,a.useState)(!1),[o,u]=(0,a.useState)(null);(0,a.useEffect)(()=>()=>{o&&URL.revokeObjectURL(o)},[o]);let d=async()=>{(!s||await (0,E.u)(n.replaceImage.confirm))&&i.current?.click()},g=async t=>{u(null),c(!0);try{let a=new File([t],"question-image.jpg",{type:t.type||"image/jpeg"}),s=await (0,q.f)(a),i=await x.f.put(`/api/error-items/${e}/image`,{imageDataUrl:s});r(i.originalImageUrl),E.c.success(n.replaceImage.done)}catch(t){let e=t?.data?.message||"";v.f.error("[ReplaceImage]","Failed to replace original image",{code:e}),E.c.error("INVALID_IMAGE"===e?n.replaceImage.invalid:n.replaceImage.failed)}finally{c(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{ref:i,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif",className:"hidden",onChange:e=>{(e=>{if(e){if(!e.type.startsWith("image/"))return E.c.error(n.replaceImage.invalid);u(URL.createObjectURL(e))}})(e.target.files?.[0]),e.target.value=""}}),o&&(0,t.jsx)(D.f,{imageSrc:o,open:!0,onClose:()=>u(null),onCropComplete:g}),(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:d,disabled:l,className:"flex items-center gap-2",children:[l?(0,t.jsx)(m.f,{className:"h-4 w-4 animate-spin"}):(0,t.jsx)(U,{className:"h-4 w-4"}),l?n.replaceImage.uploading:s?n.replaceImage.replace:n.replaceImage.add]})]})}var _=e.i(438465),P=e.i(793479),H=e.i(967489),G=e.i(943710);function B({item:e,onChanged:a}){let{t:s}=(0,h.b)(),r=s.common?.notSet||"Not set",n=T({read:()=>({subjectId:e.subjectId||null,gradeSemester:e.gradeSemester||"",paperLevel:e.paperLevel||(0,G.f)(e.difficultyStars)||"a"}),save:async t=>{await x.f.put(`/api/error-items/${e.id}`,{...t,subjectId:t.subjectId||null}),await a()},logLabel:"metadata",successMessage:s.common?.messages?.metaUpdateSuccess||"Metadata updated successfully!",failureMessage:s.common?.messages?.updateFailed||"Update failed"}),i=e=>n.setValue({...n.value,...e});return(0,t.jsxs)("div",{className:"space-y-2 pt-4 border-t",children:[(0,t.jsx)(L,{title:(0,t.jsx)("h4",{className:"text-sm font-semibold",children:s.detail?.questionInfo||"Question Info"}),actions:!n.editing&&(0,t.jsx)(C,{onClick:n.start})}),n.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:s.notebooks?.title||"Notebook"}),(0,t.jsx)(_.f,{value:n.value.subjectId||void 0,onChange:e=>i({subjectId:e})})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:s.filter.grade}),(0,t.jsx)(P.f,{value:n.value.gradeSemester,onChange:e=>i({gradeSemester:e.target.value}),placeholder:s.notebook?.gradeSemesterPlaceholder||"e.g. Grade 7, Semester 1"})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:s.filter.paperLevel}),(0,t.jsxs)(H.d,{value:n.value.paperLevel,onValueChange:e=>i({paperLevel:e}),children:[(0,t.jsx)(H.P,{children:(0,t.jsx)(H.U,{})}),(0,t.jsxs)(H.r,{children:[(0,t.jsx)(H.T,{value:"a",children:s.editor.paperLevels?.a||"Paper A"}),(0,t.jsx)(H.T,{value:"b",children:s.editor.paperLevels?.b||"Paper B"}),(0,t.jsx)(H.T,{value:"other",children:s.editor.paperLevels?.other||"Other"})]})]})]}),(0,t.jsx)(I,{onSave:n.submit,onCancel:n.cancel})]}):(0,t.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[s.notebooks?.title||"Notebook",":"]}),(0,t.jsx)("span",{className:"font-medium",children:e.subject?.name||r})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[s.filter.grade,":"]}),(0,t.jsx)("span",{className:"font-medium",children:e.gradeSemester||r})]}),(0,t.jsxs)("div",{className:"flex justify-between",children:[(0,t.jsxs)("span",{className:"text-muted-foreground",children:[s.filter.paperLevel,":"]}),(0,t.jsx)("span",{className:"font-medium",children:e.paperLevel?s.editor.paperLevels?.[e.paperLevel]||e.paperLevel:r})]})]})]})}var W=e.i(487486),Z=e.i(283086);function X({errorItemId:e,onDone:s,onSuggested:r}){let{t:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),c=async()=>{l(!0);try{if(r){let t=await x.f.post(`/api/error-items/${e}/retag`,{preview:!0},{recoverable:!0});r(t.tags)}else await x.f.post(`/api/error-items/${e}/retag`,{},{recoverable:!0}),s?.()}catch(a){let e=a?.data?.message||"",t=n.errors[e];v.f.error("[RetagItem]","Failed to regenerate tags",{code:e}),E.c.error("NO_TAGS_SELECTED"===e?n.retag.noTags:"string"==typeof t?t:n.retag.itemFailed)}finally{l(!1)}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:c,disabled:i,children:[i?(0,t.jsx)(m.f,{className:"h-4 w-4 mr-1 animate-spin"}):(0,t.jsx)(Z.f,{className:"h-4 w-4 mr-1"}),r?i?n.retag.suggestRunning:n.retag.suggestButton:i?n.retag.itemRunning:n.retag.itemButton]})}var K=e.i(574041),Q=e.i(952122),Y=e.i(990745);function J({item:e,educationStage:a,onChanged:s}){let{t:r}=(0,h.b)(),n=(0,Y.f)(e),i=T({read:()=>(0,Y.f)(e),save:async t=>{await x.f.put(`/api/error-items/${e.id}`,{knowledgePoints:t}),await s()},logLabel:"tags",successMessage:r.common?.messages?.tagUpdateSuccess||"Tags updated successfully!",failureMessage:r.common?.messages?.updateFailed||"Update failed"});return(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(L,{title:(0,t.jsx)("h4",{className:"text-sm font-semibold",children:r.editor?.tags||"Knowledge Tags"}),actions:!i.editing&&(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)(X,{errorItemId:e.id,onDone:s}),(0,t.jsx)(C,{onClick:i.start})]})}),i.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(K.f,{value:i.value,onChange:i.setValue,placeholder:r.editor?.tagsPlaceholder||"Enter or select knowledge tags...",subject:(0,Q.f)(e.subject?.name||null)||void 0,gradeStage:a}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:r.editor?.tagsHint||"Select from standard or custom tags"}),(0,t.jsx)(I,{onSave:i.submit,onCancel:i.cancel,children:(0,t.jsx)(X,{errorItemId:e.id,onSuggested:i.setValue})})]}):(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:n.map(e=>(0,t.jsx)(W.f,{variant:"secondary",children:e},e))})]})}var ee=e.i(77705);let et=(0,i.f)("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);function ea({src:e,alt:a,showLabel:s,hideLabel:r,visible:n,onVisibleChange:i,onEnlarge:l,variant:c="ghost",actions:o}){let{t:u}=(0,h.b)();return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[e&&(0,t.jsx)(f.f,{variant:c,size:"sm",onClick:()=>i(!n),className:`flex items-center gap-2 ${"ghost"===c?"text-muted-foreground":""}`,children:n?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ee.f,{className:"h-4 w-4"}),r]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(et,{className:"h-4 w-4"}),s]})}),o]}),e&&n&&(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("img",{src:e,alt:a,className:"w-full rounded-lg border cursor-pointer hover:opacity-90 transition-opacity",onClick:()=>l(e)}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 text-center",children:u.detail?.clickToEnlarge||"Click to enlarge"})]})]})}function es({item:e,educationStage:s,saveFields:r,onUpdate:n,reload:i,onEnlarge:l}){let{t:c}=(0,h.b)(),[o,u]=(0,a.useState)(!1),d=T({read:()=>e.questionText,save:e=>r({questionText:e}),logLabel:"question"});return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{children:c.detail.question}),actions:!d.editing&&(0,t.jsx)(C,{onClick:d.start})})}),(0,t.jsxs)(N.O,{className:"space-y-4",children:[d.editing?(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(b.f,{value:d.value,onChange:d.setValue,placeholder:"Enter question text...",rows:8,className:"w-full font-mono text-sm"}),(0,t.jsx)(I,{onSave:d.submit,onCancel:d.cancel})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(w.f,{content:e.questionText}),(0,t.jsx)(z.f,{svg:e.figureSvg})]}),(0,t.jsx)(J,{item:e,educationStage:s,onChanged:i}),(0,t.jsx)(B,{item:e,onChanged:i}),(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)(ea,{src:e.originalImageUrl,alt:c.detail.originalProblem||"Original Problem",showLabel:c.replaceImage?.view||"View original image",hideLabel:c.replaceImage?.hide||"Hide original image",variant:"outline",visible:o,onVisibleChange:u,onEnlarge:l,actions:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{errorItemId:e.id,hasImage:!!e.originalImageUrl,onDone:e=>{n({originalImageUrl:e}),u(!0)}}),e.originalImageUrl&&(0,t.jsx)(O,{errorItemId:e.id,onDone:n})]})})})]})]})}var er=e.i(62825);function en({item:e,saveFields:s,onEnlarge:r}){let{t:n,language:i}=(0,h.b)(),[l,c]=(0,a.useState)(!1),o=T({read:()=>({text:e.wrongAnswerText||"",status:e.mistakeStatus||"unknown"}),save:({text:e,status:t})=>s({wrongAnswerText:e,mistakeStatus:(0,er.x)(t,e)}),logLabel:"wrong answer"});return(0,t.jsxs)(N.N,{children:[(0,t.jsx)(N.Y,{children:(0,t.jsx)(L,{title:(0,t.jsx)(N.v,{children:n.editor?.wrongAnswerText||"Wrong Answer / Work"}),actions:!o.editing&&(0,t.jsx)(C,{onClick:o.start})})}),(0,t.jsx)(N.O,{className:"space-y-4",children:o.editing?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:n.editor?.mistakeStatus||"Attempt Status"}),(0,t.jsxs)(H.d,{value:o.value.status,onValueChange:e=>o.setValue({...o.value,status:e}),children:[(0,t.jsx)(H.P,{children:(0,t.jsx)(H.U,{})}),(0,t.jsxs)(H.r,{children:[(0,t.jsx)(H.T,{value:"not_attempted",children:n.editor?.mistakeStatuses?.notAttempted||"Not attempted"}),(0,t.jsx)(H.T,{value:"wrong_attempt",children:n.editor?.mistakeStatuses?.wrongAttempt||"Wrong attempt"}),(0,t.jsx)(H.T,{value:"unknown",children:n.editor?.mistakeStatuses?.unknown||"Unknown"})]})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm text-muted-foreground",children:n.editor?.wrongAnswerText||"Wrong Answer / Work"}),(0,t.jsx)(b.f,{value:o.value.text,onChange:e=>o.setValue({text:e,status:e.trim()?"wrong_attempt":o.value.status}),rows:5,className:"w-full font-mono text-sm"})]}),(0,t.jsx)(I,{onSave:o.submit,onCancel:o.cancel})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(W.f,{variant:"secondary",children:(0,er.i)(e.mistakeStatus,i)}),e.wrongAnswerText?(0,t.jsx)(w.f,{content:e.wrongAnswerText}):(0,t.jsx)("p",{className:"text-sm text-muted-foreground italic",children:n.detail?.noMistakeAnalysis||"No mistake analysis yet."}),e.wrongAnswerImageUrl&&(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)(ea,{src:e.wrongAnswerImageUrl,alt:n.detail.wrongAnswerImageAlt,showLabel:n.detail.viewImage,hideLabel:n.detail.hideImage,visible:l,onVisibleChange:c,onEnlarge:r})})]})})]})}let ei=(0,i.f)("square-function",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);var el=e.i(716400),ec=e.i(369939);let eo=new Set(["ne","neq","nabla","nu","not","notin","ni","nexists","ngeq","nleq","nmid","nparallel","nsubseteq"]);function eu(e){return e.length>80?`${e.slice(0,80)}…`:e}let ed=["questionText","answerText","analysis","wrongAnswerText","mistakeAnalysis"];function em({errorItemId:e,fields:s,onDone:r}){let{t:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),c=(0,a.useMemo)(()=>Object.values(function(e){let t={};for(let a of ed){let s=function(e){if(!e?.trim())return[];let{masked:t,segments:a}=(0,ec.F)(e),s=[];for(let e of a)try{el.f.renderToString(e.tex,{displayMode:e.displayMode,throwOnError:!0,strict:"ignore"})}catch(a){let t=a instanceof Error?a.message.replace(/^KaTeX parse error:\s*/,""):String(a);s.push({snippet:eu(e.source),message:t})}let r=t.replace(/@@MATH\d+@@/g," "),n=r.replace(/\\\$/g,"").match(/\$/g);n&&s.push({snippet:"$",message:`有 ${n.length} 个未配对的 $ 定界符`});let i=r.match(/\\[()[\]]/g);i&&s.push({snippet:i.join(" "),message:"有未配对的 \\( \\) 或 \\[ \\] 定界符"});let l=[...new Set(r.match(/\\[a-zA-Z]{2,}/g)||[])].filter(e=>!e.startsWith("\\n")||eo.has(e.slice(1)));return l.length>0&&s.push({snippet:eu(l.join(" ")),message:"LaTeX 命令没有放在 $…$ 中,会原样显示"}),s}(e[a]);s.length>0&&(t[a]=s)}return t}(s)).reduce((e,t)=>e+(t?.length??0),0),[s]),o=async()=>{l(!0);try{let t=await x.f.post(`/api/error-items/${e}/fix-latex`,{},{timeout:3e5,recoverable:!0});r(t.updated);let a=t.fixedFields.map(e=>n.fixLatex.fields[e]).join("、");E.c.info(0===t.issuesBefore?n.fixLatex.noIssues:0===t.fixedFields.length?n.fixLatex.notFixed:0===t.issuesAfter?n.fixLatex.fixedAll.replace("{fields}",a):n.fixLatex.fixedPartly.replace("{fields}",a).replace("{count}",String(t.issuesAfter)))}catch(a){let e=a?.data?.message||"",t=n.errors[e];v.f.error("[FixLatex]","Failed to fix LaTeX",{code:e}),E.c.error("string"==typeof t?t:n.fixLatex.failed)}finally{l(!1)}};return 0!==c||i?(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:o,disabled:i,className:"border-amber-500 text-amber-700 dark:text-amber-400",title:n.fixLatex.issuesFound.replace("{count}",String(c)),children:[i?(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(ei,{className:"mr-2 h-4 w-4"}),i?n.fixLatex.running:n.fixLatex.button,!i&&c>0&&(0,t.jsxs)("span",{className:"ml-1",children:["(",c,")"]})]}):null}var eg=e.i(991686),ef=e.i(846968),eh=e.i(868983);function ex({errorItemId:e,onDone:s}){let{t:r,language:n}=(0,h.b)(),[i,l]=(0,a.useState)(!1),c=async()=>{if(await (0,E.u)(r.reanswerItem.confirm)){l(!0);try{let t=await x.f.post(`/api/error-items/${e}/reanswer`,{language:n},{timeout:6e5,recoverable:!0});s(t)}catch(a){let e=a?.data?.message||"",t=r.errors[e];v.f.error("[RegenerateAnswer]","Failed to regenerate answer",{code:e}),E.c.error("NO_QUESTION_TEXT"===e?r.reanswerItem.noQuestionText:"string"==typeof t?t:r.reanswerItem.failed)}finally{l(!1)}}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:c,disabled:i,children:[i?(0,t.jsx)(m.f,{className:"h-4 w-4 mr-1 animate-spin"}):(0,t.jsx)(eh.f,{className:"h-4 w-4 mr-1"}),i?r.reanswerItem.running:r.reanswerItem.button]})}var ep=e.i(643531);let ev=(0,i.f)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);function ej({shortId:e,className:s=""}){let{t:r}=(0,h.b)(),[n,i]=(0,a.useState)(!1);if(!e)return null;let l=async t=>{t.preventDefault(),t.stopPropagation();try{await navigator.clipboard.writeText(e),i(!0),setTimeout(()=>i(!1),1500)}catch{window.prompt(r.shortId.copy,e)}};return(0,t.jsxs)("button",{type:"button",onClick:l,title:n?r.shortId.copied:r.shortId.copy,className:`inline-flex items-center gap-1 rounded-md border bg-muted/50 px-2 py-0.5 font-mono text-xs text-muted-foreground hover:text-foreground transition-colors ${s}`,children:[(0,t.jsx)("span",{children:r.shortId.label}),(0,t.jsx)("span",{className:"font-semibold text-foreground",children:e}),n?(0,t.jsx)(ep.f,{className:"h-3 w-3 text-green-600"}):(0,t.jsx)(ev,{className:"h-3 w-3"})]})}let ey=(0,i.f)("audio-lines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]),eb=(0,i.f)("clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]),ew=(0,i.f)("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),eN=(0,i.f)("minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]),ek=(0,i.f)("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);var eA=e.i(431343),eS=e.i(367240);let eC=(0,i.f)("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),eI=(0,i.f)("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);var eL=e.i(975157);function eE({supported:e,enabled:a,rate:s,fullscreen:r,onToggle:n,onCycleRate:i}){let{t:l}=(0,h.b)(),c=(0,eL.f)("h-8 shrink-0",r&&"text-white hover:bg-white/20 hover:text-white"),o=e?a?l.svgAnimation.voiceOff:l.svgAnimation.voiceOn:l.svgAnimation.voiceUnsupported;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{title:o,className:"shrink-0",children:(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)(c,"w-8 p-0",a&&e&&!r&&"text-primary"),onClick:n,disabled:!e,"aria-label":o,"aria-pressed":a&&e,children:a&&e?(0,t.jsx)(eC,{className:"h-4 w-4"}):(0,t.jsx)(eI,{className:"h-4 w-4"})})}),a&&e&&(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)(c,"px-1.5 text-xs tabular-nums"),onClick:i,"aria-label":l.svgAnimation.voiceRate,title:l.svgAnimation.voiceRate,children:[s,"×"]})]})}let eT=/<metadata\b[^>]*\bid\s*=\s*["']narration["'][^>]*>([\s\S]*?)<\/metadata\s*>/gi,eF={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function eM(e){let t=e;if("string"==typeof t){let e=t.indexOf("["),a=t.lastIndexOf("]");if(-1===e||a<e)return null;try{t=JSON.parse(t.slice(e,a+1))}catch{return null}}if(!Array.isArray(t))return null;let a=[];for(let e of t){if(!e||"object"!=typeof e)continue;let{begin:t,text:s}=e,r="number"==typeof t?t:"string"==typeof t?eO(t):null;if(null===r||!Number.isFinite(r)||r<0||"string"!=typeof s)continue;let n=s.replace(/\s+/g," ").trim();n&&a.push({begin:Math.round(100*r)/100,text:n})}a.sort((e,t)=>e.begin-t.begin);let s=[];for(let e of a){let t=s[s.length-1];t&&t.begin===e.begin?t.text=`${t.text} ${e.text}`:s.push({...e})}let r=s.slice(0,20).map(e=>({...e,text:e.text.slice(0,300)}));return r.length>0?r:null}function eR(e){for(let t of e.matchAll(eT)){let e=eM(t[1].replace(/&(#x[0-9a-f]+|#\d+|lt|gt|amp|quot|apos);/gi,(e,t)=>{if("#"!==t[0])return eF[t.toLowerCase()];let a="x"===t[1]||"X"===t[1]?parseInt(t.slice(2),16):Number(t.slice(1));return Number.isFinite(a)&&a<=1114111?String.fromCodePoint(a):e}));if(e)return e}return null}let ez=/<(?:animate|animateTransform|animateMotion|set)\b[^>]*>/gi;function e$(e,t){let a=e.match(RegExp(`\\s${t}\\s*=\\s*("([^"]*)"|'([^']*)')`,"i"));return a?(a[2]??a[3]??"").trim():null}function eO(e){if(!e)return null;let t=e.trim(),a=t.match(/^(?:(\d+):)?(\d+):(\d+(?:\.\d+)?)$/);if(a)return 3600*Number(a[1]??0)+60*Number(a[2])+Number(a[3]);let s=t.match(/^(\d+(?:\.\d+)?)(h|min|s|ms)?$/);if(!s)return null;let r={h:3600,min:60,s:1,ms:.001}[s[2]??"s"]??1;return Number(s[1])*r}let eU=new Set(["opacity","visibility","display","fill-opacity"]);function eD(e){let t=e.getAttribute("viewBox")?.split(/[\s,]+/).map(Number),a=t?.length===4&&t[3]>0?t[1]+t[3]:parseFloat(e.getAttribute("height")??"");if(!(a>0))return null;let s=t?.length===4?t[1]+.78*t[3]:.78*a,r=[];for(let t of Array.from(e.querySelectorAll("text"))){if(t.closest("defs, metadata"))continue;let a=parseFloat(t.getAttribute("y")??t.querySelector("tspan[y]")?.getAttribute("y")??"");if(!(a>=s))continue;let n=Array.from(t.querySelectorAll("tspan")),i=(n.length>0?n.map(e=>e.textContent??"").join(" "):t.textContent??"").replace(/\s+/g," ").trim(),l=function(e,t){for(let a=e;a&&a!==t;a=a.parentElement)for(let e of Array.from(a.children)){let t=e.localName;if("set"!==t&&"animate"!==t)continue;let a=e.getAttribute("attributeName")??"";if(eU.has(a)&&!function(e,t){if(null===t)return!1;let a=t.trim();return"visibility"===e?"hidden"===a:"display"===e?"none"===a:0===Number(a)}(a,e.getAttribute("to")??e.getAttribute("values")?.split(";").pop()??null))return eO((e.getAttribute("begin")??"0").split(";")[0])}return 0}(t,e);i&&null!==l&&r.push({begin:l,y:a,text:i})}return r.sort((e,t)=>e.begin-t.begin||e.y-t.y),eM(r.map(({begin:e,text:t})=>({begin:e,text:t})))}var eq=e.i(79058);let eV=[1,1.25,1.5,.75],e_="svg-narration-enabled",eP="svg-narration-rate";function eH(e){try{return localStorage.getItem(e)}catch{return null}}function eG(e,t){try{localStorage.setItem(e,t)}catch{}}let eB={zh:["zh","cmn"],en:["en"]};function eW(){return"speechSynthesis"in window&&"u">typeof SpeechSynthesisUtterance?window.speechSynthesis:null}let eZ=!1;function eX(){let e=eW();if(!e||eZ)return;eZ=!0;let t=new SpeechSynthesisUtterance(" ");t.volume=0,e.speak(t)}function eK(e,t){return Math.max(8e3,400*e.length/t+5e3)}function eQ(e,t){let a=-1;for(let s=0;s<e.length&&e[s].begin<=t+.05;s++)a=s;return a}function eY(e){let t=Math.max(0,Math.floor(e));return`${Math.floor(t/60)}:${String(t%60).padStart(2,"0")}`}function eJ({svg:e}){let{t:s,language:r}=(0,h.b)(),n=(0,a.useRef)(null),i=(0,a.useRef)(null),l=(0,a.useRef)(null),[c,o]=(0,a.useState)(!1),[u,d]=(0,a.useState)(0),[m,g]=(0,a.useState)(!1),[x,p]=(0,a.useState)(!1),v=m||x,j=(0,a.useMemo)(()=>(function(e){let t=0;for(let a of e.match(ez)||[]){let e=e$(a,"begin"),s=null===e?0:eO(e.split(";")[0]);if(null===s)continue;let r=e$(a,"repeatCount");if("indefinite"!==r&&"indefinite"!==e$(a,"repeatDur"))t=Math.max(t,s+(eO(e$(a,"dur"))??0)*(r&&Number.isFinite(Number(r))?Number(r):1))}return t})(e),[e]),y=(0,a.useMemo)(()=>(function(e){let t=e.match(/<svg\b[^>]*>/i)?.[0]??"",a=e$(t,"viewBox")?.split(/[\s,]+/).map(Number);if(a?.length===4&&a[2]>0&&a[3]>0)return a[2]/a[3];let s=parseFloat(e$(t,"width")??""),r=parseFloat(e$(t,"height")??"");return s>0&&r>0?s/r:1.6})(e),[e]),b=(0,a.useMemo)(()=>`<!doctype html><html><head><meta charset="utf-8"><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:"><style>html,body{margin:0;height:100%;background:#fff;overflow:hidden}svg{display:block;width:100%;height:100%}</style></head><body>${e}</body></html>`,[e]),w=(0,a.useMemo)(()=>eR(e),[e]),[N,k]=(0,a.useState)(null),A=w??N,S=(0,a.useCallback)(()=>{let e=i.current?.contentDocument;return"function"==typeof e?.getAnimations?e.getAnimations():[]},[]),C=function({segments:e,language:t,holdAnimation:s}){let[r,n]=(0,a.useState)(!1),[i,l]=(0,a.useState)("browser"),[c,o]=(0,a.useState)(!1),[u,d]=(0,a.useState)(1),[m,g]=(0,a.useState)(!1),[f,h]=(0,a.useState)(!1),x=(0,a.useRef)(void 0),p=(0,a.useRef)(-1),v=(0,a.useRef)(!1),j=(0,a.useRef)(null),y=(0,a.useRef)(0),b=(0,a.useRef)(null),w=(0,a.useRef)(null),N=(0,a.useRef)(!1),k=(0,a.useRef)("browser"),A=(0,a.useRef)(!1),S=(0,a.useRef)(1),C=(0,a.useRef)(s);(0,a.useEffect)(()=>{C.current=s},[s]),(0,a.useEffect)(()=>{A.current="1"===eH(e_),o(A.current);let e=Number(eH(eP));eV.includes(e)&&(S.current=e,d(e))},[]),(0,a.useEffect)(()=>{let e=!0;return(0,eq.v)().then(t=>{e&&(k.current=t,l(t))}),()=>{e=!1}},[]),(0,a.useEffect)(()=>{let e=eW();if(!e)return;let a=()=>{let a,s,r,i=e.getVoices();a=eB[t],s=i.filter(e=>a.some(t=>e.lang.toLowerCase().startsWith(t))),r="zh"===t?/^(zh|cmn)[-_](cn|hans)/i:/^en[-_]us/i,x.current=s.find(e=>r.test(e.lang)&&e.localService)??s.find(e=>r.test(e.lang))??s[0],n(0===i.length||!!x.current)};return a(),e.addEventListener?.("voiceschanged",a),()=>e.removeEventListener?.("voiceschanged",a)},[t]);let I=(0,a.useCallback)(()=>{N.current&&(N.current=!1,null===j.current&&(h(!1),C.current(!1)))},[]),L=(0,a.useCallback)(a=>{let s,r=e?.[a];if(!r)return;let n=y.current,i={},l=()=>n===y.current&&b.current===i,c=e=>{clearTimeout(s),s=setTimeout(o,e)};function o(){clearTimeout(s),l()&&(b.current=null,w.current=null,v.current=!1,g(!1),I(),null!==j.current&&(j.current=null,h(!1),C.current(!1)))}let u=!1,d=()=>{if(!l()||u)return;u=!0,I();let e=eW();if(!e)return void o();let a=new SpeechSynthesisUtterance(r.text);a.lang=x.current?.lang??("en"===t?"en-US":"zh-CN"),x.current&&(a.voice=x.current),a.rate=S.current,a.onend=o,a.onerror=o,a.onstart=()=>c(eK(r.text,a.rate)),c(2500),w.current=a,e.speak(a)};if(b.current=i,v.current=!0,g(!0),"cloud"!==k.current)return void d();let m=e?.[a+1];m&&(0,eq.U)(m.text,t).catch(()=>void 0);let f=setTimeout(()=>{l()&&null===j.current&&(N.current=!0,h(!0),C.current(!0))},300);(0,eq.U)(r.text,t).then(e=>{let t=(0,eq.l)();if(!l())return;if(!t){clearTimeout(f),d();return}let a=e=>()=>{l()&&!u&&e()};t.onplaying=a(()=>{clearTimeout(f),I(),c(eK(r.text,t.playbackRate))}),t.onended=a(o),t.onerror=a(d),t.src=e,t.playbackRate=S.current,c(8e3),t.play().catch(a(()=>{clearTimeout(f),d()}))},()=>{clearTimeout(f),d()})},[e,t,I]),E=(0,a.useCallback)(t=>{y.current++,b.current=null,w.current=null,v.current=!1,g(!1),(null!==j.current||N.current)&&(j.current=null,N.current=!1,h(!1),C.current(!1)),p.current=e?eQ(e,t)-1:-1,eW()?.cancel(),"cloud"===k.current&&(0,eq.l)()?.pause()},[e]),T=(0,a.useCallback)(t=>{if(!A.current||!e?.length||null!==j.current)return;if(v.current){let a=p.current+1;if(a>=e.length)return;let s=a>0?e[a].begin-e[a-1].begin:e[a].begin;if(t<e[a].begin-Math.min(.8,s/2))return;j.current=a,h(!0),C.current(!0);return}let a=eQ(e,t);a<=p.current||(p.current=a,L(a))},[e,L]),F=(0,a.useCallback)(()=>{A.current&&(eX(),"cloud"===k.current&&(0,eq.p)())},[]),M=(0,a.useCallback)((e,t)=>{E(t),A.current=e,o(e),eG(e_,e?"1":"0"),F()},[E,F]),R=(0,a.useCallback)(()=>{let e=eV[(eV.indexOf(S.current)+1)%eV.length];if(S.current=e,d(e),"cloud"===k.current){let t=(0,eq.l)();t&&(t.playbackRate=e)}eG(eP,String(e))},[]);return(0,a.useEffect)(()=>{let e="cloud"===i&&!(0,eq.h)();if(!c||(eZ||!eW())&&!e)return;let t=()=>{eX(),e&&(0,eq.p)()};return document.addEventListener("click",t,{capture:!0,once:!0}),document.addEventListener("touchend",t,{capture:!0,once:!0}),()=>{document.removeEventListener("click",t,{capture:!0}),document.removeEventListener("touchend",t,{capture:!0})}},[c,i]),(0,a.useEffect)(()=>{c&&"cloud"===i&&e?.length&&e.slice(0,2).forEach(e=>(0,eq.U)(e.text,t).catch(()=>void 0))},[c,i,e,t]),(0,a.useEffect)(()=>()=>{y.current++,eW()?.cancel(),"cloud"===k.current&&(0,eq.l)()?.pause()},[e]),{supported:r||"cloud"===i,enabled:c,rate:u,speaking:m,holding:f,setEnabled:M,cycleRate:R,update:T,stop:E,prime:F}}({segments:A,language:r,holdAnimation:(0,a.useCallback)(e=>{e?l.current?.pauseAnimations():l.current?.unpauseAnimations(),S().forEach(t=>e?t.pause():t.play())},[S])}),I=C.enabled&&(C.holding||!c&&C.speaking),{stop:L,update:E,prime:T}=C,F=(0,a.useCallback)(()=>{l.current?.pauseAnimations(),S().forEach(e=>e.pause()),o(!1)},[S]),M=(0,a.useCallback)(()=>{L(l.current?.getCurrentTime()??0),F()},[F,L]),R=(0,a.useCallback)(e=>{l.current?.setCurrentTime(e),S().forEach(t=>{t.currentTime=1e3*e}),d(e),L(e)},[S,L]),z=(0,a.useCallback)(()=>{let e=l.current;e&&(j>0&&e.getCurrentTime()>=j&&R(0),e.unpauseAnimations(),S().forEach(e=>e.play()),o(!0),T())},[S,j,R,T]),$=async()=>{if(x)return void p(!1);if(document.fullscreenElement)return void await document.exitFullscreen().catch(()=>void 0);let e=n.current;if(e&&"function"==typeof e.requestFullscreen)try{await e.requestFullscreen();return}catch{}p(!0)};return(0,a.useEffect)(()=>{let e=()=>g(document.fullscreenElement===n.current);return document.addEventListener("fullscreenchange",e),()=>document.removeEventListener("fullscreenchange",e)},[]),(0,a.useEffect)(()=>{if(!x)return;let e=e=>{"Escape"===e.key&&p(!1)},t=document.body.style.overflow;return document.body.style.overflow="hidden",document.addEventListener("keydown",e),()=>{document.body.style.overflow=t,document.removeEventListener("keydown",e)}},[x]),(0,a.useEffect)(()=>{if(!c)return;let e=0,t=()=>{let a=l.current?.getCurrentTime()??0;if(E(a),j>0&&a>=j){l.current?.setCurrentTime(j),F(),d(j);return}d(a),e=requestAnimationFrame(t)};return e=requestAnimationFrame(t),()=>cancelAnimationFrame(e)},[c,j,F,E]),(0,t.jsxs)("div",{ref:n,className:(0,eL.f)("space-y-2",v&&"flex flex-col items-center justify-center bg-black p-4",x&&"fixed inset-0 z-50"),children:[(0,t.jsx)("iframe",{ref:i,srcDoc:b,sandbox:"allow-same-origin",title:s.svgAnimation.alt,onLoad:()=>{l.current=i.current?.contentDocument?.querySelector("svg")??null,k(l.current?eD(l.current):null),L(0),d(0),o(!!l.current)},className:(0,eL.f)("mx-auto block rounded border bg-white transition-shadow",!v&&"w-full max-w-3xl",I&&"border-primary ring-2 ring-primary/40"),style:v?{aspectRatio:y,width:`min(100%, calc((100dvh - 96px) * ${y}))`}:{aspectRatio:y}}),(0,t.jsxs)("div",{className:(0,eL.f)("mx-auto flex w-full items-center gap-2",v?"max-w-5xl text-white":"max-w-3xl"),children:[(0,t.jsx)(f.f,{variant:"outline",size:"sm",className:"h-8 w-8 shrink-0 p-0 text-foreground",onClick:c?M:z,"aria-label":c?s.svgAnimation.pause:s.svgAnimation.play,title:c?s.svgAnimation.pause:s.svgAnimation.play,children:c?(0,t.jsx)(ek,{className:"h-4 w-4"}):(0,t.jsx)(eA.f,{className:"h-4 w-4"})}),(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)("h-8 w-8 shrink-0 p-0",v&&"text-white hover:bg-white/20 hover:text-white"),onClick:()=>{R(0),z()},"aria-label":s.svgAnimation.replay,title:s.svgAnimation.replay,children:(0,t.jsx)(eS.f,{className:"h-4 w-4"})}),j>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{type:"range",min:0,max:j,step:.1,value:Math.min(u,j),onChange:e=>R(Number(e.target.value)),"aria-label":s.svgAnimation.progress,className:"h-2 min-w-0 flex-1 cursor-pointer accent-primary"}),(0,t.jsxs)("span",{className:(0,eL.f)("shrink-0 text-xs tabular-nums",v?"text-white/80":"text-muted-foreground"),children:[eY(u)," / ",eY(j)]})]}),(0,t.jsxs)("div",{className:"ml-auto flex shrink-0 items-center gap-1",children:[!!A?.length&&(0,t.jsx)(eE,{supported:C.supported,enabled:C.enabled,rate:C.rate,fullscreen:v,onToggle:()=>C.setEnabled(!C.enabled,l.current?.getCurrentTime()??0),onCycleRate:C.cycleRate}),(0,t.jsx)(f.f,{variant:"ghost",size:"sm",className:(0,eL.f)("h-8 w-8 shrink-0 p-0",v&&"text-white hover:bg-white/20 hover:text-white"),onClick:$,"aria-label":v?s.svgAnimation.exitFullscreen:s.svgAnimation.fullscreen,title:v?s.svgAnimation.exitFullscreen:s.svgAnimation.fullscreen,children:v?(0,t.jsx)(eN,{className:"h-4 w-4"}):(0,t.jsx)(ew,{className:"h-4 w-4"})})]})]})]})}function e0({svg:e,disabled:s,onBusyChange:r}){let{t:n,language:i}=(0,h.b)(),[l,c]=(0,a.useState)(!1),[o,u]=(0,a.useState)(null),d=(0,a.useMemo)(()=>(function(e){let t=eR(e);if(t)return t;try{let t=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;return"svg"===t.nodeName?eD(t):null}catch{return null}})(e),[e]);if((0,a.useEffect)(()=>{let e=!0;return(0,eq.v)().then(t=>{e&&c("cloud"===t)}),()=>{e=!1}},[]),!l||!d?.length)return null;let g=async()=>{u(0),r(!0);try{await (0,eq.H)(d.map(e=>e.text),i,u),E.c.success(n.svgAnimation.voiceRegenerateDone)}catch(t){let e=(0,p.d)(t)||"";v.f.error("[SvgAnimation]","Failed to regenerate cloud voice",{code:e,error:(0,p.Z)(t)}),E.c.error("TTS_DISABLED"===e?n.svgAnimation.voiceRegenerateDisabled:n.svgAnimation.voiceRegenerateFailed)}finally{u(null),r(!1)}};return(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:g,disabled:s||null!==o,title:n.svgAnimation.voiceRegenerateHint,children:[null!==o?(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(eS.f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:null!==o?n.svgAnimation.voiceRegenerating.replace("{done}",String(o)).replace("{total}",String(d.length)):n.svgAnimation.voiceRegenerate})]})}function e1({errorItemId:e,svgAnimation:s,hasOtherLanguage:r,onChange:n}){let{t:i,language:l}=(0,h.b)(),[u,d]=(0,a.useState)(!1),[g,j]=(0,a.useState)(!1),[y,b]=(0,a.useState)(!1),[w,N]=(0,a.useState)(!1),[k,A]=(0,a.useState)(null),S=(0,a.useMemo)(()=>!!s&&!!eR(s),[s]),C=(e,t)=>{let a=i.errors[e];return"string"==typeof a?a:t},I=async()=>{d(!0),A(null);try{let t=await x.f.post(`/api/error-items/${e}/svg-animation`,{language:l},{timeout:6e5,recoverable:!0});n(l,t.svgAnimation)}catch(t){let e=(0,p.d)(t)||"";v.f.error("[SvgAnimation]","Failed to generate SVG animation",{code:e,error:(0,p.Z)(t)}),A("NO_QUESTION_TEXT"===e?i.svgAnimation.noQuestionText:"NO_VALID_ANIMATION"===e?i.svgAnimation.invalid:C(e,i.svgAnimation.failed))}finally{d(!1)}},L=async()=>{b(!0),A(null);try{let t=await x.f.post(`/api/error-items/${e}/svg-animation/narration`,{language:l},{timeout:3e5,recoverable:!0});n(l,t.svgAnimation),E.c.success(i.svgAnimation.narrationDone)}catch(t){let e=(0,p.d)(t)||"";v.f.error("[SvgAnimation]","Failed to generate SVG narration",{code:e,error:(0,p.Z)(t)}),A("NO_VALID_NARRATION"===e?i.svgAnimation.narrationInvalid:C(e,i.svgAnimation.narrationFailed))}finally{b(!1)}},T=async()=>{if(await (0,E.u)(i.svgAnimation.confirmDelete,{destructive:!0})){j(!0);try{await x.f.delete(`/api/error-items/${e}/svg-animation?language=${l}`),n(l,null),A(null)}catch(e){v.f.error("[SvgAnimation]","Failed to delete SVG animation",{error:e instanceof Error?e.message:String(e)}),E.c.error(i.svgAnimation.deleteFailed)}finally{j(!1)}}};if(!s)return(0,t.jsxs)("div",{className:"rounded-lg border border-dashed p-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,t.jsx)(eb,{className:"h-4 w-4"}),(0,t.jsx)("span",{children:i.svgAnimation.title})]}),(0,t.jsxs)(f.f,{variant:"outline",size:"sm",onClick:I,disabled:u,children:[u?(0,t.jsx)(m.f,{className:"mr-2 h-4 w-4 animate-spin"}):(0,t.jsx)(eb,{className:"mr-2 h-4 w-4"}),u?i.svgAnimation.generating:i.svgAnimation.generate]})]}),k&&(0,t.jsx)("p",{className:"text-xs text-destructive mt-2",children:k}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-2",children:r?i.svgAnimation.otherLanguageAvailable:i.svgAnimation.hint})]});let F=u||g||y||w;return(0,t.jsxs)("div",{className:"rounded-lg border bg-card",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2 border-b bg-muted/30",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:i.svgAnimation.title}),F&&(0,t.jsx)(m.f,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:L,disabled:F,title:i.svgAnimation.narrationHint,children:[y?(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(ey,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:y?i.svgAnimation.narrationGenerating:S?i.svgAnimation.narrationRegenerate:i.svgAnimation.narrationGenerate})]}),(0,t.jsx)(e0,{svg:s,disabled:F,onBusyChange:N}),(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1",onClick:I,disabled:F,children:[u?(0,t.jsx)(m.f,{className:"h-3.5 w-3.5 animate-spin"}):(0,t.jsx)(c.f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:u?i.svgAnimation.generating:i.svgAnimation.regenerate})]}),(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs gap-1 text-destructive hover:text-destructive",onClick:T,disabled:F,children:[(0,t.jsx)(o.f,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:i.svgAnimation.delete})]})]})]}),k&&(0,t.jsx)("p",{className:"px-3 pt-2 text-xs text-destructive",children:k}),(0,t.jsx)("div",{className:"p-2 sm:p-3",children:(0,t.jsx)(eJ,{svg:s})})]})}var e2=e.i(912505),e3=e.i(86963),e4=e.i(35209);e.s(["default",0,function(){let e=(0,r.useParams)(),i=(0,r.useRouter)(),{t:d,language:m}=(0,h.b)(),[g,p]=(0,a.useState)(null);(0,e4.f)(d.detail.title,g?.subject?.name,g?.shortId);let[b,w]=(0,a.useState)(!0),[N,k]=(0,a.useState)(null),[A,S]=(0,a.useState)(!1),[C,I]=(0,a.useState)(void 0),[L,T]=(0,a.useState)(!1),[M,z]=(0,a.useState)(!0),[$,O]=(0,a.useState)(null),[U,D]=(0,a.useState)(!1),q=(0,a.useCallback)(async e=>{try{let t=await x.f.get(`/api/error-items/${e}`);p(t)}catch(e){v.f.error("[ErrorDetail]","Failed to fetch error item",{error:e}),E.c.error(d.common?.messages?.loadFailed||"Failed to load item"),i.push("/notebooks")}finally{w(!1)}},[i,d]);(0,a.useEffect)(()=>{x.f.get("/api/user").then(e=>{e&&e.educationStage&&I(e.educationStage),T(!!e?.enableGeogebra),z(e?.enableSvgAnimation!==!1)}).catch(e=>v.f.error("[ErrorDetail]","Failed to fetch user info",{error:e})),e.id&&q(e.id)},[e.id,q]);let V=(0,a.useCallback)(e=>{p(t=>t&&{...t,...e})},[]),_=async e=>{g&&(await x.f.put(`/api/error-items/${g.id}`,e),V(e))},P=async()=>{g&&await q(g.id)},H=async e=>{if(!g)return;let t=g.difficultyStars??null;V({difficultyStars:e}),D(!0);try{let t=await x.f.put(`/api/error-items/${g.id}`,{difficultyStars:e});V({paperLevel:t.paperLevel})}catch(e){V({difficultyStars:t}),v.f.error("[ErrorDetail]","Failed to save difficulty",{error:e}),E.c.error(d.difficulty.saveFailed)}finally{D(!1)}},G=(0,a.useCallback)((e,t)=>{V({["en"===e?"svgAnimationEn":"svgAnimation"]:t})},[V]),B=async()=>{if(g&&await (0,E.u)(d.common?.messages?.confirmDelete||"Are you sure you want to delete this error item?",{destructive:!0}))try{await x.f.delete(`/api/error-items/${g.id}/delete`),E.c.success(d.common?.messages?.deleteSuccess||"Deleted successfully"),i.push(g.subjectId?`/notebooks/${g.subjectId}`:"/notebooks")}catch(e){v.f.error("[ErrorDetail]","Failed to delete error item",{error:e}),E.c.error(d.common?.messages?.deleteFailed||"Delete failed")}};return b?(0,t.jsx)(e3.f,{label:d.common.loading}):g?(0,t.jsxs)("main",{className:"min-h-screen",children:[(0,t.jsxs)("div",{className:"mx-auto max-w-6xl space-y-6 px-4 py-6 md:px-8 md:py-8",children:[(0,t.jsxs)("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[(0,t.jsx)(s.default,{href:g.subjectId?`/notebooks/${g.subjectId}`:"/notebooks",children:(0,t.jsx)(f.f,{variant:"ghost",size:"icon",className:"-ml-2",children:(0,t.jsx)(n.f,{className:"h-5 w-5"})})}),(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:d.detail.title}),(0,t.jsx)(ej,{shortId:g.shortId}),(0,t.jsx)(u.f,{size:"md",value:g.difficultyStars,onChange:H,disabled:U})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(em,{errorItemId:g.id,fields:g,onDone:V}),(0,t.jsx)(s.default,{href:`/practice?id=${g.id}`,children:(0,t.jsxs)(f.f,{variant:"outline",size:"sm",children:[(0,t.jsx)(c.f,{className:"mr-2 h-4 w-4"}),d.detail.practice]})}),$&&(0,t.jsx)(ef.x,{status:$,className:"h-8 self-center px-3"}),(0,t.jsxs)(f.f,{variant:"ghost",size:"sm",onClick:B,className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:[(0,t.jsx)(o.f,{className:"mr-2 h-4 w-4"}),d.detail.delete||"Delete"]})]})]}),(0,t.jsx)(es,{item:g,educationStage:C,saveFields:_,onUpdate:V,reload:P,onEnlarge:k}),(0,t.jsx)(eg.K,{errorItemId:g.id,onMasteryStatusChange:O}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsx)(F,{title:d.detail.correctAnswer,value:g.answerText,onSave:e=>_({answerText:e}),logLabel:"answer",rows:5,placeholder:"Enter answer...",cardClassName:"border-primary/20",titleClassName:"text-primary",contentClassName:"font-semibold",headerActions:(0,t.jsx)(ex,{errorItemId:g.id,onDone:e=>V({answerText:e.answerText??"",analysis:e.analysis??""})}),children:g.referenceImageUrl&&(0,t.jsx)("div",{className:"pt-3",children:(0,t.jsx)(ea,{src:g.referenceImageUrl,alt:d.detail.referenceImageAlt,showLabel:d.detail.viewImage,hideLabel:d.detail.hideImage,visible:A,onVisibleChange:S,onEnlarge:k})})}),(0,t.jsx)(en,{item:g,saveFields:_,onEnlarge:k})]}),(0,t.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,t.jsx)(F,{title:d.detail.analysis,value:g.analysis,onSave:e=>_({analysis:e}),logLabel:"analysis",rows:12,placeholder:"Enter analysis..."}),(0,t.jsx)(F,{title:d.detail?.mistakeAnalysis||"Mistake Analysis",value:g.mistakeAnalysis,onSave:e=>_({mistakeAnalysis:e}),logLabel:"mistake analysis",rows:8,editorLabel:d.editor?.mistakeAnalysis||"Mistake Cause Analysis",emptyText:d.detail?.noMistakeAnalysis||"No mistake analysis yet."})]}),(0,t.jsxs)("div",{className:"space-y-6",children:[M&&(0,t.jsx)(e1,{errorItemId:g.id,svgAnimation:"en"===m?g.svgAnimationEn:g.svgAnimation,hasOtherLanguage:!!("en"===m?g.svgAnimation:g.svgAnimationEn),onChange:G},m),L&&(0,t.jsx)(j,{errorItemId:g.id,commands:g.geogebraCommands,onUpdate:V}),(0,t.jsx)(R,{item:g,onUpdate:V})]})]}),(0,t.jsx)(y,{src:N,onClose:()=>k(null)})]}):(0,t.jsx)(e2.f,{icon:l,title:d.detail.notFound||"Item not found",className:"m-4 md:m-8"})}],204573)}]);
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,842727,e=>{var t=e.i(271645),r=e.i(981140),n=e.i(75830),o=e.i(820783),a=e.i(30030),i=e.i(610772),s=e.i(248425),u=e.i(30207),l=e.i(369340),c=e.i(586318),f=e.i(934620),d=Object.defineProperty,p=(e,t)=>d(e,"name",{value:t,configurable:!0}),h=!1;function v(){let[e,r]=t.useState(h);return t.useEffect(()=>{h||(h=!0,r(!0))},[]),e}p(v,"useIsHydrated");var y=t[" useSyncExternalStore ".trim().toString()];function g(){return()=>{}}function m(){return y(g,()=>!0,()=>!1)}p(g,"subscribe"),p(m,"useIsHydratedModern");var b="function"==typeof y?m:v,x=e.i(843476),w=Object.defineProperty,k=(e,t)=>w(e,"name",{value:t,configurable:!0}),M="rovingFocusGroup.onEntryFocus",j={bubbles:!1,cancelable:!0},S="RovingFocusGroup",[T,F,C]=(0,n.f)(S),[E,P]=(0,a.f)(S,[C]),[R,I]=E(S),A=t.forwardRef(k(function(e,t){return(0,x.jsx)(T.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,x.jsx)(T.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,x.jsx)(N,{...e,ref:t})})})},"RovingFocusGroup")),N=t.forwardRef(k(function(e,n){let{__scopeRovingFocusGroup:a,orientation:i,loop:f=!1,dir:d,currentTabStopId:p,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:v,onEntryFocus:y,preventScrollOnEntryFocus:g=!1,...m}=e,b=t.useRef(null),w=(0,o.f)(n,b),k=(0,c.f)(d),[T,C]=(0,l.f)({prop:p,defaultProp:h??null,onChange:v,caller:S}),[E,P]=t.useState(!1),I=(0,u.f)(y),A=F(a),N=t.useRef(!1),[L,U]=t.useState(0);return t.useEffect(()=>{let e=b.current;if(e)return e.addEventListener(M,I),()=>e.removeEventListener(M,I)},[I]),(0,x.jsx)(R,{scope:a,orientation:i,dir:k,loop:f,currentTabStopId:T,onItemFocus:t.useCallback(e=>C(e),[C]),onItemShiftTab:t.useCallback(()=>P(!0),[]),onFocusableItemAdd:t.useCallback(()=>U(e=>e+1),[]),onFocusableItemRemove:t.useCallback(()=>U(e=>e-1),[]),children:(0,x.jsx)(s.V.div,{tabIndex:E||0===L?-1:0,"data-orientation":i,...m,ref:w,style:{outline:"none",...e.style},onMouseDown:(0,r.f)(e.onMouseDown,()=>{N.current=!0}),onFocus:(0,r.f)(e.onFocus,e=>{let t=!N.current;if(e.target===e.currentTarget&&t&&!E){let t=new CustomEvent(M,j);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=A().filter(e=>e.focusable);O([e.find(e=>e.active),e.find(e=>e.id===T),...e].filter(Boolean).map(e=>e.ref.current),g)}}N.current=!1}),onBlur:(0,r.f)(e.onBlur,()=>P(!1))})})},"RovingFocusGroupImpl")),L=t.forwardRef(k(function(e,n){let{__scopeRovingFocusGroup:o,focusable:a=!0,active:u=!1,tabStopId:l,children:c,...d}=e,p=(0,i.f)(),h=l||p,v=I("RovingFocusGroupItem",o),y=v.currentTabStopId===h,g=F(o),{onFocusableItemAdd:m,onFocusableItemRemove:w,currentTabStopId:k}=v,M=b();return(0,f.f)(()=>{if(M&&a)return m(),()=>w()},[M,a,m,w]),t.useEffect(()=>{if(!M&&a)return m(),()=>w()},[M,a,m,w]),(0,x.jsx)(T.ItemSlot,{scope:o,id:h,focusable:a,active:u,children:(0,x.jsx)(s.V.span,{tabIndex:y?0:-1,"data-orientation":v.orientation,...d,ref:n,onMouseDown:(0,r.f)(e.onMouseDown,e=>{a?v.onItemFocus(h):e.preventDefault()}),onFocus:(0,r.f)(e.onFocus,()=>v.onItemFocus(h)),onKeyDown:(0,r.f)(e.onKeyDown,e=>{if("Tab"===e.key&&e.shiftKey)return void v.onItemShiftTab();if(e.target!==e.currentTarget)return;let t=_(e,v.orientation,v.dir);if(void 0!==t){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let r=g().filter(e=>e.focusable).map(e=>e.ref.current);if("last"===t)r.reverse();else if("prev"===t||"next"===t){"prev"===t&&r.reverse();let n=r.indexOf(e.currentTarget);r=v.loop?$(r,n+1):r.slice(n+1)}setTimeout(()=>O(r))}}),children:"function"==typeof c?c({isCurrentTabStop:y,hasTabStop:null!=k}):c})})},"RovingFocusGroupItem")),U={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function D(e,t){return"rtl"!==t?e:"ArrowLeft"===e?"ArrowRight":"ArrowRight"===e?"ArrowLeft":e}function _(e,t,r){let n=D(e.key,r);if(!("vertical"===t&&["ArrowLeft","ArrowRight"].includes(n))&&!("horizontal"===t&&["ArrowUp","ArrowDown"].includes(n)))return U[n]}function O(e,t=!1){let r=document.activeElement;for(let n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function $(e,t){return e.map((r,n)=>e[(t+n)%e.length])}k(D,"getDirectionAwareKey"),k(_,"getFocusIntent"),k(O,"focusFirst"),k($,"wrapArray"),e.s(["M",0,L,"F",0,A,"B",0,P],842727)},217923,e=>{let t=(0,e.i(475254).f)("chart-column",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);e.s(["f",0,t],217923)},664659,655900,e=>{var t=e.i(475254);let r=(0,t.f)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);e.s(["f",0,r],664659);let n=(0,t.f)("chevron-up",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);e.s(["f",0,n],655900)},269638,e=>{let t=(0,e.i(475254).f)("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);e.s(["f",0,t],269638)},373884,e=>{let t=(0,e.i(475254).f)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["f",0,t],373884)},440160,e=>{let t=(0,e.i(475254).f)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["f",0,t],440160)},178583,733060,e=>{let t=(0,e.i(475254).f)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["f",0,t],178583);var r=e.i(908821);e.s(["f",()=>r.f],733060)},763639,e=>{let t=(0,e.i(475254).f)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);e.s(["f",0,t],763639)},431343,79058,e=>{let t=(0,e.i(475254).f)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);e.s(["f",0,t],431343);var r=e.i(41931);let n=null,o=null,a=!1;function i(){return"u"<typeof Audio?null:o??=new Audio}let s=new Map,u=(e,t)=>`${t}
|
|
2
|
+
${e}`;function l(e,t,n){return r.f.post("/api/tts",{text:e,language:t,...n?{regenerate:n}:{}},{timeout:12e4,recoverable:!0}).then(({id:e,version:t})=>`/api/tts/${e}?v=${t}`)}async function c(e,t,r){for(let n=0;n<e.length;n++){let o=l(e[n],t,!0);s.set(u(e[n],t),o),await o.catch(r=>{throw s.delete(u(e[n],t)),r}),r?.(n+1)}}e.s(["l",0,i,"v",0,function(){return n??=r.f.get("/api/tts").then(e=>"cloud"===e.mode?"cloud":"browser").catch(()=>"browser")},"h",0,function(){return a},"H",0,c,"U",0,function(e,t){let r=u(e,t),n=s.get(r);return n||((n=l(e,t,!1)).catch(()=>s.delete(r)),s.set(r,n)),n},"p",0,function(){let e=i();if(e&&!a){let t,r,n;a=!0,t=new DataView(new ArrayBuffer(1644)),(r=(e,r)=>[...r].forEach((r,n)=>t.setUint8(e+n,r.charCodeAt(0))))(0,"RIFF"),t.setUint32(4,1636,!0),r(8,"WAVE"),r(12,"fmt "),t.setUint32(16,16,!0),t.setUint16(20,1,!0),t.setUint16(22,1,!0),t.setUint32(24,8e3,!0),t.setUint32(28,16e3,!0),t.setUint16(32,2,!0),t.setUint16(34,16,!0),r(36,"data"),t.setUint32(40,1600,!0),n="",new Uint8Array(t.buffer).forEach(e=>{n+=String.fromCharCode(e)}),e.src=`data:audio/wav;base64,${btoa(n)}`,e.play().catch(()=>{a=!1})}}],79058)},107233,e=>{let t=(0,e.i(475254).f)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["f",0,t],107233)},16715,e=>{let t=(0,e.i(475254).f)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["f",0,t],16715)},367240,e=>{let t=(0,e.i(475254).f)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["f",0,t],367240)},727612,e=>{let t=(0,e.i(475254).f)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["f",0,t],727612)},284614,e=>{let t=(0,e.i(475254).f)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["f",0,t],284614)},908821,e=>{let t=(0,e.i(475254).f)("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(["f",0,t])},522016,(e,t,r)=>{e.i(247167),Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return g},useLinkStatus:function(){return b}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(190809),i=e.r(843476),s=a._(e.r(271645)),u=e.r(195057),l=e.r(8372),c=e.r(818581),f=e.r(718967),d=e.r(405550),p=e.r(388540),h=e.r(91949),v=e.r(573668),y=e.r(509396);function g(t){var r;let n,o,a,[g,b]=(0,s.useOptimistic)(h.IDLE_LINK_STATUS),x=(0,s.useRef)(null),{href:w,as:k,children:M,prefetch:j=null,passHref:S,replace:T,shallow:F,scroll:C,onClick:E,onMouseEnter:P,onTouchStart:R,legacyBehavior:I=!1,onNavigate:A,transitionTypes:N,ref:L,unstable_dynamicOnHover:U,...D}=t;n=M,I&&("string"==typeof n||"number"==typeof n)&&(n=(0,i.jsx)("a",{children:n}));let _=s.default.useContext(l.AppRouterContext),O=!1!==j,$=!1===j?"none":!0===j?"full":"auto",z="none"!==$?"auto"===$?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,V="string"==typeof(r=k||w)?r:(0,u.formatUrl)(r);if(I){if(n?.$$typeof===Symbol.for("react.lazy"))throw Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag.");o=s.default.Children.only(n)}let K=I?o&&"object"==typeof o&&o.ref:L,B,q=s.default.useCallback(e=>(null!==_&&(x.current=(0,h.mountLinkInstance)(e,V,_,z,O,b,B)),()=>{x.current&&((0,h.unmountLinkForCurrentNavigation)(x.current),x.current=null),(0,h.unmountPrefetchableInstance)(e)}),[O,V,_,z,b,B]),H={ref:(0,c.useMergedRef)(q,K),onClick(t){I||"function"!=typeof E||E(t),I&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(t),!_||t.defaultPrevented||function(t,r,n,o,a,i,s,u="none"){if("u">typeof window){let l,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((l=t.currentTarget.getAttribute("target"))&&"_self"!==l||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,v.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{navigate:f}=e.r(132916);f(r,o?"replace":"push",!1===a?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,s,u)}}(t,V,x,T,C,A,N,$)},onMouseEnter(e){I||"function"!=typeof P||P(e),I&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),_&&O&&(0,h.onNavigationIntent)(e.currentTarget,!0===U)},onTouchStart:function(e){I||"function"!=typeof R||R(e),I&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),_&&O&&(0,h.onNavigationIntent)(e.currentTarget,!0===U)}};return(0,f.isAbsoluteUrl)(V)?H.href=V:I&&!S&&("a"!==o.type||"href"in o.props)||(H.href=(0,d.addBasePath)(V)),a=I?s.default.cloneElement(o,H):(0,i.jsx)("a",{...D,...H,children:n}),(0,i.jsx)(m.Provider,{value:g,children:a})}let m=(0,s.createContext)(h.IDLE_LINK_STATUS),b=()=>(0,s.useContext)(m);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},818581,(e,t,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(271645);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=a(e,n)),t&&(o.current=a(t,n))},[e,t])}function a(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},195057,(e,t,r)=>{e.i(247167),Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return s},formatWithValidation:function(){return l},urlObjectKeys:function(){return u}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=e.r(190809)._(e.r(998183)),i=/https?|ftp|gopher|file/;function s(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",s=e.hash||"",u=e.query||"",l=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?l=t+e.host:r&&(l=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(l+=":"+e.port)),u&&"object"==typeof u&&(u=String(a.urlQueryToSearchParams(u)));let c=e.search||u&&`?${u}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||i.test(n))&&!1!==l?(l="//"+(l||""),o&&"/"!==o[0]&&(o="/"+o)):l||(l=""),s&&"#"!==s[0]&&(s="#"+s),c&&"?"!==c[0]&&(c="?"+c),o=o.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${l}${o}${c}${s}`}let u=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function l(e){return s(e)}},573668,(e,t,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return a}});let n=e.r(718967),o=e.r(652817);function a(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},718967,(e,t,r)=>{e.i(247167),Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return w},MissingStaticPage:function(){return x},NormalizeError:function(){return m},PageNotFoundError:function(){return b},SP:function(){return v},ST:function(){return y},WEB_VITALS:function(){return a},execOnce:function(){return i},getDisplayName:function(){return f},getLocationOrigin:function(){return l},getURL:function(){return c},isAbsoluteUrl:function(){return u},isResSent:function(){return d},loadGetInitialProps:function(){return h},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return k}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let a=["CLS","FCP","INP","LCP","TTFB"];function i(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let s=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,u=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&s.test(e)};function l(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=l();return e.substring(t.length)}function f(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function d(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function h(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await h(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&d(r))return n;if(!n)throw Error(`"${f(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`);return n}let v="u">typeof performance,y=v&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class m extends Error{}class b extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class x extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class w extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function k(e){return JSON.stringify({message:e.message,stack:e.stack})}},307364,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(531278),o=e.i(519455),a=e.i(793479),i=e.i(110204),s=e.i(111110),u=e.i(41931),l=e.i(201276);e.s(["f",0,function({onSaved:e}){let{t:c}=(0,s.b)(),[f,d]=(0,r.useState)(String(90)),[p,h]=(0,r.useState)(null),[v,y]=(0,r.useState)(!0),[g,m]=(0,r.useState)(!1),[b,x]=(0,r.useState)(null),w=Number(f),k=""!==f.trim()&&Number.isFinite(w)&&w>=1&&w<=100&&1e-6>Math.abs(100*w-Math.round(100*w)),M=(0,r.useCallback)(async()=>{y(!0),x(null);try{let e=(await u.f.get("/api/user")).questionDuplicateThreshold??90;d(String(e)),h(e)}catch(e){x(c.importFlow.thresholdLoadFailed),l.f.error("[Settings]","加载判重阈值失败",{error:e instanceof Error?e.message:String(e)})}finally{y(!1)}},[c.importFlow.thresholdLoadFailed]);(0,r.useEffect)(()=>{M()},[M]);let j=async()=>{if(k&&null!==p){m(!0),x(null);try{let t=(await u.f.patch("/api/user",{questionDuplicateThreshold:w})).questionDuplicateThreshold??w;h(t),d(String(t)),x(c.importFlow.preferenceSaved),e?.(t)}catch(e){x(c.importFlow.preferenceSaveFailed),l.f.error("[Settings]","保存判重阈值失败",{error:e instanceof Error?e.message:String(e)})}finally{m(!1)}}};return(0,t.jsxs)("div",{className:"space-y-2 border-t pt-4",children:[(0,t.jsx)(i.f,{htmlFor:"question-duplicate-threshold",children:c.importFlow.thresholdLabel}),(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(a.f,{id:"question-duplicate-threshold",type:"number",min:1,max:100,step:.01,value:f,onChange:e=>{d(e.target.value),x(null)},disabled:v||g||null===p,className:"w-28","aria-describedby":"question-duplicate-threshold-hint"}),(0,t.jsx)("span",{"aria-hidden":"true",children:"%"}),(0,t.jsxs)(o.f,{type:"button",size:"sm",variant:"outline",onClick:j,disabled:v||g||null===p||!k||w===p,children:[(v||g)&&(0,t.jsx)(n.f,{className:"mr-2 h-4 w-4 animate-spin"}),c.importFlow.saveThreshold]}),!v&&null===p&&(0,t.jsx)(o.f,{type:"button",size:"sm",variant:"outline",onClick:M,children:c.importFlow.retryLoad})]}),(0,t.jsx)("p",{id:"question-duplicate-threshold-hint",className:"text-xs text-muted-foreground",children:c.importFlow.thresholdDescription}),null!==p&&!k&&(0,t.jsx)("p",{className:"text-xs text-destructive",role:"alert",children:c.importFlow.thresholdInvalid}),b&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground",role:"status",children:b})]})}],307364)},487486,e=>{var t=e.i(843476),r=e.i(991918),n=e.i(225913),o=e.i(975157);let a=(0,n.f)("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});e.s(["f",0,function({className:e,variant:n,asChild:i=!1,...s}){let u=i?r.M:"span";return(0,t.jsx)(u,{"data-slot":"badge",className:(0,o.f)(a({variant:n}),e),...s})}])},677572,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(981140),o=e.i(30030),a=e.i(842727),i=e.i(296626),s=e.i(248425),u=e.i(586318),l=e.i(369340),c=e.i(610772),f=Object.defineProperty,d=(e,t)=>f(e,"name",{value:t,configurable:!0}),p="Tabs",[h,v]=(0,o.f)(p,[a.B]),y=(0,a.B)(),[g,m]=h(p),b=r.forwardRef(d(function(e,r){let{__scopeTabs:n,value:o,onValueChange:a,defaultValue:i,orientation:f="horizontal",dir:d,activationMode:h="automatic",...v}=e,y=(0,u.f)(d),[m,b]=(0,l.f)({prop:o,onChange:a,defaultProp:i??"",caller:p});return(0,t.jsx)(g,{scope:n,baseId:(0,c.f)(),value:m,onValueChange:b,orientation:f,dir:y,activationMode:h,children:(0,t.jsx)(s.V.div,{dir:y,"data-orientation":f,...v,ref:r})})},"Tabs")),x=r.forwardRef(d(function(e,r){let{__scopeTabs:n,loop:o=!0,...i}=e,u=m("TabsList",n),l=y(n);return(0,t.jsx)(a.F,{asChild:!0,...l,orientation:u.orientation,dir:u.dir,loop:o,children:(0,t.jsx)(s.V.div,{role:"tablist","aria-orientation":u.orientation,...i,ref:r})})},"TabsList")),w=r.forwardRef(d(function(e,r){let{__scopeTabs:o,value:i,disabled:u=!1,...l}=e,c=m("TabsTrigger",o),f=y(o),d=M(c.baseId,i),p=j(c.baseId,i),h=i===c.value;return(0,t.jsx)(a.M,{asChild:!0,...f,focusable:!u,active:h,children:(0,t.jsx)(s.V.button,{type:"button",role:"tab","aria-selected":h,"aria-controls":p,"data-state":h?"active":"inactive","data-disabled":u?"":void 0,disabled:u,id:d,...l,ref:r,onMouseDown:(0,n.f)(e.onMouseDown,e=>{u||0!==e.button||!1!==e.ctrlKey?e.preventDefault():(e.currentTarget.focus(),c.onValueChange(i))}),onKeyDown:(0,n.f)(e.onKeyDown,e=>{!u&&e.target===e.currentTarget&&[" ","Enter"].includes(e.key)&&c.onValueChange(i)}),onFocus:(0,n.f)(e.onFocus,()=>{let e="manual"!==c.activationMode;h||u||!e||c.onValueChange(i)})})})},"TabsTrigger")),k=r.forwardRef(d(function(e,n){let{__scopeTabs:o,value:a,forceMount:u,children:l,...c}=e,f=m("TabsContent",o),d=M(f.baseId,a),p=j(f.baseId,a),h=a===f.value,v=r.useRef(h);return r.useEffect(()=>{let e=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(i.f,{present:u||h,children:({present:r})=>(0,t.jsx)(s.V.div,{"data-state":h?"active":"inactive","data-orientation":f.orientation,role:"tabpanel","aria-labelledby":d,hidden:!r,id:p,tabIndex:0,...c,ref:n,style:{...e.style,animationDuration:v.current?"0s":void 0},children:r&&l})})},"TabsContent"));function M(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}d(M,"makeTriggerId"),d(j,"makeContentId");var S=e.i(975157);let T=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(x,{ref:n,className:(0,S.f)("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...r}));T.displayName=x.displayName;let F=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(w,{ref:n,className:(0,S.f)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...r}));F.displayName=w.displayName;let C=r.forwardRef(({className:e,...r},n)=>(0,t.jsx)(k,{ref:n,className:(0,S.f)("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...r}));C.displayName=k.displayName,e.s(["i",0,b,"S",0,C,"U",0,T,"k",0,F],677572)},624687,e=>{var t=e.i(843476),r=e.i(975157);e.s(["f",0,function({className:e,...n}){return(0,t.jsx)("textarea",{"data-slot":"textarea",className:(0,r.f)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...n})}])},215519,e=>{var t=e.i(843476),r=e.i(271645),n=e.i(306831);let o=(0,r.createContext)({timeZone:n.J,setTimeZone:()=>void 0});e.s(["n",0,function({children:e,initialTimeZone:a=n.J}){let[i,s]=(0,r.useState)(a);return(0,t.jsx)(o.Provider,{value:{timeZone:i,setTimeZone:s},children:e})},"M",0,function(){return(0,r.useContext)(o)}])},905110,e=>{e.s(["z",0,50,"o",0,100,"P",0,1,"m",0,function(e,t=50){return"number"==typeof e&&e>=t/100}])}])})();
|
package/package.json
CHANGED
package/prisma/seed.db
CHANGED
|
Binary file
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[[180473,e=>{var i=e.i(562810);e.s(["z",0,i])},206033,e=>{var i=e.i(562810);e.s(["z",0,i])},856379,e=>{var i=e.i(181912),r=e.i(798003),n=e.i(376025),t=e.i(50377),o=e.i(698043);let a=(0,t.f)("ai-quota");async function d(e,i=new Date){let{start:t,end:a}=(0,n.d)(i,(0,r.c)());return o.f.aiUsage.count({where:{userId:e,createdAt:{gte:t,lt:a}}})}async function u(e,n){try{let t=(0,r.b)().aiDailyLimit??0;if(t>0&&"admin"!==e.role&&await d(e.id)>=t)return a.info({userId:e.id,kind:n,limit:t},"AI daily limit reached"),(0,i.B)(i.p.AI_DAILY_LIMIT_EXCEEDED,429,i.p.AI_DAILY_LIMIT_EXCEEDED,{limit:t});await o.f.aiUsage.create({data:{userId:e.id,kind:n}})}catch(i){a.error({error:i,userId:e.id,kind:n},"Failed to check AI quota")}return null}e.s(["f",0,u])},843911,e=>{var i=e.i(893963),r=e.i(592938),n=e.i(229236),t=e.i(690604),o=e.i(59116),a=e.i(298876),d=e.i(798003);let u=(0,e.i(50377).f)("ai");e.s(["f",0,function(){let e=(0,d.b)(),m=e.aiProvider;if("openai"===m){let e=(0,d.z)();return u.info({activeInstance:e?.name},"Using OpenAI Provider"),new r.F(e)}if("azure"===m)return u.info({deployment:e.azure?.deploymentName},"Using Azure OpenAI Provider"),new n.f(e.azure);if("anthropic"===m)return u.info({model:e.anthropic?.model},"Using Anthropic Provider"),new t.R(e.anthropic);{if("minimax-code"===m)return u.info({model:e.minimaxCode?.model},"Using MiniMax Code OAuth Provider"),new o.f(e.minimaxCode);if("gemini"===m)return u.info("Using Gemini Provider"),new i.f(e.gemini);let n=(0,a.j)(m)?m:"minimax",t=(0,a.k)(n,e[n]);return u.info({vendor:a.$[n].name,model:t.model},"Using vendor provider (OpenAI compatible)"),new r.F(t)}}])},630166,e=>{e.s(["f",0,function(e,i){return(i||"").trim()?"wrong_attempt":"not_attempted"===e||"wrong_attempt"===e||"unknown"===e?e:"unknown"}])}],522734,(e,i,r)=>{i.exports=e.x("fs",()=>require("fs"))},504446,(e,i,r)=>{i.exports=e.x("net",()=>require("net"))},446786,(e,i,r)=>{i.exports=e.x("os",()=>require("os"))},755004,(e,i,r)=>{i.exports=e.x("tls",()=>require("tls"))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__00s2hc-f4f5gd._.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
module.exports=[951615,(e,r,o)=>{r.exports=e.x("node:buffer",()=>require("node:buffer"))},902157,(e,r,o)=>{r.exports=e.x("node:fs",()=>require("node:fs"))},347299,(e,r,o)=>{r.exports=e.x("node:http",()=>require("node:http"))},761095,(e,r,o)=>{r.exports=e.x("node:net",()=>require("node:net"))},750227,(e,r,o)=>{r.exports=e.x("node:path",()=>require("node:path"))},59639,(e,r,o)=>{r.exports=e.x("node:process",()=>require("node:process"))},857764,(e,r,o)=>{r.exports=e.x("node:url",()=>require("node:url"))},812057,(e,r,o)=>{r.exports=e.x("node:util",()=>require("node:util"))},727028,(e,r,o)=>{r.exports=e.x("node:zlib",()=>require("node:zlib"))},325897,e=>{e.v(r=>Promise.all(["server/chunks/[externals]__1oyo6y4k5ao25._.js","server/chunks/[root-of-the-server]__15tkoe60wvpdf._.js","server/chunks/node_modules_node-fetch_src_utils_multipart-parser_0a9aeam58e52_.js"].map(r=>e.l(r))).then(()=>r(255057)))}];
|
|
2
|
-
|
|
3
|
-
//# sourceMappingURL=%5Broot-of-the-server%5D__0auuq_0yerirb._.js.map
|