@camstack/addon-pipeline-orchestrator 1.1.32 → 1.1.34
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/_stub.js +311 -299
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-BvomAHii.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-vZTi0c_a.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-iO-Czqhz.mjs +26 -0
- package/dist/{_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-B8GJlTM4.mjs → _virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-IzxaZxNX.mjs} +1 -1
- package/dist/{hostInit-CZlukFwM.mjs → hostInit-gtkVoSWG.mjs} +3 -3
- package/dist/index.js +7700 -5608
- package/dist/index.mjs +7701 -5608
- package/dist/remoteEntry.js +1 -1
- package/package.json +1 -1
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DnGsQN5q.mjs +0 -26
package/dist/_stub.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { t as e } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-BiLBDmU5.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
2
|
+
import { n as t, t as n } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-iO-Czqhz.mjs";
|
|
3
|
+
import { a as r, c as i, i as a, n as o, o as s, r as c, s as l, t as u } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-a8tvh93M.mjs";
|
|
4
|
+
import { C as d, S as f, _ as p, a as m, b as h, c as g, d as _, f as v, g as y, h as b, i as x, l as S, m as C, n as w, o as T, p as E, r as D, s as O, t as k, u as A, v as j, w as M, x as N, y as P } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-IzxaZxNX.mjs";
|
|
5
|
+
import { n as F, r as I, t as L } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-yD-rMaFX.mjs";
|
|
6
6
|
//#region ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
7
|
-
var
|
|
8
|
-
let t =
|
|
7
|
+
var R = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), z = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), B = (e) => {
|
|
8
|
+
let t = z(e);
|
|
9
9
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
10
|
-
},
|
|
10
|
+
}, V = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), ee = (e) => {
|
|
11
11
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
12
|
-
},
|
|
12
|
+
}, te = {
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
width: 24,
|
|
15
15
|
height: 24,
|
|
@@ -19,31 +19,31 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
19
19
|
strokeWidth: 2,
|
|
20
20
|
strokeLinecap: "round",
|
|
21
21
|
strokeLinejoin: "round"
|
|
22
|
-
},
|
|
23
|
-
ref:
|
|
24
|
-
...
|
|
22
|
+
}, ne = o(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => u("svg", {
|
|
23
|
+
ref: c,
|
|
24
|
+
...te,
|
|
25
25
|
width: t,
|
|
26
26
|
height: t,
|
|
27
27
|
stroke: e,
|
|
28
28
|
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
29
|
-
className:
|
|
30
|
-
...!a && !
|
|
29
|
+
className: V("lucide", i),
|
|
30
|
+
...!a && !ee(s) && { "aria-hidden": "true" },
|
|
31
31
|
...s
|
|
32
|
-
}, [...o.map(([e, t]) =>
|
|
33
|
-
let n =
|
|
32
|
+
}, [...o.map(([e, t]) => u(e, t)), ...Array.isArray(a) ? a : [a]])), H = (e, t) => {
|
|
33
|
+
let n = o(({ className: n, ...r }, i) => u(ne, {
|
|
34
34
|
ref: i,
|
|
35
35
|
iconNode: t,
|
|
36
|
-
className:
|
|
36
|
+
className: V(`lucide-${R(B(e))}`, `lucide-${e}`, n),
|
|
37
37
|
...r
|
|
38
38
|
}));
|
|
39
|
-
return n.displayName =
|
|
40
|
-
},
|
|
39
|
+
return n.displayName = B(e), n;
|
|
40
|
+
}, re = H("activity", [["path", {
|
|
41
41
|
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",
|
|
42
42
|
key: "169zse"
|
|
43
|
-
}]]),
|
|
43
|
+
}]]), ie = H("check", [["path", {
|
|
44
44
|
d: "M20 6 9 17l-5-5",
|
|
45
45
|
key: "1gmf2c"
|
|
46
|
-
}]]),
|
|
46
|
+
}]]), ae = H("cpu", [
|
|
47
47
|
["path", {
|
|
48
48
|
d: "M12 20v2",
|
|
49
49
|
key: "1lh1kg"
|
|
@@ -108,7 +108,7 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
108
108
|
rx: "1",
|
|
109
109
|
key: "z9xiuo"
|
|
110
110
|
}]
|
|
111
|
-
]),
|
|
111
|
+
]), oe = H("eye", [["path", {
|
|
112
112
|
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
113
113
|
key: "1nclc0"
|
|
114
114
|
}], ["circle", {
|
|
@@ -116,25 +116,25 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
116
116
|
cy: "12",
|
|
117
117
|
r: "3",
|
|
118
118
|
key: "1v7zrd"
|
|
119
|
-
}]]),
|
|
119
|
+
}]]), se = H("gauge", [["path", {
|
|
120
120
|
d: "m12 14 4-4",
|
|
121
121
|
key: "9kzdfg"
|
|
122
122
|
}], ["path", {
|
|
123
123
|
d: "M3.34 19a10 10 0 1 1 17.32 0",
|
|
124
124
|
key: "19p75a"
|
|
125
|
-
}]]), U =
|
|
125
|
+
}]]), U = H("hexagon", [["path", {
|
|
126
126
|
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",
|
|
127
127
|
key: "yt0hxn"
|
|
128
|
-
}]]), W =
|
|
128
|
+
}]]), W = H("minus", [["path", {
|
|
129
129
|
d: "M5 12h14",
|
|
130
130
|
key: "1ays0h"
|
|
131
|
-
}]]), G =
|
|
131
|
+
}]]), G = H("plus", [["path", {
|
|
132
132
|
d: "M5 12h14",
|
|
133
133
|
key: "1ays0h"
|
|
134
134
|
}], ["path", {
|
|
135
135
|
d: "M12 5v14",
|
|
136
136
|
key: "s699le"
|
|
137
|
-
}]]), K =
|
|
137
|
+
}]]), K = H("save", [
|
|
138
138
|
["path", {
|
|
139
139
|
d: "M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",
|
|
140
140
|
key: "1c8476"
|
|
@@ -147,7 +147,7 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
147
147
|
d: "M7 3v4a1 1 0 0 0 1 1h7",
|
|
148
148
|
key: "t51u73"
|
|
149
149
|
}]
|
|
150
|
-
]), q =
|
|
150
|
+
]), q = H("trash-2", [
|
|
151
151
|
["path", {
|
|
152
152
|
d: "M3 6h18",
|
|
153
153
|
key: "d0wm0j"
|
|
@@ -174,7 +174,7 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
174
174
|
y2: "17",
|
|
175
175
|
key: "xtxkd"
|
|
176
176
|
}]
|
|
177
|
-
]),
|
|
177
|
+
]), ce = H("video", [["path", {
|
|
178
178
|
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
|
|
179
179
|
key: "ftymec"
|
|
180
180
|
}], ["rect", {
|
|
@@ -184,7 +184,7 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
184
184
|
height: "12",
|
|
185
185
|
rx: "2",
|
|
186
186
|
key: "158x01"
|
|
187
|
-
}]]),
|
|
187
|
+
}]]), le = H("volume-2", [
|
|
188
188
|
["path", {
|
|
189
189
|
d: "M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",
|
|
190
190
|
key: "uqj9uw"
|
|
@@ -197,7 +197,7 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
197
197
|
d: "M19.364 18.364a9 9 0 0 0 0-12.728",
|
|
198
198
|
key: "ijwkga"
|
|
199
199
|
}]
|
|
200
|
-
]), J =
|
|
200
|
+
]), J = H("x", [["path", {
|
|
201
201
|
d: "M18 6 6 18",
|
|
202
202
|
key: "1bl5f8"
|
|
203
203
|
}], ["path", {
|
|
@@ -206,99 +206,111 @@ var ee = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), L = (e)
|
|
|
206
206
|
}]]);
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region src/widgets/PipelineQuickStats.tsx
|
|
209
|
-
function
|
|
210
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
209
|
+
function ue(e) {
|
|
210
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ F("div", {
|
|
211
211
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
212
212
|
children: "PipelineQuickStats requires a deviceId"
|
|
213
|
-
}) : /* @__PURE__ */
|
|
213
|
+
}) : /* @__PURE__ */ F(de, { deviceId: e.deviceId });
|
|
214
214
|
}
|
|
215
|
-
function
|
|
216
|
-
|
|
215
|
+
function de({ deviceId: n }) {
|
|
216
|
+
N(["pipelineOrchestrator", "getPipelineAssignment"], [
|
|
217
217
|
"pipeline.camera-assigned",
|
|
218
218
|
"pipeline.camera-unassigned",
|
|
219
219
|
"pipeline.camera-updated"
|
|
220
|
-
]),
|
|
221
|
-
let { data:
|
|
222
|
-
deviceId:
|
|
223
|
-
...
|
|
220
|
+
]), N(["pipelineRunner", "getCameraMetrics"], ["pipeline.camera-metrics-snapshot"]);
|
|
221
|
+
let { data: r } = f({ deviceId: n }, { staleTime: 3e4 }), i = r?.agentNodeId ?? null, a = typeof i == "string" && i.length > 0 && !i.startsWith("addon:") ? i : void 0, { data: o } = d({
|
|
222
|
+
deviceId: n,
|
|
223
|
+
...a ? { nodeId: a } : {}
|
|
224
224
|
}, {
|
|
225
225
|
staleTime: 2e3,
|
|
226
226
|
retry: !1
|
|
227
|
-
}),
|
|
227
|
+
}), s = w(), c = P(s.trpcClient, n), { data: l } = e({
|
|
228
228
|
queryKey: [
|
|
229
229
|
"device",
|
|
230
|
-
|
|
230
|
+
n,
|
|
231
231
|
"pipelineAnalytics.getActiveTracks"
|
|
232
232
|
],
|
|
233
|
-
queryFn: () =>
|
|
234
|
-
enabled: !!
|
|
233
|
+
queryFn: () => c?.pipelineAnalytics?.getActiveTracks({}) ?? [],
|
|
234
|
+
enabled: !!c,
|
|
235
235
|
refetchInterval: 5e3,
|
|
236
236
|
retry: !1
|
|
237
|
-
}), { data:
|
|
237
|
+
}), { data: u } = e({
|
|
238
238
|
queryKey: [
|
|
239
239
|
"device",
|
|
240
|
-
|
|
240
|
+
n,
|
|
241
241
|
"audioMetrics.getCurrentSnapshot"
|
|
242
242
|
],
|
|
243
|
-
queryFn: () =>
|
|
244
|
-
enabled: !!
|
|
243
|
+
queryFn: () => c?.audioMetrics?.getCurrentSnapshot({}) ?? null,
|
|
244
|
+
enabled: !!c,
|
|
245
245
|
refetchInterval: 2e3,
|
|
246
246
|
retry: !1
|
|
247
|
-
}), { data:
|
|
248
|
-
queryKey: ["recording.getStatus",
|
|
249
|
-
queryFn: async () => await
|
|
247
|
+
}), { data: p } = e({
|
|
248
|
+
queryKey: ["recording.getStatus", n],
|
|
249
|
+
queryFn: async () => await s.trpcClient.recording.getStatus.query({ deviceId: n }),
|
|
250
250
|
refetchInterval: 5e3,
|
|
251
251
|
retry: !1
|
|
252
|
-
}), { data:
|
|
253
|
-
queryKey: ["recording.getDeviceConfig",
|
|
254
|
-
queryFn: async () => await
|
|
252
|
+
}), { data: m } = e({
|
|
253
|
+
queryKey: ["recording.getDeviceConfig", n],
|
|
254
|
+
queryFn: async () => await s.trpcClient.recording.getDeviceConfig.query({ deviceId: n }),
|
|
255
|
+
staleTime: 3e4,
|
|
256
|
+
retry: !1
|
|
257
|
+
}), { data: h } = e({
|
|
258
|
+
queryKey: [
|
|
259
|
+
"device",
|
|
260
|
+
n,
|
|
261
|
+
"addonSettings.getDeviceSettings.detectionMode"
|
|
262
|
+
],
|
|
263
|
+
queryFn: () => s.trpcClient.addonSettings.getDeviceSettings.query({
|
|
264
|
+
addonId: "pipeline-orchestrator",
|
|
265
|
+
deviceId: n
|
|
266
|
+
}),
|
|
255
267
|
staleTime: 3e4,
|
|
256
268
|
retry: !1
|
|
257
|
-
}),
|
|
258
|
-
return /* @__PURE__ */
|
|
269
|
+
}), g = t(h, "detectionMode"), _ = typeof g == "string" ? g : null, v = o?.phase ?? null, y = _, b = Number(o?.actualFps ?? 0), x = Number(o?.configuredFps ?? 0), S = Number(o?.avgInferenceTimeMs ?? 0), C = Number(o?.queueDepth ?? 0), T = Number(o?.droppedFrames ?? 0), E = j(v ?? "watching"), D = l?.length ?? 0, O = u?.level.dbfs ?? null, k = typeof O == "number" ? `${O.toFixed(1)} dBFS` : "—", A = p?.enabled ?? !1, M = p?.activeMode ?? "off", L = A && M !== "off", R = A ? M === "off" ? "Idle" : M === "continuous" ? "Continuous" : M === "onMotion" ? "On motion" : M === "onAudioThreshold" ? "On audio" : M : "Disabled", z = (m?.profiles ?? []).join(", "), B = p ? `${fe(p.storageBytes ?? 0)}${z ? ` · ${z}` : ""}` : void 0;
|
|
270
|
+
return /* @__PURE__ */ I("div", {
|
|
259
271
|
className: "grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3",
|
|
260
272
|
children: [
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
icon:
|
|
273
|
+
/* @__PURE__ */ F(Y, {
|
|
274
|
+
icon: re,
|
|
263
275
|
label: "Phase",
|
|
264
|
-
value:
|
|
265
|
-
color:
|
|
266
|
-
subtext:
|
|
276
|
+
value: E.label,
|
|
277
|
+
color: E.textColor,
|
|
278
|
+
subtext: y ?? void 0
|
|
267
279
|
}),
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
icon:
|
|
280
|
+
/* @__PURE__ */ F(Y, {
|
|
281
|
+
icon: se,
|
|
270
282
|
label: "Detection FPS",
|
|
271
|
-
value: `${
|
|
272
|
-
subtext:
|
|
283
|
+
value: `${b.toFixed(1)}`,
|
|
284
|
+
subtext: x > 0 ? `target: ${x}` : void 0
|
|
273
285
|
}),
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
icon:
|
|
286
|
+
/* @__PURE__ */ F(Y, {
|
|
287
|
+
icon: ae,
|
|
276
288
|
label: "Inference",
|
|
277
|
-
value: `${
|
|
278
|
-
subtext:
|
|
289
|
+
value: `${S.toFixed(1)} ms`,
|
|
290
|
+
subtext: C > 0 ? `queue: ${C}` : void 0
|
|
279
291
|
}),
|
|
280
|
-
/* @__PURE__ */
|
|
281
|
-
icon:
|
|
292
|
+
/* @__PURE__ */ F(Y, {
|
|
293
|
+
icon: oe,
|
|
282
294
|
label: "Active Tracks",
|
|
283
|
-
value: String(
|
|
284
|
-
subtext:
|
|
295
|
+
value: String(D),
|
|
296
|
+
subtext: T > 0 ? `dropped: ${T}` : void 0
|
|
285
297
|
}),
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
icon:
|
|
298
|
+
/* @__PURE__ */ F(Y, {
|
|
299
|
+
icon: le,
|
|
288
300
|
label: "Current dB",
|
|
289
|
-
value:
|
|
301
|
+
value: k
|
|
290
302
|
}),
|
|
291
|
-
/* @__PURE__ */
|
|
292
|
-
icon:
|
|
303
|
+
/* @__PURE__ */ F(Y, {
|
|
304
|
+
icon: ce,
|
|
293
305
|
label: "Recording",
|
|
294
|
-
value:
|
|
295
|
-
color:
|
|
296
|
-
subtext:
|
|
306
|
+
value: R,
|
|
307
|
+
color: L ? "text-success" : void 0,
|
|
308
|
+
subtext: B
|
|
297
309
|
})
|
|
298
310
|
]
|
|
299
311
|
});
|
|
300
312
|
}
|
|
301
|
-
function
|
|
313
|
+
function fe(e) {
|
|
302
314
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
303
315
|
let t = [
|
|
304
316
|
"B",
|
|
@@ -310,23 +322,23 @@ function de(e) {
|
|
|
310
322
|
return `${n === 0 ? Math.round(r) : r.toFixed(1)} ${t[n]}`;
|
|
311
323
|
}
|
|
312
324
|
function Y({ icon: e, label: t, value: n, subtext: r, color: i }) {
|
|
313
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ I("div", {
|
|
314
326
|
className: "rounded-lg border border-border bg-surface p-3 min-w-0",
|
|
315
327
|
children: [
|
|
316
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ I("div", {
|
|
317
329
|
className: "flex items-center gap-1.5 mb-1 min-w-0",
|
|
318
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ F(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }), /* @__PURE__ */ F("span", {
|
|
319
331
|
className: "text-[10px] text-foreground-subtle uppercase tracking-wider truncate",
|
|
320
332
|
title: t,
|
|
321
333
|
children: t
|
|
322
334
|
})]
|
|
323
335
|
}),
|
|
324
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ F("p", {
|
|
325
337
|
className: `text-lg font-semibold leading-tight truncate ${i ?? "text-foreground"}`,
|
|
326
338
|
title: n,
|
|
327
339
|
children: n
|
|
328
340
|
}),
|
|
329
|
-
r && /* @__PURE__ */
|
|
341
|
+
r && /* @__PURE__ */ F("p", {
|
|
330
342
|
className: "text-[10px] text-foreground-subtle mt-0.5 truncate",
|
|
331
343
|
title: r,
|
|
332
344
|
children: r
|
|
@@ -336,70 +348,70 @@ function Y({ icon: e, label: t, value: n, subtext: r, color: i }) {
|
|
|
336
348
|
}
|
|
337
349
|
//#endregion
|
|
338
350
|
//#region src/widgets/zone-editor/ZoneList.tsx
|
|
339
|
-
var
|
|
351
|
+
var pe = {
|
|
340
352
|
polygon: "Polygon",
|
|
341
353
|
tripwire: "Tripwire"
|
|
342
|
-
},
|
|
354
|
+
}, me = {
|
|
343
355
|
polygon: "bg-info/10 text-info",
|
|
344
356
|
tripwire: "bg-warning/10 text-warning"
|
|
345
357
|
};
|
|
346
|
-
function
|
|
347
|
-
return /* @__PURE__ */
|
|
358
|
+
function he({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
|
|
359
|
+
return /* @__PURE__ */ I("div", {
|
|
348
360
|
className: "flex flex-col gap-2",
|
|
349
|
-
children: [/* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ F("div", {
|
|
350
362
|
className: "flex items-center gap-1",
|
|
351
|
-
children: n ? /* @__PURE__ */
|
|
363
|
+
children: n ? /* @__PURE__ */ I("button", {
|
|
352
364
|
type: "button",
|
|
353
365
|
onClick: o,
|
|
354
366
|
className: "inline-flex items-center justify-center gap-1 rounded border border-amber-500/30 bg-amber-500/10 text-amber-400 hover:bg-amber-500/20 transition-colors h-8 px-3 text-[11px] font-medium",
|
|
355
367
|
title: "Cancel drawing",
|
|
356
|
-
children: [/* @__PURE__ */
|
|
357
|
-
}) : /* @__PURE__ */
|
|
368
|
+
children: [/* @__PURE__ */ F(J, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ F("span", { children: "Cancel" })]
|
|
369
|
+
}) : /* @__PURE__ */ I(L, { children: [/* @__PURE__ */ F("button", {
|
|
358
370
|
type: "button",
|
|
359
371
|
onClick: () => a("polygon"),
|
|
360
372
|
className: "inline-flex items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors h-8 w-8",
|
|
361
373
|
title: "Add polygon zone",
|
|
362
374
|
"aria-label": "Add polygon zone",
|
|
363
|
-
children: /* @__PURE__ */
|
|
364
|
-
}), /* @__PURE__ */
|
|
375
|
+
children: /* @__PURE__ */ F(U, { className: "h-4 w-4" })
|
|
376
|
+
}), /* @__PURE__ */ F("button", {
|
|
365
377
|
type: "button",
|
|
366
378
|
onClick: () => a("tripwire"),
|
|
367
379
|
className: "inline-flex items-center justify-center rounded border border-border bg-surface text-foreground-subtle hover:text-primary hover:border-primary/40 hover:bg-primary/5 transition-colors h-8 w-8",
|
|
368
380
|
title: "Add tripwire",
|
|
369
381
|
"aria-label": "Add tripwire",
|
|
370
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ F(W, { className: "h-5 w-5 stroke-[2.5]" })
|
|
371
383
|
})] })
|
|
372
|
-
}), e.length === 0 ? /* @__PURE__ */
|
|
384
|
+
}), e.length === 0 ? /* @__PURE__ */ F("p", {
|
|
373
385
|
className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight",
|
|
374
386
|
children: "No zones yet — pick \"Zone\" or \"Tripwire\" to draw."
|
|
375
|
-
}) : /* @__PURE__ */
|
|
387
|
+
}) : /* @__PURE__ */ F("div", {
|
|
376
388
|
className: "flex flex-col gap-1",
|
|
377
389
|
children: e.map((e) => {
|
|
378
390
|
let n = e.id === t;
|
|
379
|
-
return /* @__PURE__ */
|
|
391
|
+
return /* @__PURE__ */ I("div", {
|
|
380
392
|
className: ["flex items-center gap-1.5 rounded border px-1.5 py-1 cursor-pointer transition-colors", n ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"].join(" "),
|
|
381
393
|
onClick: () => r(n ? null : e.id),
|
|
382
394
|
children: [
|
|
383
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ F("div", {
|
|
384
396
|
className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
|
|
385
397
|
style: { backgroundColor: e.color }
|
|
386
398
|
}),
|
|
387
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ F("span", {
|
|
388
400
|
className: "flex-1 truncate text-[11px] font-medium text-foreground",
|
|
389
401
|
children: e.name
|
|
390
402
|
}),
|
|
391
|
-
/* @__PURE__ */
|
|
392
|
-
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${
|
|
393
|
-
children:
|
|
403
|
+
/* @__PURE__ */ F("span", {
|
|
404
|
+
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${me[e.kind]}`,
|
|
405
|
+
children: pe[e.kind]
|
|
394
406
|
}),
|
|
395
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ F("button", {
|
|
396
408
|
type: "button",
|
|
397
409
|
title: "Delete zone",
|
|
398
410
|
className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
|
|
399
411
|
onClick: (t) => {
|
|
400
412
|
t.stopPropagation(), i(e.id);
|
|
401
413
|
},
|
|
402
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ F(q, { className: "h-3 w-3" })
|
|
403
415
|
})
|
|
404
416
|
]
|
|
405
417
|
}, e.id);
|
|
@@ -409,7 +421,7 @@ function me({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDe
|
|
|
409
421
|
}
|
|
410
422
|
//#endregion
|
|
411
423
|
//#region src/widgets/zone-editor/ZoneForm.tsx
|
|
412
|
-
var
|
|
424
|
+
var ge = [
|
|
413
425
|
"#3b82f6",
|
|
414
426
|
"#10b981",
|
|
415
427
|
"#f59e0b",
|
|
@@ -419,24 +431,24 @@ var he = [
|
|
|
419
431
|
"#f97316",
|
|
420
432
|
"#ec4899"
|
|
421
433
|
];
|
|
422
|
-
function
|
|
423
|
-
let i =
|
|
424
|
-
return /* @__PURE__ */
|
|
434
|
+
function _e({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
435
|
+
let i = m(), a = (e) => i?.updateDraft({ name: e }), o = (e) => i?.updateDraft({ color: e });
|
|
436
|
+
return /* @__PURE__ */ I("div", {
|
|
425
437
|
className: "flex flex-col gap-2",
|
|
426
438
|
children: [
|
|
427
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ I("div", {
|
|
428
440
|
className: "flex items-center justify-between",
|
|
429
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
430
442
|
className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
431
443
|
children: "Editing"
|
|
432
|
-
}), /* @__PURE__ */
|
|
444
|
+
}), /* @__PURE__ */ F("span", {
|
|
433
445
|
className: "inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium bg-surface border border-border text-foreground-subtle",
|
|
434
446
|
children: e.kind === "tripwire" ? "Tripwire" : "Polygon"
|
|
435
447
|
})]
|
|
436
448
|
}),
|
|
437
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ F("input", {
|
|
438
450
|
type: "text",
|
|
439
|
-
className:
|
|
451
|
+
className: T,
|
|
440
452
|
value: e.name,
|
|
441
453
|
autoFocus: !0,
|
|
442
454
|
onChange: (e) => a(e.target.value),
|
|
@@ -445,9 +457,9 @@ function ge({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
445
457
|
},
|
|
446
458
|
placeholder: "Zone name"
|
|
447
459
|
}),
|
|
448
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ F("div", {
|
|
449
461
|
className: "flex flex-wrap gap-1",
|
|
450
|
-
children:
|
|
462
|
+
children: ge.map((t) => /* @__PURE__ */ F("button", {
|
|
451
463
|
type: "button",
|
|
452
464
|
title: t,
|
|
453
465
|
className: ["h-4 w-4 rounded border-2 cursor-pointer transition-transform hover:scale-110", e.color === t ? "border-white scale-110" : "border-transparent"].join(" "),
|
|
@@ -455,57 +467,57 @@ function ge({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
455
467
|
onClick: () => o(t)
|
|
456
468
|
}, t))
|
|
457
469
|
}),
|
|
458
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ I("div", {
|
|
459
471
|
className: "flex items-center gap-1.5",
|
|
460
|
-
children: [/* @__PURE__ */
|
|
472
|
+
children: [/* @__PURE__ */ F("input", {
|
|
461
473
|
type: "color",
|
|
462
474
|
className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
|
|
463
475
|
value: e.color,
|
|
464
476
|
onChange: (e) => o(e.target.value)
|
|
465
|
-
}), /* @__PURE__ */
|
|
477
|
+
}), /* @__PURE__ */ F("input", {
|
|
466
478
|
type: "text",
|
|
467
|
-
className: `${
|
|
479
|
+
className: `${T} font-mono`,
|
|
468
480
|
value: e.color,
|
|
469
481
|
placeholder: "#000000",
|
|
470
482
|
onChange: (e) => o(e.target.value)
|
|
471
483
|
})]
|
|
472
484
|
}),
|
|
473
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ I("p", {
|
|
474
486
|
className: "text-[9px] text-foreground-subtle leading-tight",
|
|
475
487
|
children: [e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`, e.points.length > 0 && " · drag handles to reshape"]
|
|
476
488
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ I("div", {
|
|
478
490
|
className: "flex items-center gap-1.5",
|
|
479
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ I("button", {
|
|
480
492
|
type: "button",
|
|
481
493
|
onClick: t,
|
|
482
494
|
className: "inline-flex items-center justify-center gap-1 rounded border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors h-7 flex-1 text-[11px] font-medium",
|
|
483
495
|
title: "Save changes (Enter)",
|
|
484
|
-
children: [/* @__PURE__ */
|
|
485
|
-
}), /* @__PURE__ */
|
|
496
|
+
children: [/* @__PURE__ */ F(ie, { className: "h-3 w-3" }), "Save"]
|
|
497
|
+
}), /* @__PURE__ */ I("button", {
|
|
486
498
|
type: "button",
|
|
487
499
|
onClick: n,
|
|
488
500
|
className: "inline-flex items-center justify-center gap-1 rounded border border-border bg-surface text-foreground-subtle hover:text-foreground hover:bg-surface-hover transition-colors h-7 px-3 text-[11px] font-medium",
|
|
489
501
|
title: "Discard changes (Esc)",
|
|
490
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ F(J, { className: "h-3 w-3" }), "Discard"]
|
|
491
503
|
})]
|
|
492
504
|
}),
|
|
493
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ I("button", {
|
|
494
506
|
type: "button",
|
|
495
507
|
onClick: r,
|
|
496
|
-
className: `${
|
|
497
|
-
children: [/* @__PURE__ */
|
|
508
|
+
className: `${x} w-full`,
|
|
509
|
+
children: [/* @__PURE__ */ F(q, { className: "h-3 w-3" }), "Delete"]
|
|
498
510
|
})
|
|
499
511
|
]
|
|
500
512
|
});
|
|
501
513
|
}
|
|
502
514
|
//#endregion
|
|
503
515
|
//#region src/widgets/zone-editor/ZoneRulesEditor.tsx
|
|
504
|
-
var
|
|
516
|
+
var ve = n.map((e) => ({
|
|
505
517
|
id: e.id,
|
|
506
518
|
label: e.name
|
|
507
519
|
}));
|
|
508
|
-
function
|
|
520
|
+
function ye(e) {
|
|
509
521
|
return {
|
|
510
522
|
id: e.id,
|
|
511
523
|
name: e.name ?? "",
|
|
@@ -515,7 +527,7 @@ function ve(e) {
|
|
|
515
527
|
enabled: e.enabled !== !1
|
|
516
528
|
};
|
|
517
529
|
}
|
|
518
|
-
function
|
|
530
|
+
function be(e) {
|
|
519
531
|
let t = {
|
|
520
532
|
id: e.id,
|
|
521
533
|
zoneIds: e.zoneIds,
|
|
@@ -524,21 +536,21 @@ function ye(e) {
|
|
|
524
536
|
};
|
|
525
537
|
return e.name && (t.name = e.name), e.classFilter.length > 0 && (t.classFilter = e.classFilter), t;
|
|
526
538
|
}
|
|
527
|
-
function X({ dev: e, stage:
|
|
528
|
-
let
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
}, [
|
|
532
|
-
let
|
|
539
|
+
function X({ dev: e, stage: t, zones: n, title: i }) {
|
|
540
|
+
let a = h(e?.state.zoneRules), o = s(() => a?.[t] ?? [], [a, t]), [c, u] = l([]), [d, f] = l(!1), [m, g] = l(!1), [_, v] = l(null);
|
|
541
|
+
r(() => {
|
|
542
|
+
d || u(o.map(ye));
|
|
543
|
+
}, [o, d]);
|
|
544
|
+
let x = () => {
|
|
533
545
|
u((e) => [...e, {
|
|
534
546
|
id: crypto.randomUUID(),
|
|
535
547
|
name: "",
|
|
536
|
-
zoneIds:
|
|
548
|
+
zoneIds: n[0] ? [n[0].id] : [],
|
|
537
549
|
mode: "exclude",
|
|
538
550
|
classFilter: [],
|
|
539
551
|
enabled: !0
|
|
540
|
-
}]),
|
|
541
|
-
},
|
|
552
|
+
}]), f(!0);
|
|
553
|
+
}, S = (e, t) => {
|
|
542
554
|
u((n) => n.map((n, r) => {
|
|
543
555
|
if (r !== e) return n;
|
|
544
556
|
let i = n.classFilter.includes(t) ? n.classFilter.filter((e) => e !== t) : [...n.classFilter, t];
|
|
@@ -546,8 +558,8 @@ function X({ dev: e, stage: n, zones: r, title: i }) {
|
|
|
546
558
|
...n,
|
|
547
559
|
classFilter: i
|
|
548
560
|
};
|
|
549
|
-
})),
|
|
550
|
-
},
|
|
561
|
+
})), f(!0);
|
|
562
|
+
}, w = (e, t) => {
|
|
551
563
|
u((n) => n.map((n, r) => {
|
|
552
564
|
if (r !== e) return n;
|
|
553
565
|
let i = n.zoneIds.includes(t) ? n.zoneIds.filter((e) => e !== t) : [...n.zoneIds, t];
|
|
@@ -555,150 +567,150 @@ function X({ dev: e, stage: n, zones: r, title: i }) {
|
|
|
555
567
|
...n,
|
|
556
568
|
zoneIds: i
|
|
557
569
|
};
|
|
558
|
-
})),
|
|
559
|
-
},
|
|
560
|
-
u((t) => t.filter((t, n) => n !== e)),
|
|
561
|
-
},
|
|
570
|
+
})), f(!0);
|
|
571
|
+
}, E = (e) => {
|
|
572
|
+
u((t) => t.filter((t, n) => n !== e)), f(!0);
|
|
573
|
+
}, D = (e, t) => {
|
|
562
574
|
u((n) => n.map((n, r) => r === e ? {
|
|
563
575
|
...n,
|
|
564
576
|
...t
|
|
565
|
-
} : n)),
|
|
577
|
+
} : n)), f(!0);
|
|
566
578
|
}, A = async () => {
|
|
567
579
|
if (e?.zoneRules) {
|
|
568
|
-
g(!0),
|
|
580
|
+
g(!0), v(null);
|
|
569
581
|
try {
|
|
570
582
|
await e.zoneRules.setRules({
|
|
571
|
-
stage:
|
|
572
|
-
rules:
|
|
573
|
-
}),
|
|
583
|
+
stage: t,
|
|
584
|
+
rules: c.map(be)
|
|
585
|
+
}), f(!1);
|
|
574
586
|
} catch (e) {
|
|
575
|
-
|
|
587
|
+
v(e instanceof Error ? e.message : String(e));
|
|
576
588
|
} finally {
|
|
577
589
|
g(!1);
|
|
578
590
|
}
|
|
579
591
|
}
|
|
580
|
-
}, j =
|
|
581
|
-
return /* @__PURE__ */
|
|
592
|
+
}, j = d && !!e?.zoneRules && !m;
|
|
593
|
+
return /* @__PURE__ */ I("div", {
|
|
582
594
|
className: "rounded-md border border-border bg-surface/40 p-2.5",
|
|
583
595
|
children: [
|
|
584
|
-
/* @__PURE__ */
|
|
596
|
+
/* @__PURE__ */ I("div", {
|
|
585
597
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
586
|
-
children: [/* @__PURE__ */
|
|
587
|
-
className: `${
|
|
588
|
-
children: i ?? `${
|
|
589
|
-
}), /* @__PURE__ */
|
|
598
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
599
|
+
className: `${C} truncate`,
|
|
600
|
+
children: i ?? `${t === "motion" ? "Motion" : "Detection"} Rules`
|
|
601
|
+
}), /* @__PURE__ */ I("div", {
|
|
590
602
|
className: "flex items-center gap-1 flex-shrink-0",
|
|
591
|
-
children: [/* @__PURE__ */
|
|
603
|
+
children: [/* @__PURE__ */ I("button", {
|
|
592
604
|
type: "button",
|
|
593
|
-
onClick:
|
|
594
|
-
disabled:
|
|
595
|
-
className:
|
|
605
|
+
onClick: x,
|
|
606
|
+
disabled: n.length === 0 || !e,
|
|
607
|
+
className: k,
|
|
596
608
|
title: "Add rule",
|
|
597
|
-
children: [/* @__PURE__ */
|
|
598
|
-
}), /* @__PURE__ */
|
|
609
|
+
children: [/* @__PURE__ */ F(G, { className: "h-2.5 w-2.5" }), " Add"]
|
|
610
|
+
}), /* @__PURE__ */ I("button", {
|
|
599
611
|
type: "button",
|
|
600
612
|
onClick: () => {
|
|
601
613
|
A();
|
|
602
614
|
},
|
|
603
615
|
disabled: !j,
|
|
604
|
-
className:
|
|
605
|
-
children: [/* @__PURE__ */
|
|
616
|
+
className: O,
|
|
617
|
+
children: [/* @__PURE__ */ F(K, { className: "h-2.5 w-2.5" }), m ? "…" : "Save"]
|
|
606
618
|
})]
|
|
607
619
|
})]
|
|
608
620
|
}),
|
|
609
|
-
|
|
621
|
+
c.length === 0 ? /* @__PURE__ */ F("p", {
|
|
610
622
|
className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight",
|
|
611
|
-
children:
|
|
612
|
-
}) : /* @__PURE__ */
|
|
623
|
+
children: n.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through."
|
|
624
|
+
}) : /* @__PURE__ */ F("div", {
|
|
613
625
|
className: "flex flex-col gap-1.5",
|
|
614
|
-
children:
|
|
626
|
+
children: c.map((e, t) => /* @__PURE__ */ I("div", {
|
|
615
627
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
616
628
|
children: [
|
|
617
|
-
/* @__PURE__ */
|
|
629
|
+
/* @__PURE__ */ I("div", {
|
|
618
630
|
className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5",
|
|
619
631
|
children: [
|
|
620
|
-
/* @__PURE__ */
|
|
632
|
+
/* @__PURE__ */ F("button", {
|
|
621
633
|
type: "button",
|
|
622
634
|
role: "switch",
|
|
623
635
|
"aria-checked": e.enabled,
|
|
624
636
|
"aria-label": e.enabled ? "Disable rule" : "Enable rule",
|
|
625
637
|
title: e.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
|
|
626
|
-
onClick: () =>
|
|
638
|
+
onClick: () => D(t, { enabled: !e.enabled }),
|
|
627
639
|
className: ["inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0", e.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"].join(" "),
|
|
628
|
-
children: /* @__PURE__ */
|
|
640
|
+
children: /* @__PURE__ */ F("span", { className: ["h-3 w-3 rounded-full transition-transform", e.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"].join(" ") })
|
|
629
641
|
}),
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
className: `${
|
|
642
|
+
/* @__PURE__ */ F("input", {
|
|
643
|
+
className: `${T} min-w-0`,
|
|
632
644
|
placeholder: "Rule name (optional)",
|
|
633
645
|
value: e.name,
|
|
634
|
-
onChange: (e) =>
|
|
646
|
+
onChange: (e) => D(t, { name: e.target.value })
|
|
635
647
|
}),
|
|
636
|
-
/* @__PURE__ */
|
|
648
|
+
/* @__PURE__ */ F("button", {
|
|
637
649
|
type: "button",
|
|
638
650
|
title: "Remove rule",
|
|
639
651
|
"aria-label": "Remove rule",
|
|
640
|
-
onClick: () =>
|
|
652
|
+
onClick: () => E(t),
|
|
641
653
|
className: "flex items-center justify-center h-6 w-6 rounded text-foreground-subtle hover:text-danger hover:bg-danger/10 transition-colors flex-shrink-0",
|
|
642
|
-
children: /* @__PURE__ */
|
|
654
|
+
children: /* @__PURE__ */ F(q, { className: "h-3.5 w-3.5" })
|
|
643
655
|
})
|
|
644
656
|
]
|
|
645
657
|
}),
|
|
646
|
-
/* @__PURE__ */
|
|
658
|
+
/* @__PURE__ */ I("div", {
|
|
647
659
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
648
660
|
children: [
|
|
649
|
-
/* @__PURE__ */
|
|
661
|
+
/* @__PURE__ */ F("span", {
|
|
650
662
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
651
663
|
children: "Mode"
|
|
652
664
|
}),
|
|
653
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ F("button", {
|
|
654
666
|
type: "button",
|
|
655
|
-
onClick: () =>
|
|
656
|
-
className: `${
|
|
667
|
+
onClick: () => D(t, { mode: "include" }),
|
|
668
|
+
className: `${y} ${e.mode === "include" ? b : p}`,
|
|
657
669
|
children: "Include"
|
|
658
670
|
}),
|
|
659
|
-
/* @__PURE__ */
|
|
671
|
+
/* @__PURE__ */ F("button", {
|
|
660
672
|
type: "button",
|
|
661
|
-
onClick: () =>
|
|
662
|
-
className: `${
|
|
673
|
+
onClick: () => D(t, { mode: "exclude" }),
|
|
674
|
+
className: `${y} ${e.mode === "exclude" ? b : p}`,
|
|
663
675
|
children: "Exclude"
|
|
664
676
|
})
|
|
665
677
|
]
|
|
666
678
|
}),
|
|
667
|
-
/* @__PURE__ */
|
|
679
|
+
/* @__PURE__ */ I("div", {
|
|
668
680
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
669
|
-
children: [/* @__PURE__ */
|
|
681
|
+
children: [/* @__PURE__ */ F("span", {
|
|
670
682
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
671
683
|
children: "Zones"
|
|
672
|
-
}),
|
|
684
|
+
}), n.length === 0 ? /* @__PURE__ */ F("span", {
|
|
673
685
|
className: "text-[10px] text-foreground-subtle italic",
|
|
674
686
|
children: "none"
|
|
675
|
-
}) :
|
|
687
|
+
}) : n.map((n) => /* @__PURE__ */ I("button", {
|
|
676
688
|
type: "button",
|
|
677
|
-
onClick: () =>
|
|
678
|
-
className: `${
|
|
679
|
-
children: [/* @__PURE__ */
|
|
689
|
+
onClick: () => w(t, n.id),
|
|
690
|
+
className: `${y} ${e.zoneIds.includes(n.id) ? b : p}`,
|
|
691
|
+
children: [/* @__PURE__ */ F("span", {
|
|
680
692
|
className: "h-2 w-2 rounded-sm",
|
|
681
693
|
style: { backgroundColor: n.color || "#3b82f6" }
|
|
682
|
-
}), /* @__PURE__ */
|
|
694
|
+
}), /* @__PURE__ */ F("span", {
|
|
683
695
|
className: "truncate max-w-[7rem]",
|
|
684
696
|
children: n.name || n.id
|
|
685
697
|
})]
|
|
686
698
|
}, n.id))]
|
|
687
699
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
700
|
+
/* @__PURE__ */ I("div", {
|
|
689
701
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
690
702
|
children: [
|
|
691
|
-
/* @__PURE__ */
|
|
703
|
+
/* @__PURE__ */ F("span", {
|
|
692
704
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
693
705
|
children: "Class"
|
|
694
706
|
}),
|
|
695
|
-
|
|
707
|
+
ve.map((n) => /* @__PURE__ */ F("button", {
|
|
696
708
|
type: "button",
|
|
697
|
-
onClick: () =>
|
|
698
|
-
className: `${
|
|
709
|
+
onClick: () => S(t, n.id),
|
|
710
|
+
className: `${y} ${e.classFilter.includes(n.id) ? b : p}`,
|
|
699
711
|
children: n.label
|
|
700
712
|
}, n.id)),
|
|
701
|
-
e.classFilter.length === 0 && /* @__PURE__ */
|
|
713
|
+
e.classFilter.length === 0 && /* @__PURE__ */ F("span", {
|
|
702
714
|
className: "text-[10px] text-foreground-subtle italic ml-1",
|
|
703
715
|
children: "any"
|
|
704
716
|
})
|
|
@@ -707,16 +719,16 @@ function X({ dev: e, stage: n, zones: r, title: i }) {
|
|
|
707
719
|
]
|
|
708
720
|
}, e.id))
|
|
709
721
|
}),
|
|
710
|
-
|
|
722
|
+
_ && /* @__PURE__ */ F("p", {
|
|
711
723
|
className: "mt-2 text-[10px] text-danger",
|
|
712
|
-
children:
|
|
724
|
+
children: _
|
|
713
725
|
})
|
|
714
726
|
]
|
|
715
727
|
});
|
|
716
728
|
}
|
|
717
729
|
//#endregion
|
|
718
730
|
//#region src/widgets/zone-editor/types.ts
|
|
719
|
-
function
|
|
731
|
+
function xe(e) {
|
|
720
732
|
let t = e.kind === "tripwire" ? {
|
|
721
733
|
kind: "line",
|
|
722
734
|
points: e.points
|
|
@@ -731,15 +743,15 @@ function be(e) {
|
|
|
731
743
|
shape: t
|
|
732
744
|
};
|
|
733
745
|
}
|
|
734
|
-
function
|
|
746
|
+
function Se(e) {
|
|
735
747
|
return e === "line" ? "tripwire" : "polygon";
|
|
736
748
|
}
|
|
737
|
-
function
|
|
749
|
+
function Ce(e) {
|
|
738
750
|
return e === "tripwire" ? "line" : "polygon";
|
|
739
751
|
}
|
|
740
752
|
//#endregion
|
|
741
753
|
//#region src/widgets/zone-editor/ZoneOverlay.tsx
|
|
742
|
-
var
|
|
754
|
+
var we = "#3b82f6", Te = ["polygon", "line"], Z = [
|
|
743
755
|
"#3b82f6",
|
|
744
756
|
"#10b981",
|
|
745
757
|
"#f59e0b",
|
|
@@ -751,17 +763,17 @@ var Ce = "#3b82f6", we = ["polygon", "line"], Z = [
|
|
|
751
763
|
"#8b5cf6",
|
|
752
764
|
"#14b8a6"
|
|
753
765
|
];
|
|
754
|
-
function
|
|
766
|
+
function Ee(e) {
|
|
755
767
|
let t = new Set(e.map((e) => (e.color ?? "").toLowerCase()));
|
|
756
768
|
for (let e of Z) if (!t.has(e.toLowerCase())) return e;
|
|
757
769
|
return Z[e.length % Z.length];
|
|
758
770
|
}
|
|
759
|
-
function
|
|
771
|
+
function De(e) {
|
|
760
772
|
return {
|
|
761
773
|
id: e.id,
|
|
762
774
|
name: e.name,
|
|
763
775
|
kind: e.kind,
|
|
764
|
-
color: e.color ||
|
|
776
|
+
color: e.color || we,
|
|
765
777
|
points: [...e.polygon]
|
|
766
778
|
};
|
|
767
779
|
}
|
|
@@ -774,20 +786,20 @@ function Q(e) {
|
|
|
774
786
|
color: e.color
|
|
775
787
|
};
|
|
776
788
|
}
|
|
777
|
-
function
|
|
778
|
-
let t =
|
|
789
|
+
function Oe({ deviceId: e }) {
|
|
790
|
+
let t = P(w().trpcClient, e), n = h(t?.state.zones), r = s(() => n?.zones ?? [], [n]), o = m(), c = o?.drawingKind ?? null, l = o?.selectedZoneId ?? null, u = o?.editingDraft ?? null, d = s(() => r.map((e) => u && u.id === e.id ? {
|
|
779
791
|
id: u.id,
|
|
780
792
|
name: u.name,
|
|
781
793
|
kind: u.kind,
|
|
782
794
|
color: u.color,
|
|
783
795
|
points: [...u.points]
|
|
784
|
-
} :
|
|
796
|
+
} : De(e)), [r, u]), f = s(() => d.map(xe), [d]), p = a(async (e) => {
|
|
785
797
|
if (e.kind !== "polygon" && e.kind !== "line") return;
|
|
786
798
|
let n = {
|
|
787
799
|
id: crypto.randomUUID(),
|
|
788
800
|
name: "",
|
|
789
|
-
kind:
|
|
790
|
-
color:
|
|
801
|
+
kind: Se(e.kind),
|
|
802
|
+
color: Ee(d),
|
|
791
803
|
points: [...e.points]
|
|
792
804
|
};
|
|
793
805
|
try {
|
|
@@ -795,18 +807,18 @@ function De({ deviceId: e }) {
|
|
|
795
807
|
} catch (e) {
|
|
796
808
|
console.error("zones.addZone failed", e);
|
|
797
809
|
}
|
|
798
|
-
|
|
810
|
+
o?.setSelectedZoneId(n.id), o?.setDrawingKind(null);
|
|
799
811
|
}, [
|
|
800
812
|
t,
|
|
801
813
|
d,
|
|
802
|
-
|
|
803
|
-
]), _ =
|
|
814
|
+
o
|
|
815
|
+
]), _ = a(async (e, n) => {
|
|
804
816
|
let r = n.map((e) => ({
|
|
805
817
|
x: e.x,
|
|
806
818
|
y: e.y
|
|
807
819
|
}));
|
|
808
820
|
if (u && u.id === e) {
|
|
809
|
-
|
|
821
|
+
o?.updateDraft({ points: r });
|
|
810
822
|
return;
|
|
811
823
|
}
|
|
812
824
|
let i = d.find((t) => t.id === e);
|
|
@@ -822,55 +834,55 @@ function De({ deviceId: e }) {
|
|
|
822
834
|
t,
|
|
823
835
|
d,
|
|
824
836
|
u,
|
|
825
|
-
|
|
826
|
-
]), v =
|
|
837
|
+
o
|
|
838
|
+
]), v = a((e, t) => {
|
|
827
839
|
typeof e == "string" && (t.kind !== "polygon" && t.kind !== "line" || _(e, t.points));
|
|
828
|
-
}, [_]), y =
|
|
840
|
+
}, [_]), y = a((e) => {
|
|
829
841
|
if (e === null) {
|
|
830
|
-
|
|
842
|
+
o?.discardDraft(), o?.setSelectedZoneId(null);
|
|
831
843
|
return;
|
|
832
844
|
}
|
|
833
845
|
if (typeof e != "string") return;
|
|
834
846
|
let t = d.find((t) => t.id === e);
|
|
835
847
|
if (!t) {
|
|
836
|
-
|
|
848
|
+
o?.setSelectedZoneId(e);
|
|
837
849
|
return;
|
|
838
850
|
}
|
|
839
|
-
|
|
851
|
+
o?.enterDraft({
|
|
840
852
|
id: t.id,
|
|
841
853
|
kind: t.kind,
|
|
842
854
|
name: t.name,
|
|
843
855
|
color: t.color,
|
|
844
856
|
points: t.points
|
|
845
857
|
});
|
|
846
|
-
}, [d,
|
|
847
|
-
return d.length === 0 && c === null ? null : /* @__PURE__ */
|
|
858
|
+
}, [d, o]);
|
|
859
|
+
return d.length === 0 && c === null ? null : /* @__PURE__ */ F(i, {
|
|
848
860
|
fallback: null,
|
|
849
|
-
children: /* @__PURE__ */
|
|
861
|
+
children: /* @__PURE__ */ F(g, {
|
|
850
862
|
transparent: !0,
|
|
851
|
-
items:
|
|
852
|
-
supportedShapes:
|
|
863
|
+
items: f,
|
|
864
|
+
supportedShapes: Te,
|
|
853
865
|
selectedId: l,
|
|
854
866
|
onSelect: y,
|
|
855
867
|
onShapeChange: v,
|
|
856
868
|
onDrawComplete: (e) => {
|
|
857
|
-
|
|
869
|
+
p(e);
|
|
858
870
|
},
|
|
859
|
-
drawingKind: c === null ? null :
|
|
871
|
+
drawingKind: c === null ? null : Ce(c)
|
|
860
872
|
})
|
|
861
873
|
});
|
|
862
874
|
}
|
|
863
|
-
var
|
|
864
|
-
function
|
|
875
|
+
var ke = c(Oe), Ae = "#3b82f6";
|
|
876
|
+
function $(e) {
|
|
865
877
|
return {
|
|
866
878
|
id: e.id,
|
|
867
879
|
name: e.name,
|
|
868
880
|
kind: e.kind,
|
|
869
|
-
color: e.color ||
|
|
881
|
+
color: e.color || Ae,
|
|
870
882
|
points: [...e.polygon]
|
|
871
883
|
};
|
|
872
884
|
}
|
|
873
|
-
function
|
|
885
|
+
function je(e) {
|
|
874
886
|
return {
|
|
875
887
|
id: e.id,
|
|
876
888
|
name: e.name,
|
|
@@ -879,31 +891,31 @@ function Ae(e) {
|
|
|
879
891
|
color: e.color
|
|
880
892
|
};
|
|
881
893
|
}
|
|
882
|
-
function
|
|
883
|
-
let t =
|
|
884
|
-
|
|
894
|
+
function Me({ deviceId: e }) {
|
|
895
|
+
let t = P(w().trpcClient, e), n = h(t?.state.zones), r = s(() => n?.zones ?? [], [n]), i = s(() => r.map($), [r]), o = m(), c = o?.drawingKind ?? null, l = o?.selectedZoneId ?? null, u = o?.editingDraft ?? null;
|
|
896
|
+
M(s(() => ({
|
|
885
897
|
id: "zones",
|
|
886
898
|
order: 100,
|
|
887
|
-
node: /* @__PURE__ */
|
|
899
|
+
node: /* @__PURE__ */ F(ke, { deviceId: e })
|
|
888
900
|
}), [e]));
|
|
889
|
-
let d =
|
|
901
|
+
let d = a((e) => {
|
|
890
902
|
if (e === null) {
|
|
891
|
-
|
|
903
|
+
o?.discardDraft(), o?.setSelectedZoneId(null);
|
|
892
904
|
return;
|
|
893
905
|
}
|
|
894
|
-
let t =
|
|
895
|
-
t &&
|
|
906
|
+
let t = i.find((t) => t.id === e);
|
|
907
|
+
t && o?.enterDraft({
|
|
896
908
|
id: t.id,
|
|
897
909
|
kind: t.kind,
|
|
898
910
|
name: t.name,
|
|
899
911
|
color: t.color,
|
|
900
912
|
points: t.points
|
|
901
913
|
});
|
|
902
|
-
}, [
|
|
903
|
-
let e =
|
|
914
|
+
}, [i, o]), f = a(async () => {
|
|
915
|
+
let e = o?.editingDraft;
|
|
904
916
|
if (e) {
|
|
905
917
|
try {
|
|
906
|
-
await t?.zones?.updateZone({ zone:
|
|
918
|
+
await t?.zones?.updateZone({ zone: je({
|
|
907
919
|
id: e.id,
|
|
908
920
|
kind: e.kind,
|
|
909
921
|
name: e.name,
|
|
@@ -913,44 +925,44 @@ function je({ deviceId: e }) {
|
|
|
913
925
|
} catch (e) {
|
|
914
926
|
console.error("zones.updateZone failed", e);
|
|
915
927
|
}
|
|
916
|
-
|
|
928
|
+
o?.discardDraft(), o?.setSelectedZoneId(null);
|
|
917
929
|
}
|
|
918
|
-
}, [t,
|
|
919
|
-
|
|
920
|
-
}, [
|
|
930
|
+
}, [t, o]), p = a(() => {
|
|
931
|
+
o?.discardDraft(), o?.setSelectedZoneId(null);
|
|
932
|
+
}, [o]), g = a(async (e) => {
|
|
921
933
|
try {
|
|
922
934
|
await t?.zones?.removeZone({ zoneId: e });
|
|
923
935
|
} catch (e) {
|
|
924
936
|
console.error("zones.removeZone failed", e);
|
|
925
937
|
}
|
|
926
|
-
|
|
927
|
-
}, [t,
|
|
928
|
-
|
|
929
|
-
}, [
|
|
930
|
-
|
|
931
|
-
}, [
|
|
938
|
+
o?.selectedZoneId === e && o.setSelectedZoneId(null), o?.editingDraft?.id === e && o.discardDraft();
|
|
939
|
+
}, [t, o]), y = a((e) => {
|
|
940
|
+
o?.startDrawing(e);
|
|
941
|
+
}, [o]), b = a(() => {
|
|
942
|
+
o?.setDrawingKind(null);
|
|
943
|
+
}, [o]), x = s(() => !u || !i.find((e) => e.id === u.id) ? null : {
|
|
932
944
|
id: u.id,
|
|
933
945
|
kind: u.kind,
|
|
934
946
|
name: u.name,
|
|
935
947
|
color: u.color,
|
|
936
948
|
points: [...u.points]
|
|
937
|
-
}, [
|
|
938
|
-
return /* @__PURE__ */
|
|
939
|
-
className:
|
|
940
|
-
children: [/* @__PURE__ */
|
|
941
|
-
className:
|
|
942
|
-
children: [/* @__PURE__ */
|
|
943
|
-
className:
|
|
944
|
-
children: /* @__PURE__ */
|
|
949
|
+
}, [i, u]);
|
|
950
|
+
return /* @__PURE__ */ I("div", {
|
|
951
|
+
className: v,
|
|
952
|
+
children: [/* @__PURE__ */ I("div", {
|
|
953
|
+
className: A,
|
|
954
|
+
children: [/* @__PURE__ */ F("div", {
|
|
955
|
+
className: _,
|
|
956
|
+
children: /* @__PURE__ */ I("div", {
|
|
945
957
|
className: "min-w-0",
|
|
946
|
-
children: [/* @__PURE__ */
|
|
947
|
-
className:
|
|
958
|
+
children: [/* @__PURE__ */ F("h2", {
|
|
959
|
+
className: C,
|
|
948
960
|
children: "Detection Zones"
|
|
949
|
-
}), /* @__PURE__ */
|
|
950
|
-
className: `${
|
|
961
|
+
}), /* @__PURE__ */ I("p", {
|
|
962
|
+
className: `${E} mt-0.5 leading-tight`,
|
|
951
963
|
children: [
|
|
952
964
|
"Pick a shape below or use the ",
|
|
953
|
-
/* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ F("strong", {
|
|
954
966
|
className: "text-foreground",
|
|
955
967
|
children: "Zones"
|
|
956
968
|
}),
|
|
@@ -959,50 +971,50 @@ function je({ deviceId: e }) {
|
|
|
959
971
|
]
|
|
960
972
|
})]
|
|
961
973
|
})
|
|
962
|
-
}), /* @__PURE__ */
|
|
963
|
-
className: `${
|
|
964
|
-
children: [/* @__PURE__ */
|
|
965
|
-
zones:
|
|
974
|
+
}), /* @__PURE__ */ I("div", {
|
|
975
|
+
className: `${S} flex flex-col gap-3`,
|
|
976
|
+
children: [/* @__PURE__ */ F(he, {
|
|
977
|
+
zones: i,
|
|
966
978
|
selectedZoneId: l,
|
|
967
979
|
drawingKind: c,
|
|
968
980
|
onSelectZone: d,
|
|
969
|
-
onDeleteZone:
|
|
981
|
+
onDeleteZone: g,
|
|
970
982
|
onStartDraw: y,
|
|
971
|
-
onCancelDraw:
|
|
972
|
-
}),
|
|
973
|
-
zone:
|
|
974
|
-
onSave:
|
|
975
|
-
onDiscard:
|
|
976
|
-
onDelete: () =>
|
|
983
|
+
onCancelDraw: b
|
|
984
|
+
}), x && /* @__PURE__ */ I(L, { children: [/* @__PURE__ */ F("div", { className: "border-t border-border" }), /* @__PURE__ */ F(_e, {
|
|
985
|
+
zone: x,
|
|
986
|
+
onSave: f,
|
|
987
|
+
onDiscard: p,
|
|
988
|
+
onDelete: () => g(x.id)
|
|
977
989
|
})] })]
|
|
978
990
|
})]
|
|
979
|
-
}), /* @__PURE__ */
|
|
980
|
-
className: `grid grid-cols-1 2xl:grid-cols-2 ${
|
|
981
|
-
children: [/* @__PURE__ */
|
|
991
|
+
}), /* @__PURE__ */ I("div", {
|
|
992
|
+
className: `grid grid-cols-1 2xl:grid-cols-2 ${D}`,
|
|
993
|
+
children: [/* @__PURE__ */ F(X, {
|
|
982
994
|
dev: t,
|
|
983
995
|
stage: "motion",
|
|
984
|
-
zones:
|
|
985
|
-
}), /* @__PURE__ */
|
|
996
|
+
zones: r
|
|
997
|
+
}), /* @__PURE__ */ F(X, {
|
|
986
998
|
dev: t,
|
|
987
999
|
stage: "detection",
|
|
988
|
-
zones:
|
|
1000
|
+
zones: r
|
|
989
1001
|
})]
|
|
990
1002
|
})]
|
|
991
1003
|
});
|
|
992
1004
|
}
|
|
993
1005
|
//#endregion
|
|
994
1006
|
//#region src/widgets/ZoneEditor.tsx
|
|
995
|
-
function
|
|
996
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
1007
|
+
function Ne(e) {
|
|
1008
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ F("div", {
|
|
997
1009
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
998
1010
|
children: "ZoneEditor requires a deviceId"
|
|
999
|
-
}) : /* @__PURE__ */
|
|
1011
|
+
}) : /* @__PURE__ */ F(Me, { deviceId: e.deviceId });
|
|
1000
1012
|
}
|
|
1001
1013
|
//#endregion
|
|
1002
1014
|
//#region src/widgets/index.tsx
|
|
1003
|
-
var
|
|
1004
|
-
"pipeline-quick-stats":
|
|
1005
|
-
"zone-editor":
|
|
1015
|
+
var Pe = {
|
|
1016
|
+
"pipeline-quick-stats": ue,
|
|
1017
|
+
"zone-editor": Ne
|
|
1006
1018
|
};
|
|
1007
1019
|
//#endregion
|
|
1008
|
-
export {
|
|
1020
|
+
export { Pe as default };
|