@uzum-tech/ui 1.7.2 → 1.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/index.js +1673 -996
  2. package/dist/index.prod.js +3 -3
  3. package/es/chat/index.d.ts +6 -1
  4. package/es/chat/index.js +3 -0
  5. package/es/chat/src/Chat.d.ts +19 -6
  6. package/es/chat/src/Chat.js +54 -14
  7. package/es/chat/src/ChatListItems.d.ts +7782 -0
  8. package/es/chat/src/ChatListItems.js +188 -0
  9. package/es/chat/src/ChatMessages.d.ts +7805 -0
  10. package/es/chat/src/ChatMessages.js +325 -0
  11. package/es/chat/src/ChatParts/ChatAttachment.js +4 -3
  12. package/es/chat/src/ChatParts/MainArea.d.ts +0 -2
  13. package/es/chat/src/ChatParts/MainArea.js +108 -229
  14. package/es/chat/src/ChatParts/Sidebar.js +16 -80
  15. package/es/chat/src/interface.d.ts +10 -1
  16. package/es/chat/src/styles/index.cssr.js +16 -16
  17. package/es/chat/styles/light.d.ts +1 -1
  18. package/es/chat/styles/light.js +15 -3
  19. package/es/locales/common/arDZ.js +2 -1
  20. package/es/locales/common/deDE.js +2 -1
  21. package/es/locales/common/enGB.js +2 -1
  22. package/es/locales/common/enUS.d.ts +1 -0
  23. package/es/locales/common/enUS.js +2 -1
  24. package/es/locales/common/eo.js +2 -1
  25. package/es/locales/common/esAR.js +2 -1
  26. package/es/locales/common/faIR.js +2 -1
  27. package/es/locales/common/frFR.js +2 -1
  28. package/es/locales/common/idID.js +2 -1
  29. package/es/locales/common/itIT.js +2 -1
  30. package/es/locales/common/jaJP.js +2 -1
  31. package/es/locales/common/koKR.js +2 -1
  32. package/es/locales/common/nbNO.js +2 -1
  33. package/es/locales/common/nlNL.js +2 -1
  34. package/es/locales/common/plPL.js +2 -1
  35. package/es/locales/common/ptBR.js +2 -1
  36. package/es/locales/common/ruRU.js +2 -1
  37. package/es/locales/common/skSK.js +2 -1
  38. package/es/locales/common/svSE.js +2 -1
  39. package/es/locales/common/thTH.js +2 -1
  40. package/es/locales/common/trTR.js +2 -1
  41. package/es/locales/common/ukUA.js +2 -1
  42. package/es/locales/common/viVN.js +2 -1
  43. package/es/locales/common/zhCN.js +2 -1
  44. package/es/locales/common/zhTW.js +2 -1
  45. package/es/version.d.ts +1 -1
  46. package/es/version.js +1 -1
  47. package/lib/chat/index.d.ts +6 -1
  48. package/lib/chat/index.js +9 -1
  49. package/lib/chat/src/Chat.d.ts +19 -6
  50. package/lib/chat/src/Chat.js +53 -13
  51. package/lib/chat/src/ChatListItems.d.ts +7782 -0
  52. package/lib/chat/src/ChatListItems.js +194 -0
  53. package/lib/chat/src/ChatMessages.d.ts +7805 -0
  54. package/lib/chat/src/ChatMessages.js +331 -0
  55. package/lib/chat/src/ChatParts/ChatAttachment.js +4 -3
  56. package/lib/chat/src/ChatParts/MainArea.d.ts +0 -2
  57. package/lib/chat/src/ChatParts/MainArea.js +107 -228
  58. package/lib/chat/src/ChatParts/Sidebar.js +17 -78
  59. package/lib/chat/src/interface.d.ts +10 -1
  60. package/lib/chat/src/styles/index.cssr.js +16 -16
  61. package/lib/chat/styles/light.d.ts +1 -1
  62. package/lib/chat/styles/light.js +15 -3
  63. package/lib/locales/common/arDZ.js +2 -1
  64. package/lib/locales/common/deDE.js +2 -1
  65. package/lib/locales/common/enGB.js +2 -1
  66. package/lib/locales/common/enUS.d.ts +1 -0
  67. package/lib/locales/common/enUS.js +2 -1
  68. package/lib/locales/common/eo.js +2 -1
  69. package/lib/locales/common/esAR.js +2 -1
  70. package/lib/locales/common/faIR.js +2 -1
  71. package/lib/locales/common/frFR.js +2 -1
  72. package/lib/locales/common/idID.js +2 -1
  73. package/lib/locales/common/itIT.js +2 -1
  74. package/lib/locales/common/jaJP.js +2 -1
  75. package/lib/locales/common/koKR.js +2 -1
  76. package/lib/locales/common/nbNO.js +2 -1
  77. package/lib/locales/common/nlNL.js +2 -1
  78. package/lib/locales/common/plPL.js +2 -1
  79. package/lib/locales/common/ptBR.js +2 -1
  80. package/lib/locales/common/ruRU.js +2 -1
  81. package/lib/locales/common/skSK.js +2 -1
  82. package/lib/locales/common/svSE.js +2 -1
  83. package/lib/locales/common/thTH.js +2 -1
  84. package/lib/locales/common/trTR.js +2 -1
  85. package/lib/locales/common/ukUA.js +2 -1
  86. package/lib/locales/common/viVN.js +2 -1
  87. package/lib/locales/common/zhCN.js +2 -1
  88. package/lib/locales/common/zhTW.js +2 -1
  89. package/lib/version.d.ts +1 -1
  90. package/lib/version.js +1 -1
  91. package/package.json +1 -1
  92. package/volar.d.ts +2 -0
  93. package/web-types.json +149 -1
  94. package/es/chat/src/ChatGlobalState.d.ts +0 -13
  95. package/es/chat/src/ChatGlobalState.js +0 -32
  96. package/lib/chat/src/ChatGlobalState.d.ts +0 -13
  97. package/lib/chat/src/ChatGlobalState.js +0 -36
package/dist/index.js CHANGED
@@ -15201,7 +15201,8 @@
15201
15201
  inputPlaceholder: "Type a message...",
15202
15202
  typingText: "Typing...",
15203
15203
  retryText: "Resend",
15204
- closeButtonText: "Close chat"
15204
+ closeButtonText: "Close chat",
15205
+ unreadNotificationText: "new messages"
15205
15206
  }
15206
15207
  };
15207
15208
 
@@ -15335,7 +15336,8 @@
15335
15336
  inputPlaceholder: "Type a message...",
15336
15337
  typingText: "Typing...",
15337
15338
  retryText: "Resend",
15338
- closeButtonText: "Close chat"
15339
+ closeButtonText: "Close chat",
15340
+ unreadNotificationText: "new messages"
15339
15341
  }
15340
15342
  };
15341
15343
 
@@ -15470,7 +15472,8 @@
15470
15472
  inputPlaceholder: "Type a message...",
15471
15473
  typingText: "Typing...",
15472
15474
  retryText: "Resend",
15473
- closeButtonText: "Close chat"
15475
+ closeButtonText: "Close chat",
15476
+ unreadNotificationText: "new messages"
15474
15477
  }
15475
15478
  };
15476
15479
 
@@ -15609,7 +15612,8 @@
15609
15612
  inputPlaceholder: "\u041D\u0430\u043F\u0438\u0441\u0430\u0442\u044C \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435...",
15610
15613
  typingText: "\u041F\u0435\u0447\u0430\u0442\u0430\u0435\u0442...",
15611
15614
  retryText: "\u041F\u043E\u0432\u0442\u043E\u0440\u043D\u043E \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",
15612
- closeButtonText: "\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C \u0447\u0430\u0442"
15615
+ closeButtonText: "\u0417\u0430\u0432\u0435\u0440\u0448\u0438\u0442\u044C \u0447\u0430\u0442",
15616
+ unreadNotificationText: "\u043D\u043E\u0432\u044B\u0445 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0439"
15613
15617
  }
15614
15618
  };
15615
15619
 
@@ -15744,7 +15748,8 @@
15744
15748
  inputPlaceholder: "Type a message...",
15745
15749
  typingText: "Typing...",
15746
15750
  retryText: "Resend",
15747
- closeButtonText: "Close chat"
15751
+ closeButtonText: "Close chat",
15752
+ unreadNotificationText: "new messages"
15748
15753
  }
15749
15754
  };
15750
15755
 
@@ -15881,7 +15886,8 @@
15881
15886
  inputPlaceholder: "Type a message...",
15882
15887
  typingText: "Typing...",
15883
15888
  retryText: "Resend",
15884
- closeButtonText: "Close chat"
15889
+ closeButtonText: "Close chat",
15890
+ unreadNotificationText: "new messages"
15885
15891
  }
15886
15892
  };
15887
15893
 
@@ -16018,7 +16024,8 @@
16018
16024
  inputPlaceholder: "Type a message...",
16019
16025
  typingText: "Typing...",
16020
16026
  retryText: "Resend",
16021
- closeButtonText: "Close chat"
16027
+ closeButtonText: "Close chat",
16028
+ unreadNotificationText: "new messages"
16022
16029
  }
16023
16030
  };
16024
16031
 
@@ -16156,7 +16163,8 @@
16156
16163
  inputPlaceholder: "Type a message...",
16157
16164
  typingText: "Typing...",
16158
16165
  retryText: "Resend",
16159
- closeButtonText: "Close chat"
16166
+ closeButtonText: "Close chat",
16167
+ unreadNotificationText: "new messages"
16160
16168
  }
16161
16169
  };
16162
16170
 
@@ -16290,7 +16298,8 @@
16290
16298
  inputPlaceholder: "Type a message...",
16291
16299
  typingText: "Typing...",
16292
16300
  retryText: "Resend",
16293
- closeButtonText: "Close chat"
16301
+ closeButtonText: "Close chat",
16302
+ unreadNotificationText: "new messages"
16294
16303
  }
16295
16304
  };
16296
16305
 
@@ -16428,7 +16437,8 @@
16428
16437
  inputPlaceholder: "Type a message...",
16429
16438
  typingText: "Typing...",
16430
16439
  retryText: "Resend",
16431
- closeButtonText: "Close chat"
16440
+ closeButtonText: "Close chat",
16441
+ unreadNotificationText: "new messages"
16432
16442
  }
16433
16443
  };
16434
16444
 
@@ -16564,7 +16574,8 @@
16564
16574
  inputPlaceholder: "Type a message...",
16565
16575
  typingText: "Typing...",
16566
16576
  retryText: "Resend",
16567
- closeButtonText: "Close chat"
16577
+ closeButtonText: "Close chat",
16578
+ unreadNotificationText: "new messages"
16568
16579
  }
16569
16580
  };
16570
16581
 
@@ -16698,7 +16709,8 @@
16698
16709
  inputPlaceholder: "Type a message...",
16699
16710
  typingText: "Typing...",
16700
16711
  retryText: "Resend",
16701
- closeButtonText: "Close chat"
16712
+ closeButtonText: "Close chat",
16713
+ unreadNotificationText: "new messages"
16702
16714
  }
16703
16715
  };
16704
16716
 
@@ -16836,7 +16848,8 @@
16836
16848
  inputPlaceholder: "Type a message...",
16837
16849
  typingText: "Typing...",
16838
16850
  retryText: "Resend",
16839
- closeButtonText: "Close chat"
16851
+ closeButtonText: "Close chat",
16852
+ unreadNotificationText: "new messages"
16840
16853
  }
16841
16854
  };
16842
16855
 
@@ -16973,7 +16986,8 @@
16973
16986
  inputPlaceholder: "Type a message...",
16974
16987
  typingText: "Typing...",
16975
16988
  retryText: "Resend",
16976
- closeButtonText: "Close chat"
16989
+ closeButtonText: "Close chat",
16990
+ unreadNotificationText: "new messages"
16977
16991
  }
16978
16992
  };
16979
16993
 
@@ -17111,7 +17125,8 @@
17111
17125
  inputPlaceholder: "Type a message...",
17112
17126
  typingText: "Typing...",
17113
17127
  retryText: "Resend",
17114
- closeButtonText: "Close chat"
17128
+ closeButtonText: "Close chat",
17129
+ unreadNotificationText: "new messages"
17115
17130
  }
17116
17131
  };
17117
17132
 
@@ -17246,7 +17261,8 @@
17246
17261
  inputPlaceholder: "Type a message...",
17247
17262
  typingText: "Typing...",
17248
17263
  retryText: "Resend",
17249
- closeButtonText: "Close chat"
17264
+ closeButtonText: "Close chat",
17265
+ unreadNotificationText: "new messages"
17250
17266
  }
17251
17267
  };
17252
17268
 
@@ -17383,7 +17399,8 @@
17383
17399
  inputPlaceholder: "Type a message...",
17384
17400
  typingText: "Typing...",
17385
17401
  retryText: "Resend",
17386
- closeButtonText: "Close chat"
17402
+ closeButtonText: "Close chat",
17403
+ unreadNotificationText: "new messages"
17387
17404
  }
17388
17405
  };
17389
17406
 
@@ -17517,7 +17534,8 @@
17517
17534
  inputPlaceholder: "Type a message...",
17518
17535
  typingText: "Typing...",
17519
17536
  retryText: "Resend",
17520
- closeButtonText: "Close chat"
17537
+ closeButtonText: "Close chat",
17538
+ unreadNotificationText: "new messages"
17521
17539
  }
17522
17540
  };
17523
17541
 
@@ -17655,7 +17673,8 @@
17655
17673
  inputPlaceholder: "Type a message...",
17656
17674
  typingText: "Typing...",
17657
17675
  retryText: "Resend",
17658
- closeButtonText: "Close chat"
17676
+ closeButtonText: "Close chat",
17677
+ unreadNotificationText: "new messages"
17659
17678
  }
17660
17679
  };
17661
17680
 
@@ -17789,7 +17808,8 @@
17789
17808
  inputPlaceholder: "Type a message...",
17790
17809
  typingText: "Typing...",
17791
17810
  retryText: "Resend",
17792
- closeButtonText: "Close chat"
17811
+ closeButtonText: "Close chat",
17812
+ unreadNotificationText: "new messages"
17793
17813
  }
17794
17814
  };
17795
17815
 
@@ -17924,7 +17944,8 @@
17924
17944
  inputPlaceholder: "Type a message...",
17925
17945
  typingText: "Typing...",
17926
17946
  retryText: "Resend",
17927
- closeButtonText: "Close chat"
17947
+ closeButtonText: "Close chat",
17948
+ unreadNotificationText: "new messages"
17928
17949
  }
17929
17950
  };
17930
17951
 
@@ -18060,7 +18081,8 @@
18060
18081
  inputPlaceholder: "Type a message...",
18061
18082
  typingText: "Typing...",
18062
18083
  retryText: "Resend",
18063
- closeButtonText: "Close chat"
18084
+ closeButtonText: "Close chat",
18085
+ unreadNotificationText: "new messages"
18064
18086
  }
18065
18087
  };
18066
18088
 
@@ -18194,7 +18216,8 @@
18194
18216
  inputPlaceholder: "Type a message...",
18195
18217
  typingText: "Typing...",
18196
18218
  retryText: "Resend",
18197
- closeButtonText: "Close chat"
18219
+ closeButtonText: "Close chat",
18220
+ unreadNotificationText: "new messages"
18198
18221
  }
18199
18222
  };
18200
18223
 
@@ -18328,7 +18351,8 @@
18328
18351
  inputPlaceholder: "Type a message...",
18329
18352
  typingText: "Typing...",
18330
18353
  retryText: "Resend",
18331
- closeButtonText: "Close chat"
18354
+ closeButtonText: "Close chat",
18355
+ unreadNotificationText: "new messages"
18332
18356
  }
18333
18357
  };
18334
18358
 
@@ -18462,7 +18486,8 @@
18462
18486
  inputPlaceholder: "Type a message...",
18463
18487
  typingText: "Typing...",
18464
18488
  retryText: "Resend",
18465
- closeButtonText: "Close chat"
18489
+ closeButtonText: "Close chat",
18490
+ unreadNotificationText: "new messages"
18466
18491
  }
18467
18492
  };
18468
18493
 
@@ -58020,43 +58045,14 @@
58020
58045
  ChatMessageType2["MARK"] = "mark";
58021
58046
  return ChatMessageType2;
58022
58047
  })(ChatMessageType || {});
58048
+ var ChatMarkType = /* @__PURE__ */(ChatMarkType2 => {
58049
+ ChatMarkType2["SYSTEM"] = "system";
58050
+ ChatMarkType2["EVENT"] = "event";
58051
+ ChatMarkType2["DIVIDER"] = "divider";
58052
+ return ChatMarkType2;
58053
+ })(ChatMarkType || {});
58023
58054
  const chatInjectionKey = createInjectionKey("chat");
58024
58055
 
58025
- class ChatGlobalState {
58026
- static {
58027
- this.instance = null;
58028
- }
58029
- constructor() {
58030
- this.notificationsShown = /* @__PURE__ */new Set();
58031
- this.openedChats = /* @__PURE__ */new Set();
58032
- }
58033
- static getInstance() {
58034
- if (!ChatGlobalState.instance) {
58035
- ChatGlobalState.instance = new ChatGlobalState();
58036
- }
58037
- return ChatGlobalState.instance;
58038
- }
58039
- hasNotificationShown(chatId) {
58040
- return this.notificationsShown.has(chatId);
58041
- }
58042
- markNotificationShown(chatId) {
58043
- this.notificationsShown.add(chatId);
58044
- }
58045
- isChatOpened(chatId) {
58046
- return this.openedChats.has(chatId);
58047
- }
58048
- markChatOpened(chatId) {
58049
- this.openedChats.add(chatId);
58050
- }
58051
- markChatClosed(chatId) {
58052
- this.openedChats.delete(chatId);
58053
- }
58054
- reset() {
58055
- this.notificationsShown.clear();
58056
- this.openedChats.clear();
58057
- }
58058
- }
58059
-
58060
58056
  var commonVars = {
58061
58057
  gapSmall: "4px 8px",
58062
58058
  gapMedium: "8px 12px",
@@ -59745,73 +59741,622 @@
59745
59741
  }
