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