@nivaro/react 0.3.10 → 0.3.11

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 (43) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useNivaroForm.js +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +34 -3
  5. package/dist/shared/components/CollectionBrowserView.js +1546 -1477
  6. package/dist/shared/components/ItemEditForm.js +4332 -4195
  7. package/dist/shared/components/PageRenderer.js +512 -465
  8. package/dist/shared/components/QueryStatStrip.js +74 -70
  9. package/dist/shared/components/ReportView.js +818 -827
  10. package/dist/shared/components/SheetHeaderBody.js +16 -14
  11. package/dist/shared/components/item-edit/CatalogPickerField.js +1029 -933
  12. package/dist/shared/components/item-edit/FieldRenderer.js +161 -156
  13. package/dist/shared/components/item-edit/FieldRow.js +20 -19
  14. package/dist/shared/components/item-edit/FilePickerField.js +52 -40
  15. package/dist/shared/components/item-edit/GroupSection.js +221 -221
  16. package/dist/shared/components/item-edit/InlineGridField.js +41 -41
  17. package/dist/shared/components/item-edit/InlineTableField.js +2249 -2238
  18. package/dist/shared/components/item-edit/M2MCombobox.js +46 -44
  19. package/dist/shared/components/item-edit/NestedRelationEditor.js +11 -11
  20. package/dist/shared/components/item-edit/QuickPicker.js +263 -216
  21. package/dist/shared/components/item-edit/RelationCombobox.js +285 -245
  22. package/dist/shared/components/item-edit/RichTextEditorImpl.js +42 -32
  23. package/dist/shared/components/item-edit/RowHistorySheet.js +130 -134
  24. package/dist/shared/components/item-edit/SummaryPanel.js +305 -279
  25. package/dist/shared/components/item-edit/helpers.js +133 -134
  26. package/dist/shared/components/item-edit/line-qty.js +57 -0
  27. package/dist/shared/components/item-edit/option-disambiguate.js +53 -0
  28. package/dist/shared/components/panels/AddendumLinesDiff.js +87 -90
  29. package/dist/shared/components/panels/CommentPanel.js +350 -315
  30. package/dist/shared/components/panels/ItemLockBanner.js +297 -230
  31. package/dist/shared/components/panels/PipelinePanel.js +719 -701
  32. package/dist/shared/components/queue/QueueQuickFilters.js +43 -41
  33. package/dist/shared/components/queue/QueueWorklist.js +1005 -935
  34. package/dist/shared/components/widgets/ReviewListWidget.js +99 -93
  35. package/dist/shared/lib/obligation-banner.js +14 -13
  36. package/dist/shared/lib/obligation-reason-text.js +13 -0
  37. package/dist/shared/lib/query-filter-seed.js +34 -11
  38. package/dist/shared/lib/sanitize-html.js +24 -15
  39. package/dist/shared/lib/sheet-def.js +38 -22
  40. package/dist/shared/lib/unique-options.js +10 -0
  41. package/dist/shared/lib/utils.js +57 -43
  42. package/dist/shared/lib/validation-rules.js +58 -34
  43. package/package.json +1 -1
@@ -1,30 +1,30 @@
1
- import { jsxs as s, jsx as e, Fragment as ce } from "react/jsx-runtime";
2
- import { useQueryClient as xe, useQuery as B, useMutation as A } from "@tanstack/react-query";
3
- import { MessageSquare as _e, ChevronDown as Ce, ClipboardPlus as Se, Pencil as $e, Trash2 as qe, Check as Ee, X as Re, SmilePlus as he } from "lucide-react";
4
- import { useState as C, useRef as J, useEffect as G, useMemo as Y } from "react";
1
+ import { jsxs as s, jsx as e, Fragment as te } from "react/jsx-runtime";
2
+ import { useQueryClient as fe, useQuery as U, useMutation as O } from "@tanstack/react-query";
3
+ import { MessageSquare as Se, ChevronDown as $e, ClipboardPlus as Ee, Pencil as qe, Trash2 as De, Check as Pe, X as Re, SmilePlus as ge } from "lucide-react";
4
+ import { useState as v, useRef as V, useEffect as J, useMemo as ne } from "react";
5
5
  import { createPortal as Te } from "react-dom";
6
- import { toast as D } from "sonner";
7
- import { useNivaroClient as ne, useItemEditAuth as De, useDrilldown as Pe } from "../../context.js";
8
- import { useDebounced as Fe } from "../../hooks/useDebounced.js";
9
- import { get as U, post as z, patch as Me, del as je } from "../../lib/commands.js";
10
- import { usePresenceOnlinePoll as Ie } from "../../lib/presence-live.js";
11
- import { useRecordSignalPeers as Oe, useRecordSignalSender as Le, signalSentence as Ae } from "../../lib/presence-signals.js";
12
- import { invalidateRecordTasks as Ke } from "../../lib/record-tasks.js";
13
- import { formatRelative as ae } from "../../lib/utils.js";
14
- import { AutolinkedText as re } from "../AutolinkedText.js";
15
- import { InboundRequestPopover as Qe } from "../integrations/InboundRequest.js";
16
- import { UserAvatar as ze } from "../UserAvatar.js";
17
- import { Avatar as Be, AvatarFallback as Ue } from "../ui/avatar.js";
18
- import { Button as X } from "../ui/button.js";
19
- import { Separator as me } from "../ui/separator.js";
20
- import { Textarea as We } from "../ui/textarea.js";
21
- import { RecordEventPathSheet as He } from "./IntegrationActivitySection.js";
22
- const be = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
23
- function Xe(t) {
6
+ import { toast as R } from "sonner";
7
+ import { useNivaroClient as oe, useItemEditAuth as Fe, useDrilldown as Me } from "../../context.js";
8
+ import { useDebounced as Ie } from "../../hooks/useDebounced.js";
9
+ import { get as W, post as z, patch as je, del as Oe } from "../../lib/commands.js";
10
+ import { usePresenceOnlinePoll as Le } from "../../lib/presence-live.js";
11
+ import { useRecordSignalPeers as Ae, useRecordSignalSender as Ke, signalSentence as Qe } from "../../lib/presence-signals.js";
12
+ import { invalidateRecordTasks as ze } from "../../lib/record-tasks.js";
13
+ import { formatRelative as le } from "../../lib/utils.js";
14
+ import { AutolinkedText as se } from "../AutolinkedText.js";
15
+ import { InboundRequestPopover as Be } from "../integrations/InboundRequest.js";
16
+ import { UserAvatar as Ue } from "../UserAvatar.js";
17
+ import { Avatar as We, AvatarFallback as He } from "../ui/avatar.js";
18
+ import { Button as G } from "../ui/button.js";
19
+ import { Separator as xe } from "../ui/separator.js";
20
+ import { Textarea as Xe } from "../ui/textarea.js";
21
+ import { RecordEventPathSheet as Ge } from "./IntegrationActivitySection.js";
22
+ const ye = ["👍", "✅", "👀", "🎉", "❤️", "😂"];
23
+ function Je(t) {
24
24
  var d, c, b, m;
25
25
  return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (b = t.email) == null ? void 0 : b[0]) == null ? void 0 : m.toUpperCase()) || "?";
26
26
  }
