@nivaro/react 0.3.27 → 0.3.28

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.
@@ -9,7 +9,7 @@ import { noteReplayEvent as _e, createReplayCheckoutState as De } from "../share
9
9
  import { emitReplayTap as Te, setReplayRecorderMode as N, registerReplayCapture as qe, clipEndOffset as Le, withClipKind as Pe } from "../shared/lib/replay-capture.js";
10
10
  import { instrumentConsole as Ne, instrumentRequests as Fe, redactSecrets as Me } from "../shared/lib/replay-context.js";
11
11
  import { instrumentSocket as Oe } from "../shared/lib/replay-socket.js";
12
- const Ue = "nivaro-react@0.3.27", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
12
+ const Ue = "nivaro-react@0.3.28", j = 1e4, We = 150, He = 3e3, Ke = 600, $e = (n) => `nvr_replay_resume${n ? `:${n}` : ""}`, G = () => typeof navigator > "u" || navigator.onLine !== !1;
13
13
  function Be(n) {
14
14
  return typeof n.url != "string" || typeof fetch != "function" ? null : (f, a) => {
15
15
  const u = typeof n.getToken == "function" ? n.getToken() : void 0, d = { "Content-Type": "application/json" };
@@ -1,274 +1,283 @@
1
- import { jsxs as v, jsx as m } from "react/jsx-runtime";
1
+ import { jsxs as x, jsx as h } from "react/jsx-runtime";
2
2
  import { QueryClientContext as Se } from "@tanstack/react-query";
3
3
  import { Lock as Z, LockOpen as ie } from "lucide-react";
4
- import { useContext as Ce, useState as x, useRef as A, useCallback as w, useEffect as N } from "react";
5
- import { toast as u } from "sonner";
6
- import { useNivaroClient as qe, useItemEditAuth as Te } from "../../context.js";
7
- import { post as q, get as Ae, del as P } from "../../lib/commands.js";
8
- import { idleState as Ie } from "../../lib/idle.js";
9
- import { useOptionalRealtime as le, updateTouches as Oe } from "../../lib/realtime.js";
10
- import { announceRecordTabs as X, useRecordTabsSignal as Ye } from "../../lib/record-tabs.js";
11
- import { Button as Y } from "../ui/button.js";
12
- import { Popover as ue, PopoverTrigger as ce, PopoverContent as de } from "../ui/popover.js";
13
- const K = 1e4, De = 1500, Fe = 2e3, Me = 3e4, Be = 6e4, je = 15e3;
4
+ import { useContext as qe, useState as L, useRef as A, useCallback as p, useEffect as N } from "react";
5
+ import { toast as l } from "sonner";
6
+ import { useNivaroClient as Ie, useItemEditAuth as Te } from "../../context.js";
7
+ import { post as I, get as Ae, del as K } from "../../lib/commands.js";
8
+ import { idleState as Oe } from "../../lib/idle.js";
9
+ import { useOptionalRealtime as ue, updateTouches as De } from "../../lib/realtime.js";
10
+ import { announceRecordTabs as X, useRecordTabsSignal as Me } from "../../lib/record-tabs.js";
11
+ import { Button as M } from "../ui/button.js";
12
+ import { Popover as le, PopoverTrigger as ce, PopoverContent as de } from "../ui/popover.js";
13
+ const Q = 1e4, fe = 1500, Ye = 2e3, Fe = 5 * 6e4, Pe = 3e4, Be = 6e4, je = 15e3;
14
14
  function ze() {
15
- const [e, r] = x(!0);
15
+ const [e, r] = L(!0);
16
16
  return N(() => {
17
17
  if (typeof window > "u" || typeof document > "u") return;
18
- let a = null, _ = null;
19
- const g = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, p = () => {
20
- _ && clearInterval(_), _ = null;
21
- }, o = () => {
22
- a && clearTimeout(a), a = setTimeout(() => {
23
- if (a = null, !g()) {
24
- p(), r(!1);
25
- return;
26
- }
27
- p(), _ = setInterval(() => {
28
- g() || (p(), r(!1));
29
- }, Fe);
30
- }, De);
31
- }, L = () => {
32
- a && clearTimeout(a), a = null, p(), r(!0);
18
+ let o = null, E = null, y = 0;
19
+ const S = () => typeof document.hasFocus == "function" ? document.hasFocus() : !0, a = () => {
20
+ E && clearInterval(E), E = null;
21
+ }, $ = (_) => _ instanceof HTMLInputElement && _.type === "file", f = (_) => {
22
+ $(_.target) && (y = Date.now() + Fe);
23
+ }, b = (_) => {
24
+ !$(_.target) || !y || (y = 0, S() || w());
25
+ }, w = () => {
26
+ o && clearTimeout(o);
27
+ const _ = y - Date.now();
28
+ o = setTimeout(
29
+ () => {
30
+ if (o = null, !S()) {
31
+ a(), r(!1);
32
+ return;
33
+ }
34
+ a(), E = setInterval(() => {
35
+ S() || (a(), r(!1));
36
+ }, Ye);
37
+ },
38
+ _ > 0 ? Math.max(_, fe) : fe
39
+ );
40
+ }, m = () => {
41
+ o && clearTimeout(o), o = null, y = 0, a(), r(!0);
33
42
  };
34
- return window.addEventListener("blur", o), window.addEventListener("focus", L), () => {
35
- window.removeEventListener("blur", o), window.removeEventListener("focus", L), a && clearTimeout(a), p();
43
+ return window.addEventListener("blur", w), window.addEventListener("focus", m), document.addEventListener("click", f, !0), document.addEventListener("change", b, !0), document.addEventListener("cancel", b, !0), () => {
44
+ window.removeEventListener("blur", w), window.removeEventListener("focus", m), document.removeEventListener("click", f, !0), document.removeEventListener("change", b, !0), document.removeEventListener("cancel", b, !0), o && clearTimeout(o), a();
36
45
  };
37
46
  }, []), e;
38
47
  }
39
- function Pe() {
40
- const [e, r] = x(
48
+ function Ke() {
49
+ const [e, r] = L(
41
50
  () => typeof document > "u" || document.visibilityState !== "hidden"
42
51
  );
43
52
  return N(() => {
44
- const a = () => r(document.visibilityState !== "hidden");
45
- return document.addEventListener("visibilitychange", a), () => document.removeEventListener("visibilitychange", a);
53
+ const o = () => r(document.visibilityState !== "hidden");
54
+ return document.addEventListener("visibilitychange", o), () => document.removeEventListener("visibilitychange", o);
46
55
  }, []), e;
47
56
  }
48
- function rt(e, r, a, _ = {}) {
49
- const { lazy: g = !1, active: p = !0 } = _, o = qe(), { isAdmin: L, userId: k } = Te(), $ = Ce(Se), [R, b] = x(null), [Q, S] = x(!1), [D, ee] = x(!1), [fe, me] = x([]), [he, F] = x(null), [ke, te] = x(!1), [be, re] = x(""), [ye, U] = x(!1), [ve, ne] = x(!1), B = A(null), i = A(!1), C = A(!1), V = A(!1), W = A(0), T = A(!1), M = A(null), h = w(() => {
57
+ function nt(e, r, o, E = {}) {
58
+ const { lazy: y = !1, active: S = !0 } = E, a = Ie(), { isAdmin: $, userId: f } = Te(), b = qe(Se), [w, m] = L(null), [_, R] = L(!1), [Y, ee] = L(!1), [me, ke] = L([]), [he, F] = L(null), [be, te] = L(!1), [ve, re] = L(""), [ye, U] = L(!1), [ge, ne] = L(!1), B = A(null), i = A(!1), q = A(!1), H = A(!1), V = A(0), T = A(!1), P = A(null), v = p(() => {
50
59
  B.current && (clearInterval(B.current), B.current = null);
51
- }, []), H = w(
60
+ }, []), W = p(
52
61
  (s) => {
53
62
  var t, c;
54
- const n = s, f = n.status ?? ((t = n.response) == null ? void 0 : t.status), l = ((c = n.response) == null ? void 0 : c.data) ?? n.response;
55
- return f !== 403 || (l == null ? void 0 : l.code) !== "EDIT_LOCKED" ? !1 : (h(), i.current = !1, S(!1), u.warning(l.error || "You can no longer edit this record — your edit lock was let go"), $ == null || $.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, r] }), $ == null || $.invalidateQueries({ queryKey: ["pipeline-instance", e, r] }), !0);
63
+ const n = s, k = n.status ?? ((t = n.response) == null ? void 0 : t.status), u = ((c = n.response) == null ? void 0 : c.data) ?? n.response;
64
+ return k !== 403 || (u == null ? void 0 : u.code) !== "EDIT_LOCKED" ? !1 : (v(), i.current = !1, R(!1), l.warning(u.error || "You can no longer edit this record — your edit lock was let go"), b == null || b.invalidateQueries({ queryKey: ["pipeline-instance-lock", e, r] }), b == null || b.invalidateQueries({ queryKey: ["pipeline-instance", e, r] }), !0);
56
65
  },
57
- [$, e, r, h]
58
- ), d = w(async () => {
66
+ [b, e, r, v]
67
+ ), d = p(async () => {
59
68
  var s, n;
60
69
  if (!e || !r || T.current) return !1;
61
- M.current = null;
70
+ P.current = null;
62
71
  try {
63
- return await o.request(
64
- q(`/item-locks/${e}/${r}/lock`, { beat_ms: K })
65
- ), i.current = !0, S(!0), U(!1), b(null), h(), B.current = setInterval(() => {
66
- const f = Math.max(
72
+ return await a.request(
73
+ I(`/item-locks/${e}/${r}/lock`, { beat_ms: Q })
74
+ ), i.current = !0, R(!0), U(!1), m(null), v(), B.current = setInterval(() => {
75
+ const k = Math.max(
67
76
  0,
68
- Math.floor((Date.now() - new Date(Ie().last_active).getTime()) / 1e3)
77
+ Math.floor((Date.now() - new Date(Oe().last_active).getTime()) / 1e3)
69
78
  );
70
- o.request(
71
- q(`/item-locks/${e}/${r}/heartbeat`, {
72
- idle_seconds: f,
73
- beat_ms: K
79
+ a.request(
80
+ I(`/item-locks/${e}/${r}/heartbeat`, {
81
+ idle_seconds: k,
82
+ beat_ms: Q
74
83
  })
75
- ).then((l) => {
76
- if (!(l != null && l.idle_released)) return;
77
- h(), i.current = !1, S(!1), u.info(
84
+ ).then((u) => {
85
+ if (!(u != null && u.idle_released)) return;
86
+ v(), i.current = !1, R(!1), l.info(
78
87
  "Your edit lock was released after inactivity — it re-locks when you resume."
79
88
  );
80
89
  const t = () => {
81
90
  window.removeEventListener("pointerdown", t, !0), window.removeEventListener("keydown", t, !0), d();
82
91
  };
83
92
  window.addEventListener("pointerdown", t, !0), window.addEventListener("keydown", t, !0);
84
- }).catch((l) => {
93
+ }).catch((u) => {
85
94
  var ae, oe;
86
- const t = l, c = t.status ?? ((ae = t.response) == null ? void 0 : ae.status);
87
- if (H(l) || c !== 404 && c !== 409) return;
88
- const E = ((oe = t.response) == null ? void 0 : oe.data) ?? t.response;
89
- if (c === 404 && !(E != null && E.locked_by)) {
95
+ const t = u, c = t.status ?? ((ae = t.response) == null ? void 0 : ae.status);
96
+ if (W(u) || c !== 404 && c !== 409) return;
97
+ const C = ((oe = t.response) == null ? void 0 : oe.data) ?? t.response;
98
+ if (c === 404 && !(C != null && C.locked_by)) {
90
99
  d();
91
100
  return;
92
101
  }
93
- h(), i.current = !1, S(!1), E != null && E.locked_by && (b({
94
- locked_by: E.locked_by,
95
- locked_by_name: E.locked_by_name ?? null
96
- }), u.warning(
97
- `${E.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
102
+ v(), i.current = !1, R(!1), C != null && C.locked_by && (m({
103
+ locked_by: C.locked_by,
104
+ locked_by_name: C.locked_by_name ?? null
105
+ }), l.warning(
106
+ `${C.locked_by_name ?? "Another user"} took over editing — your changes are no longer being saved`
98
107
  ));
99
108
  });
100
- }, K), !0;
101
- } catch (f) {
102
- const l = f, t = l.status ?? ((s = l.response) == null ? void 0 : s.status), c = ((n = l.response) == null ? void 0 : n.data) ?? l.response;
103
- return M.current = t ?? null, H(f) ? !1 : t === 404 ? (T.current = !0, h(), i.current = !1, S(!1), !1) : (t === 409 && (c != null && c.locked_by) && (i.current = !1, S(!1), b({
109
+ }, Q), !0;
110
+ } catch (k) {
111
+ const u = k, t = u.status ?? ((s = u.response) == null ? void 0 : s.status), c = ((n = u.response) == null ? void 0 : n.data) ?? u.response;
112
+ return P.current = t ?? null, W(k) ? !1 : t === 404 ? (T.current = !0, v(), i.current = !1, R(!1), !1) : (t === 409 && (c != null && c.locked_by) && (i.current = !1, R(!1), m({
104
113
  locked_by: c.locked_by,
105
114
  locked_by_name: c.locked_by_name ?? null,
106
115
  ...typeof c.may_take_over == "boolean" ? { may_take_over: c.may_take_over } : {}
107
116
  })), !1);
108
117
  }
109
- }, [o, e, r, h, H]), y = w(async () => {
118
+ }, [a, e, r, v, W]), g = p(async () => {
110
119
  if (!(!e || !r))
111
120
  try {
112
- const s = await o.request(Ae(`/item-locks/${e}/${r}/lock`)), n = s == null ? void 0 : s.data;
113
- me(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), F(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
114
- const f = (n == null ? void 0 : n.is_mine) === !0 || !!k && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === k.toLowerCase(), l = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
121
+ const s = await a.request(Ae(`/item-locks/${e}/${r}/lock`)), n = s == null ? void 0 : s.data;
122
+ ke(Array.isArray(n == null ? void 0 : n.queue) ? n.queue : []), F(typeof (n == null ? void 0 : n.my_position) == "number" ? n.my_position : null);
123
+ const k = (n == null ? void 0 : n.is_mine) === !0 || !!f && String((n == null ? void 0 : n.locked_by) ?? "").toLowerCase() === f.toLowerCase(), u = typeof (n == null ? void 0 : n.may_take_over) == "boolean" ? { may_take_over: n.may_take_over } : {};
115
124
  if (i.current) return;
116
- if (!(n != null && n.locked_by) || f) {
117
- b(null);
125
+ if (!(n != null && n.locked_by) || k) {
126
+ m(null);
118
127
  return;
119
128
  }
120
- b(
129
+ m(
121
130
  (t) => t && t.locked_by === String(n.locked_by) ? {
122
131
  ...t,
123
132
  note: n.note ?? t.note ?? null,
124
133
  idle_minutes: n.locked_by_idle_minutes ?? t.idle_minutes ?? null,
125
- ...l
134
+ ...u
126
135
  } : {
127
136
  locked_by: String(n.locked_by),
128
137
  locked_by_name: n.locked_by_name ?? null,
129
138
  note: n.note ?? null,
130
139
  idle_minutes: n.locked_by_idle_minutes ?? null,
131
- ...l
140
+ ...u
132
141
  }
133
142
  ), U(!1);
134
143
  } catch (s) {
135
144
  (s == null ? void 0 : s.status) === 404 && (T.current = !0);
136
145
  }
137
- }, [o, e, r, k]), I = (R == null ? void 0 : R.locked_by) ?? null;
146
+ }, [a, e, r, f]), O = (w == null ? void 0 : w.locked_by) ?? null;
138
147
  N(() => {
139
- I && y();
140
- }, [I, y]), N(() => {
141
- if (!I) return;
142
- const s = setInterval(() => void y(), Me);
148
+ O && g();
149
+ }, [O, g]), N(() => {
150
+ if (!O) return;
151
+ const s = setInterval(() => void g(), Pe);
143
152
  return () => clearInterval(s);
144
- }, [I, y]), N(() => {
145
- if (!(!a || !e || !r))
146
- return C.current = !1, T.current = !1, g ? y() : d(), () => {
147
- h(), C.current = !1, i.current && (i.current = !1, o.request(P(`/item-locks/${e}/${r}/lock`)).then(() => X(k, "lock-released", e, r)).catch(() => {
153
+ }, [O, g]), N(() => {
154
+ if (!(!o || !e || !r))
155
+ return q.current = !1, T.current = !1, y ? g() : d(), () => {
156
+ v(), q.current = !1, i.current && (i.current = !1, a.request(K(`/item-locks/${e}/${r}/lock`)).then(() => X(f, "lock-released", e, r)).catch(() => {
148
157
  }));
149
158
  };
150
- }, [a, e, r, d, o, h, k, g, y]);
151
- const ge = w(async () => {
152
- if (!(!a || i.current || V.current) && !(Date.now() < W.current)) {
153
- V.current = !0;
159
+ }, [o, e, r, d, a, v, f, y, g]);
160
+ const we = p(async () => {
161
+ if (!(!o || i.current || H.current) && !(Date.now() < V.current)) {
162
+ H.current = !0;
154
163
  try {
155
164
  const s = await d();
156
- !s && M.current === 409 && u.warning("Someone else is editing this record — your change can’t be saved yet"), !s && M.current !== 409 && !T.current && (W.current = Date.now() + je);
165
+ !s && P.current === 409 && l.warning("Someone else is editing this record — your change can’t be saved yet"), !s && P.current !== 409 && !T.current && (V.current = Date.now() + je);
157
166
  } finally {
158
- V.current = !1;
167
+ H.current = !1;
159
168
  }
160
169
  }
161
- }, [a, d]);
170
+ }, [o, d]);
162
171
  N(() => {
163
172
  const s = () => {
164
- W.current = 0;
173
+ V.current = 0;
165
174
  };
166
175
  return window.addEventListener("online", s), () => window.removeEventListener("online", s);
167
176
  }, []);
168
- const j = w(() => {
177
+ const j = p(() => {
169
178
  var s;
170
179
  if (!(!e || !r))
171
180
  try {
172
- const n = (s = o.getToken) == null ? void 0 : s.call(o), f = o.url ?? "";
181
+ const n = (s = a.getToken) == null ? void 0 : s.call(a), k = a.url ?? "";
173
182
  fetch(
174
- `${f}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(r)}/lock/release`,
183
+ `${k}/api/item-locks/${encodeURIComponent(e)}/${encodeURIComponent(r)}/lock/release`,
175
184
  {
176
185
  method: "POST",
177
186
  keepalive: !0,
178
187
  credentials: n ? "omit" : "include",
179
188
  headers: n ? { Authorization: `Bearer ${n}` } : {}
180
189
  }
181
- ).then(() => X(k, "lock-released", e, r)).catch(() => {
190
+ ).then(() => X(f, "lock-released", e, r)).catch(() => {
182
191
  });
183
192
  } catch {
184
193
  }
185
- }, [o, e, r, k]), J = Pe(), we = ze(), z = p && J && we;
194
+ }, [a, e, r, f]), J = Ke(), xe = ze(), z = S && J && xe;
186
195
  N(() => {
187
- if (!(!a || !e || !r)) {
196
+ if (!(!o || !e || !r)) {
188
197
  if (z) {
189
- C.current && (C.current = !1, d().then((s) => {
190
- !s && M.current === 409 && u.warning(
198
+ q.current && (q.current = !1, d().then((s) => {
199
+ !s && P.current === 409 && l.warning(
191
200
  "Someone else started editing while you were away — your changes are still here, but can’t be saved until they release it"
192
201
  );
193
202
  }));
194
203
  return;
195
204
  }
196
- i.current && (h(), i.current = !1, S(!1), C.current = !0, J ? o.request(P(`/item-locks/${e}/${r}/lock`)).then(() => X(k, "lock-released", e, r)).catch(() => {
205
+ i.current && (v(), i.current = !1, R(!1), q.current = !0, J ? a.request(K(`/item-locks/${e}/${r}/lock`)).then(() => X(f, "lock-released", e, r)).catch(() => {
197
206
  }) : j());
198
207
  }
199
208
  }, [
200
- a,
209
+ o,
201
210
  z,
202
211
  J,
203
212
  e,
204
213
  r,
205
214
  d,
206
- o,
207
- h,
208
- k,
215
+ a,
216
+ v,
217
+ f,
209
218
  j
210
219
  ]), N(() => {
211
- if (!a || !g || !e || !r || I || !z) return;
220
+ if (!o || !y || !e || !r || O || !z) return;
212
221
  const s = setInterval(() => {
213
- !i.current && !T.current && y();
222
+ !i.current && !T.current && g();
214
223
  }, Be);
215
224
  return () => clearInterval(s);
216
- }, [a, g, e, r, I, z, y]), N(() => {
217
- if (!a || !e || !r) return;
225
+ }, [o, y, e, r, O, z, g]), N(() => {
226
+ if (!o || !e || !r) return;
218
227
  const s = () => {
219
- i.current && (h(), i.current = !1, C.current = !0, j());
220
- }, n = (f) => {
221
- f.persisted && C.current && (C.current = !1, d());
228
+ i.current && (v(), i.current = !1, q.current = !0, j());
229
+ }, n = (k) => {
230
+ k.persisted && q.current && (q.current = !1, d());
222
231
  };
223
232
  return window.addEventListener("pagehide", s), window.addEventListener("pageshow", n), () => {
224
233
  window.removeEventListener("pagehide", s), window.removeEventListener("pageshow", n);
225
234
  };
226
- }, [a, e, r, h, d, j]), Ye(k, "lock-released", e, r, () => {
227
- a && i.current && d();
235
+ }, [o, e, r, v, d, j]), Me(f, "lock-released", e, r, () => {
236
+ o && i.current && d();
228
237
  });
229
- const G = le();
238
+ const G = ue();
230
239
  N(() => {
231
- if (!(!a || !G || !e || !r))
240
+ if (!(!o || !G || !e || !r))
232
241
  return G.subscribeCollections([e], (s) => {
233
242
  var n;
234
- i.current || T.current || !((n = s.changed_fields) != null && n.includes("$lock")) || !Oe(s, r) || y();
243
+ i.current || T.current || !((n = s.changed_fields) != null && n.includes("$lock")) || !De(s, r) || g();
235
244
  });
236
- }, [a, G, e, r, y]);
237
- const O = le(), [xe, se] = x(!1), _e = w(async () => {
245
+ }, [o, G, e, r, g]);
246
+ const D = ue(), [_e, se] = L(!1), pe = p(async () => {
238
247
  if (!(!e || !r)) {
239
248
  se(!0);
240
249
  try {
241
- await o.request(q(`/item-locks/${e}/${r}/lock/request`, {})), u.success("Asked the current editor to release the lock");
250
+ await a.request(I(`/item-locks/${e}/${r}/lock/request`, {})), l.success("Asked the current editor to release the lock");
242
251
  } catch {
243
- u.error("Could not send the lock request");
252
+ l.error("Could not send the lock request");
244
253
  } finally {
245
254
  se(!1);
246
255
  }
247
256
  }
248
- }, [o, e, r]);
257
+ }, [a, e, r]);
249
258
  N(() => {
250
- if (!O || !e || !r) return;
251
- const s = O.on("lock:requested", (t) => {
259
+ if (!D || !e || !r) return;
260
+ const s = D.on("lock:requested", (t) => {
252
261
  if ((t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || !i.current) return;
253
262
  const c = (t == null ? void 0 : t.from) ?? {};
254
- u(`${c.name ?? "Someone"} is asking you to release this record`, {
263
+ l(`${c.name ?? "Someone"} is asking you to release this record`, {
255
264
  duration: 3e4,
256
265
  action: {
257
266
  label: "Release",
258
267
  onClick: () => {
259
- h(), i.current = !1, S(!1), o.request(
260
- q(`/item-locks/${e}/${r}/lock/respond`, {
268
+ v(), i.current = !1, R(!1), a.request(
269
+ I(`/item-locks/${e}/${r}/lock/respond`, {
261
270
  to: c.id,
262
271
  action: "release"
263
272
  })
264
- ).then(() => u.success("Lock released")).catch(() => u.error("Failed to release the lock"));
273
+ ).then(() => l.success("Lock released")).catch(() => l.error("Failed to release the lock"));
265
274
  }
266
275
  },
267
276
  cancel: {
268
277
  label: "Keep editing",
269
278
  onClick: () => {
270
- o.request(
271
- q(`/item-locks/${e}/${r}/lock/respond`, {
279
+ a.request(
280
+ I(`/item-locks/${e}/${r}/lock/respond`, {
272
281
  to: c.id,
273
282
  action: "decline"
274
283
  })
@@ -277,127 +286,127 @@ function rt(e, r, a, _ = {}) {
277
286
  }
278
287
  }
279
288
  });
280
- }), n = O.on("lock:response", (t) => {
281
- var c, E;
282
- (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || i.current || ((t == null ? void 0 : t.action) === "release" ? (u.success(`${((c = t == null ? void 0 : t.from) == null ? void 0 : c.name) ?? "The editor"} released the lock — it's yours`), d()) : u.warning(
283
- `${((E = t == null ? void 0 : t.from) == null ? void 0 : E.name) ?? "The editor"} is keeping the lock${t != null && t.note ? `: "${t.note}"` : ""}`
289
+ }), n = D.on("lock:response", (t) => {
290
+ var c, C;
291
+ (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || i.current || ((t == null ? void 0 : t.action) === "release" ? (l.success(`${((c = t == null ? void 0 : t.from) == null ? void 0 : c.name) ?? "The editor"} released the lock — it's yours`), d()) : l.warning(
292
+ `${((C = t == null ? void 0 : t.from) == null ? void 0 : C.name) ?? "The editor"} is keeping the lock${t != null && t.note ? `: "${t.note}"` : ""}`
284
293
  ));
285
- }), f = O.on("lock:available", (t) => {
286
- (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || i.current || (u.success("Your turn — the edit lock is yours"), F(null), d());
287
- }), l = O.on("lock:queued", (t) => {
288
- (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || (i.current && u(`${(t == null ? void 0 : t.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), y());
294
+ }), k = D.on("lock:available", (t) => {
295
+ (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || i.current || (l.success("Your turn — the edit lock is yours"), F(null), d());
296
+ }), u = D.on("lock:queued", (t) => {
297
+ (t == null ? void 0 : t.collection) !== e || String(t == null ? void 0 : t.item) !== String(r) || (i.current && l(`${(t == null ? void 0 : t.user_name) ?? "Someone"} is waiting to edit this record`, { duration: 8e3 }), g());
289
298
  });
290
299
  return () => {
291
- s(), n(), f(), l();
300
+ s(), n(), k(), u();
292
301
  };
293
- }, [O, e, r, o, d, h, y]);
294
- const pe = w(async () => {
302
+ }, [D, e, r, a, d, v, g]);
303
+ const Le = p(async () => {
295
304
  if (!(!e || !r)) {
296
305
  te(!0);
297
306
  try {
298
- const s = await o.request(
299
- q(`/item-locks/${e}/${r}/lock/queue`, {})
307
+ const s = await a.request(
308
+ I(`/item-locks/${e}/${r}/lock/queue`, {})
300
309
  ), n = s == null ? void 0 : s.data;
301
310
  if (n != null && n.free) {
302
- F(null), b(null), u.success("Nobody is editing this record now — go ahead");
311
+ F(null), m(null), l.success("Nobody is editing this record now — go ahead");
303
312
  return;
304
313
  }
305
- const f = n == null ? void 0 : n.position;
306
- F(typeof f == "number" ? f : 1), u.success("You are in line — the lock comes to you automatically when it frees up"), y();
314
+ const k = n == null ? void 0 : n.position;
315
+ F(typeof k == "number" ? k : 1), l.success("You are in line — the lock comes to you automatically when it frees up"), g();
307
316
  } catch {
308
- u.error("Could not join the queue");
317
+ l.error("Could not join the queue");
309
318
  } finally {
310
319
  te(!1);
311
320
  }
312
321
  }
313
- }, [o, e, r, y]), Le = w(async () => {
322
+ }, [a, e, r, g]), Ee = p(async () => {
314
323
  if (!(!e || !r))
315
324
  try {
316
- await o.request(P(`/item-locks/${e}/${r}/lock/queue`)), F(null), y();
325
+ await a.request(K(`/item-locks/${e}/${r}/lock/queue`)), F(null), g();
317
326
  } catch {
318
327
  }
319
- }, [o, e, r, y]), $e = w(
328
+ }, [a, e, r, g]), $e = p(
320
329
  async (s) => {
321
330
  if (!(!e || !r || !i.current)) {
322
331
  re(s);
323
332
  try {
324
- await o.request(q(`/item-locks/${e}/${r}/lock/note`, { note: s }));
333
+ await a.request(I(`/item-locks/${e}/${r}/lock/note`, { note: s }));
325
334
  } catch {
326
335
  }
327
336
  }
328
337
  },
329
- [o, e, r]
330
- ), Ee = w(async () => {
338
+ [a, e, r]
339
+ ), Ce = p(async () => {
331
340
  if (!(!e || !r || !i.current)) {
332
- ne(!0), h(), i.current = !1, S(!1);
341
+ ne(!0), v(), i.current = !1, R(!1);
333
342
  try {
334
- await o.request(P(`/item-locks/${e}/${r}/lock`)), U(!0), re(""), u.success("Lock released — anyone can edit this record now");
343
+ await a.request(K(`/item-locks/${e}/${r}/lock`)), U(!0), re(""), l.success("Lock released — anyone can edit this record now");
335
344
  } catch {
336
- u.error("Failed to release the lock"), d();
345
+ l.error("Failed to release the lock"), d();
337
346
  } finally {
338
347
  ne(!1);
339
348
  }
340
349
  }
341
- }, [o, e, r, h, d]), Ne = w(async () => {
350
+ }, [a, e, r, v, d]), Ne = p(async () => {
342
351
  if (i.current) return !0;
343
352
  const s = await d();
344
- return s && u.success("You hold the edit lock again"), s;
345
- }, [d]), Re = w(async () => {
353
+ return s && l.success("You hold the edit lock again"), s;
354
+ }, [d]), Re = p(async () => {
346
355
  var s;
347
356
  if (!(!e || !r)) {
348
357
  ee(!0);
349
358
  try {
350
- await o.request(
351
- q(`/item-locks/${e}/${r}/lock/force`, { beat_ms: K })
352
- ), u.success("You now hold the edit lock"), await d();
359
+ await a.request(
360
+ I(`/item-locks/${e}/${r}/lock/force`, { beat_ms: Q })
361
+ ), l.success("You now hold the edit lock"), await d();
353
362
  } catch (n) {
354
- const f = ((s = n == null ? void 0 : n.response) == null ? void 0 : s.error) ?? "Failed to take over the lock";
355
- u.error(f), (n == null ? void 0 : n.status) === 403 && b((l) => l && { ...l, may_take_over: !1 });
363
+ const k = ((s = n == null ? void 0 : n.response) == null ? void 0 : s.error) ?? "Failed to take over the lock";
364
+ l.error(k), (n == null ? void 0 : n.status) === 403 && m((u) => u && { ...u, may_take_over: !1 });
356
365
  } finally {
357
366
  ee(!1);
358
367
  }
359
368
  }
360
- }, [o, e, r, d]);
369
+ }, [a, e, r, d]);
361
370
  return {
362
- lockHolder: R,
363
- acquired: Q,
364
- isReadOnly: !!R,
371
+ lockHolder: w,
372
+ acquired: _,
373
+ isReadOnly: !!w,
365
374
  takeOver: Re,
366
- takingOver: D,
367
- isAdmin: L,
368
- requestLock: _e,
369
- requesting: xe,
370
- queue: fe,
375
+ takingOver: Y,
376
+ isAdmin: $,
377
+ requestLock: pe,
378
+ requesting: _e,
379
+ queue: me,
371
380
  myPosition: he,
372
- joinQueue: pe,
373
- leaveQueue: Le,
374
- joining: ke,
375
- myNote: be,
381
+ joinQueue: Le,
382
+ leaveQueue: Ee,
383
+ joining: be,
384
+ myNote: ve,
376
385
  saveNote: $e,
377
- release: Ee,
378
- releasing: ve,
386
+ release: Ce,
387
+ releasing: ge,
379
388
  released: ye,
380
389
  relock: Ne,
381
- claim: ge
390
+ claim: we
382
391
  };
383
392
  }
384
- function nt({
393
+ function st({
385
394
  note: e,
386
395
  onSave: r,
387
- waiting: a,
388
- onRelease: _,
389
- releasing: g,
390
- released: p,
391
- onRelock: o
396
+ waiting: o,
397
+ onRelease: E,
398
+ releasing: y,
399
+ released: S,
400
+ onRelock: a
392
401
  }) {
393
- var R;
394
- const [L, k] = x(e);
395
- N(() => k(e), [e]);
396
- const $ = () => {
397
- L.trim() !== e && r(L.trim());
402
+ var w;
403
+ const [$, f] = L(e);
404
+ N(() => f(e), [e]);
405
+ const b = () => {
406
+ $.trim() !== e && r($.trim());
398
407
  };
399
- return p ? /* @__PURE__ */ v(ue, { children: [
400
- /* @__PURE__ */ m(ce, { asChild: !0, children: /* @__PURE__ */ m(
408
+ return S ? /* @__PURE__ */ x(le, { children: [
409
+ /* @__PURE__ */ h(ce, { asChild: !0, children: /* @__PURE__ */ h(
401
410
  "button",
402
411
  {
403
412
  type: "button",
@@ -405,117 +414,117 @@ function nt({
405
414
  title: "Lock released — anyone can edit this record",
406
415
  "data-lock-released": !0,
407
416
  className: "relative inline-flex h-8 w-8 items-center justify-center text-slate-400 transition-colors hover:bg-accent hover:text-accent-foreground dark:text-slate-500",
408
- children: /* @__PURE__ */ m(ie, { className: "h-4 w-4", strokeWidth: 2 })
417
+ children: /* @__PURE__ */ h(ie, { className: "h-4 w-4", strokeWidth: 2 })
409
418
  }
410
419
  ) }),
411
- /* @__PURE__ */ v(de, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
412
- /* @__PURE__ */ m("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
413
- /* @__PURE__ */ m("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." }),
414
- /* @__PURE__ */ v(
415
- Y,
420
+ /* @__PURE__ */ x(de, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
421
+ /* @__PURE__ */ h("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You released the edit lock" }),
422
+ /* @__PURE__ */ h("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." }),
423
+ /* @__PURE__ */ x(
424
+ M,
416
425
  {
417
426
  type: "button",
418
427
  size: "sm",
419
428
  className: "mt-2 h-7 w-full text-[12px]",
420
- onClick: o,
429
+ onClick: a,
421
430
  "data-lock-relock": !0,
422
431
  children: [
423
- /* @__PURE__ */ m(Z, { className: "mr-1.5 h-3.5 w-3.5" }),
432
+ /* @__PURE__ */ h(Z, { className: "mr-1.5 h-3.5 w-3.5" }),
424
433
  " Lock again"
425
434
  ]
426
435
  }
427
436
  )
428
437
  ] })
429
- ] }) : /* @__PURE__ */ v(ue, { children: [
430
- /* @__PURE__ */ m(ce, { asChild: !0, children: /* @__PURE__ */ v(
438
+ ] }) : /* @__PURE__ */ x(le, { children: [
439
+ /* @__PURE__ */ h(ce, { asChild: !0, children: /* @__PURE__ */ x(
431
440
  "button",
432
441
  {
433
442
  type: "button",
434
443
  "aria-label": "You hold the edit lock — add a note for others",
435
- title: a.length > 0 ? `You hold the edit lock · ${a.length} waiting` : "You hold the edit lock",
444
+ title: o.length > 0 ? `You hold the edit lock · ${o.length} waiting` : "You hold the edit lock",
436
445
  "data-lock-holder": !0,
437
446
  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",
438
447
  children: [
439
- /* @__PURE__ */ m(Z, { className: "h-4 w-4", strokeWidth: 2 }),
440
- a.length > 0 && /* @__PURE__ */ m("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
448
+ /* @__PURE__ */ h(Z, { className: "h-4 w-4", strokeWidth: 2 }),
449
+ o.length > 0 && /* @__PURE__ */ h("span", { className: "absolute right-1 top-1 h-1.5 w-1.5 rounded-full bg-amber-500 ring-2 ring-background" })
441
450
  ]
442
451
  }
443
452
  ) }),
444
- /* @__PURE__ */ v(de, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
445
- /* @__PURE__ */ m("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You hold the edit lock" }),
446
- /* @__PURE__ */ m("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Others see this record read-only. A note tells them what you’re doing." }),
447
- /* @__PURE__ */ m(
453
+ /* @__PURE__ */ x(de, { align: "end", sideOffset: 6, className: "w-[300px] p-3", children: [
454
+ /* @__PURE__ */ h("p", { className: "text-[12px] font-semibold text-slate-700 dark:text-slate-200", children: "You hold the edit lock" }),
455
+ /* @__PURE__ */ h("p", { className: "mt-0.5 text-[11px] text-slate-500 dark:text-slate-400", children: "Others see this record read-only. A note tells them what you’re doing." }),
456
+ /* @__PURE__ */ h(
448
457
  "input",
449
458
  {
450
- value: L,
451
- onChange: (b) => k(b.target.value.slice(0, 300)),
452
- onBlur: $,
453
- onKeyDown: (b) => {
454
- b.key === "Enter" && (b.preventDefault(), $());
459
+ value: $,
460
+ onChange: (m) => f(m.target.value.slice(0, 300)),
461
+ onBlur: b,
462
+ onKeyDown: (m) => {
463
+ m.key === "Enter" && (m.preventDefault(), b());
455
464
  },
456
465
  placeholder: "“editing lines, ~15 min”",
457
466
  "aria-label": "Lock note",
458
467
  className: "mt-2 h-7 w-full rounded-md border border-slate-200 bg-white px-2 text-[12px] dark:border-border dark:bg-card"
459
468
  }
460
469
  ),
461
- a.length > 0 && /* @__PURE__ */ v("div", { className: "mt-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-800 dark:bg-amber-500/10 dark:text-amber-200", children: [
462
- /* @__PURE__ */ v("span", { className: "font-semibold", children: [
463
- a.length,
470
+ o.length > 0 && /* @__PURE__ */ x("div", { className: "mt-2 rounded-md bg-amber-50 px-2 py-1.5 text-[11px] text-amber-800 dark:bg-amber-500/10 dark:text-amber-200", children: [
471
+ /* @__PURE__ */ x("span", { className: "font-semibold", children: [
472
+ o.length,
464
473
  " waiting for the lock:"
465
474
  ] }),
466
475
  " ",
467
- a.map((b) => b.name ?? "someone").join(", ")
476
+ o.map((m) => m.name ?? "someone").join(", ")
468
477
  ] }),
469
- _ && /* @__PURE__ */ v(
470
- Y,
478
+ E && /* @__PURE__ */ x(
479
+ M,
471
480
  {
472
481
  type: "button",
473
482
  variant: "outline",
474
483
  size: "sm",
475
484
  className: "mt-2 h-7 w-full text-[12px]",
476
- onClick: _,
477
- disabled: g,
485
+ onClick: E,
486
+ disabled: y,
478
487
  "data-lock-release": !0,
479
488
  children: [
480
- /* @__PURE__ */ m(ie, { className: "mr-1.5 h-3.5 w-3.5" }),
481
- g ? "Releasing…" : a.length > 0 ? `Release lock to ${((R = a[0]) == null ? void 0 : R.name) ?? "the next person"}` : "Release lock"
489
+ /* @__PURE__ */ h(ie, { className: "mr-1.5 h-3.5 w-3.5" }),
490
+ y ? "Releasing…" : o.length > 0 ? `Release lock to ${((w = o[0]) == null ? void 0 : w.name) ?? "the next person"}` : "Release lock"
482
491
  ]
483
492
  }
484
493
  )
485
494
  ] })
486
495
  ] });
487
496
  }
488
- function st({
497
+ function at({
489
498
  lockHolder: e,
490
499
  onTakeOver: r,
491
- takingOver: a,
492
- isAdmin: _,
493
- onRequestLock: g,
494
- requesting: p,
495
- queue: o,
496
- myPosition: L,
497
- onJoinQueue: k,
498
- onLeaveQueue: $,
499
- joining: R,
500
- noun: b = "this item",
501
- readOnlyText: Q = "fields are read-only"
500
+ takingOver: o,
501
+ isAdmin: E,
502
+ onRequestLock: y,
503
+ requesting: S,
504
+ queue: a,
505
+ myPosition: $,
506
+ onJoinQueue: f,
507
+ onLeaveQueue: b,
508
+ joining: w,
509
+ noun: m = "this item",
510
+ readOnlyText: _ = "fields are read-only"
502
511
  }) {
503
512
  if (!e) return null;
504
- const S = e.locked_by_name || "Another user", D = (o == null ? void 0 : o.length) ?? 0;
505
- return /* @__PURE__ */ v(
513
+ const R = e.locked_by_name || "Another user", Y = (a == null ? void 0 : a.length) ?? 0;
514
+ return /* @__PURE__ */ x(
506
515
  "div",
507
516
  {
508
517
  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",
509
518
  "data-lock-banner": !0,
510
519
  children: [
511
- /* @__PURE__ */ m(Z, { className: "h-4 w-4 shrink-0 text-amber-500" }),
512
- /* @__PURE__ */ v("span", { className: "min-w-0 flex-1", children: [
513
- /* @__PURE__ */ m("span", { className: "font-medium", children: S }),
520
+ /* @__PURE__ */ h(Z, { className: "h-4 w-4 shrink-0 text-amber-500" }),
521
+ /* @__PURE__ */ x("span", { className: "min-w-0 flex-1", children: [
522
+ /* @__PURE__ */ h("span", { className: "font-medium", children: R }),
514
523
  " is editing ",
515
- b,
524
+ m,
516
525
  " — ",
517
- Q,
518
- e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */ v(
526
+ _,
527
+ e.idle_minutes != null && e.idle_minutes >= 2 && /* @__PURE__ */ x(
519
528
  "span",
520
529
  {
521
530
  className: "ml-1.5 rounded bg-amber-100 px-1 py-px text-[10px] font-semibold text-amber-700 dark:bg-amber-500/20 dark:text-amber-200",
@@ -530,67 +539,67 @@ function st({
530
539
  ),
531
540
  " ",
532
541
  "until the lock is released.",
533
- e.note && /* @__PURE__ */ v("span", { className: "mt-0.5 block text-[12.5px] text-amber-800/90 dark:text-amber-200/90", children: [
542
+ e.note && /* @__PURE__ */ x("span", { className: "mt-0.5 block text-[12.5px] text-amber-800/90 dark:text-amber-200/90", children: [
534
543
  "“",
535
544
  e.note,
536
545
  "”"
537
546
  ] }),
538
- D > 0 && L == null && /* @__PURE__ */ v("span", { className: "mt-0.5 block text-[11.5px] text-amber-700/80 dark:text-amber-300/80", children: [
539
- D,
547
+ Y > 0 && $ == null && /* @__PURE__ */ x("span", { className: "mt-0.5 block text-[11.5px] text-amber-700/80 dark:text-amber-300/80", children: [
548
+ Y,
540
549
  " ",
541
- D === 1 ? "person is" : "people are",
550
+ Y === 1 ? "person is" : "people are",
542
551
  " already waiting."
543
552
  ] })
544
553
  ] }),
545
- k && (L != null ? /* @__PURE__ */ v(
546
- Y,
554
+ f && ($ != null ? /* @__PURE__ */ x(
555
+ M,
547
556
  {
548
557
  size: "sm",
549
558
  variant: "outline",
550
559
  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",
551
- onClick: $,
560
+ onClick: b,
552
561
  "data-lock-queue-leave": !0,
553
562
  children: [
554
563
  "You’re #",
555
- L,
564
+ $,
556
565
  " in line · Leave"
557
566
  ]
558
567
  }
559
- ) : /* @__PURE__ */ m(
560
- Y,
568
+ ) : /* @__PURE__ */ h(
569
+ M,
561
570
  {
562
571
  size: "sm",
563
572
  variant: "outline",
564
573
  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",
565
- onClick: k,
566
- disabled: R,
574
+ onClick: f,
575
+ disabled: w,
567
576
  "data-lock-queue-join": !0,
568
- children: R ? "Joining…" : "Ask to be next"
577
+ children: w ? "Joining…" : "Ask to be next"
569
578
  }
570
579
  )),
571
- g && /* @__PURE__ */ m(
572
- Y,
580
+ y && /* @__PURE__ */ h(
581
+ M,
573
582
  {
574
583
  size: "sm",
575
584
  variant: "outline",
576
585
  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",
577
- onClick: g,
578
- disabled: p,
579
- children: p ? "Asking…" : "Ask them to wrap up"
586
+ onClick: y,
587
+ disabled: S,
588
+ children: S ? "Asking…" : "Ask them to wrap up"
580
589
  }
581
590
  ),
582
591
  // Admins always; other roles only when the server says they may (the
583
592
  // takeover-role allowlist, #256) — unknown = offered, and a 403 then
584
593
  // hides it. A Take over that can only fail was a dead end.
585
- (_ || e.may_take_over !== !1) && /* @__PURE__ */ m(
586
- Y,
594
+ (E || e.may_take_over !== !1) && /* @__PURE__ */ h(
595
+ M,
587
596
  {
588
597
  size: "sm",
589
598
  variant: "outline",
590
- 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" : "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",
599
+ className: E ? "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",
591
600
  onClick: r,
592
- disabled: a,
593
- children: a ? "Taking over…" : "Take over"
601
+ disabled: o,
602
+ children: o ? "Taking over…" : "Take over"
594
603
  }
595
604
  )
596
605
  ]
@@ -598,7 +607,7 @@ function st({
598
607
  );
599
608
  }
600
609
  export {
601
- st as ItemLockBanner,
602
- nt as LockHolderButton,
603
- rt as useItemLock
610
+ at as ItemLockBanner,
611
+ st as LockHolderButton,
612
+ nt as useItemLock
604
613
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.27",
3
+ "version": "0.3.28",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",