@camstack/addon-training 0.1.47 → 0.1.48
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-Kfg9dl6B.mjs → MaskShapeCanvas-HNL0xNpy.mjs} +229 -228
- package/dist/MotionZonesSettings-B1g6IUfQ.mjs +291 -0
- package/dist/PrivacyMaskSettings-D4WRZZeD.mjs +339 -0
- package/dist/{ReactKonva-DGuYUN0L.mjs → ReactKonva-DzGysLZQ.mjs} +28 -28
- package/dist/SceneMonitorEditor-pYZfyXtn.mjs +825 -0
- package/dist/_stub.js +11561 -10220
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-cOIklMU6.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-BclY1R96.mjs} +4 -4
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BVsoOuTM.mjs +26 -0
- package/dist/{_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs → _virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs} +1 -1
- package/dist/addon-training.css +1 -1
- package/dist/{chevron-right-D3StkdcR.mjs → chevron-right-cA8Hucbi.mjs} +1 -1
- package/dist/{createLucideIcon-CPP1Jzoz.mjs → createLucideIcon-C0bBNRpC.mjs} +8 -8
- package/dist/{dist-BUzSmOA3.js → dist-DxTjO9kC.js} +173 -4
- package/dist/{dist-CCnnaqt1.mjs → dist-GI2KEl-e.mjs} +173 -4
- package/dist/{grid-2x2-Yngdckwo.mjs → grid-2x2-CHuMzRxF.mjs} +1 -1
- package/dist/{hostInit-v495uwvg.mjs → hostInit-BHX8oN7K.mjs} +3 -3
- package/dist/{icons-C4_Ji5S0.mjs → icons-BwkaMam3.mjs} +9 -9
- package/dist/index.js +1 -1
- package/dist/{mic-off-DPNSd6G7.mjs → mic-off-2uHAsVtR.mjs} +1 -1
- package/dist/orchestrator/training.addon.js +1 -1
- package/dist/orchestrator/training.addon.mjs +1 -1
- package/dist/{player-overlays-DXTsKpgo.mjs → player-overlays-B4V_uIvb.mjs} +25 -25
- package/dist/providers/modal/training-modal.addon.js +1 -1
- package/dist/providers/modal/training-modal.addon.mjs +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-Cfmds8tw.mjs → responsive-1iwc-rj2.mjs} +26 -26
- package/dist/{rotate-ccw-Dak-lXgZ.mjs → rotate-ccw-Cu6tGrgG.mjs} +1 -1
- package/dist/scene-monitor-copy-Cqfs4Vng.mjs +176 -0
- package/dist/{settings-2-Cgiv3kQb.mjs → settings-2-xV0I5Y5U.mjs} +1 -1
- package/dist/{square-B_679zIX.mjs → square-ZPUterXM.mjs} +1 -1
- package/dist/{trash-2-DC8LDYlI.mjs → trash-2-BKfuhsgY.mjs} +1 -1
- package/dist/ui-text-CqJgUCKX.mjs +34 -0
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-CdlOqgkp.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-D5OhZIRm.mjs} +1 -1
- package/dist/{zoom-out-BJoVDYa3.mjs → zoom-out-DDZCsqkQ.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings-15Lfyz9l.mjs +0 -292
- package/dist/PrivacyMaskSettings-CAyzlGjl.mjs +0 -348
- package/dist/SceneMonitorEditor-D49_o83T.mjs +0 -810
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Cn2OEGrR.mjs +0 -26
- package/dist/scene-monitor-copy-DX2u-htD.mjs +0 -136
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { S as e, _ as t, c as n, g as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs";
|
|
2
|
-
import { t as o } from "./grid-2x2-Yngdckwo.mjs";
|
|
3
|
-
import { f as s, h as c, m as l, v as u } from "./responsive-Cfmds8tw.mjs";
|
|
4
|
-
import { n as d, r as f, t as p } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
|
|
5
|
-
import { r as ee, t as m } from "./player-overlays-DXTsKpgo.mjs";
|
|
6
|
-
import { MaskShapeCanvas as h } from "./MaskShapeCanvas-Kfg9dl6B.mjs";
|
|
7
|
-
//#region ../ui-library/src/composites/cap-settings/MotionZonesSettings.tsx
|
|
8
|
-
e();
|
|
9
|
-
var g = 110, _ = "motion-zones", v = 0, te = [
|
|
10
|
-
1,
|
|
11
|
-
2,
|
|
12
|
-
3
|
|
13
|
-
], y = 1, b = "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", x = "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";
|
|
14
|
-
function S(e, t, n) {
|
|
15
|
-
let r = t * n, i = Array.from({ length: r });
|
|
16
|
-
for (let t = 0; t < r; t += 1) i[t] = e[t] === !0;
|
|
17
|
-
return i;
|
|
18
|
-
}
|
|
19
|
-
function ne(e, t) {
|
|
20
|
-
if (e.length !== t.length) return !1;
|
|
21
|
-
for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
|
|
22
|
-
return !0;
|
|
23
|
-
}
|
|
24
|
-
function C(e, t) {
|
|
25
|
-
return Math.ceil(e / t);
|
|
26
|
-
}
|
|
27
|
-
function w(e, t, n) {
|
|
28
|
-
return Math.min(n - 1, Math.floor((e + .5) / t * n));
|
|
29
|
-
}
|
|
30
|
-
function T(e, t, n, r) {
|
|
31
|
-
let i = C(t, r), a = C(n, r), o = Array.from({ length: i * a }, () => !1);
|
|
32
|
-
for (let r = 0; r < n; r += 1) {
|
|
33
|
-
let s = w(r, n, a);
|
|
34
|
-
for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + w(n, t, i)] = !0);
|
|
35
|
-
}
|
|
36
|
-
return o;
|
|
37
|
-
}
|
|
38
|
-
function E(e, t, n, r) {
|
|
39
|
-
let i = C(t, r), a = C(n, r), o = Array.from({ length: t * n }, () => !1);
|
|
40
|
-
for (let r = 0; r < n; r += 1) {
|
|
41
|
-
let s = w(r, n, a);
|
|
42
|
-
for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + w(n, t, i)] === !0;
|
|
43
|
-
}
|
|
44
|
-
return o;
|
|
45
|
-
}
|
|
46
|
-
function D({ deviceId: e }) {
|
|
47
|
-
let w = c(u().trpcClient, e), [D, O] = t(null), [k, A] = t(!1), [j, M] = t(null), [N, P] = t(null), [F, I] = t(y), [L, R] = t(!1), [z, B] = t(!1), V = r(!1);
|
|
48
|
-
a(() => {
|
|
49
|
-
if (!w) return;
|
|
50
|
-
let e = !1;
|
|
51
|
-
return V.current = !1, O(null), A(!1), M(null), P(null), I(y), B(!1), (async () => {
|
|
52
|
-
try {
|
|
53
|
-
let t = await w.motionZones?.getOptions({});
|
|
54
|
-
if (e) return;
|
|
55
|
-
if (!t) throw Error("device proxy not ready");
|
|
56
|
-
if (O(t), V.current) return;
|
|
57
|
-
let n = await w.motionZones?.getStatus({});
|
|
58
|
-
if (e) return;
|
|
59
|
-
if (!n) throw Error("device proxy not ready");
|
|
60
|
-
V.current = !0;
|
|
61
|
-
let r = n.regions.find((e) => e.shape.kind === "grid"), i = S(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
62
|
-
P(i), M(T(i, t.grid.width, t.grid.height, y));
|
|
63
|
-
} catch (t) {
|
|
64
|
-
if (e) return;
|
|
65
|
-
l(t) ? A(!0) : console.error("Motion Zones load failed", t);
|
|
66
|
-
}
|
|
67
|
-
})(), () => {
|
|
68
|
-
e = !0;
|
|
69
|
-
};
|
|
70
|
-
}, [w]);
|
|
71
|
-
let H = D ? D.grid.width : 0, U = D ? D.grid.height : 0, W = C(H, F), G = C(U, F), K = i(() => j && D ? E(j, H, U, F) : null, [
|
|
72
|
-
j,
|
|
73
|
-
D,
|
|
74
|
-
H,
|
|
75
|
-
U,
|
|
76
|
-
F
|
|
77
|
-
]), 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 = n((e) => {
|
|
78
|
-
X > 0 && M(Array.from({ length: X }, () => e));
|
|
79
|
-
}, [X]), re = n(() => {
|
|
80
|
-
M((e) => e && e.map((e) => !e));
|
|
81
|
-
}, []), ie = n(() => {
|
|
82
|
-
N && D && M(T(N, H, U, F));
|
|
83
|
-
}, [
|
|
84
|
-
N,
|
|
85
|
-
D,
|
|
86
|
-
H,
|
|
87
|
-
U,
|
|
88
|
-
F
|
|
89
|
-
]), ae = n((e) => {
|
|
90
|
-
e === F || !D || M((t) => {
|
|
91
|
-
if (!t) return I(e), t;
|
|
92
|
-
let n = T(E(t, H, U, F), H, U, e);
|
|
93
|
-
return I(e), n;
|
|
94
|
-
});
|
|
95
|
-
}, [
|
|
96
|
-
F,
|
|
97
|
-
D,
|
|
98
|
-
H,
|
|
99
|
-
U
|
|
100
|
-
]), Q = i(() => D && j ? [{
|
|
101
|
-
id: v,
|
|
102
|
-
shape: {
|
|
103
|
-
kind: "grid",
|
|
104
|
-
gridWidth: W,
|
|
105
|
-
gridHeight: G,
|
|
106
|
-
cells: [...j]
|
|
107
|
-
}
|
|
108
|
-
}] : [], [
|
|
109
|
-
D,
|
|
110
|
-
j,
|
|
111
|
-
W,
|
|
112
|
-
G
|
|
113
|
-
]), $ = n((e, t) => {
|
|
114
|
-
t.kind === "grid" && M(t.cells);
|
|
115
|
-
}, []), oe = n(async () => {
|
|
116
|
-
if (!(!w || !j || !D)) {
|
|
117
|
-
R(!0);
|
|
118
|
-
try {
|
|
119
|
-
let e = E(j, D.grid.width, D.grid.height, F), t = {
|
|
120
|
-
kind: "grid",
|
|
121
|
-
gridWidth: D.grid.width,
|
|
122
|
-
gridHeight: D.grid.height,
|
|
123
|
-
cells: e
|
|
124
|
-
};
|
|
125
|
-
await w.motionZones?.setZone({ patch: { regions: [{
|
|
126
|
-
id: v,
|
|
127
|
-
enabled: !0,
|
|
128
|
-
shape: t
|
|
129
|
-
}] } });
|
|
130
|
-
let n = await w.motionZones?.getStatus({});
|
|
131
|
-
if (n) {
|
|
132
|
-
let e = n.regions.find((e) => e.shape.kind === "grid"), t = S(e ? e.shape.cells : [], D.grid.width, D.grid.height);
|
|
133
|
-
P(t), M(T(t, D.grid.width, D.grid.height, F));
|
|
134
|
-
}
|
|
135
|
-
} catch (e) {
|
|
136
|
-
console.error("Motion Zones save failed", e);
|
|
137
|
-
} finally {
|
|
138
|
-
R(!1);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}, [
|
|
142
|
-
w,
|
|
143
|
-
j,
|
|
144
|
-
D,
|
|
145
|
-
F
|
|
146
|
-
]);
|
|
147
|
-
return m(i(() => z && !k && D && j ? {
|
|
148
|
-
id: _,
|
|
149
|
-
order: g,
|
|
150
|
-
node: /* @__PURE__ */ d(h, {
|
|
151
|
-
transparent: !0,
|
|
152
|
-
items: Q,
|
|
153
|
-
supportedShapes: ["grid"],
|
|
154
|
-
grid: {
|
|
155
|
-
width: W,
|
|
156
|
-
height: G
|
|
157
|
-
},
|
|
158
|
-
selectedId: v,
|
|
159
|
-
onSelect: () => {},
|
|
160
|
-
onShapeChange: $,
|
|
161
|
-
onDrawComplete: () => {},
|
|
162
|
-
drawingKind: null
|
|
163
|
-
})
|
|
164
|
-
} : null, [
|
|
165
|
-
z,
|
|
166
|
-
k,
|
|
167
|
-
D,
|
|
168
|
-
j,
|
|
169
|
-
Q,
|
|
170
|
-
$,
|
|
171
|
-
W,
|
|
172
|
-
G
|
|
173
|
-
])), w ? /* @__PURE__ */ d(ee, {
|
|
174
|
-
title: "Motion Zones",
|
|
175
|
-
icon: /* @__PURE__ */ d(o, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
176
|
-
children: /* @__PURE__ */ d("div", {
|
|
177
|
-
className: "flex flex-col gap-3",
|
|
178
|
-
children: k ? /* @__PURE__ */ d("p", {
|
|
179
|
-
className: `${s} leading-relaxed`,
|
|
180
|
-
children: "This camera doesn't expose an on-board motion zones grid."
|
|
181
|
-
}) : !k && D !== null && j !== null ? /* @__PURE__ */ f(p, { children: [/* @__PURE__ */ f("p", {
|
|
182
|
-
className: `${s} leading-relaxed`,
|
|
183
|
-
children: [
|
|
184
|
-
"Toggle ",
|
|
185
|
-
/* @__PURE__ */ d("strong", {
|
|
186
|
-
className: "text-foreground",
|
|
187
|
-
children: "Edit grid"
|
|
188
|
-
}),
|
|
189
|
-
" to paint the region directly on the live frame, then ",
|
|
190
|
-
/* @__PURE__ */ d("strong", {
|
|
191
|
-
className: "text-foreground",
|
|
192
|
-
children: "Save"
|
|
193
|
-
}),
|
|
194
|
-
" to push the mask to the camera. Pick a bigger",
|
|
195
|
-
" ",
|
|
196
|
-
/* @__PURE__ */ d("strong", {
|
|
197
|
-
className: "text-foreground",
|
|
198
|
-
children: "Cell size"
|
|
199
|
-
}),
|
|
200
|
-
" for quicker, broad-stroke painting — it's resampled to the camera's native ",
|
|
201
|
-
D.grid.width,
|
|
202
|
-
"×",
|
|
203
|
-
D.grid.height,
|
|
204
|
-
" grid on save (×1 is the finest)."
|
|
205
|
-
]
|
|
206
|
-
}), /* @__PURE__ */ f("div", {
|
|
207
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
208
|
-
children: [
|
|
209
|
-
/* @__PURE__ */ d("button", {
|
|
210
|
-
type: "button",
|
|
211
|
-
onClick: () => B((e) => !e),
|
|
212
|
-
disabled: L,
|
|
213
|
-
"aria-pressed": z,
|
|
214
|
-
className: z ? x : b,
|
|
215
|
-
children: z ? "Done editing" : "Edit grid"
|
|
216
|
-
}),
|
|
217
|
-
/* @__PURE__ */ d("button", {
|
|
218
|
-
type: "button",
|
|
219
|
-
onClick: () => Z(!0),
|
|
220
|
-
disabled: L,
|
|
221
|
-
className: b,
|
|
222
|
-
children: "All on"
|
|
223
|
-
}),
|
|
224
|
-
/* @__PURE__ */ d("button", {
|
|
225
|
-
type: "button",
|
|
226
|
-
onClick: () => Z(!1),
|
|
227
|
-
disabled: L,
|
|
228
|
-
className: b,
|
|
229
|
-
children: "All off"
|
|
230
|
-
}),
|
|
231
|
-
/* @__PURE__ */ d("button", {
|
|
232
|
-
type: "button",
|
|
233
|
-
onClick: re,
|
|
234
|
-
disabled: L,
|
|
235
|
-
className: b,
|
|
236
|
-
children: "Invert"
|
|
237
|
-
}),
|
|
238
|
-
/* @__PURE__ */ f("div", {
|
|
239
|
-
className: "flex items-center gap-1 ml-1",
|
|
240
|
-
role: "group",
|
|
241
|
-
"aria-label": "Cell size",
|
|
242
|
-
children: [/* @__PURE__ */ d("span", {
|
|
243
|
-
className: `${s} mr-0.5`,
|
|
244
|
-
children: "Cell size"
|
|
245
|
-
}), te.map((e) => /* @__PURE__ */ f("button", {
|
|
246
|
-
type: "button",
|
|
247
|
-
onClick: () => ae(e),
|
|
248
|
-
disabled: L,
|
|
249
|
-
"aria-pressed": F === e,
|
|
250
|
-
title: e === 1 ? `Camera grid ${H}×${U} (finest)` : `${C(H, e)}×${C(U, e)} painting grid · cells ×${e} bigger`,
|
|
251
|
-
className: F === e ? x : b,
|
|
252
|
-
children: ["×", e]
|
|
253
|
-
}, e))]
|
|
254
|
-
}),
|
|
255
|
-
/* @__PURE__ */ f("span", {
|
|
256
|
-
className: `${s} ml-1 tabular-nums`,
|
|
257
|
-
children: [
|
|
258
|
-
J,
|
|
259
|
-
" / ",
|
|
260
|
-
Y,
|
|
261
|
-
" cells · ",
|
|
262
|
-
D.grid.width,
|
|
263
|
-
"×",
|
|
264
|
-
D.grid.height,
|
|
265
|
-
F === 1 ? "" : ` · paint ${W}×${G}`
|
|
266
|
-
]
|
|
267
|
-
}),
|
|
268
|
-
/* @__PURE__ */ d("span", { className: "flex-1" }),
|
|
269
|
-
/* @__PURE__ */ d("button", {
|
|
270
|
-
type: "button",
|
|
271
|
-
onClick: ie,
|
|
272
|
-
disabled: L || !q,
|
|
273
|
-
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",
|
|
274
|
-
children: "Revert"
|
|
275
|
-
}),
|
|
276
|
-
/* @__PURE__ */ d("button", {
|
|
277
|
-
type: "button",
|
|
278
|
-
onClick: () => void oe(),
|
|
279
|
-
disabled: L || !q,
|
|
280
|
-
className: x,
|
|
281
|
-
children: L ? "Saving…" : "Save"
|
|
282
|
-
})
|
|
283
|
-
]
|
|
284
|
-
})] }) : /* @__PURE__ */ d("p", {
|
|
285
|
-
className: `${s} leading-relaxed`,
|
|
286
|
-
children: "Loading the camera's grid…"
|
|
287
|
-
})
|
|
288
|
-
})
|
|
289
|
-
}) : null;
|
|
290
|
-
}
|
|
291
|
-
//#endregion
|
|
292
|
-
export { D as MotionZonesSettings };
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import { S as e, _ as t, c as n, g as r, m as i, u as a } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-DeDbF7NI.mjs";
|
|
2
|
-
import { n as ee, r as te, t as ne } from "./square-B_679zIX.mjs";
|
|
3
|
-
import { n as re, t as ie } from "./mic-off-DPNSd6G7.mjs";
|
|
4
|
-
import { t as ae } from "./trash-2-DC8LDYlI.mjs";
|
|
5
|
-
import { f as o, h as oe, m as se, v as s } from "./responsive-Cfmds8tw.mjs";
|
|
6
|
-
import { n as c, r as l, t as ce } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
|
|
7
|
-
import { r as le, t as ue } from "./player-overlays-DXTsKpgo.mjs";
|
|
8
|
-
import { MaskShapeCanvas as de } from "./MaskShapeCanvas-Kfg9dl6B.mjs";
|
|
9
|
-
//#region ../ui-library/src/composites/cap-settings/privacy-mask-audio.ts
|
|
10
|
-
e();
|
|
11
|
-
var u = "Microphone", d = "The camera encodes no audio at all — live view, recordings, exports and the audio analyzer are all silent.";
|
|
12
|
-
function fe(e) {
|
|
13
|
-
let t = e.supportsAudioMute === !0, n = t ? e.audioEnabled : null, r = e.pendingOn ?? null;
|
|
14
|
-
return {
|
|
15
|
-
label: u,
|
|
16
|
-
supported: t,
|
|
17
|
-
on: n === null ? null : r ?? n,
|
|
18
|
-
available: t && n !== null,
|
|
19
|
-
costWhenOff: d
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function f(e) {
|
|
23
|
-
return !e.available || e.on === null ? null : { enabled: !e.on };
|
|
24
|
-
}
|
|
25
|
-
//#endregion
|
|
26
|
-
//#region ../ui-library/src/composites/cap-settings/PrivacyMaskSettings.tsx
|
|
27
|
-
var p = 120, pe = "privacy-mask", m = "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", h = "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";
|
|
28
|
-
function g(e) {
|
|
29
|
-
return e.kind === "rect" || e.kind === "polygon" ? e : null;
|
|
30
|
-
}
|
|
31
|
-
function me(e) {
|
|
32
|
-
let t = new Set(e.map((e) => e.id)), n = 0;
|
|
33
|
-
for (; t.has(n);) n += 1;
|
|
34
|
-
return n;
|
|
35
|
-
}
|
|
36
|
-
function he(e, t) {
|
|
37
|
-
if (e.length !== t.length) return !1;
|
|
38
|
-
for (let n = 0; n < e.length; n += 1) if (JSON.stringify(e[n]) !== JSON.stringify(t[n])) return !1;
|
|
39
|
-
return !0;
|
|
40
|
-
}
|
|
41
|
-
function _({ deviceId: e }) {
|
|
42
|
-
let u = oe(s().trpcClient, e), [d, _] = t(null), [v, y] = t(!1), [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), [ge, P] = t(null), [F, I] = t(null), [L, R] = t(null), z = r(!1);
|
|
43
|
-
a(() => {
|
|
44
|
-
if (!u) return;
|
|
45
|
-
let e = !1;
|
|
46
|
-
return z.current = !1, _(null), y(!1), x(!1), C(null), T(null), k(!1), j(null), N(null), P(null), I(null), R(null), (async () => {
|
|
47
|
-
try {
|
|
48
|
-
let t = await u.privacyMask?.getOptions({});
|
|
49
|
-
if (e) return;
|
|
50
|
-
if (!t) throw Error("device proxy not ready");
|
|
51
|
-
if (_(t), z.current) return;
|
|
52
|
-
let n = await u.privacyMask?.getStatus({});
|
|
53
|
-
if (e) return;
|
|
54
|
-
if (!n) throw Error("device proxy not ready");
|
|
55
|
-
if (n.regions === null) {
|
|
56
|
-
x(!0), P(n.audioEnabled);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
z.current = !0;
|
|
60
|
-
let r = {
|
|
61
|
-
enabled: n.enabled,
|
|
62
|
-
regions: n.regions
|
|
63
|
-
};
|
|
64
|
-
T(r), C(r), P(n.audioEnabled);
|
|
65
|
-
} catch (t) {
|
|
66
|
-
if (e) return;
|
|
67
|
-
se(t) ? y(!0) : console.error("Privacy Mask load failed", t);
|
|
68
|
-
}
|
|
69
|
-
})(), () => {
|
|
70
|
-
e = !0;
|
|
71
|
-
};
|
|
72
|
-
}, [u]);
|
|
73
|
-
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);
|
|
74
|
-
a(() => {
|
|
75
|
-
U.current = H;
|
|
76
|
-
}, [H]);
|
|
77
|
-
let W = H > 0 && V >= H, _e = n(() => {
|
|
78
|
-
C((e) => e && {
|
|
79
|
-
...e,
|
|
80
|
-
enabled: !e.enabled
|
|
81
|
-
});
|
|
82
|
-
}, []), G = n((e) => {
|
|
83
|
-
j(typeof e == "number" ? e : null);
|
|
84
|
-
}, []), K = i(() => S ? S.regions.map((e) => ({
|
|
85
|
-
id: e.id,
|
|
86
|
-
shape: e.shape,
|
|
87
|
-
enabled: e.enabled,
|
|
88
|
-
label: `Zone ${String(e.id)}`
|
|
89
|
-
})) : [], [S]), q = n((e, t) => {
|
|
90
|
-
let n = g(t);
|
|
91
|
-
n && C((t) => t && {
|
|
92
|
-
...t,
|
|
93
|
-
regions: t.regions.map((t) => t.id === e ? {
|
|
94
|
-
...t,
|
|
95
|
-
shape: n
|
|
96
|
-
} : t)
|
|
97
|
-
});
|
|
98
|
-
}, []), J = n((e) => {
|
|
99
|
-
let t = g(e);
|
|
100
|
-
t && (N(null), C((e) => {
|
|
101
|
-
if (!e) return e;
|
|
102
|
-
let n = U.current;
|
|
103
|
-
if (n > 0 && e.regions.length >= n) return e;
|
|
104
|
-
let r = me(e.regions), i = {
|
|
105
|
-
id: r,
|
|
106
|
-
enabled: !0,
|
|
107
|
-
shape: t
|
|
108
|
-
};
|
|
109
|
-
return j(r), {
|
|
110
|
-
...e,
|
|
111
|
-
regions: [...e.regions, i]
|
|
112
|
-
};
|
|
113
|
-
}));
|
|
114
|
-
}, []), Y = n((e) => {
|
|
115
|
-
k(!0), j(null), N(e);
|
|
116
|
-
}, []), ve = n((e) => {
|
|
117
|
-
k(!0), N(null), j(e);
|
|
118
|
-
}, []), X = n((e) => {
|
|
119
|
-
j((t) => t === e ? null : t), C((t) => t && {
|
|
120
|
-
...t,
|
|
121
|
-
regions: t.regions.filter((t) => t.id !== e)
|
|
122
|
-
});
|
|
123
|
-
}, []), ye = n(() => {
|
|
124
|
-
N(null), j(null), w && C({
|
|
125
|
-
enabled: w.enabled,
|
|
126
|
-
regions: w.regions
|
|
127
|
-
});
|
|
128
|
-
}, [w]), be = n(async () => {
|
|
129
|
-
if (!(!u || !S)) {
|
|
130
|
-
D(!0);
|
|
131
|
-
try {
|
|
132
|
-
await u.privacyMask?.setMask({ patch: {
|
|
133
|
-
enabled: S.enabled,
|
|
134
|
-
regions: [...S.regions]
|
|
135
|
-
} });
|
|
136
|
-
let e = await u.privacyMask?.getStatus({});
|
|
137
|
-
if (e && e.regions !== null) {
|
|
138
|
-
let t = {
|
|
139
|
-
enabled: e.enabled,
|
|
140
|
-
regions: e.regions
|
|
141
|
-
};
|
|
142
|
-
T(t), C(t);
|
|
143
|
-
}
|
|
144
|
-
} catch (e) {
|
|
145
|
-
console.error("Privacy Mask save failed", e);
|
|
146
|
-
} finally {
|
|
147
|
-
D(!1);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}, [u, S]), Z = fe({
|
|
151
|
-
supportsAudioMute: d === null ? null : d.supportsAudioMute,
|
|
152
|
-
audioEnabled: ge,
|
|
153
|
-
pendingOn: F
|
|
154
|
-
}), xe = n(async () => {
|
|
155
|
-
let e = f(Z);
|
|
156
|
-
if (!(!u || e === null)) {
|
|
157
|
-
I(e.enabled), R(null);
|
|
158
|
-
try {
|
|
159
|
-
await u.privacyMask?.setAudioEnabled(e);
|
|
160
|
-
let t = await u.privacyMask?.getStatus({});
|
|
161
|
-
t && P(t.audioEnabled);
|
|
162
|
-
} catch (e) {
|
|
163
|
-
console.error("Privacy microphone write failed — reverting", e), R(e instanceof Error ? e.message : String(e));
|
|
164
|
-
} finally {
|
|
165
|
-
I(null);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}, [u, Z]), Se = n(() => {
|
|
169
|
-
k((e) => (e && (N(null), j(null)), !e));
|
|
170
|
-
}, []), Q = d?.supportedShapes ?? [];
|
|
171
|
-
ue(i(() => O && !v && d && S ? {
|
|
172
|
-
id: pe,
|
|
173
|
-
order: p,
|
|
174
|
-
node: /* @__PURE__ */ c(de, {
|
|
175
|
-
transparent: !0,
|
|
176
|
-
items: K,
|
|
177
|
-
supportedShapes: Q,
|
|
178
|
-
polygonVertices: d.polygonVertices,
|
|
179
|
-
selectedId: A,
|
|
180
|
-
onSelect: G,
|
|
181
|
-
onShapeChange: q,
|
|
182
|
-
onDrawComplete: J,
|
|
183
|
-
drawingKind: M
|
|
184
|
-
})
|
|
185
|
-
} : null, [
|
|
186
|
-
O,
|
|
187
|
-
v,
|
|
188
|
-
d,
|
|
189
|
-
S,
|
|
190
|
-
K,
|
|
191
|
-
Q,
|
|
192
|
-
A,
|
|
193
|
-
G,
|
|
194
|
-
q,
|
|
195
|
-
J,
|
|
196
|
-
M
|
|
197
|
-
]));
|
|
198
|
-
let Ce = d?.supportedShapes.includes("rect") ?? !1, we = d?.supportedShapes.includes("polygon") ?? !1, $ = d !== null && (d.maxRegions <= 0 || d.supportedShapes.length === 0);
|
|
199
|
-
return u ? /* @__PURE__ */ c(le, {
|
|
200
|
-
title: "Privacy Mask",
|
|
201
|
-
icon: /* @__PURE__ */ c(te, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
202
|
-
children: /* @__PURE__ */ l("div", {
|
|
203
|
-
className: "flex flex-col gap-3",
|
|
204
|
-
children: [v || $ ? /* @__PURE__ */ c("p", {
|
|
205
|
-
className: `${o} leading-relaxed`,
|
|
206
|
-
children: "This camera doesn't support an on-board privacy mask."
|
|
207
|
-
}) : b ? /* @__PURE__ */ c("p", {
|
|
208
|
-
className: `${o} leading-relaxed`,
|
|
209
|
-
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."
|
|
210
|
-
}) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ l(ce, { children: [
|
|
211
|
-
/* @__PURE__ */ l("p", {
|
|
212
|
-
className: `${o} leading-relaxed`,
|
|
213
|
-
children: [
|
|
214
|
-
"Toggle ",
|
|
215
|
-
/* @__PURE__ */ c("strong", {
|
|
216
|
-
className: "text-foreground",
|
|
217
|
-
children: "Edit mask"
|
|
218
|
-
}),
|
|
219
|
-
" to draw blanked-out zones on the live frame, then ",
|
|
220
|
-
/* @__PURE__ */ c("strong", {
|
|
221
|
-
className: "text-foreground",
|
|
222
|
-
children: "Save"
|
|
223
|
-
}),
|
|
224
|
-
" 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."
|
|
225
|
-
]
|
|
226
|
-
}),
|
|
227
|
-
/* @__PURE__ */ l("div", {
|
|
228
|
-
className: "flex items-center gap-2 flex-wrap",
|
|
229
|
-
children: [
|
|
230
|
-
/* @__PURE__ */ c("button", {
|
|
231
|
-
type: "button",
|
|
232
|
-
onClick: Se,
|
|
233
|
-
disabled: E,
|
|
234
|
-
"aria-pressed": O,
|
|
235
|
-
className: O ? h : m,
|
|
236
|
-
children: O ? "Done editing" : "Edit mask"
|
|
237
|
-
}),
|
|
238
|
-
/* @__PURE__ */ c("button", {
|
|
239
|
-
type: "button",
|
|
240
|
-
onClick: _e,
|
|
241
|
-
disabled: E,
|
|
242
|
-
"aria-pressed": S.enabled,
|
|
243
|
-
className: S.enabled ? h : m,
|
|
244
|
-
children: S.enabled ? "Mask on" : "Mask off"
|
|
245
|
-
}),
|
|
246
|
-
Ce && /* @__PURE__ */ c("button", {
|
|
247
|
-
type: "button",
|
|
248
|
-
onClick: () => Y("rect"),
|
|
249
|
-
disabled: E || W,
|
|
250
|
-
"aria-pressed": M === "rect",
|
|
251
|
-
className: M === "rect" ? h : m,
|
|
252
|
-
title: W ? "Maximum zones reached" : "Add a rectangle zone",
|
|
253
|
-
children: "+ Rect"
|
|
254
|
-
}),
|
|
255
|
-
we && /* @__PURE__ */ c("button", {
|
|
256
|
-
type: "button",
|
|
257
|
-
onClick: () => Y("polygon"),
|
|
258
|
-
disabled: E || W,
|
|
259
|
-
"aria-pressed": M === "polygon",
|
|
260
|
-
className: M === "polygon" ? h : m,
|
|
261
|
-
title: W ? "Maximum zones reached" : "Add a polygon zone",
|
|
262
|
-
children: "+ Polygon"
|
|
263
|
-
}),
|
|
264
|
-
/* @__PURE__ */ l("span", {
|
|
265
|
-
className: `${o} ml-1 tabular-nums`,
|
|
266
|
-
children: [
|
|
267
|
-
V,
|
|
268
|
-
" / ",
|
|
269
|
-
H,
|
|
270
|
-
" zones"
|
|
271
|
-
]
|
|
272
|
-
}),
|
|
273
|
-
/* @__PURE__ */ c("span", { className: "flex-1" }),
|
|
274
|
-
/* @__PURE__ */ c("button", {
|
|
275
|
-
type: "button",
|
|
276
|
-
onClick: ye,
|
|
277
|
-
disabled: E || !B,
|
|
278
|
-
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",
|
|
279
|
-
children: "Revert"
|
|
280
|
-
}),
|
|
281
|
-
/* @__PURE__ */ c("button", {
|
|
282
|
-
type: "button",
|
|
283
|
-
onClick: () => void be(),
|
|
284
|
-
disabled: E || !B,
|
|
285
|
-
className: h,
|
|
286
|
-
children: E ? "Saving…" : "Save"
|
|
287
|
-
})
|
|
288
|
-
]
|
|
289
|
-
}),
|
|
290
|
-
V > 0 ? /* @__PURE__ */ c("div", {
|
|
291
|
-
className: "flex flex-col gap-1",
|
|
292
|
-
children: S.regions.map((e) => {
|
|
293
|
-
let t = A === e.id, n = e.shape.kind === "polygon" ? re : ne;
|
|
294
|
-
return /* @__PURE__ */ l("div", {
|
|
295
|
-
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"}`,
|
|
296
|
-
children: [/* @__PURE__ */ l("button", {
|
|
297
|
-
type: "button",
|
|
298
|
-
onClick: () => ve(e.id),
|
|
299
|
-
disabled: E,
|
|
300
|
-
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",
|
|
301
|
-
children: [
|
|
302
|
-
/* @__PURE__ */ c(n, { className: "h-3.5 w-3.5 shrink-0" }),
|
|
303
|
-
/* @__PURE__ */ l("span", { children: ["Zone ", e.id] }),
|
|
304
|
-
/* @__PURE__ */ c("span", {
|
|
305
|
-
className: "text-foreground-faint capitalize",
|
|
306
|
-
children: e.shape.kind
|
|
307
|
-
})
|
|
308
|
-
]
|
|
309
|
-
}), /* @__PURE__ */ c("button", {
|
|
310
|
-
type: "button",
|
|
311
|
-
onClick: () => X(e.id),
|
|
312
|
-
disabled: E,
|
|
313
|
-
"aria-label": `Delete zone ${String(e.id)}`,
|
|
314
|
-
title: "Delete zone",
|
|
315
|
-
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",
|
|
316
|
-
children: /* @__PURE__ */ c(ae, { className: "h-3.5 w-3.5" })
|
|
317
|
-
})]
|
|
318
|
-
}, e.id);
|
|
319
|
-
})
|
|
320
|
-
}) : null
|
|
321
|
-
] }) : /* @__PURE__ */ c("p", {
|
|
322
|
-
className: `${o} leading-relaxed`,
|
|
323
|
-
children: "Loading the camera's privacy mask…"
|
|
324
|
-
}), Z.supported && /* @__PURE__ */ l("div", {
|
|
325
|
-
className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",
|
|
326
|
-
children: [/* @__PURE__ */ c("button", {
|
|
327
|
-
type: "button",
|
|
328
|
-
role: "switch",
|
|
329
|
-
"aria-label": Z.label,
|
|
330
|
-
"aria-checked": Z.on === !0,
|
|
331
|
-
disabled: !Z.available || F !== null,
|
|
332
|
-
onClick: () => void xe(),
|
|
333
|
-
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}`,
|
|
334
|
-
className: Z.on === !1 || Z.on === null ? m : h,
|
|
335
|
-
children: /* @__PURE__ */ l("span", {
|
|
336
|
-
className: "inline-flex items-center gap-1.5",
|
|
337
|
-
children: [Z.on === !1 ? /* @__PURE__ */ c(ie, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ c(ee, { className: "h-3.5 w-3.5" }), Z.on === null ? "Microphone unknown" : Z.on ? "Microphone on" : "Microphone off"]
|
|
338
|
-
})
|
|
339
|
-
}), /* @__PURE__ */ c("p", {
|
|
340
|
-
className: "text-[10px] text-foreground-subtle flex-1 leading-relaxed",
|
|
341
|
-
children: L === null ? Z.on === null ? "The camera did not report its microphone, so this state is unknown." : Z.costWhenOff : `Write failed: ${L}`
|
|
342
|
-
})]
|
|
343
|
-
})]
|
|
344
|
-
})
|
|
345
|
-
}) : null;
|
|
346
|
-
}
|
|
347
|
-
//#endregion
|
|
348
|
-
export { _ as PrivacyMaskSettings };
|