@camstack/addon-benchmark 1.2.236 → 1.2.238
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/{MaskShapeCanvas-7LKD4bOR.mjs → MaskShapeCanvas-rvnAWD46.mjs} +2330 -2329
- package/dist/MotionZonesSettings-CLUkWpK0.mjs +309 -0
- package/dist/PrivacyMaskSettings-CO253ssl.mjs +368 -0
- package/dist/SceneMonitorEditor-CokHHuc7.mjs +846 -0
- package/dist/_stub.js +7108 -6531
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_benchmark_page-ChxR9kPt.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_benchmark_page-CQo14_ap.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BMVDowC4.mjs +26 -0
- package/dist/{_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-BLRSn-wJ.mjs → _virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-BSWOsmOl.mjs} +1 -1
- package/dist/addon-benchmark.css +1 -1
- package/dist/{hostInit-CEx6N0CU.mjs → hostInit-DmAnLpvv.mjs} +3 -3
- package/dist/player-overlays-CSPcduAF.mjs +44 -0
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-BEYSc24p.mjs → responsive-D-VpyylT.mjs} +35 -35
- package/dist/scene-monitor-copy-BJy41PVw.mjs +227 -0
- package/dist/{square-DEGbSYoK.mjs → square-ZwSCZFNX.mjs} +1 -1
- package/dist/{trash-2-CCLSWdWD.mjs → trash-2-BJm2vmez.mjs} +1 -1
- package/dist/ui-text-D2tfpVFx.mjs +34 -0
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_benchmark_page__remoteEntry_js-Dm8qg1pv.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_benchmark_page__remoteEntry_js-DzyTxqcN.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings-WETj-Fnx.mjs +0 -310
- package/dist/PrivacyMaskSettings-CuZnKVIY.mjs +0 -377
- package/dist/SceneMonitorEditor-zpag-Gn2.mjs +0 -831
- package/dist/_virtual_mf___mfe_internal__addon_benchmark_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-bKs8C0v5.mjs +0 -26
- package/dist/player-overlays-D5Bao9IZ.mjs +0 -44
- package/dist/scene-monitor-copy-9bafcJ0k.mjs +0 -187
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { b as e, c as t, g as n, h as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-BLRSn-wJ.mjs";
|
|
2
|
-
import { d as o, g as s, m as c, p as ee, v as l } from "./responsive-BEYSc24p.mjs";
|
|
3
|
-
import { n as u, t as d } from "./player-overlays-D5Bao9IZ.mjs";
|
|
4
|
-
import { n as f, r as p, t as m } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Dh0XkFx5.mjs";
|
|
5
|
-
import { MaskShapeCanvas as h } from "./MaskShapeCanvas-7LKD4bOR.mjs";
|
|
6
|
-
var g = l("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
|
-
e();
|
|
27
|
-
var _ = 110, te = "motion-zones", v = 0, y = [
|
|
28
|
-
1,
|
|
29
|
-
2,
|
|
30
|
-
3
|
|
31
|
-
], b = 1, x = "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", S = "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 C(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 ne(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 w(e, t) {
|
|
43
|
-
return Math.ceil(e / t);
|
|
44
|
-
}
|
|
45
|
-
function T(e, t, n) {
|
|
46
|
-
return Math.min(n - 1, Math.floor((e + .5) / t * n));
|
|
47
|
-
}
|
|
48
|
-
function E(e, t, n, r) {
|
|
49
|
-
let i = w(t, r), a = w(n, r), o = Array.from({ length: i * a }, () => !1);
|
|
50
|
-
for (let r = 0; r < n; r += 1) {
|
|
51
|
-
let s = T(r, n, a);
|
|
52
|
-
for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + T(n, t, i)] = !0);
|
|
53
|
-
}
|
|
54
|
-
return o;
|
|
55
|
-
}
|
|
56
|
-
function D(e, t, n, r) {
|
|
57
|
-
let i = w(t, r), a = w(n, r), o = Array.from({ length: t * n }, () => !1);
|
|
58
|
-
for (let r = 0; r < n; r += 1) {
|
|
59
|
-
let s = T(r, n, a);
|
|
60
|
-
for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + T(n, t, i)] === !0;
|
|
61
|
-
}
|
|
62
|
-
return o;
|
|
63
|
-
}
|
|
64
|
-
function O({ deviceId: e }) {
|
|
65
|
-
let l = c(s().trpcClient, e), [T, O] = n(null), [k, A] = n(!1), [j, M] = n(null), [N, P] = n(null), [F, I] = n(b), [L, R] = n(!1), [z, B] = n(!1), V = r(!1);
|
|
66
|
-
a(() => {
|
|
67
|
-
if (!l) return;
|
|
68
|
-
let e = !1;
|
|
69
|
-
return V.current = !1, O(null), A(!1), M(null), P(null), I(b), B(!1), (async () => {
|
|
70
|
-
try {
|
|
71
|
-
let t = await l.motionZones?.getOptions({});
|
|
72
|
-
if (e) return;
|
|
73
|
-
if (!t) throw Error("device proxy not ready");
|
|
74
|
-
if (O(t), V.current) return;
|
|
75
|
-
let n = await l.motionZones?.getStatus({});
|
|
76
|
-
if (e) return;
|
|
77
|
-
if (!n) throw Error("device proxy not ready");
|
|
78
|
-
V.current = !0;
|
|
79
|
-
let r = n.regions.find((e) => e.shape.kind === "grid"), i = C(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
80
|
-
P(i), M(E(i, t.grid.width, t.grid.height, b));
|
|
81
|
-
} catch (t) {
|
|
82
|
-
if (e) return;
|
|
83
|
-
ee(t) ? A(!0) : console.error("Motion Zones load failed", t);
|
|
84
|
-
}
|
|
85
|
-
})(), () => {
|
|
86
|
-
e = !0;
|
|
87
|
-
};
|
|
88
|
-
}, [l]);
|
|
89
|
-
let H = T ? T.grid.width : 0, U = T ? T.grid.height : 0, W = w(H, F), G = w(U, F), K = i(() => j && T ? D(j, H, U, F) : null, [
|
|
90
|
-
j,
|
|
91
|
-
T,
|
|
92
|
-
H,
|
|
93
|
-
U,
|
|
94
|
-
F
|
|
95
|
-
]), q = i(() => K !== null && N !== null && !ne(K, N), [K, N]), J = i(() => K ? K.reduce((e, t) => t ? e + 1 : e, 0) : 0, [K]), Y = H * U, X = W * G, Z = t((e) => {
|
|
96
|
-
X > 0 && M(Array.from({ length: X }, () => e));
|
|
97
|
-
}, [X]), re = t(() => {
|
|
98
|
-
M((e) => e && e.map((e) => !e));
|
|
99
|
-
}, []), ie = t(() => {
|
|
100
|
-
N && T && M(E(N, H, U, F));
|
|
101
|
-
}, [
|
|
102
|
-
N,
|
|
103
|
-
T,
|
|
104
|
-
H,
|
|
105
|
-
U,
|
|
106
|
-
F
|
|
107
|
-
]), ae = t((e) => {
|
|
108
|
-
e === F || !T || M((t) => {
|
|
109
|
-
if (!t) return I(e), t;
|
|
110
|
-
let n = E(D(t, H, U, F), H, U, e);
|
|
111
|
-
return I(e), n;
|
|
112
|
-
});
|
|
113
|
-
}, [
|
|
114
|
-
F,
|
|
115
|
-
T,
|
|
116
|
-
H,
|
|
117
|
-
U
|
|
118
|
-
]), Q = i(() => T && j ? [{
|
|
119
|
-
id: v,
|
|
120
|
-
shape: {
|
|
121
|
-
kind: "grid",
|
|
122
|
-
gridWidth: W,
|
|
123
|
-
gridHeight: G,
|
|
124
|
-
cells: [...j]
|
|
125
|
-
}
|
|
126
|
-
}] : [], [
|
|
127
|
-
T,
|
|
128
|
-
j,
|
|
129
|
-
W,
|
|
130
|
-
G
|
|
131
|
-
]), $ = t((e, t) => {
|
|
132
|
-
t.kind === "grid" && M(t.cells);
|
|
133
|
-
}, []), oe = t(async () => {
|
|
134
|
-
if (!(!l || !j || !T)) {
|
|
135
|
-
R(!0);
|
|
136
|
-
try {
|
|
137
|
-
let e = D(j, T.grid.width, T.grid.height, F), t = {
|
|
138
|
-
kind: "grid",
|
|
139
|
-
gridWidth: T.grid.width,
|
|
140
|
-
gridHeight: T.grid.height,
|
|
141
|
-
cells: e
|
|
142
|
-
};
|
|
143
|
-
await l.motionZones?.setZone({ patch: { regions: [{
|
|
144
|
-
id: v,
|
|
145
|
-
enabled: !0,
|
|
146
|
-
shape: t
|
|
147
|
-
}] } });
|
|
148
|
-
let n = await l.motionZones?.getStatus({});
|
|
149
|
-
if (n) {
|
|
150
|
-
let e = n.regions.find((e) => e.shape.kind === "grid"), t = C(e ? e.shape.cells : [], T.grid.width, T.grid.height);
|
|
151
|
-
P(t), M(E(t, T.grid.width, T.grid.height, F));
|
|
152
|
-
}
|
|
153
|
-
} catch (e) {
|
|
154
|
-
console.error("Motion Zones save failed", e);
|
|
155
|
-
} finally {
|
|
156
|
-
R(!1);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}, [
|
|
160
|
-
l,
|
|
161
|
-
j,
|
|
162
|
-
T,
|
|
163
|
-
F
|
|
164
|
-
]);
|
|
165
|
-
return d(i(() => z && !k && T && j ? {
|
|
166
|
-
id: te,
|
|
167
|
-
order: _,
|
|
168
|
-
node: /* @__PURE__ */ f(h, {
|
|
169
|
-
transparent: !0,
|
|
170
|
-
items: Q,
|
|
171
|
-
supportedShapes: ["grid"],
|
|
172
|
-
grid: {
|
|
173
|
-
width: W,
|
|
174
|
-
height: G
|
|
175
|
-
},
|
|
176
|
-
selectedId: v,
|
|
177
|
-
onSelect: () => {},
|
|
178
|
-
onShapeChange: $,
|
|
179
|
-
onDrawComplete: () => {},
|
|
180
|
-
drawingKind: null
|
|
181
|
-
})
|
|
182
|
-
} : null, [
|
|
183
|
-
z,
|
|
184
|
-
k,
|
|
185
|
-
T,
|
|
186
|
-
j,
|
|
187
|
-
Q,
|
|
188
|
-
$,
|
|
189
|
-
W,
|
|
190
|
-
G
|
|
191
|
-
])), l ? /* @__PURE__ */ f(u, {
|
|
192
|
-
title: "Motion Zones",
|
|
193
|
-
icon: /* @__PURE__ */ f(g, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
194
|
-
children: /* @__PURE__ */ f("div", {
|
|
195
|
-
className: "flex flex-col gap-3",
|
|
196
|
-
children: k ? /* @__PURE__ */ f("p", {
|
|
197
|
-
className: `${o} leading-relaxed`,
|
|
198
|
-
children: "This camera doesn't expose an on-board motion zones grid."
|
|
199
|
-
}) : !k && T !== null && j !== null ? /* @__PURE__ */ p(m, { children: [/* @__PURE__ */ p("p", {
|
|
200
|
-
className: `${o} leading-relaxed`,
|
|
201
|
-
children: [
|
|
202
|
-
"Toggle ",
|
|
203
|
-
/* @__PURE__ */ f("strong", {
|
|
204
|
-
className: "text-foreground",
|
|
205
|
-
children: "Edit grid"
|
|
206
|
-
}),
|
|
207
|
-
" to paint the region directly on the live frame, then ",
|
|
208
|
-
/* @__PURE__ */ f("strong", {
|
|
209
|
-
className: "text-foreground",
|
|
210
|
-
children: "Save"
|
|
211
|
-
}),
|
|
212
|
-
" to push the mask to the camera. Pick a bigger",
|
|
213
|
-
" ",
|
|
214
|
-
/* @__PURE__ */ f("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
|
-
T.grid.width,
|
|
220
|
-
"×",
|
|
221
|
-
T.grid.height,
|
|
222
|
-
" grid on save (×1 is the finest)."
|
|
223
|
-
]
|
|
224
|
-
}), /* @__PURE__ */ p("div", {
|
|
225
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
226
|
-
children: [
|
|
227
|
-
/* @__PURE__ */ f("button", {
|
|
228
|
-
type: "button",
|
|
229
|
-
onClick: () => B((e) => !e),
|
|
230
|
-
disabled: L,
|
|
231
|
-
"aria-pressed": z,
|
|
232
|
-
className: z ? S : x,
|
|
233
|
-
children: z ? "Done editing" : "Edit grid"
|
|
234
|
-
}),
|
|
235
|
-
/* @__PURE__ */ f("button", {
|
|
236
|
-
type: "button",
|
|
237
|
-
onClick: () => Z(!0),
|
|
238
|
-
disabled: L,
|
|
239
|
-
className: x,
|
|
240
|
-
children: "All on"
|
|
241
|
-
}),
|
|
242
|
-
/* @__PURE__ */ f("button", {
|
|
243
|
-
type: "button",
|
|
244
|
-
onClick: () => Z(!1),
|
|
245
|
-
disabled: L,
|
|
246
|
-
className: x,
|
|
247
|
-
children: "All off"
|
|
248
|
-
}),
|
|
249
|
-
/* @__PURE__ */ f("button", {
|
|
250
|
-
type: "button",
|
|
251
|
-
onClick: re,
|
|
252
|
-
disabled: L,
|
|
253
|
-
className: x,
|
|
254
|
-
children: "Invert"
|
|
255
|
-
}),
|
|
256
|
-
/* @__PURE__ */ p("div", {
|
|
257
|
-
className: "flex items-center gap-1 ml-1",
|
|
258
|
-
role: "group",
|
|
259
|
-
"aria-label": "Cell size",
|
|
260
|
-
children: [/* @__PURE__ */ f("span", {
|
|
261
|
-
className: `${o} mr-0.5`,
|
|
262
|
-
children: "Cell size"
|
|
263
|
-
}), y.map((e) => /* @__PURE__ */ p("button", {
|
|
264
|
-
type: "button",
|
|
265
|
-
onClick: () => ae(e),
|
|
266
|
-
disabled: L,
|
|
267
|
-
"aria-pressed": F === e,
|
|
268
|
-
title: e === 1 ? `Camera grid ${H}×${U} (finest)` : `${w(H, e)}×${w(U, e)} painting grid · cells ×${e} bigger`,
|
|
269
|
-
className: F === e ? S : x,
|
|
270
|
-
children: ["×", e]
|
|
271
|
-
}, e))]
|
|
272
|
-
}),
|
|
273
|
-
/* @__PURE__ */ p("span", {
|
|
274
|
-
className: `${o} ml-1 tabular-nums`,
|
|
275
|
-
children: [
|
|
276
|
-
J,
|
|
277
|
-
" / ",
|
|
278
|
-
Y,
|
|
279
|
-
" cells · ",
|
|
280
|
-
T.grid.width,
|
|
281
|
-
"×",
|
|
282
|
-
T.grid.height,
|
|
283
|
-
F === 1 ? "" : ` · paint ${W}×${G}`
|
|
284
|
-
]
|
|
285
|
-
}),
|
|
286
|
-
/* @__PURE__ */ f("span", { className: "flex-1" }),
|
|
287
|
-
/* @__PURE__ */ f("button", {
|
|
288
|
-
type: "button",
|
|
289
|
-
onClick: ie,
|
|
290
|
-
disabled: L || !q,
|
|
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__ */ f("button", {
|
|
295
|
-
type: "button",
|
|
296
|
-
onClick: () => void oe(),
|
|
297
|
-
disabled: L || !q,
|
|
298
|
-
className: S,
|
|
299
|
-
children: L ? "Saving…" : "Save"
|
|
300
|
-
})
|
|
301
|
-
]
|
|
302
|
-
})] }) : /* @__PURE__ */ f("p", {
|
|
303
|
-
className: `${o} leading-relaxed`,
|
|
304
|
-
children: "Loading the camera's grid…"
|
|
305
|
-
})
|
|
306
|
-
})
|
|
307
|
-
}) : null;
|
|
308
|
-
}
|
|
309
|
-
//#endregion
|
|
310
|
-
export { O as MotionZonesSettings };
|
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import { b as e, c as t, g as n, h as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react__loadShare__.js-BLRSn-wJ.mjs";
|
|
2
|
-
import { d as o, g as ee, m as te, p as ne, v as s } from "./responsive-BEYSc24p.mjs";
|
|
3
|
-
import { n as re, t as ie } from "./player-overlays-D5Bao9IZ.mjs";
|
|
4
|
-
import { n as ae, r as oe, t as se } from "./square-DEGbSYoK.mjs";
|
|
5
|
-
import { t as c } from "./trash-2-CCLSWdWD.mjs";
|
|
6
|
-
import { n as l, r as u, t as ce } from "./_virtual_mf___mfe_internal__addon_benchmark_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Dh0XkFx5.mjs";
|
|
7
|
-
import { MaskShapeCanvas as le } from "./MaskShapeCanvas-7LKD4bOR.mjs";
|
|
8
|
-
var ue = s("hexagon", [["path", {
|
|
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
|
-
key: "yt0hxn"
|
|
11
|
-
}]]), de = s("mic-off", [
|
|
12
|
-
["path", {
|
|
13
|
-
d: "M12 19v3",
|
|
14
|
-
key: "npa21l"
|
|
15
|
-
}],
|
|
16
|
-
["path", {
|
|
17
|
-
d: "M15 9.34V5a3 3 0 0 0-5.68-1.33",
|
|
18
|
-
key: "1gzdoj"
|
|
19
|
-
}],
|
|
20
|
-
["path", {
|
|
21
|
-
d: "M16.95 16.95A7 7 0 0 1 5 12v-2",
|
|
22
|
-
key: "cqa7eg"
|
|
23
|
-
}],
|
|
24
|
-
["path", {
|
|
25
|
-
d: "M18.89 13.23A7 7 0 0 0 19 12v-2",
|
|
26
|
-
key: "16hl24"
|
|
27
|
-
}],
|
|
28
|
-
["path", {
|
|
29
|
-
d: "m2 2 20 20",
|
|
30
|
-
key: "1ooewy"
|
|
31
|
-
}],
|
|
32
|
-
["path", {
|
|
33
|
-
d: "M9 9v3a3 3 0 0 0 5.12 2.12",
|
|
34
|
-
key: "r2i35w"
|
|
35
|
-
}]
|
|
36
|
-
]);
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region ../ui-library/src/composites/cap-settings/privacy-mask-audio.ts
|
|
39
|
-
e();
|
|
40
|
-
var d = "Microphone", f = "The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.";
|
|
41
|
-
function p(e) {
|
|
42
|
-
let t = e.supportsAudioMute === !0, n = t ? e.audioEnabled : null, r = e.pendingOn ?? null;
|
|
43
|
-
return {
|
|
44
|
-
label: d,
|
|
45
|
-
supported: t,
|
|
46
|
-
on: n === null ? null : r ?? n,
|
|
47
|
-
available: t && n !== null,
|
|
48
|
-
costWhenOff: f
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
function m(e) {
|
|
52
|
-
return !e.available || e.on === null ? null : { enabled: !e.on };
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
//#region ../ui-library/src/composites/cap-settings/PrivacyMaskSettings.tsx
|
|
56
|
-
var fe = 120, pe = "privacy-mask", h = "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", g = "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 _(e) {
|
|
58
|
-
return e.kind === "rect" || e.kind === "polygon" ? e : null;
|
|
59
|
-
}
|
|
60
|
-
function me(e) {
|
|
61
|
-
let t = new Set(e.map((e) => e.id)), n = 0;
|
|
62
|
-
for (; t.has(n);) n += 1;
|
|
63
|
-
return n;
|
|
64
|
-
}
|
|
65
|
-
function he(e, t) {
|
|
66
|
-
if (e.length !== t.length) return !1;
|
|
67
|
-
for (let n = 0; n < e.length; n += 1) if (JSON.stringify(e[n]) !== JSON.stringify(t[n])) return !1;
|
|
68
|
-
return !0;
|
|
69
|
-
}
|
|
70
|
-
function v({ deviceId: e }) {
|
|
71
|
-
let s = te(ee().trpcClient, e), [d, f] = n(null), [v, y] = n(!1), [b, x] = n(!1), [S, C] = n(null), [w, T] = n(null), [E, D] = n(!1), [O, k] = n(!1), [A, j] = n(null), [M, N] = n(null), [ge, P] = n(null), [F, I] = n(null), [L, R] = n(null), z = r(!1);
|
|
72
|
-
a(() => {
|
|
73
|
-
if (!s) return;
|
|
74
|
-
let e = !1;
|
|
75
|
-
return z.current = !1, f(null), y(!1), x(!1), C(null), T(null), k(!1), j(null), N(null), P(null), I(null), R(null), (async () => {
|
|
76
|
-
try {
|
|
77
|
-
let t = await s.privacyMask?.getOptions({});
|
|
78
|
-
if (e) return;
|
|
79
|
-
if (!t) throw Error("device proxy not ready");
|
|
80
|
-
if (f(t), z.current) return;
|
|
81
|
-
let n = await s.privacyMask?.getStatus({});
|
|
82
|
-
if (e) return;
|
|
83
|
-
if (!n) throw Error("device proxy not ready");
|
|
84
|
-
if (n.regions === null) {
|
|
85
|
-
x(!0), P(n.audioEnabled);
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
z.current = !0;
|
|
89
|
-
let r = {
|
|
90
|
-
enabled: n.enabled,
|
|
91
|
-
regions: n.regions
|
|
92
|
-
};
|
|
93
|
-
T(r), C(r), P(n.audioEnabled);
|
|
94
|
-
} catch (t) {
|
|
95
|
-
if (e) return;
|
|
96
|
-
ne(t) ? y(!0) : console.error("Privacy Mask load failed", t);
|
|
97
|
-
}
|
|
98
|
-
})(), () => {
|
|
99
|
-
e = !0;
|
|
100
|
-
};
|
|
101
|
-
}, [s]);
|
|
102
|
-
let B = i(() => S !== null && w !== null && (S.enabled !== w.enabled || !he(S.regions, w.regions)), [S, w]), V = S ? S.regions.length : 0, H = d ? d.maxRegions : 0, U = r(0);
|
|
103
|
-
a(() => {
|
|
104
|
-
U.current = H;
|
|
105
|
-
}, [H]);
|
|
106
|
-
let W = H > 0 && V >= H, _e = t(() => {
|
|
107
|
-
C((e) => e && {
|
|
108
|
-
...e,
|
|
109
|
-
enabled: !e.enabled
|
|
110
|
-
});
|
|
111
|
-
}, []), G = t((e) => {
|
|
112
|
-
j(typeof e == "number" ? e : null);
|
|
113
|
-
}, []), K = i(() => S ? S.regions.map((e) => ({
|
|
114
|
-
id: e.id,
|
|
115
|
-
shape: e.shape,
|
|
116
|
-
enabled: e.enabled,
|
|
117
|
-
label: `Zone ${String(e.id)}`
|
|
118
|
-
})) : [], [S]), q = t((e, t) => {
|
|
119
|
-
let n = _(t);
|
|
120
|
-
n && C((t) => t && {
|
|
121
|
-
...t,
|
|
122
|
-
regions: t.regions.map((t) => t.id === e ? {
|
|
123
|
-
...t,
|
|
124
|
-
shape: n
|
|
125
|
-
} : t)
|
|
126
|
-
});
|
|
127
|
-
}, []), J = t((e) => {
|
|
128
|
-
let t = _(e);
|
|
129
|
-
t && (N(null), C((e) => {
|
|
130
|
-
if (!e) return e;
|
|
131
|
-
let n = U.current;
|
|
132
|
-
if (n > 0 && e.regions.length >= n) return e;
|
|
133
|
-
let r = me(e.regions), i = {
|
|
134
|
-
id: r,
|
|
135
|
-
enabled: !0,
|
|
136
|
-
shape: t
|
|
137
|
-
};
|
|
138
|
-
return j(r), {
|
|
139
|
-
...e,
|
|
140
|
-
regions: [...e.regions, i]
|
|
141
|
-
};
|
|
142
|
-
}));
|
|
143
|
-
}, []), Y = t((e) => {
|
|
144
|
-
k(!0), j(null), N(e);
|
|
145
|
-
}, []), ve = t((e) => {
|
|
146
|
-
k(!0), N(null), j(e);
|
|
147
|
-
}, []), X = t((e) => {
|
|
148
|
-
j((t) => t === e ? null : t), C((t) => t && {
|
|
149
|
-
...t,
|
|
150
|
-
regions: t.regions.filter((t) => t.id !== e)
|
|
151
|
-
});
|
|
152
|
-
}, []), ye = t(() => {
|
|
153
|
-
N(null), j(null), w && C({
|
|
154
|
-
enabled: w.enabled,
|
|
155
|
-
regions: w.regions
|
|
156
|
-
});
|
|
157
|
-
}, [w]), be = t(async () => {
|
|
158
|
-
if (!(!s || !S)) {
|
|
159
|
-
D(!0);
|
|
160
|
-
try {
|
|
161
|
-
await s.privacyMask?.setMask({ patch: {
|
|
162
|
-
enabled: S.enabled,
|
|
163
|
-
regions: [...S.regions]
|
|
164
|
-
} });
|
|
165
|
-
let e = await s.privacyMask?.getStatus({});
|
|
166
|
-
if (e && e.regions !== null) {
|
|
167
|
-
let t = {
|
|
168
|
-
enabled: e.enabled,
|
|
169
|
-
regions: e.regions
|
|
170
|
-
};
|
|
171
|
-
T(t), C(t);
|
|
172
|
-
}
|
|
173
|
-
} catch (e) {
|
|
174
|
-
console.error("Privacy Mask save failed", e);
|
|
175
|
-
} finally {
|
|
176
|
-
D(!1);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}, [s, S]), Z = p({
|
|
180
|
-
supportsAudioMute: d === null ? null : d.supportsAudioMute,
|
|
181
|
-
audioEnabled: ge,
|
|
182
|
-
pendingOn: F
|
|
183
|
-
}), xe = t(async () => {
|
|
184
|
-
let e = m(Z);
|
|
185
|
-
if (!(!s || e === null)) {
|
|
186
|
-
I(e.enabled), R(null);
|
|
187
|
-
try {
|
|
188
|
-
await s.privacyMask?.setAudioEnabled(e);
|
|
189
|
-
let t = await s.privacyMask?.getStatus({});
|
|
190
|
-
t && P(t.audioEnabled);
|
|
191
|
-
} catch (e) {
|
|
192
|
-
console.error("Privacy microphone write failed — reverting", e), R(e instanceof Error ? e.message : String(e));
|
|
193
|
-
} finally {
|
|
194
|
-
I(null);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}, [s, Z]), Se = t(() => {
|
|
198
|
-
k((e) => (e && (N(null), j(null)), !e));
|
|
199
|
-
}, []), Q = d?.supportedShapes ?? [];
|
|
200
|
-
ie(i(() => O && !v && d && S ? {
|
|
201
|
-
id: pe,
|
|
202
|
-
order: fe,
|
|
203
|
-
node: /* @__PURE__ */ l(le, {
|
|
204
|
-
transparent: !0,
|
|
205
|
-
items: K,
|
|
206
|
-
supportedShapes: Q,
|
|
207
|
-
polygonVertices: d.polygonVertices,
|
|
208
|
-
selectedId: A,
|
|
209
|
-
onSelect: G,
|
|
210
|
-
onShapeChange: q,
|
|
211
|
-
onDrawComplete: J,
|
|
212
|
-
drawingKind: M
|
|
213
|
-
})
|
|
214
|
-
} : null, [
|
|
215
|
-
O,
|
|
216
|
-
v,
|
|
217
|
-
d,
|
|
218
|
-
S,
|
|
219
|
-
K,
|
|
220
|
-
Q,
|
|
221
|
-
A,
|
|
222
|
-
G,
|
|
223
|
-
q,
|
|
224
|
-
J,
|
|
225
|
-
M
|
|
226
|
-
]));
|
|
227
|
-
let Ce = d?.supportedShapes.includes("rect") ?? !1, we = d?.supportedShapes.includes("polygon") ?? !1, $ = d !== null && (d.maxRegions <= 0 || d.supportedShapes.length === 0);
|
|
228
|
-
return s ? /* @__PURE__ */ l(re, {
|
|
229
|
-
title: "Privacy Mask",
|
|
230
|
-
icon: /* @__PURE__ */ l(oe, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
231
|
-
children: /* @__PURE__ */ u("div", {
|
|
232
|
-
className: "flex flex-col gap-3",
|
|
233
|
-
children: [v || $ ? /* @__PURE__ */ l("p", {
|
|
234
|
-
className: `${o} leading-relaxed`,
|
|
235
|
-
children: "This camera doesn't support an on-board privacy mask."
|
|
236
|
-
}) : b ? /* @__PURE__ */ l("p", {
|
|
237
|
-
className: `${o} leading-relaxed`,
|
|
238
|
-
children: "This camera hasn't answered, so what it currently masks is unknown — the editor stays closed rather than showing an empty frame you could save over. A battery camera answers once it wakes; otherwise check that it is reachable."
|
|
239
|
-
}) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(ce, { children: [
|
|
240
|
-
/* @__PURE__ */ u("p", {
|
|
241
|
-
className: `${o} leading-relaxed`,
|
|
242
|
-
children: [
|
|
243
|
-
"Toggle ",
|
|
244
|
-
/* @__PURE__ */ l("strong", {
|
|
245
|
-
className: "text-foreground",
|
|
246
|
-
children: "Edit mask"
|
|
247
|
-
}),
|
|
248
|
-
" to draw blanked-out zones on the live frame, then ",
|
|
249
|
-
/* @__PURE__ */ l("strong", {
|
|
250
|
-
className: "text-foreground",
|
|
251
|
-
children: "Save"
|
|
252
|
-
}),
|
|
253
|
-
" 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."
|
|
254
|
-
]
|
|
255
|
-
}),
|
|
256
|
-
/* @__PURE__ */ u("div", {
|
|
257
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
258
|
-
children: [
|
|
259
|
-
/* @__PURE__ */ l("button", {
|
|
260
|
-
type: "button",
|
|
261
|
-
onClick: Se,
|
|
262
|
-
disabled: E,
|
|
263
|
-
"aria-pressed": O,
|
|
264
|
-
className: O ? g : h,
|
|
265
|
-
children: O ? "Done editing" : "Edit mask"
|
|
266
|
-
}),
|
|
267
|
-
/* @__PURE__ */ l("button", {
|
|
268
|
-
type: "button",
|
|
269
|
-
onClick: _e,
|
|
270
|
-
disabled: E,
|
|
271
|
-
"aria-pressed": S.enabled,
|
|
272
|
-
className: S.enabled ? g : h,
|
|
273
|
-
children: S.enabled ? "Mask on" : "Mask off"
|
|
274
|
-
}),
|
|
275
|
-
Ce && /* @__PURE__ */ l("button", {
|
|
276
|
-
type: "button",
|
|
277
|
-
onClick: () => Y("rect"),
|
|
278
|
-
disabled: E || W,
|
|
279
|
-
"aria-pressed": M === "rect",
|
|
280
|
-
className: M === "rect" ? g : h,
|
|
281
|
-
title: W ? "Maximum zones reached" : "Add a rectangle zone",
|
|
282
|
-
children: "+ Rect"
|
|
283
|
-
}),
|
|
284
|
-
we && /* @__PURE__ */ l("button", {
|
|
285
|
-
type: "button",
|
|
286
|
-
onClick: () => Y("polygon"),
|
|
287
|
-
disabled: E || W,
|
|
288
|
-
"aria-pressed": M === "polygon",
|
|
289
|
-
className: M === "polygon" ? g : h,
|
|
290
|
-
title: W ? "Maximum zones reached" : "Add a polygon zone",
|
|
291
|
-
children: "+ Polygon"
|
|
292
|
-
}),
|
|
293
|
-
/* @__PURE__ */ u("span", {
|
|
294
|
-
className: `${o} ml-1 tabular-nums`,
|
|
295
|
-
children: [
|
|
296
|
-
V,
|
|
297
|
-
" / ",
|
|
298
|
-
H,
|
|
299
|
-
" zones"
|
|
300
|
-
]
|
|
301
|
-
}),
|
|
302
|
-
/* @__PURE__ */ l("span", { className: "flex-1" }),
|
|
303
|
-
/* @__PURE__ */ l("button", {
|
|
304
|
-
type: "button",
|
|
305
|
-
onClick: ye,
|
|
306
|
-
disabled: E || !B,
|
|
307
|
-
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",
|
|
308
|
-
children: "Revert"
|
|
309
|
-
}),
|
|
310
|
-
/* @__PURE__ */ l("button", {
|
|
311
|
-
type: "button",
|
|
312
|
-
onClick: () => void be(),
|
|
313
|
-
disabled: E || !B,
|
|
314
|
-
className: g,
|
|
315
|
-
children: E ? "Saving…" : "Save"
|
|
316
|
-
})
|
|
317
|
-
]
|
|
318
|
-
}),
|
|
319
|
-
V > 0 ? /* @__PURE__ */ l("div", {
|
|
320
|
-
className: "flex flex-col gap-1",
|
|
321
|
-
children: S.regions.map((e) => {
|
|
322
|
-
let t = A === e.id, n = e.shape.kind === "polygon" ? ue : se;
|
|
323
|
-
return /* @__PURE__ */ u("div", {
|
|
324
|
-
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"}`,
|
|
325
|
-
children: [/* @__PURE__ */ u("button", {
|
|
326
|
-
type: "button",
|
|
327
|
-
onClick: () => ve(e.id),
|
|
328
|
-
disabled: E,
|
|
329
|
-
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",
|
|
330
|
-
children: [
|
|
331
|
-
/* @__PURE__ */ l(n, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
332
|
-
/* @__PURE__ */ u("span", { children: ["Zone ", e.id] }),
|
|
333
|
-
/* @__PURE__ */ l("span", {
|
|
334
|
-
className: "text-foreground-faint capitalize",
|
|
335
|
-
children: e.shape.kind
|
|
336
|
-
})
|
|
337
|
-
]
|
|
338
|
-
}), /* @__PURE__ */ l("button", {
|
|
339
|
-
type: "button",
|
|
340
|
-
onClick: () => X(e.id),
|
|
341
|
-
disabled: E,
|
|
342
|
-
"aria-label": `Delete zone ${String(e.id)}`,
|
|
343
|
-
title: "Delete zone",
|
|
344
|
-
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",
|
|
345
|
-
children: /* @__PURE__ */ l(c, { className: "h-3.5 w-3.5" })
|
|
346
|
-
})]
|
|
347
|
-
}, e.id);
|
|
348
|
-
})
|
|
349
|
-
}) : null
|
|
350
|
-
] }) : /* @__PURE__ */ l("p", {
|
|
351
|
-
className: `${o} leading-relaxed`,
|
|
352
|
-
children: "Loading the camera's privacy mask…"
|
|
353
|
-
}), Z.supported && /* @__PURE__ */ u("div", {
|
|
354
|
-
className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",
|
|
355
|
-
children: [/* @__PURE__ */ l("button", {
|
|
356
|
-
type: "button",
|
|
357
|
-
role: "switch",
|
|
358
|
-
"aria-label": Z.label,
|
|
359
|
-
"aria-checked": Z.on === !0,
|
|
360
|
-
disabled: !Z.available || F !== null,
|
|
361
|
-
onClick: () => void xe(),
|
|
362
|
-
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}`,
|
|
363
|
-
className: Z.on === !1 || Z.on === null ? h : g,
|
|
364
|
-
children: /* @__PURE__ */ u("span", {
|
|
365
|
-
className: "inline-flex items-center gap-1.5",
|
|
366
|
-
children: [Z.on === !1 ? /* @__PURE__ */ l(de, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ l(ae, { className: "h-3.5 w-3.5" }), Z.on === null ? "Microphone unknown" : Z.on ? "Microphone on" : "Microphone off"]
|
|
367
|
-
})
|
|
368
|
-
}), /* @__PURE__ */ l("p", {
|
|
369
|
-
className: "text-[10px] text-foreground-subtle flex-1 leading-relaxed",
|
|
370
|
-
children: L === null ? Z.on === null ? "The camera did not report its microphone, so this state is unknown." : Z.costWhenOff : `Write failed: ${L}`
|
|
371
|
-
})]
|
|
372
|
-
})]
|
|
373
|
-
})
|
|
374
|
-
}) : null;
|
|
375
|
-
}
|
|
376
|
-
//#endregion
|
|
377
|
-
export { v as PrivacyMaskSettings };
|