@nivaro/react 0.2.53 → 0.2.55

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 (294) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +452 -4
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +252 -2
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/FormWhatsNew.js +60 -0
  10. package/dist/shared/components/ItemEditForm.js +3968 -3618
  11. package/dist/shared/components/JobsTray.js +100 -55
  12. package/dist/shared/components/MyWorkView.js +91 -89
  13. package/dist/shared/components/NotificationBell.js +80 -79
  14. package/dist/shared/components/ProfileView.js +568 -520
  15. package/dist/shared/components/RecordCompare.js +254 -0
  16. package/dist/shared/components/RecordReadView.js +598 -543
  17. package/dist/shared/components/ReportView.js +578 -543
  18. package/dist/shared/components/RowPresence.js +91 -0
  19. package/dist/shared/components/TipLayer.js +27 -27
  20. package/dist/shared/components/WidgetSlot.js +474 -458
  21. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  22. package/dist/shared/components/ai/AskPanel.js +139 -119
  23. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  24. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  25. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  26. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  27. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  28. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  29. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  30. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  31. package/dist/shared/components/chat/Composer.js +357 -303
  32. package/dist/shared/components/chat/MessageActions.js +92 -0
  33. package/dist/shared/components/chat/MessageFormat.js +290 -264
  34. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  35. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  36. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  37. package/dist/shared/components/chat/RoomParts.js +213 -274
  38. package/dist/shared/components/chat/ScreenClip.js +184 -0
  39. package/dist/shared/components/chat/chat-core.js +402 -483
  40. package/dist/shared/components/chat/chat-drafts.js +59 -0
  41. package/dist/shared/components/chat/chat-emoji.js +348 -0
  42. package/dist/shared/components/chat/chat-local-time.js +41 -0
  43. package/dist/shared/components/chat/chat-outbox.js +303 -0
  44. package/dist/shared/components/chat/chat-window.js +163 -0
  45. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  46. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  47. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  48. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  49. package/dist/shared/components/help-videos/api.js +80 -67
  50. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  51. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  52. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  53. package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
  54. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  55. package/dist/shared/components/item-edit/FieldRow.js +382 -320
  56. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  57. package/dist/shared/components/item-edit/GroupSection.js +786 -639
  58. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  59. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  60. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  61. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  62. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  63. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  64. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  65. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  66. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  67. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  68. package/dist/shared/components/item-edit/lock-why.js +94 -0
  69. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  70. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  71. package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
  72. package/dist/shared/components/layout-editor/AddPanel.js +226 -151
  73. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  74. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  75. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  76. package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
  77. package/dist/shared/components/layout-editor/CollabParts.js +175 -0
  78. package/dist/shared/components/layout-editor/DesignNode.js +311 -116
  79. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
  80. package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
  81. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  82. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  83. package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
  84. package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
  85. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  86. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  87. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  88. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  89. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  90. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  91. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  92. package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
  93. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  94. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  95. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  96. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  97. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  98. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  99. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  100. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  101. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  102. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  103. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  104. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  105. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  106. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  107. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  108. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  109. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  110. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  111. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  112. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  113. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  114. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  115. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  116. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  117. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  118. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  119. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  120. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  121. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  122. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  123. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  124. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  125. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  126. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  127. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  128. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  129. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  130. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  131. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
  132. package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
  133. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  134. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  135. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  136. package/dist/shared/components/layout-editor/design-context.js +26 -6
  137. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
  138. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  139. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  140. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  141. package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
  142. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  143. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  144. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  145. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  146. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  147. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  148. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  149. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  150. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  151. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  152. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  153. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  154. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  155. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  156. package/dist/shared/components/layout-editor/form-map.js +138 -0
  157. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  158. package/dist/shared/components/layout-editor/history-api.js +87 -0
  159. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  160. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  161. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  162. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  163. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  164. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  165. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  166. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
  167. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  168. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
  169. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  170. package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
  171. package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
  172. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  173. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  174. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  175. package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
  176. package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
  177. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  178. package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
  179. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  180. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  181. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  182. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  183. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  184. package/dist/shared/components/layout-editor/load-error.js +37 -0
  185. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  186. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  187. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  188. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  189. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  190. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  191. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  192. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  193. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  194. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  195. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  196. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  197. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  198. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  199. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  200. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  201. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  202. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  203. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  204. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  205. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  206. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  207. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  208. package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
  209. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  210. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  211. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  212. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  213. package/dist/shared/components/layout-editor/pin.js +25 -0
  214. package/dist/shared/components/layout-editor/presence.js +111 -0
  215. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  216. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  217. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  218. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  219. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  220. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  221. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  222. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  223. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  224. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  225. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  226. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  227. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  228. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  229. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  230. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  231. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  232. package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
  233. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  234. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  235. package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
  236. package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
  237. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  238. package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
  239. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  240. package/dist/shared/components/layout-editor/show-when.js +35 -0
  241. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  242. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  243. package/dist/shared/components/layout-editor/structure-ops.js +403 -0
  244. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  245. package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
  246. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  247. package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
  248. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  249. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  250. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  251. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  252. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  253. package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
  254. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  255. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  256. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  257. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  258. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
  259. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  260. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  261. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  262. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  263. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  264. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  265. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  266. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  267. package/dist/shared/components/support/SupportView.js +75 -73
  268. package/dist/shared/lib/ai-fill.js +37 -0
  269. package/dist/shared/lib/background-runs.js +150 -0
  270. package/dist/shared/lib/delivery-ack.js +9 -0
  271. package/dist/shared/lib/entry-badge-style.js +13 -0
  272. package/dist/shared/lib/entry-config.js +71 -0
  273. package/dist/shared/lib/form-sections.js +64 -0
  274. package/dist/shared/lib/form-structure.js +99 -0
  275. package/dist/shared/lib/form-usage-beacon.js +133 -0
  276. package/dist/shared/lib/jobs-tray.js +25 -23
  277. package/dist/shared/lib/keyset-pager.js +37 -0
  278. package/dist/shared/lib/layout-i18n.js +66 -0
  279. package/dist/shared/lib/layout-lint.js +490 -0
  280. package/dist/shared/lib/layout-ops.js +116 -110
  281. package/dist/shared/lib/layout-resolve.js +113 -0
  282. package/dist/shared/lib/placement-behaviour.js +144 -0
  283. package/dist/shared/lib/prefetch.js +149 -0
  284. package/dist/shared/lib/presence-hooks.js +199 -0
  285. package/dist/shared/lib/record-outbox.js +82 -81
  286. package/dist/shared/lib/replay-socket.js +93 -0
  287. package/dist/shared/lib/request-gate.js +51 -50
  288. package/dist/shared/lib/room-gaps.js +96 -0
  289. package/dist/shared/lib/screenshot.js +54 -28
  290. package/dist/shared/lib/search-log.js +27 -0
  291. package/dist/shared/lib/socket-realtime.js +101 -80
  292. package/dist/shared/lib/visible-when.js +34 -0
  293. package/dist/shared/lib/worker-socket.js +200 -0
  294. package/package.json +1 -1
