@nivaro/react 0.3.126 → 0.3.128

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 (40) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +20 -2
  4. package/dist/index.js +150 -147
  5. package/dist/shared/components/CollectionBrowserView.js +3259 -3211
  6. package/dist/shared/components/DataTable.js +406 -401
  7. package/dist/shared/components/ItemEditForm.js +4359 -4299
  8. package/dist/shared/components/MatrixEditor.js +548 -490
  9. package/dist/shared/components/MyWorkView.js +284 -274
  10. package/dist/shared/components/NotificationBell.js +264 -218
  11. package/dist/shared/components/RecordGridEditor.js +582 -472
  12. package/dist/shared/components/chat/chat-core.js +331 -346
  13. package/dist/shared/components/chat/chat-typing.js +25 -0
  14. package/dist/shared/components/command-center/CommandCenterView.js +1 -1
  15. package/dist/shared/components/command-center/PeekPanel.js +8 -1
  16. package/dist/shared/components/command-center/api.js +17 -9
  17. package/dist/shared/components/command-center/panels/AttentionPanel.js +4 -1
  18. package/dist/shared/components/command-center/panels/PartnersPanel.js +2 -1
  19. package/dist/shared/components/item-edit/GroupSection.js +1 -1
  20. package/dist/shared/components/item-edit/InlineTableField.js +432 -429
  21. package/dist/shared/components/item-edit/RecordLiveSync.js +115 -108
  22. package/dist/shared/components/item-edit/RecordViewersChip.js +17 -16
  23. package/dist/shared/components/item-edit/RowComments.js +33 -30
  24. package/dist/shared/components/item-edit/cascade-clear-notice.js +30 -28
  25. package/dist/shared/components/item-edit/live-related.js +29 -16
  26. package/dist/shared/components/item-edit/record-opened-live.js +86 -0
  27. package/dist/shared/components/item-edit/reimport-m2m.js +17 -0
  28. package/dist/shared/components/panels/OwnerOpenedLine.js +24 -23
  29. package/dist/shared/components/panels/RecordIntegrityBanner.js +1 -1
  30. package/dist/shared/components/pipeline/TeamSuggestions.js +1 -1
  31. package/dist/shared/components/queue/QueueItemSheet.js +171 -130
  32. package/dist/shared/components/record-grid-guard.js +85 -0
  33. package/dist/shared/components/support/TicketDetailSheet.js +168 -151
  34. package/dist/shared/lib/at-risk-fields.js +14 -0
  35. package/dist/shared/lib/live-queries.js +9 -8
  36. package/dist/shared/lib/live-screen.js +77 -76
  37. package/dist/shared/lib/presence-hooks.js +190 -127
  38. package/dist/shared/lib/user-sync.js +78 -65
  39. package/dist/shared/lib/waiting-count.js +40 -29
  40. package/package.json +1 -1
@@ -1,87 +1,92 @@
1
1
  import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { useQueryClient as ve, useQuery as _e, useMutation as z } from "@tanstack/react-query";
3
- import { Check as Ce, Bot as Se } from "lucide-react";
4
- import { useState as S, useRef as H, useMemo as oe, useEffect as J } from "react";
5
- import { useApiFetchConfig as $e, useItemNavigation as Te, useNavigation as je } from "../context.js";
6
- import { useDeadlineNow as Oe, liveSlaReading as Ie } from "../lib/deadline-ticker.js";
7
- import { useLiveEvent as Le } from "../lib/live.js";
8
- import { useLiveOps as Me, useFreshIds as Ae } from "../lib/live-ops.js";
9
- import { resolveNotificationTarget as ie, runNotificationTarget as De } from "../lib/notification-target.js";
10
- import { usePrefetchIntent as qe } from "../lib/prefetch.js";
11
- import { useOptionalRealtime as Fe } from "../lib/realtime.js";
12
- import { usePeekOrOpen as Ue, peekable as le } from "../lib/record-peek.js";
13
- import { userErrorMessage as We } from "../lib/safe-error.js";
14
- import { slaChip as Ee, withinDay as Pe } from "../lib/sla-chip.js";
15
- import { cn as q, formatRelative as Qe } from "../lib/utils.js";
16
- import { AgentQuestionsCard as Ke } from "./AgentQuestionsCard.js";
17
- import { FirstWeekCard as Be } from "./ai/FirstWeekCard.js";
18
- import { TaskDoButton as ze } from "./ai/TaskDo.js";
19
- import { openChatRoom as He, canOpenChatRoom as Je } from "./chat/chat-core.js";
20
- import { useMyRecordRooms as Re } from "./chat/chat-hooks.js";
21
- import { useCoveringQuery as Ve, DelegateCoverLine as Ye } from "./DelegateCoverLine.js";
22
- import { LearningPathCard as Ze } from "./help-videos/viewer/LearningPathCard.js";
23
- import { RequiredVideosCard as Ge } from "./help-videos/viewer/RequiredVideosCard.js";
24
- import { SkeletonBar as Xe, ListSkeleton as et } from "./Skeletons.js";
25
- import { TickerNumber as tt } from "./TickerNumber.js";
26
- import { UserAvatar as rt } from "./UserAvatar.js";
27
- const at = 8e3, ce = ["records", "proposals", "tasks", "team", "waiting", "notifications"], me = /* @__PURE__ */ new Set(["records", "proposals"]), ue = {
2
+ import { useQueryClient as Se, useQuery as Ce, useMutation as H } from "@tanstack/react-query";
3
+ import { Check as $e, Bot as Te } from "lucide-react";
4
+ import { useState as O, useMemo as J, useRef as W, useEffect as V } from "react";
5
+ import { useApiFetchConfig as je, useItemNavigation as Oe, useNavigation as Ie } from "../context.js";
6
+ import { useDeadlineNow as Le, liveSlaReading as Me } from "../lib/deadline-ticker.js";
7
+ import { useLiveEvent as Ae } from "../lib/live.js";
8
+ import { useLiveOps as De, useFreshIds as qe } from "../lib/live-ops.js";
9
+ import { useSettledRows as Fe } from "../lib/live-screen.js";
10
+ import { resolveNotificationTarget as ue, runNotificationTarget as We } from "../lib/notification-target.js";
11
+ import { usePrefetchIntent as Ee } from "../lib/prefetch.js";
12
+ import { useOptionalRealtime as Ue, updateItemIds as Ke } from "../lib/realtime.js";
13
+ import { usePeekOrOpen as Pe, peekable as pe } from "../lib/record-peek.js";
14
+ import { userErrorMessage as Qe } from "../lib/safe-error.js";
15
+ import { withinDay as Be, slaChip as Re } from "../lib/sla-chip.js";
16
+ import { cn as I, formatRelative as ze } from "../lib/utils.js";
17
+ import { AgentQuestionsCard as He } from "./AgentQuestionsCard.js";
18
+ import { FirstWeekCard as Je } from "./ai/FirstWeekCard.js";
19
+ import { TaskDoButton as Ve } from "./ai/TaskDo.js";
20
+ import { openChatRoom as Ye, canOpenChatRoom as Ze } from "./chat/chat-core.js";
21
+ import { useMyRecordRooms as Ge } from "./chat/chat-hooks.js";
22
+ import { useCoveringQuery as Xe, DelegateCoverLine as et } from "./DelegateCoverLine.js";
23
+ import { LearningPathCard as tt } from "./help-videos/viewer/LearningPathCard.js";
24
+ import { RequiredVideosCard as rt } from "./help-videos/viewer/RequiredVideosCard.js";
25
+ import { SkeletonBar as at, ListSkeleton as nt } from "./Skeletons.js";
26
+ import { TickerNumber as st } from "./TickerNumber.js";
27
+ import { UserAvatar as dt } from "./UserAvatar.js";
28
+ const ot = 8e3, he = ["records", "proposals", "tasks", "team", "waiting", "notifications"], be = /* @__PURE__ */ new Set(["records", "proposals"]), xe = {
28
29
  records: "Waiting on you",
29
30
  proposals: "Changes to review",
30
31
  tasks: "My tasks",
31
32
  team: "Team tasks",
32
33
  waiting: "Waiting on others",
33
34
  notifications: "Notifications"
34
- }, nt = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), F = (o) => !!o && String(o).slice(0, 10) < nt(), st = {
35
+ }, it = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10), E = (d) => !!d && String(d).slice(0, 10) < it(), lt = {
35
36
  alert: "bg-red-500/10 text-red-600 dark:text-red-400",
36
37
  warn: "bg-amber-400/15 text-amber-700 dark:text-amber-400",
37
38
  neutral: "bg-slate-500/10 text-slate-600 dark:text-slate-400",
38
39
  ok: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-400"
39
40
  };
