@nivaro/react 0.3.50 โ†’ 0.3.52

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 (29) hide show
  1. package/dist/hooks/useSessionRecorder.js +1 -1
  2. package/dist/index.d.ts +13 -3
  3. package/dist/shared/components/ItemEditForm.js +4801 -4666
  4. package/dist/shared/components/QueryTable.js +337 -324
  5. package/dist/shared/components/ReportView.js +105 -99
  6. package/dist/shared/components/alerts/AlertManagerView.js +327 -301
  7. package/dist/shared/components/item-edit/CatalogPickerField.js +1149 -1111
  8. package/dist/shared/components/item-edit/DraftRecoveryBanner.js +58 -53
  9. package/dist/shared/components/item-edit/FieldRenderer.js +227 -223
  10. package/dist/shared/components/item-edit/FieldRow.js +287 -265
  11. package/dist/shared/components/item-edit/FilePickerField.js +315 -307
  12. package/dist/shared/components/item-edit/InlineTableField.js +491 -466
  13. package/dist/shared/components/item-edit/RecordHeaderActions.js +76 -75
  14. package/dist/shared/components/item-edit/RecordLiveSync.js +93 -91
  15. package/dist/shared/components/item-edit/RelationCombobox.js +62 -60
  16. package/dist/shared/components/item-edit/SummaryPanel.js +287 -277
  17. package/dist/shared/components/item-edit/UserChip.js +233 -200
  18. package/dist/shared/components/item-edit/header-midair.js +51 -0
  19. package/dist/shared/components/item-edit/line-midair.js +76 -70
  20. package/dist/shared/components/panels/CommentPanel.js +290 -284
  21. package/dist/shared/components/panels/ItemLockBanner.js +30 -30
  22. package/dist/shared/components/panels/PipelinePanel.js +956 -901
  23. package/dist/shared/components/panels/TaskPanel.js +71 -61
  24. package/dist/shared/components/panels/TransitionRequirementsDialog.js +569 -439
  25. package/dist/shared/components/panels/requirement-side-effects.js +40 -0
  26. package/dist/shared/components/queue/QueueWorklist.js +141 -130
  27. package/dist/shared/lib/draft-store.js +48 -34
  28. package/dist/shared/lib/query-stats.js +60 -60
  29. package/package.json +1 -1
@@ -1,32 +1,32 @@
1
- import { jsxs as s, jsx as e, Fragment as V } from "react/jsx-runtime";
2
- import { useQueryClient as fe, useQuery as U, useMutation as L } from "@tanstack/react-query";
3
- import { MessageSquare as $e, ChevronDown as Ee, ClipboardPlus as qe, Pencil as De, Trash2 as Pe, Check as Te, X as Fe, SmilePlus as ge } from "lucide-react";
4
- import { useState as N, useRef as Y, useEffect as Z, useMemo as X } from "react";
5
- import { createPortal as Re } from "react-dom";
6
- import { toast as F } from "sonner";
7
- import { useNivaroClient as oe, useItemEditAuth as Me, useDrilldown as Ie } from "../../context.js";
8
- import { useDebounced as je } from "../../hooks/useDebounced.js";
9
- import { get as W, post as B, patch as Oe, del as Le } from "../../lib/commands.js";
10
- import { usePresenceOnlinePoll as Ae } from "../../lib/presence-live.js";
11
- import { useRecordSignalPeers as Ke, useRecordSignalSender as Be, signalSentence as Qe } from "../../lib/presence-signals.js";
12
- import { invalidateRecordTasks as ze } from "../../lib/record-tasks.js";
13
- import { formatRelative as le, titleCase as Ue } from "../../lib/utils.js";
14
- import { AgentBadge as We } from "../AgentBadge.js";
1
+ import { jsxs as s, jsx as e, Fragment as Y } from "react/jsx-runtime";
2
+ import { useQueryClient as ge, useQuery as z, useMutation as L } from "@tanstack/react-query";
3
+ import { MessageSquare as qe, ChevronDown as De, ClipboardPlus as Pe, Pencil as Te, Trash2 as Fe, Check as Re, X as Me, SmilePlus as ye } from "lucide-react";
4
+ import { useState as N, useRef as U, useEffect as Q, useMemo as V } from "react";
5
+ import { createPortal as Ie } from "react-dom";
6
+ import { toast as I } from "sonner";
7
+ import { useNivaroClient as oe, useItemEditAuth as je, useDrilldown as Oe } from "../../context.js";
8
+ import { useDebounced as Le } from "../../hooks/useDebounced.js";
9
+ import { get as W, post as B, patch as Ae, del as Ke } from "../../lib/commands.js";
10
+ import { usePresenceOnlinePoll as Be } from "../../lib/presence-live.js";
11
+ import { useRecordSignalPeers as Qe, useRecordSignalSender as ze, signalSentence as Ue } from "../../lib/presence-signals.js";
12
+ import { invalidateRecordTasks as We } from "../../lib/record-tasks.js";
13
+ import { formatRelative as le, titleCase as Ge } from "../../lib/utils.js";
14
+ import { AgentBadge as He } from "../AgentBadge.js";
15
15
  import { AutolinkedText as se } from "../AutolinkedText.js";
