@camstack/addon-osd-manager 0.1.198 → 0.1.200

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-DAz0zsa2.mjs +310 -0
  2. package/dist/{PrivacyMaskSettings-xC6YrNM-.mjs → PrivacyMaskSettings-DBRcmqYu.mjs} +25 -25
  3. package/dist/{SceneMonitorEditor-DKN2cL7k.mjs → SceneMonitorEditor-p1bF1btk.mjs} +299 -299
  4. package/dist/_stub.js +3872 -3832
  5. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-BPCqUX6E.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_osd_manager_page-Dgy-eWCs.mjs} +3 -3
  6. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DVaKG6N9.mjs +26 -0
  7. package/dist/addon-osd-manager.css +1 -1
  8. package/dist/{hostInit-DGG5vSkv.mjs → hostInit-Pkln2STJ.mjs} +2 -2
  9. package/dist/index.js +302 -158
  10. package/dist/index.mjs +302 -158
  11. package/dist/{player-overlays-TxRsHixk.mjs → player-overlays-2hRBqn9k.mjs} +5 -5
  12. package/dist/remoteEntry.js +1 -1
  13. package/dist/{responsive-t3UayeQT.mjs → responsive-BCF-RTGy.mjs} +3 -3
  14. package/dist/{scene-monitor-copy-gMmaT-FC.mjs → scene-monitor-copy-M5yqaBpP.mjs} +1 -1
  15. package/dist/{square-B_CvlH_T.mjs → square-CLL05HzW.mjs} +1 -1
  16. package/dist/{trash-2-BfeGf6tH.mjs → trash-2-BECtJsvm.mjs} +1 -1
  17. package/dist/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-BXV7lhl_.mjs → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__addon_osd_manager_page__remoteEntry_js-BFUWkh_2.mjs} +1 -1
  18. package/package.json +1 -1
  19. package/dist/MotionZonesSettings-DUltQQw1.mjs +0 -310
  20. package/dist/_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CGoq0DWk.mjs +0 -26