59746
59742
  });
59747
59743
 
59744
+ var style$12 = cB("chat", `
59745
+ height: 100%;
59746
+ max-height: 100%;
59747
+ min-height: 0;
59748
+ display: flex;
59749
+ box-sizing: border-box;
59750
+ .u-list-item__text {
59751
+ grid-template-columns: 1fr !important;
59752
+ }
59753
+ .u-flex {
59754
+ height: 100%;
59755
+ max-height: 100%;
59756
+ min-height: 0;
59757
+ }
59758
+ `, [cB("chat-sidebar", `
59759
+ max-width: 388px;
59760
+ width: 100%;
59761
+ height: 100%;
59762
+ display: flex;
59763
+ flex-direction: column;
59764
+ background-color: var(--u-sidebar-background-color);
59765
+ border: 1px solid var(--u-sidebar-border-color);
59766
+ border-radius: 20px;
59767
+ `, [cE("header", `
59768
+ flex-shrink: 0;
59769
+ `), cE("header-container", `
59770
+ padding: 16px 16px 4px 16px;
59771
+ `), cE("header-main", `
59772
+ flex: 0 0 48%;
59773
+ min-width: 0;
59774
+ `), cE("header-actions", `
59775
+ flex: 0 0 48%;
59776
+ min-width: 0;
59777
+ display: flex;
59778
+ justify-content: flex-end;
59779
+ align-items: center;
59780
+ gap: 8px;
59781
+ `), cE("content", `
59782
+ flex: 1;
59783
+ overflow-y: auto;
59784
+ min-height: 0;
59785
+ padding: 16px;
59786
+ padding-top: 8px;
59787
+ `), cE("item", `
59788
+ padding: 12px 16px;
59789
+ width: 100%;
59790
+ cursor: pointer;
59791
+ border-radius: 8px;
59792
+ margin-bottom: 4px;
59793
+ transition: all 0.2s ease;
59794
+ position: relative;
59795
+ `, [c$1(".u-list-item", `
59796
+ min-width: 0;
59797
+ `), c$1(".u-list-item__main", `
59798
+ min-width: 0;
59799
+ flex: 1;
59800
+ `), c$1(".u-list-item__prefix", `
59801
+ flex-shrink: 0;
59802
+ `), c$1(".u-list-item__suffix", `
59803
+ flex-shrink: 0;
59804
+ margin-left: 12px;
59805
+ `), c$1(".u-list-item__text", `
59806
+ grid-template-columns: 1fr !important;
59807
+ min-width: 0 !important;
59808
+ max-width: 100%;
59809
+ `), c$1(".u-list-item__content", `
59810
+ min-width: 0;
59811
+ `), c$1(".u-list-item__title", `
59812
+ min-width: 0;
59813
+ `), c$1(".u-list-item__subtitle", `
59814
+ min-width: 0 !important;
59815
+ `), cM("selected", `
59816
+ background-color: var(--u-sidebar-item-background-color-selected);
59817
+ `, [c$1("&:hover", `
59818
+ background-color: var(--u-sidebar-item-background-color-selected);
59819
+ `)]), cM("typing", `
59820
+ .u-list-item__description {
59821
+ color: var(--u-color-primary) !important;
59822
+ font-style: italic;
59823
+ }
59824
+ `), c$1("&:hover", `
59825
+ background-color: var(--u-sidebar-item-background-color-hover);
59826
+ `, [cM("selected", `
59827
+ background-color: var(--u-sidebar-item-background-color-selected);
59828
+ `)])]), cE("item-title", `
59829
+ font-weight: 500;
59830
+ font-size: 14px;
59831
+ line-height: 20px;
59832
+ color: var(--u-sidebar-item-text-color);
59833
+ overflow: hidden;
59834
+ text-overflow: ellipsis;
59835
+ white-space: nowrap;
59836
+ `), cE("item-subtitle", `
59837
+ font-size: 12px;
59838
+ line-height: 16px;
59839
+ color: var(--u-sidebar-item-subtitle-color);
59840
+ overflow: hidden;
59841
+ text-overflow: ellipsis;
59842
+ white-space: nowrap;
59843
+ `, [cM("typing", `
59844
+ color: var(--u-color-primary);
59845
+ font-style: italic;
59846
+ `)]), cE("item-main", `
59847
+ flex: 1;
59848
+ min-width: 0;
59849
+ margin-right: 12px;
59850
+ `), cE("item-title", `
59851
+ font-weight: 500;
59852
+ font-size: 14px;
59853
+ line-height: 20px;
59854
+ color: var(--u-text-color-base);
59855
+ margin-bottom: 2px;
59856
+ overflow: hidden;
59857
+ text-overflow: ellipsis;
59858
+ white-space: nowrap;
59859
+ `), cE("item-subtitle", `
59860
+ font-size: 12px;
59861
+ line-height: 16px;
59862
+ color: var(--u-text-color-disabled);
59863
+ overflow: hidden;
59864
+ text-overflow: ellipsis;
59865
+ white-space: nowrap;
59866
+ `), cE("item-indicators", `
59867
+ display: flex;
59868
+ flex-direction: column;
59869
+ align-items: flex-end;
59870
+ gap: 4px;
59871
+ flex-shrink: 0;
59872
+ `), cE("item-time", `
59873
+ font-size: 11px;
59874
+ line-height: 21px;
59875
+ color: var(--u-sidebar-item-time-color);
59876
+ white-space: nowrap;
59877
+ `), cE("item-status sup", `
59878
+ padding: 2px 6px 2px 5px;
59879
+ height: 22px;
59880
+ `), cE("item-status-icon", `
59881
+ color: var(--u-sidebar-item-time-color);
59882
+ `, [cM("read", `
59883
+ color: var(--u-unread-notification-background-color);
59884
+ `)]), c$1("&:has(.u-chat-sidebar__item-badge)", `
59885
+ `, [cE("item-title", `
59886
+ font-weight: 600;
59887
+ `), cE("item-subtitle", `
59888
+ color: var(--u-text-color-base);
59889
+ font-weight: 500;
59890
+ `)])]), cB("chat-main", `
59891
+ background-color: var(--u-main-background-color);
59892
+ border: 1px solid var(--u-border-color);
59893
+ border-radius: 20px;
59894
+ width: 100%;
59895
+ flex: 1;
59896
+ display: flex;
59897
+ flex-direction: column;
59898
+ height: 100%;
59899
+ max-height: 100%;
59900
+ min-height: 0;
59901
+ `, [cE("header", `
59902
+ border-bottom: 1px solid var(--u-border-color);
59903
+ width: 100%;
59904
+ padding: 24px 20px 8px 24px;
59905
+ flex-shrink: 0;
59906
+ `), cE("header-title", `
59907
+ margin-top: 9px;
59908
+ color: var(--u-header-title-color);
59909
+ `), cE("header-actions", `
59910
+ padding: 4px;
59911
+ `), cE("unread-notification", `
59912
+ background-color: var(--u-unread-notification-background-color);
59913
+ color: var(--u-unread-notification-text-color);
59914
+ padding: 6px 12px;
59915
+ text-align: center;
59916
+ font-size: 14px;
59917
+ font-weight: 500;
59918
+ margin: 8px 0;
59919
+ display: flex;
59920
+ justify-content: center;
59921
+ width: 100%;
59922
+ `, [c$1("span", `
59923
+ display: inline-block;
59924
+ white-space: nowrap;
59925
+ `)]), cE("body", `
59926
+ flex: 1;
59927
+ min-height: 0;
59928
+ position: relative;
59929
+ `, [c$1(".u-scrollbar-content", `
59930
+ padding: 16px 24px;
59931
+ min-height: 100%;
59932
+ display: flex;
59933
+ flex-direction: column;
59934
+ justify-content: flex-end;
59935
+ `)]), cE("messages-container", `
59936
+ display: flex;
59937
+ flex-direction: column;
59938
+ gap: 16px;
59939
+ min-height: 100%;
59940
+ width: 100%;
59941
+ justify-content: flex-end;
59942
+ `), cE("date-separator", `
59943
+ display: flex;
59944
+ justify-content: center;
59945
+ margin: 16px 0;
59946
+ `, [c$1("span", `
59947
+ color: var(--u-date-separator-color);
59948
+ padding: 4px 12px;
59949
+ border-radius: 12px;
59950
+ font-size: 14px;
59951
+ font-weight: 500;
59952
+ `)]), cE("mark", `
59953
+ display: flex;
59954
+ justify-content: center;
59955
+ margin: 12px 0;
59956
+ width: 100%;
59957
+ `, [c$1("span", `
59958
+ padding: 6px 12px;
59959
+ border-radius: 8px;
59960
+ color: var(--u-text-color-secondary);
59961
+ background-color: var(--u-date-separator-background-color);
59962
+ text-align: center;
59963
+ `)]), cE("message", `
59964
+ display: flex;
59965
+ margin-bottom: 8px;
59966
+ flex-shrink: 0;
59967
+ width: 100%;
59968
+ `, [cM("own", `
59969
+ justify-content: flex-end;
59970
+ `), cM("other", `
59971
+ justify-content: flex-start;
59972
+ `)]), cE("message-wrapper", `
59973
+ max-width: 70%;
59974
+ display: flex;
59975
+ flex-direction: column;
59976
+ gap: 4px;
59977
+ flex-shrink: 0;
59978
+ `), cE("message-bubble", `
59979
+ border-radius: 18px;
59980
+ font-size: 14px;
59981
+ line-height: 20px;
59982
+ word-wrap: break-word;
59983
+ background-color: var(--u-message-bubble-background-color-other);
59984
+ color: var(--u-message-bubble-text-color-other);
59985
+ border-bottom-left-radius: 6px;
59986
+ width: fit-content;
59987
+ display: flex;
59988
+ flex-direction: column;
59989
+ `, [cM("own", `
59990
+ background-color: var(--u-message-bubble-background-color-own);
59991
+ color: var(--u-message-bubble-text-color-own);
59992
+ border-bottom-left-radius: 18px;
59993
+ border-bottom-right-radius: 6px;
59994
+ `), cM("typing", `
59995
+ min-width: 300px;
59996
+ height: 44px;
59997
+ padding: 12px 16px;
59998
+ `), cM("skeleton", `
59999
+ min-width: 376px;
60000
+ height: 44px;
60001
+ `)]), cE("message-text", `
60002
+ padding: 12px 16px;
60003
+ `), cE("message-attachment", `
60004
+ display: flex;
60005
+ align-items: center;
60006
+ gap: 12px;
60007
+ padding: 12px 16px;
60008
+ background-color: #f8f9fa;
60009
+ border-radius: 12px;
60010
+ border: 1px solid #e9ecef;
60011
+ margin-top: 4px;
60012
+ `), cE("attachment-icon", `
60013
+ color: #6c757d;
60014
+ flex-shrink: 0;
60015
+ `), cE("attachment-info", `
60016
+ flex: 1;
60017
+ min-width: 0;
60018
+ `), cE("attachment-name", `
60019
+ font-size: 14px;
60020
+ font-weight: 500;
60021
+ color: var(--u-text-color-base);
60022
+ margin-bottom: 2px;
60023
+ `), cE("attachment-size", `
60024
+ font-size: 12px;
60025
+ color: var(--u-text-color-disabled);
60026
+ `), cE("message-meta", `
60027
+ display: flex;
60028
+ align-items: center;
60029
+ gap: 4px;
60030
+ font-size: 11px;
60031
+ color: var(--u-text-color-disabled);
60032
+ margin-top: 2px;
60033
+ `, [cM("own", `
60034
+ justify-content: flex-end;
60035
+ `), cM("other", `
60036
+ justify-content: flex-start;
60037
+ `), cM("skeleton", `
60038
+ width: 36px;
60039
+ height: 20px;
60040
+ border-radius: 4px;
60041
+ `)]), cE("message-time", `
60042
+ font-size: 11px;
60043
+ color: var(--u-message-time-color);
60044
+ `), cE("message-status", `
60045
+ color: var(--u-color-success);
60046
+ display: flex;
60047
+ align-items: center;
60048
+ `), cE("message-status-icon", `
60049
+ color: var(--u-message-time-color);
60050
+ `, [cM("read", `
60051
+ color: var(--u-unread-notification-background-color);
60052
+ `), cM("retry", `
60053
+ color: var(--u-color-error);
60054
+ `)]), cE("message-retry", `
60055
+ display: flex;
60056
+ align-items: center;
60057
+ gap: 4px;
60058
+ `), cE("message-retry-icon", `
60059
+ color: var(--u-color-error);
60060
+ `), cE("message-retry-text", `
60061
+ color: var(--u-color-error);
60062
+ font-size: 11px;
60063
+ font-weight: 500;
60064
+ `), cE("typing-indicator", `
60065
+ display: flex;
60066
+ justify-content: flex-start;
60067
+ margin-bottom: 8px;
60068
+ `), cE("footer", `
60069
+ border-top: 1px solid var(--u-border-color);
60070
+ padding: 0px 20px;
60071
+ flex-shrink: 0;
60072
+ `), cE("input-container", `
60073
+ width: 100%;
60074
+ padding: 16px 0px;
60075
+ `), cE("input", `
60076
+ flex: 1;
60077
+ margin-right: 4px;
60078
+ `), cE("attach-btn", `
60079
+ margin-left: 4px;
60080
+ flex-shrink: 0;
60081
+ padding: 0 12px;
60082
+ `)]), c$1("*", `
60083
+ box-sizing: border-box;
60084
+ `), c$1(".u-list-item .u-list-item__text", `
60085
+ grid-template-columns: 1fr !important;
60086
+ `), c$1(".u-upload-file-list .u-upload-file.u-upload-file--text-type", `
60087
+ margin-bottom: 0px;
60088
+ `), c$1(".u-chat-main__message-bubble--own .u-upload-file", `
60089
+ background-color: var(--u-attachment-background-color-own);
60090
+ `), c$1(".u-chat-main__message-bubble--other .u-upload-file", `
60091
+ background-color: var(--u-attachment-background-color-other);
60092
+ `)]);
60093
+
60094
+ const chatInputLight = {
60095
+ ...inputLight,
60096
+ self(vars) {
60097
+ const originalInputSelf = self$1e(vars);
60098
+ const {
60099
+ elementsTertiary
60100
+ } = vars;
60101
+ return {
60102
+ ...originalInputSelf,
60103
+ color: elementsTertiary,
60104
+ colorFocus: elementsTertiary,
60105
+ border: "none",
60106
+ borderFocus: "none",
60107
+ borderHover: "none",
60108
+ boxShadow: "none",
60109
+ boxShadowFocus: "none"
60110
+ };
60111
+ }
60112
+ };
60113
+ const chatBadgeLight = {
60114
+ ...badgeLight,
60115
+ self(vars) {
60116
+ const originalBadgeSelf = self$19(vars);
60117
+ const {
60118
+ brandPrimary400,
60119
+ elementsSecondary
60120
+ } = vars;
60121
+ return {
60122
+ ...originalBadgeSelf,
60123
+ color: brandPrimary400,
60124
+ textColor: elementsSecondary
60125
+ };
60126
+ }
60127
+ };
60128
+ const self$6 = vars => {
60129
+ const {
60130
+ borderRadiusLarge,
60131
+ elementsQuaternary,
60132
+ elementsTertiary,
60133
+ textTertiary,
60134
+ textPrimary,
60135
+ textSecondary,
60136
+ surfacePrimary,
60137
+ brandPrimary500,
60138
+ brandPrimary400,
60139
+ transparencySecondary,
60140
+ elementsSecondary,
60141
+ elementsDarkQuinary,
60142
+ staticRed,
60143
+ staticWhite
60144
+ } = vars;
60145
+ return {
60146
+ backgroundColor: surfacePrimary,
60147
+ borderColor: elementsQuaternary,
60148
+ sidebarBackgroundColor: surfacePrimary,
60149
+ sidebarBorderColor: elementsQuaternary,
60150
+ sidebarItemBackgroundColor: "transparent",
60151
+ sidebarItemBackgroundColorHover: elementsTertiary,
60152
+ sidebarItemBackgroundColorSelected: transparencySecondary,
60153
+ sidebarItemTextColor: textPrimary,
60154
+ sidebarItemTextColorSelected: brandPrimary500,
60155
+ sidebarItemSubtitleColor: textSecondary,
60156
+ sidebarItemTimeColor: elementsDarkQuinary,
60157
+ mainBackgroundColor: surfacePrimary,
60158
+ headerBackgroundColor: surfacePrimary,
60159
+ headerBorderColor: elementsQuaternary,
60160
+ headerTitleColor: textPrimary,
60161
+ messageBubbleBackgroundColorOwn: elementsTertiary,
60162
+ messageBubbleBackgroundColorOther: elementsTertiary,
60163
+ messageBubbleTextColorOwn: textPrimary,
60164
+ messageBubbleTextColorOther: textPrimary,
60165
+ messageTimeColor: textTertiary,
60166
+ messageStatusColor: textSecondary,
60167
+ attachmentBackgroundColorOwn: staticWhite,
60168
+ attachmentBackgroundColorOther: staticWhite,
60169
+ footerBackgroundColor: surfacePrimary,
60170
+ footerBorderColor: elementsQuaternary,
60171
+ inputBackgroundColor: surfacePrimary,
60172
+ inputBorderColor: elementsQuaternary,
60173
+ unreadNotificationBackgroundColor: brandPrimary400,
60174
+ unreadNotificationTextColor: elementsSecondary,
60175
+ typingIndicatorColor: textSecondary,
60176
+ dateSeparatorColor: textTertiary,
60177
+ dateSeparatorBackgroundColor: "transparent",
60178
+ borderRadius: borderRadiusLarge,
60179
+ errorColor: staticRed
60180
+ };
60181
+ };
60182
+ const chatLight = createTheme$1({
60183
+ name: "Chat",
60184
+ common: derived,
60185
+ peers: {
60186
+ Input: chatInputLight,
60187
+ Empty: emptyLight,
60188
+ Select: selectLight,
60189
+ Avatar: avatarLight,
60190
+ Badge: chatBadgeLight,
60191
+ Button: buttonLight,
60192
+ Icon: iconLight,
60193
+ List: listLight,
60194
+ Typography: typographyLight$1
60195
+ },
60196
+ self: self$6
60197
+ });
60198
+
60199
+ const chatDark = createTheme$1({
60200
+ name: "Chat",
60201
+ common: derived$1,
60202
+ peers: {
60203
+ Input: inputDark,
60204
+ Empty: emptyDark$1,
60205
+ Select: selectDark,
60206
+ Avatar: avatarDark,
60207
+ Badge: badgeDark,
60208
+ Button: buttonDark,
60209
+ Icon: iconDark$1,
60210
+ List: listDark$1,
60211
+ Typography: typographyDark
60212
+ },
60213
+ self: vars => {
60214
+ const lightVars = self$6(vars);
60215
+ return {
60216
+ ...lightVars
60217
+ };
60218
+ }
60219
+ });
60220
+
59748
60221
  const statusIconMapper$1 = {
59749
60222
  [MessageStatus.READ]: CheckmarkDoneSharp,
59750
60223
  [MessageStatus.PENDING]: MdTime,
59751
60224
  [MessageStatus.RETRY]: Refresh,
59752
60225
  [MessageStatus.UNREAD]: CheckmarkDoneSharp
59753
60226
  };