16
- import { InboundRequestPopover as Ge } from "../integrations/InboundRequest.js";
17
- import { useFieldComments as He } from "../item-edit/field-comments-context.js";
18
- import { UserAvatar as Xe } from "../UserAvatar.js";
19
- import { Avatar as Je, AvatarFallback as Ve } from "../ui/avatar.js";
20
- import { Button as J } from "../ui/button.js";
21
- import { Separator as xe } from "../ui/separator.js";
22
- import { Textarea as Ze } from "../ui/textarea.js";
23
- import { RecordEventPathSheet as Ye } from "./IntegrationActivitySection.js";
24
- const ye = ["๐Ÿ‘", "โœ…", "๐Ÿ‘€", "๐ŸŽ‰", "โค๏ธ", "๐Ÿ˜‚"];
25
- function et(t) {
16
+ import { InboundRequestPopover as Xe } from "../integrations/InboundRequest.js";
17
+ import { useFieldComments as Je } from "../item-edit/field-comments-context.js";
18
+ import { UserAvatar as Ve } from "../UserAvatar.js";
19
+ import { Avatar as Ze, AvatarFallback as Ye } from "../ui/avatar.js";
20
+ import { Button as Z } from "../ui/button.js";
21
+ import { Separator as he } from "../ui/separator.js";
22
+ import { Textarea as et } from "../ui/textarea.js";
23
+ import { RecordEventPathSheet as tt } from "./IntegrationActivitySection.js";
24
+ const ve = ["๐Ÿ‘", "โœ…", "๐Ÿ‘€", "๐ŸŽ‰", "โค๏ธ", "๐Ÿ˜‚"];
25
+ function nt(t) {
26
26
  var d, c, h, m;
27
27
  return [(d = t.first_name) == null ? void 0 : d[0], (c = t.last_name) == null ? void 0 : c[0]].filter(Boolean).join("").toUpperCase() || ((m = (h = t.email) == null ? void 0 : h[0]) == null ? void 0 : m.toUpperCase()) || "?";
28
28
  }
29
- function tt({ comment: t }) {
29
+ function rt({ comment: t }) {
30
30
  const i = (t.mentions ?? []).filter(
31
31
  (d) => {
32
32
  var c;
@@ -58,16 +58,16 @@ function tt({ comment: t }) {
58
58
  }
59
59
  );
60
60
  }
61
- function ae(t) {
61
+ function re(t) {
62
62
  return [t.first_name, t.last_name].filter(Boolean).join(" ") || t.email;
63
63
  }
64
- function nt({
64
+ function at({
65
65
  field: t,
66
66
  label: i,
67
67
  resolved: d,
68
68
  onJump: c
69
69
  }) {
70
- const h = /* @__PURE__ */ s(V, { children: [
70
+ const h = /* @__PURE__ */ s(Y, { children: [
71
71
  "on ",
72
72
  /* @__PURE__ */ e("span", { className: "font-medium", children: i }),
73
73
  d && /* @__PURE__ */ e("span", { className: "text-slate-400 dark:text-slate-500", children: " ยท resolved" })
@@ -84,124 +84,124 @@ function nt({
84
84
  }
85
85
  ) : /* @__PURE__ */ e("span", { "data-comment-field": t, className: m, children: h });
86
86
  }
87
- function at(t, i) {
87
+ function st(t, i) {
88
88
  const c = t.slice(0, i).match(/(^|\s)@([a-zA-Z0-9._-]{2,})$/);
89
89
  return c ? { start: i - c[2].length - 1, query: c[2] } : null;
90
90
  }
91
- function he(t) {
91
+ function be(t) {
92
92
  return t.email.split("@")[0];
93
93
  }
94
- function re({
94
+ function ae({
95
95
  value: t,
96
96
  onChange: i,
97
97
  ...d
98
98
  }) {
99
- const c = oe(), h = Y(null), [m, f] = N(null), [S, g] = N(0), v = je((m == null ? void 0 : m.query) ?? "", 200), { data: D = [] } = U({
99
+ const c = oe(), h = U(null), [m, C] = N(null), [y, w] = N(0), v = Le((m == null ? void 0 : m.query) ?? "", 200), { data: q = [] } = z({
100
100
  queryKey: ["users", "mention-search", v],
101
101
  queryFn: () => c.request(
102
102
  W("/users", { limit: 8, sort: "first_name", search: v })
103
103
  ).then((n) => n.data),
104
104
  enabled: !!m && v.length >= 2,
105
105
  staleTime: 3e4
106
- }), M = Ae(15e3, !!m), { data: $ } = U({
106
+ }), R = Be(15e3, !!m), { data: D } = z({
107
107
  queryKey: ["presence-online"],
108
108
  queryFn: () => c.request(
109
109
  W("/presence/online")
110
110
  ),
111
111
  enabled: !!m,
112
- refetchInterval: M,
112
+ refetchInterval: R,
113
113
  staleTime: 5e3
114
- }), p = (n) => {
115
- var u;
116
- const l = (u = $ == null ? void 0 : $.data) == null ? void 0 : u.find((k) => String(k.user_id).toUpperCase() === n.toUpperCase());
114
+ }), _ = (n) => {
115
+ var p;
116
+ const l = (p = D == null ? void 0 : D.data) == null ? void 0 : p.find((b) => String(b.user_id).toUpperCase() === n.toUpperCase());
117
117
  return l ? l.is_idle || l.away ? 1 : 0 : 2;
118
- }, y = [...D].sort((n, l) => p(n.id) - p(l.id)), { data: R = [] } = U({
118
+ }, u = [...q].sort((n, l) => _(n.id) - _(l.id)), { data: P = [] } = z({
119
119
  queryKey: ["mention-roles"],
120
120
  queryFn: () => c.request(W("/chat/roles")).then((n) => n.data).catch(() => []),
121
121
  enabled: !!m,
122
122
  staleTime: 5 * 6e4
123
- }), P = m ? R.filter(
123
+ }), S = m ? P.filter(
124
124
  (n) => n.name.toLowerCase().replace(/\s+/g, "-").startsWith(v.toLowerCase())
125
- ).slice(0, 3) : [], w = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()), E = !!m && v.length >= 2 && (y.length > 0 || w || P.length > 0), o = y.length + (w ? 1 : 0) + P.length, [b, I] = N(null), A = Y(null);
126
- Z(() => {
127
- if (!E || !h.current) {
128
- I(null);
125
+ ).slice(0, 3) : [], k = !!m && v.length >= 2 && "owners".startsWith(v.toLowerCase()), T = !!m && v.length >= 2 && (u.length > 0 || k || S.length > 0), o = u.length + (k ? 1 : 0) + S.length, [f, $] = N(null), O = U(null);
126
+ Q(() => {
127
+ if (!T || !h.current) {
128
+ $(null);
129
129
  return;
130
130
  }
131
131
  const n = h.current.getBoundingClientRect();
132
- I({ top: n.bottom + 4, left: n.left, width: Math.min(n.width, 360) });
133
- const l = (k) => {
134
- var _;
135
- (_ = A.current) != null && _.contains(k.target) || f(null);
136
- }, u = () => f(null);
137
- return window.addEventListener("scroll", l, !0), window.addEventListener("resize", u), () => {
138
- window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", u);
132
+ $({ top: n.bottom + 4, left: n.left, width: Math.min(n.width, 360) });
133
+ const l = (b) => {
134
+ var g;
135
+ (g = O.current) != null && g.contains(b.target) || C(null);
136
+ }, p = () => C(null);
137
+ return window.addEventListener("scroll", l, !0), window.addEventListener("resize", p), () => {
138
+ window.removeEventListener("scroll", l, !0), window.removeEventListener("resize", p);
139
139
  };
140
- }, [E]);
141
- function Q(n) {
142
- const l = at(n.value, n.selectionStart ?? n.value.length);
143
- f(l), l || g(0);
140
+ }, [T]);
141
+ function G(n) {
142
+ const l = st(n.value, n.selectionStart ?? n.value.length);
143
+ C(l), l || w(0);
144
144
  }
145
- function q(n) {
145
+ function F(n) {
146
146
  if (!m || !h.current) return;
147
- const l = h.current.selectionStart ?? t.length, u = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${he(n)} `, k = t.slice(0, m.start) + u + t.slice(l);
148
- i(k), f(null), g(0);
149
- const _ = m.start + u.length;
147
+ const l = h.current.selectionStart ?? t.length, p = n === "__owners__" ? "@owners " : typeof n == "object" && "role" in n ? `@${n.role.toLowerCase().replace(/\s+/g, "-")} ` : `@${be(n)} `, b = t.slice(0, m.start) + p + t.slice(l);
148
+ i(b), C(null), w(0);
149
+ const g = m.start + p.length;
150
150
  requestAnimationFrame(() => {
151
- var j, O;
152
- (j = h.current) == null || j.focus(), (O = h.current) == null || O.setSelectionRange(_, _);
151
+ var j, A;
152
+ (j = h.current) == null || j.focus(), (A = h.current) == null || A.setSelectionRange(g, g);
153
153
  });
154
154
  }
155
- function z(n) {
156
- if (E)
155
+ function H(n) {
156
+ if (T)
157
157
  if (n.key === "ArrowDown")
158
- n.preventDefault(), g((l) => (l + 1) % o);
158
+ n.preventDefault(), w((l) => (l + 1) % o);
159
159
  else if (n.key === "ArrowUp")
160
- n.preventDefault(), g((l) => (l - 1 + o) % o);
160
+ n.preventDefault(), w((l) => (l - 1 + o) % o);
161
161
  else if (n.key === "Enter" || n.key === "Tab") {
162
162
  n.preventDefault();
163
- const l = Math.min(S, o - 1), u = w ? 1 : 0, k = u + y.length;
164
- if (w && l === 0) q("__owners__");
165
- else if (l >= k) {
166
- const _ = P[l - k];
167
- _ && q({ role: _.name });
168
- } else q(y[l - u]);
169
- } else n.key === "Escape" && (n.preventDefault(), f(null));
163
+ const l = Math.min(y, o - 1), p = k ? 1 : 0, b = p + u.length;
164
+ if (k && l === 0) F("__owners__");
165
+ else if (l >= b) {
166
+ const g = S[l - b];
167
+ g && F({ role: g.name });
168
+ } else F(u[l - p]);
169
+ } else n.key === "Escape" && (n.preventDefault(), C(null));
170
170
  }
171
171
  return /* @__PURE__ */ s("div", { className: "relative", children: [
172
172
  /* @__PURE__ */ e(
173
- Ze,
173
+ et,
174
174
  {
175
175
  ...d,
176
176
  ref: h,
177
177
  value: t,
178
178
  onChange: (n) => {
179
- i(n.target.value), Q(n.target);
179
+ i(n.target.value), G(n.target);
180
180
  },
181
- onKeyDown: z,
182
- onClick: (n) => Q(n.currentTarget),
183
- onBlur: () => setTimeout(() => f(null), 150)
181
+ onKeyDown: H,
182
+ onClick: (n) => G(n.currentTarget),
183
+ onBlur: () => setTimeout(() => C(null), 150)
184
184
  }
185
185
  ),
186
- E && b && Re(
186
+ T && f && Ie(
187
187
  /* @__PURE__ */ s(
188
188
  "div",
189
189
  {
190
- ref: A,
190
+ ref: O,
191
191
  "data-mention-menu": "",
192
192
  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",
193
- style: { top: b.top, left: b.left, width: b.width },
193
+ style: { top: f.top, left: f.left, width: f.width },
194
194
  onMouseDown: (n) => n.preventDefault(),
195
195
  children: [
196
- w && /* @__PURE__ */ s(
196
+ k && /* @__PURE__ */ s(
197
197
  "button",
198
198
  {
199
199
  type: "button",
200
200
  onMouseDown: (n) => {
201
- n.preventDefault(), q("__owners__");
201
+ n.preventDefault(), F("__owners__");
202
202
  },
203
- onMouseEnter: () => g(0),
204
- className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${S === 0 ? "bg-nvr-cyan/10" : ""}`,
203
+ onMouseEnter: () => w(0),
204
+ className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${y === 0 ? "bg-nvr-cyan/10" : ""}`,
205
205
  children: [
206
206
  /* @__PURE__ */ e("span", { className: "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: "โ˜…" }),
207
207
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
@@ -211,39 +211,39 @@ function re({
211
211
  ]
212
212
  }
213
213
  ),
214
- y.map((n, l) => {
215
- var _, j;
216
- const u = w ? l + 1 : l, k = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email;
214
+ u.map((n, l) => {
215
+ var g, j;
216
+ const p = k ? l + 1 : l, b = [n.first_name, n.last_name].filter(Boolean).join(" ") || n.email;
217
217
  return /* @__PURE__ */ s(
218
218
  "button",
219
219
  {
220
220
  type: "button",
221
- onMouseDown: (O) => {
222
- O.preventDefault(), q(n);
221
+ onMouseDown: (A) => {
222
+ A.preventDefault(), F(n);
223
223
  },
224
- onMouseEnter: () => g(u),
225
- className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${u === S ? "bg-nvr-cyan/10" : ""}`,
224
+ onMouseEnter: () => w(p),
225
+ className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === y ? "bg-nvr-cyan/10" : ""}`,
226
226
  children: [
227
227
  /* @__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: [
228
- (`${((_ = n.first_name) == null ? void 0 : _[0]) ?? ""}${((j = n.last_name) == null ? void 0 : j[0]) ?? ""}`.trim() || n.email[0]).toUpperCase(),
229
- p(n.id) < 2 && /* @__PURE__ */ e(
228
+ (`${((g = n.first_name) == null ? void 0 : g[0]) ?? ""}${((j = n.last_name) == null ? void 0 : j[0]) ?? ""}`.trim() || n.email[0]).toUpperCase(),
229
+ _(n.id) < 2 && /* @__PURE__ */ e(
230
230
  "span",
231
231
  {
232
- "data-mention-presence": p(n.id) === 0 ? "online" : "idle",
233
- title: p(n.id) === 0 ? "Online" : "Idle",
234
- className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${p(n.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
232
+ "data-mention-presence": _(n.id) === 0 ? "online" : "idle",
233
+ title: _(n.id) === 0 ? "Online" : "Idle",
234
+ className: `absolute -bottom-px -right-px h-2 w-2 rounded-full ring-2 ring-white dark:ring-popover ${_(n.id) === 0 ? "bg-emerald-500" : "border border-amber-500 bg-white dark:bg-popover"}`
235
235
  }
236
236
  )
237
237
  ] }),
238
238
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
239
- /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: k }),
239
+ /* @__PURE__ */ e("span", { className: "block truncate text-[12px] font-medium text-slate-700 dark:text-slate-200", children: b }),
240
240
  /* @__PURE__ */ s("span", { className: "block truncate text-[11px] text-slate-400", children: [
241
241
  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: [
242
242
  "OOO",
243
243
  n.ooo_end ? ` until ${String(n.ooo_end).slice(0, 10)}` : ""
244
244
  ] }),
245
245
  "@",
246
- he(n),
246
+ be(n),
247
247
  (n.title || n.department) && /* @__PURE__ */ s("span", { className: "text-slate-400 dark:text-slate-500", children: [
248
248
  " ยท ",
249
249
  [n.title, n.department].filter(Boolean).join(", ")
@@ -255,17 +255,17 @@ function re({
255
255
  n.id
256
256
  );
257
257
  }),
258
- P.map((n, l) => {
259
- const u = y.length + (w ? 1 : 0) + l;
258
+ S.map((n, l) => {
259
+ const p = u.length + (k ? 1 : 0) + l;
260
260
  return /* @__PURE__ */ s(
261
261
  "button",
262
262
  {
263
263
  type: "button",
264
- onMouseDown: (k) => {
265
- k.preventDefault(), q({ role: n.name });
264
+ onMouseDown: (b) => {
265
+ b.preventDefault(), F({ role: n.name });
266
266
  },
267
- onMouseEnter: () => g(u),
268
- className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${u === S ? "bg-nvr-cyan/10" : ""}`,
267
+ onMouseEnter: () => w(p),
268
+ className: `flex w-full items-center gap-2.5 px-2.5 py-1.5 text-left transition-colors ${p === y ? "bg-nvr-cyan/10" : ""}`,
269
269
  children: [
270
270
  /* @__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" }),
271
271
  /* @__PURE__ */ s("span", { className: "min-w-0 flex-1", children: [
@@ -284,7 +284,7 @@ function re({
284
284
  )
285
285
  ] });
286
286
  }
287
- function be(t) {
287
+ function fe(t) {
288
288
  if (t.kind === "comment") return "people";
289
289
  switch (t.note.source) {
290
290
  case "note":
@@ -296,81 +296,81 @@ function be(t) {
296
296
  return "system";
297
297
  }
298
298
  }
299
- const rt = {
299
+ const ot = {
300
300
  people: "People",
301
301
  system: "System",
302
302
  integration: "Integration"
303
- }, st = "integrations:";
304
- function ot({
303
+ }, lt = "integrations:";
304
+ function it({
305
305
  note: t,
306
306
  collection: i,
307
307
  item: d
308
308
  }) {
309
- var E;
310
- const c = Ie(), [h, m] = N(!1), f = t.source === "external" && !!t.provider && !t.provider.startsWith(st), S = oe(), g = fe(), [v, D] = N(!1), M = L({
311
- mutationFn: (o) => S.request(B(`/comments/${t.comment_id}/reactions`, { emoji: o })),
309
+ var T;
310
+ const c = Oe(), [h, m] = N(!1), C = t.source === "external" && !!t.provider && !t.provider.startsWith(lt), y = oe(), w = ge(), [v, q] = N(!1), R = L({
311
+ mutationFn: (o) => y.request(B(`/comments/${t.comment_id}/reactions`, { emoji: o })),
312
312
  onSuccess: () => {
313
- D(!1), g.invalidateQueries({ queryKey: ["comments-related"] }), g.invalidateQueries({ queryKey: ["row-comment-counts"] });
313
+ q(!1), w.invalidateQueries({ queryKey: ["comments-related"] }), w.invalidateQueries({ queryKey: ["row-comment-counts"] });
314
314
  },
315
- onError: () => F.error("Failed to react")
316
- }), [$, p] = N(!1), y = L({
317
- mutationFn: () => S.request(
315
+ onError: () => I.error("Failed to react")
316
+ }), [D, _] = N(!1), u = L({
317
+ mutationFn: () => y.request(
318
318
  B(`/integration-events/${encodeURIComponent(t.provider ?? "")}/replay`, {
319
319
  entry_id: t.id.replace(/^external:/, "")
320
320
  })
321
321
  ),
322
322
  onSuccess: (o) => {
323
- var b;
324
- p(!1), F.success("Event replayed", {
325
- description: (b = o == null ? void 0 : o.data) == null ? void 0 : b.detail
326
- }), g.invalidateQueries({ queryKey: ["comments-related"] });
323
+ var f;
324
+ _(!1), I.success("Event replayed", {
325
+ description: (f = o == null ? void 0 : o.data) == null ? void 0 : f.detail
326
+ }), w.invalidateQueries({ queryKey: ["comments-related"] });
327
327
  },
328
328
  onError: (o) => {
329
- var I;
330
- p(!1);
331
- const b = (I = o == null ? void 0 : o.response) == null ? void 0 : I.error;
332
- F.error(b ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
329
+ var $;
330
+ _(!1);
331
+ const f = ($ = o == null ? void 0 : o.response) == null ? void 0 : $.error;
332
+ I.error(f ?? (o == null ? void 0 : o.message) ?? "Replay failed", { duration: 8e3 });
333
333
  }
334
- }), R = t.link ? () => {
334
+ }), P = t.link ? () => {
335
335
  const o = t.link;
336
336
  if (!o) return;
337
- const b = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
338
- if (b) {
339
- b.scrollIntoView({ behavior: "smooth", block: "center" }), b.classList.add("nvr-row-flash"), setTimeout(() => b.classList.remove("nvr-row-flash"), 2400);
337
+ const f = document.querySelector(`[data-o2m-row="${o.collection}:${o.item_id}"]`);
338
+ if (f) {
339
+ f.scrollIntoView({ behavior: "smooth", block: "center" }), f.classList.add("nvr-row-flash"), setTimeout(() => f.classList.remove("nvr-row-flash"), 2400);
340
340
  return;
341
341
  }
342
342
  c == null || c.open({ collection: o.collection, itemId: o.item_id });
343
- } : 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", w = t.source === "import" && ((E = t.import) != null && E.file_id) ? t.import : null;
343
+ } : null, S = 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", k = t.source === "import" && ((T = t.import) != null && T.file_id) ? t.import : null;
344
344
  return /* @__PURE__ */ s("div", { className: "flex gap-3", "data-recorded-note": t.source, children: [
345
345
  /* @__PURE__ */ e("div", { className: "mt-1 h-8 w-8 shrink-0", "aria-hidden": !0 }),
346
346
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
347
347
  /* @__PURE__ */ s("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1", children: [
348
- /* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${P}`, children: t.label }),
348
+ /* @__PURE__ */ e("span", { className: `rounded border px-1.5 py-px text-[10px] font-medium ${S}`, children: t.label }),
349
349
  t.user_name && /* @__PURE__ */ e("span", { className: "text-[12px] font-medium text-slate-700 dark:text-slate-200", children: t.user_name }),
350
- t.context && (R ? /* @__PURE__ */ e(
350
+ t.context && (P ? /* @__PURE__ */ e(
351
351
  "button",
352
352
  {
353
353
  type: "button",
354
- onClick: R,
354
+ onClick: P,
355
355
  className: "truncate text-[11px] text-nvr-navy underline-offset-2 hover:underline dark:text-nvr-cyan",
356
356
  "data-line-comment-link": !0,
357
357
  children: t.context
358
358
  }
359
- ) : w ? /* @__PURE__ */ e(
359
+ ) : k ? /* @__PURE__ */ e(
360
360
  "a",
361
361
  {
362
- href: `/api/files/${w.file_id}?download=1`,
362
+ href: `/api/files/${k.file_id}?download=1`,
363
363
  target: "_blank",
364
364
  rel: "noreferrer",
365
365
  onClick: (o) => o.stopPropagation(),
366
366
  className: "truncate text-[11px] text-nvr-navy underline decoration-dotted underline-offset-2 dark:text-nvr-cyan",
367
- "data-note-import-file": w.file_id ?? void 0,
367
+ "data-note-import-file": k.file_id ?? void 0,
368
368
  children: t.context
369
369
  }
370
370
  ) : /* @__PURE__ */ e("span", { className: "truncate text-[11px] text-slate-400", children: t.context })),
371
371
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(t.created_at) }),
372
372
  t.source === "inbound" && t.inbound && /* @__PURE__ */ e(
373
- Ge,
373
+ Xe,
374
374
  {
375
375
  activityId: t.inbound.activity_id,
376
376
  callerName: t.label,
@@ -390,7 +390,7 @@ function ot({
390
390
  }
391
391
  ),
392
392
  t.source === "external" && t.status === "error" && /* @__PURE__ */ e("span", { className: "rounded bg-red-50 px-1 text-[10px] font-medium text-red-700 dark:bg-red-500/10 dark:text-red-400", children: "error" }),
393
- f && /* @__PURE__ */ e(
393
+ C && /* @__PURE__ */ e(
394
394
  "button",
395
395
  {
396
396
  type: "button",
@@ -405,13 +405,13 @@ function ot({
405
405
  "button",
406
406
  {
407
407
  type: "button",
408
- onClick: () => $ ? y.mutate() : p(!0),
409
- onBlur: () => p(!1),
410
- disabled: y.isPending,
408
+ onClick: () => D ? u.mutate() : _(!0),
409
+ onBlur: () => _(!1),
410
+ disabled: u.isPending,
411
411
  "data-note-replay": t.id,
412
- className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${$ ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
412
+ className: `rounded px-1.5 py-px text-[10.5px] font-medium transition-colors ${D ? "bg-sky-600 text-white" : "text-sky-700 hover:bg-sky-50 dark:text-sky-300 dark:hover:bg-sky-900/20"}`,
413
413
  "data-tip": "Re-apply this event from its stored payload",
414
- children: y.isPending ? "Replayingโ€ฆ" : $ ? "Replay this event?" : "Replay"
414
+ children: u.isPending ? "Replayingโ€ฆ" : D ? "Replay this event?" : "Replay"
415
415
  }
416
416
  )
417
417
  ] }),
@@ -421,7 +421,7 @@ function ot({
421
421
  "button",
422
422
  {
423
423
  type: "button",
424
- onClick: () => M.mutate(o.emoji),
424
+ onClick: () => R.mutate(o.emoji),
425
425
  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"}`,
426
426
  children: [
427
427
  o.emoji,
@@ -435,17 +435,17 @@ function ot({
435
435
  "button",
436
436
  {
437
437
  type: "button",
438
- onClick: () => D((o) => !o),
438
+ onClick: () => q((o) => !o),
439
439
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
440
440
  "aria-label": "Add reaction",
441
- children: /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" })
441
+ children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
442
442
  }
443
443
  ),
444
- v && /* @__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(
444
+ v && /* @__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: ve.map((o) => /* @__PURE__ */ e(
445
445
  "button",
446
446
  {
447
447
  type: "button",
448
- onClick: () => M.mutate(o),
448
+ onClick: () => R.mutate(o),
449
449
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
450
450
  children: o
451
451
  },
@@ -454,8 +454,8 @@ function ot({
454
454
  ] })
455
455
  ] })
456
456
  ] }),
457
- f && t.provider && /* @__PURE__ */ e(
458
- Ye,
457
+ C && t.provider && /* @__PURE__ */ e(
458
+ tt,
459
459
  {
460
460
  target: h ? {
461
461
  source: t.provider,
@@ -468,99 +468,105 @@ function ot({
468
468
  )
469
469
  ] });
470
470
  }
471
- function Dt({
471
+ function Tt({
472
472
  collection: t,
473
473
  item: i,
474
474
  title: d,
475
475
  defaultExpanded: c,
476
476
  queuedComments: h,
477
- onQueueComment: m
477
+ onQueueComment: m,
478
+ onUnsentDraft: C
478
479
  }) {
479
- const f = oe(), { userId: S } = Me(), g = fe(), v = He(), [D, M] = N(!1), $ = Y(!1);
480
- Z(() => {
481
- !$.current && c !== void 0 && ($.current = !0, M(c));
480
+ const y = oe(), { userId: w } = je(), v = ge(), q = Je(), [R, D] = N(!1), _ = U(!1);
481
+ Q(() => {
482
+ !_.current && c !== void 0 && (_.current = !0, D(c));
482
483
  }, [c]);
483
- const [p, y] = N(""), [R, P] = N(!1), w = async () => {
484
+ const [u, P] = N(""), S = U(C);
485
+ S.current = C, Q(() => {
486
+ var r;
487
+ (r = S.current) == null || r.call(S, u);
488
+ }, [u]);
489
+ const [k, T] = N(!1), o = async () => {
484
490
  var r;
485
- if (!(!p.trim() || R)) {
486
- P(!0);
491
+ if (!(!u.trim() || k)) {
492
+ T(!0);
487
493
  try {
488
- const a = await f.request(
489
- B("/ai/cleanup", { text: p })
494
+ const a = await y.request(
495
+ B("/ai/cleanup", { text: u })
490
496
  );
491
- (r = a.data) != null && r.text && y(a.data.text);
497
+ (r = a.data) != null && r.text && P(a.data.text);
492
498
  } catch {
493
499
  } finally {
494
- P(!1);
500
+ T(!1);
495
501
  }
496
502
  }
497
- }, E = Ke(t, i, "note"), o = Be(t, i, "note"), b = Y(0);
498
- Z(() => {
499
- if (!p.trim()) {
500
- b.current && o("stop"), b.current = 0;
503
+ }, f = Qe(t, i, "note"), $ = ze(t, i, "note"), O = U(0);
504
+ Q(() => {
505
+ if (!u.trim()) {
506
+ O.current && $("stop"), O.current = 0;
501
507
  return;
502
508
  }
503
509
  const r = Date.now();
504
- r - b.current < 2500 || (b.current = r, o("start"));
505
- }, [p, o]), Z(() => () => o("stop"), [o]);
506
- const [I, A] = N(null), [Q, q] = N(null), [z, n] = N(""), l = !i || i === "new", u = ["comments", t, String(i)], { data: k, isLoading: _, isError: j } = U({
507
- queryKey: u,
508
- queryFn: () => f.request(W("/comments", { collection: t, item: i })).then((r) => r.data),
509
- enabled: !l
510
- }), O = X(() => (k ?? []).filter((r) => !r.deleted), [k]), { data: ve } = U({
510
+ r - O.current < 2500 || (O.current = r, $("start"));
511
+ }, [u, $]), Q(() => () => $("stop"), [$]);
512
+ const [G, F] = N(null), [H, n] = N(null), [l, p] = N(""), b = !i || i === "new", g = ["comments", t, String(i)], { data: j, isLoading: A, isError: ke } = z({
513
+ queryKey: g,
514
+ queryFn: () => y.request(W("/comments", { collection: t, item: i })).then((r) => r.data),
515
+ enabled: !b
516
+ }), ie = V(() => (j ?? []).filter((r) => !r.deleted), [j]), { data: Ne } = z({
511
517
  queryKey: ["comments-related", t, String(i)],
512
- queryFn: () => f.request(W("/comments/related", { collection: t, item: i })).then((r) => r.data ?? []).catch(() => []),
513
- enabled: !l,
518
+ queryFn: () => y.request(W("/comments/related", { collection: t, item: i })).then((r) => r.data ?? []).catch(() => []),
519
+ enabled: !b,
514
520
  staleTime: 3e4
515
- }), ie = ve ?? [], C = X(() => {
516
- const r = O.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), a = ie.map((x) => ({ kind: "related", at: x.created_at, note: x }));
521
+ }), de = Ne ?? [], E = V(() => {
522
+ const r = ie.map((x) => ({ kind: "comment", at: x.created_at, comment: x })), a = de.map((x) => ({ kind: "related", at: x.created_at, note: x }));
517
523
  return [...r, ...a].sort((x, K) => new Date(K.at).getTime() - new Date(x.at).getTime());
518
- }, [O, ie]), [G, ke] = N(() => /* @__PURE__ */ new Set()), [H, Ne] = N(""), we = X(() => {
524
+ }, [ie, de]), [X, we] = N(() => /* @__PURE__ */ new Set()), [J, _e] = N(""), Ce = V(() => {
519
525
  const r = { people: 0, system: 0, integration: 0 };
520
- for (const a of C) r[be(a)]++;
526
+ for (const a of E) r[fe(a)]++;
521
527
  return r;
522
- }, [C]), ee = X(() => {
523
- const r = H.trim().toLowerCase();
524
- return C.filter((a) => G.has(be(a)) ? !1 : r ? (a.kind === "comment" ? `${a.comment.text} ${ae(a.comment.user)}` : `${a.note.text} ${a.note.user_name ?? ""} ${a.note.label} ${a.note.context ?? ""} ${a.note.provider ?? ""}`).toLowerCase().includes(r) : !0);
525
- }, [C, G, H]), _e = (r) => ke((a) => {
528
+ }, [E]), ee = V(() => {
529
+ const r = J.trim().toLowerCase();
530
+ return E.filter((a) => X.has(fe(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);
531
+ }, [E, X, J]), Se = (r) => we((a) => {
526
532
  const x = new Set(a);
527
533
  return x.has(r) ? x.delete(r) : x.add(r), x;
528
- }), Ce = G.size > 0 || H.trim() !== "", te = L({
529
- mutationFn: (r) => f.request(B("/comments", { collection: t, item: i, text: r })),
534
+ }), $e = X.size > 0 || J.trim() !== "", te = L({
535
+ mutationFn: (r) => y.request(B("/comments", { collection: t, item: i, text: r })),
530
536
  onSuccess: () => {
531
- g.invalidateQueries({ queryKey: u }), y("");
537
+ v.invalidateQueries({ queryKey: g }), P("");
532
538
  },
533
- onError: () => F.error("Failed to post comment")
534
- }), de = L({
535
- mutationFn: ({ id: r, text: a }) => f.request(Oe(`/comments/${r}`, { text: a })),
539
+ onError: () => I.error("Failed to post comment")
540
+ }), ce = L({
541
+ mutationFn: ({ id: r, text: a }) => y.request(Ae(`/comments/${r}`, { text: a })),
536
542
  onSuccess: () => {
537
- g.invalidateQueries({ queryKey: u }), A(null), n("");
543
+ v.invalidateQueries({ queryKey: g }), F(null), p("");
538
544
  },
539
- onError: () => F.error("Failed to update comment")
545
+ onError: () => I.error("Failed to update comment")
540
546
  }), ne = L({
541
- mutationFn: (r) => f.request(Le(`/comments/${r}`)),
542
- onSuccess: () => g.invalidateQueries({ queryKey: u }),
543
- onError: () => F.error("Failed to delete comment")
544
- }), ce = L({
545
- mutationFn: ({ id: r, emoji: a }) => f.request(B(`/comments/${r}/reactions`, { emoji: a })),
546
- onSuccess: () => g.invalidateQueries({ queryKey: u }),
547
- onError: () => F.error("Failed to react")
548
- }), [me, pe] = N(null), Se = L({
549
- mutationFn: (r) => f.request(
547
+ mutationFn: (r) => y.request(Ke(`/comments/${r}`)),
548
+ onSuccess: () => v.invalidateQueries({ queryKey: g }),
549
+ onError: () => I.error("Failed to delete comment")
550
+ }), me = L({
551
+ mutationFn: ({ id: r, emoji: a }) => y.request(B(`/comments/${r}/reactions`, { emoji: a })),
552
+ onSuccess: () => v.invalidateQueries({ queryKey: g }),
553
+ onError: () => I.error("Failed to react")
554
+ }), [ue, pe] = N(null), Ee = L({
555
+ mutationFn: (r) => y.request(
550
556
  B("/tasks", {
551
557
  collection: t,
552
558
  item: i,
553
559
  title: r.text.replace(/<[^>]*>/g, "").replace(/@\[([^\]]+)\]/g, "@$1").slice(0, 200),
554
- assignee: S
560
+ assignee: w
555
561
  })
556
562
  ),
557
563
  onSuccess: () => {
558
- ze(g, t, i), F.success("Task created from comment โ€” assigned to you");
564
+ We(v, t, i), I.success("Task created from comment โ€” assigned to you");
559
565
  },
560
- onError: () => F.error("Could not create a task")
566
+ onError: () => I.error("Could not create a task")
561
567
  });
562
- function ue(r) {
563
- r.preventDefault(), p.trim() && (l && m ? (m(p.trim()), y("")) : te.mutate(p.trim()));
568
+ function xe(r) {
569
+ r.preventDefault(), u.trim() && (b && m ? (m(u.trim()), P("")) : te.mutate(u.trim()));
564
570
  }
565
571
  return (
566
572
  // Addressable from elsewhere (the summary panel jumps here), which needs
@@ -569,7 +575,7 @@ function Dt({
569
575
  "div",
570
576
  {
571
577
  "data-panel": "notes",
572
- "data-panel-expanded": D ? "true" : "false",
578
+ "data-panel-expanded": R ? "true" : "false",
573
579
  className: "overflow-hidden rounded-xl border border-slate-200 bg-white dark:bg-card dark:border-border",
574
580
  children: [
575
581
  /* @__PURE__ */ s(
@@ -577,22 +583,22 @@ function Dt({
577
583
  {
578
584
  type: "button",
579
585
  "data-panel-toggle": "notes",
580
- onClick: () => M((r) => !r),
586
+ onClick: () => D((r) => !r),
581
587
  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]",
582
588
  children: [
583
589
  /* @__PURE__ */ s("span", { className: "flex w-full items-center gap-2.5", children: [
584
- /* @__PURE__ */ e($e, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
590
+ /* @__PURE__ */ e(qe, { className: "h-3.5 w-3.5 shrink-0 text-slate-400" }),
585
591
  /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800 dark:text-slate-200", children: d || "Comments" }),
586
- (C.length > 0 || (h ?? []).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: l ? (h ?? []).length : C.length }),
592
+ (E.length > 0 || (h ?? []).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 ? (h ?? []).length : E.length }),
587
593
  /* @__PURE__ */ e(
588
- Ee,
594
+ De,
589
595
  {
590
- className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${D ? " rotate-180" : ""}`
596
+ className: `ml-auto h-3.5 w-3.5 shrink-0 text-slate-400 transition-transform duration-150${R ? " rotate-180" : ""}`
591
597
  }
592
598
  )
593
599
  ] }),
594
- !D && !l && C.length > 0 && (() => {
595
- const r = C[0], a = r.kind === "comment" ? ae(r.comment.user) : r.note.user_name ?? "System", x = (r.kind === "comment" ? r.comment.text : r.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
600
+ !R && !b && E.length > 0 && (() => {
601
+ const r = E[0], a = r.kind === "comment" ? re(r.comment.user) : r.note.user_name ?? "System", x = (r.kind === "comment" ? r.comment.text : r.note.text).replace(/<[^>]*>/g, " ").replace(/@\[([^\]]+)\]/g, "@$1").replace(/\s+/g, " ").trim();
596
602
  return x ? /* @__PURE__ */ s("span", { className: "mt-1 w-full truncate pl-6 text-[11.5px] text-slate-400", children: [
597
603
  /* @__PURE__ */ s("span", { className: "font-medium text-slate-500 dark:text-slate-400", children: [
598
604
  a,
@@ -605,13 +611,13 @@ function Dt({
605
611
  ]
606
612
  }
607
613
  ),
608
- D && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: l ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
609
- /* @__PURE__ */ s("form", { onSubmit: ue, className: "space-y-2", children: [
614
+ R && /* @__PURE__ */ e("div", { className: "border-t border-slate-100 px-5 py-4 dark:border-border/60", children: b ? /* @__PURE__ */ s("div", { className: "space-y-4", children: [
615
+ /* @__PURE__ */ s("form", { onSubmit: xe, className: "space-y-2", children: [
610
616
  /* @__PURE__ */ e(
611
- re,
617
+ ae,
612
618
  {
613
- value: p,
614
- onChange: y,
619
+ value: u,
620
+ onChange: P,
615
621
  placeholder: "Write a commentโ€ฆ",
616
622
  rows: 3,
617
623
  className: "text-[13px]"
@@ -619,11 +625,11 @@ function Dt({
619
625
  ),
620
626
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
621
627
  /* @__PURE__ */ e("p", { className: "text-[11px] text-slate-400", children: "Comment will be posted after the record is saved." }),
622
- /* @__PURE__ */ e(J, { type: "submit", size: "sm", disabled: !p.trim(), children: "Queue" })
628
+ /* @__PURE__ */ e(Z, { type: "submit", size: "sm", disabled: !u.trim(), children: "Queue" })
623
629
  ] })
624
630
  ] }),
625
631
  (h ?? []).length > 0 && /* @__PURE__ */ s("div", { className: "space-y-2", children: [
626
- /* @__PURE__ */ e(xe, {}),
632
+ /* @__PURE__ */ e(he, {}),
627
633
  (h ?? []).map((r, a) => /* @__PURE__ */ s(
628
634
  "div",
629
635
  {
@@ -636,13 +642,13 @@ function Dt({
636
642
  a
637
643
  ))
638
644
  ] })
639
- ] }) : /* @__PURE__ */ s(V, { children: [
640
- /* @__PURE__ */ s("form", { onSubmit: ue, className: "space-y-2", children: [
645
+ ] }) : /* @__PURE__ */ s(Y, { children: [
646
+ /* @__PURE__ */ s("form", { onSubmit: xe, className: "space-y-2", children: [
641
647
  /* @__PURE__ */ e(
642
- re,
648
+ ae,
643
649
  {
644
- value: p,
645
- onChange: y,
650
+ value: u,
651
+ onChange: P,
646
652
  placeholder: "Write a commentโ€ฆ",
647
653
  rows: 3,
648
654
  className: "text-[13px]"
@@ -655,45 +661,45 @@ function Dt({
655
661
  "button",
656
662
  {
657
663
  type: "button",
658
- disabled: !p.trim() || R,
659
- onClick: () => void w(),
664
+ disabled: !u.trim() || k,
665
+ onClick: () => void o(),
660
666
  "data-tip": "โœจ Fix grammar & clarity (meaning preserved)",
661
667
  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",
662
- children: R ? "โ€ฆ" : "โœจ Polish"
668
+ children: k ? "โ€ฆ" : "โœจ Polish"
663
669
  }
664
670
  ),
665
- /* @__PURE__ */ e(J, { type: "submit", size: "sm", disabled: !p.trim() || te.isPending, children: te.isPending ? "Postingโ€ฆ" : "Comment" })
671
+ /* @__PURE__ */ e(Z, { type: "submit", size: "sm", disabled: !u.trim() || te.isPending, children: te.isPending ? "Postingโ€ฆ" : "Comment" })
666
672
  ] })
667
673
  ] })
668
674
  ] }),
669
- E.length > 0 && /* @__PURE__ */ s(
675
+ f.length > 0 && /* @__PURE__ */ s(
670
676
  "p",
671
677
  {
672
678
  className: "flex items-center gap-1.5 text-[11.5px] italic text-slate-400",
673
679
  "data-note-typing": !0,
674
680
  children: [
675
681
  /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
676
- Qe(E, "writing a note"),
682
+ Ue(f, "writing a note"),
677
683
  "โ€ฆ"
678
684
  ]
679
685
  }
680
686
  ),
681
- /* @__PURE__ */ e(xe, { className: "my-4" }),
682
- C.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
687
+ /* @__PURE__ */ e(he, { className: "my-4" }),
688
+ E.length > 0 && /* @__PURE__ */ s("div", { className: "mb-3 flex flex-wrap items-center gap-1.5", "data-notes-filters": !0, children: [
683
689
  ["people", "system", "integration"].map((r) => {
684
- const a = !G.has(r), x = we[r];
690
+ const a = !X.has(r), x = Ce[r];
685
691
  return /* @__PURE__ */ s(
686
692
  "button",
687
693
  {
688
694
  type: "button",
689
- onClick: () => _e(r),
695
+ onClick: () => Se(r),
690
696
  "aria-pressed": a,
691
697
  "data-notes-filter": r,
692
698
  disabled: x === 0 && a,
693
699
  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`,
694
700
  title: r === "people" ? "Comments and notes people wrote" : r === "system" ? "State changes, change reasons, addendums and imports" : "Events an integration recorded",
695
701
  children: [
696
- rt[r],
702
+ ot[r],
697
703
  /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] opacity-70", children: x })
698
704
  ]
699
705
  },
@@ -703,65 +709,65 @@ function Dt({
703
709
  /* @__PURE__ */ e(
704
710
  "input",
705
711
  {
706
- value: H,
707
- onChange: (r) => Ne(r.target.value),
712
+ value: J,
713
+ onChange: (r) => _e(r.target.value),
708
714
  placeholder: "Search notesโ€ฆ",
709
715
  "aria-label": "Search notes",
710
716
  "data-notes-search": !0,
711
717
  className: "ml-auto h-6 w-[150px] rounded-md border border-slate-200 bg-background px-2 text-[11.5px] dark:border-border"
712
718
  }
713
719
  ),
714
- Ce && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
720
+ $e && /* @__PURE__ */ s("span", { className: "text-[10.5px] tabular-nums text-slate-400", "data-notes-shown": !0, children: [
715
721
  ee.length,
716
722
  " of ",
717
- C.length
723
+ E.length
718
724
  ] })
719
725
  ] }),
720
- _ ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
726
+ A ? /* @__PURE__ */ e("div", { className: "space-y-4", children: ["a", "b"].map((r) => /* @__PURE__ */ s("div", { className: "flex gap-3", children: [
721
727
  /* @__PURE__ */ e("div", { className: "h-8 w-8 shrink-0 animate-pulse rounded-full bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
722
728
  /* @__PURE__ */ s("div", { className: "flex-1 space-y-1.5", children: [
723
729
  /* @__PURE__ */ e("div", { className: "h-3 w-32 animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" }),
724
730
  /* @__PURE__ */ e("div", { className: "h-3 w-full animate-pulse rounded bg-slate-100 dark:bg-[hsl(var(--nvr-skeleton))]" })
725
731
  ] })
726
- ] }, r)) }) : j ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : C.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.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: ee.map((r) => {
732
+ ] }, r)) }) : ke ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-red-500", children: "Failed to load comments." }) : E.length === 0 ? /* @__PURE__ */ e("p", { className: "py-6 text-center text-[12px] text-slate-400", children: "No notes yet." }) : ee.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: ee.map((r) => {
727
733
  if (r.kind === "related")
728
734
  return /* @__PURE__ */ e("div", { className: "nvr-section-enter", children: /* @__PURE__ */ e(
729
- ot,
735
+ it,
730
736
  {
731
737
  note: r.note,
732
738
  collection: t,
733
739
  item: String(i)
734
740
  }
735
741
  ) }, r.note.id);
736
- const a = r.comment, x = S === a.user.id, K = I === a.id;
742
+ const a = r.comment, x = w === a.user.id, K = G === a.id;
737
743
  return /* @__PURE__ */ s("div", { className: "nvr-section-enter group flex gap-3", children: [
738
744
  /* @__PURE__ */ e(
739
- Xe,
745
+ Ve,
740
746
  {
741
747
  userId: a.user.id,
742
748
  className: "h-8 w-8",
743
- fallback: /* @__PURE__ */ e(Je, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Ve, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: et(a.user) }) })
749
+ fallback: /* @__PURE__ */ e(Ze, { className: "h-8 w-8 shrink-0", children: /* @__PURE__ */ e(Ye, { className: "bg-nvr-cyan/15 text-[11px] font-bold text-nvr-navy", children: nt(a.user) }) })
744
750
  }
745
751
  ),
746
752
  /* @__PURE__ */ s("div", { className: "min-w-0 flex-1", children: [
747
753
  /* @__PURE__ */ s("div", { className: "flex items-center gap-2", children: [
748
- /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: ae(a.user) }),
749
- /* @__PURE__ */ e(We, { label: a.via_agent }),
754
+ /* @__PURE__ */ e("span", { className: "text-[13px] font-medium text-slate-800", children: re(a.user) }),
755
+ /* @__PURE__ */ e(He, { label: a.via_agent }),
750
756
  /* @__PURE__ */ e("span", { className: "text-[11px] text-slate-400", children: le(a.created_at) }),
751
757
  a.updated_at && a.updated_at !== a.created_at && /* @__PURE__ */ e("span", { className: "text-[10px] text-slate-300", children: "(edited)" }),
752
758
  a.field && /* @__PURE__ */ e(
753
- nt,
759
+ at,
754
760
  {
755
761
  field: a.field,
756
- label: (v == null ? void 0 : v.labelOf(a.field)) ?? Ue(a.field),
762
+ label: (q == null ? void 0 : q.labelOf(a.field)) ?? Ge(a.field),
757
763
  resolved: !!a.resolved_at,
758
- onJump: v ? () => v.jump(a.field) : void 0
764
+ onJump: q ? () => q.jump(a.field) : void 0
759
765
  }
760
766
  ),
761
767
  !K && /* @__PURE__ */ s(
762
768
  "div",
763
769
  {
764
- className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${Q === a.id ? "opacity-100" : "opacity-0"}`,
770
+ className: `ml-auto flex items-center gap-1 transition-opacity group-hover:opacity-100 focus-within:opacity-100 ${H === a.id ? "opacity-100" : "opacity-0"}`,
765
771
  children: [
766
772
  /* @__PURE__ */ e(
767
773
  "button",
@@ -770,11 +776,11 @@ function Dt({
770
776
  title: "Make a task from this comment",
771
777
  "aria-label": "Make a task from this comment",
772
778
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted",
773
- onClick: () => Se.mutate(a),
774
- children: /* @__PURE__ */ e(qe, { className: "h-3 w-3" })
779
+ onClick: () => Ee.mutate(a),
780
+ children: /* @__PURE__ */ e(Pe, { className: "h-3 w-3" })
775
781
  }
776
782
  ),
777
- x && (Q === a.id ? /* @__PURE__ */ s(V, { children: [
783
+ x && (H === a.id ? /* @__PURE__ */ s(Y, { children: [
778
784
  /* @__PURE__ */ e(
779
785
  "button",
780
786
  {
@@ -784,7 +790,7 @@ function Dt({
784
790
  "data-comment-delete-confirm": a.id,
785
791
  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",
786
792
  onClick: () => ne.mutate(a.id, {
787
- onSettled: () => q(null)
793
+ onSettled: () => n(null)
788
794
  }),
789
795
  children: ne.isPending ? "Deletingโ€ฆ" : "Delete comment?"
790
796
  }
@@ -794,11 +800,11 @@ function Dt({
794
800
  {
795
801
  type: "button",
796
802
  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",
797
- onClick: () => q(null),
803
+ onClick: () => n(null),
798
804
  children: "Keep"
799
805
  }
800
806
  )
801
- ] }) : /* @__PURE__ */ s(V, { children: [
807
+ ] }) : /* @__PURE__ */ s(Y, { children: [
802
808
  /* @__PURE__ */ e(
803
809
  "button",
804
810
  {
@@ -807,9 +813,9 @@ function Dt({
807
813
  "aria-label": "Edit comment",
808
814
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-slate-100 hover:text-slate-700",
809
815
  onClick: () => {
810
- A(a.id), n(a.text);
816
+ F(a.id), p(a.text);
811
817
  },
812
- children: /* @__PURE__ */ e(De, { className: "h-3 w-3" })
818
+ children: /* @__PURE__ */ e(Te, { className: "h-3 w-3" })
813
819
  }
814
820
  ),
815
821
  /* @__PURE__ */ e(
@@ -819,8 +825,8 @@ function Dt({
819
825
  title: "Delete comment",
820
826
  "aria-label": "Delete comment",
821
827
  className: "rounded p-1 text-slate-400 transition-colors hover:bg-red-50 hover:text-red-500",
822
- onClick: () => q(a.id),
823
- children: /* @__PURE__ */ e(Pe, { className: "h-3 w-3" })
828
+ onClick: () => n(a.id),
829
+ children: /* @__PURE__ */ e(Fe, { className: "h-3 w-3" })
824
830
  }
825
831
  )
826
832
  ] }))
@@ -830,82 +836,82 @@ function Dt({
830
836
  ] }),
831
837
  K ? /* @__PURE__ */ s("div", { className: "mt-1.5 space-y-2", children: [
832
838
  /* @__PURE__ */ e(
833
- re,
839
+ ae,
834
840
  {
835
- value: z,
836
- onChange: n,
841
+ value: l,
842
+ onChange: p,
837
843
  rows: 3,
838
844
  className: "text-[13px]"
839
845
  }
840
846
  ),
841
847
  /* @__PURE__ */ s("div", { className: "flex items-center gap-1.5", children: [
842
848
  /* @__PURE__ */ s(
843
- J,
849
+ Z,
844
850
  {
845
851
  size: "sm",
846
852
  className: "h-7 gap-1.5",
847
- disabled: !z.trim() || de.isPending,
848
- onClick: () => de.mutate({ id: a.id, text: z.trim() }),
853
+ disabled: !l.trim() || ce.isPending,
854
+ onClick: () => ce.mutate({ id: a.id, text: l.trim() }),
849
855
  children: [
850
- /* @__PURE__ */ e(Te, { className: "h-3 w-3" }),
856
+ /* @__PURE__ */ e(Re, { className: "h-3 w-3" }),
851
857
  " Save"
852
858
  ]
853
859
  }
854
860
  ),
855
861
  /* @__PURE__ */ s(
856
- J,
862
+ Z,
857
863
  {
858
864
  size: "sm",
859
865
  variant: "outline",
860
866
  className: "h-7 gap-1.5",
861
867
  onClick: () => {
862
- A(null), n("");
868
+ F(null), p("");
863
869
  },
864
870
  children: [
865
- /* @__PURE__ */ e(Fe, { className: "h-3 w-3" }),
871
+ /* @__PURE__ */ e(Me, { className: "h-3 w-3" }),
866
872
  " Cancel"
867
873
  ]
868
874
  }
869
875
  )
870
876
  ] })
871
877
  ] }) : /* @__PURE__ */ e("p", { className: "mt-0.5 whitespace-pre-wrap text-[13px] leading-relaxed text-slate-600", children: /* @__PURE__ */ e(se, { text: a.text }) }),
872
- !K && /* @__PURE__ */ e(tt, { comment: a }),
878
+ !K && /* @__PURE__ */ e(rt, { comment: a }),
873
879
  !K && /* @__PURE__ */ s("div", { className: "mt-1 flex flex-wrap items-center gap-1", children: [
874
- (a.reactions ?? []).map((T) => /* @__PURE__ */ s(
880
+ (a.reactions ?? []).map((M) => /* @__PURE__ */ s(
875
881
  "button",
876
882
  {
877
883
  type: "button",
878
- onClick: () => ce.mutate({ id: a.id, emoji: T.emoji }),
879
- 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"}`,
884
+ onClick: () => me.mutate({ id: a.id, emoji: M.emoji }),
885
+ className: `inline-flex items-center gap-1 rounded-full border px-1.5 py-px text-[11px] transition-colors ${M.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"}`,
880
886
  children: [
881
- T.emoji,
882
- /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: T.count })
887
+ M.emoji,
888
+ /* @__PURE__ */ e("span", { className: "tabular-nums text-[10px] font-semibold", children: M.count })
883
889
  ]
884
890
  },
885
- T.emoji
891
+ M.emoji
886
892
  )),
887
893
  /* @__PURE__ */ s("span", { className: "relative", children: [
888
894
  /* @__PURE__ */ e(
889
895
  "button",
890
896
  {
891
897
  type: "button",
892
- onClick: () => pe(me === a.id ? null : a.id),
898
+ onClick: () => pe(ue === a.id ? null : a.id),
893
899
  className: "rounded p-0.5 text-slate-300 transition-colors hover:bg-slate-100 hover:text-slate-500 dark:hover:bg-muted",
894
900
  "aria-label": "Add reaction",
895
- children: /* @__PURE__ */ e(ge, { className: "h-3.5 w-3.5" })
901
+ children: /* @__PURE__ */ e(ye, { className: "h-3.5 w-3.5" })
896
902
  }
897
903
  ),
898
- 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((T) => /* @__PURE__ */ e(
904
+ ue === 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: ve.map((M) => /* @__PURE__ */ e(
899
905
  "button",
900
906
  {
901
907
  type: "button",
902
908
  onClick: () => {
903
- ce.mutate({ id: a.id, emoji: T }), pe(null);
909
+ me.mutate({ id: a.id, emoji: M }), pe(null);
904
910
  },
905
911
  className: "rounded-full px-1 text-[14px] hover:bg-muted",
906
- children: T
912
+ children: M
907
913
  },
908
- T
914
+ M
909
915
  )) })
910
916
  ] })
911
917
  ] })
@@ -919,6 +925,6 @@ function Dt({
919
925
  );
920
926
  }
921
927
  export {
922
- Dt as CommentPanel,
923
- re as MentionTextarea
928
+ Tt as CommentPanel,
929
+ ae as MentionTextarea
924
930
  };