@camstack/addon-benchmark 1.2.75 → 1.2.77
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.
- package/dist/MotionZonesSettings-eYpT7AlR.mjs +310 -0
- package/dist/{PrivacyMaskSettings-DXpGM5pW.mjs → PrivacyMaskSettings-DUxztMZj.mjs} +74 -74
- package/dist/{SceneMonitorEditor-lpTf6mwb.mjs → SceneMonitorEditor-Dgs6usxP.mjs} +263 -263
- package/dist/_stub.js +4796 -4433
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_benchmark_page-svQhk19j.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_benchmark_page-_K_CZhSX.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Bc4oZcep.mjs +26 -0
- package/dist/addon-benchmark.css +1 -1
- package/dist/{hostInit-D2joiXRO.mjs → hostInit-C5OUkJ3z.mjs} +3 -3
- package/dist/{player-overlays-BbzXZwQq.mjs → player-overlays-CteLy01r.mjs} +4 -4
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-D-bem4Ch.mjs → responsive-C7dB7Lkh.mjs} +10 -6
- package/dist/{square-DAwyOzYA.mjs → square--duOP6VL.mjs} +1 -1
- package/dist/{trash-2-CzanZXM4.mjs → trash-2-q_St5qCh.mjs} +1 -1
- package/dist/{use-device-snapshot-COMqPMwB.mjs → use-device-snapshot-Df5ga5tF.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_benchmark_page__remoteEntry_js-BAAW3Ioc.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_benchmark_page__remoteEntry_js-BD9FyBap.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings-Cn35qvHx.mjs +0 -310
- package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-IwuGtfl1.mjs +0 -26
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { c as e, g as t, h as n, p as r, u as i, x as a } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-GeuxDuzQ.mjs";
|
|
2
|
+
import { c as o, n as s, o as c, r as ee, t as l } from "./responsive-C7dB7Lkh.mjs";
|
|
3
|
+
import { i as te, t as u } from "./player-overlays-CteLy01r.mjs";
|
|
4
|
+
import { n as d, r as f, t as p } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-SOU_VnTj.mjs";
|
|
5
|
+
import { MaskShapeCanvas as m } from "./MaskShapeCanvas-BDvrLf-K.mjs";
|
|
6
|
+
var ne = o("grid-2x2", [
|
|
7
|
+
["path", {
|
|
8
|
+
d: "M12 3v18",
|
|
9
|
+
key: "108xh3"
|
|
10
|
+
}],
|
|
11
|
+
["path", {
|
|
12
|
+
d: "M3 12h18",
|
|
13
|
+
key: "1i2n21"
|
|
14
|
+
}],
|
|
15
|
+
["rect", {
|
|
16
|
+
x: "3",
|
|
17
|
+
y: "3",
|
|
18
|
+
width: "18",
|
|
19
|
+
height: "18",
|
|
20
|
+
rx: "2",
|
|
21
|
+
key: "h1oib"
|
|
22
|
+
}]
|
|
23
|
+
]);
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../ui-library/src/composites/cap-settings/MotionZonesSettings.tsx
|
|
26
|
+
a();
|
|
27
|
+
var re = 110, h = "motion-zones", g = 0, _ = [
|
|
28
|
+
1,
|
|
29
|
+
2,
|
|
30
|
+
3
|
|
31
|
+
], v = 1, y = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors", b = "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors";
|
|
32
|
+
function x(e, t, n) {
|
|
33
|
+
let r = t * n, i = Array.from({ length: r });
|
|
34
|
+
for (let t = 0; t < r; t += 1) i[t] = e[t] === !0;
|
|
35
|
+
return i;
|
|
36
|
+
}
|
|
37
|
+
function S(e, t) {
|
|
38
|
+
if (e.length !== t.length) return !1;
|
|
39
|
+
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
40
|
+
return !0;
|
|
41
|
+
}
|
|
42
|
+
function C(e, t) {
|
|
43
|
+
return Math.ceil(e / t);
|
|
44
|
+
}
|
|
45
|
+
function w(e, t, n) {
|
|
46
|
+
return Math.min(n - 1, Math.floor((e + .5) / t * n));
|
|
47
|
+
}
|
|
48
|
+
function T(e, t, n, r) {
|
|
49
|
+
let i = C(t, r), a = C(n, r), o = Array.from({ length: i * a }, () => !1);
|
|
50
|
+
for (let r = 0; r < n; r += 1) {
|
|
51
|
+
let s = w(r, n, a);
|
|
52
|
+
for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + w(n, t, i)] = !0);
|
|
53
|
+
}
|
|
54
|
+
return o;
|
|
55
|
+
}
|
|
56
|
+
function E(e, t, n, r) {
|
|
57
|
+
let i = C(t, r), a = C(n, r), o = Array.from({ length: t * n }, () => !1);
|
|
58
|
+
for (let r = 0; r < n; r += 1) {
|
|
59
|
+
let s = w(r, n, a);
|
|
60
|
+
for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + w(n, t, i)] === !0;
|
|
61
|
+
}
|
|
62
|
+
return o;
|
|
63
|
+
}
|
|
64
|
+
function D({ deviceId: a }) {
|
|
65
|
+
let o = ee(c().trpcClient, a), [w, D] = t(null), [O, k] = t(!1), [A, j] = t(null), [M, N] = t(null), [P, F] = t(v), [I, L] = t(!1), [R, z] = t(!1), B = n(!1);
|
|
66
|
+
i(() => {
|
|
67
|
+
if (!o) return;
|
|
68
|
+
let e = !1;
|
|
69
|
+
return B.current = !1, D(null), k(!1), j(null), N(null), F(v), z(!1), (async () => {
|
|
70
|
+
try {
|
|
71
|
+
let t = await o.motionZones?.getOptions({});
|
|
72
|
+
if (e) return;
|
|
73
|
+
if (!t) throw Error("device proxy not ready");
|
|
74
|
+
if (D(t), B.current) return;
|
|
75
|
+
let n = await o.motionZones?.getStatus({});
|
|
76
|
+
if (e) return;
|
|
77
|
+
if (!n) throw Error("device proxy not ready");
|
|
78
|
+
B.current = !0;
|
|
79
|
+
let r = n.regions.find((e) => e.shape.kind === "grid"), i = x(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
80
|
+
N(i), j(T(i, t.grid.width, t.grid.height, v));
|
|
81
|
+
} catch (t) {
|
|
82
|
+
if (e) return;
|
|
83
|
+
s(t) ? k(!0) : console.error("Motion Zones load failed", t);
|
|
84
|
+
}
|
|
85
|
+
})(), () => {
|
|
86
|
+
e = !0;
|
|
87
|
+
};
|
|
88
|
+
}, [o]);
|
|
89
|
+
let V = w ? w.grid.width : 0, H = w ? w.grid.height : 0, U = C(V, P), W = C(H, P), G = r(() => A && w ? E(A, V, H, P) : null, [
|
|
90
|
+
A,
|
|
91
|
+
w,
|
|
92
|
+
V,
|
|
93
|
+
H,
|
|
94
|
+
P
|
|
95
|
+
]), K = r(() => G !== null && M !== null && !S(G, M), [G, M]), q = r(() => G ? G.reduce((e, t) => t ? e + 1 : e, 0) : 0, [G]), J = V * H, Y = U * W, X = e((e) => {
|
|
96
|
+
Y > 0 && j(Array.from({ length: Y }, () => e));
|
|
97
|
+
}, [Y]), Z = e(() => {
|
|
98
|
+
j((e) => e && e.map((e) => !e));
|
|
99
|
+
}, []), ie = e(() => {
|
|
100
|
+
M && w && j(T(M, V, H, P));
|
|
101
|
+
}, [
|
|
102
|
+
M,
|
|
103
|
+
w,
|
|
104
|
+
V,
|
|
105
|
+
H,
|
|
106
|
+
P
|
|
107
|
+
]), ae = e((e) => {
|
|
108
|
+
e === P || !w || j((t) => {
|
|
109
|
+
if (!t) return F(e), t;
|
|
110
|
+
let n = T(E(t, V, H, P), V, H, e);
|
|
111
|
+
return F(e), n;
|
|
112
|
+
});
|
|
113
|
+
}, [
|
|
114
|
+
P,
|
|
115
|
+
w,
|
|
116
|
+
V,
|
|
117
|
+
H
|
|
118
|
+
]), Q = r(() => w && A ? [{
|
|
119
|
+
id: g,
|
|
120
|
+
shape: {
|
|
121
|
+
kind: "grid",
|
|
122
|
+
gridWidth: U,
|
|
123
|
+
gridHeight: W,
|
|
124
|
+
cells: [...A]
|
|
125
|
+
}
|
|
126
|
+
}] : [], [
|
|
127
|
+
w,
|
|
128
|
+
A,
|
|
129
|
+
U,
|
|
130
|
+
W
|
|
131
|
+
]), $ = e((e, t) => {
|
|
132
|
+
t.kind === "grid" && j(t.cells);
|
|
133
|
+
}, []), oe = e(async () => {
|
|
134
|
+
if (!(!o || !A || !w)) {
|
|
135
|
+
L(!0);
|
|
136
|
+
try {
|
|
137
|
+
let e = E(A, w.grid.width, w.grid.height, P), t = {
|
|
138
|
+
kind: "grid",
|
|
139
|
+
gridWidth: w.grid.width,
|
|
140
|
+
gridHeight: w.grid.height,
|
|
141
|
+
cells: e
|
|
142
|
+
};
|
|
143
|
+
await o.motionZones?.setZone({ patch: { regions: [{
|
|
144
|
+
id: g,
|
|
145
|
+
enabled: !0,
|
|
146
|
+
shape: t
|
|
147
|
+
}] } });
|
|
148
|
+
let n = await o.motionZones?.getStatus({});
|
|
149
|
+
if (n) {
|
|
150
|
+
let e = n.regions.find((e) => e.shape.kind === "grid"), t = x(e ? e.shape.cells : [], w.grid.width, w.grid.height);
|
|
151
|
+
N(t), j(T(t, w.grid.width, w.grid.height, P));
|
|
152
|
+
}
|
|
153
|
+
} catch (e) {
|
|
154
|
+
console.error("Motion Zones save failed", e);
|
|
155
|
+
} finally {
|
|
156
|
+
L(!1);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}, [
|
|
160
|
+
o,
|
|
161
|
+
A,
|
|
162
|
+
w,
|
|
163
|
+
P
|
|
164
|
+
]);
|
|
165
|
+
return u(r(() => R && !O && w && A ? {
|
|
166
|
+
id: h,
|
|
167
|
+
order: re,
|
|
168
|
+
node: /* @__PURE__ */ d(m, {
|
|
169
|
+
transparent: !0,
|
|
170
|
+
items: Q,
|
|
171
|
+
supportedShapes: ["grid"],
|
|
172
|
+
grid: {
|
|
173
|
+
width: U,
|
|
174
|
+
height: W
|
|
175
|
+
},
|
|
176
|
+
selectedId: g,
|
|
177
|
+
onSelect: () => {},
|
|
178
|
+
onShapeChange: $,
|
|
179
|
+
onDrawComplete: () => {},
|
|
180
|
+
drawingKind: null
|
|
181
|
+
})
|
|
182
|
+
} : null, [
|
|
183
|
+
R,
|
|
184
|
+
O,
|
|
185
|
+
w,
|
|
186
|
+
A,
|
|
187
|
+
Q,
|
|
188
|
+
$,
|
|
189
|
+
U,
|
|
190
|
+
W
|
|
191
|
+
])), o ? /* @__PURE__ */ d(te, {
|
|
192
|
+
title: "Motion Zones",
|
|
193
|
+
icon: /* @__PURE__ */ d(ne, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
194
|
+
children: /* @__PURE__ */ d("div", {
|
|
195
|
+
className: "flex flex-col gap-3",
|
|
196
|
+
children: O ? /* @__PURE__ */ d("p", {
|
|
197
|
+
className: `${l} leading-relaxed`,
|
|
198
|
+
children: "This camera doesn't expose an on-board motion zones grid."
|
|
199
|
+
}) : !O && w !== null && A !== null ? /* @__PURE__ */ f(p, { children: [/* @__PURE__ */ f("p", {
|
|
200
|
+
className: `${l} leading-relaxed`,
|
|
201
|
+
children: [
|
|
202
|
+
"Toggle ",
|
|
203
|
+
/* @__PURE__ */ d("strong", {
|
|
204
|
+
className: "text-foreground",
|
|
205
|
+
children: "Edit grid"
|
|
206
|
+
}),
|
|
207
|
+
" to paint the region directly on the live frame, then ",
|
|
208
|
+
/* @__PURE__ */ d("strong", {
|
|
209
|
+
className: "text-foreground",
|
|
210
|
+
children: "Save"
|
|
211
|
+
}),
|
|
212
|
+
" to push the mask to the camera. Pick a bigger",
|
|
213
|
+
" ",
|
|
214
|
+
/* @__PURE__ */ d("strong", {
|
|
215
|
+
className: "text-foreground",
|
|
216
|
+
children: "Cell size"
|
|
217
|
+
}),
|
|
218
|
+
" for quicker, broad-stroke painting — it's resampled to the camera's native ",
|
|
219
|
+
w.grid.width,
|
|
220
|
+
"×",
|
|
221
|
+
w.grid.height,
|
|
222
|
+
" grid on save (×1 is the finest)."
|
|
223
|
+
]
|
|
224
|
+
}), /* @__PURE__ */ f("div", {
|
|
225
|
+
className: "flex items-center gap-2 flex-wrap",
|
|
226
|
+
children: [
|
|
227
|
+
/* @__PURE__ */ d("button", {
|
|
228
|
+
type: "button",
|
|
229
|
+
onClick: () => z((e) => !e),
|
|
230
|
+
disabled: I,
|
|
231
|
+
"aria-pressed": R,
|
|
232
|
+
className: R ? b : y,
|
|
233
|
+
children: R ? "Done editing" : "Edit grid"
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ d("button", {
|
|
236
|
+
type: "button",
|
|
237
|
+
onClick: () => X(!0),
|
|
238
|
+
disabled: I,
|
|
239
|
+
className: y,
|
|
240
|
+
children: "All on"
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ d("button", {
|
|
243
|
+
type: "button",
|
|
244
|
+
onClick: () => X(!1),
|
|
245
|
+
disabled: I,
|
|
246
|
+
className: y,
|
|
247
|
+
children: "All off"
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ d("button", {
|
|
250
|
+
type: "button",
|
|
251
|
+
onClick: Z,
|
|
252
|
+
disabled: I,
|
|
253
|
+
className: y,
|
|
254
|
+
children: "Invert"
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ f("div", {
|
|
257
|
+
className: "flex items-center gap-1 ml-1",
|
|
258
|
+
role: "group",
|
|
259
|
+
"aria-label": "Cell size",
|
|
260
|
+
children: [/* @__PURE__ */ d("span", {
|
|
261
|
+
className: `${l} mr-0.5`,
|
|
262
|
+
children: "Cell size"
|
|
263
|
+
}), _.map((e) => /* @__PURE__ */ f("button", {
|
|
264
|
+
type: "button",
|
|
265
|
+
onClick: () => ae(e),
|
|
266
|
+
disabled: I,
|
|
267
|
+
"aria-pressed": P === e,
|
|
268
|
+
title: e === 1 ? `Camera grid ${V}×${H} (finest)` : `${C(V, e)}×${C(H, e)} painting grid · cells ×${e} bigger`,
|
|
269
|
+
className: P === e ? b : y,
|
|
270
|
+
children: ["×", e]
|
|
271
|
+
}, e))]
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ f("span", {
|
|
274
|
+
className: `${l} ml-1 tabular-nums`,
|
|
275
|
+
children: [
|
|
276
|
+
q,
|
|
277
|
+
" / ",
|
|
278
|
+
J,
|
|
279
|
+
" cells · ",
|
|
280
|
+
w.grid.width,
|
|
281
|
+
"×",
|
|
282
|
+
w.grid.height,
|
|
283
|
+
P === 1 ? "" : ` · paint ${U}×${W}`
|
|
284
|
+
]
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ d("span", { className: "flex-1" }),
|
|
287
|
+
/* @__PURE__ */ d("button", {
|
|
288
|
+
type: "button",
|
|
289
|
+
onClick: ie,
|
|
290
|
+
disabled: I || !K,
|
|
291
|
+
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
292
|
+
children: "Revert"
|
|
293
|
+
}),
|
|
294
|
+
/* @__PURE__ */ d("button", {
|
|
295
|
+
type: "button",
|
|
296
|
+
onClick: () => void oe(),
|
|
297
|
+
disabled: I || !K,
|
|
298
|
+
className: b,
|
|
299
|
+
children: I ? "Saving…" : "Save"
|
|
300
|
+
})
|
|
301
|
+
]
|
|
302
|
+
})] }) : /* @__PURE__ */ d("p", {
|
|
303
|
+
className: `${l} leading-relaxed`,
|
|
304
|
+
children: "Loading the camera's grid…"
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
}) : null;
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
export { D as MotionZonesSettings };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { c as e, g as t, h as n, p as r, u as i, x as a } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-GeuxDuzQ.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { i as re, t as c } from "./player-overlays-
|
|
4
|
-
import { n as l, r as
|
|
5
|
-
import { t as
|
|
6
|
-
import { n as
|
|
7
|
-
import { MaskShapeCanvas as
|
|
8
|
-
var
|
|
2
|
+
import { c as o, n as ee, o as te, r as ne, t as s } from "./responsive-C7dB7Lkh.mjs";
|
|
3
|
+
import { i as re, t as c } from "./player-overlays-CteLy01r.mjs";
|
|
4
|
+
import { n as l, r as u, t as ie } from "./square--duOP6VL.mjs";
|
|
5
|
+
import { t as ae } from "./trash-2-q_St5qCh.mjs";
|
|
6
|
+
import { n as d, r as f, t as oe } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-SOU_VnTj.mjs";
|
|
7
|
+
import { MaskShapeCanvas as se } from "./MaskShapeCanvas-BDvrLf-K.mjs";
|
|
8
|
+
var ce = o("hexagon", [["path", {
|
|
9
9
|
d: "M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",
|
|
10
10
|
key: "yt0hxn"
|
|
11
|
-
}]]),
|
|
11
|
+
}]]), le = o("mic-off", [
|
|
12
12
|
["path", {
|
|
13
13
|
d: "M12 19v3",
|
|
14
14
|
key: "npa21l"
|
|
@@ -37,47 +37,47 @@ var le = o("hexagon", [["path", {
|
|
|
37
37
|
//#endregion
|
|
38
38
|
//#region ../ui-library/src/composites/cap-settings/privacy-mask-audio.ts
|
|
39
39
|
a();
|
|
40
|
-
var
|
|
41
|
-
function
|
|
40
|
+
var p = "Microphone", m = "The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.";
|
|
41
|
+
function ue(e) {
|
|
42
42
|
let t = e.supportsAudioMute === !0, n = t ? e.audioEnabled : null, r = e.pendingOn ?? null;
|
|
43
43
|
return {
|
|
44
|
-
label:
|
|
44
|
+
label: p,
|
|
45
45
|
supported: t,
|
|
46
46
|
on: n === null ? null : r ?? n,
|
|
47
47
|
available: t && n !== null,
|
|
48
|
-
costWhenOff:
|
|
48
|
+
costWhenOff: m
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
function
|
|
51
|
+
function h(e) {
|
|
52
52
|
return !e.available || e.on === null ? null : { enabled: !e.on };
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
55
55
|
//#region ../ui-library/src/composites/cap-settings/PrivacyMaskSettings.tsx
|
|
56
|
-
var
|
|
57
|
-
function
|
|
56
|
+
var g = 120, de = "privacy-mask", _ = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors", v = "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors";
|
|
57
|
+
function y(e) {
|
|
58
58
|
return e.kind === "rect" || e.kind === "polygon" ? e : null;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function fe(e) {
|
|
61
61
|
let t = new Set(e.map((e) => e.id)), n = 0;
|
|
62
62
|
for (; t.has(n);) n += 1;
|
|
63
63
|
return n;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function pe(e, t) {
|
|
66
66
|
if (e.length !== t.length) return !1;
|
|
67
67
|
for (let n = 0; n < e.length; n += 1) if (JSON.stringify(e[n]) !== JSON.stringify(t[n])) return !1;
|
|
68
68
|
return !0;
|
|
69
69
|
}
|
|
70
70
|
function b({ deviceId: a }) {
|
|
71
|
-
let o = ne(
|
|
71
|
+
let o = ne(te().trpcClient, a), [p, m] = t(null), [b, x] = t(!1), [S, C] = t(null), [w, T] = t(null), [E, D] = t(!1), [O, k] = t(!1), [A, j] = t(null), [M, N] = t(null), [me, P] = t(null), [F, I] = t(null), [L, R] = t(null), z = n(!1);
|
|
72
72
|
i(() => {
|
|
73
73
|
if (!o) return;
|
|
74
74
|
let e = !1;
|
|
75
|
-
return z.current = !1,
|
|
75
|
+
return z.current = !1, m(null), x(!1), C(null), T(null), k(!1), j(null), N(null), P(null), I(null), R(null), (async () => {
|
|
76
76
|
try {
|
|
77
77
|
let t = await o.privacyMask?.getOptions({});
|
|
78
78
|
if (e) return;
|
|
79
79
|
if (!t) throw Error("device proxy not ready");
|
|
80
|
-
if (
|
|
80
|
+
if (m(t), z.current) return;
|
|
81
81
|
let n = await o.privacyMask?.getStatus({});
|
|
82
82
|
if (e) return;
|
|
83
83
|
if (!n) throw Error("device proxy not ready");
|
|
@@ -89,13 +89,13 @@ function b({ deviceId: a }) {
|
|
|
89
89
|
T(r), C(r), P(n.audioEnabled);
|
|
90
90
|
} catch (t) {
|
|
91
91
|
if (e) return;
|
|
92
|
-
|
|
92
|
+
ee(t) ? x(!0) : console.error("Privacy Mask load failed", t);
|
|
93
93
|
}
|
|
94
94
|
})(), () => {
|
|
95
95
|
e = !0;
|
|
96
96
|
};
|
|
97
97
|
}, [o]);
|
|
98
|
-
let B = r(() => S !== null && w !== null && (S.enabled !== w.enabled || !
|
|
98
|
+
let B = r(() => S !== null && w !== null && (S.enabled !== w.enabled || !pe(S.regions, w.regions)), [S, w]), V = S ? S.regions.length : 0, H = p ? p.maxRegions : 0, U = n(0);
|
|
99
99
|
i(() => {
|
|
100
100
|
U.current = H;
|
|
101
101
|
}, [H]);
|
|
@@ -112,7 +112,7 @@ function b({ deviceId: a }) {
|
|
|
112
112
|
enabled: e.enabled,
|
|
113
113
|
label: `Zone ${String(e.id)}`
|
|
114
114
|
})) : [], [S]), q = e((e, t) => {
|
|
115
|
-
let n =
|
|
115
|
+
let n = y(t);
|
|
116
116
|
n && C((t) => t && {
|
|
117
117
|
...t,
|
|
118
118
|
regions: t.regions.map((t) => t.id === e ? {
|
|
@@ -121,12 +121,12 @@ function b({ deviceId: a }) {
|
|
|
121
121
|
} : t)
|
|
122
122
|
});
|
|
123
123
|
}, []), J = e((e) => {
|
|
124
|
-
let t =
|
|
124
|
+
let t = y(e);
|
|
125
125
|
t && (N(null), C((e) => {
|
|
126
126
|
if (!e) return e;
|
|
127
127
|
let n = U.current;
|
|
128
128
|
if (n > 0 && e.regions.length >= n) return e;
|
|
129
|
-
let r =
|
|
129
|
+
let r = fe(e.regions), i = {
|
|
130
130
|
id: r,
|
|
131
131
|
enabled: !0,
|
|
132
132
|
shape: t
|
|
@@ -172,12 +172,12 @@ function b({ deviceId: a }) {
|
|
|
172
172
|
D(!1);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
}, [o, S]), Z =
|
|
176
|
-
supportsAudioMute:
|
|
175
|
+
}, [o, S]), Z = ue({
|
|
176
|
+
supportsAudioMute: p === null ? null : p.supportsAudioMute,
|
|
177
177
|
audioEnabled: me,
|
|
178
178
|
pendingOn: F
|
|
179
179
|
}), ye = e(async () => {
|
|
180
|
-
let e =
|
|
180
|
+
let e = h(Z);
|
|
181
181
|
if (!(!o || e === null)) {
|
|
182
182
|
I(e.enabled), R(null);
|
|
183
183
|
try {
|
|
@@ -192,15 +192,15 @@ function b({ deviceId: a }) {
|
|
|
192
192
|
}
|
|
193
193
|
}, [o, Z]), be = e(() => {
|
|
194
194
|
k((e) => (e && (N(null), j(null)), !e));
|
|
195
|
-
}, []), Q =
|
|
196
|
-
c(r(() => O && !b &&
|
|
197
|
-
id:
|
|
198
|
-
order:
|
|
199
|
-
node: /* @__PURE__ */
|
|
195
|
+
}, []), Q = p?.supportedShapes ?? [];
|
|
196
|
+
c(r(() => O && !b && p && S ? {
|
|
197
|
+
id: de,
|
|
198
|
+
order: g,
|
|
199
|
+
node: /* @__PURE__ */ d(se, {
|
|
200
200
|
transparent: !0,
|
|
201
201
|
items: K,
|
|
202
202
|
supportedShapes: Q,
|
|
203
|
-
polygonVertices:
|
|
203
|
+
polygonVertices: p.polygonVertices,
|
|
204
204
|
selectedId: A,
|
|
205
205
|
onSelect: G,
|
|
206
206
|
onShapeChange: q,
|
|
@@ -210,7 +210,7 @@ function b({ deviceId: a }) {
|
|
|
210
210
|
} : null, [
|
|
211
211
|
O,
|
|
212
212
|
b,
|
|
213
|
-
|
|
213
|
+
p,
|
|
214
214
|
S,
|
|
215
215
|
K,
|
|
216
216
|
Q,
|
|
@@ -220,70 +220,70 @@ function b({ deviceId: a }) {
|
|
|
220
220
|
J,
|
|
221
221
|
M
|
|
222
222
|
]));
|
|
223
|
-
let xe =
|
|
224
|
-
return o ? /* @__PURE__ */
|
|
223
|
+
let xe = p?.supportedShapes.includes("rect") ?? !1, Se = p?.supportedShapes.includes("polygon") ?? !1, $ = p !== null && (p.maxRegions <= 0 || p.supportedShapes.length === 0);
|
|
224
|
+
return o ? /* @__PURE__ */ d(re, {
|
|
225
225
|
title: "Privacy Mask",
|
|
226
|
-
icon: /* @__PURE__ */ u
|
|
227
|
-
children: /* @__PURE__ */
|
|
226
|
+
icon: /* @__PURE__ */ d(u, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
227
|
+
children: /* @__PURE__ */ f("div", {
|
|
228
228
|
className: "flex flex-col gap-3",
|
|
229
|
-
children: [b || $ ? /* @__PURE__ */
|
|
229
|
+
children: [b || $ ? /* @__PURE__ */ d("p", {
|
|
230
230
|
className: `${s} leading-relaxed`,
|
|
231
231
|
children: "This camera doesn't support an on-board privacy mask."
|
|
232
|
-
}) : !b && !$ &&
|
|
233
|
-
/* @__PURE__ */
|
|
232
|
+
}) : !b && !$ && p !== null && S !== null ? /* @__PURE__ */ f(oe, { children: [
|
|
233
|
+
/* @__PURE__ */ f("p", {
|
|
234
234
|
className: `${s} leading-relaxed`,
|
|
235
235
|
children: [
|
|
236
236
|
"Toggle ",
|
|
237
|
-
/* @__PURE__ */
|
|
237
|
+
/* @__PURE__ */ d("strong", {
|
|
238
238
|
className: "text-foreground",
|
|
239
239
|
children: "Edit mask"
|
|
240
240
|
}),
|
|
241
241
|
" to draw blanked-out zones on the live frame, then ",
|
|
242
|
-
/* @__PURE__ */
|
|
242
|
+
/* @__PURE__ */ d("strong", {
|
|
243
243
|
className: "text-foreground",
|
|
244
244
|
children: "Save"
|
|
245
245
|
}),
|
|
246
246
|
" to push them to the camera. Drag a rectangle to move, its corner to resize; drag polygon vertices, click an edge midpoint to add one, or right-click a vertex to remove it."
|
|
247
247
|
]
|
|
248
248
|
}),
|
|
249
|
-
/* @__PURE__ */
|
|
249
|
+
/* @__PURE__ */ f("div", {
|
|
250
250
|
className: "flex items-center gap-2 flex-wrap",
|
|
251
251
|
children: [
|
|
252
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ d("button", {
|
|
253
253
|
type: "button",
|
|
254
254
|
onClick: be,
|
|
255
255
|
disabled: E,
|
|
256
256
|
"aria-pressed": O,
|
|
257
|
-
className: O ?
|
|
257
|
+
className: O ? v : _,
|
|
258
258
|
children: O ? "Done editing" : "Edit mask"
|
|
259
259
|
}),
|
|
260
|
-
/* @__PURE__ */
|
|
260
|
+
/* @__PURE__ */ d("button", {
|
|
261
261
|
type: "button",
|
|
262
262
|
onClick: he,
|
|
263
263
|
disabled: E,
|
|
264
264
|
"aria-pressed": S.enabled,
|
|
265
|
-
className: S.enabled ?
|
|
265
|
+
className: S.enabled ? v : _,
|
|
266
266
|
children: S.enabled ? "Mask on" : "Mask off"
|
|
267
267
|
}),
|
|
268
|
-
xe && /* @__PURE__ */
|
|
268
|
+
xe && /* @__PURE__ */ d("button", {
|
|
269
269
|
type: "button",
|
|
270
270
|
onClick: () => Y("rect"),
|
|
271
271
|
disabled: E || W,
|
|
272
272
|
"aria-pressed": M === "rect",
|
|
273
|
-
className: M === "rect" ?
|
|
273
|
+
className: M === "rect" ? v : _,
|
|
274
274
|
title: W ? "Maximum zones reached" : "Add a rectangle zone",
|
|
275
275
|
children: "+ Rect"
|
|
276
276
|
}),
|
|
277
|
-
Se && /* @__PURE__ */
|
|
277
|
+
Se && /* @__PURE__ */ d("button", {
|
|
278
278
|
type: "button",
|
|
279
279
|
onClick: () => Y("polygon"),
|
|
280
280
|
disabled: E || W,
|
|
281
281
|
"aria-pressed": M === "polygon",
|
|
282
|
-
className: M === "polygon" ?
|
|
282
|
+
className: M === "polygon" ? v : _,
|
|
283
283
|
title: W ? "Maximum zones reached" : "Add a polygon zone",
|
|
284
284
|
children: "+ Polygon"
|
|
285
285
|
}),
|
|
286
|
-
/* @__PURE__ */
|
|
286
|
+
/* @__PURE__ */ f("span", {
|
|
287
287
|
className: `${s} ml-1 tabular-nums`,
|
|
288
288
|
children: [
|
|
289
289
|
V,
|
|
@@ -292,60 +292,60 @@ function b({ deviceId: a }) {
|
|
|
292
292
|
" zones"
|
|
293
293
|
]
|
|
294
294
|
}),
|
|
295
|
-
/* @__PURE__ */
|
|
296
|
-
/* @__PURE__ */
|
|
295
|
+
/* @__PURE__ */ d("span", { className: "flex-1" }),
|
|
296
|
+
/* @__PURE__ */ d("button", {
|
|
297
297
|
type: "button",
|
|
298
298
|
onClick: _e,
|
|
299
299
|
disabled: E || !B,
|
|
300
300
|
className: "rounded-md border border-border bg-surface px-2 py-1 text-[11px] text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors",
|
|
301
301
|
children: "Revert"
|
|
302
302
|
}),
|
|
303
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ d("button", {
|
|
304
304
|
type: "button",
|
|
305
305
|
onClick: () => void ve(),
|
|
306
306
|
disabled: E || !B,
|
|
307
|
-
className:
|
|
307
|
+
className: v,
|
|
308
308
|
children: E ? "Saving…" : "Save"
|
|
309
309
|
})
|
|
310
310
|
]
|
|
311
311
|
}),
|
|
312
|
-
V > 0 ? /* @__PURE__ */
|
|
312
|
+
V > 0 ? /* @__PURE__ */ d("div", {
|
|
313
313
|
className: "flex flex-col gap-1",
|
|
314
314
|
children: S.regions.map((e) => {
|
|
315
|
-
let t = A === e.id, n = e.shape.kind === "polygon" ?
|
|
316
|
-
return /* @__PURE__ */
|
|
315
|
+
let t = A === e.id, n = e.shape.kind === "polygon" ? ce : ie;
|
|
316
|
+
return /* @__PURE__ */ f("div", {
|
|
317
317
|
className: `flex items-center gap-2 rounded-md border px-2 py-1 transition-colors ${t ? "border-primary/50 bg-primary/10" : "border-border bg-surface"}`,
|
|
318
|
-
children: [/* @__PURE__ */
|
|
318
|
+
children: [/* @__PURE__ */ f("button", {
|
|
319
319
|
type: "button",
|
|
320
320
|
onClick: () => ge(e.id),
|
|
321
321
|
disabled: E,
|
|
322
322
|
className: "flex flex-1 items-center gap-2 text-left text-[11px] font-medium text-foreground-subtle hover:text-foreground disabled:opacity-40 transition-colors",
|
|
323
323
|
children: [
|
|
324
|
-
/* @__PURE__ */
|
|
325
|
-
/* @__PURE__ */
|
|
326
|
-
/* @__PURE__ */
|
|
324
|
+
/* @__PURE__ */ d(n, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
325
|
+
/* @__PURE__ */ f("span", { children: ["Zone ", e.id] }),
|
|
326
|
+
/* @__PURE__ */ d("span", {
|
|
327
327
|
className: "text-foreground-faint capitalize",
|
|
328
328
|
children: e.shape.kind
|
|
329
329
|
})
|
|
330
330
|
]
|
|
331
|
-
}), /* @__PURE__ */
|
|
331
|
+
}), /* @__PURE__ */ d("button", {
|
|
332
332
|
type: "button",
|
|
333
333
|
onClick: () => X(e.id),
|
|
334
334
|
disabled: E,
|
|
335
335
|
"aria-label": `Delete zone ${String(e.id)}`,
|
|
336
336
|
title: "Delete zone",
|
|
337
337
|
className: "inline-flex h-6 w-6 items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:border-red-400/40 hover:bg-red-500/10 hover:text-red-400 disabled:opacity-40 transition-colors",
|
|
338
|
-
children: /* @__PURE__ */
|
|
338
|
+
children: /* @__PURE__ */ d(ae, { className: "h-3.5 w-3.5" })
|
|
339
339
|
})]
|
|
340
340
|
}, e.id);
|
|
341
341
|
})
|
|
342
342
|
}) : null
|
|
343
|
-
] }) : /* @__PURE__ */
|
|
343
|
+
] }) : /* @__PURE__ */ d("p", {
|
|
344
344
|
className: `${s} leading-relaxed`,
|
|
345
345
|
children: "Loading the camera's privacy mask…"
|
|
346
|
-
}), Z.supported && /* @__PURE__ */
|
|
346
|
+
}), Z.supported && /* @__PURE__ */ f("div", {
|
|
347
347
|
className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",
|
|
348
|
-
children: [/* @__PURE__ */
|
|
348
|
+
children: [/* @__PURE__ */ d("button", {
|
|
349
349
|
type: "button",
|
|
350
350
|
role: "switch",
|
|
351
351
|
"aria-label": Z.label,
|
|
@@ -353,12 +353,12 @@ function b({ deviceId: a }) {
|
|
|
353
353
|
disabled: !Z.available || F !== null,
|
|
354
354
|
onClick: () => void ye(),
|
|
355
355
|
title: Z.on === null ? "Microphone — state unknown; the camera did not answer." : Z.on ? `The camera is capturing sound. Turning it off: ${Z.costWhenOff}` : `The camera is silent. ${Z.costWhenOff}`,
|
|
356
|
-
className: Z.on === !1 || Z.on === null ?
|
|
357
|
-
children: /* @__PURE__ */
|
|
356
|
+
className: Z.on === !1 || Z.on === null ? _ : v,
|
|
357
|
+
children: /* @__PURE__ */ f("span", {
|
|
358
358
|
className: "inline-flex items-center gap-1.5",
|
|
359
|
-
children: [Z.on === !1 ? /* @__PURE__ */
|
|
359
|
+
children: [Z.on === !1 ? /* @__PURE__ */ d(le, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ d(l, { className: "h-3.5 w-3.5" }), Z.on === null ? "Microphone unknown" : Z.on ? "Microphone on" : "Microphone off"]
|
|
360
360
|
})
|
|
361
|
-
}), /* @__PURE__ */
|
|
361
|
+
}), /* @__PURE__ */ d("p", {
|
|
362
362
|
className: "text-[10px] text-foreground-subtle flex-1 leading-relaxed",
|
|
363
363
|
children: L === null ? Z.on === null ? "The camera did not report its microphone, so this state is unknown." : Z.costWhenOff : `Write failed: ${L}`
|
|
364
364
|
})]
|