59754
- var ChatSidebar = vue.defineComponent({
59755
- name: "ChatSidebar",
59756
- setup(props, { slots }) {
59757
- return { slots };
60227
+ const chatListItemsProps = {
60228
+ ...useTheme.props,
60229
+ chatItems: {
60230
+ type: Array,
60231
+ default: () => []
59758
60232
  },
59759
- render() {
59760
- const { slots } = this;
59761
- const {
59762
- mergedClsPrefixRef,
59763
- chatItemsRef,
59764
- chatItemsLoadingRef,
59765
- chatItemsLoadingCountRef,
59766
- listEmptyPropsRef,
59767
- selectedChatIdRef,
59768
- typingChatIdsRef,
59769
- typingTextRef,
59770
- listItemAvatarPropsRef,
59771
- listItemBadgePropsRef,
59772
- handleChatSelect
59773
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
59774
- } = vue.inject(chatInjectionKey);
59775
- const renderListHeader = () => {
59776
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__header` }, /* @__PURE__ */ vue.h(
59777
- UFlex,
59778
- {
59779
- align: "center",
59780
- justify: "space-between",
59781
- style: { width: "100%" }
59782
- },
59783
- /* @__PURE__ */ vue.h(
59784
- "div",
59785
- {
59786
- class: `${mergedClsPrefixRef.value}-chat-sidebar__header-main`
59787
- },
59788
- slots.sidebarHeaderMain?.() || /* @__PURE__ */ vue.h(USelect, { round: true })
59789
- ),
59790
- /* @__PURE__ */ vue.h(
59791
- "div",
59792
- {
59793
- class: `${mergedClsPrefixRef.value}-chat-sidebar__header-actions`
59794
- },
59795
- slots.sidebarHeaderActions?.()
59796
- )
59797
- ));
59798
- };
59799
- const renderChatItem = (item) => {
59800
- const isSelected = selectedChatIdRef.value === item.id;
59801
- const isTyping = typingChatIdsRef.value?.includes(item.id) ?? false;
59802
- return /* @__PURE__ */ vue.h(
59803
- UListItem,
59804
- {
59805
- key: item.id,
59806
- showIcon: false,
59807
- onClick: () => {
59808
- handleChatSelect(item.id);
59809
- },
59810
- class: [
59811
- `${mergedClsPrefixRef.value}-chat-sidebar__item`,
59812
- isSelected && `${mergedClsPrefixRef.value}-chat-sidebar__item--selected`,
59813
- isTyping && `${mergedClsPrefixRef.value}-chat-sidebar__item--typing`
59814
- ]
60233
+ selectedChatId: {
60234
+ type: [String, Number, Symbol],
60235
+ default: void 0
60236
+ },
60237
+ typingChatIds: {
60238
+ type: Array,
60239
+ default: () => []
60240
+ },
60241
+ typingText: {
60242
+ type: String,
60243
+ default: void 0
60244
+ },
60245
+ loading: {
60246
+ type: Boolean,
60247
+ default: false
60248
+ },
60249
+ loadingCount: {
60250
+ type: Number,
60251
+ default: 10
60252
+ },
60253
+ emptyProps: {
60254
+ type: Object,
60255
+ default: void 0
60256
+ },
60257
+ avatarProps: {
60258
+ type: Object,
60259
+ default: void 0
60260
+ },
60261
+ badgeProps: {
60262
+ type: Object,
60263
+ default: void 0
60264
+ },
60265
+ onChatSelect: {
60266
+ type: Function,
60267
+ default: void 0
60268
+ },
60269
+ notificationsShown: {
60270
+ type: Object,
60271
+ default: () => /* @__PURE__ */ new Set()
60272
+ }
60273
+ };
60274
+ var UChatListItems = vue.defineComponent({
60275
+ name: "ChatListItems",
60276
+ props: chatListItemsProps,
60277
+ setup(props, { slots }) {
60278
+ const UChat = vue.inject(chatInjectionKey, null);
60279
+ const { mergedClsPrefixRef } = useConfig(props);
60280
+ const themeRef = UChat?.mergedThemeRef ?? useTheme("Chat", "-chat", style$12, chatLight, props, mergedClsPrefixRef);
60281
+ const { localeRef } = useLocale("Chat");
60282
+ const cssVarsRef = vue.computed(() => {
60283
+ const {
60284
+ common: {
60285
+ cubicBezierEaseInOut,
60286
+ brandPrimary500,
60287
+ staticGreen,
60288
+ staticRed,
60289
+ textPrimary,
60290
+ textSecondary,
60291
+ textTertiary
60292
+ },
60293
+ self: {
60294
+ backgroundColor,
60295
+ borderColor,
60296
+ sidebarBackgroundColor,
60297
+ sidebarBorderColor,
60298
+ sidebarItemBackgroundColor,
60299
+ sidebarItemBackgroundColorHover,
60300
+ sidebarItemBackgroundColorSelected,
60301
+ sidebarItemTextColor,
60302
+ sidebarItemTextColorSelected,
60303
+ sidebarItemSubtitleColor,
60304
+ sidebarItemTimeColor,
60305
+ unreadNotificationBackgroundColor,
60306
+ borderRadius
60307
+ }
60308
+ } = themeRef.value;
60309
+ return {
60310
+ "--u-bezier": cubicBezierEaseInOut,
60311
+ "--u-color-primary": brandPrimary500,
60312
+ "--u-color-success": staticGreen,
60313
+ "--u-color-error": staticRed,
60314
+ "--u-text-color-base": textPrimary,
60315
+ "--u-text-color-secondary": textSecondary,
60316
+ "--u-text-color-disabled": textTertiary,
60317
+ "--u-background-color": backgroundColor,
60318
+ "--u-border-color": borderColor,
60319
+ "--u-sidebar-background-color": sidebarBackgroundColor,
60320
+ "--u-sidebar-border-color": sidebarBorderColor,
60321
+ "--u-sidebar-item-background-color": sidebarItemBackgroundColor,
60322
+ "--u-sidebar-item-background-color-hover": sidebarItemBackgroundColorHover,
60323
+ "--u-sidebar-item-background-color-selected": sidebarItemBackgroundColorSelected,
60324
+ "--u-sidebar-item-text-color": sidebarItemTextColor,
60325
+ "--u-sidebar-item-text-color-selected": sidebarItemTextColorSelected,
60326
+ "--u-sidebar-item-subtitle-color": sidebarItemSubtitleColor,
60327
+ "--u-sidebar-item-time-color": sidebarItemTimeColor,
60328
+ "--u-unread-notification-background-color": unreadNotificationBackgroundColor,
60329
+ "--u-border-radius": borderRadius
60330
+ };
60331
+ });
60332
+ const themeClassHandle = useThemeClass(
60333
+ "chat-list-items",
60334
+ vue.computed(() => ""),
60335
+ cssVarsRef,
60336
+ props
60337
+ );
60338
+ const mergedTypingTextRef = vue.computed(
60339
+ () => props.typingText ?? localeRef.value.typingText
60340
+ );
60341
+ const handleChatSelect = (chatId) => {
60342
+ props.onChatSelect?.(chatId);
60343
+ };
60344
+ const renderChatItem = (item) => {
60345
+ const isSelected = props.selectedChatId === item.id;
60346
+ const isTyping = props.typingChatIds?.includes(item.id) ?? false;
60347
+ return /* @__PURE__ */ vue.h(
60348
+ UListItem,
60349
+ {
60350
+ key: item.id,
60351
+ showIcon: false,
60352
+ onClick: () => {
60353
+ handleChatSelect(item.id);
60354
+ },
60355
+ class: [
60356
+ `${mergedClsPrefixRef.value}-chat-sidebar__item`,
60357
+ isSelected && `${mergedClsPrefixRef.value}-chat-sidebar__item--selected`,
60358
+ isTyping && `${mergedClsPrefixRef.value}-chat-sidebar__item--typing`
60359
+ ]
59815
60360
  },
59816
60361
  {
59817
60362
  prefix: () => /* @__PURE__ */ vue.h(
@@ -59819,9 +60364,13 @@
59819
60364
  {
59820
60365
  size: "medium",
59821
60366
  src: typeof item.avatar === "string" ? item.avatar : void 0,
59822
- ...listItemAvatarPropsRef.value
60367
+ ...props.avatarProps,
60368
+ theme: themeRef.value.peers.Avatar,
60369
+ themeOverrides: themeRef.value.peerOverrides.Avatar
59823
60370
  },
59824
- typeof item.avatar === "function" ? item.avatar() : typeof item.title === "string" ? item.title.charAt(0)?.toUpperCase() : "?"
60371
+ {
60372
+ default: () => typeof item.avatar === "function" ? item.avatar() : typeof item.title === "string" ? item.title.charAt(0)?.toUpperCase() : "?"
60373
+ }
59825
60374
  ),
59826
60375
  header: () => /* @__PURE__ */ vue.h(
59827
60376
  "span",
@@ -59846,13 +60395,10 @@
59846
60395
  maxWidth: "100%"
59847
60396
  }
59848
60397
  },
59849
- isTyping ? typingTextRef.value : typeof item.subtitle === "string" ? item.subtitle : typeof item.subtitle === "function" ? item.subtitle() : item.subtitle
60398
+ isTyping ? mergedTypingTextRef.value : typeof item.subtitle === "string" ? item.subtitle : typeof item.subtitle === "function" ? item.subtitle() : item.subtitle
59850
60399
  ),
59851
60400
  suffix: () => {
59852
- const getChatGlobalState = () => ChatGlobalState.getInstance();
59853
- const globalState = getChatGlobalState();
59854
- const wasOpened = globalState.isChatOpened(item.id);
59855
- const displayUnreadCount = wasOpened ? 0 : item.unreadCount || 0;
60401
+ const displayUnreadCount = item.unreadCount || 0;
59856
60402
  const hasUnreadIncoming = displayUnreadCount > 0;
59857
60403
  const lastMessageIsOwn = item.lastMessageIsOwn;
59858
60404
  return /* @__PURE__ */ vue.h(
@@ -59880,14 +60426,18 @@
59880
60426
  class: [
59881
60427
  `${mergedClsPrefixRef.value}-chat-sidebar__item-status-icon`,
59882
60428
  `${mergedClsPrefixRef.value}-chat-sidebar__item-status-icon--${item.messageStatus}`
59883
- ]
60429
+ ],
60430
+ theme: themeRef.value.peers.Icon,
60431
+ themeOverrides: themeRef.value.peerOverrides.Icon
59884
60432
  }
59885
60433
  ) : null),
59886
60434
  !lastMessageIsOwn && hasUnreadIncoming && /* @__PURE__ */ vue.h(
59887
60435
  UBadge,
59888
60436
  {
59889
60437
  value: displayUnreadCount,
59890
- ...listItemBadgePropsRef.value
60438
+ ...props.badgeProps,
60439
+ theme: themeRef.value.peers.Badge,
60440
+ themeOverrides: themeRef.value.peerOverrides.Badge
59891
60441
  }
59892
60442
  )
59893
60443
  )
@@ -59896,17 +60446,203 @@
59896
60446
  }
59897
60447
  );
59898
60448
  };
59899
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar` }, renderListHeader(), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__content` }, chatItemsLoadingRef.value ? /* @__PURE__ */ vue.h(UList, { loading: true }, Array.from({ length: chatItemsLoadingCountRef.value || 10 }).map(
59900
- (_, index) => /* @__PURE__ */ vue.h(
59901
- UListItem,
60449
+ return {
60450
+ mergedClsPrefixRef,
60451
+ mergedTheme: themeRef,
60452
+ renderChatItem,
60453
+ cssVars: cssVarsRef,
60454
+ themeClass: themeClassHandle?.themeClass,
60455
+ onRender: themeClassHandle?.onRender
60456
+ };
60457
+ },
60458
+ render() {
60459
+ this.onRender?.();
60460
+ const { mergedClsPrefixRef, renderChatItem } = this;
60461
+ const content = (() => {
60462
+ if (this.loading) {
60463
+ return /* @__PURE__ */ vue.h(
60464
+ UList,
60465
+ {
60466
+ loading: true,
60467
+ theme: this.mergedTheme.peers.List,
60468
+ themeOverrides: this.mergedTheme.peerOverrides.List
60469
+ },
60470
+ {
60471
+ default: () => Array.from({ length: this.loadingCount || 10 }).map(
60472
+ (_, index) => /* @__PURE__ */ vue.h(
60473
+ UListItem,
60474
+ {
60475
+ key: index,
60476
+ avatar: { icon: PersonOutline },
60477
+ description: { text: "Loading..." },
60478
+ header: { text: "Loading..." }
60479
+ }
60480
+ )
60481
+ )
60482
+ }
60483
+ );
60484
+ }
60485
+ if (this.chatItems?.length) {
60486
+ return /* @__PURE__ */ vue.h(
60487
+ UList,
60488
+ {
60489
+ showIcon: false,
60490
+ theme: this.mergedTheme.peers.List,
60491
+ themeOverrides: this.mergedTheme.peerOverrides.List
60492
+ },
60493
+ {
60494
+ default: () => this.chatItems?.map((item) => renderChatItem(item))
60495
+ }
60496
+ );
60497
+ }
60498
+ return /* @__PURE__ */ vue.h(
60499
+ UEmpty,
59902
60500
  {
59903
- key: index,
59904
- avatar: { icon: PersonOutline },
59905
- description: { text: "Loading..." },
59906
- header: { text: "Loading..." }
60501
+ ...this.emptyProps,
60502
+ theme: this.mergedTheme.peers.Empty,
60503
+ themeOverrides: this.mergedTheme.peerOverrides.Empty
59907
60504
  }
60505
+ );
60506
+ })();
60507
+ return /* @__PURE__ */ vue.h(
60508
+ "div",
60509
+ {
60510
+ class: [`${mergedClsPrefixRef}-chat`, this.themeClass],
60511
+ style: this.cssVars
60512
+ },
60513
+ /* @__PURE__ */ vue.h(
60514
+ "div",
60515
+ {
60516
+ class: `${mergedClsPrefixRef}-chat-sidebar`,
60517
+ style: {
60518
+ border: "none",
60519
+ borderRadius: "0",
60520
+ padding: "0",
60521
+ maxWidth: "100%",
60522
+ background: "transparent"
60523
+ }
60524
+ },
60525
+ /* @__PURE__ */ vue.h(
60526
+ "div",
60527
+ {
60528
+ class: `${mergedClsPrefixRef}-chat-sidebar__content`,
60529
+ style: {
60530
+ padding: "0"
60531
+ }
60532
+ },
60533
+ content
60534
+ )
59908
60535
  )
59909
- )) : chatItemsRef.value?.length ? /* @__PURE__ */ vue.h(UList, { showIcon: false }, chatItemsRef.value?.map((item) => renderChatItem(item))) : /* @__PURE__ */ vue.h(UEmpty, { ...listEmptyPropsRef.value })));
60536
+ );
60537
+ }
60538
+ });
60539
+
60540
+ var ChatSidebar = vue.defineComponent({
60541
+ name: "ChatSidebar",
60542
+ setup(props, { slots }) {
60543
+ return { slots };
60544
+ },
60545
+ render() {
60546
+ const { slots } = this;
60547
+ const {
60548
+ mergedClsPrefixRef,
60549
+ mergedThemeRef,
60550
+ chatItemsRef,
60551
+ chatItemsLoadingRef,
60552
+ chatItemsLoadingCountRef,
60553
+ listEmptyPropsRef,
60554
+ selectedChatIdRef,
60555
+ typingChatIdsRef,
60556
+ typingTextRef,
60557
+ listItemAvatarPropsRef,
60558
+ listItemBadgePropsRef,
60559
+ notificationsShownSetRef,
60560
+ handleChatSelect
60561
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
60562
+ } = vue.inject(chatInjectionKey);
60563
+ const renderListHeader = () => {
60564
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__header` }, /* @__PURE__ */ vue.h(
60565
+ UFlex,
60566
+ {
60567
+ align: "center",
60568
+ justify: "space-between",
60569
+ class: `${mergedClsPrefixRef.value}-chat-sidebar__header-container`,
60570
+ style: { width: "100%" }
60571
+ },
60572
+ {
60573
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(
60574
+ "div",
60575
+ {
60576
+ class: `${mergedClsPrefixRef.value}-chat-sidebar__header-main`
60577
+ },
60578
+ slots.sidebarHeaderMain?.() || /* @__PURE__ */ vue.h(
60579
+ USelect,
60580
+ {
60581
+ round: true,
60582
+ size: "tiny",
60583
+ theme: mergedThemeRef.value.peers.Select,
60584
+ themeOverrides: mergedThemeRef.value.peerOverrides.Select
60585
+ }
60586
+ )
60587
+ ), /* @__PURE__ */ vue.h(
60588
+ "div",
60589
+ {
60590
+ class: `${mergedClsPrefixRef.value}-chat-sidebar__header-actions`
60591
+ },
60592
+ slots.sidebarHeaderActions?.()
60593
+ ))
60594
+ }
60595
+ ));
60596
+ };
60597
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar` }, renderListHeader(), /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-sidebar__content` }, /* @__PURE__ */ vue.h(
60598
+ UChatListItems,
60599
+ {
60600
+ chatItems: chatItemsRef.value,
60601
+ selectedChatId: selectedChatIdRef.value,
60602
+ typingChatIds: typingChatIdsRef.value,
60603
+ typingText: typingTextRef.value,
60604
+ loading: chatItemsLoadingRef.value,
60605
+ loadingCount: chatItemsLoadingCountRef.value,
60606
+ emptyProps: listEmptyPropsRef.value,
60607
+ avatarProps: listItemAvatarPropsRef.value,
60608
+ badgeProps: listItemBadgePropsRef.value,
60609
+ notificationsShown: notificationsShownSetRef.value,
60610
+ onChatSelect: handleChatSelect
60611
+ },
60612
+ {
60613
+ chatItemStatus: slots.chatItemStatus
60614
+ }
60615
+ )));
60616
+ }
60617
+ });
60618
+
60619
+ const scrollbarProps = {
60620
+ ...useTheme.props,
60621
+ trigger: String,
60622
+ xScrollable: Boolean,
60623
+ onScroll: Function,
60624
+ size: Number
60625
+ };
60626
+ const Scrollbar = vue.defineComponent({
60627
+ name: "Scrollbar",
60628
+ props: scrollbarProps,
60629
+ setup() {
60630
+ const scrollbarInstRef = vue.ref(null);
60631
+ const exposedMethods = {
60632
+ scrollTo: (...args) => {
60633
+ scrollbarInstRef.value?.scrollTo(args[0], args[1]);
60634
+ },
60635
+ scrollBy: (...args) => {
60636
+ scrollbarInstRef.value?.scrollBy(args[0], args[1]);
60637
+ }
60638
+ };
60639
+ return {
60640
+ ...exposedMethods,
60641
+ scrollbarInstRef
60642
+ };
60643
+ },
60644
+ render() {
60645
+ return /* @__PURE__ */ vue.h(Scrollbar$1, { ref: "scrollbarInstRef", ...this.$props }, this.$slots);
59910
60646
  }
59911
60647
  });
