@camstack/addon-training 0.1.4 → 0.1.6
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-DPtcv80q.mjs +310 -0
- package/dist/{PrivacyMaskSettings-BwYjIkQR.mjs → PrivacyMaskSettings-Wsn5QL0_.mjs} +4 -4
- package/dist/{SceneMonitorEditor-BBfow3Lm.mjs → SceneMonitorEditor-BlMwyiH8.mjs} +313 -313
- package/dist/_stub.js +3472 -3413
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-D9H4Ok7x.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-Cbrdn9ib.mjs} +4 -4
- package/dist/addon-training.css +1 -1
- package/dist/{dist-BiSFqfpy.js → dist-BhCRZEE4.js} +12 -1
- package/dist/{dist-B_79m03G.mjs → dist-Cqa2fHNk.mjs} +12 -1
- package/dist/{hostInit-D4KiIt2E.mjs → hostInit-BI98RYIm.mjs} +3 -3
- package/dist/index.js +1 -1
- package/dist/orchestrator/training.addon.js +1 -1
- package/dist/orchestrator/training.addon.mjs +1 -1
- package/dist/{player-overlays-wE5IcDiI.mjs → player-overlays-BX3obOMu.mjs} +5 -5
- 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-D17kMsm1.mjs → responsive-CdDIJCpI.mjs} +2 -2
- package/dist/{scene-monitor-copy-LjlvhSRM.mjs → scene-monitor-copy-5u5w3K-Y.mjs} +1 -1
- package/dist/{square-JGDHhLlY.mjs → square-C-P1-89Q.mjs} +1 -1
- package/dist/{trash-2-zeFnLJvf.mjs → trash-2-BikGYiWf.mjs} +1 -1
- package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-DfiSKeZp.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_training_page__remoteEntry_js-DGLUs0o6.mjs} +1 -1
- package/package.json +1 -1
- package/dist/MotionZonesSettings-aj085Nrn.mjs +0 -310
|
@@ -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 { d as o, i as s, l as ee, o as c, s as l } from "./responsive-CdDIJCpI.mjs";
|
|
3
|
+
import { n as u, t as d } from "./player-overlays-BX3obOMu.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 = 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
|
+
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 o = l(ee().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 (!o) 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 o.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 o.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
|
+
c(t) ? A(!0) : console.error("Motion Zones load failed", t);
|
|
84
|
+
}
|
|
85
|
+
})(), () => {
|
|
86
|
+
e = !0;
|
|
87
|
+
};
|
|
88
|
+
}, [o]);
|
|
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 (!(!o || !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 o.motionZones?.setZone({ patch: { regions: [{
|
|
144
|
+
id: v,
|
|
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 = 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
|
+
o,
|
|
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
|
+
])), o ? /* @__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: `${s} 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: `${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
|
+
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: `${s} 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: `${s} 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: `${s} leading-relaxed`,
|
|
304
|
+
children: "Loading the camera's grid…"
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
}) : null;
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
export { O as MotionZonesSettings };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
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 {
|
|
3
|
-
import { n as re, t as ie } from "./player-overlays-
|
|
4
|
-
import { n as ae, r as oe, t as se } from "./square-
|
|
5
|
-
import { t as c } from "./trash-2-
|
|
2
|
+
import { d as o, i as s, l as ee, o as te, s as ne } from "./responsive-CdDIJCpI.mjs";
|
|
3
|
+
import { n as re, t as ie } from "./player-overlays-BX3obOMu.mjs";
|
|
4
|
+
import { n as ae, r as oe, t as se } from "./square-C-P1-89Q.mjs";
|
|
5
|
+
import { t as c } from "./trash-2-BikGYiWf.mjs";
|
|
6
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
7
|
import { MaskShapeCanvas as le } from "./MaskShapeCanvas-BokARvOj.mjs";
|
|
8
8
|
var ue = o("hexagon", [["path", {
|