@camstack/addon-pipeline-orchestrator 0.1.21 → 0.1.23
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/@mf-types/compiled-types/widgets/index.d.ts +0 -2
- package/dist/@mf-types/compiled-types/widgets/index.d.ts.map +1 -1
- package/dist/@mf-types.zip +0 -0
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C4HmLg0z.mjs +20 -0
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-DEuqbomC.mjs +34 -0
- package/dist/_stub.js +568 -771
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-GASHflbS.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-xWchXz0h.mjs} +6 -6
- package/dist/{hostInit-s8NZVmrk.mjs → hostInit-Nvn9J-YF.mjs} +6 -6
- package/dist/{index-BP1Nti7b.mjs → index-BCEx31Mh.mjs} +3767 -3350
- package/dist/{index-BIlr4dIX.mjs → index-BmY66bNn.mjs} +1 -1
- package/dist/{index-CMke0KpS.mjs → index-BuYTzV_S.mjs} +6594 -6053
- package/dist/index.js +325 -91
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -91
- package/dist/index.mjs.map +1 -1
- package/dist/remoteEntry.js +1 -1
- package/package.json +3 -3
- package/dist/@mf-types/compiled-types/widgets/MotionZonesEditor.d.ts +0 -19
- package/dist/@mf-types/compiled-types/widgets/MotionZonesEditor.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/motion-zones/MotionGridCanvas.d.ts +0 -10
- package/dist/@mf-types/compiled-types/widgets/motion-zones/MotionGridCanvas.d.ts.map +0 -1
- package/dist/@mf-types/compiled-types/widgets/motion-zones/MotionZonesTab.d.ts +0 -5
- package/dist/@mf-types/compiled-types/widgets/motion-zones/MotionZonesTab.d.ts.map +0 -1
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-UNj4rttw.mjs +0 -20
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-DPoup41Y.mjs +0 -34
package/dist/_stub.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { _ as t, a as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { _ as
|
|
4
|
-
import { a as
|
|
5
|
-
import { _ as
|
|
6
|
-
import { _ as
|
|
1
|
+
import { _ as t, a as c, b as De } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs";
|
|
2
|
+
import { _ as Te } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs";
|
|
3
|
+
import { _ as xe, a as Oe, b as je, c as fe, d as he, e as We, f as me, g as ue, h as Be, i as ge, j as Me, k as qe, l as Ue, m as ee, n as te, o as ne, p as He, q as Ve, r as Ge, s as Ye, t as ze, u as Xe, v as Ke } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-DEuqbomC.mjs";
|
|
4
|
+
import { a as Ie, b as pe, c as G, d as H, e as X, f as Se, g as se, h as T } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-0qpbQxoV.mjs";
|
|
5
|
+
import { _ as Qe } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C4HmLg0z.mjs";
|
|
6
|
+
import { _ as V, a as Je, b as ae, c as ie, d as et, e as tt, f as le } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_konva__loadShare__.mjs-DSZIXeAx.mjs";
|
|
7
7
|
/**
|
|
8
8
|
* @license lucide-react v0.511.0 - ISC
|
|
9
9
|
*
|
|
10
10
|
* This source code is licensed under the ISC license.
|
|
11
11
|
* See the LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
-
const
|
|
13
|
+
const nt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), rt = (e) => e.replace(
|
|
14
14
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
15
|
-
(
|
|
16
|
-
),
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
for (const
|
|
21
|
-
if (
|
|
15
|
+
(i, r, u) => u ? u.toUpperCase() : r.toLowerCase()
|
|
16
|
+
), _e = (e) => {
|
|
17
|
+
const i = rt(e);
|
|
18
|
+
return i.charAt(0).toUpperCase() + i.slice(1);
|
|
19
|
+
}, $e = (...e) => e.filter((i, r, u) => !!i && i.trim() !== "" && u.indexOf(i) === r).join(" ").trim(), ot = (e) => {
|
|
20
|
+
for (const i in e)
|
|
21
|
+
if (i.startsWith("aria-") || i === "role" || i === "title")
|
|
22
22
|
return !0;
|
|
23
23
|
};
|
|
24
24
|
/**
|
|
@@ -27,7 +27,7 @@ const rt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ot = (
|
|
|
27
27
|
* This source code is licensed under the ISC license.
|
|
28
28
|
* See the LICENSE file in the root directory of this source tree.
|
|
29
29
|
*/
|
|
30
|
-
var
|
|
30
|
+
var st = {
|
|
31
31
|
xmlns: "http://www.w3.org/2000/svg",
|
|
32
32
|
width: 24,
|
|
33
33
|
height: 24,
|
|
@@ -44,32 +44,32 @@ var it = {
|
|
|
44
44
|
* This source code is licensed under the ISC license.
|
|
45
45
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
46
|
*/
|
|
47
|
-
const at =
|
|
47
|
+
const at = Ie(
|
|
48
48
|
({
|
|
49
49
|
color: e = "currentColor",
|
|
50
|
-
size:
|
|
50
|
+
size: i = 24,
|
|
51
51
|
strokeWidth: r = 2,
|
|
52
|
-
absoluteStrokeWidth:
|
|
53
|
-
className:
|
|
54
|
-
children:
|
|
55
|
-
iconNode:
|
|
56
|
-
...
|
|
57
|
-
},
|
|
52
|
+
absoluteStrokeWidth: u,
|
|
53
|
+
className: f = "",
|
|
54
|
+
children: s,
|
|
55
|
+
iconNode: l,
|
|
56
|
+
...a
|
|
57
|
+
}, g) => pe(
|
|
58
58
|
"svg",
|
|
59
59
|
{
|
|
60
|
-
ref:
|
|
61
|
-
...
|
|
62
|
-
width:
|
|
63
|
-
height:
|
|
60
|
+
ref: g,
|
|
61
|
+
...st,
|
|
62
|
+
width: i,
|
|
63
|
+
height: i,
|
|
64
64
|
stroke: e,
|
|
65
|
-
strokeWidth:
|
|
66
|
-
className:
|
|
67
|
-
...!
|
|
68
|
-
...
|
|
65
|
+
strokeWidth: u ? Number(r) * 24 / Number(i) : r,
|
|
66
|
+
className: $e("lucide", f),
|
|
67
|
+
...!s && !ot(a) && { "aria-hidden": "true" },
|
|
68
|
+
...a
|
|
69
69
|
},
|
|
70
70
|
[
|
|
71
|
-
...
|
|
72
|
-
...Array.isArray(
|
|
71
|
+
...l.map(([n, F]) => pe(n, F)),
|
|
72
|
+
...Array.isArray(s) ? s : [s]
|
|
73
73
|
]
|
|
74
74
|
)
|
|
75
75
|
);
|
|
@@ -79,20 +79,20 @@ const at = $e(
|
|
|
79
79
|
* This source code is licensed under the ISC license.
|
|
80
80
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
81
|
*/
|
|
82
|
-
const
|
|
83
|
-
const r =
|
|
84
|
-
({ className:
|
|
85
|
-
ref:
|
|
86
|
-
iconNode:
|
|
87
|
-
className:
|
|
88
|
-
`lucide-${
|
|
82
|
+
const O = (e, i) => {
|
|
83
|
+
const r = Ie(
|
|
84
|
+
({ className: u, ...f }, s) => pe(at, {
|
|
85
|
+
ref: s,
|
|
86
|
+
iconNode: i,
|
|
87
|
+
className: $e(
|
|
88
|
+
`lucide-${nt(_e(e))}`,
|
|
89
89
|
`lucide-${e}`,
|
|
90
|
-
|
|
90
|
+
u
|
|
91
91
|
),
|
|
92
|
-
...
|
|
92
|
+
...f
|
|
93
93
|
})
|
|
94
94
|
);
|
|
95
|
-
return r.displayName =
|
|
95
|
+
return r.displayName = _e(e), r;
|
|
96
96
|
};
|
|
97
97
|
/**
|
|
98
98
|
* @license lucide-react v0.511.0 - ISC
|
|
@@ -100,7 +100,7 @@ const j = (e, o) => {
|
|
|
100
100
|
* This source code is licensed under the ISC license.
|
|
101
101
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
102
|
*/
|
|
103
|
-
const
|
|
103
|
+
const it = [
|
|
104
104
|
[
|
|
105
105
|
"path",
|
|
106
106
|
{
|
|
@@ -108,21 +108,21 @@ const lt = [
|
|
|
108
108
|
key: "169zse"
|
|
109
109
|
}
|
|
110
110
|
]
|
|
111
|
-
],
|
|
111
|
+
], lt = O("activity", it);
|
|
112
112
|
/**
|
|
113
113
|
* @license lucide-react v0.511.0 - ISC
|
|
114
114
|
*
|
|
115
115
|
* This source code is licensed under the ISC license.
|
|
116
116
|
* See the LICENSE file in the root directory of this source tree.
|
|
117
117
|
*/
|
|
118
|
-
const
|
|
118
|
+
const ct = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], dt = O("check", ct);
|
|
119
119
|
/**
|
|
120
120
|
* @license lucide-react v0.511.0 - ISC
|
|
121
121
|
*
|
|
122
122
|
* This source code is licensed under the ISC license.
|
|
123
123
|
* See the LICENSE file in the root directory of this source tree.
|
|
124
124
|
*/
|
|
125
|
-
const
|
|
125
|
+
const ut = [
|
|
126
126
|
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
127
127
|
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
128
128
|
["path", { d: "M17 20v2", key: "1rnc9c" }],
|
|
@@ -137,14 +137,14 @@ const ft = [
|
|
|
137
137
|
["path", { d: "M7 2v2", key: "1i4yhu" }],
|
|
138
138
|
["rect", { x: "4", y: "4", width: "16", height: "16", rx: "2", key: "1vbyd7" }],
|
|
139
139
|
["rect", { x: "8", y: "8", width: "8", height: "8", rx: "1", key: "z9xiuo" }]
|
|
140
|
-
], pt =
|
|
140
|
+
], pt = O("cpu", ut);
|
|
141
141
|
/**
|
|
142
142
|
* @license lucide-react v0.511.0 - ISC
|
|
143
143
|
*
|
|
144
144
|
* This source code is licensed under the ISC license.
|
|
145
145
|
* See the LICENSE file in the root directory of this source tree.
|
|
146
146
|
*/
|
|
147
|
-
const
|
|
147
|
+
const ft = [
|
|
148
148
|
[
|
|
149
149
|
"path",
|
|
150
150
|
{
|
|
@@ -153,24 +153,24 @@ const mt = [
|
|
|
153
153
|
}
|
|
154
154
|
],
|
|
155
155
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
156
|
-
], ht =
|
|
156
|
+
], ht = O("eye", ft);
|
|
157
157
|
/**
|
|
158
158
|
* @license lucide-react v0.511.0 - ISC
|
|
159
159
|
*
|
|
160
160
|
* This source code is licensed under the ISC license.
|
|
161
161
|
* See the LICENSE file in the root directory of this source tree.
|
|
162
162
|
*/
|
|
163
|
-
const
|
|
163
|
+
const mt = [
|
|
164
164
|
["path", { d: "m12 14 4-4", key: "9kzdfg" }],
|
|
165
165
|
["path", { d: "M3.34 19a10 10 0 1 1 17.32 0", key: "19p75a" }]
|
|
166
|
-
],
|
|
166
|
+
], gt = O("gauge", mt);
|
|
167
167
|
/**
|
|
168
168
|
* @license lucide-react v0.511.0 - ISC
|
|
169
169
|
*
|
|
170
170
|
* This source code is licensed under the ISC license.
|
|
171
171
|
* See the LICENSE file in the root directory of this source tree.
|
|
172
172
|
*/
|
|
173
|
-
const
|
|
173
|
+
const bt = [
|
|
174
174
|
[
|
|
175
175
|
"path",
|
|
176
176
|
{
|
|
@@ -178,31 +178,31 @@ const yt = [
|
|
|
178
178
|
key: "yt0hxn"
|
|
179
179
|
}
|
|
180
180
|
]
|
|
181
|
-
],
|
|
181
|
+
], yt = O("hexagon", bt);
|
|
182
182
|
/**
|
|
183
183
|
* @license lucide-react v0.511.0 - ISC
|
|
184
184
|
*
|
|
185
185
|
* This source code is licensed under the ISC license.
|
|
186
186
|
* See the LICENSE file in the root directory of this source tree.
|
|
187
187
|
*/
|
|
188
|
-
const
|
|
188
|
+
const xt = [["path", { d: "M5 12h14", key: "1ays0h" }]], _t = O("minus", xt);
|
|
189
189
|
/**
|
|
190
190
|
* @license lucide-react v0.511.0 - ISC
|
|
191
191
|
*
|
|
192
192
|
* This source code is licensed under the ISC license.
|
|
193
193
|
* See the LICENSE file in the root directory of this source tree.
|
|
194
194
|
*/
|
|
195
|
-
const
|
|
195
|
+
const vt = [
|
|
196
196
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
197
197
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
198
|
-
],
|
|
198
|
+
], kt = O("plus", vt);
|
|
199
199
|
/**
|
|
200
200
|
* @license lucide-react v0.511.0 - ISC
|
|
201
201
|
*
|
|
202
202
|
* This source code is licensed under the ISC license.
|
|
203
203
|
* See the LICENSE file in the root directory of this source tree.
|
|
204
204
|
*/
|
|
205
|
-
const
|
|
205
|
+
const wt = [
|
|
206
206
|
[
|
|
207
207
|
"path",
|
|
208
208
|
{
|
|
@@ -212,167 +212,167 @@ const Nt = [
|
|
|
212
212
|
],
|
|
213
213
|
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
214
214
|
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
215
|
-
],
|
|
215
|
+
], Nt = O("save", wt);
|
|
216
216
|
/**
|
|
217
217
|
* @license lucide-react v0.511.0 - ISC
|
|
218
218
|
*
|
|
219
219
|
* This source code is licensed under the ISC license.
|
|
220
220
|
* See the LICENSE file in the root directory of this source tree.
|
|
221
221
|
*/
|
|
222
|
-
const
|
|
222
|
+
const Ct = [
|
|
223
223
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
224
224
|
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
225
225
|
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
226
226
|
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
227
227
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
228
|
-
],
|
|
228
|
+
], be = O("trash-2", Ct);
|
|
229
229
|
/**
|
|
230
230
|
* @license lucide-react v0.511.0 - ISC
|
|
231
231
|
*
|
|
232
232
|
* This source code is licensed under the ISC license.
|
|
233
233
|
* See the LICENSE file in the root directory of this source tree.
|
|
234
234
|
*/
|
|
235
|
-
const
|
|
235
|
+
const Dt = [
|
|
236
236
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
237
237
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
238
|
-
],
|
|
238
|
+
], Ze = O("x", Dt);
|
|
239
239
|
function Mt(e) {
|
|
240
240
|
return e.deviceId === void 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "PipelineQuickStats requires a deviceId" }) : /* @__PURE__ */ t(It, { deviceId: e.deviceId });
|
|
241
241
|
}
|
|
242
242
|
function It({ deviceId: e }) {
|
|
243
|
-
|
|
243
|
+
xe(
|
|
244
244
|
["pipelineOrchestrator", "getPipelineAssignment"],
|
|
245
245
|
["pipeline.camera-assigned", "pipeline.camera-unassigned", "pipeline.camera-updated"]
|
|
246
|
-
),
|
|
246
|
+
), xe(
|
|
247
247
|
["pipelineRunner", "getCameraMetrics"],
|
|
248
248
|
["pipeline.camera-metrics-snapshot"]
|
|
249
249
|
);
|
|
250
|
-
const { data:
|
|
250
|
+
const { data: i } = Oe(
|
|
251
251
|
{ deviceId: e },
|
|
252
252
|
{ staleTime: 3e4 }
|
|
253
|
-
), r =
|
|
253
|
+
), r = i?.agentNodeId ?? null, f = typeof r == "string" && r.length > 0 && !r.startsWith("addon:") ? r : void 0, { data: s } = je(
|
|
254
254
|
{
|
|
255
255
|
deviceId: e,
|
|
256
|
-
...
|
|
256
|
+
...f ? { nodeId: f } : {}
|
|
257
257
|
},
|
|
258
258
|
{ staleTime: 2e3, retry: !1 }
|
|
259
|
-
),
|
|
259
|
+
), l = fe(), a = he(l.trpcClient, e), { data: g } = Te({
|
|
260
260
|
queryKey: ["device", e, "pipelineAnalytics.getActiveTracks"],
|
|
261
|
-
queryFn: () =>
|
|
262
|
-
enabled: !!
|
|
261
|
+
queryFn: () => a?.pipelineAnalytics?.getActiveTracks({}) ?? [],
|
|
262
|
+
enabled: !!a,
|
|
263
263
|
refetchInterval: 5e3,
|
|
264
264
|
retry: !1
|
|
265
|
-
}), n =
|
|
266
|
-
return /* @__PURE__ */ t("div", { className: "@container", style: { containerType: "inline-size" }, children: /* @__PURE__ */
|
|
265
|
+
}), n = s?.phase ?? null, F = s?.detectionMode ?? null, d = Number(s?.actualFps ?? 0), $ = Number(s?.configuredFps ?? 0), b = Number(s?.avgInferenceTimeMs ?? 0), k = Number(s?.queueDepth ?? 0), Z = Number(s?.droppedFrames ?? 0), L = We(n ?? "watching"), S = g?.length ?? 0;
|
|
266
|
+
return /* @__PURE__ */ t("div", { className: "@container", style: { containerType: "inline-size" }, children: /* @__PURE__ */ c("div", { className: "grid grid-cols-1 @[360px]:grid-cols-2 @[720px]:grid-cols-4 gap-3", children: [
|
|
267
267
|
/* @__PURE__ */ t(
|
|
268
|
-
|
|
268
|
+
re,
|
|
269
269
|
{
|
|
270
|
-
icon:
|
|
270
|
+
icon: lt,
|
|
271
271
|
label: "Phase",
|
|
272
|
-
value:
|
|
273
|
-
color:
|
|
274
|
-
subtext:
|
|
272
|
+
value: L.label,
|
|
273
|
+
color: L.textColor,
|
|
274
|
+
subtext: F ?? void 0
|
|
275
275
|
}
|
|
276
276
|
),
|
|
277
277
|
/* @__PURE__ */ t(
|
|
278
|
-
|
|
278
|
+
re,
|
|
279
279
|
{
|
|
280
|
-
icon:
|
|
280
|
+
icon: gt,
|
|
281
281
|
label: "Detection FPS",
|
|
282
282
|
value: `${d.toFixed(1)}`,
|
|
283
|
-
subtext:
|
|
283
|
+
subtext: $ > 0 ? `target: ${$}` : void 0
|
|
284
284
|
}
|
|
285
285
|
),
|
|
286
286
|
/* @__PURE__ */ t(
|
|
287
|
-
|
|
287
|
+
re,
|
|
288
288
|
{
|
|
289
289
|
icon: pt,
|
|
290
290
|
label: "Inference",
|
|
291
291
|
value: `${b.toFixed(1)} ms`,
|
|
292
|
-
subtext:
|
|
292
|
+
subtext: k > 0 ? `queue: ${k}` : void 0
|
|
293
293
|
}
|
|
294
294
|
),
|
|
295
295
|
/* @__PURE__ */ t(
|
|
296
|
-
|
|
296
|
+
re,
|
|
297
297
|
{
|
|
298
298
|
icon: ht,
|
|
299
299
|
label: "Active Tracks",
|
|
300
|
-
value: String(
|
|
301
|
-
subtext:
|
|
300
|
+
value: String(S),
|
|
301
|
+
subtext: Z > 0 ? `dropped: ${Z}` : void 0
|
|
302
302
|
}
|
|
303
303
|
)
|
|
304
304
|
] }) });
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
return /* @__PURE__ */
|
|
308
|
-
/* @__PURE__ */
|
|
306
|
+
function re({ icon: e, label: i, value: r, subtext: u, color: f }) {
|
|
307
|
+
return /* @__PURE__ */ c("div", { className: "rounded-lg border border-border bg-surface p-3 min-w-0", children: [
|
|
308
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1.5 mb-1 min-w-0", children: [
|
|
309
309
|
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }),
|
|
310
310
|
/* @__PURE__ */ t(
|
|
311
311
|
"span",
|
|
312
312
|
{
|
|
313
313
|
className: "text-[10px] text-foreground-subtle uppercase tracking-wider truncate",
|
|
314
|
-
title:
|
|
315
|
-
children:
|
|
314
|
+
title: i,
|
|
315
|
+
children: i
|
|
316
316
|
}
|
|
317
317
|
)
|
|
318
318
|
] }),
|
|
319
319
|
/* @__PURE__ */ t(
|
|
320
320
|
"p",
|
|
321
321
|
{
|
|
322
|
-
className: `text-lg font-semibold leading-tight truncate ${
|
|
322
|
+
className: `text-lg font-semibold leading-tight truncate ${f ?? "text-foreground"}`,
|
|
323
323
|
title: r,
|
|
324
324
|
children: r
|
|
325
325
|
}
|
|
326
326
|
),
|
|
327
|
-
|
|
327
|
+
u && /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle mt-0.5 truncate", title: u, children: u })
|
|
328
328
|
] });
|
|
329
329
|
}
|
|
330
|
-
const
|
|
330
|
+
const St = {
|
|
331
331
|
polygon: "Polygon",
|
|
332
332
|
tripwire: "Tripwire"
|
|
333
333
|
}, $t = {
|
|
334
334
|
polygon: "bg-info/10 text-info",
|
|
335
335
|
tripwire: "bg-warning/10 text-warning"
|
|
336
336
|
};
|
|
337
|
-
function
|
|
337
|
+
function Zt({
|
|
338
338
|
zones: e,
|
|
339
|
-
selectedZoneId:
|
|
339
|
+
selectedZoneId: i,
|
|
340
340
|
drawingKind: r,
|
|
341
|
-
onSelectZone:
|
|
342
|
-
onDeleteZone:
|
|
343
|
-
onStartDraw:
|
|
344
|
-
onCancelDraw:
|
|
341
|
+
onSelectZone: u,
|
|
342
|
+
onDeleteZone: f,
|
|
343
|
+
onStartDraw: s,
|
|
344
|
+
onCancelDraw: l
|
|
345
345
|
}) {
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: r ? /* @__PURE__ */
|
|
346
|
+
return /* @__PURE__ */ c("div", { className: "flex flex-col gap-2", children: [
|
|
347
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: r ? /* @__PURE__ */ c(
|
|
348
348
|
"button",
|
|
349
349
|
{
|
|
350
350
|
type: "button",
|
|
351
|
-
onClick:
|
|
351
|
+
onClick: l,
|
|
352
352
|
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",
|
|
353
353
|
title: "Cancel drawing",
|
|
354
354
|
children: [
|
|
355
|
-
/* @__PURE__ */ t(
|
|
355
|
+
/* @__PURE__ */ t(Ze, { className: "h-3.5 w-3.5" }),
|
|
356
356
|
/* @__PURE__ */ t("span", { children: "Cancel" })
|
|
357
357
|
]
|
|
358
358
|
}
|
|
359
|
-
) : /* @__PURE__ */
|
|
359
|
+
) : /* @__PURE__ */ c(De, { children: [
|
|
360
360
|
/* @__PURE__ */ t(
|
|
361
361
|
"button",
|
|
362
362
|
{
|
|
363
363
|
type: "button",
|
|
364
|
-
onClick: () =>
|
|
364
|
+
onClick: () => s("polygon"),
|
|
365
365
|
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",
|
|
366
366
|
title: "Add polygon zone",
|
|
367
367
|
"aria-label": "Add polygon zone",
|
|
368
|
-
children: /* @__PURE__ */ t(
|
|
368
|
+
children: /* @__PURE__ */ t(yt, { className: "h-4 w-4" })
|
|
369
369
|
}
|
|
370
370
|
),
|
|
371
371
|
/* @__PURE__ */ t(
|
|
372
372
|
"button",
|
|
373
373
|
{
|
|
374
374
|
type: "button",
|
|
375
|
-
onClick: () =>
|
|
375
|
+
onClick: () => s("tripwire"),
|
|
376
376
|
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",
|
|
377
377
|
title: "Add tripwire",
|
|
378
378
|
"aria-label": "Add tripwire",
|
|
@@ -380,30 +380,30 @@ function At({
|
|
|
380
380
|
}
|
|
381
381
|
)
|
|
382
382
|
] }) }),
|
|
383
|
-
e.length === 0 ? /* @__PURE__ */ t("p", { className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight", children: 'No zones yet — pick "Zone" or "Tripwire" to draw.' }) : /* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: e.map((
|
|
384
|
-
const
|
|
385
|
-
return /* @__PURE__ */
|
|
383
|
+
e.length === 0 ? /* @__PURE__ */ t("p", { className: "text-center text-[10px] text-foreground-subtle py-3 leading-tight", children: 'No zones yet — pick "Zone" or "Tripwire" to draw.' }) : /* @__PURE__ */ t("div", { className: "flex flex-col gap-1", children: e.map((a) => {
|
|
384
|
+
const g = a.id === i;
|
|
385
|
+
return /* @__PURE__ */ c(
|
|
386
386
|
"div",
|
|
387
387
|
{
|
|
388
388
|
className: [
|
|
389
389
|
"flex items-center gap-1.5 rounded border px-1.5 py-1 cursor-pointer transition-colors",
|
|
390
|
-
|
|
390
|
+
g ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"
|
|
391
391
|
].join(" "),
|
|
392
|
-
onClick: () =>
|
|
392
|
+
onClick: () => u(g ? null : a.id),
|
|
393
393
|
children: [
|
|
394
394
|
/* @__PURE__ */ t(
|
|
395
395
|
"div",
|
|
396
396
|
{
|
|
397
397
|
className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
|
|
398
|
-
style: { backgroundColor:
|
|
398
|
+
style: { backgroundColor: a.color }
|
|
399
399
|
}
|
|
400
400
|
),
|
|
401
|
-
/* @__PURE__ */ t("span", { className: "flex-1 truncate text-[11px] font-medium text-foreground", children:
|
|
401
|
+
/* @__PURE__ */ t("span", { className: "flex-1 truncate text-[11px] font-medium text-foreground", children: a.name }),
|
|
402
402
|
/* @__PURE__ */ t(
|
|
403
403
|
"span",
|
|
404
404
|
{
|
|
405
|
-
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${$t[
|
|
406
|
-
children:
|
|
405
|
+
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${$t[a.kind]}`,
|
|
406
|
+
children: St[a.kind]
|
|
407
407
|
}
|
|
408
408
|
),
|
|
409
409
|
/* @__PURE__ */ t(
|
|
@@ -413,19 +413,19 @@ function At({
|
|
|
413
413
|
title: "Delete zone",
|
|
414
414
|
className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
|
|
415
415
|
onClick: (n) => {
|
|
416
|
-
n.stopPropagation(),
|
|
416
|
+
n.stopPropagation(), f(a.id);
|
|
417
417
|
},
|
|
418
|
-
children: /* @__PURE__ */ t(
|
|
418
|
+
children: /* @__PURE__ */ t(be, { className: "h-3 w-3" })
|
|
419
419
|
}
|
|
420
420
|
)
|
|
421
421
|
]
|
|
422
422
|
},
|
|
423
|
-
|
|
423
|
+
a.id
|
|
424
424
|
);
|
|
425
425
|
}) })
|
|
426
426
|
] });
|
|
427
427
|
}
|
|
428
|
-
const
|
|
428
|
+
const At = [
|
|
429
429
|
"#3b82f6",
|
|
430
430
|
// blue
|
|
431
431
|
"#10b981",
|
|
@@ -443,10 +443,10 @@ const Pt = [
|
|
|
443
443
|
"#ec4899"
|
|
444
444
|
// pink
|
|
445
445
|
];
|
|
446
|
-
function
|
|
447
|
-
const
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
446
|
+
function Ft({ zone: e, onSave: i, onDiscard: r, onDelete: u }) {
|
|
447
|
+
const f = me(), s = (a) => f?.updateDraft({ name: a }), l = (a) => f?.updateDraft({ color: a });
|
|
448
|
+
return /* @__PURE__ */ c("div", { className: "flex flex-col gap-2", children: [
|
|
449
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
450
450
|
/* @__PURE__ */ t("h3", { className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider", children: "Editing" }),
|
|
451
451
|
/* @__PURE__ */ t("span", { 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", children: e.kind === "tripwire" ? "Tripwire" : "Polygon" })
|
|
452
452
|
] }),
|
|
@@ -454,70 +454,70 @@ function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
|
454
454
|
"input",
|
|
455
455
|
{
|
|
456
456
|
type: "text",
|
|
457
|
-
className:
|
|
457
|
+
className: ue,
|
|
458
458
|
value: e.name,
|
|
459
459
|
autoFocus: !0,
|
|
460
|
-
onChange: (
|
|
461
|
-
onKeyDown: (
|
|
462
|
-
|
|
460
|
+
onChange: (a) => s(a.target.value),
|
|
461
|
+
onKeyDown: (a) => {
|
|
462
|
+
a.key === "Enter" ? (a.preventDefault(), i()) : a.key === "Escape" && (a.preventDefault(), r());
|
|
463
463
|
},
|
|
464
464
|
placeholder: "Zone name"
|
|
465
465
|
}
|
|
466
466
|
),
|
|
467
|
-
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children:
|
|
467
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: At.map((a) => /* @__PURE__ */ t(
|
|
468
468
|
"button",
|
|
469
469
|
{
|
|
470
470
|
type: "button",
|
|
471
|
-
title:
|
|
471
|
+
title: a,
|
|
472
472
|
className: [
|
|
473
473
|
"h-4 w-4 rounded border-2 cursor-pointer transition-transform hover:scale-110",
|
|
474
|
-
e.color ===
|
|
474
|
+
e.color === a ? "border-white scale-110" : "border-transparent"
|
|
475
475
|
].join(" "),
|
|
476
|
-
style: { backgroundColor:
|
|
477
|
-
onClick: () =>
|
|
476
|
+
style: { backgroundColor: a },
|
|
477
|
+
onClick: () => l(a)
|
|
478
478
|
},
|
|
479
|
-
|
|
479
|
+
a
|
|
480
480
|
)) }),
|
|
481
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1.5", children: [
|
|
482
482
|
/* @__PURE__ */ t(
|
|
483
483
|
"input",
|
|
484
484
|
{
|
|
485
485
|
type: "color",
|
|
486
486
|
className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
|
|
487
487
|
value: e.color,
|
|
488
|
-
onChange: (
|
|
488
|
+
onChange: (a) => l(a.target.value)
|
|
489
489
|
}
|
|
490
490
|
),
|
|
491
491
|
/* @__PURE__ */ t(
|
|
492
492
|
"input",
|
|
493
493
|
{
|
|
494
494
|
type: "text",
|
|
495
|
-
className: `${
|
|
495
|
+
className: `${ue} font-mono`,
|
|
496
496
|
value: e.color,
|
|
497
497
|
placeholder: "#000000",
|
|
498
|
-
onChange: (
|
|
498
|
+
onChange: (a) => l(a.target.value)
|
|
499
499
|
}
|
|
500
500
|
)
|
|
501
501
|
] }),
|
|
502
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ c("p", { className: "text-[9px] text-foreground-subtle leading-tight", children: [
|
|
503
503
|
e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`,
|
|
504
504
|
e.points.length > 0 && " · drag handles to reshape"
|
|
505
505
|
] }),
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
506
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1.5", children: [
|
|
507
|
+
/* @__PURE__ */ c(
|
|
508
508
|
"button",
|
|
509
509
|
{
|
|
510
510
|
type: "button",
|
|
511
|
-
onClick:
|
|
511
|
+
onClick: i,
|
|
512
512
|
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",
|
|
513
513
|
title: "Save changes (Enter)",
|
|
514
514
|
children: [
|
|
515
|
-
/* @__PURE__ */ t(
|
|
515
|
+
/* @__PURE__ */ t(dt, { className: "h-3 w-3" }),
|
|
516
516
|
"Save"
|
|
517
517
|
]
|
|
518
518
|
}
|
|
519
519
|
),
|
|
520
|
-
/* @__PURE__ */
|
|
520
|
+
/* @__PURE__ */ c(
|
|
521
521
|
"button",
|
|
522
522
|
{
|
|
523
523
|
type: "button",
|
|
@@ -525,30 +525,30 @@ function Et({ zone: e, onSave: o, onDiscard: r, onDelete: l }) {
|
|
|
525
525
|
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",
|
|
526
526
|
title: "Discard changes (Esc)",
|
|
527
527
|
children: [
|
|
528
|
-
/* @__PURE__ */ t(
|
|
528
|
+
/* @__PURE__ */ t(Ze, { className: "h-3 w-3" }),
|
|
529
529
|
"Discard"
|
|
530
530
|
]
|
|
531
531
|
}
|
|
532
532
|
)
|
|
533
533
|
] }),
|
|
534
|
-
/* @__PURE__ */
|
|
534
|
+
/* @__PURE__ */ c(
|
|
535
535
|
"button",
|
|
536
536
|
{
|
|
537
537
|
type: "button",
|
|
538
|
-
onClick:
|
|
539
|
-
className: `${
|
|
538
|
+
onClick: u,
|
|
539
|
+
className: `${Be} w-full`,
|
|
540
540
|
children: [
|
|
541
|
-
/* @__PURE__ */ t(
|
|
541
|
+
/* @__PURE__ */ t(be, { className: "h-3 w-3" }),
|
|
542
542
|
"Delete"
|
|
543
543
|
]
|
|
544
544
|
}
|
|
545
545
|
)
|
|
546
546
|
] });
|
|
547
547
|
}
|
|
548
|
-
const
|
|
548
|
+
const Lt = Qe.map(
|
|
549
549
|
(e) => ({ id: e.id, label: e.name })
|
|
550
550
|
);
|
|
551
|
-
function
|
|
551
|
+
function Et(e) {
|
|
552
552
|
return {
|
|
553
553
|
id: e.id,
|
|
554
554
|
name: e.name ?? "",
|
|
@@ -558,26 +558,26 @@ function Lt(e) {
|
|
|
558
558
|
enabled: e.enabled !== !1
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
|
-
function
|
|
562
|
-
const
|
|
561
|
+
function Pt(e) {
|
|
562
|
+
const i = {
|
|
563
563
|
id: e.id,
|
|
564
564
|
zoneIds: e.zoneIds,
|
|
565
565
|
mode: e.mode,
|
|
566
566
|
enabled: e.enabled
|
|
567
567
|
};
|
|
568
|
-
return e.name && (
|
|
568
|
+
return e.name && (i.name = e.name), e.classFilter.length > 0 && (i.classFilter = e.classFilter), i;
|
|
569
569
|
}
|
|
570
|
-
function
|
|
571
|
-
const
|
|
572
|
-
() =>
|
|
573
|
-
[
|
|
574
|
-
), [
|
|
570
|
+
function ve({ dev: e, stage: i, zones: r, title: u }) {
|
|
571
|
+
const f = ge(e?.state.zoneRules), s = G(
|
|
572
|
+
() => f?.[i] ?? [],
|
|
573
|
+
[f, i]
|
|
574
|
+
), [l, a] = H([]), [g, n] = H(!1), [F, d] = H(!1), [$, b] = H(null);
|
|
575
575
|
X(() => {
|
|
576
|
-
|
|
577
|
-
}, [
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
...
|
|
576
|
+
g || a(s.map(Et));
|
|
577
|
+
}, [s, g]);
|
|
578
|
+
const k = () => {
|
|
579
|
+
a((m) => [
|
|
580
|
+
...m,
|
|
581
581
|
{
|
|
582
582
|
id: crypto.randomUUID(),
|
|
583
583
|
name: "",
|
|
@@ -587,98 +587,98 @@ function we({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
587
587
|
enabled: !0
|
|
588
588
|
}
|
|
589
589
|
]), n(!0);
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
(
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
return { ...
|
|
590
|
+
}, Z = (m, _) => {
|
|
591
|
+
a(
|
|
592
|
+
(w) => w.map((N, B) => {
|
|
593
|
+
if (B !== m) return N;
|
|
594
|
+
const o = N.classFilter.includes(_) ? N.classFilter.filter((p) => p !== _) : [...N.classFilter, _];
|
|
595
|
+
return { ...N, classFilter: o };
|
|
596
596
|
})
|
|
597
597
|
), n(!0);
|
|
598
|
-
},
|
|
599
|
-
|
|
600
|
-
(
|
|
601
|
-
if (
|
|
602
|
-
const
|
|
603
|
-
return { ...
|
|
598
|
+
}, L = (m, _) => {
|
|
599
|
+
a(
|
|
600
|
+
(w) => w.map((N, B) => {
|
|
601
|
+
if (B !== m) return N;
|
|
602
|
+
const o = N.zoneIds.includes(_) ? N.zoneIds.filter((p) => p !== _) : [...N.zoneIds, _];
|
|
603
|
+
return { ...N, zoneIds: o };
|
|
604
604
|
})
|
|
605
605
|
), n(!0);
|
|
606
|
-
},
|
|
607
|
-
|
|
608
|
-
},
|
|
609
|
-
|
|
610
|
-
},
|
|
606
|
+
}, S = (m) => {
|
|
607
|
+
a((_) => _.filter((w, N) => N !== m)), n(!0);
|
|
608
|
+
}, y = (m, _) => {
|
|
609
|
+
a((w) => w.map((N, B) => B === m ? { ...N, ..._ } : N)), n(!0);
|
|
610
|
+
}, h = async () => {
|
|
611
611
|
if (e?.zoneRules) {
|
|
612
612
|
d(!0), b(null);
|
|
613
613
|
try {
|
|
614
|
-
await e.zoneRules.setRules({ stage:
|
|
615
|
-
} catch (
|
|
616
|
-
b(
|
|
614
|
+
await e.zoneRules.setRules({ stage: i, rules: l.map(Pt) }), n(!1);
|
|
615
|
+
} catch (m) {
|
|
616
|
+
b(m instanceof Error ? m.message : String(m));
|
|
617
617
|
} finally {
|
|
618
618
|
d(!1);
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
|
-
},
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */ t("h3", { className: `${
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
621
|
+
}, Y = g && !!e?.zoneRules && !F;
|
|
622
|
+
return /* @__PURE__ */ c("div", { className: "rounded-md border border-border bg-surface/40 p-2.5", children: [
|
|
623
|
+
/* @__PURE__ */ c("div", { className: "flex items-center justify-between mb-2 gap-2", children: [
|
|
624
|
+
/* @__PURE__ */ t("h3", { className: `${Me} truncate`, children: u ?? `${i === "motion" ? "Motion" : "Detection"} Rules` }),
|
|
625
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
626
|
+
/* @__PURE__ */ c(
|
|
627
627
|
"button",
|
|
628
628
|
{
|
|
629
629
|
type: "button",
|
|
630
|
-
onClick:
|
|
630
|
+
onClick: k,
|
|
631
631
|
disabled: r.length === 0 || !e,
|
|
632
|
-
className:
|
|
632
|
+
className: qe,
|
|
633
633
|
title: "Add rule",
|
|
634
634
|
children: [
|
|
635
|
-
/* @__PURE__ */ t(
|
|
635
|
+
/* @__PURE__ */ t(kt, { className: "h-2.5 w-2.5" }),
|
|
636
636
|
" Add"
|
|
637
637
|
]
|
|
638
638
|
}
|
|
639
639
|
),
|
|
640
|
-
/* @__PURE__ */
|
|
640
|
+
/* @__PURE__ */ c(
|
|
641
641
|
"button",
|
|
642
642
|
{
|
|
643
643
|
type: "button",
|
|
644
644
|
onClick: () => {
|
|
645
|
-
|
|
645
|
+
h();
|
|
646
646
|
},
|
|
647
|
-
disabled: !
|
|
648
|
-
className:
|
|
647
|
+
disabled: !Y,
|
|
648
|
+
className: Ue,
|
|
649
649
|
children: [
|
|
650
|
-
/* @__PURE__ */ t(
|
|
651
|
-
|
|
650
|
+
/* @__PURE__ */ t(Nt, { className: "h-2.5 w-2.5" }),
|
|
651
|
+
F ? "…" : "Save"
|
|
652
652
|
]
|
|
653
653
|
}
|
|
654
654
|
)
|
|
655
655
|
] })
|
|
656
656
|
] }),
|
|
657
|
-
|
|
657
|
+
l.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight", children: r.length === 0 ? "Define a zone first — rules reference zone ids." : "No rules — every detection at this stage passes through." }) : /* @__PURE__ */ t("div", { className: "flex flex-col gap-1.5", children: l.map((m, _) => /* @__PURE__ */ c(
|
|
658
658
|
"div",
|
|
659
659
|
{
|
|
660
660
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
661
661
|
children: [
|
|
662
|
-
/* @__PURE__ */
|
|
662
|
+
/* @__PURE__ */ c("div", { className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5", children: [
|
|
663
663
|
/* @__PURE__ */ t(
|
|
664
664
|
"button",
|
|
665
665
|
{
|
|
666
666
|
type: "button",
|
|
667
667
|
role: "switch",
|
|
668
|
-
"aria-checked":
|
|
669
|
-
"aria-label":
|
|
670
|
-
title:
|
|
671
|
-
onClick: () =>
|
|
668
|
+
"aria-checked": m.enabled,
|
|
669
|
+
"aria-label": m.enabled ? "Disable rule" : "Enable rule",
|
|
670
|
+
title: m.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
|
|
671
|
+
onClick: () => y(_, { enabled: !m.enabled }),
|
|
672
672
|
className: [
|
|
673
673
|
"inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0",
|
|
674
|
-
|
|
674
|
+
m.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"
|
|
675
675
|
].join(" "),
|
|
676
676
|
children: /* @__PURE__ */ t(
|
|
677
677
|
"span",
|
|
678
678
|
{
|
|
679
679
|
className: [
|
|
680
680
|
"h-3 w-3 rounded-full transition-transform",
|
|
681
|
-
|
|
681
|
+
m.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"
|
|
682
682
|
].join(" ")
|
|
683
683
|
}
|
|
684
684
|
)
|
|
@@ -687,10 +687,10 @@ function we({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
687
687
|
/* @__PURE__ */ t(
|
|
688
688
|
"input",
|
|
689
689
|
{
|
|
690
|
-
className: `${
|
|
690
|
+
className: `${ue} min-w-0`,
|
|
691
691
|
placeholder: "Rule name (optional)",
|
|
692
|
-
value:
|
|
693
|
-
onChange: (
|
|
692
|
+
value: m.name,
|
|
693
|
+
onChange: (w) => y(_, { name: w.target.value })
|
|
694
694
|
}
|
|
695
695
|
),
|
|
696
696
|
/* @__PURE__ */ t(
|
|
@@ -699,20 +699,20 @@ function we({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
699
699
|
type: "button",
|
|
700
700
|
title: "Remove rule",
|
|
701
701
|
"aria-label": "Remove rule",
|
|
702
|
-
onClick: () =>
|
|
702
|
+
onClick: () => S(_),
|
|
703
703
|
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",
|
|
704
|
-
children: /* @__PURE__ */ t(
|
|
704
|
+
children: /* @__PURE__ */ t(be, { className: "h-3.5 w-3.5" })
|
|
705
705
|
}
|
|
706
706
|
)
|
|
707
707
|
] }),
|
|
708
|
-
/* @__PURE__ */
|
|
708
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
709
709
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Mode" }),
|
|
710
710
|
/* @__PURE__ */ t(
|
|
711
711
|
"button",
|
|
712
712
|
{
|
|
713
713
|
type: "button",
|
|
714
|
-
onClick: () =>
|
|
715
|
-
className: `${
|
|
714
|
+
onClick: () => y(_, { mode: "include" }),
|
|
715
|
+
className: `${ee} ${m.mode === "include" ? te : ne}`,
|
|
716
716
|
children: "Include"
|
|
717
717
|
}
|
|
718
718
|
),
|
|
@@ -720,299 +720,299 @@ function we({ dev: e, stage: o, zones: r, title: l }) {
|
|
|
720
720
|
"button",
|
|
721
721
|
{
|
|
722
722
|
type: "button",
|
|
723
|
-
onClick: () =>
|
|
724
|
-
className: `${
|
|
723
|
+
onClick: () => y(_, { mode: "exclude" }),
|
|
724
|
+
className: `${ee} ${m.mode === "exclude" ? te : ne}`,
|
|
725
725
|
children: "Exclude"
|
|
726
726
|
}
|
|
727
727
|
)
|
|
728
728
|
] }),
|
|
729
|
-
/* @__PURE__ */
|
|
729
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
730
730
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Zones" }),
|
|
731
|
-
r.length === 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic", children: "none" }) : r.map((
|
|
732
|
-
const
|
|
733
|
-
return /* @__PURE__ */
|
|
731
|
+
r.length === 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic", children: "none" }) : r.map((w) => {
|
|
732
|
+
const N = m.zoneIds.includes(w.id);
|
|
733
|
+
return /* @__PURE__ */ c(
|
|
734
734
|
"button",
|
|
735
735
|
{
|
|
736
736
|
type: "button",
|
|
737
|
-
onClick: () => _
|
|
738
|
-
className: `${
|
|
737
|
+
onClick: () => L(_, w.id),
|
|
738
|
+
className: `${ee} ${N ? te : ne}`,
|
|
739
739
|
children: [
|
|
740
740
|
/* @__PURE__ */ t(
|
|
741
741
|
"span",
|
|
742
742
|
{
|
|
743
743
|
className: "h-2 w-2 rounded-sm",
|
|
744
|
-
style: { backgroundColor:
|
|
744
|
+
style: { backgroundColor: w.color || "#3b82f6" }
|
|
745
745
|
}
|
|
746
746
|
),
|
|
747
|
-
/* @__PURE__ */ t("span", { className: "truncate max-w-[7rem]", children:
|
|
747
|
+
/* @__PURE__ */ t("span", { className: "truncate max-w-[7rem]", children: w.name || w.id })
|
|
748
748
|
]
|
|
749
749
|
},
|
|
750
|
-
|
|
750
|
+
w.id
|
|
751
751
|
);
|
|
752
752
|
})
|
|
753
753
|
] }),
|
|
754
|
-
/* @__PURE__ */
|
|
754
|
+
/* @__PURE__ */ c("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
755
755
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Class" }),
|
|
756
|
-
|
|
757
|
-
const
|
|
756
|
+
Lt.map((w) => {
|
|
757
|
+
const N = m.classFilter.includes(w.id);
|
|
758
758
|
return /* @__PURE__ */ t(
|
|
759
759
|
"button",
|
|
760
760
|
{
|
|
761
761
|
type: "button",
|
|
762
|
-
onClick: () =>
|
|
763
|
-
className: `${
|
|
764
|
-
children:
|
|
762
|
+
onClick: () => Z(_, w.id),
|
|
763
|
+
className: `${ee} ${N ? te : ne}`,
|
|
764
|
+
children: w.label
|
|
765
765
|
},
|
|
766
|
-
|
|
766
|
+
w.id
|
|
767
767
|
);
|
|
768
768
|
}),
|
|
769
|
-
|
|
769
|
+
m.classFilter.length === 0 && /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic ml-1", children: "any" })
|
|
770
770
|
] })
|
|
771
771
|
]
|
|
772
772
|
},
|
|
773
|
-
|
|
773
|
+
m.id
|
|
774
774
|
)) }),
|
|
775
|
-
|
|
775
|
+
$ && /* @__PURE__ */ t("p", { className: "mt-2 text-[10px] text-danger", children: $ })
|
|
776
776
|
] });
|
|
777
777
|
}
|
|
778
|
-
function
|
|
779
|
-
return { x: e.x *
|
|
778
|
+
function z(e, i, r) {
|
|
779
|
+
return { x: e.x * i, y: e.y * r };
|
|
780
780
|
}
|
|
781
|
-
function
|
|
782
|
-
return { x: e.x /
|
|
781
|
+
function ce(e, i, r) {
|
|
782
|
+
return { x: e.x / i, y: e.y / r };
|
|
783
783
|
}
|
|
784
|
-
function
|
|
785
|
-
return e.flatMap((
|
|
784
|
+
function ke(e, i, r) {
|
|
785
|
+
return e.flatMap((u) => [u.x * i, u.y * r]);
|
|
786
786
|
}
|
|
787
|
-
function
|
|
787
|
+
function Rt(e, i) {
|
|
788
788
|
return e.color;
|
|
789
789
|
}
|
|
790
|
-
const
|
|
790
|
+
const Tt = "33", Ot = "66", we = 16, Ne = 9;
|
|
791
791
|
function jt({
|
|
792
792
|
zones: e,
|
|
793
|
-
selectedZoneId:
|
|
793
|
+
selectedZoneId: i,
|
|
794
794
|
onSelectZone: r,
|
|
795
|
-
onZonePointsChange:
|
|
796
|
-
onZoneComplete:
|
|
797
|
-
drawingKind:
|
|
798
|
-
backdrop:
|
|
799
|
-
transparent:
|
|
795
|
+
onZonePointsChange: u,
|
|
796
|
+
onZoneComplete: f,
|
|
797
|
+
drawingKind: s,
|
|
798
|
+
backdrop: l,
|
|
799
|
+
transparent: a = !1
|
|
800
800
|
}) {
|
|
801
|
-
const
|
|
801
|
+
const g = se(null), [n, F] = H({ w: 800, h: 450 }), [d, $] = H([]), [b, k] = H(null), [Z, L] = H(null), [S, y] = H(null);
|
|
802
802
|
X(() => {
|
|
803
|
-
if (!
|
|
804
|
-
const
|
|
805
|
-
if (!
|
|
806
|
-
|
|
803
|
+
if (!S) return;
|
|
804
|
+
const o = e.find((v) => v.id === S.zoneId);
|
|
805
|
+
if (!o) {
|
|
806
|
+
y(null);
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
|
-
if (
|
|
810
|
-
|
|
811
|
-
const
|
|
812
|
-
return Math.abs(
|
|
813
|
-
}) &&
|
|
814
|
-
}, [e,
|
|
815
|
-
const
|
|
816
|
-
if (!
|
|
817
|
-
const
|
|
818
|
-
const
|
|
819
|
-
if (
|
|
820
|
-
const { width:
|
|
821
|
-
|
|
809
|
+
if (o.points.length !== S.points.length) return;
|
|
810
|
+
o.points.every((v, x) => {
|
|
811
|
+
const E = S.points[x];
|
|
812
|
+
return Math.abs(v.x - E.x) < 1e-6 && Math.abs(v.y - E.y) < 1e-6;
|
|
813
|
+
}) && y(null);
|
|
814
|
+
}, [e, S]), X(() => {
|
|
815
|
+
const o = g.current;
|
|
816
|
+
if (!o) return;
|
|
817
|
+
const p = new ResizeObserver((v) => {
|
|
818
|
+
const x = v[0];
|
|
819
|
+
if (x) {
|
|
820
|
+
const { width: E, height: P } = x.contentRect;
|
|
821
|
+
F(a ? { w: E, h: P } : { w: E, h: E * 9 / 16 });
|
|
822
822
|
}
|
|
823
823
|
});
|
|
824
|
-
return
|
|
825
|
-
}, [
|
|
826
|
-
const
|
|
824
|
+
return p.observe(o), () => p.disconnect();
|
|
825
|
+
}, [a]);
|
|
826
|
+
const h = s !== null;
|
|
827
827
|
X(() => {
|
|
828
|
-
!
|
|
829
|
-
}, [
|
|
830
|
-
const
|
|
831
|
-
(
|
|
832
|
-
if (!
|
|
828
|
+
!h && b !== null && k(null);
|
|
829
|
+
}, [h, b]);
|
|
830
|
+
const Y = T(
|
|
831
|
+
(o) => {
|
|
832
|
+
if (!h) {
|
|
833
833
|
r(null);
|
|
834
834
|
return;
|
|
835
835
|
}
|
|
836
|
-
const
|
|
837
|
-
if (!
|
|
838
|
-
const
|
|
839
|
-
if (!
|
|
840
|
-
const
|
|
836
|
+
const p = o.target.getStage();
|
|
837
|
+
if (!p) return;
|
|
838
|
+
const v = p.getPointerPosition();
|
|
839
|
+
if (!v) return;
|
|
840
|
+
const x = ce(v, n.w, n.h), E = s === "tripwire";
|
|
841
841
|
if (d.length === 0) {
|
|
842
|
-
|
|
842
|
+
$([x]);
|
|
843
843
|
return;
|
|
844
844
|
}
|
|
845
|
-
if (
|
|
846
|
-
const
|
|
845
|
+
if (E && d.length === 1) {
|
|
846
|
+
const P = [...d, x], q = {
|
|
847
847
|
id: crypto.randomUUID(),
|
|
848
848
|
name: "Tripwire",
|
|
849
849
|
kind: "tripwire",
|
|
850
850
|
color: "#f59e0b",
|
|
851
|
-
points:
|
|
851
|
+
points: P
|
|
852
852
|
};
|
|
853
|
-
|
|
853
|
+
f(q), $([]);
|
|
854
854
|
return;
|
|
855
855
|
}
|
|
856
|
-
if (d.length >= 3 && !
|
|
857
|
-
const
|
|
858
|
-
if (Math.hypot(
|
|
859
|
-
const
|
|
856
|
+
if (d.length >= 3 && !E) {
|
|
857
|
+
const P = z(d[0], n.w, n.h);
|
|
858
|
+
if (Math.hypot(v.x - P.x, v.y - P.y) < 12) {
|
|
859
|
+
const K = {
|
|
860
860
|
id: crypto.randomUUID(),
|
|
861
861
|
name: "Zone",
|
|
862
862
|
kind: "polygon",
|
|
863
863
|
color: "#3b82f6",
|
|
864
864
|
points: d
|
|
865
865
|
};
|
|
866
|
-
|
|
866
|
+
f(K), $([]);
|
|
867
867
|
return;
|
|
868
868
|
}
|
|
869
869
|
}
|
|
870
|
-
|
|
870
|
+
$((P) => [...P, x]);
|
|
871
871
|
},
|
|
872
|
-
[
|
|
873
|
-
),
|
|
874
|
-
(
|
|
875
|
-
if (!
|
|
876
|
-
|
|
877
|
-
const
|
|
872
|
+
[h, d, n, s, f, r]
|
|
873
|
+
), m = T(
|
|
874
|
+
(o) => {
|
|
875
|
+
if (!h || s === "tripwire" || d.length < 3) return;
|
|
876
|
+
o.cancelBubble = !0;
|
|
877
|
+
const p = {
|
|
878
878
|
id: crypto.randomUUID(),
|
|
879
879
|
name: "Zone",
|
|
880
880
|
kind: "polygon",
|
|
881
881
|
color: "#3b82f6",
|
|
882
882
|
points: d
|
|
883
883
|
};
|
|
884
|
-
p
|
|
884
|
+
f(p), $([]);
|
|
885
885
|
},
|
|
886
|
-
[
|
|
887
|
-
),
|
|
886
|
+
[h, s, d, f]
|
|
887
|
+
), _ = se(null), w = se(null);
|
|
888
888
|
X(() => () => {
|
|
889
|
-
|
|
889
|
+
_.current !== null && cancelAnimationFrame(_.current);
|
|
890
890
|
}, []);
|
|
891
|
-
const
|
|
892
|
-
(
|
|
893
|
-
if (!
|
|
894
|
-
const
|
|
895
|
-
if (!
|
|
896
|
-
const
|
|
897
|
-
|
|
898
|
-
|
|
891
|
+
const N = T(
|
|
892
|
+
(o) => {
|
|
893
|
+
if (!h) return;
|
|
894
|
+
const p = o.target.getStage();
|
|
895
|
+
if (!p) return;
|
|
896
|
+
const v = p.getPointerPosition();
|
|
897
|
+
w.current = v ?? null, _.current === null && (_.current = requestAnimationFrame(() => {
|
|
898
|
+
_.current = null, k(w.current);
|
|
899
899
|
}));
|
|
900
900
|
},
|
|
901
|
-
[
|
|
902
|
-
),
|
|
903
|
-
if (!
|
|
904
|
-
for (let
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
/* @__PURE__ */ t(
|
|
901
|
+
[h]
|
|
902
|
+
), B = [];
|
|
903
|
+
if (!a) {
|
|
904
|
+
for (let o = 1; o < we; o++) {
|
|
905
|
+
const p = n.w / we * o;
|
|
906
|
+
B.push(
|
|
907
|
+
/* @__PURE__ */ t(V, { points: [p, 0, p, n.h], stroke: "#ffffff", strokeWidth: 0.5, opacity: 0.08 }, `gv-${o}`)
|
|
908
908
|
);
|
|
909
909
|
}
|
|
910
|
-
for (let
|
|
911
|
-
const
|
|
912
|
-
|
|
913
|
-
/* @__PURE__ */ t(
|
|
910
|
+
for (let o = 1; o < Ne; o++) {
|
|
911
|
+
const p = n.h / Ne * o;
|
|
912
|
+
B.push(
|
|
913
|
+
/* @__PURE__ */ t(V, { points: [0, p, n.w, p], stroke: "#ffffff", strokeWidth: 0.5, opacity: 0.08 }, `gh-${o}`)
|
|
914
914
|
);
|
|
915
915
|
}
|
|
916
916
|
}
|
|
917
|
-
return /* @__PURE__ */
|
|
917
|
+
return /* @__PURE__ */ c(
|
|
918
918
|
"div",
|
|
919
919
|
{
|
|
920
|
-
ref:
|
|
921
|
-
className:
|
|
922
|
-
style: { cursor:
|
|
920
|
+
ref: g,
|
|
921
|
+
className: a ? "absolute inset-0" : "relative w-full bg-zinc-900 rounded-lg overflow-hidden",
|
|
922
|
+
style: { cursor: h ? "crosshair" : "default" },
|
|
923
923
|
children: [
|
|
924
|
-
|
|
924
|
+
l && !a ? /* @__PURE__ */ t(
|
|
925
925
|
"div",
|
|
926
926
|
{
|
|
927
927
|
className: "absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover",
|
|
928
928
|
style: { width: n.w, height: n.h },
|
|
929
|
-
children:
|
|
929
|
+
children: l
|
|
930
930
|
}
|
|
931
931
|
) : null,
|
|
932
|
-
/* @__PURE__ */
|
|
933
|
-
|
|
932
|
+
/* @__PURE__ */ c(
|
|
933
|
+
Je,
|
|
934
934
|
{
|
|
935
935
|
width: n.w,
|
|
936
936
|
height: n.h,
|
|
937
|
-
onClick:
|
|
938
|
-
onDblClick:
|
|
939
|
-
onMouseMove:
|
|
937
|
+
onClick: Y,
|
|
938
|
+
onDblClick: m,
|
|
939
|
+
onMouseMove: N,
|
|
940
940
|
children: [
|
|
941
|
-
/* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */ t(
|
|
943
|
-
|
|
941
|
+
/* @__PURE__ */ c(ae, { listening: !1, children: [
|
|
942
|
+
/* @__PURE__ */ t(V, { points: [0, 0, n.w, 0, n.w, n.h, 0, n.h, 0, 0], stroke: "transparent", strokeWidth: 0 }),
|
|
943
|
+
B
|
|
944
944
|
] }),
|
|
945
|
-
/* @__PURE__ */ t(
|
|
946
|
-
const
|
|
947
|
-
return /* @__PURE__ */
|
|
948
|
-
|
|
945
|
+
/* @__PURE__ */ t(ae, { children: e.map((o) => {
|
|
946
|
+
const p = o.id === i, v = Rt(o), x = S && S.zoneId === o.id ? S.points : o.points, E = ke(x, n.w, n.h), P = o.kind === "tripwire", q = p && !h, K = Z === o.id, Q = x.map((C) => C.x * n.w), J = x.map((C) => C.y * n.h), Ae = Q.length > 0 ? Math.min(...Q) : 0, Fe = Q.length > 0 ? Math.max(...Q) : 0, Le = J.length > 0 ? Math.min(...J) : 0, Ee = J.length > 0 ? Math.max(...J) : 0;
|
|
947
|
+
return /* @__PURE__ */ c(
|
|
948
|
+
ie,
|
|
949
949
|
{
|
|
950
|
-
onClick: (
|
|
951
|
-
|
|
950
|
+
onClick: (C) => {
|
|
951
|
+
C.cancelBubble = !0, h || r(o.id);
|
|
952
952
|
},
|
|
953
953
|
children: [
|
|
954
|
-
/* @__PURE__ */
|
|
955
|
-
|
|
954
|
+
/* @__PURE__ */ c(
|
|
955
|
+
ie,
|
|
956
956
|
{
|
|
957
|
-
draggable:
|
|
958
|
-
dragBoundFunc:
|
|
959
|
-
x: Math.max(-
|
|
960
|
-
y: Math.max(-
|
|
957
|
+
draggable: q,
|
|
958
|
+
dragBoundFunc: q ? (C) => ({
|
|
959
|
+
x: Math.max(-Ae, Math.min(n.w - Fe, C.x)),
|
|
960
|
+
y: Math.max(-Le, Math.min(n.h - Ee, C.y))
|
|
961
961
|
}) : void 0,
|
|
962
|
-
onDragStart:
|
|
963
|
-
|
|
962
|
+
onDragStart: q ? () => {
|
|
963
|
+
L(o.id);
|
|
964
964
|
} : void 0,
|
|
965
|
-
onDragEnd:
|
|
966
|
-
const
|
|
967
|
-
if (
|
|
968
|
-
const
|
|
969
|
-
|
|
965
|
+
onDragEnd: q ? (C) => {
|
|
966
|
+
const D = C.target, j = D.x() / n.w, U = D.y() / n.h;
|
|
967
|
+
if (D.position({ x: 0, y: 0 }), L(null), j === 0 && U === 0) return;
|
|
968
|
+
const W = o.points.map((I) => ({ x: I.x + j, y: I.y + U }));
|
|
969
|
+
y({ zoneId: o.id, points: W }), u(o.id, W);
|
|
970
970
|
} : void 0,
|
|
971
|
-
onMouseEnter: (
|
|
972
|
-
if (!
|
|
973
|
-
const
|
|
974
|
-
|
|
971
|
+
onMouseEnter: (C) => {
|
|
972
|
+
if (!q) return;
|
|
973
|
+
const D = C.target.getStage();
|
|
974
|
+
D && (D.container().style.cursor = "move");
|
|
975
975
|
},
|
|
976
|
-
onMouseLeave: (
|
|
977
|
-
if (!
|
|
978
|
-
const
|
|
979
|
-
|
|
976
|
+
onMouseLeave: (C) => {
|
|
977
|
+
if (!q) return;
|
|
978
|
+
const D = C.target.getStage();
|
|
979
|
+
D && (D.container().style.cursor = h ? "crosshair" : "default");
|
|
980
980
|
},
|
|
981
981
|
children: [
|
|
982
|
-
|
|
983
|
-
|
|
982
|
+
P ? /* @__PURE__ */ t(
|
|
983
|
+
et,
|
|
984
984
|
{
|
|
985
|
-
points:
|
|
986
|
-
stroke:
|
|
987
|
-
strokeWidth:
|
|
988
|
-
fill:
|
|
985
|
+
points: E,
|
|
986
|
+
stroke: v,
|
|
987
|
+
strokeWidth: p ? 3 : 2,
|
|
988
|
+
fill: v,
|
|
989
989
|
pointerLength: 10,
|
|
990
990
|
pointerWidth: 8,
|
|
991
|
-
opacity:
|
|
991
|
+
opacity: p ? 1 : 0.8
|
|
992
992
|
}
|
|
993
993
|
) : /* @__PURE__ */ t(
|
|
994
|
-
|
|
994
|
+
V,
|
|
995
995
|
{
|
|
996
|
-
points:
|
|
996
|
+
points: E,
|
|
997
997
|
closed: !0,
|
|
998
|
-
fill:
|
|
999
|
-
stroke:
|
|
1000
|
-
strokeWidth:
|
|
1001
|
-
opacity:
|
|
998
|
+
fill: v + (p ? Ot : Tt),
|
|
999
|
+
stroke: v,
|
|
1000
|
+
strokeWidth: p ? 2.5 : 1.5,
|
|
1001
|
+
opacity: p ? 1 : 0.85
|
|
1002
1002
|
}
|
|
1003
1003
|
),
|
|
1004
|
-
|
|
1005
|
-
const
|
|
1004
|
+
x.length > 0 && (() => {
|
|
1005
|
+
const C = x.reduce((A, M) => A + M.x, 0), D = x.reduce((A, M) => A + M.y, 0), j = C / x.length, U = D / x.length, W = z({ x: j, y: U }, n.w, n.h), I = Math.max(40, o.name.length * 11 * 0.62);
|
|
1006
1006
|
return /* @__PURE__ */ t(
|
|
1007
|
-
|
|
1007
|
+
tt,
|
|
1008
1008
|
{
|
|
1009
|
-
x:
|
|
1010
|
-
y:
|
|
1011
|
-
width:
|
|
1009
|
+
x: W.x - I / 2,
|
|
1010
|
+
y: W.y - 7,
|
|
1011
|
+
width: I,
|
|
1012
1012
|
align: "center",
|
|
1013
|
-
text:
|
|
1013
|
+
text: o.name,
|
|
1014
1014
|
fontSize: 12,
|
|
1015
|
-
fill:
|
|
1015
|
+
fill: v,
|
|
1016
1016
|
stroke: "#000000",
|
|
1017
1017
|
strokeWidth: 3,
|
|
1018
1018
|
fillAfterStrokeEnabled: !0,
|
|
@@ -1024,93 +1024,93 @@ function jt({
|
|
|
1024
1024
|
]
|
|
1025
1025
|
}
|
|
1026
1026
|
),
|
|
1027
|
-
|
|
1028
|
-
const
|
|
1027
|
+
p && !K && x.map((C, D) => {
|
|
1028
|
+
const j = z(C, n.w, n.h), U = P ? 2 : 3, W = x.length > U;
|
|
1029
1029
|
return /* @__PURE__ */ t(
|
|
1030
|
-
|
|
1030
|
+
le,
|
|
1031
1031
|
{
|
|
1032
|
-
x:
|
|
1033
|
-
y:
|
|
1032
|
+
x: j.x,
|
|
1033
|
+
y: j.y,
|
|
1034
1034
|
radius: 5,
|
|
1035
|
-
fill:
|
|
1035
|
+
fill: v,
|
|
1036
1036
|
stroke: "#ffffff",
|
|
1037
1037
|
strokeWidth: 1.5,
|
|
1038
1038
|
draggable: !0,
|
|
1039
|
-
onDragMove: (
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
const
|
|
1043
|
-
return { zoneId:
|
|
1039
|
+
onDragMove: (I) => {
|
|
1040
|
+
const A = ce({ x: I.target.x(), y: I.target.y() }, n.w, n.h);
|
|
1041
|
+
y((M) => {
|
|
1042
|
+
const oe = (M && M.zoneId === o.id ? M.points : o.points).map((Pe, Re) => Re === D ? A : Pe);
|
|
1043
|
+
return { zoneId: o.id, points: oe };
|
|
1044
1044
|
});
|
|
1045
1045
|
},
|
|
1046
|
-
onDragEnd: (
|
|
1047
|
-
const
|
|
1048
|
-
|
|
1046
|
+
onDragEnd: (I) => {
|
|
1047
|
+
const A = ce({ x: I.target.x(), y: I.target.y() }, n.w, n.h), M = o.points.map((R, oe) => oe === D ? A : R);
|
|
1048
|
+
y({ zoneId: o.id, points: M }), u(o.id, M);
|
|
1049
1049
|
},
|
|
1050
|
-
onContextMenu: (
|
|
1051
|
-
if (
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1050
|
+
onContextMenu: (I) => {
|
|
1051
|
+
if (I.evt.preventDefault(), I.cancelBubble = !0, !W) return;
|
|
1052
|
+
const A = o.points.filter((M, R) => R !== D);
|
|
1053
|
+
u(o.id, A);
|
|
1054
1054
|
}
|
|
1055
1055
|
},
|
|
1056
|
-
`pt-${
|
|
1056
|
+
`pt-${D}`
|
|
1057
1057
|
);
|
|
1058
1058
|
}),
|
|
1059
|
-
|
|
1060
|
-
const
|
|
1059
|
+
p && !K && !P && x.length >= 2 && x.map((C, D) => {
|
|
1060
|
+
const j = x[(D + 1) % x.length], U = (C.x + j.x) / 2, W = (C.y + j.y) / 2, I = z({ x: U, y: W }, n.w, n.h);
|
|
1061
1061
|
return /* @__PURE__ */ t(
|
|
1062
|
-
|
|
1062
|
+
le,
|
|
1063
1063
|
{
|
|
1064
|
-
x:
|
|
1065
|
-
y:
|
|
1064
|
+
x: I.x,
|
|
1065
|
+
y: I.y,
|
|
1066
1066
|
radius: 4,
|
|
1067
1067
|
fill: "#ffffff",
|
|
1068
|
-
stroke:
|
|
1068
|
+
stroke: v,
|
|
1069
1069
|
strokeWidth: 1.5,
|
|
1070
1070
|
opacity: 0.6,
|
|
1071
|
-
onMouseEnter: (
|
|
1072
|
-
const
|
|
1073
|
-
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1071
|
+
onMouseEnter: (A) => {
|
|
1072
|
+
const M = A.target;
|
|
1073
|
+
M.to({ radius: 6, opacity: 1, duration: 0.1 });
|
|
1074
|
+
const R = M.getStage();
|
|
1075
|
+
R && (R.container().style.cursor = "copy");
|
|
1076
1076
|
},
|
|
1077
|
-
onMouseLeave: (
|
|
1078
|
-
const
|
|
1079
|
-
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1077
|
+
onMouseLeave: (A) => {
|
|
1078
|
+
const M = A.target;
|
|
1079
|
+
M.to({ radius: 4, opacity: 0.6, duration: 0.1 });
|
|
1080
|
+
const R = M.getStage();
|
|
1081
|
+
R && (R.container().style.cursor = h ? "crosshair" : "default");
|
|
1082
1082
|
},
|
|
1083
|
-
onClick: (
|
|
1084
|
-
|
|
1085
|
-
const
|
|
1086
|
-
...
|
|
1087
|
-
{ x:
|
|
1088
|
-
...
|
|
1083
|
+
onClick: (A) => {
|
|
1084
|
+
A.cancelBubble = !0;
|
|
1085
|
+
const M = D + 1, R = [
|
|
1086
|
+
...o.points.slice(0, M),
|
|
1087
|
+
{ x: U, y: W },
|
|
1088
|
+
...o.points.slice(M)
|
|
1089
1089
|
];
|
|
1090
|
-
|
|
1090
|
+
u(o.id, R);
|
|
1091
1091
|
}
|
|
1092
1092
|
},
|
|
1093
|
-
`mid-${
|
|
1093
|
+
`mid-${D}`
|
|
1094
1094
|
);
|
|
1095
1095
|
})
|
|
1096
1096
|
]
|
|
1097
1097
|
},
|
|
1098
|
-
|
|
1098
|
+
o.id
|
|
1099
1099
|
);
|
|
1100
1100
|
}) }),
|
|
1101
|
-
/* @__PURE__ */ t(
|
|
1102
|
-
d.length >= 2 &&
|
|
1103
|
-
|
|
1101
|
+
/* @__PURE__ */ t(ae, { listening: !1, children: h && d.length > 0 && /* @__PURE__ */ c(ie, { children: [
|
|
1102
|
+
d.length >= 2 && s !== "tripwire" && /* @__PURE__ */ t(
|
|
1103
|
+
V,
|
|
1104
1104
|
{
|
|
1105
|
-
points:
|
|
1105
|
+
points: ke(d, n.w, n.h),
|
|
1106
1106
|
stroke: "#6366f1",
|
|
1107
1107
|
strokeWidth: 1.5,
|
|
1108
1108
|
dash: [6, 3],
|
|
1109
1109
|
opacity: 0.8
|
|
1110
1110
|
}
|
|
1111
1111
|
),
|
|
1112
|
-
d.length === 1 &&
|
|
1113
|
-
|
|
1112
|
+
d.length === 1 && s === "tripwire" && b && /* @__PURE__ */ t(
|
|
1113
|
+
V,
|
|
1114
1114
|
{
|
|
1115
1115
|
points: [
|
|
1116
1116
|
d[0].x * n.w,
|
|
@@ -1124,8 +1124,8 @@ function jt({
|
|
|
1124
1124
|
opacity: 0.7
|
|
1125
1125
|
}
|
|
1126
1126
|
),
|
|
1127
|
-
b && d.length >= 1 &&
|
|
1128
|
-
|
|
1127
|
+
b && d.length >= 1 && s !== "tripwire" && /* @__PURE__ */ t(
|
|
1128
|
+
V,
|
|
1129
1129
|
{
|
|
1130
1130
|
points: [
|
|
1131
1131
|
d[d.length - 1].x * n.w,
|
|
@@ -1139,32 +1139,32 @@ function jt({
|
|
|
1139
1139
|
opacity: 0.5
|
|
1140
1140
|
}
|
|
1141
1141
|
),
|
|
1142
|
-
d.map((
|
|
1143
|
-
const
|
|
1142
|
+
d.map((o, p) => {
|
|
1143
|
+
const v = z(o, n.w, n.h), x = p === 0;
|
|
1144
1144
|
return /* @__PURE__ */ t(
|
|
1145
|
-
|
|
1145
|
+
le,
|
|
1146
1146
|
{
|
|
1147
|
-
x:
|
|
1148
|
-
y:
|
|
1149
|
-
radius:
|
|
1150
|
-
fill:
|
|
1147
|
+
x: v.x,
|
|
1148
|
+
y: v.y,
|
|
1149
|
+
radius: x && d.length >= 3 ? 7 : 4,
|
|
1150
|
+
fill: x && d.length >= 3 ? "#6366f1" : "#ffffff",
|
|
1151
1151
|
stroke: "#6366f1",
|
|
1152
1152
|
strokeWidth: 1.5,
|
|
1153
1153
|
opacity: 0.9
|
|
1154
1154
|
},
|
|
1155
|
-
|
|
1155
|
+
p
|
|
1156
1156
|
);
|
|
1157
1157
|
})
|
|
1158
1158
|
] }) })
|
|
1159
1159
|
]
|
|
1160
1160
|
}
|
|
1161
1161
|
),
|
|
1162
|
-
|
|
1162
|
+
h ? /* @__PURE__ */ t("div", { className: "px-3 py-1.5 bg-zinc-800/80 text-[11px] text-zinc-400 border-t border-zinc-700", children: s === "tripwire" ? "Click to set start point, click again to complete the tripwire" : d.length < 3 ? "Click to add points (min 3). Double-click or click first point to close." : "Continue adding points. Double-click or click first point to close." }) : null
|
|
1163
1163
|
]
|
|
1164
1164
|
}
|
|
1165
1165
|
);
|
|
1166
1166
|
}
|
|
1167
|
-
const
|
|
1167
|
+
const Wt = Se(jt), Bt = "#3b82f6", de = [
|
|
1168
1168
|
"#3b82f6",
|
|
1169
1169
|
"#10b981",
|
|
1170
1170
|
"#f59e0b",
|
|
@@ -1176,22 +1176,22 @@ const Bt = Ae(jt), qt = "#3b82f6", me = [
|
|
|
1176
1176
|
"#8b5cf6",
|
|
1177
1177
|
"#14b8a6"
|
|
1178
1178
|
];
|
|
1179
|
-
function
|
|
1180
|
-
const
|
|
1181
|
-
for (const r of
|
|
1182
|
-
if (!
|
|
1183
|
-
return
|
|
1179
|
+
function qt(e) {
|
|
1180
|
+
const i = new Set(e.map((r) => (r.color ?? "").toLowerCase()));
|
|
1181
|
+
for (const r of de)
|
|
1182
|
+
if (!i.has(r.toLowerCase())) return r;
|
|
1183
|
+
return de[e.length % de.length];
|
|
1184
1184
|
}
|
|
1185
|
-
function
|
|
1185
|
+
function Ut(e) {
|
|
1186
1186
|
return {
|
|
1187
1187
|
id: e.id,
|
|
1188
1188
|
name: e.name,
|
|
1189
1189
|
kind: e.kind,
|
|
1190
|
-
color: e.color ||
|
|
1190
|
+
color: e.color || Bt,
|
|
1191
1191
|
points: [...e.polygon]
|
|
1192
1192
|
};
|
|
1193
1193
|
}
|
|
1194
|
-
function
|
|
1194
|
+
function Ce(e) {
|
|
1195
1195
|
return {
|
|
1196
1196
|
id: e.id,
|
|
1197
1197
|
name: e.name,
|
|
@@ -1200,74 +1200,74 @@ function Se(e) {
|
|
|
1200
1200
|
color: e.color
|
|
1201
1201
|
};
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1204
|
-
const
|
|
1205
|
-
id:
|
|
1206
|
-
name:
|
|
1207
|
-
kind:
|
|
1208
|
-
color:
|
|
1209
|
-
points: [...
|
|
1210
|
-
} :
|
|
1203
|
+
function Ht({ deviceId: e }) {
|
|
1204
|
+
const i = fe(), r = he(i.trpcClient, e), u = ge(r?.state.zones), f = G(() => u?.zones ?? [], [u]), s = me(), l = s?.drawingKind ?? null, a = s?.selectedZoneId ?? null, g = s?.editingDraft ?? null, n = G(() => f.map((b) => g && g.id === b.id ? {
|
|
1205
|
+
id: g.id,
|
|
1206
|
+
name: g.name,
|
|
1207
|
+
kind: g.kind,
|
|
1208
|
+
color: g.color,
|
|
1209
|
+
points: [...g.points]
|
|
1210
|
+
} : Ut(b)), [f, g]), F = T(
|
|
1211
1211
|
async (b) => {
|
|
1212
|
-
const
|
|
1212
|
+
const k = { ...b, color: qt(n) };
|
|
1213
1213
|
try {
|
|
1214
|
-
await r?.zones?.addZone({ zone:
|
|
1215
|
-
} catch (
|
|
1216
|
-
console.error("zones.addZone failed",
|
|
1214
|
+
await r?.zones?.addZone({ zone: Ce(k) });
|
|
1215
|
+
} catch (Z) {
|
|
1216
|
+
console.error("zones.addZone failed", Z);
|
|
1217
1217
|
}
|
|
1218
|
-
|
|
1218
|
+
s?.setSelectedZoneId(k.id), s?.setDrawingKind(null);
|
|
1219
1219
|
},
|
|
1220
|
-
[r, n,
|
|
1221
|
-
), d =
|
|
1222
|
-
async (b,
|
|
1223
|
-
if (
|
|
1224
|
-
|
|
1220
|
+
[r, n, s]
|
|
1221
|
+
), d = T(
|
|
1222
|
+
async (b, k) => {
|
|
1223
|
+
if (g && g.id === b) {
|
|
1224
|
+
s?.updateDraft({ points: k });
|
|
1225
1225
|
return;
|
|
1226
1226
|
}
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
1227
|
+
const Z = n.find((L) => L.id === b);
|
|
1228
|
+
if (Z)
|
|
1229
1229
|
try {
|
|
1230
|
-
await r?.zones?.updateZone({ zone:
|
|
1231
|
-
} catch (
|
|
1232
|
-
console.error("zones.updateZone failed",
|
|
1230
|
+
await r?.zones?.updateZone({ zone: Ce({ ...Z, points: k }) });
|
|
1231
|
+
} catch (L) {
|
|
1232
|
+
console.error("zones.updateZone failed", L);
|
|
1233
1233
|
}
|
|
1234
1234
|
},
|
|
1235
|
-
[r, n,
|
|
1236
|
-
),
|
|
1235
|
+
[r, n, g, s]
|
|
1236
|
+
), $ = T(
|
|
1237
1237
|
(b) => {
|
|
1238
1238
|
if (b === null) {
|
|
1239
|
-
|
|
1239
|
+
s?.discardDraft(), s?.setSelectedZoneId(null);
|
|
1240
1240
|
return;
|
|
1241
1241
|
}
|
|
1242
|
-
const
|
|
1243
|
-
if (!
|
|
1244
|
-
|
|
1242
|
+
const k = n.find((Z) => Z.id === b);
|
|
1243
|
+
if (!k) {
|
|
1244
|
+
s?.setSelectedZoneId(b);
|
|
1245
1245
|
return;
|
|
1246
1246
|
}
|
|
1247
|
-
|
|
1248
|
-
id:
|
|
1249
|
-
kind:
|
|
1250
|
-
name:
|
|
1251
|
-
color:
|
|
1252
|
-
points:
|
|
1247
|
+
s?.enterDraft({
|
|
1248
|
+
id: k.id,
|
|
1249
|
+
kind: k.kind,
|
|
1250
|
+
name: k.name,
|
|
1251
|
+
color: k.color,
|
|
1252
|
+
points: k.points
|
|
1253
1253
|
});
|
|
1254
1254
|
},
|
|
1255
|
-
[n,
|
|
1255
|
+
[n, s]
|
|
1256
1256
|
);
|
|
1257
|
-
return n.length === 0 &&
|
|
1258
|
-
|
|
1257
|
+
return n.length === 0 && l === null ? null : /* @__PURE__ */ t(
|
|
1258
|
+
Wt,
|
|
1259
1259
|
{
|
|
1260
1260
|
zones: n,
|
|
1261
|
-
selectedZoneId:
|
|
1262
|
-
onSelectZone:
|
|
1261
|
+
selectedZoneId: a,
|
|
1262
|
+
onSelectZone: $,
|
|
1263
1263
|
onZonePointsChange: d,
|
|
1264
|
-
onZoneComplete:
|
|
1265
|
-
drawingKind:
|
|
1264
|
+
onZoneComplete: F,
|
|
1265
|
+
drawingKind: l,
|
|
1266
1266
|
transparent: !0
|
|
1267
1267
|
}
|
|
1268
1268
|
);
|
|
1269
1269
|
}
|
|
1270
|
-
const Vt =
|
|
1270
|
+
const Vt = Se(Ht), Gt = "#3b82f6";
|
|
1271
1271
|
function Yt(e) {
|
|
1272
1272
|
return {
|
|
1273
1273
|
id: e.id,
|
|
@@ -1277,7 +1277,7 @@ function Yt(e) {
|
|
|
1277
1277
|
points: [...e.polygon]
|
|
1278
1278
|
};
|
|
1279
1279
|
}
|
|
1280
|
-
function
|
|
1280
|
+
function zt(e) {
|
|
1281
1281
|
return {
|
|
1282
1282
|
id: e.id,
|
|
1283
1283
|
name: e.name,
|
|
@@ -1286,8 +1286,8 @@ function Xt(e) {
|
|
|
1286
1286
|
color: e.color
|
|
1287
1287
|
};
|
|
1288
1288
|
}
|
|
1289
|
-
function
|
|
1290
|
-
const
|
|
1289
|
+
function Xt({ deviceId: e }) {
|
|
1290
|
+
const i = fe(), r = he(i.trpcClient, e), u = ge(r?.state.zones), f = G(() => u?.zones ?? [], [u]), s = G(() => f.map(Yt), [f]), l = me(), a = l?.drawingKind ?? null, g = l?.selectedZoneId ?? null, n = l?.editingDraft ?? null, F = G(
|
|
1291
1291
|
() => ({
|
|
1292
1292
|
id: "zones",
|
|
1293
1293
|
order: 100,
|
|
@@ -1296,320 +1296,117 @@ function Kt({ deviceId: e }) {
|
|
|
1296
1296
|
}),
|
|
1297
1297
|
[e]
|
|
1298
1298
|
);
|
|
1299
|
-
|
|
1300
|
-
const d =
|
|
1301
|
-
(
|
|
1302
|
-
if (
|
|
1303
|
-
|
|
1299
|
+
He(F);
|
|
1300
|
+
const d = T(
|
|
1301
|
+
(y) => {
|
|
1302
|
+
if (y === null) {
|
|
1303
|
+
l?.discardDraft(), l?.setSelectedZoneId(null);
|
|
1304
1304
|
return;
|
|
1305
1305
|
}
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1308
|
-
id:
|
|
1309
|
-
kind:
|
|
1310
|
-
name:
|
|
1311
|
-
color:
|
|
1312
|
-
points:
|
|
1306
|
+
const h = s.find((Y) => Y.id === y);
|
|
1307
|
+
h && l?.enterDraft({
|
|
1308
|
+
id: h.id,
|
|
1309
|
+
kind: h.kind,
|
|
1310
|
+
name: h.name,
|
|
1311
|
+
color: h.color,
|
|
1312
|
+
points: h.points
|
|
1313
1313
|
});
|
|
1314
1314
|
},
|
|
1315
|
-
[
|
|
1316
|
-
),
|
|
1317
|
-
const
|
|
1318
|
-
if (
|
|
1315
|
+
[s, l]
|
|
1316
|
+
), $ = T(async () => {
|
|
1317
|
+
const y = l?.editingDraft;
|
|
1318
|
+
if (y) {
|
|
1319
1319
|
try {
|
|
1320
1320
|
await r?.zones?.updateZone({
|
|
1321
|
-
zone:
|
|
1322
|
-
id:
|
|
1323
|
-
kind:
|
|
1324
|
-
name:
|
|
1325
|
-
color:
|
|
1326
|
-
points: [...
|
|
1321
|
+
zone: zt({
|
|
1322
|
+
id: y.id,
|
|
1323
|
+
kind: y.kind,
|
|
1324
|
+
name: y.name,
|
|
1325
|
+
color: y.color,
|
|
1326
|
+
points: [...y.points]
|
|
1327
1327
|
})
|
|
1328
1328
|
});
|
|
1329
|
-
} catch (
|
|
1330
|
-
console.error("zones.updateZone failed",
|
|
1329
|
+
} catch (h) {
|
|
1330
|
+
console.error("zones.updateZone failed", h);
|
|
1331
1331
|
}
|
|
1332
|
-
|
|
1332
|
+
l?.discardDraft(), l?.setSelectedZoneId(null);
|
|
1333
1333
|
}
|
|
1334
|
-
}, [r,
|
|
1335
|
-
|
|
1336
|
-
}, [
|
|
1337
|
-
async (
|
|
1334
|
+
}, [r, l]), b = T(() => {
|
|
1335
|
+
l?.discardDraft(), l?.setSelectedZoneId(null);
|
|
1336
|
+
}, [l]), k = T(
|
|
1337
|
+
async (y) => {
|
|
1338
1338
|
try {
|
|
1339
|
-
await r?.zones?.removeZone({ zoneId:
|
|
1340
|
-
} catch (
|
|
1341
|
-
console.error("zones.removeZone failed",
|
|
1339
|
+
await r?.zones?.removeZone({ zoneId: y });
|
|
1340
|
+
} catch (h) {
|
|
1341
|
+
console.error("zones.removeZone failed", h);
|
|
1342
1342
|
}
|
|
1343
|
-
|
|
1343
|
+
l?.selectedZoneId === y && l.setSelectedZoneId(null), l?.editingDraft?.id === y && l.discardDraft();
|
|
1344
1344
|
},
|
|
1345
|
-
[r,
|
|
1346
|
-
),
|
|
1347
|
-
(
|
|
1348
|
-
|
|
1345
|
+
[r, l]
|
|
1346
|
+
), Z = T(
|
|
1347
|
+
(y) => {
|
|
1348
|
+
l?.startDrawing(y);
|
|
1349
1349
|
},
|
|
1350
|
-
[
|
|
1351
|
-
),
|
|
1352
|
-
|
|
1353
|
-
}, [
|
|
1350
|
+
[l]
|
|
1351
|
+
), L = T(() => {
|
|
1352
|
+
l?.setDrawingKind(null);
|
|
1353
|
+
}, [l]), S = G(() => !n || !s.find((h) => h.id === n.id) ? null : {
|
|
1354
1354
|
id: n.id,
|
|
1355
1355
|
kind: n.kind,
|
|
1356
1356
|
name: n.name,
|
|
1357
1357
|
color: n.color,
|
|
1358
1358
|
points: [...n.points]
|
|
1359
|
-
}, [
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */ t("div", { className:
|
|
1363
|
-
/* @__PURE__ */ t("h2", { className:
|
|
1364
|
-
/* @__PURE__ */
|
|
1359
|
+
}, [s, n]);
|
|
1360
|
+
return /* @__PURE__ */ c("div", { className: Ve, children: [
|
|
1361
|
+
/* @__PURE__ */ c("div", { className: Ge, children: [
|
|
1362
|
+
/* @__PURE__ */ t("div", { className: Ye, children: /* @__PURE__ */ c("div", { className: "min-w-0", children: [
|
|
1363
|
+
/* @__PURE__ */ t("h2", { className: Me, children: "Detection Zones" }),
|
|
1364
|
+
/* @__PURE__ */ c("p", { className: `${ze} mt-0.5 leading-tight`, children: [
|
|
1365
1365
|
"Pick a shape below or use the ",
|
|
1366
1366
|
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "Zones" }),
|
|
1367
1367
|
" button on the live frame to draw new polygons or tripwires. Behaviour is set per-stage in the rules editors below — a zone with no rule is observed by analytics but never filters."
|
|
1368
1368
|
] })
|
|
1369
1369
|
] }) }),
|
|
1370
|
-
/* @__PURE__ */
|
|
1370
|
+
/* @__PURE__ */ c("div", { className: `${Xe} flex flex-col gap-3`, children: [
|
|
1371
1371
|
/* @__PURE__ */ t(
|
|
1372
|
-
|
|
1372
|
+
Zt,
|
|
1373
1373
|
{
|
|
1374
|
-
zones:
|
|
1375
|
-
selectedZoneId:
|
|
1376
|
-
drawingKind:
|
|
1374
|
+
zones: s,
|
|
1375
|
+
selectedZoneId: g,
|
|
1376
|
+
drawingKind: a,
|
|
1377
1377
|
onSelectZone: d,
|
|
1378
|
-
onDeleteZone:
|
|
1379
|
-
onStartDraw:
|
|
1380
|
-
onCancelDraw:
|
|
1378
|
+
onDeleteZone: k,
|
|
1379
|
+
onStartDraw: Z,
|
|
1380
|
+
onCancelDraw: L
|
|
1381
1381
|
}
|
|
1382
1382
|
),
|
|
1383
|
-
|
|
1383
|
+
S && /* @__PURE__ */ c(De, { children: [
|
|
1384
1384
|
/* @__PURE__ */ t("div", { className: "border-t border-border" }),
|
|
1385
1385
|
/* @__PURE__ */ t(
|
|
1386
|
-
|
|
1386
|
+
Ft,
|
|
1387
1387
|
{
|
|
1388
|
-
zone:
|
|
1389
|
-
onSave:
|
|
1388
|
+
zone: S,
|
|
1389
|
+
onSave: $,
|
|
1390
1390
|
onDiscard: b,
|
|
1391
|
-
onDelete: () =>
|
|
1391
|
+
onDelete: () => k(S.id)
|
|
1392
1392
|
}
|
|
1393
1393
|
)
|
|
1394
1394
|
] })
|
|
1395
1395
|
] })
|
|
1396
1396
|
] }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
/* @__PURE__ */ t(
|
|
1399
|
-
/* @__PURE__ */ t(
|
|
1397
|
+
/* @__PURE__ */ c("div", { className: `grid grid-cols-1 2xl:grid-cols-2 ${Ke}`, children: [
|
|
1398
|
+
/* @__PURE__ */ t(ve, { dev: r, stage: "motion", zones: f }),
|
|
1399
|
+
/* @__PURE__ */ t(ve, { dev: r, stage: "detection", zones: f })
|
|
1400
1400
|
] })
|
|
1401
1401
|
] });
|
|
1402
1402
|
}
|
|
1403
|
-
function
|
|
1404
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "ZoneEditor requires a deviceId" }) : /* @__PURE__ */ t(
|
|
1405
|
-
}
|
|
1406
|
-
function Jt({ options: e, cells: o, onCellsChange: r }) {
|
|
1407
|
-
const { gridWidth: l, gridHeight: p } = e, i = l * p, c = Y(!1), s = Y(!0), h = Y(/* @__PURE__ */ new Set()), [, n] = L(0), S = P(
|
|
1408
|
-
(m, w) => {
|
|
1409
|
-
if (m < 0 || m >= i || o[m] === w) return;
|
|
1410
|
-
const _ = [...o];
|
|
1411
|
-
for (; _.length < i; ) _.push(!1);
|
|
1412
|
-
_.length = i, _[m] = w, r(_);
|
|
1413
|
-
},
|
|
1414
|
-
[o, i, r]
|
|
1415
|
-
), d = P(
|
|
1416
|
-
(m) => (w) => {
|
|
1417
|
-
w.preventDefault();
|
|
1418
|
-
const _ = !o[m];
|
|
1419
|
-
c.current = !0, s.current = _, h.current = /* @__PURE__ */ new Set([m]), S(m, _), n((M) => M + 1);
|
|
1420
|
-
},
|
|
1421
|
-
[o, S]
|
|
1422
|
-
), Z = P(
|
|
1423
|
-
(m) => () => {
|
|
1424
|
-
c.current && (h.current.has(m) || (h.current.add(m), S(m, s.current)));
|
|
1425
|
-
},
|
|
1426
|
-
[S]
|
|
1427
|
-
), b = P(() => {
|
|
1428
|
-
c.current && (c.current = !1, h.current = /* @__PURE__ */ new Set());
|
|
1429
|
-
}, []);
|
|
1430
|
-
return /* @__PURE__ */ t(
|
|
1431
|
-
"div",
|
|
1432
|
-
{
|
|
1433
|
-
className: "absolute inset-0 select-none grid",
|
|
1434
|
-
style: {
|
|
1435
|
-
gridTemplateColumns: `repeat(${String(l)}, 1fr)`,
|
|
1436
|
-
gridTemplateRows: `repeat(${String(p)}, 1fr)`
|
|
1437
|
-
},
|
|
1438
|
-
onPointerUp: b,
|
|
1439
|
-
onPointerLeave: b,
|
|
1440
|
-
children: Array.from({ length: i }, (m, w) => {
|
|
1441
|
-
const _ = o[w] === !0;
|
|
1442
|
-
return /* @__PURE__ */ t(
|
|
1443
|
-
"button",
|
|
1444
|
-
{
|
|
1445
|
-
type: "button",
|
|
1446
|
-
"aria-label": `motion cell ${String(w)}`,
|
|
1447
|
-
"aria-pressed": _,
|
|
1448
|
-
onPointerDown: d(w),
|
|
1449
|
-
onPointerEnter: Z(w),
|
|
1450
|
-
className: _ ? "border border-primary/40 bg-primary/30 hover:bg-primary/40 transition-colors" : "border border-white/15 bg-transparent hover:bg-white/10 transition-colors"
|
|
1451
|
-
},
|
|
1452
|
-
w
|
|
1453
|
-
);
|
|
1454
|
-
})
|
|
1455
|
-
}
|
|
1456
|
-
);
|
|
1457
|
-
}
|
|
1458
|
-
function en(e) {
|
|
1459
|
-
const o = e instanceof Error ? e.message : String(e);
|
|
1460
|
-
return o.includes("provider not available") || o.includes("motion-zones");
|
|
1461
|
-
}
|
|
1462
|
-
function Me(e, o) {
|
|
1463
|
-
const r = o.gridWidth * o.gridHeight, l = new Array(r);
|
|
1464
|
-
for (let p = 0; p < r; p += 1) l[p] = e[p] === !0;
|
|
1465
|
-
return l;
|
|
1466
|
-
}
|
|
1467
|
-
function tn(e, o) {
|
|
1468
|
-
if (e.length !== o.length) return !1;
|
|
1469
|
-
for (let r = 0; r < e.length; r += 1) if (e[r] !== o[r]) return !1;
|
|
1470
|
-
return !0;
|
|
1471
|
-
}
|
|
1472
|
-
function nn({ deviceId: e }) {
|
|
1473
|
-
const o = ae(), r = le(o.trpcClient, e), [l, p] = L(null), [i, c] = L(!1), [s, h] = L(null), [n, S] = L(null), [d, Z] = L(!1), b = Y(!1);
|
|
1474
|
-
X(() => {
|
|
1475
|
-
if (!r) return;
|
|
1476
|
-
let f = !1;
|
|
1477
|
-
return (async () => {
|
|
1478
|
-
try {
|
|
1479
|
-
const g = await r.motionZones?.getOptions({});
|
|
1480
|
-
if (f || !g || (p(g), b.current)) return;
|
|
1481
|
-
const F = await r.motionZones?.getStatus({});
|
|
1482
|
-
if (f || !F) return;
|
|
1483
|
-
b.current = !0;
|
|
1484
|
-
const K = Me(F.cells, g);
|
|
1485
|
-
S(K), h(K);
|
|
1486
|
-
} catch (g) {
|
|
1487
|
-
if (f) return;
|
|
1488
|
-
en(g) ? c(!0) : console.error("motion-zones load failed", g);
|
|
1489
|
-
}
|
|
1490
|
-
})(), () => {
|
|
1491
|
-
f = !0;
|
|
1492
|
-
};
|
|
1493
|
-
}, [r]);
|
|
1494
|
-
const m = U(
|
|
1495
|
-
() => s !== null && n !== null && !tn(s, n),
|
|
1496
|
-
[s, n]
|
|
1497
|
-
), w = U(
|
|
1498
|
-
() => s ? s.reduce((f, g) => g ? f + 1 : f, 0) : 0,
|
|
1499
|
-
[s]
|
|
1500
|
-
), _ = l ? l.gridWidth * l.gridHeight : 0, M = P((f) => {
|
|
1501
|
-
_ > 0 && h(new Array(_).fill(f));
|
|
1502
|
-
}, [_]), k = P(() => {
|
|
1503
|
-
h((f) => f && f.map((g) => !g));
|
|
1504
|
-
}, []), x = P(() => {
|
|
1505
|
-
n && h([...n]);
|
|
1506
|
-
}, [n]), V = P(async () => {
|
|
1507
|
-
if (!(!s || !r?.motionZones || !l)) {
|
|
1508
|
-
Z(!0);
|
|
1509
|
-
try {
|
|
1510
|
-
await r.motionZones.setZone({ patch: { cells: [...s] } });
|
|
1511
|
-
const f = await r.motionZones.getStatus({});
|
|
1512
|
-
if (f) {
|
|
1513
|
-
const g = Me(f.cells, l);
|
|
1514
|
-
S(g), h(g);
|
|
1515
|
-
}
|
|
1516
|
-
} catch (f) {
|
|
1517
|
-
console.error("motion-zones.setZone failed", f);
|
|
1518
|
-
} finally {
|
|
1519
|
-
Z(!1);
|
|
1520
|
-
}
|
|
1521
|
-
}
|
|
1522
|
-
}, [s, r, l]), v = U(
|
|
1523
|
-
() => !i && l && s ? {
|
|
1524
|
-
id: "motion-zones",
|
|
1525
|
-
order: 110,
|
|
1526
|
-
// above the analytics zones overlay (order 100)
|
|
1527
|
-
node: /* @__PURE__ */ t(Jt, { options: l, cells: s, onCellsChange: h })
|
|
1528
|
-
} : null,
|
|
1529
|
-
[i, l, s]
|
|
1530
|
-
);
|
|
1531
|
-
return Ze(v), /* @__PURE__ */ t("div", { className: "flex flex-col gap-3", children: i ? /* @__PURE__ */ t("p", { className: `${J} leading-relaxed`, children: "This camera doesn't expose an on-board motion-detection grid." }) : !i && l !== null && s !== null ? /* @__PURE__ */ u(be, { children: [
|
|
1532
|
-
/* @__PURE__ */ u("p", { className: `${J} leading-relaxed`, children: [
|
|
1533
|
-
"Click or drag cells on the live frame to paint the region the camera watches for motion, then",
|
|
1534
|
-
" ",
|
|
1535
|
-
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "Save" }),
|
|
1536
|
-
" to push the mask to the camera. Detection on/off and sensitivity are set in the",
|
|
1537
|
-
" ",
|
|
1538
|
-
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "On-camera motion" }),
|
|
1539
|
-
" section."
|
|
1540
|
-
] }),
|
|
1541
|
-
/* @__PURE__ */ u("div", { className: "flex items-center gap-2 flex-wrap", children: [
|
|
1542
|
-
/* @__PURE__ */ t(
|
|
1543
|
-
"button",
|
|
1544
|
-
{
|
|
1545
|
-
type: "button",
|
|
1546
|
-
onClick: () => M(!0),
|
|
1547
|
-
disabled: d,
|
|
1548
|
-
className: "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",
|
|
1549
|
-
children: "All on"
|
|
1550
|
-
}
|
|
1551
|
-
),
|
|
1552
|
-
/* @__PURE__ */ t(
|
|
1553
|
-
"button",
|
|
1554
|
-
{
|
|
1555
|
-
type: "button",
|
|
1556
|
-
onClick: () => M(!1),
|
|
1557
|
-
disabled: d,
|
|
1558
|
-
className: "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",
|
|
1559
|
-
children: "All off"
|
|
1560
|
-
}
|
|
1561
|
-
),
|
|
1562
|
-
/* @__PURE__ */ t(
|
|
1563
|
-
"button",
|
|
1564
|
-
{
|
|
1565
|
-
type: "button",
|
|
1566
|
-
onClick: k,
|
|
1567
|
-
disabled: d,
|
|
1568
|
-
className: "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",
|
|
1569
|
-
children: "Invert"
|
|
1570
|
-
}
|
|
1571
|
-
),
|
|
1572
|
-
/* @__PURE__ */ u("span", { className: `${J} ml-1 tabular-nums`, children: [
|
|
1573
|
-
w,
|
|
1574
|
-
" / ",
|
|
1575
|
-
_,
|
|
1576
|
-
" cells · ",
|
|
1577
|
-
l.gridWidth,
|
|
1578
|
-
"×",
|
|
1579
|
-
l.gridHeight
|
|
1580
|
-
] }),
|
|
1581
|
-
/* @__PURE__ */ t("span", { className: "flex-1" }),
|
|
1582
|
-
/* @__PURE__ */ t(
|
|
1583
|
-
"button",
|
|
1584
|
-
{
|
|
1585
|
-
type: "button",
|
|
1586
|
-
onClick: x,
|
|
1587
|
-
disabled: d || !m,
|
|
1588
|
-
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",
|
|
1589
|
-
children: "Revert"
|
|
1590
|
-
}
|
|
1591
|
-
),
|
|
1592
|
-
/* @__PURE__ */ t(
|
|
1593
|
-
"button",
|
|
1594
|
-
{
|
|
1595
|
-
type: "button",
|
|
1596
|
-
onClick: () => void V(),
|
|
1597
|
-
disabled: d || !m,
|
|
1598
|
-
className: "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",
|
|
1599
|
-
children: d ? "Saving…" : "Save"
|
|
1600
|
-
}
|
|
1601
|
-
)
|
|
1602
|
-
] })
|
|
1603
|
-
] }) : /* @__PURE__ */ t("p", { className: `${J} leading-relaxed`, children: "Loading the camera's motion grid…" }) });
|
|
1604
|
-
}
|
|
1605
|
-
function rn(e) {
|
|
1606
|
-
return e.deviceId === void 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "MotionZonesEditor requires a deviceId" }) : /* @__PURE__ */ t(nn, { deviceId: e.deviceId });
|
|
1403
|
+
function Kt(e) {
|
|
1404
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ t("div", { className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning", children: "ZoneEditor requires a deviceId" }) : /* @__PURE__ */ t(Xt, { deviceId: e.deviceId });
|
|
1607
1405
|
}
|
|
1608
|
-
const
|
|
1406
|
+
const ln = {
|
|
1609
1407
|
"pipeline-quick-stats": Mt,
|
|
1610
|
-
"zone-editor":
|
|
1611
|
-
"motion-zones-editor": rn
|
|
1408
|
+
"zone-editor": Kt
|
|
1612
1409
|
};
|
|
1613
1410
|
export {
|
|
1614
|
-
|
|
1411
|
+
ln as default
|
|
1615
1412
|
};
|