@camstack/addon-training 0.1.47 → 0.1.49

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 (40) hide show
  1. package/dist/{MaskShapeCanvas-Kfg9dl6B.mjs → MaskShapeCanvas-HNL0xNpy.mjs} +229 -228
  2. package/dist/MotionZonesSettings-B1g6IUfQ.mjs +291 -0
  3. package/dist/PrivacyMaskSettings-D4WRZZeD.mjs +339 -0
  4. package/dist/{ReactKonva-DGuYUN0L.mjs → ReactKonva-DzGysLZQ.mjs} +28 -28
  5. package/dist/SceneMonitorEditor-pYZfyXtn.mjs +825 -0
  6. package/dist/_stub.js +11562 -10221
  7. package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-cOIklMU6.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-OY71DavC.mjs} +4 -4
  8. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-BVsoOuTM.mjs +26 -0
  9. 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
  10. package/dist/addon-training.css +1 -1
  11. package/dist/{chevron-right-D3StkdcR.mjs → chevron-right-cA8Hucbi.mjs} +1 -1
  12. package/dist/{createLucideIcon-CPP1Jzoz.mjs → createLucideIcon-C0bBNRpC.mjs} +8 -8
  13. package/dist/{dist-CCnnaqt1.mjs → dist-D-7oMcBM.mjs} +198 -9
  14. package/dist/{dist-BUzSmOA3.js → dist-DvgVhVUN.js} +198 -9
  15. package/dist/{grid-2x2-Yngdckwo.mjs → grid-2x2-CHuMzRxF.mjs} +1 -1
  16. package/dist/{hostInit-v495uwvg.mjs → hostInit-B3DR-ujG.mjs} +3 -3
  17. package/dist/{icons-C4_Ji5S0.mjs → icons-BwkaMam3.mjs} +9 -9
  18. package/dist/index.js +1 -1
  19. package/dist/{mic-off-DPNSd6G7.mjs → mic-off-2uHAsVtR.mjs} +1 -1
  20. package/dist/orchestrator/training.addon.js +1 -1
  21. package/dist/orchestrator/training.addon.mjs +1 -1
  22. package/dist/{player-overlays-DXTsKpgo.mjs → player-overlays-B4V_uIvb.mjs} +25 -25
  23. package/dist/providers/modal/training-modal.addon.js +1 -1
  24. package/dist/providers/modal/training-modal.addon.mjs +1 -1
  25. package/dist/remoteEntry.js +1 -1
  26. package/dist/{responsive-Cfmds8tw.mjs → responsive-1iwc-rj2.mjs} +26 -26
  27. package/dist/{rotate-ccw-Dak-lXgZ.mjs → rotate-ccw-Cu6tGrgG.mjs} +1 -1
  28. package/dist/scene-monitor-copy-Cqfs4Vng.mjs +176 -0
  29. package/dist/{settings-2-Cgiv3kQb.mjs → settings-2-xV0I5Y5U.mjs} +1 -1
  30. package/dist/{square-B_679zIX.mjs → square-ZPUterXM.mjs} +1 -1
  31. package/dist/{trash-2-DC8LDYlI.mjs → trash-2-BKfuhsgY.mjs} +1 -1
  32. package/dist/ui-text-CqJgUCKX.mjs +34 -0
  33. 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-Dk6Nf5b3.mjs} +1 -1
  34. package/dist/{zoom-out-BJoVDYa3.mjs → zoom-out-DDZCsqkQ.mjs} +1 -1
  35. package/package.json +1 -1
  36. package/dist/MotionZonesSettings-15Lfyz9l.mjs +0 -292
  37. package/dist/PrivacyMaskSettings-CAyzlGjl.mjs +0 -348
  38. package/dist/SceneMonitorEditor-D49_o83T.mjs +0 -810
  39. package/dist/_virtual_mf___mfe_internal__addon_training_page__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-Cn2OEGrR.mjs +0 -26
  40. package/dist/scene-monitor-copy-DX2u-htD.mjs +0 -136
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createLucideIcon-CPP1Jzoz.mjs";
1
+ import { t as e } from "./createLucideIcon-C0bBNRpC.mjs";
2
2
  var t = e("camera", [["path", {
3
3
  d: "M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",
4
4
  key: "18u6gg"
@@ -0,0 +1,176 @@
1
+ import { g as e, l as t, w as n, y as r } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs";
2
+ import { n as i } from "./ui-text-CqJgUCKX.mjs";
3
+ //#region ../ui-library/src/lib/hub-mount.ts
4
+ n();
5
+ var a = "camstack-mount", o = /^\/(?:[A-Za-z0-9_\-.]+\/)*$/, s = null;
6
+ function c(e) {
7
+ if (e == null || e === "") return null;
8
+ let t = e.endsWith("/") ? e : `${e}/`;
9
+ return !o.test(t) || t.includes("/../") || t.includes("/./") ? null : t;
10
+ }
11
+ function l() {
12
+ if (typeof document > "u") return "/";
13
+ let e = c(document.querySelector(`meta[name="${a}"]`)?.getAttribute("content"));
14
+ if (e !== null) return e;
15
+ if (document.querySelector("base[href]") !== null) try {
16
+ let e = new URL(document.baseURI);
17
+ if (e.origin === window.location.origin) {
18
+ let t = c(e.pathname);
19
+ if (t !== null) return t;
20
+ }
21
+ } catch {}
22
+ return "/";
23
+ }
24
+ function u() {
25
+ return s === null && (s = l()), s;
26
+ }
27
+ function d() {
28
+ return u().replace(/\/$/, "");
29
+ }
30
+ function f(e) {
31
+ return /^[a-z][a-z0-9+.-]*:/i.test(e) || e.startsWith("//");
32
+ }
33
+ function p(e) {
34
+ if (f(e)) return e;
35
+ let t = u(), n = e.replace(/^\/+/, "");
36
+ return t !== "/" && (e === d() || e.startsWith(t)) ? e : `${t}${n}`;
37
+ }
38
+ //#endregion
39
+ //#region ../ui-library/src/hooks/use-device-snapshot.ts
40
+ var m = "/addon/snapshot/media";
41
+ function h(n, i = {}) {
42
+ let { width: a, baseUrl: o } = i, [s, c] = r(0);
43
+ return {
44
+ src: e(() => {
45
+ if (n === null || n <= 0) return null;
46
+ let e = o === void 0 ? d() : o.replace(/\/+$/, ""), t = new URLSearchParams();
47
+ a !== void 0 && Number.isInteger(a) && a > 0 && t.set("w", String(a)), s > 0 && (t.set("force", "1"), t.set("r", String(s)));
48
+ let r = t.toString();
49
+ return `${e}${m}/${String(n)}.jpg${r.length > 0 ? `?${r}` : ""}`;
50
+ }, [
51
+ n,
52
+ a,
53
+ o,
54
+ s
55
+ ]),
56
+ loading: !1,
57
+ refresh: t(() => {
58
+ c((e) => e + 1);
59
+ }, [])
60
+ };
61
+ }
62
+ //#endregion
63
+ //#region ../ui-library/src/composites/cap-settings/scene-monitor-copy.ts
64
+ var g = ["day", "ir"], _ = {
65
+ day: {
66
+ labelKey: "uiLibrary.sceneMonitor.variant.day",
67
+ labelFallback: "Daylight"
68
+ },
69
+ ir: {
70
+ labelKey: "uiLibrary.sceneMonitor.variant.ir",
71
+ labelFallback: "Night (IR)"
72
+ },
73
+ night: {
74
+ labelKey: "uiLibrary.sceneMonitor.variant.night",
75
+ labelFallback: "Night"
76
+ },
77
+ dawn: {
78
+ labelKey: "uiLibrary.sceneMonitor.variant.dawn",
79
+ labelFallback: "Dawn"
80
+ },
81
+ dusk: {
82
+ labelKey: "uiLibrary.sceneMonitor.variant.dusk",
83
+ labelFallback: "Dusk"
84
+ }
85
+ };
86
+ function v(e, t = i) {
87
+ let n = _[e];
88
+ return n === void 0 ? e : t(n.labelKey, n.labelFallback);
89
+ }
90
+ function y(e, t = i) {
91
+ let n = new Set(e.coveredConditions), r = g.map((e) => `${v(e, t)} ${n.has(e) ? "✓" : "✗"}`), a = [...n].filter((e) => !g.some((t) => t === e));
92
+ for (let e of a) r.push(`${v(e, t)} ✓`);
93
+ let o = g.filter((e) => !n.has(e));
94
+ if (o.length === 0) return r.join(" · ");
95
+ if (n.size === 0) return t("uiLibrary.sceneMonitor.coverage.empty", "{{parts}} — nothing captured yet, so this scene is not watching.", { parts: r.join(" · ") });
96
+ let [s = "", c] = o.map((e) => v(e, t).toLowerCase()), l = c === void 0 ? s : t("uiLibrary.sceneMonitor.coverage.namesJoin", "{{first}} and {{second}}", {
97
+ first: s,
98
+ second: c
99
+ }), u = {
100
+ parts: r.join(" · "),
101
+ names: l
102
+ };
103
+ return e.onUncoveredCondition === "judge-anyway" ? t("uiLibrary.sceneMonitor.coverage.judgeAnyway", "{{parts}} — {{names}} judged against the references you do have.", u) : t("uiLibrary.sceneMonitor.coverage.skip", "{{parts}} — optional; checks in {{names}} are skipped.", u);
104
+ }
105
+ function b(e, t = i) {
106
+ return e.suspendedCondition === null ? null : t("uiLibrary.sceneMonitor.suspension", "Paused — nothing was captured in {{light}}, so checks are on hold until the light changes back. Capture {{light}} if you want it watched around the clock.", { light: v(e.suspendedCondition, t).toLowerCase() });
107
+ }
108
+ var x = {
109
+ "no-reference-for-condition": {
110
+ key: "uiLibrary.sceneMonitor.unavailable.no_reference_for_condition",
111
+ fallback: "can’t tell — nothing has been captured for this scene yet. Press “Capture daylight” to photograph what normal looks like."
112
+ },
113
+ "view-shifted": {
114
+ key: "uiLibrary.sceneMonitor.unavailable.view_shifted",
115
+ fallback: "can’t tell — the camera view has moved since the reference was captured. Re-capture it."
116
+ },
117
+ "no-vision-profile": {
118
+ key: "uiLibrary.sceneMonitor.unavailable.no_vision_profile",
119
+ fallback: "can’t tell — the vision model is unreachable, so the change is on hold."
120
+ },
121
+ "encoder-model-changed": {
122
+ key: "uiLibrary.sceneMonitor.unavailable.encoder_model_changed",
123
+ fallback: "can’t tell — the embedding model changed, so the stored references are unreadable. Re-capture them."
124
+ },
125
+ "no-snapshot": {
126
+ key: "uiLibrary.sceneMonitor.unavailable.no_snapshot",
127
+ fallback: "can’t tell — this camera did not return a frame."
128
+ }
129
+ };
130
+ function S(e, t, n = i) {
131
+ if (e.states.length === 0) return n("uiLibrary.sceneMonitor.status.notArmed", "Not armed yet — capture the initial state to start watching.");
132
+ if (e.verdict === "unknown") {
133
+ if (e.unavailable === null) return n("uiLibrary.sceneMonitor.status.cantTellNow", "can’t tell right now.");
134
+ let t = x[e.unavailable];
135
+ return n(t.key, t.fallback);
136
+ }
137
+ let r = e.verdict === "diverged" ? e.divergedAt : e.armedAt, a = r === null ? "" : ` ${n("uiLibrary.sceneMonitor.status.heldFor", "for {{duration}}", { duration: E(Math.max(0, t - r)) })}`;
138
+ if (e.latched) return e.verdict === "diverged" ? n("uiLibrary.sceneMonitor.status.changedLatched", "CHANGED{{held}} — press Reset when you have dealt with it.", { held: a }) : n("uiLibrary.sceneMonitor.status.backToNormal", "Back to normal, but still flagged as changed{{held}}. Press Reset to clear it.", { held: a });
139
+ let o = b(e, n);
140
+ return o === null ? e.verdict === "diverged" ? n("uiLibrary.sceneMonitor.status.changed", "CHANGED{{held}}", { held: a }) : n("uiLibrary.sceneMonitor.status.normal", "Normal{{held}}", { held: a }) : o;
141
+ }
142
+ function C(e, t = i) {
143
+ return e.states.length === 0 ? {
144
+ text: t("uiLibrary.sceneMonitor.badge.notArmed", "Not armed"),
145
+ tone: "unknown"
146
+ } : e.latched ? {
147
+ text: t("uiLibrary.sceneMonitor.badge.changed", "Changed"),
148
+ tone: "alarm"
149
+ } : e.suspendedCondition === null ? e.verdict === "unknown" ? {
150
+ text: t("uiLibrary.sceneMonitor.badge.cantTell", "Can’t tell"),
151
+ tone: "unknown"
152
+ } : e.verdict === "diverged" ? {
153
+ text: t("uiLibrary.sceneMonitor.badge.changed", "Changed"),
154
+ tone: "alarm"
155
+ } : {
156
+ text: t("uiLibrary.sceneMonitor.badge.normal", "Normal"),
157
+ tone: "ok"
158
+ } : {
159
+ text: t("uiLibrary.sceneMonitor.badge.paused", "Paused"),
160
+ tone: "unknown"
161
+ };
162
+ }
163
+ var w = .4;
164
+ function T(e) {
165
+ return e.width * e.height > w;
166
+ }
167
+ function E(e) {
168
+ let t = Math.floor(e / 1e3);
169
+ if (t < 60) return `${t}s`;
170
+ let n = Math.floor(t / 60);
171
+ if (n < 60) return `${n}m`;
172
+ let r = Math.floor(n / 60);
173
+ return r < 48 ? `${r}h` : `${Math.floor(r / 24)}d`;
174
+ }
175
+ //#endregion
176
+ export { S as a, p as c, T as i, C as n, v as o, y as r, h as s, g as t };
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createLucideIcon-CPP1Jzoz.mjs";
1
+ import { t as e } from "./createLucideIcon-C0bBNRpC.mjs";
2
2
  var t = e("settings-2", [
3
3
  ["path", {
4
4
  d: "M14 17H5",
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createLucideIcon-CPP1Jzoz.mjs";
1
+ import { t as e } from "./createLucideIcon-C0bBNRpC.mjs";
2
2
  var t = e("eye-off", [
3
3
  ["path", {
4
4
  d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createLucideIcon-CPP1Jzoz.mjs";
1
+ import { t as e } from "./createLucideIcon-C0bBNRpC.mjs";
2
2
  var t = e("trash-2", [
3
3
  ["path", {
4
4
  d: "M10 11v6",
@@ -0,0 +1,34 @@
1
+ import { f as e, n as t, t as n, u as r, w as i } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react__loadShare__.js-CEvdvp1T.mjs";
2
+ import { n as a, t as o } from "./_virtual_mf___mfe_internal__addon_training_page__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-DnrbBvrw.mjs";
3
+ //#region ../ui-library/src/contexts/ui-text.tsx
4
+ i();
5
+ var s = /\{\{\s*(\w+)\s*\}\}/g;
6
+ function c(e, t) {
7
+ return typeof e == "string" ? e : t === 1 ? e.one : e.other;
8
+ }
9
+ var l = (e, t, n) => {
10
+ let r = c(t, n?.count);
11
+ return n ? r.replace(s, (e, t) => {
12
+ let r = n[t];
13
+ return r == null ? e : String(r);
14
+ }) : r;
15
+ }, u = t(l);
16
+ function d() {
17
+ return r(u);
18
+ }
19
+ var f = /<(\d+)>([\s\S]*?)<\/\1>/g;
20
+ function p(e, t) {
21
+ let r = [], i = 0;
22
+ for (let a of e.matchAll(f)) {
23
+ let o = a.index ?? 0;
24
+ o > i && r.push(e.slice(i, o));
25
+ let s = t[Number(a[1])];
26
+ r.push(s ? n(s, void 0, a[2] ?? "") : a[2] ?? ""), i = o + a[0].length;
27
+ }
28
+ return i < e.length && r.push(e.slice(i)), r;
29
+ }
30
+ function m({ uiKey: t, fallback: n, components: r = [], values: i }) {
31
+ return /* @__PURE__ */ a(o, { children: p(d()(t, n, i), r).map((t, n) => /* @__PURE__ */ a(e, { children: t }, n)) });
32
+ }
33
+ //#endregion
34
+ export { l as n, d as r, m as t };
@@ -2762,7 +2762,7 @@ async function or(e) {
2762
2762
  }
2763
2763
  }
2764
2764
  async function sr() {
2765
- return ir ||= or(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-cOIklMU6.mjs")).catch((e) => {
2765
+ return ir ||= or(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__addon_training_page-OY71DavC.mjs")).catch((e) => {
2766
2766
  throw ir = void 0, e;
2767
2767
  }), ir;
2768
2768
  }
@@ -1,4 +1,4 @@
1
- import { t as e } from "./createLucideIcon-CPP1Jzoz.mjs";
1
+ import { t as e } from "./createLucideIcon-C0bBNRpC.mjs";
2
2
  var t = e("activity", [["path", {
3
3
  d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
4
4
  key: "169zse"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-training",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Cloud training for CamStack: fine-tune the root detector on your own frames, on your own GPU-cloud account",
5
5
  "keywords": [
6
6
  "camstack",
@@ -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 };