@camstack/addon-pipeline-orchestrator 0.1.26 → 0.1.28
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/zone-editor/ZoneForm.d.ts +1 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneForm.d.ts.map +1 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneList.d.ts +1 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneList.d.ts.map +1 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneOverlay.d.ts.map +1 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/types.d.ts +33 -0
- package/dist/@mf-types/compiled-types/widgets/zone-editor/types.d.ts.map +1 -0
- package/dist/@mf-types.zip +0 -0
- package/dist/{ReactKonva--rywLr1Y.mjs → ReactKonva-Rg9MNR62.mjs} +2 -2
- package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-h5aXOPSA.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-lantnv8e.mjs} +1 -1
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C507UJJC.mjs +30 -0
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-Bau3YeQq.mjs +35 -0
- package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-0qpbQxoV.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-B9__gOco.mjs} +7 -6
- package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-DekuE8px.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-7px_s7lQ.mjs} +1 -1
- package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-Ba_7PYkj.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-BP356DyI.mjs} +1 -1
- package/dist/{__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_konva__loadShare__.mjs-DSZIXeAx.mjs → __mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_2_konva__loadShare__.mjs-BjxkVuVo.mjs} +5 -4
- package/dist/_stub.js +483 -774
- package/dist/{_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-iOQz8pwN.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_orchestrator_widgets-LTEdXGaz.mjs} +6 -6
- package/dist/{client-CzjQ3uuI.mjs → client-DRnvBKkB.mjs} +2 -2
- package/dist/{hostInit-HZ0iFEJA.mjs → hostInit-I-qi78F9.mjs} +13 -13
- package/dist/{index-Cbqs9uJn.mjs → index-B7LnRgSE.mjs} +1 -1
- package/dist/{index-BmY66bNn.mjs → index-BRAmQOXI.mjs} +254 -268
- package/dist/{index-DaulYonp.mjs → index-CSDhxUNV.mjs} +1 -1
- package/dist/index-Dhyr_mtg.mjs +52894 -0
- package/dist/index-DtOI1aTU.mjs +18504 -0
- package/dist/{index-DOuehnyb.mjs → index-DujcNO2E.mjs} +1 -1
- package/dist/{index-C1DnrJuR.mjs → index-LZ9uQOMe.mjs} +1 -1
- package/dist/index.js +4887 -935
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4887 -935
- package/dist/index.mjs.map +1 -1
- package/dist/{jsx-runtime-DACJhJOv.mjs → jsx-runtime-C5ymGPwR.mjs} +1 -1
- package/dist/remoteEntry.js +1 -1
- package/dist/{schemas-ChN4Ih0h.mjs → schemas-B7L0qZtq.mjs} +530 -515
- package/package.json +4 -1
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneCanvas.d.ts +0 -60
- package/dist/@mf-types/compiled-types/widgets/zone-editor/ZoneCanvas.d.ts.map +0 -1
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C4HmLg0z.mjs +0 -20
- package/dist/__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-DEuqbomC.mjs +0 -34
- package/dist/index-BuYTzV_S.mjs +0 -21513
- package/dist/index-CUXiTSWS.mjs +0 -13883
package/dist/_stub.js
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { _ as t, a as
|
|
2
|
-
import { _ as
|
|
3
|
-
import { _ as
|
|
4
|
-
import { a as
|
|
5
|
-
import { _ as
|
|
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";
|
|
1
|
+
import { _ as t, a as i, b as J } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-Cg6QsnjR.mjs";
|
|
2
|
+
import { _ as T } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs";
|
|
3
|
+
import { _ as Q, a as re, b as oe, c as B, d as U, e as ae, f as z, g as K, h as se, i as V, j as Y, k as ie, l as le, m as R, n as E, o as L, p as ce, q as de, r as ue, s as pe, t as me, u as fe, v as he, w as ge } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-Bau3YeQq.mjs";
|
|
4
|
+
import { a as ee, b as O, c as M, d as j, e as be, f as ye, g as w } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare__react__loadShare__.mjs-B9__gOco.mjs";
|
|
5
|
+
import { _ as xe } from "./__mfe_internal__addon_pipeline_orchestrator_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-C507UJJC.mjs";
|
|
7
6
|
/**
|
|
8
7
|
* @license lucide-react v0.511.0 - ISC
|
|
9
8
|
*
|
|
10
9
|
* This source code is licensed under the ISC license.
|
|
11
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
12
11
|
*/
|
|
13
|
-
const
|
|
12
|
+
const _e = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ve = (e) => e.replace(
|
|
14
13
|
/^([A-Z])|[\s-_]+(\w)/g,
|
|
15
|
-
(
|
|
16
|
-
),
|
|
17
|
-
const
|
|
18
|
-
return
|
|
19
|
-
},
|
|
20
|
-
for (const
|
|
21
|
-
if (
|
|
14
|
+
(o, n, d) => d ? d.toUpperCase() : n.toLowerCase()
|
|
15
|
+
), W = (e) => {
|
|
16
|
+
const o = ve(e);
|
|
17
|
+
return o.charAt(0).toUpperCase() + o.slice(1);
|
|
18
|
+
}, te = (...e) => e.filter((o, n, d) => !!o && o.trim() !== "" && d.indexOf(o) === n).join(" ").trim(), ke = (e) => {
|
|
19
|
+
for (const o in e)
|
|
20
|
+
if (o.startsWith("aria-") || o === "role" || o === "title")
|
|
22
21
|
return !0;
|
|
23
22
|
};
|
|
24
23
|
/**
|
|
@@ -27,7 +26,7 @@ const nt = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), rt = (
|
|
|
27
26
|
* This source code is licensed under the ISC license.
|
|
28
27
|
* See the LICENSE file in the root directory of this source tree.
|
|
29
28
|
*/
|
|
30
|
-
var
|
|
29
|
+
var we = {
|
|
31
30
|
xmlns: "http://www.w3.org/2000/svg",
|
|
32
31
|
width: 24,
|
|
33
32
|
height: 24,
|
|
@@ -44,31 +43,31 @@ var st = {
|
|
|
44
43
|
* This source code is licensed under the ISC license.
|
|
45
44
|
* See the LICENSE file in the root directory of this source tree.
|
|
46
45
|
*/
|
|
47
|
-
const
|
|
46
|
+
const Ne = ee(
|
|
48
47
|
({
|
|
49
48
|
color: e = "currentColor",
|
|
50
|
-
size:
|
|
51
|
-
strokeWidth:
|
|
52
|
-
absoluteStrokeWidth:
|
|
49
|
+
size: o = 24,
|
|
50
|
+
strokeWidth: n = 2,
|
|
51
|
+
absoluteStrokeWidth: d,
|
|
53
52
|
className: f = "",
|
|
54
53
|
children: s,
|
|
55
|
-
iconNode:
|
|
56
|
-
...
|
|
57
|
-
},
|
|
54
|
+
iconNode: a,
|
|
55
|
+
...r
|
|
56
|
+
}, h) => O(
|
|
58
57
|
"svg",
|
|
59
58
|
{
|
|
60
|
-
ref:
|
|
61
|
-
...
|
|
62
|
-
width:
|
|
63
|
-
height:
|
|
59
|
+
ref: h,
|
|
60
|
+
...we,
|
|
61
|
+
width: o,
|
|
62
|
+
height: o,
|
|
64
63
|
stroke: e,
|
|
65
|
-
strokeWidth:
|
|
66
|
-
className:
|
|
67
|
-
...!s && !
|
|
68
|
-
...
|
|
64
|
+
strokeWidth: d ? Number(n) * 24 / Number(o) : n,
|
|
65
|
+
className: te("lucide", f),
|
|
66
|
+
...!s && !ke(r) && { "aria-hidden": "true" },
|
|
67
|
+
...r
|
|
69
68
|
},
|
|
70
69
|
[
|
|
71
|
-
...
|
|
70
|
+
...a.map(([l, v]) => O(l, v)),
|
|
72
71
|
...Array.isArray(s) ? s : [s]
|
|
73
72
|
]
|
|
74
73
|
)
|
|
@@ -79,20 +78,20 @@ const at = Ie(
|
|
|
79
78
|
* This source code is licensed under the ISC license.
|
|
80
79
|
* See the LICENSE file in the root directory of this source tree.
|
|
81
80
|
*/
|
|
82
|
-
const
|
|
83
|
-
const
|
|
84
|
-
({ className:
|
|
81
|
+
const k = (e, o) => {
|
|
82
|
+
const n = ee(
|
|
83
|
+
({ className: d, ...f }, s) => O(Ne, {
|
|
85
84
|
ref: s,
|
|
86
|
-
iconNode:
|
|
87
|
-
className:
|
|
88
|
-
`lucide-${
|
|
85
|
+
iconNode: o,
|
|
86
|
+
className: te(
|
|
87
|
+
`lucide-${_e(W(e))}`,
|
|
89
88
|
`lucide-${e}`,
|
|
90
|
-
|
|
89
|
+
d
|
|
91
90
|
),
|
|
92
91
|
...f
|
|
93
92
|
})
|
|
94
93
|
);
|
|
95
|
-
return
|
|
94
|
+
return n.displayName = W(e), n;
|
|
96
95
|
};
|
|
97
96
|
/**
|
|
98
97
|
* @license lucide-react v0.511.0 - ISC
|
|
@@ -100,7 +99,7 @@ const O = (e, i) => {
|
|
|
100
99
|
* This source code is licensed under the ISC license.
|
|
101
100
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
101
|
*/
|
|
103
|
-
const
|
|
102
|
+
const Ce = [
|
|
104
103
|
[
|
|
105
104
|
"path",
|
|
106
105
|
{
|
|
@@ -108,21 +107,21 @@ const it = [
|
|
|
108
107
|
key: "169zse"
|
|
109
108
|
}
|
|
110
109
|
]
|
|
111
|
-
],
|
|
110
|
+
], De = k("activity", Ce);
|
|
112
111
|
/**
|
|
113
112
|
* @license lucide-react v0.511.0 - ISC
|
|
114
113
|
*
|
|
115
114
|
* This source code is licensed under the ISC license.
|
|
116
115
|
* See the LICENSE file in the root directory of this source tree.
|
|
117
116
|
*/
|
|
118
|
-
const
|
|
117
|
+
const Se = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]], Me = k("check", Se);
|
|
119
118
|
/**
|
|
120
119
|
* @license lucide-react v0.511.0 - ISC
|
|
121
120
|
*
|
|
122
121
|
* This source code is licensed under the ISC license.
|
|
123
122
|
* See the LICENSE file in the root directory of this source tree.
|
|
124
123
|
*/
|
|
125
|
-
const
|
|
124
|
+
const $e = [
|
|
126
125
|
["path", { d: "M12 20v2", key: "1lh1kg" }],
|
|
127
126
|
["path", { d: "M12 2v2", key: "tus03m" }],
|
|
128
127
|
["path", { d: "M17 20v2", key: "1rnc9c" }],
|
|
@@ -137,14 +136,14 @@ const ut = [
|
|
|
137
136
|
["path", { d: "M7 2v2", key: "1i4yhu" }],
|
|
138
137
|
["rect", { x: "4", y: "4", width: "16", height: "16", rx: "2", key: "1vbyd7" }],
|
|
139
138
|
["rect", { x: "8", y: "8", width: "8", height: "8", rx: "1", key: "z9xiuo" }]
|
|
140
|
-
],
|
|
139
|
+
], Ze = k("cpu", $e);
|
|
141
140
|
/**
|
|
142
141
|
* @license lucide-react v0.511.0 - ISC
|
|
143
142
|
*
|
|
144
143
|
* This source code is licensed under the ISC license.
|
|
145
144
|
* See the LICENSE file in the root directory of this source tree.
|
|
146
145
|
*/
|
|
147
|
-
const
|
|
146
|
+
const Ie = [
|
|
148
147
|
[
|
|
149
148
|
"path",
|
|
150
149
|
{
|
|
@@ -153,24 +152,24 @@ const ft = [
|
|
|
153
152
|
}
|
|
154
153
|
],
|
|
155
154
|
["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
|
|
156
|
-
],
|
|
155
|
+
], Ae = k("eye", Ie);
|
|
157
156
|
/**
|
|
158
157
|
* @license lucide-react v0.511.0 - ISC
|
|
159
158
|
*
|
|
160
159
|
* This source code is licensed under the ISC license.
|
|
161
160
|
* See the LICENSE file in the root directory of this source tree.
|
|
162
161
|
*/
|
|
163
|
-
const
|
|
162
|
+
const Fe = [
|
|
164
163
|
["path", { d: "m12 14 4-4", key: "9kzdfg" }],
|
|
165
164
|
["path", { d: "M3.34 19a10 10 0 1 1 17.32 0", key: "19p75a" }]
|
|
166
|
-
],
|
|
165
|
+
], Te = k("gauge", Fe);
|
|
167
166
|
/**
|
|
168
167
|
* @license lucide-react v0.511.0 - ISC
|
|
169
168
|
*
|
|
170
169
|
* This source code is licensed under the ISC license.
|
|
171
170
|
* See the LICENSE file in the root directory of this source tree.
|
|
172
171
|
*/
|
|
173
|
-
const
|
|
172
|
+
const Re = [
|
|
174
173
|
[
|
|
175
174
|
"path",
|
|
176
175
|
{
|
|
@@ -178,31 +177,31 @@ const bt = [
|
|
|
178
177
|
key: "yt0hxn"
|
|
179
178
|
}
|
|
180
179
|
]
|
|
181
|
-
],
|
|
180
|
+
], Ee = k("hexagon", Re);
|
|
182
181
|
/**
|
|
183
182
|
* @license lucide-react v0.511.0 - ISC
|
|
184
183
|
*
|
|
185
184
|
* This source code is licensed under the ISC license.
|
|
186
185
|
* See the LICENSE file in the root directory of this source tree.
|
|
187
186
|
*/
|
|
188
|
-
const
|
|
187
|
+
const Le = [["path", { d: "M5 12h14", key: "1ays0h" }]], je = k("minus", Le);
|
|
189
188
|
/**
|
|
190
189
|
* @license lucide-react v0.511.0 - ISC
|
|
191
190
|
*
|
|
192
191
|
* This source code is licensed under the ISC license.
|
|
193
192
|
* See the LICENSE file in the root directory of this source tree.
|
|
194
193
|
*/
|
|
195
|
-
const
|
|
194
|
+
const Pe = [
|
|
196
195
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
197
196
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
198
|
-
],
|
|
197
|
+
], qe = k("plus", Pe);
|
|
199
198
|
/**
|
|
200
199
|
* @license lucide-react v0.511.0 - ISC
|
|
201
200
|
*
|
|
202
201
|
* This source code is licensed under the ISC license.
|
|
203
202
|
* See the LICENSE file in the root directory of this source tree.
|
|
204
203
|
*/
|
|
205
|
-
const
|
|
204
|
+
const Ke = [
|
|
206
205
|
[
|
|
207
206
|
"path",
|
|
208
207
|
{
|
|
@@ -212,107 +211,179 @@ const wt = [
|
|
|
212
211
|
],
|
|
213
212
|
["path", { d: "M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7", key: "1ydtos" }],
|
|
214
213
|
["path", { d: "M7 3v4a1 1 0 0 0 1 1h7", key: "t51u73" }]
|
|
215
|
-
],
|
|
214
|
+
], Oe = k("save", Ke);
|
|
216
215
|
/**
|
|
217
216
|
* @license lucide-react v0.511.0 - ISC
|
|
218
217
|
*
|
|
219
218
|
* This source code is licensed under the ISC license.
|
|
220
219
|
* See the LICENSE file in the root directory of this source tree.
|
|
221
220
|
*/
|
|
222
|
-
const
|
|
221
|
+
const Be = [
|
|
223
222
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
224
223
|
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
225
224
|
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
226
225
|
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
227
226
|
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
228
|
-
],
|
|
227
|
+
], H = k("trash-2", Be);
|
|
229
228
|
/**
|
|
230
229
|
* @license lucide-react v0.511.0 - ISC
|
|
231
230
|
*
|
|
232
231
|
* This source code is licensed under the ISC license.
|
|
233
232
|
* See the LICENSE file in the root directory of this source tree.
|
|
234
233
|
*/
|
|
235
|
-
const
|
|
234
|
+
const Ue = [
|
|
235
|
+
[
|
|
236
|
+
"path",
|
|
237
|
+
{
|
|
238
|
+
d: "m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",
|
|
239
|
+
key: "ftymec"
|
|
240
|
+
}
|
|
241
|
+
],
|
|
242
|
+
["rect", { x: "2", y: "6", width: "14", height: "12", rx: "2", key: "158x01" }]
|
|
243
|
+
], ze = k("video", Ue);
|
|
244
|
+
/**
|
|
245
|
+
* @license lucide-react v0.511.0 - ISC
|
|
246
|
+
*
|
|
247
|
+
* This source code is licensed under the ISC license.
|
|
248
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
249
|
+
*/
|
|
250
|
+
const Ve = [
|
|
251
|
+
[
|
|
252
|
+
"path",
|
|
253
|
+
{
|
|
254
|
+
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",
|
|
255
|
+
key: "uqj9uw"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
["path", { d: "M16 9a5 5 0 0 1 0 6", key: "1q6k2b" }],
|
|
259
|
+
["path", { d: "M19.364 18.364a9 9 0 0 0 0-12.728", key: "ijwkga" }]
|
|
260
|
+
], He = k("volume-2", Ve);
|
|
261
|
+
/**
|
|
262
|
+
* @license lucide-react v0.511.0 - ISC
|
|
263
|
+
*
|
|
264
|
+
* This source code is licensed under the ISC license.
|
|
265
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
266
|
+
*/
|
|
267
|
+
const Qe = [
|
|
236
268
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
237
269
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
238
|
-
],
|
|
239
|
-
function
|
|
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(
|
|
270
|
+
], ne = k("x", Qe);
|
|
271
|
+
function We(e) {
|
|
272
|
+
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(Ge, { deviceId: e.deviceId });
|
|
241
273
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
274
|
+
function Ge({ deviceId: e }) {
|
|
275
|
+
Q(
|
|
244
276
|
["pipelineOrchestrator", "getPipelineAssignment"],
|
|
245
277
|
["pipeline.camera-assigned", "pipeline.camera-unassigned", "pipeline.camera-updated"]
|
|
246
|
-
),
|
|
278
|
+
), Q(
|
|
247
279
|
["pipelineRunner", "getCameraMetrics"],
|
|
248
280
|
["pipeline.camera-metrics-snapshot"]
|
|
249
281
|
);
|
|
250
|
-
const { data:
|
|
282
|
+
const { data: o } = re(
|
|
251
283
|
{ deviceId: e },
|
|
252
284
|
{ staleTime: 3e4 }
|
|
253
|
-
),
|
|
285
|
+
), n = o?.agentNodeId ?? null, f = typeof n == "string" && n.length > 0 && !n.startsWith("addon:") ? n : void 0, { data: s } = oe(
|
|
254
286
|
{
|
|
255
287
|
deviceId: e,
|
|
256
288
|
...f ? { nodeId: f } : {}
|
|
257
289
|
},
|
|
258
290
|
{ staleTime: 2e3, retry: !1 }
|
|
259
|
-
),
|
|
291
|
+
), a = B(), r = U(a.trpcClient, e), { data: h } = T({
|
|
260
292
|
queryKey: ["device", e, "pipelineAnalytics.getActiveTracks"],
|
|
261
|
-
queryFn: () =>
|
|
262
|
-
enabled: !!
|
|
293
|
+
queryFn: () => r?.pipelineAnalytics?.getActiveTracks({}) ?? [],
|
|
294
|
+
enabled: !!r,
|
|
295
|
+
refetchInterval: 5e3,
|
|
296
|
+
retry: !1
|
|
297
|
+
}), { data: l } = T({
|
|
298
|
+
queryKey: ["device", e, "audioMetrics.getCurrentSnapshot"],
|
|
299
|
+
queryFn: () => r?.audioMetrics?.getCurrentSnapshot({}) ?? null,
|
|
300
|
+
enabled: !!r,
|
|
301
|
+
refetchInterval: 2e3,
|
|
302
|
+
retry: !1
|
|
303
|
+
}), { data: v } = T({
|
|
304
|
+
queryKey: ["recording.getStatus", e],
|
|
305
|
+
queryFn: async () => await a.trpcClient.recording.getStatus.query({ deviceId: e }),
|
|
263
306
|
refetchInterval: 5e3,
|
|
264
307
|
retry: !1
|
|
265
|
-
}),
|
|
266
|
-
|
|
308
|
+
}), { data: C } = T({
|
|
309
|
+
queryKey: ["recording.getDeviceConfig", e],
|
|
310
|
+
queryFn: async () => await a.trpcClient.recording.getDeviceConfig.query({ deviceId: e }),
|
|
311
|
+
staleTime: 3e4,
|
|
312
|
+
retry: !1
|
|
313
|
+
}), N = s?.phase ?? null, D = s?.detectionMode ?? null, S = Number(s?.actualFps ?? 0), u = Number(s?.configuredFps ?? 0), y = Number(s?.avgInferenceTimeMs ?? 0), _ = Number(s?.queueDepth ?? 0), p = Number(s?.droppedFrames ?? 0), g = ae(N ?? "watching"), A = h?.length ?? 0, c = l?.level.dbfs ?? null, x = typeof c == "number" ? `${c.toFixed(1)} dBFS` : "—", b = v?.enabled ?? !1, m = v?.activeMode ?? "off", $ = b && m !== "off", P = b ? m === "off" ? "Idle" : m === "continuous" ? "Continuous" : m === "onMotion" ? "On motion" : m === "onAudioThreshold" ? "On audio" : m : "Disabled", Z = (C?.profiles ?? []).join(", "), F = v ? `${Xe(v.storageBytes ?? 0)}${Z ? ` · ${Z}` : ""}` : void 0;
|
|
314
|
+
return /* @__PURE__ */ i("div", { className: "grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3", children: [
|
|
267
315
|
/* @__PURE__ */ t(
|
|
268
|
-
|
|
316
|
+
I,
|
|
269
317
|
{
|
|
270
|
-
icon:
|
|
318
|
+
icon: De,
|
|
271
319
|
label: "Phase",
|
|
272
|
-
value:
|
|
273
|
-
color:
|
|
274
|
-
subtext:
|
|
320
|
+
value: g.label,
|
|
321
|
+
color: g.textColor,
|
|
322
|
+
subtext: D ?? void 0
|
|
275
323
|
}
|
|
276
324
|
),
|
|
277
325
|
/* @__PURE__ */ t(
|
|
278
|
-
|
|
326
|
+
I,
|
|
279
327
|
{
|
|
280
|
-
icon:
|
|
328
|
+
icon: Te,
|
|
281
329
|
label: "Detection FPS",
|
|
282
|
-
value: `${
|
|
283
|
-
subtext:
|
|
330
|
+
value: `${S.toFixed(1)}`,
|
|
331
|
+
subtext: u > 0 ? `target: ${u}` : void 0
|
|
284
332
|
}
|
|
285
333
|
),
|
|
286
334
|
/* @__PURE__ */ t(
|
|
287
|
-
|
|
335
|
+
I,
|
|
288
336
|
{
|
|
289
|
-
icon:
|
|
337
|
+
icon: Ze,
|
|
290
338
|
label: "Inference",
|
|
291
|
-
value: `${
|
|
292
|
-
subtext:
|
|
339
|
+
value: `${y.toFixed(1)} ms`,
|
|
340
|
+
subtext: _ > 0 ? `queue: ${_}` : void 0
|
|
293
341
|
}
|
|
294
342
|
),
|
|
295
343
|
/* @__PURE__ */ t(
|
|
296
|
-
|
|
344
|
+
I,
|
|
297
345
|
{
|
|
298
|
-
icon:
|
|
346
|
+
icon: Ae,
|
|
299
347
|
label: "Active Tracks",
|
|
300
|
-
value: String(
|
|
301
|
-
subtext:
|
|
348
|
+
value: String(A),
|
|
349
|
+
subtext: p > 0 ? `dropped: ${p}` : void 0
|
|
350
|
+
}
|
|
351
|
+
),
|
|
352
|
+
/* @__PURE__ */ t(
|
|
353
|
+
I,
|
|
354
|
+
{
|
|
355
|
+
icon: He,
|
|
356
|
+
label: "Current dB",
|
|
357
|
+
value: x
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ t(
|
|
361
|
+
I,
|
|
362
|
+
{
|
|
363
|
+
icon: ze,
|
|
364
|
+
label: "Recording",
|
|
365
|
+
value: P,
|
|
366
|
+
color: $ ? "text-success" : void 0,
|
|
367
|
+
subtext: F
|
|
302
368
|
}
|
|
303
369
|
)
|
|
304
|
-
] })
|
|
370
|
+
] });
|
|
305
371
|
}
|
|
306
|
-
function
|
|
307
|
-
|
|
308
|
-
|
|
372
|
+
function Xe(e) {
|
|
373
|
+
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
374
|
+
const o = ["B", "KB", "MB", "GB", "TB"], n = Math.min(o.length - 1, Math.floor(Math.log(e) / Math.log(1024))), d = e / 1024 ** n;
|
|
375
|
+
return `${n === 0 ? Math.round(d) : d.toFixed(1)} ${o[n]}`;
|
|
376
|
+
}
|
|
377
|
+
function I({ icon: e, label: o, value: n, subtext: d, color: f }) {
|
|
378
|
+
return /* @__PURE__ */ i("div", { className: "rounded-lg border border-border bg-surface p-3 min-w-0", children: [
|
|
379
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 mb-1 min-w-0", children: [
|
|
309
380
|
/* @__PURE__ */ t(e, { className: "h-3.5 w-3.5 text-foreground-subtle flex-shrink-0" }),
|
|
310
381
|
/* @__PURE__ */ t(
|
|
311
382
|
"span",
|
|
312
383
|
{
|
|
313
384
|
className: "text-[10px] text-foreground-subtle uppercase tracking-wider truncate",
|
|
314
|
-
title:
|
|
315
|
-
children:
|
|
385
|
+
title: o,
|
|
386
|
+
children: o
|
|
316
387
|
}
|
|
317
388
|
)
|
|
318
389
|
] }),
|
|
@@ -320,43 +391,43 @@ function re({ icon: e, label: i, value: r, subtext: u, color: f }) {
|
|
|
320
391
|
"p",
|
|
321
392
|
{
|
|
322
393
|
className: `text-lg font-semibold leading-tight truncate ${f ?? "text-foreground"}`,
|
|
323
|
-
title:
|
|
324
|
-
children:
|
|
394
|
+
title: n,
|
|
395
|
+
children: n
|
|
325
396
|
}
|
|
326
397
|
),
|
|
327
|
-
|
|
398
|
+
d && /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle mt-0.5 truncate", title: d, children: d })
|
|
328
399
|
] });
|
|
329
400
|
}
|
|
330
|
-
const
|
|
401
|
+
const Je = {
|
|
331
402
|
polygon: "Polygon",
|
|
332
403
|
tripwire: "Tripwire"
|
|
333
|
-
},
|
|
404
|
+
}, Ye = {
|
|
334
405
|
polygon: "bg-info/10 text-info",
|
|
335
406
|
tripwire: "bg-warning/10 text-warning"
|
|
336
407
|
};
|
|
337
|
-
function
|
|
408
|
+
function et({
|
|
338
409
|
zones: e,
|
|
339
|
-
selectedZoneId:
|
|
340
|
-
drawingKind:
|
|
341
|
-
onSelectZone:
|
|
410
|
+
selectedZoneId: o,
|
|
411
|
+
drawingKind: n,
|
|
412
|
+
onSelectZone: d,
|
|
342
413
|
onDeleteZone: f,
|
|
343
414
|
onStartDraw: s,
|
|
344
|
-
onCancelDraw:
|
|
415
|
+
onCancelDraw: a
|
|
345
416
|
}) {
|
|
346
|
-
return /* @__PURE__ */
|
|
347
|
-
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children:
|
|
417
|
+
return /* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: [
|
|
418
|
+
/* @__PURE__ */ t("div", { className: "flex items-center gap-1", children: n ? /* @__PURE__ */ i(
|
|
348
419
|
"button",
|
|
349
420
|
{
|
|
350
421
|
type: "button",
|
|
351
|
-
onClick:
|
|
422
|
+
onClick: a,
|
|
352
423
|
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
424
|
title: "Cancel drawing",
|
|
354
425
|
children: [
|
|
355
|
-
/* @__PURE__ */ t(
|
|
426
|
+
/* @__PURE__ */ t(ne, { className: "h-3.5 w-3.5" }),
|
|
356
427
|
/* @__PURE__ */ t("span", { children: "Cancel" })
|
|
357
428
|
]
|
|
358
429
|
}
|
|
359
|
-
) : /* @__PURE__ */
|
|
430
|
+
) : /* @__PURE__ */ i(J, { children: [
|
|
360
431
|
/* @__PURE__ */ t(
|
|
361
432
|
"button",
|
|
362
433
|
{
|
|
@@ -365,7 +436,7 @@ function Zt({
|
|
|
365
436
|
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
437
|
title: "Add polygon zone",
|
|
367
438
|
"aria-label": "Add polygon zone",
|
|
368
|
-
children: /* @__PURE__ */ t(
|
|
439
|
+
children: /* @__PURE__ */ t(Ee, { className: "h-4 w-4" })
|
|
369
440
|
}
|
|
370
441
|
),
|
|
371
442
|
/* @__PURE__ */ t(
|
|
@@ -376,34 +447,34 @@ function Zt({
|
|
|
376
447
|
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
448
|
title: "Add tripwire",
|
|
378
449
|
"aria-label": "Add tripwire",
|
|
379
|
-
children: /* @__PURE__ */ t(
|
|
450
|
+
children: /* @__PURE__ */ t(je, { className: "h-5 w-5 stroke-[2.5]" })
|
|
380
451
|
}
|
|
381
452
|
)
|
|
382
453
|
] }) }),
|
|
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__ */
|
|
454
|
+
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((r) => {
|
|
455
|
+
const h = r.id === o;
|
|
456
|
+
return /* @__PURE__ */ i(
|
|
386
457
|
"div",
|
|
387
458
|
{
|
|
388
459
|
className: [
|
|
389
460
|
"flex items-center gap-1.5 rounded border px-1.5 py-1 cursor-pointer transition-colors",
|
|
390
|
-
|
|
461
|
+
h ? "border-primary/50 bg-primary/10" : "border-border bg-surface hover:bg-surface-hover"
|
|
391
462
|
].join(" "),
|
|
392
|
-
onClick: () =>
|
|
463
|
+
onClick: () => d(h ? null : r.id),
|
|
393
464
|
children: [
|
|
394
465
|
/* @__PURE__ */ t(
|
|
395
466
|
"div",
|
|
396
467
|
{
|
|
397
468
|
className: "h-2.5 w-2.5 rounded-sm flex-shrink-0",
|
|
398
|
-
style: { backgroundColor:
|
|
469
|
+
style: { backgroundColor: r.color }
|
|
399
470
|
}
|
|
400
471
|
),
|
|
401
|
-
/* @__PURE__ */ t("span", { className: "flex-1 truncate text-[11px] font-medium text-foreground", children:
|
|
472
|
+
/* @__PURE__ */ t("span", { className: "flex-1 truncate text-[11px] font-medium text-foreground", children: r.name }),
|
|
402
473
|
/* @__PURE__ */ t(
|
|
403
474
|
"span",
|
|
404
475
|
{
|
|
405
|
-
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${
|
|
406
|
-
children:
|
|
476
|
+
className: `inline-flex items-center rounded-full px-1.5 py-0.5 text-[9px] font-medium flex-shrink-0 ${Ye[r.kind]}`,
|
|
477
|
+
children: Je[r.kind]
|
|
407
478
|
}
|
|
408
479
|
),
|
|
409
480
|
/* @__PURE__ */ t(
|
|
@@ -412,20 +483,20 @@ function Zt({
|
|
|
412
483
|
type: "button",
|
|
413
484
|
title: "Delete zone",
|
|
414
485
|
className: "p-0.5 text-foreground-subtle hover:text-danger rounded transition-colors flex-shrink-0",
|
|
415
|
-
onClick: (
|
|
416
|
-
|
|
486
|
+
onClick: (l) => {
|
|
487
|
+
l.stopPropagation(), f(r.id);
|
|
417
488
|
},
|
|
418
|
-
children: /* @__PURE__ */ t(
|
|
489
|
+
children: /* @__PURE__ */ t(H, { className: "h-3 w-3" })
|
|
419
490
|
}
|
|
420
491
|
)
|
|
421
492
|
]
|
|
422
493
|
},
|
|
423
|
-
|
|
494
|
+
r.id
|
|
424
495
|
);
|
|
425
496
|
}) })
|
|
426
497
|
] });
|
|
427
498
|
}
|
|
428
|
-
const
|
|
499
|
+
const tt = [
|
|
429
500
|
"#3b82f6",
|
|
430
501
|
// blue
|
|
431
502
|
"#10b981",
|
|
@@ -443,10 +514,10 @@ const At = [
|
|
|
443
514
|
"#ec4899"
|
|
444
515
|
// pink
|
|
445
516
|
];
|
|
446
|
-
function
|
|
447
|
-
const f =
|
|
448
|
-
return /* @__PURE__ */
|
|
449
|
-
/* @__PURE__ */
|
|
517
|
+
function nt({ zone: e, onSave: o, onDiscard: n, onDelete: d }) {
|
|
518
|
+
const f = z(), s = (r) => f?.updateDraft({ name: r }), a = (r) => f?.updateDraft({ color: r });
|
|
519
|
+
return /* @__PURE__ */ i("div", { className: "flex flex-col gap-2", children: [
|
|
520
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between", children: [
|
|
450
521
|
/* @__PURE__ */ t("h3", { className: "text-[10px] font-semibold text-foreground-subtle uppercase tracking-wider", children: "Editing" }),
|
|
451
522
|
/* @__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
523
|
] }),
|
|
@@ -454,101 +525,101 @@ function Ft({ zone: e, onSave: i, onDiscard: r, onDelete: u }) {
|
|
|
454
525
|
"input",
|
|
455
526
|
{
|
|
456
527
|
type: "text",
|
|
457
|
-
className:
|
|
528
|
+
className: K,
|
|
458
529
|
value: e.name,
|
|
459
530
|
autoFocus: !0,
|
|
460
|
-
onChange: (
|
|
461
|
-
onKeyDown: (
|
|
462
|
-
|
|
531
|
+
onChange: (r) => s(r.target.value),
|
|
532
|
+
onKeyDown: (r) => {
|
|
533
|
+
r.key === "Enter" ? (r.preventDefault(), o()) : r.key === "Escape" && (r.preventDefault(), n());
|
|
463
534
|
},
|
|
464
535
|
placeholder: "Zone name"
|
|
465
536
|
}
|
|
466
537
|
),
|
|
467
|
-
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children:
|
|
538
|
+
/* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: tt.map((r) => /* @__PURE__ */ t(
|
|
468
539
|
"button",
|
|
469
540
|
{
|
|
470
541
|
type: "button",
|
|
471
|
-
title:
|
|
542
|
+
title: r,
|
|
472
543
|
className: [
|
|
473
544
|
"h-4 w-4 rounded border-2 cursor-pointer transition-transform hover:scale-110",
|
|
474
|
-
e.color ===
|
|
545
|
+
e.color === r ? "border-white scale-110" : "border-transparent"
|
|
475
546
|
].join(" "),
|
|
476
|
-
style: { backgroundColor:
|
|
477
|
-
onClick: () =>
|
|
547
|
+
style: { backgroundColor: r },
|
|
548
|
+
onClick: () => a(r)
|
|
478
549
|
},
|
|
479
|
-
|
|
550
|
+
r
|
|
480
551
|
)) }),
|
|
481
|
-
/* @__PURE__ */
|
|
552
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
482
553
|
/* @__PURE__ */ t(
|
|
483
554
|
"input",
|
|
484
555
|
{
|
|
485
556
|
type: "color",
|
|
486
557
|
className: "h-6 w-6 rounded border border-border bg-background cursor-pointer p-0.5",
|
|
487
558
|
value: e.color,
|
|
488
|
-
onChange: (
|
|
559
|
+
onChange: (r) => a(r.target.value)
|
|
489
560
|
}
|
|
490
561
|
),
|
|
491
562
|
/* @__PURE__ */ t(
|
|
492
563
|
"input",
|
|
493
564
|
{
|
|
494
565
|
type: "text",
|
|
495
|
-
className: `${
|
|
566
|
+
className: `${K} font-mono`,
|
|
496
567
|
value: e.color,
|
|
497
568
|
placeholder: "#000000",
|
|
498
|
-
onChange: (
|
|
569
|
+
onChange: (r) => a(r.target.value)
|
|
499
570
|
}
|
|
500
571
|
)
|
|
501
572
|
] }),
|
|
502
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ i("p", { className: "text-[9px] text-foreground-subtle leading-tight", children: [
|
|
503
574
|
e.kind === "tripwire" ? "2 points" : `${e.points.length} pts`,
|
|
504
575
|
e.points.length > 0 && " · drag handles to reshape"
|
|
505
576
|
] }),
|
|
506
|
-
/* @__PURE__ */
|
|
507
|
-
/* @__PURE__ */
|
|
577
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5", children: [
|
|
578
|
+
/* @__PURE__ */ i(
|
|
508
579
|
"button",
|
|
509
580
|
{
|
|
510
581
|
type: "button",
|
|
511
|
-
onClick:
|
|
582
|
+
onClick: o,
|
|
512
583
|
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
584
|
title: "Save changes (Enter)",
|
|
514
585
|
children: [
|
|
515
|
-
/* @__PURE__ */ t(
|
|
586
|
+
/* @__PURE__ */ t(Me, { className: "h-3 w-3" }),
|
|
516
587
|
"Save"
|
|
517
588
|
]
|
|
518
589
|
}
|
|
519
590
|
),
|
|
520
|
-
/* @__PURE__ */
|
|
591
|
+
/* @__PURE__ */ i(
|
|
521
592
|
"button",
|
|
522
593
|
{
|
|
523
594
|
type: "button",
|
|
524
|
-
onClick:
|
|
595
|
+
onClick: n,
|
|
525
596
|
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
597
|
title: "Discard changes (Esc)",
|
|
527
598
|
children: [
|
|
528
|
-
/* @__PURE__ */ t(
|
|
599
|
+
/* @__PURE__ */ t(ne, { className: "h-3 w-3" }),
|
|
529
600
|
"Discard"
|
|
530
601
|
]
|
|
531
602
|
}
|
|
532
603
|
)
|
|
533
604
|
] }),
|
|
534
|
-
/* @__PURE__ */
|
|
605
|
+
/* @__PURE__ */ i(
|
|
535
606
|
"button",
|
|
536
607
|
{
|
|
537
608
|
type: "button",
|
|
538
|
-
onClick:
|
|
539
|
-
className: `${
|
|
609
|
+
onClick: d,
|
|
610
|
+
className: `${se} w-full`,
|
|
540
611
|
children: [
|
|
541
|
-
/* @__PURE__ */ t(
|
|
612
|
+
/* @__PURE__ */ t(H, { className: "h-3 w-3" }),
|
|
542
613
|
"Delete"
|
|
543
614
|
]
|
|
544
615
|
}
|
|
545
616
|
)
|
|
546
617
|
] });
|
|
547
618
|
}
|
|
548
|
-
const
|
|
619
|
+
const rt = xe.map(
|
|
549
620
|
(e) => ({ id: e.id, label: e.name })
|
|
550
621
|
);
|
|
551
|
-
function
|
|
622
|
+
function ot(e) {
|
|
552
623
|
return {
|
|
553
624
|
id: e.id,
|
|
554
625
|
name: e.name ?? "",
|
|
@@ -558,127 +629,127 @@ function Et(e) {
|
|
|
558
629
|
enabled: e.enabled !== !1
|
|
559
630
|
};
|
|
560
631
|
}
|
|
561
|
-
function
|
|
562
|
-
const
|
|
632
|
+
function at(e) {
|
|
633
|
+
const o = {
|
|
563
634
|
id: e.id,
|
|
564
635
|
zoneIds: e.zoneIds,
|
|
565
636
|
mode: e.mode,
|
|
566
637
|
enabled: e.enabled
|
|
567
638
|
};
|
|
568
|
-
return e.name && (
|
|
639
|
+
return e.name && (o.name = e.name), e.classFilter.length > 0 && (o.classFilter = e.classFilter), o;
|
|
569
640
|
}
|
|
570
|
-
function
|
|
571
|
-
const f =
|
|
572
|
-
() => f?.[
|
|
573
|
-
[f,
|
|
574
|
-
), [
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
}, [s,
|
|
578
|
-
const
|
|
579
|
-
|
|
580
|
-
...
|
|
641
|
+
function G({ dev: e, stage: o, zones: n, title: d }) {
|
|
642
|
+
const f = V(e?.state.zoneRules), s = M(
|
|
643
|
+
() => f?.[o] ?? [],
|
|
644
|
+
[f, o]
|
|
645
|
+
), [a, r] = j([]), [h, l] = j(!1), [v, C] = j(!1), [N, D] = j(null);
|
|
646
|
+
be(() => {
|
|
647
|
+
h || r(s.map(ot));
|
|
648
|
+
}, [s, h]);
|
|
649
|
+
const S = () => {
|
|
650
|
+
r((c) => [
|
|
651
|
+
...c,
|
|
581
652
|
{
|
|
582
653
|
id: crypto.randomUUID(),
|
|
583
654
|
name: "",
|
|
584
|
-
zoneIds:
|
|
655
|
+
zoneIds: n[0] ? [n[0].id] : [],
|
|
585
656
|
mode: "exclude",
|
|
586
657
|
classFilter: [],
|
|
587
658
|
enabled: !0
|
|
588
659
|
}
|
|
589
|
-
]),
|
|
590
|
-
},
|
|
591
|
-
|
|
592
|
-
(
|
|
593
|
-
if (
|
|
594
|
-
const
|
|
595
|
-
return { ...
|
|
660
|
+
]), l(!0);
|
|
661
|
+
}, u = (c, x) => {
|
|
662
|
+
r(
|
|
663
|
+
(b) => b.map((m, $) => {
|
|
664
|
+
if ($ !== c) return m;
|
|
665
|
+
const Z = m.classFilter.includes(x) ? m.classFilter.filter((F) => F !== x) : [...m.classFilter, x];
|
|
666
|
+
return { ...m, classFilter: Z };
|
|
596
667
|
})
|
|
597
|
-
),
|
|
598
|
-
},
|
|
599
|
-
|
|
600
|
-
(
|
|
601
|
-
if (
|
|
602
|
-
const
|
|
603
|
-
return { ...
|
|
668
|
+
), l(!0);
|
|
669
|
+
}, y = (c, x) => {
|
|
670
|
+
r(
|
|
671
|
+
(b) => b.map((m, $) => {
|
|
672
|
+
if ($ !== c) return m;
|
|
673
|
+
const Z = m.zoneIds.includes(x) ? m.zoneIds.filter((F) => F !== x) : [...m.zoneIds, x];
|
|
674
|
+
return { ...m, zoneIds: Z };
|
|
604
675
|
})
|
|
605
|
-
),
|
|
606
|
-
},
|
|
607
|
-
|
|
608
|
-
},
|
|
609
|
-
|
|
610
|
-
},
|
|
676
|
+
), l(!0);
|
|
677
|
+
}, _ = (c) => {
|
|
678
|
+
r((x) => x.filter((b, m) => m !== c)), l(!0);
|
|
679
|
+
}, p = (c, x) => {
|
|
680
|
+
r((b) => b.map((m, $) => $ === c ? { ...m, ...x } : m)), l(!0);
|
|
681
|
+
}, g = async () => {
|
|
611
682
|
if (e?.zoneRules) {
|
|
612
|
-
|
|
683
|
+
C(!0), D(null);
|
|
613
684
|
try {
|
|
614
|
-
await e.zoneRules.setRules({ stage:
|
|
615
|
-
} catch (
|
|
616
|
-
|
|
685
|
+
await e.zoneRules.setRules({ stage: o, rules: a.map(at) }), l(!1);
|
|
686
|
+
} catch (c) {
|
|
687
|
+
D(c instanceof Error ? c.message : String(c));
|
|
617
688
|
} finally {
|
|
618
|
-
|
|
689
|
+
C(!1);
|
|
619
690
|
}
|
|
620
691
|
}
|
|
621
|
-
},
|
|
622
|
-
return /* @__PURE__ */
|
|
623
|
-
/* @__PURE__ */
|
|
624
|
-
/* @__PURE__ */ t("h3", { className: `${
|
|
625
|
-
/* @__PURE__ */
|
|
626
|
-
/* @__PURE__ */
|
|
692
|
+
}, A = h && !!e?.zoneRules && !v;
|
|
693
|
+
return /* @__PURE__ */ i("div", { className: "rounded-md border border-border bg-surface/40 p-2.5", children: [
|
|
694
|
+
/* @__PURE__ */ i("div", { className: "flex items-center justify-between mb-2 gap-2", children: [
|
|
695
|
+
/* @__PURE__ */ t("h3", { className: `${Y} truncate`, children: d ?? `${o === "motion" ? "Motion" : "Detection"} Rules` }),
|
|
696
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1 flex-shrink-0", children: [
|
|
697
|
+
/* @__PURE__ */ i(
|
|
627
698
|
"button",
|
|
628
699
|
{
|
|
629
700
|
type: "button",
|
|
630
|
-
onClick:
|
|
631
|
-
disabled:
|
|
632
|
-
className:
|
|
701
|
+
onClick: S,
|
|
702
|
+
disabled: n.length === 0 || !e,
|
|
703
|
+
className: ie,
|
|
633
704
|
title: "Add rule",
|
|
634
705
|
children: [
|
|
635
|
-
/* @__PURE__ */ t(
|
|
706
|
+
/* @__PURE__ */ t(qe, { className: "h-2.5 w-2.5" }),
|
|
636
707
|
" Add"
|
|
637
708
|
]
|
|
638
709
|
}
|
|
639
710
|
),
|
|
640
|
-
/* @__PURE__ */
|
|
711
|
+
/* @__PURE__ */ i(
|
|
641
712
|
"button",
|
|
642
713
|
{
|
|
643
714
|
type: "button",
|
|
644
715
|
onClick: () => {
|
|
645
|
-
|
|
716
|
+
g();
|
|
646
717
|
},
|
|
647
|
-
disabled: !
|
|
648
|
-
className:
|
|
718
|
+
disabled: !A,
|
|
719
|
+
className: le,
|
|
649
720
|
children: [
|
|
650
|
-
/* @__PURE__ */ t(
|
|
651
|
-
|
|
721
|
+
/* @__PURE__ */ t(Oe, { className: "h-2.5 w-2.5" }),
|
|
722
|
+
v ? "…" : "Save"
|
|
652
723
|
]
|
|
653
724
|
}
|
|
654
725
|
)
|
|
655
726
|
] })
|
|
656
727
|
] }),
|
|
657
|
-
|
|
728
|
+
a.length === 0 ? /* @__PURE__ */ t("p", { className: "text-[10px] text-foreground-subtle italic px-1 py-1.5 leading-tight", children: n.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: a.map((c, x) => /* @__PURE__ */ i(
|
|
658
729
|
"div",
|
|
659
730
|
{
|
|
660
731
|
className: "rounded border border-border/50 bg-background/40 px-2 py-1.5 flex flex-col gap-1.5 overflow-hidden",
|
|
661
732
|
children: [
|
|
662
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ i("div", { className: "grid grid-cols-[auto_1fr_auto] items-center gap-1.5", children: [
|
|
663
734
|
/* @__PURE__ */ t(
|
|
664
735
|
"button",
|
|
665
736
|
{
|
|
666
737
|
type: "button",
|
|
667
738
|
role: "switch",
|
|
668
|
-
"aria-checked":
|
|
669
|
-
"aria-label":
|
|
670
|
-
title:
|
|
671
|
-
onClick: () =>
|
|
739
|
+
"aria-checked": c.enabled,
|
|
740
|
+
"aria-label": c.enabled ? "Disable rule" : "Enable rule",
|
|
741
|
+
title: c.enabled ? "Rule is active — click to disable" : "Rule is disabled — click to enable",
|
|
742
|
+
onClick: () => p(x, { enabled: !c.enabled }),
|
|
672
743
|
className: [
|
|
673
744
|
"inline-flex items-center justify-center h-5 w-9 rounded-full border transition-colors flex-shrink-0",
|
|
674
|
-
|
|
745
|
+
c.enabled ? "border-primary/50 bg-primary/20 text-primary" : "border-border bg-surface text-foreground-subtle"
|
|
675
746
|
].join(" "),
|
|
676
747
|
children: /* @__PURE__ */ t(
|
|
677
748
|
"span",
|
|
678
749
|
{
|
|
679
750
|
className: [
|
|
680
751
|
"h-3 w-3 rounded-full transition-transform",
|
|
681
|
-
|
|
752
|
+
c.enabled ? "translate-x-1.5 bg-primary" : "-translate-x-1.5 bg-foreground-subtle"
|
|
682
753
|
].join(" ")
|
|
683
754
|
}
|
|
684
755
|
)
|
|
@@ -687,10 +758,10 @@ function ve({ dev: e, stage: i, zones: r, title: u }) {
|
|
|
687
758
|
/* @__PURE__ */ t(
|
|
688
759
|
"input",
|
|
689
760
|
{
|
|
690
|
-
className: `${
|
|
761
|
+
className: `${K} min-w-0`,
|
|
691
762
|
placeholder: "Rule name (optional)",
|
|
692
|
-
value:
|
|
693
|
-
onChange: (
|
|
763
|
+
value: c.name,
|
|
764
|
+
onChange: (b) => p(x, { name: b.target.value })
|
|
694
765
|
}
|
|
695
766
|
),
|
|
696
767
|
/* @__PURE__ */ t(
|
|
@@ -699,20 +770,20 @@ function ve({ dev: e, stage: i, zones: r, title: u }) {
|
|
|
699
770
|
type: "button",
|
|
700
771
|
title: "Remove rule",
|
|
701
772
|
"aria-label": "Remove rule",
|
|
702
|
-
onClick: () =>
|
|
773
|
+
onClick: () => _(x),
|
|
703
774
|
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(
|
|
775
|
+
children: /* @__PURE__ */ t(H, { className: "h-3.5 w-3.5" })
|
|
705
776
|
}
|
|
706
777
|
)
|
|
707
778
|
] }),
|
|
708
|
-
/* @__PURE__ */
|
|
779
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
709
780
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Mode" }),
|
|
710
781
|
/* @__PURE__ */ t(
|
|
711
782
|
"button",
|
|
712
783
|
{
|
|
713
784
|
type: "button",
|
|
714
|
-
onClick: () =>
|
|
715
|
-
className: `${
|
|
785
|
+
onClick: () => p(x, { mode: "include" }),
|
|
786
|
+
className: `${R} ${c.mode === "include" ? E : L}`,
|
|
716
787
|
children: "Include"
|
|
717
788
|
}
|
|
718
789
|
),
|
|
@@ -720,451 +791,72 @@ function ve({ dev: e, stage: i, zones: r, title: u }) {
|
|
|
720
791
|
"button",
|
|
721
792
|
{
|
|
722
793
|
type: "button",
|
|
723
|
-
onClick: () =>
|
|
724
|
-
className: `${
|
|
794
|
+
onClick: () => p(x, { mode: "exclude" }),
|
|
795
|
+
className: `${R} ${c.mode === "exclude" ? E : L}`,
|
|
725
796
|
children: "Exclude"
|
|
726
797
|
}
|
|
727
798
|
)
|
|
728
799
|
] }),
|
|
729
|
-
/* @__PURE__ */
|
|
800
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
730
801
|
/* @__PURE__ */ t("span", { className: "text-[9px] uppercase tracking-wider text-foreground-subtle w-12 sm:w-14 flex-shrink-0", children: "Zones" }),
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
return /* @__PURE__ */
|
|
802
|
+
n.length === 0 ? /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic", children: "none" }) : n.map((b) => {
|
|
803
|
+
const m = c.zoneIds.includes(b.id);
|
|
804
|
+
return /* @__PURE__ */ i(
|
|
734
805
|
"button",
|
|
735
806
|
{
|
|
736
807
|
type: "button",
|
|
737
|
-
onClick: () =>
|
|
738
|
-
className: `${
|
|
808
|
+
onClick: () => y(x, b.id),
|
|
809
|
+
className: `${R} ${m ? E : L}`,
|
|
739
810
|
children: [
|
|
740
811
|
/* @__PURE__ */ t(
|
|
741
812
|
"span",
|
|
742
813
|
{
|
|
743
814
|
className: "h-2 w-2 rounded-sm",
|
|
744
|
-
style: { backgroundColor:
|
|
815
|
+
style: { backgroundColor: b.color || "#3b82f6" }
|
|
745
816
|
}
|
|
746
817
|
),
|
|
747
|
-
/* @__PURE__ */ t("span", { className: "truncate max-w-[7rem]", children:
|
|
818
|
+
/* @__PURE__ */ t("span", { className: "truncate max-w-[7rem]", children: b.name || b.id })
|
|
748
819
|
]
|
|
749
820
|
},
|
|
750
|
-
|
|
821
|
+
b.id
|
|
751
822
|
);
|
|
752
823
|
})
|
|
753
824
|
] }),
|
|
754
|
-
/* @__PURE__ */
|
|
825
|
+
/* @__PURE__ */ i("div", { className: "flex items-center gap-1.5 flex-wrap", children: [
|
|
755
826
|
/* @__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
|
|
827
|
+
rt.map((b) => {
|
|
828
|
+
const m = c.classFilter.includes(b.id);
|
|
758
829
|
return /* @__PURE__ */ t(
|
|
759
830
|
"button",
|
|
760
831
|
{
|
|
761
832
|
type: "button",
|
|
762
|
-
onClick: () =>
|
|
763
|
-
className: `${
|
|
764
|
-
children:
|
|
833
|
+
onClick: () => u(x, b.id),
|
|
834
|
+
className: `${R} ${m ? E : L}`,
|
|
835
|
+
children: b.label
|
|
765
836
|
},
|
|
766
|
-
|
|
837
|
+
b.id
|
|
767
838
|
);
|
|
768
839
|
}),
|
|
769
|
-
|
|
840
|
+
c.classFilter.length === 0 && /* @__PURE__ */ t("span", { className: "text-[10px] text-foreground-subtle italic ml-1", children: "any" })
|
|
770
841
|
] })
|
|
771
842
|
]
|
|
772
843
|
},
|
|
773
|
-
|
|
844
|
+
c.id
|
|
774
845
|
)) }),
|
|
775
|
-
|
|
846
|
+
N && /* @__PURE__ */ t("p", { className: "mt-2 text-[10px] text-danger", children: N })
|
|
776
847
|
] });
|
|
777
848
|
}
|
|
778
|
-
function
|
|
779
|
-
|
|
780
|
-
}
|
|
781
|
-
function ce(e, i, r) {
|
|
782
|
-
return { x: e.x / i, y: e.y / r };
|
|
849
|
+
function st(e) {
|
|
850
|
+
const o = e.kind === "tripwire" ? { kind: "line", points: e.points } : { kind: "polygon", points: e.points };
|
|
851
|
+
return { id: e.id, label: e.name, color: e.color, shape: o };
|
|
783
852
|
}
|
|
784
|
-
function
|
|
785
|
-
return e
|
|
853
|
+
function it(e) {
|
|
854
|
+
return e === "line" ? "tripwire" : "polygon";
|
|
786
855
|
}
|
|
787
|
-
function
|
|
788
|
-
return e
|
|
856
|
+
function lt(e) {
|
|
857
|
+
return e === "tripwire" ? "line" : "polygon";
|
|
789
858
|
}
|
|
790
|
-
const
|
|
791
|
-
function jt({
|
|
792
|
-
zones: e,
|
|
793
|
-
selectedZoneId: i,
|
|
794
|
-
onSelectZone: r,
|
|
795
|
-
onZonePointsChange: u,
|
|
796
|
-
onZoneComplete: f,
|
|
797
|
-
drawingKind: s,
|
|
798
|
-
backdrop: l,
|
|
799
|
-
transparent: a = !1
|
|
800
|
-
}) {
|
|
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
|
-
X(() => {
|
|
803
|
-
if (!S) return;
|
|
804
|
-
const o = e.find((v) => v.id === S.zoneId);
|
|
805
|
-
if (!o) {
|
|
806
|
-
y(null);
|
|
807
|
-
return;
|
|
808
|
-
}
|
|
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
|
-
}
|
|
823
|
-
});
|
|
824
|
-
return p.observe(o), () => p.disconnect();
|
|
825
|
-
}, [a]);
|
|
826
|
-
const h = s !== null;
|
|
827
|
-
X(() => {
|
|
828
|
-
!h && b !== null && k(null);
|
|
829
|
-
}, [h, b]);
|
|
830
|
-
const Y = T(
|
|
831
|
-
(o) => {
|
|
832
|
-
if (!h) {
|
|
833
|
-
r(null);
|
|
834
|
-
return;
|
|
835
|
-
}
|
|
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
|
-
if (d.length === 0) {
|
|
842
|
-
$([x]);
|
|
843
|
-
return;
|
|
844
|
-
}
|
|
845
|
-
if (E && d.length === 1) {
|
|
846
|
-
const P = [...d, x], q = {
|
|
847
|
-
id: crypto.randomUUID(),
|
|
848
|
-
name: "Tripwire",
|
|
849
|
-
kind: "tripwire",
|
|
850
|
-
color: "#f59e0b",
|
|
851
|
-
points: P
|
|
852
|
-
};
|
|
853
|
-
f(q), $([]);
|
|
854
|
-
return;
|
|
855
|
-
}
|
|
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
|
-
id: crypto.randomUUID(),
|
|
861
|
-
name: "Zone",
|
|
862
|
-
kind: "polygon",
|
|
863
|
-
color: "#3b82f6",
|
|
864
|
-
points: d
|
|
865
|
-
};
|
|
866
|
-
f(K), $([]);
|
|
867
|
-
return;
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
$((P) => [...P, x]);
|
|
871
|
-
},
|
|
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
|
-
id: crypto.randomUUID(),
|
|
879
|
-
name: "Zone",
|
|
880
|
-
kind: "polygon",
|
|
881
|
-
color: "#3b82f6",
|
|
882
|
-
points: d
|
|
883
|
-
};
|
|
884
|
-
f(p), $([]);
|
|
885
|
-
},
|
|
886
|
-
[h, s, d, f]
|
|
887
|
-
), _ = se(null), w = se(null);
|
|
888
|
-
X(() => () => {
|
|
889
|
-
_.current !== null && cancelAnimationFrame(_.current);
|
|
890
|
-
}, []);
|
|
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
|
-
}));
|
|
900
|
-
},
|
|
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
|
-
);
|
|
909
|
-
}
|
|
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
|
-
);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
return /* @__PURE__ */ c(
|
|
918
|
-
"div",
|
|
919
|
-
{
|
|
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
|
-
children: [
|
|
924
|
-
l && !a ? /* @__PURE__ */ t(
|
|
925
|
-
"div",
|
|
926
|
-
{
|
|
927
|
-
className: "absolute inset-0 pointer-events-none [&>*]:w-full [&>*]:h-full [&>img]:object-cover [&>video]:object-cover",
|
|
928
|
-
style: { width: n.w, height: n.h },
|
|
929
|
-
children: l
|
|
930
|
-
}
|
|
931
|
-
) : null,
|
|
932
|
-
/* @__PURE__ */ c(
|
|
933
|
-
Je,
|
|
934
|
-
{
|
|
935
|
-
width: n.w,
|
|
936
|
-
height: n.h,
|
|
937
|
-
onClick: Y,
|
|
938
|
-
onDblClick: m,
|
|
939
|
-
onMouseMove: N,
|
|
940
|
-
children: [
|
|
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
|
-
] }),
|
|
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
|
-
{
|
|
950
|
-
onClick: (C) => {
|
|
951
|
-
C.cancelBubble = !0, h || r(o.id);
|
|
952
|
-
},
|
|
953
|
-
children: [
|
|
954
|
-
/* @__PURE__ */ c(
|
|
955
|
-
ie,
|
|
956
|
-
{
|
|
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
|
-
}) : void 0,
|
|
962
|
-
onDragStart: q ? () => {
|
|
963
|
-
L(o.id);
|
|
964
|
-
} : void 0,
|
|
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
|
-
} : void 0,
|
|
971
|
-
onMouseEnter: (C) => {
|
|
972
|
-
if (!q) return;
|
|
973
|
-
const D = C.target.getStage();
|
|
974
|
-
D && (D.container().style.cursor = "move");
|
|
975
|
-
},
|
|
976
|
-
onMouseLeave: (C) => {
|
|
977
|
-
if (!q) return;
|
|
978
|
-
const D = C.target.getStage();
|
|
979
|
-
D && (D.container().style.cursor = h ? "crosshair" : "default");
|
|
980
|
-
},
|
|
981
|
-
children: [
|
|
982
|
-
P ? /* @__PURE__ */ t(
|
|
983
|
-
et,
|
|
984
|
-
{
|
|
985
|
-
points: E,
|
|
986
|
-
stroke: v,
|
|
987
|
-
strokeWidth: p ? 3 : 2,
|
|
988
|
-
fill: v,
|
|
989
|
-
pointerLength: 10,
|
|
990
|
-
pointerWidth: 8,
|
|
991
|
-
opacity: p ? 1 : 0.8
|
|
992
|
-
}
|
|
993
|
-
) : /* @__PURE__ */ t(
|
|
994
|
-
V,
|
|
995
|
-
{
|
|
996
|
-
points: E,
|
|
997
|
-
closed: !0,
|
|
998
|
-
fill: v + (p ? Ot : Tt),
|
|
999
|
-
stroke: v,
|
|
1000
|
-
strokeWidth: p ? 2.5 : 1.5,
|
|
1001
|
-
opacity: p ? 1 : 0.85
|
|
1002
|
-
}
|
|
1003
|
-
),
|
|
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
|
-
return /* @__PURE__ */ t(
|
|
1007
|
-
tt,
|
|
1008
|
-
{
|
|
1009
|
-
x: W.x - I / 2,
|
|
1010
|
-
y: W.y - 7,
|
|
1011
|
-
width: I,
|
|
1012
|
-
align: "center",
|
|
1013
|
-
text: o.name,
|
|
1014
|
-
fontSize: 12,
|
|
1015
|
-
fill: v,
|
|
1016
|
-
stroke: "#000000",
|
|
1017
|
-
strokeWidth: 3,
|
|
1018
|
-
fillAfterStrokeEnabled: !0,
|
|
1019
|
-
fontStyle: "bold",
|
|
1020
|
-
listening: !1
|
|
1021
|
-
}
|
|
1022
|
-
);
|
|
1023
|
-
})()
|
|
1024
|
-
]
|
|
1025
|
-
}
|
|
1026
|
-
),
|
|
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
|
-
return /* @__PURE__ */ t(
|
|
1030
|
-
le,
|
|
1031
|
-
{
|
|
1032
|
-
x: j.x,
|
|
1033
|
-
y: j.y,
|
|
1034
|
-
radius: 5,
|
|
1035
|
-
fill: v,
|
|
1036
|
-
stroke: "#ffffff",
|
|
1037
|
-
strokeWidth: 1.5,
|
|
1038
|
-
draggable: !0,
|
|
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
|
-
});
|
|
1045
|
-
},
|
|
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
|
-
},
|
|
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
|
-
}
|
|
1055
|
-
},
|
|
1056
|
-
`pt-${D}`
|
|
1057
|
-
);
|
|
1058
|
-
}),
|
|
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
|
-
return /* @__PURE__ */ t(
|
|
1062
|
-
le,
|
|
1063
|
-
{
|
|
1064
|
-
x: I.x,
|
|
1065
|
-
y: I.y,
|
|
1066
|
-
radius: 4,
|
|
1067
|
-
fill: "#ffffff",
|
|
1068
|
-
stroke: v,
|
|
1069
|
-
strokeWidth: 1.5,
|
|
1070
|
-
opacity: 0.6,
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
];
|
|
1090
|
-
u(o.id, R);
|
|
1091
|
-
}
|
|
1092
|
-
},
|
|
1093
|
-
`mid-${D}`
|
|
1094
|
-
);
|
|
1095
|
-
})
|
|
1096
|
-
]
|
|
1097
|
-
},
|
|
1098
|
-
o.id
|
|
1099
|
-
);
|
|
1100
|
-
}) }),
|
|
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
|
-
{
|
|
1105
|
-
points: ke(d, n.w, n.h),
|
|
1106
|
-
stroke: "#6366f1",
|
|
1107
|
-
strokeWidth: 1.5,
|
|
1108
|
-
dash: [6, 3],
|
|
1109
|
-
opacity: 0.8
|
|
1110
|
-
}
|
|
1111
|
-
),
|
|
1112
|
-
d.length === 1 && s === "tripwire" && b && /* @__PURE__ */ t(
|
|
1113
|
-
V,
|
|
1114
|
-
{
|
|
1115
|
-
points: [
|
|
1116
|
-
d[0].x * n.w,
|
|
1117
|
-
d[0].y * n.h,
|
|
1118
|
-
b.x,
|
|
1119
|
-
b.y
|
|
1120
|
-
],
|
|
1121
|
-
stroke: "#f59e0b",
|
|
1122
|
-
strokeWidth: 1.5,
|
|
1123
|
-
dash: [6, 3],
|
|
1124
|
-
opacity: 0.7
|
|
1125
|
-
}
|
|
1126
|
-
),
|
|
1127
|
-
b && d.length >= 1 && s !== "tripwire" && /* @__PURE__ */ t(
|
|
1128
|
-
V,
|
|
1129
|
-
{
|
|
1130
|
-
points: [
|
|
1131
|
-
d[d.length - 1].x * n.w,
|
|
1132
|
-
d[d.length - 1].y * n.h,
|
|
1133
|
-
b.x,
|
|
1134
|
-
b.y
|
|
1135
|
-
],
|
|
1136
|
-
stroke: "#6366f1",
|
|
1137
|
-
strokeWidth: 1,
|
|
1138
|
-
dash: [4, 4],
|
|
1139
|
-
opacity: 0.5
|
|
1140
|
-
}
|
|
1141
|
-
),
|
|
1142
|
-
d.map((o, p) => {
|
|
1143
|
-
const v = z(o, n.w, n.h), x = p === 0;
|
|
1144
|
-
return /* @__PURE__ */ t(
|
|
1145
|
-
le,
|
|
1146
|
-
{
|
|
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
|
-
stroke: "#6366f1",
|
|
1152
|
-
strokeWidth: 1.5,
|
|
1153
|
-
opacity: 0.9
|
|
1154
|
-
},
|
|
1155
|
-
p
|
|
1156
|
-
);
|
|
1157
|
-
})
|
|
1158
|
-
] }) })
|
|
1159
|
-
]
|
|
1160
|
-
}
|
|
1161
|
-
),
|
|
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
|
-
]
|
|
1164
|
-
}
|
|
1165
|
-
);
|
|
1166
|
-
}
|
|
1167
|
-
const Wt = Se(jt), Bt = "#3b82f6", de = [
|
|
859
|
+
const ct = "#3b82f6", dt = ["polygon", "line"], q = [
|
|
1168
860
|
"#3b82f6",
|
|
1169
861
|
"#10b981",
|
|
1170
862
|
"#f59e0b",
|
|
@@ -1176,22 +868,22 @@ const Wt = Se(jt), Bt = "#3b82f6", de = [
|
|
|
1176
868
|
"#8b5cf6",
|
|
1177
869
|
"#14b8a6"
|
|
1178
870
|
];
|
|
1179
|
-
function
|
|
1180
|
-
const
|
|
1181
|
-
for (const
|
|
1182
|
-
if (!
|
|
1183
|
-
return
|
|
871
|
+
function ut(e) {
|
|
872
|
+
const o = new Set(e.map((n) => (n.color ?? "").toLowerCase()));
|
|
873
|
+
for (const n of q)
|
|
874
|
+
if (!o.has(n.toLowerCase())) return n;
|
|
875
|
+
return q[e.length % q.length];
|
|
1184
876
|
}
|
|
1185
|
-
function
|
|
877
|
+
function pt(e) {
|
|
1186
878
|
return {
|
|
1187
879
|
id: e.id,
|
|
1188
880
|
name: e.name,
|
|
1189
881
|
kind: e.kind,
|
|
1190
|
-
color: e.color ||
|
|
882
|
+
color: e.color || ct,
|
|
1191
883
|
points: [...e.polygon]
|
|
1192
884
|
};
|
|
1193
885
|
}
|
|
1194
|
-
function
|
|
886
|
+
function X(e) {
|
|
1195
887
|
return {
|
|
1196
888
|
id: e.id,
|
|
1197
889
|
name: e.name,
|
|
@@ -1200,84 +892,101 @@ function Ce(e) {
|
|
|
1200
892
|
color: e.color
|
|
1201
893
|
};
|
|
1202
894
|
}
|
|
1203
|
-
function
|
|
1204
|
-
const
|
|
1205
|
-
id:
|
|
1206
|
-
name:
|
|
1207
|
-
kind:
|
|
1208
|
-
color:
|
|
1209
|
-
points: [...
|
|
1210
|
-
} :
|
|
1211
|
-
async (
|
|
1212
|
-
|
|
895
|
+
function mt({ deviceId: e }) {
|
|
896
|
+
const o = B(), n = U(o.trpcClient, e), d = V(n?.state.zones), f = M(() => d?.zones ?? [], [d]), s = z(), a = s?.drawingKind ?? null, r = s?.selectedZoneId ?? null, h = s?.editingDraft ?? null, l = M(() => f.map((u) => h && h.id === u.id ? {
|
|
897
|
+
id: h.id,
|
|
898
|
+
name: h.name,
|
|
899
|
+
kind: h.kind,
|
|
900
|
+
color: h.color,
|
|
901
|
+
points: [...h.points]
|
|
902
|
+
} : pt(u)), [f, h]), v = M(() => l.map(st), [l]), C = w(
|
|
903
|
+
async (u) => {
|
|
904
|
+
if (u.kind !== "polygon" && u.kind !== "line") return;
|
|
905
|
+
const y = {
|
|
906
|
+
id: crypto.randomUUID(),
|
|
907
|
+
name: "",
|
|
908
|
+
kind: it(u.kind),
|
|
909
|
+
color: ut(l),
|
|
910
|
+
points: [...u.points]
|
|
911
|
+
};
|
|
1213
912
|
try {
|
|
1214
|
-
await
|
|
1215
|
-
} catch (
|
|
1216
|
-
console.error("zones.addZone failed",
|
|
913
|
+
await n?.zones?.addZone({ zone: X(y) });
|
|
914
|
+
} catch (_) {
|
|
915
|
+
console.error("zones.addZone failed", _);
|
|
1217
916
|
}
|
|
1218
|
-
s?.setSelectedZoneId(
|
|
917
|
+
s?.setSelectedZoneId(y.id), s?.setDrawingKind(null);
|
|
1219
918
|
},
|
|
1220
|
-
[
|
|
1221
|
-
),
|
|
1222
|
-
async (
|
|
1223
|
-
|
|
1224
|
-
|
|
919
|
+
[n, l, s]
|
|
920
|
+
), N = w(
|
|
921
|
+
async (u, y) => {
|
|
922
|
+
const _ = y.map((g) => ({ x: g.x, y: g.y }));
|
|
923
|
+
if (h && h.id === u) {
|
|
924
|
+
s?.updateDraft({ points: _ });
|
|
1225
925
|
return;
|
|
1226
926
|
}
|
|
1227
|
-
const
|
|
1228
|
-
if (
|
|
927
|
+
const p = l.find((g) => g.id === u);
|
|
928
|
+
if (p)
|
|
1229
929
|
try {
|
|
1230
|
-
await
|
|
1231
|
-
} catch (
|
|
1232
|
-
console.error("zones.updateZone failed",
|
|
930
|
+
await n?.zones?.updateZone({ zone: X({ ...p, points: _ }) });
|
|
931
|
+
} catch (g) {
|
|
932
|
+
console.error("zones.updateZone failed", g);
|
|
1233
933
|
}
|
|
1234
934
|
},
|
|
1235
|
-
[
|
|
1236
|
-
),
|
|
1237
|
-
(
|
|
1238
|
-
|
|
935
|
+
[n, l, h, s]
|
|
936
|
+
), D = w(
|
|
937
|
+
(u, y) => {
|
|
938
|
+
typeof u == "string" && (y.kind !== "polygon" && y.kind !== "line" || N(u, y.points));
|
|
939
|
+
},
|
|
940
|
+
[N]
|
|
941
|
+
), S = w(
|
|
942
|
+
(u) => {
|
|
943
|
+
if (u === null) {
|
|
1239
944
|
s?.discardDraft(), s?.setSelectedZoneId(null);
|
|
1240
945
|
return;
|
|
1241
946
|
}
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
947
|
+
if (typeof u != "string") return;
|
|
948
|
+
const y = l.find((_) => _.id === u);
|
|
949
|
+
if (!y) {
|
|
950
|
+
s?.setSelectedZoneId(u);
|
|
1245
951
|
return;
|
|
1246
952
|
}
|
|
1247
953
|
s?.enterDraft({
|
|
1248
|
-
id:
|
|
1249
|
-
kind:
|
|
1250
|
-
name:
|
|
1251
|
-
color:
|
|
1252
|
-
points:
|
|
954
|
+
id: y.id,
|
|
955
|
+
kind: y.kind,
|
|
956
|
+
name: y.name,
|
|
957
|
+
color: y.color,
|
|
958
|
+
points: y.points
|
|
1253
959
|
});
|
|
1254
960
|
},
|
|
1255
|
-
[
|
|
961
|
+
[l, s]
|
|
1256
962
|
);
|
|
1257
|
-
return
|
|
1258
|
-
|
|
963
|
+
return l.length === 0 && a === null ? null : /* @__PURE__ */ t(
|
|
964
|
+
ce,
|
|
1259
965
|
{
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
966
|
+
transparent: !0,
|
|
967
|
+
items: v,
|
|
968
|
+
supportedShapes: dt,
|
|
969
|
+
selectedId: r,
|
|
970
|
+
onSelect: S,
|
|
971
|
+
onShapeChange: D,
|
|
972
|
+
onDrawComplete: (u) => {
|
|
973
|
+
C(u);
|
|
974
|
+
},
|
|
975
|
+
drawingKind: a === null ? null : lt(a)
|
|
1267
976
|
}
|
|
1268
977
|
);
|
|
1269
978
|
}
|
|
1270
|
-
const
|
|
1271
|
-
function
|
|
979
|
+
const ft = ye(mt), ht = "#3b82f6";
|
|
980
|
+
function gt(e) {
|
|
1272
981
|
return {
|
|
1273
982
|
id: e.id,
|
|
1274
983
|
name: e.name,
|
|
1275
984
|
kind: e.kind,
|
|
1276
|
-
color: e.color ||
|
|
985
|
+
color: e.color || ht,
|
|
1277
986
|
points: [...e.polygon]
|
|
1278
987
|
};
|
|
1279
988
|
}
|
|
1280
|
-
function
|
|
989
|
+
function bt(e) {
|
|
1281
990
|
return {
|
|
1282
991
|
id: e.id,
|
|
1283
992
|
name: e.name,
|
|
@@ -1286,127 +995,127 @@ function zt(e) {
|
|
|
1286
995
|
color: e.color
|
|
1287
996
|
};
|
|
1288
997
|
}
|
|
1289
|
-
function
|
|
1290
|
-
const
|
|
998
|
+
function yt({ deviceId: e }) {
|
|
999
|
+
const o = B(), n = U(o.trpcClient, e), d = V(n?.state.zones), f = M(() => d?.zones ?? [], [d]), s = M(() => f.map(gt), [f]), a = z(), r = a?.drawingKind ?? null, h = a?.selectedZoneId ?? null, l = a?.editingDraft ?? null, v = M(
|
|
1291
1000
|
() => ({
|
|
1292
1001
|
id: "zones",
|
|
1293
1002
|
order: 100,
|
|
1294
1003
|
// above PTZ overlay (order 0) so handles aren't occluded
|
|
1295
|
-
node: /* @__PURE__ */ t(
|
|
1004
|
+
node: /* @__PURE__ */ t(ft, { deviceId: e })
|
|
1296
1005
|
}),
|
|
1297
1006
|
[e]
|
|
1298
1007
|
);
|
|
1299
|
-
|
|
1300
|
-
const
|
|
1301
|
-
(
|
|
1302
|
-
if (
|
|
1303
|
-
|
|
1008
|
+
de(v);
|
|
1009
|
+
const C = w(
|
|
1010
|
+
(p) => {
|
|
1011
|
+
if (p === null) {
|
|
1012
|
+
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
1304
1013
|
return;
|
|
1305
1014
|
}
|
|
1306
|
-
const
|
|
1307
|
-
|
|
1308
|
-
id:
|
|
1309
|
-
kind:
|
|
1310
|
-
name:
|
|
1311
|
-
color:
|
|
1312
|
-
points:
|
|
1015
|
+
const g = s.find((A) => A.id === p);
|
|
1016
|
+
g && a?.enterDraft({
|
|
1017
|
+
id: g.id,
|
|
1018
|
+
kind: g.kind,
|
|
1019
|
+
name: g.name,
|
|
1020
|
+
color: g.color,
|
|
1021
|
+
points: g.points
|
|
1313
1022
|
});
|
|
1314
1023
|
},
|
|
1315
|
-
[s,
|
|
1316
|
-
),
|
|
1317
|
-
const
|
|
1318
|
-
if (
|
|
1024
|
+
[s, a]
|
|
1025
|
+
), N = w(async () => {
|
|
1026
|
+
const p = a?.editingDraft;
|
|
1027
|
+
if (p) {
|
|
1319
1028
|
try {
|
|
1320
|
-
await
|
|
1321
|
-
zone:
|
|
1322
|
-
id:
|
|
1323
|
-
kind:
|
|
1324
|
-
name:
|
|
1325
|
-
color:
|
|
1326
|
-
points: [...
|
|
1029
|
+
await n?.zones?.updateZone({
|
|
1030
|
+
zone: bt({
|
|
1031
|
+
id: p.id,
|
|
1032
|
+
kind: p.kind,
|
|
1033
|
+
name: p.name,
|
|
1034
|
+
color: p.color,
|
|
1035
|
+
points: [...p.points]
|
|
1327
1036
|
})
|
|
1328
1037
|
});
|
|
1329
|
-
} catch (
|
|
1330
|
-
console.error("zones.updateZone failed",
|
|
1038
|
+
} catch (g) {
|
|
1039
|
+
console.error("zones.updateZone failed", g);
|
|
1331
1040
|
}
|
|
1332
|
-
|
|
1041
|
+
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
1333
1042
|
}
|
|
1334
|
-
}, [
|
|
1335
|
-
|
|
1336
|
-
}, [
|
|
1337
|
-
async (
|
|
1043
|
+
}, [n, a]), D = w(() => {
|
|
1044
|
+
a?.discardDraft(), a?.setSelectedZoneId(null);
|
|
1045
|
+
}, [a]), S = w(
|
|
1046
|
+
async (p) => {
|
|
1338
1047
|
try {
|
|
1339
|
-
await
|
|
1340
|
-
} catch (
|
|
1341
|
-
console.error("zones.removeZone failed",
|
|
1048
|
+
await n?.zones?.removeZone({ zoneId: p });
|
|
1049
|
+
} catch (g) {
|
|
1050
|
+
console.error("zones.removeZone failed", g);
|
|
1342
1051
|
}
|
|
1343
|
-
|
|
1052
|
+
a?.selectedZoneId === p && a.setSelectedZoneId(null), a?.editingDraft?.id === p && a.discardDraft();
|
|
1344
1053
|
},
|
|
1345
|
-
[
|
|
1346
|
-
),
|
|
1347
|
-
(
|
|
1348
|
-
|
|
1054
|
+
[n, a]
|
|
1055
|
+
), u = w(
|
|
1056
|
+
(p) => {
|
|
1057
|
+
a?.startDrawing(p);
|
|
1349
1058
|
},
|
|
1350
|
-
[
|
|
1351
|
-
),
|
|
1352
|
-
|
|
1353
|
-
}, [
|
|
1354
|
-
id:
|
|
1355
|
-
kind:
|
|
1356
|
-
name:
|
|
1357
|
-
color:
|
|
1358
|
-
points: [...
|
|
1359
|
-
}, [s,
|
|
1360
|
-
return /* @__PURE__ */
|
|
1361
|
-
/* @__PURE__ */
|
|
1362
|
-
/* @__PURE__ */ t("div", { className:
|
|
1363
|
-
/* @__PURE__ */ t("h2", { className:
|
|
1364
|
-
/* @__PURE__ */
|
|
1059
|
+
[a]
|
|
1060
|
+
), y = w(() => {
|
|
1061
|
+
a?.setDrawingKind(null);
|
|
1062
|
+
}, [a]), _ = M(() => !l || !s.find((g) => g.id === l.id) ? null : {
|
|
1063
|
+
id: l.id,
|
|
1064
|
+
kind: l.kind,
|
|
1065
|
+
name: l.name,
|
|
1066
|
+
color: l.color,
|
|
1067
|
+
points: [...l.points]
|
|
1068
|
+
}, [s, l]);
|
|
1069
|
+
return /* @__PURE__ */ i("div", { className: ue, children: [
|
|
1070
|
+
/* @__PURE__ */ i("div", { className: pe, children: [
|
|
1071
|
+
/* @__PURE__ */ t("div", { className: me, children: /* @__PURE__ */ i("div", { className: "min-w-0", children: [
|
|
1072
|
+
/* @__PURE__ */ t("h2", { className: Y, children: "Detection Zones" }),
|
|
1073
|
+
/* @__PURE__ */ i("p", { className: `${fe} mt-0.5 leading-tight`, children: [
|
|
1365
1074
|
"Pick a shape below or use the ",
|
|
1366
1075
|
/* @__PURE__ */ t("strong", { className: "text-foreground", children: "Zones" }),
|
|
1367
1076
|
" 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
1077
|
] })
|
|
1369
1078
|
] }) }),
|
|
1370
|
-
/* @__PURE__ */
|
|
1079
|
+
/* @__PURE__ */ i("div", { className: `${he} flex flex-col gap-3`, children: [
|
|
1371
1080
|
/* @__PURE__ */ t(
|
|
1372
|
-
|
|
1081
|
+
et,
|
|
1373
1082
|
{
|
|
1374
1083
|
zones: s,
|
|
1375
|
-
selectedZoneId:
|
|
1376
|
-
drawingKind:
|
|
1377
|
-
onSelectZone:
|
|
1378
|
-
onDeleteZone:
|
|
1379
|
-
onStartDraw:
|
|
1380
|
-
onCancelDraw:
|
|
1084
|
+
selectedZoneId: h,
|
|
1085
|
+
drawingKind: r,
|
|
1086
|
+
onSelectZone: C,
|
|
1087
|
+
onDeleteZone: S,
|
|
1088
|
+
onStartDraw: u,
|
|
1089
|
+
onCancelDraw: y
|
|
1381
1090
|
}
|
|
1382
1091
|
),
|
|
1383
|
-
|
|
1092
|
+
_ && /* @__PURE__ */ i(J, { children: [
|
|
1384
1093
|
/* @__PURE__ */ t("div", { className: "border-t border-border" }),
|
|
1385
1094
|
/* @__PURE__ */ t(
|
|
1386
|
-
|
|
1095
|
+
nt,
|
|
1387
1096
|
{
|
|
1388
|
-
zone:
|
|
1389
|
-
onSave:
|
|
1390
|
-
onDiscard:
|
|
1391
|
-
onDelete: () =>
|
|
1097
|
+
zone: _,
|
|
1098
|
+
onSave: N,
|
|
1099
|
+
onDiscard: D,
|
|
1100
|
+
onDelete: () => S(_.id)
|
|
1392
1101
|
}
|
|
1393
1102
|
)
|
|
1394
1103
|
] })
|
|
1395
1104
|
] })
|
|
1396
1105
|
] }),
|
|
1397
|
-
/* @__PURE__ */
|
|
1398
|
-
/* @__PURE__ */ t(
|
|
1399
|
-
/* @__PURE__ */ t(
|
|
1106
|
+
/* @__PURE__ */ i("div", { className: `grid grid-cols-1 2xl:grid-cols-2 ${ge}`, children: [
|
|
1107
|
+
/* @__PURE__ */ t(G, { dev: n, stage: "motion", zones: f }),
|
|
1108
|
+
/* @__PURE__ */ t(G, { dev: n, stage: "detection", zones: f })
|
|
1400
1109
|
] })
|
|
1401
1110
|
] });
|
|
1402
1111
|
}
|
|
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(
|
|
1112
|
+
function xt(e) {
|
|
1113
|
+
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(yt, { deviceId: e.deviceId });
|
|
1405
1114
|
}
|
|
1406
|
-
const
|
|
1407
|
-
"pipeline-quick-stats":
|
|
1408
|
-
"zone-editor":
|
|
1115
|
+
const Ct = {
|
|
1116
|
+
"pipeline-quick-stats": We,
|
|
1117
|
+
"zone-editor": xt
|
|
1409
1118
|
};
|
|
1410
1119
|
export {
|
|
1411
|
-
|
|
1120
|
+
Ct as default
|
|
1412
1121
|
};
|