@nivaro/react 0.3.64 → 0.3.66

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 (74) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +62 -8
  4. package/dist/shared/components/CollectionBrowserView.js +3127 -3204
  5. package/dist/shared/components/ConformanceView.js +235 -221
  6. package/dist/shared/components/DataTable.js +478 -459
  7. package/dist/shared/components/ItemEditForm.js +4842 -4500
  8. package/dist/shared/components/MyWorkView.js +124 -113
  9. package/dist/shared/components/PageRenderer.js +146 -138
  10. package/dist/shared/components/ProfileView.js +483 -472
  11. package/dist/shared/components/RecordDrilldownSheet.js +73 -65
  12. package/dist/shared/components/ReportView.js +1100 -1094
  13. package/dist/shared/components/bulk/BulkActionButtons.js +72 -72
  14. package/dist/shared/components/bulk/BulkCompareButton.js +62 -0
  15. package/dist/shared/components/bulk/BulkFieldUpdate.js +114 -103
  16. package/dist/shared/components/bulk/BulkFieldUpdateButton.js +73 -0
  17. package/dist/shared/components/bulk/MessageStakeholders.js +235 -0
  18. package/dist/shared/components/bulk/bulk-field-options.js +29 -23
  19. package/dist/shared/components/integrations/IntegrationObligationsView.js +191 -173
  20. package/dist/shared/components/integrations/IntegrationStatusLines.js +101 -85
  21. package/dist/shared/components/integrations/RecordIntegrationPreview.js +11 -9
  22. package/dist/shared/components/integrations/SendCurrentData.js +126 -0
  23. package/dist/shared/components/item-edit/CatalogPickerField.js +1535 -1440
  24. package/dist/shared/components/item-edit/FieldRenderer.js +49 -45
  25. package/dist/shared/components/item-edit/FieldRow.js +413 -403
  26. package/dist/shared/components/item-edit/GroupSection.js +555 -538
  27. package/dist/shared/components/item-edit/InlineTableField.js +2903 -2816
  28. package/dist/shared/components/item-edit/M2MCombobox.js +407 -338
  29. package/dist/shared/components/item-edit/MidairCollisionDialog.js +367 -116
  30. package/dist/shared/components/item-edit/NestedRelationEditor.js +171 -163
  31. package/dist/shared/components/item-edit/PlanGrid.js +783 -724
  32. package/dist/shared/components/item-edit/QuickCreateButton.js +291 -224
  33. package/dist/shared/components/item-edit/RecordInsights.js +113 -111
  34. package/dist/shared/components/item-edit/RecordLiveSync.js +4 -1
  35. package/dist/shared/components/item-edit/RelationCombobox.js +398 -364
  36. package/dist/shared/components/item-edit/SummaryPanel.js +146 -144
  37. package/dist/shared/components/item-edit/UserChip.js +264 -229
  38. package/dist/shared/components/item-edit/cascade-clear-notice.js +56 -0
  39. package/dist/shared/components/item-edit/collision-format.js +37 -0
  40. package/dist/shared/components/item-edit/field-a11y.js +25 -0
  41. package/dist/shared/components/item-edit/header-path-preview.js +52 -0
  42. package/dist/shared/components/item-edit/line-merge.js +84 -0
  43. package/dist/shared/components/item-edit/line-midair.js +94 -87
  44. package/dist/shared/components/item-edit/move-guard.js +17 -0
  45. package/dist/shared/components/item-edit/picker-search.js +27 -16
  46. package/dist/shared/components/item-edit/rail-width.js +8 -0
  47. package/dist/shared/components/monitoring/InactiveUserLinksView.js +126 -124
  48. package/dist/shared/components/panels/AccessDeniedPanel.js +96 -55
  49. package/dist/shared/components/panels/CommentPanel.js +142 -136
  50. package/dist/shared/components/panels/ItemLockBanner.js +246 -240
  51. package/dist/shared/components/panels/PipelinePanel.js +1366 -1194
  52. package/dist/shared/components/panels/RevisionsPanel.js +106 -102
  53. package/dist/shared/components/panels/SlaBreachBanner.js +16 -20
  54. package/dist/shared/components/panels/SlaClock.js +90 -68
  55. package/dist/shared/components/queue/QueueItemSheet.js +94 -87
  56. package/dist/shared/components/queue/QueueWorklist.js +1522 -1347
  57. package/dist/shared/components/queue/worklist-csv.js +75 -0
  58. package/dist/shared/components/queue/worklist-helpers.js +20 -0
  59. package/dist/shared/components/widgets/ReviewListWidget.js +226 -207
  60. package/dist/shared/lib/bulk-copy.js +17 -0
  61. package/dist/shared/lib/cbv-export.js +122 -0
  62. package/dist/shared/lib/delete-offer.js +13 -0
  63. package/dist/shared/lib/error-hints.js +1 -0
  64. package/dist/shared/lib/leave-guard.js +41 -26
  65. package/dist/shared/lib/list-link.js +72 -56
  66. package/dist/shared/lib/live-queries.js +32 -30
  67. package/dist/shared/lib/moved-notice.js +25 -0
  68. package/dist/shared/lib/notification-target.js +56 -54
  69. package/dist/shared/lib/obligation-banner.js +11 -8
  70. package/dist/shared/lib/obligation-reason-text.js +6 -6
  71. package/dist/shared/lib/quick-filter-cascade.js +29 -19
  72. package/dist/shared/lib/sort-cycle.js +6 -0
  73. package/dist/shared/lib/summary-mode.js +59 -41
  74. package/package.json +1 -1
@@ -1,55 +1,56 @@
1
1
  import { jsxs as _, jsx as v } from "react/jsx-runtime";
2
2
  import { QueryClientContext as je } from "@tanstack/react-query";
3
- import { Lock as ue, LockOpen as ye } from "lucide-react";
3
+ import { Lock as ce, LockOpen as ye } from "lucide-react";
4
4
  import { useState as S, useEffect as x, useRef as C, useCallback as E, useContext as Be } from "react";
5
- import { toast as d } from "sonner";
5
+ import { toast as f } from "sonner";
6
6
  import { useNivaroClient as Qe, useItemEditAuth as Ue } from "../../context.js";
7
- import { post as D, get as Ve, del as H } from "../../lib/commands.js";
7
+ import { post as M, get as Ve, del as J } from "../../lib/commands.js";
8
8
  import { idleState as We } from "../../lib/idle.js";
