@camstack/addon-osd-manager 0.1.123 → 0.1.125

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.
Files changed (20) hide show
  1. package/dist/MotionZonesSettings-a5Xl2ZE4.mjs +310 -0
  2. package/dist/{PrivacyMaskSettings-DVZjIN6W.mjs → PrivacyMaskSettings-B2UgOTdb.mjs} +26 -26
  3. package/dist/{SceneMonitorEditor-vd5ui8yS.mjs → SceneMonitorEditor-8tp57K86.mjs} +295 -295
  4. package/dist/_stub.js +245 -245
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BUn-8ukN.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-Co7z8wQJ.mjs} +3 -3
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BK-eslgm.mjs +26 -0
  7. package/dist/addon-osd-manager.css +1 -1
  8. package/dist/{responsive-BJ6OUcwu.mjs → cap-error-DC-GOnm5.mjs} +8 -8
  9. package/dist/{hostInit-B0QYXY-C.mjs → hostInit-p8Mnw5w9.mjs} +2 -2
  10. package/dist/index.js +401 -18
  11. package/dist/index.mjs +401 -18
  12. package/dist/{player-overlays-CnOtnn9E.mjs → player-overlays-C7IiQKvf.mjs} +1 -1
  13. package/dist/remoteEntry.js +1 -1
  14. package/dist/{scene-monitor-copy-CbOCxWBI.mjs → scene-monitor-copy-B5sXPAoG.mjs} +1 -1
  15. package/dist/{square-C85XpRsl.mjs → square-MsYzEBNo.mjs} +1 -1
  16. package/dist/{trash-2-RZb81dMj.mjs → trash-2-CahmDJ9h.mjs} +1 -1
  17. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-BYA-5ZRu.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-B0w_cAoJ.mjs} +1 -1
  18. package/package.json +1 -1
  19. package/dist/MotionZonesSettings-DN5iDMeX.mjs +0 -310
  20. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BzMsLBUL.mjs +0 -26
