@camstack/addon-training 0.1.20 → 0.1.22
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-BokARvOj.mjs +13806 -0
- package/dist/MotionZonesSettings-DshSNzpp.mjs +310 -0
- package/dist/{PrivacyMaskSettings-Bo1S23wt.mjs → PrivacyMaskSettings-DDaIx7j5.mjs} +70 -45
- package/dist/{SceneMonitorEditor-DnQJ7Hx3.mjs → SceneMonitorEditor-CuJ7xjyd.mjs} +311 -311
- package/dist/_stub.js +7264 -16772
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-BlFM0TmL.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-DJDgoXBt.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-D7T4QEtw.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BSOdwqcC.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-B3rryujf.mjs +25 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-nL4MGFRP.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-BT_wL8s3.mjs} +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DDBEvLdo.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom__loadShare__.js-CK-LlgOt.mjs +26 -0
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-gTIQrhKs.mjs +25 -0
- package/dist/{dist-l5PSmQZo.js → dist-Dd6EAdVX.js} +39 -1
- package/dist/{dist-p0tvRgy8.mjs → dist-DhCvklZW.mjs} +39 -1
- package/dist/{hostInit-Dy4zvQir.mjs → hostInit-DR-St7pA.mjs} +2 -2
- package/dist/index.js +8 -1
- package/dist/index.mjs +7 -0
- package/dist/orchestrator/training.addon.js +1 -1
- package/dist/orchestrator/training.addon.mjs +1 -1
- package/dist/{player-overlays-BR2_H0wZ.mjs → player-overlays-DUZMtmvk.mjs} +10 -32
- package/dist/providers/modal/training-modal.addon.js +71 -92
- package/dist/providers/modal/training-modal.addon.mjs +71 -92
- package/dist/remoteEntry.js +1 -1
- package/dist/{responsive-emJo3EdF.mjs → responsive-C7QsFtTb.mjs} +38 -42
- package/dist/{scene-monitor-copy-CcQxbRXa.mjs → scene-monitor-copy-BtffdnnW.mjs} +4 -4
- package/dist/{square-CErp1WgN.mjs → square-e5Ytjod_.mjs} +4 -29
- package/dist/{trash-2-Drz0fMgI.mjs → trash-2-Clte6zIF.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-CacDWi0w.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-dy7yMOdw.mjs} +390 -399
- package/package.json +1 -1
- package/dist/MaskShapeCanvas-Kfg9dl6B.mjs +0 -686
- package/dist/MotionZonesSettings-DflIL9ss.mjs +0 -292
- package/dist/ReactKonva-DGuYUN0L.mjs +0 -5416
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-C7dks3FG.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-DpjirGmB.mjs +0 -89
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_client__loadShare__.js-CFCVuRAs.mjs +0 -58
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.js-BkvDudqY.mjs +0 -62
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs +0 -34
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom__loadShare__.js-DAZkHxxU.mjs +0 -45
- package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_2_dom_mf_1_client__loadShare__.js-CHqN9NLt.mjs +0 -34
- package/dist/grid-2x2-D9syAI6z.mjs +0 -21
- package/dist/lib-CVGFTwe0.mjs +0 -7770
|
@@ -0,0 +1,310 @@
|
|
|
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_training_page__loadShare__react__loadShare__.js-BT_wL8s3.mjs";
|
|
2
|
+
import { _ as o, f as s, h as ee, m as c, y as l } from "./responsive-C7QsFtTb.mjs";
|
|
3
|
+
import { n as u, t as d } from "./player-overlays-DUZMtmvk.mjs";
|
|
4
|
+
import { n as f, r as p, t as m } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DDBEvLdo.mjs";
|
|
5
|
+
import { MaskShapeCanvas as h } from "./MaskShapeCanvas-BokARvOj.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 te = 110, _ = "motion-zones", v = 0, ne = [
|
|
28
|
+
1,
|
|
29
|
+
2,
|
|
30
|
+
3
|
|
31
|
+
], 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";
|
|
32
|
+
function S(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 re(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: e }) {
|
|
65
|
+
let l = ee(o().trpcClient, e), [w, D] = n(null), [O, k] = n(!1), [A, j] = n(null), [M, N] = n(null), [P, F] = n(y), [I, L] = n(!1), [R, z] = n(!1), B = r(!1);
|
|
66
|
+
a(() => {
|
|
67
|
+
if (!l) return;
|
|
68
|
+
let e = !1;
|
|
69
|
+
return B.current = !1, D(null), k(!1), j(null), N(null), F(y), z(!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 (D(t), B.current) return;
|
|
75
|
+
let n = await l.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 = S(r ? r.shape.cells : [], t.grid.width, t.grid.height);
|
|
80
|
+
N(i), j(T(i, t.grid.width, t.grid.height, y));
|
|
81
|
+
} catch (t) {
|
|
82
|
+
if (e) return;
|
|
83
|
+
c(t) ? k(!0) : console.error("Motion Zones load failed", t);
|
|
84
|
+
}
|
|
85
|
+
})(), () => {
|
|
86
|
+
e = !0;
|
|
87
|
+
};
|
|
88
|
+
}, [l]);
|
|
89
|
+
let V = w ? w.grid.width : 0, H = w ? w.grid.height : 0, U = C(V, P), W = C(H, P), G = i(() => A && w ? E(A, V, H, P) : null, [
|
|
90
|
+
A,
|
|
91
|
+
w,
|
|
92
|
+
V,
|
|
93
|
+
H,
|
|
94
|
+
P
|
|
95
|
+
]), K = i(() => G !== null && M !== null && !re(G, M), [G, M]), q = i(() => G ? G.reduce((e, t) => t ? e + 1 : e, 0) : 0, [G]), J = V * H, Y = U * W, X = t((e) => {
|
|
96
|
+
Y > 0 && j(Array.from({ length: Y }, () => e));
|
|
97
|
+
}, [Y]), ie = t(() => {
|
|
98
|
+
j((e) => e && e.map((e) => !e));
|
|
99
|
+
}, []), Z = t(() => {
|
|
100
|
+
M && w && j(T(M, V, H, P));
|
|
101
|
+
}, [
|
|
102
|
+
M,
|
|
103
|
+
w,
|
|
104
|
+
V,
|
|
105
|
+
H,
|
|
106
|
+
P
|
|
107
|
+
]), ae = t((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 = i(() => w && A ? [{
|
|
119
|
+
id: v,
|
|
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
|
+
]), $ = t((e, t) => {
|
|
132
|
+
t.kind === "grid" && j(t.cells);
|
|
133
|
+
}, []), oe = t(async () => {
|
|
134
|
+
if (!(!l || !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 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 = S(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
|
+
l,
|
|
161
|
+
A,
|
|
162
|
+
w,
|
|
163
|
+
P
|
|
164
|
+
]);
|
|
165
|
+
return d(i(() => R && !O && w && A ? {
|
|
166
|
+
id: _,
|
|
167
|
+
order: te,
|
|
168
|
+
node: /* @__PURE__ */ f(h, {
|
|
169
|
+
transparent: !0,
|
|
170
|
+
items: Q,
|
|
171
|
+
supportedShapes: ["grid"],
|
|
172
|
+
grid: {
|
|
173
|
+
width: U,
|
|
174
|
+
height: W
|
|
175
|
+
},
|
|
176
|
+
selectedId: v,
|
|
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
|
+
])), 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: O ? /* @__PURE__ */ f("p", {
|
|
197
|
+
className: `${s} leading-relaxed`,
|
|
198
|
+
children: "This camera doesn't expose an on-board motion zones grid."
|
|
199
|
+
}) : !O && w !== null && A !== null ? /* @__PURE__ */ p(m, { children: [/* @__PURE__ */ p("p", {
|
|
200
|
+
className: `${s} 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
|
+
w.grid.width,
|
|
220
|
+
"×",
|
|
221
|
+
w.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: () => z((e) => !e),
|
|
230
|
+
disabled: I,
|
|
231
|
+
"aria-pressed": R,
|
|
232
|
+
className: R ? x : b,
|
|
233
|
+
children: R ? "Done editing" : "Edit grid"
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ f("button", {
|
|
236
|
+
type: "button",
|
|
237
|
+
onClick: () => X(!0),
|
|
238
|
+
disabled: I,
|
|
239
|
+
className: b,
|
|
240
|
+
children: "All on"
|
|
241
|
+
}),
|
|
242
|
+
/* @__PURE__ */ f("button", {
|
|
243
|
+
type: "button",
|
|
244
|
+
onClick: () => X(!1),
|
|
245
|
+
disabled: I,
|
|
246
|
+
className: b,
|
|
247
|
+
children: "All off"
|
|
248
|
+
}),
|
|
249
|
+
/* @__PURE__ */ f("button", {
|
|
250
|
+
type: "button",
|
|
251
|
+
onClick: ie,
|
|
252
|
+
disabled: I,
|
|
253
|
+
className: b,
|
|
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: `${s} mr-0.5`,
|
|
262
|
+
children: "Cell size"
|
|
263
|
+
}), ne.map((e) => /* @__PURE__ */ p("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 ? x : b,
|
|
270
|
+
children: ["×", e]
|
|
271
|
+
}, e))]
|
|
272
|
+
}),
|
|
273
|
+
/* @__PURE__ */ p("span", {
|
|
274
|
+
className: `${s} 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__ */ f("span", { className: "flex-1" }),
|
|
287
|
+
/* @__PURE__ */ f("button", {
|
|
288
|
+
type: "button",
|
|
289
|
+
onClick: Z,
|
|
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__ */ f("button", {
|
|
295
|
+
type: "button",
|
|
296
|
+
onClick: () => void oe(),
|
|
297
|
+
disabled: I || !K,
|
|
298
|
+
className: x,
|
|
299
|
+
children: I ? "Saving…" : "Save"
|
|
300
|
+
})
|
|
301
|
+
]
|
|
302
|
+
})] }) : /* @__PURE__ */ f("p", {
|
|
303
|
+
className: `${s} leading-relaxed`,
|
|
304
|
+
children: "Loading the camera's grid…"
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
}) : null;
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
export { D as MotionZonesSettings };
|
|
@@ -1,14 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import { n as l, r as u, t as
|
|
7
|
-
import { MaskShapeCanvas as
|
|
8
|
-
var
|
|
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_training_page__loadShare__react__loadShare__.js-BT_wL8s3.mjs";
|
|
2
|
+
import { _ as ee, f as o, h as te, m as ne, y as s } from "./responsive-C7QsFtTb.mjs";
|
|
3
|
+
import { n as re, t as ie } from "./player-overlays-DUZMtmvk.mjs";
|
|
4
|
+
import { n as ae, r as oe, t as se } from "./square-e5Ytjod_.mjs";
|
|
5
|
+
import { t as c } from "./trash-2-Clte6zIF.mjs";
|
|
6
|
+
import { n as l, r as u, t as ce } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DDBEvLdo.mjs";
|
|
7
|
+
import { MaskShapeCanvas as le } from "./MaskShapeCanvas-BokARvOj.mjs";
|
|
8
|
+
var ue = s("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
|
+
}]]), 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
|
+
]);
|
|
12
37
|
//#endregion
|
|
13
38
|
//#region ../ui-library/src/composites/cap-settings/privacy-mask-audio.ts
|
|
14
39
|
e();
|
|
@@ -43,17 +68,17 @@ function he(e, t) {
|
|
|
43
68
|
return !0;
|
|
44
69
|
}
|
|
45
70
|
function v({ deviceId: e }) {
|
|
46
|
-
let
|
|
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);
|
|
47
72
|
a(() => {
|
|
48
|
-
if (!
|
|
73
|
+
if (!s) return;
|
|
49
74
|
let e = !1;
|
|
50
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 () => {
|
|
51
76
|
try {
|
|
52
|
-
let t = await
|
|
77
|
+
let t = await s.privacyMask?.getOptions({});
|
|
53
78
|
if (e) return;
|
|
54
79
|
if (!t) throw Error("device proxy not ready");
|
|
55
80
|
if (f(t), z.current) return;
|
|
56
|
-
let n = await
|
|
81
|
+
let n = await s.privacyMask?.getStatus({});
|
|
57
82
|
if (e) return;
|
|
58
83
|
if (!n) throw Error("device proxy not ready");
|
|
59
84
|
if (n.regions === null) {
|
|
@@ -68,29 +93,29 @@ function v({ deviceId: e }) {
|
|
|
68
93
|
T(r), C(r), P(n.audioEnabled);
|
|
69
94
|
} catch (t) {
|
|
70
95
|
if (e) return;
|
|
71
|
-
|
|
96
|
+
ne(t) ? y(!0) : console.error("Privacy Mask load failed", t);
|
|
72
97
|
}
|
|
73
98
|
})(), () => {
|
|
74
99
|
e = !0;
|
|
75
100
|
};
|
|
76
|
-
}, [
|
|
101
|
+
}, [s]);
|
|
77
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);
|
|
78
103
|
a(() => {
|
|
79
104
|
U.current = H;
|
|
80
105
|
}, [H]);
|
|
81
|
-
let W = H > 0 && V >= H, _e =
|
|
106
|
+
let W = H > 0 && V >= H, _e = t(() => {
|
|
82
107
|
C((e) => e && {
|
|
83
108
|
...e,
|
|
84
109
|
enabled: !e.enabled
|
|
85
110
|
});
|
|
86
|
-
}, []), G =
|
|
111
|
+
}, []), G = t((e) => {
|
|
87
112
|
j(typeof e == "number" ? e : null);
|
|
88
113
|
}, []), K = i(() => S ? S.regions.map((e) => ({
|
|
89
114
|
id: e.id,
|
|
90
115
|
shape: e.shape,
|
|
91
116
|
enabled: e.enabled,
|
|
92
117
|
label: `Zone ${String(e.id)}`
|
|
93
|
-
})) : [], [S]), q =
|
|
118
|
+
})) : [], [S]), q = t((e, t) => {
|
|
94
119
|
let n = _(t);
|
|
95
120
|
n && C((t) => t && {
|
|
96
121
|
...t,
|
|
@@ -99,7 +124,7 @@ function v({ deviceId: e }) {
|
|
|
99
124
|
shape: n
|
|
100
125
|
} : t)
|
|
101
126
|
});
|
|
102
|
-
}, []), J =
|
|
127
|
+
}, []), J = t((e) => {
|
|
103
128
|
let t = _(e);
|
|
104
129
|
t && (N(null), C((e) => {
|
|
105
130
|
if (!e) return e;
|
|
@@ -115,29 +140,29 @@ function v({ deviceId: e }) {
|
|
|
115
140
|
regions: [...e.regions, i]
|
|
116
141
|
};
|
|
117
142
|
}));
|
|
118
|
-
}, []), Y =
|
|
143
|
+
}, []), Y = t((e) => {
|
|
119
144
|
k(!0), j(null), N(e);
|
|
120
|
-
}, []), ve =
|
|
145
|
+
}, []), ve = t((e) => {
|
|
121
146
|
k(!0), N(null), j(e);
|
|
122
|
-
}, []), X =
|
|
147
|
+
}, []), X = t((e) => {
|
|
123
148
|
j((t) => t === e ? null : t), C((t) => t && {
|
|
124
149
|
...t,
|
|
125
150
|
regions: t.regions.filter((t) => t.id !== e)
|
|
126
151
|
});
|
|
127
|
-
}, []), ye =
|
|
152
|
+
}, []), ye = t(() => {
|
|
128
153
|
N(null), j(null), w && C({
|
|
129
154
|
enabled: w.enabled,
|
|
130
155
|
regions: w.regions
|
|
131
156
|
});
|
|
132
|
-
}, [w]), be =
|
|
133
|
-
if (!(!
|
|
157
|
+
}, [w]), be = t(async () => {
|
|
158
|
+
if (!(!s || !S)) {
|
|
134
159
|
D(!0);
|
|
135
160
|
try {
|
|
136
|
-
await
|
|
161
|
+
await s.privacyMask?.setMask({ patch: {
|
|
137
162
|
enabled: S.enabled,
|
|
138
163
|
regions: [...S.regions]
|
|
139
164
|
} });
|
|
140
|
-
let e = await
|
|
165
|
+
let e = await s.privacyMask?.getStatus({});
|
|
141
166
|
if (e && e.regions !== null) {
|
|
142
167
|
let t = {
|
|
143
168
|
enabled: e.enabled,
|
|
@@ -151,17 +176,17 @@ function v({ deviceId: e }) {
|
|
|
151
176
|
D(!1);
|
|
152
177
|
}
|
|
153
178
|
}
|
|
154
|
-
}, [
|
|
179
|
+
}, [s, S]), Z = p({
|
|
155
180
|
supportsAudioMute: d === null ? null : d.supportsAudioMute,
|
|
156
181
|
audioEnabled: ge,
|
|
157
182
|
pendingOn: F
|
|
158
|
-
}), xe =
|
|
183
|
+
}), xe = t(async () => {
|
|
159
184
|
let e = m(Z);
|
|
160
|
-
if (!(!
|
|
185
|
+
if (!(!s || e === null)) {
|
|
161
186
|
I(e.enabled), R(null);
|
|
162
187
|
try {
|
|
163
|
-
await
|
|
164
|
-
let t = await
|
|
188
|
+
await s.privacyMask?.setAudioEnabled(e);
|
|
189
|
+
let t = await s.privacyMask?.getStatus({});
|
|
165
190
|
t && P(t.audioEnabled);
|
|
166
191
|
} catch (e) {
|
|
167
192
|
console.error("Privacy microphone write failed — reverting", e), R(e instanceof Error ? e.message : String(e));
|
|
@@ -169,13 +194,13 @@ function v({ deviceId: e }) {
|
|
|
169
194
|
I(null);
|
|
170
195
|
}
|
|
171
196
|
}
|
|
172
|
-
}, [
|
|
197
|
+
}, [s, Z]), Se = t(() => {
|
|
173
198
|
k((e) => (e && (N(null), j(null)), !e));
|
|
174
199
|
}, []), Q = d?.supportedShapes ?? [];
|
|
175
200
|
ie(i(() => O && !v && d && S ? {
|
|
176
201
|
id: pe,
|
|
177
202
|
order: fe,
|
|
178
|
-
node: /* @__PURE__ */ l(
|
|
203
|
+
node: /* @__PURE__ */ l(le, {
|
|
179
204
|
transparent: !0,
|
|
180
205
|
items: K,
|
|
181
206
|
supportedShapes: Q,
|
|
@@ -200,20 +225,20 @@ function v({ deviceId: e }) {
|
|
|
200
225
|
M
|
|
201
226
|
]));
|
|
202
227
|
let Ce = d?.supportedShapes.includes("rect") ?? !1, we = d?.supportedShapes.includes("polygon") ?? !1, $ = d !== null && (d.maxRegions <= 0 || d.supportedShapes.length === 0);
|
|
203
|
-
return
|
|
228
|
+
return s ? /* @__PURE__ */ l(re, {
|
|
204
229
|
title: "Privacy Mask",
|
|
205
|
-
icon: /* @__PURE__ */ l(
|
|
230
|
+
icon: /* @__PURE__ */ l(oe, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
|
|
206
231
|
children: /* @__PURE__ */ u("div", {
|
|
207
232
|
className: "flex flex-col gap-3",
|
|
208
233
|
children: [v || $ ? /* @__PURE__ */ l("p", {
|
|
209
|
-
className: `${
|
|
234
|
+
className: `${o} leading-relaxed`,
|
|
210
235
|
children: "This camera doesn't support an on-board privacy mask."
|
|
211
236
|
}) : b ? /* @__PURE__ */ l("p", {
|
|
212
|
-
className: `${
|
|
237
|
+
className: `${o} leading-relaxed`,
|
|
213
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."
|
|
214
|
-
}) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(
|
|
239
|
+
}) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(ce, { children: [
|
|
215
240
|
/* @__PURE__ */ u("p", {
|
|
216
|
-
className: `${
|
|
241
|
+
className: `${o} leading-relaxed`,
|
|
217
242
|
children: [
|
|
218
243
|
"Toggle ",
|
|
219
244
|
/* @__PURE__ */ l("strong", {
|
|
@@ -266,7 +291,7 @@ function v({ deviceId: e }) {
|
|
|
266
291
|
children: "+ Polygon"
|
|
267
292
|
}),
|
|
268
293
|
/* @__PURE__ */ u("span", {
|
|
269
|
-
className: `${
|
|
294
|
+
className: `${o} ml-1 tabular-nums`,
|
|
270
295
|
children: [
|
|
271
296
|
V,
|
|
272
297
|
" / ",
|
|
@@ -294,7 +319,7 @@ function v({ deviceId: e }) {
|
|
|
294
319
|
V > 0 ? /* @__PURE__ */ l("div", {
|
|
295
320
|
className: "flex flex-col gap-1",
|
|
296
321
|
children: S.regions.map((e) => {
|
|
297
|
-
let t = A === e.id, n = e.shape.kind === "polygon" ?
|
|
322
|
+
let t = A === e.id, n = e.shape.kind === "polygon" ? ue : se;
|
|
298
323
|
return /* @__PURE__ */ u("div", {
|
|
299
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"}`,
|
|
300
325
|
children: [/* @__PURE__ */ u("button", {
|
|
@@ -317,13 +342,13 @@ function v({ deviceId: e }) {
|
|
|
317
342
|
"aria-label": `Delete zone ${String(e.id)}`,
|
|
318
343
|
title: "Delete zone",
|
|
319
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",
|
|
320
|
-
children: /* @__PURE__ */ l(
|
|
345
|
+
children: /* @__PURE__ */ l(c, { className: "h-3.5 w-3.5" })
|
|
321
346
|
})]
|
|
322
347
|
}, e.id);
|
|
323
348
|
})
|
|
324
349
|
}) : null
|
|
325
350
|
] }) : /* @__PURE__ */ l("p", {
|
|
326
|
-
className: `${
|
|
351
|
+
className: `${o} leading-relaxed`,
|
|
327
352
|
children: "Loading the camera's privacy mask…"
|
|
328
353
|
}), Z.supported && /* @__PURE__ */ u("div", {
|
|
329
354
|
className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",
|
|
@@ -338,7 +363,7 @@ function v({ deviceId: e }) {
|
|
|
338
363
|
className: Z.on === !1 || Z.on === null ? h : g,
|
|
339
364
|
children: /* @__PURE__ */ u("span", {
|
|
340
365
|
className: "inline-flex items-center gap-1.5",
|
|
341
|
-
children: [Z.on === !1 ? /* @__PURE__ */ l(
|
|
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"]
|
|
342
367
|
})
|
|
343
368
|
}), /* @__PURE__ */ l("p", {
|
|
344
369
|
className: "text-[10px] text-foreground-subtle flex-1 leading-relaxed",
|