@camstack/addon-pipeline-orchestrator 1.2.117 → 1.2.119
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 +190 -190
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-VEOnuDLU.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-ClbmXd_h.mjs} +3 -3
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CS2JMxKh.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-CCaaMesa.mjs +26 -0
- package/dist/{hostInit-DbCp-P4V.mjs → hostInit-FZNWOo0Q.mjs} +3 -3
- package/dist/index.js +269 -1
- package/dist/index.mjs +269 -1
- 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-BAtz5Ika.mjs +0 -26
- package/dist/_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CJTjPc-H.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 { n as t, r as n, t as r } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-
|
|
2
|
+
import { n as t, r as n, t as r } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-CS2JMxKh.mjs";
|
|
3
3
|
import { a as i, c as a, i as o, n as s, o as c, r as l, s as u, t as d } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.js-a8tvh93M.mjs";
|
|
4
|
-
import { C as f, S as p, _ as m, a as h, b as g, c as _, d as v, f as y, g as b, h as x, i as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as
|
|
5
|
-
import { n as
|
|
4
|
+
import { C as f, S as p, _ as m, a as h, b as g, c as _, d as v, f as y, g as b, h as x, i as S, l as C, m as w, n as T, o as E, p as D, r as O, s as k, t as A, u as j, v as M, w as N, x as ee, y as P } from "./_virtual_mf___mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CCaaMesa.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(), te = (e) => {
|
|
11
11
|
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
12
|
-
},
|
|
12
|
+
}, ne = {
|
|
13
13
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14
14
|
width: 24,
|
|
15
15
|
height: 24,
|
|
@@ -19,31 +19,31 @@ var L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (e) =
|
|
|
19
19
|
strokeWidth: 2,
|
|
20
20
|
strokeLinecap: "round",
|
|
21
21
|
strokeLinejoin: "round"
|
|
22
|
-
},
|
|
22
|
+
}, re = s(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: a, iconNode: o, ...s }, c) => d("svg", {
|
|
23
23
|
ref: c,
|
|
24
|
-
...
|
|
24
|
+
...ne,
|
|
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 && !te(s) && { "aria-hidden": "true" },
|
|
31
31
|
...s
|
|
32
|
-
}, [...o.map(([e, t]) => d(e, t)), ...Array.isArray(a) ? a : [a]])),
|
|
33
|
-
let n = s(({ className: n, ...r }, i) => d(
|
|
32
|
+
}, [...o.map(([e, t]) => d(e, t)), ...Array.isArray(a) ? a : [a]])), H = (e, t) => {
|
|
33
|
+
let n = s(({ className: n, ...r }, i) => d(re, {
|
|
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
|
+
}, ie = 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
|
+
}]]), ae = H("check", [["path", {
|
|
44
44
|
d: "M20 6 9 17l-5-5",
|
|
45
45
|
key: "1gmf2c"
|
|
46
|
-
}]]),
|
|
46
|
+
}]]), oe = H("cpu", [
|
|
47
47
|
["path", {
|
|
48
48
|
d: "M12 20v2",
|
|
49
49
|
key: "1lh1kg"
|
|
@@ -108,7 +108,7 @@ var L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (e) =
|
|
|
108
108
|
rx: "1",
|
|
109
109
|
key: "z9xiuo"
|
|
110
110
|
}]
|
|
111
|
-
]),
|
|
111
|
+
]), se = 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 L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (e) =
|
|
|
116
116
|
cy: "12",
|
|
117
117
|
r: "3",
|
|
118
118
|
key: "1v7zrd"
|
|
119
|
-
}]]), U =
|
|
119
|
+
}]]), U = 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
|
-
}]]), W =
|
|
125
|
+
}]]), W = 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
|
-
}]]), G =
|
|
128
|
+
}]]), G = H("minus", [["path", {
|
|
129
129
|
d: "M5 12h14",
|
|
130
130
|
key: "1ays0h"
|
|
131
|
-
}]]), K =
|
|
131
|
+
}]]), K = 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
|
-
}]]), ce =
|
|
137
|
+
}]]), ce = 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 L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (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 L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (e) =
|
|
|
174
174
|
y2: "17",
|
|
175
175
|
key: "xtxkd"
|
|
176
176
|
}]
|
|
177
|
-
]), le =
|
|
177
|
+
]), le = 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 L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (e) =
|
|
|
184
184
|
height: "12",
|
|
185
185
|
rx: "2",
|
|
186
186
|
key: "158x01"
|
|
187
|
-
}]]), ue =
|
|
187
|
+
}]]), ue = 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 L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (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", {
|
|
@@ -207,24 +207,24 @@ var L = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), R = (e) =
|
|
|
207
207
|
//#endregion
|
|
208
208
|
//#region src/widgets/PipelineQuickStats.tsx
|
|
209
209
|
function de(e) {
|
|
210
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
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(fe, { deviceId: e.deviceId });
|
|
214
214
|
}
|
|
215
215
|
function fe({ deviceId: t }) {
|
|
216
|
-
|
|
216
|
+
N(["pipelineOrchestrator", "getPipelineAssignment"], [
|
|
217
217
|
"pipeline.camera-assigned",
|
|
218
218
|
"pipeline.camera-unassigned",
|
|
219
219
|
"pipeline.camera-updated"
|
|
220
|
-
]),
|
|
221
|
-
let { data: n } =
|
|
220
|
+
]), N(["pipelineRunner", "getCameraMetrics"], ["pipeline.camera-metrics-snapshot"]);
|
|
221
|
+
let { data: n } = A({ deviceId: t }, { staleTime: 3e4 }), i = n?.agentNodeId ?? null, a = typeof i == "string" && i.length > 0 && !i.startsWith("addon:") ? i : void 0, { data: o } = T({
|
|
222
222
|
deviceId: t,
|
|
223
223
|
...a ? { nodeId: a } : {}
|
|
224
224
|
}, {
|
|
225
225
|
staleTime: 2e3,
|
|
226
226
|
retry: !1
|
|
227
|
-
}), s =
|
|
227
|
+
}), s = _(), c = p(s.trpcClient, t), { data: l } = e({
|
|
228
228
|
queryKey: [
|
|
229
229
|
"device",
|
|
230
230
|
t,
|
|
@@ -266,46 +266,46 @@ function fe({ deviceId: t }) {
|
|
|
266
266
|
}),
|
|
267
267
|
staleTime: 3e4,
|
|
268
268
|
retry: !1
|
|
269
|
-
}), h = r(m, "detectionMode"), g = typeof h == "string" ? h : null,
|
|
270
|
-
return /* @__PURE__ */
|
|
269
|
+
}), h = r(m, "detectionMode"), g = typeof h == "string" ? h : null, v = o?.phase ?? null, y = g, b = Number(o?.actualFps ?? 0), x = Number(o?.configuredFps ?? 0), S = Number(o?.avgInferenceTimeMs ?? 0), C = Number(o?.queueDepth ?? 0), w = Number(o?.droppedFrames ?? 0), E = ee(v ?? "watching"), D = l?.length ?? 0, O = u?.level.dbfs ?? null, k = typeof O == "number" ? `${O.toFixed(1)} dBFS` : "—", j = d?.enabled ?? !1, M = d?.activeMode ?? "off", P = j && M !== "off", L = j ? M === "off" ? "Idle" : M === "continuous" ? "Continuous" : M === "onMotion" ? "On motion" : M === "onAudioThreshold" ? "On audio" : M : "Disabled", R = (f?.profiles ?? []).join(", "), z = d ? `${pe(d.storageBytes ?? 0)}${R ? ` · ${R}` : ""}` : void 0;
|
|
270
|
+
return /* @__PURE__ */ I("div", {
|
|
271
271
|
className: "grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3",
|
|
272
272
|
children: [
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
icon:
|
|
273
|
+
/* @__PURE__ */ F(Y, {
|
|
274
|
+
icon: ie,
|
|
275
275
|
label: "Phase",
|
|
276
|
-
value:
|
|
277
|
-
color:
|
|
278
|
-
subtext:
|
|
276
|
+
value: E.label,
|
|
277
|
+
color: E.textColor,
|
|
278
|
+
subtext: y ?? void 0
|
|
279
279
|
}),
|
|
280
|
-
/* @__PURE__ */
|
|
280
|
+
/* @__PURE__ */ F(Y, {
|
|
281
281
|
icon: U,
|
|
282
282
|
label: "Detection FPS",
|
|
283
|
-
value: `${
|
|
284
|
-
subtext:
|
|
283
|
+
value: `${b.toFixed(1)}`,
|
|
284
|
+
subtext: x > 0 ? `target: ${x}` : void 0
|
|
285
285
|
}),
|
|
286
|
-
/* @__PURE__ */
|
|
287
|
-
icon:
|
|
286
|
+
/* @__PURE__ */ F(Y, {
|
|
287
|
+
icon: oe,
|
|
288
288
|
label: "Inference",
|
|
289
|
-
value: `${
|
|
290
|
-
subtext:
|
|
289
|
+
value: `${S.toFixed(1)} ms`,
|
|
290
|
+
subtext: C > 0 ? `queue: ${C}` : void 0
|
|
291
291
|
}),
|
|
292
|
-
/* @__PURE__ */
|
|
293
|
-
icon:
|
|
292
|
+
/* @__PURE__ */ F(Y, {
|
|
293
|
+
icon: se,
|
|
294
294
|
label: "Active Tracks",
|
|
295
|
-
value: String(
|
|
296
|
-
subtext:
|
|
295
|
+
value: String(D),
|
|
296
|
+
subtext: w > 0 ? `dropped: ${w}` : void 0
|
|
297
297
|
}),
|
|
298
|
-
/* @__PURE__ */
|
|
298
|
+
/* @__PURE__ */ F(Y, {
|
|
299
299
|
icon: ue,
|
|
300
300
|
label: "Current dB",
|
|
301
|
-
value:
|
|
301
|
+
value: k
|
|
302
302
|
}),
|
|
303
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ F(Y, {
|
|
304
304
|
icon: le,
|
|
305
305
|
label: "Recording",
|
|
306
|
-
value:
|
|
307
|
-
color:
|
|
308
|
-
subtext:
|
|
306
|
+
value: L,
|
|
307
|
+
color: P ? "text-success" : void 0,
|
|
308
|
+
subtext: z
|
|
309
309
|
})
|
|
310
310
|
]
|
|
311
311
|
});
|
|
@@ -322,23 +322,23 @@ function pe(e) {
|
|
|
322
322
|
return `${n === 0 ? Math.round(r) : r.toFixed(1)} ${t[n]}`;
|
|
323
323
|
}
|
|
324
324
|
function Y({ icon: e, label: t, value: n, subtext: r, color: i }) {
|
|
325
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ I("div", {
|
|
326
326
|
className: "rounded-lg border border-border bg-surface p-3 min-w-0",
|
|
327
327
|
children: [
|
|
328
|
-
/* @__PURE__ */
|
|
328
|
+
/* @__PURE__ */ I("div", {
|
|
329
329
|
className: "flex items-center gap-1.5 mb-1 min-w-0",
|
|
330
|
-
children: [/* @__PURE__ */
|
|
330
|
+
children: [/* @__PURE__ */ F(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }), /* @__PURE__ */ F("span", {
|
|
331
331
|
className: "text-[10px] text-foreground-subtle uppercase tracking-wider truncate",
|
|
332
332
|
title: t,
|
|
333
333
|
children: t
|
|
334
334
|
})]
|
|
335
335
|
}),
|
|
336
|
-
/* @__PURE__ */
|
|
336
|
+
/* @__PURE__ */ F("p", {
|
|
337
337
|
className: `text-lg font-semibold leading-tight truncate ${i ?? "text-foreground"}`,
|
|
338
338
|
title: n,
|
|
339
339
|
children: n
|
|
340
340
|
}),
|
|
341
|
-
r && /* @__PURE__ */
|
|
341
|
+
r && /* @__PURE__ */ F("p", {
|
|
342
342
|
className: "text-[10px] text-foreground-subtle mt-0.5 truncate",
|
|
343
343
|
title: r,
|
|
344
344
|
children: r
|
|
@@ -356,62 +356,62 @@ var me = {
|
|
|
356
356
|
tripwire: "bg-warning/10 text-warning"
|
|
357
357
|
};
|
|
358
358
|
function ge({ zones: e, selectedZoneId: t, drawingKind: n, onSelectZone: r, onDeleteZone: i, onStartDraw: a, onCancelDraw: o }) {
|
|
359
|
-
return /* @__PURE__ */
|
|
359
|
+
return /* @__PURE__ */ I("div", {
|
|
360
360
|
className: "flex flex-col gap-2",
|
|
361
|
-
children: [/* @__PURE__ */
|
|
361
|
+
children: [/* @__PURE__ */ F("div", {
|
|
362
362
|
className: "flex items-center gap-1",
|
|
363
|
-
children: n ? /* @__PURE__ */
|
|
363
|
+
children: n ? /* @__PURE__ */ I("button", {
|
|
364
364
|
type: "button",
|
|
365
365
|
onClick: o,
|
|
366
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",
|
|
367
367
|
title: "Cancel drawing",
|
|
368
|
-
children: [/* @__PURE__ */
|
|
369
|
-
}) : /* @__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", {
|
|
370
370
|
type: "button",
|
|
371
371
|
onClick: () => a("polygon"),
|
|
372
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",
|
|
373
373
|
title: "Add polygon zone",
|
|
374
374
|
"aria-label": "Add polygon zone",
|
|
375
|
-
children: /* @__PURE__ */
|
|
376
|
-
}), /* @__PURE__ */
|
|
375
|
+
children: /* @__PURE__ */ F(W, { className: "h-4 w-4" })
|
|
376
|
+
}), /* @__PURE__ */ F("button", {
|
|
377
377
|
type: "button",
|
|
378
378
|
onClick: () => a("tripwire"),
|
|
379
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",
|
|
380
380
|
title: "Add tripwire",
|
|
381
381
|
"aria-label": "Add tripwire",
|
|
382
|
-
children: /* @__PURE__ */
|
|
382
|
+
children: /* @__PURE__ */ F(G, { className: "h-5 w-5 stroke-[2.5]" })
|
|
383
383
|
})] })
|
|
384
|
-
}), e.length === 0 ? /* @__PURE__ */
|
|
384
|
+
}), e.length === 0 ? /* @__PURE__ */ F("p", {
|
|
385
385
|
className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight",
|
|
386
386
|
children: "No zones yet — pick \"Zone\" or \"Tripwire\" to draw."
|
|
387
|
-
}) : /* @__PURE__ */
|
|
387
|
+
}) : /* @__PURE__ */ F("div", {
|
|
388
388
|
className: "flex flex-col gap-1",
|
|
389
389
|
children: e.map((e) => {
|
|
390
390
|
let n = e.id === t;
|
|
391
|
-
return /* @__PURE__ */
|
|
391
|
+
return /* @__PURE__ */ I("div", {
|
|
392
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(" "),
|
|
393
393
|
onClick: () => r(n ? null : e.id),
|
|
394
394
|
children: [
|
|
395
|
-
/* @__PURE__ */
|
|
395
|
+
/* @__PURE__ */ F("div", {
|
|
396
396
|
className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
|
|
397
397
|
style: { backgroundColor: e.color }
|
|
398
398
|
}),
|
|
399
|
-
/* @__PURE__ */
|
|
399
|
+
/* @__PURE__ */ F("span", {
|
|
400
400
|
className: "flex-1 truncate text-[11px] font-medium text-foreground",
|
|
401
401
|
children: e.name
|
|
402
402
|
}),
|
|
403
|
-
/* @__PURE__ */
|
|
403
|
+
/* @__PURE__ */ F("span", {
|
|
404
404
|
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${he[e.kind]}`,
|
|
405
405
|
children: me[e.kind]
|
|
406
406
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ F("button", {
|
|
408
408
|
type: "button",
|
|
409
409
|
title: "Delete zone",
|
|
410
410
|
className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
|
|
411
411
|
onClick: (t) => {
|
|
412
412
|
t.stopPropagation(), i(e.id);
|
|
413
413
|
},
|
|
414
|
-
children: /* @__PURE__ */
|
|
414
|
+
children: /* @__PURE__ */ F(q, { className: "h-3 w-3" })
|
|
415
415
|
})
|
|
416
416
|
]
|
|
417
417
|
}, e.id);
|
|
@@ -432,23 +432,23 @@ var _e = [
|
|
|
432
432
|
"#ec4899"
|
|
433
433
|
];
|
|
434
434
|
function ve({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
435
|
-
let i =
|
|
436
|
-
return /* @__PURE__ */
|
|
435
|
+
let i = j(), a = (e) => i?.updateDraft({ name: e }), o = (e) => i?.updateDraft({ color: e });
|
|
436
|
+
return /* @__PURE__ */ I("div", {
|
|
437
437
|
className: "flex flex-col gap-2",
|
|
438
438
|
children: [
|
|
439
|
-
/* @__PURE__ */
|
|
439
|
+
/* @__PURE__ */ I("div", {
|
|
440
440
|
className: "flex items-center justify-between",
|
|
441
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
442
442
|
className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider",
|
|
443
443
|
children: "Editing"
|
|
444
|
-
}), /* @__PURE__ */
|
|
444
|
+
}), /* @__PURE__ */ F("span", {
|
|
445
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",
|
|
446
446
|
children: e.kind === "tripwire" ? "Tripwire" : "Polygon"
|
|
447
447
|
})]
|
|
448
448
|
}),
|
|
449
|
-
/* @__PURE__ */
|
|
449
|
+
/* @__PURE__ */ F("input", {
|
|
450
450
|
type: "text",
|
|
451
|
-
className:
|
|
451
|
+
className: k,
|
|
452
452
|
value: e.name,
|
|
453
453
|
autoFocus: !0,
|
|
454
454
|
onChange: (e) => a(e.target.value),
|
|
@@ -457,9 +457,9 @@ function ve({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
457
457
|
},
|
|
458
458
|
placeholder: "Zone name"
|
|
459
459
|
}),
|
|
460
|
-
/* @__PURE__ */
|
|
460
|
+
/* @__PURE__ */ F("div", {
|
|
461
461
|
className: "flex flex-wrap gap-1",
|
|
462
|
-
children: _e.map((t) => /* @__PURE__ */
|
|
462
|
+
children: _e.map((t) => /* @__PURE__ */ F("button", {
|
|
463
463
|
type: "button",
|
|
464
464
|
title: t,
|
|
465
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(" "),
|
|
@@ -467,46 +467,46 @@ function ve({ zone: e, onSave: t, onDiscard: n, onDelete: r }) {
|
|
|
467
467
|
onClick: () => o(t)
|
|
468
468
|
}, t))
|
|
469
469
|
}),
|
|
470
|
-
/* @__PURE__ */
|
|
470
|
+
/* @__PURE__ */ I("div", {
|
|
471
471
|
className: "flex items-center gap-1.5",
|
|
472
|
-
children: [/* @__PURE__ */
|
|
472
|
+
children: [/* @__PURE__ */ F("input", {
|
|
473
473
|
type: "color",
|
|
474
474
|
className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
|
|
475
475
|
value: e.color,
|
|
476
476
|
onChange: (e) => o(e.target.value)
|
|
477
|
-
}), /* @__PURE__ */
|
|
477
|
+
}), /* @__PURE__ */ F("input", {
|
|
478
478
|
type: "text",
|
|
479
|
-
className: `${
|
|
479
|
+
className: `${k} font-mono`,
|
|
480
480
|
value: e.color,
|
|
481
481
|
placeholder: "#000000",
|
|
482
482
|
onChange: (e) => o(e.target.value)
|
|
483
483
|
})]
|
|
484
484
|
}),
|
|
485
|
-
/* @__PURE__ */
|
|
485
|
+
/* @__PURE__ */ I("p", {
|
|
486
486
|
className: "text-[9px] text-foreground-subtle leading-tight",
|
|
487
487
|
children: [e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`, e.points.length > 0 && " · drag handles to reshape"]
|
|
488
488
|
}),
|
|
489
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ I("div", {
|
|
490
490
|
className: "flex items-center gap-1.5",
|
|
491
|
-
children: [/* @__PURE__ */
|
|
491
|
+
children: [/* @__PURE__ */ I("button", {
|
|
492
492
|
type: "button",
|
|
493
493
|
onClick: t,
|
|
494
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",
|
|
495
495
|
title: "Save changes (Enter)",
|
|
496
|
-
children: [/* @__PURE__ */
|
|
497
|
-
}), /* @__PURE__ */
|
|
496
|
+
children: [/* @__PURE__ */ F(ae, { className: "h-3 w-3" }), "Save"]
|
|
497
|
+
}), /* @__PURE__ */ I("button", {
|
|
498
498
|
type: "button",
|
|
499
499
|
onClick: n,
|
|
500
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",
|
|
501
501
|
title: "Discard changes (Esc)",
|
|
502
|
-
children: [/* @__PURE__ */
|
|
502
|
+
children: [/* @__PURE__ */ F(J, { className: "h-3 w-3" }), "Discard"]
|
|
503
503
|
})]
|
|
504
504
|
}),
|
|
505
|
-
/* @__PURE__ */
|
|
505
|
+
/* @__PURE__ */ I("button", {
|
|
506
506
|
type: "button",
|
|
507
507
|
onClick: r,
|
|
508
|
-
className: `${
|
|
509
|
-
children: [/* @__PURE__ */
|
|
508
|
+
className: `${E} w-full`,
|
|
509
|
+
children: [/* @__PURE__ */ F(q, { className: "h-3 w-3" }), "Delete"]
|
|
510
510
|
})
|
|
511
511
|
]
|
|
512
512
|
});
|
|
@@ -554,11 +554,11 @@ function Te(e) {
|
|
|
554
554
|
return e.name && (t.name = e.name), e.classFilter.length > 0 && (t.classFilter = e.classFilter), t;
|
|
555
555
|
}
|
|
556
556
|
function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
557
|
-
let a = f(e?.state.zoneRules), o = c(() => a?.[t] ?? [], [a, t]), [s, l] = u([]), [d, p] = u(!1), [
|
|
557
|
+
let a = f(e?.state.zoneRules), o = c(() => a?.[t] ?? [], [a, t]), [s, l] = u([]), [d, p] = u(!1), [h, _] = u(!1), [v, y] = u(null), b = Se(t);
|
|
558
558
|
i(() => {
|
|
559
559
|
d || l(o.map(we));
|
|
560
560
|
}, [o, d]);
|
|
561
|
-
let
|
|
561
|
+
let x = () => {
|
|
562
562
|
l((e) => [...e, {
|
|
563
563
|
id: crypto.randomUUID(),
|
|
564
564
|
name: "",
|
|
@@ -567,7 +567,7 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
567
567
|
classFilter: [],
|
|
568
568
|
enabled: !0
|
|
569
569
|
}]), p(!0);
|
|
570
|
-
},
|
|
570
|
+
}, w = (e, t) => {
|
|
571
571
|
l((n) => n.map((n, r) => {
|
|
572
572
|
if (r !== e) return n;
|
|
573
573
|
let i = n.classFilter.includes(t) ? n.classFilter.filter((e) => e !== t) : [...n.classFilter, t];
|
|
@@ -576,7 +576,7 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
576
576
|
classFilter: i
|
|
577
577
|
};
|
|
578
578
|
})), p(!0);
|
|
579
|
-
},
|
|
579
|
+
}, T = (e, t) => {
|
|
580
580
|
l((n) => n.map((n, r) => {
|
|
581
581
|
if (r !== e) return n;
|
|
582
582
|
let i = n.zoneIds.includes(t) ? n.zoneIds.filter((e) => e !== t) : [...n.zoneIds, t];
|
|
@@ -585,7 +585,7 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
585
585
|
zoneIds: i
|
|
586
586
|
};
|
|
587
587
|
})), p(!0);
|
|
588
|
-
},
|
|
588
|
+
}, E = (e) => {
|
|
589
589
|
l((t) => t.filter((t, n) => n !== e)), p(!0);
|
|
590
590
|
}, D = (e, t) => {
|
|
591
591
|
l((n) => n.map((n, r) => r === e ? {
|
|
@@ -594,59 +594,59 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
594
594
|
} : n)), p(!0);
|
|
595
595
|
}, O = async () => {
|
|
596
596
|
if (e?.zoneRules) {
|
|
597
|
-
|
|
597
|
+
_(!0), y(null);
|
|
598
598
|
try {
|
|
599
599
|
await e.zoneRules.setRules({
|
|
600
600
|
stage: t,
|
|
601
601
|
rules: s.map(Te)
|
|
602
602
|
}), p(!1);
|
|
603
603
|
} catch (e) {
|
|
604
|
-
|
|
604
|
+
y(e instanceof Error ? e.message : String(e));
|
|
605
605
|
} finally {
|
|
606
|
-
|
|
606
|
+
_(!1);
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
|
-
},
|
|
610
|
-
return /* @__PURE__ */
|
|
609
|
+
}, A = d && !!e?.zoneRules && !h;
|
|
610
|
+
return /* @__PURE__ */ I("div", {
|
|
611
611
|
className: "rounded-md border border-border bg-surface/40 p-2.5",
|
|
612
612
|
children: [
|
|
613
|
-
/* @__PURE__ */
|
|
613
|
+
/* @__PURE__ */ I("div", {
|
|
614
614
|
className: "flex items-center justify-between mb-2 gap-2",
|
|
615
|
-
children: [/* @__PURE__ */
|
|
615
|
+
children: [/* @__PURE__ */ F("h3", {
|
|
616
616
|
className: `${m} truncate`,
|
|
617
617
|
children: r ?? be(t)
|
|
618
|
-
}), /* @__PURE__ */
|
|
618
|
+
}), /* @__PURE__ */ I("div", {
|
|
619
619
|
className: "flex items-center gap-1 flex-shrink-0",
|
|
620
|
-
children: [/* @__PURE__ */
|
|
620
|
+
children: [/* @__PURE__ */ I("button", {
|
|
621
621
|
type: "button",
|
|
622
|
-
onClick:
|
|
622
|
+
onClick: x,
|
|
623
623
|
disabled: n.length === 0 || !e,
|
|
624
|
-
className:
|
|
624
|
+
className: S,
|
|
625
625
|
title: "Add rule",
|
|
626
|
-
children: [/* @__PURE__ */
|
|
627
|
-
}), /* @__PURE__ */
|
|
626
|
+
children: [/* @__PURE__ */ F(K, { className: "h-2.5 w-2.5" }), " Add"]
|
|
627
|
+
}), /* @__PURE__ */ I("button", {
|
|
628
628
|
type: "button",
|
|
629
629
|
onClick: () => {
|
|
630
630
|
O();
|
|
631
631
|
},
|
|
632
|
-
disabled: !
|
|
633
|
-
className:
|
|
634
|
-
children: [/* @__PURE__ */
|
|
632
|
+
disabled: !A,
|
|
633
|
+
className: C,
|
|
634
|
+
children: [/* @__PURE__ */ F(ce, { className: "h-2.5 w-2.5" }), h ? "…" : "Save"]
|
|
635
635
|
})]
|
|
636
636
|
})]
|
|
637
637
|
}),
|
|
638
|
-
s.length === 0 ? /* @__PURE__ */
|
|
638
|
+
s.length === 0 ? /* @__PURE__ */ F("p", {
|
|
639
639
|
className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight",
|
|
640
640
|
children: n.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through."
|
|
641
|
-
}) : /* @__PURE__ */
|
|
641
|
+
}) : /* @__PURE__ */ F("div", {
|
|
642
642
|
className: "flex flex-col gap-1.5",
|
|
643
|
-
children: s.map((e, t) => /* @__PURE__ */
|
|
643
|
+
children: s.map((e, t) => /* @__PURE__ */ I("div", {
|
|
644
644
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
645
645
|
children: [
|
|
646
|
-
/* @__PURE__ */
|
|
646
|
+
/* @__PURE__ */ I("div", {
|
|
647
647
|
className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5",
|
|
648
648
|
children: [
|
|
649
|
-
/* @__PURE__ */
|
|
649
|
+
/* @__PURE__ */ F("button", {
|
|
650
650
|
type: "button",
|
|
651
651
|
role: "switch",
|
|
652
652
|
"aria-checked": e.enabled,
|
|
@@ -654,80 +654,80 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
654
654
|
title: e.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
|
|
655
655
|
onClick: () => D(t, { enabled: !e.enabled }),
|
|
656
656
|
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(" "),
|
|
657
|
-
children: /* @__PURE__ */
|
|
657
|
+
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(" ") })
|
|
658
658
|
}),
|
|
659
|
-
/* @__PURE__ */
|
|
660
|
-
className: `${
|
|
659
|
+
/* @__PURE__ */ F("input", {
|
|
660
|
+
className: `${k} min-w-0`,
|
|
661
661
|
placeholder: "Rule name (optional)",
|
|
662
662
|
value: e.name,
|
|
663
663
|
onChange: (e) => D(t, { name: e.target.value })
|
|
664
664
|
}),
|
|
665
|
-
/* @__PURE__ */
|
|
665
|
+
/* @__PURE__ */ F("button", {
|
|
666
666
|
type: "button",
|
|
667
667
|
title: "Remove rule",
|
|
668
668
|
"aria-label": "Remove rule",
|
|
669
|
-
onClick: () =>
|
|
669
|
+
onClick: () => E(t),
|
|
670
670
|
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",
|
|
671
|
-
children: /* @__PURE__ */
|
|
671
|
+
children: /* @__PURE__ */ F(q, { className: "h-3.5 w-3.5" })
|
|
672
672
|
})
|
|
673
673
|
]
|
|
674
674
|
}),
|
|
675
|
-
/* @__PURE__ */
|
|
675
|
+
/* @__PURE__ */ I("div", {
|
|
676
676
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
677
677
|
children: [
|
|
678
|
-
/* @__PURE__ */
|
|
678
|
+
/* @__PURE__ */ F("span", {
|
|
679
679
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
680
680
|
children: "Mode"
|
|
681
681
|
}),
|
|
682
|
-
/* @__PURE__ */
|
|
682
|
+
/* @__PURE__ */ F("button", {
|
|
683
683
|
type: "button",
|
|
684
684
|
onClick: () => D(t, { mode: "include" }),
|
|
685
|
-
className: `${
|
|
685
|
+
className: `${P} ${e.mode === "include" ? M : g}`,
|
|
686
686
|
children: "Include"
|
|
687
687
|
}),
|
|
688
|
-
/* @__PURE__ */
|
|
688
|
+
/* @__PURE__ */ F("button", {
|
|
689
689
|
type: "button",
|
|
690
690
|
onClick: () => D(t, { mode: "exclude" }),
|
|
691
|
-
className: `${
|
|
691
|
+
className: `${P} ${e.mode === "exclude" ? M : g}`,
|
|
692
692
|
children: "Exclude"
|
|
693
693
|
})
|
|
694
694
|
]
|
|
695
695
|
}),
|
|
696
|
-
/* @__PURE__ */
|
|
696
|
+
/* @__PURE__ */ I("div", {
|
|
697
697
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
698
|
-
children: [/* @__PURE__ */
|
|
698
|
+
children: [/* @__PURE__ */ F("span", {
|
|
699
699
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
700
700
|
children: "Zones"
|
|
701
|
-
}), n.length === 0 ? /* @__PURE__ */
|
|
701
|
+
}), n.length === 0 ? /* @__PURE__ */ F("span", {
|
|
702
702
|
className: "text-[10px] text-foreground-subtle italic",
|
|
703
703
|
children: "none"
|
|
704
|
-
}) : n.map((n) => /* @__PURE__ */
|
|
704
|
+
}) : n.map((n) => /* @__PURE__ */ I("button", {
|
|
705
705
|
type: "button",
|
|
706
|
-
onClick: () =>
|
|
707
|
-
className: `${
|
|
708
|
-
children: [/* @__PURE__ */
|
|
706
|
+
onClick: () => T(t, n.id),
|
|
707
|
+
className: `${P} ${e.zoneIds.includes(n.id) ? M : g}`,
|
|
708
|
+
children: [/* @__PURE__ */ F("span", {
|
|
709
709
|
className: "h-2 w-2 rounded-sm",
|
|
710
710
|
style: { backgroundColor: n.color || "#3b82f6" }
|
|
711
|
-
}), /* @__PURE__ */
|
|
711
|
+
}), /* @__PURE__ */ F("span", {
|
|
712
712
|
className: "truncate max-w-[7rem]",
|
|
713
713
|
children: n.name || n.id
|
|
714
714
|
})]
|
|
715
715
|
}, n.id))]
|
|
716
716
|
}),
|
|
717
|
-
|
|
717
|
+
b && /* @__PURE__ */ I("div", {
|
|
718
718
|
className: "flex items-center gap-1.5 flex-wrap",
|
|
719
719
|
children: [
|
|
720
|
-
/* @__PURE__ */
|
|
720
|
+
/* @__PURE__ */ F("span", {
|
|
721
721
|
className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0",
|
|
722
722
|
children: "Class"
|
|
723
723
|
}),
|
|
724
|
-
Ce.map((n) => /* @__PURE__ */
|
|
724
|
+
Ce.map((n) => /* @__PURE__ */ F("button", {
|
|
725
725
|
type: "button",
|
|
726
|
-
onClick: () =>
|
|
727
|
-
className: `${
|
|
726
|
+
onClick: () => w(t, n.id),
|
|
727
|
+
className: `${P} ${e.classFilter.includes(n.id) ? M : g}`,
|
|
728
728
|
children: n.label
|
|
729
729
|
}, n.id)),
|
|
730
|
-
e.classFilter.length === 0 && /* @__PURE__ */
|
|
730
|
+
e.classFilter.length === 0 && /* @__PURE__ */ F("span", {
|
|
731
731
|
className: "text-[10px] text-foreground-subtle italic ml-1",
|
|
732
732
|
children: "any"
|
|
733
733
|
})
|
|
@@ -736,9 +736,9 @@ function X({ dev: e, stage: t, zones: n, title: r }) {
|
|
|
736
736
|
]
|
|
737
737
|
}, e.id))
|
|
738
738
|
}),
|
|
739
|
-
|
|
739
|
+
v && /* @__PURE__ */ F("p", {
|
|
740
740
|
className: "mt-2 text-[10px] text-danger",
|
|
741
|
-
children:
|
|
741
|
+
children: v
|
|
742
742
|
})
|
|
743
743
|
]
|
|
744
744
|
});
|
|
@@ -804,7 +804,7 @@ function $(e) {
|
|
|
804
804
|
};
|
|
805
805
|
}
|
|
806
806
|
function Me({ deviceId: e }) {
|
|
807
|
-
let t = p(
|
|
807
|
+
let t = p(_().trpcClient, e), n = f(t?.state.zones), r = c(() => n?.zones ?? [], [n]), i = j(), s = i?.drawingKind ?? null, l = i?.selectedZoneId ?? null, u = i?.editingDraft ?? null, d = c(() => r.map((e) => u && u.id === e.id ? {
|
|
808
808
|
id: u.id,
|
|
809
809
|
name: u.name,
|
|
810
810
|
kind: u.kind,
|
|
@@ -852,9 +852,9 @@ function Me({ deviceId: e }) {
|
|
|
852
852
|
d,
|
|
853
853
|
u,
|
|
854
854
|
i
|
|
855
|
-
]),
|
|
855
|
+
]), y = o((e, t) => {
|
|
856
856
|
typeof e == "string" && (t.kind !== "polygon" && t.kind !== "line" || g(e, t.points));
|
|
857
|
-
}, [g]),
|
|
857
|
+
}, [g]), b = o((e) => {
|
|
858
858
|
if (e === null) {
|
|
859
859
|
i?.discardDraft(), i?.setSelectedZoneId(null);
|
|
860
860
|
return;
|
|
@@ -873,15 +873,15 @@ function Me({ deviceId: e }) {
|
|
|
873
873
|
points: t.points
|
|
874
874
|
});
|
|
875
875
|
}, [d, i]);
|
|
876
|
-
return d.length === 0 && s === null ? null : /* @__PURE__ */
|
|
876
|
+
return d.length === 0 && s === null ? null : /* @__PURE__ */ F(a, {
|
|
877
877
|
fallback: null,
|
|
878
|
-
children: /* @__PURE__ */
|
|
878
|
+
children: /* @__PURE__ */ F(v, {
|
|
879
879
|
transparent: !0,
|
|
880
880
|
items: m,
|
|
881
881
|
supportedShapes: Z,
|
|
882
882
|
selectedId: l,
|
|
883
|
-
onSelect:
|
|
884
|
-
onShapeChange:
|
|
883
|
+
onSelect: b,
|
|
884
|
+
onShapeChange: y,
|
|
885
885
|
onDrawComplete: (e) => {
|
|
886
886
|
h(e);
|
|
887
887
|
},
|
|
@@ -909,11 +909,11 @@ function Ie(e) {
|
|
|
909
909
|
};
|
|
910
910
|
}
|
|
911
911
|
function Le({ deviceId: e }) {
|
|
912
|
-
let t = p(
|
|
912
|
+
let t = p(_().trpcClient, e), n = f(t?.state.zones), r = c(() => n?.zones ?? [], [n]), i = c(() => r.map(Fe), [r]), a = j(), s = a?.drawingKind ?? null, l = a?.selectedZoneId ?? null, u = a?.editingDraft ?? null;
|
|
913
913
|
O(c(() => ({
|
|
914
914
|
id: "zones",
|
|
915
915
|
order: 100,
|
|
916
|
-
node: /* @__PURE__ */
|
|
916
|
+
node: /* @__PURE__ */ F(Ne, { deviceId: e })
|
|
917
917
|
}), [e]));
|
|
918
918
|
let d = o((e) => {
|
|
919
919
|
if (e === null) {
|
|
@@ -928,7 +928,7 @@ function Le({ deviceId: e }) {
|
|
|
928
928
|
color: t.color,
|
|
929
929
|
points: t.points
|
|
930
930
|
});
|
|
931
|
-
}, [i, a]),
|
|
931
|
+
}, [i, a]), g = o(async () => {
|
|
932
932
|
let e = a?.editingDraft;
|
|
933
933
|
if (e) {
|
|
934
934
|
try {
|
|
@@ -944,16 +944,16 @@ function Le({ deviceId: e }) {
|
|
|
944
944
|
}
|
|
945
945
|
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
946
946
|
}
|
|
947
|
-
}, [t, a]),
|
|
947
|
+
}, [t, a]), v = o(() => {
|
|
948
948
|
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
949
|
-
}, [a]),
|
|
949
|
+
}, [a]), S = o(async (e) => {
|
|
950
950
|
try {
|
|
951
951
|
await t?.zones?.removeZone({ zoneId: e });
|
|
952
952
|
} catch (e) {
|
|
953
953
|
console.error("zones.removeZone failed", e);
|
|
954
954
|
}
|
|
955
955
|
a?.selectedZoneId === e && a.setSelectedZoneId(null), a?.editingDraft?.id === e && a.discardDraft();
|
|
956
|
-
}, [t, a]),
|
|
956
|
+
}, [t, a]), C = o((e) => {
|
|
957
957
|
a?.startDrawing(e);
|
|
958
958
|
}, [a]), T = o(() => {
|
|
959
959
|
a?.setDrawingKind(null);
|
|
@@ -964,22 +964,22 @@ function Le({ deviceId: e }) {
|
|
|
964
964
|
color: u.color,
|
|
965
965
|
points: [...u.points]
|
|
966
966
|
}, [i, u]);
|
|
967
|
-
return /* @__PURE__ */
|
|
967
|
+
return /* @__PURE__ */ I("div", {
|
|
968
968
|
className: x,
|
|
969
|
-
children: [/* @__PURE__ */
|
|
969
|
+
children: [/* @__PURE__ */ I("div", {
|
|
970
970
|
className: D,
|
|
971
|
-
children: [/* @__PURE__ */
|
|
971
|
+
children: [/* @__PURE__ */ F("div", {
|
|
972
972
|
className: w,
|
|
973
|
-
children: /* @__PURE__ */
|
|
973
|
+
children: /* @__PURE__ */ I("div", {
|
|
974
974
|
className: "min-w-0",
|
|
975
|
-
children: [/* @__PURE__ */
|
|
975
|
+
children: [/* @__PURE__ */ F("h2", {
|
|
976
976
|
className: m,
|
|
977
977
|
children: "Detection Zones"
|
|
978
|
-
}), /* @__PURE__ */
|
|
978
|
+
}), /* @__PURE__ */ I("p", {
|
|
979
979
|
className: `${b} mt-0.5 leading-tight`,
|
|
980
980
|
children: [
|
|
981
981
|
"Pick a shape below or use the ",
|
|
982
|
-
/* @__PURE__ */
|
|
982
|
+
/* @__PURE__ */ F("strong", {
|
|
983
983
|
className: "text-foreground",
|
|
984
984
|
children: "Zones"
|
|
985
985
|
}),
|
|
@@ -988,37 +988,37 @@ function Le({ deviceId: e }) {
|
|
|
988
988
|
]
|
|
989
989
|
})]
|
|
990
990
|
})
|
|
991
|
-
}), /* @__PURE__ */
|
|
991
|
+
}), /* @__PURE__ */ I("div", {
|
|
992
992
|
className: `${y} flex flex-col gap-3`,
|
|
993
|
-
children: [/* @__PURE__ */
|
|
993
|
+
children: [/* @__PURE__ */ F(ge, {
|
|
994
994
|
zones: i,
|
|
995
995
|
selectedZoneId: l,
|
|
996
996
|
drawingKind: s,
|
|
997
997
|
onSelectZone: d,
|
|
998
|
-
onDeleteZone:
|
|
999
|
-
onStartDraw:
|
|
998
|
+
onDeleteZone: S,
|
|
999
|
+
onStartDraw: C,
|
|
1000
1000
|
onCancelDraw: T
|
|
1001
|
-
}), E && /* @__PURE__ */
|
|
1001
|
+
}), E && /* @__PURE__ */ I(L, { children: [/* @__PURE__ */ F("div", { className: "border-t border-border" }), /* @__PURE__ */ F(ve, {
|
|
1002
1002
|
zone: E,
|
|
1003
|
-
onSave:
|
|
1004
|
-
onDiscard:
|
|
1005
|
-
onDelete: () =>
|
|
1003
|
+
onSave: g,
|
|
1004
|
+
onDiscard: v,
|
|
1005
|
+
onDelete: () => S(E.id)
|
|
1006
1006
|
})] })]
|
|
1007
1007
|
})]
|
|
1008
|
-
}), /* @__PURE__ */
|
|
1009
|
-
className: `grid grid-cols-1 2xl:grid-cols-2 ${
|
|
1008
|
+
}), /* @__PURE__ */ I("div", {
|
|
1009
|
+
className: `grid grid-cols-1 2xl:grid-cols-2 ${h}`,
|
|
1010
1010
|
children: [
|
|
1011
|
-
/* @__PURE__ */
|
|
1011
|
+
/* @__PURE__ */ F(X, {
|
|
1012
1012
|
dev: t,
|
|
1013
1013
|
stage: "motion",
|
|
1014
1014
|
zones: r
|
|
1015
1015
|
}),
|
|
1016
|
-
/* @__PURE__ */
|
|
1016
|
+
/* @__PURE__ */ F(X, {
|
|
1017
1017
|
dev: t,
|
|
1018
1018
|
stage: "detection",
|
|
1019
1019
|
zones: r
|
|
1020
1020
|
}),
|
|
1021
|
-
/* @__PURE__ */
|
|
1021
|
+
/* @__PURE__ */ F(X, {
|
|
1022
1022
|
dev: t,
|
|
1023
1023
|
stage: "package",
|
|
1024
1024
|
zones: r
|
|
@@ -1030,10 +1030,10 @@ function Le({ deviceId: e }) {
|
|
|
1030
1030
|
//#endregion
|
|
1031
1031
|
//#region src/widgets/ZoneEditor.tsx
|
|
1032
1032
|
function Re(e) {
|
|
1033
|
-
return e.deviceId === void 0 ? /* @__PURE__ */
|
|
1033
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ F("div", {
|
|
1034
1034
|
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
1035
1035
|
children: "ZoneEditor requires a deviceId"
|
|
1036
|
-
}) : /* @__PURE__ */
|
|
1036
|
+
}) : /* @__PURE__ */ F(Le, { deviceId: e.deviceId });
|
|
1037
1037
|
}
|
|
1038
1038
|
//#endregion
|
|
1039
1039
|
//#region src/widgets/index.tsx
|