59912
60648
 
@@ -60216,7 +60952,7 @@
60216
60952
  }
60217
60953
  });
60218
60954
 
60219
- var style$12 = c$1([c$1("@keyframes spin-rotate", `
60955
+ var style$11 = c$1([c$1("@keyframes spin-rotate", `
60220
60956
  from {
60221
60957
  transform: rotate(0);
60222
60958
  }
@@ -60315,7 +61051,7 @@
60315
61051
  const themeRef = useTheme(
60316
61052
  "Spin",
60317
61053
  "-spin",
60318
- style$12,
61054
+ style$11,
60319
61055
  spinLight,
60320
61056
  props,
60321
61057
  mergedClsPrefixRef
@@ -60811,7 +61547,7 @@
60811
61547
  };
60812
61548
  const imageContextKey = createInjectionKey("u-image");
60813
61549
 
60814
- const self$6 = vars => {
61550
+ const self$5 = vars => {
60815
61551
  const {
60816
61552
  elementsSecondary,
60817
61553
  elementsSenary,
@@ -60831,7 +61567,7 @@
60831
61567
  peers: {
60832
61568
  Tooltip: tooltipLight
60833
61569
  },
60834
- self: self$6
61570
+ self: self$5
60835
61571
  });
60836
61572
 
60837
61573
  const imageDark = {
@@ -60840,7 +61576,7 @@
60840
61576
  peers: {
60841
61577
  Tooltip: tooltipDark
60842
61578
  },
60843
- self: self$6
61579
+ self: self$5
60844
61580
  };
60845
61581
 
60846
61582
  const prevIcon = /* @__PURE__ */ vue.h("svg", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ vue.h(
@@ -60881,7 +61617,7 @@
60881
61617
  )
60882
61618
  );
60883
61619
 
60884
- var style$11 = c$1([c$1("body >", [cB("image-container", "position: fixed;")]), cB("image-preview-container", `
61620
+ var style$10 = c$1([c$1("body >", [cB("image-container", "position: fixed;")]), cB("image-preview-container", `
60885
61621
  position: fixed;
60886
61622
  left: 0;
60887
61623
  right: 0;
@@ -60957,7 +61693,7 @@
60957
61693
  const themeRef = useTheme(
60958
61694
  "Image",
60959
61695
  "-image",
60960
- style$11,
61696
+ style$10,
60961
61697
  imageLight,
60962
61698
  props,
60963
61699
  vue.toRef(props, "clsPrefix")
@@ -61815,7 +62551,7 @@
61815
62551
  }
61816
62552
  });
61817
62553
 
61818
- var style$10 = c$1([cB("upload", "width: var(--u-upload-width)", [cM("dragger-inside", [cB("upload-trigger", `
62554
+ var style$$ = c$1([cB("upload", "width: var(--u-upload-width)", [cM("dragger-inside", [cB("upload-trigger", `
61819
62555
  display: block;
61820
62556
  `)]), cM("drag-over", [cB("upload-dragger", `
61821
62557
  border: var(--u-dragger-border-hover);
@@ -62585,7 +63321,7 @@
62585
63321
  const themeRef = useTheme(
62586
63322
  "Upload",
62587
63323
  "-upload",
62588
- style$10,
63324
+ style$$,
62589
63325
  uploadLight,
62590
63326
  props,
62591
63327
  mergedClsPrefixRef
@@ -62987,122 +63723,7 @@
62987
63723
  }
62988
63724
  });
62989
63725
 
62990
- var ChatAttachmentComponent = vue.defineComponent({
62991
- name: "ChatAttachment",
62992
- props: {
62993
- message: {
62994
- type: Object,
62995
- required: true
62996
- },
62997
- attachments: {
62998
- type: Array,
62999
- required: true
63000
- },
63001
- uploadProps: {
63002
- type: Object,
63003
- default: () => ({})
63004
- },
63005
- withPadding: {
63006
- type: Boolean,
63007
- default: false
63008
- }
63009
- },
63010
- setup(props, { slots }) {
63011
- const getThumbnailUrl = (att) => {
63012
- const url = [att.preview, att.thumbnail].find(
63013
- (value) => typeof value === "string"
63014
- );
63015
- return url ?? null;
63016
- };
63017
- const renderAttachment = () => {
63018
- const fileList = props.attachments.map(
63019
- (att, index) => ({
63020
- id: `${String(props.message.id)}-attachment-${index}`,
63021
- name: att.name,
63022
- status: att.status || "finished",
63023
- percentage: att.percentage ?? null,
63024
- url: att.url ?? null,
63025
- thumbnailUrl: getThumbnailUrl(att),
63026
- type: att.type ?? null,
63027
- file: null,
63028
- batchId: null
63029
- })
63030
- );
63031
- const uploadComponent = /* @__PURE__ */ vue.h(
63032
- UUpload,
63033
- {
63034
- abstract: true,
63035
- fileList,
63036
- fileListStyle: props.withPadding ? {
63037
- display: "flex",
63038
- flexDirection: "column",
63039
- gap: "2px",
63040
- marginTop: "0"
63041
- } : void 0,
63042
- showRemoveButton: false,
63043
- showDownloadButton: props.attachments.some(
63044
- (att) => att.status === "finished"
63045
- ),
63046
- showRetryButton: props.attachments.some(
63047
- (att) => att.status === "error"
63048
- ),
63049
- ...props.uploadProps
63050
- },
63051
- /* @__PURE__ */ vue.h(UUploadFileList, null, {
63052
- "upload-file-title": slots["upload-file-title"] ? ({ file }) => slots["upload-file-title"]?.(file) : void 0,
63053
- "upload-file-subtitle": slots["upload-file-subtitle"] ? ({ file }) => slots["upload-file-subtitle"]?.(file) : ({ file }) => {
63054
- const att = props.attachments.find(
63055
- (a) => a.name === file.name
63056
- );
63057
- return /* @__PURE__ */ vue.h("span", { style: { fontSize: "12px", color: "#999" } }, att?.size || file.file?.size);
63058
- }
63059
- })
63060
- );
63061
- if (props.withPadding) {
63062
- return /* @__PURE__ */ vue.h("div", { style: { padding: "2px" } }, uploadComponent);
63063
- }
63064
- return uploadComponent;
63065
- };
63066
- return () => {
63067
- if (slots.default) {
63068
- return slots.default(props.message);
63069
- }
63070
- return renderAttachment();
63071
- };
63072
- }
63073
- });
63074
-
63075
- const scrollbarProps = {
63076
- ...useTheme.props,
63077
- trigger: String,
63078
- xScrollable: Boolean,
63079
- onScroll: Function,
63080
- size: Number
63081
- };
63082
- const Scrollbar = vue.defineComponent({
63083
- name: "Scrollbar",
63084
- props: scrollbarProps,
63085
- setup() {
63086
- const scrollbarInstRef = vue.ref(null);
63087
- const exposedMethods = {
63088
- scrollTo: (...args) => {
63089
- scrollbarInstRef.value?.scrollTo(args[0], args[1]);
63090
- },
63091
- scrollBy: (...args) => {
63092
- scrollbarInstRef.value?.scrollBy(args[0], args[1]);
63093
- }
63094
- };
63095
- return {
63096
- ...exposedMethods,
63097
- scrollbarInstRef
63098
- };
63099
- },
63100
- render() {
63101
- return /* @__PURE__ */ vue.h(Scrollbar$1, { ref: "scrollbarInstRef", ...this.$props }, this.$slots);
63102
- }
63103
- });
63104
-
63105
- var style$$ = cB("h", `
63726
+ var style$_ = cB("h", `
63106
63727
  font-size: var(--u-font-size);
63107
63728
  font-weight: var(--u-font-weight);
63108
63729
  margin: var(--u-margin);
@@ -63150,7 +63771,7 @@
63150
63771
  mergedClsPrefixRef,
63151
63772
  inlineThemeDisabled
63152
63773
  } = useConfig(props);
63153
- const themeRef = useTheme("Typography", "-h", style$$, typographyLight$1, props, mergedClsPrefixRef);
63774
+ const themeRef = useTheme("Typography", "-h", style$_, typographyLight$1, props, mergedClsPrefixRef);
63154
63775
  const cssVarsRef = vue.computed(() => {
63155
63776
  const {
63156
63777
  type
@@ -63214,7 +63835,7 @@
63214
63835
  const UH5 = createHeader("5");
63215
63836
  const UH6 = createHeader("6");
63216
63837
 
63217
- var style$_ = cB("a", `
63838
+ var style$Z = cB("a", `
63218
63839
  cursor: pointer;
63219
63840
  transition:
63220
63841
  color .3s var(--u-bezier),
@@ -63237,7 +63858,7 @@
63237
63858
  const themeRef = useTheme(
63238
63859
  "Typography",
63239
63860
  "-a",
63240
- style$_,
63861
+ style$Z,
63241
63862
  typographyLight$1,
63242
63863
  props,
63243
63864
  mergedClsPrefixRef
@@ -63273,7 +63894,7 @@
63273
63894
  }
63274
63895
  });
63275
63896
 
63276
- var style$Z = cB("p", `
63897
+ var style$Y = cB("p", `
63277
63898
  box-sizing: border-box;
63278
63899
  transition: color .3s var(--u-bezier);
63279
63900
  margin: var(--u-margin);
@@ -63297,7 +63918,7 @@
63297
63918
  const themeRef = useTheme(
63298
63919
  "Typography",
63299
63920
  "-p",
63300
- style$Z,
63921
+ style$Y,
63301
63922
  typographyLight$1,
63302
63923
  props,
63303
63924
  mergedClsPrefixRef
@@ -63349,7 +63970,7 @@
63349
63970
  }
63350
63971
  });
63351
63972
 
63352
- var style$Y = cB("blockquote", `
63973
+ var style$X = cB("blockquote", `
63353
63974
  font-size: var(--u-font-size);
63354
63975
  line-height: var(--u-line-height);
63355
63976
  margin: 0;
@@ -63388,7 +64009,7 @@
63388
64009
  const themeRef = useTheme(
63389
64010
  "Typography",
63390
64011
  "-blockquote",
63391
- style$Y,
64012
+ style$X,
63392
64013
  typographyLight$1,
63393
64014
  props,
63394
64015
  mergedClsPrefixRef
@@ -63437,7 +64058,7 @@
63437
64058
  }
63438
64059
  });
63439
64060
 
63440
- var style$X = cB("hr", `
64061
+ var style$W = cB("hr", `
63441
64062
  margin: 12px 0;
63442
64063
  transition: border-color .3s var(--u-bezier);
63443
64064
  border-left: none;
@@ -63462,7 +64083,7 @@
63462
64083
  const themeRef = useTheme(
63463
64084
  "Typography",
63464
64085
  "-hr",
63465
- style$X,
64086
+ style$W,
63466
64087
  typographyLight$1,
63467
64088
  props,
63468
64089
  mergedClsPrefixRef
@@ -63509,7 +64130,7 @@
63509
64130
  `), c$1("&:last-child", `
63510
64131
  margin-bottom: 0;
63511
64132
  `)];
63512
- var style$W = c$1([cB("ol", {
64133
+ var style$V = c$1([cB("ol", {
63513
64134
  fontSize: "var(--u-font-size)",
63514
64135
  padding: "var(--u-ol-padding)"
63515
64136
  }, [cM("align-text", {
@@ -63539,7 +64160,7 @@
63539
64160
  const themeRef = useTheme(
63540
64161
  "Typography",
63541
64162
  "-xl",
63542
- style$W,
64163
+ style$V,
63543
64164
  typographyLight$1,
63544
64165
  props,
63545
64166
  mergedClsPrefixRef
@@ -63610,7 +64231,7 @@
63610
64231
  const themeRef = useTheme(
63611
64232
  "Typography",
63612
64233
  "-xl",
63613
- style$W,
64234
+ style$V,
63614
64235
  typographyLight$1,
63615
64236
  props,
63616
64237
  mergedClsPrefixRef
@@ -63752,193 +64373,273 @@
63752
64373
  }
63753
64374
  });
63754
64375
 
63755
- const SCROLL_DELAY = 50;
63756
- const SENDING_DELAY = 100;
63757
- const getChatGlobalState = () => ChatGlobalState.getInstance();
64376
+ var ChatAttachmentComponent = vue.defineComponent({
64377
+ name: "ChatAttachment",
64378
+ props: {
64379
+ message: {
64380
+ type: Object,
64381
+ required: true
64382
+ },
64383
+ attachments: {
64384
+ type: Array,
64385
+ required: true
64386
+ },
64387
+ uploadProps: {
64388
+ type: Object,
64389
+ default: () => ({})
64390
+ },
64391
+ withPadding: {
64392
+ type: Boolean,
64393
+ default: false
64394
+ }
64395
+ },
64396
+ setup(props, { slots }) {
64397
+ const getThumbnailUrl = (att) => {
64398
+ const url = [att.preview, att.thumbnail].find(
64399
+ (value) => typeof value === "string"
64400
+ );
64401
+ return url ?? null;
64402
+ };
64403
+ const renderAttachment = () => {
64404
+ const fileList = props.attachments.map(
64405
+ (att, index) => ({
64406
+ id: `${String(props.message.id)}-attachment-${index}`,
64407
+ name: att.name,
64408
+ status: att.status || "finished",
64409
+ percentage: att.percentage ?? null,
64410
+ url: att.url ?? null,
64411
+ thumbnailUrl: getThumbnailUrl(att),
64412
+ type: att.type ?? null,
64413
+ file: null,
64414
+ batchId: null
64415
+ })
64416
+ );
64417
+ const uploadComponent = /* @__PURE__ */ vue.h(
64418
+ UUpload,
64419
+ {
64420
+ abstract: true,
64421
+ fileList,
64422
+ fileListStyle: props.withPadding ? {
64423
+ display: "flex",
64424
+ flexDirection: "column",
64425
+ gap: "2px",
64426
+ marginTop: "0"
64427
+ } : void 0,
64428
+ showRemoveButton: false,
64429
+ showDownloadButton: props.attachments.some(
64430
+ (att) => att.status === "finished"
64431
+ ),
64432
+ showRetryButton: props.attachments.some(
64433
+ (att) => att.status === "error"
64434
+ ),
64435
+ ...props.uploadProps
64436
+ },
64437
+ {
64438
+ default: () => /* @__PURE__ */ vue.h(UUploadFileList, null, {
64439
+ "upload-file-title": slots["upload-file-title"] ? ({ file }) => slots["upload-file-title"]?.(file) : void 0,
64440
+ "upload-file-subtitle": slots["upload-file-subtitle"] ? ({ file }) => slots["upload-file-subtitle"]?.(file) : ({ file }) => {
64441
+ const att = props.attachments.find(
64442
+ (a) => a.name === file.name
64443
+ );
64444
+ return /* @__PURE__ */ vue.h("span", { style: { fontSize: "12px", color: "#999" } }, att?.size || file.file?.size);
64445
+ }
64446
+ })
64447
+ }
64448
+ );
64449
+ if (props.withPadding) {
64450
+ return /* @__PURE__ */ vue.h("div", { style: { padding: "2px" } }, uploadComponent);
64451
+ }
64452
+ return uploadComponent;
64453
+ };
64454
+ return () => {
64455
+ if (slots.default) {
64456
+ return slots.default(props.message);
64457
+ }
64458
+ return renderAttachment();
64459
+ };
64460
+ }
64461
+ });
64462
+
63758
64463
  const statusIconMapper = {
63759
64464
  [MessageStatus.READ]: CheckmarkDoneSharp,
63760
64465
  [MessageStatus.PENDING]: MdTime,
63761
64466
  [MessageStatus.RETRY]: Refresh,
63762
64467
  [MessageStatus.UNREAD]: CheckmarkDoneSharp
63763
64468
  };
63764
- var ChatMainArea = vue.defineComponent({
63765
- name: "ChatMainArea",
63766
- setup(_, { slots }) {
63767
- const {
63768
- mergedClsPrefixRef,
63769
- selectedChatRef,
63770
- messagesRef,
63771
- typingChatIdsRef,
63772
- messagesLoadingRef,
63773
- messagesLoadingCountRef,
63774
- headerButtonPropsRef,
63775
- headerIconPropsRef,
63776
- messageUploadPropsRef,
63777
- footerInputPropsRef,
63778
- footerButtonPropsRef,
63779
- footerUploadPropsRef,
63780
- footerIconPropsRef,
63781
- inputPlaceholderRef,
63782
- retryTextRef,
63783
- typingTextRef,
63784
- closeButtonTextRef,
63785
- handleMessageSend,
63786
- handleMessageRetry,
63787
- onChatClose,
63788
- onChatShare,
63789
- onUserProfile
63790
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
63791
- } = vue.inject(chatInjectionKey);
63792
- const messagesBodyRef = vue.ref();
63793
- const inputRef = vue.ref();
63794
- const inputValue = vue.ref("");
63795
- const attachmentFileList = vue.ref([]);
63796
- const unreadMessagesCount = vue.computed(() => {
63797
- if (!messagesRef.value) return 0;
63798
- return messagesRef.value.filter(
63799
- (msg) => !msg.isOwn && msg.status === MessageStatus.UNREAD
63800
- ).length;
63801
- });
63802
- const showNotificationManually = vue.ref(false);
63803
- const hasUnreadMessages = vue.ref(false);
63804
- const unreadCountOnOpen = vue.ref(0);
63805
- const chatInputs = vue.ref({});
63806
- vue.watch(
63807
- selectedChatRef,
63808
- (newChat, oldChat) => {
63809
- if (newChat && newChat.id !== oldChat?.id) {
63810
- inputValue.value = chatInputs.value[newChat.id] || "";
63811
- unreadCountOnOpen.value = unreadMessagesCount.value;
63812
- const globalState = getChatGlobalState();
63813
- globalState.markChatOpened(newChat.id);
63814
- if (unreadCountOnOpen.value > 0 && !globalState.hasNotificationShown(newChat.id)) {
63815
- hasUnreadMessages.value = true;
63816
- showNotificationManually.value = true;
63817
- globalState.markNotificationShown(newChat.id);
63818
- } else {
63819
- hasUnreadMessages.value = false;
63820
- showNotificationManually.value = false;
63821
- }
63822
- void vue.nextTick(() => {
63823
- scrollToBottom();
63824
- });
64469
+ const chatMessagesProps = {
64470
+ ...useTheme.props,
64471
+ messages: {
64472
+ type: Array,
64473
+ default: () => []
64474
+ },
64475
+ loading: {
64476
+ type: Boolean,
64477
+ default: false
64478
+ },
64479
+ loadingCount: {
64480
+ type: Number,
64481
+ default: 5
64482
+ },
64483
+ typingChatIds: {
64484
+ type: Array,
64485
+ default: () => []
64486
+ },
64487
+ selectedChatId: {
64488
+ type: [String, Number, Symbol],
64489
+ default: void 0
64490
+ },
64491
+ typingText: {
64492
+ type: String,
64493
+ default: void 0
64494
+ },
64495
+ retryText: {
64496
+ type: String,
64497
+ default: void 0
64498
+ },
64499
+ uploadProps: {
64500
+ type: Object,
64501
+ default: void 0
64502
+ },
64503
+ showUnreadNotification: {
64504
+ type: Boolean,
64505
+ default: false
64506
+ },
64507
+ unreadNotificationText: {
64508
+ type: String,
64509
+ default: void 0
64510
+ },
64511
+ unreadNotificationCount: {
64512
+ type: Number,
64513
+ default: void 0
64514
+ },
64515
+ onMessageRetry: {
64516
+ type: Function,
64517
+ default: void 0
64518
+ }
64519
+ };
64520
+ var UChatMessages = vue.defineComponent({
64521
+ name: "ChatMessages",
64522
+ props: chatMessagesProps,
64523
+ setup(props, { slots }) {
64524
+ const UChat = vue.inject(chatInjectionKey, null);
64525
+ const { mergedClsPrefixRef } = useConfig(props);
64526
+ const themeRef = UChat?.mergedThemeRef ?? useTheme("Chat", "-chat", style$12, chatLight, props, mergedClsPrefixRef);
64527
+ const { localeRef } = useLocale("Chat");
64528
+ const cssVarsRef = vue.computed(() => {
64529
+ const {
64530
+ common: {
64531
+ cubicBezierEaseInOut,
64532
+ brandPrimary500,
64533
+ staticGreen,
64534
+ staticRed,
64535
+ textPrimary,
64536
+ textSecondary,
64537
+ textTertiary
64538
+ },
64539
+ self: {
64540
+ backgroundColor,
64541
+ borderColor,
64542
+ mainBackgroundColor,
64543
+ headerBackgroundColor,
64544
+ headerBorderColor,
64545
+ headerTitleColor,
64546
+ messageBubbleBackgroundColorOwn,
64547
+ messageBubbleBackgroundColorOther,
64548
+ messageBubbleTextColorOwn,
64549
+ messageBubbleTextColorOther,
64550
+ messageTimeColor,
64551
+ messageStatusColor,
64552
+ attachmentBackgroundColorOwn,
64553
+ attachmentBackgroundColorOther,
64554
+ unreadNotificationBackgroundColor,
64555
+ unreadNotificationTextColor,
64556
+ typingIndicatorColor,
64557
+ dateSeparatorColor,
64558
+ dateSeparatorBackgroundColor,
64559
+ borderRadius,
64560
+ errorColor
63825
64561
  }
63826
- },
63827
- { immediate: true }
64562
+ } = themeRef.value;
64563
+ return {
64564
+ "--u-bezier": cubicBezierEaseInOut,
64565
+ "--u-color-primary": brandPrimary500,
64566
+ "--u-color-success": staticGreen,
64567
+ "--u-color-error": errorColor || staticRed,
64568
+ "--u-text-color-base": textPrimary,
64569
+ "--u-text-color-secondary": textSecondary,
64570
+ "--u-text-color-disabled": textTertiary,
64571
+ "--u-background-color": backgroundColor,
64572
+ "--u-border-color": borderColor,
64573
+ "--u-main-background-color": mainBackgroundColor,
64574
+ "--u-header-background-color": headerBackgroundColor,
64575
+ "--u-header-border-color": headerBorderColor,
64576
+ "--u-header-title-color": headerTitleColor,
64577
+ "--u-message-bubble-background-color-own": messageBubbleBackgroundColorOwn,
64578
+ "--u-message-bubble-background-color-other": messageBubbleBackgroundColorOther,
64579
+ "--u-message-bubble-text-color-own": messageBubbleTextColorOwn,
64580
+ "--u-message-bubble-text-color-other": messageBubbleTextColorOther,
64581
+ "--u-message-time-color": messageTimeColor,
64582
+ "--u-message-status-color": messageStatusColor,
64583
+ "--u-attachment-background-color-own": attachmentBackgroundColorOwn,
64584
+ "--u-attachment-background-color-other": attachmentBackgroundColorOther,
64585
+ "--u-unread-notification-background-color": unreadNotificationBackgroundColor,
64586
+ "--u-unread-notification-text-color": unreadNotificationTextColor,
64587
+ "--u-typing-indicator-color": typingIndicatorColor,
64588
+ "--u-date-separator-color": dateSeparatorColor,
64589
+ "--u-date-separator-background-color": dateSeparatorBackgroundColor,
64590
+ "--u-border-radius": borderRadius
64591
+ };
64592
+ });
64593
+ const themeClassHandle = useThemeClass(
64594
+ "chat-messages",
64595
+ vue.computed(() => ""),
64596
+ cssVarsRef,
64597
+ props
63828
64598
  );
63829
- vue.watch(
63830
- messagesRef,
63831
- (newMessages, oldMessages) => {
63832
- if (newMessages && oldMessages && newMessages.length > oldMessages.length) {
63833
- if (selectedChatRef.value) {
63834
- const globalState = getChatGlobalState();
63835
- if (globalState.hasNotificationShown(selectedChatRef.value.id)) {
63836
- showNotificationManually.value = false;
63837
- }
63838
- }
63839
- void vue.nextTick(() => {
63840
- scrollToBottom();
63841
- });
63842
- }
63843
- },
63844
- { deep: true }
64599
+ const mergedTypingTextRef = vue.computed(
64600
+ () => props.typingText ?? localeRef.value.typingText
63845
64601
  );
63846
- vue.watch(unreadMessagesCount, (newCount, oldCount) => {
63847
- if (selectedChatRef.value) {
63848
- if (newCount === 0 && oldCount > 0) {
63849
- showNotificationManually.value = false;
63850
- hasUnreadMessages.value = false;
63851
- }
63852
- }
63853
- });
63854
- const showUnreadNotification = vue.computed(() => {
63855
- return hasUnreadMessages.value && showNotificationManually.value;
63856
- });
63857
- vue.onMounted(() => {
63858
- void vue.nextTick(() => {
63859
- scrollToBottom();
63860
- });
64602
+ const mergedRetryTextRef = vue.computed(
64603
+ () => props.retryText ?? localeRef.value.retryText
64604
+ );
64605
+ const mergedUnreadNotificationTextRef = vue.computed(
64606
+ () => props.unreadNotificationText ?? localeRef.value.unreadNotificationText
64607
+ );
64608
+ const unreadMessagesCount = vue.computed(() => {
64609
+ if (!props.messages) return 0;
64610
+ return props.messages.filter(
64611
+ (msg) => !msg.isOwn && msg.status === MessageStatus.UNREAD
64612
+ ).length;
63861
64613
  });
63862
- const scrollToBottom = () => {
63863
- const el = messagesBodyRef.value;
63864
- if (!el) return;
63865
- if ("scrollTo" in el && typeof el.scrollTo === "function") {
63866
- el.scrollTo({ top: 999999, behavior: "smooth" });
63867
- return;
63868
- }
63869
- if ("$el" in el && el.$el instanceof HTMLElement) {
63870
- const scrollContainer = el.$el.querySelector(".u-scrollbar-content") || el.$el;
63871
- scrollContainer.scrollTop = scrollContainer.scrollHeight;
63872
- return;
63873
- }
63874
- if ("scrollTop" in el && "scrollHeight" in el) {
63875
- el.scrollTop = el.scrollHeight;
63876
- }
64614
+ const handleMessageRetry = (message) => {
64615
+ props.onMessageRetry?.(message);
64616
+ };
64617
+ const renderDateSeparator = (date) => {
64618
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ vue.h("span", null, date));
63877
64619
  };
63878
64620
  const renderUnreadNotification = () => {
63879
- if (!showUnreadNotification.value) return null;
64621
+ const count = props.unreadNotificationCount ?? unreadMessagesCount.value;
63880
64622
  return /* @__PURE__ */ vue.h(
63881
64623
  "div",
63882
64624
  {
63883
64625
  class: `${mergedClsPrefixRef.value}-chat-main__unread-notification`
63884
64626
  },
63885
- /* @__PURE__ */ vue.h("span", null, unreadCountOnOpen.value, " \u043D\u043E\u0432\u044B\u0445 \u0443\u0432\u0435\u0434\u043E\u043C\u043B\u0435\u043D\u0438\u044F")
64627
+ /* @__PURE__ */ vue.h("span", null, count, " ", mergedUnreadNotificationTextRef.value)
63886
64628
  );
63887
64629
  };
63888
- const renderHeader = () => {
63889
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` }, /* @__PURE__ */ vue.h(UFlex, { justify: "space-between", align: "flex-start" }, /* @__PURE__ */ vue.h(
63890
- UText,
63891
- {
63892
- variant: "heading-s-bold",
63893
- class: `${mergedClsPrefixRef.value}-chat-main__header-title`
63894
- },
63895
- selectedChatRef.value?.title || "Select a chat"
63896
- ), /* @__PURE__ */ vue.h(
63897
- UFlex,
64630
+ const renderMarkMessage = (message) => {
64631
+ const markTypeClass = message.markType === ChatMarkType.SYSTEM ? "system" : message.markType === ChatMarkType.EVENT ? "event" : "divider";
64632
+ return /* @__PURE__ */ vue.h(
64633
+ "div",
63898
64634
  {
63899
- align: "center",
63900
- size: "small",
63901
- class: `${mergedClsPrefixRef.value}-chat-main__header-actions`
64635
+ key: message.id,
64636
+ class: [
64637
+ `${mergedClsPrefixRef.value}-chat-main__mark`,
64638
+ `${mergedClsPrefixRef.value}-chat-main__mark--${markTypeClass}`
64639
+ ]
63902
64640
  },
63903
- resolveSlot(slots.headerActions, () => [
63904
- /* @__PURE__ */ vue.h(
63905
- Button,
63906
- {
63907
- secondary: true,
63908
- circle: true,
63909
- size: "large",
63910
- ...headerButtonPropsRef.value,
63911
- onClick: () => onChatShare?.value?.()
63912
- },
63913
- /* @__PURE__ */ vue.h(UIcon, { size: 20, ...headerIconPropsRef.value }, /* @__PURE__ */ vue.h(ArrowHookUpRight, null))
63914
- ),
63915
- /* @__PURE__ */ vue.h(
63916
- Button,
63917
- {
63918
- secondary: true,
63919
- circle: true,
63920
- size: "large",
63921
- ...headerButtonPropsRef.value,
63922
- onClick: () => onUserProfile?.value?.()
63923
- },
63924
- /* @__PURE__ */ vue.h(UIcon, { size: 20, ...headerIconPropsRef.value }, /* @__PURE__ */ vue.h(PersonNote, null))
63925
- ),
63926
- /* @__PURE__ */ vue.h(
63927
- Button,
63928
- {
63929
- type: "primary",
63930
- size: "large",
63931
- round: true,
63932
- ...headerButtonPropsRef.value,
63933
- onClick: () => onChatClose?.value?.()
63934
- },
63935
- closeButtonTextRef.value
63936
- )
63937
- ])
63938
- )));
63939
- };
63940
- const renderDateSeparator = (date) => {
63941
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__date-separator` }, /* @__PURE__ */ vue.h("span", null, date));
64641
+ message.content && /* @__PURE__ */ vue.h("span", null, message.content)
64642
+ );
63942
64643
  };
63943
64644
  const renderMessage = (message) => {
63944
64645
  const isOwn = message.isOwn;
@@ -63965,7 +64666,7 @@
63965
64666
  {
63966
64667
  message,
63967
64668
  attachments,
63968
- uploadProps: messageUploadPropsRef.value,
64669
+ uploadProps: props.uploadProps,
63969
64670
  withPadding: true
63970
64671
  },
63971
64672
  {
@@ -63986,7 +64687,7 @@
63986
64687
  {
63987
64688
  message,
63988
64689
  attachments,
63989
- uploadProps: messageUploadPropsRef.value
64690
+ uploadProps: props.uploadProps
63990
64691
  },
63991
64692
  {
63992
64693
  default: slots.messageAttachment,
@@ -64016,7 +64717,9 @@
64016
64717
  {
64017
64718
  size: 16,
64018
64719
  component: statusIconMapper[MessageStatus.RETRY],
64019
- class: `${mergedClsPrefixRef.value}-chat-main__message-retry-icon`
64720
+ class: `${mergedClsPrefixRef.value}-chat-main__message-retry-icon`,
64721
+ theme: themeRef.value.peers.Icon,
64722
+ themeOverrides: themeRef.value.peerOverrides.Icon
64020
64723
  }
64021
64724
  ),
64022
64725
  /* @__PURE__ */ vue.h(
@@ -64024,7 +64727,7 @@
64024
64727
  {
64025
64728
  class: `${mergedClsPrefixRef.value}-chat-main__message-retry-text`
64026
64729
  },
64027
- retryTextRef.value
64730
+ mergedRetryTextRef.value
64028
64731
  )
64029
64732
  ) : /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(
64030
64733
  "span",
@@ -64047,7 +64750,9 @@
64047
64750
  `${mergedClsPrefixRef.value}-chat-main__message-status-icon--${String(
64048
64751
  message.status
64049
64752
  )}`
64050
- ]
64753
+ ],
64754
+ theme: themeRef.value.peers.Icon,
64755
+ themeOverrides: themeRef.value.peerOverrides.Icon
64051
64756
  }
64052
64757
  )
64053
64758
  ))
@@ -64085,7 +64790,7 @@
64085
64790
  {
64086
64791
  class: `${mergedClsPrefixRef.value}-chat-main__message-time`
64087
64792
  },
64088
- typingTextRef.value
64793
+ mergedTypingTextRef.value
64089
64794
  )
64090
64795
  ))
64091
64796
  );
@@ -64132,46 +64837,124 @@
64132
64837
  ))
64133
64838
  );
64134
64839
  };
64135
- const renderMessages = () => {
64136
- if (messagesLoadingRef.value) {
64137
- return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__messages` }, Array.from({ length: messagesLoadingCountRef.value || 5 }).map(
64138
- (_2, index) => {
64139
- const isOwn = index % 2 === 0;
64140
- return renderSkeletonMessage(isOwn, index);
64141
- }
64142
- ));
64840
+ return {
64841
+ mergedClsPrefixRef,
64842
+ mergedTheme: themeRef,
64843
+ renderMessage,
64844
+ renderMarkMessage,
64845
+ renderTypingIndicator,
64846
+ renderSkeletonMessage,
64847
+ renderDateSeparator,
64848
+ renderUnreadNotification,
64849
+ cssVars: cssVarsRef,
64850
+ themeClass: themeClassHandle?.themeClass,
64851
+ onRender: themeClassHandle?.onRender
64852
+ };
64853
+ },
64854
+ render() {
64855
+ this.onRender?.();
64856
+ const {
64857
+ mergedClsPrefixRef,
64858
+ renderMessage,
64859
+ renderMarkMessage,
64860
+ renderTypingIndicator,
64861
+ renderSkeletonMessage,
64862
+ renderDateSeparator,
64863
+ renderUnreadNotification
64864
+ } = this;
64865
+ if (this.loading) {
64866
+ return /* @__PURE__ */ vue.h(
64867
+ "div",
64868
+ {
64869
+ class: [`${mergedClsPrefixRef}-chat`, this.themeClass],
64870
+ style: this.cssVars
64871
+ },
64872
+ /* @__PURE__ */ vue.h(
64873
+ "div",
64874
+ {
64875
+ class: `${mergedClsPrefixRef}-chat-main`,
64876
+ style: {
64877
+ border: "none",
64878
+ borderRadius: "0",
64879
+ padding: "0",
64880
+ background: "transparent"
64881
+ }
64882
+ },
64883
+ /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef}-chat-main__messages` }, Array.from({ length: this.loadingCount || 5 }).map(
64884
+ (_, index) => {
64885
+ const isOwn = index % 2 === 0;
64886
+ return renderSkeletonMessage(isOwn, index);
64887
+ }
64888
+ ))
64889
+ )
64890
+ );
64891
+ }
64892
+ const messagesWithDates = [];
64893
+ let currentDate = "";
64894
+ let unreadNotificationInserted = false;
64895
+ this.messages?.forEach((message, index) => {
64896
+ const messageDate = message.date || "";
64897
+ if (messageDate !== currentDate) {
64898
+ messagesWithDates.push({
64899
+ type: "date-separator",
64900
+ date: messageDate,
64901
+ id: `date-${String(index)}`
64902
+ });
64903
+ currentDate = messageDate;
64143
64904
  }
64144
- const messagesWithDates = [];
64145
- let currentDate = "";
64146
- let unreadNotificationInserted = false;
64147
- messagesRef.value?.forEach((message, index) => {
64148
- const messageDate = message.date || "";
64149
- if (messageDate !== currentDate) {
64150
- messagesWithDates.push({
64151
- type: "date-separator",
64152
- date: messageDate,
64153
- id: `date-${String(index)}`
64154
- });
64155
- currentDate = messageDate;
64156
- }
64157
- if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && showUnreadNotification.value) {
64158
- messagesWithDates.push({
64159
- type: "unread-notification",
64160
- id: "unread-notification"
64161
- });
64162
- unreadNotificationInserted = true;
64163
- }
64905
+ if (!unreadNotificationInserted && !message.isOwn && message.status === MessageStatus.UNREAD && this.showUnreadNotification) {
64164
64906
  messagesWithDates.push({
64165
- type: "message",
64166
- ...message
64907
+ type: "unread-notification",
64908
+ id: "unread-notification"
64167
64909
  });
64910
+ unreadNotificationInserted = true;
64911
+ }
64912
+ messagesWithDates.push({
64913
+ type: "message",
64914
+ ...message
64168
64915
  });
64169
- return /* @__PURE__ */ vue.h(
64916
+ });
64917
+ if (!unreadNotificationInserted && this.showUnreadNotification) {
64918
+ const unreadCount = this.unreadNotificationCount || 0;
64919
+ let incomingMessagesFound = 0;
64920
+ let insertIndex = messagesWithDates.length;
64921
+ for (let i = messagesWithDates.length - 1; i >= 0; i--) {
64922
+ const item = messagesWithDates[i];
64923
+ if (item.type === "message") {
64924
+ const message = item;
64925
+ if (!message.isOwn) {
64926
+ incomingMessagesFound++;
64927
+ if (incomingMessagesFound === unreadCount) {
64928
+ insertIndex = i;
64929
+ break;
64930
+ }
64931
+ }
64932
+ }
64933
+ }
64934
+ messagesWithDates.splice(insertIndex, 0, {
64935
+ type: "unread-notification",
64936
+ id: "unread-notification"
64937
+ });
64938
+ }
64939
+ const isTyping = this.selectedChatId && this.typingChatIds?.includes(this.selectedChatId);
64940
+ return /* @__PURE__ */ vue.h(
64941
+ "div",
64942
+ {
64943
+ class: [`${mergedClsPrefixRef}-chat`, this.themeClass],
64944
+ style: this.cssVars
64945
+ },
64946
+ /* @__PURE__ */ vue.h(
64170
64947
  "div",
64171
64948
  {
64172
- class: `${mergedClsPrefixRef.value}-chat-main__messages-container`
64949
+ class: `${mergedClsPrefixRef}-chat-main`,
64950
+ style: {
64951
+ border: "none",
64952
+ borderRadius: "0",
64953
+ padding: "0",
64954
+ background: "transparent"
64955
+ }
64173
64956
  },
64174
- messagesWithDates.map(
64957
+ /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef}-chat-main__messages-container` }, messagesWithDates.map(
64175
64958
  (item) => {
64176
64959
  if (item.type === "date-separator") {
64177
64960
  return renderDateSeparator(item.date ?? "");
@@ -64179,10 +64962,273 @@
64179
64962
  if (item.type === "unread-notification") {
64180
64963
  return renderUnreadNotification();
64181
64964
  }
64182
- return renderMessage(item);
64965
+ const message = item;
64966
+ if (message.type === ChatMessageType.MARK) {
64967
+ return renderMarkMessage(message);
64968
+ }
64969
+ return renderMessage(message);
64183
64970
  }
64184
- ),
64185
- selectedChatRef.value && typingChatIdsRef.value?.includes(selectedChatRef.value.id) && renderTypingIndicator()
64971
+ ), isTyping && renderTypingIndicator())
64972
+ )
64973
+ );
64974
+ }
64975
+ });
64976
+
64977
+ const SCROLL_DELAY = 50;
64978
+ const SENDING_DELAY = 100;
64979
+ var ChatMainArea = vue.defineComponent({
64980
+ name: "ChatMainArea",
64981
+ setup(_, { slots }) {
64982
+ const {
64983
+ mergedClsPrefixRef,
64984
+ mergedThemeRef,
64985
+ selectedChatRef,
64986
+ messagesRef,
64987
+ typingChatIdsRef,
64988
+ messagesLoadingRef,
64989
+ messagesLoadingCountRef,
64990
+ headerButtonPropsRef,
64991
+ headerIconPropsRef,
64992
+ messageUploadPropsRef,
64993
+ footerInputPropsRef,
64994
+ footerButtonPropsRef,
64995
+ footerUploadPropsRef,
64996
+ footerIconPropsRef,
64997
+ inputPlaceholderRef,
64998
+ retryTextRef,
64999
+ typingTextRef,
65000
+ closeButtonTextRef,
65001
+ unreadNotificationTextRef,
65002
+ notificationsShownSetRef,
65003
+ unreadCountsBeforeReadRef,
65004
+ markNotificationShown,
65005
+ handleMessageSend,
65006
+ handleMessageRetry,
65007
+ onChatClose,
65008
+ onChatShare,
65009
+ onUserProfile
65010
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
65011
+ } = vue.inject(chatInjectionKey);
65012
+ const messagesBodyRef = vue.ref();
65013
+ const inputRef = vue.ref();
65014
+ const inputValue = vue.ref("");
65015
+ const attachmentFileList = vue.ref([]);
65016
+ const unreadMessagesCount = vue.computed(() => {
65017
+ if (!messagesRef.value) return 0;
65018
+ return messagesRef.value.filter(
65019
+ (msg) => !msg.isOwn && msg.status === MessageStatus.UNREAD
65020
+ ).length;
65021
+ });
65022
+ const showNotificationManually = vue.ref(false);
65023
+ const hasUnreadMessages = vue.ref(false);
65024
+ const unreadCountOnOpen = vue.ref(0);
65025
+ const chatInputs = vue.ref({});
65026
+ const lastMessageId = vue.ref(null);
65027
+ vue.watch(
65028
+ selectedChatRef,
65029
+ (newChat, oldChat) => {
65030
+ if (newChat && newChat.id !== oldChat?.id) {
65031
+ inputValue.value = chatInputs.value[newChat.id] || "";
65032
+ const unreadBeforeRead = unreadCountsBeforeReadRef.value[newChat.id] || 0;
65033
+ unreadCountOnOpen.value = unreadBeforeRead;
65034
+ lastMessageId.value = null;
65035
+ if (unreadBeforeRead > 0 && !notificationsShownSetRef.value.has(newChat.id)) {
65036
+ hasUnreadMessages.value = true;
65037
+ showNotificationManually.value = true;
65038
+ markNotificationShown(newChat.id);
65039
+ } else {
65040
+ hasUnreadMessages.value = false;
65041
+ showNotificationManually.value = false;
65042
+ }
65043
+ void vue.nextTick(() => {
65044
+ scrollToBottom();
65045
+ });
65046
+ setTimeout(() => {
65047
+ scrollToBottom();
65048
+ }, SCROLL_DELAY);
65049
+ }
65050
+ },
65051
+ { immediate: true }
65052
+ );
65053
+ vue.watch(
65054
+ messagesRef,
65055
+ (newMessages) => {
65056
+ if (!newMessages || newMessages.length === 0) {
65057
+ lastMessageId.value = null;
65058
+ return;
65059
+ }
65060
+ const currentLastMessage = newMessages[newMessages.length - 1];
65061
+ const currentLastId = currentLastMessage?.id;
65062
+ if (currentLastId !== lastMessageId.value && lastMessageId.value !== null) {
65063
+ void vue.nextTick(() => {
65064
+ scrollToBottom();
65065
+ });
65066
+ setTimeout(() => {
65067
+ scrollToBottom();
65068
+ }, SCROLL_DELAY);
65069
+ if (currentLastMessage && !currentLastMessage.isOwn && currentLastMessage.status === MessageStatus.UNREAD) {
65070
+ unreadCountOnOpen.value = unreadMessagesCount.value;
65071
+ }
65072
+ }
65073
+ lastMessageId.value = currentLastId ?? null;
65074
+ },
65075
+ { deep: true, flush: "post" }
65076
+ );
65077
+ vue.watch(unreadMessagesCount, (newCount, oldCount) => {
65078
+ if (selectedChatRef.value && newCount === 0 && oldCount > 0) {
65079
+ showNotificationManually.value = false;
65080
+ hasUnreadMessages.value = false;
65081
+ const newSet = new Set(notificationsShownSetRef.value);
65082
+ newSet.delete(selectedChatRef.value.id);
65083
+ notificationsShownSetRef.value = newSet;
65084
+ }
65085
+ });
65086
+ const showUnreadNotification = vue.computed(() => {
65087
+ return hasUnreadMessages.value && showNotificationManually.value;
65088
+ });
65089
+ vue.onMounted(() => {
65090
+ void vue.nextTick(() => {
65091
+ scrollToBottom();
65092
+ });
65093
+ setTimeout(() => {
65094
+ scrollToBottom();
65095
+ }, SCROLL_DELAY);
65096
+ });
65097
+ const scrollToBottom = () => {
65098
+ const el = messagesBodyRef.value;
65099
+ if (!el) return;
65100
+ if ("$el" in el && el.$el instanceof HTMLElement) {
65101
+ const scrollContainer = el.$el.querySelector(".u-scrollbar-content");
65102
+ if (scrollContainer) {
65103
+ scrollContainer.scrollTop = scrollContainer.scrollHeight;
65104
+ return;
65105
+ }
65106
+ }
65107
+ if ("scrollTo" in el && typeof el.scrollTo === "function") {
65108
+ el.scrollTo({ top: 999999, behavior: "auto" });
65109
+ return;
65110
+ }
65111
+ if ("scrollTop" in el && "scrollHeight" in el) {
65112
+ el.scrollTop = el.scrollHeight;
65113
+ }
65114
+ };
65115
+ const renderHeader = () => {
65116
+ return /* @__PURE__ */ vue.h("div", { class: `${mergedClsPrefixRef.value}-chat-main__header` }, /* @__PURE__ */ vue.h(UFlex, { justify: "space-between", align: "flex-start" }, {
65117
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(
65118
+ UText,
65119
+ {
65120
+ variant: "heading-s-bold",
65121
+ class: `${mergedClsPrefixRef.value}-chat-main__header-title`,
65122
+ theme: mergedThemeRef.value.peers.Typography,
65123
+ themeOverrides: mergedThemeRef.value.peerOverrides.Typography
65124
+ },
65125
+ {
65126
+ default: () => selectedChatRef.value?.title || "Select a chat"
65127
+ }
65128
+ ), /* @__PURE__ */ vue.h(
65129
+ UFlex,
65130
+ {
65131
+ align: "center",
65132
+ size: "small",
65133
+ class: `${mergedClsPrefixRef.value}-chat-main__header-actions`
65134
+ },
65135
+ {
65136
+ default: () => resolveSlot(slots.headerActions, () => [
65137
+ /* @__PURE__ */ vue.h(
65138
+ Button,
65139
+ {
65140
+ secondary: true,
65141
+ circle: true,
65142
+ size: "large",
65143
+ ...headerButtonPropsRef.value,
65144
+ theme: mergedThemeRef.value.peers.Button,
65145
+ themeOverrides: mergedThemeRef.value.peerOverrides.Button,
65146
+ onClick: () => onChatShare?.value?.()
65147
+ },
65148
+ {
65149
+ default: () => /* @__PURE__ */ vue.h(
65150
+ UIcon,
65151
+ {
65152
+ size: 20,
65153
+ ...headerIconPropsRef.value,
65154
+ theme: mergedThemeRef.value.peers.Icon,
65155
+ themeOverrides: mergedThemeRef.value.peerOverrides.Icon
65156
+ },
65157
+ {
65158
+ default: () => /* @__PURE__ */ vue.h(ArrowHookUpRight, null)
65159
+ }
65160
+ )
65161
+ }
65162
+ ),
65163
+ /* @__PURE__ */ vue.h(
65164
+ Button,
65165
+ {
65166
+ secondary: true,
65167
+ circle: true,
65168
+ size: "large",
65169
+ ...headerButtonPropsRef.value,
65170
+ theme: mergedThemeRef.value.peers.Button,
65171
+ themeOverrides: mergedThemeRef.value.peerOverrides.Button,
65172
+ onClick: () => onUserProfile?.value?.()
65173
+ },
65174
+ {
65175
+ default: () => /* @__PURE__ */ vue.h(
65176
+ UIcon,
65177
+ {
65178
+ size: 20,
65179
+ ...headerIconPropsRef.value,
65180
+ theme: mergedThemeRef.value.peers.Icon,
65181
+ themeOverrides: mergedThemeRef.value.peerOverrides.Icon
65182
+ },
65183
+ {
65184
+ default: () => /* @__PURE__ */ vue.h(PersonNote, null)
65185
+ }
65186
+ )
65187
+ }
65188
+ ),
65189
+ /* @__PURE__ */ vue.h(
65190
+ Button,
65191
+ {
65192
+ type: "primary",
65193
+ size: "large",
65194
+ round: true,
65195
+ ...headerButtonPropsRef.value,
65196
+ theme: mergedThemeRef.value.peers.Button,
65197
+ themeOverrides: mergedThemeRef.value.peerOverrides.Button,
65198
+ onClick: () => onChatClose?.value?.()
65199
+ },
65200
+ {
65201
+ default: () => closeButtonTextRef.value
65202
+ }
65203
+ )
65204
+ ])
65205
+ }
65206
+ ))
65207
+ }));
65208
+ };
65209
+ const renderMessages = () => {
65210
+ return /* @__PURE__ */ vue.h(
65211
+ UChatMessages,
65212
+ {
65213
+ messages: messagesRef.value,
65214
+ loading: messagesLoadingRef.value,
65215
+ loadingCount: messagesLoadingCountRef.value,
65216
+ typingChatIds: typingChatIdsRef.value,
65217
+ selectedChatId: selectedChatRef.value?.id,
65218
+ typingText: typingTextRef.value,
65219
+ retryText: retryTextRef.value,
65220
+ uploadProps: messageUploadPropsRef.value,
65221
+ showUnreadNotification: showUnreadNotification.value,
65222
+ unreadNotificationText: unreadNotificationTextRef.value,
65223
+ unreadNotificationCount: unreadCountOnOpen.value,
65224
+ onMessageRetry: handleMessageRetry
65225
+ },
65226
+ {
65227
+ messageAttachment: slots.messageAttachment,
65228
+ messageAttachmentTitle: slots.messageAttachmentTitle,
65229
+ messageAttachmentSubtitle: slots.messageAttachmentSubtitle,
65230
+ messageStatus: slots.messageStatus
65231
+ }
64186
65232
  );
64187
65233
  };
64188
65234
  const isSending = vue.ref(false);
@@ -64209,12 +65255,8 @@
64209
65255
  inputValue.value = "";
64210
65256
  attachmentFileList.value = [];
64211
65257
  chatInputs.value[selectedChatRef.value.id] = "";
64212
- const globalState = getChatGlobalState();
64213
- if (globalState.hasNotificationShown(selectedChatRef.value.id)) {
64214
- globalState.markNotificationShown(selectedChatRef.value.id);
64215
- showNotificationManually.value = false;
64216
- hasUnreadMessages.value = false;
64217
- }
65258
+ hasUnreadMessages.value = false;
65259
+ showNotificationManually.value = false;
64218
65260
  void vue.nextTick(() => {
64219
65261
  scrollToBottom();
64220
65262
  });
@@ -64285,58 +65327,78 @@
64285
65327
  onUpdateFileList: handleFileListUpdate,
64286
65328
  ...footerUploadPropsRef.value
64287
65329
  },
64288
- /* @__PURE__ */ vue.h(
64289
- UFlex,
64290
- {
64291
- align: "center",
64292
- size: "small",
64293
- class: `${mergedClsPrefixRef.value}-chat-main__input-container`
64294
- },
64295
- /* @__PURE__ */ vue.h(UUploadTrigger, { abstract: true }, {
64296
- default: ({ handleClick }) => /* @__PURE__ */ vue.h(
64297
- Button,
64298
- {
64299
- secondary: true,
64300
- size: "large",
64301
- class: `${mergedClsPrefixRef.value}-chat-main__attach-btn`,
64302
- ...footerButtonPropsRef.value,
64303
- onClick: handleClick
64304
- },
64305
- /* @__PURE__ */ vue.h(UIcon, { size: 24, ...footerIconPropsRef.value }, /* @__PURE__ */ vue.h(AttachIcon, null))
64306
- )
64307
- }),
64308
- /* @__PURE__ */ vue.h(
64309
- UInput,
65330
+ {
65331
+ default: () => /* @__PURE__ */ vue.h(
65332
+ UFlex,
64310
65333
  {
64311
- ref: "inputRef",
64312
- value: inputValue.value,
64313
- placeholder: inputPlaceholderRef.value,
64314
- class: `${mergedClsPrefixRef.value}-chat-main__input`,
64315
- ...footerInputPropsRef.value,
64316
- onUpdateValue: (value) => {
64317
- inputValue.value = value;
64318
- if (selectedChatRef.value) {
64319
- chatInputs.value[selectedChatRef.value.id] = value;
64320
- }
64321
- },
64322
- onKeydown: (e) => {
64323
- if (e.key === "Enter" && !e.shiftKey) {
64324
- e.preventDefault();
64325
- e.stopPropagation();
64326
- void handleSendMessage();
65334
+ align: "center",
65335
+ size: "small",
65336
+ class: `${mergedClsPrefixRef.value}-chat-main__input-container`
65337
+ },
65338
+ {
65339
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, /* @__PURE__ */ vue.h(UUploadTrigger, { abstract: true }, {
65340
+ default: ({
65341
+ handleClick
65342
+ }) => /* @__PURE__ */ vue.h(
65343
+ Button,
65344
+ {
65345
+ secondary: true,
65346
+ size: "large",
65347
+ class: `${mergedClsPrefixRef.value}-chat-main__attach-btn`,
65348
+ ...footerButtonPropsRef.value,
65349
+ theme: mergedThemeRef.value.peers.Button,
65350
+ themeOverrides: mergedThemeRef.value.peerOverrides.Button,
65351
+ onClick: handleClick
65352
+ },
65353
+ {
65354
+ default: () => /* @__PURE__ */ vue.h(
65355
+ UIcon,
65356
+ {
65357
+ size: 24,
65358
+ ...footerIconPropsRef.value,
65359
+ theme: mergedThemeRef.value.peers.Icon,
65360
+ themeOverrides: mergedThemeRef.value.peerOverrides.Icon
65361
+ },
65362
+ {
65363
+ default: () => /* @__PURE__ */ vue.h(AttachIcon, null)
65364
+ }
65365
+ )
65366
+ }
65367
+ )
65368
+ }), /* @__PURE__ */ vue.h(
65369
+ UInput,
65370
+ {
65371
+ ref: "inputRef",
65372
+ value: inputValue.value,
65373
+ placeholder: inputPlaceholderRef.value,
65374
+ class: `${mergedClsPrefixRef.value}-chat-main__input`,
65375
+ ...footerInputPropsRef.value,
65376
+ theme: mergedThemeRef.value.peers.Input,
65377
+ themeOverrides: mergedThemeRef.value.peerOverrides.Input,
65378
+ onUpdateValue: (value) => {
65379
+ inputValue.value = value;
65380
+ if (selectedChatRef.value) {
65381
+ chatInputs.value[selectedChatRef.value.id] = value;
65382
+ }
65383
+ },
65384
+ onKeydown: (e) => {
65385
+ if (e.key === "Enter" && !e.shiftKey) {
65386
+ e.preventDefault();
65387
+ e.stopPropagation();
65388
+ void handleSendMessage();
65389
+ }
65390
+ }
64327
65391
  }
64328
- }
65392
+ ))
64329
65393
  }
64330
65394
  )
64331
- )
65395
+ }
64332
65396
  ));
64333
65397
  };
64334
65398
  return {
64335
65399
  renderHeader,
64336
65400
  renderMessages,
64337
65401
  renderFooter,
64338
- renderUnreadNotification,
64339
- showUnreadNotification,
64340
65402
  messagesBodyRef,
64341
65403
  inputRef,
64342
65404
  inputValue,
@@ -64352,451 +65414,10 @@
64352
65414
  ref: "messagesBodyRef",
64353
65415
  class: `${mergedClsPrefixRef.value}-chat-main__body`
64354
65416
  },
64355
- this.renderMessages()
64356
- ), this.renderFooter());
64357
- }
64358
- });
64359
-
64360
- var style$V = cB("chat", `
64361
- height: 100%;
64362
- max-height: 100%;
64363
- min-height: 0;
64364
- display: flex;
64365
- overflow: hidden;
64366
- box-sizing: border-box;
64367
- .u-list-item__text {
64368
- grid-template-columns: 1fr !important;
64369
- }
64370
- .u-flex {
64371
- height: 100%;
64372
- max-height: 100%;
64373
- min-height: 0;
64374
- overflow: hidden;
64375
- }
64376
- `, [cB("chat-sidebar", `
64377
- max-width: 388px;
64378
- width: 100%;
64379
- height: 100%;
64380
- display: flex;
64381
- flex-direction: column;
64382
- background-color: var(--u-sidebar-background-color);
64383
- border: 1px solid var(--u-sidebar-border-color);
64384
- border-radius: 20px;
64385
- overflow: hidden;
64386
- `, [cE("header", `
64387
- padding: 16px 16px 0 16px;
64388
- flex-shrink: 0;
64389
- `), cE("header-main", `
64390
- flex: 0 0 48%;
64391
- min-width: 0;
64392
- `), cE("header-actions", `
64393
- flex: 0 0 48%;
64394
- min-width: 0;
64395
- display: flex;
64396
- justify-content: flex-end;
64397
- align-items: center;
64398
- gap: 8px;
64399
- `), cE("content", `
64400
- flex: 1;
64401
- overflow-y: auto;
64402
- min-height: 0;
64403
- padding: 16px;
64404
- padding-top: 12px;
64405
- `), cE("item", `
64406
- padding: 12px 16px;
64407
- width: 100%;
64408
- cursor: pointer;
64409
- border-radius: 8px;
64410
- margin-bottom: 4px;
64411
- transition: all 0.2s ease;
64412
- position: relative;
64413
- `, [c$1(".u-list-item", `
64414
- min-width: 0;
64415
- `), c$1(".u-list-item__main", `
64416
- min-width: 0;
64417
- flex: 1;
64418
- `), c$1(".u-list-item__prefix", `
64419
- flex-shrink: 0;
64420
- `), c$1(".u-list-item__suffix", `
64421
- flex-shrink: 0;
64422
- margin-left: 12px;
64423
- `), c$1(".u-list-item__text", `
64424
- grid-template-columns: 1fr !important;
64425
- min-width: 0 !important;
64426
- max-width: 100%;
64427
- `), c$1(".u-list-item__content", `
64428
- min-width: 0;
64429
- `), c$1(".u-list-item__title", `
64430
- min-width: 0;
64431
- `), c$1(".u-list-item__subtitle", `
64432
- min-width: 0 !important;
64433
- `), cM("selected", `
64434
- background-color: var(--u-sidebar-item-background-color-selected);
64435
- `, [c$1("&:hover", `
64436
- background-color: var(--u-sidebar-item-background-color-selected);
64437
- `)]), cM("typing", `
64438
- .u-list-item__description {
64439
- color: var(--u-color-primary) !important;
64440
- font-style: italic;
65417
+ {
65418
+ default: () => this.renderMessages()
64441
65419
  }
64442
- `), c$1("&:hover", `
64443
- background-color: var(--u-sidebar-item-background-color-hover);
64444
- `, [cM("selected", `
64445
- background-color: var(--u-sidebar-item-background-color-selected);
64446
- `)])]), cE("item-title", `
64447
- font-weight: 500;
64448
- font-size: 14px;
64449
- line-height: 20px;
64450
- color: var(--u-sidebar-item-text-color);
64451
- overflow: hidden;
64452
- text-overflow: ellipsis;
64453
- white-space: nowrap;
64454
- `), cE("item-subtitle", `
64455
- font-size: 12px;
64456
- line-height: 16px;
64457
- color: var(--u-sidebar-item-subtitle-color);
64458
- overflow: hidden;
64459
- text-overflow: ellipsis;
64460
- white-space: nowrap;
64461
- `, [cM("typing", `
64462
- color: var(--u-color-primary);
64463
- font-style: italic;
64464
- `)]), cE("item-main", `
64465
- flex: 1;
64466
- min-width: 0;
64467
- margin-right: 12px;
64468
- `), cE("item-title", `
64469
- font-weight: 500;
64470
- font-size: 14px;
64471
- line-height: 20px;
64472
- color: var(--u-text-color-base);
64473
- margin-bottom: 2px;
64474
- overflow: hidden;
64475
- text-overflow: ellipsis;
64476
- white-space: nowrap;
64477
- `), cE("item-subtitle", `
64478
- font-size: 12px;
64479
- line-height: 16px;
64480
- color: var(--u-text-color-disabled);
64481
- overflow: hidden;
64482
- text-overflow: ellipsis;
64483
- white-space: nowrap;
64484
- `), cE("item-indicators", `
64485
- display: flex;
64486
- flex-direction: column;
64487
- align-items: flex-end;
64488
- gap: 4px;
64489
- flex-shrink: 0;
64490
- `), cE("item-time", `
64491
- font-size: 11px;
64492
- line-height: 21px;
64493
- color: var(--u-sidebar-item-time-color);
64494
- white-space: nowrap;
64495
- `), cE("item-status sup", `
64496
- padding: 2px 6px 2px 5px;
64497
- height: 22px;
64498
- --u-color: var(--u-unread-notification-background-color);
64499
- `), cE("item-status-icon", `
64500
- color: var(--u-sidebar-item-time-color);
64501
- `, [cM("read", `
64502
- color: var(--u-unread-notification-background-color);
64503
- `)]), c$1("&:has(.u-chat-sidebar__item-badge)", `
64504
- `, [cE("item-title", `
64505
- font-weight: 600;
64506
- `), cE("item-subtitle", `
64507
- color: var(--u-text-color-base);
64508
- font-weight: 500;
64509
- `)])]), cB("chat-main", `
64510
- background-color: var(--u-main-background-color);
64511
- border: 1px solid var(--u-border-color);
64512
- border-radius: 20px;
64513
- width: 100%;
64514
- flex: 1;
64515
- display: flex;
64516
- flex-direction: column;
64517
- height: 100%;
64518
- max-height: 100%;
64519
- min-height: 0;
64520
- overflow: hidden;
64521
- `, [cE("header", `
64522
- border-bottom: 1px solid var(--u-border-color);
64523
- width: 100%;
64524
- padding: 24px 20px 8px 24px;
64525
- flex-shrink: 0;
64526
- `), cE("header-title", `
64527
- margin-top: 9px;
64528
- color: var(--u-header-title-color);
64529
- `), cE("header-actions", `
64530
- padding: 4px;
64531
- `), cE("unread-notification", `
64532
- background-color: var(--u-unread-notification-background-color);
64533
- color: var(--u-unread-notification-text-color);
64534
- padding: 6px 12px;
64535
- text-align: center;
64536
- font-size: 12px;
64537
- font-weight: 500;
64538
- margin: 8px 0;
64539
- display: flex;
64540
- justify-content: center;
64541
- width: 100%;
64542
- `, [c$1("span", `
64543
- display: inline-block;
64544
- white-space: nowrap;
64545
- `)]), cE("body", `
64546
- flex: 1;
64547
- min-height: 0;
64548
- position: relative;
64549
- `, [c$1(".u-scrollbar-content", `
64550
- padding: 16px 24px;
64551
- min-height: 100%;
64552
- display: flex;
64553
- flex-direction: column;
64554
- justify-content: flex-end;
64555
- `)]), cE("messages-container", `
64556
- display: flex;
64557
- flex-direction: column;
64558
- gap: 16px;
64559
- min-height: 100%;
64560
- width: 100%;
64561
- justify-content: flex-end;
64562
- `), cE("date-separator", `
64563
- display: flex;
64564
- justify-content: center;
64565
- margin: 16px 0;
64566
- `, [c$1("span", `
64567
- color: var(--u-date-separator-color);
64568
- padding: 4px 12px;
64569
- border-radius: 12px;
64570
- font-size: 12px;
64571
- font-weight: 500;
64572
- `)]), cE("message", `
64573
- display: flex;
64574
- margin-bottom: 8px;
64575
- flex-shrink: 0;
64576
- width: 100%;
64577
- `, [cM("own", `
64578
- justify-content: flex-end;
64579
- `), cM("other", `
64580
- justify-content: flex-start;
64581
- `)]), cE("message-wrapper", `
64582
- max-width: 70%;
64583
- display: flex;
64584
- flex-direction: column;
64585
- gap: 4px;
64586
- flex-shrink: 0;
64587
- `), cE("message-bubble", `
64588
- border-radius: 18px;
64589
- font-size: 14px;
64590
- line-height: 20px;
64591
- word-wrap: break-word;
64592
- background-color: var(--u-message-bubble-background-color-other);
64593
- color: var(--u-message-bubble-text-color-other);
64594
- border-bottom-left-radius: 6px;
64595
- width: fit-content;
64596
- display: flex;
64597
- flex-direction: column;
64598
- `, [cM("own", `
64599
- background-color: var(--u-message-bubble-background-color-own);
64600
- color: var(--u-message-bubble-text-color-own);
64601
- border-bottom-left-radius: 18px;
64602
- border-bottom-right-radius: 6px;
64603
- `), cM("typing", `
64604
- min-width: 300px;
64605
- height: 44px;
64606
- padding: 12px 16px;
64607
- `), cM("skeleton", `
64608
- min-width: 376px;
64609
- height: 44px;
64610
- `)]), cE("message-text", `
64611
- padding: 12px 16px;
64612
- `), cE("message-attachment", `
64613
- display: flex;
64614
- align-items: center;
64615
- gap: 12px;
64616
- padding: 12px 16px;
64617
- background-color: #f8f9fa;
64618
- border-radius: 12px;
64619
- border: 1px solid #e9ecef;
64620
- margin-top: 4px;
64621
- `), cE("attachment-icon", `
64622
- color: #6c757d;
64623
- flex-shrink: 0;
64624
- `), cE("attachment-info", `
64625
- flex: 1;
64626
- min-width: 0;
64627
- `), cE("attachment-name", `
64628
- font-size: 14px;
64629
- font-weight: 500;
64630
- color: var(--u-text-color-base);
64631
- margin-bottom: 2px;
64632
- `), cE("attachment-size", `
64633
- font-size: 12px;
64634
- color: var(--u-text-color-disabled);
64635
- `), cE("message-meta", `
64636
- display: flex;
64637
- align-items: center;
64638
- gap: 4px;
64639
- font-size: 11px;
64640
- color: var(--u-text-color-disabled);
64641
- margin-top: 2px;
64642
- `, [cM("own", `
64643
- justify-content: flex-end;
64644
- `), cM("other", `
64645
- justify-content: flex-start;
64646
- `), cM("skeleton", `
64647
- width: 36px;
64648
- height: 20px;
64649
- border-radius: 4px;
64650
- `)]), cE("message-time", `
64651
- font-size: 11px;
64652
- color: var(--u-message-time-color);
64653
- `), cE("message-status", `
64654
- color: var(--u-color-success);
64655
- display: flex;
64656
- align-items: center;
64657
- `), cE("message-status-icon", `
64658
- color: var(--u-message-time-color);
64659
- `, [cM("read", `
64660
- color: var(--u-unread-notification-background-color);
64661
- `), cM("retry", `
64662
- color: var(--u-color-error);
64663
- `)]), cE("message-retry", `
64664
- display: flex;
64665
- align-items: center;
64666
- gap: 4px;
64667
- `), cE("message-retry-icon", `
64668
- color: var(--u-color-error);
64669
- `), cE("message-retry-text", `
64670
- color: var(--u-color-error);
64671
- font-size: 11px;
64672
- font-weight: 500;
64673
- `), cE("typing-indicator", `
64674
- display: flex;
64675
- justify-content: flex-start;
64676
- margin-bottom: 8px;
64677
- `), cE("footer", `
64678
- border-top: 1px solid var(--u-border-color);
64679
- padding: 0px 20px;
64680
- flex-shrink: 0;
64681
- `), cE("input-container", `
64682
- width: 100%;
64683
- padding: 16px 0px;
64684
- `), cE("input", `
64685
- flex: 1;
64686
- margin-right: 4px;
64687
- --u-color: #F3F4F6 !important;
64688
- --u-color-focus: #F3F4F6 !important;
64689
- --u-border: none !important;
64690
- --u-border-focus: none !important;
64691
- --u-border-hover: none !important;
64692
- --u-box-shadow: none !important;
64693
- --u-box-shadow-focus: none !important;
64694
- `), cE("attach-btn", `
64695
- margin-left: 4px;
64696
- flex-shrink: 0;
64697
- padding: 0 12px;
64698
- `)]), c$1("*", `
64699
- box-sizing: border-box;
64700
- `), c$1(".u-list-item .u-list-item__text", `
64701
- grid-template-columns: 1fr !important;
64702
- `), c$1(".u-upload-file-list .u-upload-file.u-upload-file--text-type", `
64703
- margin-bottom: 0px;
64704
- `), c$1(".u-chat-main__message-bubble--own .u-upload-file", `
64705
- background-color: var(--u-attachment-background-color-own);
64706
- `), c$1(".u-chat-main__message-bubble--other .u-upload-file", `
64707
- background-color: var(--u-attachment-background-color-other);
64708
- `)]);
64709
-
64710
- const self$5 = vars => {
64711
- const {
64712
- borderRadiusLarge,
64713
- elementsQuaternary,
64714
- elementsTertiary,
64715
- textTertiary,
64716
- textPrimary,
64717
- textSecondary,
64718
- surfacePrimary,
64719
- brandPrimary500,
64720
- brandPrimary400,
64721
- transparencySecondary,
64722
- elementsSecondary,
64723
- elementsDarkQuinary,
64724
- staticRed,
64725
- staticWhite
64726
- } = vars;
64727
- return {
64728
- backgroundColor: surfacePrimary,
64729
- borderColor: elementsQuaternary,
64730
- sidebarBackgroundColor: surfacePrimary,
64731
- sidebarBorderColor: elementsQuaternary,
64732
- sidebarItemBackgroundColor: "transparent",
64733
- sidebarItemBackgroundColorHover: elementsTertiary,
64734
- sidebarItemBackgroundColorSelected: transparencySecondary,
64735
- sidebarItemTextColor: textPrimary,
64736
- sidebarItemTextColorSelected: brandPrimary500,
64737
- sidebarItemSubtitleColor: textSecondary,
64738
- sidebarItemTimeColor: elementsDarkQuinary,
64739
- mainBackgroundColor: surfacePrimary,
64740
- headerBackgroundColor: surfacePrimary,
64741
- headerBorderColor: elementsQuaternary,
64742
- headerTitleColor: textPrimary,
64743
- messageBubbleBackgroundColorOwn: elementsTertiary,
64744
- messageBubbleBackgroundColorOther: elementsTertiary,
64745
- messageBubbleTextColorOwn: textPrimary,
64746
- messageBubbleTextColorOther: textPrimary,
64747
- messageTimeColor: textTertiary,
64748
- messageStatusColor: textSecondary,
64749
- attachmentBackgroundColorOwn: staticWhite,
64750
- attachmentBackgroundColorOther: staticWhite,
64751
- footerBackgroundColor: surfacePrimary,
64752
- footerBorderColor: elementsQuaternary,
64753
- inputBackgroundColor: surfacePrimary,
64754
- inputBorderColor: elementsQuaternary,
64755
- unreadNotificationBackgroundColor: brandPrimary400,
64756
- unreadNotificationTextColor: elementsSecondary,
64757
- typingIndicatorColor: textSecondary,
64758
- dateSeparatorColor: textTertiary,
64759
- dateSeparatorBackgroundColor: elementsTertiary,
64760
- borderRadius: borderRadiusLarge,
64761
- errorColor: staticRed
64762
- };
64763
- };
64764
- const chatLight = createTheme$1({
64765
- name: "Chat",
64766
- common: derived,
64767
- peers: {
64768
- Input: inputLight,
64769
- Empty: emptyLight,
64770
- Select: selectLight,
64771
- Avatar: avatarLight,
64772
- Badge: badgeLight,
64773
- Button: buttonLight,
64774
- Icon: iconLight,
64775
- List: listLight,
64776
- Typography: typographyLight$1
64777
- },
64778
- self: self$5
64779
- });
64780
-
64781
- const chatDark = createTheme$1({
64782
- name: "Chat",
64783
- common: derived$1,
64784
- peers: {
64785
- Input: inputDark,
64786
- Empty: emptyDark$1,
64787
- Select: selectDark,
64788
- Avatar: avatarDark,
64789
- Badge: badgeDark,
64790
- Button: buttonDark,
64791
- Icon: iconDark$1,
64792
- List: listDark$1,
64793
- Typography: typographyDark
64794
- },
64795
- self: vars => {
64796
- const lightVars = self$5(vars);
64797
- return {
64798
- ...lightVars
64799
- };
65420
+ ), this.renderFooter());
64800
65421
  }