9
- import { useOptionalRealtime as ge, updateTouches as He } from "../../lib/realtime.js";
10
- import { announceRecordTabs as Z, useRecordTabsSignal as Je } from "../../lib/record-tabs.js";
11
- import { noteTakeOverHold as ie } from "../item-edit/FieldAffordances.js";
12
- import { Button as M } from "../ui/button.js";
9
+ import { noteNamedMovedNotice as He, movedNoticeText as Je, movedNoticeId as Ge } from "../../lib/moved-notice.js";
10
+ import { useOptionalRealtime as ge, updateTouches as Xe } from "../../lib/realtime.js";
11
+ import { announceRecordTabs as ee, useRecordTabsSignal as Ze } from "../../lib/record-tabs.js";
12
+ import { noteTakeOverHold as ue } from "../item-edit/FieldAffordances.js";
13
+ import { Button as D } from "../ui/button.js";
13
14
  import { Popover as we, PopoverTrigger as xe, PopoverContent as _e } from "../ui/popover.js";
14
- const ee = 1e4, pe = 1500, Ge = 2e3, Xe = 5 * 6e4, Ze = 3e4, et = 6e4, tt = 15e3, Le = 1500, rt = 1e4;
15
+ const te = 1e4, pe = 1500, et = 2e3, tt = 5 * 6e4, rt = 3e4, nt = 6e4, at = 15e3, Le = 1500, st = 1e4;
15
16
  function Ee(e, t) {
16
17
  return e ? `${t ?? "Someone else"} took over editing — your changes are still here, but can’t be saved until they release it` : "Someone else started editing while you were away — your changes are still here, but can’t be saved until they release it";
17
18
  }
