@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.
- package/dist/full.css +1 -1
- package/dist/hooks/useSessionRecorder.js +99 -98
- package/dist/index.d.ts +452 -4
- package/dist/index.js +644 -618
- package/dist/layout-editor.d.ts +252 -2
- package/dist/shared/components/BackgroundRunOffer.js +117 -0
- package/dist/shared/components/BroadcastView.js +214 -213
- package/dist/shared/components/CollectionBrowserView.js +2592 -2695
- package/dist/shared/components/FormWhatsNew.js +60 -0
- package/dist/shared/components/ItemEditForm.js +3968 -3618
- package/dist/shared/components/JobsTray.js +100 -55
- package/dist/shared/components/MyWorkView.js +91 -89
- package/dist/shared/components/NotificationBell.js +80 -79
- package/dist/shared/components/ProfileView.js +568 -520
- package/dist/shared/components/RecordCompare.js +254 -0
- package/dist/shared/components/RecordReadView.js +598 -543
- package/dist/shared/components/ReportView.js +578 -543
- package/dist/shared/components/RowPresence.js +91 -0
- package/dist/shared/components/TipLayer.js +27 -27
- package/dist/shared/components/WidgetSlot.js +474 -458
- package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
- package/dist/shared/components/ai/AskPanel.js +139 -119
- package/dist/shared/components/ai/FirstWeekCard.js +126 -0
- package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
- package/dist/shared/components/bulk/bulk-field-options.js +45 -0
- package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
- package/dist/shared/components/chat/ChannelArchive.js +326 -0
- package/dist/shared/components/chat/ChannelExtras.js +141 -121
- package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
- package/dist/shared/components/chat/ChatPanel.js +1695 -1733
- package/dist/shared/components/chat/Composer.js +357 -303
- package/dist/shared/components/chat/MessageActions.js +92 -0
- package/dist/shared/components/chat/MessageFormat.js +290 -264
- package/dist/shared/components/chat/OutboxBubbles.js +146 -0
- package/dist/shared/components/chat/RequestIdCard.js +135 -0
- package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
- package/dist/shared/components/chat/RoomParts.js +213 -274
- package/dist/shared/components/chat/ScreenClip.js +184 -0
- package/dist/shared/components/chat/chat-core.js +402 -483
- package/dist/shared/components/chat/chat-drafts.js +59 -0
- package/dist/shared/components/chat/chat-emoji.js +348 -0
- package/dist/shared/components/chat/chat-local-time.js +41 -0
- package/dist/shared/components/chat/chat-outbox.js +303 -0
- package/dist/shared/components/chat/chat-window.js +163 -0
- package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
- package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
- package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
- package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
- package/dist/shared/components/help-videos/api.js +80 -67
- package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
- package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
- package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
- package/dist/shared/components/item-edit/FieldAffordances.js +9 -8
- package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
- package/dist/shared/components/item-edit/FieldRow.js +382 -320
- package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
- package/dist/shared/components/item-edit/GroupSection.js +786 -639
- package/dist/shared/components/item-edit/HeaderTools.js +59 -56
- package/dist/shared/components/item-edit/InlineTableField.js +3 -1
- package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
- package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
- package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
- package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
- package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
- package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
- package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
- package/dist/shared/components/item-edit/lazy-sections.js +36 -0
- package/dist/shared/components/item-edit/lock-why.js +94 -0
- package/dist/shared/components/item-edit/picker-miss.js +26 -0
- package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
- package/dist/shared/components/item-edit/useFormUsageBeacon.js +65 -0
- package/dist/shared/components/layout-editor/AddPanel.js +226 -151
- package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
- package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
- package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
- package/dist/shared/components/layout-editor/ChangeNote.js +147 -0
- package/dist/shared/components/layout-editor/CollabParts.js +175 -0
- package/dist/shared/components/layout-editor/DesignNode.js +311 -116
- package/dist/shared/components/layout-editor/EditorCanvas.js +30 -26
- package/dist/shared/components/layout-editor/EditorTopBar.js +463 -175
- package/dist/shared/components/layout-editor/FindReplace.js +188 -0
- package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
- package/dist/shared/components/layout-editor/HistoryPanel.js +250 -109
- package/dist/shared/components/layout-editor/LayoutEditor.js +1196 -305
- package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
- package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
- package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
- package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
- package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
- package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
- package/dist/shared/components/layout-editor/StagedChip.js +22 -0
- package/dist/shared/components/layout-editor/StructureMenu.js +464 -0
- package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
- package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
- package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
- package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
- package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
- package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
- package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
- package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
- package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
- package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
- package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
- package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
- package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
- package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
- package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
- package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
- package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
- package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
- package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
- package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
- package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
- package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
- package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
- package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
- package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
- package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
- package/dist/shared/components/layout-editor/assist/jump.js +142 -0
- package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
- package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
- package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
- package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
- package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
- package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
- package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
- package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
- package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
- package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
- package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
- package/dist/shared/components/layout-editor/collab/FormFollowShare.js +388 -0
- package/dist/shared/components/layout-editor/collab/collab-api.js +80 -0
- package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
- package/dist/shared/components/layout-editor/commands/intents.js +214 -0
- package/dist/shared/components/layout-editor/commands/parse.js +242 -0
- package/dist/shared/components/layout-editor/design-context.js +26 -6
- package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +181 -164
- package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
- package/dist/shared/components/layout-editor/dnd/node.js +69 -57
- package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
- package/dist/shared/components/layout-editor/draft-recovery.js +131 -0
- package/dist/shared/components/layout-editor/editor-notes.js +78 -0
- package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
- package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
- package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
- package/dist/shared/components/layout-editor/entry/presets.js +71 -0
- package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
- package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
- package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
- package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
- package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
- package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
- package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
- package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
- package/dist/shared/components/layout-editor/field-zones.js +116 -0
- package/dist/shared/components/layout-editor/form-map.js +138 -0
- package/dist/shared/components/layout-editor/grid-guides.js +142 -0
- package/dist/shared/components/layout-editor/history-api.js +87 -0
- package/dist/shared/components/layout-editor/inheritance.js +55 -0
- package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
- package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
- package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
- package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
- package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
- package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
- package/dist/shared/components/layout-editor/inspector/BulkInspector.js +179 -0
- package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
- package/dist/shared/components/layout-editor/inspector/GroupInspector.js +291 -141
- package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
- package/dist/shared/components/layout-editor/inspector/Inspector.js +282 -180
- package/dist/shared/components/layout-editor/inspector/LookTab.js +166 -109
- package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
- package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
- package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
- package/dist/shared/components/layout-editor/inspector/PickerTab.js +146 -118
- package/dist/shared/components/layout-editor/inspector/RulesTab.js +162 -111
- package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
- package/dist/shared/components/layout-editor/inspector/kit.js +71 -70
- package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
- package/dist/shared/components/layout-editor/is-typing.js +9 -0
- package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
- package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
- package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
- package/dist/shared/components/layout-editor/load-error.js +37 -0
- package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
- package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
- package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
- package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
- package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
- package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
- package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
- package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
- package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
- package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
- package/dist/shared/components/layout-editor/nav/find.js +20 -0
- package/dist/shared/components/layout-editor/nav/tree.js +142 -0
- package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
- package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
- package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
- package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
- package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
- package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
- package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
- package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
- package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
- package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
- package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
- package/dist/shared/components/layout-editor/overview/describe-conditions.js +24 -14
- package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
- package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
- package/dist/shared/components/layout-editor/panel-style.js +8 -7
- package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
- package/dist/shared/components/layout-editor/pin.js +25 -0
- package/dist/shared/components/layout-editor/presence.js +111 -0
- package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
- package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
- package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
- package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
- package/dist/shared/components/layout-editor/restore-piece.js +192 -0
- package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
- package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
- package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
- package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
- package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
- package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
- package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
- package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
- package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
- package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
- package/dist/shared/components/layout-editor/section-structure.js +241 -0
- package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
- package/dist/shared/components/layout-editor/settings/FormSettings.js +125 -103
- package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
- package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
- package/dist/shared/components/layout-editor/settings/ToolsSection.js +215 -105
- package/dist/shared/components/layout-editor/settings/WhoSection.js +139 -100
- package/dist/shared/components/layout-editor/settings/controls.js +8 -8
- package/dist/shared/components/layout-editor/settings/settings-registry.js +142 -21
- package/dist/shared/components/layout-editor/shortcuts.js +88 -0
- package/dist/shared/components/layout-editor/show-when.js +35 -0
- package/dist/shared/components/layout-editor/slot-names.js +4 -3
- package/dist/shared/components/layout-editor/staged-api.js +64 -0
- package/dist/shared/components/layout-editor/structure-ops.js +403 -0
- package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
- package/dist/shared/components/layout-editor/testing/TestingPanels.js +556 -0
- package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
- package/dist/shared/components/layout-editor/testing/testing-model.js +406 -0
- package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
- package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
- package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
- package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
- package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
- package/dist/shared/components/layout-editor/usage/UsagePanel.js +232 -0
- package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
- package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
- package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
- package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
- package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -306
- package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
- package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
- package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
- package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
- package/dist/shared/components/profile/AgentsPanel.js +479 -0
- package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
- package/dist/shared/components/support/SuggestFormChange.js +143 -0
- package/dist/shared/components/support/SupportAnalytics.js +171 -0
- package/dist/shared/components/support/SupportView.js +75 -73
- package/dist/shared/lib/ai-fill.js +37 -0
- package/dist/shared/lib/background-runs.js +150 -0
- package/dist/shared/lib/delivery-ack.js +9 -0
- package/dist/shared/lib/entry-badge-style.js +13 -0
- package/dist/shared/lib/entry-config.js +71 -0
- package/dist/shared/lib/form-sections.js +64 -0
- package/dist/shared/lib/form-structure.js +99 -0
- package/dist/shared/lib/form-usage-beacon.js +133 -0
- package/dist/shared/lib/jobs-tray.js +25 -23
- package/dist/shared/lib/keyset-pager.js +37 -0
- package/dist/shared/lib/layout-i18n.js +66 -0
- package/dist/shared/lib/layout-lint.js +490 -0
- package/dist/shared/lib/layout-ops.js +116 -110
- package/dist/shared/lib/layout-resolve.js +113 -0
- package/dist/shared/lib/placement-behaviour.js +144 -0
- package/dist/shared/lib/prefetch.js +149 -0
- package/dist/shared/lib/presence-hooks.js +199 -0
- package/dist/shared/lib/record-outbox.js +82 -81
- package/dist/shared/lib/replay-socket.js +93 -0
- package/dist/shared/lib/request-gate.js +51 -50
- package/dist/shared/lib/room-gaps.js +96 -0
- package/dist/shared/lib/screenshot.js +54 -28
- package/dist/shared/lib/search-log.js +27 -0
- package/dist/shared/lib/socket-realtime.js +101 -80
- package/dist/shared/lib/visible-when.js +34 -0
- package/dist/shared/lib/worker-socket.js +200 -0
- package/package.json +1 -1
|
@@ -1,127 +1,129 @@
|
|
|
1
|
-
import { readItems as
|
|
1
|
+
import { readItems as J } from "@nivaro/sdk";
|
|
2
2
|
import { useQueryClient as v, useMutation as h, useQuery as y } from "@tanstack/react-query";
|
|
3
|
-
import { useContext as
|
|
4
|
-
import { toast as
|
|
5
|
-
import { useNivaroClient as
|
|
6
|
-
import { get as g, patch as
|
|
7
|
-
import { isDndActive as
|
|
8
|
-
import { playNotificationSound as
|
|
9
|
-
import { announceLocalPrefs as
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
3
|
+
import { useContext as Z, useState as k, useEffect as $, useMemo as M, useCallback as O, useRef as Q, createContext as X } from "react";
|
|
4
|
+
import { toast as ee } from "sonner";
|
|
5
|
+
import { useNivaroClient as m } from "../../context.js";
|
|
6
|
+
import { get as g, patch as C, post as K, del as x } from "../../lib/commands.js";
|
|
7
|
+
import { isDndActive as te } from "../../lib/dnd.js";
|
|
8
|
+
import { playNotificationSound as ne } from "../../lib/notification-sound.js";
|
|
9
|
+
import { announceLocalPrefs as se } from "../../lib/user-sync.js";
|
|
10
|
+
import { bindChatOutbox as re, enqueueChatOutbox as oe } from "./chat-outbox.js";
|
|
11
|
+
import { discardOutbox as gt, editOutbox as pt, holdOutbox as vt, nudgeChatOutbox as qt, retryOutbox as bt, useOutbox as _t } from "./chat-outbox.js";
|
|
12
|
+
const $e = ["👍", "✅", "👀", "🎉", "❤️", "😂"], ae = X(null);
|
|
13
|
+
function q() {
|
|
14
|
+
const e = Z(ae);
|
|
13
15
|
if (!e) throw new Error("Chat components must be wrapped in <ChatProvider>");
|
|
14
16
|
return e;
|
|
15
17
|
}
|
|
16
|
-
const
|
|
18
|
+
const Ke = 0, Fe = {
|
|
17
19
|
collections: { messages: "chat_messages", reads: "chat_last_read", presence: "user_presence" },
|
|
18
20
|
globalRoom: "global",
|
|
19
21
|
globalLabel: "General",
|
|
20
22
|
entityPattern: String.raw`\b([A-Za-z]{2,4}\d{2}(?:INV)?-\d+)\b`
|
|
21
23
|
};
|
|
22
|
-
function
|
|
24
|
+
function Oe(e, t) {
|
|
23
25
|
return `dm:${[e.toUpperCase(), t.toUpperCase()].sort().join(":")}`;
|
|
24
26
|
}
|
|
25
|
-
function
|
|
27
|
+
function B(e, t) {
|
|
26
28
|
if (!e.startsWith("dm:")) return null;
|
|
27
|
-
const
|
|
28
|
-
return [
|
|
29
|
+
const s = e.slice(3);
|
|
30
|
+
return [s.slice(0, 36), s.slice(37)].find((o) => o.toLowerCase() !== t.toLowerCase()) ?? null;
|
|
29
31
|
}
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
function F(e, t) {
|
|
33
|
+
const s = q(), n = v(), o = (t ?? []).join("|");
|
|
34
|
+
$(() => {
|
|
33
35
|
const r = () => {
|
|
34
|
-
for (const
|
|
36
|
+
for (const a of e) n.invalidateQueries({ queryKey: a });
|
|
35
37
|
};
|
|
36
|
-
if (
|
|
37
|
-
if (
|
|
38
|
-
}, [
|
|
39
|
-
}
|
|
40
|
-
function
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
if (
|
|
44
|
-
return
|
|
45
|
-
for (const o of t)
|
|
38
|
+
if (s.subscribeRooms) return s.subscribeRooms(t ?? [], r);
|
|
39
|
+
if (s.realtime) return s.realtime(s.collections.messages, r);
|
|
40
|
+
}, [s.subscribeRooms, s.realtime, o, n]);
|
|
41
|
+
}
|
|
42
|
+
function ie(e, t) {
|
|
43
|
+
const s = q(), n = v();
|
|
44
|
+
$(() => {
|
|
45
|
+
if (s.realtime)
|
|
46
|
+
return s.realtime(e, () => {
|
|
47
|
+
for (const o of t) n.invalidateQueries({ queryKey: o });
|
|
46
48
|
});
|
|
47
|
-
}, [
|
|
49
|
+
}, [s.realtime, e, n]);
|
|
48
50
|
}
|
|
49
|
-
function
|
|
50
|
-
var
|
|
51
|
-
const
|
|
51
|
+
function Me(e, t = null) {
|
|
52
|
+
var U, D, A;
|
|
53
|
+
const s = q(), n = m(), o = t ? "around" in t ? `around:${t.around}` : `date:${t.date}` : "latest", { data: r, isLoading: a } = y({
|
|
52
54
|
queryKey: ["nvr-chat", e, o],
|
|
53
55
|
queryFn: async () => {
|
|
54
|
-
const
|
|
55
|
-
return t && "around" in t && (
|
|
56
|
-
g("/chat/messages",
|
|
56
|
+
const _ = { room: e, limit: 80 };
|
|
57
|
+
return t && "around" in t && (_.around = t.around), t && "date" in t && (_.date = t.date), await n.request(
|
|
58
|
+
g("/chat/messages", _)
|
|
57
59
|
);
|
|
58
60
|
},
|
|
59
61
|
enabled: !!e,
|
|
60
62
|
staleTime: 5e3,
|
|
61
|
-
refetchInterval:
|
|
63
|
+
refetchInterval: s.realtime || s.subscribeRooms ? void 0 : 1e4
|
|
62
64
|
});
|
|
63
|
-
|
|
64
|
-
const [c, u] =
|
|
65
|
-
|
|
65
|
+
F([["nvr-chat"], ["nvr-chat-rooms"], ["nvr-chat-thread"]], e ? [e] : []);
|
|
66
|
+
const [c, u] = k([]), [d, l] = k(null), [i, p] = k(!1);
|
|
67
|
+
$(() => {
|
|
66
68
|
u([]), l(null);
|
|
67
69
|
}, [e, o]);
|
|
68
|
-
const
|
|
69
|
-
if (c.length === 0) return
|
|
70
|
-
const
|
|
71
|
-
return [...c.filter((
|
|
72
|
-
}, [c,
|
|
73
|
-
var
|
|
74
|
-
if (!e ||
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
70
|
+
const f = (r == null ? void 0 : r.data) ?? [], b = M(() => {
|
|
71
|
+
if (c.length === 0) return f;
|
|
72
|
+
const _ = new Set(f.map((R) => R.id));
|
|
73
|
+
return [...c.filter((R) => !_.has(R.id)), ...f];
|
|
74
|
+
}, [c, f]), W = O(async () => {
|
|
75
|
+
var R;
|
|
76
|
+
if (!e || i) return;
|
|
77
|
+
const _ = b[0];
|
|
78
|
+
if (_) {
|
|
77
79
|
p(!0);
|
|
78
80
|
try {
|
|
79
|
-
const
|
|
80
|
-
g("/chat/messages", { room: e, limit: 60, before:
|
|
81
|
+
const E = await n.request(
|
|
82
|
+
g("/chat/messages", { room: e, limit: 60, before: _.id })
|
|
81
83
|
);
|
|
82
|
-
u((
|
|
84
|
+
u((Y) => [...E.data ?? [], ...Y]), l(!!((R = E.meta) != null && R.has_older));
|
|
83
85
|
} finally {
|
|
84
86
|
p(!1);
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
|
-
}, [e,
|
|
89
|
+
}, [e, b, n, i]);
|
|
88
90
|
return {
|
|
89
|
-
messages:
|
|
90
|
-
loading:
|
|
91
|
-
hasOlder: d ?? !!((
|
|
92
|
-
hasNewer: !!((
|
|
93
|
-
anchorId: ((
|
|
94
|
-
loadOlder:
|
|
95
|
-
loadingOlder:
|
|
91
|
+
messages: b,
|
|
92
|
+
loading: a,
|
|
93
|
+
hasOlder: d ?? !!((U = r == null ? void 0 : r.meta) != null && U.has_older),
|
|
94
|
+
hasNewer: !!((D = r == null ? void 0 : r.meta) != null && D.has_newer),
|
|
95
|
+
anchorId: ((A = r == null ? void 0 : r.meta) == null ? void 0 : A.anchor) ?? null,
|
|
96
|
+
loadOlder: W,
|
|
97
|
+
loadingOlder: i
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
|
-
function
|
|
99
|
-
const
|
|
100
|
+
function Ie(e, t) {
|
|
101
|
+
const s = q(), n = m(), { data: o, isLoading: r } = y({
|
|
100
102
|
queryKey: ["nvr-chat-thread", e, t],
|
|
101
|
-
queryFn: async () => (await
|
|
103
|
+
queryFn: async () => (await n.request(
|
|
102
104
|
g("/chat/messages", { room: e, thread: t, limit: 300 })
|
|
103
105
|
)).data ?? [],
|
|
104
106
|
enabled: !!e && !!t,
|
|
105
107
|
staleTime: 5e3,
|
|
106
|
-
refetchInterval:
|
|
108
|
+
refetchInterval: s.realtime || s.subscribeRooms ? void 0 : 1e4
|
|
107
109
|
});
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
+
F([["nvr-chat-thread"]], e ? [e] : []);
|
|
111
|
+
const a = o ?? [];
|
|
110
112
|
return {
|
|
111
|
-
root:
|
|
112
|
-
replies:
|
|
113
|
+
root: a.find((c) => c.id === t) ?? null,
|
|
114
|
+
replies: a.filter((c) => c.id !== t),
|
|
113
115
|
loading: r
|
|
114
116
|
};
|
|
115
117
|
}
|
|
116
|
-
function
|
|
117
|
-
var r,
|
|
118
|
-
const t =
|
|
119
|
-
return
|
|
118
|
+
function ke(e) {
|
|
119
|
+
var r, a, c;
|
|
120
|
+
const t = m(), s = v(), n = q();
|
|
121
|
+
return re(t, s, ((r = n.me) == null ? void 0 : r.id) ?? null), { mutate: O(
|
|
120
122
|
(u) => {
|
|
121
|
-
var l,
|
|
123
|
+
var l, i;
|
|
122
124
|
const d = typeof u == "string" ? { text: u } : u;
|
|
123
|
-
|
|
124
|
-
client_id:
|
|
125
|
+
oe({
|
|
126
|
+
client_id: ce(),
|
|
125
127
|
room: e,
|
|
126
128
|
text: d.text,
|
|
127
129
|
mentions: d.mentions ?? [],
|
|
@@ -129,142 +131,35 @@ function Be(e) {
|
|
|
129
131
|
parent_id: d.parentId ?? null,
|
|
130
132
|
quote_id: d.quoteId ?? null,
|
|
131
133
|
urgent: !!d.urgent,
|
|
132
|
-
status: "sending",
|
|
133
|
-
error: null,
|
|
134
134
|
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
135
|
-
sender: ((l =
|
|
136
|
-
sender_name: ((
|
|
135
|
+
sender: ((l = n.me) == null ? void 0 : l.id) ?? "",
|
|
136
|
+
sender_name: ((i = n.me) == null ? void 0 : i.name) ?? null
|
|
137
137
|
});
|
|
138
138
|
},
|
|
139
|
-
[e, (
|
|
139
|
+
[e, (a = n.me) == null ? void 0 : a.id, (c = n.me) == null ? void 0 : c.name]
|
|
140
140
|
), isPending: !1 };
|
|
141
141
|
}
|
|
142
|
-
|
|
143
|
-
let _ = [];
|
|
144
|
-
const A = /* @__PURE__ */ new Set();
|
|
145
|
-
let P = null, q = null, k = null, E = !1, U = null;
|
|
146
|
-
function pe() {
|
|
142
|
+
function ce() {
|
|
147
143
|
var t;
|
|
148
144
|
const e = globalThis.crypto;
|
|
149
145
|
return ((t = e == null ? void 0 : e.randomUUID) == null ? void 0 : t.call(e)) ?? `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
150
146
|
}
|
|
151
|
-
function
|
|
152
|
-
|
|
153
|
-
if (typeof localStorage > "u" || !k) return;
|
|
154
|
-
const e = _.filter((t) => t.sender === k);
|
|
155
|
-
localStorage.setItem(`${ne}:${k}`, JSON.stringify(e));
|
|
156
|
-
} catch {
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
function F() {
|
|
160
|
-
ve();
|
|
161
|
-
for (const e of A) e();
|
|
162
|
-
}
|
|
163
|
-
function qe(e, t, n) {
|
|
164
|
-
if (P = e, q = t, n && n !== k) {
|
|
165
|
-
k = n;
|
|
166
|
-
try {
|
|
167
|
-
const s = localStorage.getItem(`${ne}:${n}`), o = s ? JSON.parse(s) : [], r = new Set(_.map((i) => i.client_id));
|
|
168
|
-
for (const i of o)
|
|
169
|
-
r.has(i.client_id) || _.push({ ...i, status: i.status === "failed" ? "failed" : "queued" });
|
|
170
|
-
o.length && (F(), j(1e3));
|
|
171
|
-
} catch {
|
|
172
|
-
}
|
|
173
|
-
typeof window < "u" && window.addEventListener("online", () => j(0));
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
function _e(e) {
|
|
177
|
-
_.push(e), F(), G();
|
|
178
|
-
}
|
|
179
|
-
function j(e) {
|
|
180
|
-
U && clearTimeout(U), U = setTimeout(() => {
|
|
181
|
-
U = null;
|
|
182
|
-
for (const t of _) t.status === "queued" && (t.status = "sending");
|
|
183
|
-
F(), G();
|
|
184
|
-
}, e);
|
|
185
|
-
}
|
|
186
|
-
function be(e) {
|
|
187
|
-
const t = e == null ? void 0 : e.status;
|
|
188
|
-
return t == null ? !0 : t === 0 || t === 502 || t === 503 || t === 504;
|
|
189
|
-
}
|
|
190
|
-
async function G() {
|
|
191
|
-
if (!(E || !P)) {
|
|
192
|
-
E = !0;
|
|
193
|
-
try {
|
|
194
|
-
const e = /* @__PURE__ */ new Set();
|
|
195
|
-
for (const t of [..._])
|
|
196
|
-
if (t.status !== "failed" && !e.has(t.room)) {
|
|
197
|
-
if (t.status === "queued") {
|
|
198
|
-
e.add(t.room);
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
const n = await P.request(
|
|
203
|
-
S("/chat/messages", {
|
|
204
|
-
room: t.room,
|
|
205
|
-
message: t.text,
|
|
206
|
-
mentions: t.mentions,
|
|
207
|
-
attachments: t.attachments,
|
|
208
|
-
parent_id: t.parent_id,
|
|
209
|
-
quote_id: t.quote_id,
|
|
210
|
-
urgent: t.urgent,
|
|
211
|
-
client_id: t.client_id
|
|
212
|
-
})
|
|
213
|
-
);
|
|
214
|
-
_ = _.filter((o) => o.client_id !== t.client_id);
|
|
215
|
-
const s = n == null ? void 0 : n.data;
|
|
216
|
-
s && !t.parent_id && (q == null || q.setQueryData(
|
|
217
|
-
["nvr-chat", t.room, "latest"],
|
|
218
|
-
(o) => o && !o.data.some((r) => r.id === s.id) ? { ...o, data: [...o.data, s] } : o
|
|
219
|
-
)), q == null || q.invalidateQueries({ queryKey: ["nvr-chat", t.room] }), q == null || q.invalidateQueries({ queryKey: ["nvr-chat-thread", t.room] }), q == null || q.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), F();
|
|
220
|
-
} catch (n) {
|
|
221
|
-
if (be(n))
|
|
222
|
-
t.status = "queued", t.error = "Waiting for a connection", e.add(t.room), j(8e3);
|
|
223
|
-
else {
|
|
224
|
-
t.status = "failed";
|
|
225
|
-
const s = n == null ? void 0 : n.response;
|
|
226
|
-
t.error = (s == null ? void 0 : s.error) ?? (n instanceof Error ? n.message : "Could not send");
|
|
227
|
-
}
|
|
228
|
-
F();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
} finally {
|
|
232
|
-
E = !1;
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function Ge(e) {
|
|
237
|
-
const t = _.find((n) => n.client_id === e);
|
|
238
|
-
t && (t.status = "sending", t.error = null, F(), G());
|
|
239
|
-
}
|
|
240
|
-
function He(e) {
|
|
241
|
-
_ = _.filter((t) => t.client_id !== e), F();
|
|
242
|
-
}
|
|
243
|
-
function Je(e, t = null) {
|
|
244
|
-
const [, n] = I(0);
|
|
245
|
-
return M(() => {
|
|
246
|
-
const s = () => n((o) => o + 1);
|
|
247
|
-
return A.add(s), () => {
|
|
248
|
-
A.delete(s);
|
|
249
|
-
};
|
|
250
|
-
}, []), _.filter((s) => s.room === e && (s.parent_id ?? null) === t);
|
|
251
|
-
}
|
|
252
|
-
function se(e, t, n) {
|
|
253
|
-
const s = (t == null ? void 0 : t.toLowerCase()) ?? "";
|
|
147
|
+
function G(e, t, s) {
|
|
148
|
+
const n = (t == null ? void 0 : t.toLowerCase()) ?? "";
|
|
254
149
|
return e.map((r) => {
|
|
255
|
-
var u, d, l,
|
|
256
|
-
const
|
|
150
|
+
var u, d, l, i, p;
|
|
151
|
+
const a = r.kind === "unknown" ? "entity" : r.kind, c = a === "global" ? (
|
|
257
152
|
// The server names General only when an admin renamed it.
|
|
258
|
-
r.label ??
|
|
259
|
-
) :
|
|
153
|
+
r.label ?? s.globalLabel
|
|
154
|
+
) : a === "dm" ? (
|
|
260
155
|
// The server resolves the peer's name from the user table; the
|
|
261
156
|
// message sender is only a fallback for hosts that don't send one.
|
|
262
|
-
r.label ?? (((d = (u = r.last_message) == null ? void 0 : u.sender) == null ? void 0 : d.toLowerCase()) !==
|
|
263
|
-
) : r.label ?? ((p =
|
|
157
|
+
r.label ?? (((d = (u = r.last_message) == null ? void 0 : u.sender) == null ? void 0 : d.toLowerCase()) !== n ? ((l = r.last_message) == null ? void 0 : l.sender_name) ?? null : null) ?? `User ${((i = B(r.room, n)) == null ? void 0 : i.slice(0, 8)) ?? ""}`
|
|
158
|
+
) : r.label ?? ((p = s.roomLabel) == null ? void 0 : p.call(s, r.room)) ?? r.room.toUpperCase();
|
|
264
159
|
return {
|
|
265
160
|
room: r.room,
|
|
266
161
|
label: c,
|
|
267
|
-
kind:
|
|
162
|
+
kind: a,
|
|
268
163
|
lastMessage: r.last_message,
|
|
269
164
|
unread: r.unread,
|
|
270
165
|
muted: r.muted,
|
|
@@ -276,26 +171,26 @@ function se(e, t, n) {
|
|
|
276
171
|
mentions: r.mentions ?? 0,
|
|
277
172
|
welcome_seen_at: r.welcome_seen_at ?? null
|
|
278
173
|
};
|
|
279
|
-
}).sort((r,
|
|
174
|
+
}).sort((r, a) => {
|
|
280
175
|
if (r.kind === "global") return -1;
|
|
281
|
-
if (
|
|
176
|
+
if (a.kind === "global") return 1;
|
|
282
177
|
const c = r.lastMessage ? new Date(r.lastMessage.date_created).getTime() : 0;
|
|
283
|
-
return (
|
|
178
|
+
return (a.lastMessage ? new Date(a.lastMessage.date_created).getTime() : 0) - c;
|
|
284
179
|
});
|
|
285
180
|
}
|
|
286
|
-
function
|
|
287
|
-
const e =
|
|
288
|
-
queryKey: ["nvr-chat-rooms",
|
|
181
|
+
function Le() {
|
|
182
|
+
const e = q(), t = m(), s = e.me, n = y({
|
|
183
|
+
queryKey: ["nvr-chat-rooms", s == null ? void 0 : s.id],
|
|
289
184
|
queryFn: async () => (await t.request(g("/chat/rooms"))).data ?? [],
|
|
290
|
-
enabled: !!
|
|
185
|
+
enabled: !!s,
|
|
291
186
|
refetchInterval: 45e3,
|
|
292
187
|
staleTime: 1e4
|
|
293
188
|
});
|
|
294
|
-
|
|
295
|
-
const o =
|
|
296
|
-
() =>
|
|
297
|
-
[
|
|
298
|
-
), r =
|
|
189
|
+
F([["nvr-chat-rooms"]]);
|
|
190
|
+
const o = M(
|
|
191
|
+
() => G(n.data ?? [], s == null ? void 0 : s.id, e),
|
|
192
|
+
[n.data, s == null ? void 0 : s.id, e]
|
|
193
|
+
), r = I().chat_badge_mode, a = o.reduce((c, u) => {
|
|
299
194
|
var d;
|
|
300
195
|
if (u.muted) return c;
|
|
301
196
|
if (r === "conversations") {
|
|
@@ -304,62 +199,62 @@ function We() {
|
|
|
304
199
|
}
|
|
305
200
|
return c + u.unread;
|
|
306
201
|
}, 0);
|
|
307
|
-
return { rooms: o, totalUnread:
|
|
202
|
+
return { rooms: o, totalUnread: a, loading: n.isLoading };
|
|
308
203
|
}
|
|
309
|
-
function
|
|
310
|
-
const t =
|
|
311
|
-
queryKey: ["nvr-chat-rooms",
|
|
312
|
-
queryFn: async () => (await
|
|
204
|
+
function Qe(e) {
|
|
205
|
+
const t = q(), s = m(), n = t.me, o = y({
|
|
206
|
+
queryKey: ["nvr-chat-rooms", n == null ? void 0 : n.id, "archived"],
|
|
207
|
+
queryFn: async () => (await s.request(
|
|
313
208
|
g("/chat/rooms", { archived: "1" })
|
|
314
209
|
)).data ?? [],
|
|
315
|
-
enabled: !!
|
|
210
|
+
enabled: !!n && e,
|
|
316
211
|
staleTime: 1e4
|
|
317
212
|
});
|
|
318
|
-
return { rooms:
|
|
213
|
+
return { rooms: M(() => G(o.data ?? [], n == null ? void 0 : n.id, t), [o.data, n == null ? void 0 : n.id, t]), loading: o.isLoading };
|
|
319
214
|
}
|
|
320
|
-
function
|
|
321
|
-
const t =
|
|
215
|
+
function xe(e) {
|
|
216
|
+
const t = m(), { data: s, isLoading: n } = y({
|
|
322
217
|
queryKey: ["nvr-chat-directory", e],
|
|
323
218
|
queryFn: async () => (await t.request(
|
|
324
219
|
g("/chat/directory", e ? { search: e } : void 0)
|
|
325
220
|
)).data ?? [],
|
|
326
221
|
staleTime: 15e3
|
|
327
222
|
});
|
|
328
|
-
return { channels:
|
|
223
|
+
return { channels: s ?? [], loading: n };
|
|
329
224
|
}
|
|
330
|
-
function
|
|
331
|
-
const e =
|
|
225
|
+
function Ue() {
|
|
226
|
+
const e = m(), t = v(), s = () => {
|
|
332
227
|
t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), t.invalidateQueries({ queryKey: ["nvr-chat-directory"] });
|
|
333
|
-
},
|
|
334
|
-
mutationFn: (l) => e.request(
|
|
335
|
-
onSuccess:
|
|
228
|
+
}, n = h({
|
|
229
|
+
mutationFn: (l) => e.request(K(`/chat/rooms/${encodeURIComponent(l)}/join`)),
|
|
230
|
+
onSuccess: s
|
|
336
231
|
}), o = h({
|
|
337
|
-
mutationFn: (l) => e.request(
|
|
338
|
-
onSuccess:
|
|
232
|
+
mutationFn: (l) => e.request(x(`/chat/rooms/${encodeURIComponent(l)}/join`)),
|
|
233
|
+
onSuccess: s
|
|
339
234
|
}), r = h({
|
|
340
|
-
mutationFn: ({ room: l, muted:
|
|
341
|
-
onSuccess:
|
|
342
|
-
}),
|
|
343
|
-
mutationFn: ({ room: l, mode:
|
|
344
|
-
|
|
345
|
-
notify_mode:
|
|
235
|
+
mutationFn: ({ room: l, muted: i }) => e.request(C(`/chat/rooms/${encodeURIComponent(l)}`, { muted: i })),
|
|
236
|
+
onSuccess: s
|
|
237
|
+
}), a = h({
|
|
238
|
+
mutationFn: ({ room: l, mode: i }) => e.request(
|
|
239
|
+
C(`/chat/rooms/${encodeURIComponent(l)}`, {
|
|
240
|
+
notify_mode: i === "mentions" ? "mentions" : null
|
|
346
241
|
})
|
|
347
242
|
),
|
|
348
|
-
onSuccess:
|
|
243
|
+
onSuccess: s
|
|
349
244
|
}), c = h({
|
|
350
|
-
mutationFn: ({ room: l, archived:
|
|
351
|
-
onSuccess:
|
|
245
|
+
mutationFn: ({ room: l, archived: i }) => e.request(C(`/chat/rooms/${encodeURIComponent(l)}`, { archived: i })),
|
|
246
|
+
onSuccess: s
|
|
352
247
|
}), u = h({
|
|
353
|
-
mutationFn: ({ room: l, starred:
|
|
354
|
-
onSuccess:
|
|
248
|
+
mutationFn: ({ room: l, starred: i }) => e.request(C(`/chat/rooms/${encodeURIComponent(l)}`, { starred: i })),
|
|
249
|
+
onSuccess: s
|
|
355
250
|
}), d = h({
|
|
356
|
-
mutationFn: (l) => e.request(
|
|
357
|
-
onSuccess:
|
|
251
|
+
mutationFn: (l) => e.request(C(`/chat/rooms/${encodeURIComponent(l)}`, { welcome_seen: !0 })),
|
|
252
|
+
onSuccess: s
|
|
358
253
|
});
|
|
359
|
-
return { join:
|
|
254
|
+
return { join: n, leave: o, setMuted: r, setNotifyMode: a, setArchived: c, setStarred: u, dismissWelcome: d };
|
|
360
255
|
}
|
|
361
|
-
function
|
|
362
|
-
const t =
|
|
256
|
+
function De(e) {
|
|
257
|
+
const t = m(), { data: s, isLoading: n } = y({
|
|
363
258
|
queryKey: ["nvr-chat-members", e],
|
|
364
259
|
queryFn: async () => (await t.request(
|
|
365
260
|
g(`/chat/channels/${e}/members`)
|
|
@@ -367,25 +262,25 @@ function Xe(e) {
|
|
|
367
262
|
enabled: e != null,
|
|
368
263
|
staleTime: 1e4
|
|
369
264
|
});
|
|
370
|
-
return { members:
|
|
265
|
+
return { members: s ?? [], loading: n };
|
|
371
266
|
}
|
|
372
|
-
function
|
|
373
|
-
const t =
|
|
374
|
-
|
|
267
|
+
function Ae(e) {
|
|
268
|
+
const t = m(), s = v(), n = () => {
|
|
269
|
+
s.invalidateQueries({ queryKey: ["nvr-chat-members", e] }), s.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), s.invalidateQueries({ queryKey: ["nvr-chat-directory"] });
|
|
375
270
|
}, o = h({
|
|
376
|
-
mutationFn: (c) => t.request(
|
|
377
|
-
onSuccess:
|
|
271
|
+
mutationFn: (c) => t.request(C(`/chat/channels/${e}`, c)),
|
|
272
|
+
onSuccess: n
|
|
378
273
|
}), r = h({
|
|
379
|
-
mutationFn: (c) => t.request(
|
|
380
|
-
onSuccess:
|
|
381
|
-
}),
|
|
382
|
-
mutationFn: (c) => t.request(
|
|
383
|
-
onSuccess:
|
|
274
|
+
mutationFn: (c) => t.request(K(`/chat/channels/${e}/members`, { user_id: c })),
|
|
275
|
+
onSuccess: n
|
|
276
|
+
}), a = h({
|
|
277
|
+
mutationFn: (c) => t.request(x(`/chat/channels/${e}/members/${c}`)),
|
|
278
|
+
onSuccess: n
|
|
384
279
|
});
|
|
385
|
-
return { update: o, addMember: r, removeMember:
|
|
280
|
+
return { update: o, addMember: r, removeMember: a };
|
|
386
281
|
}
|
|
387
|
-
function
|
|
388
|
-
const e =
|
|
282
|
+
function Ee() {
|
|
283
|
+
const e = m(), { data: t } = y({
|
|
389
284
|
queryKey: ["nvr-chat-roles"],
|
|
390
285
|
queryFn: async () => (await e.request(
|
|
391
286
|
g("/chat/roles")
|
|
@@ -394,194 +289,214 @@ function et() {
|
|
|
394
289
|
});
|
|
395
290
|
return t ?? [];
|
|
396
291
|
}
|
|
397
|
-
function
|
|
398
|
-
const
|
|
292
|
+
function Ne(e, t) {
|
|
293
|
+
const s = m(), { data: n, isLoading: o } = y({
|
|
399
294
|
queryKey: ["nvr-chat-user-search", e],
|
|
400
|
-
queryFn: async () => (await
|
|
295
|
+
queryFn: async () => (await s.request(
|
|
401
296
|
g("/users", { limit: 20, ...e.trim() ? { search: e.trim() } : {} })
|
|
402
297
|
)).data ?? [],
|
|
403
298
|
enabled: t,
|
|
404
299
|
staleTime: 3e4
|
|
405
300
|
});
|
|
406
|
-
return { users:
|
|
301
|
+
return { users: n ?? [], loading: o };
|
|
407
302
|
}
|
|
408
|
-
function
|
|
409
|
-
const e =
|
|
303
|
+
function Pe() {
|
|
304
|
+
const e = m(), t = v();
|
|
410
305
|
return h({
|
|
411
|
-
mutationFn: (
|
|
306
|
+
mutationFn: (s) => e.request(K("/chat/channels", s)),
|
|
412
307
|
onSuccess: () => {
|
|
413
308
|
t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] }), t.invalidateQueries({ queryKey: ["nvr-chat-directory"] });
|
|
414
309
|
}
|
|
415
310
|
});
|
|
416
311
|
}
|
|
417
|
-
let
|
|
418
|
-
const
|
|
419
|
-
function
|
|
312
|
+
let N = 0;
|
|
313
|
+
const L = /* @__PURE__ */ new Map();
|
|
314
|
+
function P(e) {
|
|
420
315
|
var t;
|
|
421
316
|
return e.kind === "dm" || e.kind === "channel" && !!((t = e.channel) != null && t.is_direct);
|
|
422
317
|
}
|
|
423
|
-
const
|
|
424
|
-
function
|
|
425
|
-
|
|
318
|
+
const w = /* @__PURE__ */ new Map();
|
|
319
|
+
function je(e) {
|
|
320
|
+
$(() => {
|
|
426
321
|
if (e)
|
|
427
|
-
return
|
|
428
|
-
const t = (
|
|
429
|
-
t <= 0 ?
|
|
322
|
+
return w.set(e, (w.get(e) ?? 0) + 1), () => {
|
|
323
|
+
const t = (w.get(e) ?? 1) - 1;
|
|
324
|
+
t <= 0 ? w.delete(e) : w.set(e, t);
|
|
430
325
|
};
|
|
431
326
|
}, [e]);
|
|
432
327
|
}
|
|
433
|
-
function
|
|
328
|
+
function ue() {
|
|
434
329
|
return typeof document > "u" || document.visibilityState === "visible";
|
|
435
330
|
}
|
|
436
|
-
function
|
|
437
|
-
return
|
|
331
|
+
function j(e) {
|
|
332
|
+
return w.has(e) && ue();
|
|
438
333
|
}
|
|
439
|
-
function
|
|
440
|
-
const e =
|
|
334
|
+
function le() {
|
|
335
|
+
const e = I().notification_sound;
|
|
441
336
|
return typeof e == "string" ? e : "off";
|
|
442
337
|
}
|
|
443
|
-
function
|
|
444
|
-
const e =
|
|
338
|
+
function I() {
|
|
339
|
+
const e = m(), { data: t } = y({
|
|
445
340
|
queryKey: ["nvr-profile-prefs"],
|
|
446
|
-
queryFn: () => e.request(g("/users/me")).then((
|
|
447
|
-
var
|
|
448
|
-
return ((
|
|
341
|
+
queryFn: () => e.request(g("/users/me")).then((s) => {
|
|
342
|
+
var n;
|
|
343
|
+
return ((n = s.data) == null ? void 0 : n.preferences) ?? {};
|
|
449
344
|
}),
|
|
450
345
|
staleTime: 6e4
|
|
451
346
|
});
|
|
452
347
|
return t ?? {};
|
|
453
348
|
}
|
|
454
|
-
function
|
|
455
|
-
const e =
|
|
349
|
+
function de() {
|
|
350
|
+
const e = m(), t = v();
|
|
456
351
|
return h({
|
|
457
|
-
mutationFn: (
|
|
458
|
-
onMutate: (
|
|
459
|
-
const
|
|
460
|
-
return t.setQueryData(["nvr-profile-prefs"], { ...
|
|
352
|
+
mutationFn: (s) => e.request(C("/users/me/preferences", s)),
|
|
353
|
+
onMutate: (s) => {
|
|
354
|
+
const n = t.getQueryData(["nvr-profile-prefs"]);
|
|
355
|
+
return t.setQueryData(["nvr-profile-prefs"], { ...n ?? {}, ...s }), { prev: n };
|
|
461
356
|
},
|
|
462
|
-
onError: (
|
|
357
|
+
onError: (s, n, o) => {
|
|
463
358
|
o != null && o.prev && t.setQueryData(["nvr-profile-prefs"], o.prev);
|
|
464
359
|
},
|
|
465
|
-
onSuccess: (
|
|
360
|
+
onSuccess: (s, n) => se(Object.keys(n)),
|
|
466
361
|
onSettled: () => {
|
|
467
362
|
t.invalidateQueries({ queryKey: ["nvr-profile-prefs"] }), t.invalidateQueries({ queryKey: ["presence-online"] });
|
|
468
363
|
}
|
|
469
364
|
});
|
|
470
365
|
}
|
|
471
|
-
function
|
|
472
|
-
const
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
366
|
+
function ze() {
|
|
367
|
+
const e = I(), t = de(), s = Object.keys(e).length > 0;
|
|
368
|
+
$(() => {
|
|
369
|
+
if (!s) return;
|
|
370
|
+
let n = "";
|
|
371
|
+
try {
|
|
372
|
+
n = Intl.DateTimeFormat().resolvedOptions().timeZone || "";
|
|
373
|
+
} catch {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
if (!(!n || e.browser_timezone === n)) {
|
|
377
|
+
try {
|
|
378
|
+
if (sessionStorage.getItem("nvr-browser-tz") === n) return;
|
|
379
|
+
sessionStorage.setItem("nvr-browser-tz", n);
|
|
380
|
+
} catch {
|
|
381
|
+
}
|
|
382
|
+
t.mutate({ browser_timezone: n });
|
|
383
|
+
}
|
|
384
|
+
}, [s, e.browser_timezone]);
|
|
385
|
+
}
|
|
386
|
+
function Be(e, t) {
|
|
387
|
+
const s = q(), n = le(), o = I(), r = Q(o);
|
|
388
|
+
r.current = o, $(() => {
|
|
389
|
+
const a = t ? t.filter((d) => P(d) && !j(d.room)).reduce((d, l) => d + l.unread, 0) : e, c = a > N, u = te(r.current);
|
|
390
|
+
if (s.sound && c && !u && ne(n), t) {
|
|
391
|
+
const d = L.size > 0, l = w.size > 0;
|
|
392
|
+
for (const i of t) {
|
|
393
|
+
const p = L.get(i.room) ?? 0;
|
|
394
|
+
if (d && !u && !i.muted && P(i) && i.unread > p && !j(i.room)) {
|
|
395
|
+
const f = i.lastMessage, b = f != null && f.sender_name ? String(f.sender_name).trim() : null;
|
|
396
|
+
ee(
|
|
397
|
+
i.kind === "dm" ? `New message from ${b || i.label}` : `New message in ${i.label}${b ? ` — ${b}` : ""}`,
|
|
483
398
|
{
|
|
484
|
-
description:
|
|
399
|
+
description: f != null && f.message ? String(f.message).replace(/<[^>]*>/g, "").slice(0, 90) : void 0,
|
|
485
400
|
duration: 4e3,
|
|
486
401
|
...l ? { position: "top-center" } : {},
|
|
487
402
|
// Reading the message is the whole reason the toast exists, so
|
|
488
403
|
// it opens the conversation — only when a host has somewhere to
|
|
489
404
|
// open it, otherwise the click would do nothing.
|
|
490
|
-
...
|
|
405
|
+
...ge() ? {
|
|
491
406
|
className: "cursor-pointer",
|
|
492
407
|
onDismiss: void 0,
|
|
493
408
|
action: {
|
|
494
409
|
label: "Open",
|
|
495
|
-
onClick: () =>
|
|
410
|
+
onClick: () => V(i.room, i.label)
|
|
496
411
|
}
|
|
497
412
|
} : {}
|
|
498
413
|
}
|
|
499
414
|
);
|
|
500
415
|
}
|
|
501
|
-
|
|
416
|
+
L.set(i.room, i.unread);
|
|
502
417
|
}
|
|
503
418
|
}
|
|
504
|
-
|
|
505
|
-
}, [e,
|
|
419
|
+
N = a;
|
|
420
|
+
}, [e, s.sound, t, n]);
|
|
506
421
|
}
|
|
507
|
-
function
|
|
508
|
-
const e =
|
|
422
|
+
function Ge() {
|
|
423
|
+
const e = m(), t = v();
|
|
509
424
|
return h({
|
|
510
|
-
mutationFn: (
|
|
425
|
+
mutationFn: (s) => e.request(K(`/chat/rooms/${encodeURIComponent(s)}/read`)),
|
|
511
426
|
onSuccess: () => void t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] })
|
|
512
427
|
});
|
|
513
428
|
}
|
|
514
|
-
const
|
|
515
|
-
function
|
|
429
|
+
const me = ["nvr-chat-room-types"];
|
|
430
|
+
function H(e) {
|
|
516
431
|
return {
|
|
517
|
-
queryKey:
|
|
432
|
+
queryKey: me,
|
|
518
433
|
queryFn: async () => {
|
|
519
434
|
const t = await e.request(g("/chat/room-types"));
|
|
520
|
-
return ((t == null ? void 0 : t.data) ?? []).filter((
|
|
435
|
+
return ((t == null ? void 0 : t.data) ?? []).filter((s) => s.is_active);
|
|
521
436
|
},
|
|
522
437
|
staleTime: 5 * 6e4
|
|
523
438
|
};
|
|
524
439
|
}
|
|
525
|
-
function
|
|
526
|
-
const t =
|
|
440
|
+
function He(e) {
|
|
441
|
+
const t = q(), s = m(), n = (e == null ? void 0 : e.indexOf(":")) ?? -1, o = e && n > 0 ? e.slice(0, n) : null, r = e && n > 0 ? e.slice(n + 1) : null, a = !!e && !!o && !!r && e !== t.globalRoom && o !== "dm" && o !== "ch", { data: c } = y({ ...H(s), enabled: a }), u = a ? c == null ? void 0 : c.find((i) => i.is_active && i.prefix === o) : void 0, { data: d } = y({
|
|
527
442
|
queryKey: ["nvr-chat-entity-record", u == null ? void 0 : u.collection, u == null ? void 0 : u.match_field, r],
|
|
528
443
|
queryFn: async () => {
|
|
529
|
-
var p,
|
|
530
|
-
return u.match_field === "id" ? r : ((
|
|
444
|
+
var p, f;
|
|
445
|
+
return u.match_field === "id" ? r : ((f = (p = (await s.request(
|
|
531
446
|
g(`/items/${u.collection}`, {
|
|
532
447
|
limit: 1,
|
|
533
448
|
fields: "id",
|
|
534
449
|
filter: JSON.stringify({ [u.match_field]: { _eq: r } })
|
|
535
450
|
})
|
|
536
|
-
)).data) == null ? void 0 : p[0]) == null ? void 0 :
|
|
451
|
+
)).data) == null ? void 0 : p[0]) == null ? void 0 : f.id) ?? null;
|
|
537
452
|
},
|
|
538
453
|
enabled: !!u && !!r,
|
|
539
454
|
staleTime: 5 * 6e4
|
|
540
455
|
});
|
|
541
|
-
return !u || d == null ? null : (t.recordUrl ?? ((
|
|
542
|
-
}
|
|
543
|
-
const
|
|
544
|
-
function
|
|
545
|
-
const
|
|
546
|
-
for (const
|
|
547
|
-
|
|
548
|
-
start:
|
|
549
|
-
end:
|
|
550
|
-
token: { text: `@${
|
|
456
|
+
return !u || d == null ? null : (t.recordUrl ?? ((i, p) => `/collections/${i}/${p}`))(u.collection, d);
|
|
457
|
+
}
|
|
458
|
+
const fe = /@\[([^\]]+)\](?:\([^)]*\))?/g;
|
|
459
|
+
function Ve(e, t) {
|
|
460
|
+
const s = new RegExp(t, "gi"), n = [];
|
|
461
|
+
for (const a of e.matchAll(fe))
|
|
462
|
+
n.push({
|
|
463
|
+
start: a.index,
|
|
464
|
+
end: a.index + a[0].length,
|
|
465
|
+
token: { text: `@${a[1]}`, mention: a[1] }
|
|
551
466
|
});
|
|
552
|
-
for (const
|
|
553
|
-
|
|
554
|
-
start:
|
|
555
|
-
end:
|
|
556
|
-
token: { text:
|
|
467
|
+
for (const a of e.matchAll(s))
|
|
468
|
+
n.some((c) => a.index >= c.start && a.index < c.end) || n.push({
|
|
469
|
+
start: a.index,
|
|
470
|
+
end: a.index + a[0].length,
|
|
471
|
+
token: { text: a[0], entity: a[0].toUpperCase() }
|
|
557
472
|
});
|
|
558
|
-
|
|
473
|
+
n.sort((a, c) => a.start - c.start);
|
|
559
474
|
const o = [];
|
|
560
475
|
let r = 0;
|
|
561
|
-
for (const
|
|
562
|
-
|
|
476
|
+
for (const a of n)
|
|
477
|
+
a.start > r && o.push({ text: e.slice(r, a.start) }), o.push(a.token), r = a.end;
|
|
563
478
|
return r < e.length && o.push({ text: e.slice(r) }), o;
|
|
564
479
|
}
|
|
565
|
-
function
|
|
566
|
-
const
|
|
567
|
-
return
|
|
480
|
+
function We(e, t) {
|
|
481
|
+
const n = e.slice(0, t).match(/@([^@\n\r]*)$/);
|
|
482
|
+
return n ? n[1] : null;
|
|
568
483
|
}
|
|
569
|
-
const
|
|
570
|
-
function
|
|
571
|
-
const t =
|
|
484
|
+
const he = 3e3;
|
|
485
|
+
function Ye(e) {
|
|
486
|
+
const t = q(), s = m();
|
|
572
487
|
v();
|
|
573
|
-
const
|
|
574
|
-
o.current && clearTimeout(o.current), o.current = null,
|
|
575
|
-
}, [r, t]), c =
|
|
576
|
-
!r || !e || !t.setTypingRoom || (
|
|
577
|
-
}, [r, e, t,
|
|
578
|
-
|
|
488
|
+
const n = Q(!1), o = Q(null), r = t.me, a = O(() => {
|
|
489
|
+
o.current && clearTimeout(o.current), o.current = null, n.current && r && t.setTypingRoom && (n.current = !1, t.setTypingRoom(r.id, null));
|
|
490
|
+
}, [r, t]), c = O(() => {
|
|
491
|
+
!r || !e || !t.setTypingRoom || (n.current || (n.current = !0, t.setTypingRoom(r.id, e)), o.current && clearTimeout(o.current), o.current = setTimeout(a, he));
|
|
492
|
+
}, [r, e, t, a]);
|
|
493
|
+
$(() => a, [a]);
|
|
579
494
|
const { data: u } = y({
|
|
580
495
|
queryKey: ["nvr-chat-typing", e],
|
|
581
496
|
queryFn: async () => {
|
|
582
497
|
const l = new Date(Date.now() - 6e4).toISOString();
|
|
583
|
-
return (await
|
|
584
|
-
|
|
498
|
+
return (await s.request(
|
|
499
|
+
J(t.collections.presence, {
|
|
585
500
|
limit: 10,
|
|
586
501
|
fields: ["user_id", "display_name", "typing_room", "last_seen"],
|
|
587
502
|
filter: { typing_room: { _eq: e }, last_seen: { _gte: l } }
|
|
@@ -592,23 +507,23 @@ function lt(e) {
|
|
|
592
507
|
refetchInterval: 6e3,
|
|
593
508
|
staleTime: 2e3
|
|
594
509
|
});
|
|
595
|
-
|
|
596
|
-
const d =
|
|
510
|
+
ie(t.collections.presence, [["nvr-chat-typing"]]);
|
|
511
|
+
const d = M(() => {
|
|
597
512
|
var p;
|
|
598
|
-
const l = (p = r == null ? void 0 : r.id) == null ? void 0 : p.toLowerCase(),
|
|
599
|
-
var
|
|
600
|
-
return ((
|
|
601
|
-
}).map((
|
|
602
|
-
return
|
|
513
|
+
const l = (p = r == null ? void 0 : r.id) == null ? void 0 : p.toLowerCase(), i = (u ?? []).filter((f) => {
|
|
514
|
+
var b;
|
|
515
|
+
return ((b = f.user_id) == null ? void 0 : b.toLowerCase()) !== l;
|
|
516
|
+
}).map((f) => f.display_name ?? "Someone");
|
|
517
|
+
return i.length === 0 ? null : i.length === 1 ? `${i[0]} is typing…` : i.length === 2 ? `${i[0]} and ${i[1]} are typing…` : `${i.length} people are typing…`;
|
|
603
518
|
}, [u, r == null ? void 0 : r.id]);
|
|
604
|
-
return { onType: c, clearTyping:
|
|
519
|
+
return { onType: c, clearTyping: a, typingText: d };
|
|
605
520
|
}
|
|
606
|
-
function
|
|
607
|
-
const t =
|
|
521
|
+
function Je(e) {
|
|
522
|
+
const t = q(), s = m(), n = t.me, o = e && n ? B(e, n.id) : null, { data: r } = y({
|
|
608
523
|
queryKey: ["nvr-chat-peer-read", e],
|
|
609
524
|
queryFn: async () => {
|
|
610
525
|
var c;
|
|
611
|
-
return ((c = (await
|
|
526
|
+
return ((c = (await s.request(
|
|
612
527
|
g(
|
|
613
528
|
`/chat/rooms/${encodeURIComponent(e)}/peer-read`
|
|
614
529
|
)
|
|
@@ -618,64 +533,64 @@ function dt(e) {
|
|
|
618
533
|
refetchInterval: 3e4,
|
|
619
534
|
staleTime: 5e3
|
|
620
535
|
});
|
|
621
|
-
return
|
|
536
|
+
return F([["nvr-chat-peer-read"]], e ? [e] : []), r ?? null;
|
|
622
537
|
}
|
|
623
|
-
function
|
|
624
|
-
const t =
|
|
538
|
+
function Ze(e) {
|
|
539
|
+
const t = m(), s = v();
|
|
625
540
|
return h({
|
|
626
|
-
mutationFn: ({ messageId:
|
|
627
|
-
onSuccess: () => void
|
|
541
|
+
mutationFn: ({ messageId: n, emoji: o }) => t.request(K(`/chat/messages/${n}/reactions`, { emoji: o })),
|
|
542
|
+
onSuccess: () => void s.invalidateQueries({ queryKey: ["nvr-chat", e] })
|
|
628
543
|
});
|
|
629
544
|
}
|
|
630
|
-
function
|
|
631
|
-
const t =
|
|
545
|
+
function Xe(e) {
|
|
546
|
+
const t = m(), s = v();
|
|
632
547
|
return h({
|
|
633
|
-
mutationFn: ({ messageId:
|
|
634
|
-
onSuccess: () => void
|
|
548
|
+
mutationFn: ({ messageId: n, text: o }) => t.request(C(`/chat/messages/${n}`, { message: o })),
|
|
549
|
+
onSuccess: () => void s.invalidateQueries({ queryKey: ["nvr-chat", e] })
|
|
635
550
|
});
|
|
636
551
|
}
|
|
637
|
-
function
|
|
638
|
-
const t =
|
|
552
|
+
function et(e) {
|
|
553
|
+
const t = m(), s = v();
|
|
639
554
|
return h({
|
|
640
|
-
mutationFn: (
|
|
555
|
+
mutationFn: (n) => t.request(x(`/chat/messages/${n}`)),
|
|
641
556
|
onSuccess: () => {
|
|
642
|
-
|
|
557
|
+
s.invalidateQueries({ queryKey: ["nvr-chat", e] }), s.invalidateQueries({ queryKey: ["nvr-chat-rooms"] });
|
|
643
558
|
}
|
|
644
559
|
});
|
|
645
560
|
}
|
|
646
|
-
function
|
|
647
|
-
const
|
|
648
|
-
t.sender && (
|
|
649
|
-
const o = Object.keys(
|
|
650
|
-
queryKey: ["nvr-chat-search",
|
|
651
|
-
queryFn: async () => (await
|
|
652
|
-
g("/chat/search",
|
|
561
|
+
function tt(e, t = {}) {
|
|
562
|
+
const s = m(), n = { q: e };
|
|
563
|
+
t.sender && (n.sender = t.sender), t.room && (n.room = t.room), t.from && (n.from = t.from), t.to && (n.to = t.to), t.has_attachment && (n.has_attachment = "1"), t.mentions_me && (n.mentions_me = "1");
|
|
564
|
+
const o = Object.keys(n).length > 1, { data: r, isLoading: a } = y({
|
|
565
|
+
queryKey: ["nvr-chat-search", n],
|
|
566
|
+
queryFn: async () => (await s.request(
|
|
567
|
+
g("/chat/search", n)
|
|
653
568
|
)).data ?? [],
|
|
654
569
|
enabled: e.trim().length >= 2 || o,
|
|
655
570
|
staleTime: 15e3
|
|
656
571
|
});
|
|
657
|
-
return { hits: r ?? [], loading:
|
|
572
|
+
return { hits: r ?? [], loading: a };
|
|
658
573
|
}
|
|
659
|
-
function
|
|
660
|
-
const e =
|
|
574
|
+
function nt() {
|
|
575
|
+
const e = m(), t = v();
|
|
661
576
|
return h({
|
|
662
|
-
mutationFn: async (
|
|
577
|
+
mutationFn: async (s) => (await e.request(K("/chat/group-dm", s))).data,
|
|
663
578
|
onSuccess: () => void t.invalidateQueries({ queryKey: ["nvr-chat-rooms"] })
|
|
664
579
|
});
|
|
665
580
|
}
|
|
666
|
-
function
|
|
667
|
-
const e =
|
|
581
|
+
function ye() {
|
|
582
|
+
const e = m(), { data: t } = y({
|
|
668
583
|
queryKey: ["nvr-chat-config"],
|
|
669
584
|
queryFn: async () => (await e.request(g("/chat/config"))).data ?? { bot_name: null, bot_user_id: null },
|
|
670
585
|
staleTime: 5 * 6e4
|
|
671
586
|
});
|
|
672
587
|
return t ?? { bot_name: null, bot_user_id: null };
|
|
673
588
|
}
|
|
674
|
-
function
|
|
675
|
-
return
|
|
589
|
+
function st() {
|
|
590
|
+
return ye().bot_name;
|
|
676
591
|
}
|
|
677
|
-
function
|
|
678
|
-
const t =
|
|
592
|
+
function rt(e) {
|
|
593
|
+
const t = m(), { data: s } = y({
|
|
679
594
|
queryKey: ["nvr-chat-pins", e],
|
|
680
595
|
queryFn: async () => (await t.request(
|
|
681
596
|
g(`/chat/rooms/${encodeURIComponent(e)}/pins`)
|
|
@@ -683,16 +598,16 @@ function vt(e) {
|
|
|
683
598
|
enabled: !!e,
|
|
684
599
|
staleTime: 15e3
|
|
685
600
|
});
|
|
686
|
-
return
|
|
601
|
+
return F([["nvr-chat-pins"]], e ? [e] : []), s ?? [];
|
|
687
602
|
}
|
|
688
|
-
function
|
|
689
|
-
const t =
|
|
603
|
+
function ot(e) {
|
|
604
|
+
const t = m(), s = v();
|
|
690
605
|
return h({
|
|
691
|
-
mutationFn: (
|
|
692
|
-
onSuccess: () => void
|
|
606
|
+
mutationFn: (n) => t.request(K(`/chat/messages/${n}/pin`)),
|
|
607
|
+
onSuccess: () => void s.invalidateQueries({ queryKey: ["nvr-chat-pins", e] })
|
|
693
608
|
});
|
|
694
609
|
}
|
|
695
|
-
const
|
|
610
|
+
const z = [
|
|
696
611
|
"#7dd3fc",
|
|
697
612
|
"#86efac",
|
|
698
613
|
"#fcd34d",
|
|
@@ -702,107 +617,111 @@ const ee = [
|
|
|
702
617
|
"#99f6e4",
|
|
703
618
|
"#00ceff"
|
|
704
619
|
];
|
|
705
|
-
function
|
|
620
|
+
function at(e) {
|
|
706
621
|
let t = 0;
|
|
707
|
-
for (const
|
|
708
|
-
return
|
|
622
|
+
for (const s of e) t = t * 31 + s.charCodeAt(0) | 0;
|
|
623
|
+
return z[Math.abs(t) % z.length];
|
|
709
624
|
}
|
|
710
|
-
function
|
|
711
|
-
var
|
|
625
|
+
function it(e) {
|
|
626
|
+
var s, n;
|
|
712
627
|
if (!e) return "?";
|
|
713
628
|
const t = e.trim().split(/\s+/);
|
|
714
|
-
return ((((
|
|
629
|
+
return ((((s = t[0]) == null ? void 0 : s[0]) ?? "") + (((n = t[1]) == null ? void 0 : n[0]) ?? "")).toUpperCase() || "?";
|
|
715
630
|
}
|
|
716
|
-
let
|
|
717
|
-
function
|
|
718
|
-
return
|
|
719
|
-
|
|
631
|
+
let T = null;
|
|
632
|
+
function ct(e) {
|
|
633
|
+
return T = e, () => {
|
|
634
|
+
T === e && (T = null);
|
|
720
635
|
};
|
|
721
636
|
}
|
|
722
|
-
function
|
|
723
|
-
return
|
|
637
|
+
function ut() {
|
|
638
|
+
return T !== null;
|
|
724
639
|
}
|
|
725
|
-
function
|
|
726
|
-
|
|
640
|
+
function lt(e, t) {
|
|
641
|
+
T == null || T(e, t);
|
|
727
642
|
}
|
|
728
|
-
let
|
|
729
|
-
function
|
|
730
|
-
return
|
|
731
|
-
|
|
643
|
+
let S = null;
|
|
644
|
+
function dt(e) {
|
|
645
|
+
return S = e, () => {
|
|
646
|
+
S === e && (S = null);
|
|
732
647
|
};
|
|
733
648
|
}
|
|
734
|
-
function
|
|
735
|
-
return
|
|
649
|
+
function ge() {
|
|
650
|
+
return S !== null;
|
|
736
651
|
}
|
|
737
|
-
function
|
|
738
|
-
|
|
652
|
+
function V(e, t) {
|
|
653
|
+
S == null || S(e, t);
|
|
739
654
|
}
|
|
740
|
-
function
|
|
741
|
-
const t =
|
|
742
|
-
return
|
|
655
|
+
function mt(e = !0) {
|
|
656
|
+
const t = m(), { data: s } = y({ ...H(t), enabled: e });
|
|
657
|
+
return s;
|
|
743
658
|
}
|
|
744
|
-
async function
|
|
659
|
+
async function ft(e, t, s) {
|
|
745
660
|
var r;
|
|
746
|
-
const
|
|
747
|
-
g("/chat/record-room", { collection: t, item:
|
|
661
|
+
const n = await e.request(
|
|
662
|
+
g("/chat/record-room", { collection: t, item: s })
|
|
748
663
|
);
|
|
749
|
-
if (!((r =
|
|
750
|
-
const o =
|
|
751
|
-
return
|
|
664
|
+
if (!((r = n.data) != null && r.room)) return !1;
|
|
665
|
+
const o = n.data.room.slice(n.data.room.indexOf(":") + 1);
|
|
666
|
+
return V(n.data.room, o), !0;
|
|
752
667
|
}
|
|
753
668
|
export {
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
ct as
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
669
|
+
Fe as CHAT_DEFAULTS,
|
|
670
|
+
me as CHAT_ROOM_TYPES_KEY,
|
|
671
|
+
ae as ChatConfigContext,
|
|
672
|
+
Ke as GENERAL_CHANNEL_ID,
|
|
673
|
+
$e as REACTION_EMOJI,
|
|
674
|
+
ge as canOpenChatRoom,
|
|
675
|
+
ut as canOpenDm,
|
|
676
|
+
at as chatAvatarColor,
|
|
677
|
+
it as chatInitials,
|
|
678
|
+
H as chatRoomTypesQuery,
|
|
679
|
+
gt as discardOutbox,
|
|
680
|
+
ft as discussRecord,
|
|
681
|
+
B as dmPeer,
|
|
682
|
+
Oe as dmRoom,
|
|
683
|
+
pt as editOutbox,
|
|
684
|
+
We as getMentionQuery,
|
|
685
|
+
vt as holdOutbox,
|
|
686
|
+
qt as nudgeChatOutbox,
|
|
687
|
+
V as openChatRoom,
|
|
688
|
+
lt as openDmWith,
|
|
689
|
+
ct as registerDmOpener,
|
|
690
|
+
dt as registerRoomOpener,
|
|
691
|
+
bt as retryOutbox,
|
|
692
|
+
Ve as splitMessageTokens,
|
|
693
|
+
Qe as useArchivedRooms,
|
|
694
|
+
Ae as useChannelAdmin,
|
|
695
|
+
xe as useChannelDirectory,
|
|
696
|
+
De as useChannelMembers,
|
|
697
|
+
ye as useChatBotInfo,
|
|
698
|
+
st as useChatBotName,
|
|
699
|
+
q as useChatConfig,
|
|
700
|
+
Me as useChatMessages,
|
|
701
|
+
Ee as useChatRoles,
|
|
702
|
+
Le as useChatRooms,
|
|
703
|
+
tt as useChatSearch,
|
|
704
|
+
Ie as useChatThread,
|
|
705
|
+
Pe as useCreateChannel,
|
|
706
|
+
nt as useCreateGroupDm,
|
|
707
|
+
et as useDeleteMessage,
|
|
708
|
+
Xe as useEditMessage,
|
|
709
|
+
He as useEntityRoomLink,
|
|
710
|
+
Ge as useMarkRoomRead,
|
|
711
|
+
I as useMyPreferences,
|
|
712
|
+
le as useNotificationSoundPreference,
|
|
713
|
+
je as useOpenRoomRegistration,
|
|
714
|
+
_t as useOutbox,
|
|
715
|
+
Je as usePeerReadAt,
|
|
716
|
+
ze as useRecordBrowserTimezone,
|
|
717
|
+
mt as useRecordRoomTypes,
|
|
718
|
+
Ue as useRoomMembership,
|
|
719
|
+
rt as useRoomPins,
|
|
720
|
+
ke as useSendChatMessage,
|
|
721
|
+
de as useSetMyPreferences,
|
|
722
|
+
ot as useTogglePin,
|
|
723
|
+
Ze as useToggleReaction,
|
|
724
|
+
Ye as useTypingIndicator,
|
|
725
|
+
Be as useUnreadChirp,
|
|
726
|
+
Ne as useUserSearch
|
|
808
727
|
};
|