64801
65422
  });
64802
65423
 
@@ -64914,6 +65535,10 @@
64914
65535
  type: String,
64915
65536
  default: void 0
64916
65537
  },
65538
+ unreadNotificationText: {
65539
+ type: String,
65540
+ default: void 0
65541
+ },
64917
65542
  chatItemsLoading: {
64918
65543
  type: Boolean,
64919
65544
  default: false
@@ -64999,12 +65624,17 @@
64999
65624
  const themeRef = useTheme(
65000
65625
  "Chat",
65001
65626
  "-chat",
65002
- style$V,
65627
+ style$12,
65003
65628
  chatLight,
65004
65629
  props,
65005
65630
  mergedClsPrefixRef
65006
65631
  );
65007
65632
  const { localeRef } = useLocale("Chat");
65633
+ const notificationsShownSet = vue.ref(/* @__PURE__ */ new Set());
65634
+ const markNotificationShown = (chatId) => {
65635
+ notificationsShownSet.value.add(chatId);
65636
+ notificationsShownSet.value = new Set(notificationsShownSet.value);
65637
+ };
65008
65638
  const cssVarsRef = vue.computed(() => {
65009
65639
  const {
65010
65640
  common: { cubicBezierEaseInOut },
@@ -65112,10 +65742,37 @@
65112
65742
  }
65113
65743
  return [];
65114
65744
  });
65745
+ const lastUnreadCounts = vue.ref({});
65746
+ vue.watch(
65747
+ () => props.chatItems,
65748
+ (chatItems) => {
65749
+ if (!chatItems) return;
65750
+ chatItems.forEach((chatItem) => {
65751
+ const chatId = chatItem.id;
65752
+ const currentUnreadCount = chatItem.unreadCount || 0;
65753
+ const lastUnreadCount = lastUnreadCounts.value[chatId] || 0;
65754
+ if (currentUnreadCount > lastUnreadCount) {
65755
+ const newSet = new Set(notificationsShownSet.value);
65756
+ newSet.delete(chatId);
65757
+ notificationsShownSet.value = newSet;
65758
+ }
65759
+ lastUnreadCounts.value[chatId] = currentUnreadCount;
65760
+ });
65761
+ },
65762
+ { deep: true, immediate: true }
65763
+ );
65764
+ const unreadCountsBeforeRead = vue.ref({});
65115
65765
  const handleChatSelect = (chatId) => {
65766
+ const previousChatId = uncontrolledSelectedChatIdRef.value;
65767
+ if (previousChatId !== void 0 && previousChatId !== chatId) {
65768
+ emit("mark-messages-read", previousChatId);
65769
+ }
65770
+ const selectedItem = props.chatItems?.find((item) => item.id === chatId);
65771
+ const unreadCountBeforeRead = selectedItem?.unreadCount || 0;
65772
+ unreadCountsBeforeRead.value[chatId] = unreadCountBeforeRead;
65116
65773
  uncontrolledSelectedChatIdRef.value = chatId;
65117
65774
  emit("update:selectedChatId", chatId);
65118
- const selectedItem = props.chatItems?.find((item) => item.id === chatId);
65775
+ emit("mark-messages-read", chatId);
65119
65776
  if (selectedItem) {
65120
65777
  props.onChatSelect?.(chatId, selectedItem);
65121
65778
  }
@@ -65166,8 +65823,12 @@
65166
65823
  const mergedCloseButtonTextRef = vue.computed(
65167
65824
  () => props.closeButtonText ?? localeRef.value.closeButtonText
65168
65825
  );
65826
+ const mergedUnreadNotificationTextRef = vue.computed(
65827
+ () => props.unreadNotificationText ?? localeRef.value.unreadNotificationText
65828
+ );
65169
65829
  vue.provide(chatInjectionKey, {
65170
65830
  mergedClsPrefixRef,
65831
+ mergedThemeRef: themeRef,
65171
65832
  chatItemsRef: vue.toRef(props, "chatItems"),
65172
65833
  selectedChatIdRef: mergedSelectedChatIdRef,
65173
65834
  selectedChatRef,
@@ -65197,6 +65858,10 @@
65197
65858
  retryTextRef: mergedRetryTextRef,
65198
65859
  typingTextRef: mergedTypingTextRef,
65199
65860
  closeButtonTextRef: mergedCloseButtonTextRef,
65861
+ unreadNotificationTextRef: mergedUnreadNotificationTextRef,
65862
+ notificationsShownSetRef: notificationsShownSet,
65863
+ unreadCountsBeforeReadRef: unreadCountsBeforeRead,
65864
+ markNotificationShown,
65200
65865
  handleChatSelect,
65201
65866
  handleMessageSend,
65202
65867
  handleMessageRetry,
@@ -65233,16 +65898,18 @@
65233
65898
  ...this.cssVars
65234
65899
  }
65235
65900
  },
65236
- /* @__PURE__ */ vue.h(UFlex, { wrap: false, size: [20, 20], style: { width: "100%" } }, resolveSlot($slots.sidebar, () => [
65237
- /* @__PURE__ */ vue.h(ChatSidebar, null, {
65238
- sidebarHeaderMain: $slots.sidebarHeaderMain,
65239
- sidebarHeaderActions: $slots.sidebarHeaderActions
65240
- })
65241
- ]), resolveSlot($slots.default, () => [
65242
- /* @__PURE__ */ vue.h(ChatMainArea, null, {
65243
- headerActions: $slots.headerActions
65244
- })
65245
- ]))
65901
+ /* @__PURE__ */ vue.h(UFlex, { wrap: false, size: [20, 20], style: { width: "100%" } }, {
65902
+ default: () => /* @__PURE__ */ vue.h(vue.Fragment, null, resolveSlot($slots.sidebar, () => [
65903
+ /* @__PURE__ */ vue.h(ChatSidebar, null, {
65904
+ sidebarHeaderMain: $slots.sidebarHeaderMain,
65905
+ sidebarHeaderActions: $slots.sidebarHeaderActions
65906
+ })
65907
+ ]), resolveSlot($slots.default, () => [
65908
+ /* @__PURE__ */ vue.h(ChatMainArea, null, {
65909
+ headerActions: $slots.headerActions
65910
+ })
65911
+ ]))
65912
+ })
65246
65913
  );
65247
65914
  }