18
- function nt() {
19
+ function ot() {
19
20
  const [e, t] = S(!0);
20
21
  return x(() => {
21
22
  if (typeof window > "u" || typeof document > "u") return;
22
- let s = null, R = null, k = 0;
23
- const q = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, g = () => {
24
- R && clearInterval(R), R = null;
23
+ let s = null, N = null, h = 0;
24
+ const q = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, w = () => {
25
+ N && clearInterval(N), N = null;
25
26
  }, $ = (y) => y instanceof HTMLInputElement && y.type === "file", p = (y) => {
26
- $(y.target) && (k = Date.now() + Xe);
27
+ $(y.target) && (h = Date.now() + tt);
27
28
  }, o = (y) => {
28
- !$(y.target) || !k || (k = 0, q() || T());
29
+ !$(y.target) || !h || (h = 0, q() || T());
29
30
  }, T = () => {
30
31
  s && clearTimeout(s);
31
- const y = k - Date.now();
32
+ const y = h - Date.now();
32
33
  s = setTimeout(
33
34
  () => {
34
35
  if (s = null, !q()) {
35
- g(), t(!1);
36
+ w(), t(!1);
36
37
  return;
37
38
  }
38
- g(), R = setInterval(() => {
39
- q() || (g(), t(!1));
40
- }, Ge);
39
+ w(), N = setInterval(() => {
40
+ q() || (w(), t(!1));
41
+ }, et);
41
42
  },
42
43
  y > 0 ? Math.max(y, pe) : pe
43
44
  );
44
45
  }, c = () => {
45
- s && clearTimeout(s), s = null, k = 0, g(), t(!0);
46
+ s && clearTimeout(s), s = null, h = 0, w(), t(!0);
46
47
  };
47
48
  return window.addEventListener("blur", T), window.addEventListener("focus", c), document.addEventListener("click", p, !0), document.addEventListener("change", o, !0), document.addEventListener("cancel", o, !0), () => {
48
- window.removeEventListener("blur", T), window.removeEventListener("focus", c), document.removeEventListener("click", p, !0), document.removeEventListener("change", o, !0), document.removeEventListener("cancel", o, !0), s && clearTimeout(s), g();
49
+ window.removeEventListener("blur", T), window.removeEventListener("focus", c), document.removeEventListener("click", p, !0), document.removeEventListener("change", o, !0), document.removeEventListener("cancel", o, !0), s && clearTimeout(s), w();
49
50
  };
50
51
  }, []), e;
51
52
  }
52
- function at() {
53
+ function it() {
53
54
  const [e, t] = S(
54
55
  () => typeof document > "u" || document.visibilityState !== "hidden"
55
56
  );
@@ -58,274 +59,274 @@ function at() {
58
59
  return document.addEventListener("visibilitychange", s), () => document.removeEventListener("visibilitychange", s);
59
60
  }, []), e;
60
61
  }
61
- function yt(e, t, s, R = {}) {
62
- const { lazy: k = !1, active: q = !0, dirty: g } = R, $ = C(g);
63
- $.current = g;
64
- const p = E(() => k && $.current === !1, [k]), o = Qe(), { isAdmin: T, userId: c } = Ue(), y = Be(je), [Y, N] = S(null), [z, L] = S(!1), [B, le] = S(!1), [$e, Se] = S([]), [Re, Q] = S(null), [Ne, ce] = S(!1), [Ce, de] = S(""), [Te, te] = S(!1), [qe, fe] = S(!1), J = C(null), i = C(!1), A = C(!1), re = C(!1), ne = C(0), F = C(!1), U = C(null), V = C(null), W = C(null), G = C(!1), K = `${e ?? ""}:${t ?? ""}`, P = E(() => {
65
- W.current = null, G.current = !1, ie(K, !1);
66
- }, [K]), f = E(() => {
67
- J.current && (clearInterval(J.current), J.current = null);
68
- }, []), ae = E(
62
+ function _t(e, t, s, N = {}) {
63
+ const { lazy: h = !1, active: q = !0, dirty: w } = N, $ = C(w);
64
+ $.current = w;
65
+ const p = E(() => h && $.current === !1, [h]), o = Qe(), { isAdmin: T, userId: c } = Ue(), y = Be(je), [Y, R] = S(null), [K, L] = S(!1), [B, le] = S(!1), [$e, Se] = S([]), [Ne, Q] = S(null), [Re, de] = S(!1), [Ce, fe] = S(""), [Te, re] = S(!1), [qe, me] = S(!1), G = C(null), i = C(!1), I = C(!1), ne = C(!1), ae = C(0), F = C(!1), U = C(null), V = C(null), W = C(null), X = C(!1), P = `${e ?? ""}:${t ?? ""}`, j = E(() => {
66
+ W.current = null, X.current = !1, ue(P, !1);
67
+ }, [P]), m = E(() => {
68
+ G.current && (clearInterval(G.current), G.current = null);
69
+ }, []), se = E(
69
70
  (a) => {
70
- var r, u;
71
- const n = a, m = n.status ?? ((r = n.response) == null ? void 0 : r.status), l = ((u = n.response) == null ? void 0 : u.data) ?? n.response;
72
- return m !== 403 || (l == null ? void 0 : l.code) !== "EDIT_LOCKED" ? !1 : (f(), i.current = !1, L(!1), d.warning(l.error || "You can no longer edit this record — your edit lock was let go"), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, t] }), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance", e, t] }), !0);
71
+ var l, r;
72
+ const n = a, k = n.status ?? ((l = n.response) == null ? void 0 : l.status), u = ((r = n.response) == null ? void 0 : r.data) ?? n.response;
73
+ return k !== 403 || (u == null ? void 0 : u.code) !== "EDIT_LOCKED" ? !1 : (m(), i.current = !1, L(!1), f.warning(u.error || "You can no longer edit this record — your edit lock was let go"), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, t] }), y == null || y.invalidateQueries({ queryKey: ["pipeline-instance", e, t] }), !0);
73
74
  },
74
- [y, e, t, f]
75
- ), h = E(async () => {
75
+ [y, e, t, m]
76
+ ), b = E(async () => {
76
77
  var a, n;
77
78
  if (!e || !t || F.current) return !1;
78
79
  U.current = null, V.current = null;
79
80
  try {
80
81
  return await o.request(
81
- D(`/item-locks/${e}/${t}/lock`, { beat_ms: ee })
82
- ), i.current = !0, L(!0), te(!1), N(null), f(), J.current = setInterval(() => {
83
- const m = Math.max(
82
+ M(`/item-locks/${e}/${t}/lock`, { beat_ms: te })
83
+ ), i.current = !0, L(!0), re(!1), R(null), m(), G.current = setInterval(() => {
84
+ const k = Math.max(
84
85
  0,
85
86
  Math.floor((Date.now() - new Date(We().last_active).getTime()) / 1e3)
86
87
  );
87
88
  o.request(
88
- D(`/item-locks/${e}/${t}/heartbeat`, {
89
- idle_seconds: m,
90
- beat_ms: ee
89
+ M(`/item-locks/${e}/${t}/heartbeat`, {
90
+ idle_seconds: k,
91
+ beat_ms: te
91
92
  })
92
- ).then((l) => {
93
- if (!(l != null && l.idle_released)) return;
94
- f(), i.current = !1, L(!1), d.info(
93
+ ).then((u) => {
94
+ if (!(u != null && u.idle_released)) return;
95
+ m(), i.current = !1, L(!1), f.info(
95
96
  "Your edit lock was released after inactivity — it re-locks when you resume."
96
97
  );
97
- const r = () => {
98
- window.removeEventListener("pointerdown", r, !0), window.removeEventListener("keydown", r, !0), !p() && h();
98
+ const l = () => {
99
+ window.removeEventListener("pointerdown", l, !0), window.removeEventListener("keydown", l, !0), !p() && b();
99
100
  };
100
- window.addEventListener("pointerdown", r, !0), window.addEventListener("keydown", r, !0);
101
- }).catch((l) => {
102
- var he, be;
103
- const r = l, u = r.status ?? ((he = r.response) == null ? void 0 : he.status);
104
- if (ae(l) || u !== 404 && u !== 409) return;
105
- const b = ((be = r.response) == null ? void 0 : be.data) ?? r.response;
106
- if (u === 404 && !(b != null && b.locked_by) && (b == null ? void 0 : b.taken_over) === !0) {
107
- f(), i.current = !1, L(!1);
108
- const ve = b.taken_over_by_name ?? null;
109
- V.current = ve ?? "Someone else", d.warning(
101
+ window.addEventListener("pointerdown", l, !0), window.addEventListener("keydown", l, !0);
102
+ }).catch((u) => {
103
+ var H, be;
104
+ const l = u, r = l.status ?? ((H = l.response) == null ? void 0 : H.status);
105
+ if (se(u) || r !== 404 && r !== 409) return;
106
+ const d = ((be = l.response) == null ? void 0 : be.data) ?? l.response;
107
+ if (r === 404 && !(d != null && d.locked_by) && (d == null ? void 0 : d.taken_over) === !0) {
108
+ m(), i.current = !1, L(!1);
109
+ const ve = d.taken_over_by_name ?? null;
110
+ V.current = ve ?? "Someone else", f.warning(
110
111
  `${ve ?? "Someone else"} took over editing — your changes are still here; they save once you edit again`
111
112
  );
112
113
  return;
113
114
  }
114
- if (u === 404 && !(b != null && b.locked_by)) {
115
+ if (r === 404 && !(d != null && d.locked_by)) {
115
116
  if (p()) {
116
- f(), i.current = !1, L(!1);
117
+ m(), i.current = !1, L(!1);
117
118
  return;
118
119
  }
119
- h();
120
+ b();
120
121
  return;
121
122
  }
122
- f(), i.current = !1, L(!1), b != null && b.locked_by && (N({
123
- locked_by: b.locked_by,
124
- locked_by_name: b.locked_by_name ?? null
125
- }), d.warning(
126
- b.taken_over === !1 ? Ee(!1) : `${b.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
123
+ m(), i.current = !1, L(!1), d != null && d.locked_by && (R({
124
+ locked_by: d.locked_by,
125
+ locked_by_name: d.locked_by_name ?? null
126
+ }), f.warning(
127
+ d.taken_over === !1 ? Ee(!1) : `${d.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
127
128
  ));
128
129
  });
129
- }, ee), !0;
130
- } catch (m) {
131
- const l = m, r = l.status ?? ((a = l.response) == null ? void 0 : a.status), u = ((n = l.response) == null ? void 0 : n.data) ?? l.response;
132
- return U.current = r ?? null, V.current = (u == null ? void 0 : u.taken_over) === !0 ? u.locked_by_name ?? "Someone else" : null, ae(m) ? !1 : r === 404 ? (F.current = !0, f(), i.current = !1, L(!1), !1) : (r === 409 && (u != null && u.locked_by) && (i.current = !1, L(!1), N({
133
- locked_by: u.locked_by,
134
- locked_by_name: u.locked_by_name ?? null,
135
- ...typeof u.may_take_over == "boolean" ? { may_take_over: u.may_take_over } : {}
130
+ }, te), !0;
131
+ } catch (k) {
132
+ const u = k, l = u.status ?? ((a = u.response) == null ? void 0 : a.status), r = ((n = u.response) == null ? void 0 : n.data) ?? u.response;
133
+ return U.current = l ?? null, V.current = (r == null ? void 0 : r.taken_over) === !0 ? r.locked_by_name ?? "Someone else" : null, se(k) ? !1 : l === 404 ? (F.current = !0, m(), i.current = !1, L(!1), !1) : (l === 409 && (r != null && r.locked_by) && (i.current = !1, L(!1), R({
134
+ locked_by: r.locked_by,
135
+ locked_by_name: r.locked_by_name ?? null,
136
+ ...typeof r.may_take_over == "boolean" ? { may_take_over: r.may_take_over } : {}
136
137
  })), !1);
137
138
  }
138
- }, [o, e, t, f, ae, p]), w = E(async () => {
139
+ }, [o, e, t, m, se, p]), g = E(async () => {
139
140
  if (!(!e || !t))
140
141
  try {
141
142
  const a = await o.request(Ve(`/item-locks/${e}/${t}/lock`)), n = a == null ? void 0 : a.data;
142
143
  Se(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), Q(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
143
- const m = (n == null ? void 0 : n.is_mine) === !0 || !!c && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === c.toLowerCase(), l = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
144
+ const k = (n == null ? void 0 : n.is_mine) === !0 || !!c && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === c.toLowerCase(), u = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
144
145
  if (i.current) return;
145
- if (!(n != null && n.locked_by) || m) {
146
- N(null);
146
+ if (!(n != null && n.locked_by) || k) {
147
+ R(null);
147
148
  return;
148
149
  }
149
- N(
150
- (r) => r && r.locked_by === String(n.locked_by) ? {
151
- ...r,
152
- note: n.note ?? r.note ?? null,
153
- idle_minutes: n.locked_by_idle_minutes ?? r.idle_minutes ?? null,
154
- ...l
150
+ R(
151
+ (l) => l && l.locked_by === String(n.locked_by) ? {
152
+ ...l,
153
+ note: n.note ?? l.note ?? null,
154
+ idle_minutes: n.locked_by_idle_minutes ?? l.idle_minutes ?? null,
155
+ ...u
155
156
  } : {
156
157
  locked_by: String(n.locked_by),
157
158
  locked_by_name: n.locked_by_name ?? null,
158
159
  note: n.note ?? null,
159
160
  idle_minutes: n.locked_by_idle_minutes ?? null,
160
- ...l
161
+ ...u
161
162
  }
162
- ), te(!1);
163
+ ), re(!1);
163
164
  } catch (a) {
164
165
  (a == null ? void 0 : a.status) === 404 && (F.current = !0);
165
166
  }
166
- }, [o, e, t, c]), I = (Y == null ? void 0 : Y.locked_by) ?? null;
167
+ }, [o, e, t, c]), A = (Y == null ? void 0 : Y.locked_by) ?? null;
167
168
  x(() => {
168
- I && w();
169
- }, [I, w]), x(() => {
170
- if (!I) return;
171
- const a = setInterval(() => void w(), Ze);
169
+ A && g();
170
+ }, [A, g]), x(() => {
171
+ if (!A) return;
172
+ const a = setInterval(() => void g(), rt);
172
173
  return () => clearInterval(a);
173
- }, [I, w]), x(() => {
174
+ }, [A, g]), x(() => {
174
175
  if (!(!s || !e || !t))
175
- return A.current = !1, F.current = !1, k ? w() : h(), () => {
176
- f(), A.current = !1, i.current && (i.current = !1, o.request(H(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
176
+ return I.current = !1, F.current = !1, h ? g() : b(), () => {
177
+ m(), I.current = !1, i.current && (i.current = !1, o.request(J(`/item-locks/${e}/${t}/lock`)).then(() => ee(c, "lock-released", e, t)).catch(() => {
177
178
  }));
178
179
  };
179
- }, [s, e, t, h, o, f, c, k, w]);
180
- const Ae = E(async () => {
181
- if (!(!s || i.current || re.current) && !(Date.now() < ne.current)) {
182
- re.current = !0;
180
+ }, [s, e, t, b, o, m, c, h, g]);
181
+ const Ie = E(async () => {
182
+ if (!(!s || i.current || ne.current) && !(Date.now() < ae.current)) {
183
+ ne.current = !0;
183
184
  try {
184
- const a = await h();
185
- !a && U.current === 409 && d.warning("Someone else is editing this record — your change can’t be saved yet"), !a && U.current !== 409 && !F.current && (ne.current = Date.now() + tt);
185
+ const a = await b();
186
+ !a && U.current === 409 && f.warning("Someone else is editing this record — your change can’t be saved yet"), !a && U.current !== 409 && !F.current && (ae.current = Date.now() + at);
186
187
  } finally {
187
- re.current = !1;
188
+ ne.current = !1;
188
189
  }
189
190
  }
190
- }, [s, h]);
191
+ }, [s, b]);
191
192
  x(() => {
192
193
  const a = () => {
193
- ne.current = 0;
194
+ ae.current = 0;
194
195
  };
195
196
  return window.addEventListener("online", a), () => window.removeEventListener("online", a);
196
197
  }, []);
197
- const X = E(() => {
198
+ const Z = E(() => {
198
199
  var a;
199
200
  if (!(!e || !t))
200
201
  try {
201
- const n = (a = o.getToken) == null ? void 0 : a.call(o), m = o.url ?? "";
202
+ const n = (a = o.getToken) == null ? void 0 : a.call(o), k = o.url ?? "";
202
203
  fetch(
203
- `${m}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(t)}/lock/release`,
204
+ `${k}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(t)}/lock/release`,
204
205
  {
205
206
  method: "POST",
206
207
  keepalive: !0,
207
208
  credentials: n ? "omit" : "include",
208
209
  headers: n ? { Authorization: `Bearer ${n}` } : {}
209
210
  }
210
- ).then(() => Z(c, "lock-released", e, t)).catch(() => {
211
+ ).then(() => ee(c, "lock-released", e, t)).catch(() => {
211
212
  });
212
213
  } catch {
213
214
  }
214
- }, [o, e, t, c]), se = at(), Ie = nt(), O = q && se && Ie, me = C(O);
215
+ }, [o, e, t, c]), oe = it(), Ae = ot(), O = q && oe && Ae, ke = C(O);
215
216
  x(() => {
216
- const a = me.current;
217
- me.current = O, !(!s || !e || !t || a || !O) && (i.current || !I || w());
218
- }, [s, O, e, t, I, w]), x(() => {
217
+ const a = ke.current;
218
+ ke.current = O, !(!s || !e || !t || a || !O) && (i.current || !A || g());
219
+ }, [s, O, e, t, A, g]), x(() => {
219
220
  if (!(!s || !e || !t)) {
220
221
  if (O) {
221
- if (A.current) {
222
- if (A.current = !1, p()) return;
223
- h().then((a) => {
224
- !a && U.current === 409 && d.warning(Ee(V.current != null, V.current));
222
+ if (I.current) {
223
+ if (I.current = !1, p()) return;
224
+ b().then((a) => {
225
+ !a && U.current === 409 && f.warning(Ee(V.current != null, V.current));
225
226
  });
226
227
  }
227
228
  return;
228
229
  }
229
- i.current && (f(), i.current = !1, L(!1), A.current = !0, se ? o.request(H(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
230
- }) : X());
230
+ i.current && (m(), i.current = !1, L(!1), I.current = !0, oe ? o.request(J(`/item-locks/${e}/${t}/lock`)).then(() => ee(c, "lock-released", e, t)).catch(() => {
231
+ }) : Z());
231
232
  }
232
233
  }, [
233
234
  s,
234
235
  O,
235
- se,
236
+ oe,
236
237
  e,
237
238
  t,
238
- h,
239
+ b,
239
240
  o,
240
- f,
241
+ m,
241
242
  c,
242
- X,
243
+ Z,
243
244
  p
244
245
  ]), x(() => {
245
- if (!s || !k || !e || !t || I || !O) return;
246
+ if (!s || !h || !e || !t || A || !O) return;
246
247
  const a = setInterval(() => {
247
- !i.current && !F.current && w();
248
- }, et);
248
+ !i.current && !F.current && g();
249
+ }, nt);
249
250
  return () => clearInterval(a);
250
- }, [s, k, e, t, I, O, w]), x(() => {
251
+ }, [s, h, e, t, A, O, g]), x(() => {
251
252
  if (!s || !e || !t) return;
252
253
  const a = () => {
253
- i.current && (f(), i.current = !1, A.current = !0, X());
254
- }, n = (m) => {
255
- m.persisted && A.current && (A.current = !1, p() || h());
254
+ i.current && (m(), i.current = !1, I.current = !0, Z());
255
+ }, n = (k) => {
256
+ k.persisted && I.current && (I.current = !1, p() || b());
256
257
  };
257
258
  return window.addEventListener("pagehide", a), window.addEventListener("pageshow", n), () => {
258
259
  window.removeEventListener("pagehide", a), window.removeEventListener("pageshow", n);
259
260
  };
260
- }, [s, e, t, f, h, X, p]), x(() => {
261
- if (!s || !k || !e || !t || g !== !1 || !i.current) return;
262
- const a = W.current, n = a != null && !G.current ? Math.max(Le, a + rt - Date.now()) : Le, m = setTimeout(() => {
263
- $.current !== !1 || !i.current || (f(), i.current = !1, L(!1), P(), o.request(H(`/item-locks/${e}/${t}/lock`)).then(() => Z(c, "lock-released", e, t)).catch(() => {
261
+ }, [s, e, t, m, b, Z, p]), x(() => {
262
+ if (!s || !h || !e || !t || w !== !1 || !i.current) return;
263
+ const a = W.current, n = a != null && !X.current ? Math.max(Le, a + st - Date.now()) : Le, k = setTimeout(() => {
264
+ $.current !== !1 || !i.current || (m(), i.current = !1, L(!1), j(), o.request(J(`/item-locks/${e}/${t}/lock`)).then(() => ee(c, "lock-released", e, t)).catch(() => {
264
265
  }));
265
266
  }, n);
266
- return () => clearTimeout(m);
267
+ return () => clearTimeout(k);
267
268
  }, [
268
269
  s,
269
- k,
270
+ h,
270
271
  e,
271
272
  t,
272
- g,
273
- z,
273
+ w,
274
+ K,
274
275
  o,
275
- f,
276
+ m,
276
277
  c,
277
- P
278
+ j
278
279
  ]), x(() => {
279
- g === !0 && W.current != null && (G.current = !0);
280
- }, [g]), x(() => {
281
- !z && W.current != null && P();
282
- }, [z, P]), x(() => () => ie(K, !1), [K]), Je(c, "lock-released", e, t, () => {
283
- s && i.current && h();
280
+ w === !0 && W.current != null && (X.current = !0);
281
+ }, [w]), x(() => {
282
+ !K && W.current != null && j();
283
+ }, [K, j]), x(() => () => ue(P, !1), [P]), Ze(c, "lock-released", e, t, () => {
284
+ s && i.current && b();
284
285
  });
285
- const oe = ge();
286
+ const ie = ge();
286
287
  x(() => {
287
- if (!(!s || !oe || !e || !t))
288
- return oe.subscribeCollections([e], (a) => {
288
+ if (!(!s || !ie || !e || !t))
289
+ return ie.subscribeCollections([e], (a) => {
289
290
  var n;
290
- i.current || F.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !He(a, t) || w();
291
+ i.current || F.current || !((n = a.changed_fields) != null && n.includes("$lock")) || !Xe(a, t) || g();
291
292
  });
292
- }, [s, oe, e, t, w]);
293
- const j = ge(), [Oe, ke] = S(!1), De = E(async () => {
293
+ }, [s, ie, e, t, g]);
294
+ const z = ge(), [Oe, he] = S(!1), Me = E(async () => {
294
295
  if (!(!e || !t)) {
295
- ke(!0);
296
+ he(!0);
296
297
  try {
297
- await o.request(D(`/item-locks/${e}/${t}/lock/request`, {})), d.success("Asked the current editor to release the lock");
298
+ await o.request(M(`/item-locks/${e}/${t}/lock/request`, {})), f.success("Asked the current editor to release the lock");
298
299
  } catch {
299
- d.error("Could not send the lock request");
300
+ f.error("Could not send the lock request");
300
301
  } finally {
301
- ke(!1);
302
+ he(!1);
302
303
  }
303
304
  }
304
305
  }, [o, e, t]);
305
306
  x(() => {
306
- if (!j || !e || !t) return;
307
- const a = j.on("lock:requested", (r) => {
307
+ if (!z || !e || !t) return;
308
+ const a = z.on("lock:requested", (r) => {
308
309
  if ((r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || !i.current) return;
309
- const u = (r == null ? void 0 : r.from) ?? {};
310
- d(`${u.name ?? "Someone"} is asking you to release this record`, {
310
+ const d = (r == null ? void 0 : r.from) ?? {};
311
+ f(`${d.name ?? "Someone"} is asking you to release this record`, {
311
312
  duration: 3e4,
312
313
  action: {
313
314
  label: "Release",
314
315
  onClick: () => {
315
- f(), i.current = !1, L(!1), o.request(
316
- D(`/item-locks/${e}/${t}/lock/respond`, {
317
- to: u.id,
316
+ m(), i.current = !1, L(!1), o.request(
317
+ M(`/item-locks/${e}/${t}/lock/respond`, {
318
+ to: d.id,
318
319
  action: "release"
319
320
  })
320
- ).then(() => d.success("Lock released")).catch(() => d.error("Failed to release the lock"));
321
+ ).then(() => f.success("Lock released")).catch(() => f.error("Failed to release the lock"));
321
322
  }
322
323
  },
323
324
  cancel: {
324
325
  label: "Keep editing",
325
326
  onClick: () => {
326
327
  o.request(
327
- D(`/item-locks/${e}/${t}/lock/respond`, {
328
- to: u.id,
328
+ M(`/item-locks/${e}/${t}/lock/respond`, {
329
+ to: d.id,
329
330
  action: "decline"
330
331
  })
331
332
  ).catch(() => {
@@ -333,51 +334,56 @@ function yt(e, t, s, R = {}) {
333
334
  }
334
335
  }
335
336
  });
336
- }), n = j.on("lock:response", (r) => {
337
- var u, b;
338
- (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (d.success(`${((u = r == null ? void 0 : r.from) == null ? void 0 : u.name) ?? "The editor"} released the lock — it's yours`), h()) : d.warning(
339
- `${((b = r == null ? void 0 : r.from) == null ? void 0 : b.name) ?? "The editor"} is keeping the lock${r != null && r.note ? `: "${r.note}"` : ""}`
337
+ }), n = z.on("lock:response", (r) => {
338
+ var d, H;
339
+ (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || ((r == null ? void 0 : r.action) === "release" ? (f.success(`${((d = r == null ? void 0 : r.from) == null ? void 0 : d.name) ?? "The editor"} released the lock — it's yours`), b()) : f.warning(
340
+ `${((H = r == null ? void 0 : r.from) == null ? void 0 : H.name) ?? "The editor"} is keeping the lock${r != null && r.note ? `: "${r.note}"` : ""}`
340
341
  ));
341
- }), m = j.on("lock:available", (r) => {
342
- (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (d.success("Your turn — the edit lock is yours"), Q(null), h());
343
- }), l = j.on("lock:queued", (r) => {
344
- (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && d(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), w());
342
+ }), k = z.on("lock:available", (r) => {
343
+ (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || i.current || (f.success("Your turn — the edit lock is yours"), Q(null), b());
344
+ }), u = z.on("lock:queued", (r) => {
345
+ (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (i.current && f(`${(r == null ? void 0 : r.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), g());
346
+ }), l = z.on("lock:moved", (r) => {
347
+ (r == null ? void 0 : r.collection) !== e || String(r == null ? void 0 : r.item) !== String(t) || (He(e, t), f.warning(Je(r ?? {}), {
348
+ id: Ge(e, t),
349
+ duration: 3e4
350
+ }), g());
345
351
  });
346
352
  return () => {
347
- a(), n(), m(), l();
353
+ a(), n(), k(), u(), l();
348
354
  };
349
- }, [j, e, t, o, h, f, w]);
350
- const Me = E(async () => {
355
+ }, [z, e, t, o, b, m, g]);
356
+ const De = E(async () => {
351
357
  if (!(!e || !t)) {
352
- ce(!0);
358
+ de(!0);
353
359
  try {
354
360
  const a = await o.request(
355
- D(`/item-locks/${e}/${t}/lock/queue`, {})
361
+ M(`/item-locks/${e}/${t}/lock/queue`, {})
356
362
  ), n = a == null ? void 0 : a.data;
357
363
  if (n != null && n.free) {
358
- Q(null), N(null), d.success("Nobody is editing this record now — go ahead");
364
+ Q(null), R(null), f.success("Nobody is editing this record now — go ahead");
359
365
  return;
360
366
  }
361
- const m = n == null ? void 0 : n.position;
362
- Q(typeof m == "number" ? m : 1), d.success("You are in line — the lock comes to you automatically when it frees up"), w();
367
+ const k = n == null ? void 0 : n.position;
368
+ Q(typeof k == "number" ? k : 1), f.success("You are in line — the lock comes to you automatically when it frees up"), g();
363
369
  } catch {
364
- d.error("Could not join the queue");
370
+ f.error("Could not join the queue");
365
371
  } finally {
366
- ce(!1);
372
+ de(!1);
367
373
  }
368
374
  }
369
- }, [o, e, t, w]), Ye = E(async () => {
375
+ }, [o, e, t, g]), Ye = E(async () => {
370
376
  if (!(!e || !t))
371
377
  try {
372
- await o.request(H(`/item-locks/${e}/${t}/lock/queue`)), Q(null), w();
378
+ await o.request(J(`/item-locks/${e}/${t}/lock/queue`)), Q(null), g();
373
379
  } catch {
374
380
  }
375
- }, [o, e, t, w]), Fe = E(
381
+ }, [o, e, t, g]), Fe = E(
376
382
  async (a) => {
377
383
  if (!(!e || !t || !i.current)) {
378
- de(a);
384
+ fe(a);
379
385
  try {
380
- await o.request(D(`/item-locks/${e}/${t}/lock/note`, { note: a }));
386
+ await o.request(M(`/item-locks/${e}/${t}/lock/note`, { note: a }));
381
387
  } catch {
382
388
  }
383
389
  }
@@ -385,66 +391,66 @@ function yt(e, t, s, R = {}) {
385
391
  [o, e, t]
386
392
  ), ze = E(async () => {
387
393
  if (!(!e || !t || !i.current)) {
388
- fe(!0), f(), i.current = !1, L(!1);
394
+ me(!0), m(), i.current = !1, L(!1);
389
395
  try {
390
- await o.request(H(`/item-locks/${e}/${t}/lock`)), te(!0), de(""), d.success("Lock released — anyone can edit this record now");
396
+ await o.request(J(`/item-locks/${e}/${t}/lock`)), re(!0), fe(""), f.success("Lock released — anyone can edit this record now");
391
397
  } catch {
392
- d.error("Failed to release the lock"), h();
398
+ f.error("Failed to release the lock"), b();
393
399
  } finally {
394
- fe(!1);
400
+ me(!1);
395
401
  }
396
402
  }
397
- }, [o, e, t, f, h]), Ke = E(async () => {
403
+ }, [o, e, t, m, b]), Ke = E(async () => {
398
404
  if (i.current) return !0;
399
- const a = await h();
400
- return a && d.success("You hold the edit lock again"), a;
401
- }, [h]), Pe = E(async () => {
405
+ const a = await b();
406
+ return a && f.success("You hold the edit lock again"), a;
407
+ }, [b]), Pe = E(async () => {
402
408
  var a;
403
409
  if (!(!e || !t)) {
404
410
  le(!0);
405
411
  try {
406
412
  await o.request(
407
- D(`/item-locks/${e}/${t}/lock/force`, { beat_ms: ee })
408
- ), d.success("You now hold the edit lock"), W.current = Date.now(), G.current = !1, ie(K, !0), await h() || P();
413
+ M(`/item-locks/${e}/${t}/lock/force`, { beat_ms: te })
414
+ ), f.success("You now hold the edit lock"), W.current = Date.now(), X.current = !1, ue(P, !0), await b() || j();
409
415
  } catch (n) {
410
- const m = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
411
- d.error(m), (n == null ? void 0 : n.status) === 403 && N((l) => l && { ...l, may_take_over: !1 });
416
+ const k = ((a = n == null ? void 0 : n.response) == null ? void 0 : a.error) ?? "Failed to take over the lock";
417
+ f.error(k), (n == null ? void 0 : n.status) === 403 && R((u) => u && { ...u, may_take_over: !1 });
412
418
  } finally {
413
419
  le(!1);
414
420
  }
415
421
  }
416
- }, [o, e, t, h, K, P]);
422
+ }, [o, e, t, b, P, j]);
417
423
  return {
418
424
  lockHolder: Y,
419
- acquired: z,
425
+ acquired: K,
420
426
  isReadOnly: !!Y,
421
427
  takeOver: Pe,
422
428
  takingOver: B,
423
429
  isAdmin: T,
424
- requestLock: De,
430
+ requestLock: Me,
425
431
  requesting: Oe,
426
432
  queue: $e,
427
- myPosition: Re,
428
- joinQueue: Me,
433
+ myPosition: Ne,
434
+ joinQueue: De,
429
435
  leaveQueue: Ye,
430
- joining: Ne,
436
+ joining: Re,
431
437
  myNote: Ce,
432
438
  saveNote: Fe,
433
439
  release: ze,
434
440
  releasing: qe,
435
441
  released: Te,
436
442
  relock: Ke,
437
- claim: Ae
443
+ claim: Ie
438
444
  };
439
445
  }
440
- function gt({
446
+ function pt({
441
447
  note: e,
442
448
  onSave: t,
443
449
  waiting: s,
444
- onRelease: R,
445
- releasing: k,
450
+ onRelease: N,
451
+ releasing: h,
446
452
  released: q,
447
- onRelock: g
453
+ onRelock: w
448
454
  }) {
449
455
  var T;
450
456
  const [$, p] = S(e);
@@ -468,15 +474,15 @@ function gt({
468
474
  /* @__PURE__ */ v("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
469
475
  /* @__PURE__ */ v("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Anyone can edit this record now. Your next edit locks it again — or lock it now." }),
470
476
  /* @__PURE__ */ _(
471
- M,
477
+ D,
472
478
  {
473
479
  type: "button",
474
480
  size: "sm",
475
481
  className: "mt-2 h-7 w-full text-[12px]",
476
- onClick: g,
482
+ onClick: w,
477
483
  "data-lock-relock": !0,
478
484
  children: [
479
- /* @__PURE__ */ v(ue, { className: "mr-1.5 h-3.5 w-3.5" }),
485
+ /* @__PURE__ */ v(ce, { className: "mr-1.5 h-3.5 w-3.5" }),
480
486
  " Lock again"
481
487
  ]
482
488
  }
@@ -492,7 +498,7 @@ function gt({
492
498
  "data-lock-holder": !0,
493
499
  className: "relative inline-flex h-8 w-8 items-center justify-center text-[#0e7490] transition-colors hover:bg-accent hover:text-accent-foreground dark:text-nvr-cyan",
494
500
  children: [
495
- /* @__PURE__ */ v(ue, { className: "h-4 w-4", strokeWidth: 2 }),
501
+ /* @__PURE__ */ v(ce, { className: "h-4 w-4", strokeWidth: 2 }),
496
502
  s.length > 0 && /* @__PURE__ */ v("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
497
503
  ]
498
504
  }
@@ -522,33 +528,33 @@ function gt({
522
528
  " ",
523
529
  s.map((c) => c.name ?? "someone").join(", ")
524
530
  ] }),
525
- R && /* @__PURE__ */ _(
526
- M,
531
+ N && /* @__PURE__ */ _(
532
+ D,
527
533
  {
528
534
  type: "button",
529
535
  variant: "outline",
530
536
  size: "sm",
531
537
  className: "mt-2 h-7 w-full text-[12px]",
532
- onClick: R,
533
- disabled: k,
538
+ onClick: N,
539
+ disabled: h,
534
540
  "data-lock-release": !0,
535
541
  children: [
536
542
  /* @__PURE__ */ v(ye, { className: "mr-1.5 h-3.5 w-3.5" }),
537
- k ? "Releasing…" : s.length > 0 ? `Release lock to ${((T = s[0]) == null ? void 0 : T.name) ?? "the next person"}` : "Release lock"
543
+ h ? "Releasing…" : s.length > 0 ? `Release lock to ${((T = s[0]) == null ? void 0 : T.name) ?? "the next person"}` : "Release lock"
538
544
  ]
539
545
  }
540
546
  )
541
547
  ] })
542
548
  ] });
543
549
  }
544
- function wt({
550
+ function Lt({
545
551
  lockHolder: e,
546
552
  onTakeOver: t,
547
553
  takingOver: s,
548
- isAdmin: R,
549
- onRequestLock: k,
554
+ isAdmin: N,
555
+ onRequestLock: h,
550
556
  requesting: q,
551
- queue: g,
557
+ queue: w,
552
558
  myPosition: $,
553
559
  onJoinQueue: p,
554
560
  onLeaveQueue: o,
@@ -556,16 +562,16 @@ function wt({
556
562
  noun: c = "this item",
557
563
  readOnlyText: y = "fields are read-only"
558
564
  }) {
559
- const [Y, N] = S(!1), z = (e == null ? void 0 : e.locked_by) ?? null;
560
- if (x(() => N(!1), [z]), !e) return null;
561
- const L = e.locked_by_name || "Another user", B = (g == null ? void 0 : g.length) ?? 0;
565
+ const [Y, R] = S(!1), K = (e == null ? void 0 : e.locked_by) ?? null;
566
+ if (x(() => R(!1), [K]), !e) return null;
567
+ const L = e.locked_by_name || "Another user", B = (w == null ? void 0 : w.length) ?? 0;
562
568
  return /* @__PURE__ */ _(
563
569
  "div",
564
570
  {
565
571
  className: "mb-4 flex flex-wrap items-center gap-3 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-500/30 dark:bg-amber-500/10 dark:text-amber-100",
566
572
  "data-lock-banner": !0,
567
573
  children: [
568
- /* @__PURE__ */ v(ue, { className: "h-4 w-4 shrink-0 text-amber-500" }),
574
+ /* @__PURE__ */ v(ce, { className: "h-4 w-4 shrink-0 text-amber-500" }),
569
575
  /* @__PURE__ */ _("span", { className: "min-w-0 flex-1", children: [
570
576
  /* @__PURE__ */ v("span", { className: "font-medium", children: L }),
571
577
  " is editing ",
@@ -599,7 +605,7 @@ function wt({
599
605
  ] })
600
606
  ] }),
601
607
  p && ($ != null ? /* @__PURE__ */ _(
602
- M,
608
+ D,
603
609
  {
604
610
  size: "sm",
605
611
  variant: "outline",
@@ -613,7 +619,7 @@ function wt({
613
619
  ]
614
620
  }
615
621
  ) : /* @__PURE__ */ v(
616
- M,
622
+ D,
617
623
  {
618
624
  size: "sm",
619
625
  variant: "outline",
@@ -624,13 +630,13 @@ function wt({
624
630
  children: T ? "Joining…" : "Ask to be next"
625
631
  }
626
632
  )),
627
- k && /* @__PURE__ */ v(
628
- M,
633
+ h && /* @__PURE__ */ v(
634
+ D,
629
635
  {
630
636
  size: "sm",
631
637
  variant: "outline",
632
638
  className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
633
- onClick: k,
639
+ onClick: h,
634
640
  disabled: q,
635
641
  children: q ? "Asking…" : "Ask them to wrap up"
636
642
  }
@@ -638,7 +644,7 @@ function wt({
638
644
  // Admins always; other roles only when the server says they may (the
639
645
  // takeover-role allowlist, #256) — unknown = offered, and a 403 then
640
646
  // hides it. A Take over that can only fail was a dead end.
641
- (R || e.may_take_over !== !1) && (Y ? /* @__PURE__ */ _(
647
+ (N || e.may_take_over !== !1) && (Y ? /* @__PURE__ */ _(
642
648
  "span",
643
649
  {
644
650
  className: "flex basis-full flex-wrap items-center justify-end gap-2 text-[12px] text-amber-800 dark:text-amber-200",
@@ -649,23 +655,23 @@ function wt({
649
655
  " may have unsaved changes — they can’t save them once you take over."
650
656
  ] }),
651
657
  /* @__PURE__ */ v(
652
- M,
658
+ D,
653
659
  {
654
660
  size: "sm",
655
661
  variant: "outline",
656
662
  className: "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15",
657
- onClick: () => N(!1),
663
+ onClick: () => R(!1),
658
664
  disabled: s,
659
665
  children: "Cancel"
660
666
  }
661
667
  ),
662
668
  /* @__PURE__ */ v(
663
- M,
669
+ D,
664
670
  {
665
671
  size: "sm",
666
672
  className: "h-7 shrink-0 bg-amber-600 text-[12px] text-white hover:bg-amber-700",
667
673
  onClick: () => {
668
- N(!1), t();
674
+ R(!1), t();
669
675
  },
670
676
  disabled: s,
671
677
  "data-lock-takeover-go": !0,
@@ -675,12 +681,12 @@ function wt({
675
681
  ]
676
682
  }
677
683
  ) : /* @__PURE__ */ v(
678
- M,
684
+ D,
679
685
  {
680
686
  size: "sm",
681
687
  variant: "outline",
682
- className: R ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
683
- onClick: () => N(!0),
688
+ className: N ? "h-7 shrink-0 border-amber-300 bg-white text-[12px] text-amber-800 hover:bg-amber-100 dark:border-amber-500/40 dark:bg-transparent dark:text-amber-200 dark:hover:bg-amber-500/15" : "h-7 shrink-0 border-amber-200 bg-white/60 text-[12px] text-amber-700/80 hover:bg-amber-100 dark:border-amber-500/30 dark:bg-transparent dark:text-amber-200/80 dark:hover:bg-amber-500/15",
689
+ onClick: () => R(!0),
684
690
  disabled: s,
685
691
  children: s ? "Taking over…" : "Take over"
686
692
  }
@@ -690,9 +696,9 @@ function wt({
690
696
  );
691
697
  }
692
698
  export {
693
- wt as ItemLockBanner,
694
- gt as LockHolderButton,
695
- rt as TAKEOVER_HOLD_MS,
699
+ Lt as ItemLockBanner,
700
+ pt as LockHolderButton,
701
+ st as TAKEOVER_HOLD_MS,
696
702
  Ee as takenAwayText,
697
- yt as useItemLock
703
+ _t as useItemLock
698
704
  };