@@ -0,0 +1,303 @@
1
+ import { useState as $, useEffect as T } from "react";
2
+ import { post as F } from "../../lib/commands.js";
3
+ import { useOptionalRealtime as Q } from "../../lib/realtime.js";
4
+ const R = "nivaro-chat-outbox", v = "entries", j = "nvr-chat-outbox", J = 1440 * 60 * 1e3, P = 8e3, Y = "nvr-chat-outbox:flush";
5
+ let G = !1;
6
+ const h = /* @__PURE__ */ new Map();
7
+ function I() {
8
+ return new Promise((e) => {
9
+ try {
10
+ if (G || typeof indexedDB > "u") return e(null);
11
+ const t = indexedDB.open(R, 1);
12
+ t.onupgradeneeded = () => {
13
+ t.result.objectStoreNames.contains(v) || t.result.createObjectStore(v, { keyPath: "client_id" });
14
+ }, t.onsuccess = () => e(t.result), t.onerror = () => e(null), t.onblocked = () => e(null);
15
+ } catch {
16
+ e(null);
17
+ }
18
+ });
19
+ }
20
+ async function y(e, t) {
21
+ const n = await I();
22
+ return n ? new Promise((i) => {
23
+ try {
24
+ const a = n.transaction(v, e), r = t(a.objectStore(v));
25
+ r.onsuccess = () => i({ ok: !0, value: r.result }), r.onerror = () => i({ ok: !1, value: null }), a.oncomplete = () => n.close(), a.onerror = () => {
26
+ n.close(), i({ ok: !1, value: null });
27
+ };
28
+ } catch {
29
+ n.close(), i({ ok: !1, value: null });
30
+ }
31
+ }) : { ok: !1, value: null };
32
+ }
33
+ const U = (e) => JSON.parse(JSON.stringify(e));
34
+ async function q(e) {
35
+ h.set(e.client_id, e), await y("readwrite", (t) => t.put(U(e)));
36
+ }
37
+ async function L(e) {
38
+ h.delete(e), await y("readwrite", (t) => t.delete(e));
39
+ }
40
+ async function C(e) {
41
+ const t = await y("readonly", (n) => n.get(e));
42
+ return t.ok ? t.value ?? null : h.get(e) ?? null;
43
+ }
44
+ async function B() {
45
+ const e = await y("readonly", (t) => t.getAll());
46
+ return e.ok ? e.value ?? [] : [...h.values()];
47
+ }
48
+ let o = [];
49
+ const D = /* @__PURE__ */ new Set();
50
+ let p = null, s = null, l = null, M = !1, m = null, _ = !1, A = !1, f = null;
51
+ const S = /* @__PURE__ */ new Set();
52
+ let k = 0, g = !1;
53
+ function X(e) {
54
+ return `${typeof location < "u" ? location.host : ""}|${e}`;
55
+ }
56
+ function w() {
57
+ for (const e of D) e();
58
+ }
59
+ function O() {
60
+ try {
61
+ f == null || f.postMessage({ type: "changed" });
62
+ } catch {
63
+ }
64
+ }
65
+ const E = (e, t) => e.created_at < t.created_at ? -1 : e.created_at > t.created_at ? 1 : 0;
66
+ async function b() {
67
+ if (!l || M) return;
68
+ const e = l, t = await B();
69
+ if (l !== e) return;
70
+ const n = t.filter((a) => (a == null ? void 0 : a.owner) === e).sort(E), i = new Set(n.map((a) => a.client_id));
71
+ o = [
72
+ ...n,
73
+ ...o.filter((a) => !i.has(a.client_id) && S.has(a.client_id))
74
+ ].sort(E), w();
75
+ }
76
+ function x(e, t = Date.now()) {
77
+ const n = new Date(e.created_at).getTime();
78
+ return !Number.isFinite(n) || t - n > J;
79
+ }
80
+ function z(e, t = Date.now()) {
81
+ const n = /* @__PURE__ */ new Set();
82
+ for (const i of [...e].sort(E))
83
+ if (i.status !== "failed" && !n.has(i.room) && (n.add(i.room), !(i.held || x(i, t))))
84
+ return i;
85
+ return null;
86
+ }
87
+ async function d(e, t) {
88
+ const n = o.find((a) => a.client_id === e) ?? await C(e);
89
+ if (!n) return null;
90
+ const i = { ...n, ...t, updated_at: (/* @__PURE__ */ new Date()).toISOString() };
91
+ return o = o.some((a) => a.client_id === e) ? o.map((a) => a.client_id === e ? i : a) : o, w(), await q(i), O(), i;
92
+ }
93
+ async function K(e) {
94
+ o = o.filter((t) => t.client_id !== e), w(), await L(e), O();
95
+ }
96
+ function st(e, t, n) {
97
+ var r;
98
+ if (p = e, s = t, !n) return;
99
+ const i = X(n);
100
+ if (i === l) return;
101
+ if (l = i, o = [], w(), !A && typeof window < "u" && (A = !0, window.addEventListener("online", () => u(0)), (r = document.addEventListener) == null || r.call(document, "visibilitychange", () => {
102
+ document.visibilityState === "visible" && o.some((c) => c.status === "queued") && u(0);
103
+ })), typeof BroadcastChannel < "u" && !f)
104
+ try {
105
+ f = new BroadcastChannel("nvr-chat-outbox"), f.onmessage = () => void b();
106
+ } catch {
107
+ f = null;
108
+ }
109
+ const a = l;
110
+ (async () => {
111
+ for (const c of await B()) c && c.owner !== a && await L(c.client_id);
112
+ await H(n, a), await b(), o.length && u(1e3);
113
+ })();
114
+ }
115
+ async function H(e, t) {
116
+ try {
117
+ if (typeof localStorage > "u") return;
118
+ const n = `${j}:${e}`, i = localStorage.getItem(n);
119
+ if (!i) return;
120
+ localStorage.removeItem(n);
121
+ const a = JSON.parse(i);
122
+ for (const r of Array.isArray(a) ? a : [])
123
+ !(r != null && r.client_id) || await C(r.client_id) || await q({ ...r, owner: t, status: r.status === "failed" ? "failed" : "queued" });
124
+ } catch {
125
+ }
126
+ }
127
+ async function ut() {
128
+ o = [], h.clear(), l = null, w(), await y("readwrite", (e) => e.clear()), O();
129
+ }
130
+ function ct(e) {
131
+ const t = typeof navigator < "u" && navigator.onLine === !1, n = g || t;
132
+ let i = Date.parse(e.created_at) || Date.now();
133
+ i <= k && (i = k + 1), k = i;
134
+ const a = {
135
+ ...e,
136
+ created_at: new Date(i).toISOString(),
137
+ owner: l ?? void 0,
138
+ status: n ? "queued" : "sending",
139
+ error: n ? "Waiting for a connection" : null,
140
+ updated_at: (/* @__PURE__ */ new Date()).toISOString()
141
+ };
142
+ o = [...o, a], S.add(a.client_id), w(), q(a).then(() => {
143
+ S.delete(a.client_id), O(), t || W();
144
+ });
145
+ }
146
+ function u(e) {
147
+ m && clearTimeout(m), m = setTimeout(() => {
148
+ m = null, W();
149
+ }, e);
150
+ }
151
+ function V() {
152
+ o.some((e) => e.status === "queued" || e.status === "sending") && u(0);
153
+ }
154
+ function Z(e) {
155
+ var i;
156
+ const t = e, n = (t == null ? void 0 : t.status) ?? ((i = t == null ? void 0 : t.response) == null ? void 0 : i.status);
157
+ return n == null ? !(t != null && t.response) : n === 0 || n === 502 || n === 503 || n === 504;
158
+ }
159
+ function tt() {
160
+ var e;
161
+ return ((e = globalThis.navigator) == null ? void 0 : e.locks) ?? null;
162
+ }
163
+ async function W() {
164
+ if (_ || !p) return;
165
+ const e = tt();
166
+ if (!e) return N();
167
+ let t = !1;
168
+ await e.request(Y, { ifAvailable: !0 }, async (n) => {
169
+ n && (t = !0, await N());
170
+ }).catch(() => {
171
+ }), !t && o.some((n) => n.status !== "failed" && !n.held) && u(1500);
172
+ }
173
+ async function N() {
174
+ if (_ || !p) return;
175
+ _ = !0;
176
+ const e = p;
177
+ try {
178
+ await b(), et();
179
+ for (let t = 0; t < 500; t++) {
180
+ const n = z(o);
181
+ if (!n) return;
182
+ const i = M ? n : await C(n.client_id);
183
+ if (!i || i.held || i.status === "failed") {
184
+ i || S.delete(n.client_id), await b(), i || (o = o.filter((r) => r.client_id !== n.client_id));
185
+ continue;
186
+ }
187
+ if (await d(i.client_id, { status: "sending", error: null }), await nt(e, i) === "offline") {
188
+ for (const r of o)
189
+ r.status === "sending" && r.client_id !== i.client_id && await d(r.client_id, { status: "queued", error: "Waiting for a connection" });
190
+ u(P);
191
+ return;
192
+ }
193
+ }
194
+ } finally {
195
+ _ = !1;
196
+ }
197
+ }
198
+ function et() {
199
+ const e = Date.now();
200
+ for (const t of o)
201
+ t.status !== "failed" && !t.held && x(t, e) && d(t.client_id, {
202
+ status: "failed",
203
+ error: "Not sent — it waited more than a day for a connection"
204
+ });
205
+ }
206
+ async function nt(e, t) {
207
+ try {
208
+ const n = await e.request(
209
+ F("/chat/messages", {
210
+ room: t.room,
211
+ message: t.text,
212
+ mentions: t.mentions,
213
+ attachments: t.attachments,
214
+ parent_id: t.parent_id,
215
+ quote_id: t.quote_id,
216
+ urgent: t.urgent,
217
+ client_id: t.client_id
218
+ })
219
+ );
220
+ g = !1, await K(t.client_id);
221
+ const i = n == null ? void 0 : n.data;
222
+ return i && !t.parent_id && (s == null || s.setQueryData(
223
+ ["nvr-chat", t.room, "latest"],
224
+ (a) => a && !a.data.some((r) => r.id === i.id) ? { ...a, data: [...a.data, i] } : a
225
+ )), s == null || s.invalidateQueries({ queryKey: ["nvr-chat", t.room] }), s == null || s.invalidateQueries({ queryKey: ["nvr-chat-thread", t.room] }), s == null || s.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), "sent";
226
+ } catch (n) {
227
+ if (Z(n))
228
+ return g = !0, await d(t.client_id, { status: "queued", error: "Waiting for a connection" }), "offline";
229
+ g = !1;
230
+ const i = n == null ? void 0 : n.response;
231
+ return await d(t.client_id, {
232
+ status: "failed",
233
+ error: (i == null ? void 0 : i.error) ?? (n instanceof Error ? n.message : "Could not send")
234
+ }), "failed";
235
+ }
236
+ }
237
+ function lt(e) {
238
+ const t = o.find((n) => n.client_id === e);
239
+ !t || t.status === "sending" || d(e, {
240
+ status: "queued",
241
+ error: null,
242
+ held: !1,
243
+ created_at: x(t) ? (/* @__PURE__ */ new Date()).toISOString() : t.created_at
244
+ }).then(() => u(0));
245
+ }
246
+ function it(e) {
247
+ const t = o.find((n) => n.client_id === e);
248
+ !t || t.status === "sending" || K(e).then(() => u(0));
249
+ }
250
+ function dt(e, t) {
251
+ const n = o.find((i) => i.client_id === e);
252
+ return !n || n.status === "sending" ? !1 : (d(e, { held: t }).then(() => {
253
+ t || u(0);
254
+ }), !0);
255
+ }
256
+ function ft(e, t) {
257
+ const n = o.find((a) => a.client_id === e);
258
+ if (!n || n.status === "sending") return;
259
+ const i = t.replace(/\s+$/, "");
260
+ if (!i.trim() && n.attachments.length === 0) {
261
+ it(e);
262
+ return;
263
+ }
264
+ d(e, {
265
+ text: i,
266
+ held: !1,
267
+ status: "queued",
268
+ error: null,
269
+ created_at: x(n) ? (/* @__PURE__ */ new Date()).toISOString() : n.created_at
270
+ }).then(() => u(0));
271
+ }
272
+ function wt(e, t = null) {
273
+ const [, n] = $(0), i = Q();
274
+ return T(() => {
275
+ const a = () => n((r) => r + 1);
276
+ return D.add(a), () => {
277
+ D.delete(a);
278
+ };
279
+ }, []), T(() => {
280
+ var r;
281
+ if (!(i != null && i.onStatus)) return;
282
+ let a = ((r = i.status) == null ? void 0 : r.call(i).state) ?? "live";
283
+ return i.onStatus((c) => {
284
+ c.state === "live" && a !== "live" && V(), a = c.state;
285
+ });
286
+ }, [i]), o.filter((a) => a.room === e && (a.parent_id ?? null) === t);
287
+ }
288
+ export {
289
+ J as OUTBOX_STALE_MS,
290
+ st as bindChatOutbox,
291
+ ut as clearChatOutbox,
292
+ it as discardOutbox,
293
+ ft as editOutbox,
294
+ ct as enqueueChatOutbox,
295
+ W as flushChatOutbox,
296
+ dt as holdOutbox,
297
+ x as isStaleOutboxItem,
298
+ z as nextToSend,
299
+ V as nudgeChatOutbox,
300
+ lt as retryOutbox,
301
+ u as scheduleFlush,
302
+ wt as useOutbox
303
+ };
@@ -0,0 +1,163 @@
1
+ import { useRef as b, useState as W, useMemo as V, useCallback as M, useLayoutEffect as S, useEffect as F } from "react";
2
+ const k = 150, K = 1200, N = 25;
3
+ function X(d, u, p, r, v = K) {
4
+ const l = d.length;
5
+ if (l === 0) return null;
6
+ const h = p - v, f = p + r + v;
7
+ let o = 0, s = -1, c = l - 1;
8
+ for (let m = 0; m < l; m++) {
9
+ const R = u(d[m]);
10
+ if (s < 0 && o + R > h && (s = m), o > f) {
11
+ c = m - 1;
12
+ break;
13
+ }
14
+ o += R;
15
+ }
16
+ return s < 0 && (s = l - 1), c < s && (c = s), { from: d[s], to: d[c], toEnd: c === l - 1 };
17
+ }
18
+ function $(d, u, p, r, v, l) {
19
+ const h = d.length;
20
+ if (!v || h === 0) return { start: 0, end: h, padTop: 0, padBottom: 0 };
21
+ let f, o;
22
+ const s = p ? u.get(p.from) : void 0, c = p ? p.toEnd ? h - 1 : u.get(p.to) : void 0;
23
+ if (s != null && c != null && c >= s)
24
+ f = s, o = c + 1;
25
+ else {
26
+ const i = l != null ? u.get(l) : void 0;
27
+ i != null ? (f = Math.max(0, i - N), o = Math.min(h, i + N * 2)) : (f = Math.max(0, h - N * 2), o = h);
28
+ }
29
+ let m = 0;
30
+ for (let i = 0; i < f; i++) m += r(d[i]);
31
+ let R = 0;
32
+ for (let i = o; i < h; i++) R += r(d[i]);
33
+ return { start: f, end: o, padTop: m, padBottom: R };
34
+ }
35
+ function z(d, u) {
36
+ return d.getBoundingClientRect().top - u.getBoundingClientRect().top;
37
+ }
38
+ function G(d) {
39
+ var T;
40
+ const { scrollerRef: u, listRef: p, ids: r, estimate: v, resetKey: l, pinnedRef: h } = d, f = b(/* @__PURE__ */ new Map()), o = b(/* @__PURE__ */ new Map()), s = b(/* @__PURE__ */ new Map()), c = b(null), m = b(null), R = b(null), i = b(null), [_, I] = W(null), O = r.length > k, E = V(() => {
41
+ const t = /* @__PURE__ */ new Map();
42
+ for (let e = 0; e < r.length; e++) t.set(r[e], e);
43
+ return t;
44
+ }, [r]), x = b(r);
45
+ x.current = r;
46
+ const H = M((t) => f.current.get(t) ?? v, [v]);
47
+ S(() => {
48
+ f.current.clear(), c.current = null, m.current = null, R.current = null, I(null);
49
+ }, [l]);
50
+ const A = M(() => {
51
+ const t = u.current;
52
+ if (t)
53
+ for (const e of x.current) {
54
+ const n = o.current.get(e);
55
+ if (!n) continue;
56
+ const a = z(n, t);
57
+ if (a + n.offsetHeight > 0) {
58
+ c.current = { id: e, rel: a };
59
+ return;
60
+ }
61
+ }
62
+ }, [u]), B = M(() => {
63
+ const t = u.current, e = c.current;
64
+ if (!t || !e || h.current) return;
65
+ const n = o.current.get(e.id);
66
+ if (!n) return;
67
+ const a = z(n, t) - e.rel;
68
+ Math.abs(a) >= 1 && (t.scrollTop += a);
69
+ }, [u, h]), C = M(() => {
70
+ const t = u.current, e = p.current, n = x.current;
71
+ if (!t || !e || n.length <= k) return;
72
+ const a = e.getBoundingClientRect().top - t.getBoundingClientRect().top, w = X(n, H, -a, t.clientHeight);
73
+ w && I(
74
+ (y) => y && y.from === w.from && y.to === w.to && y.toEnd === w.toEnd ? y : w
75
+ );
76
+ }, [u, p, H]), g = V(
77
+ () => typeof ResizeObserver > "u" ? null : new ResizeObserver((t) => {
78
+ for (const e of t) {
79
+ const n = e.target, a = Number(n.dataset.chatRow);
80
+ Number.isFinite(a) && f.current.set(a, n.offsetHeight);
81
+ }
82
+ B();
83
+ }),
84
+ [B]
85
+ );
86
+ F(() => () => g == null ? void 0 : g.disconnect(), [g]);
87
+ const L = M(
88
+ (t) => {
89
+ let e = s.current.get(t);
90
+ return e || (e = (n) => {
91
+ const a = o.current.get(t);
92
+ a && a !== n && (g == null || g.unobserve(a)), n ? (o.current.set(t, n), f.current.set(t, n.offsetHeight), g == null || g.observe(n)) : o.current.delete(t);
93
+ }, s.current.set(t, e)), e;
94
+ },
95
+ [g]
96
+ );
97
+ F(() => {
98
+ for (const t of o.current.values()) g == null || g.observe(t);
99
+ }, [g]), F(() => {
100
+ if (s.current.size > r.length * 2 + 200)
101
+ for (const t of [...s.current.keys()]) E.has(t) || s.current.delete(t);
102
+ }, [r, E]), S(() => {
103
+ const t = r[0] ?? null, e = R.current;
104
+ R.current = t, e != null && t !== e && c.current && E.has(c.current.id) && B(), O && C();
105
+ }, [r, E, O, C, B]), S(() => {
106
+ const t = m.current;
107
+ if (t == null) {
108
+ (!c.current || !o.current.has(c.current.id)) && A();
109
+ return;
110
+ }
111
+ const e = o.current.get(t);
112
+ e && (m.current = null, e.scrollIntoView({ block: "center" }), A());
113
+ });
114
+ const P = M(() => {
115
+ A(), !(!O || i.current != null) && (i.current = requestAnimationFrame(() => {
116
+ i.current = null, C();
117
+ }));
118
+ }, [A, O, C]);
119
+ F(
120
+ () => () => {
121
+ i.current != null && cancelAnimationFrame(i.current);
122
+ },
123
+ []
124
+ );
125
+ const q = M(
126
+ (t) => {
127
+ const e = E.get(t);
128
+ if (e == null) return !1;
129
+ m.current = t;
130
+ const n = x.current, a = Math.max(0, e - N), w = Math.min(n.length - 1, e + N);
131
+ return I({ from: n[a], to: n[w], toEnd: w === n.length - 1 }), !0;
132
+ },
133
+ [E]
134
+ ), D = $(r, E, _, H, O, ((T = c.current) == null ? void 0 : T.id) ?? null);
135
+ return { windowed: O, ...D, rowRef: L, onScroll: P, reveal: q };
136
+ }
137
+ function J(d = 600) {
138
+ const [u, p] = W(() => typeof IntersectionObserver > "u"), r = b(null);
139
+ return F(() => () => {
140
+ var l;
141
+ return (l = r.current) == null ? void 0 : l.disconnect();
142
+ }, []), [M(
143
+ (l) => {
144
+ var o;
145
+ if ((o = r.current) == null || o.disconnect(), r.current = null, !l || u || typeof IntersectionObserver > "u") return;
146
+ const h = l.closest("[data-chat-messages]"), f = new IntersectionObserver(
147
+ (s) => {
148
+ s.some((c) => c.isIntersecting) && (p(!0), f.disconnect());
149
+ },
150
+ { root: h, rootMargin: `${d}px 0px` }
151
+ );
152
+ f.observe(l), r.current = f;
153
+ },
154
+ [u, d]
155
+ ), u];
156
+ }
157
+ export {
158
+ k as WINDOW_FROM,
159
+ $ as spanFor,
160
+ G as useMessageWindow,
161
+ J as useNearViewport,
162
+ X as windowFor
163
+ };
@@ -0,0 +1,143 @@
1
+ import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
+ import { MicOff as p, Mic as x, ScreenShareOff as k, ScreenShare as y, PhoneOff as w, Headphones as l } from "lucide-react";
3
+ import { cn as d } from "../../../lib/utils.js";
4
+ import { canOpenChatRoom as c, openChatRoom as N } from "../chat-core.js";
5
+ import { peerSummary as h } from "./huddle-store.js";
6
+ const S = "flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-400 dark:hover:bg-white/10 dark:hover:text-slate-100";
7
+ function H({
8
+ room: u,
9
+ roomLabel: o,
10
+ huddle: r,
11
+ renderAvatar: m
12
+ }) {
13
+ const { enabled: b, support: f, state: e, roster: a, inThis: g, inOther: v } = r;
14
+ if (!b) return null;
15
+ if (v && e.room) {
16
+ const n = e.room;
17
+ return /* @__PURE__ */ i(
18
+ "button",
19
+ {
20
+ type: "button",
21
+ onClick: () => c() ? N(n) : r.leave(),
22
+ className: "flex h-7 items-center gap-1.5 rounded-md bg-nvr-cyan/10 px-2 text-[11px] font-medium text-slate-700 transition-colors hover:bg-nvr-cyan/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-slate-100",
23
+ "data-tip": c() ? "Back to the room you are talking in" : "Leave that huddle",
24
+ "data-huddle-elsewhere": !0,
25
+ children: [
26
+ /* @__PURE__ */ i("span", { className: "relative flex h-2 w-2", children: [
27
+ /* @__PURE__ */ t("span", { className: "absolute inline-flex h-full w-full rounded-full bg-nvr-cyan opacity-60 motion-safe:animate-ping" }),
28
+ /* @__PURE__ */ t("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-nvr-cyan" })
29
+ ] }),
30
+ "In a huddle"
31
+ ]
32
+ }
33
+ );
34
+ }
35
+ if (g) {
36
+ const n = e.status === "joining";
37
+ return /* @__PURE__ */ i(
38
+ "fieldset",
39
+ {
40
+ className: "m-0 flex h-7 min-w-0 items-center gap-0.5 rounded-md border border-slate-200 bg-white p-0 px-0.5 dark:border-border dark:bg-card",
41
+ "data-huddle-controls": !0,
42
+ children: [
43
+ /* @__PURE__ */ t("legend", { className: "sr-only", children: "Huddle controls" }),
44
+ /* @__PURE__ */ t(
45
+ "button",
46
+ {
47
+ type: "button",
48
+ onClick: r.toggleMute,
49
+ disabled: n,
50
+ className: d(
51
+ "flex h-6 w-6 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40",
52
+ e.muted ? "bg-red-50 text-red-600 dark:bg-red-500/15 dark:text-red-300" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/10"
53
+ ),
54
+ "aria-pressed": e.muted,
55
+ "aria-label": e.muted ? "Unmute microphone" : "Mute microphone",
56
+ "data-tip": e.muted ? "Unmute" : "Mute",
57
+ "data-huddle-mute": e.muted ? "on" : "off",
58
+ children: e.muted ? /* @__PURE__ */ t(p, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ t(x, { className: "h-3.5 w-3.5", strokeWidth: 2 })
59
+ }
60
+ ),
61
+ f.screen && /* @__PURE__ */ t(
62
+ "button",
63
+ {
64
+ type: "button",
65
+ onClick: r.toggleShare,
66
+ disabled: n,
67
+ className: d(
68
+ "flex h-6 w-6 items-center justify-center rounded transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan disabled:opacity-40",
69
+ e.sharing ? "bg-nvr-cyan/15 text-slate-900 dark:text-slate-100" : "text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-white/10"
70
+ ),
71
+ "aria-pressed": e.sharing,
72
+ "aria-label": e.sharing ? "Stop sharing your screen" : "Share your screen",
73
+ "data-tip": e.sharing ? "Stop sharing" : "Share screen",
74
+ "data-huddle-share": e.sharing ? "on" : "off",
75
+ children: e.sharing ? /* @__PURE__ */ t(k, { className: "h-3.5 w-3.5", strokeWidth: 2 }) : /* @__PURE__ */ t(y, { className: "h-3.5 w-3.5", strokeWidth: 2 })
76
+ }
77
+ ),
78
+ /* @__PURE__ */ i(
79
+ "button",
80
+ {
81
+ type: "button",
82
+ onClick: r.leave,
83
+ className: "flex h-6 items-center gap-1 rounded px-1.5 text-[11px] font-medium text-red-600 transition-colors hover:bg-red-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:text-red-300 dark:hover:bg-red-500/15",
84
+ "aria-label": "Leave the huddle",
85
+ "data-huddle-leave": !0,
86
+ children: [
87
+ /* @__PURE__ */ t(w, { className: "h-3.5 w-3.5", strokeWidth: 2 }),
88
+ "Leave"
89
+ ]
90
+ }
91
+ )
92
+ ]
93
+ }
94
+ );
95
+ }
96
+ if (a.length > 0) {
97
+ const n = a.slice(0, 3);
98
+ return /* @__PURE__ */ i(
99
+ "button",
100
+ {
101
+ type: "button",
102
+ onClick: r.join,
103
+ className: "flex h-7 items-center gap-1.5 rounded-md border border-slate-200 bg-white pl-1 pr-2 text-[11px] font-medium text-slate-700 transition-colors hover:border-nvr-cyan hover:bg-nvr-cyan/10 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan dark:border-border dark:bg-card dark:text-slate-100",
104
+ "data-tip": `${h(a)} in a huddle — join`,
105
+ "aria-label": `Join the huddle in ${o} (${h(a)})`,
106
+ "data-huddle-join": !0,
107
+ children: [
108
+ /* @__PURE__ */ t("span", { className: "flex -space-x-1.5", children: n.map((s) => /* @__PURE__ */ t(
109
+ "span",
110
+ {
111
+ className: "rounded-full ring-2 ring-white dark:ring-card",
112
+ style: { lineHeight: 0 },
113
+ children: m(s.user, s.name)
114
+ },
115
+ s.socket
116
+ )) }),
117
+ a.length > 3 && /* @__PURE__ */ i("span", { className: "text-slate-500 dark:text-slate-400", children: [
118
+ "+",
119
+ a.length - 3
120
+ ] }),
121
+ /* @__PURE__ */ t(l, { className: "h-3.5 w-3.5 text-nvr-cyan", strokeWidth: 2 }),
122
+ "Join"
123
+ ]
124
+ }
125
+ );
126
+ }
127
+ return /* @__PURE__ */ t(
128
+ "button",
129
+ {
130
+ type: "button",
131
+ onClick: r.join,
132
+ className: S,
133
+ "aria-label": `Start a huddle in ${o}`,
134
+ "data-tip": "Start a huddle — talk with whoever is here",
135
+ "data-huddle-start": !0,
136
+ "data-room": u,
137
+ children: /* @__PURE__ */ t(l, { className: "h-4 w-4", strokeWidth: 2 })
138
+ }
139
+ );
140
+ }
141
+ export {
142
+ H as HuddleControls
143
+ };