65248
65915
  });
@@ -74520,7 +75187,7 @@
74520
75187
  var root = freeGlobal || freeSelf || Function('return this')();
74521
75188
 
74522
75189
  /** Built-in value references. */
74523
- var Symbol = root.Symbol;
75190
+ var Symbol$1 = root.Symbol;
74524
75191
 
74525
75192
  /** Used for built-in method references. */
74526
75193
  var objectProto$s = Object.prototype;
@@ -74536,7 +75203,7 @@
74536
75203
  var nativeObjectToString$3 = objectProto$s.toString;
74537
75204
 
74538
75205
  /** Built-in value references. */
74539
- var symToStringTag$1 = Symbol ? Symbol.toStringTag : undefined;
75206
+ var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined;
74540
75207
 
74541
75208
  /**
74542
75209
  * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
@@ -74589,7 +75256,7 @@
74589
75256
  undefinedTag = '[object Undefined]';
74590
75257
 
74591
75258
  /** Built-in value references. */
74592
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
75259
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
74593
75260
 
74594
75261
  /**
74595
75262
  * The base implementation of `getTag` without fallbacks for buggy environments.
@@ -74726,7 +75393,7 @@
74726
75393
  var INFINITY$5 = 1 / 0;
74727
75394
 
74728
75395
  /** Used to convert symbols to primitives and strings. */