27
- function Ge({ comment: t }) {
27
+ function Ve({ comment: t }) {
28
28
  const i = (t.mentions ?? []).filter(
29
29
  (d) => {
30
30
  var c;
@@ -47,7 +47,7 @@ function Ge({ comment: t }) {
47
47
  children: [
48
48
  d.seen_at ? "✓ " : "",
49
49
  c,
50
- d.seen_at ? ` saw this ${ae(d.seen_at)}` : " has not seen this yet"
50
+ d.seen_at ? ` saw this ${le(d.seen_at)}` : " has not seen this yet"
51
51
  ]
52
52
  },
53
53
  d.id
@@ -56,123 +56,123 @@ function Ge({ comment: t }) {
56
56
  }
57
57
  );
58
58
  }
59
- function ee(t) {
59
+ function re(t) {
60
60
  return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
61
61
  }
62
- function Je(t, i) {
62
+ function Ze(t, i) {
63
63
  const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
64
64
  return c ? { start: i - c[2].length - 1, query: c[2] } : null;
65
65
  }
66
- function pe(t) {
66
+ function he(t) {
67
67
  return t.email.split("@")[0];
68
68
  }
69
- function te({
69
+ function ae({
70
70
  value: t,
71
71
  onChange: i,
72
72
  ...d
73
73
  }) {
74
- const c = ne(), b = J(null), [m, h] = C(null), [E, f] = C(0), N = Fe((m == null ? void 0 : m.query) ?? "", 200), { data: M = [] } = B({
75
- queryKey: ["users", "mention-search", N],
74
+ const c = oe(), b = V(null), [m, h] = v(null), [E, f] = v(0), k = Ie((m == null ? void 0 : m.query) ?? "", 200), { data: M = [] } = U({
75
+ queryKey: ["users", "mention-search", k],
76
76
  queryFn: () => c.request(
77
- U("/users", { limit: 8, sort: "first_name", search: N })
78
- ).then((r) => r.data),
79
- enabled: !!m && N.length >= 2,
77
+ W("/users", { limit: 8, sort: "first_name", search: k })
78
+ ).then((n) => n.data),
79
+ enabled: !!m && k.length >= 2,
80
80
  staleTime: 3e4
81
- }), j = Ie(15e3, !!m), { data: u } = B({
81
+ }), I = Le(15e3, !!m), { data: p } = U({
82
82
  queryKey: ["presence-online"],
83
83
  queryFn: () => c.request(
84
- U("/presence/online")
84
+ W("/presence/online")
85
85
  ),
86
86
  enabled: !!m,
87
- refetchInterval: j,
87
+ refetchInterval: I,
88
88
  staleTime: 5e3
89
- }), g = (r) => {
89
+ }), g = (n) => {
90
90
  var x;
91
- const l = (x = u == null ? void 0 : u.data) == null ? void 0 : x.find((k) => String(k.user_id).toUpperCase() === r.toUpperCase());
91
+ const l = (x = p == null ? void 0 : p.data) == null ? void 0 : x.find((_) => String(_.user_id).toUpperCase() === n.toUpperCase());
92
92
  return l ? l.is_idle || l.away ? 1 : 0 : 2;
93
- }, w = [...M].sort((r, l) => g(r.id) - g(l.id)), { data: I = [] } = B({
93
+ }, N = [...M].sort((n, l) => g(n.id) - g(l.id)), { data: j = [] } = U({
94
94
  queryKey: ["mention-roles"],
95
- queryFn: () => c.request(U("/chat/roles")).then((r) => r.data).catch(() => []),
95
+ queryFn: () => c.request(W("/chat/roles")).then((n) => n.data).catch(() => []),
96
96
  enabled: !!m,
97
97
  staleTime: 5 * 6e4
98
- }), P = m ? I.filter(
99
- (r) => r.name.toLowerCase().replace(/\s+/g, "-").startsWith(N.toLowerCase())
100
- ).slice(0, 3) : [], _ = !!m && N.length >= 2 && "owners".startsWith(N.toLowerCase()), S = !!m && N.length >= 2 && (w.length > 0 || _ || P.length > 0), o = w.length + (_ ? 1 : 0) + P.length, [y, R] = C(null), K = J(null);
101
- G(() => {
102
- if (!S || !b.current) {
103
- R(null);
98
+ }), T = m ? j.filter(
99
+ (n) => n.name.toLowerCase().replace(/\s+/g, "-").startsWith(k.toLowerCase())
100
+ ).slice(0, 3) : [], w = !!m && k.length >= 2 && "owners".startsWith(k.toLowerCase()), C = !!m && k.length >= 2 && (N.length > 0 || w || T.length > 0), o = N.length + (w ? 1 : 0) + T.length, [y, D] = v(null), B = V(null);
101
+ J(() => {
102
+ if (!C || !b.current) {
103
+ D(null);
104
104
  return;
105
105
  }
106
- const r = b.current.getBoundingClientRect();
107
- R({ top: r.bottom + 4, left: r.left, width: Math.min(r.width, 360) });
108
- const l = (k) => {
109
- var q;
110
- (q = K.current) != null && q.contains(k.target) || h(null);
106
+ const n = b.current.getBoundingClientRect();
107
+ D({ top: n.bottom + 4, left: n.left, width: Math.min(n.width, 360) });
108
+ const l = (_) => {
109
+ var S;
110
+ (S = B.current) != null && S.contains(_.target) || h(null);
111
111
  }, x = () => h(null);
112
112
  return window.addEventListener("scroll", l, !0), window.addEventListener("resize", x), () => {
113
113
  window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", x);
114
114
  };
115
- }, [S]);
116
- function O(r) {
117
- const l = Je(r.value, r.selectionStart ?? r.value.length);
115
+ }, [C]);
116
+ function L(n) {
117
+ const l = Ze(n.value, n.selectionStart ?? n.value.length);
118
118
  h(l), l || f(0);
119
119
  }
120
- function $(r) {
120
+ function q(n) {
121
121
  if (!m || !b.current) return;
122
- const l = b.current.selectionStart ?? t.length, x = r === "__owners__" ? "@owners " : typeof r == "object" && "role" in r ? `@${r.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${pe(r)} `, k = t.slice(0, m.start) + x + t.slice(l);
123
- i(k), h(null), f(0);
124
- const q = m.start + x.length;
122
+ const l = b.current.selectionStart ?? t.length, x = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${he(n)} `, _ = t.slice(0, m.start) + x + t.slice(l);
123
+ i(_), h(null), f(0);
124
+ const S = m.start + x.length;
125
125
  requestAnimationFrame(() => {
126
- var F, v;
127
- (F = b.current) == null || F.focus(), (v = b.current) == null || v.setSelectionRange(q, q);
126
+ var F, K;
127
+ (F = b.current) == null || F.focus(), (K = b.current) == null || K.setSelectionRange(S, S);
128
128
  });
129
129
  }
130
- function L(r) {
131
- if (S)
132
- if (r.key === "ArrowDown")
133
- r.preventDefault(), f((l) => (l + 1) % o);
134
- else if (r.key === "ArrowUp")
135
- r.preventDefault(), f((l) => (l - 1 + o) % o);
136
- else if (r.key === "Enter" || r.key === "Tab") {
137
- r.preventDefault();
138
- const l = Math.min(E, o - 1), x = _ ? 1 : 0, k = x + w.length;
139
- if (_ && l === 0) $("__owners__");
140
- else if (l >= k) {
141
- const q = P[l - k];
142
- q && $({ role: q.name });
143
- } else $(w[l - x]);
144
- } else r.key === "Escape" && (r.preventDefault(), h(null));
130
+ function A(n) {
131
+ if (C)
132
+ if (n.key === "ArrowDown")
133
+ n.preventDefault(), f((l) => (l + 1) % o);
134
+ else if (n.key === "ArrowUp")
135
+ n.preventDefault(), f((l) => (l - 1 + o) % o);
136
+ else if (n.key === "Enter" || n.key === "Tab") {
137
+ n.preventDefault();
138
+ const l = Math.min(E, o - 1), x = w ? 1 : 0, _ = x + N.length;
139
+ if (w && l === 0) q("__owners__");
140
+ else if (l >= _) {
141
+ const S = T[l - _];
142
+ S && q({ role: S.name });
143
+ } else q(N[l - x]);
144
+ } else n.key === "Escape" && (n.preventDefault(), h(null));
145
145
  }
146
146
  return /* @__PURE__ */ s("div", { className: "relative", children: [
147
147
  /* @__PURE__ */ e(
148
- We,
148
+ Xe,
149
149
  {
150
150
  ...d,
151
151
  ref: b,
152
152
  value: t,
153
- onChange: (r) => {
154
- i(r.target.value), O(r.target);
153
+ onChange: (n) => {
154
+ i(n.target.value), L(n.target);
155
155
  },
156
- onKeyDown: L,
157
- onClick: (r) => O(r.currentTarget),
156
+ onKeyDown: A,
157
+ onClick: (n) => L(n.currentTarget),
158
158
  onBlur: () => setTimeout(() => h(null), 150)
159
159
  }
160
160
  ),
161
- S && y && Te(
161
+ C && y && Te(
162
162
  /* @__PURE__ */ s(
163
163
  "div",
164
164
  {
165
- ref: K,
165
+ ref: B,
166
166
  className: "fixed z-[110] max-h-60 overflow-y-auto rounded-md border border-slate-200 bg-white shadow-lg dark:border-border dark:bg-popover",
167
167
  style: { top: y.top, left: y.left, width: y.width },
168
- onMouseDown: (r) => r.preventDefault(),
168
+ onMouseDown: (n) => n.preventDefault(),
169
169
  children: [
170
- _ && /* @__PURE__ */ s(
170
+ w && /* @__PURE__ */ s(
171
171
  "button",
172
172
  {
173
173
  type: "button",
174
- onMouseDown: (r) => {
175
- r.preventDefault(), $("__owners__");
174
+ onMouseDown: (n) => {
175
+ n.preventDefault(), q("__owners__");
176
176
  },
177
177
  onMouseEnter: () => f(0),
178
178
  className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${E === 0 ? "bg-nvr-cyan/10" : ""}`,
@@ -185,70 +185,70 @@ function te({
185
185
  ]
186
186
  }
187
187
  ),
188
- w.map((r, l) => {
189
- var q, F;
190
- const x = _ ? l + 1 : l, k = [r.first_name, r.last_name].filter(Boolean).join(" ") || r.email;
188
+ N.map((n, l) => {
189
+ var S, F;
190
+ const x = w ? l + 1 : l, _ = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email;
191
191
  return /* @__PURE__ */ s(
192
192
  "button",
193
193
  {
194
194
  type: "button",
195
- onMouseDown: (v) => {
196
- v.preventDefault(), $(r);
195
+ onMouseDown: (K) => {
196
+ K.preventDefault(), q(n);
197
197
  },
198
198
  onMouseEnter: () => f(x),
199
199
  className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${x === E ? "bg-nvr-cyan/10" : ""}`,
200
200
  children: [
201
201
  /* @__PURE__ */ s("span", { className: "relative flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-nvr-cyan/15 text-[10px] font-semibold text-nvr-navy/80 dark:text-nvr-cyan", children: [
202
- (`${((q = r.first_name) == null ? void 0 : q[0]) ?? ""}${((F = r.last_name) == null ? void 0 : F[0]) ?? ""}`.trim() || r.email[0]).toUpperCase(),
203
- g(r.id) < 2 && /* @__PURE__ */ e(
202
+ (`${((S = n.first_name) == null ? void 0 : S[0]) ?? ""}${((F = n.last_name) == null ? void 0 : F[0]) ?? ""}`.trim() || n.email[0]).toUpperCase(),
203
+ g(n.id) < 2 && /* @__PURE__ */ e(
204
204
  "span",
205
205
  {
206
- "data-mention-presence": g(r.id) === 0 ? "online" : "idle",
207
- title: g(r.id) === 0 ? "Online" : "Idle",
208
- className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${g(r.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
206
+ "data-mention-presence": g(n.id) === 0 ? "online" : "idle",
207
+ title: g(n.id) === 0 ? "Online" : "Idle",
208
+ className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${g(n.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
209
209
  }
210
210
  )
211
211
  ] }),
212
212
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
213
- /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: k }),
213
+ /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: _ }),
214
214
  /* @__PURE__ */ s("span", { className: "block truncate text-[11px] text-slate-400", children: [
215
- r.is_out_of_office && /* @__PURE__ */ s("span", { className: "mr-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: [
215
+ n.is_out_of_office && /* @__PURE__ */ s("span", { className: "mr-1 rounded bg-amber-100 px-1 py-px text-[9.5px] font-semibold text-amber-700 dark:bg-amber-400/15 dark:text-amber-400", children: [
216
216
  "OOO",
217
- r.ooo_end ? ` until ${String(r.ooo_end).slice(0, 10)}` : ""
217
+ n.ooo_end ? ` until ${String(n.ooo_end).slice(0, 10)}` : ""
218
218
  ] }),
219
219
  "@",
220
- pe(r),
221
- (r.title || r.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
220
+ he(n),
221
+ (n.title || n.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
222
222
  " · ",
223
- [r.title, r.department].filter(Boolean).join(", ")
223
+ [n.title, n.department].filter(Boolean).join(", ")
224
224
  ] })
225
225
  ] })
226
226
  ] })
227
227
  ]
228
228
  },
229
- r.id
229
+ n.id
230
230
  );
231
231
  }),
232
- P.map((r, l) => {
233
- const x = w.length + (_ ? 1 : 0) + l;
232
+ T.map((n, l) => {
233
+ const x = N.length + (w ? 1 : 0) + l;
234
234
  return /* @__PURE__ */ s(
235
235
  "button",
236
236
  {
237
237
  type: "button",
238
- onMouseDown: (k) => {
239
- k.preventDefault(), $({ role: r.name });
238
+ onMouseDown: (_) => {
239
+ _.preventDefault(), q({ role: n.name });
240
240
  },
241
241
  onMouseEnter: () => f(x),
242
242
  className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${x === E ? "bg-nvr-cyan/10" : ""}`,
243
243
  children: [
244
244
  /* @__PURE__ */ e("span", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-violet-500/15 text-[10px] font-semibold text-violet-600 dark:text-violet-300", children: "R" }),
245
245
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
246
- /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: r.name }),
246
+ /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: n.name }),
247
247
  /* @__PURE__ */ e("span", { className: "block text-[11px] text-slate-400", children: "Role — notifies every member" })
248
248
  ] })
249
249
  ]
250
250
  },
251
- `role-${r.id}`
251
+ `role-${n.id}`
252
252
  );
253
253
  })
254
254
  ]
@@ -258,7 +258,7 @@ function te({
258
258
  )
259
259
  ] });
260
260
  }
261
- function ue(t) {
261
+ function be(t) {
262
262
  if (t.kind === "comment") return "people";
263
263
  switch (t.note.source) {
264
264
  case "note":
@@ -270,24 +270,24 @@ function ue(t) {
270
270
  return "system";
271
271
  }
272
272
  }
273
- const Ve = {
273
+ const Ye = {
274
274
  people: "People",
275
275
  system: "System",
276
276
  integration: "Integration"
277
- }, Ze = "integrations:";
278
- function Ye({
277
+ }, et = "integrations:";
278
+ function tt({
279
279
  note: t,
280
280
  collection: i,
281
281
  item: d
282
282
  }) {
283
- var S;
284
- const c = Pe(), [b, m] = C(!1), h = t.source === "external" && !!t.provider && !t.provider.startsWith(Ze), E = ne(), f = xe(), [N, M] = C(!1), j = A({
283
+ var C;
284
+ const c = Me(), [b, m] = v(!1), h = t.source === "external" && !!t.provider && !t.provider.startsWith(et), E = oe(), f = fe(), [k, M] = v(!1), I = O({
285
285
  mutationFn: (o) => E.request(z(`/comments/${t.comment_id}/reactions`, { emoji: o })),
286
286
  onSuccess: () => {
287
287
  M(!1), f.invalidateQueries({ queryKey: ["comments-related"] }), f.invalidateQueries({ queryKey: ["row-comment-counts"] });
288
288
  },
289
- onError: () => D.error("Failed to react")
290
- }), [u, g] = C(!1), w = A({
289
+ onError: () => R.error("Failed to react")
290
+ }), [p, g] = v(!1), N = O({
291
291
  mutationFn: () => E.request(
292
292
  z(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
293
293
  entry_id: t.id.replace(/^external:/, "")
@@ -295,17 +295,17 @@ function Ye({
295
295
  ),
296
296
  onSuccess: (o) => {
297
297
  var y;
298
- g(!1), D.success("Event replayed", {
298
+ g(!1), R.success("Event replayed", {
299
299
  description: (y = o == null ? void 0 : o.data) == null ? void 0 : y.detail
300
300
  }), f.invalidateQueries({ queryKey: ["comments-related"] });
301
301
  },
302
302
  onError: (o) => {
303
- var R;
303
+ var D;
304
304
  g(!1);
305
- const y = (R = o == null ? void 0 : o.response) == null ? void 0 : R.error;
306
- D.error(y ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
305
+ const y = (D = o == null ? void 0 : o.response) == null ? void 0 : D.error;
306
+ R.error(y ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
307
307
  }
308
- }), I = t.link ? () => {
308
+ }), j = t.link ? () => {
309
309
  const o = t.link;
310
310
  if (!o) return;
311
311
  const y = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
@@ -314,37 +314,37 @@ function Ye({
314
314
  return;
315
315
  }
316
316
  c == null || c.open({ collection: o.collection, itemId: o.item_id });
317
- } : null, P = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", _ = t.source === "import" && ((S = t.import) != null && S.file_id) ? t.import : null;
317
+ } : null, T = t.source === "transition" ? "border-nvr-cyan/30 bg-nvr-cyan/[0.06] text-nvr-navy dark:text-nvr-cyan" : t.source === "addendum" ? "border-amber-200 bg-amber-50/60 text-amber-700 dark:border-amber-900/40 dark:bg-amber-900/10 dark:text-amber-400" : t.source === "external" || t.source === "inbound" ? "border-sky-200 bg-sky-50/70 text-sky-700 dark:border-sky-900/40 dark:bg-sky-900/10 dark:text-sky-300" : t.source === "import" ? "border-emerald-200 bg-emerald-50/70 text-emerald-700 dark:border-emerald-900/40 dark:bg-emerald-900/10 dark:text-emerald-300" : "border-slate-200 bg-slate-50/80 text-slate-600 dark:border-border dark:bg-muted/40 dark:text-slate-300", w = t.source === "import" && ((C = t.import) != null && C.file_id) ? t.import : null;
318
318
  return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
319
319
  /* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
320
320
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
321
321
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
322
- /* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${P}`, children: t.label }),
322
+ /* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${T}`, children: t.label }),
323
323
  t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
324
- t.context && (I ? /* @__PURE__ */ e(
324
+ t.context && (j ? /* @__PURE__ */ e(
325
325
  "button",
326
326
  {
327
327
  type: "button",
328
- onClick: I,
328
+ onClick: j,
329
329
  className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
330
330
  "data-line-comment-link": !0,
331
331
  children: t.context
332
332
  }
333
- ) : _ ? /* @__PURE__ */ e(
333
+ ) : w ? /* @__PURE__ */ e(
334
334
  "a",
335
335
  {
336
- href: `/api/files/${_.file_id}?download=1`,
336
+ href: `/api/files/${w.file_id}?download=1`,
337
337
  target: "_blank",
338
338
  rel: "noreferrer",
339
339
  onClick: (o) => o.stopPropagation(),
340
340
  className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
341
- "data-note-import-file": _.file_id ?? void 0,
341
+ "data-note-import-file": w.file_id ?? void 0,
342
342
  children: t.context
343
343
  }
344
344
  ) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
345
- /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ae(t.created_at) }),
345
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(t.created_at) }),
346
346
  t.source === "inbound" && t.inbound && /* @__PURE__ */ e(
347
- Qe,
347
+ Be,
348
348
  {
349
349
  activityId: t.inbound.activity_id,
350
350
  callerName: t.label,
@@ -379,23 +379,23 @@ function Ye({
379
379
  "button",
380
380
  {
381
381
  type: "button",
382
- onClick: () => u ? w.mutate() : g(!0),
382
+ onClick: () => p ? N.mutate() : g(!0),
383
383
  onBlur: () => g(!1),
384
- disabled: w.isPending,
384
+ disabled: N.isPending,
385
385
  "data-note-replay": t.id,
386
- className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${u ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
386
+ className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${p ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
387
387
  "data-tip": "Re-apply this event from its stored payload",
388
- children: w.isPending ? "Replaying…" : u ? "Replay this event?" : "Replay"
388
+ children: N.isPending ? "Replaying…" : p ? "Replay this event?" : "Replay"
389
389
  }
390
390
  )
391
391
  ] }),
392
- /* @__PURE__ */ e("p", { className: "mt-1 whitespace-pre-wrap break-words text-[13px] leading-snug text-slate-600 dark:text-slate-300", children: /* @__PURE__ */ e(re, { text: t.text }) }),
392
+ /* @__PURE__ */ e("p", { className: "mt-1 whitespace-pre-wrap break-words text-[13px] leading-snug text-slate-600 dark:text-slate-300", children: /* @__PURE__ */ e(se, { text: t.text }) }),
393
393
  t.comment_id && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
394
394
  (t.reactions ?? []).map((o) => /* @__PURE__ */ s(
395
395
  "button",
396
396
  {
397
397
  type: "button",
398
- onClick: () => j.mutate(o.emoji),
398
+ onClick: () => I.mutate(o.emoji),
399
399
  className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${o.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
400
400
  children: [
401
401
  o.emoji,
@@ -412,14 +412,14 @@ function Ye({
412
412
  onClick: () => M((o) => !o),
413
413
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
414
414
  "aria-label": "Add reaction",
415
- children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
415
+ children: /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" })
416
416
  }
417
417
  ),
418
- N && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: be.map((o) => /* @__PURE__ */ e(
418
+ k && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: ye.map((o) => /* @__PURE__ */ e(
419
419
  "button",
420
420
  {
421
421
  type: "button",
422
- onClick: () => j.mutate(o),
422
+ onClick: () => I.mutate(o),
423
423
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
424
424
  children: o
425
425
  },
@@ -429,7 +429,7 @@ function Ye({
429
429
  ] })
430
430
  ] }),
431
431
  h && t.provider && /* @__PURE__ */ e(
432
- He,
432
+ Ge,
433
433
  {
434
434
  target: b ? {
435
435
  source: t.provider,
@@ -442,7 +442,7 @@ function Ye({
442
442
  )
443
443
  ] });
444
444
  }
445
- function kt({
445
+ function wt({
446
446
  collection: t,
447
447
  item: i,
448
448
  title: d,
@@ -450,91 +450,91 @@ function kt({
450
450
  queuedComments: b,
451
451
  onQueueComment: m
452
452
  }) {
453
- const h = ne(), { userId: E } = De(), f = xe(), [N, M] = C(!1), j = J(!1);
454
- G(() => {
455
- !j.current && c !== void 0 && (j.current = !0, M(c));
453
+ const h = oe(), { userId: E } = Fe(), f = fe(), [k, M] = v(!1), I = V(!1);
454
+ J(() => {
455
+ !I.current && c !== void 0 && (I.current = !0, M(c));
456
456
  }, [c]);
457
- const [u, g] = C(""), [w, I] = C(!1), P = async () => {
458
- var n;
459
- if (!(!u.trim() || w)) {
460
- I(!0);
457
+ const [p, g] = v(""), [N, j] = v(!1), T = async () => {
458
+ var r;
459
+ if (!(!p.trim() || N)) {
460
+ j(!0);
461
461
  try {
462
462
  const a = await h.request(
463
- z("/ai/cleanup", { text: u })
463
+ z("/ai/cleanup", { text: p })
464
464
  );
465
- (n = a.data) != null && n.text && g(a.data.text);
465
+ (r = a.data) != null && r.text && g(a.data.text);
466
466
  } catch {
467
467
  } finally {
468
- I(!1);
468
+ j(!1);
469
469
  }
470
470
  }
471
- }, _ = Oe(t, i, "note"), S = Le(t, i, "note"), o = J(0);
472
- G(() => {
473
- if (!u.trim()) {
474
- o.current && S("stop"), o.current = 0;
471
+ }, w = Ae(t, i, "note"), C = Ke(t, i, "note"), o = V(0);
472
+ J(() => {
473
+ if (!p.trim()) {
474
+ o.current && C("stop"), o.current = 0;
475
475
  return;
476
476
  }
477
- const n = Date.now();
478
- n - o.current < 2500 || (o.current = n, S("start"));
479
- }, [u, S]), G(() => () => S("stop"), [S]);
480
- const [y, R] = C(null), [K, O] = C(""), $ = !i || i === "new", L = ["comments", t, String(i)], { data: r, isLoading: l, isError: x } = B({
481
- queryKey: L,
482
- queryFn: () => h.request(U("/comments", { collection: t, item: i })).then((n) => n.data),
483
- enabled: !$
484
- }), k = r ?? [], { data: q } = B({
477
+ const r = Date.now();
478
+ r - o.current < 2500 || (o.current = r, C("start"));
479
+ }, [p, C]), J(() => () => C("stop"), [C]);
480
+ const [y, D] = v(null), [B, L] = v(null), [q, A] = v(""), n = !i || i === "new", l = ["comments", t, String(i)], { data: x, isLoading: _, isError: S } = U({
481
+ queryKey: l,
482
+ queryFn: () => h.request(W("/comments", { collection: t, item: i })).then((r) => r.data),
483
+ enabled: !n
484
+ }), F = x ?? [], { data: K } = U({
485
485
  queryKey: ["comments-related", t, String(i)],
486
- queryFn: () => h.request(U("/comments/related", { collection: t, item: i })).then((n) => n.data ?? []).catch(() => []),
487
- enabled: !$,
486
+ queryFn: () => h.request(W("/comments/related", { collection: t, item: i })).then((r) => r.data ?? []).catch(() => []),
487
+ enabled: !n,
488
488
  staleTime: 3e4
489
- }), F = q ?? [], v = Y(() => {
490
- const n = k.map((p) => ({ kind: "comment", at: p.created_at, comment: p })), a = F.map((p) => ({ kind: "related", at: p.created_at, note: p }));
491
- return [...n, ...a].sort((p, Q) => new Date(Q.at).getTime() - new Date(p.at).getTime());
492
- }, [k, F]), [W, fe] = C(() => /* @__PURE__ */ new Set()), [H, ge] = C(""), ye = Y(() => {
493
- const n = { people: 0, system: 0, integration: 0 };
494
- for (const a of v) n[ue(a)]++;
495
- return n;
496
- }, [v]), V = Y(() => {
497
- const n = H.trim().toLowerCase();
498
- return v.filter((a) => W.has(ue(a)) ? !1 : n ? (a.kind === "comment" ? `${a.comment.text} ${ee(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(n) : !0);
499
- }, [v, W, H]), ve = (n) => fe((a) => {
500
- const p = new Set(a);
501
- return p.has(n) ? p.delete(n) : p.add(n), p;
502
- }), ke = W.size > 0 || H.trim() !== "", Z = A({
503
- mutationFn: (n) => h.request(z("/comments", { collection: t, item: i, text: n })),
489
+ }), ie = K ?? [], $ = ne(() => {
490
+ const r = F.map((u) => ({ kind: "comment", at: u.created_at, comment: u })), a = ie.map((u) => ({ kind: "related", at: u.created_at, note: u }));
491
+ return [...r, ...a].sort((u, Q) => new Date(Q.at).getTime() - new Date(u.at).getTime());
492
+ }, [F, ie]), [H, ve] = v(() => /* @__PURE__ */ new Set()), [X, ke] = v(""), Ne = ne(() => {
493
+ const r = { people: 0, system: 0, integration: 0 };
494
+ for (const a of $) r[be(a)]++;
495
+ return r;
496
+ }, [$]), Z = ne(() => {
497
+ const r = X.trim().toLowerCase();
498
+ return $.filter((a) => H.has(be(a)) ? !1 : r ? (a.kind === "comment" ? `${a.comment.text} ${re(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(r) : !0);
499
+ }, [$, H, X]), we = (r) => ve((a) => {
500
+ const u = new Set(a);
501
+ return u.has(r) ? u.delete(r) : u.add(r), u;
502
+ }), _e = H.size > 0 || X.trim() !== "", Y = O({
503
+ mutationFn: (r) => h.request(z("/comments", { collection: t, item: i, text: r })),
504
504
  onSuccess: () => {
505
- f.invalidateQueries({ queryKey: L }), g("");
505
+ f.invalidateQueries({ queryKey: l }), g("");
506
506
  },
507
- onError: () => D.error("Failed to post comment")
508
- }), se = A({
509
- mutationFn: ({ id: n, text: a }) => h.request(Me(`/comments/${n}`, { text: a })),
507
+ onError: () => R.error("Failed to post comment")
508
+ }), de = O({
509
+ mutationFn: ({ id: r, text: a }) => h.request(je(`/comments/${r}`, { text: a })),
510
510
  onSuccess: () => {
511
- f.invalidateQueries({ queryKey: L }), R(null), O("");
511
+ f.invalidateQueries({ queryKey: l }), D(null), A("");
512
512
  },
513
- onError: () => D.error("Failed to update comment")
514
- }), Ne = A({
515
- mutationFn: (n) => h.request(je(`/comments/${n}`)),
516
- onSuccess: () => f.invalidateQueries({ queryKey: L }),
517
- onError: () => D.error("Failed to delete comment")
518
- }), oe = A({
519
- mutationFn: ({ id: n, emoji: a }) => h.request(z(`/comments/${n}/reactions`, { emoji: a })),
520
- onSuccess: () => f.invalidateQueries({ queryKey: L }),
521
- onError: () => D.error("Failed to react")
522
- }), [le, ie] = C(null), we = A({
523
- mutationFn: (n) => h.request(
513
+ onError: () => R.error("Failed to update comment")
514
+ }), ee = O({
515
+ mutationFn: (r) => h.request(Oe(`/comments/${r}`)),
516
+ onSuccess: () => f.invalidateQueries({ queryKey: l }),
517
+ onError: () => R.error("Failed to delete comment")
518
+ }), ce = O({
519
+ mutationFn: ({ id: r, emoji: a }) => h.request(z(`/comments/${r}/reactions`, { emoji: a })),
520
+ onSuccess: () => f.invalidateQueries({ queryKey: l }),
521
+ onError: () => R.error("Failed to react")
522
+ }), [me, ue] = v(null), Ce = O({
523
+ mutationFn: (r) => h.request(
524
524
  z("/tasks", {
525
525
  collection: t,
526
526
  item: i,
527
- title: n.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
527
+ title: r.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
528
528
  assignee: E
529
529
  })
530
530
  ),
531
531
  onSuccess: () => {
532
- Ke(f, t, i), D.success("Task created from comment — assigned to you");
532
+ ze(f, t, i), R.success("Task created from comment — assigned to you");
533
533
  },
534
- onError: () => D.error("Could not create a task")
534
+ onError: () => R.error("Could not create a task")
535
535
  });
536
- function de(n) {
537
- n.preventDefault(), u.trim() && ($ && m ? (m(u.trim()), g("")) : Z.mutate(u.trim()));
536
+ function pe(r) {
537
+ r.preventDefault(), p.trim() && (n && m ? (m(p.trim()), g("")) : Y.mutate(p.trim()));
538
538
  }
539
539
  return (
540
540
  // Addressable from elsewhere (the summary panel jumps here), which needs
@@ -543,7 +543,7 @@ function kt({
543
543
  "div",
544
544
  {
545
545
  "data-panel": "notes",
546
- "data-panel-expanded": N ? "true" : "false",
546
+ "data-panel-expanded": k ? "true" : "false",
547
547
  className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
548
548
  children: [
549
549
  /* @__PURE__ */ s(
@@ -551,40 +551,40 @@ function kt({
551
551
  {
552
552
  type: "button",
553
553
  "data-panel-toggle": "notes",
554
- onClick: () => M((n) => !n),
554
+ onClick: () => M((r) => !r),
555
555
  className: "flex w-full flex-col px-5 py-3.5 text-left transition-colors hover:bg-slate-50/50 dark:hover:bg-white/[0.02]",
556
556
  children: [
557
557
  /* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
558
- /* @__PURE__ */ e(_e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
558
+ /* @__PURE__ */ e(Se, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
559
559
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
560
- (v.length > 0 || (b ?? []).length > 0) && /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: $ ? (b ?? []).length : v.length }),
560
+ ($.length > 0 || (b ?? []).length > 0) && /* @__PURE__ */ e("span", { className: "rounded-full bg-slate-100 px-1.5 py-px text-[10.5px] font-semibold tabular-nums text-slate-500 dark:bg-muted dark:text-slate-400", children: n ? (b ?? []).length : $.length }),
561
561
  /* @__PURE__ */ e(
562
- Ce,
562
+ $e,
563
563
  {
564
- className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${N ? " rotate-180" : ""}`
564
+ className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${k ? " rotate-180" : ""}`
565
565
  }
566
566
  )
567
567
  ] }),
568
- !N && !$ && v.length > 0 && (() => {
569
- const n = v[0], a = n.kind === "comment" ? ee(n.comment.user) : n.note.user_name ?? "System", p = (n.kind === "comment" ? n.comment.text : n.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
570
- return p ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
568
+ !k && !n && $.length > 0 && (() => {
569
+ const r = $[0], a = r.kind === "comment" ? re(r.comment.user) : r.note.user_name ?? "System", u = (r.kind === "comment" ? r.comment.text : r.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
570
+ return u ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
571
571
  /* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
572
572
  a,
573
573
  ":"
574
574
  ] }),
575
575
  " ",
576
- /* @__PURE__ */ e(re, { text: p, plain: !0 })
576
+ /* @__PURE__ */ e(se, { text: u, plain: !0 })
577
577
  ] }) : null;
578
578
  })()
579
579
  ]
580
580
  }
581
581
  ),
582
- N && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: $ ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
583
- /* @__PURE__ */ s("form", { onSubmit: de, className: "space-y-2", children: [
582
+ k && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: n ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
583
+ /* @__PURE__ */ s("form", { onSubmit: pe, className: "space-y-2", children: [
584
584
  /* @__PURE__ */ e(
585
- te,
585
+ ae,
586
586
  {
587
- value: u,
587
+ value: p,
588
588
  onChange: g,
589
589
  placeholder: "Write a comment…",
590
590
  rows: 3,
@@ -593,29 +593,29 @@ function kt({
593
593
  ),
594
594
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
595
595
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
596
- /* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !u.trim(), children: "Queue" })
596
+ /* @__PURE__ */ e(G, { type: "submit", size: "sm", disabled: !p.trim(), children: "Queue" })
597
597
  ] })
598
598
  ] }),
599
599
  (b ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
600
- /* @__PURE__ */ e(me, {}),
601
- (b ?? []).map((n, a) => /* @__PURE__ */ s(
600
+ /* @__PURE__ */ e(xe, {}),
601
+ (b ?? []).map((r, a) => /* @__PURE__ */ s(
602
602
  "div",
603
603
  {
604
604
  className: "flex items-start gap-2.5 rounded-lg border border-dashed border-amber-200/70 bg-amber-50/40 px-3 py-2 dark:border-amber-500/20 dark:bg-amber-500/5",
605
605
  children: [
606
606
  /* @__PURE__ */ e("span", { className: "mt-0.5 inline-flex shrink-0 items-center rounded-full bg-amber-100 px-1.5 py-0.5 text-[10px] font-medium text-amber-600 dark:bg-amber-500/15 dark:text-amber-400", children: "Pending" }),
607
- /* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: n })
607
+ /* @__PURE__ */ e("p", { className: "text-[13px] leading-relaxed text-slate-600 dark:text-slate-300", children: r })
608
608
  ]
609
609
  },
610
610
  a
611
611
  ))
612
612
  ] })
613
- ] }) : /* @__PURE__ */ s(ce, { children: [
614
- /* @__PURE__ */ s("form", { onSubmit: de, className: "space-y-2", children: [
613
+ ] }) : /* @__PURE__ */ s(te, { children: [
614
+ /* @__PURE__ */ s("form", { onSubmit: pe, className: "space-y-2", children: [
615
615
  /* @__PURE__ */ e(
616
- te,
616
+ ae,
617
617
  {
618
- value: u,
618
+ value: p,
619
619
  onChange: g,
620
620
  placeholder: "Write a comment…",
621
621
  rows: 3,
@@ -629,166 +629,201 @@ function kt({
629
629
  "button",
630
630
  {
631
631
  type: "button",
632
- disabled: !u.trim() || w,
633
- onClick: () => void P(),
632
+ disabled: !p.trim() || N,
633
+ onClick: () => void T(),
634
634
  "data-tip": "✨ Fix grammar & clarity (meaning preserved)",
635
635
  className: "rounded-md border border-slate-200 px-2 py-1 text-[11.5px] text-slate-500 hover:bg-muted disabled:opacity-50 dark:border-border",
636
- children: w ? "…" : "✨ Polish"
636
+ children: N ? "…" : "✨ Polish"
637
637
  }
638
638
  ),
639
- /* @__PURE__ */ e(X, { type: "submit", size: "sm", disabled: !u.trim() || Z.isPending, children: Z.isPending ? "Posting…" : "Comment" })
639
+ /* @__PURE__ */ e(G, { type: "submit", size: "sm", disabled: !p.trim() || Y.isPending, children: Y.isPending ? "Posting…" : "Comment" })
640
640
  ] })
641
641
  ] })
642
642
  ] }),
643
- _.length > 0 && /* @__PURE__ */ s(
643
+ w.length > 0 && /* @__PURE__ */ s(
644
644
  "p",
645
645
  {
646
646
  className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
647
647
  "data-note-typing": !0,
648
648
  children: [
649
649
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
650
- Ae(_, "writing a note"),
650
+ Qe(w, "writing a note"),
651
651
  "…"
652
652
  ]
653
653
  }
654
654
  ),
655
- /* @__PURE__ */ e(me, { className: "my-4" }),
656
- v.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
657
- ["people", "system", "integration"].map((n) => {
658
- const a = !W.has(n), p = ye[n];
655
+ /* @__PURE__ */ e(xe, { className: "my-4" }),
656
+ $.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
657
+ ["people", "system", "integration"].map((r) => {
658
+ const a = !H.has(r), u = Ne[r];
659
659
  return /* @__PURE__ */ s(
660
660
  "button",
661
661
  {
662
662
  type: "button",
663
- onClick: () => ve(n),
663
+ onClick: () => we(r),
664
664
  "aria-pressed": a,
665
- "data-notes-filter": n,
666
- disabled: p === 0 && a,
665
+ "data-notes-filter": r,
666
+ disabled: u === 0 && a,
667
667
  className: `inline-flex items-center gap-1 rounded-full border px-2 py-px text-[11px] font-medium transition-colors ${a ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 text-slate-400 line-through decoration-slate-300 dark:border-border"} disabled:opacity-50`,
668
- title: n === "people" ? "Comments and notes people wrote" : n === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
668
+ title: r === "people" ? "Comments and notes people wrote" : r === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
669
669
  children: [
670
- Ve[n],
671
- /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: p })
670
+ Ye[r],
671
+ /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: u })
672
672
  ]
673
673
  },
674
- n
674
+ r
675
675
  );
676
676
  }),
677
677
  /* @__PURE__ */ e(
678
678
  "input",
679
679
  {
680
- value: H,
681
- onChange: (n) => ge(n.target.value),
680
+ value: X,
681
+ onChange: (r) => ke(r.target.value),
682
682
  placeholder: "Search notes…",
683
683
  "aria-label": "Search notes",
684
684
  "data-notes-search": !0,
685
685
  className: "ml-auto h-6 w-[150px] rounded-md border border-slate-200 bg-background px-2 text-[11.5px] dark:border-border"
686
686
  }
687
687
  ),
688
- ke && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
689
- V.length,
688
+ _e && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
689
+ Z.length,
690
690
  " of ",
691
- v.length
691
+ $.length
692
692
  ] })
693
693
  ] }),
694
- l ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((n) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
694
+ _ ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
695
695
  /* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
696
696
  /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
697
697
  /* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
698
698
  /* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
699
699
  ] })
700
- ] }, n)) }) : x ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : v.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : V.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: V.map((n) => {
701
- if (n.kind === "related")
700
+ ] }, r)) }) : S ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : $.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : Z.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes match — clear the search or turn a filter back on." }) : /* @__PURE__ */ e("div", { className: "nvr-stagger-direct space-y-4", children: Z.map((r) => {
701
+ if (r.kind === "related")
702
702
  return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
703
- Ye,
703
+ tt,
704
704
  {
705
- note: n.note,
705
+ note: r.note,
706
706
  collection: t,
707
707
  item: String(i)
708
708
  }
709
- ) }, n.note.id);
710
- const a = n.comment, p = E === a.user.id, Q = y === a.id;
709
+ ) }, r.note.id);
710
+ const a = r.comment, u = E === a.user.id, Q = y === a.id;
711
711
  return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
712
712
  /* @__PURE__ */ e(
713
- ze,
713
+ Ue,
714
714
  {
715
715
  userId: a.user.id,
716
716
  className: "h-8 w-8",
717
- fallback: /* @__PURE__ */ e(Be, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Ue, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: Xe(a.user) }) })
717
+ fallback: /* @__PURE__ */ e(We, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(He, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: Je(a.user) }) })
718
718
  }
719
719
  ),
720
720
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
721
721
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
722
- /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ee(a.user) }),
723
- /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: ae(a.created_at) }),
722
+ /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: re(a.user) }),
723
+ /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(a.created_at) }),
724
724
  a.updated_at && a.updated_at !== a.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
725
- !Q && /* @__PURE__ */ s("div", { className: "ml-auto flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100", children: [
726
- /* @__PURE__ */ e(
727
- "button",
728
- {
729
- type: "button",
730
- title: "Make a task from this comment",
731
- className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
732
- onClick: () => we.mutate(a),
733
- children: /* @__PURE__ */ e(Se, { className: "h-3 w-3" })
734
- }
735
- ),
736
- p && /* @__PURE__ */ s(ce, { children: [
737
- /* @__PURE__ */ e(
738
- "button",
739
- {
740
- type: "button",
741
- className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
742
- onClick: () => {
743
- R(a.id), O(a.text);
744
- },
745
- children: /* @__PURE__ */ e($e, { className: "h-3 w-3" })
746
- }
747
- ),
748
- /* @__PURE__ */ e(
749
- "button",
750
- {
751
- type: "button",
752
- className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
753
- onClick: () => Ne.mutate(a.id),
754
- children: /* @__PURE__ */ e(qe, { className: "h-3 w-3" })
755
- }
756
- )
757
- ] })
758
- ] })
725
+ !Q && /* @__PURE__ */ s(
726
+ "div",
727
+ {
728
+ className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${B === a.id ? "opacity-100" : "opacity-0"}`,
729
+ children: [
730
+ /* @__PURE__ */ e(
731
+ "button",
732
+ {
733
+ type: "button",
734
+ title: "Make a task from this comment",
735
+ "aria-label": "Make a task from this comment",
736
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
737
+ onClick: () => Ce.mutate(a),
738
+ children: /* @__PURE__ */ e(Ee, { className: "h-3 w-3" })
739
+ }
740
+ ),
741
+ u && (B === a.id ? /* @__PURE__ */ s(te, { children: [
742
+ /* @__PURE__ */ e(
743
+ "button",
744
+ {
745
+ type: "button",
746
+ autoFocus: !0,
747
+ disabled: ee.isPending,
748
+ "data-comment-delete-confirm": a.id,
749
+ className: "rounded bg-red-600 px-1.5 py-px text-[10.5px] font-medium text-white transition-colors hover:bg-red-700 disabled:opacity-60",
750
+ onClick: () => ee.mutate(a.id, {
751
+ onSettled: () => L(null)
752
+ }),
753
+ children: ee.isPending ? "Deleting…" : "Delete comment?"
754
+ }
755
+ ),
756
+ /* @__PURE__ */ e(
757
+ "button",
758
+ {
759
+ type: "button",
760
+ className: "rounded px-1.5 py-px text-[10.5px] font-medium text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-muted",
761
+ onClick: () => L(null),
762
+ children: "Keep"
763
+ }
764
+ )
765
+ ] }) : /* @__PURE__ */ s(te, { children: [
766
+ /* @__PURE__ */ e(
767
+ "button",
768
+ {
769
+ type: "button",
770
+ title: "Edit comment",
771
+ "aria-label": "Edit comment",
772
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
773
+ onClick: () => {
774
+ D(a.id), A(a.text);
775
+ },
776
+ children: /* @__PURE__ */ e(qe, { className: "h-3 w-3" })
777
+ }
778
+ ),
779
+ /* @__PURE__ */ e(
780
+ "button",
781
+ {
782
+ type: "button",
783
+ title: "Delete comment",
784
+ "aria-label": "Delete comment",
785
+ className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
786
+ onClick: () => L(a.id),
787
+ children: /* @__PURE__ */ e(De, { className: "h-3 w-3" })
788
+ }
789
+ )
790
+ ] }))
791
+ ]
792
+ }
793
+ )
759
794
  ] }),
760
795
  Q ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
761
796
  /* @__PURE__ */ e(
762
- te,
797
+ ae,
763
798
  {
764
- value: K,
765
- onChange: O,
799
+ value: q,
800
+ onChange: A,
766
801
  rows: 3,
767
802
  className: "text-[13px]"
768
803
  }
769
804
  ),
770
805
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
771
806
  /* @__PURE__ */ s(
772
- X,
807
+ G,
773
808
  {
774
809
  size: "sm",
775
810
  className: "h-7 gap-1.5",
776
- disabled: !K.trim() || se.isPending,
777
- onClick: () => se.mutate({ id: a.id, text: K.trim() }),
811
+ disabled: !q.trim() || de.isPending,
812
+ onClick: () => de.mutate({ id: a.id, text: q.trim() }),
778
813
  children: [
779
- /* @__PURE__ */ e(Ee, { className: "h-3 w-3" }),
814
+ /* @__PURE__ */ e(Pe, { className: "h-3 w-3" }),
780
815
  " Save"
781
816
  ]
782
817
  }
783
818
  ),
784
819
  /* @__PURE__ */ s(
785
- X,
820
+ G,
786
821
  {
787
822
  size: "sm",
788
823
  variant: "outline",
789
824
  className: "h-7 gap-1.5",
790
825
  onClick: () => {
791
- R(null), O("");
826
+ D(null), A("");
792
827
  },
793
828
  children: [
794
829
  /* @__PURE__ */ e(Re, { className: "h-3 w-3" }),
@@ -797,44 +832,44 @@ function kt({
797
832
  }
798
833
  )
799
834
  ] })
800
- ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(re, { text: a.text }) }),
801
- !Q && /* @__PURE__ */ e(Ge, { comment: a }),
835
+ ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text: a.text }) }),
836
+ !Q && /* @__PURE__ */ e(Ve, { comment: a }),
802
837
  !Q && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
803
- (a.reactions ?? []).map((T) => /* @__PURE__ */ s(
838
+ (a.reactions ?? []).map((P) => /* @__PURE__ */ s(
804
839
  "button",
805
840
  {
806
841
  type: "button",
807
- onClick: () => oe.mutate({ id: a.id, emoji: T.emoji }),
808
- className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${T.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
842
+ onClick: () => ce.mutate({ id: a.id, emoji: P.emoji }),
843
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${P.mine ? "border-nvr-cyan/40 bg-nvr-cyan/10 text-nvr-navy dark:text-nvr-cyan" : "border-slate-200 bg-slate-50 text-slate-600 hover:border-slate-300 dark:border-border dark:bg-muted dark:text-slate-300"}`,
809
844
  children: [
810
- T.emoji,
811
- /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: T.count })
845
+ P.emoji,
846
+ /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: P.count })
812
847
  ]
813
848
  },
814
- T.emoji
849
+ P.emoji
815
850
  )),
816
851
  /* @__PURE__ */ s("span", { className: "relative", children: [
817
852
  /* @__PURE__ */ e(
818
853
  "button",
819
854
  {
820
855
  type: "button",
821
- onClick: () => ie(le === a.id ? null : a.id),
856
+ onClick: () => ue(me === a.id ? null : a.id),
822
857
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
823
858
  "aria-label": "Add reaction",
824
- children: /* @__PURE__ */ e(he, { className: "h-3.5 w-3.5" })
859
+ children: /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" })
825
860
  }
826
861
  ),
827
- le === a.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: be.map((T) => /* @__PURE__ */ e(
862
+ me === a.id && /* @__PURE__ */ e("span", { className: "absolute bottom-6 left-0 z-20 flex gap-0.5 rounded-full border border-slate-200 bg-white px-1.5 py-1 shadow-lg dark:border-border dark:bg-popover", children: ye.map((P) => /* @__PURE__ */ e(
828
863
  "button",
829
864
  {
830
865
  type: "button",
831
866
  onClick: () => {
832
- oe.mutate({ id: a.id, emoji: T }), ie(null);
867
+ ce.mutate({ id: a.id, emoji: P }), ue(null);
833
868
  },
834
869
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
835
- children: T
870
+ children: P
836
871
  },
837
- T
872
+ P
838
873
  )) })
839
874
  ] })
840
875
  ] })
@@ -848,5 +883,5 @@ function kt({
848
883
  );
849
884
  }
850
885
  export {
851
- kt as CommentPanel
886
+ wt as CommentPanel
852
887
  };