@cloudflare/realtimekit-ui 1.0.9-staging.2 → 1.0.9-staging.4

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 (587) hide show
  1. package/dist/browser.js +1 -1
  2. package/dist/cjs/ChatHead-e13f3b0e.js +13 -0
  3. package/dist/cjs/{TextMessage-4f9299ff.js → TextMessage-7bb3e1fd.js} +1 -1
  4. package/dist/cjs/{chat-04fd67b4.js → chat-717e517d.js} +1 -1
  5. package/dist/cjs/{notification-6f17add8.js → config-8c9ac89a.js} +0 -35
  6. package/dist/cjs/{ChatHead-6416d6cf.js → date-61ffcd0a.js} +0 -10
  7. package/dist/cjs/index-05554ce6.js +62 -2
  8. package/dist/cjs/index.cjs.js +11 -10
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/cjs/notification-567fe887.js +39 -0
  11. package/dist/cjs/realtimekit-ui.cjs.js +1 -1
  12. package/dist/cjs/rtk-ai-transcriptions.cjs.entry.js +3 -2
  13. package/dist/cjs/rtk-audio-grid.cjs.entry.js +1 -1
  14. package/dist/cjs/rtk-audio-visualizer_4.cjs.entry.js +1 -1
  15. package/dist/cjs/rtk-avatar_24.cjs.entry.js +2584 -0
  16. package/dist/cjs/rtk-breakout-room-manager_3.cjs.entry.js +397 -0
  17. package/dist/cjs/rtk-breakout-rooms-manager_9.cjs.entry.js +986 -0
  18. package/dist/cjs/rtk-channel-creator.cjs.entry.js +163 -0
  19. package/dist/cjs/rtk-channel-details.cjs.entry.js +49 -0
  20. package/dist/cjs/rtk-channel-header.cjs.entry.js +83 -0
  21. package/dist/cjs/rtk-channel-selector-ui.cjs.entry.js +4 -4
  22. package/dist/cjs/rtk-chat-composer-ui.cjs.entry.js +1 -1
  23. package/dist/cjs/rtk-chat-message.cjs.entry.js +118 -0
  24. package/dist/cjs/rtk-chat-messages-ui.cjs.entry.js +200 -0
  25. package/dist/cjs/rtk-chat-search-results.cjs.entry.js +57 -0
  26. package/dist/cjs/rtk-chat-selector-ui.cjs.entry.js +1 -1
  27. package/dist/cjs/rtk-clock.cjs.entry.js +3 -3
  28. package/dist/cjs/rtk-controlbar.cjs.entry.js +1 -1
  29. package/dist/cjs/rtk-debugger-audio_4.cjs.entry.js +686 -0
  30. package/dist/cjs/rtk-debugger-toggle.cjs.entry.js +1 -1
  31. package/dist/cjs/rtk-dialog-manager.cjs.entry.js +154 -0
  32. package/dist/cjs/rtk-dialog.cjs.entry.js +93 -0
  33. package/dist/cjs/rtk-file-dropzone.cjs.entry.js +1 -1
  34. package/dist/cjs/rtk-file-message_3.cjs.entry.js +148 -0
  35. package/dist/cjs/rtk-header.cjs.entry.js +1 -1
  36. package/dist/cjs/rtk-idle-screen.cjs.entry.js +1 -1
  37. package/dist/cjs/rtk-image-viewer.cjs.entry.js +1 -1
  38. package/dist/cjs/rtk-information-tooltip.cjs.entry.js +1 -1
  39. package/dist/cjs/rtk-leave-button.cjs.entry.js +1 -1
  40. package/dist/cjs/rtk-logo.cjs.entry.js +77 -0
  41. package/dist/cjs/rtk-message-list-view.cjs.entry.js +3 -3
  42. package/dist/cjs/rtk-more-toggle.cjs.entry.js +2 -2
  43. package/dist/cjs/rtk-notification.cjs.entry.js +71 -0
  44. package/dist/cjs/rtk-notifications.cjs.entry.js +588 -0
  45. package/dist/cjs/rtk-participant-setup.cjs.entry.js +2 -2
  46. package/dist/cjs/rtk-participant_2.cjs.entry.js +14 -14
  47. package/dist/cjs/rtk-participants-audio.cjs.entry.js +1 -1
  48. package/dist/cjs/rtk-participants-stage-list_4.cjs.entry.js +1 -1
  49. package/dist/cjs/rtk-plugins_2.cjs.entry.js +4 -4
  50. package/dist/cjs/rtk-poll_2.cjs.entry.js +3 -3
  51. package/dist/cjs/rtk-recording-indicator.cjs.entry.js +1 -1
  52. package/dist/cjs/rtk-screenshare-view.cjs.entry.js +5 -5
  53. package/dist/cjs/rtk-settings-toggle.cjs.entry.js +1 -1
  54. package/dist/cjs/rtk-sidebar.cjs.entry.js +1 -1
  55. package/dist/cjs/rtk-spotlight-grid.cjs.entry.js +2 -2
  56. package/dist/cjs/rtk-stage.cjs.entry.js +1 -1
  57. package/dist/cjs/rtk-transcript.cjs.entry.js +1 -1
  58. package/dist/cjs/rtk-waiting-screen.cjs.entry.js +1 -1
  59. package/dist/collection/components/rtk-ai-transcriptions/rtk-ai-transcriptions.js +1 -1
  60. package/dist/collection/components/rtk-audio-grid/rtk-audio-grid.js +1 -1
  61. package/dist/collection/components/rtk-breakout-room-participants/rtk-breakout-room-participants.js +2 -2
  62. package/dist/collection/components/rtk-broadcast-message-modal/rtk-broadcast-message-modal.js +2 -2
  63. package/dist/collection/components/rtk-channel-creator/rtk-channel-creator.js +5 -2
  64. package/dist/collection/components/rtk-channel-details/rtk-channel-details.js +2 -1
  65. package/dist/collection/components/rtk-channel-header/rtk-channel-header.js +1 -0
  66. package/dist/collection/components/rtk-channel-selector-ui/rtk-channel-selector-ui.js +5 -2
  67. package/dist/collection/components/rtk-chat/rtk-chat.js +5 -102
  68. package/dist/collection/components/rtk-chat-message/rtk-chat-message.js +3 -2
  69. package/dist/collection/components/rtk-chat-messages-ui/rtk-chat-messages-ui.js +13 -4
  70. package/dist/collection/components/rtk-chat-messages-ui-paginated/rtk-chat-messages-ui-paginated.js +4 -2
  71. package/dist/collection/components/rtk-chat-search-results/rtk-chat-search-results.js +2 -1
  72. package/dist/collection/components/rtk-clock/rtk-clock.js +3 -3
  73. package/dist/collection/components/rtk-confirmation-modal/rtk-confirmation-modal.js +1 -1
  74. package/dist/collection/components/rtk-controlbar/rtk-controlbar.js +1 -1
  75. package/dist/collection/components/rtk-counter/rtk-counter.js +2 -2
  76. package/dist/collection/components/rtk-debugger-toggle/rtk-debugger-toggle.js +1 -1
  77. package/dist/collection/components/rtk-dialog-manager/rtk-dialog-manager.js +0 -6
  78. package/dist/collection/components/rtk-draft-attachment-view/rtk-draft-attachment-view.js +1 -1
  79. package/dist/collection/components/rtk-emoji-picker/rtk-emoji-picker.js +1 -1
  80. package/dist/collection/components/rtk-emoji-picker-button/rtk-emoji-picker-button.js +1 -1
  81. package/dist/collection/components/rtk-file-dropzone/rtk-file-dropzone.js +1 -1
  82. package/dist/collection/components/rtk-file-message/rtk-file-message.js +3 -2
  83. package/dist/collection/components/rtk-file-message-view/rtk-file-message-view.js +1 -1
  84. package/dist/collection/components/rtk-file-picker-button/rtk-file-picker-button.js +1 -1
  85. package/dist/collection/components/rtk-header/rtk-header.js +1 -1
  86. package/dist/collection/components/rtk-idle-screen/rtk-idle-screen.js +1 -1
  87. package/dist/collection/components/rtk-image-message/rtk-image-message.js +5 -4
  88. package/dist/collection/components/rtk-image-message-view/rtk-image-message-view.js +3 -3
  89. package/dist/collection/components/rtk-image-viewer/rtk-image-viewer.js +1 -1
  90. package/dist/collection/components/rtk-information-tooltip/rtk-information-tooltip.js +1 -1
  91. package/dist/collection/components/rtk-leave-button/rtk-leave-button.js +1 -1
  92. package/dist/collection/components/rtk-leave-meeting/rtk-leave-meeting.js +2 -2
  93. package/dist/collection/components/rtk-markdown-view/rtk-markdown-view.js +1 -1
  94. package/dist/collection/components/rtk-menu/rtk-menu.js +2 -2
  95. package/dist/collection/components/rtk-menu-item/rtk-menu-item.js +1 -1
  96. package/dist/collection/components/rtk-menu-list/rtk-menu-list.js +1 -1
  97. package/dist/collection/components/rtk-message-list-view/rtk-message-list-view.js +3 -3
  98. package/dist/collection/components/rtk-message-view/rtk-message-view.css +26 -12
  99. package/dist/collection/components/rtk-message-view/rtk-message-view.js +23 -1
  100. package/dist/collection/components/rtk-more-toggle/rtk-more-toggle.js +2 -2
  101. package/dist/collection/components/rtk-mute-all-confirmation/rtk-mute-all-confirmation.js +1 -1
  102. package/dist/collection/components/rtk-notification/rtk-notification.js +2 -2
  103. package/dist/collection/components/rtk-overlay-modal/rtk-overlay-modal.js +1 -1
  104. package/dist/collection/components/rtk-paginated-list/rtk-paginated-list.css +25 -1
  105. package/dist/collection/components/rtk-paginated-list/rtk-paginated-list.js +25 -22
  106. package/dist/collection/components/rtk-participant/rtk-participant.js +12 -12
  107. package/dist/collection/components/rtk-participant-setup/rtk-participant-setup.js +2 -2
  108. package/dist/collection/components/rtk-participants-audio/rtk-participants-audio.js +1 -1
  109. package/dist/collection/components/rtk-participants-stage-list/rtk-participants-stage-list.js +1 -1
  110. package/dist/collection/components/rtk-permissions-message/rtk-permissions-message.js +1 -1
  111. package/dist/collection/components/rtk-plugins/rtk-plugins.js +1 -1
  112. package/dist/collection/components/rtk-poll/rtk-poll.js +1 -1
  113. package/dist/collection/components/rtk-poll-form/rtk-poll-form.js +2 -2
  114. package/dist/collection/components/rtk-polls/rtk-polls.js +3 -3
  115. package/dist/collection/components/rtk-recording-indicator/rtk-recording-indicator.js +1 -1
  116. package/dist/collection/components/rtk-screenshare-view/rtk-screenshare-view.js +5 -5
  117. package/dist/collection/components/rtk-settings-toggle/rtk-settings-toggle.js +1 -1
  118. package/dist/collection/components/rtk-sidebar/rtk-sidebar.css +2 -0
  119. package/dist/collection/components/rtk-spinner/rtk-spinner.js +1 -1
  120. package/dist/collection/components/rtk-spotlight-grid/rtk-spotlight-grid.js +2 -2
  121. package/dist/collection/components/rtk-stage/rtk-stage.js +1 -1
  122. package/dist/collection/components/rtk-switch/rtk-switch.js +1 -1
  123. package/dist/collection/components/rtk-text-composer-view/rtk-text-composer-view.js +1 -1
  124. package/dist/collection/components/rtk-text-message/rtk-text-message.js +3 -2
  125. package/dist/collection/components/rtk-text-message-view/rtk-text-message-view.js +1 -1
  126. package/dist/collection/components/rtk-tooltip/rtk-tooltip.js +1 -1
  127. package/dist/collection/components/rtk-transcript/rtk-transcript.js +1 -1
  128. package/dist/collection/components/rtk-virtualized-list/rtk-virtualized-participant-list.js +2 -2
  129. package/dist/collection/components/rtk-waiting-screen/rtk-waiting-screen.js +1 -1
  130. package/dist/collection/utils/chat.js +1 -1
  131. package/dist/components/index.js +7 -7
  132. package/dist/components/{p-26055088.js → p-080acf18.js} +3 -3
  133. package/dist/components/{p-34b580c9.js → p-0a35a909.js} +3 -3
  134. package/dist/components/{p-f9faeffc.js → p-0b4e526c.js} +3 -3
  135. package/dist/components/{p-a3ebfc10.js → p-0d582365.js} +2 -2
  136. package/dist/components/{p-c7413ac8.js → p-0d7bf41b.js} +4 -4
  137. package/dist/components/{p-a5a40d7e.js → p-102b6df8.js} +2 -2
  138. package/dist/components/{p-12d2b558.js → p-10ef077c.js} +3 -3
  139. package/dist/components/{p-4772f368.js → p-121e073d.js} +2 -2
  140. package/dist/components/{p-b804a5f5.js → p-188bfe87.js} +8 -8
  141. package/dist/components/{p-a9d5d165.js → p-190db142.js} +7 -7
  142. package/dist/components/{p-fb427023.js → p-20290b0b.js} +4 -4
  143. package/dist/components/{p-03fe0979.js → p-244cbe7b.js} +2 -2
  144. package/dist/components/{p-cc5ecd67.js → p-2d08ab28.js} +2 -2
  145. package/dist/components/{p-91a9efcf.js → p-2e282643.js} +5 -5
  146. package/dist/components/{p-aba9b612.js → p-2f82e0b0.js} +7 -7
  147. package/dist/components/{p-7119673c.js → p-33a87325.js} +2 -2
  148. package/dist/components/{p-511ed3f8.js → p-395d7140.js} +4 -4
  149. package/dist/components/{p-1a60f5b0.js → p-3da4880c.js} +4 -4
  150. package/dist/components/{p-af35ac31.js → p-47c25f64.js} +1 -1
  151. package/dist/components/{p-01a50790.js → p-488d88a8.js} +4 -4
  152. package/dist/components/{p-e2e22bf8.js → p-4d582a90.js} +5 -5
  153. package/dist/components/{p-b373754d.js → p-51de7af3.js} +1 -1
  154. package/dist/components/{p-65b9931e.js → p-55501201.js} +4 -4
  155. package/dist/components/{p-7f0ee3c6.js → p-563c785d.js} +3 -3
  156. package/dist/components/{p-c40166a9.js → p-5c92df32.js} +5 -5
  157. package/dist/components/{p-ed8955d0.js → p-5f26bba3.js} +2 -2
  158. package/dist/components/{p-0a7f6a8a.js → p-618864a0.js} +3 -3
  159. package/dist/components/{p-49967150.js → p-63ef7ea4.js} +6 -6
  160. package/dist/components/{p-00ebd1dc.js → p-65cd2fe3.js} +4 -4
  161. package/dist/components/{p-3438fd71.js → p-6756b222.js} +2 -2
  162. package/dist/components/{p-9730c398.js → p-6c2cfa0d.js} +3 -3
  163. package/dist/components/{p-3a80e3ab.js → p-6f272732.js} +8 -8
  164. package/dist/components/{p-df25c2a7.js → p-6f340109.js} +1 -1
  165. package/dist/components/{p-a09aefba.js → p-7481511c.js} +2 -2
  166. package/dist/components/{p-6bd3b767.js → p-78b61cce.js} +1 -1
  167. package/dist/components/{p-037e572f.js → p-7fc0dc2f.js} +1 -1
  168. package/dist/components/{p-314b1504.js → p-82f8c924.js} +2 -2
  169. package/dist/components/{p-6d49cf9f.js → p-84e5b453.js} +2 -2
  170. package/dist/components/{p-f5f0b499.js → p-88bef213.js} +2 -2
  171. package/dist/components/{p-f46a0782.js → p-8d25843a.js} +3 -3
  172. package/dist/components/{p-2b955eb0.js → p-914563e7.js} +5 -5
  173. package/dist/components/{p-04aaec79.js → p-94e867c2.js} +17 -15
  174. package/dist/components/{p-731ee854.js → p-9889bee5.js} +5 -5
  175. package/dist/components/{p-dc4b6fc4.js → p-9e87b2c9.js} +2 -2
  176. package/dist/components/{p-f734a4cf.js → p-a10b9faa.js} +2 -2
  177. package/dist/components/{p-f81c7fda.js → p-a29c01fc.js} +2 -2
  178. package/dist/components/{p-551bed08.js → p-a4a5ff5a.js} +4 -4
  179. package/dist/components/{p-1986022b.js → p-a6296b02.js} +3 -3
  180. package/dist/components/{p-93e1439e.js → p-a94b2e67.js} +2 -2
  181. package/dist/components/{p-4c8cff29.js → p-a9540d93.js} +28 -24
  182. package/dist/components/{p-a2f4f9e3.js → p-aae4c250.js} +1 -1
  183. package/dist/components/{p-3051f5f5.js → p-abe1dbe6.js} +4 -4
  184. package/dist/components/{p-840ef7fe.js → p-adf73364.js} +5 -5
  185. package/dist/components/{p-72346e7f.js → p-afe77b50.js} +2 -2
  186. package/dist/components/{p-f4ff7d70.js → p-b011763d.js} +3 -3
  187. package/dist/components/{p-9ea5df8f.js → p-b34865c7.js} +4 -4
  188. package/dist/components/{p-897a04be.js → p-b882f4a1.js} +4 -4
  189. package/dist/components/{p-4edd666b.js → p-bb8f2597.js} +6 -6
  190. package/dist/components/{p-9149c02e.js → p-c078ae06.js} +2 -2
  191. package/dist/components/{p-989d36e2.js → p-c3621e10.js} +6 -6
  192. package/dist/components/{p-40c5ca62.js → p-c515acba.js} +2 -2
  193. package/dist/components/{p-12437468.js → p-cf503999.js} +2 -2
  194. package/dist/components/{p-66bae0d9.js → p-d06d1eac.js} +2 -2
  195. package/dist/components/{p-17867774.js → p-d107e9f4.js} +3 -3
  196. package/dist/components/{p-c5dfd548.js → p-d37b8a32.js} +49 -326
  197. package/dist/components/{p-bccc21f8.js → p-d3de8b85.js} +3 -3
  198. package/dist/components/{p-22a734a8.js → p-d4e2ac64.js} +6 -6
  199. package/dist/components/{p-0abe4b8a.js → p-dab9d3d6.js} +1 -1
  200. package/dist/components/{p-52b090fc.js → p-dbfc9151.js} +3 -3
  201. package/dist/components/{p-d2c3870a.js → p-e4a080a5.js} +3 -3
  202. package/dist/components/{p-c663f9b1.js → p-e6710b76.js} +4 -4
  203. package/dist/components/{p-3df2211d.js → p-e675729a.js} +4 -4
  204. package/dist/components/{p-ddb2df62.js → p-e81fc1e8.js} +3 -3
  205. package/dist/components/{p-39a6a6a6.js → p-e8df7ac5.js} +18 -18
  206. package/dist/components/{p-1d29b7c3.js → p-ee98bbaf.js} +12 -12
  207. package/dist/components/{p-3fe1bb0d.js → p-f47894a6.js} +12 -12
  208. package/dist/components/{p-6fe2233b.js → p-f4e75ea9.js} +3 -3
  209. package/dist/components/{p-22d9d3ff.js → p-f7430e46.js} +5 -5
  210. package/dist/components/{p-d2b37264.js → p-f7eb9c47.js} +5 -5
  211. package/dist/components/{p-54dba22f.js → p-f8f5cb31.js} +4 -4
  212. package/dist/components/{p-03bdc4c0.js → p-fa8f6b4a.js} +1 -1
  213. package/dist/components/{p-fb46d041.js → p-fd68a52b.js} +8 -8
  214. package/dist/components/{p-c3582bf3.js → p-fe911889.js} +12 -9
  215. package/dist/components/rtk-ai-toggle.js +4 -4
  216. package/dist/components/rtk-ai-transcriptions.js +1 -1
  217. package/dist/components/rtk-ai.js +3 -3
  218. package/dist/components/rtk-audio-grid.js +3 -3
  219. package/dist/components/rtk-audio-tile.js +5 -5
  220. package/dist/components/rtk-audio-visualizer.js +1 -1
  221. package/dist/components/rtk-avatar.js +1 -1
  222. package/dist/components/rtk-breakout-room-manager.js +1 -1
  223. package/dist/components/rtk-breakout-room-participants.js +1 -1
  224. package/dist/components/rtk-breakout-rooms-manager.js +1 -1
  225. package/dist/components/rtk-breakout-rooms-toggle.js +4 -4
  226. package/dist/components/rtk-broadcast-message-modal.js +1 -1
  227. package/dist/components/rtk-camera-selector.js +1 -1
  228. package/dist/components/rtk-camera-toggle.js +5 -5
  229. package/dist/components/rtk-caption-toggle.js +4 -4
  230. package/dist/components/rtk-channel-creator.js +209 -1
  231. package/dist/components/rtk-channel-details.js +1 -1
  232. package/dist/components/rtk-channel-header.js +146 -1
  233. package/dist/components/rtk-channel-selector-ui.js +7 -7
  234. package/dist/components/rtk-channel-selector-view.js +1 -1
  235. package/dist/components/rtk-chat-composer-ui.js +7 -7
  236. package/dist/components/rtk-chat-composer-view.js +1 -1
  237. package/dist/components/rtk-chat-message.js +1 -1
  238. package/dist/components/rtk-chat-messages-ui-paginated.js +1 -1
  239. package/dist/components/rtk-chat-messages-ui.js +302 -1
  240. package/dist/components/rtk-chat-search-results.js +146 -1
  241. package/dist/components/rtk-chat-selector-ui.js +3 -3
  242. package/dist/components/rtk-chat-toggle.js +5 -5
  243. package/dist/components/rtk-chat.js +1 -1
  244. package/dist/components/rtk-clock.js +5 -5
  245. package/dist/components/rtk-confirmation-modal.js +1 -1
  246. package/dist/components/rtk-controlbar-button.js +1 -1
  247. package/dist/components/rtk-controlbar.js +3 -3
  248. package/dist/components/rtk-counter.js +1 -1
  249. package/dist/components/rtk-debugger-audio.js +1 -1
  250. package/dist/components/rtk-debugger-screenshare.js +1 -1
  251. package/dist/components/rtk-debugger-system.js +1 -1
  252. package/dist/components/rtk-debugger-toggle.js +5 -5
  253. package/dist/components/rtk-debugger-video.js +1 -1
  254. package/dist/components/rtk-debugger.js +1 -1
  255. package/dist/components/rtk-dialog-manager.js +305 -1
  256. package/dist/components/rtk-dialog.js +1 -1
  257. package/dist/components/rtk-draft-attachment-view.js +1 -1
  258. package/dist/components/rtk-emoji-picker-button.js +1 -1
  259. package/dist/components/rtk-emoji-picker.js +1 -1
  260. package/dist/components/rtk-ended-screen.js +3 -3
  261. package/dist/components/rtk-file-dropzone.js +3 -3
  262. package/dist/components/rtk-file-message-view.js +1 -1
  263. package/dist/components/rtk-file-message.js +1 -1
  264. package/dist/components/rtk-file-picker-button.js +1 -1
  265. package/dist/components/rtk-fullscreen-toggle.js +1 -1
  266. package/dist/components/rtk-grid-pagination.js +3 -3
  267. package/dist/components/rtk-grid.js +8 -8
  268. package/dist/components/rtk-header.js +3 -3
  269. package/dist/components/rtk-idle-screen.js +5 -5
  270. package/dist/components/rtk-image-message-view.js +1 -1
  271. package/dist/components/rtk-image-message.js +1 -1
  272. package/dist/components/rtk-image-viewer.js +3 -3
  273. package/dist/components/rtk-information-tooltip.js +3 -3
  274. package/dist/components/rtk-join-stage.js +1 -1
  275. package/dist/components/rtk-leave-button.js +5 -5
  276. package/dist/components/rtk-leave-meeting.js +1 -1
  277. package/dist/components/rtk-livestream-indicator.js +1 -1
  278. package/dist/components/rtk-livestream-player.js +1 -1
  279. package/dist/components/rtk-livestream-toggle.js +4 -4
  280. package/dist/components/rtk-logo.js +1 -1
  281. package/dist/components/rtk-markdown-view.js +1 -1
  282. package/dist/components/rtk-meeting-title.js +3 -3
  283. package/dist/components/rtk-meeting.js +47 -227
  284. package/dist/components/rtk-menu-item.js +1 -1
  285. package/dist/components/rtk-menu-list.js +1 -1
  286. package/dist/components/rtk-menu.js +1 -1
  287. package/dist/components/rtk-message-list-view.js +6 -6
  288. package/dist/components/rtk-message-view.js +1 -1
  289. package/dist/components/rtk-mic-toggle.js +5 -5
  290. package/dist/components/rtk-microphone-selector.js +1 -1
  291. package/dist/components/rtk-mixed-grid.js +6 -6
  292. package/dist/components/rtk-more-toggle.js +6 -6
  293. package/dist/components/rtk-mute-all-button.js +5 -5
  294. package/dist/components/rtk-mute-all-confirmation.js +1 -1
  295. package/dist/components/rtk-name-tag.js +1 -1
  296. package/dist/components/rtk-network-indicator.js +2 -2
  297. package/dist/components/rtk-notification.js +1 -1
  298. package/dist/components/rtk-notifications.js +629 -1
  299. package/dist/components/rtk-overlay-modal.js +1 -1
  300. package/dist/components/rtk-paginated-list.js +1 -1
  301. package/dist/components/rtk-participant-count.js +2 -2
  302. package/dist/components/rtk-participant-setup.js +4 -4
  303. package/dist/components/rtk-participant-tile.js +1 -1
  304. package/dist/components/rtk-participant.js +1 -1
  305. package/dist/components/rtk-participants-audio.js +4 -4
  306. package/dist/components/rtk-participants-stage-list.js +1 -1
  307. package/dist/components/rtk-participants-stage-queue.js +1 -1
  308. package/dist/components/rtk-participants-toggle.js +5 -5
  309. package/dist/components/rtk-participants-viewer-list.js +1 -1
  310. package/dist/components/rtk-participants-waiting-list.js +1 -1
  311. package/dist/components/rtk-participants.js +14 -14
  312. package/dist/components/rtk-permissions-message.js +1 -1
  313. package/dist/components/rtk-pip-toggle.js +4 -4
  314. package/dist/components/rtk-plugin-main.js +1 -1
  315. package/dist/components/rtk-plugins-toggle.js +5 -5
  316. package/dist/components/rtk-plugins.js +1 -1
  317. package/dist/components/rtk-poll-form.js +1 -1
  318. package/dist/components/rtk-poll.js +1 -1
  319. package/dist/components/rtk-polls-toggle.js +5 -5
  320. package/dist/components/rtk-polls.js +1 -1
  321. package/dist/components/rtk-recording-indicator.js +3 -3
  322. package/dist/components/rtk-recording-toggle.js +4 -4
  323. package/dist/components/rtk-screen-share-toggle.js +5 -5
  324. package/dist/components/rtk-screenshare-view.js +8 -8
  325. package/dist/components/rtk-settings-audio.js +1 -1
  326. package/dist/components/rtk-settings-toggle.js +5 -5
  327. package/dist/components/rtk-settings-video.js +1 -1
  328. package/dist/components/rtk-settings.js +10 -10
  329. package/dist/components/rtk-setup-screen.js +6 -6
  330. package/dist/components/rtk-sidebar-ui.js +1 -1
  331. package/dist/components/rtk-sidebar.js +10 -10
  332. package/dist/components/rtk-simple-grid.js +2 -2
  333. package/dist/components/rtk-speaker-selector.js +1 -1
  334. package/dist/components/rtk-spinner.js +1 -1
  335. package/dist/components/rtk-spotlight-grid.js +4 -4
  336. package/dist/components/rtk-spotlight-indicator.js +1 -1
  337. package/dist/components/rtk-stage-toggle.js +5 -5
  338. package/dist/components/rtk-stage.js +3 -3
  339. package/dist/components/rtk-switch.js +1 -1
  340. package/dist/components/rtk-tab-bar.js +1 -1
  341. package/dist/components/rtk-text-composer-view.js +1 -1
  342. package/dist/components/rtk-text-message-view.js +1 -1
  343. package/dist/components/rtk-text-message.js +1 -1
  344. package/dist/components/rtk-tooltip.js +1 -1
  345. package/dist/components/rtk-transcript.js +1 -1
  346. package/dist/components/rtk-transcripts.js +3 -3
  347. package/dist/components/rtk-ui-provider.js +2 -2
  348. package/dist/components/rtk-viewer-count.js +1 -1
  349. package/dist/components/rtk-virtualized-participant-list.js +1 -1
  350. package/dist/components/rtk-waiting-screen.js +4 -4
  351. package/dist/docs/docs-components.json +144 -384
  352. package/dist/docs/docs-vscode.json +7 -3
  353. package/dist/esm/ChatHead-15c2f8d4.js +11 -0
  354. package/dist/esm/{TextMessage-07d53134.js → TextMessage-ca92045e.js} +1 -1
  355. package/dist/esm/{chat-32ac0c2b.js → chat-ff185374.js} +2 -2
  356. package/dist/esm/{notification-0794a8cc.js → config-e684aa4d.js} +3 -37
  357. package/dist/esm/{ChatHead-11b92a26.js → date-b1f78dea.js} +1 -10
  358. package/dist/esm/{debounce-6ec038d3.js → debounce-3ea4df36.js} +1 -1
  359. package/dist/esm/{file-849468c1.js → file-6114f1a9.js} +1 -1
  360. package/dist/esm/index-c1fb98bb.js +62 -2
  361. package/dist/esm/{index-849b9dd9.js → index-e65afca5.js} +1 -1
  362. package/dist/esm/index.js +7 -6
  363. package/dist/esm/loader.js +13237 -13245
  364. package/dist/esm/{merge-f5f3ca10.js → merge-7ffc04b3.js} +1 -1
  365. package/dist/esm/notification-78afaabf.js +37 -0
  366. package/dist/esm/realtimekit-ui.js +1 -1
  367. package/dist/esm/rtk-ai-toggle.entry.js +2 -2
  368. package/dist/esm/rtk-ai-transcriptions.entry.js +6 -5
  369. package/dist/esm/rtk-ai.entry.js +2 -2
  370. package/dist/esm/rtk-audio-grid.entry.js +3 -3
  371. package/dist/esm/rtk-audio-tile.entry.js +2 -2
  372. package/dist/esm/rtk-audio-visualizer_4.entry.js +3 -3
  373. package/dist/esm/rtk-avatar_24.entry.js +2557 -0
  374. package/dist/esm/rtk-breakout-room-manager_3.entry.js +391 -0
  375. package/dist/esm/rtk-breakout-rooms-manager_9.entry.js +974 -0
  376. package/dist/esm/rtk-breakout-rooms-toggle.entry.js +2 -2
  377. package/dist/esm/rtk-camera-selector_2.entry.js +2 -2
  378. package/dist/esm/rtk-camera-toggle.entry.js +2 -2
  379. package/dist/esm/rtk-caption-toggle.entry.js +2 -2
  380. package/dist/{components/p-c9a7cf06.js → esm/rtk-channel-creator.entry.js} +12 -64
  381. package/dist/esm/rtk-channel-details.entry.js +45 -0
  382. package/dist/{components/p-0c11d195.js → esm/rtk-channel-header.entry.js} +9 -78
  383. package/dist/esm/rtk-channel-selector-ui.entry.js +6 -6
  384. package/dist/esm/rtk-chat-composer-ui.entry.js +3 -3
  385. package/dist/esm/rtk-chat-message.entry.js +114 -0
  386. package/dist/{components/p-0e07ea51.js → esm/rtk-chat-messages-ui.entry.js} +14 -122
  387. package/dist/esm/rtk-chat-search-results.entry.js +53 -0
  388. package/dist/esm/rtk-chat-selector-ui.entry.js +3 -3
  389. package/dist/esm/rtk-chat-toggle.entry.js +3 -3
  390. package/dist/esm/rtk-clock.entry.js +5 -5
  391. package/dist/esm/rtk-controlbar-button.entry.js +2 -2
  392. package/dist/esm/rtk-controlbar.entry.js +3 -3
  393. package/dist/esm/rtk-debugger-audio_4.entry.js +679 -0
  394. package/dist/esm/rtk-debugger-toggle.entry.js +3 -3
  395. package/dist/{components/p-3042f998.js → esm/rtk-dialog-manager.entry.js} +10 -179
  396. package/dist/esm/rtk-dialog.entry.js +89 -0
  397. package/dist/esm/rtk-ended-screen.entry.js +2 -2
  398. package/dist/esm/rtk-file-dropzone.entry.js +3 -3
  399. package/dist/esm/rtk-file-message_3.entry.js +142 -0
  400. package/dist/esm/rtk-fullscreen-toggle.entry.js +2 -2
  401. package/dist/esm/rtk-grid-pagination.entry.js +2 -2
  402. package/dist/esm/rtk-grid.entry.js +2 -2
  403. package/dist/esm/rtk-header.entry.js +3 -3
  404. package/dist/esm/rtk-idle-screen.entry.js +3 -3
  405. package/dist/esm/rtk-image-viewer.entry.js +5 -5
  406. package/dist/esm/rtk-information-tooltip.entry.js +3 -3
  407. package/dist/esm/rtk-leave-button.entry.js +3 -3
  408. package/dist/esm/rtk-livestream-indicator_3.entry.js +2 -2
  409. package/dist/esm/rtk-livestream-toggle.entry.js +2 -2
  410. package/dist/esm/rtk-logo.entry.js +73 -0
  411. package/dist/esm/rtk-meeting-title.entry.js +2 -2
  412. package/dist/esm/rtk-message-list-view.entry.js +6 -6
  413. package/dist/esm/rtk-mic-toggle.entry.js +2 -2
  414. package/dist/esm/rtk-mixed-grid.entry.js +2 -2
  415. package/dist/esm/rtk-more-toggle.entry.js +4 -4
  416. package/dist/esm/rtk-mute-all-button.entry.js +2 -2
  417. package/dist/esm/rtk-name-tag.entry.js +3 -3
  418. package/dist/esm/rtk-network-indicator.entry.js +2 -2
  419. package/dist/esm/rtk-notification.entry.js +67 -0
  420. package/dist/{components/p-7a336667.js → esm/rtk-notifications.entry.js} +13 -60
  421. package/dist/esm/rtk-participant-count.entry.js +2 -2
  422. package/dist/esm/rtk-participant-setup.entry.js +4 -4
  423. package/dist/esm/rtk-participant_2.entry.js +18 -18
  424. package/dist/esm/rtk-participants-audio.entry.js +3 -3
  425. package/dist/esm/rtk-participants-stage-list_4.entry.js +3 -3
  426. package/dist/esm/rtk-participants-toggle.entry.js +3 -3
  427. package/dist/esm/rtk-participants.entry.js +3 -3
  428. package/dist/esm/rtk-pip-toggle.entry.js +2 -2
  429. package/dist/esm/rtk-plugin-main_2.entry.js +3 -3
  430. package/dist/esm/rtk-plugins-toggle.entry.js +3 -3
  431. package/dist/esm/rtk-plugins_2.entry.js +6 -6
  432. package/dist/esm/rtk-poll_2.entry.js +6 -6
  433. package/dist/esm/rtk-polls-toggle.entry.js +3 -3
  434. package/dist/esm/rtk-recording-indicator.entry.js +3 -3
  435. package/dist/esm/rtk-recording-toggle.entry.js +2 -2
  436. package/dist/esm/rtk-screen-share-toggle.entry.js +2 -2
  437. package/dist/esm/rtk-screenshare-view.entry.js +7 -7
  438. package/dist/esm/rtk-settings-audio_2.entry.js +2 -2
  439. package/dist/esm/rtk-settings-toggle.entry.js +3 -3
  440. package/dist/esm/rtk-settings.entry.js +2 -2
  441. package/dist/esm/rtk-setup-screen.entry.js +3 -3
  442. package/dist/esm/rtk-sidebar-ui.entry.js +2 -2
  443. package/dist/esm/rtk-sidebar.entry.js +4 -4
  444. package/dist/esm/rtk-simple-grid.entry.js +2 -2
  445. package/dist/esm/rtk-spotlight-grid.entry.js +4 -4
  446. package/dist/esm/rtk-spotlight-indicator.entry.js +2 -2
  447. package/dist/esm/rtk-stage-toggle.entry.js +2 -2
  448. package/dist/esm/rtk-stage.entry.js +3 -3
  449. package/dist/esm/rtk-transcript.entry.js +3 -3
  450. package/dist/esm/rtk-transcripts.entry.js +2 -2
  451. package/dist/esm/rtk-ui-provider.entry.js +2 -2
  452. package/dist/esm/rtk-waiting-screen.entry.js +3 -3
  453. package/dist/esm/{sidebar-76cae1f0.js → sidebar-030fff49.js} +1 -1
  454. package/dist/esm/{string-5e8dab07.js → string-068ce30a.js} +1 -1
  455. package/dist/esm/{ui-store-2965ff1a.js → ui-store-9e486e1b.js} +1 -1
  456. package/dist/realtimekit-ui/index.esm.js +1 -1
  457. package/dist/realtimekit-ui/{p-ff19ee1e.entry.js → p-0689d68b.entry.js} +1 -1
  458. package/dist/realtimekit-ui/{p-2318c3af.js → p-084b6f30.js} +1 -1
  459. package/dist/realtimekit-ui/{p-e6f1e6aa.entry.js → p-09869644.entry.js} +1 -1
  460. package/dist/realtimekit-ui/{p-22313959.entry.js → p-0b8c47d9.entry.js} +1 -1
  461. package/dist/realtimekit-ui/{p-b6c83f82.entry.js → p-11c964cf.entry.js} +1 -1
  462. package/dist/realtimekit-ui/{p-2857144e.js → p-12e4cb4a.js} +1 -1
  463. package/dist/realtimekit-ui/{p-9ba26c9f.entry.js → p-1666857d.entry.js} +1 -1
  464. package/dist/realtimekit-ui/{p-7f896d33.entry.js → p-1bf58a84.entry.js} +1 -1
  465. package/dist/realtimekit-ui/{p-2d6c5160.entry.js → p-2a0ec1c6.entry.js} +1 -1
  466. package/dist/realtimekit-ui/{p-404207e0.entry.js → p-2b373e53.entry.js} +1 -1
  467. package/dist/realtimekit-ui/p-2f641bfa.entry.js +1 -0
  468. package/dist/realtimekit-ui/p-2fc5ef84.entry.js +1 -0
  469. package/dist/realtimekit-ui/{p-9b6d809b.entry.js → p-31f58b98.entry.js} +1 -1
  470. package/dist/realtimekit-ui/p-33228f0a.entry.js +1 -0
  471. package/dist/realtimekit-ui/p-3369f405.entry.js +1 -0
  472. package/dist/realtimekit-ui/p-36c8dfa0.entry.js +1 -0
  473. package/dist/realtimekit-ui/p-382270d8.js +1 -0
  474. package/dist/realtimekit-ui/{p-ac1ff0f8.entry.js → p-385fddbd.entry.js} +1 -1
  475. package/dist/realtimekit-ui/{p-f1ab4672.entry.js → p-38aec474.entry.js} +1 -1
  476. package/dist/realtimekit-ui/p-38f4773b.entry.js +1 -0
  477. package/dist/realtimekit-ui/{p-368420fc.entry.js → p-3a325310.entry.js} +1 -1
  478. package/dist/realtimekit-ui/{p-83a8cd29.entry.js → p-3d0c4257.entry.js} +1 -1
  479. package/dist/realtimekit-ui/{p-6495f016.entry.js → p-3e02ec0b.entry.js} +1 -1
  480. package/dist/realtimekit-ui/p-3eefefa3.entry.js +1 -0
  481. package/dist/realtimekit-ui/p-40be18ee.js +1 -0
  482. package/dist/realtimekit-ui/{p-f5a3ccc0.entry.js → p-481549ac.entry.js} +1 -1
  483. package/dist/realtimekit-ui/{p-2aa2727b.entry.js → p-4eba1baa.entry.js} +1 -1
  484. package/dist/realtimekit-ui/p-4eee77b0.entry.js +1 -0
  485. package/dist/realtimekit-ui/{p-1185eec6.entry.js → p-50157a65.entry.js} +1 -1
  486. package/dist/realtimekit-ui/p-50e861f9.entry.js +1 -0
  487. package/dist/realtimekit-ui/{p-a7ba0456.entry.js → p-5383fe87.entry.js} +1 -1
  488. package/dist/realtimekit-ui/{p-2d09aeb4.entry.js → p-53ac3d30.entry.js} +1 -1
  489. package/dist/realtimekit-ui/{p-e32c13e0.entry.js → p-54a31e02.entry.js} +1 -1
  490. package/dist/realtimekit-ui/p-57277553.entry.js +1 -0
  491. package/dist/realtimekit-ui/{p-95ab3abe.entry.js → p-5a2d8313.entry.js} +1 -1
  492. package/dist/realtimekit-ui/p-5b2d97fc.js +1 -0
  493. package/dist/realtimekit-ui/p-60a29b69.entry.js +1 -0
  494. package/dist/realtimekit-ui/{p-62949a7d.entry.js → p-61a16ccf.entry.js} +1 -1
  495. package/dist/realtimekit-ui/{p-47d8e5c8.entry.js → p-61a53713.entry.js} +1 -1
  496. package/dist/realtimekit-ui/{p-77f71d40.entry.js → p-61d3f74f.entry.js} +1 -1
  497. package/dist/realtimekit-ui/{p-2dc496f0.entry.js → p-62e0a141.entry.js} +1 -1
  498. package/dist/realtimekit-ui/{p-dfa4a588.entry.js → p-639ab9ad.entry.js} +1 -1
  499. package/dist/realtimekit-ui/{p-0ab52f70.entry.js → p-643194e4.entry.js} +1 -1
  500. package/dist/realtimekit-ui/p-6a45f305.js +1 -0
  501. package/dist/realtimekit-ui/{p-e65d2f04.entry.js → p-6adb2de4.entry.js} +1 -1
  502. package/dist/realtimekit-ui/{p-efabd2ce.js → p-6f211c3e.js} +1 -1
  503. package/dist/realtimekit-ui/{p-c1d92065.entry.js → p-74e1b5a6.entry.js} +1 -1
  504. package/dist/realtimekit-ui/{p-a449b5cd.entry.js → p-7613857e.entry.js} +1 -1
  505. package/dist/realtimekit-ui/p-7786e9a7.entry.js +1 -0
  506. package/dist/realtimekit-ui/{p-5cb4f925.entry.js → p-77e04fb7.entry.js} +1 -1
  507. package/dist/realtimekit-ui/{p-1f328e83.entry.js → p-788f26c4.entry.js} +1 -1
  508. package/dist/realtimekit-ui/{p-53ffaa9f.entry.js → p-7a8ca3f2.entry.js} +1 -1
  509. package/dist/realtimekit-ui/{p-f5560043.entry.js → p-7b999408.entry.js} +1 -1
  510. package/dist/realtimekit-ui/p-7f76de48.entry.js +1 -0
  511. package/dist/realtimekit-ui/{p-2799d5b2.js → p-80c856cd.js} +1 -1
  512. package/dist/realtimekit-ui/{p-64aa0fae.entry.js → p-882d07c9.entry.js} +1 -1
  513. package/dist/realtimekit-ui/{p-7fab2c53.entry.js → p-8b189438.entry.js} +1 -1
  514. package/dist/realtimekit-ui/{p-81d1334c.entry.js → p-8b341608.entry.js} +1 -1
  515. package/dist/realtimekit-ui/{p-e24289b8.entry.js → p-8f512d69.entry.js} +1 -1
  516. package/dist/realtimekit-ui/{p-c6c86fd8.js → p-91ea043c.js} +1 -1
  517. package/dist/realtimekit-ui/{p-145caa6b.js → p-91fd286c.js} +1 -1
  518. package/dist/realtimekit-ui/p-930f0255.entry.js +1 -0
  519. package/dist/realtimekit-ui/p-93b84c22.js +1 -0
  520. package/dist/realtimekit-ui/{p-34350578.entry.js → p-941f159e.entry.js} +1 -1
  521. package/dist/realtimekit-ui/{p-f3998c17.entry.js → p-949b2b6a.entry.js} +1 -1
  522. package/dist/realtimekit-ui/{p-3144bec3.entry.js → p-951a7b06.entry.js} +1 -1
  523. package/dist/realtimekit-ui/{p-616f3a25.entry.js → p-95f05e26.entry.js} +1 -1
  524. package/dist/realtimekit-ui/{p-db9dd8ea.entry.js → p-98ee3341.entry.js} +1 -1
  525. package/dist/realtimekit-ui/{p-7fbca8d1.entry.js → p-9ad2c746.entry.js} +1 -1
  526. package/dist/realtimekit-ui/p-9c1f42dd.entry.js +1 -0
  527. package/dist/realtimekit-ui/{p-6334ca51.entry.js → p-9cbf286a.entry.js} +1 -1
  528. package/dist/realtimekit-ui/{p-560fc162.entry.js → p-a1203856.entry.js} +1 -1
  529. package/dist/realtimekit-ui/{p-0b93c12d.entry.js → p-a319e81f.entry.js} +1 -1
  530. package/dist/realtimekit-ui/p-a4e223e8.entry.js +1 -0
  531. package/dist/realtimekit-ui/{p-e7a89e24.entry.js → p-a9126c12.entry.js} +1 -1
  532. package/dist/realtimekit-ui/{p-a55863be.entry.js → p-a9dd63ef.entry.js} +1 -1
  533. package/dist/realtimekit-ui/p-aa70de39.entry.js +1 -0
  534. package/dist/realtimekit-ui/{p-ead8970b.entry.js → p-ae7319ac.entry.js} +1 -1
  535. package/dist/realtimekit-ui/p-b387e9a1.entry.js +1 -0
  536. package/dist/realtimekit-ui/p-b564d931.entry.js +1 -0
  537. package/dist/realtimekit-ui/{p-f16345d6.entry.js → p-ba51770e.entry.js} +1 -1
  538. package/dist/realtimekit-ui/{p-0979ba30.entry.js → p-c1b81873.entry.js} +1 -1
  539. package/dist/realtimekit-ui/{p-543dcdc1.entry.js → p-c5c965b8.entry.js} +1 -1
  540. package/dist/realtimekit-ui/{p-b2b8b421.entry.js → p-c638f666.entry.js} +1 -1
  541. package/dist/realtimekit-ui/p-c7711712.entry.js +1 -0
  542. package/dist/realtimekit-ui/{p-bfd7cd5a.entry.js → p-d0384d90.entry.js} +1 -1
  543. package/dist/realtimekit-ui/p-d7f16f24.entry.js +1 -0
  544. package/dist/realtimekit-ui/p-d81c0263.entry.js +1 -0
  545. package/dist/realtimekit-ui/{p-35b87831.entry.js → p-d9cad67f.entry.js} +1 -1
  546. package/dist/realtimekit-ui/{p-0266e82b.entry.js → p-de75d48d.entry.js} +1 -1
  547. package/dist/realtimekit-ui/{p-4b62d6f9.entry.js → p-e62593a2.entry.js} +1 -1
  548. package/dist/realtimekit-ui/{p-fa2ee341.js → p-e720b51e.js} +1 -1
  549. package/dist/realtimekit-ui/{p-9ac89beb.entry.js → p-e7b83772.entry.js} +1 -1
  550. package/dist/realtimekit-ui/{p-8046e263.js → p-e87928f7.js} +1 -1
  551. package/dist/realtimekit-ui/{p-39d0ad4d.entry.js → p-e925ca8a.entry.js} +1 -1
  552. package/dist/realtimekit-ui/{p-e0dd5f79.entry.js → p-f0f6c282.entry.js} +1 -1
  553. package/dist/realtimekit-ui/{p-51a8a9e5.entry.js → p-f40a55e3.entry.js} +1 -1
  554. package/dist/realtimekit-ui/{p-47e89714.entry.js → p-f5aa8af7.entry.js} +1 -1
  555. package/dist/realtimekit-ui/p-f645b8bb.entry.js +1 -0
  556. package/dist/realtimekit-ui/realtimekit-ui.esm.js +1 -1
  557. package/dist/types/components/rtk-channel-creator/rtk-channel-creator.d.ts +3 -0
  558. package/dist/types/components/rtk-channel-details/rtk-channel-details.d.ts +1 -0
  559. package/dist/types/components/rtk-channel-header/rtk-channel-header.d.ts +1 -0
  560. package/dist/types/components/rtk-channel-selector-ui/rtk-channel-selector-ui.d.ts +3 -0
  561. package/dist/types/components/rtk-chat/rtk-chat.d.ts +0 -9
  562. package/dist/types/components/rtk-chat-message/rtk-chat-message.d.ts +1 -0
  563. package/dist/types/components/rtk-chat-messages-ui/rtk-chat-messages-ui.d.ts +3 -0
  564. package/dist/types/components/rtk-chat-search-results/rtk-chat-search-results.d.ts +1 -0
  565. package/dist/types/components/rtk-file-message/rtk-file-message.d.ts +1 -0
  566. package/dist/types/components/rtk-image-message/rtk-image-message.d.ts +1 -0
  567. package/dist/types/components/rtk-message-view/rtk-message-view.d.ts +2 -0
  568. package/dist/types/components/rtk-paginated-list/rtk-paginated-list.d.ts +5 -0
  569. package/dist/types/components/rtk-text-message/rtk-text-message.d.ts +1 -0
  570. package/dist/types/components.d.ts +104 -0
  571. package/dist/types/types/props.d.ts +1 -0
  572. package/dist/types/utils/chat.d.ts +1 -1
  573. package/package.json +1 -1
  574. package/dist/cjs/rtk-avatar_54.cjs.entry.js +0 -6417
  575. package/dist/components/p-6a47e2ee.js +0 -148
  576. package/dist/esm/rtk-avatar_54.entry.js +0 -6360
  577. package/dist/realtimekit-ui/p-00b5bdeb.entry.js +0 -1
  578. package/dist/realtimekit-ui/p-173457a5.js +0 -1
  579. package/dist/realtimekit-ui/p-2d729cec.entry.js +0 -1
  580. package/dist/realtimekit-ui/p-3263d76d.entry.js +0 -1
  581. package/dist/realtimekit-ui/p-34c90f1c.entry.js +0 -1
  582. package/dist/realtimekit-ui/p-47314bc7.js +0 -1
  583. package/dist/realtimekit-ui/p-4ea418c9.js +0 -1
  584. package/dist/realtimekit-ui/p-55f181be.entry.js +0 -1
  585. package/dist/realtimekit-ui/p-bad807c1.entry.js +0 -1
  586. package/dist/realtimekit-ui/p-bfed80f3.entry.js +0 -1
  587. package/dist/realtimekit-ui/p-d7a5c237.entry.js +0 -1