74729
- var symbolProto$2 = Symbol ? Symbol.prototype : undefined,
75396
+ var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : undefined,
74730
75397
  symbolToString = symbolProto$2 ? symbolProto$2.toString : undefined;
74731
75398
 
74732
75399
  /**
@@ -77986,7 +78653,7 @@
77986
78653
  }
77987
78654
 
77988
78655
  /** Built-in value references. */
77989
- var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
78656
+ var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : undefined;
77990
78657
 
77991
78658
  /**
77992
78659
  * Checks if `value` is a flattenable `arguments` object or array.
@@ -79678,7 +80345,7 @@
79678
80345
  }
79679
80346
 
79680
80347
  /** Used to convert symbols to primitives and strings. */
79681
- var symbolProto$1 = Symbol ? Symbol.prototype : undefined,
80348
+ var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined,
79682
80349
  symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : undefined;
79683
80350
 
79684
80351
  /**
@@ -80411,7 +81078,7 @@
80411
81078
  dataViewTag = '[object DataView]';
80412
81079
 
80413
81080
  /** Used to convert symbols to primitives and strings. */
80414
- var symbolProto = Symbol ? Symbol.prototype : undefined,
81081
+ var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined,
80415
81082
  symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
80416
81083
 
80417
81084
  /**
@@ -86168,7 +86835,7 @@
86168
86835
  setTag$1 = '[object Set]';
86169
86836
 
86170
86837
  /** Built-in value references. */
