@camstack/addon-post-analysis 0.1.19 → 0.2.0
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/dist-4mTLJ7BJ.mjs +20750 -0
- package/dist/dist-CS2K80so.js +20933 -0
- package/dist/embedding-encoder/index.js +977 -902
- package/dist/embedding-encoder/index.mjs +967 -860
- package/dist/enrichment-engine/index.js +834 -833
- package/dist/enrichment-engine/index.mjs +828 -832
- package/dist/pipeline-analytics/_stub.js +1680 -1397
- package/dist/pipeline-analytics/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-DOSUJ-U0.mjs +156 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DJvmVCso.mjs +26 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-B3Wx5J80.mjs +26 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.js-C0AuF9av.mjs +26 -0
- package/dist/pipeline-analytics/_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Bm-iyjmq.mjs +26 -0
- package/dist/pipeline-analytics/dist-CYZr2fwk.mjs +2726 -0
- package/dist/pipeline-analytics/hostInit-BazRS2O7.mjs +129 -0
- package/dist/pipeline-analytics/index.js +7133 -2558
- package/dist/pipeline-analytics/index.mjs +7124 -2557
- package/dist/pipeline-analytics/remoteEntry.js +134 -2973
- package/dist/pipeline-analytics/remoteEntry.ssr.js +33 -0
- package/dist/pipeline-analytics/virtualExposes-BgYzpJZG.mjs +27 -0
- package/dist/pipeline-analytics/virtual_mf-exposes-ssr___mfe_internal__addon_pipeline_analytics_widgets__remoteEntry_js-D7qgWCKX.mjs +10 -0
- package/dist/resolve-frame-5lMxmeI1.js +57 -0
- package/dist/resolve-frame-CT1T1tWy.mjs +44 -0
- package/package.json +26 -32
- package/dist/embedding-encoder/index.js.map +0 -1
- package/dist/embedding-encoder/index.mjs.map +0 -1
- package/dist/enrichment-engine/index.js.map +0 -1
- package/dist/enrichment-engine/index.mjs.map +0 -1
- package/dist/ffmpeg-config-DRONlBsj.mjs +0 -56
- package/dist/ffmpeg-config-DRONlBsj.mjs.map +0 -1
- package/dist/ffmpeg-config-uANz3sV5.js +0 -73
- package/dist/ffmpeg-config-uANz3sV5.js.map +0 -1
- package/dist/index-BFbwYH1P.js +0 -14343
- package/dist/index-BFbwYH1P.js.map +0 -1
- package/dist/index-BrTlzsrE.mjs +0 -14344
- package/dist/index-BrTlzsrE.mjs.map +0 -1
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/AudioHistoryChart.d.ts +0 -4
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/AudioMetricsPanel.d.ts +0 -10
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/DetectionHistoryChart.d.ts +0 -4
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/LiveStatsTab.d.ts +0 -5
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/MotionHistoryChart.d.ts +0 -4
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/OccupancyHistoryChart.d.ts +0 -4
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/OccupancyPanel.d.ts +0 -10
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/chart-utils.d.ts +0 -97
- package/dist/pipeline-analytics/@mf-types/compiled-types/pipeline-analytics/widgets/index.d.ts +0 -29
- package/dist/pipeline-analytics/@mf-types/widgets.d.ts +0 -2
- package/dist/pipeline-analytics/@mf-types.d.ts +0 -3
- package/dist/pipeline-analytics/@mf-types.zip +0 -0
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_sdk__loadShare__.mjs-h5aXOPSA.mjs +0 -12
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.mjs-NjF4kxzW.mjs +0 -19
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.mjs-7HAAnpQu.mjs +0 -18
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.mjs-DoWbefqS.mjs +0 -104
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_trpc_mf_1_client__loadShare__.mjs-52bfkwC8.mjs +0 -85
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_trpc_mf_1_react_mf_2_query__loadShare__.mjs-CVrnrGED.mjs +0 -62
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.mjs-BZTB2scQ.mjs +0 -88
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.mjs_commonjs-proxy-CJO5YKGV.mjs +0 -29
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.mjs-BsyrX6NO.mjs +0 -36
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_2_dom__loadShare__.mjs-Dp8hqYOB.mjs +0 -45
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_2_dom__loadShare__.mjs_commonjs-proxy-B0h0AGOH.mjs +0 -6
- package/dist/pipeline-analytics/__mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_2_dom_mf_1_client__loadShare__.mjs-BZjEt71l.mjs +0 -34
- package/dist/pipeline-analytics/_virtual_mf-localSharedImportMap___mfe_internal__addon_pipeline_analytics_widgets-kZBmgzMg.mjs +0 -156
- package/dist/pipeline-analytics/client-BlxIUpgf.mjs +0 -9836
- package/dist/pipeline-analytics/getErrorShape-BPSzUA7W-TlK8ipWe.mjs +0 -211
- package/dist/pipeline-analytics/hostInit-qBB1Thhi.mjs +0 -168
- package/dist/pipeline-analytics/index-BoL0rgZt.mjs +0 -435
- package/dist/pipeline-analytics/index-CR1aiZDH.mjs +0 -185
- package/dist/pipeline-analytics/index-CWkKuNLr.mjs +0 -232
- package/dist/pipeline-analytics/index-DlhiA9R0.mjs +0 -2603
- package/dist/pipeline-analytics/index-DtdgkNgf.mjs +0 -725
- package/dist/pipeline-analytics/index-Dw6Q30NI.mjs +0 -1655
- package/dist/pipeline-analytics/index-Dy2V7VOm.mjs +0 -14379
- package/dist/pipeline-analytics/index-i47purqY.mjs +0 -37880
- package/dist/pipeline-analytics/index-xncRG7-x.mjs +0 -2713
- package/dist/pipeline-analytics/index.js.map +0 -1
- package/dist/pipeline-analytics/index.mjs.map +0 -1
- package/dist/pipeline-analytics/jsx-runtime-Dlbl3gpr.mjs +0 -55
- package/dist/pipeline-analytics/schemas-ClCuS4qa.mjs +0 -3594
- package/dist/pipeline-analytics/virtualExposes-8FzWTdq3.mjs +0 -42
- package/dist/playlist-generator-EhPaB7Hn.js +0 -48
- package/dist/playlist-generator-EhPaB7Hn.js.map +0 -1
- package/dist/playlist-generator-VTkgn53O.mjs +0 -48
- package/dist/playlist-generator-VTkgn53O.mjs.map +0 -1
- package/dist/recording/index.js +0 -257
- package/dist/recording/index.js.map +0 -1
- package/dist/recording/index.mjs +0 -235
- package/dist/recording/index.mjs.map +0 -1
- package/dist/recording-coordinator-BoGr5moz.js +0 -1052
- package/dist/recording-coordinator-BoGr5moz.js.map +0 -1
- package/dist/recording-coordinator-CsYH9LqF.mjs +0 -1012
- package/dist/recording-coordinator-CsYH9LqF.mjs.map +0 -1
- package/dist/recording-db-gOgaoQh0.js +0 -348
- package/dist/recording-db-gOgaoQh0.js.map +0 -1
- package/dist/recording-db-lIkSMTLq.mjs +0 -348
- package/dist/recording-db-lIkSMTLq.mjs.map +0 -1
- package/dist/recording-service-facade-B9lG6OFn.mjs +0 -123
- package/dist/recording-service-facade-B9lG6OFn.mjs.map +0 -1
- package/dist/recording-service-facade-Do1PKlAL.js +0 -123
- package/dist/recording-service-facade-Do1PKlAL.js.map +0 -1
- package/dist/storage-estimator-CRpoQc9j.js +0 -72
- package/dist/storage-estimator-CRpoQc9j.js.map +0 -1
- package/dist/storage-estimator-DzD8gWJH.mjs +0 -72
- package/dist/storage-estimator-DzD8gWJH.mjs.map +0 -1
|
@@ -1,1463 +1,1746 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
]
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* @license lucide-react v0.511.0 - ISC
|
|
195
|
-
*
|
|
196
|
-
* This source code is licensed under the ISC license.
|
|
197
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
-
*/
|
|
199
|
-
const nt = [
|
|
200
|
-
["path", { d: "M12.75 7.09a3 3 0 0 1 2.16 2.16", key: "1d4wjd" }],
|
|
201
|
-
[
|
|
202
|
-
"path",
|
|
203
|
-
{
|
|
204
|
-
d: "M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",
|
|
205
|
-
key: "12yil7"
|
|
206
|
-
}
|
|
207
|
-
],
|
|
208
|
-
["path", { d: "m2 2 20 20", key: "1ooewy" }],
|
|
209
|
-
["path", { d: "M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533", key: "lhrkcz" }],
|
|
210
|
-
["path", { d: "M9.13 9.13a3 3 0 0 0 3.74 3.74", key: "13wojd" }]
|
|
211
|
-
], rt = j("map-pin-off", nt);
|
|
212
|
-
/**
|
|
213
|
-
* @license lucide-react v0.511.0 - ISC
|
|
214
|
-
*
|
|
215
|
-
* This source code is licensed under the ISC license.
|
|
216
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
217
|
-
*/
|
|
218
|
-
const ot = [
|
|
219
|
-
["line", { x1: "2", x2: "22", y1: "2", y2: "22", key: "a6p6uj" }],
|
|
220
|
-
["path", { d: "M18.89 13.23A7.12 7.12 0 0 0 19 12v-2", key: "80xlxr" }],
|
|
221
|
-
["path", { d: "M5 10v2a7 7 0 0 0 12 5", key: "p2k8kg" }],
|
|
222
|
-
["path", { d: "M15 9.34V5a3 3 0 0 0-5.68-1.33", key: "1gzdoj" }],
|
|
223
|
-
["path", { d: "M9 9v3a3 3 0 0 0 5.12 2.12", key: "r2i35w" }],
|
|
224
|
-
["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }]
|
|
225
|
-
], st = j("mic-off", ot);
|
|
226
|
-
/**
|
|
227
|
-
* @license lucide-react v0.511.0 - ISC
|
|
228
|
-
*
|
|
229
|
-
* This source code is licensed under the ISC license.
|
|
230
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
231
|
-
*/
|
|
232
|
-
const at = [
|
|
233
|
-
["path", { d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z", key: "131961" }],
|
|
234
|
-
["path", { d: "M19 10v2a7 7 0 0 1-14 0v-2", key: "1vc78b" }],
|
|
235
|
-
["line", { x1: "12", x2: "12", y1: "19", y2: "22", key: "x3vr5v" }]
|
|
236
|
-
], it = j("mic", at);
|
|
237
|
-
function ce({
|
|
238
|
-
presets: e,
|
|
239
|
-
value: t,
|
|
240
|
-
onChange: o
|
|
241
|
-
}) {
|
|
242
|
-
return /* @__PURE__ */ n("div", { className: "flex items-center gap-1 border border-border rounded-md p-0.5 bg-background", children: e.map(({ id: r, label: a }) => /* @__PURE__ */ n(
|
|
243
|
-
"button",
|
|
244
|
-
{
|
|
245
|
-
type: "button",
|
|
246
|
-
onClick: () => o(r),
|
|
247
|
-
className: `px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${t === r ? "bg-primary/10 text-primary" : "text-foreground-subtle hover:text-foreground"}`,
|
|
248
|
-
children: a
|
|
249
|
-
},
|
|
250
|
-
r
|
|
251
|
-
)) });
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, t as a } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare__react__loadShare__.js-C0AuF9av.mjs";
|
|
2
|
+
import { t as o } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_tanstack_mf_1_react_mf_2_query__loadShare__.js-B3Wx5J80.mjs";
|
|
3
|
+
import { a as s, i as c, n as l, o as u, r as d, s as f, t as p } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DJvmVCso.mjs";
|
|
4
|
+
import { n as m, r as h, t as g } from "./_virtual_mf___mfe_internal__addon_pipeline_analytics_widgets__loadShare__react_mf_1_jsx_mf_2_runtime__loadShare__.js-Bm-iyjmq.mjs";
|
|
5
|
+
//#region ../../node_modules/lucide-react/dist/esm/shared/src/utils.js
|
|
6
|
+
var _ = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), v = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), y = (e) => {
|
|
7
|
+
let t = v(e);
|
|
8
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
9
|
+
}, b = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), x = (e) => {
|
|
10
|
+
for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
|
|
11
|
+
}, S = {
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
width: 24,
|
|
14
|
+
height: 24,
|
|
15
|
+
viewBox: "0 0 24 24",
|
|
16
|
+
fill: "none",
|
|
17
|
+
stroke: "currentColor",
|
|
18
|
+
strokeWidth: 2,
|
|
19
|
+
strokeLinecap: "round",
|
|
20
|
+
strokeLinejoin: "round"
|
|
21
|
+
}, C = n(({ color: e = "currentColor", size: t = 24, strokeWidth: n = 2, absoluteStrokeWidth: r, className: i = "", children: o, iconNode: s, ...c }, l) => a("svg", {
|
|
22
|
+
ref: l,
|
|
23
|
+
...S,
|
|
24
|
+
width: t,
|
|
25
|
+
height: t,
|
|
26
|
+
stroke: e,
|
|
27
|
+
strokeWidth: r ? Number(n) * 24 / Number(t) : n,
|
|
28
|
+
className: b("lucide", i),
|
|
29
|
+
...!o && !x(c) && { "aria-hidden": "true" },
|
|
30
|
+
...c
|
|
31
|
+
}, [...s.map(([e, t]) => a(e, t)), ...Array.isArray(o) ? o : [o]])), w = (e, t) => {
|
|
32
|
+
let r = n(({ className: n, ...r }, i) => a(C, {
|
|
33
|
+
ref: i,
|
|
34
|
+
iconNode: t,
|
|
35
|
+
className: b(`lucide-${_(y(e))}`, `lucide-${e}`, n),
|
|
36
|
+
...r
|
|
37
|
+
}));
|
|
38
|
+
return r.displayName = y(e), r;
|
|
39
|
+
}, T = w("activity", [["path", {
|
|
40
|
+
d: "M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",
|
|
41
|
+
key: "169zse"
|
|
42
|
+
}]]), E = w("boxes", [
|
|
43
|
+
["path", {
|
|
44
|
+
d: "M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",
|
|
45
|
+
key: "lc1i9w"
|
|
46
|
+
}],
|
|
47
|
+
["path", {
|
|
48
|
+
d: "m7 16.5-4.74-2.85",
|
|
49
|
+
key: "1o9zyk"
|
|
50
|
+
}],
|
|
51
|
+
["path", {
|
|
52
|
+
d: "m7 16.5 5-3",
|
|
53
|
+
key: "va8pkn"
|
|
54
|
+
}],
|
|
55
|
+
["path", {
|
|
56
|
+
d: "M7 16.5v5.17",
|
|
57
|
+
key: "jnp8gn"
|
|
58
|
+
}],
|
|
59
|
+
["path", {
|
|
60
|
+
d: "M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",
|
|
61
|
+
key: "8zsnat"
|
|
62
|
+
}],
|
|
63
|
+
["path", {
|
|
64
|
+
d: "m17 16.5-5-3",
|
|
65
|
+
key: "8arw3v"
|
|
66
|
+
}],
|
|
67
|
+
["path", {
|
|
68
|
+
d: "m17 16.5 4.74-2.85",
|
|
69
|
+
key: "8rfmw"
|
|
70
|
+
}],
|
|
71
|
+
["path", {
|
|
72
|
+
d: "M17 16.5v5.17",
|
|
73
|
+
key: "k6z78m"
|
|
74
|
+
}],
|
|
75
|
+
["path", {
|
|
76
|
+
d: "M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",
|
|
77
|
+
key: "1xygjf"
|
|
78
|
+
}],
|
|
79
|
+
["path", {
|
|
80
|
+
d: "M12 8 7.26 5.15",
|
|
81
|
+
key: "1vbdud"
|
|
82
|
+
}],
|
|
83
|
+
["path", {
|
|
84
|
+
d: "m12 8 4.74-2.85",
|
|
85
|
+
key: "3rx089"
|
|
86
|
+
}],
|
|
87
|
+
["path", {
|
|
88
|
+
d: "M12 13.5V8",
|
|
89
|
+
key: "1io7kd"
|
|
90
|
+
}]
|
|
91
|
+
]), D = w("eye", [["path", {
|
|
92
|
+
d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",
|
|
93
|
+
key: "1nclc0"
|
|
94
|
+
}], ["circle", {
|
|
95
|
+
cx: "12",
|
|
96
|
+
cy: "12",
|
|
97
|
+
r: "3",
|
|
98
|
+
key: "1v7zrd"
|
|
99
|
+
}]]), O = w("layers", [
|
|
100
|
+
["path", {
|
|
101
|
+
d: "M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",
|
|
102
|
+
key: "zw3jo"
|
|
103
|
+
}],
|
|
104
|
+
["path", {
|
|
105
|
+
d: "M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",
|
|
106
|
+
key: "1wduqc"
|
|
107
|
+
}],
|
|
108
|
+
["path", {
|
|
109
|
+
d: "M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",
|
|
110
|
+
key: "kqbvx6"
|
|
111
|
+
}]
|
|
112
|
+
]), k = w("map-pin-off", [
|
|
113
|
+
["path", {
|
|
114
|
+
d: "M12.75 7.09a3 3 0 0 1 2.16 2.16",
|
|
115
|
+
key: "1d4wjd"
|
|
116
|
+
}],
|
|
117
|
+
["path", {
|
|
118
|
+
d: "M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",
|
|
119
|
+
key: "12yil7"
|
|
120
|
+
}],
|
|
121
|
+
["path", {
|
|
122
|
+
d: "m2 2 20 20",
|
|
123
|
+
key: "1ooewy"
|
|
124
|
+
}],
|
|
125
|
+
["path", {
|
|
126
|
+
d: "M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",
|
|
127
|
+
key: "lhrkcz"
|
|
128
|
+
}],
|
|
129
|
+
["path", {
|
|
130
|
+
d: "M9.13 9.13a3 3 0 0 0 3.74 3.74",
|
|
131
|
+
key: "13wojd"
|
|
132
|
+
}]
|
|
133
|
+
]), A = w("mic-off", [
|
|
134
|
+
["line", {
|
|
135
|
+
x1: "2",
|
|
136
|
+
x2: "22",
|
|
137
|
+
y1: "2",
|
|
138
|
+
y2: "22",
|
|
139
|
+
key: "a6p6uj"
|
|
140
|
+
}],
|
|
141
|
+
["path", {
|
|
142
|
+
d: "M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",
|
|
143
|
+
key: "80xlxr"
|
|
144
|
+
}],
|
|
145
|
+
["path", {
|
|
146
|
+
d: "M5 10v2a7 7 0 0 0 12 5",
|
|
147
|
+
key: "p2k8kg"
|
|
148
|
+
}],
|
|
149
|
+
["path", {
|
|
150
|
+
d: "M15 9.34V5a3 3 0 0 0-5.68-1.33",
|
|
151
|
+
key: "1gzdoj"
|
|
152
|
+
}],
|
|
153
|
+
["path", {
|
|
154
|
+
d: "M9 9v3a3 3 0 0 0 5.12 2.12",
|
|
155
|
+
key: "r2i35w"
|
|
156
|
+
}],
|
|
157
|
+
["line", {
|
|
158
|
+
x1: "12",
|
|
159
|
+
x2: "12",
|
|
160
|
+
y1: "19",
|
|
161
|
+
y2: "22",
|
|
162
|
+
key: "x3vr5v"
|
|
163
|
+
}]
|
|
164
|
+
]), j = w("mic", [
|
|
165
|
+
["path", {
|
|
166
|
+
d: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",
|
|
167
|
+
key: "131961"
|
|
168
|
+
}],
|
|
169
|
+
["path", {
|
|
170
|
+
d: "M19 10v2a7 7 0 0 1-14 0v-2",
|
|
171
|
+
key: "1vc78b"
|
|
172
|
+
}],
|
|
173
|
+
["line", {
|
|
174
|
+
x1: "12",
|
|
175
|
+
x2: "12",
|
|
176
|
+
y1: "19",
|
|
177
|
+
y2: "22",
|
|
178
|
+
key: "x3vr5v"
|
|
179
|
+
}]
|
|
180
|
+
]);
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/pipeline-analytics/widgets/chart-utils.tsx
|
|
183
|
+
function M({ presets: e, value: t, onChange: n }) {
|
|
184
|
+
return /* @__PURE__ */ m("div", {
|
|
185
|
+
className: "flex items-center gap-1 border border-border rounded-md p-0.5 bg-background",
|
|
186
|
+
children: e.map(({ id: e, label: r }) => /* @__PURE__ */ m("button", {
|
|
187
|
+
type: "button",
|
|
188
|
+
onClick: () => n(e),
|
|
189
|
+
className: `px-2 py-0.5 rounded text-[10px] font-medium transition-colors ${t === e ? "bg-primary/10 text-primary" : "text-foreground-subtle hover:text-foreground"}`,
|
|
190
|
+
children: r
|
|
191
|
+
}, e))
|
|
192
|
+
});
|
|
252
193
|
}
|
|
253
|
-
function
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
194
|
+
function ee(t = 0) {
|
|
195
|
+
let n = e(null), [a, o] = r(0);
|
|
196
|
+
return i(() => {
|
|
197
|
+
let e = n.current;
|
|
198
|
+
if (!e) return;
|
|
199
|
+
let r = (e) => o(Math.max(t, Math.floor(e)));
|
|
200
|
+
r(e.clientWidth);
|
|
201
|
+
let i = new ResizeObserver((e) => {
|
|
202
|
+
let t = e[0];
|
|
203
|
+
t && r(t.contentRect.width);
|
|
204
|
+
});
|
|
205
|
+
return i.observe(e), () => i.disconnect();
|
|
206
|
+
}, [t]), [n, a];
|
|
266
207
|
}
|
|
267
|
-
function
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
const s = String(o.getDate()).padStart(2, "0"), d = String(o.getMonth() + 1).padStart(2, "0");
|
|
271
|
-
return `${s}/${d} ${r}:${a}`;
|
|
208
|
+
function te(e, t) {
|
|
209
|
+
let n = new Date(e), r = String(n.getHours()).padStart(2, "0"), i = String(n.getMinutes()).padStart(2, "0");
|
|
210
|
+
return t <= 1440 * 60 * 1e3 ? `${r}:${i}` : `${String(n.getDate()).padStart(2, "0")}/${String(n.getMonth() + 1).padStart(2, "0")} ${r}:${i}`;
|
|
272
211
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
212
|
+
function N(e, t, n, r, i) {
|
|
213
|
+
if (t <= 1) return r;
|
|
214
|
+
let a = n - r - i;
|
|
215
|
+
return r + e / (t - 1) * a;
|
|
277
216
|
}
|
|
278
|
-
function
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
217
|
+
function ne(e, t, n, r, i, a) {
|
|
218
|
+
if (t <= e) return [];
|
|
219
|
+
let o = t - e, s = [], c = n - r - i;
|
|
220
|
+
for (let t = 0; t < a; t++) {
|
|
221
|
+
let n = t / Math.max(1, a - 1), i = e + o * n;
|
|
222
|
+
s.push({
|
|
223
|
+
x: r + n * c,
|
|
224
|
+
label: te(i, o)
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
return s;
|
|
289
228
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
"#ec4899",
|
|
300
|
-
// pink-500
|
|
301
|
-
"#14b8a6",
|
|
302
|
-
// teal-500
|
|
303
|
-
"#6366f1",
|
|
304
|
-
// indigo-500
|
|
305
|
-
"#ef4444"
|
|
306
|
-
// red-500
|
|
229
|
+
var P = [
|
|
230
|
+
"#3b82f6",
|
|
231
|
+
"#a855f7",
|
|
232
|
+
"#10b981",
|
|
233
|
+
"#f59e0b",
|
|
234
|
+
"#ec4899",
|
|
235
|
+
"#14b8a6",
|
|
236
|
+
"#6366f1",
|
|
237
|
+
"#ef4444"
|
|
307
238
|
];
|
|
308
|
-
function
|
|
309
|
-
|
|
239
|
+
function re(e) {
|
|
240
|
+
return P[e % P.length] ?? "#64748b";
|
|
310
241
|
}
|
|
311
|
-
function
|
|
312
|
-
|
|
313
|
-
|
|
242
|
+
function F() {
|
|
243
|
+
let [e, t] = r(null);
|
|
244
|
+
return {
|
|
245
|
+
state: e,
|
|
246
|
+
bindHover: t
|
|
247
|
+
};
|
|
314
248
|
}
|
|
315
|
-
function
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
249
|
+
function I({ state: e, containerWidth: t }) {
|
|
250
|
+
if (!e) return null;
|
|
251
|
+
let n = Math.max(114, t - 110 - 4), r = Math.max(114, Math.min(n, e.anchorX)), i = e.anchorX - r;
|
|
252
|
+
return /* @__PURE__ */ h("div", {
|
|
253
|
+
role: "tooltip",
|
|
254
|
+
style: {
|
|
255
|
+
position: "absolute",
|
|
256
|
+
left: r,
|
|
257
|
+
top: e.anchorY,
|
|
258
|
+
transform: "translate(-50%, calc(-100% - 8px))",
|
|
259
|
+
pointerEvents: "none"
|
|
260
|
+
},
|
|
261
|
+
className: "z-10 rounded-md border border-border bg-surface shadow-lg px-2.5 py-1.5 text-[10px] text-foreground min-w-[140px] max-w-[240px]",
|
|
262
|
+
children: [
|
|
263
|
+
/* @__PURE__ */ m("div", {
|
|
264
|
+
className: "font-semibold mb-1 truncate",
|
|
265
|
+
children: e.title
|
|
266
|
+
}),
|
|
267
|
+
/* @__PURE__ */ m("div", {
|
|
268
|
+
className: "space-y-0.5",
|
|
269
|
+
children: e.rows.map((e, t) => /* @__PURE__ */ h("div", {
|
|
270
|
+
className: "flex items-center justify-between gap-2",
|
|
271
|
+
children: [/* @__PURE__ */ h("span", {
|
|
272
|
+
className: "flex items-center gap-1 text-foreground-subtle truncate",
|
|
273
|
+
children: [e.colour && /* @__PURE__ */ m("span", {
|
|
274
|
+
className: "inline-block h-1.5 w-1.5 rounded-sm flex-shrink-0",
|
|
275
|
+
style: { backgroundColor: e.colour }
|
|
276
|
+
}), /* @__PURE__ */ m("span", {
|
|
277
|
+
className: "truncate",
|
|
278
|
+
children: e.label
|
|
279
|
+
})]
|
|
280
|
+
}), /* @__PURE__ */ m("span", {
|
|
281
|
+
className: "tabular-nums",
|
|
282
|
+
children: e.value
|
|
283
|
+
})]
|
|
284
|
+
}, t))
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ m("span", {
|
|
287
|
+
"aria-hidden": !0,
|
|
288
|
+
style: { left: `calc(50% + ${i}px)` },
|
|
289
|
+
className: "absolute -bottom-1 -translate-x-1/2 h-2 w-2 rotate-45 bg-surface border-r border-b border-border"
|
|
290
|
+
})
|
|
291
|
+
]
|
|
292
|
+
});
|
|
350
293
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region src/pipeline-analytics/widgets/AudioHistoryChart.tsx
|
|
296
|
+
var L = {
|
|
297
|
+
"5m": {
|
|
298
|
+
label: "5 min",
|
|
299
|
+
windowSec: 300,
|
|
300
|
+
sampleEveryMs: 1e3,
|
|
301
|
+
pollIntervalMs: 5e3
|
|
302
|
+
},
|
|
303
|
+
"1h": {
|
|
304
|
+
label: "1 h",
|
|
305
|
+
windowSec: 3600,
|
|
306
|
+
sampleEveryMs: 5e3,
|
|
307
|
+
pollIntervalMs: 3e4
|
|
308
|
+
},
|
|
309
|
+
"24h": {
|
|
310
|
+
label: "24 h",
|
|
311
|
+
windowSec: 1440 * 60,
|
|
312
|
+
sampleEveryMs: 6e4,
|
|
313
|
+
pollIntervalMs: 3e5
|
|
314
|
+
}
|
|
315
|
+
}, ie = [
|
|
316
|
+
{
|
|
317
|
+
id: "5m",
|
|
318
|
+
label: L["5m"].label
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
id: "1h",
|
|
322
|
+
label: L["1h"].label
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
id: "24h",
|
|
326
|
+
label: L["24h"].label
|
|
327
|
+
}
|
|
328
|
+
], R = 140, z = {
|
|
329
|
+
top: 16,
|
|
330
|
+
right: 12,
|
|
331
|
+
bottom: 24,
|
|
332
|
+
left: 38
|
|
333
|
+
}, ae = {
|
|
334
|
+
speech: "#3b82f6",
|
|
335
|
+
music: "#a855f7",
|
|
336
|
+
dog_bark: "#ec4899",
|
|
337
|
+
glass_break: "#f43f5e",
|
|
338
|
+
alarm: "#f59e0b",
|
|
339
|
+
baby_cry: "#10b981"
|
|
366
340
|
};
|
|
367
|
-
function
|
|
368
|
-
|
|
341
|
+
function oe(e) {
|
|
342
|
+
return e ? ae[e.toLowerCase()] ?? "#6366f1" : "#71717a";
|
|
369
343
|
}
|
|
370
|
-
function
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
344
|
+
function se({ deviceId: n }) {
|
|
345
|
+
let i = c(f().trpcClient, n), [a, s] = r("5m"), l = L[a], [u, d] = ee(), p = F(), _ = e(null), v = (e) => {
|
|
346
|
+
let t = _.current;
|
|
347
|
+
if (!t) return e;
|
|
348
|
+
let n = t.getBoundingClientRect();
|
|
349
|
+
return n.width === 0 ? e : e / d * n.width;
|
|
350
|
+
}, y = o({
|
|
351
|
+
queryKey: [
|
|
352
|
+
"audio-metrics",
|
|
353
|
+
n,
|
|
354
|
+
"history",
|
|
355
|
+
a
|
|
356
|
+
],
|
|
357
|
+
queryFn: async () => i ? await i.audioMetrics?.getHistory({
|
|
358
|
+
windowSec: l.windowSec,
|
|
359
|
+
sampleEveryMs: l.sampleEveryMs
|
|
360
|
+
}) ?? null : null,
|
|
361
|
+
enabled: !!i,
|
|
362
|
+
refetchInterval: l.pollIntervalMs,
|
|
363
|
+
staleTime: Math.max(1e3, l.pollIntervalMs / 2)
|
|
364
|
+
}), b = y.data, x = b?.points ?? [], S = t(() => fe(x), [x]), C = t(() => ue(x, d, S), [
|
|
365
|
+
x,
|
|
366
|
+
d,
|
|
367
|
+
S
|
|
368
|
+
]), w = t(() => de(x, d, S), [
|
|
369
|
+
x,
|
|
370
|
+
d,
|
|
371
|
+
S
|
|
372
|
+
]), E = t(() => pe(S), [S]), D = t(() => me(x, d), [x, d]);
|
|
373
|
+
return /* @__PURE__ */ h("div", {
|
|
374
|
+
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
375
|
+
children: [/* @__PURE__ */ h("div", {
|
|
376
|
+
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
377
|
+
children: [/* @__PURE__ */ h("div", {
|
|
378
|
+
className: "flex items-center gap-1.5",
|
|
379
|
+
children: [/* @__PURE__ */ m(T, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
380
|
+
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
381
|
+
children: "Audio Level History"
|
|
382
|
+
})]
|
|
383
|
+
}), /* @__PURE__ */ m(M, {
|
|
384
|
+
presets: ie,
|
|
385
|
+
value: a,
|
|
386
|
+
onChange: s
|
|
387
|
+
})]
|
|
388
|
+
}), /* @__PURE__ */ h("div", {
|
|
389
|
+
ref: u,
|
|
390
|
+
className: "p-3 min-w-0 relative",
|
|
391
|
+
children: [x.length === 0 ? /* @__PURE__ */ m("div", {
|
|
392
|
+
className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
|
|
393
|
+
children: y.isLoading ? "Loading…" : "No audio history yet — analytics pipeline must be active."
|
|
394
|
+
}) : d === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ h("svg", {
|
|
395
|
+
ref: _,
|
|
396
|
+
role: "img",
|
|
397
|
+
"aria-label": "Audio dBFS history",
|
|
398
|
+
width: "100%",
|
|
399
|
+
height: R,
|
|
400
|
+
viewBox: `0 0 ${d} ${R}`,
|
|
401
|
+
preserveAspectRatio: "none",
|
|
402
|
+
className: "block",
|
|
403
|
+
onMouseLeave: () => p.bindHover(null),
|
|
404
|
+
children: [
|
|
405
|
+
E.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
406
|
+
x1: z.left,
|
|
407
|
+
x2: d - z.right,
|
|
408
|
+
y1: e,
|
|
409
|
+
y2: e,
|
|
410
|
+
stroke: "currentColor",
|
|
411
|
+
strokeOpacity: .08,
|
|
412
|
+
strokeWidth: .5
|
|
413
|
+
}), /* @__PURE__ */ m("text", {
|
|
414
|
+
x: z.left - 6,
|
|
415
|
+
y: e + 3,
|
|
416
|
+
textAnchor: "end",
|
|
417
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
418
|
+
children: t
|
|
419
|
+
})] }, `y-${n}`)),
|
|
420
|
+
D.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
|
|
421
|
+
x: e,
|
|
422
|
+
y: R - z.bottom + 12,
|
|
423
|
+
textAnchor: "middle",
|
|
424
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
425
|
+
children: t
|
|
426
|
+
}, `x-${n}`)),
|
|
427
|
+
w && /* @__PURE__ */ m("path", {
|
|
428
|
+
d: w,
|
|
429
|
+
fill: "none",
|
|
430
|
+
stroke: "currentColor",
|
|
431
|
+
strokeOpacity: .25,
|
|
432
|
+
strokeWidth: 1,
|
|
433
|
+
strokeDasharray: "3 2"
|
|
434
|
+
}),
|
|
435
|
+
C && /* @__PURE__ */ m("path", {
|
|
436
|
+
d: C,
|
|
437
|
+
fill: "none",
|
|
438
|
+
stroke: "currentColor",
|
|
439
|
+
className: "text-primary",
|
|
440
|
+
strokeWidth: 1.5
|
|
441
|
+
}),
|
|
442
|
+
x.map((e, t) => e.topClass === null ? null : /* @__PURE__ */ m("circle", {
|
|
443
|
+
cx: B(t, x.length, d),
|
|
444
|
+
cy: ce(e.dbfs, S),
|
|
445
|
+
r: 3,
|
|
446
|
+
fill: oe(e.topClass),
|
|
447
|
+
stroke: "#000",
|
|
448
|
+
strokeOpacity: .3,
|
|
449
|
+
strokeWidth: .5
|
|
450
|
+
}, `dot-${t}`)),
|
|
451
|
+
x.map((e, t) => {
|
|
452
|
+
let n = B(t, x.length, d), r = ce(e.dbfs, S), i = R - z.top - z.bottom, a = x.length > 1 ? (d - z.left - z.right) / (x.length - 1) : 24;
|
|
453
|
+
return /* @__PURE__ */ m("rect", {
|
|
454
|
+
x: n - a / 2,
|
|
455
|
+
y: z.top,
|
|
456
|
+
width: Math.max(2, a),
|
|
457
|
+
height: i,
|
|
458
|
+
fill: "transparent",
|
|
459
|
+
onMouseEnter: () => {
|
|
460
|
+
p.bindHover({
|
|
461
|
+
anchorX: v(n),
|
|
462
|
+
anchorY: r,
|
|
463
|
+
title: `${he(e.ts)} · ${e.dbfs?.toFixed(1) ?? "—"} dB`,
|
|
464
|
+
rows: [
|
|
465
|
+
{
|
|
466
|
+
label: "peak (window)",
|
|
467
|
+
value: `${e.peakDbfs.toFixed(1)} dB`
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
label: "avg (window)",
|
|
471
|
+
value: `${e.avgDbfs.toFixed(1)} dB`
|
|
472
|
+
},
|
|
473
|
+
...e.topClass === null ? [] : [{
|
|
474
|
+
label: e.topClass,
|
|
475
|
+
value: e.topScore == null ? "—" : `${(e.topScore * 100).toFixed(0)}%`,
|
|
476
|
+
colour: oe(e.topClass)
|
|
477
|
+
}]
|
|
478
|
+
]
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
}, `hit-${t}`);
|
|
482
|
+
})
|
|
483
|
+
]
|
|
484
|
+
}), /* @__PURE__ */ m(I, {
|
|
485
|
+
state: p.state,
|
|
486
|
+
containerWidth: d
|
|
487
|
+
})] }), x.length > 0 && /* @__PURE__ */ h("div", {
|
|
488
|
+
className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
|
|
489
|
+
children: [/* @__PURE__ */ h("span", { children: [
|
|
490
|
+
x.length,
|
|
491
|
+
" samples · ~",
|
|
492
|
+
Math.round((b?.effectiveSampleEveryMs ?? l.sampleEveryMs) / 1e3),
|
|
493
|
+
"s spacing"
|
|
494
|
+
] }), /* @__PURE__ */ h("span", { children: [
|
|
495
|
+
"peak ",
|
|
496
|
+
x.reduce((e, t) => Math.max(e, t.peakDbfs), -Infinity).toFixed(1),
|
|
497
|
+
" dB"
|
|
498
|
+
] })]
|
|
499
|
+
})]
|
|
500
|
+
})]
|
|
501
|
+
});
|
|
483
502
|
}
|
|
484
|
-
function
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
503
|
+
function B(e, t, n) {
|
|
504
|
+
if (t <= 1) return z.left;
|
|
505
|
+
let r = n - z.left - z.right;
|
|
506
|
+
return z.left + e / (t - 1) * r;
|
|
488
507
|
}
|
|
489
|
-
function
|
|
490
|
-
|
|
508
|
+
function ce(e, t) {
|
|
509
|
+
return le(e === null || !Number.isFinite(e) ? t.min : Math.max(t.min, Math.min(t.max, e)), t);
|
|
491
510
|
}
|
|
492
|
-
function
|
|
493
|
-
|
|
494
|
-
|
|
511
|
+
function le(e, t) {
|
|
512
|
+
let n = R - z.top - z.bottom, r = Math.max(1, t.max - t.min), i = (e - t.min) / r;
|
|
513
|
+
return z.top + (1 - i) * n;
|
|
495
514
|
}
|
|
496
|
-
function
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
515
|
+
function ue(e, t, n) {
|
|
516
|
+
if (e.length === 0) return null;
|
|
517
|
+
let r = [];
|
|
518
|
+
for (let i = 0; i < e.length; i++) {
|
|
519
|
+
let a = B(i, e.length, t), o = ce(e[i].dbfs, n);
|
|
520
|
+
r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
|
|
521
|
+
}
|
|
522
|
+
return r.join(" ");
|
|
504
523
|
}
|
|
505
|
-
function
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
524
|
+
function de(e, t, n) {
|
|
525
|
+
if (e.length === 0) return null;
|
|
526
|
+
let r = [];
|
|
527
|
+
for (let i = 0; i < e.length; i++) {
|
|
528
|
+
let a = B(i, e.length, t), o = le(Math.max(n.min, Math.min(n.max, e[i].peakDbfs)), n);
|
|
529
|
+
r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
|
|
530
|
+
}
|
|
531
|
+
return r.join(" ");
|
|
513
532
|
}
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
533
|
+
function fe(e) {
|
|
534
|
+
if (e.length === 0) return {
|
|
535
|
+
min: -80,
|
|
536
|
+
max: -40
|
|
537
|
+
};
|
|
538
|
+
let t = Infinity, n = -Infinity;
|
|
539
|
+
for (let r of e) r.dbfs !== null && Number.isFinite(r.dbfs) && (t = Math.min(t, r.dbfs), n = Math.max(n, r.dbfs)), Number.isFinite(r.peakDbfs) && (t = Math.min(t, r.peakDbfs), n = Math.max(n, r.peakDbfs));
|
|
540
|
+
if (!Number.isFinite(t) || !Number.isFinite(n)) return {
|
|
541
|
+
min: -80,
|
|
542
|
+
max: -40
|
|
543
|
+
};
|
|
544
|
+
let r = Math.max(-100, Math.floor(t - 1)), i = Math.min(0, Math.ceil(n));
|
|
545
|
+
return i - r < 5 && (r = Math.max(-100, i - 5)), {
|
|
546
|
+
min: r,
|
|
547
|
+
max: i
|
|
548
|
+
};
|
|
522
549
|
}
|
|
523
|
-
function
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
550
|
+
function pe(e) {
|
|
551
|
+
let t = [];
|
|
552
|
+
for (let n = 0; n < 4; n++) {
|
|
553
|
+
let r = n / 3, i = e.min + (e.max - e.min) * r;
|
|
554
|
+
t.push({
|
|
555
|
+
y: le(i, e),
|
|
556
|
+
label: `${Math.round(i)}`
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
return t;
|
|
533
560
|
}
|
|
534
|
-
function
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
561
|
+
function me(e, t) {
|
|
562
|
+
if (e.length === 0) return [];
|
|
563
|
+
let n = e[0], r = e[e.length - 1], i = [], a = Math.min(5, e.length);
|
|
564
|
+
for (let e = 0; e < a; e++) {
|
|
565
|
+
let o = e / Math.max(1, a - 1), s = n.ts + (r.ts - n.ts) * o;
|
|
566
|
+
i.push({
|
|
567
|
+
x: z.left + o * (t - z.left - z.right),
|
|
568
|
+
label: he(s)
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
return i;
|
|
545
572
|
}
|
|
546
|
-
function
|
|
547
|
-
|
|
548
|
-
|
|
573
|
+
function he(e) {
|
|
574
|
+
let t = new Date(e);
|
|
575
|
+
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
549
576
|
}
|
|
577
|
+
//#endregion
|
|
578
|
+
//#region src/pipeline-analytics/widgets/AudioMetricsPanel.tsx
|
|
550
579
|
function ge(e) {
|
|
551
|
-
|
|
580
|
+
return !Number.isFinite(e) || e <= 0 ? 60 : Math.round(e > 600 ? e / 1e3 : e);
|
|
552
581
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
) });
|
|
582
|
+
function _e({ dev: e, deviceId: t, title: n = "Audio Metrics", variant: r = "full" }) {
|
|
583
|
+
let i = s(f().trpcClient, e === void 0 && t !== void 0 ? t : null, (e) => e.audioMetrics), a = u(e ? e.state.audioMetrics : void 0), o = e === void 0 ? i : a;
|
|
584
|
+
return o ? /* @__PURE__ */ m(ve, {
|
|
585
|
+
title: n,
|
|
586
|
+
variant: r,
|
|
587
|
+
ts: o.ts,
|
|
588
|
+
children: /* @__PURE__ */ h("div", {
|
|
589
|
+
className: r === "compact" ? "space-y-2" : "grid grid-cols-1 2xl:grid-cols-3 gap-3",
|
|
590
|
+
children: [
|
|
591
|
+
/* @__PURE__ */ m(be, { snapshot: o }),
|
|
592
|
+
/* @__PURE__ */ m(xe, { snapshot: o }),
|
|
593
|
+
/* @__PURE__ */ m(Se, { snapshot: o })
|
|
594
|
+
]
|
|
595
|
+
})
|
|
596
|
+
}) : /* @__PURE__ */ m(ve, {
|
|
597
|
+
title: n,
|
|
598
|
+
variant: r,
|
|
599
|
+
children: /* @__PURE__ */ m(ye, {
|
|
600
|
+
icon: /* @__PURE__ */ m(A, { className: "h-5 w-5 mb-2 opacity-30" }),
|
|
601
|
+
message: e || t !== void 0 ? "No audio data yet — analytics pipeline must be active and audio enabled for this device." : "Resolving device…"
|
|
602
|
+
})
|
|
603
|
+
});
|
|
577
604
|
}
|
|
578
|
-
function
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
605
|
+
function ve({ title: e, variant: t, ts: n, children: r }) {
|
|
606
|
+
let i = n ? Math.max(0, Math.floor((Date.now() - n) / 1e3)) : null;
|
|
607
|
+
return /* @__PURE__ */ h("div", {
|
|
608
|
+
className: t === "compact" ? "rounded-md border border-border/60 bg-surface/60 p-3" : "rounded-lg border border-border bg-surface overflow-hidden",
|
|
609
|
+
children: [/* @__PURE__ */ h("div", {
|
|
610
|
+
className: t === "compact" ? "flex items-center justify-between mb-2" : "border-b border-border px-4 py-2 flex items-center justify-between",
|
|
611
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
612
|
+
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
613
|
+
children: e
|
|
614
|
+
}), i !== null && /* @__PURE__ */ m("span", {
|
|
615
|
+
className: "text-[10px] text-foreground-subtle",
|
|
616
|
+
children: i === 0 ? "just now" : `${i}s ago`
|
|
617
|
+
})]
|
|
618
|
+
}), /* @__PURE__ */ m("div", {
|
|
619
|
+
className: t === "compact" ? "" : "p-3",
|
|
620
|
+
children: r
|
|
621
|
+
})]
|
|
622
|
+
});
|
|
587
623
|
}
|
|
588
|
-
function
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
624
|
+
function ye({ icon: e, message: t }) {
|
|
625
|
+
return /* @__PURE__ */ h("div", {
|
|
626
|
+
className: "px-4 py-6 flex flex-col items-center text-center text-foreground-subtle",
|
|
627
|
+
children: [e, /* @__PURE__ */ m("p", {
|
|
628
|
+
className: "text-[11px]",
|
|
629
|
+
children: t
|
|
630
|
+
})]
|
|
631
|
+
});
|
|
593
632
|
}
|
|
594
|
-
function
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
633
|
+
function be({ snapshot: e }) {
|
|
634
|
+
let { dbfs: t } = e.level, n = Math.max(-80, Math.min(0, Number.isFinite(t) ? t : -80)), r = (n + 80) / 80 * 100, i = n > -10 ? "bg-danger" : n > -25 ? "bg-warning" : "bg-primary";
|
|
635
|
+
return /* @__PURE__ */ h("div", {
|
|
636
|
+
className: "rounded-md border border-border/60 bg-background/40 px-3 py-2",
|
|
637
|
+
children: [
|
|
638
|
+
/* @__PURE__ */ h("div", {
|
|
639
|
+
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
640
|
+
children: [
|
|
641
|
+
/* @__PURE__ */ m(T, { className: "h-3.5 w-3.5" }),
|
|
642
|
+
/* @__PURE__ */ m("span", { children: "Level" }),
|
|
643
|
+
/* @__PURE__ */ m("span", {
|
|
644
|
+
className: "ml-auto text-base font-semibold text-foreground tabular-nums normal-case tracking-normal",
|
|
645
|
+
children: Number.isFinite(t) ? `${t.toFixed(1)} dB` : "silent"
|
|
646
|
+
})
|
|
647
|
+
]
|
|
648
|
+
}),
|
|
649
|
+
/* @__PURE__ */ m("div", {
|
|
650
|
+
className: "h-1.5 rounded-full bg-foreground-subtle/15 overflow-hidden",
|
|
651
|
+
children: /* @__PURE__ */ m("div", {
|
|
652
|
+
className: `h-full ${i} transition-all`,
|
|
653
|
+
style: { width: `${r}%` }
|
|
654
|
+
})
|
|
655
|
+
}),
|
|
656
|
+
/* @__PURE__ */ h("div", {
|
|
657
|
+
className: "flex justify-between text-[9px] text-foreground-subtle mt-1 tabular-nums",
|
|
658
|
+
children: [
|
|
659
|
+
/* @__PURE__ */ h("span", { children: [
|
|
660
|
+
"peak ",
|
|
661
|
+
Number.isFinite(e.peakDbfs) ? e.peakDbfs.toFixed(1) : "—",
|
|
662
|
+
" dB"
|
|
663
|
+
] }),
|
|
664
|
+
/* @__PURE__ */ h("span", { children: [
|
|
665
|
+
"avg ",
|
|
666
|
+
e.avgDbfs.toFixed(1),
|
|
667
|
+
" dB"
|
|
668
|
+
] }),
|
|
669
|
+
/* @__PURE__ */ h("span", { children: [ge(e.windowSec), "s window"] })
|
|
670
|
+
]
|
|
671
|
+
})
|
|
672
|
+
]
|
|
673
|
+
});
|
|
626
674
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
675
|
+
function xe({ snapshot: e }) {
|
|
676
|
+
let { current: t } = e;
|
|
677
|
+
return /* @__PURE__ */ h("div", {
|
|
678
|
+
className: "rounded-md border border-border/60 bg-background/40 px-3 py-2",
|
|
679
|
+
children: [/* @__PURE__ */ h("div", {
|
|
680
|
+
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
681
|
+
children: [/* @__PURE__ */ m(j, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ m("span", { children: "Now" })]
|
|
682
|
+
}), t ? /* @__PURE__ */ h("div", {
|
|
683
|
+
className: "flex flex-col gap-1",
|
|
684
|
+
children: [/* @__PURE__ */ m("span", {
|
|
685
|
+
className: "text-sm font-semibold text-foreground",
|
|
686
|
+
children: t.className
|
|
687
|
+
}), /* @__PURE__ */ h("span", {
|
|
688
|
+
className: "text-[10px] text-foreground-subtle tabular-nums",
|
|
689
|
+
children: [
|
|
690
|
+
"score ",
|
|
691
|
+
(t.score * 100).toFixed(0),
|
|
692
|
+
"% —",
|
|
693
|
+
" ",
|
|
694
|
+
Math.max(0, Math.floor((Date.now() - t.timestamp) / 1e3)),
|
|
695
|
+
"s ago"
|
|
696
|
+
]
|
|
697
|
+
})]
|
|
698
|
+
}) : /* @__PURE__ */ m("span", {
|
|
699
|
+
className: "text-[10px] text-foreground-subtle italic",
|
|
700
|
+
children: "silence / unclassified"
|
|
701
|
+
})]
|
|
702
|
+
});
|
|
645
703
|
}
|
|
646
|
-
function
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
704
|
+
function Se({ snapshot: e }) {
|
|
705
|
+
return e.byClass.length === 0 ? /* @__PURE__ */ h("div", {
|
|
706
|
+
className: "rounded-md border border-border/40 bg-background/20 px-3 py-2",
|
|
707
|
+
children: [/* @__PURE__ */ h("div", {
|
|
708
|
+
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
709
|
+
children: [/* @__PURE__ */ m(T, { className: "h-3.5 w-3.5" }), /* @__PURE__ */ h("span", { children: [
|
|
710
|
+
"Last ",
|
|
711
|
+
ge(e.windowSec),
|
|
712
|
+
"s"
|
|
713
|
+
] })]
|
|
714
|
+
}), /* @__PURE__ */ m("span", {
|
|
715
|
+
className: "text-[10px] text-foreground-subtle italic",
|
|
716
|
+
children: "no classified audio"
|
|
717
|
+
})]
|
|
718
|
+
}) : /* @__PURE__ */ h("div", {
|
|
719
|
+
className: "rounded-md border border-border/60 bg-background/40",
|
|
720
|
+
children: [/* @__PURE__ */ h("div", {
|
|
721
|
+
className: "px-3 py-1.5 border-b border-border/40 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
722
|
+
children: [
|
|
723
|
+
/* @__PURE__ */ m(T, { className: "h-3.5 w-3.5" }),
|
|
724
|
+
/* @__PURE__ */ h("span", { children: [
|
|
725
|
+
"Last ",
|
|
726
|
+
ge(e.windowSec),
|
|
727
|
+
"s"
|
|
728
|
+
] }),
|
|
729
|
+
/* @__PURE__ */ m("span", {
|
|
730
|
+
className: "ml-auto text-[10px] normal-case tracking-normal",
|
|
731
|
+
children: e.byClass.length
|
|
732
|
+
})
|
|
733
|
+
]
|
|
734
|
+
}), /* @__PURE__ */ m("div", {
|
|
735
|
+
className: "divide-y divide-border/30",
|
|
736
|
+
children: e.byClass.slice(0, 8).map((e) => /* @__PURE__ */ h("div", {
|
|
737
|
+
className: "px-3 py-1.5 flex items-center justify-between text-xs",
|
|
738
|
+
children: [/* @__PURE__ */ m("span", {
|
|
739
|
+
className: "font-medium text-foreground truncate",
|
|
740
|
+
children: e.className
|
|
741
|
+
}), /* @__PURE__ */ h("span", {
|
|
742
|
+
className: "flex items-center gap-2 tabular-nums text-foreground-subtle",
|
|
743
|
+
children: [/* @__PURE__ */ h("span", { children: [e.hits, "× hits"] }), /* @__PURE__ */ h("span", {
|
|
744
|
+
className: "rounded-full px-1.5 py-0.5 text-[10px] bg-primary/10 text-primary border border-primary/20",
|
|
745
|
+
children: [(e.peakScore * 100).toFixed(0), "%"]
|
|
746
|
+
})]
|
|
747
|
+
})]
|
|
748
|
+
}, e.className))
|
|
749
|
+
})]
|
|
750
|
+
});
|
|
681
751
|
}
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
752
|
+
//#endregion
|
|
753
|
+
//#region src/pipeline-analytics/widgets/OccupancyHistoryChart.tsx
|
|
754
|
+
var V = {
|
|
755
|
+
"5m": {
|
|
756
|
+
label: "5 min",
|
|
757
|
+
windowMs: 5 * 6e4,
|
|
758
|
+
resolution: "minute",
|
|
759
|
+
pollIntervalMs: 5e3
|
|
760
|
+
},
|
|
761
|
+
"30m": {
|
|
762
|
+
label: "30 min",
|
|
763
|
+
windowMs: 30 * 6e4,
|
|
764
|
+
resolution: "minute",
|
|
765
|
+
pollIntervalMs: 15e3
|
|
766
|
+
},
|
|
767
|
+
"1h": {
|
|
768
|
+
label: "1 h",
|
|
769
|
+
windowMs: 60 * 6e4,
|
|
770
|
+
resolution: "5min",
|
|
771
|
+
pollIntervalMs: 3e4
|
|
772
|
+
}
|
|
773
|
+
}, Ce = [
|
|
774
|
+
{
|
|
775
|
+
id: "5m",
|
|
776
|
+
label: V["5m"].label
|
|
777
|
+
},
|
|
778
|
+
{
|
|
779
|
+
id: "30m",
|
|
780
|
+
label: V["30m"].label
|
|
781
|
+
},
|
|
782
|
+
{
|
|
783
|
+
id: "1h",
|
|
784
|
+
label: V["1h"].label
|
|
785
|
+
}
|
|
786
|
+
], H = 140, U = {
|
|
787
|
+
top: 14,
|
|
788
|
+
right: 12,
|
|
789
|
+
bottom: 24,
|
|
790
|
+
left: 32
|
|
791
|
+
}, W = "__all__";
|
|
792
|
+
function we({ deviceId: n }) {
|
|
793
|
+
let a = c(f().trpcClient, n), [s, l] = r("5m"), [d, p] = r(W), _ = V[s], [v, y] = ee(), b = F(), x = e(null), S = (e) => {
|
|
794
|
+
let t = x.current;
|
|
795
|
+
if (!t) return e;
|
|
796
|
+
let n = t.getBoundingClientRect();
|
|
797
|
+
return n.width === 0 ? e : e / y * n.width;
|
|
798
|
+
}, C = u(a?.state.zoneAnalytics), w = t(() => {
|
|
799
|
+
let e = /* @__PURE__ */ new Set();
|
|
800
|
+
if (C?.frame.byClass) for (let t of Object.keys(C.frame.byClass)) e.add(t);
|
|
801
|
+
if (C?.zones) for (let t of C.zones) for (let n of Object.keys(t.byClass)) e.add(n);
|
|
802
|
+
return [...e].toSorted();
|
|
803
|
+
}, [C]);
|
|
804
|
+
i(() => {
|
|
805
|
+
d !== W && !w.includes(d) && p(W);
|
|
806
|
+
}, [d, w]);
|
|
807
|
+
let T = o({
|
|
808
|
+
queryKey: [
|
|
809
|
+
"zone-analytics",
|
|
810
|
+
n,
|
|
811
|
+
"cameraHistory",
|
|
812
|
+
s,
|
|
813
|
+
d
|
|
814
|
+
],
|
|
815
|
+
queryFn: async () => {
|
|
816
|
+
if (!a) return [];
|
|
817
|
+
let e = Date.now();
|
|
818
|
+
return await a.zoneAnalytics?.getCameraHistory({
|
|
819
|
+
from: e - _.windowMs,
|
|
820
|
+
to: e,
|
|
821
|
+
resolution: _.resolution,
|
|
822
|
+
...d === W ? {} : { className: d }
|
|
823
|
+
}) ?? [];
|
|
824
|
+
},
|
|
825
|
+
enabled: !!a,
|
|
826
|
+
refetchInterval: _.pollIntervalMs,
|
|
827
|
+
staleTime: Math.max(1e3, _.pollIntervalMs / 2)
|
|
828
|
+
}), E = T.data ?? [], D = T.dataUpdatedAt > 0 ? T.dataUpdatedAt : Date.now(), k = D - _.windowMs, A = t(() => {
|
|
829
|
+
if (E.length === 0) return 1;
|
|
830
|
+
let e = E.reduce((e, t) => Math.max(e, t.count), 0);
|
|
831
|
+
return Math.max(1, Math.ceil(e * 1.15));
|
|
832
|
+
}, [E]), j = t(() => Ee(E, y, A), [
|
|
833
|
+
E,
|
|
834
|
+
y,
|
|
835
|
+
A
|
|
836
|
+
]), te = t(() => ne(k, D, y, U.left, U.right, 5), [
|
|
837
|
+
k,
|
|
838
|
+
D,
|
|
839
|
+
y
|
|
840
|
+
]), P = t(() => De(A), [A]);
|
|
841
|
+
return /* @__PURE__ */ h("div", {
|
|
842
|
+
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
843
|
+
children: [/* @__PURE__ */ h("div", {
|
|
844
|
+
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
845
|
+
children: [/* @__PURE__ */ h("div", {
|
|
846
|
+
className: "flex items-center gap-1.5",
|
|
847
|
+
children: [/* @__PURE__ */ m(O, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
848
|
+
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
849
|
+
children: "Occupancy History"
|
|
850
|
+
})]
|
|
851
|
+
}), /* @__PURE__ */ h("div", {
|
|
852
|
+
className: "flex items-center gap-2",
|
|
853
|
+
children: [w.length > 0 && /* @__PURE__ */ h("select", {
|
|
854
|
+
value: d,
|
|
855
|
+
onChange: (e) => p(e.target.value),
|
|
856
|
+
className: "text-[10px] px-1.5 py-0.5 rounded border border-border bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-primary/40",
|
|
857
|
+
title: "Filter by detected class",
|
|
858
|
+
children: [/* @__PURE__ */ m("option", {
|
|
859
|
+
value: W,
|
|
860
|
+
children: "All classes"
|
|
861
|
+
}), w.map((e) => /* @__PURE__ */ m("option", {
|
|
862
|
+
value: e,
|
|
863
|
+
children: e
|
|
864
|
+
}, e))]
|
|
865
|
+
}), /* @__PURE__ */ m(M, {
|
|
866
|
+
presets: Ce,
|
|
867
|
+
value: s,
|
|
868
|
+
onChange: l
|
|
869
|
+
})]
|
|
870
|
+
})]
|
|
871
|
+
}), /* @__PURE__ */ h("div", {
|
|
872
|
+
ref: v,
|
|
873
|
+
className: "p-3 min-w-0 relative",
|
|
874
|
+
children: [E.length === 0 ? /* @__PURE__ */ m("div", {
|
|
875
|
+
className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
|
|
876
|
+
children: T.isLoading ? "Loading…" : "No occupancy history yet — analytics pipeline must be active."
|
|
877
|
+
}) : y === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ h("svg", {
|
|
878
|
+
ref: x,
|
|
879
|
+
role: "img",
|
|
880
|
+
"aria-label": "Frame occupancy history",
|
|
881
|
+
width: "100%",
|
|
882
|
+
height: H,
|
|
883
|
+
viewBox: `0 0 ${y} ${H}`,
|
|
884
|
+
preserveAspectRatio: "none",
|
|
885
|
+
className: "block",
|
|
886
|
+
onMouseLeave: () => b.bindHover(null),
|
|
887
|
+
children: [
|
|
888
|
+
P.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
889
|
+
x1: U.left,
|
|
890
|
+
x2: y - U.right,
|
|
891
|
+
y1: e,
|
|
892
|
+
y2: e,
|
|
893
|
+
stroke: "currentColor",
|
|
894
|
+
strokeOpacity: .08,
|
|
895
|
+
strokeWidth: .5
|
|
896
|
+
}), /* @__PURE__ */ m("text", {
|
|
897
|
+
x: U.left - 6,
|
|
898
|
+
y: e + 3,
|
|
899
|
+
textAnchor: "end",
|
|
900
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
901
|
+
children: t
|
|
902
|
+
})] }, `y-${n}`)),
|
|
903
|
+
te.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
|
|
904
|
+
x: e,
|
|
905
|
+
y: H - U.bottom + 12,
|
|
906
|
+
textAnchor: "middle",
|
|
907
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
908
|
+
children: t
|
|
909
|
+
}, `x-${n}`)),
|
|
910
|
+
j && /* @__PURE__ */ m("path", {
|
|
911
|
+
d: j,
|
|
912
|
+
fill: "none",
|
|
913
|
+
stroke: "currentColor",
|
|
914
|
+
className: "text-primary",
|
|
915
|
+
strokeWidth: 1.5
|
|
916
|
+
}),
|
|
917
|
+
E.map((e, t) => {
|
|
918
|
+
let n = N(t, E.length, y, U.left, U.right), r = Te(e.count, A), i = H - U.top - U.bottom, a = E.length > 1 ? (y - U.left - U.right) / (E.length - 1) : 24;
|
|
919
|
+
return /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("circle", {
|
|
920
|
+
cx: n,
|
|
921
|
+
cy: r,
|
|
922
|
+
r: 2,
|
|
923
|
+
fill: "currentColor",
|
|
924
|
+
className: "text-primary"
|
|
925
|
+
}), /* @__PURE__ */ m("rect", {
|
|
926
|
+
x: n - a / 2,
|
|
927
|
+
y: U.top,
|
|
928
|
+
width: Math.max(2, a),
|
|
929
|
+
height: i,
|
|
930
|
+
fill: "transparent",
|
|
931
|
+
onMouseEnter: () => {
|
|
932
|
+
b.bindHover({
|
|
933
|
+
anchorX: S(n),
|
|
934
|
+
anchorY: r,
|
|
935
|
+
title: `${Oe(e.ts)} · ${e.count} object${e.count === 1 ? "" : "s"}`,
|
|
936
|
+
rows: [{
|
|
937
|
+
label: "Class",
|
|
938
|
+
value: d === W ? "all" : d
|
|
939
|
+
}, {
|
|
940
|
+
label: "Bucket",
|
|
941
|
+
value: _.resolution
|
|
942
|
+
}]
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
})] }, `${e.ts}-${t}`);
|
|
946
|
+
})
|
|
947
|
+
]
|
|
948
|
+
}), /* @__PURE__ */ m(I, {
|
|
949
|
+
state: b.state,
|
|
950
|
+
containerWidth: y
|
|
951
|
+
})] }), E.length > 0 && /* @__PURE__ */ h("div", {
|
|
952
|
+
className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
|
|
953
|
+
children: [/* @__PURE__ */ h("span", { children: [
|
|
954
|
+
E.length,
|
|
955
|
+
" bucket",
|
|
956
|
+
E.length === 1 ? "" : "s",
|
|
957
|
+
" · ",
|
|
958
|
+
_.resolution,
|
|
959
|
+
" ",
|
|
960
|
+
"resolution"
|
|
961
|
+
] }), /* @__PURE__ */ h("span", { children: [
|
|
962
|
+
"peak ",
|
|
963
|
+
E.reduce((e, t) => Math.max(e, t.count), 0),
|
|
964
|
+
" obj"
|
|
965
|
+
] })]
|
|
966
|
+
})]
|
|
967
|
+
})]
|
|
968
|
+
});
|
|
828
969
|
}
|
|
829
|
-
function
|
|
830
|
-
|
|
831
|
-
|
|
970
|
+
function Te(e, t) {
|
|
971
|
+
let n = H - U.top - U.bottom, r = Math.min(1, e / t);
|
|
972
|
+
return U.top + (1 - r) * n;
|
|
832
973
|
}
|
|
833
|
-
function
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
974
|
+
function Ee(e, t, n) {
|
|
975
|
+
if (e.length === 0) return null;
|
|
976
|
+
let r = [];
|
|
977
|
+
for (let i = 0; i < e.length; i++) {
|
|
978
|
+
let a = N(i, e.length, t, U.left, U.right), o = Te(e[i].count, n);
|
|
979
|
+
r.push(`${i === 0 ? "M" : "L"} ${a.toFixed(1)} ${o.toFixed(1)}`);
|
|
980
|
+
}
|
|
981
|
+
return r.join(" ");
|
|
841
982
|
}
|
|
842
|
-
function
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
983
|
+
function De(e) {
|
|
984
|
+
let t = [];
|
|
985
|
+
for (let n = 0; n < 4; n++) {
|
|
986
|
+
let r = n / 3, i = Math.round(e * r), a = H - U.top - U.bottom;
|
|
987
|
+
t.push({
|
|
988
|
+
y: U.top + (1 - r) * a,
|
|
989
|
+
label: `${i}`
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
return t;
|
|
852
993
|
}
|
|
853
|
-
function
|
|
854
|
-
|
|
855
|
-
|
|
994
|
+
function Oe(e) {
|
|
995
|
+
let t = new Date(e);
|
|
996
|
+
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
856
997
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
998
|
+
//#endregion
|
|
999
|
+
//#region src/pipeline-analytics/widgets/MotionHistoryChart.tsx
|
|
1000
|
+
var G = {
|
|
1001
|
+
"1h": {
|
|
1002
|
+
label: "1 h",
|
|
1003
|
+
windowMs: 60 * 6e4,
|
|
1004
|
+
bucketMs: 6e4,
|
|
1005
|
+
pollIntervalMs: 15e3
|
|
1006
|
+
},
|
|
1007
|
+
"6h": {
|
|
1008
|
+
label: "6 h",
|
|
1009
|
+
windowMs: 360 * 6e4,
|
|
1010
|
+
bucketMs: 5 * 6e4,
|
|
1011
|
+
pollIntervalMs: 6e4
|
|
1012
|
+
},
|
|
1013
|
+
"24h": {
|
|
1014
|
+
label: "24 h",
|
|
1015
|
+
windowMs: 1440 * 6e4,
|
|
1016
|
+
bucketMs: 15 * 6e4,
|
|
1017
|
+
pollIntervalMs: 3e5
|
|
1018
|
+
}
|
|
1019
|
+
}, ke = [
|
|
1020
|
+
{
|
|
1021
|
+
id: "1h",
|
|
1022
|
+
label: G["1h"].label
|
|
1023
|
+
},
|
|
1024
|
+
{
|
|
1025
|
+
id: "6h",
|
|
1026
|
+
label: G["6h"].label
|
|
1027
|
+
},
|
|
1028
|
+
{
|
|
1029
|
+
id: "24h",
|
|
1030
|
+
label: G["24h"].label
|
|
1031
|
+
}
|
|
1032
|
+
], Ae = 5e3, K = 140, q = {
|
|
1033
|
+
top: 14,
|
|
1034
|
+
right: 12,
|
|
1035
|
+
bottom: 24,
|
|
1036
|
+
left: 32
|
|
1037
|
+
};
|
|
1038
|
+
function je({ deviceId: n }) {
|
|
1039
|
+
let i = c(f().trpcClient, n), [a, s] = r("1h"), l = G[a], [u, d] = ee(), p = F(), _ = e(null), v = (e) => {
|
|
1040
|
+
let t = _.current;
|
|
1041
|
+
if (!t) return e;
|
|
1042
|
+
let n = t.getBoundingClientRect();
|
|
1043
|
+
return n.width === 0 ? e : e / d * n.width;
|
|
1044
|
+
}, y = o({
|
|
1045
|
+
queryKey: [
|
|
1046
|
+
"pipeline-analytics",
|
|
1047
|
+
n,
|
|
1048
|
+
"motionEvents",
|
|
1049
|
+
a
|
|
1050
|
+
],
|
|
1051
|
+
queryFn: async () => {
|
|
1052
|
+
if (!i) return [];
|
|
1053
|
+
let e = Date.now() - l.windowMs;
|
|
1054
|
+
return await i.pipelineAnalytics?.getMotionEvents({
|
|
1055
|
+
since: e,
|
|
1056
|
+
limit: Ae
|
|
1057
|
+
}) ?? [];
|
|
1058
|
+
},
|
|
1059
|
+
enabled: !!i,
|
|
1060
|
+
refetchInterval: l.pollIntervalMs,
|
|
1061
|
+
staleTime: Math.max(1e3, l.pollIntervalMs / 2)
|
|
1062
|
+
}), b = y.data ?? [], x = y.dataUpdatedAt > 0 ? y.dataUpdatedAt : Date.now(), S = x - l.windowMs, C = t(() => Me(b, S, x, l.bucketMs), [
|
|
1063
|
+
b,
|
|
1064
|
+
S,
|
|
1065
|
+
x,
|
|
1066
|
+
l.bucketMs
|
|
1067
|
+
]), w = t(() => {
|
|
1068
|
+
if (C.length === 0) return 1;
|
|
1069
|
+
let e = C.reduce((e, t) => Math.max(e, t.count), 0);
|
|
1070
|
+
return Math.max(1, Math.ceil(e * 1.15));
|
|
1071
|
+
}, [C]), E = t(() => ne(S, x, d, q.left, q.right, 5), [
|
|
1072
|
+
S,
|
|
1073
|
+
x,
|
|
1074
|
+
d
|
|
1075
|
+
]), D = t(() => Pe(w), [w]), O = b.length;
|
|
1076
|
+
return /* @__PURE__ */ h("div", {
|
|
1077
|
+
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
1078
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1079
|
+
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
1080
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1081
|
+
className: "flex items-center gap-1.5",
|
|
1082
|
+
children: [/* @__PURE__ */ m(T, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
1083
|
+
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
1084
|
+
children: "Motion History"
|
|
1085
|
+
})]
|
|
1086
|
+
}), /* @__PURE__ */ m(M, {
|
|
1087
|
+
presets: ke,
|
|
1088
|
+
value: a,
|
|
1089
|
+
onChange: s
|
|
1090
|
+
})]
|
|
1091
|
+
}), /* @__PURE__ */ h("div", {
|
|
1092
|
+
ref: u,
|
|
1093
|
+
className: "p-3 min-w-0 relative",
|
|
1094
|
+
children: [O === 0 ? /* @__PURE__ */ m("div", {
|
|
1095
|
+
className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
|
|
1096
|
+
children: y.isLoading ? "Loading…" : "No motion events in the selected window."
|
|
1097
|
+
}) : d === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [/* @__PURE__ */ h("svg", {
|
|
1098
|
+
ref: _,
|
|
1099
|
+
role: "img",
|
|
1100
|
+
"aria-label": "Motion event histogram",
|
|
1101
|
+
width: "100%",
|
|
1102
|
+
height: K,
|
|
1103
|
+
viewBox: `0 0 ${d} ${K}`,
|
|
1104
|
+
preserveAspectRatio: "none",
|
|
1105
|
+
className: "block",
|
|
1106
|
+
onMouseLeave: () => p.bindHover(null),
|
|
1107
|
+
children: [
|
|
1108
|
+
D.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
1109
|
+
x1: q.left,
|
|
1110
|
+
x2: d - q.right,
|
|
1111
|
+
y1: e,
|
|
1112
|
+
y2: e,
|
|
1113
|
+
stroke: "currentColor",
|
|
1114
|
+
strokeOpacity: .08,
|
|
1115
|
+
strokeWidth: .5
|
|
1116
|
+
}), /* @__PURE__ */ m("text", {
|
|
1117
|
+
x: q.left - 6,
|
|
1118
|
+
y: e + 3,
|
|
1119
|
+
textAnchor: "end",
|
|
1120
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
1121
|
+
children: t
|
|
1122
|
+
})] }, `y-${n}`)),
|
|
1123
|
+
E.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
|
|
1124
|
+
x: e,
|
|
1125
|
+
y: K - q.bottom + 12,
|
|
1126
|
+
textAnchor: "middle",
|
|
1127
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
1128
|
+
children: t
|
|
1129
|
+
}, `x-${n}`)),
|
|
1130
|
+
C.map((e, t) => {
|
|
1131
|
+
let { x: n, w: r } = Ne(e.bucketStart, l.bucketMs, S, x, d), i = K - q.top - q.bottom, a = e.count / w * i, o = q.top + (i - a), s = e.bucketStart + l.bucketMs;
|
|
1132
|
+
return /* @__PURE__ */ h("g", { children: [e.count > 0 && /* @__PURE__ */ m("rect", {
|
|
1133
|
+
x: n,
|
|
1134
|
+
y: o,
|
|
1135
|
+
width: Math.max(1, r - 1),
|
|
1136
|
+
height: Math.max(1, a),
|
|
1137
|
+
fill: "currentColor",
|
|
1138
|
+
className: "text-primary",
|
|
1139
|
+
opacity: .85
|
|
1140
|
+
}), /* @__PURE__ */ m("rect", {
|
|
1141
|
+
x: n,
|
|
1142
|
+
y: q.top,
|
|
1143
|
+
width: Math.max(2, r),
|
|
1144
|
+
height: i,
|
|
1145
|
+
fill: "transparent",
|
|
1146
|
+
onMouseEnter: () => {
|
|
1147
|
+
p.bindHover({
|
|
1148
|
+
anchorX: v(n + r / 2),
|
|
1149
|
+
anchorY: o,
|
|
1150
|
+
title: `${Fe(e.bucketStart, s)} · ${e.count} event${e.count === 1 ? "" : "s"}`,
|
|
1151
|
+
rows: [{
|
|
1152
|
+
label: "Bucket",
|
|
1153
|
+
value: Ie(l.bucketMs)
|
|
1154
|
+
}, {
|
|
1155
|
+
label: "Count",
|
|
1156
|
+
value: `${e.count}`
|
|
1157
|
+
}]
|
|
1158
|
+
});
|
|
1159
|
+
}
|
|
1160
|
+
})] }, `${e.bucketStart}-${t}`);
|
|
1161
|
+
})
|
|
1162
|
+
]
|
|
1163
|
+
}), /* @__PURE__ */ m(I, {
|
|
1164
|
+
state: p.state,
|
|
1165
|
+
containerWidth: d
|
|
1166
|
+
})] }), O > 0 && /* @__PURE__ */ h("div", {
|
|
1167
|
+
className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
|
|
1168
|
+
children: [/* @__PURE__ */ h("span", { children: [
|
|
1169
|
+
O,
|
|
1170
|
+
" event",
|
|
1171
|
+
O === 1 ? "" : "s",
|
|
1172
|
+
" · ",
|
|
1173
|
+
Ie(l.bucketMs),
|
|
1174
|
+
" ",
|
|
1175
|
+
"buckets"
|
|
1176
|
+
] }), /* @__PURE__ */ h("span", { children: [
|
|
1177
|
+
"peak ",
|
|
1178
|
+
C.reduce((e, t) => Math.max(e, t.count), 0),
|
|
1179
|
+
"/bucket"
|
|
1180
|
+
] })]
|
|
1181
|
+
})]
|
|
1182
|
+
})]
|
|
1183
|
+
});
|
|
984
1184
|
}
|
|
985
|
-
function
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
1185
|
+
function Me(e, t, n, r) {
|
|
1186
|
+
if (n <= t) return [];
|
|
1187
|
+
let i = Math.floor(t / r) * r, a = Math.floor(n / r) * r, o = /* @__PURE__ */ new Map();
|
|
1188
|
+
for (let e = i; e <= a; e += r) o.set(e, 0);
|
|
1189
|
+
for (let i of e) {
|
|
1190
|
+
if (i.timestamp < t || i.timestamp > n) continue;
|
|
1191
|
+
let e = Math.floor(i.timestamp / r) * r;
|
|
1192
|
+
o.set(e, (o.get(e) ?? 0) + 1);
|
|
1193
|
+
}
|
|
1194
|
+
return [...o.entries()].toSorted(([e], [t]) => e - t).map(([e, t]) => ({
|
|
1195
|
+
bucketStart: e,
|
|
1196
|
+
count: t
|
|
1197
|
+
}));
|
|
996
1198
|
}
|
|
997
|
-
function
|
|
998
|
-
|
|
999
|
-
|
|
1199
|
+
function Ne(e, t, n, r, i) {
|
|
1200
|
+
let a = Math.max(1, r - n), o = i - q.left - q.right;
|
|
1201
|
+
return {
|
|
1202
|
+
x: q.left + (e - n) / a * o,
|
|
1203
|
+
w: t / a * o
|
|
1204
|
+
};
|
|
1000
1205
|
}
|
|
1001
|
-
function
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1206
|
+
function Pe(e) {
|
|
1207
|
+
let t = [];
|
|
1208
|
+
for (let n = 0; n < 4; n++) {
|
|
1209
|
+
let r = n / 3, i = Math.round(e * r), a = K - q.top - q.bottom;
|
|
1210
|
+
t.push({
|
|
1211
|
+
y: q.top + (1 - r) * a,
|
|
1212
|
+
label: `${i}`
|
|
1213
|
+
});
|
|
1214
|
+
}
|
|
1215
|
+
return t;
|
|
1011
1216
|
}
|
|
1012
|
-
function
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1217
|
+
function Fe(e, t) {
|
|
1218
|
+
let n = (e) => {
|
|
1219
|
+
let t = new Date(e);
|
|
1220
|
+
return `${String(t.getHours()).padStart(2, "0")}:${String(t.getMinutes()).padStart(2, "0")}`;
|
|
1221
|
+
};
|
|
1222
|
+
return `${n(e)}–${n(t)}`;
|
|
1018
1223
|
}
|
|
1019
|
-
function
|
|
1020
|
-
|
|
1224
|
+
function Ie(e) {
|
|
1225
|
+
return e >= 60 * 6e4 ? `${Math.round(e / 6e4 / 60)}h` : e >= 6e4 ? `${Math.round(e / 6e4)}m` : `${Math.round(e / 1e3)}s`;
|
|
1021
1226
|
}
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1227
|
+
//#endregion
|
|
1228
|
+
//#region src/pipeline-analytics/widgets/DetectionHistoryChart.tsx
|
|
1229
|
+
var J = {
|
|
1230
|
+
"1h": {
|
|
1231
|
+
label: "1 h",
|
|
1232
|
+
windowMs: 60 * 6e4,
|
|
1233
|
+
bucketMs: 6e4,
|
|
1234
|
+
pollIntervalMs: 15e3
|
|
1235
|
+
},
|
|
1236
|
+
"6h": {
|
|
1237
|
+
label: "6 h",
|
|
1238
|
+
windowMs: 360 * 6e4,
|
|
1239
|
+
bucketMs: 5 * 6e4,
|
|
1240
|
+
pollIntervalMs: 6e4
|
|
1241
|
+
},
|
|
1242
|
+
"24h": {
|
|
1243
|
+
label: "24 h",
|
|
1244
|
+
windowMs: 1440 * 6e4,
|
|
1245
|
+
bucketMs: 15 * 6e4,
|
|
1246
|
+
pollIntervalMs: 3e5
|
|
1247
|
+
}
|
|
1248
|
+
}, Le = [
|
|
1249
|
+
{
|
|
1250
|
+
id: "1h",
|
|
1251
|
+
label: J["1h"].label
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
id: "6h",
|
|
1255
|
+
label: J["6h"].label
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
id: "24h",
|
|
1259
|
+
label: J["24h"].label
|
|
1260
|
+
}
|
|
1261
|
+
], Re = 5e3, ze = 4, Y = "__other__", X = "__all__", Z = 160, Q = {
|
|
1262
|
+
top: 14,
|
|
1263
|
+
right: 12,
|
|
1264
|
+
bottom: 24,
|
|
1265
|
+
left: 32
|
|
1266
|
+
};
|
|
1267
|
+
function Be({ deviceId: n }) {
|
|
1268
|
+
let a = c(f().trpcClient, n), [s, l] = r("1h"), [u, d] = r(X), p = J[s], [_, v] = ee(), y = F(), b = e(null), x = o({
|
|
1269
|
+
queryKey: [
|
|
1270
|
+
"pipeline-analytics",
|
|
1271
|
+
n,
|
|
1272
|
+
"objectEvents",
|
|
1273
|
+
s
|
|
1274
|
+
],
|
|
1275
|
+
queryFn: async () => {
|
|
1276
|
+
if (!a) return [];
|
|
1277
|
+
let e = Date.now() - p.windowMs;
|
|
1278
|
+
return await a.pipelineAnalytics?.getObjectEvents({
|
|
1279
|
+
since: e,
|
|
1280
|
+
limit: Re
|
|
1281
|
+
}) ?? [];
|
|
1282
|
+
},
|
|
1283
|
+
enabled: !!a,
|
|
1284
|
+
refetchInterval: p.pollIntervalMs,
|
|
1285
|
+
staleTime: Math.max(1e3, p.pollIntervalMs / 2)
|
|
1286
|
+
}), S = x.data ?? [], C = t(() => u === X ? S : S.filter((e) => e.className === u), [S, u]), w = x.dataUpdatedAt > 0 ? x.dataUpdatedAt : Date.now(), T = w - p.windowMs, E = t(() => {
|
|
1287
|
+
let e = /* @__PURE__ */ new Set();
|
|
1288
|
+
for (let t of S) e.add(t.className);
|
|
1289
|
+
return u !== X && e.add(u), [...e].toSorted();
|
|
1290
|
+
}, [S, u]);
|
|
1291
|
+
i(() => {
|
|
1292
|
+
u !== X && S.length > 0 && !E.includes(u) && d(X);
|
|
1293
|
+
}, [
|
|
1294
|
+
u,
|
|
1295
|
+
S,
|
|
1296
|
+
E
|
|
1297
|
+
]);
|
|
1298
|
+
let O = t(() => Ve(C, ze), [C]), k = t(() => He(C, T, w, p.bucketMs, O), [
|
|
1299
|
+
C,
|
|
1300
|
+
T,
|
|
1301
|
+
w,
|
|
1302
|
+
p.bucketMs,
|
|
1303
|
+
O
|
|
1304
|
+
]), A = t(() => {
|
|
1305
|
+
if (k.length === 0) return 1;
|
|
1306
|
+
let e = k.reduce((e, t) => Math.max(e, t.total), 0);
|
|
1307
|
+
return Math.max(1, Math.ceil(e * 1.15));
|
|
1308
|
+
}, [k]), j = t(() => ne(T, w, v, Q.left, Q.right, 5), [
|
|
1309
|
+
T,
|
|
1310
|
+
w,
|
|
1311
|
+
v
|
|
1312
|
+
]), te = t(() => We(A), [A]), N = t(() => {
|
|
1313
|
+
let e = O.map((e) => e.className);
|
|
1314
|
+
return C.some((e) => !O.some((t) => t.className === e.className)) && e.push(Y), e;
|
|
1315
|
+
}, [C, O]), P = (e) => {
|
|
1316
|
+
let t = b.current;
|
|
1317
|
+
if (!t) return e;
|
|
1318
|
+
let n = t.getBoundingClientRect();
|
|
1319
|
+
return n.width === 0 ? e : e / v * n.width;
|
|
1320
|
+
};
|
|
1321
|
+
return /* @__PURE__ */ h("div", {
|
|
1322
|
+
className: "rounded-lg border border-border bg-surface overflow-hidden",
|
|
1323
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1324
|
+
className: "border-b border-border px-4 py-2 flex items-center justify-between gap-3",
|
|
1325
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1326
|
+
className: "flex items-center gap-1.5",
|
|
1327
|
+
children: [/* @__PURE__ */ m(D, { className: "h-3.5 w-3.5 text-foreground-subtle" }), /* @__PURE__ */ m("h2", {
|
|
1328
|
+
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
1329
|
+
children: "Detection History"
|
|
1330
|
+
})]
|
|
1331
|
+
}), /* @__PURE__ */ h("div", {
|
|
1332
|
+
className: "flex items-center gap-2",
|
|
1333
|
+
children: [E.length > 0 && /* @__PURE__ */ h("select", {
|
|
1334
|
+
value: u,
|
|
1335
|
+
onChange: (e) => d(e.target.value),
|
|
1336
|
+
className: "text-[10px] px-1.5 py-0.5 rounded border border-border bg-background text-foreground focus:outline-none focus:ring-1 focus:ring-primary/40",
|
|
1337
|
+
title: "Filter by detected class",
|
|
1338
|
+
children: [/* @__PURE__ */ m("option", {
|
|
1339
|
+
value: X,
|
|
1340
|
+
children: "All classes"
|
|
1341
|
+
}), E.map((e) => /* @__PURE__ */ m("option", {
|
|
1342
|
+
value: e,
|
|
1343
|
+
children: e
|
|
1344
|
+
}, e))]
|
|
1345
|
+
}), /* @__PURE__ */ m(M, {
|
|
1346
|
+
presets: Le,
|
|
1347
|
+
value: s,
|
|
1348
|
+
onChange: l
|
|
1349
|
+
})]
|
|
1350
|
+
})]
|
|
1351
|
+
}), /* @__PURE__ */ h("div", {
|
|
1352
|
+
ref: _,
|
|
1353
|
+
className: "p-3 min-w-0 relative",
|
|
1354
|
+
children: [C.length === 0 ? /* @__PURE__ */ m("div", {
|
|
1355
|
+
className: "flex items-center justify-center h-32 text-[11px] text-foreground-subtle italic",
|
|
1356
|
+
children: x.isLoading ? "Loading…" : "No detection events in the selected window."
|
|
1357
|
+
}) : v === 0 ? /* @__PURE__ */ m("div", { className: "h-32" }) : /* @__PURE__ */ h(g, { children: [
|
|
1358
|
+
/* @__PURE__ */ h("svg", {
|
|
1359
|
+
ref: b,
|
|
1360
|
+
role: "img",
|
|
1361
|
+
"aria-label": "Detection event histogram",
|
|
1362
|
+
width: "100%",
|
|
1363
|
+
height: Z,
|
|
1364
|
+
viewBox: `0 0 ${v} ${Z}`,
|
|
1365
|
+
preserveAspectRatio: "none",
|
|
1366
|
+
className: "block",
|
|
1367
|
+
onMouseLeave: () => y.bindHover(null),
|
|
1368
|
+
children: [
|
|
1369
|
+
te.map(({ y: e, label: t }, n) => /* @__PURE__ */ h("g", { children: [/* @__PURE__ */ m("line", {
|
|
1370
|
+
x1: Q.left,
|
|
1371
|
+
x2: v - Q.right,
|
|
1372
|
+
y1: e,
|
|
1373
|
+
y2: e,
|
|
1374
|
+
stroke: "currentColor",
|
|
1375
|
+
strokeOpacity: .08,
|
|
1376
|
+
strokeWidth: .5
|
|
1377
|
+
}), /* @__PURE__ */ m("text", {
|
|
1378
|
+
x: Q.left - 6,
|
|
1379
|
+
y: e + 3,
|
|
1380
|
+
textAnchor: "end",
|
|
1381
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
1382
|
+
children: t
|
|
1383
|
+
})] }, `y-${n}`)),
|
|
1384
|
+
j.map(({ x: e, label: t }, n) => /* @__PURE__ */ m("text", {
|
|
1385
|
+
x: e,
|
|
1386
|
+
y: Z - Q.bottom + 12,
|
|
1387
|
+
textAnchor: "middle",
|
|
1388
|
+
className: "text-[9px] fill-foreground-subtle",
|
|
1389
|
+
children: t
|
|
1390
|
+
}, `x-${n}`)),
|
|
1391
|
+
k.map((e, t) => {
|
|
1392
|
+
if (e.total === 0) return null;
|
|
1393
|
+
let { x: n, w: r } = Ue(e.bucketStart, p.bucketMs, T, w, v), i = Z - Q.top - Q.bottom, a = e.total / A * i, o = Q.top + (i - a), s = 0, c = N.map((t, a) => {
|
|
1394
|
+
let o = e.byClass[t] ?? 0;
|
|
1395
|
+
if (o === 0) return null;
|
|
1396
|
+
let c = o / A * i, l = Q.top + (i - s - c);
|
|
1397
|
+
s += c;
|
|
1398
|
+
let u = t === Y ? "#94a3b8" : re(a);
|
|
1399
|
+
return /* @__PURE__ */ m("rect", {
|
|
1400
|
+
x: n,
|
|
1401
|
+
y: l,
|
|
1402
|
+
width: Math.max(1, r - 1),
|
|
1403
|
+
height: Math.max(1, c),
|
|
1404
|
+
fill: u,
|
|
1405
|
+
opacity: .9
|
|
1406
|
+
}, `${e.bucketStart}-${t}`);
|
|
1407
|
+
}).filter((e) => e !== null), l = e.bucketStart + p.bucketMs;
|
|
1408
|
+
return /* @__PURE__ */ h("g", { children: [c, /* @__PURE__ */ m("rect", {
|
|
1409
|
+
x: n,
|
|
1410
|
+
y: Q.top,
|
|
1411
|
+
width: Math.max(2, r),
|
|
1412
|
+
height: i,
|
|
1413
|
+
fill: "transparent",
|
|
1414
|
+
onMouseEnter: () => {
|
|
1415
|
+
y.bindHover({
|
|
1416
|
+
anchorX: P(n + r / 2),
|
|
1417
|
+
anchorY: o,
|
|
1418
|
+
title: `${Ge(e.bucketStart, l, p.bucketMs)} · ${e.total} detection${e.total === 1 ? "" : "s"}`,
|
|
1419
|
+
rows: N.map((t, n) => {
|
|
1420
|
+
let r = e.byClass[t] ?? 0;
|
|
1421
|
+
return r === 0 ? null : {
|
|
1422
|
+
label: t === Y ? "other" : t,
|
|
1423
|
+
value: `${r}`,
|
|
1424
|
+
colour: t === Y ? "#94a3b8" : re(n)
|
|
1425
|
+
};
|
|
1426
|
+
}).filter((e) => e !== null)
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
})] }, `g-${e.bucketStart}-${t}`);
|
|
1430
|
+
})
|
|
1431
|
+
]
|
|
1432
|
+
}),
|
|
1433
|
+
/* @__PURE__ */ m(I, {
|
|
1434
|
+
state: y.state,
|
|
1435
|
+
containerWidth: v
|
|
1436
|
+
}),
|
|
1437
|
+
/* @__PURE__ */ m(qe, { stackOrder: N })
|
|
1438
|
+
] }), C.length > 0 && /* @__PURE__ */ h("div", {
|
|
1439
|
+
className: "flex items-center justify-between text-[10px] text-foreground-subtle mt-1",
|
|
1440
|
+
children: [/* @__PURE__ */ h("span", { children: [
|
|
1441
|
+
C.length,
|
|
1442
|
+
" detection",
|
|
1443
|
+
C.length === 1 ? "" : "s",
|
|
1444
|
+
" ·",
|
|
1445
|
+
" ",
|
|
1446
|
+
Ke(p.bucketMs),
|
|
1447
|
+
" buckets"
|
|
1448
|
+
] }), /* @__PURE__ */ h("span", { children: [
|
|
1449
|
+
"peak ",
|
|
1450
|
+
k.reduce((e, t) => Math.max(e, t.total), 0),
|
|
1451
|
+
"/bucket"
|
|
1452
|
+
] })]
|
|
1453
|
+
})]
|
|
1454
|
+
})]
|
|
1455
|
+
});
|
|
1193
1456
|
}
|
|
1194
|
-
function
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1457
|
+
function Ve(e, t) {
|
|
1458
|
+
let n = /* @__PURE__ */ new Map();
|
|
1459
|
+
for (let t of e) n.set(t.className, (n.get(t.className) ?? 0) + 1);
|
|
1460
|
+
return [...n.entries()].toSorted(([, e], [, t]) => t - e).slice(0, t).map(([e, t]) => ({
|
|
1461
|
+
className: e,
|
|
1462
|
+
count: t
|
|
1463
|
+
}));
|
|
1199
1464
|
}
|
|
1200
|
-
function
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1465
|
+
function He(e, t, n, r, i) {
|
|
1466
|
+
if (n <= t) return [];
|
|
1467
|
+
let a = new Set(i.map((e) => e.className)), o = Math.floor(t / r) * r, s = Math.floor(n / r) * r, c = /* @__PURE__ */ new Map();
|
|
1468
|
+
for (let e = o; e <= s; e += r) c.set(e, {
|
|
1469
|
+
total: 0,
|
|
1470
|
+
byClass: {}
|
|
1471
|
+
});
|
|
1472
|
+
for (let i of e) {
|
|
1473
|
+
if (i.timestamp < t || i.timestamp > n) continue;
|
|
1474
|
+
let e = Math.floor(i.timestamp / r) * r, o = c.get(e);
|
|
1475
|
+
if (!o) continue;
|
|
1476
|
+
o.total += 1;
|
|
1477
|
+
let s = a.has(i.className) ? i.className : Y;
|
|
1478
|
+
o.byClass[s] = (o.byClass[s] ?? 0) + 1;
|
|
1479
|
+
}
|
|
1480
|
+
return [...c.entries()].toSorted(([e], [t]) => e - t).map(([e, t]) => ({
|
|
1481
|
+
bucketStart: e,
|
|
1482
|
+
total: t.total,
|
|
1483
|
+
byClass: t.byClass
|
|
1484
|
+
}));
|
|
1218
1485
|
}
|
|
1219
|
-
function
|
|
1220
|
-
|
|
1221
|
-
|
|
1486
|
+
function Ue(e, t, n, r, i) {
|
|
1487
|
+
let a = Math.max(1, r - n), o = i - Q.left - Q.right;
|
|
1488
|
+
return {
|
|
1489
|
+
x: Q.left + (e - n) / a * o,
|
|
1490
|
+
w: t / a * o
|
|
1491
|
+
};
|
|
1222
1492
|
}
|
|
1223
|
-
function
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1493
|
+
function We(e) {
|
|
1494
|
+
let t = [];
|
|
1495
|
+
for (let n = 0; n < 4; n++) {
|
|
1496
|
+
let r = n / 3, i = Math.round(e * r), a = Z - Q.top - Q.bottom;
|
|
1497
|
+
t.push({
|
|
1498
|
+
y: Q.top + (1 - r) * a,
|
|
1499
|
+
label: `${i}`
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
return t;
|
|
1233
1503
|
}
|
|
1234
|
-
function
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
return `${s}:${d}`;
|
|
1238
|
-
};
|
|
1239
|
-
return o >= 60 * 6e4 ? `${r(new Date(e))}–${r(new Date(t))}` : `${r(new Date(e))}–${r(new Date(t))}`;
|
|
1504
|
+
function Ge(e, t, n) {
|
|
1505
|
+
let r = (e) => `${String(e.getHours()).padStart(2, "0")}:${String(e.getMinutes()).padStart(2, "0")}`;
|
|
1506
|
+
return `${r(new Date(e))}–${r(new Date(t))}`;
|
|
1240
1507
|
}
|
|
1241
|
-
function
|
|
1242
|
-
|
|
1508
|
+
function Ke(e) {
|
|
1509
|
+
return e >= 60 * 6e4 ? `${Math.round(e / 6e4 / 60)}h` : e >= 6e4 ? `${Math.round(e / 6e4)}m` : `${Math.round(e / 1e3)}s`;
|
|
1243
1510
|
}
|
|
1244
|
-
function
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1511
|
+
function qe({ stackOrder: e }) {
|
|
1512
|
+
return e.length === 0 ? null : /* @__PURE__ */ m("div", {
|
|
1513
|
+
className: "flex flex-wrap gap-2 mt-2 px-1",
|
|
1514
|
+
children: e.map((e, t) => /* @__PURE__ */ h("span", {
|
|
1515
|
+
className: "inline-flex items-center gap-1 text-[10px] text-foreground-subtle",
|
|
1516
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1517
|
+
className: "inline-block h-2 w-2 rounded-sm",
|
|
1518
|
+
style: { backgroundColor: e === Y ? "#94a3b8" : re(t) }
|
|
1519
|
+
}), /* @__PURE__ */ m("span", { children: e === Y ? "other" : e })]
|
|
1520
|
+
}, e))
|
|
1521
|
+
});
|
|
1252
1522
|
}
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1523
|
+
//#endregion
|
|
1524
|
+
//#region src/pipeline-analytics/widgets/OccupancyPanel.tsx
|
|
1525
|
+
function Je({ dev: e, deviceId: t, title: n = "Live Occupancy", variant: r = "full" }) {
|
|
1526
|
+
let i = c(f().trpcClient, e === void 0 && t !== void 0 ? t : null), a = e ?? i, o = u(a?.state.zoneAnalytics);
|
|
1527
|
+
return o ? /* @__PURE__ */ m(Ye, {
|
|
1528
|
+
title: n,
|
|
1529
|
+
variant: r,
|
|
1530
|
+
ts: o.ts,
|
|
1531
|
+
children: /* @__PURE__ */ h("div", {
|
|
1532
|
+
className: r === "compact" ? "space-y-2" : "grid grid-cols-1 2xl:grid-cols-3 gap-3",
|
|
1533
|
+
children: [
|
|
1534
|
+
/* @__PURE__ */ m(Ze, { frame: o.frame }),
|
|
1535
|
+
/* @__PURE__ */ m($e, { snapshot: o }),
|
|
1536
|
+
/* @__PURE__ */ m(Qe, { unzoned: o.unzoned })
|
|
1537
|
+
]
|
|
1538
|
+
})
|
|
1539
|
+
}) : /* @__PURE__ */ m(Ye, {
|
|
1540
|
+
title: n,
|
|
1541
|
+
variant: r,
|
|
1542
|
+
children: /* @__PURE__ */ m(Xe, { message: a ? "No occupancy data yet — analytics pipeline must be active for this device." : "Resolving device…" })
|
|
1543
|
+
});
|
|
1268
1544
|
}
|
|
1269
|
-
function
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1545
|
+
function Ye({ title: e, variant: t, ts: n, children: r }) {
|
|
1546
|
+
let i = n ? Math.max(0, Math.floor((Date.now() - n) / 1e3)) : null;
|
|
1547
|
+
return /* @__PURE__ */ h("div", {
|
|
1548
|
+
className: t === "compact" ? "rounded-md border border-border/60 bg-surface/60 p-3" : "rounded-lg border border-border bg-surface overflow-hidden",
|
|
1549
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1550
|
+
className: t === "compact" ? "flex items-center justify-between mb-2" : "border-b border-border px-4 py-2 flex items-center justify-between",
|
|
1551
|
+
children: [/* @__PURE__ */ m("h2", {
|
|
1552
|
+
className: "text-xs font-semibold text-foreground uppercase tracking-wider",
|
|
1553
|
+
children: e
|
|
1554
|
+
}), i !== null && /* @__PURE__ */ m("span", {
|
|
1555
|
+
className: "text-[10px] text-foreground-subtle",
|
|
1556
|
+
children: i === 0 ? "just now" : `${i}s ago`
|
|
1557
|
+
})]
|
|
1558
|
+
}), /* @__PURE__ */ m("div", {
|
|
1559
|
+
className: t === "compact" ? "" : "p-3",
|
|
1560
|
+
children: r
|
|
1561
|
+
})]
|
|
1562
|
+
});
|
|
1278
1563
|
}
|
|
1279
|
-
function
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1564
|
+
function Xe({ message: e }) {
|
|
1565
|
+
return /* @__PURE__ */ h("div", {
|
|
1566
|
+
className: "px-4 py-6 flex flex-col items-center text-center text-foreground-subtle",
|
|
1567
|
+
children: [/* @__PURE__ */ m(O, { className: "h-5 w-5 mb-2 opacity-30" }), /* @__PURE__ */ m("p", {
|
|
1568
|
+
className: "text-[11px]",
|
|
1569
|
+
children: e
|
|
1570
|
+
})]
|
|
1571
|
+
});
|
|
1284
1572
|
}
|
|
1285
|
-
function
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
tone: "default"
|
|
1294
|
-
}
|
|
1295
|
-
);
|
|
1573
|
+
function Ze({ frame: e }) {
|
|
1574
|
+
return /* @__PURE__ */ m(et, {
|
|
1575
|
+
icon: /* @__PURE__ */ m(E, { className: "h-3.5 w-3.5" }),
|
|
1576
|
+
label: "Frame total",
|
|
1577
|
+
total: e.totalObjects,
|
|
1578
|
+
byClass: e.byClass,
|
|
1579
|
+
tone: "default"
|
|
1580
|
+
});
|
|
1296
1581
|
}
|
|
1297
|
-
function
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
tone: "muted"
|
|
1306
|
-
}
|
|
1307
|
-
);
|
|
1582
|
+
function Qe({ unzoned: e }) {
|
|
1583
|
+
return /* @__PURE__ */ m(et, {
|
|
1584
|
+
icon: /* @__PURE__ */ m(k, { className: "h-3.5 w-3.5" }),
|
|
1585
|
+
label: "Outside any zone",
|
|
1586
|
+
total: e.totalObjects,
|
|
1587
|
+
byClass: e.byClass,
|
|
1588
|
+
tone: "muted"
|
|
1589
|
+
});
|
|
1308
1590
|
}
|
|
1309
|
-
function
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1591
|
+
function $e({ snapshot: e }) {
|
|
1592
|
+
return e.zones.length === 0 ? /* @__PURE__ */ m(et, {
|
|
1593
|
+
icon: /* @__PURE__ */ m(O, { className: "h-3.5 w-3.5" }),
|
|
1594
|
+
label: "Per-zone",
|
|
1595
|
+
total: 0,
|
|
1596
|
+
byClass: {},
|
|
1597
|
+
tone: "muted",
|
|
1598
|
+
emptyMessage: "No zones defined for this camera."
|
|
1599
|
+
}) : /* @__PURE__ */ h("div", {
|
|
1600
|
+
className: "rounded-md border border-border/60 bg-background/40",
|
|
1601
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1602
|
+
className: "px-3 py-1.5 border-b border-border/40 flex items-center gap-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
1603
|
+
children: [
|
|
1604
|
+
/* @__PURE__ */ m(O, { className: "h-3.5 w-3.5" }),
|
|
1605
|
+
/* @__PURE__ */ m("span", { children: "Per-zone" }),
|
|
1606
|
+
/* @__PURE__ */ m("span", {
|
|
1607
|
+
className: "ml-auto text-[10px] normal-case tracking-normal",
|
|
1608
|
+
children: e.zones.length
|
|
1609
|
+
})
|
|
1610
|
+
]
|
|
1611
|
+
}), /* @__PURE__ */ m("div", {
|
|
1612
|
+
className: "divide-y divide-border/30",
|
|
1613
|
+
children: e.zones.map((e) => /* @__PURE__ */ h("div", {
|
|
1614
|
+
className: "px-3 py-2",
|
|
1615
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1616
|
+
className: "flex items-center justify-between mb-1",
|
|
1617
|
+
children: [/* @__PURE__ */ m("span", {
|
|
1618
|
+
className: "text-xs font-medium text-foreground truncate",
|
|
1619
|
+
children: e.zoneName
|
|
1620
|
+
}), /* @__PURE__ */ m("span", {
|
|
1621
|
+
className: "rounded-full px-2 py-0.5 text-[10px] font-medium bg-foreground-subtle/10 text-foreground-subtle border border-border",
|
|
1622
|
+
children: e.totalObjects
|
|
1623
|
+
})]
|
|
1624
|
+
}), /* @__PURE__ */ m(tt, { byClass: e.byClass })]
|
|
1625
|
+
}, e.zoneId))
|
|
1626
|
+
})]
|
|
1627
|
+
});
|
|
1334
1628
|
}
|
|
1335
|
-
function
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1629
|
+
function et({ icon: e, label: t, total: n, byClass: r, tone: i, emptyMessage: a }) {
|
|
1630
|
+
let o = Object.keys(r).length;
|
|
1631
|
+
return /* @__PURE__ */ h("div", {
|
|
1632
|
+
className: i === "muted" ? "rounded-md border border-border/40 bg-background/20 px-3 py-2" : "rounded-md border border-border/60 bg-background/40 px-3 py-2",
|
|
1633
|
+
children: [/* @__PURE__ */ h("div", {
|
|
1634
|
+
className: "flex items-center gap-1.5 mb-1.5 text-[11px] uppercase tracking-wider text-foreground-subtle",
|
|
1635
|
+
children: [
|
|
1636
|
+
e,
|
|
1637
|
+
/* @__PURE__ */ m("span", { children: t }),
|
|
1638
|
+
/* @__PURE__ */ m("span", {
|
|
1639
|
+
className: "ml-auto text-base font-semibold text-foreground tabular-nums normal-case tracking-normal",
|
|
1640
|
+
children: n
|
|
1641
|
+
})
|
|
1642
|
+
]
|
|
1643
|
+
}), o === 0 ? /* @__PURE__ */ m("span", {
|
|
1644
|
+
className: "text-[10px] text-foreground-subtle italic",
|
|
1645
|
+
children: a ?? "no objects"
|
|
1646
|
+
}) : /* @__PURE__ */ m(tt, { byClass: r })]
|
|
1647
|
+
});
|
|
1345
1648
|
}
|
|
1346
|
-
function
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
)) });
|
|
1649
|
+
function tt({ byClass: e }) {
|
|
1650
|
+
let n = t(() => Object.entries(e).sort(([, e], [, t]) => t - e), [e]);
|
|
1651
|
+
return n.length === 0 ? /* @__PURE__ */ m("span", {
|
|
1652
|
+
className: "text-[10px] text-foreground-subtle italic",
|
|
1653
|
+
children: "no objects"
|
|
1654
|
+
}) : /* @__PURE__ */ m("div", {
|
|
1655
|
+
className: "flex flex-wrap gap-1",
|
|
1656
|
+
children: n.map(([e, t]) => /* @__PURE__ */ h("span", {
|
|
1657
|
+
className: "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium bg-primary/10 text-primary border border-primary/20",
|
|
1658
|
+
children: [/* @__PURE__ */ m("span", { children: e }), /* @__PURE__ */ m("span", {
|
|
1659
|
+
className: "tabular-nums opacity-80",
|
|
1660
|
+
children: t
|
|
1661
|
+
})]
|
|
1662
|
+
}, e))
|
|
1663
|
+
});
|
|
1362
1664
|
}
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
deviceId: e
|
|
1405
|
-
}
|
|
1406
|
-
),
|
|
1407
|
-
/* @__PURE__ */ n(
|
|
1408
|
-
B,
|
|
1409
|
-
{
|
|
1410
|
-
widgetId: "pipeline-analytics/motion-history-chart",
|
|
1411
|
-
host: "device-tab",
|
|
1412
|
-
deviceId: e
|
|
1413
|
-
}
|
|
1414
|
-
),
|
|
1415
|
-
/* @__PURE__ */ n(
|
|
1416
|
-
B,
|
|
1417
|
-
{
|
|
1418
|
-
widgetId: "pipeline-analytics/detection-history-chart",
|
|
1419
|
-
host: "device-tab",
|
|
1420
|
-
deviceId: e
|
|
1421
|
-
}
|
|
1422
|
-
)
|
|
1423
|
-
] });
|
|
1665
|
+
//#endregion
|
|
1666
|
+
//#region src/pipeline-analytics/widgets/LiveStatsTab.tsx
|
|
1667
|
+
function nt({ deviceId: e }) {
|
|
1668
|
+
return /* @__PURE__ */ h("div", {
|
|
1669
|
+
className: l,
|
|
1670
|
+
children: [
|
|
1671
|
+
/* @__PURE__ */ h("div", {
|
|
1672
|
+
className: `grid ${p}`,
|
|
1673
|
+
style: { gridTemplateColumns: "repeat(auto-fit, minmax(min(100%, 340px), 1fr))" },
|
|
1674
|
+
children: [/* @__PURE__ */ m(d, {
|
|
1675
|
+
widgetId: "pipeline-analytics/live-occupancy-panel",
|
|
1676
|
+
host: "device-tab",
|
|
1677
|
+
deviceId: e
|
|
1678
|
+
}), /* @__PURE__ */ m(d, {
|
|
1679
|
+
widgetId: "pipeline-analytics/audio-metrics-panel",
|
|
1680
|
+
host: "device-tab",
|
|
1681
|
+
deviceId: e
|
|
1682
|
+
})]
|
|
1683
|
+
}),
|
|
1684
|
+
/* @__PURE__ */ m(d, {
|
|
1685
|
+
widgetId: "pipeline-analytics/audio-history-chart",
|
|
1686
|
+
host: "device-tab",
|
|
1687
|
+
deviceId: e
|
|
1688
|
+
}),
|
|
1689
|
+
/* @__PURE__ */ m(d, {
|
|
1690
|
+
widgetId: "pipeline-analytics/occupancy-history-chart",
|
|
1691
|
+
host: "device-tab",
|
|
1692
|
+
deviceId: e
|
|
1693
|
+
}),
|
|
1694
|
+
/* @__PURE__ */ m(d, {
|
|
1695
|
+
widgetId: "pipeline-analytics/motion-history-chart",
|
|
1696
|
+
host: "device-tab",
|
|
1697
|
+
deviceId: e
|
|
1698
|
+
}),
|
|
1699
|
+
/* @__PURE__ */ m(d, {
|
|
1700
|
+
widgetId: "pipeline-analytics/detection-history-chart",
|
|
1701
|
+
host: "device-tab",
|
|
1702
|
+
deviceId: e
|
|
1703
|
+
})
|
|
1704
|
+
]
|
|
1705
|
+
});
|
|
1424
1706
|
}
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1707
|
+
//#endregion
|
|
1708
|
+
//#region src/pipeline-analytics/widgets/index.tsx
|
|
1709
|
+
function $({ name: e }) {
|
|
1710
|
+
return /* @__PURE__ */ h("div", {
|
|
1711
|
+
className: "rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning",
|
|
1712
|
+
children: [e, " requires a deviceId"]
|
|
1713
|
+
});
|
|
1430
1714
|
}
|
|
1431
|
-
function
|
|
1432
|
-
|
|
1715
|
+
function rt(e) {
|
|
1716
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "AudioHistoryChart" }) : /* @__PURE__ */ m(se, { deviceId: e.deviceId });
|
|
1433
1717
|
}
|
|
1434
|
-
function
|
|
1435
|
-
|
|
1718
|
+
function it(e) {
|
|
1719
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "AudioMetricsPanel" }) : /* @__PURE__ */ m(_e, { deviceId: e.deviceId });
|
|
1436
1720
|
}
|
|
1437
|
-
function
|
|
1438
|
-
|
|
1721
|
+
function at(e) {
|
|
1722
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "OccupancyHistoryChart" }) : /* @__PURE__ */ m(we, { deviceId: e.deviceId });
|
|
1439
1723
|
}
|
|
1440
|
-
function
|
|
1441
|
-
|
|
1724
|
+
function ot(e) {
|
|
1725
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "MotionHistoryChart" }) : /* @__PURE__ */ m(je, { deviceId: e.deviceId });
|
|
1442
1726
|
}
|
|
1443
|
-
function
|
|
1444
|
-
|
|
1727
|
+
function st(e) {
|
|
1728
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "DetectionHistoryChart" }) : /* @__PURE__ */ m(Be, { deviceId: e.deviceId });
|
|
1445
1729
|
}
|
|
1446
|
-
function
|
|
1447
|
-
|
|
1730
|
+
function ct(e) {
|
|
1731
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "LiveOccupancyPanel" }) : /* @__PURE__ */ m(Je, { deviceId: e.deviceId });
|
|
1448
1732
|
}
|
|
1449
|
-
function
|
|
1450
|
-
|
|
1733
|
+
function lt(e) {
|
|
1734
|
+
return e.deviceId === void 0 ? /* @__PURE__ */ m($, { name: "LiveStats" }) : /* @__PURE__ */ m(nt, { deviceId: e.deviceId });
|
|
1451
1735
|
}
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
};
|
|
1461
|
-
export {
|
|
1462
|
-
cn as default
|
|
1736
|
+
var ut = {
|
|
1737
|
+
"audio-history-chart": rt,
|
|
1738
|
+
"audio-metrics-panel": it,
|
|
1739
|
+
"occupancy-history-chart": at,
|
|
1740
|
+
"motion-history-chart": ot,
|
|
1741
|
+
"detection-history-chart": st,
|
|
1742
|
+
"live-occupancy-panel": ct,
|
|
1743
|
+
"live-stats": lt
|
|
1463
1744
|
};
|
|
1745
|
+
//#endregion
|
|
1746
|
+
export { ut as default };
|