@@ -0,0 +1,2584 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index$1 = require('./index-05554ce6.js');
6
+ const uiStore = require('./ui-store-1cb28da8.js');
7
+ const string = require('./string-9bce3253.js');
8
+ const index = require('./index-8d07e125.js');
9
+ const debounce = require('./debounce-a3e0d9e7.js');
10
+ const chat = require('./chat-717e517d.js');
11
+ const file = require('./file-0b9afa34.js');
12
+ const merge = require('./merge-73e2770b.js');
13
+ const index$2 = require('./index-821d14b7.js');
14
+ const config = require('./config-8c9ac89a.js');
15
+ const ResizeObserver_es = require('./ResizeObserver.es-ba961f16.js');
16
+ const floatingUi_dom_esm = require('./floating-ui.dom.esm-705e65f3.js');
17
+ const date = require('./date-61ffcd0a.js');
18
+ const scroll = require('./scroll-c6404609.js');
19
+
20
+ const rtkAvatarCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px);align-items:center;justify-content:center;font-size:28px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));overflow:clip;border-radius:9999px;-webkit-user-select:none;-moz-user-select:none;user-select:none}rtk-icon{height:50%;width:50%}.image-ctr{display:flex;height:100%;width:100%;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}img{height:var(--rtk-space-0, 0px);width:var(--rtk-space-0, 0px);-o-object-fit:cover;object-fit:cover}img.loaded{height:100%;width:100%}.initials{display:flex;height:100%;width:100%;align-items:center;justify-content:center;text-transform:uppercase}.image{display:flex;height:100%;width:100%;align-items:center;justify-content:center}.image img{display:none;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}.image img.loaded{display:block}:host([variant='hexagon']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)}:host([variant='square']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)}:host([size='sm']){height:var(--rtk-space-14, 56px);width:var(--rtk-space-14, 56px);font-size:12px}:host([size='md']){height:var(--rtk-space-28, 112px);width:var(--rtk-space-28, 112px)}:host([size='lg']){height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px)}";
21
+ const RtkAvatarStyle0 = rtkAvatarCss;
22
+
23
+ var __decorate$h = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
24
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
25
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
26
+ r = Reflect.decorate(decorators, target, key, desc);
27
+ else
28
+ for (var i = decorators.length - 1; i >= 0; i--)
29
+ if (d = decorators[i])
30
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
31
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
32
+ };
33
+ const RtkAvatar = class {
34
+ constructor(hostRef) {
35
+ index$1.registerInstance(this, hostRef);
36
+ /** Avatar type */
37
+ this.variant = 'circular';
38
+ /** Icon pack */
39
+ this.iconPack = uiStore.defaultIconPack;
40
+ /** Language */
41
+ this.t = uiStore.useLanguage();
42
+ this.imageState = 'loading';
43
+ this.getAvatar = () => {
44
+ var _a;
45
+ const name = string.formatName(((_a = this.participant) === null || _a === void 0 ? void 0 : _a.name) || '');
46
+ let picture;
47
+ if (this.participant != null && 'picture' in this.participant) {
48
+ picture = this.participant.picture;
49
+ }
50
+ if (picture && picture.length > 0 && this.imageState !== 'errored') {
51
+ return (index$1.h("div", { class: "image-ctr" }, this.imageState === 'loading' && index$1.h("rtk-spinner", { iconPack: this.iconPack }), index$1.h("img", { src: picture, class: { loaded: this.imageState === 'loaded' }, loading: "lazy", title: name, onLoad: () => (this.imageState = 'loaded'), onError: () => (this.imageState = 'errored'), part: "image" })));
52
+ }
53
+ const initials = string.getInitials(name);
54
+ return (index$1.h("div", { class: "initials", title: name, part: "initials" }, initials));
55
+ };
56
+ }
57
+ render() {
58
+ return (index$1.h(index$1.Host, { key: 'c1a0be37edb75c40b275ad59af85cee7df3f1cdf' }, this.getAvatar(), index$1.h("slot", { key: '1cd71e7494a09d68a52051edc279911dc3168515' })));
59
+ }
60
+ };
61
+ __decorate$h([
62
+ index.SyncWithStore()
63
+ ], RtkAvatar.prototype, "iconPack", void 0);
64
+ __decorate$h([
65
+ index.SyncWithStore()
66
+ ], RtkAvatar.prototype, "t", void 0);
67
+ RtkAvatar.style = RtkAvatarStyle0;
68
+
69
+ const rtkButtonCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--icon-size:var(--rtk-button-icon-size, var(--rtk-space-5, 20px));--transition-property:var(--rtk-transition-property, all);--transition-duration:100ms;display:inline-flex;height:var(--rtk-space-8, 32px);cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-sm, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration)}button{box-sizing:border-box;background-color:transparent;color:inherit;border:var(--rtk-border-width-sm, 1px) solid transparent;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);display:inline-flex;flex-grow:1;justify-content:center;vertical-align:baseline;gap:var(--rtk-space-1, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration);outline:none;height:inherit;border-radius:inherit;fill:inherit;cursor:inherit;font-weight:inherit;font-family:inherit;font-size:inherit;line-height:inherit}.start,.content,.end{align-self:center}::slotted(rtk-icon),::slotted(rtk-spinner){height:var(--icon-size);width:var(--icon-size)}:host([variant='primary']){color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}button:focus-visible{border-color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host(:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity))}:host([disabled]:not([disabled='false'])){cursor:not-allowed;opacity:0.6}:host([variant='secondary']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='secondary']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([variant='secondary']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host([variant='danger']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='danger']:hover){background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.7)}:host([variant='danger']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='ghost']){background-color:transparent;color:inherit}:host([variant='ghost'].active){--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}:host([variant='ghost']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='ghost']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([kind='icon']){--icon-size:var(--rtk-space-5, 20px);width:var(--rtk-space-8, 32px)}:host([kind='icon']) button{padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px)}:host([kind='wide']){width:100%}:host([size='lg']){--icon-size:var(--rtk-space-5, 20px);height:var(--rtk-space-10, 40px);font-size:16px}:host([size='lg'][kind='icon']){--icon-size:var(--rtk-space-6, 24px);height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px)}:host([size='sm']){--icon-size:var(--rtk-space-4, 16px);height:var(--rtk-space-6, 24px);font-size:12px}:host([size='sm'][kind='icon']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}";
70
+ const RtkButtonStyle0 = rtkButtonCss;
71
+
72
+ const RtkButton = class {
73
+ constructor(hostRef) {
74
+ index$1.registerInstance(this, hostRef);
75
+ /** Button variant */
76
+ this.variant = 'primary';
77
+ /** Button type */
78
+ this.kind = 'button';
79
+ /** Whether to reverse order of children */
80
+ this.reverse = false;
81
+ /** Where the button is disabled or not */
82
+ this.disabled = false;
83
+ /** Button type */
84
+ this.type = 'button';
85
+ }
86
+ render() {
87
+ return (index$1.h(index$1.Host, { key: '0f96cef4ae77a2be8013fa5d62d39626734eeced' }, index$1.h("button", { key: '8c06d5f5cc71779b8d56f31d2dd77b8d35e8b280', part: "button", type: this.type, disabled: this.disabled }, index$1.h("span", { key: 'ae741ddf8cc914f9493c26330b1f322541f64223', class: "start" }, index$1.h("slot", { key: '18275dab42a4dd38b5a59463ffca227e4a6df3c8', name: "start" })), index$1.h("span", { key: 'c2b912515b6edc2966c4cdb282c89022aa05c13f', class: "content", part: "content" }, index$1.h("slot", { key: '5d87993198e16a3b5f38e62979fa2ee5637a059d' })), index$1.h("span", { key: '0bc907da23ea362f8ae0b3fdf88452b1c3881078', class: "end" }, index$1.h("slot", { key: '0862eeefcfa5765ce605b99a04aab88222ed6e68', name: "end" })))));
88
+ }
89
+ static get delegatesFocus() { return true; }
90
+ };
91
+ RtkButton.style = RtkButtonStyle0;
92
+
93
+ const rtkChannelSelectorViewCss = ".scrollbar {\n /* For Firefox */\n scrollbar-width: thin;\n scrollbar-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent);\n}\n\n/* For WebKit */\n.scrollbar::-webkit-scrollbar {\n height: var(--rtk-space-1\\.5, 6px);\n width: var(--rtk-space-1\\.5, 6px);\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-background, transparent);\n}\n\n.scrollbar::-webkit-scrollbar-thumb {\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)));\n}\n\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n position: relative;\n z-index: 10;\n height: var(--rtk-space-12, 48px);\n min-height: 48px;\n}\n\n.dropdown-trigger {\n height: 100%;\n width: 100%;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n padding: var(--rtk-space-4, 16px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));\n font-size: 14px;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n cursor: pointer;\n position: absolute;\n z-index: 20;\n}\n\n.dropdown-trigger span {\n display: flex;\n flex: 1 1 0%;\n align-items: center;\n justify-content: space-between;\n}\n\n.dropdown-trigger rtk-icon {\n margin-left: var(--rtk-space-1, 4px);\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n flex-shrink: 0;\n}\n\n@container chatcontainer (height < 360px) {\n .dropdown-trigger {\n padding: var(--rtk-space-2, 8px);\n }\n .dropdown {\n top: var(--rtk-space-8, 32px) !important;\n }\n .search-container {\n padding-left: var(--rtk-space-0, 0px) !important;\n padding-right: var(--rtk-space-0, 0px) !important;\n padding-top: var(--rtk-space-0, 0px) !important;\n padding-bottom: var(--rtk-space-0, 0px) !important;\n }\n input {\n height: var(--rtk-space-8, 32px) !important;\n border-radius: var(--rtk-border-radius-none, 0) !important;\n }\n .channel {\n height: var(--rtk-space-8, 32px) !important;\n border-radius: var(--rtk-border-radius-sm, 4px) !important;\n }\n .avatar-icon {\n height: var(--rtk-space-3, 12px) !important;\n width: var(--rtk-space-3, 12px) !important;\n padding: var(--rtk-space-1, 4px) !important;\n }\n\n rtk-avatar {\n height: var(--rtk-space-5, 20px) !important;\n width: var(--rtk-space-5, 20px) !important;\n }\n}\n\n.dropdown {\n position: absolute;\n width: 100%;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));\n top: var(--rtk-space-12, 48px);\n z-index: 10;\n animation: 0.3s slide-down ease;\n}\n\n.dropdown .channels-container {\n max-height: var(--rtk-space-80, 320px);\n}\n\n.list {\n display: flex;\n flex-direction: column;\n}\n\n.list .channel .channel-data {\n align-items: flex-start;\n}\n\n.unread-count {\n display: flex;\n justify-content: center;\n height: var(--rtk-space-5, 20px);\n min-width: var(--rtk-space-3, 12px);\n border-radius: 9999px;\n padding-left: var(--rtk-space-1, 4px);\n padding-right: var(--rtk-space-1, 4px);\n font-size: 12px;\n line-height: 1.25rem;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\ninput {\n height: var(--rtk-space-9, 36px);\n width: 100%;\n padding-left: var(--rtk-space-3, 12px);\n padding-right: var(--rtk-space-3, 12px);\n box-sizing: border-box;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n outline: 2px solid transparent;\n outline-offset: 2px;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.search-container {\n display: flex;\n flex-shrink: 0;\n flex-grow: 0;\n flex-basis: auto;\n align-items: center;\n padding-top: var(--rtk-space-3, 12px);\n padding-bottom: var(--rtk-space-3, 12px);\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-2, 8px);\n border-bottom: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.search-container rtk-icon {\n margin-left: calc(var(--rtk-space-8, 32px) * -1);\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n color: rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76));\n}\n\n.channels-container {\n display: flex;\n flex-direction: column;\n gap: var(--rtk-space-1, 4px);\n padding: var(--rtk-space-2, 8px);\n flex: 1 1 auto;\n overflow-y: auto;\n}\n\n.channel {\n flex-shrink: 0;\n box-sizing: border-box;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n background-color: transparent;\n outline: 2px solid transparent;\n outline-offset: 2px;\n cursor: pointer;\n border-radius: var(--rtk-border-radius-md, 8px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--rtk-space-2, 8px);\n height: var(--rtk-space-16, 64px);\n width: 100%;\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.channel:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n}\n\n.channel .channel-data {\n flex: 1 1 0%;\n align-items: center;\n justify-content: space-between;\n display: flex;\n gap: var(--rtk-space-2, 8px);\n}\n\n.channel .name {\n font-size: 16px;\n}\n\n.channel .name, \n .channel .last-message {\n max-width: var(--rtk-space-40, 160px);\n text-align: left;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n}\n\n.channel .no-message {\n font-style: italic;\n}\n\n.channel rtk-avatar {\n height: var(--rtk-space-12, 48px);\n width: var(--rtk-space-12, 48px);\n overflow: clip;\n border-radius: 9999px;\n font-size: 14px;\n}\n\n.channel .avatar-icon {\n height: var(--rtk-space-6, 24px);\n width: var(--rtk-space-6, 24px);\n padding: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n overflow: clip;\n border-radius: 9999px;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n.channel time, \n .channel .last-message {\n font-size: 12px;\n color: rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76));\n}\n\n.channel.active {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\n.channel.active .unread-count {\n background-color: rgb(var(--rtk-colors-text-on-brand-800, var(--rtk-colors-text-800, 255 255 255 / 0.76)));\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));\n}\n\n.channel.active time {\n color: rgb(var(--rtk-colors-text-on-brand-800, var(--rtk-colors-text-800, 255 255 255 / 0.76)));\n}\n\n.channel.active .last-message {\n color: rgb(var(--rtk-colors-text-on-brand-700, var(--rtk-colors-text-700, 255 255 255 / 0.64)));\n}\n\n.channel.active rtk-avatar {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));\n}\n\n.col {\n gap: var(--rtk-space-1, 4px);\n display: flex;\n flex-direction: column;\n}\n\n.channel-meta {\n flex-shrink: 0;\n align-items: flex-end;\n}\n\n@keyframes slide-down {\n from {\n transform: translateY(-50px);\n }\n to {\n transform: translateY(0%);\n }\n}\n";
94
+ const RtkChannelSelectorViewStyle0 = rtkChannelSelectorViewCss;
95
+
96
+ var __decorate$g = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
97
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
98
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
99
+ r = Reflect.decorate(decorators, target, key, desc);
100
+ else
101
+ for (var i = decorators.length - 1; i >= 0; i--)
102
+ if (d = decorators[i])
103
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
104
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
105
+ };
106
+ const RtkChannelSelectorView = class {
107
+ constructor(hostRef) {
108
+ index$1.registerInstance(this, hostRef);
109
+ this.channelChange = index$1.createEvent(this, "channelChange", 7);
110
+ /** Disables search bar (default = false) */
111
+ this.disableSearch = false;
112
+ /** Hides avatar (default = false) */
113
+ this.hideAvatar = false;
114
+ /** Icon Pack */
115
+ this.iconPack = uiStore.defaultIconPack;
116
+ /** Language */
117
+ this.t = uiStore.useLanguage();
118
+ /** Render as dropdown or list (default = list) */
119
+ this.viewAs = 'list';
120
+ this.searchQuery = '';
121
+ this.showDropdown = false;
122
+ this.calculateListHeight = debounce.debounce(() => {
123
+ if (this.viewAs === 'list' && this.$listEl) {
124
+ let height = 0;
125
+ const slotEl = this.$el.shadowRoot.querySelector('slot[name="header"]');
126
+ if (slotEl) {
127
+ slotEl.assignedElements().forEach((e) => (height += e.offsetHeight));
128
+ }
129
+ if (this.$searchEl) {
130
+ height += this.$searchEl.offsetHeight;
131
+ }
132
+ this.$listEl.style.height = `${window.innerHeight - height - 16}px`;
133
+ }
134
+ }, 60);
135
+ this.getFilteredChannels = () => {
136
+ if (this.searchQuery.trim() === '') {
137
+ return this.channels;
138
+ }
139
+ return this.channels.filter((channel) => {
140
+ return channel['name'].toLowerCase().includes(this.searchQuery.toLowerCase());
141
+ });
142
+ };
143
+ this.toggleDropdown = () => {
144
+ this.showDropdown = !this.showDropdown;
145
+ };
146
+ this.getChannelById = (id) => {
147
+ return this.channels.find((channel) => channel.id === id);
148
+ };
149
+ this.getTotalUnreads = () => {
150
+ return this.channels.reduce((acc, curr) => {
151
+ return acc + curr.unreadCount;
152
+ }, 0);
153
+ };
154
+ this.onChannelClickHandler = (channel) => {
155
+ this.channelChange.emit(channel);
156
+ if (this.viewAs === 'dropdown') {
157
+ this.showDropdown = false;
158
+ }
159
+ };
160
+ }
161
+ connectedCallback() {
162
+ this.resizeObserver = new ResizeObserver(this.calculateListHeight);
163
+ }
164
+ componentDidLoad() {
165
+ this.resizeObserver.observe(this.$el);
166
+ this.calculateListHeight();
167
+ }
168
+ disconnectedCallback() {
169
+ var _a;
170
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
171
+ this.calculateListHeight.cancel();
172
+ }
173
+ getTimeLabel(messageDate) {
174
+ const today = new Date();
175
+ const yesterday = new Date(today);
176
+ yesterday.setDate(today.getDate() - 1);
177
+ const firstDayOfWeek = new Date(today);
178
+ firstDayOfWeek.setDate(today.getDate() - today.getDay() - 1);
179
+ if (messageDate.toDateString() === today.toDateString()) {
180
+ return messageDate.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
181
+ }
182
+ else if (messageDate.toDateString() === yesterday.toDateString()) {
183
+ return this.t('date.yesteday');
184
+ }
185
+ else if (messageDate > firstDayOfWeek) {
186
+ const weekdays = [
187
+ 'date.sunday',
188
+ 'date.monday',
189
+ 'date.tuesday',
190
+ 'date.wednesday',
191
+ 'date.thursday',
192
+ 'date.friday',
193
+ 'date.saturday',
194
+ ];
195
+ return this.t(weekdays[messageDate.getDay()]);
196
+ }
197
+ else {
198
+ return Intl.DateTimeFormat([], {
199
+ day: '2-digit',
200
+ month: '2-digit',
201
+ year: '2-digit',
202
+ }).format(messageDate);
203
+ }
204
+ }
205
+ render() {
206
+ const filteredChannels = this.getFilteredChannels();
207
+ const shouldShowDropdown = this.viewAs === 'list' || (this.viewAs === 'dropdown' && this.showDropdown);
208
+ return (index$1.h(index$1.Host, { key: 'adc8ab4b9c8c865998588fbd9766296f18b3e48e' }, this.viewAs === 'list' && index$1.h("slot", { key: 'e5740725a4349472ca2eb1fb0816eb2311a99838', name: "header" }), shouldShowDropdown && (index$1.h("div", { key: '425adc920c28e0421e07bb0bd9f61b31c42fcda9', class: {
209
+ dropdown: this.viewAs === 'dropdown',
210
+ scrollbar: this.viewAs === 'dropdown',
211
+ list: this.viewAs === 'list',
212
+ } }, !this.disableSearch && (index$1.h("div", { key: '9fbbc48d8489f2a6490729fac1fecdef1838e84a', class: "search-container", ref: (el) => (this.$searchEl = el) }, index$1.h("input", { key: 'f7fb43662d50274f80380b735ef9f5fc0b215442', type: "text", placeholder: this.t('chat.search_conversations'), value: this.searchQuery, onInput: (e) => (this.searchQuery = e.target.value) }), index$1.h("rtk-icon", { key: 'af76e65a1397d2a6e557a28b687e26aef641c568', icon: this.iconPack.search }))), index$1.h("div", { key: '0711a9cfcc811269a5020dc41030c0daee5cc8bf', class: "channels-container scrollbar", ref: (el) => (this.$listEl = el) }, filteredChannels.map((channel) => {
213
+ return (index$1.h("button", { class: { channel: true, active: this.selectedChannelId === channel.id }, onClick: () => this.onChannelClickHandler(channel) }, !this.hideAvatar && (index$1.h("div", null, channel.icon ? (index$1.h("rtk-icon", { class: "avatar-icon", icon: this.iconPack[channel.icon] })) : (index$1.h("rtk-avatar", { participant: {
214
+ name: channel.name,
215
+ picture: channel.avatarUrl,
216
+ } })))), index$1.h("div", { class: "channel-data" }, index$1.h("div", { class: "col" }, index$1.h("div", { class: "name" }, channel.name), channel.latestMessage && (index$1.h("div", { class: {
217
+ 'last-message': true,
218
+ 'no-message': !channel.latestMessage,
219
+ } }, index$1.h("rtk-text-message-view", { isMarkdown: true, text: channel.latestMessage })))), index$1.h("div", { class: "col channel-meta" }, channel.latestMessageTime && (index$1.h("time", { class: "time" }, this.getTimeLabel(channel.latestMessageTime))), channel.unreadCount > 0 && (index$1.h("div", { class: "unread-count" }, channel.unreadCount))))));
220
+ })))), this.viewAs === 'dropdown' && (index$1.h("button", { key: '0c87f90d6d0fe22284995ab7259689f80a862829', class: "dropdown-trigger", onClick: this.toggleDropdown }, index$1.h("span", { key: 'd1a364f2c5c57d19702d0b8707ca661c1dc4c14f' }, this.selectedChannelId &&
221
+ `${this.t('to')} ${this.getChannelById(this.selectedChannelId).name}`, this.getTotalUnreads() > 0 && (index$1.h("div", { key: 'bf789f9df82851825bc6ea12a19a5f37ab74aefe', class: "unread-count" }, this.getTotalUnreads()))), index$1.h("rtk-icon", { key: 'c0d03f883f4c46b2698be0f197751fc0470717ea', icon: this.showDropdown ? this.iconPack.chevron_up : this.iconPack.chevron_down })))));
222
+ }
223
+ get $el() { return index$1.getElement(this); }
224
+ };
225
+ __decorate$g([
226
+ index.SyncWithStore()
227
+ ], RtkChannelSelectorView.prototype, "iconPack", void 0);
228
+ __decorate$g([
229
+ index.SyncWithStore()
230
+ ], RtkChannelSelectorView.prototype, "t", void 0);
231
+ RtkChannelSelectorView.style = RtkChannelSelectorViewStyle0;
232
+
233
+ const rtkChatCss = ":host {\n line-height: initial;\n font-family: var(--rtk-font-family, sans-serif);\n\n font-feature-settings: normal;\n font-variation-settings: normal;\n}\n\np {\n margin: var(--rtk-space-0, 0px);\n padding: var(--rtk-space-0, 0px);\n}\n\n.scrollbar {\n /* For Firefox */\n scrollbar-width: thin;\n scrollbar-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent);\n}\n\n/* For WebKit */\n.scrollbar::-webkit-scrollbar {\n height: var(--rtk-space-1\\.5, 6px);\n width: var(--rtk-space-1\\.5, 6px);\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-background, transparent);\n}\n\n.scrollbar::-webkit-scrollbar-thumb {\n border-radius: 9999px;\n background-color: var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)));\n}\n\n\n:host {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: column;\n font-size: 14px;\n position: relative;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\nh3 {\n margin: var(--rtk-space-0, 0px);\n display: flex;\n height: var(--rtk-space-12, 48px);\n align-items: center;\n justify-content: center;\n font-size: 16px;\n font-weight: 400;\n color: rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));\n text-align: center;\n}\n\n#dropzone {\n position: absolute;\n top: var(--rtk-space-0, 0px);\n right: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n z-index: 10;\n display: none;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));\n}\n\n#dropzone.active {\n display: flex;\n animation: 0.2s slide-up ease-in;\n}\n\nrtk-chat-messages-ui,\nrtk-chat-messages-ui-paginated {\n flex: 1 0 0;\n}\n\nrtk-chat-composer-view {\n margin: var(--rtk-space-2, 8px);\n}\n\n.chat-container {\n display: flex;\n height: 100%;\n width: 100%;\n flex-direction: row;\n container-type: size;\n container-name: chatcontainer;\n}\n\n@container chatcontainer (height < 360px) {\n rtk-channel-selector-view {\n height: var(--rtk-space-8, 32px);\n min-height: 24px;\n }\n}\n\n.chat {\n display: flex;\n flex: 1 1 0%;\n flex-direction: column;\n}\n\n.banner {\n height: 100%;\n width: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n}\n\n.banner .welcome-new-channel {\n width: var(--rtk-space-48, 192px);\n}\n\n.banner .create-channel-illustration {\n height: var(--rtk-space-40, 160px);\n width: var(--rtk-space-40, 160px);\n}\n\n.channel-selector-header {\n box-sizing: border-box;\n height: var(--rtk-space-16, 64px);\n padding: var(--rtk-space-4, 16px);\n display: flex;\n justify-content: space-between;\n border-bottom: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-700, 44 44 44));\n}\n\n.channel-selector-header .channel-create-btn {\n width: var(--rtk-space-8, 32px);\n justify-content: center;\n}\n\n.channel-selector-header .channel-create-btn:hover {\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));\n}\n\n.view-chats-btn {\n margin-top: var(--rtk-space-4, 16px);\n}\n\n.selector-container {\n z-index: 50;\n width: 100%;\n max-width: var(--rtk-space-80, 320px);\n border-right: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.selector-container.hide {\n display: none;\n}\n\n.mobile-close-btn {\n display: none;\n}\n\n.selector-container.mobile {\n height: 100%;\n width: 100%;\n max-width: 100%;\n position: absolute;\n top: var(--rtk-space-0, 0px);\n right: var(--rtk-space-0, 0px);\n bottom: var(--rtk-space-0, 0px);\n left: var(--rtk-space-0, 0px);\n background-color: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0.6);\n display: flex;\n}\n\n.selector-container.mobile rtk-channel-selector-view {\n max-width: var(--rtk-space-96, 384px);\n animation: 0.3s swipe-in;\n}\n\n.selector-container.mobile .mobile-close-btn {\n margin-top: var(--rtk-space-4, 16px);\n margin-bottom: var(--rtk-space-4, 16px);\n margin-left: var(--rtk-space-6, 24px);\n margin-right: var(--rtk-space-6, 24px);\n display: block;\n}\n\n.pinned-messages-header {\n display: flex;\n align-items: center;\n gap: var(--rtk-space-2, 8px);\n padding: var(--rtk-space-2, 8px);\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n font-size: 12px;\n cursor: pointer;\n}\n\n.pinned-messages-header rtk-icon {\n height: var(--rtk-space-3, 12px);\n width: var(--rtk-space-3, 12px);\n}\n\n.pinned-messages-header:hover {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n.pinned-messages-header.active {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));\n}\n\n@keyframes swipe-in {\n from {\n transform: translateX(-100%);\n }\n to {\n transform: translateX(0);\n }\n}\n";
234
+ const RtkChatStyle0 = rtkChatCss;
235
+
236
+ var __decorate$f = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
237
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
238
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
239
+ r = Reflect.decorate(decorators, target, key, desc);
240
+ else
241
+ for (var i = decorators.length - 1; i >= 0; i--)
242
+ if (d = decorators[i])
243
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
244
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
245
+ };
246
+ const RtkChat = class {
247
+ constructor(hostRef) {
248
+ index$1.registerInstance(this, hostRef);
249
+ this.stateUpdate = index$1.createEvent(this, "rtkStateUpdate", 7);
250
+ this.chatUpdateListener = ({ message }) => {
251
+ if (message.channelId)
252
+ return;
253
+ if (!this.displayFilter || this.displayFilter(message)) {
254
+ this.addToChatGroup(message);
255
+ // shallow copy to trigger render
256
+ this.chatGroups = Object.assign({}, this.chatGroups);
257
+ }
258
+ };
259
+ this.chatPermissionUpdateListener = () => {
260
+ this.canSend = this.meeting.self.permissions.chatPublic.canSend;
261
+ this.canSendTextMessage = this.meeting.self.permissions.chatPublic.text;
262
+ this.canSendFiles = this.meeting.self.permissions.chatPublic.files;
263
+ };
264
+ /** Config */
265
+ this.config = uiStore.createDefaultConfig();
266
+ /** Icon pack */
267
+ this.iconPack = uiStore.defaultIconPack;
268
+ /** Language */
269
+ this.t = uiStore.useLanguage();
270
+ /** disables private chat */
271
+ this.disablePrivateChat = false;
272
+ /** Can current user pin/unpin messages */
273
+ this.canPinMessages = false;
274
+ /**
275
+ * @deprecated
276
+ * Beta API, will change in future
277
+ * List of target presets allowed as private chat recipient
278
+ */
279
+ this.privatePresetFilter = [];
280
+ /**
281
+ * @deprecated
282
+ * Beta API, will change in future
283
+ * A filter function for messages to be displayed
284
+ */
285
+ this.displayFilter = undefined;
286
+ this.unreadCountGroups = {};
287
+ this.chatGroups = { everyone: [] };
288
+ this.selectedGroup = 'everyone';
289
+ this.now = new Date();
290
+ this.dropzoneActivated = false;
291
+ this.showLatestMessageButton = false;
292
+ this.canSend = false;
293
+ this.canSendTextMessage = false;
294
+ this.canSendFiles = false;
295
+ this.canPrivateMessage = false;
296
+ this.canSendPrivateTexts = false;
297
+ this.canSendPrivateFiles = false;
298
+ this.emojiPickerEnabled = false;
299
+ this.chatRecipientId = 'everyone';
300
+ this.participants = [];
301
+ this.channels = [];
302
+ this.editingMessage = null;
303
+ this.replyMessage = null;
304
+ this.searchQuery = '';
305
+ this.selectorState = 'hide';
306
+ this.creatingChannel = false;
307
+ this.showPinnedMessages = false;
308
+ this.channelMap = new Map();
309
+ this.onDragOver = (e) => {
310
+ e.preventDefault();
311
+ this.dropzoneActivated = true;
312
+ };
313
+ this.onDragLeave = () => {
314
+ this.dropzoneActivated = false;
315
+ };
316
+ this.onDrop = (e) => {
317
+ e.preventDefault();
318
+ this.dropzoneActivated = false;
319
+ chat.handleFilesDataTransfer(e.dataTransfer.items, (type, file) => {
320
+ var _a, _b, _c, _d;
321
+ switch (type) {
322
+ case 'image':
323
+ if (this.isFileMessagingAllowed()) {
324
+ (_b = (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.chat) === null || _b === void 0 ? void 0 : _b.sendImageMessage(file, this.getRecipientPeerIds());
325
+ }
326
+ break;
327
+ case 'file':
328
+ if (this.isFileMessagingAllowed()) {
329
+ (_d = (_c = this.meeting) === null || _c === void 0 ? void 0 : _c.chat) === null || _d === void 0 ? void 0 : _d.sendFileMessage(file, this.getRecipientPeerIds());
330
+ }
331
+ break;
332
+ }
333
+ });
334
+ };
335
+ this.disconnectMeeting = (meeting) => {
336
+ var _a, _b, _c, _d, _e, _f;
337
+ if (this.isPrivateChatSupported()) {
338
+ meeting === null || meeting === void 0 ? void 0 : meeting.participants.joined.removeListener('participantJoined', this.onParticipantUpdate);
339
+ meeting === null || meeting === void 0 ? void 0 : meeting.participants.joined.removeListener('participantLeft', this.onParticipantUpdate);
340
+ }
341
+ (_a = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _a === void 0 ? void 0 : _a.removeListener('chatUpdate', this.chatUpdateListener);
342
+ (_b = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _b === void 0 ? void 0 : _b.removeListener('channelCreate', this.onChannelCreateOrUpdate);
343
+ (_c = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _c === void 0 ? void 0 : _c.removeListener('channelUpdate', this.onChannelCreateOrUpdate);
344
+ (_d = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _d === void 0 ? void 0 : _d.removeListener('channelMessageUpdate', this.onChannelCreateOrUpdate);
345
+ (_f = (_e = meeting === null || meeting === void 0 ? void 0 : meeting.participants) === null || _e === void 0 ? void 0 : _e.all) === null || _f === void 0 ? void 0 : _f.removeListener('participantsUpdate', this.onChannelCreateOrUpdate);
346
+ meeting.self.permissions.removeListener('*', this.chatPermissionUpdateListener);
347
+ };
348
+ this.getFilteredParticipants = () => {
349
+ if (this.privatePresetFilter.length === 0)
350
+ return this.participants;
351
+ return this.participants.filter((p) => this.privatePresetFilter.includes(p.presetName));
352
+ };
353
+ this.onParticipantUpdate = () => {
354
+ this.participants = this.meeting.participants.joined
355
+ .toArray()
356
+ .filter((p) => this.privatePresetFilter.length === 0 || this.privatePresetFilter.includes(p.presetName));
357
+ // if selected participant leaves, reset state to everyone
358
+ if (this.selectedParticipant && !this.participants.includes(this.selectedParticipant)) {
359
+ this.selectedParticipant = null;
360
+ this.chatRecipientId = this.selectedGroup = 'everyone';
361
+ }
362
+ };
363
+ this.updateUnreadCountGroups = (obj) => {
364
+ this.unreadCountGroups = Object.assign(Object.assign({}, this.unreadCountGroups), obj);
365
+ };
366
+ this.isPrivateChatSupported = () => {
367
+ return this.canPrivateMessage && !this.disablePrivateChat;
368
+ };
369
+ this.updateRecipients = (event) => {
370
+ const { id } = event.detail;
371
+ this.chatRecipientId = id;
372
+ this.selectedParticipant = this.participants.find((p) => p.userId === id);
373
+ if (this.chatRecipientId !== 'everyone') {
374
+ const allParticipants = [this.chatRecipientId, this.meeting.self.userId];
375
+ const targetKey = chat.generateChatGroupKey(allParticipants);
376
+ this.selectedGroup = targetKey;
377
+ }
378
+ else {
379
+ this.selectedGroup = 'everyone';
380
+ }
381
+ this.updateUnreadCountGroups({ [this.selectedGroup]: 0 });
382
+ };
383
+ this.isTextMessagingAllowed = () => {
384
+ if (this.chatRecipientId === 'everyone') {
385
+ // public chat
386
+ return this.canSend && this.canSendTextMessage;
387
+ }
388
+ // private chat
389
+ return this.canPrivateMessage && this.canSendPrivateTexts;
390
+ };
391
+ this.isFileMessagingAllowed = () => {
392
+ if (this.chatRecipientId === 'everyone') {
393
+ // public chat
394
+ return this.canSend && this.canSendFiles;
395
+ }
396
+ // private chat
397
+ return this.canPrivateMessage && this.canSendPrivateFiles;
398
+ };
399
+ this.onChannelChanged = (e) => {
400
+ const channel = e.detail;
401
+ if (channel.id.includes(chat.TEMPORARY_CHANNEL_PREFIX)) {
402
+ this.createDMChannel(channel.id.replace(chat.TEMPORARY_CHANNEL_PREFIX, ''));
403
+ }
404
+ else {
405
+ this.selectedChannelId = channel.id;
406
+ }
407
+ this.cleanup();
408
+ if (this.selectorState !== 'desktop') {
409
+ this.selectorState = 'hide';
410
+ }
411
+ };
412
+ this.createDMChannel = async (memberId) => {
413
+ this.creatingChannel = true;
414
+ const newChannel = await this.meeting.chat.createChannel('Direct Message', [memberId], {
415
+ visibility: 'private',
416
+ isDirectMessage: true,
417
+ });
418
+ this.creatingChannel = false;
419
+ this.selectedChannelId = newChannel.id;
420
+ };
421
+ this.cleanup = () => {
422
+ this.editingMessage = null;
423
+ this.replyMessage = null;
424
+ this.searchQuery = '';
425
+ };
426
+ this.onQuotedMessageDismiss = () => {
427
+ this.replyMessage = null;
428
+ };
429
+ this.onChannelCreateOrUpdate = (channel) => {
430
+ if (channel) {
431
+ this.channelMap.set(channel.id, channel);
432
+ }
433
+ else {
434
+ this.meeting.chat.channels.forEach((chan) => this.channelMap.set(chan.id, chan));
435
+ }
436
+ const allChannels = Array.from(this.channelMap.values());
437
+ const channels = allChannels
438
+ .filter((channel) => !chat.isDirectMessageChannel(channel))
439
+ .sort((a, b) => chat.alphabeticalSorter(a.displayName, b.displayName));
440
+ const membersWithChannel = allChannels.filter(chat.isDirectMessageChannel).map((channel) => {
441
+ return Object.assign(Object.assign({}, channel), { displayName: this.getMemberDisplayName(channel) });
442
+ });
443
+ const membersWithoutChannel = this.meeting.participants.all
444
+ .toArray()
445
+ .filter((member) => {
446
+ if (member.userId === this.meeting.self.userId)
447
+ return false;
448
+ const matcher = chat.getDMComparator([this.meeting.self.userId, member.userId]);
449
+ return membersWithChannel.every((channel) => chat.getDMComparator(channel.memberIds) !== matcher);
450
+ })
451
+ .map((member) => {
452
+ return {
453
+ id: `${chat.TEMPORARY_CHANNEL_PREFIX}${member.userId}`,
454
+ displayName: member.name,
455
+ displayPictureUrl: member.picture,
456
+ isDirectMessage: true,
457
+ unreadCount: 0,
458
+ };
459
+ });
460
+ const dms = [...membersWithChannel, ...membersWithoutChannel].sort((a, b) => chat.alphabeticalSorter(a.displayName, b.displayName));
461
+ this.channels = [...channels, ...dms];
462
+ // select channel only if it is created in db
463
+ const nonTemporaryChannel = [...channels, ...membersWithChannel];
464
+ if (!this.selectedChannelId && nonTemporaryChannel.length !== 0) {
465
+ this.selectedChannelId = nonTemporaryChannel[0].id;
466
+ }
467
+ };
468
+ this.getMemberDisplayName = (channel) => {
469
+ var _a;
470
+ let id;
471
+ if (channel.memberIds.length === 1) {
472
+ // channel with self
473
+ id = channel.memberIds[0];
474
+ }
475
+ else {
476
+ id =
477
+ channel.memberIds[0] === this.meeting.self.userId
478
+ ? channel.memberIds[1]
479
+ : channel.memberIds[0];
480
+ }
481
+ const member = this.meeting.participants.all.toArray().find((member) => member.userId === id);
482
+ return (_a = member === null || member === void 0 ? void 0 : member.name) !== null && _a !== void 0 ? _a : id;
483
+ };
484
+ this.onNewMessageHandler = async (e) => {
485
+ const message = e.detail;
486
+ this.meeting.chat.sendMessage(message, this.getRecipientPeerIds());
487
+ };
488
+ this.onEditMessageHandler = async (e) => {
489
+ var _a, _b;
490
+ await ((_b = (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.chat) === null || _b === void 0 ? void 0 : _b.editTextMessage(this.editingMessage.id, e.detail, this.editingMessage.channelId));
491
+ this.editingMessage = null;
492
+ };
493
+ this.onEditCancel = () => {
494
+ this.editingMessage = null;
495
+ };
496
+ this.onPinMessage = (event) => {
497
+ const message = event.detail;
498
+ if (message.pinned) {
499
+ this.meeting.chat.unpin(message.id);
500
+ }
501
+ else {
502
+ this.meeting.chat.pin(message.id);
503
+ }
504
+ };
505
+ this.onDeleteMessage = (event) => {
506
+ const message = event.detail;
507
+ this.meeting.chat.deleteMessage(message.id);
508
+ };
509
+ this.getPrivateChatRecipients = () => {
510
+ const participants = this.getFilteredParticipants().map((participant) => {
511
+ const key = chat.generateChatGroupKey([participant.userId, this.meeting.self.userId]);
512
+ const result = {
513
+ id: participant.userId,
514
+ name: participant.name,
515
+ avatarUrl: participant.picture,
516
+ unreadCount: this.unreadCountGroups[key],
517
+ };
518
+ return result;
519
+ });
520
+ const everyone = {
521
+ id: 'everyone',
522
+ name: this.t('chat.everyone'),
523
+ icon: 'participants',
524
+ unreadCount: this.unreadCountGroups['everyone'],
525
+ };
526
+ return [everyone, ...participants];
527
+ };
528
+ this.onTogglePinnedMessages = () => {
529
+ this.showPinnedMessages = !this.showPinnedMessages;
530
+ };
531
+ this.renderPinnedMessagesHeader = () => {
532
+ if (this.meeting.chat.pinned.length === 0)
533
+ return null;
534
+ return (index$1.h("rtk-tooltip", { label: this.t('chat.toggle_pinned_msgs') }, index$1.h("div", { class: { 'pinned-messages-header': true, active: this.showPinnedMessages }, onClick: this.onTogglePinnedMessages }, index$1.h("rtk-icon", { icon: this.iconPack.pin }), this.t('chat.pinned_msgs'), ` (${this.meeting.chat.pinned.length})`)));
535
+ };
536
+ }
537
+ connectedCallback() {
538
+ if (!this.meeting)
539
+ return;
540
+ this.meetingChanged(this.meeting);
541
+ if (this.meeting && !this.meeting.chat) {
542
+ return;
543
+ }
544
+ if (this.isFileMessagingAllowed()) {
545
+ this.host.addEventListener('dragover', this.onDragOver);
546
+ this.host.addEventListener('dragleave', this.onDragLeave);
547
+ this.host.addEventListener('drop', this.onDrop);
548
+ }
549
+ }
550
+ onEditMessageInit(event) {
551
+ if (event.detail.flags.isReply) {
552
+ this.replyMessage = event.detail.payload;
553
+ }
554
+ else if (event.detail.flags.isEdit) {
555
+ this.editingMessage = event.detail.payload;
556
+ }
557
+ }
558
+ disconnectedCallback() {
559
+ var _a;
560
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
561
+ this.disconnectMeeting(this.meeting);
562
+ this.host.removeEventListener('dragover', this.onDragOver);
563
+ this.host.removeEventListener('dragleave', this.onDragLeave);
564
+ this.host.removeEventListener('drop', this.onDrop);
565
+ }
566
+ meetingChanged(meeting, oldMeeting) {
567
+ var _a, _b, _c, _d, _e, _f;
568
+ if (oldMeeting != undefined)
569
+ this.disconnectMeeting(oldMeeting);
570
+ if (meeting && !meeting.chat)
571
+ return;
572
+ if (meeting != null) {
573
+ this.canSend = meeting.self.permissions.chatPublic.canSend;
574
+ this.canSendTextMessage = meeting.self.permissions.chatPublic.text;
575
+ this.canSendFiles = meeting.self.permissions.chatPublic.files;
576
+ this.canPrivateMessage = !!(((_a = meeting.self.permissions.chatPrivate) === null || _a === void 0 ? void 0 : _a.canSend) ||
577
+ ((_b = meeting.self.permissions.chatPrivate) === null || _b === void 0 ? void 0 : _b.canReceive));
578
+ this.canSendPrivateTexts = !!((_c = meeting.self.permissions.chatPrivate) === null || _c === void 0 ? void 0 : _c.text);
579
+ this.canSendPrivateFiles = !!((_d = meeting.self.permissions.chatPrivate) === null || _d === void 0 ? void 0 : _d.files);
580
+ this.canPinMessages =
581
+ ((_e = meeting === null || meeting === void 0 ? void 0 : meeting.__internals__) === null || _e === void 0 ? void 0 : _e.features.hasFeature(uiStore.FlagsmithFeatureFlags.PINNED_MESSAGES)) &&
582
+ meeting.self.permissions.pinParticipant;
583
+ this.initializeChatGroups();
584
+ // shallow copy to trigger render
585
+ this.chatGroups = Object.assign({}, this.chatGroups);
586
+ meeting.self.permissions.on('*', this.chatPermissionUpdateListener);
587
+ this.onParticipantUpdate();
588
+ (_f = meeting.chat) === null || _f === void 0 ? void 0 : _f.addListener('chatUpdate', this.chatUpdateListener);
589
+ if (this.isPrivateChatSupported()) {
590
+ meeting.participants.joined.addListener('participantJoined', this.onParticipantUpdate);
591
+ meeting.participants.joined.addListener('participantLeft', this.onParticipantUpdate);
592
+ }
593
+ }
594
+ }
595
+ chatGroupsChanged(chatGroups) {
596
+ var _a, _b;
597
+ if (!this.isPrivateChatSupported()) {
598
+ return;
599
+ }
600
+ const unreadCounts = {};
601
+ for (const key in chatGroups) {
602
+ const lastReadTimestamp = (_a = uiStore.chatUnreadTimestamps[key]) !== null && _a !== void 0 ? _a : 0;
603
+ unreadCounts[key] = chatGroups[key].filter((c) => c.type == 'chat' &&
604
+ c.message.time > lastReadTimestamp &&
605
+ c.message.userId !== this.meeting.self.userId).length;
606
+ if (key ===
607
+ chat.generateChatGroupKey([this.meeting.self.userId, (_b = this.selectedParticipant) === null || _b === void 0 ? void 0 : _b.userId]) ||
608
+ (key === 'everyone' && this.selectedParticipant === null)) {
609
+ unreadCounts[key] = 0;
610
+ uiStore.chatUnreadTimestamps[key] = new Date();
611
+ }
612
+ }
613
+ this.updateUnreadCountGroups(unreadCounts);
614
+ }
615
+ initializeChatGroups() {
616
+ var _a;
617
+ (_a = this.meeting.chat) === null || _a === void 0 ? void 0 : _a.messages.forEach((message) => {
618
+ if (!this.displayFilter || this.displayFilter(message)) {
619
+ this.addToChatGroup(message);
620
+ }
621
+ });
622
+ }
623
+ onDisplayFilterChanged(newFilter, oldFilter) {
624
+ if (newFilter !== oldFilter) {
625
+ this.chatGroups = {};
626
+ this.initializeChatGroups();
627
+ }
628
+ }
629
+ addToChatGroup(message) {
630
+ var _a;
631
+ const parsedMessage = chat.parseMessageForTarget(message);
632
+ let key = 'everyone';
633
+ if (((_a = parsedMessage.targetUserIds) === null || _a === void 0 ? void 0 : _a.length) > 0) {
634
+ const allParticipants = new Set([
635
+ parsedMessage.userId,
636
+ ...parsedMessage.targetUserIds,
637
+ ]);
638
+ key = chat.generateChatGroupKey(Array.from(allParticipants));
639
+ }
640
+ if (this.chatGroups[key] === undefined)
641
+ this.chatGroups[key] = [];
642
+ let isEditedMessage = false;
643
+ let messages = [];
644
+ this.chatGroups[key].forEach((chat) => {
645
+ if (chat.type === 'chat' && chat.message.id === message.id) {
646
+ isEditedMessage = true;
647
+ messages.push({ type: 'chat', message: parsedMessage });
648
+ }
649
+ else {
650
+ messages.push(chat);
651
+ }
652
+ });
653
+ if (!isEditedMessage) {
654
+ messages.push({ type: 'chat', message: parsedMessage });
655
+ }
656
+ this.chatGroups[key] = messages;
657
+ }
658
+ getRecipientPeerIds() {
659
+ let peerIds = [];
660
+ if (this.chatRecipientId !== 'everyone') {
661
+ peerIds = [this.selectedParticipant.id];
662
+ }
663
+ return peerIds;
664
+ }
665
+ channelSwitchListener(e) {
666
+ this.onChannelChanged(e);
667
+ }
668
+ renderComposerUI() {
669
+ var _a, _b, _c;
670
+ if (this.chatRecipientId === 'everyone') {
671
+ if (!this.canSendTextMessage && !this.canSendFiles)
672
+ return null;
673
+ }
674
+ else {
675
+ if (!this.canSendPrivateTexts && !this.canSendPrivateFiles)
676
+ return null;
677
+ }
678
+ const uiProps = { iconPack: this.iconPack, t: this.t, size: this.size };
679
+ const message = this.editingMessage ? this.editingMessage.message : '';
680
+ const quotedMessage = this.replyMessage ? this.replyMessage.message : '';
681
+ return (index$1.h("rtk-chat-composer-view", Object.assign({ message: message, storageKey: (_a = this.selectedChannelId) !== null && _a !== void 0 ? _a : `draft-${this.selectedChannelId}`, quotedMessage: quotedMessage, isEditing: !!this.editingMessage, canSendTextMessage: this.isTextMessagingAllowed(), canSendFiles: this.isFileMessagingAllowed(), disableEmojiPicker: !!((_c = (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.__internals__) === null || _c === void 0 ? void 0 : _c.features.hasFeature(uiStore.FlagsmithFeatureFlags.DISABLE_EMOJI_PICKER)), maxLength: this.meeting.chat.maxTextLimit, rateLimits: this.meeting.chat.rateLimits, inputTextPlaceholder: this.t('chat.message_placeholder'), onNewMessage: this.onNewMessageHandler, onEditMessage: this.onEditMessageHandler, onEditCancel: this.onEditCancel, onQuotedMessageDismiss: this.onQuotedMessageDismiss }, uiProps), index$1.h("slot", { name: "chat-addon", slot: "chat-addon" })));
682
+ }
683
+ render() {
684
+ var _a;
685
+ if (!this.meeting) {
686
+ return null;
687
+ }
688
+ let chatMessages = this.chatGroups[this.selectedGroup] || [];
689
+ if (this.showPinnedMessages && this.meeting.chat.pinned.length !== 0) {
690
+ chatMessages = chatMessages.filter((chat) => chat.type === 'chat' && chat.message.pinned);
691
+ }
692
+ return (index$1.h(index$1.Host, null, index$1.h("div", { class: "chat-container" }, index$1.h("div", { class: "chat" }, this.isFileMessagingAllowed() && (index$1.h("div", { id: "dropzone", class: { active: this.dropzoneActivated }, part: "dropzone" }, index$1.h("rtk-icon", { icon: this.iconPack.attach }), index$1.h("p", null, this.t('chat.send_attachment')))), this.renderPinnedMessagesHeader(), this.isPrivateChatSupported() && (index$1.h("rtk-channel-selector-view", { channels: this.getPrivateChatRecipients(), selectedChannelId: ((_a = this.selectedParticipant) === null || _a === void 0 ? void 0 : _a.userId) || 'everyone', onChannelChange: this.updateRecipients, t: this.t, viewAs: "dropdown" })), index$1.h("rtk-chat-messages-ui-paginated", { meeting: this.meeting, onPinMessage: this.onPinMessage, onDeleteMessage: this.onDeleteMessage, size: this.size, iconPack: this.iconPack, t: this.t }), this.renderComposerUI()))));
693
+ }
694
+ get host() { return index$1.getElement(this); }
695
+ static get watchers() { return {
696
+ "meeting": ["meetingChanged"],
697
+ "chatGroups": ["chatGroupsChanged"],
698
+ "displayFilter": ["onDisplayFilterChanged"]
699
+ }; }
700
+ };
701
+ __decorate$f([
702
+ index.SyncWithStore()
703
+ ], RtkChat.prototype, "meeting", void 0);
704
+ __decorate$f([
705
+ index.SyncWithStore()
706
+ ], RtkChat.prototype, "config", void 0);
707
+ __decorate$f([
708
+ index.SyncWithStore()
709
+ ], RtkChat.prototype, "iconPack", void 0);
710
+ __decorate$f([
711
+ index.SyncWithStore()
712
+ ], RtkChat.prototype, "t", void 0);
713
+ RtkChat.style = RtkChatStyle0;
714
+
715
+ const rtkChatComposerViewCss = ":host {\n display: flex;\n flex-direction: column;\n font-family: var(--rtk-font-family, sans-serif);\n font-size: 14px;\n position: relative;\n}\n\n.quoted-message-container {\n margin-bottom: var(--rtk-space-2, 8px);\n display: flex;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n border-radius: var(--rtk-border-radius-md, 8px);\n border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.quoted-message-container .quoted-message {\n flex: 1 1 0%;\n padding: var(--rtk-space-2, 8px);\n border-radius: var(--rtk-border-radius-md, 8px);\n max-height: var(--rtk-space-24, 96px);\n overflow-y: auto;\n word-break: break-all;\n}\n\n.quoted-message-container .quoted-message blockquote {\n display: none;\n}\n\n.quoted-message-container rtk-icon.dismiss {\n margin-left: auto;\n height: var(--rtk-space-5, 20px);\n width: var(--rtk-space-5, 20px);\n padding: var(--rtk-space-2, 8px);\n border-radius: var(--rtk-border-radius-md, 8px);\n color: rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));\n}\n\n.quoted-message-container rtk-icon.dismiss:hover {\n cursor: pointer;\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.quoted-message-container rtk-icon.dismiss {\n transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;\n transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);\n transition-duration: 150ms;\n}\n\n.composer-container {\n position: relative;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n border-radius: var(--rtk-border-radius-md, 8px);\n overflow: hidden;\n border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n}\n\n.composer-container > .composers {\n min-height: 60px;\n }\n\n@container chatcontainer (height < 360px) {\n .composer-container > .composers {\n min-height: 30px;\n }\n}\n\n.chat-buttons {\n padding: var(--rtk-space-3, 12px);\n display: flex;\n align-items: center;\n justify-content: space-between;\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n color: rgb(var(--rtk-colors-text-1000, 255 255 255));\n}\n\n.chat-buttons .right {\n z-index: 10;\n}\n\n.chat-buttons .right .edit-buttons {\n display: flex;\n gap: var(--rtk-space-2, 8px);\n}\n\n.chat-buttons > div {\n display: flex;\n align-items: center;\n}\n\nrtk-emoji-picker {\n z-index: 20;\n position: absolute;\n top: calc(var(--rtk-space-72, 288px) * -1);\n border-top: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));\n animation: 0.3s slide-up ease;\n}\n\n@keyframes slide-up {\n from {\n transform: translateY(100%);\n }\n to {\n transform: translateY(0%);\n }\n}\n";
716
+ const RtkChatComposerViewStyle0 = rtkChatComposerViewCss;
717
+
718
+ var __decorate$e = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
719
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
720
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
721
+ r = Reflect.decorate(decorators, target, key, desc);
722
+ else
723
+ for (var i = decorators.length - 1; i >= 0; i--)
724
+ if (d = decorators[i])
725
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
726
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
727
+ };
728
+ const messageLimits = {
729
+ messagesSent: 0,
730
+ startTime: 0,
731
+ };
732
+ const RtkChatComposerView = class {
733
+ constructor(hostRef) {
734
+ index$1.registerInstance(this, hostRef);
735
+ this.onNewMessage = index$1.createEvent(this, "newMessage", 7);
736
+ this.onEditMessage = index$1.createEvent(this, "editMessage", 7);
737
+ this.onEditCancel = index$1.createEvent(this, "editCancel", 7);
738
+ this.onQuotedMessageDismiss = index$1.createEvent(this, "quotedMessageDismiss", 7);
739
+ /** Whether user can send text messages */
740
+ this.canSendTextMessage = true;
741
+ /** Whether user can send file messages */
742
+ this.canSendFiles = true;
743
+ /** Message to be pre-populated */
744
+ this.message = '';
745
+ /** Quote message to be displayed */
746
+ this.quotedMessage = '';
747
+ /** Key for storing message in localStorage */
748
+ this.storageKey = 'rtk-text-message';
749
+ /** Placeholder for text input */
750
+ this.inputTextPlaceholder = 'Enter your message';
751
+ /** Sets composer to edit mode */
752
+ this.isEditing = false;
753
+ /** Icon pack */
754
+ this.iconPack = uiStore.defaultIconPack;
755
+ /** Language */
756
+ this.t = uiStore.useLanguage();
757
+ /** Whether to show emoji picker */
758
+ this.disableEmojiPicker = false;
759
+ /** Rate limits */
760
+ this.rateLimits = {
761
+ period: 60,
762
+ maxInvocations: 60,
763
+ };
764
+ this.fileToUpload = null;
765
+ this.isEmojiPickerOpen = false;
766
+ this.disableSendButton = false;
767
+ this.rateLimitsBreached = false;
768
+ this.textMessage = '';
769
+ this.sendFile = () => {
770
+ if (!this.canSendFiles) {
771
+ return;
772
+ }
773
+ if (this.fileToUpload.type === 'image') {
774
+ this.onNewMessage.emit({
775
+ type: 'image',
776
+ image: this.fileToUpload.file,
777
+ });
778
+ }
779
+ else {
780
+ this.onNewMessage.emit({ type: 'file', file: this.fileToUpload.file });
781
+ }
782
+ this.fileToUpload = null;
783
+ };
784
+ this.handleSendMessage = () => {
785
+ if (!this.canSendTextMessage || this.rateLimitsBreached) {
786
+ return;
787
+ }
788
+ if (this.fileToUpload !== null) {
789
+ this.sendFile();
790
+ return;
791
+ }
792
+ const message = this.textMessage;
793
+ const currentTime = Date.now();
794
+ if (currentTime - messageLimits.startTime > this.rateLimits.period * 1000) {
795
+ messageLimits.startTime = currentTime;
796
+ messageLimits.messagesSent = 0;
797
+ }
798
+ messageLimits.messagesSent += 1;
799
+ this.checkRateLimitBreached(currentTime);
800
+ if (message.length > 0) {
801
+ if (this.quotedMessage.length !== 0) {
802
+ this.onNewMessage.emit({
803
+ type: 'text',
804
+ message,
805
+ });
806
+ }
807
+ else {
808
+ this.onNewMessage.emit({ type: 'text', message });
809
+ }
810
+ this.cleanup();
811
+ }
812
+ };
813
+ this.handleEditMessage = () => {
814
+ this.onEditMessage.emit(this.textMessage);
815
+ this.cleanup();
816
+ };
817
+ this.handleEditCancel = () => {
818
+ this.onEditCancel.emit();
819
+ this.cleanup();
820
+ };
821
+ this.onTextChangeHandler = (event) => {
822
+ var _a;
823
+ this.textMessage = event.detail;
824
+ if (this.textMessage.length >= ((_a = this.maxLength) !== null && _a !== void 0 ? _a : chat.MAX_TEXT_LENGTH)) {
825
+ this.disableSendButton = true;
826
+ }
827
+ else if (this.disableSendButton) {
828
+ this.disableSendButton = false;
829
+ }
830
+ uiStore.gracefulStorage.setItem(this.storageKey, event.detail);
831
+ };
832
+ this.onKeyDownHandler = (event) => {
833
+ if (event.key === 'Enter' && event.shiftKey) {
834
+ return;
835
+ }
836
+ if (this.disableSendButton) {
837
+ return;
838
+ }
839
+ if (event.key === 'Enter') {
840
+ event.preventDefault();
841
+ if (this.isEditing) {
842
+ this.handleEditMessage();
843
+ }
844
+ else {
845
+ this.handleSendMessage();
846
+ }
847
+ }
848
+ };
849
+ this.onFileUploadHandler = (type, file) => {
850
+ this.fileToUpload = { type, file };
851
+ };
852
+ this.onQuotedMessageDismissHandler = () => {
853
+ this.onQuotedMessageDismiss.emit();
854
+ };
855
+ this.cleanup = () => {
856
+ this.textMessage = '';
857
+ this.fileToUpload = null;
858
+ uiStore.gracefulStorage.setItem(this.storageKey, '');
859
+ this.$textComposer.setText('', true);
860
+ this.isEmojiPickerOpen = false;
861
+ };
862
+ this.onKeyDownHandler = this.onKeyDownHandler.bind(this);
863
+ }
864
+ connectedCallback() {
865
+ this.textMessage = this.message || uiStore.gracefulStorage.getItem(this.storageKey) || '';
866
+ this.checkRateLimitBreached(Date.now());
867
+ }
868
+ componentWillUpdate() {
869
+ this.textMessage = this.message || uiStore.gracefulStorage.getItem(this.storageKey) || '';
870
+ }
871
+ componentDidLoad() {
872
+ if (this.message) {
873
+ index$1.writeTask(() => this.$textComposer.setText(this.message, true));
874
+ }
875
+ }
876
+ checkRateLimitBreached(currentTime) {
877
+ // Check if the function call is within limits
878
+ if (messageLimits.messagesSent >= this.rateLimits.maxInvocations) {
879
+ this.disableSendButton = true;
880
+ this.rateLimitsBreached = true;
881
+ const timeRemainingForReset = currentTime - messageLimits.startTime + this.rateLimits.period * 1000;
882
+ setTimeout(() => {
883
+ messageLimits.messagesSent = 0;
884
+ messageLimits.startTime = Date.now();
885
+ this.disableSendButton = false;
886
+ this.rateLimitsBreached = false;
887
+ }, timeRemainingForReset);
888
+ }
889
+ }
890
+ render() {
891
+ var _a;
892
+ const uiProps = { iconPack: this.iconPack, t: this.t };
893
+ return (index$1.h(index$1.Host, { key: '06455539e3067eb1c1c592b551d0ef99eba2f331' }, this.canSendTextMessage && this.isEmojiPickerOpen && (index$1.h("rtk-emoji-picker", Object.assign({ key: 'fe83b0ab9562cc0e1c61f89e4b441ef592edfa1a', part: "emoji-picker", onPickerClose: () => {
894
+ this.isEmojiPickerOpen = false;
895
+ }, onRtkEmojiClicked: (e) => {
896
+ this.textMessage += e.detail;
897
+ this.$textComposer.setText(this.textMessage, true);
898
+ } }, uiProps))), index$1.h("slot", { key: '8653c2e805e41adf5958941cc10ff01d43f97792', name: "chat-addon" }), this.quotedMessage && this.quotedMessage.length !== 0 && (index$1.h("div", { key: '82b9bf5203a799709e980d61ab827b9daf8292e6', class: "quoted-message-container", part: "quoted-message-container" }, index$1.h("div", { key: '4b9fe8f382da7075e815c329f2d7dca17ce0f694', class: "quoted-message scrollbar" }, index$1.h("rtk-text-message-view", { key: '7a16547e83d9bca43794e46e56c5a9c743a9929a', text: this.quotedMessage, isMarkdown: true })), index$1.h("div", { key: '5691b8d882016cda66cd2faf3858bc38cd53458c' }, index$1.h("rtk-icon", { key: '2d5b222bd5eaac6d46812b704674f52f86efdb92', "aria-label": this.t('dismiss'), class: "dismiss", icon: this.iconPack.dismiss, onClick: this.onQuotedMessageDismissHandler })))), index$1.h("div", { key: 'd7638411df9ae1b2cbef8cae66d0af2b7ad310e6', class: "composer-container" }, index$1.h("div", { key: 'ca1ee222584fdd27e53989d28b6ce583c6b0c400', class: "composers" }, this.fileToUpload && (index$1.h("rtk-draft-attachment-view", Object.assign({ key: 'd511c900c71a97f8f92640b73a7575dcd267de88' }, uiProps, { attachment: this.fileToUpload, onDeleteAttachment: () => (this.fileToUpload = null) }))), !this.fileToUpload && (index$1.h("rtk-text-composer-view", { key: '08f214184853dcedeccb5f07dac2a0a308269793', value: this.textMessage, placeholder: this.inputTextPlaceholder, onTextChange: this.onTextChangeHandler, keyDownHandler: this.onKeyDownHandler, maxLength: (_a = this.maxLength) !== null && _a !== void 0 ? _a : chat.MAX_TEXT_LENGTH, rateLimitBreached: this.rateLimitsBreached, t: this.t, iconPack: this.iconPack, ref: (el) => (this.$textComposer = el) }))), index$1.h("div", { key: '9b6cbe7cb8529c8e60f8cc9e13cc95ca64504efc', class: "chat-buttons", part: "chat-buttons" }, index$1.h("div", { key: '30e24e8edf58179ef20ccd436d3833ba177ebb0d', class: "left", part: "chat-buttons-left" }, !this.fileToUpload && !this.isEditing && (index$1.h("div", { key: '54ad294bedab1c0bc7c02a72c4f3f51bc10bba85' }, this.canSendFiles && [
899
+ index$1.h("rtk-file-picker-button", Object.assign({ key: '1a0760e05a183b6c8da2ff02e33ecd40bfdb6e97' }, uiProps, { onFileChange: (event) => this.onFileUploadHandler('file', event.detail) })),
900
+ index$1.h("rtk-file-picker-button", Object.assign({ key: '5d6cf1928c8edb6737b367807c93152ad62cea36', filter: "image/*", label: this.t('chat.send_img'), icon: "image", onFileChange: (event) => this.onFileUploadHandler('image', event.detail) }, uiProps)),
901
+ ], this.canSendTextMessage && !this.disableEmojiPicker && (index$1.h("rtk-emoji-picker-button", Object.assign({ key: '50f14152b8d15009104e9b1dd05ee5e1ec49ab16', isActive: this.isEmojiPickerOpen, onClick: () => {
902
+ this.isEmojiPickerOpen = !this.isEmojiPickerOpen;
903
+ } }, uiProps))), index$1.h("slot", { key: '1e1fe81e1e196fc8d679bfc2d6ed0c6402c74a4a', name: "chat-buttons" })))), index$1.h("div", { key: '272526b7c81ed1acd028beceb3869c584e94308f', class: "right", part: "chat-buttons-right" }, !this.isEditing && (index$1.h("rtk-tooltip", { key: '6750abf323b2f1c951661c44390eb97d3ec71544', variant: "primary", label: this.t('chat.send_msg'), delay: 2000 }, index$1.h("rtk-button", { key: 'a159fa6dcc1f8ede64085abd8286a69ad86b7002', kind: "icon", disabled: this.disableSendButton, onClick: () => this.handleSendMessage(), title: this.t('chat.send_msg') }, index$1.h("rtk-icon", { key: 'bb26a3a7954727859f5566ecc60d746ac6700b7b', icon: this.iconPack.send })))), this.isEditing && (index$1.h("div", { key: '5ef512e3fc236510a518e76ce027f0c8fc1c9a0c', class: "edit-buttons" }, index$1.h("rtk-tooltip", { key: 'e18ae7567350d32b18a70de8cb2c1af0830353bc', variant: "secondary", label: this.t('cancel'), delay: 2000 }, index$1.h("rtk-button", { key: '4f4aa2e44308a393314ab95244c87a3b8d4b282c', kind: "icon", variant: "secondary", onClick: () => this.handleEditCancel(), title: this.t('cancel') }, index$1.h("rtk-icon", { key: 'a4a99fe9ae34707cb63f63461a4728baf70e3e7a', icon: this.iconPack.dismiss }))), index$1.h("rtk-tooltip", { key: '789315dbf551ba74d004459981532fa9a467ac45', variant: "primary", label: this.t('chat.update_msg'), delay: 2000 }, index$1.h("rtk-button", { key: '61da43993c2da9b8bd00796544030e9b4cb45f12', kind: "icon", onClick: () => this.handleEditMessage(), title: this.t('chat.send_msg') }, index$1.h("rtk-icon", { key: 'e45aab29b0f6553ed2d7f370a8817bdccdabe42e', icon: this.iconPack.checkmark }))))))))));
904
+ }
905
+ };
906
+ __decorate$e([
907
+ index.SyncWithStore()
908
+ ], RtkChatComposerView.prototype, "iconPack", void 0);
909
+ __decorate$e([
910
+ index.SyncWithStore()
911
+ ], RtkChatComposerView.prototype, "t", void 0);
912
+ RtkChatComposerView.style = RtkChatComposerViewStyle0;
913
+
914
+ const rtkChatMessagesUiPaginatedCss = ":host{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));flex:1 0 0px}";
915
+ const RtkChatMessagesUiPaginatedStyle0 = rtkChatMessagesUiPaginatedCss;
916
+
917
+ var __decorate$d = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
918
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
919
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
920
+ r = Reflect.decorate(decorators, target, key, desc);
921
+ else
922
+ for (var i = decorators.length - 1; i >= 0; i--)
923
+ if (d = decorators[i])
924
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
925
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
926
+ };
927
+ const RtkChatMessagesUiPaginated = class {
928
+ constructor(hostRef) {
929
+ index$1.registerInstance(this, hostRef);
930
+ this.editMessageInit = index$1.createEvent(this, "editMessageInit", 7);
931
+ this.onPinMessage = index$1.createEvent(this, "pinMessage", 7);
932
+ this.onDeleteMessage = index$1.createEvent(this, "deleteMessage", 7);
933
+ this.stateUpdate = index$1.createEvent(this, "rtkStateUpdate", 7);
934
+ /** Icon pack */
935
+ this.iconPack = uiStore.defaultIconPack;
936
+ /** Language */
937
+ this.t = uiStore.useLanguage();
938
+ /** Whether to align chat bubbles to the left */
939
+ this.leftAlign = false;
940
+ this.permissionsChanged = false;
941
+ this.pageSize = 25;
942
+ this.lastReadMessageIndex = -1;
943
+ this.permissionsUpdateListener = () => {
944
+ this.permissionsChanged = !this.permissionsChanged;
945
+ };
946
+ this.maybeMarkChannelAsRead = (messages) => {
947
+ if (!this.selectedChannelId)
948
+ return;
949
+ if (messages.length === 0)
950
+ return;
951
+ if (this.lastReadMessageIndex !== -1)
952
+ return;
953
+ const latestMsg = messages.at(0).time > messages.at(-1).time ? messages.at(0) : messages.at(-1);
954
+ if (!latestMsg.channelIndex)
955
+ return;
956
+ this.lastReadMessageIndex = parseInt(latestMsg.channelIndex, 10);
957
+ this.meeting.chat.markLastReadMessage(this.selectedChannelId, latestMsg);
958
+ };
959
+ this.getChatMessages = async (timestamp, size, reversed) => {
960
+ const { messages } = await this.meeting.chat.getMessages(timestamp, size, reversed, undefined, this.selectedChannelId);
961
+ this.maybeMarkChannelAsRead(messages);
962
+ return messages;
963
+ };
964
+ this.createChatNodes = (data) => {
965
+ /**
966
+ * NOTE(callmetarush): When between pages the message's isContinued
967
+ * will fail in current implementation
968
+ */
969
+ return data.map((message, idx) => {
970
+ var _a;
971
+ const isContinued = message.userId === ((_a = data[idx - 1]) === null || _a === void 0 ? void 0 : _a.userId);
972
+ return this.createChatNode(message, isContinued);
973
+ });
974
+ };
975
+ this.disconnectMeeting = (meeting) => {
976
+ var _a, _b;
977
+ (_a = meeting === null || meeting === void 0 ? void 0 : meeting.chat) === null || _a === void 0 ? void 0 : _a.removeListener('chatUpdate', this.chatUpdateListener);
978
+ (_b = this.meeting) === null || _b === void 0 ? void 0 : _b.self.permissions.removeListener('permissionsUpdate', this.permissionsUpdateListener);
979
+ };
980
+ this.getMessageActions = (message) => {
981
+ const actions = [];
982
+ // const isSelf = this.meeting.self.userId === message.userId;
983
+ // const chatMessagePermissions = this.meeting.self.permissions?.chatMessage;
984
+ // const canEdit =
985
+ // chatMessagePermissions === undefined
986
+ // ? isSelf
987
+ // : chatMessagePermissions.canEdit === 'ALL' ||
988
+ // (chatMessagePermissions.canEdit === 'SELF' && isSelf);
989
+ // const canDelete =
990
+ // chatMessagePermissions === undefined
991
+ // ? isSelf
992
+ // : chatMessagePermissions.canDelete === 'ALL' ||
993
+ // (chatMessagePermissions.canDelete === 'SELF' && isSelf);
994
+ if (this.meeting.self.permissions.pinParticipant) {
995
+ actions.push({
996
+ id: 'pin_message',
997
+ label: message.pinned ? this.t('unpin') : this.t('pin'),
998
+ icon: this.iconPack.pin,
999
+ });
1000
+ }
1001
+ // if (canDelete) {
1002
+ // actions.push({
1003
+ // id: 'delete_message',
1004
+ // label: this.t('chat.delete_msg'),
1005
+ // icon: this.iconPack.delete,
1006
+ // });
1007
+ // }
1008
+ return actions;
1009
+ };
1010
+ this.onMessageActionHandler = (actionId, message) => {
1011
+ switch (actionId) {
1012
+ case 'pin_message':
1013
+ this.onPinMessage.emit(message);
1014
+ break;
1015
+ case 'delete_message':
1016
+ this.onDeleteMessage.emit(message);
1017
+ break;
1018
+ }
1019
+ };
1020
+ this.createChatNode = (message, isContinued) => {
1021
+ var _a, _b, _c, _d;
1022
+ if (message.targetUserIds.length !== 0)
1023
+ return null; // don't render private messages
1024
+ let displayPicture;
1025
+ if (this.meeting.meta.viewType === 'CHAT') {
1026
+ displayPicture = (_a = this.meeting.participants.all
1027
+ .toArray()
1028
+ .find((p) => p.userId === message.userId)) === null || _a === void 0 ? void 0 : _a.picture;
1029
+ }
1030
+ else {
1031
+ if (this.meeting.self.userId === message.userId) {
1032
+ displayPicture = this.meeting.self.picture;
1033
+ }
1034
+ else {
1035
+ displayPicture =
1036
+ (_c = (_b = this.meeting.participants.joined
1037
+ .toArray()
1038
+ .find((member) => member.userId === message.userId)) === null || _b === void 0 ? void 0 : _b.picture) !== null && _c !== void 0 ? _c : (_d = this.meeting.participants.waitlisted.toArray().find((p) => p.userId === message.userId)) === null || _d === void 0 ? void 0 : _d.picture;
1039
+ }
1040
+ }
1041
+ const isSelf = message.userId === this.meeting.self.userId;
1042
+ const viewType = isSelf ? 'outgoing' : 'incoming';
1043
+ return (index$1.h("div", { class: { pinned: message.pinned } }, index$1.h("div", { class: "message-wrapper" }, index$1.h("rtk-message-view", { time: message.time, actions: this.getMessageActions(message), authorName: message.displayName, isSelf: isSelf, avatarUrl: displayPicture, hideAuthorName: isContinued, viewType: viewType, variant: "bubble", onAction: (event) => this.onMessageActionHandler(event.detail, message) }, index$1.h("div", null, index$1.h("div", { class: "body" }, message.type === 'text' && (index$1.h("rtk-text-message-view", { text: message.message, isMarkdown: true })), message.type === 'file' && (index$1.h("rtk-file-message-view", { name: message.name, url: message.link, size: message.size })), message.type === 'image' && (index$1.h("rtk-image-message-view", { url: message.link, onPreview: () => {
1044
+ this.stateUpdate.emit({ image: message });
1045
+ } }))), message.pinned && (index$1.h("div", { class: "pin-icon", part: "pin-icon" }, index$1.h("rtk-icon", { icon: this.iconPack.pin, size: "sm" }))))))));
1046
+ };
1047
+ this.chatUpdateListener = (data) => {
1048
+ if (this.selectedChannelId && data.message.channelId !== this.selectedChannelId)
1049
+ return;
1050
+ if (data.action === 'add') {
1051
+ this.$paginatedListRef.onNewNode(data.message);
1052
+ this.lastReadMessageIndex = -1;
1053
+ this.maybeMarkChannelAsRead([data.message]);
1054
+ }
1055
+ else if (data.action === 'delete') {
1056
+ this.$paginatedListRef.onNodeDelete(data.message.id);
1057
+ }
1058
+ else if (data.action === 'edit') {
1059
+ this.$paginatedListRef.onNodeUpdate(data.message.id, data.message);
1060
+ }
1061
+ };
1062
+ }
1063
+ componentDidLoad() {
1064
+ const slotted = this.host.shadowRoot.querySelector('slot');
1065
+ if (!slotted)
1066
+ return;
1067
+ this.children = slotted.assignedElements()[0];
1068
+ }
1069
+ connectedCallback() {
1070
+ this.meetingChanged(this.meeting);
1071
+ }
1072
+ disconnectedCallback() {
1073
+ this.disconnectMeeting(this.meeting);
1074
+ }
1075
+ meetingChanged(meeting, oldMeeting) {
1076
+ var _a;
1077
+ if (oldMeeting != undefined)
1078
+ this.disconnectMeeting(oldMeeting);
1079
+ if (meeting && !meeting.chat)
1080
+ return;
1081
+ if (meeting != null) {
1082
+ (_a = meeting.chat) === null || _a === void 0 ? void 0 : _a.addListener('chatUpdate', this.chatUpdateListener);
1083
+ meeting.self.permissions.addListener('permissionsUpdate', this.permissionsUpdateListener);
1084
+ }
1085
+ this.permissionsUpdateListener();
1086
+ }
1087
+ channelChanged() {
1088
+ this.lastReadMessageIndex = -1;
1089
+ }
1090
+ render() {
1091
+ return (index$1.h(index$1.Host, { key: '6fdfc734e2f31c5e6d6ef616766ae1eadbbc44aa' }, index$1.h("rtk-paginated-list", { key: '4286561871575f00871ecd177aae852846c35ecd', ref: (el) => (this.$paginatedListRef = el), pageSize: this.pageSize, pagesAllowed: 3, fetchData: this.getChatMessages, createNodes: this.createChatNodes, selectedItemId: this.selectedChannelId, emptyListLabel: this.t('chat.empty_channel') }, index$1.h("slot", { key: 'd101b1f6d86fcc058dba3146ae8ce783978c93cd' }))));
1092
+ }
1093
+ get host() { return index$1.getElement(this); }
1094
+ static get watchers() { return {
1095
+ "meeting": ["meetingChanged"],
1096
+ "selectedChannelId": ["channelChanged"]
1097
+ }; }
1098
+ };
1099
+ __decorate$d([
1100
+ index.SyncWithStore()
1101
+ ], RtkChatMessagesUiPaginated.prototype, "meeting", void 0);
1102
+ __decorate$d([
1103
+ index.SyncWithStore()
1104
+ ], RtkChatMessagesUiPaginated.prototype, "iconPack", void 0);
1105
+ __decorate$d([
1106
+ index.SyncWithStore()
1107
+ ], RtkChatMessagesUiPaginated.prototype, "t", void 0);
1108
+ RtkChatMessagesUiPaginated.style = RtkChatMessagesUiPaginatedStyle0;
1109
+
1110
+ const rtkDraftAttachmentViewCss = ":host{display:flex;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-top-left-radius:var(--rtk-border-radius-md, 8px);border-top-right-radius:var(--rtk-border-radius-md, 8px)}.preview-overlay{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);background-color:inherit}.preview{position:absolute;top:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);max-width:-moz-fit-content;max-width:fit-content;max-height:var(--rtk-space-20, 80px)}.preview:hover rtk-tooltip{display:block}.preview rtk-tooltip{position:absolute;top:calc(var(--rtk-space-1, 4px) * -1);left:calc(var(--rtk-space-1, 4px) * -1);display:none;margin-left:calc(var(--rtk-space-1, 4px) * -1);margin-top:calc(var(--rtk-space-1, 4px) * -1)}.preview rtk-button{display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));border:1px solid rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview-image{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);-o-object-fit:cover;object-fit:cover;max-height:100%;max-width:100%;overflow:clip;border-radius:var(--rtk-border-radius-md, 8px)}.preview-file{padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--rtk-border-radius-md, 8px);max-width:200px}";
1111
+ const RtkDraftAttachmentViewStyle0 = rtkDraftAttachmentViewCss;
1112
+
1113
+ var __decorate$c = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1114
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1115
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1116
+ r = Reflect.decorate(decorators, target, key, desc);
1117
+ else
1118
+ for (var i = decorators.length - 1; i >= 0; i--)
1119
+ if (d = decorators[i])
1120
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1121
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1122
+ };
1123
+ const RtkDraftAttachmentView = class {
1124
+ constructor(hostRef) {
1125
+ index$1.registerInstance(this, hostRef);
1126
+ this.onDeleteAttachment = index$1.createEvent(this, "deleteAttachment", 7);
1127
+ /** Icon pack */
1128
+ this.iconPack = uiStore.defaultIconPack;
1129
+ /** Language */
1130
+ this.t = uiStore.useLanguage();
1131
+ /** Attachment to display */
1132
+ this.attachment = null;
1133
+ this.filePreview = null;
1134
+ this.fileReader = new FileReader();
1135
+ this.generatePreview = () => {
1136
+ if (this.attachment.type === 'image') {
1137
+ this.fileReader.readAsDataURL(this.attachment.file);
1138
+ }
1139
+ else if (this.attachment.type === 'file') {
1140
+ this.filePreview = this.attachment.file.name;
1141
+ }
1142
+ };
1143
+ this.onDeleteClickHandler = () => {
1144
+ this.filePreview = null;
1145
+ this.onDeleteAttachment.emit();
1146
+ };
1147
+ }
1148
+ onAttachmentChange() {
1149
+ this.generatePreview();
1150
+ }
1151
+ connectedCallback() {
1152
+ this.fileReader.onload = (e) => {
1153
+ if (typeof e.target.result === 'string') {
1154
+ this.filePreview = e.target.result;
1155
+ }
1156
+ };
1157
+ // this.fileReader.onloadstart = () => {};
1158
+ // this.fileReader.onloadend = () => {};
1159
+ }
1160
+ componentWillLoad() {
1161
+ this.onAttachmentChange();
1162
+ }
1163
+ render() {
1164
+ return (index$1.h(index$1.Host, { key: 'b23eb412c60a62f542aec0e3cd3b99fc72de48f0' }, index$1.h("div", { key: '04251f8d4b13325f8474110c89733369bd8904f2', class: "preview-overlay" }, index$1.h("div", { key: '51963510a704b19e7c591ea177018bae6e0317f5', class: "preview" }, index$1.h("rtk-tooltip", { key: '3a2167ea7a02f1d744462826084f0fef5c607ac9', label: this.t('chat.cancel_upload') }, index$1.h("rtk-button", { key: '634c9a7e0962ed82c36519e919eb597c9b603f51', variant: "secondary", kind: "icon", onClick: this.onDeleteClickHandler }, index$1.h("rtk-icon", { key: 'b936e54ae44e1d54b73adf38a92551fbea0299c5', icon: this.iconPack.dismiss }))), this.attachment.type === 'image' ? (index$1.h("img", { class: "preview-image", src: this.filePreview })) : (index$1.h("div", { class: "preview-file" }, index$1.h("span", null, this.filePreview)))))));
1165
+ }
1166
+ static get watchers() { return {
1167
+ "attachment": ["onAttachmentChange"]
1168
+ }; }
1169
+ };
1170
+ __decorate$c([
1171
+ index.SyncWithStore()
1172
+ ], RtkDraftAttachmentView.prototype, "iconPack", void 0);
1173
+ __decorate$c([
1174
+ index.SyncWithStore()
1175
+ ], RtkDraftAttachmentView.prototype, "t", void 0);
1176
+ RtkDraftAttachmentView.style = RtkDraftAttachmentViewStyle0;
1177
+
1178
+ const EMOJI_ASSET_URL = 'https://rtk-assets.realtime.cloudflare.com/assets/emojis-data.json';
1179
+ let cachedEmojis;
1180
+ /**
1181
+ * fetches the latest emoji list from CDN
1182
+ * @returns list of emojis
1183
+ */
1184
+ const fetchEmojis = async () => {
1185
+ if (!cachedEmojis) {
1186
+ const emojis = await fetch(EMOJI_ASSET_URL);
1187
+ cachedEmojis = emojis.json();
1188
+ }
1189
+ return cachedEmojis;
1190
+ };
1191
+
1192
+ const rtkEmojiPickerCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{width:100%}.emoji-parent{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-64, 256px);width:100%;max-width:640px;flex-direction:column;padding:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-0, 0px);-webkit-user-select:none;-moz-user-select:none;user-select:none;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.close-parent{display:flex;flex:1 1 0%;justify-content:flex-end;padding:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#emoji-grid{margin-top:var(--rtk-space-2, 8px);box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start;overflow-x:hidden;overflow-y:scroll;height:100%;grid-auto-rows:minmax(min-content, max-content)}#loader{display:flex;height:100%;width:100%;align-items:center;justify-content:center}input{display:block;height:var(--rtk-space-8, 32px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:14px;border-width:var(--rtk-border-width-none, 0);border-style:solid;border-style:none;border-color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input::placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input{border-radius:var(--rtk-border-radius-sm, 4px);outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-ring-opacity));--tw-ring-opacity:0.3}.emoji{height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);font-size:20px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}";
1193
+ const RtkEmojiPickerStyle0 = rtkEmojiPickerCss;
1194
+
1195
+ var __decorate$b = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1196
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1197
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1198
+ r = Reflect.decorate(decorators, target, key, desc);
1199
+ else
1200
+ for (var i = decorators.length - 1; i >= 0; i--)
1201
+ if (d = decorators[i])
1202
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1203
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1204
+ };
1205
+ const RtkEmojiPicker = class {
1206
+ constructor(hostRef) {
1207
+ index$1.registerInstance(this, hostRef);
1208
+ this.pickerClose = index$1.createEvent(this, "pickerClose", 7);
1209
+ this.emojiClicked = index$1.createEvent(this, "rtkEmojiClicked", 7);
1210
+ /** Icon pack */
1211
+ this.iconPack = uiStore.defaultIconPack;
1212
+ /** Language */
1213
+ this.t = uiStore.useLanguage();
1214
+ /** Controls whether or not to focus on mount */
1215
+ this.focusWhenOpened = true;
1216
+ this.filterVal = '';
1217
+ this.filteredEmojis = [];
1218
+ }
1219
+ componentWillLoad() {
1220
+ // Don't use async here as it will block the render
1221
+ fetchEmojis().then((e) => {
1222
+ this.emojiList = e;
1223
+ this.handleInputChange(this.inputElement);
1224
+ });
1225
+ }
1226
+ componentDidLoad() {
1227
+ if (this.focusWhenOpened) {
1228
+ this.inputElement.focus();
1229
+ }
1230
+ }
1231
+ handleInputChange(target) {
1232
+ this.filterVal = target.value;
1233
+ const regex = new RegExp(`([^,]*?${this.filterVal}[^,]*):(\\d+)`, 'g');
1234
+ this.filteredEmojis = Array.from(this.emojiList['search'].matchAll(regex)).map((m) => {
1235
+ return { name: m[1], emoji: this.emojiList['emojis'][m[2]] };
1236
+ });
1237
+ }
1238
+ handleEmojiClick(emoji) {
1239
+ this.emojiClicked.emit(emoji);
1240
+ }
1241
+ mapEmojiList() {
1242
+ var _a;
1243
+ if (((_a = this.emojiList) === null || _a === void 0 ? void 0 : _a.length) > 0) {
1244
+ return (index$1.h("div", { id: "loader" }, index$1.h("rtk-spinner", { iconPack: this.iconPack })));
1245
+ }
1246
+ return (index$1.h("div", { id: "emoji-grid", class: "scrollbar max-w-40" }, this.filteredEmojis.map((e) => (index$1.h("rtk-button", { key: `emoji-button-${e.name}`, class: "emoji", variant: "ghost", kind: "icon", title: e.name, onClick: () => this.handleEmojiClick(e.emoji) }, e.emoji)))));
1247
+ }
1248
+ render() {
1249
+ return (index$1.h(index$1.Host, { key: 'e099d5996a16c659de17ca9a36fcd79a9f02f400' }, index$1.h("div", { key: '2a3e300c9625b877feb2b6780df7d1a9851cb7f3', class: 'close-parent' }, index$1.h("rtk-button", { key: '7ca8421704136d09d107d1f7392ba393d5f59a9a', variant: "ghost", kind: "icon", class: "close", onClick: () => { var _a; return (_a = this.pickerClose) === null || _a === void 0 ? void 0 : _a.emit(); }, "aria-label": this.t('close') }, index$1.h("rtk-icon", { key: '040069093f7243bf5075d55b2c081c564d885a8f', icon: this.iconPack.dismiss }))), index$1.h("div", { key: '372a32be35dea5200323720e221424b5138cc4ab', class: 'emoji-parent' }, index$1.h("input", { key: 'fae2be13d736adbb99212146498f00d4f395636e', value: this.filterVal, onInput: (event) => this.handleInputChange(event.target), placeholder: this.t('search'), ref: (el) => (this.inputElement = el) }), this.mapEmojiList())));
1250
+ }
1251
+ };
1252
+ __decorate$b([
1253
+ index.SyncWithStore()
1254
+ ], RtkEmojiPicker.prototype, "iconPack", void 0);
1255
+ __decorate$b([
1256
+ index.SyncWithStore()
1257
+ ], RtkEmojiPicker.prototype, "t", void 0);
1258
+ RtkEmojiPicker.style = RtkEmojiPickerStyle0;
1259
+
1260
+ const rtkEmojiPickerButtonCss = ":host{}";
1261
+ const RtkEmojiPickerButtonStyle0 = rtkEmojiPickerButtonCss;
1262
+
1263
+ var __decorate$a = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1264
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1265
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1266
+ r = Reflect.decorate(decorators, target, key, desc);
1267
+ else
1268
+ for (var i = decorators.length - 1; i >= 0; i--)
1269
+ if (d = decorators[i])
1270
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1271
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1272
+ };
1273
+ const RtkEmojiPickerButton = class {
1274
+ constructor(hostRef) {
1275
+ index$1.registerInstance(this, hostRef);
1276
+ /** Icon pack */
1277
+ this.iconPack = uiStore.defaultIconPack;
1278
+ /** Language */
1279
+ this.t = uiStore.useLanguage();
1280
+ }
1281
+ render() {
1282
+ return (index$1.h("rtk-tooltip", { key: 'bcde14fb2c3a6544882502e65ffda7a6b3b6f13d', label: this.t('chat.send_emoji') }, index$1.h("rtk-button", { key: 'd82fa78c4ffe48c24131a6e38f087548f540fefa', variant: "ghost", kind: "icon", class: { active: this.isActive }, title: this.t('chat.send_emoji') }, index$1.h("rtk-icon", { key: '791bbe2537f1aeb064c5e9ccbbf4af37b706ec2a', icon: this.iconPack.emoji_multiple }))));
1283
+ }
1284
+ };
1285
+ __decorate$a([
1286
+ index.SyncWithStore()
1287
+ ], RtkEmojiPickerButton.prototype, "iconPack", void 0);
1288
+ __decorate$a([
1289
+ index.SyncWithStore()
1290
+ ], RtkEmojiPickerButton.prototype, "t", void 0);
1291
+ RtkEmojiPickerButton.style = RtkEmojiPickerButtonStyle0;
1292
+
1293
+ const rtkFileMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{margin-left:var(--rtk-space-1, 4px);flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}";
1294
+ const RtkFileMessageViewStyle0 = rtkFileMessageViewCss;
1295
+
1296
+ var __decorate$9 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1297
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1298
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1299
+ r = Reflect.decorate(decorators, target, key, desc);
1300
+ else
1301
+ for (var i = decorators.length - 1; i >= 0; i--)
1302
+ if (d = decorators[i])
1303
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1304
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1305
+ };
1306
+ const RtkFileMessageView = class {
1307
+ constructor(hostRef) {
1308
+ index$1.registerInstance(this, hostRef);
1309
+ /** Icon pack */
1310
+ this.iconPack = uiStore.defaultIconPack;
1311
+ }
1312
+ render() {
1313
+ return (index$1.h("div", { key: 'cdd46a1be912f807688dc86671dddd2fa5b9e7c9', class: "file" }, index$1.h("rtk-button", { key: '20bd6c448ec64902989cd742a8f18de32e368194', variant: "secondary", kind: "icon", onClick: () => file.downloadFile(string.sanitizeLink(this.url), { name: this.name, fallbackName: 'file' }), part: "button" }, index$1.h("rtk-icon", { key: '11ac30db5146132be8aaba67a79f66f8aba7bb8d', icon: this.iconPack.download })), index$1.h("div", { key: '342dd8daa944a5857a6519339b4d3bfb6c369eda', class: "file-data" }, index$1.h("div", { key: 'e161743b75677b1e81d09d7c373be494ccf8411a', class: "name" }, this.name), index$1.h("div", { key: '99f2d8d77ef3c129aa0c229260f6e79901ce268c', class: "file-data-split" }, index$1.h("div", { key: '7b9beadca2a810c151fb1ad43ee7c47ba451a37a', class: "ext" }, file.getExtension(this.name)), index$1.h("span", { key: 'd55f69a96bbe26c262461fa87f1a0a506854cf59', class: "divider" }), index$1.h("div", { key: 'cad33d263ab75aeb3083886e83063b8ccb2ea976', class: "size" }, file.getFileSize(this.size))))));
1314
+ }
1315
+ };
1316
+ __decorate$9([
1317
+ index.SyncWithStore()
1318
+ ], RtkFileMessageView.prototype, "iconPack", void 0);
1319
+ RtkFileMessageView.style = RtkFileMessageViewStyle0;
1320
+
1321
+ const rtkFilePickerButtonCss = ":host{}";
1322
+ const RtkFilePickerButtonStyle0 = rtkFilePickerButtonCss;
1323
+
1324
+ var __decorate$8 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1325
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1326
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1327
+ r = Reflect.decorate(decorators, target, key, desc);
1328
+ else
1329
+ for (var i = decorators.length - 1; i >= 0; i--)
1330
+ if (d = decorators[i])
1331
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1332
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1333
+ };
1334
+ const RtkFilePickerButton = class {
1335
+ constructor(hostRef) {
1336
+ index$1.registerInstance(this, hostRef);
1337
+ this.onFileChange = index$1.createEvent(this, "fileChange", 7);
1338
+ /** Icon */
1339
+ this.icon = 'attach';
1340
+ /** Icon pack */
1341
+ this.iconPack = uiStore.defaultIconPack;
1342
+ /** Language */
1343
+ this.t = uiStore.useLanguage();
1344
+ this.uploadFile = () => {
1345
+ const input = this.fileInputField;
1346
+ input.type = 'file';
1347
+ if (this.filter) {
1348
+ input.accept = this.filter;
1349
+ }
1350
+ input.onchange = (e) => {
1351
+ const { validity, files: [file], } = e.target;
1352
+ if (validity.valid) {
1353
+ this.onFileChange.emit(file);
1354
+ }
1355
+ };
1356
+ input.click();
1357
+ };
1358
+ }
1359
+ connectedCallback() {
1360
+ this.fileInputField = document.createElement('input');
1361
+ }
1362
+ disconnectedCallback() {
1363
+ // For GC
1364
+ this.fileInputField = undefined;
1365
+ }
1366
+ render() {
1367
+ const label = this.label || this.t('chat.send_file');
1368
+ const icon = this.iconPack[this.icon];
1369
+ return (index$1.h("rtk-tooltip", { key: '78ef1fd3a42656601c94561bbfc63f888d8180d3', label: label }, index$1.h("rtk-button", { key: 'a0a82e689c2e3a344936db1b3253e36def3a0ce5', variant: "ghost", kind: "icon", onClick: () => this.uploadFile(), title: label }, index$1.h("rtk-icon", { key: '1651a9f460e3851ff5296f05cf08554f9da21703', icon: icon }))));
1370
+ }
1371
+ };
1372
+ __decorate$8([
1373
+ index.SyncWithStore()
1374
+ ], RtkFilePickerButton.prototype, "iconPack", void 0);
1375
+ __decorate$8([
1376
+ index.SyncWithStore()
1377
+ ], RtkFilePickerButton.prototype, "t", void 0);
1378
+ RtkFilePickerButton.style = RtkFilePickerButtonStyle0;
1379
+
1380
+ const rtkIconCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:var(--rtk-space-10, 40px);outline:2px solid transparent;outline-offset:2px}:host .icon-wrapper{display:flex;height:100%;width:100%;flex-direction:column;align-items:center}:host svg{height:100%;width:100%;outline:2px solid transparent;outline-offset:2px}:host([size='xl']){box-sizing:border-box;display:block;height:var(--rtk-space-16, 64px) !important;width:var(--rtk-space-16, 64px) !important;--rtk-spinner-color:currentColor}:host([size='md']){box-sizing:border-box;display:block;height:var(--rtk-space-6, 24px) !important;width:var(--rtk-space-6, 24px) !important;--rtk-spinner-color:currentColor}:host([size='sm']){box-sizing:border-box;display:block;height:var(--rtk-space-4, 16px) !important;width:var(--rtk-space-4, 16px) !important;--rtk-spinner-color:currentColor}:host([variant='secondary']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-text-opacity))}:host([variant='danger']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";
1381
+ const RtkIconStyle0 = rtkIconCss;
1382
+
1383
+ const parseIcon = (icon) => {
1384
+ try {
1385
+ return JSON.parse(icon);
1386
+ }
1387
+ catch (e) {
1388
+ return icon;
1389
+ }
1390
+ };
1391
+ const RtkIcon = class {
1392
+ constructor(hostRef) {
1393
+ index$1.registerInstance(this, hostRef);
1394
+ /** Icon variant */
1395
+ this.variant = 'primary';
1396
+ /** Size */
1397
+ this.size = 'lg';
1398
+ }
1399
+ render() {
1400
+ return (index$1.h(index$1.Host, { key: 'fbacb1ee3dd4c1ca7aa612f08e938601df73036c' }, index$1.h("div", { key: '04c026967cb7aa3acb3fba09fcf5b0d33f45e2b0', class: "icon-wrapper", innerHTML: parseIcon(this.icon), part: "wrapper" })));
1401
+ }
1402
+ };
1403
+ RtkIcon.style = RtkIconStyle0;
1404
+
1405
+ const rtkImageMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.image-spinner{cursor:wait}.image-errored{cursor:not-allowed}.image{display:block;font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}";
1406
+ const RtkImageMessageViewStyle0 = rtkImageMessageViewCss;
1407
+
1408
+ var __decorate$7 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1409
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1410
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1411
+ r = Reflect.decorate(decorators, target, key, desc);
1412
+ else
1413
+ for (var i = decorators.length - 1; i >= 0; i--)
1414
+ if (d = decorators[i])
1415
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1416
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1417
+ };
1418
+ const RtkImageMessageView = class {
1419
+ constructor(hostRef) {
1420
+ index$1.registerInstance(this, hostRef);
1421
+ this.onPreview = index$1.createEvent(this, "preview", 7);
1422
+ /** Icon pack */
1423
+ this.iconPack = uiStore.defaultIconPack;
1424
+ /** Language */
1425
+ this.t = uiStore.useLanguage();
1426
+ this.status = 'loading';
1427
+ }
1428
+ render() {
1429
+ return (index$1.h("div", { key: '47b2dd8f8dfc0d2aa20e80b513f802e1ebc09153', class: { image: true, loaded: this.status === 'loaded' } }, index$1.h("img", { key: 'fba4cfc015beb86040ec74b2a44e2163744a67c6', src: string.sanitizeLink(this.url), onLoad: () => {
1430
+ this.status = 'loaded';
1431
+ }, onError: () => {
1432
+ this.status = 'errored';
1433
+ }, onClick: () => {
1434
+ if (this.status === 'loaded') {
1435
+ this.onPreview.emit(this.url);
1436
+ }
1437
+ } }), this.status === 'loading' && (index$1.h("div", { key: '4da0a3ab39d782e9affe7702a19232747bb4581c', class: "image-spinner", title: this.t('chat.img.loading'), "aria-label": this.t('chat.img.loading') }, index$1.h("rtk-spinner", { key: 'dea7afe2c92dd5c7c71620bc7b9089f743ef1aa2', iconPack: this.iconPack }))), this.status === 'errored' && (index$1.h("div", { key: 'ab303ce11b7182d20c64b00638a1c8be59aea774', class: "image-errored", title: this.t('chat.error.img_not_found'), "aria-label": this.t('chat.error.img_not_found') }, index$1.h("rtk-icon", { key: 'e14eb63cc4b2d18a5abd921e25ef305095f61c17', icon: this.iconPack.image_off }))), this.status === 'loaded' && (index$1.h("div", { key: 'ccceaa5cc5821ce9b4ddab742001cee78135636a', class: "actions" }, index$1.h("rtk-button", { key: 'de49516247d9655cc74afcd58bc50771e2594dca', class: "action", variant: "secondary", kind: "icon", onClick: () => {
1438
+ this.onPreview.emit(this.url);
1439
+ } }, index$1.h("rtk-icon", { key: 'bd1ea608e4846d994a418236dca7856570bd689d', icon: this.iconPack.full_screen_maximize })), index$1.h("rtk-button", { key: '266a860a4ab4d6cf76bd89bb35c987efbc89a593', class: "action", variant: "secondary", kind: "icon", onClick: () => file.downloadFile(this.url, { fallbackName: 'image' }) }, index$1.h("rtk-icon", { key: 'ec26862ff95e116d519280c7e62ed7a7e1ede273', icon: this.iconPack.download }))))));
1440
+ }
1441
+ };
1442
+ __decorate$7([
1443
+ index.SyncWithStore()
1444
+ ], RtkImageMessageView.prototype, "iconPack", void 0);
1445
+ __decorate$7([
1446
+ index.SyncWithStore()
1447
+ ], RtkImageMessageView.prototype, "t", void 0);
1448
+ RtkImageMessageView.style = RtkImageMessageViewStyle0;
1449
+
1450
+ const rtkMarkdownViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{overflow-wrap:break-word}a{color:currentColor}.block-quote,blockquote{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px);--tw-border-spacing-x:1px;--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-md, 2px);border-right-width:var(--rtk-border-width-none, 0);border-style:solid;padding:var(--rtk-space-0\\.5, 2px);padding-left:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);border-top-left-radius:var(--rtk-border-radius-none, 0);border-bottom-left-radius:var(--rtk-border-radius-none, 0)}pre{white-space:pre-wrap}";
1451
+ const RtkMarkdownViewStyle0 = rtkMarkdownViewCss;
1452
+
1453
+ const RtkMarkdownView = class {
1454
+ constructor(hostRef) {
1455
+ index$1.registerInstance(this, hostRef);
1456
+ /** max length of text to render as markdown */
1457
+ this.maxLength = chat.MAX_TEXT_LENGTH;
1458
+ this.restoreEmpty = (content, tag, renderCallback) => {
1459
+ return content.trim().length === 0 ? `${tag}${content}${tag}` : renderCallback(content);
1460
+ };
1461
+ this.renderLink = (content) => {
1462
+ return (index$1.h("a", { class: "link", href: content, target: "_blank", rel: "noopener noreferrer" }, content));
1463
+ };
1464
+ this.renderBold = (content) => {
1465
+ if (typeof content === 'string') {
1466
+ return this.restoreEmpty(content, '*', (c) => index$1.h("b", null, c));
1467
+ }
1468
+ return index$1.h("b", null, this.renderTokens(content));
1469
+ };
1470
+ this.renderItalic = (content) => {
1471
+ if (typeof content === 'string') {
1472
+ return this.restoreEmpty(content, '_', (c) => index$1.h("i", null, c));
1473
+ }
1474
+ return index$1.h("i", null, this.renderTokens(content));
1475
+ };
1476
+ this.renderStrikethrough = (content) => {
1477
+ if (typeof content === 'string') {
1478
+ return this.restoreEmpty(content, '~', (c) => index$1.h("s", null, c));
1479
+ }
1480
+ return index$1.h("b", null, this.renderTokens(content));
1481
+ };
1482
+ this.renderPlainText = (content) => {
1483
+ if (typeof content === 'string') {
1484
+ return content;
1485
+ }
1486
+ return index$1.h("p", null, this.renderTokens(content));
1487
+ };
1488
+ this.renderTokens = (tokens) => {
1489
+ return tokens.map((token) => {
1490
+ switch (token.type) {
1491
+ case 'a':
1492
+ if (typeof token.content === 'string') {
1493
+ return this.renderLink(token.content);
1494
+ }
1495
+ case 'b':
1496
+ return this.renderBold(token.content);
1497
+ case 'i':
1498
+ return this.renderItalic(token.content);
1499
+ case 's':
1500
+ return this.renderStrikethrough(token.content);
1501
+ case 'q':
1502
+ return index$1.h("span", { class: "block-quote" });
1503
+ case 'plain_text':
1504
+ default:
1505
+ return this.renderPlainText(token.content);
1506
+ }
1507
+ });
1508
+ };
1509
+ }
1510
+ renderMessage(text) {
1511
+ let lines = text.split('\n');
1512
+ let isCodeBlock = false;
1513
+ if (lines[0] === '```' && lines[lines.length - 1] === '```') {
1514
+ isCodeBlock = true;
1515
+ lines = lines.slice(1, -1);
1516
+ }
1517
+ const message = lines.map((line) => {
1518
+ const tokens = chat.parseRichText(line);
1519
+ return index$1.h("p", null, this.renderTokens(tokens));
1520
+ });
1521
+ if (isCodeBlock) {
1522
+ return index$1.h("pre", { style: { whiteSpace: 'pre', overflow: 'scroll' } }, lines.join('\n'));
1523
+ }
1524
+ return message;
1525
+ }
1526
+ render() {
1527
+ const slicedMessage = this.text.slice(0, this.maxLength);
1528
+ const withReply = chat.extractReplyBlock(slicedMessage, true);
1529
+ const withoutReply = chat.stripOutReplyBlock(slicedMessage);
1530
+ return (index$1.h("p", { key: 'c33735507a0798dffc360f01793bc7b0caaac159' }, withReply.length !== 0 && index$1.h("blockquote", { key: 'c0a4271ee4c843b6e73c8300a8026a3ec8dd5fe3' }, this.renderMessage(withReply)), withoutReply.length !== 0 && this.renderMessage(withoutReply)));
1531
+ }
1532
+ };
1533
+ RtkMarkdownView.style = RtkMarkdownViewStyle0;
1534
+
1535
+ const sm = 640;
1536
+ const md = 768;
1537
+ const lg = 1080;
1538
+ const xl = 2160;
1539
+ const breakpoints = {
1540
+ sm: sm,
1541
+ md: md,
1542
+ lg: lg,
1543
+ xl: xl
1544
+ };
1545
+
1546
+ /**
1547
+ * Get the screen breakpoint from a given width
1548
+ * @param width The width of the container
1549
+ * @returns The screen breakpoint value
1550
+ */
1551
+ const getSize = (width) => {
1552
+ if (width >= breakpoints.lg)
1553
+ return 'lg';
1554
+ else if (width >= breakpoints.md)
1555
+ return 'md';
1556
+ else
1557
+ return 'sm';
1558
+ };
1559
+
1560
+ const rtkMeetingCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);height:100%;width:100%}:host([mode='fill']){position:relative}";
1561
+ const RtkMeetingStyle0 = rtkMeetingCss;
1562
+
1563
+ const RtkMeeting = class {
1564
+ constructor(hostRef) {
1565
+ index$1.registerInstance(this, hostRef);
1566
+ this.statesUpdate = index$1.createEvent(this, "rtkStatesUpdate", 7);
1567
+ /** Since RtkMeeting by design works as a provider for component, to be in sync with other providers, added provider id */
1568
+ this.providerId = 'provider-' + Math.floor(Math.random() * 100);
1569
+ this.roomJoinedListener = () => {
1570
+ this.updateStates({ meeting: 'joined' });
1571
+ };
1572
+ this.waitlistedListener = () => {
1573
+ this.updateStates({ meeting: 'waiting' });
1574
+ };
1575
+ this.roomLeftListener = ({ state }) => {
1576
+ // Let socketConnectionUpdate listener handle this case.
1577
+ if (state === 'disconnected' || state === 'failed')
1578
+ return;
1579
+ this.updateStates({ meeting: 'ended', roomLeftState: state });
1580
+ };
1581
+ this.mediaPermissionUpdateListener = ({ kind, message }) => {
1582
+ if (['audio', 'video'].includes(kind)) {
1583
+ if ((message === 'DENIED' || message === 'SYSTEM_DENIED') &&
1584
+ (this.peerStore || uiStore.uiStore).state.states.activeDebugger !== true) {
1585
+ const permissionModalSettings = {
1586
+ enabled: true,
1587
+ kind,
1588
+ };
1589
+ this.updateStates({ activePermissionsMessage: permissionModalSettings });
1590
+ }
1591
+ }
1592
+ };
1593
+ this.socketConnectionUpdateListener = ({ state }) => {
1594
+ if (state === 'failed') {
1595
+ setTimeout(() => {
1596
+ this.meeting.leave('disconnected');
1597
+ }, this.leaveRoomTimer);
1598
+ }
1599
+ };
1600
+ this.peerStore = null; // peer specific store for this meeting peer instance
1601
+ /** Whether to load config from preset */
1602
+ this.loadConfigFromPreset = false;
1603
+ /** Whether to apply the design system on the document root from config */
1604
+ this.applyDesignSystem = false;
1605
+ /** Fill type */
1606
+ this.mode = 'fixed';
1607
+ /** Whether participant should leave when this component gets unmounted */
1608
+ this.leaveOnUnmount = false;
1609
+ /** Language */
1610
+ this.t = uiStore.useLanguage();
1611
+ /** UI Config */
1612
+ this.config = uiStore.createDefaultConfig();
1613
+ /** Grid layout */
1614
+ this.gridLayout = 'row';
1615
+ /** Icon pack */
1616
+ this.iconPack = uiStore.defaultIconPack;
1617
+ this.handleChangingMeeting = (destinationMeetingId) => {
1618
+ const currentStates = (this.peerStore || uiStore.uiStore).state.states;
1619
+ this.updateStates({
1620
+ activeBreakoutRoomsManager: Object.assign(Object.assign({}, currentStates.activeBreakoutRoomsManager), { destinationMeetingId }),
1621
+ });
1622
+ };
1623
+ }
1624
+ connectedCallback() {
1625
+ var _a;
1626
+ if (typeof window !== 'undefined') {
1627
+ this.authErrorListener = (ev) => {
1628
+ if (ev.detail.message.includes('401')) {
1629
+ this.updateStates({ meeting: 'ended', roomLeftState: 'unauthorized' });
1630
+ }
1631
+ };
1632
+ window.addEventListener('rtkError', this.authErrorListener);
1633
+ }
1634
+ // Initialize default values
1635
+ this.leaveRoomTimer = 10000;
1636
+ this.loadConfigFromPreset = true;
1637
+ this.applyDesignSystem = true;
1638
+ // Setup event listeners
1639
+ this.setupStoreRequestListener();
1640
+ this.setupStateUpdateListener();
1641
+ this.meetingChanged(this.meeting);
1642
+ this.iconPackChanged(this.iconPack);
1643
+ this.tChanged(this.t);
1644
+ this.configChanged(this.config);
1645
+ this.resizeObserver = new ResizeObserver_es.index(() => this.handleResize());
1646
+ this.resizeObserver.observe(this.host);
1647
+ if (this.applyDesignSystem &&
1648
+ ((_a = this.config) === null || _a === void 0 ? void 0 : _a.designTokens) != null &&
1649
+ typeof document !== 'undefined' &&
1650
+ (this.peerStore || uiStore.uiStore).state.states.activeDebugger !== true) {
1651
+ merge.provideRtkDesignSystem(document.documentElement, this.config.designTokens);
1652
+ }
1653
+ }
1654
+ disconnectedCallback() {
1655
+ var _a;
1656
+ if (this.leaveOnUnmount) {
1657
+ (_a = this.meeting) === null || _a === void 0 ? void 0 : _a.leaveRoom();
1658
+ }
1659
+ this.resizeObserver.disconnect();
1660
+ window.removeEventListener('rtkError', this.authErrorListener);
1661
+ // Remove event listeners
1662
+ if (this.storeRequestListener) {
1663
+ this.host.removeEventListener('rtkRequestStore', this.storeRequestListener);
1664
+ this.storeRequestListener = null;
1665
+ }
1666
+ if (this.stateUpdateListener) {
1667
+ this.host.removeEventListener('rtkStateUpdate', this.stateUpdateListener);
1668
+ this.stateUpdateListener = null;
1669
+ }
1670
+ // Clear meeting listeners
1671
+ if (this.meeting) {
1672
+ this.clearListeners(this.meeting);
1673
+ }
1674
+ }
1675
+ setupStoreRequestListener() {
1676
+ // Remove existing listener if any
1677
+ if (this.storeRequestListener) {
1678
+ this.host.removeEventListener('rtkRequestStore', this.storeRequestListener);
1679
+ }
1680
+ // Listen for store requests from child components
1681
+ this.storeRequestListener = (event) => {
1682
+ // Provide peer specific store if available, otherwise fall back to global store
1683
+ if (!this.peerStore)
1684
+ return;
1685
+ const storeToProvide = this.peerStore;
1686
+ const responseEvent = new CustomEvent('rtkProvideStore', {
1687
+ detail: { store: storeToProvide, requestId: event.detail.requestId },
1688
+ });
1689
+ document.dispatchEvent(responseEvent);
1690
+ // Stop the event from bubbling further to prevent other meetings from handling it
1691
+ event.stopPropagation();
1692
+ };
1693
+ this.host.addEventListener('rtkRequestStore', this.storeRequestListener);
1694
+ }
1695
+ setupStateUpdateListener() {
1696
+ if (this.stateUpdateListener) {
1697
+ this.host.removeEventListener('rtkStateUpdate', this.stateUpdateListener);
1698
+ }
1699
+ this.stateUpdateListener = (event) => {
1700
+ const eventTarget = event.target;
1701
+ if (!this.host.contains(eventTarget)) {
1702
+ return;
1703
+ }
1704
+ this.updateStates(event.detail);
1705
+ };
1706
+ this.host.addEventListener('rtkStateUpdate', this.stateUpdateListener);
1707
+ }
1708
+ clearListeners(meeting) {
1709
+ if (!meeting)
1710
+ return;
1711
+ meeting.self.removeListener('roomLeft', this.roomLeftListener);
1712
+ meeting.self.removeListener('roomJoined', this.roomJoinedListener);
1713
+ meeting.self.removeListener('waitlisted', this.waitlistedListener);
1714
+ meeting.self.removeListener('mediaPermissionUpdate', this.mediaPermissionUpdateListener);
1715
+ meeting.meta.removeListener('socketConnectionUpdate', this.socketConnectionUpdateListener);
1716
+ }
1717
+ meetingChanged(meeting) {
1718
+ var _a, _b;
1719
+ if (!meeting)
1720
+ return;
1721
+ // Create peer specific store for this meeting peer instance
1722
+ if (meeting) {
1723
+ this.peerStore = uiStore.createPeerStore({
1724
+ meeting,
1725
+ config: this.config,
1726
+ iconPack: this.iconPack,
1727
+ t: this.t,
1728
+ providerId: this.providerId,
1729
+ });
1730
+ // Notify components that peer specific store is now available
1731
+ document.dispatchEvent(new CustomEvent('rtkPeerStoreReady', {
1732
+ detail: {
1733
+ peerId: meeting.self.id,
1734
+ },
1735
+ }));
1736
+ }
1737
+ else {
1738
+ this.peerStore = null;
1739
+ }
1740
+ this.updateStates({ viewType: meeting.meta.viewType });
1741
+ if (this.loadConfigFromPreset && meeting.self.config != null) {
1742
+ const theme = meeting.self.config;
1743
+ const { config: config$1, data } = config.generateConfig(theme, meeting);
1744
+ this.config = config$1;
1745
+ if (this.showSetupScreen == null) {
1746
+ this.showSetupScreen = data.showSetupScreen;
1747
+ }
1748
+ if (meeting.connectedMeetings.supportsConnectedMeetings &&
1749
+ ((_a = (this.peerStore || uiStore.uiStore).state.states.activeBreakoutRoomsManager) === null || _a === void 0 ? void 0 : _a.destinationMeetingId)) {
1750
+ this.showSetupScreen = false;
1751
+ }
1752
+ }
1753
+ if (this.applyDesignSystem &&
1754
+ ((_b = this.config) === null || _b === void 0 ? void 0 : _b.designTokens) != null &&
1755
+ typeof document !== 'undefined' &&
1756
+ (this.peerStore || uiStore.uiStore).state.states.activeDebugger !== true) {
1757
+ merge.provideRtkDesignSystem(document.documentElement, this.config.designTokens);
1758
+ }
1759
+ meeting.self.addListener('roomJoined', this.roomJoinedListener);
1760
+ meeting.self.addListener('waitlisted', this.waitlistedListener);
1761
+ meeting.self.addListener('roomLeft', this.roomLeftListener);
1762
+ meeting.self.addListener('mediaPermissionUpdate', this.mediaPermissionUpdateListener);
1763
+ meeting.meta.addListener('socketConnectionUpdate', this.socketConnectionUpdateListener);
1764
+ if (meeting.connectedMeetings.supportsConnectedMeetings) {
1765
+ meeting.connectedMeetings.once('changingMeeting', this.handleChangingMeeting);
1766
+ }
1767
+ if (meeting.self.roomJoined) {
1768
+ this.updateStates({ meeting: 'joined' });
1769
+ }
1770
+ else {
1771
+ if (this.showSetupScreen) {
1772
+ this.updateStates({ meeting: 'setup' });
1773
+ }
1774
+ else {
1775
+ meeting.joinRoom();
1776
+ }
1777
+ }
1778
+ window.removeEventListener('rtkError', this.authErrorListener);
1779
+ }
1780
+ iconPackChanged(newIconPack) {
1781
+ if (this.peerStore) {
1782
+ this.peerStore.state.iconPack = newIconPack;
1783
+ }
1784
+ }
1785
+ tChanged(newT) {
1786
+ if (this.peerStore) {
1787
+ this.peerStore.state.t = newT;
1788
+ }
1789
+ }
1790
+ configChanged(config) {
1791
+ if (this.peerStore) {
1792
+ this.peerStore.state.config = config;
1793
+ }
1794
+ if ((config === null || config === void 0 ? void 0 : config.designTokens) &&
1795
+ typeof document !== 'undefined' &&
1796
+ (this.peerStore || uiStore.uiStore).state.states.activeDebugger !== true) {
1797
+ merge.provideRtkDesignSystem(document.documentElement, config.designTokens);
1798
+ }
1799
+ }
1800
+ handleResize() {
1801
+ this.size = getSize(this.host.clientWidth);
1802
+ }
1803
+ updateStates(states) {
1804
+ // Use peer specific store if available, otherwise fall back to global store
1805
+ const targetStore = this.peerStore || uiStore.uiStore;
1806
+ const newStates = Object.assign({}, targetStore.state.states);
1807
+ targetStore.state.states = merge.deepMerge(newStates, states);
1808
+ // Emit unscoped event for backward compatibility
1809
+ this.statesUpdate.emit(targetStore.state.states);
1810
+ // Also emit a scoped event that only this meeting's components should listen to
1811
+ const scopedEvent = new CustomEvent('rtkStatesUpdate', {
1812
+ detail: targetStore.state.states,
1813
+ bubbles: true,
1814
+ composed: true,
1815
+ });
1816
+ this.host.dispatchEvent(scopedEvent);
1817
+ }
1818
+ render() {
1819
+ const defaults = {
1820
+ meeting: this.meeting,
1821
+ size: this.size,
1822
+ states: (this.peerStore || uiStore.uiStore).state.states,
1823
+ config: this.config || uiStore.createDefaultConfig(),
1824
+ iconPack: this.iconPack,
1825
+ t: this.t,
1826
+ };
1827
+ if ((this.peerStore || uiStore.uiStore).state.states.viewType === 'CHAT') {
1828
+ return index$1.h("rtk-chat", Object.assign({}, defaults));
1829
+ }
1830
+ const elementProps = {
1831
+ 'rtk-grid': {
1832
+ layout: this.gridLayout,
1833
+ },
1834
+ };
1835
+ return index$1.h(index$2.Render, { element: "rtk-meeting", defaults: defaults, asHost: true, elementProps: elementProps });
1836
+ }
1837
+ get host() { return index$1.getElement(this); }
1838
+ static get watchers() { return {
1839
+ "meeting": ["meetingChanged"],
1840
+ "iconPack": ["iconPackChanged"],
1841
+ "t": ["tChanged"],
1842
+ "config": ["configChanged"]
1843
+ }; }
1844
+ };
1845
+ RtkMeeting.style = RtkMeetingStyle0;
1846
+
1847
+ const rtkMenuCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:inline-block;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#menu-list{position:absolute;z-index:20;display:none}";
1848
+ const RtkMenuStyle0 = rtkMenuCss;
1849
+
1850
+ var __decorate$6 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1851
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1852
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1853
+ r = Reflect.decorate(decorators, target, key, desc);
1854
+ else
1855
+ for (var i = decorators.length - 1; i >= 0; i--)
1856
+ if (d = decorators[i])
1857
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1858
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1859
+ };
1860
+ const RtkMenu$1 = class {
1861
+ constructor(hostRef) {
1862
+ index$1.registerInstance(this, hostRef);
1863
+ this.clickedThis = false;
1864
+ /** Placement of menu */
1865
+ this.placement = 'bottom-end';
1866
+ /** Offset in px */
1867
+ this.offset = 10;
1868
+ /** Icon pack */
1869
+ this.iconPack = uiStore.defaultIconPack;
1870
+ /** Language */
1871
+ this.t = uiStore.useLanguage();
1872
+ this.handleOutsideClick = () => {
1873
+ // handles clicking on other menu triggers
1874
+ if (!this.clickedThis) {
1875
+ // if other trigger is clicked, hide this menu-list
1876
+ this.menuListEl.style.display = 'none';
1877
+ }
1878
+ // reset the value
1879
+ this.clickedThis = false;
1880
+ };
1881
+ }
1882
+ componentDidLoad() {
1883
+ document.addEventListener('click', this.handleOutsideClick);
1884
+ this.update();
1885
+ }
1886
+ disconnectedCallback() {
1887
+ document.removeEventListener('click', this.handleOutsideClick);
1888
+ }
1889
+ update() {
1890
+ floatingUi_dom_esm.computePosition(this.triggerEl, this.menuListEl, {
1891
+ placement: this.placement,
1892
+ middleware: [floatingUi_dom_esm.offset(this.offset), floatingUi_dom_esm.flip(), floatingUi_dom_esm.shift({ padding: 5 })],
1893
+ }).then(({ x, y }) => {
1894
+ Object.assign(this.menuListEl.style, {
1895
+ left: `${x}px`,
1896
+ top: `${y}px`,
1897
+ });
1898
+ });
1899
+ }
1900
+ render() {
1901
+ return (index$1.h(index$1.Host, { key: 'b019210ff85bde38c61855f8ac38aa8b927aa857' }, index$1.h("span", { key: '14f689eed0672642c3a181ee5d197d7a9b5c00a8', id: "trigger", ref: (el) => (this.triggerEl = el), onClick: () => {
1902
+ this.clickedThis = true;
1903
+ if (this.menuListEl.style.display !== 'block') {
1904
+ this.menuListEl.style.display = 'block';
1905
+ this.update();
1906
+ }
1907
+ else {
1908
+ this.menuListEl.style.display = 'none';
1909
+ }
1910
+ } }, index$1.h("slot", { key: 'f1ab2111e0ad309df5b38e4f189d821b8ab50a4a', name: "trigger" })), index$1.h("span", { key: 'ec03b8c7ff60dd21dce3bc1f9b473ab59ec37ace', part: "menu-list", id: "menu-list", ref: (el) => (this.menuListEl = el) }, index$1.h("slot", { key: 'bc05fba324ccf4360340b070c8d4f3723a72cf6e' }))));
1911
+ }
1912
+ };
1913
+ __decorate$6([
1914
+ index.SyncWithStore()
1915
+ ], RtkMenu$1.prototype, "iconPack", void 0);
1916
+ __decorate$6([
1917
+ index.SyncWithStore()
1918
+ ], RtkMenu$1.prototype, "t", void 0);
1919
+ RtkMenu$1.style = RtkMenuStyle0;
1920
+
1921
+ const rtkMenuItemCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px}::slotted([slot='start']){margin-right:var(--rtk-space-2, 8px)}::slotted([slot='end']){margin-left:var(--rtk-space-2, 8px)}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host(.red){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}";
1922
+ const RtkMenuItemStyle0 = rtkMenuItemCss;
1923
+
1924
+ var __decorate$5 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1925
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1926
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1927
+ r = Reflect.decorate(decorators, target, key, desc);
1928
+ else
1929
+ for (var i = decorators.length - 1; i >= 0; i--)
1930
+ if (d = decorators[i])
1931
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1932
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1933
+ };
1934
+ const RtkMenuItem = class {
1935
+ constructor(hostRef) {
1936
+ index$1.registerInstance(this, hostRef);
1937
+ /** Icon pack */
1938
+ this.iconPack = uiStore.defaultIconPack;
1939
+ /** Language */
1940
+ this.t = uiStore.useLanguage();
1941
+ }
1942
+ render() {
1943
+ return (index$1.h(index$1.Host, { key: 'a5c802aa2cb8cb235dc1e68d54ec9703c57df0b9' }, index$1.h("slot", { key: 'b448160fdd220fd814d471ddc08d7f784af10c49', name: "start" }), index$1.h("slot", { key: '0b342d2547a7835ea23d1974c3fd1b2e3507e779' }), index$1.h("slot", { key: '6670a8ed947d2bd6fb1651e9c6c1cd52f5ca419c', name: "end" })));
1944
+ }
1945
+ };
1946
+ __decorate$5([
1947
+ index.SyncWithStore()
1948
+ ], RtkMenuItem.prototype, "iconPack", void 0);
1949
+ __decorate$5([
1950
+ index.SyncWithStore()
1951
+ ], RtkMenuItem.prototype, "t", void 0);
1952
+ RtkMenuItem.style = RtkMenuItemStyle0;
1953
+
1954
+ const rtkMenuListCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:-moz-max-content;width:max-content;flex-direction:column;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}";
1955
+ const RtkMenuListStyle0 = rtkMenuListCss;
1956
+
1957
+ var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1958
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1959
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1960
+ r = Reflect.decorate(decorators, target, key, desc);
1961
+ else
1962
+ for (var i = decorators.length - 1; i >= 0; i--)
1963
+ if (d = decorators[i])
1964
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1965
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1966
+ };
1967
+ const RtkMenuList = class {
1968
+ constructor(hostRef) {
1969
+ index$1.registerInstance(this, hostRef);
1970
+ /** Icon pack */
1971
+ this.iconPack = uiStore.defaultIconPack;
1972
+ /** Language */
1973
+ this.t = uiStore.useLanguage();
1974
+ }
1975
+ render() {
1976
+ return (index$1.h(index$1.Host, { key: '1357690e48bef0c8c0e953886f1fd7754f0e4e4d' }, index$1.h("slot", { key: 'f3a221b7a4d28f53add6b658a0510294a998d6c1' })));
1977
+ }
1978
+ };
1979
+ __decorate$4([
1980
+ index.SyncWithStore()
1981
+ ], RtkMenuList.prototype, "iconPack", void 0);
1982
+ __decorate$4([
1983
+ index.SyncWithStore()
1984
+ ], RtkMenuList.prototype, "t", void 0);
1985
+ RtkMenuList.style = RtkMenuListStyle0;
1986
+
1987
+ const rtkMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{max-width:var(--rtk-space-96, 384px)}.message-wrapper{display:flex;flex-direction:row-reverse;align-items:flex-start;gap:var(--rtk-space-2, 8px)}.message-wrapper.incoming{flex-direction:row}.message{display:flex;flex-direction:column;align-items:flex-end}.incoming .message{display:flex;flex-direction:column;align-items:flex-start}.header{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);align-self:flex-end;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:12px;font-weight:600}.incoming .header{align-self:flex-start}.body{display:flex;flex-direction:column;min-width:var(--rtk-space-24, 96px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:14px;line-height:1.375;position:relative}.bubble{max-width:90%;padding:var(--rtk-space-2, 8px);border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:var(--rtk-border-radius-md, 8px)}.incoming .bubble{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.metadata{margin-top:var(--rtk-space-2, 8px);align-self:flex-end;font-size:10px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.avatar{display:none}rtk-menu{position:absolute;right:var(--rtk-space-0, 0px);top:var(--rtk-space-0, 0px);border-radius:var(--rtk-border-radius-lg, 12px)}rtk-menu rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}.actions{display:flex;align-items:center;justify-content:center;padding-left:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background:radial-gradient(\n at top right,\n rgb(var(--rtk-colors-brand-300, 73 124 253)) 60%,\n rgba(255, 255, 255, 0) 80%\n )}.actions rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.incoming .actions{background:radial-gradient(\n at top right,\n rgb(var(--rtk-colors-background-800, 30 30 30)) 60%,\n rgba(255, 255, 255, 0) 80%\n )}.incoming .actions rtk-icon{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.incoming rtk-avatar{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}@media (min-width: 400px){.avatar{display:flex;width:var(--rtk-space-6, 24px)}.avatar rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);font-size:10px;overflow:clip;border-radius:9999px}}@media (hover: hover){rtk-menu{visibility:hidden}.body:hover rtk-menu{visibility:visible}}";
1988
+ const RtkMessageViewStyle0 = rtkMessageViewCss;
1989
+
1990
+ var __decorate$3 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
1991
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1992
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
1993
+ r = Reflect.decorate(decorators, target, key, desc);
1994
+ else
1995
+ for (var i = decorators.length - 1; i >= 0; i--)
1996
+ if (d = decorators[i])
1997
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1998
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1999
+ };
2000
+ const RtkMessageView = class {
2001
+ constructor(hostRef) {
2002
+ index$1.registerInstance(this, hostRef);
2003
+ this.onAction = index$1.createEvent(this, "action", 7);
2004
+ /** List of actions to show in menu */
2005
+ this.actions = [];
2006
+ /** Appearance */
2007
+ this.variant = 'bubble';
2008
+ /** Render */
2009
+ this.viewType = 'outgoing';
2010
+ /** Hides avatar */
2011
+ this.hideAvatar = false;
2012
+ /** Is the message sent by the current user */
2013
+ this.isSelf = false;
2014
+ /** Hides author display label */
2015
+ this.hideAuthorName = false;
2016
+ /** Hides metadata (time) */
2017
+ this.hideMetadata = false;
2018
+ /** Icon pack */
2019
+ this.iconPack = uiStore.defaultIconPack;
2020
+ }
2021
+ renderActions() {
2022
+ return (index$1.h("rtk-menu", { placement: "top-end", offset: 1 }, index$1.h("button", { slot: "trigger", class: "actions" }, index$1.h("rtk-icon", { icon: this.iconPack.chevron_down })), index$1.h("rtk-menu-list", null, this.actions.map((action) => (index$1.h("rtk-menu-item", { onClick: () => this.onAction.emit(action.id) }, action.icon && index$1.h("rtk-icon", { icon: action.icon, slot: "start" }), action.label))))));
2023
+ }
2024
+ render() {
2025
+ return (index$1.h(index$1.Host, { key: '61882011f477f816296277a4f2d5622d224e47f0' }, index$1.h("div", { key: 'ae21bfc0c499879da6a2167f0cad5203475de696', class: { 'message-wrapper': true, [this.viewType]: true } }, !this.hideAvatar && (index$1.h("aside", { key: '73b10ebb1dccdc4e2c9258f185eb14f07d11d542', class: "avatar", part: "avatar" }, index$1.h("rtk-avatar", { key: 'e07971bf9d7738fb2dcc015d339a13d5dca7c6f7', participant: { name: this.authorName, picture: this.avatarUrl }, size: "sm" }))), index$1.h("div", { key: '1e24801f717589e598c4160bea7ab10a59acfcc2', class: "message", part: "message" }, !this.hideAuthorName && (index$1.h("div", { key: '3178f750ad798b7d83508f82ead36ee5407fee4c', class: "header" }, this.authorName, " ", this.isSelf ? ' (You)' : '')), index$1.h("div", { key: '056445ef0c557d7d756330df5778ad8bc2d41e60', class: { body: true, bubble: this.variant === 'bubble' } }, index$1.h("slot", { key: '6d5486666ce2238e4387c2621d562b24704a9317' }), !this.hideMetadata && !!this.time && (index$1.h("div", { key: '1d4b9bdbb3aaf288dce4b43a31354df3d413b2b4', class: "metadata", title: date.formatDateTime(this.time) }, date.elapsedDuration(this.time, new Date(Date.now())))), this.actions.length !== 0 && this.renderActions())))));
2026
+ }
2027
+ };
2028
+ __decorate$3([
2029
+ index.SyncWithStore()
2030
+ ], RtkMessageView.prototype, "iconPack", void 0);
2031
+ RtkMessageView.style = RtkMessageViewStyle0;
2032
+
2033
+ const rtkPaginatedListCss = ".scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))\n var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;flex:1}.container{box-sizing:border-box;display:flex;flex-direction:column-reverse;padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);flex:1 0 0px;overflow-y:scroll}.file-picker{display:none}.chat *:first-child{margin-top:var(--rtk-space-0, 0px)}.chat .head{display:flex;align-items:center}.chat .head .name{margin-right:var(--rtk-space-4, 16px);font-size:12px;font-weight:700}.chat .head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat .body{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);overflow-wrap:break-word;font-size:14px;line-height:1.375}.chat .body .emoji{font-size:24px}p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}rtk-text-message,rtk-image-message,rtk-file-message{margin-top:var(--rtk-space-4, 16px);display:block;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}*[is-continued]{margin-top:var(--rtk-space-3, 12px)}rtk-text-message[is-continued]{margin-top:var(--rtk-space-2, 8px)}.chat .image{position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.chat .image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.chat .image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.chat .image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.chat .image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.chat .image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}.chat .file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1\\.5, 6px);padding-bottom:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.chat .file .file-data{flex:1 1 0%}.chat .file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.chat .file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.chat .file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}.smallest-dom-element{width:1px}#top-scroll{transform:translateY(20vh)}#bottom-scroll{transform:translateY(-20vh)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.show-new-messages-ctr{pointer-events:none;position:absolute;bottom:var(--rtk-space-2, 8px);right:var(--rtk-space-4, 16px);z-index:10;margin-top:calc(var(--rtk-space-14, 56px) * -1);--tw-translate-y:var(--rtk-space-28, 112px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter, -webkit-backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages-ctr.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}.show-new-messages{pointer-events:auto;border-radius:9999px}.show-new-messages:hover{border-radius:9999px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-ring-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}rtk-spinner,.empty-list{margin:auto}.page-wrapper{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.message-wrapper{margin-bottom:var(--rtk-space-2, 8px)}.pinned .message-wrapper{position:relative}.pinned .pin-icon{position:absolute;right:calc(var(--rtk-space-1, 4px) * -1);top:calc(var(--rtk-space-1, 4px) * -1);display:flex;border-radius:var(--rtk-border-radius-sm, 4px)}.pinned rtk-message-view{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px)}.load-more-on-top-container{pointer-events:none;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-4, 16px);z-index:10}.load-more-icon{pointer-events:auto;border-radius:9999px}.load-more-icon:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-ring-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}";
2034
+ const RtkPaginatedListStyle0 = rtkPaginatedListCss;
2035
+
2036
+ var __decorate$2 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2037
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2038
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2039
+ r = Reflect.decorate(decorators, target, key, desc);
2040
+ else
2041
+ for (var i = decorators.length - 1; i >= 0; i--)
2042
+ if (d = decorators[i])
2043
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2044
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2045
+ };
2046
+ const RtkPaginatedList = class {
2047
+ constructor(hostRef) {
2048
+ index$1.registerInstance(this, hostRef);
2049
+ /** Icon pack */
2050
+ this.iconPack = uiStore.defaultIconPack;
2051
+ /** Language */
2052
+ this.t = uiStore.useLanguage();
2053
+ /** label to show when empty */
2054
+ this.emptyListLabel = null;
2055
+ this.isLoading = false;
2056
+ this.isLoadingTop = false;
2057
+ this.isLoadingBottom = false;
2058
+ this.hasMoreDataAtTop = false;
2059
+ this.rerenderBoolean = false;
2060
+ /**
2061
+ * This gets disabled when the user scrolls up and the bottom node
2062
+ * is not visible anymore.
2063
+ */
2064
+ this.shouldRenderNewNodes = true;
2065
+ /**
2066
+ * This gets disabled when the user scrolls up and the bottom node
2067
+ * is not visible anymore.
2068
+ */
2069
+ this.hasNewNodesToRender = false;
2070
+ this.showEmptyListLabel = false;
2071
+ /**
2072
+ * This is a private variable not a state
2073
+ * since we want to debounce rerenders
2074
+ *
2075
+ * A list of pages where each page contains a number of Nodes
2076
+ * [
2077
+ * [Node 1, Node 2, Node 3.... Node N],
2078
+ * [Node 1, Node 2, Node 3.... Node N],
2079
+ * ]
2080
+ */
2081
+ this.pagesToRender = [[]];
2082
+ this.currentTime = () => {
2083
+ return new Date().getTime();
2084
+ };
2085
+ this.observe = (el) => {
2086
+ if (!el)
2087
+ return;
2088
+ this.intersectionObserver.observe(el);
2089
+ };
2090
+ }
2091
+ /**
2092
+ * On a new node created
2093
+ */
2094
+ async onNewNode(node) {
2095
+ if (!this.shouldRenderNewNodes) {
2096
+ this.hasNewNodesToRender = true;
2097
+ return;
2098
+ }
2099
+ this.addNodeToRender(node, false);
2100
+ this.rerender();
2101
+ }
2102
+ /**
2103
+ * On node deleted
2104
+ */
2105
+ async onNodeDelete(key) {
2106
+ const oldLength = this.pagesToRender.flat().length;
2107
+ this.pagesToRender = this.pagesToRender.map((page) => page.filter((item) => item.id !== key));
2108
+ if (oldLength !== this.pagesToRender.flat().length) {
2109
+ this.rerender();
2110
+ }
2111
+ }
2112
+ /**
2113
+ * On node updated
2114
+ */
2115
+ async onNodeUpdate(key, newItem) {
2116
+ let shouldRerender = false;
2117
+ this.pagesToRender = this.pagesToRender.map((page) => page.map((item) => {
2118
+ if (item.id === key) {
2119
+ shouldRerender = true;
2120
+ return newItem;
2121
+ }
2122
+ return item;
2123
+ }));
2124
+ if (shouldRerender)
2125
+ this.rerender();
2126
+ }
2127
+ onItemChanged(newItemId, oldItemId) {
2128
+ if (newItemId !== oldItemId) {
2129
+ this.pagesToRender = [[]];
2130
+ this.loadFirstPage().then(() => this.rerender());
2131
+ }
2132
+ }
2133
+ connectedCallback() {
2134
+ this.rerender = debounce.debounce(this.rerender.bind(this), 50, { maxWait: 200 });
2135
+ this.autoScroll = true;
2136
+ this.intersectionObserver = new IntersectionObserver((entries) => {
2137
+ index$1.writeTask(() => {
2138
+ for (const entry of entries) {
2139
+ if (entry.target.id === 'bottom-scroll') {
2140
+ if (entry.isIntersecting)
2141
+ this.loadBottom();
2142
+ else
2143
+ this.shouldRenderNewNodes = false;
2144
+ }
2145
+ if (entry.target.id === 'top-scroll' && entry.isIntersecting) {
2146
+ this.loadTop();
2147
+ }
2148
+ }
2149
+ });
2150
+ });
2151
+ }
2152
+ disconnectedCallback() {
2153
+ this.intersectionObserver.disconnect();
2154
+ }
2155
+ componentDidLoad() {
2156
+ /**
2157
+ * Adding observes here so that on the first render we scroll down
2158
+ * and shouldRenderNewNodes remains true
2159
+ */
2160
+ this.loadFirstPage();
2161
+ this.observe(this.$topRef);
2162
+ this.observe(this.$bottomRef);
2163
+ }
2164
+ componentDidRender() {
2165
+ if (this.shouldRenderNewNodes && this.autoScroll)
2166
+ scroll.smoothScrollToBottom(this.$paginatedList);
2167
+ }
2168
+ loadFirstPage() {
2169
+ return this.loadPage(this.currentTime(), this.pageSize, true, (data) => {
2170
+ if (data.length === 0) {
2171
+ this.showEmptyListLabel = true;
2172
+ }
2173
+ });
2174
+ }
2175
+ loadTop() {
2176
+ /**
2177
+ * If there is only one unfilled page or no page, no need to check
2178
+ * for top since it will be empty
2179
+ */
2180
+ if (this.pagesToRender.length === 0)
2181
+ return;
2182
+ if (this.pagesToRender.length === 1 && this.pagesToRender[0].length < this.pageSize)
2183
+ return;
2184
+ /**
2185
+ * TODO: Make this more flexible currently this only works with chat
2186
+ */
2187
+ const oldestVNode = this.pagesToRender[0][0];
2188
+ const oldestTimestamp = oldestVNode.timeMs;
2189
+ // TODO: scrollIntoView
2190
+ const onPageRendered = () => { }; // oldestVNode.$elm$?.scrollIntoView();
2191
+ this.isLoadingTop = true;
2192
+ this.loadPage(oldestTimestamp - 1, this.pageSize, true, onPageRendered, 'top');
2193
+ }
2194
+ loadBottom() {
2195
+ /**
2196
+ * If there is only one unfilled page or no page, no need to check
2197
+ * for top since it will be empty
2198
+ */
2199
+ if (this.pagesToRender.length === 0) {
2200
+ this.shouldRenderNewNodes = true;
2201
+ return;
2202
+ }
2203
+ if (this.pagesToRender.length === 1 && this.pagesToRender[0].length < this.pageSize) {
2204
+ this.shouldRenderNewNodes = true;
2205
+ return;
2206
+ }
2207
+ const newestVNode = this.pagesToRender.at(-1).at(-1);
2208
+ const newestTimestamp = newestVNode.timeMs;
2209
+ // TODO: scrollIntoView
2210
+ const onPageRendered = () => scroll.smoothScrollToBottom(this.$paginatedList);
2211
+ this.isLoadingBottom = true;
2212
+ this.loadPage(newestTimestamp + 1, this.pageSize, false, onPageRendered, 'bottom');
2213
+ }
2214
+ addNodeToRender(node, addToStart) {
2215
+ if (addToStart) {
2216
+ const firstPage = this.pagesToRender[0];
2217
+ if (firstPage && (firstPage === null || firstPage === void 0 ? void 0 : firstPage.length) < this.pageSize) {
2218
+ /**
2219
+ * If first page is not full then just add to that page
2220
+ */
2221
+ firstPage.unshift(node);
2222
+ }
2223
+ else {
2224
+ /**
2225
+ * If first page is full then add a new page to the start
2226
+ */
2227
+ const newPage = [node];
2228
+ this.pagesToRender.unshift(newPage);
2229
+ this.removeLastPageIfNeeded(false);
2230
+ }
2231
+ }
2232
+ else {
2233
+ const [lastPage] = this.pagesToRender.slice(-1);
2234
+ if (lastPage && (lastPage === null || lastPage === void 0 ? void 0 : lastPage.length) < this.pageSize) {
2235
+ /**
2236
+ * If last page is not full then just add it
2237
+ */
2238
+ lastPage.push(node);
2239
+ }
2240
+ else {
2241
+ /**
2242
+ * If last page is full add a new page with just
2243
+ * this node
2244
+ */
2245
+ const newPage = [node];
2246
+ this.pagesToRender.push(newPage);
2247
+ this.removeLastPageIfNeeded(true);
2248
+ }
2249
+ }
2250
+ }
2251
+ /**
2252
+ * @param start
2253
+ * @param end
2254
+ * @param reversed Defines whether to add the page at the beginning or the end
2255
+ * @param onPageLoaded Callback for when all new nodes are rendered
2256
+ * @param direction Indicates if loading from 'top' or 'bottom'
2257
+ */
2258
+ async loadPage(timestamp, size, reversed, onPageRendered = () => { }, direction) {
2259
+ this.isLoading = true;
2260
+ const data = (await this.fetchData(timestamp, size, reversed));
2261
+ this.isLoading = false;
2262
+ if (direction === 'top') {
2263
+ this.isLoadingTop = false;
2264
+ this.hasMoreDataAtTop = (data === null || data === void 0 ? void 0 : data.length) > 0;
2265
+ }
2266
+ if (direction === 'bottom') {
2267
+ this.isLoadingBottom = false;
2268
+ }
2269
+ if (!(data === null || data === void 0 ? void 0 : data.length)) {
2270
+ /**
2271
+ * While scrolling down if there were no new items found
2272
+ * then start rendering new nodes;
2273
+ */
2274
+ if (!reversed) {
2275
+ this.hasNewNodesToRender = false;
2276
+ this.shouldRenderNewNodes = true;
2277
+ }
2278
+ onPageRendered([]);
2279
+ return;
2280
+ }
2281
+ data.forEach((node) => this.addNodeToRender(node, reversed));
2282
+ this.rerender();
2283
+ onPageRendered(data);
2284
+ }
2285
+ rerender() {
2286
+ this.rerenderBoolean = !this.rerenderBoolean;
2287
+ }
2288
+ removeLastPageIfNeeded(removeFromStart) {
2289
+ if (this.pagesToRender.length > this.pagesAllowed) {
2290
+ if (removeFromStart)
2291
+ this.pagesToRender.shift();
2292
+ else
2293
+ this.pagesToRender.pop();
2294
+ }
2295
+ }
2296
+ onDownArrowClicked() {
2297
+ /**
2298
+ * Load the freshest pages
2299
+ */
2300
+ this.loadBottom();
2301
+ }
2302
+ onLoadMoreOnTopClicked() {
2303
+ this.loadTop();
2304
+ }
2305
+ render() {
2306
+ var _a;
2307
+ /**
2308
+ * div.container is flex=column-reverse
2309
+ * which is why div#bottom-scroll comes before div#top-scroll
2310
+ * div.page-wrapper prevents reversal of messages
2311
+ */
2312
+ return (index$1.h(index$1.Host, { key: '23e10f12b079213650cf9c947d30650ba8c95a4d' }, index$1.h("div", { key: 'b5406069fd69ff117b19d437184c38b3c7d2fc28', class: "scrollbar container", part: "container", ref: (el) => (this.$paginatedList = el) }, index$1.h("div", { key: '7be947f2409ff810e0d10beea53ace8fdec334ce', class: { 'show-new-messages-ctr': true, active: !this.shouldRenderNewNodes } }, index$1.h("rtk-button", { key: '45c43d6ca1cc39376334dffa10f3f2c137d65add', class: "show-new-messages", kind: "icon", variant: "secondary", part: "show-new-messages", onClick: () => this.onDownArrowClicked() }, index$1.h("rtk-icon", { key: '519b0db80f7d16cc4d03983e227d4897a5868ec9', icon: this.iconPack.chevron_down }))), index$1.h("div", { key: '53691e3943b90ef9e422c8da8f5facaa23f01920', class: "smallest-dom-element", id: "bottom-scroll", ref: (el) => (this.$bottomRef = el) }), this.isLoadingBottom && index$1.h("rtk-spinner", { key: '2a393cb0bbb07c356144464dcc7c597f5cc9771b', size: "sm" }), this.isLoading && this.pagesToRender.flat().length === 0 && index$1.h("rtk-spinner", { key: '4ce03be69368db0d6d0d4ad079b14f2c7d93f26d', size: "lg" }), this.pagesToRender.flat().length === 0 && this.showEmptyListLabel ? (index$1.h("div", { class: "empty-list" }, (_a = this.emptyListLabel) !== null && _a !== void 0 ? _a : this.t('list.empty'))) : (index$1.h("div", { class: "page-wrapper" }, this.pagesToRender.map((page) => this.createNodes(page)))), this.hasMoreDataAtTop && !this.isLoadingTop && (index$1.h("div", { key: '5c85806854687efe098e4bd6d06d109060445378', class: "load-more-on-top-container" }, index$1.h("rtk-button", { key: '6d73a030fad5ba133aa2841b2feb196646592ada', class: "load-more-icon", kind: "icon", variant: "secondary", part: "load-more-icon", onClick: () => this.onLoadMoreOnTopClicked() }, index$1.h("rtk-icon", { key: '61a4f376749938df280e5c734dd3fa8a9b0b7201', icon: this.iconPack.chevron_up })))), this.isLoadingTop && index$1.h("rtk-spinner", { key: '3e55b99c60ed7bc2cd937091a33663dd19c9ca68', size: "sm" }), index$1.h("div", { key: 'a69e0a3a26d295783f4f729b33770b206ab5d46b', class: "smallest-dom-element", id: "top-scroll", ref: (el) => (this.$topRef = el) }))));
2313
+ }
2314
+ static get watchers() { return {
2315
+ "selectedItemId": ["onItemChanged"]
2316
+ }; }
2317
+ };
2318
+ __decorate$2([
2319
+ index.SyncWithStore()
2320
+ ], RtkPaginatedList.prototype, "iconPack", void 0);
2321
+ __decorate$2([
2322
+ index.SyncWithStore()
2323
+ ], RtkPaginatedList.prototype, "t", void 0);
2324
+ RtkPaginatedList.style = RtkPaginatedListStyle0;
2325
+
2326
+ const rtkSpinnerCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:block;height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);--rtk-spinner-color:currentColor}.spinner{height:100%;width:100%}@keyframes spin{to{transform:rotate(360deg)}}.spinner{animation:spin 1s linear infinite;border-radius:9999px;background-color:transparent;animation-duration:1.3s}:host([size='md']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}";
2327
+ const RtkSpinnerStyle0 = rtkSpinnerCss;
2328
+
2329
+ var __decorate$1 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2330
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2331
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2332
+ r = Reflect.decorate(decorators, target, key, desc);
2333
+ else
2334
+ for (var i = decorators.length - 1; i >= 0; i--)
2335
+ if (d = decorators[i])
2336
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2337
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2338
+ };
2339
+ const RtkSpinner = class {
2340
+ constructor(hostRef) {
2341
+ index$1.registerInstance(this, hostRef);
2342
+ /** Icon pack */
2343
+ this.iconPack = uiStore.defaultIconPack;
2344
+ /** Size */
2345
+ this.size = 'md';
2346
+ }
2347
+ render() {
2348
+ return (index$1.h(index$1.Host, { key: '2eb8672a849f85e2c207ec9331d1093b7deefaa3' }, index$1.h("rtk-icon", { key: '5a2f292ddd7a5c52709ce41f47422f08bdf82852', class: "spinner", icon: this.iconPack.spinner })));
2349
+ }
2350
+ };
2351
+ __decorate$1([
2352
+ index.SyncWithStore()
2353
+ ], RtkSpinner.prototype, "iconPack", void 0);
2354
+ RtkSpinner.style = RtkSpinnerStyle0;
2355
+
2356
+ const rtkTextComposerViewCss = ".chat-input {\n position: relative;\n z-index: 10;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n border-top-left-radius: var(--rtk-border-radius-md, 8px);\n border-top-right-radius: var(--rtk-border-radius-md, 8px)\n}\n\n .chat-input textarea {\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));\n box-sizing: border-box;\n padding: var(--rtk-space-3, 12px);\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea::-moz-placeholder {\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea::placeholder {\n color: rgb(var(--rtk-colors-text-1000, 255 255 255))\n}\n\n .chat-input textarea {\n font-family: var(--rtk-font-family, sans-serif);\n outline: 2px solid transparent;\n outline-offset: 2px;\n resize: none;\n overflow-y: auto;\n border-width: var(--rtk-border-width-none, 0);\n border-style: none;\n min-height: 60px;\n font-size: 14px\n}\n\n@container chatcontainer (height < 360px) {\n textarea {\n height: 30px !important;\n min-height: 30px !important\n }\n}\n\n.text-error {\n left: var(--rtk-space-0, 0px);\n z-index: 10;\n margin-top: var(--rtk-space-1, 4px);\n margin-left: var(--rtk-space-1, 4px);\n display: flex;\n width: -moz-fit-content;\n width: fit-content;\n align-items: center;\n justify-content: flex-start;\n border-radius: var(--rtk-border-radius-sm, 4px);\n --tw-border-opacity: 1;\n border-color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-border-opacity));\n --tw-bg-opacity: 1;\n background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));\n padding-left: var(--rtk-space-2, 8px);\n padding-right: var(--rtk-space-2, 8px);\n font-size: 12px;\n font-weight: 600;\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity));\n border: 1px solid\n}\n\n#warning-indicator {\n margin-right: var(--rtk-space-1, 4px);\n height: var(--rtk-space-3, 12px);\n width: var(--rtk-space-3, 12px)\n}\n\n.text-error.breached {\n --tw-border-opacity: 1;\n border-color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity));\n --tw-text-opacity: 1;\n color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))\n}";
2357
+ const RtkTextComposerViewStyle0 = rtkTextComposerViewCss;
2358
+
2359
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
2360
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2361
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
2362
+ r = Reflect.decorate(decorators, target, key, desc);
2363
+ else
2364
+ for (var i = decorators.length - 1; i >= 0; i--)
2365
+ if (d = decorators[i])
2366
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2367
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2368
+ };
2369
+ const RtkTextComposerView = class {
2370
+ constructor(hostRef) {
2371
+ index$1.registerInstance(this, hostRef);
2372
+ this.onTextChange = index$1.createEvent(this, "textChange", 7);
2373
+ /** Disable the text input (default = false) */
2374
+ this.disabled = false;
2375
+ /** Boolean to indicate if rate limit is breached */
2376
+ this.rateLimitBreached = false;
2377
+ /** Keydown event handler function */
2378
+ this.keyDownHandler = () => { };
2379
+ /** Icon pack */
2380
+ this.iconPack = uiStore.defaultIconPack;
2381
+ /** Language */
2382
+ this.t = uiStore.useLanguage();
2383
+ this.maxLengthBreached = 0;
2384
+ this.onInputHandler = () => {
2385
+ const text = this.$textArea.value.trim();
2386
+ this.maybeResize(text);
2387
+ this.checkLength(text);
2388
+ this.onTextChange.emit(text);
2389
+ };
2390
+ this.maybeResize = (text) => {
2391
+ const newLines = [...text.matchAll(/\n/g)].length;
2392
+ this.$textArea.style.height = `${Math.min(200, 60 + 20 * newLines)}px`;
2393
+ };
2394
+ }
2395
+ componentDidLoad() {
2396
+ if (this.maxLength) {
2397
+ this.$textArea.maxLength = this.maxLength;
2398
+ }
2399
+ const text = this.$textArea.value.trim();
2400
+ if (text !== '') {
2401
+ this.maybeResize(text);
2402
+ }
2403
+ this.$textArea.focus();
2404
+ }
2405
+ /** Sets value of the text input */
2406
+ async setText(text, focus = false) {
2407
+ this.$textArea.value = text;
2408
+ this.maybeResize(text);
2409
+ if (focus) {
2410
+ this.$textArea.focus();
2411
+ }
2412
+ this.checkLength(text);
2413
+ this.onTextChange.emit(text);
2414
+ }
2415
+ checkLength(text) {
2416
+ // unicode code length
2417
+ const textLen = text.length;
2418
+ if (textLen + 10 >= this.maxLength) {
2419
+ this.maxLengthBreached = text.length;
2420
+ }
2421
+ else if (textLen + 10 < this.maxLength && this.maxLengthBreached > 0) {
2422
+ this.maxLengthBreached = 0;
2423
+ }
2424
+ }
2425
+ render() {
2426
+ return (index$1.h("div", { key: '1b51f7d6ffbe8069172a5dc51f291988000c898a', class: "chat-input", part: "chat-input-container" }, this.maxLengthBreached > 0 && (index$1.h("div", { key: 'fe75f8333a7643458d5077fec968464327e65ca3', class: 'text-error ' + (this.maxLengthBreached === this.maxLength ? 'breached' : '') }, index$1.h("rtk-icon", { key: '669066f9983f226d96baeebdfa10ffb1fc8001b7', id: "warning-indicator", icon: this.iconPack.warning, part: "warning-indicator" }), ' ', this.maxLengthBreached, " / ", this.maxLength, " ", this.t('chat.max_limit_warning'))), this.rateLimitBreached && (index$1.h("div", { key: '0024d3b4e8d5eda5f94ff2fe9d8aa18cfb9297a7', class: 'text-error breached' }, index$1.h("rtk-icon", { key: 'bc3a0417a81de43b67595cde79dfe7aba21a6601', id: "warning-indicator", icon: this.iconPack.warning, part: "warning-indicator" }), ' ', this.t('chat.rate_limit_error'))), index$1.h("textarea", { key: 'c6077b3128eeea4be2358ab557062df322a8ffa9', ref: (el) => (this.$textArea = el), placeholder: this.placeholder, disabled: this.disabled, onInput: this.onInputHandler, onKeyDown: this.keyDownHandler, part: "chat-input", value: this.value })));
2427
+ }
2428
+ };
2429
+ __decorate([
2430
+ index.SyncWithStore()
2431
+ ], RtkTextComposerView.prototype, "iconPack", void 0);
2432
+ __decorate([
2433
+ index.SyncWithStore()
2434
+ ], RtkTextComposerView.prototype, "t", void 0);
2435
+ RtkTextComposerView.style = RtkTextComposerViewStyle0;
2436
+
2437
+ const rtkTextMessageViewCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.text{word-break:break-word;display:block;overflow-wrap:break-word;line-height:1.375}.text.emoji{font-size:24px}";
2438
+ const RtkTextMessageViewStyle0 = rtkTextMessageViewCss;
2439
+
2440
+ const RtkTextMessageView = class {
2441
+ constructor(hostRef) {
2442
+ index$1.registerInstance(this, hostRef);
2443
+ /** Renders text as markdown (default = true) */
2444
+ this.isMarkdown = false;
2445
+ }
2446
+ render() {
2447
+ return (index$1.h("p", { key: '90e03b1cdd7271004b0ba2932d7e00342d0b884d', class: { text: true, emoji: string.hasOnlyEmojis(this.text) } }, this.isMarkdown ? index$1.h("rtk-markdown-view", { text: this.text }) : this.text));
2448
+ }
2449
+ };
2450
+ RtkTextMessageView.style = RtkTextMessageViewStyle0;
2451
+
2452
+ const rtkTooltipCss = ":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--background-color:var(--rtk-tooltip-background-color, rgb(var(--rtk-colors-background-600, 60 60 60)));--color:var(--rtk-tooltip-color, rgb(var(--rtk-colors-text-1000, 255 255 255)));display:inline-flex}#trigger{display:block;width:100%;flex:1 1 0%}.tooltip{max-width:var(--rtk-space-64, 256px);position:fixed;z-index:20;display:none;width:-moz-max-content;width:max-content;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);font-size:12px}.tooltip,#arrow{position:absolute;background-color:var(--background-color);color:var(--color)}#arrow{position:absolute;height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);transform:rotate(45deg)}:host([variant='primary']){--background-color:rgb(var(--rtk-colors-brand-500, 33 96 253));--color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host([kind='block']){display:block}";
2453
+ const RtkTooltipStyle0 = rtkTooltipCss;
2454
+
2455
+ const RtkMenu = class {
2456
+ constructor(hostRef) {
2457
+ index$1.registerInstance(this, hostRef);
2458
+ this.openChange = index$1.createEvent(this, "rtkOpenChange", 7);
2459
+ /** Tooltip label */
2460
+ this.label = '';
2461
+ /** Tooltip variant */
2462
+ this.variant = 'secondary';
2463
+ /** Disabled */
2464
+ this.disabled = false;
2465
+ /** Open */
2466
+ this.open = false;
2467
+ /** Tooltip kind */
2468
+ this.kind = 'inline';
2469
+ /** Placement of menu */
2470
+ this.placement = 'top';
2471
+ /** Delay before showing the tooltip */
2472
+ this.delay = 0;
2473
+ this.isInFocus = false;
2474
+ this.showMenu = () => {
2475
+ if (this.disabled)
2476
+ return;
2477
+ this.isInFocus = true;
2478
+ setTimeout(() => {
2479
+ if (this.isInFocus) {
2480
+ this.tooltipEl.style.display = 'block';
2481
+ this.update();
2482
+ this.openChange.emit(true);
2483
+ if (this.size === 'sm') {
2484
+ setTimeout(() => {
2485
+ if (this.isInFocus) {
2486
+ this.hideMenu();
2487
+ }
2488
+ }, 1000);
2489
+ }
2490
+ }
2491
+ }, this.delay);
2492
+ };
2493
+ this.hideMenu = () => {
2494
+ if (this.open || this.disabled)
2495
+ return;
2496
+ this.isInFocus = false;
2497
+ this.tooltipEl.style.display = 'none';
2498
+ this.openChange.emit(false);
2499
+ };
2500
+ }
2501
+ componentDidLoad() {
2502
+ this.triggerEl.addEventListener('focusin', this.showMenu);
2503
+ this.triggerEl.addEventListener('mouseenter', this.showMenu);
2504
+ this.triggerEl.addEventListener('focusout', this.hideMenu);
2505
+ this.triggerEl.addEventListener('mouseleave', this.hideMenu);
2506
+ index$1.writeTask(() => {
2507
+ this.openChanged(this.open);
2508
+ });
2509
+ }
2510
+ disconnectedCallback() {
2511
+ if (!this.triggerEl)
2512
+ return;
2513
+ this.triggerEl.removeEventListener('focusin', this.showMenu);
2514
+ this.triggerEl.removeEventListener('mouseenter', this.showMenu);
2515
+ this.triggerEl.removeEventListener('focusout', this.hideMenu);
2516
+ this.triggerEl.removeEventListener('mouseleave', this.hideMenu);
2517
+ this.triggerEl = undefined;
2518
+ }
2519
+ openChanged(open) {
2520
+ if (open) {
2521
+ this.showMenu();
2522
+ }
2523
+ else {
2524
+ this.hideMenu();
2525
+ }
2526
+ }
2527
+ update() {
2528
+ floatingUi_dom_esm.computePosition(this.triggerEl, this.tooltipEl, {
2529
+ placement: this.placement,
2530
+ middleware: [floatingUi_dom_esm.offset(8), floatingUi_dom_esm.flip(), floatingUi_dom_esm.shift({ padding: 5 }), floatingUi_dom_esm.arrow({ element: this.arrowEl })],
2531
+ }).then(({ x, y, placement, middlewareData }) => {
2532
+ Object.assign(this.tooltipEl.style, {
2533
+ left: `${x}px`,
2534
+ top: `${y}px`,
2535
+ });
2536
+ const { x: arrowX, y: arrowY } = middlewareData.arrow;
2537
+ const staticSide = {
2538
+ top: 'bottom',
2539
+ right: 'left',
2540
+ bottom: 'top',
2541
+ left: 'right',
2542
+ }[placement.split('-')[0]];
2543
+ Object.assign(this.arrowEl.style, {
2544
+ left: arrowX != null ? `${arrowX}px` : '',
2545
+ top: arrowY != null ? `${arrowY}px` : '',
2546
+ right: '',
2547
+ bottom: '',
2548
+ [staticSide]: '-4px',
2549
+ });
2550
+ });
2551
+ }
2552
+ render() {
2553
+ return (index$1.h(index$1.Host, { key: '32f792b447497e62bc776085657de62b8d6213bf' }, index$1.h("span", { key: '96f014373662e86cadb00d5a0b981246d3a7cac4', part: "trigger", id: "trigger", ref: (el) => (this.triggerEl = el) }, index$1.h("slot", { key: '218a47538fad33071c2ed20d83610b36e8c5a8f4' })), index$1.h("div", { key: 'c338da352126320e70333ad8ae814667e53dc5b4', part: "tooltip", class: "tooltip", id: "tooltip", role: "tooltip", ref: (el) => (this.tooltipEl = el) }, index$1.h("div", { key: 'bd0fe7c880bf999ba565959e84cc78412d008fb7', id: "arrow", ref: (el) => (this.arrowEl = el), part: "arrow" }), this.label, index$1.h("slot", { key: '67fcc99de5f9db145ce832b7eb46aa0e587ed101', name: "tooltip" }))));
2554
+ }
2555
+ static get watchers() { return {
2556
+ "open": ["openChanged"]
2557
+ }; }
2558
+ };
2559
+ RtkMenu.style = RtkTooltipStyle0;
2560
+
2561
+ exports.rtk_avatar = RtkAvatar;
2562
+ exports.rtk_button = RtkButton;
2563
+ exports.rtk_channel_selector_view = RtkChannelSelectorView;
2564
+ exports.rtk_chat = RtkChat;
2565
+ exports.rtk_chat_composer_view = RtkChatComposerView;
2566
+ exports.rtk_chat_messages_ui_paginated = RtkChatMessagesUiPaginated;
2567
+ exports.rtk_draft_attachment_view = RtkDraftAttachmentView;
2568
+ exports.rtk_emoji_picker = RtkEmojiPicker;
2569
+ exports.rtk_emoji_picker_button = RtkEmojiPickerButton;
2570
+ exports.rtk_file_message_view = RtkFileMessageView;
2571
+ exports.rtk_file_picker_button = RtkFilePickerButton;
2572
+ exports.rtk_icon = RtkIcon;
2573
+ exports.rtk_image_message_view = RtkImageMessageView;
2574
+ exports.rtk_markdown_view = RtkMarkdownView;
2575
+ exports.rtk_meeting = RtkMeeting;
2576
+ exports.rtk_menu = RtkMenu$1;
2577
+ exports.rtk_menu_item = RtkMenuItem;
2578
+ exports.rtk_menu_list = RtkMenuList;
2579
+ exports.rtk_message_view = RtkMessageView;
2580
+ exports.rtk_paginated_list = RtkPaginatedList;
2581
+ exports.rtk_spinner = RtkSpinner;
2582
+ exports.rtk_text_composer_view = RtkTextComposerView;
2583
+ exports.rtk_text_message_view = RtkTextMessageView;
2584
+ exports.rtk_tooltip = RtkMenu;