@@ -0,0 +1,310 @@
1
+ import { _ as e, c as t, g as n, h as r, u as i, x as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-D7xZfSHZ.mjs";
2
+ import { a as o, c as s, i as c, r as l, u } from "./responsive-BCF-RTGy.mjs";
3
+ import { n as d, t as f } from "./player-overlays-2hRBqn9k.mjs";
4
+ import { n as p, r as m, t as ee } 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 h } from "./MaskShapeCanvas-mrxtKs_l.mjs";
6
+ var g = u("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 _ = 110, v = "motion-zones", y = 0, b = [
28
+ 1,
29
+ 2,
30
+ 3
31
+ ], x = 1, S = "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", C = "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 w(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 T(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 E(e, t) {
43
+ return Math.ceil(e / t);
44
+ }
45
+ function D(e, t, n) {
46
+ return Math.min(n - 1, Math.floor((e + .5) / t * n));
47
+ }
48
+ function O(e, t, n, r) {
49
+ let i = E(t, r), a = E(n, r), o = Array.from({ length: i * a }, () => !1);
50
+ for (let r = 0; r < n; r += 1) {
51
+ let s = D(r, n, a);
52
+ for (let n = 0; n < t; n += 1) e[r * t + n] === !0 && (o[s * i + D(n, t, i)] = !0);
53
+ }
54
+ return o;
55
+ }
56
+ function k(e, t, n, r) {
57
+ let i = E(t, r), a = E(n, r), o = Array.from({ length: t * n }, () => !1);
58
+ for (let r = 0; r < n; r += 1) {
59
+ let s = D(r, n, a);
60
+ for (let n = 0; n < t; n += 1) o[r * t + n] = e[s * i + D(n, t, i)] === !0;
61
+ }
62
+ return o;
63
+ }
64
+ function A({ deviceId: a }) {
65
+ let u = o(s().trpcClient, a), [D, A] = e(null), [j, M] = e(!1), [N, P] = e(null), [F, I] = e(null), [L, R] = e(x), [z, B] = e(!1), [V, H] = e(!1), U = n(!1);
66
+ i(() => {
67
+ if (!u) return;
68
+ let e = !1;
69
+ return U.current = !1, A(null), M(!1), P(null), I(null), R(x), H(!1), (async () => {
70
+ try {
71
+ let t = await u.motionZones?.getOptions({});
72
+ if (e) return;
73
+ if (!t) throw Error("device proxy not ready");
74
+ if (A(t), U.current) return;
75
+ let n = await u.motionZones?.getStatus({});
76
+ if (e) return;
77
+ if (!n) throw Error("device proxy not ready");
78
+ U.current = !0;
79
+ let r = n.regions.find((e) => e.shape.kind === "grid"), i = w(r ? r.shape.cells : [], t.grid.width, t.grid.height);
80
+ I(i), P(O(i, t.grid.width, t.grid.height, x));
81
+ } catch (t) {
82
+ if (e) return;
83
+ c(t) ? M(!0) : console.error("Motion Zones load failed", t);
84
+ }
85
+ })(), () => {
86
+ e = !0;
87
+ };
88
+ }, [u]);
89
+ let W = D ? D.grid.width : 0, G = D ? D.grid.height : 0, K = E(W, L), q = E(G, L), J = r(() => N && D ? k(N, W, G, L) : null, [
90
+ N,
91
+ D,
92
+ W,
93
+ G,
94
+ L
95
+ ]), Y = r(() => J !== null && F !== null && !T(J, F), [J, F]), te = r(() => J ? J.reduce((e, t) => t ? e + 1 : e, 0) : 0, [J]), ne = W * G, X = K * q, Z = t((e) => {
96
+ X > 0 && P(Array.from({ length: X }, () => e));
97
+ }, [X]), re = t(() => {
98
+ P((e) => e && e.map((e) => !e));
99
+ }, []), ie = t(() => {
100
+ F && D && P(O(F, W, G, L));
101
+ }, [
102
+ F,
103
+ D,
104
+ W,
105
+ G,
106
+ L
107
+ ]), ae = t((e) => {
108
+ e === L || !D || P((t) => {
109
+ if (!t) return R(e), t;
110
+ let n = O(k(t, W, G, L), W, G, e);
111
+ return R(e), n;
112
+ });
113
+ }, [
114
+ L,
115
+ D,
116
+ W,
117
+ G
118
+ ]), Q = r(() => D && N ? [{
119
+ id: y,
120
+ shape: {
121
+ kind: "grid",
122
+ gridWidth: K,
123
+ gridHeight: q,
124
+ cells: [...N]
125
+ }
126
+ }] : [], [
127
+ D,
128
+ N,
129
+ K,
130
+ q
131
+ ]), $ = t((e, t) => {
132
+ t.kind === "grid" && P(t.cells);
133
+ }, []), oe = t(async () => {
134
+ if (!(!u || !N || !D)) {
135
+ B(!0);
136
+ try {
137
+ let e = k(N, D.grid.width, D.grid.height, L), t = {
138
+ kind: "grid",
139
+ gridWidth: D.grid.width,
140
+ gridHeight: D.grid.height,
141
+ cells: e
142
+ };
143
+ await u.motionZones?.setZone({ patch: { regions: [{
144
+ id: y,
145
+ enabled: !0,
146
+ shape: t
147
+ }] } });
148
+ let n = await u.motionZones?.getStatus({});
149
+ if (n) {
150
+ let e = n.regions.find((e) => e.shape.kind === "grid"), t = w(e ? e.shape.cells : [], D.grid.width, D.grid.height);
151
+ I(t), P(O(t, D.grid.width, D.grid.height, L));
152
+ }
153
+ } catch (e) {
154
+ console.error("Motion Zones save failed", e);
155
+ } finally {
156
+ B(!1);
157
+ }
158
+ }
159
+ }, [
160
+ u,
161
+ N,
162
+ D,
163
+ L
164
+ ]);
165
+ return f(r(() => V && !j && D && N ? {
166
+ id: v,
167
+ order: _,
168
+ node: /* @__PURE__ */ p(h, {
169
+ transparent: !0,
170
+ items: Q,
171
+ supportedShapes: ["grid"],
172
+ grid: {
173
+ width: K,
174
+ height: q
175
+ },
176
+ selectedId: y,
177
+ onSelect: () => {},
178
+ onShapeChange: $,
179
+ onDrawComplete: () => {},
180
+ drawingKind: null
181
+ })
182
+ } : null, [
183
+ V,
184
+ j,
185
+ D,
186
+ N,
187
+ Q,
188
+ $,
189
+ K,
190
+ q
191
+ ])), u ? /* @__PURE__ */ p(d, {
192
+ title: "Motion Zones",
193
+ icon: /* @__PURE__ */ p(g, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
194
+ children: /* @__PURE__ */ p("div", {
195
+ className: "flex flex-col gap-3",
196
+ children: j ? /* @__PURE__ */ p("p", {
197
+ className: `${l} leading-relaxed`,
198
+ children: "This camera doesn't expose an on-board motion zones grid."
199
+ }) : !j && D !== null && N !== null ? /* @__PURE__ */ m(ee, { children: [/* @__PURE__ */ m("p", {
200
+ className: `${l} leading-relaxed`,
201
+ children: [
202
+ "Toggle ",
203
+ /* @__PURE__ */ p("strong", {
204
+ className: "text-foreground",
205
+ children: "Edit grid"
206
+ }),
207
+ " to paint the region directly on the live frame, then ",
208
+ /* @__PURE__ */ p("strong", {
209
+ className: "text-foreground",
210
+ children: "Save"
211
+ }),
212
+ " to push the mask to the camera. Pick a bigger",
213
+ " ",
214
+ /* @__PURE__ */ p("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
+ D.grid.width,
220
+ "×",
221
+ D.grid.height,
222
+ " grid on save (×1 is the finest)."
223
+ ]
224
+ }), /* @__PURE__ */ m("div", {
225
+ className: "flex items-center gap-2 flex-wrap",
226
+ children: [
227
+ /* @__PURE__ */ p("button", {
228
+ type: "button",
229
+ onClick: () => H((e) => !e),
230
+ disabled: z,
231
+ "aria-pressed": V,
232
+ className: V ? C : S,
233
+ children: V ? "Done editing" : "Edit grid"
234
+ }),
235
+ /* @__PURE__ */ p("button", {
236
+ type: "button",
237
+ onClick: () => Z(!0),
238
+ disabled: z,
239
+ className: S,
240
+ children: "All on"
241
+ }),
242
+ /* @__PURE__ */ p("button", {
243
+ type: "button",
244
+ onClick: () => Z(!1),
245
+ disabled: z,
246
+ className: S,
247
+ children: "All off"
248
+ }),
249
+ /* @__PURE__ */ p("button", {
250
+ type: "button",
251
+ onClick: re,
252
+ disabled: z,
253
+ className: S,
254
+ children: "Invert"
255
+ }),
256
+ /* @__PURE__ */ m("div", {
257
+ className: "flex items-center gap-1 ml-1",
258
+ role: "group",
259
+ "aria-label": "Cell size",
260
+ children: [/* @__PURE__ */ p("span", {
261
+ className: `${l} mr-0.5`,
262
+ children: "Cell size"
263
+ }), b.map((e) => /* @__PURE__ */ m("button", {
264
+ type: "button",
265
+ onClick: () => ae(e),
266
+ disabled: z,
267
+ "aria-pressed": L === e,
268
+ title: e === 1 ? `Camera grid ${W}×${G} (finest)` : `${E(W, e)}×${E(G, e)} painting grid · cells ×${e} bigger`,
269
+ className: L === e ? C : S,
270
+ children: ["×", e]
271
+ }, e))]
272
+ }),
273
+ /* @__PURE__ */ m("span", {
274
+ className: `${l} ml-1 tabular-nums`,
275
+ children: [
276
+ te,
277
+ " / ",
278
+ ne,
279
+ " cells · ",
280
+ D.grid.width,
281
+ "×",
282
+ D.grid.height,
283
+ L === 1 ? "" : ` · paint ${K}×${q}`
284
+ ]
285
+ }),
286
+ /* @__PURE__ */ p("span", { className: "flex-1" }),
287
+ /* @__PURE__ */ p("button", {
288
+ type: "button",
289
+ onClick: ie,
290
+ disabled: z || !Y,
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__ */ p("button", {
295
+ type: "button",
296
+ onClick: () => void oe(),
297
+ disabled: z || !Y,
298
+ className: C,
299
+ children: z ? "Saving…" : "Save"
300
+ })
301
+ ]
302
+ })] }) : /* @__PURE__ */ p("p", {
303
+ className: `${l} leading-relaxed`,
304
+ children: "Loading the camera's grid…"
305
+ })
306
+ })
307
+ }) : null;
308
+ }
309
+ //#endregion
310
+ export { A as MotionZonesSettings };
@@ -1,11 +1,11 @@
1
1
  import { _ as e, c as t, g as n, h as r, u as i, x as a } from "./_virtual_mf___mfe_internal__addon_osd_manager_page__loadShare__react__loadShare__.js-D7xZfSHZ.mjs";
2
- import { c as o, n as ee, o as te, r as ne, t as s } from "./responsive-t3UayeQT.mjs";
3
- import { n as re, t as ie } from "./player-overlays-TxRsHixk.mjs";
4
- import { i as ae, n as oe, r as se, t as c } from "./square-B_CvlH_T.mjs";
5
- import { t as ce } from "./trash-2-BfeGf6tH.mjs";
2
+ import { a as ee, c as te, i as ne, r as o, u as s } from "./responsive-BCF-RTGy.mjs";
3
+ import { n as re, t as ie } from "./player-overlays-2hRBqn9k.mjs";
4
+ import { i as ae, n as oe, r as se, t as c } from "./square-CLL05HzW.mjs";
5
+ import { t as ce } from "./trash-2-BECtJsvm.mjs";
6
6
  import { n as l, r as u, t as le } 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 ue } from "./MaskShapeCanvas-mrxtKs_l.mjs";
8
- var de = o("hexagon", [["path", {
8
+ var de = 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
  }]]);
@@ -43,17 +43,17 @@ function he(e, t) {
43
43
  return !0;
44
44
  }
45
45
  function v({ deviceId: a }) {
46
- let o = ne(te().trpcClient, a), [d, f] = e(null), [v, y] = e(!1), [b, x] = e(!1), [S, C] = e(null), [w, T] = e(null), [E, D] = e(!1), [O, k] = e(!1), [A, j] = e(null), [M, N] = e(null), [ge, P] = e(null), [F, I] = e(null), [L, R] = e(null), z = n(!1);
46
+ let s = ee(te().trpcClient, a), [d, f] = e(null), [v, y] = e(!1), [b, x] = e(!1), [S, C] = e(null), [w, T] = e(null), [E, D] = e(!1), [O, k] = e(!1), [A, j] = e(null), [M, N] = e(null), [ge, P] = e(null), [F, I] = e(null), [L, R] = e(null), z = n(!1);
47
47
  i(() => {
48
- if (!o) return;
48
+ if (!s) return;
49
49
  let e = !1;
50
50
  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
51
  try {
52
- let t = await o.privacyMask?.getOptions({});
52
+ let t = await s.privacyMask?.getOptions({});
53
53
  if (e) return;
54
54
  if (!t) throw Error("device proxy not ready");
55
55
  if (f(t), z.current) return;
56
- let n = await o.privacyMask?.getStatus({});
56
+ let n = await s.privacyMask?.getStatus({});
57
57
  if (e) return;
58
58
  if (!n) throw Error("device proxy not ready");
59
59
  if (n.regions === null) {
@@ -68,12 +68,12 @@ function v({ deviceId: a }) {
68
68
  T(r), C(r), P(n.audioEnabled);
69
69
  } catch (t) {
70
70
  if (e) return;
71
- ee(t) ? y(!0) : console.error("Privacy Mask load failed", t);
71
+ ne(t) ? y(!0) : console.error("Privacy Mask load failed", t);
72
72
  }
73
73
  })(), () => {
74
74
  e = !0;
75
75
  };
76
- }, [o]);
76
+ }, [s]);
77
77
  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);
78
78
  i(() => {
79
79
  U.current = H;
@@ -130,14 +130,14 @@ function v({ deviceId: a }) {
130
130
  regions: w.regions
131
131
  });
132
132
  }, [w]), be = t(async () => {
133
- if (!(!o || !S)) {
133
+ if (!(!s || !S)) {
134
134
  D(!0);
135
135
  try {
136
- await o.privacyMask?.setMask({ patch: {
136
+ await s.privacyMask?.setMask({ patch: {
137
137
  enabled: S.enabled,
138
138
  regions: [...S.regions]
139
139
  } });
140
- let e = await o.privacyMask?.getStatus({});
140
+ let e = await s.privacyMask?.getStatus({});
141
141
  if (e && e.regions !== null) {
142
142
  let t = {
143
143
  enabled: e.enabled,
@@ -151,17 +151,17 @@ function v({ deviceId: a }) {
151
151
  D(!1);
152
152
  }
153
153
  }
154
- }, [o, S]), Z = p({
154
+ }, [s, S]), Z = p({
155
155
  supportsAudioMute: d === null ? null : d.supportsAudioMute,
156
156
  audioEnabled: ge,
157
157
  pendingOn: F
158
158
  }), xe = t(async () => {
159
159
  let e = m(Z);
160
- if (!(!o || e === null)) {
160
+ if (!(!s || e === null)) {
161
161
  I(e.enabled), R(null);
162
162
  try {
163
- await o.privacyMask?.setAudioEnabled(e);
164
- let t = await o.privacyMask?.getStatus({});
163
+ await s.privacyMask?.setAudioEnabled(e);
164
+ let t = await s.privacyMask?.getStatus({});
165
165
  t && P(t.audioEnabled);
166
166
  } catch (e) {
167
167
  console.error("Privacy microphone write failed — reverting", e), R(e instanceof Error ? e.message : String(e));
@@ -169,7 +169,7 @@ function v({ deviceId: a }) {
169
169
  I(null);
170
170
  }
171
171
  }
172
- }, [o, Z]), Se = t(() => {
172
+ }, [s, Z]), Se = t(() => {
173
173
  k((e) => (e && (N(null), j(null)), !e));
174
174
  }, []), Q = d?.supportedShapes ?? [];
175
175
  ie(r(() => O && !v && d && S ? {
@@ -200,20 +200,20 @@ function v({ deviceId: a }) {
200
200
  M
201
201
  ]));
202
202
  let Ce = d?.supportedShapes.includes("rect") ?? !1, we = d?.supportedShapes.includes("polygon") ?? !1, $ = d !== null && (d.maxRegions <= 0 || d.supportedShapes.length === 0);
203
- return o ? /* @__PURE__ */ l(re, {
203
+ return s ? /* @__PURE__ */ l(re, {
204
204
  title: "Privacy Mask",
205
205
  icon: /* @__PURE__ */ l(ae, { className: "h-3.5 w-3.5 text-foreground-subtle" }),
206
206
  children: /* @__PURE__ */ u("div", {
207
207
  className: "flex flex-col gap-3",
208
208
  children: [v || $ ? /* @__PURE__ */ l("p", {
209
- className: `${s} leading-relaxed`,
209
+ className: `${o} leading-relaxed`,
210
210
  children: "This camera doesn't support an on-board privacy mask."
211
211
  }) : b ? /* @__PURE__ */ l("p", {
212
- className: `${s} leading-relaxed`,
212
+ className: `${o} leading-relaxed`,
213
213
  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
214
  }) : !v && !$ && !b && d !== null && S !== null ? /* @__PURE__ */ u(le, { children: [
215
215
  /* @__PURE__ */ u("p", {
216
- className: `${s} leading-relaxed`,
216
+ className: `${o} leading-relaxed`,
217
217
  children: [
218
218
  "Toggle ",
219
219
  /* @__PURE__ */ l("strong", {
@@ -266,7 +266,7 @@ function v({ deviceId: a }) {
266
266
  children: "+ Polygon"
267
267
  }),
268
268
  /* @__PURE__ */ u("span", {
269
- className: `${s} ml-1 tabular-nums`,
269
+ className: `${o} ml-1 tabular-nums`,
270
270
  children: [
271
271
  V,
272
272
  " / ",
@@ -323,7 +323,7 @@ function v({ deviceId: a }) {
323
323
  })
324
324
  }) : null
325
325
  ] }) : /* @__PURE__ */ l("p", {
326
- className: `${s} leading-relaxed`,
326
+ className: `${o} leading-relaxed`,
327
327
  children: "Loading the camera's privacy mask…"
328
328
  }), Z.supported && /* @__PURE__ */ u("div", {
329
329
  className: "flex items-start gap-3 rounded-md border border-border bg-surface px-2 py-2",