lookatstudy-mobile 0.35.0 → 0.36.0
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/package.json +1 -1
- package/server.cjs +2684 -2021
- package/web/assets/{CanvasStage-C72HaOiw.js → CanvasStage-2yeV4nPH.js} +1 -1
- package/web/assets/{CommandPalette-cB6g-mzh.js → CommandPalette-BFX8tcFC.js} +1 -1
- package/web/assets/{CompanionBotLab-Ch7CGv7f.js → CompanionBotLab-DTlObSeR.js} +1 -1
- package/web/assets/{CourseSearchPanel-C4Kh0qi3.js → CourseSearchPanel-DiuZkUSE.js} +1 -1
- package/web/assets/{ExamView-dpph-olw.js → ExamView-fx7mUx8Q.js} +2 -2
- package/web/assets/PersonalProfileModal-CivNUd4y.js +16 -0
- package/web/assets/{ReviewPanel-DynCNoAR.js → ReviewPanel-CdgUqKuF.js} +1 -1
- package/web/assets/{SettingsView-CislD6Xj.js → SettingsView-pzj-Jlrz.js} +6 -6
- package/web/assets/{VoicePanel-BgdvFoyX.js → VoicePanel-Cyopy3sr.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-CMtB3HOl.js → abnfDiagram-VCTEODGH-Dn5J4BZu.js} +1 -1
- package/web/assets/{abnfDiagram-VCTEODGH-ODA7YWAP-BvhKfjaY.js → abnfDiagram-VCTEODGH-ODA7YWAP-6WuG0Nt3.js} +1 -1
- package/web/assets/{api-web-Dwfo27My.js → api-web-ChIPnpHO.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-C4PU3XN7-CSMXYZiY.js → architectureDiagram-5GKGNRK7-C4PU3XN7-BtKh8197.js} +1 -1
- package/web/assets/{architectureDiagram-5GKGNRK7-CHnFIH9b.js → architectureDiagram-5GKGNRK7-jrCKwrXL.js} +1 -1
- package/web/assets/{blockDiagram-I7D4REHJ-VdzqHZvv.js → blockDiagram-I7D4REHJ-CWtkTOLG.js} +1 -1
- package/web/assets/{blockDiagram-NRAW4CY4-UMJ6PMQQ-D7kvNED-.js → blockDiagram-NRAW4CY4-UMJ6PMQQ-DHl4tIPo.js} +1 -1
- package/web/assets/{c4Diagram-7LVT6UL2-CgznJmUi.js → c4Diagram-7LVT6UL2-DvgOYbmL.js} +1 -1
- package/web/assets/{c4Diagram-UCG6FXSJ-75X3U2P3-B9xFuSPH.js → c4Diagram-UCG6FXSJ-75X3U2P3-8t5uU1V0.js} +1 -1
- package/web/assets/channel-CSAHJ2BV.js +1 -0
- package/web/assets/{chunk-2Q5K7J3B-CAns8y8j.js → chunk-2Q5K7J3B-D-MRkRaW.js} +1 -1
- package/web/assets/{chunk-5VM5RSS4-C2nhzqYi.js → chunk-5VM5RSS4-DgMwQtQx.js} +1 -1
- package/web/assets/{chunk-7XDTSPCN-Du4JZkXG.js → chunk-7XDTSPCN-C6CLiznJ.js} +1 -1
- package/web/assets/{chunk-CTNIYPP6-B7lfk-YJ.js → chunk-CTNIYPP6-CM1Z69qf.js} +1 -1
- package/web/assets/{chunk-CXNFBKHE-BC4UXdAm.js → chunk-CXNFBKHE-B6ieqKBL.js} +1 -1
- package/web/assets/{chunk-F27PBJKO-LQpoAT6J.js → chunk-F27PBJKO-AboV3MjF.js} +1 -1
- package/web/assets/{chunk-IMKFNOWR-Ctz3Z-uw.js → chunk-IMKFNOWR-BRfxTcG3.js} +1 -1
- package/web/assets/{chunk-ISA7TJRJ-CxiQRkRL.js → chunk-ISA7TJRJ-BA6VnLlf.js} +1 -1
- package/web/assets/{chunk-JWPE2WC7-yepkRAwM.js → chunk-JWPE2WC7-CM5DFf0Z.js} +1 -1
- package/web/assets/{chunk-LV3HUYFY-CIjD4C-e.js → chunk-LV3HUYFY-DtT0YyqZ.js} +1 -1
- package/web/assets/{chunk-M3IUQBOH-B_b1jC1d.js → chunk-M3IUQBOH-DGSTxKRB.js} +1 -1
- package/web/assets/{chunk-NDIOYS4C-Dnzhfg9r.js → chunk-NDIOYS4C-BDCIN1Cv.js} +1 -1
- package/web/assets/{chunk-POPQ4Y6H-fHcz0X8j.js → chunk-POPQ4Y6H-CRs1ouKF.js} +1 -1
- package/web/assets/{chunk-RE4WF27V-CxX4BnEj.js → chunk-RE4WF27V-CPwQc2vn.js} +1 -1
- package/web/assets/{chunk-SVP7TREG-BnltLrM-.js → chunk-SVP7TREG-Cbw7rxkD.js} +1 -1
- package/web/assets/{chunk-TICWLB2K-D12wpFc6.js → chunk-TICWLB2K-CJpuBU6m.js} +1 -1
- package/web/assets/{chunk-VII2H2IX-Twcv7Nfl.js → chunk-VII2H2IX-udiwuRgE.js} +1 -1
- package/web/assets/{chunk-X5GNSKZ3-BL1R0B0m.js → chunk-X5GNSKZ3-DvVFKhTQ.js} +1 -1
- package/web/assets/{chunk-XCWWM2C3-Tg4IR0n8.js → chunk-XCWWM2C3-EFZq_oj4.js} +1 -1
- package/web/assets/{chunk-XXDRQBXY-DJoPR1YB.js → chunk-XXDRQBXY-BCxGit2x.js} +1 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-4hLnkbwM.js +1 -0
- package/web/assets/classDiagram-ZZMXUADV-CMAUnrA5.js +1 -0
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-4hLnkbwM.js +1 -0
- package/web/assets/classDiagram-v2-VYDZK3BY-CMAUnrA5.js +1 -0
- package/web/assets/{core-CInUNwIn.js → core-CTdCef6f.js} +4 -4
- package/web/assets/{cose-bilkent-JH36ORCC-Bs86DA0h.js → cose-bilkent-JH36ORCC-Dfkex2fo.js} +1 -1
- package/web/assets/{cose-bilkent-JH36ORCC-OB24KH3T-Dq3mWE76.js → cose-bilkent-JH36ORCC-OB24KH3T-CE0-pZTl.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-D6ZQlGMQ.js → cynefin-OW5HDTMX-DeRfvx8D.js} +1 -1
- package/web/assets/{cynefin-OW5HDTMX-GVF3BKWE-Dnl8JJFM.js → cynefin-OW5HDTMX-GVF3BKWE-WBE1vO13.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-CCC-03k6.js → cynefinDiagram-5FMLGOSQ-Bh5b3wB1.js} +1 -1
- package/web/assets/{cynefinDiagram-5FMLGOSQ-H3WIRU3N-Dt1RAnjs.js → cynefinDiagram-5FMLGOSQ-H3WIRU3N-BJvz82EQ.js} +1 -1
- package/web/assets/{dagre-3AP2YEHR-DCERTXHT-B0t8ElJV.js → dagre-3AP2YEHR-DCERTXHT-XAHjclga.js} +1 -1
- package/web/assets/{dagre-GXQ25YYZ-CgU7yrVy.js → dagre-GXQ25YYZ-DrM7-QVm.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-DTR2y6UT.js → diagram-S7CK7UJ4-DuzIHkVE.js} +1 -1
- package/web/assets/{diagram-S7CK7UJ4-MULGZGEL-DwX9tj_E.js → diagram-S7CK7UJ4-MULGZGEL-DPqhnzpl.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-D2CVN862.js → diagram-UQ7AKVKN-DhVHhLx3.js} +1 -1
- package/web/assets/{diagram-UQ7AKVKN-YQBY353J-LgNf4bhC.js → diagram-UQ7AKVKN-YQBY353J-CtxlSSGF.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-CYQLixjs.js → diagram-VSXAHHWV-KRouqsun.js} +1 -1
- package/web/assets/{diagram-VSXAHHWV-WLNH2ELY-C2Plr2sR.js → diagram-VSXAHHWV-WLNH2ELY-CIR4bpme.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-BJQtFm-G.js → diagram-VX7I27RA-CTJ3vljk.js} +1 -1
- package/web/assets/{diagram-VX7I27RA-XW6YQV5G-BkfQh4Mv.js → diagram-VX7I27RA-XW6YQV5G-BpP1BFMf.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-arIh_Ydh.js → diagram-Z3DM3KII-D5hgo2N9.js} +1 -1
- package/web/assets/{diagram-Z3DM3KII-HG7RF65D-BsWePKJ6.js → diagram-Z3DM3KII-HG7RF65D-BYiYU7xi.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-efb9oxoq.js → ebnfDiagram-PWID7BFC-DamZ_7Vh.js} +1 -1
- package/web/assets/{ebnfDiagram-PWID7BFC-OKY4VHYD-CSDN-ES2.js → ebnfDiagram-PWID7BFC-OKY4VHYD-yPy84C7F.js} +1 -1
- package/web/assets/{elk.bundled-B1HkkibK.js → elk.bundled-Bnb7YbCz.js} +1 -1
- package/web/assets/{erDiagram-RLTQ6QDP-BM3e1Eha.js → erDiagram-RLTQ6QDP-DXutINWC.js} +1 -1
- package/web/assets/{erDiagram-SSCWMZ5O-PIPKOIK7-BkRkgiEn.js → erDiagram-SSCWMZ5O-PIPKOIK7-ZtlmPRSG.js} +1 -1
- package/web/assets/{flowDiagram-A5DVABFB-2Z4AVO5R-CNrxNr1X.js → flowDiagram-A5DVABFB-2Z4AVO5R-RWiTsxAA.js} +1 -1
- package/web/assets/{flowDiagram-HODETNUW-tIdWY3-u.js → flowDiagram-HODETNUW-C0v4xgVs.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-CcbO-KDD.js → ganttDiagram-EL5Y4UJY-C10Pxkpf.js} +1 -1
- package/web/assets/{ganttDiagram-EL5Y4UJY-JZNG7GOG-BZZl4cGf.js → ganttDiagram-EL5Y4UJY-JZNG7GOG-C3JHepgy.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-DMWMLL3G-BXh7EB8a.js → gitGraphDiagram-WWUBYQGX-DMWMLL3G-Dvo5dray.js} +1 -1
- package/web/assets/{gitGraphDiagram-WWUBYQGX-mUHSo0oW.js → gitGraphDiagram-WWUBYQGX-DnhwejId.js} +1 -1
- package/web/assets/{index-CtcKtEMF.js → index-BeI-qOIb.js} +6 -6
- package/web/assets/index-By7sA5iY.css +1 -0
- package/web/assets/{index-BzdORPhC.js → index-C06x750C.js} +1 -1
- package/web/assets/{index-DpUqsNSC.js → index-C8cLLejx.js} +1 -1
- package/web/assets/{index-B9KSAI26.js → index-D5O6zEt9.js} +2 -2
- package/web/assets/{infoDiagram-27XIBGKW-6zuJOkud.js → infoDiagram-27XIBGKW-BCK0GNZi.js} +1 -1
- package/web/assets/{infoDiagram-RXCK75RN-HANS5KVC-DgNsPCDB.js → infoDiagram-RXCK75RN-HANS5KVC-DnIuK4Ld.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-7GCIT7WU-C1aCi21z.js → ishikawaDiagram-5VMMS53U-7GCIT7WU-D7H0PvCT.js} +1 -1
- package/web/assets/{ishikawaDiagram-5VMMS53U-CfBlX7z8.js → ishikawaDiagram-5VMMS53U-CwfpIEur.js} +1 -1
- package/web/assets/{journeyDiagram-3NMN7TZE-CsVwn0uz.js → journeyDiagram-3NMN7TZE-D7yc5_ha.js} +1 -1
- package/web/assets/{journeyDiagram-EYS64GPL-OAPELBT7-GmOyjRKs.js → journeyDiagram-EYS64GPL-OAPELBT7-BxN0kQu5.js} +1 -1
- package/web/assets/{kanban-definition-3QL26DDD-I7RKWQQY-DYO1LivP.js → kanban-definition-3QL26DDD-I7RKWQQY-4n8YjWaH.js} +1 -1
- package/web/assets/{kanban-definition-UXKFOSKX-BGaJOKpZ.js → kanban-definition-UXKFOSKX-jCn6YBMx.js} +1 -1
- package/web/assets/{katex-N6JRN4PM-CCO3fQlh.js → katex-N6JRN4PM-Dsye9nhm.js} +1 -1
- package/web/assets/{layout-DxwbGgTi.js → layout-BGHeGqee.js} +1 -1
- package/web/assets/main-D7WqSbOt.js +537 -0
- package/web/assets/{mermaid-layout-elk.core-D9OOh4D_.js → mermaid-layout-elk.core-DTUF3xdW.js} +2 -2
- package/web/assets/{mermaid.core-BEhN9Nie.js → mermaid.core-C-NqYAhX.js} +5 -5
- package/web/assets/{mindmap-definition-FBJOCRG2-KIYZG64Y-ZPfoLqVV.js → mindmap-definition-FBJOCRG2-KIYZG64Y-DfNqXTK3.js} +1 -1
- package/web/assets/{mindmap-definition-YA3MSWOX-D-0q8D0x.js → mindmap-definition-YA3MSWOX-D3sKf06e.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-BV_8eJIL.js → pegDiagram-XKGWAZYB-CVKDjCVA.js} +1 -1
- package/web/assets/{pegDiagram-XKGWAZYB-OIP57N6J-DqRF2GbT.js → pegDiagram-XKGWAZYB-OIP57N6J-DS2aCbPH.js} +1 -1
- package/web/assets/{pet-DCzJVVt6.js → pet-Du-sCSbe.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-2UOTW327-Cr4fAU8o.js → pieDiagram-E7YTZNPT-2UOTW327-yjF7mWxr.js} +1 -1
- package/web/assets/{pieDiagram-E7YTZNPT-nB-_CLeT.js → pieDiagram-E7YTZNPT-Bv5akhT4.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-BNAlPSkj.js → quadrantDiagram-AXDQQJYC-O95BF4oR.js} +1 -1
- package/web/assets/{quadrantDiagram-AXDQQJYC-SN3ASJJK-Cf5G05Po.js → quadrantDiagram-AXDQQJYC-SN3ASJJK-BLrtldcO.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-34742W6X-CFH7Z2dw.js → railroadDiagram-O6MQD6OU-34742W6X-D8Re17Lm.js} +1 -1
- package/web/assets/{railroadDiagram-O6MQD6OU-FF9J40BN.js → railroadDiagram-O6MQD6OU-C4dT_AHN.js} +1 -1
- package/web/assets/{render-O7CIS3YK-CFk-qve4.js → render-O7CIS3YK-C1LKCRfk.js} +7 -7
- package/web/assets/{requirementDiagram-BXWQKSXE-BMV8VnvW.js → requirementDiagram-BXWQKSXE-DRoAJ0A4.js} +1 -1
- package/web/assets/{requirementDiagram-EFPCY7ZU-NGAFFSMB-Dgr3205x.js → requirementDiagram-EFPCY7ZU-NGAFFSMB-BRpdn_yZ.js} +1 -1
- package/web/assets/{rotate-ccw-DZxkibR5.js → rotate-ccw-BS0Lg3XV.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-3D3M4XPB-CN03neoX.js → sankeyDiagram-P5KCCOFB-3D3M4XPB-U2MyqhHx.js} +1 -1
- package/web/assets/{sankeyDiagram-P5KCCOFB-yPJIv_Ow.js → sankeyDiagram-P5KCCOFB-DhLHY7NO.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-BaWlvXkm.js → sequenceDiagram-WJ2MYXX4-C5QbVOkW.js} +1 -1
- package/web/assets/{sequenceDiagram-WJ2MYXX4-Q2IOPB4R-GEXmhp2H.js → sequenceDiagram-WJ2MYXX4-Q2IOPB4R-C3se4pTd.js} +1 -1
- package/web/assets/{sizeCapture-INFHLROL-DvbiIbXq.js → sizeCapture-INFHLROL-Ds6O28WR.js} +1 -1
- package/web/assets/{sizeCapture-X5ZJPWSS-PSGVOMYM-CLmCvgE-.js → sizeCapture-X5ZJPWSS-PSGVOMYM-Dalg_GSB.js} +1 -1
- package/web/assets/{stateDiagram-D77RDMKH-v3JAq8H4.js → stateDiagram-D77RDMKH-C4Loqn2S.js} +1 -1
- package/web/assets/{stateDiagram-HBIQ2CUA-4M2S6MAN-Bk6n0C4h.js → stateDiagram-HBIQ2CUA-4M2S6MAN-CYg9tFmx.js} +1 -1
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-CMhstoHU.js +1 -0
- package/web/assets/stateDiagram-v2-MP3YSRHH-CcPVgXyv.js +1 -0
- package/web/assets/{swimlanes-42K2YHIH-DHz1p7KG.js → swimlanes-42K2YHIH-B95g1myb.js} +1 -1
- package/web/assets/{swimlanes-XN3QIQJK-N6N2CCQ6-HxeNMmfZ.js → swimlanes-XN3QIQJK-N6N2CCQ6-BVCO5pth.js} +1 -1
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-CqJNI91T.js +8 -0
- package/web/assets/swimlanesDiagram-VR7AAH4N-BrEEiqe7.js +8 -0
- package/web/assets/{timeline-definition-24CTP7MA-Dn1hyaRN.js → timeline-definition-24CTP7MA-DfbDTQSt.js} +1 -1
- package/web/assets/{timeline-definition-24CTP7MA-KN7RSRVM-DVlLI_ni.js → timeline-definition-24CTP7MA-KN7RSRVM-Ba1F1ajL.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-AKJ7LXAN-W1H4YhrJ.js → vennDiagram-4TSXK5OY-AKJ7LXAN-B9Nx1RWB.js} +1 -1
- package/web/assets/{vennDiagram-4TSXK5OY-Dxezw6vn.js → vennDiagram-4TSXK5OY-B-uAb-fo.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-3B6A3BN5-y4QqLWww.js → wardleyDiagram-VM6X3IG4-3B6A3BN5-v-icjHpd.js} +1 -1
- package/web/assets/{wardleyDiagram-VM6X3IG4-BJzvdena.js → wardleyDiagram-VM6X3IG4-Cr0_wFiw.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-DePRnwoY.js → xychartDiagram-S5SC5T6Z-DwsgX-jd.js} +1 -1
- package/web/assets/{xychartDiagram-S5SC5T6Z-OBDNV6WG-CCeTp4-Y.js → xychartDiagram-S5SC5T6Z-OBDNV6WG-BX7F_LDu.js} +1 -1
- package/web/index.html +3 -3
- package/web/pet.html +3 -3
- package/web/assets/arrow-right-TM3y6L-Y.js +0 -6
- package/web/assets/channel-Df7Ybeyp.js +0 -1
- package/web/assets/classDiagram-DTDB5LWJ-LWRDKZ5K-B6JY0Amc.js +0 -1
- package/web/assets/classDiagram-ZZMXUADV-CW-v2a7Q.js +0 -1
- package/web/assets/classDiagram-v2-JRS7N3AN-2BZHGRP2-B6JY0Amc.js +0 -1
- package/web/assets/classDiagram-v2-VYDZK3BY-CW-v2a7Q.js +0 -1
- package/web/assets/index-DpPK19Iz.css +0 -1
- package/web/assets/main-CSS_lFDP.js +0 -487
- package/web/assets/stateDiagram-v2-4QOOHH4V-LBBLA2WV-CSGIWpWK.js +0 -1
- package/web/assets/stateDiagram-v2-MP3YSRHH-Bw5j-FVB.js +0 -1
- package/web/assets/swimlanesDiagram-VK2B7HYN-E6N4H5SY-BcGn1eC6.js +0 -8
- package/web/assets/swimlanesDiagram-VR7AAH4N-BORev-1v.js +0 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r,j as h}from"./index-
|
|
1
|
+
import{r,j as h}from"./index-C8cLLejx.js";import{c as T,u as L,r as D}from"./main-D7WqSbOt.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as s,j as t}from"./index-
|
|
1
|
+
import{r as s,j as t}from"./index-C8cLLejx.js";import{c as y,u as v,b as k,L as j,F as N,M as w,G as C,T as M,d as _}from"./main-D7WqSbOt.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as G,r as v,j as c,o as ie,p as ce,c as le}from"./index-
|
|
1
|
+
import{u as G,r as v,j as c,o as ie,p as ce,c as le}from"./index-C8cLLejx.js";function A(e,t){return{code:e,message:t}}function me(e,t={}){const n=t.minSide??256,u=t.maxSide??4096,i=t.marginRatio??.02,o=t.alphaThreshold??128,r=t.minBlobAreaRatio??.05,h=t.maxSamples??1e6,l=[],g=(s,p=0,w=0)=>({ok:!1,issues:s.map(([T,C])=>A(T,C)),opaqueRatio:p,blobCount:w}),{width:a,height:m,rgba:b}=e;if(!Number.isFinite(a)||!Number.isFinite(m)||a<=0||m<=0||!Number.isInteger(a)||!Number.isInteger(m))return g([["BAD_DIMENSIONS",`非法尺寸 ${a}x${m}`]]);if(Math.min(a,m)<n&&l.push(A("TOO_SMALL",`短边 ${Math.min(a,m)}px < ${n}px`)),Math.max(a,m)>u&&l.push(A("TOO_LARGE",`长边 ${Math.max(a,m)}px > ${u}px(导入时自动缩放)`)),!b||b.length!==a*m*4)return l.push(A("BAD_PIXEL_BUFFER",`rgba 长度 ${(b==null?void 0:b.length)??0} ≠ ${a}*${m}*4`)),{ok:!1,issues:l,opaqueRatio:0,blobCount:0};const x=Math.max(1,Math.ceil(Math.sqrt(a*m/h))),d=Math.floor((a-1)/x)+1,f=Math.floor((m-1)/x)+1,y=new Uint8Array(d*f);let L=0,M=0,N=255,S=d,R=-1,k=f,Y=-1;for(let s=0;s<f;s++){const p=s*x;for(let w=0;w<d;w++){const T=w*x,C=b[(p*a+T)*4+3];M++,C<N&&(N=C),C>=o&&(y[s*d+w]=1,L++,w<S&&(S=w),w>R&&(R=w),s<k&&(k=s),s>Y&&(Y=s))}}const J=M>0?L/M:0;if(L===0)return l.push(A("ALL_TRANSPARENT","整图无不透明像素(空图/坏抠图)")),{ok:l.length===0,issues:l,opaqueRatio:J,blobCount:0};if(N===255&&l.push(A("NO_ALPHA","未检出任何透明像素——需要透明底 PNG(可一键抠图/豆包抠图)")),S===0||k===0||R===d-1||Y===f-1){const s=a*i,p=m*i;(S*x<s||k*x<p||R*x+x-1>a-1-s||Y*x+x-1>m-1-p)&&l.push(A("EDGE_TOUCH","主体贴边——四周留 5~10% 空白,给跳跃/挤压变换留余地"))}const _=new Uint8Array(d*f),B=[],$=[];for(let s=0;s<y.length;s++){if(!y[s]||_[s])continue;let p=0,w=d,T=-1,C=f,O=-1;for($.push(s),_[s]=1;$.length>0;){const E=$.pop();p++;const P=E%d,X=(E-P)/d;P<w&&(w=P),P>T&&(T=P),X<C&&(C=X),X>O&&(O=X);const D=I=>{y[I]&&!_[I]&&(_[I]=1,$.push(I))};P>0&&D(E-1),P<d-1&&D(E+1),X>0&&D(E-d),X<f-1&&D(E+d)}B.push({area:p,minX:w,maxX:T,minY:C,maxY:O})}const se=B.length>0?Math.max(...B.map(s=>s.area)):0,Z=B.filter(s=>s.area>=se*r),re=(s,p)=>s.minX>=p.minX&&s.maxX<=p.maxX&&s.minY>=p.minY&&s.maxY<=p.maxY,oe=(s,p)=>{const w=Math.min(s.maxX,p.maxX)-Math.max(s.minX,p.minX),T=Math.min(s.maxY,p.maxY)-Math.max(s.minY,p.minY);if(w<=0||T<=0)return 0;const C=w*T,O=(s.maxX-s.minX+1)*(s.maxY-s.minY+1),E=(p.maxX-p.minX+1)*(p.maxY-p.minY+1);return C/Math.min(O,E)},F=Z.filter(s=>!Z.some(p=>p!==s&&p.area>=s.area&&(re(s,p)||oe(s,p)>=.4))).length;return F>=2&&l.push(A("MULTI_BLOB",`检出 ${F} 个独立主体——请裁剪到单角色`)),{ok:l.length===0,issues:l,opaqueRatio:J,blobCount:F}}function de(e){return typeof e.poseHoldMs=="number"?e.poseHoldMs:1200}const ue=""+new URL("alien-idle-D2VKjYsl.png",import.meta.url).href,fe=""+new URL("alien-happy-Ci3JfpxD.png",import.meta.url).href,he=""+new URL("alien-thinking-gWKA2xDz.png",import.meta.url).href,pe=""+new URL("alien-keyL-C_tZriGQ.png",import.meta.url).href,xe=""+new URL("alien-keyL-C_tZriGQ.png",import.meta.url).href,z=""+new URL("alien-head-CS10QxqG.png",import.meta.url).href,be=""+new URL("alien-body-DXq5WJRs.png",import.meta.url).href,j={head:{x:.3,y:.05,w:.4,h:.2726},body:{x:.3,y:.3226,w:.4,h:.2841}},ee={x:.5,y:.3226},ye={formatVersion:1,id:"lab-alien",name:"Lab 小宇航员(Kenney)",author:"Kenney",license:"CC0-1.0 (Kenney Platformer Characters)",tier:"bongo",states:{idle:"idle.png",keyL:"keyl.png",keyR:"keyr.png",happy:"happy.png",thinking:"thinking.png"},poseHoldMs:1100};async function ge(){const e={idle:ue,keyL:pe,keyR:xe,happy:fe,thinking:he},t=await we(z),n=document.createElement("canvas");n.width=512,n.height=512;const u=n.getContext("2d");u.drawImage(t,0,0);const i=u.getImageData(0,0,512,512),o=me({width:512,height:512,rgba:i.data});return{srcs:e,parts:{head:z,body:be},selfSpec:o}}function we(e){return new Promise((t,n)=>{const u=new Image;u.onload=()=>t(u),u.onerror=()=>n(new Error(`image load failed: ${e}`)),u.src=e})}function te(e,t,n){const{x:u,y:i,w:o,h:r,t:h,deform:l}=n,g=n.cols??6,a=n.rows??8,m=n.src??{x:0,y:0,w:t.width,h:t.height},b=[];for(let d=0;d<=a;d++)for(let f=0;f<=g;f++){const y=f/g,L=d/a,M=l(y,L,h);b.push([u+y*o+M.dx,i+L*r+M.dy])}const x=(d,f)=>b[f*(g+1)+d];for(let d=0;d<a;d++)for(let f=0;f<g;f++){const y=x(f,d),L=x(f+1,d),M=x(f,d+1),N=x(f+1,d+1),S=m.x+f/g*m.w,R=m.y+d/a*m.h,k=m.x+(f+1)/g*m.w,Y=m.y+(d+1)/a*m.h;ne(e,t,[S,R],[k,R],[S,Y],y,L,M),ne(e,t,[k,R],[k,Y],[S,Y],L,N,M)}}function ne(e,t,n,u,i,o,r,h){const l=(u[0]-n[0])*(i[1]-n[1])-(i[0]-n[0])*(u[1]-n[1]);if(Math.abs(l)<1e-8)return;const g=((r[0]-o[0])*(i[1]-n[1])-(h[0]-o[0])*(u[1]-n[1]))/l,a=((h[0]-o[0])*(u[0]-n[0])-(r[0]-o[0])*(i[0]-n[0]))/l,m=((r[1]-o[1])*(i[1]-n[1])-(h[1]-o[1])*(u[1]-n[1]))/l,b=((h[1]-o[1])*(u[0]-n[0])-(r[1]-o[1])*(i[0]-n[0]))/l,x=o[0]-g*n[0]-a*n[1],d=o[1]-m*n[0]-b*n[1];e.save(),e.beginPath(),e.moveTo(o[0],o[1]),e.lineTo(r[0],r[1]),e.lineTo(h[0],h[1]),e.closePath(),e.clip(),e.transform(g,m,a,b,x,d),e.drawImage(t,0,0),e.restore()}function K(e){const t=v.useRef(e);t.current=e,v.useEffect(()=>{const n={side:1},u=r=>{if(r.repeat)return;const h=ce(r.code,n.side);n.side=n.side===1?-1:1,t.current(h===1?"keyR":"keyL")},i=r=>t.current(r.detail?"thinking":"idle"),o=ie(r=>t.current(r.kind==="wrong"?"wrong":"happy"));return window.addEventListener("keydown",u,{passive:!0}),window.addEventListener("companion-streaming",i),()=>{window.removeEventListener("keydown",u),window.removeEventListener("companion-streaming",i),o()}},[])}function H(){const[e,t]=v.useState("idle"),n=v.useRef(null),u=v.useCallback((i,o=0)=>{n.current!==null&&window.clearTimeout(n.current),n.current=null,t(i);const r=o>0?o:0;r>0&&i!=="idle"&&(n.current=window.setTimeout(()=>t("idle"),r))},[]);return v.useEffect(()=>()=>{n.current!==null&&window.clearTimeout(n.current)},[]),{pose:e,setTimed:u}}function Q(e,t){t||!e||typeof e.animate!="function"||e.animate([{transform:"translateY(0)"},{transform:"translateY(-12%)"},{transform:"translateY(2%)"},{transform:"translateY(0)"}],{duration:380,easing:"cubic-bezier(0.2, 1.4, 0.4, 1)"})}function V(e,t){t||!e||typeof e.animate!="function"||e.animate([{transform:"rotate(0deg)"},{transform:"rotate(-6deg)"},{transform:"rotate(6deg)"},{transform:"rotate(0deg)"}],{duration:280})}function q(e,t){t||!e||typeof e.animate!="function"||e.animate([{transform:"translateY(0px) scale(1, 1)"},{transform:"translateY(2.5px) scale(1.045, 0.93)",offset:.42},{transform:"translateY(0px) scale(1, 1)"}],{duration:185,easing:"ease-out",composite:"add"})}const W=`
|
|
2
2
|
.cbot { position: relative; display: inline-block; line-height: 0;
|
|
3
3
|
animation: cbot-breath 3.4s ease-in-out infinite; transform-origin: 50% 62%; }
|
|
4
4
|
.cbot img, .cbot canvas { display: block; user-select: none; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,j as t}from"./index-
|
|
1
|
+
import{r as u,j as t}from"./index-C8cLLejx.js";import{c as C,U as I,u as y,a as L,d as S,X as N,B as M,T as E,C as R}from"./main-D7WqSbOt.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,h as U,j as e,c as ie}from"./index-
|
|
1
|
+
import{r as o,h as U,j as e,c as ie}from"./index-C8cLLejx.js";import{c as te,u as ce,a as j,m as de,T as z,p as Y,A as q,L as V,q as oe,X as xe}from"./main-D7WqSbOt.js";import{R as G}from"./rotate-ccw-BS0Lg3XV.js";/**
|
|
2
2
|
* @license lucide-react v0.468.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -8,4 +8,4 @@ import{r as o,h as U,j as e,c as ie}from"./index-DpUqsNSC.js";import{c as te,u a
|
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const ue=te("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);function _(r,c=4){const l=(r.match(/[\u2E80-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/g)??[]).length,u=(r.match(/[A-Za-z]+/g)??[]).length;let f=45+Math.ceil(l/5)+Math.ceil(u/3)+Math.max(0,c)*8;return r.includes("```")&&(f+=25),/\$\$?[^$\n]+\$\$?/.test(r)&&(f+=25),Math.max(60,Math.min(300,Math.round(f)))}function fe(r){let c=2166136261;for(let l=0;l<r.length;l++)c^=r.charCodeAt(l),c=Math.imul(c,16777619);return c>>>0}function he(r){let c=r>>>0;return()=>{c|=0,c=c+1831565813|0;let l=Math.imul(c^c>>>15,1|c);return l=l+Math.imul(l^l>>>7,61|l)^l,((l^l>>>14)>>>0)/4294967296}}function ee(r,c){const l=Array.from({length:r},(u,f)=>f);for(let u=r-1;u>0;u--){const f=Math.floor(c()*(u+1)),a=l[u];l[u]=l[f],l[f]=a}return l}function be(r,c){const l=he(fe(c)),u=ee(r.length,l),f={};for(const a of r)f[a.id]=ee(Math.max(1,a.optionCount),l);return{questionOrder:u,optionPerms:f}}function ge(r,c){const l=r[c];return String(l??c)}function pe({stars:r}){return e.jsx("div",{className:"flex gap-1","aria-label":`${r} stars`,children:[1,2,3].map(c=>e.jsx(me,{className:`w-7 h-7 ${c<=r?"text-gold fill-gold":"text-ink/20"}`},c))})}function Ne({examNode:r,locale:c,onExamCompleted:l,onSessionChange:u,paused:f}){const a=ce(),[x,m]=o.useState("loading"),[g,S]=o.useState(null),[N,E]=o.useState([]),[C,se]=o.useState(null),[w,K]=o.useState(0),[v,L]=o.useState(null),[p,M]=o.useState(null),[ae,y]=o.useState(""),[R,I]=o.useState(0),[W,P]=o.useState(null),F=o.useRef({}),A=o.useRef(null),T=o.useRef(null),X=o.useRef(null),h=C?N[C.questionOrder[w]]??null:null,Z=h&&C?C.optionPerms[h.id]??[]:[],Q=(h==null?void 0:h.options)??[],O=Z.length===Q.length?Z:Q.map((n,t)=>t);o.useEffect(()=>(U(!0),()=>U(!1)),[]),o.useEffect(()=>{let n=!1;return m("loading"),y(""),M(null),S(null),(async()=>{try{const t=await j.examGetStatus(r.id);if(n)return;S(t),E(t.exercises),t.status==="generating"?m("generating"):t.status==="failed"?(y(t.error??a("exam.errorEmpty")),m("failed")):t.status==="ready"?t.latestAttempt&&t.latestAttempt.finishedAt?(M({correctCount:t.latestAttempt.correctCount,totalCount:t.latestAttempt.totalCount,stars:t.latestAttempt.stars,bestStars:t.bestStars,terminated:t.latestAttempt.terminated,perQuestion:t.latestAttempt.perQuestion??[]}),m("result")):m("ready"):(m("generating"),j.examPrepare(r.id,c??null).catch(()=>{}))}catch(t){n||(y(t instanceof Error?t.message:String(t)),m("failed"))}})(),()=>{n=!0}},[r.id]),o.useEffect(()=>j.on("exam:status",t=>{t.nodeId===r.id&&(t.status==="ready"?j.examGetStatus(r.id).then(d=>{S(d),E(d.exercises),m(s=>s==="generating"?d.latestAttempt?"result":"ready":s)}).catch(()=>{}):t.status==="failed"?(y(t.error??a("exam.errorEmpty")),m("failed")):(S(d=>d&&{...d,...t}),m(d=>d==="loading"?"generating":d)))}),[r.id]);const D=o.useCallback(async()=>{var n,t,d;try{const s=await j.examStartAttempt(r.id),i=be(s.exercises.map(b=>{var k;return{id:b.id,optionCount:((k=b.options)==null?void 0:k.length)??0}}),s.attemptId);E(s.exercises),A.current=s.attemptId,se(i),F.current={},K(0),L(null),M(null),T.current=null,m("answering"),I(_(((n=s.exercises[i.questionOrder[0]])==null?void 0:n.prompt)??"",((d=(t=s.exercises[i.questionOrder[0]])==null?void 0:t.options)==null?void 0:d.length)??4))}catch(s){y(s instanceof Error?s.message:String(s)),m("failed")}},[r.id]),ne=o.useCallback(()=>{P(null),M(null),m("generating"),S(n=>n&&{...n,status:"generating",done:0,total:0}),j.examRegenerate(r.id,c??null).then(n=>{n.status==="failed"&&(y(n.error??a("exam.errorEmpty")),m("failed"))}).catch(n=>{y(n instanceof Error?n.message:String(n)),m("failed")})},[r.id,c,a]),H=e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn-3d-neutral px-4 py-1.5 text-body","data-testid":"exam-regen-btn",onClick:n=>P(n.currentTarget.getBoundingClientRect()),children:[e.jsx(G,{className:"w-3.5 h-3.5 inline"}),a("exam.regenerate")]}),W&&e.jsx(de,{anchorRect:W,message:a("exam.regenerate.confirmMsg"),confirmLabel:a("exam.regenerate"),onConfirm:ne,onCancel:()=>P(null)})]});o.useEffect(()=>{var n,t;x!=="answering"||!h||T.current!==h.id&&(I(_(h.prompt,((n=h.options)==null?void 0:n.length)??4)),L(null),(t=X.current)==null||t.scrollTo({top:0}))},[w,x]),o.useEffect(()=>{if(x!=="answering"||f)return;const n=setInterval(()=>{I(t=>t>0?t-1:0)},1e3);return()=>clearInterval(n)},[x,f]);const B=o.useCallback(n=>{const t=h;if(!t||x!=="answering"||T.current===t.id)return;T.current=t.id;const d=n===null?"":ge(O,n),s={...F.current,[t.id]:d};F.current=s,A.current&&j.examRecordAnswer(r.id,A.current,t.id,d).catch(()=>{}),w+1<N.length?K(w+1):(m("submitting"),(async()=>{try{const i=await j.examSubmitAttempt(r.id,A.current,s);M({correctCount:i.correctCount,totalCount:i.totalCount,stars:i.stars,bestStars:i.bestStars,terminated:i.terminated,perQuestion:i.perQuestion}),m("result"),l==null||l(),i.stars>=1&&ie("exam-pass")}catch(i){y(i instanceof Error?i.message:String(i)),m("failed")}})())},[h,x,O,w,N.length,r.id,l]),re=o.useCallback(()=>{v!==null&&B(v)},[v,B]);if(o.useEffect(()=>{x!=="answering"||R>0||f||B(v)},[R,x,f]),o.useEffect(()=>{const n=async()=>{if(A.current)try{await j.examSubmitAttempt(r.id,A.current,F.current,{terminated:!0}),l==null||l()}catch{}},t=x==="answering"||x==="submitting";return u==null||u(t?{active:!0,terminate:n}:{active:!1,terminate:null}),()=>u==null?void 0:u({active:!1,terminate:null})},[x,r.id,l,u]),x==="loading")return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-loading",children:[e.jsx(z,{className:"w-12 h-12 text-accent mb-4 opacity-60"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"})]})]});if(x==="generating"){const n=(g==null?void 0:g.done)??0,t=(g==null?void 0:g.total)??0,d=t>0?Math.round(n/t*100):0;return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-generating",children:[e.jsx(z,{className:"w-12 h-12 text-accent mb-4 opacity-60"}),e.jsx("div",{className:"text-title font-bold text-ink mb-2",children:a("exam.generating.title")}),e.jsx("div",{className:"text-body text-ink-muted mb-4",children:a("exam.generating.stage")}),e.jsx("div",{className:"w-56 h-2.5 rounded-full bg-ink/10 overflow-hidden mb-2",role:"progressbar","aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:"h-full rounded-full bg-brand transition-all duration-500",style:{width:`${Math.max(4,d)}%`}})}),e.jsx("div",{className:"text-label text-ink-muted tabular-nums mb-6",children:t>0?a("exam.generating.kcProgress",{done:n,total:t}):a("exam.generating.preparing")}),e.jsx("div",{className:"text-caption text-ink-muted max-w-xs text-center",children:a("exam.generating.canLeave")})]})}if(x==="failed")return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center","data-testid":"exam-error",children:[e.jsx(Y,{className:"w-10 h-10 text-warning mb-3"}),e.jsx("div",{className:"text-body font-bold text-ink mb-1",children:a("exam.errorTitle")}),e.jsx("div",{className:"text-body text-ink-muted mb-4 max-w-xs break-words",children:ae||a("exam.errorEmpty")}),e.jsxs("button",{className:"btn-3d-brand px-4 py-1.5 text-body",onClick:()=>{m("generating"),j.examPrepare(r.id,c??null).catch(()=>{})},children:[e.jsx(G,{className:"w-3.5 h-3.5 inline"}),a("exam.failed.retry")]})]});if(x==="ready"&&g){const n=g.exercises.reduce((d,s)=>{var i;return d+_(s.prompt,((i=s.options)==null?void 0:i.length)??4)},0),t=Math.max(1,Math.round(n/60));return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-ready",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-brand/15 flex items-center justify-center mb-4",children:e.jsx(z,{className:"w-7 h-7 text-brand"})}),e.jsx("div",{className:"text-hero font-extrabold text-ink mb-1",children:a("exam.ready.title")}),e.jsx("div",{className:"text-body text-ink-muted mb-3 text-center",children:r.title}),e.jsx("div",{className:"text-label text-ink-muted mb-8",children:a("exam.ready.meta",{q:g.questionCount,kc:g.kcCount,min:t})}),e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsxs("button",{className:"btn-3d-brand px-6 py-2 text-lead",onClick:D,"data-testid":"exam-start-btn",children:[a("exam.start"),e.jsx(q,{className:"w-4 h-4 inline ml-1"})]}),H]})]})}if(x==="answering"||x==="submitting"){if(!h)return null;const n=R<=10;return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0","data-testid":"exam-answering",children:[e.jsxs("div",{className:"px-6 pt-6 w-full max-w-2xl mx-auto shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-label text-ink-muted tabular-nums",children:a("exam.q.progress",{i:w+1,n:N.length})}),e.jsxs("div",{className:`flex items-center gap-1 text-label font-bold tabular-nums transition-colors ${n?"text-warning":"text-ink"}`,"data-testid":"exam-timer",children:[e.jsx(ue,{className:"w-3.5 h-3.5"}),Math.floor(R/60),":",String(R%60).padStart(2,"0")]})]}),e.jsx("div",{className:"w-full h-1.5 rounded-full bg-ink/10 overflow-hidden mb-6",children:e.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${w/N.length*100}%`}})})]}),e.jsxs("div",{ref:X,className:"flex-1 min-h-0 overflow-y-auto px-6 pb-6 w-full max-w-2xl mx-auto",children:[h.kcTitle&&e.jsxs("div",{className:"inline-flex items-center gap-1 text-caption text-accent bg-accent/10 rounded-full px-2.5 py-1 mb-3 self-start",children:[e.jsx(V,{className:"w-3 h-3"}),h.kcTitle]}),e.jsx("div",{className:"text-lead text-ink leading-relaxed mb-6 whitespace-pre-wrap break-words",children:h.prompt}),e.jsx("div",{className:"flex flex-col gap-2.5",children:O.map((t,d)=>e.jsx("button",{onClick:()=>L(d),"data-testid":`exam-option-${d}`,className:`text-left px-4 py-3 rounded-xl border transition-all duration-150 ${v===d?"border-accent bg-accent/15 text-ink":"border-ink/10 bg-ink/5 text-ink hover:border-ink/25"}`,children:e.jsx("span",{className:"text-body break-words",children:Q[t]})},t))}),e.jsx("div",{className:"mt-6 flex justify-end",children:x==="submitting"?e.jsx("div",{className:"text-body text-ink-muted",children:a("exam.submitting")}):e.jsxs("button",{className:"btn-3d-brand px-5 py-2 text-body disabled:opacity-40 disabled:cursor-not-allowed",disabled:v===null,onClick:re,"data-testid":"exam-next-btn",children:[w+1<N.length?a("exam.q.next"):a("exam.q.submit"),e.jsx(q,{className:"w-3.5 h-3.5 inline ml-1"})]})})]})]})}if(x==="result"&&p){const n=p.totalCount>0?Math.round(p.correctCount/p.totalCount*100):0,t=new Map;for(const s of p.perQuestion){const i=s.kcTitle??"";if(!i)continue;const b=t.get(i)??{correct:0,total:0};b.total++,s.correct&&b.correct++,t.set(i,b)}const d=new Map(N.map(s=>[s.id,s]));return e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-8 max-w-2xl w-full mx-auto","data-testid":"exam-result",children:[e.jsxs("div",{className:"flex flex-col items-center mb-6",children:[e.jsx(pe,{stars:p.stars}),e.jsx("div",{className:"text-hero font-extrabold text-ink mt-3",children:a("exam.result.score",{correct:p.correctCount,total:p.totalCount})}),e.jsx("div",{className:"text-body text-ink-muted mt-1",children:a("exam.result.accuracy",{pct:n})}),e.jsxs("div",{className:"flex items-center gap-3 text-label text-ink-muted mt-2",children:[e.jsx("span",{children:a("exam.result.best",{stars:p.bestStars})}),g&&g.attemptCount>1&&e.jsx("span",{children:a("exam.result.attempts",{n:g.attemptCount})})]})]}),p.terminated&&e.jsxs("div",{className:"rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 mb-6 flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4 text-warning shrink-0"}),e.jsx("span",{className:"text-body text-ink",children:a("exam.terminated.banner")})]}),t.size>0&&e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"text-title font-bold text-ink mb-3",children:a("exam.result.kcBreakdown")}),e.jsx("div",{className:"flex flex-col gap-2",children:[...t.entries()].map(([s,i])=>{const k=(i.total>0?i.correct/i.total:0)<.6;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 rounded-xl bg-ink/5","data-testid":"exam-kc-row",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-accent shrink-0"}),e.jsx("span",{className:"text-body text-ink truncate",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[k&&e.jsx("span",{className:"text-caption text-warning",children:a("exam.result.weakKc")}),e.jsxs("span",{className:"text-label text-ink-muted tabular-nums",children:[i.correct,"/",i.total]})]})]},s)})})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"text-title font-bold text-ink mb-3",children:a("exam.result.review")}),e.jsx("div",{className:"flex flex-col gap-2",children:p.perQuestion.map((s,i)=>{const b=d.get(s.exerciseId),k=s.options??(b==null?void 0:b.options)??null,le=s.prompt??(b==null?void 0:b.prompt)??`#${i+1}`,J=$=>k&&$!==""&&k[Number($)]!==void 0?k[Number($)]:$;return e.jsx("div",{className:"px-4 py-3 rounded-xl bg-ink/5","data-testid":"exam-review-row",children:e.jsxs("div",{className:"flex items-start gap-2",children:[s.correct?e.jsx(oe,{className:"w-4 h-4 text-brand shrink-0 mt-0.5"}):e.jsx(xe,{className:`w-4 h-4 shrink-0 mt-0.5 ${s.answered?"text-warning":"text-ink-muted"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-body text-ink mb-1",children:le}),e.jsx("div",{className:"text-caption text-ink-muted",children:s.answered?s.correct?e.jsx("span",{className:"text-brand",children:a("exam.result.correctLabel")}):e.jsxs(e.Fragment,{children:[a("exam.result.yourAnswer"),":",J(s.userAnswer),e.jsx("span",{className:"mx-1",children:"·"}),a("exam.result.correctAnswer"),":",J(s.correctAnswer)]}):a("exam.result.unanswered")}),s.explanation&&e.jsx("div",{className:"text-caption text-ink-muted mt-1 leading-relaxed",children:s.explanation})]})]})},s.exerciseId)})})]}),e.jsxs("div",{className:"flex justify-center items-center gap-3 pb-4",children:[e.jsxs("button",{className:"btn-3d-brand px-5 py-2 text-body",onClick:D,"data-testid":"exam-retry-btn",children:[e.jsx(G,{className:"w-3.5 h-3.5 inline"}),a("exam.retryExam")]}),H]})]})}return null}export{Ne as ExamView};
|
|
11
|
+
*/const ue=te("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);function _(r,c=4){const l=(r.match(/[\u2E80-\u9FFF\uF900-\uFAFF\uFF00-\uFFEF]/g)??[]).length,u=(r.match(/[A-Za-z]+/g)??[]).length;let f=45+Math.ceil(l/5)+Math.ceil(u/3)+Math.max(0,c)*8;return r.includes("```")&&(f+=25),/\$\$?[^$\n]+\$\$?/.test(r)&&(f+=25),Math.max(60,Math.min(300,Math.round(f)))}function fe(r){let c=2166136261;for(let l=0;l<r.length;l++)c^=r.charCodeAt(l),c=Math.imul(c,16777619);return c>>>0}function he(r){let c=r>>>0;return()=>{c|=0,c=c+1831565813|0;let l=Math.imul(c^c>>>15,1|c);return l=l+Math.imul(l^l>>>7,61|l)^l,((l^l>>>14)>>>0)/4294967296}}function ee(r,c){const l=Array.from({length:r},(u,f)=>f);for(let u=r-1;u>0;u--){const f=Math.floor(c()*(u+1)),a=l[u];l[u]=l[f],l[f]=a}return l}function be(r,c){const l=he(fe(c)),u=ee(r.length,l),f={};for(const a of r)f[a.id]=ee(Math.max(1,a.optionCount),l);return{questionOrder:u,optionPerms:f}}function ge(r,c){const l=r[c];return String(l??c)}function pe({stars:r}){return e.jsx("div",{className:"flex gap-1","aria-label":`${r} stars`,children:[1,2,3].map(c=>e.jsx(me,{className:`w-7 h-7 ${c<=r?"text-gold fill-gold":"text-ink/20"}`},c))})}function ke({examNode:r,locale:c,onExamCompleted:l,onSessionChange:u,paused:f}){const a=ce(),[x,m]=o.useState("loading"),[g,S]=o.useState(null),[N,E]=o.useState([]),[C,se]=o.useState(null),[w,K]=o.useState(0),[v,L]=o.useState(null),[p,M]=o.useState(null),[ae,y]=o.useState(""),[R,I]=o.useState(0),[W,P]=o.useState(null),F=o.useRef({}),A=o.useRef(null),T=o.useRef(null),X=o.useRef(null),h=C?N[C.questionOrder[w]]??null:null,Z=h&&C?C.optionPerms[h.id]??[]:[],Q=(h==null?void 0:h.options)??[],O=Z.length===Q.length?Z:Q.map((n,t)=>t);o.useEffect(()=>(U(!0),()=>U(!1)),[]),o.useEffect(()=>{let n=!1;return m("loading"),y(""),M(null),S(null),(async()=>{try{const t=await j.examGetStatus(r.id);if(n)return;S(t),E(t.exercises),t.status==="generating"?m("generating"):t.status==="failed"?(y(t.error??a("exam.errorEmpty")),m("failed")):t.status==="ready"?t.latestAttempt&&t.latestAttempt.finishedAt?(M({correctCount:t.latestAttempt.correctCount,totalCount:t.latestAttempt.totalCount,stars:t.latestAttempt.stars,bestStars:t.bestStars,terminated:t.latestAttempt.terminated,perQuestion:t.latestAttempt.perQuestion??[]}),m("result")):m("ready"):(m("generating"),j.examPrepare(r.id,c??null).catch(()=>{}))}catch(t){n||(y(t instanceof Error?t.message:String(t)),m("failed"))}})(),()=>{n=!0}},[r.id]),o.useEffect(()=>j.on("exam:status",t=>{t.nodeId===r.id&&(t.status==="ready"?j.examGetStatus(r.id).then(d=>{S(d),E(d.exercises),m(s=>s==="generating"?d.latestAttempt?"result":"ready":s)}).catch(()=>{}):t.status==="failed"?(y(t.error??a("exam.errorEmpty")),m("failed")):(S(d=>d&&{...d,...t}),m(d=>d==="loading"?"generating":d)))}),[r.id]);const D=o.useCallback(async()=>{var n,t,d;try{const s=await j.examStartAttempt(r.id),i=be(s.exercises.map(b=>{var k;return{id:b.id,optionCount:((k=b.options)==null?void 0:k.length)??0}}),s.attemptId);E(s.exercises),A.current=s.attemptId,se(i),F.current={},K(0),L(null),M(null),T.current=null,m("answering"),I(_(((n=s.exercises[i.questionOrder[0]])==null?void 0:n.prompt)??"",((d=(t=s.exercises[i.questionOrder[0]])==null?void 0:t.options)==null?void 0:d.length)??4))}catch(s){y(s instanceof Error?s.message:String(s)),m("failed")}},[r.id]),ne=o.useCallback(()=>{P(null),M(null),m("generating"),S(n=>n&&{...n,status:"generating",done:0,total:0}),j.examRegenerate(r.id,c??null).then(n=>{n.status==="failed"&&(y(n.error??a("exam.errorEmpty")),m("failed"))}).catch(n=>{y(n instanceof Error?n.message:String(n)),m("failed")})},[r.id,c,a]),H=e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn-3d-neutral px-4 py-1.5 text-body","data-testid":"exam-regen-btn",onClick:n=>P(n.currentTarget.getBoundingClientRect()),children:[e.jsx(G,{className:"w-3.5 h-3.5 inline"}),a("exam.regenerate")]}),W&&e.jsx(de,{anchorRect:W,message:a("exam.regenerate.confirmMsg"),confirmLabel:a("exam.regenerate"),onConfirm:ne,onCancel:()=>P(null)})]});o.useEffect(()=>{var n,t;x!=="answering"||!h||T.current!==h.id&&(I(_(h.prompt,((n=h.options)==null?void 0:n.length)??4)),L(null),(t=X.current)==null||t.scrollTo({top:0}))},[w,x]),o.useEffect(()=>{if(x!=="answering"||f)return;const n=setInterval(()=>{I(t=>t>0?t-1:0)},1e3);return()=>clearInterval(n)},[x,f]);const B=o.useCallback(n=>{const t=h;if(!t||x!=="answering"||T.current===t.id)return;T.current=t.id;const d=n===null?"":ge(O,n),s={...F.current,[t.id]:d};F.current=s,A.current&&j.examRecordAnswer(r.id,A.current,t.id,d).catch(()=>{}),w+1<N.length?K(w+1):(m("submitting"),(async()=>{try{const i=await j.examSubmitAttempt(r.id,A.current,s);M({correctCount:i.correctCount,totalCount:i.totalCount,stars:i.stars,bestStars:i.bestStars,terminated:i.terminated,perQuestion:i.perQuestion}),m("result"),l==null||l(),i.stars>=1&&ie("exam-pass")}catch(i){y(i instanceof Error?i.message:String(i)),m("failed")}})())},[h,x,O,w,N.length,r.id,l]),re=o.useCallback(()=>{v!==null&&B(v)},[v,B]);if(o.useEffect(()=>{x!=="answering"||R>0||f||B(v)},[R,x,f]),o.useEffect(()=>{const n=async()=>{if(A.current)try{await j.examSubmitAttempt(r.id,A.current,F.current,{terminated:!0}),l==null||l()}catch{}},t=x==="answering"||x==="submitting";return u==null||u(t?{active:!0,terminate:n}:{active:!1,terminate:null}),()=>u==null?void 0:u({active:!1,terminate:null})},[x,r.id,l,u]),x==="loading")return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-loading",children:[e.jsx(z,{className:"w-12 h-12 text-accent mb-4 opacity-60"}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"})]})]});if(x==="generating"){const n=(g==null?void 0:g.done)??0,t=(g==null?void 0:g.total)??0,d=t>0?Math.round(n/t*100):0;return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-generating",children:[e.jsx(z,{className:"w-12 h-12 text-accent mb-4 opacity-60"}),e.jsx("div",{className:"text-title font-bold text-ink mb-2",children:a("exam.generating.title")}),e.jsx("div",{className:"text-body text-ink-muted mb-4",children:a("exam.generating.stage")}),e.jsx("div",{className:"w-56 h-2.5 rounded-full bg-ink/10 overflow-hidden mb-2",role:"progressbar","aria-valuenow":d,"aria-valuemin":0,"aria-valuemax":100,children:e.jsx("div",{className:"h-full rounded-full bg-brand transition-all duration-500",style:{width:`${Math.max(4,d)}%`}})}),e.jsx("div",{className:"text-label text-ink-muted tabular-nums mb-6",children:t>0?a("exam.generating.kcProgress",{done:n,total:t}):a("exam.generating.preparing")}),e.jsx("div",{className:"text-caption text-ink-muted max-w-xs text-center",children:a("exam.generating.canLeave")})]})}if(x==="failed")return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6 text-center","data-testid":"exam-error",children:[e.jsx(Y,{className:"w-10 h-10 text-warning mb-3"}),e.jsx("div",{className:"text-body font-bold text-ink mb-1",children:a("exam.errorTitle")}),e.jsx("div",{className:"text-body text-ink-muted mb-4 max-w-xs break-words",children:ae||a("exam.errorEmpty")}),e.jsxs("button",{className:"btn-3d-brand px-4 py-1.5 text-body",onClick:()=>{m("generating"),j.examPrepare(r.id,c??null).catch(()=>{})},children:[e.jsx(G,{className:"w-3.5 h-3.5 inline"}),a("exam.failed.retry")]})]});if(x==="ready"&&g){const n=g.exercises.reduce((d,s)=>{var i;return d+_(s.prompt,((i=s.options)==null?void 0:i.length)??4)},0),t=Math.max(1,Math.round(n/60));return e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center px-6","data-testid":"exam-ready",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-brand/15 flex items-center justify-center mb-4",children:e.jsx(z,{className:"w-7 h-7 text-brand"})}),e.jsx("div",{className:"text-hero font-extrabold text-ink mb-1",children:a("exam.ready.title")}),e.jsx("div",{className:"text-body text-ink-muted mb-3 text-center",children:r.title}),e.jsx("div",{className:"text-label text-ink-muted mb-8",children:a("exam.ready.meta",{q:g.questionCount,kc:g.kcCount,min:t})}),e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsxs("button",{className:"btn-3d-brand px-6 py-2 text-lead",onClick:D,"data-testid":"exam-start-btn",children:[a("exam.start"),e.jsx(q,{className:"w-4 h-4 inline ml-1"})]}),H]})]})}if(x==="answering"||x==="submitting"){if(!h)return null;const n=R<=10;return e.jsxs("div",{className:"flex-1 flex flex-col min-h-0","data-testid":"exam-answering",children:[e.jsxs("div",{className:"px-6 pt-6 w-full max-w-2xl mx-auto shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("div",{className:"text-label text-ink-muted tabular-nums",children:a("exam.q.progress",{i:w+1,n:N.length})}),e.jsxs("div",{className:`flex items-center gap-1 text-label font-bold tabular-nums transition-colors ${n?"text-warning":"text-ink"}`,"data-testid":"exam-timer",children:[e.jsx(ue,{className:"w-3.5 h-3.5"}),Math.floor(R/60),":",String(R%60).padStart(2,"0")]})]}),e.jsx("div",{className:"w-full h-1.5 rounded-full bg-ink/10 overflow-hidden mb-6",children:e.jsx("div",{className:"h-full bg-accent transition-all duration-300",style:{width:`${w/N.length*100}%`}})})]}),e.jsxs("div",{ref:X,className:"flex-1 min-h-0 overflow-y-auto px-6 pb-6 w-full max-w-2xl mx-auto",children:[h.kcTitle&&e.jsxs("div",{className:"inline-flex items-center gap-1 text-caption text-accent bg-accent/10 rounded-full px-2.5 py-1 mb-3 self-start",children:[e.jsx(V,{className:"w-3 h-3"}),h.kcTitle]}),e.jsx("div",{className:"text-lead text-ink leading-relaxed mb-6 whitespace-pre-wrap break-words",children:h.prompt}),e.jsx("div",{className:"flex flex-col gap-2.5",children:O.map((t,d)=>e.jsx("button",{onClick:()=>L(d),"data-testid":`exam-option-${d}`,className:`text-left px-4 py-3 rounded-xl border transition-all duration-150 ${v===d?"border-accent bg-accent/15 text-ink":"border-ink/10 bg-ink/5 text-ink hover:border-ink/25"}`,children:e.jsx("span",{className:"text-body break-words",children:Q[t]})},t))}),e.jsx("div",{className:"mt-6 flex justify-end",children:x==="submitting"?e.jsx("div",{className:"text-body text-ink-muted",children:a("exam.submitting")}):e.jsxs("button",{className:"btn-3d-brand px-5 py-2 text-body disabled:opacity-40 disabled:cursor-not-allowed",disabled:v===null,onClick:re,"data-testid":"exam-next-btn",children:[w+1<N.length?a("exam.q.next"):a("exam.q.submit"),e.jsx(q,{className:"w-3.5 h-3.5 inline ml-1"})]})})]})]})}if(x==="result"&&p){const n=p.totalCount>0?Math.round(p.correctCount/p.totalCount*100):0,t=new Map;for(const s of p.perQuestion){const i=s.kcTitle??"";if(!i)continue;const b=t.get(i)??{correct:0,total:0};b.total++,s.correct&&b.correct++,t.set(i,b)}const d=new Map(N.map(s=>[s.id,s]));return e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-8 max-w-2xl w-full mx-auto","data-testid":"exam-result",children:[e.jsxs("div",{className:"flex flex-col items-center mb-6",children:[e.jsx(pe,{stars:p.stars}),e.jsx("div",{className:"text-hero font-extrabold text-ink mt-3",children:a("exam.result.score",{correct:p.correctCount,total:p.totalCount})}),e.jsx("div",{className:"text-body text-ink-muted mt-1",children:a("exam.result.accuracy",{pct:n})}),e.jsxs("div",{className:"flex items-center gap-3 text-label text-ink-muted mt-2",children:[e.jsx("span",{children:a("exam.result.best",{stars:p.bestStars})}),g&&g.attemptCount>1&&e.jsx("span",{children:a("exam.result.attempts",{n:g.attemptCount})})]})]}),p.terminated&&e.jsxs("div",{className:"rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 mb-6 flex items-center gap-2",children:[e.jsx(Y,{className:"w-4 h-4 text-warning shrink-0"}),e.jsx("span",{className:"text-body text-ink",children:a("exam.terminated.banner")})]}),t.size>0&&e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"text-title font-bold text-ink mb-3",children:a("exam.result.kcBreakdown")}),e.jsx("div",{className:"flex flex-col gap-2",children:[...t.entries()].map(([s,i])=>{const k=(i.total>0?i.correct/i.total:0)<.6;return e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 rounded-xl bg-ink/5","data-testid":"exam-kc-row",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(V,{className:"w-3.5 h-3.5 text-accent shrink-0"}),e.jsx("span",{className:"text-body text-ink truncate",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[k&&e.jsx("span",{className:"text-caption text-warning",children:a("exam.result.weakKc")}),e.jsxs("span",{className:"text-label text-ink-muted tabular-nums",children:[i.correct,"/",i.total]})]})]},s)})})]}),e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"text-title font-bold text-ink mb-3",children:a("exam.result.review")}),e.jsx("div",{className:"flex flex-col gap-2",children:p.perQuestion.map((s,i)=>{const b=d.get(s.exerciseId),k=s.options??(b==null?void 0:b.options)??null,le=s.prompt??(b==null?void 0:b.prompt)??`#${i+1}`,J=$=>k&&$!==""&&k[Number($)]!==void 0?k[Number($)]:$;return e.jsx("div",{className:"px-4 py-3 rounded-xl bg-ink/5","data-testid":"exam-review-row",children:e.jsxs("div",{className:"flex items-start gap-2",children:[s.correct?e.jsx(oe,{className:"w-4 h-4 text-brand shrink-0 mt-0.5"}):e.jsx(xe,{className:`w-4 h-4 shrink-0 mt-0.5 ${s.answered?"text-warning":"text-ink-muted"}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("div",{className:"text-body text-ink mb-1",children:le}),e.jsx("div",{className:"text-caption text-ink-muted",children:s.answered?s.correct?e.jsx("span",{className:"text-brand",children:a("exam.result.correctLabel")}):e.jsxs(e.Fragment,{children:[a("exam.result.yourAnswer"),":",J(s.userAnswer),e.jsx("span",{className:"mx-1",children:"·"}),a("exam.result.correctAnswer"),":",J(s.correctAnswer)]}):a("exam.result.unanswered")}),s.explanation&&e.jsx("div",{className:"text-caption text-ink-muted mt-1 leading-relaxed",children:s.explanation})]})]})},s.exerciseId)})})]}),e.jsxs("div",{className:"flex justify-center items-center gap-3 pb-4",children:[e.jsxs("button",{className:"btn-3d-brand px-5 py-2 text-body",onClick:D,"data-testid":"exam-retry-btn",children:[e.jsx(G,{className:"w-3.5 h-3.5 inline"}),a("exam.retryExam")]}),H]})]})}return null}export{ke as ExamView};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import{r as n,j as e}from"./index-C8cLLejx.js";import{c as L,u as I,g as T,b as G,h as F,a as c,i as H,X as q,j as K,P as O,L as V,A as X,k as J,l as Q,m as U,n as W,s as Y,o as Z}from"./main-D7WqSbOt.js";/**
|
|
2
|
+
* @license lucide-react v0.468.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ee=L("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
|
|
7
|
+
* @license lucide-react v0.468.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const te=L("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
12
|
+
* @license lucide-react v0.468.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const se=L("History",[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);function R(a,r,s){var f;if(a.mbti){const x=W(a.mbti,r);return{field:s("boot.profile.field.mbti"),value:`${a.mbti} · ${x.name}`}}if(a.name)return{field:s("boot.profile.field.name"),value:a.name};if((f=a.interests)!=null&&f.length)return{field:s("profile.field.interests"),value:a.interests.join(r==="en"?", ":"、")};if(a.freeNote)return{field:s("boot.profile.field.free"),value:a.freeNote};const p=a.style;if(p){const x=[["start","start"],["interaction","interaction"],["feedback","feedback"],["pacing","pacing"]];for(const[o]of x){const d=p[o];if(d)return{field:`${s("boot.profile.field.style")} · ${s(`profile.style.${o}`)}`,value:Y(o,d,r)}}}return null}function ie({onClose:a,onProfileSaved:r}){var E;const s=I(),f=T()==="en"?"en":"zh-CN",x=n.useRef(null);G(x,!0);const o=F(),[d,u]=n.useState(null),[k,M]=n.useState(null),[P,S]=n.useState(null),[i,N]=n.useState(null),[g,b]=n.useState(!1),[j,h]=n.useState(null),m=n.useRef(new Map);n.useEffect(()=>{const t=l=>{l.key==="Escape"&&a()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[a]);const v=n.useCallback(()=>{c.profileListProposals().then(M).catch(()=>M([]))},[]),y=n.useCallback(t=>{S(t),t&&c.memoryListAll().then(N).catch(()=>N(null))},[]);n.useEffect(()=>{c.profileGet().then(u).catch(()=>u(H())),v(),c.hasSetting("flag_memory_system").then(t=>y(t)).catch(()=>y(!1))},[v,y]);const A=n.useCallback(t=>{u(t),c.profileSet(t).then(()=>{o.show(s("profile.saved"),{duration:2500}),r==null||r()}).catch(()=>o.show(s("profile.save_failed"),{duration:3500}))},[r,o,s]),B=n.useCallback(async(t,l)=>{b(!0);try{l==="apply"?await c.applyProposal(t):await c.rejectProposal(t),v(),c.profileGet().then(u).catch(()=>{})}finally{b(!1)}},[v]),$=n.useCallback(async()=>{b(!0);try{await c.setSetting("flag_memory_system","true"),y(!0)}finally{b(!1)}},[y]),_=n.useCallback(async t=>{h(null),b(!0);try{await c.memoryDeleteSlot(t),c.memoryListAll().then(N).catch(()=>{}),o.show(s("profile.memory.deleted"),{duration:2500})}finally{b(!1)}},[o,s]),D=(k??[]).filter(t=>t.status==="pending"),w=(k??[]).filter(t=>t.status!=="pending");return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",onClick:a,"data-testid":"profile-modal",children:e.jsxs("div",{ref:x,role:"dialog","aria-modal":"true","aria-label":s("profile.title"),className:"w-[min(560px,94vw)] max-h-[86vh] rounded-2xl bg-surface-0 shadow-elevated flex flex-col",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-6 pt-6 pb-4 shrink-0",children:[e.jsx("div",{className:"text-hero font-bold text-ink",children:s("profile.title")}),e.jsxs("button",{className:"btn-3d-neutral inline-flex items-center gap-1 px-3 py-2",onClick:a,"data-testid":"profile-close",children:[e.jsx(q,{size:16}),s("action.close")]})]}),e.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto px-6 pb-6 flex flex-col gap-6",children:[e.jsxs("section",{className:"flex flex-col gap-3","data-testid":"profile-section-declared",children:[e.jsx(C,{icon:e.jsx(K,{size:16,className:"text-accent"}),label:s("profile.section.declared")}),d?e.jsx(O,{t:s,locale:f,profile:d,onSave:A,testIdPrefix:"pf"}):e.jsx("div",{className:"text-label text-ink-faint",children:"…"})]}),e.jsxs("section",{className:"flex flex-col gap-3","data-testid":"profile-section-suggestions",children:[e.jsx(C,{icon:e.jsx(V,{size:16,className:"text-accent"}),label:s("profile.section.suggestions")}),k===null?e.jsx("div",{className:"text-label text-ink-faint",children:"…"}):D.length===0?e.jsx("div",{className:"rounded-xl bg-surface-1 p-3 text-label text-ink-muted","data-testid":"profile-suggest-empty",children:s("profile.suggest.empty")}):D.map(t=>{const l=R(t.patch,f,s);return e.jsxs("div",{className:"rounded-xl border border-accent/30 bg-accent/5 p-3 flex flex-col gap-2","data-testid":"profile-suggest-card",children:[e.jsx("div",{className:"text-label text-ink leading-relaxed",children:s("profile.suggest.title",{field:(l==null?void 0:l.field)??"",value:(l==null?void 0:l.value)??""})}),t.rationale&&e.jsxs("div",{className:"text-label text-ink-muted leading-relaxed",children:[s("profile.suggest.reason"),t.rationale]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{className:"btn-3d-brand inline-flex items-center gap-1 px-3 py-2",disabled:g,onClick:()=>void B(t.id,"apply"),"data-testid":"profile-suggest-apply",children:[e.jsx(X,{size:14}),s("profile.suggest.apply",{value:(l==null?void 0:l.value)??""})]}),e.jsx("button",{className:"btn-3d-neutral px-3 py-2",disabled:g,onClick:()=>void B(t.id,"reject"),"data-testid":"profile-suggest-keep",children:s("profile.suggest.keep")})]})]},t.id)}),w.length>0&&e.jsxs("details",{className:"rounded-xl bg-surface-1 p-3","data-testid":"profile-suggest-history",children:[e.jsxs("summary",{className:"text-label font-bold text-ink cursor-pointer inline-flex items-center gap-1.5",children:[e.jsx(se,{size:14}),s("profile.suggest.history",{n:w.length})]}),e.jsx("div",{className:"mt-2 flex flex-col gap-1.5",children:w.map(t=>{const l=R(t.patch,f,s);return e.jsxs("div",{className:"text-caption text-ink-muted flex items-start gap-1.5",children:[t.status==="applied"?e.jsx(J,{size:13,className:"shrink-0 mt-0.5 text-brand"}):t.status==="rejected"?e.jsx(ee,{size:13,className:"shrink-0 mt-0.5 text-ink-faint"}):e.jsx(te,{size:13,className:"shrink-0 mt-0.5 text-ink-faint"}),e.jsxs("span",{children:[s("profile.suggest.title",{field:(l==null?void 0:l.field)??"",value:(l==null?void 0:l.value)??""}),t.rationale?` — ${t.rationale}`:""]})]},t.id)})})]})]}),e.jsxs("section",{className:"flex flex-col gap-3","data-testid":"profile-section-memory",children:[e.jsx(C,{icon:e.jsx(Q,{size:16,className:"text-accent"}),label:s("profile.section.memory")}),P===null?e.jsx("div",{className:"text-label text-ink-faint",children:"…"}):P?e.jsxs("div",{className:"flex flex-col gap-3","data-testid":"profile-memory-on",children:[e.jsx("div",{className:"text-caption text-ink-muted",children:s("profile.memory.disclaimer")}),e.jsx(z,{t:s,label:s("profile.memory.global"),items:i!=null&&i.global?[{id:i.global.id,text:i.global.summary}]:[],onAskDelete:t=>h(t),registerBtn:(t,l)=>{l?m.current.set(t,l):m.current.delete(t)},busy:g}),e.jsx(z,{t:s,label:s("profile.memory.pattern"),items:((i==null?void 0:i.patterns)??[]).map(t=>({id:t.id,text:t.summary})),onAskDelete:t=>h(t),registerBtn:(t,l)=>{l?m.current.set(t,l):m.current.delete(t)},busy:g}),e.jsx(z,{t:s,label:s("profile.memory.nodes"),items:((i==null?void 0:i.nodes)??[]).slice(0,8).map(t=>({id:t.id,text:t.summary})),extra:(((E=i==null?void 0:i.nodes)==null?void 0:E.length)??0)>8?s("profile.memory.more",{n:((i==null?void 0:i.nodes.length)??0)-8}):void 0,onAskDelete:t=>h(t),registerBtn:(t,l)=>{l?m.current.set(t,l):m.current.delete(t)},busy:g}),j&&m.current.get(j)&&e.jsx(U,{anchorRect:m.current.get(j).getBoundingClientRect(),message:s("profile.memory.confirm"),danger:!0,onConfirm:()=>void _(j),onCancel:()=>h(null),testid:"profile-memory-confirm"})]}):e.jsxs("div",{className:"rounded-xl bg-surface-1 p-4 flex flex-col gap-3","data-testid":"profile-memory-off",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-label font-bold text-ink mb-1",children:s("profile.memory.off.title")}),e.jsx("div",{className:"text-label text-ink-muted leading-relaxed",children:s("profile.memory.off.desc")})]}),e.jsx("button",{className:"btn-3d-brand self-start px-4 py-2",disabled:g,onClick:()=>void $(),"data-testid":"profile-memory-enable",children:s("profile.memory.enable")})]})]})]})]})})}function C({icon:a,label:r}){return e.jsxs("div",{className:"flex items-center gap-2 text-label font-bold text-ink",children:[a,r]})}function z({t:a,label:r,items:s,extra:p,onAskDelete:f,registerBtn:x,busy:o}){return e.jsxs("div",{className:"rounded-xl bg-surface-1 p-3 flex flex-col gap-2",children:[e.jsx("div",{className:"text-caption font-bold text-ink-faint",children:r}),s.length===0?e.jsx("div",{className:"text-caption text-ink-faint",children:a("profile.memory.empty")}):s.map(d=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("span",{className:"flex-1 text-caption text-ink-muted leading-relaxed",children:d.text}),e.jsx("button",{className:"shrink-0 p-1.5 rounded-lg text-ink-faint hover:text-warning transition-colors",disabled:o,onClick:()=>f(d.id),"aria-label":a("profile.memory.delete"),ref:u=>x(d.id,u),"data-testid":"profile-memory-delete",children:e.jsx(Z,{size:15})})]},d.id)),p&&e.jsx("div",{className:"text-caption text-ink-faint",children:p})]})}export{ie as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e,c as S}from"./index-
|
|
1
|
+
import{r as a,j as e,c as S}from"./index-C8cLLejx.js";import{u as j,a as N,S as M}from"./main-D7WqSbOt.js";function A({tree:c,onReviewNode:d,progressMap:o}){const s=j(),[l,f]=a.useState([]),[b,h]=a.useState(!0),[n,x]=a.useState(null);a.useEffect(()=>{N.getAllSrsItems().then(t=>f(t)).catch(()=>f([])).finally(()=>h(!1))},[]);const p=a.useMemo(()=>new Map(c.map(t=>[t.id,t])),[c]),g=a.useMemo(()=>new Set(l.filter(t=>t.overdue).map(t=>t.nodeId)),[l]),i=a.useMemo(()=>{const t=c.filter(u=>{var y;const m=(y=o[u.id])==null?void 0:y.status;return u.type==="lesson"&&(m==="in_progress"||m==="mastered")}),r=new Map;for(const u of t){const m=u.parentId??"(root)";r.has(m)||r.set(m,[]),r.get(m).push(u)}return r},[c,o]),w=a.useMemo(()=>Array.from(i.values()).flat().filter(t=>g.has(t.id)).length,[i,g]),v=a.useMemo(()=>Array.from(i.values()).flat(),[i]);if(a.useEffect(()=>{if(i.size>0&&(!n||!i.has(n))){const t=i.keys().next().value;t&&x(t)}},[i,n]),b)return e.jsxs("div",{className:"text-center py-12 text-body text-ink-muted flex items-center justify-center gap-2",children:[e.jsx("span",{className:"typing-dot w-1.5 h-1.5 bg-brand rounded-full inline-block"}),s("review.loading")]});if(v.length===0)return e.jsxs("div",{className:"text-center py-16","data-testid":"review-empty",children:[e.jsx("div",{className:"text-4xl mb-3 opacity-30",children:"📖"}),e.jsx("div",{className:"text-body text-ink-muted",children:s("review.empty.title")}),e.jsx("div",{className:"text-label text-ink-faint mt-1",children:s("review.empty.desc")})]});const k=t=>{var r;return((r=p.get(t))==null?void 0:r.title)??t};return e.jsxs("div",{className:"p-5 max-w-2xl mx-auto","data-testid":"review-panel",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h2",{className:"text-title font-extrabold text-ink-strong",children:s("review.title")}),w>0&&e.jsxs("span",{className:"text-label font-bold text-review","data-testid":"review-due-count",children:[w," ",s("review.due.count")]})]}),e.jsxs("button",{onClick:()=>{const t=v[Math.floor(Math.random()*v.length)];t&&d(t.id)},"data-testid":"review-interleave",className:"btn-3d-neutral w-full py-2.5 text-body mb-5 flex items-center justify-center gap-1.5",children:[e.jsx(M,{className:"w-4 h-4"}),s("review.interleave")]}),e.jsx("div",{className:"text-label font-bold text-ink-muted mb-2",children:s("review.selectSection")}),e.jsx("div",{className:"flex flex-wrap gap-1.5 mb-4",children:Array.from(i.entries()).map(([t,r])=>e.jsxs("button",{onClick:()=>x(t),className:`px-2.5 py-1 rounded-full text-label font-bold transition-colors ${n===t?"bg-brand/15 text-brand ring-1 ring-brand/30":"bg-surface-3 text-ink-muted hover:text-ink-strong"}`,children:[k(t),e.jsxs("span",{className:"ml-1 opacity-60",children:["(",r.length,")"]})]},t))}),n&&i.has(n)&&e.jsx("div",{className:"space-y-1.5","data-testid":"review-lesson-list",children:i.get(n).map(t=>{const r=g.has(t.id);return e.jsxs("div",{className:`flex items-center justify-between gap-2 p-2.5 rounded-lg transition-colors ${r?"bg-review/8 ring-1 ring-review/20":"bg-surface-3 hover:bg-surface-3/80"}`,children:[e.jsxs("div",{className:"flex items-center gap-1.5 truncate flex-1",children:[r&&e.jsx("span",{className:"shrink-0 w-1.5 h-1.5 rounded-full bg-review"}),e.jsx("span",{className:"text-body text-ink-strong truncate",children:t.title})]}),e.jsx("button",{onClick:()=>d(t.id),"data-testid":`review-lesson-${t.id.slice(0,8)}`,className:"shrink-0 px-3 py-1 rounded-lg bg-brand/15 text-brand text-label font-bold hover:bg-brand/25 transition-colors",children:s("review.reviewLesson")})]},t.id)})})]})}function E({nodeId:c,onRated:d}){const o=a.useRef(null),s=j(),[l,f]=a.useState(!1),[b,h]=a.useState(!1),n=async x=>{if(!(l||b)){f(!0);try{await N.recordReview(c,x),h(!0),d==null||d(),S(x>=4?"correct":"wrong",{origin:x>=4&&o.current?(()=>{const p=o.current.getBoundingClientRect();return{x:p.right-48,y:p.top+24}})():void 0})}catch{}finally{f(!1)}}};return b?e.jsx("div",{className:"text-center text-body text-brand py-2","data-testid":"self-rated",children:s("review.selfrated")}):e.jsxs("div",{ref:o,className:"border-t border-[var(--border-faint)] pt-3 mt-3","data-testid":"self-rating",children:[e.jsx("div",{className:"text-caption font-bold text-ink-muted uppercase tracking-wider mb-2 text-center",children:s("review.selfrate.title")}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("button",{onClick:()=>n(1),disabled:l,"data-testid":"rate-again",className:"py-2 rounded-lg border border-warning/40 text-warning hover:bg-warning/10 transition-colors disabled:opacity-40 flex flex-col items-center gap-0.5",children:[e.jsx("span",{className:"text-body font-bold",children:s("review.selfrate.again")}),e.jsx("span",{className:"text-caption opacity-70",children:s("review.selfrate.again.hint")})]}),e.jsxs("button",{onClick:()=>n(4),disabled:l,"data-testid":"rate-remembered",className:"py-2 rounded-lg border border-accent/40 text-accent hover:bg-accent/10 transition-colors disabled:opacity-40 flex flex-col items-center gap-0.5",children:[e.jsx("span",{className:"text-body font-bold",children:s("review.selfrate.remembered")}),e.jsx("span",{className:"text-caption opacity-70",children:s("review.selfrate.remembered.hint")})]}),e.jsxs("button",{onClick:()=>n(5),disabled:l,"data-testid":"rate-mastered",className:"py-2 rounded-lg border border-brand/40 text-brand hover:bg-brand/10 transition-colors disabled:opacity-40 flex flex-col items-center gap-0.5",children:[e.jsx("span",{className:"text-body font-bold",children:s("review.selfrate.mastered")}),e.jsx("span",{className:"text-caption opacity-70",children:s("review.selfrate.mastered.hint")})]})]})]})}export{A as ReviewPanel,E as SelfRatingCard};
|