@mieweb/ui 0.10.0-dev.3 → 0.10.0-dev.31
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/README.md +4 -4
- package/agent/mieweb-ui.instructions.md +90 -1
- package/dist/CsvBlock-FX5YNGNE.cjs +17 -0
- package/dist/{CsvBlock-ROJCKJDP.cjs.map → CsvBlock-FX5YNGNE.cjs.map} +1 -1
- package/dist/CsvBlock-VLMG7GUO.js +8 -0
- package/dist/{CsvBlock-UWPMTLE2.js.map → CsvBlock-VLMG7GUO.js.map} +1 -1
- package/dist/HtmlPreviewBlock-5JE7L3GR.js +8 -0
- package/dist/{HtmlPreviewBlock-ME5U3XNS.js.map → HtmlPreviewBlock-5JE7L3GR.js.map} +1 -1
- package/dist/HtmlPreviewBlock-UO37JQ3K.cjs +17 -0
- package/dist/{HtmlPreviewBlock-DWFN6EUB.cjs.map → HtmlPreviewBlock-UO37JQ3K.cjs.map} +1 -1
- package/dist/Input-yN516s5_.d.cts +3 -0
- package/dist/Input-yN516s5_.d.ts +3 -0
- package/dist/MermaidBlock-3XHFBAMV.js +8 -0
- package/dist/{MermaidBlock-2B6CPD6Y.js.map → MermaidBlock-3XHFBAMV.js.map} +1 -1
- package/dist/MermaidBlock-RZ75RPZA.cjs +17 -0
- package/dist/{MermaidBlock-D2UC5M55.cjs.map → MermaidBlock-RZ75RPZA.cjs.map} +1 -1
- package/dist/SurveyBlock-MUVJ3JUI.js +8 -0
- package/dist/{SurveyBlock-4DO62RBT.js.map → SurveyBlock-MUVJ3JUI.js.map} +1 -1
- package/dist/SurveyBlock-VH47YXZC.cjs +17 -0
- package/dist/{SurveyBlock-4CD4AYMJ.cjs.map → SurveyBlock-VH47YXZC.cjs.map} +1 -1
- package/dist/ag-grid.d.cts +142 -1
- package/dist/ag-grid.d.ts +142 -1
- package/dist/brands/bluehive.cjs +3 -3
- package/dist/brands/bluehive.css +3 -0
- package/dist/brands/bluehive.js +1 -1
- package/dist/brands/index.cjs +14 -14
- package/dist/brands/index.js +4 -4
- package/dist/{chunk-JYZW2PZS.cjs → chunk-254QK722.cjs} +7 -7
- package/dist/chunk-254QK722.cjs.map +1 -0
- package/dist/{chunk-VKELAMAZ.js → chunk-2JICT4A2.js} +27 -11
- package/dist/chunk-2JICT4A2.js.map +1 -0
- package/dist/{chunk-VPWJCJCX.cjs → chunk-35Y4ILCU.cjs} +7 -7
- package/dist/{chunk-VPWJCJCX.cjs.map → chunk-35Y4ILCU.cjs.map} +1 -1
- package/dist/{chunk-G3JX3UAU.cjs → chunk-3KPDQG5O.cjs} +5 -5
- package/dist/{chunk-G3JX3UAU.cjs.map → chunk-3KPDQG5O.cjs.map} +1 -1
- package/dist/{chunk-Y5HFM7LO.js → chunk-3RXZWHCU.js} +4 -4
- package/dist/{chunk-Y5HFM7LO.js.map → chunk-3RXZWHCU.js.map} +1 -1
- package/dist/chunk-3YBS4WUQ.js +52 -0
- package/dist/chunk-3YBS4WUQ.js.map +1 -0
- package/dist/{chunk-WNJRS7Y7.cjs → chunk-3ZWCIPFT.cjs} +4 -2
- package/dist/chunk-3ZWCIPFT.cjs.map +1 -0
- package/dist/chunk-4HC2IBOX.js +258 -0
- package/dist/chunk-4HC2IBOX.js.map +1 -0
- package/dist/chunk-4IS3QCOQ.cjs +453 -0
- package/dist/chunk-4IS3QCOQ.cjs.map +1 -0
- package/dist/chunk-4NCDU5IG.cjs +56 -0
- package/dist/chunk-4NCDU5IG.cjs.map +1 -0
- package/dist/{chunk-E4IBHYJ7.cjs → chunk-6N6LIAUJ.cjs} +9 -9
- package/dist/{chunk-E4IBHYJ7.cjs.map → chunk-6N6LIAUJ.cjs.map} +1 -1
- package/dist/{chunk-3M7TAXNR.js → chunk-6ZPTZTKN.js} +3 -3
- package/dist/{chunk-3M7TAXNR.js.map → chunk-6ZPTZTKN.js.map} +1 -1
- package/dist/{chunk-MWVW4APN.cjs → chunk-7UTBDFFL.cjs} +4 -4
- package/dist/{chunk-MWVW4APN.cjs.map → chunk-7UTBDFFL.cjs.map} +1 -1
- package/dist/{chunk-FJ7YPVKV.js → chunk-7X6R3JIA.js} +3 -3
- package/dist/{chunk-FJ7YPVKV.js.map → chunk-7X6R3JIA.js.map} +1 -1
- package/dist/{chunk-GOALNQZ2.js → chunk-7YO7DNUV.js} +4 -83
- package/dist/chunk-7YO7DNUV.js.map +1 -0
- package/dist/{chunk-P2CA3XGI.js → chunk-7ZV67VZE.js} +4 -4
- package/dist/{chunk-P2CA3XGI.js.map → chunk-7ZV67VZE.js.map} +1 -1
- package/dist/chunk-ADW7ZYCY.cjs +2707 -0
- package/dist/chunk-ADW7ZYCY.cjs.map +1 -0
- package/dist/{chunk-2G75X6TS.cjs → chunk-AHHFFXJR.cjs} +3 -3
- package/dist/{chunk-2G75X6TS.cjs.map → chunk-AHHFFXJR.cjs.map} +1 -1
- package/dist/{chunk-VILW53UZ.js → chunk-BIQ7GSO2.js} +3 -3
- package/dist/{chunk-VILW53UZ.js.map → chunk-BIQ7GSO2.js.map} +1 -1
- package/dist/chunk-BM35CACB.js +148 -0
- package/dist/chunk-BM35CACB.js.map +1 -0
- package/dist/chunk-BNH4SXJB.js +874 -0
- package/dist/chunk-BNH4SXJB.js.map +1 -0
- package/dist/{chunk-XEAT7XJG.cjs → chunk-BUT6MF5K.cjs} +29 -13
- package/dist/chunk-BUT6MF5K.cjs.map +1 -0
- package/dist/{chunk-UAMXCMST.cjs → chunk-CFI3TQMA.cjs} +3 -3
- package/dist/{chunk-UAMXCMST.cjs.map → chunk-CFI3TQMA.cjs.map} +1 -1
- package/dist/{chunk-J5CSLNCN.cjs → chunk-COM7RNZU.cjs} +2 -2
- package/dist/{chunk-J5CSLNCN.cjs.map → chunk-COM7RNZU.cjs.map} +1 -1
- package/dist/{chunk-XI34EGK5.cjs → chunk-CPPUT74P.cjs} +9 -9
- package/dist/{chunk-XI34EGK5.cjs.map → chunk-CPPUT74P.cjs.map} +1 -1
- package/dist/{chunk-ACCAXVOG.js → chunk-CRS2CQWM.js} +134 -56
- package/dist/chunk-CRS2CQWM.js.map +1 -0
- package/dist/{chunk-OE5CKRUC.js → chunk-D22GE27K.js} +4 -4
- package/dist/{chunk-OE5CKRUC.js.map → chunk-D22GE27K.js.map} +1 -1
- package/dist/chunk-DXEPYK3I.cjs +92 -0
- package/dist/chunk-DXEPYK3I.cjs.map +1 -0
- package/dist/{chunk-ZGRCSNPK.js → chunk-E2PBPQGS.js} +4 -4
- package/dist/{chunk-ZGRCSNPK.js.map → chunk-E2PBPQGS.js.map} +1 -1
- package/dist/{chunk-5JJ2DAE4.js → chunk-ENMXHZNE.js} +3 -3
- package/dist/{chunk-5JJ2DAE4.js.map → chunk-ENMXHZNE.js.map} +1 -1
- package/dist/{chunk-XCP454Q6.js → chunk-F4N67NAF.js} +12 -3
- package/dist/chunk-F4N67NAF.js.map +1 -0
- package/dist/chunk-FBCDYTWM.js +385 -0
- package/dist/chunk-FBCDYTWM.js.map +1 -0
- package/dist/{chunk-VU6UTJRM.js → chunk-FIKO4WR6.js} +3 -3
- package/dist/{chunk-VU6UTJRM.js.map → chunk-FIKO4WR6.js.map} +1 -1
- package/dist/{chunk-DEDN5HAG.js → chunk-FZURBQJ2.js} +3 -3
- package/dist/{chunk-DEDN5HAG.js.map → chunk-FZURBQJ2.js.map} +1 -1
- package/dist/{chunk-JHULS3EC.js → chunk-GBUVIGD5.js} +89 -3
- package/dist/chunk-GBUVIGD5.js.map +1 -0
- package/dist/chunk-GU5OS7JJ.cjs +281 -0
- package/dist/chunk-GU5OS7JJ.cjs.map +1 -0
- package/dist/{chunk-V7D3YGUV.js → chunk-GVLNXPJX.js} +4 -4
- package/dist/{chunk-V7D3YGUV.js.map → chunk-GVLNXPJX.js.map} +1 -1
- package/dist/chunk-GVM6DTR5.js +90 -0
- package/dist/chunk-GVM6DTR5.js.map +1 -0
- package/dist/{chunk-SQHMGT4W.js → chunk-GW4RFJZ5.js} +7 -7
- package/dist/chunk-GW4RFJZ5.js.map +1 -0
- package/dist/{chunk-3QEVGSFG.cjs → chunk-GYXUS65N.cjs} +5 -5
- package/dist/{chunk-3QEVGSFG.cjs.map → chunk-GYXUS65N.cjs.map} +1 -1
- package/dist/{chunk-WGPLUCBD.js → chunk-H2IAMSHK.js} +3 -3
- package/dist/{chunk-WGPLUCBD.js.map → chunk-H2IAMSHK.js.map} +1 -1
- package/dist/{chunk-JID7AZTO.cjs → chunk-H3ROMJYI.cjs} +4 -4
- package/dist/{chunk-JID7AZTO.cjs.map → chunk-H3ROMJYI.cjs.map} +1 -1
- package/dist/{chunk-GD7EBGC4.cjs → chunk-HC3NAN55.cjs} +19 -19
- package/dist/{chunk-GD7EBGC4.cjs.map → chunk-HC3NAN55.cjs.map} +1 -1
- package/dist/{chunk-7ZXAQTV4.cjs → chunk-HIZWOAWY.cjs} +8 -8
- package/dist/{chunk-7ZXAQTV4.cjs.map → chunk-HIZWOAWY.cjs.map} +1 -1
- package/dist/{chunk-NV2CWBI2.cjs → chunk-IEY3ZJIT.cjs} +12 -3
- package/dist/chunk-IEY3ZJIT.cjs.map +1 -0
- package/dist/chunk-IT775BYG.js +179 -0
- package/dist/chunk-IT775BYG.js.map +1 -0
- package/dist/chunk-IYWG72DM.js +166 -0
- package/dist/chunk-IYWG72DM.js.map +1 -0
- package/dist/{chunk-2YCERQWC.js → chunk-JBIGSP2T.js} +6 -6
- package/dist/{chunk-2YCERQWC.js.map → chunk-JBIGSP2T.js.map} +1 -1
- package/dist/{chunk-IX6KFB3K.cjs → chunk-JELTRRR5.cjs} +9 -9
- package/dist/{chunk-IX6KFB3K.cjs.map → chunk-JELTRRR5.cjs.map} +1 -1
- package/dist/{chunk-YQDA366U.js → chunk-JHG3ELS2.js} +2 -2
- package/dist/{chunk-YQDA366U.js.map → chunk-JHG3ELS2.js.map} +1 -1
- package/dist/{chunk-WWJIW2IH.cjs → chunk-JSXIB6EJ.cjs} +4 -4
- package/dist/{chunk-WWJIW2IH.cjs.map → chunk-JSXIB6EJ.cjs.map} +1 -1
- package/dist/{chunk-WNM7IZJ7.js → chunk-K34DXMLZ.js} +7 -7
- package/dist/{chunk-WNM7IZJ7.js.map → chunk-K34DXMLZ.js.map} +1 -1
- package/dist/{chunk-FXO5ARBB.cjs → chunk-KDW6BD4O.cjs} +4 -4
- package/dist/{chunk-FXO5ARBB.cjs.map → chunk-KDW6BD4O.cjs.map} +1 -1
- package/dist/{chunk-Z5V7SAZ4.js → chunk-KFEN2SRZ.js} +3 -3
- package/dist/{chunk-Z5V7SAZ4.js.map → chunk-KFEN2SRZ.js.map} +1 -1
- package/dist/{chunk-2QKBTPUC.cjs → chunk-KGKBZN3T.cjs} +8 -8
- package/dist/{chunk-2QKBTPUC.cjs.map → chunk-KGKBZN3T.cjs.map} +1 -1
- package/dist/{chunk-UV2FVNWT.cjs → chunk-LFPJ3OUM.cjs} +5 -5
- package/dist/{chunk-UV2FVNWT.cjs.map → chunk-LFPJ3OUM.cjs.map} +1 -1
- package/dist/{chunk-WNAA6CLE.cjs → chunk-LHBWRMNC.cjs} +94 -2
- package/dist/chunk-LHBWRMNC.cjs.map +1 -0
- package/dist/{chunk-JI244Y7C.js → chunk-MLAWXPRY.js} +190 -5
- package/dist/chunk-MLAWXPRY.js.map +1 -0
- package/dist/chunk-N7C4OEP7.cjs +356 -0
- package/dist/chunk-N7C4OEP7.cjs.map +1 -0
- package/dist/{chunk-WNZAYBVB.cjs → chunk-NKV76R65.cjs} +48 -48
- package/dist/{chunk-WNZAYBVB.cjs.map → chunk-NKV76R65.cjs.map} +1 -1
- package/dist/{chunk-PYJDVWXM.js → chunk-NUB5HRKS.js} +3 -3
- package/dist/{chunk-PYJDVWXM.js.map → chunk-NUB5HRKS.js.map} +1 -1
- package/dist/{chunk-LL6IWKI3.js → chunk-OW3SQJ7P.js} +3 -3
- package/dist/{chunk-LL6IWKI3.js.map → chunk-OW3SQJ7P.js.map} +1 -1
- package/dist/{chunk-5GUOOLPR.cjs → chunk-P5CMZZRZ.cjs} +5 -5
- package/dist/{chunk-5GUOOLPR.cjs.map → chunk-P5CMZZRZ.cjs.map} +1 -1
- package/dist/{chunk-3T7QGLNB.js → chunk-PJEL5ZZV.js} +4 -2
- package/dist/chunk-PJEL5ZZV.js.map +1 -0
- package/dist/{chunk-H4ZXMQQW.js → chunk-QOVJ6Z6R.js} +3 -3
- package/dist/{chunk-H4ZXMQQW.js.map → chunk-QOVJ6Z6R.js.map} +1 -1
- package/dist/{chunk-U42F3HLE.cjs → chunk-QURJVPRH.cjs} +190 -5
- package/dist/chunk-QURJVPRH.cjs.map +1 -0
- package/dist/{chunk-X4XPNTCZ.cjs → chunk-R5Z7AOVU.cjs} +136 -58
- package/dist/chunk-R5Z7AOVU.cjs.map +1 -0
- package/dist/{chunk-TMMVIUUN.js → chunk-R6KPWIGO.js} +4 -4
- package/dist/{chunk-TMMVIUUN.js.map → chunk-R6KPWIGO.js.map} +1 -1
- package/dist/{chunk-22CYDCXA.js → chunk-RM2HPQIC.js} +105 -14
- package/dist/chunk-RM2HPQIC.js.map +1 -0
- package/dist/{chunk-ENKFJJZX.js → chunk-SD7ONW6S.js} +6 -6
- package/dist/{chunk-ENKFJJZX.js.map → chunk-SD7ONW6S.js.map} +1 -1
- package/dist/{chunk-RJ6NTJHC.js → chunk-SRMTRD7F.js} +3 -3
- package/dist/{chunk-RJ6NTJHC.js.map → chunk-SRMTRD7F.js.map} +1 -1
- package/dist/chunk-T4JYUICS.js +2657 -0
- package/dist/chunk-T4JYUICS.js.map +1 -0
- package/dist/{chunk-7ZDPD5ZX.cjs → chunk-T4L7Q5FA.cjs} +7 -7
- package/dist/{chunk-7ZDPD5ZX.cjs.map → chunk-T4L7Q5FA.cjs.map} +1 -1
- package/dist/{chunk-NJ6MY6V5.js → chunk-T5BBZQ66.js} +3 -3
- package/dist/{chunk-NJ6MY6V5.js.map → chunk-T5BBZQ66.js.map} +1 -1
- package/dist/{chunk-2IZLKPUW.js → chunk-THLIL6PY.js} +3 -3
- package/dist/{chunk-2IZLKPUW.js.map → chunk-THLIL6PY.js.map} +1 -1
- package/dist/{chunk-SGFYA22I.cjs → chunk-TJCX4OML.cjs} +8 -8
- package/dist/{chunk-SGFYA22I.cjs.map → chunk-TJCX4OML.cjs.map} +1 -1
- package/dist/{chunk-N6IY47YA.cjs → chunk-TTSSUOEV.cjs} +8 -8
- package/dist/{chunk-N6IY47YA.cjs.map → chunk-TTSSUOEV.cjs.map} +1 -1
- package/dist/{chunk-5MCBWTIF.cjs → chunk-TYE5K5WV.cjs} +4 -4
- package/dist/{chunk-5MCBWTIF.cjs.map → chunk-TYE5K5WV.cjs.map} +1 -1
- package/dist/{chunk-VOKVG3ER.js → chunk-UBSH27C2.js} +4 -4
- package/dist/{chunk-VOKVG3ER.js.map → chunk-UBSH27C2.js.map} +1 -1
- package/dist/{chunk-TAXD5ADA.cjs → chunk-UEDTZYGI.cjs} +3 -3
- package/dist/{chunk-TAXD5ADA.cjs.map → chunk-UEDTZYGI.cjs.map} +1 -1
- package/dist/{chunk-UQ3VVR6A.cjs → chunk-UPWIJC6I.cjs} +3 -3
- package/dist/{chunk-UQ3VVR6A.cjs.map → chunk-UPWIJC6I.cjs.map} +1 -1
- package/dist/{chunk-S7WCHDBO.js → chunk-VCI2Y7ST.js} +3 -3
- package/dist/{chunk-S7WCHDBO.js.map → chunk-VCI2Y7ST.js.map} +1 -1
- package/dist/chunk-VINZZQBD.cjs +323 -0
- package/dist/chunk-VINZZQBD.cjs.map +1 -0
- package/dist/{chunk-OD47TTAW.cjs → chunk-VOQJHSXN.cjs} +9 -9
- package/dist/{chunk-OD47TTAW.cjs.map → chunk-VOQJHSXN.cjs.map} +1 -1
- package/dist/chunk-VPTASZ2O.cjs +171 -0
- package/dist/chunk-VPTASZ2O.cjs.map +1 -0
- package/dist/chunk-WXFGHDTV.cjs +896 -0
- package/dist/chunk-WXFGHDTV.cjs.map +1 -0
- package/dist/{chunk-VNYW4C4J.cjs → chunk-X6A27RGO.cjs} +4 -84
- package/dist/chunk-X6A27RGO.cjs.map +1 -0
- package/dist/chunk-XBTKZCZF.js +333 -0
- package/dist/chunk-XBTKZCZF.js.map +1 -0
- package/dist/chunk-XDIMTPZU.cjs +202 -0
- package/dist/chunk-XDIMTPZU.cjs.map +1 -0
- package/dist/chunk-XDU65GLW.js +21 -0
- package/dist/chunk-XDU65GLW.js.map +1 -0
- package/dist/chunk-XI74P5F2.cjs +424 -0
- package/dist/chunk-XI74P5F2.cjs.map +1 -0
- package/dist/{chunk-WIAQQNFU.cjs → chunk-XRVMYT5G.cjs} +106 -13
- package/dist/chunk-XRVMYT5G.cjs.map +1 -0
- package/dist/chunk-XVW5DPPP.js +429 -0
- package/dist/chunk-XVW5DPPP.js.map +1 -0
- package/dist/chunk-Y4E2WRUR.cjs +188 -0
- package/dist/chunk-Y4E2WRUR.cjs.map +1 -0
- package/dist/chunk-Y4QNLW7W.js +300 -0
- package/dist/chunk-Y4QNLW7W.js.map +1 -0
- package/dist/{chunk-6EN3IQQI.cjs → chunk-YRHBSSQ3.cjs} +6 -6
- package/dist/{chunk-6EN3IQQI.cjs.map → chunk-YRHBSSQ3.cjs.map} +1 -1
- package/dist/{chunk-KZFBQ7GY.js → chunk-YU55JD35.js} +3 -3
- package/dist/{chunk-KZFBQ7GY.js.map → chunk-YU55JD35.js.map} +1 -1
- package/dist/chunk-YW2AKBLS.cjs +23 -0
- package/dist/chunk-YW2AKBLS.cjs.map +1 -0
- package/dist/{chunk-ELPW32ZI.cjs → chunk-ZTMYKAVU.cjs} +45 -45
- package/dist/{chunk-ELPW32ZI.cjs.map → chunk-ZTMYKAVU.cjs.map} +1 -1
- package/dist/{chunk-3QGS6CXD.js → chunk-ZYL4SNOR.js} +3 -3
- package/dist/{chunk-3QGS6CXD.js.map → chunk-ZYL4SNOR.js.map} +1 -1
- package/dist/components/Alert/index.d.cts +1 -1
- package/dist/components/Alert/index.d.ts +1 -1
- package/dist/components/AlertDialog/index.cjs +6 -5
- package/dist/components/AlertDialog/index.d.cts +28 -3
- package/dist/components/AlertDialog/index.d.ts +28 -3
- package/dist/components/AlertDialog/index.js +5 -4
- package/dist/components/AudioRecorder/index.d.cts +2 -2
- package/dist/components/AudioRecorder/index.d.ts +2 -2
- package/dist/components/Autocomplete/index.d.cts +8 -2
- package/dist/components/Autocomplete/index.d.ts +8 -2
- package/dist/components/Avatar/index.d.cts +1 -1
- package/dist/components/Avatar/index.d.ts +1 -1
- package/dist/components/Badge/index.d.cts +1 -1
- package/dist/components/Badge/index.d.ts +1 -1
- package/dist/components/BoardView/index.cjs +24 -0
- package/dist/components/BoardView/index.cjs.map +1 -0
- package/dist/components/BoardView/index.d.cts +41 -0
- package/dist/components/BoardView/index.d.ts +41 -0
- package/dist/components/BoardView/index.js +7 -0
- package/dist/components/BoardView/index.js.map +1 -0
- package/dist/components/Button/index.cjs +4 -3
- package/dist/components/Button/index.d.cts +2 -1
- package/dist/components/Button/index.d.ts +2 -1
- package/dist/components/Button/index.js +2 -1
- package/dist/components/CalendarView/index.cjs +23 -0
- package/dist/components/CalendarView/index.cjs.map +1 -0
- package/dist/components/CalendarView/index.d.cts +39 -0
- package/dist/components/CalendarView/index.d.ts +39 -0
- package/dist/components/CalendarView/index.js +10 -0
- package/dist/components/CalendarView/index.js.map +1 -0
- package/dist/components/Card/index.d.cts +3 -3
- package/dist/components/Card/index.d.ts +3 -3
- package/dist/components/Collapsible/index.cjs +6 -6
- package/dist/components/Collapsible/index.js +3 -3
- package/dist/components/CountryCodeDropdown/index.cjs +5 -5
- package/dist/components/CountryCodeDropdown/index.js +2 -2
- package/dist/components/CustomizableDashboard/index.cjs +10 -9
- package/dist/components/CustomizableDashboard/index.js +3 -2
- package/dist/components/Dropdown/index.cjs +10 -10
- package/dist/components/Dropdown/index.d.cts +2 -1
- package/dist/components/Dropdown/index.d.ts +2 -1
- package/dist/components/Dropdown/index.js +3 -3
- package/dist/components/FloatingWindow/index.cjs +5 -4
- package/dist/components/FloatingWindow/index.js +3 -2
- package/dist/components/GanttView/index.cjs +20 -0
- package/dist/components/GanttView/index.cjs.map +1 -0
- package/dist/components/GanttView/index.d.cts +36 -0
- package/dist/components/GanttView/index.d.ts +36 -0
- package/dist/components/GanttView/index.js +7 -0
- package/dist/components/GanttView/index.js.map +1 -0
- package/dist/components/GlossaryTooltip/index.cjs +3 -3
- package/dist/components/GlossaryTooltip/index.js +2 -2
- package/dist/components/KeyboardShortcutsOverlay/index.cjs +5 -5
- package/dist/components/KeyboardShortcutsOverlay/index.js +3 -3
- package/dist/components/ListView/index.cjs +23 -0
- package/dist/components/ListView/index.cjs.map +1 -0
- package/dist/components/ListView/index.d.cts +124 -0
- package/dist/components/ListView/index.d.ts +124 -0
- package/dist/components/ListView/index.js +10 -0
- package/dist/components/ListView/index.js.map +1 -0
- package/dist/components/Markdown/index.cjs +20 -19
- package/dist/components/Markdown/index.js +8 -7
- package/dist/components/MediaEditor/index.cjs +15 -14
- package/dist/components/MediaEditor/index.d.cts +91 -2
- package/dist/components/MediaEditor/index.d.ts +91 -2
- package/dist/components/MediaEditor/index.js +10 -9
- package/dist/components/MediaFeed/index.cjs +26 -0
- package/dist/components/MediaFeed/index.cjs.map +1 -0
- package/dist/components/MediaFeed/index.d.cts +104 -0
- package/dist/components/MediaFeed/index.d.ts +104 -0
- package/dist/components/MediaFeed/index.js +17 -0
- package/dist/components/MediaFeed/index.js.map +1 -0
- package/dist/components/MediaPlayer/index.cjs +7 -6
- package/dist/components/MediaPlayer/index.d.cts +19 -1
- package/dist/components/MediaPlayer/index.d.ts +19 -1
- package/dist/components/MediaPlayer/index.js +4 -3
- package/dist/components/MegaMenu/index.cjs +6 -5
- package/dist/components/MegaMenu/index.js +3 -2
- package/dist/components/Modal/index.cjs +10 -10
- package/dist/components/Modal/index.js +2 -2
- package/dist/components/Pagination/index.d.cts +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/PhoneInput/index.d.cts +36 -3
- package/dist/components/PhoneInput/index.d.ts +36 -3
- package/dist/components/Progress/index.d.cts +1 -1
- package/dist/components/Progress/index.d.ts +1 -1
- package/dist/components/Q/index.d.cts +2 -2
- package/dist/components/Q/index.d.ts +2 -2
- package/dist/components/QuickAction/index.d.cts +1 -1
- package/dist/components/QuickAction/index.d.ts +1 -1
- package/dist/components/RadialExplorer/index.cjs +5 -4
- package/dist/components/RadialExplorer/index.js +4 -3
- package/dist/components/RecordButton/index.d.cts +1 -1
- package/dist/components/RecordButton/index.d.ts +1 -1
- package/dist/components/RichTextEditor/index.cjs +9 -8
- package/dist/components/RichTextEditor/index.d.cts +7 -2
- package/dist/components/RichTextEditor/index.d.ts +7 -2
- package/dist/components/RichTextEditor/index.js +6 -5
- package/dist/components/ScrollArea/index.d.cts +1 -1
- package/dist/components/ScrollArea/index.d.ts +1 -1
- package/dist/components/SectionSpyNav/index.cjs +4 -3
- package/dist/components/SectionSpyNav/index.js +3 -2
- package/dist/components/Select/index.cjs +4 -4
- package/dist/components/Select/index.d.cts +1 -2
- package/dist/components/Select/index.d.ts +1 -2
- package/dist/components/Select/index.js +2 -2
- package/dist/components/Skeleton/index.d.cts +1 -1
- package/dist/components/Skeleton/index.d.ts +1 -1
- package/dist/components/Slider/index.d.cts +2 -2
- package/dist/components/Slider/index.d.ts +2 -2
- package/dist/components/SliderCalculator/index.cjs +4 -4
- package/dist/components/SliderCalculator/index.js +2 -2
- package/dist/components/SourceTip/index.cjs +3 -3
- package/dist/components/SourceTip/index.js +2 -2
- package/dist/components/Spinner/index.d.cts +2 -2
- package/dist/components/Spinner/index.d.ts +2 -2
- package/dist/components/SuperChat/index.cjs +1406 -823
- package/dist/components/SuperChat/index.cjs.map +1 -1
- package/dist/components/SuperChat/index.d.cts +126 -8
- package/dist/components/SuperChat/index.d.ts +126 -8
- package/dist/components/SuperChat/index.js +1398 -815
- package/dist/components/SuperChat/index.js.map +1 -1
- package/dist/components/SuperChat/plugins/index.cjs +6 -6
- package/dist/components/SuperChat/plugins/index.d.cts +2 -3
- package/dist/components/SuperChat/plugins/index.d.ts +2 -3
- package/dist/components/SuperChat/plugins/index.js +5 -5
- package/dist/components/Text/index.d.cts +3 -3
- package/dist/components/Text/index.d.ts +3 -3
- package/dist/components/Textarea/index.d.cts +1 -2
- package/dist/components/Textarea/index.d.ts +1 -2
- package/dist/components/ThemeProvider/index.cjs +9 -9
- package/dist/components/ThemeProvider/index.d.cts +3 -1
- package/dist/components/ThemeProvider/index.d.ts +3 -1
- package/dist/components/ThemeProvider/index.js +3 -3
- package/dist/components/Tooltip/index.cjs +3 -3
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/TranscriptView/index.d.cts +85 -4
- package/dist/components/TranscriptView/index.d.ts +85 -4
- package/dist/components/ViewSet/index.cjs +24 -0
- package/dist/components/ViewSet/index.cjs.map +1 -0
- package/dist/components/ViewSet/index.d.cts +200 -0
- package/dist/components/ViewSet/index.d.ts +200 -0
- package/dist/components/ViewSet/index.js +15 -0
- package/dist/components/ViewSet/index.js.map +1 -0
- package/dist/components/ViewSwitcher/index.cjs +20 -0
- package/dist/components/ViewSwitcher/index.cjs.map +1 -0
- package/dist/components/ViewSwitcher/index.d.cts +4 -0
- package/dist/components/ViewSwitcher/index.d.ts +4 -0
- package/dist/components/ViewSwitcher/index.js +7 -0
- package/dist/components/ViewSwitcher/index.js.map +1 -0
- package/dist/datavis.cjs +3 -2
- package/dist/datavis.cjs.map +1 -1
- package/dist/datavis.d.cts +167 -13
- package/dist/datavis.d.ts +167 -13
- package/dist/datavis.js +2 -1
- package/dist/datavis.js.map +1 -1
- package/dist/deck.cjs +3360 -0
- package/dist/deck.cjs.map +1 -0
- package/dist/deck.d.cts +712 -0
- package/dist/deck.d.ts +712 -0
- package/dist/deck.js +3316 -0
- package/dist/deck.js.map +1 -0
- package/dist/esheet.cjs +14 -13
- package/dist/esheet.cjs.map +1 -1
- package/dist/esheet.d.cts +183 -1
- package/dist/esheet.d.ts +183 -1
- package/dist/esheet.js +11 -10
- package/dist/esheet.js.map +1 -1
- package/dist/globe.cjs +2 -2
- package/dist/globe.js +1 -1
- package/dist/hooks/index.cjs +60 -27
- package/dist/hooks/index.d.cts +590 -31
- package/dist/hooks/index.d.ts +590 -31
- package/dist/hooks/index.js +6 -5
- package/dist/icons-wBacj6BW.d.cts +142 -0
- package/dist/icons-wBacj6BW.d.ts +142 -0
- package/dist/index-DoYYWsNc.d.cts +127 -0
- package/dist/index-DoYYWsNc.d.ts +127 -0
- package/dist/index.cjs +1420 -1048
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8796 -482
- package/dist/index.d.ts +8796 -482
- package/dist/index.js +368 -232
- package/dist/index.js.map +1 -1
- package/dist/kerebron.cjs +58 -19
- package/dist/kerebron.cjs.map +1 -1
- package/dist/kerebron.css +115 -0
- package/dist/kerebron.d.cts +37 -0
- package/dist/kerebron.d.ts +37 -0
- package/dist/kerebron.js +58 -19
- package/dist/kerebron.js.map +1 -1
- package/dist/maps.cjs +160 -0
- package/dist/maps.cjs.map +1 -0
- package/dist/maps.d.cts +42 -0
- package/dist/maps.d.ts +42 -0
- package/dist/maps.js +138 -0
- package/dist/maps.js.map +1 -0
- package/dist/motion.cjs +7 -7
- package/dist/motion.d.cts +186 -2
- package/dist/motion.d.ts +186 -2
- package/dist/motion.js +2 -2
- package/dist/q.d.cts +25 -3
- package/dist/q.d.ts +25 -3
- package/dist/styles/effects.css +133 -0
- package/dist/styles/init.css +3 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/dist/templates.cjs +156 -0
- package/dist/templates.cjs.map +1 -0
- package/dist/templates.d.cts +734 -0
- package/dist/templates.d.ts +734 -0
- package/dist/templates.js +11 -0
- package/dist/templates.js.map +1 -0
- package/dist/types-Cx1FHLq2.d.cts +548 -0
- package/dist/types-Cx1FHLq2.d.ts +548 -0
- package/dist/types-DsdZvEI1.d.cts +92 -0
- package/dist/types-DsdZvEI1.d.ts +92 -0
- package/dist/utils/index.d.cts +13 -2
- package/dist/utils/index.d.ts +13 -2
- package/package.json +62 -13
- package/dist/Animated-XmH6k8pZ.d.cts +0 -188
- package/dist/Animated-XmH6k8pZ.d.ts +0 -188
- package/dist/CsvBlock-ROJCKJDP.cjs +0 -16
- package/dist/CsvBlock-UWPMTLE2.js +0 -7
- package/dist/HtmlPreviewBlock-DWFN6EUB.cjs +0 -16
- package/dist/HtmlPreviewBlock-ME5U3XNS.js +0 -7
- package/dist/MedicationEditor-Bp4NLy7y.d.cts +0 -352
- package/dist/MedicationEditor-Bp4NLy7y.d.ts +0 -352
- package/dist/MermaidBlock-2B6CPD6Y.js +0 -7
- package/dist/MermaidBlock-D2UC5M55.cjs +0 -16
- package/dist/SurveyBlock-4CD4AYMJ.cjs +0 -16
- package/dist/SurveyBlock-4DO62RBT.js +0 -7
- package/dist/chunk-22CYDCXA.js.map +0 -1
- package/dist/chunk-3T7QGLNB.js.map +0 -1
- package/dist/chunk-6HFFWEM3.cjs +0 -22
- package/dist/chunk-6HFFWEM3.cjs.map +0 -1
- package/dist/chunk-ACCAXVOG.js.map +0 -1
- package/dist/chunk-GOALNQZ2.js.map +0 -1
- package/dist/chunk-HB7C7NB5.js +0 -20
- package/dist/chunk-HB7C7NB5.js.map +0 -1
- package/dist/chunk-JHULS3EC.js.map +0 -1
- package/dist/chunk-JI244Y7C.js.map +0 -1
- package/dist/chunk-JYZW2PZS.cjs.map +0 -1
- package/dist/chunk-NV2CWBI2.cjs.map +0 -1
- package/dist/chunk-SQHMGT4W.js.map +0 -1
- package/dist/chunk-U42F3HLE.cjs.map +0 -1
- package/dist/chunk-VKELAMAZ.js.map +0 -1
- package/dist/chunk-VNYW4C4J.cjs.map +0 -1
- package/dist/chunk-WIAQQNFU.cjs.map +0 -1
- package/dist/chunk-WNAA6CLE.cjs.map +0 -1
- package/dist/chunk-WNJRS7Y7.cjs.map +0 -1
- package/dist/chunk-X4XPNTCZ.cjs.map +0 -1
- package/dist/chunk-XCP454Q6.js.map +0 -1
- package/dist/chunk-XEAT7XJG.cjs.map +0 -1
- package/dist/html-MdxqSzjD.d.cts +0 -13
- package/dist/html-MdxqSzjD.d.ts +0 -13
- package/dist/orderRows-BUJYgSc7.d.cts +0 -221
- package/dist/orderRows-BUJYgSc7.d.ts +0 -221
- package/dist/transcript-Cg7uSW-C.d.cts +0 -84
- package/dist/transcript-Cg7uSW-C.d.ts +0 -84
- package/dist/types-B97JNRNQ.d.cts +0 -251
- package/dist/types-CnPEwzlp.d.cts +0 -254
- package/dist/types-CnPEwzlp.d.ts +0 -254
- package/dist/types-gZXrfLj6.d.ts +0 -251
- package/dist/useAnchoredPosition-CKwLSQW8.d.cts +0 -76
- package/dist/useAnchoredPosition-CKwLSQW8.d.ts +0 -76
- package/dist/useTheme-B9SWu6ui.d.cts +0 -24
- package/dist/useTheme-B9SWu6ui.d.ts +0 -24
- package/dist/useTranscriptEdits-CGzlemHT.d.cts +0 -182
- package/dist/useTranscriptEdits-D32bLs0l.d.ts +0 -182
|
@@ -1,29 +1,40 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkJFLC7SHM_cjs = require('../../chunk-JFLC7SHM.cjs');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
4
|
+
var chunkXRVMYT5G_cjs = require('../../chunk-XRVMYT5G.cjs');
|
|
5
|
+
var chunkR5Z7AOVU_cjs = require('../../chunk-R5Z7AOVU.cjs');
|
|
6
|
+
var chunkWXFGHDTV_cjs = require('../../chunk-WXFGHDTV.cjs');
|
|
7
|
+
require('../../chunk-GLXTVCHN.cjs');
|
|
8
|
+
var chunkBUT6MF5K_cjs = require('../../chunk-BUT6MF5K.cjs');
|
|
9
|
+
var chunkTJCX4OML_cjs = require('../../chunk-TJCX4OML.cjs');
|
|
10
|
+
require('../../chunk-PJ6CC53R.cjs');
|
|
7
11
|
var chunkJEIW7BSV_cjs = require('../../chunk-JEIW7BSV.cjs');
|
|
8
12
|
require('../../chunk-VBWRH4UW.cjs');
|
|
9
|
-
require('../../chunk-
|
|
13
|
+
var chunkVPTASZ2O_cjs = require('../../chunk-VPTASZ2O.cjs');
|
|
14
|
+
require('../../chunk-254QK722.cjs');
|
|
15
|
+
require('../../chunk-T4L7Q5FA.cjs');
|
|
10
16
|
require('../../chunk-I44YNYI6.cjs');
|
|
11
17
|
require('../../chunk-Z5S5JEJD.cjs');
|
|
18
|
+
require('../../chunk-NNEFAUHV.cjs');
|
|
19
|
+
require('../../chunk-FHY3K6PL.cjs');
|
|
12
20
|
require('../../chunk-FSGEDDF2.cjs');
|
|
13
21
|
require('../../chunk-AOHJILLU.cjs');
|
|
14
|
-
require('../../chunk-
|
|
22
|
+
require('../../chunk-SCV7C55E.cjs');
|
|
15
23
|
require('../../chunk-L7L5S2HO.cjs');
|
|
24
|
+
var chunkYW2AKBLS_cjs = require('../../chunk-YW2AKBLS.cjs');
|
|
25
|
+
var chunkX6A27RGO_cjs = require('../../chunk-X6A27RGO.cjs');
|
|
16
26
|
var chunkYVL3XATO_cjs = require('../../chunk-YVL3XATO.cjs');
|
|
17
|
-
require('../../chunk-
|
|
27
|
+
require('../../chunk-DXEPYK3I.cjs');
|
|
28
|
+
var chunkIEY3ZJIT_cjs = require('../../chunk-IEY3ZJIT.cjs');
|
|
18
29
|
var chunkS5RVSXDV_cjs = require('../../chunk-S5RVSXDV.cjs');
|
|
19
30
|
require('../../chunk-EUAMEVVI.cjs');
|
|
20
|
-
var
|
|
31
|
+
var React3 = require('react');
|
|
32
|
+
var lucideReact = require('lucide-react');
|
|
33
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
34
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
21
35
|
var Markdown = require('react-markdown');
|
|
22
36
|
var remarkGfm = require('remark-gfm');
|
|
23
37
|
var rehypeSanitize = require('rehype-sanitize');
|
|
24
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
25
|
-
var classVarianceAuthority = require('class-variance-authority');
|
|
26
|
-
var lucideReact = require('lucide-react');
|
|
27
38
|
var reactVirtual = require('@tanstack/react-virtual');
|
|
28
39
|
|
|
29
40
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -46,399 +57,204 @@ function _interopNamespace(e) {
|
|
|
46
57
|
return Object.freeze(n);
|
|
47
58
|
}
|
|
48
59
|
|
|
49
|
-
var
|
|
60
|
+
var React3__namespace = /*#__PURE__*/_interopNamespace(React3);
|
|
50
61
|
var Markdown__default = /*#__PURE__*/_interopDefault(Markdown);
|
|
51
62
|
var remarkGfm__default = /*#__PURE__*/_interopDefault(remarkGfm);
|
|
52
63
|
var rehypeSanitize__default = /*#__PURE__*/_interopDefault(rehypeSanitize);
|
|
53
64
|
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
65
|
+
function MessageMedia({
|
|
66
|
+
attachment,
|
|
67
|
+
onOpen,
|
|
68
|
+
openLabel,
|
|
69
|
+
playLabel,
|
|
70
|
+
errorLabel,
|
|
71
|
+
retryLabel,
|
|
72
|
+
launchId
|
|
73
|
+
}) {
|
|
74
|
+
const playable = attachment.kind !== "image";
|
|
75
|
+
const actionLabel = playable ? playLabel : openLabel;
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
"data-slot": "superchat-message-media",
|
|
80
|
+
className: "mt-3 flex w-72 max-w-full flex-col gap-2",
|
|
81
|
+
children: [
|
|
82
|
+
attachment.title && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium", children: attachment.title }),
|
|
83
|
+
attachment.kind === "image" && attachment.src ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
84
|
+
"img",
|
|
85
|
+
{
|
|
86
|
+
src: attachment.src,
|
|
87
|
+
alt: attachment.alt ?? attachment.title ?? "",
|
|
88
|
+
loading: "lazy",
|
|
89
|
+
className: "max-h-72 w-full rounded-lg object-contain"
|
|
90
|
+
}
|
|
91
|
+
) : (attachment.kind === "video" || attachment.kind === "audio") && attachment.src ? (
|
|
92
|
+
// An opaque themed surface: the player's semi-transparent states
|
|
93
|
+
// (error, loading) must never compose onto a colored chat bubble.
|
|
94
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-background overflow-hidden rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
95
|
+
chunkBUT6MF5K_cjs.MediaPlayer,
|
|
96
|
+
{
|
|
97
|
+
src: attachment.src,
|
|
98
|
+
kind: attachment.kind,
|
|
99
|
+
poster: attachment.poster,
|
|
100
|
+
"aria-label": attachment.alt ?? attachment.title ?? openLabel,
|
|
101
|
+
controls: !onOpen,
|
|
102
|
+
preload: "metadata",
|
|
103
|
+
labels: { error: errorLabel, retry: retryLabel },
|
|
104
|
+
className: "max-h-72"
|
|
105
|
+
}
|
|
106
|
+
) })
|
|
107
|
+
) : attachment.poster ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
108
|
+
"img",
|
|
109
|
+
{
|
|
110
|
+
src: attachment.poster,
|
|
111
|
+
alt: attachment.alt ?? attachment.title ?? "",
|
|
112
|
+
loading: "lazy",
|
|
113
|
+
className: "max-h-72 w-full rounded-lg object-contain"
|
|
114
|
+
}
|
|
115
|
+
) : null,
|
|
116
|
+
attachment.caption && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", children: attachment.caption }),
|
|
117
|
+
onOpen && /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.ButtonGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
118
|
+
chunkX6A27RGO_cjs.Button,
|
|
119
|
+
{
|
|
120
|
+
"data-media-launch-id": launchId,
|
|
121
|
+
variant: "secondary",
|
|
122
|
+
size: "sm",
|
|
123
|
+
leftIcon: playable ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-4", "aria-hidden": "true" }) : void 0,
|
|
124
|
+
"aria-label": playable && attachment.title ? `${playLabel} ${attachment.title}` : actionLabel,
|
|
125
|
+
onClick: () => onOpen(playable),
|
|
126
|
+
children: actionLabel
|
|
127
|
+
}
|
|
128
|
+
) })
|
|
129
|
+
]
|
|
69
130
|
}
|
|
70
|
-
|
|
71
|
-
};
|
|
72
|
-
return (tree) => splitNode(tree);
|
|
131
|
+
);
|
|
73
132
|
}
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const withoutClass = existing.filter(
|
|
80
|
-
(a) => !(Array.isArray(a) && a[0] === "className")
|
|
81
|
-
);
|
|
82
|
-
attributes[tag] = [...withoutClass, "className"];
|
|
83
|
-
};
|
|
84
|
-
allowClass("code");
|
|
85
|
-
allowClass("pre");
|
|
86
|
-
allowClass("span");
|
|
87
|
-
allowClass("div");
|
|
88
|
-
schema.attributes = attributes;
|
|
89
|
-
return schema;
|
|
133
|
+
function formatTime(time) {
|
|
134
|
+
return new Date(time).toLocaleTimeString(void 0, {
|
|
135
|
+
hour: "numeric",
|
|
136
|
+
minute: "2-digit"
|
|
137
|
+
});
|
|
90
138
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
139
|
+
function byTime(a, b) {
|
|
140
|
+
return new Date(a.time).getTime() - new Date(b.time).getTime();
|
|
141
|
+
}
|
|
142
|
+
function lastActivityOf(c) {
|
|
143
|
+
if (c.lastActivity) return new Date(c.lastActivity).getTime();
|
|
144
|
+
const last = lastMessageByTime(c.thread);
|
|
145
|
+
return last ? new Date(last.time).getTime() : 0;
|
|
146
|
+
}
|
|
147
|
+
function escapeRegExp(value) {
|
|
148
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
149
|
+
}
|
|
150
|
+
function detectMentions(text, participants) {
|
|
151
|
+
const ids = [];
|
|
152
|
+
for (const p of participants) {
|
|
153
|
+
if (p.kind === "system") continue;
|
|
154
|
+
const token = "@" + p.name.split(" ")[0];
|
|
155
|
+
const pattern = new RegExp(
|
|
156
|
+
`(?<![\\w@])${escapeRegExp(token)}(?![\\w])`,
|
|
157
|
+
"i"
|
|
158
|
+
);
|
|
159
|
+
if (pattern.test(text)) ids.push(p.id);
|
|
97
160
|
}
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
))
|
|
105
|
-
|
|
161
|
+
return ids;
|
|
162
|
+
}
|
|
163
|
+
function lastMessageByTime(thread) {
|
|
164
|
+
let latest;
|
|
165
|
+
let latestTime = -Infinity;
|
|
166
|
+
for (const message of thread) {
|
|
167
|
+
const t = new Date(message.time).getTime();
|
|
168
|
+
if (t >= latestTime) {
|
|
169
|
+
latest = message;
|
|
170
|
+
latestTime = t;
|
|
106
171
|
}
|
|
107
|
-
out.attributes = baseAttrs;
|
|
108
172
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
173
|
+
return latest;
|
|
174
|
+
}
|
|
175
|
+
function parseHexColor(value) {
|
|
176
|
+
const hex = value.trim();
|
|
177
|
+
if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hex)) return null;
|
|
178
|
+
const normalized = hex.length === 4 ? "#" + [...hex.slice(1)].map((char) => char + char).join("") : hex;
|
|
179
|
+
return [1, 3, 5].map(
|
|
180
|
+
(start) => parseInt(normalized.slice(start, start + 2), 16)
|
|
181
|
+
);
|
|
182
|
+
}
|
|
183
|
+
function relativeLuminanceChannel(channel) {
|
|
184
|
+
const normalized = channel / 255;
|
|
185
|
+
return normalized <= 0.03928 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
|
|
186
|
+
}
|
|
187
|
+
function relativeLuminance(value) {
|
|
188
|
+
const rgb = parseHexColor(value);
|
|
189
|
+
if (!rgb) return null;
|
|
190
|
+
const [red, green, blue] = rgb;
|
|
191
|
+
return 0.2126 * relativeLuminanceChannel(red) + 0.7152 * relativeLuminanceChannel(green) + 0.0722 * relativeLuminanceChannel(blue);
|
|
192
|
+
}
|
|
193
|
+
function contrastRatio(foreground, background) {
|
|
194
|
+
const foregroundLuminance = relativeLuminance(foreground);
|
|
195
|
+
const backgroundLuminance = relativeLuminance(background);
|
|
196
|
+
if (foregroundLuminance === null || backgroundLuminance === null) return null;
|
|
197
|
+
const lighter = Math.max(foregroundLuminance, backgroundLuminance);
|
|
198
|
+
const darker = Math.min(foregroundLuminance, backgroundLuminance);
|
|
199
|
+
return (lighter + 0.05) / (darker + 0.05);
|
|
200
|
+
}
|
|
201
|
+
function minimumContrastRatio(value, backgrounds) {
|
|
202
|
+
const contrasts = backgrounds.map((background) => contrastRatio(value, background)).filter((contrast) => contrast !== null);
|
|
203
|
+
if (contrasts.length !== backgrounds.length) return null;
|
|
204
|
+
return Math.min(...contrasts);
|
|
205
|
+
}
|
|
206
|
+
function accessibleAccentTextColor(value) {
|
|
207
|
+
if (!value) return void 0;
|
|
208
|
+
const contrast = minimumContrastRatio(value, ["#f5f5f5", "#262626"]);
|
|
209
|
+
if (contrast === null) return value;
|
|
210
|
+
return contrast < 4.5 ? void 0 : value;
|
|
211
|
+
}
|
|
212
|
+
function ParticipantAvatar({
|
|
213
|
+
participant
|
|
214
|
+
}) {
|
|
215
|
+
const isAgent = participant?.kind === "agent";
|
|
216
|
+
const backgroundColor = participant?.color ?? (isAgent ? "var(--mieweb-primary-700, #1f2937)" : "#64748b");
|
|
217
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
218
|
+
chunkJEIW7BSV_cjs.Avatar,
|
|
219
|
+
{
|
|
220
|
+
size: "xs",
|
|
221
|
+
src: participant?.avatar,
|
|
222
|
+
alt: "",
|
|
223
|
+
name: participant?.name ?? "?",
|
|
224
|
+
fallback: isAgent ? /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.SparklesIcon, { size: "sm" }) : void 0,
|
|
225
|
+
style: { backgroundColor },
|
|
226
|
+
"aria-hidden": "true",
|
|
227
|
+
className: "shrink-0"
|
|
119
228
|
}
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
for (const [k, v] of Object.entries(extra)) {
|
|
123
|
-
if (k === "tagNames" || k === "attributes" || k === "protocols") continue;
|
|
124
|
-
out[k] = v;
|
|
125
|
-
}
|
|
126
|
-
return out;
|
|
229
|
+
);
|
|
127
230
|
}
|
|
128
|
-
function
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
231
|
+
function ReferenceChip({
|
|
232
|
+
reference,
|
|
233
|
+
linkBuilder,
|
|
234
|
+
onReferenceClick
|
|
235
|
+
}) {
|
|
236
|
+
const href = linkBuilder?.(reference);
|
|
237
|
+
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
238
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
239
|
+
chunkYVL3XATO_cjs.Badge,
|
|
132
240
|
{
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
),
|
|
138
|
-
target: props.target ?? "_blank",
|
|
139
|
-
rel: props.rel ?? "noopener noreferrer",
|
|
140
|
-
children
|
|
241
|
+
variant: "default",
|
|
242
|
+
size: "sm",
|
|
243
|
+
className: "rounded px-1.5 text-[10px] font-semibold tracking-wide uppercase",
|
|
244
|
+
children: reference.refType
|
|
141
245
|
}
|
|
142
246
|
),
|
|
143
|
-
|
|
144
|
-
|
|
247
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: reference.title })
|
|
248
|
+
] });
|
|
249
|
+
const className = "inline-flex max-w-full items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-700 hover:border-primary-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200";
|
|
250
|
+
if (href) {
|
|
251
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
252
|
+
"a",
|
|
145
253
|
{
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
props.className
|
|
151
|
-
)
|
|
152
|
-
}
|
|
153
|
-
),
|
|
154
|
-
code: ({ node: _node, ...props }) => {
|
|
155
|
-
const isBlock = typeof props.className === "string" && props.className.includes("language-");
|
|
156
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
157
|
-
"code",
|
|
158
|
-
{
|
|
159
|
-
...props,
|
|
160
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
161
|
-
!isBlock && "rounded bg-neutral-200 px-1 py-0.5 text-[0.85em] text-neutral-800 dark:bg-neutral-700 dark:text-neutral-100",
|
|
162
|
-
props.className
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
);
|
|
166
|
-
},
|
|
167
|
-
input: ({ node: _node, ...props }) => {
|
|
168
|
-
if (props.type === "checkbox") {
|
|
169
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
170
|
-
"input",
|
|
171
|
-
{
|
|
172
|
-
...props,
|
|
173
|
-
"aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 : "Task list item")
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
return /* @__PURE__ */ jsxRuntime.jsx("input", { ...props });
|
|
178
|
-
},
|
|
179
|
-
table: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
180
|
-
"table",
|
|
181
|
-
{
|
|
182
|
-
...props,
|
|
183
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
184
|
-
"w-full border-collapse text-sm [&_td]:border [&_td]:border-neutral-200 [&_td]:px-2 [&_td]:py-1 dark:[&_td]:border-neutral-700 [&_th]:border [&_th]:border-neutral-200 [&_th]:px-2 [&_th]:py-1 [&_th]:text-start dark:[&_th]:border-neutral-700",
|
|
185
|
-
props.className
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
) }),
|
|
189
|
-
// Tailwind's preflight resets list markers/padding; restore them explicitly
|
|
190
|
-
// so bullets/numbers show without depending on the typography plugin.
|
|
191
|
-
ul: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: chunkS5RVSXDV_cjs.cn("list-disc ps-5", props.className) }),
|
|
192
|
-
ol: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: chunkS5RVSXDV_cjs.cn("list-decimal ps-5", props.className) }),
|
|
193
|
-
li: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: chunkS5RVSXDV_cjs.cn("ps-1", props.className) }),
|
|
194
|
-
// Preflight also flattens headings to body size/weight; restore a sensible
|
|
195
|
-
// hierarchy without depending on the typography plugin.
|
|
196
|
-
h1: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
197
|
-
"h1",
|
|
198
|
-
{
|
|
199
|
-
...props,
|
|
200
|
-
className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-xl font-semibold", props.className),
|
|
201
|
-
children
|
|
202
|
-
}
|
|
203
|
-
),
|
|
204
|
-
h2: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
205
|
-
"h2",
|
|
206
|
-
{
|
|
207
|
-
...props,
|
|
208
|
-
className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-lg font-semibold", props.className),
|
|
209
|
-
children
|
|
210
|
-
}
|
|
211
|
-
),
|
|
212
|
-
h3: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
213
|
-
"h3",
|
|
214
|
-
{
|
|
215
|
-
...props,
|
|
216
|
-
className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-base font-semibold", props.className),
|
|
217
|
-
children
|
|
218
|
-
}
|
|
219
|
-
),
|
|
220
|
-
h4: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
221
|
-
"h4",
|
|
222
|
-
{
|
|
223
|
-
...props,
|
|
224
|
-
className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
|
|
225
|
-
children
|
|
226
|
-
}
|
|
227
|
-
),
|
|
228
|
-
h5: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
229
|
-
"h5",
|
|
230
|
-
{
|
|
231
|
-
...props,
|
|
232
|
-
className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
|
|
233
|
-
children
|
|
234
|
-
}
|
|
235
|
-
),
|
|
236
|
-
h6: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
-
"h6",
|
|
238
|
-
{
|
|
239
|
-
...props,
|
|
240
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
241
|
-
"mt-2 mb-1 text-xs font-semibold tracking-wide uppercase",
|
|
242
|
-
props.className
|
|
243
|
-
),
|
|
244
|
-
children
|
|
245
|
-
}
|
|
246
|
-
),
|
|
247
|
-
hr: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
248
|
-
"hr",
|
|
249
|
-
{
|
|
250
|
-
...props,
|
|
251
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
252
|
-
"my-2 border-neutral-300 dark:border-neutral-600",
|
|
253
|
-
props.className
|
|
254
|
-
)
|
|
255
|
-
}
|
|
256
|
-
)
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
function createMarkdownRenderer(options = {}) {
|
|
260
|
-
const { plugins = [], trusted = false } = options;
|
|
261
|
-
const remarkPlugins = [
|
|
262
|
-
remarkGfm__default.default,
|
|
263
|
-
remarkPreserveLineBreaks,
|
|
264
|
-
...plugins.flatMap((p) => p.remarkPlugins ?? [])
|
|
265
|
-
];
|
|
266
|
-
const pluginRehype = plugins.flatMap(
|
|
267
|
-
(p) => p.rehypePlugins ?? []
|
|
268
|
-
);
|
|
269
|
-
const sanitizeSchema = plugins.reduce(
|
|
270
|
-
(acc, p) => mergeSanitizeSchema(acc, p.sanitizeSchema),
|
|
271
|
-
baseSanitizeSchema()
|
|
272
|
-
);
|
|
273
|
-
const rehypePlugins = trusted ? pluginRehype : [...pluginRehype, [rehypeSanitize__default.default, sanitizeSchema]];
|
|
274
|
-
const components = plugins.reduce(
|
|
275
|
-
(acc, p) => ({ ...acc, ...p.components }),
|
|
276
|
-
baseComponents()
|
|
277
|
-
);
|
|
278
|
-
const MarkdownRenderer = (text, ctx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
279
|
-
MarkdownContent,
|
|
280
|
-
{
|
|
281
|
-
text,
|
|
282
|
-
messageId: ctx.messageId,
|
|
283
|
-
streaming: ctx.streaming,
|
|
284
|
-
remarkPlugins,
|
|
285
|
-
rehypePlugins,
|
|
286
|
-
components
|
|
287
|
-
},
|
|
288
|
-
ctx.messageId
|
|
289
|
-
);
|
|
290
|
-
return MarkdownRenderer;
|
|
291
|
-
}
|
|
292
|
-
var transformUrl = (url, key, node) => {
|
|
293
|
-
if (key === "src" && node.tagName === "img" && (/^data:image\//i.test(url) || /^blob:/i.test(url))) {
|
|
294
|
-
return url;
|
|
295
|
-
}
|
|
296
|
-
return Markdown.defaultUrlTransform(url);
|
|
297
|
-
};
|
|
298
|
-
var MarkdownContent = React2__namespace.memo(function MarkdownContent2({
|
|
299
|
-
text,
|
|
300
|
-
messageId,
|
|
301
|
-
streaming,
|
|
302
|
-
remarkPlugins,
|
|
303
|
-
rehypePlugins,
|
|
304
|
-
components
|
|
305
|
-
}) {
|
|
306
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunkJFLC7SHM_cjs.TextRenderContext.Provider, { value: { messageId, streaming }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
307
|
-
Markdown__default.default,
|
|
308
|
-
{
|
|
309
|
-
remarkPlugins,
|
|
310
|
-
rehypePlugins,
|
|
311
|
-
urlTransform: transformUrl,
|
|
312
|
-
components,
|
|
313
|
-
children: text
|
|
314
|
-
}
|
|
315
|
-
) });
|
|
316
|
-
});
|
|
317
|
-
function formatTime(time) {
|
|
318
|
-
return new Date(time).toLocaleTimeString(void 0, {
|
|
319
|
-
hour: "numeric",
|
|
320
|
-
minute: "2-digit"
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function byTime(a, b) {
|
|
324
|
-
return new Date(a.time).getTime() - new Date(b.time).getTime();
|
|
325
|
-
}
|
|
326
|
-
function lastActivityOf(c) {
|
|
327
|
-
if (c.lastActivity) return new Date(c.lastActivity).getTime();
|
|
328
|
-
const last = lastMessageByTime(c.thread);
|
|
329
|
-
return last ? new Date(last.time).getTime() : 0;
|
|
330
|
-
}
|
|
331
|
-
function escapeRegExp(value) {
|
|
332
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
333
|
-
}
|
|
334
|
-
function detectMentions(text, participants) {
|
|
335
|
-
const ids = [];
|
|
336
|
-
for (const p of participants) {
|
|
337
|
-
if (p.kind === "system") continue;
|
|
338
|
-
const token = "@" + p.name.split(" ")[0];
|
|
339
|
-
const pattern = new RegExp(
|
|
340
|
-
`(?<![\\w@])${escapeRegExp(token)}(?![\\w])`,
|
|
341
|
-
"i"
|
|
342
|
-
);
|
|
343
|
-
if (pattern.test(text)) ids.push(p.id);
|
|
344
|
-
}
|
|
345
|
-
return ids;
|
|
346
|
-
}
|
|
347
|
-
function lastMessageByTime(thread) {
|
|
348
|
-
let latest;
|
|
349
|
-
let latestTime = -Infinity;
|
|
350
|
-
for (const message of thread) {
|
|
351
|
-
const t = new Date(message.time).getTime();
|
|
352
|
-
if (t >= latestTime) {
|
|
353
|
-
latest = message;
|
|
354
|
-
latestTime = t;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return latest;
|
|
358
|
-
}
|
|
359
|
-
function parseHexColor(value) {
|
|
360
|
-
const hex = value.trim();
|
|
361
|
-
if (!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(hex)) return null;
|
|
362
|
-
const normalized = hex.length === 4 ? "#" + [...hex.slice(1)].map((char) => char + char).join("") : hex;
|
|
363
|
-
return [1, 3, 5].map(
|
|
364
|
-
(start) => parseInt(normalized.slice(start, start + 2), 16)
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
function relativeLuminanceChannel(channel) {
|
|
368
|
-
const normalized = channel / 255;
|
|
369
|
-
return normalized <= 0.03928 ? normalized / 12.92 : ((normalized + 0.055) / 1.055) ** 2.4;
|
|
370
|
-
}
|
|
371
|
-
function relativeLuminance(value) {
|
|
372
|
-
const rgb = parseHexColor(value);
|
|
373
|
-
if (!rgb) return null;
|
|
374
|
-
const [red, green, blue] = rgb;
|
|
375
|
-
return 0.2126 * relativeLuminanceChannel(red) + 0.7152 * relativeLuminanceChannel(green) + 0.0722 * relativeLuminanceChannel(blue);
|
|
376
|
-
}
|
|
377
|
-
function contrastRatio(foreground, background) {
|
|
378
|
-
const foregroundLuminance = relativeLuminance(foreground);
|
|
379
|
-
const backgroundLuminance = relativeLuminance(background);
|
|
380
|
-
if (foregroundLuminance === null || backgroundLuminance === null) return null;
|
|
381
|
-
const lighter = Math.max(foregroundLuminance, backgroundLuminance);
|
|
382
|
-
const darker = Math.min(foregroundLuminance, backgroundLuminance);
|
|
383
|
-
return (lighter + 0.05) / (darker + 0.05);
|
|
384
|
-
}
|
|
385
|
-
function minimumContrastRatio(value, backgrounds) {
|
|
386
|
-
const contrasts = backgrounds.map((background) => contrastRatio(value, background)).filter((contrast) => contrast !== null);
|
|
387
|
-
if (contrasts.length !== backgrounds.length) return null;
|
|
388
|
-
return Math.min(...contrasts);
|
|
389
|
-
}
|
|
390
|
-
function accessibleAccentTextColor(value) {
|
|
391
|
-
if (!value) return void 0;
|
|
392
|
-
const contrast = minimumContrastRatio(value, ["#f5f5f5", "#262626"]);
|
|
393
|
-
if (contrast === null) return value;
|
|
394
|
-
return contrast < 4.5 ? void 0 : value;
|
|
395
|
-
}
|
|
396
|
-
function ParticipantAvatar({
|
|
397
|
-
participant
|
|
398
|
-
}) {
|
|
399
|
-
const isAgent = participant?.kind === "agent";
|
|
400
|
-
const backgroundColor = participant?.color ?? (isAgent ? "var(--mieweb-primary-700, #1f2937)" : "#64748b");
|
|
401
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
402
|
-
chunkJEIW7BSV_cjs.Avatar,
|
|
403
|
-
{
|
|
404
|
-
size: "xs",
|
|
405
|
-
src: participant?.avatar,
|
|
406
|
-
alt: "",
|
|
407
|
-
name: participant?.name ?? "?",
|
|
408
|
-
fallback: isAgent ? /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.SparklesIcon, { size: "sm" }) : void 0,
|
|
409
|
-
style: { backgroundColor },
|
|
410
|
-
"aria-hidden": "true",
|
|
411
|
-
className: "shrink-0"
|
|
412
|
-
}
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
function ReferenceChip({
|
|
416
|
-
reference,
|
|
417
|
-
linkBuilder,
|
|
418
|
-
onReferenceClick
|
|
419
|
-
}) {
|
|
420
|
-
const href = linkBuilder?.(reference);
|
|
421
|
-
const content = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
422
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
423
|
-
chunkYVL3XATO_cjs.Badge,
|
|
424
|
-
{
|
|
425
|
-
variant: "default",
|
|
426
|
-
size: "sm",
|
|
427
|
-
className: "rounded px-1.5 text-[10px] font-semibold tracking-wide uppercase",
|
|
428
|
-
children: reference.refType
|
|
429
|
-
}
|
|
430
|
-
),
|
|
431
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: reference.title })
|
|
432
|
-
] });
|
|
433
|
-
const className = "inline-flex max-w-full items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 py-1.5 text-sm text-neutral-700 hover:border-primary-300 dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-200";
|
|
434
|
-
if (href) {
|
|
435
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
436
|
-
"a",
|
|
437
|
-
{
|
|
438
|
-
href,
|
|
439
|
-
className,
|
|
440
|
-
onClick: () => onReferenceClick?.(reference),
|
|
441
|
-
children: content
|
|
254
|
+
href,
|
|
255
|
+
className,
|
|
256
|
+
onClick: () => onReferenceClick?.(reference),
|
|
257
|
+
children: content
|
|
442
258
|
}
|
|
443
259
|
);
|
|
444
260
|
}
|
|
@@ -498,11 +314,11 @@ function useMessageCopy({
|
|
|
498
314
|
getText,
|
|
499
315
|
defaultFormat
|
|
500
316
|
}) {
|
|
501
|
-
const [copied, setCopied] =
|
|
502
|
-
const copiedTimer =
|
|
317
|
+
const [copied, setCopied] = React3__namespace.useState(false);
|
|
318
|
+
const copiedTimer = React3__namespace.useRef(
|
|
503
319
|
void 0
|
|
504
320
|
);
|
|
505
|
-
|
|
321
|
+
React3__namespace.useEffect(() => () => window.clearTimeout(copiedTimer.current), []);
|
|
506
322
|
const flash = () => {
|
|
507
323
|
setCopied(true);
|
|
508
324
|
window.clearTimeout(copiedTimer.current);
|
|
@@ -546,7 +362,7 @@ function ActionMenuItem({
|
|
|
546
362
|
item,
|
|
547
363
|
onSelect
|
|
548
364
|
}) {
|
|
549
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
365
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkTJCX4OML_cjs.DropdownItem, { onClick: () => onSelect(item.onSelect), children: item.description ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col items-start", children: [
|
|
550
366
|
/* @__PURE__ */ jsxRuntime.jsx("span", { children: item.label }),
|
|
551
367
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] font-normal text-neutral-400", children: item.description })
|
|
552
368
|
] }) : item.label });
|
|
@@ -555,7 +371,7 @@ function FooterActionButton({
|
|
|
555
371
|
action,
|
|
556
372
|
isSelf
|
|
557
373
|
}) {
|
|
558
|
-
const [open, setOpen] =
|
|
374
|
+
const [open, setOpen] = React3__namespace.useState(false);
|
|
559
375
|
const onClickCapture = action.submenu ? (e) => {
|
|
560
376
|
if (e.metaKey || e.ctrlKey) {
|
|
561
377
|
e.preventDefault();
|
|
@@ -578,7 +394,7 @@ function FooterActionButton({
|
|
|
578
394
|
);
|
|
579
395
|
if (!action.submenu) return button;
|
|
580
396
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
581
|
-
|
|
397
|
+
chunkTJCX4OML_cjs.Dropdown,
|
|
582
398
|
{
|
|
583
399
|
open,
|
|
584
400
|
onOpenChange: setOpen,
|
|
@@ -598,17 +414,13 @@ function FooterActionButton({
|
|
|
598
414
|
}
|
|
599
415
|
);
|
|
600
416
|
}
|
|
601
|
-
var MessageActionsBar =
|
|
417
|
+
var MessageActionsBar = React3__namespace.forwardRef(function MessageActionsBar2({ actions, isSelf }, ref) {
|
|
602
418
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
603
419
|
"div",
|
|
604
420
|
{
|
|
605
421
|
ref,
|
|
606
422
|
"data-slot": "superchat-message-actions",
|
|
607
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
608
|
-
"flex items-center gap-0.5",
|
|
609
|
-
isSelf && "justify-end",
|
|
610
|
-
actionRevealClass
|
|
611
|
-
),
|
|
423
|
+
className: chunkS5RVSXDV_cjs.cn("flex flex-col items-center gap-0.5", actionRevealClass),
|
|
612
424
|
children: actions.map((action) => /* @__PURE__ */ jsxRuntime.jsx(FooterActionButton, { action, isSelf }, action.id))
|
|
613
425
|
}
|
|
614
426
|
);
|
|
@@ -618,7 +430,7 @@ function MessageOverflowMenu({
|
|
|
618
430
|
actions,
|
|
619
431
|
footerVisible
|
|
620
432
|
}) {
|
|
621
|
-
const [open, setOpen] =
|
|
433
|
+
const [open, setOpen] = React3__namespace.useState(false);
|
|
622
434
|
const select = (fn) => {
|
|
623
435
|
setOpen(false);
|
|
624
436
|
fn();
|
|
@@ -627,7 +439,7 @@ function MessageOverflowMenu({
|
|
|
627
439
|
"div",
|
|
628
440
|
{
|
|
629
441
|
className: chunkS5RVSXDV_cjs.cn(
|
|
630
|
-
"sticky bottom-2 shrink-0
|
|
442
|
+
"sticky bottom-2 mt-auto shrink-0 transition-opacity",
|
|
631
443
|
// Rich content (e.g. NITRO tables) layers internals up to z-50, so the
|
|
632
444
|
// open menu's stacking context must clear that.
|
|
633
445
|
open ? "z-[60]" : "z-10",
|
|
@@ -637,7 +449,7 @@ function MessageOverflowMenu({
|
|
|
637
449
|
footerVisible && !open && "pointer-events-none invisible opacity-0"
|
|
638
450
|
),
|
|
639
451
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
640
|
-
|
|
452
|
+
chunkTJCX4OML_cjs.Dropdown,
|
|
641
453
|
{
|
|
642
454
|
open,
|
|
643
455
|
onOpenChange: setOpen,
|
|
@@ -656,9 +468,9 @@ function MessageOverflowMenu({
|
|
|
656
468
|
(action) => action.submenu ? (
|
|
657
469
|
// Actions with variants collapse to just their submenu — a
|
|
658
470
|
// top-level default item would duplicate the flyout's options.
|
|
659
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
471
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkTJCX4OML_cjs.DropdownSubmenu, { label: action.submenu.label, children: action.submenu.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx(ActionMenuItem, { item, onSelect: select }, item.id)) }, action.id)
|
|
660
472
|
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
661
|
-
|
|
473
|
+
chunkTJCX4OML_cjs.DropdownItem,
|
|
662
474
|
{
|
|
663
475
|
onClick: () => select(action.onSelect),
|
|
664
476
|
children: action.label
|
|
@@ -671,7 +483,7 @@ function MessageOverflowMenu({
|
|
|
671
483
|
}
|
|
672
484
|
);
|
|
673
485
|
}
|
|
674
|
-
var MessageRow =
|
|
486
|
+
var MessageRow = React3__namespace.memo(function MessageRow2({
|
|
675
487
|
message,
|
|
676
488
|
participant,
|
|
677
489
|
isSelf,
|
|
@@ -680,21 +492,27 @@ var MessageRow = React2__namespace.memo(function MessageRow2({
|
|
|
680
492
|
onReferenceClick,
|
|
681
493
|
editable,
|
|
682
494
|
onMessageEdited,
|
|
683
|
-
defaultCopyFormat = "rich"
|
|
495
|
+
defaultCopyFormat = "rich",
|
|
496
|
+
onOpenMedia,
|
|
497
|
+
openMediaLabel = "Open in media feed",
|
|
498
|
+
playMediaLabel = "Play",
|
|
499
|
+
mediaErrorLabel,
|
|
500
|
+
mediaRetryLabel
|
|
684
501
|
}) {
|
|
685
502
|
const streaming = message.status === "streaming";
|
|
686
|
-
const hasBody = !!message.text || (message.content?.length ?? 0) > 0;
|
|
687
|
-
const [isEditing, setIsEditing] =
|
|
688
|
-
const [draft, setDraft] =
|
|
689
|
-
const
|
|
690
|
-
const
|
|
691
|
-
const
|
|
503
|
+
const hasBody = !!message.text || (message.content?.length ?? 0) > 0 || (message.media?.length ?? 0) > 0;
|
|
504
|
+
const [isEditing, setIsEditing] = React3__namespace.useState(false);
|
|
505
|
+
const [draft, setDraft] = React3__namespace.useState(message.text ?? "");
|
|
506
|
+
const [editMinWidth, setEditMinWidth] = React3__namespace.useState();
|
|
507
|
+
const editRef = React3__namespace.useRef(null);
|
|
508
|
+
const bubbleRef = React3__namespace.useRef(null);
|
|
509
|
+
const autosize = React3__namespace.useCallback(() => {
|
|
692
510
|
const el = editRef.current;
|
|
693
511
|
if (!el) return;
|
|
694
512
|
el.style.height = "auto";
|
|
695
513
|
el.style.height = `${el.scrollHeight}px`;
|
|
696
514
|
}, []);
|
|
697
|
-
|
|
515
|
+
React3__namespace.useEffect(() => {
|
|
698
516
|
if (!isEditing) return;
|
|
699
517
|
const el = editRef.current;
|
|
700
518
|
if (!el) return;
|
|
@@ -709,337 +527,662 @@ var MessageRow = React2__namespace.memo(function MessageRow2({
|
|
|
709
527
|
${block.text}
|
|
710
528
|
\`\`\``;
|
|
711
529
|
}
|
|
712
|
-
if ((block.type === "text" || block.type === "thinking") && block.text) {
|
|
713
|
-
return block.text;
|
|
530
|
+
if ((block.type === "text" || block.type === "thinking") && block.text) {
|
|
531
|
+
return block.text;
|
|
532
|
+
}
|
|
533
|
+
return "";
|
|
534
|
+
}).filter(Boolean).join("\n\n") ?? "";
|
|
535
|
+
const canCopy = !isEditing && (!!message.content?.length || typeof message.text === "string" && message.text.length > 0);
|
|
536
|
+
const showEditAction = canEdit && !isEditing;
|
|
537
|
+
const actionCount = (canCopy ? 1 : 0) + (showEditAction ? 1 : 0);
|
|
538
|
+
const hasActions = actionCount > 0;
|
|
539
|
+
const collapseToMenu = actionCount > 1;
|
|
540
|
+
const copy = useMessageCopy({
|
|
541
|
+
markdown: markdownSource,
|
|
542
|
+
getHtml: () => bubbleRef.current?.innerHTML ?? "",
|
|
543
|
+
getText: () => bubbleRef.current?.textContent ?? "",
|
|
544
|
+
defaultFormat: defaultCopyFormat
|
|
545
|
+
});
|
|
546
|
+
const actionsBarRef = React3__namespace.useRef(null);
|
|
547
|
+
const [footerVisible, setFooterVisible] = React3__namespace.useState(true);
|
|
548
|
+
React3__namespace.useEffect(() => {
|
|
549
|
+
const el = actionsBarRef.current;
|
|
550
|
+
if (!el || typeof globalThis.IntersectionObserver === "undefined") return;
|
|
551
|
+
const observer = new globalThis.IntersectionObserver(([entry]) => {
|
|
552
|
+
setFooterVisible(entry?.isIntersecting ?? false);
|
|
553
|
+
});
|
|
554
|
+
observer.observe(el);
|
|
555
|
+
return () => observer.disconnect();
|
|
556
|
+
}, [hasActions, collapseToMenu]);
|
|
557
|
+
if (message.type === "system") {
|
|
558
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
559
|
+
"div",
|
|
560
|
+
{
|
|
561
|
+
"data-slot": "superchat-system-message",
|
|
562
|
+
role: "status",
|
|
563
|
+
className: "my-1 text-center text-xs text-neutral-500 dark:text-neutral-400",
|
|
564
|
+
children: message.text
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
}
|
|
568
|
+
if (message.type === "ref" && message.ref) {
|
|
569
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
570
|
+
"div",
|
|
571
|
+
{
|
|
572
|
+
"data-slot": "superchat-reference",
|
|
573
|
+
className: chunkS5RVSXDV_cjs.cn("flex", isSelf && "justify-end"),
|
|
574
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
575
|
+
ReferenceChip,
|
|
576
|
+
{
|
|
577
|
+
reference: message.ref,
|
|
578
|
+
linkBuilder,
|
|
579
|
+
onReferenceClick
|
|
580
|
+
}
|
|
581
|
+
)
|
|
582
|
+
}
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
const accent = participant?.color;
|
|
586
|
+
const accentTextColor = accessibleAccentTextColor(accent);
|
|
587
|
+
const authorName = participant?.name ?? "Unknown";
|
|
588
|
+
const startEdit = () => {
|
|
589
|
+
const el = bubbleRef.current;
|
|
590
|
+
if (el) {
|
|
591
|
+
const cs = getComputedStyle(el);
|
|
592
|
+
const contentWidth = el.clientWidth - parseFloat(cs.paddingLeft) - parseFloat(cs.paddingRight);
|
|
593
|
+
setEditMinWidth(contentWidth > 0 ? contentWidth : void 0);
|
|
594
|
+
}
|
|
595
|
+
setDraft(message.text ?? "");
|
|
596
|
+
setIsEditing(true);
|
|
597
|
+
};
|
|
598
|
+
const cancelEdit = () => setIsEditing(false);
|
|
599
|
+
const saveEdit = () => {
|
|
600
|
+
const next = draft.trim();
|
|
601
|
+
if (next && next !== message.text) onMessageEdited?.(message.id, next);
|
|
602
|
+
setIsEditing(false);
|
|
603
|
+
};
|
|
604
|
+
const handleEditPaste = (e) => {
|
|
605
|
+
const files = Array.from(e.clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/")).map((item) => item.getAsFile()).filter((f) => f !== null);
|
|
606
|
+
if (files.length === 0) return;
|
|
607
|
+
e.preventDefault();
|
|
608
|
+
const el = e.currentTarget;
|
|
609
|
+
const start = el.selectionStart ?? draft.length;
|
|
610
|
+
const end = el.selectionEnd ?? draft.length;
|
|
611
|
+
Promise.all(
|
|
612
|
+
files.map(
|
|
613
|
+
(file, i) => new Promise((resolve) => {
|
|
614
|
+
const reader = new window.FileReader();
|
|
615
|
+
reader.onload = () => {
|
|
616
|
+
const dataUrl = typeof reader.result === "string" ? reader.result : "";
|
|
617
|
+
const name = file.name || `pasted-image-${i + 1}.png`;
|
|
618
|
+
resolve(dataUrl ? `` : "");
|
|
619
|
+
};
|
|
620
|
+
reader.readAsDataURL(file);
|
|
621
|
+
})
|
|
622
|
+
)
|
|
623
|
+
).then((snippets) => {
|
|
624
|
+
const insert = snippets.filter(Boolean).join("\n");
|
|
625
|
+
if (!insert) return;
|
|
626
|
+
el.focus();
|
|
627
|
+
el.setSelectionRange(start, end);
|
|
628
|
+
const text = `${insert}
|
|
629
|
+
`;
|
|
630
|
+
const inserted = typeof document !== "undefined" && typeof document.execCommand === "function" && document.execCommand("insertText", false, text);
|
|
631
|
+
if (!inserted) {
|
|
632
|
+
setDraft((prev) => `${prev.slice(0, start)}${text}${prev.slice(end)}`);
|
|
633
|
+
}
|
|
634
|
+
requestAnimationFrame(autosize);
|
|
635
|
+
});
|
|
636
|
+
};
|
|
637
|
+
const actions = [
|
|
638
|
+
...canCopy ? [
|
|
639
|
+
{
|
|
640
|
+
id: "copy",
|
|
641
|
+
label: "Copy message",
|
|
642
|
+
title: "Copy message (\u2318/Ctrl-click: default format)",
|
|
643
|
+
icon: copy.copied ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 14, "aria-hidden": "true" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clipboard, { size: 14, "aria-hidden": "true" }),
|
|
644
|
+
onSelect: copy.copyDefault,
|
|
645
|
+
submenu: {
|
|
646
|
+
label: "Copy as",
|
|
647
|
+
items: [
|
|
648
|
+
{
|
|
649
|
+
id: "copy-rich",
|
|
650
|
+
label: "Copy as rich text",
|
|
651
|
+
description: "Rich text + Markdown",
|
|
652
|
+
onSelect: copy.copyRich
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
id: "copy-markdown",
|
|
656
|
+
label: "Copy as Markdown",
|
|
657
|
+
onSelect: copy.copyMarkdown
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
id: "copy-plain",
|
|
661
|
+
label: "Copy as plain text",
|
|
662
|
+
onSelect: copy.copyPlain
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
] : [],
|
|
668
|
+
...showEditAction ? [
|
|
669
|
+
{
|
|
670
|
+
id: "edit",
|
|
671
|
+
label: "Edit message",
|
|
672
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { size: 14, "aria-hidden": "true" }),
|
|
673
|
+
onSelect: startEdit
|
|
674
|
+
}
|
|
675
|
+
] : []
|
|
676
|
+
];
|
|
677
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
678
|
+
"div",
|
|
679
|
+
{
|
|
680
|
+
"data-slot": "superchat-message",
|
|
681
|
+
role: "article",
|
|
682
|
+
"aria-label": `${authorName}, ${formatTime(message.time)}`,
|
|
683
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
684
|
+
"group flex gap-2",
|
|
685
|
+
isSelf ? "flex-row-reverse" : "flex-row"
|
|
686
|
+
),
|
|
687
|
+
children: [
|
|
688
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
689
|
+
"div",
|
|
690
|
+
{
|
|
691
|
+
"data-slot": "superchat-message-gutter",
|
|
692
|
+
className: "flex shrink-0 flex-col items-center gap-1",
|
|
693
|
+
children: [
|
|
694
|
+
/* @__PURE__ */ jsxRuntime.jsx(ParticipantAvatar, { participant }),
|
|
695
|
+
hasActions && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
696
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
MessageOverflowMenu,
|
|
698
|
+
{
|
|
699
|
+
isSelf,
|
|
700
|
+
actions,
|
|
701
|
+
footerVisible: collapseToMenu ? false : footerVisible
|
|
702
|
+
}
|
|
703
|
+
),
|
|
704
|
+
!collapseToMenu && /* @__PURE__ */ jsxRuntime.jsx(
|
|
705
|
+
MessageActionsBar,
|
|
706
|
+
{
|
|
707
|
+
ref: actionsBarRef,
|
|
708
|
+
actions,
|
|
709
|
+
isSelf
|
|
710
|
+
}
|
|
711
|
+
)
|
|
712
|
+
] })
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
),
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
717
|
+
"div",
|
|
718
|
+
{
|
|
719
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
720
|
+
"flex min-w-0 flex-1 flex-col gap-1",
|
|
721
|
+
isSelf && "items-end"
|
|
722
|
+
),
|
|
723
|
+
children: [
|
|
724
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
725
|
+
"div",
|
|
726
|
+
{
|
|
727
|
+
"data-slot": "superchat-message-meta",
|
|
728
|
+
className: "flex items-baseline gap-2",
|
|
729
|
+
children: [
|
|
730
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
731
|
+
"span",
|
|
732
|
+
{
|
|
733
|
+
className: "text-xs font-medium",
|
|
734
|
+
style: accentTextColor ? { color: accentTextColor } : void 0,
|
|
735
|
+
children: authorName
|
|
736
|
+
}
|
|
737
|
+
),
|
|
738
|
+
participant?.role && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: participant.role }),
|
|
739
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: formatTime(message.time) }),
|
|
740
|
+
message.editedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
741
|
+
"span",
|
|
742
|
+
{
|
|
743
|
+
"data-slot": "superchat-edited-indicator",
|
|
744
|
+
className: "text-[10px] text-neutral-500 dark:text-neutral-400",
|
|
745
|
+
title: `Edited ${formatTime(message.editedAt)}`,
|
|
746
|
+
children: "(edited)"
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
]
|
|
750
|
+
}
|
|
751
|
+
),
|
|
752
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
753
|
+
"div",
|
|
754
|
+
{
|
|
755
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
756
|
+
"flex w-full items-center gap-1",
|
|
757
|
+
isSelf ? "flex-row-reverse" : "flex-row"
|
|
758
|
+
),
|
|
759
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
760
|
+
chunkXRVMYT5G_cjs.ChatBubble,
|
|
761
|
+
{
|
|
762
|
+
ref: bubbleRef,
|
|
763
|
+
"data-slot": "superchat-bubble",
|
|
764
|
+
variant: isSelf ? "user" : "assistant",
|
|
765
|
+
hasError: message.status === "error",
|
|
766
|
+
className: "text-sm has-[[data-slot=superchat-nitro-table]]:w-full has-[[data-slot=superchat-nitro-table]]:max-w-full",
|
|
767
|
+
children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
768
|
+
"div",
|
|
769
|
+
{
|
|
770
|
+
"data-slot": "superchat-message-editor",
|
|
771
|
+
className: "flex w-80 max-w-full flex-col gap-2",
|
|
772
|
+
style: editMinWidth ? { minWidth: editMinWidth } : void 0,
|
|
773
|
+
children: [
|
|
774
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
775
|
+
"textarea",
|
|
776
|
+
{
|
|
777
|
+
value: draft,
|
|
778
|
+
ref: editRef,
|
|
779
|
+
rows: 2,
|
|
780
|
+
onChange: (e) => {
|
|
781
|
+
setDraft(e.target.value);
|
|
782
|
+
autosize();
|
|
783
|
+
},
|
|
784
|
+
onPaste: handleEditPaste,
|
|
785
|
+
onKeyDown: (e) => {
|
|
786
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
787
|
+
e.preventDefault();
|
|
788
|
+
saveEdit();
|
|
789
|
+
} else if (e.key === "Escape") {
|
|
790
|
+
e.preventDefault();
|
|
791
|
+
cancelEdit();
|
|
792
|
+
}
|
|
793
|
+
},
|
|
794
|
+
"aria-label": "Edit message",
|
|
795
|
+
className: "focus:ring-primary-500 max-h-60 min-h-16 w-full resize-none rounded-lg border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 focus:ring-1 focus:outline-none dark:border-neutral-600 dark:bg-neutral-900 dark:text-white"
|
|
796
|
+
}
|
|
797
|
+
),
|
|
798
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
799
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
800
|
+
"button",
|
|
801
|
+
{
|
|
802
|
+
type: "button",
|
|
803
|
+
onClick: cancelEdit,
|
|
804
|
+
className: "rounded-md px-2.5 py-1 text-xs font-medium text-neutral-200 hover:bg-white/10",
|
|
805
|
+
children: "Cancel"
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
"button",
|
|
810
|
+
{
|
|
811
|
+
type: "button",
|
|
812
|
+
onClick: saveEdit,
|
|
813
|
+
disabled: !draft.trim() || draft.trim() === message.text,
|
|
814
|
+
className: "rounded-md bg-white px-2.5 py-1 text-xs font-medium text-neutral-900 hover:bg-neutral-100 disabled:opacity-40",
|
|
815
|
+
children: "Save"
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
] })
|
|
819
|
+
]
|
|
820
|
+
}
|
|
821
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
822
|
+
message.content?.map((block, i) => {
|
|
823
|
+
if (block.type === "tool_use" && block.toolCall) {
|
|
824
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.MCPToolCallDisplay, { toolCall: block.toolCall }, i);
|
|
825
|
+
}
|
|
826
|
+
if ((block.type === "text" || block.type === "thinking") && block.text) {
|
|
827
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
828
|
+
"div",
|
|
829
|
+
{
|
|
830
|
+
className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
|
|
831
|
+
children: renderText(block.text, {
|
|
832
|
+
messageId: message.id,
|
|
833
|
+
streaming,
|
|
834
|
+
role: participant?.kind === "human" ? "user" : "assistant"
|
|
835
|
+
})
|
|
836
|
+
},
|
|
837
|
+
i
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
if (block.type === "code" && block.text) {
|
|
841
|
+
const fenced = `\`\`\`${block.language ?? ""}
|
|
842
|
+
${block.text}
|
|
843
|
+
\`\`\``;
|
|
844
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
845
|
+
"div",
|
|
846
|
+
{
|
|
847
|
+
className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
|
|
848
|
+
children: renderText(fenced, {
|
|
849
|
+
messageId: message.id,
|
|
850
|
+
streaming,
|
|
851
|
+
role: participant?.kind === "human" ? "user" : "assistant"
|
|
852
|
+
})
|
|
853
|
+
},
|
|
854
|
+
i
|
|
855
|
+
);
|
|
856
|
+
}
|
|
857
|
+
return null;
|
|
858
|
+
}),
|
|
859
|
+
message.text && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word", children: renderText(message.text, {
|
|
860
|
+
messageId: message.id,
|
|
861
|
+
streaming,
|
|
862
|
+
role: participant?.kind === "human" ? "user" : "assistant"
|
|
863
|
+
}) }),
|
|
864
|
+
message.media?.map((attachment) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
865
|
+
MessageMedia,
|
|
866
|
+
{
|
|
867
|
+
attachment,
|
|
868
|
+
openLabel: openMediaLabel,
|
|
869
|
+
playLabel: playMediaLabel,
|
|
870
|
+
errorLabel: mediaErrorLabel,
|
|
871
|
+
retryLabel: mediaRetryLabel,
|
|
872
|
+
launchId: JSON.stringify([message.id, attachment.id]),
|
|
873
|
+
onOpen: onOpenMedia ? (play) => onOpenMedia(message.id, attachment.id, play) : void 0
|
|
874
|
+
},
|
|
875
|
+
attachment.id
|
|
876
|
+
)),
|
|
877
|
+
streaming && !hasBody && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.AITypingIndicator, {}) })
|
|
878
|
+
] })
|
|
879
|
+
}
|
|
880
|
+
)
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
]
|
|
884
|
+
}
|
|
885
|
+
)
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
);
|
|
889
|
+
});
|
|
890
|
+
var sidebarItem = classVarianceAuthority.cva(
|
|
891
|
+
"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-start text-sm transition-colors",
|
|
892
|
+
{
|
|
893
|
+
variants: {
|
|
894
|
+
active: {
|
|
895
|
+
true: "bg-primary-100 text-primary-900 dark:bg-primary-900/40 dark:text-primary-100",
|
|
896
|
+
false: "text-neutral-700 hover:bg-neutral-100 dark:text-neutral-200 dark:hover:bg-neutral-800"
|
|
897
|
+
}
|
|
898
|
+
},
|
|
899
|
+
defaultVariants: { active: false }
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
|
|
903
|
+
// src/components/SuperChat/media.ts
|
|
904
|
+
function getConversationMediaItems(conversation) {
|
|
905
|
+
const participants = new Map(
|
|
906
|
+
conversation.participants.map((participant) => [
|
|
907
|
+
participant.id,
|
|
908
|
+
participant
|
|
909
|
+
])
|
|
910
|
+
);
|
|
911
|
+
return [...conversation.thread].sort(byTime).flatMap(
|
|
912
|
+
(message) => (message.media ?? []).map((attachment) => ({
|
|
913
|
+
// Tuple encoding prevents collisions when ids themselves contain a
|
|
914
|
+
// delimiter. Including the conversation keeps selection scoped to it.
|
|
915
|
+
id: JSON.stringify([conversation.id, message.id, attachment.id]),
|
|
916
|
+
conversationId: conversation.id,
|
|
917
|
+
message,
|
|
918
|
+
attachment,
|
|
919
|
+
participant: participants.get(message.participantId)
|
|
920
|
+
}))
|
|
921
|
+
);
|
|
922
|
+
}
|
|
923
|
+
function remarkPreserveLineBreaks() {
|
|
924
|
+
const splitNode = (node) => {
|
|
925
|
+
if (!node.children) return;
|
|
926
|
+
const next = [];
|
|
927
|
+
for (const child of node.children) {
|
|
928
|
+
if (child.type === "text" && child.value && child.value.includes("\n")) {
|
|
929
|
+
const segments = child.value.split("\n");
|
|
930
|
+
segments.forEach((segment, i) => {
|
|
931
|
+
if (i > 0) next.push({ type: "break" });
|
|
932
|
+
if (segment) next.push({ type: "text", value: segment });
|
|
933
|
+
});
|
|
934
|
+
} else {
|
|
935
|
+
splitNode(child);
|
|
936
|
+
next.push(child);
|
|
937
|
+
}
|
|
938
|
+
}
|
|
939
|
+
node.children = next;
|
|
940
|
+
};
|
|
941
|
+
return (tree) => splitNode(tree);
|
|
942
|
+
}
|
|
943
|
+
function baseSanitizeSchema() {
|
|
944
|
+
const schema = JSON.parse(JSON.stringify(rehypeSanitize.defaultSchema));
|
|
945
|
+
const attributes = schema.attributes ?? {};
|
|
946
|
+
const allowClass = (tag) => {
|
|
947
|
+
const existing = attributes[tag] ?? [];
|
|
948
|
+
const withoutClass = existing.filter(
|
|
949
|
+
(a) => !(Array.isArray(a) && a[0] === "className")
|
|
950
|
+
);
|
|
951
|
+
attributes[tag] = [...withoutClass, "className"];
|
|
952
|
+
};
|
|
953
|
+
allowClass("code");
|
|
954
|
+
allowClass("pre");
|
|
955
|
+
allowClass("span");
|
|
956
|
+
allowClass("div");
|
|
957
|
+
schema.attributes = attributes;
|
|
958
|
+
return schema;
|
|
959
|
+
}
|
|
960
|
+
function mergeSanitizeSchema(base, extra) {
|
|
961
|
+
if (!extra) return base;
|
|
962
|
+
const out = { ...base };
|
|
963
|
+
if (Array.isArray(extra.tagNames)) {
|
|
964
|
+
const a = base.tagNames ?? [];
|
|
965
|
+
out.tagNames = Array.from(/* @__PURE__ */ new Set([...a, ...extra.tagNames]));
|
|
966
|
+
}
|
|
967
|
+
if (extra.attributes && typeof extra.attributes === "object") {
|
|
968
|
+
const baseAttrs = {
|
|
969
|
+
...base.attributes ?? {}
|
|
970
|
+
};
|
|
971
|
+
for (const [tag, attrs] of Object.entries(
|
|
972
|
+
extra.attributes
|
|
973
|
+
)) {
|
|
974
|
+
baseAttrs[tag] = [...baseAttrs[tag] ?? [], ...attrs];
|
|
975
|
+
}
|
|
976
|
+
out.attributes = baseAttrs;
|
|
977
|
+
}
|
|
978
|
+
if (extra.protocols && typeof extra.protocols === "object") {
|
|
979
|
+
const baseProtocols = {
|
|
980
|
+
...base.protocols ?? {}
|
|
981
|
+
};
|
|
982
|
+
for (const [attr, protocols] of Object.entries(
|
|
983
|
+
extra.protocols
|
|
984
|
+
)) {
|
|
985
|
+
baseProtocols[attr] = Array.from(
|
|
986
|
+
/* @__PURE__ */ new Set([...baseProtocols[attr] ?? [], ...protocols])
|
|
987
|
+
);
|
|
714
988
|
}
|
|
715
|
-
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
React2__namespace.useEffect(() => {
|
|
728
|
-
const el = actionsBarRef.current;
|
|
729
|
-
if (!el || typeof globalThis.IntersectionObserver === "undefined") return;
|
|
730
|
-
const observer = new globalThis.IntersectionObserver(([entry]) => {
|
|
731
|
-
setFooterVisible(entry?.isIntersecting ?? false);
|
|
732
|
-
});
|
|
733
|
-
observer.observe(el);
|
|
734
|
-
return () => observer.disconnect();
|
|
735
|
-
}, [hasActions]);
|
|
736
|
-
if (message.type === "system") {
|
|
737
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
738
|
-
"div",
|
|
989
|
+
out.protocols = baseProtocols;
|
|
990
|
+
}
|
|
991
|
+
for (const [k, v] of Object.entries(extra)) {
|
|
992
|
+
if (k === "tagNames" || k === "attributes" || k === "protocols") continue;
|
|
993
|
+
out[k] = v;
|
|
994
|
+
}
|
|
995
|
+
return out;
|
|
996
|
+
}
|
|
997
|
+
function baseComponents() {
|
|
998
|
+
return {
|
|
999
|
+
a: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1000
|
+
"a",
|
|
739
1001
|
{
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
1002
|
+
...props,
|
|
1003
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1004
|
+
"text-primary-800 hover:text-primary-900 dark:text-primary-300 underline underline-offset-2",
|
|
1005
|
+
props.className
|
|
1006
|
+
),
|
|
1007
|
+
target: props.target ?? "_blank",
|
|
1008
|
+
rel: props.rel ?? "noopener noreferrer",
|
|
1009
|
+
children
|
|
744
1010
|
}
|
|
745
|
-
)
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
-
"div",
|
|
1011
|
+
),
|
|
1012
|
+
pre: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1013
|
+
"pre",
|
|
750
1014
|
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
1015
|
+
...props,
|
|
1016
|
+
tabIndex: 0,
|
|
1017
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1018
|
+
"overflow-x-auto rounded-lg bg-neutral-900 p-3 text-sm text-neutral-100 dark:bg-neutral-950",
|
|
1019
|
+
props.className
|
|
1020
|
+
)
|
|
1021
|
+
}
|
|
1022
|
+
),
|
|
1023
|
+
code: ({ node: _node, ...props }) => {
|
|
1024
|
+
const isBlock = typeof props.className === "string" && props.className.includes("language-");
|
|
1025
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1026
|
+
"code",
|
|
1027
|
+
{
|
|
1028
|
+
...props,
|
|
1029
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1030
|
+
!isBlock && "rounded bg-neutral-200 px-1 py-0.5 text-[0.85em] text-neutral-800 dark:bg-neutral-700 dark:text-neutral-100",
|
|
1031
|
+
props.className
|
|
1032
|
+
)
|
|
1033
|
+
}
|
|
1034
|
+
);
|
|
1035
|
+
},
|
|
1036
|
+
input: ({ node: _node, ...props }) => {
|
|
1037
|
+
if (props.type === "checkbox") {
|
|
1038
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1039
|
+
"input",
|
|
755
1040
|
{
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
onReferenceClick
|
|
1041
|
+
...props,
|
|
1042
|
+
"aria-label": props["aria-label"] ?? (props["aria-labelledby"] ? void 0 : "Task list item")
|
|
759
1043
|
}
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
return /* @__PURE__ */ jsxRuntime.jsx("input", { ...props });
|
|
1047
|
+
},
|
|
1048
|
+
table: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "my-2 overflow-x-auto", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1049
|
+
"table",
|
|
1050
|
+
{
|
|
1051
|
+
...props,
|
|
1052
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1053
|
+
"w-full border-collapse text-sm [&_td]:border [&_td]:border-neutral-200 [&_td]:px-2 [&_td]:py-1 dark:[&_td]:border-neutral-700 [&_th]:border [&_th]:border-neutral-200 [&_th]:px-2 [&_th]:py-1 [&_th]:text-start dark:[&_th]:border-neutral-700",
|
|
1054
|
+
props.className
|
|
760
1055
|
)
|
|
761
1056
|
}
|
|
762
|
-
)
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
};
|
|
777
|
-
const handleEditPaste = (e) => {
|
|
778
|
-
const files = Array.from(e.clipboardData.items).filter((item) => item.kind === "file" && item.type.startsWith("image/")).map((item) => item.getAsFile()).filter((f) => f !== null);
|
|
779
|
-
if (files.length === 0) return;
|
|
780
|
-
e.preventDefault();
|
|
781
|
-
const el = e.currentTarget;
|
|
782
|
-
const start = el.selectionStart ?? draft.length;
|
|
783
|
-
const end = el.selectionEnd ?? draft.length;
|
|
784
|
-
Promise.all(
|
|
785
|
-
files.map(
|
|
786
|
-
(file, i) => new Promise((resolve) => {
|
|
787
|
-
const reader = new window.FileReader();
|
|
788
|
-
reader.onload = () => {
|
|
789
|
-
const dataUrl = typeof reader.result === "string" ? reader.result : "";
|
|
790
|
-
const name = file.name || `pasted-image-${i + 1}.png`;
|
|
791
|
-
resolve(dataUrl ? `` : "");
|
|
792
|
-
};
|
|
793
|
-
reader.readAsDataURL(file);
|
|
794
|
-
})
|
|
795
|
-
)
|
|
796
|
-
).then((snippets) => {
|
|
797
|
-
const insert = snippets.filter(Boolean).join("\n");
|
|
798
|
-
if (!insert) return;
|
|
799
|
-
el.focus();
|
|
800
|
-
el.setSelectionRange(start, end);
|
|
801
|
-
const text = `${insert}
|
|
802
|
-
`;
|
|
803
|
-
const inserted = typeof document !== "undefined" && typeof document.execCommand === "function" && document.execCommand("insertText", false, text);
|
|
804
|
-
if (!inserted) {
|
|
805
|
-
setDraft((prev) => `${prev.slice(0, start)}${text}${prev.slice(end)}`);
|
|
1057
|
+
) }),
|
|
1058
|
+
// Tailwind's preflight resets list markers/padding; restore them explicitly
|
|
1059
|
+
// so bullets/numbers show without depending on the typography plugin.
|
|
1060
|
+
ul: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ul", { ...props, className: chunkS5RVSXDV_cjs.cn("list-disc ps-5", props.className) }),
|
|
1061
|
+
ol: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("ol", { ...props, className: chunkS5RVSXDV_cjs.cn("list-decimal ps-5", props.className) }),
|
|
1062
|
+
li: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { ...props, className: chunkS5RVSXDV_cjs.cn("ps-1", props.className) }),
|
|
1063
|
+
// Preflight also flattens headings to body size/weight; restore a sensible
|
|
1064
|
+
// hierarchy without depending on the typography plugin.
|
|
1065
|
+
h1: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1066
|
+
"h1",
|
|
1067
|
+
{
|
|
1068
|
+
...props,
|
|
1069
|
+
className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-xl font-semibold", props.className),
|
|
1070
|
+
children
|
|
806
1071
|
}
|
|
807
|
-
|
|
808
|
-
})
|
|
809
|
-
|
|
810
|
-
const actions = [
|
|
811
|
-
...canCopy ? [
|
|
1072
|
+
),
|
|
1073
|
+
h2: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1074
|
+
"h2",
|
|
812
1075
|
{
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
{
|
|
833
|
-
id: "copy-plain",
|
|
834
|
-
label: "Copy as plain text",
|
|
835
|
-
onSelect: copy.copyPlain
|
|
836
|
-
}
|
|
837
|
-
]
|
|
838
|
-
}
|
|
1076
|
+
...props,
|
|
1077
|
+
className: chunkS5RVSXDV_cjs.cn("mt-3 mb-1 text-lg font-semibold", props.className),
|
|
1078
|
+
children
|
|
1079
|
+
}
|
|
1080
|
+
),
|
|
1081
|
+
h3: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1082
|
+
"h3",
|
|
1083
|
+
{
|
|
1084
|
+
...props,
|
|
1085
|
+
className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-base font-semibold", props.className),
|
|
1086
|
+
children
|
|
1087
|
+
}
|
|
1088
|
+
),
|
|
1089
|
+
h4: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1090
|
+
"h4",
|
|
1091
|
+
{
|
|
1092
|
+
...props,
|
|
1093
|
+
className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
|
|
1094
|
+
children
|
|
839
1095
|
}
|
|
840
|
-
|
|
841
|
-
...
|
|
1096
|
+
),
|
|
1097
|
+
h5: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1098
|
+
"h5",
|
|
842
1099
|
{
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
onSelect: startEdit
|
|
1100
|
+
...props,
|
|
1101
|
+
className: chunkS5RVSXDV_cjs.cn("mt-2 mb-1 text-sm font-semibold", props.className),
|
|
1102
|
+
children
|
|
847
1103
|
}
|
|
848
|
-
|
|
1104
|
+
),
|
|
1105
|
+
h6: ({ node: _node, children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1106
|
+
"h6",
|
|
1107
|
+
{
|
|
1108
|
+
...props,
|
|
1109
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1110
|
+
"mt-2 mb-1 text-xs font-semibold tracking-wide uppercase",
|
|
1111
|
+
props.className
|
|
1112
|
+
),
|
|
1113
|
+
children
|
|
1114
|
+
}
|
|
1115
|
+
),
|
|
1116
|
+
hr: ({ node: _node, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1117
|
+
"hr",
|
|
1118
|
+
{
|
|
1119
|
+
...props,
|
|
1120
|
+
className: chunkS5RVSXDV_cjs.cn(
|
|
1121
|
+
"my-2 border-neutral-300 dark:border-neutral-600",
|
|
1122
|
+
props.className
|
|
1123
|
+
)
|
|
1124
|
+
}
|
|
1125
|
+
)
|
|
1126
|
+
};
|
|
1127
|
+
}
|
|
1128
|
+
function createMarkdownRenderer(options = {}) {
|
|
1129
|
+
const { plugins = [], trusted = false } = options;
|
|
1130
|
+
const remarkPlugins = [
|
|
1131
|
+
remarkGfm__default.default,
|
|
1132
|
+
remarkPreserveLineBreaks,
|
|
1133
|
+
...plugins.flatMap((p) => p.remarkPlugins ?? [])
|
|
849
1134
|
];
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
{
|
|
853
|
-
"data-slot": "superchat-message",
|
|
854
|
-
role: "article",
|
|
855
|
-
"aria-label": `${authorName}, ${formatTime(message.time)}`,
|
|
856
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
857
|
-
"group flex gap-2",
|
|
858
|
-
isSelf ? "flex-row-reverse" : "flex-row"
|
|
859
|
-
),
|
|
860
|
-
children: [
|
|
861
|
-
/* @__PURE__ */ jsxRuntime.jsx(ParticipantAvatar, { participant }),
|
|
862
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: chunkS5RVSXDV_cjs.cn("flex min-w-0 flex-col gap-1", isSelf && "items-end"), children: [
|
|
863
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
864
|
-
"div",
|
|
865
|
-
{
|
|
866
|
-
"data-slot": "superchat-message-meta",
|
|
867
|
-
className: "flex items-baseline gap-2",
|
|
868
|
-
children: [
|
|
869
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
870
|
-
"span",
|
|
871
|
-
{
|
|
872
|
-
className: "text-xs font-medium",
|
|
873
|
-
style: accentTextColor ? { color: accentTextColor } : void 0,
|
|
874
|
-
children: authorName
|
|
875
|
-
}
|
|
876
|
-
),
|
|
877
|
-
participant?.role && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: participant.role }),
|
|
878
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[10px] text-neutral-500 dark:text-neutral-400", children: formatTime(message.time) }),
|
|
879
|
-
message.editedAt && /* @__PURE__ */ jsxRuntime.jsx(
|
|
880
|
-
"span",
|
|
881
|
-
{
|
|
882
|
-
"data-slot": "superchat-edited-indicator",
|
|
883
|
-
className: "text-[10px] text-neutral-500 dark:text-neutral-400",
|
|
884
|
-
title: `Edited ${formatTime(message.editedAt)}`,
|
|
885
|
-
children: "(edited)"
|
|
886
|
-
}
|
|
887
|
-
)
|
|
888
|
-
]
|
|
889
|
-
}
|
|
890
|
-
),
|
|
891
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
892
|
-
"div",
|
|
893
|
-
{
|
|
894
|
-
className: chunkS5RVSXDV_cjs.cn(
|
|
895
|
-
"flex items-center gap-1",
|
|
896
|
-
isSelf ? "flex-row-reverse" : "flex-row"
|
|
897
|
-
),
|
|
898
|
-
children: [
|
|
899
|
-
hasActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
900
|
-
MessageOverflowMenu,
|
|
901
|
-
{
|
|
902
|
-
isSelf,
|
|
903
|
-
actions,
|
|
904
|
-
footerVisible
|
|
905
|
-
}
|
|
906
|
-
),
|
|
907
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
908
|
-
chunkWIAQQNFU_cjs.ChatBubble,
|
|
909
|
-
{
|
|
910
|
-
ref: bubbleRef,
|
|
911
|
-
"data-slot": "superchat-bubble",
|
|
912
|
-
variant: isSelf ? "user" : "assistant",
|
|
913
|
-
hasError: message.status === "error",
|
|
914
|
-
className: "text-sm has-[[data-slot=superchat-nitro-table]]:w-full has-[[data-slot=superchat-nitro-table]]:max-w-full",
|
|
915
|
-
children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
916
|
-
"div",
|
|
917
|
-
{
|
|
918
|
-
"data-slot": "superchat-message-editor",
|
|
919
|
-
className: "flex w-80 max-w-full flex-col gap-2",
|
|
920
|
-
children: [
|
|
921
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
922
|
-
"textarea",
|
|
923
|
-
{
|
|
924
|
-
value: draft,
|
|
925
|
-
ref: editRef,
|
|
926
|
-
rows: 2,
|
|
927
|
-
onChange: (e) => {
|
|
928
|
-
setDraft(e.target.value);
|
|
929
|
-
autosize();
|
|
930
|
-
},
|
|
931
|
-
onPaste: handleEditPaste,
|
|
932
|
-
onKeyDown: (e) => {
|
|
933
|
-
if (e.key === "Enter" && !e.shiftKey) {
|
|
934
|
-
e.preventDefault();
|
|
935
|
-
saveEdit();
|
|
936
|
-
} else if (e.key === "Escape") {
|
|
937
|
-
e.preventDefault();
|
|
938
|
-
cancelEdit();
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
"aria-label": "Edit message",
|
|
942
|
-
className: "focus:ring-primary-500 max-h-60 min-h-16 w-full resize-none rounded-lg border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 focus:ring-1 focus:outline-none dark:border-neutral-600 dark:bg-neutral-900 dark:text-white"
|
|
943
|
-
}
|
|
944
|
-
),
|
|
945
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
946
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
947
|
-
"button",
|
|
948
|
-
{
|
|
949
|
-
type: "button",
|
|
950
|
-
onClick: cancelEdit,
|
|
951
|
-
className: "rounded-md px-2.5 py-1 text-xs font-medium text-neutral-200 hover:bg-white/10",
|
|
952
|
-
children: "Cancel"
|
|
953
|
-
}
|
|
954
|
-
),
|
|
955
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
956
|
-
"button",
|
|
957
|
-
{
|
|
958
|
-
type: "button",
|
|
959
|
-
onClick: saveEdit,
|
|
960
|
-
disabled: !draft.trim() || draft.trim() === message.text,
|
|
961
|
-
className: "rounded-md bg-white px-2.5 py-1 text-xs font-medium text-neutral-900 hover:bg-neutral-100 disabled:opacity-40",
|
|
962
|
-
children: "Save"
|
|
963
|
-
}
|
|
964
|
-
)
|
|
965
|
-
] })
|
|
966
|
-
]
|
|
967
|
-
}
|
|
968
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
969
|
-
message.content?.map((block, i) => {
|
|
970
|
-
if (block.type === "tool_use" && block.toolCall) {
|
|
971
|
-
return /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.MCPToolCallDisplay, { toolCall: block.toolCall }, i);
|
|
972
|
-
}
|
|
973
|
-
if ((block.type === "text" || block.type === "thinking") && block.text) {
|
|
974
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
975
|
-
"div",
|
|
976
|
-
{
|
|
977
|
-
className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
|
|
978
|
-
children: renderText(block.text, {
|
|
979
|
-
messageId: message.id,
|
|
980
|
-
streaming,
|
|
981
|
-
role: participant?.kind === "human" ? "user" : "assistant"
|
|
982
|
-
})
|
|
983
|
-
},
|
|
984
|
-
i
|
|
985
|
-
);
|
|
986
|
-
}
|
|
987
|
-
if (block.type === "code" && block.text) {
|
|
988
|
-
const fenced = `\`\`\`${block.language ?? ""}
|
|
989
|
-
${block.text}
|
|
990
|
-
\`\`\``;
|
|
991
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
992
|
-
"div",
|
|
993
|
-
{
|
|
994
|
-
className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word",
|
|
995
|
-
children: renderText(fenced, {
|
|
996
|
-
messageId: message.id,
|
|
997
|
-
streaming,
|
|
998
|
-
role: participant?.kind === "human" ? "user" : "assistant"
|
|
999
|
-
})
|
|
1000
|
-
},
|
|
1001
|
-
i
|
|
1002
|
-
);
|
|
1003
|
-
}
|
|
1004
|
-
return null;
|
|
1005
|
-
}),
|
|
1006
|
-
message.text && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none **:wrap-break-word", children: renderText(message.text, {
|
|
1007
|
-
messageId: message.id,
|
|
1008
|
-
streaming,
|
|
1009
|
-
role: participant?.kind === "human" ? "user" : "assistant"
|
|
1010
|
-
}) }),
|
|
1011
|
-
streaming && !hasBody && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(chunkWIAQQNFU_cjs.AITypingIndicator, {}) })
|
|
1012
|
-
] })
|
|
1013
|
-
}
|
|
1014
|
-
)
|
|
1015
|
-
]
|
|
1016
|
-
}
|
|
1017
|
-
),
|
|
1018
|
-
hasActions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1019
|
-
MessageActionsBar,
|
|
1020
|
-
{
|
|
1021
|
-
ref: actionsBarRef,
|
|
1022
|
-
actions,
|
|
1023
|
-
isSelf
|
|
1024
|
-
}
|
|
1025
|
-
)
|
|
1026
|
-
] })
|
|
1027
|
-
]
|
|
1028
|
-
}
|
|
1135
|
+
const pluginRehype = plugins.flatMap(
|
|
1136
|
+
(p) => p.rehypePlugins ?? []
|
|
1029
1137
|
);
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1138
|
+
const sanitizeSchema = plugins.reduce(
|
|
1139
|
+
(acc, p) => mergeSanitizeSchema(acc, p.sanitizeSchema),
|
|
1140
|
+
baseSanitizeSchema()
|
|
1141
|
+
);
|
|
1142
|
+
const rehypePlugins = trusted ? pluginRehype : [...pluginRehype, [rehypeSanitize__default.default, sanitizeSchema]];
|
|
1143
|
+
const components = plugins.reduce(
|
|
1144
|
+
(acc, p) => ({ ...acc, ...p.components }),
|
|
1145
|
+
baseComponents()
|
|
1146
|
+
);
|
|
1147
|
+
const MarkdownRenderer = (text, ctx) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1148
|
+
MarkdownContent,
|
|
1149
|
+
{
|
|
1150
|
+
text,
|
|
1151
|
+
messageId: ctx.messageId,
|
|
1152
|
+
streaming: ctx.streaming,
|
|
1153
|
+
remarkPlugins,
|
|
1154
|
+
rehypePlugins,
|
|
1155
|
+
components
|
|
1039
1156
|
},
|
|
1040
|
-
|
|
1157
|
+
ctx.messageId
|
|
1158
|
+
);
|
|
1159
|
+
return MarkdownRenderer;
|
|
1160
|
+
}
|
|
1161
|
+
var transformUrl = (url, key, node) => {
|
|
1162
|
+
if (key === "src" && node.tagName === "img" && (/^data:image\//i.test(url) || /^blob:/i.test(url))) {
|
|
1163
|
+
return url;
|
|
1041
1164
|
}
|
|
1042
|
-
);
|
|
1165
|
+
return Markdown.defaultUrlTransform(url);
|
|
1166
|
+
};
|
|
1167
|
+
var MarkdownContent = React3__namespace.memo(function MarkdownContent2({
|
|
1168
|
+
text,
|
|
1169
|
+
messageId,
|
|
1170
|
+
streaming,
|
|
1171
|
+
remarkPlugins,
|
|
1172
|
+
rehypePlugins,
|
|
1173
|
+
components
|
|
1174
|
+
}) {
|
|
1175
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkJFLC7SHM_cjs.TextRenderContext.Provider, { value: { messageId, streaming }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1176
|
+
Markdown__default.default,
|
|
1177
|
+
{
|
|
1178
|
+
remarkPlugins,
|
|
1179
|
+
rehypePlugins,
|
|
1180
|
+
urlTransform: transformUrl,
|
|
1181
|
+
components,
|
|
1182
|
+
children: text
|
|
1183
|
+
}
|
|
1184
|
+
) });
|
|
1185
|
+
});
|
|
1043
1186
|
function VirtualThread({
|
|
1044
1187
|
items,
|
|
1045
1188
|
participantById,
|
|
@@ -1050,32 +1193,28 @@ function VirtualThread({
|
|
|
1050
1193
|
editable,
|
|
1051
1194
|
onMessageEdited,
|
|
1052
1195
|
defaultCopyFormat,
|
|
1053
|
-
|
|
1054
|
-
|
|
1196
|
+
onOpenMedia,
|
|
1197
|
+
openMediaLabel,
|
|
1198
|
+
playMediaLabel,
|
|
1199
|
+
mediaErrorLabel,
|
|
1200
|
+
mediaRetryLabel,
|
|
1201
|
+
scrollRef,
|
|
1202
|
+
contentRef,
|
|
1055
1203
|
containerProps
|
|
1056
1204
|
}) {
|
|
1057
|
-
const parentRef = React2__namespace.useRef(null);
|
|
1058
1205
|
const virtualizer = reactVirtual.useVirtualizer({
|
|
1059
1206
|
count: items.length,
|
|
1060
|
-
getScrollElement: () =>
|
|
1207
|
+
getScrollElement: () => scrollRef.current,
|
|
1061
1208
|
// Rough first guess; real heights are measured via measureElement.
|
|
1062
1209
|
estimateSize: () => 88,
|
|
1063
1210
|
overscan: 10,
|
|
1064
1211
|
getItemKey: (index) => items[index]?.id ?? index
|
|
1065
1212
|
});
|
|
1066
|
-
const count = items.length;
|
|
1067
|
-
React2__namespace.useEffect(() => {
|
|
1068
|
-
if (count === 0) return;
|
|
1069
|
-
if (order === "desc") {
|
|
1070
|
-
virtualizer.scrollToIndex(0, { align: "start" });
|
|
1071
|
-
} else {
|
|
1072
|
-
virtualizer.scrollToIndex(count - 1, { align: "end" });
|
|
1073
|
-
}
|
|
1074
|
-
}, [count, conversationId, order]);
|
|
1075
1213
|
const virtualItems = virtualizer.getVirtualItems();
|
|
1076
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...containerProps, ref:
|
|
1214
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ...containerProps, ref: scrollRef, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1077
1215
|
"div",
|
|
1078
1216
|
{
|
|
1217
|
+
ref: contentRef,
|
|
1079
1218
|
style: {
|
|
1080
1219
|
height: virtualizer.getTotalSize(),
|
|
1081
1220
|
position: "relative",
|
|
@@ -1107,7 +1246,12 @@ function VirtualThread({
|
|
|
1107
1246
|
onReferenceClick,
|
|
1108
1247
|
editable,
|
|
1109
1248
|
onMessageEdited,
|
|
1110
|
-
defaultCopyFormat
|
|
1249
|
+
defaultCopyFormat,
|
|
1250
|
+
onOpenMedia,
|
|
1251
|
+
openMediaLabel,
|
|
1252
|
+
playMediaLabel,
|
|
1253
|
+
mediaErrorLabel,
|
|
1254
|
+
mediaRetryLabel
|
|
1111
1255
|
}
|
|
1112
1256
|
) })
|
|
1113
1257
|
},
|
|
@@ -1119,6 +1263,11 @@ function VirtualThread({
|
|
|
1119
1263
|
}
|
|
1120
1264
|
function SuperChat({
|
|
1121
1265
|
conversation,
|
|
1266
|
+
view,
|
|
1267
|
+
defaultView = "thread",
|
|
1268
|
+
onViewChange,
|
|
1269
|
+
mediaFeedProps,
|
|
1270
|
+
mediaLabels,
|
|
1122
1271
|
currentParticipantId,
|
|
1123
1272
|
renderPlugins,
|
|
1124
1273
|
renderTextContent,
|
|
@@ -1130,44 +1279,366 @@ function SuperChat({
|
|
|
1130
1279
|
linkBuilder,
|
|
1131
1280
|
defaultCopyFormat,
|
|
1132
1281
|
className,
|
|
1282
|
+
showHeader = true,
|
|
1283
|
+
placeholder,
|
|
1284
|
+
allowAttachments,
|
|
1285
|
+
agents,
|
|
1286
|
+
selectedAgent,
|
|
1287
|
+
onAgentChange,
|
|
1288
|
+
agentSelectorLabel,
|
|
1289
|
+
modelSelectorProps,
|
|
1290
|
+
isStreaming,
|
|
1291
|
+
onStop,
|
|
1292
|
+
stopLabel,
|
|
1133
1293
|
onMessageSent,
|
|
1134
1294
|
onMessageEdited,
|
|
1135
1295
|
onConversationClosed,
|
|
1136
1296
|
onReferenceClick,
|
|
1137
1297
|
onBack
|
|
1138
1298
|
}) {
|
|
1139
|
-
const headingId =
|
|
1140
|
-
|
|
1141
|
-
|
|
1299
|
+
const headingId = React3__namespace.useId();
|
|
1300
|
+
const [internalView, setInternalView] = React3__namespace.useState({
|
|
1301
|
+
conversationId: conversation.id,
|
|
1302
|
+
view: defaultView
|
|
1303
|
+
});
|
|
1304
|
+
const activeView = view ?? (internalView.conversationId === conversation.id ? internalView.view : "thread");
|
|
1305
|
+
const labels = {
|
|
1306
|
+
backToConversation: "Back to conversation",
|
|
1307
|
+
openMedia: "Open in media feed",
|
|
1308
|
+
playMedia: "Play",
|
|
1309
|
+
unknownAuthor: "Unknown",
|
|
1310
|
+
...mediaLabels
|
|
1311
|
+
};
|
|
1312
|
+
const mediaItems = React3__namespace.useMemo(() => {
|
|
1313
|
+
const items = getConversationMediaItems(conversation);
|
|
1314
|
+
return order === "desc" ? items.reverse() : items;
|
|
1315
|
+
}, [conversation, order]);
|
|
1316
|
+
const [mediaSelection, setMediaSelection] = React3__namespace.useState();
|
|
1317
|
+
const [manualPlaybackRequest, setManualPlaybackRequest] = React3__namespace.useState();
|
|
1318
|
+
const playbackRequestCounter = React3__namespace.useRef(0);
|
|
1319
|
+
const mediaFeedRef = React3__namespace.useRef(null);
|
|
1320
|
+
const backToConversationRef = React3__namespace.useRef(null);
|
|
1321
|
+
const focusMediaOnOpenRef = React3__namespace.useRef(false);
|
|
1322
|
+
const focusThreadOnBackRef = React3__namespace.useRef(false);
|
|
1323
|
+
const mediaReturnTargetRef = React3__namespace.useRef(void 0);
|
|
1324
|
+
const mediaContextRef = React3__namespace.useRef({
|
|
1325
|
+
conversation,
|
|
1326
|
+
view,
|
|
1327
|
+
onViewChange,
|
|
1328
|
+
mediaFeedProps,
|
|
1329
|
+
mediaItems
|
|
1330
|
+
});
|
|
1331
|
+
mediaContextRef.current = {
|
|
1332
|
+
conversation,
|
|
1333
|
+
view,
|
|
1334
|
+
onViewChange,
|
|
1335
|
+
mediaFeedProps,
|
|
1336
|
+
mediaItems
|
|
1337
|
+
};
|
|
1338
|
+
const setView = React3__namespace.useCallback((next) => {
|
|
1339
|
+
const context = mediaContextRef.current;
|
|
1340
|
+
if (context.view === void 0)
|
|
1341
|
+
setInternalView({ conversationId: context.conversation.id, view: next });
|
|
1342
|
+
context.onViewChange?.(next, { conversation: context.conversation });
|
|
1343
|
+
}, []);
|
|
1344
|
+
const handleMediaSelection = React3__namespace.useCallback((item) => {
|
|
1345
|
+
setMediaSelection({ conversationId: item.conversationId, itemId: item.id });
|
|
1346
|
+
mediaContextRef.current.mediaFeedProps?.onActiveItemChange?.(item);
|
|
1347
|
+
}, []);
|
|
1348
|
+
const handleOpenMedia = React3__namespace.useCallback(
|
|
1349
|
+
(messageId, attachmentId, play = false) => {
|
|
1350
|
+
const item = mediaContextRef.current.mediaItems.find(
|
|
1351
|
+
(candidate) => candidate.message.id === messageId && candidate.attachment.id === attachmentId
|
|
1352
|
+
);
|
|
1353
|
+
if (!item) return;
|
|
1354
|
+
handleMediaSelection(item);
|
|
1355
|
+
mediaReturnTargetRef.current = {
|
|
1356
|
+
conversationId: item.conversationId,
|
|
1357
|
+
messageId,
|
|
1358
|
+
attachmentId
|
|
1359
|
+
};
|
|
1360
|
+
focusMediaOnOpenRef.current = true;
|
|
1361
|
+
setManualPlaybackRequest(
|
|
1362
|
+
play ? {
|
|
1363
|
+
conversationId: item.conversationId,
|
|
1364
|
+
itemId: item.id,
|
|
1365
|
+
requestId: ++playbackRequestCounter.current
|
|
1366
|
+
} : void 0
|
|
1367
|
+
);
|
|
1368
|
+
setView("media");
|
|
1369
|
+
},
|
|
1370
|
+
[handleMediaSelection, setView]
|
|
1371
|
+
);
|
|
1372
|
+
const handleBackToConversation = React3__namespace.useCallback(() => {
|
|
1373
|
+
focusMediaOnOpenRef.current = false;
|
|
1374
|
+
focusThreadOnBackRef.current = true;
|
|
1375
|
+
setManualPlaybackRequest(void 0);
|
|
1376
|
+
setView("thread");
|
|
1377
|
+
}, [setView]);
|
|
1378
|
+
const hostPlaybackRequest = mediaFeedProps?.playbackRequest;
|
|
1379
|
+
const hostPlaybackKey = hostPlaybackRequest ? `${hostPlaybackRequest.itemId}\0${hostPlaybackRequest.requestId}` : void 0;
|
|
1380
|
+
React3__namespace.useEffect(() => {
|
|
1381
|
+
if (hostPlaybackKey === void 0) return;
|
|
1382
|
+
setManualPlaybackRequest(void 0);
|
|
1383
|
+
}, [hostPlaybackKey]);
|
|
1384
|
+
React3__namespace.useEffect(() => {
|
|
1385
|
+
if (internalView.conversationId !== conversation.id) {
|
|
1386
|
+
setInternalView({ conversationId: conversation.id, view: "thread" });
|
|
1387
|
+
}
|
|
1388
|
+
if (mediaReturnTargetRef.current?.conversationId !== conversation.id) {
|
|
1389
|
+
mediaReturnTargetRef.current = void 0;
|
|
1390
|
+
focusMediaOnOpenRef.current = false;
|
|
1391
|
+
focusThreadOnBackRef.current = false;
|
|
1392
|
+
setManualPlaybackRequest(void 0);
|
|
1393
|
+
}
|
|
1394
|
+
}, [conversation.id, internalView.conversationId]);
|
|
1395
|
+
React3__namespace.useEffect(() => {
|
|
1396
|
+
if (activeView !== "media" || !focusMediaOnOpenRef.current) return;
|
|
1397
|
+
const target = mediaFeedRef.current?.querySelector(
|
|
1398
|
+
'article[tabindex="0"]'
|
|
1399
|
+
) ?? mediaFeedRef.current?.querySelector('[role="feed"]');
|
|
1400
|
+
if (target) focusMediaOnOpenRef.current = false;
|
|
1401
|
+
(target ?? backToConversationRef.current)?.focus({ preventScroll: true });
|
|
1402
|
+
}, [
|
|
1403
|
+
activeView,
|
|
1404
|
+
mediaFeedProps?.loading,
|
|
1405
|
+
mediaFeedProps?.error,
|
|
1406
|
+
mediaItems.length
|
|
1407
|
+
]);
|
|
1408
|
+
React3__namespace.useEffect(() => {
|
|
1409
|
+
chunkR5Z7AOVU_cjs.notifyComposerMigrationOnce("SuperChat");
|
|
1142
1410
|
}, []);
|
|
1143
|
-
const renderText =
|
|
1411
|
+
const renderText = React3__namespace.useMemo(
|
|
1144
1412
|
() => renderTextContent ?? createMarkdownRenderer({
|
|
1145
1413
|
plugins: renderPlugins,
|
|
1146
1414
|
trusted: trustedContent
|
|
1147
1415
|
}),
|
|
1148
1416
|
[renderTextContent, renderPlugins, trustedContent]
|
|
1149
1417
|
);
|
|
1150
|
-
const
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1418
|
+
const prefersReducedMotion = chunkYW2AKBLS_cjs.usePrefersReducedMotion();
|
|
1419
|
+
const {
|
|
1420
|
+
containerRef: threadRef,
|
|
1421
|
+
contentRef: threadContentRef,
|
|
1422
|
+
isAtBottom,
|
|
1423
|
+
scrollToBottom,
|
|
1424
|
+
anchorToTurnStart,
|
|
1425
|
+
followIfPinned,
|
|
1426
|
+
stopFollowing
|
|
1427
|
+
} = chunkVPTASZ2O_cjs.useStickToBottom({
|
|
1428
|
+
disabled: order === "desc" || activeView === "media"
|
|
1429
|
+
});
|
|
1430
|
+
React3__namespace.useEffect(() => {
|
|
1431
|
+
if (activeView !== "thread") return;
|
|
1432
|
+
setManualPlaybackRequest(void 0);
|
|
1433
|
+
if (!focusThreadOnBackRef.current) return;
|
|
1434
|
+
focusThreadOnBackRef.current = false;
|
|
1435
|
+
const source = mediaReturnTargetRef.current;
|
|
1436
|
+
const launchId = source ? JSON.stringify([source.messageId, source.attachmentId]) : void 0;
|
|
1437
|
+
const launcher = source?.conversationId === conversation.id ? Array.from(
|
|
1438
|
+
threadRef.current?.querySelectorAll(
|
|
1439
|
+
"[data-media-launch-id]"
|
|
1440
|
+
) ?? []
|
|
1441
|
+
).find((button) => button.dataset.mediaLaunchId === launchId) : void 0;
|
|
1442
|
+
(launcher ?? threadRef.current)?.focus({ preventScroll: true });
|
|
1443
|
+
}, [activeView, conversation.id, threadRef]);
|
|
1444
|
+
const [hasNewBelow, setHasNewBelow] = React3__namespace.useState(false);
|
|
1445
|
+
const [turnStartId, setTurnStartId] = React3__namespace.useState(null);
|
|
1446
|
+
const [turnMinHeight, setTurnMinHeight] = React3__namespace.useState();
|
|
1447
|
+
const anchoredTurnRef = React3__namespace.useRef(null);
|
|
1448
|
+
const threadSnapshotRef = React3__namespace.useRef(void 0);
|
|
1449
|
+
const atBottomRef = React3__namespace.useRef(isAtBottom);
|
|
1450
|
+
atBottomRef.current = isAtBottom;
|
|
1451
|
+
const pendingMediaOwnSendRef = React3__namespace.useRef(false);
|
|
1452
|
+
const pendingMediaAppendRef = React3__namespace.useRef(false);
|
|
1453
|
+
React3__namespace.useEffect(() => {
|
|
1454
|
+
threadSnapshotRef.current = void 0;
|
|
1455
|
+
pendingMediaOwnSendRef.current = false;
|
|
1456
|
+
pendingMediaAppendRef.current = false;
|
|
1457
|
+
setTurnStartId(null);
|
|
1458
|
+
anchoredTurnRef.current = null;
|
|
1459
|
+
if (order === "desc") {
|
|
1460
|
+
const el = threadRef.current;
|
|
1461
|
+
if (el) el.scrollTop = 0;
|
|
1462
|
+
} else {
|
|
1463
|
+
scrollToBottom("auto");
|
|
1464
|
+
}
|
|
1465
|
+
setHasNewBelow(false);
|
|
1466
|
+
}, [conversation.id, order]);
|
|
1467
|
+
const threadLength = conversation.thread.length;
|
|
1468
|
+
const prevThreadLengthRef = React3__namespace.useRef(threadLength);
|
|
1469
|
+
const prevMessageIdsRef = React3__namespace.useRef(
|
|
1470
|
+
new Set(conversation.thread.map((message) => message.id))
|
|
1471
|
+
);
|
|
1472
|
+
const policyConversationRef = React3__namespace.useRef(conversation.id);
|
|
1473
|
+
const policyBaselinedRef = React3__namespace.useRef(false);
|
|
1474
|
+
React3__namespace.useEffect(() => {
|
|
1475
|
+
if (!policyBaselinedRef.current || policyConversationRef.current !== conversation.id) {
|
|
1476
|
+
policyBaselinedRef.current = true;
|
|
1477
|
+
policyConversationRef.current = conversation.id;
|
|
1478
|
+
prevThreadLengthRef.current = threadLength;
|
|
1479
|
+
prevMessageIdsRef.current = new Set(
|
|
1480
|
+
conversation.thread.map((message) => message.id)
|
|
1481
|
+
);
|
|
1482
|
+
if (order !== "desc" && [...conversation.thread].sort(byTime).at(-1)?.status === "streaming") {
|
|
1483
|
+
stopFollowing();
|
|
1484
|
+
}
|
|
1485
|
+
return;
|
|
1486
|
+
}
|
|
1487
|
+
if (threadLength === prevThreadLengthRef.current) return;
|
|
1488
|
+
const grew = threadLength > prevThreadLengthRef.current;
|
|
1489
|
+
prevThreadLengthRef.current = threadLength;
|
|
1490
|
+
if (grew && activeView === "media") pendingMediaAppendRef.current = true;
|
|
1491
|
+
if (order === "desc") {
|
|
1492
|
+
const el = threadRef.current;
|
|
1493
|
+
if (el) el.scrollTop = 0;
|
|
1494
|
+
return;
|
|
1495
|
+
}
|
|
1496
|
+
const prevIds = prevMessageIdsRef.current;
|
|
1497
|
+
let turnStart;
|
|
1498
|
+
if (grew && currentParticipantId) {
|
|
1499
|
+
for (const message of [...conversation.thread].sort(byTime)) {
|
|
1500
|
+
if (!prevIds.has(message.id) && message.participantId === currentParticipantId) {
|
|
1501
|
+
turnStart = message.id;
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
if (turnStart) {
|
|
1506
|
+
if (activeView === "media") pendingMediaOwnSendRef.current = true;
|
|
1507
|
+
if (virtualized) {
|
|
1508
|
+
scrollToBottom("auto");
|
|
1509
|
+
} else {
|
|
1510
|
+
setTurnStartId(turnStart);
|
|
1511
|
+
}
|
|
1512
|
+
} else if (grew) {
|
|
1513
|
+
const newest = [...conversation.thread].sort(byTime).at(-1);
|
|
1514
|
+
if (newest?.status === "streaming") {
|
|
1515
|
+
followIfPinned("auto");
|
|
1516
|
+
stopFollowing();
|
|
1517
|
+
} else if (!followIfPinned("auto")) {
|
|
1518
|
+
setHasNewBelow(true);
|
|
1519
|
+
}
|
|
1520
|
+
} else {
|
|
1521
|
+
followIfPinned("auto");
|
|
1522
|
+
}
|
|
1523
|
+
}, [threadLength, order, isAtBottom, conversation.id, activeView]);
|
|
1524
|
+
React3__namespace.useLayoutEffect(() => {
|
|
1525
|
+
if (activeView !== "thread") return;
|
|
1526
|
+
const container = threadRef.current;
|
|
1527
|
+
if (!container) return;
|
|
1528
|
+
const snapshot = threadSnapshotRef.current;
|
|
1529
|
+
const sameThread = snapshot?.conversationId === conversation.id && snapshot.order === order;
|
|
1530
|
+
const ownSend = pendingMediaOwnSendRef.current;
|
|
1531
|
+
const appended = pendingMediaAppendRef.current;
|
|
1532
|
+
pendingMediaOwnSendRef.current = false;
|
|
1533
|
+
pendingMediaAppendRef.current = false;
|
|
1534
|
+
if (order === "desc") {
|
|
1535
|
+
container.scrollTop = sameThread && !appended ? snapshot.scrollTop : 0;
|
|
1536
|
+
} else if (ownSend && !virtualized) ; else if (sameThread && !ownSend && (!snapshot.atBottom || !appended)) {
|
|
1537
|
+
container.scrollTop = snapshot.scrollTop;
|
|
1538
|
+
if (!snapshot.atBottom) stopFollowing();
|
|
1539
|
+
} else {
|
|
1540
|
+
scrollToBottom("auto");
|
|
1541
|
+
if ([...conversation.thread].sort(byTime).at(-1)?.status === "streaming")
|
|
1542
|
+
stopFollowing();
|
|
1543
|
+
}
|
|
1544
|
+
return () => {
|
|
1545
|
+
threadSnapshotRef.current = {
|
|
1546
|
+
conversationId: conversation.id,
|
|
1547
|
+
order,
|
|
1548
|
+
scrollTop: container.scrollTop,
|
|
1549
|
+
atBottom: atBottomRef.current
|
|
1550
|
+
};
|
|
1551
|
+
};
|
|
1552
|
+
}, [conversation.id, order, activeView, virtualized]);
|
|
1553
|
+
React3__namespace.useLayoutEffect(() => {
|
|
1554
|
+
if (!turnStartId || anchoredTurnRef.current === turnStartId) return;
|
|
1555
|
+
const container = threadRef.current;
|
|
1556
|
+
if (!container) return;
|
|
1557
|
+
const reserve = Math.max(0, container.clientHeight - 32);
|
|
1558
|
+
if (turnMinHeight !== reserve) {
|
|
1559
|
+
setTurnMinHeight(reserve);
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
const target = container.querySelector(
|
|
1563
|
+
'[data-slot="superchat-turn"]'
|
|
1564
|
+
);
|
|
1565
|
+
if (target) {
|
|
1566
|
+
anchorToTurnStart(target, prefersReducedMotion ? "auto" : "smooth");
|
|
1567
|
+
anchoredTurnRef.current = turnStartId;
|
|
1568
|
+
}
|
|
1569
|
+
}, [
|
|
1570
|
+
turnStartId,
|
|
1571
|
+
turnMinHeight,
|
|
1572
|
+
anchorToTurnStart,
|
|
1573
|
+
prefersReducedMotion,
|
|
1574
|
+
threadRef,
|
|
1575
|
+
activeView
|
|
1576
|
+
]);
|
|
1577
|
+
React3__namespace.useEffect(() => {
|
|
1578
|
+
prevMessageIdsRef.current = new Set(
|
|
1579
|
+
conversation.thread.map((message) => message.id)
|
|
1580
|
+
);
|
|
1581
|
+
});
|
|
1582
|
+
React3__namespace.useEffect(() => {
|
|
1583
|
+
if (isAtBottom) setHasNewBelow(false);
|
|
1584
|
+
}, [isAtBottom]);
|
|
1585
|
+
const newestMessage = React3__namespace.useMemo(
|
|
1586
|
+
() => [...conversation.thread].sort(byTime).at(-1),
|
|
1587
|
+
[conversation]
|
|
1588
|
+
);
|
|
1589
|
+
const raiseNewBelow = React3__namespace.useCallback(() => {
|
|
1590
|
+
if (order !== "desc") setHasNewBelow(true);
|
|
1591
|
+
}, [order]);
|
|
1592
|
+
const resumeFollowing = React3__namespace.useCallback(() => {
|
|
1593
|
+
if (order !== "desc") scrollToBottom("auto");
|
|
1594
|
+
}, [order, scrollToBottom]);
|
|
1595
|
+
chunkVPTASZ2O_cjs.useStreamEndedBelowFold(
|
|
1596
|
+
newestMessage,
|
|
1597
|
+
isAtBottom,
|
|
1598
|
+
raiseNewBelow,
|
|
1599
|
+
resumeFollowing
|
|
1600
|
+
);
|
|
1601
|
+
const handleJumpToBottom = React3__namespace.useCallback(() => {
|
|
1602
|
+
scrollToBottom(prefersReducedMotion ? "auto" : "smooth");
|
|
1603
|
+
}, [scrollToBottom, prefersReducedMotion]);
|
|
1604
|
+
const participantById = React3__namespace.useMemo(() => {
|
|
1158
1605
|
const map = /* @__PURE__ */ new Map();
|
|
1159
1606
|
conversation.participants.forEach((p) => map.set(p.id, p));
|
|
1160
1607
|
return map;
|
|
1161
1608
|
}, [conversation]);
|
|
1162
|
-
const orderedThread =
|
|
1609
|
+
const orderedThread = React3__namespace.useMemo(() => {
|
|
1163
1610
|
const sorted = [...conversation.thread].sort(byTime);
|
|
1164
1611
|
return order === "desc" ? sorted.reverse() : sorted;
|
|
1165
1612
|
}, [conversation, order]);
|
|
1166
|
-
const
|
|
1613
|
+
const turnIndex = React3__namespace.useMemo(
|
|
1614
|
+
() => turnStartId && order !== "desc" ? orderedThread.findIndex((message) => message.id === turnStartId) : -1,
|
|
1615
|
+
[orderedThread, turnStartId, order]
|
|
1616
|
+
);
|
|
1617
|
+
const renderMessageRow = (m) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1618
|
+
MessageRow,
|
|
1619
|
+
{
|
|
1620
|
+
message: m,
|
|
1621
|
+
participant: participantById.get(m.participantId),
|
|
1622
|
+
isSelf: !!currentParticipantId && m.participantId === currentParticipantId,
|
|
1623
|
+
renderText,
|
|
1624
|
+
linkBuilder,
|
|
1625
|
+
onReferenceClick,
|
|
1626
|
+
editable,
|
|
1627
|
+
onMessageEdited: handleMessageEdited,
|
|
1628
|
+
defaultCopyFormat,
|
|
1629
|
+
onOpenMedia: handleOpenMedia,
|
|
1630
|
+
openMediaLabel: labels.openMedia,
|
|
1631
|
+
playMediaLabel: labels.playMedia,
|
|
1632
|
+
mediaErrorLabel: mediaFeedProps?.labels?.mediaError,
|
|
1633
|
+
mediaRetryLabel: mediaFeedProps?.labels?.retry
|
|
1634
|
+
},
|
|
1635
|
+
m.id
|
|
1636
|
+
);
|
|
1637
|
+
const onMessageEditedRef = React3__namespace.useRef(onMessageEdited);
|
|
1167
1638
|
onMessageEditedRef.current = onMessageEdited;
|
|
1168
|
-
const conversationRef =
|
|
1639
|
+
const conversationRef = React3__namespace.useRef(conversation);
|
|
1169
1640
|
conversationRef.current = conversation;
|
|
1170
|
-
const handleMessageEdited =
|
|
1641
|
+
const handleMessageEdited = React3__namespace.useCallback(
|
|
1171
1642
|
(messageId, text) => {
|
|
1172
1643
|
onMessageEditedRef.current?.(messageId, text, {
|
|
1173
1644
|
conversation: conversationRef.current
|
|
@@ -1176,7 +1647,7 @@ function SuperChat({
|
|
|
1176
1647
|
[]
|
|
1177
1648
|
);
|
|
1178
1649
|
const editable = !readOnly && !!onMessageEdited;
|
|
1179
|
-
const mentionOptions =
|
|
1650
|
+
const mentionOptions = React3__namespace.useMemo(
|
|
1180
1651
|
() => conversation.participants.filter((p) => p.kind !== "system").map((p) => ({
|
|
1181
1652
|
id: p.id,
|
|
1182
1653
|
label: p.name,
|
|
@@ -1186,17 +1657,17 @@ function SuperChat({
|
|
|
1186
1657
|
})),
|
|
1187
1658
|
[conversation.participants]
|
|
1188
1659
|
);
|
|
1189
|
-
const composerAccept =
|
|
1660
|
+
const composerAccept = React3__namespace.useMemo(
|
|
1190
1661
|
() => acceptTokensFor(acceptedFileTypes),
|
|
1191
1662
|
[acceptedFileTypes]
|
|
1192
1663
|
);
|
|
1193
|
-
const [draft, setDraft] =
|
|
1194
|
-
const draftEpochRef =
|
|
1195
|
-
const handleDraftChange =
|
|
1664
|
+
const [draft, setDraft] = React3__namespace.useState("");
|
|
1665
|
+
const draftEpochRef = React3__namespace.useRef(0);
|
|
1666
|
+
const handleDraftChange = React3__namespace.useCallback((value) => {
|
|
1196
1667
|
draftEpochRef.current += 1;
|
|
1197
1668
|
setDraft(value);
|
|
1198
1669
|
}, []);
|
|
1199
|
-
const handleComposerSend =
|
|
1670
|
+
const handleComposerSend = React3__namespace.useCallback(
|
|
1200
1671
|
async (message) => {
|
|
1201
1672
|
const epoch = draftEpochRef.current;
|
|
1202
1673
|
try {
|
|
@@ -1227,7 +1698,7 @@ function SuperChat({
|
|
|
1227
1698
|
className
|
|
1228
1699
|
),
|
|
1229
1700
|
children: [
|
|
1230
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1701
|
+
showHeader ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1231
1702
|
"header",
|
|
1232
1703
|
{
|
|
1233
1704
|
"data-slot": "superchat-header",
|
|
@@ -1286,77 +1757,165 @@ function SuperChat({
|
|
|
1286
1757
|
onClick: () => onConversationClosed(conversation),
|
|
1287
1758
|
"aria-label": "Close conversation",
|
|
1288
1759
|
className: "rounded-md p-1 text-neutral-400 hover:bg-neutral-100 dark:hover:bg-neutral-800",
|
|
1289
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1760
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.CloseIcon, {})
|
|
1290
1761
|
}
|
|
1291
1762
|
)
|
|
1292
1763
|
]
|
|
1293
1764
|
}
|
|
1765
|
+
) : (
|
|
1766
|
+
// Keeps the panel's aria-labelledby reference valid without a visible header.
|
|
1767
|
+
/* @__PURE__ */ jsxRuntime.jsx("h2", { id: headingId, className: "sr-only", children: conversation.title })
|
|
1294
1768
|
),
|
|
1295
|
-
|
|
1296
|
-
|
|
1769
|
+
activeView === "media" ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1770
|
+
"div",
|
|
1297
1771
|
{
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1772
|
+
"data-slot": "superchat-media-view",
|
|
1773
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
1774
|
+
children: [
|
|
1775
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-4 pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(chunkXRVMYT5G_cjs.ButtonGroup, { className: "justify-start", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1776
|
+
chunkX6A27RGO_cjs.Button,
|
|
1777
|
+
{
|
|
1778
|
+
ref: backToConversationRef,
|
|
1779
|
+
variant: "ghost",
|
|
1780
|
+
size: "sm",
|
|
1781
|
+
leftIcon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1782
|
+
lucideReact.ArrowLeft,
|
|
1783
|
+
{
|
|
1784
|
+
className: "size-4 rtl:rotate-180",
|
|
1785
|
+
"aria-hidden": "true"
|
|
1786
|
+
}
|
|
1787
|
+
),
|
|
1788
|
+
onClick: handleBackToConversation,
|
|
1789
|
+
children: labels.backToConversation
|
|
1790
|
+
}
|
|
1791
|
+
) }) }),
|
|
1792
|
+
/* @__PURE__ */ React3.createElement(
|
|
1793
|
+
chunkWXFGHDTV_cjs.MediaFeed,
|
|
1794
|
+
{
|
|
1795
|
+
...mediaFeedProps,
|
|
1796
|
+
ref: mediaFeedRef,
|
|
1797
|
+
key: conversation.id,
|
|
1798
|
+
items: mediaItems,
|
|
1799
|
+
getId: (item) => item.id,
|
|
1800
|
+
getMedia: (item) => item.attachment,
|
|
1801
|
+
getTitle: (item) => item.attachment.title ?? "",
|
|
1802
|
+
getCaption: (item) => item.attachment.caption ?? item.message.text,
|
|
1803
|
+
getAuthor: (item) => ({
|
|
1804
|
+
name: item.participant?.name ?? labels.unknownAuthor,
|
|
1805
|
+
avatar: item.participant?.avatar
|
|
1806
|
+
}),
|
|
1807
|
+
activeItemId: mediaFeedProps?.activeItemId ?? (mediaSelection?.conversationId === conversation.id ? mediaSelection.itemId : void 0),
|
|
1808
|
+
onActiveItemChange: handleMediaSelection,
|
|
1809
|
+
playbackRequest: manualPlaybackRequest?.conversationId === conversation.id ? manualPlaybackRequest : mediaFeedProps?.playbackRequest,
|
|
1810
|
+
className: chunkS5RVSXDV_cjs.cn("min-h-0 flex-1", mediaFeedProps?.className)
|
|
1811
|
+
}
|
|
1812
|
+
)
|
|
1813
|
+
]
|
|
1318
1814
|
}
|
|
1319
|
-
) : /* @__PURE__ */ jsxRuntime.
|
|
1815
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1320
1816
|
"div",
|
|
1321
1817
|
{
|
|
1322
|
-
"data-slot": "superchat-thread",
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1818
|
+
"data-slot": "superchat-thread-viewport",
|
|
1819
|
+
className: "relative flex min-h-0 flex-1 flex-col",
|
|
1820
|
+
children: [
|
|
1821
|
+
virtualized ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
1822
|
+
VirtualThread,
|
|
1823
|
+
{
|
|
1824
|
+
items: orderedThread,
|
|
1825
|
+
participantById,
|
|
1826
|
+
currentParticipantId,
|
|
1827
|
+
renderText,
|
|
1828
|
+
linkBuilder,
|
|
1829
|
+
onReferenceClick,
|
|
1830
|
+
editable,
|
|
1831
|
+
onMessageEdited: handleMessageEdited,
|
|
1832
|
+
defaultCopyFormat,
|
|
1833
|
+
onOpenMedia: handleOpenMedia,
|
|
1834
|
+
openMediaLabel: labels.openMedia,
|
|
1835
|
+
playMediaLabel: labels.playMedia,
|
|
1836
|
+
mediaErrorLabel: mediaFeedProps?.labels?.mediaError,
|
|
1837
|
+
mediaRetryLabel: mediaFeedProps?.labels?.retry,
|
|
1838
|
+
scrollRef: threadRef,
|
|
1839
|
+
contentRef: threadContentRef,
|
|
1840
|
+
containerProps: {
|
|
1841
|
+
"data-slot": "superchat-thread",
|
|
1842
|
+
role: "log",
|
|
1843
|
+
"aria-label": "Messages",
|
|
1844
|
+
"aria-live": "polite",
|
|
1845
|
+
// Focusable so keyboard-only users can scroll the message history.
|
|
1846
|
+
tabIndex: 0,
|
|
1847
|
+
className: "flex-1 overflow-y-auto p-4"
|
|
1848
|
+
}
|
|
1849
|
+
}
|
|
1850
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
1851
|
+
"div",
|
|
1852
|
+
{
|
|
1853
|
+
"data-slot": "superchat-thread",
|
|
1854
|
+
ref: threadRef,
|
|
1855
|
+
role: "log",
|
|
1856
|
+
"aria-label": "Messages",
|
|
1857
|
+
"aria-live": "polite",
|
|
1858
|
+
tabIndex: 0,
|
|
1859
|
+
className: "flex-1 overflow-y-auto p-4",
|
|
1860
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: threadContentRef, className: "space-y-4", children: [
|
|
1861
|
+
(turnIndex === -1 ? orderedThread : orderedThread.slice(0, turnIndex)).map(renderMessageRow),
|
|
1862
|
+
turnIndex !== -1 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1863
|
+
"div",
|
|
1864
|
+
{
|
|
1865
|
+
"data-slot": "superchat-turn",
|
|
1866
|
+
className: "space-y-4",
|
|
1867
|
+
style: { minHeight: turnMinHeight },
|
|
1868
|
+
children: orderedThread.slice(turnIndex).map(renderMessageRow)
|
|
1869
|
+
}
|
|
1870
|
+
)
|
|
1871
|
+
] })
|
|
1872
|
+
}
|
|
1873
|
+
),
|
|
1874
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { children: order !== "desc" && !isAtBottom && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1875
|
+
chunkIEY3ZJIT_cjs.Animated,
|
|
1876
|
+
{
|
|
1877
|
+
preset: "fade",
|
|
1878
|
+
mode: "presence",
|
|
1879
|
+
className: "absolute inset-x-0 bottom-0 z-20",
|
|
1880
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1881
|
+
chunkXRVMYT5G_cjs.JumpToBottomButton,
|
|
1882
|
+
{
|
|
1883
|
+
dataSlot: "superchat-jump-to-bottom",
|
|
1884
|
+
hasNewMessages: hasNewBelow,
|
|
1885
|
+
onClick: handleJumpToBottom
|
|
1886
|
+
}
|
|
1887
|
+
)
|
|
1888
|
+
},
|
|
1889
|
+
"jump-to-bottom"
|
|
1890
|
+
) })
|
|
1891
|
+
]
|
|
1344
1892
|
}
|
|
1345
1893
|
),
|
|
1346
1894
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1347
|
-
|
|
1895
|
+
chunkR5Z7AOVU_cjs.ChatComposer,
|
|
1348
1896
|
{
|
|
1349
1897
|
value: draft,
|
|
1350
1898
|
onValueChange: handleDraftChange,
|
|
1351
1899
|
onSend: handleComposerSend,
|
|
1352
1900
|
disabled: readOnly,
|
|
1353
|
-
|
|
1901
|
+
className: "px-4 pb-4",
|
|
1902
|
+
placeholder: readOnly ? "Read-only conversation" : placeholder ?? "Type a message\u2026 use @ to address an agent",
|
|
1354
1903
|
mentionOptions,
|
|
1355
|
-
allowAttachments: !readOnly,
|
|
1904
|
+
allowAttachments: !readOnly && (allowAttachments ?? true),
|
|
1356
1905
|
acceptedFileTypes: composerAccept,
|
|
1357
1906
|
maxFileSize: 25 * 1024 * 1024,
|
|
1358
1907
|
maxLength: 1e5,
|
|
1359
|
-
inputLabel: "Message"
|
|
1908
|
+
inputLabel: "Message",
|
|
1909
|
+
showAgentSelector: !!agents?.length,
|
|
1910
|
+
agents,
|
|
1911
|
+
selectedAgent,
|
|
1912
|
+
onAgentChange,
|
|
1913
|
+
agentSelectorLabel,
|
|
1914
|
+
showModelSelector: !!modelSelectorProps,
|
|
1915
|
+
modelSelectorProps,
|
|
1916
|
+
isStreaming,
|
|
1917
|
+
onStop,
|
|
1918
|
+
stopLabel
|
|
1360
1919
|
}
|
|
1361
1920
|
)
|
|
1362
1921
|
]
|
|
@@ -1371,12 +1930,14 @@ function SuperChatConversations({
|
|
|
1371
1930
|
onConversationOpened,
|
|
1372
1931
|
onNewConversation
|
|
1373
1932
|
}) {
|
|
1374
|
-
const [internalActive, setInternalActive] =
|
|
1933
|
+
const [internalActive, setInternalActive] = React3__namespace.useState(
|
|
1375
1934
|
defaultActiveConversationId ?? conversations[0]?.id
|
|
1376
1935
|
);
|
|
1936
|
+
const [hasMounted, setHasMounted] = React3__namespace.useState(false);
|
|
1937
|
+
React3__namespace.useEffect(() => setHasMounted(true), []);
|
|
1377
1938
|
const requestedId = activeConversationId ?? internalActive;
|
|
1378
1939
|
const activeId = conversations.some((c) => c.id === requestedId) ? requestedId : conversations[0]?.id;
|
|
1379
|
-
const sortedConversations =
|
|
1940
|
+
const sortedConversations = React3__namespace.useMemo(
|
|
1380
1941
|
() => [...conversations].sort((a, b) => lastActivityOf(b) - lastActivityOf(a)),
|
|
1381
1942
|
[conversations]
|
|
1382
1943
|
);
|
|
@@ -1428,10 +1989,21 @@ function SuperChatConversations({
|
|
|
1428
1989
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate font-medium", children: c.title }),
|
|
1429
1990
|
last?.text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "block truncate text-xs text-neutral-600 dark:text-neutral-400", children: last.text })
|
|
1430
1991
|
] }),
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1992
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkIEY3ZJIT_cjs.AnimatedPresence, { initial: hasMounted, children: !!c.unread && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1993
|
+
chunkIEY3ZJIT_cjs.Animated,
|
|
1994
|
+
{
|
|
1995
|
+
as: "span",
|
|
1996
|
+
preset: "pop",
|
|
1997
|
+
mode: "presence",
|
|
1998
|
+
"data-slot": "superchat-unread-badge",
|
|
1999
|
+
className: "bg-primary-600 ms-1 inline-flex h-5 min-w-5 items-center justify-center rounded-full px-1.5 text-[10px] font-semibold text-white",
|
|
2000
|
+
children: [
|
|
2001
|
+
c.unread,
|
|
2002
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " unread messages" })
|
|
2003
|
+
]
|
|
2004
|
+
},
|
|
2005
|
+
"unread"
|
|
2006
|
+
) })
|
|
1435
2007
|
]
|
|
1436
2008
|
}
|
|
1437
2009
|
) }, c.id);
|
|
@@ -1444,6 +2016,11 @@ function SuperChatConversations({
|
|
|
1444
2016
|
}
|
|
1445
2017
|
function SuperChatInbox({
|
|
1446
2018
|
conversations,
|
|
2019
|
+
view,
|
|
2020
|
+
defaultView,
|
|
2021
|
+
onViewChange,
|
|
2022
|
+
mediaFeedProps,
|
|
2023
|
+
mediaLabels,
|
|
1447
2024
|
activeConversationId,
|
|
1448
2025
|
defaultActiveConversationId,
|
|
1449
2026
|
currentParticipantId,
|
|
@@ -1465,13 +2042,13 @@ function SuperChatInbox({
|
|
|
1465
2042
|
onNewConversation,
|
|
1466
2043
|
onReferenceClick
|
|
1467
2044
|
}) {
|
|
1468
|
-
const [internalActive, setInternalActive] =
|
|
2045
|
+
const [internalActive, setInternalActive] = React3__namespace.useState(
|
|
1469
2046
|
defaultActiveConversationId ?? conversations[0]?.id
|
|
1470
2047
|
);
|
|
1471
2048
|
const requestedId = activeConversationId ?? internalActive;
|
|
1472
2049
|
const active = conversations.find((c) => c.id === requestedId) ?? conversations[0];
|
|
1473
2050
|
const activeId = active?.id;
|
|
1474
|
-
const [mobileView, setMobileView] =
|
|
2051
|
+
const [mobileView, setMobileView] = React3__namespace.useState("list");
|
|
1475
2052
|
const handleOpen = (c) => {
|
|
1476
2053
|
if (activeConversationId === void 0) setInternalActive(c.id);
|
|
1477
2054
|
setMobileView("chat");
|
|
@@ -1505,6 +2082,11 @@ function SuperChatInbox({
|
|
|
1505
2082
|
SuperChat,
|
|
1506
2083
|
{
|
|
1507
2084
|
conversation: active,
|
|
2085
|
+
view,
|
|
2086
|
+
defaultView,
|
|
2087
|
+
onViewChange,
|
|
2088
|
+
mediaFeedProps,
|
|
2089
|
+
mediaLabels,
|
|
1508
2090
|
currentParticipantId,
|
|
1509
2091
|
renderPlugins,
|
|
1510
2092
|
renderTextContent,
|
|
@@ -1552,5 +2134,6 @@ exports.SuperChat = SuperChat;
|
|
|
1552
2134
|
exports.SuperChatConversations = SuperChatConversations;
|
|
1553
2135
|
exports.SuperChatInbox = SuperChatInbox;
|
|
1554
2136
|
exports.createMarkdownRenderer = createMarkdownRenderer;
|
|
2137
|
+
exports.getConversationMediaItems = getConversationMediaItems;
|
|
1555
2138
|
//# sourceMappingURL=index.cjs.map
|
|
1556
2139
|
//# sourceMappingURL=index.cjs.map
|