@@ -0,0 +1,310 @@
1
+ import { c as e, h as t, m as n, p as r, u as i, y as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-Bs1t18EM.mjs";
2
+ import { a as o, n as s, r as ee, s as c, t as l } from "./cap-error-DC-GOnm5.mjs";
3
+ import { n as te, t as u } from "./player-overlays-C7IiQKvf.mjs";
4
+ import { n as d, r as f, t as ne } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
5
+ import { MaskShapeCanvas as re } from "./MaskShapeCanvas-BEVxAjNq.mjs";
6
+ var p = c("grid-2x2", [
7
+ ["path", {
8
+ d: "M12 3v18",
9
+ key: "108xh3"
10
+ }],
11
+ ["path", {
12
+ d: "M3 12h18",
13
+ key: "1i2n21"
14
+ }],
15
+ ["rect", {
16
+ x: "3",
17
+ y: "3",
18
+ width: "18",
19
+ height: "18",
20
+ rx: "2",
21
+ key: "h1oib"
22
+ }]
23
+ ]);
24
+ //#endregion
25
+ //#region ../ui-library/src/composites/cap-settings/MotionZonesSettings.tsx
26
+ a();
27
+ var m = 110, h = "motion-zones", g = 0, _ = [
28
+ 1,
29
+ 2,
30
+ 3
31
+ ], v = 1, y = "rounded-md border border-border bg-surface px-2 py-1 text-[11px] font-medium text-foreground-subtle hover:bg-surface-hover disabled:opacity-40 transition-colors", b = "rounded-md border border-primary/50 bg-primary/15 px-2.5 py-1 text-[11px] font-medium text-primary hover:bg-primary/25 disabled:opacity-40 transition-colors";
32
+ function x(e, t, n) {
33
+ let r = t * n, i = Array.from({ length: r });
34
+ for (let t = 0; t < r; t += 1) i[t] = e[t] === !0;
35
+ return i;
36
+ }
37
+ function S(e, t) {
38
+ if (e.length !== t.length) return !1;
39
+ for (let n = 0; n < e.length; n += 1) if (e[n] !== t[n]) return !1;
40
+ return !0;
41
+ }
42
+ function C(e, t) {
43
+ return Math.ceil(e / t);
44
+ }
45
+ function w(e, t, n) {
46
+ return Math.min(n - 1, Math.floor((e + .5) / t * n));
47
+ }
48
+ function T(e, t, n, r) {
49
+ let i = C(t, r), a = C(n, r), o = Array.from({ length: i * a }, () => !1);
50
+ for (let r = 0; r < n; r += 1) {
51
+ let s = w(r, n, a);
52
+ for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + w(n, t, i)] = !0);
53
+ }
54
+ return o;
55
+ }
56
+ function E(e, t, n, r) {
57
+ let i = C(t, r), a = C(n, r), o = Array.from({ length: t * n }, () => !1);
58
+ for (let r = 0; r < n; r += 1) {
59
+ let s = w(r, n, a);
60
+ for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + w(n, t, i)] === !0;
61
+ }
62
+ return o;
63
+ }
64
+ function D({ deviceId: a }) {
65
+ let c = ee(o().trpcClient, a), [w, D] = t(null), [O, k] = t(!1), [A, j] = t(null), [M, N] = t(null), [P, F] = t(v), [I, L] = t(!1), [R, z] = t(!1), B = n(!1);
66
+ i(() => {
67
+ if (!c) return;
68
+ let e = !1;
69
+ return B.current = !1, D(null), k(!1), j(null), N(null), F(v), z(!1), (async () => {
70
+ try {
71
+ let t = await c.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 c.motionZones?.getStatus({});
76
+ if (e) return;
77
+ if (!n) throw Error("device proxy not ready");
78
+ B.current = !0;
79
+ let r = n.regions.find((e) => e.shape.kind === "grid"), i = x(r ? r.shape.cells : [], t.grid.width, t.grid.height);
80
+ N(i), j(T(i, t.grid.width, t.grid.height, v));
81
+ } catch (t) {
82
+ if (e) return;
83
+ l(t) ? k(!0) : console.error("Motion Zones load failed", t);
84
+ }
85
+ })(), () => {
86
+ e = !0;
87
+ };
88
+ }, [c]);
89
+ let V = w ? w.grid.width : 0, H = w ? w.grid.height : 0, U = C(V, P), W = C(H, P), G = r(() => A && w ? E(A, V, H, P) : null, [
90
+ A,
91
+ w,
92
+ V,
93
+ H,
94
+ P
95
+ ]), K = r(() => G !== null && M !== null && !S(G, M), [G, M]), q = r(() => G ? G.reduce((e, t) => t ? e + 1 : e, 0) : 0, [G]), J = V * H, Y = U * W, X = e((e) => {
96
+ Y > 0 && j(Array.from({ length: Y }, () => e));
97
+ }, [Y]), ie = e(() => {
98
+ j((e) => e && e.map((e) => !e));
99
+ }, []), Z = e(() => {
100
+ M && w && j(T(M, V, H, P));
101
+ }, [
102
+ M,
103
+ w,
104
+ V,
105
+ H,
106
+ P
107
+ ]), ae = e((e) => {
108
+ e === P || !w || j((t) => {
109
+ if (!t) return F(e), t;
110
+ let n = T(E(t, V, H, P), V, H, e);
111
+ return F(e), n;
112
+ });
113
+ }, [
114
+ P,
115
+ w,
116
+ V,
117
+ H
118
+ ]), Q = r(() => w && A ? [{
119
+ id: g,
120
+ shape: {
121
+ kind: "grid",
122
+ gridWidth: U,
123
+ gridHeight: W,
124
+ cells: [...A]
125
+ }
126
+ }] : [], [
127
+ w,
128
+ A,
129
+ U,
130
+ W
131
+ ]), $ = e((e, t) => {
132
+ t.kind === "grid" && j(t.cells);
133
+ }, []), oe = e(async () => {
134
+ if (!(!c || !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 c.motionZones?.setZone({ patch: { regions: [{
144
+ id: g,
145
+ enabled: !0,
146
+ shape: t
147
+ }] } });
148
+ let n = await c.motionZones?.getStatus({});
149
+ if (n) {
150
+ let e = n.regions.find((e) => e.shape.kind === "grid"), t = x(e ? e.shape.cells : [], w.grid.width, w.grid.height);
151
+ N(t), j(T(t, w.grid.width, w.grid.height, P));
152
+ }
153
+ } catch (e) {
154
+ console.error("Motion Zones save failed", e);
155
+ } finally {
156
+ L(!1);
157
+ }
158
+ }
159
+ }, [
160
+ c,
161
+ A,
162
+ w,
163
+ P
164
+ ]);
165
+ return u(r(() => R && !O && w && A ? {
166
+ id: h,
167
+ order: m,
168
+ node: /* @__PURE__ */ d(re, {
169
+ transparent: !0,
170
+ items: Q,
171
+ supportedShapes: ["grid"],
172
+ grid: {
173
+ width: U,
174
+ height: W
175
+ },
176
+ selectedId: g,
177
+ onSelect: () => {},
178
+ onShapeChange: $,
179
+ onDrawComplete: () => {},
180
+ drawingKind: null
181
+ })
182
+ } : null, [
183
+ R,
184
+ O,
185
+ w,
186
+ A,
187
+ Q,
188
+ $,
189
+ U,
190
+ W
191
+ ])), c ? /* @__PURE__ */ d(te, {
192
+ title: "Motion Zones",
193
+ icon: /* @__PURE__ */ d(p, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
194
+ children: /* @__PURE__ */ d("div", {
195
+ className: "flex flex-col gap-3",
196
+ children: O ? /* @__PURE__ */ d("p", {
197
+ className: `${s} leading-relaxed`,
198
+ children: "This camera doesn't expose an on-board motion zones grid."
199
+ }) : !O && w !== null && A !== null ? /* @__PURE__ */ f(ne, { children: [/* @__PURE__ */ f("p", {
200
+ className: `${s} leading-relaxed`,
201
+ children: [
202
+ "Toggle ",
203
+ /* @__PURE__ */ d("strong", {
204
+ className: "text-foreground",
205
+ children: "Edit grid"
206
+ }),
207
+ " to paint the region directly on the live frame, then ",
208
+ /* @__PURE__ */ d("strong", {
209
+ className: "text-foreground",
210
+ children: "Save"
211
+ }),
212
+ " to push the mask to the camera. Pick a bigger",
213
+ " ",
214
+ /* @__PURE__ */ d("strong", {
215
+ className: "text-foreground",
216
+ children: "Cell size"
217
+ }),
218
+ " for quicker, broad-stroke painting — it's resampled to the camera's native ",
219
+ w.grid.width,
220
+ "×",
221
+ w.grid.height,
222
+ " grid on save (×1 is the finest)."
223
+ ]
224
+ }), /* @__PURE__ */ f("div", {
225
+ className: "flex items-center gap-2 flex-wrap",
226
+ children: [
227
+ /* @__PURE__ */ d("button", {
228
+ type: "button",
229
+ onClick: () => z((e) => !e),
230
+ disabled: I,
231
+ "aria-pressed": R,
232
+ className: R ? b : y,
233
+ children: R ? "Done editing" : "Edit grid"
234
+ }),
235
+ /* @__PURE__ */ d("button", {
236
+ type: "button",
237
+ onClick: () => X(!0),
238
+ disabled: I,
239
+ className: y,
240
+ children: "All on"
241
+ }),
242
+ /* @__PURE__ */ d("button", {
243
+ type: "button",
244
+ onClick: () => X(!1),
245
+ disabled: I,
246
+ className: y,
247
+ children: "All off"
248
+ }),
249
+ /* @__PURE__ */ d("button", {
250
+ type: "button",
251
+ onClick: ie,
252
+ disabled: I,
253
+ className: y,
254
+ children: "Invert"
255
+ }),
256
+ /* @__PURE__ */ f("div", {
257
+ className: "flex items-center gap-1 ml-1",
258
+ role: "group",
259
+ "aria-label": "Cell size",
260
+ children: [/* @__PURE__ */ d("span", {
261
+ className: `${s} mr-0.5`,
262
+ children: "Cell size"
263
+ }), _.map((e) => /* @__PURE__ */ f("button", {
264
+ type: "button",
265
+ onClick: () => ae(e),
266
+ disabled: I,
267
+ "aria-pressed": P === e,
268
+ title: e === 1 ? `Camera grid ${V}×${H} (finest)` : `${C(V, e)}×${C(H, e)} painting grid · cells ×${e} bigger`,
269
+ className: P === e ? b : y,
270
+ children: ["×", e]
271
+ }, e))]
272
+ }),
273
+ /* @__PURE__ */ f("span", {
274
+ className: `${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__ */ d("span", { className: "flex-1" }),
287
+ /* @__PURE__ */ d("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__ */ d("button", {
295
+ type: "button",
296
+ onClick: () => void oe(),
297
+ disabled: I || !K,
298
+ className: b,
299
+ children: I ? "Saving…" : "Save"
300
+ })
301
+ ]
302
+ })] }) : /* @__PURE__ */ d("p", {
303
+ className: `${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,14 @@
1
1
  import { c as e, h as t, m as n, p as r, u as i, y as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-Bs1t18EM.mjs";
2
- import { a as ee, n as te, r as ne, s as o, t as s } from "./responsive-BJ6OUcwu.mjs";
3
- import { n as re, t as ie } from "./player-overlays-CnOtnn9E.mjs";
4
- import { n as ae, r as oe, t as se } from "./square-C85XpRsl.mjs";
5
- import { t as c } from "./trash-2-RZb81dMj.mjs";
2
+ import { a as ee, n as o, r as te, s, t as ne } from "./cap-error-DC-GOnm5.mjs";
3
+ import { n as re, t as ie } from "./player-overlays-C7IiQKvf.mjs";
4
+ import { n as ae, r as oe, t as se } from "./square-MsYzEBNo.mjs";
5
+ import { t as c } from "./trash-2-CahmDJ9h.mjs";
6
6
  import { n as l, r as u, t as ce } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DalfdIDw.mjs";
7
7
  import { MaskShapeCanvas as le } from "./MaskShapeCanvas-BEVxAjNq.mjs";
8
- var ue = o("hexagon", [["path", {
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
- }]]), de = o("mic-off", [
11
+ }]]), de = s("mic-off", [
12
12
  ["path", {
13
13
  d: "M12 19v3",
14
14
  key: "npa21l"
@@ -68,17 +68,17 @@ function he(e, t) {
68
68
  return !0;
69
69
  }
70
70
  function v({ deviceId: a }) {
71
- let o = ne(ee().trpcClient, a), [d, f] = 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 = n(!1);
71
+ let s = te(ee().trpcClient, a), [d, f] = 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 = n(!1);
72
72
  i(() => {
73
- if (!o) return;
73
+ if (!s) return;
74
74
  let e = !1;
75
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
76
  try {
77
- let t = await o.privacyMask?.getOptions({});
77
+ let t = await s.privacyMask?.getOptions({});
78
78
  if (e) return;
79
79
  if (!t) throw Error("device proxy not ready");
80
80
  if (f(t), z.current) return;
81
- let n = await o.privacyMask?.getStatus({});
81
+ let n = await s.privacyMask?.getStatus({});
82
82
  if (e) return;
83
83
  if (!n) throw Error("device proxy not ready");
84
84
  if (n.regions === null) {
@@ -93,12 +93,12 @@ function v({ deviceId: a }) {
93
93
  T(r), C(r), P(n.audioEnabled);
94
94
  } catch (t) {
95
95
  if (e) return;
96
- te(t) ? y(!0) : console.error("Privacy Mask load failed", t);
96
+ ne(t) ? y(!0) : console.error("Privacy Mask load failed", t);
97
97
  }
98
98
  })(), () => {
99
99
  e = !0;
100
100
  };
101
- }, [o]);
101
+ }, [s]);
102
102
  let B = r(() => 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 = n(0);
103
103
  i(() => {
104
104
  U.current = H;
@@ -155,14 +155,14 @@ function v({ deviceId: a }) {
155
155
  regions: w.regions
156
156
  });
157
157
  }, [w]), be = e(async () => {
158
- if (!(!o || !S)) {
158
+ if (!(!s || !S)) {
159
159
  D(!0);
160
160
  try {
161
- await o.privacyMask?.setMask({ patch: {
161
+ await s.privacyMask?.setMask({ patch: {
162
162
  enabled: S.enabled,
163
163
  regions: [...S.regions]
164
164
  } });
165
- let e = await o.privacyMask?.getStatus({});
165
+ let e = await s.privacyMask?.getStatus({});
166
166
  if (e && e.regions !== null) {
167
167
  let t = {
168
168
  enabled: e.enabled,
@@ -176,17 +176,17 @@ function v({ deviceId: a }) {
176
176
  D(!1);
177
177
  }
178
178
  }
179
- }, [o, S]), Z = p({
179
+ }, [s, S]), Z = p({
180
180
  supportsAudioMute: d === null ? null : d.supportsAudioMute,
181
181
  audioEnabled: ge,
182
182
  pendingOn: F
183
183
  }), xe = e(async () => {
184
184
  let e = m(Z);
185
- if (!(!o || e === null)) {
185
+ if (!(!s || e === null)) {
186
186
  I(e.enabled), R(null);
187
187
  try {
188
- await o.privacyMask?.setAudioEnabled(e);
189
- let t = await o.privacyMask?.getStatus({});
188
+ await s.privacyMask?.setAudioEnabled(e);
189
+ let t = await s.privacyMask?.getStatus({});
190
190
  t && P(t.audioEnabled);
191
191
  } catch (e) {
192
192
  console.error("Privacy microphone write failed — reverting", e), R(e instanceof Error ? e.message : String(e));
@@ -194,7 +194,7 @@ function v({ deviceId: a }) {
194
194
  I(null);
195
195
  }
196
196
  }
197
- }, [o, Z]), Se = e(() => {
197
+ }, [s, Z]), Se = e(() => {
198
198
  k((e) => (e && (N(null), j(null)), !e));
199
199
  }, []), Q = d?.supportedShapes ?? [];
200
200
  ie(r(() => O && !v && d && S ? {
@@ -225,20 +225,20 @@ function v({ deviceId: a }) {
225
225
  M
226
226
  ]));
227
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 o ? /* @__PURE__ */ l(re, {
228
+ return s ? /* @__PURE__ */ l(re, {
229
229
  title: "Privacy Mask",
230
230
  icon: /* @__PURE__ */ l(oe, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
231
231
  children: /* @__PURE__ */ u("div", {
232
232
  className: "flex flex-col gap-3",
233
233
  children: [v || $ ? /* @__PURE__ */ l("p", {
234
- className: `${s} leading-relaxed`,
234
+ className: `${o} leading-relaxed`,
235
235
  children: "This camera doesn't support an on-board privacy mask."
236
236
  }) : b ? /* @__PURE__ */ l("p", {
237
- className: `${s} leading-relaxed`,
237
+ className: `${o} leading-relaxed`,
238
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
239
  }) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(ce, { children: [
240
240
  /* @__PURE__ */ u("p", {
241
- className: `${s} leading-relaxed`,
241
+ className: `${o} leading-relaxed`,
242
242
  children: [
243
243
  "Toggle ",
244
244
  /* @__PURE__ */ l("strong", {
@@ -291,7 +291,7 @@ function v({ deviceId: a }) {
291
291
  children: "+ Polygon"
292
292
  }),
293
293
  /* @__PURE__ */ u("span", {
294
- className: `${s} ml-1 tabular-nums`,
294
+ className: `${o} ml-1 tabular-nums`,
295
295
  children: [
296
296
  V,
297
297
  " / ",
@@ -348,7 +348,7 @@ function v({ deviceId: a }) {
348
348
  })
349
349
  }) : null
350
350
  ] }) : /* @__PURE__ */ l("p", {
351
- className: `${s} leading-relaxed`,
351
+ className: `${o} leading-relaxed`,
352
352
  children: "Loading the camera's privacy mask…"
353
353
  }), Z.supported && /* @__PURE__ */ u("div", {
354
354
  className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",