40
- function dt(o, u) {
41
- return o != null && o.due_at ? Ie(o, u) : o;
41
+ function Y(d, u) {
42
+ return d != null && d.due_at ? Me(d, u) : d;
42
43
  }
43
- function pe(o) {
44
- return !o || o.status === "breached" ? !1 : o.status === "warning" || Pe(o);
44
+ function ct(d, u) {
45
+ const l = Ke(d);
46
+ return l == null ? !0 : l.some((g) => String(g) === "*" || u.has(`${d.collection}:${g}`));
45
47
  }
46
- function ot({ sla: o }) {
47
- const u = Ee(o), c = u && pe(o) ? { ...u, tone: "warn" } : u;
48
- return c ? /* @__PURE__ */ e(
48
+ function Z(d) {
49
+ return !d || d.status === "breached" ? !1 : d.status === "warning" || Be(d);
50
+ }
51
+ function mt({ sla: d }) {
52
+ const u = Re(d), l = u && Z(d) ? { ...u, tone: "warn" } : u;
53
+ return l ? /* @__PURE__ */ e(
49
54
  "span",
50
55
  {
51
- "data-sla-chip": c.tone,
52
- className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${st[c.tone]}`,
53
- children: c.label
56
+ "data-sla-chip": l.tone,
57
+ className: `rounded px-1.5 py-0.5 text-[10px] font-semibold tabular-nums transition-colors duration-500 ${lt[l.tone]}`,
58
+ children: l.label
54
59
  }
55
60
  ) : null;
56
61
  }
57
- function it({ state: o, color: u }) {
58
- return o ? /* @__PURE__ */ e(
62
+ function ut({ state: d, color: u }) {
63
+ return d ? /* @__PURE__ */ e(
59
64
  "span",
60
65
  {
61
- "data-tip": o,
66
+ "data-tip": d,
62
67
  className: "min-w-0 truncate rounded-full px-2 py-0.5 text-[10.5px] font-medium",
63
68
  style: {
64
69
  backgroundColor: u ? `${u}22` : "rgba(100,116,139,.12)",
65
70
  color: u ?? void 0
66
71
  },
67
- children: o
72
+ children: d
68
73
  }
69
74
  ) : null;
70
75
  }
71
- function lt({ order: o, hidden: u }) {
72
- const c = o.filter(
76
+ function pt({ order: d, hidden: u }) {
77
+ const l = d.filter(
73
78
  (p) => !u.includes(p) && (p === "records" || p === "tasks" || p === "notifications")
74
- ), y = (p, w) => /* @__PURE__ */ n(
79
+ ), g = (p, w) => /* @__PURE__ */ n(
75
80
  "section",
76
81
  {
77
82
  className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
78
83
  children: [
79
84
  /* @__PURE__ */ n("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
80
- /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children: ue[p] ?? p }),
85
+ /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium text-slate-400 dark:text-slate-500", children: xe[p] ?? p }),
81
86
  p === "records" && /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
82
87
  ] }),
83
88
  /* @__PURE__ */ e(
84
- et,
89
+ nt,
85
90
  {
86
91
  header: !1,
87
92
  rows: w,
@@ -100,15 +105,15 @@ function lt({ order: o, hidden: u }) {
100
105
  ]
101
106
  },
102
107
  p
103
- ), g = [];
104
- for (let p = 0; p < c.length; ) {
105
- if (c[p] === "records") {
106
- g.push(y("records", 5)), p++;
108
+ ), k = [];
109
+ for (let p = 0; p < l.length; ) {
110
+ if (l[p] === "records") {
111
+ k.push(g("records", 5)), p++;
107
112
  continue;
108
113
  }
109
- const w = c.slice(p, p + 2).filter((f) => f !== "records");
110
- g.push(
111
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: w.map((f) => y(f, 4)) }, w.join("+"))
114
+ const w = l.slice(p, p + 2).filter((y) => y !== "records");
115
+ k.push(
116
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: w.map((y) => g(y, 4)) }, w.join("+"))
112
117
  ), p += w.length;
113
118
  }
114
119
  return /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work-loading": !0, "aria-busy": "true", children: [
@@ -119,7 +124,7 @@ function lt({ order: o, hidden: u }) {
119
124
  className: "rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card",
120
125
  children: [
121
126
  /* @__PURE__ */ e("p", { className: "text-[10.5px] uppercase tracking-wide text-muted-foreground", children: p }),
122
- /* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(Xe, { width: 34, className: "h-[18px] rounded-md" }) })
127
+ /* @__PURE__ */ e("p", { className: "mt-0.5 flex h-[27px] items-center", children: /* @__PURE__ */ e(at, { width: 34, className: "h-[18px] rounded-md" }) })
123
128
  ]
124
129
  },
125
130
  p
@@ -127,154 +132,163 @@ function lt({ order: o, hidden: u }) {
127
132
  /* @__PURE__ */ e("span", { className: "ml-3 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] text-slate-400 dark:border-border dark:text-slate-500", children: "Refresh" }),
128
133
  /* @__PURE__ */ e("span", { className: "ml-2 rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] text-slate-400 dark:border-border dark:text-slate-500", children: "Customize" })
129
134
  ] }),
130
- g
135
+ k
131
136
  ] });
132
137
  }
133
- function U({ label: o, value: u, tone: c }) {
138
+ function U({ label: d, value: u, tone: l }) {
134
139
  return /* @__PURE__ */ n("div", { className: "min-w-0 rounded-lg border border-slate-200 bg-white p-3 dark:border-border dark:bg-card", children: [
135
- /* @__PURE__ */ e("p", { className: "break-words text-[10.5px] uppercase tracking-wide text-muted-foreground", children: o }),
136
- /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${c ?? ""}`, children: /* @__PURE__ */ e(tt, { value: u }) })
140
+ /* @__PURE__ */ e("p", { className: "break-words text-[10.5px] uppercase tracking-wide text-muted-foreground", children: d }),
141
+ /* @__PURE__ */ e("p", { className: `mt-0.5 text-[18px] font-semibold tabular-nums ${l ?? ""}`, children: /* @__PURE__ */ e(st, { value: u }) })
137
142
  ] });
138
143
  }
139
- function Ft({
140
- notificationRoutes: o,
144
+ function Pt({
145
+ notificationRoutes: d,
141
146
  onOpenPath: u
142
147
  } = {}) {
143
- const { apiBase: c, authHeaders: y, credentials: g } = $e(), { open: p } = Te(), w = Ue(), f = je(), v = ve(), R = qe(), V = (r) => {
144
- var h, m;
145
- const s = ((h = o == null ? void 0 : o.support) == null ? void 0 : h.call(o, String(r))) ?? ((m = f.consoleUrl) == null ? void 0 : m.call(f, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
146
- u ? u(s) : f.navigate(s);
147
- }, W = Fe(), [he, O] = S(!1), [x, be] = S(() => {
148
+ const { apiBase: l, authHeaders: g, credentials: k } = je(), { open: p } = Oe(), w = Pe(), y = Ie(), v = Se(), G = Ee(), X = (r) => {
149
+ var h, c;
150
+ const s = ((h = d == null ? void 0 : d.support) == null ? void 0 : h.call(d, String(r))) ?? ((c = y.consoleUrl) == null ? void 0 : c.call(y, `/support?ticket=${r}`)) ?? `/support?ticket=${r}`;
151
+ u ? u(s) : y.navigate(s);
152
+ }, K = Ue(), [x, ge] = O(() => {
148
153
  try {
149
154
  const r = localStorage.getItem("nvr_mywork_sections");
150
155
  if (r) {
151
156
  const s = JSON.parse(r);
152
157
  if (Array.isArray(s == null ? void 0 : s.order) && Array.isArray(s == null ? void 0 : s.hidden)) {
153
- const h = ce.map((m, b) => ({
154
- k: m,
155
- at: s.order.indexOf(m) >= 0 ? s.order.indexOf(m) : b - 0.5
156
- })).sort((m, b) => m.at - b.at).map((m) => m.k);
157
- return { order: h, hidden: s.hidden.filter((m) => h.includes(m)) };
158
+ const h = he.map((c, b) => ({
159
+ k: c,
160
+ at: s.order.indexOf(c) >= 0 ? s.order.indexOf(c) : b - 0.5
161
+ })).sort((c, b) => c.at - b.at).map((c) => c.k);
162
+ return { order: h, hidden: s.hidden.filter((c) => h.includes(c)) };
158
163
  }
159
164
  }
160
165
  } catch {
161
166
  }
162
- return { order: [...ce], hidden: [] };
163
- }), Y = (r) => {
164
- be(r);
167
+ return { order: [...he], hidden: [] };
168
+ }), ee = (r) => {
169
+ ge(r);
165
170
  try {
166
171
  localStorage.setItem("nvr_mywork_sections", JSON.stringify(r));
167
172
  } catch {
168
173
  }
169
- }, [xe, ge] = S(!1), Z = H(0), [I, fe] = S("all"), ke = Oe(!0), [E, G] = S(null), { data: L } = Ve(), k = oe(() => {
170
- const r = E ? L == null ? void 0 : L.find((s) => s.user_id === E) : null;
174
+ }, [fe, ke] = O(!1), [_, ye] = O("all"), L = Le(!0), [M, te] = O(null), { data: A } = Xe(), f = J(() => {
175
+ const r = M ? A == null ? void 0 : A.find((s) => s.user_id === M) : null;
171
176
  return r ? { userId: r.user_id, name: r.first_name || r.name, keys: new Set(r.keys) } : null;
172
- }, [E, L]), { data: a, isLoading: ye, refetch: X, isFetching: ee } = _e({
177
+ }, [M, A]), { data: a, isLoading: we, refetch: Ne, isFetching: re } = Ce({
173
178
  queryKey: ["my-work"],
174
179
  queryFn: async () => {
175
- const r = await fetch(`${c}/my-work`, { headers: y, credentials: g });
180
+ const r = await fetch(`${l}/my-work`, { headers: g, credentials: k });
176
181
  if (!r.ok) throw new Error("my-work failed");
177
182
  return (await r.json()).data;
178
183
  },
179
184
  staleTime: 6e4
180
- }), te = H(0), $ = H(null), re = () => {
185
+ }), ae = W(0), $ = W(null), D = () => {
181
186
  const r = () => {
182
- $.current = null, te.current = Date.now(), O(!1), v.invalidateQueries({ queryKey: ["my-work"] });
183
- }, s = te.current + at - Date.now();
187
+ $.current = null, ae.current = Date.now(), v.invalidateQueries({ queryKey: ["my-work"] });
188
+ }, s = ae.current + ot - Date.now();
184
189
  $.current || (s <= 0 ? r() : $.current = setTimeout(r, s));
185
190
  };
186
- Me("my-work", re, { debounceMs: 1500 }), Le("notification:new", re, { debounceMs: 1500 }), J(
191
+ De("my-work", D, { debounceMs: 1500 }), Ae("notification:new", D, { debounceMs: 1500 }), V(
187
192
  () => () => {
188
193
  $.current && clearTimeout($.current);
189
194
  },
190
195
  []
191
196
  );
192
- const ae = Ae([
197
+ const ne = qe([
193
198
  ...((a == null ? void 0 : a.owned) ?? []).map((r) => `o:${r.collection}:${r.item}`),
194
199
  ...((a == null ? void 0 : a.tasks) ?? []).map((r) => `t:${r.id}`),
195
200
  ...((a == null ? void 0 : a.team_tasks) ?? []).map((r) => `tt:${r.id}`),
196
201
  ...((a == null ? void 0 : a.requested) ?? []).map((r) => `r:${r.id}`),
197
202
  ...((a == null ? void 0 : a.notifications) ?? []).map((r) => `n:${r.id}`),
198
203
  ...((a == null ? void 0 : a.proposals) ?? []).map((r) => `p:${r.id}`)
199
- ]), _ = (r) => ae.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", P = oe(() => {
204
+ ]), S = (r) => ne.has(r) ? "bg-nvr-cyan/10 transition-colors duration-700" : "transition-colors duration-700", P = J(() => {
200
205
  const r = /* @__PURE__ */ new Set();
201
206
  for (const s of (a == null ? void 0 : a.owned) ?? []) s.collection && r.add(s.collection);
202
207
  return [...r];
203
- }, [a]);
204
- J(() => {
205
- if (!(!W || P.length === 0))
206
- return W.subscribeCollections(P, () => {
207
- const r = Date.now();
208
- r - Z.current < 3e4 || (Z.current = r, O(!0));
208
+ }, [a]), se = W(/* @__PURE__ */ new Set());
209
+ se.current = new Set(((a == null ? void 0 : a.owned) ?? []).map((r) => `${r.collection}:${r.item}`));
210
+ const de = W(D);
211
+ de.current = D, V(() => {
212
+ if (!(!K || P.length === 0))
213
+ return K.subscribeCollections(P, (r) => {
214
+ ct(r, se.current) && de.current();
209
215
  });
210
- }, [W, P]);
211
- const ne = z({
216
+ }, [K, P]);
217
+ const oe = J(() => {
218
+ const r = (a == null ? void 0 : a.owned) ?? [], s = _ === "all" ? r : r.filter((h) => {
219
+ const c = Y(h.sla, L);
220
+ return _ === "soon" ? Z(c) : (c == null ? void 0 : c.status) === "breached";
221
+ });
222
+ return f ? s.filter((h) => f.keys.has(`${h.collection}:${h.item}`)) : s;
223
+ }, [a, _, L, f]), Q = Fe(oe, (r) => `${r.collection}:${r.item}`, {
224
+ resetKey: `${_}|${M ?? ""}`
225
+ }), ie = H({
212
226
  // A ticket closes through /support so its requester hears about it.
213
- mutationFn: (r) => fetch(`${c}/${r.kind === "support" ? "support/tickets" : "tasks"}/${r.id}`, {
227
+ mutationFn: (r) => fetch(`${l}/${r.kind === "support" ? "support/tickets" : "tasks"}/${r.id}`, {
214
228
  method: "PATCH",
215
- headers: { ...y, "content-type": "application/json" },
216
- credentials: g,
229
+ headers: { ...g, "content-type": "application/json" },
230
+ credentials: k,
217
231
  body: JSON.stringify({ status: "done" })
218
232
  }),
219
233
  onSuccess: () => v.invalidateQueries({ queryKey: ["my-work"] })
220
- }), M = z({
234
+ }), q = H({
221
235
  mutationFn: async ({ id: r, action: s }) => {
222
- const h = await fetch(`${c}/tasks/${r}/${s}`, {
236
+ const h = await fetch(`${l}/tasks/${r}/${s}`, {
223
237
  method: "POST",
224
- headers: { ...y, "content-type": "application/json" },
225
- credentials: g,
238
+ headers: { ...g, "content-type": "application/json" },
239
+ credentials: k,
226
240
  body: "{}"
227
- }), m = await h.json().catch(() => ({}));
228
- if (!h.ok) throw new Error(m.error ?? "Failed");
241
+ }), c = await h.json().catch(() => ({}));
242
+ if (!h.ok) throw new Error(c.error ?? "Failed");
229
243
  return s;
230
244
  },
231
245
  onSuccess: (r) => {
232
- Q(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), v.invalidateQueries({ queryKey: ["my-work"] });
246
+ B(r === "claim" ? "It’s yours — it moved to My tasks." : "Reminder sent."), v.invalidateQueries({ queryKey: ["my-work"] });
233
247
  },
234
- onError: (r) => Q(We(r, "Failed"))
235
- }), [A, Q] = S(null);
236
- J(() => {
237
- if (!A) return;
238
- const r = setTimeout(() => Q(null), 4e3);
248
+ onError: (r) => B(Qe(r, "Failed"))
249
+ }), [F, B] = O(null);
250
+ V(() => {
251
+ if (!F) return;
252
+ const r = setTimeout(() => B(null), 4e3);
239
253
  return () => clearTimeout(r);
240
- }, [A]);
241
- const se = z({
242
- mutationFn: (r) => fetch(`${c}/notifications/mark-read`, {
254
+ }, [F]);
255
+ const le = H({
256
+ mutationFn: (r) => fetch(`${l}/notifications/mark-read`, {
243
257
  method: "POST",
244
- headers: { ...y, "content-type": "application/json" },
245
- credentials: g,
258
+ headers: { ...g, "content-type": "application/json" },
259
+ credentials: k,
246
260
  body: JSON.stringify({ ids: r })
247
261
  }),
248
262
  onSuccess: () => {
249
263
  v.invalidateQueries({ queryKey: ["my-work"] }), v.invalidateQueries({ queryKey: ["notifications"] });
250
264
  }
251
- }), C = (r, s, h, m) => {
252
- if (r && s && le(r)) {
253
- const l = (m ?? []).filter((d) => d.collection && d.item && le(d.collection)).map((d) => ({ collection: d.collection, itemId: String(d.item) }));
254
- if (w({ collection: r, itemId: String(s) }, h, { list: l }) !== "navigate")
265
+ }), C = (r, s, h, c) => {
266
+ if (r && s && pe(r)) {
267
+ const m = (c ?? []).filter((o) => o.collection && o.item && pe(o.collection)).map((o) => ({ collection: o.collection, itemId: String(o.item) }));
268
+ if (w({ collection: r, itemId: String(s) }, h, { list: m }) !== "navigate")
255
269
  return;
256
270
  }
257
271
  const b = {
258
- record: (l, d) => (p({ collection: l, itemId: d }), null),
259
- ...o
260
- }, t = ie(r, s, {
272
+ record: (m, o) => (p({ collection: m, itemId: o }), null),
273
+ ...d
274
+ }, t = ue(r, s, {
261
275
  ...b,
262
- record: (l, d) => {
276
+ record: (m, o) => {
263
277
  var N;
264
- return ((N = o == null ? void 0 : o.record) == null ? void 0 : N.call(o, l, d)) ?? null;
278
+ return ((N = d == null ? void 0 : d.record) == null ? void 0 : N.call(d, m, o)) ?? null;
265
279
  }
266
280
  });
267
281
  if (t) {
268
- De(t, (l) => u == null ? void 0 : u(l));
282
+ We(t, (m) => u == null ? void 0 : u(m));
269
283
  return;
270
284
  }
271
285
  r && s && !/^nivaro_/i.test(r) && r !== "__chat__" && p({ collection: r, itemId: s });
272
- }, we = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!ie(r, s, {
286
+ }, ve = (r, s) => r && s && !/^nivaro_/i.test(r) && r !== "__chat__" ? !0 : !!ue(r, s, {
273
287
  record: () => null,
274
- ...o
288
+ ...d
275
289
  });
276
- return ye || !a ? /* @__PURE__ */ e(lt, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work": !0, children: [
277
- /* @__PURE__ */ e(Be, { onOpenPath: u }),
290
+ return we || !a ? /* @__PURE__ */ e(pt, { order: x.order, hidden: x.hidden }) : /* @__PURE__ */ n("div", { className: "space-y-5 p-4 sm:p-6", "data-my-work": !0, children: [
291
+ /* @__PURE__ */ e(Je, { onOpenPath: u }),
278
292
  /* @__PURE__ */ n("div", { className: "flex flex-col-reverse gap-3 sm:flex-row sm:items-start sm:justify-between", children: [
279
293
  /* @__PURE__ */ n("div", { className: "grid min-w-0 flex-1 grid-cols-2 gap-3 lg:grid-cols-4", children: [
280
294
  /* @__PURE__ */ e(U, { label: "Waiting on you", value: a.counts.owned }),
@@ -290,30 +304,14 @@ function Ft({
290
304
  /* @__PURE__ */ e(U, { label: "Unread notifications", value: a.counts.notifications })
291
305
  ] }),
292
306
  /* @__PURE__ */ n("div", { className: "flex shrink-0 flex-wrap items-center justify-end gap-2", children: [
293
- he && /* @__PURE__ */ n(
294
- "button",
295
- {
296
- type: "button",
297
- onClick: () => {
298
- O(!1), X();
299
- },
300
- className: "inline-flex items-center gap-1.5 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-3 py-1.5 text-[12px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
301
- children: [
302
- /* @__PURE__ */ e("span", { className: "h-1.5 w-1.5 animate-pulse rounded-full bg-nvr-cyan" }),
303
- "Updates available — refresh"
304
- ]
305
- }
306
- ),
307
307
  /* @__PURE__ */ e(
308
308
  "button",
309
309
  {
310
310
  type: "button",
311
- onClick: () => {
312
- O(!1), X();
313
- },
314
- disabled: ee,
311
+ onClick: () => void Ne(),
312
+ disabled: re,
315
313
  className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted disabled:opacity-50 dark:border-border",
316
- children: ee ? "Refreshing…" : "Refresh"
314
+ children: re ? "Refreshing…" : "Refresh"
317
315
  }
318
316
  ),
319
317
  /* @__PURE__ */ n("div", { className: "relative", children: [
@@ -321,17 +319,17 @@ function Ft({
321
319
  "button",
322
320
  {
323
321
  type: "button",
324
- onClick: () => ge((r) => !r),
322
+ onClick: () => ke((r) => !r),
325
323
  className: "rounded-md border border-slate-200 px-2.5 py-1.5 text-[12px] hover:bg-muted dark:border-border",
326
324
  children: "Customize"
327
325
  }
328
326
  ),
329
- xe && /* @__PURE__ */ n("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
327
+ fe && /* @__PURE__ */ n("div", { className: "absolute right-0 top-full z-20 mt-1 w-56 rounded-lg border border-slate-200 bg-white p-2 shadow-lg dark:border-border dark:bg-card", children: [
330
328
  /* @__PURE__ */ e("p", { className: "px-1 pb-1.5 text-[11px] font-semibold text-slate-500", children: "Sections" }),
331
329
  x.order.map((r, s) => {
332
- const h = ue[r] ?? r, m = x.hidden.includes(r), b = (t) => {
333
- const l = [...x.order], d = s + t;
334
- d < 0 || d >= l.length || ([l[s], l[d]] = [l[d], l[s]], Y({ ...x, order: l }));
330
+ const h = xe[r] ?? r, c = x.hidden.includes(r), b = (t) => {
331
+ const m = [...x.order], o = s + t;
332
+ o < 0 || o >= m.length || ([m[s], m[o]] = [m[o], m[s]], ee({ ...x, order: m }));
335
333
  };
336
334
  return /* @__PURE__ */ n(
337
335
  "div",
@@ -342,19 +340,19 @@ function Ft({
342
340
  "button",
343
341
  {
344
342
  type: "button",
345
- onClick: () => Y({
343
+ onClick: () => ee({
346
344
  ...x,
347
- hidden: m ? x.hidden.filter((t) => t !== r) : [...x.hidden, r]
345
+ hidden: c ? x.hidden.filter((t) => t !== r) : [...x.hidden, r]
348
346
  }),
349
347
  className: "flex h-4 w-4 items-center justify-center rounded border border-slate-300 text-[10px] dark:border-border",
350
- title: m ? "Show section" : "Hide section",
351
- children: m ? "" : "✓"
348
+ title: c ? "Show section" : "Hide section",
349
+ children: c ? "" : "✓"
352
350
  }
353
351
  ),
354
352
  /* @__PURE__ */ e(
355
353
  "span",
356
354
  {
357
- className: `min-w-0 flex-1 truncate text-[12px] ${m ? "text-slate-400 line-through" : ""}`,
355
+ className: `min-w-0 flex-1 truncate text-[12px] ${c ? "text-slate-400 line-through" : ""}`,
358
356
  children: h
359
357
  }
360
358
  ),
@@ -387,32 +385,32 @@ function Ft({
387
385
  ] })
388
386
  ] })
389
387
  ] }),
390
- A && /* @__PURE__ */ e(
388
+ F && /* @__PURE__ */ e(
391
389
  "p",
392
390
  {
393
391
  className: "rounded-md border border-slate-200 bg-white px-3 py-2 text-[12px] dark:border-border dark:bg-card",
394
392
  role: "status",
395
393
  "data-my-work-task-note": !0,
396
- children: A
394
+ children: F
397
395
  }
398
396
  ),
399
- /* @__PURE__ */ e(Ke, { questions: a.questions ?? [] }),
397
+ /* @__PURE__ */ e(He, { questions: a.questions ?? [] }),
400
398
  /* @__PURE__ */ e(
401
- Ye,
399
+ et,
402
400
  {
403
- showing: (k == null ? void 0 : k.userId) ?? null,
404
- onShow: (r) => G((s) => s === r.user_id ? null : r.user_id)
401
+ showing: (f == null ? void 0 : f.userId) ?? null,
402
+ onShow: (r) => te((s) => s === r.user_id ? null : r.user_id)
405
403
  }
406
404
  ),
407
- /* @__PURE__ */ e(Ge, { className: "mb-4" }),
408
- /* @__PURE__ */ e(Ze, { className: "mb-4" }),
405
+ /* @__PURE__ */ e(rt, { className: "mb-4" }),
406
+ /* @__PURE__ */ e(tt, { className: "mb-4" }),
409
407
  (() => {
410
408
  const r = {
411
409
  records: () => {
412
- const t = new Map(a.owned.map((i) => [i, dt(i.sla, ke)])), l = (i) => pe(t.get(i) ?? null), d = (i) => {
410
+ const t = new Map(a.owned.map((i) => [i, Y(i.sla, L)])), m = (i) => Z(t.get(i) ?? null), o = (i) => {
413
411
  var j;
414
412
  return ((j = t.get(i)) == null ? void 0 : j.status) === "breached";
415
- }, N = a.owned.filter(l).length, T = a.owned.filter(d).length, D = I === "soon" ? a.owned.filter(l) : I === "breached" ? a.owned.filter(d) : a.owned, K = k ? D.filter((i) => k.keys.has(`${i.collection}:${i.item}`)) : D, Ne = [
413
+ }, N = a.owned.filter(m).length, T = a.owned.filter(o).length, R = oe, _e = [
416
414
  { key: "all", label: `All (${a.owned.length})` },
417
415
  { key: "soon", label: `Due soon (${N})` },
418
416
  { key: "breached", label: `Breached (${T})` }
@@ -423,77 +421,88 @@ function Ft({
423
421
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Records whose current step resolves you as an owner — most urgent first." })
424
422
  ] }),
425
423
  a.owned.length > 0 && /* @__PURE__ */ n("div", { className: "flex flex-wrap items-center gap-1 border-b border-slate-100 px-4 py-2 dark:border-border/60", children: [
426
- /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: Ne.map((i) => /* @__PURE__ */ e(
424
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-1 rounded-lg bg-slate-100 p-1 dark:bg-muted", children: _e.map((i) => /* @__PURE__ */ e(
427
425
  "button",
428
426
  {
429
427
  type: "button",
430
428
  "data-my-work-sla-filter": i.key,
431
- "aria-pressed": I === i.key,
432
- onClick: () => fe(i.key),
429
+ "aria-pressed": _ === i.key,
430
+ onClick: () => ye(i.key),
433
431
  className: [
434
432
  "rounded-md px-2.5 py-1 text-[11px] font-medium transition-colors duration-150",
435
- I === i.key ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
433
+ _ === i.key ? "bg-white text-slate-900 shadow-sm dark:bg-card dark:text-foreground" : "text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200"
436
434
  ].join(" "),
437
435
  children: i.label
438
436
  },
439
437
  i.key
440
438
  )) }),
441
- k && /* @__PURE__ */ n(
439
+ f && /* @__PURE__ */ n(
442
440
  "button",
443
441
  {
444
442
  type: "button",
445
443
  "data-my-work-cover-filter": !0,
446
- onClick: () => G(null),
447
- "aria-label": `Show all records, not only ${k.name}'s`,
444
+ onClick: () => te(null),
445
+ "aria-label": `Show all records, not only ${f.name}'s`,
448
446
  className: "ml-1 inline-flex items-center gap-1 rounded-full border border-nvr-cyan/40 bg-nvr-cyan/10 px-2.5 py-1 text-[11px] font-medium text-[#0e7490] hover:bg-nvr-cyan/20 dark:text-[#67e8f9]",
449
447
  children: [
450
- k.name,
448
+ f.name,
451
449
  "'s records",
452
450
  /* @__PURE__ */ e("span", { "aria-hidden": !0, className: "text-[12px] leading-none", children: "×" })
453
451
  ]
454
452
  }
455
453
  )
456
454
  ] }),
457
- K.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-6 text-center text-[12.5px] text-muted-foreground", children: a.owned.length === 0 ? "Nothing is waiting on you. Enjoy it." : "Nothing matches this filter." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: K.map((i) => {
458
- var j, de;
459
- return /* @__PURE__ */ e(
460
- "li",
461
- {
462
- className: _(`o:${i.collection}:${i.item}`),
463
- "data-my-work-fresh": ae.has(`o:${i.collection}:${i.item}`) || void 0,
464
- children: /* @__PURE__ */ n(
465
- "button",
455
+ Q.rows.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-6 text-center text-[12.5px] text-muted-foreground", children: a.owned.length === 0 ? "Nothing is waiting on you. Enjoy it." : "Nothing matches this filter." }) : /* @__PURE__ */ e(
456
+ "ul",
457
+ {
458
+ ref: Q.containerRef,
459
+ className: "divide-y divide-slate-100 dark:divide-border/60",
460
+ children: Q.rows.map(({ row: i, state: j }) => {
461
+ var ce, me;
462
+ return /* @__PURE__ */ e(
463
+ "li",
466
464
  {
467
- type: "button",
468
- onClick: (B) => C(i.collection, i.item, B, K),
469
- ...R.record(i.collection, i.item),
470
- className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
471
- children: [
472
- /* @__PURE__ */ e("span", { className: "min-w-[6.5rem] flex-1 truncate text-[12.5px] font-medium", children: i.label }),
473
- /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: i.collection.replace(/_/g, " ") }),
474
- ((j = i.flags) == null ? void 0 : j.some((B) => /^on hold$/i.test(B.name.trim()))) && /* @__PURE__ */ e(
475
- "span",
476
- {
477
- "data-my-work-hold": !0,
478
- className: "shrink-0 rounded-full bg-amber-500/15 px-1.5 py-px text-[10.5px] font-semibold text-amber-800 dark:text-amber-300",
479
- children: "On hold"
480
- }
481
- ),
482
- /* @__PURE__ */ e(
483
- it,
484
- {
485
- state: i.state_label || ((de = i.state) == null ? void 0 : de.replace(/_/g, " ")) || null,
486
- color: i.state_color
487
- }
488
- ),
489
- /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(ot, { sla: t.get(i) ?? null }) })
490
- ]
491
- }
492
- )
493
- },
494
- `${i.collection}:${i.item}`
495
- );
496
- }) })
465
+ className: I(
466
+ S(`o:${i.collection}:${i.item}`),
467
+ j === "departed" && "opacity-50"
468
+ ),
469
+ "data-my-work-fresh": ne.has(`o:${i.collection}:${i.item}`) || void 0,
470
+ "data-my-work-departed": j === "departed" || void 0,
471
+ children: /* @__PURE__ */ n(
472
+ "button",
473
+ {
474
+ type: "button",
475
+ onClick: (z) => C(i.collection, i.item, z, R),
476
+ ...G.record(i.collection, i.item),
477
+ className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-muted",
478
+ children: [
479
+ /* @__PURE__ */ e("span", { className: "min-w-[6.5rem] flex-1 truncate text-[12.5px] font-medium", children: i.label }),
480
+ /* @__PURE__ */ e("span", { className: "hidden text-[11px] text-muted-foreground sm:inline", children: i.collection.replace(/_/g, " ") }),
481
+ ((ce = i.flags) == null ? void 0 : ce.some((z) => /^on hold$/i.test(z.name.trim()))) && /* @__PURE__ */ e(
482
+ "span",
483
+ {
484
+ "data-my-work-hold": !0,
485
+ className: "shrink-0 rounded-full bg-amber-500/15 px-1.5 py-px text-[10.5px] font-semibold text-amber-800 dark:text-amber-300",
486
+ children: "On hold"
487
+ }
488
+ ),
489
+ /* @__PURE__ */ e(
490
+ ut,
491
+ {
492
+ state: i.state_label || ((me = i.state) == null ? void 0 : me.replace(/_/g, " ")) || null,
493
+ color: i.state_color
494
+ }
495
+ ),
496
+ /* @__PURE__ */ e("span", { className: "shrink-0", children: /* @__PURE__ */ e(mt, { sla: t.get(i) ?? Y(i.sla, L) }) })
497
+ ]
498
+ }
499
+ )
500
+ },
501
+ `${i.collection}:${i.item}`
502
+ );
503
+ })
504
+ }
505
+ )
497
506
  ] });
498
507
  },
499
508
  // Idea 6 — only when something waits on this person's decision.
@@ -507,12 +516,12 @@ function Ft({
507
516
  /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Changes to review" }),
508
517
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Proposed changes on locked records — open one to compare old and new and accept or decline it." })
509
518
  ] }),
510
- /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((t) => /* @__PURE__ */ e("li", { className: _(`p:${t.id}`), "data-my-work-proposal": t.id, children: /* @__PURE__ */ n(
519
+ /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.proposals ?? []).map((t) => /* @__PURE__ */ e("li", { className: S(`p:${t.id}`), "data-my-work-proposal": t.id, children: /* @__PURE__ */ n(
511
520
  "button",
512
521
  {
513
522
  type: "button",
514
523
  onClick: () => C(t.collection, t.item),
515
- ...R.record(t.collection, t.item),
524
+ ...G.record(t.collection, t.item),
516
525
  className: "flex w-full items-start gap-2.5 px-4 py-2 text-left hover:bg-muted",
517
526
  children: [
518
527
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
@@ -526,7 +535,7 @@ function Ft({
526
535
  t.reason
527
536
  ] })
528
537
  ] }),
529
- /* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children: Qe(t.created_at) })
538
+ /* @__PURE__ */ e("span", { className: "shrink-0 pt-0.5 text-[11px] text-muted-foreground", children: ze(t.created_at) })
530
539
  ]
531
540
  }
532
541
  ) }, t.id)) })
@@ -538,15 +547,15 @@ function Ft({
538
547
  a.tasks.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "No open tasks." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.tasks.map((t) => /* @__PURE__ */ n(
539
548
  "li",
540
549
  {
541
- className: q("flex items-center gap-2.5 px-4 py-2", _(`t:${t.id}`)),
550
+ className: I("flex items-center gap-2.5 px-4 py-2", S(`t:${t.id}`)),
542
551
  children: [
543
552
  /* @__PURE__ */ e(
544
553
  "button",
545
554
  {
546
555
  type: "button",
547
556
  title: "Mark done",
548
- onClick: () => ne.mutate(t),
549
- disabled: ne.isPending,
557
+ onClick: () => ie.mutate(t),
558
+ disabled: ie.isPending,
550
559
  className: "flex h-4 w-4 shrink-0 items-center justify-center rounded border border-slate-300 text-transparent hover:border-emerald-500 hover:text-emerald-500 dark:border-border",
551
560
  children: "✓"
552
561
  }
@@ -560,7 +569,7 @@ function Ft({
560
569
  "data-tip": `Handed to ${t.agent_name ?? "your agent"} — it picks this up through My Work`,
561
570
  "data-my-work-agent-task": t.id,
562
571
  children: [
563
- /* @__PURE__ */ e(Se, { className: "h-3 w-3", "aria-hidden": !0 }),
572
+ /* @__PURE__ */ e(Te, { className: "h-3 w-3", "aria-hidden": !0 }),
564
573
  t.agent_name ?? "Agent"
565
574
  ]
566
575
  }
@@ -569,7 +578,7 @@ function Ft({
569
578
  "button",
570
579
  {
571
580
  type: "button",
572
- onClick: (l) => t.kind === "support" ? V(t.id) : C(t.collection, t.item, l),
581
+ onClick: (m) => t.kind === "support" ? X(t.id) : C(t.collection, t.item, m),
573
582
  className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
574
583
  children: [
575
584
  t.title,
@@ -578,7 +587,7 @@ function Ft({
578
587
  }
579
588
  ),
580
589
  /* @__PURE__ */ e(
581
- ze,
590
+ Ve,
582
591
  {
583
592
  task: t,
584
593
  isAssignee: !0,
@@ -589,7 +598,7 @@ function Ft({
589
598
  t.due_date && /* @__PURE__ */ e(
590
599
  "span",
591
600
  {
592
- className: `text-[11px] tabular-nums ${F(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
601
+ className: `text-[11px] tabular-nums ${E(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
593
602
  children: new Date(t.due_date).toLocaleDateString(void 0, { timeZone: "UTC" })
594
603
  }
595
604
  )
@@ -611,7 +620,7 @@ function Ft({
611
620
  (a.team_tasks ?? []).length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "Nothing waiting with your teams." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: (a.team_tasks ?? []).map((t) => /* @__PURE__ */ n(
612
621
  "li",
613
622
  {
614
- className: q("flex items-center gap-2.5 px-4 py-2", _(`tt:${t.id}`)),
623
+ className: I("flex items-center gap-2.5 px-4 py-2", S(`tt:${t.id}`)),
615
624
  "data-my-work-team-task": t.id,
616
625
  children: [
617
626
  t.priority === "urgent" && /* @__PURE__ */ e("span", { className: "shrink-0 rounded bg-red-500/10 px-1 py-px text-[9.5px] font-semibold uppercase tracking-wide text-red-600 dark:text-red-400", children: "urgent" }),
@@ -619,7 +628,7 @@ function Ft({
619
628
  "button",
620
629
  {
621
630
  type: "button",
622
- onClick: (l) => C(t.collection, t.item, l),
631
+ onClick: (m) => C(t.collection, t.item, m),
623
632
  className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
624
633
  children: [
625
634
  t.title,
@@ -630,7 +639,7 @@ function Ft({
630
639
  t.due_date && /* @__PURE__ */ e(
631
640
  "span",
632
641
  {
633
- className: `text-[11px] tabular-nums ${F(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
642
+ className: `text-[11px] tabular-nums ${E(t.due_date) ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
634
643
  children: new Date(t.due_date).toLocaleDateString(void 0, {
635
644
  timeZone: "UTC"
636
645
  })
@@ -640,8 +649,8 @@ function Ft({
640
649
  "button",
641
650
  {
642
651
  type: "button",
643
- onClick: () => M.mutate({ id: t.id, action: "claim" }),
644
- disabled: M.isPending,
652
+ onClick: () => q.mutate({ id: t.id, action: "claim" }),
653
+ disabled: q.isPending,
645
654
  className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted dark:border-border",
646
655
  "data-my-work-claim": t.id,
647
656
  children: "Pick it up"
@@ -655,7 +664,7 @@ function Ft({
655
664
  }
656
665
  ),
657
666
  waiting: () => {
658
- const t = a.requested ?? [], l = t.filter((d) => F(d.due_date)).length;
667
+ const t = a.requested ?? [], m = t.filter((o) => E(o.due_date)).length;
659
668
  return /* @__PURE__ */ n(
660
669
  "section",
661
670
  {
@@ -665,63 +674,63 @@ function Ft({
665
674
  /* @__PURE__ */ n("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: [
666
675
  /* @__PURE__ */ n("h2", { className: "text-[13px] font-medium", children: [
667
676
  "Waiting on others",
668
- l > 0 && /* @__PURE__ */ n("span", { className: "ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
669
- l,
677
+ m > 0 && /* @__PURE__ */ n("span", { className: "ml-2 rounded bg-red-500/10 px-1.5 py-0.5 text-[10.5px] font-semibold text-red-600 dark:text-red-400", children: [
678
+ m,
670
679
  " overdue"
671
680
  ] })
672
681
  ] }),
673
682
  /* @__PURE__ */ e("p", { className: "text-[11px] text-muted-foreground", children: "Tasks you asked someone else to do." })
674
683
  ] }),
675
- t.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You are not waiting on anyone." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: t.map((d) => {
676
- const N = F(d.due_date), T = !!d.nudged_at && Date.now() - new Date(d.nudged_at).getTime() < 20 * 36e5;
684
+ t.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You are not waiting on anyone." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: t.map((o) => {
685
+ const N = E(o.due_date), T = !!o.nudged_at && Date.now() - new Date(o.nudged_at).getTime() < 20 * 36e5;
677
686
  return /* @__PURE__ */ n(
678
687
  "li",
679
688
  {
680
- className: q("flex items-center gap-2.5 px-4 py-2", _(`r:${d.id}`)),
681
- "data-my-work-requested": d.id,
689
+ className: I("flex items-center gap-2.5 px-4 py-2", S(`r:${o.id}`)),
690
+ "data-my-work-requested": o.id,
682
691
  children: [
683
692
  /* @__PURE__ */ n(
684
693
  "button",
685
694
  {
686
695
  type: "button",
687
- onClick: (D) => d.kind === "support" ? V(d.id) : C(d.collection, d.item, D),
696
+ onClick: (R) => o.kind === "support" ? X(o.id) : C(o.collection, o.item, R),
688
697
  className: "min-w-0 flex-1 truncate text-left text-[12.5px] hover:underline",
689
698
  children: [
690
- d.title,
699
+ o.title,
691
700
  /* @__PURE__ */ e("span", { className: "ml-1.5 text-[11px] text-muted-foreground", children: [
692
- d.assignee_name ?? (d.team_name ? `${d.team_name} team` : "Unassigned"),
693
- d.item_label
701
+ o.assignee_name ?? (o.team_name ? `${o.team_name} team` : "Unassigned"),
702
+ o.item_label
694
703
  ].filter(Boolean).join(" · ") })
695
704
  ]
696
705
  }
697
706
  ),
698
- d.due_date && /* @__PURE__ */ n(
707
+ o.due_date && /* @__PURE__ */ n(
699
708
  "span",
700
709
  {
701
710
  className: `text-[11px] tabular-nums ${N ? "font-medium text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
702
711
  children: [
703
712
  N ? "Overdue · " : "",
704
- new Date(d.due_date).toLocaleDateString(void 0, {
713
+ new Date(o.due_date).toLocaleDateString(void 0, {
705
714
  timeZone: "UTC"
706
715
  })
707
716
  ]
708
717
  }
709
718
  ),
710
- d.kind !== "support" && /* @__PURE__ */ e(
719
+ o.kind !== "support" && /* @__PURE__ */ e(
711
720
  "button",
712
721
  {
713
722
  type: "button",
714
- onClick: () => M.mutate({ id: d.id, action: "nudge" }),
715
- disabled: M.isPending || T,
723
+ onClick: () => q.mutate({ id: o.id, action: "nudge" }),
724
+ disabled: q.isPending || T,
716
725
  title: T ? "Already nudged today" : "Send a reminder",
717
726
  className: "shrink-0 rounded-md border border-slate-200 px-2 py-0.5 text-[11px] font-medium hover:bg-muted disabled:opacity-50 dark:border-border",
718
- "data-my-work-nudge": d.id,
727
+ "data-my-work-nudge": o.id,
719
728
  children: T ? "Nudged" : "Nudge"
720
729
  }
721
730
  )
722
731
  ]
723
732
  },
724
- d.id
733
+ o.id
725
734
  );
726
735
  }) })
727
736
  ]
@@ -735,7 +744,7 @@ function Ft({
735
744
  "button",
736
745
  {
737
746
  type: "button",
738
- onClick: () => se.mutate(a.notifications.map((t) => t.id)),
747
+ onClick: () => le.mutate(a.notifications.map((t) => t.id)),
739
748
  className: "text-[11px] text-[#00a5cc] hover:underline",
740
749
  children: "Mark all read"
741
750
  }
@@ -744,21 +753,21 @@ function Ft({
744
753
  a.notifications.length === 0 ? /* @__PURE__ */ e("p", { className: "px-4 py-5 text-center text-[12.5px] text-muted-foreground", children: "You're all caught up." }) : /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: a.notifications.map((t) => /* @__PURE__ */ n(
745
754
  "li",
746
755
  {
747
- className: q("flex items-start gap-2.5 px-4 py-2", _(`n:${t.id}`)),
756
+ className: I("flex items-start gap-2.5 px-4 py-2", S(`n:${t.id}`)),
748
757
  children: [
749
758
  /* @__PURE__ */ e(
750
- rt,
759
+ dt,
751
760
  {
752
761
  userId: t.sender,
753
762
  className: "mt-0.5 h-5 w-5",
754
763
  fallback: /* @__PURE__ */ e("span", { className: "mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-slate-100 text-[9px] font-semibold text-slate-500 dark:bg-muted" })
755
764
  }
756
765
  ),
757
- we(t.collection, t.item) ? /* @__PURE__ */ n(
766
+ ve(t.collection, t.item) ? /* @__PURE__ */ n(
758
767
  "button",
759
768
  {
760
769
  type: "button",
761
- onClick: (l) => C(t.collection, t.item, l, a.notifications),
770
+ onClick: (m) => C(t.collection, t.item, m, a.notifications),
762
771
  className: "min-w-0 flex-1 cursor-pointer text-left hover:opacity-80",
763
772
  children: [
764
773
  /* @__PURE__ */ e("p", { className: "truncate text-[12.5px] font-medium", children: t.subject }),
@@ -778,9 +787,9 @@ function Ft({
778
787
  type: "button",
779
788
  "aria-label": "Mark read",
780
789
  "data-tip": "Mark read",
781
- onClick: () => se.mutate([t.id]),
790
+ onClick: () => le.mutate([t.id]),
782
791
  className: "mt-0.5 shrink-0 rounded p-1 text-slate-400 hover:bg-slate-100 hover:text-slate-700 dark:hover:bg-muted dark:hover:text-slate-200",
783
- children: /* @__PURE__ */ e(Ce, { className: "h-3 w-3" })
792
+ children: /* @__PURE__ */ e($e, { className: "h-3 w-3" })
784
793
  }
785
794
  )
786
795
  ]
@@ -790,59 +799,60 @@ function Ft({
790
799
  ] })
791
800
  }, s = new Map(
792
801
  x.order.filter((t) => !x.hidden.includes(t) && r[t]).map((t) => [t, r[t]()]).filter(([, t]) => t != null)
793
- ), h = [...s.keys()], m = [];
802
+ ), h = [...s.keys()], c = [];
794
803
  let b = 0;
795
804
  for (; b < h.length; ) {
796
805
  const t = h[b];
797
- if (me.has(t))
798
- m.push(
806
+ if (be.has(t))
807
+ c.push(
799
808
  /* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(t) }, t)
800
809
  ), b++;
801
810
  else {
802
- const l = [t];
803
- b + 1 < h.length && !me.has(h[b + 1]) && l.push(h[b + 1]), m.push(
804
- /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: l.map((d) => /* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(d) }, d)) }, l.join("+"))
805
- ), b += l.length;
811
+ const m = [t];
812
+ b + 1 < h.length && !be.has(h[b + 1]) && m.push(h[b + 1]), c.push(
813
+ /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-5 lg:grid-cols-2", children: m.map((o) => /* @__PURE__ */ e("div", { className: "min-w-0", children: s.get(o) }, o)) }, m.join("+"))
814
+ ), b += m.length;
806
815
  }
807
816
  }
808
- return m;
817
+ return c;
809
818
  })(),
810
- /* @__PURE__ */ e(ct, {})
819
+ /* @__PURE__ */ e(ht, {})
811
820
  ] });
812
821
  }
813
- function ct() {
814
- const o = Je(), { rooms: u } = Re(o);
815
- return !o || u.length === 0 ? null : /* @__PURE__ */ n(
822
+ function ht() {
823
+ const d = Ze(), { rooms: u } = Ge(d);
824
+ return !d || u.length === 0 ? null : /* @__PURE__ */ n(
816
825
  "section",
817
826
  {
818
827
  className: "rounded-lg border border-slate-200 bg-white dark:border-border dark:bg-card",
819
828
  "data-my-work-chat": !0,
820
829
  children: [
821
830
  /* @__PURE__ */ e("div", { className: "border-b border-slate-200 px-4 py-2.5 dark:border-border", children: /* @__PURE__ */ e("h2", { className: "text-[13px] font-medium", children: "Record conversations" }) }),
822
- /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((c) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
831
+ /* @__PURE__ */ e("ul", { className: "divide-y divide-slate-100 dark:divide-border/60", children: u.map((l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ n(
823
832
  "button",
824
833
  {
825
834
  type: "button",
826
- onClick: () => He(c.room, c.label),
835
+ onClick: () => Ye(l.room, l.label),
827
836
  className: "flex w-full items-center gap-2.5 px-4 py-2 text-left hover:bg-slate-50 dark:hover:bg-muted/40",
828
- "data-my-work-chat-room": c.room,
837
+ "data-my-work-chat-room": l.room,
829
838
  children: [
830
839
  /* @__PURE__ */ n("span", { className: "min-w-0 flex-1", children: [
831
- /* @__PURE__ */ e("span", { className: "block truncate text-[12.5px] font-medium", children: c.label }),
832
- c.last_message && /* @__PURE__ */ n("span", { className: "block truncate text-[11.5px] text-muted-foreground", children: [
833
- c.last_message.sender_name ? `${c.last_message.sender_name}: ` : "",
834
- c.last_message.message.replace(/@\[([^\]]+)\]/g, "@$1")
840
+ /* @__PURE__ */ e("span", { className: "block truncate text-[12.5px] font-medium", children: l.label }),
841
+ l.last_message && /* @__PURE__ */ n("span", { className: "block truncate text-[11.5px] text-muted-foreground", children: [
842
+ l.last_message.sender_name ? `${l.last_message.sender_name}: ` : "",
843
+ l.last_message.message.replace(/@\[([^\]]+)\]/g, "@$1")
835
844
  ] })
836
845
  ] }),
837
- c.mentions > 0 && /* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white", children: "@" }),
838
- /* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1.5 text-[10px] font-bold tabular-nums text-slate-600 dark:bg-muted dark:text-slate-300", children: c.unread > 99 ? "99+" : c.unread })
846
+ l.mentions > 0 && /* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-bold text-white", children: "@" }),
847
+ /* @__PURE__ */ e("span", { className: "flex h-5 min-w-5 items-center justify-center rounded-full bg-slate-100 px-1.5 text-[10px] font-bold tabular-nums text-slate-600 dark:bg-muted dark:text-slate-300", children: l.unread > 99 ? "99+" : l.unread })
839
848
  ]
840
849
  }
841
- ) }, c.room)) })
850
+ ) }, l.room)) })
842
851
  ]
843
852
  }
844
853
  );
845
854
  }
846
855
  export {
847
- Ft as MyWorkView
856
+ Pt as MyWorkView,
857
+ ct as touchesOnScreen
848
858
  };