86171
- var symIterator$1 = Symbol ? Symbol.iterator : undefined;
86838
+ var symIterator$1 = Symbol$1 ? Symbol$1.iterator : undefined;
86172
86839
 
86173
86840
  /**
86174
86841
  * Converts `value` to an array.
@@ -91773,7 +92440,7 @@
91773
92440
  var hasOwnProperty = objectProto.hasOwnProperty;
91774
92441
 
91775
92442
  /** Built-in value references. */
91776
- var symIterator = Symbol ? Symbol.iterator : undefined;
92443
+ var symIterator = Symbol$1 ? Symbol$1.iterator : undefined;
91777
92444
 
91778
92445
  /* Built-in method references for those with the same name as other `lodash` methods. */
91779
92446
  var nativeMax = Math.max,
@@ -128809,6 +129476,9 @@
128809
129476
 
128810
129477
  var components = /*#__PURE__*/Object.freeze({
128811
129478
  __proto__: null,
129479
+ ChatMarkType: ChatMarkType,
129480
+ ChatMessageType: ChatMessageType,
129481
+ MessageStatus: MessageStatus,
128812
129482
  NA: a,
128813
129483
  NP: p,
128814
129484
  UActionCard: ActionCard,
@@ -128833,6 +129503,8 @@
128833
129503
  UCarouselItem: UCarouselItem,
128834
129504
  UCascader: Cascader,
128835
129505
  UChat: Chat,
129506
+ UChatListItems: UChatListItems,
129507
+ UChatMessages: UChatMessages,
128836
129508
  UCheckbox: UCheckbox,
128837
129509
  UCheckboxGroup: UCheckboxGroup,
128838
129510
  UCode: UCode,
@@ -129097,7 +129769,7 @@
129097
129769
  watermarkProps: watermarkProps
129098
129770
  });
129099
129771
 
129100
- var version = "1.7.2";
129772
+ var version = "1.8.1";
129101
129773
 
129102
129774
  function create({
129103
129775
  componentPrefix = "U",
@@ -129902,6 +130574,9 @@
129902
130574
  };
129903
130575
  }
129904
130576
 
130577
+ exports.ChatMarkType = ChatMarkType;
130578
+ exports.ChatMessageType = ChatMessageType;
130579
+ exports.MessageStatus = MessageStatus;
129905
130580
  exports.NA = a;
129906
130581
  exports.NP = p;
129907
130582
  exports.UActionCard = ActionCard;
@@ -129926,6 +130601,8 @@
129926
130601
  exports.UCarouselItem = UCarouselItem;
129927
130602
  exports.UCascader = Cascader;
129928
130603
  exports.UChat = Chat;
130604
+ exports.UChatListItems = UChatListItems;
130605
+ exports.UChatMessages = UChatMessages;
129929
130606
  exports.UCheckbox = UCheckbox;
129930
130607
  exports.UCheckboxGroup = UCheckboxGroup;
129931
130608
  exports.UCode = UCode;