@nivaro/react 0.3.26 → 0.3.27

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